Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 8

PtTerminalCharset_t, PtTerminalCharsets_t

Character sets used by PtTerminal

Synopsis:

typedef struct {
    const unsigned short *table;
    unsigned char first, last;
    …
    } PtTerminalCharset_t;

typedef struct {
    unsigned short from, to;
    } PtTerminalCharSubst_t;

typedef struct {
    PtTerminalCharset_t const *AnsiCharset;
    PtTerminalCharset_t const *InternalCharset;
    PtTerminalCharset_t const *FontTranslation;
    PtTerminalCharSubst_t const *Subst;
    unsigned short NumSubst;
    …
    } PtTerminalCharsets_t;

Description:

The PtTerminalCharset_t and PtTerminalCharsets_t structures define character sets used internally and externally by PtTerminal.


Note: Both structures have some undocumented members at the end, reserved for future extensions. To be safe, make sure that they're filled with zeros. The order of the documented members will stay the same — it's safe to initialize these structures statically.

A PtTerminalCharset_t structure defines an 8-bit character set by defining its mapping to Unicode. This is how this mapping can be expressed in C:

wchar_t unicode_value( unsigned char ch, 
                       PtTerminalCharset_t const *cs ) {
wchar_t result;

if ( ch < 0x80 )
   return ch; /* ch is an ASCII character */
else {
   if ( ch >= cs->first && ch <= cs->last
        && ( result = cs->table[ cs - cs->first ] ) != L'\0' )
      /* ch is mapped to a Unicode value */
      return result;
   else
      /* ch is an illegal value */
      return NO_MAPPING_DEFINED;
   }
}

If a character set contains “illegal values”, they're displayed as blanks and are never generated from a key event. But in general, it's a good idea to avoid having illegal values in a character set — preferably, the internal character set should define all values from 0x80 to 0xFF and the ANSI character set should define all values from 0xA0 to 0xFF.

You can set AnsiCharset or InternalCharset (or both) to NULL; the function then uses the defaults (8859-1 for AnsiCharset and PC character set for InternalCharset). It's also possible to get to the actual tables that define the defaults by calling PtTerminalDefaultCharsets():

const PtTerminalCharsets_t *PtTerminalDefaultCharsets( void );

The FontTranslation defines the mapping from the internal character set to whatever character set your Photon font is using. In other words, if FontTranslation isn't NULL, PtTerminal uses the 16-bit code returned by:

unicode_value( internal_char, FontTranslation )

to display the 8-bit internal code internal_char. Note that if you want the widget to use Unicode, FontTranslation should point to the same character set as InternalCharset.

If FontTranslation is NULL, the font is assumed to be compatible with the internal character set, and no mapping is used.

The Subst field points to an array that lists character substitutions that the widget uses when a character is missing from the character set that it needs to be translated to. The array must be sorted with the respect to the from field. NumSubst defines the length of the array.

The situations where the substitutions are performed are:

Classification:

Photon

See also:

PtTerminal, PtTerminalDefaultCharsets()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 190

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/pt/ptterminalcharset_t.html on line 190