Operation.h 1.6 KB

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