1471 lines
44 KiB
C
1471 lines
44 KiB
C
/* Generated by Nim Compiler v1.9.0 */
|
|
#define NIM_INTBITS 32
|
|
|
|
#include "nimbase.h"
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <errno.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
|
|
#define nimfr_(x, y)
|
|
#define nimln_(x, y)
|
|
typedef struct NimStrPayload NimStrPayload;
|
|
typedef struct NimStringV2 NimStringV2;
|
|
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
|
|
typedef struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
|
|
typedef struct tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw;
|
|
typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
|
|
typedef struct Exception Exception;
|
|
typedef struct RootObj RootObj;
|
|
typedef struct TNimTypeV2 TNimTypeV2;
|
|
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
|
|
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA_Content tySequence__uB9b75OUPRENsBAu4AnoePA_Content;
|
|
typedef struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg;
|
|
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
|
|
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;
|
|
struct NimStrPayload {
|
|
NI cap;
|
|
NIM_CHAR data[SEQ_DECL_SIZE];
|
|
};
|
|
struct NimStringV2 {
|
|
NI len;
|
|
NimStrPayload* p;
|
|
};
|
|
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
|
|
NimStringV2 Field0;
|
|
NimStringV2 Field1;
|
|
};
|
|
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
|
|
NimStringV2 Field0;
|
|
NimStringV2 Field1;
|
|
NimStringV2 Field2;
|
|
};
|
|
struct TNimTypeV2 {
|
|
void* destructor;
|
|
NI size;
|
|
NI16 align;
|
|
NI16 depth;
|
|
NU32* display;
|
|
void* traceImpl;
|
|
void* typeInfoV1;
|
|
NI flags;
|
|
};
|
|
struct RootObj {
|
|
TNimTypeV2* m_type;
|
|
};
|
|
struct tySequence__uB9b75OUPRENsBAu4AnoePA {
|
|
NI len; tySequence__uB9b75OUPRENsBAu4AnoePA_Content* p;
|
|
};
|
|
struct Exception {
|
|
RootObj Sup;
|
|
Exception* parent;
|
|
NCSTRING name;
|
|
NimStringV2 message;
|
|
tySequence__uB9b75OUPRENsBAu4AnoePA trace;
|
|
Exception* up;
|
|
};
|
|
struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
|
|
Exception Sup;
|
|
};
|
|
struct tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw {
|
|
tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
|
|
};
|
|
struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg {
|
|
NI i;
|
|
NI prev;
|
|
NIM_BOOL notFirst;
|
|
};
|
|
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
|
|
NI Field0;
|
|
NI Field1;
|
|
};
|
|
struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
|
|
NCSTRING procname;
|
|
NI line;
|
|
NCSTRING filename;
|
|
};
|
|
|
|
|
|
#ifndef tySequence__uB9b75OUPRENsBAu4AnoePA_Content_PP
|
|
#define tySequence__uB9b75OUPRENsBAu4AnoePA_Content_PP
|
|
struct tySequence__uB9b75OUPRENsBAu4AnoePA_Content { NI cap; tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];};
|
|
#endif
|
|
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___stdZassertions_16)(NimStringV2* dest, NimStringV2 src);
|
|
N_NIMCALL(NimStringV2, rawNewString)(NI cap);
|
|
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__stdZprivateZospaths50_52)(NimStringV2* result, NI* state, NimStringV2 tail);
|
|
static N_INLINE(NIM_CHAR, X5BX5D___system_7017)(NimStringV2 s, NI i);
|
|
static N_INLINE(NIM_CHAR*, X5BX5D___system_7056)(NimStringV2* s, NI i);
|
|
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s);
|
|
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_2301)(NimStringV2* s);
|
|
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__stdZprivateZospaths50_23)(NimStringV2* path, NIM_BOOL trailingSep);
|
|
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s, NI newLen);
|
|
static N_INLINE(void, nimAddCharV1)(NimStringV2* s, NIM_CHAR c);
|
|
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s, NI addlen);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqsink___stdZassertions_19)(NimStringV2* dest, NimStringV2 src);
|
|
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_77)(NimStringV2 x, NimStringV2* result, NI* state, NIM_CHAR dirSep);
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePathEnd__stdZprivateZospaths50_45)(NimStringV2 path, NIM_BOOL trailingSep);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path);
|
|
static N_INLINE(void, nimZeroMem)(void* p, NI size);
|
|
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
|
|
N_LIB_PRIVATE N_NIMCALL(tyTuple__UV3llMMYFckfui8YMBuUZA, nossplitPath)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_7528)(NimStringV2 s, NI first, NI last);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_7540)(NimStringV2 s, NI first);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZprivateZospaths50_292)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZassertions_13)(NimStringV2* dest);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePath__pureZpathnorm_137)(NimStringV2 path, NIM_CHAR dirSep);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, cmp__system_1543)(NimStringV2 x, NimStringV2 y);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringV2 a, NimStringV2 b);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosrelativePath)(NimStringV2 path, NimStringV2 base, NIM_CHAR sep);
|
|
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a, NimStringV2 b);
|
|
static N_INLINE(NIM_BOOL, equalMem__system_1727)(void* a, void* b, NI size);
|
|
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
|
|
static N_INLINE(void, normalizePathAux__stdZprivateZospaths50_18)(NimStringV2* path);
|
|
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringV2* path);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePathInternal__stdZprivateZospaths50_21)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePath__stdZprivateZospaths50_343)(NimStringV2 path, NimStringV2 root);
|
|
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size, NI alignment);
|
|
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src);
|
|
static N_INLINE(void, copyMem__system_1719)(void* dest, void* source, NI size);
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
|
|
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head, NimStringV2 tail);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetCurrentDir)(void);
|
|
N_NIMCALL(NimStringV2, mnewString)(NI len);
|
|
static N_INLINE(NIM_BOOL, eqeq___system_7494)(NCSTRING x, NCSTRING y);
|
|
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_85)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_224)(NimStringV2 msg);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_82)(NI32 errorCode, NimStringV2 additionalInfo);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__pureZpathnorm_6)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringV2 x);
|
|
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__pureZpathnorm_10)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringV2 x);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringV2 s, NimStringV2 prefix);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__stdZprivateZospaths50_166)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__stdZprivateZospaths50_245)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normExt__stdZprivateZospaths50_242)(NimStringV2 ext);
|
|
static N_INLINE(void, appendChar)(NimStringV2* dest, NIM_CHAR c);
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[1+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_2 = { 1 | NIM_STRLIT_FLAG, "/" };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_3 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_2};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[0+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_4 = { 0 | NIM_STRLIT_FLAG, "" };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_5 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_6 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_7 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[1+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_8 = { 1 | NIM_STRLIT_FLAG, "." };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_9 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_8};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_10 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
extern TNimTypeV2 NTIv2__ke0esfQKJkTSUu9bpZ7VlFw_;
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[36+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_11 = { 36 | NIM_STRLIT_FLAG, "The specified root is not absolute: " };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_12 = {36, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_11};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[37+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_13 = { 37 | NIM_STRLIT_FLAG, "ospaths2.nim(885, 21) `bufsize >= 0` " };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_14 = {37, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_13};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_15 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[2+1];
|
|
} TM__O1zDbSYyG8zQytyoZAh0dg_17 = { 2 | NIM_STRLIT_FLAG, ".." };
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_18 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_17};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_19 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_8};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_20 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_17};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_21 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_17};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_22 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_8};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_23 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
|
|
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_24 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_8};
|
|
static NIM_CONST tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ TM__O1zDbSYyG8zQytyoZAh0dg_16 = {((NI)0),
|
|
((NI)-1)}
|
|
;
|
|
extern NIM_BOOL nimInErrorMode__system_3994;
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosunixToNativePath)(NimStringV2 path, NimStringV2 drive) {
|
|
NimStringV2 result;
|
|
result.len = 0; result.p = NIM_NIL;
|
|
eqcopy___stdZassertions_16((&result), path);
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_CHAR, X5BX5D___system_7017)(NimStringV2 s, NI i) {
|
|
NIM_CHAR result;
|
|
result = (NIM_CHAR)0;
|
|
result = s.p->data[(NI)(s.len - i)];
|
|
return result;
|
|
}
|
|
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s) {
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = !(((*s).p == ((NimStrPayload*) NIM_NIL)));
|
|
if (!(T3_)) goto LA4_;
|
|
T3_ = ((NI)((*(*s).p).cap & ((NI)1073741824)) == ((NI)1073741824));
|
|
LA4_: ;
|
|
if (!T3_) goto LA5_;
|
|
nimPrepareStrMutationImpl__system_2301(s);
|
|
}
|
|
LA5_: ;
|
|
}
|
|
static N_INLINE(NIM_CHAR*, X5BX5D___system_7056)(NimStringV2* s, NI i) {
|
|
NIM_CHAR* result;
|
|
result = (NIM_CHAR*)0;
|
|
nimPrepareStrMutationV2((&(*s)));
|
|
result = (&(*s).p->data[(NI)((*s).len - i)]);
|
|
return result;
|
|
}
|
|
static N_INLINE(void, nimAddCharV1)(NimStringV2* s, NIM_CHAR c) {
|
|
prepareAdd(s, ((NI)1));
|
|
(*(*s).p).data[(*s).len] = c;
|
|
(*(*s).p).data[(NI)((*s).len + ((NI)1))] = 0;
|
|
(*s).len += ((NI)1);
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__stdZprivateZospaths50_23)(NimStringV2* path, NIM_BOOL trailingSep) {
|
|
NI i;
|
|
{ {
|
|
if (!((*path).len == ((NI)0))) goto LA3_;
|
|
goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
i = (*path).len;
|
|
{
|
|
while (1) {
|
|
if (!(((NI)1) <= i)) goto LA6 ;
|
|
{
|
|
if (!(((NU8)((*path).p->data[(NI)(i - ((NI)1))])) == ((NU8)(47)) || ((NU8)((*path).p->data[(NI)(i - ((NI)1))])) == ((NU8)(47)))) goto LA9_;
|
|
i -= ((NI)1);
|
|
}
|
|
goto LA7_;
|
|
LA9_: ;
|
|
{
|
|
NIM_BOOL T12_;
|
|
NIM_BOOL T13_;
|
|
T12_ = (NIM_BOOL)0;
|
|
T13_ = (NIM_BOOL)0;
|
|
T13_ = ((NU8)((*path).p->data[(NI)(i - ((NI)1))]) == (NU8)(46));
|
|
if (!(T13_)) goto LA14_;
|
|
T13_ = (((NI)2) <= i);
|
|
LA14_: ;
|
|
T12_ = T13_;
|
|
if (!(T12_)) goto LA15_;
|
|
T12_ = (((NU8)((*path).p->data[(NI)(i - ((NI)2))])) == ((NU8)(47)) || ((NU8)((*path).p->data[(NI)(i - ((NI)2))])) == ((NU8)(47)));
|
|
LA15_: ;
|
|
if (!T12_) goto LA16_;
|
|
i -= ((NI)1);
|
|
}
|
|
goto LA7_;
|
|
LA16_: ;
|
|
{
|
|
goto LA5;
|
|
}
|
|
LA7_: ;
|
|
} LA6: ;
|
|
} LA5: ;
|
|
{
|
|
if (!trailingSep) goto LA21_;
|
|
setLengthStrV2((&(*path)), ((NI) (i)));
|
|
nimAddCharV1((&(*path)), 47);
|
|
}
|
|
goto LA19_;
|
|
LA21_: ;
|
|
{
|
|
if (!(((NI)0) < i)) goto LA24_;
|
|
setLengthStrV2((&(*path)), ((NI) (i)));
|
|
}
|
|
goto LA19_;
|
|
LA24_: ;
|
|
{
|
|
eqsink___stdZassertions_19((&(*path)), TM__O1zDbSYyG8zQytyoZAh0dg_3);
|
|
}
|
|
LA19_: ;
|
|
}BeforeRet_: ;
|
|
}
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
|
|
NIM_BOOL* result;
|
|
result = (NIM_BOOL*)0;
|
|
result = (&nimInErrorMode__system_3994);
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__stdZprivateZospaths50_52)(NimStringV2* result, NI* state, NimStringV2 tail) {
|
|
NIM_BOOL trailingSep;
|
|
NIM_BOOL T1_;
|
|
NIM_BOOL T2_;
|
|
NIM_CHAR T4_;
|
|
NIM_BOOL T6_;
|
|
NIM_BOOL T8_;
|
|
NIM_CHAR* T10_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
T1_ = (NIM_BOOL)0;
|
|
T2_ = (NIM_BOOL)0;
|
|
T2_ = (((NI)0) < tail.len);
|
|
if (!(T2_)) goto LA3_;
|
|
T4_ = (NIM_CHAR)0;
|
|
T4_ = X5BX5D___system_7017(tail, ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T2_ = (((NU8)(T4_)) == ((NU8)(47)) || ((NU8)(T4_)) == ((NU8)(47)));
|
|
LA3_: ;
|
|
T1_ = T2_;
|
|
if (T1_) goto LA5_;
|
|
T6_ = (NIM_BOOL)0;
|
|
T6_ = (tail.len == ((NI)0));
|
|
if (!(T6_)) goto LA7_;
|
|
T8_ = (NIM_BOOL)0;
|
|
T8_ = (((NI)0) < (*result).len);
|
|
if (!(T8_)) goto LA9_;
|
|
T10_ = (NIM_CHAR*)0;
|
|
T10_ = X5BX5D___system_7056(result, ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T8_ = (((NU8)((*T10_))) == ((NU8)(47)) || ((NU8)((*T10_))) == ((NU8)(47)));
|
|
LA9_: ;
|
|
T6_ = T8_;
|
|
LA7_: ;
|
|
T1_ = T6_;
|
|
LA5_: ;
|
|
trailingSep = T1_;
|
|
normalizePathEnd__stdZprivateZospaths50_23(result, NIM_FALSE);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
addNormalizePath__pureZpathnorm_77(tail, result, state, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
normalizePathEnd__stdZprivateZospaths50_23(result, trailingSep);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head, NimStringV2 tail) {
|
|
NimStringV2 result;
|
|
NI state;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
result = rawNewString(((NI) ((NI)(head.len + tail.len))));
|
|
state = ((NI)0);
|
|
joinPathImpl__stdZprivateZospaths50_52((&result), (&state), head);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
joinPathImpl__stdZprivateZospaths50_52((&result), (&state), tail);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePathEnd__stdZprivateZospaths50_45)(NimStringV2 path, NIM_BOOL trailingSep) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
eqcopy___stdZassertions_16((&result), path);
|
|
normalizePathEnd__stdZprivateZospaths50_23((&result), trailingSep);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
|
|
void* T1_;
|
|
T1_ = (void*)0;
|
|
T1_ = memset(a, v, ((size_t) (size)));
|
|
}
|
|
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
nimSetMem__systemZmemory_7(p, ((int)0), size);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(tyTuple__UV3llMMYFckfui8YMBuUZA, nossplitPath)(NimStringV2 path) {
|
|
tyTuple__UV3llMMYFckfui8YMBuUZA result;
|
|
NI sepPos;
|
|
nimZeroMem((void*)(&result), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
|
|
sepPos = ((NI)-1);
|
|
{
|
|
NI i;
|
|
NI colontmp_;
|
|
NI res;
|
|
i = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = (NI)(path.len - ((NI)1));
|
|
res = colontmp_;
|
|
{
|
|
while (1) {
|
|
if (!(((NI)0) <= res)) goto LA3 ;
|
|
i = res;
|
|
{
|
|
if (!(((NU8)(path.p->data[i])) == ((NU8)(47)) || ((NU8)(path.p->data[i])) == ((NU8)(47)))) goto LA6_;
|
|
sepPos = i;
|
|
goto LA1;
|
|
}
|
|
LA6_: ;
|
|
res -= ((NI)1);
|
|
} LA3: ;
|
|
}
|
|
} LA1: ;
|
|
{
|
|
NI colontmpD_;
|
|
NI colontmpD__2;
|
|
NI T12_;
|
|
NimStringV2 T19_;
|
|
NimStringV2 T20_;
|
|
if (!(((NI)0) <= sepPos)) goto LA10_;
|
|
colontmpD_ = (NI)0;
|
|
colontmpD__2 = (NI)0;
|
|
T12_ = (NI)0;
|
|
{
|
|
NIM_BOOL T15_;
|
|
T15_ = (NIM_BOOL)0;
|
|
T15_ = NIM_LIKELY((((NI)1) <= sepPos));
|
|
if (!T15_) goto LA16_;
|
|
colontmpD_ = (NI)(sepPos - ((NI)1));
|
|
T12_ = colontmpD_;
|
|
}
|
|
goto LA13_;
|
|
LA16_: ;
|
|
{
|
|
colontmpD__2 = ((NI)0);
|
|
T12_ = colontmpD__2;
|
|
}
|
|
LA13_: ;
|
|
T19_.len = 0; T19_.p = NIM_NIL;
|
|
T19_ = substr__system_7528(path, ((NI)0), T12_);
|
|
eqsink___stdZassertions_19((&result.Field0), T19_);
|
|
T20_.len = 0; T20_.p = NIM_NIL;
|
|
T20_ = substr__system_7540(path, (NI)(sepPos + ((NI)1)));
|
|
eqsink___stdZassertions_19((&result.Field1), T20_);
|
|
}
|
|
goto LA8_;
|
|
LA10_: ;
|
|
{
|
|
eqsink___stdZassertions_19((&result.Field0), TM__O1zDbSYyG8zQytyoZAh0dg_6);
|
|
eqcopy___stdZassertions_16((&result.Field1), path);
|
|
}
|
|
LA8_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZprivateZospaths50_292)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest) {
|
|
eqdestroy___stdZassertions_13((&(*dest).Field0));
|
|
eqdestroy___stdZassertions_13((&(*dest).Field1));
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = (path.len == ((NI)0));
|
|
if (T3_) goto LA4_;
|
|
T3_ = (((NU8)(path.p->data[(NI)(path.len - ((NI)1))])) == ((NU8)(47)) || ((NU8)(path.p->data[(NI)(path.len - ((NI)1))])) == ((NU8)(47)));
|
|
LA4_: ;
|
|
if (!T3_) goto LA5_;
|
|
result = TM__O1zDbSYyG8zQytyoZAh0dg_5;
|
|
}
|
|
goto LA1_;
|
|
LA5_: ;
|
|
{
|
|
tyTuple__UV3llMMYFckfui8YMBuUZA colontmpD_;
|
|
nimZeroMem((void*)(&colontmpD_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
|
|
colontmpD_ = nossplitPath(path);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqcopy___stdZassertions_16((&result), colontmpD_.Field1);
|
|
eqdestroy___stdZprivateZospaths50_292((&colontmpD_));
|
|
}
|
|
LA1_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, noslastPathPart)(NimStringV2 path) {
|
|
NimStringV2 result;
|
|
NimStringV2 path_2;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
path_2.len = 0; path_2.p = NIM_NIL;
|
|
path_2 = normalizePathEnd__stdZprivateZospaths50_45(path, NIM_FALSE);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
result = nosextractFilename(path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqdestroy___stdZassertions_13((&path_2));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NI, noscmpPaths)(NimStringV2 pathA, NimStringV2 pathB) {
|
|
NI result;
|
|
NimStringV2 a;
|
|
NimStringV2 b;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NI)0;
|
|
a.len = 0; a.p = NIM_NIL;
|
|
b.len = 0; b.p = NIM_NIL;
|
|
a = normalizePath__pureZpathnorm_137(pathA, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
b = normalizePath__pureZpathnorm_137(pathB, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
if (!NIM_TRUE) goto LA3_;
|
|
result = cmp__system_1543(a, b);
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
result = nsuCmpIgnoreCase(a, b);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA1_: ;
|
|
eqdestroy___stdZassertions_13((&b));
|
|
eqdestroy___stdZassertions_13((&a));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg, nossplitFile)(NimStringV2 path) {
|
|
tyTuple__7q7q3E6Oj24ZNVJb9aonhAg result;
|
|
NI namePos;
|
|
NI dotPos;
|
|
nimZeroMem((void*)(&result), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
|
|
namePos = ((NI)0);
|
|
dotPos = ((NI)0);
|
|
{
|
|
NI i;
|
|
NI colontmp_;
|
|
NI res;
|
|
i = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = (NI)(path.len - ((NI)1));
|
|
res = colontmp_;
|
|
{
|
|
while (1) {
|
|
if (!(((NI)0) <= res)) goto LA3 ;
|
|
i = res;
|
|
{
|
|
NIM_BOOL T6_;
|
|
T6_ = (NIM_BOOL)0;
|
|
T6_ = (((NU8)(path.p->data[i])) == ((NU8)(47)) || ((NU8)(path.p->data[i])) == ((NU8)(47)));
|
|
if (T6_) goto LA7_;
|
|
T6_ = (i == ((NI)0));
|
|
LA7_: ;
|
|
if (!T6_) goto LA8_;
|
|
{
|
|
NI colontmpD_;
|
|
NI colontmpD__2;
|
|
NI T14_;
|
|
NimStringV2 T21_;
|
|
if (!(((NU8)(path.p->data[i])) == ((NU8)(47)) || ((NU8)(path.p->data[i])) == ((NU8)(47)))) goto LA12_;
|
|
colontmpD_ = (NI)0;
|
|
colontmpD__2 = (NI)0;
|
|
T14_ = (NI)0;
|
|
{
|
|
NIM_BOOL T17_;
|
|
T17_ = (NIM_BOOL)0;
|
|
T17_ = NIM_LIKELY((((NI)1) <= i));
|
|
if (!T17_) goto LA18_;
|
|
colontmpD_ = (NI)(i - ((NI)1));
|
|
T14_ = colontmpD_;
|
|
}
|
|
goto LA15_;
|
|
LA18_: ;
|
|
{
|
|
colontmpD__2 = ((NI)0);
|
|
T14_ = colontmpD__2;
|
|
}
|
|
LA15_: ;
|
|
T21_.len = 0; T21_.p = NIM_NIL;
|
|
T21_ = substr__system_7528(path, ((NI)0), T14_);
|
|
eqsink___stdZassertions_19((&result.Field0), T21_);
|
|
namePos = (NI)(i + ((NI)1));
|
|
}
|
|
LA12_: ;
|
|
{
|
|
NimStringV2 T26_;
|
|
NimStringV2 T27_;
|
|
if (!(i < dotPos)) goto LA24_;
|
|
T26_.len = 0; T26_.p = NIM_NIL;
|
|
T26_ = substr__system_7528(path, namePos, (NI)(dotPos - ((NI)1)));
|
|
eqsink___stdZassertions_19((&result.Field1), T26_);
|
|
T27_.len = 0; T27_.p = NIM_NIL;
|
|
T27_ = substr__system_7540(path, dotPos);
|
|
eqsink___stdZassertions_19((&result.Field2), T27_);
|
|
}
|
|
goto LA22_;
|
|
LA24_: ;
|
|
{
|
|
NimStringV2 T29_;
|
|
T29_.len = 0; T29_.p = NIM_NIL;
|
|
T29_ = substr__system_7540(path, namePos);
|
|
eqsink___stdZassertions_19((&result.Field1), T29_);
|
|
}
|
|
LA22_: ;
|
|
goto LA1;
|
|
}
|
|
goto LA4_;
|
|
LA8_: ;
|
|
{
|
|
NIM_BOOL T31_;
|
|
NIM_BOOL T32_;
|
|
NIM_BOOL T33_;
|
|
NIM_BOOL T34_;
|
|
NIM_BOOL T35_;
|
|
T31_ = (NIM_BOOL)0;
|
|
T32_ = (NIM_BOOL)0;
|
|
T33_ = (NIM_BOOL)0;
|
|
T34_ = (NIM_BOOL)0;
|
|
T35_ = (NIM_BOOL)0;
|
|
T35_ = ((NU8)(path.p->data[i]) == (NU8)(46));
|
|
if (!(T35_)) goto LA36_;
|
|
T35_ = (((NI)0) < i);
|
|
LA36_: ;
|
|
T34_ = T35_;
|
|
if (!(T34_)) goto LA37_;
|
|
T34_ = (i < (NI)(path.len - ((NI)1)));
|
|
LA37_: ;
|
|
T33_ = T34_;
|
|
if (!(T33_)) goto LA38_;
|
|
T33_ = !((((NU8)(path.p->data[(NI)(i - ((NI)1))])) == ((NU8)(47)) || ((NU8)(path.p->data[(NI)(i - ((NI)1))])) == ((NU8)(47))));
|
|
LA38_: ;
|
|
T32_ = T33_;
|
|
if (!(T32_)) goto LA39_;
|
|
T32_ = !(((NU8)(path.p->data[(NI)(i + ((NI)1))]) == (NU8)(46)));
|
|
LA39_: ;
|
|
T31_ = T32_;
|
|
if (!(T31_)) goto LA40_;
|
|
T31_ = (dotPos == ((NI)0));
|
|
LA40_: ;
|
|
if (!T31_) goto LA41_;
|
|
dotPos = i;
|
|
}
|
|
goto LA4_;
|
|
LA41_: ;
|
|
LA4_: ;
|
|
res -= ((NI)1);
|
|
} LA3: ;
|
|
}
|
|
} LA1: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZos_231)(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* dest) {
|
|
eqdestroy___stdZassertions_13((&(*dest).Field0));
|
|
eqdestroy___stdZassertions_13((&(*dest).Field1));
|
|
eqdestroy___stdZassertions_13((&(*dest).Field2));
|
|
}
|
|
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size) {
|
|
int result;
|
|
result = (int)0;
|
|
result = memcmp(a, b, ((size_t) (size)));
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_BOOL, equalMem__system_1727)(void* a, void* b, NI size) {
|
|
NIM_BOOL result;
|
|
int T1_;
|
|
result = (NIM_BOOL)0;
|
|
T1_ = (int)0;
|
|
T1_ = nimCmpMem(a, b, size);
|
|
result = (T1_ == ((NI32)0));
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a, NimStringV2 b) {
|
|
NIM_BOOL result;
|
|
NI alen;
|
|
NI blen;
|
|
{ result = (NIM_BOOL)0;
|
|
alen = a.len;
|
|
blen = b.len;
|
|
{
|
|
if (!(alen == blen)) goto LA3_;
|
|
{
|
|
if (!(alen == ((NI)0))) goto LA7_;
|
|
result = NIM_TRUE;
|
|
goto BeforeRet_;
|
|
}
|
|
LA7_: ;
|
|
result = equalMem__system_1727(((void*) ((&a.p->data[((NI)0)]))), ((void*) ((&b.p->data[((NI)0)]))), ((NI) (alen)));
|
|
goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringV2* path) {
|
|
NimStringV2 T1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
T1_.len = 0; T1_.p = NIM_NIL;
|
|
T1_ = normalizePath__pureZpathnorm_137((*path), 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqsink___stdZassertions_19((&(*path)), T1_);
|
|
}BeforeRet_: ;
|
|
}
|
|
static N_INLINE(void, normalizePathAux__stdZprivateZospaths50_18)(NimStringV2* path) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
nosnormalizePath(path);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringV2 path) {
|
|
NIM_BOOL result;
|
|
{ result = (NIM_BOOL)0;
|
|
{
|
|
if (!(path.len == ((NI)0))) goto LA3_;
|
|
result = NIM_FALSE;
|
|
goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
result = ((NU8)(path.p->data[((NI)0)]) == (NU8)(47));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
|
|
void* T1_;
|
|
T1_ = (void*)0;
|
|
T1_ = memcpy(dest, source, ((size_t) (size)));
|
|
}
|
|
static N_INLINE(void, copyMem__system_1719)(void* dest, void* source, NI size) {
|
|
nimCopyMem(dest, source, size);
|
|
}
|
|
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src) {
|
|
{
|
|
if (!(((NI)0) < src.len)) goto LA3_;
|
|
copyMem__system_1719(((void*) ((&(*(*dest).p).data[(*dest).len]))), ((void*) ((&(*src.p).data[((NI)0)]))), ((NI) ((NI)(src.len + ((NI)1)))));
|
|
(*dest).len += src.len;
|
|
}
|
|
LA3_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePath__stdZprivateZospaths50_343)(NimStringV2 path, NimStringV2 root) {
|
|
NimStringV2 result;
|
|
NimStringV2 T1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
T1_.len = 0; T1_.p = NIM_NIL;
|
|
{
|
|
NIM_BOOL T4_;
|
|
T4_ = (NIM_BOOL)0;
|
|
T4_ = nosisAbsolute(path);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (!T4_) goto LA5_;
|
|
eqcopy___stdZassertions_16((&result), path);
|
|
}
|
|
goto LA2_;
|
|
LA5_: ;
|
|
{
|
|
{
|
|
NIM_BOOL T10_;
|
|
tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw* T13_;
|
|
NimStringV2 T14_;
|
|
T10_ = (NIM_BOOL)0;
|
|
T10_ = nosisAbsolute(root);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (!!(T10_)) goto LA11_;
|
|
T13_ = NIM_NIL;
|
|
T13_ = (tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw*) nimNewObj(sizeof(tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw), NIM_ALIGNOF(tyObject_ValueError__ke0esfQKJkTSUu9bpZ7VlFw));
|
|
(*T13_).Sup.Sup.Sup.m_type = (&NTIv2__ke0esfQKJkTSUu9bpZ7VlFw_);
|
|
(*T13_).Sup.Sup.name = "ValueError";
|
|
T14_.len = 0; T14_.p = NIM_NIL;
|
|
T14_ = rawNewString(root.len + 36);
|
|
appendString((&T14_), TM__O1zDbSYyG8zQytyoZAh0dg_12);
|
|
appendString((&T14_), root);
|
|
(*T13_).Sup.Sup.message = T14_;
|
|
(*T13_).Sup.Sup.parent = ((Exception*) NIM_NIL);
|
|
raiseExceptionEx((Exception*)T13_, "ValueError", "absolutePath", "ospaths2.nim", 904);
|
|
goto BeforeRet_;
|
|
}
|
|
LA11_: ;
|
|
result = nosjoinPath(root, path);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA2_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_BOOL, eqeq___system_7494)(NCSTRING x, NCSTRING y) {
|
|
NIM_BOOL result;
|
|
result = (NIM_BOOL)0;
|
|
{
|
|
if (!(((void*) (x)) == ((void*) (y)))) goto LA3_;
|
|
result = NIM_TRUE;
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
NIM_BOOL T6_;
|
|
T6_ = (NIM_BOOL)0;
|
|
T6_ = (x == 0);
|
|
if (T6_) goto LA7_;
|
|
T6_ = (y == 0);
|
|
LA7_: ;
|
|
if (!T6_) goto LA8_;
|
|
result = NIM_FALSE;
|
|
}
|
|
goto LA1_;
|
|
LA8_: ;
|
|
{
|
|
int T11_;
|
|
T11_ = (int)0;
|
|
T11_ = strcmp(x, y);
|
|
result = (T11_ == ((NI32)0));
|
|
}
|
|
LA1_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s) {
|
|
NCSTRING result;
|
|
result = (NCSTRING)0;
|
|
{
|
|
if (!(s.len == ((NI)0))) goto LA3_;
|
|
result = "";
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
result = ((NCSTRING) ((*s.p).data));
|
|
}
|
|
LA1_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetCurrentDir)(void) {
|
|
NimStringV2 result;
|
|
NI bufsize;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
bufsize = ((NI)1024);
|
|
result = mnewString(((NI) (bufsize)));
|
|
{
|
|
while (1) {
|
|
{
|
|
NCSTRING T5_;
|
|
NIM_BOOL T6_;
|
|
size_t T9_;
|
|
T5_ = (NCSTRING)0;
|
|
T5_ = getcwd(nimToCStringConv(result), bufsize);
|
|
T6_ = (NIM_BOOL)0;
|
|
T6_ = eqeq___system_7494(T5_, ((NCSTRING) NIM_NIL));
|
|
if (!!(T6_)) goto LA7_;
|
|
T9_ = (size_t)0;
|
|
T9_ = strlen(nimToCStringConv(result));
|
|
setLengthStrV2((&result), ((NI) (T9_)));
|
|
goto LA1;
|
|
}
|
|
goto LA3_;
|
|
LA7_: ;
|
|
{
|
|
NI32 err;
|
|
err = osLastError__stdZoserrors_85();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NimStringV2 T19_;
|
|
if (!(err == ERANGE)) goto LA13_;
|
|
bufsize = (NI)((NU32)(bufsize) << (NU32)(((NI)1)));
|
|
{
|
|
if (!!((((NI)0) <= bufsize))) goto LA17_;
|
|
failedAssertImpl__stdZassertions_224(TM__O1zDbSYyG8zQytyoZAh0dg_14);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA17_: ;
|
|
T19_.len = 0; T19_.p = NIM_NIL;
|
|
T19_ = mnewString(((NI) (bufsize)));
|
|
eqsink___stdZassertions_19((&result), T19_);
|
|
}
|
|
goto LA11_;
|
|
LA13_: ;
|
|
{
|
|
NI32 T21_;
|
|
T21_ = (NI32)0;
|
|
T21_ = osLastError__stdZoserrors_85();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
raiseOSError__stdZoserrors_82(T21_, TM__O1zDbSYyG8zQytyoZAh0dg_15);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA11_: ;
|
|
}
|
|
LA3_: ;
|
|
}
|
|
} LA1: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePathInternal__stdZprivateZospaths50_21)(NimStringV2 path) {
|
|
NimStringV2 result;
|
|
NimStringV2 colontmpD_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
colontmpD_ = nosgetCurrentDir();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
result = absolutePath__stdZprivateZospaths50_343(path, colontmpD_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosrelativePath)(NimStringV2 path, NimStringV2 base, NIM_CHAR sep) {
|
|
NimStringV2 result;
|
|
NimStringV2 base_2;
|
|
NimStringV2 path_2;
|
|
NimStringV2 T6_;
|
|
NIM_BOOL a1;
|
|
NIM_BOOL a2;
|
|
tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg f;
|
|
tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg b;
|
|
tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ ff;
|
|
tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bb;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
base_2.len = 0; base_2.p = NIM_NIL;
|
|
path_2.len = 0; path_2.p = NIM_NIL;
|
|
{
|
|
if (!(path.len == ((NI)0))) goto LA4_;
|
|
result = TM__O1zDbSYyG8zQytyoZAh0dg_7;
|
|
eqdestroy___stdZassertions_13((&path_2));
|
|
eqdestroy___stdZassertions_13((&base_2));
|
|
goto BeforeRet_;
|
|
}
|
|
LA4_: ;
|
|
T6_.len = 0; T6_.p = NIM_NIL;
|
|
{
|
|
if (!eqStrings(base, TM__O1zDbSYyG8zQytyoZAh0dg_9)) goto LA9_;
|
|
base_2 = TM__O1zDbSYyG8zQytyoZAh0dg_10;
|
|
}
|
|
goto LA7_;
|
|
LA9_: ;
|
|
{
|
|
eqcopy___stdZassertions_16((&base_2), base);
|
|
}
|
|
LA7_: ;
|
|
eqcopy___stdZassertions_16((&path_2), path);
|
|
normalizePathAux__stdZprivateZospaths50_18((&path_2));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
normalizePathAux__stdZprivateZospaths50_18((&base_2));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
a1 = nosisAbsolute(path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
a2 = nosisAbsolute(base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
NIM_BOOL T14_;
|
|
NimStringV2 T18_;
|
|
T14_ = (NIM_BOOL)0;
|
|
T14_ = a1;
|
|
if (!(T14_)) goto LA15_;
|
|
T14_ = !(a2);
|
|
LA15_: ;
|
|
if (!T14_) goto LA16_;
|
|
T18_.len = 0; T18_.p = NIM_NIL;
|
|
T18_ = absolutePathInternal__stdZprivateZospaths50_21(base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
eqsink___stdZassertions_19((&base_2), T18_);
|
|
}
|
|
goto LA12_;
|
|
LA16_: ;
|
|
{
|
|
NIM_BOOL T20_;
|
|
NimStringV2 T24_;
|
|
T20_ = (NIM_BOOL)0;
|
|
T20_ = a2;
|
|
if (!(T20_)) goto LA21_;
|
|
T20_ = !(a1);
|
|
LA21_: ;
|
|
if (!T20_) goto LA22_;
|
|
T24_.len = 0; T24_.p = NIM_NIL;
|
|
T24_ = absolutePathInternal__stdZprivateZospaths50_21(path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
eqsink___stdZassertions_19((&path_2), T24_);
|
|
}
|
|
goto LA12_;
|
|
LA22_: ;
|
|
LA12_: ;
|
|
nimZeroMem((void*)(&f), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
|
|
nimZeroMem((void*)(&b), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
|
|
ff = TM__O1zDbSYyG8zQytyoZAh0dg_16;
|
|
bb = TM__O1zDbSYyG8zQytyoZAh0dg_16;
|
|
result = rawNewString(((NI) (path_2.len)));
|
|
{
|
|
while (1) {
|
|
NIM_BOOL T27_;
|
|
NI diff;
|
|
NIM_BOOL same;
|
|
NI colontmp_;
|
|
NI colontmp__2;
|
|
NI colontmp__3;
|
|
NI colontmp__4;
|
|
T27_ = (NIM_BOOL)0;
|
|
T27_ = hasNext__pureZpathnorm_6(f, path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
if (!(T27_)) goto LA28_;
|
|
T27_ = hasNext__pureZpathnorm_6(b, base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
LA28_: ;
|
|
if (!T27_) goto LA26 ;
|
|
ff = next__pureZpathnorm_10((&f), path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
bb = next__pureZpathnorm_10((&b), base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
diff = (NI)(ff.Field1 - ff.Field0);
|
|
{
|
|
if (!!((diff == (NI)(bb.Field1 - bb.Field0)))) goto LA31_;
|
|
goto LA25;
|
|
}
|
|
LA31_: ;
|
|
same = NIM_TRUE;
|
|
{
|
|
NI i;
|
|
NI res;
|
|
i = (NI)0;
|
|
res = ((NI)0);
|
|
{
|
|
while (1) {
|
|
if (!(res <= diff)) goto LA35 ;
|
|
i = res;
|
|
{
|
|
if (!!(((NU8)(path_2.p->data[(NI)(i + ff.Field0)]) == (NU8)(base_2.p->data[(NI)(i + bb.Field0)])))) goto LA38_;
|
|
same = NIM_FALSE;
|
|
goto LA33;
|
|
}
|
|
LA38_: ;
|
|
res += ((NI)1);
|
|
} LA35: ;
|
|
}
|
|
} LA33: ;
|
|
{
|
|
if (!!(same)) goto LA42_;
|
|
goto LA25;
|
|
}
|
|
LA42_: ;
|
|
colontmp_ = ((NI)0);
|
|
colontmp__2 = ((NI)-1);
|
|
ff.Field0 = colontmp_;
|
|
ff.Field1 = colontmp__2;
|
|
colontmp__3 = ((NI)0);
|
|
colontmp__4 = ((NI)-1);
|
|
bb.Field0 = colontmp__3;
|
|
bb.Field1 = colontmp__4;
|
|
} LA26: ;
|
|
} LA25: ;
|
|
{
|
|
while (1) {
|
|
{
|
|
if (!(bb.Field0 <= bb.Field1)) goto LA48_;
|
|
{
|
|
NIM_BOOL T52_;
|
|
NIM_CHAR* T54_;
|
|
T52_ = (NIM_BOOL)0;
|
|
T52_ = (((NI)0) < result.len);
|
|
if (!(T52_)) goto LA53_;
|
|
T54_ = (NIM_CHAR*)0;
|
|
T54_ = X5BX5D___system_7056((&result), ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T52_ = !(((NU8)((*T54_)) == (NU8)(sep)));
|
|
LA53_: ;
|
|
if (!T52_) goto LA55_;
|
|
nimAddCharV1((&result), sep);
|
|
}
|
|
LA55_: ;
|
|
prepareAdd((&result), 2);
|
|
appendString((&result), TM__O1zDbSYyG8zQytyoZAh0dg_18);
|
|
}
|
|
LA48_: ;
|
|
{
|
|
NIM_BOOL T59_;
|
|
T59_ = (NIM_BOOL)0;
|
|
T59_ = hasNext__pureZpathnorm_6(b, base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
if (!!(T59_)) goto LA60_;
|
|
goto LA44;
|
|
}
|
|
LA60_: ;
|
|
bb = next__pureZpathnorm_10((&b), base_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
} LA44: ;
|
|
{
|
|
while (1) {
|
|
{
|
|
if (!(ff.Field0 <= ff.Field1)) goto LA66_;
|
|
{
|
|
NIM_BOOL T70_;
|
|
NIM_CHAR* T72_;
|
|
T70_ = (NIM_BOOL)0;
|
|
T70_ = (((NI)0) < result.len);
|
|
if (!(T70_)) goto LA71_;
|
|
T72_ = (NIM_CHAR*)0;
|
|
T72_ = X5BX5D___system_7056((&result), ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T70_ = !(((NU8)((*T72_)) == (NU8)(sep)));
|
|
LA71_: ;
|
|
if (!T70_) goto LA73_;
|
|
nimAddCharV1((&result), sep);
|
|
}
|
|
LA73_: ;
|
|
{
|
|
NI i_2;
|
|
NI colontmp__5;
|
|
NI res_2;
|
|
i_2 = (NI)0;
|
|
colontmp__5 = (NI)0;
|
|
colontmp__5 = (NI)(ff.Field1 - ff.Field0);
|
|
res_2 = ((NI)0);
|
|
{
|
|
while (1) {
|
|
if (!(res_2 <= colontmp__5)) goto LA77 ;
|
|
i_2 = res_2;
|
|
nimAddCharV1((&result), path_2.p->data[(NI)(i_2 + ff.Field0)]);
|
|
res_2 += ((NI)1);
|
|
} LA77: ;
|
|
}
|
|
}
|
|
}
|
|
LA66_: ;
|
|
{
|
|
NIM_BOOL T80_;
|
|
T80_ = (NIM_BOOL)0;
|
|
T80_ = hasNext__pureZpathnorm_6(f, path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
if (!!(T80_)) goto LA81_;
|
|
goto LA62;
|
|
}
|
|
LA81_: ;
|
|
ff = next__pureZpathnorm_10((&f), path_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
} LA62: ;
|
|
{
|
|
if (!(result.len == ((NI)0))) goto LA85_;
|
|
prepareAdd((&result), 1);
|
|
appendString((&result), TM__O1zDbSYyG8zQytyoZAh0dg_19);
|
|
}
|
|
LA85_: ;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&path_2));
|
|
eqdestroy___stdZassertions_13((&base_2));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isRelativeTo__stdZprivateZospaths50_159)(NimStringV2 path, NimStringV2 base) {
|
|
NIM_BOOL result;
|
|
NimStringV2 path_2;
|
|
NimStringV2 base_2;
|
|
NimStringV2 ret;
|
|
NIM_BOOL T2_;
|
|
NIM_BOOL T4_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NIM_BOOL)0;
|
|
path_2.len = 0; path_2.p = NIM_NIL;
|
|
base_2.len = 0; base_2.p = NIM_NIL;
|
|
ret.len = 0; ret.p = NIM_NIL;
|
|
path_2 = normalizePath__pureZpathnorm_137(path, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
base_2 = normalizePath__pureZpathnorm_137(base, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
ret = nosrelativePath(path_2, base_2, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T2_ = (NIM_BOOL)0;
|
|
T2_ = (((NI)0) < path_2.len);
|
|
if (!(T2_)) goto LA3_;
|
|
T4_ = (NIM_BOOL)0;
|
|
T4_ = nsuStartsWith(ret, TM__O1zDbSYyG8zQytyoZAh0dg_20);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T2_ = !(T4_);
|
|
LA3_: ;
|
|
result = T2_;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&ret));
|
|
eqdestroy___stdZassertions_13((&base_2));
|
|
eqdestroy___stdZassertions_13((&path_2));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__stdZprivateZospaths50_166)(NimStringV2 path) {
|
|
NI result;
|
|
NI q;
|
|
{ result = (NI)0;
|
|
q = ((NI)1);
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = (((NI)1) <= path.len);
|
|
if (!(T3_)) goto LA4_;
|
|
T3_ = (((NU8)(path.p->data[(NI)(path.len - ((NI)1))])) == ((NU8)(47)) || ((NU8)(path.p->data[(NI)(path.len - ((NI)1))])) == ((NU8)(47)));
|
|
LA4_: ;
|
|
if (!T3_) goto LA5_;
|
|
q = ((NI)2);
|
|
}
|
|
LA5_: ;
|
|
{
|
|
NI i;
|
|
NI colontmp_;
|
|
NI res;
|
|
i = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = (NI)(path.len - q);
|
|
res = colontmp_;
|
|
{
|
|
while (1) {
|
|
if (!(((NI)0) <= res)) goto LA9 ;
|
|
i = res;
|
|
{
|
|
if (!(((NU8)(path.p->data[i])) == ((NU8)(47)) || ((NU8)(path.p->data[i])) == ((NU8)(47)))) goto LA12_;
|
|
result = i;
|
|
goto BeforeRet_;
|
|
}
|
|
LA12_: ;
|
|
res -= ((NI)1);
|
|
} LA9: ;
|
|
}
|
|
}
|
|
result = ((NI)-1);
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosparentDir)(NimStringV2 path) {
|
|
NimStringV2 result;
|
|
NI sepPos;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
result = normalizePath__pureZpathnorm_137(path, 47);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
sepPos = parentDirPos__stdZprivateZospaths50_166(result);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NimStringV2 T5_;
|
|
if (!(((NI)0) <= sepPos)) goto LA3_;
|
|
T5_.len = 0; T5_.p = NIM_NIL;
|
|
T5_ = substr__system_7528(result, ((NI)0), sepPos);
|
|
eqsink___stdZassertions_19((&result), T5_);
|
|
normalizePathEnd__stdZprivateZospaths50_23((&result), NIM_FALSE);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
NIM_BOOL T7_;
|
|
NIM_BOOL T8_;
|
|
NIM_BOOL T9_;
|
|
NIM_CHAR* T13_;
|
|
T7_ = (NIM_BOOL)0;
|
|
T8_ = (NIM_BOOL)0;
|
|
T9_ = (NIM_BOOL)0;
|
|
T9_ = eqStrings(result, TM__O1zDbSYyG8zQytyoZAh0dg_21);
|
|
if (T9_) goto LA10_;
|
|
T9_ = eqStrings(result, TM__O1zDbSYyG8zQytyoZAh0dg_22);
|
|
LA10_: ;
|
|
T8_ = T9_;
|
|
if (T8_) goto LA11_;
|
|
T8_ = (result.len == ((NI)0));
|
|
LA11_: ;
|
|
T7_ = T8_;
|
|
if (T7_) goto LA12_;
|
|
T13_ = (NIM_CHAR*)0;
|
|
T13_ = X5BX5D___system_7056((&result), ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T7_ = (((NU8)((*T13_))) == ((NU8)(47)) || ((NU8)((*T13_))) == ((NU8)(47)));
|
|
LA12_: ;
|
|
if (!T7_) goto LA14_;
|
|
eqsink___stdZassertions_19((&result), TM__O1zDbSYyG8zQytyoZAh0dg_23);
|
|
}
|
|
goto LA1_;
|
|
LA14_: ;
|
|
{
|
|
eqsink___stdZassertions_19((&result), TM__O1zDbSYyG8zQytyoZAh0dg_24);
|
|
}
|
|
LA1_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___stdZprivateZospaths50_295)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest, tyTuple__UV3llMMYFckfui8YMBuUZA src) {
|
|
eqcopy___stdZassertions_16((&(*dest).Field0), src.Field0);
|
|
eqcopy___stdZassertions_16((&(*dest).Field1), src.Field1);
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqsink___stdZprivateZospaths50_298)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest, tyTuple__UV3llMMYFckfui8YMBuUZA src) {
|
|
if ((*dest).Field0.p != src.Field0.p) { eqdestroy___stdZassertions_13((&(*dest).Field0));
|
|
}
|
|
(*dest).Field0.len = src.Field0.len; (*dest).Field0.p = src.Field0.p;
|
|
if ((*dest).Field1.p != src.Field1.p) { eqdestroy___stdZassertions_13((&(*dest).Field1));
|
|
}
|
|
(*dest).Field1.len = src.Field1.len; (*dest).Field1.p = src.Field1.p;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisRootDir)(NimStringV2 path) {
|
|
NIM_BOOL result;
|
|
NI T1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NIM_BOOL)0;
|
|
T1_ = (NI)0;
|
|
T1_ = parentDirPos__stdZprivateZospaths50_166(path);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
result = (T1_ < ((NI)0));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__stdZprivateZospaths50_245)(NimStringV2 path) {
|
|
NI result;
|
|
result = (NI)0;
|
|
result = ((NI)-1);
|
|
{
|
|
NI i;
|
|
NI colontmp_;
|
|
NI res;
|
|
i = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = (NI)(path.len - ((NI)1));
|
|
res = colontmp_;
|
|
{
|
|
while (1) {
|
|
if (!(((NI)1) <= res)) goto LA3 ;
|
|
i = res;
|
|
{
|
|
if (!((NU8)(path.p->data[i]) == (NU8)(46))) goto LA6_;
|
|
result = i;
|
|
goto LA1;
|
|
}
|
|
goto LA4_;
|
|
LA6_: ;
|
|
{
|
|
if (!(((NU8)(path.p->data[i])) == ((NU8)(47)) || ((NU8)(path.p->data[i])) == ((NU8)(47)))) goto LA9_;
|
|
goto LA1;
|
|
}
|
|
goto LA4_;
|
|
LA9_: ;
|
|
LA4_: ;
|
|
res -= ((NI)1);
|
|
} LA3: ;
|
|
}
|
|
} LA1: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(void, appendChar)(NimStringV2* dest, NIM_CHAR c) {
|
|
(*(*dest).p).data[(*dest).len] = c;
|
|
(*(*dest).p).data[(NI)((*dest).len + ((NI)1))] = 0;
|
|
(*dest).len += ((NI)1);
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normExt__stdZprivateZospaths50_242)(NimStringV2 ext) {
|
|
NimStringV2 result;
|
|
result.len = 0; result.p = NIM_NIL;
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = (ext.len == 0);
|
|
if (T3_) goto LA4_;
|
|
T3_ = ((NU8)(ext.p->data[((NI)0)]) == (NU8)(46));
|
|
LA4_: ;
|
|
if (!T3_) goto LA5_;
|
|
eqcopy___stdZassertions_16((&result), ext);
|
|
}
|
|
goto LA1_;
|
|
LA5_: ;
|
|
{
|
|
NimStringV2 T8_;
|
|
T8_.len = 0; T8_.p = NIM_NIL;
|
|
T8_ = rawNewString(ext.len + 1);
|
|
appendChar((&T8_), 46);
|
|
appendString((&T8_), ext);
|
|
result = T8_;
|
|
}
|
|
LA1_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, noschangeFileExt)(NimStringV2 filename, NimStringV2 ext) {
|
|
NimStringV2 result;
|
|
NI extPos;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
extPos = searchExtPos__stdZprivateZospaths50_245(filename);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 T5_;
|
|
if (!(extPos < ((NI)0))) goto LA3_;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
T5_.len = 0; T5_.p = NIM_NIL;
|
|
colontmpD_ = normExt__stdZprivateZospaths50_242(ext);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T5_ = rawNewString(filename.len + colontmpD_.len + 0);
|
|
appendString((&T5_), filename);
|
|
appendString((&T5_), colontmpD_);
|
|
result = T5_;
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
NimStringV2 colontmpD__2;
|
|
NimStringV2 colontmpD__3;
|
|
NimStringV2 T7_;
|
|
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
|
|
colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
|
|
T7_.len = 0; T7_.p = NIM_NIL;
|
|
colontmpD__2 = substr__system_7528(filename, ((NI)0), (NI)(extPos - ((NI)1)));
|
|
colontmpD__3 = normExt__stdZprivateZospaths50_242(ext);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T7_ = rawNewString(colontmpD__2.len + colontmpD__3.len + 0);
|
|
appendString((&T7_), colontmpD__2);
|
|
appendString((&T7_), colontmpD__3);
|
|
result = T7_;
|
|
eqdestroy___stdZassertions_13((&colontmpD__3));
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
}
|
|
LA1_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosaddFileExt)(NimStringV2 filename, NimStringV2 ext) {
|
|
NimStringV2 result;
|
|
NI extPos;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
extPos = searchExtPos__stdZprivateZospaths50_245(filename);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 T5_;
|
|
if (!(extPos < ((NI)0))) goto LA3_;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
T5_.len = 0; T5_.p = NIM_NIL;
|
|
colontmpD_ = normExt__stdZprivateZospaths50_242(ext);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T5_ = rawNewString(filename.len + colontmpD_.len + 0);
|
|
appendString((&T5_), filename);
|
|
appendString((&T5_), colontmpD_);
|
|
result = T5_;
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
eqcopy___stdZassertions_16((&result), filename);
|
|
}
|
|
LA1_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|