func.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef AFUN__FUNC_H_PUBLIC
  2. #define AFUN__FUNC_H_PUBLIC
  3. typedef struct ArgCodeList ArgCodeList;
  4. typedef struct ArgList 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. /* ArgCodeList 创建与释放 */
  22. ArgCodeList *makeArgCodeList(af_Code *code, size_t size, bool free_code, bool run_in_func);
  23. ArgCodeList *freeArgCodeList(ArgCodeList *acl);
  24. void freeAllArgCodeList(ArgCodeList *acl);
  25. /* ArgCodeList 操作函数 */
  26. ArgCodeList **pushArgCodeList(ArgCodeList **base, ArgCodeList *new);
  27. ArgCodeList **pushNewArgCodeList(ArgCodeList **base, af_Code *code, size_t size, bool free_code, bool run_in_func);
  28. void *getArgCodeListData(ArgCodeList *acl);
  29. af_Object *getArgCodeListResult(ArgCodeList *acl);
  30. /* ArgList 创建与释放 */
  31. ArgList *makeArgList(char *name, af_Object *obj);
  32. ArgList *freeArgList(ArgList *al);
  33. void freeAllArgList(ArgList *al);
  34. /* ArgList 操作函数 */
  35. ArgList **pushArgList(ArgList **base, ArgList *new);
  36. ArgList **pushNewArgList(ArgList **base, char *name, af_Object *obj);
  37. bool runArgList(ArgList *al, af_VarSpaceListNode *vsl);
  38. /* FuncInfo 创建与释放 */
  39. af_FuncInfo *makeFuncInfo(enum af_FuncInfoScope scope, enum af_FuncInfoEmbedded embedded, bool is_macro, bool is_object);
  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