Complicating the new loading process is the handling of lines with errors. When a line containing an error is entered into the edit box, no recreation of the line is necessary since the edit box already has the text. However, when a program is being loaded from a file and a line has an error, the text of the line has to be entered into the edit box.
When the edit box retrieves the recreated text for a changed line, the program unit returns a null string for a line with an error. For null strings (lines with errors), the edit box ignores the line since it already has the line in the document. The program unit will be changed to return the line with an error, and it will not send a program change signal if the line originated by a change from the edit box document. However, when the program class is loading a program from a file, it will send program change signals for lines with errors.
The program unit will need to know whether an update came from the edit box (no signal) or program load (send signal). During the loading of the program, the lines are loaded sequentially and each will be added (appended) to the end of the program. If the current program unit update routine was used as is, the new program load routine would need to maintain a line number which would be incremented for each line and passed to the update routine.
To simplify the program load routine and give the update routine the ability to determine the caller (edit box or program load), a new append operation was added (in addition to the insert, change and remove operations). The update routine detects the append operation by whether the line number passed to it is set to a -1, which the program load routine will use as it adds lines to the end of the program (and it won't need to keep track of line numbers).
When the update routine sees the line number set to -1, it sets the operation to append and the line number to the current count of lines in the program. Otherwise, the append operation is the same as the insert operation. The operation enumeration was moved from the error list header file to the program model header file with the new append operation. This enumeration was only in the error list header file for the set change index routine, but this routine had been removed though its definition was accidentally left behind (it was removed).
[commit b795a47120]
Wednesday, January 8, 2014
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.)