These last weeks we’ve been working on the integration of the Data Schema and the Embeds (two of the more intricate connections needed for the new AppGen.Net)
Here’s a screenshot of the Embeds interface (in this screenshot we are using a textbox dialog not the full Source editor)
The concept of “embeds” is uniquely Clarion, and I don’t know any code generation system that has copied this functionality, and of course the idea of “embed” functionality is not part of any T4 implementation. Implementing “embeds” allows us to deliver true two-way extensibility.
The embeds can be used in two ways; an extension template can inject code into the target source file, or a user can write their own code into an embed point. Either way it becomes a part of the final output from the code generation process.
An extension template can extend the functionality of a Procedure or Application template by adding code to in an embed created in the Parent template. With embeds Clarion can extend the generated code from the bottom to top, instead of the top to bottom hierarchy used with OOP derivation. The extension template doesn’t need to know anything about the code generated by its parent in order to insert its own code into the process, all it needs is the embed name and its priority of execution. The embed points, as in the Win32 template system supports a name that is unique to the active scope, and displays text that supports display within a tree structure, and a description to be used as quick context help (as a tool tip). Also, as with its Win32 counterpart, it supports the concept of “hidden” embeds that create an embed point that can only by used by an extension template, and isn’t visible to the end user. An embed also supports a condition that is evaluated at code generation time to allow conditional embeded code generation. The embed points support the use of a priority, and in the case of template generated code a description.
Declaring an embed in the templates is very simple:
<#% EmbedName tree=”Display Name|other level|other level” description=”some short text” hidden=”True” condition=”expression” #>
for the AtEmbed directive the syntax is:
<#%+ EmbedName condition=”expression” priority = “5000” Description=”text”#>
between the beginning (<#%+ #>) and end (<#%-#>) of the AtEmbed, both both static code and dynamic code can be inserted.
Here’s a screenshot showing the Data Schema pad.
The dictionary is the heart of a Clarion Application, and for that reason we needed a way to interact with the Data Schema, so of course we chose to suport the same UI as we have for Win32 applications; the Data Schema Pad. And the same as in our Win32 template system the templates have access to the the data defined in the Schema to be used at the Application or Procedure level using properties of the templates.