mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
Finished initial implmentation bootstrap generation and singleheader implementation.
This commit is contained in:
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();
|
||||
|
@ -3,14 +3,13 @@
|
||||
// ReSharper disable CppClangTidyClangDiagnosticSwitchEnum
|
||||
|
||||
#if ! defined(GEN_DONT_ENFORCE_GEN_TIME_GUARD) && ! defined(GEN_TIME)
|
||||
#error Gen.hpp : GEN_TIME not defined
|
||||
# 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"
|
||||
|
Reference in New Issue
Block a user