The program model receives program line changes from the edit box, which up to now just stored the text of the program lines in a string list. Eventually the program model will store the internal code of the BASIC program after the line is translated and encoded. Since the encoder is not yet implemented, the output RPN lists from the translator will be stored so that more components of the GUI can be developed.
In order for the program model to store RPN lists, the program lines need to be translated, which means that the program model class needed a translator instance. A translator instance member pointer was added, which is created by the constructor and deleted in the destructor. To hold the RPN lists, a member was added for the list of RPN list pointers.
The update slot that receives the program lines from the edit box was modified to translate new lines and insert the resulting RPN list (which may contain an error); delete the RPN list for a deleted line; and delete the RPN list, translate a changed line and replace the RPN list pointer for the changed line.
The data function was modified to return the text of the RPN list for the requested line (if it doesn't have an error), or the column, length and message as a single string for a line with an error. Eventually the error will need to be highlighted some how in the edit box.
All uses of the program line string list were replaced with the new translated line RPN list. The string list member was left in and is still updated by the update slot, and it is also still used to detect line changes. Shortly this list will be removed when the comparison is made using the RPN lists.
But first a small problem needs to be investigated. During initial testing, an expected translator test file was loaded instead of the input data file and a segmentation fault occurred. Loading any text file should just produce a bunch of errors (which is did when one of the other text files used for debugging the edit box was loaded). Loading the desired translator test file and removing the comment lines produced the translated RPN lists in the program view as expected including lines with errors, which produced the expected error string.
[commit c77bdb9274]
Sunday, March 31, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)