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


C++ OPERAND函数代码示例

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


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

示例1: apply_W

/** Wxy --> xyy */
static Object *
apply_W( Array *spine, unsigned int nargs, Manager *m )
{
    Object *a1, *a2;

    if ( nargs >= 2 )
    {
        a1 = array__pop( spine );
        a2 = array__pop( spine );

        /* Replace the function of the Apply with new object @xy. */
        SET_FUNCTION( a2,
            manager__object( m, apply_type,
                apply__new( OPERAND( a1 ), OPERAND( a2 ) ), NOFLAGS ) );

        /* Replace the operand of the Apply with new object y. */
        SET_OPERAND( a2, OPERAND( a2 ) );

        array__push( spine, a2 );

        return a2;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:27,代码来源:graph-reduce.c

示例2: switch

size_t CRegExp::regrepeat(TCHAR *node)
{
	size_t count;
	TCHAR *scan;
	TCHAR ch;

	switch (OP(node))
	{
	case ANY:
		return(_tcslen(reginput));
		break;
	case EXACTLY:
		ch = *OPERAND(node);
		count = 0;
		for (scan = reginput; *scan == ch; scan++)
			count++;
		return(count);
		break;
	case ANYOF:
		return(_tcsspn(reginput, OPERAND(node)));
		break;
	case ANYBUT:
		return(_tcscspn(reginput, OPERAND(node)));
		break;
	default:		// Oh dear.  Called inappropriately.
		TRACE0("internal error: bad call of regrepeat\n");
		return(0);	// Best compromise.
		break;
	}
	// NOTREACHED
}
开发者ID:apex-hughin,项目名称:CrimsonEditor,代码行数:31,代码来源:RegExp.cpp

示例3: apply_R

/** Rxyz --> yzx */
static Object *
apply_R( Array *spine, unsigned int nargs, Manager *m )
{
    Object *a1, *a2, *a3;

    if ( nargs >= 3 )
    {
        a1 = array__pop( spine );
        a2 = array__pop( spine );
        a3 = array__pop( spine );

        /* Replace the function of the Apply with new object @yz. */
        SET_FUNCTION( a3,
            manager__object( m, apply_type,
                apply__new( OPERAND( a2 ), OPERAND( a3 ) ), NOFLAGS ) );

        /* Replace the operand of the Apply with x. */
        SET_OPERAND( a3, OPERAND( a1 ) );

        return a3;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:26,代码来源:graph-reduce.c

示例4: regoptail

/*
   - regoptail - regtail on operand of first argument; nop if operandless
 */
static void regoptail (char * p, char * val)
{
    /* "Operandless" and "op != BRANCH" are synonymous in practice. */
    if (p == (char *) NULL || p == &regdummy || OP(p) != BRANCH)
        return;
    regtail(OPERAND(p), val);
}
开发者ID:Hobbitron,项目名称:tmi2_fluffos_v3,代码行数:10,代码来源:regexp.c

示例5: regoptail

static void regoptail(regex_t *preg, int p, int val )
{
	/* "Operandless" and "op != BRANCH" are synonymous in practice. */
	if (p != 0 && OP(preg, p) == BRANCH) {
		regtail(preg, OPERAND(p), val);
	}
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:7,代码来源:jimregexp.c

示例6: apply_Y

/** Yf --> f(Yf) */
static Object *
apply_Y( Array *spine, unsigned int nargs, Manager *m )
{
    Object *a1, *f;

    if ( nargs >= 1 )
    {
        a1 = array__pop( spine );

        f = OPERAND( a1 );

        /* Replace the operand of the Apply with new object @Yf. */
        SET_OPERAND( a1,
             manager__object( m, apply_type,
                 apply__new( FUNCTION( a1 ), f ), NOFLAGS ) );

        /* Replace the function of the Apply with f. */
        SET_FUNCTION( a1, f );

        return a1;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:26,代码来源:graph-reduce.c

示例7: regtail

void CRegExp::regoptail(TCHAR *p, TCHAR *val)
{
	// "Operandless" and "op != BRANCH" are synonymous in practice.
	if (!bEmitCode || OP(p) != BRANCH)
		return;
	regtail(OPERAND(p), val);
}
开发者ID:apex-hughin,项目名称:CrimsonEditor,代码行数:7,代码来源:RegExp.cpp

示例8: regmatchsimplerepeat

static int regmatchsimplerepeat(regex_t *preg, int scan, int matchmin)
{
	int nextch = '\0';
	const char *save;
	int no;
	int c;

	int max = preg->program[scan + 2];
	int min = preg->program[scan + 3];
	int next = regnext(preg, scan);

	/*
	 * Lookahead to avoid useless match attempts
	 * when we know what character comes next.
	 */
	if (OP(preg, next) == EXACTLY) {
		nextch = preg->program[OPERAND(next)];
	}
	save = preg->reginput;
	no = regrepeat(preg, scan + 5, max);
	if (no < min) {
		return 0;
	}
	if (matchmin) {
		/* from min up to no */
		max = no;
		no = min;
	}
	/* else from no down to min */
	while (1) {
		if (matchmin) {
			if (no > max) {
				break;
			}
		}
		else {
			if (no < min) {
				break;
			}
		}
		preg->reginput = save + utf8_index(save, no);
		reg_utf8_tounicode_case(preg->reginput, &c, (preg->cflags & REG_ICASE));
		/* If it could work, try it. */
		if (reg_iseol(preg, nextch) || c == nextch) {
			if (regmatch(preg, next)) {
				return(1);
			}
		}
		if (matchmin) {
			/* Couldn't or didn't, add one more */
			no++;
		}
		else {
			/* Couldn't or didn't -- back up. */
			no--;
		}
	}
	return(0);
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:59,代码来源:jimregexp.c

示例9: parse_reg_name

static int parse_reg_name(RRegItem *reg, csh handle, cs_insn *insn, int reg_num) {
	if (!reg) {
		return -1;
	}
	switch (OPERAND (reg_num).type) {
	case MIPS_OP_REG:
		reg->name = (char *)cs_reg_name (handle, OPERAND (reg_num).reg);
		break;
	case MIPS_OP_MEM:
		if (OPERAND (reg_num).mem.base != MIPS_REG_INVALID) {
			reg->name = (char *)cs_reg_name (handle, OPERAND (reg_num).mem.base);
		}
	default:
		break;
	}
	return 0;
}
开发者ID:jroimartin,项目名称:radare2,代码行数:17,代码来源:anal_mips_cs.c

示例10: regrepeat

/*
 - regrepeat - repeatedly match something simple, report how many
 */
static int regrepeat(regex_t *preg, int p, int max)
{
	int count = 0;
	const char *scan;
	int opnd;
	int ch;
	int n;

	scan = preg->reginput;
	opnd = OPERAND(p);
	switch (OP(preg, p)) {
	case ANY:
		/* No need to handle utf8 specially here */
		while (!reg_iseol(preg, *scan) && count < max) {
			count++;
			scan++;
		}
		break;
	case EXACTLY:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (preg->program[opnd] != ch) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	case ANYOF:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) == 0) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	case ANYBUT:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) != 0) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	default:		/* Oh dear.  Called inappropriately. */
		preg->err = REG_ERR_INTERNAL;
		count = 0;	/* Best compromise. */
		break;
	}
	preg->reginput = scan;

	return(count);
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:60,代码来源:jimregexp.c

示例11: op_fillval

static void op_fillval(RAnal *anal, RAnalOp *op, csh *handle, cs_insn *insn) {
	static RRegItem reg;
	switch (op->type & R_ANAL_OP_TYPE_MASK) {
	case R_ANAL_OP_TYPE_LOAD:
		if (OPERAND(1).type == MIPS_OP_MEM) {
			ZERO_FILL (reg);
			op->src[0] = r_anal_value_new ();
			op->src[0]->reg = &reg;
			parse_reg_name (op->src[0]->reg, *handle, insn, 1);
			op->src[0]->delta = OPERAND(1).mem.disp;
		}
		break;
	case R_ANAL_OP_TYPE_STORE:
		if (OPERAND(1).type == MIPS_OP_MEM) {
			ZERO_FILL (reg);
			op->dst = r_anal_value_new ();
			op->dst->reg = &reg;
			parse_reg_name (op->dst->reg, *handle, insn, 1);
			op->dst->delta = OPERAND(1).mem.disp;
		}
		break;
	case R_ANAL_OP_TYPE_SHL:
	case R_ANAL_OP_TYPE_SHR:
	case R_ANAL_OP_TYPE_SAR:
	case R_ANAL_OP_TYPE_XOR:
	case R_ANAL_OP_TYPE_SUB:
	case R_ANAL_OP_TYPE_AND:
	case R_ANAL_OP_TYPE_ADD:
	case R_ANAL_OP_TYPE_OR:
		SET_SRC_DST_3_REG_OR_IMM (op);
		break;
	case R_ANAL_OP_TYPE_MOV:
		SET_SRC_DST_2_REGS (op);
		break;
	case R_ANAL_OP_TYPE_DIV:
		SET_SRC_DST_3_REGS (op);
		break;
	}
	if (insn && (insn->id == MIPS_INS_SLTI || insn->id == MIPS_INS_SLTIU)) {
		SET_SRC_DST_3_IMM (op);
	}
}
开发者ID:jroimartin,项目名称:radare2,代码行数:42,代码来源:anal_mips_cs.c

示例12: op_fillval

static void op_fillval(RAnalOp *op, csh handle, cs_insn *insn) {
	static RRegItem reg;
	switch (op->type & R_ANAL_OP_TYPE_MASK) {
	case R_ANAL_OP_TYPE_MOV:
		ZERO_FILL (reg);
		if (OPERAND(1).type == M68K_OP_MEM) {
			op->src[0] = r_anal_value_new ();
			op->src[0]->reg = &reg;
			parse_reg_name (op->src[0]->reg, handle, insn, 1);
			op->src[0]->delta = OPERAND(0).mem.disp;
		} else if (OPERAND(0).type == M68K_OP_MEM) {
			op->dst = r_anal_value_new ();
			op->dst->reg = &reg;
			parse_reg_name (op->dst->reg, handle, insn, 0);
			op->dst->delta = OPERAND(1).mem.disp;
		}
		break;
	case R_ANAL_OP_TYPE_LEA:
		ZERO_FILL (reg);
		if (OPERAND(1).type == M68K_OP_MEM) {
			op->dst = r_anal_value_new ();
			op->dst->reg = &reg;
			parse_reg_name (op->dst->reg, handle, insn, 1);
			op->dst->delta = OPERAND(1).mem.disp;
		}
		break;
	}
}
开发者ID:das-labor,项目名称:radare2,代码行数:28,代码来源:anal_m68k_cs.c

示例13: apply_T

/** Txy --> yx */
static Object *
apply_T( Array *spine, unsigned int nargs )
{
    Object *a1, *a2;

    if ( nargs >= 2 )
    {
        a1 = array__pop( spine );
        a2 = array__pop( spine );

        /* Replace the function of the Apply with y. */
        SET_FUNCTION( a2, OPERAND( a2 ) );

        /* Replace the operand of the Apply with x. */
        SET_OPERAND( a2, OPERAND( a1 ) );

        return a2;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:23,代码来源:graph-reduce.c

示例14: apply_w

/** wx --> xx */
static Object *
apply_w( Array *spine, unsigned int nargs )
{
    Object *a1;

    if ( nargs >= 1 )
    {
        a1 = array__pop( spine );

        /* Replace the function of the Apply with x. */
        SET_FUNCTION( a1, OPERAND( a1 ) );

        return a1;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:19,代码来源:graph-reduce.c

示例15: apply_I

/** Ix --> x */
static Object *
apply_I( Array *spine, unsigned int nargs )
{
    Object *a1;

    if ( nargs >= 1 )
    {
        a1 = array__pop( spine );

        /* Replace the Apply with an indirection node to x. */
        substitute_boxed( a1, OPERAND( a1 ) );

        return a1;
    }

    else
        return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:19,代码来源:graph-reduce.c


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