summaryrefslogtreecommitdiff
path: root/source/scb
diff options
context:
space:
mode:
Diffstat (limited to 'source/scb')
-rwxr-xr-xsource/scb/scb.c5
-rw-r--r--source/scb/scb.h41
2 files changed, 30 insertions, 16 deletions
diff --git a/source/scb/scb.c b/source/scb/scb.c
index d81f244..2a6cf43 100755
--- a/source/scb/scb.c
+++ b/source/scb/scb.c
@@ -1,8 +1,11 @@
1#include "scb.h" 1#include "scb.h"
2 2
3s32 main(s32 argument_count, char **argument, char **env) 3int main(s32 argument_count, char **argument, char **env)
4{ 4{
5 mem_arena *global_arena = arena_create(MiB(10));
5 assert_msg(argument_count < 2, "no arguments passed to scb"); 6 assert_msg(argument_count < 2, "no arguments passed to scb");
6 init(argument_count, argument, env); 7 init(argument_count, argument, env);
7 8
9 arena_destroy(global_arena);
10 return 0;
8} 11}
diff --git a/source/scb/scb.h b/source/scb/scb.h
index 39f5e89..09c4852 100644
--- a/source/scb/scb.h
+++ b/source/scb/scb.h
@@ -13,23 +13,30 @@ struct config {
13 string8 flags[]; 13 string8 flags[];
14}; 14};
15 15
16 16typedef struct file_metad file_metad;
17internal void 17struct file_metad
18self_rebuild(const char *binary_path)
19{ 18{
19 string8 name;
20 u32 time;
21};
20 22
21 struct stat scb_binary_stats; 23internal b32
22 assert_msg((lstat(binary_path), &sb == -1),"\nlstat failed to initialize\n"); 24is_file_modified(const char *path)
25{
26 struct stat scb_bstats;
27 s8 err = lstat(path, &scb_bstats);
28 assert_msg((err), "lstat failed.");
23 29
24 if(ctime(&sb.st_mtime)) 30 if(scb_bstats.st_mtime)
25 { 31 {
26 32
27 } 33 }
34 return 0;
28} 35}
29 36
30//@documentatie: hebfjlberln 37//@documentatie: hebfjlberln
31internal void 38internal void
32init(int argument_count, char **argument, char **env) 39init(int argument_count, char **argument, char **env)
33{ 40{
34 mem_arena *global_arena = arena_create(KiB(2)); 41 mem_arena *global_arena = arena_create(KiB(2));
35 assert_msg(argument_count > 2, "no program passed"); 42 assert_msg(argument_count > 2, "no program passed");
@@ -41,20 +48,22 @@ init(int argument_count, char **argument, char **env)
41 48
42 //- load files into buffer 49 //- load files into buffer
43 { 50 {
44 51 if(is_file_modified)
45 52 {
53 self_rebuild();
54 }
46 55
47 //- TODO(nasr): ... 56 //- TODO(nasr): ...
48 } 57 }
49 58
50 if(string8_cmp(command, StringCast("doc", 3))) 59 if(string8_cmp(command, StringCastUTF8("doc", 3)))
51 { 60 {
52 //- run meta program that builds tool documentation 61 //- run meta program that builds tool documentation
53 //- hmmm how do i store the documentation 62 //- hmmm how do i store the documentation
54 { 63 {
55 } 64 }
56 } 65 }
57 else if(string8_cmp(command, StringCast("build", 5))) 66 else if(string8_cmp(command, StringCast("build", 5)))
58 { 67 {
59 68
60 69
@@ -75,8 +84,10 @@ init(int argument_count, char **argument, char **env)
75 84
76 } 85 }
77 } 86 }
78 else if(string8_cmp(command, StringCast("meta", 5))) 87 else if(string8_cmp(command, StringCast("meta", 5)))
79 { 88 {
80 //- run the meta program 89 //- run the meta program
81 } 90 }
91
92 return;
82} 93}