I spent several hours yesterday and today working on the Priority Procedure Cross Referencer and Fault Analyser (PrioXRef). I finished off the deceptive assignment statement (:C = (:B = 1 ? 2 : 3) initialises :C but it does not initialise :B) then continued working on other kinds of statements. I noticed that at one stage, some variables were being marked as unused after their definition, which I know is wrong. It turned out that the code that reads comments was not working correctly and caused the program to skip over a large chunk of the program. I wrote a routine that sort of works but I wasn't happy with this and tried to find a better solution.
The problem is that two characters have to be detected in order to end a comment (*/) and my routine had great difficulty in doing so. It doesn't help that I often used long comment lines (like /****************/ to mark sections in my code: these were causing the problem. After thinking about the problem for several hours, I decided eventually to 'cheat': I used the Delphi function pos that looks for a substring in a string, making the detection of */ very easy. Thinking about it now, this is hardly 'cheating' as I am using several other Delphi constructs, but the idea was to write the lexical analyser using standard Pascal as much as possible.
For all the help that PrioXRef can bring to the table, there are still areas that can give a programmer grief. I have just spent a frustrating hour trying to figure out why an interface procedure that I wrote several months ago had suddenly stopped working. The interface is for the SUPPLIERS screen and naturally uses fields from the eponymous table. I eventually discovered that the problem was that I was accessing the default purchase order type, a pointer to which is held in the table SUPPLIERSA. There was no record in this table for the supplier that I was testing and so my query result was empty. The rationale behind extension tables (such as SUPPLIERSA) is that one can define for this table fields that are used by only a subset of the suppliers and so save space in the database.
No comments:
Post a Comment