/MEng/System/Runtime/ASCII| ClassPath: | MEng.System.Runtime.ASCII | | Parent ClassPath: | MEng.Object | | Copyable: | No | | Final: | Yes |
MEng.System.Runtime.ASCII provides support for dealing with ASCII digits as binary data. Since CML is Unicode oriented, and so many device protocols have ASCII protocols, it is often convenient to treat their data as just binary data instead of text data. This class provides numeric literals for all of the ASCII codes, and methods to convert bytes holding ASCII decimal and hexadecimal digits to their binary values, and vice versa. Nested Classes:
Enum=ASCIIErrors
NotDecDig : "%(1) is not an ASCII decimal digit";
NotHexDig : "%(1) is not an ASCII hex digit";
EndEnum;This enumerated type defines the ASCII specific exceptions that this class can throw.
Literals:Card1 kNUL(0); Card1 kSOH(1); Card1 kSTX(2); Card1 kETX(3); Card1 kACK(6); Card1 kBEL(7); Card1 kBS(8); Card1 kTAB(9); Card1 kLF(10); Card1 kVT(11); Card1 kFF(12); Card1 kCR(13); Card1 kSO(14); Card1 kSI(15); Card1 kDLE(16); Card1 kDC1(17); Card1 kDC2(18); Card1 kDC3(19); Card1 kDC4(20); Card1 kNAK(21); Card1 kSYN(22); Card1 kETB(23); Card1 kCAN(24); Card1 kEM(25); Card1 kSUB(26); Card1 kESC(27); Card1 kDig_0(0x30); Card1 kDig_1(0x31); Card1 kDig_2(0x32); Card1 kDig_3(0x33); Card1 kDig_4(0x34); Card1 kDig_5(0x35); Card1 kDig_6(0x36); Card1 kDig_7(0x37); Card1 kDig_8(0x38); Card1 kDig_9(0x39); Card1 kChar_A(0x41); Card1 kChar_B(0x42); Card1 kChar_C(0x43); Card1 kChar_D(0x44); Card1 kChar_E(0x45); | Card1 kChar_F(0x46); Card1 kChar_G(0x47); Card1 kChar_H(0x48); Card1 kChar_I(0x49); Card1 kChar_J(0x4A); Card1 kChar_K(0x4B); Card1 kChar_L(0x4C); Card1 kChar_M(0x4D); Card1 kChar_N(0x4E); Card1 kChar_O(0x4F); Card1 kChar_P(0x50); Card1 kChar_Q(0x51); Card1 kChar_R(0x52); Card1 kChar_S(0x53); Card1 kChar_T(0x54); Card1 kChar_U(0x55); Card1 kChar_V(0x56); Card1 kChar_W(0x57); Card1 kChar_X(0x58); Card1 kChar_Y(0x59); Card1 kChar_Z(0x5A); Card1 kChar_a(0x61); Card1 kChar_b(0x62); Card1 kChar_c(0x63); Card1 kChar_d(0x64); Card1 kChar_e(0x65); Card1 kChar_f(0x66); Card1 kChar_g(0x67); Card1 kChar_h(0x68); Card1 kChar_i(0x69); Card1 kChar_j(0x6A); Card1 kChar_k(0x6B); Card1 kChar_l(0x6C); Card1 kChar_m(0x6D); Card1 kChar_n(0x6E); Card1 kChar_o(0x6F); Card1 kChar_p(0x70); Card1 kChar_q(0x71); Card1 kChar_r(0x72); Card1 kChar_s(0x73); Card1 kChar_t(0x74); | Card1 kChar_u(0x75); Card1 kChar_v(0x76); Card1 kChar_w(0x77); Card1 kChar_x(0x78); Card1 kChar_y(0x79); Card1 kChar_z(0x7A); Card1 kExclaim(0x21); Card1 kQuote(0x22); Card1 kPound(0x23); Card1 kDollar(0x24); Card1 kPercent(0x25); Card1 kAmpersand(0x26); Card1 kApostrophe(0x27); Card1 kOpenParen(0x28); Card1 kCloseParen(0x29); Card1 kAsterisk(0x2A); Card1 kPlus(0x2B); Card1 kComma(0x2C); Card1 kMinus(0x2D); Card1 kPeriod(0x2E); Card1 kSlash(0x2F); Card1 kColon(0x3A); Card1 kSemiColon(0x3B); Card1 kLessThan(0x3C); Card1 kEqual(0x3D); Card1 kGreaterThan(0x3E); Card1 kQuestion(0x3F); Card1 kAt(0x40); Card1 kOpenBracket(0x5B); Card1 kBackSlash(0x5C); Card1 kCloseBracket(0x5D); Card1 kCaret(0x5E); Card1 kUnderscore(0x5F); Card1 kGrave(0x60); Card1 kOpenCurly(0x7B); Card1 kVertBar(0x7C); Card1 kCloseCurly(0x7D); Card1 kTilde(0x7E); Card1 kDEL(0x7F); |
This class has a a large number of literals, to define all of the ASCII values. Note that they are in terms of Card1 values, because ASCII is not a valid text format in CML, which is purely Unicode oriented. These are intended to allow ASCII data to be manipulated as binary data mainly. Constructors:
Constructor(); There is only a default constructor. This class has no members of it's own and exists purely to provide some conversion routines and literals. The conversion routines operate only on passed in data, not on any state of this class, so all methods are const.
Final, Const Methods:
FromDecDigit([In] Card1 ToCvt) Returns MEng.Card1;
FromHexDigit([In] Card1 ToCvt) Returns MEng.Card1; These methods take an ASCII decimal or hexadecimal digit, in binary Card1 form, so a numeric value in the ranges 0x30..0x39, 0x41..0x46, 0x61..0x66, and converts it to it's binary form, i.e. a numeric value from 0..9 or 0..0xF. If the value is not a valid decimal in the indicated radix, then the NotDecDig or NotHexDig exception will be thrown.
IsDecDigit([In] Card1 ToCvt) Returns MEng.Boolean;
IsHexDigit([In] Card1 ToCvt) Returns MEng.Boolean; These methods check the passed Card1 value and returns a Boolean value to indicate if the passed value is a legal ASCII decimal or hexadecimal value.
ToDecDigit([In] Card1 ToCvt) Returns MEng.Card1;
ToHexDigit([In] Card1 ToCvt) Returns MEng.Card1; These methods take a numeric value from 0..9 or 0..0xF, and converts it to the appropriate ASCII digit, as a binary Card1 format. So 0 becomes 0x31, 9 becomes 0x39, 15 becomes 0x45 and so forth. If the value cannot be converted to an ASCII value in the indicated radix, then the NotDecDig or NotHexDig exception will be thrown.
|