/* ix/MBox (rip_cmd.c) by Sylvio Runge 6/94

   This C source code contains the following functions:


###########################################################################
The basic syntax rules are as follows:

1.  A RIPscrip command line starts at the beginning of a line of
    text.  A RIPscrip command line moved to the middle of a line of
    text is treated as literal text. This prevents people inserting
    mischievous things in teleconference messages, or similar pranks.
    The only exceptions to this rule is stated below under item 6,
    "continuation of long lines", and item 12 "alternate RIPscrip
    starting sequences".

2.  A RIPscrip command line begins with an exclamation mark (!).

3.  Every RIPscrip command is preceded by the universal RIPscrip
    delimiter, vertical-bar (|)

4.  Individual RIPscrip commands may be combined on the same line
    providing they are separated by the vertical bar delimiter.

5.  RIPscrip commands or command lines may be split across multiple
    lines with a backslash (\) just before each split.  This helps
    RIPscrip commands conform to right margins and escape word
    wrapping.

          An example:

               !|c02|L02030405|P0901020102010201020102\
               0102010201020102

6.  RIPscrip must allow for normal text to be intermixed with
    RIPscrip commands.  If unrecognized text appears after a RIPscrip
    command, on the same line, the text is ignored (the command is
    not ignored).  A line that does not begin with "!|" is considered
    raw text and is routed to the TTY text window (see "8" below).

7.  RIPscrip makes provisions for a Graphical Window and a Text
    Window.  The Graphical Window is where all RIPscrip graphics
    appear.  The Text Window is where raw text appears.  Raw Text
    includes ANSI color and cursor movement codes (a subset of VT-100
    terminal emulation).

8.  The vertical bar (|) of a RIPscrip command can be followed by a
    level number.  If the 1st character after (|) is a numeric digit
    (1-9), then that's the RIPscrip Command Level.  If the very 1st
    character is NOT a digit 1-9, then it is the command type
    character and the command is a Level-0 command.  If the 1st
    character is a digit 1-9, and the second character is also a
    digit, then that defines a sub-level of a RIPscrip level.  For
    example:

          !|L     RIPscrip Level-0 Command "L"
         !|1L     RIPscrip Level-1 Command "L"
        !|15L     RIPscrip Level-1, sub-level 5 Command "L"

    Each of the above examples are unique commands not to be confused
    with each other.  You may continue the sub-levels up to a maximum
    level of 9 (e.g., !|123456789<cmd>").

9.  Every RIPscrip command includes a command type character.  In
    Level-0 commands, this character immediately follows the vertical
    bar.  At all other levels, it follows the level digits.  The
    command type character may be any printable non-decimal-digit
    character.

10. Following the command type character are 0 or more parameters.
    If the command requires a text-string, it is always the LAST
    parameter.  Numeric parameters DO NOT have any delimiters
    (commas, dashes, spaces, etc.).  A variable width numeric
    parameter may be used as the last parameter.  This allows for
    maximum efficiency.  Numbers are represented in base-36.  This
    compacts numbers down to roughly 3/5 of their decimal form.
    This numbering system, technically called "Hexa-Tri-Decimal",
    has affectionately been dubbed "MegaNums".  Unlike Hexadecimal
    which uses 0-9, A-F, MegaNums take advantage of the entire
    alphabet, using characters 0-9 and A-Z.

11. An exclamation mark (!) or vertical bar (|) character can appear
    in a RIPscrip text parameter by preceding it with a backslash(\).
    A literal backslash is represented with a double-backslash (\\).

12. A RIPscrip sequence CAN begin in a column other than column #0,
    if the exclamation mark prefix is replaced with a Ctrl-A (Start
    Of Header [SOH]) character, or Ctrl-B (STX) character.  Since
    99.9% of all BBS' do not allow users to enter most control
    characters, users will be unable to begin RIPscrip sequences in
    the middle of a command line.  Only the host should be able to
    do this.  This prevents people from cluttering  teleconference,
    or other areas of a host with spurious RIPscrip sequences.

13. If the last couple of bytes on a RIPscrip text line are           > v1.54
    backslashes, special care must be taken to make sure that they    > v1.54
    are not interpretted as a line-continuation.  If a literal        > v1.54
    backslash is desired as the last position on the line, it must    > v1.54
    be specified as a double-backslash (eg, "\\").  If a line-        > v1.54
    continuation is used then there would have to be three            > v1.54
    backslashes used on the line as in the following example:         > v1.54
                                                                      > v1.54
        !|@2233this is a text line with a literal \\\                 > v1.54
        used in the message                                           > v1.54
                                                                      > v1.54
    This would text output at (22,33) [meganum] the message:          > v1.54
                                                                      > v1.54
       this is a text line with a literal \used in the message        > v1.54
*/
