__macro.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef VIRTUALMATH___MACRO_H
  2. #define VIRTUALMATH___MACRO_H
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <stdarg.h>
  7. #include <getopt.h>
  8. // 布尔逻辑的定义
  9. #define bool int
  10. #define true 1
  11. #define false 0
  12. // PASS语句的定义
  13. #define PASS do{}while(0)
  14. #define NUMBER_TYPE long int
  15. #define HASH_INDEX unsigned int
  16. #define INTER_FUNCTIONSIG_CORE struct Inter *inter, struct VarList *var_list
  17. #define INTER_FUNCTIONSIG Statement *st, INTER_FUNCTIONSIG_CORE
  18. #define CALL_INTER_FUNCTIONSIG_CORE(var_list) inter, var_list
  19. #define CALL_INTER_FUNCTIONSIG(st, var_list) st, CALL_INTER_FUNCTIONSIG_CORE(var_list)
  20. #define run_continue(result) (result.type == not_return || result.type == operation_return)
  21. #define run_continue_(result) (result->type == not_return || result->type == operation_return)
  22. #define is_error(result) (result.type == error_return)
  23. #define freeBase(element, return_) do{ \
  24. if (element == NULL){ \
  25. goto return_; \
  26. } \
  27. }while(0) \
  28. #define checkResult(check_result) do{ \
  29. if (is_error(check_result)){ \
  30. return check_result; \
  31. } \
  32. }while(0) \
  33. #endif //VIRTUALMATH___MACRO_H