cgv
|
ppp was originally developed to extend the functionallity of the C++ preprocessor. This was done by embedding special commands inside a preheader file with extension *.ph and then transforming the preheader to a real header file interpreting the special commands. ppp (speek tripel-p) has its name from the three 'p's in the word pre-preprocessor.
The embedding of special commands inside a text document proved useful for other applications too and in this way ppp was also used to transform template files based on previously collected information into target files. This template transformation process is applied for
If possible it would be best to avoid custom build tools whereever possible. ppp has been implemented to develop repetitive code needed in template programming, where looping is necessary. The C++ pre-processor can be used for this purpose also but the resulting code is incomprehensible, it does not work together with debuggers and documentation tools like doxygen do neither work.
The source code of ppp is located in "$(CGV_DIR)/tool/ppp"
. A precompiled executable is provided for windows and located in "$(CGV_DIR)/bin/ppp.exe"
. ppp can be invoked in two ways:
Used extensions for ppp input files:
".ph"
... for pre-header files that are used to generate code".ppp"
... files that are used solely to configure ppp. The standard ppp configuration file is located in "<cgv/config/ppp.ppp>"
.".hh"
... header files of classes that uses the automatic type reflection mechanism".pj"
... project files used for make file generation".tm"
... template filesFor the visual studio development environment, custom build rules are defined for ".ph", ".hh" and ".pj" files. The custom rule files are located in the folder "$(CGV_DIR)/make/vs"
.
A simple example of the usage of ppp is given in the header abst_signal.ph which is located in the namespace cgv::base. It contains a templated class signature representing an arbitrary signature of a functor.
cgv/base/abst_signal.ph
:
All ppp commands are preceeded by a -symbol. This example includes three ppp commands:
@exclude-command
includes the proceeding files but does not add a corresponding include directive in the target file (what is done by the @include-command
). The included file ppp.ppp defines several global ppp-variables, one of them is N_ARG
.@
[...] repeats a string, i.e. "typename T1"
, into a list separated for example by ", ". In each entry numbers in the string are incremented.@
(...) simply writes the value of a ppp internal variable to the target file.@for-commands
iterate everything within the ppp-block markers and