diff --git a/Application/Application.cpp b/Application/Application.cpp index 17d2cfe..523acb5 100644 --- a/Application/Application.cpp +++ b/Application/Application.cpp @@ -27,11 +27,6 @@ namespace Coda { std::string subCommand = argParser.getSubCommand(); -#if _DEBUG - return repl(); - -#else - if (subCommand == "repl") { return repl(); } @@ -83,7 +78,6 @@ namespace Coda { } return EXIT_SUCCESS; } -#endif } diff --git a/Application/Application.h b/Application/Application.h index a2d90ed..2d2e2f0 100644 --- a/Application/Application.h +++ b/Application/Application.h @@ -19,7 +19,7 @@ namespace Coda { dddddddd \n\ CCCCCCCCCCCCC d::::::d \n\ CCC::::::::::::C d::::::d \n\ - CC:::::::::::::::C d::::::d \033[0mv0.3\033[1;96m \n\ + CC:::::::::::::::C d::::::d \033[0mv1.0.1\033[1;96m \n\ C:::::CCCCCCCC::::C d:::::d \n\ C:::::C CCCCCC ooooooooooo ddddddddd:::::d aaaaaaaaaaaaa \n\ C:::::C oo:::::::::::oo dd::::::::::::::d a::::::::::::a \n\ diff --git a/CHANGELOG.md b/CHANGELOG.md index 28b7318..0f5ac4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.1] - 04-10-2023 +- Code cleaning +- Removed `Linux` support. + ## [1.0] - 02-10-2023 ### Added diff --git a/Frontend/Importer/Importer.cpp b/Frontend/Importer/Importer.cpp index 0533a2b..532d5e7 100644 --- a/Frontend/Importer/Importer.cpp +++ b/Frontend/Importer/Importer.cpp @@ -1,12 +1,7 @@ #include "Importer.h" #include - -#if _WIN32 #include -#else -#include -#include -#endif + #include "../../Error/Error.h" @@ -90,9 +85,6 @@ namespace Coda { Error::Importer::raise("Imported file not found: " + importString); } - -#if _WIN32 // Check if the platform is Windows - std::string Importer::getExecutablePath() { wchar_t buffer[MAX_PATH]; GetModuleFileNameW(NULL, buffer, MAX_PATH); @@ -108,37 +100,10 @@ namespace Coda { return narrowExecutablePath; } -#else // Assuming Unix-like system (Linux, macOS, etc.) - std::string Importer::getExecutablePath() { - char buffer[PATH_MAX]; - ssize_t len = readlink("/proc/self/exe", buffer, sizeof(buffer) - 1); - if (len != -1) { - buffer[len] = '\0'; - std::string executablePath(buffer); - size_t lastSlashIndex = executablePath.rfind("/"); - if (lastSlashIndex != std::string::npos) { - executablePath = executablePath.substr(0, lastSlashIndex + 1); - } - return executablePath; - } - else { - throw "failed to get path of executable file" - return ""; - } - } -#endif - -#if _WIN32 bool Importer::fileExists(const std::string& filePath) { std::wstring wideFilePath(filePath.begin(), filePath.end()); DWORD fileAttributes = GetFileAttributes(wideFilePath.c_str()); return (fileAttributes != INVALID_FILE_ATTRIBUTES && !(fileAttributes & FILE_ATTRIBUTE_DIRECTORY)); } -#else - bool fileExists(const std::string& filePath) { - std::wstring wideFilePath(filePath.begin(), filePath.end()); - return access(wideFilePath, F_OK) == 0; - } -#endif } } diff --git a/Runtime/Interpreter/EvaluateObjectType.cpp b/Runtime/Interpreter/EvaluateObjectType.cpp index 214479e..33e5889 100644 --- a/Runtime/Interpreter/EvaluateObjectType.cpp +++ b/Runtime/Interpreter/EvaluateObjectType.cpp @@ -1,9 +1,6 @@ #include "Interpreter.h" -#ifdef _WIN32 #include -#else -#include -#endif // _WIN32 + namespace Coda { @@ -65,7 +62,7 @@ namespace Coda { IF_ERROR_RETURN_VALUE_PTR; Value args = Value(); ValuePtr name = interpret(*callExpression.left.get(), env); - + Position pos = callExpression.left->endPosition; pos.scope = name->value; Interpreter::callStack.push(pos); @@ -137,14 +134,9 @@ namespace Coda { typedef void (*FunctionType) (IValuePtr, IValuePtr, IEnvironment*); -#ifdef _WIN32 dllFilename += ".dll"; std::wstring s(dllFilename.begin(), dllFilename.end()); HMODULE lib = LoadLibrary(s.c_str()); -#else - dllFilename += ".so"; - void* lib = dlopen(dllFilename, RTLD_LAZY); -#endif if (!lib) { @@ -153,19 +145,12 @@ namespace Coda { } FunctionType myFunction; -#ifdef _WIN32 myFunction = (FunctionType)GetProcAddress(lib, functionName.c_str()); -#else - myFunction = (FunctionType)dlsym(lib, functionName.c_str()); -#endif + if (!myFunction) { Error::Runtime::raise("Cannot find function " + functionName + " at, ", Interpreter::callStack, callExpression.startPosition, callExpression.endPosition); -#ifdef _WIN32 FreeLibrary(lib); -#else - dlclose(lib); -#endif return nullptr; } @@ -178,14 +163,9 @@ namespace Coda { Error::Runtime::raise("Error in running '" + functionName + "': " + s); } - // Unload the library -#ifdef _WIN32 FreeLibrary(lib); -#else - dlclose(lib); -#endif return std::dynamic_pointer_cast(result); - } + } ValuePtr Interpreter::evaluateMemberExpression(const Frontend::Node& astNode, Environment& env) @@ -237,5 +217,5 @@ namespace Coda { IF_ERROR_RETURN_VALUE_PTR; return env.addFunction(astNode.value, astNode, env); } - } // namespace Runtime - } // namespace Coda \ No newline at end of file + } // namespace Runtime +} // namespace Coda \ No newline at end of file