| 196 | } |
| 197 | |
| 198 | void fxAbort(txMachine* the, int status) |
| 199 | { |
| 200 | #if MODDEF_XS_TEST |
| 201 | if (XS_DEBUGGER_EXIT == status) { |
| 202 | extern txMachine *gThe; |
| 203 | if (gThe == the) { |
| 204 | gThe = NULL; // soft reset |
| 205 | return; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | if (XS_NOT_ENOUGH_MEMORY_EXIT == status) |
| 210 | mxUnknownError("fxAbort: out of memory"); |
| 211 | #endif |
| 212 | |
| 213 | #ifdef mxDebug |
| 214 | if ((XS_DEAD_STRIP_EXIT == status) && the->debugEval) |
| 215 | mxUnknownError("dead strip"); |
| 216 | #endif |
| 217 | |
| 218 | #if defined(mxDebug) || defined(mxInstrument) || defined(MODDEF_XS_ABORTHOOK) |
| 219 | const char *msg = fxAbortString(status); |
| 220 | |
| 221 | #if MODDEF_XS_ABORTHOOK |
| 222 | if ((XS_JAVASCRIPT_STACK_OVERFLOW_EXIT != status) && (XS_NATIVE_STACK_OVERFLOW_EXIT != status) & (XS_DEBUGGER_EXIT != status)) { |
| 223 | xsBooleanValue ignore = false; |
| 224 | |
| 225 | fxBeginHost(the); |
| 226 | { |
| 227 | mxPush(mxException); |
| 228 | txSlot *exception = the->stack; |
| 229 | mxException = xsUndefined; |
| 230 | mxTry(the) { |
| 231 | txID abortID = fxFindName(the, "abort"); |
| 232 | mxOverflow(-8); |
| 233 | mxPush(mxGlobal); |
| 234 | if (fxHasID(the, abortID)) { |
| 235 | mxPush(mxGlobal); |
| 236 | fxCallID(the, abortID); |
| 237 | mxPushStringC((char *)msg); |
| 238 | mxPushSlot(exception); |
| 239 | fxRunCount(the, 2); |
| 240 | ignore = (XS_BOOLEAN_KIND == the->stack->kind) && !the->stack->value.boolean; |
| 241 | mxPop(); |
| 242 | } |
| 243 | } |
| 244 | mxCatch(the) { |
| 245 | } |
| 246 | } |
| 247 | fxEndHost(the); |
| 248 | if (ignore) |
| 249 | return; |
| 250 | } |
| 251 | #endif |
| 252 | |
| 253 | fxReport(the, "XS abort: %s\n", msg); |
| 254 | #if !defined(MODDEF_XS_DEBUGABORT) || MODDEF_XS_DEBUGABORT |
| 255 | #if defined(mxDebug) && !MODDEF_XS_TEXT |
nothing calls this directly
no test coverage detected