From 553c820a8ae3b36b203af9c6524207b8d6e0658e Mon Sep 17 00:00:00 2001 From: augustin64 Date: Fri, 12 Jan 2024 14:10:23 +0100 Subject: [PATCH] Rename headers to .hpp --- Makefile | 4 ++-- src/analysis.cpp | 6 +++--- src/errors.cpp | 8 ++++---- src/execute.cpp | 2 +- src/include/{analysis.h => analysis.hpp} | 4 ++-- src/include/{colors.h => colors.hpp} | 0 src/include/{config.h => config.hpp} | 0 src/include/{errors.h => errors.hpp} | 2 +- src/include/{execute.h => execute.hpp} | 14 +++++++------- src/include/{input.h => input.hpp} | 0 src/include/{interpreter.h => interpreter.hpp} | 6 +++--- src/include/{memory.h => memory.hpp} | 4 ++-- src/include/{parser.h => parser.hpp} | 4 ++-- src/include/{tokenize.h => tokenize.hpp} | 2 +- src/include/{types.h => types.hpp} | 0 src/include/{utils.h => utils.hpp} | 2 +- src/input.cpp | 4 ++-- src/interpreter.cpp | 8 ++++---- src/main.cpp | 10 +++++----- src/memory.cpp | 8 ++++---- src/parser.cpp | 10 +++++----- src/tokenize.cpp | 4 ++-- src/utils.cpp | 2 +- test/arithmetic.cpp | 6 +++--- test/bool_logic.cpp | 6 +++--- test/functions.cpp | 6 +++--- test/include/{test.h => test.hpp} | 4 ++-- test/operators.cpp | 6 +++--- test/repl.cpp | 6 +++--- test/statements.cpp | 6 +++--- test/tokenize.cpp | 4 ++-- test/variables.cpp | 6 +++--- 32 files changed, 77 insertions(+), 77 deletions(-) rename src/include/{analysis.h => analysis.hpp} (79%) rename src/include/{colors.h => colors.hpp} (100%) rename src/include/{config.h => config.hpp} (100%) rename src/include/{errors.h => errors.hpp} (99%) rename src/include/{execute.h => execute.hpp} (64%) rename src/include/{input.h => input.hpp} (100%) rename src/include/{interpreter.h => interpreter.hpp} (91%) rename src/include/{memory.h => memory.hpp} (95%) rename src/include/{parser.h => parser.hpp} (97%) rename src/include/{tokenize.h => tokenize.hpp} (96%) rename src/include/{types.h => types.hpp} (100%) rename src/include/{utils.h => utils.hpp} (97%) rename test/include/{test.h => test.hpp} (95%) diff --git a/Makefile b/Makefile index a4c6d7c..2301798 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ TESTS_OBJ = $(TESTS_SRC:$(TEST_SRCDIR)/%.cpp=$(BUILDDIR)/test-%) LD_CXXFLAGS = # Compilation flag -CXXFLAGS = -Wall -Wextra -g -O0 -std=c++2a +CXXFLAGS = -Wall -Wextra -g -O3 -std=c++2a # Remove warnings about unused variables, functions, ... # -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable # Compile with debug @@ -26,7 +26,7 @@ $(BUILDDIR)/main: $(SRCDIR)/main.cpp $(OBJ) $(CXX) $^ -o $@ $(CXXFLAGS) $(LD_CXXFLAGS) -$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/include/%.h +$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/include/%.hpp $(CXX) -c $< -o $@ $(CXXFLAGS) diff --git a/src/analysis.cpp b/src/analysis.cpp index 21d5113..c861e10 100644 --- a/src/analysis.cpp +++ b/src/analysis.cpp @@ -1,7 +1,7 @@ #include -#include "include/utils.h" -#include "include/errors.h" -#include "include/analysis.h" +#include "include/utils.hpp" +#include "include/errors.hpp" +#include "include/analysis.hpp" bool bool_castable(AnalysisResult type) { (void)type; diff --git a/src/errors.cpp b/src/errors.cpp index d87d127..bd83dd0 100644 --- a/src/errors.cpp +++ b/src/errors.cpp @@ -4,10 +4,10 @@ #include using namespace std; -#include "include/utils.h" -#include "include/errors.h" -#include "include/colors.h" -#include "include/tokenize.h" +#include "include/utils.hpp" +#include "include/errors.hpp" +#include "include/colors.hpp" +#include "include/tokenize.hpp" string UserError::get_message(void) const { switch (this->type) { diff --git a/src/execute.cpp b/src/execute.cpp index 4da8db9..301577c 100644 --- a/src/execute.cpp +++ b/src/execute.cpp @@ -1,7 +1,7 @@ #include using namespace std; -#include "include/execute.h" +#include "include/execute.hpp" EvalResult execute(vector input, Memory& memory, int initial_line, ExecArgs args) { diff --git a/src/include/analysis.h b/src/include/analysis.hpp similarity index 79% rename from src/include/analysis.h rename to src/include/analysis.hpp index 1de657b..0fa24e9 100644 --- a/src/include/analysis.h +++ b/src/include/analysis.hpp @@ -1,8 +1,8 @@ #ifndef ANALYSIS_H #define ANALYSIS_H -#include "types.h" -#include "memory.h" +#include "types.hpp" +#include "memory.hpp" using namespace std; using AnalysisResult = variant; diff --git a/src/include/colors.h b/src/include/colors.hpp similarity index 100% rename from src/include/colors.h rename to src/include/colors.hpp diff --git a/src/include/config.h b/src/include/config.hpp similarity index 100% rename from src/include/config.h rename to src/include/config.hpp diff --git a/src/include/errors.h b/src/include/errors.hpp similarity index 99% rename from src/include/errors.h rename to src/include/errors.hpp index 24f8deb..611d1a2 100644 --- a/src/include/errors.h +++ b/src/include/errors.hpp @@ -4,7 +4,7 @@ #include using namespace std; -#include "tokenize.h" +#include "tokenize.hpp" /** * Errors diff --git a/src/include/execute.h b/src/include/execute.hpp similarity index 64% rename from src/include/execute.h rename to src/include/execute.hpp index 4208c5b..f63c8e8 100644 --- a/src/include/execute.h +++ b/src/include/execute.hpp @@ -1,13 +1,13 @@ #ifndef DEF_EXECUTE_H #define DEF_EXECUTE_H -#include "errors.h" -#include "parser.h" -#include "colors.h" -#include "memory.h" -#include "tokenize.h" -#include "analysis.h" -#include "interpreter.h" +#include "errors.hpp" +#include "parser.hpp" +#include "colors.hpp" +#include "memory.hpp" +#include "tokenize.hpp" +#include "analysis.hpp" +#include "interpreter.hpp" typedef struct ExecArgs { bool print_tokens=false; diff --git a/src/include/input.h b/src/include/input.hpp similarity index 100% rename from src/include/input.h rename to src/include/input.hpp diff --git a/src/include/interpreter.h b/src/include/interpreter.hpp similarity index 91% rename from src/include/interpreter.h rename to src/include/interpreter.hpp index 2ab3a42..1f8b8b1 100644 --- a/src/include/interpreter.h +++ b/src/include/interpreter.hpp @@ -3,9 +3,9 @@ #include #include -#include "types.h" -#include "memory.h" -#include "errors.h" +#include "types.hpp" +#include "memory.hpp" +#include "errors.hpp" using namespace std; /* diff --git a/src/include/memory.h b/src/include/memory.hpp similarity index 95% rename from src/include/memory.h rename to src/include/memory.hpp index 9fc69c3..304f3d5 100644 --- a/src/include/memory.h +++ b/src/include/memory.hpp @@ -5,8 +5,8 @@ #include #include #include -#include "types.h" -#include "colors.h" +#include "types.hpp" +#include "colors.hpp" using namespace std; class Memory { diff --git a/src/include/parser.h b/src/include/parser.hpp similarity index 97% rename from src/include/parser.h rename to src/include/parser.hpp index f746e2e..edf7fdb 100644 --- a/src/include/parser.h +++ b/src/include/parser.hpp @@ -5,8 +5,8 @@ #include #include #include -#include "tokenize.h" -#include "errors.h" +#include "tokenize.hpp" +#include "errors.hpp" using namespace std; /** diff --git a/src/include/tokenize.h b/src/include/tokenize.hpp similarity index 96% rename from src/include/tokenize.h rename to src/include/tokenize.hpp index 9a66f66..f8a8b8a 100644 --- a/src/include/tokenize.h +++ b/src/include/tokenize.hpp @@ -4,7 +4,7 @@ #include #include #include -#include "types.h" +#include "types.hpp" using namespace std; /* diff --git a/src/include/types.h b/src/include/types.hpp similarity index 100% rename from src/include/types.h rename to src/include/types.hpp diff --git a/src/include/utils.h b/src/include/utils.hpp similarity index 97% rename from src/include/utils.h rename to src/include/utils.hpp index be847ed..e2bd64b 100644 --- a/src/include/utils.h +++ b/src/include/utils.hpp @@ -1,7 +1,7 @@ #ifndef DEF_UTILS_H #define DEF_UTILS_H -#include "types.h" +#include "types.hpp" using namespace std; /** diff --git a/src/input.cpp b/src/input.cpp index 4f0d436..d508e06 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -6,8 +6,8 @@ #include // for tc(get/set)attr using namespace std; -#include "include/config.h" -#include "include/colors.h" +#include "include/config.hpp" +#include "include/colors.hpp" char silent_get_char() { // Get char without echoing it diff --git a/src/interpreter.cpp b/src/interpreter.cpp index 5181935..9fdc247 100644 --- a/src/interpreter.cpp +++ b/src/interpreter.cpp @@ -1,10 +1,10 @@ #include #include #include -#include "include/parser.h" -#include "include/interpreter.h" -#include "include/memory.h" -#include "include/utils.h" +#include "include/parser.hpp" +#include "include/interpreter.hpp" +#include "include/memory.hpp" +#include "include/utils.hpp" using namespace std; bool bool_cast(EvalResult value) { diff --git a/src/main.cpp b/src/main.cpp index 2fe9719..ee9eedd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,11 +2,11 @@ #include using namespace std; -#include "include/input.h" -#include "include/errors.h" -#include "include/colors.h" -#include "include/execute.h" -#include "include/memory.h" +#include "include/input.hpp" +#include "include/errors.hpp" +#include "include/colors.hpp" +#include "include/execute.hpp" +#include "include/memory.hpp" void show_help(char* prog_name) { printf("Usage: %s [OPTIONS]\n\n", prog_name); diff --git a/src/memory.cpp b/src/memory.cpp index 6de4257..9bb7ffd 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -1,7 +1,7 @@ -#include "include/memory.h" -#include "include/errors.h" -#include "include/utils.h" -#include "include/types.h" +#include "include/memory.hpp" +#include "include/errors.hpp" +#include "include/utils.hpp" +#include "include/types.hpp" using namespace std; Memory::Memory(void) { diff --git a/src/parser.cpp b/src/parser.cpp index d9bee39..96a08a6 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -3,11 +3,11 @@ #include using namespace std; -#include "include/tokenize.h" -#include "include/colors.h" -#include "include/parser.h" -#include "include/config.h" -#include "include/utils.h" +#include "include/tokenize.hpp" +#include "include/colors.hpp" +#include "include/parser.hpp" +#include "include/config.hpp" +#include "include/utils.hpp" CodePosition null_pos = { .line = -1, diff --git a/src/tokenize.cpp b/src/tokenize.cpp index d872616..1ad7576 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -2,8 +2,8 @@ #include #include #include -#include "include/errors.h" -#include "include/tokenize.h" +#include "include/errors.hpp" +#include "include/tokenize.hpp" using namespace std; regex INT_REGEX ("\\d+"); diff --git a/src/utils.cpp b/src/utils.cpp index 569dfb5..ab99e75 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -3,7 +3,7 @@ #include #include -#include "include/utils.h" +#include "include/utils.hpp" CodePosition get_node_pos(Node node) { if (holds_alternative(node)) diff --git a/test/arithmetic.cpp b/test/arithmetic.cpp index acf20f5..643e741 100644 --- a/test/arithmetic.cpp +++ b/test/arithmetic.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" int execute(string s) { Memory memory; diff --git a/test/bool_logic.cpp b/test/bool_logic.cpp index db2ec12..8c87ca1 100644 --- a/test/bool_logic.cpp +++ b/test/bool_logic.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" int execute(string s) { Memory memory; diff --git a/test/functions.cpp b/test/functions.cpp index 4c99acd..446ed92 100644 --- a/test/functions.cpp +++ b/test/functions.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" EvalResult execute(string s) { Memory memory; diff --git a/test/include/test.h b/test/include/test.hpp similarity index 95% rename from test/include/test.h rename to test/include/test.hpp index 84c15c3..1ca195b 100644 --- a/test/include/test.h +++ b/test/include/test.hpp @@ -1,8 +1,8 @@ #ifndef DEF_TEST_H #define DEF_TEST_H -#include "../../src/include/colors.h" -#include "../../src/include/errors.h" +#include "../../src/include/colors.hpp" +#include "../../src/include/errors.hpp" #define _TEST_PRESENTATION(description) { printf("\n" BLUE "#### %s:" BOLD "%s" RESET BLUE " #####" RESET "\n", __FILE__, description); } diff --git a/test/operators.cpp b/test/operators.cpp index c5fbbe5..a0229fd 100644 --- a/test/operators.cpp +++ b/test/operators.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" int execute(string s) { Memory memory; diff --git a/test/repl.cpp b/test/repl.cpp index 50b2d56..e16ad3f 100644 --- a/test/repl.cpp +++ b/test/repl.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" EvalResult execute(string s, Memory& memory) { return execute(split_string(s, '\n'), memory); diff --git a/test/statements.cpp b/test/statements.cpp index c1604bc..4dd4e32 100644 --- a/test/statements.cpp +++ b/test/statements.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" EvalResult execute(string s) { Memory memory; diff --git a/test/tokenize.cpp b/test/tokenize.cpp index 95fc9bf..5fa2f8e 100644 --- a/test/tokenize.cpp +++ b/test/tokenize.cpp @@ -2,9 +2,9 @@ #include using namespace std; -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/tokenize.h" +#include "../src/include/tokenize.hpp" int main() { _TEST_PRESENTATION("Lexer"); diff --git a/test/variables.cpp b/test/variables.cpp index 3b1e6cc..68e17fc 100644 --- a/test/variables.cpp +++ b/test/variables.cpp @@ -1,7 +1,7 @@ -#include "include/test.h" +#include "include/test.hpp" -#include "../src/include/execute.h" -#include "../src/include/utils.h" +#include "../src/include/execute.hpp" +#include "../src/include/utils.hpp" EvalResult execute(string s) { Memory memory;