blob: 6a1782a9563adb0bc7a0a5c3576e8a4cba8de250 (
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
|
#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);
OS_ASSERT(25, Segments_Initialize(&targ->linkage.segs));
OS_ASSERT(28, Overlays_Initialize(&targ->linkage.overlays));
OS_ASSERT(35, 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;
}
|