1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 32
#include "nimbase.h"
#include <unistd.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
NimStringV2 Field0;
NimStringV2 Field1;
};
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_u119)(NI32 errorCode_p0, NimStringV2 additionalInfo_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_u122)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___stdZprivateZoscommon_u100)(tyTuple__UV3llMMYFckfui8YMBuUZA x_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u2597)(NimStringV2 dest_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2606)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
extern NIM_BOOL nimInErrorMode__system_u4276;
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0) {
NCSTRING result;
{
if (!(s_p0.len == ((NI)0))) goto LA3_;
result = "";
}
goto LA1_;
LA3_: ;
{
result = ((NCSTRING) ((*s_p0.p).data));
}
LA1_: ;
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4276);
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, createSymlink__stdZprivateZossymlinks_u13)(NimStringV2 src_p0, NimStringV2 dest_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
{
int T3_;
NimStringV2 colontmpD_;
NI32 T7_;
tyTuple__UV3llMMYFckfui8YMBuUZA T8_;
T3_ = (int)0;
T3_ = symlink(nimToCStringConv(src_p0), nimToCStringConv(dest_p1));
if (!!((T3_ == ((NI32)0)))) goto LA4_;
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T7_ = (NI32)0;
T7_ = osLastError__stdZoserrors_u122();
if (NIM_UNLIKELY(*nimErr_)) goto LA6_;
T8_.Field0 = src_p0;
T8_.Field1 = dest_p1;
colontmpD_ = dollar___stdZprivateZoscommon_u100(T8_);
if (NIM_UNLIKELY(*nimErr_)) goto LA6_;
raiseOSError__stdZoserrors_u119(T7_, colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto LA6_;
{
LA6_:;
}
{
eqdestroy___system_u2597(colontmpD_);
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA4_: ;
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, expandSymlink__stdZprivateZossymlinks_u19)(NimStringV2 symlinkPath_p0) {
NimStringV2 result;
NI bufLen;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result.len = 0; result.p = NIM_NIL;
bufLen = ((NI)1024);
{
while (1) {
NimStringV2 T3_;
NI len;
T3_.len = 0; T3_.p = NIM_NIL;
T3_ = mnewString((bufLen));
eqsink___system_u2606((&result), T3_);
len = readlink(nimToCStringConv(symlinkPath_p0), nimToCStringConv(result), bufLen);
{
NI32 T8_;
if (!(len < ((NI)0))) goto LA6_;
T8_ = (NI32)0;
T8_ = osLastError__stdZoserrors_u122();
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
raiseOSError__stdZoserrors_u119(T8_, symlinkPath_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA6_: ;
{
if (!(len < bufLen)) goto LA11_;
setLengthStrV2((&result), (len));
goto LA1;
}
LA11_: ;
bufLen = (NI)((NU32)(bufLen) << (NU32)(((NI)1)));
}
} LA1: ;
}BeforeRet_: ;
return result;
}
|