Pushing latest changes for gencpp

This commit is contained in:
Edward R. Gonzalez 2024-04-17 16:55:22 -04:00
parent 626ab703a7
commit 83d691c65c
11 changed files with 254 additions and 235 deletions

View File

@ -49,5 +49,7 @@
"**/.vscode": true, "**/.vscode": true,
"**/.vs": true, "**/.vs": true,
"**/sanity.gen.hpp": true "**/sanity.gen.hpp": true
} },
"autoHide.autoHidePanel": false,
"autoHide.autoHideSideBar": false
} }

View File

@ -11,7 +11,7 @@
<BuildCommand>pwsh ./scripts/build.ps1 msvc debug bootstrap</BuildCommand> <BuildCommand>pwsh ./scripts/build.ps1 msvc debug bootstrap</BuildCommand>
<RebuildCommand></RebuildCommand> <RebuildCommand></RebuildCommand>
<BuildFileCommand></BuildFileCommand> <BuildFileCommand></BuildFileCommand>
<CleanCommand>psh ./scripts/clean.ps1</CleanCommand> <CleanCommand>pwsh ./scripts/clean.ps1</CleanCommand>
<BuildWorkingDirectory></BuildWorkingDirectory> <BuildWorkingDirectory></BuildWorkingDirectory>
<CancelBuild></CancelBuild> <CancelBuild></CancelBuild>
<RunCommand>./test/gen/build/gencpp.exe</RunCommand> <RunCommand>./test/gen/build/gencpp.exe</RunCommand>

View File

@ -366,6 +366,9 @@
<Content Include="scripts\helpers\target_arch.psm1" /> <Content Include="scripts\helpers\target_arch.psm1" />
<Content Include="scripts\refactor.ps1" /> <Content Include="scripts\refactor.ps1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="singleheader\gen\" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -7,7 +7,6 @@ Builder Builder::open( char const* path )
Builder result; Builder result;
FileError error = file_open_mode( & result.File, EFileMode_WRITE, path ); FileError error = file_open_mode( & result.File, EFileMode_WRITE, path );
if ( error != EFileError_NONE ) if ( error != EFileError_NONE )
{ {
log_failure( "gen::File::open - Could not open file: %s", path); log_failure( "gen::File::open - Could not open file: %s", path);

View File

@ -195,7 +195,7 @@ struct Array
return get_header()->Num; return get_header()->Num;
} }
bool pop( void ) void pop( void )
{ {
Header& header = * get_header(); Header& header = * get_header();
@ -246,7 +246,11 @@ struct Array
return true; return true;
if ( new_capacity < header.Num ) if ( new_capacity < header.Num )
{
// Already have the memory, mine as well keep it.
header.Num = new_capacity; header.Num = new_capacity;
return true;
}
sw size = sizeof( Header ) + sizeof( Type ) * new_capacity; sw size = sizeof( Header ) + sizeof( Type ) * new_capacity;
Header* new_header = rcast( Header*, alloc( header.Allocator, size ) ); 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> template<typename Type>
struct HashTable struct HashTable
{ {

View File

@ -24,7 +24,16 @@ void validate_file_ast( char const* path, char const* path_gen )
{ {
log_fmt( "\nValidating: %s", path ); 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 ); 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(); u64 time_start = time_rel_ms();
CodeBody ast = parse_global_body( { file.size, (char const*)file.data } ); 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); log_fmt("\n\tAst generated. Time taken: %llu ms", time_rel_ms() - time_start);