SYMBOL CASE CONTROL


XLISP-PLUS uses two variables, *READTABLE-CASE* and *PRINT-CASE* to deturmine case conversion during reading and printing of symbols. *READTABLE-CASE* can have the values :UPCASE :DOWNCASE :PRESERVE or :INVERT, while *PRINT-CASE* can have the values :UPCASE :DOWNCASE or :CAPITALIZE. By default, or when other values have been specified, both are :UPCASE.

When *READTABLE-CASE* is :UPCASE, all unescaped lowercase characters are converted to uppercase when read. When it is :DOWNCASE, all unescaped uppercase characters are converted to lowercase. This mode is not very useful because the predefined symbols are all uppercase and would need to be escaped to read them. When *READTABLE-CASE* is :PRESERVE, no conversion takes place. This allows case sensitive input with predefined functions in uppercase. The final choice, :INVERT, will invert the case of any symbol that is not mixed case. This provides case sensitive input while making the predefined functions and variables appear to be in lowercase.

The printing of symbols involves the settings of both *READTABLE-CASE* and *PRINT-CASE*. When *READTABLE-CASE* is :UPCASE, lowercase characters are escaped (unless PRINC is used), and uppercase characters are printed in the case specified by *PRINT-CASE*. When *READTABLE-CASE* is :DOWNCASE, uppercase characters are escaped (unless PRINC is used), and lowercase are printed in the case specified by *PRINT-CASE*. The *PRINT-CASE* value of :CAPITALIZE means that the first character of the symbol, and any character in the symbol immediately following a non-alphabetical character are to be in uppercase, while all other alphabetical characters are to be in lowercase. The remaining *READTABLE-CASE* modes ignore *PRINT-CASE* and do not escape alphabetic characters. :PRESERVE never changes the case of characters while :INVERT inverts the case of any non mixed-case symbols.

There are five major useful combinations of these modes:

A: *READTABLE-CASE* :UPCASE *PRINT-CASE* :UPCASE

"Traditional" mode. Case insensitive input; must escape to put lowercase characters in symbol names. Symbols print exactly as they are stored, with lowercase characters escaped when PRIN1 is used.

B: *READTABLE-CASE* :UPCASE *PRINT-CASE* :DOWNCASE

"Eyesaver" mode. Case insensitive input; must escape to put lowercase characters in symbol name. Symbols print entirely in lowercase except symbols escaped when lowercase characters present with PRIN1.

C: *READTABLE-CASE* :PRESERVE

"Oldfashioned case sensitive" mode. Case sensitive input. Predefined symbols must be typed in uppercase. No alpha quoting needed. Symbols print exactly as stored.

D: *READTABLE-CASE* :INVERT

"Modern case sensitive" mode. Case sensitive input. Predefined symbols must be typed in lowercase. Alpha quoting should be avoided. Predefined symbols print in lower case, other symbols print as they were entered.

E: *READTABLE-CASE* :UPCASE *PRINT-CASE* :CAPITALIZE

Like case B, except symbol names print capitalized.

As far as compatibility between these modes are concerned, data printed in mode A can be read in A, B, C, or E. Data printed in mode B can be read in A, B, D, or E. Data printed in mode C can be read in mode C, and if no lowercase symbols in modes A, B and E as well. Data printed in mode D can be read in mode D, and if no (internally) lowercase symbols in modes A, B, and E as well. Data printed in mode E can be read in modes A, B, and E. In addition, symbols containing characters requiring quoting are compatible among all modes.


XLISP-PLUS - Version 2.1g - Tom Almy tom.almy@tek.com - 18 JUL 94
Generated with
WebMaker