inter.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef VIRTUALMATH_INTER_H
  2. #define VIRTUALMATH_INTER_H
  3. struct Result;
  4. #define BASEOBJSZIE (17)
  5. #define VARNAMESIZE (10)
  6. #define BASEEXCESIZE (19)
  7. #define MAGFUNCSIZE (46)
  8. #define B_OBJECT (0)
  9. #define B_VOBJECT (1)
  10. #define B_INT_ (2)
  11. #define B_DOU (3)
  12. #define B_STR (4)
  13. #define B_BOOL (5)
  14. #define B_PASS (6)
  15. #define B_LIB (7)
  16. #define B_FILE (8)
  17. #define B_TUPLE (9)
  18. #define B_LIST (10)
  19. #define B_DICT (11)
  20. #define B_FUNCTION (12)
  21. #define B_NONE (13)
  22. #define B_LISTITER (14)
  23. #define B_DICTITER (15)
  24. #define B_POINTER (16)
  25. #define VN_str (0)
  26. #define VN_num (1)
  27. #define VN_bool (2)
  28. #define VN_file (3)
  29. #define VN_none (4)
  30. #define VN_pass (5)
  31. #define VN_class (6)
  32. #define VN_obj (7)
  33. #define VN_dict (8)
  34. #define VN_tuple (9)
  35. #define M_INIT (0)
  36. #define M_NEW (1)
  37. #define M_CALL (2)
  38. #define M_ENTER (3)
  39. #define M_EXIT (4)
  40. #define M_ADD (5)
  41. #define M_SUB (6)
  42. #define M_MUL (7)
  43. #define M_DIV (8)
  44. #define M_DEL (9)
  45. #define M_DOWN (10)
  46. #define M_SLICE (11)
  47. #define M_ITER (12)
  48. #define M_NEXT (13)
  49. #define M_REPO (14)
  50. #define M_BOOL (15)
  51. #define M_NAME (16)
  52. #define M_SELF (17)
  53. #define M_FATHER (18)
  54. #define M_MESSAGE (19)
  55. #define M_STR (20)
  56. #define M_DOWN_ASSIGMENT (21)
  57. #define M_SLICE_ASSIGMENT (22)
  58. #define M_DOWN_DEL (23)
  59. #define M_SLICE_DEL (24)
  60. #define M_ATTR (25)
  61. #define M_VAL (26)
  62. #define M_INTDIV (27)
  63. #define M_MOD (28)
  64. #define M_POW (29)
  65. #define M_BAND (30)
  66. #define M_BOR (31)
  67. #define M_BXOR (32)
  68. #define M_BNOT (33)
  69. #define M_BL (34)
  70. #define M_BR (35)
  71. #define M_EQ (36)
  72. #define M_MOREEQ (37)
  73. #define M_LESSEQ (38)
  74. #define M_MORE (39)
  75. #define M_LESS (40)
  76. #define M_NOTEQ (41)
  77. #define M_AND (42)
  78. #define M_OR (43)
  79. #define M_NOT (44)
  80. #define M_NEGATE (45)
  81. struct Inter{
  82. struct Value *base;
  83. struct LinkValue *link_base;
  84. struct HashTable *hash_base;
  85. struct Var *base_var;
  86. struct LinkValue *base_belong;
  87. struct Package *package;
  88. struct VarList *var_list;
  89. struct InterData{
  90. FILE *inter_stdout;
  91. FILE *inter_stderr;
  92. FILE *inter_stdin;
  93. bool is_stdout;
  94. bool is_stderr;
  95. bool is_stdin;
  96. struct LinkValue *base_obj[BASEOBJSZIE];
  97. struct LinkValue *base_exc[BASEEXCESIZE];
  98. wchar_t *var_name[VARNAMESIZE];
  99. wchar_t *mag_func[MAGFUNCSIZE];
  100. int default_pt_type;
  101. size_t var_max;
  102. int var_deep;
  103. } data;
  104. };
  105. typedef struct Inter Inter;
  106. typedef struct Statement Statement;
  107. typedef enum ResultType ResultType;
  108. Inter *makeInter(char *out, char *error_, char *in, LinkValue *belong);
  109. void freeInter(Inter *inter, bool show_gc);
  110. void setBaseInterData(struct Inter *inter);
  111. void runCodeStdin(Inter *inter, char *hello_string);
  112. void runCodeFile(Inter *inter, char *file[]);
  113. bool runParser(char *code_file, Inter *inter, bool is_one, Statement **st);
  114. void mergeInter(Inter *new, Inter *base);
  115. Inter *deriveInter(LinkValue *belong, Inter *inter);
  116. #endif //VIRTUALMATH_INTER_H