home *** CD-ROM | disk | FTP | other *** search
-
- Archimedes MUMPS v1.0 documentation
-
-
- PROGRAMMING ENVIRONMENT
-
-
- *UCI's*
-
- The MUMPS system is divided in so-called UCI's (User Class Identifiers).
- Each UCI has it's own set of routines and it's own databases. More than one
- user can be 'in' a UCI at the same time, using the same routines and
- databases. There is one 'system UCI' in which routines and data are kept
- that are global to all UCI's (initially, it is called "SYS"). For instance,
- the routine %RD (which displays a routine directory) resides in the system
- UCI. In fact, you are not allowed to save routines that start with a '%'
- unless you are in the system UCI, the same goes for databases that have
- names starting with '%'. However, every UCI has read-access to the system
- UCI.
-
- So, with UCI's you can have different database systems that do not interfere
- with one another, you can keep all routines and data specific to one
- database system together, separated from other database systems.
-
- When MUMPS is started you are requested to 'login'. This means that you have
- to specify a UCI in which you want to work. For instance, if you wanted to
- adapt the %RD routine you would login with "SYS:*", meaning that you want a
- programmer's shell in the UCI "SYS" (UCI names always are made up of three
- uppercase letters.) It is also possible to specify a routinename after the
- ':', in that case the routine will be started immediately, you will not
- enter a programmer's shell. For instance, to access your music collection
- database as a user (not a programmer, you do not want to edit routines,just
- use them!) you type "MUS:MUSIC"; this will run routine MUSIC in UCI MUS,
- assuming MUSIC and MUS exist and MUSIC is the routine you want (the main
- routine).
-
-
- *The programmer's shell*
-
- Assuming that you have logged in with a programmer's shell, what can you do
- next? MUMPS provides a prompt like this ('_' is supposed to represent the
- cursor):
-
- >_
-
- Since MUMPS is an interactive interpreter you can feed MUMPS commands to
- execute, like
-
- W !,12*12
-
- which will write a new line and then 144, as 12*12 equals 144. Or:
-
- F I=1:1:10,"Hello","World",20:1 W " ",I
-
- which will produce:
-
- 1 2 3 4 5 6 7 8 9 10 Hello World 20 21 22 23 24 25 26 27 28 29 30 31 32 33
- 34 35 36 37 38 39 40 41
-
- etc. on your screen. The last parameter in the FOR loop (yes, that's what it
- was!) specifies an endless loop, it just goes on adding 1 to I and printing
- I on the screen. You can interrupt this by typing <Ctrl-C> or <Ctrl-@>.
- Typing <Ctrl-C> or <Ctrl-@> always interrupts the foreground process. Ok,
- suppose you got fed up with the previous FOR loop after a few minutes and
- interrupted the process. What next?
-
-
- -Command history-
-
- If you now type "?" at the command line something like the following will be displayed:
-
- 0: W !,12*12
- 1: F I=1:1:10,"Hello","World",20:1 W " ",I
-
- Typing "?" at the command line produces the command history. It shows the
- last 10 different commands, longer than 3 characters, issued by you at the
- command line. It is possible to retrieve a previous command by type "!<n>",
- where <n> is the number of the command as displayed in the command history.
- So typing "!1" will insert the FOR loop command(s) into the MUMPS
- inputbuffer. When a previous command is retrieved, the cursor is positioned
- at the end of the displayed text. Pressing <Enter> (or <Return> or whatever)
- will execute the command again.
-
-
- -Edit keys-
-
- When typing commands at the command line there are several 'edit-keys'
- available:
-
- <Ctrl-U> : empty the command line
- <Ctrl-A> : move cursor to start of line
- <Ctrl-Z> : move cursor to end of line
- <Ctrl-K> : move cursor one character to the left
- <Ctrl-L> : move cursor one character to the right
- <Backspace> or <Del> : delete character to the left of cursor
-
-
- -Routines-
-
- What do MUMPS routines look like? Well, just like a normal sequence of
- commands you can type at the command prompt, preceded by a 'line start
- character', optionally preceded by a label for referencing the line in the
- routine. Example:
-
- FNAME R !,"First name? ",NM Q:NM?1.U W " Enter your name!" R *R G FNAME
-
- "FNAME" is called the 'label' of the line. Just after it there's a <TAB>
- character which is called the 'line start character'. After that, normal
- MUMPS commands follow. A ';' character when typed where you can type a
- command, introduces a comment, for example:
-
- K ^OLDDATA ; delete old data
-
- The previous line does not have a label, but it *does* have a line start
- character! and a comment, of course.
-
-
- -Entering and listing routines-
-
- Entering routines is only possible when you are in a programmer's shell. If
- the first 'white space' character in the line you typed is a <TAB>
- character, the line is inserted in the routine just after the last line
- entered, or as the first line if no previous lines were entered. To get a
- listing of your routine, just type "P". "P" is short for PRINT, which is a
- non-standard MUMPS command that lists the routine currently in memory. The
- first line of a program must always be entered in the above described way!
- Conventionally, it has the following form:
-
- Program name<TAB>;Programmers initials/name;date;Description of routine;
-
- For instance:
-
- MUSIC ;HHV; 20 Feb 1992 ;Main routine music database;
-
- The ';' after the <TAB> is important, because it introduces a comment! If it
- is omitted, "HHV" will be interpreted as a command and generate an error.
-
- Usually, it is more convenient to use a routine editor. The supplied editor,
- %ED, is an excellent line editor and simplifies editing programs
- considerably. You can invoke %ED by typing "X ^%" at the command line. Full
- help on the editor is available in the editor itself, just type a "?" after
- the ">>"-prompt.
-
-
- -Saving routines etc.-
-
- If you've entered a routine, save it by typing "ZS" (short for ZSAVE). The
- routine will be saved in the current UCI and the name of the routine will
- be the same as the label of the first line in the program. If any errors
- occur when saving (the routine is checked for syntax errors) you will be
- told so and warned that the executable version of your routine is not saved!
- This means that you can't run the program yet, but you're 'source code'
- will be save (assuming no other serious errors occur), so don't worry!
-
- Removing a routine from memory is done with the "ZR" command. To load a
- routine from disk use: "ZL <routine name>". Typing "ZL MUSIC" will load the
- routine MUSIC in memory, ready for editing again.
-
-
- -Obtaining a routine directory and deleting routines-
-
- Typing "D ^%RD" at the ">"-prompt will display a routine directory of the
- UCI you're in. If you would want to delete a routine from disk, you would
- type "ZD <routine name>".
-
-
- *Halting MUMPS*
-
- ****************************************************************************
- * *
- * IIIII MM M MM PPP OOO RRR TTTTTTT AAA N N TTTTTTT *
- * I M M M M P P O O R R T A A NN N T *
- * I M M M P P O O R R T AAAAA N N N T *
- * I M M PPP O O RRR T AAAAA N NN T *
- * I M M P O O R R T A A N N T *
- * I M M P O O R R T A A N N T *
- * IIIII M M P OOO R R T A A N N T *
- ****************************************************************************
-
- It is very important that MUMPS is halted in a decent way, namely by
- issuing a ZH command (ZHALT) or by logging in with the login name "STOP"!
- If MUMPS is shut down by any other means (mains switch/RESET
- button/Ctrl-Alt-Delete or whatever) the CHANCE that the database will be
- CORRUPT is VERY BIG ! MUMPS uses buffers for data stored on disk in main
- memory to reduce access times. These buffers *can* be modified and ZHALT
- makes sure that all modified buffers are written to disk. (The MUMPS system
- manager updates the modified blocks every second, so only very recent
- updates in the database lead to modified buffers in memory. Usually, if you
- don't see the disklight for several seconds, there are no modified buffers
- in the system. However, this still does *NOT* mean that it is safe to quit
- MUMPS in an MUMPS unfriendly way !!!)
-
-
- *System utilities supplied with MUMPS*
-
- There are several utilities already installed in MUMPS. ***!!! They are
- copyright of the programmer !!!***. Whenever a selection of routines or
- globals has to made, they may be specified using the wildcard "*", for
- instance, "V*" selects all routines whose name starts with a "V".
- Routines/globals can be deselected by preceding the specification with a "-"
- ("-V*", for instance). Entering "^L" displays a list of already selected
- routines/globals. Entering "^D" displays a directory of routines/globals.
- The system utilities are:
-
-
- %DAT
- - (Dutch) converts the variable %TUM to textual format in the variable
- %DAT. For example, if %TUM=55459 then %DAT will be "3 Nov 1992". There are
- other entrypoints for %DAT that produce different results:
-
- ^%DAT : 3 Nov 1992
- C^%DAT : 03-11-92
- D^%DAT : Di, 3 Nov 1992
- Z^%DAT : 031192
-
-
- %ED & %EDT
- - Routine editor. If you type "D ^%ED" in the system UCI, a global ^% will
- be created that contains the routine editor in executable form. Start the
- routine editor (in any UCI) with "X ^%". Full help is supplied on-line in the
- editor.
-
-
- %FL
- - Produces a list of the first lines of all routines in the current UCI
-
-
- %G
- - The Global Viewer/Editor. Start %G by typing "D ^%G". Enter a "?" for a
- directory of globals defined in the UCI you're in. Enter "??" for help with
- the Global Viewer/Editor.
-
-
- %GD
- - Gives you a global directory.
-
-
- %GDEL
- - Deletes specified globals.
-
-
- %GR
- - Restores globals from a file saved by %GS.
-
-
- %GS
- - Saves selected globals to a file.
-
-
- %GSEL
- - Selects globals and puts selected globalnames in ^UTILITY($I).
-
-
- %RD
- - Gives a routine directory.
-
-
- %RDEL
- - Deletes specified routines.
-
-
- %RR
- - Restores routines from a file saved by %RS.
-
-
- %RS
- - Saves selected routines into a file.
-
-
- %RSE
- - Finds a string in a selection of routines.
-
-
- %RSEL
- - Selects routines and puts selected routinenames in ^UTILITY($I).
-
-
- %TUM
-
- - (Dutch) performs the opposite action of %DAT, but has a lot of extra's.
- If %DAT is of the form "H"[+/-n], where n is a positive integer and [...]
- means that ... is optional, than today is specified with the optional
- offset. So, to make things clear, if %DAT="H+1", %TUM will be the internal
- MUMPS day-value that corresponds to 'tomorrow'. If you convert %TUM back to
- a %DAT value using ^%DAT, %DAT will be "4 Nov 1992", assuming that today is
- 3 Nov 1992.
- If you leave of the year in %DAT ("1-1") it is assumed you mean this year.
- %TUM will convert "1-1" into "1-1-<this year>".
-
- /* end of ProgEnv */
-