Index: trunk/src_plugins/drc_query/dlg.c =================================================================== --- trunk/src_plugins/drc_query/dlg.c (revision 30454) +++ trunk/src_plugins/drc_query/dlg.c (revision 30455) @@ -125,7 +125,7 @@ pcb_view_list_t *view = calloc(sizeof(pcb_view_list_t), 1); pcb_board_t *pcb = (pcb_board_t *)pcb_gui->get_dad_hidlib(hid_ctx); - drc_qry_exec(pcb, view, ctx->rule, + drc_qry_exec(NULL, pcb, view, ctx->rule, ctx->dlg[ctx->wtype].val.str, ctx->dlg[ctx->wtitle].val.str, ctx->dlg[ctx->wdesc].val.str, @@ -505,7 +505,7 @@ } view = calloc(sizeof(pcb_view_list_t), 1); - drc_qry_exec(pcb, view, row->cell[0], textval(nd, "type"), textval(nd, "title"), textval(nd, "desc"), script); + drc_qry_exec(NULL, pcb, view, row->cell[0], textval(nd, "type"), textval(nd, "title"), textval(nd, "desc"), script); drcq_open_view_win(&pcb->hidlib, view); drc_rlist_pcb2dlg(); /* for the run time */ } Index: trunk/src_plugins/drc_query/drc_query.c =================================================================== --- trunk/src_plugins/drc_query/drc_query.c (revision 30454) +++ trunk/src_plugins/drc_query/drc_query.c (revision 30455) @@ -133,7 +133,7 @@ qctx->hit_cnt++; } -static long drc_qry_exec(pcb_board_t *pcb, pcb_view_list_t *lst, const char *name, const char *type, const char *title, const char *desc, const char *query) +static long drc_qry_exec(pcb_qry_exec_t *ec, pcb_board_t *pcb, pcb_view_list_t *lst, const char *name, const char *type, const char *title, const char *desc, const char *query) { const char *scope = NULL; drc_qry_ctx_t qctx; @@ -158,7 +158,7 @@ st = pcb_drcq_stat_get(name); ts = pcb_dtime(); - pcb_qry_run_script(pcb, query, scope, drc_qry_exec_cb, &qctx); + pcb_qry_run_script(ec, pcb, query, scope, drc_qry_exec_cb, &qctx); te = pcb_dtime(); st->last_run_time = te - ts; @@ -256,7 +256,7 @@ if ((dis != NULL) && (*dis != 0)) continue; - cnt += drc_qry_exec((pcb_board_t *)hidlib, &pcb_drc_lst, i->name, + cnt += drc_qry_exec(NULL, (pcb_board_t *)hidlib, &pcb_drc_lst, i->name, load_str(rule, i, "type"), load_str(rule, i, "title"), load_str(rule, i, "desc"), load_str(rule, i, "query") ); Index: trunk/src_plugins/query/query.h =================================================================== --- trunk/src_plugins/query/query.h (revision 30454) +++ trunk/src_plugins/query/query.h (revision 30455) @@ -184,7 +184,7 @@ /* Compile and execute a script, calling cb for each object. Returns the number of evaluation errors or -1 if evaluation couldn't start */ -int pcb_qry_run_script(pcb_board_t *pcb, const char *script, const char *scope, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx); +int pcb_qry_run_script(pcb_qry_exec_t *ec, pcb_board_t *pcb, const char *script, const char *scope, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx); /*** drc list-reports ***/ Index: trunk/src_plugins/query/query_act.c =================================================================== --- trunk/src_plugins/query/query_act.c (revision 30454) +++ trunk/src_plugins/query/query_act.c (revision 30455) @@ -153,7 +153,7 @@ pcb_view_list_append(view, v); } -int pcb_qry_run_script(pcb_board_t *pcb, const char *script, const char *scope, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx) +int pcb_qry_run_script(pcb_qry_exec_t *ec, pcb_board_t *pcb, const char *script, const char *scope, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx) { pcb_qry_node_t *prg = NULL; int bufno = -1; /* empty scope means board */ @@ -198,7 +198,7 @@ return -1; } } - return pcb_qry_run(pcb, prg, bufno, cb, user_ctx); + return pcb_qry_run(ec, pcb, prg, bufno, cb, user_ctx); } static fgw_error_t pcb_act_query(fgw_arg_t *res, int argc, fgw_arg_t *argv) @@ -239,7 +239,7 @@ memset(&st, 0, sizeof(st)); st.print_idpath = (cmd[4] != '\0'); printf("Script eval: '%s' scope='%s'\n", arg, scope == NULL ? "" : scope); - errs = pcb_qry_run_script(PCB_ACT_BOARD, arg, scope, eval_cb, &st); + errs = pcb_qry_run_script(NULL, PCB_ACT_BOARD, arg, scope, eval_cb, &st); if (errs < 0) printf("Failed to run the query\n"); @@ -266,7 +266,7 @@ PCB_ACT_MAY_CONVARG(2, FGW_STR, query, arg = argv[2].val.str); PCB_ACT_MAY_CONVARG(3, FGW_STR, query, scope = argv[3].val.str); - if (pcb_qry_run_script(PCB_ACT_BOARD, arg, scope, flagop_cb, &sel) < 0) + if (pcb_qry_run_script(NULL, PCB_ACT_BOARD, arg, scope, flagop_cb, &sel) < 0) printf("Failed to run the query\n"); if (sel.cnt > 0) { pcb_board_set_changed_flag(pcb_true); @@ -294,7 +294,7 @@ PCB_ACT_MAY_CONVARG(2, FGW_STR, query, arg = argv[2].val.str); PCB_ACT_MAY_CONVARG(3, FGW_STR, query, scope = argv[3].val.str); - if (pcb_qry_run_script(PCB_ACT_BOARD, arg, scope, flagop_cb, &sel) < 0) + if (pcb_qry_run_script(NULL, PCB_ACT_BOARD, arg, scope, flagop_cb, &sel) < 0) printf("Failed to run the query\n"); if (sel.cnt > 0) { pcb_board_set_changed_flag(pcb_true); @@ -315,7 +315,7 @@ if (!fgw_ptr_in_domain(&pcb_fgw, &argv[2], PCB_PTR_DOMAIN_IDPATH_LIST)) return FGW_ERR_PTR_DOMAIN; - if (pcb_qry_run_script(PCB_ACT_BOARD, arg, scope, append_cb, list) < 0) + if (pcb_qry_run_script(NULL, PCB_ACT_BOARD, arg, scope, append_cb, list) < 0) PCB_ACT_IRES(1); else PCB_ACT_IRES(0); @@ -326,7 +326,7 @@ fgw_arg_t args[4], ares; pcb_view_list_t *view = calloc(sizeof(pcb_view_list_t), 1); PCB_ACT_MAY_CONVARG(2, FGW_STR, query, arg = argv[2].val.str); - if (pcb_qry_run_script(PCB_ACT_BOARD, arg, scope, view_cb, view) >= 0) { + if (pcb_qry_run_script(NULL, PCB_ACT_BOARD, arg, scope, view_cb, view) >= 0) { args[1].type = FGW_STR; args[1].val.str = "advanced search results"; args[2].type = FGW_STR; args[2].val.str = "search_res"; fgw_ptr_reg(&pcb_fgw, &args[3], PCB_PTR_DOMAIN_VIEWLIST, FGW_PTR | FGW_STRUCT, view); Index: trunk/src_plugins/query/query_exec.c =================================================================== --- trunk/src_plugins/query/query_exec.c (revision 30454) +++ trunk/src_plugins/query/query_exec.c (revision 30455) @@ -159,7 +159,7 @@ ctx->iter->idx[vi] = 0; } -int pcb_qry_run(pcb_board_t *pcb, pcb_qry_node_t *prg, int bufno, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx) +int pcb_qry_run(pcb_qry_exec_t *ec_in, pcb_board_t *pcb, pcb_qry_node_t *prg, int bufno, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx) { int ret = 0, r; pcb_qry_exec_t ec; Index: trunk/src_plugins/query/query_exec.h =================================================================== --- trunk/src_plugins/query/query_exec.h (revision 30454) +++ trunk/src_plugins/query/query_exec.h (revision 30455) @@ -50,7 +50,7 @@ void pcb_qry_uninit(pcb_qry_exec_t *ctx); /* Execute an expression or a rule */ -int pcb_qry_run(pcb_board_t *pcb, pcb_qry_node_t *prg, int bufno, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx); +int pcb_qry_run(pcb_qry_exec_t *ec, pcb_board_t *pcb, pcb_qry_node_t *prg, int bufno, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_any_obj_t *current), void *user_ctx); int pcb_qry_is_true(pcb_qry_val_t *val);