123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef FUNCTIONS_H
- #define FUNCTIONS_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #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();
- #ifdef __cplusplus
- }
- #endif
- #endif
|