-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from fktn-k/feature/226_add_natvis_file
Feature/226 add natvis file
- Loading branch information
Showing
10 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
build* | ||
.vscode/ | ||
.vs/ | ||
/build* | ||
/.vscode/ | ||
/.vs/ | ||
|
||
# documentation | ||
/docs/mkdocs/site/ | ||
/docs/mkdocs/venv/ | ||
/docs/mkdocs/venv/ | ||
|
||
# natvis generator | ||
/tool/natvis_generator/venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- This is a auto-generated file. --> | ||
<!-- Edit ./tools/natvis_generator/fkYAML.natvis.j2 --> | ||
|
||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<!-- Namespace fkyaml::v0_2_2 --> | ||
<Type Name="fkyaml::v0_2_2::basic_node<*>"> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::SEQUENCE">{*(m_node_value.p_sequence)}</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::MAPPING">{*(m_node_value.p_mapping)}</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::NULL_OBJECT">nullptr</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::BOOLEAN">{m_node_value.boolean}</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::INTEGER">{m_node_value.integer}</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::FLOAT_NUMBER">{m_node_value.float_val}</DisplayString> | ||
<DisplayString Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::STRING">{*(m_node_value.p_string)}</DisplayString> | ||
<Expand> | ||
<ExpandedItem Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::SEQUENCE"> | ||
*(m_node_value.p_sequence),view(simple) | ||
</ExpandedItem> | ||
<ExpandedItem Condition="m_node_type == fkyaml::v0_2_2::detail::node_t::MAPPING"> | ||
*(m_node_value.p_mapping),view(simple) | ||
</ExpandedItem> | ||
</Expand> | ||
</Type> | ||
|
||
<Type Name="std::pair<*, fkyaml::v0_2_2::basic_node<*>>" IncludeView="MapHelper"> | ||
<DisplayString>{second}</DisplayString> | ||
<Expand> | ||
<ExpandedItem>second</ExpandedItem> | ||
</Expand> | ||
</Type> | ||
</AutoVisualizer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
install-venv: | ||
python3 -m venv venv | ||
venv/bin/pip install --upgrade pip | ||
venv/bin/pip install -r requirements.txt | ||
|
||
uninstall-venv: | ||
rm -rf venv | ||
|
||
generate: install-venv | ||
venv/bin/python3 ./natvis_generator.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# natvis_generator.py | ||
|
||
Generate the Natvis debugger visualization file for fkYAML library with fully qualified namespaces which is specified in the params.json file. | ||
To modify the output natvis file, | ||
|
||
## Usage | ||
|
||
Update "version" value and run the following command. | ||
|
||
```bash | ||
./natvis_generator.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- This is a auto-generated file. --> | ||
<!-- Edit ./tools/natvis_generator/fkYAML.natvis.j2 --> | ||
|
||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<!-- Namespace {{ namespace }} --> | ||
<Type Name="{{ namespace }}::basic_node<*>"> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::SEQUENCE">{*(m_node_value.p_sequence)}</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::MAPPING">{*(m_node_value.p_mapping)}</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::NULL_OBJECT">nullptr</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::BOOLEAN">{m_node_value.boolean}</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::INTEGER">{m_node_value.integer}</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::FLOAT_NUMBER">{m_node_value.float_val}</DisplayString> | ||
<DisplayString Condition="m_node_type == {{ namespace }}::detail::node_t::STRING">{*(m_node_value.p_string)}</DisplayString> | ||
<Expand> | ||
<ExpandedItem Condition="m_node_type == {{ namespace }}::detail::node_t::SEQUENCE"> | ||
*(m_node_value.p_sequence),view(simple) | ||
</ExpandedItem> | ||
<ExpandedItem Condition="m_node_type == {{ namespace }}::detail::node_t::MAPPING"> | ||
*(m_node_value.p_mapping),view(simple) | ||
</ExpandedItem> | ||
</Expand> | ||
</Type> | ||
|
||
<Type Name="std::pair<*, {{ namespace }}::basic_node<*>>" IncludeView="MapHelper"> | ||
<DisplayString>{second}</DisplayString> | ||
<Expand> | ||
<ExpandedItem>second</ExpandedItem> | ||
</Expand> | ||
</Type> | ||
</AutoVisualizer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
import jinja2 | ||
import re | ||
import sys | ||
|
||
def check_version_format(ver): | ||
if not re.fullmatch(r'\d+\.\d+\.\d+', ver): | ||
raise ValueError('Invalid semantic version specified. ver=' + ver) | ||
return ver | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
with open('params.json') as j: | ||
params= json.load(j) | ||
|
||
semver = check_version_format(params['version']) | ||
abi_ns = 'v' + semver.replace('.', '_') | ||
namespace = 'fkyaml::' + abi_ns | ||
|
||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath=sys.path[0]), | ||
autoescape=True, | ||
trim_blocks=True, | ||
lstrip_blocks=True, | ||
keep_trailing_newline=True) | ||
template = environment.get_template('fkYAML.natvis.j2') | ||
|
||
natvis = template.render(namespace=namespace) | ||
|
||
with open('../../fkYAML.natvis', 'w') as f: | ||
f.write(natvis) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "version": "0.2.2" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Jinja2==3.1.2. |