MOO-cows Mailing List Archive


SOLVED: Problem using 1.7.8p4 on BSDi 1.1 systems

[FAQ editor: this should get a spot in the FAQ for at least a while, until
there's little chance of anyone running BSDi 1.1 anymore.]

I have, at long last, gotten around to tracking down the cause of the problem
many folks have reported in using the MOO server on a BSDi 1.1 machine.  To
refresh folks' memories, it manifests itself as a `syntax error' reported when
reading in just about any DB file, including Minimal.db.

The next layer of the problem is that the MOO compiler's parser is failing to
recognize *any* MOO keywords (e.g., `return', `if', etc.).  This started
happening after I changed the server to use a so-called `perfect hash table'
for keyword lookup; this is a specially-built table allowing the server to
simply add together the length of a string and a couple of the characters in
that string, and look up the result in a table to see if that string matches
one of the keywords.  The table is built using a tool I run once, before making
the distribution tar file.

In order to make the table work case-insensitively, the table-lookup code calls
the C function `tolower' on every string character it uses, to canonicalize the
case.  Well, it turns out that BSDi 1.1 has a little bug in its version of
`tolower': `tolower' does the intended job of `toupper' and vice-versa!

	(Note to BSDi hackers: this only happens if, as I do in the
	server for good but complicated reasons, you use the true
	function versions of these, not the macros in <ctype.h>.)

The simplest fix for BSDi 1.1 users is to add this line to the very top of the
file `keywords.c':

	#define tolower toupper

I have reason to believe that this bug does not exist in BSDi 2.0, so I'm going
to hold off on trying to incorporate any workaround for it in the official MOO


Home | Subject Index | Thread Index