From RTSC-Pedia
revision tip
LANDSCAPE orientation![]() | [printable version] [offline version] | offline version generated on 11-Jun-2009 18:06 UTC | ![]() |
XDCscript - Template-Body
Contents of the template file
Contents |
Description
The body of a template contains lines of text that are automatically output when the template object is expanded via genStream() or genFile(). It also contains lines of script that are evaluated prior to generating output. This script code can reference any object in the current environment — with $out, this, and $args bound to parameters of genStream().
Syntax
- text`script`text ... \n
- A line of text to be output by the template at this point. All script between the `` quotes is replaced with its (textual) value in the current context.
- % script ...\n
- A single line of script evaluated by the template at this point.
- %%{\n
- stmt ...\n
- stmt ...\n
- %%}\n
- Multiple lines of script to be evaluated at this point.
Example
The following script and template illustrate many of the capabilities of templates. This example generates a copyright header from a template.
|
|
Running this script produces the following output.
xs -f gen.xs bob carol ted alice | |
| /* Copyright 2008 by TI. * All rights reserved. Property of TI. * Contributions from: * bob * carol * ted * alice */ |
See also
XDCscript - Template-Object | under construction |
XDCscript - Template-Object.genFile | Generate textual output file from a template |
XDCscript - Template-Object.genStream | Generate textual output stream from a template |
![]() | [printable version] [offline version] | offline version generated on 11-Jun-2009 18:06 UTC | ![]() |
Copyright © 2008 The Eclipse Foundation. All Rights Reserved