Add lists (MEMORY ERRORS)
This commit is contained in:
25
src/types.h
25
src/types.h
@@ -27,6 +27,16 @@ struct GroundValue;
|
||||
|
||||
struct List;
|
||||
|
||||
/*
|
||||
* Custom data type that stores Ground values.
|
||||
* Associated functions:
|
||||
* createList(), appendToList(), getListAt(), setListAt()
|
||||
*/
|
||||
typedef struct List {
|
||||
size_t size;
|
||||
struct GroundValue* values;
|
||||
} List;
|
||||
|
||||
/*
|
||||
* Stores literal values created in a Ground program.
|
||||
* Associated functions:
|
||||
@@ -41,21 +51,11 @@ typedef struct GroundValue {
|
||||
char* stringVal;
|
||||
char charVal;
|
||||
bool boolVal;
|
||||
struct List* listVal;
|
||||
List listVal;
|
||||
void* customVal;
|
||||
} data;
|
||||
} GroundValue;
|
||||
|
||||
/*
|
||||
* Custom data type that stores Ground values.
|
||||
* Associated functions:
|
||||
* createList(), appendToList(), getListAt(), setListAt()
|
||||
*/
|
||||
typedef struct List {
|
||||
size_t size;
|
||||
GroundValue* values;
|
||||
} List;
|
||||
|
||||
/*
|
||||
* Indicates status when accessing a list.
|
||||
* Associated functions:
|
||||
@@ -107,6 +107,9 @@ GroundValue createCharGroundValue(char in);
|
||||
// Creates a GroundValue containing (in), with type BOOl.
|
||||
GroundValue createBoolGroundValue(bool in);
|
||||
|
||||
// Creates a GroundValue containing (in), with type LIST.
|
||||
GroundValue createListGroundValue(List in);
|
||||
|
||||
// If (gv) contains any data stored on the heap, frees it.
|
||||
void freeGroundValue(GroundValue* gv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user