Lines Matching refs:ctx
2 %extra_argument {config_t *ctx}
46 static void configparser_push(config_t *ctx, data_config *dc, int isnew) { in configparser_push() argument
48 dc->context_ndx = ctx->all_configs->used; in configparser_push()
49 force_assert(dc->context_ndx > ctx->current->context_ndx); in configparser_push()
50 array_insert_unique(ctx->all_configs, (data_unset *)dc); in configparser_push()
51 dc->parent = ctx->current; in configparser_push()
54 if (ctx->configs_stack.used > 0 && ctx->current->context_ndx == 0) { in configparser_push()
58 configparser_push_data_config_list(&ctx->configs_stack, ctx->current); in configparser_push()
59 ctx->current = dc; in configparser_push()
62 static data_config *configparser_pop(config_t *ctx) { in configparser_pop() argument
63 data_config *old = ctx->current; in configparser_pop()
64 force_assert(ctx->configs_stack.used); in configparser_pop()
65 ctx->current = ctx->configs_stack.data[--ctx->configs_stack.used]; in configparser_pop()
66 force_assert(old && ctx->current); in configparser_pop()
71 static data_unset *configparser_get_variable(config_t *ctx, const buffer *key) { in configparser_get_variable() argument
78 for (dc = ctx->current; dc; dc = dc->parent) { in configparser_get_variable()
241 configparser_parse_condition(config_t * const ctx, const buffer * const obj_tag, const buffer * con… in configparser_parse_condition() argument
260 const uint32_t comp_offset = buffer_clen(&ctx->current->key)+3; in configparser_parse_condition()
261 buffer * const tb = ctx->srv->tmp_buf; in configparser_parse_condition()
264 { BUF_PTR_LEN(&ctx->current->key) } in configparser_parse_condition()
279 if (NULL != (dc = configparser_get_data_config(ctx->all_configs, in configparser_parse_condition()
281 configparser_push(ctx, dc, 0); in configparser_parse_condition()
294 ctx->ok = 0; in configparser_parse_condition()
311 ctx->ok = 0; in configparser_parse_condition()
321 ctx->ok = 0; in configparser_parse_condition()
332 ctx->ok = 0; in configparser_parse_condition()
343 if (ctx->ok) in configparser_parse_condition()
344 configparser_push(ctx, dc, 1); in configparser_parse_condition()
351 configparser_parse_else_condition(config_t * const ctx) in configparser_parse_else_condition() argument
355 buffer_append_str2(&dc->key, BUF_PTR_LEN(&ctx->current->key), in configparser_parse_else_condition()
358 configparser_push(ctx, dc, 1); in configparser_parse_else_condition()
364 ctx->ok = 0;
399 %token_destructor { buffer_free($$); UNUSED(ctx); }
402 if (ctx->ok) { in key()
406 ctx->current->context_ndx, in key()
407 ctx->current->key.ptr, A->ptr); in key()
408 ctx->ok = 0; in key()
409 } else if (NULL == array_get_element_klen(ctx->current->value, BUF_PTR_LEN(&B->key))) { in key()
410 array_insert_unique(ctx->current->value, B); in key()
414 ctx->current->context_ndx, in key()
415 ctx->current->key.ptr, B->key.ptr); in key()
416 ctx->ok = 0; in key()
426 if (ctx->ok) { in key()
429 ctx->current->context_ndx, in key()
430 ctx->current->key.ptr, A->ptr); in key()
431 ctx->ok = 0; in key()
434 array_replace(ctx->current->value, B); in key()
445 if (ctx->ok) { in key()
446 array *vars = ctx->current->value; in key()
451 ctx->current->context_ndx, in key()
452 ctx->current->key.ptr, A->ptr); in key()
453 ctx->ok = 0; in key()
454 …_extract_element_klen(vars, BUF_PTR_LEN(A))) || NULL != (du = configparser_get_variable(ctx, A))) { in key()
457 ctx->ok = 0; in key()
461 array_insert_unique(ctx->current->value, du); in key()
465 array_insert_unique(ctx->current->value, B); in key()
489 if (ctx->ok) { in expression()
493 ctx->ok = 0; in expression()
509 if (ctx->ok) { in value()
521 ctx->ok = 0; in value()
523 } else if (NULL == (A = configparser_get_variable(ctx, B))) { in value()
525 ctx->ok = 0; in value()
549 ctx->ok = 0; in value()
571 if (ctx->ok) { in aelements()
579 ctx->ok = 0; in aelements()
598 if (ctx->ok) { in aelements()
613 if (ctx->ok) { in aelement()
630 dc = configparser_get_data_config(ctx->srv->config_context, CONST_STR_LEN("global"));
632 configparser_push(ctx, dc, 0);
636 configparser_pop(ctx);
641 if (ctx->ok) { in condlines()
644 ctx->ok = 0; in condlines()
648 ctx->ok = 0; in condlines()
660 if (ctx->ok) { in condlines()
663 ctx->ok = 0; in condlines()
667 ctx->ok = 0; in condlines()
670 if (ctx->ok) { in condlines()
673 dc = (data_config *)array_extract_element_klen(ctx->all_configs, BUF_PTR_LEN(&C->key)); in condlines()
710 if (NULL == (dc = configparser_get_data_config(ctx->all_configs, BUF_PTR_LEN(&C->key)))) { in condlines()
712 array_insert_unique(ctx->all_configs, (data_unset *)C); in condlines()
717 ctx->ok = 0; in condlines()
735 if (ctx->ok) { in condline()
736 A = configparser_pop(ctx); in condline()
742 if (ctx->ok) { in cond_else()
743 A = configparser_pop(ctx); in cond_else()
749 if (ctx->ok && D->type != TYPE_STRING) { in SRVVARNAME()
751 ctx->ok = 0; in SRVVARNAME()
754 if (ctx->ok) { in SRVVARNAME()
755 configparser_parse_condition(ctx, B, C, E, &((data_string *)D)->value); in SRVVARNAME()
767 if (ctx->ok) {
768 configparser_parse_else_condition(ctx);
793 if (ctx->ok) { in stringop()
801 ctx->ok = 0; in stringop()
809 if (ctx->ok) { in stringop()
810 if (0 != config_parse_file(ctx->srv, ctx, A->ptr)) { in stringop()
811 ctx->ok = 0; in stringop()
819 if (ctx->ok) { in stringop()
820 if (0 != config_parse_cmd(ctx->srv, ctx, A->ptr)) { in stringop()
821 ctx->ok = 0; in stringop()