code.h 963 B

1234567891011121314151617181920212223242526
  1. #ifndef AFUN__BYTECODE_H_PUBLIC
  2. #define AFUN__BYTECODE_H_PUBLIC
  3. #include <stdio.h>
  4. typedef struct af_Code af_Code;
  5. enum af_BlockType {
  6. parentheses = 0, // 小括号
  7. brackets, // 中括号
  8. curly, // 大括号
  9. };
  10. af_Code *makeLiteralCode(char *literal_data, char *func, char prefix, FileLine line, FilePath path);
  11. af_Code *makeVariableCode(char *var, char prefix, FileLine line, FilePath path);
  12. af_Code *makeBlockCode(enum af_BlockType type, af_Code *element, char prefix, FileLine line, FilePath path, af_Code **next);
  13. af_Code *connectCode(af_Code **base, af_Code *next);
  14. af_Code *copyCode(af_Code *base, FilePath *path);
  15. af_Code *freeCode(af_Code *bt);
  16. bool freeCodeWithElement(af_Code *bt, af_Code **next);
  17. void freeAllCode(af_Code *bt);
  18. bool getCodeBlockNext(af_Code *bt, af_Code **next);
  19. bool writeAllCode(af_Code *bt, FILE *file);
  20. bool readAllCode(af_Code **bt, FILE *file);
  21. void printCode(af_Code *bt);
  22. #endif //AFUN__BYTECODE_H_PUBLIC