示例#1
0
BOOL CVirtualHelper::call(BOOL boolVal, CWnd *pWnd1, CWnd *pWnd2)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *wnd1;
	if (pWnd1) {
		wnd1 = PyWinObject_FromCWnd(pWnd1);
		if (!wnd1) return FALSE;
	} else {
		Py_INCREF(Py_None);
		wnd1 = Py_None;
	}
	PyObject *wnd2;
	if (pWnd2) {
		wnd2 = 	PyWinObject_FromCWnd(pWnd2);
		if (!wnd2) return FALSE;
	} else {
		Py_INCREF(Py_None);
		wnd2 = Py_None;
	}
	PyObject *arglst = Py_BuildValue("(iOO)",boolVal, wnd1, wnd2);
	BOOL ret = do_call(arglst);
	DODECREF (wnd1); // the reference I created.
	DODECREF (wnd2); // the reference I created.
	return ret;
}
示例#2
0
BOOL CVirtualHelper::call(UINT_PTR val)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(N)",PyWinObject_FromULONG_PTR(val));
	return do_call(arglst);
}
示例#3
0
BOOL CVirtualHelper::call(const WCHAR *val, int ival)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(ui)",val,ival);
	return do_call(arglst);
}
示例#4
0
BOOL CVirtualHelper::call(int val1, int val2, int val3)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(iii)",val1, val2, val3);
	return do_call(arglst);
}
示例#5
0
BOOL CVirtualHelper::call(long val)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(l)",val);
	return do_call(arglst);
}
示例#6
0
BOOL CVirtualHelper::call(DWORD val, DWORD val2)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(ii)",val, val2);
	return do_call(arglst);
}
示例#7
0
BOOL CVirtualHelper::call(BOOL v1, BOOL v2)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(NN)",PyBool_FromLong(v1), PyBool_FromLong(v2));
	return do_call(arglst);
}
示例#8
0
文件: coopth.c 项目: ccarcel/dosemu2
static enum CoopthRet do_run_thread(struct coopth_t *thr,
	struct coopth_per_thread_t *pth)
{
    enum CoopthRet ret = do_call(pth);
    switch (ret) {
#define DO_SWITCH(x) \
    case COOPTH_##x: \
	pth->st = SW_ST(x); \
	break
#define DO_SWITCH2(x, c) \
    case COOPTH_##x: \
	c; \
	pth->st = SW_ST(x); \
	break
    DO_SWITCH(YIELD);
    DO_SWITCH(WAIT);
    DO_SWITCH(SCHED);
    DO_SWITCH(DETACH);
    DO_SWITCH(LEAVE);
    DO_SWITCH(DONE);
    DO_SWITCH2(ATTACH, coopth_callf_chk(thr, pth));

    case COOPTH_SLEEP:
	pth->st = ST(SLEEPING);
	break;
    case COOPTH_DELETE:
	do_del_thread(thr, pth);
	break;
    }
    return ret;
}
示例#9
0
BOOL CVirtualHelper::call(WPARAM w, LPARAM l)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("NN",PyWinObject_FromPARAM(w), PyWinObject_FromPARAM(l));
	return do_call(arglst);
}
示例#10
0
/*
** Call a function (C or Lua). The parameters must be on the stack,
** between [stack+base,top). The function to be called is at stack+base-1.
** When returns, the results are on the stack, between [stack+base-1,top).
** The number of results is nResults, unless nResults=MULT_RET.
*/
static void do_call (StkId base, int nResults)
{
  StkId firstResult;
  TObject *func = stack+base-1;
  int i;
  if (ttype(func) == LUA_T_CFUNCTION) {
    ttype(func) = LUA_T_CMARK;
    firstResult = callC(fvalue(func), base);
  }
  else if (ttype(func) == LUA_T_FUNCTION) {
    ttype(func) = LUA_T_MARK;
    firstResult = lua_execute(func->value.tf->code, base);
  }
  else { /* func is not a function */
    /* Check the tag method for invalid functions */
    TObject *im = luaI_getimbyObj(func, IM_FUNCTION);
    if (ttype(im) == LUA_T_NIL)
      lua_error("call expression not a function");
    open_stack((top-stack)-(base-1));
    stack[base-1] = *im;
    do_call(base, nResults);
    return;
  }
  /* adjust the number of results */
  if (nResults != MULT_RET)
    adjust_top(firstResult+nResults);
  /* move results to base-1 (to erase parameters and function) */
  base--;
  nResults = top - (stack+firstResult);  /* actual number of results */
  for (i=0; i<nResults; i++)
    *(stack+base+i) = *(stack+firstResult+i);
  top -= firstResult-base;
}
示例#11
0
文件: opcode.c 项目: cskau/VM
/*
** Call the specified fallback, putting it on the stack below its arguments
*/
static void callFB (int fb)
{
  int nParams = luaI_fallBacks[fb].nParams;
  open_stack(nParams);
  *(top-nParams-1) = luaI_fallBacks[fb].function;
  do_call((top-stack)-nParams, luaI_fallBacks[fb].nResults);
}
示例#12
0
文件: opcode.c 项目: cskau/VM
/*
** Call a function (C or Lua). The parameters must be on the stack,
** between [stack+base,top). The function to be called is at stack+base-1.
** When returns, the results are on the stack, between [stack+base-1,top).
** The number of results is nResults, unless nResults=MULT_RET.
*/
static void do_call (StkId base, int nResults)
{
  StkId firstResult;
  Object *func = stack+base-1;
  int i;
  if (tag(func) == LUA_T_CFUNCTION)
  {
    tag(func) = LUA_T_CMARK;
    firstResult = callC(fvalue(func), base);
  }
  else if (tag(func) == LUA_T_FUNCTION)
  {
    tag(func) = LUA_T_MARK;
    firstResult = lua_execute(func->value.tf->code, base);
  }
  else
  { /* func is not a function */
    /* Call the fallback for invalid functions */
    open_stack((top-stack)-(base-1));
    stack[base-1] = luaI_fallBacks[FB_FUNCTION].function;
    do_call(base, nResults);
    return;
  }
  /* adjust the number of results */
  if (nResults != MULT_RET && top - (stack+firstResult) != nResults)
    adjust_top(firstResult+nResults);
  /* move results to base-1 (to erase parameters and function) */
  base--;
  nResults = top - (stack+firstResult);  /* actual number of results */
  for (i=0; i<nResults; i++)
    *(stack+base+i) = *(stack+firstResult+i);
  top -= firstResult-base;
}
示例#13
0
BOOL CVirtualHelper::call(CDC *pDC, CPrintInfo *pInfo)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *dc = (PyObject *) ui_assoc_object::make (ui_dc_object::type,
												   pDC)->GetGoodRet();
	if (!dc) return FALSE;
        BOOL ret;
        PyObject *info = NULL;
        PyObject *arglst = NULL;
        if (pInfo != NULL) {
          info = (PyObject *) ui_assoc_object::make (ui_prinfo_object::type,
                                                     pInfo)->GetGoodRet();
          if (!info) return FALSE;
          arglst = Py_BuildValue("(OO)",dc, info);
        } else {
          arglst = Py_BuildValue("(Oz)",dc, NULL);
        }
        ret = do_call(arglst);
	DODECREF (dc); // the reference I created.
        if (pInfo != NULL) {
          DODECREF (info); // the reference I created.
        }
	return ret;
}
示例#14
0
static void do_call_to(int cs, int ip, struct RealModeCallStructure *rmreg,
		       int rmask)
{
    do_call(READ_RMREG(cs, rmask), READ_RMREG(ip, rmask), rmreg, rmask);
    RMREG(cs) = cs;
    RMREG(ip) = ip;
}
示例#15
0
static void do_unprotectedrun (lua_CFunction f, int nParams, int nResults)
{
  StkId base = (top-stack)-nParams;
  open_stack(nParams);
  stack[base].ttype = LUA_T_CFUNCTION;
  stack[base].value.f = f;
  do_call(base+1, nResults);
}
示例#16
0
/*
** Call the function at CLS_current.base, and incorporate results on
** the Lua2C structure.
*/
static void do_callinc (int nResults)
{
  StkId base = CLS_current.base;
  do_call(base+1, nResults);
  CLS_current.lua2C = base;  /* position of the new results */
  CLS_current.num = (top-stack) - base;  /* number of results */
  CLS_current.base = base + CLS_current.num;  /* incorporate results on stack */
}
示例#17
0
	void call(const MetaObject& mo) const
	{
		typename mirror::mp::is_a<
			MetaObject,
			typename tag_by_wrapper<Wrapper>::type
		>::type selector;
		do_call(mo, selector);
	}
示例#18
0
 Boxed_Value operator()(const std::vector<Boxed_Value> &params, const chaiscript::Type_Conversions &t_conversions) const
 {
   if (m_arity < 0 || size_t(m_arity) == params.size()) {
     return do_call(params, t_conversions);
   } else {
     throw exception::arity_error(static_cast<int>(params.size()), m_arity);
   }
 }
示例#19
0
BOOL CVirtualHelper::call(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO*pHandlerInfo)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("iiNN",nID, nCode, PyWinLong_FromVoidPtr(pExtra), PyWinLong_FromVoidPtr(pHandlerInfo));
	BOOL ret = do_call(arglst);
	return ret;
}
示例#20
0
BOOL CVirtualHelper::call(PyObject *ob)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	if (!ob)
		ob=Py_None;
	PyObject *arglst = Py_BuildValue("(O)",ob);
	return do_call(arglst);
}
示例#21
0
void NvimRPC::call(const std::string &method, Integer& res, const U& ...u) {
    Object v = do_call(method, u...);
    std::cout << "Integer NvimRPC::call" << std::endl;
    
    // int64_t is only for negative integer.
    if(v.is_int64_t())       res = v.as_int64_t();
    else if(v.is_uint64_t()) res = v.as_uint64_t();
    else std::cout << "invalid response type" << std::endl; //TODO: add error handler
}
示例#22
0
int parse_call()
{
    char *arg = strtok(NULL, " ");
    uint32_t addr;
    if(arg && parse_uint32(arg, &addr))
        return do_call(addr);
    else
        return syntax_error(arg);
}
示例#23
0
VOID  do_call_indirect(ADDRINT target, BOOL taken)
{
    if( !taken ) return;

    const string *s = Target2String(target);
    do_call( s );
    
    if (s != &invalid)
        delete s;
}
示例#24
0
文件: main.cpp 项目: CCJY/coliru
    void operator () (std::vector<boost::any> const& v)
    {
        if (v.size() < sizeof...(Args))
        {
            std::cout << "Bad arity!" << std::endl; // Throw if you prefer
            return;
        }

        return do_call(v, std::make_integer_sequence<int, sizeof...(Args)>());
    }
示例#25
0
BOOL CVirtualHelper::call(const MSG *msg)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *arglst = Py_BuildValue("(N)", PyWinObject_FromMSG(msg));
	if (!arglst)
		return FALSE;
	BOOL ret = do_call(arglst);
	return ret;
}
示例#26
0
文件: codegen.c 项目: ras52/bootstrap
static
expr_code(stream, node, need_lval) {
    auto op = node[0];
    if ( op == '()' )
        do_call( stream, node, need_lval );
    else if ( is_op(node[0]) )
        opexpr_code( stream, node, need_lval );
    else
        return leaf_code( stream, node, need_lval );
}
示例#27
0
Sint32 vbutton::leftclick(Sint32 whichbutton)
{
	Sint32 retvalue=0;
	Uint8* mousekeys = query_keyboard();

	if (whichbutton == 1) // hotkeys
	{
		if (mousekeys[hotkey])
		{
			myscreen->soundp->play_sound(SOUND_BOW);
			vdisplay(1);
			vdisplay();
			if (myfunc)
			{
				retvalue = do_call(myfunc, arg);
			}
			while (mousekeys[hotkey])
				get_input_events(WAIT);
			return retvalue;
		}
	}
	else
	{
		if (mouse_on())
		{
			myscreen->soundp->play_sound(SOUND_BOW);
			vdisplay(1);
			vdisplay();
			if (myfunc)
			{
				retvalue = do_call(myfunc, arg);
			}
			//else
			//  retvalue = fun(arg);
			//while (mousekeys[hotkey])
			//	(void)1;
			return retvalue;
			//vdisplay();
		}
	}
	return -1; // wasn't focused on us
}
示例#28
0
BOOL CVirtualHelper::call(LPCREATESTRUCT lpcs)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *cs = PyObjectFromCreateStruct(lpcs);
	if (!cs) return FALSE;
	PyObject *arglst = Py_BuildValue("(O)", cs);
	BOOL ret = do_call(arglst);
	DODECREF(cs); // my reference.
	return ret;
}
示例#29
0
BOOL CVirtualHelper::call(CWnd *pWnd, int i, int i2)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *wnd = PyWinObject_FromCWnd(pWnd);
	if (!wnd) return FALSE;
	PyObject *arglst = Py_BuildValue("(Oii)",wnd, i, i2);
	BOOL ret = do_call(arglst);
	DODECREF (wnd); // the reference I created.
	return ret;
}
示例#30
0
BOOL CVirtualHelper::call(LPCREATESTRUCT lpcs, PyObject *ob)
{
	if (!handler) return FALSE;
	CEnterLeavePython _celp;
	PyObject *cs = PyObjectFromCreateStruct(lpcs);
	if (!cs) return FALSE;
	if (ob==NULL) ob = Py_None;
	PyObject *arglst = Py_BuildValue("(O,O)", cs, ob );
	DODECREF(cs); // ref I created.
	BOOL ret = do_call(arglst);
	return ret;
}