fileio/
mgfftemplate__define.pro
Allows substitution into a text file specified template by data held in structures or objects.
Class description for mgfffortemplate
Fields
- name ''
name of the FOREACH loop index variable.
- value ptr_new()
pointer to the value of the FOREACH loop index variable.
Class description for mgffcompoundtemplate
Fields
- template1 obj_new()
a subobject implementing the getVariable method
- template2 ptr_new()
a subobject implementing the getVariable method
Class description for mgfftemplate
Properties
- spaces init
Fields
- tokenizer obj_new()
MGffTokenizer used to break a template into tokens
- SPACES ''
- templateFilename ''
filename of the template file
Author information
- Author
Michael Galloy
Routines
result = mgfffortemplate::getVariable(name [, /found])Implements the getVariable method.
mgfffortemplate::setVariable, valueSets the FOREACH loop index variable.
mgfffortemplate::cleanupFree resources.
result = mgfffortemplate::init(name, value)Initialize the instance variables.
mgfffortemplate__defineDefine instance variables.
result = mgffcompoundtemplate::getVariable(name [, /found])Implements the getVariable method.
mgffcompoundtemplate::cleanupFree resources.
result = mgffcompoundtemplate::init(template1, template2)Initialize instance variables.
mgffcompoundtemplate__defineDefine instance variables.
mgfftemplate::_printf, lun, data [, _extra=keywords]Wrapper for PRINTF that recognizes LUN=-3 as /dev/null.
mgfftemplate::_process_if, mgfftemplate$variables, mgfftemplate$output_lunProcess an [% IF %] directive.
mgfftemplate::_process_foreach, variables, output_lunProcess a [% FOREACH %] directive.
mgfftemplate::_process_include, variables, output_lun [, spaces=integer]Process an [% INCLUDE filename %] directive.
mgfftemplate::_process_include_template, variables, output_lun [, spaces=integer]Process a [% INCLUDE_TEMPLATE filename %] directive.
mgfftemplate::_process_insert, output_lun [, spaces=integer]Process an [% INSERT filename %] directive.
mgfftemplate::_process_scope, variables, output_lunProcess a [% SCOPE ovariables %] directive.
result = mgfftemplate::_getVariable(variables, name [, /found])Finds a given variable name in a structure of variables or calls getVariable if variables is an object.
mgfftemplate::_process_variable, mgfftemplate$expression, mgfftemplate$variables, mgfftemplate$output_lun [, post_delim=string] [, value=any] [, /found]Process an [% expression %] directive.
mgfftemplate::_process_tokens, variables, output_lun [, /else_clause]Process directives or plain text.
mgfftemplate::process, variables [, output_filename] [, lun=long]Process the template with the given variables and send output to the given filename.
mgfftemplate::resetReset the template to run again from the start of the template.
mgfftemplate::cleanupFrees resources.
result = mgfftemplate::init(template_filename [, spaces=integer])Create a template class for a given template.
mgfftemplate__defineDefine instance variables.
Routine details
topmgfffortemplate::getVariableprivate
result = mgfffortemplate::getVariable(name [, /found])
Implements the getVariable method. This routine returns a value of a variable given the variable's name as a string. The only variable this object should contain is the FOREACH loop index variable.
Return value
any type
Parameters
- name in required type=string
name of the variable
Keywords
- found out optional type=boolean
true if the variable was found
topmgfffortemplate::setVariableprivate
mgfffortemplate::setVariable, value
Sets the FOREACH loop index variable.
Parameters
- value in required type=any
new value of the FOREACH loop index variable
topmgfffortemplate::initprivate
result = mgfffortemplate::init(name, value)
Initialize the instance variables.
Return value
1 for success, 0 for failure
Parameters
- name in required type=string
name of the FOREACH loop index variable
- value in required type=any
initial value for the FOREACH loop index variable
topmgfffortemplate__defineprivate
mgfffortemplate__define
Define instance variables. This class is used internally by the MGffTemplate class to handle the variable associated with a FOREACH loop.
topmgffcompoundtemplate::getVariableprivate
result = mgffcompoundtemplate::getVariable(name [, /found])
Implements the getVariable method. This routine returns a value of a variable given the variable's name as a string. This routine checks its subobjects for the variable.
Return value
any type
Parameters
- name in required type=string
name of the variable
Keywords
- found out optional type=boolean
true if the variable was found
topmgffcompoundtemplate::initprivate
result = mgffcompoundtemplate::init(template1, template2)
Initialize instance variables.
Return value
1L
Parameters
- template1 in required type=object
an object which implements the getVariable method
- template2 in required type=object
an object which implements the getVariable method or a structure
topmgffcompoundtemplate__defineprivate
mgffcompoundtemplate__define
Define instance variables. This class is used internally by the MGffTemplate class to handle the variables associated with a SCOPE directive.
topmgfftemplate::_printfprivate
mgfftemplate::_printf, lun, data [, _extra=keywords]
Wrapper for PRINTF that recognizes LUN=-3 as /dev/null.
Parameters
- lun in required type=LUN
logical unit number to direct output to, -3 means /dev/null
- data in required type=any
data to print
Keywords
- _extra in optional type=keywords
keywords to PRINTF
topmgfftemplate::_process_ifprivate
mgfftemplate::_process_if, mgfftemplate$variables, mgfftemplate$output_lun
Process an [% IF %] directive. Note: this routine uses SCOPE_VARFETCH to pull variables from the template into the local scope of this routine. Therefore all the local variables have a prefix of "mgfftemplate$" to avoid name clashes.
Parameters
- mgfftemplate$variables in required type=structure
anonymous structure of variables
- mgfftemplate$output_lun in required type=LUN
logical unit number of output file
topmgfftemplate::_process_foreachprivate
mgfftemplate::_process_foreach, variables, output_lun
Process a [% FOREACH %] directive.
Parameters
- variables in required type=structure
anonymous structure of variables
- output_lun in required type=LUN
logical unit number of output file
topmgfftemplate::_process_includeprivate
mgfftemplate::_process_include, variables, output_lun [, spaces=integer]
Process an [% INCLUDE filename %] directive. This includes the file specified by the "filename" variable directly (with not processing), as in the INSERT directive except the filename is specified with a variable.
Parameters
- variables in required type=structure
anonymous structure of variables
- output_lun in required type=LUN
logical unit number of output file
Keywords
- spaces in optional type=integer default=0
number of spaces to indent the include
topmgfftemplate::_process_include_templateprivate
mgfftemplate::_process_include_template, variables, output_lun [, spaces=integer]
Process a [% INCLUDE_TEMPLATE filename %] directive. This includes the file specified by the "filename" variable, processing it as a template with the same variables as the current template.
Parameters
- variables in required type=structure
anonymous structure of variables
- output_lun in required type=LUN
logical unit number of output file
Keywords
- spaces in optional type=integer default=0
number of spaces to indent the include
topmgfftemplate::_process_insertprivate
mgfftemplate::_process_insert, output_lun [, spaces=integer]
Process an [% INSERT filename %] directive. Insert the given filename. Here "filename" is not a variable; it is a directly specified filename. The filename can be absolute or relative to the template file.
Parameters
- output_lun in required type=LUN
logical unit number of output file
Keywords
- spaces in optional type=integer default=0
number of spaces to indent the include
topmgfftemplate::_process_scopeprivate
mgfftemplate::_process_scope, variables, output_lun
Process a [% SCOPE ovariables %] directive. Only valid for a object template.
Parameters
- variables in required type=object
object with getVariable method
- output_lun in required type=LUN
logical unit number of output file
topmgfftemplate::_getVariable
result = mgfftemplate::_getVariable(variables, name [, /found])
Finds a given variable name in a structure of variables or calls getVariable if variables is an object.
Return value
value of variable or -1L if not found
Parameters
- variables in required type=structure
structure of variables
- name in required type=string
name of a variable
Keywords
- found out optional type=boolean
true if name is a variable in variables structure
topmgfftemplate::_process_variableprivate
mgfftemplate::_process_variable, mgfftemplate$expression, mgfftemplate$variables, mgfftemplate$output_lun [, post_delim=string] [, value=any] [, /found]
Process an [% expression %] directive. Note: this routine uses SCOPE_VARFETCH to pull variables from the template into the local scope of this routine. Therefore all the local variables have a prefix of "mgfftemplate$" to avoid name clashes.
Parameters
- mgfftemplate$expression in required type=string
expression containing variable names to insert value of
- mgfftemplate$variables in required type=structure
anonymous structure of variables
- mgfftemplate$output_lun in required type=LUN
logical unit number of output file
Keywords
- post_delim out optional type=string
delimiter after the returned token
- value out optional type=any
value of the expression evaluated
- found out optional type=boolean
true if the expression was evaluated without error
topmgfftemplate::_process_tokensprivate
mgfftemplate::_process_tokens, variables, output_lun [, /else_clause]
Process directives or plain text.
Parameters
- variables in required type=structure
anonymous structure of variables
- output_lun in required type=LUN
logical unit number of output file
Keywords
- else_clause out optional type=boolean
returns 1 if an [% ELSE %] directive was just processed
topmgfftemplate::process
mgfftemplate::process, variables [, output_filename] [, lun=long]
Process the template with the given variables and send output to the given filename.
Parameters
- variables in required type=structure
either a structure or an object with getVariable method
- output_filename in optional type=string
filename of the output file
Keywords
- lun in optional type=long
logical unit number of an already open file to send output to
topmgfftemplate::reset
mgfftemplate::reset
Reset the template to run again from the start of the template.
topmgfftemplate::init
result = mgfftemplate::init(template_filename [, spaces=integer])
Create a template class for a given template. A template can be used many times with different sets of data sent to the process method.
Return value
1 for success, 0 otherwise
Parameters
- template_filename in required type=string
filename of the template file
Keywords
- spaces in optional type=integer default=0
number of spaces to indent the include
topmgfftemplate__define
input/output
mgfftemplate__define
Define instance variables.
Other attributes
- Requires:
IDL 6.1
- Uses:
MGffTokenizer class
File attributes
| Modification date: | Mon Jan 28 11:18:32 2008 |
| Lines: | 780 |
| Docformat: | idldoc verbatim |
![[attach.png]](../idldoc-resources/attach.png)