diff options
| -rw-r--r-- | build.sh | 0 | ||||
| -rw-r--r-- | source/base/base_rand.h | 0 | ||||
| -rw-r--r-- | source/base/base_string.c | 0 | ||||
| -rwxr-xr-x | source/scb/scb.c | 8 | ||||
| -rw-r--r-- | source/scb/scb.h | 82 |
5 files changed, 90 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/build.sh | |||
diff --git a/source/base/base_rand.h b/source/base/base_rand.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/base/base_rand.h | |||
diff --git a/source/base/base_string.c b/source/base/base_string.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/base/base_string.c | |||
diff --git a/source/scb/scb.c b/source/scb/scb.c new file mode 100755 index 0000000..d81f244 --- /dev/null +++ b/source/scb/scb.c | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #include "scb.h" | ||
| 2 | |||
| 3 | s32 main(s32 argument_count, char **argument, char **env) | ||
| 4 | { | ||
| 5 | assert_msg(argument_count < 2, "no arguments passed to scb"); | ||
| 6 | init(argument_count, argument, env); | ||
| 7 | |||
| 8 | } | ||
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 | } | ||
