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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
|
/* 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(NimStringV2, alignString__pureZstrformat_u19)(NimStringV2 s_p0, NI minimumWidth_p1, NIM_CHAR align_p2, NIM_CHAR fill_p3);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2600)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(NI, validateUtf8__pureZunicode_u7583)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NIMCALL(NI, validateUtf8__pureZunicode_u342)(NIM_CHAR* s_p0, NI s_p0Len_0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(NI, runeLen__pureZunicode_u7411)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NIMCALL(NI, nucruneLen)(NIM_CHAR* s_p0, NI s_p0Len_0);
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, nsuRepeatChar)(NIM_CHAR c_p0, NI count_p1);
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, prepareAdd)(NimStringV2* s_p0, NI addLen_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u3)(NI x_p0);
extern NIM_BOOL nimInErrorMode__system_u4276;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4276);
return result;
}
static N_INLINE(NI, validateUtf8__pureZunicode_u7583)(NimStringV2 s_p0) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
result = validateUtf8__pureZunicode_u342((((s_p0).p) ? ((NIM_CHAR*)s_p0.p->data+(((NI)0))) : NIM_NIL), ((s_p0.len-1))-(((NI)0))+1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
return result;
}
static N_INLINE(NI, runeLen__pureZunicode_u7411)(NimStringV2 s_p0) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
result = nucruneLen((((s_p0).p) ? ((NIM_CHAR*)s_p0.p->data+(((NI)0))) : NIM_NIL), ((s_p0.len-1))-(((NI)0))+1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
return result;
}
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_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, alignString__pureZstrformat_u19)(NimStringV2 s_p0, NI minimumWidth_p1, NIM_CHAR align_p2, NIM_CHAR fill_p3) {
NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result.len = 0; result.p = NIM_NIL;
{
if (!(minimumWidth_p1 == ((NI)0))) goto LA3_;
eqcopy___system_u2600((&result), s_p0);
}
goto LA1_;
LA3_: ;
{
NI colontmpD_;
NI colontmpD__2;
NI sRuneLen;
NI toFill;
colontmpD_ = (NI)0;
colontmpD__2 = (NI)0;
{
NI T8_;
T8_ = (NI)0;
T8_ = validateUtf8__pureZunicode_u7583(s_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (!(T8_ == ((NI)-1))) goto LA9_;
colontmpD_ = runeLen__pureZunicode_u7411(s_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
sRuneLen = colontmpD_;
}
goto LA6_;
LA9_: ;
{
colontmpD__2 = s_p0.len;
sRuneLen = colontmpD__2;
}
LA6_: ;
toFill = (NI)(minimumWidth_p1 - sRuneLen);
{
if (!(toFill <= ((NI)0))) goto LA14_;
eqcopy___system_u2600((&result), s_p0);
}
goto LA12_;
LA14_: ;
{
NIM_BOOL T17_;
NimStringV2 colontmpD__3;
NimStringV2 T21_;
T17_ = (NIM_BOOL)0;
T17_ = ((NU8)(align_p2) == (NU8)(60));
if (T17_) goto LA18_;
T17_ = ((NU8)(align_p2) == (NU8)(0));
LA18_: ;
if (!T17_) goto LA19_;
colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
T21_.len = 0; T21_.p = NIM_NIL;
colontmpD__3 = nsuRepeatChar(fill_p3, (toFill));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
T21_ = rawNewString(s_p0.len + colontmpD__3.len + 0);
appendString((&T21_), s_p0);
appendString((&T21_), colontmpD__3);
result = T21_;
eqdestroy___system_u2597(colontmpD__3);
}
goto LA12_;
LA19_: ;
{
NimStringV2 colontmpD__4;
NimStringV2 colontmpD__5;
NI half;
NimStringV2 T25_;
if (!((NU8)(align_p2) == (NU8)(94))) goto LA23_;
colontmpD__4.len = 0; colontmpD__4.p = NIM_NIL;
colontmpD__5.len = 0; colontmpD__5.p = NIM_NIL;
half = (NI)(toFill / ((NI)2));
T25_.len = 0; T25_.p = NIM_NIL;
colontmpD__4 = nsuRepeatChar(fill_p3, (half));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
colontmpD__5 = nsuRepeatChar(fill_p3, ((NI)(toFill - half)));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
T25_ = rawNewString(colontmpD__4.len + s_p0.len + colontmpD__5.len + 0);
appendString((&T25_), colontmpD__4);
appendString((&T25_), s_p0);
appendString((&T25_), colontmpD__5);
result = T25_;
eqdestroy___system_u2597(colontmpD__5);
eqdestroy___system_u2597(colontmpD__4);
}
goto LA12_;
LA23_: ;
{
NimStringV2 colontmpD__6;
NimStringV2 T27_;
colontmpD__6.len = 0; colontmpD__6.p = NIM_NIL;
T27_.len = 0; T27_.p = NIM_NIL;
colontmpD__6 = nsuRepeatChar(fill_p3, (toFill));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
T27_ = rawNewString(colontmpD__6.len + s_p0.len + 0);
appendString((&T27_), colontmpD__6);
appendString((&T27_), s_p0);
result = T27_;
eqdestroy___system_u2597(colontmpD__6);
}
LA12_: ;
}
LA1_: ;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, formatValue__pureZterminal_u252)(NimStringV2* result_p0, NimStringV2 value_p1) {
NimStringV2 value_2;
NimStringV2 colontmpD_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
value_2.len = 0; value_2.p = NIM_NIL;
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
value_2 = value_p1;
colontmpD_ = alignString__pureZstrformat_u19(value_2, ((NI)0), 0, 32);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
prepareAdd((&(*result_p0)), colontmpD_.len + 0);
appendString((&(*result_p0)), colontmpD_);
eqdestroy___system_u2597(colontmpD_);
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, formatValue__pureZterminal_u265)(NimStringV2* result_p0, NI value_p1) {
NimStringV2 colontmpD_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___systemZdollars_u3(value_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
prepareAdd((&(*result_p0)), colontmpD_.len + 0);
appendString((&(*result_p0)), colontmpD_);
eqdestroy___system_u2597(colontmpD_);
}BeforeRet_: ;
}
|