mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Removed debug code
This commit is contained in:
@@ -3,9 +3,7 @@
|
|||||||
#include "drive_system.h"
|
#include "drive_system.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
typedef struct Toy_File
|
typedef struct Toy_File
|
||||||
{
|
{
|
||||||
@@ -80,7 +78,6 @@ static int nativeOpen(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments)
|
|||||||
file->fp = fopen(filePath, mode);
|
file->fp = fopen(filePath, mode);
|
||||||
if (file->fp == NULL) {
|
if (file->fp == NULL) {
|
||||||
TOY_FREE(Toy_File, file);
|
TOY_FREE(Toy_File, file);
|
||||||
fprintf(stderr, "Error code: %d\n", errno);
|
|
||||||
fprintf(stderr, "File not found: %s\n", filePath);
|
fprintf(stderr, "File not found: %s\n", filePath);
|
||||||
file->error = 1;
|
file->error = 1;
|
||||||
}
|
}
|
||||||
@@ -96,8 +93,7 @@ static int nativeOpen(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// result
|
// result
|
||||||
Toy_Literal fileLiteral = TOY_TO_OPAQUE_LITERAL(file, 900);
|
Toy_Literal fileLiteral = TOY_TO_OPAQUE_LITERAL(file, TOY_OPAQUE_TAG_FILE);
|
||||||
|
|
||||||
Toy_pushLiteralArray(&interpreter->stack, fileLiteral);
|
Toy_pushLiteralArray(&interpreter->stack, fileLiteral);
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
@@ -124,7 +120,7 @@ static int nativeClose(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check self type
|
// check self type
|
||||||
if (!(TOY_IS_OPAQUE(selfLiteral) || TOY_GET_OPAQUE_TAG(selfLiteral) == 900)) {
|
if (!(TOY_IS_OPAQUE(selfLiteral) || TOY_GET_OPAQUE_TAG(selfLiteral) == TOY_OPAQUE_TAG_FILE)) {
|
||||||
interpreter->errorOutput("Incorrect argument type passed to close\n");
|
interpreter->errorOutput("Incorrect argument type passed to close\n");
|
||||||
Toy_freeLiteral(selfLiteral);
|
Toy_freeLiteral(selfLiteral);
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,6 @@
|
|||||||
|
|
||||||
#include "toy_interpreter.h"
|
#include "toy_interpreter.h"
|
||||||
|
|
||||||
|
#define TOY_OPAQUE_TAG_FILE 300
|
||||||
|
|
||||||
int Toy_hookFileIO(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Literal alias);
|
int Toy_hookFileIO(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Literal alias);
|
||||||
|
|||||||
Reference in New Issue
Block a user