Thursday, September 24, 2020

Return to lockdown - keeping myself occupied with new programming projects

Due to the high number of people being found positive for Covid-19 in Israel and the exponential rate of increase, it has been decided that some form of lock down will be enacted over the next few weeks. In a sense, this isn't much of a problem, as Monday is Yom Kippur, which means that Sunday wouldn't be a work day for most people. Then the week after that is 'the festival of booths', during which many people don't work anyway. At the time of writing, I don't know whether my company is to be closed or to work in some reduced form, so I don't know what will happen to me next week.

One way or another, I'm going to have plenty of spare time on my hands. Just as well, as I have two programming projects that I want to execute during this time. The first is an update of one of the OP's multilingual exams - there are problems running this with Windows 10. I started examining the problem last week in a modern version of Delphi; I think that I know what the problem is but I haven't had the time to do anything apart from thinking about the problem. I'm fairly certain that there is interference between the use of a string table resource file and the clientdataset component. If I can't find a simple resolution, I may have to abandon the clientdataset, instead outputting 'rich text' files that will somehow have to be combined to create a final output file.

The other project is quite grandiose: over the months, I've collected various mistakes that I have made whilst programming procedures in Priority and that were not noted by the in-built syntax checker. The idea is to check things that are not caught by the internal program, to supplement it and not replace it. Simply put, I want to write an external syntax checker that will check things like matched LINK/UNLINK pairs, uninitialised variables and a few other problems. I've been devoting a fair amount of thought as to how to store the data of such a program; traditional cross reference programs in Pascal used linked lists, and indeed I found such a program yesterday evening. But I would like to have a much more modern interface and use types such as stringlists and similar. A stringlist is ideal for storing what would have been an array of identifiers but isn't so useful when additional data regarding those identifiers is required.

I will no doubt continue to debate the subject in my mind until I commence coding; at the moment, my inclination is to take the old school cross referencer and adapt it to the Priority SQL syntax. This will be a complex task that would have to be done one way or another, so it's probably better to start with something that works so that I can concentrate on the syntax and not on how everything is stored. A cross referencer is a good idea anyway: it makes finding references to a variable much easier. I started writing a long program in Priority yesterday afternoon and finished writing and debugging this morning: this is 270 lines long which is fairly long but not too complicated. During the writing process, I moved pieces from place to place within the program (primarily moving non-variant operations out of loops, to be technical) and sometimes these edits slightly mangled the text. I discovered a new bug: a variable will always start with a colon (e.g. :DAYS); in the course of one of these edits and pastes, I had a variable named ::DAYS which is not the same as :DAYS. 

A cross referencer helps in finding variables that appear only once; this can mean that either the variable is superfluous as it is never used, or more problematic, it is a variable without value (as in the above case of ::DAYS). I wasted an hour yesterday on another procedure, trying to figure out why a value being saved in a variable was not being written later on. Eventually I saw the problem: the value was saved in :PARTCOST but was later accessed as :PARCOST. A cross referencer would find this immediately.


No comments: