Better library stuff #7
@@ -7,10 +7,30 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Macro for easily returning errors
|
||||||
|
#define ERROR(what, type) return createErrorGroundValue(createGroundError(what, type, NULL, NULL))
|
||||||
|
|
||||||
// Forward declaration of the scope structure used in interpreter
|
// Forward declaration of the scope structure used in interpreter
|
||||||
struct GroundScope;
|
struct GroundScope;
|
||||||
typedef struct GroundScope GroundScope;
|
typedef struct GroundScope GroundScope;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stores data associated with an error thrown during Ground execution.
|
||||||
|
*/
|
||||||
|
typedef struct GroundError {
|
||||||
|
char* what;
|
||||||
|
char* type;
|
||||||
|
struct GroundInstruction* where;
|
||||||
|
size_t line;
|
||||||
|
bool hasLine;
|
||||||
|
} GroundError;
|
||||||
|
|
||||||
|
// Creates a GroundValue containing (in), with type ERROR.
|
||||||
|
GroundValue createErrorGroundValue(GroundError in);
|
||||||
|
|
||||||
|
// Creates a GroundError.
|
||||||
|
GroundError createGroundError(char* what, char* type, GroundInstruction* where, size_t* line);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function pointer type for native functions.
|
* Function pointer type for native functions.
|
||||||
* scope: The current execution scope (opaque).
|
* scope: The current execution scope (opaque).
|
||||||
|
|||||||
Reference in New Issue
Block a user