flexoutput - Output facility with flexible substitution
The flexoutput module allows you to output strings with arguments substituted via simple codes within the string. For example:
call write_items( 10, 'The value of {2} is {1}, as expected', [ item(1), item('Name') ] )
would produce the string: The value of Name is 1, as expected
The function item returns a value of the type item_t, so that in the above statement an array is constructed with integer and string values. These are then substituted using default formatting specific to the data type. The result is written to a file.
There are two public routines:
This subroutine writes the string contained in the argument format to the file at LU-number lun. Substrings like "{1}", "{2}", etc. are substitued by the corresponding element from the array item_array. Use the function item to construct the array of items.
LU-number of the file to write to.
Format string to be used.
Array specifying the variables. COnstruct it using the item function.
Explicitly advance or not at the end of writing the string. By default advance, so that the next write statement starts on a new line.
This function returns a value of type item_t, so that an array can be formed to be passed to write_items. The argument var is one of the basic types: integer, single and double precision real or a character string of any length.
The variable to be assigned a value from the input file.
Copyright © 2016 Arjen Markus <arjenmarkus at sourceforge dot net>