diff options
| author | nasr <nsrddyn@gmail.com> | 2026-04-14 23:11:40 +0200 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-04-14 23:11:40 +0200 |
| commit | 4d2a2af0c7d4eec9a9e43e0ba08813fdebaf8f9c (patch) | |
| tree | 339f3001e570d5e37946a46849a0ff5a4d238b19 /source/scb/scb.h | |
feature(setup): defininig the setup of the project
Diffstat (limited to 'source/scb/scb.h')
| -rw-r--r-- | source/scb/scb.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/source/scb/scb.h b/source/scb/scb.h new file mode 100644 index 0000000..39f5e89 --- /dev/null +++ b/source/scb/scb.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* descrition: meta program, build tool | ||
| 2 | author: Abdellah El Morabit */ | ||
| 3 | #define BASE_UNITY | ||
| 4 | #include "../base/base_include.h" | ||
| 5 | |||
| 6 | #define scbdef static | ||
| 7 | |||
| 8 | typedef struct config config; | ||
| 9 | |||
| 10 | struct config { | ||
| 11 | string8 compiler; | ||
| 12 | string8 output; | ||
| 13 | string8 flags[]; | ||
| 14 | }; | ||
| 15 | |||
| 16 | |||
| 17 | internal void | ||
| 18 | self_rebuild(const char *binary_path) | ||
| 19 | { | ||
| 20 | |||
| 21 | struct stat scb_binary_stats; | ||
| 22 | assert_msg((lstat(binary_path), &sb == -1),"\nlstat failed to initialize\n"); | ||
| 23 | |||
| 24 | if(ctime(&sb.st_mtime)) | ||
| 25 | { | ||
| 26 | |||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | //@documentatie: hebfjlberln | ||
| 31 | internal void | ||
| 32 | init(int argument_count, char **argument, char **env) | ||
| 33 | { | ||
| 34 | mem_arena *global_arena = arena_create(KiB(2)); | ||
| 35 | assert_msg(argument_count > 2, "no program passed"); | ||
| 36 | |||
| 37 | string8 command = PushString(global_arena, Len(*argument[2])); | ||
| 38 | |||
| 39 | command.data = (u8 *) *argument; | ||
| 40 | command.size = Len(*argument[2]); | ||
| 41 | |||
| 42 | //- load files into buffer | ||
| 43 | { | ||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | //- TODO(nasr): ... | ||
| 48 | } | ||
| 49 | |||
| 50 | if(string8_cmp(command, StringCast("doc", 3))) | ||
| 51 | { | ||
| 52 | //- run meta program that builds tool documentation | ||
| 53 | //- hmmm how do i store the documentation | ||
| 54 | { | ||
| 55 | } | ||
| 56 | } | ||
| 57 | else if(string8_cmp(command, StringCast("build", 5))) | ||
| 58 | { | ||
| 59 | |||
| 60 | |||
| 61 | //- search for the binary in PATH | ||
| 62 | { | ||
| 63 | for(s32 index = 0; *env[index]; ++index) | ||
| 64 | { | ||
| 65 | |||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | //- run the simple build tool | ||
| 70 | pid_t pid = fork(); | ||
| 71 | assert_msg(pid == -1, "failed to start fork process"); | ||
| 72 | |||
| 73 | |||
| 74 | if(pid == 0) { | ||
| 75 | |||
| 76 | } | ||
| 77 | } | ||
| 78 | else if(string8_cmp(command, StringCast("meta", 5))) | ||
| 79 | { | ||
| 80 | //- run the meta program | ||
| 81 | } | ||
| 82 | } | ||
