std-mumps@plus5.UUCP (10/23/84)
From: Hokey (The Moderator) <std-mumps-request@plus5.UUCP>
Ansi MUMPS digest Monday, 22 Oct 1984 Volume 1 : Issue 4
Today's topics:
Next MDC meeting
MUMPS Variable Handling
----------------------------------------------------------------------
Date: Mon Oct 22 22:57:12 CDT 1984
From: hokey@plus5.uucp
Subject: Next MDC meeting
The next meeting of the MUMPS Development Committee will be held in
Washington DC:
9:00A Thursday - 3:00P Friday, November 8-9
in the Humphrey Building, room 503-529A,
3rd and Independence, SW
Thomas Salander writes:
Please note that security at this building has been increased
and that the management has asked for a list of names for entry
control at the door.
If you want to go and are not expected, you might want to contact Thomas
at 301-955-6533. I would hope that others would be allowed into the
building for the meeting, but who am I to say!
------------------------------
Date: Monday, 22 Oct 1984 13:46:48-PDT
From: gallagher@nimbus.DEC
Subject: MUMPS Variable Handling
*****************
* d i g i t a l * INTEROFFICE MEMORANDUM
*****************
TO: MDC DATE: 19-OCT-84
FROM: Jack Bowie
DEPT: MSG Engineering
EXT: 231-2361
LOC/MAIL STOP: MRO3-2/H7
SUBJECT: MUMPS Variable Handling
The enclosed memo is an attempt to describe the
semantics of MUMPS symbol operations. The model
presented is not meant to be an implementation
technique. It is an effort to describe the real actions
of our new language features, e.g. NEW and parameter
passing. Please review this suggestion for discussion
at the upcoming MDC meeting.
MUMPS SYMBOL HANDLING
The association between MUMPS local variable names (lvn)
and their values can be represented as a relationship
between two conceptual tables, the Name Table and the
Value Table. All operations involving variable
manipulation can be explained in terms of actions on
these tables. The Name Table contains the names of all
variables "known" in the current environment. It is
composed of entries which contain the variable name and
a Value ID (VID). The VID is an identifier which is
used as a key into the Value Table. VID's are generated
sequentially (see below) and are unique throughout any
process lifetime. The Value Table contains the values
of all variables for the process. Entries in the Value
Table contain a VID, a reference count and an associated
MUMPS data value (string). A special value,
"undefined", may replace the MUMPS value.
1. Both tables are initially empty.
2. When a SET command is executed the following steps are
performed:
A. The Name Table is searched for an entry which contains the
specified (l.h.s.) variable.
B. If an entry is found, then the Value Table is searched for
the entry containing the associated VID, and the value of
this entry is updated to that specified in the command.
C. If a Name Table entry is not found, an entry is created
containing the variable name and a new (unique) VID. A new
entry is also made in the Value Table containing the VID, a
reference count of one, and the value specified in the
command.
3. Whenever the value of a variable is needed, the Name Table is
searched for an entry containing the specified variable name.
If the name is not found, the value is said to be undefined.
If the name is found, the Value Table is searched for the
entry containing the VID that was associated with the name.
The value in this entry (which may be the "undefined" value)
is returned as the value of the variable name. If this value
is "undefined" and the reference count in the Value Table
entry is one, both the Name Table entry and the Value Table
entry may be deleted.
4. When an inclusive KILL command is executed, the Name Table is
searched for entries containing either the specified variable
name, or one of its descendents. For each such entry found,
the following steps are performed:
A. The Value Table is searched for the entry containing the
VID that was associated with the Name Table entry.
B. The reference count for this entry is reduced by one.
C. If the count goes to zero, both the Name Table entry and
the Value Table entry are deleted.
D. Otherwise, the value in the Value Table entry is set to the
"undefined" value.
5. The operation of an exclusive KILL command is similar to that
of the (inclusive) KILL except that the KILL operation
described above is applied to every entry in the Name Table
except those specified in the command argument or their
descendants.
6. The KILL-all command applies the above KILL operation to all
entries in the Name Table.
7. When an inclusive NEW command is executed a NEW-frame is
placed on the control stack. This frame contains the NEW
argument and a set of Name Table entries. The Name Table is
searched for entries containing either the specified variable
name or one of its descendants. For each such entry, the
entry is copied into the NEW-frame and then deleted from the
Name Table.
8. The operation of the exclusive-NEW command is similar to that
of the (inclusive) NEW except that the Name Table entries
placed in the NEW-frame (and then deleted) are those except
the ones specified in the command argument or their
descendants.
9. The argumentless NEW command applies the above NEW operation
to all entries in the Name Table.
10. The execution of an XECUTE command or an explicit or implicit
DO command causes a DO-frame to be placed on the control
stack. This frame contains a descriptor of the current
execution location.
If the DO command contains parameters the following additional
steps are performed:
A. For each actual parameter an internal variable (indexed by
parameter position) is set to one of the following VID
values:
i. If the parameter is call-by-value a new Value Table
entry is created with a new VID, a reference count of
one and a value equal to that of the parameter. The
saved VID is the VID of the new entry.
ii. If the parameter is call-by-reference, the saved VID is
the VID in the parameter name's Name Table entry. If
the parameter name is not in the Name Table, a new Name
Table entry is created containing the parameter's name
and a new VID. A new entry is also made in the Value
Table containing the new VID, a reference count of one,
and the "undefined" value. In either case, the
reference count of the Value Table entry is then
increased by one.
B. An implicit NEW operation is performed on each of the
formal parameter names.
C. For each formal parameter name, a Name Table entry is
created containing that name and the VID from the
respective internal variable.
11. The execution of a QUIT command not in the scope of a FOR
causes successive frames to be popped off the control stack.
For each frame the following steps are performed:
A. If the frame is a DO-frame, QUIT processing is completed
and execution continues at the location specified in the
frame.
B. Otherwise, the original NEW command is retrieved from the
frame:
i. If the command was an inclusive NEW, then an implicit
inclusive KILL is performed on the NEW argument.
ii. If the command was an exclusive NEW, then an implicit
exclusive KILL is performed on the NEW argument.
iii. If the command was an argumentless NEW then an
argumentless KILL (KILL-all) is performed.
C. Finally, each New Table entry is retrieved from the frame
and restored to the Name Table.
------------------------------
End of Ansi MUMPS digest
*****************************
--
Hokey ..ihnp4!plus5!hokey
314-725-9492