Tuesday, July 16, 2013

Print Functions Correction

A segmentation fault was occurring with the new translator routines when a print function (TAB or SPC) was used incorrectly in an expression.  The problem was in the existing process final operand routine, which contained a check for print-only internal functions.  For these functions, it set flags for the current command on the command stack.  However, the command stack is not used for the new translator routines and was empty causing the crash.  This section of code will be removed once the old translator routines are removed, but to temporarily correct the problem with the new translator, a check was added to make sure the command stack is not empty.

The second problem occurred in the existing find code routine.  The change above allowed the print functions with a none data type to now be placed on the done stack.  When the the data type of the done stack top item was checked with the expected data type, the conversion code table did not have any entries for the none data type.  The missing entries were added set to the invalid code.

Two additional statements with print functions used incorrectly in expressions were added to translator test #3.  The old translator routines report the error incorrectly, the entire function through the closing parentheses should be reported, not just the function token.  The new translator routines do report the error correctly.

[commit 250b6ffd15]