Called from xst.c's fxLoadModule. Returns 1 if the module ID was found in the bundle map (and resolved), 0 to fall through to filesystem loading. Non-bundle usage: the map is empty, so this returns 0 immediately.
| 115 | // the bundle map (and resolved), 0 to fall through to filesystem loading. |
| 116 | // Non-bundle usage: the map is empty, so this returns 0 immediately. |
| 117 | int fxBundleLoad(txMachine *the, txSlot *module, txID moduleID) |
| 118 | { |
| 119 | if (gBundleMapCount == 0) |
| 120 | return 0; |
| 121 | const char *name = fxGetKeyName(the, moduleID); |
| 122 | if (!name) |
| 123 | return 0; |
| 124 | const txBundleEntry *entry = fxBundleMapGet(name); |
| 125 | if (!entry) |
| 126 | return 0; |
| 127 | txStringCStream stream; |
| 128 | stream.buffer = (char *)entry->source; |
| 129 | stream.offset = 0; |
| 130 | stream.size = entry->sourceLen; |
| 131 | #ifdef mxDebug |
| 132 | txUnsigned flags = mxDebugFlag; |
| 133 | #else |
| 134 | txUnsigned flags = 0; |
| 135 | #endif |
| 136 | txScript *script = fxParseScript(the, &stream, fxStringCGetter, flags); |
| 137 | if (script) |
| 138 | fxResolveModule(the, module, moduleID, script, C_NULL, C_NULL); |
| 139 | return 1; |
| 140 | } |
| 141 | |
| 142 | void fxBundleRun(txMachine *the, char *buffer, size_t size) |
| 143 | { |
no test coverage detected