// write some data to the stream provider // Consumer should call this void StreamWrite(Stream *stream, char *data, unsigned short len) { if (!stream) { alertf("no stream"); return; } if (!stream->provider) { alertf("no provider"); return; } if (!stream->provider->write) { alertf("provider not handling write"); return; } stream->provider->write(stream, stream->providerData, data, len); }
ARSE_API void HandleException(SAppBase* pAppBase, const std::string& message, const std::vector<std::string>& callstack) { #ifdef USE_MEMCHECK MemCheck().clear(); #endif std::string lastFile; try { lastFile = *pAppBase->filesystem().lastOpen(); if (!callstack.empty()) { dlog << join(callstack, " <- ") << dlog.endl; derr << "FATAL EXCEPTION: \n\n" << join(callstack, " <- ") << dlog.endl; } } catch(...) { } try { if (!pAppBase || !pAppBase->validForDisplay()) throw message; // try fancy exception catch pAppBase->onException(callstack, message + "\n\nLast file opened: " + lastFile); pAppBase->run(); delete pAppBase; } catch (...) { // last-ditch exception catch (exception during fancy exception) try { alertf("%s\r%s\rLast file opened: %s", join(callstack, " <- ").c_str(), message.c_str(), lastFile.c_str()); if (pAppBase) DestroyWindow(pAppBase->hWnd()); } catch (...) { MessageBox(0, message.c_str(), "ARSE Fatal Error", 0); } } }