• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BODY函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BODY函数的典型用法代码示例。如果您正苦于以下问题:C++ BODY函数的具体用法?C++ BODY怎么用?C++ BODY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BODY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Kpp__SetupRule

short PEXPORT Kpp__SetupRule(LPRULE lpRule, LISTID idVarList,
                             LISTID idClassList, EXPID idIfPart,
                             EXPID idThenPart)
{
#ifdef INFERENCE
    PRIORITY(lpRule) = 0;
    MATCHES(lpRule) = NULLID;
    NUMVARS(lpRule) = KppListLen(idVarList);
    BODY(lpRule) = JoinIfThen(idIfPart, idThenPart);
    if (idIfPart)
        KppDeleteExp(idIfPart);
    if (idThenPart)
        KppDeleteExp(idThenPart);

    if (NUMVARS(lpRule) == 0)
        VARS(lpRule) = KppMakeList(0);
    else
    {
        VARS(lpRule) = MakeRuleArgList(idVarList, idClassList);
        if (idVarList)
            KppDeleteList(idVarList);
        if (idClassList)
            KppDeleteList(idClassList);
        idVarList = VARS(lpRule);
        KppClearVarList(idVarList);
        KppBindVars(idVarList, BODY(lpRule));
        }
#endif

   return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:31,代码来源:KFUNC.C


示例2: __CopyRule

RULEID __CopyRule(LPRULE lpOldRule, ITEMID idName)
{
#ifdef INFERENCE
    RULEID      idRule;
    LPRULE      lpRule;
    LPEXP       lpBody;
    EXPID       idBody;

    if (GetRule(idName) != NULLID)
        return NULLID;
    
    idRule = KppAddItemAndName (RULE, (LPLPSTR)&lpRule, idName);
    if (!idRule)
        return NULLID;
    NAME(lpRule) = idName;
    FLAGS(lpRule) = NULL;
    PRIORITY(lpRule) = 0;
    MATCHES(lpRule) = NULLID;
    NUMVARS(lpRule) = NUMVARS(lpOldRule);
    if (! (FLAGS(lpRule) & CBODY))
    {
        VARS(lpRule) = KppDeepListCopy(VARS(lpOldRule), Kpp__CopyVar,idRule);
        idBody = BODY(lpRule) = KppCopyExp(
                        BODY(lpOldRule), (LPLPSTR)&lpBody, kPERMMODE);
        KppReleaseExp(idBody);
    }
    KppReleaseItem(RULE, idRule);

    /* Add to KnowledgeTools */
    KppAddItemCB (RULE, 1);

    return idRule;
#endif
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,代码来源:KFUNC.C


示例3: rb_cpApplyDampedSpring

static VALUE 
rb_cpApplyDampedSpring(VALUE klass, VALUE a, VALUE b, 
  VALUE anchr1, VALUE anchr2, VALUE rlen, VALUE k, VALUE dmp, VALUE dt)
{
  cpApplyDampedSpring(BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2), 
  NUM2DBL(rlen), NUM2DBL(k), NUM2DBL(dmp), NUM2DBL(dt));
  return klass;
} 
开发者ID:banister,项目名称:chipmunk,代码行数:8,代码来源:rb_cpBody.c


示例4: Kpp__ResetGoal

short PEXPORT Kpp__ResetGoal(LPGOAL lpGoal)
{
#ifdef INFERENCE
    /* delete the goal body */
    if (! (FLAGS(lpGoal) & CBODY)
        && BODY(lpGoal) != NULLID)
        KppDeleteExp(BODY(lpGoal));
#endif

    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:11,代码来源:KFUNC.C


示例5: rb_cpBodyInitialize

static VALUE
rb_cpBodyInitialize(VALUE self, VALUE m, VALUE i) {
  cpBody *body = BODY(self);
  cpBodyInit(body, NUM2DBL(m), NUM2DBL(i));
  body->data = (void *)self;
  return self;
}
开发者ID:Anaxim,项目名称:chipmunk,代码行数:7,代码来源:rb_cpBody.c


示例6: do_bodyCode

SEXP attribute_hidden do_bodyCode(SEXP call, SEXP op, SEXP args, SEXP rho)
{
    checkArity(op, args);
    if (TYPEOF(CAR(args)) == CLOSXP)
	return duplicate(BODY(CAR(args)));
    else return R_NilValue;
}
开发者ID:o-,项目名称:Rexperiments,代码行数:7,代码来源:builtin.c


示例7: do_envirgets

SEXP attribute_hidden do_envirgets(SEXP call, SEXP op, SEXP args, SEXP rho)
{
    SEXP env, s = CAR(args);

    checkArity(op, args);
    check1arg(args, call, "x");

    env = CADR(args);

    if (TYPEOF(CAR(args)) == CLOSXP
	&& (isEnvironment(env) ||
	    isEnvironment(env = simple_as_environment(env)) ||
	    isNull(env))) {
	if (isNull(env))
	    error(_("use of NULL environment is defunct"));
	if(MAYBE_SHARED(s))
	    /* this copies but does not duplicate args or code */
	    s = duplicate(s);
	if (TYPEOF(BODY(s)) == BCODESXP)
	    /* switch to interpreted version if compiled */
	    SET_BODY(s, R_ClosureExpr(CAR(args)));
	SET_CLOENV(s, env);
    }
    else if (isNull(env) || isEnvironment(env) ||
	isEnvironment(env = simple_as_environment(env)))
	setAttrib(s, R_DotEnvSymbol, env);
    else
	error(_("replacement object is not an environment"));
    return s;
}
开发者ID:o-,项目名称:Rexperiments,代码行数:30,代码来源:builtin.c


示例8: __EvalFunc

WORD __EvalFunc(LPFUNC lpFunc, LISTID idArgList)
{
    WORD i = FALSE;
    ATOMID idName = NAME(lpFunc);
    EXPID idBody;
    LPEXP lpBody;
    LISTID idVarList;
    GLOBALHANDLE hBody;

    if (NUMVARS(lpFunc) != KppListLen(idArgList))
        return KppRegisterKappaMessage(hResThisDll, IDE_BADNUMARG, 
                                       idName, NULLID, NULLID);

    idVarList = VARS(lpFunc);
    idBody = BODY(lpFunc);
    if (!idBody)
        KappaReturnAtom(lpIDs->idNull);

    UnwindProtect(cleanup);
    if (lpKALView && lpKALView->bActive)
        (*lpKALView->PushFn)(idName);
    lpBody = KppCopyTempExp(idBody, (GLOBALHANDLE FAR *) &hBody);
    Kpp__LoadArgs(lpBody, idVarList, idArgList);
    
    i = Kpp_EvalExp(lpBody);
  cleanup:
    KppReleaseTempExp(hBody, i);
    KppUnbindVars(idVarList);
    if (lpKALView && lpKALView->bActive)
        (*lpKALView->Pop)(TRUE);
    EndProtect();
    
    return i;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,代码来源:KFUNC.C


示例9: rb_cpShapeSetBody

static VALUE
rb_cpShapeSetBody(VALUE self, VALUE body)
{
	SHAPE(self)->body = BODY(body);
	rb_ivar_set(self, id_body, body);
	
	return body;
}
开发者ID:0w,项目名称:moai-dev,代码行数:8,代码来源:rb_cpShape.c


示例10: rb_cpBodyIsStatic

static VALUE
rb_cpBodyIsStatic(VALUE self) {
  cpBody * body = BODY(self);
  cpBool stat   = 0;
  // cpBodyInitStatic(body);
  stat = cpBodyIsStatic(body);
  return stat ? Qtrue : Qfalse;
  //
}
开发者ID:Anaxim,项目名称:chipmunk,代码行数:9,代码来源:rb_cpBody.c


示例11: nbGenerateIsotropicCore

/* generatePlummer: generate Plummer model initial conditions for test
 * runs, scaled to units such that M = -4E = G = 1 (Henon, Heggie,
 * etc).  See Aarseth, SJ, Henon, M, & Wielen, R (1974) Astr & Ap, 37,
 * 183.
 */
static int nbGenerateIsotropicCore(lua_State* luaSt,

				   dsfmt_t* prng,
				   unsigned int nbody,
				   real mass1,
				   real mass2,

				   mwbool ignore,
				   
				   mwvector rShift,
				   mwvector vShift,
				   real radiusScale1,
				   real radiusScale2)
{
    unsigned int i;
    int table;
    Body b;
    real r, velScale;

    real mass = mass1 + mass2;
    real radiusScale = mw_sqrt(mw_pow(radiusScale1,2) + mw_pow(radiusScale2,2));
    memset(&b, 0, sizeof(b));

    velScale =  mw_sqrt(mass / radiusScale);     /* and recip. speed scale */

    b.bodynode.type = BODY(ignore);    /* Same for all in the model */
    b.bodynode.mass = mass / nbody;    /* Mass per particle */

    lua_createtable(luaSt, nbody, 0);
    table = lua_gettop(luaSt);
    
    for (i = 0; i < nbody; ++i)
    {
        do
        {
	  r = isotropicRandomR(prng, radiusScale1, radiusScale2, mass1, mass2);
	    /* FIXME: We should avoid the divide by 0.0 by multiplying
             * the original random number by 0.9999.. but I'm too lazy
             * to change the tests. Same with other models */
        }
        while (isinf(r));

        b.bodynode.pos = isotropicBodyPosition(prng, rShift, r);

        b.vel = isotropicBodyVelocity(prng, r, vShift, velScale, radiusScale1, radiusScale2, mass1, mass2);
	
        assert(nbPositionValid(b.bodynode.pos));

        pushBody(luaSt, &b);
	//	printf("Body %d is pushed. \n",i);
        lua_rawseti(luaSt, table, i + 1);
    }

    return 1;
}
开发者ID:MarchM4,项目名称:Milkyway-home-server-expansion,代码行数:60,代码来源:nbody_isotropic.c


示例12: rb_cpCircleInitialize

static VALUE
rb_cpCircleInitialize(VALUE self, VALUE body, VALUE radius, VALUE offset)
{
	cpCircleShape *circle = (cpCircleShape *)SHAPE(self);
	
	cpCircleShapeInit(circle, BODY(body), NUM2DBL(radius), *VGET(offset));
	circle->shape.data = (void *)self;
	circle->shape.collision_type = Qnil;

	rb_ivar_set(self, id_body, body);
	
	return self;
}
开发者ID:0w,项目名称:moai-dev,代码行数:13,代码来源:rb_cpShape.c


示例13: rb_cpSegmentInitialize

static VALUE
rb_cpSegmentInitialize(VALUE self, VALUE body, VALUE a, VALUE b, VALUE r)
{
	cpSegmentShape *seg = (cpSegmentShape *)SHAPE(self);
	
	cpSegmentShapeInit(seg, BODY(body), *VGET(a), *VGET(b), NUM2DBL(r));
	seg->shape.data = (void *)self;
	seg->shape.collision_type = Qnil;

	rb_ivar_set(self, id_body, body);
	
	return self;
}
开发者ID:0w,项目名称:moai-dev,代码行数:13,代码来源:rb_cpShape.c


示例14: apply

obj_t * apply(obj_t *args, obj_t *env) {

	assert(IS_LIST(args));

	if (IS_LIST(CAR(args)) && IS_FUNC(CAR(CAR(args)))) {

		return (FUNC(CAR(CAR(args))))(CDR(args), env);
	} else if (IS_LIST(CAR(args)) && IS_DEFUNC(CAR(CAR(args)))) {

		obj_t * func_args;
		obj_t * call_args;

		obj_t * body;
		obj_t * result;

		body = clone_obj(BODY(CAR(CAR(args))));
		func_args = ARGS(CAR(CAR(args)));
		call_args = CDR(args);

		/* ((<DEFUNC:[args=(X)][body=(TIMES X X)]>) 3) */

		while (IS_LIST(func_args) && IS_LIST(call_args)) {
			obj_t * func_arg = CAR(func_args);
			obj_t * call_arg = CAR(call_args);

			replace_obj(func_arg, call_arg, body);

			func_args = CDR(func_args);
			call_args = CDR(call_args);
		}

		if ((IS_LIST(func_args) && !IS_LIST(call_args)) ||
				(!IS_LIST(func_args) && IS_LIST(call_args))) {

			free_obj(body); /* clean up */

			fprintf(stdout, "Unexpected number of arguments\n");
			return alloc_fail();
		}

		result = eval(body, env);

		free_obj(body);

		return result;

	} else {

		return clone_obj(args);
	}
}
开发者ID:tcort,项目名称:edgar,代码行数:51,代码来源:apply.c


示例15: reassign_function

SEXP reassign_function(SEXP name, SEXP env, SEXP old_fun, SEXP new_fun)
{
  if (TYPEOF(name) != SYMSXP) error("name must be a symbol");
  if (TYPEOF(env) != ENVSXP) error("env must be an environment");
  if (TYPEOF(old_fun) != CLOSXP) error("old_fun must be a function");
  if (TYPEOF(new_fun) != CLOSXP) error("new_fun must be a function");

  SET_FORMALS(old_fun, FORMALS(new_fun));
  SET_BODY(old_fun, BODY(new_fun));
  SET_CLOENV(old_fun, CLOENV(new_fun));
  DUPLICATE_ATTRIB(old_fun, new_fun);

  return R_NilValue;
}
开发者ID:BayesyBrad,项目名称:testthat,代码行数:14,代码来源:reassign.c


示例16: Kpp__ResetFunc

short PEXPORT Kpp__ResetFunc(LPFUNC lpFunc)
{
    if (! (FLAGS(lpFunc) & CBODY))
    {
        /* first delete the list of variables */
        if (VARS(lpFunc) != NULLID)
        {
            KppClearVarList(VARS(lpFunc));
            KppClearList(VARS(lpFunc), VAR);
            KppDeleteList(VARS(lpFunc));
            VARS (lpFunc) = NULLID;
        }

        /* then delete the body */
        if (BODY(lpFunc) != NULLID)
        {
            KppDeleteExp(BODY(lpFunc));
            BODY(lpFunc) = NULLID;
        }
    }
    
    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:23,代码来源:KFUNC.C


示例17: __CopyGoal

GOALID __CopyGoal(LPGOAL lpOldGoal, ITEMID idName)
{
#ifdef INFERENCE
    GOALID      idGoal;
    LPGOAL      lpGoal;
    LPEXP       lpBody;
    EXPID       idBody;

    if (GetGoal(idName) != NULLID)
        return NULLID;
    
    idGoal = KppAddItemAndName(GOAL, (LPLPSTR)&lpGoal, idName);
    if (!idGoal)
        return NULLID;
    
    NAME(lpGoal) = idName;
    FLAGS(lpGoal) = NULL;
    PRIORITY(lpGoal) = 0;
    if (! (FLAGS(lpGoal) & CBODY))
    {
        if (BODY(lpGoal) == NULLID)
            idBody = NULLID;
        else
        {
            idBody = BODY(lpGoal) = KppCopyExp(BODY(lpOldGoal),
                                (LPLPSTR)&lpBody, kPERMMODE);
            KppReleaseExp(idBody);
        }
    }
    KppReleaseItem(GOAL, idGoal);

    /* Add to KnowledgeTools */
    KppAddItemCB(GOAL, 1);

    return idGoal;
#endif
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:37,代码来源:KFUNC.C


示例18: Kpp__ResetRule

short PEXPORT Kpp__ResetRule(LPRULE lpRule)
{
#ifdef INFERENCE
    if (FLAGS(lpRule) & CBODY)
    {
        if (VARS(lpRule)) KppDeleteList(VARS(lpRule));
        if (CIFPAIRS(lpRule)) KppDeleteList(CIFPAIRS(lpRule));
        if (CTHENPAIRS(lpRule)) KppDeleteList(CTHENPAIRS(lpRule));
    }
    else
    {
        /* first delete the list of variables */
        if (VARS(lpRule) != NULLID)
        {
            KppClearVarList(VARS(lpRule));
            KppClearList(VARS(lpRule), VAR);
            KppDeleteList(VARS(lpRule));
            VARS (lpRule) = NULLID;
        }

        /* then delete the body */
        if (BODY(lpRule) != NULLID)
        {
            KppDeleteExp(BODY(lpRule));
            BODY(lpRule) = NULLID;
        }
    }
    
    /* then delete list of matches if it exists! */
    if (MATCHES(lpRule) != NULLID) {
        KppDeleteMatchList(MATCHES(lpRule));
        MATCHES(lpRule) = NULLID;
        }
#endif

    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:37,代码来源:KFUNC.C


示例19: __CopyFunc

FUNCID __CopyFunc(LPFUNC lpOldFunc, ITEMID idName)
{
    FUNCID      idFunc;
    LPFUNC      lpFunc;
    LPEXP       lpBody;
    EXPID       idBody;

    if (GetFunc(idName) != NULLID)
        return NULLID;
    
    idFunc = KppAddItemAndName (FUNC, (LPLPSTR)&lpFunc, idName);
    if (!idFunc)
        return NULLID;
    NAME(lpFunc) = idName;
    FLAGS(lpFunc) = NULL;
    NUMVARS(lpFunc) = NUMVARS(lpOldFunc);
    if (! (FLAGS(lpFunc) & CBODY))
    {
        VARS(lpFunc) = KppDeepListCopy(VARS(lpOldFunc), Kpp__CopyVar, idFunc);
        if (BODY(lpOldFunc) == NULLID)
            idBody = NULLID;
        else
        {
            idBody = BODY(lpFunc) = KppCopyExp(BODY(lpOldFunc),
                                        (LPLPSTR)&lpBody, kPERMMODE);
            KppReleaseExp(idBody);
        }
    }

    KppReleaseItem(FUNC, idFunc);

    /* Add to KnowledgeTools */
    KppAddItemCB (FUNC, 1);

    return idFunc;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:36,代码来源:KFUNC.C


示例20: PrintLanguageEtc

/* PrintLanguage() or PrintClosure() : */
static void PrintLanguageEtc(SEXP s, Rboolean useSource, Rboolean isClosure)
{
    int i;
    SEXP t = getAttrib(s, R_SrcrefSymbol);
    Rboolean useSrc = useSource && isInteger(t);
    if (useSrc) {
	PROTECT(t = lang2(R_AsCharacterSymbol, t));
	t = eval(t, R_BaseEnv);
	UNPROTECT(1);
    } else {
	t = deparse1w(s, 0, useSource | DEFAULTDEPARSE);
    }
    PROTECT(t);
    for (i = 0; i < LENGTH(t); i++) {
 	Rprintf("%s\n", translateChar(STRING_ELT(t, i))); // translate: for srcref part (PR#16732)
    }
    UNPROTECT(1);
    if (isClosure) {
	if (isByteCode(BODY(s))) Rprintf("<bytecode: %p>\n", BODY(s));
	t = CLOENV(s);
	if (t != R_GlobalEnv)
	    Rprintf("%s\n", EncodeEnvironment(t));
    }
}
开发者ID:radfordneal,项目名称:pqR,代码行数:25,代码来源:print.c



注:本文中的BODY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BOOL函数代码示例发布时间:2022-05-30
下一篇:
C++ BNerr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap