void qObjDef::Eval(qCtx *ctx, qStr *out, qArgAry *args) { AddRef(); try { qCtxTmp tmpCtx(ctx); int i, an = myArgNames.Count(); int mapcnt = min(an,args->Count()); for (i = 0; i < mapcnt; ++i) { if (myArgNames[i].Length() > 0) { CStr s = args->GetAt(i); CStr n = myArgNames[i]; //n.Change(); if (!n.IsEmpty()) { if (myQuoted[i] == dParsed ) { qObjParsed *p = new qObjParsed(s); tmpCtx.MapObj(p, n); } else if (myQuoted[i] == dQuoted) { tmpCtx.MapObj(s, n); args->SetAt(i, s); } else if (myQuoted[i] == dObjRef) { qObj *obj; args->SetAt(i,s); if (ctx->Find(&obj, s)) { tmpCtx.MapObj(new qObjByRef(obj, false), n); } } else { args->SetAt(i, s); tmpCtx.MapObj(s, n); }} else { args->SetAt(i, s); } } } for (; i < an; ++i) { if (myArgNames[i].Length() > 0) { CStr n = myArgNames[i]; n.Change(); if (!n.IsEmpty()) tmpCtx.MapObj(CStr::Null, n); } } for (; i < args->Count(); ++i) { args->SetAt(i,(*args)[i]); } qObjDefArgs *inst = new qObjDefArgs(this, args); tmpCtx.MapObj(inst, "arg"); tmpCtx.MapObj(args->Count(), "num-args"); tmpCtx.MapObj(args->Count(), "argc"); // *** comp //tmpCtx.Parse(&qStrReadBuf(myBody), out); qStrReadBuf rTmp(myBody); RunCompiled(&tmpCtx, &rTmp, out); } catch (qCtxExAbort ex) { throw ex; } catch (qCtxEx ex) { throw ex; } catch (...) { ctx->Throw(out, 999, "Core Unhandled exception"); } Free(); }