REF MISHAP_CODES          A.Law, A.Sloman, S.Hardy, R.Barrett, A.Morris,
                      J.Laventhol, J.Gibson & I.Rogers : Feb 82 - Aug 90
                                            Updated Adrian Howard Sep 90

       COPYRIGHT University of Sussex 1990. All Rights Reserved.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<                             >>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<         MISHAP CODES        >>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<                             >>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Some mishap messages  start with a  string of characters  representing a
code for the error. This file  contains a summary of those codes,  and a
fuller explanation of their meaning. The system specific error codes are
given separately  from  those which  are  common to  the  entire  Poplog
system.

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

  1   General error codes

  2   X Windows error codes

  3   System dependent error codes



----------------------
1  General error codes
----------------------

crsv                                                        [error_code]
can't restore saved image
        The mishap

            crsv: CAN'T RESTORE - NOT SAME SYSTEM AND VERSION

        means that a saved image  cannot be restored because the  Poplog
        system on which the  image was built is  different from the  one
        you are  trying to  restore it  into, i.e.  it has  a  different
        pop_system_version string.

        In VMS Poplog, the mishap

            crsv: CAN'T RESTORE - VMS SHAREABLE IMAGES HAVE EXPANDED,
                    NEED TO REBUILD SAVED IMAGE

        occurs because  the size  of the  VMS shareable  images used  by
        Poplog is greater in the current  version of VMS than it was  in
        the version  under  which the  saved  image was  built,  and  an
        insufficient expansion margin was allowed. The mishap prints out

            INVOLVING: 'expansion margin allowed A%, needed N%'

        where A  was the  expansion margin  allowed for  when the  saved
        image was built,  and N is  the minimum margin  that would  have
        actually  been   needed  for   the   saved  image   to   restore
        successfully. (The margin can be specified via the logical  name
        "pop_shrim_margin" -- see REF * SYSTEM.)

        For further information on saving and restoring images, see  the
        following  HELP  files:  * SYSSAVE  * SYSRESTORE   * SYSSAVEINCR
        * SYSRESTOREINCR. Also see REF * SYSTEM.


enp                                                         [error_code]
executing non-procedure
        This error message can result  from mistyping a procedure  name,
        calling a procedure before you've defined it, or using the  same
        identifier for  the  name of  a  procedure and  for  some  other
        purpose.


ica                                                         [error_code]
incorrect item after <prefix_op>
        An incorrect  type occurs  after  prefix_op. For  example,  in a
        list, the symbol ^ can only be followed by a word, and not,  for
        example a number or string (See HELP * ARROW).

        Another example of this error can be got from the nonop operator
        (see HELP * NONOP). If you wish to use an infix operation,  e.g.
        + or >  as an identifier  referring to the  procedure, then  you
        have to prefix it  with nonop. If the  wrong sort of  identifier
        follows nonop, you'll  get this error  (i.e. what follows  nonop
        must have been declared as an operator).


ine                                                         [error_code]
identifier name expected [after <prefix_op>]
        A special case of ica where  the item expected is an  identifier
        name, e.g. in an identifier declaration statement, or following
        ident, etc.


ids                                                         [error_code]
incorrect define syntax
        You've probably left out one of the parentheses, e.g.

            define silly(x,y;

        or used a semi-colon instead of a comma, e.g.

            define silly(x;y);

        or inadvertently  used a  syntax word  as one  of the  input  or
        output variables in a procedure definition, e.g.

            define silly(x, until);

            define silly(x, y) -> until;

        in which case the error message will, somewhat misleadingly  say
        "(nothing after -> or =>)" or left the semi-colon off the end of
        the procedure heading so that  Pop-11 thinks that the  following
        items are being declared as variables, e.g.

            define silly(list)
                vars x

        Pop-11 thinks vars is being used as one of the variables in  the
        procedure  heading  and  complains.   See  also  REF * IPS   and
        REF * IDW.


idw                                                         [error_code]
illegal declaration of word
        This can be due to several different mistakes:

            (1) You've tried to declare and use as a variable a word
                which already is a 'protected' Pop-11 system word. E.g.
                try

                    vars length;

            (2) You've left the semi-colon off the end of a vars
                statement, so that Pop-11 thinks the next item is also
                part of the declaration, e.g. type in:

                    vars x
                    [a list of words] -> x

            (3) Like (1) except that you've used the variable as one of
                the formal parameters (input variables) or output locals
                of a procedure heading. E.g. try:

                    define silly(in) -> out;

                in is a 'syntax' word, used in the 'loop' construct:

                    for variable in list do ... endfor,

                so using in, (or for, or do, or endfor) as a variable
                will cause an error.

        Alternatively, you may have put square brackets round the formal
        parameter, because you expect the argument to be a list, e.g.

                define silly([list]);

        Pop-11 thinks you  are trying  to use  `[` and  `]` as  variable
        names. (You  provide  the  square  brackets  when  you  RUN  the
        procedure, not when you define it).

        Or you may have tried to define a procedure with a name which is
        already a Pop-11 word, e.g.

                define front(list);

        See also REF * IDS -- 'Incorrect define syntax'.


iue                                                         [error_code]
impermissible update expression (e.g. after -> or ->>)
        This error  message will  occur  if you  follow either  kind  of
        assignment arrow with an expression which is not permissible  in
        that context,  i.e.  that does  not  have an  interpretation  in
        'update' mode. Examples:

            99 -> 100;
            3 -> [X];
            X -> Y and Z;


ips                                                         [error_code]
incorrect procedure syntax
        You've probably left out one of the parentheses, e.g.

            procedure (x,y;

        or used a semi-colon instead of a comma,

            procedure (x;y);

        or left the semi-colon off the  end of the procedure heading  so
        that Pop-11 thinks that the  following items are being  declared
        as variables, e.g.

            procedure (list)
                vars x

        Pop-11 thinks VARS is being used as one of the variables in  the
        procedure  heading  and  complains.  See  also  HELP * IDS   and
        HELP * IDW.


iqw                                                         [error_code]
incorrect quoted word
        You'll get  an error  message if  the word-quote  symbol (")  is
        followed by something that cannot be a word (see  HELP * WORDS).
        For instance, the following is an illegal expressions:

            vars ninenine = "99";


mcb                                                         [error_code]
missing closing bracket
        You will get this  error message when a  closing bracket of  the
        correct type  cannot  be found.  This  could be  caused  by  you
        missing the bracket completely, eg:

            [a list without a closing bracket -> foo;

        or or by using the wrong type, eg:

            {a vector with the wrong closing bracket] -> foo;


mei                                                         [error_code]
misplaced expression item
        This mishap occurs  when an incorrect  expression is found  when
        compiling a  Pop-11 program.  One way  this often  occurs is  by
        missing out a closing 'bracket' in an expression. For example

            repeat 5 times;
                /* blah... blah... blah... */
            endrepost;  ;;; typo in the "endrepeat"


msep                                                        [error_code]
missing separator
        This can happen  for a variety  of reasons. The  most common  is
        that you've forgotten to terminate  a command with a  semicolon.
        E.g:

            vars list;
            [a list of words] -> list
            list =>

        The second line should have a semi-colon after "list".

        Because Pop-11 treats  line breaks as  equivalent to spaces,  so
        that you can  type long  commands going over  several lines,  it
        doesn't  realise  that  the  command  on  the  second  line  was
        complete. So it continues  trying to read  a command, and  finds
        that the word 'list' occurs twice with nothing in between, which
        is not permitted.

        Another way  to  get this  mishap  is to  type  square  brackets
        instead of round ones after a procedure name, e.g.

            replyto [I like you];

        instead of

            replyto( [I like you]);

        See HELP * SEMICOLON, * PRINTARROW


msw                                                         [error_code]
misplaced syntax word
        This sort of mishap can occur when you have a 'closing  bracket'
        missing,   or   perhaps   a   surplus   closing   bracket   (See
        TEACH * BRACKETS). For example, the following will produce a MSW
        mishap:

            repeat;
                /* do something */
            endwhile;   ;;; wrong closing bracket


ndb                                                         [error_code]
no define before line <number>
        This error  message  is produced  by  the VED  ENTER  mcp  (Mark
        current procedure)  routine i.e.  ved_mcp ,  or its  derivatives
        (ved_jcp -  Justify current  procedure, ved_lcp  - load  current
        procedure).

        ved_mcp searches backwards from  the current line looking  for a
        line starting  with define.  To do  this it  uses ved_mbp  (Mark
        beginning of procedure).  If it  doesn't find such  a line,  the
        error message is  produced. For more  information about  marking
        ranges in ved see HELP * MARK.


pvn                                                         [error_code]
procedure or vector needed in vedfiletype
        This mishap is caused by giving an item that is neither a vector
        nor a  procedure as  the action  part of  an entry  in the  list
        vedfiletypes  or   in   the   list  given   to   the   procedure
        vedsetfiletypes. See HELP * VEDFILETYPES.


rle                                                         [error_code]
recursion level exceeded
        If you  call a  procedure which  calls itself,  then there  is a
        danger that the calls will  go on indefinitely. You'll then  get
        'recursion level  exceeded'. The  way to  stop this  is for  the
        procedure to  check whether  some  stopping condition  has  been
        reached, and if so, not call itself again.

            For example  here  is a  procedure  which adds  up  all  the
        numbers up to the given NUM.

            define addup(num) -> total;
                if num = 0 then
                    0 -> total
                else
                    addup(num - 1) -> total;
                    total + num -> total
                endif
            enddefine;

        If you trace that procedure and  give it 5 as input, you'll  see
        how it calls  itself with  num getting smaller  and smaller.  It
        stops when the number = 0.

            trace addup;
            addup(5) =>

        However, if you  give it a  decimal number, then  the number  is
        never = 0, so the recursive calling can go on and on, and you'll
        have to interrupt with CTRL-C. Try it.

            addup(5.3) =>

        If you UNTRACE ADDUP; and do  it again, then there won't be  any
        print out,  but  after  a  while the  recursion  level  will  be
        exceeded.  You'll  get  a  long  error  message  which  you  can
        interrupt   with   CTRL-C.   See   HELP * POP_CALLSTACK_LIM   on
        controlling the maximum depth of recursion


rom                                                         [error_code]
soft/hard memory allocation exceeded
        This mishap divides up into two basic types:

            ROM: MEMORY LIMIT (popmemlim) EXCEEDED (<DOING>)
                This error means that the 'advisory' limit given by  the
                variable popmemlim  has been  exceeded (the  purpose  of
                this limit being simply to prevent runaway expansion  of
                memory  by  a  buggy  program,  or  to  contain   memory
                expansion so  that garbage  collections don't  take  too
                long). Its default is 100000  words, but you can set  it
                as high as you want.

            ROM: NO MORE MEMORY AVAILABLE (<DOING>)
                This second error  is more serious,  and means that  you
                have actually  exhausted all  the memory  the  operating
                system is  willing  (or able)  to  give to  your  Poplog
                process.

        The DOING part of the mishap tells you when the error  occurred.
        For example if DOING mentioned  the heap space, then the  memory
        limit was probably exceeded when space was being allocated for a
        structure. See HELP * POPMEMLIM, REF * SYSTEM for more details.


rvl                                                         [error_code]
recursive_valof looping
        Recursive_valof applies  * valof to  X while  X is  a word,  and
        returns the result. The * mishap can be caused by applying it to
        a variable whose value is a word with the same name, e.g.:

                vars d = "d";
                recursive_valof(d) =>

        Also see HELP * valof.


spn                                                         [error_code]
string or procedure needed in vedfiletypes
        This mishap is produced by vedsetfiletypes if it finds something
        other than a string or procedure  as a "bottom level" file  type
        specification, when interpreting  the condition of  an entry  in
        the vedfiletypes list. See HELP * vedfiletypes.


ste                                                         [error_code]
stack empty (missing argument? missing result?)
        Procedures get their  inputs (arguments)  via a  portion of  the
        computer memory called the stack. They also leave their  results
        there. If  a procedure  is not  provided with  enough inputs  it
        takes what it can, then complains stack empty. E.g. try

            matches [a list] =>

        Matches needs two inputs, and here it has only one, so you get a
        mishap.

            Also if a procedure should have produced a result because it
        was to be used in another procedure, then a mishap will occur if
        the result is not found on the stack. E.g. you can have a string
        of IF THEN  ELSEIF THEN... conditions  and if there  is no  ELSE
        case, then  if none  of the  conditions is  true, no  result  is
        produced.

            Aside from this, a 'stack empty' mishap will arise if a SEGV
        (Segmentation Violation)  signal occurs.  This may  account  for
        certain 'stack empty' mishaps during the execution of  incorrect
        externally   loaded   routines.   See   TEACH * STACK   for   an
        introduction to the stack.


sts                                                         [error_code]
structure too short
        This mishap message occurs when an attempt is made to  specify a
        portion of  a  structure  which is  larger  than  the  structure
        itself.  Typically,  asking  for  the  first  N  elements   of a
        structure which has length less  than N will cause this  mishap.
        For example

            allbutfirst(5, 'four') =>

        The  string  'four'   is  a   structure  of   only  4   elements
        (characters), so attempting to specify more than 4 elements will
        cause a mishap.

            See  HELP * allbutfirst  and  * allbutlast  which   describe
        procedures that can produce  this error. Also see  HELP * length
        on finding the number of elements in a structure.


uts                                                         [error_code]
unterminated string
        This mishap is due to the  use of the "string quote"  character,
        ('). Often it is a result of trying to put an apostrophe  into a
        word, as in

            [I DON'T KNOW] =>

        See HELP * APOSTROPHE for more information on this.


vffn                                                        [error_code]
ved file or name needed
        Several ved procedures  (e.g. * vededitor, * vedpresent)  expect
        an argument which is either a ved file name (i.e. a string) or a
        ved file  structure. If  any  other item  is given  this  mishap
        message results.


vfn                                                         [error_code]
ved file needed
        This mishap is caused by giving an incorrect item as argument to
        a procedure that expects a ved file structure.


vln                                                         [error_code]
vector of length 2 or 3 needed in ved specification
        This mishap is produced  if an incorrect 'action'  specification
        is found in the list vedfiletypes or in a similar list given  to
        the procedure vedsetfiletypes. See HELP * VEDFILETYPES.


wft                                                         [error_code]
wrong file type in vedfiletypes
        This mishap  occurs when  an incorrect  file type  specification
        (i.e. a condition that  is not a string,  list or procedure)  is
        included in the  list vedfiletypes, or  in a list  given to  the
        procedure vedsetfiletypes. See HELP * VEDFILETYPES.




------------------------
2  X Windows error codes
------------------------

Programs using the Poplog/X interface  may generate the following  error
codes:


xte                                                         [error_code]
x toolkit error
        This mishap  will  be  generated  by a  call  to  XtErrorMsg  or
        XtError, and indicates that a non-recoverable error has  occured
        inside the x Toolkit. For errors generated using XtErrorMsg, the
        name and type of  the error message  is also reported.  Poplog's
        default response to this error is to generate a mishap.

        After such errors, the toolkit is left in an undetermined state,
        and  future   interactions  with   the   x  Toolkit   may   have
        unpredictable results.


xtw                                                         [error_code]
x toolkit warning
        This error code is used when one of the x Toolkit error handlers
        XtWarning or  XtWarningMsg  is  called. Poplog  prints  out  the
        warning  message  but  does  not  interrupt  the  program   that
        generated it.  Such  errors  often occur  when  you  specify  an
        invalid value  for a  resource,  or try  for example  to  call a
        callback list that doesn't exist.


xioe                                                        [error_code]
xlib io error
        This mishap arises when a fatal io error involving a  connection
        to an X Server has occured. This can happen when the  connection
        between  the  client  and  the  X  Server  is  terminated  using
        XKillClient (eg.  by  the  X  program xkill  or  by  the  window
        manager). Poplog's response to this is to destroy any X  Toolkit
        application context related to the display, and then to mishap.


xpe                                                         [error_code]
x protocol error
        This mishap code is used when an x operation has failed, and the
        x server has notified  Poplog of an  error. Such errors  usually
        occur when an invalid or null resource ID or XID is passed to an
        Xlib procedure. The operation is aborted, and information  about
        the request number,  the resource ID  invovled, etc. is  printed
        out. Although  the operation  is  not completed,  the  currently
        running program is not interrupted.




-------------------------------
3  System dependent error codes
-------------------------------

serr                                                        [error_code]
system errors
        There are two types of mishaps caused by system errors:

        SERR: SYSTEM ERROR
            This is the general mishap for any system error that Poplog
            cannot handle, for example an illegal instruction. This
            error should only happen in usual circumstances (using
            non-checking procedures for example).

            On Unix systems the mishap will appear under a message
            something like this:

                <<<<<<< System Error: Signal = 4, PC = 000A4712 >>>>>>>

            which gives the Unix signal number of the error, and the
            value of the program counter at the time. For more details
            of the use of Unix signals in Pop see REF * ASYNC and the
            Unix manual entries signal(3v) and sigvec(2).

        SERR: MEMORY ACCESS VIOLATION
            This mishap is a result of trying to change part of the
            Poplog system which you're not allowed to. You may be able
            to get around the error by making a copy of the item before
            altering it (see HELP * COPY).

            On Unix systems this mishap will usually be caused by signal
            11 (segmentation violation) and will appear under a message
            something like this:

             <<< Access Violation: PC = 4712, Addr = 0000, Code = 0 >>>

            giving various pieces of information about the state of the
            machine at the time of the error (probably of no use to the
            average user).



--- C.all/ref/mishap_codes
--- Copyright University of Sussex 1991. All rights reserved.
