Debian Codegraph @

terps/tads/tads3/include/charset.h

raw symbols SCIP
1 #charset "us-ascii"
2 #pragma once
3
4 /*
5 * Copyright (c) 2001, 2006 Michael J. Roberts
6 *
7 * This file is part of TADS 3.
8 *
9 * This header defines the CharacterSet intrinsic class.
10 */
11
12
13 /* include our base class definition */
14 #include "systype.h"
15
16 /*
17 * The CharacterSet intrinsic class provides information on character set
18 * translations and can be used to translate between the Unicode character
19 * set that the T3 VM uses internally for string values and the local
20 * character set or sets used for display, keyboard input, and file I/O.
21 */
22 intrinsic class CharacterSet 'character-set/030001': Object
23 {
24 /*
25 * Constructor:
26 *
27 * new CharacterSet(charsetName) - creates an object to represent the
28 * named local character set. Certain common character set names are
29 * built into the system:
30 *
31 * us-ascii - the plain 7-bit ASCII character set
32 *. latin1 - 8-bit Western Europe extended ASCII (also called ISO 8859-1)
33 *. utf-8 - Unicode UTF-8 (varying byte length Unicode encoding)
34 *. utf-16le - little-endian 16-bit Unicode
35 *. utf-16be - big-endian 16-bit Unicode
36 *
37 * You can extend this basic set using mapping files. You can create
38 * your own mapping files (see the System Manual to learn how), so
39 * there's essentially no limit to the character sets that TADS can
40 * work with. You'll probably never need to create your own custom
41 * mappings, though, because the standard TADS distributions include a
42 * large set of pre-built mappings that cover most systems currently in
43 * use. The standard set includes the various ISO 8859 variants, plus
44 * proprietary code pages for Windows, DOS, and Mac OS.
45 *
46 * If the named mapping doesn't exist, a CharacterSet object will still
47 * be created, but it'll throw an error (UnknownCharacterSetException)
48 * if you attempt to use it to perform any mappings. You can determine
49 * if the mapping exists with the isMappingKnown method.
50 */
51
52 /*
53 * Get the name of the character set. This simply returns the name
54 * that was given to construct the character set.
55 */
56 getName();
57
58 /*
59 * Determine if the mapping is known. This returns true if the
60 * character set has a known local mapping, nil if not. Note that it
61 * doesn't matter whether or not the character set is actually in use
62 * on the local platform; all that matters is that a T3 mapping file
63 * is available on this machine.
64 */
65 isMappingKnown();
66
67 /*
68 * Determine if a character or string of characters is mappable to this
69 * character set. If the input is an integer, it represents the
70 * Unicode character code for a single character; if the input is a
71 * string, each character in the string is checked. This returns true
72 * if every character given has a valid mapping in the local character
73 * set, nil if not. Note that if a string is given, and even one
74 * character is not mappable, this returns nil.
75 */
76 isMappable(val);
77
78 /*
79 * Determine if a character or string of characters is "round-trip"
80 * mappable to this character set. If the input is an integer, it
81 * represents a Unicode character code to be tested; if the input is a
82 * string, each character in the string is tested. Returns true if
83 * every character given has a valid round-trip mapping, nil if not.
84 *
85 * A character has a round-trip mapping if it can be mapped to this
86 * local character set and then back to Unicode to yield the original
87 * character. If a character has a round-trip mapping, then in general
88 * the character has an exact representation in the local character set
89 * (as opposed to an approximation: if 'a-umlaut' maps to a simple
90 * unaccented 'a', or to 'ae', then it has only an approximated
91 * representation).
92 */
93 isRoundTripMappable(val);
94 }
95