mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 07:44:45 -08:00
Pushing latest changes for gencpp
This commit is contained in:
parent
626ab703a7
commit
83d691c65c
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -49,5 +49,7 @@
|
||||
"**/.vscode": true,
|
||||
"**/.vs": true,
|
||||
"**/sanity.gen.hpp": true
|
||||
}
|
||||
},
|
||||
"autoHide.autoHidePanel": false,
|
||||
"autoHide.autoHideSideBar": false
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<BuildCommand>pwsh ./scripts/build.ps1 msvc debug bootstrap</BuildCommand>
|
||||
<RebuildCommand></RebuildCommand>
|
||||
<BuildFileCommand></BuildFileCommand>
|
||||
<CleanCommand>psh ./scripts/clean.ps1</CleanCommand>
|
||||
<CleanCommand>pwsh ./scripts/clean.ps1</CleanCommand>
|
||||
<BuildWorkingDirectory></BuildWorkingDirectory>
|
||||
<CancelBuild></CancelBuild>
|
||||
<RunCommand>./test/gen/build/gencpp.exe</RunCommand>
|
||||
|
@ -366,6 +366,9 @@
|
||||
<Content Include="scripts\helpers\target_arch.psm1" />
|
||||
<Content Include="scripts\refactor.ps1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="singleheader\gen\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -7,7 +7,6 @@ Builder Builder::open( char const* path )
|
||||
Builder result;
|
||||
|
||||
FileError error = file_open_mode( & result.File, EFileMode_WRITE, path );
|
||||
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
log_failure( "gen::File::open - Could not open file: %s", path);
|
||||
|
@ -96,8 +96,8 @@ $lib_winmm = 'Winmm.lib'
|
||||
$stack_size = 1024 * 1024 * 4
|
||||
|
||||
$compiler_args = @(
|
||||
($flag_define + 'UNICODE'),
|
||||
($flag_define + '_UNICODE')
|
||||
( $flag_define + 'UNICODE'),
|
||||
( $flag_define + '_UNICODE')
|
||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0'),
|
||||
( $flag_define + 'RL_USE_LIBTYPE_SHARED')
|
||||
# ($flag_set_stack_size + $stack_size)
|
||||
|
@ -75,7 +75,7 @@ namespace ECode
|
||||
StrC to_str( Type type )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{sizeof( "Invalid" ), "Invalid" },
|
||||
{ sizeof( "Invalid" ), "Invalid" },
|
||||
{ sizeof( "Untyped" ), "Untyped" },
|
||||
{ sizeof( "NewLine" ), "NewLine" },
|
||||
{ sizeof( "Comment" ), "Comment" },
|
||||
@ -98,7 +98,7 @@ namespace ECode
|
||||
{ sizeof( "Execution" ), "Execution" },
|
||||
{ sizeof( "Export_Body" ), "Export_Body" },
|
||||
{ sizeof( "Extern_Linkage" ), "Extern_Linkage" },
|
||||
{ sizeof( "Extern_Linkage_Body" ), "Extern_Linkage_Body"},
|
||||
{ sizeof( "Extern_Linkage_Body" ), "Extern_Linkage_Body" },
|
||||
{ sizeof( "Friend" ), "Friend" },
|
||||
{ sizeof( "Function" ), "Function" },
|
||||
{ sizeof( "Function_Fwd" ), "Function_Fwd" },
|
||||
@ -110,7 +110,7 @@ namespace ECode
|
||||
{ sizeof( "Operator" ), "Operator" },
|
||||
{ sizeof( "Operator_Fwd" ), "Operator_Fwd" },
|
||||
{ sizeof( "Operator_Member" ), "Operator_Member" },
|
||||
{ sizeof( "Operator_Member_Fwd" ), "Operator_Member_Fwd"},
|
||||
{ sizeof( "Operator_Member_Fwd" ), "Operator_Member_Fwd" },
|
||||
{ sizeof( "Operator_Cast" ), "Operator_Cast" },
|
||||
{ sizeof( "Operator_Cast_Fwd" ), "Operator_Cast_Fwd" },
|
||||
{ sizeof( "Parameters" ), "Parameters" },
|
||||
@ -118,7 +118,7 @@ namespace ECode
|
||||
{ sizeof( "Preprocess_Include" ), "Preprocess_Include" },
|
||||
{ sizeof( "Preprocess_If" ), "Preprocess_If" },
|
||||
{ sizeof( "Preprocess_IfDef" ), "Preprocess_IfDef" },
|
||||
{ sizeof( "Preprocess_IfNotDef" ), "Preprocess_IfNotDef"},
|
||||
{ sizeof( "Preprocess_IfNotDef" ), "Preprocess_IfNotDef" },
|
||||
{ sizeof( "Preprocess_ElIf" ), "Preprocess_ElIf" },
|
||||
{ sizeof( "Preprocess_Else" ), "Preprocess_Else" },
|
||||
{ sizeof( "Preprocess_EndIf" ), "Preprocess_EndIf" },
|
||||
|
@ -58,7 +58,7 @@ namespace EOperator
|
||||
StrC to_str( Type op )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{sizeof( "INVALID" ), "INVALID"},
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "=" ), "=" },
|
||||
{ sizeof( "+=" ), "+=" },
|
||||
{ sizeof( "-=" ), "-=" },
|
||||
|
@ -46,7 +46,7 @@ namespace ESpecifier
|
||||
StrC to_str( Type type )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "consteval" ), "consteval" },
|
||||
{ sizeof( "constexpr" ), "constexpr" },
|
||||
{ sizeof( "constinit" ), "constinit" },
|
||||
@ -56,7 +56,7 @@ namespace ESpecifier
|
||||
{ sizeof( "global" ), "global" },
|
||||
{ sizeof( "inline" ), "inline" },
|
||||
{ sizeof( "internal" ), "internal" },
|
||||
{ sizeof( "local_persist" ), "local_persist"},
|
||||
{ sizeof( "local_persist" ), "local_persist" },
|
||||
{ sizeof( "mutable" ), "mutable" },
|
||||
{ sizeof( "neverinline" ), "neverinline" },
|
||||
{ sizeof( "*" ), "*" },
|
||||
|
@ -116,7 +116,7 @@ namespace parser
|
||||
StrC to_str( Type type )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{sizeof( "__invalid__" ), "__invalid__" },
|
||||
{ sizeof( "__invalid__" ), "__invalid__" },
|
||||
{ sizeof( "private" ), "private" },
|
||||
{ sizeof( "protected" ), "protected" },
|
||||
{ sizeof( "public" ), "public" },
|
||||
@ -211,8 +211,8 @@ namespace parser
|
||||
{ sizeof( "_W64" ), "_W64" },
|
||||
{ sizeof( "..." ), "..." },
|
||||
{ sizeof( "__attrib_start__" ), "__attrib_start__" },
|
||||
{ sizeof( "GEN_API_Export_Code" ), "GEN_API_Export_Code"},
|
||||
{ sizeof( "GEN_API_Import_Code" ), "GEN_API_Import_Code"},
|
||||
{ sizeof( "GEN_API_Export_Code" ), "GEN_API_Export_Code" },
|
||||
{ sizeof( "GEN_API_Import_Code" ), "GEN_API_Import_Code" },
|
||||
};
|
||||
return lookup[ type ];
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ struct Array
|
||||
return get_header()->Num;
|
||||
}
|
||||
|
||||
bool pop( void )
|
||||
void pop( void )
|
||||
{
|
||||
Header& header = * get_header();
|
||||
|
||||
@ -246,7 +246,11 @@ struct Array
|
||||
return true;
|
||||
|
||||
if ( new_capacity < header.Num )
|
||||
{
|
||||
// Already have the memory, mine as well keep it.
|
||||
header.Num = new_capacity;
|
||||
return true;
|
||||
}
|
||||
|
||||
sw size = sizeof( Header ) + sizeof( Type ) * new_capacity;
|
||||
Header* new_header = rcast( Header*, alloc( header.Allocator, size ) );
|
||||
@ -289,6 +293,8 @@ struct Array
|
||||
}
|
||||
};
|
||||
|
||||
// TODO(Ed) : This thing needs ALOT of work.
|
||||
|
||||
template<typename Type>
|
||||
struct HashTable
|
||||
{
|
||||
|
@ -24,7 +24,16 @@ void validate_file_ast( char const* path, char const* path_gen )
|
||||
{
|
||||
log_fmt( "\nValidating: %s", path );
|
||||
|
||||
String path_temp = String::make_length( GlobalAllocator, path_gen, str_len( path_gen ) );
|
||||
|
||||
FileContents file = file_read_contents( GlobalAllocator, true, path );
|
||||
// FileError error = file_open_mode( & path_temp, EFileMode_WRITE, path );
|
||||
// if ( error != EFileError_NONE )
|
||||
// {
|
||||
// log_failure( "gen::File::open - Could not open file: %s", path);
|
||||
// return;
|
||||
// }
|
||||
|
||||
u64 time_start = time_rel_ms();
|
||||
CodeBody ast = parse_global_body( { file.size, (char const*)file.data } );
|
||||
log_fmt("\n\tAst generated. Time taken: %llu ms", time_rel_ms() - time_start);
|
||||
|
Loading…
Reference in New Issue
Block a user