void EvalDebugStop(const void *data, qCtx *ctx, qStr *out, qArgAry *args) { if (ctx->GetSafeMode()) {ctx->Throw(out, 301, "function not available"); return;} // apache environment only... should be GetDebugEnv(ctx) ... etc char *p; bool ok = true; char cmd[256]; qArgAry cmdArgs; qCtxTmp debCtx(ctx); qStrFileO debout(stdout); debCtx.MapObj(&ok, (QOBJFUNC) EvalBreak, "go"); printf("Press enter to continue\n"); while (ok && fgets(cmd, 255, stdin)) { p = cmd; while (*p && !isspace(*p) && *p != '(') ++p; *p++ = '\0'; if (cmd && *cmd) { qObj *obj; debCtx.Find(&obj, cmd); cmdArgs.Grow(0); qStrReadBuf rTmp(p); debCtx.ParseArgsQmap(&rTmp, &cmdArgs, obj->GetQmap()); debCtx.Eval(&debout, cmd, &cmdArgs); debout.PutC('\n'); } else break; } }
BOOL CInviteChatDlg::OnInitDialog() { CResizableDialog::OnInitDialog(); HRESULT hr = m_pWebCustomizer.CreateInstance(CLSID_MpaWebCustomizer); LPUNKNOWN pDispatch = m_edit.GetControlUnknown(); m_pWebCustomizer->PutRefWebBrowser((LPDISPATCH)pDispatch); InitMpaWebEvent(); pSession = theNet2.GetSession(); ASSERT(pSession!=NULL); SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE); SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),TRUE); CRect winRect; GetWindowRect(&winRect); CRect rTmp(15,70,winRect.Width()-15,winRect.Height()-50); CRect r; AddAnchor(m_Nick.GetSafeHwnd(), CSize(0,0), CSize(0,0)); AddAnchor(m_edit.GetSafeHwnd(), CSize(0,0), CSize(100,100)); AddAnchor(m_Deny.GetSafeHwnd(), CSize(100,100), CSize(100,100)); AddAnchor(m_Accept.GetSafeHwnd(), CSize(100,100), CSize(100,100)); AddAnchor(m_Details.GetSafeHwnd(), CSize(0,100), CSize(0,100)); AddAnchor(m_ChatDetails.GetSafeHwnd(), CSize(0,100), CSize(0,100)); CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_INVITE_CHAT, _T("")); if(!strRect.IsEmpty()) { CRect rWindow = StringToRect(strRect); FitRectToWindow(rWindow); SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE); } m_Nick.Invalidate(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
qObjDef *CreateDef(qCtx *ctx, qStr *out, qArgAry *args, CStr &name) { if (args->Count() < 1) return NULL; if (name.IsEmpty()) name = (*args)[0]; if (name.Length()) { int i; if (args->Count() >= 2) { CStr body = (*args)[1]; // *** comp qStrBuf out; qStrReadBuf rTmp(body); qCtxComp comp(ctx); comp.Parse(&rTmp, &out); body = out; qArg arg; qObjDef *obj = new qObjDef(body); for (i = 2; i < args->Count(); ++i) { arg = args->GetAt(i); if (!arg.IsEmpty()) { if (args->GetQuot(i)) { obj->AddArgName(arg, qObjDef::dQuoted); } else if (arg[0] == '*') { obj->AddArgName(arg+1, qObjDef::dParsed); } else if (arg[0] == '&') { obj->AddArgName(arg+1, qObjDef::dObjRef); } else { obj->AddArgName(arg, qObjDef::dNormal); } } } return obj; } } return NULL; }
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(); }
void Decompile(qStr *in, qStr *out) { int i, j; char *p; C_BASE b; while (in->GetS((char *) &b, sizeof(b)) == sizeof(b)) { CStr dt(b.ln); if (in->GetS(dt.GetBuffer(), b.ln) == b.ln) { if (b.bc == BC_FUNC) { C_ARGS v; C_ARG a; CStr cur; p = dt.GetBuffer(); if (b.rn) { for (j = 0; j < b.ln; ++j) p[j] = p[j] ^ b.rn; } out->PutC('%'); out->PutS(dt); if (in->GetS((char *) &v, sizeof(v)) == sizeof(v)) { if (v.cnt > 0) out->PutC('('); else out->PutC('%'); for (i = 0; i < v.cnt; ++i) { if (in->GetS((char *) &a, sizeof(a)) == sizeof(a)) { cur.Grow(a.ln); if (in->GetS(cur.GetBuffer(), a.ln) == (int) a.ln) { p = cur.GetBuffer(); if (b.rn) { for (j = 0; j < (int) a.ln; ++j) p[j] = p[j] ^ b.rn; } if (a.at == ARG_CMP) { qStrReadBuf rTmp(cur); Decompile(&rTmp, out); } else { if (a.at == ARG_QSTR) out->PutC('\''); out->PutS(cur); } if (i < (v.cnt-1)) { out->PutC(','); } } } } if (v.cnt > 0) out->PutC(')'); } } else if (b.bc == BC_OUT) { out->PutS(dt, b.ln); } } } }
void RunCompiled(qCtx *ctx, qStr *in, qStr *out) { int i, j; char *p; C_BASE b; while (in->GetS((char *) &b, sizeof(b)) == sizeof(b) && b.ln > 0) { CStr dt(b.ln); if (in->GetS(dt.GetBuffer(), b.ln) == b.ln) { if (b.bc == BC_FUNC) { p = dt.GetBuffer(); if (b.rn) { for (j = 0; j < b.ln; ++j) p[j] = p[j] ^ b.rn; } qObj *obj; if (ctx->Find(&obj, (const CStr &) dt)) { C_ARGS v; C_ARG a; CStr cur; qArgAry ary; char qmode; if (in->GetS((char *) &v, sizeof(v)) == sizeof(v)) { char *map = obj->GetQmap(); if (!map || *map == 'A') { qmode = !map ? '0' : '1'; for (i = 0; i < v.cnt; ++i) { { if (in->GetS((char *) &a, sizeof(a)) == sizeof(a)) { cur.Grow(a.ln); if (in->GetS(cur.GetBuffer(), a.ln) == (int) a.ln) { p = cur.GetBuffer(); if (b.rn) { for (j = 0; j < (int) a.ln; ++j) p[j] = p[j] ^ b.rn; } ary.Add(cur); ary.SetQuot(i, a.at == ARG_QSTR); if (!ary.GetQuot(i) && qmode == '0') { qStrBuf tmp; if (a.at == ARG_CMP) { qStrReadBuf rTmp(ary[i]); RunCompiled(ctx, &rTmp, &tmp); } else { qStrReadBuf rTmp(ary[i]); ctx->Parse(&rTmp, &tmp); } ary[i] = tmp; } else { if (a.at == ARG_CMP) { if (qmode != '2') { qStrBuf tmp; qStrReadBuf rTmp(ary[i]); Decompile(&rTmp, &tmp); ary[i] = tmp; } else { ary.SetQuot(i, ARG_CMP); } } } } } } } } else { qmode = (*map == '1' ? '1' : '0'); ++map; for (i = 0; i < v.cnt; ++i) { { if (in->GetS((char *) &a, sizeof(a)) == sizeof(a)) { cur.Grow(a.ln); if (in->GetS(cur.GetBuffer(), a.ln) == (int) a.ln) { p = cur.GetBuffer(); if (b.rn) { for (j = 0; j < (int) a.ln; ++j) p[j] = p[j] ^ b.rn; } ary.Add(cur); ary.SetQuot(i, a.at == ARG_QSTR); if (!ary.GetQuot(i) && qmode == '0') { qStrBuf tmp; if (a.at == ARG_CMP) { qStrReadBuf rTmp(ary[i]); RunCompiled(ctx, &rTmp, &tmp); } else { qStrReadBuf rTmp(ary[i]); ctx->Parse(&rTmp, &tmp); } ary[i] = tmp; } else { if (a.at == ARG_CMP) { if (qmode != '2') { qStrBuf tmp; qStrReadBuf rTmp(ary[i]); Decompile(&rTmp, &tmp); ary[i] = tmp; } else { ary.SetQuot(i, ARG_CMP); } } } } } } if (*map) { if (*map != 'A') { qmode = *map; ++map; } } else { qmode = '0'; } } } obj->Eval(ctx, out, v.cnt ? &ary : NULL); } } else { if (ctx->GetStrict()) { ctx->ThrowF(out, 98, "Function '%s' was not found.", (const char *) dt); } else { C_ARGS v; C_ARG a; CStr cur; if (in->GetS((char *) &v, sizeof(v)) == sizeof(v)) { for (i = 0; i < v.cnt; ++i) { if (in->GetS((char *) &a, sizeof(a)) == sizeof(a)) { cur.Grow(a.ln); if (in->GetS(cur.GetBuffer(), a.ln) != (int) a.ln) { break; } } } } out->PutC('%'); out->PutS(dt); if (v.cnt > 0) { out->PutC(T_LP); out->PutS("..."); out->PutC(T_RP); } else { out->PutC('%'); } } } } else if (b.bc == BC_OUT) { out->PutS(dt, b.ln); } } } }
BOOL CAddUserRequest::OnInitDialog() { CResizableDialog::OnInitDialog(); HRESULT hr = m_pWebCustomizer.CreateInstance(CLSID_MpaWebCustomizer); LPUNKNOWN pDispatch = m_edit.GetControlUnknown(); m_pWebCustomizer->PutRefWebBrowser((LPDISPATCH)pDispatch); InitMpaWebEvent(); pSession = theNet2.GetSession(); ASSERT(pSession!=NULL); SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE); SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),TRUE); // LoadSkin(); CRect winRect; GetWindowRect(&winRect); CRect rTmp(15,70,winRect.Width()-15,winRect.Height()-50); //m_edit.Create(NULL,NULL,WS_VISIBLE|WS_BORDER,rTmp,this,IDC_DHTML_EDIT); //m_edit.SetContextMenu(IDR_MESSENGER_MENU,1,this); //m_edit.SetViewMode(); // [4/29/2002] //m_edit.SetDefaultFontName(L"Arial"); //m_edit.SetDefaultFontSize(nFontSizes[GetOptionInt(IDS_OFSMESSENGER,IDS_SIZE,1)]); // [4/29/2002] // m_Nick.SetWindowPos(NULL,18,43,winRect.Width()-36,16,SWP_NOZORDER|SWP_NOACTIVATE); // m_Nick.SetTextColor(0xffffff); // m_Nick.SetTransparent(TRUE); // m_Close.SetAutoPressed(TRUE); // m_Close.SetCanStayPressed(FALSE); // m_Mini.SetAutoPressed(TRUE); // m_Mini.SetCanStayPressed(FALSE); // m_Deny.SetAutoPressed(TRUE); // m_Deny.SetCanStayPressed(FALSE); // m_AddToContact.SetAutoPressed(TRUE); // m_AddToContact.SetCanStayPressed(FALSE); // m_Accept.SetAutoPressed(TRUE); // m_Accept.SetCanStayPressed(FALSE); // m_Details.SetAutoPressed(TRUE); // m_Details.SetCanStayPressed(FALSE); // m_Deny.SetWindowPos(NULL,winRect.Width()-91,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); // m_AddToContact.SetWindowPos(NULL,winRect.Width()-91,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW); // m_Accept.SetWindowPos(NULL,winRect.Width()-170,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); // m_Details.SetWindowPos(NULL,15,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); CRect r; //m_frameEdit.GetWindowRect(&r); //ScreenToClient(&r); //m_edit.SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER); AddAnchor(m_edit.GetSafeHwnd(), CSize(0,0), CSize(100,100)); AddAnchor(m_Deny.GetSafeHwnd(), CSize(100,100), CSize(100,100)); AddAnchor(m_AddToContact.GetSafeHwnd(), CSize(100,100), CSize(100,100)); AddAnchor(m_Accept.GetSafeHwnd(), CSize(100,100), CSize(100,100)); AddAnchor(m_Details.GetSafeHwnd(), CSize(0,100), CSize(0,100)); CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_ADD_FRIENDR, _T("")); if(!strRect.IsEmpty()) { CRect rWindow = StringToRect(strRect); FitRectToWindow(rWindow); SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE); } //m_edit.Clear(); //m_edit.SetFocus(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// // CHistoryPane message handlers // void CHistoryPane::OnPaint() { CPaintDC dc(this); CRect r; CRgn rgn; CPen pen; uint w, i; uint y, gap; COLORREF colBack; GetClientRect(&r); colBack = GetSysColor(COLOR_3DLIGHT); // dc.FillSolidRect(0, 0, XBORDER, r.bottom, colBack); dc.FillSolidRect(r.right-XBORDER, 0, XBORDER, r.bottom, colBack); dc.FillSolidRect(XBORDER, 0, r.right-r.left-2*XBORDER, YBORDER, colBack); dc.FillSolidRect(XBORDER, r.bottom-YBORDER, r.right-r.left-2*XBORDER, YBORDER, colBack); dc.Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); // r.DeflateRect(XBORDER, YBORDER); rgn.CreateRectRgnIndirect(&r); dc.SelectClipRgn(&rgn, RGN_COPY); pen.CreatePen(PS_SOLID, 1, RGB(0xff,0x3f,0x00)); //dc.SetROP2(R2_XORPEN); dc.SelectObject(&pen); dc.SelectStockObject(NULL_BRUSH); dc.SetStretchBltMode(HALFTONE); // w = m_uWidth; y = YBORDER; gap = 0; for (i=m_uTopItem; i<m_vItems.size(); i++) { CItem & info = m_vItems[i]; CRect rTmp(0,0,0,0); rTmp = CRect(XBORDER, y, XBORDER+m_uWidth, y+info.h0); BitmapBlt(&dc, &rTmp, info.image0, 0); if (info.sel0 != rTmp) { rTmp = info.sel0 + CSize(0,y); dc.Rectangle(&rTmp); } dc.FillSolidRect(XBORDER, y+info.h0, m_uWidth, YSPACE, GetSysColor(COLOR_3DLIGHT)); //dc.Draw3dRect(XBORDER, y, w, info.h0, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW)); y += info.h0 + YSPACE; if (y > r.bottom) break; } if (y < r.bottom) { gap = r.bottom - y; dc.FillSolidRect(XBORDER, y, m_uWidth, r.bottom-y, colBack); } if (m_bSendScroll || gap != m_uTrailingGap) { m_uTrailingGap = gap; m_bSendScroll = false; GetParent()->PostMessage(m_uMsgScroll); } }