333 lines
11 KiB
C
333 lines
11 KiB
C
/* Generated by Nim Compiler v1.9.0 */
|
|
#define NIM_INTBITS 64
|
|
|
|
#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
|
|
#define nimfr_(x, y)
|
|
#define nimln_(x, y)
|
|
typedef struct NimStrPayload NimStrPayload;
|
|
typedef struct NimStringV2 NimStringV2;
|
|
typedef struct tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A;
|
|
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
|
|
struct NimStrPayload {
|
|
NI cap;
|
|
NIM_CHAR data[SEQ_DECL_SIZE];
|
|
};
|
|
struct NimStringV2 {
|
|
NI len;
|
|
NimStrPayload* p;
|
|
};
|
|
struct tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A {
|
|
NI bytes;
|
|
NI16* data;
|
|
};
|
|
typedef N_STDCALL_PTR(NI32, tyProc__5sqIMptsyAfPn3c9cPj4DOA) (NI16* pathName);
|
|
typedef NI16 tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag[1];
|
|
typedef N_STDCALL_PTR(NI32, tyProc__9bXer9a4ps9aSGctILcxWReVw) (void);
|
|
typedef N_STDCALL_PTR(NI32, tyProc__aOhJuXP2rSFzW5eC9bSzvwg) (NI16* lpFileName, NI32 dwFileAttributes);
|
|
typedef NU8 tySet_tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg;
|
|
typedef NU8 tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg;
|
|
typedef N_STDCALL_PTR(NI32, tyProc__29cQilB9cqahn5yPQZH66TkA) (NI16* lpExistingFileName, NI16* lpNewFileName, NI32 bFailIfExists);
|
|
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
|
|
NimStringV2 Field0;
|
|
NimStringV2 Field1;
|
|
};
|
|
static N_INLINE(void, nimZeroMem)(void* p, NI size);
|
|
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A, newWideCString__stdZwidestrs_287)(NimStringV2 s);
|
|
static N_INLINE(NI16*, toWideCString__stdZwidestrs_41)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A x);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZwidestrs_6)(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A* a);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringV2 file);
|
|
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(NIM_BOOL, tryMoveFSObject__stdZprivateZoscommon_61)(NimStringV2 source, NimStringV2 dest, NIM_BOOL isDir);
|
|
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_224)(NimStringV2 msg);
|
|
static N_INLINE(NI, countBits32)(NU32 n);
|
|
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x);
|
|
N_CDECL(int, __builtin_popcount)(unsigned int x);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringV2 link);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___stdZprivateZoscommon_71)(tyTuple__UV3llMMYFckfui8YMBuUZA* x);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZassertions_13)(NimStringV2* dest);
|
|
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringV2 source, NimStringV2 dest, tySet_tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg options);
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[28+1];
|
|
} TM__CMIme9a8i2wZOUbxErcFpJA_2 = { 28 | NIM_STRLIT_FLAG, "osfiles.nim(415, 7) `false` " };
|
|
static const NimStringV2 TM__CMIme9a8i2wZOUbxErcFpJA_3 = {28, (NimStrPayload*)&TM__CMIme9a8i2wZOUbxErcFpJA_2};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[108+1];
|
|
} TM__CMIme9a8i2wZOUbxErcFpJA_4 = { 108 | NIM_STRLIT_FLAG, "osfiles.nim(217, 3) `card(copyFlagSymlink * options) == 1` There should be exactly one cfSymlink* in options" };
|
|
static const NimStringV2 TM__CMIme9a8i2wZOUbxErcFpJA_5 = {108, (NimStrPayload*)&TM__CMIme9a8i2wZOUbxErcFpJA_4};
|
|
extern NIM_BOOL nimInErrorMode__system_3980;
|
|
extern tyProc__5sqIMptsyAfPn3c9cPj4DOA Dl_1442841188_;
|
|
extern tyProc__9bXer9a4ps9aSGctILcxWReVw Dl_1442840748_;
|
|
extern tyProc__aOhJuXP2rSFzW5eC9bSzvwg Dl_1442840843_;
|
|
extern tyProc__29cQilB9cqahn5yPQZH66TkA Dl_1442840846_;
|
|
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(NIM_BOOL*, nimErrorFlag)(void) {
|
|
NIM_BOOL* result;
|
|
result = (NIM_BOOL*)0;
|
|
result = (&nimInErrorMode__system_3980);
|
|
return result;
|
|
}
|
|
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(NIM_BOOL, nostryRemoveFile)(NimStringV2 file) {
|
|
NIM_BOOL result;
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A f;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NIM_BOOL)0;
|
|
nimZeroMem((void*)(&f), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
result = NIM_TRUE;
|
|
f = newWideCString__stdZwidestrs_287(file);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
{
|
|
NI16* T3_;
|
|
NI32 T4_;
|
|
NI32 err;
|
|
T3_ = (NI16*)0;
|
|
T3_ = toWideCString__stdZwidestrs_41(f);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T4_ = (NI32)0;
|
|
T4_ = Dl_1442841188_(T3_);
|
|
if (!(T4_ == ((NI32)0))) goto LA5_;
|
|
result = NIM_FALSE;
|
|
err = Dl_1442840748_();
|
|
{
|
|
NIM_BOOL T9_;
|
|
T9_ = (NIM_BOOL)0;
|
|
T9_ = (err == ((NI32)2));
|
|
if (T9_) goto LA10_;
|
|
T9_ = (err == ((NI32)3));
|
|
LA10_: ;
|
|
if (!T9_) goto LA11_;
|
|
result = NIM_TRUE;
|
|
}
|
|
goto LA7_;
|
|
LA11_: ;
|
|
{
|
|
NIM_BOOL T14_;
|
|
NIM_BOOL T15_;
|
|
NI16* T17_;
|
|
NI32 T18_;
|
|
NI16* T20_;
|
|
NI32 T21_;
|
|
T14_ = (NIM_BOOL)0;
|
|
T15_ = (NIM_BOOL)0;
|
|
T15_ = (err == ((NI32)5));
|
|
if (!(T15_)) goto LA16_;
|
|
T17_ = (NI16*)0;
|
|
T17_ = toWideCString__stdZwidestrs_41(f);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T18_ = (NI32)0;
|
|
T18_ = Dl_1442840843_(T17_, ((NI32)128));
|
|
T15_ = !((T18_ == ((NI32)0)));
|
|
LA16_: ;
|
|
T14_ = T15_;
|
|
if (!(T14_)) goto LA19_;
|
|
T20_ = (NI16*)0;
|
|
T20_ = toWideCString__stdZwidestrs_41(f);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
T21_ = (NI32)0;
|
|
T21_ = Dl_1442841188_(T20_);
|
|
T14_ = !((T21_ == ((NI32)0)));
|
|
LA19_: ;
|
|
if (!T14_) goto LA22_;
|
|
result = NIM_TRUE;
|
|
}
|
|
goto LA7_;
|
|
LA22_: ;
|
|
LA7_: ;
|
|
}
|
|
LA5_: ;
|
|
eqdestroy___stdZwidestrs_6((&f));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringV2 file) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
{
|
|
NIM_BOOL T3_;
|
|
NI32 T6_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = nostryRemoveFile(file);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (!!(T3_)) goto LA4_;
|
|
T6_ = (NI32)0;
|
|
T6_ = osLastError__stdZoserrors_89();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
raiseOSError__stdZoserrors_86(T6_, file);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA4_: ;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, nosmoveFile)(NimStringV2 source, NimStringV2 dest) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = tryMoveFSObject__stdZprivateZoscommon_61(source, dest, NIM_FALSE);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (!!(T3_)) goto LA4_;
|
|
{
|
|
if (!NIM_TRUE) goto LA8_;
|
|
failedAssertImpl__stdZassertions_224(TM__CMIme9a8i2wZOUbxErcFpJA_3);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA8_: ;
|
|
}
|
|
LA4_: ;
|
|
}BeforeRet_: ;
|
|
}
|
|
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x) {
|
|
NI result;
|
|
NU32 x_2;
|
|
int T1_;
|
|
result = (NI)0;
|
|
x_2 = x;
|
|
T1_ = (int)0;
|
|
T1_ = __builtin_popcount(x_2);
|
|
result = ((NI) (T1_));
|
|
return result;
|
|
}
|
|
static N_INLINE(NI, countBits32)(NU32 n) {
|
|
NI result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result = (NI)0;
|
|
result = countSetBitsImpl__systemZcountbits95impl_26(n);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringV2 source, NimStringV2 dest, tySet_tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg options) {
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A s;
|
|
tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A d;
|
|
NIM_BOOL isSymlink;
|
|
NIM_BOOL oldNimErrFin1_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
nimZeroMem((void*)(&s), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
nimZeroMem((void*)(&d), sizeof(tyObject_WideCStringObj__BwbUsAz4qeNPsD7q6SJ32A));
|
|
{
|
|
if (!!((countBits32((7 & options)) == ((NI)1)))) goto LA4_;
|
|
failedAssertImpl__stdZassertions_224(TM__CMIme9a8i2wZOUbxErcFpJA_5);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
LA4_: ;
|
|
isSymlink = nossymlinkExists(source);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
NIM_BOOL T8_;
|
|
NIM_BOOL T10_;
|
|
T8_ = (NIM_BOOL)0;
|
|
T8_ = isSymlink;
|
|
if (!(T8_)) goto LA9_;
|
|
T10_ = (NIM_BOOL)0;
|
|
T10_ = ((options &((NU8)1<<((NU)((((tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg)2)))&7U)))!=0);
|
|
if (T10_) goto LA11_;
|
|
T10_ = NIM_TRUE;
|
|
LA11_: ;
|
|
T8_ = T10_;
|
|
LA9_: ;
|
|
if (!T8_) goto LA12_;
|
|
eqdestroy___stdZwidestrs_6((&d));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqdestroy___stdZwidestrs_6((&s));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
goto BeforeRet_;
|
|
}
|
|
LA12_: ;
|
|
s = newWideCString__stdZwidestrs_287(source);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
d = newWideCString__stdZwidestrs_287(dest);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
{
|
|
NI16* T16_;
|
|
NI16* T17_;
|
|
NI32 T18_;
|
|
NimStringV2 colontmpD_;
|
|
NI32 T22_;
|
|
tyTuple__UV3llMMYFckfui8YMBuUZA T23_;
|
|
T16_ = (NI16*)0;
|
|
T16_ = toWideCString__stdZwidestrs_41(s);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T17_ = (NI16*)0;
|
|
T17_ = toWideCString__stdZwidestrs_41(d);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T18_ = (NI32)0;
|
|
T18_ = Dl_1442840846_(T16_, T17_, ((NI32)0));
|
|
if (!(T18_ == ((NI32)0))) goto LA19_;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
T22_ = (NI32)0;
|
|
T22_ = osLastError__stdZoserrors_89();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
|
|
T23_.Field0 = source;
|
|
T23_.Field1 = dest;
|
|
colontmpD_ = dollar___stdZprivateZoscommon_71((&T23_));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
|
|
raiseOSError__stdZoserrors_86(T22_, colontmpD_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
|
|
{
|
|
LA21_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
}
|
|
LA19_: ;
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
|
|
eqdestroy___stdZwidestrs_6((&d));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
eqdestroy___stdZwidestrs_6((&s));
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
*nimErr_ = oldNimErrFin1_;
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, copyFileWithPermissions__stdZprivateZosfiles_263)(NimStringV2 source, NimStringV2 dest, NIM_BOOL ignorePermissionErrors, tySet_tyEnum_CopyFlag__mhWURcDRsh0F1DeHBSFUVg options) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
noscopyFile(source, dest, options);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|