func.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef AFUN__FUNC_H_PUBLIC
  2. #define AFUN__FUNC_H_PUBLIC
  3. typedef struct af_ArgCodeList af_ArgCodeList;
  4. typedef struct af_ArgList af_ArgList;
  5. typedef struct af_FuncInfo af_FuncInfo;
  6. #include "code.h"
  7. #include "object.h"
  8. enum af_FuncInfoScope {
  9. normal_scope = 0,
  10. inline_scope,
  11. pure_scope,
  12. super_pure_scope,
  13. };
  14. enum af_FuncInfoEmbedded {
  15. not_embedded = 0,
  16. protect_embedded, // 内嵌函数
  17. super_embedded, // 超内嵌函数
  18. };
  19. typedef void callFuncBody(void *make, af_Environment *env);
  20. DEFINE_DLC_SYMBOL(callFuncBody);
  21. /* af_ArgCodeList 创建与释放 */
  22. af_ArgCodeList *makeArgCodeList(af_Code *code, size_t size, bool free_code, bool run_in_func);
  23. af_ArgCodeList *freeArgCodeList(af_ArgCodeList *acl);
  24. void freeAllArgCodeList(af_ArgCodeList *acl);
  25. /* af_ArgCodeList 操作函数 */
  26. af_ArgCodeList **pushArgCodeList(af_ArgCodeList **base, af_ArgCodeList *new);
  27. af_ArgCodeList **pushNewArgCodeList(af_ArgCodeList **base, af_Code *code, size_t size, bool free_code, bool run_in_func);
  28. void *getArgCodeListData(af_ArgCodeList *acl);
  29. af_Object *getArgCodeListResult(af_ArgCodeList *acl);
  30. /* af_ArgList 创建与释放 */
  31. af_ArgList *makeArgList(char *name, af_Object *obj);
  32. af_ArgList *freeArgList(af_ArgList *al);
  33. void freeAllArgList(af_ArgList *al);
  34. /* af_ArgList 操作函数 */
  35. af_ArgList **pushArgList(af_ArgList **base, af_ArgList *new);
  36. af_ArgList **pushNewArgList(af_ArgList **base, char *name, af_Object *obj);
  37. bool runArgList(af_ArgList *al, af_VarSpaceListNode *vsl);
  38. /* FuncInfo 创建与释放 */
  39. af_FuncInfo *makeFuncInfo(enum af_FuncInfoScope scope, enum af_FuncInfoEmbedded embedded, bool is_macro);
  40. void freeFuncInfo(af_FuncInfo *fi);
  41. /* FuncInfo 操作函数 */
  42. void makeCFuncBodyToFuncInfo(DLC_SYMBOL(callFuncBody) c_func, char **msg_type, af_FuncInfo *fi);
  43. void makeCodeFuncBodyToFuncInfo(af_Code *code, bool free_code, char **msg_type, af_FuncInfo *fi);
  44. #endif //AFUN__FUNC_H_PUBLIC