#CTRAN update:
I've been looking at ways to neaten up the code while making it more robust and testable ("make it right").
After starting down a couple of dead ends and having a conversation with a mate, I decided to split the class parsing method (_GetClass) into two - _BuildLocalClass and _BuildExternalClass. While there's a huge amount of crossover between Psion's local category (.CAT and .CL) files and external (.EXT) files 1 , they don't share any keywords inside their classes. Each keyword had a "if external" or "if not external" check. I never loved this, but it was the only way I could see of getting it working. Of course, the obvious solution was staring me in the face.
Now the check only happens at the start of a class being parsed:
if _FileType = ooExternal then
begin
_ClassList.Add(_BuildExternalClass(tokline));
end
else begin
_ClassList.Add(_BuildLocalClass(tokline));
end;
I also changed _ClassList from an array to a TList, which should be a little more memory efficient when adding classes. I might do the same for elements within classes, too.
These probably won't make any noticeable speed difference, but it does improve code readability and should make it easier to test.
1 : Local category files define classes for processing by CTRAN, while external category files reference and summarise pre-compiled classes.





