From c6d2bf69d209edf820b958a42039c8df5416ff85 Mon Sep 17 00:00:00 2001 From: anon Date: Wed, 19 Jun 2024 13:01:30 +0200 Subject: [PATCH] renamed confusingly named scanners --- Makefile | 2 +- source/cli.cpp | 4 ++-- source/cli.hpp | 2 +- source/{csml.l => from_csml_to_xml.l} | 0 source/{xml.l => from_xml_to_csml.l} | 0 source/main.cpp | 10 ++++++---- source/scanner.hpp | 6 ++++-- 7 files changed, 14 insertions(+), 10 deletions(-) rename source/{csml.l => from_csml_to_xml.l} (100%) rename source/{xml.l => from_xml_to_csml.l} (100%) diff --git a/Makefile b/Makefile index b0843cc..6e2145a 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ OBJECT.d := object/ TEST.d := test/ INSTALL.d := /bin/ -SOURCE := main.cpp xml.cpp csml.cpp cli.cpp html_special.cpp +SOURCE := main.cpp from_xml_to_csml.cpp from_csml_to_xml.cpp cli.cpp html_special.cpp OBJECT := $(addprefix ${OBJECT.d}/,${SOURCE}) OBJECT := ${OBJECT:.cpp=.o} OBJECT := ${OBJECT:.c=.o} diff --git a/source/cli.cpp b/source/cli.cpp index 2d8d1b2..98192e1 100644 --- a/source/cli.cpp +++ b/source/cli.cpp @@ -143,13 +143,13 @@ signed parse_round2_arguments(int argc, char * * argv) { switch (input_type) { case input_type_t::CSML: { - yylex(csml_in, csml_out, csml_lex); + yylex(from_csml_to_xml_in, from_csml_to_xml_out, from_csml_to_xml_lex); if (not tag_stack.empty()) { exit(POLUTED_STACK); } } break; case input_type_t::XML: { - yylex(xml_in, xml_out, xml_lex); + yylex(from_xml_to_csml_in, from_xml_to_csml_out, from_xml_to_csml_lex); if (not tag_stack.empty()) { exit(POLUTED_STACK); } diff --git a/source/cli.hpp b/source/cli.hpp index 8fcc798..d475637 100644 --- a/source/cli.hpp +++ b/source/cli.hpp @@ -12,7 +12,7 @@ extern "C" void usage(void); extern "C" signed parse_colon_list(char * const list, std::vector destination); extern "C" signed parse_sets(char * const list); -/* Parse arguments with perminant effects (-h) +/* Parse arguments with global effects (-h) * Perform validation. */ extern "C" signed parse_round1_arguments(int argc, char * * argv); diff --git a/source/csml.l b/source/from_csml_to_xml.l similarity index 100% rename from source/csml.l rename to source/from_csml_to_xml.l diff --git a/source/xml.l b/source/from_xml_to_csml.l similarity index 100% rename from source/xml.l rename to source/from_xml_to_csml.l diff --git a/source/main.cpp b/source/main.cpp index 0681095..ab8cec1 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -10,6 +10,7 @@ #include "scanner.hpp" #include "exit_values.hpp" +// Define declared variables from 'scanner.hpp' here std::vector ignore_list; std::vector asymmetric_special_list; @@ -19,9 +20,10 @@ std::string buffer; std::string tag_candidate; std::stack tag_stack; +/* --------------- */ -extern int xml_lex_destroy(void); -extern int csml_lex_destroy(void); +extern int from_xml_to_csml_lex_destroy(void); +extern int from_csml_to_xml_lex_destroy(void); char * output_name_from_input_name(const char * const input, const char * const extension) { char * input_duplicate = strdup(input); @@ -87,8 +89,8 @@ signed main(int argc, char * * argv) { usage(); } - xml_lex_destroy(); - csml_lex_destroy(); + from_xml_to_csml_lex_destroy(); + from_csml_to_xml_lex_destroy(); return EXIT_SUCCESS; } diff --git a/source/scanner.hpp b/source/scanner.hpp index 8683af9..dbae9b2 100644 --- a/source/scanner.hpp +++ b/source/scanner.hpp @@ -5,14 +5,16 @@ #include #include +// NOTE: definitions are in 'main.cpp' + #define DECLARE_LEXER(x) \ extern FILE * x ## _in; \ extern FILE * x ## _out; \ extern int x ## _lex(void); \ extern int x ## _lex_destroy(void); -DECLARE_LEXER(csml); -DECLARE_LEXER(xml); +DECLARE_LEXER(from_csml_to_xml); +DECLARE_LEXER(from_xml_to_csml); #define ECHOS(s) do { \ const char * const ss = s; \