From ba98624e82c3ceb03c73442013d2506de98b0687 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 26 Jul 2023 00:22:45 +1000 Subject: [PATCH] Fixed C-API function name, resolved #87, thanks @hiperiondev --- repl/lib_about.c | 12 ++++++------ repl/lib_random.c | 2 +- repl/lib_runner.c | 2 +- repl/lib_standard.c | 2 +- source/toy_common.h | 4 ++-- source/toy_interpreter.c | 4 ++-- source/toy_scope.c | 2 +- source/toy_scope.h | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/repl/lib_about.c b/repl/lib_about.c index fe5b0c8..b9cda17 100644 --- a/repl/lib_about.c +++ b/repl/lib_about.c @@ -27,7 +27,7 @@ int Toy_hookAbout(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lite //store as an aliased dictionary if (!TOY_IS_NULL(alias)) { //make sure the name isn't taken - if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) { + if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) { interpreter->errorOutput("Can't override an existing variable\n"); Toy_freeLiteral(alias); @@ -83,11 +83,11 @@ int Toy_hookAbout(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lite //store globally else { //make sure the names aren't taken - if (Toy_isDelcaredScopeVariable(interpreter->scope, majorKeyLiteral) || - Toy_isDelcaredScopeVariable(interpreter->scope, minorKeyLiteral) || - Toy_isDelcaredScopeVariable(interpreter->scope, patchKeyLiteral) || - Toy_isDelcaredScopeVariable(interpreter->scope, buildKeyLiteral) || - Toy_isDelcaredScopeVariable(interpreter->scope, authorKeyLiteral)) { + if (Toy_isDeclaredScopeVariable(interpreter->scope, majorKeyLiteral) || + Toy_isDeclaredScopeVariable(interpreter->scope, minorKeyLiteral) || + Toy_isDeclaredScopeVariable(interpreter->scope, patchKeyLiteral) || + Toy_isDeclaredScopeVariable(interpreter->scope, buildKeyLiteral) || + Toy_isDeclaredScopeVariable(interpreter->scope, authorKeyLiteral)) { interpreter->errorOutput("Can't override an existing variable\n"); Toy_freeLiteral(alias); diff --git a/repl/lib_random.c b/repl/lib_random.c index 97cbe44..7d07e94 100644 --- a/repl/lib_random.c +++ b/repl/lib_random.c @@ -133,7 +133,7 @@ int Toy_hookRandom(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lit //store the library in an aliased dictionary if (!TOY_IS_NULL(alias)) { //make sure the name isn't taken - if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) { + if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) { interpreter->errorOutput("Can't override an existing variable\n"); Toy_freeLiteral(alias); return -1; diff --git a/repl/lib_runner.c b/repl/lib_runner.c index 1271429..494083e 100644 --- a/repl/lib_runner.c +++ b/repl/lib_runner.c @@ -462,7 +462,7 @@ int Toy_hookRunner(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Lit //store the library in an aliased dictionary if (!TOY_IS_NULL(alias)) { //make sure the name isn't taken - if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) { + if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) { interpreter->errorOutput("Can't override an existing variable\n"); Toy_freeLiteral(alias); return -1; diff --git a/repl/lib_standard.c b/repl/lib_standard.c index 3c31403..9e4836f 100644 --- a/repl/lib_standard.c +++ b/repl/lib_standard.c @@ -2024,7 +2024,7 @@ int Toy_hookStandard(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_L //store the library in an aliased dictionary if (!TOY_IS_NULL(alias)) { //make sure the name isn't taken - if (Toy_isDelcaredScopeVariable(interpreter->scope, alias)) { + if (Toy_isDeclaredScopeVariable(interpreter->scope, alias)) { interpreter->errorOutput("Can't override an existing variable\n"); Toy_freeLiteral(alias); return -1; diff --git a/source/toy_common.h b/source/toy_common.h index a89bd82..5d09295 100644 --- a/source/toy_common.h +++ b/source/toy_common.h @@ -54,7 +54,7 @@ The current minor version of Toy. This value is embedded into the bytecode, and This value MUST fit into an unsigned char. !*/ -#define TOY_VERSION_MINOR 1 +#define TOY_VERSION_MINOR 2 /*! ### TOY_VERSION_PATCH @@ -64,7 +64,7 @@ The current patch version of Toy. This value is embedded into the bytecode. This value MUST fit into an unsigned char. !*/ -#define TOY_VERSION_PATCH 7 +#define TOY_VERSION_PATCH 0 /*! ### TOY_VERSION_BUILD diff --git a/source/toy_interpreter.c b/source/toy_interpreter.c index 8ccbc7f..1fb4bd2 100644 --- a/source/toy_interpreter.c +++ b/source/toy_interpreter.c @@ -699,7 +699,7 @@ static bool execVarAssign(Toy_Interpreter* interpreter) { return false; } - if (!Toy_isDelcaredScopeVariable(interpreter->scope, lhs)) { + if (!Toy_isDeclaredScopeVariable(interpreter->scope, lhs)) { interpreter->errorOutput("Undeclared variable \""); Toy_printLiteralCustom(lhs, interpreter->errorOutput); interpreter->errorOutput("\"\n"); @@ -1467,7 +1467,7 @@ bool Toy_callFn(Toy_Interpreter* interpreter, const char* name, Toy_LiteralArray Toy_Literal key = TOY_TO_IDENTIFIER_LITERAL(Toy_createRefStringLength(name, strlen(name))); Toy_Literal val = TOY_TO_NULL_LITERAL; - if (!Toy_isDelcaredScopeVariable(interpreter->scope, key)) { + if (!Toy_isDeclaredScopeVariable(interpreter->scope, key)) { interpreter->errorOutput("No function with that name\n"); return false; } diff --git a/source/toy_scope.c b/source/toy_scope.c index ee1b4f7..c8a92c7 100644 --- a/source/toy_scope.c +++ b/source/toy_scope.c @@ -256,7 +256,7 @@ bool Toy_declareScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal typ return true; } -bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key) { +bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key) { while (scope != NULL) { if (Toy_existsLiteralDictionary(&scope->variables, key)) { return true; diff --git a/source/toy_scope.h b/source/toy_scope.h index b6e3f3f..7cbcbb9 100644 --- a/source/toy_scope.h +++ b/source/toy_scope.h @@ -58,11 +58,11 @@ This function returns true on success, otherwise it returns failure (such as if TOY_API bool Toy_declareScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal type); /*! -### bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key) +### bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key) This function checks to see if a given variable with the name `key` has been previously declared. !*/ -TOY_API bool Toy_isDelcaredScopeVariable(Toy_Scope* scope, Toy_Literal key); +TOY_API bool Toy_isDeclaredScopeVariable(Toy_Scope* scope, Toy_Literal key); /*! ### bool Toy_setScopeVariable(Toy_Scope* scope, Toy_Literal key, Toy_Literal value, bool constCheck)