• Home
  • Raw
  • Download

Lines Matching full:exec

3075 xmlFARegDebugExec(xmlRegExecCtxtPtr exec) {  in xmlFARegDebugExec()  argument
3076 printf("state: %d:%d:idx %d", exec->state->no, exec->transno, exec->index); in xmlFARegDebugExec()
3077 if (exec->inputStack != NULL) { in xmlFARegDebugExec()
3080 for (i = 0;(i < 3) && (i < exec->inputStackNr);i++) in xmlFARegDebugExec()
3082 exec->inputStack[exec->inputStackNr - (i + 1)].value); in xmlFARegDebugExec()
3084 printf(": %s", &(exec->inputString[exec->index])); in xmlFARegDebugExec()
3091 xmlFARegExecSave(xmlRegExecCtxtPtr exec) { in xmlFARegExecSave() argument
3094 exec->transno++; in xmlFARegExecSave()
3095 xmlFARegDebugExec(exec); in xmlFARegExecSave()
3096 exec->transno--; in xmlFARegExecSave()
3099 if (exec->nbPush > MAX_PUSH) { in xmlFARegExecSave()
3102 exec->nbPush++; in xmlFARegExecSave()
3105 if (exec->maxRollbacks == 0) { in xmlFARegExecSave()
3106 exec->maxRollbacks = 4; in xmlFARegExecSave()
3107 exec->rollbacks = (xmlRegExecRollback *) xmlMalloc(exec->maxRollbacks * in xmlFARegExecSave()
3109 if (exec->rollbacks == NULL) { in xmlFARegExecSave()
3111 exec->maxRollbacks = 0; in xmlFARegExecSave()
3114 memset(exec->rollbacks, 0, in xmlFARegExecSave()
3115 exec->maxRollbacks * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3116 } else if (exec->nbRollbacks >= exec->maxRollbacks) { in xmlFARegExecSave()
3118 int len = exec->maxRollbacks; in xmlFARegExecSave()
3120 exec->maxRollbacks *= 2; in xmlFARegExecSave()
3121 tmp = (xmlRegExecRollback *) xmlRealloc(exec->rollbacks, in xmlFARegExecSave()
3122 exec->maxRollbacks * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3125 exec->maxRollbacks /= 2; in xmlFARegExecSave()
3128 exec->rollbacks = tmp; in xmlFARegExecSave()
3129 tmp = &exec->rollbacks[len]; in xmlFARegExecSave()
3130 memset(tmp, 0, (exec->maxRollbacks - len) * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3132 exec->rollbacks[exec->nbRollbacks].state = exec->state; in xmlFARegExecSave()
3133 exec->rollbacks[exec->nbRollbacks].index = exec->index; in xmlFARegExecSave()
3134 exec->rollbacks[exec->nbRollbacks].nextbranch = exec->transno + 1; in xmlFARegExecSave()
3135 if (exec->comp->nbCounters > 0) { in xmlFARegExecSave()
3136 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecSave()
3137 exec->rollbacks[exec->nbRollbacks].counts = (int *) in xmlFARegExecSave()
3138 xmlMalloc(exec->comp->nbCounters * sizeof(int)); in xmlFARegExecSave()
3139 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecSave()
3141 exec->status = -5; in xmlFARegExecSave()
3145 memcpy(exec->rollbacks[exec->nbRollbacks].counts, exec->counts, in xmlFARegExecSave()
3146 exec->comp->nbCounters * sizeof(int)); in xmlFARegExecSave()
3148 exec->nbRollbacks++; in xmlFARegExecSave()
3152 xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) { in xmlFARegExecRollBack() argument
3153 if (exec->nbRollbacks <= 0) { in xmlFARegExecRollBack()
3154 exec->status = -1; in xmlFARegExecRollBack()
3160 exec->nbRollbacks--; in xmlFARegExecRollBack()
3161 exec->state = exec->rollbacks[exec->nbRollbacks].state; in xmlFARegExecRollBack()
3162 exec->index = exec->rollbacks[exec->nbRollbacks].index; in xmlFARegExecRollBack()
3163 exec->transno = exec->rollbacks[exec->nbRollbacks].nextbranch; in xmlFARegExecRollBack()
3164 if (exec->comp->nbCounters > 0) { in xmlFARegExecRollBack()
3165 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecRollBack()
3166 fprintf(stderr, "exec save: allocation failed"); in xmlFARegExecRollBack()
3167 exec->status = -6; in xmlFARegExecRollBack()
3170 if (exec->counts) { in xmlFARegExecRollBack()
3171 memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts, in xmlFARegExecRollBack()
3172 exec->comp->nbCounters * sizeof(int)); in xmlFARegExecRollBack()
3178 xmlFARegDebugExec(exec); in xmlFARegExecRollBack()
3191 xmlRegExecCtxtPtr exec = &execval; in xmlFARegExec() local
3194 exec->inputString = content; in xmlFARegExec()
3195 exec->index = 0; in xmlFARegExec()
3196 exec->nbPush = 0; in xmlFARegExec()
3197 exec->determinist = 1; in xmlFARegExec()
3198 exec->maxRollbacks = 0; in xmlFARegExec()
3199 exec->nbRollbacks = 0; in xmlFARegExec()
3200 exec->rollbacks = NULL; in xmlFARegExec()
3201 exec->status = 0; in xmlFARegExec()
3202 exec->comp = comp; in xmlFARegExec()
3203 exec->state = comp->states[0]; in xmlFARegExec()
3204 exec->transno = 0; in xmlFARegExec()
3205 exec->transcount = 0; in xmlFARegExec()
3206 exec->inputStack = NULL; in xmlFARegExec()
3207 exec->inputStackMax = 0; in xmlFARegExec()
3209 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int)); in xmlFARegExec()
3210 if (exec->counts == NULL) { in xmlFARegExec()
3214 memset(exec->counts, 0, comp->nbCounters * sizeof(int)); in xmlFARegExec()
3216 exec->counts = NULL; in xmlFARegExec()
3217 while ((exec->status == 0) && (exec->state != NULL) && in xmlFARegExec()
3218 ((exec->inputString[exec->index] != 0) || in xmlFARegExec()
3219 ((exec->state != NULL) && in xmlFARegExec()
3220 (exec->state->type != XML_REGEXP_FINAL_STATE)))) { in xmlFARegExec()
3232 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL)) { in xmlFARegExec()
3237 if (exec->transno < exec->state->nbTrans) { in xmlFARegExec()
3238 trans = &exec->state->trans[exec->transno]; in xmlFARegExec()
3248 exec->transcount = 0; in xmlFARegExec()
3249 for (;exec->transno < exec->state->nbTrans;exec->transno++) { in xmlFARegExec()
3250 trans = &exec->state->trans[exec->transno]; in xmlFARegExec()
3260 if (exec->counts == NULL) { in xmlFARegExec()
3261 exec->status = -1; in xmlFARegExec()
3268 count = exec->counts[trans->count]; in xmlFARegExec()
3269 counter = &exec->comp->counters[trans->count]; in xmlFARegExec()
3279 exec->status = -2; in xmlFARegExec()
3281 } else if (exec->inputString[exec->index] != 0) { in xmlFARegExec()
3282 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len); in xmlFARegExec()
3297 if ((exec->counts == NULL) || in xmlFARegExec()
3298 (exec->comp == NULL) || in xmlFARegExec()
3299 (exec->comp->counters == NULL)) { in xmlFARegExec()
3300 exec->status = -1; in xmlFARegExec()
3303 counter = &exec->comp->counters[trans->counter]; in xmlFARegExec()
3304 if (exec->counts[trans->counter] >= counter->max) in xmlFARegExec()
3310 exec->counts[trans->counter]++; in xmlFARegExec()
3312 if (exec->state->nbTrans > exec->transno + 1) { in xmlFARegExec()
3313 xmlFARegExecSave(exec); in xmlFARegExec()
3315 exec->transcount = 1; in xmlFARegExec()
3320 if (exec->transcount == atom->max) { in xmlFARegExec()
3323 exec->index += len; in xmlFARegExec()
3327 if (exec->inputString[exec->index] == 0) { in xmlFARegExec()
3328 exec->index -= len; in xmlFARegExec()
3331 if (exec->transcount >= atom->min) { in xmlFARegExec()
3332 int transno = exec->transno; in xmlFARegExec()
3333 xmlRegStatePtr state = exec->state; in xmlFARegExec()
3338 exec->transno = -1; /* trick */ in xmlFARegExec()
3339 exec->state = to; in xmlFARegExec()
3340 xmlFARegExecSave(exec); in xmlFARegExec()
3341 exec->transno = transno; in xmlFARegExec()
3342 exec->state = state; in xmlFARegExec()
3344 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), in xmlFARegExec()
3347 exec->transcount++; in xmlFARegExec()
3349 if (exec->transcount < atom->min) in xmlFARegExec()
3362 if (exec->counts == NULL) { in xmlFARegExec()
3363 exec->status = -1; in xmlFARegExec()
3369 exec->counts[trans->counter]--; in xmlFARegExec()
3377 exec->transcount = 1; in xmlFARegExec()
3383 exec->transcount = 1; in xmlFARegExec()
3390 (exec->state->nbTrans > exec->transno + 1))) { in xmlFARegExec()
3394 trans->atom->no, codepoint, exec->index); in xmlFARegExec()
3397 trans->count, codepoint, exec->index); in xmlFARegExec()
3399 xmlFARegExecSave(exec); in xmlFARegExec()
3405 if ((exec->counts == NULL) || in xmlFARegExec()
3406 (exec->comp == NULL) || in xmlFARegExec()
3407 (exec->comp->counters == NULL)) { in xmlFARegExec()
3408 exec->status = -1; in xmlFARegExec()
3411 counter = &exec->comp->counters[trans->counter]; in xmlFARegExec()
3412 if (exec->counts[trans->counter] >= counter->max) in xmlFARegExec()
3417 exec->counts[trans->counter]++; in xmlFARegExec()
3421 if (exec->counts == NULL) { in xmlFARegExec()
3422 exec->status = -1; in xmlFARegExec()
3429 exec->counts[trans->count] = 0; in xmlFARegExec()
3434 exec->state = comp->states[trans->to]; in xmlFARegExec()
3435 exec->transno = 0; in xmlFARegExec()
3437 exec->index += len; in xmlFARegExec()
3441 exec->status = -4; in xmlFARegExec()
3445 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) { in xmlFARegExec()
3450 exec->determinist = 0; in xmlFARegExec()
3452 printf("rollback from state %d on %d:%c\n", exec->state->no, in xmlFARegExec()
3455 xmlFARegExecRollBack(exec); in xmlFARegExec()
3461 if (exec->rollbacks != NULL) { in xmlFARegExec()
3462 if (exec->counts != NULL) { in xmlFARegExec()
3465 for (i = 0;i < exec->maxRollbacks;i++) in xmlFARegExec()
3466 if (exec->rollbacks[i].counts != NULL) in xmlFARegExec()
3467 xmlFree(exec->rollbacks[i].counts); in xmlFARegExec()
3469 xmlFree(exec->rollbacks); in xmlFARegExec()
3471 if (exec->state == NULL) in xmlFARegExec()
3473 if (exec->counts != NULL) in xmlFARegExec()
3474 xmlFree(exec->counts); in xmlFARegExec()
3475 if (exec->status == 0) in xmlFARegExec()
3477 if (exec->status == -1) { in xmlFARegExec()
3478 if (exec->nbPush > MAX_PUSH) in xmlFARegExec()
3482 return(exec->status); in xmlFARegExec()
3491 static void testerr(xmlRegExecCtxtPtr exec);
3507 xmlRegExecCtxtPtr exec; in xmlRegNewExecCtxt() local
3513 exec = (xmlRegExecCtxtPtr) xmlMalloc(sizeof(xmlRegExecCtxt)); in xmlRegNewExecCtxt()
3514 if (exec == NULL) { in xmlRegNewExecCtxt()
3518 memset(exec, 0, sizeof(xmlRegExecCtxt)); in xmlRegNewExecCtxt()
3519 exec->inputString = NULL; in xmlRegNewExecCtxt()
3520 exec->index = 0; in xmlRegNewExecCtxt()
3521 exec->determinist = 1; in xmlRegNewExecCtxt()
3522 exec->maxRollbacks = 0; in xmlRegNewExecCtxt()
3523 exec->nbRollbacks = 0; in xmlRegNewExecCtxt()
3524 exec->rollbacks = NULL; in xmlRegNewExecCtxt()
3525 exec->status = 0; in xmlRegNewExecCtxt()
3526 exec->comp = comp; in xmlRegNewExecCtxt()
3528 exec->state = comp->states[0]; in xmlRegNewExecCtxt()
3529 exec->transno = 0; in xmlRegNewExecCtxt()
3530 exec->transcount = 0; in xmlRegNewExecCtxt()
3531 exec->callback = callback; in xmlRegNewExecCtxt()
3532 exec->data = data; in xmlRegNewExecCtxt()
3535 * For error handling, exec->counts is allocated twice the size in xmlRegNewExecCtxt()
3538 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int) in xmlRegNewExecCtxt()
3540 if (exec->counts == NULL) { in xmlRegNewExecCtxt()
3542 xmlFree(exec); in xmlRegNewExecCtxt()
3545 memset(exec->counts, 0, comp->nbCounters * sizeof(int) * 2); in xmlRegNewExecCtxt()
3546 exec->errCounts = &exec->counts[comp->nbCounters]; in xmlRegNewExecCtxt()
3548 exec->counts = NULL; in xmlRegNewExecCtxt()
3549 exec->errCounts = NULL; in xmlRegNewExecCtxt()
3551 exec->inputStackMax = 0; in xmlRegNewExecCtxt()
3552 exec->inputStackNr = 0; in xmlRegNewExecCtxt()
3553 exec->inputStack = NULL; in xmlRegNewExecCtxt()
3554 exec->errStateNo = -1; in xmlRegNewExecCtxt()
3555 exec->errString = NULL; in xmlRegNewExecCtxt()
3556 exec->nbPush = 0; in xmlRegNewExecCtxt()
3557 return(exec); in xmlRegNewExecCtxt()
3562 * @exec: a regular expression evaulation context
3567 xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) { in xmlRegFreeExecCtxt() argument
3568 if (exec == NULL) in xmlRegFreeExecCtxt()
3571 if (exec->rollbacks != NULL) { in xmlRegFreeExecCtxt()
3572 if (exec->counts != NULL) { in xmlRegFreeExecCtxt()
3575 for (i = 0;i < exec->maxRollbacks;i++) in xmlRegFreeExecCtxt()
3576 if (exec->rollbacks[i].counts != NULL) in xmlRegFreeExecCtxt()
3577 xmlFree(exec->rollbacks[i].counts); in xmlRegFreeExecCtxt()
3579 xmlFree(exec->rollbacks); in xmlRegFreeExecCtxt()
3581 if (exec->counts != NULL) in xmlRegFreeExecCtxt()
3582 xmlFree(exec->counts); in xmlRegFreeExecCtxt()
3583 if (exec->inputStack != NULL) { in xmlRegFreeExecCtxt()
3586 for (i = 0;i < exec->inputStackNr;i++) { in xmlRegFreeExecCtxt()
3587 if (exec->inputStack[i].value != NULL) in xmlRegFreeExecCtxt()
3588 xmlFree(exec->inputStack[i].value); in xmlRegFreeExecCtxt()
3590 xmlFree(exec->inputStack); in xmlRegFreeExecCtxt()
3592 if (exec->errString != NULL) in xmlRegFreeExecCtxt()
3593 xmlFree(exec->errString); in xmlRegFreeExecCtxt()
3594 xmlFree(exec); in xmlRegFreeExecCtxt()
3598 xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlFARegExecSaveInputString() argument
3601 printf("saving value: %d:%s\n", exec->inputStackNr, value); in xmlFARegExecSaveInputString()
3603 if (exec->inputStackMax == 0) { in xmlFARegExecSaveInputString()
3604 exec->inputStackMax = 4; in xmlFARegExecSaveInputString()
3605 exec->inputStack = (xmlRegInputTokenPtr) in xmlFARegExecSaveInputString()
3606 xmlMalloc(exec->inputStackMax * sizeof(xmlRegInputToken)); in xmlFARegExecSaveInputString()
3607 if (exec->inputStack == NULL) { in xmlFARegExecSaveInputString()
3609 exec->inputStackMax = 0; in xmlFARegExecSaveInputString()
3612 } else if (exec->inputStackNr + 1 >= exec->inputStackMax) { in xmlFARegExecSaveInputString()
3615 exec->inputStackMax *= 2; in xmlFARegExecSaveInputString()
3616 tmp = (xmlRegInputTokenPtr) xmlRealloc(exec->inputStack, in xmlFARegExecSaveInputString()
3617 exec->inputStackMax * sizeof(xmlRegInputToken)); in xmlFARegExecSaveInputString()
3620 exec->inputStackMax /= 2; in xmlFARegExecSaveInputString()
3623 exec->inputStack = tmp; in xmlFARegExecSaveInputString()
3625 exec->inputStack[exec->inputStackNr].value = xmlStrdup(value); in xmlFARegExecSaveInputString()
3626 exec->inputStack[exec->inputStackNr].data = data; in xmlFARegExecSaveInputString()
3627 exec->inputStackNr++; in xmlFARegExecSaveInputString()
3628 exec->inputStack[exec->inputStackNr].value = NULL; in xmlFARegExecSaveInputString()
3629 exec->inputStack[exec->inputStackNr].data = NULL; in xmlFARegExecSaveInputString()
3684 * @exec: a regexp execution context
3685 * @comp: the precompiled exec with a compact table
3695 xmlRegCompactPushString(xmlRegExecCtxtPtr exec, in xmlRegCompactPushString() argument
3699 int state = exec->index; in xmlRegCompactPushString()
3727 exec->index = target; in xmlRegCompactPushString()
3728 if ((exec->callback != NULL) && (comp->transdata != NULL)) { in xmlRegCompactPushString()
3729 exec->callback(exec->data, value, in xmlRegCompactPushString()
3754 if (exec->errString != NULL) in xmlRegCompactPushString()
3755 xmlFree(exec->errString); in xmlRegCompactPushString()
3756 exec->errString = xmlStrdup(value); in xmlRegCompactPushString()
3757 exec->errStateNo = state; in xmlRegCompactPushString()
3758 exec->status = -1; in xmlRegCompactPushString()
3760 testerr(exec); in xmlRegCompactPushString()
3767 * @exec: a regexp execution context or NULL to indicate the end
3778 xmlRegExecPushStringInternal(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushStringInternal() argument
3786 if (exec == NULL) in xmlRegExecPushStringInternal()
3788 if (exec->comp == NULL) in xmlRegExecPushStringInternal()
3790 if (exec->status != 0) in xmlRegExecPushStringInternal()
3791 return(exec->status); in xmlRegExecPushStringInternal()
3793 if (exec->comp->compact != NULL) in xmlRegExecPushStringInternal()
3794 return(xmlRegCompactPushString(exec, exec->comp, value, data)); in xmlRegExecPushStringInternal()
3797 if (exec->state->type == XML_REGEXP_FINAL_STATE) in xmlRegExecPushStringInternal()
3809 if ((value != NULL) && (exec->inputStackNr > 0)) { in xmlRegExecPushStringInternal()
3810 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
3811 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
3812 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
3818 while ((exec->status == 0) && in xmlRegExecPushStringInternal()
3821 (exec->state->type != XML_REGEXP_FINAL_STATE)))) { in xmlRegExecPushStringInternal()
3828 if ((value == NULL) && (exec->counts == NULL)) in xmlRegExecPushStringInternal()
3831 exec->transcount = 0; in xmlRegExecPushStringInternal()
3832 for (;exec->transno < exec->state->nbTrans;exec->transno++) { in xmlRegExecPushStringInternal()
3833 trans = &exec->state->trans[exec->transno]; in xmlRegExecPushStringInternal()
3855 for (i = 0;i < exec->state->nbTrans;i++) { in xmlRegExecPushStringInternal()
3856 t = &exec->state->trans[i]; in xmlRegExecPushStringInternal()
3859 counter = &exec->comp->counters[t->counter]; in xmlRegExecPushStringInternal()
3860 count = exec->counts[t->counter]; in xmlRegExecPushStringInternal()
3890 for (i = 0;i < exec->state->nbTrans;i++) { in xmlRegExecPushStringInternal()
3891 t = &exec->state->trans[i]; in xmlRegExecPushStringInternal()
3894 counter = &exec->comp->counters[t->counter]; in xmlRegExecPushStringInternal()
3895 count = exec->counts[t->counter]; in xmlRegExecPushStringInternal()
3909 count = exec->counts[trans->count]; in xmlRegExecPushStringInternal()
3910 counter = &exec->comp->counters[trans->count]; in xmlRegExecPushStringInternal()
3918 exec->status = -2; in xmlRegExecPushStringInternal()
3931 count = exec->counts[trans->counter]; in xmlRegExecPushStringInternal()
3932 counter = &exec->comp->counters[trans->counter]; in xmlRegExecPushStringInternal()
3938 xmlRegStatePtr to = exec->comp->states[trans->to]; in xmlRegExecPushStringInternal()
3943 if (exec->state->nbTrans > exec->transno + 1) { in xmlRegExecPushStringInternal()
3944 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
3945 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
3947 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
3949 exec->transcount = 1; in xmlRegExecPushStringInternal()
3954 if (exec->transcount == atom->max) { in xmlRegExecPushStringInternal()
3957 exec->index++; in xmlRegExecPushStringInternal()
3958 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
3959 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
3968 exec->index --; in xmlRegExecPushStringInternal()
3971 if (exec->transcount >= atom->min) { in xmlRegExecPushStringInternal()
3972 int transno = exec->transno; in xmlRegExecPushStringInternal()
3973 xmlRegStatePtr state = exec->state; in xmlRegExecPushStringInternal()
3978 exec->transno = -1; /* trick */ in xmlRegExecPushStringInternal()
3979 exec->state = to; in xmlRegExecPushStringInternal()
3980 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
3981 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
3983 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
3984 exec->transno = transno; in xmlRegExecPushStringInternal()
3985 exec->state = state; in xmlRegExecPushStringInternal()
3988 exec->transcount++; in xmlRegExecPushStringInternal()
3990 if (exec->transcount < atom->min) in xmlRegExecPushStringInternal()
4005 if ((exec->callback != NULL) && (atom != NULL) && in xmlRegExecPushStringInternal()
4007 exec->callback(exec->data, atom->valuep, in xmlRegExecPushStringInternal()
4010 if (exec->state->nbTrans > exec->transno + 1) { in xmlRegExecPushStringInternal()
4011 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
4012 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
4014 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
4020 exec->counts[trans->counter]++; in xmlRegExecPushStringInternal()
4028 exec->counts[trans->count] = 0; in xmlRegExecPushStringInternal()
4033 if ((exec->comp->states[trans->to] != NULL) && in xmlRegExecPushStringInternal()
4034 (exec->comp->states[trans->to]->type == in xmlRegExecPushStringInternal()
4040 if (exec->errString != NULL) in xmlRegExecPushStringInternal()
4041 xmlFree(exec->errString); in xmlRegExecPushStringInternal()
4042 exec->errString = xmlStrdup(value); in xmlRegExecPushStringInternal()
4043 exec->errState = exec->state; in xmlRegExecPushStringInternal()
4044 memcpy(exec->errCounts, exec->counts, in xmlRegExecPushStringInternal()
4045 exec->comp->nbCounters * sizeof(int)); in xmlRegExecPushStringInternal()
4047 exec->state = exec->comp->states[trans->to]; in xmlRegExecPushStringInternal()
4048 exec->transno = 0; in xmlRegExecPushStringInternal()
4050 if (exec->inputStack != NULL) { in xmlRegExecPushStringInternal()
4051 exec->index++; in xmlRegExecPushStringInternal()
4052 if (exec->index < exec->inputStackNr) { in xmlRegExecPushStringInternal()
4053 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
4054 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
4075 exec->status = -4; in xmlRegExecPushStringInternal()
4079 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) { in xmlRegExecPushStringInternal()
4085 if ((progress) && (exec->state != NULL) && in xmlRegExecPushStringInternal()
4086 (exec->state->type != XML_REGEXP_SINK_STATE)) { in xmlRegExecPushStringInternal()
4088 if (exec->errString != NULL) in xmlRegExecPushStringInternal()
4089 xmlFree(exec->errString); in xmlRegExecPushStringInternal()
4090 exec->errString = xmlStrdup(value); in xmlRegExecPushStringInternal()
4091 exec->errState = exec->state; in xmlRegExecPushStringInternal()
4092 memcpy(exec->errCounts, exec->counts, in xmlRegExecPushStringInternal()
4093 exec->comp->nbCounters * sizeof(int)); in xmlRegExecPushStringInternal()
4099 exec->determinist = 0; in xmlRegExecPushStringInternal()
4100 xmlFARegExecRollBack(exec); in xmlRegExecPushStringInternal()
4101 if ((exec->inputStack != NULL ) && (exec->status == 0)) { in xmlRegExecPushStringInternal()
4102 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
4103 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
4114 if (exec->status == 0) { in xmlRegExecPushStringInternal()
4115 return(exec->state->type == XML_REGEXP_FINAL_STATE); in xmlRegExecPushStringInternal()
4118 if (exec->status < 0) { in xmlRegExecPushStringInternal()
4119 testerr(exec); in xmlRegExecPushStringInternal()
4122 return(exec->status); in xmlRegExecPushStringInternal()
4127 * @exec: a regexp execution context or NULL to indicate the end
4137 xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushString() argument
4139 return(xmlRegExecPushStringInternal(exec, value, data, 0)); in xmlRegExecPushString()
4144 * @exec: a regexp execution context or NULL to indicate the end
4155 xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushString2() argument
4161 if (exec == NULL) in xmlRegExecPushString2()
4163 if (exec->comp == NULL) in xmlRegExecPushString2()
4165 if (exec->status != 0) in xmlRegExecPushString2()
4166 return(exec->status); in xmlRegExecPushString2()
4169 return(xmlRegExecPushString(exec, value, data)); in xmlRegExecPushString2()
4177 exec->status = -1; in xmlRegExecPushString2()
4188 if (exec->comp->compact != NULL) in xmlRegExecPushString2()
4189 ret = xmlRegCompactPushString(exec, exec->comp, str, data); in xmlRegExecPushString2()
4191 ret = xmlRegExecPushStringInternal(exec, str, data, 1); in xmlRegExecPushString2()
4200 * @exec: a regexp execution context
4213 xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, in xmlRegExecGetValues() argument
4219 if ((exec == NULL) || (nbval == NULL) || (nbneg == NULL) || in xmlRegExecGetValues()
4226 if ((exec->comp != NULL) && (exec->comp->compact != NULL)) { in xmlRegExecGetValues()
4230 comp = exec->comp; in xmlRegExecGetValues()
4233 if (exec->errStateNo == -1) return(-1); in xmlRegExecGetValues()
4234 state = exec->errStateNo; in xmlRegExecGetValues()
4236 state = exec->index; in xmlRegExecGetValues()
4270 if (exec->state->type == XML_REGEXP_FINAL_STATE) in xmlRegExecGetValues()
4277 if (exec->errState == NULL) return(-1); in xmlRegExecGetValues()
4278 state = exec->errState; in xmlRegExecGetValues()
4280 if (exec->state == NULL) return(-1); in xmlRegExecGetValues()
4281 state = exec->state; in xmlRegExecGetValues()
4303 count = exec->errCounts[trans->counter]; in xmlRegExecGetValues()
4305 count = exec->counts[trans->counter]; in xmlRegExecGetValues()
4306 if (exec->comp != NULL) in xmlRegExecGetValues()
4307 counter = &exec->comp->counters[trans->counter]; in xmlRegExecGetValues()
4316 if ((exec->comp != NULL) && (exec->comp->states[trans->to] != NULL) && in xmlRegExecGetValues()
4317 (exec->comp->states[trans->to]->type != in xmlRegExecGetValues()
4343 if ((exec->comp->states[trans->to] != NULL) && in xmlRegExecGetValues()
4344 (exec->comp->states[trans->to]->type == in xmlRegExecGetValues()
4360 * @exec: a regexp execution context
4370 * returned will be freed with the @exec context and don't need to be
4376 xmlRegExecNextValues(xmlRegExecCtxtPtr exec, int *nbval, int *nbneg, in xmlRegExecNextValues() argument
4378 return(xmlRegExecGetValues(exec, 0, nbval, nbneg, values, terminal)); in xmlRegExecNextValues()
4383 * @exec: a regexp execution context generating an error
4395 * returned will be freed with the @exec context and don't need to be
4401 xmlRegExecErrInfo(xmlRegExecCtxtPtr exec, const xmlChar **string, in xmlRegExecErrInfo() argument
4403 if (exec == NULL) in xmlRegExecErrInfo()
4406 if (exec->status != 0) in xmlRegExecErrInfo()
4407 *string = exec->errString; in xmlRegExecErrInfo()
4411 return(xmlRegExecGetValues(exec, 1, nbval, nbneg, values, terminal)); in xmlRegExecErrInfo()
4415 static void testerr(xmlRegExecCtxtPtr exec) { in testerr() argument
4421 xmlRegExecErrInfo(exec, &string, &nb, &nbneg, &values[0], &terminal); in testerr()
4427 xmlRegExecPushChar(xmlRegExecCtxtPtr exec, int UCS) {
4433 if (exec == NULL)
4435 if (exec->status != 0)
4436 return(exec->status);
4438 while ((exec->status == 0) &&
4439 ((exec->inputString[exec->index] != 0) ||
4440 (exec->state->type != XML_REGEXP_FINAL_STATE))) {
4447 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
4450 exec->transcount = 0;
4451 for (;exec->transno < exec->state->nbTrans;exec->transno++) {
4452 trans = &exec->state->trans[exec->transno];
4465 count = exec->counts[trans->count];
4466 counter = &exec->comp->counters[trans->count];
4474 exec->status = -2;
4476 } else if (exec->inputString[exec->index] != 0) {
4477 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
4480 xmlRegStatePtr to = exec->comp->states[trans->to];
4485 if (exec->state->nbTrans > exec->transno + 1) {
4486 xmlFARegExecSave(exec);
4488 exec->transcount = 1;
4493 if (exec->transcount == atom->max) {
4496 exec->index += len;
4500 if (exec->inputString[exec->index] == 0) {
4501 exec->index -= len;
4504 if (exec->transcount >= atom->min) {
4505 int transno = exec->transno;
4506 xmlRegStatePtr state = exec->state;
4511 exec->transno = -1; /* trick */
4512 exec->state = to;
4513 xmlFARegExecSave(exec);
4514 exec->transno = transno;
4515 exec->state = state;
4517 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
4520 exec->transcount++;
4522 if (exec->transcount < atom->min)
4537 if (exec->state->nbTrans > exec->transno + 1) {
4538 xmlFARegExecSave(exec);
4547 exec->counts[trans->count] = 0;
4553 exec->counts[trans->counter]++;
4558 exec->state = exec->comp->states[trans->to];
4559 exec->transno = 0;
4561 exec->index += len;
4565 exec->status = -4;
4569 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
4574 exec->determinist = 0;
4575 xmlFARegExecRollBack(exec);