Coding Help:

Most OTS form programs are written to use the default array (L[]) to hold the values for each line of a given tax form. Typically the values are currency amounts, or dollars. Consequently, several of the convenience routines are written to work with the L[] array, and to print out values with two digits after the decimal point, as in "8.25". Additional custom variables are added when needed to handle form-values that do not correspond directly to line numbers.

Summary of key OTS functions:

GetLine( "label", &var ) Looks for "label" in input file, and places the corresponding sum of values following that label (until ";") into variable.

GetLineF( "label", &var ) Like GetLine() above, but also writes the result to the output file.
GetLineFnz( "label", &var ) Like GetLine(), but only writes non-zero values to the output file.
GetLine1( "label", &var ) Like GetLine() above, but expects exactly one value   (no sum, no semicolon ";" in input file).
c = SmallerOf( a, b ); Selects smaller of two values.
c = LargerOf( a, b ); Selects larger of two values.
c = NotLessThanZero( a ); Selects positive value or zero. Prevents negative values.
showline( j ) Writes currency value of L[j] to output file with label in nice format.
shownum( j ) Writes integer value of L[j] to output file with label in nice format.
showline_wmsg( j, "msg" ) Like showline, but adds the provided message to the output line.
ShowLineNonZero( j ) Like showline, but only writes non-zero values.
ShowLineNonZero_wMsg( j, "msg" ) Like showline_wmsg, but only writes non-zero values.
showline_wlabel( "label", var ) For custom line names and variables not in the default L[] array.
showline_wlabelnz( "label", var ) Like showline_wlabel, but only writes non-zero values.
showline_wlabelmsg( "label", var, "msg" ) Like showline_wlabel,but adds the provided message to the output line.



Return to How to add new forms

.