• Home
  • Raw
  • Download

Lines Matching refs:aux

20   JQP_AUX *aux = yy->aux;  in _jqp_fatal()  local
21 aux->rc = rc; in _jqp_fatal()
22 longjmp(aux->fatal_jmp, 1); in _jqp_fatal()
28 JQP_AUX *aux = yy->aux; in _jqp_malloc() local
29 aux->rc = iwrc_set_errno(IW_ERROR_ALLOC, errno); in _jqp_malloc()
30 longjmp(aux->fatal_jmp, 1); in _jqp_malloc()
38 JQP_AUX *aux = yy->aux; in _jqp_realloc() local
39 aux->rc = iwrc_set_errno(IW_ERROR_ALLOC, errno); in _jqp_realloc()
40 longjmp(aux->fatal_jmp, 1); in _jqp_realloc()
45 static iwrc _jqp_aux_set_input(JQP_AUX *aux, const char *input) { in _jqp_aux_set_input() argument
47 char *buf = iwpool_alloc(len, aux->pool); in _jqp_aux_set_input()
52 aux->buf = buf; in _jqp_aux_set_input()
60 char *ret = iwpool_strdup(yy->aux->pool, text, &rc); in _jqp_strdup()
66 JQPUNIT *ret = iwpool_calloc(sizeof(JQPUNIT), yy->aux->pool); in _jqp_unit()
74 JQP_AUX *aux = yy->aux; in _jqp_push() local
76 if (aux->stackn < (sizeof(aux->stackpool) / sizeof(aux->stackpool[0]))) { in _jqp_push()
77 stack = &aux->stackpool[aux->stackn++]; in _jqp_push()
79 stack = malloc(sizeof(*aux->stack)); in _jqp_push()
83 aux->stackn++; in _jqp_push()
87 if (!aux->stack) { in _jqp_push()
90 aux->stack->next = stack; in _jqp_push()
91 stack->prev = aux->stack; in _jqp_push()
93 aux->stack = stack; in _jqp_push()
94 return aux->stack; in _jqp_push()
98 JQP_AUX *aux = yy->aux; in _jqp_pop() local
99 JQP_STACK *stack = aux->stack, ret; in _jqp_pop()
100 if (!stack || (aux->stackn < 1)) { in _jqp_pop()
104 aux->stack = stack->prev; in _jqp_pop()
105 if (aux->stack) { in _jqp_pop()
106 aux->stack->next = 0; in _jqp_pop()
111 if (aux->stackn-- > (sizeof(aux->stackpool) / sizeof(aux->stackpool[0]))) { in _jqp_pop()
138 JQP_AUX *aux = yy->aux; in _jqp_string_push() local
139 stack->str = iwpool_strdup(aux->pool, stack->str, &rc); in _jqp_string_push()
211 JQP_AUX *aux = yy->aux; in _jqp_placeholder() local
218 int len = iwitoa(aux->num_placeholders++, nbuf + 1, JBNUMBUF_SIZE); in _jqp_placeholder()
224 if (!aux->start_placeholder) { in _jqp_placeholder()
225 aux->start_placeholder = &unit->string; in _jqp_placeholder()
226 aux->end_placeholder = aux->start_placeholder; in _jqp_placeholder()
228 aux->end_placeholder->placeholder_next = &unit->string; in _jqp_placeholder()
229 aux->end_placeholder = aux->end_placeholder->placeholder_next; in _jqp_placeholder()
349 JQP_AUX *aux = yy->aux; in _jqp_unescaped_string() local
353 int len = _jqp_unescape_json_string(text, 0, 0, &aux->rc); in _jqp_unescaped_string()
354 if (aux->rc) { in _jqp_unescaped_string()
355 JQRC(yy, aux->rc); // -V547 in _jqp_unescaped_string()
357 char *dest = iwpool_alloc(len + 1, aux->pool); in _jqp_unescaped_string()
361 _jqp_unescape_json_string(text, dest, len, &aux->rc); in _jqp_unescaped_string()
362 if (aux->rc) { in _jqp_unescaped_string()
363 JQRC(yy, aux->rc); // -V547 in _jqp_unescaped_string()
371 JQP_AUX *aux = yy->aux; in _jqp_json_string() local
375 int len = _jqp_unescape_json_string(text, 0, 0, &aux->rc); in _jqp_json_string()
376 if (aux->rc) { in _jqp_json_string()
377 JQRC(yy, aux->rc); // -V547 in _jqp_json_string()
379 char *dest = iwpool_alloc(len + 1, aux->pool); in _jqp_json_string()
383 _jqp_unescape_json_string(text, dest, len, &aux->rc); in _jqp_json_string()
384 if (aux->rc) { in _jqp_json_string()
385 JQRC(yy, aux->rc); // -V547 in _jqp_json_string()
404 JQP_AUX *aux = yy->aux; in _jqp_json_collect() local
409 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_json_collect()
410 JQPUNIT *unit = aux->stack->unit; in _jqp_json_collect()
453 yy->aux->negate = true; in _jqp_op_negate()
457 yy->aux->negate = false; in _jqp_op_negate_reset()
461 JQP_AUX *aux = yy->aux; in _jqp_unit_op() local
464 unit->op.negate = aux->negate; in _jqp_unit_op()
465 aux->negate = false; in _jqp_unit_op()
488 if (!aux->start_op) { in _jqp_unit_op()
489 aux->start_op = &unit->op; in _jqp_unit_op()
490 aux->end_op = aux->start_op; in _jqp_unit_op()
492 aux->end_op->next = &unit->op; in _jqp_unit_op()
493 aux->end_op = aux->end_op->next; in _jqp_unit_op()
499 JQP_AUX *aux = yy->aux; in _jqp_unit_join() local
502 unit->join.negate = aux->negate; in _jqp_unit_join()
503 aux->negate = false; in _jqp_unit_join()
531 JQP_AUX *aux = yy->aux; in _jqp_pop_expr_chain() local
532 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_expr_chain()
533 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_expr_chain()
567 JQP_AUX *aux = yy->aux; in _jqp_pop_projection_nodes() local
570 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_projection_nodes()
571 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_projection_nodes()
603 JQP_AUX *aux = yy->aux; in _jqp_push_joined_projection() local
604 if (!aux->stack || (aux->stack->type != STACK_STRING)) { in _jqp_push_joined_projection()
608 if (aux->stack->str[0] == '-') { in _jqp_push_joined_projection()
619 JQP_AUX *aux = yy->aux; in _jqp_pop_joined_projections() local
620 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_joined_projections()
621 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_joined_projections()
640 JQP_AUX *aux = yy->aux; in _jqp_pop_projfields_chain() local
641 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_projfields_chain()
642 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_projfields_chain()
665 JQP_AUX *aux = yy->aux; in _jqp_pop_ordernodes() local
666 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_ordernodes()
667 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_ordernodes()
709 JQP_AUX *aux = yy->aux; in _jqp_pop_node_chain() local
710 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_node_chain()
711 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_node_chain()
732 if ( aux->stack in _jqp_pop_node_chain()
733 && (aux->stack->type == STACK_UNIT) in _jqp_pop_node_chain()
734 && (aux->stack->unit->type == JQP_STRING_TYPE) in _jqp_pop_node_chain()
735 && (aux->stack->unit->string.flavour & JQP_STR_ANCHOR)) { in _jqp_pop_node_chain()
737 if (!aux->first_anchor) { in _jqp_pop_node_chain()
738 aux->first_anchor = filter->filter.anchor; in _jqp_pop_node_chain()
746 JQP_AUX *aux = yy->aux; in _jqp_pop_filter_factor_chain() local
748 while (aux->stack && aux->stack->type == STACK_UNIT) { in _jqp_pop_filter_factor_chain()
749 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_filter_factor_chain()
773 JQP_AUX *aux = yy->aux; in _jqp_set_filters_expr() local
780 query->query.aux = aux; in _jqp_set_filters_expr()
781 aux->expr = &expr->exprnode; in _jqp_set_filters_expr()
782 aux->query = &query->query; in _jqp_set_filters_expr()
786 JQP_AUX *aux = yy->aux; in _jqp_create_filterexpr_pk() local
789 if ( aux->stack in _jqp_create_filterexpr_pk()
790 && (aux->stack->type == STACK_UNIT) in _jqp_create_filterexpr_pk()
791 && (aux->stack->unit->type == JQP_STRING_TYPE) in _jqp_create_filterexpr_pk()
792 && (aux->stack->unit->string.flavour & JQP_STR_ANCHOR)) { in _jqp_create_filterexpr_pk()
794 if (!aux->first_anchor) { in _jqp_create_filterexpr_pk()
795 aux->first_anchor = anchor; in _jqp_create_filterexpr_pk()
808 JQP_AUX *aux = yy->aux; in _jqp_set_apply() local
809 if (!unit || !aux->query) { in _jqp_set_apply()
814 aux->apply = &unit->json.jn; in _jqp_set_apply()
815 aux->apply_placeholder = 0; in _jqp_set_apply()
817 aux->apply_placeholder = unit->string.value; in _jqp_set_apply()
818 aux->apply = 0; in _jqp_set_apply()
826 JQP_AUX *aux = yy->aux; in _jqp_set_apply_delete() local
827 aux->qmode |= JQP_QRY_APPLY_DEL; in _jqp_set_apply_delete()
831 JQP_AUX *aux = yy->aux; in _jqp_set_apply_upsert() local
832 aux->qmode |= JQP_QRY_APPLY_UPSERT; in _jqp_set_apply_upsert()
837 JQP_AUX *aux = yy->aux; in _jqp_add_orderby() local
842 if (!aux->orderby) { in _jqp_add_orderby()
843 aux->orderby = &unit->string; in _jqp_add_orderby()
845 aux->orderby->next = &unit->string; in _jqp_add_orderby()
850 JQP_AUX *aux = yy->aux; in _jqp_set_skip() local
856 if (aux->skip) { in _jqp_set_skip()
859 aux->skip = unit; in _jqp_set_skip()
863 JQP_AUX *aux = yy->aux; in _jqp_set_limit() local
869 if (aux->limit) { in _jqp_set_limit()
872 aux->limit = unit; in _jqp_set_limit()
876 JQP_AUX *aux = yy->aux; in _jqp_set_aggregate_count() local
877 aux->qmode |= JQP_QRY_COUNT; in _jqp_set_aggregate_count()
878 aux->projection = 0; // No projections in aggregate mode in _jqp_set_aggregate_count()
882 JQP_AUX *aux = yy->aux; in _jqp_set_noidx() local
883 aux->qmode |= JQP_QRY_NOIDX; in _jqp_set_noidx()
887 JQP_AUX *aux = yy->aux; in _jqp_set_inverse() local
888 aux->qmode |= (JQP_QRY_NOIDX | JQP_QRY_INVERSE); in _jqp_set_inverse()
892 JQP_AUX *aux = yy->aux; in _jqp_set_projection() local
893 if (!unit || !aux->query) { in _jqp_set_projection()
902 aux->has_exclude_all_projection = true; in _jqp_set_projection()
907 } else if (!aux->has_keep_projections && (p->flags & JQP_PROJECTION_FLAG_INCLUDE)) { in _jqp_set_projection()
908 aux->has_keep_projections = true; in _jqp_set_projection()
911 aux->projection = proj; in _jqp_set_projection()
922 JQP_AUX *aux = yy->aux; in _jqp_finish() local
924 JQP_STRING *orderby = aux->orderby; in _jqp_finish()
931 aux->orderby_num = cnt; in _jqp_finish()
933 aux->orderby_ptrs = iwpool_alloc(cnt * sizeof(JBL_PTR), aux->pool); in _jqp_finish()
934 if (!aux->orderby_ptrs) { in _jqp_finish()
944 orderby = aux->orderby; in _jqp_finish()
952 rc = jbl_ptr_alloc_pool(iwxstr_ptr(xstr), &aux->orderby_ptrs[cnt], aux->pool); in _jqp_finish()
954 JBL_PTR ptr = aux->orderby_ptrs[cnt]; in _jqp_finish()
965 aux->orderby_num = 0; in _jqp_finish()
976 JQP_AUX *aux = *auxp; in jqp_aux_create() local
977 aux->xerr = iwxstr_new(); in jqp_aux_create()
978 if (!aux->xerr) { in jqp_aux_create()
982 aux->pool = iwpool_create(4 * 1024); in jqp_aux_create()
983 if (!aux->pool) { in jqp_aux_create()
987 rc = _jqp_aux_set_input(aux, input); in jqp_aux_create()
997 JQP_AUX *aux = *auxp; in jqp_aux_destroy() local
998 if (aux) { in jqp_aux_destroy()
1000 if (aux->pool) { in jqp_aux_destroy()
1001 iwpool_destroy(aux->pool); in jqp_aux_destroy()
1003 if (aux->xerr) { in jqp_aux_destroy()
1004 iwxstr_destroy(aux->xerr); in jqp_aux_destroy()
1006 free(aux); in jqp_aux_destroy()
1015 JQP_AUX *aux = yy->aux; in yyerror() local
1016 IWXSTR *xerr = aux->xerr; in yyerror()
1034 iwrc jqp_parse(JQP_AUX *aux) { in jqp_parse() argument
1036 yy.aux = aux; in jqp_parse()
1037 if (setjmp(aux->fatal_jmp)) { in jqp_parse()
1038 if (aux->rc) { in jqp_parse()
1039 iwlog_ecode_error3(aux->rc); in jqp_parse()
1044 if (!aux->rc) { in jqp_parse()
1045 aux->rc = JQL_ERROR_QUERY_PARSE; in jqp_parse()
1048 if (iwxstr_size(aux->xerr) && !(aux->mode & JQL_SILENT_ON_PARSE_ERROR)) { in jqp_parse()
1050 iwxstr_unshift(aux->xerr, prefix, strlen(prefix)); in jqp_parse()
1051 iwlog_error("%s\n", iwxstr_ptr(aux->xerr)); in jqp_parse()
1057 return aux->rc; in jqp_parse()
1109 if (q->aux->qmode & JQP_QRY_APPLY_DEL) { in _jqp_print_apply()
1112 if (q->aux->qmode & JQP_QRY_APPLY_UPSERT) { in _jqp_print_apply()
1117 if (q->aux->apply_placeholder) { in _jqp_print_apply()
1118 PT(q->aux->apply_placeholder, -1, 0, 0); in _jqp_print_apply()
1119 } else if (q->aux->apply) { in _jqp_print_apply()
1120 rc = jbn_as_json(q->aux->apply, pt, op, 0); in _jqp_print_apply()
1280 bool inbraces = (en != q->aux->expr && en->type == JQP_EXPR_NODE_TYPE); in _jqp_print_expression_node()
1338 JQP_AUX *aux = q->aux; in _jqp_print_opts() local
1340 JQP_STRING *ob = aux->orderby; in _jqp_print_opts()
1363 if (aux->skip || aux->limit) { in _jqp_print_opts()
1368 if (aux->skip) { in _jqp_print_opts()
1370 if (aux->skip->type == JQP_STRING_TYPE) { in _jqp_print_opts()
1371 if (aux->skip->string.flavour & JQP_STR_PLACEHOLDER) { in _jqp_print_opts()
1372 rc = _print_placeholder(aux->skip->string.value, pt, op); in _jqp_print_opts()
1375 PT(aux->skip->string.value, -1, 0, 0); in _jqp_print_opts()
1377 } else if (aux->skip->type == JQP_INTEGER_TYPE) { in _jqp_print_opts()
1379 iwitoa(aux->skip->intval.value, nbuf, JBNUMBUF_SIZE); in _jqp_print_opts()
1383 if (aux->limit) { in _jqp_print_opts()
1385 if (aux->limit->type == JQP_STRING_TYPE) { in _jqp_print_opts()
1386 if (aux->limit->string.flavour & JQP_STR_PLACEHOLDER) { in _jqp_print_opts()
1387 rc = _print_placeholder(aux->limit->string.value, pt, op); in _jqp_print_opts()
1390 PT(aux->limit->string.value, -1, 0, 0); in _jqp_print_opts()
1392 } else if (aux->limit->type == JQP_INTEGER_TYPE) { in _jqp_print_opts()
1394 iwitoa(aux->limit->intval.value, nbuf, JBNUMBUF_SIZE); in _jqp_print_opts()
1405 JQP_AUX *aux = q->aux; in jqp_print_query() local
1406 iwrc rc = _jqp_print_expression_node(q, aux->expr, pt, op); in jqp_print_query()
1408 if (aux->apply_placeholder || aux->apply) { in jqp_print_query()
1413 if (aux->projection) { in jqp_print_query()
1415 rc = _jqp_print_projection(aux->projection, pt, op); in jqp_print_query()
1418 if (aux->skip || aux->limit || aux->orderby) { in jqp_print_query()