本文整理汇总了C++中OPERAND函数的典型用法代码示例。如果您正苦于以下问题:C++ OPERAND函数的具体用法?C++ OPERAND怎么用?C++ OPERAND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OPERAND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 == ®dummy || 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 = ®
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 = ®
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 = ®
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 = ®
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 = ®
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
示例16: apply_K
/** Kxy --> x */
static Object *
apply_K( Array *spine, unsigned int nargs )
{
Object *a1, *a2;
if ( nargs >= 2 )
{
a1 = array__pop( spine );
a2 = array__pop( spine );
/* Replace the top-level Apply with an indirection node to x. */
substitute_boxed( a2, OPERAND( a1 ) );
return a2;
}
else
return 0;
}
开发者ID:joshsh,项目名称:archive,代码行数:20,代码来源:graph-reduce.c
示例17: regrepeat
/*
- regrepeat - repeatedly match something simple, report how many
*/
static int
regrepeat( char *p )
{
register int count = 0;
register const char *scan;
register char *opnd;
scan = reginput;
opnd = OPERAND(p);
switch (OP(p)) {
case ANY:
count = strlen(scan);
scan += count;
break;
case EXACTLY:
while (*opnd == *scan) {
count++;
scan++;
}
break;
case ANYOF:
while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
count++;
scan++;
}
break;
case ANYBUT:
while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
count++;
scan++;
}
break;
default: /* Oh dear. Called inappropriately. */
regerror("internal foulup");
count = 0; /* Best compromise. */
break;
}
reginput = scan;
return(count);
}
开发者ID:BlackYoup,项目名称:medusa,代码行数:44,代码来源:regexp.c
示例18: OPERAND
/*
- regrepeat - repeatedly match something simple, report how many
*/
int ossimRegExp::regrepeat (const char* p) {
int count = 0;
const char* scan;
const char* opnd;
scan = reginput;
opnd = OPERAND(p);
switch (OP(p)) {
case ANY:
count = (int)strlen(scan);
scan += count;
break;
case EXACTLY:
while (*opnd == *scan) {
count++;
scan++;
}
break;
case ANYOF:
while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
count++;
scan++;
}
break;
case ANYBUT:
while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
count++;
scan++;
}
break;
default: // Oh dear. Called inappropriately.
//RAISE Error, SYM(ossimRegExp), SYM(Internal_Error),
printf ("ossimRegExp::find(): Internal error.\n");
return 0;
}
reginput = scan;
return (count);
}
开发者ID:ossimlabs,项目名称:ossim,代码行数:41,代码来源:ossimRegExp.cpp
示例19: strlen
/*
- RegComp - compile a regular expression into internal code
*
* We can't allocate space until we know how big the compiled form will be,
* but we can't compile it (and thus know how big it is) until we've got a
* place to put the code. So we cheat: we compile it twice, once with code
* generation turned off and size counting turned on, and once "for real".
* This also means that we don't allocate space until we are sure that the
* thing really will compile successfully, and we never have to move the
* code and thus invalidate pointers into it. (Note that it has to be in
* one piece because free() must be able to free it all.)
*
* Beware that the optimization-preparation code in here knows about some
* of the structure of the compiled regexp.
*/
regexp *RegComp( const char *instr )
{
regexp *r;
char *scan;
char *longest;
const char *exp;
char buff[MAX_STR*2];
int flags, ignmag = FALSE;
unsigned j;
size_t i, k, len;
#ifdef WANT_EXCLAMATION
if( instr[0] == '!' ) {
instr++;
ignmag = TRUE;
}
#endif
/*
* flip roles of magic chars
*/
if( !ignmag && ( !MAGICFLAG && MAGICSTR != NULL ) ) {
j = 0;
k = strlen( instr );
for( i = 0; i < k; i++ ) {
if( instr[i] == '\\' ) {
if( strchr( MAGICSTR, instr[i + 1] ) == NULL ) {
buff[j++] = '\\';
}
i++;
} else {
if( strchr( MAGICSTR, instr[i] ) != NULL ) {
buff[j++] = '\\';
}
}
buff[j++] = instr[i];
}
buff[j] = 0;
exp = buff;
} else {
exp = instr;
}
regError( ERR_NO_ERR );
if( exp == NULL ) {
FAIL( ERR_RE_NULL_ARGUMENT );
}
/* First pass: determine size, legality. */
regparse = exp;
regnpar = 1;
regsize = 0L;
regcode = ®dummy;
regc( MAGIC );
if( reg( 0, &flags ) == NULL ) {
return( NULL );
}
/* Allocate space. */
r = ALLOC( sizeof( regexp ) + ( unsigned ) regsize );
/* Second pass: emit code. */
regparse = exp;
regnpar = 1;
regcode = r->program;
regc( MAGIC );
if( reg( 0, &flags ) == NULL ) {
return( NULL );
}
/* Dig out information for optimizations. */
r->regstart = '\0'; /* Worst-case defaults. */
r->reganch = 0;
r->regmust = NULL;
r->regmlen = 0;
scan = r->program + 1; /* First BRANCH. */
if( OP( regnext( scan ) ) == END ) { /* Only one top-level choice. */
scan = OPERAND( scan );
/* Starting-point info. */
if( OP( scan ) == EXACTLY ) {
r->regstart = *OPERAND( scan );
} else if( OP( scan ) == BOL ) {
r->reganch++;
//.........这里部分代码省略.........
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:101,代码来源:regexp.c
示例20: regcomp
/*
- regcomp - compile a regular expression into internal code
*
* We can't allocate space until we know how big the compiled form will be,
* but we can't compile it (and thus know how big it is) until we've got a
* place to put the code. So we cheat: we compile it twice, once with code
* generation turned off and size counting turned on, and once "for real".
* This also means that we don't allocate space until we are sure that the
* thing really will compile successfully, and we never have to move the
* code and thus invalidate pointers into it. (Note that it has to be in
* one piece because free() must be able to free it all.)
*
* Beware that the optimization-preparation code in here knows about some
* of the structure of the compiled regexp.
*/
regexp *
regcomp( const char *exp )
{
register regexp *r;
register char *scan;
register char *longest;
register unsigned len;
int flags;
if (exp == NULL)
FAIL("NULL argument");
/* First pass: determine size, legality. */
#ifdef notdef
if (exp[0] == '.' && exp[1] == '*') exp += 2; /* aid grep */
#endif
regparse = (char *)exp;
regnpar = 1;
regsize = 0L;
regcode = ®dummy;
regc(MAGIC);
if (reg(0, &flags) == NULL)
return(NULL);
/* Small enough for pointer-storage convention? */
if (regsize >= 32767L) /* Probably could be 65535L. */
FAIL("regexp too big");
/* Allocate space. */
r = (regexp *)malloc(sizeof(regexp) + (unsigned)regsize);
if (r == NULL)
FAIL("out of space");
/* Second pass: emit code. */
regparse = (char *)exp;
regnpar = 1;
regcode = r->program;
regc(MAGIC);
if (reg(0, &flags) == NULL)
return(NULL);
/* Dig out information for optimizations. */
r->regstart = '\0'; /* Worst-case defaults. */
r->reganch = 0;
r->regmust = NULL;
r->regmlen = 0;
scan = r->program+1; /* First BRANCH. */
if (OP(regnext(scan)) == END) { /* Only one top-level choice. */
scan = OPERAND(scan);
/* Starting-point info. */
if (OP(scan) == EXACTLY)
r->regstart = *OPERAND(scan);
else if (OP(scan) == BOL)
r->reganch++;
/*
* If there's something expensive in the r.e., find the
* longest literal string that must appear and make it the
* regmust. Resolve ties in favor of later strings, since
* the regstart check works with the beginning of the r.e.
* and avoiding duplication strengthens checking. Not a
* strong reason, but sufficient in the absence of others.
*/
if (flags&SPSTART) {
longest = NULL;
len = 0;
for (; scan != NULL; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
len = strlen(OPERAND(scan));
}
r->regmust = longest;
r->regmlen = len;
}
}
return(r);
}
开发者ID:BlackYoup,项目名称:medusa,代码行数:94,代码来源:regexp.c
注:本文中的OPERAND函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论