summaryrefslogtreecommitdiff
path: root/source/scb/scb.h
blob: 39f5e89e678bb91b2e626cc1523255e6481e1090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* descrition: meta program, build tool
   author: Abdellah El Morabit */
#define BASE_UNITY
#include "../base/base_include.h"

#define  scbdef static

typedef struct config config;

struct config {
    string8 compiler;
    string8 output;
    string8 flags[];
};


internal void
self_rebuild(const char *binary_path)
{

    struct stat scb_binary_stats;
    assert_msg((lstat(binary_path), &sb == -1),"\nlstat failed to initialize\n");

    if(ctime(&sb.st_mtime))
    {
        
    }
}

//@documentatie: hebfjlberln
internal void
init(int argument_count, char **argument, char **env) 
{
    mem_arena *global_arena = arena_create(KiB(2));
    assert_msg(argument_count > 2, "no program passed");

    string8 command = PushString(global_arena, Len(*argument[2]));

    command.data = (u8 *) *argument;
    command.size = Len(*argument[2]);

    //- load files into buffer
    {



        //- TODO(nasr): ...
    }

    if(string8_cmp(command, StringCast("doc", 3))) 
    {
        //- run meta program that builds tool documentation 
        //- hmmm how do i store the documentation
        {
        }
    } 
    else if(string8_cmp(command, StringCast("build", 5))) 
    {


        //- search for the binary in PATH
        {
            for(s32 index = 0; *env[index]; ++index)
            {

            }
        }

        //- run the simple build tool
        pid_t pid = fork();
        assert_msg(pid == -1, "failed to start fork process");


        if(pid == 0) {

        }
    }
    else if(string8_cmp(command, StringCast("meta", 5))) 
    {
        //- run the meta program
    }
}