Reworked Toy_String as a union, enabled -Wpedantic

Toy now fits into the C spec.

Fixed #158

Addendum: MacOS test caught an error:

error: a function declaration without a prototype is deprecated in all versions of C

That took 3 attempts to fix correctly.

Addendum: 'No new line at the end of file' are you shitting me?
This commit is contained in:
2024-12-15 15:34:57 +11:00
parent 93fce94e9c
commit a28053d4e9
41 changed files with 322 additions and 309 deletions

View File

@@ -5,7 +5,7 @@
//forward declarations
struct Toy_Bucket;
struct Toy_String;
union Toy_String_t;
struct Toy_Array;
typedef enum Toy_ValueType {
@@ -32,7 +32,7 @@ typedef struct Toy_Value { //32 | 64 BITNESS
bool boolean; //1 | 1
int integer; //4 | 4
float number; //4 | 4
struct Toy_String* string; //4 | 8
union Toy_String_t* string; //4 | 8
struct Toy_Array* array; //4 | 8
//TODO: more types go here
//TODO: consider 'stack' as a possible addition
@@ -84,7 +84,7 @@ TOY_API bool Toy_checkValuesAreComparable(Toy_Value left, Toy_Value right);
TOY_API int Toy_compareValues(Toy_Value left, Toy_Value right);
//convert the value to a string - values that *are* strings are simply copied
TOY_API struct Toy_String* Toy_stringifyValue(struct Toy_Bucket** bucketHandle, Toy_Value value);
TOY_API union Toy_String_t* Toy_stringifyValue(struct Toy_Bucket** bucketHandle, Toy_Value value);
//for debugging
TOY_API const char* Toy_private_getValueTypeAsCString(Toy_ValueType type);