summaryrefslogtreecommitdiff
path: root/command_line/CmdLine/Src/CLTarg.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--command_line/CmdLine/Src/CLTarg.c55
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;
+}