mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Finished initial implmentation bootstrap generation and singleheader implementation.
This commit is contained in:
parent
ebe049d3a0
commit
62b0ed2112
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,6 +6,8 @@ build/*
|
||||
**/*.gen.*
|
||||
**/gen/gen.hpp
|
||||
**/gen/gen.cpp
|
||||
**/gen/gen_dep.hpp
|
||||
**/gen/gen_dep.cpp
|
||||
|
||||
gencpp.hpp
|
||||
gencpp.cpp
|
||||
|
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@ -31,6 +31,15 @@
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/project/",
|
||||
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Debug singleheader vsdbg",
|
||||
"program": "${workspaceFolder}/singleheader/build/gencpp_singleheader.exe",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/singleheader/",
|
||||
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -171,8 +171,8 @@ An example of building is provided within project, singleheader, and test.
|
||||
|
||||
**Project**
|
||||
|
||||
`gen.bootstrap.cpp` generates a segmented version of the library following a more traditional cpp convention.
|
||||
With the exception that: *The component hpp and cpp files are all included into their respective header and source*
|
||||
`gen.bootstrap.cpp` generates a segmented version of the library where code is divided into `gen.hpp`, `gen.cpp`, `gen_dep.hpp`, and `gen_dep.cpp`.
|
||||
(Similar whats there already, but with the includes injected)
|
||||
|
||||
**Singleheader**
|
||||
|
||||
|
0
project/components/AttributeTokens.csv
Normal file
0
project/components/AttributeTokens.csv
Normal file
|
0
project/components/ECode.csv
Normal file
0
project/components/ECode.csv
Normal file
|
0
project/components/EOperator.csv
Normal file
0
project/components/EOperator.csv
Normal file
|
0
project/components/ESpecifier.csv
Normal file
0
project/components/ESpecifier.csv
Normal file
|
0
project/components/ETokType.csv
Normal file
0
project/components/ETokType.csv
Normal file
|
@ -402,7 +402,7 @@ StrC token_fmt_impl( sw num, ... )
|
||||
# define GEN_MAX_NAME_LENGTH 128
|
||||
#endif
|
||||
#ifndef GEN_MAX_UNTYPED_STR_LENGTH
|
||||
# define GEN_MAX_UNTYPED_STR_LENGTH kilobytes(640)
|
||||
# define GEN_MAX_UNTYPED_STR_LENGTH megabytes(1)
|
||||
#endif
|
||||
#ifndef GEN_TOKEN_FMT_TOKEN_MAP_MEM_SIZE
|
||||
# define GEN_TOKEN_FMT_TOKEN_MAP_MEM_SIZE kilobytes(4)
|
||||
|
@ -13,5 +13,5 @@
|
||||
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
||||
// Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
||||
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
||||
# include "dependencies/gen.dep.hpp"
|
||||
# include "gen.dep.hpp"
|
||||
#endif
|
||||
|
9
project/components/gen.impl_start.cpp
Normal file
9
project/components/gen.impl_start.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#if ! defined(GEN_DONT_ENFORCE_GEN_TIME_GUARD) && ! defined(GEN_TIME)
|
||||
# error Gen.hpp : GEN_TIME not defined
|
||||
#endif
|
||||
|
||||
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
||||
//! Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
||||
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
||||
# include "gen.dep.cpp"
|
||||
#endif
|
@ -1,19 +0,0 @@
|
||||
// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)
|
||||
#include "gen.dep.hpp"
|
||||
|
||||
#include "gen.impl_start.cpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#include "gen.debug.cpp"
|
||||
#include "gen.string_ops.cpp"
|
||||
#include "gen.printing.cpp"
|
||||
#include "gen.memory.cpp"
|
||||
#include "gen.parsing.cpp"
|
||||
#include "gen.hashing.cpp"
|
||||
#include "gen.string.cpp"
|
||||
#include "gen.timing.cpp"
|
||||
|
||||
#include "gen.file_handling.cpp"
|
||||
|
||||
GEN_NS_END
|
@ -1,20 +0,0 @@
|
||||
// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)
|
||||
#pragma once
|
||||
|
||||
#include "gen.header_start.hpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#include "gen.macros.hpp"
|
||||
#include "gen.basic_types.hpp"
|
||||
#include "gen.debug.hpp"
|
||||
#include "gen.memory.hpp"
|
||||
#include "gen.string_ops.hpp"
|
||||
#include "gen.printing.hpp"
|
||||
#include "gen.containers.hpp"
|
||||
#include "gen.string.hpp"
|
||||
#include "gen.file_handling.hpp"
|
||||
#include "gen.parsing.hpp"
|
||||
#include "gen.timing.hpp"
|
||||
|
||||
GEN_NS_END
|
@ -129,11 +129,3 @@
|
||||
# include <intrin.h>
|
||||
# endif
|
||||
#pragma endregion Mandatory Includes
|
||||
|
||||
#ifdef GEN_DONT_USE_NAMESPACE
|
||||
# define GEN_NS_BEGIN
|
||||
# define GEN_NS_END
|
||||
#else
|
||||
# define GEN_NS_BEGIN namespace gen {
|
||||
# define GEN_NS_END }
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
struct FileInfo;
|
||||
|
||||
#ifndef GEN_PRINTF_MAXLEN
|
||||
# define GEN_PRINTF_MAXLEN 65536
|
||||
# define GEN_PRINTF_MAXLEN kilobytes(128)
|
||||
#endif
|
||||
|
||||
// NOTE: A locally persisting buffer is used internally
|
||||
|
@ -10,7 +10,7 @@ Code scan_file( char const* path )
|
||||
FileError error = file_open_mode( & file, EFileMode_READ, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
fatal( "scan_file: Could not open genc.macro.h: %s", path );
|
||||
fatal( "scan_file: Could not open: %s", path );
|
||||
}
|
||||
|
||||
sw fsize = file_size( & file );
|
||||
|
@ -35,36 +35,135 @@ int gen_main()
|
||||
Code push_ignores = scan_file( "helpers/gen.push_ignores.inline.hpp" );
|
||||
Code pop_ignores = scan_file( "helpers/gen.pop_ignores.inline.hpp" );
|
||||
|
||||
Builder gen_deps_header;
|
||||
// gen_dep.hpp
|
||||
{
|
||||
Code header_start = scan_file( "dependencies/gen.header_start.hpp" );
|
||||
Code nspace_macro = untyped_str( namespace_by_default ? nspace_default : nspace_non_default );
|
||||
Code macros = scan_file( "dependencies/gen.macros.hpp" );
|
||||
Code basic_types = scan_file( "dependencies/gen.basic_types.hpp" );
|
||||
Code debug = scan_file( "dependencies/gen.debug.hpp" );
|
||||
Code memory = scan_file( "dependencies/gen.memory.hpp" );
|
||||
Code string_ops = scan_file( "dependencies/gen.string_ops.hpp" );
|
||||
Code printing = scan_file( "dependencies/gen.printing.hpp" );
|
||||
Code containers = scan_file( "dependencies/gen.containers.hpp" );
|
||||
Code string = scan_file( "dependencies/gen.string.hpp" );
|
||||
Code file_handling = scan_file( "dependencies/gen.file_handling.hpp" );
|
||||
Code parsing = scan_file( "dependencies/gen.parsing.hpp" );
|
||||
Code timing = scan_file( "dependencies/gen.timing.hpp" );
|
||||
|
||||
Builder
|
||||
deps_header;
|
||||
deps_header.open("gen/gen_dep.hpp");
|
||||
deps_header.print_fmt("// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n");
|
||||
deps_header.print_fmt("#pragma once\n\n");
|
||||
deps_header.print( push_ignores );
|
||||
deps_header.print( header_start );
|
||||
deps_header.print( nspace_macro );
|
||||
deps_header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||
deps_header.print( macros );
|
||||
deps_header.print( basic_types );
|
||||
deps_header.print( debug );
|
||||
deps_header.print( memory );
|
||||
deps_header.print( string_ops );
|
||||
deps_header.print( printing );
|
||||
deps_header.print( containers );
|
||||
deps_header.print( string );
|
||||
deps_header.print( file_handling );
|
||||
deps_header.print( parsing );
|
||||
deps_header.print( timing );
|
||||
deps_header.print_fmt( "GEN_NS_END\n\n");
|
||||
deps_header.print( pop_ignores );
|
||||
deps_header.write();
|
||||
}
|
||||
|
||||
Builder gen_deps_impl;
|
||||
// gen_dep.cpp
|
||||
{
|
||||
CodeInclude header = def_include( txt_StrC("gen_dep.hpp") );
|
||||
Code impl_start = scan_file( "dependencies/gen.impl_start.cpp" );
|
||||
Code debug = scan_file( "dependencies/gen.debug.cpp" );
|
||||
Code string_ops = scan_file( "dependencies/gen.string_ops.cpp" );
|
||||
Code printing = scan_file( "dependencies/gen.printing.cpp" );
|
||||
Code memory = scan_file( "dependencies/gen.memory.cpp" );
|
||||
Code parsing = scan_file( "dependencies/gen.parsing.cpp" );
|
||||
Code hashing = scan_file( "dependencies/gen.hashing.cpp" );
|
||||
Code string = scan_file( "dependencies/gen.string.cpp" );
|
||||
Code timing = scan_file( "dependencies/gen.timing.cpp" );
|
||||
|
||||
Builder
|
||||
deps_impl;
|
||||
deps_impl.open("gen/gen_dep.cpp");
|
||||
deps_impl.print_fmt("// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n");
|
||||
deps_impl.print( impl_start );
|
||||
deps_impl.print( header );
|
||||
deps_impl.print_fmt( "\nGEN_NS_BEGIN\n");
|
||||
deps_impl.print( debug );
|
||||
deps_impl.print( string_ops );
|
||||
deps_impl.print( printing );
|
||||
deps_impl.print( memory );
|
||||
deps_impl.print( parsing );
|
||||
deps_impl.print( string );
|
||||
deps_impl.print( timing );
|
||||
deps_impl.print_fmt( "GEN_NS_END\n\n");
|
||||
deps_impl.write();
|
||||
}
|
||||
|
||||
Builder gen_header;
|
||||
// gen.hpp
|
||||
{
|
||||
Code header_start = scan_file( "components/gen.header_start.hpp" );
|
||||
Code nspace_macro = untyped_str( namespace_by_default ? nspace_default : nspace_non_default );
|
||||
Code types = scan_file( "components/gen.types.hpp" );
|
||||
Code data_structs = scan_file( "components/gen.data_structures.hpp" );
|
||||
Code interface = scan_file( "components/gen.interface.hpp" );
|
||||
Code header_end = scan_file( "components/gen.header_end.hpp" );
|
||||
|
||||
gen_header.open( "gen/gen.hpp" );
|
||||
gen_header.print_fmt("#pragma once\n\n");
|
||||
gen_header.print( push_ignores );
|
||||
gen_header.print( header_start );
|
||||
gen_header.print( nspace_macro );
|
||||
gen_header.print_fmt( "GEN_NS_BEGIN\n");
|
||||
|
||||
gen_header.print_fmt( "\nGEN_NS_END\n\n");
|
||||
gen_header.print( pop_ignores );
|
||||
gen_header.write();
|
||||
Builder
|
||||
header;
|
||||
header.open( "gen/gen.hpp" );
|
||||
header.print_fmt("#pragma once\n\n");
|
||||
header.print( push_ignores );
|
||||
header.print( header_start );
|
||||
header.print( nspace_macro );
|
||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||
header.print( types );
|
||||
header.print( data_structs );
|
||||
header.print( interface );
|
||||
header.print( header_end );
|
||||
header.print_fmt( "GEN_NS_END\n\n");
|
||||
header.print( pop_ignores );
|
||||
header.write();
|
||||
}
|
||||
|
||||
Builder gen_impl;
|
||||
// gen.cpp
|
||||
{
|
||||
Code impl_start = scan_file( "components/gen.impl_start.cpp" );
|
||||
CodeInclude header = def_include( txt_StrC("gen.hpp") );
|
||||
Code data = scan_file( "components/gen.data.cpp" );
|
||||
Code ast_case_macros = scan_file( "components/gen.ast_case_macros.cpp" );
|
||||
Code ast = scan_file( "components/gen.ast.cpp" );
|
||||
Code interface = scan_file( "components/gen.interface.cpp" );
|
||||
Code upfront = scan_file( "components/gen.interface.upfront.cpp" );
|
||||
Code parsing = scan_file( "components/gen.interface.parsing.cpp" );
|
||||
Code untyped = scan_file( "components/gen.untyped.cpp" );
|
||||
|
||||
Code builder = scan_file( "filesystem/gen.builder.cpp" );
|
||||
|
||||
Builder
|
||||
impl;
|
||||
impl.open( "gen/gen.cpp" );
|
||||
impl.print( push_ignores );
|
||||
impl.print( impl_start );
|
||||
impl.print( header );
|
||||
impl.print_fmt( "\nGEN_NS_BEGIN\n\n");
|
||||
impl.print( data );
|
||||
impl.print( ast_case_macros );
|
||||
impl.print( ast );
|
||||
impl.print( interface );
|
||||
impl.print( upfront );
|
||||
impl.print( parsing );
|
||||
impl.print( untyped );
|
||||
impl.print_fmt( "GEN_NS_END\n\n");
|
||||
impl.print( pop_ignores );
|
||||
impl.write();
|
||||
}
|
||||
|
||||
gen::deinit();
|
||||
|
@ -6,11 +6,10 @@
|
||||
# error Gen.hpp : GEN_TIME not defined
|
||||
#endif
|
||||
|
||||
|
||||
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
||||
//! Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
||||
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
||||
# include "dependencies/gen.dep.cpp"
|
||||
# include "gen.dep.cpp"
|
||||
#endif
|
||||
|
||||
#include "gen.hpp"
|
||||
|
19
project/gen.dep.cpp
Normal file
19
project/gen.dep.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)
|
||||
#include "gen.dep.hpp"
|
||||
|
||||
#include "dependencies/gen.impl_start.cpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#include "dependencies/gen.debug.cpp"
|
||||
#include "dependencies/gen.string_ops.cpp"
|
||||
#include "dependencies/gen.printing.cpp"
|
||||
#include "dependencies/gen.memory.cpp"
|
||||
#include "dependencies/gen.parsing.cpp"
|
||||
#include "dependencies/gen.hashing.cpp"
|
||||
#include "dependencies/gen.string.cpp"
|
||||
#include "dependencies/gen.timing.cpp"
|
||||
|
||||
#include "dependencies/gen.file_handling.cpp"
|
||||
|
||||
GEN_NS_END
|
28
project/gen.dep.hpp
Normal file
28
project/gen.dep.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)
|
||||
#pragma once
|
||||
|
||||
#include "dependencies/gen.header_start.hpp"
|
||||
|
||||
#ifdef GEN_DONT_USE_NAMESPACE
|
||||
# define GEN_NS_BEGIN
|
||||
# define GEN_NS_END
|
||||
#else
|
||||
# define GEN_NS_BEGIN namespace gen {
|
||||
# define GEN_NS_END }
|
||||
#endif
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#include "dependencies/gen.macros.hpp"
|
||||
#include "dependencies/gen.basic_types.hpp"
|
||||
#include "dependencies/gen.debug.hpp"
|
||||
#include "dependencies/gen.memory.hpp"
|
||||
#include "dependencies/gen.string_ops.hpp"
|
||||
#include "dependencies/gen.printing.hpp"
|
||||
#include "dependencies/gen.containers.hpp"
|
||||
#include "dependencies/gen.string.hpp"
|
||||
#include "dependencies/gen.file_handling.hpp"
|
||||
#include "dependencies/gen.parsing.hpp"
|
||||
#include "dependencies/gen.timing.hpp"
|
||||
|
||||
GEN_NS_END
|
@ -11,6 +11,14 @@
|
||||
#include "helpers/gen.push_ignores.inline.hpp"
|
||||
#include "components/gen.header_start.hpp"
|
||||
|
||||
#ifdef GEN_DONT_USE_NAMESPACE
|
||||
# define GEN_NS_BEGIN
|
||||
# define GEN_NS_END
|
||||
#else
|
||||
# define GEN_NS_BEGIN namespace gen {
|
||||
# define GEN_NS_END }
|
||||
#endif
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#include "components/gen.types.hpp"
|
||||
|
@ -60,10 +60,10 @@ $formatParams = @(
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @('gencpp.hpp', 'gencpp.cpp')
|
||||
$include = @('gen.hpp', 'gen.cpp', 'gen_dep.hpp', 'gen_dep.cpp')
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
clang-format $formatParams $targetFiles
|
||||
Write-Host "`nFormatting complete"
|
||||
|
@ -9,6 +9,7 @@ $path_project_build = Join-Path $path_project build
|
||||
$path_singleheader_build = Join-Path $path_singleheader build
|
||||
$path_project_gen = Join-Path $path_project gen
|
||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||
$path_x64 = Join-Path $path_root x64
|
||||
|
||||
if ( Test-Path $path_project_build)
|
||||
{
|
||||
@ -30,7 +31,12 @@ if ( Test-Path $path_gen_build )
|
||||
Remove-Item $path_gen_build -Recurse
|
||||
}
|
||||
|
||||
[string[]] $include = 'gen.hpp', 'gen.cpp'
|
||||
if ( Test-Path $path_x64)
|
||||
{
|
||||
Remove-Item $path_x64 -Recurse
|
||||
}
|
||||
|
||||
[string[]] $include = 'gen.hpp', 'gen.cpp', 'gen_dep.hpp', 'gen_dep.cpp'
|
||||
[string[]] $exclude =
|
||||
|
||||
$files = Get-ChildItem -Recurse -Path $path_project_gen -Include $include -Exclude $exclude
|
||||
|
@ -18,7 +18,7 @@ $path_singleheader = Join-Path $path_root singleheader
|
||||
$path_singleheader_build = Join-Path $path_singleheader build
|
||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||
|
||||
write-host "`n`nBuilding gencpp bootstrap`n"
|
||||
write-host "`n`nBuilding gencpp singleheader`n"
|
||||
|
||||
if ( -not( Test-Path $path_singleheader_build) )
|
||||
{
|
||||
@ -49,7 +49,7 @@ if ( -not(Test-Path($path_singleheader_gen) )) {
|
||||
# Run meta-program
|
||||
$gencpp_singleheader = Join-Path $path_singleheader_build gencpp_singleheader.exe
|
||||
|
||||
Write-Host `nRunning gencpp bootstrap...
|
||||
Write-Host `nRunning gencpp singleheader...
|
||||
& $gencpp_singleheader
|
||||
|
||||
# Format generated files
|
||||
@ -60,7 +60,7 @@ $formatParams = @(
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$include = @('gencpp.hpp')
|
||||
$include = @('gen.hpp')
|
||||
$exclude = $null
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
@ -5,6 +5,9 @@
|
||||
|
||||
Public Address:
|
||||
https://github.com/Ed94/gencpp
|
||||
|
||||
This is a single header variant of the library.
|
||||
Define GEN_IMPLEMENTATION before including this file in a single compilation unit.
|
||||
*/
|
||||
#if ! defined(GEN_DONT_ENFORCE_GEN_TIME_GUARD) && ! defined(GEN_TIME)
|
||||
# error Gen.hpp : GEN_TIME not defined
|
||||
|
@ -28,49 +28,155 @@ constexpr StrC nspace_non_default = txt_StrC(R"(
|
||||
#endif
|
||||
)");
|
||||
|
||||
constexpr StrC gen_implementation_guard = txt_StrC(R"(
|
||||
constexpr StrC implementation_guard_start = txt_StrC(R"(
|
||||
#pragma region GENCPP IMPLEMENTATION GUARD
|
||||
#if ! defined(GEN_IMPLEMENTATION)
|
||||
# define GEN_IMPLEMENTATION
|
||||
)");
|
||||
|
||||
constexpr StrC gen_implementation_end = txt_StrC(R"(
|
||||
constexpr StrC implementation_guard_end = txt_StrC(R"(
|
||||
#endif
|
||||
#pragma endregion GENCPP IMPLEMENTATION GUARD
|
||||
)");
|
||||
|
||||
constexpr StrC roll_own_dependencies_guard_start = txt_StrC(R"(
|
||||
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
||||
// Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
||||
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
||||
|
||||
)");
|
||||
|
||||
constexpr StrC roll_own_dependencies_guard_end = txt_StrC(R"(
|
||||
// GEN_ROLL_OWN_DEPENDENCIES
|
||||
#endif
|
||||
|
||||
)");
|
||||
|
||||
int gen_main()
|
||||
{
|
||||
gen::init();
|
||||
|
||||
Code push_ignores = scan_file( "../project/helpers/gen.push_ignores.inline.hpp" );
|
||||
Code pop_ignores = scan_file( "../project/helpers/gen.pop_ignores.inline.hpp" );
|
||||
#define project_dir "../project/"
|
||||
|
||||
Code push_ignores = scan_file( project_dir "helpers/gen.push_ignores.inline.hpp" );
|
||||
Code pop_ignores = scan_file( project_dir "helpers/gen.pop_ignores.inline.hpp" );
|
||||
|
||||
Code header_start = scan_file( "components/gen.header_start.hpp" );
|
||||
Code nspace_macro = untyped_str( namespace_by_default ? nspace_default : nspace_non_default );
|
||||
|
||||
Builder gen_header;
|
||||
gen_header.open( "gen/gen.hpp" );
|
||||
gen_header.print( push_ignores );
|
||||
Builder
|
||||
header;
|
||||
header.open( "gen/gen.hpp" );
|
||||
header.print( push_ignores );
|
||||
|
||||
header.print_fmt("#pragma once\n\n");
|
||||
|
||||
// Headers
|
||||
gen_header.print_fmt("#pragma once\n\n");
|
||||
gen_header.print( header_start );
|
||||
gen_header.print( nspace_macro );
|
||||
gen_header.print_fmt( "GEN_NS_BEGIN\n");
|
||||
{
|
||||
header.print( header_start );
|
||||
header.print( nspace_macro );
|
||||
|
||||
gen_header.print_fmt( "\nGEN_NS_END\n");
|
||||
{
|
||||
header.print_fmt( roll_own_dependencies_guard_start );
|
||||
|
||||
Code header_start = scan_file( project_dir "dependencies/gen.header_start.hpp" );
|
||||
Code macros = scan_file( project_dir "dependencies/gen.macros.hpp" );
|
||||
Code basic_types = scan_file( project_dir "dependencies/gen.basic_types.hpp" );
|
||||
Code debug = scan_file( project_dir "dependencies/gen.debug.hpp" );
|
||||
Code memory = scan_file( project_dir "dependencies/gen.memory.hpp" );
|
||||
Code string_ops = scan_file( project_dir "dependencies/gen.string_ops.hpp" );
|
||||
Code printing = scan_file( project_dir "dependencies/gen.printing.hpp" );
|
||||
Code containers = scan_file( project_dir "dependencies/gen.containers.hpp" );
|
||||
Code string = scan_file( project_dir "dependencies/gen.string.hpp" );
|
||||
Code file_handling = scan_file( project_dir "dependencies/gen.file_handling.hpp" );
|
||||
Code parsing = scan_file( project_dir "dependencies/gen.parsing.hpp" );
|
||||
Code timing = scan_file( project_dir "dependencies/gen.timing.hpp" );
|
||||
|
||||
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||
header.print( header_start );
|
||||
header.print( macros );
|
||||
header.print( basic_types );
|
||||
header.print( debug );
|
||||
header.print( memory );
|
||||
header.print( string_ops );
|
||||
header.print( printing );
|
||||
header.print( containers );
|
||||
header.print( string );
|
||||
header.print( file_handling );
|
||||
header.print( parsing );
|
||||
header.print( timing );
|
||||
header.print_fmt( "GEN_NS_END\n" );
|
||||
|
||||
header.print_fmt( roll_own_dependencies_guard_end );
|
||||
}
|
||||
|
||||
Code types = scan_file( project_dir "components/gen.types.hpp" );
|
||||
Code data_structs = scan_file( project_dir "components/gen.data_structures.hpp" );
|
||||
Code interface = scan_file( project_dir "components/gen.interface.hpp" );
|
||||
Code header_end = scan_file( project_dir "components/gen.header_end.hpp" );
|
||||
|
||||
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||
header.print( types );
|
||||
header.print( data_structs );
|
||||
header.print( interface );
|
||||
header.print( header_end );
|
||||
header.print_fmt( "GEN_NS_END\n" );
|
||||
}
|
||||
|
||||
// Implementation
|
||||
{
|
||||
header.print_fmt( "%s\n", (char const*) implementation_guard_start );
|
||||
{
|
||||
header.print_fmt( roll_own_dependencies_guard_start );
|
||||
|
||||
gen_header.print_fmt( "%s\n\n", (char const*) gen_implementation_guard );
|
||||
gen_header.print_fmt( "GEN_NS_BEGIN\n");
|
||||
Code impl_start = scan_file( project_dir "dependencies/gen.impl_start.cpp" );
|
||||
Code debug = scan_file( project_dir "dependencies/gen.debug.cpp" );
|
||||
Code string_ops = scan_file( project_dir "dependencies/gen.string_ops.cpp" );
|
||||
Code printing = scan_file( project_dir "dependencies/gen.printing.cpp" );
|
||||
Code memory = scan_file( project_dir "dependencies/gen.memory.cpp" );
|
||||
Code parsing = scan_file( project_dir "dependencies/gen.parsing.cpp" );
|
||||
Code hashing = scan_file( project_dir "dependencies/gen.hashing.cpp" );
|
||||
Code string = scan_file( project_dir "dependencies/gen.string.cpp" );
|
||||
Code timing = scan_file( project_dir "dependencies/gen.timing.cpp" );
|
||||
|
||||
gen_header.print_fmt( "\nGEN_NS_END\n");
|
||||
gen_header.print_fmt( "%s\n", (char const*) gen_implementation_end );
|
||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||
header.print( impl_start );
|
||||
header.print( debug );
|
||||
header.print( string_ops );
|
||||
header.print( printing );
|
||||
header.print( memory );
|
||||
header.print( parsing );
|
||||
header.print( hashing );
|
||||
header.print( string );
|
||||
header.print( timing );
|
||||
header.print_fmt( "GEN_NS_END\n");
|
||||
|
||||
gen_header.print( pop_ignores );
|
||||
gen_header.write();
|
||||
header.print_fmt( roll_own_dependencies_guard_end );
|
||||
}
|
||||
|
||||
Code data = scan_file( project_dir "components/gen.data.cpp" );
|
||||
Code ast_case_macros = scan_file( project_dir "components/gen.ast_case_macros.cpp" );
|
||||
Code ast = scan_file( project_dir "components/gen.ast.cpp" );
|
||||
Code interface = scan_file( project_dir "components/gen.interface.cpp" );
|
||||
Code upfront = scan_file( project_dir "components/gen.interface.upfront.cpp" );
|
||||
Code parsing = scan_file( project_dir "components/gen.interface.parsing.cpp" );
|
||||
Code untyped = scan_file( project_dir "components/gen.untyped.cpp" );
|
||||
|
||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||
header.print( data );
|
||||
header.print( ast_case_macros );
|
||||
header.print( ast );
|
||||
header.print( interface );
|
||||
header.print( upfront );
|
||||
header.print( parsing );
|
||||
header.print( untyped );
|
||||
header.print_fmt( "GEN_NS_END\n");
|
||||
|
||||
header.print_fmt( "%s\n", (char const*) implementation_guard_end );
|
||||
}
|
||||
|
||||
header.print( pop_ignores );
|
||||
header.write();
|
||||
|
||||
gen::deinit();
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user