Search                        Top                                  Index
HELP ASCII                        A. Sloman and Steve Hardy, August 1982

THE REPRESENTATION OF CHARACTERS

         CONTENTS - (Use <ENTER> g to access required sections)

 -- Character codes in Pop11
 -- Codes for non-printing characters
 -- Codes for characters in strings
 -- Summary of ASCII codes
 -- Procedures that operate on characters
 -- See also


-- Character codes in Pop11 -------------------------------------------

POP11 uses the ASCII representation for characters, i.e. integers from 0
to 127. In order to make it unnecessary to remember the codes, the
following syntax is provided, using the "grave" symbol "`", not to be
confused with the string-quote symbol "'".

If the character "`" is immediately followed by any other character and
then another "`" , then the effect is exactly the same as if you had
typed an integer corresponding to the ascii code for the second
character. The code for an "a" is 97, so:

    `a` -> X; and 97 -> X;

are equivalent.

For consistency with earlier versions of POP11, the final "`" is
optional. However, it is generally clearer to include it.

The character quote character can itself be quoted thus:

    ``` =>
    ** 96


-- Codes for non-printing characters ----------------------------------

To get the codes for non-printing characters, an escape sequence is used,
using the backslash character "\" thus:

 ASCII Typed as     Represents
   32    `\s`       the code for a space
   13    `\r`       the code for a carriage return
   10    `\n`       the code for a line feed
    8    `\b`       the code for a back space
    9    `\t`       the code for a tab
   27    `\e`       the code for an escape
   92    `\\`       the code for the backslash itself

Note: `\`  and `\`` will be taken as equivalent to ```.

For other non-printing (control) characters, use \^ before the
appropriate letter, e.g.

        `\^a` or `\^A`   is CTRL-A   (ASCII 1)
        `\^b` or `\^B`   is CTRL-B   (ASCII 2)
etc.

Note that

        `\^H` is the same as `\b`   (backspace)
        `\^I` is the same as `\t`   (tab)
        `\^?` is the code for the DEL character (127).
etc.

Additional codes are available: "\" in conjunction with  "^" (up-arrow)
followed  by one of  the characters

                @  A-Z  [  \  ]  ^  _  ?

can be used to represent the control characters ASCII 0 - 31 and ASCII
127. E.g. ASCII 28 is `\^\`, ASCI 29 is `\^]`


-- Codes for characters in strings ------------------------------------

These conventions can also be used in strings. So to print a string
containing tabs and newlines you can use \n and \t in the string. (In
addition, to include the string quote character in a string, precede it
with the backslash "\", e.g. 'it\'s a string'.

A further convention allowed in strings is the representation of an
ASCII code by an integer between the brackets in \(..). E.g.

    '\(65)\(66)' =>

is equivalent to

    'AB' =>

Binary, octal or hexadecimal representations can be used for the
integers, as described in REF *ITEMISE. So

    '\(8:101)\(8:102)'

is also equivalent to 'AB'.


-- Summary of ASCII codes ---------------------------------------------

Here are the ASCII codes summarised. The symbol "^" preceding a
character indicates that the code is generated by holding down the CTRL
key and pressing that character (on most terminals).

0   ^@    16  ^P   32  \s   48  0    64  @    80  P    96  `    112 p
1   ^A    17  ^Q   33  !    49  1    65  A    81  Q    97  a    113 q
2   ^B    18  ^R   34  "    50  2    66  B    82  R    98  b    114 r
3   ^C    19  ^S   35  #    51  3    67  C    83  S    99  c    115 s
4   ^D    20  ^T   36  $    52  4    68  D    84  T    100 d    116 t
5   ^E    21  ^U   37  %    53  5    69  E    85  U    101 e    117 u
6   ^F    22  ^V   38  &    54  6    70  F    86  V    102 f    118 v
7   ^G    23  ^W   39  '    55  7    71  G    87  W    103 g    119 w
8   \b    24  ^X   40  (    56  8    72  H    88  X    104 h    120 x
9   \t    25  ^Y   41  )    57  9    73  I    89  Y    105 i    121 y
10  \n    26  ^Z   42  *    58  :    74  J    90  Z    106 j    122 z
11  ^K    27 <ESC> 43  +    59  ;    75  K    91  [    107 k    123 {
12  ^L    28  ^\   44   ,   60  <    76  L    92  \    108 l    124 |
13  \r    29  ^]   45  -    61  =    77  M    93  ]    109 m    125 }
14  ^N    30  ^^   46  .    62  >    78  N    94  ^    110 n    126 ~
15  ^O    31  ^_   47  /    63  ?    79  O    95  _    111 o    127 <DEL>

Note: the above representation for control characters is accepted in VED
search strings.


-- Procedures that operate on characters -------------------------------

The following procedures, documented in REF * STRINGS, perform various
operations on character codes:

    *ISALPHACODE
    *ISLOWERCODE
    *ISNUMBERCODE
    *ISUPPERCODE
    *LOWERTOUPPER
    *UPPERTOLOWER

-- See also -----------------------------------------------------------

HELP * STRINGS      - on rules for forming strings
HELP * APOSTROPHE   - use of apostrophes in POP-11 syntax
REF * ITEMISE       - more details on string expressions
REF * STRINGS       - procedures that operate on strings and characters
REF * VEDPROCS/Graphics   - graphics characters in Ved files
REF * VEDCOMMS/Attributes - bold/underline etc. characters in Ved files

--- C.all/help/ascii ---------------------------------------------------
--- Copyright University of Sussex 1991. All rights reserved. ----------