stepan-mitkin/drakon_editor

templates with DRAKON

ACJA opened this issue · 0 comments

ACJA commented

The best use of DRAKON editor for template function and classes is to "encapsulate" the whole template declaration and implementation of a function or class in a DRAKON project. This way one can freely use the DRAKON file in any other project, in any combination with other DRAKON files.
It is possible to place the content of the declaration code in the === h_header === section of the "file description" of a new template DRAKON project, and the content of the implementation in the === h_footer === section. Nothing needs to be placed in the === c_header === or the === c_footer === sections. This will encapsulate the whole template declaration and definition in a clean DRAKON project that can be used freely in any other place.
...
I tried to look into implementing real diagrams for template functions and classes. The "inline" keyword that DRAKON provides is otherwise very useful for implementing template functions. I could use a lookout tag "#template<" in order to send the result to a BASH script to make syntax corrections for correcting the result. This approach works well with simple template functions. It is getting much more complicated with multiple template levels inside template functions, or with template classes. My last hope is Stepan to look into this issue and implement template support for DRAKON diagrams.
...
Attached is an example with a template function and a template class. Just extract the project and run the "run.prj" script inside the DRAKON directory.
19.00-Template_function.tar.gz
19.02-Template_class_array_example.tar.gz