mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
compiles agian...
This commit is contained in:
parent
4a2ed6de4e
commit
5c47777972
@ -1,3 +1,5 @@
|
|||||||
|
#include "builder.hpp"
|
||||||
|
|
||||||
Builder Builder::open( char const* path )
|
Builder Builder::open( char const* path )
|
||||||
{
|
{
|
||||||
Builder result;
|
Builder result;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "gen.hpp"
|
||||||
|
|
||||||
struct Builder
|
struct Builder
|
||||||
{
|
{
|
||||||
FileInfo File;
|
FileInfo File;
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gen.scanner.hpp"
|
#include "gen.scanner.hpp"
|
||||||
|
|
||||||
namespace gen {
|
|
||||||
|
|
||||||
struct Policy
|
struct Policy
|
||||||
{
|
{
|
||||||
// Nothing for now.
|
// Nothing for now.
|
||||||
@ -68,6 +65,3 @@ struct Editor
|
|||||||
|
|
||||||
bool process_requests( Array<Receipt> out_receipts );
|
bool process_requests( Array<Receipt> out_receipts );
|
||||||
};
|
};
|
||||||
|
|
||||||
// namespace gen
|
|
||||||
};
|
|
||||||
|
@ -1 +1 @@
|
|||||||
|
#include "scanner.hpp"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "gen.hpp"
|
||||||
|
|
||||||
// This is a simple file reader that reads the entire file into memory.
|
// 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.
|
// 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.
|
// 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
|
// Skip the line
|
||||||
sptr skip_size = sptr( scanner - str );
|
sptr skip_size = sptr( scanner - str.Data );
|
||||||
if ( current == '\r' )
|
if ( current == '\r' )
|
||||||
{
|
{
|
||||||
skip_size += 2;
|
skip_size += 2;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "static_data.cpp"
|
// #include "static_data.cpp"
|
||||||
|
|
||||||
Code Code::Global;
|
Code Code::Global;
|
||||||
Code Code::Invalid;
|
Code Code::Invalid;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "types.hpp"
|
// #include "types.hpp"
|
||||||
#include "temp/ecode.hpp"
|
// #include "temp/ecode.hpp"
|
||||||
#include "temp/eoperator.hpp"
|
// #include "temp/eoperator.hpp"
|
||||||
#include "temp/especifier.hpp"
|
// #include "temp/especifier.hpp"
|
||||||
|
|
||||||
struct AST;
|
struct AST;
|
||||||
struct AST_Body;
|
struct AST_Body;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ast.hpp"
|
// #include "ast.hpp"
|
||||||
|
|
||||||
#pragma region AST Types
|
#pragma region AST Types
|
||||||
/*
|
/*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "inlines.hpp"
|
// #include "inlines.hpp"
|
||||||
#include "temp/ast_inlines.hpp"
|
// #include "temp/ast_inlines.hpp"
|
||||||
|
|
||||||
#pragma region Constants
|
#pragma region Constants
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ extern CodeSpecifiers spec_constexpr;
|
|||||||
extern CodeSpecifiers spec_constinit;
|
extern CodeSpecifiers spec_constinit;
|
||||||
extern CodeSpecifiers spec_extern_linkage;
|
extern CodeSpecifiers spec_extern_linkage;
|
||||||
extern CodeSpecifiers spec_final;
|
extern CodeSpecifiers spec_final;
|
||||||
extern CodeSpeciifers spec_forceinline;
|
extern CodeSpecifiers spec_forceinline;
|
||||||
extern CodeSpecifiers spec_global;
|
extern CodeSpecifiers spec_global;
|
||||||
extern CodeSpecifiers spec_inline;
|
extern CodeSpecifiers spec_inline;
|
||||||
extern CodeSpecifiers spec_internal_linkage;
|
extern CodeSpecifiers spec_internal_linkage;
|
||||||
@ -144,11 +144,11 @@ extern CodeType t_typename;
|
|||||||
|
|
||||||
# define args( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__
|
# define args( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__
|
||||||
|
|
||||||
# define code_str( ... ) gen::untyped_str( code( __VA_ARGS__ ) )
|
# define code_str( ... ) GEN_NS untyped_str( code( __VA_ARGS__ ) )
|
||||||
# define code_fmt( ... ) gen::untyped_str( token_fmt( __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.
|
// 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
|
#pragma endregion Macros
|
||||||
|
|
||||||
|
@ -20,9 +20,11 @@
|
|||||||
|
|
||||||
#ifndef GEN_NS_BEGIN
|
#ifndef GEN_NS_BEGIN
|
||||||
# ifdef GEN_DONT_USE_NAMESPACE
|
# ifdef GEN_DONT_USE_NAMESPACE
|
||||||
|
# define GEN_NS
|
||||||
# define GEN_NS_BEGIN
|
# define GEN_NS_BEGIN
|
||||||
# define GEN_NS_END
|
# define GEN_NS_END
|
||||||
# else
|
# else
|
||||||
|
# define GEN_NS gen::
|
||||||
# define GEN_NS_BEGIN namespace gen {
|
# define GEN_NS_BEGIN namespace gen {
|
||||||
# define GEN_NS_END }
|
# define GEN_NS_END }
|
||||||
# endif
|
# endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "interface.hpp"
|
// #include "interface.hpp"
|
||||||
|
|
||||||
void AST::append( AST* other )
|
void AST::append( AST* other )
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ast.cpp"
|
// #include "ast.cpp"
|
||||||
|
|
||||||
internal void init_parser();
|
internal void init_parser();
|
||||||
internal void deinit_parser();
|
internal void deinit_parser();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ast_types.hpp"
|
// #include "ast_types.hpp"
|
||||||
|
|
||||||
#pragma region Gen Interface
|
#pragma region Gen Interface
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "temp/etoktype.cpp"
|
// #include "temp/etoktype.cpp"
|
||||||
#include "interface.upfront.cpp"
|
// #include "interface.upfront.cpp"
|
||||||
|
|
||||||
namespace Parser
|
namespace Parser
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#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 )
|
sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va )
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "interface.cpp"
|
// #include "interface.cpp"
|
||||||
|
|
||||||
#pragma region Upfront
|
#pragma region Upfront
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "src_start.cpp"
|
// #include "src_start.cpp"
|
||||||
|
|
||||||
#pragma region StaticData
|
#pragma region StaticData
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ global CodeSpecifiers spec_constexpr;
|
|||||||
global CodeSpecifiers spec_constinit;
|
global CodeSpecifiers spec_constinit;
|
||||||
global CodeSpecifiers spec_extern_linkage;
|
global CodeSpecifiers spec_extern_linkage;
|
||||||
global CodeSpecifiers spec_final;
|
global CodeSpecifiers spec_final;
|
||||||
global CodeSpeciifers spec_forceinline;
|
global CodeSpecifiers spec_forceinline;
|
||||||
global CodeSpecifiers spec_global;
|
global CodeSpecifiers spec_global;
|
||||||
global CodeSpecifiers spec_inline;
|
global CodeSpecifiers spec_inline;
|
||||||
global CodeSpecifiers spec_internal_linkage;
|
global CodeSpecifiers spec_internal_linkage;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "header_start.hpp"
|
// #include "header_start.hpp"
|
||||||
|
|
||||||
using LogFailType = sw(*)(char const*, ...);
|
using LogFailType = sw(*)(char const*, ...);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macros.hpp"
|
// #include "macros.hpp"
|
||||||
|
|
||||||
#pragma region Basic Types
|
#pragma region Basic Types
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "printing.hpp"
|
// #include "printing.hpp"
|
||||||
|
|
||||||
#pragma region Containers
|
#pragma region Containers
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "src_start.cpp"
|
// #include "src_start.cpp"
|
||||||
|
|
||||||
#pragma region Debug
|
#pragma region Debug
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "basic_types.hpp"
|
// #include "basic_types.hpp"
|
||||||
|
|
||||||
#pragma region Debug
|
#pragma region Debug
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "strings.cpp"
|
// #include "strings.cpp"
|
||||||
|
|
||||||
#pragma region File Handling
|
#pragma region File Handling
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "strings.hpp"
|
// #include "strings.hpp"
|
||||||
|
|
||||||
#pragma region File Handling
|
#pragma region File Handling
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "memory.cpp"
|
// #include "memory.cpp"
|
||||||
|
|
||||||
#pragma region Hashing
|
#pragma region Hashing
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "containers.hpp"
|
// #include "containers.hpp"
|
||||||
|
|
||||||
#pragma region Hashing
|
#pragma region Hashing
|
||||||
|
|
||||||
|
@ -116,9 +116,11 @@
|
|||||||
#pragma endregion Mandatory Includes
|
#pragma endregion Mandatory Includes
|
||||||
|
|
||||||
#ifdef GEN_DONT_USE_NAMESPACE
|
#ifdef GEN_DONT_USE_NAMESPACE
|
||||||
|
# define GEN_NS
|
||||||
# define GEN_NS_BEGIN
|
# define GEN_NS_BEGIN
|
||||||
# define GEN_NS_END
|
# define GEN_NS_END
|
||||||
#else
|
#else
|
||||||
|
# define GEN_NS gen::
|
||||||
# define GEN_NS_BEGIN namespace gen {
|
# define GEN_NS_BEGIN namespace gen {
|
||||||
# define GEN_NS_END }
|
# define GEN_NS_END }
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "header_start.hpp"
|
// #include "header_start.hpp"
|
||||||
|
|
||||||
#pragma region Macros
|
#pragma region Macros
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "printing.cpp"
|
// #include "printing.cpp"
|
||||||
|
|
||||||
#pragma region Memory
|
#pragma region Memory
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "debug.hpp"
|
// #include "debug.hpp"
|
||||||
|
|
||||||
#pragma region Memory
|
#pragma region Memory
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#pragma region ADT
|
#pragma region ADT
|
||||||
|
|
||||||
#define _adt_fprintf( s_, fmt_, ... ) \
|
#define _adt_fprintf( s_, fmt_, ... ) \
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#pragma region ADT
|
#pragma region ADT
|
||||||
|
|
||||||
enum ADT_Type : u32
|
enum ADT_Type : u32
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "string_ops.cpp"
|
// #include "string_ops.cpp"
|
||||||
|
|
||||||
#pragma region Printing
|
#pragma region Printing
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "string_ops.hpp"
|
// #include "string_ops.hpp"
|
||||||
|
|
||||||
#pragma region Printing
|
#pragma region Printing
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "debug.cpp"
|
// #include "debug.cpp"
|
||||||
|
|
||||||
#pragma region String Ops
|
#pragma region String Ops
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "memory.hpp"
|
// #include "memory.hpp"
|
||||||
|
|
||||||
#pragma region String Ops
|
#pragma region String Ops
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "hashing.cpp"
|
// #include "hashing.cpp"
|
||||||
|
|
||||||
#pragma region String
|
#pragma region String
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "hashing.hpp"
|
// #include "hashing.hpp"
|
||||||
|
|
||||||
#pragma region Strings
|
#pragma region Strings
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "filesystem.cpp"
|
// #include "filesystem.cpp"
|
||||||
|
|
||||||
#pragma region Timing
|
#pragma region Timing
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "filesystem.hpp"
|
// #include "filesystem.hpp"
|
||||||
|
|
||||||
#pragma region Timing
|
#pragma region Timing
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# include "gen.dep.cpp"
|
# include "gen.dep.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
namespace gen {
|
||||||
|
|
||||||
#include "components/static_data.cpp"
|
#include "components/static_data.cpp"
|
||||||
|
|
||||||
@ -27,6 +27,6 @@ GEN_NS_BEGIN
|
|||||||
#include "components/interface.parsing.cpp"
|
#include "components/interface.parsing.cpp"
|
||||||
#include "components/interface.untyped.cpp"
|
#include "components/interface.untyped.cpp"
|
||||||
|
|
||||||
GEN_NS_END
|
}
|
||||||
|
|
||||||
#include "helpers/pop_ignores.inline.hpp"
|
#include "helpers/pop_ignores.inline.hpp"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "dependencies/src_start.cpp"
|
#include "dependencies/src_start.cpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
namespace gen {
|
||||||
|
|
||||||
#include "dependencies/debug.cpp"
|
#include "dependencies/debug.cpp"
|
||||||
#include "dependencies/string_ops.cpp"
|
#include "dependencies/string_ops.cpp"
|
||||||
@ -14,4 +14,4 @@ GEN_NS_BEGIN
|
|||||||
#include "dependencies/filesystem.cpp"
|
#include "dependencies/filesystem.cpp"
|
||||||
#include "dependencies/timing.cpp"
|
#include "dependencies/timing.cpp"
|
||||||
|
|
||||||
GEN_NS_END
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "dependencies/header_start.hpp"
|
#include "dependencies/header_start.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
namespace gen {
|
||||||
|
|
||||||
#include "dependencies/macros.hpp"
|
#include "dependencies/macros.hpp"
|
||||||
#include "dependencies/basic_types.hpp"
|
#include "dependencies/basic_types.hpp"
|
||||||
@ -17,4 +17,4 @@ GEN_NS_BEGIN
|
|||||||
#include "dependencies/filesystem.hpp"
|
#include "dependencies/filesystem.hpp"
|
||||||
#include "dependencies/timing.hpp"
|
#include "dependencies/timing.hpp"
|
||||||
|
|
||||||
GEN_NS_END
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "helpers/push_ignores.inline.hpp"
|
#include "helpers/push_ignores.inline.hpp"
|
||||||
#include "components/header_start.hpp"
|
#include "components/header_start.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
namespace gen {
|
||||||
|
|
||||||
#include "components/types.hpp"
|
#include "components/types.hpp"
|
||||||
#include "components/temp/ecode.hpp"
|
#include "components/temp/ecode.hpp"
|
||||||
@ -27,6 +27,6 @@ GEN_NS_BEGIN
|
|||||||
#include "components/temp/ast_inlines.hpp"
|
#include "components/temp/ast_inlines.hpp"
|
||||||
#include "components/header_end.hpp"
|
#include "components/header_end.hpp"
|
||||||
|
|
||||||
GEN_NS_END
|
}
|
||||||
|
|
||||||
#include "helpers/pop_ignores.inline.hpp"
|
#include "helpers/pop_ignores.inline.hpp"
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
#include "gen.hpp"
|
#include "gen.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
namespace gen {
|
||||||
#include "dependencies/parsing.hpp"
|
#include "dependencies/parsing.hpp"
|
||||||
GEN_NS_END
|
}
|
||||||
|
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
|
||||||
@ -30,13 +30,7 @@ CodeBody gen_ecode( char const* path )
|
|||||||
to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", code, code );
|
to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", code, code );
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeEnum enum_code = parse_enum( token_fmt( "entries", (StrC)enum_entries, stringize(
|
CodeEnum enum_code = parse_enum(gen::token_fmt_impl((3 + 1) / 2, "entries", (StrC)enum_entries, "enum Type : u32 { <entries> NumTypes };"));
|
||||||
enum Type : u32
|
|
||||||
{
|
|
||||||
<entries>
|
|
||||||
NumTypes
|
|
||||||
};
|
|
||||||
)));
|
|
||||||
|
|
||||||
#pragma push_macro( "local_persist" )
|
#pragma push_macro( "local_persist" )
|
||||||
#undef local_persist
|
#undef local_persist
|
||||||
|
Loading…
Reference in New Issue
Block a user