1135 lines
37 KiB
C
1135 lines
37 KiB
C
/* Generated by Nim Compiler v1.9.0 */
|
|
#define NIM_INTBITS 64
|
|
|
|
#include "nimbase.h"
|
|
#include <string.h>
|
|
#include <stdlib.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__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
|
|
typedef struct tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A;
|
|
typedef struct tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA;
|
|
typedef struct tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw;
|
|
typedef struct tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw;
|
|
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_Time__3y2ZpqsTJLqdZvpC9a0rU2Q tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q;
|
|
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;
|
|
struct NimStrPayload {
|
|
NI cap;
|
|
NIM_CHAR data[SEQ_DECL_SIZE];
|
|
};
|
|
struct NimStringV2 {
|
|
NI len;
|
|
NimStrPayload* p;
|
|
};
|
|
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
|
|
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
|
|
NimStringV2 Field0;
|
|
NimStringV2 Field1;
|
|
NimStringV2 Field2;
|
|
};
|
|
struct tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A {
|
|
NI bytes;
|
|
NI16* data;
|
|
};
|
|
typedef N_STDCALL_PTR(NI32, tyProc__G0MNqLrkAnRVz4cDlgVcRg) (NI handle, NI16* buf, NI32 size);
|
|
typedef NI16 tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag[1];
|
|
typedef N_STDCALL_PTR(NI32, tyProc__Rzv0SS9bu3vYSxhvPQEKMBQ) (NI16* lpFileName, NI32 nBufferLength, NI16* lpBuffer, NI16** lpFilePart);
|
|
struct tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw {
|
|
NI32 dwLowDateTime;
|
|
NI32 dwHighDateTime;
|
|
};
|
|
typedef NI16 tyArray__EKfNt9b8uxndgFbu2Ky3XAQ[260];
|
|
typedef NI16 tyArray__Get9cpRTS5VjGKP6CDsI9bYA[14];
|
|
struct tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA {
|
|
NI32 dwFileAttributes;
|
|
tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw ftCreationTime;
|
|
tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw ftLastAccessTime;
|
|
tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw ftLastWriteTime;
|
|
NI32 nFileSizeHigh;
|
|
NI32 nFileSizeLow;
|
|
NI32 dwReserved0;
|
|
NI32 dwReserved1;
|
|
tyArray__EKfNt9b8uxndgFbu2Ky3XAQ cFileName;
|
|
tyArray__Get9cpRTS5VjGKP6CDsI9bYA cAlternateFileName;
|
|
};
|
|
typedef N_STDCALL_PTR(NI32, tyProc__jwEWAkul5J6p6K0UfXa1tw) (NI hFindFile, tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA* lpFindFileData);
|
|
typedef N_STDCALL_PTR(NI32, tyProc__9bXer9a4ps9aSGctILcxWReVw) (void);
|
|
typedef N_STDCALL_PTR(void, tyProc__ofoySXaAAlxxs9bQS9a1etlg) (NI hFindFile);
|
|
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_OSError__PeQ9bR8XhClb9cp9cbW28aSyw {
|
|
tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
|
|
NI32 errorCode;
|
|
};
|
|
typedef NimStringV2 tyArray__24KAM9afIUgUaqBaEBB6r9bg[3];
|
|
struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q {
|
|
NI64 seconds;
|
|
NI nanosecond;
|
|
};
|
|
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(NimStringV2, nospquoteShellWindows)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, contains__pureZstrutils_1813)(NimStringV2 s, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw chars);
|
|
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, prepareAdd)(NimStringV2* s, NI addlen);
|
|
static N_INLINE(void, nimAddCharV1)(NimStringV2* s, NIM_CHAR c);
|
|
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s, NI newLen);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZassertions_13)(NimStringV2* dest);
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShell)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___stdZassertions_16)(NimStringV2* dest, NimStringV2 src);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetHomeDir)(void);
|
|
static N_INLINE(NimStringV2, slash___stdZprivateZospaths50_90)(NimStringV2 head, NimStringV2 tail);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head, NimStringV2 tail);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_7613)(NimStringV2 s, NI first);
|
|
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(void, nossplitFile)(NimStringV2 path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppFilename)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A, newWideCString__stdZwidestrs_260)(NCSTRING source, NI L);
|
|
static N_INLINE(NI16*, toWideCString__stdZwidestrs_41)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A x);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqsink___stdZassertions_19)(NimStringV2* dest, NimStringV2 src);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqsink___stdZwidestrs_27)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A* a, tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A b);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___stdZwidestrs_359)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A s, NI estimate, NI replacement);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZwidestrs_6)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A* a);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZprivateZosdirs_65)(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* dest);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A, newWideCString__stdZwidestrs_287)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_86)(NI32 errorCode, NimStringV2 additionalInfo);
|
|
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_89)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, findFirstFile__stdZprivateZoscommon_25)(NimStringV2 a, tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA* b);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__stdZprivateZospaths50_283)(NimStringV2 path);
|
|
static N_INLINE(NIM_BOOL, skipFindData__stdZprivateZoscommon_34)(tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA* f);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___stdZwidestrs_356)(NI16* s);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringV2 filename);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringV2 dir);
|
|
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size, NI alignment);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space);
|
|
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosaddFileExt)(NimStringV2 filename, NimStringV2 ext);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, getEnv__stdZenvvars_14)(NimStringV2 key, NimStringV2 default_0);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_7601)(NimStringV2 s, NI first, NI last);
|
|
static N_INLINE(NIM_CHAR, X5BX5D___system_7090)(NimStringV2 s, NI i);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, fromWinTime__pureZtimes_1068)(NI64 win);
|
|
N_LIB_PRIVATE N_NIMCALL(NI64, rdFileTime__windowsZwinlean_285)(tyObject_FILETIME__bs4NMleDDVF7xsEK0SGLBw f);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, ntLtTime)(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q a, tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q b);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringV2 file);
|
|
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_191)(int status);
|
|
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s);
|
|
static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__yu6cxgKBBXbNsTkT9cyMd4g_2 = {
|
|
0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
|
;
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[0+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_3 = { 0 | NIM_STRLIT_FLAG, "" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_4 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_5 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[1+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_6 = { 1 | NIM_STRLIT_FLAG, "\"" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_7 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_6};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[2+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_8 = { 2 | NIM_STRLIT_FLAG, "\\\"" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_9 = {2, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_8};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_10 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_6};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_11 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[1+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_12 = { 1 | NIM_STRLIT_FLAG, " " };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_13 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_12};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_14 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_15 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
extern TNimTypeV2 NTIv2__PeQ9bR8XhClb9cp9cbW28aSyw_;
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[6+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_16 = { 6 | NIM_STRLIT_FLAG, "file \'" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_17 = {6, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_16};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[16+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_18 = { 16 | NIM_STRLIT_FLAG, "\' does not exist" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_19 = {16, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_18};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[4+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_20 = { 4 | NIM_STRLIT_FLAG, "PATH" };
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_21 = {4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_20};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_22 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_23 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_3};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[3+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_24 = { 3 | NIM_STRLIT_FLAG, "exe" };
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[3+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_25 = { 3 | NIM_STRLIT_FLAG, "cmd" };
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[3+1];
|
|
} TM__yu6cxgKBBXbNsTkT9cyMd4g_26 = { 3 | NIM_STRLIT_FLAG, "bat" };
|
|
N_LIB_PRIVATE NIM_CONST tyArray__24KAM9afIUgUaqBaEBB6r9bg ExeExts__pureZos_94 = {{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_24},
|
|
{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_25},
|
|
{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_26}}
|
|
;
|
|
extern NIM_BOOL nimInErrorMode__system_3980;
|
|
extern tyProc__G0MNqLrkAnRVz4cDlgVcRg Dl_1442840774_;
|
|
extern tyProc__Rzv0SS9bu3vYSxhvPQEKMBQ Dl_1442840836_;
|
|
extern tyProc__jwEWAkul5J6p6K0UfXa1tw Dl_1442840831_;
|
|
extern tyProc__9bXer9a4ps9aSGctILcxWReVw Dl_1442840748_;
|
|
extern tyProc__ofoySXaAAlxxs9bQS9a1etlg Dl_1442840834_;
|
|
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_: ;
|
|
}
|
|
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);
|
|
}
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
|
|
NIM_BOOL* result;
|
|
result = (NIM_BOOL*)0;
|
|
result = (&nimInErrorMode__system_3980);
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShellWindows)(NimStringV2 s) {
|
|
NimStringV2 result;
|
|
NimStringV2 backslashBuff;
|
|
NIM_BOOL needQuote;
|
|
NIM_BOOL T1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
backslashBuff.len = 0; backslashBuff.p = NIM_NIL;
|
|
T1_ = (NIM_BOOL)0;
|
|
T1_ = contains__pureZstrutils_1813(s, TM__yu6cxgKBBXbNsTkT9cyMd4g_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (T1_) goto LA2_;
|
|
T1_ = (s.len == ((NI)0));
|
|
LA2_: ;
|
|
needQuote = T1_;
|
|
result = TM__yu6cxgKBBXbNsTkT9cyMd4g_4;
|
|
backslashBuff = TM__yu6cxgKBBXbNsTkT9cyMd4g_5;
|
|
{
|
|
if (!needQuote) goto LA5_;
|
|
prepareAdd((&result), 1);
|
|
appendString((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_7);
|
|
}
|
|
LA5_: ;
|
|
{
|
|
NIM_CHAR c;
|
|
NI i;
|
|
NI L;
|
|
c = (NIM_CHAR)0;
|
|
i = ((NI)0);
|
|
L = s.len;
|
|
{
|
|
while (1) {
|
|
if (!(i < L)) goto LA9 ;
|
|
c = s.p->data[i];
|
|
{
|
|
if (!((NU8)(c) == (NU8)(92))) goto LA12_;
|
|
nimAddCharV1((&backslashBuff), c);
|
|
}
|
|
goto LA10_;
|
|
LA12_: ;
|
|
{
|
|
if (!((NU8)(c) == (NU8)(34))) goto LA15_;
|
|
{
|
|
NI i_2;
|
|
NI colontmp_;
|
|
NI i_3;
|
|
i_2 = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = (NI)(backslashBuff.len * ((NI)2));
|
|
i_3 = ((NI)0);
|
|
{
|
|
while (1) {
|
|
if (!(i_3 < colontmp_)) goto LA19 ;
|
|
i_2 = i_3;
|
|
nimAddCharV1((&result), 92);
|
|
i_3 += ((NI)1);
|
|
} LA19: ;
|
|
}
|
|
}
|
|
setLengthStrV2((&backslashBuff), ((NI)0));
|
|
prepareAdd((&result), 2);
|
|
appendString((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_9);
|
|
}
|
|
goto LA10_;
|
|
LA15_: ;
|
|
{
|
|
{
|
|
if (!!((backslashBuff.len == ((NI)0)))) goto LA23_;
|
|
prepareAdd((&result), backslashBuff.len + 0);
|
|
appendString((&result), backslashBuff);
|
|
setLengthStrV2((&backslashBuff), ((NI)0));
|
|
}
|
|
LA23_: ;
|
|
nimAddCharV1((&result), c);
|
|
}
|
|
LA10_: ;
|
|
i += ((NI)1);
|
|
} LA9: ;
|
|
}
|
|
}
|
|
{
|
|
if (!(((NI)0) < backslashBuff.len)) goto LA27_;
|
|
prepareAdd((&result), backslashBuff.len + 0);
|
|
appendString((&result), backslashBuff);
|
|
}
|
|
LA27_: ;
|
|
{
|
|
if (!needQuote) goto LA31_;
|
|
prepareAdd((&result), backslashBuff.len + 0);
|
|
appendString((&result), backslashBuff);
|
|
prepareAdd((&result), 1);
|
|
appendString((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_10);
|
|
}
|
|
LA31_: ;
|
|
eqdestroy___stdZassertions_13((&backslashBuff));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShell)(NimStringV2 s) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
result = nospquoteShellWindows(s);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, quoteShellCommand__pureZos_81)(NimStringV2* args, NI argsLen_0) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
result = TM__yu6cxgKBBXbNsTkT9cyMd4g_11;
|
|
{
|
|
NI i;
|
|
NI colontmp_;
|
|
NI i_2;
|
|
i = (NI)0;
|
|
colontmp_ = (NI)0;
|
|
colontmp_ = argsLen_0;
|
|
i_2 = ((NI)0);
|
|
{
|
|
while (1) {
|
|
NimStringV2 colontmpD_;
|
|
if (!(i_2 < colontmp_)) goto LA3 ;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
i = i_2;
|
|
{
|
|
if (!(((NI)0) < i)) goto LA6_;
|
|
prepareAdd((&result), 1);
|
|
appendString((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_13);
|
|
}
|
|
LA6_: ;
|
|
colontmpD_ = nospquoteShell(args[i]);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
prepareAdd((&result), colontmpD_.len + 0);
|
|
appendString((&result), colontmpD_);
|
|
i_2 += ((NI)1);
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
} LA3: ;
|
|
}
|
|
}
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(NimStringV2, slash___stdZprivateZospaths50_90)(NimStringV2 head, NimStringV2 tail) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
result = nosjoinPath(head, tail);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, expandTilde__pureZos_56)(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)0)]) == (NU8)(126)));
|
|
LA4_: ;
|
|
if (!T3_) goto LA5_;
|
|
eqcopy___stdZassertions_16((&result), path);
|
|
}
|
|
goto LA1_;
|
|
LA5_: ;
|
|
{
|
|
if (!(path.len == ((NI)1))) goto LA8_;
|
|
result = nosgetHomeDir();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
goto LA1_;
|
|
LA8_: ;
|
|
{
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 colontmpD__2;
|
|
if (!(((NU8)(path.p->data[((NI)1)])) == ((NU8)(92)) || ((NU8)(path.p->data[((NI)1)])) == ((NU8)(47)))) goto LA11_;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
|
|
colontmpD_ = nosgetHomeDir();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
colontmpD__2 = substr__system_7613(path, ((NI)2));
|
|
result = slash___stdZprivateZospaths50_90(colontmpD_, colontmpD__2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
goto LA1_;
|
|
LA11_: ;
|
|
{
|
|
eqcopy___stdZassertions_16((&result), path);
|
|
}
|
|
LA1_: ;
|
|
}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_: ;
|
|
}
|
|
static N_INLINE(NI16*, toWideCString__stdZwidestrs_41)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A x) {
|
|
NI16* result;
|
|
result = (NI16*)0;
|
|
result = x.data;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppFilename)(void) {
|
|
NimStringV2 result;
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A buf;
|
|
NI32 bufsize;
|
|
NIM_BOOL oldNimErrFin1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
nimZeroMem((void*)(&buf), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
bufsize = ((NI32)260);
|
|
buf = newWideCString__stdZwidestrs_260("", ((NI) (bufsize)));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
while (1) {
|
|
NI32 L;
|
|
NI16* T4_;
|
|
T4_ = (NI16*)0;
|
|
T4_ = toWideCString__stdZwidestrs_41(buf);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
L = Dl_1442840774_(((NI)0), T4_, bufsize);
|
|
{
|
|
if (!(L == ((NI32)0))) goto LA7_;
|
|
eqsink___stdZassertions_19((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_14);
|
|
goto LA2;
|
|
}
|
|
goto LA5_;
|
|
LA7_: ;
|
|
{
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A T12_;
|
|
if (!(bufsize < L)) goto LA10_;
|
|
T12_ = newWideCString__stdZwidestrs_260("", ((NI) (L)));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
eqsink___stdZwidestrs_27((&buf), T12_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
bufsize = L;
|
|
}
|
|
goto LA5_;
|
|
LA10_: ;
|
|
{
|
|
NimStringV2 T14_;
|
|
T14_.len = 0; T14_.p = NIM_NIL;
|
|
T14_ = dollar___stdZwidestrs_359(buf, ((NI) (L)), ((NI)65533));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
eqsink___stdZassertions_19((&result), T14_);
|
|
goto LA2;
|
|
}
|
|
LA5_: ;
|
|
}
|
|
} LA2: ;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
|
|
eqdestroy___stdZwidestrs_6((&buf));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
*nimErr_ = oldNimErrFin1_;
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppDir)(void) {
|
|
NimStringV2 result;
|
|
tyTuple__7q7q3E6Oj24ZNVJb9aonhAg colontmpD_;
|
|
NimStringV2 T1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
nimZeroMem((void*)(&colontmpD_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
|
|
T1_.len = 0; T1_.p = NIM_NIL;
|
|
T1_ = nosgetAppFilename();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
nossplitFile(T1_, (&colontmpD_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqcopy___stdZassertions_16((&result), colontmpD_.Field0);
|
|
eqdestroy___stdZprivateZosdirs_65((&colontmpD_));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_BOOL, skipFindData__stdZprivateZoscommon_34)(tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA* f) {
|
|
NIM_BOOL result;
|
|
NIM_BOOL T1_;
|
|
NIM_BOOL T3_;
|
|
NIM_BOOL T5_;
|
|
result = (NIM_BOOL)0;
|
|
T1_ = (NIM_BOOL)0;
|
|
T1_ = (((NI) ((*f).cFileName[(((NI)0))- 0])) == ((NI)46));
|
|
if (!(T1_)) goto LA2_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = (((NI) ((*f).cFileName[(((NI)1))- 0])) == ((NI)0));
|
|
if (T3_) goto LA4_;
|
|
T5_ = (NIM_BOOL)0;
|
|
T5_ = (((NI) ((*f).cFileName[(((NI)1))- 0])) == ((NI)46));
|
|
if (!(T5_)) goto LA6_;
|
|
T5_ = (((NI) ((*f).cFileName[(((NI)2))- 0])) == ((NI)0));
|
|
LA6_: ;
|
|
T3_ = T5_;
|
|
LA4_: ;
|
|
T1_ = T3_;
|
|
LA2_: ;
|
|
result = T1_;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosexpandFilename)(NimStringV2 filename) {
|
|
NimStringV2 result;
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A res;
|
|
NI32 bufsize;
|
|
NI16* unused;
|
|
NIM_BOOL oldNimErrFin4_;
|
|
NIM_BOOL oldNimErrFin1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
nimZeroMem((void*)(&res), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
bufsize = ((NI32)260);
|
|
unused = ((NI16*) NIM_NIL);
|
|
res = newWideCString__stdZwidestrs_260("", ((NI) (bufsize)));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
while (1) {
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A colontmpD_;
|
|
NI32 L;
|
|
NI16* T5_;
|
|
NI16* T6_;
|
|
nimZeroMem((void*)(&colontmpD_), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
colontmpD_ = newWideCString__stdZwidestrs_287(filename);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
T5_ = (NI16*)0;
|
|
T5_ = toWideCString__stdZwidestrs_41(colontmpD_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
T6_ = (NI16*)0;
|
|
T6_ = toWideCString__stdZwidestrs_41(res);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
L = Dl_1442840836_(T5_, bufsize, T6_, &unused);
|
|
{
|
|
NI32 T11_;
|
|
if (!(L == ((NI32)0))) goto LA9_;
|
|
T11_ = (NI32)0;
|
|
T11_ = osLastError__stdZoserrors_89();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
raiseOSError__stdZoserrors_86(T11_, filename);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
}
|
|
goto LA7_;
|
|
LA9_: ;
|
|
{
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A T15_;
|
|
if (!(bufsize < L)) goto LA13_;
|
|
T15_ = newWideCString__stdZwidestrs_260("", ((NI) (L)));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
eqsink___stdZwidestrs_27((&res), T15_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
bufsize = L;
|
|
}
|
|
goto LA7_;
|
|
LA13_: ;
|
|
{
|
|
NimStringV2 T17_;
|
|
T17_.len = 0; T17_.p = NIM_NIL;
|
|
T17_ = dollar___stdZwidestrs_359(res, ((NI) (L)), ((NI)65533));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
|
|
eqsink___stdZassertions_19((&result), T17_);
|
|
eqdestroy___stdZwidestrs_6((&colontmpD_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
goto LA2;
|
|
}
|
|
LA7_: ;
|
|
{
|
|
LA4_:;
|
|
}
|
|
{
|
|
oldNimErrFin4_ = *nimErr_; *nimErr_ = NIM_FALSE;
|
|
eqdestroy___stdZwidestrs_6((&colontmpD_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
*nimErr_ = oldNimErrFin4_;
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
} LA2: ;
|
|
{
|
|
NimStringV2 x;
|
|
tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA fX60gensym10_;
|
|
NI resX60gensym10_;
|
|
x.len = 0; x.p = NIM_NIL;
|
|
nimZeroMem((void*)(&fX60gensym10_), sizeof(tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA));
|
|
resX60gensym10_ = (NI)0;
|
|
resX60gensym10_ = findFirstFile__stdZprivateZoscommon_25(result, (&fX60gensym10_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
|
|
{
|
|
NI dotPosX60gensym10_;
|
|
if (!!((resX60gensym10_ == ((NI)-1)))) goto LA24_;
|
|
dotPosX60gensym10_ = searchExtPos__stdZprivateZospaths50_283(result);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
{
|
|
while (1) {
|
|
{
|
|
NIM_BOOL T31_;
|
|
NIM_BOOL T32_;
|
|
NimStringV2 ffX60gensym10_;
|
|
NI idxX60gensym10_;
|
|
T31_ = (NIM_BOOL)0;
|
|
T32_ = (NIM_BOOL)0;
|
|
T32_ = skipFindData__stdZprivateZoscommon_34((&fX60gensym10_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
T31_ = !(T32_);
|
|
if (!(T31_)) goto LA33_;
|
|
T31_ = !(!(((NI32)(fX60gensym10_.dwFileAttributes & ((NI32)16)) == ((NI32)0))));
|
|
LA33_: ;
|
|
if (!T31_) goto LA34_;
|
|
ffX60gensym10_.len = 0; ffX60gensym10_.p = NIM_NIL;
|
|
ffX60gensym10_ = dollar___stdZwidestrs_356(((NI16*) ((&fX60gensym10_.cFileName[(((NI)0))- 0]))));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
idxX60gensym10_ = (NI)((NI)(ffX60gensym10_.len - result.len) + dotPosX60gensym10_);
|
|
{
|
|
NIM_BOOL T38_;
|
|
NIM_BOOL T39_;
|
|
NIM_BOOL T40_;
|
|
NIM_BOOL T43_;
|
|
NIM_BOOL T46_;
|
|
NIM_BOOL T47_;
|
|
tyTuple__7q7q3E6Oj24ZNVJb9aonhAg colontmpD__2;
|
|
NimStringV2 colontmpD__3;
|
|
NimStringV2 blitTmp;
|
|
NimStringV2 T52_;
|
|
T38_ = (NIM_BOOL)0;
|
|
T39_ = (NIM_BOOL)0;
|
|
T40_ = (NIM_BOOL)0;
|
|
T40_ = (dotPosX60gensym10_ < ((NI)0));
|
|
if (T40_) goto LA41_;
|
|
T40_ = (ffX60gensym10_.len <= idxX60gensym10_);
|
|
LA41_: ;
|
|
T39_ = T40_;
|
|
if (T39_) goto LA42_;
|
|
T43_ = (NIM_BOOL)0;
|
|
T43_ = (((NI)0) <= idxX60gensym10_);
|
|
if (!(T43_)) goto LA44_;
|
|
T43_ = ((NU8)(ffX60gensym10_.p->data[idxX60gensym10_]) == (NU8)(46));
|
|
LA44_: ;
|
|
T39_ = T43_;
|
|
LA42_: ;
|
|
T38_ = T39_;
|
|
if (T38_) goto LA45_;
|
|
T46_ = (NIM_BOOL)0;
|
|
T47_ = (NIM_BOOL)0;
|
|
T47_ = (((NI)0) <= dotPosX60gensym10_);
|
|
if (!(T47_)) goto LA48_;
|
|
T47_ = ((NI)(dotPosX60gensym10_ + ((NI)1)) < result.len);
|
|
LA48_: ;
|
|
T46_ = T47_;
|
|
if (!(T46_)) goto LA49_;
|
|
T46_ = ((NU8)(result.p->data[(NI)(dotPosX60gensym10_ + ((NI)1))]) == (NU8)(42));
|
|
LA49_: ;
|
|
T38_ = T46_;
|
|
LA45_: ;
|
|
if (!T38_) goto LA50_;
|
|
nimZeroMem((void*)(&colontmpD__2), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
|
|
colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
|
|
blitTmp = result;
|
|
result.len = 0; result.p = NIM_NIL;
|
|
nossplitFile(blitTmp, (&colontmpD__2));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
colontmpD__3 = nosextractFilename(ffX60gensym10_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
T52_.len = 0; T52_.p = NIM_NIL;
|
|
T52_ = slash___stdZprivateZospaths50_90(colontmpD__2.Field0, colontmpD__3);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
eqsink___stdZassertions_19((&x), T52_);
|
|
eqsink___stdZassertions_19((&result), x);
|
|
x.len = 0; x.p = NIM_NIL;
|
|
eqdestroy___stdZassertions_13((&colontmpD__3));
|
|
eqdestroy___stdZprivateZosdirs_65((&colontmpD__2));
|
|
}
|
|
LA50_: ;
|
|
eqdestroy___stdZassertions_13((&ffX60gensym10_));
|
|
}
|
|
LA34_: ;
|
|
{
|
|
NI32 T55_;
|
|
NI32 errCodeX60gensym10_;
|
|
T55_ = (NI32)0;
|
|
T55_ = Dl_1442840831_(resX60gensym10_, (&fX60gensym10_));
|
|
if (!(T55_ == ((NI32)0))) goto LA56_;
|
|
errCodeX60gensym10_ = Dl_1442840748_();
|
|
{
|
|
if (!(errCodeX60gensym10_ == ((NI32)18))) goto LA60_;
|
|
goto LA27;
|
|
}
|
|
goto LA58_;
|
|
LA60_: ;
|
|
{
|
|
raiseOSError__stdZoserrors_86(errCodeX60gensym10_, TM__yu6cxgKBBXbNsTkT9cyMd4g_15);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA26_;
|
|
}
|
|
LA58_: ;
|
|
}
|
|
LA56_: ;
|
|
}
|
|
} LA27: ;
|
|
{
|
|
LA26_:;
|
|
}
|
|
{
|
|
Dl_1442840834_(resX60gensym10_);
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
|
|
}
|
|
LA24_: ;
|
|
{
|
|
LA21_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&x));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
{
|
|
NIM_BOOL T69_;
|
|
NIM_BOOL T70_;
|
|
NIM_BOOL T72_;
|
|
tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw* T75_;
|
|
NimStringV2 T76_;
|
|
T69_ = (NIM_BOOL)0;
|
|
T70_ = (NIM_BOOL)0;
|
|
T70_ = nosfileExists(result);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T69_ = !(T70_);
|
|
if (!(T69_)) goto LA71_;
|
|
T72_ = (NIM_BOOL)0;
|
|
T72_ = nosdirExists(result);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T69_ = !(T72_);
|
|
LA71_: ;
|
|
if (!T69_) goto LA73_;
|
|
T75_ = NIM_NIL;
|
|
T75_ = (tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw*) nimNewObj(sizeof(tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw), NIM_ALIGNOF(tyObject_OSError__PeQ9bR8XhClb9cp9cbW28aSyw));
|
|
(*T75_).Sup.Sup.Sup.m_type = (&NTIv2__PeQ9bR8XhClb9cp9cbW28aSyw_);
|
|
(*T75_).Sup.Sup.name = "OSError";
|
|
T76_.len = 0; T76_.p = NIM_NIL;
|
|
T76_ = rawNewString(result.len + 22);
|
|
appendString((&T76_), TM__yu6cxgKBBXbNsTkT9cyMd4g_17);
|
|
appendString((&T76_), result);
|
|
appendString((&T76_), TM__yu6cxgKBBXbNsTkT9cyMd4g_19);
|
|
(*T75_).Sup.Sup.message = T76_;
|
|
(*T75_).Sup.Sup.parent = ((Exception*) NIM_NIL);
|
|
raiseExceptionEx((Exception*)T75_, "OSError", "expandFilename", "os.nim", 455);
|
|
goto LA1_;
|
|
}
|
|
LA73_: ;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
|
|
eqdestroy___stdZwidestrs_6((&res));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
*nimErr_ = oldNimErrFin1_;
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
static N_INLINE(NIM_CHAR, X5BX5D___system_7090)(NimStringV2 s, NI i) {
|
|
NIM_CHAR result;
|
|
result = (NIM_CHAR)0;
|
|
result = s.p->data[(NI)(s.len - i)];
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, findExe__pureZos_95)(NimStringV2 exe, NIM_BOOL followSymlinks, NimStringV2* extensions, NI extensionsLen_0) {
|
|
NimStringV2 result;
|
|
NimStringV2 path;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
path.len = 0; path.p = NIM_NIL;
|
|
{
|
|
if (!(exe.len == ((NI)0))) goto LA4_;
|
|
eqdestroy___stdZassertions_13((&path));
|
|
goto BeforeRet_;
|
|
}
|
|
LA4_: ;
|
|
{
|
|
NimStringV2* extX60gensym8_;
|
|
NI i;
|
|
extX60gensym8_ = (NimStringV2*)0;
|
|
i = ((NI)0);
|
|
{
|
|
while (1) {
|
|
NimStringV2 T9_;
|
|
if (!(i < extensionsLen_0)) goto LA8 ;
|
|
extX60gensym8_ = (&extensions[i]);
|
|
T9_.len = 0; T9_.p = NIM_NIL;
|
|
T9_ = nosaddFileExt(exe, (*extX60gensym8_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
eqsink___stdZassertions_19((&result), T9_);
|
|
{
|
|
NIM_BOOL T12_;
|
|
T12_ = (NIM_BOOL)0;
|
|
T12_ = nosfileExists(result);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
if (!T12_) goto LA13_;
|
|
eqdestroy___stdZassertions_13((&path));
|
|
goto BeforeRet_;
|
|
}
|
|
LA13_: ;
|
|
i += ((NI)1);
|
|
} LA8: ;
|
|
}
|
|
}
|
|
path = getEnv__stdZenvvars_14(TM__yu6cxgKBBXbNsTkT9cyMd4g_21, TM__yu6cxgKBBXbNsTkT9cyMd4g_22);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
NimStringV2 candidate;
|
|
NI lastX60gensym33_;
|
|
NI splitsX60gensym33_;
|
|
candidate.len = 0; candidate.p = NIM_NIL;
|
|
lastX60gensym33_ = ((NI)0);
|
|
splitsX60gensym33_ = ((NI)-1);
|
|
{
|
|
while (1) {
|
|
NI firstX60gensym33_;
|
|
NimStringV2 T27_;
|
|
if (!(lastX60gensym33_ <= path.len)) goto LA18 ;
|
|
firstX60gensym33_ = lastX60gensym33_;
|
|
{
|
|
while (1) {
|
|
NIM_BOOL T21_;
|
|
T21_ = (NIM_BOOL)0;
|
|
T21_ = (lastX60gensym33_ < path.len);
|
|
if (!(T21_)) goto LA22_;
|
|
T21_ = !(((NU8)(path.p->data[lastX60gensym33_]) == (NU8)(59)));
|
|
LA22_: ;
|
|
if (!T21_) goto LA20 ;
|
|
lastX60gensym33_ += ((NI)1);
|
|
} LA20: ;
|
|
}
|
|
{
|
|
if (!(splitsX60gensym33_ == ((NI)0))) goto LA25_;
|
|
lastX60gensym33_ = path.len;
|
|
}
|
|
LA25_: ;
|
|
T27_.len = 0; T27_.p = NIM_NIL;
|
|
T27_ = substr__system_7601(path, firstX60gensym33_, (NI)(lastX60gensym33_ - ((NI)1)));
|
|
eqsink___stdZassertions_19((&candidate), T27_);
|
|
{
|
|
NimStringV2 x;
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 colontmpD__2;
|
|
NimStringV2 T34_;
|
|
x.len = 0; x.p = NIM_NIL;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
|
|
{
|
|
if (!(candidate.len == ((NI)0))) goto LA32_;
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
eqdestroy___stdZassertions_13((&x));
|
|
goto LA28;
|
|
}
|
|
LA32_: ;
|
|
T34_.len = 0; T34_.p = NIM_NIL;
|
|
{
|
|
NIM_BOOL T37_;
|
|
NIM_CHAR T39_;
|
|
T37_ = (NIM_BOOL)0;
|
|
T37_ = ((NU8)(candidate.p->data[((NI)0)]) == (NU8)(34));
|
|
if (!(T37_)) goto LA38_;
|
|
T39_ = (NIM_CHAR)0;
|
|
T39_ = X5BX5D___system_7090(candidate, ((NI)1));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA29_;
|
|
T37_ = ((NU8)(T39_) == (NU8)(34));
|
|
LA38_: ;
|
|
if (!T37_) goto LA40_;
|
|
colontmpD_ = substr__system_7601(candidate, ((NI)1), (NI)(candidate.len - ((NI)2)));
|
|
T34_ = colontmpD_;
|
|
}
|
|
goto LA35_;
|
|
LA40_: ;
|
|
{
|
|
colontmpD__2 = candidate;
|
|
candidate.len = 0; candidate.p = NIM_NIL;
|
|
T34_ = colontmpD__2;
|
|
}
|
|
LA35_: ;
|
|
x = slash___stdZprivateZospaths50_90(T34_, exe);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA29_;
|
|
{
|
|
NimStringV2* ext;
|
|
NI i_2;
|
|
ext = (NimStringV2*)0;
|
|
i_2 = ((NI)0);
|
|
{
|
|
while (1) {
|
|
NimStringV2 x_2;
|
|
if (!(i_2 < extensionsLen_0)) goto LA45 ;
|
|
x_2.len = 0; x_2.p = NIM_NIL;
|
|
ext = (&extensions[i_2]);
|
|
x_2 = nosaddFileExt(x, (*ext));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA46_;
|
|
{
|
|
NIM_BOOL T49_;
|
|
T49_ = (NIM_BOOL)0;
|
|
T49_ = nosfileExists(x_2);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA46_;
|
|
if (!T49_) goto LA50_;
|
|
eqsink___stdZassertions_19((&result), x_2);
|
|
x_2.len = 0; x_2.p = NIM_NIL;
|
|
eqdestroy___stdZassertions_13((&x_2));
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
eqdestroy___stdZassertions_13((&x));
|
|
eqdestroy___stdZassertions_13((&candidate));
|
|
eqdestroy___stdZassertions_13((&path));
|
|
goto BeforeRet_;
|
|
}
|
|
LA50_: ;
|
|
i_2 += ((NI)1);
|
|
{
|
|
LA46_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&x_2));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA29_;
|
|
} LA45: ;
|
|
}
|
|
}
|
|
{
|
|
LA29_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
eqdestroy___stdZassertions_13((&x));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA16_;
|
|
} LA28: ;
|
|
{
|
|
if (!(splitsX60gensym33_ == ((NI)0))) goto LA58_;
|
|
goto LA17;
|
|
}
|
|
LA58_: ;
|
|
splitsX60gensym33_ -= ((NI)1);
|
|
lastX60gensym33_ += ((NI)1);
|
|
} LA18: ;
|
|
} LA17: ;
|
|
{
|
|
LA16_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&candidate));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
result = TM__yu6cxgKBBXbNsTkT9cyMd4g_23;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&path));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringV2 file) {
|
|
tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
|
|
tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA f;
|
|
NI h;
|
|
NI64 T6_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
|
|
nimZeroMem((void*)(&f), sizeof(tyObject_WIN32_FIND_DATA__aYwmSz9bIz0JHAL9ciwIrnhA));
|
|
h = findFirstFile__stdZprivateZoscommon_25(file, (&f));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NI32 T5_;
|
|
if (!(h == ((NI)-1))) goto LA3_;
|
|
T5_ = (NI32)0;
|
|
T5_ = osLastError__stdZoserrors_89();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
raiseOSError__stdZoserrors_86(T5_, file);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
T6_ = (NI64)0;
|
|
T6_ = rdFileTime__windowsZwinlean_285(f.ftLastWriteTime);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
result = fromWinTime__pureZtimes_1068(T6_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
Dl_1442840834_(h);
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileNewer)(NimStringV2 a, NimStringV2 b) {
|
|
NIM_BOOL result;
|
|
tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T1_;
|
|
tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T2_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NIM_BOOL)0;
|
|
T1_ = nosgetLastModificationTime(b);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T2_ = nosgetLastModificationTime(a);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
result = ntLtTime(T1_, T2_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_191)(int status) {
|
|
int result;
|
|
result = (int)0;
|
|
result = status;
|
|
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(NI, nosexecShellCmd)(NimStringV2 command) {
|
|
NI result;
|
|
int T1_;
|
|
int T2_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NI)0;
|
|
T1_ = (int)0;
|
|
T1_ = system(nimToCStringConv(command));
|
|
T2_ = (int)0;
|
|
T2_ = exitStatusLikeShell__pureZos_191(T1_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
result = ((NI) (T2_));
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|