home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / mumps / percentm.doc < prev    next >
Text File  |  1987-07-08  |  36KB  |  1,252 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                        John Lewkowicz
  9.        New York State College of Veterinary Medicine
  10.                      Cornell University
  11.                      Ithaca, N.Y. 14853
  12.  
  13.  
  14.                        Copyright 1986
  15.  
  16.  
  17.  
  18.  
  19.  
  20. Permission is hereby granted to  copy  and  distribute  this
  21. document  and  the  programs/data bases described herein for
  22. any non-commercial purpose. Any use  of  this  material  for
  23. commercial  advantage  without  the prior written consent of
  24. the author is prohibited.
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                         Introduction
  70.  
  71.      This utility package is a unified collection  of  MUMPS
  72. programs designed to aid programmers in developing and main-
  73. taining MUMPS programs  and  data  bases.  It  provides  for
  74. creating, editing, listing, saving, restoring and killing of
  75. both routines and globals in a single interactive package.
  76.  
  77. To invoke any of the utility functions, issue the command:
  78.                            DO ^%M
  79.  
  80. while in direct mode. The first time the program is  run  on
  81. any  system  it will automatically initialize all data bases
  82. and ask for various default conditions.
  83.  
  84.      This  package  was  designed  specifically  to  run  on
  85. MicroMUMPS  developed  at  UC  Davis  by Dr. Walters and his
  86. associates. It is written in standard MUMPS but makes use of
  87. many  special  Z-extensions to the language provided by that
  88. implementation. In addition, it  is  set  up  to  run  in  a
  89. single-user  environment,  since none of the scratch globals
  90. support multiple users.
  91.  
  92.      All programs and globals in the utility  package  begin
  93. with  the  characters  %M, as will any future extensions. No
  94. data bases are needed initially  since  any  necessary  ones
  95. (such  as  the  terminal  definition  global  %MTC)  will be
  96. created for you the first time the package is executed.  Try
  97. to  avoid  creating  programs  or routines starting with %M,
  98. since they might conflict with  future  expansions  of  this
  99. utility package.
  100.  
  101.      All terminal I/O (including Console,  Printer,  Sequen-
  102. tial MSDOS files, etc) is coordinated via a terminal defini-
  103. tion program and data base to  provide  considerable  device
  104. independence.  This package makes use of many special termi-
  105. nal characteristics (such as High and Low intensity) if they
  106. are  available.  You  can  use one of the initial options to
  107. define or modify new terminals and to tie a  given  terminal
  108. type  to a specific I/O port. The first time this package is
  109. run, neutral default definitions are used, but you can  pick
  110. the  Terminal  option to Define/Tie a new definition to your
  111. Console  or  Printer.  This  reconfiguration  will   improve
  112. interactions with the program.
  113.  
  114.      A special feature available when  Saving  or  Restoring
  115. either  Routines  or Globals is that they can be transmitted
  116. between computers by directing Input/Output of the Save file
  117. to MicroMUMPS device number 5.  The user need only establish
  118. a hardware link via the communications port and %M will han-
  119. dle all the rest.
  120.  
  121.  
  122.                            2
  123.  
  124.             
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132. MicroMUMPS Utilities                      Cornell University
  133.  
  134.  
  135.      %M also supports multiple  volume  global  saves  which
  136. permit  saving  large  data  bases  on  multiple floppy disk
  137. volumes. Routine saves are still output  to  single  volumes
  138. since it is assumed the programmer can subdivide routines to
  139. distribute them on more than one floppy disk.
  140.  
  141. Standard Conventions
  142.  
  143.      There are a number of keyboard and  name  specification
  144. standards  that  are  available in this package. Some of the
  145. conventions are always in effect (like ?  and  ??),  whereas
  146. others  (such  as  ?L)  are  only  available  when logically
  147. needed.
  148.  
  149. ? and ?? can be used to answer any question in  the  package
  150.    to  get  additional HELP on how to answer that particular
  151.    question. A single question mark (?)  will  get  you  one
  152.    line  of  abbreviated  help.  A double question mark (??)
  153.    will get you the same abbreviated HELP line together with
  154.    any extended help available.
  155.  
  156. ^       always lets you back up to the previous question  or
  157.    set of questions.
  158.  
  159. : and ::  Whenever you see a ":", in indicates that the pro-
  160.    gram  is  waiting  for  a  keyboard entry. A double colon
  161.    ("::") is displayed whenever a default  answer  has  been
  162.    supplied  for you. If a default answer has been supplied,
  163.    you can accept it by pressing the <RETURN> key.
  164.  
  165. "?L" can be entered (when appropriate) to  get  a  directory
  166.    listing  (either routines or globals depending on earlier
  167.    choices). This option is available on all routine or glo-
  168.    bal name specification questions.
  169.  
  170. "?S"    is similar to "?L" except that  it  lists  only  the
  171.    selected  routine  or  global  names  (more  on selection
  172.    later).
  173.  
  174.    Routine/Global Name entry -  when  selecting  routine  or
  175.    global  names  (i.e.,  to  flag them for listing, saving,
  176.    restoring, etc), you can either enter specific names (one
  177.    at  a time) or use the ``wild card'' characters ``*'' and
  178.    ``?''. The ? character in a name  represents  any  single
  179.    character,  whereas the * character represents any number
  180.    of characters. For example:
  181.  
  182.    ``A*B"  selects all names starting with ``A'' and  ending
  183.       with the character ``B'' regardless of name length.
  184.  
  185.    ``A?B'' selects all three-character names  starting  with
  186.       ``A'' and ending with ``B.''
  187.  
  188.   
  189.  
  190.                              3
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198. MicroMUMPS Utilities                      Cornell University
  199.  
  200.  
  201.    Combinations of the above are allowed, but avoid the spe-
  202.    cial  cases  of  ?,  ??,  ?L and ?S as they conflict with
  203.    other conventions already discussed.
  204.  
  205.    The ' (not) character is used to de-select  one  or  more
  206.    names from the list already specified. For example,
  207.  
  208.    A*      selects all names starting with ``A''
  209.    A1*     subsequently de-selects  all  names  within  that
  210.       subset that start with the characters A1.
  211.  
  212. Global Reference - when working on globals,  often  you  are
  213.    given  the option to specify an individual global or part
  214.    of a global. This option is  used  instead  of  the  name
  215.    question  to  permit  you  to  pick  individual  nodes or
  216.    branches of a global (e.g., to list or  edit  part  of  a
  217.    global)  rather  than  groups of global names (e.g., when
  218.    saving or restoring  globals).  When  entering  a  Global
  219.    Specification, the following rules apply:
  220.  
  221. NAME ONLY (^XYZ) implies that you want to process the entire
  222.       global
  223. FULL Reference (^XYZ(1,"ABC",2)) implies that  you  want  to
  224.       work on that node only.
  225. PARTIAL REFERENCE (^XYZ(1, or ^XYZ(1   )  implies  that  you
  226.       want to work on that node and all of its descendants.
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.                                4
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264. MicroMUMPS Utilities                      Cornell University
  265.  
  266.  
  267.               Functional Descriptions - Routines
  268. Directory
  269.       A directory of all  routines is  maintained  in  ^%MU.
  270. This directory is updated when editing, restoring or killing 
  271. routines. If you choose the option to refresh the directory,  
  272. a temporary MSDOS file SCRATCH.DAT is created and killed  in 
  273. the process of creating the new  directory. You  may specify 
  274. the Drive and output device for the directory.
  275.  
  276. Edit
  277.       An option used to create and edit routines.  The rou-
  278. tine to be edited is loaded into a scratch global ^%MRE and 
  279. all edit operations are performed on that global.  The rou-
  280. tine on disk is NOT updated until you  give  the editor the 
  281. File command.  When specifying a  name  to  be  edited, you 
  282. can enter an asterisk (*) to  indicate that you wish to use 
  283. the routine currently in ^%MRE, thereby saving load time.
  284.  
  285.       The editor also allows you to enter  COMMENTS  associ-
  286. ated with labels in a routine. These comments are held in %M 
  287. and  do  NOT  take  up  partition  space when the program is 
  288. executed.  They can be printed with the program  when  using 
  289. the List option.  They can also be Saved and  Restored along 
  290. with the routines.
  291.  
  292.       To Enter/Edit comments for a given label in  the  rou-
  293. tine being edited, simply enter a semicolon  and  the  Label 
  294. name when the editor is looking for a command (eg, you could 
  295. enter ':LABEL' to Enter/Edit comments for the label LABEL).
  296.  
  297. List
  298.       This  option allows you to list  routines  (optionally
  299. with their comments) on the device of your choice. NOTE that 
  300. you will want to use the terminal definition option to esta-
  301. blish the  parameters of  your devices  (printer, etc.).  If 
  302. output is to the console or any CRT device, the program will 
  303. pause with a keyboard read at the end of each page.
  304.  
  305. Find
  306.       This command allows  you to search  for  one  or  more
  307. strings (or patterns) in a specified set of selected routines. 
  308. You specify where the search results are to be directed. (If 
  309. a CRT, the program pauses at the end of each page).
  310.  
  311. Change
  312.       Change  allows you to change one or more strings in  a
  313. specified set  of routines to new strings.  Output  trace of 
  314. the  changes can  be directed  to the device of your choice. 
  315. (But  no pauses  at the  end of each screen for CRT's.)  You 
  316. can  set the  TO string to  a null (<return> only) to delete 
  317. the target (FROM) string. 
  318.  
  319.  
  320.  
  321.  
  322.                              5
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330. MicroMUMPS Utilities                      Cornell University
  331.  
  332.  
  333. Save
  334.        Save allows you to save a specified set  of  routines
  335. (with an option to  include  the  comments)  to  a specified 
  336. output device - an MSDOS sequential  file (devices 2,3, or 4 
  337. in MicroMUMPS).  You will be asked for a Drive and File name 
  338. for the output file.
  339.  
  340.       Note: You can specify device  5  to  direct  the  save
  341. operation to the external  communication port.  This  option 
  342. can  be  used  in  conjunction  with  a RESTORE operation on 
  343. another  computer (also using device 5) to effect  computer-
  344. to-computer transfers of routines and globals.  However, use  
  345. of  inter-computer transfers requires that the communication 
  346. ports are properly set  up prior to initiating this process. 
  347. Failure to do so  will probably  hang the system and require
  348. rebooting with consequent loss of workspace files.
  349.  
  350. Restore
  351.       Restore allows you to  restore routines, and,  option-
  352. ally, comments that  were Saved with  the Save  option.  You 
  353. specify the name(s) that are to be  restored and whether  or  
  354. not you want the comments  associated with those routines to
  355. be restored also.  For UCD MicroMUMPS version 5.0 and later, 
  356. this function will restore the routines to  ASCII files with 
  357. the .MMP extention.   You  will still  need to  ZFETCH  them  
  358. into the routines library file.
  359.  
  360.       Note: You can restore from device 5 to read information
  361. being transmitted from another computer (see Save option above).
  362.  
  363. Kill
  364.       Kill allows you to remove a specified set of routines.  
  365. It also kills the routines entry in the directory (^%MU) and 
  366. any comments that are associated with this routine (^%M).
  367.  
  368. Xtended Directory
  369.        This function acts in a manner similar to the  DIREC-
  370. TORY command but also lists the  first line of each  routine 
  371. and the second line if it is a comment line.  It  is a  very 
  372. useful  convention to  have the  first line  of each routine 
  373. contain (as a comment) the author's name and optionally  the 
  374. last date modified, and the 2nd line of  each  routine  be a  
  375. comment line that briefly describes  the function of the rou-
  376. tine.  As an  example, the following two lines could  be  the  
  377. first two lines of the routine %M:
  378.   
  379.    %M   ;John Lewkowicz - NYS College of Veterinary Medicine
  380.         ;Programmer Utilities - Main Entry Point and Dispatch
  381.  
  382. The X  function would then list both of these lines when dis-
  383. playing the directory.
  384.  
  385.  
  386.  
  387.  
  388.  
  389.                              6
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396. MicroMUMPS Utilities                      Cornell University
  397.  
  398.  
  399.                Functional Description - Globals
  400. Directory
  401.  
  402.      Directory gives you a directory of  all  globals.  This
  403. directory  is  maintained  in  ^%MU,  similar to the routine
  404. directory. Since it is much easier to create and delete glo-
  405. bals  and harder (if not impossible) to track these changes,
  406. it is recommended that you refresh the directory before  you
  407. list   it.  When  refreshing,  the  temporary  scratch  file
  408. SCRATCH.DAT is created and deleted. You  will  also  get  to
  409. specify the Drive and output device for the directory.
  410.  
  411. Edit
  412.  
  413.      Edit lets you edit a global reference  (entire  global,
  414. specific  node,  or  specific branch). It loops through your
  415. reference, displaying each node and  getting  your  changes.
  416. After  each  node  you  can  specify  whether to do the node
  417. Again, go on to the Next node or Stop  editing  this  refer-
  418. ence.
  419.  
  420. List
  421.  
  422.      List lets you list a global reference (all or  part  of
  423. the  global)  to a specified device. If that device is a CRT
  424. (as defined by the Terminal definition option), the  program
  425. will pause at the end of each screen.
  426.  
  427. Find
  428.  
  429.      Find allows you to search for one or more  strings  (or
  430. patterns)  for  a  given  global reference. Output of search
  431. results is sent to the device of  your  choice,  with  CRT's
  432. pausing at the end of each screen.
  433.  
  434. Change
  435.  
  436.      Change allows you to change one or more strings  (FROM)
  437. to new strings (TO) for a global reference (all or part of a
  438. global). A trace of the changes is output to the  device  of
  439. your  choice.  There are NO pauses at the end of a screen on
  440. CRT's. The TO string can be a null ("") to DELETE  the  FROM
  441. string.
  442.  
  443. Save
  444.  
  445.      Save allows you to output one  or  more  globals  to  a
  446. specified  output  device.  Usually  output is to one of the
  447. sequential MSDOS files (devices 2,3, or  4  in  MicroMUMPS),
  448. and  you  will  be  asked  to  enter the drive and file name
  449. specification for the output file.
  450.  
  451. When doing a global Save, you can specify the maximum number
  452.  
  453.  
  454.                              7
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462. MicroMUMPS Utilities                      Cornell University
  463.  
  464.  
  465. of  bytes  to  output to the output file. If you make use of
  466. this feature, you can create multiple output files (volumes)
  467. to  save  large  data bases on floppy disks. For example, to
  468. save 1MBYTE worth of data on  5  1/4"  double-sided,  double
  469. density  disks with 360K bytes on each disk, you could indi-
  470. cate that the maximum bytes to output is 360K  (in  response
  471. to  the  question  asked  just before the ``Ready to Start''
  472. question). The utility would then start a  global  Save  and
  473. continue  through  the  first  360K bytes. At that time, the
  474. output file is closed and you will be advised to remove  the
  475. disk,  insert a new one, and define where the continued out-
  476. put is to go. Naming each of the continuation files is  your
  477. responsibility. Each of the resulting save files is complete
  478. and standalone (including a definition of  Date/Time  lines)
  479. and  can  be  individually  restored  when using the RESTORE
  480. option.
  481.  
  482. Restore
  483.  
  484.      Restore allows you to retrieve one  or  more  specified
  485. global names from a file created with the Save option.
  486.  
  487. Kill
  488.  
  489.      Kill allows you to remove a  specified  set  of  global
  490. names.  Deleted  globals are also removed from the directory
  491. in ^%MU.
  492.  
  493. Xtended Directory
  494.  
  495.      This command will provide you with a  global  directory
  496. on  a  specified output device and will list along with each
  497. entry the contents of the top data node if  it  is  defined.
  498. Thus,  you can comment the data base by defining a string at
  499. the name level, for example:
  500.  
  501. ^%MTC="Terminal Definition and Port Assignments"
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.   
  520.                                8
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528. MicroMUMPS Utilities                      Cornell University
  529.  
  530.  
  531.                   Terminal Characteristics
  532.  
  533.  
  534.      This utility allows you to define  the  characteristics
  535. of  specific  terminals and to tie those terminals logically
  536. to UCD MicroMUMPS port assignments. using these  definitions
  537. in programs (for example this utility package %M) allows the
  538. programmer  a  certain  device  independence  difficult   to
  539. achieve  when  device-specific  codes  are used in programs.
  540. Most of the terminal specific values that might be of use to
  541. a  programmer  are maintained by this utility and can be set
  542. up once at the beginning of a package initialization.  These
  543. parameters include:
  544.  
  545. Right Margin - The number of characters that will fit on one
  546.    line.   Use  of  this  parameter allows the programmer to
  547.    ensure that data fits on a line, to center data, etc.  As
  548.    an  example,  to  center  a string of data on a line, the
  549.    following code could be used (assuming string to be  cen-
  550.    tered  is  in  variable  `X' and variable RM contains the
  551.    value for the right margin):
  552.  
  553.    W !,?RM2-$L(X)2),X,!
  554.  
  555. Screen Length - The number of  lines  that  will  fit  on  a
  556.    screen  or page. This parameter permits the programmer to
  557.    pause at the end of a screen or start  a  new  page  with
  558.    header information, etc.
  559.  
  560. Form Feed - The character sequence necessary  to  clear  the
  561.    screen  and  start  a  new page. The MUMPS ``#'' does NOT
  562.    always perform this function depending  on  the  terminal
  563.    and  the use of SETMUMPS described in the MicroMUMPS User
  564.    Manual. If this value is initialized correctly, the  pro-
  565.    grammer can always clear the screen with a
  566.  
  567.    W @FF   or      W @IOFF
  568.  
  569. High Intensity - If a terminal supports multiple intensities
  570.    (or  multiple  colors),  it  is possible to switch to the
  571.    High intensity (or a designated color) by writing out the
  572.    character sequence of this variable with a
  573.  
  574.    W @LH   or      W @IOLH
  575.  
  576. Low Intensity - String of characters that will switch termi-
  577.    nals  that  support  dual intensity back to LOW intensity
  578.    (or a specified color) by writing the command
  579.  
  580.    W @HL   or      W @IOHL
  581.  
  582.    In all cases where outputting these strings or  executing
  583.    strings  of  code, the codes are set up so that terminals
  584.  
  585.  
  586.                              9
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594. MicroMUMPS Utilities                      Cornell University
  595.  
  596.  
  597.    that do not  support  a  feature  will  not  be  affected
  598.    adversely.  For  example, a terminal that doesn't support
  599.    dual intensity would have a high intensity and low inten-
  600.    sity  string  of  ``*0'', which would result in a W *0 to
  601.    the device, a command that would not affect the terminal.
  602.  
  603. Cursor Positioning - On terminals that support cursor  posi-
  604.    tioning,  you  can Xecute an indirect MUMPS command after
  605.    setting the desired X and Y positions as follows:
  606.  
  607.    S DX=10,DY=20 X XY...          -or- S DX=10,DY=20 X IOXY
  608.  
  609. Terminal Type - The variable SUB (or IOST) contains a string
  610.    that  defines  the  terminal  type.  The  first character
  611.    defines the general type (C=CRT, P=printer, O=Other), and
  612.    the rest of the string is free text defining the specific
  613.    type (e.g., DEC LA120).
  614.  
  615. The following entry points are available to  the  programmer
  616. for general access to these terminal values:
  617.  
  618.    CURRENT^%MTC will open the device specified  in  $IO  and
  619.    return the following parameters
  620.  
  621.            FF - Form Feed character sequence
  622.            HL - High to Low Intensity switch character sequence
  623.            LH - Low to High Intensity switch character sequence
  624.            RM - Right Margin
  625.            SL - Screen Length
  626.            XY - Cursor positioning command
  627.            SUB - Terminal Subtype
  628.  
  629.    In addition  to  opening  the  device  if  necessary,  an
  630.    optional  startup string will be sent to the device (this
  631.    function can be used to set up initial  default  terminal
  632.    conditions such as high intensity, printer pitch, etc.).
  633.  
  634. ^%MTC will let the user pick which of the  MUMPS  I/O  ports
  635.    they wish to direct output To/From. On return, the device
  636.    has been opened, an optional  initialization  string  has
  637.    been  output  to  the device, and the following variables
  638.    are available for use by the program:
  639.  
  640.            IO -    Device Number selected (numeric)
  641.                    0 - Console
  642.                    1 - Printer port
  643.                    2 - Sequential MSDOS file
  644.                    3 - Sequential MSDOS file
  645.                    4 - Sequential MSDOS file
  646.                    5 - AUX port for external communication
  647.  
  648.            IOFF -  Character sequence to clear screen/start new page
  649.            IOHL -  Character sequence to go to low intensity
  650.            IOLH -  Character sequence to go to hight intensity
  651.  
  652.                              10
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660. MicroMUMPS Utilities                      Cornell University
  661.  
  662.  
  663.            IORM -  Right Margin (characters/line -1)
  664.            IOSL - Screen/Page length (lines -1)
  665.            IOST -  Terminal Subtype (see SUB above)
  666.            IOXY -  MUMPS command string Xecuted to position cursor
  667.  
  668.    If the device selected is an MSDOS sequential file,  then
  669.    the  default  setup  code for those devices (2-4) will be
  670.    Xecuted and the program will ask  the  user  for  a  file
  671.    specification  (Drive  and  File Name) and then open that
  672.    file.
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.                                11
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726. MicroMUMPS Utilities                      Cornell University
  727.  
  728.  
  729.                     Defining a Terminal
  730.  
  731.  
  732.  
  733.      This option is used to define a new terminal type or to
  734. modify  the  definition  of  an  existing  terminal (such as
  735. startup strings, right margin, etc).  The  parameters  main-
  736. tained by this utility reside in ^%MTC. This global does not
  737. need to exist when you first run  the  %M  utility  package,
  738. since  it will be initialized by ^%M8 to include a number of
  739. standard CRTs and Printers as well as the  MSDOS  sequential
  740. files. If the terminals on your system are in the file after
  741. this  initialization,  you  can  use  the  ``Defining  MUMPS
  742. Ports''  option  to  attach  a  specified terminal type to a
  743. specific I/O port.
  744.  
  745.      This utility option  allows  you  to  define  terminal-
  746. specific  characteristics.  Enter  a  ``?'' or ``??'' if you
  747. need help on a specific question. After entering the  termi-
  748. nal  specification,  there will be NO apparent change on the
  749. terminal, since you have not yet assigned  these  parameters
  750. to a Port number.
  751.  
  752. Example (ADM3A CRT)     (user responses in bold face)
  753.  
  754.         Terminal Name: ADM3A    name of terminal
  755.         Description: C-Lear-Siegler ADM3A
  756.         Form Feed Character(s): *26,#   (# resets MUMPS $X,$Y)
  757.         Hi->LO characters: *27,*41      (use *0 if not available)
  758.         LO->HI character(s): *27,*40    (use *0 if not available)
  759.         Right Margin: 79        (characters per line - 1)
  760.         Screen Length: 23       (Lines per page - 1)
  761.         Cursor Positioning: W *24,"=",*DY+32,*DX+32     (move to DX,DY)
  762.         Startup Code: O %IO U %IO W *27,*40     (start at high intensity)
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.                                12
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792. MicroMUMPS Utilities                      Cornell University
  793.  
  794.  
  795.                    Defining a MUMPS Port
  796.  
  797.  
  798.      This function allows you to assign one of  the  defined
  799. terminal  types  and  its  parameters  to one of the numeric
  800. MicroMUMPS ports (0-4). The ports are defined as:
  801.  
  802.         0 -     Console (input/output)
  803.         1 -     Printer (output only)
  804.         2 -     MSDOS sequential file (input-output)
  805.         3 -     MSDOS sequential file (input-output)
  806.         4 -     MSDOS sequential file (input-output)
  807.         5 -     AUX port (COM1 or COM2)
  808.  
  809.      After you have tied a terminal to a port,  the  program
  810. will issue a
  811.  
  812. D CURRENT^%MTC
  813.  
  814. and set up the correct parameters for the appropriate port.
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.       Utility Data Bases (Globals used by %M package)
  822.  
  823. ^%M - Holds user-generated comments associated with specific
  824.    labels for specific routines. Entered/Edited when editing
  825.    Routines.
  826.  
  827. ^%MD - Defines the default Routine library and Global drives
  828.    to  be  used  when running the %M utility functions. Ini-
  829.    tialized first time  through  routine  %M8.  %M8  can  be
  830.    invoked directly (D ^%M8) to change these defaults.
  831.  
  832. ^%MRE - Temporary scratch file into which routine lines  are
  833.    written when editing a routine. All of the actual editing
  834.    of these lines is done on data in this global.
  835.  
  836. ^%MTC - Contains device descriptions and current assignments
  837.    of the MUMPS ports.
  838.  
  839. ^%MU - Utility global that holds  directories  (Routine  and
  840.    Global)  as well as Routine and Global restore specifica-
  841.    tions.
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.                                13
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858. MicroMUMPS Utilities                      Cornell University
  859.  
  860.  
  861.                     ^%M Global Structure
  862.  
  863. Description
  864.  
  865.      This global contains free text comments associated with
  866. a  given  routine and label. The data is entered/edited when
  867. editing routines.  It is used when listing routines and  can
  868. be  saved  and  restored  with  the  routines  at the user's
  869. option.
  870.  
  871. Structure
  872.  
  873.                                 |-----|
  874.                                 | %M  |
  875.                                 |-----|
  876.                                   /\
  877.                                  /  \ (ROUTINE)
  878.                                 /
  879.                              |---|
  880.                              |---|
  881.                                /\
  882.                               /  \  (LABEL)
  883.                              /
  884.                 -------------------
  885.                 |  |  |  |  |  |  |
  886.                 |(0)              |(n)
  887.            |---------|         |------|
  888.            |last line|         | Data |
  889.            |  used   |         |------|
  890.            |---------|
  891.  
  892. ROUTINE is a Routine Name
  893. LABEL  is a Routine line label
  894. last line used is an integer pointing to the last data node (n)
  895. Data contains free text comments
  896.  
  897.  
  898.  
  899.                    ^%MD Global Structure
  900.  
  901. Description
  902.  
  903.      This global contains the  Default  Routine  and  Global
  904. drives used by the Utility package %M.
  905.  
  906. Structure
  907.  
  908.         ^%MD=RG
  909.  
  910. R       is the default Routine drive (A-P)
  911.  
  912. G       is the default Global Drive (A-P)
  913.  
  914.  
  915.  
  916.                                14
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924. MicroMUMPS Utilities                      Cornell University
  925.  
  926.  
  927.                    ^%MRE Global Structure
  928.  
  929. Description
  930.  
  931.      This global holds the routine currently  being  edited.
  932. The editor is line-oriented, and the line number is the sub-
  933. script into this global.
  934.  
  935.  
  936.  
  937. Structure
  938.  
  939.                                 |------|
  940.                                 | %M   |
  941.                                 |------|
  942.                                   /\
  943.                                  /  \ (ROUTINE)
  944.                                 /
  945.                              |---|
  946.                              |---|
  947.                                /\
  948.                               /  \  (LABEL)
  949.                              /
  950.                 -------------------
  951.                 |  |  |  |  |  |  |
  952.                 |(0)              |(n)
  953.            |---------|         |-----|
  954.            |last line|         | Data|
  955.            |  used   |         |-----|
  956.            |---------|
  957.  
  958. ROUTINE is a Routine Name
  959. LABEL  is a Routine line label
  960. last line used is an integer pointing to the last data node (n)
  961. Data contains free text comments
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.    
  981.  
  982.                               15
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990. MicroMUMPS Utilities                      Cornell University
  991.  
  992.  
  993.                    ^%MTC Global Structure
  994.  
  995.  
  996. Description
  997.  
  998.      This  global  contains  terminal  definitions  and  the
  999. current MUMPS port assignments. It is initialized by routine
  1000. %M8 and updated  by  routine  %MTC  (at  labels  DEFINE  and
  1001. DEFAULT).
  1002.  
  1003.  
  1004. Structure
  1005.  
  1006.  
  1007.                                 |---------|
  1008.                                 | ^%MTC   |
  1009.                                 |---------|
  1010.                                     /\
  1011.                                    /  \
  1012.                                   /(n) \ (TERMINAL)
  1013.                                  /      \
  1014.                         |---------|     |------|
  1015.                         | Terminal|     | Desc |
  1016.                         |---------|     |------|
  1017.  
  1018. n is an integer MUMPS port number (0-5)
  1019. Terminal is a terminal name like ADM3A
  1020. Desc is a description of the terminal in the following format:
  1021.  
  1022.         Desc = ``FF~HL~LH~RM~SL~XY~TD~SC'' where:
  1023.  
  1024.                 FF - Form Feed sequence
  1025.                 HL - Low intensity sequence
  1026.                 LH - High intensity sequence
  1027.                 RM - Right Margin
  1028.                 SL - Screen Length
  1029.                 XY - Cursor Positioning code
  1030.                 TD - Terminal description (such as C-ADM3A)
  1031.                 SC - Startup code to be eXecuted when Opening device
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                                16
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056. MicroMUMPS Utilities                      Cornell University
  1057.  
  1058.  
  1059.                    ^%MU Global Structure
  1060.  
  1061.  
  1062. Description
  1063.  
  1064.      A utility global for use by the %M utility package.  It
  1065. holds  directories (both Routine and Global) as well as Rou-
  1066. tine and Global restore specifications.
  1067.  
  1068.  
  1069. Structure
  1070.  
  1071.  
  1072.                                         |--------|
  1073.                                         | ^%MU   |
  1074.                                         |--------|
  1075.                                            /\
  1076.                                           /  \
  1077.                                          /    \
  1078.                                   -------      ---------------
  1079.                                   |                          |
  1080.                         (``ROU'' or ``GBL'')    (``RESR'' or ``RESG'')
  1081.                                   |                          |
  1082.                                 |---|                      |---|
  1083.                                 |---|                      |---|
  1084.                                   /\                        /\
  1085.                                  /  \ (NAME)               /  \  (n)
  1086.                                 /    \                    /    \
  1087.                         |-----------|            |----------------|
  1088.                         |SELECTED   |            |SPECIFICATION   |
  1089.                         |-----------|            |----------------|
  1090.  
  1091. NAME is a Routine or Global Name (depending on  whether  the
  1092.    subscript is ``ROU'' or ``GBL'').
  1093.  
  1094. SELECTED os a True/False indication (1/0) as to whether  the
  1095.    name has been selected or not.
  1096.  
  1097. SPECIFICATION is a restore specification (either Routine  or
  1098.    Global  depending  on  whether  the previous subscript is
  1099.    ``RESR'' or ``RESG'' in the following format:
  1100.  
  1101.    NAME:IF
  1102.  
  1103.    where Name is the actual user entry (such as X?Z*) and IF
  1104.    is the indirect pattern match that will be used to test a
  1105.    target name (such as 1"A"1E1"B".E).
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.                                17
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. MicroMUMPS Utilities                      Cornell University
  1123.  
  1124.  
  1125.                 Save-Restore File Structure
  1126.  
  1127.      The Save/Restore routines and globals are  written  out
  1128. as  sequential  files  to  the designated devices. The first
  1129. line is always a free text description of the file  and  the
  1130. second  line  is a free text data and time. Both lines could
  1131. be nulls.
  1132. ------------------------------------------------------------
  1133. GLOBAL                         ROUTINE
  1134. ``Description''                ``Description''
  1135. ``Date and Time''              ``Date and Time''
  1136. Global Reference               Routine name
  1137.    data element                   routine line
  1138. Global reference                  routine line
  1139.    data element                   routine line
  1140.    .                              .
  1141.    .                              .
  1142.    .                              .
  1143. (Blank global reference        (Blank routine line is used
  1144. indicates file done)           to indicate end of routine)
  1145.                                Routine name
  1146.                                   routine line
  1147.                                   routine line
  1148.                                   .
  1149.                                   .
  1150.                                   .
  1151.                                (blank routine name indicates
  1152.                                end of file)
  1153.  
  1154.  
  1155.      You can use %M to save and restore  both  routines  and
  1156. globals  between  computers  without  the creation of a tem-
  1157. porary file (using device #5 on both computers. If you  want
  1158. to  transmit  or receive routines or globals from OTHER sys-
  1159. tems, you can use the following sections of  MUMPS  code  to
  1160. transmit  (TX)  or receive (RX) a line (L) to/from the other
  1161. machine.
  1162.  
  1163. TX R X G TX:X'="" W L,! R X G TX:X'="" W $L(L),! R X G TX:X'=""
  1164.    Q
  1165. RX R !,A:10 E  W "*-ERROR-*",! G RX
  1166. R1 R !,X:10 E  W "*-ERROR-*",! G RX
  1167.    S X=$S(X'?1N.N:0,$L(A)'=X:0,1:1) W $S(X:"",1:"*-ERROR-*"),!
  1168.    G RX:'X
  1169.    Q
  1170.  
  1171. The code above  assumes  that  the  device  in-USE  for  the
  1172. read/writes  is connected to the microcomputer via an RS-232
  1173. serial line and that  echo  is  turned  off,  and  that  the
  1174. default  line  length  is  set  at  255  characters (i.e., O
  1175. DEV:(255:1) for Intersystems MUMPS).
  1176.  
  1177.  
  1178.  
  1179.  
  1180.                                18
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188. MicroMUMPS Utilities                      Cornell University
  1189.  
  1190.  
  1191.                   Utility Package Routines
  1192.  
  1193. %M      Main  entry  point.   Gets   primary   options   and
  1194.      dispatches  control to other routines in the package as
  1195.      appropriate. Also  processes  name  specifications  and
  1196.      flags (selecting) entries in appropriate directories.
  1197.  
  1198. %M0     Processes Directory requests (including  ``?L''  and
  1199.      ``?S''), and both Global and Routine List options.
  1200.  
  1201. %M1     Controls the Editing of both Routines  and  Globals.
  1202.      The actual editing of routines is handled by the %ME...
  1203.      routines, but global editing is done by %M1.
  1204.  
  1205. %M2     Processes Delete and Find options for  Routines  and
  1206.      for Globals.
  1207.  
  1208. %M3     Processes the Change option for Routines and Globals.
  1209.  
  1210. %M4     Performs Save and Restore operations for  both  Rou-
  1211.      tines and Globals.
  1212.  
  1213. %M5     Gets user options for Terminal and  Port  specifica-
  1214.      tions. Dispatches control to %MTC for actual updates.
  1215.  
  1216. %M6     Does actual Routine/Global Save or Restore  (%M4  is
  1217.      used  to  collect  options  and set up for Save/Restore
  1218.      operation.
  1219.  
  1220. %M7     Handles eXtended Directory  for  both  Routines  and
  1221.      Globals.
  1222.  
  1223. %M8     Initializes both the default drive data base  (^%MD)
  1224.      and the terminal characteristic data base (^%MTC).
  1225.  
  1226. %M9     Displays help text for the Utility package.
  1227.  
  1228. %M10    A Continuation of %M9 help text).
  1229.  
  1230. %MEDT   Routine and comment file editor.
  1231.  
  1232. %MEDT1  Continuation of %MEDT.
  1233.  
  1234. %MEDTE  Extended explanations for %MEDT.
  1235.  
  1236. %MEDTE1 Continuation of %MEDTE.
  1237.  
  1238. %MTC    Terminal definition routine. Entry points at
  1239.              %MTC    to let user select a port.
  1240.              CURRENT^%MTC to get current device parameters.
  1241.  
  1242. %MTCD   Continuation of %MTC with  entry  points  to  define
  1243.      characteristics  of a terminal (DEFINE) and to assign a
  1244.      terminal to a MUMPS I/O port (DEFAULT).
  1245.  
  1246. %MTCH   Used to display help text for %MTC questions.
  1247.  
  1248.                                19
  1249.  
  1250.  
  1251.  
  1252.