12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #ifndef FUNCTIONS_H
- #define FUNCTIONS_H
- #include <stdbool.h>
- #include "DataType.h"
- #include "vm/Script.h"
- #define FUNCTION_ARGUMENTS 9
- typedef void (*ScriptFunction)(Script*);
- typedef struct {
- const char* name;
- int arguments;
- DataType argumentTypes[FUNCTION_ARGUMENTS];
- DataType returnType;
- int address;
- int size;
- int line;
- bool global;
- ScriptFunction scriptFunction;
- } Function;
- typedef struct {
- int capacity;
- int entries;
- Function* data;
- } Functions;
- void fInit(Function* f, const char* name, int line);
- bool fAddArgument(Function* f, DataType type, Structs* sts);
- void fsInit(Functions* fs);
- void fsDelete(Functions* fs);
- Function* fsSearch(Functions* fs, Function* f, bool constMatch);
- void fsAdd(Functions* fs, Function* f);
- void gfInit(Function* f, const char* name, DataType r, ScriptFunction sf);
- bool gfAddArgument(Function* f, DataType type);
- void gfsInit();
- bool gfsAdd(Function* f);
- bool gfsCall(Script* sc, int id);
- void gfsDelete();
- #endif
|