| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (10 out of 10)

Translating From the Gensym Character Set

Use the pseudocode procedure shown below as the basis for your own routine to translate a series of characters in the Gensym character set to characters in another format, such as the KS C 5601, JIS, ASCII, or ISO Latin-1 character sets. Alternatively, you can use the character set conversion functions described in Character Set Conversion Functions.

The following procedure should be used in a program that maintains an index into a string, beginning at character zero (0). The program calls this procedure to get the next character and to update the index, based on how many characters were used to represent the Gensym character set character.

This pseudocode procedure gets the character code for the Gensym character set character at position i in string s; that is, s(i).

  1. Let c be the character s(i). Let i = i + 1.

  2. If:

    Otherwise, return the ASCII character code for c. The result is an ASCII-encoded character.

  3. If:

    Otherwise, return the character code or codes for the character that c corresponds to in the table Encoding for ASCII and Special Characters. This result might be in ASCII or in some other (undefined) character encoding. Note that the characters ~ @ and \ are included in this set.

  4. If:

    Otherwise, let d1 = the character code for c, let d2 = the character code for s(i), let i = i + 1, and return the result of the following formula:

    The result is a JIS-encoded character.

  5. Return the code for c. The result is an ASCII-encoded character.

When this procedure completes, the index i points either to the next possible character or to the end of the string s.

| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (10 out of 10)

Copyright © 1997 Gensym Corporation, Inc.