__macro.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 NUMBER_FORMAT "ld"
  16. #define HASH_INDEX unsigned int
  17. #define INTER_FUNCTIONSIG_CORE struct Inter *inter, struct VarList *var_list
  18. #define INTER_FUNCTIONSIG Statement *st, INTER_FUNCTIONSIG_CORE
  19. #define CALL_INTER_FUNCTIONSIG_CORE(var_list) inter, var_list
  20. #define CALL_INTER_FUNCTIONSIG(st, var_list) st, CALL_INTER_FUNCTIONSIG_CORE(var_list)
  21. #define run_continue(result) (result.type == not_return || result.type == operation_return)
  22. #define run_continue_(result) (result->type == not_return || result->type == operation_return)
  23. #define is_error(result) (result.type == error_return)
  24. #define freeBase(element, return_) do{ \
  25. if (element == NULL){ \
  26. goto return_; \
  27. } \
  28. }while(0) \
  29. #define checkResult(check_result) do{ \
  30. if (is_error(check_result)){ \
  31. return check_result; \
  32. } \
  33. }while(0) \
  34. #endif //VIRTUALMATH___MACRO_H