X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Flet_func.h;h=60fdefd2d5e62cc5cd51eaace2a32a9f6a3a1494;hp=936c38d0a0d2b3aff680547664adf22d682acb74;hb=c9384515a81cb64d345b299908b2852f51bb8e6e;hpb=a107dfcca2dfd0fc5a2779a8d679f778cb8f3290 diff --git a/src/types/let_func.h b/src/types/let_func.h index 936c38d..60fdefd 100644 --- a/src/types/let_func.h +++ b/src/types/let_func.h @@ -28,26 +28,47 @@ #include "token.h" -#include "impl_var.h" -#include "decl_arg.h" +struct psi_data; +struct psi_impl; +struct psi_decl_arg; +struct psi_impl_var; +struct psi_let_exp; +struct psi_call_frame; -typedef struct let_func { +struct psi_let_func { + struct psi_token *token; token_t type; char *name; - impl_var *var; - struct let_vals *inner; - struct let_val *outer; - decl_arg *ref; -} let_func; + struct psi_impl_var *var; + struct psi_plist *inner; +}; -let_func *init_let_func(token_t type, const char *name, impl_var *var); -void free_let_func(let_func *func); -void dump_let_func(int fd, let_func *func, unsigned level); +struct psi_let_func *psi_let_func_init(token_t type, const char *name, struct psi_impl_var *var); +void psi_let_func_free(struct psi_let_func **func_ptr); +void psi_let_func_dump(int fd, struct psi_let_func *func, unsigned level); -struct psi_data; -struct impl; -struct let_val; +void *psi_let_func_exec(struct psi_let_exp *func_val, struct psi_let_func *func, struct psi_decl_arg *darg, struct psi_call_frame *frame); +bool psi_let_func_validate(struct psi_data *data, struct psi_let_func *func, struct psi_validate_scope *scope); + +#include "marshal.h" + +static inline psi_marshal_let locate_let_func_fn(token_t type) { + psi_marshal_let let_fn; -int validate_let_func(struct psi_data *data, struct let_val *val, let_func *func, decl_var *let_var, struct impl *impl); + switch (type) { + case PSI_T_BOOLVAL: let_fn = psi_let_boolval; break; + case PSI_T_INTVAL: let_fn = psi_let_intval; break; + case PSI_T_FLOATVAL: let_fn = psi_let_floatval; break; + case PSI_T_STRVAL: let_fn = psi_let_strval; break; + case PSI_T_STRLEN: let_fn = psi_let_strlen; break; + case PSI_T_PATHVAL: let_fn = psi_let_pathval; break; + case PSI_T_OBJVAL: let_fn = psi_let_objval; break; + case PSI_T_ZVAL: let_fn = psi_let_zval; break; + case PSI_T_VOID: let_fn = psi_let_void; break; + case PSI_T_COUNT: let_fn = psi_let_count; break; + default: let_fn = NULL; break; + } + return let_fn; +} #endif