1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 32
3
4 #include "nimbase.h"
5 #include <string.h>
6 #undef LANGUAGE_C
7 #undef MIPSEB
8 #undef MIPSEL
9 #undef PPC
10 #undef R3000
11 #undef R4000
12 #undef i386
13 #undef linux
14 #undef mips
15 #undef near
16 #undef far
17 #undef powerpc
18 #undef unix
19 #define nimfr_(x, y)
20 #define nimln_(x, y)
21 typedef struct NimStringDesc NimStringDesc;
22 typedef struct TGenericSeq TGenericSeq;
23 typedef struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
24 struct TGenericSeq {
25 NI len;
26 NI reserved;
27 };
28 struct NimStringDesc {
29 TGenericSeq Sup;
30 NIM_CHAR data[SEQ_DECL_SIZE];
31 };
32 struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
33 NimStringDesc* Field0;
34 NimStringDesc* Field1;
35 NimStringDesc* Field2;
36 };
37 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep);
38 static N_INLINE(NIM_BOOL, isEmpty__pathutils_93)(NimStringDesc* x);
39 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
40 N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
41 N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_71)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep);
42 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path);
43 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
44 static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail);
45 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
46 N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result);
47 static N_INLINE(void, nimZeroMem)(void* p, NI size);
48 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
49 N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
50 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, slash___pathutils_89)(NimStringDesc* base, NimStringDesc* f);
N_NIMCALL(NimStringDesc *,relativeTo__pathutils_132)51 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, relativeTo__pathutils_132)(NimStringDesc* fullPath, NimStringDesc* baseFilename, NIM_CHAR sep) {
52 NimStringDesc* result;
53 result = NIM_NIL;
54 result = nosrelativePath(fullPath, baseFilename, sep);
55 return result;
56 }
N_INLINE(NIM_BOOL,isEmpty__pathutils_93)57 static N_INLINE(NIM_BOOL, isEmpty__pathutils_93)(NimStringDesc* x) {
58 NIM_BOOL result;
59 result = (NIM_BOOL)0;
60 result = ((x ? x->Sup.len : 0) == ((NI) 0));
61 return result;
62 }
N_NIMCALL(NimStringDesc *,slash___pathutils_111)63 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, slash___pathutils_111)(NimStringDesc* base, NimStringDesc* f) {
64 NimStringDesc* result;
65 NimStringDesc* base_2;
66 NI state;
67 result = NIM_NIL;
68 {
69 NIM_BOOL T3_;
70 T3_ = (NIM_BOOL)0;
71 T3_ = isEmpty__pathutils_93(base);
72 if (!T3_) goto LA4_;
73 base_2 = nosgetCurrentDir();
74 }
75 goto LA1_;
76 LA4_: ;
77 {
78 base_2 = base;
79 }
80 LA1_: ;
81 result = rawNewString(((NI) ((NI)((base_2 ? base_2->Sup.len : 0) + (f ? f->Sup.len : 0)))));
82 state = ((NI) 0);
83 addNormalizePath__pureZpathnorm_71(base_2, (&result), (&state), 47);
84 addNormalizePath__pureZpathnorm_71(f, (&result), (&state), 47);
85 return result;
86 }
N_INLINE(NimStringDesc *,slash___pureZos_121)87 static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail) {
88 NimStringDesc* result;
89 result = NIM_NIL;
90 result = nosjoinPath(head, tail);
91 return result;
92 }
N_NIMCALL(NimStringDesc *,toAbsoluteDir__pathutils_71)93 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, toAbsoluteDir__pathutils_71)(NimStringDesc* path) {
94 NimStringDesc* result;
95 result = NIM_NIL;
96 {
97 NIM_BOOL T3_;
98 T3_ = (NIM_BOOL)0;
99 T3_ = nosisAbsolute(path);
100 if (!T3_) goto LA4_;
101 result = copyString(path);
102 }
103 goto LA1_;
104 LA4_: ;
105 {
106 NimStringDesc* T7_;
107 T7_ = NIM_NIL;
108 T7_ = nosgetCurrentDir();
109 result = slash___pureZos_121(T7_, path);
110 }
111 LA1_: ;
112 return result;
113 }
N_NIMCALL(NimStringDesc *,slash___pathutils_89)114 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, slash___pathutils_89)(NimStringDesc* base, NimStringDesc* f) {
115 NimStringDesc* result;
116 NimStringDesc* base_2;
117 NI state;
118 result = NIM_NIL;
119 {
120 NIM_BOOL T3_;
121 T3_ = (NIM_BOOL)0;
122 T3_ = isEmpty__pathutils_93(base);
123 if (!T3_) goto LA4_;
124 base_2 = nosgetCurrentDir();
125 }
126 goto LA1_;
127 LA4_: ;
128 {
129 base_2 = base;
130 }
131 LA1_: ;
132 result = rawNewString(((NI) ((NI)((base_2 ? base_2->Sup.len : 0) + (f ? f->Sup.len : 0)))));
133 state = ((NI) 0);
134 addNormalizePath__pureZpathnorm_71(base_2, (&result), (&state), 47);
135 addNormalizePath__pureZpathnorm_71(f, (&result), (&state), 47);
136 return result;
137 }
N_INLINE(void,nimSetMem__systemZmemory_7)138 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
139 void* T1_;
140 T1_ = (void*)0;
141 T1_ = memset(a, v, ((size_t) (size)));
142 }
N_INLINE(void,nimZeroMem)143 static N_INLINE(void, nimZeroMem)(void* p, NI size) {
144 nimSetMem__systemZmemory_7(p, ((int) 0), size);
145 }
N_NIMCALL(void,splitFile__pathutils_26)146 N_LIB_PRIVATE N_NIMCALL(void, splitFile__pathutils_26)(NimStringDesc* x, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result) {
147 tyTuple__7q7q3E6Oj24ZNVJb9aonhAg T1_;
148 NimStringDesc* a;
149 NimStringDesc* b;
150 NimStringDesc* c;
151 NimStringDesc* colontmp_;
152 NimStringDesc* colontmp__2;
153 NimStringDesc* colontmp__3;
154 nimZeroMem((void*)(&T1_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
155 nossplitFile(x, (&T1_));
156 a = NIM_NIL;
157 a = T1_.Field0;
158 b = NIM_NIL;
159 b = T1_.Field1;
160 c = NIM_NIL;
161 c = T1_.Field2;
162 colontmp_ = copyString(a);
163 colontmp__2 = copyString(b);
164 colontmp__3 = copyString(c);
165 unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp_));
166 unsureAsgnRef((void**) (&(*Result).Field1), copyString(colontmp__2));
167 unsureAsgnRef((void**) (&(*Result).Field2), copyString(colontmp__3));
168 }
N_NIMCALL(NimStringDesc *,toAbsolute__pathutils_137)169 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, toAbsolute__pathutils_137)(NimStringDesc* file, NimStringDesc* base) {
170 NimStringDesc* result;
171 result = NIM_NIL;
172 {
173 NIM_BOOL T3_;
174 T3_ = (NIM_BOOL)0;
175 T3_ = nosisAbsolute(file);
176 if (!T3_) goto LA4_;
177 result = copyString(file);
178 }
179 goto LA1_;
180 LA4_: ;
181 {
182 result = slash___pathutils_89(base, file);
183 }
184 LA1_: ;
185 return result;
186 }
187