• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gnulib-local/lib/libxml/

Lines Matching refs:exec

2872 xmlFARegDebugExec(xmlRegExecCtxtPtr exec) {
2873 printf("state: %d:%d:idx %d", exec->state->no, exec->transno, exec->index);
2874 if (exec->inputStack != NULL) {
2877 for (i = 0;(i < 3) && (i < exec->inputStackNr);i++)
2878 printf("%s ", exec->inputStack[exec->inputStackNr - (i + 1)]);
2880 printf(": %s", &(exec->inputString[exec->index]));
2887 xmlFARegExecSave(xmlRegExecCtxtPtr exec) {
2890 exec->transno++;
2891 xmlFARegDebugExec(exec);
2892 exec->transno--;
2895 if (exec->nbPush > MAX_PUSH) {
2898 exec->nbPush++;
2901 if (exec->maxRollbacks == 0) {
2902 exec->maxRollbacks = 4;
2903 exec->rollbacks = (xmlRegExecRollback *) xmlMalloc(exec->maxRollbacks *
2905 if (exec->rollbacks == NULL) {
2907 exec->maxRollbacks = 0;
2910 memset(exec->rollbacks, 0,
2911 exec->maxRollbacks * sizeof(xmlRegExecRollback));
2912 } else if (exec->nbRollbacks >= exec->maxRollbacks) {
2914 int len = exec->maxRollbacks;
2916 exec->maxRollbacks *= 2;
2917 tmp = (xmlRegExecRollback *) xmlRealloc(exec->rollbacks,
2918 exec->maxRollbacks * sizeof(xmlRegExecRollback));
2921 exec->maxRollbacks /= 2;
2924 exec->rollbacks = tmp;
2925 tmp = &exec->rollbacks[len];
2926 memset(tmp, 0, (exec->maxRollbacks - len) * sizeof(xmlRegExecRollback));
2928 exec->rollbacks[exec->nbRollbacks].state = exec->state;
2929 exec->rollbacks[exec->nbRollbacks].index = exec->index;
2930 exec->rollbacks[exec->nbRollbacks].nextbranch = exec->transno + 1;
2931 if (exec->comp->nbCounters > 0) {
2932 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
2933 exec->rollbacks[exec->nbRollbacks].counts = (int *)
2934 xmlMalloc(exec->comp->nbCounters * sizeof(int));
2935 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
2937 exec->status = -5;
2941 memcpy(exec->rollbacks[exec->nbRollbacks].counts, exec->counts,
2942 exec->comp->nbCounters * sizeof(int));
2944 exec->nbRollbacks++;
2948 xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) {
2949 if (exec->nbRollbacks <= 0) {
2950 exec->status = -1;
2956 exec->nbRollbacks--;
2957 exec->state = exec->rollbacks[exec->nbRollbacks].state;
2958 exec->index = exec->rollbacks[exec->nbRollbacks].index;
2959 exec->transno = exec->rollbacks[exec->nbRollbacks].nextbranch;
2960 if (exec->comp->nbCounters > 0) {
2961 if (exec->rollbacks[exec->nbRollbacks].counts == NULL) {
2962 fprintf(stderr, "exec save: allocation failed");
2963 exec->status = -6;
2966 memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
2967 exec->comp->nbCounters * sizeof(int));
2972 xmlFARegDebugExec(exec);
2985 xmlRegExecCtxtPtr exec = &execval;
2988 exec->inputString = content;
2989 exec->index = 0;
2990 exec->nbPush = 0;
2991 exec->determinist = 1;
2992 exec->maxRollbacks = 0;
2993 exec->nbRollbacks = 0;
2994 exec->rollbacks = NULL;
2995 exec->status = 0;
2996 exec->comp = comp;
2997 exec->state = comp->states[0];
2998 exec->transno = 0;
2999 exec->transcount = 0;
3000 exec->inputStack = NULL;
3001 exec->inputStackMax = 0;
3003 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int));
3004 if (exec->counts == NULL) {
3008 memset(exec->counts, 0, comp->nbCounters * sizeof(int));
3010 exec->counts = NULL;
3011 while ((exec->status == 0) &&
3012 ((exec->inputString[exec->index] != 0) ||
3013 (exec->state->type != XML_REGEXP_FINAL_STATE))) {
3025 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL)) {
3030 if (exec->transno < exec->state->nbTrans) {
3031 trans = &exec->state->trans[exec->transno];
3041 exec->transcount = 0;
3042 for (;exec->transno < exec->state->nbTrans;exec->transno++) {
3043 trans = &exec->state->trans[exec->transno];
3053 if (exec->counts == NULL) {
3054 exec->status = -1;
3061 count = exec->counts[trans->count];
3062 counter = &exec->comp->counters[trans->count];
3072 exec->status = -2;
3074 } else if (exec->inputString[exec->index] != 0) {
3075 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
3086 if (exec->counts == NULL) {
3087 exec->status = -1;
3093 exec->counts[trans->counter]++;
3095 if (exec->state->nbTrans > exec->transno + 1) {
3096 xmlFARegExecSave(exec);
3098 exec->transcount = 1;
3103 if (exec->transcount == atom->max) {
3106 exec->index += len;
3110 if (exec->inputString[exec->index] == 0) {
3111 exec->index -= len;
3114 if (exec->transcount >= atom->min) {
3115 int transno = exec->transno;
3116 xmlRegStatePtr state = exec->state;
3121 exec->transno = -1; /* trick */
3122 exec->state = to;
3123 xmlFARegExecSave(exec);
3124 exec->transno = transno;
3125 exec->state = state;
3127 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
3130 exec->transcount++;
3132 if (exec->transcount < atom->min)
3145 if (exec->counts == NULL) {
3146 exec->status = -1;
3152 exec->counts[trans->counter]--;
3160 exec->transcount = 1;
3166 exec->transcount = 1;
3173 (exec->state->nbTrans > exec->transno + 1))) {
3177 trans->atom->no, codepoint, exec->index);
3180 trans->count, codepoint, exec->index);
3182 xmlFARegExecSave(exec);
3185 if (exec->counts == NULL) {
3186 exec->status = -1;
3192 exec->counts[trans->counter]++;
3196 if (exec->counts == NULL) {
3197 exec->status = -1;
3204 exec->counts[trans->count] = 0;
3209 exec->state = comp->states[trans->to];
3210 exec->transno = 0;
3212 exec->index += len;
3216 exec->status = -4;
3220 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
3225 exec->determinist = 0;
3227 printf("rollback from state %d on %d:%c\n", exec->state->no,
3230 xmlFARegExecRollBack(exec);
3236 if (exec->rollbacks != NULL) {
3237 if (exec->counts != NULL) {
3240 for (i = 0;i < exec->maxRollbacks;i++)
3241 if (exec->rollbacks[i].counts != NULL)
3242 xmlFree(exec->rollbacks[i].counts);
3244 xmlFree(exec->rollbacks);
3246 if (exec->counts != NULL)
3247 xmlFree(exec->counts);
3248 if (exec->status == 0)
3250 if (exec->status == -1) {
3251 if (exec->nbPush > MAX_PUSH)
3255 return(exec->status);
3264 static void testerr(xmlRegExecCtxtPtr exec);
3280 xmlRegExecCtxtPtr exec;
3286 exec = (xmlRegExecCtxtPtr) xmlMalloc(sizeof(xmlRegExecCtxt));
3287 if (exec == NULL) {
3291 memset(exec, 0, sizeof(xmlRegExecCtxt));
3292 exec->inputString = NULL;
3293 exec->index = 0;
3294 exec->determinist = 1;
3295 exec->maxRollbacks = 0;
3296 exec->nbRollbacks = 0;
3297 exec->rollbacks = NULL;
3298 exec->status = 0;
3299 exec->comp = comp;
3301 exec->state = comp->states[0];
3302 exec->transno = 0;
3303 exec->transcount = 0;
3304 exec->callback = callback;
3305 exec->data = data;
3308 * For error handling, exec->counts is allocated twice the size
3311 exec->counts = (int *) xmlMalloc(comp->nbCounters * sizeof(int)
3313 if (exec->counts == NULL) {
3315 xmlFree(exec);
3318 memset(exec->counts, 0, comp->nbCounters * sizeof(int) * 2);
3319 exec->errCounts = &exec->counts[comp->nbCounters];
3321 exec->counts = NULL;
3322 exec->errCounts = NULL;
3324 exec->inputStackMax = 0;
3325 exec->inputStackNr = 0;
3326 exec->inputStack = NULL;
3327 exec->errStateNo = -1;
3328 exec->errString = NULL;
3329 exec->nbPush = 0;
3330 return(exec);
3335 * @exec: a regular expression evaulation context
3340 xmlRegFreeExecCtxt(xmlRegExecCtxtPtr exec) {
3341 if (exec == NULL)
3344 if (exec->rollbacks != NULL) {
3345 if (exec->counts != NULL) {
3348 for (i = 0;i < exec->maxRollbacks;i++)
3349 if (exec->rollbacks[i].counts != NULL)
3350 xmlFree(exec->rollbacks[i].counts);
3352 xmlFree(exec->rollbacks);
3354 if (exec->counts != NULL)
3355 xmlFree(exec->counts);
3356 if (exec->inputStack != NULL) {
3359 for (i = 0;i < exec->inputStackNr;i++) {
3360 if (exec->inputStack[i].value != NULL)
3361 xmlFree(exec->inputStack[i].value);
3363 xmlFree(exec->inputStack);
3365 if (exec->errString != NULL)
3366 xmlFree(exec->errString);
3367 xmlFree(exec);
3371 xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value,
3374 printf("saving value: %d:%s\n", exec->inputStackNr, value);
3376 if (exec->inputStackMax == 0) {
3377 exec->inputStackMax = 4;
3378 exec->inputStack = (xmlRegInputTokenPtr)
3379 xmlMalloc(exec->inputStackMax * sizeof(xmlRegInputToken));
3380 if (exec->inputStack == NULL) {
3382 exec->inputStackMax = 0;
3385 } else if (exec->inputStackNr + 1 >= exec->inputStackMax) {
3388 exec->inputStackMax *= 2;
3389 tmp = (xmlRegInputTokenPtr) xmlRealloc(exec->inputStack,
3390 exec->inputStackMax * sizeof(xmlRegInputToken));
3393 exec->inputStackMax /= 2;
3396 exec->inputStack = tmp;
3398 exec->inputStack[exec->inputStackNr].value = xmlStrdup(value);
3399 exec->inputStack[exec->inputStackNr].data = data;
3400 exec->inputStackNr++;
3401 exec->inputStack[exec->inputStackNr].value = NULL;
3402 exec->inputStack[exec->inputStackNr].data = NULL;
3457 * @exec: a regexp execution context
3458 * @comp: the precompiled exec with a compact table
3468 xmlRegCompactPushString(xmlRegExecCtxtPtr exec,
3472 int state = exec->index;
3500 exec->index = target;
3501 if ((exec->callback != NULL) && (comp->transdata != NULL)) {
3502 exec->callback(exec->data, value,
3527 if (exec->errString != NULL)
3528 xmlFree(exec->errString);
3529 exec->errString = xmlStrdup(value);
3530 exec->errStateNo = state;
3531 exec->status = -1;
3533 testerr(exec);
3540 * @exec: a regexp execution context or NULL to indicate the end
3551 xmlRegExecPushStringInternal(xmlRegExecCtxtPtr exec, const xmlChar *value,
3559 if (exec == NULL)
3561 if (exec->comp == NULL)
3563 if (exec->status != 0)
3564 return(exec->status);
3566 if (exec->comp->compact != NULL)
3567 return(xmlRegCompactPushString(exec, exec->comp, value, data));
3570 if (exec->state->type == XML_REGEXP_FINAL_STATE)
3582 if ((value != NULL) && (exec->inputStackNr > 0)) {
3583 xmlFARegExecSaveInputString(exec, value, data);
3584 value = exec->inputStack[exec->index].value;
3585 data = exec->inputStack[exec->index].data;
3591 while ((exec->status == 0) &&
3594 (exec->state->type != XML_REGEXP_FINAL_STATE)))) {
3601 if ((value == NULL) && (exec->counts == NULL))
3604 exec->transcount = 0;
3605 for (;exec->transno < exec->state->nbTrans;exec->transno++) {
3606 trans = &exec->state->trans[exec->transno];
3628 for (i = 0;i < exec->state->nbTrans;i++) {
3629 t = &exec->state->trans[i];
3632 counter = &exec->comp->counters[t->counter];
3633 count = exec->counts[t->counter];
3663 for (i = 0;i < exec->state->nbTrans;i++) {
3664 t = &exec->state->trans[i];
3667 counter = &exec->comp->counters[t->counter];
3668 count = exec->counts[t->counter];
3682 count = exec->counts[trans->count];
3683 counter = &exec->comp->counters[trans->count];
3691 exec->status = -2;
3704 count = exec->counts[trans->counter];
3705 counter = &exec->comp->counters[trans->counter];
3711 xmlRegStatePtr to = exec->comp->states[trans->to];
3716 if (exec->state->nbTrans > exec->transno + 1) {
3717 if (exec->inputStackNr <= 0) {
3718 xmlFARegExecSaveInputString(exec, value, data);
3720 xmlFARegExecSave(exec);
3722 exec->transcount = 1;
3727 if (exec->transcount == atom->max) {
3730 exec->index++;
3731 value = exec->inputStack[exec->index].value;
3732 data = exec->inputStack[exec->index].data;
3741 exec->index --;
3744 if (exec->transcount >= atom->min) {
3745 int transno = exec->transno;
3746 xmlRegStatePtr state = exec->state;
3751 exec->transno = -1; /* trick */
3752 exec->state = to;
3753 if (exec->inputStackNr <= 0) {
3754 xmlFARegExecSaveInputString(exec, value, data);
3756 xmlFARegExecSave(exec);
3757 exec->transno = transno;
3758 exec->state = state;
3761 exec->transcount++;
3763 if (exec->transcount < atom->min)
3778 if ((exec->callback != NULL) && (atom != NULL) &&
3780 exec->callback(exec->data, atom->valuep,
3783 if (exec->state->nbTrans > exec->transno + 1) {
3784 if (exec->inputStackNr <= 0) {
3785 xmlFARegExecSaveInputString(exec, value, data);
3787 xmlFARegExecSave(exec);
3793 exec->counts[trans->counter]++;
3801 exec->counts[trans->count] = 0;
3806 if ((exec->comp->states[trans->to] != NULL) &&
3807 (exec->comp->states[trans->to]->type ==
3813 if (exec->errString != NULL)
3814 xmlFree(exec->errString);
3815 exec->errString = xmlStrdup(value);
3816 exec->errState = exec->state;
3817 memcpy(exec->errCounts, exec->counts,
3818 exec->comp->nbCounters * sizeof(int));
3820 exec->state = exec->comp->states[trans->to];
3821 exec->transno = 0;
3823 if (exec->inputStack != NULL) {
3824 exec->index++;
3825 if (exec->index < exec->inputStackNr) {
3826 value = exec->inputStack[exec->index].value;
3827 data = exec->inputStack[exec->index].data;
3848 exec->status = -4;
3852 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
3858 if ((progress) && (exec->state != NULL) &&
3859 (exec->state->type != XML_REGEXP_SINK_STATE)) {
3861 if (exec->errString != NULL)
3862 xmlFree(exec->errString);
3863 exec->errString = xmlStrdup(value);
3864 exec->errState = exec->state;
3865 memcpy(exec->errCounts, exec->counts,
3866 exec->comp->nbCounters * sizeof(int));
3872 exec->determinist = 0;
3873 xmlFARegExecRollBack(exec);
3874 if (exec->status == 0) {
3875 value = exec->inputStack[exec->index].value;
3876 data = exec->inputStack[exec->index].data;
3887 if (exec->status == 0) {
3888 return(exec->state->type == XML_REGEXP_FINAL_STATE);
3891 if (exec->status < 0) {
3892 testerr(exec);
3895 return(exec->status);
3900 * @exec: a regexp execution context or NULL to indicate the end
3910 xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value,
3912 return(xmlRegExecPushStringInternal(exec, value, data, 0));
3917 * @exec: a regexp execution context or NULL to indicate the end
3928 xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value,
3934 if (exec == NULL)
3936 if (exec->comp == NULL)
3938 if (exec->status != 0)
3939 return(exec->status);
3942 return(xmlRegExecPushString(exec, value, data));
3950 exec->status = -1;
3961 if (exec->comp->compact != NULL)
3962 ret = xmlRegCompactPushString(exec, exec->comp, str, data);
3964 ret = xmlRegExecPushStringInternal(exec, str, data, 1);
3973 * @exec: a regexp execution context
3986 xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err,
3992 if ((exec == NULL) || (nbval == NULL) || (nbneg == NULL) ||
3999 if ((exec->comp != NULL) && (exec->comp->compact != NULL)) {
4003 comp = exec->comp;
4006 if (exec->errStateNo == -1) return(-1);
4007 state = exec->errStateNo;
4009 state = exec->index;
4043 if (exec->state->type == XML_REGEXP_FINAL_STATE)
4050 if (exec->errState == NULL) return(-1);
4051 state = exec->errState;
4053 if (exec->state == NULL) return(-1);
4054 state = exec->state;
4076 count = exec->errCounts[trans->counter];
4078 count = exec->counts[trans->counter];
4079 if (exec->comp != NULL)
4080 counter = &exec->comp->counters[trans->counter];
4089 if ((exec->comp->states[trans->to] != NULL) &&
4090 (exec->comp->states[trans->to]->type !=
4116 if ((exec->comp->states[trans->to] != NULL) &&
4117 (exec->comp->states[trans->to]->type ==
4133 * @exec: a regexp execution context
4143 * returned will be freed with the @exec context and don't need to be
4149 xmlRegExecNextValues(xmlRegExecCtxtPtr exec, int *nbval, int *nbneg,
4151 return(xmlRegExecGetValues(exec, 0, nbval, nbneg, values, terminal));
4156 * @exec: a regexp execution context generating an error
4168 * returned will be freed with the @exec context and don't need to be
4174 xmlRegExecErrInfo(xmlRegExecCtxtPtr exec, const xmlChar **string,
4176 if (exec == NULL)
4179 if (exec->status != 0)
4180 *string = exec->errString;
4184 return(xmlRegExecGetValues(exec, 1, nbval, nbneg, values, terminal));
4188 static void testerr(xmlRegExecCtxtPtr exec) {
4194 xmlRegExecErrInfo(exec, &string, &nb, &nbneg, &values[0], &terminal);
4200 xmlRegExecPushChar(xmlRegExecCtxtPtr exec, int UCS) {
4206 if (exec == NULL)
4208 if (exec->status != 0)
4209 return(exec->status);
4211 while ((exec->status == 0) &&
4212 ((exec->inputString[exec->index] != 0) ||
4213 (exec->state->type != XML_REGEXP_FINAL_STATE))) {
4220 if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
4223 exec->transcount = 0;
4224 for (;exec->transno < exec->state->nbTrans;exec->transno++) {
4225 trans = &exec->state->trans[exec->transno];
4238 count = exec->counts[trans->count];
4239 counter = &exec->comp->counters[trans->count];
4247 exec->status = -2;
4249 } else if (exec->inputString[exec->index] != 0) {
4250 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
4253 xmlRegStatePtr to = exec->comp->states[trans->to];
4258 if (exec->state->nbTrans > exec->transno + 1) {
4259 xmlFARegExecSave(exec);
4261 exec->transcount = 1;
4266 if (exec->transcount == atom->max) {
4269 exec->index += len;
4273 if (exec->inputString[exec->index] == 0) {
4274 exec->index -= len;
4277 if (exec->transcount >= atom->min) {
4278 int transno = exec->transno;
4279 xmlRegStatePtr state = exec->state;
4284 exec->transno = -1; /* trick */
4285 exec->state = to;
4286 xmlFARegExecSave(exec);
4287 exec->transno = transno;
4288 exec->state = state;
4290 codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
4293 exec->transcount++;
4295 if (exec->transcount < atom->min)
4310 if (exec->state->nbTrans > exec->transno + 1) {
4311 xmlFARegExecSave(exec);
4320 exec->counts[trans->count] = 0;
4326 exec->counts[trans->counter]++;
4331 exec->state = exec->comp->states[trans->to];
4332 exec->transno = 0;
4334 exec->index += len;
4338 exec->status = -4;
4342 if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
4347 exec->determinist = 0;
4348 xmlFARegExecRollBack(exec);