From 5c477779725a958d343594b6c03e59409375f7ea Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 21 Aug 2023 21:40:23 -0400 Subject: [PATCH] compiles agian... --- project/auxillary/builder.cpp | 2 ++ project/auxillary/builder.hpp | 3 +++ project/auxillary/editor.hpp | 6 ------ project/auxillary/scanner.cpp | 2 +- project/auxillary/scanner.hpp | 5 ++++- project/components/ast.cpp | 2 +- project/components/ast.hpp | 8 ++++---- project/components/ast_types.hpp | 2 +- project/components/header_end.hpp | 12 ++++++------ project/components/header_start.hpp | 2 ++ project/components/inlines.hpp | 2 +- project/components/interface.cpp | 2 +- project/components/interface.hpp | 2 +- project/components/interface.parsing.cpp | 4 ++-- project/components/interface.untyped.cpp | 2 +- project/components/interface.upfront.cpp | 2 +- project/components/static_data.cpp | 4 ++-- project/components/types.hpp | 2 +- project/dependencies/basic_types.hpp | 2 +- project/dependencies/containers.hpp | 2 +- project/dependencies/debug.cpp | 2 +- project/dependencies/debug.hpp | 2 +- project/dependencies/filesystem.cpp | 2 +- project/dependencies/filesystem.hpp | 2 +- project/dependencies/hashing.cpp | 2 +- project/dependencies/hashing.hpp | 2 +- project/dependencies/header_start.hpp | 2 ++ project/dependencies/macros.hpp | 2 +- project/dependencies/memory.cpp | 2 +- project/dependencies/memory.hpp | 2 +- project/dependencies/parsing.cpp | 2 ++ project/dependencies/parsing.hpp | 2 ++ project/dependencies/printing.cpp | 2 +- project/dependencies/printing.hpp | 2 +- project/dependencies/string_ops.cpp | 2 +- project/dependencies/string_ops.hpp | 2 +- project/dependencies/strings.cpp | 2 +- project/dependencies/strings.hpp | 2 +- project/dependencies/timing.cpp | 2 +- project/dependencies/timing.hpp | 2 +- project/gen.cpp | 4 ++-- project/gen.dep.cpp | 4 ++-- project/gen.dep.hpp | 4 ++-- project/gen.hpp | 4 ++-- project/helpers/helper.hpp | 12 +++--------- 45 files changed, 70 insertions(+), 66 deletions(-) diff --git a/project/auxillary/builder.cpp b/project/auxillary/builder.cpp index 694d81c..0ba2a7b 100644 --- a/project/auxillary/builder.cpp +++ b/project/auxillary/builder.cpp @@ -1,3 +1,5 @@ +#include "builder.hpp" + Builder Builder::open( char const* path ) { Builder result; diff --git a/project/auxillary/builder.hpp b/project/auxillary/builder.hpp index 6571c40..ecb459a 100644 --- a/project/auxillary/builder.hpp +++ b/project/auxillary/builder.hpp @@ -1,3 +1,6 @@ +#pragma once +#include "gen.hpp" + struct Builder { FileInfo File; diff --git a/project/auxillary/editor.hpp b/project/auxillary/editor.hpp index a82fe47..c8eae23 100644 --- a/project/auxillary/editor.hpp +++ b/project/auxillary/editor.hpp @@ -1,9 +1,6 @@ #pragma once - #include "gen.scanner.hpp" -namespace gen { - struct Policy { // Nothing for now. @@ -68,6 +65,3 @@ struct Editor bool process_requests( Array out_receipts ); }; - -// namespace gen -}; diff --git a/project/auxillary/scanner.cpp b/project/auxillary/scanner.cpp index 8b13789..871616e 100644 --- a/project/auxillary/scanner.cpp +++ b/project/auxillary/scanner.cpp @@ -1 +1 @@ - +#include "scanner.hpp" diff --git a/project/auxillary/scanner.hpp b/project/auxillary/scanner.hpp index b070a61..a16dc06 100644 --- a/project/auxillary/scanner.hpp +++ b/project/auxillary/scanner.hpp @@ -1,3 +1,6 @@ +#pragma once +#include "gen.hpp" + // This is a simple file reader that reads the entire file into memory. // It has an extra option to skip the first few lines for undesired includes. // This is done so that includes can be kept in dependency and component files so that intellisense works. @@ -48,7 +51,7 @@ Code scan_file( char const* path, bool skip_header_includes = true ) } // Skip the line - sptr skip_size = sptr( scanner - str ); + sptr skip_size = sptr( scanner - str.Data ); if ( current == '\r' ) { skip_size += 2; diff --git a/project/components/ast.cpp b/project/components/ast.cpp index 0fd04f3..e89eaf3 100644 --- a/project/components/ast.cpp +++ b/project/components/ast.cpp @@ -1,5 +1,5 @@ #pragma once -#include "static_data.cpp" +// #include "static_data.cpp" Code Code::Global; Code Code::Invalid; diff --git a/project/components/ast.hpp b/project/components/ast.hpp index 580f4d7..4216d8e 100644 --- a/project/components/ast.hpp +++ b/project/components/ast.hpp @@ -1,8 +1,8 @@ #pragma once -#include "types.hpp" -#include "temp/ecode.hpp" -#include "temp/eoperator.hpp" -#include "temp/especifier.hpp" +// #include "types.hpp" +// #include "temp/ecode.hpp" +// #include "temp/eoperator.hpp" +// #include "temp/especifier.hpp" struct AST; struct AST_Body; diff --git a/project/components/ast_types.hpp b/project/components/ast_types.hpp index 8a8c54c..190170d 100644 --- a/project/components/ast_types.hpp +++ b/project/components/ast_types.hpp @@ -1,5 +1,5 @@ #pragma once -#include "ast.hpp" +// #include "ast.hpp" #pragma region AST Types /* diff --git a/project/components/header_end.hpp b/project/components/header_end.hpp index d194cd7..1ce81d1 100644 --- a/project/components/header_end.hpp +++ b/project/components/header_end.hpp @@ -1,6 +1,6 @@ #pragma once -#include "inlines.hpp" -#include "temp/ast_inlines.hpp" +// #include "inlines.hpp" +// #include "temp/ast_inlines.hpp" #pragma region Constants @@ -77,7 +77,7 @@ extern CodeSpecifiers spec_constexpr; extern CodeSpecifiers spec_constinit; extern CodeSpecifiers spec_extern_linkage; extern CodeSpecifiers spec_final; -extern CodeSpeciifers spec_forceinline; +extern CodeSpecifiers spec_forceinline; extern CodeSpecifiers spec_global; extern CodeSpecifiers spec_inline; extern CodeSpecifiers spec_internal_linkage; @@ -144,11 +144,11 @@ extern CodeType t_typename; # define args( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__ -# define code_str( ... ) gen::untyped_str( code( __VA_ARGS__ ) ) -# define code_fmt( ... ) gen::untyped_str( token_fmt( __VA_ARGS__ ) ) +# define code_str( ... ) GEN_NS untyped_str( code( __VA_ARGS__ ) ) +# define code_fmt( ... ) GEN_NS untyped_str( token_fmt( __VA_ARGS__ ) ) // Takes a format string (char const*) and a list of tokens (StrC) and returns a StrC of the formatted string. -# define token_fmt( ... ) gen::token_fmt_impl( (num_args( __VA_ARGS__ ) + 1) / 2, __VA_ARGS__ ) +# define token_fmt( ... ) GEN_NS token_fmt_impl( (num_args( __VA_ARGS__ ) + 1) / 2, __VA_ARGS__ ) #pragma endregion Macros diff --git a/project/components/header_start.hpp b/project/components/header_start.hpp index 2d7c4ed..571f370 100644 --- a/project/components/header_start.hpp +++ b/project/components/header_start.hpp @@ -20,9 +20,11 @@ #ifndef GEN_NS_BEGIN # ifdef GEN_DONT_USE_NAMESPACE +# define GEN_NS # define GEN_NS_BEGIN # define GEN_NS_END # else +# define GEN_NS gen:: # define GEN_NS_BEGIN namespace gen { # define GEN_NS_END } # endif diff --git a/project/components/inlines.hpp b/project/components/inlines.hpp index 06b0d51..9ad9241 100644 --- a/project/components/inlines.hpp +++ b/project/components/inlines.hpp @@ -1,5 +1,5 @@ #pragma once -#include "interface.hpp" +// #include "interface.hpp" void AST::append( AST* other ) { diff --git a/project/components/interface.cpp b/project/components/interface.cpp index f3f3ae1..a1748dc 100644 --- a/project/components/interface.cpp +++ b/project/components/interface.cpp @@ -1,5 +1,5 @@ #pragma once -#include "ast.cpp" +// #include "ast.cpp" internal void init_parser(); internal void deinit_parser(); diff --git a/project/components/interface.hpp b/project/components/interface.hpp index 4b90046..1250127 100644 --- a/project/components/interface.hpp +++ b/project/components/interface.hpp @@ -1,5 +1,5 @@ #pragma once -#include "ast_types.hpp" +// #include "ast_types.hpp" #pragma region Gen Interface diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp index 1760041..c3a8a79 100644 --- a/project/components/interface.parsing.cpp +++ b/project/components/interface.parsing.cpp @@ -1,6 +1,6 @@ #pragma once -#include "temp/etoktype.cpp" -#include "interface.upfront.cpp" +// #include "temp/etoktype.cpp" +// #include "interface.upfront.cpp" namespace Parser { diff --git a/project/components/interface.untyped.cpp b/project/components/interface.untyped.cpp index ceb65b2..4c79673 100644 --- a/project/components/interface.untyped.cpp +++ b/project/components/interface.untyped.cpp @@ -1,5 +1,5 @@ #pragma once -#include "interface.parsing.cpp" +// #include "interface.parsing.cpp" sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va ) { diff --git a/project/components/interface.upfront.cpp b/project/components/interface.upfront.cpp index 4e49d41..a92c0cd 100644 --- a/project/components/interface.upfront.cpp +++ b/project/components/interface.upfront.cpp @@ -1,5 +1,5 @@ #pragma once -#include "interface.cpp" +// #include "interface.cpp" #pragma region Upfront diff --git a/project/components/static_data.cpp b/project/components/static_data.cpp index b2701d9..6496d4f 100644 --- a/project/components/static_data.cpp +++ b/project/components/static_data.cpp @@ -1,5 +1,5 @@ #pragma once -#include "src_start.cpp" +// #include "src_start.cpp" #pragma region StaticData @@ -50,7 +50,7 @@ global CodeSpecifiers spec_constexpr; global CodeSpecifiers spec_constinit; global CodeSpecifiers spec_extern_linkage; global CodeSpecifiers spec_final; -global CodeSpeciifers spec_forceinline; +global CodeSpecifiers spec_forceinline; global CodeSpecifiers spec_global; global CodeSpecifiers spec_inline; global CodeSpecifiers spec_internal_linkage; diff --git a/project/components/types.hpp b/project/components/types.hpp index 7f16a2f..633128f 100644 --- a/project/components/types.hpp +++ b/project/components/types.hpp @@ -1,5 +1,5 @@ #pragma once -#include "header_start.hpp" +// #include "header_start.hpp" using LogFailType = sw(*)(char const*, ...); diff --git a/project/dependencies/basic_types.hpp b/project/dependencies/basic_types.hpp index 6dc3693..4822da6 100644 --- a/project/dependencies/basic_types.hpp +++ b/project/dependencies/basic_types.hpp @@ -1,5 +1,5 @@ #pragma once -#include "macros.hpp" +// #include "macros.hpp" #pragma region Basic Types diff --git a/project/dependencies/containers.hpp b/project/dependencies/containers.hpp index 1c77aea..d9dc9e2 100644 --- a/project/dependencies/containers.hpp +++ b/project/dependencies/containers.hpp @@ -1,5 +1,5 @@ #pragma once -#include "printing.hpp" +// #include "printing.hpp" #pragma region Containers diff --git a/project/dependencies/debug.cpp b/project/dependencies/debug.cpp index a3d044b..a6b77d8 100644 --- a/project/dependencies/debug.cpp +++ b/project/dependencies/debug.cpp @@ -1,5 +1,5 @@ #pragma once -#include "src_start.cpp" +// #include "src_start.cpp" #pragma region Debug diff --git a/project/dependencies/debug.hpp b/project/dependencies/debug.hpp index 8e8fba1..4490ece 100644 --- a/project/dependencies/debug.hpp +++ b/project/dependencies/debug.hpp @@ -1,5 +1,5 @@ #pragma once -#include "basic_types.hpp" +// #include "basic_types.hpp" #pragma region Debug diff --git a/project/dependencies/filesystem.cpp b/project/dependencies/filesystem.cpp index 1861e9a..ef09251 100644 --- a/project/dependencies/filesystem.cpp +++ b/project/dependencies/filesystem.cpp @@ -1,5 +1,5 @@ #pragma once -#include "strings.cpp" +// #include "strings.cpp" #pragma region File Handling diff --git a/project/dependencies/filesystem.hpp b/project/dependencies/filesystem.hpp index 113f839..4e90c1e 100644 --- a/project/dependencies/filesystem.hpp +++ b/project/dependencies/filesystem.hpp @@ -1,5 +1,5 @@ #pragma once -#include "strings.hpp" +// #include "strings.hpp" #pragma region File Handling diff --git a/project/dependencies/hashing.cpp b/project/dependencies/hashing.cpp index 2294810..93d1d51 100644 --- a/project/dependencies/hashing.cpp +++ b/project/dependencies/hashing.cpp @@ -1,5 +1,5 @@ #pragma once -#include "memory.cpp" +// #include "memory.cpp" #pragma region Hashing diff --git a/project/dependencies/hashing.hpp b/project/dependencies/hashing.hpp index 4b70f4a..32ba253 100644 --- a/project/dependencies/hashing.hpp +++ b/project/dependencies/hashing.hpp @@ -1,5 +1,5 @@ #pragma once -#include "containers.hpp" +// #include "containers.hpp" #pragma region Hashing diff --git a/project/dependencies/header_start.hpp b/project/dependencies/header_start.hpp index e7c1379..e314c43 100644 --- a/project/dependencies/header_start.hpp +++ b/project/dependencies/header_start.hpp @@ -116,9 +116,11 @@ #pragma endregion Mandatory Includes #ifdef GEN_DONT_USE_NAMESPACE +# define GEN_NS # define GEN_NS_BEGIN # define GEN_NS_END #else +# define GEN_NS gen:: # define GEN_NS_BEGIN namespace gen { # define GEN_NS_END } #endif diff --git a/project/dependencies/macros.hpp b/project/dependencies/macros.hpp index b28ec65..1c59dc8 100644 --- a/project/dependencies/macros.hpp +++ b/project/dependencies/macros.hpp @@ -1,5 +1,5 @@ #pragma once -#include "header_start.hpp" +// #include "header_start.hpp" #pragma region Macros diff --git a/project/dependencies/memory.cpp b/project/dependencies/memory.cpp index 9d7a17c..1778695 100644 --- a/project/dependencies/memory.cpp +++ b/project/dependencies/memory.cpp @@ -1,5 +1,5 @@ #pragma once -#include "printing.cpp" +// #include "printing.cpp" #pragma region Memory diff --git a/project/dependencies/memory.hpp b/project/dependencies/memory.hpp index d8335db..6731a86 100644 --- a/project/dependencies/memory.hpp +++ b/project/dependencies/memory.hpp @@ -1,5 +1,5 @@ #pragma once -#include "debug.hpp" +// #include "debug.hpp" #pragma region Memory diff --git a/project/dependencies/parsing.cpp b/project/dependencies/parsing.cpp index 6d4d110..d9d3d8e 100644 --- a/project/dependencies/parsing.cpp +++ b/project/dependencies/parsing.cpp @@ -1,3 +1,5 @@ +#pragma once + #pragma region ADT #define _adt_fprintf( s_, fmt_, ... ) \ diff --git a/project/dependencies/parsing.hpp b/project/dependencies/parsing.hpp index 3f7810b..d89bdac 100644 --- a/project/dependencies/parsing.hpp +++ b/project/dependencies/parsing.hpp @@ -1,3 +1,5 @@ +#pragma once + #pragma region ADT enum ADT_Type : u32 diff --git a/project/dependencies/printing.cpp b/project/dependencies/printing.cpp index d8342ff..8961369 100644 --- a/project/dependencies/printing.cpp +++ b/project/dependencies/printing.cpp @@ -1,5 +1,5 @@ #pragma once -#include "string_ops.cpp" +// #include "string_ops.cpp" #pragma region Printing diff --git a/project/dependencies/printing.hpp b/project/dependencies/printing.hpp index 8c7b895..edb0d3e 100644 --- a/project/dependencies/printing.hpp +++ b/project/dependencies/printing.hpp @@ -1,5 +1,5 @@ #pragma once -#include "string_ops.hpp" +// #include "string_ops.hpp" #pragma region Printing diff --git a/project/dependencies/string_ops.cpp b/project/dependencies/string_ops.cpp index 4fb578d..65c64c7 100644 --- a/project/dependencies/string_ops.cpp +++ b/project/dependencies/string_ops.cpp @@ -1,5 +1,5 @@ #pragma once -#include "debug.cpp" +// #include "debug.cpp" #pragma region String Ops diff --git a/project/dependencies/string_ops.hpp b/project/dependencies/string_ops.hpp index 7bb61d3..972b3c8 100644 --- a/project/dependencies/string_ops.hpp +++ b/project/dependencies/string_ops.hpp @@ -1,5 +1,5 @@ #pragma once -#include "memory.hpp" +// #include "memory.hpp" #pragma region String Ops diff --git a/project/dependencies/strings.cpp b/project/dependencies/strings.cpp index 7b323f0..c5ff182 100644 --- a/project/dependencies/strings.cpp +++ b/project/dependencies/strings.cpp @@ -1,5 +1,5 @@ #pragma once -#include "hashing.cpp" +// #include "hashing.cpp" #pragma region String diff --git a/project/dependencies/strings.hpp b/project/dependencies/strings.hpp index 2e82a2c..7d0da07 100644 --- a/project/dependencies/strings.hpp +++ b/project/dependencies/strings.hpp @@ -1,5 +1,5 @@ #pragma once -#include "hashing.hpp" +// #include "hashing.hpp" #pragma region Strings diff --git a/project/dependencies/timing.cpp b/project/dependencies/timing.cpp index 1062b0b..3199004 100644 --- a/project/dependencies/timing.cpp +++ b/project/dependencies/timing.cpp @@ -1,5 +1,5 @@ #pragma once -#include "filesystem.cpp" +// #include "filesystem.cpp" #pragma region Timing diff --git a/project/dependencies/timing.hpp b/project/dependencies/timing.hpp index 30390c7..dc82455 100644 --- a/project/dependencies/timing.hpp +++ b/project/dependencies/timing.hpp @@ -1,5 +1,5 @@ #pragma once -#include "filesystem.hpp" +// #include "filesystem.hpp" #pragma region Timing diff --git a/project/gen.cpp b/project/gen.cpp index 693acc6..9e230b9 100644 --- a/project/gen.cpp +++ b/project/gen.cpp @@ -14,7 +14,7 @@ # include "gen.dep.cpp" #endif -GEN_NS_BEGIN +namespace gen { #include "components/static_data.cpp" @@ -27,6 +27,6 @@ GEN_NS_BEGIN #include "components/interface.parsing.cpp" #include "components/interface.untyped.cpp" -GEN_NS_END +} #include "helpers/pop_ignores.inline.hpp" diff --git a/project/gen.dep.cpp b/project/gen.dep.cpp index 16ad02f..e22091f 100644 --- a/project/gen.dep.cpp +++ b/project/gen.dep.cpp @@ -3,7 +3,7 @@ #include "dependencies/src_start.cpp" -GEN_NS_BEGIN +namespace gen { #include "dependencies/debug.cpp" #include "dependencies/string_ops.cpp" @@ -14,4 +14,4 @@ GEN_NS_BEGIN #include "dependencies/filesystem.cpp" #include "dependencies/timing.cpp" -GEN_NS_END +} diff --git a/project/gen.dep.hpp b/project/gen.dep.hpp index 7a245a7..c6c54a2 100644 --- a/project/gen.dep.hpp +++ b/project/gen.dep.hpp @@ -3,7 +3,7 @@ #include "dependencies/header_start.hpp" -GEN_NS_BEGIN +namespace gen { #include "dependencies/macros.hpp" #include "dependencies/basic_types.hpp" @@ -17,4 +17,4 @@ GEN_NS_BEGIN #include "dependencies/filesystem.hpp" #include "dependencies/timing.hpp" -GEN_NS_END +} diff --git a/project/gen.hpp b/project/gen.hpp index b7158f3..de7c851 100644 --- a/project/gen.hpp +++ b/project/gen.hpp @@ -11,7 +11,7 @@ #include "helpers/push_ignores.inline.hpp" #include "components/header_start.hpp" -GEN_NS_BEGIN +namespace gen { #include "components/types.hpp" #include "components/temp/ecode.hpp" @@ -27,6 +27,6 @@ GEN_NS_BEGIN #include "components/temp/ast_inlines.hpp" #include "components/header_end.hpp" -GEN_NS_END +} #include "helpers/pop_ignores.inline.hpp" diff --git a/project/helpers/helper.hpp b/project/helpers/helper.hpp index 675bc51..b83706f 100644 --- a/project/helpers/helper.hpp +++ b/project/helpers/helper.hpp @@ -2,9 +2,9 @@ #include "gen.hpp" -GEN_NS_BEGIN +namespace gen { #include "dependencies/parsing.hpp" -GEN_NS_END +} using namespace gen; @@ -30,13 +30,7 @@ CodeBody gen_ecode( char const* path ) to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", code, code ); } - CodeEnum enum_code = parse_enum( token_fmt( "entries", (StrC)enum_entries, stringize( - enum Type : u32 - { - - NumTypes - }; - ))); + CodeEnum enum_code = parse_enum(gen::token_fmt_impl((3 + 1) / 2, "entries", (StrC)enum_entries, "enum Type : u32 { NumTypes };")); #pragma push_macro( "local_persist" ) #undef local_persist