当前位置: 首页>>代码示例>>C++>>正文


C++ CHECKOP函数代码示例

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


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

示例1: prim_event_exists

void
prim_event_exists(PRIM_PROTOTYPE)
{
    CHECKOP(1);
    oper1 = POP();		/* str: eventID to look for */

    if (oper1->type != PROG_STRING || !oper1->data.string)
	abort_interp("Expected a non-null string eventid to search for.");

    result = muf_event_exists(fr, oper1->data.string->data);

    CLEAR(oper1);
    PushInt(result);
}
开发者ID:foxbird,项目名称:fuzzball,代码行数:14,代码来源:p_misc.c

示例2: prim_prettylock

void 
prim_prettylock(PRIM_PROTOTYPE)
{
    const char *ptr;

    CHECKOP(1);
    oper1 = POP();		/* lock: lock */
    if (oper1->type != PROG_LOCK)
	abort_interp("Invalid argument");
    ptr = unparse_boolexp(ProgUID, oper1->data.lock, 1);
    CHECKOFLOW(1);
    CLEAR(oper1);
    PushString(ptr);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:14,代码来源:p_misc.c

示例3: prim_lreverse

void
prim_lreverse(PRIM_PROTOTYPE)
{
	int i;

	CHECKOP(1);
	oper1 = POP();
	if (oper1->type != PROG_INTEGER)
		abort_interp("Invalid argument type.");
	tmp = oper1->data.number;	/* Depth on stack */
	if (tmp < 0)
		abort_interp("Argument must be positive.");
	CHECKOP(tmp);
	if (tmp > 0) {
		for (i = 0; i < (tmp / 2); i++) {
			temp2 = arg[*top - (tmp - i)];
			arg[*top - (tmp - i)] = arg[*top - (i + 1)];
			arg[*top - (i + 1)] = temp2;
		}
	}
	CLEAR(oper1);
	PushInt(tmp);
}
开发者ID:hyena,项目名称:fuzzball,代码行数:23,代码来源:p_stack.c

示例4: prim_interp

void
prim_interp(PRIM_PROTOTYPE)
{
	struct inst *oper1 = NULL; /* prevents re-entrancy issues! */
	struct inst *oper2 = NULL; /* prevents re-entrancy issues! */
	struct inst *oper3 = NULL; /* prevents re-entrancy issues! */

	struct inst *rv=NULL;
	char buf[BUFFER_LEN];
	struct frame *tmpfr;

	CHECKOP(3);
	oper3 = POP();				/* string -- top stack argument */
	oper2 = POP();				/* dbref  --  trigger */
	oper1 = POP();				/* dbref  --  Program to run */

	if (!valid_object(oper1) || Typeof(oper1->data.objref) != TYPE_PROGRAM)
		abort_interp("Bad program reference. (1)");
	if (!valid_object(oper2))
		abort_interp("Bad object. (2)");
	if ((mlev < 3) && !permissions(ProgUID, oper2->data.objref))
		abort_interp("Permission denied.");
	if (fr->level > 8)
		abort_interp("Interp call loops not allowed.");
	CHECKREMOTE(oper2->data.objref);

	strcpyn(buf, sizeof(buf), match_args);
	strcpyn(match_args, sizeof(match_args), oper3->data.string ? oper3->data.string->data : "");
	tmpfr = interp(fr->descr, player, DBFETCH(player)->location, oper1->data.objref,
				   oper2->data.objref, PREEMPT, STD_HARDUID, 0);
	if (tmpfr) {
		rv = interp_loop(player, oper1->data.objref, tmpfr, 1);
	}
	strcpyn(match_args, sizeof(match_args), buf);

	CLEAR(oper3);
	CLEAR(oper2);
	CLEAR(oper1);

	if (rv) {
		if (rv->type < PROG_STRING) {
			push(arg, top, rv->type, MIPSCAST(&rv->data.number));
		} else {
			push(arg, top, rv->type, MIPSCAST(rv->data.string));
		}
	} else {
		PushNullStr;
	}

}
开发者ID:hyena,项目名称:fuzzball,代码行数:50,代码来源:p_stack.c

示例5: prim_fread

void prim_fread(PRIM_PROTOTYPE)
{
  FILE *fh;
  char *filename;
  double offset;
  char tempchr[2];
  int result;
  CHECKOP(2);
  oper1 = POP();
  oper2 = POP();
  if (getuid() == 0 ) 
    abort_interp("Muck is running under root privs, file prims disabled.");
  if (mlev < LBOY) abort_interp("BOY primitive only.");  
  if(oper1->type != PROG_INTEGER)
    abort_interp("Arguement 1 is not an integer.");
  if(oper1->data.number < 0 ) abort_interp("Arguement 1 is a negative number.");
  if(oper2->type != PROG_STRING) abort_interp("Arguement 2 is not a string.");
  if(!oper2->data.string) abort_interp("Argueemnt 2 is a null string.");
  offset = oper1->data.number;
  filename = oper2->data.string->data;
#ifdef SECURE_FILE_PRIMS
  if (!(valid_name(filename)))
      abort_interp( "Invalid file name.");
  if ( strchr( filename, '$' ) == NULL )
    filename = set_directory(filename);
  else
    filename = parse_token( filename );
  if ( filename == NULL )
    abort_interp( "Invalid shortcut used." );
#endif
  fh = fopen(filename, "r");
  if (fh == NULL) { result = 0; } else {
    fseek(fh, offset, SEEK_SET);
    tempchr[0] = (char) fgetc(fh);
    tempchr[1] = '\0';
    fclose(fh);
    sprintf(buf, "%s", tempchr);
    result = 1;
    if(tp_log_files)
      log2filetime("logs/files", "#%d by %s FREAD: %s \n", program, unparse_object(player, player), oper2->data.string->data); 
   if ( tempchr[0] == EOF )
      result = 0;
  }
  CLEAR(oper1);
  CLEAR(oper2);
  if( result )
     PushString(buf);
  else 
     PushNullStr;
} 
开发者ID:CyberLeo,项目名称:protomuck,代码行数:50,代码来源:p_file.c

示例6: prim_bitand

void
prim_bitand(PRIM_PROTOTYPE)
{
    CHECKOP(2);
    oper1 = POP();
    oper2 = POP();
    if (!arith_type(oper2, oper1))
        abort_interp("Invalid argument type");
    result = oper2->data.number & oper1->data.number;
    tmp = oper2->type;
    CLEAR(oper1);
    CLEAR(oper2);
    push(arg, top, tmp, MIPSCAST & result);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:14,代码来源:p_math.c

示例7: prim_logstatus

void
prim_logstatus(PRIM_PROTOTYPE)
{
    CHECKOP(1);
    oper1 = POP();
    if (mlev < LARCH)
        abort_interp("Archwizard primitive.");
    if (oper1->type != PROG_STRING)
        abort_interp("Non-string argument (1).");
    if (oper1->data.string) {
        strcpy(buf, oper1->data.string->data);
        log_status("%s\r\n", buf);
    }
    CLEAR(oper1);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:15,代码来源:p_system.c

示例8: prim_online

void 
prim_online(PRIM_PROTOTYPE)
{
    CHECKOP(0);
    if (mlev < (tp_compatible_muf ? LM3 : LM2))
	abort_interp(tp_compatible_muf ? "M3 prim" : "M2 prim");
    result = pcount();
    CHECKOFLOW(result + 1);
    while (result) {
	ref = pdbref(result--);
	PushObject(ref);
    }
    result = pcount();
    PushInt(result);
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:15,代码来源:p_connects.c

示例9: prim_nextdescr

void 
prim_nextdescr(PRIM_PROTOTYPE)
{
    /* int -- int */
    CHECKOP(1);
    oper1 = POP();
    if (mlev < LM3)
	abort_interp("M3 prim");
    if (oper1->type != PROG_INTEGER)
	abort_interp("Argument not an integer (1)");
    result = oper1->data.number;
    result = pnextdescr(result);
    CLEAR(oper1);
    PushInt(result);
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:15,代码来源:p_connects.c

示例10: prim_awakep

void 
prim_awakep(PRIM_PROTOTYPE)
{
    CHECKOP(1);
    oper1 = POP();
    if (!valid_object(oper1))
	abort_interp("invalid argument");
    ref = oper1->data.objref;
    if (Typeof(ref) == TYPE_THING && (FLAGS(ref) & ZOMBIE))
	ref = OWNER(ref);
    if (Typeof(ref) != TYPE_PLAYER)
	abort_interp("invalid argument");
    result = online(ref);
    PushInt(result);
}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:15,代码来源:p_connects.c

示例11: prim_atan

void
prim_atan(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (!no_good(oper1->data.fnumber)) {
		fresult = atan(oper1->data.fnumber);
	} else {
		fresult = H_PI;
	}
	CLEAR(oper1);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:15,代码来源:p_float.c

示例12: prim_atan2

void
prim_atan2(PRIM_PROTOTYPE)
{
	CHECKOP(2);
	oper2 = POP();
	oper1 = POP();
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	if (oper2->type != PROG_FLOAT)
		abort_interp("Non-float argument. (2)");
	fresult = atan2(oper1->data.fnumber, oper2->data.fnumber);
	CLEAR(oper1);
	CLEAR(oper2);
	PushFloat(fresult);
}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:15,代码来源:p_float.c

示例13: prim_put

void
prim_put(PRIM_PROTOTYPE)
{
    CHECKOP(2);
    oper1 = POP();
    oper2 = POP();
    if (oper1->type != PROG_INTEGER || oper1->data.number <= 0)
	abort_interp("Operand not a positive integer.");
    tmp = oper1->data.number;
    EXPECT_WRITE_STACK(tmp);
    CLEAR(&arg[*top - tmp]);
    copyinst(oper2, &arg[*top - tmp]);
    CLEAR(oper1);
    CLEAR(oper2);
}
开发者ID:foxbird,项目名称:fuzzball,代码行数:15,代码来源:p_stack.c

示例14: prim_ftostr

void
prim_ftostr(PRIM_PROTOTYPE)
{
	CHECKOP(1);
	oper1 = POP();
       if ( oper1->type == PROG_INTEGER ) 
          { oper1->type = PROG_FLOAT;
            oper1->data.fnumber = oper1->data.number;
          }
	if (oper1->type != PROG_FLOAT)
		abort_interp("Non-float argument. (1)");
	sprintf(buf, "%#g", oper1->data.fnumber);
	CLEAR(oper1);
	PushString(buf);
}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:15,代码来源:p_float.c

示例15: prim_cancallp

void
prim_cancallp(PRIM_PROTOTYPE)
{
    CHECKOP(2);
    oper2 = POP();		/* string: public function name */
    oper1 = POP();		/* dbref: Program dbref to check */
    if (oper1->type != PROG_OBJECT)
	abort_interp("Expected dbref argument. (1)");
    if (!valid_object(oper1))
	abort_interp("Invalid dbref (1)");
    if (Typeof(oper1->data.objref) != TYPE_PROGRAM)
	abort_interp("Object is not a MUF Program. (1)");
    if (oper2->type != PROG_STRING)
	abort_interp("Expected string argument. (2)");
    if (!oper2->data.string)
	abort_interp("Invalid Null string argument. (2)");

    if (!(PROGRAM_CODE(oper1->data.objref))) {
	struct line *tmpline;

	tmpline = PROGRAM_FIRST(oper1->data.objref);
	PROGRAM_SET_FIRST(oper1->data.objref,
			  (struct line *) read_program(oper1->data.objref));
	do_compile(-1, OWNER(oper1->data.objref), oper1->data.objref, 0);
	free_prog_text(PROGRAM_FIRST(oper1->data.objref));
	PROGRAM_SET_FIRST(oper1->data.objref, tmpline);
    }

    result = 0;
    if (ProgMLevel(oper1->data.objref) > 0 &&
	(mlev >= 4 || OWNER(oper1->data.objref) == ProgUID || Linkable(oper1->data.objref))
	    ) {
	struct publics *pbs;

	pbs = PROGRAM_PUBS(oper1->data.objref);
	while (pbs) {
	    if (!strcasecmp(oper2->data.string->data, pbs->subname))
		break;
	    pbs = pbs->next;
	}
	if (pbs && mlev >= pbs->mlev)
	    result = 1;
    }
    CHECKOFLOW(1);
    CLEAR(oper1);
    CLEAR(oper2);
    PushInt(result);
}
开发者ID:foxbird,项目名称:fuzzball,代码行数:48,代码来源:p_misc.c


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