mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Added API macro to some functions
This commit is contained in:
@@ -228,7 +228,7 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
//TODO: remove this when the interpreter meets the specification
|
||||
if (command.verbose) {
|
||||
printf(WARN "Warning! This interpreter is a work in progress, it does not yet meet the %d.%d.%d specification.\n" RESET, TOY_VERSION_MAJOR, TOY_VERSION_MINOR, TOY_VERSION_PATCH);
|
||||
printf(NOTICE "Toy Programming Language Version %d.%d.%d\n" RESET, TOY_VERSION_MAJOR, TOY_VERSION_MINOR, TOY_VERSION_PATCH);
|
||||
}
|
||||
|
||||
//run source file
|
||||
|
||||
@@ -109,7 +109,7 @@ void helpCommand(int argc, const char* argv[]) {
|
||||
printf("-f\t| --file filename\tParse, compile and execute the source file.\n\n");
|
||||
printf("-i\t| --input source\tParse, compile and execute this given string of source code.\n\n");
|
||||
printf("-c\t| --compile filename\tParse and compile the specified source file into an output file.\n\n");
|
||||
printf("-o\t| --output filename\tName of the file compiled with --compile (default: out.tb).\n\n");
|
||||
printf("-o\t| --output outfile\tName of the output file built with --compile (default: out.tb).\n\n");
|
||||
}
|
||||
|
||||
void copyrightCommand(int argc, const char* argv[]) {
|
||||
|
||||
@@ -2482,7 +2482,7 @@ void runInterpreter(Interpreter* interpreter, unsigned char* bytecode, int lengt
|
||||
freeLiteral(lit);
|
||||
}
|
||||
|
||||
//free the bytecode immediately after use
|
||||
//free the bytecode immediately after use TODO: because why?
|
||||
FREE_ARRAY(unsigned char, interpreter->bytecode, interpreter->length);
|
||||
|
||||
//free the associated data
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "literal.h"
|
||||
|
||||
typedef struct LiteralArray {
|
||||
@@ -8,11 +10,11 @@ typedef struct LiteralArray {
|
||||
int count;
|
||||
} LiteralArray;
|
||||
|
||||
void initLiteralArray(LiteralArray* array);
|
||||
void freeLiteralArray(LiteralArray* array);
|
||||
int pushLiteralArray(LiteralArray* array, Literal literal);
|
||||
Literal popLiteralArray(LiteralArray* array);
|
||||
bool setLiteralArray(LiteralArray* array, Literal index, Literal value);
|
||||
Literal getLiteralArray(LiteralArray* array, Literal index);
|
||||
TOY_API void initLiteralArray(LiteralArray* array);
|
||||
TOY_API void freeLiteralArray(LiteralArray* array);
|
||||
TOY_API int pushLiteralArray(LiteralArray* array, Literal literal);
|
||||
TOY_API Literal popLiteralArray(LiteralArray* array);
|
||||
TOY_API bool setLiteralArray(LiteralArray* array, Literal index, Literal value);
|
||||
TOY_API Literal getLiteralArray(LiteralArray* array, Literal index);
|
||||
|
||||
int findLiteralIndex(LiteralArray* array, Literal literal);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "literal.h"
|
||||
|
||||
//TODO: benchmark this
|
||||
@@ -17,11 +19,11 @@ typedef struct LiteralDictionary {
|
||||
int contains; //count + tombstones, for internal use
|
||||
} LiteralDictionary;
|
||||
|
||||
void initLiteralDictionary(LiteralDictionary* dictionary);
|
||||
void freeLiteralDictionary(LiteralDictionary* dictionary);
|
||||
TOY_API void initLiteralDictionary(LiteralDictionary* dictionary);
|
||||
TOY_API void freeLiteralDictionary(LiteralDictionary* dictionary);
|
||||
|
||||
void setLiteralDictionary(LiteralDictionary* dictionary, Literal key, Literal value);
|
||||
Literal getLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
void removeLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
TOY_API void setLiteralDictionary(LiteralDictionary* dictionary, Literal key, Literal value);
|
||||
TOY_API Literal getLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
TOY_API void removeLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
|
||||
bool existsLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
TOY_API bool existsLiteralDictionary(LiteralDictionary* dictionary, Literal key);
|
||||
|
||||
Reference in New Issue
Block a user