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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 32
#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg;
typedef struct tyObject_Defect__WFlDaIWu7hFOKoGSG7uH7g tyObject_Defect__WFlDaIWu7hFOKoGSG7uH7g;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tySequence__S89cE01OvNjsN9c71FKsSrqQ tySequence__S89cE01OvNjsN9c71FKsSrqQ;
typedef struct tySequence__S89cE01OvNjsN9c71FKsSrqQ_Content tySequence__S89cE01OvNjsN9c71FKsSrqQ_Content;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content;
typedef struct tyObject_StackTraceEntry__RcJz5RXFIYjIseutvVFICA tyObject_StackTraceEntry__RcJz5RXFIYjIseutvVFICA;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
void* vTable[SEQ_DECL_SIZE];
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__S89cE01OvNjsN9c71FKsSrqQ {
NI len; tySequence__S89cE01OvNjsN9c71FKsSrqQ_Content* p;
};
struct Exception {
RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringV2 message;
tySequence__S89cE01OvNjsN9c71FKsSrqQ trace;
Exception* up;
};
struct tyObject_Defect__WFlDaIWu7hFOKoGSG7uH7g {
Exception Sup;
};
struct tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg {
tyObject_Defect__WFlDaIWu7hFOKoGSG7uH7g Sup;
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
NI len; tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content* p;
};
struct tyObject_StackTraceEntry__RcJz5RXFIYjIseutvVFICA {
NCSTRING procname;
NI line;
NCSTRING filename;
};
struct tySequence__S89cE01OvNjsN9c71FKsSrqQ_Content { NI cap; tyObject_StackTraceEntry__RcJz5RXFIYjIseutvVFICA data[SEQ_DECL_SIZE]; };
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content { NI cap; NimStringV2 data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(NimStringV2, cstrToNimstr)(NCSTRING str_p0);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2594)(NimStringV2* dest_p0);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, copyMem__system_u1713)(void* dest_p0, void* source_p1, NI size_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u3)(NI x_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u2597)(NimStringV2 dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e_p0, NCSTRING ename_p1, NCSTRING procname_p2, NCSTRING filename_p3, NI line_p4);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void*, newSeqPayload)(NI cap_p0, NI elemSize_p1, NI elemAlign_p2);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1);
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s_p0, NI addLen_p1);
N_LIB_PRIVATE N_NIMCALL(void, add__stdZenumutils_u71)(tySequence__sM4lkSb7zS6F7OVMvW9cffQ* x_p0, NimStringV2 y_p1);
extern TNimTypeV2 NTIv2__9cIOj9cQBZH8lEZvCihI6Eyg_;
static const struct {
NI cap; NIM_CHAR data[43+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_2 = { 43 | NIM_STRLIT_FLAG, "index out of bounds, the container is empty" };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_3 = {43, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_2};
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_4 = { 6 | NIM_STRLIT_FLAG, "index " };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_5 = {6, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_4};
static const struct {
NI cap; NIM_CHAR data[13+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_6 = { 13 | NIM_STRLIT_FLAG, " not in 0 .. " };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_7 = {13, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_6};
static const struct {
NI cap; NIM_CHAR data[0+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_8 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_9 = {0, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_8};
extern int cmdCount;
extern NCSTRING* cmdLine;
extern NIM_BOOL nimInErrorMode__system_u4272;
N_LIB_PRIVATE N_NIMCALL(NI, paramCount__stdZcmdline_u62)(void) {
NI result;
result = ((NI) ((NI32)(cmdCount - ((NI32)1))));
return result;
}
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, copyMem__system_u1713)(void* dest_p0, void* source_p1, NI size_p2) {
nimCopyMem(dest_p0, source_p1, size_p2);
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
{
if (!(((NI)0) < src_p1.len)) goto LA3_;
copyMem__system_u1713(((void*) ((&(*(*dest_p0).p).data[(*dest_p0).len]))), ((void*) ((&(*src_p1.p).data[((NI)0)]))), ((NI)(src_p1.len + ((NI)1))));
(*dest_p0).len += src_p1.len;
}
LA3_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4272);
return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, paramStr__stdZcmdline_u56)(NI i_p0) {
NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result.len = 0; result.p = NIM_NIL;
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = (((NI32) (i_p0)) < cmdCount);
if (!(T3_)) goto LA4_;
T3_ = (((NI)0) <= i_p0);
LA4_: ;
if (!T3_) goto LA5_;
result = cstrToNimstr(cmdLine[i_p0]);
}
goto LA1_;
LA5_: ;
{
NimStringV2 colontmpD_;
NimStringV2 colontmpD__2;
tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg* T9_;
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
T9_ = NIM_NIL;
T9_ = (tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg*) nimNewObj(sizeof(tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg), NIM_ALIGNOF(tyObject_IndexDefect__9cIOj9cQBZH8lEZvCihI6Eyg));
(*T9_).Sup.Sup.Sup.m_type = (&NTIv2__9cIOj9cQBZH8lEZvCihI6Eyg_);
(*T9_).Sup.Sup.name = "IndexDefect";
{
NimStringV2 blitTmp;
if (!((NI32)(cmdCount - ((NI32)1)) < ((NI32)0))) goto LA12_;
colontmpD_ = TM__MZPGKsURfItHSi3RvnOT8Q_3;
blitTmp = colontmpD_;
eqwasMoved___system_u2594((&colontmpD_));
(*T9_).Sup.Sup.message = blitTmp;
}
goto LA10_;
LA12_: ;
{
NimStringV2 colontmpD__3;
NimStringV2 colontmpD__4;
NimStringV2 T15_;
NimStringV2 blitTmp_2;
colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
colontmpD__4.len = 0; colontmpD__4.p = NIM_NIL;
T15_.len = 0; T15_.p = NIM_NIL;
colontmpD__3 = dollar___systemZdollars_u3(i_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA8_;
colontmpD__4 = dollar___systemZdollars_u3(((NI) ((NI32)(cmdCount - ((NI32)1)))));
if (NIM_UNLIKELY(*nimErr_)) goto LA8_;
T15_ = rawNewString(colontmpD__3.len + colontmpD__4.len + 19);
appendString((&T15_), TM__MZPGKsURfItHSi3RvnOT8Q_5);
appendString((&T15_), colontmpD__3);
appendString((&T15_), TM__MZPGKsURfItHSi3RvnOT8Q_7);
appendString((&T15_), colontmpD__4);
colontmpD__2 = T15_;
eqdestroy___system_u2597(colontmpD__4);
eqdestroy___system_u2597(colontmpD__3);
blitTmp_2 = colontmpD__2;
eqwasMoved___system_u2594((&colontmpD__2));
(*T9_).Sup.Sup.message = blitTmp_2;
}
LA10_: ;
(*T9_).Sup.Sup.parent = ((Exception*) NIM_NIL);
raiseExceptionEx((Exception*)T9_, "IndexDefect", "paramStr", "cmdline.nim", 274);
goto LA8_;
{
LA8_:;
}
{
eqdestroy___system_u2597(colontmpD__2);
eqdestroy___system_u2597(colontmpD_);
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA1_: ;
}BeforeRet_: ;
return result;
}
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1) {
prepareAdd(s_p0, ((NI)1));
(*(*s_p0).p).data[(*s_p0).len] = c_p1;
(*s_p0).len += ((NI)1);
(*(*s_p0).p).data[(*s_p0).len] = 0;
}
N_LIB_PRIVATE N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ, nosparseCmdLine)(NimStringV2 c_p0) {
tySequence__sM4lkSb7zS6F7OVMvW9cffQ result;
NimStringV2 a;
NI i;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result.len = 0; result.p = NIM_NIL;
a.len = 0; a.p = NIM_NIL;
result.len = 0; result.p = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content*) newSeqPayload(0, sizeof(NimStringV2), NIM_ALIGNOF(NimStringV2));
i = ((NI)0);
a = TM__MZPGKsURfItHSi3RvnOT8Q_9;
{
while (1) {
NimStringV2 T26_;
setLengthStrV2((&a), ((NI)0));
{
while (1) {
NIM_BOOL T6_;
T6_ = (NIM_BOOL)0;
T6_ = (i < c_p0.len);
if (!(T6_)) goto LA7_;
T6_ = (((NU8)(c_p0.p->data[i])) == ((NU8)(32)) || ((NU8)(c_p0.p->data[i])) == ((NU8)(9)) || ((NU8)(c_p0.p->data[i])) == ((NU8)(10)) || ((NU8)(c_p0.p->data[i])) == ((NU8)(13)));
LA7_: ;
if (!T6_) goto LA5;
i += ((NI)1);
} LA5: ;
}
{
if (!(c_p0.len <= i)) goto LA10_;
goto LA2;
}
LA10_: ;
switch (((NU8)(c_p0.p->data[i]))) {
case 39:
case 34:
{
NIM_CHAR delim;
delim = c_p0.p->data[i];
i += ((NI)1);
{
while (1) {
NIM_BOOL T15_;
T15_ = (NIM_BOOL)0;
T15_ = (i < c_p0.len);
if (!(T15_)) goto LA16_;
T15_ = !(((NU8)(c_p0.p->data[i]) == (NU8)(delim)));
LA16_: ;
if (!T15_) goto LA14;
nimAddCharV1((&a), c_p0.p->data[i]);
i += ((NI)1);
} LA14: ;
}
{
if (!(i < c_p0.len)) goto LA19_;
i += ((NI)1);
}
LA19_: ;
}
break;
default:
{
{
while (1) {
NIM_BOOL T24_;
T24_ = (NIM_BOOL)0;
T24_ = (i < c_p0.len);
if (!(T24_)) goto LA25_;
T24_ = ((NU8)(32) < (NU8)(c_p0.p->data[i]));
LA25_: ;
if (!T24_) goto LA23;
nimAddCharV1((&a), c_p0.p->data[i]);
i += ((NI)1);
} LA23: ;
}
}
break;
}
T26_.len = 0; T26_.p = NIM_NIL;
T26_ = a;
eqwasMoved___system_u2594((&a));
add__stdZenumutils_u71((&result), T26_);
}
} LA2: ;
{
LA1_:;
}
{
eqdestroy___system_u2597(a);
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
return result;
}
|