From 999dc83cac37efc109da4d562a8a75d1f6fc7c86 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 22 Dec 2025 15:33:46 +0100 Subject: feat: CompilerKit: Refactor NECTI_ symbols to NECTAR_. Signed-off-by: Amlal El Mahrouss --- src/CompilerKit/src/Assemblers/Assembler+32x0.cc | 2 +- src/CompilerKit/src/Assemblers/Assembler+64x0.cc | 2 +- src/CompilerKit/src/Assemblers/Assembler+AMD64.cc | 2 +- src/CompilerKit/src/Assemblers/Assembler+ARM64.cc | 4 +- .../src/Assemblers/Assembler+PowerPC.cc | 4 +- .../src/CodeGenerator+AssemblyFactory.cc | 6 +- src/CompilerKit/src/Compilers/CCompiler+64x0.cc | 6 +- src/CompilerKit/src/Compilers/CCompiler+ARM64.cc | 6 +- src/CompilerKit/src/Compilers/CCompiler+Power64.cc | 6 +- .../src/Compilers/CPlusPlusCompiler+AMD64.cc | 145 +++++++++++---------- src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cc | 28 ++-- .../src/Preprocessor/Preprocessor+Generic.cc | 12 +- 12 files changed, 112 insertions(+), 111 deletions(-) (limited to 'src/CompilerKit') diff --git a/src/CompilerKit/src/Assemblers/Assembler+32x0.cc b/src/CompilerKit/src/Assemblers/Assembler+32x0.cc index c05bf1f..39d72f9 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+32x0.cc +++ b/src/CompilerKit/src/Assemblers/Assembler+32x0.cc @@ -33,7 +33,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(NEAssemblerMain32000) { +NECTAR_MODULE(NEAssemblerMain32000) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); return EXIT_SUCCESS; } diff --git a/src/CompilerKit/src/Assemblers/Assembler+64x0.cc b/src/CompilerKit/src/Assemblers/Assembler+64x0.cc index c7923e8..067b303 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+64x0.cc +++ b/src/CompilerKit/src/Assemblers/Assembler+64x0.cc @@ -67,7 +67,7 @@ static bool asm_read_attributes(std::string line); ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(AssemblerMain64x0) { +NECTAR_MODULE(AssemblerMain64x0) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); for (size_t i = 1; i < argc; ++i) { diff --git a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc index b949e67..8dc1ae3 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc +++ b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc @@ -83,7 +83,7 @@ static bool asm_read_attributes(std::string line); ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(AssemblerMainAMD64) { +NECTAR_MODULE(AssemblerMainAMD64) { //////////////// CPU OPCODES BEGIN //////////////// CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); diff --git a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc index 22b4023..6ca665b 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc +++ b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc @@ -72,7 +72,7 @@ static bool asm_read_attributes(std::string line); ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(AssemblerMainARM64) { +NECTAR_MODULE(AssemblerMainARM64) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); for (size_t i = 1; i < argc; ++i) { @@ -259,7 +259,7 @@ asm_fail_exit: if (kVerbose) kStdOut << "AssemblerARM64: Exit failed.\n"; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cc b/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cc index 48ddefe..19108f8 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cc +++ b/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cc @@ -72,7 +72,7 @@ static bool asm_read_attributes(std::string line); ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(AssemblerMainPower64) { +NECTAR_MODULE(AssemblerMainPower64) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); for (size_t i = 1; i < argc; ++i) { @@ -259,7 +259,7 @@ asm_fail_exit: if (kVerbose) kStdOut << "AssemblerPower: Exit failed.\n"; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc index 98ba944..bef8746 100644 --- a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc +++ b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc @@ -18,10 +18,10 @@ namespace CompilerKit { ///! @brief Compile for specific format (ELF, PEF, ZBIN) Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) { - if (sourceFile.length() < 1) return NECTI_UNIMPLEMENTED; + if (sourceFile.length() < 1) return NECTAR_UNIMPLEMENTED; - if (!this->fMounted) return NECTI_UNIMPLEMENTED; - if (arch != this->fMounted->Arch()) return NECTI_INVALID_ARCH; + if (!this->fMounted) return NECTAR_UNIMPLEMENTED; + if (arch != this->fMounted->Arch()) return NECTAR_INVALID_ARCH; return this->fMounted->CompileToFormat(sourceFile, arch); } diff --git a/src/CompilerKit/src/Compilers/CCompiler+64x0.cc b/src/CompilerKit/src/Compilers/CCompiler+64x0.cc index 42d654b..7468cce 100644 --- a/src/CompilerKit/src/Compilers/CCompiler+64x0.cc +++ b/src/CompilerKit/src/Compilers/CCompiler+64x0.cc @@ -135,7 +135,7 @@ class CompilerFrontend64x0 final : public CompilerKit::ICompilerFrontend { explicit CompilerFrontend64x0() = default; ~CompilerFrontend64x0() override = default; - NECTI_COPY_DEFAULT(CompilerFrontend64x0); + NECTAR_COPY_DEFAULT(CompilerFrontend64x0); std::string Check(const char* text, const char* file); CompilerKit::SyntaxLeafList::SyntaxLeaf Compile(std::string text, std::string file) override; @@ -1046,7 +1046,7 @@ class AssemblyCCInterface final CK_ASSEMBLY_INTERFACE { explicit AssemblyCCInterface() = default; ~AssemblyCCInterface() override = default; - NECTI_COPY_DEFAULT(AssemblyCCInterface); + NECTAR_COPY_DEFAULT(AssemblyCCInterface); UInt32 Arch() noexcept override { return CompilerKit::AssemblyFactory::kArch64x0; } @@ -1179,7 +1179,7 @@ class AssemblyCCInterface final CK_ASSEMBLY_INTERFACE { } }; -NECTI_MODULE(CompilerCLang64x0) { +NECTAR_MODULE(CompilerCLang64x0) { ::signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); kCompilerTypes.push_back({.fName = "void", .fValue = "void"}); diff --git a/src/CompilerKit/src/Compilers/CCompiler+ARM64.cc b/src/CompilerKit/src/Compilers/CCompiler+ARM64.cc index 688835e..028a027 100644 --- a/src/CompilerKit/src/Compilers/CCompiler+ARM64.cc +++ b/src/CompilerKit/src/Compilers/CCompiler+ARM64.cc @@ -136,7 +136,7 @@ class CompilerFrontendARM64 final : public CompilerKit::ICompilerFrontend { explicit CompilerFrontendARM64() = default; ~CompilerFrontendARM64() override = default; - NECTI_COPY_DEFAULT(CompilerFrontendARM64); + NECTAR_COPY_DEFAULT(CompilerFrontendARM64); std::string Check(const char* text, const char* file); CompilerKit::SyntaxLeafList::SyntaxLeaf Compile(std::string text, std::string file) override; @@ -1045,7 +1045,7 @@ class AssemblyCCInterface final CK_ASSEMBLY_INTERFACE { explicit AssemblyCCInterface() = default; ~AssemblyCCInterface() override = default; - NECTI_COPY_DEFAULT(AssemblyCCInterface); + NECTAR_COPY_DEFAULT(AssemblyCCInterface); UInt32 Arch() noexcept override { return CompilerKit::AssemblyFactory::kArchAARCH64; } @@ -1178,7 +1178,7 @@ class AssemblyCCInterface final CK_ASSEMBLY_INTERFACE { } }; -NECTI_MODULE(CompilerCLangARM64) { +NECTAR_MODULE(CompilerCLangARM64) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); kCompilerTypes.push_back({.fName = "void", .fValue = "void"}); diff --git a/src/CompilerKit/src/Compilers/CCompiler+Power64.cc b/src/CompilerKit/src/Compilers/CCompiler+Power64.cc index 39d09fd..99a3ea7 100644 --- a/src/CompilerKit/src/Compilers/CCompiler+Power64.cc +++ b/src/CompilerKit/src/Compilers/CCompiler+Power64.cc @@ -120,7 +120,7 @@ class CompilerFrontendPower64 final : public CompilerKit::ICompilerFrontend { explicit CompilerFrontendPower64() = default; ~CompilerFrontendPower64() override = default; - NECTI_COPY_DEFAULT(CompilerFrontendPower64); + NECTAR_COPY_DEFAULT(CompilerFrontendPower64); std::string Check(const char* text, const char* file); CompilerKit::SyntaxLeafList::SyntaxLeaf Compile(std::string text, std::string file) override; @@ -1058,7 +1058,7 @@ class AssemblyMountpointCLang final CK_ASSEMBLY_INTERFACE { explicit AssemblyMountpointCLang() = default; ~AssemblyMountpointCLang() override = default; - NECTI_COPY_DEFAULT(AssemblyMountpointCLang); + NECTAR_COPY_DEFAULT(AssemblyMountpointCLang); UInt32 Arch() noexcept override { return CompilerKit::AssemblyFactory::kArchPowerPC; } @@ -1190,7 +1190,7 @@ class AssemblyMountpointCLang final CK_ASSEMBLY_INTERFACE { } }; -NECTI_MODULE(CompilerCLangPowerPC) { +NECTAR_MODULE(CompilerCLangPowerPC) { CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); kCompilerTypes.push_back({.fName = "void", .fValue = "void"}); diff --git a/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc b/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc index efe557f..1a14afb 100644 --- a/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc +++ b/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc @@ -120,7 +120,7 @@ class CompilerFrontendCPlusPlusAMD64 final CK_COMPILER_FRONTEND { explicit CompilerFrontendCPlusPlusAMD64() = default; ~CompilerFrontendCPlusPlusAMD64() override = default; - NECTI_COPY_DEFAULT(CompilerFrontendCPlusPlusAMD64); + NECTAR_COPY_DEFAULT(CompilerFrontendCPlusPlusAMD64); CompilerKit::SyntaxLeafList::SyntaxLeaf Compile(const CompilerKit::STLString text, CompilerKit::STLString file) override; @@ -174,7 +174,7 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendCPlusPlusAMD64::Compile( for (auto& keyword : kKeywords) { if (text.find(keyword.fKeywordName) != std::string::npos) { switch (keyword.fKeywordKind) { - case CompilerKit::kKeywordKindCommentInline: { + case CompilerKit::KeywordKind::kKeywordKindCommentInline: { break; } default: @@ -186,17 +186,17 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendCPlusPlusAMD64::Compile( // can't go before start of string if (pos > 0 && text[pos - 1] == '+' && - keyword.fKeywordKind == CompilerKit::kKeywordKindVariableAssign) + keyword.fKeywordKind == CompilerKit::KeywordKind::kKeywordKindVariableAssign) continue; if (pos > 0 && text[pos - 1] == '-' && - keyword.fKeywordKind == CompilerKit::kKeywordKindVariableAssign) + keyword.fKeywordKind == CompilerKit::KeywordKind::kKeywordKindVariableAssign) continue; // don't go out of range if ((pos + keyword.fKeywordName.size()) < text.size() && text[pos + keyword.fKeywordName.size()] == '=' && - keyword.fKeywordKind == CompilerKit::kKeywordKindVariableAssign) + keyword.fKeywordKind == CompilerKit::KeywordKind::kKeywordKindVariableAssign) continue; keywords_list.emplace_back(std::make_pair(keyword, index)); @@ -425,7 +425,7 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendCPlusPlusAMD64::Compile( static bool typeFound = false; for (auto& keyword : kKeywords) { - if (keyword.fKeywordKind == CompilerKit::kKeywordKindType) { + if (keyword.fKeywordKind == CompilerKit::KeywordKind::kKeywordKindType) { if (text.find(keyword.fKeywordName) != CompilerKit::STLString::npos) { if (text[text.find(keyword.fKeywordName)] == ' ') { typeFound = false; @@ -534,7 +534,7 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendCPlusPlusAMD64::Compile( done: for (auto& keyword : kKeywords) { - if (keyword.fKeywordKind == CompilerKit::kKeywordKindType && + if (keyword.fKeywordKind == CompilerKit::KeywordKind::kKeywordKindType && varName.find(keyword.fKeywordName) != CompilerKit::STLString::npos) { varName.erase(varName.find(keyword.fKeywordName), keyword.fKeywordName.size()); break; @@ -548,9 +548,10 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendCPlusPlusAMD64::Compile( kRegisterMap.insert(kRegisterMap.end(), newVars.begin(), newVars.end()); - if (keyword.second > 0 && - kKeywords[keyword.second - 1].fKeywordKind == CompilerKit::kKeywordKindType || - kKeywords[keyword.second - 1].fKeywordKind == CompilerKit::kKeywordKindTypePtr) { + if (keyword.second > 0 && kKeywords[keyword.second - 1].fKeywordKind == + CompilerKit::KeywordKind::kKeywordKindType || + kKeywords[keyword.second - 1].fKeywordKind == + CompilerKit::KeywordKind::kKeywordKindTypePtr) { syntax_tree.fUserValue = "\n"; continue; } @@ -726,7 +727,7 @@ class AssemblyCPlusPlusInterfaceAMD64 final CK_ASSEMBLY_INTERFACE { explicit AssemblyCPlusPlusInterfaceAMD64() = default; ~AssemblyCPlusPlusInterfaceAMD64() override = default; - NECTI_COPY_DEFAULT(AssemblyCPlusPlusInterfaceAMD64); + NECTAR_COPY_DEFAULT(AssemblyCPlusPlusInterfaceAMD64); UInt32 Arch() noexcept override { return CompilerKit::AssemblyFactory::kArchAMD64; } @@ -758,66 +759,66 @@ class AssemblyCPlusPlusInterfaceAMD64 final CK_ASSEMBLY_INTERFACE { #define kExtListCxx {".cpp", ".cc", ".cc", ".c++", ".cp"} -NECTI_MODULE(CompilerCPlusPlusAMD64) { +NECTAR_MODULE(CompilerCPlusPlusAMD64) { bool skip = false; - kKeywords.emplace_back("if", CompilerKit::kKeywordKindIf); - kKeywords.emplace_back("else", CompilerKit::kKeywordKindElse); - kKeywords.emplace_back("else if", CompilerKit::kKeywordKindElseIf); - - kKeywords.emplace_back("class", CompilerKit::kKeywordKindClass); - kKeywords.emplace_back("struct", CompilerKit::kKeywordKindClass); - kKeywords.emplace_back("namespace", CompilerKit::kKeywordKindNamespace); - kKeywords.emplace_back("typedef", CompilerKit::kKeywordKindTypedef); - kKeywords.emplace_back("using", CompilerKit::kKeywordKindTypedef); - kKeywords.emplace_back("{", CompilerKit::kKeywordKindBodyStart); - kKeywords.emplace_back("}", CompilerKit::kKeywordKindBodyEnd); - kKeywords.emplace_back("auto", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("int", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("bool", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("unsigned", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("short", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("char", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("long", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("float", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("double", CompilerKit::kKeywordKindType); - kKeywords.emplace_back("void", CompilerKit::kKeywordKindType); - - kKeywords.emplace_back("auto*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("int*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("bool*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("unsigned*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("short*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("char*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("long*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("float*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("double*", CompilerKit::kKeywordKindTypePtr); - kKeywords.emplace_back("void*", CompilerKit::kKeywordKindTypePtr); - - kKeywords.emplace_back("(", CompilerKit::kKeywordKindFunctionStart); - kKeywords.emplace_back(")", CompilerKit::kKeywordKindFunctionEnd); - kKeywords.emplace_back("=", CompilerKit::kKeywordKindVariableAssign); - kKeywords.emplace_back("+=", CompilerKit::kKeywordKindVariableInc); - kKeywords.emplace_back("-=", CompilerKit::kKeywordKindVariableDec); - kKeywords.emplace_back("const", CompilerKit::kKeywordKindConstant); - kKeywords.emplace_back("*", CompilerKit::kKeywordKindPtr); - kKeywords.emplace_back("->", CompilerKit::kKeywordKindPtrAccess); - kKeywords.emplace_back(".", CompilerKit::kKeywordKindAccess); - kKeywords.emplace_back(",", CompilerKit::kKeywordKindArgSeparator); - kKeywords.emplace_back(";", CompilerKit::kKeywordKindEndInstr); - kKeywords.emplace_back(":", CompilerKit::kKeywordKindSpecifier); - kKeywords.emplace_back("public:", CompilerKit::kKeywordKindSpecifier); - kKeywords.emplace_back("private:", CompilerKit::kKeywordKindSpecifier); - kKeywords.emplace_back("protected:", CompilerKit::kKeywordKindSpecifier); - kKeywords.emplace_back("final", CompilerKit::kKeywordKindSpecifier); - kKeywords.emplace_back("return", CompilerKit::kKeywordKindReturn); - kKeywords.emplace_back("/*", CompilerKit::kKeywordKindCommentMultiLineStart); - kKeywords.emplace_back("*/", CompilerKit::kKeywordKindCommentMultiLineEnd); - kKeywords.emplace_back("//", CompilerKit::kKeywordKindCommentInline); - kKeywords.emplace_back("==", CompilerKit::kKeywordKindEq); - kKeywords.emplace_back("!=", CompilerKit::kKeywordKindNotEq); - kKeywords.emplace_back(">=", CompilerKit::kKeywordKindGreaterEq); - kKeywords.emplace_back("<=", CompilerKit::kKeywordKindLessEq); + kKeywords.emplace_back("if", CompilerKit::KeywordKind::kKeywordKindIf); + kKeywords.emplace_back("else", CompilerKit::KeywordKind::kKeywordKindElse); + kKeywords.emplace_back("else if", CompilerKit::KeywordKind::kKeywordKindElseIf); + + kKeywords.emplace_back("class", CompilerKit::KeywordKind::kKeywordKindClass); + kKeywords.emplace_back("struct", CompilerKit::KeywordKind::kKeywordKindClass); + kKeywords.emplace_back("namespace", CompilerKit::KeywordKind::kKeywordKindNamespace); + kKeywords.emplace_back("typedef", CompilerKit::KeywordKind::kKeywordKindTypedef); + kKeywords.emplace_back("using", CompilerKit::KeywordKind::kKeywordKindTypedef); + kKeywords.emplace_back("{", CompilerKit::KeywordKind::kKeywordKindBodyStart); + kKeywords.emplace_back("}", CompilerKit::KeywordKind::kKeywordKindBodyEnd); + kKeywords.emplace_back("auto", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("int", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("bool", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("unsigned", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("short", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("char", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("long", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("float", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("double", CompilerKit::KeywordKind::kKeywordKindType); + kKeywords.emplace_back("void", CompilerKit::KeywordKind::kKeywordKindType); + + kKeywords.emplace_back("auto*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("int*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("bool*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("unsigned*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("short*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("char*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("long*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("float*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("double*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + kKeywords.emplace_back("void*", CompilerKit::KeywordKind::kKeywordKindTypePtr); + + kKeywords.emplace_back("(", CompilerKit::KeywordKind::kKeywordKindFunctionStart); + kKeywords.emplace_back(")", CompilerKit::KeywordKind::kKeywordKindFunctionEnd); + kKeywords.emplace_back("=", CompilerKit::KeywordKind::kKeywordKindVariableAssign); + kKeywords.emplace_back("+=", CompilerKit::KeywordKind::kKeywordKindVariableInc); + kKeywords.emplace_back("-=", CompilerKit::KeywordKind::kKeywordKindVariableDec); + kKeywords.emplace_back("const", CompilerKit::KeywordKind::kKeywordKindConstant); + kKeywords.emplace_back("*", CompilerKit::KeywordKind::kKeywordKindPtr); + kKeywords.emplace_back("->", CompilerKit::KeywordKind::kKeywordKindPtrAccess); + kKeywords.emplace_back(".", CompilerKit::KeywordKind::kKeywordKindAccess); + kKeywords.emplace_back(",", CompilerKit::KeywordKind::kKeywordKindArgSeparator); + kKeywords.emplace_back(";", CompilerKit::KeywordKind::kKeywordKindEndInstr); + kKeywords.emplace_back(":", CompilerKit::KeywordKind::kKeywordKindSpecifier); + kKeywords.emplace_back("public:", CompilerKit::KeywordKind::kKeywordKindSpecifier); + kKeywords.emplace_back("private:", CompilerKit::KeywordKind::kKeywordKindSpecifier); + kKeywords.emplace_back("protected:", CompilerKit::KeywordKind::kKeywordKindSpecifier); + kKeywords.emplace_back("final", CompilerKit::KeywordKind::kKeywordKindSpecifier); + kKeywords.emplace_back("return", CompilerKit::KeywordKind::kKeywordKindReturn); + kKeywords.emplace_back("/*", CompilerKit::KeywordKind::kKeywordKindCommentMultiLineStart); + kKeywords.emplace_back("*/", CompilerKit::KeywordKind::kKeywordKindCommentMultiLineEnd); + kKeywords.emplace_back("//", CompilerKit::KeywordKind::kKeywordKindCommentInline); + kKeywords.emplace_back("==", CompilerKit::KeywordKind::kKeywordKindEq); + kKeywords.emplace_back("!=", CompilerKit::KeywordKind::kKeywordKindNotEq); + kKeywords.emplace_back(">=", CompilerKit::KeywordKind::kKeywordKindGreaterEq); + kKeywords.emplace_back("<=", CompilerKit::KeywordKind::kKeywordKindLessEq); kErrorLimit = 0; @@ -852,7 +853,7 @@ NECTI_MODULE(CompilerCPlusPlusAMD64) { if (strcmp(argv[index], "-cxx-dialect") == 0) { if (kFrontend) std::cout << kFrontend->Language() << "\n"; - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } if (strcmp(argv[index], "-cxx-max-err") == 0) { @@ -884,7 +885,7 @@ NECTI_MODULE(CompilerCPlusPlusAMD64) { for (CompilerKit::STLString ext : exts) { if (argv_i.ends_with(ext)) { if (kAssembler.Compile(argv_i, kMachine) != EXIT_SUCCESS) { - return NECTI_INVALID_DATA; + return NECTAR_INVALID_DATA; } break; @@ -894,7 +895,7 @@ NECTI_MODULE(CompilerCPlusPlusAMD64) { kAssembler.Unmount(); - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } // diff --git a/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cc b/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cc index 205b005..0b240bd 100644 --- a/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cc +++ b/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cc @@ -69,7 +69,7 @@ static std::vector kObjectBytes; /// @brief Nectar 64-bit Linker. /// @note This linker is made for PEF executable, thus Nectar based OSes. -NECTI_MODULE(DynamicLinker64PEF) { +NECTAR_MODULE(DynamicLinker64PEF) { bool is_executable = true; CompilerKit::install_signal(SIGSEGV, CompilerKit::Detail::drvi_crash_handler); @@ -94,11 +94,11 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "-arm64: Output as a ARM64 PEF.\n"; kConsoleOut << "-output: Select the output file name.\n"; - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } else if (std::strcmp(argv[linker_arg], "-version") == 0) { kLinkerSplash(); - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } else if (std::strcmp(argv[linker_arg], "-fat") == 0) { kFatBinaryEnable = true; @@ -172,10 +172,10 @@ NECTI_MODULE(DynamicLinker64PEF) { if (kOutput.empty()) { kConsoleOut << "no output filename set." << std::endl; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } else if (kObjectList.empty()) { kConsoleOut << "no input files." << std::endl; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } else { namespace FS = std::filesystem; @@ -185,7 +185,7 @@ NECTI_MODULE(DynamicLinker64PEF) { // if filesystem doesn't find file // -> throw error. kConsoleOut << "no such file: " << obj << std::endl; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } } } @@ -193,7 +193,7 @@ NECTI_MODULE(DynamicLinker64PEF) { // PEF expects a valid target architecture when outputing a binary. if (kArch == CompilerKit::kPefArchInvalid) { kConsoleOut << "no target architecture set, can't continue." << std::endl; - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } CompilerKit::PEFContainer pef_container{}; @@ -223,7 +223,7 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "error: " << strerror(errno) << "\n"; } - return NECTI_FILE_NOT_FOUND; + return NECTAR_FILE_NOT_FOUND; } //! Read AE to convert as PEF. @@ -252,7 +252,7 @@ NECTI_MODULE(DynamicLinker64PEF) { "treated as a FAT binary." << std::endl; - return NECTI_FAT_ERROR; + return NECTAR_FAT_ERROR; } else { if (kVerbose) { kConsoleOut << "Architecture matches what we expect.\n"; @@ -347,7 +347,7 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "not an object container: " << objectFile << std::endl; // don't continue, it is a fatal error. - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } pef_container.Cpu = archs; @@ -630,7 +630,7 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "Multiple symbols of: " << symbol << " detected, cannot continue.\n"; } - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } // step 2.5: write program bytes. @@ -660,7 +660,7 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "Undefined symbol " << unreferenced_symbol << "\n"; } - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } if ((!kStartFound || kDuplicateSymbols) && @@ -669,10 +669,10 @@ NECTI_MODULE(DynamicLinker64PEF) { kConsoleOut << "File: " << kOutput << " is corrupt now...\n"; } - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } // Last rev 13-1-24 diff --git a/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc b/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc index cef97b1..9cae903 100644 --- a/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc +++ b/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc @@ -725,7 +725,7 @@ void bpp_parse_file(std::ifstream& hdr_file, std::ofstream& pp_out) { ///////////////////////////////////////////////////////////////////////////////////////// -NECTI_MODULE(CPlusPlusPreprocessorMain) { +NECTAR_MODULE(CPlusPlusPreprocessorMain) { try { bool skip = false; bool double_skip = false; @@ -806,7 +806,7 @@ NECTI_MODULE(CPlusPlusPreprocessorMain) { "NeKernel Preprocessor Driver v1.11, (c) Amlal El Mahrouss 2024-2025 all rights " "reserved."); - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } if (strcmp(argv[index], "-cpp-help") == 0) { @@ -819,7 +819,7 @@ NECTI_MODULE(CPlusPlusPreprocessorMain) { printf("%s\n", "-cpp-ver: print the version."); printf("%s\n", "-cpp-help: show help (this current command)."); - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } if (strcmp(argv[index], "-cpp-include-dir") == 0) { @@ -871,7 +871,7 @@ NECTI_MODULE(CPlusPlusPreprocessorMain) { kFiles.emplace_back(argv[index]); } - if (kFiles.empty()) return NECTI_EXEC_ERROR; + if (kFiles.empty()) return NECTAR_EXEC_ERROR; for (auto& file : kFiles) { if (!std::filesystem::exists(file)) continue; @@ -882,12 +882,12 @@ NECTI_MODULE(CPlusPlusPreprocessorMain) { bpp_parse_file(file_descriptor, file_descriptor_pp); } - return NECTI_SUCCESS; + return NECTAR_SUCCESS; } catch (const std::runtime_error& e) { std::cout << e.what() << '\n'; } - return NECTI_EXEC_ERROR; + return NECTAR_EXEC_ERROR; } // Last rev 8-1-24 -- cgit v1.2.3