Operation.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef OPERATION_H
  2. #define OPERATION_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define OP_INTEGRAL(TYPE) OP_##TYPE##_INT32, OP_##TYPE##_INT64
  7. #define OP_NUMBER(TYPE) OP_INTEGRAL(TYPE), OP_##TYPE##_FLOAT
  8. #define OP_TYPE(TYPE) OP_NUMBER(TYPE), OP_##TYPE##_BOOL
  9. #define OP_CHANGE_NUMBER(TYPE) \
  10. OP_PUSH_PRE_##TYPE##_CHANGE, OP_PUSH_POST_##TYPE##_CHANGE, \
  11. OP_##TYPE##_CHANGE
  12. typedef enum Operation {
  13. OP_NOTHING,
  14. OP_NUMBER(PUSH),
  15. OP_PUSH_TRUE,
  16. OP_PUSH_FALSE,
  17. OP_PUSH_NULLPTR,
  18. OP_PUSH_TEXT,
  19. OP_NUMBER(ADD),
  20. OP_NUMBER(SUB),
  21. OP_NUMBER(MUL),
  22. OP_NUMBER(DIV),
  23. OP_MOD_INT32,
  24. OP_MOD_INT64,
  25. OP_NUMBER(INVERT_SIGN),
  26. OP_NUMBER(LESS),
  27. OP_NUMBER(LESS_EQUAL),
  28. OP_NUMBER(GREATER),
  29. OP_NUMBER(GREATER_EQUAL),
  30. OP_TYPE(EQUAL),
  31. OP_TYPE(NOT_EQUAL),
  32. OP_EQUAL_POINTER,
  33. OP_NOT_EQUAL_POINTER,
  34. OP_NOT,
  35. OP_AND,
  36. OP_OR,
  37. OP_INTEGRAL(BIT_NOT),
  38. OP_INTEGRAL(BIT_AND),
  39. OP_INTEGRAL(BIT_OR),
  40. OP_INTEGRAL(BIT_XOR),
  41. OP_INTEGRAL(LEFT_SHIFT),
  42. OP_INTEGRAL(RIGHT_SHIFT),
  43. OP_LINE,
  44. OP_GOTO,
  45. OP_IF_GOTO,
  46. OP_PEEK_FALSE_GOTO,
  47. OP_PEEK_TRUE_GOTO,
  48. OP_GOSUB,
  49. OP_RETURN,
  50. OP_TYPE(RETURN),
  51. OP_RETURN_POINTER,
  52. OP_RESERVE,
  53. OP_GRESERVE,
  54. OP_LOAD,
  55. OP_TYPE(LOAD),
  56. OP_TYPE(STORE),
  57. OP_DEREFERENCE_VAR,
  58. OP_DEREFERENCE_GVAR,
  59. OP_REFERENCE,
  60. OP_DUPLICATE_REFERENCE,
  61. OP_ADD_REFERENCE,
  62. OP_NEW,
  63. OP_DELETE,
  64. OP_LENGTH,
  65. OP_STORE_POINTER,
  66. OP_INTEGRAL(PUSH_PRE_CHANGE),
  67. OP_INTEGRAL(PUSH_POST_CHANGE),
  68. OP_INTEGRAL(CHANGE),
  69. OP_FLOAT_TO_INT32,
  70. OP_INT32_TO_FLOAT,
  71. OP_INT32_TO_INT64,
  72. OP_INT64_TO_INT32,
  73. OP_FLOAT_TO_INT64,
  74. OP_INT64_TO_FLOAT,
  75. OP_CALL
  76. } Operation;
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif