When I say that we attempt to map the characters as closely as possible, I mean that given a character with a certain numerical code, we attempt to display a character that looks as much as possible like the IBM PC character with that same numerical code. On the other hand, we have no way to translate string characters appearing in your source code. What do I mean by this? Well, consider the character 'é'. This happens to correspond to character 0x82 in the IBM PC character set. Suppose you have source code like this:
putch ('é'); /* bad! */
putch (0x82); /* good! */
What makes the first of these two lines "bad" is that the numerical code which the compiler creates for 'é' is based on the character sets and languages installed on the computer doing the compiling, and is very likely not 0x82. So the first form is almost guaranteed not to work properly. Even so, calling the second form "good" is stretching a point, because (as it happens), the TurboC library isn't presently able to display the character 'é' anyway. True Turbo C is able to display any of the characters in the IBM PC character set -- i.e. the standard printable 7-bit ASCII characters, plus additional characters in the numerical ranges 0-31 and 128-255. However, the TurboC library does not fully support this capability in text mode, because the ncurses library does not. A subset of the IBM PC character set is supported, including linedraw characters. (However, all linedraw characters representing double-lines or combinations of double/single lines are represented simply in terms of single lines.)
True Turbo C | TurboC library |
(Click here to see the program that generated this output.) As you may notice, non-supported characters are rendered as dots. Actually, this can be changed within the ported program to any other character as follows:
/*If this still isn't good enough for you, you can individually control the mapping of every character. For example:
Add this code prior to the FIRST use of any conio function.
The default character cannot be changed after initialization.
The values used are any integer character code recognized by
ncurses (NOT IBM PC character codes).
*/
extern gint DefaultChar;
DefaultChar = ' '; /* or whatever */
/*
Add this code AFTER the first use of textmode.
It will be overridden if placed BEFORE textmode.
*/
extern gint TranslatedChar[256];
TranslatedChar[0x9d] = 'Y'; /* support YEN as 'Y'. */
No comments:
Post a Comment