Rename headers to .hpp

This commit is contained in:
augustin64 2024-01-12 14:10:23 +01:00
parent 5d0f86545e
commit 553c820a8a
32 changed files with 77 additions and 77 deletions

View File

@ -14,7 +14,7 @@ TESTS_OBJ = $(TESTS_SRC:$(TEST_SRCDIR)/%.cpp=$(BUILDDIR)/test-%)
LD_CXXFLAGS = LD_CXXFLAGS =
# Compilation flag # Compilation flag
CXXFLAGS = -Wall -Wextra -g -O0 -std=c++2a CXXFLAGS = -Wall -Wextra -g -O3 -std=c++2a
# Remove warnings about unused variables, functions, ... # Remove warnings about unused variables, functions, ...
# -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable # -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable
# Compile with debug # Compile with debug
@ -26,7 +26,7 @@ $(BUILDDIR)/main: $(SRCDIR)/main.cpp $(OBJ)
$(CXX) $^ -o $@ $(CXXFLAGS) $(LD_CXXFLAGS) $(CXX) $^ -o $@ $(CXXFLAGS) $(LD_CXXFLAGS)
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/include/%.h $(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/include/%.hpp
$(CXX) -c $< -o $@ $(CXXFLAGS) $(CXX) -c $< -o $@ $(CXXFLAGS)

View File

@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include "include/utils.h" #include "include/utils.hpp"
#include "include/errors.h" #include "include/errors.hpp"
#include "include/analysis.h" #include "include/analysis.hpp"
bool bool_castable(AnalysisResult type) { bool bool_castable(AnalysisResult type) {
(void)type; (void)type;

View File

@ -4,10 +4,10 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include "include/utils.h" #include "include/utils.hpp"
#include "include/errors.h" #include "include/errors.hpp"
#include "include/colors.h" #include "include/colors.hpp"
#include "include/tokenize.h" #include "include/tokenize.hpp"
string UserError::get_message(void) const { string UserError::get_message(void) const {
switch (this->type) { switch (this->type) {

View File

@ -1,7 +1,7 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
#include "include/execute.h" #include "include/execute.hpp"
EvalResult execute(vector<string> input, Memory& memory, int initial_line, ExecArgs args) { EvalResult execute(vector<string> input, Memory& memory, int initial_line, ExecArgs args) {

View File

@ -1,8 +1,8 @@
#ifndef ANALYSIS_H #ifndef ANALYSIS_H
#define ANALYSIS_H #define ANALYSIS_H
#include "types.h" #include "types.hpp"
#include "memory.h" #include "memory.hpp"
using namespace std; using namespace std;
using AnalysisResult = variant<Type, monostate>; using AnalysisResult = variant<Type, monostate>;

View File

@ -4,7 +4,7 @@
#include <string> #include <string>
using namespace std; using namespace std;
#include "tokenize.h" #include "tokenize.hpp"
/** /**
* Errors * Errors

View File

@ -1,13 +1,13 @@
#ifndef DEF_EXECUTE_H #ifndef DEF_EXECUTE_H
#define DEF_EXECUTE_H #define DEF_EXECUTE_H
#include "errors.h" #include "errors.hpp"
#include "parser.h" #include "parser.hpp"
#include "colors.h" #include "colors.hpp"
#include "memory.h" #include "memory.hpp"
#include "tokenize.h" #include "tokenize.hpp"
#include "analysis.h" #include "analysis.hpp"
#include "interpreter.h" #include "interpreter.hpp"
typedef struct ExecArgs { typedef struct ExecArgs {
bool print_tokens=false; bool print_tokens=false;

View File

@ -3,9 +3,9 @@
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include "types.h" #include "types.hpp"
#include "memory.h" #include "memory.hpp"
#include "errors.h" #include "errors.hpp"
using namespace std; using namespace std;
/* /*

View File

@ -5,8 +5,8 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <optional> #include <optional>
#include "types.h" #include "types.hpp"
#include "colors.h" #include "colors.hpp"
using namespace std; using namespace std;
class Memory { class Memory {

View File

@ -5,8 +5,8 @@
#include <variant> #include <variant>
#include <optional> #include <optional>
#include <stdexcept> #include <stdexcept>
#include "tokenize.h" #include "tokenize.hpp"
#include "errors.h" #include "errors.hpp"
using namespace std; using namespace std;
/** /**

View File

@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include "types.h" #include "types.hpp"
using namespace std; using namespace std;
/* /*

View File

@ -1,7 +1,7 @@
#ifndef DEF_UTILS_H #ifndef DEF_UTILS_H
#define DEF_UTILS_H #define DEF_UTILS_H
#include "types.h" #include "types.hpp"
using namespace std; using namespace std;
/** /**

View File

@ -6,8 +6,8 @@
#include <termios.h> // for tc(get/set)attr #include <termios.h> // for tc(get/set)attr
using namespace std; using namespace std;
#include "include/config.h" #include "include/config.hpp"
#include "include/colors.h" #include "include/colors.hpp"
char silent_get_char() { // Get char without echoing it char silent_get_char() { // Get char without echoing it

View File

@ -1,10 +1,10 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "include/parser.h" #include "include/parser.hpp"
#include "include/interpreter.h" #include "include/interpreter.hpp"
#include "include/memory.h" #include "include/memory.hpp"
#include "include/utils.h" #include "include/utils.hpp"
using namespace std; using namespace std;
bool bool_cast(EvalResult value) { bool bool_cast(EvalResult value) {

View File

@ -2,11 +2,11 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include "include/input.h" #include "include/input.hpp"
#include "include/errors.h" #include "include/errors.hpp"
#include "include/colors.h" #include "include/colors.hpp"
#include "include/execute.h" #include "include/execute.hpp"
#include "include/memory.h" #include "include/memory.hpp"
void show_help(char* prog_name) { void show_help(char* prog_name) {
printf("Usage: %s [OPTIONS]\n\n", prog_name); printf("Usage: %s [OPTIONS]\n\n", prog_name);

View File

@ -1,7 +1,7 @@
#include "include/memory.h" #include "include/memory.hpp"
#include "include/errors.h" #include "include/errors.hpp"
#include "include/utils.h" #include "include/utils.hpp"
#include "include/types.h" #include "include/types.hpp"
using namespace std; using namespace std;
Memory::Memory(void) { Memory::Memory(void) {

View File

@ -3,11 +3,11 @@
#include <algorithm> #include <algorithm>
using namespace std; using namespace std;
#include "include/tokenize.h" #include "include/tokenize.hpp"
#include "include/colors.h" #include "include/colors.hpp"
#include "include/parser.h" #include "include/parser.hpp"
#include "include/config.h" #include "include/config.hpp"
#include "include/utils.h" #include "include/utils.hpp"
CodePosition null_pos = { CodePosition null_pos = {
.line = -1, .line = -1,

View File

@ -2,8 +2,8 @@
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "include/errors.h" #include "include/errors.hpp"
#include "include/tokenize.h" #include "include/tokenize.hpp"
using namespace std; using namespace std;
regex INT_REGEX ("\\d+"); regex INT_REGEX ("\\d+");

View File

@ -3,7 +3,7 @@
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include "include/utils.h" #include "include/utils.hpp"
CodePosition get_node_pos(Node node) { CodePosition get_node_pos(Node node) {
if (holds_alternative<InnerNode>(node)) if (holds_alternative<InnerNode>(node))

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
int execute(string s) { int execute(string s) {
Memory memory; Memory memory;

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
int execute(string s) { int execute(string s) {
Memory memory; Memory memory;

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
EvalResult execute(string s) { EvalResult execute(string s) {
Memory memory; Memory memory;

View File

@ -1,8 +1,8 @@
#ifndef DEF_TEST_H #ifndef DEF_TEST_H
#define DEF_TEST_H #define DEF_TEST_H
#include "../../src/include/colors.h" #include "../../src/include/colors.hpp"
#include "../../src/include/errors.h" #include "../../src/include/errors.hpp"
#define _TEST_PRESENTATION(description) { printf("\n" BLUE "#### %s:" BOLD "%s" RESET BLUE " #####" RESET "\n", __FILE__, description); } #define _TEST_PRESENTATION(description) { printf("\n" BLUE "#### %s:" BOLD "%s" RESET BLUE " #####" RESET "\n", __FILE__, description); }

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
int execute(string s) { int execute(string s) {
Memory memory; Memory memory;

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
EvalResult execute(string s, Memory& memory) { EvalResult execute(string s, Memory& memory) {
return execute(split_string(s, '\n'), memory); return execute(split_string(s, '\n'), memory);

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
EvalResult execute(string s) { EvalResult execute(string s) {
Memory memory; Memory memory;

View File

@ -2,9 +2,9 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/tokenize.h" #include "../src/include/tokenize.hpp"
int main() { int main() {
_TEST_PRESENTATION("Lexer"); _TEST_PRESENTATION("Lexer");

View File

@ -1,7 +1,7 @@
#include "include/test.h" #include "include/test.hpp"
#include "../src/include/execute.h" #include "../src/include/execute.hpp"
#include "../src/include/utils.h" #include "../src/include/utils.hpp"
EvalResult execute(string s) { EvalResult execute(string s) {
Memory memory; Memory memory;