cvs: php4 /ext/standard url_scanner_ex.c
| From: | Thies C. Arntzen | Date: | Sat, 27 Apr 2002 14:08:07 +0000 |
| Subject: | cvs: php4 /ext/standard url_scanner_ex.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11476@lists.php.net to get a copy of this message | ||
thies Sat Apr 27 10:08:07 2002 EDT
Modified files:
/php4/ext/standard url_scanner_ex.c
Log:
part 2 of last commit
Index: php4/ext/standard/url_scanner_ex.c
diff -u php4/ext/standard/url_scanner_ex.c:1.54 php4/ext/standard/url_scanner_ex.c:1.55
--- php4/ext/standard/url_scanner_ex.c:1.54 Thu Apr 25 18:12:56 2002
+++ php4/ext/standard/url_scanner_ex.c Sat Apr 27 10:08:07 2002
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.5 on Thu Apr 25 15:14:39 2002 */
-#line 1 "/home/jimw/php4/ext/standard/url_scanner_ex.re"
+/* Generated by re2c 0.5 on Sat Apr 27 16:02:20 2002 */
+#line 1 "/home/thies/devel/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
@@ -95,7 +95,7 @@
#define YYLIMIT q
#define YYMARKER r
-static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *name, smart_str
*val, const char *separator)
+static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *name, smart_str
*val, smart_str *udata_name, smart_str *udata_value, const char *separator)
{
register const char *p, *q;
const char *bash = NULL;
@@ -188,6 +188,12 @@
smart_str_append(dest, name);
smart_str_appendc(dest, '=');
smart_str_append(dest, val);
+ if (udata_name->len && udata_value->len) {
+ smart_str_appends(dest, separator);
+ smart_str_append(dest, udata_name);
+ smart_str_appendc(dest, '=');
+ smart_str_append(dest, udata_value);
+ }
if (bash)
smart_str_appendl(dest, bash, q - bash);
@@ -210,7 +216,7 @@
if (quotes)
smart_str_appendc(&ctx->result, type);
if (f) {
- append_modified_url(&ctx->val, &ctx->result, &ctx->q_name,
&ctx->q_value, PG(arg_separator).output);
+ append_modified_url(&ctx->val, &ctx->result, &ctx->q_name,
&ctx->q_value, &ctx->q_udata_name, &ctx->q_udata_value,
PG(arg_separator).output);
} else {
smart_str_append(&ctx->result, &ctx->val);
}
@@ -250,6 +256,14 @@
smart_str_appends(&ctx->result, "\" value=\"");
smart_str_append(&ctx->result, &ctx->q_value);
smart_str_appends(&ctx->result, "\" />");
+
+ if (ctx->q_udata_name.len) {
+ smart_str_appends(&ctx->result, "<input type=\"hidden\"
name=\"");
+ smart_str_append(&ctx->result, &ctx->q_udata_name);
+ smart_str_appends(&ctx->result, "\" value=\"");
+ smart_str_append(&ctx->result, &ctx->q_udata_value);
+ smart_str_appends(&ctx->result, "\" />");
+ }
}
}
@@ -364,17 +378,17 @@
if(yybm[0+yych] & 128) goto yy15;
yy13: yych = *++YYCURSOR;
yy14:
-#line 263
+#line 277
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy16: if(yybm[0+yych] & 128) goto yy15;
yy17:
-#line 264
+#line 278
{ passthru(STD_ARGS); goto state_plain; }
}
-#line 265
+#line 279
state_tag:
@@ -428,11 +442,11 @@
yy20: yych = *++YYCURSOR;
goto yy25;
yy21:
-#line 270
+#line 284
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto
state_plain; else goto state_next_arg; }
yy22: yych = *++YYCURSOR;
yy23:
-#line 271
+#line 285
{ passthru(STD_ARGS); goto state_plain_begin; }
yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -440,7 +454,7 @@
yy25: if(yybm[0+yych] & 128) goto yy24;
goto yy21;
}
-#line 272
+#line 286
state_next_arg_begin:
@@ -511,20 +525,20 @@
}
yy28: yych = *++YYCURSOR;
yy29:
-#line 280
+#line 294
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
yy30: yych = *++YYCURSOR;
goto yy37;
yy31:
-#line 281
+#line 295
{ passthru(STD_ARGS); goto state_next_arg; }
yy32: yych = *++YYCURSOR;
yy33:
-#line 282
+#line 296
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
yy34: yych = *++YYCURSOR;
yy35:
-#line 283
+#line 297
{ passthru(STD_ARGS); goto state_plain_begin; }
yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -532,7 +546,7 @@
yy37: if(yybm[0+yych] & 128) goto yy36;
goto yy31;
}
-#line 284
+#line 298
state_arg:
@@ -586,11 +600,11 @@
yy40: yych = *++YYCURSOR;
goto yy45;
yy41:
-#line 289
+#line 303
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
yy42: yych = *++YYCURSOR;
yy43:
-#line 290
+#line 304
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -598,7 +612,7 @@
yy45: if(yybm[0+yych] & 128) goto yy44;
goto yy41;
}
-#line 291
+#line 305
state_before_val:
@@ -653,12 +667,12 @@
if(yych == ' ') goto yy55;
if(yych == '=') goto yy53;
yy49:
-#line 297
+#line 311
{ --YYCURSOR; goto state_next_arg_begin; }
yy50: yych = *++YYCURSOR;
goto yy54;
yy51:
-#line 296
+#line 310
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
yy52: yych = *++YYCURSOR;
goto yy49;
@@ -677,7 +691,7 @@
case 0: goto yy49;
}
}
-#line 298
+#line 312
@@ -747,7 +761,7 @@
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '>') goto yy74;
yy61:
-#line 307
+#line 321
{ passthru(STD_ARGS); goto state_next_arg_begin; }
yy62: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -756,7 +770,7 @@
yy63: yych = *++YYCURSOR;
goto yy67;
yy64:
-#line 306
+#line 320
{ handle_val(STD_ARGS, 0, '"'); goto state_next_arg_begin; }
yy65: yych = *++YYCURSOR;
goto yy61;
@@ -776,7 +790,7 @@
}
yy71: yych = *++YYCURSOR;
yy72:
-#line 305
+#line 319
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
yy73: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -785,10 +799,10 @@
if(yych >= '>') goto yy70;
yy75: yych = *++YYCURSOR;
yy76:
-#line 304
+#line 318
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
}
-#line 308
+#line 322
stop:
@@ -802,18 +816,22 @@
}
-char *url_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value,
size_t *newlen TSRMLS_DC)
+char *url_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value,
char *udata_name, char *udata_value, size_t *newlen TSRMLS_DC)
{
smart_str surl = {0};
smart_str buf = {0};
smart_str sname = {0};
smart_str sval = {0};
+ smart_str aname = {0};
+ smart_str avalue = {0};
smart_str_setl(&surl, url, urllen);
smart_str_sets(&sname, name);
smart_str_sets(&sval, value);
+ smart_str_sets(&aname, udata_name);
+ smart_str_sets(&avalue, udata_value);
- append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output);
+ append_modified_url(&surl, &buf, &sname, &sval, &aname, &avalue,
PG(arg_separator).output);
smart_str_0(&buf);
if (newlen) *newlen = buf.len;
@@ -821,7 +839,7 @@
return buf.c;
}
-char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t
*newlen, zend_bool do_flush TSRMLS_DC)
+char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, char
*udata_name, char *udata_value, size_t *newlen, zend_bool do_flush TSRMLS_DC)
{
url_adapt_state_ex_t *ctx;
char *retval;
@@ -830,6 +848,10 @@
smart_str_sets(&ctx->q_name, name);
smart_str_sets(&ctx->q_value, value);
+
+ smart_str_sets(&ctx->q_udata_name, udata_name);
+ smart_str_sets(&ctx->q_udata_value, udata_value);
+
xx_mainloop(ctx, src, srclen TSRMLS_CC);
*newlen = ctx->result.len;