Skip to content

Commit

Permalink
establish
Browse files Browse the repository at this point in the history
  • Loading branch information
jackutea committed Jan 5, 2024
1 parent c0c9e86 commit b7c2007
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"files.associations": {
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript",
"utf8.h": "c"
}
}
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Dependancies
utf8.h - https://github.com/sheredom/utf8.h
raylib - https://github.com/raysan5/raylib
Binary file added bin/lingc.exe
Binary file not shown.
Binary file added bin/raylib.dll
Binary file not shown.
10 changes: 10 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@REM mkdir if not exist .\build
if not exist .\build mkdir .\build
gcc -o .\build\main.o -c .\src\main.c

if not exist .\bin mkdir .\bin
gcc -o .\bin\lingc.exe .\build\main.o .\lib\win_64\raylib.dll

copy .\lib\win_64\raylib.dll .\bin\raylib.dll

@echo Build Done!
Binary file added build/main.o
Binary file not shown.
Binary file added lib/win_64/libraylib.a
Binary file not shown.
Binary file added lib/win_64/libraylibdll.a
Binary file not shown.
Binary file added lib/win_64/raylib.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions rebuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
@REM delete if exist .\bin
if exist .\bin rmdir /s /q .\bin
@REM delete if exist .\build
if exist .\build rmdir /s /q .\build

call build.bat
@echo on
2 changes: 2 additions & 0 deletions run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
call build.bat
.\bin\lingc.exe
12 changes: 12 additions & 0 deletions src/Entities_Source/E_Function.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "import.h"
#include "E_Function.h"

typedef struct {
int id;
int index;
string name;
string returns[RULE_FUNCTION_RETURN_MAX];
byte returns_count;
string params[RULE_FUNCTION_PARAM_MAX];
byte params_count;
} E_Function;
6 changes: 6 additions & 0 deletions src/Entities_Source/E_Function.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef E_FUNCTION_H__
#define E_FUNCTION_H__

typedef struct E_Function E_Function;

#endif
9 changes: 9 additions & 0 deletions src/Entities_Source/E_StaticVar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "import.h"
#include "E_StaticVar.h"

typedef struct {
int id;
int index;
string name;
string value;
} E_StaticVar;
6 changes: 6 additions & 0 deletions src/Entities_Source/E_StaticVar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef E_STATICVAR_H__
#define E_STATICVAR_H__

typedef struct E_StaticVar E_StaticVar;

#endif
6 changes: 6 additions & 0 deletions src/Entities_Source/export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef ENTITIES_SOURCE_EXPORT_H__
#define ENTITIES_SOURCE_EXPORT_H__

#include "E_StaticVar.h"

#endif
6 changes: 6 additions & 0 deletions src/Entities_Source/import.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef ENTITIES_SOURCE_IMPORT_H__
#define ENTITIES_SOURCE_IMPORT_H__

#include "../Generic.h"

#endif
22 changes: 22 additions & 0 deletions src/Generic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef GENERIC_H__
#define GENERIC_H__

#include <utf8.h>

#ifndef bool
#define bool unsigned char
#define true 1
#define false 0
#endif

#define PLogNA(x) printf("%s:%d %s", __FILE__, __LINE__, x)
#define PLog(x, ...) printf("%s:%d ", __FILE__, __LINE__); printf(x, __VA_ARGS__)

#define string utf8_int8_t *
#define byte unsigned char

// ==== Rule ====
const int RULE_FUNCTION_RETURN_MAX = 8;
const int RULE_FUNCTION_PARAM_MAX = 32;

#endif
6 changes: 6 additions & 0 deletions src/Repo/RP_Source.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef RP_SOURCE_H__
#define RP_SOURCE_H__

typedef struct RP_Source RP_Source;

#endif
18 changes: 18 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <raylib.h>
#include <stdio.h>
#include "Generic.h"

int main(int argc, char **argv) {
string str = "Hello, world!%d\n";
PLog(str,4);
#if DEBUG_DRAW
InitWindow(800, 600, "Hello, world!");
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
EndDrawing();
}
CloseWindow();
#endif
return 0;
}
23 changes: 23 additions & 0 deletions tests/Main.ling
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import io;

public struct ST {

public i8 a;
motheronly i16 b;
external i32 c;
internal bool d;

public fn void Log() {
Console.Log(a.ToString());
}

}

public fn i32 Main() {
Console.Log("Hello World!");
return 0;
}

fn i32, i32 Out(i32 a, i32 b) {
return a, b;
}

0 comments on commit b7c2007

Please sign in to comment.