[comp.windows.x.motif] a uil war story

stevec@bu-pub.bu.edu (Steve Connelly) (02/23/91)

	A comic tragedy of homeric proportions, not for the faint-of-heart or
case-sensitive:

	Even though I don't use the UIL programming language when writing 
Motif applications, I was conscripted to give a tutorial on UIL.
	So that the students could better isolate the UIL keywords in my tiny 
sample program, I thought I would make the keywords all uppercase.  
	I first looked up "case sensitivity" in the DECstation manual and also
in the Prentice Hall OSF manual.  The subsection on case sensitivity was 
letter-for-letter exactly the same in both manuals, except the DEC manual said 
the default was case insensitive.  A quick experiment revealed that the problem
was merely that the DEC manual was incorrect.
	The documentation said that, if the UIL program is case sensitive,
all names of the user's procedures would be stored in the compiled UID file
as all uppercase.  As a result, in the C program that reads the UID file, the 
names given to MrmRegisterNames() must be uppercase.  The documentation 
had a table, which is paraphrased here:


Case        |  UIL keywords   |  User's names  |
------------|-----------------|----------------|
            |                 |                |
sensitive   |  must be        |  can be        |
            |  lower case.    |  any case.     |
------------|-----------------|----------------|
            |                 |                |
insensitive |  can be         |  must be       |
            |  any case.      |  uppercase.    |
-----------------------------------------------

	Thus, UIL enforces the Law of Conservation of Insensitivity, which 
states that, to give case insensitivity to one program, you must take 
insensitivity away from the other.  I decided I could live with this.
	I added the line "NAMES = CASE_INSENSITIVE" to my UIL program and 
happily changed all the UIL keywords to uppercase.
	I tried to compile the tiny UIL program.  However, the compiler gave
many error messages.  Apparently, the program isn't case insensitive until
the end of the line "NAMES = CASE_INSENSITIVE".  I went back and set to 
lowercase all lines before and including the case sensitivity statement.
	However, I felt something was awry.  The statement "MODULE module-name"
is the first line of a UIL program, and thus could never be in uppercase. 
This implied that the UIL modules in the documentation could never have 
compiled.
	Having changed the first few lines of the UIL program to lowercase,
I was able to bootstap my program into case insensitive mode.  However, the 
standard include file "XmAppl.uil" has the variables XmVersion and XmVERSION, 
which are the same words in a case insensitive program.  Thus, the program 
couldn't be compiled.
	I changed the program so as not to include "XmAppl.h", and, voila,
the program compiled.

	The documentation says "The case-sensitivity clause should be the first
element in the module header...."  So, I had finally mastered the first clause
of the first part of a UIL program.

	

								Steve Connelly