1 // ================================================================ 2 // These evaluate right-hand-side extended values (rxvals) and return the same. 3 // 4 // For scalar (non-extended) right-hand side values, everything is ephemeral as 5 // it propagates up through the concrete syntax tree: e.g. in '$c = $a . $b' the 6 // $a and $b are copied out as ephemerals; in the concat function their 7 // concatenation is computed and the ephemeral input arguments are freed; then 8 // the result is stored in field $c. 9 // 10 // But for extended values (here) everything is copy-on-write: 11 // expression-intermediate values are not always ephemeral. This is due to the 12 // size of the data involved. We can do dump or emit of a nested hashmap stored 13 // in an oosvar or local without copying it; we can do mapdiff of two map-valued 14 // variables while not modifying or copying either argument. 15 // 16 // The boxed_xval_t decorates mlhmmv_value_t (extended value) with an 17 // is_ephemeral flag. The mlhmmv_value_t in turn has a map or a scalar. 18 // ================================================================ 19 20 #ifndef RXVAL_EVALUATOR_H 21 #define RXVAL_EVALUATOR_H 22 23 #include "lib/context.h" 24 #include "containers/lrec.h" 25 #include "containers/lhmsmv.h" 26 #include "containers/mlhmmv.h" 27 #include "lib/mvfuncs.h" 28 #include "containers/boxed_xval.h" 29 #include "containers/local_stack.h" 30 #include "containers/loop_stack.h" 31 #include "lib/string_array.h" 32 33 // ---------------------------------------------------------------- 34 struct _rxval_evaluator_t; // forward reference for method declarations 35 36 typedef boxed_xval_t rxval_evaluator_process_func_t(void* pvstate, variables_t* pvars); 37 38 typedef void rxval_evaluator_free_func_t(struct _rxval_evaluator_t*); 39 40 typedef struct _rxval_evaluator_t { 41 void* pvstate; 42 rxval_evaluator_process_func_t* pprocess_func; 43 rxval_evaluator_free_func_t* pfree_func; 44 } rxval_evaluator_t; 45 46 #endif // RXVAL_EVALUATOR_H 47