The program model needs to encode lines when an update signal is received once each line has been successfully translated. The program model update slot routine receives this signal from the edit box, which includes the line number, number of lines deleted, number of lines inserted, and a list of strings of the lines. The type of operations needed on the program is then determined (change, insert or remove lines) and calls the update line routine to perform the operation for each line affected.
The update line routine was modified to encode the line after a successful translate. A temporary program word vector was added to the line info list to the code for the line. The line info list currently holds a pointer to the translated RPN list (temporary), and an index to the error list if the line has an error. The program model will contain a single program word vector for the entire program unit with the line info list containing offsets and sizes of the lines within this vector. This will allow execution through the program without using time dealing with lines. Only the insert operation was modified to store the line code vector at this time.
The tester class encode input routine was modified to let the program model translate and encode the line, by calling the update slot routine directly to insert a single line to the end of the program. An access function to the RPN list pointer was added to the program model to get the RPN list for a line to determine if there was a translation error and to get the information about the error (column, length and message). The debug text routine was modified to take a line index argument instead of a program word pointer and a word count, which uses the line index to get the program line code and work count. Because the program model still possesses the RPN list, the encode input routine can no longer delete it.
As a result, a token memory leak occurred (which could previously be seen when running the GUI and then exiting) because the program model was not deleting the RPN lists contained in the line info list when the application exited. This was corrected by deleting all of the RPN lists in the program model destructor. The tester class run routine was modified not to report token errors after each line, which will be reported when the application terminates.
[commit 49b3231acb]
Sunday, October 13, 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.)