home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-01 | 1.4 KB | 42 lines | [TEXT/R*ch] |
- HOW DO YOU DISPLAY NON-GRAPHIC CHARACTERS IN ABC?
-
- One aim of ABC is that ABC programs should work identically on all
- machines: there are no references to machine or architectural features
- in the language.
-
- Because different machines have different character sets, you can only
- directly represent ASCII characters in ABC programs, and only those
- characters have a guaranteed sorting.
-
- To ensure portability, you have to do a bit of extra work to use other
- characters. The usual method is something like this:
-
- abc -i characters < characters-file
-
- where characters-file is a file including (maybe as one line) all the
- characters you want to include.
-
- This then creates an ABC location containing the characters you want
- to use.
-
- If characters-file contains all the characters of your machine, spread
- over several lines, then you can do the following to find the minimum
- and maximum characters on your machine:
-
- PUT " ", " " IN minch, maxch
- FOR line IN characters:
- PUT min {minch; min line}, max {maxch; max line} IN minch, maxch
-
- Now the list {minch..maxch} will contain all the characters.
-
- Another, yet more portable, solution is to build a table mapping the names
- of the characters in some form to the characters themselves, and then
- use it like this:
-
- PUT char["TAB"] IN tab
- PUT char["ESC"] IN esc
- and so on.
-
- Beware! Character 0 is almost certain not to work, and will give odd
- results.
-