mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-19 16:54:08 +10:00
Renemed all variables to fit into a namespace
Basically, all Toy varaibles, functions, etc. are prepended with "Toy_", and macros are prepended with "TOY_". This is to reduce namespace pollution, which was an issue pointed out to be - blame @GyroVorbis. I've also bumped the minor version number - theoretically I should bump the major number, but I'm not quite ready for 1.0 yet.
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
#include "literal.h"
|
||||
#include "toy_literal.h"
|
||||
|
||||
#include "memory.h"
|
||||
#include "console_colors.h"
|
||||
#include "toy_memory.h"
|
||||
#include "toy_console_colors.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
{
|
||||
//test a single null literal
|
||||
Literal literal = TO_NULL_LITERAL;
|
||||
Toy_Literal literal = TOY_TO_NULL_LITERAL;
|
||||
|
||||
if (!IS_NULL(literal)) {
|
||||
fprintf(stderr, ERROR "ERROR: null literal failed\n" RESET);
|
||||
if (!TOY_IS_NULL(literal)) {
|
||||
fprintf(stderr, TOY_CC_ERROR "ERROR: null literal failed\n" TOY_CC_RESET);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
//test boolean literals
|
||||
Literal t = TO_BOOLEAN_LITERAL(true);
|
||||
Literal f = TO_BOOLEAN_LITERAL(false);
|
||||
Toy_Literal t = TOY_TO_BOOLEAN_LITERAL(true);
|
||||
Toy_Literal f = TOY_TO_BOOLEAN_LITERAL(false);
|
||||
|
||||
if (!IS_TRUTHY(t) || IS_TRUTHY(f)) {
|
||||
fprintf(stderr, ERROR "ERROR: boolean literal failed\n" RESET);
|
||||
if (!TOY_IS_TRUTHY(t) || TOY_IS_TRUTHY(f)) {
|
||||
fprintf(stderr, TOY_CC_ERROR "ERROR: boolean literal failed\n" TOY_CC_RESET);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -31,20 +31,20 @@ int main() {
|
||||
//test string literals
|
||||
char* buffer = "Hello world";
|
||||
|
||||
Literal literal = TO_STRING_LITERAL(createRefString(buffer));
|
||||
Toy_Literal literal = TOY_TO_STRING_LITERAL(Toy_createRefString(buffer));
|
||||
|
||||
freeLiteral(literal);
|
||||
Toy_freeLiteral(literal);
|
||||
}
|
||||
|
||||
{
|
||||
//test identifier literals
|
||||
char buffer[] = "Hello world";
|
||||
|
||||
Literal literal = TO_IDENTIFIER_LITERAL(createRefString(buffer));
|
||||
Toy_Literal literal = TOY_TO_IDENTIFIER_LITERAL(Toy_createRefString(buffer));
|
||||
|
||||
freeLiteral(literal);
|
||||
Toy_freeLiteral(literal);
|
||||
}
|
||||
|
||||
printf(NOTICE "All good\n" RESET);
|
||||
printf(TOY_CC_NOTICE "All good\n" TOY_CC_RESET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user