,MOD
- R 44X (11 April 1983) <PSL.NMODE-DOC>NM-CHARACTERS.ibm
PLA 97_LAS 80 0_FIR 2_INT 1 6.0_TYP 160 163 162 193_INP 12 101_MAR 2
,END
,PRO
201 OUT 160_202 OUT 163_203 OUT 162_204 OUT 193
205 INP 12 101_206 INP 12 102
,END
,DEFINE
 UNIT SPACE
 FUNCTION
,END

          201/NMODE Manual (Character Sets and Command Input Conventions)     Page 3-1


          202/3.  Character Sets and Command Input Conventions

            201/In this chapter we introduce the terminology and concepts used to talk
          about NMODE commands.  NMODE is designed to be used with a kind of
          keyboard with two special shift keys which can type 512 different characters,
          instead of the 128 different characters which ordinary ASCII keyboards can
          send.  The terminology of NMODE commands is formulated in terms of these
          shift keys.  So that NMODE can be used on ASCII terminals, we provide
          two-character ASCII circumlocutions for the command characters which are not
          ASCII.

          202/3.1  The 9-bit Command Character Set

            201/NMODE is designed ideally to be used with terminals whose keyboards have
          a pair of shift keys, labeled "Control" and "Meta", either or both of which
          can be combined with any character that you can type.  These shift keys
          produce  202/Control  201/characters  and 202/Meta 201/characters, which are the editing
          commands of NMODE.   We name each of these characters by  prefixing
          "Control-" (or "C-"), "Meta-" (or "M-") or both to the basic character: thus,
          Meta-F or M-F is the character which is F typed with the Meta key held
          down.  C-M-; is the Semicolon character with both the Control and Meta
          keys.  Control in the NMODE command character set is not precisely the same
          as Control in the ASCII character set, but the general purpose is the same.

            There are 128 basic characters.  Multiplied by the four possibilities of the
          Control and Meta keys, this makes 512 characters in the NMODE command
          character set.  So it is called the 512-character set, to distinguish it from
          ASCII, which has only 128 characters.  It is also called the 202/9-bit 201/character
          set because 9 bits are required to express a number from 0 to 511.  Note
          that the 512-character set is used only for keyboard commands.  Characters
          in files being edited with NMODE are ASCII characters.

            Sadly, most terminals do not have ideal NMODE keyboards.  In fact, the
          only ideal keyboards are at MIT.  On nonideal keyboards, the Control key is
          somewhat limited (it can only be combined with some characters, not with all),
          and the Meta key may not exist at all.  We make it possible to use NMODE on
          a nonideal terminal by providing two-character circumlocutions, made up of
          ASCII characters that you can type, for the characters that you can't type.
          These circumlocutions start with a 202/bit prefix 201/character; see below.   For
          example, to use the Meta-A command, you could type C-A.  On the hp9836,
          the key labelled tab sends C-and acts as a meta prefix.

            Both the NMODE 9-bit character set and ASCII have Control characters,
          but the 9-bit character set has more different ones.  In ASCII, only letters
          and a few punctuation marks can be made into Control characters; in the
          9-bit character set every character has a Control version.  For example, we
          have Control-Space, Control-1, and Control-=.  We also have two different
          characters Control-A and Control-a!  But they always do the same thing in
          NMODE, so you can ignore the distinction between them, unless you are doing
          customization.  In practice, you can forget all about the distinction between
          ASCII Control and NMODE Control, except to realize that NMODE uses some
          "Control" characters which ASCII keyboards cannot type.
          201/Page 3-2                   NMODE Manual (The 9-bit Command Character Set)


            We have given some command characters special names which we always
          capitalize.  "<CR>" or "Return" stands for the carriage return character,
          code 015 (all character codes are in octal).   Note that C-R means the
          character Control-R, never <CR>.  "Rubout" is the character with code 177,
          labeled "Delete" on some keyboards.  "Altmode" is the character with code
          033, sometimes labeled "Escape".  Other command characters with special
          names are Tab (code 011), Backspace (code 010), Linefeed (code 012), Space
          (code 040), Excl ("!", code 041), Comma (code 054), and Period (code 056).
          Control is represented in the numeric code for a character by 400, and Meta
          by 200; thus, Meta-Period is code 256 in the 9-bit character set.

          202/3.2  Prefix Characters

            201/A non-ideal keyboard can only send certain Control characters, and may
          completely lack the ability to send Meta characters.  To use these commands
          on such keyboards, you need to use two-character circumlocutions starting
          with a 202/bit prefix 201/character which turns on the Control or Meta bit in the
          second character.  The C-character turns on the Meta bit, so C-X can be
          used to type a Meta-X, and C-Control-O can be used to type a C-M-O.  C-is
          known as the 202/Metizer201/.  Other bit prefix characters are C-^ for Control, and
          C-Z for Control and Meta together.   Thus, C-^ < is a way of typing a
          Control-<, and C-Z < can be used to type C-M-<.  Because C-^ is awkward
          to  type  on most keyboards, we have tried to minimize the number of
          commands for which you will need it.

            There are two other prefix characters, Control-X and Meta-X which are
          used as the beginning of a large set of multi-character commands known as
          202/C-X commands 201/and 202/M-X commands201/.  C-X is not a bit prefix character; C-X A
          is not a circumlocution for any single character, and it must be typed as two
          characters on any terminal.  C-X actually runs the function 203/c-x-prefix201/, while
          M-X  runs  203/m-x-prefix201/.   Two  prefixes  which  are  also  used  are  ESC
          (203/esc-prefix201/) and C-] (203/lisp-prefix201/) (also called Lisp-).  Each of these is used
          with a small set of single character suffixes.  You can create new prefix
          characters when you customize.

          202/3.3  Commands, Functions, and Variables

            201/Most of the NMODE commands documented herein are members of this 9-bit
          character set.   Others are pairs of characters from that set.  However,
          NMODE doesn't really implement commands directly.   Instead, NMODE is
          composed    of    202/functions201/,    which    have    long    names    such   as
          203/move-down-extending-command 201/and which are programs  that  perform  the
          editing operations.   202/Commands 201/such as C-N are connected to functions
          through the 202/command dispatch table201/.  When we say that C-N moves the
          cursor down a line, we are glossing over a distinction which is unimportant
          for  ordinary  use,  but  essential  for  customization:  it  is  the  function
          203/move-down-extending-command 201/which knows how to move down a line, and
          C-N moves down a line 203/because 201/it is connected to that function.  We usually
          ignore this subtlety to keep things simple.  To give the extension-writer the
          information he needs, we state the name of the function which really does the
          work in parentheses after mentioning the command name.  For example: "C-N
          (203/move-down-extending-command201/) moves the cursor down a line".   In the
          NMODE wall chart, the function names are used as a form of very brief
          201/NMODE Manual (Commands, Functions, and Variables)                Page 3-3


          documentation for the command characters.  See Section 6.2 [Functions], page
          2.

            While we are on the subject of customization information which you should
          not be frightened of, it's a good time to tell you about 202/variables201/.  Often the
          description of a command will say "to change this, set the variable Mumble
          Foo".  A variable is a name used to remember a value.  NMODE contains many
          variables which are there so that you can change them if you want to
          customize.  The variable's value is examined by some command, and changing
          the value makes the command behave differently.  Until you are interested in
          customizing, you can ignore this information.  When you are ready to be
          interested, read the basic information on variables, and then the information
          on individual variables will make sense.  See Section 22.2 [Variables], page
          4.

          202/3.4  Notational Conventions for ASCII Characters

            201/Control characters in files, your NMODE buffer, or PSL programs, are
          ordinary ASCII characters.  The special 9-bit character set applies only to
          typing NMODE commands.  ASCII contains the printing characters, rubout,
          and some control characters.  Most ASCII control characters are represented
          in this manual as uparrow or caret followed by the corresponding non-control
          character: control-E is represented as ^E.

            Some ASCII characters have special names.   These include tab (011),
          backspace (010), linefeed (012), Return (015), altmode (033), space (040),
          and rubout (177).  To make it clear whether we are talking about a 9-bit
          character or an ASCII character, we capitalize names of 9-bit characters and
          leave  names  of  ASCII  characters  in  lower  case.   Note  that  the 9-bit
          characters Tab and Control-I are different, but the ASCII characters tab and
          control-I are the same.

            On the Dec-20 lines in files are separated by a sequence of two ASCII
          control characters, carriage return followed by linefeed.  This sequence is
          called 202/CRLF201/.  On the hp9836 lines in files are separated by other means.
          Normally, NMODE treats this two-character sequence as if it were a single
          character, a 202/line separator201/, linefeed.  A Return which is not part of a CRLF
          is called 202/stray201/.  NMODE usually treats them as part of the text of a line and
          displays them as ^Ms.

            Most control characters when present in the NMODE buffer are displayed
          with a caret; thus, ^A for ASCII ^A.  Rubout is displayed as ^?, because by
          stretching the meaning of "control" it can be interpreted as ASCII control-?.
          A backspace is usually displayed as ^H since it is ASCII control-H, because
          most displays cannot do overprinting.