Lines Matching refs:ctx
47 url_adapt_state_ex_t *ctx;
52 ctx = &BG(url_adapt_state_ex);
56 if (ctx->tags)
57 zend_hash_destroy(ctx->tags);
59 ctx->tags = malloc(sizeof(HashTable));
60 if (!ctx->tags) {
65 zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
83 zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL);
152 static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC)
156 if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0)
160 smart_str_appendc(&ctx->result, type);
162 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
164 smart_str_append(&ctx->result, &ctx->val);
167 smart_str_appendc(&ctx->result, type);
184 #define STATE ctx->state
186 #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
187 #define STD_ARGS ctx, start, xp TSRMLS_CC
198 smart_str_appendl(&ctx->result, start, YYCURSOR - start);
210 if (ctx->form_app.len > 0) {
211 switch (ctx->tag.len) {
213 if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) {
216 if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) {
217 char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len);
219 e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p);
221 e = ctx->val.c + ctx->val.len;
223 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
231 if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) {
238 smart_str_append(&ctx->result, &ctx->form_app);
254 ctx->tag.len = 0;
255 smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
256 for (i = 0; i < ctx->tag.len; i++)
257 ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]);
258 if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
265 ctx->arg.len = 0;
266 smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
271 smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
272 tag_arg(ctx, quotes, type TSRMLS_CC);
275 static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS…
282 smart_str_appendl(&ctx->buf, newdata, newlen);
284 YYCURSOR = ctx->buf.c;
285 YYLIMIT = ctx->buf.c + ctx->buf.len;
352 …scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *Y…
356 if (rest) memmove(ctx->buf.c, start, rest);
357 ctx->buf.len = rest;
385 url_adapt_state_ex_t *ctx;
388 ctx = &BG(url_adapt_state_ex);
390 xx_mainloop(ctx, src, srclen TSRMLS_CC);
392 *newlen = ctx->result.len;
393 if (!ctx->result.c) {
394 smart_str_appendl(&ctx->result, "", 0);
396 smart_str_0(&ctx->result);
398 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len);
399 *newlen += ctx->buf.len;
400 smart_str_free(&ctx->buf);
402 retval = ctx->result.c;
403 ctx->result.c = NULL;
404 ctx->result.len = 0;
410 url_adapt_state_ex_t *ctx;
412 ctx = &BG(url_adapt_state_ex);
414 memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
421 url_adapt_state_ex_t *ctx;
423 ctx = &BG(url_adapt_state_ex);
425 smart_str_free(&ctx->result);
426 smart_str_free(&ctx->buf);
427 smart_str_free(&ctx->tag);
428 smart_str_free(&ctx->arg);
445 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
446 if (ctx->buf.len) {
447 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len);
448 smart_str_appendl(&ctx->result, output, output_len);
450 *handled_output = ctx->result.c;
451 *handled_output_len = ctx->buf.len + output_len;
453 ctx->result.c = NULL;
454 ctx->result.len = 0;
455 smart_str_free(&ctx->buf);