13.7.2. Creating templates

You can create your own templates, or modify an existing template, in an editor and then save the newly-created file. When saving your own templates you must use the .tpl extension.

A template takes the format:

”templatename” TEMPLATE [-above|-below|-indent|-selection]
            [-auto=<phrase>] [filename]
.
.
.
“templatename” END

where:

-templatename

Specifies the template name.

-above

Use this to insert the template on the line above the current cursor.

-below

Use this to insert the template on the line below the current cursor.

-indent

Templates are indented to match the previous line.

-selection

Indicates that the template contains variables that are replaced on insertion into the source code. Valid variables are:

$selection

The currently selected text.

$paste

The current paste buffer.

$filename

The current filename, without the path, in lowercase.

$FILENAME

The current filename, without the path, in uppercase.

$directory

The path without the filename.

-auto=<phrase>

Specifies the auto insertion phrase. The phrase is a name associated with a defined template. When a template has an auto insertion phrase, there are three actions available after typing in the phrase:

Ctrl+Shift+3

Insert the template at the cursor position.

Ctrl+3

View the definition of the template specified by phrase.

Alt+3

Invoke the Insert Template dialog.

filename

Specifies the file containing text to define the template. Where no file is given, the lines following the template definition header are used until the line “templatename” END is reached.

Within the template, you can place a ^L (ASCII 12) character after a comment section. The lines immediately preceding the ^L are not inserted. These lines are used for data definitions.

You can also nest templates within templates using the syntax:

“filename” INCLUDE

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B
Non-Confidential