diff options
author | Ash Wolf <ninji@wuffs.org> | 2022-10-19 21:16:13 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2022-10-19 21:16:13 +0100 |
commit | d1f153d34b023d81768f6087f67dbfff714bafc9 (patch) | |
tree | a694d470a60655d0cda15a70791fbdb90a2398cf /command_line/CmdLine/Src/CLTarg.c | |
parent | 775b6861666af36d317fb577cf489e2c6377f878 (diff) | |
download | MWCC-d1f153d34b023d81768f6087f67dbfff714bafc9.tar.gz MWCC-d1f153d34b023d81768f6087f67dbfff714bafc9.zip |
let's commit all this before my VM blows up and nukes my work
Diffstat (limited to '')
-rw-r--r-- | command_line/CmdLine/Src/CLTarg.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/command_line/CmdLine/Src/CLTarg.c b/command_line/CmdLine/Src/CLTarg.c index e69de29..a3f4389 100644 --- a/command_line/CmdLine/Src/CLTarg.c +++ b/command_line/CmdLine/Src/CLTarg.c @@ -0,0 +1,55 @@ +#include "cmdline.h" + +Target *Target_New(const char *name, OSType cpu, OSType os, OSType lang) { + Target *targ; + + targ = xcalloc("target", sizeof(Target)); + + strncpy(targ->targetName, name, sizeof(targ->targetName)); + targ->targetinfo = xcalloc("target info", sizeof(CWTargetInfo)); + targ->cpu = cpu; + targ->os = os; + targ->lang = lang; + + OS_GetCWD(&targ->outputDirectory); + +#line 25 + OPTION_ASSERT(Segments_Initialize(&targ->linkage.segs)); +#line 28 + OPTION_ASSERT(Overlays_Initialize(&targ->linkage.overlays)); +#line 35 + OPTION_ASSERT(Files_Initialize(&targ->files) && Files_Initialize(&targ->pchs) && VFiles_Initialize(&targ->virtualFiles) && + Paths_Initialize(&targ->sysPaths) && Paths_Initialize(&targ->userPaths) && Incls_Initialize(&targ->incls, targ)); + + return targ; +} + +void Target_Free(Target *targ) { + Segments_Terminate(&targ->linkage.segs); + Overlays_Terminate(&targ->linkage.overlays); + Paths_Terminate(&targ->sysPaths); + Paths_Terminate(&targ->userPaths); + Files_Terminate(&targ->files); + Files_Terminate(&targ->pchs); + VFiles_Terminate(&targ->virtualFiles); + Incls_Terminate(&targ->incls); + xfree(targ); +} + +void Targets_Term(Target *list) { + Target *scan; + Target *next; + + for (scan = list; scan; scan = next) { + next = scan->next; + Target_Free(scan); + } +} + +void Target_Add(Target **list, Target *targ) { + Target **scan; + + for (scan = list; *scan; scan = &(*scan)->next) {} + + *scan = targ; +} |