char* Except::callstack() const { OstreamStr oss; for (int i = 0; i < calls_->size(); ++i) oss << endl << calls_->get(i).getdata("fn"); return oss.str(); }
Value su_syminfo() { int n_symbols = symbols.size() / sizeof (SuSymbol); OstreamStr os; os << "Symbols: Count " << n_symbols << " (max " << MAX_SYMBOLS << "), " << "Size " << names.size() << " (max " << NAMES_SPACE << ")"; return new SuString(os.str()); }
char* callStackString() { OstreamStr stk; gcstring indent = ""; for (Frame* f = tls().proc->fp; f > tls().proc->frames; --f) { stk << endl << indent; if (f->fn) stk << f->fn; else if (f->prim) stk << f->prim; indent += " "; } return stk.str(); }
char* Func::params() const { OstreamStr out; out << "("; short j = 0; for (int i = 0; i < nparams; ++i) { if (i != 0) out << ","; if (i == nparams - rest) out << "@"; if (flags && (flags[i] & DYN)) out << "_"; out << symstr(locals[i]); if (i >= nparams - ndefaults - rest && i < nparams - rest) out << "=" << literals[j++]; } out << ")"; return out.str(); }
// used for "function call overflow" and "value stack overflow" void except_log_stack_() { static bool first = true; const char* stk = ""; if (first) { first = false; stk = callStackString(); } errlog(os.str(), stk); except_(); }
Value SuFunction::call(Value self, Value member, short nargs, short nargnames, short* argnames, int each) { static Value Disasm("Disasm"); static Value Source("Source"); if (member == CALL) { args(nargs, nargnames, argnames, each); if (flags) dotParams(self); Framer frame(this, self); return tls().proc->fp->run(); } else if (member == Disasm) { NOARGS("function.Disasm()"); OstreamStr oss; disasm(oss); return new SuString(oss.str()); } else if (member == Source) { return new SuString(src); } else return Func::call(self, member, nargs, nargnames, argnames, each); }
const char* DbmsQueryLocal::explain() { OstreamStr os; os << q; return os.str(); }
void except_() { alert(os.str()); exit(EXIT_FAILURE); }
// to allow setting breakpoints void except_err_() { Except e(os.str()); os.clear(); throw e; }