mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Merge pull request #23 from Ed94/dev
dev pull - Build script updates and misc fixes
This commit is contained in:
commit
12bf878cb3
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
.idea
|
.idea
|
||||||
|
|
||||||
build/*
|
**/build/*
|
||||||
.vs
|
.vs
|
||||||
|
|
||||||
**/*.gen.*
|
**/*.gen.*
|
||||||
|
18
.vscode/c_cpp_properties.json
vendored
18
.vscode/c_cpp_properties.json
vendored
@ -1,7 +1,23 @@
|
|||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32 msvc",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"defines": [
|
||||||
|
"_DEBUG",
|
||||||
|
"UNICODE",
|
||||||
|
"_UNICODE",
|
||||||
|
"GEN_TIME"
|
||||||
|
],
|
||||||
|
"windowsSdkVersion": "10.0.19041.0",
|
||||||
|
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
|
||||||
|
"intelliSenseMode": "msvc-x64",
|
||||||
|
"compileCommands": "${workspaceFolder}/project/build/compile_commands.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Win32 clang",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/**"
|
"${workspaceFolder}/**"
|
||||||
],
|
],
|
||||||
|
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
@ -8,9 +8,9 @@
|
|||||||
"type": "lldb",
|
"type": "lldb",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug gentime lldb",
|
"name": "Debug gentime lldb",
|
||||||
"program": "${workspaceFolder}/test/gen/build/gencpp.exe",
|
"program": "${workspaceFolder}/test/test.exe",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/test/gen/",
|
"cwd": "${workspaceFolder}/test/",
|
||||||
"postRunCommands": [
|
"postRunCommands": [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -18,16 +18,16 @@
|
|||||||
"type": "cppvsdbg",
|
"type": "cppvsdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug gentime vsdbg",
|
"name": "Debug gentime vsdbg",
|
||||||
"program": "${workspaceFolder}/test/gen/build/gencpp.exe",
|
"program": "${workspaceFolder}/test/build/test.exe",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/test/gen/",
|
"cwd": "${workspaceFolder}/test/",
|
||||||
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "cppvsdbg",
|
"type": "cppvsdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug bootstrap vsdbg",
|
"name": "Debug bootstrap vsdbg",
|
||||||
"program": "${workspaceFolder}/project/build/gencpp_bootstrap.exe",
|
"program": "${workspaceFolder}/project/build/bootstrap.exe",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/project/",
|
"cwd": "${workspaceFolder}/project/",
|
||||||
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
"visualizerFile": "${workspaceFolder}/scripts/gencpp.natvis"
|
||||||
|
@ -40,7 +40,6 @@ The keywords supported for the preprocessor are:
|
|||||||
* ifdef
|
* ifdef
|
||||||
* elif
|
* elif
|
||||||
* endif
|
* endif
|
||||||
* undef
|
|
||||||
* pragma
|
* pragma
|
||||||
|
|
||||||
Each directive `#` line is considered one preproecessor unit, and will be treated as one Preprocessor AST. *These ASTs will be considered members or entries of braced scope they reside within*.
|
Each directive `#` line is considered one preproecessor unit, and will be treated as one Preprocessor AST. *These ASTs will be considered members or entries of braced scope they reside within*.
|
||||||
|
@ -360,7 +360,7 @@ Code <name> = code_str( <some code without "" quotes > )
|
|||||||
Template metaprogramming in the traditional sense becomes possible with the use of `token_fmt` and parse constructors:
|
Template metaprogramming in the traditional sense becomes possible with the use of `token_fmt` and parse constructors:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
StrC value = txt_StrC("Something");
|
StrC value = txt("Something");
|
||||||
|
|
||||||
char const* template_str = txt(
|
char const* template_str = txt(
|
||||||
Code with <key> to replace with token_values
|
Code with <key> to replace with token_values
|
||||||
@ -447,7 +447,7 @@ and have the desired specifiers assigned to them beforehand.
|
|||||||
|
|
||||||
## Code generation and modification
|
## Code generation and modification
|
||||||
|
|
||||||
There are three provided file interfaces:
|
There are three provided auxillary interfaces:
|
||||||
|
|
||||||
* Builder
|
* Builder
|
||||||
* Editor
|
* Editor
|
||||||
@ -462,11 +462,12 @@ Editor and Scanner are disabled by default, use `GEN_FEATURE_EDITOR` and `GEN_FE
|
|||||||
* The code is provided via print( code ) function will be serialized to its buffer.
|
* The code is provided via print( code ) function will be serialized to its buffer.
|
||||||
* When all serialization is finished, use the write() command to write the buffer to the file.
|
* When all serialization is finished, use the write() command to write the buffer to the file.
|
||||||
|
|
||||||
### Editor is for editing a series of files based on a set of requests provided to it
|
### Editor is for editing a series of files/asts based on a set of requests provided to it
|
||||||
|
|
||||||
**Note: Not implemented yet**
|
**Note: Not implemented yet**
|
||||||
|
|
||||||
* The purpose is to overrite a specific file, it places its contents in a buffer to scan.
|
* The purpose is to overrite a specific file, it places its contents in a buffer to scan.
|
||||||
|
* If editing an AST it will generate a new ast as a result (ASTs are not edited).
|
||||||
* Requests are populated using the following interface:
|
* Requests are populated using the following interface:
|
||||||
* add : Add code.
|
* add : Add code.
|
||||||
* remove : Remove code.
|
* remove : Remove code.
|
||||||
@ -486,7 +487,7 @@ Additionally if `GEN_FEATURE_EDITOR_REFACTOR` is defined, refactor( file_path, s
|
|||||||
Refactor is based of the refactor library and uses its interface.
|
Refactor is based of the refactor library and uses its interface.
|
||||||
It will on call add a request to the queue to run the refactor script on the file.
|
It will on call add a request to the queue to run the refactor script on the file.
|
||||||
|
|
||||||
### Scanner allows the user to generate Code ASTs by reading files
|
### Scanner allows the user to sift through a series of files/asts based on a set of requests provided to it
|
||||||
|
|
||||||
**Note: Not implemented yet**
|
**Note: Not implemented yet**
|
||||||
|
|
||||||
@ -495,8 +496,6 @@ It will on call add a request to the queue to run the refactor script on the fil
|
|||||||
|
|
||||||
The file will only be read from, no writing supported.
|
The file will only be read from, no writing supported.
|
||||||
|
|
||||||
One great use case is for example: generating the single-header library for gencpp!
|
|
||||||
|
|
||||||
### Additional Info (Editor and Scanner)
|
### Additional Info (Editor and Scanner)
|
||||||
|
|
||||||
When all requests have been populated, call process_requests().
|
When all requests have been populated, call process_requests().
|
||||||
|
127
gencpp.vcxproj
127
gencpp.vcxproj
@ -98,49 +98,52 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include=".editorconfig" />
|
<None Include=".editorconfig" />
|
||||||
|
<None Include="project\components\temp\Readme.md" />
|
||||||
<None Include="Readme.md" />
|
<None Include="Readme.md" />
|
||||||
<None Include="scripts\build.ci.ps1" />
|
<None Include="scripts\build.ci.ps1" />
|
||||||
<None Include="scripts\build.ps1" />
|
<None Include="scripts\build.ps1" />
|
||||||
<None Include="scripts\clean.ps1" />
|
<None Include="scripts\clean.ps1" />
|
||||||
<None Include="scripts\gen.ps1" />
|
|
||||||
<None Include="scripts\genccp.natstepfilter" />
|
<None Include="scripts\genccp.natstepfilter" />
|
||||||
<None Include="scripts\gencpp.refactor" />
|
<None Include="scripts\gencpp.refactor" />
|
||||||
<None Include="scripts\get_sources.ps1" />
|
|
||||||
<None Include="test\gen\meson.build" />
|
<None Include="test\gen\meson.build" />
|
||||||
<None Include="test\meson.build" />
|
<None Include="test\meson.build" />
|
||||||
<None Include="test\Readme.md" />
|
<None Include="test\Readme.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="project\components\gen.data_structures.hpp" />
|
<ClInclude Include="project\auxillary\builder.hpp" />
|
||||||
<ClInclude Include="project\components\gen.ecode.hpp" />
|
<ClInclude Include="project\auxillary\editor.hpp" />
|
||||||
<ClInclude Include="project\components\gen.eoperator.hpp" />
|
<ClInclude Include="project\auxillary\scanner.hpp" />
|
||||||
<ClInclude Include="project\components\gen.especifier.hpp" />
|
<ClInclude Include="project\components\ast.hpp" />
|
||||||
<ClInclude Include="project\components\gen.header_end.hpp" />
|
<ClInclude Include="project\components\ast_types.hpp" />
|
||||||
<ClInclude Include="project\components\gen.header_start.hpp" />
|
<ClInclude Include="project\components\header_end.hpp" />
|
||||||
<ClInclude Include="project\components\gen.interface.hpp" />
|
<ClInclude Include="project\components\header_start.hpp" />
|
||||||
<ClInclude Include="project\components\gen.types.hpp" />
|
<ClInclude Include="project\components\inlines.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.basic_types.hpp" />
|
<ClInclude Include="project\components\interface.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.containers.hpp" />
|
<ClInclude Include="project\components\temp\ast_inlines.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.debug.hpp" />
|
<ClInclude Include="project\components\temp\ecode.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.file_handling.hpp" />
|
<ClInclude Include="project\components\temp\eoperator.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.hashing.hpp" />
|
<ClInclude Include="project\components\temp\especifier.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.header_start.hpp" />
|
<ClInclude Include="project\components\types.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.macros.hpp" />
|
<ClInclude Include="project\dependencies\basic_types.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.memory.hpp" />
|
<ClInclude Include="project\dependencies\containers.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.parsing.hpp" />
|
<ClInclude Include="project\dependencies\debug.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.printing.hpp" />
|
<ClInclude Include="project\dependencies\filesystem.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.string.hpp" />
|
<ClInclude Include="project\dependencies\hashing.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.string_ops.hpp" />
|
<ClInclude Include="project\dependencies\header_start.hpp" />
|
||||||
<ClInclude Include="project\dependencies\gen.timing.hpp" />
|
<ClInclude Include="project\dependencies\macros.hpp" />
|
||||||
<ClInclude Include="project\filesystem\gen.builder.hpp" />
|
<ClInclude Include="project\dependencies\memory.hpp" />
|
||||||
<ClInclude Include="project\filesystem\gen.editor.hpp" />
|
<ClInclude Include="project\dependencies\parsing.hpp" />
|
||||||
<ClInclude Include="project\filesystem\gen.scanner.hpp" />
|
<ClInclude Include="project\dependencies\printing.hpp" />
|
||||||
|
<ClInclude Include="project\dependencies\strings.hpp" />
|
||||||
|
<ClInclude Include="project\dependencies\string_ops.hpp" />
|
||||||
|
<ClInclude Include="project\dependencies\timing.hpp" />
|
||||||
<ClInclude Include="project\gen.dep.hpp" />
|
<ClInclude Include="project\gen.dep.hpp" />
|
||||||
<ClInclude Include="project\gen.hpp" />
|
<ClInclude Include="project\gen.hpp" />
|
||||||
<ClInclude Include="project\helpers\gen.pop_ignores.inline.hpp" />
|
<ClInclude Include="project\helpers\helper.hpp" />
|
||||||
<ClInclude Include="project\helpers\gen.push_ignores.inline.hpp" />
|
<ClInclude Include="project\helpers\pop_ignores.inline.hpp" />
|
||||||
<ClInclude Include="project\helpers\gen.undef.macros.hpp" />
|
<ClInclude Include="project\helpers\push_ignores.inline.hpp" />
|
||||||
<ClInclude Include="singleheader\components\gen.header_start.hpp" />
|
<ClInclude Include="project\helpers\undef.macros.hpp" />
|
||||||
|
<ClInclude Include="singleheader\components\header_start.hpp" />
|
||||||
<ClInclude Include="test\DummyInclude.hpp" />
|
<ClInclude Include="test\DummyInclude.hpp" />
|
||||||
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp" />
|
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp" />
|
||||||
<ClInclude Include="test\Parsed\HashTable.Parsed.hpp" />
|
<ClInclude Include="test\Parsed\HashTable.Parsed.hpp" />
|
||||||
@ -157,29 +160,31 @@
|
|||||||
<ClInclude Include="test\Parsed\Sanity.Parsed.hpp" />
|
<ClInclude Include="test\Parsed\Sanity.Parsed.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="project\components\gen.ast.cpp" />
|
<ClCompile Include="project\auxillary\builder.cpp" />
|
||||||
<ClCompile Include="project\components\gen.ast_case_macros.cpp" />
|
<ClCompile Include="project\auxillary\scanner.cpp" />
|
||||||
<ClCompile Include="project\components\gen.data.cpp" />
|
<ClCompile Include="project\bootstrap.cpp" />
|
||||||
<ClCompile Include="project\components\gen.etoktype.cpp" />
|
<ClCompile Include="project\components\ast.cpp" />
|
||||||
<ClCompile Include="project\components\gen.impl_start.cpp" />
|
<ClCompile Include="project\components\ast_case_macros.cpp" />
|
||||||
<ClCompile Include="project\components\gen.interface.cpp" />
|
<ClCompile Include="project\components\interface.cpp" />
|
||||||
<ClCompile Include="project\components\gen.interface.parsing.cpp" />
|
<ClCompile Include="project\components\interface.parsing.cpp" />
|
||||||
<ClCompile Include="project\components\gen.interface.upfront.cpp" />
|
<ClCompile Include="project\components\interface.upfront.cpp" />
|
||||||
<ClCompile Include="project\components\gen.untyped.cpp" />
|
<ClCompile Include="project\components\src_start.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.debug.cpp" />
|
<ClCompile Include="project\components\static_data.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.file_handling.cpp" />
|
<ClCompile Include="project\components\temp\etoktype.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.hashing.cpp" />
|
<ClCompile Include="project\components\untyped.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.impl_start.cpp" />
|
<ClCompile Include="project\dependencies\debug.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.memory.cpp" />
|
<ClCompile Include="project\dependencies\filesystem.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.parsing.cpp" />
|
<ClCompile Include="project\dependencies\hashing.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.printing.cpp" />
|
<ClCompile Include="project\dependencies\memory.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.string.cpp" />
|
<ClCompile Include="project\dependencies\parsing.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.string_ops.cpp" />
|
<ClCompile Include="project\dependencies\printing.cpp" />
|
||||||
<ClCompile Include="project\dependencies\gen.timing.cpp" />
|
<ClCompile Include="project\dependencies\src_start.cpp" />
|
||||||
<ClCompile Include="project\gen.bootstrap.cpp" />
|
<ClCompile Include="project\dependencies\strings.cpp" />
|
||||||
|
<ClCompile Include="project\dependencies\string_ops.cpp" />
|
||||||
|
<ClCompile Include="project\dependencies\timing.cpp" />
|
||||||
<ClCompile Include="project\gen.cpp" />
|
<ClCompile Include="project\gen.cpp" />
|
||||||
<ClCompile Include="project\gen.dep.cpp" />
|
<ClCompile Include="project\gen.dep.cpp" />
|
||||||
<ClCompile Include="singleheader\gen.singleheader.cpp" />
|
<ClCompile Include="singleheader\singleheader.cpp" />
|
||||||
<ClCompile Include="test\parsing.cpp" />
|
<ClCompile Include="test\parsing.cpp" />
|
||||||
<ClCompile Include="test\sanity.cpp" />
|
<ClCompile Include="test\sanity.cpp" />
|
||||||
<ClCompile Include="test\SOA.cpp" />
|
<ClCompile Include="test\SOA.cpp" />
|
||||||
@ -193,21 +198,15 @@
|
|||||||
<Natvis Include="scripts\gencpp.natvis" />
|
<Natvis Include="scripts\gencpp.natvis" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="project\components\AttributeTokens.csv" />
|
<Content Include="project\enums\AttributeTokens.csv" />
|
||||||
<Content Include="project\components\ECode.csv" />
|
<Content Include="project\enums\ECode.csv" />
|
||||||
<Content Include="project\components\EOperator.csv" />
|
<Content Include="project\enums\EOperator.csv" />
|
||||||
<Content Include="project\components\ESpecifier.csv" />
|
<Content Include="project\enums\ESpecifier.csv" />
|
||||||
<Content Include="project\components\ETokType.csv" />
|
<Content Include="project\enums\ETokType.csv" />
|
||||||
<Content Include="project\meson.build" />
|
|
||||||
<Content Include="scripts\.clang-format" />
|
<Content Include="scripts\.clang-format" />
|
||||||
<Content Include="scripts\bootstrap.ci.ps1" />
|
<Content Include="scripts\helpers\devshell.ps1" />
|
||||||
<Content Include="scripts\bootstrap.ps1" />
|
<Content Include="scripts\helpers\target_arch.psm1" />
|
||||||
<Content Include="scripts\msvc\build_msvc.ps1" />
|
|
||||||
<Content Include="scripts\msvc\devshell.ps1" />
|
|
||||||
<Content Include="scripts\refactor.ps1" />
|
<Content Include="scripts\refactor.ps1" />
|
||||||
<Content Include="scripts\singleheader.ci.ps1" />
|
|
||||||
<Content Include="scripts\singleheader.ps1" />
|
|
||||||
<Content Include="singleheader\meson.build" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -18,18 +18,9 @@
|
|||||||
<ClCompile Include="project\gen.cpp">
|
<ClCompile Include="project\gen.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="test\gen\build\meson-private\sanitycheckc.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="test\gen\build\meson-private\sanitycheckcpp.cc">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="test\test.cpp">
|
<ClCompile Include="test\test.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="singleheader\gen\gen.singleheader.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="test\test.Upfront.cpp">
|
<ClCompile Include="test\test.Upfront.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -60,9 +51,6 @@
|
|||||||
<ClCompile Include="project\components\gen.interface.upfront.cpp">
|
<ClCompile Include="project\components\gen.interface.upfront.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="project\dependencies\gen.dep.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="project\dependencies\gen.file_handling.cpp">
|
<ClCompile Include="project\dependencies\gen.file_handling.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -75,32 +63,116 @@
|
|||||||
<ClCompile Include="project\dependencies\gen.printing.cpp">
|
<ClCompile Include="project\dependencies\gen.printing.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.ast_case_macros.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.data.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.etoktype.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.impl_start.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.interface.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\gen.untyped.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.debug.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.hashing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.impl_start.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.string.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.string_ops.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\gen.timing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\gen.bootstrap.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="singleheader\gen.singleheader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\temp\etoktype.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\ast.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\ast_case_macros.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\interface.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\interface.parsing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\interface.upfront.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\src_start.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\static_data.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\components\untyped.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\bootstrap.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\debug.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\filesystem.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\hashing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\memory.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\parsing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\printing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\src_start.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\string_ops.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\strings.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="project\dependencies\timing.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="project\gen.hpp">
|
<ClInclude Include="project\gen.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="project\gen.undef.macros.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\DummyInclude.hpp">
|
<ClInclude Include="test\DummyInclude.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="test\gen\array.Upfront.gen.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\gen\buffer.Upfront.gen.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\gen\hashtable.Upfront.gen.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\gen\ring.Upfront.gen.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\gen\sanity.Upfront.gen.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp">
|
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -137,18 +209,6 @@
|
|||||||
<ClInclude Include="project\gen.dep.hpp">
|
<ClInclude Include="project\gen.dep.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="project\gen.editor.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="project\gen.pop_ignores.inline.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="project\gen.push_ignores.inline.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="project\gen.scanner.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test\parsing.hpp">
|
<ClInclude Include="test\parsing.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -170,9 +230,6 @@
|
|||||||
<ClInclude Include="project\dependencies\gen.containers.hpp">
|
<ClInclude Include="project\dependencies\gen.containers.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="project\dependencies\gen.dep.hpp">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="project\dependencies\gen.file_handling.hpp">
|
<ClInclude Include="project\dependencies\gen.file_handling.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -215,6 +272,117 @@
|
|||||||
<ClInclude Include="project\helpers\gen.undef.macros.hpp">
|
<ClInclude Include="project\helpers\gen.undef.macros.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\gen.ecode.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\gen.eoperator.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\gen.especifier.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\gen.header_end.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\gen.header_start.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\gen.debug.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\gen.hashing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\gen.timing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="singleheader\components\gen.header_start.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\temp\ast_inlines.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\temp\ecode.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\temp\eoperator.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\temp\especifier.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\ast.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\ast_types.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\header_end.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\header_start.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\inlines.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\interface.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\components\types.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\helpers\helper.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\helpers\pop_ignores.inline.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\helpers\push_ignores.inline.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\helpers\undef.macros.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\basic_types.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\containers.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\debug.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\filesystem.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\hashing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\header_start.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\macros.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\memory.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\parsing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\printing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\string_ops.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\strings.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="project\dependencies\timing.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include=".editorconfig" />
|
<None Include=".editorconfig" />
|
||||||
@ -229,6 +397,7 @@
|
|||||||
<None Include="scripts\gen.ps1" />
|
<None Include="scripts\gen.ps1" />
|
||||||
<None Include="scripts\genccp.natstepfilter" />
|
<None Include="scripts\genccp.natstepfilter" />
|
||||||
<None Include="scripts\gencpp.refactor" />
|
<None Include="scripts\gencpp.refactor" />
|
||||||
|
<None Include="project\components\temp\Readme.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include=".vscode\gencpp.natvis" />
|
<Natvis Include=".vscode\gencpp.natvis" />
|
||||||
|
@ -12,6 +12,7 @@ Builder Builder::open( char const* path )
|
|||||||
|
|
||||||
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
|
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
|
||||||
|
|
||||||
|
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +23,11 @@ void Builder::pad_lines( s32 num )
|
|||||||
|
|
||||||
void Builder::print( Code code )
|
void Builder::print( Code code )
|
||||||
{
|
{
|
||||||
Buffer.append( code->to_string() );
|
String str = code->to_string();
|
||||||
|
const sw len = str.length();
|
||||||
|
|
||||||
|
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
||||||
|
Buffer.append( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Builder::print_fmt( char const* fmt, ... )
|
void Builder::print_fmt( char const* fmt, ... )
|
||||||
@ -35,6 +40,7 @@ void Builder::print_fmt( char const* fmt, ... )
|
|||||||
res = str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
|
res = str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
|
||||||
va_end( va );
|
va_end( va );
|
||||||
|
|
||||||
|
// log_fmt( "$%s - print_fmt: %.*s\n", File.filename, res > 80 ? 80 : res, buf );
|
||||||
Buffer.append( buf, res );
|
Buffer.append( buf, res );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +49,9 @@ void Builder::write()
|
|||||||
bool result = file_write( & File, Buffer, Buffer.length() );
|
bool result = file_write( & File, Buffer, Buffer.length() );
|
||||||
|
|
||||||
if ( result == false )
|
if ( result == false )
|
||||||
log_failure("gen::File::write - Failed to write to file: %s", file_name( & File ) );
|
log_failure("gen::File::write - Failed to write to file: %s\n", file_name( & File ) );
|
||||||
|
|
||||||
|
log_fmt( "Generated: %s\n", File.filename );
|
||||||
file_close( & File );
|
file_close( & File );
|
||||||
Buffer.free();
|
Buffer.free();
|
||||||
}
|
}
|
1
project/auxillary/scanner.cpp
Normal file
1
project/auxillary/scanner.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -5,13 +5,13 @@ Code scan_file( char const* path )
|
|||||||
FileError error = file_open_mode( & file, EFileMode_READ, path );
|
FileError error = file_open_mode( & file, EFileMode_READ, path );
|
||||||
if ( error != EFileError_NONE )
|
if ( error != EFileError_NONE )
|
||||||
{
|
{
|
||||||
fatal( "scan_file: Could not open: %s", path );
|
GEN_FATAL( "scan_file: Could not open: %s", path );
|
||||||
}
|
}
|
||||||
|
|
||||||
sw fsize = file_size( & file );
|
sw fsize = file_size( & file );
|
||||||
if ( fsize <= 0 )
|
if ( fsize <= 0 )
|
||||||
{
|
{
|
||||||
fatal("scan_file: %s is empty", path );
|
GEN_FATAL("scan_file: %s is empty", path );
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = String::make_reserve( GlobalAllocator, fsize );
|
String str = String::make_reserve( GlobalAllocator, fsize );
|
||||||
@ -36,7 +36,6 @@ struct SymbolInfo
|
|||||||
Code Signature;
|
Code Signature;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Scanner
|
struct Scanner
|
||||||
{
|
{
|
||||||
struct RequestEntry
|
struct RequestEntry
|
@ -3,15 +3,16 @@
|
|||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#include "gen.cpp"
|
#include "gen.cpp"
|
||||||
|
|
||||||
|
#include "helpers/push_ignores.inline.hpp"
|
||||||
#include "helpers/helper.hpp"
|
#include "helpers/helper.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
GEN_NS_BEGIN
|
||||||
#include "dependencies/parsing.cpp"
|
#include "dependencies/parsing.cpp"
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
|
||||||
#include "file_processors/builder.hpp"
|
#include "auxillary/builder.hpp"
|
||||||
#include "file_processors/builder.cpp"
|
#include "auxillary/builder.cpp"
|
||||||
#include "file_processors/scanner.hpp"
|
#include "auxillary/scanner.hpp"
|
||||||
|
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
|
||||||
@ -28,18 +29,18 @@ int gen_main()
|
|||||||
|
|
||||||
// gen_dep.hpp
|
// gen_dep.hpp
|
||||||
{
|
{
|
||||||
Code header_start = scan_file( "dependencies/header_start.hpp" );
|
Code header_start = scan_file( "dependencies/header_start.hpp" );
|
||||||
Code macros = scan_file( "dependencies/macros.hpp" );
|
Code macros = scan_file( "dependencies/macros.hpp" );
|
||||||
Code basic_types = scan_file( "dependencies/basic_types.hpp" );
|
Code basic_types = scan_file( "dependencies/basic_types.hpp" );
|
||||||
Code debug = scan_file( "dependencies/debug.hpp" );
|
Code debug = scan_file( "dependencies/debug.hpp" );
|
||||||
Code memory = scan_file( "dependencies/memory.hpp" );
|
Code memory = scan_file( "dependencies/memory.hpp" );
|
||||||
Code string_ops = scan_file( "dependencies/string_ops.hpp" );
|
Code string_ops = scan_file( "dependencies/string_ops.hpp" );
|
||||||
Code printing = scan_file( "dependencies/printing.hpp" );
|
Code printing = scan_file( "dependencies/printing.hpp" );
|
||||||
Code containers = scan_file( "dependencies/containers.hpp" );
|
Code containers = scan_file( "dependencies/containers.hpp" );
|
||||||
Code hashing = scan_file( "dependencies/hashing.hpp" );
|
Code hashing = scan_file( "dependencies/hashing.hpp" );
|
||||||
Code string = scan_file( "dependencies/string.hpp" );
|
Code strings = scan_file( "dependencies/strings.hpp" );
|
||||||
Code file_handling = scan_file( "dependencies/file_handling.hpp" );
|
Code filesystem = scan_file( "dependencies/filesystem.hpp" );
|
||||||
Code timing = scan_file( "dependencies/timing.hpp" );
|
Code timing = scan_file( "dependencies/timing.hpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
header = Builder::open("gen/gen.dep.hpp");
|
header = Builder::open("gen/gen.dep.hpp");
|
||||||
@ -56,8 +57,8 @@ int gen_main()
|
|||||||
header.print( printing );
|
header.print( printing );
|
||||||
header.print( containers );
|
header.print( containers );
|
||||||
header.print( hashing );
|
header.print( hashing );
|
||||||
header.print( string );
|
header.print( strings );
|
||||||
header.print( file_handling );
|
header.print( filesystem );
|
||||||
header.print( timing );
|
header.print( timing );
|
||||||
|
|
||||||
header.print_fmt( "GEN_NS_END\n\n" );
|
header.print_fmt( "GEN_NS_END\n\n" );
|
||||||
@ -66,15 +67,15 @@ int gen_main()
|
|||||||
|
|
||||||
// gen_dep.cpp
|
// gen_dep.cpp
|
||||||
{
|
{
|
||||||
Code src_start = scan_file( "dependencies/src_start.cpp" );
|
Code src_start = scan_file( "dependencies/src_start.cpp" );
|
||||||
Code debug = scan_file( "dependencies/debug.cpp" );
|
Code debug = scan_file( "dependencies/debug.cpp" );
|
||||||
Code string_ops = scan_file( "dependencies/string_ops.cpp" );
|
Code string_ops = scan_file( "dependencies/string_ops.cpp" );
|
||||||
Code printing = scan_file( "dependencies/printing.cpp" );
|
Code printing = scan_file( "dependencies/printing.cpp" );
|
||||||
Code memory = scan_file( "dependencies/memory.cpp" );
|
Code memory = scan_file( "dependencies/memory.cpp" );
|
||||||
Code hashing = scan_file( "dependencies/hashing.cpp" );
|
Code hashing = scan_file( "dependencies/hashing.cpp" );
|
||||||
Code string = scan_file( "dependencies/string.cpp" );
|
Code strings = scan_file( "dependencies/strings.cpp" );
|
||||||
Code file_handling = scan_file( "dependencies/file_handling.cpp" );
|
Code filesystem = scan_file( "dependencies/filesystem.cpp" );
|
||||||
Code timing = scan_file( "dependencies/timing.cpp" );
|
Code timing = scan_file( "dependencies/timing.cpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
src = Builder::open( "gen/gen.dep.cpp" );
|
src = Builder::open( "gen/gen.dep.cpp" );
|
||||||
@ -88,8 +89,8 @@ int gen_main()
|
|||||||
src.print( printing );
|
src.print( printing );
|
||||||
src.print( hashing );
|
src.print( hashing );
|
||||||
src.print( memory );
|
src.print( memory );
|
||||||
src.print( string );
|
src.print( strings );
|
||||||
src.print( file_handling );
|
src.print( filesystem );
|
||||||
src.print( timing );
|
src.print( timing );
|
||||||
|
|
||||||
src.print_fmt( "GEN_NS_END\n\n" );
|
src.print_fmt( "GEN_NS_END\n\n" );
|
||||||
@ -189,13 +190,13 @@ int gen_main()
|
|||||||
|
|
||||||
// gen_builder.hpp
|
// gen_builder.hpp
|
||||||
{
|
{
|
||||||
Code builder = scan_file( "file_processors/builder.hpp" );
|
Code builder = scan_file( "auxillary/builder.hpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
header = Builder::open( "gen/gen.builder.hpp" );
|
header = Builder::open( "gen/gen.builder.hpp" );
|
||||||
header.print_fmt( generation_notice );
|
header.print_fmt( generation_notice );
|
||||||
header.print_fmt( "#pragma once\n\n" );
|
header.print_fmt( "#pragma once\n\n" );
|
||||||
header.print( def_include( txt_StrC("gen.hpp") ));
|
header.print( def_include( txt("gen.hpp") ));
|
||||||
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
||||||
header.print( builder );
|
header.print( builder );
|
||||||
header.print_fmt( "\nGEN_NS_END\n\n" );
|
header.print_fmt( "\nGEN_NS_END\n\n" );
|
||||||
@ -204,12 +205,12 @@ int gen_main()
|
|||||||
|
|
||||||
// gen_builder.cpp
|
// gen_builder.cpp
|
||||||
{
|
{
|
||||||
Code builder = scan_file( "file_processors/builder.cpp" );
|
Code builder = scan_file( "auxillary/builder.cpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
src = Builder::open( "gen/gen.builder.cpp" );
|
src = Builder::open( "gen/gen.builder.cpp" );
|
||||||
src.print_fmt( generation_notice );
|
src.print_fmt( generation_notice );
|
||||||
src.print( def_include( txt_StrC("gen.builder.hpp") ) );
|
src.print( def_include( txt("gen.builder.hpp") ) );
|
||||||
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
||||||
src.print( builder );
|
src.print( builder );
|
||||||
src.print_fmt( "\nGEN_NS_END\n\n" );
|
src.print_fmt( "\nGEN_NS_END\n\n" );
|
||||||
@ -219,13 +220,13 @@ int gen_main()
|
|||||||
// gen_scanner.hpp
|
// gen_scanner.hpp
|
||||||
{
|
{
|
||||||
Code parsing = scan_file( "dependencies/parsing.hpp" );
|
Code parsing = scan_file( "dependencies/parsing.hpp" );
|
||||||
Code scanner = scan_file( "file_processors/scanner.hpp" );
|
Code scanner = scan_file( "auxillary/scanner.hpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
header = Builder::open( "gen/gen.scanner.hpp" );
|
header = Builder::open( "gen/gen.scanner.hpp" );
|
||||||
header.print_fmt( generation_notice );
|
header.print_fmt( generation_notice );
|
||||||
header.print_fmt( "#pragma once\n\n" );
|
header.print_fmt( "#pragma once\n\n" );
|
||||||
header.print( def_include( txt_StrC("gen.hpp") ) );
|
header.print( def_include( txt("gen.hpp") ) );
|
||||||
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
||||||
header.print( parsing );
|
header.print( parsing );
|
||||||
header.print( scanner );
|
header.print( scanner );
|
||||||
@ -236,15 +237,15 @@ int gen_main()
|
|||||||
// gen_scanner.cpp
|
// gen_scanner.cpp
|
||||||
{
|
{
|
||||||
Code parsing = scan_file( "dependencies/parsing.cpp" );
|
Code parsing = scan_file( "dependencies/parsing.cpp" );
|
||||||
// Code scanner = scan_file( "file_processors/scanner.cpp" );
|
Code scanner = scan_file( "auxillary/scanner.cpp" );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
src = Builder::open( "gen/gen.scanner.cpp" );
|
src = Builder::open( "gen/gen.scanner.cpp" );
|
||||||
src.print_fmt( generation_notice );
|
src.print_fmt( generation_notice );
|
||||||
src.print( def_include( txt_StrC("gen.scanner.hpp") ) );
|
src.print( def_include( txt("gen.scanner.hpp") ) );
|
||||||
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
||||||
src.print( parsing );
|
src.print( parsing );
|
||||||
// src.print( scanner );
|
src.print( scanner );
|
||||||
src.print_fmt( "\nGEN_NS_END\n\n" );
|
src.print_fmt( "\nGEN_NS_END\n\n" );
|
||||||
src.write();
|
src.write();
|
||||||
}
|
}
|
@ -59,7 +59,7 @@ String AST::to_string()
|
|||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
str_copy( line, Content + curr, length );
|
str_copy( line, (char const*)Content + curr, length );
|
||||||
result.append_fmt( "//%.*s", length, line );
|
result.append_fmt( "//%.*s", length, line );
|
||||||
mem_set( line, 0, MaxCommentLineLength);
|
mem_set( line, 0, MaxCommentLineLength);
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ struct AST
|
|||||||
- sizeof(ModuleFlag)
|
- sizeof(ModuleFlag)
|
||||||
- sizeof(u32)
|
- sizeof(u32)
|
||||||
)
|
)
|
||||||
/ sizeof(SpecifierT) -1; // -1 for 4 extra bytes
|
/ sizeof(SpecifierT) - 1; // -1 for 4 extra bytes
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct
|
struct
|
||||||
|
@ -15,10 +15,10 @@ void* Global_Allocator_Proc( void* allocator_data, AllocType type, sw size, sw a
|
|||||||
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
||||||
|
|
||||||
if ( bucket.PhysicalStart == nullptr )
|
if ( bucket.PhysicalStart == nullptr )
|
||||||
fatal( "Failed to create bucket for Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to create bucket for Global_AllocatorBuckets");
|
||||||
|
|
||||||
if ( ! Global_AllocatorBuckets.append( bucket ) )
|
if ( ! Global_AllocatorBuckets.append( bucket ) )
|
||||||
fatal( "Failed to append bucket to Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to append bucket to Global_AllocatorBuckets");
|
||||||
|
|
||||||
last = & Global_AllocatorBuckets.back();
|
last = & Global_AllocatorBuckets.back();
|
||||||
}
|
}
|
||||||
@ -42,10 +42,10 @@ void* Global_Allocator_Proc( void* allocator_data, AllocType type, sw size, sw a
|
|||||||
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
||||||
|
|
||||||
if ( bucket.PhysicalStart == nullptr )
|
if ( bucket.PhysicalStart == nullptr )
|
||||||
fatal( "Failed to create bucket for Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to create bucket for Global_AllocatorBuckets");
|
||||||
|
|
||||||
if ( ! Global_AllocatorBuckets.append( bucket ) )
|
if ( ! Global_AllocatorBuckets.append( bucket ) )
|
||||||
fatal( "Failed to append bucket to Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to append bucket to Global_AllocatorBuckets");
|
||||||
|
|
||||||
last = & Global_AllocatorBuckets.back();
|
last = & Global_AllocatorBuckets.back();
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ internal
|
|||||||
void define_constants()
|
void define_constants()
|
||||||
{
|
{
|
||||||
Code::Global = make_code();
|
Code::Global = make_code();
|
||||||
Code::Global->Name = get_cached_string( txt_StrC("Global Code") );
|
Code::Global->Name = get_cached_string( txt("Global Code") );
|
||||||
Code::Global->Content = Code::Global->Name;
|
Code::Global->Content = Code::Global->Name;
|
||||||
|
|
||||||
Code::Invalid = make_code();
|
Code::Invalid = make_code();
|
||||||
@ -76,22 +76,22 @@ void define_constants()
|
|||||||
|
|
||||||
t_empty = (CodeType) make_code();
|
t_empty = (CodeType) make_code();
|
||||||
t_empty->Type = ECode::Typename;
|
t_empty->Type = ECode::Typename;
|
||||||
t_empty->Name = get_cached_string( txt_StrC("") );
|
t_empty->Name = get_cached_string( txt("") );
|
||||||
t_empty.set_global();
|
t_empty.set_global();
|
||||||
|
|
||||||
access_private = make_code();
|
access_private = make_code();
|
||||||
access_private->Type = ECode::Access_Private;
|
access_private->Type = ECode::Access_Private;
|
||||||
access_private->Name = get_cached_string( txt_StrC("private:") );
|
access_private->Name = get_cached_string( txt("private:") );
|
||||||
access_private.set_global();
|
access_private.set_global();
|
||||||
|
|
||||||
access_protected = make_code();
|
access_protected = make_code();
|
||||||
access_protected->Type = ECode::Access_Protected;
|
access_protected->Type = ECode::Access_Protected;
|
||||||
access_protected->Name = get_cached_string( txt_StrC("protected:") );
|
access_protected->Name = get_cached_string( txt("protected:") );
|
||||||
access_protected.set_global();
|
access_protected.set_global();
|
||||||
|
|
||||||
access_public = make_code();
|
access_public = make_code();
|
||||||
access_public->Type = ECode::Access_Public;
|
access_public->Type = ECode::Access_Public;
|
||||||
access_public->Name = get_cached_string( txt_StrC("public:") );
|
access_public->Name = get_cached_string( txt("public:") );
|
||||||
access_public.set_global();
|
access_public.set_global();
|
||||||
|
|
||||||
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
||||||
@ -102,13 +102,13 @@ void define_constants()
|
|||||||
|
|
||||||
module_global_fragment = make_code();
|
module_global_fragment = make_code();
|
||||||
module_global_fragment->Type = ECode::Untyped;
|
module_global_fragment->Type = ECode::Untyped;
|
||||||
module_global_fragment->Name = get_cached_string( txt_StrC("module;") );
|
module_global_fragment->Name = get_cached_string( txt("module;") );
|
||||||
module_global_fragment->Content = module_global_fragment->Name;
|
module_global_fragment->Content = module_global_fragment->Name;
|
||||||
module_global_fragment.set_global();
|
module_global_fragment.set_global();
|
||||||
|
|
||||||
module_private_fragment = make_code();
|
module_private_fragment = make_code();
|
||||||
module_private_fragment->Type = ECode::Untyped;
|
module_private_fragment->Type = ECode::Untyped;
|
||||||
module_private_fragment->Name = get_cached_string( txt_StrC("module : private;") );
|
module_private_fragment->Name = get_cached_string( txt("module : private;") );
|
||||||
module_private_fragment->Content = module_private_fragment->Name;
|
module_private_fragment->Content = module_private_fragment->Name;
|
||||||
module_private_fragment.set_global();
|
module_private_fragment.set_global();
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ void define_constants()
|
|||||||
|
|
||||||
pragma_once = (CodePragma) make_code();
|
pragma_once = (CodePragma) make_code();
|
||||||
pragma_once->Type = ECode::Preprocess_Pragma;
|
pragma_once->Type = ECode::Preprocess_Pragma;
|
||||||
pragma_once->Name = get_cached_string( txt_StrC("once") );
|
pragma_once->Name = get_cached_string( txt("once") );
|
||||||
pragma_once->Content = pragma_once->Name;
|
pragma_once->Content = pragma_once->Name;
|
||||||
pragma_once.set_global();
|
pragma_once.set_global();
|
||||||
|
|
||||||
param_varadic = (CodeType) make_code();
|
param_varadic = (CodeType) make_code();
|
||||||
param_varadic->Type = ECode::Parameters;
|
param_varadic->Type = ECode::Parameters;
|
||||||
param_varadic->Name = get_cached_string( txt_StrC("...") );
|
param_varadic->Name = get_cached_string( txt("...") );
|
||||||
param_varadic->ValueType = t_empty;
|
param_varadic->ValueType = t_empty;
|
||||||
param_varadic.set_global();
|
param_varadic.set_global();
|
||||||
|
|
||||||
@ -226,12 +226,12 @@ void init()
|
|||||||
Global_AllocatorBuckets = Array<Arena>::init_reserve( heap(), 128 );
|
Global_AllocatorBuckets = Array<Arena>::init_reserve( heap(), 128 );
|
||||||
|
|
||||||
if ( Global_AllocatorBuckets == nullptr )
|
if ( Global_AllocatorBuckets == nullptr )
|
||||||
fatal( "Failed to reserve memory for Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to reserve memory for Global_AllocatorBuckets");
|
||||||
|
|
||||||
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
Arena bucket = Arena::init_from_allocator( heap(), Global_BucketSize );
|
||||||
|
|
||||||
if ( bucket.PhysicalStart == nullptr )
|
if ( bucket.PhysicalStart == nullptr )
|
||||||
fatal( "Failed to create first bucket for Global_AllocatorBuckets");
|
GEN_FATAL( "Failed to create first bucket for Global_AllocatorBuckets");
|
||||||
|
|
||||||
Global_AllocatorBuckets.append( bucket );
|
Global_AllocatorBuckets.append( bucket );
|
||||||
|
|
||||||
@ -242,12 +242,12 @@ void init()
|
|||||||
CodePools = Array<Pool>::init_reserve( Allocator_DataArrays, InitSize_DataArrays );
|
CodePools = Array<Pool>::init_reserve( Allocator_DataArrays, InitSize_DataArrays );
|
||||||
|
|
||||||
if ( CodePools == nullptr )
|
if ( CodePools == nullptr )
|
||||||
fatal( "gen::init: Failed to initialize the CodePools array" );
|
GEN_FATAL( "gen::init: Failed to initialize the CodePools array" );
|
||||||
|
|
||||||
StringArenas = Array<Arena>::init_reserve( Allocator_DataArrays, InitSize_DataArrays );
|
StringArenas = Array<Arena>::init_reserve( Allocator_DataArrays, InitSize_DataArrays );
|
||||||
|
|
||||||
if ( StringArenas == nullptr )
|
if ( StringArenas == nullptr )
|
||||||
fatal( "gen::init: Failed to initialize the StringArenas array" );
|
GEN_FATAL( "gen::init: Failed to initialize the StringArenas array" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the code pool and code entries arena.
|
// Setup the code pool and code entries arena.
|
||||||
@ -255,7 +255,7 @@ void init()
|
|||||||
Pool code_pool = Pool::init( Allocator_CodePool, CodePool_NumBlocks, sizeof(AST) );
|
Pool code_pool = Pool::init( Allocator_CodePool, CodePool_NumBlocks, sizeof(AST) );
|
||||||
|
|
||||||
if ( code_pool.PhysicalStart == nullptr )
|
if ( code_pool.PhysicalStart == nullptr )
|
||||||
fatal( "gen::init: Failed to initialize the code pool" );
|
GEN_FATAL( "gen::init: Failed to initialize the code pool" );
|
||||||
|
|
||||||
CodePools.append( code_pool );
|
CodePools.append( code_pool );
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ void init()
|
|||||||
Arena string_arena = Arena::init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
Arena string_arena = Arena::init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
||||||
|
|
||||||
if ( string_arena.PhysicalStart == nullptr )
|
if ( string_arena.PhysicalStart == nullptr )
|
||||||
fatal( "gen::init: Failed to initialize the string arena" );
|
GEN_FATAL( "gen::init: Failed to initialize the string arena" );
|
||||||
|
|
||||||
StringArenas.append( string_arena );
|
StringArenas.append( string_arena );
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ void init()
|
|||||||
StringCache = StringTable::init( Allocator_StringTable );
|
StringCache = StringTable::init( Allocator_StringTable );
|
||||||
|
|
||||||
if ( StringCache.Entries == nullptr )
|
if ( StringCache.Entries == nullptr )
|
||||||
fatal( "gen::init: Failed to initialize the StringCache");
|
GEN_FATAL( "gen::init: Failed to initialize the StringCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
define_constants();
|
define_constants();
|
||||||
@ -362,7 +362,7 @@ AllocatorInfo get_string_allocator( s32 str_length )
|
|||||||
Arena new_arena = Arena::init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
Arena new_arena = Arena::init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
||||||
|
|
||||||
if ( ! StringArenas.append( new_arena ) )
|
if ( ! StringArenas.append( new_arena ) )
|
||||||
fatal( "gen::get_string_allocator: Failed to allocate a new string arena" );
|
GEN_FATAL( "gen::get_string_allocator: Failed to allocate a new string arena" );
|
||||||
|
|
||||||
last = & StringArenas.back();
|
last = & StringArenas.back();
|
||||||
}
|
}
|
||||||
@ -397,10 +397,10 @@ Code make_code()
|
|||||||
Pool code_pool = Pool::init( Allocator_CodePool, CodePool_NumBlocks, sizeof(AST) );
|
Pool code_pool = Pool::init( Allocator_CodePool, CodePool_NumBlocks, sizeof(AST) );
|
||||||
|
|
||||||
if ( code_pool.PhysicalStart == nullptr )
|
if ( code_pool.PhysicalStart == nullptr )
|
||||||
fatal( "gen::make_code: Failed to allocate a new code pool - CodePool allcoator returned nullptr." );
|
GEN_FATAL( "gen::make_code: Failed to allocate a new code pool - CodePool allcoator returned nullptr." );
|
||||||
|
|
||||||
if ( ! CodePools.append( code_pool ) )
|
if ( ! CodePools.append( code_pool ) )
|
||||||
fatal( "gen::make_code: Failed to allocate a new code pool - CodePools failed to append new pool." );
|
GEN_FATAL( "gen::make_code: Failed to allocate a new code pool - CodePools failed to append new pool." );
|
||||||
|
|
||||||
allocator = & CodePools.back();
|
allocator = & CodePools.back();
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1122,7 @@ if ( def.Ptr == nullptr ) \
|
|||||||
# define check( Type_ ) ( left && currtok.Type == Type_ )
|
# define check( Type_ ) ( left && currtok.Type == Type_ )
|
||||||
|
|
||||||
# define push_scope() \
|
# define push_scope() \
|
||||||
StackNode scope { nullptr, currtok, NullToken, txt_StrC( __func__ ) }; \
|
StackNode scope { nullptr, currtok, NullToken, txt( __func__ ) }; \
|
||||||
Context.push( & scope )
|
Context.push( & scope )
|
||||||
|
|
||||||
#pragma endregion Helper Macros
|
#pragma endregion Helper Macros
|
||||||
@ -1329,7 +1329,7 @@ Code parse_static_assert()
|
|||||||
|
|
||||||
char const* result = str_fmt_buf( "%.*s\n", content.Length, content.Text );
|
char const* result = str_fmt_buf( "%.*s\n", content.Length, content.Text );
|
||||||
|
|
||||||
assert->Content = get_cached_string( to_StrC( result ) );
|
assert->Content = get_cached_string( to_str( result ) );
|
||||||
assert->Name = assert->Content;
|
assert->Name = assert->Content;
|
||||||
|
|
||||||
Context.pop();
|
Context.pop();
|
||||||
@ -1409,7 +1409,7 @@ CodeAttributes parse_attributes()
|
|||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
push_scope();
|
push_scope();
|
||||||
|
|
||||||
Token start;
|
Token start = NullToken;
|
||||||
s32 len = 0;
|
s32 len = 0;
|
||||||
|
|
||||||
if ( check(TokType::Attribute_Open) )
|
if ( check(TokType::Attribute_Open) )
|
||||||
@ -2264,7 +2264,7 @@ Code parse_simple_preprocess( Parser::TokType which )
|
|||||||
|
|
||||||
char const* content = str_fmt_buf( "%.*s\n", tok.Length, tok.Text );
|
char const* content = str_fmt_buf( "%.*s\n", tok.Length, tok.Text );
|
||||||
|
|
||||||
Code result = untyped_str( to_StrC( content ) );
|
Code result = untyped_str( to_str( content ) );
|
||||||
Context.Scope->Name = tok;
|
Context.Scope->Name = tok;
|
||||||
|
|
||||||
if ( str_compare( Context.Scope->Prev->ProcName.Ptr, "parse_typedef", Context.Scope->Prev->ProcName.Len ) != 0 )
|
if ( str_compare( Context.Scope->Prev->ProcName.Ptr, "parse_typedef", Context.Scope->Prev->ProcName.Len ) != 0 )
|
||||||
@ -3186,7 +3186,7 @@ CodeConstructor parse_constructor()
|
|||||||
{
|
{
|
||||||
eat( TokType::Assign_Classifer );
|
eat( TokType::Assign_Classifer );
|
||||||
|
|
||||||
Token initializer_list_tok;
|
Token initializer_list_tok = NullToken;
|
||||||
|
|
||||||
s32 level = 0;
|
s32 level = 0;
|
||||||
while ( left && ( currtok.Type != TokType::BraceCurly_Open || level > 0 ) )
|
while ( left && ( currtok.Type != TokType::BraceCurly_Open || level > 0 ) )
|
||||||
|
@ -89,4 +89,5 @@ namespace ECode
|
|||||||
# undef Define_Types
|
# undef Define_Types
|
||||||
}
|
}
|
||||||
using CodeT = ECode::Type;
|
using CodeT = ECode::Type;
|
||||||
|
using ECode::to_str;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace EOperator
|
|||||||
# define Entry( Type_, Token_ ) { sizeof(stringize(Token_)), stringize(Token_) },
|
# define Entry( Type_, Token_ ) { sizeof(stringize(Token_)), stringize(Token_) },
|
||||||
Define_Operators
|
Define_Operators
|
||||||
# undef Entry
|
# undef Entry
|
||||||
txt_StrC(",")
|
txt(",")
|
||||||
};
|
};
|
||||||
|
|
||||||
return lookup[ op ];
|
return lookup[ op ];
|
||||||
@ -73,4 +73,5 @@ namespace EOperator
|
|||||||
# undef Define_Operators
|
# undef Define_Operators
|
||||||
}
|
}
|
||||||
using OperatorT = EOperator::Type;
|
using OperatorT = EOperator::Type;
|
||||||
|
using EOperator::to_str;
|
||||||
|
|
||||||
|
@ -107,4 +107,5 @@ namespace ESpecifier
|
|||||||
# undef Define_Specifiers
|
# undef Define_Specifiers
|
||||||
}
|
}
|
||||||
using SpecifierT = ESpecifier::Type;
|
using SpecifierT = ESpecifier::Type;
|
||||||
|
using ESpecifier::to_str;
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ namespace Parser
|
|||||||
};
|
};
|
||||||
|
|
||||||
using TokType = ETokType::Type;
|
using TokType = ETokType::Type;
|
||||||
|
using ETokType::to_str;
|
||||||
|
|
||||||
} // Parser
|
} // Parser
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using LogFailType = sw(*)(char const*, ...);
|
using LogFailType = sw(*)(char const*, ...);
|
||||||
|
|
||||||
// By default this library will either crash or exit if an error is detected while generating codes.
|
// By default this library will either crash or exit if an error is detected while generating codes.
|
||||||
// Even if set to not use fatal, fatal will still be used for memory failures as the library is unusable when they occur.
|
// Even if set to not use GEN_FATAL, GEN_FATAL will still be used for memory failures as the library is unusable when they occur.
|
||||||
#ifdef GEN_DONT_USE_FATAL
|
#ifdef GEN_DONT_USE_FATAL
|
||||||
#define log_failure log_fmt
|
#define log_failure log_fmt
|
||||||
#else
|
#else
|
||||||
#define log_failure fatal
|
#define log_failure GEN_FATAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum class AccessSpec : u32
|
enum class AccessSpec : u32
|
||||||
@ -46,7 +46,6 @@ enum class EnumT : u8
|
|||||||
constexpr EnumT EnumClass = EnumT::Class;
|
constexpr EnumT EnumClass = EnumT::Class;
|
||||||
constexpr EnumT EnumRegular = EnumT::Regular;
|
constexpr EnumT EnumRegular = EnumT::Regular;
|
||||||
|
|
||||||
|
|
||||||
enum class ModuleFlag : u32
|
enum class ModuleFlag : u32
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
@ -76,50 +75,3 @@ constexpr EPreprocessCond PreprocessCond_IfDef = EPreprocessCond::IfDef;
|
|||||||
constexpr EPreprocessCond PreprocessCond_IfNotDef = EPreprocessCond::IfNotDef;
|
constexpr EPreprocessCond PreprocessCond_IfNotDef = EPreprocessCond::IfNotDef;
|
||||||
constexpr EPreprocessCond PreprocessCond_ElIf = EPreprocessCond::ElIf;
|
constexpr EPreprocessCond PreprocessCond_ElIf = EPreprocessCond::ElIf;
|
||||||
|
|
||||||
/*
|
|
||||||
Predefined attributes
|
|
||||||
Used for the parser constructors to identify non-standard attributes
|
|
||||||
|
|
||||||
Override these to change the attribute to your own unique identifier convention.
|
|
||||||
|
|
||||||
The tokenizer identifies attribute defines with the GEN_DEFINE_ATTRIBUTE_TOKENS macros.
|
|
||||||
See the example below and the Define_TokType macro used in gen.cpp to know the format.
|
|
||||||
While the library can parse raw attributes, most projects use defines to wrap them for compiler
|
|
||||||
platform indendence. The token define allows support for them without having to modify the library.
|
|
||||||
*/
|
|
||||||
#if defined(GEN_SYSTEM_WINDOWS) || defined( __CYGWIN__ )
|
|
||||||
#ifndef GEN_Attribute_Keyword
|
|
||||||
# define GEN_API_Export_Code __declspec(dllexport)
|
|
||||||
# define GEN_API_Import_Code __declspec(dllimport)
|
|
||||||
# define GEN_Attribute_Keyword __declspec
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr char const* Attribute_Keyword = stringize( GEN_Attribute_Keyword);
|
|
||||||
|
|
||||||
#elif GEN_HAS_ATTRIBUTE( visibility ) || GEN_GCC_VERSION_CHECK( 3, 3, 0 )
|
|
||||||
#ifndef GEN_Attribute_Keyword
|
|
||||||
# define GEN_API_Export_Code __attribute__ ((visibility ("default")))
|
|
||||||
# define GEN_API_Import_Code __attribute__ ((visibility ("default")))
|
|
||||||
# define GEN_Attribute_Keyword __attribute__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr char const* Attribute_Keyword = stringize( GEN_Attribute_Keyword );
|
|
||||||
|
|
||||||
#else
|
|
||||||
#ifndef GEN_Attribute_Keyword
|
|
||||||
# define GEN_API_Export_Code
|
|
||||||
# define GEN_API_Import_Code
|
|
||||||
# define GEN_Attribute_Keyword
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr char const* Attribute_Keyword = "";
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Implements basic string interning. Data structure is based off the ZPL Hashtable.
|
|
||||||
using StringTable = HashTable<String const>;
|
|
||||||
|
|
||||||
// Represents strings cached with the string table.
|
|
||||||
// Should never be modified, if changed string is desired, cache_string( str ) another.
|
|
||||||
using StringCached = String const;
|
|
||||||
|
|
||||||
|
@ -34,22 +34,22 @@ s32 assert_crash( char const* condition );
|
|||||||
void process_exit( u32 code );
|
void process_exit( u32 code );
|
||||||
|
|
||||||
#if Build_Debug
|
#if Build_Debug
|
||||||
#define fatal( fmt, ... ) \
|
#define GEN_FATAL( ... ) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
local_persist thread_local \
|
local_persist thread_local \
|
||||||
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
|
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
|
||||||
\
|
\
|
||||||
str_fmt(buf, GEN_PRINTF_MAXLEN, fmt, __VA_ARGS__); \
|
str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__); \
|
||||||
GEN_PANIC(buf); \
|
GEN_PANIC(buf); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define fatal( fmt, ... ) \
|
# define GEN_FATAL( ... ) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
str_fmt_out_err( fmt, __VA_ARGS__ ); \
|
str_fmt_out_err( __VA_ARGS__ ); \
|
||||||
process_exit(1); \
|
process_exit(1); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
@ -100,25 +100,6 @@
|
|||||||
#define GEN_DEF_INLINE static
|
#define GEN_DEF_INLINE static
|
||||||
#define GEN_IMPL_INLINE static inline
|
#define GEN_IMPL_INLINE static inline
|
||||||
|
|
||||||
#ifdef GEN_COMPILER_MSVC
|
|
||||||
# define forceinline __forceinline
|
|
||||||
# define neverinline __declspec( noinline )
|
|
||||||
#elif defined(GEN_COMPILER_GCC)
|
|
||||||
# define forceinline inline __attribute__((__always_inline__))
|
|
||||||
# define neverinline __attribute__( ( __noinline__ ) )
|
|
||||||
#elif defined(GEN_COMPILER_CLANG)
|
|
||||||
#if __has_attribute(__always_inline__)
|
|
||||||
# define forceinline inline __attribute__((__always_inline__))
|
|
||||||
# define neverinline __attribute__( ( __noinline__ ) )
|
|
||||||
#else
|
|
||||||
# define forceinline
|
|
||||||
# define neverinline
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
# define forceinline
|
|
||||||
# define neverinline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma endregion Platform Detection
|
#pragma endregion Platform Detection
|
||||||
|
|
||||||
#pragma region Mandatory Includes
|
#pragma region Mandatory Includes
|
||||||
|
@ -8,6 +8,25 @@
|
|||||||
#define internal static // Internal linkage
|
#define internal static // Internal linkage
|
||||||
#define local_persist static // Local Persisting variables
|
#define local_persist static // Local Persisting variables
|
||||||
|
|
||||||
|
#ifdef GEN_COMPILER_MSVC
|
||||||
|
# define forceinline __forceinline
|
||||||
|
# define neverinline __declspec( noinline )
|
||||||
|
#elif defined(GEN_COMPILER_GCC)
|
||||||
|
# define forceinline inline __attribute__((__always_inline__))
|
||||||
|
# define neverinline __attribute__( ( __noinline__ ) )
|
||||||
|
#elif defined(GEN_COMPILER_CLANG)
|
||||||
|
#if __has_attribute(__always_inline__)
|
||||||
|
# define forceinline inline __attribute__((__always_inline__))
|
||||||
|
# define neverinline __attribute__( ( __noinline__ ) )
|
||||||
|
#else
|
||||||
|
# define forceinline
|
||||||
|
# define neverinline
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
# define forceinline
|
||||||
|
# define neverinline
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bits
|
// Bits
|
||||||
|
|
||||||
#define bit( Value ) ( 1 << Value )
|
#define bit( Value ) ( 1 << Value )
|
||||||
@ -21,7 +40,7 @@
|
|||||||
#define scast( Type, Value ) static_cast< Type >( Value )
|
#define scast( Type, Value ) static_cast< Type >( Value )
|
||||||
|
|
||||||
// Num Arguments (Varadics)
|
// Num Arguments (Varadics)
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
// #if defined(__GNUC__) || defined(__clang__)
|
||||||
// Supports 0-50 arguments
|
// Supports 0-50 arguments
|
||||||
#define num_args_impl( _0, \
|
#define num_args_impl( _0, \
|
||||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||||
@ -53,37 +72,39 @@
|
|||||||
0 \
|
0 \
|
||||||
)
|
)
|
||||||
|
|
||||||
#else
|
// #else
|
||||||
// Supports 1-50 arguments
|
// This doesn't work on latest msvc so I had to use /Zc:preprocessor flag.
|
||||||
#define num_args_impl( \
|
|
||||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
|
||||||
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
|
||||||
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
|
||||||
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
|
||||||
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
|
||||||
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
|
||||||
_61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
|
||||||
_71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
|
||||||
_81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
|
||||||
_91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
|
||||||
N, ... \
|
|
||||||
) N
|
|
||||||
|
|
||||||
#define num_args(...) \
|
// Supports 1-50 arguments
|
||||||
num_args_impl( __VA_ARGS__, \
|
// #define num_args_impl( \
|
||||||
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
// _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||||
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
// _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
||||||
80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
// _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
||||||
70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
// _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
||||||
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
// _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
||||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
// _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
||||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
// _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
||||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
// _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
||||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
// _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
||||||
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
// _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
||||||
10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
// N, ... \
|
||||||
)
|
// ) N
|
||||||
#endif
|
|
||||||
|
// #define num_args(...) \
|
||||||
|
// num_args_impl( __VA_ARGS__, \
|
||||||
|
// 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
||||||
|
// 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
||||||
|
// 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
||||||
|
// 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
||||||
|
// 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
||||||
|
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||||
|
// 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||||
|
// 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||||
|
// 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
||||||
|
// 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
||||||
|
// 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
||||||
|
// )
|
||||||
|
// #endif
|
||||||
|
|
||||||
// Stringizing
|
// Stringizing
|
||||||
#define stringize_va( ... ) #__VA_ARGS__
|
#define stringize_va( ... ) #__VA_ARGS__
|
||||||
@ -125,6 +146,12 @@
|
|||||||
#define min( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) )
|
#define min( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) )
|
||||||
#define size_of( x ) ( sw )( sizeof( x ) )
|
#define size_of( x ) ( sw )( sizeof( x ) )
|
||||||
|
|
||||||
|
#if defined( _MSC_VER ) || defined( GEN_COMPILER_TINYC )
|
||||||
|
# define offset_of( Type, element ) ( ( GEN_NS( gen_sw ) ) & ( ( ( Type* )0 )->element ) )
|
||||||
|
#else
|
||||||
|
# define offset_of( Type, element ) __builtin_offsetof( Type, element )
|
||||||
|
#endif
|
||||||
|
|
||||||
template< class Type >
|
template< class Type >
|
||||||
void swap( Type& a, Type& b )
|
void swap( Type& a, Type& b )
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,7 @@ void* Arena::allocator_proc( void* allocator_data, AllocType type, sw size, sw a
|
|||||||
if ( arena->TotalUsed + total_size > (sw) arena->TotalSize )
|
if ( arena->TotalUsed + total_size > (sw) arena->TotalSize )
|
||||||
{
|
{
|
||||||
// zpl__printf_err("%s", "Arena out of memory\n");
|
// zpl__printf_err("%s", "Arena out of memory\n");
|
||||||
fatal("Arena out of memory! (Possibly could not fit for the largest size Arena!!)");
|
GEN_FATAL("Arena out of memory! (Possibly could not fit for the largest size Arena!!)");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#pragma region String
|
#pragma region Strings
|
||||||
|
|
||||||
// Constant string with length.
|
// Constant string with length.
|
||||||
struct StrC
|
struct StrC
|
||||||
@ -12,18 +12,14 @@ struct StrC
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define txt_StrC( text ) StrC { sizeof( text ) - 1, text }
|
#define cast_to_strc( str ) * rcast( StrC*, str - sizeof(sw) )
|
||||||
|
#define txt( text ) StrC { sizeof( text ) - 1, text }
|
||||||
|
|
||||||
StrC to_StrC( char const* str )
|
StrC to_str( char const* str )
|
||||||
{
|
{
|
||||||
return { str_len( str ), str };
|
return { str_len( str ), str };
|
||||||
}
|
}
|
||||||
|
|
||||||
sw StrC_len( char const* str )
|
|
||||||
{
|
|
||||||
return (sw) ( str - 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dynamic String
|
// Dynamic String
|
||||||
// This is directly based off the ZPL string api.
|
// This is directly based off the ZPL string api.
|
||||||
// They used a header pattern
|
// They used a header pattern
|
||||||
@ -33,8 +29,8 @@ struct String
|
|||||||
struct Header
|
struct Header
|
||||||
{
|
{
|
||||||
AllocatorInfo Allocator;
|
AllocatorInfo Allocator;
|
||||||
sw Length;
|
|
||||||
sw Capacity;
|
sw Capacity;
|
||||||
|
sw Length;
|
||||||
};
|
};
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -76,7 +72,7 @@ struct String
|
|||||||
header->Capacity = capacity;
|
header->Capacity = capacity;
|
||||||
header->Length = 0;
|
header->Length = 0;
|
||||||
|
|
||||||
String result = { (char*)allocation + header_size };
|
String result = { rcast(char*, allocation) + header_size };
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +88,7 @@ struct String
|
|||||||
return { nullptr };
|
return { nullptr };
|
||||||
|
|
||||||
Header&
|
Header&
|
||||||
header = * rcast(Header*, allocation);
|
header = * rcast(Header*, allocation);
|
||||||
header = { allocator, length, length };
|
header = { allocator, length, length };
|
||||||
|
|
||||||
String result = { rcast( char*, allocation) + header_size };
|
String result = { rcast( char*, allocation) + header_size };
|
||||||
@ -332,11 +328,7 @@ struct String
|
|||||||
|
|
||||||
operator StrC() const
|
operator StrC() const
|
||||||
{
|
{
|
||||||
return
|
return { length(), Data };
|
||||||
{
|
|
||||||
length(),
|
|
||||||
Data
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used with cached strings
|
// Used with cached strings
|
||||||
@ -363,19 +355,21 @@ struct String
|
|||||||
return Data[ index ];
|
return Data[ index ];
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Data = nullptr;
|
char* Data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct String_POD
|
struct String_POD
|
||||||
{
|
{
|
||||||
char* Data;
|
char* Data;
|
||||||
|
|
||||||
operator String()
|
|
||||||
{
|
|
||||||
return * rcast(String*, this);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
static_assert( sizeof( String_POD ) == sizeof( String ), "String is not a POD" );
|
static_assert( sizeof( String_POD ) == sizeof( String ), "String is not a POD" );
|
||||||
|
|
||||||
#pragma endregion String
|
// Implements basic string interning. Data structure is based off the ZPL Hashtable.
|
||||||
|
using StringTable = HashTable<String const>;
|
||||||
|
|
||||||
|
// Represents strings cached with the string table.
|
||||||
|
// Should never be modified, if changed string is desired, cache_string( str ) another.
|
||||||
|
using StringCached = String const;
|
||||||
|
|
||||||
|
#pragma endregion Strings
|
||||||
|
|
@ -10,8 +10,8 @@ GEN_NS_BEGIN
|
|||||||
#include "dependencies/printing.cpp"
|
#include "dependencies/printing.cpp"
|
||||||
#include "dependencies/memory.cpp"
|
#include "dependencies/memory.cpp"
|
||||||
#include "dependencies/hashing.cpp"
|
#include "dependencies/hashing.cpp"
|
||||||
#include "dependencies/string.cpp"
|
#include "dependencies/strings.cpp"
|
||||||
#include "dependencies/file_handling.cpp"
|
#include "dependencies/filesystem.cpp"
|
||||||
#include "dependencies/timing.cpp"
|
#include "dependencies/timing.cpp"
|
||||||
|
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
@ -13,8 +13,8 @@ GEN_NS_BEGIN
|
|||||||
#include "dependencies/printing.hpp"
|
#include "dependencies/printing.hpp"
|
||||||
#include "dependencies/containers.hpp"
|
#include "dependencies/containers.hpp"
|
||||||
#include "dependencies/hashing.hpp"
|
#include "dependencies/hashing.hpp"
|
||||||
#include "dependencies/string.hpp"
|
#include "dependencies/strings.hpp"
|
||||||
#include "dependencies/file_handling.hpp"
|
#include "dependencies/filesystem.hpp"
|
||||||
#include "dependencies/timing.hpp"
|
#include "dependencies/timing.hpp"
|
||||||
|
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
@ -61,7 +61,7 @@ CodeBody gen_ecode( char const* path )
|
|||||||
|
|
||||||
CodeBody gen_eoperator( char const* path )
|
CodeBody gen_eoperator( char const* path )
|
||||||
{
|
{
|
||||||
char scratch_mem[kilobytes(1)];
|
char scratch_mem[kilobytes(4)];
|
||||||
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||||
|
|
||||||
file_read_contents( scratch, zero_terminate, path );
|
file_read_contents( scratch, zero_terminate, path );
|
||||||
@ -116,7 +116,7 @@ CodeBody gen_eoperator( char const* path )
|
|||||||
|
|
||||||
CodeBody gen_especifier( char const* path )
|
CodeBody gen_especifier( char const* path )
|
||||||
{
|
{
|
||||||
char scratch_mem[kilobytes(1)];
|
char scratch_mem[kilobytes(4)];
|
||||||
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||||
|
|
||||||
file_read_contents( scratch, zero_terminate, path );
|
file_read_contents( scratch, zero_terminate, path );
|
||||||
@ -531,7 +531,7 @@ CodeBody gen_ast_inlines()
|
|||||||
CodeBody impl_cast_var = parse_global_body( token_fmt( "typename", StrC name(Var), cast_tmpl ));
|
CodeBody impl_cast_var = parse_global_body( token_fmt( "typename", StrC name(Var), cast_tmpl ));
|
||||||
|
|
||||||
CodeBody result = def_global_body( args(
|
CodeBody result = def_global_body( args(
|
||||||
def_pragma( txt_StrC("region generated code inline implementation")),
|
def_pragma( txt("region generated code inline implementation")),
|
||||||
fmt_newline,
|
fmt_newline,
|
||||||
impl_code,
|
impl_code,
|
||||||
impl_code_body,
|
impl_code_body,
|
||||||
@ -563,9 +563,9 @@ CodeBody gen_ast_inlines()
|
|||||||
impl_code_using,
|
impl_code_using,
|
||||||
impl_code_var,
|
impl_code_var,
|
||||||
fmt_newline,
|
fmt_newline,
|
||||||
def_pragma( txt_StrC("endregion generated code inline implementation")),
|
def_pragma( txt("endregion generated code inline implementation")),
|
||||||
fmt_newline,
|
fmt_newline,
|
||||||
def_pragma( txt_StrC("region generated AST/Code cast implementation")),
|
def_pragma( txt("region generated AST/Code cast implementation")),
|
||||||
fmt_newline,
|
fmt_newline,
|
||||||
impl_cast_body,
|
impl_cast_body,
|
||||||
impl_cast_attribute,
|
impl_cast_attribute,
|
||||||
@ -596,7 +596,7 @@ CodeBody gen_ast_inlines()
|
|||||||
impl_cast_using,
|
impl_cast_using,
|
||||||
impl_cast_var,
|
impl_cast_var,
|
||||||
fmt_newline,
|
fmt_newline,
|
||||||
def_pragma( txt_StrC("endregion generated AST/Code cast implementation")),
|
def_pragma( txt("endregion generated AST/Code cast implementation")),
|
||||||
fmt_newline
|
fmt_newline
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#undef stringize
|
#undef stringize
|
||||||
#undef stringize
|
#undef stringize
|
||||||
#undef stringize_va
|
#undef stringize_va
|
||||||
#undef txt_StrC
|
#undef txt
|
||||||
|
|
||||||
#undef GEN_TIME
|
#undef GEN_TIME
|
||||||
#undef gen_main
|
#undef gen_main
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
project( 'gencpp_bootstrap', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
|
||||||
|
|
||||||
includes = include_directories(
|
|
||||||
[
|
|
||||||
'../project',
|
|
||||||
])
|
|
||||||
|
|
||||||
sources = [ 'gen.bootstrap.cpp' ]
|
|
||||||
|
|
||||||
if get_option('buildtype').startswith('debug')
|
|
||||||
|
|
||||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
executable( 'gencpp_bootstrap', sources, include_directories : includes )
|
|
@ -8,27 +8,40 @@ Generation, testing, and cleanup scripts for the test directory are found here a
|
|||||||
|
|
||||||
Currently `refactor` only supports naive sort of *find and replace* feature set and will not be able to rename identifiers excluisvely to a specific context (such as only renaming member names of a specific struct, etc).
|
Currently `refactor` only supports naive sort of *find and replace* feature set and will not be able to rename identifiers excluisvely to a specific context (such as only renaming member names of a specific struct, etc).
|
||||||
|
|
||||||
|
**Note: The following macros are used with specifiers and token parsing within the library:**
|
||||||
|
|
||||||
|
* global
|
||||||
|
* internal
|
||||||
|
* local_persist
|
||||||
|
* forceinline
|
||||||
|
* neverinline
|
||||||
|
|
||||||
|
IF they are changed the following files would need adjustment:
|
||||||
|
|
||||||
|
* `./project/enums/ESpecifier.csv`
|
||||||
|
* `./project/enums/ETokType.csv`
|
||||||
|
* `./project/helpers/helper.hpp`
|
||||||
|
|
||||||
## Build & Run Scripts
|
## Build & Run Scripts
|
||||||
|
|
||||||
**`clean.ps1`**
|
**`clean.ps1`**
|
||||||
Remove any generated content from the repository.
|
Remove any generated content from the repository.
|
||||||
|
|
||||||
**`bootstrap.ps1`**
|
**`build.ps1`**
|
||||||
Generate a version of gencpp where components are inlined directly to `gen.<hpp/cpp>` and `gen. <hpp/cpp>`
|
Build bootstrap, singleheader, or tests. Supports MSVC or clang, release or debug.
|
||||||
Any heavily preprocessed code is not inlined and are instead generated using the code in the `helpers` directory.
|
|
||||||
|
|
||||||
**`singlheader.build.ps1`**
|
```
|
||||||
Generate a single-header version of the library where all code that would normally good in the usual four files (see bootstrap) are inlined into a single `gen.hpp` file.
|
args:
|
||||||
As with the bootstrap, any heavily preprocessed code is not inlined and instead generated with helper code.
|
bootstrap
|
||||||
|
singleheader
|
||||||
|
test
|
||||||
|
clang
|
||||||
|
msvc : By default this project builds with clang, specifying msvc will build with MSVC.
|
||||||
|
debug
|
||||||
|
release : By default this project builds in debug mode, specifying release will build with optimizations.
|
||||||
|
```
|
||||||
|
|
||||||
**`test.gen.build.ps1`**
|
**`package_release.ps1`**
|
||||||
Build the metaprogram for generating the test code.
|
Will build the project as fast as possible, then package the release into a zip file.
|
||||||
|
|
||||||
**`test.gen.ps1`**
|
*Note: My env is Windows 11 with MSVC 2022 and clang 16.0.6*
|
||||||
Build (if not already) the metaprogram for generating test code, then run it to generate code.
|
|
||||||
|
|
||||||
**`test.build.ps1`**
|
|
||||||
Build and run metaprogram, build test program.
|
|
||||||
|
|
||||||
**`test.run.ps1`**
|
|
||||||
Build and run metaprogram, build and run test program.
|
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
[string] $type = $null
|
|
||||||
[string] $test = $false
|
|
||||||
|
|
||||||
foreach ( $arg in $args )
|
|
||||||
{
|
|
||||||
if ( $arg -eq "test" )
|
|
||||||
{
|
|
||||||
$test = $true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$type = $arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
|
||||||
$path_project = Join-Path $path_root project
|
|
||||||
$path_project_build = Join-Path $path_project build
|
|
||||||
$path_project_gen = Join-Path $path_project gen
|
|
||||||
|
|
||||||
write-host "`n`nBuilding gencpp bootstrap`n"
|
|
||||||
|
|
||||||
if ( -not( Test-Path $path_project_build) )
|
|
||||||
{
|
|
||||||
# Generate build files for bootstrap
|
|
||||||
Push-Location $path_project
|
|
||||||
$args_meson = @()
|
|
||||||
$args_meson += "setup"
|
|
||||||
$args_meson += $path_project_build
|
|
||||||
|
|
||||||
& meson $args_meson
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile bootstrap
|
|
||||||
Push-Location $path_root
|
|
||||||
$args_ninja = @()
|
|
||||||
$args_ninja += "-C"
|
|
||||||
$args_ninja += $path_project_build
|
|
||||||
|
|
||||||
& ninja $args_ninja
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Push-location $path_project
|
|
||||||
if ( -not(Test-Path($path_project_gen) )) {
|
|
||||||
New-Item -ItemType Directory -Path $path_project_gen
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run bootstrap
|
|
||||||
$gencpp_bootstrap = Join-Path $path_project_build gencpp_bootstrap.exe
|
|
||||||
|
|
||||||
Write-Host `nRunning gencpp bootstrap...
|
|
||||||
& $gencpp_bootstrap
|
|
||||||
|
|
||||||
# Format generated gencpp
|
|
||||||
Write-Host `nBeginning format...
|
|
||||||
$formatParams = @(
|
|
||||||
'-i' # In-place
|
|
||||||
'-style=file:../scripts/.clang-format'
|
|
||||||
'-verbose'
|
|
||||||
)
|
|
||||||
|
|
||||||
$include = @(
|
|
||||||
'gen.hpp', 'gen.cpp',
|
|
||||||
'gen.dep.hpp', 'gen.dep.cpp',
|
|
||||||
'gen.builder.hpp', 'gen.builder.cpp'
|
|
||||||
'gen.scanner.hpp', 'gen.scanner.cpp'
|
|
||||||
)
|
|
||||||
$exclude = $null
|
|
||||||
|
|
||||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
|
||||||
|
|
||||||
clang-format $formatParams $targetFiles
|
|
||||||
Write-Host "`nFormatting complete"
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
# Build and run validation
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
cls
|
|
||||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'bootstrap.ci.ps1') $args"
|
|
465
scripts/build.ci.ps1
Normal file
465
scripts/build.ci.ps1
Normal file
@ -0,0 +1,465 @@
|
|||||||
|
# This build script was written to build on windows, however I did setup some generalization to allow for cross platform building.
|
||||||
|
# It will most likely need a partial rewrite to segment the build process into separate script invocations based on the OS.
|
||||||
|
# That or just rewrite it in an sh script and call it a day.
|
||||||
|
|
||||||
|
cls
|
||||||
|
|
||||||
|
Import-Module ./helpers/target_arch.psm1
|
||||||
|
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
|
||||||
|
$path_root = git rev-parse --show-toplevel
|
||||||
|
|
||||||
|
Push-Location $path_root
|
||||||
|
|
||||||
|
#region Arguments
|
||||||
|
$vendor = $null
|
||||||
|
$release = $null
|
||||||
|
[bool] $bootstrap = $false
|
||||||
|
[bool] $singleheader = $false
|
||||||
|
[bool] $test = $false
|
||||||
|
|
||||||
|
[array] $vendors = @( "clang", "msvc" )
|
||||||
|
|
||||||
|
# This is a really lazy way of parsing the args, could use actual params down the line...
|
||||||
|
|
||||||
|
if ( $args ) { $args | ForEach-Object {
|
||||||
|
switch ($_){
|
||||||
|
{ $_ -in $vendors } { $vendor = $_; break }
|
||||||
|
"release" { $release = $true }
|
||||||
|
"debug" { $release = $false }
|
||||||
|
"bootstrap" { $bootstrap = $true }
|
||||||
|
"singleheader" { $singleheader = $true }
|
||||||
|
"test" { $test = $true }
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
#endregion Arguments
|
||||||
|
|
||||||
|
#region Configuration
|
||||||
|
if ($IsWindows) {
|
||||||
|
# This library was really designed to only run on 64-bit systems.
|
||||||
|
# (Its a development tool after all)
|
||||||
|
& $devshell -arch amd64
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $vendor -eq $null ) {
|
||||||
|
write-host "No vendor specified, assuming clang available"
|
||||||
|
$compiler = "clang"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $release -eq $null ) {
|
||||||
|
write-host "No build type specified, assuming debug"
|
||||||
|
$release = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $bootstrap -eq $false -and $singleheader -eq $false -and $test -eq $false ) {
|
||||||
|
throw "No build target specified. One must be specified, this script will not assume one"
|
||||||
|
}
|
||||||
|
|
||||||
|
write-host "Building gencpp with $vendor"
|
||||||
|
write-host "Build Type: $(if ($release) {"Release"} else {"Debug"} )"
|
||||||
|
|
||||||
|
function run-compiler
|
||||||
|
{
|
||||||
|
param( $compiler, $unit, $compiler_args )
|
||||||
|
|
||||||
|
write-host "`Compiling $unit"
|
||||||
|
write-host "Compiler config:"
|
||||||
|
$compiler_args | ForEach-Object {
|
||||||
|
write-host $_ -ForegroundColor Cyan
|
||||||
|
}
|
||||||
|
|
||||||
|
$time_taken = Measure-Command {
|
||||||
|
& $compiler $compiler_args 2>&1 | ForEach-Object {
|
||||||
|
$color = 'White'
|
||||||
|
switch ($_){
|
||||||
|
{ $_ -match "error" } { $color = 'Red' ; break }
|
||||||
|
{ $_ -match "warning" } { $color = 'Yellow'; break }
|
||||||
|
}
|
||||||
|
write-host `t $_ -ForegroundColor $color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Test-Path($unit) ) {
|
||||||
|
write-host "$unit compile finished in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write-host "Compile failed for $unit" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function run-linker
|
||||||
|
{
|
||||||
|
param( $linker, $binary, $linker_args )
|
||||||
|
|
||||||
|
write-host "`Linking $binary"
|
||||||
|
write-host "Linker config:"
|
||||||
|
$linker_args | ForEach-Object {
|
||||||
|
write-host $_ -ForegroundColor Cyan
|
||||||
|
}
|
||||||
|
|
||||||
|
$time_taken = Measure-Command {
|
||||||
|
& $linker $linker_args 2>&1 | ForEach-Object {
|
||||||
|
$color = 'White'
|
||||||
|
switch ($_){
|
||||||
|
{ $_ -match "error" } { $color = 'Red' ; break }
|
||||||
|
{ $_ -match "warning" } { $color = 'Yellow'; break }
|
||||||
|
}
|
||||||
|
write-host `t $_ -ForegroundColor $color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Test-Path($binary) ) {
|
||||||
|
write-host "$binary linking finished in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write-host "Linking failed for $binary" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $vendor -match "clang" )
|
||||||
|
{
|
||||||
|
# https://clang.llvm.org/docs/ClangCommandLineReference.html
|
||||||
|
$flag_compile = '-c'
|
||||||
|
$flag_color_diagnostics = '-fcolor-diagnostics'
|
||||||
|
$flag_no_color_diagnostics = '-fno-color-diagnostics'
|
||||||
|
$flag_debug = '-g'
|
||||||
|
$flag_debug_codeview = '-gcodeview'
|
||||||
|
$flag_define = '-D'
|
||||||
|
$flag_include = '-I'
|
||||||
|
$flag_library = '-l'
|
||||||
|
$flag_library_path = '-L'
|
||||||
|
$flag_link_win = '-Wl,'
|
||||||
|
$flag_link_win_subsystem_console = '/SUBSYSTEM:CONSOLE'
|
||||||
|
$flag_link_win_machine_32 = '/MACHINE:X86'
|
||||||
|
$flag_link_win_machine_64 = '/MACHINE:X64'
|
||||||
|
$flag_link_win_debug = '/DEBUG'
|
||||||
|
$flag_link_win_pdb = '/PDB:'
|
||||||
|
$flag_link_win_path_output = '/OUT:'
|
||||||
|
$flag_no_optimization = '-O0'
|
||||||
|
$flag_path_output = '-o'
|
||||||
|
$flag_preprocess_non_intergrated = '-no-integrated-cpp'
|
||||||
|
$flag_profiling_debug = '-fdebug-info-for-profiling'
|
||||||
|
$flag_target_arch = '-target'
|
||||||
|
$flag_wall = '-Wall'
|
||||||
|
$flag_warning = '-W'
|
||||||
|
$flag_warning_as_error = '-Werror'
|
||||||
|
$flag_win_nologo = '/nologo'
|
||||||
|
|
||||||
|
$ignore_warning_ms_include = 'no-microsoft-include'
|
||||||
|
|
||||||
|
$target_arch = Get-TargetArchClang
|
||||||
|
|
||||||
|
$warning_ignores = @(
|
||||||
|
$ignore_warning_ms_include
|
||||||
|
)
|
||||||
|
|
||||||
|
# https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-170
|
||||||
|
$libraries = @(
|
||||||
|
'Kernel32' # For Windows API
|
||||||
|
# 'msvcrt', # For the C Runtime (Dynamically Linked)
|
||||||
|
# 'libucrt',
|
||||||
|
'libcmt' # For the C Runtime (Static Linkage)
|
||||||
|
)
|
||||||
|
|
||||||
|
function build-simple
|
||||||
|
{
|
||||||
|
param( $includes, $unit, $executable )
|
||||||
|
Write-Host "build-simple: clang"
|
||||||
|
|
||||||
|
$object = $executable -replace '\.exe', '.obj'
|
||||||
|
$pdb = $executable -replace '\.exe', '.pdb'
|
||||||
|
|
||||||
|
$compiler_args = @(
|
||||||
|
$flag_no_color_diagnostics,
|
||||||
|
$flag_target_arch, $target_arch,
|
||||||
|
$flag_wall,
|
||||||
|
$flag_preprocess_non_intergrated,
|
||||||
|
( $flag_define + 'GEN_TIME' ),
|
||||||
|
( $flag_path_output + $object ),
|
||||||
|
( $flag_include + $includes )
|
||||||
|
)
|
||||||
|
if ( $release -eq $false ) {
|
||||||
|
$compiler_args += ( $flag_define + 'Build_Debug' )
|
||||||
|
$compiler_args += $flag_debug, $flag_debug_codeview, $flag_profiling_debug
|
||||||
|
$compiler_args += $flag_no_optimization
|
||||||
|
}
|
||||||
|
|
||||||
|
$warning_ignores | ForEach-Object {
|
||||||
|
$compiler_args += $flag_warning + $_
|
||||||
|
}
|
||||||
|
|
||||||
|
$compiler_args += $flag_compile, $unit
|
||||||
|
run-compiler $compiler $unit $compiler_args
|
||||||
|
|
||||||
|
$linker_args = @(
|
||||||
|
$flag_link_win_subsystem_console,
|
||||||
|
$flag_link_win_machine_64,
|
||||||
|
$( $flag_link_win_path_output + $executable )
|
||||||
|
)
|
||||||
|
if ( $release -eq $false ) {
|
||||||
|
$linker_args += $flag_link_win_debug
|
||||||
|
$linker_args += $flag_link_win_pdb + $pdb
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
$libraries | ForEach-Object {
|
||||||
|
$linker_args += $_ + '.lib'
|
||||||
|
}
|
||||||
|
|
||||||
|
$linker_args += $object
|
||||||
|
run-linker $linker $executable $linker_args
|
||||||
|
}
|
||||||
|
|
||||||
|
$compiler = 'clang++'
|
||||||
|
$linker = 'lld-link'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $vendor -match "msvc" )
|
||||||
|
{
|
||||||
|
# https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category?view=msvc-170
|
||||||
|
$flag_compile = '/c'
|
||||||
|
$flag_debug = '/Zi'
|
||||||
|
$flag_define = '/D'
|
||||||
|
$flag_include = '/I'
|
||||||
|
$flag_full_src_path = '/FC'
|
||||||
|
$flag_nologo = '/nologo'
|
||||||
|
$flag_dll = '/LD'
|
||||||
|
$flag_dll_debug = '/LDd'
|
||||||
|
$flag_linker = '/link'
|
||||||
|
$flag_link_debug = '/DEBUG'
|
||||||
|
$flag_link_pdb = '/PDB:'
|
||||||
|
$flag_link_machine_32 = '/MACHINE:X86'
|
||||||
|
$flag_link_machine_64 = '/MACHINE:X64'
|
||||||
|
$flag_link_path_output = '/OUT:'
|
||||||
|
$flag_link_rt_dll = '/MD'
|
||||||
|
$flag_link_rt_dll_debug = '/MDd'
|
||||||
|
$flag_link_rt_static = '/MT'
|
||||||
|
$flag_link_rt_static_debug = '/MTd'
|
||||||
|
$flag_link_subsystem_console = '/SUBSYSTEM:CONSOLE'
|
||||||
|
$flag_link_subsystem_windows = '/SUBSYSTEM:WINDOWS'
|
||||||
|
$flag_no_optimization = '/Od'
|
||||||
|
$flag_out_name = '/OUT:'
|
||||||
|
$flag_path_interm = '/Fo'
|
||||||
|
$flag_path_debug = '/Fd'
|
||||||
|
$flag_path_output = '/Fe'
|
||||||
|
$flag_preprocess_conform = '/Zc:preprocessor'
|
||||||
|
|
||||||
|
# This works because this project uses a single unit to build
|
||||||
|
function build-simple
|
||||||
|
{
|
||||||
|
param( $includes, $unit, $executable )
|
||||||
|
Write-Host "build-simple: msvc"
|
||||||
|
|
||||||
|
$object = $executable -replace '\.exe', '.obj'
|
||||||
|
$pdb = $executable -replace '\.exe', '.pdb'
|
||||||
|
|
||||||
|
$compiler_args = @(
|
||||||
|
$flag_nologo,
|
||||||
|
$flag_preprocess_conform,
|
||||||
|
$flag_debug,
|
||||||
|
( $flag_define + 'GEN_TIME' ),
|
||||||
|
$flag_full_src_path,
|
||||||
|
( $flag_path_interm + $path_build + '\' ),
|
||||||
|
( $flag_path_output + $path_build + '\' )
|
||||||
|
)
|
||||||
|
if ( $release -eq $false ) {
|
||||||
|
$compiler_args += ( $flag_define + 'Build_Debug' )
|
||||||
|
$compiler_args += ( $flag_path_debug + $path_build + '\' )
|
||||||
|
$compiler_args += $flag_link_rt_static_debug
|
||||||
|
$compiler_args += $flag_no_optimization
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$compiler_args += $flag_link_rt_static
|
||||||
|
}
|
||||||
|
$compiler_args += $includes | ForEach-Object { $flag_include + $_ }
|
||||||
|
$compiler_args += $flag_compile, $unit
|
||||||
|
run-compiler $compiler $unit $compiler_args
|
||||||
|
|
||||||
|
$linker_args = @(
|
||||||
|
$flag_nologo,
|
||||||
|
$flag_link_machine_64,
|
||||||
|
$flag_link_subsystem_console,
|
||||||
|
( $flag_link_path_output + $executable )
|
||||||
|
)
|
||||||
|
if ( $release -eq $false ) {
|
||||||
|
$linker_args += $flag_link_debug
|
||||||
|
$linker_args += $flag_link_pdb + $pdb
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
$linker_args += $object
|
||||||
|
run-linker $linker $executable $linker_args
|
||||||
|
}
|
||||||
|
|
||||||
|
$compiler = 'cl'
|
||||||
|
$linker = 'link'
|
||||||
|
}
|
||||||
|
#endregion Configuration
|
||||||
|
|
||||||
|
#region Building
|
||||||
|
$path_build = Join-Path $path_root build
|
||||||
|
$path_project = Join-Path $path_root project
|
||||||
|
$path_scripts = Join-Path $path_root scripts
|
||||||
|
$path_singleheader = Join-Path $path_root singleheader
|
||||||
|
$path_test = Join-Path $path_root test
|
||||||
|
|
||||||
|
if ( $bootstrap )
|
||||||
|
{
|
||||||
|
$path_build = join-path $path_project build
|
||||||
|
$path_gen = join-path $path_project gen
|
||||||
|
|
||||||
|
if ( -not(Test-Path($path_build) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_build
|
||||||
|
}
|
||||||
|
if ( -not(Test-Path($path_gen) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_gen
|
||||||
|
}
|
||||||
|
|
||||||
|
$includes = @( $path_project)
|
||||||
|
$unit = join-path $path_project "bootstrap.cpp"
|
||||||
|
$executable = join-path $path_build "bootstrap.exe"
|
||||||
|
|
||||||
|
build-simple $includes $unit $executable
|
||||||
|
|
||||||
|
Push-Location $path_project
|
||||||
|
if ( Test-Path( $executable ) ) {
|
||||||
|
write-host "`nRunning bootstrap"
|
||||||
|
$time_taken = Measure-Command { & $executable
|
||||||
|
| ForEach-Object {
|
||||||
|
write-host `t $_ -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write-host "`nBootstrap completed in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $singleheader )
|
||||||
|
{
|
||||||
|
$path_build = join-path $path_singleheader build
|
||||||
|
$path_gen = join-path $path_singleheader gen
|
||||||
|
|
||||||
|
if ( -not(Test-Path($path_build) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_build
|
||||||
|
}
|
||||||
|
if ( -not(Test-Path($path_gen) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_gen
|
||||||
|
}
|
||||||
|
|
||||||
|
$includes = @( $path_project )
|
||||||
|
$unit = join-path $path_singleheader "singleheader.cpp"
|
||||||
|
$executable = join-path $path_build "singleheader.exe"
|
||||||
|
|
||||||
|
build-simple $includes $unit $executable
|
||||||
|
|
||||||
|
Push-Location $path_singleheader
|
||||||
|
if ( Test-Path( $executable ) ) {
|
||||||
|
write-host "`nRunning singleheader generator"
|
||||||
|
$time_taken = Measure-Command { & $executable
|
||||||
|
| ForEach-Object {
|
||||||
|
write-host `t $_ -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write-host "`nSingleheader generator completed in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $test )
|
||||||
|
{
|
||||||
|
$path_gen = join-path $path_test gen
|
||||||
|
$path_gen_build = join-path $path_gen build
|
||||||
|
$path_build = join-path $path_test build
|
||||||
|
|
||||||
|
if ( -not(Test-Path($path_build) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_build
|
||||||
|
}
|
||||||
|
if ( -not(Test-Path($path_gen) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_gen
|
||||||
|
}
|
||||||
|
if ( -not(Test-Path($path_gen_build) )) {
|
||||||
|
New-Item -ItemType Directory -Path $path_gen_build
|
||||||
|
}
|
||||||
|
|
||||||
|
$path_bootstrap = join-path $path_project gen
|
||||||
|
|
||||||
|
$includes = @( $path_bootstrap )
|
||||||
|
$unit = join-path $path_test "test.cpp"
|
||||||
|
$executable = join-path $path_build "test.exe"
|
||||||
|
|
||||||
|
build-simple $includes $unit $executable
|
||||||
|
|
||||||
|
Push-Location $path_test
|
||||||
|
if ( Test-Path( $executable ) ) {
|
||||||
|
write-host "`nRunning test generator"
|
||||||
|
$time_taken = Measure-Command { & $executable
|
||||||
|
| ForEach-Object {
|
||||||
|
write-host `t $_ -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write-host "`nTest generator completed in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
#endregion Building
|
||||||
|
|
||||||
|
#region Formatting
|
||||||
|
function format-cpp
|
||||||
|
{
|
||||||
|
param( $path, $include, $exclude )
|
||||||
|
|
||||||
|
# Format generated gencpp
|
||||||
|
Write-Host "`nBeginning format"
|
||||||
|
$formatParams = @(
|
||||||
|
'-i' # In-place
|
||||||
|
'-style=file:./scripts/.clang-format'
|
||||||
|
'-verbose'
|
||||||
|
)
|
||||||
|
|
||||||
|
$targetFiles = @(
|
||||||
|
Get-ChildItem -Recurse -Path $path -Include $include -Exclude $exclude
|
||||||
|
| Select-Object -ExpandProperty FullName
|
||||||
|
)
|
||||||
|
|
||||||
|
$time_taken = Measure-Command {
|
||||||
|
clang-format $formatParams $targetFiles
|
||||||
|
}
|
||||||
|
Write-Host "`nFormatting complete in $($time_taken.TotalMilliseconds) ms"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) )
|
||||||
|
{
|
||||||
|
$path_gen = join-path $path_project gen
|
||||||
|
$include = @(
|
||||||
|
'gen.hpp', 'gen.cpp',
|
||||||
|
'gen.dep.hpp', 'gen.dep.cpp',
|
||||||
|
'gen.builder.hpp', 'gen.builder.cpp'
|
||||||
|
'gen.scanner.hpp', 'gen.scanner.cpp'
|
||||||
|
)
|
||||||
|
$exclude = $null
|
||||||
|
format-cpp $path_gen $include $exclude
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $singleheader -and (Test-Path (Join-Path $path_singleheader "gen/gen.hpp")) )
|
||||||
|
{
|
||||||
|
$path_gen = join-path $path_singleheader gen
|
||||||
|
$include = @(
|
||||||
|
'gen.hpp'
|
||||||
|
)
|
||||||
|
$exclude = $null
|
||||||
|
format-cpp $path_gen $include $exclude
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $test )
|
||||||
|
{
|
||||||
|
$path_gen = join-path $path_test gen
|
||||||
|
$include = @(
|
||||||
|
'*.gen.hpp'
|
||||||
|
)
|
||||||
|
$exclude = $null
|
||||||
|
format-cpp $path_gen $include $exclude
|
||||||
|
}
|
||||||
|
#endregion Formatting
|
||||||
|
|
||||||
|
Pop-Location # $path_root
|
3
scripts/build.ps1
Normal file
3
scripts/build.ps1
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
cls
|
||||||
|
$build = Join-Path $PSScriptRoot 'build.ci.ps1'
|
||||||
|
& $build @args
|
@ -7,9 +7,9 @@ $path_singleheader_build = Join-Path $path_singleheader build
|
|||||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||||
$path_test = Join-Path $path_root test
|
$path_test = Join-Path $path_root test
|
||||||
$path_test_build = Join-Path $path_test build
|
$path_test_build = Join-Path $path_test build
|
||||||
$path_gen = Join-Path $path_test gen
|
$path_test_gen = Join-Path $path_test gen
|
||||||
$path_gen_build = Join-Path $path_gen build
|
|
||||||
$path_x64 = Join-Path $path_root x64
|
$path_x64 = Join-Path $path_root x64
|
||||||
|
$path_release = Join-Path $path_root release
|
||||||
|
|
||||||
if ( Test-Path $path_project_build)
|
if ( Test-Path $path_project_build)
|
||||||
{
|
{
|
||||||
@ -36,9 +36,9 @@ if ( Test-Path $path_test_build )
|
|||||||
Remove-Item $path_test_build -Recurse
|
Remove-Item $path_test_build -Recurse
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Test-Path $path_gen_build )
|
if ( Test-Path $path_test_gen )
|
||||||
{
|
{
|
||||||
Remove-Item $path_gen_build -Recurse
|
Remove-Item $path_test_gen -Recurse
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Test-Path $path_x64)
|
if ( Test-Path $path_x64)
|
||||||
@ -46,22 +46,10 @@ if ( Test-Path $path_x64)
|
|||||||
Remove-Item $path_x64 -Recurse
|
Remove-Item $path_x64 -Recurse
|
||||||
}
|
}
|
||||||
|
|
||||||
# [string[]] $include = 'gen.hpp', 'gen.cpp', 'gen_dep.hpp', 'gen_dep.cpp'
|
if ( Test-Path $path_release )
|
||||||
# [string[]] $exclude =
|
{
|
||||||
|
Remove-Item $path_release -Recurse
|
||||||
# $files = Get-ChildItem -Recurse -Path $path_project_gen -Include $include -Exclude $exclude
|
}
|
||||||
|
|
||||||
# if ( $files )
|
|
||||||
# {
|
|
||||||
# Remove-Item $files
|
|
||||||
# }
|
|
||||||
|
|
||||||
# $files = Get-ChildItem -Recurse -Path $path_singleheader_gen -Include $include -Exclude $exclude
|
|
||||||
|
|
||||||
# if ( $files )
|
|
||||||
# {
|
|
||||||
# Remove-Item $files
|
|
||||||
# }
|
|
||||||
|
|
||||||
$include = '*.h', '*.hpp', '*.cpp'
|
$include = '*.h', '*.hpp', '*.cpp'
|
||||||
$exclude =
|
$exclude =
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
<DisplayString>{(Header*)((char*)Data - sizeof(Header))}</DisplayString>
|
<DisplayString>{(Header*)((char*)Data - sizeof(Header))}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<Item Name="Allocator">((Header*)((char*)Data - sizeof(Header)))->Allocator</Item>
|
<Item Name="Allocator">((Header*)((char*)Data - sizeof(Header)))->Allocator</Item>
|
||||||
<Item Name="Length">((Header*)((char*)Data - sizeof(Header)))->Length</Item>
|
|
||||||
<Item Name="Capacity">((Header*)((char*)Data - sizeof(Header)))->Capacity</Item>
|
<Item Name="Capacity">((Header*)((char*)Data - sizeof(Header)))->Capacity</Item>
|
||||||
|
<Item Name="Length">((Header*)((char*)Data - sizeof(Header)))->Length</Item>
|
||||||
</Expand>
|
</Expand>
|
||||||
</Synthetic>
|
</Synthetic>
|
||||||
</Expand>
|
</Expand>
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
// Gen Macro namespace
|
// Gen Macro namespace
|
||||||
// namespace GEN_, new_namespace_
|
// namespace GEN_, new_namespace_
|
||||||
|
|
||||||
// ---------- ZPL Macros
|
// ---------- Dependency Macros
|
||||||
|
// Platform
|
||||||
// word GEN_ARCH_64_BIT, new_name
|
// word GEN_ARCH_64_BIT, new_name
|
||||||
// word GEN_ARCH_32_BIT, new_name
|
// word GEN_ARCH_32_BIT, new_name
|
||||||
|
|
||||||
@ -43,20 +43,86 @@
|
|||||||
// word GEN_COMPILER_MINGW, new_name
|
// word GEN_COMPILER_MINGW, new_name
|
||||||
// word GEN_COMPILER_MSVC, new_name
|
// word GEN_COMPILER_MSVC, new_name
|
||||||
|
|
||||||
// word forceinline, new_name
|
// General
|
||||||
// word neverinline, new_name
|
|
||||||
|
|
||||||
// word zpl_cast, new_name
|
// word zpl_cast, new_name
|
||||||
|
|
||||||
// word global, new_name
|
// word global, new_name
|
||||||
// word internal, new_name
|
// word internal, new_name
|
||||||
// word local_persist, new_name
|
// word local_persist, new_name
|
||||||
|
// word forceinline, new_name
|
||||||
|
// word neverinline, new_name
|
||||||
|
|
||||||
|
// word bit, new_name
|
||||||
|
// word bitfield_is_equal, new_name
|
||||||
|
|
||||||
|
// word ccast, new_name
|
||||||
|
// word pcast, new_name
|
||||||
|
// word rcast, new_name
|
||||||
|
// word scast, new_name
|
||||||
|
|
||||||
|
// word num_args, new_name
|
||||||
|
// word num_args_impl, new_name
|
||||||
|
|
||||||
|
// word stringize, new_name
|
||||||
|
// word stringize_va, new_name
|
||||||
|
|
||||||
|
// word do_once, new_name
|
||||||
|
// word do_once_start, new_name
|
||||||
|
// word do_once_end, new_name
|
||||||
|
// word label_scope_start, new_name
|
||||||
|
// word label_scope_end, new_name
|
||||||
|
|
||||||
|
// word count_of, new_name
|
||||||
|
// word is_between, new_name
|
||||||
|
// word min, new_name
|
||||||
|
// word size_of, new_name
|
||||||
|
// word offset_of, new_name
|
||||||
|
// word swap, new_name
|
||||||
|
|
||||||
|
// Basic Types
|
||||||
|
// word GEN_U8_MIN, new_name
|
||||||
|
// word GEN_U8_MAX, new_name
|
||||||
|
// word GEN_I8_MIN, new_name
|
||||||
|
// word GEN_I8_MAX, new_name
|
||||||
|
|
||||||
|
// word GEN_U16_MIN, new_name
|
||||||
|
// word GEN_U16_MAX, new_name
|
||||||
|
// word GEN_I16_MIN, new_name
|
||||||
|
// word GEN_I16_MAX, new_name
|
||||||
|
|
||||||
|
// word GEN_U32_MIN, new_name
|
||||||
|
// word GEN_U32_MAX, new_name
|
||||||
|
// word GEN_I32_MIN, new_name
|
||||||
|
// word GEN_I32_MAX, new_name
|
||||||
|
|
||||||
|
// word GEN_U64_MIN, new_name
|
||||||
|
// word GEN_U64_MAX, new_name
|
||||||
|
// word GEN_I64_MIN, new_name
|
||||||
|
// word GEN_I64_MAX, new_name
|
||||||
|
|
||||||
|
// word GEN_USIZE_MIN, new_name
|
||||||
|
// word GEN_USIZE_MAX, new_name
|
||||||
|
// word GEN_ISIZE_MIN, new_name
|
||||||
|
// word GEN_ISIZE_MAX, new_name
|
||||||
|
|
||||||
|
// word GEN_F32_MIN, new_name
|
||||||
|
// word GEN_F32_MAX, new_name
|
||||||
|
// word GEN_F64_MIN, new_name
|
||||||
|
// word GEN_F64_MAX, new_name
|
||||||
|
|
||||||
|
// Debug
|
||||||
// word GEN_DEBUG_TRAP, new_name
|
// word GEN_DEBUG_TRAP, new_name
|
||||||
// word GEN_ASSERT, new_name
|
// word GEN_ASSERT, new_name
|
||||||
// word GEN_ASSERT_MSG, new_name
|
// word GEN_ASSERT_MSG, new_name
|
||||||
// word GEN_ASSERT_NOT_NULL, new_name
|
// word GEN_ASSERT_NOT_NULL, new_name
|
||||||
// word GEN_PANIC, new_name
|
// word GEN_PANIC, new_name
|
||||||
|
// word GEN_FATAL, new_name
|
||||||
|
|
||||||
|
// Memory
|
||||||
|
// word kilobytes, new_name
|
||||||
|
// word megabytes, new_name
|
||||||
|
// word gigabytes, new_name
|
||||||
|
// word terabytes, new_name
|
||||||
|
|
||||||
// word zero_item, new_name
|
// word zero_item, new_name
|
||||||
// word zero_array, new_name
|
// word zero_array, new_name
|
||||||
@ -67,13 +133,11 @@
|
|||||||
// word malloc, new_name
|
// word malloc, new_name
|
||||||
// word mfree, new_name
|
// word mfree, new_name
|
||||||
|
|
||||||
// word count_of, new_name
|
// Strings
|
||||||
// word is_between, new_name
|
// word txt, new_name
|
||||||
// word min, new_name
|
// word cast_to_strc, new_name
|
||||||
// word size_of, new_name
|
|
||||||
// word swap, new_name
|
|
||||||
|
|
||||||
// ---------- ZPL Types
|
// ---------- Dependency Types
|
||||||
|
|
||||||
// word b8, new_name
|
// word b8, new_name
|
||||||
// word b16, new_name
|
// word b16, new_name
|
||||||
@ -114,11 +178,11 @@
|
|||||||
// word FileStandardType, new_name
|
// word FileStandardType, new_name
|
||||||
// word SeekWhenceType, new_name
|
// word SeekWhenceType, new_name
|
||||||
|
|
||||||
// ---------- ZPL Data
|
// ---------- Dependency Data
|
||||||
|
|
||||||
// word default_file_operations, new_name
|
// word default_file_operations, new_name
|
||||||
|
|
||||||
// ---------- ZPL Procedures
|
// ---------- Dependency Procedures
|
||||||
|
|
||||||
// word align_forward, new_name
|
// word align_forward, new_name
|
||||||
// word align_fordward_i64, new_name
|
// word align_fordward_i64, new_name
|
||||||
@ -158,6 +222,7 @@
|
|||||||
// word hex_digit_to_int, new_name
|
// word hex_digit_to_int, new_name
|
||||||
// word i64_to_str, new_name
|
// word i64_to_str, new_name
|
||||||
// word is_power_of_two, new_name
|
// word is_power_of_two, new_name
|
||||||
|
// word log_fmt, new_name
|
||||||
// word mem_copy, new_name
|
// word mem_copy, new_name
|
||||||
// word mem_move, new_name
|
// word mem_move, new_name
|
||||||
// word mem_set, new_name
|
// word mem_set, new_name
|
||||||
@ -189,22 +254,10 @@
|
|||||||
|
|
||||||
// ---------- gencpp Macros
|
// ---------- gencpp Macros
|
||||||
|
|
||||||
// word bit, new_name
|
// word log_failure, new_name
|
||||||
// word bitfield_is_equal, new_name
|
|
||||||
|
|
||||||
// word ccast, new_name
|
// word NoCode, new_name
|
||||||
// word pcast, new_name
|
// word CodeInvalid, new_name
|
||||||
// word rcast, new_name
|
|
||||||
// word scast, new_name
|
|
||||||
|
|
||||||
// word do_once, new_name
|
|
||||||
// word do_once_start, new_name
|
|
||||||
// word do_once_end, new_name
|
|
||||||
// word num_args, new_name
|
|
||||||
// word num_args_impl, new_name
|
|
||||||
// word stringize, new_name
|
|
||||||
// word stringize_va, new_name
|
|
||||||
// word txt_StrC, new_name
|
|
||||||
|
|
||||||
// ------------ gencpp common
|
// ------------ gencpp common
|
||||||
|
|
||||||
@ -215,16 +268,13 @@
|
|||||||
// word StrC, new_name
|
// word StrC, new_name
|
||||||
// word String, new_name
|
// word String, new_name
|
||||||
|
|
||||||
// word log_fmt, new_name
|
// word to_str, new_name
|
||||||
// word fatal, new_name
|
// word to_str, new_name
|
||||||
// word to_str, new_name
|
// word to_type, new_name
|
||||||
// word to_StrC, new_name
|
|
||||||
// word to_type, new_name
|
|
||||||
|
|
||||||
// ------------ gencpp Types & Constants
|
// ------------ gencpp Types & Constants
|
||||||
|
|
||||||
// word LogFailType, new_name
|
// word LogFailType, new_name
|
||||||
// word log_failure, new_name
|
|
||||||
|
|
||||||
// word AccessSpec, new_name
|
// word AccessSpec, new_name
|
||||||
// word ECode, new_name
|
// word ECode, new_name
|
||||||
@ -251,7 +301,6 @@
|
|||||||
// word Code, new_name
|
// word Code, new_name
|
||||||
// word Code_POD, new_name
|
// word Code_POD, new_name
|
||||||
// word Keyword, new_name
|
// word Keyword, new_name
|
||||||
// word NoCode, new_name
|
|
||||||
|
|
||||||
// ------------ gencpp API
|
// ------------ gencpp API
|
||||||
|
|
||||||
@ -277,6 +326,9 @@
|
|||||||
// word def_attributes, new_name
|
// word def_attributes, new_name
|
||||||
// word def_comment, new_name
|
// word def_comment, new_name
|
||||||
// word def_class, new_name
|
// word def_class, new_name
|
||||||
|
// word def_constructor, new_name
|
||||||
|
// word def_destructor, new_name
|
||||||
|
// word def_define, new_name
|
||||||
// word def_enum, new_name
|
// word def_enum, new_name
|
||||||
// word def_execution, new_name
|
// word def_execution, new_name
|
||||||
// word def_extern_link, new_name
|
// word def_extern_link, new_name
|
||||||
@ -286,7 +338,10 @@
|
|||||||
// word def_module, new_name
|
// word def_module, new_name
|
||||||
// word def_namespace, new_name
|
// word def_namespace, new_name
|
||||||
// word def_operator, new_name
|
// word def_operator, new_name
|
||||||
|
// word def_operator_cast, new_name
|
||||||
// word def_param, new_name
|
// word def_param, new_name
|
||||||
|
// word def_pargma, new_name
|
||||||
|
// word def_preprocess_cond, new_name
|
||||||
// word def_specifier, new_name
|
// word def_specifier, new_name
|
||||||
// word def_struct, new_name
|
// word def_struct, new_name
|
||||||
// word def_template, new_name
|
// word def_template, new_name
|
||||||
@ -343,22 +398,24 @@
|
|||||||
// word untyped_fmt, new_name
|
// word untyped_fmt, new_name
|
||||||
// word untyped_token_fmt, new_name
|
// word untyped_token_fmt, new_name
|
||||||
|
|
||||||
// ------------ File Handling
|
// ------------ File Ops
|
||||||
|
|
||||||
// word Builder, new_name
|
// word Builder, new_name
|
||||||
// word Editor, new_name
|
// word Editor, new_name
|
||||||
// word Scanner, new_name
|
// word Scanner, new_name
|
||||||
|
|
||||||
// ------------ gencpp macros
|
// ------------ gencpp user macros
|
||||||
|
|
||||||
// word gen_main, new_name
|
// word gen_main, new_name
|
||||||
// word GEN_TIME, new_name
|
// word GEN_TIME, new_name
|
||||||
|
|
||||||
// word __, new_name
|
// word __, new_name
|
||||||
// word code, new_name
|
// word name, new_name
|
||||||
// word name, new_name
|
// word code, new_name
|
||||||
// word args, new_name
|
// word args, new_name
|
||||||
// word token_fmt, new_name
|
// word code_str, new_name
|
||||||
|
// word code_fmt, new_name
|
||||||
|
// word token_fmt, new_name
|
||||||
|
|
||||||
// ------------ Type AST namespace
|
// ------------ Type AST namespace
|
||||||
// namespace t_, new_namespace_
|
// namespace t_, new_namespace_
|
||||||
|
25
scripts/helpers/target_arch.psm1
Normal file
25
scripts/helpers/target_arch.psm1
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# target_arch.psm1
|
||||||
|
|
||||||
|
function Get-TargetArchClang {
|
||||||
|
# Get the target architecture by querying clang itself
|
||||||
|
$output = & clang -v 2>&1
|
||||||
|
foreach ($line in $output) {
|
||||||
|
if ($line -like "*Target:*") {
|
||||||
|
$clangTarget = ($line -split ':')[1].Trim()
|
||||||
|
return $clangTarget
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw "Clang target architecture could not be determined."
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-TargetArchMSVC {
|
||||||
|
# Assuming you've set the Visual Studio environment variables using `vcvarsall.bat`
|
||||||
|
# This looks for the `VSCMD_ARG_TGT_ARCH` environment variable which Visual Studio sets to indicate the target architecture.
|
||||||
|
$arch = $env:VSCMD_ARG_TGT_ARCH
|
||||||
|
if (-not $arch) {
|
||||||
|
throw "MSVC target architecture could not be determined. Ensure you've initialized the Visual Studio environment."
|
||||||
|
}
|
||||||
|
return $arch
|
||||||
|
}
|
||||||
|
|
||||||
|
Export-ModuleMember -Function Get-TargetArchClang, Get-TargetArchMSVC
|
@ -1,16 +0,0 @@
|
|||||||
cls
|
|
||||||
|
|
||||||
if ( -not( Test-Path $path_build ) ) {
|
|
||||||
New-Item -ItemType Directory -Path $path_build | Out-Null
|
|
||||||
}
|
|
||||||
if ( -not( Test-Path $path_build_interm ) ) {
|
|
||||||
New-Item -ItemType Directory -Path $path_build_interm | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
|
||||||
$path_build = Join-Path $path_root build
|
|
||||||
$path_gen = Join-Path $path_test gen
|
|
||||||
$path_gen_build = Join-Path $path_gen build
|
|
||||||
$path_scripts = Join-Path $path_root scripts
|
|
||||||
$path_test = Join-Path $path_root test
|
|
||||||
$path_test_build = Join-Path $path_test build
|
|
48
scripts/package_release.ps1
Normal file
48
scripts/package_release.ps1
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
cls
|
||||||
|
|
||||||
|
$build = Join-Path $PSScriptRoot 'build.ci.ps1'
|
||||||
|
|
||||||
|
if ( $IsWindows ) {
|
||||||
|
& $build release msvc bootstrap singleheader
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
& $build release clang bootstrap singleheader
|
||||||
|
}
|
||||||
|
|
||||||
|
$path_root = git rev-parse --show-toplevel
|
||||||
|
$path_docs = Join-Path $path_root docs
|
||||||
|
$path_project = Join-Path $path_root project
|
||||||
|
$path_project_gen = Join-Path $path_project gen
|
||||||
|
$path_singleheader = Join-Path $path_root singleheader
|
||||||
|
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||||
|
$path_release = Join-Path $path_root release
|
||||||
|
$path_release_content = Join-Path $path_release content
|
||||||
|
|
||||||
|
if ( -not(Test-Path $path_release) ) {
|
||||||
|
New-Item -ItemType Directory -Path $path_release
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( -not(Test-Path $path_release_content) ) {
|
||||||
|
New-Item -ItemType Directory -Path $path_release_content
|
||||||
|
}
|
||||||
|
|
||||||
|
$license = Join-Path $path_root LICENSE
|
||||||
|
$readme_root = Join-Path $path_root Readme.md
|
||||||
|
$readme_docs = Join-Path $path_docs Readme.md
|
||||||
|
$readme_parsing = Join-Path $path_docs Parsing.md
|
||||||
|
|
||||||
|
Copy-Item $license -Destination (Join-Path $path_release_content "LICENSE")
|
||||||
|
Copy-Item $readme_root -Destination (Join-Path $path_release_content "Readme.md")
|
||||||
|
Copy-Item $readme_docs -Destination (Join-Path $path_release_content "Readme_Docs.md")
|
||||||
|
Copy-Item $readme_parsing -Destination (Join-Path $path_release_content "Parsing.md")
|
||||||
|
|
||||||
|
# Singleheader
|
||||||
|
Copy-Item -Path $path_singleheader_gen\gen.hpp -Destination $path_release_content\gen.hpp
|
||||||
|
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_singleheader.zip -Force
|
||||||
|
Remove-Item -Path $path_release_content\gen.hpp
|
||||||
|
|
||||||
|
# Segmented
|
||||||
|
Copy-Item -Path $path_project_gen\* -Destination $path_release_content
|
||||||
|
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_segmented.zip -Force
|
||||||
|
|
||||||
|
Remove-Item -Path $path_release_content -Recurse
|
@ -1,73 +0,0 @@
|
|||||||
[string] $type = $null
|
|
||||||
[string] $test = $false
|
|
||||||
|
|
||||||
foreach ( $arg in $args )
|
|
||||||
{
|
|
||||||
if ( $arg -eq "test" )
|
|
||||||
{
|
|
||||||
$test = $true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$type = $arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
|
||||||
$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 singleheader`n"
|
|
||||||
|
|
||||||
if ( -not( Test-Path $path_singleheader_build) )
|
|
||||||
{
|
|
||||||
# Generate build files for meta-program
|
|
||||||
Push-Location $path_singleheader
|
|
||||||
$args_meson = @()
|
|
||||||
$args_meson += "setup"
|
|
||||||
$args_meson += $path_singleheader_build
|
|
||||||
|
|
||||||
& meson $args_meson
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile meta-program
|
|
||||||
Push-Location $path_root
|
|
||||||
$args_ninja = @()
|
|
||||||
$args_ninja += "-C"
|
|
||||||
$args_ninja += $path_singleheader_build
|
|
||||||
|
|
||||||
& ninja $args_ninja
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Push-location $path_singleheader
|
|
||||||
if ( -not(Test-Path($path_singleheader_gen) )) {
|
|
||||||
New-Item -ItemType Directory -Path $path_singleheader_gen
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run meta-program
|
|
||||||
$gencpp_singleheader = Join-Path $path_singleheader_build gencpp_singleheader.exe
|
|
||||||
|
|
||||||
Write-Host `nRunning gencpp singleheader...
|
|
||||||
& $gencpp_singleheader
|
|
||||||
|
|
||||||
# Format generated files
|
|
||||||
Write-Host `nBeginning format...
|
|
||||||
$formatParams = @(
|
|
||||||
'-i' # In-place
|
|
||||||
'-style=file:../scripts/.clang-format'
|
|
||||||
'-verbose'
|
|
||||||
)
|
|
||||||
|
|
||||||
$include = @('gen.hpp')
|
|
||||||
$exclude = $null
|
|
||||||
|
|
||||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
|
||||||
|
|
||||||
clang-format $formatParams $targetFiles
|
|
||||||
Write-Host "`nFormatting complete"
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
# Build and run validation
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
cls
|
|
||||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'singleheader.ci.ps1') $args"
|
|
@ -1,45 +0,0 @@
|
|||||||
[string] $type = $null
|
|
||||||
[string] $test = $false
|
|
||||||
|
|
||||||
foreach ( $arg in $args )
|
|
||||||
{
|
|
||||||
if ( $arg -eq "test" )
|
|
||||||
{
|
|
||||||
$test = $true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$type = $arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
|
||||||
$path_build = Join-Path $path_root build
|
|
||||||
$path_scripts = Join-Path $path_root scripts
|
|
||||||
$path_test = Join-Path $path_root test
|
|
||||||
$path_gen = Join-Path $path_test gen
|
|
||||||
$path_test_build = Join-Path $path_test build
|
|
||||||
$path_gen_build = Join-Path $path_gen build
|
|
||||||
|
|
||||||
write-host "`n`nBuilding Test`n"
|
|
||||||
|
|
||||||
if ( -not( Test-Path $path_gen_build ) )
|
|
||||||
{
|
|
||||||
# Generate build files for meta-program
|
|
||||||
Push-Location $path_gen
|
|
||||||
$args_meson = @()
|
|
||||||
$args_meson += "setup"
|
|
||||||
$args_meson += $path_gen_build
|
|
||||||
|
|
||||||
& meson $args_meson
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile meta-program
|
|
||||||
Push-Location $path_root
|
|
||||||
$args_ninja = @()
|
|
||||||
$args_ninja += "-C"
|
|
||||||
$args_ninja += $path_gen_build
|
|
||||||
|
|
||||||
& ninja $args_ninja
|
|
||||||
Pop-Location
|
|
@ -1,2 +0,0 @@
|
|||||||
cls
|
|
||||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'test.gen_build.ci.ps1') $args"
|
|
@ -1,102 +0,0 @@
|
|||||||
cls
|
|
||||||
|
|
||||||
[string] $type = $null
|
|
||||||
[string] $test = $false
|
|
||||||
|
|
||||||
foreach ( $arg in $args )
|
|
||||||
{
|
|
||||||
if ( $arg -eq "test" )
|
|
||||||
{
|
|
||||||
$test = $true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$type = $arg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
|
||||||
$path_build = Join-Path $path_root build
|
|
||||||
$path_scripts = Join-Path $path_root scripts
|
|
||||||
$path_test = Join-Path $path_root test
|
|
||||||
$path_gen = Join-Path $path_test gen
|
|
||||||
$path_test_build = Join-Path $path_test build
|
|
||||||
$path_gen_build = Join-Path $path_gen build
|
|
||||||
|
|
||||||
# Invoke-Expression "& $(Join-Path $PSScriptRoot 'bootstrap.ci.ps1')"
|
|
||||||
# Invoke-Expression "& $(Join-Path $PSScriptRoot 'singleheader.ci.ps1')"
|
|
||||||
|
|
||||||
write-host "`n`nBuilding Test`n"
|
|
||||||
|
|
||||||
if ( -not( Test-Path $path_gen_build ) )
|
|
||||||
{
|
|
||||||
# Generate build files for meta-program
|
|
||||||
Push-Location $path_gen
|
|
||||||
$args_meson = @()
|
|
||||||
$args_meson += "setup"
|
|
||||||
$args_meson += $path_gen_build
|
|
||||||
|
|
||||||
& meson $args_meson
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile meta-program
|
|
||||||
Push-Location $path_root
|
|
||||||
$args_ninja = @()
|
|
||||||
$args_ninja += "-C"
|
|
||||||
$args_ninja += $path_gen_build
|
|
||||||
|
|
||||||
& ninja $args_ninja
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Push-location $path_gen
|
|
||||||
# Run meta-program
|
|
||||||
$gencpp = Join-Path $path_gen_build gencpp.exe
|
|
||||||
|
|
||||||
Write-Host `nRunning tests...
|
|
||||||
& $gencpp
|
|
||||||
|
|
||||||
# Format generated files
|
|
||||||
$path_clang_format = Join-Path $path_scripts .clang-format
|
|
||||||
|
|
||||||
Write-Host `nBeginning format...
|
|
||||||
$formatParams = @(
|
|
||||||
'-i' # In-place
|
|
||||||
"-style=file:$path_clang_format" # Search for a .clang-format file in the parent directory of the source file.
|
|
||||||
'-verbose'
|
|
||||||
)
|
|
||||||
|
|
||||||
$include = @('*.gen.hpp', '*.gen.cpp')
|
|
||||||
$exclude = $null
|
|
||||||
|
|
||||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
|
||||||
|
|
||||||
clang-format $formatParams $targetFiles
|
|
||||||
Write-Host "`nFormatting complete"
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
# Build the program depending on generated files.
|
|
||||||
if ( -not( Test-Path $path_test_build ) )
|
|
||||||
{
|
|
||||||
Push-Location $path_test
|
|
||||||
$args_meson = @()
|
|
||||||
$args_meson += "setup"
|
|
||||||
$args_meson += $path_test_build
|
|
||||||
|
|
||||||
# & meson $args_meson
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
Push-Location $path_root
|
|
||||||
$args_ninja = @()
|
|
||||||
$args_ninja += "-C"
|
|
||||||
$args_ninja += $path_test_build
|
|
||||||
|
|
||||||
# ninja $args_ninja
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Push-Location $path_test
|
|
||||||
$testcpp = Join-Path $path_test_build testcpp.exe
|
|
||||||
|
|
||||||
# & $testcpp
|
|
||||||
Pop-Location
|
|
@ -1,18 +0,0 @@
|
|||||||
project( 'gencpp_singleheader', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
|
||||||
|
|
||||||
includes = include_directories(
|
|
||||||
[
|
|
||||||
'../project',
|
|
||||||
])
|
|
||||||
|
|
||||||
sources = [ 'gen.singleheader.cpp' ]
|
|
||||||
|
|
||||||
if get_option('buildtype').startswith('debug')
|
|
||||||
|
|
||||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
executable( 'gencpp_singleheader', sources, include_directories : includes )
|
|
@ -3,15 +3,16 @@
|
|||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#include "gen.cpp"
|
#include "gen.cpp"
|
||||||
|
|
||||||
|
#include "helpers/push_ignores.inline.hpp"
|
||||||
#include "helpers/helper.hpp"
|
#include "helpers/helper.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
GEN_NS_BEGIN
|
||||||
#include "dependencies/parsing.cpp"
|
#include "dependencies/parsing.cpp"
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
|
||||||
#include "file_processors/builder.hpp"
|
#include "auxillary/builder.hpp"
|
||||||
#include "file_processors/builder.cpp"
|
#include "auxillary/builder.cpp"
|
||||||
#include "file_processors/scanner.hpp"
|
#include "auxillary/scanner.hpp"
|
||||||
|
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
|
||||||
@ -19,25 +20,25 @@ constexpr char const* generation_notice =
|
|||||||
"// This file was generated automatially by gen.bootstrap.cpp "
|
"// This file was generated automatially by gen.bootstrap.cpp "
|
||||||
"(See: https://github.com/Ed94/gencpp)\n\n";
|
"(See: https://github.com/Ed94/gencpp)\n\n";
|
||||||
|
|
||||||
constexpr StrC implementation_guard_start = txt_StrC(R"(
|
constexpr StrC implementation_guard_start = txt(R"(
|
||||||
#pragma region GENCPP IMPLEMENTATION GUARD
|
#pragma region GENCPP IMPLEMENTATION GUARD
|
||||||
#if defined(GEN_IMPLEMENTATION) && ! defined(GEN_IMPLEMENTED)
|
#if defined(GEN_IMPLEMENTATION) && ! defined(GEN_IMPLEMENTED)
|
||||||
# define GEN_IMPLEMENTED
|
# define GEN_IMPLEMENTED
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr StrC implementation_guard_end = txt_StrC(R"(
|
constexpr StrC implementation_guard_end = txt(R"(
|
||||||
#endif
|
#endif
|
||||||
#pragma endregion GENCPP IMPLEMENTATION GUARD
|
#pragma endregion GENCPP IMPLEMENTATION GUARD
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr StrC roll_own_dependencies_guard_start = txt_StrC(R"(
|
constexpr StrC roll_own_dependencies_guard_start = txt(R"(
|
||||||
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
//! 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
|
// Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
||||||
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
||||||
|
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr StrC roll_own_dependencies_guard_end = txt_StrC(R"(
|
constexpr StrC roll_own_dependencies_guard_end = txt(R"(
|
||||||
// GEN_ROLL_OWN_DEPENDENCIES
|
// GEN_ROLL_OWN_DEPENDENCIES
|
||||||
#endif
|
#endif
|
||||||
)");
|
)");
|
||||||
@ -68,18 +69,18 @@ int gen_main()
|
|||||||
|
|
||||||
if ( generate_gen_dep )
|
if ( generate_gen_dep )
|
||||||
{
|
{
|
||||||
Code header_start = scan_file( project_dir "dependencies/header_start.hpp" );
|
Code header_start = scan_file( project_dir "dependencies/header_start.hpp" );
|
||||||
Code macros = scan_file( project_dir "dependencies/macros.hpp" );
|
Code macros = scan_file( project_dir "dependencies/macros.hpp" );
|
||||||
Code basic_types = scan_file( project_dir "dependencies/basic_types.hpp" );
|
Code basic_types = scan_file( project_dir "dependencies/basic_types.hpp" );
|
||||||
Code debug = scan_file( project_dir "dependencies/debug.hpp" );
|
Code debug = scan_file( project_dir "dependencies/debug.hpp" );
|
||||||
Code memory = scan_file( project_dir "dependencies/memory.hpp" );
|
Code memory = scan_file( project_dir "dependencies/memory.hpp" );
|
||||||
Code string_ops = scan_file( project_dir "dependencies/string_ops.hpp" );
|
Code string_ops = scan_file( project_dir "dependencies/string_ops.hpp" );
|
||||||
Code printing = scan_file( project_dir "dependencies/printing.hpp" );
|
Code printing = scan_file( project_dir "dependencies/printing.hpp" );
|
||||||
Code containers = scan_file( project_dir "dependencies/containers.hpp" );
|
Code containers = scan_file( project_dir "dependencies/containers.hpp" );
|
||||||
Code hashing = scan_file( project_dir "dependencies/hashing.hpp" );
|
Code hashing = scan_file( project_dir "dependencies/hashing.hpp" );
|
||||||
Code string = scan_file( project_dir "dependencies/string.hpp" );
|
Code strings = scan_file( project_dir "dependencies/strings.hpp" );
|
||||||
Code file_handling = scan_file( project_dir "dependencies/file_handling.hpp" );
|
Code filesystem = scan_file( project_dir "dependencies/filesystem.hpp" );
|
||||||
Code timing = scan_file( project_dir "dependencies/timing.hpp" );
|
Code timing = scan_file( project_dir "dependencies/timing.hpp" );
|
||||||
|
|
||||||
header.print_fmt( roll_own_dependencies_guard_start );
|
header.print_fmt( roll_own_dependencies_guard_start );
|
||||||
header.print( header_start );
|
header.print( header_start );
|
||||||
@ -93,8 +94,8 @@ int gen_main()
|
|||||||
header.print( printing );
|
header.print( printing );
|
||||||
header.print( containers );
|
header.print( containers );
|
||||||
header.print( hashing );
|
header.print( hashing );
|
||||||
header.print( string );
|
header.print( strings );
|
||||||
header.print( file_handling );
|
header.print( filesystem );
|
||||||
header.print( timing );
|
header.print( timing );
|
||||||
|
|
||||||
if ( generate_scanner )
|
if ( generate_scanner )
|
||||||
@ -106,6 +107,7 @@ int gen_main()
|
|||||||
|
|
||||||
header.print_fmt( "GEN_NS_END\n" );
|
header.print_fmt( "GEN_NS_END\n" );
|
||||||
header.print_fmt( roll_own_dependencies_guard_end );
|
header.print_fmt( roll_own_dependencies_guard_end );
|
||||||
|
header.print( fmt_newline );
|
||||||
}
|
}
|
||||||
|
|
||||||
Code types = scan_file( project_dir "components/types.hpp" );
|
Code types = scan_file( project_dir "components/types.hpp" );
|
||||||
@ -146,14 +148,14 @@ int gen_main()
|
|||||||
if ( generate_builder )
|
if ( generate_builder )
|
||||||
{
|
{
|
||||||
header.print_fmt( "#pragma region Builder\n\n" );
|
header.print_fmt( "#pragma region Builder\n\n" );
|
||||||
header.print( scan_file( project_dir "file_processors/builder.hpp" ) );
|
header.print( scan_file( project_dir "auxillary/builder.hpp" ) );
|
||||||
header.print_fmt( "#pragma endregion Builder\n\n" );
|
header.print_fmt( "#pragma endregion Builder\n\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( generate_scanner )
|
if ( generate_scanner )
|
||||||
{
|
{
|
||||||
header.print_fmt( "#pragma region Scanner\n\n" );
|
header.print_fmt( "#pragma region Scanner\n\n" );
|
||||||
header.print( scan_file( project_dir "file_processors/scanner.hpp" ) );
|
header.print( scan_file( project_dir "auxillary/scanner.hpp" ) );
|
||||||
header.print_fmt( "#pragma endregion Scanner\n\n" );
|
header.print_fmt( "#pragma endregion Scanner\n\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,15 +168,15 @@ int gen_main()
|
|||||||
|
|
||||||
if ( generate_gen_dep )
|
if ( generate_gen_dep )
|
||||||
{
|
{
|
||||||
Code impl_start = scan_file( project_dir "dependencies/src_start.cpp" );
|
Code impl_start = scan_file( project_dir "dependencies/src_start.cpp" );
|
||||||
Code debug = scan_file( project_dir "dependencies/debug.cpp" );
|
Code debug = scan_file( project_dir "dependencies/debug.cpp" );
|
||||||
Code string_ops = scan_file( project_dir "dependencies/string_ops.cpp" );
|
Code string_ops = scan_file( project_dir "dependencies/string_ops.cpp" );
|
||||||
Code printing = scan_file( project_dir "dependencies/printing.cpp" );
|
Code printing = scan_file( project_dir "dependencies/printing.cpp" );
|
||||||
Code memory = scan_file( project_dir "dependencies/memory.cpp" );
|
Code memory = scan_file( project_dir "dependencies/memory.cpp" );
|
||||||
Code hashing = scan_file( project_dir "dependencies/hashing.cpp" );
|
Code hashing = scan_file( project_dir "dependencies/hashing.cpp" );
|
||||||
Code string = scan_file( project_dir "dependencies/string.cpp" );
|
Code strings = scan_file( project_dir "dependencies/strings.cpp" );
|
||||||
Code file_handling = scan_file( project_dir "dependencies/file_handling.cpp" );
|
Code filesystem = scan_file( project_dir "dependencies/filesystem.cpp" );
|
||||||
Code timing = scan_file( project_dir "dependencies/timing.cpp" );
|
Code timing = scan_file( project_dir "dependencies/timing.cpp" );
|
||||||
|
|
||||||
header.print_fmt( roll_own_dependencies_guard_start );
|
header.print_fmt( roll_own_dependencies_guard_start );
|
||||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||||
@ -185,8 +187,8 @@ int gen_main()
|
|||||||
header.print( printing );
|
header.print( printing );
|
||||||
header.print( memory );
|
header.print( memory );
|
||||||
header.print( hashing );
|
header.print( hashing );
|
||||||
header.print( string );
|
header.print( strings );
|
||||||
header.print( file_handling );
|
header.print( filesystem );
|
||||||
header.print( timing );
|
header.print( timing );
|
||||||
|
|
||||||
if ( generate_scanner )
|
if ( generate_scanner )
|
||||||
@ -232,7 +234,7 @@ int gen_main()
|
|||||||
if ( generate_builder )
|
if ( generate_builder )
|
||||||
{
|
{
|
||||||
header.print_fmt( "#pragma region Builder\n\n" );
|
header.print_fmt( "#pragma region Builder\n\n" );
|
||||||
header.print( scan_file( project_dir "file_processors/builder.cpp" ) );
|
header.print( scan_file( project_dir "auxillary/builder.cpp" ) );
|
||||||
header.print_fmt( "#pragma endregion Builder\n\n" );
|
header.print_fmt( "#pragma endregion Builder\n\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +242,7 @@ int gen_main()
|
|||||||
if ( generate_scanner )
|
if ( generate_scanner )
|
||||||
{
|
{
|
||||||
header.print_fmt( "#pragma region Scanner\n\n" );
|
header.print_fmt( "#pragma region Scanner\n\n" );
|
||||||
header.print( scan_file( project_dir "file_processors/scanner.cpp" ) );
|
header.print( scan_file( project_dir "auxillary/scanner.cpp" ) );
|
||||||
header.print_fmt( "#pragma endregion Scanner\n\n" );
|
header.print_fmt( "#pragma endregion Scanner\n\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -2,8 +2,8 @@
|
|||||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#define GEN_BENCHMARK
|
#define GEN_BENCHMARK
|
||||||
#include "gen/gen.hpp"
|
#include "gen.hpp"
|
||||||
#include "gen/gen.builder.hpp"
|
#include "gen.builder.hpp"
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
|
||||||
Code gen_SOA( CodeStruct struct_def, s32 num_entries = 0 )
|
Code gen_SOA( CodeStruct struct_def, s32 num_entries = 0 )
|
||||||
@ -33,7 +33,7 @@ Code gen_SOA( CodeStruct struct_def, s32 num_entries = 0 )
|
|||||||
if ( struct_mem->Type == ECode::Variable )
|
if ( struct_mem->Type == ECode::Variable )
|
||||||
{
|
{
|
||||||
CodeType var_type = struct_mem.cast<CodeVar>()->ValueType;
|
CodeType var_type = struct_mem.cast<CodeVar>()->ValueType;
|
||||||
StrC num_entries_str = to_StrC( str_fmt_buf( "%d", num_entries ) );
|
StrC num_entries_str = to_str( str_fmt_buf( "%d", num_entries ) );
|
||||||
|
|
||||||
CodeVar entry_arr = { nullptr };
|
CodeVar entry_arr = { nullptr };
|
||||||
if ( ! num_entries)
|
if ( ! num_entries)
|
||||||
@ -124,7 +124,7 @@ void check_SOA()
|
|||||||
soa_test.print( parse_using( code(
|
soa_test.print( parse_using( code(
|
||||||
using u16 = unsigned short;
|
using u16 = unsigned short;
|
||||||
)));
|
)));
|
||||||
soa_test.print( def_include( txt_StrC("gen.hpp")));
|
soa_test.print( def_include( txt("gen.hpp")));
|
||||||
soa_test.print( def_using_namespace( name(gen) ) );
|
soa_test.print( def_using_namespace( name(gen) ) );
|
||||||
|
|
||||||
soa_test.print( gen_SOA(
|
soa_test.print( gen_SOA(
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
project( 'test', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
|
||||||
|
|
||||||
# add_global_arguments('-E', language : 'cpp')
|
|
||||||
|
|
||||||
includes = include_directories(
|
|
||||||
[
|
|
||||||
'../../project',
|
|
||||||
# '../../thirdparty'
|
|
||||||
])
|
|
||||||
|
|
||||||
# get_sources = files('./get_sources.ps1')
|
|
||||||
# sources = files(run_command('powershell', get_sources, check: true).stdout().strip().split('\n'))
|
|
||||||
|
|
||||||
sources = [ '../test.cpp' ]
|
|
||||||
|
|
||||||
if get_option('buildtype').startswith('debug')
|
|
||||||
|
|
||||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
|
||||||
# add_project_arguments('-E', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
endif
|
|
||||||
# add_project_arguments('-E', language : ['c', 'cpp'])
|
|
||||||
# add_global_arguments( '-E', language : ['cpp'])
|
|
||||||
|
|
||||||
add_project_arguments('-DGEN_TIME', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
executable( 'gencpp', sources, include_directories : includes )
|
|
@ -1,25 +0,0 @@
|
|||||||
project( 'test', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
|
||||||
|
|
||||||
# add_global_arguments('-E', language : 'cpp')
|
|
||||||
|
|
||||||
includes = include_directories(
|
|
||||||
[
|
|
||||||
'./gen',
|
|
||||||
'../project',
|
|
||||||
# '../thirdparty'
|
|
||||||
])
|
|
||||||
|
|
||||||
# get_sources = files('./get_sources.ps1')
|
|
||||||
# sources = files(run_command('powershell', get_sources, check: true).stdout().strip().split('\n'))
|
|
||||||
|
|
||||||
sources = [ 'test.cpp' ]
|
|
||||||
|
|
||||||
if get_option('buildtype').startswith('debug')
|
|
||||||
|
|
||||||
add_project_arguments('-DBuild_Debug', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
add_project_arguments('-Druntime', language : ['c', 'cpp'])
|
|
||||||
|
|
||||||
executable( 'testcpp', sources, include_directories : includes )
|
|
@ -255,7 +255,7 @@ u32 gen_array_file()
|
|||||||
gen_array_file;
|
gen_array_file;
|
||||||
gen_array_file.open( "array.Parsed.gen.hpp" );
|
gen_array_file.open( "array.Parsed.gen.hpp" );
|
||||||
|
|
||||||
Code include_gen = def_include( txt_StrC("gen.hpp") );
|
Code include_gen = def_include( txt("gen.hpp") );
|
||||||
gen_array_file.print( include_gen );
|
gen_array_file.print( include_gen );
|
||||||
|
|
||||||
gen_array_file.print( def_using_namespace( name(gen)));
|
gen_array_file.print( def_using_namespace( name(gen)));
|
||||||
|
@ -169,7 +169,7 @@ u32 gen_buffer_file()
|
|||||||
gen_buffer_file;
|
gen_buffer_file;
|
||||||
gen_buffer_file.open( "buffer.Parsed.gen.hpp" );
|
gen_buffer_file.open( "buffer.Parsed.gen.hpp" );
|
||||||
|
|
||||||
gen_buffer_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_buffer_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_buffer_file.print( def_using_namespace( name(gen)));
|
gen_buffer_file.print( def_using_namespace( name(gen)));
|
||||||
|
|
||||||
gen_buffer_file.print( gen__buffer_base() );
|
gen_buffer_file.print( gen__buffer_base() );
|
||||||
|
@ -320,9 +320,9 @@ u32 gen_hashtable_file()
|
|||||||
gen_hashtable_file;
|
gen_hashtable_file;
|
||||||
gen_hashtable_file.open( "hashtable.Parsed.gen.hpp" );
|
gen_hashtable_file.open( "hashtable.Parsed.gen.hpp" );
|
||||||
|
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_hashtable_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("Array.Parsed.hpp")) );
|
gen_hashtable_file.print( def_include( txt("Array.Parsed.hpp")) );
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("array.Parsed.gen.hpp")) );
|
gen_hashtable_file.print( def_include( txt("array.Parsed.gen.hpp")) );
|
||||||
|
|
||||||
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Code gen__ring( StrC type )
|
|||||||
name = get_cached_string({ name_len, name_str });
|
name = get_cached_string({ name_len, name_str });
|
||||||
};
|
};
|
||||||
|
|
||||||
StrC buffer_name = to_StrC( str_fmt_buf( "Buffer_%s", type.Ptr ));
|
StrC buffer_name = to_str( str_fmt_buf( "Buffer_%s", type.Ptr ));
|
||||||
|
|
||||||
Code ring = parse_struct( token_fmt( "RingName", (StrC)name, "type", type, "BufferName", buffer_name,
|
Code ring = parse_struct( token_fmt( "RingName", (StrC)name, "type", type, "BufferName", buffer_name,
|
||||||
stringize(
|
stringize(
|
||||||
@ -138,8 +138,8 @@ u32 gen_ring_file()
|
|||||||
gen_ring_file;
|
gen_ring_file;
|
||||||
gen_ring_file.open( "ring.Parsed.gen.hpp" );
|
gen_ring_file.open( "ring.Parsed.gen.hpp" );
|
||||||
|
|
||||||
gen_ring_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_ring_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_ring_file.print( def_include( txt_StrC("buffer.Parsed.gen.hpp")) );
|
gen_ring_file.print( def_include( txt("buffer.Parsed.gen.hpp")) );
|
||||||
// gen_ring_file.print( gen__ring_base() );
|
// gen_ring_file.print( gen__ring_base() );
|
||||||
|
|
||||||
gen_ring_file.print( def_using_namespace( name(gen)));
|
gen_ring_file.print( def_using_namespace( name(gen)));
|
||||||
|
@ -14,7 +14,7 @@ u32 gen_sanity()
|
|||||||
gen_sanity_file;
|
gen_sanity_file;
|
||||||
gen_sanity_file.open("./sanity.Parsed.gen.hpp");
|
gen_sanity_file.open("./sanity.Parsed.gen.hpp");
|
||||||
|
|
||||||
gen_sanity_file.print( def_comment( txt_StrC(
|
gen_sanity_file.print( def_comment( txt(
|
||||||
"The following will show a series of base cases for the gen parsed api.\n"
|
"The following will show a series of base cases for the gen parsed api.\n"
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ u32 gen_sanity()
|
|||||||
{};
|
{};
|
||||||
));
|
));
|
||||||
|
|
||||||
empty_body->Body.append( def_comment( txt_StrC("Empty class body") ) );
|
empty_body->Body.append( def_comment( txt("Empty class body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print(fwd);
|
gen_sanity_file.print(fwd);
|
||||||
gen_sanity_file.print(empty_body);
|
gen_sanity_file.print(empty_body);
|
||||||
@ -76,7 +76,7 @@ u32 gen_sanity()
|
|||||||
|
|
||||||
// External Linkage
|
// External Linkage
|
||||||
{
|
{
|
||||||
CodeComment empty_comment = def_comment( txt_StrC("Empty external linkage") );
|
CodeComment empty_comment = def_comment( txt("Empty external linkage") );
|
||||||
|
|
||||||
CodeExtern c_extern = parse_extern_link( code(
|
CodeExtern c_extern = parse_extern_link( code(
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -122,7 +122,7 @@ u32 gen_sanity()
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
def->Body.append( def_comment( txt_StrC("Empty function body") ) );
|
def->Body.append( def_comment( txt("Empty function body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print(fwd);
|
gen_sanity_file.print(fwd);
|
||||||
gen_sanity_file.print(def);
|
gen_sanity_file.print(def);
|
||||||
@ -138,7 +138,7 @@ u32 gen_sanity()
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
def->Body.append( def_comment( txt_StrC("Empty namespace body") ) );
|
def->Body.append( def_comment( txt("Empty namespace body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print(def);
|
gen_sanity_file.print(def);
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ u32 gen_sanity()
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
def->Body.append( def_comment( txt_StrC("Empty function body") ) );
|
def->Body.append( def_comment( txt("Empty function body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print(fwd);
|
gen_sanity_file.print(fwd);
|
||||||
gen_sanity_file.print(def);
|
gen_sanity_file.print(def);
|
||||||
@ -241,7 +241,7 @@ u32 gen_sanity()
|
|||||||
{};
|
{};
|
||||||
));
|
));
|
||||||
|
|
||||||
empty_body->Body.append( def_comment( txt_StrC("Empty struct body") ) );
|
empty_body->Body.append( def_comment( txt("Empty struct body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print(fwd);
|
gen_sanity_file.print(fwd);
|
||||||
gen_sanity_file.print(empty_body);
|
gen_sanity_file.print(empty_body);
|
||||||
@ -257,7 +257,7 @@ u32 gen_sanity()
|
|||||||
};
|
};
|
||||||
));
|
));
|
||||||
|
|
||||||
empty->Body.append( def_comment( txt_StrC("Empty union body") ) );
|
empty->Body.append( def_comment( txt("Empty union body") ) );
|
||||||
|
|
||||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned short u16; )) );
|
gen_sanity_file.print( parse_typedef( code( typedef unsigned short u16; )) );
|
||||||
gen_sanity_file.print( parse_typedef( code( typedef unsigned long u32; )) );
|
gen_sanity_file.print( parse_typedef( code( typedef unsigned long u32; )) );
|
||||||
@ -334,7 +334,7 @@ u32 gen_sanity()
|
|||||||
|
|
||||||
gen_sanity_file.print_fmt("\n");
|
gen_sanity_file.print_fmt("\n");
|
||||||
|
|
||||||
gen_sanity_file.print( def_comment( txt_StrC(
|
gen_sanity_file.print( def_comment( txt(
|
||||||
"End of base case tests\n"
|
"End of base case tests\n"
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ int gen_main()
|
|||||||
using u16 = unsigned short;
|
using u16 = unsigned short;
|
||||||
)));
|
)));
|
||||||
|
|
||||||
soa_test.print( def_include( txt_StrC("gen.hpp")));
|
soa_test.print( def_include( txt("gen.hpp")));
|
||||||
|
|
||||||
soa_test.print( def_using_namespace( name(gen) ) );
|
soa_test.print( def_using_namespace( name(gen) ) );
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#define GEN_BENCHMARK
|
#define GEN_BENCHMARK
|
||||||
#include "gen/gen.hpp"
|
#include "gen.hpp"
|
||||||
#include "gen/gen.builder.hpp"
|
#include "gen.builder.hpp"
|
||||||
|
|
||||||
void check_sanity()
|
void check_sanity()
|
||||||
{
|
{
|
||||||
@ -17,7 +17,7 @@ void check_sanity()
|
|||||||
CodeType t_int_dupe = def_type( name(int) );
|
CodeType t_int_dupe = def_type( name(int) );
|
||||||
|
|
||||||
if ( t_int_dupe->Name != t_int->Name )
|
if ( t_int_dupe->Name != t_int->Name )
|
||||||
fatal("check_sanity: String caching failed!");
|
GEN_FATAL("check_sanity: String caching failed!");
|
||||||
|
|
||||||
|
|
||||||
// Purposefully uses an excessive amount of memory to make sure the the memory backend doesn't break.
|
// Purposefully uses an excessive amount of memory to make sure the the memory backend doesn't break.
|
||||||
@ -63,8 +63,7 @@ void check_sanity()
|
|||||||
log_fmt("Num String Cache Arenas : %llu TotalSize: %llu !\n", StringArenas.num(), StringArenas.num() * SizePer_StringArena);
|
log_fmt("Num String Cache Arenas : %llu TotalSize: %llu !\n", StringArenas.num(), StringArenas.num() * SizePer_StringArena);
|
||||||
log_fmt("Num String Cache : %llu\n", StringCache.Entries.num(), StringCache);
|
log_fmt("Num String Cache : %llu\n", StringCache.Entries.num(), StringCache);
|
||||||
|
|
||||||
Builder builder;
|
Builder builder = Builder::open( "./gen/sanity.gen.hpp" );
|
||||||
builder.open( "sanity.gen.hpp" );
|
|
||||||
|
|
||||||
idx = typedefs.num();
|
idx = typedefs.num();
|
||||||
#ifdef GEN_BENCHMARK
|
#ifdef GEN_BENCHMARK
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
|
#if GEN_TIME
|
||||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#define GEN_BENCHMARK
|
#define GEN_BENCHMARK
|
||||||
#include "gen/gen.cpp"
|
#include "gen.cpp"
|
||||||
#include "gen/gen.builder.cpp"
|
#include "gen.builder.cpp"
|
||||||
#include "sanity.cpp"
|
#include "sanity.cpp"
|
||||||
#include "SOA.cpp"
|
#include "SOA.cpp"
|
||||||
#include "test.singleheader_ast.cpp"
|
#include "test.singleheader_ast.cpp"
|
||||||
|
|
||||||
#if GEN_TIME
|
|
||||||
int gen_main()
|
int gen_main()
|
||||||
{
|
{
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||||
#define GEN_EXPOSE_BACKEND
|
#define GEN_EXPOSE_BACKEND
|
||||||
#define GEN_BENCHMARK
|
#define GEN_BENCHMARK
|
||||||
#include "gen/gen.hpp"
|
#include "gen.hpp"
|
||||||
#include "gen/gen.builder.hpp"
|
#include "gen.builder.hpp"
|
||||||
#include "gen/gen.scanner.hpp"
|
#include "gen.scanner.hpp"
|
||||||
using namespace gen;
|
using namespace gen;
|
||||||
|
|
||||||
void check_singleheader_ast()
|
void check_singleheader_ast()
|
||||||
{
|
{
|
||||||
#define project_dir "../../"
|
#define project_dir "../"
|
||||||
gen::init();
|
gen::init();
|
||||||
log_fmt("\ncheck_singleheader_ast:\n");
|
log_fmt("\ncheck_singleheader_ast:\n");
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ void check_singleheader_ast()
|
|||||||
time_start = time_rel_ms();
|
time_start = time_rel_ms();
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
builder = Builder::open( "singleheader_copy.gen.hpp" );
|
builder = Builder::open( "gen/singleheader_copy.gen.hpp" );
|
||||||
builder.print( ast );
|
builder.print( ast );
|
||||||
builder.write();
|
builder.write();
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ u32 gen_array_file()
|
|||||||
gen_array_file;
|
gen_array_file;
|
||||||
gen_array_file.open( "array.Upfront.gen.hpp" );
|
gen_array_file.open( "array.Upfront.gen.hpp" );
|
||||||
|
|
||||||
CodeInclude include_gen = def_include( txt_StrC("gen.hpp") );
|
CodeInclude include_gen = def_include( txt("gen.hpp") );
|
||||||
gen_array_file.print( include_gen );
|
gen_array_file.print( include_gen );
|
||||||
|
|
||||||
gen_array_file.print( def_using_namespace( name(gen)));
|
gen_array_file.print( def_using_namespace( name(gen)));
|
||||||
|
@ -239,7 +239,7 @@ u32 gen_buffer_file()
|
|||||||
gen_buffer_file;
|
gen_buffer_file;
|
||||||
gen_buffer_file.open( "buffer.Upfront.gen.hpp" );
|
gen_buffer_file.open( "buffer.Upfront.gen.hpp" );
|
||||||
|
|
||||||
gen_buffer_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_buffer_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_buffer_file.print( def_using_namespace( name(gen)) );
|
gen_buffer_file.print( def_using_namespace( name(gen)) );
|
||||||
|
|
||||||
gen_buffer_file.print( gen__buffer_base() );
|
gen_buffer_file.print( gen__buffer_base() );
|
||||||
|
@ -447,9 +447,9 @@ u32 gen_hashtable_file()
|
|||||||
gen_hashtable_file;
|
gen_hashtable_file;
|
||||||
gen_hashtable_file.open( "hashtable.Upfront.gen.hpp" );
|
gen_hashtable_file.open( "hashtable.Upfront.gen.hpp" );
|
||||||
|
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_hashtable_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("Array.Upfront.hpp")) );
|
gen_hashtable_file.print( def_include( txt("Array.Upfront.hpp")) );
|
||||||
gen_hashtable_file.print( def_include( txt_StrC("array.Upfront.gen.hpp")) );
|
gen_hashtable_file.print( def_include( txt("array.Upfront.gen.hpp")) );
|
||||||
|
|
||||||
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
gen_hashtable_file.print( def_using_namespace( name(gen)));
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ u32 gen_ring_file()
|
|||||||
gen_ring_file;
|
gen_ring_file;
|
||||||
gen_ring_file.open( "ring.Upfront.gen.hpp" );
|
gen_ring_file.open( "ring.Upfront.gen.hpp" );
|
||||||
|
|
||||||
gen_ring_file.print( def_include( txt_StrC("gen.hpp")) );
|
gen_ring_file.print( def_include( txt("gen.hpp")) );
|
||||||
gen_ring_file.print( def_include( txt_StrC("buffer.Upfront.gen.hpp")) );
|
gen_ring_file.print( def_include( txt("buffer.Upfront.gen.hpp")) );
|
||||||
|
|
||||||
gen_ring_file.print( def_using_namespace( name(gen)));
|
gen_ring_file.print( def_using_namespace( name(gen)));
|
||||||
|
|
||||||
|
@ -11,13 +11,13 @@ u32 gen_sanity_upfront()
|
|||||||
|
|
||||||
// Comment
|
// Comment
|
||||||
{
|
{
|
||||||
CodeComment comment_test = def_comment( txt_StrC("Sanity check: def_comment test") );
|
CodeComment comment_test = def_comment( txt("Sanity check: def_comment test") );
|
||||||
|
|
||||||
gen_sanity_file.print(comment_test);
|
gen_sanity_file.print(comment_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_sanity_file.print_fmt("\n");
|
gen_sanity_file.print_fmt("\n");
|
||||||
gen_sanity_file.print( def_comment( txt_StrC(
|
gen_sanity_file.print( def_comment( txt(
|
||||||
"The following will show a series of base cases for the gen api.\n"
|
"The following will show a series of base cases for the gen api.\n"
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ u32 gen_sanity_upfront()
|
|||||||
CodeClass fwd = def_class( name(TestEmptyClass) );
|
CodeClass fwd = def_class( name(TestEmptyClass) );
|
||||||
CodeClass empty_body;
|
CodeClass empty_body;
|
||||||
{
|
{
|
||||||
CodeComment cmt = def_comment( txt_StrC("Empty class body") );
|
CodeComment cmt = def_comment( txt("Empty class body") );
|
||||||
CodeBody body = def_class_body( args( cmt ) );
|
CodeBody body = def_class_body( args( cmt ) );
|
||||||
|
|
||||||
empty_body = def_class( name(TestEmptyClass), body );
|
empty_body = def_class( name(TestEmptyClass), body );
|
||||||
@ -74,7 +74,7 @@ u32 gen_sanity_upfront()
|
|||||||
// External Linkage
|
// External Linkage
|
||||||
{
|
{
|
||||||
CodeBody body = def_extern_link_body( 1
|
CodeBody body = def_extern_link_body( 1
|
||||||
, def_comment( txt_StrC("Empty extern body") )
|
, def_comment( txt("Empty extern body") )
|
||||||
);
|
);
|
||||||
|
|
||||||
CodeExtern c_extern = def_extern_link( name(C), body );
|
CodeExtern c_extern = def_extern_link( name(C), body );
|
||||||
@ -100,7 +100,7 @@ u32 gen_sanity_upfront()
|
|||||||
CodeFn def;
|
CodeFn def;
|
||||||
{
|
{
|
||||||
CodeBody body = def_function_body( 1
|
CodeBody body = def_function_body( 1
|
||||||
, def_comment( txt_StrC("Empty function body") )
|
, def_comment( txt("Empty function body") )
|
||||||
);
|
);
|
||||||
|
|
||||||
def = def_function( name(test_function), __, __, body );
|
def = def_function( name(test_function), __, __, body );
|
||||||
@ -114,7 +114,7 @@ u32 gen_sanity_upfront()
|
|||||||
|
|
||||||
// Include
|
// Include
|
||||||
{
|
{
|
||||||
CodeInclude include = def_include( txt_StrC("../DummyInclude.hpp") );
|
CodeInclude include = def_include( txt("../DummyInclude.hpp") );
|
||||||
|
|
||||||
gen_sanity_file.print(include);
|
gen_sanity_file.print(include);
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ u32 gen_sanity_upfront()
|
|||||||
CodeNS namespace_def;
|
CodeNS namespace_def;
|
||||||
{
|
{
|
||||||
CodeBody body = def_namespace_body( 1
|
CodeBody body = def_namespace_body( 1
|
||||||
, def_comment( txt_StrC("Empty namespace body") )
|
, def_comment( txt("Empty namespace body") )
|
||||||
);
|
);
|
||||||
|
|
||||||
namespace_def = def_namespace( name(TestNamespace), body );
|
namespace_def = def_namespace( name(TestNamespace), body );
|
||||||
@ -213,7 +213,7 @@ u32 gen_sanity_upfront()
|
|||||||
CodeFn def, def2;
|
CodeFn def, def2;
|
||||||
{
|
{
|
||||||
CodeBody body = def_function_body( 1
|
CodeBody body = def_function_body( 1
|
||||||
, def_comment( txt_StrC("Empty function body") )
|
, def_comment( txt("Empty function body") )
|
||||||
);
|
);
|
||||||
|
|
||||||
CodeParam params = def_params( args(
|
CodeParam params = def_params( args(
|
||||||
@ -259,7 +259,7 @@ u32 gen_sanity_upfront()
|
|||||||
CodeClass fwd = def_class( name(TestEmptyStruct) );
|
CodeClass fwd = def_class( name(TestEmptyStruct) );
|
||||||
CodeClass empty_body;
|
CodeClass empty_body;
|
||||||
{
|
{
|
||||||
CodeComment cmt = def_comment( txt_StrC("Empty struct body") );
|
CodeComment cmt = def_comment( txt("Empty struct body") );
|
||||||
CodeBody body = def_class_body( args( cmt ) );
|
CodeBody body = def_class_body( args( cmt ) );
|
||||||
|
|
||||||
empty_body = def_class( name(TestEmptyStruct), body );
|
empty_body = def_class( name(TestEmptyStruct), body );
|
||||||
@ -274,7 +274,7 @@ u32 gen_sanity_upfront()
|
|||||||
// Union
|
// Union
|
||||||
{
|
{
|
||||||
CodeBody body = def_union_body( 1
|
CodeBody body = def_union_body( 1
|
||||||
, def_comment( txt_StrC("Empty union body") )
|
, def_comment( txt("Empty union body") )
|
||||||
);
|
);
|
||||||
|
|
||||||
CodeUnion def = def_union( name(TestEmptyUnion), body );
|
CodeUnion def = def_union( name(TestEmptyUnion), body );
|
||||||
@ -312,7 +312,7 @@ u32 gen_sanity_upfront()
|
|||||||
|
|
||||||
CodeTemplate tmpl = def_template( def_param( t_class, name(Type) )
|
CodeTemplate tmpl = def_template( def_param( t_class, name(Type) )
|
||||||
, def_function( name(test_template), def_param( t_Type, name(a) ), __
|
, def_function( name(test_template), def_param( t_Type, name(a) ), __
|
||||||
, def_function_body(1, def_comment( txt_StrC("Empty template function body")))
|
, def_function_body(1, def_comment( txt("Empty template function body")))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ u32 gen_sanity_upfront()
|
|||||||
|
|
||||||
gen_sanity_file.print_fmt("\n");
|
gen_sanity_file.print_fmt("\n");
|
||||||
|
|
||||||
gen_sanity_file.print( def_comment( txt_StrC(
|
gen_sanity_file.print( def_comment( txt(
|
||||||
"End of base case tests.\n"
|
"End of base case tests.\n"
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user