| 272 | #endif |
| 273 | |
| 274 | void fxLoadModule(txMachine* the, txSlot* module, txID moduleID) |
| 275 | { |
| 276 | txString path = fxGetKeyName(the, moduleID); |
| 277 | txByte* code; |
| 278 | size_t size; |
| 279 | code = fxGetArchiveCode(the, the->archive, path, &size); |
| 280 | if (code) { |
| 281 | txScript script; |
| 282 | script.callback = NULL; |
| 283 | script.symbolsBuffer = NULL; |
| 284 | script.symbolsSize = 0; |
| 285 | script.codeBuffer = code; |
| 286 | script.codeSize = (txSize)size; |
| 287 | script.hostsBuffer = NULL; |
| 288 | script.hostsSize = 0; |
| 289 | script.path = path; |
| 290 | script.version[0] = XS_MAJOR_VERSION; |
| 291 | script.version[1] = XS_MINOR_VERSION; |
| 292 | script.version[2] = XS_PATCH_VERSION; |
| 293 | script.version[3] = 0; |
| 294 | fxResolveModule(the, module, moduleID, &script, C_NULL, C_NULL); |
| 295 | } |
| 296 | else { |
| 297 | txPreparation* preparation = the->preparation; |
| 298 | if (preparation) { |
| 299 | txInteger c = preparation->scriptCount; |
| 300 | txScript* script = preparation->scripts; |
| 301 | while (c > 0) { |
| 302 | if (!c_strcmp(path, script->path)) { |
| 303 | fxResolveModule(the, module, moduleID, script, C_NULL, C_NULL); |
| 304 | return; |
| 305 | } |
| 306 | c--; |
| 307 | script++; |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | #if MODDEF_XS_TEST |
| 312 | if (!c_strncmp(path, "xsbug://", 8)) { |
| 313 | fxDebugImport(the, module, path); |
| 314 | return; |
| 315 | } |
| 316 | #endif |
| 317 | } |
| 318 | |
| 319 | #endif /* mxUseDefaultLoadModule */ |
| 320 |
no test coverage detected