FunctionMap.h 839 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef FUNCTIONMAP_H
  2. #define FUNCTIONMAP_H
  3. #include <stdbool.h>
  4. typedef struct Function {
  5. const char* name;
  6. int arguments;
  7. int address;
  8. bool returns;
  9. } Function;
  10. typedef struct LingeringFunction {
  11. const char* name;
  12. int arguments;
  13. int line;
  14. int reserved;
  15. bool noReturn;
  16. } LingeringFunction;
  17. typedef struct FunctionMap {
  18. int capacity;
  19. int entries;
  20. Function* data;
  21. int queueCapacity;
  22. int queueEntries;
  23. LingeringFunction* queue;
  24. } FunctionMap;
  25. void fmInit(FunctionMap* fm);
  26. void fmDelete(FunctionMap* fm);
  27. Function* fmSearch(FunctionMap* fm, const char* name, int arguments);
  28. bool fmAdd(FunctionMap* fm, const char* name, int arguments, int address, bool returns);
  29. void fmEnqueue(FunctionMap* fm, const char* name, int arguments, int line, int reserved, bool noReturn);
  30. #endif