@agoric/xsnap 0.14.3-dev-b047af2.0 → 0.14.3-dev-2a16ddd.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/package.json +8 -15
  2. package/src/build.js +4 -61
  3. package/moddable/modules/data/base64/base64.js +0 -28
  4. package/moddable/modules/data/base64/manifest.json +0 -11
  5. package/moddable/modules/data/base64/modBase64.c +0 -188
  6. package/moddable/modules/data/binaryMessage/BinaryMessage.js +0 -106
  7. package/moddable/modules/data/crc/crc.c +0 -205
  8. package/moddable/modules/data/crc/crc.js +0 -36
  9. package/moddable/modules/data/crc/manifest.json +0 -8
  10. package/moddable/modules/data/hex/hex.js +0 -28
  11. package/moddable/modules/data/hex/manifest.json +0 -11
  12. package/moddable/modules/data/hex/modHex.c +0 -139
  13. package/moddable/modules/data/logical/logical.js +0 -32
  14. package/moddable/modules/data/logical/modLogical.c +0 -98
  15. package/moddable/modules/data/qrcode/manifest.json +0 -9
  16. package/moddable/modules/data/qrcode/qrcode.c +0 -93
  17. package/moddable/modules/data/qrcode/qrcode.js +0 -23
  18. package/moddable/modules/data/qrcode/qrcodegen.c +0 -1025
  19. package/moddable/modules/data/qrcode/qrcodegen.h +0 -267
  20. package/moddable/modules/data/text/decoder/manifest.json +0 -8
  21. package/moddable/modules/data/text/decoder/textdecoder.c +0 -480
  22. package/moddable/modules/data/text/decoder/textdecoder.js +0 -27
  23. package/moddable/modules/data/text/encoder/manifest.json +0 -8
  24. package/moddable/modules/data/text/encoder/textencoder.c +0 -232
  25. package/moddable/modules/data/text/encoder/textencoder.js +0 -24
  26. package/moddable/modules/data/tinyint/tinyint.c +0 -150
  27. package/moddable/modules/data/tinyint/tinyint.js +0 -53
  28. package/moddable/modules/data/url/manifest.json +0 -17
  29. package/moddable/modules/data/url/url.c +0 -1959
  30. package/moddable/modules/data/url/url.js +0 -210
  31. package/moddable/modules/data/wavreader/manifest.json +0 -8
  32. package/moddable/modules/data/wavreader/wavreader.js +0 -128
  33. package/moddable/modules/data/zlib/deflate.c +0 -161
  34. package/moddable/modules/data/zlib/deflate.js +0 -63
  35. package/moddable/modules/data/zlib/inflate.c +0 -145
  36. package/moddable/modules/data/zlib/inflate.js +0 -66
  37. package/moddable/modules/data/zlib/manifest_deflate.json +0 -9
  38. package/moddable/modules/data/zlib/manifest_inflate.json +0 -9
  39. package/moddable/modules/data/zlib/miniz.c +0 -4924
  40. package/moddable/xs/includes/xs.d.ts +0 -73
  41. package/moddable/xs/includes/xs.h +0 -1533
  42. package/moddable/xs/includes/xsmc.h +0 -206
  43. package/moddable/xs/makefiles/lin/makefile +0 -33
  44. package/moddable/xs/makefiles/lin/xsc.mk +0 -118
  45. package/moddable/xs/makefiles/lin/xsid.mk +0 -90
  46. package/moddable/xs/makefiles/lin/xsl.mk +0 -168
  47. package/moddable/xs/makefiles/lin/xst.mk +0 -201
  48. package/moddable/xs/makefiles/mac/makefile +0 -33
  49. package/moddable/xs/makefiles/mac/xsc.mk +0 -130
  50. package/moddable/xs/makefiles/mac/xsid.mk +0 -102
  51. package/moddable/xs/makefiles/mac/xsl.mk +0 -177
  52. package/moddable/xs/makefiles/mac/xst.mk +0 -203
  53. package/moddable/xs/makefiles/mac/xst_no_asan.txt +0 -52
  54. package/moddable/xs/makefiles/win/build.bat +0 -26
  55. package/moddable/xs/makefiles/win/xsc.mak +0 -142
  56. package/moddable/xs/makefiles/win/xsid.mak +0 -113
  57. package/moddable/xs/makefiles/win/xsl.mak +0 -186
  58. package/moddable/xs/makefiles/win/xst.mak +0 -195
  59. package/moddable/xs/platforms/lin_xs.h +0 -99
  60. package/moddable/xs/platforms/mac_xs.h +0 -97
  61. package/moddable/xs/platforms/wasm_xs.h +0 -79
  62. package/moddable/xs/platforms/win_xs.h +0 -104
  63. package/moddable/xs/platforms/xsHost.h +0 -63
  64. package/moddable/xs/platforms/xsPlatform.h +0 -618
  65. package/moddable/xs/sources/xsAPI.c +0 -2555
  66. package/moddable/xs/sources/xsAll.c +0 -294
  67. package/moddable/xs/sources/xsAll.h +0 -2741
  68. package/moddable/xs/sources/xsArguments.c +0 -222
  69. package/moddable/xs/sources/xsArray.c +0 -2657
  70. package/moddable/xs/sources/xsAtomics.c +0 -844
  71. package/moddable/xs/sources/xsBigInt.c +0 -1859
  72. package/moddable/xs/sources/xsBoolean.c +0 -109
  73. package/moddable/xs/sources/xsCode.c +0 -4493
  74. package/moddable/xs/sources/xsCommon.c +0 -1710
  75. package/moddable/xs/sources/xsCommon.h +0 -1142
  76. package/moddable/xs/sources/xsDataView.c +0 -2890
  77. package/moddable/xs/sources/xsDate.c +0 -1541
  78. package/moddable/xs/sources/xsDebug.c +0 -2710
  79. package/moddable/xs/sources/xsDefaults.c +0 -134
  80. package/moddable/xs/sources/xsError.c +0 -353
  81. package/moddable/xs/sources/xsFunction.c +0 -776
  82. package/moddable/xs/sources/xsGenerator.c +0 -865
  83. package/moddable/xs/sources/xsGlobal.c +0 -839
  84. package/moddable/xs/sources/xsJSON.c +0 -1091
  85. package/moddable/xs/sources/xsLexical.c +0 -1969
  86. package/moddable/xs/sources/xsLockdown.c +0 -933
  87. package/moddable/xs/sources/xsMapSet.c +0 -1649
  88. package/moddable/xs/sources/xsMarshall.c +0 -1020
  89. package/moddable/xs/sources/xsMath.c +0 -624
  90. package/moddable/xs/sources/xsMemory.c +0 -1941
  91. package/moddable/xs/sources/xsModule.c +0 -3101
  92. package/moddable/xs/sources/xsNumber.c +0 -560
  93. package/moddable/xs/sources/xsObject.c +0 -1102
  94. package/moddable/xs/sources/xsPlatforms.c +0 -480
  95. package/moddable/xs/sources/xsProfile.c +0 -577
  96. package/moddable/xs/sources/xsPromise.c +0 -1199
  97. package/moddable/xs/sources/xsProperty.c +0 -636
  98. package/moddable/xs/sources/xsProxy.c +0 -1014
  99. package/moddable/xs/sources/xsRegExp.c +0 -1168
  100. package/moddable/xs/sources/xsRun.c +0 -4889
  101. package/moddable/xs/sources/xsScope.c +0 -1293
  102. package/moddable/xs/sources/xsScript.c +0 -288
  103. package/moddable/xs/sources/xsScript.h +0 -1186
  104. package/moddable/xs/sources/xsSnapshot.c +0 -2161
  105. package/moddable/xs/sources/xsSnapshot.h +0 -51
  106. package/moddable/xs/sources/xsSourceMap.c +0 -218
  107. package/moddable/xs/sources/xsString.c +0 -3332
  108. package/moddable/xs/sources/xsSymbol.c +0 -503
  109. package/moddable/xs/sources/xsSyntaxical.c +0 -4193
  110. package/moddable/xs/sources/xsTree.c +0 -1893
  111. package/moddable/xs/sources/xsType.c +0 -1488
  112. package/moddable/xs/sources/xsdtoa.c +0 -6672
  113. package/moddable/xs/sources/xsmc.c +0 -340
  114. package/moddable/xs/sources/xsre.c +0 -7578
  115. package/xsnap-native/xsnap/makefiles/lin/makefile +0 -10
  116. package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +0 -153
  117. package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +0 -144
  118. package/xsnap-native/xsnap/makefiles/mac/makefile +0 -10
  119. package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +0 -162
  120. package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +0 -153
  121. package/xsnap-native/xsnap/sources/xsnap-worker.c +0 -996
  122. package/xsnap-native/xsnap/sources/xsnap.c +0 -716
  123. package/xsnap-native/xsnap/sources/xsnap.h +0 -142
  124. package/xsnap-native/xsnap/sources/xsnapPlatform.c +0 -1496
  125. package/xsnap-native/xsnap/sources/xsnapPlatform.h +0 -105
@@ -1,480 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-2017 Moddable Tech, Inc.
3
- *
4
- * This file is part of the Moddable SDK Runtime.
5
- *
6
- * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Lesser General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * The Moddable SDK Runtime is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public License
17
- * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
- *
19
- * This file incorporates work covered by the following copyright and
20
- * permission notice:
21
- *
22
- * Copyright (C) 2010-2016 Marvell International Ltd.
23
- * Copyright (C) 2002-2010 Kinoma, Inc.
24
- *
25
- * Licensed under the Apache License, Version 2.0 (the "License");
26
- * you may not use this file except in compliance with the License.
27
- * You may obtain a copy of the License at
28
- *
29
- * http://www.apache.org/licenses/LICENSE-2.0
30
- *
31
- * Unless required by applicable law or agreed to in writing, software
32
- * distributed under the License is distributed on an "AS IS" BASIS,
33
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
- * See the License for the specific language governing permissions and
35
- * limitations under the License.
36
- */
37
-
38
- #include "xsAll.h"
39
- #include "xsScript.h"
40
-
41
- /* old programming interface defaults to 0 */
42
-
43
- #ifndef mxUseDefaultMachinePlatform
44
- #define mxUseDefaultMachinePlatform 0
45
- #endif
46
- #ifndef mxUseDefaultBuildKeys
47
- #define mxUseDefaultBuildKeys 0
48
- #endif
49
- #ifndef mxUseDefaultChunkAllocation
50
- #define mxUseDefaultChunkAllocation 0
51
- #endif
52
- #ifndef mxUseDefaultSlotAllocation
53
- #define mxUseDefaultSlotAllocation 0
54
- #endif
55
- #ifndef mxUseDefaultFindModule
56
- #define mxUseDefaultFindModule 0
57
- #endif
58
- #ifndef mxUseDefaultLoadModule
59
- #define mxUseDefaultLoadModule 0
60
- #endif
61
- #ifndef mxUseDefaultParseScript
62
- #define mxUseDefaultParseScript 0
63
- #endif
64
- #ifndef mxUseDefaultQueuePromiseJobs
65
- #define mxUseDefaultQueuePromiseJobs 0
66
- #endif
67
- #ifndef mxUseDefaultAbort
68
- #define mxUseDefaultAbort 0
69
- #endif
70
- #ifndef mxUseDefaultDebug
71
- #define mxUseDefaultDebug 0
72
- #endif
73
-
74
- #if mxUseDefaultMachinePlatform
75
-
76
- void fxCreateMachinePlatform(txMachine* the)
77
- {
78
- }
79
-
80
- void fxDeleteMachinePlatform(txMachine* the)
81
- {
82
- }
83
-
84
- #endif /* mxUseDefaultMachinePlatform */
85
-
86
- #if mxUseDefaultBuildKeys
87
-
88
- void fxBuildKeys(txMachine* the)
89
- {
90
- int i;
91
- for (i = 0; i < XS_SYMBOL_ID_COUNT; i++) {
92
- txID id = the->keyIndex;
93
- txSlot* description = fxNewSlot(the);
94
- fxCopyStringC(the, description, gxIDStrings[i]);
95
- the->keyArray[id] = description;
96
- the->keyIndex++;
97
- }
98
- for (; i < XS_ID_COUNT; i++) {
99
- fxID(the, gxIDStrings[i]);
100
- }
101
- }
102
-
103
- #endif /* mxUseDefaultBuildKeys */
104
-
105
-
106
- #if mxUseDefaultChunkAllocation
107
-
108
- void* fxAllocateChunks(txMachine* the, txSize theSize)
109
- {
110
- return c_malloc(theSize);
111
- }
112
-
113
- void fxFreeChunks(txMachine* the, void* theChunks)
114
- {
115
- c_free(theChunks);
116
- }
117
-
118
- #endif /* mxUseDefaultChunkAllocation */
119
-
120
-
121
- #if mxUseDefaultSlotAllocation
122
-
123
- txSlot* fxAllocateSlots(txMachine* the, txSize theCount)
124
- {
125
- return(txSlot*)c_malloc(theCount * sizeof(txSlot));
126
- }
127
-
128
- void fxFreeSlots(txMachine* the, void* theSlots)
129
- {
130
- c_free(theSlots);
131
- }
132
-
133
- #endif /* mxUseDefaultSlotAllocation */
134
-
135
- #if mxUseDefaultFindModule
136
-
137
- txID fxFindModule(txMachine* the, txSlot* realm, txID moduleID, txSlot* slot)
138
- {
139
- txPreparation* preparation = the->preparation;
140
- char name[C_PATH_MAX];
141
- #if MODDEF_XS_TEST
142
- char extension[5] = "";
143
- #endif
144
- char buffer[C_PATH_MAX];
145
- txInteger dot = 0;
146
- txString slash;
147
- txString path;
148
- fxToStringBuffer(the, slot, name, sizeof(name));
149
- if (name[0] == '.') {
150
- if (name[1] == '/') {
151
- dot = 1;
152
- }
153
- else if ((name[1] == '.') && (name[2] == '/')) {
154
- dot = 2;
155
- }
156
- }
157
- #if mxWindows
158
- {
159
- char c;
160
- slash = name;
161
- if (!c_strncmp(name, "xsbug://", 8))
162
- slash += 8;
163
- while ((c = *slash)) {
164
- if (c == '/')
165
- *slash = '\\';
166
- slash++;
167
- }
168
- }
169
- #endif
170
- slash = c_strrchr(name, mxSeparator);
171
- if (!slash)
172
- slash = name;
173
- slash = c_strrchr(slash, '.');
174
- if (slash && (!c_strcmp(slash, ".js") || !c_strcmp(slash, ".mjs"))) {
175
- #if MODDEF_XS_TEST
176
- c_strcpy(extension, slash);
177
- #endif
178
- *slash = 0;
179
- }
180
- if (dot) {
181
- if (moduleID == XS_NO_ID)
182
- return XS_NO_ID;
183
- buffer[0] = mxSeparator;
184
- path = buffer + 1;
185
- c_strcpy(path, fxGetKeyName(the, moduleID));
186
- slash = c_strrchr(buffer, mxSeparator);
187
- if (!slash)
188
- return XS_NO_ID;
189
- if (dot == 2) {
190
- *slash = 0;
191
- slash = c_strrchr(buffer, mxSeparator);
192
- if (!slash)
193
- return XS_NO_ID;
194
- }
195
- *slash = 0;
196
- if ((c_strlen(buffer) + c_strlen(name + dot)) >= sizeof(buffer))
197
- mxRangeError("path too long");
198
- c_strcat(buffer, name + dot);
199
- }
200
- else
201
- path = name;
202
- if (preparation) {
203
- txInteger c = preparation->scriptCount;
204
- txScript* script = preparation->scripts;
205
- size_t size;
206
- if (fxGetArchiveCode(the, the->archive, path, &size))
207
- return fxNewNameC(the, path);
208
- while (c > 0) {
209
- if (!c_strcmp(path, script->path))
210
- return fxNewNameC(the, path);
211
- c--;
212
- script++;
213
- }
214
- }
215
- #if MODDEF_XS_TEST
216
- if (!c_strncmp(path, "xsbug://", 8)) {
217
- c_strcat(path, extension);
218
- return fxNewNameC(the, path);
219
- }
220
- #endif
221
- return XS_NO_ID;
222
- }
223
-
224
- #endif /* mxUseDefaultFindModule */
225
-
226
- #if mxUseDefaultLoadModule
227
-
228
- #if MODDEF_XS_TEST
229
- extern void fxDebugImport(txMachine* the, txSlot* module, txString path);
230
- #endif
231
-
232
- void fxLoadModule(txMachine* the, txSlot* module, txID moduleID)
233
- {
234
- txString path = fxGetKeyName(the, moduleID);
235
- txByte* code;
236
- size_t size;
237
- code = fxGetArchiveCode(the, the->archive, path, &size);
238
- if (code) {
239
- txScript script;
240
- script.callback = NULL;
241
- script.symbolsBuffer = NULL;
242
- script.symbolsSize = 0;
243
- script.codeBuffer = code;
244
- script.codeSize = (txSize)size;
245
- script.hostsBuffer = NULL;
246
- script.hostsSize = 0;
247
- script.path = path;
248
- script.version[0] = XS_MAJOR_VERSION;
249
- script.version[1] = XS_MINOR_VERSION;
250
- script.version[2] = XS_PATCH_VERSION;
251
- script.version[3] = 0;
252
- fxResolveModule(the, module, moduleID, &script, C_NULL, C_NULL);
253
- }
254
- else {
255
- txPreparation* preparation = the->preparation;
256
- if (preparation) {
257
- txInteger c = preparation->scriptCount;
258
- txScript* script = preparation->scripts;
259
- while (c > 0) {
260
- if (!c_strcmp(path, script->path)) {
261
- fxResolveModule(the, module, moduleID, script, C_NULL, C_NULL);
262
- return;
263
- }
264
- c--;
265
- script++;
266
- }
267
- }
268
- }
269
- #if MODDEF_XS_TEST
270
- if (!c_strncmp(path, "xsbug://", 8)) {
271
- fxDebugImport(the, module, path);
272
- return;
273
- }
274
- #endif
275
- }
276
-
277
- #endif /* mxUseDefaultLoadModule */
278
-
279
- #if mxUseDefaultParseScript
280
-
281
- txScript* fxParseScript(txMachine* the, void* stream, txGetter getter, txUnsigned flags)
282
- {
283
- txParser _parser;
284
- txParser* parser = &_parser;
285
- txParserJump jump;
286
- txScript* script = NULL;
287
- fxInitializeParser(parser, the, the->parserBufferSize, the->parserTableModulo);
288
- parser->firstJump = &jump;
289
- if (c_setjmp(jump.jmp_buf) == 0) {
290
- fxParserTree(parser, stream, getter, flags, NULL);
291
- #ifdef mxDebug
292
- parser->flags |= mxDebugFlag;
293
- if (!parser->source) {
294
- char tag[16];
295
- parser->flags |= mxDebugFlag;
296
- fxGenerateTag(the, tag, sizeof(tag), C_NULL);
297
- parser->source = fxNewParserSymbol(parser, tag);
298
- }
299
- if (fxIsConnected(the)) {
300
- if (getter == fxStringGetter)
301
- fxFileEvalString(the, ((txStringStream*)stream)->slot->value.string, parser->source->string);
302
- else if (getter == fxStringCGetter)
303
- fxFileEvalString(the, ((txStringCStream*)stream)->buffer, parser->source->string);
304
- }
305
- #endif
306
- fxParserHoist(parser);
307
- fxParserBind(parser);
308
- script = fxParserCode(parser);
309
- }
310
- #ifdef mxInstrument
311
- if (the->peakParserSize < parser->total)
312
- the->peakParserSize = parser->total;
313
- #endif
314
- fxTerminateParser(parser);
315
- return script;
316
- }
317
-
318
- #endif /* mxUseDefaultParseScript */
319
-
320
- #if mxUseDefaultQueuePromiseJobs
321
-
322
- void fxQueuePromiseJobs(txMachine* the)
323
- {
324
- mxUnknownError("promise: no queue");
325
- }
326
-
327
- #endif /* mxUseDefaultQueuePromiseJobs */
328
-
329
- #if mxUseDefaultAbort
330
-
331
- void fxAbort(txMachine* the, int status)
332
- {
333
- txString why = C_NULL;
334
- switch (status) {
335
- case XS_STACK_OVERFLOW_EXIT:
336
- why = "stack overflow";
337
- break;
338
- case XS_NOT_ENOUGH_MEMORY_EXIT:
339
- why = "memory full";
340
- break;
341
- case XS_NO_MORE_KEYS_EXIT:
342
- why = "not enough keys";
343
- break;
344
- case XS_DEAD_STRIP_EXIT:
345
- why = "dead strip";
346
- break;
347
- case XS_DEBUGGER_EXIT:
348
- break;
349
- case XS_FATAL_CHECK_EXIT:
350
- break;
351
- case XS_UNHANDLED_EXCEPTION_EXIT:
352
- why = "unhandled exception";
353
- break;
354
- case XS_UNHANDLED_REJECTION_EXIT:
355
- why = "unhandled rejection";
356
- break;
357
- case XS_TOO_MUCH_COMPUTATION_EXIT:
358
- why = "too much computation";
359
- break;
360
- default:
361
- why = "unknown";
362
- break;
363
- }
364
- if (why)
365
- fprintf(stderr, "Error: %s\n", why);
366
- c_exit(status);
367
- }
368
-
369
- #endif /* mxUseDefaultAbort */
370
-
371
- #ifdef mxDebug
372
-
373
- #if mxUseDefaultDebug
374
-
375
- void fxConnect(txMachine* the)
376
- {
377
- }
378
-
379
- void fxDisconnect(txMachine* the)
380
- {
381
- }
382
-
383
- txBoolean fxIsConnected(txMachine* the)
384
- {
385
- return 0;
386
- }
387
-
388
- txBoolean fxIsReadable(txMachine* the)
389
- {
390
- return 0;
391
- }
392
-
393
- void fxReceive(txMachine* the)
394
- {
395
- }
396
-
397
- void fxSend(txMachine* the, txBoolean more)
398
- {
399
- }
400
-
401
- #endif /* mxUseDefaultDebug */
402
-
403
- #endif
404
-
405
- #if mxWindows || mxMacOSX || mxLinux || mxWasm
406
- uint32_t modMilliseconds()
407
- {
408
- c_timeval tv;
409
- c_gettimeofday(&tv, NULL);
410
- // #if (mxWasm || mxWindows || mxMacOSX)
411
- return (uint32_t)(uint64_t)(((double)(tv.tv_sec) * 1000.0) + ((double)(tv.tv_usec) / 1000.0));
412
- // #else
413
- // return (uint32_t)(((double)(tv.tv_sec) * 1000.0) + ((double)(tv.tv_usec) / 1000.0));
414
- // #endif
415
- }
416
- #endif
417
-
418
- #if mxWindows
419
-
420
- #if _MSC_VER < 1800
421
-
422
- unsigned long c_nan[2]={0xffffffff, 0x7fffffff};
423
- unsigned long c_infinity[2]={0x00000000, 0x7ff00000};
424
-
425
- int c_fpclassify(double x)
426
- {
427
- int result = FP_NORMAL;
428
- switch (_fpclass(x)) {
429
- case _FPCLASS_SNAN:
430
- case _FPCLASS_QNAN:
431
- result = FP_NAN;
432
- break;
433
- case _FPCLASS_NINF:
434
- case _FPCLASS_PINF:
435
- result = FP_INFINITE;
436
- break;
437
- case _FPCLASS_NZ:
438
- case _FPCLASS_PZ:
439
- result = FP_ZERO;
440
- break;
441
- case _FPCLASS_ND:
442
- case _FPCLASS_PD:
443
- result = FP_SUBNORMAL;
444
- break;
445
- }
446
- return result;
447
- }
448
-
449
- #endif /* _MSC_VER < 1800 */
450
-
451
- int c_gettimeofday(c_timeval *tp, struct c_timezone *tzp)
452
- {
453
- struct _timeb tb;
454
-
455
- _ftime(&tb);
456
- if (tp != 0) {
457
- tp->tv_sec = (long)tb.time;
458
- tp->tv_usec = tb.millitm * 1000;
459
- }
460
- if (tzp != 0) {
461
- tzp->tz_minuteswest = tb.timezone;
462
- tzp->tz_dsttime = tb.dstflag;
463
- }
464
- return (0);
465
- }
466
-
467
- #ifdef mxParse
468
- char *c_realpath(const char *path, char *real)
469
- {
470
- if (_fullpath(real, path, C_PATH_MAX) != NULL) {
471
- DWORD attributes = GetFileAttributes(real);
472
- if (attributes != 0xFFFFFFFF) {
473
- return real;
474
- }
475
- }
476
- return C_NULL;
477
- }
478
- #endif
479
-
480
- #endif