Thursday, June 21, 2012

Porting code_gen.c and db_fileio.c

(This entry was written offline during a flight from Las Vegas to
Milwaukee today, June 21st 2012. I'm continuing the task of merging Waverous into Stunt, or
put another way, getting Stunt to be C++ compliant).

I never caught this when I ported Waverous to C++ because I never
defined BYTECODE_REDUCE_REF. This suggests to me a way of testing the
server by compiling it with every possible combination of
flags... this would be one hell of a build-and-smoke test. For every
combination of compile-time options: compile the server, start it up,
log in and do some basic tasks, shut down. I would have caught this
long ago if I'd thought of writing such a test.

After some dedicated surfing via my phone at Milwaukee's airport,
which does not have free wi-fi (pththth) I found the solution on
www.cplusplus.com:

It's curious and non-obvious to me that the args within the function
are cast and that this satisfies the compiler. On a side note I think being able to google our compiler errors and find solutions is an exception to Fred Brooks's "No Silver Bullet" argument. It feels like an order of magnitude increase in productivity to get help so easily.

I'm now past one of the stickier parts of porting: past the
TRY/EXECEPT/ENDTRY preprocessor macros in code_gen.c. I had to edit the file by hand and incorporate the needed expansion of the macros because the block of code in question had added blank lines spacing out the code. I would think patch would have a command line flag to account for this situation, but patch can only handle changes in leading and trailing whitespace.