mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Hooks can't be dict keys, tweaked Toy_readFile
This commit is contained in:
@@ -27,7 +27,7 @@ void error(char* msg) {
|
||||
int main() {
|
||||
{
|
||||
size_t size = 0;
|
||||
const char* source = Toy_readFile("scripts/call-from-host.toy", &size);
|
||||
const char* source = (const char*)Toy_readFile("scripts/call-from-host.toy", &size);
|
||||
const unsigned char* tb = Toy_compileString(source, &size);
|
||||
free((void*)source);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ int main() {
|
||||
{
|
||||
//source
|
||||
size_t sourceLength = 0;
|
||||
const char* source = Toy_readFile("scripts/compiler_sample_code.toy", &sourceLength);
|
||||
const char* source = (const char*)Toy_readFile("scripts/compiler_sample_code.toy", &sourceLength);
|
||||
|
||||
//test basic compilation & collation
|
||||
Toy_Lexer lexer;
|
||||
|
||||
@@ -53,7 +53,7 @@ void runSourceCustom(const char* source) {
|
||||
|
||||
void runSourceFileCustom(const char* fname) {
|
||||
size_t size = 0; //not used
|
||||
const char* source = Toy_readFile(fname, &size);
|
||||
const char* source = (const char*)Toy_readFile(fname, &size);
|
||||
runSourceCustom(source);
|
||||
free((void*)source);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ int main() {
|
||||
|
||||
//compile the source
|
||||
size_t size = 0;
|
||||
const char* source = Toy_readFile(fname, &size);
|
||||
const char* source = (const char*)Toy_readFile(fname, &size);
|
||||
if (!source) {
|
||||
printf(TOY_CC_ERROR "Failed to load file: %s\n" TOY_CC_RESET, fname);
|
||||
failedAsserts++;
|
||||
@@ -140,7 +140,7 @@ int main() {
|
||||
|
||||
//compile the source
|
||||
size_t size = 0;
|
||||
const char* source = Toy_readFile(fname, &size);
|
||||
const char* source = (const char*)Toy_readFile(fname, &size);
|
||||
if (!source) {
|
||||
printf(TOY_CC_ERROR "Failed to load file: %s\n" TOY_CC_RESET, fname);
|
||||
failedAsserts++;
|
||||
|
||||
@@ -84,7 +84,7 @@ void runSourceCustom(const char* source) {
|
||||
|
||||
void runSourceFileCustom(const char* fname) {
|
||||
size_t size = 0; //not used
|
||||
const char* source = Toy_readFile(fname, &size);
|
||||
const char* source = (const char*)Toy_readFile(fname, &size);
|
||||
runSourceCustom(source);
|
||||
free((void*)source);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ static int consume(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments) {
|
||||
int main() {
|
||||
{
|
||||
size_t size = 0;
|
||||
const char* source = Toy_readFile("scripts/opaque-data-type.toy", &size);
|
||||
const char* source = (const char*)Toy_readFile("scripts/opaque-data-type.toy", &size);
|
||||
const unsigned char* tb = Toy_compileString(source, &size);
|
||||
free((void*)source);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ int main() {
|
||||
{
|
||||
//get the source file
|
||||
size_t size = 0;
|
||||
const char* source = Toy_readFile("scripts/parser_sample_code.toy", &size);
|
||||
const char* source = (const char*)Toy_readFile("scripts/parser_sample_code.toy", &size);
|
||||
|
||||
//test parsing a chunk of junk (valgrind will find leaks)
|
||||
Toy_Lexer lexer;
|
||||
|
||||
Reference in New Issue
Block a user