[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4 AutoGen Scheme Functions

AutoGen uses Guile to interpret Scheme expressions within AutoGen macros. All of the normal Guile functions are available, plus several extensions (see section Common Scheme Functions) have been added to augment the repertoire of string manipulation functions and manage the state of AutoGen processing.

This section describes those functions that are specific to AutoGen. Please take note that these AutoGen specific functions are not loaded and thus not made available until after the command line options have been processed and the AutoGen definitions have been loaded. They may, of course, be used in Scheme functions that get defined at those times, but they cannot be invoked.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.1 ‘ag-fprintf’ - format to autogen stream

Usage: (ag-fprintf ag-diversion format [ format-arg ... ])
Format a string using arguments from the alist. Write to a specified AutoGen diversion. That may be either a specified suspended output stream (see section out-suspend’ - suspend current output file) or an index into the output stack (see section out-push-new’ - purge and create output file). (ag-fprintf 0 ...) is equivalent to (emit (sprintf ...)), and (ag-fprintf 1 ...) sends output to the most recently suspended output stream.

Arguments:
ag-diversion - AutoGen diversion name or number
format - formatting string
format-arg - Optional - list of arguments to formatting string


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.2 ‘ag-function?’ - test for function

Usage: (ag-function? ag-name)
return SCM_BOOL_T if a specified name is a user-defined AutoGen macro, otherwise return SCM_BOOL_F.

Arguments:
ag-name - name of AutoGen macro


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.3 ‘base-name’ - base output name

Usage: (base-name)
Returns a string containing the base name of the output file(s). Generally, this is also the base name of the definitions file.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.4 ‘chdir’ - Change current directory

Usage: (chdir dir)
Sets the current directory for AutoGen. Shell commands will run from this directory as well. This is a wrapper around the Guile native function. It returns its directory name argument and fails the program on failure.

Arguments:
dir - new directory name


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.5 ‘count’ - definition count

Usage: (count ag-name)
Count the number of entries for a definition. The input argument must be a string containing the name of the AutoGen values to be counted. If there is no value associated with the name, the result is an SCM immediate integer value of zero.

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.6 ‘def-file’ - definitions file name

Usage: (def-file)
Get the name of the definitions file. Returns the name of the source file containing the AutoGen definitions.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.7 ‘def-file-line’ - get a definition file+line number

Usage: (def-file-line ag-name [ msg-fmt ])
Returns the file and line number of a AutoGen defined value, using either the default format, "from %s line %d", or else the format you supply. For example, if you want to insert a "C" language file-line directive, you would supply the format "# %2$d \"%1$s\"", but that is also already supplied with the scheme variable See section format file info as, “#line nn "file". You may use it thus:

 
(def-file-line "ag-def-name" c-file-line-fmt)

It is also safe to use the formatting string, "%2$d". AutoGen uses an argument vector version of printf: See section Replacement for Stdio Formatting Library.

Arguments:
ag-name - name of AutoGen value
msg-fmt - Optional - formatting for line message


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.8 ‘dne’ - "Do Not Edit" warning

Usage: (dne prefix [ first_prefix ] [ optpfx ])
Generate a "DO NOT EDIT" or "EDIT WITH CARE" warning string. Which depends on whether or not the --writable command line option was set.

The first argument may be an option: -d

This will suppress the variable text (date and version information). If specified, then the "prefix" and "first" arguments are shifted to the next arguments.

The first argument is a per-line string prefix. The optional second argument is a prefix for the first-line and, in read-only mode, activates the editor hints.

 
-*- buffer-read-only: t -*- vi: set ro:

The warning string also includes information about the template used to construct the file and the definitions used in its instantiation.

The optional third argument is used when the first argument is actually an invocation option and the prefix arguments get shifted. The first argument must be, specifically, "-d". That is used to signify that the date stamp should not be inserted into the output.

Arguments:
prefix - string for starting each output line
first_prefix - Optional - for the first output line
optpfx - Optional - shifted prefix


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.9 ‘emit’ - emit the text for each argument

Usage: (emit alist ...)
Walk the tree of arguments, displaying the values of displayable SCM types. EXCEPTION: if the first argument is a number, then that number is used to index the output stack. "0" is the default, the current output.

Arguments:
alist - list of arguments to stringify and emit


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.10 ‘emit-string-table’ - output a string table

Usage: (emit-string-table st-name)
Emit into the current output stream a static char const array named st-name that will have NUL bytes between each inserted string.

Arguments:
st-name - the name of the array of characters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.11 ‘error’ - display message and exit

Usage: (error message)
The argument is a string that printed out as part of an error message. The message is formed from the formatting string:

 
DEFINITIONS ERROR in %s line %d for %s:  %s\n

The first three arguments to this format are provided by the routine and are: The name of the template file, the line within the template where the error was found, and the current output file name.

After displaying the message, the current output file is removed and autogen exits with the EXIT_FAILURE error code. IF, however, the argument begins with the number 0 (zero), or the string is the empty string, then processing continues with the next suffix.

Arguments:
message - message to display before exiting


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.12 ‘exist?’ - test for value name

Usage: (exist? ag-name)
return SCM_BOOL_T iff a specified name has an AutoGen value. The name may include indexes and/or member names. All but the last member name must be an aggregate definition. For example:

 
(exist? "foo[3].bar.baz")

will yield true if all of the following is true:
There is a member value of either group or string type named baz for some group value bar that is a member of the foo group with index 3. There may be multiple entries of bar within foo, only one needs to contain a value for baz.

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.13 ‘find-file’ - locate a file in the search path

Usage: (find-file file-name [ suffix ])
AutoGen has a search path that it uses to locate template and definition files. This function will search the same list for ‘file-name’, both with and without the ‘.suffix’, if provided.

Arguments:
file-name - name of file with text
suffix - Optional - file suffix to try, too


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.14 ‘first-for?’ - detect first iteration

Usage: (first-for? [ for_var ])
Returns SCM_BOOL_T if the named FOR loop (or, if not named, the current innermost loop) is on the first pass through the data. Outside of any FOR loop, it returns SCM_UNDEFINED, see section FOR - Emit a template block multiple times.

Arguments:
for_var - Optional - which for loop


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.15 ‘for-by’ - set iteration step

Usage: (for-by by)
This function records the "step by" information for an AutoGen FOR function. Outside of the FOR macro itself, this function will emit an error. See section FOR - Emit a template block multiple times.

Arguments:
by - the iteration increment for the AutoGen FOR macro


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.16 ‘for-from’ - set initial index

Usage: (for-from from)
This function records the initial index information for an AutoGen FOR function. Outside of the FOR macro itself, this function will emit an error. See section FOR - Emit a template block multiple times.

Arguments:
from - the initial index for the AutoGen FOR macro


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.17 ‘for-index’ - get current loop index

Usage: (for-index [ for_var ])
Returns the current index for the named FOR loop. If not named, then the index for the innermost loop. Outside of any FOR loop, it returns SCM_UNDEFINED, See section FOR - Emit a template block multiple times.

Arguments:
for_var - Optional - which for loop


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.18 ‘for-sep’ - set loop separation string

Usage: (for-sep separator)
This function records the separation string that is to be inserted between each iteration of an AutoGen FOR function. This is often nothing more than a comma. Outside of the FOR macro itself, this function will emit an error.

Arguments:
separator - the text to insert between the output of each FOR iteration


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.19 ‘for-to’ - set ending index

Usage: (for-to to)
This function records the terminating value information for an AutoGen FOR function. Outside of the FOR macro itself, this function will emit an error. See section FOR - Emit a template block multiple times.

Arguments:
to - the final index for the AutoGen FOR macro


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.20 ‘found-for?’ - is current index in list?

Usage: (found-for? [ for_var ])
Returns SCM_BOOL_T if the currently indexed value is present, otherwise SCM_BOOL_F. Outside of any FOR loop, it returns SCM_UNDEFINED. See section FOR - Emit a template block multiple times.

Arguments:
for_var - Optional - which for loop


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.21 ‘get’ - get named value

Usage: (get ag-name [ alt-val ])
Get the first string value associated with the name. It will either return the associated string value (if the name resolves), the alternate value (if one is provided), or else the empty string.

Arguments:
ag-name - name of AutoGen value
alt-val - Optional - value if not present


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.22 ‘get-c-name’ - get named value, mapped to C name syntax

Usage: (get-c-name ag-name)
Get the first string value associated with the name. It will either return the associated string value (if the name resolves), the alternate value (if one is provided), or else the empty string. The result is passed through "string->c-name!".

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.23 ‘get-down-name’ - get lower cased named value, mapped to C name syntax

Usage: (get-down-name ag-name)
Get the first string value associated with the name. It will either return the associated string value (if the name resolves), the alternate value (if one is provided), or else the empty string. The result is passed through "string->c-name!" and "string->down-case!".

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.24 ‘get-up-name’ - get upper cased named value, mapped to C name syntax

Usage: (get-up-name ag-name)
Get the first string value associated with the name. It will either return the associated string value (if the name resolves), the alternate value (if one is provided), or else the empty string. The result is passed through "string->c-name!" and "string->up-case!".

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.25 ‘high-lim’ - get highest value index

Usage: (high-lim ag-name)
Returns the highest index associated with an array of definitions. This is generally, but not necessarily, one less than the count value. (The indexes may be specified, rendering a non-zero based or sparse array of values.)

This is very useful for specifying the size of a zero-based array of values where not all values are present. For example:

 
tMyStruct myVals[ [+ (+ 1 (high-lim "my-val-list")) +] ];

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.26 ‘insert-suspended’ - insert a named suspension in current output

Usage: (insert-suspended susp-name)
Emit into the current output the output suspended under a given diversion name.

Arguments:
susp-name - the name of the suspended output


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.27 ‘last-for?’ - detect last iteration

Usage: (last-for? [ for_var ])
Returns SCM_BOOL_T if the named FOR loop (or, if not named, the current innermost loop) is on the last pass through the data. Outside of any FOR loop, it returns SCM_UNDEFINED. See section FOR - Emit a template block multiple times.

Arguments:
for_var - Optional - which for loop


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.28 ‘len’ - get count of values

Usage: (len ag-name)
If the named object is a group definition, then "len" is the same as "count". Otherwise, if it is one or more text definitions, then it is the sum of their string lengths. If it is a single text definition, then it is equivalent to (string-length (get "ag-name")).

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.29 ‘low-lim’ - get lowest value index

Usage: (low-lim ag-name)
Returns the lowest index associated with an array of definitions.

Arguments:
ag-name - name of AutoGen value


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.30 ‘make-header-guard’ - make self-inclusion guard

Usage: (make-header-guard name)
This function will create a #ifndef/#define sequence for protecting a header from multiple evaluation. It will also set the Scheme variable header-file to the name of the file being protected and it will set header-guard to the name of the #define being used to protect it. It is expected that this will be used as follows:

 
[+ (make-header-guard "group_name") +]
...
#endif /* [+ (. header-guard) +] */

#include "[+ (. header-file)  +]"

The #define name is composed as follows:

  1. The first element is the string argument and a separating underscore.
  2. That is followed by the name of the header file with illegal characters mapped to underscores.
  3. The end of the name is always, "_GUARD".
  4. Finally, the entire string is mapped to upper case.

The final #define name is stored in an SCM symbol named header-guard. Consequently, the concluding #endif for the file should read something like:

 
#endif /* [+ (. header-guard) +] */

The name of the header file (the current output file) is also stored in an SCM symbol, header-file. Therefore, if you are also generating a C file that uses the previously generated header file, you can put this into that generated file:

 
#include "[+ (. header-file) +]"

Obviously, if you are going to produce more than one header file from a particular template, you will need to be careful how these SCM symbols get handled.

Arguments:
name - header group name


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.31 ‘make-tmp-dir’ - create a temporary directory

Usage: (make-tmp-dir)
Create a directory that will be cleaned up upon exit.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.32 ‘match-value?’ - test for matching value

Usage: (match-value? op ag-name test-str)
This function answers the question, "Is there an AutoGen value named ag-name with a value that matches the pattern test-str using the match function op?" Return SCM_BOOL_T iff at least one occurrence of the specified name has such a value. The operator can be any function that takes two string arguments and yields a boolean. It is expected that you will use one of the string matching functions provided by AutoGen.
The value name must follow the same rules as the ag-name argument for exist? (see section exist?’ - test for value name).

Arguments:
op - boolean result operator
ag-name - name of AutoGen value
test-str - string to test against


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.33 ‘mk-gettextable’ - print a string in a gettext-able format

Usage: (mk-gettextable string)
Returns SCM_UNDEFINED. The input text string is printed to the current output as one puts() call per paragraph.

Arguments:
string - a multi-paragraph string


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.34 ‘out-delete’ - delete current output file

Usage: (out-delete)
Remove the current output file. Cease processing the template for the current suffix. It is an error if there are push-ed output files. Use the (error "0") scheme function instead. See section Redirecting Output.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.35 ‘out-depth’ - output file stack depth

Usage: (out-depth)
Returns the depth of the output file stack. See section Redirecting Output.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.36 ‘out-emit-suspended’ - emit the text of suspended output

Usage: (out-emit-suspended susp_nm)
This function is equivalent to (begin (out-resume <name>) (out-pop #t))

Arguments:
susp_nm - A name tag of suspended output


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.37 ‘out-line’ - output file line number

Usage: (out-line)
Returns the current line number of the output file. It rewinds and reads the file to count newlines.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.38 ‘out-move’ - change name of output file

Usage: (out-move new-name)
Rename current output file. See section Redirecting Output. Please note: changing the name will not save a temporary file from being deleted. It may, however, be used on the root output file.

Arguments:
new-name - new name for the current output file


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.39 ‘out-name’ - current output file name

Usage: (out-name)
Returns the name of the current output file. If the current file is a temporary, unnamed file, then it will scan up the chain until a real output file name is found. See section Redirecting Output.

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.40 ‘out-pop’ - close current output file

Usage: (out-pop [ disp ])
If there has been a push on the output, then close that file and go back to the previously open file. It is an error if there has not been a push. See section Redirecting Output.

If there is no argument, no further action is taken. Otherwise, the argument should be #t and the contents of the file are returned by the function.

Arguments:
disp - Optional - return contents of the file


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.41 ‘out-push-add’ - append output to file

Usage: (out-push-add file-name)
Identical to push-new, except the contents are not purged, but appended to. See section Redirecting Output.

Arguments:
file-name - name of the file to append text to


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.42 ‘out-push-new’ - purge and create output file

Usage: (out-push-new [ file-name ])
Leave the current output file open, but purge and create a new file that will remain open until a pop delete or switch closes it. The file name is optional and, if omitted, the output will be sent to a temporary file that will be deleted when it is closed. See section Redirecting Output.

Arguments:
file-name - Optional - name of the file to create


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.43 ‘out-resume’ - resume suspended output file

Usage: (out-resume susp_nm)
If there has been a suspended output, then make that output descriptor current again. That output must have been suspended with the same tag name given to this routine as its argument.

Arguments:
susp_nm - A name tag for reactivating


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.44 ‘out-suspend’ - suspend current output file

Usage: (out-suspend suspName)
If there has been a push on the output, then set aside the output descriptor for later reactiviation with (out-resume "xxx"). The tag name need not reflect the name of the output file. In fact, the output file may be an anonymous temporary file. You may also change the tag every time you suspend output to a file, because the tag names are forgotten as soon as the file has been "resumed".

Arguments:
suspName - A name tag for reactivating


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.45 ‘out-switch’ - close and create new output

Usage: (out-switch file-name)
Switch output files - close current file and make the current file pointer refer to the new file. This is equivalent to out-pop followed by out-push-new, except that you may not pop the base level output file, but you may switch it. See section Redirecting Output.

Arguments:
file-name - name of the file to create


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.46 ‘output-file-next-line’ - print the file name and next line number

Usage: (output-file-next-line [ line_off ] [ alt_fmt ])
Returns a string with the current output file name and line number. The default format is: # <line+1> "<output-file-name>" The argument may be either a number indicating an offset from the current output line number or an alternate formatting string. If both are provided, then the first must be a numeric offset.

Be careful that you are directing output to the final output file. Otherwise, you will get the file name and line number of the temporary file. That won’t be what you want.

Arguments:
line_off - Optional - offset to line number
alt_fmt - Optional - alternate format string


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.47 ‘set-option’ - Set a command line option

Usage: (set-option opt)
The text argument must be an option name followed by any needed option argument. Returns SCM_UNDEFINED.

Arguments:
opt - AutoGen option name + its argument


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.48 ‘set-writable’ - Make the output file be writable

Usage: (set-writable [ set? ])
This function will set the current output file to be writable (or not). This is only effective if neither the --writable nor --not-writable have been specified. This state is reset when the current suffix’s output is complete.

Arguments:
set? - Optional - boolean arg, false to make output non-writable


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.49 ‘stack’ - make list of AutoGen values

Usage: (stack ag-name)
Create a scheme list of all the strings that are associated with a name. They must all be text values or we choke.

Arguments:
ag-name - AutoGen value name


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.50 ‘stack-join’ - stack values then join them

Usage: (stack-join join ag-name)
This function will collect all the values named ag-name (see the see section stack function) and join them separated by the join string (see the see section join function).

Arguments:
join - string between each element
ag-name - name of autogen values to stack


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.51 ‘suffix’ - get the current suffix

Usage: (suffix)
Returns the current active suffix (see section Format of the Pseudo Macro).

This Scheme function takes no arguments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.52 ‘tpl-file’ - get the template file name

Usage: (tpl-file [ full_path ])
Returns the name of the current template file. If #t is passed in as an argument, then the template file is hunted for in the template search path. Otherwise, just the unadorned name.

Arguments:
full_path - Optional - include full path to file


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.53 ‘tpl-file-line’ - get the template file+line number

Usage: (tpl-file-line [ msg-fmt ])
Returns the file and line number of the current template macro using either the default format, "from %s line %d", or else the format you supply. For example, if you want to insert a "C" language file-line directive, you would supply the format "# %2$d \"%1$s\"", but that is also already supplied with the scheme variable See section format file info as, “#line nn "file". You may use it thus:

 
(tpl-file-line c-file-line-fmt)

It is also safe to use the formatting string, "%2$d". AutoGen uses an argument vector version of printf: See section Replacement for Stdio Formatting Library, and it does not need to know the types of each argument in order to skip forward to the second argument.

Arguments:
msg-fmt - Optional - formatting for line message


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.54 ‘tpl-file-next-line’ - get the template file plus next line number

Usage: (tpl-file-next-line [ msg-fmt ])
This is almost the same as See section tpl-file-line’ - get the template file+line number, except that the line referenced is the next line, per C compiler conventions, and consequently defaults to the format: # <line-no+1> "<file-name>"

Arguments:
msg-fmt - Optional - formatting for line message


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.55 ‘autogen-version’ - autogen version number

This is a symbol defining the current AutoGen version number string. It was first defined in AutoGen-5.2.14. It is currently “5.18.2”.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.56 format file info as, “#line nn "file"

This is a symbol that can easily be used with the functions See section tpl-file-line’ - get the template file+line number, and See section def-file-line’ - get a definition file+line number. These will emit C program #line directives pointing to template and definitions text, respectively.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Bruce Korb on October 16, 2013 using texi2html 1.82.