diff --git a/c/dsl/mlr_dsl_cst_func_subr.c b/c/dsl/mlr_dsl_cst_func_subr.c index 77325e910..e038ec964 100644 --- a/c/dsl/mlr_dsl_cst_func_subr.c +++ b/c/dsl/mlr_dsl_cst_func_subr.c @@ -142,7 +142,7 @@ void mlr_dsl_cst_free_udf(cst_udf_state_t* pstate, context_t* pctx) { static boxed_xval_t cst_udf_process_callback(void* pvstate, int arity, boxed_xval_t* args, variables_t* pvars) { cst_udf_state_t* pstate = pvstate; cst_top_level_statement_block_t* ptop_level_block = pstate->ptop_level_block; - mlhmmv_xvalue_t retval = mlhmmv_xvalue_wrap_terminal(mv_absent()); + boxed_xval_t retval = box_ephemeral_val(mv_absent()); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Push stack and bind parameters to arguments @@ -180,9 +180,9 @@ static boxed_xval_t cst_udf_process_callback(void* pvstate, int arity, boxed_xva if (pvars->return_state.returned) { retval = pvars->return_state.retval; if (pstate->return_value_type_mask != TYPE_MASK_ANY) { - cst_udf_type_check_return_value(pstate, &retval); + cst_udf_type_check_return_value(pstate, &retval.xval); } - pvars->return_state.retval = mlhmmv_xvalue_wrap_terminal(mv_absent()); + pvars->return_state.retval = box_ephemeral_val(mv_absent()); pvars->return_state.returned = FALSE; break; } @@ -198,9 +198,9 @@ static boxed_xval_t cst_udf_process_callback(void* pvstate, int arity, boxed_xva if (pvars->return_state.returned) { retval = pvars->return_state.retval; if (pstate->return_value_type_mask != TYPE_MASK_ANY) { - cst_udf_type_check_return_value(pstate, &retval); + cst_udf_type_check_return_value(pstate, &retval.xval); } - pvars->return_state.retval = mlhmmv_xvalue_wrap_terminal(mv_absent()); + pvars->return_state.retval = box_ephemeral_val(mv_absent()); pvars->return_state.returned = FALSE; break; } @@ -209,7 +209,7 @@ static boxed_xval_t cst_udf_process_callback(void* pvstate, int arity, boxed_xva if (!pvars->return_state.returned) { if (pstate->return_value_type_mask != TYPE_MASK_ANY) { - cst_udf_type_check_return_value(pstate, &retval); + cst_udf_type_check_return_value(pstate, &retval.xval); } } @@ -218,7 +218,7 @@ static boxed_xval_t cst_udf_process_callback(void* pvstate, int arity, boxed_xva local_stack_subframe_exit(pframe, ptop_level_block->pblock->subframe_var_count); local_stack_frame_exit(local_stack_pop(pvars->plocal_stack)); - return box_ephemeral_xval(retval); // xxx check ephemeral, once these are boxed through the call chain + return retval; } static void cst_udf_type_check_return_value(cst_udf_state_t* pstate, mlhmmv_xvalue_t* pretval) { diff --git a/c/dsl/mlr_dsl_cst_return_statements.c b/c/dsl/mlr_dsl_cst_return_statements.c index ae7e80a8a..fec40293d 100644 --- a/c/dsl/mlr_dsl_cst_return_statements.c +++ b/c/dsl/mlr_dsl_cst_return_statements.c @@ -39,13 +39,14 @@ static void return_value_func( { return_value_state_t* pstate = pstatement->pvstate; rxval_evaluator_t* pxev = pstate->preturn_value_xevaluator; - // xxx modify the API to box the retval throughout the call-chain - boxed_xval_t boxed_retval = pxev->pprocess_func(pxev->pvstate, pvars); - if (boxed_retval.is_ephemeral) { - pvars->return_state.retval = boxed_retval.xval; + boxed_xval_t retval = pxev->pprocess_func(pxev->pvstate, pvars); + + if (retval.is_ephemeral) { + pvars->return_state.retval = retval; } else { - pvars->return_state.retval = mlhmmv_xvalue_copy(&boxed_retval.xval); + pvars->return_state.retval = box_ephemeral_xval(mlhmmv_xvalue_copy(&retval.xval)); } + pvars->return_state.returned = TRUE; } diff --git a/c/dsl/return_state.h b/c/dsl/return_state.h index d21644c5f..fad98bfc6 100644 --- a/c/dsl/return_state.h +++ b/c/dsl/return_state.h @@ -4,7 +4,7 @@ #include "containers/mlhmmv.h" typedef struct _return_state_t { - mlhmmv_xvalue_t retval; + boxed_xval_t retval; int returned; } return_state_t; diff --git a/c/mapping/mapper_put_or_filter.c b/c/mapping/mapper_put_or_filter.c index 26b5911ff..850c1f05d 100644 --- a/c/mapping/mapper_put_or_filter.c +++ b/c/mapping/mapper_put_or_filter.c @@ -504,7 +504,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi .ploop_stack = pstate->ploop_stack, .return_state = { .returned = FALSE, - .retval = mlhmmv_xvalue_wrap_terminal(mv_absent()), + .retval = box_ephemeral_val(mv_absent()), }, .trace_execution = pstate->trace_execution, .json_quote_int_keys = pstate->pwriter_opts->json_quote_int_keys, @@ -535,7 +535,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi .ploop_stack = pstate->ploop_stack, .return_state = { .returned = FALSE, - .retval = mlhmmv_xvalue_wrap_terminal(mv_absent()), + .retval = box_ephemeral_val(mv_absent()), }, .trace_execution = pstate->trace_execution, .json_quote_int_keys = pstate->pwriter_opts->json_quote_int_keys, @@ -570,7 +570,7 @@ static sllv_t* mapper_put_or_filter_process(lrec_t* pinrec, context_t* pctx, voi .ploop_stack = pstate->ploop_stack, .return_state = { .returned = FALSE, - .retval = mlhmmv_xvalue_wrap_terminal(mv_absent()), + .retval = box_ephemeral_val(mv_absent()), }, .trace_execution = pstate->trace_execution, .json_quote_int_keys = pstate->pwriter_opts->json_quote_int_keys, diff --git a/c/todo.txt b/c/todo.txt index 931eddd28..462a28c3f 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -13,8 +13,11 @@ BUGFIXES * xxxes * valgrinds * release notes -* start chain with 'then' -? median, only if quick (else 5.1.0) + +? mlr -i? + +k start chain with 'then' +k median, only if quick (else 5.1.0) ================================================================ UT FOR 5.0.0: diff --git a/doc/cookbook.html b/doc/cookbook.html index d710b98b1..59c7500e3 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -607,33 +607,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000032902 -3 3 5 0.000014067 -4 5 9 0.000016928 -5 8 15 0.000024080 -6 13 25 0.000031948 -7 21 41 0.000048161 -8 34 67 0.000074863 -9 55 109 0.000117064 -10 89 177 0.000192881 -11 144 287 0.000282049 -12 233 465 0.000476122 -13 377 753 0.000766039 -14 610 1219 0.001500845 -15 987 1973 0.001886129 -16 1597 3193 0.003160954 -17 2584 5167 0.006124020 -18 4181 8361 0.008030891 -19 6765 13529 0.014431000 -20 10946 21891 0.020816088 -21 17711 35421 0.038719893 -22 28657 57313 0.057912111 -23 46368 92735 0.094176054 -24 75025 150049 0.150635004 -25 121393 242785 0.236346006 -26 196418 392835 0.385300875 -27 317811 635621 0.623147011 -28 514229 1028457 0.982747078 +2 2 3 0.000034094 +3 3 5 0.000022888 +4 5 9 0.000015974 +5 8 15 0.000022173 +6 13 25 0.000030994 +7 21 41 0.000046968 +8 34 67 0.000072002 +9 55 109 0.000114918 +10 89 177 0.000198126 +11 144 287 0.000288010 +12 233 465 0.000456810 +13 377 753 0.000729084 +14 610 1219 0.001229048 +15 987 1973 0.001889944 +16 1597 3193 0.002962112 +17 2584 5167 0.005040884 +18 4181 8361 0.008141041 +19 6765 13529 0.013772964 +20 10946 21891 0.025915146 +21 17711 35421 0.035820961 +22 28657 57313 0.055882931 +23 46368 92735 0.089221001 +24 75025 150049 0.142101049 +25 121393 242785 0.227752924 +26 196418 392835 0.379987001 +27 317811 635621 0.643369913 +28 514229 1028457 0.958025217

@@ -665,33 +665,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000034809 +2 2 3 0.000036001 3 3 3 0.000014067 -4 5 3 0.000011921 -5 8 3 0.000012159 +4 5 3 0.000010967 +5 8 3 0.000010967 6 13 3 0.000010967 7 21 3 0.000010967 -8 34 3 0.000011921 -9 55 3 0.000010967 -10 89 3 0.000013113 -11 144 3 0.000010967 -12 233 3 0.000015020 +8 34 3 0.000010967 +9 55 3 0.000010014 +10 89 3 0.000012159 +11 144 3 0.000011921 +12 233 3 0.000014067 13 377 3 0.000010967 14 610 3 0.000010967 -15 987 3 0.000010967 -16 1597 3 0.000011206 -17 2584 3 0.000010967 -18 4181 3 0.000010967 -19 6765 3 0.000010967 -20 10946 3 0.000010014 -21 17711 3 0.000010967 -22 28657 3 0.000010967 -23 46368 3 0.000013113 -24 75025 3 0.000010967 -25 121393 3 0.000010967 -26 196418 3 0.000010967 -27 317811 3 0.000010967 -28 514229 3 0.000010967 +15 987 3 0.000020981 +16 1597 3 0.000011921 +17 2584 3 0.000013113 +18 4181 3 0.000012875 +19 6765 3 0.000012159 +20 10946 3 0.000012875 +21 17711 3 0.000013113 +22 28657 3 0.000011921 +23 46368 3 0.000015974 +24 75025 3 0.000013113 +25 121393 3 0.000013828 +26 196418 3 0.000014067 +27 317811 3 0.000013113 +28 514229 3 0.000012875

diff --git a/doc/manpage.html b/doc/manpage.html index 74838f660..7fd7d554f 100644 --- a/doc/manpage.html +++ b/doc/manpage.html @@ -2006,7 +2006,7 @@ SEE ALSO - 2017-02-10 MILLER(1) + 2017-02-13 MILLER(1)

diff --git a/doc/manpage.txt b/doc/manpage.txt index d0cc9a5ee..6c1d034ad 100644 --- a/doc/manpage.txt +++ b/doc/manpage.txt @@ -1857,4 +1857,4 @@ SEE ALSO - 2017-02-10 MILLER(1) + 2017-02-13 MILLER(1) diff --git a/doc/mlr.1 b/doc/mlr.1 index 913265b46..10423680f 100644 --- a/doc/mlr.1 +++ b/doc/mlr.1 @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2017-02-10 +.\" Date: 2017-02-13 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2017-02-10" "\ \&" "\ \&" +.TH "MILLER" "1" "2017-02-13" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~