mirror of
https://github.com/johnkerl/miller.git
synced 2026-08-03 21:13:09 +00:00
UDF iterate
This commit is contained in:
parent
6a84d53c7a
commit
d44deb32bd
2 changed files with 41 additions and 41 deletions
|
|
@ -4,6 +4,34 @@
|
|||
#include "mapping/context_flags.h"
|
||||
#include "mapping/rval_evaluators.h"
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
typedef enum _func_class_t {
|
||||
FUNC_CLASS_ARITHMETIC,
|
||||
FUNC_CLASS_MATH,
|
||||
FUNC_CLASS_BOOLEAN,
|
||||
FUNC_CLASS_STRING,
|
||||
FUNC_CLASS_CONVERSION,
|
||||
FUNC_CLASS_TIME
|
||||
} func_class_t;
|
||||
|
||||
typedef enum _arity_check_t {
|
||||
ARITY_CHECK_PASS,
|
||||
ARITY_CHECK_FAIL,
|
||||
ARITY_CHECK_NO_SUCH
|
||||
} arity_check_t;
|
||||
|
||||
// xxx move to fcn manager, along with move functions -> methods there
|
||||
typedef struct _function_lookup_t {
|
||||
func_class_t function_class;
|
||||
char* function_name;
|
||||
int arity;
|
||||
char* usage_string;
|
||||
} function_lookup_t;
|
||||
|
||||
// xxx rm
|
||||
extern function_lookup_t FUNCTION_LOOKUP_TABLE[];
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
//typedef struct _function_lookup_t {
|
||||
// func_class_t function_class;
|
||||
// char* function_name;
|
||||
|
|
@ -40,6 +68,7 @@ static rval_evaluator_t* rval_evaluator_alloc_from_ternary_func_name(char* fnnm,
|
|||
static rval_evaluator_t* rval_evaluator_alloc_from_ternary_regex_arg2_func_name(char* fnnm,
|
||||
rval_evaluator_t* parg1, char* regex_string, int ignore_case, rval_evaluator_t* parg3);
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// ----------------------------------------------------------------
|
||||
fmgr_t* fmgr_alloc() {
|
||||
fmgr_t* pfmgr = mlr_malloc_or_die(sizeof(fmgr_t));
|
||||
|
|
@ -69,11 +98,6 @@ void fmgr_install_UDF(fmgr_t* pfmgr, char* name, rval_evaluator_t* pevaluator) {
|
|||
// xxx stub
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
rval_evaluator_t* fmgr_alloc_evaluator(fmgr_t* pfmgr, char* name) {
|
||||
return NULL; // xxx stub
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// xxx make static
|
||||
function_lookup_t FUNCTION_LOOKUP_TABLE[] = {
|
||||
|
|
|
|||
|
|
@ -7,52 +7,28 @@
|
|||
#include "mapping/type_inference.h"
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx make static in fmgr
|
||||
|
||||
typedef enum _func_class_t {
|
||||
FUNC_CLASS_ARITHMETIC,
|
||||
FUNC_CLASS_MATH,
|
||||
FUNC_CLASS_BOOLEAN,
|
||||
FUNC_CLASS_STRING,
|
||||
FUNC_CLASS_CONVERSION,
|
||||
FUNC_CLASS_TIME
|
||||
} func_class_t;
|
||||
|
||||
typedef enum _arity_check_t {
|
||||
ARITY_CHECK_PASS,
|
||||
ARITY_CHECK_FAIL,
|
||||
ARITY_CHECK_NO_SUCH
|
||||
} arity_check_t;
|
||||
|
||||
// xxx move to fcn manager, along with move functions -> methods there
|
||||
typedef struct _function_lookup_t {
|
||||
func_class_t function_class;
|
||||
char* function_name;
|
||||
int arity;
|
||||
char* usage_string;
|
||||
} function_lookup_t;
|
||||
|
||||
extern function_lookup_t FUNCTION_LOOKUP_TABLE[]; // xxx rm
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
struct _function_lookup_t;
|
||||
typedef struct _fmgr_t {
|
||||
function_lookup_t * function_lookup_table;
|
||||
struct _function_lookup_t * function_lookup_table;
|
||||
lhmsv_t* pUDF_names_to_evaluators;
|
||||
} fmgr_t;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
fmgr_t* fmgr_alloc();
|
||||
|
||||
void fmgr_free(fmgr_t* pfmgr);
|
||||
|
||||
// xxx disallow redefine ?
|
||||
void fmgr_install_UDF(fmgr_t* pfmgr, char* name, rval_evaluator_t* pevaluator);
|
||||
rval_evaluator_t* fmgr_alloc_evaluator(fmgr_t* pfmgr, char* name);
|
||||
|
||||
void fmgr_list_functions(fmgr_t* pfmgr, FILE* output_stream, char* leader);
|
||||
// Pass function_name == NULL to get usage for all functions:
|
||||
void fmgr_function_usage(fmgr_t* pfmgr, FILE* output_stream, char* function_name);
|
||||
void fmgr_list_all_functions_raw(fmgr_t* pfmgr, FILE* output_stream);
|
||||
|
||||
rval_evaluator_t* fmgr_alloc_from_operator_or_function(fmgr_t* pfmgr, mlr_dsl_ast_node_t* pnode,
|
||||
int type_inferencing, int context_flags);
|
||||
|
||||
void fmgr_list_functions(fmgr_t* pfmgr, FILE* output_stream, char* leader);
|
||||
|
||||
// Pass function_name == NULL to get usage for all functions:
|
||||
void fmgr_function_usage(fmgr_t* pfmgr, FILE* output_stream, char* function_name);
|
||||
|
||||
void fmgr_list_all_functions_raw(fmgr_t* pfmgr, FILE* output_stream);
|
||||
|
||||
#endif // FUNCTION_MANAGER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue