Added API macro to some functions

This commit is contained in:
2022-10-02 00:44:46 +01:00
parent 467cd8d978
commit 3460967e3b
5 changed files with 19 additions and 15 deletions

View File

@@ -228,7 +228,7 @@ int main(int argc, const char* argv[]) {
//TODO: remove this when the interpreter meets the specification //TODO: remove this when the interpreter meets the specification
if (command.verbose) { 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 //run source file

View 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("-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("-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("-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[]) { void copyrightCommand(int argc, const char* argv[]) {

View File

@@ -2482,7 +2482,7 @@ void runInterpreter(Interpreter* interpreter, unsigned char* bytecode, int lengt
freeLiteral(lit); 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_ARRAY(unsigned char, interpreter->bytecode, interpreter->length);
//free the associated data //free the associated data

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
#include "common.h"
#include "literal.h" #include "literal.h"
typedef struct LiteralArray { typedef struct LiteralArray {
@@ -8,11 +10,11 @@ typedef struct LiteralArray {
int count; int count;
} LiteralArray; } LiteralArray;
void initLiteralArray(LiteralArray* array); TOY_API void initLiteralArray(LiteralArray* array);
void freeLiteralArray(LiteralArray* array); TOY_API void freeLiteralArray(LiteralArray* array);
int pushLiteralArray(LiteralArray* array, Literal literal); TOY_API int pushLiteralArray(LiteralArray* array, Literal literal);
Literal popLiteralArray(LiteralArray* array); TOY_API Literal popLiteralArray(LiteralArray* array);
bool setLiteralArray(LiteralArray* array, Literal index, Literal value); TOY_API bool setLiteralArray(LiteralArray* array, Literal index, Literal value);
Literal getLiteralArray(LiteralArray* array, Literal index); TOY_API Literal getLiteralArray(LiteralArray* array, Literal index);
int findLiteralIndex(LiteralArray* array, Literal literal); int findLiteralIndex(LiteralArray* array, Literal literal);

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
#include "common.h"
#include "literal.h" #include "literal.h"
//TODO: benchmark this //TODO: benchmark this
@@ -17,11 +19,11 @@ typedef struct LiteralDictionary {
int contains; //count + tombstones, for internal use int contains; //count + tombstones, for internal use
} LiteralDictionary; } LiteralDictionary;
void initLiteralDictionary(LiteralDictionary* dictionary); TOY_API void initLiteralDictionary(LiteralDictionary* dictionary);
void freeLiteralDictionary(LiteralDictionary* dictionary); TOY_API void freeLiteralDictionary(LiteralDictionary* dictionary);
void setLiteralDictionary(LiteralDictionary* dictionary, Literal key, Literal value); TOY_API void setLiteralDictionary(LiteralDictionary* dictionary, Literal key, Literal value);
Literal getLiteralDictionary(LiteralDictionary* dictionary, Literal key); TOY_API Literal getLiteralDictionary(LiteralDictionary* dictionary, Literal key);
void removeLiteralDictionary(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);