本文整理汇总了C++中MORE函数的典型用法代码示例。如果您正苦于以下问题:C++ MORE函数的具体用法?C++ MORE怎么用?C++ MORE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MORE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: igraph_i_eigen_matrix_lapack_cmp_sm
int igraph_i_eigen_matrix_lapack_cmp_sm(void *extra, const void *a,
const void *b) {
igraph_i_eml_cmp_t *myextra=(igraph_i_eml_cmp_t *) extra;
int *aa=(int*) a, *bb=(int*) b;
igraph_real_t a_m=VECTOR(*myextra->mag)[*aa];
igraph_real_t b_m=VECTOR(*myextra->mag)[*bb];
if (MORE(a_m, b_m)) {
return 1;
} else if (LESS(a_m, b_m)) {
return -1;
} else {
igraph_real_t a_r=VECTOR(*myextra->real)[*aa];
igraph_real_t a_i=VECTOR(*myextra->imag)[*aa];
igraph_real_t b_r=VECTOR(*myextra->real)[*bb];
igraph_real_t b_i=VECTOR(*myextra->imag)[*bb];
if (NONZERO(a_i) && ZERO(b_i)) { return -1; }
if (ZERO(a_i) && NONZERO(b_i)) { return 1; }
if (LESS(a_r, b_r)) { return -1; }
if (MORE(a_r, b_r)) { return 1; }
if (LESS(a_i, b_i)) { return -1; }
if (MORE(a_i, b_i)) { return 1; }
}
return 0;
}
示例2: p_b_coll_elem
/*
- p_b_coll_elem - parse a collating-element name and look it up
== static char p_b_coll_elem(struct parse *p, int endc);
*/
static char /* value of collating element */
p_b_coll_elem(
struct parse *p,
int endc) /* name ended by endc,']' */
{
const char *sp;
const struct cname *cp;
size_t len;
_DIAGASSERT(p != NULL);
sp = p->next;
while (MORE() && !SEETWO(endc, ']'))
NEXT();
if (!MORE()) {
SETERROR(REG_EBRACK);
return(0);
}
len = p->next - sp;
for (cp = cnames; cp->name != NULL; cp++)
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
return(cp->code); /* known name */
if (len == 1)
return(*sp); /* single character */
SETERROR(REG_ECOLLATE); /* neither */
return(0);
}
示例3: string
/*
- p_str - string (no metacharacters) "parser"
*/
static void
p_str(struct parse *p)
{
REQUIRE(MORE(), REG_EMPTY);
while (MORE())
ordinary(p, GETNEXT());
}
示例4: p_b_term
/*
- p_b_term - parse one term of a bracketed character list
*/
static void
p_b_term(struct parse *p, cset *cs)
{
char c;
char start, finish;
int i;
/* classify what we've got */
switch ((MORE()) ? PEEK() : '\0') {
case '[':
c = (MORE2()) ? PEEK2() : '\0';
break;
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
break;
default:
c = '\0';
break;
}
switch (c) {
case ':': /* character class */
NEXT2();
REQUIRE(MORE(), REG_EBRACK);
c = PEEK();
REQUIRE(c != '-' && c != ']', REG_ECTYPE);
p_b_cclass(p, cs);
REQUIRE(MORE(), REG_EBRACK);
REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
break;
case '=': /* equivalence class */
NEXT2();
REQUIRE(MORE(), REG_EBRACK);
c = PEEK();
REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
p_b_eclass(p, cs);
REQUIRE(MORE(), REG_EBRACK);
REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
break;
default: /* symbol, ordinary character, or range */
/* xxx revision needed for multichar stuff */
start = p_b_symbol(p);
if (SEE('-') && MORE2() && PEEK2() != ']') {
/* range */
NEXT();
if (EAT('-'))
finish = '-';
else
finish = p_b_symbol(p);
} else
finish = start;
/* xxx what about signed chars here... */
REQUIRE(start <= finish, REG_ERANGE);
for (i = start; i <= finish; i++)
CHadd(cs, i);
break;
}
}
示例5: string
/*
- p_str - string (no metacharacters) "parser"
== static void p_str(struct parse *p);
*/
static void
p_str(
struct parse *p)
{
_DIAGASSERT(p != NULL);
REQUIRE(MORE(), REG_EMPTY);
while (MORE())
ordinary(p, GETNEXT());
}
示例6: p_ere
/*
- p_ere - ERE parser top level, concatenation and alternation
== static void p_ere(struct parse *p, int stop, size_t reclimit);
*/
static void
p_ere(
struct parse *p,
int stop, /* character this ERE should end at */
size_t reclimit)
{
char c;
sopno prevback = 0; /* pacify gcc */
sopno prevfwd = 0; /* pacify gcc */
sopno conc;
int first = 1; /* is this the first alternative? */
_DIAGASSERT(p != NULL);
if (reclimit++ > RECLIMIT || p->error == REG_ESPACE) {
p->error = REG_ESPACE;
return;
}
for (;;) {
/* do a bunch of concatenated expressions */
conc = HERE();
while (MORE() && (c = PEEK()) != '|' && c != stop)
p_ere_exp(p, reclimit);
REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
if (!EAT('|'))
break; /* NOTE BREAK OUT */
if (first) {
INSERT(OCH_, conc); /* offset is wrong */
prevfwd = conc;
prevback = conc;
first = 0;
}
ASTERN(OOR1, prevback);
prevback = THERE();
AHEAD(prevfwd); /* fix previous offset */
prevfwd = HERE();
EMIT(OOR2, 0); /* offset is very wrong */
}
if (!first) { /* tail-end fixups */
AHEAD(prevfwd);
ASTERN(O_CH, prevback);
}
assert(!MORE() || SEE(stop));
}
示例7: p_bre
/*
- p_bre - BRE parser top level, anchoring and concatenation
* Giving end1 as OUT essentially eliminates the end1/end2 check.
*
* This implementation is a bit of a kludge, in that a trailing $ is first
* taken as an ordinary character and then revised to be an anchor. The
* only undesirable side effect is that '$' gets included as a character
* category in such cases. This is fairly harmless; not worth fixing.
* The amount of lookahead needed to avoid this kludge is excessive.
*/
static void
p_bre(struct parse *p,
int end1, /* first terminating character */
int end2) /* second terminating character */
{
sopno start = HERE();
int first = 1; /* first subexpression? */
int wasdollar = 0;
if (EAT('^')) {
EMIT(OBOL, 0);
p->g->iflags |= USEBOL;
p->g->nbol++;
}
while (MORE() && !SEETWO(end1, end2)) {
wasdollar = p_simp_re(p, first);
first = 0;
}
if (wasdollar) { /* oops, that was a trailing anchor */
DROP(1);
EMIT(OEOL, 0);
p->g->iflags |= USEEOL;
p->g->neol++;
}
REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
}
示例8: p_b_cclass
/*
- p_b_cclass - parse a character-class name and deal with it
*/
static void
p_b_cclass(struct parse *p, cset *cs)
{
char *sp = p->next;
struct cclass *cp;
size_t len;
const char *u;
char c;
while (MORE() && isalpha(PEEK()))
NEXT();
len = p->next - sp;
for (cp = cclasses; cp->name != NULL; cp++)
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
break;
if (cp->name == NULL) {
/* oops, didn't find it */
SETERROR(REG_ECTYPE);
return;
}
u = cp->chars;
while ((c = *u++) != '\0')
CHadd(cs, c);
for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
MCadd(p, cs, u);
}
示例9: swim
static
void
swim(PQ q, int k)
{
while(k > 1 && MORE(k/2, k)) {
exchange(q, k, k/2);
k /= 2;
}
}
示例10: sink
static
void
sink(PQ q, int k)
{
int j;
while(2*k <= q->count) {
j = 2 * k;
if(j < q->count && MORE(j, j+1))
j++;
if(!MORE(k, j))
break;
exchange(q, k, j);
k = j;
}
}
示例11: p_ere
/*
- p_ere - ERE parser top level, concatenation and alternation
*/
static void
p_ere(struct parse *p, int stop) /* character this ERE should end at */
{
char c;
sopno prevback;
sopno prevfwd;
sopno conc;
int first = 1; /* is this the first alternative? */
for (;;) {
/* do a bunch of concatenated expressions */
conc = HERE();
while (MORE() && (c = PEEK()) != '|' && c != stop)
p_ere_exp(p);
REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
if (!EAT('|'))
break; /* NOTE BREAK OUT */
if (first) {
INSERT(OCH_, conc); /* offset is wrong */
prevfwd = conc;
prevback = conc;
first = 0;
}
ASTERN(OOR1, prevback);
prevback = THERE();
AHEAD(prevfwd); /* fix previous offset */
prevfwd = HERE();
EMIT(OOR2, 0); /* offset is very wrong */
}
if (!first) { /* tail-end fixups */
AHEAD(prevfwd);
ASTERN(O_CH, prevback);
}
assert(!MORE() || SEE(stop));
}
示例12: p_b_symbol
/*
- p_b_symbol - parse a character or [..]ed multicharacter collating symbol
*/
static char /* value of symbol */
p_b_symbol(struct parse *p)
{
char value;
REQUIRE(MORE(), REG_EBRACK);
if (!EATTWO('[', '.'))
return(GETNEXT());
/* collating symbol */
value = p_b_coll_elem(p, '.');
REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
return(value);
}
示例13: p_count
/*
- p_count - parse a repetition count
*/
static int /* the value */
p_count(struct parse *p)
{
int count = 0;
int ndigits = 0;
while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
count = count*10 + (GETNEXT() - '0');
ndigits++;
}
REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
return(count);
}
示例14: echoListSplit3
echoObject *
echoListSplit3(echoScene *scene, echoObject *list, int depth) {
echoObject *ret, *tmp0, *tmp1;
if (!( echoTypeList == list->type ||
echoTypeAABBox == list->type ))
return NULL;
if (!depth)
return list;
ret = echoListSplit(scene, list, 0);
#define DOIT(obj, ax) ((obj) = echoListSplit(scene, (obj), (ax)))
#define MORE(obj) echoTypeSplit == (obj)->type
if (MORE(ret)) {
tmp0 = DOIT(SPLIT(ret)->obj0, 1);
if (MORE(tmp0)) {
tmp1 = DOIT(SPLIT(tmp0)->obj0, 2);
if (MORE(tmp1)) {
SPLIT(tmp1)->obj0 = echoListSplit3(scene, SPLIT(tmp1)->obj0, depth-1);
SPLIT(tmp1)->obj1 = echoListSplit3(scene, SPLIT(tmp1)->obj1, depth-1);
}
tmp1 = DOIT(SPLIT(tmp0)->obj1, 2);
if (MORE(tmp1)) {
SPLIT(tmp1)->obj0 = echoListSplit3(scene, SPLIT(tmp1)->obj0, depth-1);
SPLIT(tmp1)->obj1 = echoListSplit3(scene, SPLIT(tmp1)->obj1, depth-1);
}
}
tmp0 = DOIT(SPLIT(ret)->obj1, 1);
if (MORE(tmp0)) {
tmp1 = DOIT(SPLIT(tmp0)->obj0, 2);
if (MORE(tmp1)) {
SPLIT(tmp1)->obj0 = echoListSplit3(scene, SPLIT(tmp1)->obj0, depth-1);
SPLIT(tmp1)->obj1 = echoListSplit3(scene, SPLIT(tmp1)->obj1, depth-1);
}
tmp1 = DOIT(SPLIT(tmp0)->obj1, 2);
if (MORE(tmp1)) {
SPLIT(tmp1)->obj0 = echoListSplit3(scene, SPLIT(tmp1)->obj0, depth-1);
SPLIT(tmp1)->obj1 = echoListSplit3(scene, SPLIT(tmp1)->obj1, depth-1);
}
}
}
return ret;
}
示例15: p_bre
/*
- p_bre - BRE parser top level, anchoring and concatenation
== static void p_bre(struct parse *p, int end1, \
== int end2, size_t reclimit);
* Giving end1 as OUT essentially eliminates the end1/end2 check.
*
* This implementation is a bit of a kludge, in that a trailing $ is first
* taken as an ordinary character and then revised to be an anchor. The
* only undesirable side effect is that '$' gets included as a character
* category in such cases. This is fairly harmless; not worth fixing.
* The amount of lookahead needed to avoid this kludge is excessive.
*/
static void
p_bre(
struct parse *p,
int end1, /* first terminating character */
int end2, /* second terminating character */
size_t reclimit)
{
sopno start;
int first = 1; /* first subexpression? */
int wasdollar = 0;
_DIAGASSERT(p != NULL);
if (reclimit++ > RECLIMIT || p->error == REG_ESPACE) {
p->error = REG_ESPACE;
return;
}
start = HERE();
if (EAT('^')) {
EMIT(OBOL, 0);
p->g->iflags |= USEBOL;
p->g->nbol++;
}
while (MORE() && !SEETWO(end1, end2)) {
wasdollar = p_simp_re(p, first, reclimit);
first = 0;
}
if (wasdollar) { /* oops, that was a trailing anchor */
DROP(1);
EMIT(OEOL, 0);
p->g->iflags |= USEEOL;
p->g->neol++;
}
REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
}