[Simh] 'build' branch updated + on ibm1130 simulator using reserved identifiers and breaking the build

Peter Lund firefly at vax64.dk
Tue Oct 2 17:59:44 EDT 2007


On Tue, 2007-10-02 at 21:01 +0200, Peter Lund wrote:

> My 'build' branch at http://vax64.dyndns.org/repo/hg has these tests.
> 
> There are many other problems with the current makefile.  The 'build'
> branch is an attempt to fix them.  It is a little bit out of date as it
> doesn't build all the simulators but the code in my local directory
> does.

I have updated the published 'build' branch now.

Ibm1130 doesn't compile correctly under cygwin due to a misplaced/buggy
platform test that conditionally enables a private version of
strcasecmp/stricmp.

I'm not really sure that it is strictly necessary to use a case-blind
string comparison so the simplest path forward would be to just use
strcmp/strncmp.

The problem is that C89/90 doesn't have any case-blind string comparison
functions.  DOS/Windows have several (stricmp/strcmpi/strnicmp + I think
a few rare others).  POSIX has strcasecmp/strncasecmp.  The simulator
tries to either use strnicmp/strcmpi or implement its own versions of
them.  Unfortunately, it uses a(n incomplete) platform test (#ifndef
WIN32) instead of a feature test, so it tries to compile them under
cygwin which goes wrong because the standard headers on Windows have
some macro definitions that f*ck it up.  The macro definitions are there
to paper over the many synonyms these functions have in the DOS/Windows
world.

Actually, cygwin and the standard windows headers are perfectly allowed
to do what they do.

It is the Ibm1130 emulator that is wrong.

Identifiers that begin with 'str' and a lower-case letter are reserved
by the standard because they want to be able to add more standard
functions to <string.h>.  (ยง7.26.11 of the C99 standard, draft 1124.)
If they ever add something like these functions, they will most likely
use strcasecmp/strncasecmp as in POSIX.

So the options seem to be:
1) make a better platform test.
2) try to detect features instead (needs help from the build script).
3) always use a private implementation of the two functions in question
and give them a non-reserved name.
4) explicitly convert to upper/lower case and then use strcmp/strncmp
5) just use strcmp/strncmp

I prefer #5 because the code becomes simpler but #3 is also good and it
preserves complete compatibility.  Both are easy to do.

-Peter




More information about the Simh mailing list