mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-26 17:28:13 +00:00
neaten
This commit is contained in:
parent
5c3928244e
commit
a1e6e544aa
13 changed files with 33 additions and 32 deletions
|
|
@ -98,7 +98,7 @@ local_stack_frame_t* local_stack_pop(local_stack_t* pstack) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
mv_t local_stack_frame_get_terminal_from_indexed(local_stack_frame_t* pframe, // xxx rename
|
||||
mv_t local_stack_frame_ref_terminal_from_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys)
|
||||
{
|
||||
LOCAL_STACK_TRACE(printf("LOCAL STACK FRAME %p GET %d\n", pframe, vardef_frame_relative_index));
|
||||
|
|
@ -147,7 +147,7 @@ mv_t local_stack_frame_get_terminal_from_indexed(local_stack_frame_t* pframe, //
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
mlhmmv_xvalue_t* local_stack_frame_get_extended_from_indexed(local_stack_frame_t* pframe, // xxx rename w/ 'reference' in name
|
||||
mlhmmv_xvalue_t* local_stack_frame_ref_extended_from_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys)
|
||||
{
|
||||
LOCAL_STACK_TRACE(printf("LOCAL STACK FRAME %p GET %d\n", pframe, vardef_frame_relative_index));
|
||||
|
|
@ -289,7 +289,7 @@ void local_stack_frame_assign_extended_nonindexed(local_stack_frame_t* pframe,
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
void local_stack_frame_assign_extended_indexed(local_stack_frame_t* pframe, // xxx rename
|
||||
void local_stack_frame_assign_extended_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys,
|
||||
mlhmmv_xvalue_t new_value) // xxx by ptr
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@ static inline void local_stack_frame_assign_terminal_nonindexed(local_stack_fram
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
mv_t local_stack_frame_get_terminal_from_indexed(local_stack_frame_t* pframe,
|
||||
mv_t local_stack_frame_ref_terminal_from_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys);
|
||||
|
||||
mlhmmv_xvalue_t* local_stack_frame_get_extended_from_indexed(local_stack_frame_t* pframe,
|
||||
mlhmmv_xvalue_t* local_stack_frame_ref_extended_from_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys);
|
||||
|
||||
void local_stack_frame_define_terminal(local_stack_frame_t* pframe, char* variable_name,
|
||||
|
|
@ -137,7 +137,7 @@ void local_stack_frame_assign_terminal_indexed(local_stack_frame_t* pframe,
|
|||
int vardef_frame_relative_index, sllmv_t* pmvkeys,
|
||||
mv_t terminal_value);
|
||||
|
||||
void local_stack_frame_assign_extended_indexed(local_stack_frame_t* pframe, // xxx rename
|
||||
void local_stack_frame_assign_extended_indexed(local_stack_frame_t* pframe,
|
||||
int vardef_frame_relative_index, sllmv_t* pmvkeys,
|
||||
mlhmmv_xvalue_t terminal_value);
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ void mlr_dsl_cst_handle_statement_block(
|
|||
variables_t* pvars,
|
||||
cst_outputs_t* pcst_outputs);
|
||||
|
||||
void handle_statement_block_with_break_continue( // xxx rename w/ prefix
|
||||
void mlr_dsl_cst_handle_statement_block_with_break_continue(
|
||||
cst_statement_block_t* pblock,
|
||||
variables_t* pvars,
|
||||
cst_outputs_t* pcst_outputs);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ mlr_dsl_cst_statement_t* alloc_conditional_block(mlr_dsl_cst_t* pcst, mlr_dsl_as
|
|||
}
|
||||
|
||||
mlr_dsl_cst_block_handler_t* pblock_handler = (context_flags & IN_BREAKABLE)
|
||||
? handle_statement_block_with_break_continue
|
||||
? mlr_dsl_cst_handle_statement_block_with_break_continue
|
||||
: mlr_dsl_cst_handle_statement_block;
|
||||
|
||||
return mlr_dsl_cst_statement_valloc_with_block(
|
||||
|
|
@ -181,7 +181,7 @@ mlr_dsl_cst_statement_t* alloc_if_head(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_t*
|
|||
}
|
||||
|
||||
mlr_dsl_cst_block_handler_t* pblock_handler = (context_flags & IN_BREAKABLE)
|
||||
? handle_statement_block_with_break_continue
|
||||
? mlr_dsl_cst_handle_statement_block_with_break_continue
|
||||
: mlr_dsl_cst_handle_statement_block;
|
||||
|
||||
return mlr_dsl_cst_statement_valloc_with_block(
|
||||
|
|
@ -311,7 +311,7 @@ mlr_dsl_cst_statement_t* alloc_while(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_t* pn
|
|||
pnode,
|
||||
handle_while,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_while,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ mlr_dsl_cst_statement_t* alloc_do_while(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_t*
|
|||
pnode,
|
||||
handle_do_while,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_do_while,
|
||||
pstate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ mlr_dsl_cst_statement_t* alloc_for_oosvar(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_
|
|||
pnode,
|
||||
handle_for_oosvar,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_oosvar,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ static void handle_for_oosvar(
|
|||
// Recurse over the for-k-names, e.g. ["k1", "k2"], on each call descending one level
|
||||
// deeper into the submap. Note there must be at least one k-name so we are assuming
|
||||
// the for-loop within handle_for_oosvar_aux was gone through once & thus
|
||||
// handle_statement_block_with_break_continue was called through there.
|
||||
// mlr_dsl_cst_handle_statement_block_with_break_continue was called through there.
|
||||
|
||||
handle_for_oosvar_aux(pstatement, pvars, pcst_outputs, submap,
|
||||
pstate->k_variable_names, pstate->k_frame_relative_indices,
|
||||
|
|
@ -321,7 +321,7 @@ mlr_dsl_cst_statement_t* alloc_for_oosvar_key_only(mlr_dsl_cst_t* pcst, mlr_dsl_
|
|||
pnode,
|
||||
handle_for_oosvar_key_only,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_oosvar_key_only,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -476,7 +476,7 @@ mlr_dsl_cst_statement_t* alloc_for_local_map(mlr_dsl_cst_t* pcst, mlr_dsl_ast_no
|
|||
pnode,
|
||||
handle_for_local_map,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_local_map,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ static void handle_for_local_map(
|
|||
// indexed by [3, $4]. Copy it for the very likely case that it is being updated inside the
|
||||
// for-loop.
|
||||
|
||||
mlhmmv_xvalue_t *psubmap = local_stack_frame_get_extended_from_indexed(pframe,
|
||||
mlhmmv_xvalue_t *psubmap = local_stack_frame_ref_extended_from_indexed(pframe,
|
||||
pstate->target_frame_relative_index, ptarget_keylist);
|
||||
|
||||
if (psubmap != NULL) {
|
||||
|
|
@ -536,7 +536,7 @@ static void handle_for_local_map(
|
|||
// Recurse over the for-k-names, e.g. ["k1", "k2"], on each call descending one level
|
||||
// deeper into the submap. Note there must be at least one k-name so we are assuming
|
||||
// the for-loop within handle_for_local_map_aux was gone through once & thus
|
||||
// handle_statement_block_with_break_continue was called through there.
|
||||
// mlr_dsl_cst_handle_statement_block_with_break_continue was called through there.
|
||||
|
||||
handle_for_local_map_aux(pstatement, pvars, pcst_outputs, submap,
|
||||
pstate->k_variable_names, pstate->k_frame_relative_indices,
|
||||
|
|
@ -662,7 +662,7 @@ mlr_dsl_cst_statement_t* alloc_for_local_map_key_only(mlr_dsl_cst_t* pcst, mlr_d
|
|||
// xxx comment liberally
|
||||
MLR_INTERNAL_CODING_ERROR_IF(pmiddle->vardef_frame_relative_index == MD_UNUSED_INDEX);
|
||||
pstate->target_frame_relative_index = pmiddle->vardef_frame_relative_index;
|
||||
pstate->ptarget_keylist_evaluators = allocate_keylist_evaluators_from_ast_node( // xxx rename x 2
|
||||
pstate->ptarget_keylist_evaluators = allocate_keylist_evaluators_from_ast_node(
|
||||
pmiddle, pcst->pfmgr, type_inferencing, context_flags);
|
||||
|
||||
MLR_INTERNAL_CODING_ERROR_IF(pnode->subframe_var_count == MD_UNUSED_INDEX);
|
||||
|
|
@ -678,7 +678,7 @@ mlr_dsl_cst_statement_t* alloc_for_local_map_key_only(mlr_dsl_cst_t* pcst, mlr_d
|
|||
pnode,
|
||||
handle_for_local_map_key_only,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_local_map_key_only,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ static void handle_for_local_map_key_only(
|
|||
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
|
||||
mlhmmv_xvalue_t *psubmap = local_stack_frame_get_extended_from_indexed(pframe,
|
||||
mlhmmv_xvalue_t *psubmap = local_stack_frame_ref_extended_from_indexed(pframe,
|
||||
pstate->target_frame_relative_index, ptarget_keylist);
|
||||
sllv_t* pkeys = mlhmmv_xvalue_copy_keys_indexed(psubmap, NULL); // xxx refactor w/o null
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ mlr_dsl_cst_statement_t* alloc_for_map_literal(mlr_dsl_cst_t* pcst, mlr_dsl_ast_
|
|||
pnode,
|
||||
handle_for_map_literal,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_map_literal,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -881,7 +881,7 @@ static void handle_for_map_literal(
|
|||
// Recurse over the for-k-names, e.g. ["k1", "k2"], on each call descending one level
|
||||
// deeper into the submap. Note there must be at least one k-name so we are assuming
|
||||
// the for-loop within handle_for_map_literal_aux was gone through once & thus
|
||||
// handle_statement_block_with_break_continue was called through there.
|
||||
// mlr_dsl_cst_handle_statement_block_with_break_continue was called through there.
|
||||
|
||||
handle_for_map_literal_aux(pstatement, pvars, pcst_outputs, &boxed_xval.xval,
|
||||
pstate->k_variable_names, pstate->k_frame_relative_indices,
|
||||
|
|
@ -1017,7 +1017,7 @@ mlr_dsl_cst_statement_t* alloc_for_map_literal_key_only(mlr_dsl_cst_t* pcst, mlr
|
|||
pnode,
|
||||
handle_for_map_literal_key_only,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_map_literal_key_only,
|
||||
pstate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ mlr_dsl_cst_statement_t* alloc_for_srec(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_t*
|
|||
pnode,
|
||||
handle_for_srec,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_for_srec,
|
||||
pstate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -869,7 +869,7 @@ static void record_emitter_from_local_variable(
|
|||
if (names_all_non_null_or_error) {
|
||||
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
mlhmmv_xvalue_t* pmval = local_stack_frame_get_extended_from_indexed(pframe,
|
||||
mlhmmv_xvalue_t* pmval = local_stack_frame_ref_extended_from_indexed(pframe,
|
||||
pstate->localvar_frame_relative_index, NULL);
|
||||
if (pmval != NULL) {
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ static void handle_return_value_from_indexed_local_variable(
|
|||
if (all_non_null_or_error) {
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
|
||||
mlhmmv_xvalue_t* pmvalue = local_stack_frame_get_extended_from_indexed(pframe,
|
||||
mlhmmv_xvalue_t* pmvalue = local_stack_frame_ref_extended_from_indexed(pframe,
|
||||
pstate->rhs_frame_relative_index, pmvkeys);
|
||||
|
||||
if (pmvalue == NULL) {
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ void mlr_dsl_cst_handle_statement_block(
|
|||
|
||||
// This is for statement lists recursively contained within a loop body.
|
||||
// It checks for break or continue flags after each statement.
|
||||
void handle_statement_block_with_break_continue(
|
||||
void mlr_dsl_cst_handle_statement_block_with_break_continue(
|
||||
cst_statement_block_t* pblock,
|
||||
variables_t* pvars,
|
||||
cst_outputs_t* pcst_outputs)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ mlr_dsl_cst_statement_t* alloc_triple_for(mlr_dsl_cst_t* pcst, mlr_dsl_ast_node_
|
|||
pnode,
|
||||
handle_triple_for,
|
||||
pblock,
|
||||
handle_statement_block_with_break_continue,
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue,
|
||||
free_triple_for,
|
||||
pstate);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ static void handle_triple_for(
|
|||
break;
|
||||
|
||||
// Body statements
|
||||
handle_statement_block_with_break_continue(pstatement->pblock, pvars, pcst_outputs);
|
||||
mlr_dsl_cst_handle_statement_block_with_break_continue(pstatement->pblock, pvars, pcst_outputs);
|
||||
|
||||
if (loop_stack_get(pvars->ploop_stack) & LOOP_BROKEN) {
|
||||
loop_stack_clear(pvars->ploop_stack, LOOP_BROKEN);
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ mv_t rval_evaluator_local_map_keylist_func(void* pvstate, variables_t* pvars) {
|
|||
mv_t rv = mv_absent();
|
||||
if (all_non_null_or_error) {
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
mv_t val = local_stack_frame_get_terminal_from_indexed(pframe, pstate->vardef_frame_relative_index, pmvkeys);
|
||||
mv_t val = local_stack_frame_ref_terminal_from_indexed(pframe, pstate->vardef_frame_relative_index, pmvkeys);
|
||||
if (val.type == MT_STRING && *val.u.strv == 0)
|
||||
rv = mv_empty();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ typedef struct _rxval_evaluator_from_nonindexed_local_variable_state_t {
|
|||
static boxed_xval_t rxval_evaluator_from_nonindexed_local_variable_func(void* pvstate, variables_t* pvars) {
|
||||
rxval_evaluator_from_nonindexed_local_variable_state_t* pstate = pvstate;
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
mlhmmv_xvalue_t* pxval = local_stack_frame_get_extended_from_indexed(
|
||||
mlhmmv_xvalue_t* pxval = local_stack_frame_ref_extended_from_indexed(
|
||||
pframe, pstate->vardef_frame_relative_index, NULL);
|
||||
if (pxval == NULL) {
|
||||
return (boxed_xval_t) {
|
||||
|
|
@ -315,7 +315,7 @@ static boxed_xval_t rxval_evaluator_from_indexed_local_variable_func(void* pvsta
|
|||
|
||||
if (all_non_null_or_error) {
|
||||
local_stack_frame_t* pframe = local_stack_get_top_frame(pvars->plocal_stack);
|
||||
mlhmmv_xvalue_t* pxval = local_stack_frame_get_extended_from_indexed(pframe, pstate->vardef_frame_relative_index,
|
||||
mlhmmv_xvalue_t* pxval = local_stack_frame_ref_extended_from_indexed(pframe, pstate->vardef_frame_relative_index,
|
||||
pmvkeys);
|
||||
sllmv_free(pmvkeys);
|
||||
if (pxval == NULL) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ MAPVAR CHECKLIST:
|
|||
* debt-reduction
|
||||
- valgrinds
|
||||
- xxxes
|
||||
! ref terminals as well as non-terminals
|
||||
- prune unused functions
|
||||
? free vs. free_contents names ?
|
||||
* func/subr mapvar args; func mapvar retval
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue