Back in November of 2005, I was chatting with Vassili and the topic of games (as usual) came up. I mentioned to him that I had starting porting Elite the New Kind to VisualWorks, but it was broken because of a broken laptop. He seemed interested, so I decided to dig up the work around and show him.
Quite some time had passed since I last looked at the code. One thing became immediately clear, I could not easily tell which functions I had finished porting. It was obvious if a function was not ported at all, because there was no corresponding method. However, for methods that had code that looked like the C function, it was not clear if the translation bugs were fixed yet. I found myself wanting a way to compare the method source with the corresponding source in the C source file.
Finally, it occurred to me that if could annotate a method with a pragma that described the location of the original C function (which C file and where in the file), I could then use the Differator to compare the Smalltalk with the original C source. Using a pragma was a huge leap for me. I had been aware for pragmas as long as they had been in VisualWorks. However, for some reason (probably one reason: I'm a dope), I never found the need to create my own.
I re-parented all my Elite classes under a new superclass, which I called CFileThing. On the class side, I created the following method:
filePragma <pragmas: #class> <pragmas: #instance> ^#(file:start:stop:)
Then it is a trivial exercise to use the Differator to compare the two implementations side by side. Here's how one method comparison looks in the differator:
With a little more work, it was not too hard to integrate this behavior into a new subclass of the CodeCompareTool:
Before I knew it, I was in position where I could publish a work in progress to the public repository. However, it was also the same time I noticed the copyright problems Christian Pinder was having with having released Elite the new Kind. The wikipedia entry on Elite claims: "The dispute has since been settled and Elite: The New Kind can be downloaded once more". However, I can't find a reference confirming this. So, I'm reluctant to publish to the public repository.
In the meantime, I have a screencast showing the port in VisualWorks. Here you'll see me leave the space station, show the different views, turn around and dock back in the station. The docking was courtesy of the docking computer which I added so I would not have to buy it first.