mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Minor tweak
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
typedef struct Toy_Runner {
|
typedef struct Toy_Runner {
|
||||||
Toy_Interpreter interpreter;
|
Toy_Interpreter interpreter;
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
#include "toy_memory.h"
|
#include "toy_memory.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
static int nativeClock(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments) {
|
static int nativeClock(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments) {
|
||||||
//no arguments
|
//no arguments
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "toy_literal.h"
|
#include "toy_literal.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
//static math utils, copied from the interpreter
|
//static math utils, copied from the interpreter
|
||||||
static Toy_Literal addition(Toy_Interpreter* interpreter, Toy_Literal lhs, Toy_Literal rhs) {
|
static Toy_Literal addition(Toy_Interpreter* interpreter, Toy_Literal lhs, Toy_Literal rhs) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "toy_console_colors.h"
|
#include "toy_console_colors.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
void Toy_initCompiler(Toy_Compiler* compiler) {
|
void Toy_initCompiler(Toy_Compiler* compiler) {
|
||||||
Toy_initLiteralArray(&compiler->literalCache);
|
Toy_initLiteralArray(&compiler->literalCache);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "toy_console_colors.h"
|
#include "toy_console_colors.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
//hash util functions
|
//hash util functions
|
||||||
static unsigned int hashString(const char* string, int length) {
|
static unsigned int hashString(const char* string, int length) {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ typedef int (*Toy_NativeFn)(struct Toy_Interpreter* interpreter, struct Toy_Lite
|
|||||||
typedef int (*Toy_HookFn)(struct Toy_Interpreter* interpreter, struct Toy_Literal identifier, struct Toy_Literal alias);
|
typedef int (*Toy_HookFn)(struct Toy_Interpreter* interpreter, struct Toy_Literal identifier, struct Toy_Literal alias);
|
||||||
typedef void (*Toy_PrintFn)(const char*);
|
typedef void (*Toy_PrintFn)(const char*);
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TOY_LITERAL_NULL,
|
TOY_LITERAL_NULL,
|
||||||
TOY_LITERAL_BOOLEAN,
|
TOY_LITERAL_BOOLEAN,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "toy_refstring.h"
|
#include "toy_refstring.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
//memory allocation
|
//memory allocation
|
||||||
extern void* Toy_private_defaultMemoryAllocator(void* pointer, size_t oldSize, size_t newSize);
|
extern void* Toy_private_defaultMemoryAllocator(void* pointer, size_t oldSize, size_t newSize);
|
||||||
static Toy_RefStringAllocatorFn allocate = Toy_private_defaultMemoryAllocator;
|
static Toy_RefStringAllocatorFn allocate = Toy_private_defaultMemoryAllocator;
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "toy_common.h"
|
#include "toy_common.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
//memory allocation hook
|
//memory allocation hook
|
||||||
typedef void* (*Toy_RefStringAllocatorFn)(void* pointer, size_t oldSize, size_t newSize);
|
typedef void* (*Toy_RefStringAllocatorFn)(void* pointer, size_t oldSize, size_t newSize);
|
||||||
TOY_API void Toy_setRefStringAllocatorFn(Toy_RefStringAllocatorFn);
|
TOY_API void Toy_setRefStringAllocatorFn(Toy_RefStringAllocatorFn);
|
||||||
|
|||||||
Reference in New Issue
Block a user