Lines Matching refs:exec
3152 xmlFARegDebugExec(xmlRegExecCtxtPtr exec) { in xmlFARegDebugExec() argument
3153 printf("state: %d:%d:idx %d", exec->state->no, exec->transno, exec->index); in xmlFARegDebugExec()
3154 if (exec->inputStack != NULL) { in xmlFARegDebugExec()
3157 for (i = 0;(i < 3) && (i < exec->inputStackNr);i++) in xmlFARegDebugExec()
3159 exec->inputStack[exec->inputStackNr - (i + 1)].value); in xmlFARegDebugExec()
3161 printf(": %s", &(exec->inputString[exec->index])); in xmlFARegDebugExec()
3168 xmlFARegExecSave(xmlRegExecCtxtPtr exec) { in xmlFARegExecSave() argument
3171 exec->transno++; in xmlFARegExecSave()
3172 xmlFARegDebugExec(exec); in xmlFARegExecSave()
3173 exec->transno--; in xmlFARegExecSave()
3176 if (exec->nbPush > MAX_PUSH) { in xmlFARegExecSave()
3179 exec->nbPush++; in xmlFARegExecSave()
3182 if (exec->maxRollbacks == 0) { in xmlFARegExecSave()
3183 exec->maxRollbacks = 4; in xmlFARegExecSave()
3184 exec->rollbacks = (xmlRegExecRollback *) xmlMalloc(exec->maxRollbacks * in xmlFARegExecSave()
3186 if (exec->rollbacks == NULL) { in xmlFARegExecSave()
3188 exec->maxRollbacks = 0; in xmlFARegExecSave()
3191 memset(exec->rollbacks, 0, in xmlFARegExecSave()
3192 exec->maxRollbacks * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3193 } else if (exec->nbRollbacks >= exec->maxRollbacks) { in xmlFARegExecSave()
3195 int len = exec->maxRollbacks; in xmlFARegExecSave()
3197 exec->maxRollbacks *= 2; in xmlFARegExecSave()
3198 tmp = (xmlRegExecRollback *) xmlRealloc(exec->rollbacks, in xmlFARegExecSave()
3199 exec->maxRollbacks * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3202 exec->maxRollbacks /= 2; in xmlFARegExecSave()
3205 exec->rollbacks = tmp; in xmlFARegExecSave()
3206 tmp = &exec->rollbacks[len]; in xmlFARegExecSave()
3207 memset(tmp, 0, (exec->maxRollbacks - len) * sizeof(xmlRegExecRollback)); in xmlFARegExecSave()
3209 exec->rollbacks[exec->nbRollbacks].state = exec->state; in xmlFARegExecSave()
3210 exec->rollbacks[exec->nbRollbacks].index = exec->index; in xmlFARegExecSave()
3211 exec->rollbacks[exec->nbRollbacks].nextbranch = exec->transno + 1; in xmlFARegExecSave()
3212 if (exec->comp->nbCounters > 0) { in xmlFARegExecSave()
3213 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecSave()
3214 exec->rollbacks[exec->nbRollbacks].counts = (int *) in xmlFARegExecSave()
3215 xmlMalloc(exec->comp->nbCounters * sizeof(int)); in xmlFARegExecSave()
3216 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecSave()
3218 exec->status = -5; in xmlFARegExecSave()
3222 memcpy(exec->rollbacks[exec->nbRollbacks].counts, exec->counts, in xmlFARegExecSave()
3223 exec->comp->nbCounters * sizeof(int)); in xmlFARegExecSave()
3225 exec->nbRollbacks++; in xmlFARegExecSave()
3229 xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) { in xmlFARegExecRollBack() argument
3230 if (exec->nbRollbacks <= 0) { in xmlFARegExecRollBack()
3231 exec->status = -1; in xmlFARegExecRollBack()
3237 exec->nbRollbacks--; in xmlFARegExecRollBack()
3238 exec->state = exec->rollbacks[exec->nbRollbacks].state; in xmlFARegExecRollBack()
3239 exec->index = exec->rollbacks[exec->nbRollbacks].index; in xmlFARegExecRollBack()
3240 exec->transno = exec->rollbacks[exec->nbRollbacks].nextbranch; in xmlFARegExecRollBack()
3241 if (exec->comp->nbCounters > 0) { in xmlFARegExecRollBack()
3242 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { in xmlFARegExecRollBack()
3244 exec->status = -6; in xmlFARegExecRollBack()
3247 if (exec->counts) { in xmlFARegExecRollBack()
3248 memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts, in xmlFARegExecRollBack()
3249 exec->comp->nbCounters * sizeof(int)); in xmlFARegExecRollBack()
3255 xmlFARegDebugExec(exec); in xmlFARegExecRollBack()
3268 xmlRegExecCtxtPtr exec = &execval; in xmlFARegExec() local
3271 exec->inputString = content; in xmlFARegExec()
3272 exec->index = 0; in xmlFARegExec()
3273 exec->nbPush = 0; in xmlFARegExec()
3274 exec->determinist = 1; in xmlFARegExec()
3275 exec->maxRollbacks = 0; in xmlFARegExec()
3276 exec->nbRollbacks = 0; in xmlFARegExec()
3277 exec->rollbacks = NULL; in xmlFARegExec()
3278 exec->status = 0; in xmlFARegExec()
3279 exec->comp = comp; in xmlFARegExec()
3280 exec->state = comp->states[0]; in xmlFARegExec()
3281 exec->transno = 0; in xmlFARegExec()
3282 exec->transcount = 0; in xmlFARegExec()
3283 exec->inputStack = NULL; in xmlFARegExec()
3284 exec->inputStackMax = 0; in xmlFARegExec()
3286 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int)); in xmlFARegExec()
3287 if (exec->counts == NULL) { in xmlFARegExec()
3291 memset(exec->counts, 0, comp->nbCounters * sizeof(int)); in xmlFARegExec()
3293 exec->counts = NULL; in xmlFARegExec()
3294 while ((exec->status == 0) && (exec->state != NULL) && in xmlFARegExec()
3295 ((exec->inputString[exec->index] != 0) || in xmlFARegExec()
3296 ((exec->state != NULL) && in xmlFARegExec()
3297 (exec->state->type != XML_REGEXP_FINAL_STATE)))) { in xmlFARegExec()
3309 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL)) { in xmlFARegExec()
3314 if (exec->transno < exec->state->nbTrans) { in xmlFARegExec()
3315 trans = &exec->state->trans[exec->transno]; in xmlFARegExec()
3325 exec->transcount = 0; in xmlFARegExec()
3326 for (;exec->transno < exec->state->nbTrans;exec->transno++) { in xmlFARegExec()
3327 trans = &exec->state->trans[exec->transno]; in xmlFARegExec()
3337 if (exec->counts == NULL) { in xmlFARegExec()
3338 exec->status = -1; in xmlFARegExec()
3345 count = exec->counts[trans->count]; in xmlFARegExec()
3346 counter = &exec->comp->counters[trans->count]; in xmlFARegExec()
3356 exec->status = -2; in xmlFARegExec()
3358 } else if (exec->inputString[exec->index] != 0) { in xmlFARegExec()
3359 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len); in xmlFARegExec()
3374 if ((exec->counts == NULL) || in xmlFARegExec()
3375 (exec->comp == NULL) || in xmlFARegExec()
3376 (exec->comp->counters == NULL)) { in xmlFARegExec()
3377 exec->status = -1; in xmlFARegExec()
3380 counter = &exec->comp->counters[trans->counter]; in xmlFARegExec()
3381 if (exec->counts[trans->counter] >= counter->max) in xmlFARegExec()
3387 exec->counts[trans->counter]++; in xmlFARegExec()
3389 if (exec->state->nbTrans > exec->transno + 1) { in xmlFARegExec()
3390 xmlFARegExecSave(exec); in xmlFARegExec()
3392 exec->transcount = 1; in xmlFARegExec()
3397 if (exec->transcount == atom->max) { in xmlFARegExec()
3400 exec->index += len; in xmlFARegExec()
3404 if (exec->inputString[exec->index] == 0) { in xmlFARegExec()
3405 exec->index -= len; in xmlFARegExec()
3408 if (exec->transcount >= atom->min) { in xmlFARegExec()
3409 int transno = exec->transno; in xmlFARegExec()
3410 xmlRegStatePtr state = exec->state; in xmlFARegExec()
3415 exec->transno = -1; /* trick */ in xmlFARegExec()
3416 exec->state = to; in xmlFARegExec()
3417 xmlFARegExecSave(exec); in xmlFARegExec()
3418 exec->transno = transno; in xmlFARegExec()
3419 exec->state = state; in xmlFARegExec()
3421 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), in xmlFARegExec()
3424 exec->transcount++; in xmlFARegExec()
3426 if (exec->transcount < atom->min) in xmlFARegExec()
3439 if (exec->counts == NULL) { in xmlFARegExec()
3440 exec->status = -1; in xmlFARegExec()
3446 exec->counts[trans->counter]--; in xmlFARegExec()
3454 exec->transcount = 1; in xmlFARegExec()
3460 exec->transcount = 1; in xmlFARegExec()
3467 (exec->state->nbTrans > exec->transno + 1))) { in xmlFARegExec()
3471 trans->atom->no, codepoint, exec->index); in xmlFARegExec()
3474 trans->count, codepoint, exec->index); in xmlFARegExec()
3476 xmlFARegExecSave(exec); in xmlFARegExec()
3482 if ((exec->counts == NULL) || in xmlFARegExec()
3483 (exec->comp == NULL) || in xmlFARegExec()
3484 (exec->comp->counters == NULL)) { in xmlFARegExec()
3485 exec->status = -1; in xmlFARegExec()
3488 counter = &exec->comp->counters[trans->counter]; in xmlFARegExec()
3489 if (exec->counts[trans->counter] >= counter->max) in xmlFARegExec()
3494 exec->counts[trans->counter]++; in xmlFARegExec()
3498 if (exec->counts == NULL) { in xmlFARegExec()
3499 exec->status = -1; in xmlFARegExec()
3506 exec->counts[trans->count] = 0; in xmlFARegExec()
3511 exec->state = comp->states[trans->to]; in xmlFARegExec()
3512 exec->transno = 0; in xmlFARegExec()
3514 exec->index += len; in xmlFARegExec()
3518 exec->status = -4; in xmlFARegExec()
3522 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) { in xmlFARegExec()
3527 exec->determinist = 0; in xmlFARegExec()
3529 printf("rollback from state %d on %d:%c\n", exec->state->no, in xmlFARegExec()
3532 xmlFARegExecRollBack(exec); in xmlFARegExec()
3538 if (exec->rollbacks != NULL) { in xmlFARegExec()
3539 if (exec->counts != NULL) { in xmlFARegExec()
3542 for (i = 0;i < exec->maxRollbacks;i++) in xmlFARegExec()
3543 if (exec->rollbacks[i].counts != NULL) in xmlFARegExec()
3544 xmlFree(exec->rollbacks[i].counts); in xmlFARegExec()
3546 xmlFree(exec->rollbacks); in xmlFARegExec()
3548 if (exec->state == NULL) in xmlFARegExec()
3550 if (exec->counts != NULL) in xmlFARegExec()
3551 xmlFree(exec->counts); in xmlFARegExec()
3552 if (exec->status == 0) in xmlFARegExec()
3554 if (exec->status == -1) { in xmlFARegExec()
3555 if (exec->nbPush > MAX_PUSH) in xmlFARegExec()
3559 return(exec->status); in xmlFARegExec()
3568 static void testerr(xmlRegExecCtxtPtr exec);
3584 xmlRegExecCtxtPtr exec; in xmlRegNewExecCtxt() local
3590 exec = (xmlRegExecCtxtPtr) xmlMalloc(sizeof(xmlRegExecCtxt)); in xmlRegNewExecCtxt()
3591 if (exec == NULL) { in xmlRegNewExecCtxt()
3595 memset(exec, 0, sizeof(xmlRegExecCtxt)); in xmlRegNewExecCtxt()
3596 exec->inputString = NULL; in xmlRegNewExecCtxt()
3597 exec->index = 0; in xmlRegNewExecCtxt()
3598 exec->determinist = 1; in xmlRegNewExecCtxt()
3599 exec->maxRollbacks = 0; in xmlRegNewExecCtxt()
3600 exec->nbRollbacks = 0; in xmlRegNewExecCtxt()
3601 exec->rollbacks = NULL; in xmlRegNewExecCtxt()
3602 exec->status = 0; in xmlRegNewExecCtxt()
3603 exec->comp = comp; in xmlRegNewExecCtxt()
3605 exec->state = comp->states[0]; in xmlRegNewExecCtxt()
3606 exec->transno = 0; in xmlRegNewExecCtxt()
3607 exec->transcount = 0; in xmlRegNewExecCtxt()
3608 exec->callback = callback; in xmlRegNewExecCtxt()
3609 exec->data = data; in xmlRegNewExecCtxt()
3615 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int) in xmlRegNewExecCtxt()
3617 if (exec->counts == NULL) { in xmlRegNewExecCtxt()
3619 xmlFree(exec); in xmlRegNewExecCtxt()
3622 memset(exec->counts, 0, comp->nbCounters * sizeof(int) * 2); in xmlRegNewExecCtxt()
3623 exec->errCounts = &exec->counts[comp->nbCounters]; in xmlRegNewExecCtxt()
3625 exec->counts = NULL; in xmlRegNewExecCtxt()
3626 exec->errCounts = NULL; in xmlRegNewExecCtxt()
3628 exec->inputStackMax = 0; in xmlRegNewExecCtxt()
3629 exec->inputStackNr = 0; in xmlRegNewExecCtxt()
3630 exec->inputStack = NULL; in xmlRegNewExecCtxt()
3631 exec->errStateNo = -1; in xmlRegNewExecCtxt()
3632 exec->errString = NULL; in xmlRegNewExecCtxt()
3633 exec->nbPush = 0; in xmlRegNewExecCtxt()
3634 return(exec); in xmlRegNewExecCtxt()
3644 xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) { in xmlRegFreeExecCtxt() argument
3645 if (exec == NULL) in xmlRegFreeExecCtxt()
3648 if (exec->rollbacks != NULL) { in xmlRegFreeExecCtxt()
3649 if (exec->counts != NULL) { in xmlRegFreeExecCtxt()
3652 for (i = 0;i < exec->maxRollbacks;i++) in xmlRegFreeExecCtxt()
3653 if (exec->rollbacks[i].counts != NULL) in xmlRegFreeExecCtxt()
3654 xmlFree(exec->rollbacks[i].counts); in xmlRegFreeExecCtxt()
3656 xmlFree(exec->rollbacks); in xmlRegFreeExecCtxt()
3658 if (exec->counts != NULL) in xmlRegFreeExecCtxt()
3659 xmlFree(exec->counts); in xmlRegFreeExecCtxt()
3660 if (exec->inputStack != NULL) { in xmlRegFreeExecCtxt()
3663 for (i = 0;i < exec->inputStackNr;i++) { in xmlRegFreeExecCtxt()
3664 if (exec->inputStack[i].value != NULL) in xmlRegFreeExecCtxt()
3665 xmlFree(exec->inputStack[i].value); in xmlRegFreeExecCtxt()
3667 xmlFree(exec->inputStack); in xmlRegFreeExecCtxt()
3669 if (exec->errString != NULL) in xmlRegFreeExecCtxt()
3670 xmlFree(exec->errString); in xmlRegFreeExecCtxt()
3671 xmlFree(exec); in xmlRegFreeExecCtxt()
3675 xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlFARegExecSaveInputString() argument
3678 printf("saving value: %d:%s\n", exec->inputStackNr, value); in xmlFARegExecSaveInputString()
3680 if (exec->inputStackMax == 0) { in xmlFARegExecSaveInputString()
3681 exec->inputStackMax = 4; in xmlFARegExecSaveInputString()
3682 exec->inputStack = (xmlRegInputTokenPtr) in xmlFARegExecSaveInputString()
3683 xmlMalloc(exec->inputStackMax * sizeof(xmlRegInputToken)); in xmlFARegExecSaveInputString()
3684 if (exec->inputStack == NULL) { in xmlFARegExecSaveInputString()
3686 exec->inputStackMax = 0; in xmlFARegExecSaveInputString()
3689 } else if (exec->inputStackNr + 1 >= exec->inputStackMax) { in xmlFARegExecSaveInputString()
3692 exec->inputStackMax *= 2; in xmlFARegExecSaveInputString()
3693 tmp = (xmlRegInputTokenPtr) xmlRealloc(exec->inputStack, in xmlFARegExecSaveInputString()
3694 exec->inputStackMax * sizeof(xmlRegInputToken)); in xmlFARegExecSaveInputString()
3697 exec->inputStackMax /= 2; in xmlFARegExecSaveInputString()
3700 exec->inputStack = tmp; in xmlFARegExecSaveInputString()
3702 exec->inputStack[exec->inputStackNr].value = xmlStrdup(value); in xmlFARegExecSaveInputString()
3703 exec->inputStack[exec->inputStackNr].data = data; in xmlFARegExecSaveInputString()
3704 exec->inputStackNr++; in xmlFARegExecSaveInputString()
3705 exec->inputStack[exec->inputStackNr].value = NULL; in xmlFARegExecSaveInputString()
3706 exec->inputStack[exec->inputStackNr].data = NULL; in xmlFARegExecSaveInputString()
3772 xmlRegCompactPushString(xmlRegExecCtxtPtr exec, in xmlRegCompactPushString() argument
3776 int state = exec->index; in xmlRegCompactPushString()
3804 exec->index = target; in xmlRegCompactPushString()
3805 if ((exec->callback != NULL) && (comp->transdata != NULL)) { in xmlRegCompactPushString()
3806 exec->callback(exec->data, value, in xmlRegCompactPushString()
3831 if (exec->errString != NULL) in xmlRegCompactPushString()
3832 xmlFree(exec->errString); in xmlRegCompactPushString()
3833 exec->errString = xmlStrdup(value); in xmlRegCompactPushString()
3834 exec->errStateNo = state; in xmlRegCompactPushString()
3835 exec->status = -1; in xmlRegCompactPushString()
3837 testerr(exec); in xmlRegCompactPushString()
3855 xmlRegExecPushStringInternal(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushStringInternal() argument
3863 if (exec == NULL) in xmlRegExecPushStringInternal()
3865 if (exec->comp == NULL) in xmlRegExecPushStringInternal()
3867 if (exec->status != 0) in xmlRegExecPushStringInternal()
3868 return(exec->status); in xmlRegExecPushStringInternal()
3870 if (exec->comp->compact != NULL) in xmlRegExecPushStringInternal()
3871 return(xmlRegCompactPushString(exec, exec->comp, value, data)); in xmlRegExecPushStringInternal()
3874 if (exec->state->type == XML_REGEXP_FINAL_STATE) in xmlRegExecPushStringInternal()
3886 if ((value != NULL) && (exec->inputStackNr > 0)) { in xmlRegExecPushStringInternal()
3887 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
3888 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
3889 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
3895 while ((exec->status == 0) && in xmlRegExecPushStringInternal()
3898 (exec->state->type != XML_REGEXP_FINAL_STATE)))) { in xmlRegExecPushStringInternal()
3905 if ((value == NULL) && (exec->counts == NULL)) in xmlRegExecPushStringInternal()
3908 exec->transcount = 0; in xmlRegExecPushStringInternal()
3909 for (;exec->transno < exec->state->nbTrans;exec->transno++) { in xmlRegExecPushStringInternal()
3910 trans = &exec->state->trans[exec->transno]; in xmlRegExecPushStringInternal()
3932 for (i = 0;i < exec->state->nbTrans;i++) { in xmlRegExecPushStringInternal()
3933 t = &exec->state->trans[i]; in xmlRegExecPushStringInternal()
3936 counter = &exec->comp->counters[t->counter]; in xmlRegExecPushStringInternal()
3937 count = exec->counts[t->counter]; in xmlRegExecPushStringInternal()
3967 for (i = 0;i < exec->state->nbTrans;i++) { in xmlRegExecPushStringInternal()
3968 t = &exec->state->trans[i]; in xmlRegExecPushStringInternal()
3971 counter = &exec->comp->counters[t->counter]; in xmlRegExecPushStringInternal()
3972 count = exec->counts[t->counter]; in xmlRegExecPushStringInternal()
3986 count = exec->counts[trans->count]; in xmlRegExecPushStringInternal()
3987 counter = &exec->comp->counters[trans->count]; in xmlRegExecPushStringInternal()
3995 exec->status = -2; in xmlRegExecPushStringInternal()
4008 count = exec->counts[trans->counter]; in xmlRegExecPushStringInternal()
4009 counter = &exec->comp->counters[trans->counter]; in xmlRegExecPushStringInternal()
4015 xmlRegStatePtr to = exec->comp->states[trans->to]; in xmlRegExecPushStringInternal()
4020 if (exec->state->nbTrans > exec->transno + 1) { in xmlRegExecPushStringInternal()
4021 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
4022 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
4024 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
4026 exec->transcount = 1; in xmlRegExecPushStringInternal()
4031 if (exec->transcount == atom->max) { in xmlRegExecPushStringInternal()
4034 exec->index++; in xmlRegExecPushStringInternal()
4035 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
4036 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
4045 exec->index --; in xmlRegExecPushStringInternal()
4048 if (exec->transcount >= atom->min) { in xmlRegExecPushStringInternal()
4049 int transno = exec->transno; in xmlRegExecPushStringInternal()
4050 xmlRegStatePtr state = exec->state; in xmlRegExecPushStringInternal()
4055 exec->transno = -1; /* trick */ in xmlRegExecPushStringInternal()
4056 exec->state = to; in xmlRegExecPushStringInternal()
4057 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
4058 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
4060 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
4061 exec->transno = transno; in xmlRegExecPushStringInternal()
4062 exec->state = state; in xmlRegExecPushStringInternal()
4065 exec->transcount++; in xmlRegExecPushStringInternal()
4067 if (exec->transcount < atom->min) in xmlRegExecPushStringInternal()
4082 if ((exec->callback != NULL) && (atom != NULL) && in xmlRegExecPushStringInternal()
4084 exec->callback(exec->data, atom->valuep, in xmlRegExecPushStringInternal()
4087 if (exec->state->nbTrans > exec->transno + 1) { in xmlRegExecPushStringInternal()
4088 if (exec->inputStackNr <= 0) { in xmlRegExecPushStringInternal()
4089 xmlFARegExecSaveInputString(exec, value, data); in xmlRegExecPushStringInternal()
4091 xmlFARegExecSave(exec); in xmlRegExecPushStringInternal()
4097 exec->counts[trans->counter]++; in xmlRegExecPushStringInternal()
4105 exec->counts[trans->count] = 0; in xmlRegExecPushStringInternal()
4110 if ((exec->comp->states[trans->to] != NULL) && in xmlRegExecPushStringInternal()
4111 (exec->comp->states[trans->to]->type == in xmlRegExecPushStringInternal()
4117 if (exec->errString != NULL) in xmlRegExecPushStringInternal()
4118 xmlFree(exec->errString); in xmlRegExecPushStringInternal()
4119 exec->errString = xmlStrdup(value); in xmlRegExecPushStringInternal()
4120 exec->errState = exec->state; in xmlRegExecPushStringInternal()
4121 memcpy(exec->errCounts, exec->counts, in xmlRegExecPushStringInternal()
4122 exec->comp->nbCounters * sizeof(int)); in xmlRegExecPushStringInternal()
4124 exec->state = exec->comp->states[trans->to]; in xmlRegExecPushStringInternal()
4125 exec->transno = 0; in xmlRegExecPushStringInternal()
4127 if (exec->inputStack != NULL) { in xmlRegExecPushStringInternal()
4128 exec->index++; in xmlRegExecPushStringInternal()
4129 if (exec->index < exec->inputStackNr) { in xmlRegExecPushStringInternal()
4130 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
4131 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
4152 exec->status = -4; in xmlRegExecPushStringInternal()
4156 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) { in xmlRegExecPushStringInternal()
4162 if ((progress) && (exec->state != NULL) && in xmlRegExecPushStringInternal()
4163 (exec->state->type != XML_REGEXP_SINK_STATE)) { in xmlRegExecPushStringInternal()
4165 if (exec->errString != NULL) in xmlRegExecPushStringInternal()
4166 xmlFree(exec->errString); in xmlRegExecPushStringInternal()
4167 exec->errString = xmlStrdup(value); in xmlRegExecPushStringInternal()
4168 exec->errState = exec->state; in xmlRegExecPushStringInternal()
4169 if (exec->comp->nbCounters) in xmlRegExecPushStringInternal()
4170 memcpy(exec->errCounts, exec->counts, in xmlRegExecPushStringInternal()
4171 exec->comp->nbCounters * sizeof(int)); in xmlRegExecPushStringInternal()
4177 exec->determinist = 0; in xmlRegExecPushStringInternal()
4178 xmlFARegExecRollBack(exec); in xmlRegExecPushStringInternal()
4179 if ((exec->inputStack != NULL ) && (exec->status == 0)) { in xmlRegExecPushStringInternal()
4180 value = exec->inputStack[exec->index].value; in xmlRegExecPushStringInternal()
4181 data = exec->inputStack[exec->index].data; in xmlRegExecPushStringInternal()
4192 if (exec->status == 0) { in xmlRegExecPushStringInternal()
4193 return(exec->state->type == XML_REGEXP_FINAL_STATE); in xmlRegExecPushStringInternal()
4196 if (exec->status < 0) { in xmlRegExecPushStringInternal()
4197 testerr(exec); in xmlRegExecPushStringInternal()
4200 return(exec->status); in xmlRegExecPushStringInternal()
4215 xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushString() argument
4217 return(xmlRegExecPushStringInternal(exec, value, data, 0)); in xmlRegExecPushString()
4233 xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, in xmlRegExecPushString2() argument
4239 if (exec == NULL) in xmlRegExecPushString2()
4241 if (exec->comp == NULL) in xmlRegExecPushString2()
4243 if (exec->status != 0) in xmlRegExecPushString2()
4244 return(exec->status); in xmlRegExecPushString2()
4247 return(xmlRegExecPushString(exec, value, data)); in xmlRegExecPushString2()
4255 exec->status = -1; in xmlRegExecPushString2()
4266 if (exec->comp->compact != NULL) in xmlRegExecPushString2()
4267 ret = xmlRegCompactPushString(exec, exec->comp, str, data); in xmlRegExecPushString2()
4269 ret = xmlRegExecPushStringInternal(exec, str, data, 1); in xmlRegExecPushString2()
4291 xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, in xmlRegExecGetValues() argument
4297 if ((exec == NULL) || (nbval == NULL) || (nbneg == NULL) || in xmlRegExecGetValues()
4304 if ((exec->comp != NULL) && (exec->comp->compact != NULL)) { in xmlRegExecGetValues()
4308 comp = exec->comp; in xmlRegExecGetValues()
4311 if (exec->errStateNo == -1) return(-1); in xmlRegExecGetValues()
4312 state = exec->errStateNo; in xmlRegExecGetValues()
4314 state = exec->index; in xmlRegExecGetValues()
4348 if (exec->state->type == XML_REGEXP_FINAL_STATE) in xmlRegExecGetValues()
4355 if (exec->errState == NULL) return(-1); in xmlRegExecGetValues()
4356 state = exec->errState; in xmlRegExecGetValues()
4358 if (exec->state == NULL) return(-1); in xmlRegExecGetValues()
4359 state = exec->state; in xmlRegExecGetValues()
4381 count = exec->errCounts[trans->counter]; in xmlRegExecGetValues()
4383 count = exec->counts[trans->counter]; in xmlRegExecGetValues()
4384 if (exec->comp != NULL) in xmlRegExecGetValues()
4385 counter = &exec->comp->counters[trans->counter]; in xmlRegExecGetValues()
4394 if ((exec->comp != NULL) && (exec->comp->states[trans->to] != NULL) && in xmlRegExecGetValues()
4395 (exec->comp->states[trans->to]->type != in xmlRegExecGetValues()
4421 if ((exec->comp->states[trans->to] != NULL) && in xmlRegExecGetValues()
4422 (exec->comp->states[trans->to]->type == in xmlRegExecGetValues()
4454 xmlRegExecNextValues(xmlRegExecCtxtPtr exec, int *nbval, int *nbneg, in xmlRegExecNextValues() argument
4456 return(xmlRegExecGetValues(exec, 0, nbval, nbneg, values, terminal)); in xmlRegExecNextValues()
4479 xmlRegExecErrInfo(xmlRegExecCtxtPtr exec, const xmlChar **string, in xmlRegExecErrInfo() argument
4481 if (exec == NULL) in xmlRegExecErrInfo()
4484 if (exec->status != 0) in xmlRegExecErrInfo()
4485 *string = exec->errString; in xmlRegExecErrInfo()
4489 return(xmlRegExecGetValues(exec, 1, nbval, nbneg, values, terminal)); in xmlRegExecErrInfo()
4493 static void testerr(xmlRegExecCtxtPtr exec) { in testerr() argument
4499 xmlRegExecErrInfo(exec, &string, &nb, &nbneg, &values[0], &terminal); in testerr()
4505 xmlRegExecPushChar(xmlRegExecCtxtPtr exec, int UCS) {
4511 if (exec == NULL)
4513 if (exec->status != 0)
4514 return(exec->status);
4516 while ((exec->status == 0) &&
4517 ((exec->inputString[exec->index] != 0) ||
4518 (exec->state->type != XML_REGEXP_FINAL_STATE))) {
4525 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
4528 exec->transcount = 0;
4529 for (;exec->transno < exec->state->nbTrans;exec->transno++) {
4530 trans = &exec->state->trans[exec->transno];
4543 count = exec->counts[trans->count];
4544 counter = &exec->comp->counters[trans->count];
4552 exec->status = -2;
4554 } else if (exec->inputString[exec->index] != 0) {
4555 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
4558 xmlRegStatePtr to = exec->comp->states[trans->to];
4563 if (exec->state->nbTrans > exec->transno + 1) {
4564 xmlFARegExecSave(exec);
4566 exec->transcount = 1;
4571 if (exec->transcount == atom->max) {
4574 exec->index += len;
4578 if (exec->inputString[exec->index] == 0) {
4579 exec->index -= len;
4582 if (exec->transcount >= atom->min) {
4583 int transno = exec->transno;
4584 xmlRegStatePtr state = exec->state;
4589 exec->transno = -1; /* trick */
4590 exec->state = to;
4591 xmlFARegExecSave(exec);
4592 exec->transno = transno;
4593 exec->state = state;
4595 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
4598 exec->transcount++;
4600 if (exec->transcount < atom->min)
4615 if (exec->state->nbTrans > exec->transno + 1) {
4616 xmlFARegExecSave(exec);
4625 exec->counts[trans->count] = 0;
4631 exec->counts[trans->counter]++;
4636 exec->state = exec->comp->states[trans->to];
4637 exec->transno = 0;
4639 exec->index += len;
4643 exec->status = -4;
4647 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
4652 exec->determinist = 0;
4653 xmlFARegExecRollBack(exec);