1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 32
#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2600)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_u2348)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseAssert__stdZassertions_u13)(NimStringV2 msg_p0);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, copyMem__system_u1713)(void* dest_p0, void* source_p1, NI size_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u2597)(NimStringV2 dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2606)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nsuReplaceChar)(NimStringV2 s_p0, NIM_CHAR sub_p1, NIM_CHAR by_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static const struct {
NI cap; NIM_CHAR data[52+1];
} TM__ZF8ppk9aofq5DcpfJb2DIsg_2 = { 52 | NIM_STRLIT_FLAG, "paths like `C:foo` are currently unsupported, path: " };
static const NimStringV2 TM__ZF8ppk9aofq5DcpfJb2DIsg_3 = {52, (NimStrPayload*)&TM__ZF8ppk9aofq5DcpfJb2DIsg_2};
extern NIM_BOOL nimInErrorMode__system_u4274;
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = !(((*s_p0).p == ((NimStrPayload*) NIM_NIL)));
if (!(T3_)) goto LA4_;
T3_ = ((NI)((*(*s_p0).p).cap & ((NI)1073741824)) == ((NI)1073741824));
LA4_: ;
if (!T3_) goto LA5_;
nimPrepareStrMutationImpl__system_u2348(s_p0);
}
LA5_: ;
}
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, copyMem__system_u1713)(void* dest_p0, void* source_p1, NI size_p2) {
nimCopyMem(dest_p0, source_p1, size_p2);
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
{
if (!(((NI)0) < src_p1.len)) goto LA3_;
copyMem__system_u1713(((void*) ((&(*(*dest_p0).p).data[(*dest_p0).len]))), ((void*) ((&(*src_p1.p).data[((NI)0)]))), ((NI)(src_p1.len + ((NI)1))));
(*dest_p0).len += src_p1.len;
}
LA3_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4274);
return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nativeToUnixPath__stdZprivateZglobs_u97)(NimStringV2 path_p0) {
NimStringV2 result;
NimStringV2 T16_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result.len = 0; result.p = NIM_NIL;
eqcopy___system_u2600((&result), path_p0);
{
NIM_BOOL T3_;
NIM_BOOL T4_;
T3_ = (NIM_BOOL)0;
T4_ = (NIM_BOOL)0;
T4_ = (((NI)2) <= path_p0.len);
if (!(T4_)) goto LA5_;
T4_ = (((NU8)(path_p0.p->data[((NI)0)])) >= ((NU8)(97)) && ((NU8)(path_p0.p->data[((NI)0)])) <= ((NU8)(122)) || ((NU8)(path_p0.p->data[((NI)0)])) >= ((NU8)(65)) && ((NU8)(path_p0.p->data[((NI)0)])) <= ((NU8)(90)));
LA5_: ;
T3_ = T4_;
if (!(T3_)) goto LA6_;
T3_ = ((NU8)(path_p0.p->data[((NI)1)]) == (NU8)(58));
LA6_: ;
if (!T3_) goto LA7_;
nimPrepareStrMutationV2((&result));
result.p->data[((NI)0)] = 47;
nimPrepareStrMutationV2((&result));
result.p->data[((NI)1)] = path_p0.p->data[((NI)0)];
{
NIM_BOOL T11_;
NimStringV2 colontmpD_;
NimStringV2 T15_;
T11_ = (NIM_BOOL)0;
T11_ = (((NI)2) < path_p0.len);
if (!(T11_)) goto LA12_;
T11_ = !(((NU8)(path_p0.p->data[((NI)2)]) == (NU8)(92)));
LA12_: ;
if (!T11_) goto LA13_;
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T15_.len = 0; T15_.p = NIM_NIL;
T15_ = rawNewString(path_p0.len + 52);
appendString((&T15_), TM__ZF8ppk9aofq5DcpfJb2DIsg_3);
appendString((&T15_), path_p0);
colontmpD_ = T15_;
raiseAssert__stdZassertions_u13(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___system_u2597(colontmpD_);
}
LA13_: ;
}
LA7_: ;
T16_.len = 0; T16_.p = NIM_NIL;
T16_ = nsuReplaceChar(result, 92, 47);
if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u2597(T16_); goto BeforeRet_;}
eqsink___system_u2606((&result), T16_);
}BeforeRet_: ;
return result;
}
|