func.h 1.7 KB

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