File: %40m..%40slib%40sstd%40sprivate%40sosfiles.nim.c

package info (click to toggle)
nim 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,911,644 kB
  • sloc: sh: 24,603; ansic: 1,761; python: 1,492; makefile: 1,013; sql: 298; asm: 141; xml: 13
file content (325 lines) | stat: -rw-r--r-- 11,076 bytes parent folder | download
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/* Generated by Nim Compiler v2.2.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
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w;
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__S69bIyvbp2ySa2Didg6Np7w {
	NI bytes;
	NI16* data;
};
typedef N_STDCALL_PTR(NI32, tyProc__5sqIMptsyAfPn3c9cPj4DOA) (NI16* pathName_p0);
typedef NI16 tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag[1];
typedef N_STDCALL_PTR(NI32, tyProc__9bXer9a4ps9aSGctILcxWReVw) (void);
typedef N_STDCALL_PTR(NI32, tyProc__aOhJuXP2rSFzW5eC9bSzvwg) (NI16* lpFileName_p0, NI32 dwFileAttributes_p1);
typedef NU8 tySet_tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g;
typedef NU8 tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g;
typedef N_STDCALL_PTR(NI32, tyProc__29cQilB9cqahn5yPQZH66TkA) (NI16* lpExistingFileName_p0, NI16* lpNewFileName_p1, NI32 bFailIfExists_p2);
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
	NimStringV2 Field0;
	NimStringV2 Field1;
};
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w, newWideCString__stdZwidestrs_u316)(NimStringV2 s_p0);
static N_INLINE(NI16*, toWideCString__stdZwidestrs_u49)(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w x_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZwidestrs_u7)(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w a_p0);
static N_INLINE(NI, countBits32)(NU32 n_p0);
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_u26)(NU32 x_p0);
N_CDECL(int, __builtin_popcount)(unsigned int x_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u242)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringV2 link_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_u123)(NI32 errorCode_p0, NimStringV2 additionalInfo_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_u126)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___stdZprivateZoscommon_u78)(tyTuple__UV3llMMYFckfui8YMBuUZA* x_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u2597)(NimStringV2 dest_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringV2 file_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__stdZprivateZoscommon_u68)(NimStringV2 source_p0, NimStringV2 dest_p1, NIM_BOOL isDir_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseAssert__stdZassertions_u13)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringV2 source_p0, NimStringV2 dest_p1, tySet_tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g options_p2, NI bufferSize_p3);
static const struct {
  NI cap; NIM_CHAR data[108+1];
} TM__CMIme9a8i2wZOUbxErcFpJA_2 = { 108 | NIM_STRLIT_FLAG, "osfiles.nim(215, 3) `card(copyFlagSymlink * options) == 1` There should be exactly one cfSymlink* in options" };
static const NimStringV2 TM__CMIme9a8i2wZOUbxErcFpJA_3 = {108, (NimStrPayload*)&TM__CMIme9a8i2wZOUbxErcFpJA_2};
static const struct {
  NI cap; NIM_CHAR data[11+1];
} TM__CMIme9a8i2wZOUbxErcFpJA_4 = { 11 | NIM_STRLIT_FLAG, "unreachable" };
static const NimStringV2 TM__CMIme9a8i2wZOUbxErcFpJA_5 = {11, (NimStrPayload*)&TM__CMIme9a8i2wZOUbxErcFpJA_4};
extern NIM_BOOL nimInErrorMode__system_u4274;
extern tyProc__5sqIMptsyAfPn3c9cPj4DOA Dl_1426063979_;
extern tyProc__9bXer9a4ps9aSGctILcxWReVw Dl_1426063531_;
extern tyProc__aOhJuXP2rSFzW5eC9bSzvwg Dl_1426063626_;
extern tyProc__29cQilB9cqahn5yPQZH66TkA Dl_1426063629_;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4274);
	return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(NI16*, toWideCString__stdZwidestrs_u49)(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w x_p0) {
	NI16* result;
	result = x_p0.data;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringV2 file_p0) {
	NIM_BOOL result;
	tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w f;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&f), sizeof(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w));
	result = NIM_TRUE;
	f = newWideCString__stdZwidestrs_u316(file_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NI16* T3_;
		NI32 T4_;
		NI32 err;
		T3_ = (NI16*)0;
		T3_ = toWideCString__stdZwidestrs_u49(f);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T4_ = (NI32)0;
		T4_ = Dl_1426063979_(T3_);
		if (!(T4_ == ((NI32)0))) goto LA5_;
		result = NIM_FALSE;
		err = Dl_1426063531_();
		{
			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_u49(f);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			T18_ = (NI32)0;
			T18_ = Dl_1426063626_(T17_, ((NI32)128));
			T15_ = !((T18_ == ((NI32)0)));
LA16_: ;
			T14_ = T15_;
			if (!(T14_)) goto LA19_;
			T20_ = (NI16*)0;
			T20_ = toWideCString__stdZwidestrs_u49(f);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			T21_ = (NI32)0;
			T21_ = Dl_1426063979_(T20_);
			T14_ = !((T21_ == ((NI32)0)));
LA19_: ;
			if (!T14_) goto LA22_;
			result = NIM_TRUE;
		}
		goto LA7_;
LA22_: ;
LA7_: ;
	}
LA5_: ;
	eqdestroy___stdZwidestrs_u7(f);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_u26)(NU32 x_p0) {
	NI result;
	NU32 x_2;
	int T1_;
	result = (NI)0;
	x_2 = x_p0;
	T1_ = (int)0;
	T1_ = __builtin_popcount(x_2);
	result = ((NI) (T1_));
	return result;
}
static N_INLINE(NI, countBits32)(NU32 n_p0) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	result = countSetBitsImpl__systemZcountbits95impl_u26(n_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringV2 source_p0, NimStringV2 dest_p1, tySet_tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g options_p2, NI bufferSize_p3) {
	tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w s;
	tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w d;
	NIM_BOOL isSymlink;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&s), sizeof(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w));
	nimZeroMem((void*)(&d), sizeof(tyObject_WideCStringObj__S69bIyvbp2ySa2Didg6Np7w));
	{
		if (!!((countBits32((7 & options_p2)) == ((NI)1)))) goto LA4_;
		failedAssertImpl__stdZassertions_u242(TM__CMIme9a8i2wZOUbxErcFpJA_3);
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	}
LA4_: ;
	isSymlink = nossymlinkExists(source_p0);
	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_p2 &((NU8)1<<((NU)((((tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g)2)))&7U)))!=0);
		if (T10_) goto LA11_;
		T10_ = NIM_TRUE;
LA11_: ;
		T8_ = T10_;
LA9_: ;
		if (!T8_) goto LA12_;
		eqdestroy___stdZwidestrs_u7(d);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		eqdestroy___stdZwidestrs_u7(s);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		goto BeforeRet_;
	}
LA12_: ;
	s = newWideCString__stdZwidestrs_u316(source_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	d = newWideCString__stdZwidestrs_u316(dest_p1);
	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_u49(s);
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		T17_ = (NI16*)0;
		T17_ = toWideCString__stdZwidestrs_u49(d);
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		T18_ = (NI32)0;
		T18_ = Dl_1426063629_(T16_, T17_, ((NI32)0));
		if (!(T18_ == ((NI32)0))) goto LA19_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		T22_ = (NI32)0;
		T22_ = osLastError__stdZoserrors_u126();
		if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
		T23_.Field0 = source_p0;
		T23_.Field1 = dest_p1;
		colontmpD_ = dollar___stdZprivateZoscommon_u78((&T23_));
		if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
		raiseOSError__stdZoserrors_u123(T22_, colontmpD_);
		if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
		{
			LA21_:;
		}
		{
			eqdestroy___system_u2597(colontmpD_);
		}
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	}
LA19_: ;
	{
		LA1_:;
	}
	{
		oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
		eqdestroy___stdZwidestrs_u7(d);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		eqdestroy___stdZwidestrs_u7(s);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		*nimErr_ = oldNimErrFin1_;
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringV2 file_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T3_;
		NI32 T6_;
		T3_ = (NIM_BOOL)0;
		T3_ = nostryRemoveFile(file_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__stdZoserrors_u126();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		raiseOSError__stdZoserrors_u123(T6_, file_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, nosmoveFile)(NimStringV2 source_p0, NimStringV2 dest_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject__stdZprivateZoscommon_u68(source_p0, dest_p1, NIM_FALSE);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(T3_)) goto LA4_;
		raiseAssert__stdZassertions_u13(TM__CMIme9a8i2wZOUbxErcFpJA_5);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, copyFileWithPermissions__stdZprivateZosfiles_u288)(NimStringV2 source_p0, NimStringV2 dest_p1, NIM_BOOL ignorePermissionErrors_p2, tySet_tyEnum_CopyFlag__1j5oUmplkZXgil3SrVhR7g options_p3) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	noscopyFile(source_p0, dest_p1, options_p3, ((NI)16384));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}