-/* Generated by re2c 0.5 on Wed Sep 20 10:04:05 2000 */
+/* Generated by re2c 0.5 on Wed Sep 20 10:08:57 2000 */
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
#define HANDLE_TAG() {\
int ok = 0; \
int i; \
- smart_str_setl(&ctx->tag, start, YYCURSOR - start); \
+ smart_str_copyl(&ctx->tag, start, YYCURSOR - start); \
for (i = 0; check_tag_arg[i].tag; i++) { \
if (ctx->tag.len == check_tag_arg[i].taglen \
&& strncasecmp(ctx->tag.c, check_tag_arg[i].tag, ctx->tag.len) == 0) { \
}
#define HANDLE_ARG() {\
- smart_str_setl(&ctx->arg, start, YYCURSOR - start); \
+ smart_str_copyl(&ctx->arg, start, YYCURSOR - start); \
}
#define HANDLE_VAL(quotes) {\
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
tag_arg(ctx PLS_CC); \
}
-/*
- * Since arg/tag are read-only during the mainloop, we do not need
- * to copy them. We need those variables across multiple calls
- * to url_adapt() though, but they point to a private buffer. So we
- * copy them before leaving the mainloop() and restore them at
- * the beginning.
- */
-
-#define MOVE_TO_CTX(X) \
- if (ctx->X.c) \
- smart_str_copyl(&ctx->c_##X, ctx->X.c, ctx->X.len); \
- else \
- smart_str_free(&ctx->c_##X)
-
-#define FETCH_FROM_CTX(X) \
- smart_str_setl(&ctx->X, ctx->c_##X.c, ctx->c_##X.len)
-
static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
{
char *end, *q;
int rest;
PLS_FETCH();
- FETCH_FROM_CTX(arg);
- FETCH_FROM_CTX(tag);
-
smart_str_appendl(&ctx->buf, newdata, newlen);
YYCURSOR = ctx->buf.c;
YYLIMIT = ctx->buf.c + ctx->buf.len;
-#line 283
+#line 263
while(1) {
if(yych != '<') goto yy4;
yy2: yych = *++YYCURSOR;
yy3:
-#line 294
+#line 274
{ PASSTHRU(); STATE = STATE_TAG; continue; }
yy4: yych = *++YYCURSOR;
yy5:
-#line 295
+#line 275
{ PASSTHRU(); continue; }
}
-#line 296
+#line 276
break;
yy8: yych = *++YYCURSOR;
goto yy13;
yy9:
-#line 301
+#line 281
{ HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
yy10: yych = *++YYCURSOR;
yy11:
-#line 302
+#line 282
{ PASSTHRU(); continue; }
yy12: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yy13: if(yybm[0+yych] & 128) goto yy12;
goto yy9;
}
-#line 303
+#line 283
break;
}
yy16: yych = *++YYCURSOR;
yy17:
-#line 308
+#line 288
{ PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
yy18: yych = *++YYCURSOR;
yy19:
-#line 309
+#line 289
{ PASSTHRU(); continue; }
yy20: yych = *++YYCURSOR;
yy21:
-#line 310
+#line 290
{ YYCURSOR--; STATE = STATE_ARG; continue; }
yy22: yych = *++YYCURSOR;
yy23:
-#line 311
+#line 291
{ PASSTHRU(); continue; }
}
-#line 312
+#line 292
break;
yy26: yych = *++YYCURSOR;
goto yy31;
yy27:
-#line 317
+#line 297
{ PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
yy28: yych = *++YYCURSOR;
yy29:
-#line 318
+#line 298
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
yy30: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yy31: if(yybm[0+yych] & 128) goto yy30;
goto yy27;
}
-#line 319
+#line 299
case STATE_BEFORE_VAL:
if(yych == ' ') goto yy41;
if(yych == '=') goto yy39;
yy35:
-#line 324
+#line 304
{ YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
yy36: yych = *++YYCURSOR;
goto yy40;
yy37:
-#line 323
+#line 303
{ PASSTHRU(); STATE = STATE_VAL; continue; }
yy38: yych = *++YYCURSOR;
goto yy35;
case 0: goto yy35;
}
}
-#line 325
+#line 305
break;
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '>') goto yy54;
yy47:
-#line 332
+#line 312
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
yy48: yych = *++YYCURSOR;
goto yy52;
yy49:
-#line 331
+#line 311
{ HANDLE_VAL(0); STATE = STATE_NEXT_ARG; continue; }
yy50: yych = *++YYCURSOR;
goto yy47;
}
yy56: yych = *++YYCURSOR;
yy57:
-#line 330
+#line 310
{ HANDLE_VAL(1); STATE = STATE_NEXT_ARG; continue; }
}
-#line 333
+#line 313
break;
}
printf("stopped in state %d at pos %d (%d:%c)\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR);
#endif
- MOVE_TO_CTX(tag);
- MOVE_TO_CTX(arg);
-
rest = YYLIMIT - start;
memmove(ctx->buf.c, start, rest);
smart_str_free(&ctx->result);
smart_str_free(&ctx->buf);
- smart_str_free(&ctx->c_tag);
- smart_str_free(&ctx->c_arg);
+ smart_str_free(&ctx->tag);
+ smart_str_free(&ctx->arg);
return SUCCESS;
}
#define HANDLE_TAG() {\
int ok = 0; \
int i; \
- smart_str_setl(&ctx->tag, start, YYCURSOR - start); \
+ smart_str_copyl(&ctx->tag, start, YYCURSOR - start); \
for (i = 0; check_tag_arg[i].tag; i++) { \
if (ctx->tag.len == check_tag_arg[i].taglen \
&& strncasecmp(ctx->tag.c, check_tag_arg[i].tag, ctx->tag.len) == 0) { \
}
#define HANDLE_ARG() {\
- smart_str_setl(&ctx->arg, start, YYCURSOR - start); \
+ smart_str_copyl(&ctx->arg, start, YYCURSOR - start); \
}
#define HANDLE_VAL(quotes) {\
smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); \
tag_arg(ctx PLS_CC); \
}
-/*
- * Since arg/tag are read-only during the mainloop, we do not need
- * to copy them. We need those variables across multiple calls
- * to url_adapt() though, but they point to a private buffer. So we
- * copy them before leaving the mainloop() and restore them at
- * the beginning.
- */
-
-#define MOVE_TO_CTX(X) \
- if (ctx->X.c) \
- smart_str_copyl(&ctx->c_##X, ctx->X.c, ctx->X.len); \
- else \
- smart_str_free(&ctx->c_##X)
-
-#define FETCH_FROM_CTX(X) \
- smart_str_setl(&ctx->X, ctx->c_##X.c, ctx->c_##X.len)
-
static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
{
char *end, *q;
int rest;
PLS_FETCH();
- FETCH_FROM_CTX(arg);
- FETCH_FROM_CTX(tag);
-
smart_str_appendl(&ctx->buf, newdata, newlen);
YYCURSOR = ctx->buf.c;
printf("stopped in state %d at pos %d (%d:%c)\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR);
#endif
- MOVE_TO_CTX(tag);
- MOVE_TO_CTX(arg);
-
rest = YYLIMIT - start;
memmove(ctx->buf.c, start, rest);
smart_str_free(&ctx->result);
smart_str_free(&ctx->buf);
- smart_str_free(&ctx->c_tag);
- smart_str_free(&ctx->c_arg);
+ smart_str_free(&ctx->tag);
+ smart_str_free(&ctx->arg);
return SUCCESS;
}