From 0649a141ddfb2811bbb13aad3dea59db2f779a69 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 13 Jan 2023 15:39:22 +0000 Subject: [PATCH] Moved time header includes, comment tweaks --- repl/lib_standard.c | 4 +++- repl/lib_timer.c | 3 ++- repl/repl_main.c | 2 +- source/ast_node.h | 2 +- source/literal.c | 3 +-- source/literal_array.c | 2 -- source/toy_common.h | 9 +-------- 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/repl/lib_standard.c b/repl/lib_standard.c index 3224e37..22f7aa1 100644 --- a/repl/lib_standard.c +++ b/repl/lib_standard.c @@ -1,8 +1,10 @@ #include "lib_standard.h" -#include "toy_common.h" #include "memory.h" +#include +#include + static int nativeClock(Interpreter* interpreter, LiteralArray* arguments) { //no arguments if (arguments->count != 0) { diff --git a/repl/lib_timer.c b/repl/lib_timer.c index cd098c7..fbda56f 100644 --- a/repl/lib_timer.c +++ b/repl/lib_timer.c @@ -1,9 +1,10 @@ #include "lib_timer.h" -#include "toy_common.h" #include "memory.h" #include +#include +#include //GOD DAMN IT: https://stackoverflow.com/questions/15846762/timeval-subtract-explanation int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { diff --git a/repl/repl_main.c b/repl/repl_main.c index 998e611..cafed98 100644 --- a/repl/repl_main.c +++ b/repl/repl_main.c @@ -100,7 +100,7 @@ int main(int argc, const char* argv[]) { return 0; } - //TODO: remove this when the interpreter meets the specification + //version if (command.verbose) { printf(NOTICE "Toy Programming Language Version %d.%d.%d\n" RESET, TOY_VERSION_MAJOR, TOY_VERSION_MINOR, TOY_VERSION_PATCH); } diff --git a/source/ast_node.h b/source/ast_node.h index 574807c..797ebac 100644 --- a/source/ast_node.h +++ b/source/ast_node.h @@ -250,7 +250,7 @@ union _node { NodeFnDecl fnDecl; NodeFnCall fnCall; NodeFnReturn returns; - NodeIf pathIf; //TODO: rename these to ifStmt? + NodeIf pathIf; NodeWhile pathWhile; NodeFor pathFor; NodeBreak pathBreak; diff --git a/source/literal.c b/source/literal.c index d4dff94..77de57e 100644 --- a/source/literal.c +++ b/source/literal.c @@ -380,7 +380,7 @@ int hashLiteral(Literal lit) { case LITERAL_FUNCTION: case LITERAL_FUNCTION_NATIVE: - return 0; //TODO: find a way to hash these properly + return 0; //can't hash these case LITERAL_IDENTIFIER: return HASH_I(lit); //pre-computed @@ -564,7 +564,6 @@ void printLiteralCustom(Literal literal, void (printFn)(const char*)) { } break; - //TODO: functions case LITERAL_FUNCTION: case LITERAL_FUNCTION_NATIVE: printFn("(function)"); diff --git a/source/literal_array.c b/source/literal_array.c index a460944..8493fd2 100644 --- a/source/literal_array.c +++ b/source/literal_array.c @@ -77,8 +77,6 @@ bool setLiteralArray(LiteralArray* array, Literal index, Literal value) { return false; } - //TODO: implicit push when referencing one-past-the-end? - freeLiteral(array->literals[idx]); array->literals[idx] = copyLiteral(value); diff --git a/source/toy_common.h b/source/toy_common.h index f0e2951..a6b44d6 100644 --- a/source/toy_common.h +++ b/source/toy_common.h @@ -9,22 +9,15 @@ #define TOY_VERSION_PATCH 5 #define TOY_VERSION_BUILD __DATE__ " " __TIME__ -//NOTE: I don't know why the time headers are here, need to try moving them back to the correct spots again -//platform exports/imports +//platform-specific specifications #if defined(__linux__) #define TOY_API extern -#include -#include #elif defined(_WIN32) || defined(WIN32) #define TOY_API -#include -#include #else #define TOY_API -#include -#include #endif