jscript: Rename JSREG_* defines to REG_*.

This commit is contained in:
Piotr Caban 2013-02-19 10:11:51 +01:00 committed by Alexandre Julliard
parent 6b474b555e
commit 4c6a1d1d92
3 changed files with 28 additions and 28 deletions

View File

@ -165,7 +165,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags,
heap_pool_t *mark;
HRESULT hres;
if((rem_flags & REM_CHECK_GLOBAL) && !(regexp->jsregexp->flags & JSREG_GLOB))
if((rem_flags & REM_CHECK_GLOBAL) && !(regexp->jsregexp->flags & REG_GLOB))
return S_FALSE;
mark = heap_pool_mark(&ctx->tmp_heap);
@ -216,7 +216,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *str, B
ret[i++] = cres;
if(!gflag && !(This->jsregexp->flags & JSREG_GLOB)) {
if(!gflag && !(This->jsregexp->flags & REG_GLOB)) {
hres = S_OK;
break;
}
@ -407,7 +407,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsstr_t
if(FAILED(hres))
return hres;
if(regexp->jsregexp->flags & JSREG_GLOB) {
if(regexp->jsregexp->flags & REG_GLOB) {
if(regexp->last_index < 0) {
jsstr_release(string);
set_last_index(regexp, 0);
@ -668,7 +668,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *str, jsval
jsdisp_t *array;
HRESULT hres;
if(!(regexp->jsregexp->flags & JSREG_GLOB)) {
if(!(regexp->jsregexp->flags & REG_GLOB)) {
match_result_t match, *parens = NULL;
DWORD parens_cnt, parens_size = 0;
const WCHAR *cp = str->str;
@ -991,16 +991,16 @@ HRESULT parse_regexp_flags(const WCHAR *str, DWORD str_len, DWORD *ret)
for (p = str; p < str+str_len; p++) {
switch (*p) {
case 'g':
flags |= JSREG_GLOB;
flags |= REG_GLOB;
break;
case 'i':
flags |= JSREG_FOLD;
flags |= REG_FOLD;
break;
case 'm':
flags |= JSREG_MULTILINE;
flags |= REG_MULTILINE;
break;
case 'y':
flags |= JSREG_STICKY;
flags |= REG_STICKY;
break;
default:
WARN("wrong flag %c\n", *p);

View File

@ -638,14 +638,14 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
}
}
if (t->kid && t->u.flat.length > 1) {
pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLATi : REOP_FLAT;
pc[-1] = (state->flags & REG_FOLD) ? REOP_FLATi : REOP_FLAT;
pc = WriteCompactIndex(pc, (WCHAR*)t->kid - state->cpbegin);
pc = WriteCompactIndex(pc, t->u.flat.length);
} else if (t->u.flat.chr < 256) {
pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLAT1i : REOP_FLAT1;
pc[-1] = (state->flags & REG_FOLD) ? REOP_FLAT1i : REOP_FLAT1;
*pc++ = (jsbytecode) t->u.flat.chr;
} else {
pc[-1] = (state->flags & JSREG_FOLD)
pc[-1] = (state->flags & REG_FOLD)
? REOP_UCFLAT1i
: REOP_UCFLAT1;
SET_ARG(pc, t->u.flat.chr);
@ -804,7 +804,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
*/
if (((RENode *) result->kid)->op == REOP_FLAT &&
((RENode *) result->u.kid2)->op == REOP_FLAT &&
(state->flags & JSREG_FOLD) == 0) {
(state->flags & REG_FOLD) == 0) {
result->op = REOP_ALTPREREQ;
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
result->u.altprereq.ch2 = ((RENode *) result->u.kid2)->u.flat.chr;
@ -816,7 +816,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
if (((RENode *) result->kid)->op == REOP_CLASS &&
((RENode *) result->kid)->u.ucclass.index < 256 &&
((RENode *) result->u.kid2)->op == REOP_FLAT &&
(state->flags & JSREG_FOLD) == 0) {
(state->flags & REG_FOLD) == 0) {
result->op = REOP_ALTPREREQ2;
result->u.altprereq.ch1 = ((RENode *) result->u.kid2)->u.flat.chr;
result->u.altprereq.ch2 = ((RENode *) result->kid)->u.ucclass.index;
@ -828,7 +828,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
if (((RENode *) result->kid)->op == REOP_FLAT &&
((RENode *) result->u.kid2)->op == REOP_CLASS &&
((RENode *) result->u.kid2)->u.ucclass.index < 256 &&
(state->flags & JSREG_FOLD) == 0) {
(state->flags & REG_FOLD) == 0) {
result->op = REOP_ALTPREREQ2;
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
result->u.altprereq.ch2 =
@ -1108,11 +1108,11 @@ lexHex:
continue;
}
}
if (state->flags & JSREG_FOLD)
if (state->flags & REG_FOLD)
rangeStart = localMax; /* one run of the uc/dc loop below */
}
if (state->flags & JSREG_FOLD) {
if (state->flags & REG_FOLD) {
WCHAR maxch = localMax;
for (i = rangeStart; i <= localMax; i++) {
@ -2009,7 +2009,7 @@ BackrefMatcher(REGlobalData *gData, REMatchState *x, size_t parenIndex)
return NULL;
parenContent = &gData->cpbegin[cap->index];
if (gData->regexp->flags & JSREG_FOLD) {
if (gData->regexp->flags & REG_FOLD) {
for (i = 0; i < len; i++) {
if (toupperW(parenContent[i]) != toupperW(x->cp[i]))
return NULL;
@ -2233,7 +2233,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
}
if (inRange) {
if (gData->regexp->flags & JSREG_FOLD) {
if (gData->regexp->flags & REG_FOLD) {
assert(rangeStart <= thisCh);
for (i = rangeStart; i <= thisCh; i++) {
WCHAR uch, dch;
@ -2251,7 +2251,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
}
inRange = FALSE;
} else {
if (gData->regexp->flags & JSREG_FOLD) {
if (gData->regexp->flags & REG_FOLD) {
AddCharacterToCharSet(charSet, toupperW(thisCh));
AddCharacterToCharSet(charSet, tolowerW(thisCh));
} else {
@ -2325,7 +2325,7 @@ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
case REOP_BOL:
if (x->cp != gData->cpbegin) {
if (/*!gData->cx->regExpStatics.multiline && FIXME !!! */
!(gData->regexp->flags & JSREG_MULTILINE)) {
!(gData->regexp->flags & REG_MULTILINE)) {
break;
}
if (!RE_IS_LINE_TERM(x->cp[-1]))
@ -2336,7 +2336,7 @@ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
case REOP_EOL:
if (x->cp != gData->cpend) {
if (/*!gData->cx->regExpStatics.multiline &&*/
!(gData->regexp->flags & JSREG_MULTILINE)) {
!(gData->regexp->flags & REG_MULTILINE)) {
break;
}
if (!RE_IS_LINE_TERM(*x->cp))
@ -2532,7 +2532,7 @@ ExecuteREBytecode(REGlobalData *gData, REMatchState *x)
* If the first node is a simple match, step the index into the string
* until that match is made, or fail if it can't be found at all.
*/
if (REOP_IS_SIMPLE(op) && !(gData->regexp->flags & JSREG_STICKY)) {
if (REOP_IS_SIMPLE(op) && !(gData->regexp->flags & REG_STICKY)) {
anchor = FALSE;
while (x->cp <= gData->cpend) {
nextpc = pc; /* reset back to start each time */
@ -3063,7 +3063,7 @@ static REMatchState *MatchRegExp(REGlobalData *gData, REMatchState *x)
for (j = 0; j < gData->regexp->parenCount; j++)
x->parens[j].index = -1;
result = ExecuteREBytecode(gData, x);
if (!gData->ok || result || (gData->regexp->flags & JSREG_STICKY))
if (!gData->ok || result || (gData->regexp->flags & REG_STICKY))
return result;
gData->backTrackSP = gData->backTrackStack;
gData->cursz = 0;

View File

@ -31,10 +31,10 @@
* the Initial Developer. All Rights Reserved.
*/
#define JSREG_FOLD 0x01 /* fold uppercase to lowercase */
#define JSREG_GLOB 0x02 /* global exec, creates array of matches */
#define JSREG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
#define JSREG_STICKY 0x08 /* only match starting at lastIndex */
#define REG_FOLD 0x01 /* fold uppercase to lowercase */
#define REG_GLOB 0x02 /* global exec, creates array of matches */
#define REG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
#define REG_STICKY 0x08 /* only match starting at lastIndex */
typedef struct RECapture {
ptrdiff_t index; /* start of contents, -1 for empty */
@ -73,7 +73,7 @@ typedef struct RECharSet {
} RECharSet;
typedef struct JSRegExp {
WORD flags; /* flags, see jsapi.h's JSREG_* defines */
WORD flags; /* flags, see jsapi.h's REG_* defines */
size_t parenCount; /* number of parenthesized submatches */
size_t classCount; /* count [...] bitmaps */
RECharSet *classList; /* list of [...] bitmaps */