Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$STACK

1995 Version of ANSI (Equivalent to Current ISO Version) of Standard

7.1.5.19 $STack

$ST[ACK] ( intexpr )

This form returns a string as follows:

  1. If intexpr is –1, returns the largest value of intexpr for which the $STack function will return a non-empty value. Note: if $ECode is empty then $STack(–1)=$STack.
  2. If intexpr is 0 (zero), returns an implementation specific value indicating how this process was started.
  3. If intexpr is greater than 0 (zero) and less than or equal to $STack(–1) indicates how this level of the PROCESS-STACK was created:
    1. If due to a command, the commandword fully spelled out and in uppercase.
    2. if due to an exfunc or exvar, the string "$$".
    3. if due to an error, the ecode representing the error that created the result returned by $STack(intexpr).
  4. If intexpr is greater than $STack(–1), returns an empty string.

Values of intexpr less than –1 are reserved for future extensions of the $STack function.

$ST[ACK] ( intexpr , stackcodexpr )

    stackcodexpr::= expr V stackcode
    stackcode::=


PLACE
MCODE
ECODE



This form returns information about the action that created this level of the PROCESS-STACK as follows:

stackcodeReturned String
ECODE the list of any ecodes added at this level.
MCODE the value (in the case of an Xecute) or the line for the location identified by $STack(intexpr,"PLACE"). If the line is not available, an empty string is returned.
PLACE the location of a command at the intexpr level of the PROCESS-STACK as follows:
  1. if intexpr is not equal to $STack and $STack(intexpr,"ECODE") would return the empty string, the last command executed.
  2. if intexpr is equal to $STack and $STack(intexpr,"ECODE") would return the empty string, the currently executing command.
  3. if $STack(intexpr,"ECODE") would return a non-empty string, the last command to start execution while $STack(intexpr,"ECODE") would have returned the empty string.

The location is in the form:

   place SP + eoffset

    place::=

[ label ] [ + intlit [ ^ | environment | routinename
@


    eoffset::= intlit

In place, the first case is used to identify the line being executed at the time of creation of this level of the PROCESS-STACK. The second case (@) shows the point of execution occurring in an Xecute.

eoffset is an offset into the code or data identified by place at which the error occurred. The value might point to the first or last character of a "token" just before or just after a "token", or even to the command or line in which the error occurred. Implementors should provide as accurate a value for eoffset as practical.

All values of stackcode beginning with the letter Z are reserved for the implementation. All other values of stackcode are reserved for future extensions of the $STack function. stackcodes differing only in the use of corresponding upper and lower case letters are equivalent.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

This page most recently updated on 15-Nov-2023, 13:13:25.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)