home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / message / gmhf.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  507.2 KB  |  12,771 lines

  1.  
  2. -------- SIMTEL20 Ada Software Repository Prologue ------------
  3. --                                                           -*
  4. -- Unit name    : Rainform Message Handler Package
  5. -- Version      : 1.0
  6. -- Contact      : Lt. Colonel Falgiano
  7. --              : ESD/SCW
  8. --              : Hanscom AFB, MA  01731
  9. -- Author       : Tom Vollman
  10. --              : Veda, Inc.
  11. --              : 2 Three Notch Road
  12. --              : Lexington Park, MD  20653
  13. -- DDN Address  : CONTR 12 @NOSC-TECR (ARPANET)
  14. -- Copyright    : (c) 1985 Veda, Inc.
  15. -- Date created : 22 October 1984
  16. -- Release date : 15 April 1985
  17. -- Last update  : 3 May 1985
  18. --                                                           -*
  19. ---------------------------------------------------------------
  20. --                                                           -*
  21. -- Keywords     : 
  22. ----------------:
  23. --
  24. -- Abstract     : This tool may be used to edit any formatted
  25. ----------------: message type that can be defined within the 
  26. ----------------: specified boundries of the "generic message".
  27. ----------------: The tool is delivered with instances defined
  28. ----------------: for several Rainform message types and one 
  29. ----------------: Non_Rainform message type.  Additional types
  30. ----------------: may be instantiated with a re-compilation.
  31. ----------------: 
  32. ----------------: This tool was developed as a precursor for 
  33. ----------------: the WMCCS Information System (WIS).  An
  34. ----------------: executable version of the tool has been 
  35. ----------------: demonstrated.  This source code has sub-
  36. ----------------: sequently been recompiled but has not under-
  37. ----------------: gone extensive testing.
  38. ----------------:
  39. --                                                           -*
  40. ------------------ Revision history ---------------------------
  41. --                                                           -*
  42. -- DATE         VERSION AUTHOR                  HISTORY 
  43. -- 05/03/85       1.0   Tom Vollman             Initial Release
  44. --                                                           -*
  45. ------------------ Distribution and Copyright -----------------
  46. --                                                           -*
  47. -- This prologue must be included in all copies of this software.
  48. -- 
  49. -- This software is copyright by the author.
  50. -- 
  51. -- This software is released to the Ada community.
  52. -- This software is released to the Public Domain (note:
  53. --   software released to the Public Domain is not subject
  54. --   to copyright protection).
  55. -- Restrictions on use or distribution:  NONE
  56. --                                                           -*
  57. ----------------- Disclaimer ----------------------------------
  58. --                                                           -*
  59. -- This software and its documentation are provided "AS IS" and
  60. -- without any expressed or implied warranties whatsoever.
  61. --
  62. -- No warranties as to performance, merchantability, or fitness
  63. -- for a particular purpose exist.
  64. --
  65. -- Because of the diversity of conditions and hardware under
  66. -- which this software may be used, no warranty of fitness for
  67. -- a particular purpose is offered.  The user is advised to 
  68. -- test the software thoroughly before relying on it.  The user
  69. -- must assume the entire risk and liability of using this 
  70. -- software.
  71. --
  72. -- In no event shall any person or organization of people be
  73. -- held responsible for any direct, indirect, consequential
  74. -- or inconsequential damages or lost profits.
  75. --                                                          -*
  76. ----------------- END-PROLOGUE -------------------------------
  77. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  78. --termdef.sp
  79. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  80. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  81. --                                                                    --
  82. --            Program unit:  PACKAGE TERMINAL_DEFINITION              --
  83. --            File name :    TERMDEF.SP                               --
  84. --                                                                    --
  85. --            ===========================================             --
  86. --                                                                    --
  87. --                                                                    --
  88. --            Produced by Veda Incorporated                           --
  89. --            Version  1.0      April 15, 1985                        --
  90. --                                                                    --
  91. --                                                                    --
  92. --            This program unit is a member of the GMHF. It           --
  93. --            was developed using TeleSoft's Ada compiler,            --
  94. --            version 2.1 in a VAX/VMS environment, version           --
  95. --            3.7                                                     --
  96. --                                                                    --
  97. --                                                                    --
  98. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  99. --
  100. package TERMINAL_DEFINITION is 
  101.  
  102.    use ASCII; 
  103. --
  104. -- this sub-package defines all terminal dependent data
  105. -- elements used by the gmhf system.if the systemis to 
  106. -- be executed using a terminal other then the VT-100
  107. -- series terminals, this package will have to be edited
  108. -- to handle the new characteristics....
  109. --
  110. --
  111.    -- start off with defining some general terminal characteristics
  112.    -- 
  113.    NMBR_OF_ROWS  : constant INTEGER := 24; 
  114.    NMBR_OF_COLS  : constant INTEGER := 80; 
  115.    --
  116.    subtype CRT_ROWS   is INTEGER range 1..NMBR_OF_ROWS; 
  117.    subtype CRT_COLS   is INTEGER range 1..NMBR_OF_COLS; 
  118.    -- 
  119.    -- we define a record type to hold a crt position
  120.    --
  121.    type CRT_POSITION  is record 
  122.       ROW     : CRT_ROWS; 
  123.       COLUMN  : CRT_COLS; 
  124.    end record; 
  125.    --
  126.    -- since it is directly related to the crt dimensions, we will
  127.    -- define the edit screen partitions:
  128.    --
  129.    -- the title of the menu is on rows 1&2
  130.    TOP_OF_MESSAGE_AREA    : constant CRT_ROWS := 3; 
  131.    TOP_OF_WORK_AREA       : constant CRT_ROWS := 16; 
  132.    TOP_OF_AMP_AREA        : constant CRT_ROWS := 20; 
  133.    --
  134.    -- from the tops of the areas, we may compute the bottoms
  135.    -- 
  136.    BOT_OF_MESSAGE_AREA    : constant CRT_ROWS := TOP_OF_WORK_AREA - 2; 
  137.    BOT_OF_WORK_AREA       : constant CRT_ROWS := TOP_OF_AMP_AREA - 2; 
  138.    BOT_OF_AMP_AREA        : constant CRT_ROWS := NMBR_OF_ROWS; 
  139.    --
  140.    -- if a message contains classified data and is displayed,
  141.    -- the message's classification must be displayed in two
  142.    -- places on the screen. the following declarations specifiy
  143.    -- where the two locations should be.
  144.    --
  145.    UPPER_CLASSIFICATION   : CRT_POSITION := (ROW => 1, COLUMN => 1); 
  146.    LOWER_CLASSIFICATION   : CRT_POSITION := (ROW => 24, COLUMN => 65); 
  147.    --
  148.    -- the system requires a set of function keys or a series of other
  149.    -- keys to represent a function key. it is fairly standard practice
  150.    -- for a function key to be symbolized by a special ascii character
  151.    -- followed by one or several additional characters. the special 
  152.    -- ascii character should be common for all of the function keys.
  153.    -- this system will operate based on the assumption that the user
  154.    --  terminal supports this representation of a function key. below
  155.    --  specifies the value of the leading special ascii character and
  156.    --  the length of the string of characters to follow.
  157.    --
  158.    -- for vt-100's the function key is represented by an escape followed
  159.    -- by a string of two characters.
  160.    --
  161.    START_OF_FUNCTION_KEY  : CHARACTER := ESC; 
  162.    subtype FUNCTION_KEY     is STRING (1..2); 
  163.    -- 
  164.    --
  165.    -- define the sequences which the terminal will echo back
  166.    -- upon depression of the system driver function keys.
  167.    -- if the number of available function keys are limited
  168.    -- these keys may be defined as editing function keys also
  169.    -- since both sets are never needed simultaniously.
  170.    -- 
  171.    --
  172.    type SYSTEM_DRIVER_KEYS  is record 
  173.       TAB          : FUNCTION_KEY := "Op";           --sd1
  174.       BACK_TAB     : FUNCTION_KEY := "On";      --sd2
  175.       COMMAND      : FUNCTION_KEY := "OM";       --sd3
  176.       ARROW_UP     : FUNCTION_KEY := "[A";      --sd4
  177.       ARROW_DOWN   : FUNCTION_KEY := "[B";    --sd5
  178.    end record; 
  179.    --
  180.    --
  181.    -- now define the sequence which the terminal will echo
  182.    -- upon depression of the special editing function keys.
  183.    -- again these keys may double as system driver keys
  184.    -- since both arent needed simultaneously
  185.    --
  186.    type EDIT_FUNC_KEYS      is record 
  187.       NEXT_FIELD   : FUNCTION_KEY := "OR";   --ef1
  188.       PREV_FIELD   : FUNCTION_KEY := "OS";   --ef2
  189.       ERASE_FIELD  : FUNCTION_KEY := "OQ";  --ef3
  190.       NEXT_LINE    : FUNCTION_KEY := "Oy";    --ef4
  191.       PREV_LINE    : FUNCTION_KEY := "Om";    --ef5
  192.       INSERT_LINE  : FUNCTION_KEY := "Ov";  --ef6
  193.       DELETE_LINE  : FUNCTION_KEY := "Ol";  --ef7
  194.       EDIT_LINE    : FUNCTION_KEY := "Ow";    --ef8
  195.       END_EDIT     : FUNCTION_KEY := "OP";     --ef9
  196.       CLASSIFY     : FUNCTION_KEY := "Ot";     --ef10
  197.       UP_ARROW     : FUNCTION_KEY := "[A"; 
  198.       DOWN_ARROW   : FUNCTION_KEY := "[B"; 
  199.       RIGHT_ARROW  : FUNCTION_KEY := "[C"; 
  200.       LEFT_ARROW   : FUNCTION_KEY := "[D"; 
  201.       NIL          : FUNCTION_KEY := "  "; 
  202.    end record; 
  203.    --
  204.    --
  205.    -- now specify all of the routines which are 
  206.    -- terminal dependent. these routines will have to be 
  207.    -- modified if a terminal which is not vt-100 compatable
  208.    -- is used.
  209.    --
  210.    procedure INT_STR (INPUT_VALUE    : INTEGER; 
  211.                       OUTPUT_STRING  : out STRING; 
  212.                       NUM_CHARS      : in out INTEGER); 
  213.    
  214.    procedure STR_INT (INPUT_STRING  : in out STRING; 
  215.                       OUTPUT_VALUE  : out INTEGER); 
  216.    
  217.    procedure GOTO_CRT_POSITION (ROW  : in CRT_ROWS; 
  218.                                 COL  : in CRT_COLS); 
  219.    
  220.    procedure GOTO_CRT_POSITION (POSITION  : CRT_POSITION); 
  221.    
  222.    procedure UNDERSCORE_ON; 
  223.    
  224.    procedure UNDERSCORE_OFF; 
  225.    
  226.    procedure REVERSE_VIDEO_ON; 
  227.    
  228.    procedure REVERSE_VIDEO_OFF; 
  229.    
  230.    procedure ERASE_SCREEN; 
  231.    
  232.    procedure ERASE_TO_END_OF_SCREEN; 
  233.    
  234.    procedure ERASE_LINE; 
  235.    
  236.    procedure SAVE_CURSOR_POSITION; 
  237.    
  238.    procedure RESTORE_CURSOR_POSITION; 
  239.    
  240.    procedure ERASE_LINE (LINE_NUMBER  : in CRT_ROWS); 
  241.    
  242.    procedure RING_BELL; 
  243.    
  244.    procedure BACK_SPACE; 
  245.    
  246.    procedure FORWARD_SPACE; 
  247.    --
  248.    procedure INITIALIZE_TERMINAL; 
  249.    --
  250. end TERMINAL_DEFINITION; 
  251. --
  252. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  253. --termdef.txt
  254. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  255. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  256. --                                                                    --
  257. --            Program unit:  PACKAGE TERMINAL_DEFINITION              --
  258. --            File name :    TERMDEF.TXT                              --
  259. --                                                                    --
  260. --            ===========================================             --
  261. --                                                                    --
  262. --                                                                    --
  263. --            Produced by Veda Incorporated                           --
  264. --            Version  1.0      April 15, 1985                        --
  265. --                                                                    --
  266. --                                                                    --
  267. --            This program unit is a member of the GMHF. It           --
  268. --            was developed using TeleSoft's Ada compiler,            --
  269. --            version 2.1 in a VAX/VMS environment, version           --
  270. --            3.7                                                     --
  271. --                                                                    --
  272. --                                                                    --
  273. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  274. --
  275. with TEXT_IO;  use TEXT_IO; 
  276. -----------------------------------
  277. package body TERMINAL_DEFINITION is 
  278. -----------------------------------
  279. --
  280. -- there are no data elements local only to this package
  281. -- because this package will not contain an executable driver.
  282. -- hence we will just define the procedures specified in the
  283. -- specificatioin portion of the package.
  284. --
  285. --
  286.    ------------------
  287.    procedure INT_STR (INPUT_VALUE    : INTEGER; 
  288.                       OUTPUT_STRING  : out STRING; 
  289.                       NUM_CHARS      : in out INTEGER) is 
  290.    ------------------
  291.    --
  292.    -- this procedure inputs an integer, and transforms it into a 
  293.    -- left-justified string. It returns the string and the number of
  294.    -- non-blank characters in the string.
  295.    --
  296.       type DEC_DIG  is array (0..9) of STRING (1..1); 
  297.       DIG           : DEC_DIG; -- this holds a copy of each digit in string form
  298.       BLANKS        : STRING (1..12) := "            "; 
  299.       STR           : STRING (1..12);   -- this holds the string we are building
  300.       SIGN          : STRING (1..1);   -- this holds the sign either a "-" or " " 
  301.       INT_VAL, CTR  : INTEGER; -- int_val is the working value of the 
  302.                               -- input value. ctr is a place holder.
  303.    --
  304.    begin 
  305.       STR := "            ";   -- init working string
  306.       DIG := (0 => "0", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 
  307.       6 => "6", 7 => "7", 8 => "8", 9 => "9");     -- init digits
  308.       INT_VAL := INPUT_VALUE; -- place input parameter into working spot
  309.    --  
  310.       if INT_VAL < 0 then      -- set sign and ensure working value >0
  311.          SIGN := "-"; 
  312.          INT_VAL := - INT_VAL; 
  313.       else 
  314.          SIGN := " "; 
  315.       end if; 
  316.    -- 
  317.       for I in reverse 1..12 loop   -- strip off the low order digits - 
  318.          STR (I) := DIG (INT_VAL mod 10) (1);   -- place them into the work
  319.          INT_VAL := (INT_VAL - (INT_VAL mod 10)) / 10;   -- string. Then 
  320.          CTR := I;                 -- adjust the working value. Continue
  321.          exit when INT_VAL = 0;     -- until out of digits.
  322.       end loop; 
  323.    --
  324.       if SIGN = "-" then            -- set sign
  325.          CTR := CTR - 1; 
  326.          STR (CTR) := SIGN (1); 
  327.       end if; 
  328.    -- 
  329.       NUM_CHARS := 12 - CTR + 1;      -- calculate # of non-blank digits
  330.       OUTPUT_STRING (1..NUM_CHARS) := STR (CTR..12);   -- and place them 
  331.                                       -- into output string.
  332.    end INT_STR; 
  333.    --
  334.    --
  335.    ------------------
  336.    procedure STR_INT (INPUT_STRING  : in out STRING; 
  337.                       OUTPUT_VALUE  : out INTEGER) is 
  338.    ------------------
  339.    --
  340.    -- this procedure inputs a string, and transforms it into an
  341.    -- integer. If it finds a non-digit it raises an exception :
  342.    -- non_digit_input.
  343.    --
  344.    -- It calls a subprogram, left_justify_and_validate, which in turn
  345.    -- calls a subprogram, left_shift.
  346.    --
  347.       type DEC_DIG  is array (0..9) of STRING (1..1); 
  348.       DIG                                  : DEC_DIG; -- this holds a copy of each digit in string form
  349.       SIGN                                 : INTEGER; 
  350.       NON_DIGIT_INPUT                      : exception; 
  351.       FIRST_DIGIT, LAST_DIGIT, TEMP_VALUE  : INTEGER; 
  352.       FOUND_A_DIGIT                        : BOOLEAN; 
  353.    --
  354.       -----------------------------------
  355.       procedure LEFT_JUSTIFY_AND_VALIDATE (LAST_DIGIT  : out INTEGER) is 
  356.       -----------------------------------
  357.       --
  358.          CURRENT_POSITION  : POSITIVE; 
  359.       --
  360.          -----------------------
  361.          procedure LEFT_SHIFT is 
  362.          -----------------------
  363.          --
  364.          -- This proc shifts input_string to the left (over any leading
  365.          -- blanks) and pads on the right with blanks. The position at
  366.          -- which this routine begins its looking and shifting is found
  367.          -- in current_position.
  368.          --
  369.             I, J  : POSITIVE; 
  370.          begin 
  371.             I := CURRENT_POSITION; 
  372.             J := I + 1; 
  373.             while (INPUT_STRING (I) = ' ' and CURRENT_POSITION <= 
  374.                       INPUT_STRING'LENGTH) loop 
  375.                INPUT_STRING (I..INPUT_STRING'LENGTH) := INPUT_STRING 
  376.                          (J..INPUT_STRING'LENGTH) & " "; 
  377.                CURRENT_POSITION := CURRENT_POSITION + 1; 
  378.             end loop; 
  379.          end LEFT_SHIFT; 
  380.          --
  381.       begin 
  382.          CURRENT_POSITION := 1; -- set pointer to beginning of string
  383.          LEFT_SHIFT;            -- get rid of any leading blanks
  384.          --
  385.          if INPUT_STRING (1) = '-' then 
  386.             FIRST_DIGIT := 2;   -- if the number is negative, set a
  387.          else                   -- pointer to 2, else to 1. This ptr
  388.             FIRST_DIGIT := 1;   -- tells us where to start the shift/
  389.          end if;                -- calculate loop.
  390.          LAST_DIGIT := 0; 
  391.          VALIDATE_LOOP : 
  392.          for I in FIRST_DIGIT..INPUT_STRING'LENGTH loop 
  393.             --
  394.             CURRENT_POSITION := I; -- set ptr to 'next' character and
  395.             LEFT_SHIFT;            -- get rid of any leading blanks.
  396.             if CURRENT_POSITION > INPUT_STRING'LENGTH then --if the rest
  397.                exit VALIDATE_LOOP; --of the string was blank,we're done.
  398.             end if; 
  399.             --
  400.             FOUND_A_DIGIT := FALSE; -- we're going to look to see if the
  401.             INNER_LOOP : 
  402.             for J in 0..9 loop              -- next char is a digit. If
  403.                if INPUT_STRING (I..I) = DIG (J) then   -- so then note the 
  404.                   FOUND_A_DIGIT := TRUE; --fact and hold the position of
  405.                   LAST_DIGIT := I; -- this, the rightmost digit found,
  406.                end if;             -- so far.
  407.             end loop INNER_LOOP; 
  408.             --
  409.             if FOUND_A_DIGIT = FALSE then --If we never raised the flag,
  410.                raise NON_DIGIT_INPUT; -- then what was there was not a
  411.                exit VALIDATE_LOOP;    --digit, so take exception and go.
  412.             end if; 
  413.          end loop VALIDATE_LOOP; 
  414.          --
  415.       --
  416.       end LEFT_JUSTIFY_AND_VALIDATE; 
  417.       --
  418.    --
  419.    begin 
  420.       TEMP_VALUE := 0;  -- init output value
  421.       DIG := (0 => "0", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 
  422.       6 => "6", 7 => "7", 8 => "8", 9 => "9");     -- init digits
  423.       -- 
  424.       LEFT_JUSTIFY_AND_VALIDATE (LAST_DIGIT);   -- pack the string and make
  425.                             -- sure all characters are digits or blanks.
  426.       if FIRST_DIGIT = 2 then 
  427.          SIGN := - 1; 
  428.       else                  -- If the first character was a '-', set
  429.          SIGN := 1;         -- sign = -1, else sign = 1.
  430.       end if; 
  431.       --
  432.       for I in reverse FIRST_DIGIT..LAST_DIGIT loop -- digit at a time
  433.                                          -- calculate the integer part
  434.          INNER : 
  435.          for J in 0..9 loop 
  436.             if INPUT_STRING (I..I) = DIG (J) then 
  437.                TEMP_VALUE := TEMP_VALUE -- when one is found, calc
  438.                + J * 10 ** (LAST_DIGIT - I);        --its value
  439.                exit INNER; 
  440.             end if; 
  441.          end loop INNER; 
  442.       end loop; 
  443.       TEMP_VALUE := TEMP_VALUE * SIGN;   -- apply the algebraic sign.
  444.       --
  445.       OUTPUT_VALUE := TEMP_VALUE; 
  446.       -- exception
  447.       -- when non_digit_input => put_line("non-digit input in left");
  448.       --
  449.    end STR_INT; 
  450.    --
  451.    ---------------------------
  452.    procedure GOTO_CRT_POSITION (ROW  : in CRT_ROWS; 
  453.                                 COL  : in CRT_COLS) is 
  454.    ---------------------------
  455.    --
  456.    -- this procedure is tasked with performing absolute cursor 
  457.    -- addressing. It should, one way or another, move the active
  458.    -- cursor position to the row and column specified in the 
  459.    -- argument list.
  460.    --
  461.       -- this routine must first convert the numerical input to
  462.       -- string variables so define the string variables.
  463.       --
  464.       CHAR_ROW  : STRING (1..2); 
  465.       CHAR_COL  : STRING (1..2); 
  466.       N_DIGITS  : INTEGER; 
  467.       M_DIGITS  : INTEGER; 
  468.       --
  469.       --
  470.    begin 
  471.    --
  472.       --
  473.       -- the first thing we must do is convert the row and col to
  474.       -- character strings. we do this by calling the utilty routine
  475.       -- for this purpose. 
  476.       --
  477.       INT_STR (ROW, CHAR_ROW, N_DIGITS); 
  478.       INT_STR (COL, CHAR_COL, M_DIGITS); 
  479.       --
  480.       -- now write the escape sequence to the terminal to
  481.       -- perform the absolute cursor positioning
  482.       --
  483.       PUT (ESC); 
  484.       PUT ("[" & CHAR_ROW (1..N_DIGITS) & ";" & CHAR_COL (1..M_DIGITS) & "f"); 
  485.       --
  486.    --
  487.    end GOTO_CRT_POSITION; 
  488.    --
  489.    --
  490.    ---------------------------
  491.    procedure GOTO_CRT_POSITION (POSITION  : CRT_POSITION) is 
  492.    ---------------------------
  493.    --
  494.    -- this procedure is tasked with performing absolute cursor 
  495.    -- addressing. It should, one way or another, move the active
  496.    -- cursor position to the row and column specified in the 
  497.    -- argument list.
  498.    --
  499.       -- this routine must first convert the numerical input to
  500.       -- string variables so define the string variables.
  501.       --
  502.       ROW       : CRT_ROWS; 
  503.       COL       : CRT_COLS; 
  504.       CHAR_ROW  : STRING (1..2); 
  505.       CHAR_COL  : STRING (1..2); 
  506.       N_DIGITS  : INTEGER; 
  507.       M_DIGITS  : INTEGER; 
  508.       --
  509.       --
  510.    begin 
  511.    --
  512.    -- this is an overloaded version of the goto_pos above, which
  513.    -- requires a row and a column as inputs. this version accepts
  514.    -- an element of crt_position, converts it to a row and a column
  515.    -- and proceeds exactly as the version above.
  516.    --
  517.       ROW := POSITION.ROW; 
  518.       COL := POSITION.COLUMN; 
  519.       --
  520.       -- the first thing we must do is convert the row and col to
  521.       -- character strings. we do this by calling the utilty routine
  522.       -- for this purpose. 
  523.       --
  524.       INT_STR (ROW, CHAR_ROW, N_DIGITS); 
  525.       INT_STR (COL, CHAR_COL, M_DIGITS); 
  526.       --
  527.       -- now write the escape sequence to the terminal to
  528.       -- perform the absolute cursor positioning
  529.       --
  530.       PUT (ESC); 
  531.       PUT ("[" & CHAR_ROW (1..N_DIGITS) & ";" & CHAR_COL (1..M_DIGITS) & "f"); 
  532.       --
  533.    --
  534.    end GOTO_CRT_POSITION; 
  535.    --
  536.    --
  537.    --------------------------
  538.    procedure UNDERSCORE_ON is 
  539.    --------------------------
  540.    --
  541.    -- this routine will turn the underscore characteristic for the 
  542.    -- user terminal on. for vt-100s its just an escape sequence.
  543.    --
  544.    begin 
  545.       --
  546.       PUT (ESC); 
  547.       PUT ("[4m"); 
  548.       --
  549.    --
  550.    end UNDERSCORE_ON; 
  551.    --
  552.    --
  553.    ---------------------------
  554.    procedure UNDERSCORE_OFF is 
  555.    ---------------------------
  556.    --
  557.    -- this routine turns off the underscore characteristic for
  558.    -- the user terminal. for vt-100s its just an escape sequence.
  559.    -- CAUTION the same sequence also turns off reverse video
  560.    --
  561.    begin 
  562.       --
  563.       PUT (ESC); 
  564.       PUT ("[0m"); 
  565.       --
  566.    --
  567.    end UNDERSCORE_OFF; 
  568.    --
  569.    --
  570.    -----------------------------
  571.    procedure REVERSE_VIDEO_ON is 
  572.    -----------------------------
  573.    --
  574.    -- this routine turns on the reverse video characteristic for
  575.    -- the user terminal. for vt-100s its an escape sequence.
  576.    --
  577.    begin 
  578.       --
  579.       PUT (ESC); 
  580.       PUT ("[7m"); 
  581.       --
  582.    --
  583.    end REVERSE_VIDEO_ON; 
  584.    --
  585.    --
  586.    ------------------------------
  587.    procedure REVERSE_VIDEO_OFF is 
  588.    ------------------------------
  589.    --
  590.    -- this routine turns the reverse video characteristic off
  591.    -- for the user terminal. for vt-100s its an escape sequence. 
  592.    -- CAUTION- the same sequence also turns underscore off.
  593.    --
  594.    begin 
  595.       --
  596.       PUT (ESC); 
  597.       PUT ("[0m"); 
  598.       --
  599.    --
  600.    end REVERSE_VIDEO_OFF; 
  601.    --
  602.    --
  603.    -------------------------
  604.    procedure ERASE_SCREEN is 
  605.    -------------------------
  606.    --
  607.    -- this routine erases the screen. for vt-100s its an escape
  608.    -- sequence.
  609.    --
  610.    begin 
  611.       --
  612.       PUT (ESC); 
  613.       PUT ("[2J"); 
  614.       --
  615.    --
  616.    end ERASE_SCREEN; 
  617.    --
  618.    --
  619.    -------------------------
  620.    procedure ERASE_TO_END_OF_SCREEN is 
  621.    -------------------------
  622.    --
  623.    -- this routine erases to the end of the screen. 
  624.    -- for vt-100s its an escape sequence.
  625.    --
  626.    begin 
  627.       --
  628.       PUT (ESC); 
  629.       PUT ("[J"); 
  630.       --
  631.    --
  632.    end ERASE_TO_END_OF_SCREEN; 
  633.    --
  634.    --
  635.    -----------------------
  636.    procedure ERASE_LINE is 
  637.    -----------------------
  638.    --
  639.    -- this routine erase the current line the cursor is on.
  640.    -- for vt-100s its an escape sequence.
  641.    --
  642.    begin 
  643.       --
  644.       PUT (ESC); 
  645.       PUT ("[2K"); 
  646.       --
  647.    --
  648.    end ERASE_LINE; 
  649.    --
  650.    ---------------------------------
  651.    procedure SAVE_CURSOR_POSITION is 
  652.    ---------------------------------
  653.    --
  654.    -- this routine will save the current cursor position and
  655.    -- all current attributes for the terminal which are set
  656.    --
  657.    begin 
  658.       --
  659.       PUT (ESC); 
  660.       PUT ("7"); 
  661.       --
  662.    --
  663.    end SAVE_CURSOR_POSITION; 
  664.    --
  665.    --
  666.    ------------------------------------
  667.    procedure RESTORE_CURSOR_POSITION is 
  668.    ------------------------------------
  669.    --
  670.    -- this routine returns the cursor to where it was upon
  671.    -- calling save_cursor_position and also resets the
  672.    -- attributes to what they were
  673.    --
  674.    begin 
  675.       --
  676.       PUT (ESC); 
  677.       PUT ("8"); 
  678.       --
  679.    --
  680.    end RESTORE_CURSOR_POSITION; 
  681.    --
  682.    --
  683.    -----------------------
  684.    procedure ERASE_LINE (LINE_NUMBER  : in CRT_ROWS) is 
  685.    -----------------------
  686.    --
  687.    -- erases the line whose line number is passed as an 
  688.    -- argument and return the cursor back to where it was
  689.    -- for the vt-100 it all can be done with escape sequences
  690.    -- good luck doing it with any other terminal.
  691.    --
  692.    begin 
  693.       --
  694.       SAVE_CURSOR_POSITION; 
  695.       --
  696.       -- now goto the row which needs to be erased
  697.       --
  698.       GOTO_CRT_POSITION (LINE_NUMBER, 1); 
  699.       --
  700.       -- and erase line
  701.       --
  702.       PUT (ESC); 
  703.       PUT ("[2K"); 
  704.       --
  705.       RESTORE_CURSOR_POSITION; 
  706.       --
  707.    --
  708.    end ERASE_LINE; 
  709.    --
  710.    --           
  711.    ----------------------
  712.    procedure RING_BELL is 
  713.    ----------------------
  714.    --
  715.    -- this routine rings the terminal bell.
  716.    -- bell is an ascii character.
  717.    --
  718.    begin 
  719.       --
  720.       PUT (BEL); 
  721.       --
  722.    --
  723.    end RING_BELL; 
  724.    --
  725.    ----------------------
  726.    procedure BACK_SPACE is 
  727.    ----------------------
  728.    --
  729.    -- this routine backspaces the cursor one position
  730.    -- bs is an ascii character.
  731.    --
  732.    begin 
  733.       --
  734.       PUT (BS); 
  735.       --
  736.    --
  737.    end BACK_SPACE; 
  738.    --
  739.    ----------------------
  740.    procedure FORWARD_SPACE is 
  741.    ----------------------
  742.    --
  743.    -- this routine moves the cursor forward one position
  744.    -- fs is an ascii character.
  745.    --
  746.    begin 
  747.       --
  748.       PUT (FS); 
  749.       --
  750.    --
  751.    end FORWARD_SPACE; 
  752.    --
  753.    ----------------------
  754.    procedure INITIALIZE_TERMINAL is 
  755.    ----------------------
  756.    --
  757.    -- this routine allows the implementor to do any terminal 
  758.    -- initialization. For VT 100s, we set the application keypad.
  759.    --
  760.    begin 
  761.       --
  762.       PUT (ESC); 
  763.       PUT ("="); 
  764.       --
  765.    --
  766.    end INITIALIZE_TERMINAL; 
  767.    --
  768. --  
  769. end TERMINAL_DEFINITION; 
  770. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  771. --mmip.sp
  772. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  773. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  774. --                                                                    --
  775. --            Program unit:  PACKAGE MAN_MACHINE_INTERFACE            --
  776. --            File name :    MMIP                                     --
  777. --                                                                    --
  778. --            ===========================================             --
  779. --                                                                    --
  780. --                                                                    --
  781. --            Produced by Veda Incorporated                           --
  782. --            Version  1.0      April 15, 1985                        --
  783. --                                                                    --
  784. --                                                                    --
  785. --            This program unit is a member of the GMHF. It           --
  786. --            was developed using TeleSoft's Ada compiler,            --
  787. --            version 2.1 in a VAX/VMS environment, version           --
  788. --            3.7                                                     --
  789. --                                                                    --
  790. --                                                                    --
  791. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  792. --
  793. -------------------------------- 
  794. package MAN_MACHINE_INTERFACE is 
  795. --------------------------------
  796. --
  797. -- mmip is a package used to define all data element and
  798. -- processing element definitions which will be used for 
  799. -- communications between the user and the gmhf system..
  800. --
  801. -- the following contains miscellaneous
  802. -- data element and processing element definitions for
  803. -- man/machine interface use. these routines should be terminal
  804. -- independent but they may be host dependent.
  805. --
  806.    --
  807.    -- a few data definitions for use as arguments 
  808.    --
  809.    type UP_OR_DOWN is (UP, DOWN); 
  810.    
  811.    type COMMAND is (NEXT_FIELD,  PREV_FIELD,  ERASE_FIELD, NEXT_LINE,   
  812.                     PREV_LINE,   INSERT_LINE, DELETE_LINE, EDIT_LINE,   
  813.                     END_EDIT,    CLASSIFY,    UP_ARROW,    DOWN_ARROW,  
  814.                     RIGHT_ARROW, LEFT_ARROW,  NIL); 
  815.    --
  816.    --
  817.    procedure PROMPT (TEXT  : in STRING); 
  818.    
  819.    procedure DISPLAY_MENU (MENU_NAME  : STRING); 
  820.    
  821.    procedure SCROLL_SCREEN (TOP_OF_SCROLL_AREA, BOTTOM_OF_SCROLL_AREA  : 
  822.              POSITIVE; 
  823.                             DIRECTION                                  : in 
  824.              UP_OR_DOWN); 
  825.    
  826.    procedure GET_COMMAND (EDIT_COMMAND  : out COMMAND); 
  827.    
  828.    procedure READ_NOECHO (TEXT  : in out STRING); 
  829.    
  830.    procedure READ (TEXT          : in out STRING; 
  831.                    NUM_CHAR      : in POSITIVE; 
  832.                    COMMAND_FLAG  : out BOOLEAN; 
  833.                    EDIT_COMMAND  : out COMMAND); 
  834.    
  835. --
  836. end MAN_MACHINE_INTERFACE; 
  837. --
  838. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  839. --mmip.txt
  840. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  841. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  842. --                                                                    --
  843. --            Program unit:  PACKAGE MAN_MACHINE_INTERFACE            --
  844. --            File name :    MMIP.TXT                                 --
  845. --                                                                    --
  846. --            ===========================================             --
  847. --                                                                    --
  848. --                                                                    --
  849. --            Produced by Veda Incorporated                           --
  850. --            Version  1.0      April 15, 1985                        --
  851. --                                                                    --
  852. --                                                                    --
  853. --            This program unit is a member of the GMHF. It           --
  854. --            was developed using TeleSoft's Ada compiler,            --
  855. --            version 2.1 in a VAX/VMS environment, version           --
  856. --            3.7                                                     --
  857. --                                                                    --
  858. --                                                                    --
  859. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  860. --
  861. with HOST_LCD_IF;          use HOST_LCD_IF; 
  862. with TEXT_IO;              use TEXT_IO; 
  863. with TERMINAL_DEFINITION;  use TERMINAL_DEFINITION; 
  864. -------------------------------------------------
  865. package body MAN_MACHINE_INTERFACE is 
  866. -------------------------------------------------
  867.    package INT_IO is new INTEGER_IO (INTEGER); 
  868.    use INT_IO; 
  869.    PROMPT_DISPLAYED  : BOOLEAN; 
  870. --
  871. -- 
  872. -- there are no data elements local only to this package
  873. -- because this package will not contain an executable driver.
  874. -- hence we will just define the procedures specified in the 
  875. -- specification portion of the package.
  876. --
  877. --
  878.    -----------------
  879.    procedure PROMPT (TEXT  : in STRING) is 
  880.    -----------------
  881.    --
  882.    -- this routine will prompt the user with the string passed as 
  883.    -- an argument. the prompt will appear on the second row of the 
  884.    -- menus.
  885.    --
  886.       PROMPT_STRING  : STRING (1..NMBR_OF_COLS) := (1..NMBR_OF_COLS => ' '); 
  887.       
  888.    begin 
  889.       --
  890.       -- the first thing we must do is save the cursor position
  891.       --
  892.       SAVE_CURSOR_POSITION; 
  893.       --
  894.       -- then move to the prompt area, ring the bell,
  895.       --  and then put out the string
  896.       --
  897.       GOTO_CRT_POSITION (2, 1); 
  898.       if PROMPT_DISPLAYED = FALSE then 
  899.          RING_BELL; 
  900.       end if; 
  901.       --
  902.       -- then turn on underscore
  903.       --
  904.       REVERSE_VIDEO_OFF;   -- make sure everythings off first
  905.       UNDERSCORE_ON; 
  906.       --
  907.       -- then put out the string
  908.       --
  909.       PROMPT_STRING (1..TEXT'LENGTH) := TEXT; 
  910.       PUT (PROMPT_STRING); 
  911.       --
  912.       -- now restore cursor position
  913.       --
  914.       RESTORE_CURSOR_POSITION; 
  915.       --
  916.       PROMPT_DISPLAYED := TRUE; 
  917.    --
  918.    end PROMPT; 
  919.    --
  920.    --
  921.    -----------------------
  922.    procedure DISPLAY_MENU (MENU_NAME  : STRING) is 
  923.    -----------------------
  924.    --
  925.    -- this routine reads a sequential file for each menu and
  926.    -- echoes the contents back to the terminal.
  927.    --
  928.       NUMBER_OF_CHARACTERS  : NATURAL; 
  929.       SCREEN_STRING         : STRING (1..256); 
  930.       FILE_1                : TEXT_IO.FILE_TYPE; 
  931.    begin 
  932.    --
  933.       --
  934.       --
  935.       -- open the file specified by menu_name
  936.       --
  937.       OPEN (FILE_1, IN_FILE, MENU_NAME & ".dsp", ""); 
  938.       ERASE_SCREEN; 
  939.       while not END_OF_FILE (FILE_1) loop 
  940.          -- read one line at a time and load the values into
  941.          -- the screen_string array unti end of file is reached
  942.          --
  943.          GET_LINE (FILE_1, SCREEN_STRING, NUMBER_OF_CHARACTERS); 
  944.          --
  945.          -- with a put(string) put all of the characters out
  946.          -- to the terminal. this will display the screen.
  947.          -- number_of_characters is decremented by 1 because
  948.          -- the loop is top tested therefore it gets incremented 1
  949.          -- too many times.
  950.          --
  951.          PUT (SCREEN_STRING (1..NUMBER_OF_CHARACTERS)); 
  952.          --
  953.       end loop; 
  954.       CLOSE (FILE_1); 
  955.    --
  956.    end DISPLAY_MENU; 
  957.    --
  958.    --
  959.    -------------------------
  960.    procedure SCROLL_SCREEN (TOP_OF_SCROLL_AREA, BOTTOM_OF_SCROLL_AREA  : 
  961.              POSITIVE; 
  962.                             DIRECTION                                  : in UP_OR_DOWN) 
  963.              is 
  964.    -------------------------
  965.    --
  966.    -- this routine scrolls the displayed message up or down on
  967.    -- the user terminal as specified.
  968.    --
  969.       DIRECTION_STRING  : STRING (1..1); 
  970.       TOP_STRING        : STRING (1..2); 
  971.       BOTTOM_STRING     : STRING (1..2); 
  972.       ROW_NUMBER        : POSITIVE; 
  973.    begin 
  974.       PUT (TOP_STRING, TOP_OF_SCROLL_AREA); 
  975.       if TOP_STRING (1) = ' ' then 
  976.          TOP_STRING (1) := '0'; 
  977.       end if; 
  978.       PUT (BOTTOM_STRING, BOTTOM_OF_SCROLL_AREA); 
  979.       if BOTTOM_STRING (1) = ' ' then 
  980.          BOTTOM_STRING (1) := '0'; 
  981.       end if; 
  982.       PUT (ASCII.ESC); 
  983.       PUT ("[" & TOP_STRING & ";" & BOTTOM_STRING & "r"); 
  984.       if DIRECTION = UP then 
  985.          ROW_NUMBER := BOTTOM_OF_SCROLL_AREA; 
  986.          DIRECTION_STRING := "D"; 
  987.       else 
  988.          ROW_NUMBER := TOP_OF_SCROLL_AREA; 
  989.          DIRECTION_STRING := "M"; 
  990.       end if; 
  991.       GOTO_CRT_POSITION (ROW_NUMBER, 1); 
  992.       PUT (ASCII.ESC); 
  993.       PUT (DIRECTION_STRING); 
  994.       PUT (BOTTOM_STRING, NMBR_OF_ROWS); 
  995.       PUT (ASCII.ESC); 
  996.       PUT ("[1;" & BOTTOM_STRING & "r"); 
  997.    --
  998.    end SCROLL_SCREEN; 
  999.    --
  1000.    --
  1001.    ----------------------------
  1002.    procedure READ_NOECHO (TEXT  : in out STRING) is 
  1003.    ----------------------------
  1004.    -- this routine is written in iwth direct use of the KAPSE.
  1005.    -- the routines used within are further described in the installation
  1006.    -- guide for TeleSoft under the LCD section.
  1007.    -- this routine will read a string of characters with no echo.
  1008.    -- it is primarily designed to read only one character since
  1009.    -- backspace and del aren't acknowledged.
  1010.    --
  1011.       --
  1012.       -- info is a record which defines how to open the terminal
  1013.       --  
  1014.       INFO      : FILE_INFO; 
  1015.       F         : FILENO; 
  1016.       LAST      : STRING_INDEX; 
  1017.       WHY_LESS  : TERMINATOR; 
  1018.       RESULT    : ERROR_CLASS; 
  1019.    --
  1020.    begin 
  1021.    
  1022.       INFO.FILE_TYPE := TEXT_KIND; 
  1023.       INFO.TERMINAL := TRUE; 
  1024.       INFO.CHARACTER_MODE := TRUE; 
  1025.       INFO.NEEDS_ECHO := TRUE; 
  1026.       INFO.EOLN_CH := ASCII.NUL; 
  1027.       INFO.EOP_CH := ASCII.NUL; 
  1028.       INFO.EOF_CH := ASCII.NUL; 
  1029.       INFO.BACKSPACE_CH := ASCII.NUL; 
  1030.       INFO.DEL_CH := ASCII.NUL; 
  1031.       --
  1032.       -- open the terminal as an input device
  1033.       --
  1034.       FS_OPEN (F, 
  1035.       "sys$input:", 
  1036.       "", 
  1037.       CONSOLE, 
  1038.       SEQUENTIAL_ACCESS, 
  1039.       TEXT_KIND, 
  1040.       "", 
  1041.       IN_OUT_MODE, 
  1042.       FALSE, 
  1043.       TRUE, 
  1044.       132, 
  1045.       RESULT); 
  1046.       --
  1047.       -- now the terminal is open so set some characteristics
  1048.       -- with a put_info
  1049.       --
  1050.       FS_PUT_INFO (F, INFO, RESULT); 
  1051.       --
  1052.       -- get the characters
  1053.       --
  1054.       FS_GET_CHARS (F, TEXT, LAST, WHY_LESS, RESULT); 
  1055.       --
  1056.       -- close the terminal as a file
  1057.       --
  1058.       FS_CLOSE (F, RESULT); 
  1059.       --
  1060.    --
  1061.    end READ_NOECHO; 
  1062.    --
  1063.    ---------------------
  1064.    procedure GET_COMMAND (EDIT_COMMAND  : out COMMAND) is 
  1065.    ---------------------
  1066.    --
  1067.    -- this routine will return a edit function command issued by the usr
  1068.    --
  1069.       KEY_FOR     : EDIT_FUNC_KEYS; 
  1070.       KEY         : FUNCTION_KEY;      -- from termdef
  1071.       CHAR        : CHARACTER; 
  1072.       BLANK_LINE  : STRING (1..NMBR_OF_COLS) := (1..NMBR_OF_COLS => ' '); 
  1073.    begin 
  1074.       READ_NOECHO (KEY);       ------
  1075.       --
  1076.       -- now convert the string into an element of the enumerated
  1077.       -- type command. This is done to make the editor pure of
  1078.       -- references to function keys.
  1079.       --
  1080.       if KEY = KEY_FOR.NEXT_FIELD then 
  1081.          EDIT_COMMAND := NEXT_FIELD; 
  1082.       elsif KEY = KEY_FOR.PREV_FIELD then 
  1083.          EDIT_COMMAND := PREV_FIELD; 
  1084.       elsif KEY = KEY_FOR.ERASE_FIELD then 
  1085.          EDIT_COMMAND := ERASE_FIELD; 
  1086.       elsif KEY = KEY_FOR.NEXT_LINE then 
  1087.          EDIT_COMMAND := NEXT_LINE; 
  1088.       elsif KEY = KEY_FOR.PREV_LINE then 
  1089.          EDIT_COMMAND := PREV_LINE; 
  1090.       elsif KEY = KEY_FOR.INSERT_LINE then 
  1091.          EDIT_COMMAND := INSERT_LINE; 
  1092.       elsif KEY = KEY_FOR.DELETE_LINE then 
  1093.          EDIT_COMMAND := DELETE_LINE; 
  1094.       elsif KEY = KEY_FOR.EDIT_LINE then 
  1095.          EDIT_COMMAND := EDIT_LINE; 
  1096.       elsif KEY = KEY_FOR.END_EDIT then 
  1097.          EDIT_COMMAND := END_EDIT; 
  1098.       elsif KEY = KEY_FOR.CLASSIFY then 
  1099.          EDIT_COMMAND := CLASSIFY; 
  1100.       elsif KEY = KEY_FOR.UP_ARROW then 
  1101.          EDIT_COMMAND := UP_ARROW; 
  1102.       elsif KEY = KEY_FOR.DOWN_ARROW then 
  1103.          EDIT_COMMAND := DOWN_ARROW; 
  1104.       elsif KEY = KEY_FOR.RIGHT_ARROW then 
  1105.          EDIT_COMMAND := RIGHT_ARROW; 
  1106.       elsif KEY = KEY_FOR.LEFT_ARROW then 
  1107.          EDIT_COMMAND := LEFT_ARROW; 
  1108.       else 
  1109.          EDIT_COMMAND := NIL; 
  1110.       end if; 
  1111.       if PROMPT_DISPLAYED = TRUE then 
  1112.          PROMPT (BLANK_LINE); 
  1113.          PROMPT_DISPLAYED := FALSE; 
  1114.       end if; 
  1115.    end GET_COMMAND; 
  1116.    --
  1117.    --
  1118.    --------------------
  1119.    procedure READ (TEXT          : in out STRING; 
  1120.                    NUM_CHAR      : in POSITIVE; 
  1121.                    COMMAND_FLAG  : out BOOLEAN; 
  1122.                    EDIT_COMMAND  : out COMMAND) is 
  1123.    --------------------
  1124.    --
  1125.       FAKE_CHARACTER  : STRING (1..1); 
  1126.       COUNT           : INTEGER; 
  1127.    begin 
  1128.    --
  1129.       --
  1130.       COMMAND_FLAG := FALSE; 
  1131.       COUNT := 1; 
  1132.       while COUNT <= NUM_CHAR loop 
  1133.          READ_NOECHO (FAKE_CHARACTER); 
  1134.          exit when FAKE_CHARACTER (1) = ASCII.CR or FAKE_CHARACTER (1) = 
  1135.                    ASCII.ESC; 
  1136.          if (FAKE_CHARACTER (1) = ASCII.BS or FAKE_CHARACTER (1) = ASCII.DEL) 
  1137.                    and (COUNT /= 1) then 
  1138.             PUT (FAKE_CHARACTER); 
  1139.             COUNT := COUNT - 1; 
  1140.             if FAKE_CHARACTER (1) = ASCII.DEL then 
  1141.                TEXT (COUNT) := ' '; 
  1142.             end if; 
  1143.          else 
  1144.             if FAKE_CHARACTER (1) /= ASCII.BS and FAKE_CHARACTER (1) /= 
  1145.                       ASCII.DEL then 
  1146.                TEXT (COUNT) := FAKE_CHARACTER (1); 
  1147.                PUT (FAKE_CHARACTER); 
  1148.                COUNT := COUNT + 1; 
  1149.             end if; 
  1150.          end if; 
  1151.       end loop; 
  1152.       if FAKE_CHARACTER (1) = ASCII.ESC then 
  1153.          GET_COMMAND (EDIT_COMMAND); 
  1154.          COMMAND_FLAG := TRUE; 
  1155.       end if; 
  1156.       --
  1157.    end READ; 
  1158.    --
  1159. end MAN_MACHINE_INTERFACE; 
  1160. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1161. --typelist.sp
  1162. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1163. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1164. --                                                                    --
  1165. --            Program unit:  PACKAGE TYPE_LIST                        --
  1166. --            File name :    TYPELIST.SP                              --
  1167. --                                                                    --
  1168. --            ===========================================             --
  1169. --                                                                    --
  1170. --                                                                    --
  1171. --            Produced by Veda Incorporated                           --
  1172. --            Version  1.0      April 15, 1985                        --
  1173. --                                                                    --
  1174. --                                                                    --
  1175. --            This program unit is a member of the GMHF. It           --
  1176. --            was developed using TeleSoft's Ada compiler,            --
  1177. --            version 2.1 in a VAX/VMS environment, version           --
  1178. --            3.7                                                     --
  1179. --                                                                    --
  1180. --                                                                    --
  1181. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1182. --
  1183. package TYPE_LIST is 
  1184. --
  1185. -- specification for all message types
  1186. -- currently supported by the system
  1187. --
  1188.    type AVAILABLE_TYPES is (RAINFORM, UNITREP); 
  1189. --
  1190. end TYPE_LIST; 
  1191. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1192. --class.sp
  1193. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1194. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1195. --                                                                    --
  1196. --            Program unit:  PACKAGE CLASSIFICATION_DEFINITION        --
  1197. --            File name :    CLASS.SP                                 --
  1198. --                                                                    --
  1199. --            ===========================================             --
  1200. --                                                                    --
  1201. --                                                                    --
  1202. --            Produced by Veda Incorporated                           --
  1203. --            Version  1.0      April 15, 1985                        --
  1204. --                                                                    --
  1205. --                                                                    --
  1206. --            This program unit is a member of the GMHF. It           --
  1207. --            was developed using TeleSoft's Ada compiler,            --
  1208. --            version 2.1 in a VAX/VMS environment, version           --
  1209. --            3.7                                                     --
  1210. --                                                                    --
  1211. --                                                                    --
  1212. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1213. --
  1214. ------------------------------------------------------- 
  1215. package CLASSIFICATION_DEFINITION is 
  1216. -------------------------------------------------------
  1217. --
  1218. -- classification is a package used to define a type for classification
  1219. -- and routines to get a user entered classification and to display a
  1220. -- classification to the screen
  1221. --
  1222.  
  1223.    type CLASSIFICATION is (UNCLASSIFIED, CONFIDENTIAL, SECRET,       
  1224.                            TOP_SECRET                                        
  1225.              ); 
  1226.    
  1227.    procedure GET_CLASSIFICATION (CLASS  : out CLASSIFICATION); 
  1228.    
  1229.    procedure DISPLAY_CLASSIFICATION (CLASS  : in CLASSIFICATION); 
  1230.    --
  1231.    procedure DISPLAY_LOWER_CLASSIFICATION (CLASS  : in CLASSIFICATION); 
  1232. --
  1233. end CLASSIFICATION_DEFINITION; 
  1234. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1235. --class.txt
  1236. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1237. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1238. --                                                                    --
  1239. --            Program unit:  PACKAGE CLASSIFICATION_DEFINITION        --
  1240. --            File name :    CLASS.TXT                                --
  1241. --                                                                    --
  1242. --            ===========================================             --
  1243. --                                                                    --
  1244. --                                                                    --
  1245. --            Produced by Veda Incorporated                           --
  1246. --            Version  1.0      April 15, 1985                        --
  1247. --                                                                    --
  1248. --                                                                    --
  1249. --            This program unit is a member of the GMHF. It           --
  1250. --            was developed using TeleSoft's Ada compiler,            --
  1251. --            version 2.1 in a VAX/VMS environment, version           --
  1252. --            3.7                                                     --
  1253. --                                                                    --
  1254. --                                                                    --
  1255. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1256. --
  1257. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  1258. with TERMINAL_DEFINITION;    use TERMINAL_DEFINITION; 
  1259. with TEXT_IO;                use TEXT_IO; 
  1260. -------------------------------------------------
  1261. package body CLASSIFICATION_DEFINITION is 
  1262. -------------------------------------------------
  1263. --
  1264.    INDEX  : POSITIVE; 
  1265.    subtype CLASS_STRING  is STRING (1..12); 
  1266.    type CLASS_ARRAY      is array (CLASSIFICATION) of CLASS_STRING; 
  1267.    CLASS_PROMPT  : CLASS_ARRAY := (UNCLASSIFIED => "UNCLASSIFIED", 
  1268.    CONFIDENTIAL => "CONFIDENTIAL", 
  1269.    SECRET => "SECRET      ", 
  1270.    TOP_SECRET => "TOP SECRET  "); 
  1271.    BLANKS        : CLASS_STRING := "            "; 
  1272.    
  1273.    type CLASS_PROMPT_LENGTH  is array (CLASSIFICATION) of POSITIVE; 
  1274.    CLASS_LENGTH  : CLASS_PROMPT_LENGTH := (UNCLASSIFIED => 12, 
  1275.    CONFIDENTIAL => 12, 
  1276.    SECRET => 6, 
  1277.    TOP_SECRET => 10); 
  1278.    package CLASS_IO is new ENUMERATION_IO (CLASSIFICATION); 
  1279.    
  1280.    ----------------------------
  1281.    procedure GET_CLASSIFICATION (CLASS  : out CLASSIFICATION) is 
  1282.    ----------------------------
  1283.       DUMMY_STRING       : STRING (1..12); 
  1284.       CHARACTERS_GOTTEN  : POSITIVE; 
  1285.       COMMAND_FLAG       : BOOLEAN; 
  1286.       COMMAND_GOTTEN     : COMMAND; 
  1287.    begin 
  1288.       loop 
  1289.          begin 
  1290.             READ (DUMMY_STRING, 12, COMMAND_FLAG, COMMAND_GOTTEN); 
  1291.             if DUMMY_STRING (1..4) = "TOP " then 
  1292.                DUMMY_STRING (1..4) := "TOP_"; 
  1293.             end if; 
  1294.             CLASS_IO.GET (DUMMY_STRING, CLASS, CHARACTERS_GOTTEN); 
  1295.             exit; 
  1296.          exception 
  1297.             when END_ERROR => 
  1298.                exit; 
  1299.             when others => 
  1300.                PROMPT ("Invalid classification entry. Please reenter data."); 
  1301.                GOTO_CRT_POSITION (TOP_OF_AMP_AREA + 3, 40); 
  1302.          end; 
  1303.       end loop; 
  1304.    end GET_CLASSIFICATION; 
  1305.    --
  1306.    --------------------------------
  1307.    procedure DISPLAY_CLASSIFICATION (CLASS  : in CLASSIFICATION) is 
  1308.    --------------------------------
  1309.    begin 
  1310.       GOTO_CRT_POSITION (UPPER_CLASSIFICATION); 
  1311.       UNDERSCORE_ON; 
  1312.       PUT (BLANKS); 
  1313.       GOTO_CRT_POSITION (UPPER_CLASSIFICATION); 
  1314.       PUT (CLASS_PROMPT (CLASS) (1..CLASS_LENGTH (CLASS))); 
  1315.       GOTO_CRT_POSITION (LOWER_CLASSIFICATION); 
  1316.       UNDERSCORE_OFF; 
  1317.       PUT (BLANKS); 
  1318.       UNDERSCORE_ON; 
  1319.       GOTO_CRT_POSITION (LOWER_CLASSIFICATION); 
  1320.       PUT (CLASS_PROMPT (CLASS) (1..CLASS_LENGTH (CLASS))); 
  1321.       UNDERSCORE_OFF; 
  1322.    end DISPLAY_CLASSIFICATION; 
  1323.    --------------------------------
  1324.    procedure DISPLAY_LOWER_CLASSIFICATION (CLASS  : in CLASSIFICATION) is 
  1325.    --------------------------------
  1326.    begin 
  1327.       GOTO_CRT_POSITION (LOWER_CLASSIFICATION); 
  1328.       PUT (BLANKS); 
  1329.       UNDERSCORE_ON; 
  1330.       GOTO_CRT_POSITION (LOWER_CLASSIFICATION); 
  1331.       PUT (CLASS_PROMPT (CLASS) (1..CLASS_LENGTH (CLASS))); 
  1332.       UNDERSCORE_OFF; 
  1333.    end DISPLAY_LOWER_CLASSIFICATION; 
  1334. end CLASSIFICATION_DEFINITION; 
  1335. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1336. --lnklst.sp
  1337. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1338. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1339. --                                                                    --
  1340. --            Program unit:  PACKAGE LINKED_LIST_PROCEDURED           --
  1341. --            File name :    LNKLST.SP                                --
  1342. --                                                                    --
  1343. --            ===========================================             --
  1344. --                                                                    --
  1345. --                                                                    --
  1346. --            Produced by Veda Incorporated                           --
  1347. --            Version  1.0      April 15, 1985                        --
  1348. --                                                                    --
  1349. --                                                                    --
  1350. --            This program unit is a member of the GMHF. It           --
  1351. --            was developed using TeleSoft's Ada compiler,            --
  1352. --            version 2.1 in a VAX/VMS environment, version           --
  1353. --            3.7                                                     --
  1354. --                                                                    --
  1355. --                                                                    --
  1356. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1357. --
  1358. with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  1359. ---------------------------------------
  1360. package LINKED_LIST_PROCEDURES is 
  1361. ---------------------------------------
  1362. -- this package contains three procedures needed to edit a
  1363. -- message as a linked list of lines. The three visible 
  1364. -- procedures allow one to insert a line before or after
  1365. -- the node specified, and to delete the node specified.
  1366. -- The structure implemented is a doubly linked list with
  1367. -- pointers to the head and tail. See the definitions of
  1368. -- message_component and message.
  1369.    --
  1370.    -- node is defined as access to elements of type message_component
  1371.    --
  1372.    subtype LINE_OF_TEXT    is STRING (1..80); 
  1373.    --
  1374.    type MESSAGE_COMPONENT;  
  1375.    --
  1376.    type NODE               is access MESSAGE_COMPONENT; 
  1377.    --
  1378.    type MESSAGE_COMPONENT  is record 
  1379.       NEXT_LINE        : NODE; 
  1380.       PREV_LINE        : NODE; 
  1381.       LINE_TYPE        : POSITIVE; 
  1382.       TEXT_LINE        : LINE_OF_TEXT := (OTHERS => ' '); 
  1383.    end record; 
  1384.    --
  1385.    -- a message is then defined as an entity of type message. in
  1386.    -- defining a message, we specify pointers to its head and tail
  1387.    -- (first and last lines), its classification, and keep current
  1388.    -- the number of lines in the message.
  1389.    --
  1390.    type MESSAGE            is record 
  1391.       HEAD             : NODE; 
  1392.       TAIL             : NODE; 
  1393.       CLASS            : CLASSIFICATION; 
  1394.       NUMBER_OF_LINES  : POSITIVE; 
  1395.    end record; 
  1396.    --
  1397.    procedure INSERT_BEFORE (INPUT_MESSAGE  : in out MESSAGE; 
  1398.                             POINTER        : NODE); 
  1399.    
  1400.    procedure INSERT_AFTER (INPUT_MESSAGE  : in out MESSAGE; 
  1401.                            POINTER        : NODE); 
  1402.    
  1403.    procedure DELETE (INPUT_MESSAGE  : in out MESSAGE; 
  1404.                      POINTER        : NODE); 
  1405.    --
  1406. end LINKED_LIST_PROCEDURES; 
  1407. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1408. --lnklst.txt
  1409. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1410. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1411. --                                                                    --
  1412. --            Program unit:  PACKAGE LINKED_LIST_PROCEDURES           --
  1413. --            File name :    LNKLST.TXT                               --
  1414. --                                                                    --
  1415. --            ===========================================             --
  1416. --                                                                    --
  1417. --                                                                    --
  1418. --            Produced by Veda Incorporated                           --
  1419. --            Version  1.0      April 15, 1985                        --
  1420. --                                                                    --
  1421. --                                                                    --
  1422. --            This program unit is a member of the GMHF. It           --
  1423. --            was developed using TeleSoft's Ada compiler,            --
  1424. --            version 2.1 in a VAX/VMS environment, version           --
  1425. --            3.7                                                     --
  1426. --                                                                    --
  1427. --                                                                    --
  1428. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1429. --
  1430. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  1431. ---------------------------------------
  1432. package body LINKED_LIST_PROCEDURES is 
  1433. ---------------------------------------
  1434. -- this package contains three procedures needed to edit a
  1435. -- message as a linked list of lines. The three visible 
  1436. -- procedures allow one to insert a line before or after
  1437. -- the node specified, and to delete the node specified.
  1438. -- The structure implemented is a doubly linked list with
  1439. -- pointers to the head and tail. See the definitions of
  1440. -- message_component and message.
  1441. --
  1442.    ------------------------------------
  1443.    procedure INSERT_BEFORE (INPUT_MESSAGE  : in out MESSAGE; 
  1444.                             POINTER        : NODE) is 
  1445.    ------------------------------------
  1446.       NEW_POINTER  : NODE;   -- holds pointer to a new message component
  1447.    begin 
  1448.       --
  1449.       -- first check boundary condition
  1450.       --
  1451.       if POINTER = null then 
  1452.          PROMPT ("cannot insert a line in a non-existant message"); 
  1453.          return; 
  1454.       end if; 
  1455.       --
  1456.       -- its ok to add the line, so go get a new message_component
  1457.       -- and set the pointers. If the new line will be the head, 
  1458.       -- set them in the then block, otherwise in the else block
  1459.       --
  1460.       NEW_POINTER := new MESSAGE_COMPONENT; 
  1461.       --
  1462.       if POINTER = INPUT_MESSAGE.HEAD then --new first line ?
  1463.          NEW_POINTER.NEXT_LINE := POINTER;     -- link new line to
  1464.          POINTER.PREV_LINE := NEW_POINTER; -- following line
  1465.          INPUT_MESSAGE.HEAD := NEW_POINTER;   --set head pointer
  1466.                     -- below, link new line to precedng line
  1467.          NEW_POINTER.PREV_LINE := INPUT_MESSAGE.TAIL; 
  1468.          INPUT_MESSAGE.TAIL.NEXT_LINE := NEW_POINTER; 
  1469.       --
  1470.       else                             -- not new first line
  1471.          NEW_POINTER.NEXT_LINE := POINTER; -- set pointers in
  1472.          NEW_POINTER.PREV_LINE := POINTER.PREV_LINE;   -- new line
  1473.          POINTER.PREV_LINE.NEXT_LINE := NEW_POINTER;   -- set them in
  1474.          POINTER.PREV_LINE := NEW_POINTER;  -- preceding and
  1475.                                          --  following lines
  1476.       end if; 
  1477.       --
  1478.    end INSERT_BEFORE; 
  1479.    --
  1480.    -----------------------------------
  1481.    procedure INSERT_AFTER (INPUT_MESSAGE  : in out MESSAGE; 
  1482.                            POINTER        : NODE) is 
  1483.    -----------------------------------
  1484.       NEW_POINTER  : NODE;   --holds a pointer to a new message component
  1485.    begin 
  1486.       --
  1487.       -- first check boundary condition
  1488.       --
  1489.       if POINTER = null then 
  1490.          PROMPT ("cannot insert a line in a non-existant message"); 
  1491.          return; 
  1492.       end if; 
  1493.       --
  1494.       -- its ok to add the line, so go get a new message_component
  1495.       -- and set the pointers. If the new line will be the tail,
  1496.       -- set them in the then block, otherwise in the else block
  1497.       --
  1498.       NEW_POINTER := new MESSAGE_COMPONENT; 
  1499.       --
  1500.       if POINTER = INPUT_MESSAGE.TAIL then -- new last line ?
  1501.          NEW_POINTER.PREV_LINE := POINTER;     -- link new line to
  1502.          POINTER.NEXT_LINE := NEW_POINTER; -- preceding line
  1503.          INPUT_MESSAGE.TAIL := NEW_POINTER;   --set tail pointer
  1504.                     --below, link new line to following line
  1505.          NEW_POINTER.NEXT_LINE := INPUT_MESSAGE.HEAD; 
  1506.          INPUT_MESSAGE.HEAD.PREV_LINE := NEW_POINTER; 
  1507.       --
  1508.       else                              -- not new last line
  1509.          NEW_POINTER.PREV_LINE := POINTER;   -- set pointers in
  1510.          NEW_POINTER.NEXT_LINE := POINTER.NEXT_LINE;   -- new line
  1511.          POINTER.NEXT_LINE.PREV_LINE := NEW_POINTER;   -- set them
  1512.          POINTER.NEXT_LINE := NEW_POINTER;   -- in previous and
  1513.                                          --  following lines
  1514.       end if; 
  1515.       --
  1516.    end INSERT_AFTER; 
  1517.    --
  1518.    ------------------------------
  1519.    procedure DELETE (INPUT_MESSAGE  : in out MESSAGE; 
  1520.                      POINTER        : NODE) is 
  1521.    ------------------------------
  1522.    begin 
  1523.       --
  1524.       -- first check boundary condition
  1525.       --
  1526.       if POINTER = null then 
  1527.          PROMPT ("cannot delete a line from an empty message"); 
  1528.          return; 
  1529.       end if; 
  1530.       --
  1531.       -- its ok to delete the line, so determine whether it is a
  1532.       -- one line message or whether it is longer. If it is a one
  1533.       -- line message, handle it in the then block, otherwise in
  1534.       -- the else block
  1535.       --
  1536.       if INPUT_MESSAGE.HEAD = INPUT_MESSAGE.TAIL then 
  1537.          INPUT_MESSAGE.HEAD := null;     -- set head and tail
  1538.          INPUT_MESSAGE.TAIL := null;   -- pointers to null
  1539.          INPUT_MESSAGE.NUMBER_OF_LINES := 0;   -- and # lines= 0
  1540.       --
  1541.       else                             -- more than one line
  1542.          --
  1543.          -- set preceding line pointer and following line pointer
  1544.          --
  1545.          POINTER.PREV_LINE.NEXT_LINE := POINTER.NEXT_LINE; 
  1546.          POINTER.NEXT_LINE.PREV_LINE := POINTER.PREV_LINE; 
  1547.          --
  1548.          -- if the line being deleted is the head and/or the tail
  1549.          -- we must reset the head/tail pointer(s)
  1550.          --
  1551.          if POINTER = INPUT_MESSAGE.HEAD then   -- reset head
  1552.             INPUT_MESSAGE.HEAD := POINTER.NEXT_LINE;   --pointer
  1553.          end if; 
  1554.          --
  1555.          if POINTER = INPUT_MESSAGE.TAIL then   -- reset tail
  1556.             INPUT_MESSAGE.TAIL := POINTER.PREV_LINE;   --pointer
  1557.          end if; 
  1558.       --
  1559. -- ***  need to insert a call to an instance of a de-allocate proc here
  1560.       --
  1561.       end if; 
  1562.    end DELETE; 
  1563.    --
  1564. end LINKED_LIST_PROCEDURES; 
  1565. --
  1566. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1567. --fap.sp
  1568. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1569. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1570. --                                                                    --
  1571. --            Program unit:  PACKAGE FILE_ACCESS                      --
  1572. --            File name :    FAP.SP                                   --
  1573. --                                                                    --
  1574. --            ===========================================             --
  1575. --                                                                    --
  1576. --                                                                    --
  1577. --            Produced by Veda Incorporated                           --
  1578. --            Version  1.0      April 15, 1985                        --
  1579. --                                                                    --
  1580. --                                                                    --
  1581. --            This program unit is a member of the GMHF. It           --
  1582. --            was developed using TeleSoft's Ada compiler,            --
  1583. --            version 2.1 in a VAX/VMS environment, version           --
  1584. --            3.7                                                     --
  1585. --                                                                    --
  1586. --                                                                    --
  1587. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1588. --
  1589. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  1590. with TYPE_LIST;               use TYPE_LIST; 
  1591. --
  1592. package FILE_ACCESS is 
  1593. --
  1594. -- This package is available only to routines internal to
  1595. -- the system driver package. The routines deal mainly with 
  1596. -- managing the messages of the internal database.
  1597. -- External users may not utilize any of these routines.
  1598.  
  1599.   -- 
  1600.   --  linked_list directory structure
  1601.   --
  1602.  
  1603.    type DIRECTORY_STRUCTURE;       -- incomplete type declaration
  1604.    type DIRECTORY_ENTRY      is access DIRECTORY_STRUCTURE; 
  1605.    
  1606.    type DIRECTORY_STRUCTURE  is record 
  1607.       MESSAGE_TYPE           : AVAILABLE_TYPES; 
  1608.       MESSAGE_FILENAME       : STRING (1..9); 
  1609.       NUMBER_OF_MESSAGES     : NATURAL; 
  1610.       PREVIOUS_MESSAGE_TYPE  : DIRECTORY_ENTRY; 
  1611.       NEXT_MESSAGE_TYPE      : DIRECTORY_ENTRY; 
  1612.       TYPE_STRING            : STRING (1..11); 
  1613.       NUMBER_STRING          : STRING (1..5); 
  1614.    end record; 
  1615.    
  1616.    TOP_OF_DIRECTORY  : DIRECTORY_ENTRY; 
  1617.    
  1618.   --
  1619.   --  returns a pointer to the top of the directory
  1620.   --
  1621.    
  1622.    procedure GET_DIRECTORY (TOP_OF_DIRECTORY  : out DIRECTORY_ENTRY); 
  1623.    
  1624.   --
  1625.   --  retrieves a message from the internal data base 
  1626.   --
  1627.    
  1628.    procedure GET_MESSAGE_OUT (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1629.                               MESSAGE_NUMBER     : in NATURAL; 
  1630.                               MESSAGE_TEXT       : in out MESSAGE); 
  1631.    
  1632.   --
  1633.   --  adds a new message to the internal data base
  1634.   --
  1635.    
  1636.    procedure PUT_NEW_MESSAGE_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1637.                                  MESSAGE_TEXT       : in MESSAGE); 
  1638.    
  1639.   --
  1640.   --  replaces a message within the internal data base
  1641.   --
  1642.    
  1643.    procedure PUT_OLD_MESSAGE_BACK_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1644.                                       MESSAGE_NUMBER     : in NATURAL; 
  1645.                                       MESSAGE_TEXT       : in MESSAGE); 
  1646.    
  1647.   --
  1648.   --  deletes a message from the internal data base
  1649.   --
  1650.    
  1651.    procedure DELETE_MESSAGE_FROM_DATABASE (DIRECTORY_POINTER  : in out 
  1652.              DIRECTORY_ENTRY; 
  1653.                                            MESSAGE_NUMBER     : in NATURAL); 
  1654.    
  1655. end FILE_ACCESS; 
  1656. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1657. --fap.txt
  1658. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1659. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1660. --                                                                    --
  1661. --            Program unit:  PACKAGE FILE_ACCESS                      --
  1662. --            File name :    FAP.TXT                                  --
  1663. --                                                                    --
  1664. --            ===========================================             --
  1665. --                                                                    --
  1666. --                                                                    --
  1667. --            Produced by Veda Incorporated                           --
  1668. --            Version  1.0      April 15, 1985                        --
  1669. --                                                                    --
  1670. --                                                                    --
  1671. --            This program unit is a member of the GMHF. It           --
  1672. --            was developed using TeleSoft's Ada compiler,            --
  1673. --            version 2.1 in a VAX/VMS environment, version           --
  1674. --            3.7                                                     --
  1675. --                                                                    --
  1676. --                                                                    --
  1677. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  1678. --
  1679. with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  1680. with MAN_MACHINE_INTERFACE;      use MAN_MACHINE_INTERFACE; 
  1681. with TERMINAL_DEFINITION;        use TERMINAL_DEFINITION; 
  1682. with DIRECT_IO;                  
  1683. with CALENDAR;                   
  1684. with TEXT_IO;                    use TEXT_IO; 
  1685.  
  1686. package body FILE_ACCESS is 
  1687. --
  1688. -- This package is available only to routines internal to
  1689. -- the system driver package. The routines deal mainly with 
  1690. -- managing the messages of the internal database.
  1691. -- External users may not utilize any of these routines.
  1692. --
  1693.    -----------------------------------------------
  1694.    --
  1695.    -- local variables and direct_io instantiations
  1696.    --
  1697.    -----------------------------------------------
  1698.    --
  1699.    RECORD_ERROR  : exception; 
  1700.    --
  1701.    -- define the internal storage format of a message
  1702.    --
  1703.    type MESSAGE_FORMAT  is array (1..25) of STRING (1..80); 
  1704.    --
  1705.    type MESSAGE_RECORD  is record 
  1706.       CLASS             : CLASSIFICATION; 
  1707.       NUMBER_OF_LINES   : POSITIVE; 
  1708.       MONTH, DAY, YEAR  : INTEGER; 
  1709.       CONTENT           : MESSAGE_FORMAT; 
  1710.    end record; 
  1711.    --
  1712.    package DIRECTORY_IO is new DIRECT_IO (DIRECTORY_STRUCTURE); 
  1713.    use DIRECTORY_IO; 
  1714.    FILE_1            : DIRECTORY_IO.FILE_TYPE; 
  1715.    RECORD_NUMBER     : DIRECTORY_IO.POSITIVE_COUNT; 
  1716.    --
  1717.    DIRECTORY_RECORD  : DIRECTORY_STRUCTURE; 
  1718.    --
  1719.    package MESSAGE_IO is new DIRECT_IO (MESSAGE_RECORD); 
  1720.    use MESSAGE_IO; 
  1721.    FILE_2                 : MESSAGE_IO.FILE_TYPE; 
  1722.    MESSAGE_RECORD_NUMBER  : MESSAGE_IO.POSITIVE_COUNT; 
  1723.    --
  1724.    MESSAGE_DATA           : MESSAGE_RECORD; 
  1725.    --
  1726.    LINE_NUMBER            : POSITIVE; 
  1727.    FOUND                  : BOOLEAN; 
  1728.    --
  1729.    MONTH, DAY, YEAR       : INTEGER; 
  1730.    --
  1731.    package MESSAGE_TYPE_IO is new ENUMERATION_IO (AVAILABLE_TYPES); 
  1732.    package NATURAL_IO is new INTEGER_IO (NATURAL); 
  1733.   --
  1734.   ----------------------------------------
  1735.   --  local date routine
  1736.   ----------------------------------------
  1737.    procedure GET_THE_DATE (MONTH, DAY, YEAR  : out INTEGER) is 
  1738.    --
  1739.       COMPUTE_TIME  : CALENDAR.TIME; 
  1740.    --
  1741.    begin 
  1742.       --
  1743.       COMPUTE_TIME := CALENDAR.CLOCK; 
  1744.       --
  1745.       MONTH := CALENDAR.MONTH (COMPUTE_TIME); 
  1746.       DAY := CALENDAR.DAY (COMPUTE_TIME); 
  1747.       YEAR := CALENDAR.YEAR (COMPUTE_TIME); 
  1748.       --
  1749.    end GET_THE_DATE; 
  1750.   --
  1751.   --
  1752.   ----------------------------------------
  1753.    procedure GET_DIRECTORY (TOP_OF_DIRECTORY  : out DIRECTORY_ENTRY) is 
  1754.   ----------------------------------------
  1755.    
  1756.       CURRENT_POINTER  : DIRECTORY_ENTRY; 
  1757.       NEXT_POINTER     : DIRECTORY_ENTRY; 
  1758.       --
  1759.       --
  1760.    begin
  1761.       --
  1762.       -- open the directory
  1763.       --
  1764.       OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  1765.       --
  1766.       -- save the top of the directory linked list
  1767.       --
  1768.       CURRENT_POINTER := new DIRECTORY_STRUCTURE; 
  1769.       TOP_OF_DIRECTORY := CURRENT_POINTER; 
  1770.       --
  1771.       -- load the first directory entry
  1772.       --
  1773.       RECORD_NUMBER := 1; 
  1774.       READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  1775.       --
  1776.       -- store the contents at current_pointer
  1777.       --
  1778.       CURRENT_POINTER.MESSAGE_TYPE := DIRECTORY_RECORD.MESSAGE_TYPE; 
  1779.       CURRENT_POINTER.MESSAGE_FILENAME := DIRECTORY_RECORD.MESSAGE_FILENAME; 
  1780.       CURRENT_POINTER.NUMBER_OF_MESSAGES := 
  1781.                 DIRECTORY_RECORD.NUMBER_OF_MESSAGES; 
  1782.       CURRENT_POINTER.PREVIOUS_MESSAGE_TYPE := null; 
  1783.       CURRENT_POINTER.TYPE_STRING := DIRECTORY_RECORD.TYPE_STRING; 
  1784.       CURRENT_POINTER.NUMBER_STRING := DIRECTORY_RECORD.NUMBER_STRING; 
  1785.       --
  1786.       -- now get the rest of the records
  1787.       --
  1788.       while not END_OF_FILE (FILE_1) loop 
  1789.          --
  1790.          NEXT_POINTER := new DIRECTORY_STRUCTURE; 
  1791.          RECORD_NUMBER := RECORD_NUMBER + 1; 
  1792.          READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  1793.             --
  1794.          NEXT_POINTER.MESSAGE_TYPE := DIRECTORY_RECORD.MESSAGE_TYPE; 
  1795.          NEXT_POINTER.MESSAGE_FILENAME := DIRECTORY_RECORD.MESSAGE_FILENAME; 
  1796.          NEXT_POINTER.NUMBER_OF_MESSAGES := 
  1797.                    DIRECTORY_RECORD.NUMBER_OF_MESSAGES; 
  1798.          NEXT_POINTER.PREVIOUS_MESSAGE_TYPE := CURRENT_POINTER; 
  1799.          NEXT_POINTER.TYPE_STRING := DIRECTORY_RECORD.TYPE_STRING; 
  1800.          NEXT_POINTER.NUMBER_STRING := DIRECTORY_RECORD.NUMBER_STRING; 
  1801.             --
  1802.          CURRENT_POINTER.NEXT_MESSAGE_TYPE := NEXT_POINTER; 
  1803.          CURRENT_POINTER := NEXT_POINTER; 
  1804.          --
  1805.       end loop; 
  1806.        --
  1807.       CLOSE (FILE_1); 
  1808.        --
  1809.    end GET_DIRECTORY; 
  1810.   --
  1811.   --------------------------------------
  1812.    procedure GET_MESSAGE_OUT (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1813.                               MESSAGE_NUMBER     : in NATURAL; 
  1814.                               MESSAGE_TEXT       : in out MESSAGE) is 
  1815.   --------------------------------------
  1816.   --
  1817.       MESSAGE_POINTER  : NODE;
  1818.   --
  1819.   --
  1820.    begin 
  1821.    --
  1822.       PROMPT("Retrieving data base message");
  1823.     --
  1824.     -- open the message file and read the first record
  1825.     --
  1826.       OPEN (FILE_2, INOUT_FILE, 
  1827.       DIRECTORY_POINTER.MESSAGE_FILENAME & ".MSG", ""); 
  1828.     --
  1829.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES OR
  1830.          MESSAGE_NUMBER = 0 then 
  1831.          MESSAGE_RECORD_NUMBER := 1; 
  1832.       else 
  1833.          MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT ((MESSAGE_NUMBER 
  1834.                    * 4 + 1)); 
  1835.       end if; 
  1836.     --
  1837.       READ (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  1838.     --
  1839.     -- load the first record into memory
  1840.     --
  1841.       MESSAGE_POINTER := new MESSAGE_COMPONENT; 
  1842.     --
  1843.       MESSAGE_TEXT.HEAD := MESSAGE_POINTER; 
  1844.       MESSAGE_TEXT.TAIL := MESSAGE_POINTER; 
  1845.       MESSAGE_TEXT.CLASS := MESSAGE_DATA.CLASS; 
  1846.       MESSAGE_TEXT.NUMBER_OF_LINES := MESSAGE_DATA.NUMBER_OF_LINES; 
  1847.     --
  1848.       MESSAGE_POINTER.NEXT_LINE := null; 
  1849.       MESSAGE_POINTER.PREV_LINE := null; 
  1850.       MESSAGE_POINTER.TEXT_LINE := MESSAGE_DATA.CONTENT (1); 
  1851.     --
  1852.     -- load the remaining lines into memory; an additional record must
  1853.     -- be read after 25, 50 and 75 lines
  1854.     --
  1855.       LINE_NUMBER := 1; 
  1856.       for I in 2..MESSAGE_DATA.NUMBER_OF_LINES loop 
  1857.          LINE_NUMBER := LINE_NUMBER + 1; 
  1858.          if LINE_NUMBER > 25 then 
  1859.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  1860.             if NATURAL (MESSAGE_RECORD_NUMBER) >= (MESSAGE_NUMBER + 1) * 4 + 1 
  1861.                       then 
  1862.                raise RECORD_ERROR; 
  1863.             end if; 
  1864.             LINE_NUMBER := 1; 
  1865.             READ (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  1866.          end if; 
  1867.          INSERT_AFTER (MESSAGE_TEXT, MESSAGE_POINTER); 
  1868.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  1869.          MESSAGE_POINTER.TEXT_LINE := MESSAGE_DATA.CONTENT (LINE_NUMBER); 
  1870.       end loop; 
  1871.     --
  1872.     --
  1873.       CLOSE (FILE_2); 
  1874.   --
  1875.    exception 
  1876.      --
  1877.       when RECORD_ERROR => 
  1878.          CLOSE (FILE_2); 
  1879.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  1880.   --
  1881.    end GET_MESSAGE_OUT; 
  1882.   --
  1883.   -----------------------------------------
  1884.    procedure PUT_NEW_MESSAGE_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1885.                                  MESSAGE_TEXT       : in MESSAGE) is 
  1886.   -----------------------------------------
  1887.   --
  1888.       MESSAGE_POINTER  : NODE; 
  1889.   --
  1890.    begin 
  1891.     --
  1892.     -- find the directory record and update the directory file
  1893.     --
  1894.       RECORD_NUMBER := 1; 
  1895.       OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  1896.       while not END_OF_FILE (FILE_1) loop 
  1897.          READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  1898.          if DIRECTORY_RECORD.MESSAGE_TYPE = DIRECTORY_POINTER.MESSAGE_TYPE 
  1899.                    then 
  1900.             DIRECTORY_RECORD.NUMBER_OF_MESSAGES := 
  1901.                       DIRECTORY_RECORD.NUMBER_OF_MESSAGES + 1; 
  1902.             NATURAL_IO.PUT (TO => DIRECTORY_RECORD.NUMBER_STRING, 
  1903.             ITEM => DIRECTORY_RECORD.NUMBER_OF_MESSAGES); 
  1904.             exit; 
  1905.          else 
  1906.             RECORD_NUMBER := RECORD_NUMBER + 1; 
  1907.          end if; 
  1908.       end loop; 
  1909.     --
  1910.       WRITE (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  1911.       CLOSE (FILE_1); 
  1912.     --
  1913.     -- open the message file
  1914.     --
  1915.       OPEN (FILE_2, INOUT_FILE, 
  1916.       DIRECTORY_RECORD.MESSAGE_FILENAME & ".MSG", ""); 
  1917.     --
  1918.       MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT 
  1919.                 ((DIRECTORY_RECORD.NUMBER_OF_MESSAGES) * 4 + 1); 
  1920.     --
  1921.       MESSAGE_DATA.CLASS := MESSAGE_TEXT.CLASS; 
  1922.       MESSAGE_DATA.NUMBER_OF_LINES := MESSAGE_TEXT.NUMBER_OF_LINES; 
  1923.     --
  1924.       GET_THE_DATE (MONTH, DAY, YEAR); 
  1925.       MESSAGE_DATA.MONTH := MONTH; 
  1926.       MESSAGE_DATA.DAY := DAY; 
  1927.       MESSAGE_DATA.YEAR := YEAR; 
  1928.     --
  1929.     -- write the message to disk, 25 lines per record
  1930.     --
  1931.       MESSAGE_POINTER := MESSAGE_TEXT.HEAD; 
  1932.     --
  1933.       LINE_NUMBER := 1; 
  1934.       for I in 1..MESSAGE_TEXT.NUMBER_OF_LINES loop 
  1935.          MESSAGE_DATA.CONTENT (LINE_NUMBER) := MESSAGE_POINTER.TEXT_LINE; 
  1936.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  1937.          LINE_NUMBER := LINE_NUMBER + 1; 
  1938.          if LINE_NUMBER > 25 or I >= MESSAGE_TEXT.NUMBER_OF_LINES then 
  1939.             LINE_NUMBER := 1; 
  1940.             WRITE (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  1941.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  1942.             if MESSAGE_RECORD_NUMBER >= MESSAGE_IO.POSITIVE_COUNT 
  1943.                       (((DIRECTORY_RECORD.NUMBER_OF_MESSAGES) + 1) * 4 + 1) 
  1944.                       then 
  1945.                raise RECORD_ERROR; 
  1946.             end if; 
  1947.          end if; 
  1948.       end loop; 
  1949.     --
  1950.       CLOSE (FILE_2); 
  1951.       PROMPT("New message saved in data base");
  1952.     --
  1953.    exception 
  1954.      --
  1955.       when RECORD_ERROR => 
  1956.          CLOSE (FILE_2); 
  1957.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  1958.   --
  1959.    end PUT_NEW_MESSAGE_IN; 
  1960.   --
  1961.   ----------------------------------------------
  1962.    procedure PUT_OLD_MESSAGE_BACK_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  1963.                                       MESSAGE_NUMBER     : in NATURAL; 
  1964.                                       MESSAGE_TEXT       : in MESSAGE) is 
  1965.   ----------------------------------------------
  1966.   --
  1967.       MESSAGE_POINTER  : NODE; 
  1968.   --
  1969.    begin 
  1970.     --
  1971.     -- validate the message number
  1972.     --
  1973.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES then 
  1974.          PROMPT ("illegal record number selected"); 
  1975.          return; 
  1976.       end if; 
  1977.     --
  1978.     -- open the message file
  1979.     --
  1980.       OPEN (FILE_2, INOUT_FILE, 
  1981.       DIRECTORY_POINTER.MESSAGE_FILENAME & ".MSG", ""); 
  1982.     --
  1983.     -- must be a valid selection, process it
  1984.     --
  1985.       MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT (MESSAGE_NUMBER * 4 
  1986.                 + 1); 
  1987.     --
  1988.       MESSAGE_DATA.CLASS := MESSAGE_TEXT.CLASS; 
  1989.       MESSAGE_DATA.NUMBER_OF_LINES := MESSAGE_TEXT.NUMBER_OF_LINES; 
  1990.     --
  1991.       GET_THE_DATE (MONTH, DAY, YEAR); 
  1992.       MESSAGE_DATA.MONTH := MONTH; 
  1993.       MESSAGE_DATA.DAY := DAY; 
  1994.       MESSAGE_DATA.YEAR := YEAR; 
  1995.     --
  1996.     -- write the message to disk, 25 lines per record
  1997.     --
  1998.       MESSAGE_POINTER := MESSAGE_TEXT.HEAD; 
  1999.     --
  2000.       LINE_NUMBER := 1; 
  2001.       for I in 1..MESSAGE_TEXT.NUMBER_OF_LINES loop 
  2002.          MESSAGE_DATA.CONTENT (LINE_NUMBER) := MESSAGE_POINTER.TEXT_LINE; 
  2003.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  2004.          LINE_NUMBER := LINE_NUMBER + 1; 
  2005.          if LINE_NUMBER > 25 or I >= MESSAGE_TEXT.NUMBER_OF_LINES then 
  2006.             LINE_NUMBER := 1; 
  2007.             WRITE (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  2008.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  2009.             if NATURAL (MESSAGE_RECORD_NUMBER) >= (MESSAGE_NUMBER + 1) * 4 + 1 
  2010.                       then 
  2011.                raise RECORD_ERROR; 
  2012.             end if; 
  2013.          end if; 
  2014.       end loop; 
  2015.     --
  2016.       CLOSE (FILE_2); 
  2017.       PROMPT("Old message restored in data base");
  2018.   --
  2019.    exception 
  2020.      --
  2021.       when RECORD_ERROR => 
  2022.          CLOSE (FILE_2); 
  2023.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  2024.   --
  2025.    end PUT_OLD_MESSAGE_BACK_IN; 
  2026.   --
  2027.   --------------------------------------
  2028.    procedure DELETE_MESSAGE_FROM_DATABASE (DIRECTORY_POINTER  : in out 
  2029.              DIRECTORY_ENTRY; 
  2030.                                            MESSAGE_NUMBER     : in NATURAL) is 
  2031.   --------------------------------------
  2032.    --
  2033.       SCRATCH_MESSAGE  : MESSAGE; 
  2034.       ENTRY_NUMBER     : NATURAL; 
  2035.    --
  2036.    begin 
  2037.       --
  2038.       -- validate the message number to be deleted
  2039.       --
  2040.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES or 
  2041.                 MESSAGE_NUMBER = 0 then 
  2042.          PROMPT ("Illegal Message Delete Attempted"); 
  2043.          return; 
  2044.       --
  2045.       else 
  2046.          --
  2047.          PROMPT ("Deleting Message Entry"); 
  2048.          --
  2049.          OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  2050.          --
  2051.          -- last entry deletion does not require repacking
  2052.          --
  2053.          if MESSAGE_NUMBER /= DIRECTORY_POINTER.NUMBER_OF_MESSAGES then 
  2054.             --
  2055.             -- must re-pack the message file
  2056.             --
  2057.             for I in MESSAGE_NUMBER + 1..DIRECTORY_POINTER.NUMBER_OF_MESSAGES 
  2058.                       loop 
  2059.                ENTRY_NUMBER := NATURAL (I); 
  2060.                GET_MESSAGE_OUT (DIRECTORY_POINTER, ENTRY_NUMBER, 
  2061.                SCRATCH_MESSAGE); 
  2062.                ENTRY_NUMBER := ENTRY_NUMBER - 1; 
  2063.                PUT_OLD_MESSAGE_BACK_IN (DIRECTORY_POINTER, ENTRY_NUMBER, 
  2064.                SCRATCH_MESSAGE); 
  2065.             end loop; 
  2066.          end if; 
  2067.          --
  2068.          RECORD_NUMBER := 1; 
  2069.          while not END_OF_FILE (FILE_1) loop 
  2070.             READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  2071.             exit when DIRECTORY_RECORD.MESSAGE_TYPE = 
  2072.                       DIRECTORY_POINTER.MESSAGE_TYPE; 
  2073.             RECORD_NUMBER := RECORD_NUMBER + 1; 
  2074.          end loop; 
  2075.          --
  2076.          DIRECTORY_RECORD.NUMBER_OF_MESSAGES := 
  2077.                    DIRECTORY_RECORD.NUMBER_OF_MESSAGES - 1; 
  2078.          NATURAL_IO.PUT (TO => DIRECTORY_RECORD.NUMBER_STRING, 
  2079.          ITEM => DIRECTORY_RECORD.NUMBER_OF_MESSAGES); 
  2080.          WRITE (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  2081.          CLOSE (FILE_1); 
  2082.          --
  2083.       end if; 
  2084.    --
  2085.    end DELETE_MESSAGE_FROM_DATABASE; 
  2086. --
  2087. --
  2088. end FILE_ACCESS; 
  2089. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2090. --pp.sp
  2091. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2092. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2093. --                                                                    --
  2094. --            Program unit:  PACKAGE PRINT_PROCEDURES                 --
  2095. --            File name :    PP                                       --
  2096. --                                                                    --
  2097. --            ===========================================             --
  2098. --                                                                    --
  2099. --                                                                    --
  2100. --            Produced by Veda Incorporated                           --
  2101. --            Version  1.0      April 15, 1985                        --
  2102. --                                                                    --
  2103. --                                                                    --
  2104. --            This program unit is a member of the GMHF. It           --
  2105. --            was developed using TeleSoft's Ada compiler,            --
  2106. --            version 2.1 in a VAX/VMS environment, version           --
  2107. --            3.7                                                     --
  2108. --                                                                    --
  2109. --                                                                    --
  2110. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2111. --
  2112. with TYPE_LIST;               use TYPE_LIST; 
  2113. with FILE_ACCESS;             use FILE_ACCESS; 
  2114. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  2115.  
  2116. package PRINT_PROCEDURES is 
  2117. --
  2118. -- The print package provides the GMHF system routines with the
  2119. -- capability of supplying hardcopy out-puts of single messages,
  2120. -- groups of messages, and the message directory of the internal
  2121. -- message database.
  2122. --
  2123. --
  2124.    procedure PRINT_MESSAGE_DIRECTORY; 
  2125.    
  2126.    procedure PRINT_MESSAGE_TEXT (DIRECTORY_POINTER  : DIRECTORY_ENTRY; 
  2127.                                  MESSAGE_NUMBER     : in NATURAL); 
  2128.    
  2129.    procedure PRINT_MESSAGE_TEXT (WORKSPACE_MESSAGE  : in MESSAGE; 
  2130.                                  MESSAGE_TYPE       : in AVAILABLE_TYPES); 
  2131.    
  2132.    procedure PRINT_GROUP_OF_MESSAGES (DIRECTORY_POINTER : DIRECTORY_ENTRY; 
  2133.                               FIRST_MESSAGE, LAST_MESSAGE : in NATURAL);
  2134.                                            
  2135. --
  2136. end PRINT_PROCEDURES; 
  2137. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2138. --pp.txt
  2139. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2140. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2141. --                                                                    --
  2142. --            Program unit:  PACKAGE PRINT_PROCEDURES                 --
  2143. --            File name :    PP.TXT                                   --
  2144. --                                                                    --
  2145. --            ===========================================             --
  2146. --                                                                    --
  2147. --                                                                    --
  2148. --            Produced by Veda Incorporated                           --
  2149. --            Version  1.0      April 15, 1985                        --
  2150. --                                                                    --
  2151. --                                                                    --
  2152. --            This program unit is a member of the GMHF. It           --
  2153. --            was developed using TeleSoft's Ada compiler,            --
  2154. --            version 2.1 in a VAX/VMS environment, version           --
  2155. --            3.7                                                     --
  2156. --                                                                    --
  2157. --                                                                    --
  2158. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2159. --
  2160. with TEXT_IO;                    use TEXT_IO; 
  2161. with DIRECT_IO;                  
  2162. with CALENDAR;                   
  2163. with MAN_MACHINE_INTERFACE;      use MAN_MACHINE_INTERFACE; 
  2164. with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  2165. package body PRINT_PROCEDURES is 
  2166. --
  2167. -- The print package provides the GMHF system routines with the
  2168. -- capability of supplying hardcopy out-puts of single messages,
  2169. -- groups of messages, and the message directory of the internal
  2170. -- message database.
  2171. --
  2172. --
  2173.    ---------------------------------------------
  2174.    -- local variables and package instantiations
  2175.    ---------------------------------------------
  2176.    --
  2177.    FILE_2  : TEXT_IO.FILE_TYPE; 
  2178.    --
  2179.    package TYPE_IO is new TEXT_IO.ENUMERATION_IO (AVAILABLE_TYPES); 
  2180.    package CLASS_IO is new TEXT_IO.ENUMERATION_IO (CLASSIFICATION); 
  2181.    package NUMBER_IO is new INTEGER_IO (NATURAL); 
  2182.    package TIME_IO is new INTEGER_IO (INTEGER); 
  2183.    --
  2184.    MONTH  : INTEGER; 
  2185.    DAY    : INTEGER; 
  2186.    YEAR   : INTEGER; 
  2187.    --
  2188.    --
  2189. ---------------------------------
  2190. -- routines local to this package
  2191. ---------------------------------
  2192. --
  2193.    procedure GET_THE_DATE (MONTH, DAY, YEAR  : out INTEGER) is 
  2194.    --
  2195.       COMPUTE_TIME  : CALENDAR.TIME; 
  2196.    --
  2197.    begin 
  2198.     --
  2199.       COMPUTE_TIME := CALENDAR.CLOCK; 
  2200.       --
  2201.       MONTH := CALENDAR.MONTH (COMPUTE_TIME); 
  2202.       DAY := CALENDAR.DAY (COMPUTE_TIME); 
  2203.       YEAR := CALENDAR.YEAR (COMPUTE_TIME); 
  2204.     --
  2205.    end GET_THE_DATE; 
  2206. --
  2207.    procedure PRINT_MESSAGE_HEADER (CLASS             : in CLASSIFICATION; 
  2208.                                    MESSAGE_TYPE      : in AVAILABLE_TYPES; 
  2209.                                    MESSAGE_NUMBER    : NATURAL; 
  2210.                                    MONTH, DAY, YEAR  : in INTEGER) is 
  2211.    --
  2212.    begin 
  2213.    --
  2214.       PUT (FILE_2, ASCII.FF); 
  2215.    --
  2216.       PUT (FILE_2, ASCII.HT); 
  2217.       PUT (FILE_2, ASCII.HT); 
  2218.       PUT (FILE_2, ASCII.HT); 
  2219.       PUT (FILE_2, ASCII.HT); 
  2220.       CLASS_IO.PUT (FILE_2, CLASS); 
  2221.       PUT_LINE (FILE_2, " "); 
  2222.    --
  2223.       PUT (FILE_2, "Date Last Modified : "); 
  2224.       TIME_IO.PUT (FILE_2, MONTH, 2); 
  2225.       PUT (FILE_2, "/"); 
  2226.       TIME_IO.PUT (FILE_2, DAY, 2); 
  2227.       PUT (FILE_2, "/"); 
  2228.       TIME_IO.PUT (FILE_2, YEAR, 4); 
  2229.    --
  2230.       PUT (FILE_2, ASCII.HT); 
  2231.       PUT (FILE_2, ASCII.HT); 
  2232.       PUT (FILE_2, ASCII.HT); 
  2233.       PUT (FILE_2, "Message Number : "); 
  2234.       NUMBER_IO.PUT (FILE_2, MESSAGE_NUMBER); 
  2235.       PUT_LINE (FILE_2, " "); 
  2236.    --
  2237.       PUT (FILE_2, "Message Type : "); 
  2238.       TYPE_IO.PUT (FILE_2, MESSAGE_TYPE); 
  2239.    --
  2240.       PUT_LINE (FILE_2, " "); 
  2241.       PUT_LINE (FILE_2, " "); 
  2242.    --
  2243.    end PRINT_MESSAGE_HEADER; 
  2244. --
  2245.    procedure PRINT_MESSAGE_TRAILER (CLASS  : in CLASSIFICATION) is 
  2246.    --
  2247.    begin 
  2248.    --
  2249.       PUT_LINE (FILE_2, " "); 
  2250.       PUT_LINE (FILE_2, " "); 
  2251.       PUT (FILE_2, ASCII.HT); 
  2252.       PUT (FILE_2, ASCII.HT); 
  2253.       PUT (FILE_2, ASCII.HT); 
  2254.       PUT (FILE_2, ASCII.HT); 
  2255.       CLASS_IO.PUT (FILE_2, CLASS); 
  2256.       PUT_LINE (FILE_2, " "); 
  2257.    --
  2258.    end PRINT_MESSAGE_TRAILER; 
  2259.   --
  2260.   ------------------------------------
  2261.   --
  2262.   ------------------------------------
  2263.    procedure PRINT_MESSAGE_DIRECTORY is 
  2264.   ------------------------------------
  2265.   --
  2266.       DIRECTORY_RECORD  : DIRECTORY_STRUCTURE; 
  2267.   --
  2268.       package DIR_IO is new DIRECT_IO (DIRECTORY_STRUCTURE); 
  2269.       use DIR_IO; 
  2270.       FILE_1                   : DIR_IO.FILE_TYPE; 
  2271.       DIRECTORY_RECORD_NUMBER  : DIR_IO.POSITIVE_COUNT := 1; 
  2272.   --
  2273.       package INT_IO is new TEXT_IO.INTEGER_IO (INTEGER); 
  2274.   --
  2275.   --
  2276.    begin 
  2277.       --
  2278.       -- inform user of action being taken
  2279.       --
  2280.       PROMPT ("Printing the Message Directory"); 
  2281.       --
  2282.       -- open the directory file
  2283.       --
  2284.       OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  2285.       --
  2286.       -- open the print file
  2287.       --
  2288.       OPEN (FILE_2, OUT_FILE, "SYS$PRINT:", ""); 
  2289.       --
  2290.       -- print header
  2291.       --
  2292.       PUT (FILE_2, ASCII.FF); 
  2293.       PUT_LINE (FILE_2, " "); 
  2294.       PUT (FILE_2, ASCII.HT); 
  2295.       PUT (FILE_2, ASCII.HT); 
  2296.       PUT (FILE_2, ASCII.HT); 
  2297.       PUT (FILE_2, "GMHF DIRECTORY LISTING"); 
  2298.       PUT_LINE (FILE_2, " "); 
  2299.       PUT (FILE_2, ASCII.HT); 
  2300.       PUT (FILE_2, " Message Type"); 
  2301.       PUT (FILE_2, ASCII.HT); 
  2302.       PUT (FILE_2, ASCII.HT); 
  2303.       PUT (FILE_2, " File Name"); 
  2304.       PUT (FILE_2, ASCII.HT); 
  2305.       PUT (FILE_2, ASCII.HT); 
  2306.       PUT (FILE_2, " No. Messages"); 
  2307.       PUT_LINE (FILE_2, " "); 
  2308.       PUT_LINE (FILE_2, " "); 
  2309.       --
  2310.       -- loop till end of file
  2311.       --
  2312.       while not END_OF_FILE (FILE_1) loop 
  2313.          READ (FILE_1, DIRECTORY_RECORD, DIRECTORY_RECORD_NUMBER); 
  2314.          --
  2315.          PUT (FILE_2, ASCII.HT); 
  2316.          TYPE_IO.PUT (FILE_2, DIRECTORY_RECORD.MESSAGE_TYPE); 
  2317.          PUT (FILE_2, ASCII.HT); 
  2318.          PUT (FILE_2, ASCII.HT); 
  2319.          PUT (FILE_2, ASCII.HT); 
  2320.          PUT (FILE_2, DIRECTORY_RECORD.MESSAGE_FILENAME); 
  2321.          PUT (FILE_2, ASCII.HT); 
  2322.          PUT (FILE_2, ASCII.HT); 
  2323.          INT_IO.PUT (FILE_2, DIRECTORY_RECORD.NUMBER_OF_MESSAGES); 
  2324.          PUT_LINE (FILE_2, " "); 
  2325.          --
  2326.          DIRECTORY_RECORD_NUMBER := DIRECTORY_RECORD_NUMBER + 1; 
  2327.       end loop; 
  2328.       --
  2329.       -- close the files
  2330.       CLOSE (FILE_1); 
  2331.       CLOSE (FILE_2); 
  2332.       --
  2333.    end PRINT_MESSAGE_DIRECTORY; 
  2334. --
  2335.   -----------------------------
  2336.    procedure PRINT_MESSAGE_TEXT (DIRECTORY_POINTER  : DIRECTORY_ENTRY; 
  2337.                                  MESSAGE_NUMBER     : in NATURAL) is 
  2338.   -----------------------------
  2339.   --
  2340.       LINE_NUMBER  : INTEGER := 1; 
  2341.   --
  2342.   -- internal message structure
  2343.   --
  2344.       type MESSAGE_FORMAT  is array (1..25) of STRING (1..80); 
  2345.       type MESSAGE_RECORD  is record 
  2346.          CLASS             : CLASSIFICATION; 
  2347.          NUMBER_OF_LINES   : POSITIVE; 
  2348.          MONTH, DAY, YEAR  : INTEGER; 
  2349.          CONTENT           : MESSAGE_FORMAT; 
  2350.       end record; 
  2351.   --
  2352.       package MESSAGE_IO is new DIRECT_IO (MESSAGE_RECORD); 
  2353.       use MESSAGE_IO; 
  2354.       FILE_3         : MESSAGE_IO.FILE_TYPE; 
  2355.       RECORD_NUMBER  : MESSAGE_IO.POSITIVE_COUNT; 
  2356.   --
  2357.       MESSAGE_DATA   : MESSAGE_RECORD; 
  2358.   --
  2359.   --
  2360.    begin 
  2361.       --
  2362.       -- inform the operator of the action being taken
  2363.       --
  2364.       if MESSAGE_NUMBER > 0 then 
  2365.          PROMPT ("Printing Message Text"); 
  2366.       else 
  2367.          PROMPT ("Printing the Prototype Message Text"); 
  2368.       end if; 
  2369.       --
  2370.       -- open the message file
  2371.       --
  2372.       OPEN (FILE_3, INOUT_FILE, 
  2373.       DIRECTORY_POINTER.MESSAGE_FILENAME & ".MSG", ""); 
  2374.       --
  2375.       -- open the print file
  2376.       --
  2377.       OPEN (FILE_2, OUT_FILE, "SYS$PRINT:", ""); 
  2378.       -- 
  2379.       -- read the first message record, read more records as needed
  2380.       --
  2381.       RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT (MESSAGE_NUMBER * 3 + 1); 
  2382.       --
  2383.       READ (FILE_3, MESSAGE_DATA, RECORD_NUMBER); 
  2384.       --
  2385.       -- print the message header and classification
  2386.       --
  2387.       PRINT_MESSAGE_HEADER (MESSAGE_DATA.CLASS, 
  2388.       DIRECTORY_POINTER.MESSAGE_TYPE, 
  2389.       MESSAGE_NUMBER, 
  2390.       MESSAGE_DATA.MONTH, 
  2391.       MESSAGE_DATA.DAY, 
  2392.       MESSAGE_DATA.YEAR); 
  2393.       --
  2394.       for I in 1..MESSAGE_DATA.NUMBER_OF_LINES loop 
  2395.         --
  2396.          if LINE_NUMBER > 25 then 
  2397.             LINE_NUMBER := 1; 
  2398.             RECORD_NUMBER := RECORD_NUMBER + 1; 
  2399.             READ (FILE_3, MESSAGE_DATA, RECORD_NUMBER); 
  2400.          end if; 
  2401.          --
  2402.          PUT (FILE_2, MESSAGE_DATA.CONTENT (LINE_NUMBER)); 
  2403.          PUT_LINE (FILE_2, " "); 
  2404.          LINE_NUMBER := LINE_NUMBER + 1;
  2405.          --
  2406.          -- check to see if a page is full, if so need trailer & header
  2407.          -- 
  2408.          if I = 50 then 
  2409.             PRINT_MESSAGE_TRAILER (MESSAGE_DATA.CLASS); 
  2410.             PRINT_MESSAGE_HEADER (MESSAGE_DATA.CLASS, 
  2411.             DIRECTORY_POINTER.MESSAGE_TYPE, 
  2412.             MESSAGE_NUMBER, 
  2413.             MONTH, DAY, YEAR); 
  2414.          end if; 
  2415.         --
  2416.       end loop; 
  2417.       --
  2418.       --  trailing classification
  2419.       --
  2420.       PRINT_MESSAGE_TRAILER (MESSAGE_DATA.CLASS); 
  2421.       --
  2422.       -- close the files
  2423.       --
  2424.       CLOSE (FILE_2); 
  2425.       CLOSE (FILE_3); 
  2426.     --
  2427.    end PRINT_MESSAGE_TEXT; 
  2428. --
  2429.   -------------------------------
  2430.    procedure PRINT_MESSAGE_TEXT (WORKSPACE_MESSAGE  : in MESSAGE; 
  2431.                                  MESSAGE_TYPE       : in AVAILABLE_TYPES) is 
  2432.   -------------------------------
  2433.   --
  2434.       CURRENT_LINE  : NODE; 
  2435.   --
  2436.    begin 
  2437.   --
  2438.       CURRENT_LINE := WORKSPACE_MESSAGE.HEAD; 
  2439.       --
  2440.       PROMPT ("Printing the workspace Message Text"); 
  2441.       --
  2442.       -- open the print file
  2443.       --
  2444.       OPEN (FILE_2, OUT_FILE, "SYS$PRINT:", ""); 
  2445.       --
  2446.       -- get the current date
  2447.       --
  2448.       GET_THE_DATE (MONTH, DAY, YEAR); 
  2449.       --
  2450.       -- print the message header and classification
  2451.       --
  2452.       PRINT_MESSAGE_HEADER (WORKSPACE_MESSAGE.CLASS, 
  2453.       MESSAGE_TYPE, 0, MONTH, DAY, YEAR); 
  2454.       --
  2455.       for I in 1..WORKSPACE_MESSAGE.NUMBER_OF_LINES loop 
  2456.         --
  2457.          PUT (FILE_2, CURRENT_LINE.TEXT_LINE); 
  2458.          PUT_LINE (FILE_2, " "); 
  2459.          CURRENT_LINE := CURRENT_LINE.NEXT_LINE; 
  2460.          --
  2461.          -- check to see if a page is full, if so need trailer & header
  2462.          -- 
  2463.          if I = 50 then 
  2464.             PRINT_MESSAGE_TRAILER (WORKSPACE_MESSAGE.CLASS); 
  2465.             PRINT_MESSAGE_HEADER (WORKSPACE_MESSAGE.CLASS, 
  2466.             MESSAGE_TYPE, 0, MONTH, DAY, YEAR); 
  2467.          end if; 
  2468.         --
  2469.       end loop; 
  2470.       --
  2471.       --  trailing classification
  2472.       --
  2473.       PRINT_MESSAGE_TRAILER (WORKSPACE_MESSAGE.CLASS); 
  2474.       --
  2475.       -- close the file
  2476.       --
  2477.       CLOSE (FILE_2); 
  2478.       --
  2479.    end PRINT_MESSAGE_TEXT; 
  2480. --
  2481.   ---------------------------------- 
  2482.    procedure PRINT_GROUP_OF_MESSAGES (DIRECTORY_POINTER            : DIRECTORY_ENTRY; 
  2483.                          FIRST_MESSAGE, LAST_MESSAGE  : in NATURAL) is 
  2484.   ----------------------------------
  2485.   --
  2486.       START_OF_LOOP  : NATURAL; 
  2487.       END_OF_LOOP    : NATURAL; 
  2488.   --
  2489.    begin 
  2490.       --
  2491.       -- validate the message numbers
  2492.       --
  2493.       START_OF_LOOP := FIRST_MESSAGE; 
  2494.       END_OF_LOOP := LAST_MESSAGE; 
  2495.       --
  2496.       if LAST_MESSAGE < FIRST_MESSAGE then 
  2497.          START_OF_LOOP := LAST_MESSAGE; 
  2498.          END_OF_LOOP := FIRST_MESSAGE; 
  2499.       end if; 
  2500.       --
  2501.       if END_OF_LOOP > DIRECTORY_POINTER.NUMBER_OF_MESSAGES then 
  2502.          END_OF_LOOP := DIRECTORY_POINTER.NUMBER_OF_MESSAGES; 
  2503.       end if; 
  2504.       --
  2505.       for I in START_OF_LOOP..END_OF_LOOP loop 
  2506.          PRINT_MESSAGE_TEXT (DIRECTORY_POINTER, I); 
  2507.       end loop; 
  2508.       --
  2509.    end PRINT_GROUP_OF_MESSAGES; 
  2510. --
  2511. end PRINT_PROCEDURES; 
  2512. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2513. --edittypes.sp
  2514. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2515. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2516. --                                                                    --
  2517. --            Program unit:  PACKAGE EDITOR_TYPES                     --
  2518. --            File name :    EDITTYPES.SP                             --
  2519. --                                                                    --
  2520. --            ===========================================             --
  2521. --                                                                    --
  2522. --                                                                    --
  2523. --            Produced by Veda Incorporated                           --
  2524. --            Version  1.0      April 15, 1985                        --
  2525. --                                                                    --
  2526. --                                                                    --
  2527. --            This program unit is a member of the GMHF. It           --
  2528. --            was developed using TeleSoft's Ada compiler,            --
  2529. --            version 2.1 in a VAX/VMS environment, version           --
  2530. --            3.7                                                     --
  2531. --                                                                    --
  2532. --                                                                    --
  2533. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2534. --
  2535. with DIRECT_IO;               
  2536. with TEXT_IO;                 use TEXT_IO; 
  2537. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  2538. with TERMINAL_DEFINITION;     use TERMINAL_DEFINITION; 
  2539.  
  2540. package EDITOR_TYPES is 
  2541.    package INT_IO is new INTEGER_IO (INTEGER); 
  2542.    
  2543.    -- here we define the structures used to define the manner in which
  2544.    -- lines are composed of fields
  2545.       --
  2546.       -- the type line_component defines how a field is used within 
  2547.       -- a line. Each line will be an array of line_component. The user
  2548.       -- specifies each field which is in the line, its position and
  2549.       -- length, and whether it is required.
  2550.       --
  2551.    type LINE_COMPONENT         is record 
  2552.       FIELD             : INTEGER; 
  2553.       FIELD_POSITION    : INTEGER; 
  2554.       FIELD_LENGTH      : INTEGER; 
  2555.       REQUIRED          : BOOLEAN; 
  2556.    end record; 
  2557.    
  2558.       --
  2559.       -- we define a line as an array of line components. this allows
  2560.       -- the structure of each type of line to be specified in terms of
  2561.       -- basic building blocks - line_component's. A line structure
  2562.       -- specification consists of the number of fields, a prototype
  2563.       -- version of the line, and an array of the line_component's which
  2564.       -- define its fields. the prototype line contains all
  2565.       -- non-changeable characters in their normal positions, with all
  2566.       -- user changeable characters left as blanks. It is in some sense
  2567.       -- a 'blank line' ready to be filled in. 
  2568.       --
  2569.                  -- THE 34 IS A KLUDGE vv this should be max flds/line
  2570.    type COMPONENT_ARRAY        is array (1..34) of LINE_COMPONENT; 
  2571.       --
  2572.    type LINE_DEFINITION        is record 
  2573.       NUMBER_OF_FIELDS  : INTEGER; 
  2574.       PROTOTYPE_LINE    : LINE_OF_TEXT; 
  2575.       COMPONENT         : COMPONENT_ARRAY; 
  2576.    end record; 
  2577.    
  2578.    type LINE_DEFINITION_ARRAY  is array (0..34) of LINE_DEFINITION; 
  2579.    
  2580.    package LINE_DEFINITION_IO is new DIRECT_IO (LINE_DEFINITION); 
  2581.       --
  2582.       -- The structures of the lines being implemented are stored in a 
  2583.       -- file passed as a formal parameter. Below we define the entities
  2584.       -- required to open and read that file.
  2585.       --
  2586.    LINE_STRUCTURE_FILE  : LINE_DEFINITION_IO.FILE_TYPE; 
  2587.    LINE_TYPE_COUNTER    : LINE_DEFINITION_IO.POSITIVE_COUNT; 
  2588.    
  2589.       --
  2590.       -- now we define those data types and file structures required to
  2591.       -- hold and access field prompts and amplifications. This works as
  2592.       -- follows:
  2593.       --   each type of field has a 'field prompt' which appears under
  2594.       --   it in the work area. Some fields have amplifying information
  2595.       --   which appears in the amp area. These data are held in a
  2596.       --   direct access file supplied by the implementor. In addition,
  2597.       --   since lines contain the fields in varying order, there is an
  2598.       --   accompanying 'lookup array' which holds the prompt numbers
  2599.       --   for each field of a line. Thus to display a prompt, you tell
  2600.       --   display_prompt what line type is being edited, which field,
  2601.       --   and so on, and it retrieves the appropriate field prompt and
  2602.       --   amp and displays them.
  2603.       --
  2604.    subtype PROMPT_DISPLAY_LINE  is STRING (1..NMBR_OF_COLS); 
  2605.    
  2606.    MAXIMUM_AMP_LINES  : INTEGER := BOT_OF_AMP_AREA - TOP_OF_AMP_AREA + 1; 
  2607.    
  2608.    type AMP_LINE_DATA    is record 
  2609.       AMP_POSITION            : CRT_POSITION; 
  2610.       AMP_LINE                : PROMPT_DISPLAY_LINE; 
  2611.    end record; 
  2612.    
  2613.    type AMP_INFORMATION  is array (1..MAXIMUM_AMP_LINES) of AMP_LINE_DATA; 
  2614.    
  2615.    type PROMPT_DATA      is record 
  2616.       LENGTH_OF_FIELD_PROMPT  : INTEGER; 
  2617.       FIELD_PROMPT            : PROMPT_DISPLAY_LINE; 
  2618.       NUMBER_OF_AMP_LINES     : INTEGER range 0..MAXIMUM_AMP_LINES; 
  2619.       THIS_AMP                : AMP_INFORMATION; 
  2620.    end record; 
  2621.    
  2622.    package FIELD_PROMPT_IO is new DIRECT_IO (PROMPT_DATA); 
  2623.    FIELD_PROMPT_FILE  : FIELD_PROMPT_IO.FILE_TYPE; 
  2624.    
  2625. -- 34 is a major kludge
  2626.    type FIELD_PROMPT_VECTOR  is array (1..34) of NATURAL; 
  2627.    
  2628.    CURRENT_PROMPTS  : FIELD_PROMPT_VECTOR; 
  2629.    CURRENT_LINE     : INTEGER; 
  2630.    
  2631.    package PROMPT_VECTOR_IO is new DIRECT_IO (FIELD_PROMPT_VECTOR); 
  2632.    PROMPT_VECTOR_FILE  : PROMPT_VECTOR_IO.FILE_TYPE; 
  2633.    PROMPT_COUNT        : PROMPT_VECTOR_IO.POSITIVE_COUNT; 
  2634.    
  2635.    package FIELD_PROMPT is 
  2636.    
  2637.       procedure DISPLAY_PROMPT (LINE_NUMBER     : in NATURAL; 
  2638.                                 FIELD_NUMBER    : in POSITIVE; 
  2639.                                 FIELD_POSITION  : in POSITIVE; 
  2640.                                 FIELD_LENGTH    : in POSITIVE; 
  2641.                                 ANY_AMP         : out BOOLEAN); 
  2642.       
  2643.       procedure DISPLAY_PROMPT (SPECIAL_PROMPT_NUMBER  : in POSITIVE); 
  2644.       
  2645.       
  2646.    end FIELD_PROMPT; 
  2647.    --
  2648.    -- These provide the default procedures for generic instantiation.
  2649.    --
  2650.    procedure NULL_PROCEDURE (LINE_TO_PACK  : in out LINE_OF_TEXT; 
  2651.                              LINE_FORMAT   : in LINE_DEFINITION); 
  2652.    
  2653.    procedure NULL_PROCEDURE; 
  2654.    
  2655.    
  2656. end EDITOR_TYPES; 
  2657. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2658. --edittypes.txt
  2659. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2660. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2661. --                                                                    --
  2662. --            Program unit:  PACKAGE EDITOR_TYPES                     --
  2663. --            File name :    EDITTYPES.TXT                            --
  2664. --                                                                    --
  2665. --            ===========================================             --
  2666. --                                                                    --
  2667. --                                                                    --
  2668. --            Produced by Veda Incorporated                           --
  2669. --            Version  1.0      April 15, 1985                        --
  2670. --                                                                    --
  2671. --                                                                    --
  2672. --            This program unit is a member of the GMHF. It           --
  2673. --            was developed using TeleSoft's Ada compiler,            --
  2674. --            version 2.1 in a VAX/VMS environment, version           --
  2675. --            3.7                                                     --
  2676. --                                                                    --
  2677. --                                                                    --
  2678. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2679. --
  2680. with TEXT_IO;  use TEXT_IO; 
  2681. package body EDITOR_TYPES is 
  2682.  
  2683.  
  2684.    package body FIELD_PROMPT is 
  2685.    
  2686.       FIRST_TIME_DISPLAYED  : BOOLEAN := FALSE; 
  2687.       
  2688.       procedure RETRIEVE_PROMPT (LINE_NUMBER   : in INTEGER; 
  2689.                                  FIELD_NUMBER  : in INTEGER; 
  2690.                                  PROMPT        : out PROMPT_DATA) is 
  2691.       
  2692.          RECORD_NUMBER  : NATURAL; 
  2693.          ITEM_COUNT     : FIELD_PROMPT_IO.POSITIVE_COUNT; 
  2694.       begin 
  2695.          --
  2696.          -- If the look-up array has not yet been updated for this line
  2697.          -- then read it.
  2698.          --
  2699.          if CURRENT_LINE /= LINE_NUMBER or FIRST_TIME_DISPLAYED = FALSE then 
  2700.             PROMPT_COUNT := PROMPT_VECTOR_IO.POSITIVE_COUNT (LINE_NUMBER + 1); 
  2701.             PROMPT_VECTOR_IO.READ (PROMPT_VECTOR_FILE, CURRENT_PROMPTS, 
  2702.             PROMPT_COUNT); 
  2703.             FIRST_TIME_DISPLAYED := TRUE; 
  2704.          end if; 
  2705.          --
  2706.          -- Use the look-up array to determine which prompt to display
  2707.          --
  2708.          RECORD_NUMBER := CURRENT_PROMPTS (FIELD_NUMBER); 
  2709.          --
  2710.          -- here we do a direct access read on the prompt file -
  2711.          --          field prompt and amplification
  2712.          -- 
  2713.          ITEM_COUNT := FIELD_PROMPT_IO.POSITIVE_COUNT (RECORD_NUMBER); 
  2714.          FIELD_PROMPT_IO.READ (FIELD_PROMPT_FILE, PROMPT, ITEM_COUNT); 
  2715.          --
  2716.       end RETRIEVE_PROMPT; 
  2717.       
  2718.       procedure DISPLAY_PROMPT (LINE_NUMBER     : in NATURAL; 
  2719.                                 FIELD_NUMBER    : in POSITIVE; 
  2720.                                 FIELD_POSITION  : in POSITIVE; 
  2721.                                 FIELD_LENGTH    : in POSITIVE; 
  2722.                                 ANY_AMP         : out BOOLEAN) is 
  2723.       
  2724.          PROMPT     : PROMPT_DATA; 
  2725.          OFFSET     : INTEGER; 
  2726.          DASH_LINE  : LINE_OF_TEXT := (1..80 => '-'); 
  2727.       begin 
  2728.          --
  2729.          -- first retrieve the two pieces of the prompt - the field 
  2730.          -- prompt and the amplification
  2731.          --
  2732.          RETRIEVE_PROMPT (LINE_NUMBER, FIELD_NUMBER, PROMPT); 
  2733.          if PROMPT.NUMBER_OF_AMP_LINES = 0 then 
  2734.             ANY_AMP := FALSE; 
  2735.          else 
  2736.             ANY_AMP := TRUE; 
  2737.          end if; 
  2738.          CURRENT_LINE := LINE_NUMBER; 
  2739.          --
  2740.          -- now position the cursor and underline the field
  2741.          --
  2742.          GOTO_CRT_POSITION (BOT_OF_WORK_AREA - 1, FIELD_POSITION); 
  2743.          PUT (DASH_LINE (1..FIELD_LENGTH)); 
  2744.          --
  2745.          -- first figure out the offset for the field prompt,
  2746.          -- then position the cursor and write the field prompt
  2747.          --
  2748.          OFFSET_BLOCK : 
  2749.          --
  2750.          -- The point of this block is to determine where to start
  2751.          -- writing the propmt in order that it be as centered as
  2752.          -- possible under the field
  2753.          --
  2754.          declare 
  2755.             LENGTH_DELTA, HALF_DELTA, EXCESS, UNDERAGE  : INTEGER; 
  2756.          begin 
  2757.             LENGTH_DELTA := FIELD_LENGTH - PROMPT.LENGTH_OF_FIELD_PROMPT; 
  2758.             
  2759.             HALF_DELTA := LENGTH_DELTA / 2; 
  2760.             if LENGTH_DELTA >= 0 then  -- here prompt shorter than field
  2761.                OFFSET := HALF_DELTA; 
  2762.             else                       -- here field shorter than prompt
  2763.                EXCESS := FIELD_POSITION + FIELD_LENGTH + abs (HALF_DELTA) + 1 
  2764.                          - NMBR_OF_COLS; 
  2765.                UNDERAGE := FIELD_POSITION - abs (HALF_DELTA) - 1; 
  2766.                GOTO_CRT_POSITION (22, 1); 
  2767.                if EXCESS <= 0 and UNDERAGE >= 0 then 
  2768.                   OFFSET := HALF_DELTA; 
  2769.                elsif EXCESS > 0 then 
  2770.                   OFFSET := HALF_DELTA - EXCESS; 
  2771.                else 
  2772.                   OFFSET := HALF_DELTA + abs (UNDERAGE); 
  2773.                end if; 
  2774.             end if; 
  2775.          end OFFSET_BLOCK; 
  2776.          
  2777.          GOTO_CRT_POSITION (BOT_OF_WORK_AREA, FIELD_POSITION + OFFSET); 
  2778.          PUT (PROMPT.FIELD_PROMPT); 
  2779.          --
  2780.          -- now write the amplification -if any; number of lines is often 0
  2781.          --
  2782.          for I in 1..PROMPT.NUMBER_OF_AMP_LINES loop 
  2783.             GOTO_CRT_POSITION (PROMPT.THIS_AMP (I).AMP_POSITION); 
  2784.             PUT (PROMPT.THIS_AMP (I).AMP_LINE); 
  2785.          end loop; 
  2786.          
  2787.       end DISPLAY_PROMPT; 
  2788.       
  2789.       procedure RETRIEVE_PROMPT (SPECIAL_PROMPT_NUMBER  : in POSITIVE; 
  2790.                                  PROMPT                 : out PROMPT_DATA) is 
  2791.       
  2792.          RECORD_NUMBER  : NATURAL; 
  2793.          ITEM_COUNT     : FIELD_PROMPT_IO.POSITIVE_COUNT; 
  2794.       begin 
  2795.          --
  2796.          -- If the look-up array has not yet been updated for this line
  2797.          -- then read it.
  2798.          --
  2799.          if CURRENT_LINE /= 0 or FIRST_TIME_DISPLAYED = FALSE then 
  2800.             PROMPT_COUNT := PROMPT_VECTOR_IO.POSITIVE_COUNT (1); 
  2801.             PROMPT_VECTOR_IO.READ (PROMPT_VECTOR_FILE, CURRENT_PROMPTS, 
  2802.             PROMPT_COUNT); 
  2803.             FIRST_TIME_DISPLAYED := TRUE; 
  2804.          end if; 
  2805.          RECORD_NUMBER := CURRENT_PROMPTS (SPECIAL_PROMPT_NUMBER); 
  2806.          
  2807.          --
  2808.          -- here we do a direct access read on the prompt file- amp only
  2809.          -- 
  2810.          ITEM_COUNT := FIELD_PROMPT_IO.POSITIVE_COUNT (RECORD_NUMBER); 
  2811.          FIELD_PROMPT_IO.READ (FIELD_PROMPT_FILE, PROMPT, ITEM_COUNT); 
  2812.          
  2813.       end RETRIEVE_PROMPT; 
  2814.       
  2815.       procedure DISPLAY_PROMPT (SPECIAL_PROMPT_NUMBER  : in POSITIVE) is 
  2816.       
  2817.          PROMPT  : PROMPT_DATA; 
  2818.          
  2819.       begin 
  2820.          --
  2821.          -- first retrieve the prompt 
  2822.          --
  2823.          RETRIEVE_PROMPT (SPECIAL_PROMPT_NUMBER, PROMPT); 
  2824.          CURRENT_LINE := 0; 
  2825.          --
  2826.          -- now write the amplification 
  2827.          --
  2828.          for I in 1..PROMPT.NUMBER_OF_AMP_LINES loop 
  2829.             GOTO_CRT_POSITION (PROMPT.THIS_AMP (I).AMP_POSITION); 
  2830.             PUT (PROMPT.THIS_AMP (I).AMP_LINE); 
  2831.          end loop; 
  2832.          
  2833.       end DISPLAY_PROMPT; 
  2834.       
  2835.    end FIELD_PROMPT; 
  2836.    
  2837.    procedure NULL_PROCEDURE (LINE_TO_PACK  : in out LINE_OF_TEXT; 
  2838.                              LINE_FORMAT   : in LINE_DEFINITION) is 
  2839.    begin 
  2840.       null; 
  2841.    end NULL_PROCEDURE; 
  2842.    
  2843.    procedure NULL_PROCEDURE is 
  2844.    begin 
  2845.       null; 
  2846.    end NULL_PROCEDURE; 
  2847.    
  2848. end EDITOR_TYPES; 
  2849. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2850. --genfile.txt
  2851. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2852. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2853. --                                                                    --
  2854. --            Program unit:  PACKAGE FILE_GENERIC                     --
  2855. --            File name :    GENFILE.TXT                              --
  2856. --                                                                    --
  2857. --            ===========================================             --
  2858. --                                                                    --
  2859. --                                                                    --
  2860. --            Produced by Veda Incorporated                           --
  2861. --            Version  1.0      April 15, 1985                        --
  2862. --                                                                    --
  2863. --                                                                    --
  2864. --            This program unit is a member of the GMHF. It           --
  2865. --            was developed using TeleSoft's Ada compiler,            --
  2866. --            version 2.1 in a VAX/VMS environment, version           --
  2867. --            3.7                                                     --
  2868. --                                                                    --
  2869. --                                                                    --
  2870. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  2871. --
  2872. with EDITOR_TYPES;            use EDITOR_TYPES; 
  2873. with MAN_MACHINE_INTERFACE;   use MAN_MACHINE_INTERFACE; 
  2874. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  2875.  
  2876. package FILE_GENERIC is 
  2877.  
  2878. -- this generic definition reads the line structure from a file
  2879. -- which is passed as a generic parameter
  2880.  
  2881.    generic 
  2882.    
  2883.    --
  2884.    -- the first three parameters allow the implementor to specify 
  2885.    -- limits on message line characteristics.
  2886.    --
  2887.       MAXIMUM_FIELDS_PER_LINE, MAXIMUM_CHARACTERS_PER_LINE, 
  2888.       MAXIMUM_LINES_PER_MESSAGE  : POSITIVE; 
  2889.    --
  2890.    -- the implementor must specify the legal line and field names,
  2891.    -- as well as the name of the files which contain the line
  2892.    -- structure definitions and the field prompts.
  2893.    --
  2894.       type LINE_NAME is (<>                                                     
  2895.                 ); 
  2896.    --
  2897.       with procedure GET_LINE_NAME (LINE_TYPE  : out LINE_NAME) is <>; 
  2898.    --
  2899.       type FIELD_NAME is (<>                                                    
  2900.                 );          -- and the legal field names.
  2901.    --
  2902.       LINE_STRUCTURE_FILE_NAME  : STRING; 
  2903.    --
  2904.       PROMPT_VECTOR_FILE_NAME   : STRING; 
  2905.                                      --holds lookup table for field pmts
  2906.    --
  2907.       FIELD_PROMPT_FILE_NAME    : STRING; -- holds field prompts themselves
  2908.    --
  2909.    -- get_field is provided by the implementor for each instantiation.
  2910.    -- in some cases, the same get_field could be used for different
  2911.    -- message types. this would be possible if the message types
  2912.    -- differed only at the line level, and not at the field level.
  2913.    -- an example is the different colors of Rainform messages. the
  2914.    -- different colors require different combinations of lines, but
  2915.    -- use the same field structures.
  2916.    --
  2917.       with procedure GET_FIELD (FIELD_TYPE      : in FIELD_NAME; 
  2918.                                 FIELD_GOTTEN    : in out STRING; 
  2919.                                 FIELD_POSITION  : in POSITIVE; 
  2920.                                 FIELD_LENGTH    : in POSITIVE; 
  2921.                                 COMMAND_GOTTEN  : in out COMMAND; 
  2922.                                 COMMAND_FLAG    : in out BOOLEAN) is <>; 
  2923.    --
  2924.    -- some line formats require extraneous blanks to be removed from
  2925.    -- fields, while other line formats make no such requirements. To
  2926.    -- handle either case, we define procedures pack_line & unpack_line.
  2927.    -- the defaults for these procedures are null routines, but the
  2928.    -- implementor may substitute a non-null procedure as a formal
  2929.    -- parameter, as we have done in the Rainform instance. pack_line
  2930.    -- removes extraneous blanks, while unpack_line expands a packed line
  2931.    -- as specified by the line format requirements.
  2932.    --
  2933.       with procedure PACK_LINE (LINE_TO_PACK  : in out LINE_OF_TEXT; 
  2934.                                 LINE_FORMAT   : in LINE_DEFINITION) is 
  2935.                 NULL_PROCEDURE; 
  2936.       with procedure UNPACK_LINE (LINE_TO_UNPACK  : in out LINE_OF_TEXT; 
  2937.                                   LINE_FORMAT     : in LINE_DEFINITION) is 
  2938.                 NULL_PROCEDURE; 
  2939.    --
  2940.    --
  2941.    -- validate_line_insertion allows the user to specify any conditions
  2942.    -- to be placed upon the insertion of lines into messages.
  2943.    -- For example, it may be that a line of some particular type must be
  2944.    -- preceded by a line of some other type; in such a case, this
  2945.    -- routine would ensure that the requirement was met, or if not met,
  2946.    -- it would perform the user specified action.
  2947.    --
  2948.       with procedure VALIDATE_LINE_INSERTION is NULL_PROCEDURE; 
  2949.    --
  2950.    -- parse_line_type is required to parse the message lines, determine
  2951.    -- the line type of each line of the message, and place that line
  2952.    -- type in the appropriate field of the message component for that
  2953.    -- line.
  2954.    --
  2955.       with procedure PARSE_LINE_TYPE (POINTER_TO_LINE  : NODE; 
  2956.                                       LINE_TYPE_FOUND  : out LINE_NAME); 
  2957.       
  2958.       
  2959.       package FILED_GENERIC_MESSAGE_EDITOR is 
  2960.       
  2961.    --
  2962.    -- variables defined here are used in the main edit procedure below.
  2963.    --
  2964.          LENGTH_OF_FIELD      : INTEGER;       -- length of the current field
  2965.          START_OF_FIELD       : INTEGER; 
  2966.                                -- starting position of the current field
  2967.          END_OF_FIELD         : INTEGER; -- ending position of the current field
  2968.          BLANK_LINE           : LINE_OF_TEXT := (1..80 => ' ');   -- for blank filling
  2969.          LINE_FORMAT          : LINE_DEFINITION; 
  2970.                                    -- to hold format of the current line
  2971.          CHAR                 : STRING (1..1); 
  2972.          USER_INPUT           : COMMAND; 
  2973.          TEMP_LINE_TYPE       : LINE_NAME; 
  2974.                                -- the next three temporarys are to allow
  2975.          TEMP_FIELD_TYPE      : FIELD_NAME; 
  2976.                                  -- us to keep references to line( ).xxx
  2977.          TEMP_INTEGER         : INTEGER;   -- on one line.
  2978.          LINE_STRUCTURE_FILE  : LINE_DEFINITION_IO.FILE_TYPE; 
  2979.          LINE_TYPE_COUNTER    : LINE_DEFINITION_IO.POSITIVE_COUNT; 
  2980.          TEMP_AMP             : BOOLEAN; 
  2981.    --
  2982.          
  2983.    -- working_data is a record definition which defines those data
  2984.    -- required to change the contents of a message during its editing
  2985.    -- process. This includes the message being edited,
  2986.    -- a pointer to and the relative line number in
  2987.    -- the message of: the top line currently displayed, the bottom
  2988.    -- line currently displayed, and the current line being edited; a
  2989.    -- flag which tracks whether the use of the current line is valid,
  2990.    -- the number of the field being edited; we keep track of whether
  2991.    -- the editor is in scroll mode (vs edit mode) and  whether any
  2992.    -- changes have yet been made to the message being edited. Finally
  2993.    -- a 'buffer' for the next command to be executed is provided.
  2994.    --
  2995.    -- the type line_information is defined to hold the pointers and
  2996.    -- relative line numbers mentioned above.
  2997.    --
  2998.          type LINE_INFORMATION  is record 
  2999.             LINE_NUMBER          : INTEGER range 1..MAXIMUM_LINES_PER_MESSAGE; 
  3000.             LINE_POINTER         : NODE; 
  3001.          end record; 
  3002.    --
  3003.    -- the discrete type edit_mode is used to track whether the user
  3004.    -- is in scroll mode or edit mode.
  3005.    --
  3006.          type EDIT_MODE is (SCROLL, EDIT                                           
  3007.                    ); 
  3008.    --
  3009.          type WORKING_DATA      is record 
  3010.             CURRENT_MESSAGE      : MESSAGE;       -- the message being edited
  3011.             WORK_LINE            : LINE_INFORMATION; 
  3012.                                      -- number & ptr to the current line
  3013.             TOP_LINE             : LINE_INFORMATION; -- number & ptr to the top line
  3014.             BOTTOM_LINE          : LINE_INFORMATION; 
  3015.                                       -- number & ptr to the bottom line
  3016.             VALIDATED_LINE_FLAG  : BOOLEAN;         -- is this line valid
  3017.             CURRENT_FIELD        : INTEGER range 1..MAXIMUM_FIELDS_PER_LINE; 
  3018.                                          -- field currently being edited
  3019.             ANY_AMP              : BOOLEAN; 
  3020.                          -- is there an amp for the current field prompt
  3021.             MODE                 : EDIT_MODE;                -- edit mode or scroll mode
  3022.             CHANGES_MADE_FLAG    : BOOLEAN; 
  3023.                                      -- made any changes to this message
  3024.             NEXT_COMMAND         : COMMAND;      -- next command entered by user
  3025.          end record; 
  3026.    --
  3027.          WD  : WORKING_DATA; 
  3028.          
  3029.          procedure EDITOR (MESSAGE_PASSED  : in out MESSAGE); 
  3030.    --
  3031.       end FILED_GENERIC_MESSAGE_EDITOR; 
  3032.       
  3033.    end FILE_GENERIC; 
  3034.    
  3035. ------------------------------------------------------------------------
  3036.    with TEXT_IO;                    use TEXT_IO; 
  3037.    with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  3038.    with TERMINAL_DEFINITION;        use TERMINAL_DEFINITION; 
  3039.    with FILE_ACCESS;                use FILE_ACCESS; 
  3040.    
  3041.    package body FILE_GENERIC is 
  3042.    
  3043.    
  3044.       package body FILED_GENERIC_MESSAGE_EDITOR is 
  3045.       
  3046.          procedure EDITOR (MESSAGE_PASSED  : in out MESSAGE) is 
  3047.          
  3048.    --
  3049.    -- Here we define those edit functions which are independent of
  3050.    -- message type, except possibly for formal data parameters.
  3051.    --
  3052.       -------------------------------------
  3053.             procedure FILL_LINE_TYPES is 
  3054.       -------------------------------------
  3055.                LINE_TYPE_FOUND  : LINE_NAME; 
  3056.                LINE_TO_PARSE    : NODE; 
  3057.             begin 
  3058.       --
  3059.       -- we proceed from head to tail of the message in msg, and
  3060.       -- for each line, we deterime the line type using parse_line_type.
  3061.       -- we then determine the position of that line type in the type
  3062.       -- line_name, and store the position in the line_type field of the
  3063.       -- message component. In fact, we consider the set of positions to
  3064.       -- range between 1..number of line types rather than 0..(number of
  3065.       -- line types - 1).
  3066.       --
  3067.                if MESSAGE_PASSED.NUMBER_OF_LINES < 1 then 
  3068.                   return; 
  3069.                end if; 
  3070.          --
  3071.                LINE_TO_PARSE := MESSAGE_PASSED.HEAD; 
  3072.                for I in 1..MESSAGE_PASSED.NUMBER_OF_LINES loop 
  3073.                   PARSE_LINE_TYPE (LINE_TO_PARSE, LINE_TYPE_FOUND); 
  3074.                   LINE_TO_PARSE.LINE_TYPE := LINE_NAME'POS (LINE_TYPE_FOUND) + 
  3075.                             1; 
  3076.                   LINE_TO_PARSE := LINE_TO_PARSE.NEXT_LINE; 
  3077.                end loop; 
  3078.          --
  3079.             end FILL_LINE_TYPES; 
  3080.       --
  3081.       -------------------------------------
  3082.             procedure DISPLAY_LINE (LINE_DATA       : LINE_INFORMATION; 
  3083.                                     BACKLIGHT_FLAG  : BOOLEAN) is 
  3084.       -------------------------------------
  3085.                CHARS_TO_DISPLAY, ROW  : POSITIVE; 
  3086.             begin 
  3087.          --
  3088.          -- if line is to be backlit then turn on reverse video
  3089.          --
  3090.                if BACKLIGHT_FLAG = TRUE then 
  3091.                   REVERSE_VIDEO_ON; 
  3092.                end if; 
  3093.          --
  3094.          -- calculate the row upon which we are to write the line,
  3095.          -- and position the cursor to the beginning of that row
  3096.          --
  3097.                ROW := LINE_DATA.LINE_NUMBER - WD.TOP_LINE.LINE_NUMBER + 
  3098.                          TOP_OF_MESSAGE_AREA; 
  3099.                GOTO_CRT_POSITION (ROW, 1); 
  3100.          --
  3101.          -- display the line, and reposition the cursor to the beginning
  3102.          -- of that line. Do this by first calculating the number of non
  3103.          -- blank characters. Display them. If backlight_flag is on,
  3104.          -- off reverse video. Then fill the remainder of the line with
  3105.          -- blanks (to over-write anything that might have been there
  3106.          -- before).
  3107.          --
  3108.                for I in reverse 1..MAXIMUM_CHARACTERS_PER_LINE loop 
  3109.                   if LINE_DATA.LINE_POINTER.TEXT_LINE (I) /= ' ' then 
  3110.                      CHARS_TO_DISPLAY := I; 
  3111.                      exit; 
  3112.                   end if; 
  3113.                end loop; 
  3114.                PUT (LINE_DATA.LINE_POINTER.TEXT_LINE (1..CHARS_TO_DISPLAY)); 
  3115.          --
  3116.          -- if line was backlit then turn off reverse video
  3117.          --
  3118.                if BACKLIGHT_FLAG = TRUE then 
  3119.                   REVERSE_VIDEO_OFF; 
  3120.                end if; 
  3121.                PUT (BLANK_LINE (1..MAXIMUM_CHARACTERS_PER_LINE - 
  3122.                          CHARS_TO_DISPLAY)); 
  3123.                GOTO_CRT_POSITION (ROW, 1); 
  3124.                
  3125.             end DISPLAY_LINE; 
  3126.       --
  3127.       -------------------------------------
  3128.             procedure DISPLAY_MESSAGE is 
  3129.       -------------------------------------
  3130.       --
  3131.       -- this routine displays message text lines in the message area.
  3132.       -- it displays starting with top_line and ending with bottom_line
  3133.       --
  3134.                DISPLAY_LINE_POINTER        : NODE; 
  3135.                                        -- points to line being displayed
  3136.                NUMBER_OF_LINES_TO_DISPLAY  : POSITIVE; 
  3137.             begin 
  3138.          --
  3139.          -- first we initialize display_line_pointer and calculate the
  3140.          -- number of lines to display. 
  3141.          -- then we loop, displaying lines and updating pointers.
  3142.          --
  3143.                DISPLAY_LINE_POINTER := WD.TOP_LINE.LINE_POINTER; 
  3144.                NUMBER_OF_LINES_TO_DISPLAY := WD.BOTTOM_LINE.LINE_NUMBER - 
  3145.                          WD.TOP_LINE.LINE_NUMBER + 1; 
  3146.          --
  3147.                for I in 1..NUMBER_OF_LINES_TO_DISPLAY loop 
  3148.             --
  3149.             -- position cursor, put text, and update pointer.
  3150.             --
  3151.                   GOTO_CRT_POSITION (TOP_OF_MESSAGE_AREA + I - 1, 1); 
  3152.                   PUT (DISPLAY_LINE_POINTER.TEXT_LINE 
  3153.                             (1..MAXIMUM_CHARACTERS_PER_LINE)); 
  3154.                   DISPLAY_LINE_POINTER := DISPLAY_LINE_POINTER.NEXT_LINE; 
  3155.                end loop; 
  3156.                DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3157.          --
  3158.             end DISPLAY_MESSAGE; 
  3159.       --
  3160.       -------------------------------------
  3161.             procedure FIELD_PUT (FIELD_NUM  : POSITIVE) is 
  3162.       -------------------------------------
  3163.       --
  3164.       -- this routine determines the field type from the current field
  3165.       -- number and the working line type. it gets a string to display.
  3166.       -- it underlines the field, displays the string (the field prompt)
  3167.       -- and positions the cursor to the first position in the field.
  3168.       --
  3169.             
  3170.             begin 
  3171.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA + 1, 1); 
  3172.                ERASE_LINE; 
  3173.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA + 2, 1); 
  3174.                ERASE_LINE; 
  3175.                if WD.ANY_AMP = TRUE then 
  3176.                   GOTO_CRT_POSITION (TOP_OF_AMP_AREA, 1); 
  3177.                   ERASE_TO_END_OF_SCREEN; 
  3178.                end if; 
  3179.          --
  3180.          -- now display the field prompt itself
  3181.          --
  3182.                FIELD_PROMPT.DISPLAY_PROMPT 
  3183.                          (WD.WORK_LINE.LINE_POINTER.LINE_TYPE, 
  3184.                WD.CURRENT_FIELD, 
  3185.                LINE_FORMAT.COMPONENT (WD.CURRENT_FIELD).FIELD_POSITION, 
  3186.                LINE_FORMAT.COMPONENT (WD.CURRENT_FIELD).FIELD_LENGTH, 
  3187.                TEMP_AMP); 
  3188.          --
  3189.          -- now redisplay the classification and reposition to first
  3190.          -- character of field. Save the temp_amp flag.
  3191.          --
  3192.                if TEMP_AMP = TRUE or WD.ANY_AMP = TRUE then 
  3193.                   DISPLAY_LOWER_CLASSIFICATION (WD.CURRENT_MESSAGE.CLASS); 
  3194.                end if; 
  3195.                WD.ANY_AMP := TEMP_AMP; 
  3196.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA, 
  3197.                LINE_FORMAT.COMPONENT (WD.CURRENT_FIELD).FIELD_POSITION); 
  3198.          --
  3199.             end FIELD_PUT; 
  3200.       --
  3201.       -------------------------------------
  3202.             procedure GET_LINE_TYPE (LINE_TYPE  : out LINE_NAME) is 
  3203.       -------------------------------------
  3204.       --
  3205.       -- prompts the user with the names of lines available
  3206.       -- and accepts the user's input
  3207.       --
  3208.             begin 
  3209.          --
  3210.          -- first we must prompt the user as to what line types are
  3211.          -- available. This prompt should be stored as an amp in the
  3212.          -- amp file. The actual parameter 1 in the display_prompt
  3213.          -- call tells display_prompt that it is the line_name prompt
  3214.          -- that is desired.
  3215.          --
  3216.                ERASE_SCREEN; 
  3217.                
  3218.                FIELD_PROMPT.DISPLAY_PROMPT (1); 
  3219.                
  3220.                GOTO_CRT_POSITION (BOT_OF_AMP_AREA, NMBR_OF_COLS - 10); 
  3221.          --
  3222.          -- now ask for user entry, accept it, and return
  3223.          --
  3224.                GET_LINE_NAME (LINE_TYPE); 
  3225.          --
  3226.          -- now re-display the menu & classification;
  3227.          --
  3228.                DISPLAY_MENU ("editmenu"); 
  3229.                
  3230.                DISPLAY_CLASSIFICATION (WD.CURRENT_MESSAGE.CLASS); 
  3231.                
  3232.             end GET_LINE_TYPE; 
  3233.       --
  3234.       -------------------------------------
  3235.             procedure START_END_AND_LENGTH (FIELD_NUMBER  : INTEGER) is 
  3236.       -------------------------------------
  3237.             begin 
  3238.          --
  3239.          -- This is just to enhance readibility. It will
  3240.          -- determine starting position, length, and ending position
  3241.          -- of the  field number passed
  3242.          --
  3243.                START_OF_FIELD := LINE_FORMAT.COMPONENT 
  3244.                          (FIELD_NUMBER).FIELD_POSITION; 
  3245.          --
  3246.                LENGTH_OF_FIELD := LINE_FORMAT.COMPONENT 
  3247.                          (FIELD_NUMBER).FIELD_LENGTH; 
  3248.          --
  3249.                END_OF_FIELD := START_OF_FIELD + LENGTH_OF_FIELD - 1; 
  3250.          --
  3251.             end START_END_AND_LENGTH; 
  3252.       --
  3253.       -------------------------------------
  3254.             procedure PROCESS_CLASSIFY_MESSAGE_COMMAND is 
  3255.       -------------------------------------
  3256.             begin 
  3257.       --
  3258.       -- To process the classify_message command, we first erase the
  3259.       -- bottom of the screen and display the prompt which solicits the
  3260.       -- desired classification. We then accept the user's entry.
  3261.       -- Finally, we erase the prompt and display the (new)
  3262.       -- classification.
  3263.       --
  3264.                GOTO_CRT_POSITION (TOP_OF_AMP_AREA, 1); 
  3265.                ERASE_TO_END_OF_SCREEN; 
  3266.                
  3267.                FIELD_PROMPT.DISPLAY_PROMPT (2); 
  3268.                
  3269.                GOTO_CRT_POSITION (TOP_OF_AMP_AREA + 3, 40); 
  3270.                GET_CLASSIFICATION (WD.CURRENT_MESSAGE.CLASS); 
  3271.                
  3272.                GOTO_CRT_POSITION (TOP_OF_AMP_AREA, 1); 
  3273.                ERASE_TO_END_OF_SCREEN; 
  3274.                DISPLAY_CLASSIFICATION (WD.CURRENT_MESSAGE.CLASS); 
  3275.                
  3276.             end PROCESS_CLASSIFY_MESSAGE_COMMAND; 
  3277.       --
  3278.       --------------------------------------
  3279.             procedure PROCESS_EDIT_LINE_COMMAND is 
  3280.       --------------------------------------
  3281.       --
  3282.       -- process_edit_line_command encapsulates all functions required
  3283.       -- to edit a line. various data elements are defined below, and
  3284.       -- several procedures are also defined within the scope of this
  3285.       -- procedure.
  3286.       --
  3287.       --
  3288.                FIELD_GOTTEN    : LINE_OF_TEXT;   -- holds field entered by user
  3289.                COMMAND_GOTTEN  : COMMAND;   -- holds command entered by user
  3290.                COMMAND_FLAG    : BOOLEAN; 
  3291.                                  --flag specifying whether user gave cmd
  3292.                FIELD_TYPE      : FIELD_NAME;        -- kind of field to input
  3293.                WORKING_TEXT    : LINE_OF_TEXT;      -- working line of text
  3294.          --
  3295.          -------------------------------------
  3296.                procedure LINE_VALIDATE is 
  3297.          -------------------------------------
  3298.          --checks to ensure all required flds are non-null. It does this
  3299.          -- by comparing the current field contents with the prototype
  3300.          -- field contents. If they are the same, then by definition the
  3301.          -- field is empty.
  3302.                
  3303.          -- builds a prompt string listing the #s of any required fields
  3304.          -- which are not filled in. This string is initialized with a
  3305.          -- partial prompt - "required fields left blank:" - to which we
  3306.          -- concatenate the field number of each required field which is
  3307.          -- blank. If it turns out that a required field was left blank,
  3308.          -- we issue the prompt.
  3309.          --
  3310.                   PROMPT_STRING     : STRING (1..NMBR_OF_COLS) := (1..NMBR_OF_COLS 
  3311.                             => ' '); 
  3312.                   RET_STR           : STRING (1..5); 
  3313.                   T_STR, NUM_CHARS  : INTEGER; 
  3314.                   P_STR_POINTER     : INTEGER := 27; 
  3315.             --
  3316.                begin 
  3317.             --
  3318.             -- any line with no fields is valid
  3319.             --
  3320.                   if LINE_FORMAT.NUMBER_OF_FIELDS = 0 then 
  3321.                      return; 
  3322.                   end if; 
  3323.                   
  3324.                   PROMPT_STRING (1..27) := "required fields left blank:"; 
  3325.             --
  3326.             -- initialize validated_line_flag to false. If the line is
  3327.             -- invalid by virtue of having a required field unfilled,
  3328.             -- set it to true.
  3329.             --
  3330.                   WD.VALIDATED_LINE_FLAG := FALSE; 
  3331.             --
  3332.             -- we compare the contents of each required field in the
  3333.             --current line with corresponding prototype field.if they're
  3334.             -- the same, the current field is empty (by definition).
  3335.             --In that case, we add that line's line number to the prompt
  3336.             -- we are building.
  3337.             --
  3338.                   for I in 1..LINE_FORMAT.NUMBER_OF_FIELDS loop 
  3339.                --
  3340.                      if LINE_FORMAT.COMPONENT (I).REQUIRED = TRUE then 
  3341.                   --
  3342.                   -- this field is required. is it filled ?
  3343.                   -- first determine start and end positions of field
  3344.                   --
  3345.                         START_END_AND_LENGTH (I); 
  3346.                   --
  3347.                   -- now compare contents of prototype field to actual
  3348.                   -- field. if they're the same, set flag and add to the
  3349.                   -- prompt
  3350.                   --
  3351.                         if WORKING_TEXT (START_OF_FIELD..END_OF_FIELD) = 
  3352.                                   LINE_FORMAT.PROTOTYPE_LINE 
  3353.                                   (START_OF_FIELD..END_OF_FIELD) then 
  3354.                      --
  3355.                            WD.VALIDATED_LINE_FLAG := TRUE; 
  3356.                      --
  3357.                      -- convert the field number (i) to a string
  3358.                      --
  3359.                            INT_STR (I, RET_STR, NUM_CHARS); 
  3360.                      --
  3361.                      -- set temp prompt string length to old prompt
  3362.                      -- string length + number of characters in latest
  3363.                      -- field # + 2. if the temp length can be
  3364.                      -- accomodated by crt width,then adjust the prompt
  3365.                      -- and the prompt length.
  3366.                      --
  3367.                            T_STR := P_STR_POINTER + NUM_CHARS + 2; 
  3368.                      --
  3369.                            if T_STR <= NMBR_OF_COLS then 
  3370.                               PROMPT_STRING (P_STR_POINTER + 1..T_STR) := " " 
  3371.                                         & RET_STR (1..NUM_CHARS) & ","; 
  3372.                               P_STR_POINTER := T_STR; 
  3373.                            end if; 
  3374.                         end if; 
  3375.                      end if; 
  3376.                   end loop; 
  3377.             --
  3378.             -- if there was a required field left blank, prompt the user
  3379.             --
  3380.                   if WD.VALIDATED_LINE_FLAG = TRUE then 
  3381.                      PROMPT (PROMPT_STRING); 
  3382.                   end if; 
  3383.             --
  3384.                end LINE_VALIDATE; 
  3385.          --
  3386.          -------------------------------------
  3387.                procedure PROCESS_NEXT_FIELD_COMMAND is 
  3388.          -------------------------------------
  3389.                begin 
  3390.             --
  3391.             -- if we are at end of line set field pointer to 1,
  3392.             -- otherwise increment it.
  3393.             --
  3394.             --
  3395.                   if WD.CURRENT_FIELD = LINE_FORMAT.NUMBER_OF_FIELDS then 
  3396.                      WD.CURRENT_FIELD := 1; 
  3397.                   else 
  3398.                      WD.CURRENT_FIELD := WD.CURRENT_FIELD + 1; 
  3399.                   end if; 
  3400.             --
  3401.             -- determine new field type
  3402.             --
  3403.                   FIELD_TYPE := FIELD_NAME'VAL (LINE_FORMAT.COMPONENT 
  3404.                             (WD.CURRENT_FIELD).FIELD); 
  3405.             --
  3406.             -- put the field prompt to the screen and position cursor
  3407.             --
  3408.                   FIELD_PUT (WD.CURRENT_FIELD); 
  3409.             --
  3410.                end PROCESS_NEXT_FIELD_COMMAND; 
  3411.          --
  3412.          -------------------------------------
  3413.                procedure PROCESS_PREVIOUS_FIELD_COMMAND is 
  3414.          -------------------------------------
  3415.                begin 
  3416.             --
  3417.             -- if we are at beginning of line set field pointer to
  3418.             -- number of fields in line, otherwise decrement it.
  3419.             --
  3420.                   if WD.CURRENT_FIELD = 1 then 
  3421.                      WD.CURRENT_FIELD := LINE_FORMAT.NUMBER_OF_FIELDS; 
  3422.                   else 
  3423.                      WD.CURRENT_FIELD := WD.CURRENT_FIELD - 1; 
  3424.                   end if; 
  3425.             --
  3426.             -- determine new field type
  3427.             --
  3428.                   FIELD_TYPE := FIELD_NAME'VAL (LINE_FORMAT.COMPONENT 
  3429.                             (WD.CURRENT_FIELD).FIELD); 
  3430.             --
  3431.             -- put the field prompt to the screen and position cursor
  3432.             --
  3433.                   FIELD_PUT (WD.CURRENT_FIELD); 
  3434.             --
  3435.                end PROCESS_PREVIOUS_FIELD_COMMAND; 
  3436.          --
  3437.          -------------------------------------
  3438.                procedure EXTRACT_FIELD is 
  3439.          -------------------------------------
  3440.                begin 
  3441.             --
  3442.             -- determine field positions
  3443.             --
  3444.                   START_END_AND_LENGTH (WD.CURRENT_FIELD); 
  3445.             --
  3446.             -- place current contents of field into field_gotten
  3447.             -- prior to calling get_field
  3448.             --
  3449.                   FIELD_GOTTEN (1..LENGTH_OF_FIELD) := WORKING_TEXT 
  3450.                             (START_OF_FIELD..END_OF_FIELD); 
  3451.             --
  3452.                end EXTRACT_FIELD; 
  3453.          --
  3454.          -------------------------------------
  3455.                procedure REPLACE_FIELD is 
  3456.          -------------------------------------
  3457.                begin 
  3458.             --
  3459.             -- determine field positions
  3460.             --
  3461.                   START_END_AND_LENGTH (WD.CURRENT_FIELD); 
  3462.             --
  3463.             -- place new contents of field into working_text
  3464.             -- after calling get_field
  3465.             --
  3466.                   WORKING_TEXT (START_OF_FIELD..END_OF_FIELD) := FIELD_GOTTEN 
  3467.                             (1..LENGTH_OF_FIELD); 
  3468.             --
  3469.                end REPLACE_FIELD; 
  3470.          --
  3471.          -------------------------------------
  3472.                procedure PROCESS_ERASE_FIELD_COMMAND is 
  3473.          -------------------------------------
  3474.                begin 
  3475.             --
  3476.             -- determine field positions
  3477.             --
  3478.                   START_END_AND_LENGTH (WD.CURRENT_FIELD); 
  3479.             --
  3480.             -- fill field_gotten with contents of prototype field
  3481.             --
  3482.                   FIELD_GOTTEN (1..LENGTH_OF_FIELD) := 
  3483.                             LINE_FORMAT.PROTOTYPE_LINE 
  3484.                             (START_OF_FIELD..END_OF_FIELD); 
  3485.             --
  3486.             -- fill working_text with contents of prototype field
  3487.             --
  3488.                   WORKING_TEXT (START_OF_FIELD..END_OF_FIELD) := FIELD_GOTTEN 
  3489.                             (1..LENGTH_OF_FIELD); 
  3490.             --
  3491.             -- now position cursor to beginning of the field in the work
  3492.             -- area, write over whatever is there, and reposition
  3493.             -- to the beginning of the field
  3494.             --
  3495.                   GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  3496.                   PUT (FIELD_GOTTEN (1..LENGTH_OF_FIELD)); 
  3497.                   GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  3498.             --
  3499.                end PROCESS_ERASE_FIELD_COMMAND; 
  3500.          --
  3501.       -------------------------------------
  3502.                procedure SAVE_LINE is 
  3503.       -------------------------------------
  3504.                begin 
  3505.          --
  3506.          -- pack the line of text and place it in the message
  3507.          --
  3508.                   PACK_LINE (WORKING_TEXT, LINE_FORMAT); 
  3509.                   WD.WORK_LINE.LINE_POINTER.TEXT_LINE := WORKING_TEXT; 
  3510.                end SAVE_LINE; 
  3511.       --
  3512.       ----------------------------------------
  3513.             begin   -- finally starting process_edit_line_command
  3514.          --
  3515.                WD.MODE := EDIT; 
  3516.          --
  3517.          -- we are about to begin editing the line whose data are given
  3518.          -- in work_line. set changes made flag, put the current
  3519.          -- contents of the line into working_text, set the field
  3520.          -- number to 1, set the field type to its proper value, and
  3521.          -- set next command to nil.
  3522.          --   
  3523.                WD.CHANGES_MADE_FLAG := TRUE; 
  3524.                WORKING_TEXT (1..MAXIMUM_CHARACTERS_PER_LINE) := 
  3525.                          WD.WORK_LINE.LINE_POINTER.TEXT_LINE 
  3526.                          (1..MAXIMUM_CHARACTERS_PER_LINE); 
  3527.                WD.CURRENT_FIELD := 1; 
  3528.                FIELD_TYPE := FIELD_NAME'VAL (LINE_FORMAT.COMPONENT 
  3529.                          (WD.CURRENT_FIELD).FIELD); 
  3530.                WD.NEXT_COMMAND := NIL; 
  3531.          --
  3532.          -- now we do the display work. first unpack the text, then
  3533.          -- position ourselves to the beginning of the work line area,
  3534.          -- display the text and the field prompt for the first field.
  3535.          --
  3536.                UNPACK_LINE (WORKING_TEXT, LINE_FORMAT); 
  3537.                
  3538.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA, 1); 
  3539.                PUT (WORKING_TEXT (1..MAXIMUM_CHARACTERS_PER_LINE)); 
  3540.                FIELD_PUT (1); 
  3541.          --
  3542.          -- now we loop until the user enters a command which causes us
  3543.          -- to cease editing this line
  3544.          --
  3545.                loop 
  3546.             --
  3547.             -- now that we are into the edit field loop, we put the
  3548.             -- existing contents of the current field into field_gotten
  3549.             --
  3550.                   EXTRACT_FIELD; 
  3551.             --
  3552.             -- now we go input the field (ie. allow the user to edit it)
  3553.             --
  3554.                   GET_FIELD (FIELD_TYPE, FIELD_GOTTEN (1..LENGTH_OF_FIELD), 
  3555.                   LINE_FORMAT.COMPONENT (WD.CURRENT_FIELD).FIELD_POSITION, 
  3556.                   LINE_FORMAT.COMPONENT (WD.CURRENT_FIELD).FIELD_LENGTH, 
  3557.                   COMMAND_GOTTEN, COMMAND_FLAG); 
  3558.             --
  3559.             -- must now place the contents of field_gotten into the line
  3560.             --
  3561.                   REPLACE_FIELD; 
  3562.             --
  3563.             -- having handled the field gotten, we are now ready to
  3564.             -- handle any command which may also have been entered
  3565.             --
  3566.                   if COMMAND_FLAG = FALSE then 
  3567.                      PROCESS_NEXT_FIELD_COMMAND; 
  3568.                   else                      -- when command_flag = true;
  3569.                      case COMMAND_GOTTEN is 
  3570.                   --
  3571.                         when NEXT_FIELD | RIGHT_ARROW => 
  3572.                            PROCESS_NEXT_FIELD_COMMAND; 
  3573.                   --
  3574.                         when PREV_FIELD | LEFT_ARROW => 
  3575.                            PROCESS_PREVIOUS_FIELD_COMMAND; 
  3576.                   --
  3577.                         when ERASE_FIELD => 
  3578.                            PROCESS_ERASE_FIELD_COMMAND; 
  3579.                   --
  3580.                         when CLASSIFY => 
  3581.                            PROCESS_CLASSIFY_MESSAGE_COMMAND; 
  3582.                            PROCESS_NEXT_FIELD_COMMAND; 
  3583.                   --
  3584.                         when PREV_LINE | UP_ARROW | NEXT_LINE | DOWN_ARROW | 
  3585.                                   END_EDIT => 
  3586.                                  --here we're leaving edit line so clean
  3587.                                  -- up. Set mode to scroll, validate the
  3588.                                  -- line.
  3589.                                  --
  3590.                            WD.MODE := SCROLL; 
  3591.                            LINE_VALIDATE; 
  3592.                                  --
  3593.                                  -- do we want to allow the user to 
  3594.                                  -- enter a line which does not have
  3595.                                  -- all required fields. If not, enter
  3596.                                  -- required action here.
  3597.                                  --
  3598.                            WD.NEXT_COMMAND := COMMAND_GOTTEN; 
  3599.                                  --
  3600.                                  -- Now save the text of the line just
  3601.                                  -- edited and erase the work/amp areas
  3602.                                  -- to be rid of that line's text and 
  3603.                                  -- prompts. Then redisplay the
  3604.                                  -- classification.
  3605.                                  --
  3606.                            SAVE_LINE; 
  3607.                            for K in TOP_OF_WORK_AREA..BOT_OF_WORK_AREA loop 
  3608.                               ERASE_LINE (K); 
  3609.                            end loop; 
  3610.                            if WD.ANY_AMP = TRUE then 
  3611.                               GOTO_CRT_POSITION (TOP_OF_AMP_AREA, 1); 
  3612.                               ERASE_TO_END_OF_SCREEN; 
  3613.                               DISPLAY_LOWER_CLASSIFICATION 
  3614.                                         (WD.CURRENT_MESSAGE.CLASS); 
  3615.                            end if; 
  3616.                            exit; 
  3617.                            
  3618.                         when others => 
  3619.                            PROMPT ("illegal command in this context"); 
  3620.                            PROCESS_NEXT_FIELD_COMMAND; 
  3621.                      end case; 
  3622.                --
  3623.                   end if; 
  3624.             --
  3625.                end loop; 
  3626.          --
  3627.             end PROCESS_EDIT_LINE_COMMAND; 
  3628.       --
  3629.       ---------------------------------------
  3630.             procedure PROCESS_INSERT_LINE_COMMAND is 
  3631.       ---------------------------------------
  3632.                NEW_LINE_NUMBER  : POSITIVE; 
  3633.       --
  3634.             begin 
  3635.          --
  3636.          -- first check boundary condition
  3637.          --
  3638.                if WD.CURRENT_MESSAGE.NUMBER_OF_LINES = 
  3639.                          MAXIMUM_LINES_PER_MESSAGE then 
  3640.                   PROMPT ("Already at maximum number of lines per message"); 
  3641.                   return; 
  3642.                end if; 
  3643.          --
  3644.          -- this constitutes a change in the message
  3645.          --
  3646.                WD.CHANGES_MADE_FLAG := TRUE; 
  3647.          --
  3648.          -- get new node, adjust pointers, and initialize
  3649.          --
  3650.                INSERT_BEFORE (WD.CURRENT_MESSAGE, WD.WORK_LINE.LINE_POINTER); 
  3651.          --
  3652.          -- reset pointer to make the new line the working line
  3653.          --
  3654.                WD.WORK_LINE.LINE_POINTER := 
  3655.                          WD.WORK_LINE.LINE_POINTER.PREV_LINE; 
  3656.          --
  3657.          -- if were at top line, make new line into top line
  3658.          --
  3659.                if WD.WORK_LINE.LINE_NUMBER = WD.TOP_LINE.LINE_NUMBER then 
  3660.                   WD.TOP_LINE.LINE_POINTER := WD.WORK_LINE.LINE_POINTER; 
  3661.                end if; 
  3662.          --
  3663.          -- increment line count
  3664.          --
  3665.                WD.CURRENT_MESSAGE.NUMBER_OF_LINES := 
  3666.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES + 1; 
  3667.          --
  3668.          -- get type of line to be added
  3669.          --
  3670.                GET_LINE_TYPE (TEMP_LINE_TYPE); 
  3671.                WD.WORK_LINE.LINE_POINTER.LINE_TYPE := LINE_NAME'POS 
  3672.                          (TEMP_LINE_TYPE) + 1; 
  3673.                LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3674.                          (LINE_NAME'POS (TEMP_LINE_TYPE) + 1); 
  3675.       --
  3676.                LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3677.                LINE_TYPE_COUNTER); 
  3678.          --
  3679.          --initialize the line's text with prototype line
  3680.          --
  3681.                WD.WORK_LINE.LINE_POINTER.TEXT_LINE 
  3682.                          (1..MAXIMUM_CHARACTERS_PER_LINE) := 
  3683.                          LINE_FORMAT.PROTOTYPE_LINE 
  3684.                          (1..MAXIMUM_CHARACTERS_PER_LINE); 
  3685.          --
  3686.          -- now do display work. first, adjust bottom line display data.
  3687.          --
  3688.          -- if the number of lines displayed is less than the number of
  3689.          -- crt lines available, then there is room at the bottom of the
  3690.          -- crt for another line, and the bottom line displayed will
  3691.          -- change in number, but it will be the same text. otherwise,
  3692.          -- the line number will remain the same, but the line pointer
  3693.          -- will change.
  3694.          --
  3695.                if (WD.BOTTOM_LINE.LINE_NUMBER - WD.TOP_LINE.LINE_NUMBER + 1) < 
  3696.                          (BOT_OF_MESSAGE_AREA - TOP_OF_MESSAGE_AREA + 1) then 
  3697.                   WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER + 
  3698.                             1; 
  3699.                else 
  3700.                   WD.BOTTOM_LINE.LINE_POINTER := 
  3701.                             WD.BOTTOM_LINE.LINE_POINTER.PREV_LINE; 
  3702.                end if; 
  3703.          --
  3704.          -- now re-display the message
  3705.          --
  3706.                DISPLAY_MESSAGE; 
  3707.          --
  3708.          -- if this line is editable, set mode to edit and edit it;
  3709.          -- otherwise set mode to scroll and return.
  3710.          --
  3711.                if LINE_FORMAT.NUMBER_OF_FIELDS > 0 then 
  3712.                   WD.MODE := EDIT; 
  3713.                   PROCESS_EDIT_LINE_COMMAND; 
  3714.                else 
  3715.                   WD.MODE := SCROLL; 
  3716.                end if; 
  3717.          --
  3718.             end PROCESS_INSERT_LINE_COMMAND; 
  3719.       --
  3720.       ---------------------------------------
  3721.             procedure PROCESS_DELETE_LINE_COMMAND is 
  3722.       ---------------------------------------
  3723.             begin 
  3724.          --
  3725.          -- first check boundary conditions
  3726.          --
  3727.                if WD.CURRENT_MESSAGE.NUMBER_OF_LINES = 1 then 
  3728.                   PROMPT (" can't delete the only line in a message"); 
  3729.                   return; 
  3730.                end if; 
  3731.          --
  3732.          --
  3733.          -- this constitutes a change in the message
  3734.          --
  3735.                WD.CHANGES_MADE_FLAG := TRUE; 
  3736.          --
  3737.          -- decrement the number of lines in the message
  3738.          --
  3739.                WD.CURRENT_MESSAGE.NUMBER_OF_LINES := 
  3740.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES - 1; 
  3741.          --
  3742.          -- we take this in three cases : deleting the first line,
  3743.          -- the last line, or some middle line of the message.
  3744.          --
  3745.                if WD.WORK_LINE.LINE_NUMBER = 1 then 
  3746.          -- 
  3747.          -- here we are deleting 1st line of the message
  3748.          -- reset pointer to 2nd and delete 1st
  3749.          -- 
  3750.                   WD.WORK_LINE.LINE_POINTER := 
  3751.                             WD.WORK_LINE.LINE_POINTER.NEXT_LINE; 
  3752.                   LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3753.                             (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  3754.         --
  3755.                   LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3756.                   LINE_TYPE_COUNTER); 
  3757.                   DELETE (WD.CURRENT_MESSAGE, 
  3758.                             WD.WORK_LINE.LINE_POINTER.PREV_LINE); 
  3759.          -- 
  3760.          -- now we scroll the message area up, display any new 
  3761.          -- bottom line if there is one, and display the new 1st 
  3762.          -- line backlit. While we are doing that we also update 
  3763.          -- the display pointers.
  3764.          -- 
  3765.                   SCROLL_SCREEN (TOP_OF_MESSAGE_AREA + 1, 
  3766.                   BOT_OF_MESSAGE_AREA, UP); 
  3767.                   WD.TOP_LINE.LINE_POINTER := WD.WORK_LINE.LINE_POINTER; 
  3768.             --
  3769.             -- Is there to be a new line displayed at the bottom ? 
  3770.             --
  3771.                   if WD.CURRENT_MESSAGE.NUMBER_OF_LINES < (BOT_OF_MESSAGE_AREA 
  3772.                             - TOP_OF_MESSAGE_AREA + 1) then 
  3773.             --
  3774.             -- here there is a not a new line to be displayed. 
  3775.             -- change number of bottom line, and backlight new 
  3776.             -- working line 
  3777.             -- 
  3778.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  3779.                                - 1; 
  3780.                      DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3781.             -- 
  3782.                   else 
  3783.             --
  3784.             -- here there is a new line to be displayed. change pointer
  3785.             -- to bottom line, display new bottom line , and backlight
  3786.             -- new working line.
  3787.             --
  3788.                      WD.BOTTOM_LINE.LINE_POINTER := 
  3789.                                WD.BOTTOM_LINE.LINE_POINTER.NEXT_LINE; 
  3790.                      DISPLAY_LINE (WD.BOTTOM_LINE, FALSE); 
  3791.                      DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3792.                   end if; 
  3793.          --
  3794.                elsif WD.WORK_LINE.LINE_NUMBER > 
  3795.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES then 
  3796.          --
  3797.          -- here we are deleting the last line of the message.
  3798.          -- reset pointer, set current line, delete old working line
  3799.          --
  3800.                   WD.WORK_LINE.LINE_POINTER := 
  3801.                             WD.WORK_LINE.LINE_POINTER.PREV_LINE; 
  3802.                   WD.WORK_LINE.LINE_NUMBER := WD.WORK_LINE.LINE_NUMBER - 1; 
  3803.                   LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3804.                             (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  3805.         --
  3806.                   LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3807.                   LINE_TYPE_COUNTER); 
  3808.                   DELETE (WD.CURRENT_MESSAGE, 
  3809.                   WD.WORK_LINE.LINE_POINTER.NEXT_LINE); 
  3810.          --
  3811.          -- If the whole message is on the screen, we do one thing
  3812.          -- otherwise we take another approach
  3813.          --
  3814.                   if WD.TOP_LINE.LINE_NUMBER = 1 then 
  3815.             --
  3816.             -- here we erase the old bottom line, backlite then new
  3817.             -- and reset pointers
  3818.             --
  3819.                      GOTO_CRT_POSITION (WD.BOTTOM_LINE.LINE_NUMBER + 
  3820.                                TOP_OF_MESSAGE_AREA - 1, 1); 
  3821.                      ERASE_LINE; 
  3822.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  3823.                                - 1; 
  3824.                      WD.BOTTOM_LINE.LINE_POINTER := WD.WORK_LINE.LINE_POINTER; 
  3825.                      DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3826.                   else 
  3827.             --
  3828.             -- here we scroll down, rewrite the new top and bottom
  3829.             -- lines, and adjust pointers
  3830.             --
  3831.                      SCROLL_SCREEN (TOP_OF_MESSAGE_AREA, 
  3832.                      BOT_OF_MESSAGE_AREA, DOWN); 
  3833.                      WD.TOP_LINE.LINE_NUMBER := WD.TOP_LINE.LINE_NUMBER - 1; 
  3834.                      WD.TOP_LINE.LINE_POINTER := 
  3835.                                WD.TOP_LINE.LINE_POINTER.PREV_LINE; 
  3836.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  3837.                                - 1; 
  3838.                      WD.BOTTOM_LINE.LINE_POINTER := 
  3839.                                WD.BOTTOM_LINE.LINE_POINTER.PREV_LINE; 
  3840.                      DISPLAY_LINE (WD.TOP_LINE, FALSE); 
  3841.                      DISPLAY_LINE (WD.BOTTOM_LINE, TRUE); 
  3842.                   end if; 
  3843.                else 
  3844.          --
  3845.          -- here we are deleting a middle line of the message.
  3846.          -- reset pointers, set current line, delete old working line
  3847.          --
  3848.          -- we take this in the following cases :
  3849.          -- 1.  bottom line of the message is not on the screen
  3850.          -- 2.  bottom line is on the screen, but the top line is not
  3851.          -- 3.  entire message is on the screen
  3852.          --
  3853.                   if WD.BOTTOM_LINE.LINE_NUMBER <= 
  3854.                             WD.CURRENT_MESSAGE.NUMBER_OF_LINES then 
  3855.             --
  3856.             -- here we shall scroll from the bottom of the screen
  3857.             -- up, write the new bottom line on the screen unbacklit,
  3858.             -- write the new working line backlit, and adjust pointers
  3859.             --
  3860.                      WD.WORK_LINE.LINE_POINTER := 
  3861.                                WD.WORK_LINE.LINE_POINTER.NEXT_LINE; 
  3862.                      LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3863.                                (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  3864.         --
  3865.                      LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3866.                      LINE_TYPE_COUNTER); 
  3867.                      DELETE (WD.CURRENT_MESSAGE, 
  3868.                      WD.WORK_LINE.LINE_POINTER.PREV_LINE); 
  3869.             --
  3870.                      if WD.BOTTOM_LINE.LINE_NUMBER = WD.WORK_LINE.LINE_NUMBER 
  3871.                                then 
  3872.                --
  3873.                -- here we're deleting the bottom line displayed
  3874.                --
  3875.                         GOTO_CRT_POSITION (BOT_OF_MESSAGE_AREA, 1); 
  3876.                         ERASE_LINE; 
  3877.                         WD.BOTTOM_LINE.LINE_POINTER := 
  3878.                                   WD.WORK_LINE.LINE_POINTER; 
  3879.                         DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3880.                --
  3881.                      else 
  3882.                --
  3883.                -- here we're deleting a line above the bottom line
  3884.                --
  3885.                         SCROLL_SCREEN (WD.WORK_LINE.LINE_NUMBER - 
  3886.                                   WD.TOP_LINE.LINE_NUMBER + 
  3887.                                   TOP_OF_MESSAGE_AREA, 
  3888.                         BOT_OF_MESSAGE_AREA, UP); 
  3889.                         WD.BOTTOM_LINE.LINE_POINTER := 
  3890.                                   WD.BOTTOM_LINE.LINE_POINTER.NEXT_LINE; 
  3891.                         DISPLAY_LINE (WD.BOTTOM_LINE, FALSE); 
  3892.                         DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3893.                   --
  3894.                   -- did we delete the top line displayed ?
  3895.                   --
  3896.                         if WD.TOP_LINE.LINE_NUMBER = WD.WORK_LINE.LINE_NUMBER 
  3897.                                   then 
  3898.                            WD.TOP_LINE.LINE_POINTER := 
  3899.                                      WD.WORK_LINE.LINE_POINTER; 
  3900.                         end if; 
  3901.                      end if; 
  3902.             --
  3903.                   elsif WD.TOP_LINE.LINE_NUMBER > 1 then 
  3904.             --
  3905.             -- here we shall scroll from the top of the screen down,
  3906.             -- write the new top line on the screen unbacklit,
  3907.             -- write the new working line backlit, and adjust pointers
  3908.             --
  3909.                      WD.WORK_LINE.LINE_POINTER := 
  3910.                                WD.WORK_LINE.LINE_POINTER.PREV_LINE; 
  3911.                      LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3912.                                (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  3913.            --
  3914.                      LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3915.                      LINE_TYPE_COUNTER); 
  3916.                      WD.WORK_LINE.LINE_NUMBER := WD.WORK_LINE.LINE_NUMBER - 1; 
  3917.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  3918.                                - 1; 
  3919.                      WD.TOP_LINE.LINE_NUMBER := WD.TOP_LINE.LINE_NUMBER - 1; 
  3920.                      WD.TOP_LINE.LINE_POINTER := 
  3921.                                WD.TOP_LINE.LINE_POINTER.PREV_LINE; 
  3922.                      DELETE (WD.CURRENT_MESSAGE, 
  3923.                      WD.WORK_LINE.LINE_POINTER.NEXT_LINE); 
  3924.                --
  3925.                      if WD.WORK_LINE.LINE_NUMBER = WD.TOP_LINE.LINE_NUMBER 
  3926.                                then 
  3927.                --
  3928.                -- here we are deleting the top line
  3929.                --
  3930.                         GOTO_CRT_POSITION (TOP_OF_MESSAGE_AREA, 1); 
  3931.                         ERASE_LINE; 
  3932.                         DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3933.                --
  3934.                      else 
  3935.                --
  3936.                -- here we are deleting some interior line
  3937.                --
  3938.                         SCROLL_SCREEN (TOP_OF_MESSAGE_AREA, 
  3939.                         WD.WORK_LINE.LINE_NUMBER - WD.TOP_LINE.LINE_NUMBER + 
  3940.                                   TOP_OF_MESSAGE_AREA, 
  3941.                         DOWN); 
  3942.                         DISPLAY_LINE (WD.TOP_LINE, FALSE); 
  3943.                         DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3944.                      end if; 
  3945.                   else 
  3946.             -- 
  3947.             -- here the whole message is on the screen, so we scroll up
  3948.             -- rewriting the new working line backlit, and adjust
  3949.             -- pointers.
  3950.             --
  3951.                      WD.WORK_LINE.LINE_POINTER := 
  3952.                                WD.WORK_LINE.LINE_POINTER.NEXT_LINE; 
  3953.                      LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  3954.                                (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  3955.               --
  3956.                      LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  3957.                      LINE_TYPE_COUNTER); 
  3958.                      DELETE (WD.CURRENT_MESSAGE, 
  3959.                      WD.WORK_LINE.LINE_POINTER.PREV_LINE); 
  3960.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  3961.                                - 1; 
  3962.                      SCROLL_SCREEN (TOP_OF_MESSAGE_AREA + 
  3963.                                WD.WORK_LINE.LINE_NUMBER - 1, 
  3964.                      BOT_OF_MESSAGE_AREA, UP); 
  3965.                      DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  3966.                   end if; 
  3967.                end if; 
  3968.             end PROCESS_DELETE_LINE_COMMAND; 
  3969.       --
  3970.       ---------------------------------------
  3971.             procedure PROCESS_NEXT_LINE_COMMAND is 
  3972.       ---------------------------------------
  3973.       --
  3974.             begin 
  3975.          --
  3976.          -- check boundary condition
  3977.          --
  3978.                if (WD.WORK_LINE.LINE_NUMBER = 
  3979.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES) and 
  3980.                          (WD.CURRENT_MESSAGE.NUMBER_OF_LINES = 
  3981.                          MAXIMUM_LINES_PER_MESSAGE) then 
  3982.                   PROMPT ("Already at maximum number of lines per message"); 
  3983.                   return; 
  3984.                end if; 
  3985.          --
  3986.          -- if the user is on the last line and activates this command,
  3987.          -- we insert a new line at the end of the message. if not at
  3988.          -- the last line, we simply move on to the next line.
  3989.          --
  3990.                if WD.WORK_LINE.LINE_NUMBER < 
  3991.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES then 
  3992.             --
  3993.             -- here we do not add a line, we simply move on to the next
  3994.             -- line. to do that, first we un-backlight the old working
  3995.             -- line, and update the data on the new working line
  3996.             --
  3997.                   DISPLAY_LINE (WD.WORK_LINE, FALSE); 
  3998.                   WD.WORK_LINE.LINE_NUMBER := WD.WORK_LINE.LINE_NUMBER + 1; 
  3999.                   WD.WORK_LINE.LINE_POINTER := 
  4000.                             WD.WORK_LINE.LINE_POINTER.NEXT_LINE; 
  4001.                   LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  4002.                             (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  4003.         --
  4004.                   LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  4005.                   LINE_TYPE_COUNTER); 
  4006.             --
  4007.             -- if the new working line is not on the screen (we were at
  4008.             -- the bottom) scroll the message area up, and adjust the
  4009.             -- top/bottom line displayed data
  4010.             --
  4011.                   if WD.WORK_LINE.LINE_NUMBER > WD.BOTTOM_LINE.LINE_NUMBER 
  4012.                             then 
  4013.                      SCROLL_SCREEN (TOP_OF_MESSAGE_AREA, 
  4014.                      BOT_OF_MESSAGE_AREA, UP); 
  4015.                      WD.TOP_LINE.LINE_NUMBER := WD.TOP_LINE.LINE_NUMBER + 1; 
  4016.                      WD.TOP_LINE.LINE_POINTER := 
  4017.                                WD.TOP_LINE.LINE_POINTER.NEXT_LINE; 
  4018.                      WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER 
  4019.                                + 1; 
  4020.                      WD.BOTTOM_LINE.LINE_POINTER := 
  4021.                                WD.BOTTOM_LINE.LINE_POINTER.NEXT_LINE; 
  4022.                   end if; 
  4023.             --
  4024.             -- backlight the new working line
  4025.             --
  4026.                   DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  4027.             --
  4028.                else 
  4029.             --
  4030.             -- here we were at the end of the message so we must add a
  4031.             -- new line at the bottom of the message
  4032.             --
  4033.             -- get new node, adjust pointers, and initialize
  4034.             --
  4035.                   INSERT_AFTER (WD.CURRENT_MESSAGE, 
  4036.                             WD.WORK_LINE.LINE_POINTER); 
  4037.             --
  4038.             -- reset pointer to make the new line the working line and
  4039.             -- increment line count
  4040.             --
  4041.                   WD.WORK_LINE.LINE_POINTER := 
  4042.                             WD.WORK_LINE.LINE_POINTER.NEXT_LINE; 
  4043.                   
  4044.                   WD.CURRENT_MESSAGE.TAIL := WD.WORK_LINE.LINE_POINTER; 
  4045.                   
  4046.                   WD.CURRENT_MESSAGE.NUMBER_OF_LINES := 
  4047.                             WD.CURRENT_MESSAGE.NUMBER_OF_LINES + 1; 
  4048.                   
  4049.                   WD.WORK_LINE.LINE_NUMBER := 
  4050.                             WD.CURRENT_MESSAGE.NUMBER_OF_LINES; 
  4051.             --
  4052.             -- get type of line to be added and
  4053.             -- initialize the line's text with prototype line
  4054.             --
  4055.                   GET_LINE_TYPE (TEMP_LINE_TYPE); 
  4056.                   WD.WORK_LINE.LINE_POINTER.LINE_TYPE := LINE_NAME'POS 
  4057.                             (TEMP_LINE_TYPE) + 1; 
  4058.                   LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  4059.                             (LINE_NAME'POS (TEMP_LINE_TYPE) + 1); 
  4060.                   
  4061.                   LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  4062.                   LINE_TYPE_COUNTER); 
  4063.                   WD.WORK_LINE.LINE_POINTER.TEXT_LINE 
  4064.                             (1..MAXIMUM_CHARACTERS_PER_LINE) := 
  4065.                             LINE_FORMAT.PROTOTYPE_LINE 
  4066.                             (1..MAXIMUM_CHARACTERS_PER_LINE); 
  4067.             --
  4068.             -- this constitutes a change
  4069.             --
  4070.                   WD.CHANGES_MADE_FLAG := TRUE; 
  4071.             --
  4072.             -- now do the display work. first update bottom ln dsp data
  4073.             --
  4074.                   WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER + 
  4075.                             1; 
  4076.                   WD.BOTTOM_LINE.LINE_POINTER := 
  4077.                             WD.BOTTOM_LINE.LINE_POINTER.NEXT_LINE; 
  4078.             --
  4079.             -- if we were at the bottom of the screen, then we will have
  4080.             -- a new top line displayed, so update that data
  4081.             --
  4082.                   if (WD.BOTTOM_LINE.LINE_NUMBER - WD.TOP_LINE.LINE_NUMBER) > 
  4083.                             (BOT_OF_MESSAGE_AREA - TOP_OF_MESSAGE_AREA) then 
  4084.                      WD.TOP_LINE.LINE_POINTER := 
  4085.                                WD.TOP_LINE.LINE_POINTER.NEXT_LINE; 
  4086.                      WD.TOP_LINE.LINE_NUMBER := WD.TOP_LINE.LINE_NUMBER + 1; 
  4087.                   end if; 
  4088.             --
  4089.             -- now re-display the message
  4090.             --
  4091.                   DISPLAY_MESSAGE; 
  4092.             --
  4093.             -- if this line is editable, set mode to edit and edit it;
  4094.             -- otherwise set mode to scroll and return.
  4095.             --
  4096.                   if LINE_FORMAT.NUMBER_OF_FIELDS > 0 then 
  4097.                      WD.MODE := EDIT; 
  4098.                      PROCESS_EDIT_LINE_COMMAND; 
  4099.                   else 
  4100.                      WD.MODE := SCROLL; 
  4101.                   end if; 
  4102.             --
  4103.                end if; 
  4104.             end PROCESS_NEXT_LINE_COMMAND; 
  4105.       --    
  4106.       --------------------------------------
  4107.             procedure PROCESS_PREV_LINE_COMMAND is 
  4108.       --------------------------------------
  4109.             begin 
  4110.          --
  4111.          -- check boundary condition
  4112.          --
  4113.                if WD.WORK_LINE.LINE_POINTER = WD.CURRENT_MESSAGE.HEAD then 
  4114.                   PROMPT ("can't back-up past top of message"); 
  4115.                   return; 
  4116.                end if; 
  4117.          --
  4118.          -- first we un-backlight the old working line, and update the
  4119.          -- data for the new working line
  4120.          --
  4121.                DISPLAY_LINE (WD.WORK_LINE, FALSE); 
  4122.                WD.WORK_LINE.LINE_NUMBER := WD.WORK_LINE.LINE_NUMBER - 1; 
  4123.                WD.WORK_LINE.LINE_POINTER := 
  4124.                          WD.WORK_LINE.LINE_POINTER.PREV_LINE; 
  4125.                LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  4126.                          (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  4127.          --
  4128.                
  4129.                LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  4130.                LINE_TYPE_COUNTER); 
  4131.          --
  4132.          -- if the new working line is not on the screen (we were at
  4133.          -- the bottom) scroll the message area down, and adjust the
  4134.          -- top/bottom line displayed data
  4135.          --
  4136.                if WD.WORK_LINE.LINE_NUMBER < WD.TOP_LINE.LINE_NUMBER then 
  4137.                   SCROLL_SCREEN (TOP_OF_MESSAGE_AREA, 
  4138.                   BOT_OF_MESSAGE_AREA, DOWN); 
  4139.                   WD.TOP_LINE.LINE_NUMBER := WD.TOP_LINE.LINE_NUMBER - 1; 
  4140.                   WD.TOP_LINE.LINE_POINTER := 
  4141.                             WD.TOP_LINE.LINE_POINTER.PREV_LINE; 
  4142.                   WD.BOTTOM_LINE.LINE_NUMBER := WD.BOTTOM_LINE.LINE_NUMBER - 
  4143.                             1; 
  4144.                   WD.BOTTOM_LINE.LINE_POINTER := 
  4145.                             WD.BOTTOM_LINE.LINE_POINTER.PREV_LINE; 
  4146.                end if; 
  4147.          --
  4148.          -- backlight the new working line
  4149.          --
  4150.                DISPLAY_LINE (WD.WORK_LINE, TRUE); 
  4151.          --
  4152.             end PROCESS_PREV_LINE_COMMAND; 
  4153.       --    
  4154. ------------------------------------------------------------------------
  4155.             use LINE_DEFINITION_IO; 
  4156.             use FIELD_PROMPT_IO; 
  4157.             use PROMPT_VECTOR_IO; 
  4158. --
  4159. -- finally we get to the body of the main procedure
  4160. --
  4161.          begin 
  4162.    --
  4163.    -- to start, we must go get the message we are to edit, and perform
  4164.    -- some initialization.
  4165.    --
  4166.             INITIALIZE_TERMINAL; 
  4167.    --
  4168.             OPEN (LINE_STRUCTURE_FILE, IN_FILE, LINE_STRUCTURE_FILE_NAME); 
  4169.    --
  4170.             OPEN (FIELD_PROMPT_FILE, IN_FILE, FIELD_PROMPT_FILE_NAME); 
  4171.    --
  4172.             OPEN (PROMPT_VECTOR_FILE, IN_FILE, PROMPT_VECTOR_FILE_NAME); 
  4173. --
  4174.    --
  4175.             WD.CURRENT_MESSAGE := MESSAGE_PASSED; 
  4176.    --
  4177.             FILL_LINE_TYPES; 
  4178.                       -- determine the type of each line and place in
  4179.                       -- in the line_type field of its message component
  4180.                       -- read the line structure data for the first line
  4181.                       -- into line_format
  4182.    --
  4183.    -- we initialize the working, top and bottom lines displayed data
  4184.    --
  4185.             WD.WORK_LINE.LINE_NUMBER := 1; 
  4186.             WD.WORK_LINE.LINE_POINTER := WD.CURRENT_MESSAGE.HEAD; 
  4187.    --
  4188.             EDITOR_TYPES.CURRENT_LINE := - 1; 
  4189.                                     --ensures won't match the first time
  4190.             LINE_TYPE_COUNTER := LINE_DEFINITION_IO.POSITIVE_COUNT 
  4191.                       (WD.WORK_LINE.LINE_POINTER.LINE_TYPE); 
  4192.             
  4193.             LINE_DEFINITION_IO.READ (LINE_STRUCTURE_FILE, LINE_FORMAT, 
  4194.             LINE_TYPE_COUNTER); 
  4195.    --
  4196.             WD.TOP_LINE.LINE_NUMBER := 1; 
  4197.             WD.TOP_LINE.LINE_POINTER := WD.CURRENT_MESSAGE.HEAD; 
  4198.    --
  4199.    -- if screen is filled, then bottom line has line # = # lines in crt
  4200.    -- message area, otherwise bottom line has # = number of lines in
  4201.    -- message
  4202.    --
  4203.             if WD.CURRENT_MESSAGE.NUMBER_OF_LINES >= (BOT_OF_MESSAGE_AREA - 
  4204.                       TOP_OF_MESSAGE_AREA + 1) then 
  4205.                WD.BOTTOM_LINE.LINE_NUMBER := BOT_OF_MESSAGE_AREA - 
  4206.                          TOP_OF_MESSAGE_AREA + 1; 
  4207.             else 
  4208.                WD.BOTTOM_LINE.LINE_NUMBER := 
  4209.                          WD.CURRENT_MESSAGE.NUMBER_OF_LINES; 
  4210.             end if; 
  4211.    --
  4212.    -- we get the pointer to the bottom line displayed the hard way (BFM)
  4213.    --
  4214.             WD.BOTTOM_LINE.LINE_POINTER := WD.CURRENT_MESSAGE.HEAD; 
  4215.    --
  4216.             for I in 1..(WD.CURRENT_MESSAGE.NUMBER_OF_LINES - 1) loop 
  4217.    --
  4218.                WD.BOTTOM_LINE.LINE_POINTER := 
  4219.                          WD.BOTTOM_LINE.LINE_POINTER.NEXT_LINE; 
  4220.    --
  4221.             end loop; 
  4222.    --
  4223.    -- now we display the menu, the message classification, and 
  4224.    -- the message itself.
  4225.    --
  4226.             DISPLAY_MENU ("editmenu"); 
  4227.    --
  4228.             DISPLAY_CLASSIFICATION (WD.CURRENT_MESSAGE.CLASS); 
  4229.    --
  4230.             DISPLAY_MESSAGE; 
  4231.    --
  4232.    -- we initialize to scroll mode and no changes made. we set the
  4233.    --
  4234.             WD.MODE := SCROLL; 
  4235.             WD.CHANGES_MADE_FLAG := FALSE; 
  4236.    --
  4237.    -- now we enter the scroll mode loop.
  4238.    --
  4239.             MAIN : 
  4240.             loop 
  4241.                WD.NEXT_COMMAND := NIL; 
  4242.                READ_NOECHO (CHAR); 
  4243.       --
  4244.                if CHAR (1) = START_OF_FUNCTION_KEY  then
  4245.  
  4246.                      GET_COMMAND (USER_INPUT); 
  4247.                      -- gets user's command
  4248.          --
  4249.                elsif CHAR (1) = ASCII.CR then
  4250.  
  4251.                      USER_INPUT := NEXT_LINE; 
  4252.          --
  4253.          -- handle arrows, etc here
  4254.          --
  4255.                else
  4256.                      USER_INPUT := NIL; 
  4257.          --
  4258.                end if; 
  4259.       --
  4260.               declare
  4261.                  EMBEDDED_COMMAND : exception;
  4262.               begin
  4263.                case USER_INPUT is 
  4264.          --
  4265.                   when CLASSIFY => 
  4266.                      PROCESS_CLASSIFY_MESSAGE_COMMAND; 
  4267.                      TEMP_INTEGER := WD.WORK_LINE.LINE_NUMBER - 
  4268.                                WD.TOP_LINE.LINE_NUMBER + TOP_OF_MESSAGE_AREA; 
  4269.                      GOTO_CRT_POSITION (TEMP_INTEGER, 1); 
  4270.          --
  4271.                   when PREV_LINE | UP_ARROW => 
  4272.                      PROCESS_PREV_LINE_COMMAND; 
  4273.                --
  4274.                   when NEXT_LINE | DOWN_ARROW => 
  4275.                      PROCESS_NEXT_LINE_COMMAND; 
  4276.                      if WD.NEXT_COMMAND /= NIL then
  4277.                         raise EMBEDDED_COMMAND;
  4278.                      end if;
  4279.                --
  4280.          --
  4281.                   when INSERT_LINE => 
  4282.                      PROCESS_INSERT_LINE_COMMAND; 
  4283.                      if WD.NEXT_COMMAND /= NIL then
  4284.                         raise EMBEDDED_COMMAND;
  4285.                      end if;
  4286.                --
  4287.          --
  4288.                   when DELETE_LINE => 
  4289.                      PROCESS_DELETE_LINE_COMMAND; 
  4290.          --
  4291.                   when EDIT_LINE | RIGHT_ARROW => 
  4292.                      if LINE_FORMAT.NUMBER_OF_FIELDS > 0 then 
  4293.             --
  4294.             -- IMPORTANT - line editing is embedded
  4295.             -- in process_edit_line_command.
  4296.             --
  4297.                         PROCESS_EDIT_LINE_COMMAND; 
  4298.  
  4299.                -- If we came back with a command, we must handle it here
  4300.                -- before we continue with the main loop.
  4301.                --
  4302.                         case WD.NEXT_COMMAND is 
  4303.                            when PREV_LINE | UP_ARROW => 
  4304.                               PROCESS_PREV_LINE_COMMAND; 
  4305.                   --
  4306.                            when NEXT_LINE | DOWN_ARROW => 
  4307.                               if WD.NEXT_COMMAND /= NIL then
  4308.                                  raise EMBEDDED_COMMAND;
  4309.                               end if;
  4310.                   --
  4311.                            when END_EDIT => 
  4312.                               exit MAIN; 
  4313.                   --
  4314.                            when others => 
  4315.                               PROMPT ("others in main"); 
  4316.                         end case; 
  4317.                      else 
  4318.                         PROMPT ("Can't edit a line with no fields"); 
  4319.                      end if; 
  4320.          --
  4321.                   when PREV_FIELD | NEXT_FIELD | ERASE_FIELD => 
  4322.                      PROMPT ("this command not available in scroll mode"); 
  4323.          --
  4324.                   when END_EDIT => 
  4325.                      exit MAIN; 
  4326.          --
  4327.                   when others => 
  4328.                      PROMPT ("illegal input, please enter command"); 
  4329.          --
  4330.                end case; 
  4331.               exception
  4332.                  when embedded_command =>
  4333.                --
  4334.                -- If we came back with a command, we must handle it here
  4335.                -- before we continue with the main loop.
  4336.                --
  4337.                         case WD.NEXT_COMMAND is 
  4338.                            when PREV_LINE | UP_ARROW => 
  4339.                               PROCESS_PREV_LINE_COMMAND; 
  4340.                   --
  4341.                            when NEXT_LINE | DOWN_ARROW => 
  4342.                               PROCESS_NEXT_LINE_COMMAND; 
  4343.                   --
  4344.                            when END_EDIT => 
  4345.                               exit MAIN; 
  4346.                   --
  4347.                            when others => 
  4348.                               PROMPT ("others in main"); 
  4349.                         end case; 
  4350.               end;
  4351.             end loop MAIN; 
  4352.                            CLOSE (LINE_STRUCTURE_FILE);
  4353.                            CLOSE (FIELD_PROMPT_FILE);
  4354.                            CLOSE (PROMPT_VECTOR_FILE);
  4355.                            MESSAGE_PASSED := WD.CURRENT_MESSAGE;
  4356.                            VALIDATE_LINE_INSERTION; 
  4357.          end EDITOR; 
  4358.    --
  4359.       end FILED_GENERIC_MESSAGE_EDITOR; 
  4360.       
  4361.    end FILE_GENERIC; 
  4362. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4363. --genmenu.sp
  4364. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4365. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4366. --                                                                    --
  4367. --            Program unit:  PACKAGE GENERAL_MENU_ROUTINES            --
  4368. --            File name :    GENMENU.SP                               --
  4369. --                                                                    --
  4370. --            ===========================================             --
  4371. --                                                                    --
  4372. --                                                                    --
  4373. --            Produced by Veda Incorporated                           --
  4374. --            Version  1.0      April 15, 1985                        --
  4375. --                                                                    --
  4376. --                                                                    --
  4377. --            This program unit is a member of the GMHF. It           --
  4378. --            was developed using TeleSoft's Ada compiler,            --
  4379. --            version 2.1 in a VAX/VMS environment, version           --
  4380. --            3.7                                                     --
  4381. --                                                                    --
  4382. --                                                                    --
  4383. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4384. --
  4385. with TEXT_IO;                 use TEXT_IO; 
  4386. with TERMINAL_DEFINITION;     use TERMINAL_DEFINITION; 
  4387. with FILE_ACCESS;             use FILE_ACCESS; 
  4388. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  4389. --
  4390. --
  4391. package GENERAL_MENU_ROUTINES is 
  4392. --
  4393. -- 
  4394.    type MENU_NAMES is (GMHF, GMHF_1, GMHF_11, GMHF_12, GMHF_2, GMHF_3,  
  4395.                        GMHF_31, NONE ); 
  4396.    --
  4397.    type TYPES_OF_FIELDS is (COMMAND_FIELD, DATA_FIELD, LIST_FIELD ); 
  4398.    --
  4399.    type MENU_FIELD       is record 
  4400.       FIELD_TYPE            : TYPES_OF_FIELDS; 
  4401.       NUMBER_OF_ASSOCIATES  : NATURAL; 
  4402.       POSITION              : CRT_POSITION; 
  4403.    end record; 
  4404.    --
  4405.    type FIELD_ARRAY      is array (INTEGER range <>) of MENU_FIELD; 
  4406.    --
  4407.    LENGTH_OF_DATA_FIELD  : constant INTEGER := 4; 
  4408.    type STRING_VALUE  is array (INTEGER range <>) of STRING 
  4409.              (1..LENGTH_OF_DATA_FIELD); 
  4410.    --
  4411.    DIRECTORY_LINE_NUMBER   : POSITIVE := 6; 
  4412.    CURRENT_TYPE            : DIRECTORY_ENTRY; 
  4413.    --
  4414.    MESSAGE_TYPE_COLUMN     : constant CRT_COLS := 60; 
  4415.    NUMBER_OF_MESSAGES      : constant CRT_COLS := 72; 
  4416.    TYPE_AND_NUMBER_STRING  : STRING (1..16); 
  4417.    --
  4418.    TOP_LINE                : NODE; 
  4419.    BOTTOM_LINE             : NODE; 
  4420.    START_OF_MSG            : NODE; 
  4421.    END_OF_MSG              : NODE; 
  4422.    ---------------------------
  4423.    procedure LOAD_MESSAGE_TYPE (FIELDS            : in FIELD_ARRAY; 
  4424.                                 NUMBER_OF_FIELDS  : in INTEGER; 
  4425.                                 CURRENT_FIELD     : in POSITIVE; 
  4426.                                 MESSAGE_STRING    : in STRING); 
  4427.    ---------------------------
  4428.    -----------------------------
  4429.    procedure GENERAL_MENU_DRIVER (CURRENT_FIELD     : in out POSITIVE; 
  4430.                                   NUMBER_OF_FIELDS  : in INTEGER; 
  4431.                                   FIELDS            : in FIELD_ARRAY; 
  4432.                                   CURRENT_MENU      : in MENU_NAMES; 
  4433.                                   CURRENT_ENTRY     : in out DIRECTORY_ENTRY; 
  4434.                                   VALUE             : in out STRING_VALUE); 
  4435.    -----------------------------
  4436.    --
  4437. end GENERAL_MENU_ROUTINES; 
  4438. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4439. --genmenu.txt
  4440. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4441. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4442. --                                                                    --
  4443. --            Program unit:  PACKAGE GENERAL_MENU_ROUTINES            --
  4444. --            File name :    GENMENU.TXT                              --
  4445. --                                                                    --
  4446. --            ===========================================             --
  4447. --                                                                    --
  4448. --                                                                    --
  4449. --            Produced by Veda Incorporated                           --
  4450. --            Version  1.0      April 15, 1985                        --
  4451. --                                                                    --
  4452. --                                                                    --
  4453. --            This program unit is a member of the GMHF. It           --
  4454. --            was developed using TeleSoft's Ada compiler,            --
  4455. --            version 2.1 in a VAX/VMS environment, version           --
  4456. --            3.7                                                     --
  4457. --                                                                    --
  4458. --                                                                    --
  4459. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4460. --
  4461. with TEXT_IO;                use TEXT_IO; 
  4462. with TERMINAL_DEFINITION;    use TERMINAL_DEFINITION; 
  4463. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  4464. --
  4465. package body GENERAL_MENU_ROUTINES is 
  4466. --
  4467. -- 
  4468.    ---------------------------
  4469.    procedure LOAD_MESSAGE_TYPE (FIELDS            : in FIELD_ARRAY; 
  4470.                                 NUMBER_OF_FIELDS  : in INTEGER; 
  4471.                                 CURRENT_FIELD     : in POSITIVE; 
  4472.                                 MESSAGE_STRING    : in STRING) is 
  4473.    ---------------------------
  4474.    begin 
  4475.    --
  4476.       UNDERSCORE_ON; 
  4477.       for I in 1..NUMBER_OF_FIELDS loop 
  4478.          if FIELDS (I).FIELD_TYPE = LIST_FIELD then 
  4479.             GOTO_CRT_POSITION (FIELDS (I).POSITION); 
  4480.             PUT (MESSAGE_STRING); 
  4481.          end if; 
  4482.       end loop; 
  4483.       --
  4484.       GOTO_CRT_POSITION (FIELDS (CURRENT_FIELD).POSITION); 
  4485.       UNDERSCORE_OFF; 
  4486.    --
  4487.    end LOAD_MESSAGE_TYPE; 
  4488. --
  4489.    -----------------------------
  4490.    procedure GENERAL_MENU_DRIVER (CURRENT_FIELD     : in out POSITIVE; 
  4491.                                   NUMBER_OF_FIELDS  : in INTEGER; 
  4492.                                   FIELDS            : in FIELD_ARRAY; 
  4493.                                   CURRENT_MENU      : in MENU_NAMES; 
  4494.                                   CURRENT_ENTRY     : in out DIRECTORY_ENTRY; 
  4495.                                   VALUE             : in out STRING_VALUE) is 
  4496.    -----------------------------
  4497.    --
  4498.       CURRENT_POSITION   : INTEGER; 
  4499.       ONE_CHARACTER      : STRING (1..1); 
  4500.       THE_FUNCTION_KEY   : FUNCTION_KEY; 
  4501.       SYSTEM_DRIVER_KEY  : SYSTEM_DRIVER_KEYS; 
  4502.       --
  4503.       -- some internal routines to follow
  4504.       --
  4505.       -----------------
  4506.       procedure TAB (CURRENT_FIELD     : in out POSITIVE; 
  4507.                      NUMBER_OF_FIELDS  : in INTEGER; 
  4508.                      FIELDS            : in FIELD_ARRAY) is 
  4509.       -----------------
  4510.       --
  4511.       -- the key hit is the tab key
  4512.       --
  4513.       begin 
  4514.          if CURRENT_FIELD = NUMBER_OF_FIELDS then 
  4515.             CURRENT_FIELD := 1; 
  4516.          else 
  4517.             CURRENT_FIELD := CURRENT_FIELD + 1; 
  4518.          end if; 
  4519.          GOTO_CRT_POSITION (FIELDS (CURRENT_FIELD).POSITION); 
  4520.          --
  4521.       --
  4522.       end TAB; 
  4523.       --
  4524.       --
  4525.       ------------------
  4526.       procedure BACK_TAB (CURRENT_FIELD     : in out POSITIVE; 
  4527.                           NUMBER_OF_FIELDS  : in INTEGER; 
  4528.                           FIELDS            : in FIELD_ARRAY) is 
  4529.       ------------------
  4530.       --
  4531.       -- the key hit is the back tab key
  4532.       --
  4533.       begin 
  4534.          if CURRENT_FIELD = 1 then 
  4535.             CURRENT_FIELD := NUMBER_OF_FIELDS; 
  4536.          else 
  4537.             CURRENT_FIELD := CURRENT_FIELD - 1; 
  4538.          end if; 
  4539.          GOTO_CRT_POSITION (FIELDS (CURRENT_FIELD).POSITION); 
  4540.          --
  4541.       --
  4542.       end BACK_TAB; 
  4543.       --
  4544.       --
  4545.       --------------------------
  4546.       procedure SCROLL_DIRECTORY (DIRECTION  : in UP_OR_DOWN; 
  4547.                                   ELEMENT    : in out DIRECTORY_ENTRY) is 
  4548.       --------------------------
  4549.       --
  4550.          THIS_ENTRY  : DIRECTORY_ENTRY; 
  4551.       --
  4552.          procedure SCROLL_UP (CURRENT_ENTRY  : in DIRECTORY_ENTRY) is 
  4553.          --
  4554.          begin 
  4555.          --
  4556.             THIS_ENTRY := CURRENT_ENTRY; 
  4557.             for I in reverse 6..20 loop 
  4558.                GOTO_CRT_POSITION (CRT_ROWS (I), MESSAGE_TYPE_COLUMN); 
  4559.                TYPE_AND_NUMBER_STRING := THIS_ENTRY.TYPE_STRING & 
  4560.                          THIS_ENTRY.NUMBER_STRING; 
  4561.                PUT (TYPE_AND_NUMBER_STRING); 
  4562.                THIS_ENTRY := THIS_ENTRY.PREVIOUS_MESSAGE_TYPE; 
  4563.             end loop; 
  4564.          --
  4565.          end SCROLL_UP; 
  4566.          --
  4567.          --
  4568.          procedure SCROLL_DOWN (CURRENT_ENTRY  : in DIRECTORY_ENTRY) is 
  4569.          --
  4570.          begin 
  4571.          --
  4572.             THIS_ENTRY := CURRENT_ENTRY; 
  4573.             for I in 6..20 loop 
  4574.                GOTO_CRT_POSITION (CRT_ROWS (I), MESSAGE_TYPE_COLUMN); 
  4575.                TYPE_AND_NUMBER_STRING := THIS_ENTRY.TYPE_STRING & 
  4576.                          THIS_ENTRY.NUMBER_STRING; 
  4577.                PUT (TYPE_AND_NUMBER_STRING); 
  4578.                THIS_ENTRY := THIS_ENTRY.NEXT_MESSAGE_TYPE; 
  4579.             end loop; 
  4580.          --
  4581.          end SCROLL_DOWN; 
  4582.          --
  4583.          --
  4584.       begin 
  4585.       --
  4586.       -- do the boundary checks first
  4587.       --
  4588.          if (DIRECTION = DOWN and ELEMENT.PREVIOUS_MESSAGE_TYPE = null) or 
  4589.                    (DIRECTION = UP and ELEMENT.NEXT_MESSAGE_TYPE = null) then 
  4590.             --
  4591.             RING_BELL; 
  4592.             --
  4593.          else 
  4594.             --
  4595.             -- first un-highlight the current entry
  4596.             --
  4597.             GOTO_CRT_POSITION (DIRECTORY_LINE_NUMBER, 
  4598.             MESSAGE_TYPE_COLUMN); 
  4599.             TYPE_AND_NUMBER_STRING := ELEMENT.TYPE_STRING & 
  4600.                       ELEMENT.NUMBER_STRING; 
  4601.             PUT (TYPE_AND_NUMBER_STRING); 
  4602.             --
  4603.             -- now adjust pointer based on direction
  4604.             --
  4605.             if DIRECTION = DOWN then 
  4606.                ELEMENT := ELEMENT.PREVIOUS_MESSAGE_TYPE; 
  4607.                DIRECTORY_LINE_NUMBER := DIRECTORY_LINE_NUMBER - 1; 
  4608.             --
  4609.             else -- up
  4610.             --
  4611.                ELEMENT := ELEMENT.NEXT_MESSAGE_TYPE; 
  4612.                DIRECTORY_LINE_NUMBER := DIRECTORY_LINE_NUMBER + 1; 
  4613.             --
  4614.             end if; 
  4615.             --
  4616.             -- check for scrolling
  4617.             --
  4618.             if DIRECTORY_LINE_NUMBER > 20 then 
  4619.                SCROLL_UP (ELEMENT); 
  4620.                DIRECTORY_LINE_NUMBER := 20; 
  4621.             elsif DIRECTORY_LINE_NUMBER < 6 then 
  4622.                SCROLL_DOWN (ELEMENT); 
  4623.                DIRECTORY_LINE_NUMBER := 6; 
  4624.             end if; 
  4625.             --
  4626.             -- highlight the new entry
  4627.             --
  4628.             GOTO_CRT_POSITION (DIRECTORY_LINE_NUMBER, 
  4629.             MESSAGE_TYPE_COLUMN); 
  4630.             REVERSE_VIDEO_ON; 
  4631.             TYPE_AND_NUMBER_STRING := ELEMENT.TYPE_STRING & 
  4632.                       ELEMENT.NUMBER_STRING; 
  4633.             PUT (TYPE_AND_NUMBER_STRING); 
  4634.             REVERSE_VIDEO_OFF; 
  4635.             --
  4636.             -- return cursor to current field
  4637.             --
  4638.             GOTO_CRT_POSITION (FIELDS (CURRENT_FIELD).POSITION); 
  4639.             --
  4640.          end if; 
  4641.       --
  4642.       end SCROLL_DIRECTORY; 
  4643.       --
  4644.       --
  4645.       ------------------------
  4646.       procedure SCROLL_MESSAGE (DIRECTION  : UP_OR_DOWN) is 
  4647.       ------------------------
  4648.          procedure SCROLL_UP is 
  4649.          begin 
  4650.             if BOTTOM_LINE = END_OF_MSG then 
  4651.                PROMPT ("Bottom of message reached"); 
  4652.             else 
  4653.                SAVE_CURSOR_POSITION; 
  4654.                UNDERSCORE_OFF; 
  4655.                SCROLL_SCREEN (5, 18, UP); 
  4656.                BOTTOM_LINE := BOTTOM_LINE.NEXT_LINE; 
  4657.                TOP_LINE := TOP_LINE.NEXT_LINE; 
  4658.                GOTO_CRT_POSITION (18, 1); 
  4659.                PUT (BOTTOM_LINE.TEXT_LINE); 
  4660.                RESTORE_CURSOR_POSITION; 
  4661.             end if; 
  4662.          end SCROLL_UP; 
  4663.          -------------
  4664.          -------------
  4665.          procedure SCROLL_DOWN is 
  4666.          begin 
  4667.             if TOP_LINE = START_OF_MSG then 
  4668.                PROMPT ("Top of message reached"); 
  4669.             else 
  4670.                SAVE_CURSOR_POSITION; 
  4671.                UNDERSCORE_OFF; 
  4672.                SCROLL_SCREEN (5, 18, DOWN); 
  4673.                BOTTOM_LINE := BOTTOM_LINE.PREV_LINE; 
  4674.                TOP_LINE := TOP_LINE.PREV_LINE; 
  4675.                GOTO_CRT_POSITION (5, 1); 
  4676.                PUT (TOP_LINE.TEXT_LINE); 
  4677.                RESTORE_CURSOR_POSITION; 
  4678.             end if; 
  4679.          end SCROLL_DOWN; 
  4680.       --
  4681.       -- driver to call proper scrolling routine
  4682.       --
  4683.       begin 
  4684.          case DIRECTION is 
  4685.             when UP => 
  4686.                SCROLL_UP; 
  4687.             when DOWN => 
  4688.                SCROLL_DOWN; 
  4689.          end case; 
  4690.       end SCROLL_MESSAGE; 
  4691.       --
  4692.    --
  4693.    -- here starts the main part of the rouitne
  4694.    --
  4695.    begin 
  4696.       --
  4697.       GOTO_CRT_POSITION (FIELDS (CURRENT_FIELD).POSITION); 
  4698.       --
  4699.       loop 
  4700.          --
  4701.          -- read one character and if its an escape then
  4702.          -- read two more because its probably a function key
  4703.          -- if its not an escape then its a normal character
  4704.          -- probably so process it if its legal for the current field
  4705.          --
  4706.          -- get one character
  4707.          --
  4708.          READ_NOECHO (ONE_CHARACTER); 
  4709.          --
  4710.          if ONE_CHARACTER (1) = ASCII.ESC then 
  4711.             --
  4712.             -- get two more characters to determine the function key
  4713.             --
  4714.             READ_NOECHO (THE_FUNCTION_KEY); 
  4715.             --
  4716.             if THE_FUNCTION_KEY = SYSTEM_DRIVER_KEY.TAB then 
  4717.                --
  4718.                -- the key hit is the tab key
  4719.                --
  4720.                TAB (CURRENT_FIELD, NUMBER_OF_FIELDS, 
  4721.                FIELDS (1..NUMBER_OF_FIELDS)); 
  4722.                CURRENT_POSITION := 1; 
  4723.                --
  4724.             elsif THE_FUNCTION_KEY = SYSTEM_DRIVER_KEY.BACK_TAB then 
  4725.                --
  4726.                -- the key hit is the back tab key
  4727.                --
  4728.                BACK_TAB (CURRENT_FIELD, NUMBER_OF_FIELDS, 
  4729.                FIELDS (1..NUMBER_OF_FIELDS)); 
  4730.                CURRENT_POSITION := 1; 
  4731.                --
  4732.             elsif THE_FUNCTION_KEY = SYSTEM_DRIVER_KEY.ARROW_UP then 
  4733.                --
  4734.                -- the key hit is arrow_up
  4735.                --
  4736.                if CURRENT_MENU = GMHF_31 then 
  4737.                   SCROLL_MESSAGE (DOWN); 
  4738.                else 
  4739.                   --
  4740.                   -- all other menus have a directory displayed which
  4741.                   -- may be scrolled.
  4742.                   --
  4743.                   if FIELDS (CURRENT_FIELD).FIELD_TYPE = LIST_FIELD then 
  4744.                      --
  4745.                      SCROLL_DIRECTORY (DOWN, CURRENT_ENTRY); 
  4746.                      LOAD_MESSAGE_TYPE (FIELDS, NUMBER_OF_FIELDS, 
  4747.                      CURRENT_FIELD, 
  4748.                      CURRENT_ENTRY.TYPE_STRING); 
  4749.                   else 
  4750.                      --
  4751.                      -- not a legal key at this field
  4752.                      --
  4753.                      RING_BELL; 
  4754.                      --
  4755.                   end if; 
  4756.                   --
  4757.                end if; 
  4758.                --
  4759.             elsif THE_FUNCTION_KEY = SYSTEM_DRIVER_KEY.ARROW_DOWN then 
  4760.                --
  4761.                -- the key hit is arrow_down
  4762.                --
  4763.                if CURRENT_MENU = GMHF_31 then 
  4764.                   SCROLL_MESSAGE (UP); 
  4765.                else 
  4766.                   --
  4767.                   -- all other menus have a directory displayed which
  4768.                   -- may be scrolled.
  4769.                   --
  4770.                   if FIELDS (CURRENT_FIELD).FIELD_TYPE = LIST_FIELD then 
  4771.                      --
  4772.                      SCROLL_DIRECTORY (UP, CURRENT_ENTRY); 
  4773.                      LOAD_MESSAGE_TYPE (FIELDS, NUMBER_OF_FIELDS, 
  4774.                      CURRENT_FIELD, 
  4775.                      CURRENT_ENTRY.TYPE_STRING); 
  4776.                   else 
  4777.                      --
  4778.                      -- not a legal key at this field
  4779.                      --
  4780.                      RING_BELL; 
  4781.                   end if; 
  4782.                   --
  4783.                end if; 
  4784.                --
  4785.             elsif THE_FUNCTION_KEY = SYSTEM_DRIVER_KEY.COMMAND then 
  4786.                --
  4787.                -- the key hit is the command key
  4788.                -- so evaluate it
  4789.                --
  4790.                if FIELDS (CURRENT_FIELD).FIELD_TYPE = COMMAND_FIELD then 
  4791.                   exit; 
  4792.                else 
  4793.                   RING_BELL; -- not legal on non command type field
  4794.                end if; 
  4795.                --
  4796.             else 
  4797.                --
  4798.                -- if none of the above it was an illegal entry
  4799.                --
  4800.                RING_BELL; 
  4801.             end if; 
  4802.             --
  4803.          else 
  4804.             --
  4805.             -- process of elimination leaves us with just a single
  4806.             -- character being received from the key board so if its
  4807.             -- legal then process it
  4808.             --
  4809.             if FIELDS (CURRENT_FIELD).FIELD_TYPE = DATA_FIELD then 
  4810.                if ONE_CHARACTER (1) = ' ' or (ONE_CHARACTER (1) >= '0' and 
  4811.                          ONE_CHARACTER (1) <= '9') then 
  4812.                   --
  4813.                   VALUE (CURRENT_FIELD) (CURRENT_POSITION) := ONE_CHARACTER 
  4814.                             (1); 
  4815.                   UNDERSCORE_ON; 
  4816.                   PUT (ONE_CHARACTER (1));   -- echos the char to the screen
  4817.                   UNDERSCORE_OFF; 
  4818.                   --
  4819.                   if CURRENT_POSITION >= LENGTH_OF_DATA_FIELD then 
  4820.                      --
  4821.                      -- field is full to its max so move to next field
  4822.                      --
  4823.                      TAB (CURRENT_FIELD, NUMBER_OF_FIELDS, 
  4824.                      FIELDS (1..NUMBER_OF_FIELDS)); 
  4825.                      CURRENT_POSITION := 1; 
  4826.                   else 
  4827.                      --
  4828.                      -- just increment the current position on the field
  4829.                      --
  4830.                      CURRENT_POSITION := CURRENT_POSITION + 1; 
  4831.                   end if; 
  4832.                --
  4833.                else 
  4834.                   -- illegal entry for numeric data field
  4835.                   RING_BELL; 
  4836.                end if; 
  4837.             --
  4838.             else 
  4839.                -- cant type a character on a non data field
  4840.                RING_BELL; 
  4841.             end if; 
  4842.          --
  4843.          end if; 
  4844.          --
  4845.       --
  4846.       end loop; 
  4847.       --
  4848.    --
  4849.    end GENERAL_MENU_DRIVER; 
  4850. --
  4851. end GENERAL_MENU_ROUTINES; 
  4852. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4853. --calledit.sp
  4854. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4855. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4856. --                                                                    --
  4857. --            Program unit:  PACKAGE CALL_EDITOR                      --
  4858. --            File name :    CALLEDIT.SP                              --
  4859. --                                                                    --
  4860. --            ===========================================             --
  4861. --                                                                    --
  4862. --                                                                    --
  4863. --            Produced by Veda Incorporated                           --
  4864. --            Version  1.0      April 15, 1985                        --
  4865. --                                                                    --
  4866. --                                                                    --
  4867. --            This program unit is a member of the GMHF. It           --
  4868. --            was developed using TeleSoft's Ada compiler,            --
  4869. --            version 2.1 in a VAX/VMS environment, version           --
  4870. --            3.7                                                     --
  4871. --                                                                    --
  4872. --                                                                    --
  4873. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4874. --
  4875. with file_access;              use file_access;
  4876. with linked_list_procedures;   use linked_list_procedures;
  4877. --
  4878. package call_editor is
  4879.    --
  4880.    -- only one procedure within this package
  4881.    --
  4882.    procedure call_the_editor(message_pointer : in out message;
  4883.                              directory_info  : in out directory_entry;
  4884.                              message_number  : in out natural);
  4885.    --
  4886. end call_editor;
  4887. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4888. --calledit.txt
  4889. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4890. --
  4891. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4892. --                                                                    --
  4893. --            Program unit:  PACKAGE CALL_EDITOR                      --
  4894. --            File name :    CALLEDIT.TXT                             --
  4895. --                                                                    --
  4896. --            ===========================================             --
  4897. --                                                                    --
  4898. --                                                                    --
  4899. --            Produced by Veda Incorporated                           --
  4900. --            Version  1.0      April 15, 1985                        --
  4901. --                                                                    --
  4902. --                                                                    --
  4903. --            This program unit is a member of the GMHF. It           --
  4904. --            was developed using TeleSoft's Ada compiler,            --
  4905. --            version 2.1 in a VAX/VMS environment, version           --
  4906. --            3.7                                                     --
  4907. --                                                                    --
  4908. --                                                                    --
  4909. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4910. with UR_EDITOR;  use UR_EDITOR; 
  4911. with RF_EDITOR;  use RF_EDITOR; 
  4912. with TYPE_LIST;  use TYPE_LIST; 
  4913. --
  4914.   package body CALL_EDITOR is 
  4915.    --
  4916.    -- only one procedure within this package
  4917.    --
  4918.    procedure CALL_THE_EDITOR (MESSAGE_POINTER  : in out MESSAGE; 
  4919.                               DIRECTORY_INFO   : in out DIRECTORY_ENTRY; 
  4920.                               MESSAGE_NUMBER   : in out NATURAL) is 
  4921.    begin 
  4922.       case DIRECTORY_INFO.MESSAGE_TYPE is 
  4923.          when RAINFORM =>
  4924.             RAINFORM_ED.EDITOR (MESSAGE_POINTER); 
  4925.          when UNITREP  => 
  4926.             UNITREP_ED.EDITOR (MESSAGE_POINTER); 
  4927.         end case; 
  4928.    end CALL_THE_EDITOR; 
  4929.    --
  4930. end CALL_EDITOR; 
  4931. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4932. --sdp.sp
  4933. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4934. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4935. --                                                                    --
  4936. --            Program unit:  PACKAGE SYSTEM_DRIVER                    --
  4937. --            File name :    SDP.SP                                   --
  4938. --                                                                    --
  4939. --            ===========================================             --
  4940. --                                                                    --
  4941. --                                                                    --
  4942. --            Produced by Veda Incorporated                           --
  4943. --            Version  1.0      April 15, 1985                        --
  4944. --                                                                    --
  4945. --                                                                    --
  4946. --            This program unit is a member of the GMHF. It           --
  4947. --            was developed using TeleSoft's Ada compiler,            --
  4948. --            version 2.1 in a VAX/VMS environment, version           --
  4949. --            3.7                                                     --
  4950. --                                                                    --
  4951. --                                                                    --
  4952. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4953. --
  4954. with GENERAL_MENU_ROUTINES;  use GENERAL_MENU_ROUTINES; 
  4955. --
  4956. package SYSTEM_DRIVER is 
  4957. --
  4958. --this package provides the routines necessary to run
  4959. --gmhf as a stand_alone or embedded system. the routines are
  4960. --generally decission makers which determine what actions
  4961. --are to be taken based on user inputs through the mmi menus.
  4962. --each routine of this package corresponds to one and only
  4963. --one menu of the system.
  4964. --p.s.   there is no routine for the edit menu since it is
  4965. --       included in the edit_function package of gmhf.
  4966. --
  4967.    --
  4968.    --
  4969.    procedure MAIN_MENU_HANDLER (MENU  : in out MENU_NAMES); 
  4970.    --
  4971.    procedure MESSAGE_EDIT_DIRECTORY_MENU_HANDLER (MENU  : in out MENU_NAMES); 
  4972.    --
  4973.    procedure MESSAGE_PRINT_DIRECTORY_MENU_HANDLER (MENU  : in out MENU_NAMES); 
  4974.    --
  4975.    procedure PROCESS_EDITED_MESSAGE_MENU_HANDLER (MENU  : in out MENU_NAMES); 
  4976.    --
  4977.    procedure MESSAGE_DELETE_DIRECTORY_MENU_HANDLER (MENU  : in out 
  4978.              MENU_NAMES); 
  4979.    --
  4980.    procedure REVIEW_FOR_DELETION_MENU_HANDLER (MENU  : in out MENU_NAMES); 
  4981. --
  4982. end SYSTEM_DRIVER; 
  4983. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4984. --sdp.txt
  4985. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4986. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  4987. --                                                                    --
  4988. --            Program unit:  PACKAGE SYSTEM_DRIVER                    --
  4989. --            File name :    SDP.TXT                                  --
  4990. --                                                                    --
  4991. --            ===========================================             --
  4992. --                                                                    --
  4993. --                                                                    --
  4994. --            Produced by Veda Incorporated                           --
  4995. --            Version  1.0      April 15, 1985                        --
  4996. --                                                                    --
  4997. --                                                                    --
  4998. --            This program unit is a member of the GMHF. It           --
  4999. --            was developed using TeleSoft's Ada compiler,            --
  5000. --            version 2.1 in a VAX/VMS environment, version           --
  5001. --            3.7                                                     --
  5002. --                                                                    --
  5003. --                                                                    --
  5004. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  5005. --
  5006. with TEXT_IO;                    use TEXT_IO; 
  5007. with TERMINAL_DEFINITION;        use TERMINAL_DEFINITION; 
  5008. with MAN_MACHINE_INTERFACE;      use MAN_MACHINE_INTERFACE; 
  5009. with FILE_ACCESS;                use FILE_ACCESS; 
  5010. with PRINT_PROCEDURES;           use PRINT_PROCEDURES; 
  5011. with LINKED_LIST_PROCEDURES;     use LINKED_LIST_PROCEDURES; 
  5012. with TYPE_LIST;                  use TYPE_LIST; 
  5013. with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  5014. with CALL_EDITOR;                use CALL_EDITOR; 
  5015. --
  5016. --
  5017. package body SYSTEM_DRIVER is 
  5018. --
  5019. -- this package provides the routines necessary to run
  5020. -- gmhf as a stand_alone or embedded system. the routines are
  5021. -- generally decision makers which determine what actions
  5022. -- are to be taken based on user inputs through the mmi menus.
  5023. -- each routine of this package corresponds to one and only
  5024. -- one menu of the system.
  5025. -- p.s.   there is no routine for the edit menu since it is
  5026. --        included in the edit_function package of gmhf.
  5027. --
  5028. -- 
  5029.    package NATURAL_IO is new INTEGER_IO (NATURAL); 
  5030.    use NATURAL_IO; 
  5031.    --
  5032.    --
  5033.    LAST                   : POSITIVE; 
  5034.    SUFFICIENT_DATA        : BOOLEAN; 
  5035.    --
  5036.    ACTIVE_MESSAGE         : MESSAGE; 
  5037.    ACTIVE_MESSAGE_NUMBER  : NATURAL; 
  5038.    ACTIVE_MESSAGE_TYPE    : DIRECTORY_ENTRY; 
  5039.    --
  5040.    --
  5041.    -----------------------------------
  5042.    procedure DISPLAY_MESSAGE_DIRECTORY (DIRECTORY  : in out DIRECTORY_ENTRY) 
  5043.              is 
  5044.    -----------------------------------
  5045.    --
  5046.       DIRECTORY_POINTER      : DIRECTORY_ENTRY; 
  5047.       DIRECTORY_DISPLAY_ROW  : CRT_ROWS := 6; 
  5048.    --
  5049.    begin 
  5050.       --
  5051.       -- first get the top of the directory
  5052.       --
  5053.       GET_DIRECTORY (DIRECTORY); 
  5054.       --
  5055.       -- now go through and display elements
  5056.       --
  5057.       DIRECTORY_POINTER := DIRECTORY; 
  5058.       while DIRECTORY_POINTER /= null loop 
  5059.         --
  5060.         -- set pointer to the current type
  5061.         --
  5062.          if DIRECTORY_DISPLAY_ROW = CRT_ROWS (DIRECTORY_LINE_NUMBER) then 
  5063.             DIRECTORY := DIRECTORY_POINTER; 
  5064.          end if; 
  5065.         --
  5066.          GOTO_CRT_POSITION (DIRECTORY_DISPLAY_ROW, MESSAGE_TYPE_COLUMN); 
  5067.          TYPE_AND_NUMBER_STRING := DIRECTORY_POINTER.TYPE_STRING & 
  5068.                    DIRECTORY_POINTER.NUMBER_STRING; 
  5069.          PUT (TYPE_AND_NUMBER_STRING); 
  5070.         --
  5071.          DIRECTORY_DISPLAY_ROW := DIRECTORY_DISPLAY_ROW + 1; 
  5072.          DIRECTORY_POINTER := DIRECTORY_POINTER.NEXT_MESSAGE_TYPE; 
  5073.         --
  5074.         -- boundary check
  5075.         --
  5076.          exit when DIRECTORY_DISPLAY_ROW > 20; 
  5077.         --
  5078.       end loop; 
  5079.    --
  5080.       GOTO_CRT_POSITION (DIRECTORY_LINE_NUMBER, MESSAGE_TYPE_COLUMN); 
  5081.       TYPE_AND_NUMBER_STRING := DIRECTORY.TYPE_STRING & 
  5082.                 DIRECTORY.NUMBER_STRING; 
  5083.       REVERSE_VIDEO_ON; 
  5084.       PUT (TYPE_AND_NUMBER_STRING); 
  5085.       REVERSE_VIDEO_OFF; 
  5086.    --
  5087.    end DISPLAY_MESSAGE_DIRECTORY; 
  5088.    --
  5089. --
  5090. -----------------------------------------------------------------------
  5091. --             here starts the routines for each menu
  5092. -----------------------------------------------------------------------
  5093.    ---------------------------
  5094.    procedure MAIN_MENU_HANDLER (MENU  : in out MENU_NAMES) is 
  5095.    ---------------------------
  5096.    --
  5097.    -- this routine handles the tabing, commanding etc. of the
  5098.    -- main menu.
  5099.    --
  5100.       NUMBER_OF_FIELDS  : constant INTEGER := 4; 
  5101.       VALUES_GOTTEN     : STRING_VALUE (1..NUMBER_OF_FIELDS); 
  5102.       CURRENT_FIELD     : POSITIVE := 1; 
  5103.       FIELDS            : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5104.                 (COMMAND_FIELD, 0, (ROW => 7, COLUMN => 6)), 2 => 
  5105.                 (COMMAND_FIELD, 0, (ROW => 12, COLUMN => 6)), 3 => 
  5106.                 (COMMAND_FIELD, 0, (ROW => 17, COLUMN => 6)), 4 => 
  5107.                 (COMMAND_FIELD, 0, (ROW => 24, COLUMN => 6))); 
  5108.    begin 
  5109.       loop 
  5110.          --
  5111.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5112.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5113.          --
  5114.          if CURRENT_FIELD = 1 then 
  5115.             MENU := GMHF_1; 
  5116.          elsif CURRENT_FIELD = 2 then 
  5117.             MENU := GMHF_2; 
  5118.          elsif CURRENT_FIELD = 3 then 
  5119.             MENU := GMHF_3; 
  5120.          elsif CURRENT_FIELD = 4 then 
  5121.             MENU := NONE; 
  5122.          end if; 
  5123.          -- now exit menu handler
  5124.          exit; 
  5125.       --
  5126.       end loop; 
  5127.       --
  5128.    --
  5129.    end MAIN_MENU_HANDLER; 
  5130. --
  5131. --
  5132.    ---------------------------------------------
  5133.    procedure MESSAGE_EDIT_DIRECTORY_MENU_HANDLER (MENU  : in out MENU_NAMES) 
  5134.              is 
  5135.    ---------------------------------------------
  5136.    --
  5137.    -- this routine handles the tabing, commanding etc. of the
  5138.    -- edit directory menu.
  5139.    --
  5140.       MESSAGE_NUMBER    : NATURAL; 
  5141.       MESSAGE_POINTER   : MESSAGE; 
  5142.       NUMBER_OF_FIELDS  : constant INTEGER := 9; 
  5143.       VALUES_GOTTEN     : STRING_VALUE (1..NUMBER_OF_FIELDS)
  5144.                           := (others => "    "); 
  5145.       CURRENT_FIELD     : POSITIVE := 1; 
  5146.       FIELDS            : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5147.                 (COMMAND_FIELD, 1, (ROW => 5, COLUMN => 6)), 2 => (DATA_FIELD, 
  5148.                 0, (ROW => 5, COLUMN => 23)), 3 => (LIST_FIELD, 0, (ROW => 5, 
  5149.                 COLUMN => 40)), 4 => (COMMAND_FIELD, 0, (ROW => 9, COLUMN => 
  5150.                 6)), 5 => (LIST_FIELD, 0, (ROW => 9, COLUMN => 40)), 6 => 
  5151.                 (COMMAND_FIELD, 0, (ROW => 13, COLUMN => 6)), 7 => 
  5152.                 (LIST_FIELD, 0, (ROW => 13, COLUMN => 44)), 8 => 
  5153.                 (COMMAND_FIELD, 0, (ROW => 19, COLUMN => 6)), 9 => 
  5154.                 (COMMAND_FIELD, 0, (ROW => 24, COLUMN => 6))); 
  5155.    begin 
  5156.       DISPLAY_MESSAGE_DIRECTORY (CURRENT_TYPE); 
  5157.       LOAD_MESSAGE_TYPE (FIELDS, NUMBER_OF_FIELDS, CURRENT_FIELD, 
  5158.                 CURRENT_TYPE.TYPE_STRING); 
  5159.       --
  5160.       loop 
  5161.          SUFFICIENT_DATA := TRUE; 
  5162.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5163.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5164.          --
  5165.          for I in 1..FIELDS (CURRENT_FIELD).NUMBER_OF_ASSOCIATES loop 
  5166.             if VALUES_GOTTEN (CURRENT_FIELD + I) = "    " then 
  5167.                SUFFICIENT_DATA := FALSE; 
  5168.                PROMPT ("insufficient data for command"); 
  5169.                CURRENT_FIELD := CURRENT_FIELD + I; 
  5170.                exit; -- exits loop
  5171.             end if; 
  5172.          end loop; 
  5173.          --
  5174.          if SUFFICIENT_DATA then 
  5175.          -- HERE THE USER WANTS TO EDIT AN EXISTING MESSAGE
  5176.             if CURRENT_FIELD = 1 then 
  5177.                GET (VALUES_GOTTEN (2), MESSAGE_NUMBER, LAST); 
  5178.                -- converts string to integer
  5179.                if MESSAGE_NUMBER > 0 and MESSAGE_NUMBER <= 
  5180.                          CURRENT_TYPE.NUMBER_OF_MESSAGES then 
  5181.                   GET_MESSAGE_OUT (CURRENT_TYPE, MESSAGE_NUMBER, 
  5182.                             MESSAGE_POINTER); 
  5183.                   --
  5184.                   -- retain the values of the edited message
  5185.                   --
  5186.                   ACTIVE_MESSAGE := MESSAGE_POINTER; 
  5187.                   ACTIVE_MESSAGE_TYPE := CURRENT_TYPE; 
  5188.                   ACTIVE_MESSAGE_NUMBER := MESSAGE_NUMBER; 
  5189.                   --
  5190.                   -- call routine which decides which editor to activate
  5191.                   --
  5192.                   CALL_THE_EDITOR (ACTIVE_MESSAGE, ACTIVE_MESSAGE_TYPE, 
  5193.                             ACTIVE_MESSAGE_NUMBER); 
  5194.                   --
  5195.                   MENU := GMHF_12; -- process edited message menu
  5196.                   exit; 
  5197.                else 
  5198.                   PROMPT (" message number out of range "); 
  5199.                   CURRENT_FIELD := 2; 
  5200.                   -- now go back into general_menu_driver 
  5201.                end if; 
  5202.                --
  5203.             elsif CURRENT_FIELD = 4 then 
  5204.                -- here the user wants to edit a new message
  5205.                MESSAGE_NUMBER := CURRENT_TYPE.NUMBER_OF_MESSAGES + 1; 
  5206.                GET_MESSAGE_OUT (CURRENT_TYPE, MESSAGE_NUMBER, 
  5207.                          MESSAGE_POINTER); 
  5208.                --
  5209.                -- retain the values of the edited message
  5210.                --
  5211.                ACTIVE_MESSAGE := MESSAGE_POINTER; 
  5212.                ACTIVE_MESSAGE_TYPE := CURRENT_TYPE; 
  5213.                ACTIVE_MESSAGE_NUMBER := MESSAGE_NUMBER; 
  5214.                --
  5215.                -- call routine which decides which editor to activate
  5216.                --
  5217.                CALL_THE_EDITOR (ACTIVE_MESSAGE, ACTIVE_MESSAGE_TYPE, 
  5218.                          ACTIVE_MESSAGE_NUMBER); 
  5219.                --
  5220.                --
  5221.                MENU := GMHF_12; 
  5222.                exit; 
  5223.                --
  5224.             elsif CURRENT_FIELD = 6 then 
  5225.                -- here the user wants to edit the prototype message
  5226.                MESSAGE_NUMBER := 0; 
  5227.                GET_MESSAGE_OUT (CURRENT_TYPE, MESSAGE_NUMBER, 
  5228.                          MESSAGE_POINTER); 
  5229.                --
  5230.                -- call routine which decides which editor to activate
  5231.                --
  5232.                CALL_THE_EDITOR (MESSAGE_POINTER, CURRENT_TYPE, 
  5233.                          MESSAGE_NUMBER); 
  5234.                --
  5235.                -- and save the message automatically
  5236.                --
  5237.                PUT_OLD_MESSAGE_BACK_IN (CURRENT_TYPE, MESSAGE_NUMBER, 
  5238.                          MESSAGE_POINTER); 
  5239.                PROMPT ("prototype message modified"); 
  5240.                MENU := GMHF_1; 
  5241.                exit; 
  5242.                --
  5243.             elsif CURRENT_FIELD = 8 then 
  5244.                -- here the user just wants to print the directory
  5245.                PRINT_MESSAGE_DIRECTORY; 
  5246.             elsif CURRENT_FIELD = 9 then 
  5247.                -- user elects to return to the main menu
  5248.                MENU := GMHF; 
  5249.                exit; 
  5250.             end if; 
  5251.             --
  5252.          else 
  5253.             -- there was insufficient data to process command 
  5254.             -- so return to the general_menu_driver
  5255.             null; 
  5256.          end if; 
  5257.          --
  5258.       end loop; 
  5259.       --
  5260.    end MESSAGE_EDIT_DIRECTORY_MENU_HANDLER; 
  5261. --
  5262. --
  5263.    ----------------------------------------------
  5264.    procedure MESSAGE_PRINT_DIRECTORY_MENU_HANDLER (MENU  : in out MENU_NAMES) 
  5265.              is 
  5266.    ----------------------------------------------
  5267.    --
  5268.    -- this routine handles the tabing, commanding etc. of the
  5269.    -- print directory menu.
  5270.    --
  5271.       MESSAGE_NUMBER        : NATURAL; 
  5272.       FIRST_MESSAGE_NUMBER  : NATURAL; 
  5273.       LAST_MESSAGE_NUMBER   : NATURAL; 
  5274.       NUMBER_OF_FIELDS      : constant INTEGER := 11; 
  5275.       VALUES_GOTTEN         : STRING_VALUE (1..NUMBER_OF_FIELDS)
  5276.                               := (others => "    "); 
  5277.       CURRENT_FIELD         : POSITIVE := 1; 
  5278.       FIELDS                : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5279.                 (COMMAND_FIELD, 1, (ROW => 5, COLUMN => 6)), 2 => (DATA_FIELD, 
  5280.                 0, (ROW => 5, COLUMN => 24)), 3 => (LIST_FIELD, 0, (ROW => 5, 
  5281.                 COLUMN => 41)), 4 => (COMMAND_FIELD, 2, (ROW => 9, COLUMN => 
  5282.                 6)), 5 => (DATA_FIELD, 0, (ROW => 9, COLUMN => 24)), 6 => 
  5283.                 (DATA_FIELD, 0, (ROW => 9, COLUMN => 46)), 7 => (LIST_FIELD, 
  5284.                 0, (ROW => 11, COLUMN => 36)), 8 => (COMMAND_FIELD, 0, (ROW => 
  5285.                 15, COLUMN => 6)), 9 => (LIST_FIELD, 0, (ROW => 15, COLUMN => 
  5286.                 45)), 10 => (COMMAND_FIELD, 0, (ROW => 19, COLUMN => 6)), 11 
  5287.                 => (COMMAND_FIELD, 0, (ROW => 24, COLUMN => 6))); 
  5288.    begin 
  5289.       DISPLAY_MESSAGE_DIRECTORY (CURRENT_TYPE); 
  5290.       LOAD_MESSAGE_TYPE (FIELDS, NUMBER_OF_FIELDS, CURRENT_FIELD, 
  5291.                 CURRENT_TYPE.TYPE_STRING); 
  5292.       loop 
  5293.          SUFFICIENT_DATA := TRUE; 
  5294.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5295.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5296.          --
  5297.          for I in 1..FIELDS (CURRENT_FIELD).NUMBER_OF_ASSOCIATES loop 
  5298.             if VALUES_GOTTEN (CURRENT_FIELD + I) = "    " then 
  5299.                SUFFICIENT_DATA := FALSE; 
  5300.                PROMPT ("insufficient data for command"); 
  5301.                CURRENT_FIELD := CURRENT_FIELD + I; 
  5302.                exit; -- exits loop
  5303.             end if; 
  5304.          end loop; 
  5305.          --
  5306.          if SUFFICIENT_DATA then 
  5307.             --
  5308.             if CURRENT_FIELD = 1 then 
  5309.                GET (VALUES_GOTTEN (2), MESSAGE_NUMBER, LAST); 
  5310.                -- converts string to integer
  5311.                if MESSAGE_NUMBER > 0 and MESSAGE_NUMBER <= 
  5312.                          CURRENT_TYPE.NUMBER_OF_MESSAGES then 
  5313.                   PRINT_MESSAGE_TEXT (CURRENT_TYPE, MESSAGE_NUMBER); 
  5314.                   --
  5315.                else 
  5316.                   PROMPT (" message number out of range "); 
  5317.                   CURRENT_FIELD := 2; 
  5318.                   -- now go back to the general_menu_driver
  5319.                end if; 
  5320.                --
  5321.             elsif CURRENT_FIELD = 4 then 
  5322.                GET (VALUES_GOTTEN (5), FIRST_MESSAGE_NUMBER, LAST); 
  5323.                -- converts string to integer
  5324.                if FIRST_MESSAGE_NUMBER > 0 and FIRST_MESSAGE_NUMBER <= 
  5325.                          CURRENT_TYPE.NUMBER_OF_MESSAGES then 
  5326.                   --
  5327.                   GET (VALUES_GOTTEN (6), LAST_MESSAGE_NUMBER, LAST); 
  5328.                   if LAST_MESSAGE_NUMBER > 0 and LAST_MESSAGE_NUMBER <= 
  5329.                             CURRENT_TYPE.NUMBER_OF_MESSAGES then 
  5330.                      PRINT_GROUP_OF_MESSAGES (CURRENT_TYPE, 
  5331.                                FIRST_MESSAGE_NUMBER, LAST_MESSAGE_NUMBER); 
  5332.                   else 
  5333.                      PROMPT (" second message number out of range "); 
  5334.                      CURRENT_FIELD := 6; 
  5335.                      -- now go back to the general_menu_driver
  5336.                   end if; 
  5337.                   --
  5338.                else 
  5339.                   PROMPT (" first message number out of range "); 
  5340.                   CURRENT_FIELD := 5; 
  5341.                   -- now go back to the general_menu_driver
  5342.                end if; 
  5343.                --
  5344.             elsif CURRENT_FIELD = 8 then 
  5345.                -- print the prototype message 
  5346.                MESSAGE_NUMBER := 0; 
  5347.                PRINT_MESSAGE_TEXT (CURRENT_TYPE, MESSAGE_NUMBER); 
  5348.                --
  5349.             elsif CURRENT_FIELD = 10 then 
  5350.                -- print_directory
  5351.                PRINT_MESSAGE_DIRECTORY; 
  5352.                --
  5353.             elsif CURRENT_FIELD = 11 then 
  5354.                --
  5355.                MENU := GMHF; 
  5356.                exit; 
  5357.                --
  5358.             end if; 
  5359.          --
  5360.          else 
  5361.             -- there was insufficient data to process command
  5362.             -- so return to the general_menu_driver
  5363.             null; 
  5364.          end if; 
  5365.       --
  5366.       end loop; 
  5367.       --
  5368.    end MESSAGE_PRINT_DIRECTORY_MENU_HANDLER; 
  5369. --
  5370. --
  5371.    ---------------------------------------------
  5372.    procedure PROCESS_EDITED_MESSAGE_MENU_HANDLER (MENU  : in out MENU_NAMES) 
  5373.              is 
  5374.    ---------------------------------------------
  5375.    --
  5376.    -- this routine handles the tabing, commanding etc. of the
  5377.    -- process edited msg menu.
  5378.    --
  5379.       NUMBER_OF_FIELDS  : constant INTEGER := 5; 
  5380.       VALUES_GOTTEN     : STRING_VALUE (1..NUMBER_OF_FIELDS)
  5381.                           := (others => "    "); 
  5382.       CURRENT_FIELD     : POSITIVE := 1; 
  5383.       FIELDS            : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5384.                 (COMMAND_FIELD, 0, (ROW => 12, COLUMN => 6)), 2 => 
  5385.                 (COMMAND_FIELD, 0, (ROW => 14, COLUMN => 6)), 3 => 
  5386.                 (COMMAND_FIELD, 0, (ROW => 18, COLUMN => 6)), 4 => 
  5387.                 (COMMAND_FIELD, 0, (ROW => 20, COLUMN => 6)), 5 => 
  5388.                 (COMMAND_FIELD, 0, (ROW => 24, COLUMN => 6))); 
  5389.    --
  5390.    -- here starts the main part of the routine
  5391.    --
  5392.    begin 
  5393.       --
  5394.       GOTO_CRT_POSITION (6, 32); 
  5395.       PUT (ACTIVE_MESSAGE_TYPE.TYPE_STRING); 
  5396.       PUT (ACTIVE_MESSAGE_NUMBER, 5); 
  5397.       --
  5398.       loop 
  5399.          --
  5400.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5401.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5402.          --
  5403.          if CURRENT_FIELD = 1 then 
  5404.             -- resave message
  5405.             PUT_OLD_MESSAGE_BACK_IN (ACTIVE_MESSAGE_TYPE, 
  5406.                       ACTIVE_MESSAGE_NUMBER, ACTIVE_MESSAGE); 
  5407.             --
  5408.          elsif CURRENT_FIELD = 2 then 
  5409.             -- save msg as new
  5410.             PUT_NEW_MESSAGE_IN (ACTIVE_MESSAGE_TYPE, ACTIVE_MESSAGE); 
  5411.             --
  5412.          elsif CURRENT_FIELD = 3 then 
  5413.             -- re-edit the message
  5414.             --
  5415.             -- call routine which decides which editor to activate
  5416.             --
  5417.             CALL_THE_EDITOR (ACTIVE_MESSAGE, ACTIVE_MESSAGE_TYPE, 
  5418.                       ACTIVE_MESSAGE_NUMBER); 
  5419.             --
  5420.             MENU := GMHF_12; 
  5421.             exit; 
  5422.             --
  5423.          elsif CURRENT_FIELD = 4 then 
  5424.             MENU := GMHF_1; 
  5425.             exit; 
  5426.             --
  5427.          elsif CURRENT_FIELD = 5 then 
  5428.             MENU := GMHF; 
  5429.             exit; 
  5430.             --
  5431.          end if; 
  5432.          --
  5433.       --
  5434.       end loop; 
  5435.       --
  5436.    end PROCESS_EDITED_MESSAGE_MENU_HANDLER; 
  5437. --
  5438. --
  5439.    -----------------------------------------------
  5440.    procedure MESSAGE_DELETE_DIRECTORY_MENU_HANDLER (MENU  : in out MENU_NAMES) 
  5441.              is 
  5442.    -----------------------------------------------
  5443.    --
  5444.    -- this routine handles the tabing, commanding etc. of the
  5445.    -- msg delete directory menu.
  5446.    --
  5447.       MESSAGE_NUMBER    : NATURAL; 
  5448.       NUMBER_OF_FIELDS  : constant INTEGER := 4; 
  5449.       VALUES_GOTTEN     : STRING_VALUE (1..NUMBER_OF_FIELDS)
  5450.                           := (others => "    "); 
  5451.       CURRENT_FIELD     : POSITIVE := 1; 
  5452.       FIELDS            : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5453.                 (COMMAND_FIELD, 1, (ROW => 11, COLUMN => 6)), 2 => 
  5454.                 (DATA_FIELD, 0, (ROW => 11, COLUMN => 25)), 3 => (LIST_FIELD, 
  5455.                 0, (ROW => 11, COLUMN => 41)), 4 => (COMMAND_FIELD, 0, (ROW => 
  5456.                 24, COLUMN => 6))); 
  5457.    begin 
  5458.       DISPLAY_MESSAGE_DIRECTORY (CURRENT_TYPE); 
  5459.       LOAD_MESSAGE_TYPE (FIELDS, NUMBER_OF_FIELDS, CURRENT_FIELD, 
  5460.                 CURRENT_TYPE.TYPE_STRING); 
  5461.       --
  5462.       loop 
  5463.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5464.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5465.          --
  5466.          SUFFICIENT_DATA := TRUE;
  5467.          for I in 1..FIELDS (CURRENT_FIELD).NUMBER_OF_ASSOCIATES loop 
  5468.             if VALUES_GOTTEN (CURRENT_FIELD + I) = "    " then 
  5469.                SUFFICIENT_DATA := FALSE; 
  5470.                PROMPT ("insufficient data for command"); 
  5471.                CURRENT_FIELD := CURRENT_FIELD + I; 
  5472.                exit; -- exits loop
  5473.             end if; 
  5474.          end loop; 
  5475.          --
  5476.          if SUFFICIENT_DATA then
  5477.             if CURRENT_FIELD = 1 then 
  5478.                GET (VALUES_GOTTEN (2), MESSAGE_NUMBER, LAST); 
  5479.                -- converts string to integer
  5480.                if MESSAGE_NUMBER > 0 and MESSAGE_NUMBER <= 
  5481.                          CURRENT_TYPE.NUMBER_OF_MESSAGES then 
  5482.                   ACTIVE_MESSAGE_TYPE := CURRENT_TYPE; 
  5483.                   ACTIVE_MESSAGE_NUMBER := MESSAGE_NUMBER; 
  5484.                   GET_MESSAGE_OUT (ACTIVE_MESSAGE_TYPE, ACTIVE_MESSAGE_NUMBER, 
  5485.                             ACTIVE_MESSAGE); 
  5486.                   --
  5487.                   MENU := GMHF_31; 
  5488.                   exit; 
  5489.                   --
  5490.                else 
  5491.                   PROMPT (" message number out of range "); 
  5492.                   CURRENT_FIELD := 2; 
  5493.                   -- now go back to the general_menu_driver
  5494.                end if; 
  5495.                --
  5496.             elsif CURRENT_FIELD = 4 then 
  5497.                MENU := GMHF; 
  5498.                exit; 
  5499.             end if; 
  5500.          --
  5501.          else
  5502.             -- there was insufficient data to process comand
  5503.             null;
  5504.          end if;
  5505.       --
  5506.       end loop; 
  5507.       --
  5508.    end MESSAGE_DELETE_DIRECTORY_MENU_HANDLER; 
  5509. --
  5510. --
  5511.    ------------------------------------------
  5512.    procedure REVIEW_FOR_DELETION_MENU_HANDLER (MENU  : in out MENU_NAMES) is 
  5513.    ------------------------------------------
  5514.    --
  5515.    -- this routine handles the tabing, commanding etc. of the
  5516.    -- main menu.
  5517.    --
  5518.       NUMBER_OF_FIELDS  : constant INTEGER := 3; 
  5519.       VALUES_GOTTEN     : STRING_VALUE (1..NUMBER_OF_FIELDS)
  5520.                           := (others => "    "); 
  5521.       CURRENT_FIELD     : POSITIVE := 1; 
  5522.       FIELDS            : constant FIELD_ARRAY (1..NUMBER_OF_FIELDS) := (1 => 
  5523.                 (COMMAND_FIELD, 0, (ROW => 20, COLUMN => 6)), 2 => 
  5524.                 (COMMAND_FIELD, 0, (ROW => 22, COLUMN => 6)), 3 => 
  5525.                 (COMMAND_FIELD, 0, (ROW => 24, COLUMN => 6))); 
  5526.       --
  5527.       -- internal procedures to follow
  5528.       --
  5529.       -------------------------
  5530.       procedure DISPLAY_MESSAGE (CURRENT_MESSAGE  : in MESSAGE; 
  5531.                                  MESSAGE_NUMBER   : in NATURAL; 
  5532.                                  MESSAGE_TYPE     : in DIRECTORY_ENTRY) is 
  5533.       -------------------------
  5534.       --
  5535.          MESSAGE_CONTENT  : NODE; 
  5536.          LINE_NUMBER      : CRT_ROWS := 3; 
  5537.          package CLASSIFICATION_IO is new ENUMERATION_IO (CLASSIFICATION); 
  5538.       --
  5539.       begin 
  5540.       --
  5541.          GOTO_CRT_POSITION (LINE_NUMBER, 1); 
  5542.          PUT (MESSAGE_TYPE.TYPE_STRING); 
  5543.          GOTO_CRT_POSITION (LINE_NUMBER, 30); 
  5544.          CLASSIFICATION_IO.PUT (CURRENT_MESSAGE.CLASS); 
  5545.          GOTO_CRT_POSITION (LINE_NUMBER, 55); 
  5546.          PUT ("Message Number "); 
  5547.          PUT (MESSAGE_NUMBER); 
  5548.       --
  5549.          LINE_NUMBER := 5; 
  5550.          MESSAGE_CONTENT := CURRENT_MESSAGE.HEAD; 
  5551.          START_OF_MSG := CURRENT_MESSAGE.HEAD; 
  5552.          TOP_LINE := START_OF_MSG; 
  5553.          END_OF_MSG := CURRENT_MESSAGE.TAIL;
  5554.          -- init bottom line incase of 1 line message 
  5555.          BOTTOM_LINE := END_OF_MSG;
  5556.       --
  5557.          loop 
  5558.          --
  5559.             GOTO_CRT_POSITION (LINE_NUMBER, 1); 
  5560.             PUT (MESSAGE_CONTENT.TEXT_LINE); 
  5561.             LINE_NUMBER := LINE_NUMBER + 1; 
  5562.             exit when LINE_NUMBER >= 19; 
  5563.             exit when MESSAGE_CONTENT = END_OF_MSG;
  5564.             BOTTOM_LINE := MESSAGE_CONTENT.NEXT_LINE; 
  5565.             MESSAGE_CONTENT := MESSAGE_CONTENT.NEXT_LINE; 
  5566.             --
  5567.          end loop; 
  5568.       --
  5569.       end DISPLAY_MESSAGE; 
  5570.       --
  5571.    --
  5572.    -- here starts the main part of the routine
  5573.    --
  5574.    begin 
  5575.       DISPLAY_MESSAGE (ACTIVE_MESSAGE, ACTIVE_MESSAGE_NUMBER, 
  5576.                 ACTIVE_MESSAGE_TYPE); 
  5577.       loop 
  5578.          GENERAL_MENU_DRIVER (CURRENT_FIELD, NUMBER_OF_FIELDS, FIELDS, MENU, 
  5579.                    CURRENT_TYPE, VALUES_GOTTEN); 
  5580.          --
  5581.          if CURRENT_FIELD = 1 then 
  5582.             -- delete the message
  5583.             DELETE_MESSAGE_FROM_DATABASE (ACTIVE_MESSAGE_TYPE, 
  5584.                       ACTIVE_MESSAGE_NUMBER); 
  5585.             PROMPT (" message successfully deleted "); 
  5586.          elsif CURRENT_FIELD = 2 then 
  5587.             MENU := GMHF_3; 
  5588.             exit; 
  5589.          elsif CURRENT_FIELD = 3 then 
  5590.             MENU := GMHF; 
  5591.             exit; 
  5592.          end if; 
  5593.          --
  5594.       --
  5595.       end loop; 
  5596.       --
  5597.    end REVIEW_FOR_DELETION_MENU_HANDLER; 
  5598. --
  5599. end SYSTEM_DRIVER; 
  5600. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5601. --gmhf.txt
  5602. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5603. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  5604. --                                                                    --
  5605. --            Program unit:  PACKAGE GMHF_DRIVER                      --
  5606. --            File name :    GMHF.TXT                                 --
  5607. --                                                                    --
  5608. --            ===========================================             --
  5609. --                                                                    --
  5610. --                                                                    --
  5611. --            Produced by Veda Incorporated                           --
  5612. --            Version  1.0      April 15, 1985                        --
  5613. --                                                                    --
  5614. --                                                                    --
  5615. --            This program unit is a member of the GMHF. It           --
  5616. --            was developed using TeleSoft's Ada compiler,            --
  5617. --            version 2.1 in a VAX/VMS environment, version           --
  5618. --            3.7                                                     --
  5619. --                                                                    --
  5620. --                                                                    --
  5621. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  5622. --
  5623. with TEXT_IO;                use TEXT_IO; 
  5624. with TERMINAL_DEFINITION;    use TERMINAL_DEFINITION; 
  5625. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  5626. with SYSTEM_DRIVER;          use SYSTEM_DRIVER; 
  5627. with GENERAL_MENU_ROUTINES;  use GENERAL_MENU_ROUTINES; 
  5628. -- 
  5629. procedure GMHF_DRIVER is 
  5630. --
  5631. --
  5632.    NEXT_MENU  : MENU_NAMES; 
  5633.    MENU       : STRING (1..9); 
  5634. --
  5635. begin  -- driver
  5636.    PUT (ASCII.ESC); 
  5637.    PUT ('='); 
  5638.    NEXT_MENU := GMHF; 
  5639.    loop 
  5640.       ERASE_SCREEN; 
  5641.       case NEXT_MENU is 
  5642.          when GMHF => 
  5643.             MENU := "     gmhf"; 
  5644.             DISPLAY_MENU (MENU);   -- the main menu for the system
  5645.             MAIN_MENU_HANDLER (NEXT_MENU); 
  5646.          when GMHF_1 => 
  5647.             MENU := "    gmhf1"; 
  5648.             DISPLAY_MENU (MENU); 
  5649.             MESSAGE_EDIT_DIRECTORY_MENU_HANDLER (NEXT_MENU); 
  5650.          when GMHF_11 => 
  5651.             MENU := "   gmhf11"; 
  5652.             NEXT_MENU := GMHF;   -- temporarily
  5653.          when GMHF_12 => 
  5654.             MENU := "   gmhf12"; 
  5655.             DISPLAY_MENU (MENU); 
  5656.             PROCESS_EDITED_MESSAGE_MENU_HANDLER (NEXT_MENU); 
  5657.          when GMHF_2 => 
  5658.             MENU := "    gmhf2"; 
  5659.             DISPLAY_MENU (MENU); 
  5660.             MESSAGE_PRINT_DIRECTORY_MENU_HANDLER (NEXT_MENU); 
  5661.          when GMHF_3 => 
  5662.             MENU := "    gmhf3"; 
  5663.             DISPLAY_MENU (MENU); 
  5664.             MESSAGE_DELETE_DIRECTORY_MENU_HANDLER (NEXT_MENU); 
  5665.          when GMHF_31 => 
  5666.             MENU := "   gmhf31"; 
  5667.             DISPLAY_MENU (MENU); 
  5668.             REVIEW_FOR_DELETION_MENU_HANDLER (NEXT_MENU); 
  5669.          when others => 
  5670.             exit; 
  5671.       end case; 
  5672.    --
  5673.    end loop; 
  5674. --
  5675. end GMHF_DRIVER; 
  5676. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5677. --extrnusr.sp
  5678. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5679. with linked_list_procedures; use linked_list_procedures;
  5680. package access_for_external_users is
  5681. --
  5682. -- This package is available for any user who desires to 
  5683. -- utilize the storage and retrieval functions of the
  5684. -- internal database of GMHF.
  5685. --
  5686. --
  5687.    type external_message is array(positive range <>) of string(1..80);
  5688.  
  5689.    --
  5690.    -- provides external access to loading a message for the editor
  5691.    --
  5692.  
  5693.    procedure load_external_message_into_workspace(class : in string;
  5694.                                 message_text : in external_message;
  5695.                                 editable_message : out message);
  5696.  
  5697.    --
  5698.    --  provides access to retrieving a message from the editor
  5699.    --
  5700.  
  5701.    procedure retrieve_message_from_workspace(class : out string;
  5702.                                message_text : out external_message;
  5703.                                editable_message : in message);
  5704.  
  5705.    --
  5706.    -- provides external access to loading a message
  5707.    --
  5708.  
  5709.    procedure load_external_message_into_database(class : in string;
  5710.                                 message_type : in string;
  5711.                                 message_text : in external_message);
  5712.  
  5713.    --
  5714.    --  provides access to retrieving a message
  5715.    --
  5716.  
  5717.    procedure retrieve_message_from_database(class : out string;
  5718.                                message_type : in string;
  5719.                                message_number : in natural;
  5720.                                message_text : out external_message);
  5721.  
  5722.    --
  5723. end access_for_external_users;
  5724. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5725. --extrnusr.txt
  5726. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5727. with linked_list_procedures;    use linked_list_procedures;
  5728. with type_list;                 use type_list;
  5729. with classification_definition; use classification_definition;
  5730. with file_access;               use file_access;
  5731. --
  5732. package body access_for_external_users is
  5733. --
  5734. -- This package is available for any user who desires to 
  5735. -- utilize the storage and retrieval functions of the
  5736. -- internal database of GMHF.
  5737. --
  5738.    --
  5739.    -- provides external access to loading a message for the editor
  5740.    --
  5741.    ----------------------------------------------
  5742.    procedure load_external_message_into_workspace(class : in string;
  5743.                                 message_text : in external_message;
  5744.                                 editable_message : out message) is
  5745.    ----------------------------------------------
  5746.    --
  5747.    external_classification : classification;
  5748.    working_message : message;
  5749.    input_node : node;
  5750.    -- 
  5751.    begin
  5752.       --
  5753.       -- first validate the classification 
  5754.       --
  5755.          external_classification := classification'value(class);
  5756.       --
  5757.       -- if no constraint error is raised by the VALUE attribute, then
  5758.       -- load the message into the linked list type message
  5759.       --
  5760.          input_node := new message_component;
  5761.       --
  5762.       -- initialize the message
  5763.       --
  5764.          working_message.head := input_node;
  5765.          working_message.tail := input_node;
  5766.          working_message.class := external_classification;
  5767.          working_message.number_of_lines := 1;
  5768.       --
  5769.       -- and initialize the pointer
  5770.       --
  5771.          input_node.next_line := null;
  5772.          input_node.prev_line := null;
  5773.          input_node.text_line := message_text(1);
  5774.       --
  5775.       -- load the linked list
  5776.       --
  5777.          for index in message_text'first+1 .. message_text'last
  5778.          loop
  5779.             insert_after(working_message,input_node);
  5780.             input_node := input_node.next_line;
  5781.             input_node.text_line := message_text(index);
  5782.          end loop;
  5783.       --
  5784.       -- return the message
  5785.       --
  5786.          editable_message := working_message;
  5787.    --
  5788.    --
  5789.    end load_external_message_into_workspace;
  5790.    --
  5791.    --  provides access to retrieving a message from the editor
  5792.    --
  5793.    -----------------------------------------
  5794.    procedure retrieve_message_from_workspace(class : out string;
  5795.                                message_text : out external_message;
  5796.                                editable_message : in message) is
  5797.    -----------------------------------------
  5798.    --
  5799.      output_node : node;
  5800.    --
  5801.    begin
  5802.    --
  5803.    -- put the message into external format
  5804.    --
  5805.       output_node := editable_message.head;
  5806.       for index in 1 .. editable_message.number_of_lines
  5807.       loop
  5808.          message_text(index) := output_node.text_line;
  5809.          output_node := output_node.next_line;
  5810.       end loop;
  5811.    --
  5812.    -- return the classification also
  5813.    --
  5814.       class := classification'image(editable_message.class);
  5815.    --
  5816.    --
  5817.    end retrieve_message_from_workspace;
  5818.    --
  5819.    -- provides external access to loading a message into database
  5820.    --
  5821.    ---------------------------------------------
  5822.    procedure load_external_message_into_database(class : in string;
  5823.                                 message_type : in string;
  5824.                                 message_text : in external_message) is
  5825.    ---------------------------------------------
  5826.    --
  5827.    external_classification : classification;
  5828.    external_message_type : available_types;
  5829.    directory_pointer : directory_entry;
  5830.    input_message : message;
  5831.    input_node : node;
  5832.    --
  5833.    begin
  5834.    --
  5835.    -- first, validate the classification and message type
  5836.    --
  5837.       external_classification := classification'value(class);
  5838.       --
  5839.       external_message_type := available_types'value(message_type);
  5840.    --
  5841.    -- if no constraint error is raised by the VALUE attribute, then
  5842.    --    create a new message and store it in the database
  5843.    --
  5844.       input_node := new message_component;
  5845.       --
  5846.       -- initialize the message
  5847.       --
  5848.          input_message.head := input_node;
  5849.          input_message.tail := input_node;
  5850.          input_message.class := external_classification;
  5851.          input_message.number_of_lines := 1;
  5852.       --
  5853.       -- and initialize the pointer
  5854.       --
  5855.          input_node.next_line := null;
  5856.          input_node.prev_line := null;
  5857.          input_node.text_line := message_text(1);
  5858.    --
  5859.    -- need to get the directory entry for this message type
  5860.    --
  5861.       get_directory(directory_pointer);
  5862.       --
  5863.       -- loop thru the directory until the entry for this type is found
  5864.       --
  5865.          while directory_pointer.message_type /= external_message_type
  5866.          loop
  5867.             directory_pointer := directory_pointer.next_message_type;
  5868.          end loop;
  5869.    --
  5870.    -- load the linked list
  5871.    --
  5872.       for index in message_text'first+1 .. message_text'last
  5873.       loop
  5874.          insert_after(input_message,input_node);
  5875.          input_node := input_node.next_line;
  5876.          input_node.text_line := message_text(index);
  5877.       end loop;
  5878.    --
  5879.    -- and finally, add the new message
  5880.    --
  5881.       put_new_message_in(directory_pointer,input_message);
  5882.    --
  5883.    --      
  5884.    end load_external_message_into_database;
  5885.    --
  5886.    --  provides access to retrieving a message from database
  5887.    --
  5888.    ----------------------------------------
  5889.    procedure retrieve_message_from_database(class : out string;
  5890.                                message_type : in string;
  5891.                                message_number : in natural;
  5892.                                message_text : out external_message) is
  5893.    ----------------------------------------
  5894.    --
  5895.       external_message_type : available_types;
  5896.       directory_pointer : directory_entry;
  5897.       output_message : message;
  5898.       output_node : node;
  5899.    --
  5900.    begin
  5901.    --
  5902.    -- validate the message type
  5903.    --
  5904.       external_message_type := available_types'value(message_type);
  5905.    --
  5906.    -- need to get the directory entry for this message type
  5907.    --
  5908.       get_directory(directory_pointer);
  5909.       --
  5910.       -- loop thru the directory until the entry for this type is found
  5911.       --
  5912.          while directory_pointer.message_type /= external_message_type
  5913.          loop
  5914.             directory_pointer := directory_pointer.next_message_type;
  5915.          end loop;
  5916.    --
  5917.    -- validate the message number
  5918.    --
  5919.       if message_number > directory_pointer.number_of_messages then
  5920.          raise constraint_error;
  5921.       end if;
  5922.    --
  5923.    -- get the message out of the database
  5924.    --
  5925.       get_message_out(directory_pointer,message_number,output_message);
  5926.    --
  5927.    -- put the message into external format
  5928.    --
  5929.       output_node := output_message.head;
  5930.       for index in 1 .. output_message.number_of_lines
  5931.       loop
  5932.          message_text(index) := output_node.text_line;
  5933.          output_node := output_node.next_line;
  5934.       end loop;
  5935.    --
  5936.    -- return the classification also
  5937.    --
  5938.       class := classification'image(output_message.class);
  5939.    --
  5940.    end retrieve_message_from_database;
  5941.    --
  5942.    --
  5943. end access_for_external_users;
  5944. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5945. --minigfu.txt
  5946. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5947. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  5948. --                                                                    --
  5949. --            Program unit:  PACKAGE GENERIC_GET_FIELD_UTILITIES      --
  5950. --            File name :    MINIGFU.TXT                              --
  5951. --                                                                    --
  5952. --            ===========================================             --
  5953. --                                                                    --
  5954. --                                                                    --
  5955. --            Produced by Veda Incorporated                           --
  5956. --            Version  1.0      April 15, 1985                        --
  5957. --                                                                    --
  5958. --                                                                    --
  5959. --            This program unit is a member of the GMHF. It           --
  5960. --            was developed using TeleSoft's Ada compiler,            --
  5961. --            version 2.1 in a VAX/VMS environment, version           --
  5962. --            3.7                                                     --
  5963. --                                                                    --
  5964. --                                                                    --
  5965. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  5966. --
  5967. with TEXT_IO;                use TEXT_IO; 
  5968. with TERMINAL_DEFINITION;    use TERMINAL_DEFINITION; 
  5969. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  5970. --
  5971. package GENERIC_GET_FIELD_UTILITIES is 
  5972. --
  5973. -- this package contains three generic definitions which can be used to
  5974. -- instantiate input routines to be called by 'Get_field'. The basic
  5975. -- structure is that we pass an enumerated type as a formal parameter,
  5976. -- and the other formal parameter is the text_io.enumeration_io.get
  5977. -- for that enumerated type. If the current compiler supported nested
  5978. -- generics, we wouldn't have to instantiate the enumeration_io.get
  5979. -- elsewhere, but could do it within the generic definition given here.
  5980.  
  5981. --
  5982. -- There are three generic definitions. The first can be used to get an
  5983. -- enumerated field 'as is'. The second can be used to get an enumerated
  5984. -- field which contains characters which are not allowed in Ada
  5985. -- identifers but which must be input. The third can be used to get an
  5986. -- enumerated field some of whose items are Ada keywords.
  5987. --
  5988.  
  5989. --
  5990. -- The primary reason for using these generics instead of using only the
  5991. -- Ada supplied generics is to be consistant with the user interface. In
  5992. -- particular with capturing command key inputs and to a lesser extent,
  5993. -- handling exceptions.
  5994.  
  5995. --
  5996.    generic 
  5997.       type ENUMERATED_TYPE is (<>); 
  5998.       with procedure GET_PROC (STR  : in STRING; 
  5999.                                FLD  : out ENUMERATED_TYPE; 
  6000.                                INT  : out POSITIVE); 
  6001.       procedure GET_ENUMERATED_FIELD (STR             : in out STRING; 
  6002.                                    START_OF_FIELD     : in POSITIVE; 
  6003.                                    CHARACTERS_GOTTEN  : in out POSITIVE;
  6004.                                    COMMAND_FLAG       : in out BOOLEAN; 
  6005.                                    COMMAND_GOTTEN     : in out COMMAND);
  6006.  
  6007.       
  6008.       generic 
  6009.          type ENUMERATED_TYPE is (<>); 
  6010.          with procedure GET_PROC (STR  : in STRING; 
  6011.                                   FLD  : out ENUMERATED_TYPE; 
  6012.                                   INT  : out POSITIVE); 
  6013.          procedure GET_B_OR_H_ENUMERATED_FIELD (STR  : in out STRING; 
  6014.                                   START_OF_FIELD     : in POSITIVE; 
  6015.                                   CHARACTERS_GOTTEN  : in out POSITIVE; 
  6016.                                   COMMAND_FLAG       : in out BOOLEAN; 
  6017.                                   COMMAND_GOTTEN     : in out COMMAND); 
  6018.          
  6019.          generic 
  6020.             type ENUMERATED_TYPE is (<>); 
  6021.             with procedure GET_PROC (STR  : in STRING; 
  6022.                                      FLD  : out ENUMERATED_TYPE; 
  6023.                                      INT  : out POSITIVE); 
  6024.             procedure GET_X_ENUMERATED_FIELD (STR                : in out STRING; 
  6025.                                   START_OF_FIELD     : in POSITIVE; 
  6026.                                   CHARACTERS_GOTTEN  : in out POSITIVE; 
  6027.                                   COMMAND_FLAG       : in out BOOLEAN; 
  6028.                                   COMMAND_GOTTEN     : in out COMMAND); 
  6029.             
  6030.             
  6031.          end GENERIC_GET_FIELD_UTILITIES; 
  6032. -----------------------------------------------------------------------
  6033.          
  6034.          package body GENERIC_GET_FIELD_UTILITIES is 
  6035.          
  6036.          
  6037.             procedure GET_ENUMERATED_FIELD (STR                : in out STRING; 
  6038.                                             START_OF_FIELD     : in POSITIVE; 
  6039.                                             CHARACTERS_GOTTEN  : in out 
  6040.                                                       POSITIVE; 
  6041.                                             COMMAND_FLAG       : in out BOOLEAN; 
  6042.                                             COMMAND_GOTTEN     : in out COMMAND) 
  6043.                       is 
  6044.             
  6045.                ERASE_REQUEST  : exception; 
  6046.                BLANKS         : STRING (1..80) := (1..80 => ' '); 
  6047.                FIELD_TO_GET   : ENUMERATED_TYPE; 
  6048.             begin 
  6049.                loop 
  6050.                   begin 
  6051.                      if COMMAND_FLAG = FALSE then 
  6052.                         READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6053.                      end if; 
  6054.                      if COMMAND_GOTTEN = ERASE_FIELD then 
  6055.                         raise ERASE_REQUEST; 
  6056.                      end if; 
  6057.                      GET_PROC (STR, FIELD_TO_GET, CHARACTERS_GOTTEN); 
  6058.                      
  6059.                      if CHARACTERS_GOTTEN >= STR'LENGTH then 
  6060.                         exit; 
  6061.                      elsif STR (CHARACTERS_GOTTEN + 1..STR'LENGTH) = BLANKS 
  6062.                                (CHARACTERS_GOTTEN + 1..STR'LENGTH) then 
  6063.                         exit; 
  6064.                      else 
  6065.                         raise DATA_ERROR; 
  6066.                      end if; 
  6067.                      
  6068.                   exception 
  6069.                      when DATA_ERROR => 
  6070.                         PROMPT 
  6071.                          
  6072.                          
  6073.                          ("Illegal fixed field data entry. Please reenter data."); 
  6074.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6075.                         COMMAND_FLAG := FALSE; 
  6076.                         COMMAND_GOTTEN := NIL; 
  6077.                      when END_ERROR => 
  6078.                         exit; 
  6079.                      when ERASE_REQUEST => 
  6080.                         COMMAND_FLAG := FALSE; 
  6081.                         COMMAND_GOTTEN := NIL; 
  6082.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6083.                         STR (1..STR'LENGTH) := BLANKS (1..STR'LENGTH); 
  6084.                         PUT (BLANKS (1..STR'LENGTH)); 
  6085.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6086.                      when others => 
  6087.                         PROMPT 
  6088.                          
  6089.                          ("Illegal fixed field data entry. Please try again."); 
  6090.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6091.                         COMMAND_FLAG := FALSE; 
  6092.                         COMMAND_GOTTEN := NIL; 
  6093.                   end; 
  6094.                end loop; 
  6095.             end GET_ENUMERATED_FIELD; 
  6096. -----------------------------------------------------------------------
  6097.             
  6098.             procedure GET_B_OR_H_ENUMERATED_FIELD (STR                : in out STRING; 
  6099.                                    START_OF_FIELD     : in POSITIVE; 
  6100.                                    CHARACTERS_GOTTEN  : in out POSITIVE; 
  6101.                                    COMMAND_FLAG       : in out BOOLEAN; 
  6102.                                    COMMAND_GOTTEN     : in out COMMAND)
  6103.                                                              is 
  6104.    --
  6105.                ERASE_REQUEST            : exception; 
  6106.                DUMMY_STRING             : STRING (1..20) := (1..20 => ' '); 
  6107.                FIELD_TO_GET             : ENUMERATED_TYPE; 
  6108.                FLAG_A                   : BOOLEAN := FALSE; 
  6109.                UPPER_LOOP               : INTEGER; 
  6110.                STRING_2_POINTER         : POSITIVE := 1; 
  6111.                CHARACTER_ADDED_COUNTER  : NATURAL := 0; 
  6112.                BLANKS                   : STRING (1..80) := (1..80 => ' '); 
  6113.                
  6114.             begin 
  6115.                loop 
  6116.                   begin 
  6117.                      if COMMAND_FLAG = FALSE then 
  6118.                         READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6119.                      end if; 
  6120.                      
  6121.                      if COMMAND_GOTTEN = ERASE_FIELD then 
  6122.                         raise ERASE_REQUEST; 
  6123.                      end if; 
  6124.       --
  6125.       -- change any user entered hyphens or blanks to underscores prior
  6126.       -- to using the enumerated io get
  6127.       --
  6128.                      for I in STR'RANGE loop 
  6129.          --
  6130.          -- ignore leading blanks
  6131.          --
  6132.                         if STR (I) = ' ' and FLAG_A = FALSE then 
  6133.                            STRING_2_POINTER := STRING_2_POINTER + 1; 
  6134.          --
  6135.          -- handle non-leading blanks
  6136.          --
  6137.                         elsif STR (I) = ' ' and FLAG_A = TRUE then 
  6138.                            if I = STR'LENGTH then 
  6139.                               exit; 
  6140.                            elsif STR (I + 1) = ' ' then 
  6141.                               exit; 
  6142.                            else 
  6143.                               DUMMY_STRING (STRING_2_POINTER..STRING_2_POINTER 
  6144.                                         + 2) := "_B_"; 
  6145.                               STRING_2_POINTER := STRING_2_POINTER + 3; 
  6146.                            end if; 
  6147.          --
  6148.          -- handle hyphens
  6149.          --
  6150.                         elsif STR (I) = '-' then 
  6151.                            FLAG_A := TRUE; 
  6152.                            DUMMY_STRING (STRING_2_POINTER..STRING_2_POINTER + 
  6153.                                      2) := "_X_"; 
  6154.                            STRING_2_POINTER := STRING_2_POINTER + 3; 
  6155.                            CHARACTER_ADDED_COUNTER := CHARACTER_ADDED_COUNTER 
  6156.                                      + 2; 
  6157.          --
  6158.          -- if not blank or hyphen, copy it into d_s_2
  6159.          --
  6160.                         else 
  6161.                            DUMMY_STRING (STRING_2_POINTER) := STR (I); 
  6162.                            STRING_2_POINTER := STRING_2_POINTER + 1; 
  6163.                            FLAG_A := TRUE; 
  6164.                         end if; 
  6165.                      end loop; 
  6166.       --
  6167.                      if STR'LENGTH >= 8 then 
  6168.                         if STR (1..8) = "41_METER" then 
  6169.                            DUMMY_STRING (1..12) := "X_41_X_METER"; 
  6170.                            CHARACTER_ADDED_COUNTER := 4; 
  6171.                         end if; 
  6172.                      end if; 
  6173.                      
  6174.                      GET_PROC (DUMMY_STRING, FIELD_TO_GET, CHARACTERS_GOTTEN); 
  6175.                      
  6176.                      if CHARACTERS_GOTTEN >= DUMMY_STRING'LENGTH then 
  6177.                         exit; 
  6178.                      elsif DUMMY_STRING (CHARACTERS_GOTTEN + 
  6179.                                1..DUMMY_STRING'LENGTH) = BLANKS 
  6180.                                (CHARACTERS_GOTTEN + 1..DUMMY_STRING'LENGTH) 
  6181.                                then 
  6182.                         exit; 
  6183.                      else 
  6184.                         raise DATA_ERROR; 
  6185.                      end if; 
  6186.                      
  6187.                   exception 
  6188.                      when DATA_ERROR => 
  6189.                         PROMPT 
  6190.                          
  6191.                          
  6192.                          ("Illegal fixed field data entry. Please reenter data."); 
  6193.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6194.                         COMMAND_FLAG := FALSE; 
  6195.                         COMMAND_GOTTEN := NIL; 
  6196.                         
  6197.                      when END_ERROR => 
  6198.                         exit; 
  6199.                      when ERASE_REQUEST => 
  6200.                         COMMAND_FLAG := FALSE; 
  6201.                         COMMAND_GOTTEN := NIL; 
  6202.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6203.                         STR (1..STR'LENGTH) := BLANKS (1..STR'LENGTH); 
  6204.                         PUT (BLANKS (1..STR'LENGTH)); 
  6205.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6206.                         
  6207.                      when others => 
  6208.                         PROMPT 
  6209.                          
  6210.                          
  6211.                          ("Illegal fixed field data entry. Please reenter data."); 
  6212.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6213.                         COMMAND_FLAG := FALSE; 
  6214.                         COMMAND_GOTTEN := NIL; 
  6215.                   end; 
  6216.                end loop; 
  6217.    --
  6218.             end GET_B_OR_H_ENUMERATED_FIELD; 
  6219.    ------------------------------------------------
  6220.             procedure GET_X_ENUMERATED_FIELD (STR                : in out STRING; 
  6221.                                     START_OF_FIELD     : in POSITIVE; 
  6222.                                     CHARACTERS_GOTTEN  : in out POSITIVE; 
  6223.                                     COMMAND_FLAG       : in out BOOLEAN; 
  6224.                                     COMMAND_GOTTEN     : in out COMMAND) 
  6225.                       is 
  6226.             
  6227.                ERASE_REQUEST            : exception; 
  6228.                DUMMY_STRING             : STRING (1..69) := (1..69 => ' '); 
  6229.                FIELD_TO_GET             : ENUMERATED_TYPE; 
  6230.                STRING_2_POINTER         : POSITIVE := 1; 
  6231.                CHARACTER_ADDED_COUNTER  : NATURAL := 0; 
  6232.                BLANKS                   : STRING (1..80) := (1..80 => ' '); 
  6233.                
  6234.             begin 
  6235.                loop 
  6236.                   begin 
  6237.                      if COMMAND_FLAG = FALSE then 
  6238.                         READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6239.                      end if; 
  6240.                      
  6241.                      if COMMAND_GOTTEN = ERASE_FIELD then 
  6242.                         raise ERASE_REQUEST; 
  6243.                      end if; 
  6244.                      
  6245.                      DUMMY_STRING (1..STR'LENGTH) := STR (1..STR'LENGTH); 
  6246.                      if DUMMY_STRING (1..STR'LENGTH) = BLANKS (1..STR'LENGTH) 
  6247.                                then 
  6248.                         exit; 
  6249.                      end if; 
  6250.                      
  6251.                      for I in 1..STR'LENGTH loop 
  6252.                         if DUMMY_STRING (1) = ' ' then 
  6253.                            DUMMY_STRING (1..STR'LENGTH) := DUMMY_STRING 
  6254.                                      (2..STR'LENGTH) & " "; 
  6255.                         end if; 
  6256.                      end loop; 
  6257.                      
  6258.                      if STR'LENGTH >= 5 and then 
  6259.                         DUMMY_STRING (1..5) = "OTHER" then DUMMY_STRING 
  6260.                                   (1..DUMMY_STRING'LENGTH) := "X_" & 
  6261.                                   DUMMY_STRING (1..DUMMY_STRING'LENGTH - 2); 
  6262.                         
  6263.                      elsif STR'LENGTH >= 4 and then 
  6264.                         DUMMY_STRING (1..4) = "LINE" then DUMMY_STRING 
  6265.                                   (1..DUMMY_STRING'LENGTH) := "X_" & 
  6266.                                   DUMMY_STRING (1..DUMMY_STRING'LENGTH - 2); 
  6267.                         
  6268.                      elsif STR'LENGTH >= 3 and then 
  6269.                         DUMMY_STRING (1..3) = "OUT" then DUMMY_STRING 
  6270.                                   (1..DUMMY_STRING'LENGTH) := "X_" & 
  6271.                                   DUMMY_STRING (1..DUMMY_STRING'LENGTH - 2); 
  6272.                         
  6273.                      elsif STR'LENGTH >= 2 and then 
  6274.                         (DUMMY_STRING (1..2) = "AT" or DUMMY_STRING (1..2) = 
  6275.                                   "DO" or DUMMY_STRING (1..2) = "IF" or 
  6276.                                   DUMMY_STRING (1..2) = "IN" or DUMMY_STRING 
  6277.                                   (1..2) = "IS") then DUMMY_STRING 
  6278.                                   (1..DUMMY_STRING'LENGTH) := "X_" & 
  6279.                                   DUMMY_STRING (1..DUMMY_STRING'LENGTH - 2); 
  6280.                      end if; 
  6281.       --
  6282.                      GET_PROC (DUMMY_STRING, FIELD_TO_GET, CHARACTERS_GOTTEN); 
  6283.                      
  6284.                      if CHARACTERS_GOTTEN >= DUMMY_STRING'LENGTH then 
  6285.                         exit; 
  6286.                      elsif DUMMY_STRING (CHARACTERS_GOTTEN + 
  6287.                                1..DUMMY_STRING'LENGTH) = BLANKS 
  6288.                                (CHARACTERS_GOTTEN + 1..DUMMY_STRING'LENGTH) 
  6289.                                then 
  6290.                         exit; 
  6291.                      else 
  6292.                         raise DATA_ERROR; 
  6293.                      end if; 
  6294.                      
  6295.                   exception 
  6296.                      when DATA_ERROR => 
  6297.                         PROMPT 
  6298.                          
  6299.                          
  6300.                          ("Illegal fixed field data entry. Please reenter data."); 
  6301.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6302.                         COMMAND_FLAG := FALSE; 
  6303.                         COMMAND_GOTTEN := NIL; 
  6304.                         
  6305.                      when END_ERROR => 
  6306.                         exit; 
  6307.                      when ERASE_REQUEST => 
  6308.                         COMMAND_FLAG := FALSE; 
  6309.                         COMMAND_GOTTEN := NIL; 
  6310.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6311.                         STR (1..STR'LENGTH) := BLANKS (1..STR'LENGTH); 
  6312.                         PUT (BLANKS (1..STR'LENGTH)); 
  6313.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6314.                      when others => 
  6315.                         PROMPT 
  6316.                          
  6317.                          ("Illegal fixed field data entry. Please try again."); 
  6318.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6319.                         COMMAND_FLAG := FALSE; 
  6320.                         COMMAND_GOTTEN := NIL; 
  6321.                         
  6322.                   end; 
  6323.                end loop; 
  6324.                
  6325.             end GET_X_ENUMERATED_FIELD; 
  6326.             
  6327.          end GENERIC_GET_FIELD_UTILITIES; 
  6328. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6329. --staticgfu.sp
  6330. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6331. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  6332. --                                                                    --
  6333. --            Program unit:  PACKAGE STATIC_GET_FIELD_UTILITIES       --
  6334. --            File name :    STATICGFU.SP                             --
  6335. --                                                                    --
  6336. --            ===========================================             --
  6337. --                                                                    --
  6338. --                                                                    --
  6339. --            Produced by Veda Incorporated                           --
  6340. --            Version  1.0      April 15, 1985                        --
  6341. --                                                                    --
  6342. --                                                                    --
  6343. --            This program unit is a member of the GMHF. It           --
  6344. --            was developed using TeleSoft's Ada compiler,            --
  6345. --            version 2.1 in a VAX/VMS environment, version           --
  6346. --            3.7                                                     --
  6347. --                                                                    --
  6348. --                                                                    --
  6349. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  6350. --
  6351. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  6352.  
  6353. package STATIC_GET_FIELD_UTILITIES is 
  6354.  
  6355. --
  6356. -- The purpose of this package is to provide utilities which can be used
  6357. -- by Get_field to input numeric fields and calculate checksums.
  6358. --
  6359. -- The primary reason for using these procedures instead of using only
  6360. -- the Ada supplied routines is to be consistant with the user interface
  6361. -- in particular with capturing command key inputs and to a lesser
  6362. -- extent,handling exceptions.
  6363.  
  6364.    type REAL  is delta 0.1 range - 999999.9..999999.9; 
  6365.    
  6366.    ERASE_ERROR  : exception; 
  6367.    
  6368.    procedure CHECKSUM (INPUT_DIGITS    : in STRING; 
  6369.                        CHECKSUM_DIGIT  : out STRING); 
  6370.    
  6371.    procedure GET_CONSTRAINED_INTEGER (STR                    : in out STRING; 
  6372.                                       START_OF_FIELD         : POSITIVE; 
  6373.                                       LOW_LIMIT, HIGH_LIMIT  : in INTEGER; 
  6374.                                       FILL_CHARACTER         : in CHARACTER; 
  6375.                                       COMMAND_FLAG           : in out BOOLEAN; 
  6376.                                       COMMAND_GOTTEN         : in out 
  6377.              COMMAND); 
  6378.    
  6379.    procedure GET_CONSTRAINED_CHARACTER (STR                    : in out STRING; 
  6380.                                         START_OF_FIELD         : POSITIVE; 
  6381.                                         FIRST_CHAR, LAST_CHAR  : in CHARACTER; 
  6382.                                         COMMAND_FLAG           : in out BOOLEAN; 
  6383.                                         COMMAND_GOTTEN         : in out COMMAND; 
  6384.                                         SPACE_ALLOWED          : BOOLEAN := 
  6385.              FALSE); 
  6386.    
  6387.    procedure GET_CONSTRAINED_DECIMAL (STR                    : in out STRING; 
  6388.                                       START_OF_FIELD         : POSITIVE; 
  6389.                                       LOW_LIMIT, HIGH_LIMIT  : in REAL; 
  6390.                                       FILL_CHARACTER         : in CHARACTER; 
  6391.                                       COMMAND_FLAG           : in out BOOLEAN; 
  6392.                                       COMMAND_GOTTEN         : in out 
  6393.              COMMAND); 
  6394.    
  6395. end STATIC_GET_FIELD_UTILITIES; 
  6396. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6397. --staticgfu.txt
  6398. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6399. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  6400. --                                                                    --
  6401. --            Program unit:  PACKAGE STATIC_GET_FIELD_UTILITIES       --
  6402. --            File name :    STATICGFU.TXT                            --
  6403. --                                                                    --
  6404. --            ===========================================             --
  6405. --                                                                    --
  6406. --                                                                    --
  6407. --            Produced by Veda Incorporated                           --
  6408. --            Version  1.0      April 15, 1985                        --
  6409. --                                                                    --
  6410. --                                                                    --
  6411. --            This program unit is a member of the GMHF. It           --
  6412. --            was developed using TeleSoft's Ada compiler,            --
  6413. --            version 2.1 in a VAX/VMS environment, version           --
  6414. --            3.7                                                     --
  6415. --                                                                    --
  6416. --                                                                    --
  6417. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  6418. --
  6419. with TEXT_IO;              use TEXT_IO; 
  6420. with TERMINAL_DEFINITION;  use TERMINAL_DEFINITION; 
  6421.  
  6422. package body STATIC_GET_FIELD_UTILITIES is 
  6423.  
  6424.  
  6425.    procedure CHECKSUM (INPUT_DIGITS    : in STRING; 
  6426.                        CHECKSUM_DIGIT  : out STRING) is 
  6427.    
  6428.       COUNTER        : NATURAL := 0; 
  6429.       DIGIT_VALUE    : NATURAL range 0..9; 
  6430.       LAST           : POSITIVE; 
  6431.       FOUND_A_DIGIT  : BOOLEAN := FALSE; 
  6432.       DUMMY_STRING   : STRING (1..2) := "  "; 
  6433.       package INT_IO is new INTEGER_IO (INTEGER); 
  6434.    begin 
  6435.       for I in 1..INPUT_DIGITS'LENGTH loop 
  6436.          if INPUT_DIGITS (I) in '0'..'9' then 
  6437.             INT_IO.GET (INPUT_DIGITS (I..I), DIGIT_VALUE, LAST); 
  6438.             COUNTER := COUNTER + DIGIT_VALUE; 
  6439.             FOUND_A_DIGIT := TRUE; 
  6440.          end if; 
  6441.       end loop; 
  6442.       COUNTER := COUNTER mod 10; 
  6443.       if FOUND_A_DIGIT = TRUE then 
  6444.          DUMMY_STRING := NATURAL'IMAGE (COUNTER); 
  6445.       end if; 
  6446.       CHECKSUM_DIGIT (1..1) := DUMMY_STRING (2..2); 
  6447.    end CHECKSUM; 
  6448.    
  6449.    
  6450.    procedure GET_CONSTRAINED_INTEGER (STR                    : in out STRING; 
  6451.                                       START_OF_FIELD         : POSITIVE; 
  6452.                                       LOW_LIMIT, HIGH_LIMIT  : in INTEGER; 
  6453.                                       FILL_CHARACTER         : in CHARACTER; 
  6454.                                       COMMAND_FLAG           : in out BOOLEAN; 
  6455.                                       COMMAND_GOTTEN         : in out COMMAND) 
  6456.              is 
  6457.    --
  6458.    -- declare some local variables
  6459.    --
  6460.       package INT_IO is new INTEGER_IO (INTEGER); 
  6461.       use INT_IO; 
  6462.       subtype CONSTRAINED_INTEGER  is INTEGER range LOW_LIMIT..HIGH_LIMIT; 
  6463.       TEST_INT     : CONSTRAINED_INTEGER; 
  6464.       NUMBER_READ  : POSITIVE; 
  6465.       BLANKS       : STRING (1..10) := (1..10 => ' '); 
  6466.    --
  6467.    begin 
  6468.       loop -- until no contraint error is raised or alternate exit
  6469.          begin   -- a block construct
  6470.          --
  6471.          -- first read the user input into a string
  6472.          --
  6473.             if COMMAND_FLAG = FALSE then 
  6474.                READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6475.             end if; 
  6476.             
  6477.             if COMMAND_GOTTEN = ERASE_FIELD then 
  6478.                raise ERASE_ERROR; 
  6479.             end if; 
  6480.          --
  6481.          -- now with integer i_o get a integer from the string
  6482.          --
  6483.             GET (FROM => STR, ITEM => TEST_INT, LAST => NUMBER_READ); 
  6484.          -- now see if there is any superfluous data in the field
  6485.          --
  6486.             if NUMBER_READ = STR'LENGTH then 
  6487.             -- no need for any further check. everything is a.o.k.
  6488.                null; 
  6489.             elsif STR (NUMBER_READ + 1..STR'LENGTH) /= BLANKS (NUMBER_READ + 
  6490.                       1..STR'LENGTH) then 
  6491.                raise DATA_ERROR; 
  6492.             end if; 
  6493.          --
  6494.          -- now see if the number was with in the ranges 
  6495.          --
  6496.          -- put the integer back into a string and if required pad w/ zeros
  6497.          --
  6498.             PUT (TO => STR, ITEM => TEST_INT); 
  6499.          --
  6500.             if FILL_CHARACTER = '0' then 
  6501.             -- pad with zeros. ( default is padded with blanks)
  6502.                for I in 1..STR'LENGTH loop 
  6503.                   if STR (I) = ' ' then 
  6504.                      STR (I) := '0'; 
  6505.                   end if; 
  6506.                end loop; 
  6507.             end if; 
  6508.          -- 
  6509.             exit;   -- the block construct
  6510.          --
  6511.          exception 
  6512.             when DATA_ERROR => 
  6513.             --
  6514.             -- if not blank then prompt bad input and go get more
  6515.             --
  6516.                if STR = BLANKS (1..STR'LENGTH) then 
  6517.                   exit; 
  6518.                else 
  6519.                   PROMPT (" ILLEGAL INPUT FOR NUMERIC FIELD"); 
  6520.                   COMMAND_FLAG := FALSE; 
  6521.                   COMMAND_GOTTEN := NIL; 
  6522.                   GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6523.                end if; 
  6524.                
  6525.             when CONSTRAINT_ERROR => 
  6526.             --
  6527.                PROMPT (" NUMBER OUT OF RANGE FOR THIS FIELD "); 
  6528.                COMMAND_FLAG := FALSE; 
  6529.                COMMAND_GOTTEN := NIL; 
  6530.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6531.             --
  6532.             when END_ERROR => 
  6533.             --
  6534.             -- all blank and thats o.k. so 
  6535.             --
  6536.                exit; 
  6537.                
  6538.             when ERASE_ERROR => 
  6539.                raise ERASE_ERROR; 
  6540.                
  6541.          end;      -- the block construct
  6542.       end loop; -- for reading until good
  6543.    end GET_CONSTRAINED_INTEGER; 
  6544.    -----------------------------------------------------
  6545.    procedure GET_CONSTRAINED_DECIMAL (STR                    : in out STRING; 
  6546.                                       START_OF_FIELD         : POSITIVE; 
  6547.                                       LOW_LIMIT, HIGH_LIMIT  : in REAL; 
  6548.                                       FILL_CHARACTER         : in CHARACTER; 
  6549.                                       COMMAND_FLAG           : in out BOOLEAN; 
  6550.                                       COMMAND_GOTTEN         : in out COMMAND) 
  6551.              is 
  6552.    --
  6553.    -- define some variables and types
  6554.    --
  6555.    --
  6556.       STR2                 : STRING (1..STR'LENGTH) := (1..STR'LENGTH => ' '); 
  6557.       CHECK_STR            : STRING (1..STR'LENGTH + 3) := (1..STR'LENGTH + 3 => ' '); 
  6558.       TEST_REAL            : REAL; 
  6559.       NUMBER_READ          : POSITIVE; 
  6560.       BLANKS               : STRING (1..CHECK_STR'LENGTH) := (1..CHECK_STR'LENGTH => ' '); 
  6561.       CHARACTER_FOUND      : BOOLEAN; 
  6562.       DECIMAL_POINT_FOUND  : BOOLEAN; 
  6563.       LAST_CHAR_PLACE      : INTEGER; 
  6564.       DECIMAL_PLACE        : INTEGER; 
  6565.       TEMP_LENGTH          : INTEGER; 
  6566.    --
  6567.       PRECISION_ERROR      : exception; 
  6568.       package REAL_IO is new FIXED_IO (REAL); 
  6569.       use REAL_IO; 
  6570.    --
  6571.    begin 
  6572.       loop -- until no exceptions are raised or alternate exit occurs
  6573.          begin   -- a block construct
  6574.          --
  6575.          -- first read the user input into a string
  6576.          --
  6577.             if COMMAND_FLAG = FALSE then 
  6578.                READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6579.             end if; 
  6580.             
  6581.             if COMMAND_GOTTEN = ERASE_FIELD then 
  6582.                raise ERASE_ERROR; 
  6583.             end if; 
  6584.          --
  6585.          -- now c y a by forcing the proper format if its not already
  6586.          -- in it. first search for a decimal point
  6587.          --
  6588.             CHECK_STR (2..STR'LENGTH + 1) := STR; 
  6589.             CHARACTER_FOUND := FALSE; 
  6590.             DECIMAL_POINT_FOUND := FALSE; 
  6591.             LAST_CHAR_PLACE := 0; 
  6592.             DECIMAL_PLACE := 0; 
  6593.          --
  6594.             TEMP_LENGTH := STR'LENGTH + 1; 
  6595.             for I in 2..TEMP_LENGTH loop 
  6596.                if CHECK_STR (I) /= ' ' then 
  6597.                   CHARACTER_FOUND := TRUE; 
  6598.                   LAST_CHAR_PLACE := I; 
  6599.                --
  6600.                   if CHECK_STR (I) = '.' then 
  6601.                      DECIMAL_POINT_FOUND := TRUE; 
  6602.                      DECIMAL_PLACE := I; 
  6603.                   end if; 
  6604.                --
  6605.                end if; 
  6606.             end loop; 
  6607.          --
  6608.             if DECIMAL_POINT_FOUND then 
  6609.                if CHECK_STR (1..DECIMAL_PLACE - 1) = BLANKS (1..DECIMAL_PLACE 
  6610.                          - 1) then 
  6611.                   CHECK_STR (DECIMAL_PLACE - 1) := '0'; 
  6612.                elsif CHECK_STR (DECIMAL_PLACE + 1..CHECK_STR'LENGTH) = BLANKS 
  6613.                          (DECIMAL_PLACE + 1..CHECK_STR'LENGTH) then 
  6614.                   CHECK_STR (DECIMAL_PLACE + 1) := '0'; 
  6615.                end if; 
  6616.             elsif CHARACTER_FOUND then 
  6617.                DECIMAL_PLACE := LAST_CHAR_PLACE + 1; 
  6618.                CHECK_STR (LAST_CHAR_PLACE + 1..LAST_CHAR_PLACE + 2) := ".0"; 
  6619.             else 
  6620.             -- the entry was blank which is o.k.
  6621.                exit; 
  6622.             end if; 
  6623.          --
  6624.          -- now make certain there is not too many digits following '.'
  6625.          --
  6626.             if CHECK_STR (DECIMAL_PLACE + 2) /= ' ' then 
  6627.                raise PRECISION_ERROR; 
  6628.             end if; 
  6629.          --
  6630.          -- now with real i_o get a real number from the string
  6631.          --
  6632.             GET (FROM => CHECK_STR, ITEM => TEST_REAL, LAST => NUMBER_READ); 
  6633.          -- now see if there is any superfluous data in the field
  6634.          --
  6635.             if NUMBER_READ = CHECK_STR'LENGTH then 
  6636.             -- no need for any further check. everything is a.o.k.
  6637.                null; 
  6638.             elsif CHECK_STR (NUMBER_READ + 1..CHECK_STR'LENGTH) /= BLANKS 
  6639.                       (NUMBER_READ + 1..CHECK_STR'LENGTH) then 
  6640.                raise DATA_ERROR; 
  6641.             end if; 
  6642.          --
  6643.          -- now check that the number is in the specified range
  6644.          --
  6645.             if TEST_REAL < LOW_LIMIT or TEST_REAL > HIGH_LIMIT then 
  6646.                raise CONSTRAINT_ERROR; 
  6647.             end if; 
  6648.          --
  6649.          -- now right justify the string 
  6650.          --
  6651.             LAST_CHAR_PLACE := LAST_CHAR_PLACE - 1; 
  6652.                                                  -- for the str variable
  6653.          --
  6654.             STR2 (STR'LENGTH - LAST_CHAR_PLACE + 1..STR'LENGTH) := STR 
  6655.                       (1..LAST_CHAR_PLACE); 
  6656.             STR := STR2; 
  6657.          --
  6658.          -- and pad with zeros if required
  6659.             if FILL_CHARACTER = '0' then 
  6660.             -- pad with zeros. ( default is padded with blanks)
  6661.                for I in 1..STR'LENGTH loop 
  6662.                   if STR (I) = ' ' then 
  6663.                      STR (I) := '0'; 
  6664.                   end if; 
  6665.                end loop; 
  6666.             end if; 
  6667.          -- 
  6668.             exit;   -- the block construct
  6669.          --
  6670.          exception 
  6671.             when DATA_ERROR => 
  6672.             --
  6673.             -- if not blank then prompt bad input and go get more
  6674.             --
  6675.                if STR = BLANKS (1..STR'LENGTH) then 
  6676.                   exit; 
  6677.                else 
  6678.                   PROMPT (" ILLEGAL INPUT FOR NUMERIC FIELD"); 
  6679.                   COMMAND_FLAG := FALSE; 
  6680.                   COMMAND_GOTTEN := NIL; 
  6681.                   GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6682.                end if; 
  6683.                
  6684.             when CONSTRAINT_ERROR => 
  6685.             --
  6686.                PROMPT (" NUMBER OUT OF RANGE FOR THIS FIELD "); 
  6687.                COMMAND_FLAG := FALSE; 
  6688.                COMMAND_GOTTEN := NIL; 
  6689.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6690.             --
  6691.             when PRECISION_ERROR => 
  6692.             --
  6693.                PROMPT (" NUMBER EXCEEDS REQUIRED PRECISION FOR FIELD "); 
  6694.                CHECK_STR := (1..STR'LENGTH + 3 => ' '); 
  6695.                COMMAND_FLAG := FALSE; 
  6696.                COMMAND_GOTTEN := NIL; 
  6697.                GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6698.             --
  6699.                
  6700.             when ERASE_ERROR => 
  6701.                raise ERASE_ERROR; 
  6702.                
  6703.          end;      -- the block construct
  6704.       end loop; -- for reading until good
  6705.    --
  6706.    --
  6707.    end GET_CONSTRAINED_DECIMAL; 
  6708. --
  6709. -----------------------------------------------------
  6710.    procedure GET_CONSTRAINED_CHARACTER (STR                    : in out STRING; 
  6711.                                         START_OF_FIELD         : POSITIVE; 
  6712.                                         FIRST_CHAR, LAST_CHAR  : in CHARACTER; 
  6713.                                         COMMAND_FLAG           : in out BOOLEAN; 
  6714.                                         COMMAND_GOTTEN         : in out COMMAND; 
  6715.                                         SPACE_ALLOWED          : BOOLEAN := FALSE) 
  6716.              is 
  6717.    --
  6718.    -- declare some local variables
  6719.    --
  6720.       subtype CONSTRAINED_CHARACTER  is CHARACTER range FIRST_CHAR..LAST_CHAR; 
  6721.       TEST_CHAR  : CONSTRAINED_CHARACTER; 
  6722.    --
  6723.    begin 
  6724.       loop -- until no contraint error is raised or alternate exit
  6725.          begin   -- a block construct
  6726.          --
  6727.          -- first read the user input into a string
  6728.          --
  6729.             if COMMAND_FLAG = FALSE then 
  6730.                READ (STR, STR'LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  6731.             end if; 
  6732.             
  6733.             if COMMAND_GOTTEN = ERASE_FIELD then 
  6734.                raise ERASE_ERROR; 
  6735.             end if; 
  6736.          --
  6737.          -- now see if the character was with in the ranges 
  6738.          -- by making an assignment. if it was not in the range,
  6739.          -- a constraint error should be raised
  6740.          --
  6741.             TEST_CHAR := STR (1); 
  6742.          -- 
  6743.             exit;   -- the block construct
  6744.          --
  6745.          exception 
  6746.             when CONSTRAINT_ERROR => 
  6747.             --
  6748.             --if the character is a blank and space allowed thats o.k.
  6749.             --
  6750.                if STR (1) = ' ' and SPACE_ALLOWED then 
  6751.                   exit; 
  6752.                else 
  6753.                   PROMPT (" CHARACTER OUT OF RANGE FOR THIS FIELD "); 
  6754.                   COMMAND_FLAG := FALSE; 
  6755.                   COMMAND_GOTTEN := NIL; 
  6756.                   GOTO_CRT_POSITION (TOP_OF_WORK_AREA, START_OF_FIELD); 
  6757.                end if; 
  6758.             --
  6759.                
  6760.             when ERASE_ERROR => 
  6761.                raise ERASE_ERROR; 
  6762.                
  6763.          end;      -- the block construct
  6764.       end loop; -- for reading until good
  6765.    end GET_CONSTRAINED_CHARACTER; 
  6766.    
  6767. end STATIC_GET_FIELD_UTILITIES; 
  6768. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6769. --linefield.sp
  6770. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6771. package line_field_lists is
  6772.    --
  6773.    --
  6774.    type list_of_lines is (
  6775.                           A,   B,   C,   D,   G,   J,   K,   L,   M,   
  6776.                           N,   P,   Q,   T,   V,   X,   R,   DM1, DN1, 
  6777.                           JM1, KF1, KF2, KF3, KF4, KN1, RM3, TF1, H,   
  6778.                           E,   NIL); 
  6779.    --
  6780.    --
  6781.    -- ALSO, define values for the number of lines, number of characters
  6782.    --       per line, and number of fields per line
  6783.    --
  6784.    
  6785.    MAXIMUM_FIELDS_PER_LINE : positive := 34;
  6786.  
  6787.    MAXIMUM_CHARACTERS_PER_LINE : positive := 80;
  6788.  
  6789.    MAXIMUM_LINES_PER_MESSAGE : positive := 75;
  6790.  
  6791.    type list_of_fields is 
  6792.                                (CARD_NUMBER,      CLASSIFICATION,   
  6793.                                 UAC,              RECORD_ID,        
  6794.                                 UIC,              ORIGINATORS_UIC,  
  6795.                                 MESSAGE_TYPE,     MESSAGE_NUMBER,   
  6796.                                 UDC,              ANAME,            
  6797.                                 UTC,              ULC,              
  6798.                                 MJCOM,            MAJOR,            
  6799.                                 REVAL,            TPSN,             
  6800.                                 SCLAS,            LNAME,            
  6801.                                 COAFF,            MONOR,            
  6802.                                 CSERV,            OPCON,            
  6803.                                 ADCON,            HOGEO,            
  6804.                                 PRGEO,            EMBRK,            
  6805.                                 ACTIV,            FLAG,             
  6806.                                 PUIC,             CBCOM,            
  6807.                                 DFCON,            POINT,            
  6808.                                 NUCIN,            PCTEF,            
  6809.                                 BILET,            CORNK,            
  6810.                                 CONAM,            MMCMD,            
  6811.                                 NTASK,            MODFG,            
  6812.                                 PLETD,            NDEST,            
  6813.                                 DETA,             CXMRS,            
  6814.                                 TCAA,             MEDIA,            
  6815.                                 TADC,             ROUTE,            
  6816.                                 RWDTE,            XRTE,             
  6817.                                 XDATE,            TPERS,            
  6818.                                 PEGEO,            STRUC,            
  6819.                                 AUTH,             ASGD,             
  6820.                                 POSTR,            PICDA,            
  6821.                                 DEPS,             TDEPS,            
  6822.                                 CASPW,            CCASP,            
  6823.                                 CCEBY,            SCATD,            
  6824.                                 MGO,              AGO,              
  6825.                                 NA,               NFO,              
  6826.                                 MENL,             NAVO,             
  6827.                                 NAVE,             OTHOF,            
  6828.                                 OTHEN,            PIAOD,            
  6829.                                 TREAD,            READY,            
  6830.                                 REASN,            PRRAT,            
  6831.                                 PRRES,            ESRAT,            
  6832.                                 ESRES,            ERRAT,            
  6833.                                 ERRES,            TRRAT,            
  6834.                                 TRRES,            SECRN,            
  6835.                                 TERRN,            CARAT,            
  6836.                                 CADAT,            LIM,              
  6837.                                 RLIM,             RICDA,            
  6838.                                 DOCNR,            DOCID,            
  6839.                                 PERTP,            TPAUT,            
  6840.                                 TPASG,            TPAVL,            
  6841.                                 PERTC,            CPAUR,            
  6842.                                 CPASG,            CPAVL,            
  6843.                                 TRUTC,            TMTHD,            
  6844.                                 TCARQ,            TCRAS,            
  6845.                                 TCRAV,            TRSA1,            
  6846.                                 TRSA2,            TRSA3,            
  6847.                                 TRSA4,            TRSA5,            
  6848.                                 EQSEE,            EQSSE,            
  6849.                                 MEARD,            MEASG,            
  6850.                                 MEPOS,            ESSA1,            
  6851.                                 ESSA2,            ESSA3,            
  6852.                                 ESSA4,            ESSA5,            
  6853.                                 ESSA6,            ESSA7,            
  6854.                                 ESSA8,            ESSA9,            
  6855.                                 EQREE,            EQRED,            
  6856.                                 MEMRA,            ERSA1,            
  6857.                                 ERSA2,            ERSA3,            
  6858.                                 ERSA4,            ERSA5,            
  6859.                                 ERSA6,            ERSA7,            
  6860.                                 ERSA8,            SDOC,             
  6861.                                 READF,            REASF,            
  6862.                                 PRRAF,            PRREF,            
  6863.                                 ESRAF,            ESREF,            
  6864.                                 ERRAF,            ERREF,            
  6865.                                 TRRAF,            TRREF,            
  6866.                                 SECRF,            TERRF,            
  6867.                                 CARAF,            CADAF,            
  6868.                                 LIMF,             RLIMF,            
  6869.                                 RICDF,            RESPF,            
  6870.                                 SMCC1,            SMRA1,            
  6871.                                 SMAA1,            SMRC1,            
  6872.                                 SMAC1,            SMCC2,            
  6873.                                 SMRA2,            SMAA2,            
  6874.                                 SMRC2,            SMAC2,            
  6875.                                 SMCC3,            SMRA3,            
  6876.                                 SMAA3,            SMRC3,            
  6877.                                 SMAC3,            SMCC4,            
  6878.                                 SMRA4,            SMAA4,            
  6879.                                 SMRC4,            SMAC4,            
  6880.                                 GCCLA,            GCCLB,            
  6881.                                 GCCLC,            SPCLU,            
  6882.                                 PRMA,             MARAT,            
  6883.                                 MAREA,            CHDAT,            
  6884.                                 FMART,            FCDAT,            
  6885.                                 MEQPT,            FORDV,            
  6886.                                 MEPSA,            METAL,            
  6887.                                 MEPSD,            MEORD,            
  6888.                                 MEORN,            MEORC,            
  6889.                                 MEORO,            CREWA,            
  6890.                                 CREAL,            CREWF,            
  6891.                                 CRMRD,            CRMRN,            
  6892.                                 CRMRC,            CRMRO,            
  6893.                                 MEREC,            TEGEO,            
  6894.                                 PIN,              FRQNO,            
  6895.                                 PLEAC,            DDP,              
  6896.                                 DDPRD,            MDT,              
  6897.                                 PUTCV,            PEQPT,            
  6898.                                 TPGEO,            ALTYP,            
  6899.                                 NUMBR,            NUMEA,            
  6900.                                 ALRET,            NUSEQ,            
  6901.                                 WPNCO,            NUQPT,            
  6902.                                 DSGEO,            NUMWR,            
  6903.                                 NUMWB,            NUGUN,            
  6904.                                 RTIME,            DSSTA,            
  6905.                                 RFGDS,            NUSTO,            
  6906.                                 NUECC,            SEQ,              
  6907.                                 TOT,              LABEL,            
  6908.                                 RMKID,            REMRK,            
  6909.                                 TEQPT,            MESEN,            
  6910.                                 DECON,            MECUS,            
  6911.                                 AVCAT,            RESND,            
  6912.                                 ERDTE,            EXDAC,            
  6913.                                 CPGEO,            CFGEO,            
  6914.                                 EQDEP,            EQARR,            
  6915.                                 TPIN,             TLEAC,            
  6916.                                 TLEQE,            UEQPT,            
  6917.                                 MEQS,             SEDY,             
  6918.                                 TEDY,             ERRDY,            
  6919.                                 AVAIL,            DCNDY,            
  6920.                                 EQRET,            GEOGR,            
  6921.                                 OPERL,            DAFLD,            
  6922.                                 ACGEO,            ACITY,            
  6923.                                 ADATE,            MDATE,            
  6924.                                 RDATE,            GCMD,             
  6925.                                 TDATE,            TRGEO,            
  6926.                                 DEPDT,            ARRDT,            
  6927.                                 RPTOR,            INTR1,            
  6928.                                 INTR2,            SBRPT,            
  6929.                                 ATACH,            NOT_USED,         
  6930.                                 H_CARD_NUMBER,    DAY_OF_MONTH,     
  6931.                                 MONTH,            YEAR,             
  6932.                                 REAL_OR_EXERCISE, NIL        );
  6933.              
  6934.    --
  6935. --
  6936. end line_field_lists;
  6937. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6938. --buildfile.sp
  6939. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6940. package BUILD_FILE is
  6941.    --
  6942.    -- here we will specify a generic routine for building the
  6943.    -- data file which contains the info about each line of a 
  6944.    -- given message type. This package need only be used once
  6945.    -- at the instantiation of a new mesage editor.
  6946.    --
  6947. --   generic 
  6948.       --
  6949.       -- first pass the list of all lines for the message type
  6950.       -- in the form of an enumerated type.
  6951.       --
  6952. --      type LIST_OF_LINES is (<>); 
  6953.       --
  6954.       -- second pass the list of all field names for the message type
  6955.       -- in the form of an enumerated type.
  6956.       --
  6957. --      type LIST_OF_FIELDS is (<>);
  6958.       --
  6959.       -- now pass the total number of characters which the longest line
  6960.       -- of the given message type may be.
  6961.       --
  6962. --      MAXIMUM_CHARACTERS_PER_LINE : INTEGER;
  6963.       --
  6964.       -- now pass the maximum number of fields a line of the given
  6965.       -- type may contain.
  6966.       --
  6967. --      MAXIMUM_FIELDS_PER_LINE : INTEGER;
  6968.       --
  6969.    procedure FILE_BUILDER;
  6970. --
  6971. end BUILD_FILE;
  6972. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6973. --buildfile.txt
  6974. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6975. with text_io; 
  6976. with direct_io;
  6977. with line_field_lists;  use line_field_lists;
  6978. --
  6979. package body BUILD_FILE is
  6980.    --
  6981.    -- here we will provide a generic routine for building the
  6982.    -- data file which contains the info about each line of a 
  6983.    -- given message type. This package need only be used once
  6984.    -- at the instantiation of a new mesage editor.
  6985.    --
  6986.    procedure FILE_BUILDER is
  6987.       --
  6988.       -- first define the identifiers necessary for outputing the data
  6989.       -- to the destination file.
  6990.       --
  6991.       temp_field_name : list_of_fields := nil;
  6992.       tmp_int : integer;
  6993.       type line_component is
  6994.       record
  6995.          field_name     : natural := 0;
  6996.          field_position : natural := 1;
  6997.          field_length   : natural := 1;
  6998.          required_flag  : boolean := false;
  6999.       end record;
  7000.       --
  7001.       -- 34 fields is a kludge but good enough for RAINFORM and unitrep
  7002.       type line_component_array is array(1..34) of line_component;
  7003.       --
  7004.       type line_definition is 
  7005.       record
  7006.          number_of_fields : natural := maximum_fields_per_line;
  7007.          prototype_line   : string(1..80) := (1..80=> ' ');
  7008.          component        : line_component_array ;
  7009.       end record;
  7010.       --
  7011.       line_info             : line_definition;
  7012.       initialized_line_info : line_definition;
  7013.       --
  7014.       package DESTINATION_IO is new DIRECT_IO( LINE_DEFINITION );
  7015.       use DESTINATION_IO;
  7016.       destination_file : destination_io.file_type;
  7017.       record_number    : destination_io.positive_count;
  7018.       --
  7019.       --
  7020.       -- then define the identifiers necessary for reading the source 
  7021.       -- file and validating its contents.
  7022.       --
  7023.       use text_io;
  7024.       package FIELD_IO    is new  ENUMERATION_IO( LIST_OF_FIELDS ); 
  7025.       package LINE_IO     is new  ENUMERATION_IO( LIST_OF_LINES );
  7026.       package BOOLEAN_IO  is new  ENUMERATION_IO( BOOLEAN );
  7027.       package INT_IO      is new  INTEGER_IO( INTEGER );
  7028.       package COUNT_IO    is new  INTEGER_IO( TEXT_IO.COUNT );
  7029.       use FIELD_IO;
  7030.       use LINE_IO;
  7031.       use BOOLEAN_IO;
  7032.       use INT_IO;
  7033.       use COUNT_IO;
  7034.       --
  7035.       filename          : string(1..9) := (others => ' ');
  7036.       source_file       : text_io.file_type;
  7037.       current_column    : text_io.positive_count;
  7038.       current_line_name : list_of_lines;
  7039.       current_position  : integer;
  7040.       temp_char         : character;
  7041.       proto_started     : boolean;
  7042.       source_string     : string(1..256);
  7043.       amount            : natural;
  7044.       last              : positive;
  7045.       front,back        : positive;
  7046.       --
  7047.       BAD_LINE_IN_SOURCE_FILE : exception;
  7048.       --
  7049.    begin
  7050.       put_line(" ");
  7051.       put_line(" Enter the file name to use for input and output");
  7052.       put(" .sce and .des will be appended automatically: ");
  7053.       get(filename);
  7054.       --
  7055.       -- open up the file of which the source data is contained
  7056.       --
  7057.       text_io.open(source_file,in_file,filename&".sce");
  7058.       --
  7059.       -- create the direct access destination file
  7060.       --
  7061.       begin
  7062.          destination_io.open
  7063.          (destination_file,out_file,filename&".des");
  7064.       exception
  7065.          when DESTINATION_IO.NAME_ERROR =>
  7066.          destination_io.create
  7067.          (destination_file,out_file,filename&".des");
  7068.       end; -- block consttruct
  7069.       --
  7070.       -- now set up a loop for reading the info for each line until
  7071.       -- end of file.
  7072.       --
  7073.       while not end_of_file(source_file) loop
  7074.          --
  7075.          -- init the line_info record
  7076.          --
  7077.          line_info := initialized_line_info;
  7078.          --
  7079.          -- first get the line name as an enumerated type
  7080.          --
  7081.          loop
  7082.          --
  7083.             begin
  7084.                get_line(source_file,source_string,amount);
  7085.                for I in 1..AMOUNT loop
  7086.                   if SOURCE_STRING(I) /= ' ' then
  7087.                      FRONT := I;
  7088.                      EXIT;
  7089.                   end if;
  7090.                end loop;
  7091.                BACK := AMOUNT;
  7092.                for I in FRONT .. AMOUNT loop
  7093.                   if SOURCE_STRING(I) = ' ' or SOURCE_STRING(I) = ','
  7094.                   then
  7095.                      BACK := I-1;
  7096.                      exit;
  7097.                   end if;
  7098.                end loop;
  7099.                --
  7100.                CURRENT_LINE_NAME :=
  7101.                   LIST_OF_LINES'value(SOURCE_STRING(FRONT..BACK));
  7102.                exit;
  7103.                --
  7104.             exception
  7105.                when CONSTRAINT_ERROR =>
  7106.                   if source_string(1..2) /= "--" then
  7107.                      -- not a comment line so bad
  7108.                      put_line(" ERROR READING LINE NAME...");
  7109.                      raise BAD_LINE_IN_SOURCE_FILE;
  7110.                   else
  7111.                      -- comment line so just go on and read next line
  7112.                      null;
  7113.                   end if;
  7114.             end; -- block statement
  7115.          end loop;
  7116.          --
  7117.          -- now get the number of fields for the line
  7118.          --
  7119.          loop
  7120.          --
  7121.             begin
  7122.                get_line(source_file,source_string,amount);
  7123.                get(source_string(1..amount),line_info.number_of_fields,
  7124.                                                                  last);
  7125.                exit;
  7126.             exception
  7127.                when TEXT_IO.DATA_ERROR =>
  7128.                   if source_string(1..2) /= "--" then
  7129.                      -- not a comment line so bad
  7130.                      put_line(" ERROR READING NUMBER OF FIELDS...");
  7131.                      raise BAD_LINE_IN_SOURCE_FILE;
  7132.                   else
  7133.                      -- comment line so go read next line
  7134.                      null;
  7135.                   end if;
  7136.             end; -- block statement
  7137.          end loop;
  7138.          --
  7139.          -- now get the prototype line
  7140.          --
  7141.          current_position := 1;
  7142.          proto_started := false;
  7143.          --
  7144.          loop
  7145.          --
  7146.             get(source_file,temp_char);
  7147.             if temp_char = '"' then
  7148.                --
  7149.                -- this character either represents the start of a 
  7150.                -- prototype line or the end of one
  7151.                --
  7152.                if not proto_started then
  7153.                   -- start of proto
  7154.                   proto_started := true;
  7155.                else
  7156.                   -- end proto but we may continue on the next line
  7157.                   get_line(source_file,source_string,amount);
  7158.                   if source_string(1) = '&' then
  7159.                      -- we have found a continuation character
  7160.                      proto_started := false;
  7161.                   else
  7162.                      exit; -- loop because we're done with prototype
  7163.                   end if;
  7164.                   --
  7165.                end if;
  7166.                --
  7167.             else
  7168.                --
  7169.                if not proto_started then
  7170.                   -- any character is illegal except space or comment
  7171.                   --
  7172.                   if temp_char = ' ' then
  7173.                      null; -- every thing is o.k.
  7174.                   elsif temp_char = '-' and col(source_file) <= 2 then
  7175.                      get(source_file,temp_char);
  7176.                      if temp_char = '-' then -- definitely a comment
  7177.                         skip_line(source_file);
  7178.                      else
  7179.                         put_line(" ERROR READING PROTOTYPE LINE... ");
  7180.                         skip_line(source_file);
  7181.                         raise BAD_LINE_IN_SOURCE_FILE;
  7182.                      end if;
  7183.                   else
  7184.                      put_line(" ERROR READING PROTOTYPE LINE... ");
  7185.                      skip_line(source_file);
  7186.                      raise BAD_LINE_IN_SOURCE_FILE;
  7187.                   end if;
  7188.                   --
  7189.                else
  7190.                   -- proto started is true so any ascii character is
  7191.                   -- legal
  7192.                   --
  7193.                   line_info.prototype_line(current_position) := 
  7194.                                                       temp_char;
  7195.                   current_position := current_position + 1;
  7196.                   --
  7197.                   -- make certain the proto line doesn't get longer 
  7198.                   -- then allowed 
  7199.                   --
  7200.                   if current_position > maximum_characters_per_line
  7201.                   then
  7202.                      skip_line(source_file);
  7203.                      exit; -- loop
  7204.                   end if;
  7205.                   --
  7206.                end if;
  7207.                --
  7208.             end if;
  7209.             --
  7210.          end loop;
  7211.          --
  7212.          -- now loop for each field and get the info
  7213.          --
  7214.          for i in 1 .. line_info.number_of_fields loop
  7215.             --
  7216.             loop
  7217.                --
  7218.                begin
  7219.                   get_line(source_file,source_string,amount);
  7220.                   for I in 1..AMOUNT loop
  7221.                      if SOURCE_STRING(I) /= ' ' then
  7222.                         FRONT := I;
  7223.                         EXIT;
  7224.                      end if;
  7225.                   end loop;
  7226.                   BACK := AMOUNT;
  7227.                   for I in FRONT .. AMOUNT loop
  7228.                      if SOURCE_STRING(I) = ' ' or SOURCE_STRING(I) = ','
  7229.                      then
  7230.                         BACK := I-1;
  7231.                         exit;
  7232.                      end if;
  7233.                   end loop;
  7234.                   --
  7235.                   TEMP_FIELD_NAME :=
  7236.                      LIST_OF_FIELDS'value(SOURCE_STRING(FRONT..BACK));
  7237.                   LAST := BACK;
  7238.                  --
  7239.                  line_info.component(i).field_name := 
  7240.                      list_of_fields'pos(temp_field_name);
  7241.                  --
  7242.                  get(source_string(last+2..amount),
  7243.                      line_info.component(i).field_position,last);
  7244.                  --
  7245.                  get(source_string(last+2..amount),
  7246.                      line_info.component(i).field_length,last);
  7247.                  --
  7248.                  get(source_string(last+2..amount),
  7249.                      line_info.component(i).required_flag,last);
  7250.                  exit;
  7251.                  --
  7252.                exception
  7253.                   when CONSTRAINT_ERROR | TEXT_IO.DATA_ERROR =>
  7254.                      if source_string(1..2) /= "--" then
  7255.                         -- not a comment line so bad
  7256.                         put_line(" ERROR READING FIELD INFO... ");
  7257.                         raise BAD_LINE_IN_SOURCE_FILE;
  7258.                      else
  7259.                         -- comment line so just get next line
  7260.                         null;
  7261.                      end if;
  7262.                end; -- block statement
  7263.             end loop;
  7264.             --
  7265.          end loop;
  7266.          --
  7267.          -- now put the info to the direct access destination file.
  7268.          --
  7269.          put("calculating record number -");
  7270.          record_number := destination_io.count
  7271.                        (list_of_lines'pos(current_line_name) + 1);
  7272.          put(" writing to file ");
  7273.          write(destination_file,line_info,record_number);
  7274.          put_line(" successfully.");
  7275.          --
  7276.          -- for debug purposes it helps to enable the following 
  7277.          -- commented lines
  7278.          --
  7279.          put_line(" ");
  7280.          put(current_line_name);
  7281.          put_line(" ");
  7282. --         put(line_info.number_of_fields);
  7283. --         put_line(" ");
  7284. --         put_line(line_info.prototype_line);
  7285. --         for j in 1 .. line_info.number_of_fields loop
  7286. --            put(line_info.component(j).field_name);
  7287. --            put("  ");
  7288. --            put(line_info.component(j).field_position);
  7289. --            put("  ");
  7290. --            put(line_info.component(j).field_length);
  7291. --            put("  ");
  7292. --            put(line_info.component(j).required_flag);
  7293. --            put_line(" ");
  7294. --         end loop;
  7295.          --
  7296.          --
  7297.       end loop;  -- while not eof
  7298.       --
  7299.       raise TEXT_IO.END_ERROR;
  7300.       --
  7301.       -- there are to exceptions we need to handle
  7302.       --
  7303.       exception
  7304.          when TEXT_IO.DATA_ERROR =>
  7305.             --
  7306.             put(" ERROR IN SOURCE FILE ON LINE #");
  7307.             put(line(source_file) - 1);
  7308.             put_line("."); 
  7309.             --
  7310.          when TEXT_IO.END_ERROR =>
  7311.             --
  7312.             put(" END OF SOURCE FILE REACHED. ");
  7313.             put(line(source_file) -1);
  7314.             put_line(" LINES PROCESSED.");
  7315.             --
  7316.          when BAD_LINE_IN_SOURCE_FILE =>
  7317.             --
  7318.             put(" ERROR IN SOURCE FILE ON LINE #");
  7319.             put(line(source_file) - 1);
  7320.             put_line("."); 
  7321.             --
  7322.          when TEXT_IO.NAME_ERROR =>
  7323.             --
  7324.             put_line(" ERROR IN OPENING SOURCE FILE (name_error).");
  7325.             --
  7326.          when TEXT_IO.USE_ERROR =>
  7327.             --
  7328.             put_line(" ERROR IN OPENING SOURCE FILE (use_error).");
  7329.             --
  7330.       -- end exceptions
  7331.    end FILE_BUILDER;
  7332. --
  7333. begin
  7334.    null;
  7335. end BUILD_FILE;
  7336. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7337. --linemaker.txt
  7338. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7339. with build_file; use build_file;
  7340. procedure line_maker is
  7341. --
  7342. begin
  7343.     file_builder;
  7344. end line_maker;
  7345. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7346. --buildpmt.sp
  7347. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7348. package BUILD_PROMPT_FILE is
  7349.    --
  7350.    -- here we will specify a routine for building the
  7351.    -- data file which contains the info about each prompt of a 
  7352.    -- given message type. This package need only be used once
  7353.    -- at the instantiation of a new mesage editor.
  7354.    --
  7355.    procedure PROMPT_FILE_BUILDER( 
  7356.                          maximum_characters_per_line : in integer;
  7357.                          max_amp_lines : in integer);
  7358. --
  7359. end BUILD_PROMPT_FILE;
  7360. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7361. --pmtmaker.txt
  7362. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7363. with build_prompt_file; use build_prompt_file;
  7364. procedure prompt_maker is
  7365. --
  7366. begin
  7367.     prompt_file_builder(80,5);
  7368. end prompt_maker;
  7369. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7370. --buildlut.sp
  7371. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7372. package BUILD_LUT is
  7373.    --
  7374.    -- here we will specify a generic routine for building the
  7375.    -- data file which contains the info about each line of a 
  7376.    -- given message type. This package need only be used once
  7377.    -- at the instantiation of a new mesage editor.
  7378.    --
  7379. --   generic 
  7380.       --
  7381.       -- first pass the list of all lines for the message type
  7382.       -- in the form of an enumerated type.
  7383.       --
  7384. --      type LIST_OF_LINES is (<>); 
  7385.       --
  7386.       -- now pass the maximum number of fields a line of the given
  7387.       -- type may contain.
  7388.       --
  7389. --      MAXIMUM_FIELDS_PER_LINE : INTEGER;
  7390.       --
  7391.    procedure LUT_BUILDER;
  7392. --
  7393. end BUILD_LUT;
  7394. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7395. --buildlut.txt
  7396. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7397. with text_io; 
  7398. with direct_io;
  7399. with line_field_lists;  use line_field_lists;
  7400. --
  7401. package body BUILD_LUT is
  7402.    --
  7403.    -- here we will provide a generic routine for building the
  7404.    -- data file which contains the info about each line of a 
  7405.    -- given message type. This package need only be used once
  7406.    -- at the instantiation of a new mesage editor.
  7407.    --
  7408.    procedure LUT_BUILDER is
  7409.       --
  7410.       -- first define the identifiers necessary for outputing the data
  7411.       -- to the destination file.
  7412.       --
  7413.       tmp_int : integer;
  7414.       type lut_component is array(1..34) of integer;
  7415.       --
  7416.       lut_info              : lut_component;
  7417.       initialized_lut_info  : lut_component := (others => 0);
  7418.       --
  7419.       package DESTINATION_IO is new DIRECT_IO( lut_component );
  7420.       use DESTINATION_IO;
  7421.       destination_file : destination_io.file_type;
  7422.       record_number    : destination_io.positive_count;
  7423.       --
  7424.       --
  7425.       -- then define the identifiers necessary for reading the source 
  7426.       -- file and validating its contents.
  7427.       --
  7428.       use text_io;
  7429.       package LINE_IO     is new  ENUMERATION_IO( LIST_OF_LINES );
  7430.       package INT_IO      is new  INTEGER_IO( INTEGER );
  7431.       package COUNT_IO    is new  INTEGER_IO( TEXT_IO.COUNT );
  7432.       use LINE_IO;
  7433.       use INT_IO;
  7434.       use COUNT_IO;
  7435.       --
  7436.       filename          : string(1..9);
  7437.       source_file       : text_io.file_type;
  7438.       current_column    : text_io.positive_count;
  7439.       current_line_name : list_of_lines;
  7440.       current_position  : integer;
  7441.       temp_char         : character;
  7442.       source_string     : string(1..256);
  7443.       blanks            : string(1..256) := (others => ' ');
  7444.       amount            : natural;
  7445.       last              : positive;
  7446.       front,back        : positive;
  7447.       start_pos         : positive;
  7448.       --
  7449.       BAD_LINE_IN_SOURCE_FILE : exception;
  7450.       --
  7451.    begin
  7452.       --
  7453.       put_line(" ");
  7454.       put_line(" Enter the file name to use for input and output");
  7455.       put(" .sce and .des will be appended automatically: ");
  7456.       get(filename);
  7457.       --
  7458.       -- open up the file of which the source data is contained
  7459.       --
  7460.       text_io.open(source_file,in_file,filename&".sce");
  7461.       --
  7462.       -- create the direct access destination file
  7463.       --
  7464.       begin
  7465.          destination_io.open
  7466.          (destination_file,out_file,filename&".des");
  7467.       exception
  7468.          when DESTINATION_IO.NAME_ERROR =>
  7469.             destination_io.create
  7470.             (destination_file,out_file,filename&".des");
  7471.          when DESTINATION_IO.STATUS_ERROR =>
  7472.             destination_io.create
  7473.             (destination_file,out_file,filename&".des");
  7474.       end; -- block construct
  7475.       --
  7476.       -- now set up a loop for reading the info for each line until
  7477.       -- end of file.
  7478.       --
  7479.       record_number := 1;
  7480.       --
  7481.       while not end_of_file(source_file) loop
  7482.          --
  7483.          -- init the lut_info record
  7484.          --
  7485.          lut_info := initialized_lut_info;
  7486.          --
  7487.          -- first get the line name as an enumerated type
  7488.          --
  7489.          loop
  7490.          --
  7491.             begin
  7492.                get_line(source_file,source_string,amount);
  7493.                for I in 1 .. AMOUNT loop
  7494.                   if SOURCE_STRING(I) /= ' ' then
  7495.                      FRONT := I;
  7496.                      exit;
  7497.                   end if;
  7498.                end loop;
  7499.                BACK := AMOUNT;
  7500.                for I in FRONT .. AMOUNT loop
  7501.                   if SOURCE_STRING(I) = ' ' or SOURCE_STRING(I) = ','
  7502.                   then
  7503.                      BACK := I-1;
  7504.                      exit;
  7505.                   end if;
  7506.                end loop;
  7507.                LAST := BACK;
  7508.                CURRENT_LINE_NAME :=
  7509.                    LIST_OF_LINES'value(SOURCE_STRING(FRONT .. BACK));
  7510.                exit;
  7511.                --
  7512.             exception
  7513.                when CONSTRAINT_ERROR =>
  7514.                   if source_string(1..2) /= "--" then
  7515.                      -- not a comment line so bad or special
  7516.                      if record_number = 1 then
  7517.                         last := 7;
  7518.                         exit; -- special line
  7519.                      else
  7520.                         put_line(" ERROR READING LINE NAME...");
  7521.                         raise BAD_LINE_IN_SOURCE_FILE;
  7522.                      end if;
  7523.                   else
  7524.                      -- comment line so just go on and read next line
  7525.                      null;
  7526.                   end if;
  7527.             end; -- block statement
  7528.          end loop;
  7529.          --
  7530.          -- now get the lut entry for each field of the line
  7531.          --
  7532.          for i in 1 .. 34 loop
  7533.          --
  7534.             begin
  7535.                --
  7536.                start_pos := last + 2;
  7537.                if start_pos <= amount then
  7538.                  get(source_string(start_pos..amount),lut_info(i),last);
  7539.                else
  7540.                   exit;
  7541.                end if;
  7542.             exception
  7543.                when TEXT_IO.DATA_ERROR =>
  7544.                   if source_string(start_pos..amount) = 
  7545.                                    blanks(start_pos..amount) then
  7546.                      exit;
  7547.                   else
  7548.                      raise BAD_LINE_IN_SOURCE_FILE;
  7549.                   end if;
  7550.             end; -- block statement
  7551.          end loop;
  7552.          --
  7553.          -- now put the info to the direct access destination file.
  7554.          --
  7555.          put("calculating record number -");
  7556.          if record_number = 1 then
  7557.             write(destination_file,lut_info,record_number);
  7558.             record_number := 2;
  7559.          else
  7560.             record_number := destination_io.count
  7561.                        (list_of_lines'pos(current_line_name) + 2);
  7562.             write(destination_file,lut_info,record_number);
  7563.          end if;
  7564.          --
  7565.          --
  7566.          --
  7567.       end loop;  -- while not eof
  7568.       --
  7569.       raise TEXT_IO.END_ERROR;
  7570.       --
  7571.       -- there are to exceptions we need to handle
  7572.       --
  7573.       exception
  7574.          when TEXT_IO.DATA_ERROR =>
  7575.             --
  7576.             put(" ERROR IN SOURCE FILE ON LINE #");
  7577.             put(line(source_file) - 1);
  7578.             put_line("."); 
  7579.             --
  7580.          when TEXT_IO.END_ERROR =>
  7581.             --
  7582.             put(" END OF SOURCE FILE REACHED. ");
  7583.             put(line(source_file) -1);
  7584.             put_line(" LINES PROCESSED.");
  7585.             --
  7586.          when BAD_LINE_IN_SOURCE_FILE =>
  7587.             --
  7588.             put(" ERROR IN SOURCE FILE ON LINE #");
  7589.             put(line(source_file) - 1);
  7590.             put_line("."); 
  7591.             --
  7592.          when TEXT_IO.NAME_ERROR =>
  7593.             --
  7594.             put_line(" ERROR IN OPENING SOURCE FILE (name_error).");
  7595.             --
  7596.          when TEXT_IO.USE_ERROR =>
  7597.             --
  7598.             put_line(" ERROR IN OPENING SOURCE FILE (use_error).");
  7599.             --
  7600.       -- end exceptions
  7601.    end LUT_BUILDER;
  7602. --
  7603. begin
  7604.    null;
  7605. end BUILD_LUT;
  7606. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7607. --lutmaker.txt
  7608. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7609. with build_lut; use build_lut;
  7610. procedure lut_maker is
  7611. --
  7612. begin
  7613.     lut_builder;
  7614. end lut_maker;
  7615. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7616. --buildpmt.txt
  7617. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7618. with text_io; 
  7619. with direct_io;
  7620. with terminal_definition;    use terminal_definition;
  7621. --
  7622. package body BUILD_PROMPT_FILE is
  7623.    --
  7624.    -- here we will provide a generic routine for building the
  7625.    -- data file which contains the info about each line of a 
  7626.    -- given message type. This package need only be used once
  7627.    -- at the instantiation of a new mesage editor.
  7628.    --
  7629.    procedure PROMPT_FILE_BUILDER(
  7630.                          maximum_characters_per_line : in integer;
  7631.                          max_amp_lines : in integer) is
  7632.       --
  7633.       -- first define the identifiers necessary for outputing the data
  7634.       -- to the destination file.
  7635.       --
  7636.       type amp_component is
  7637.       record
  7638.          location:  crt_position := (row => 2, column => 1);
  7639.          amp     : string(1..80) := (1..80 => ' ');
  7640.       end record;
  7641.       --
  7642.       type amp_component_array is array(1..max_amp_lines)
  7643.                                          of amp_component;
  7644.       --
  7645.       type prompt_definition is 
  7646.       record
  7647.          prompt_line_length  : integer := 0;
  7648.          prompt_line         : string(1..80) := (1..80 => ' ');
  7649.          number_of_amp_lines : natural := max_amp_lines;
  7650.          component           : amp_component_array ;
  7651.       end record;
  7652.       --
  7653.       prompt_info             : prompt_definition;
  7654.       initialized_prompt_info : prompt_definition;
  7655.       --
  7656.       package DESTINATION_IO is new DIRECT_IO( prompt_definition );
  7657.       use DESTINATION_IO;
  7658.       destination_file : destination_io.file_type;
  7659.       record_number    : destination_io.positive_count;
  7660.       --
  7661.       --
  7662.       -- then define the identifiers necessary for reading the source 
  7663.       -- file and validating its contents.
  7664.       --
  7665.       use text_io;
  7666.       package INT_IO      is new  INTEGER_IO( INTEGER );
  7667.       package COUNT_IO    is new  INTEGER_IO( TEXT_IO.COUNT );
  7668.       use INT_IO;
  7669.       use COUNT_IO;
  7670.       --
  7671.       filename          : string(1..9);
  7672.       prompt_started    : boolean;
  7673.       amp_started       : boolean;
  7674.       source_file       : text_io.file_type;
  7675.       current_column    : text_io.positive_count;
  7676.       current_position  : integer;
  7677.       temp_char         : character;
  7678.       source_string     : string(1..256);
  7679.       amount            : natural;
  7680.       last              : positive;
  7681.       next_char         : positive;
  7682.       --
  7683.       BAD_LINE_IN_SOURCE_FILE : exception;
  7684.       --
  7685.    begin
  7686.       put_line(" ");
  7687.       put_line(" Enter the file name to use for input and output");
  7688.       put(" .sce and .des will be appended automatically: ");
  7689.       get(filename);
  7690.       --
  7691.       -- open up the file of which the source data is contained
  7692.       --
  7693.       text_io.open(source_file,in_file,filename&".sce");
  7694.       --
  7695.       -- create the direct access destination file
  7696.       --
  7697.       begin
  7698.          destination_io.open
  7699.          (destination_file,out_file,filename&".des");
  7700.       exception
  7701.          when DESTINATION_IO.NAME_ERROR =>
  7702.          destination_io.create
  7703.                       (destination_file,out_file,filename&".des");
  7704.       end; -- block consttruct
  7705.       --
  7706.       -- now set up a loop for reading the info for each line until
  7707.       -- end of file.
  7708.       --
  7709.       record_number := 1;
  7710.       while not end_of_file(source_file) loop
  7711.          --
  7712.          -- init the prompt_info record
  7713.          --
  7714.          prompt_info := initialized_prompt_info;
  7715.          --
  7716.          -- now get the prompttype line
  7717.          --
  7718.          current_position := 1;
  7719.          prompt_started := false;
  7720.          --
  7721.          loop
  7722.          --
  7723.             get(source_file,temp_char);
  7724.             if temp_char = '"' then
  7725.                --
  7726.                -- this character either represents the start of a 
  7727.                -- prompt or the end of one
  7728.                --
  7729.                if not prompt_started then
  7730.                   -- start of prompt
  7731.                   prompt_started := true;
  7732.                else
  7733.                   -- end prompt but we may continue on the next line
  7734.                   get_line(source_file,source_string,amount);
  7735.                   if source_string(1) = '&' then
  7736.                      -- we have found a continuation character
  7737.                      prompt_started := false;
  7738.                   else
  7739.                      exit; -- loop because we're done with prompt
  7740.                   end if;
  7741.                   --
  7742.                end if;
  7743.                --
  7744.             else
  7745.                --
  7746.                if not prompt_started then
  7747.                   -- any character is illegal except space or comment
  7748.                   --
  7749.                   if temp_char = ' ' then
  7750.                      null; -- every thing is o.k.
  7751.                   elsif temp_char = '-' and col(source_file) <= 2 then
  7752.                      get(source_file,temp_char);
  7753.                      if temp_char = '-' then -- definitely a comment
  7754.                         skip_line(source_file);
  7755.                      else
  7756.                         put_line(" ERROR READING PROMPT LINE... ");
  7757.                         skip_line(source_file);
  7758.                         raise BAD_LINE_IN_SOURCE_FILE;
  7759.                      end if;
  7760.                   else
  7761.                      put_line(" ERROR READING PROMPT LINE... ");
  7762.                      skip_line(source_file);
  7763.                      raise BAD_LINE_IN_SOURCE_FILE;
  7764.                   end if;
  7765.                   --
  7766.                else
  7767.                   -- prompt started is true so any ascii character is
  7768.                   -- legal
  7769.                   --
  7770.                   prompt_info.prompt_line(current_position) := 
  7771.                                                       temp_char;
  7772.                   current_position := current_position + 1;
  7773.                   --
  7774.                   -- make certain the prompt line doesn't get longer 
  7775.                   -- then allowed 
  7776.                   --
  7777.                   if current_position > maximum_characters_per_line
  7778.                   then
  7779.                      skip_line(source_file);
  7780.                      exit; -- loop
  7781.                   end if;
  7782.                   --
  7783.                end if;
  7784.                --
  7785.             end if;
  7786.             --
  7787.          end loop;
  7788.          prompt_info.prompt_line_length := current_position - 1;
  7789.          --
  7790.          -- now get the number of amps for the prompt
  7791.          --
  7792.          loop
  7793.          --
  7794.             begin
  7795.                get_line(source_file,source_string,amount);
  7796.                get(source_string(1..amount),
  7797.                    prompt_info.number_of_amp_lines,last);
  7798.                exit;
  7799.             exception
  7800.                when TEXT_IO.DATA_ERROR =>
  7801.                   if source_string(1..2) /= "--" then
  7802.                      -- not a comment line so bad
  7803.                      put_line(" ERROR READING NUMBER OF AMPS...");
  7804.                      raise BAD_LINE_IN_SOURCE_FILE;
  7805.                   else
  7806.                      -- comment line so go read next line
  7807.                      null;
  7808.                   end if;
  7809.             end; -- block statement
  7810.          end loop;
  7811.          --
  7812.          -- now loop for each field and get the info
  7813.          --
  7814.          for i in 1 .. prompt_info.number_of_amp_lines loop
  7815.             --
  7816.             loop
  7817.                --
  7818.                begin
  7819.                  get_line(source_file,source_string,amount);
  7820.                  get(source_string(1..amount),
  7821.                      prompt_info.component(i).location.row,last);
  7822.                  --
  7823.                  get(source_string(last+2..amount),
  7824.                      prompt_info.component(i).location.column,last);
  7825.                  --
  7826.                  current_position := 1;
  7827.                  amp_started := false;
  7828.                  --
  7829.                  next_char := last + 2;
  7830.                  loop
  7831.                  --
  7832.                     temp_char := source_string(next_char);
  7833.                     next_char := next_char + 1;
  7834.                     if temp_char = '"' then
  7835.                        --
  7836.                        -- this character either represents the start of
  7837.                        -- amp or the end of one
  7838.                        --
  7839.                        if not amp_started then
  7840.                           -- start of amp
  7841.                           amp_started := true;
  7842.                        else
  7843.                           exit; -- loop because we done with prompt
  7844.                           --
  7845.                        end if;
  7846.                        --
  7847.                     else
  7848.                        --
  7849.                        if not amp_started then
  7850.                           -- any character is illegal except space or 
  7851.                           -- comment
  7852.                           --
  7853.                           if temp_char = ' ' then
  7854.                              null; -- every thing is o.k.
  7855.                           elsif temp_char = '-' and 
  7856.                                 col(source_file) <= 2 then
  7857.                              --
  7858.                              temp_char := source_string(next_char);
  7859.                              next_char := next_char + 1;
  7860.                              if temp_char = '-' then 
  7861.                                 -- definitely a comment
  7862.                                 skip_line(source_file);
  7863.                              else
  7864.                                 put_line(" ERROR READING AMP LINE... ");
  7865.                                 skip_line(source_file);
  7866.                                 raise BAD_LINE_IN_SOURCE_FILE;
  7867.                              end if;
  7868.                           else
  7869.                              put_line(" ERROR READING AMP LINE... ");
  7870.                              skip_line(source_file);
  7871.                              raise BAD_LINE_IN_SOURCE_FILE;
  7872.                           end if;
  7873.                           --
  7874.                        else
  7875.                           -- prompt started is true so any ascii 
  7876.                           -- character is legal
  7877.                           --
  7878.                           prompt_info.component(i).amp(current_position)
  7879.                                      := temp_char;
  7880.                           current_position := current_position + 1;
  7881.                           --
  7882.                           -- make certain the prompt line doesn't get 
  7883.                           -- longer then allowed 
  7884.                           --
  7885.                           if current_position > 
  7886.                                       maximum_characters_per_line then
  7887.                              skip_line(source_file);
  7888.                              exit; -- loop
  7889.                           end if;
  7890.                           --
  7891.                        end if;
  7892.                        --
  7893.                     end if;
  7894.                     --
  7895.                  end loop;
  7896.  
  7897.                  exit;
  7898.                  --
  7899.                exception
  7900.                   when TEXT_IO.DATA_ERROR =>
  7901.                      if source_string(1..2) /= "--" then
  7902.                         -- not a comment line so bad
  7903.                         put_line(" ERROR READING FIELD INFO... ");
  7904.                         raise BAD_LINE_IN_SOURCE_FILE;
  7905.                      else
  7906.                         -- comment line so just get next line
  7907.                         null;
  7908.                      end if;
  7909.                end; -- block statement
  7910.             end loop;
  7911.             --
  7912.          end loop;
  7913.          --
  7914.          -- now put the info to the direct access destination file.
  7915.          --
  7916.          put(" writing to file ");
  7917.          write(destination_file,prompt_info,record_number);
  7918.          put_line(" successfully.");
  7919.          record_number := record_number + 1;
  7920.          --
  7921.          --
  7922.       end loop;  -- while not eof
  7923.       --
  7924.       raise TEXT_IO.END_ERROR;
  7925.       --
  7926.       -- there are to exceptions we need to handle
  7927.       --
  7928.       exception
  7929.          when TEXT_IO.DATA_ERROR =>
  7930.             --
  7931.             put(" ERROR IN SOURCE FILE ON LINE #");
  7932.             put(line(source_file) - 1);
  7933.             put_line("."); 
  7934.             --
  7935.          when TEXT_IO.END_ERROR =>
  7936.             --
  7937.             put(" END OF SOURCE FILE REACHED. ");
  7938.             put(line(source_file) -1);
  7939.             put_line(" LINES PROCESSED.");
  7940.             --
  7941.          when BAD_LINE_IN_SOURCE_FILE =>
  7942.             --
  7943.             put(" ERROR IN SOURCE FILE ON LINE #");
  7944.             put(line(source_file) - 1);
  7945.             put_line("."); 
  7946.             --
  7947.          when TEXT_IO.NAME_ERROR =>
  7948.             --
  7949.             put_line(" ERROR IN OPENING SOURCE FILE (name_error).");
  7950.             --
  7951.          when TEXT_IO.USE_ERROR =>
  7952.             --
  7953.             put_line(" ERROR IN OPENING SOURCE FILE (use_error).");
  7954.             --
  7955.       -- end exceptions
  7956.    end PROMPT_FILE_BUILDER;
  7957. --
  7958. begin
  7959.    null;
  7960. end BUILD_PROMPT_FILE;
  7961. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7962. --dirbuild.txt
  7963. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7964.  
  7965. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  7966. --                                                                    --
  7967. --            Program unit:  PROCEDURE DIRECTORY_BUILD                --
  7968. --            File name :    DIRBUILD.TXT                             --
  7969. --                                                                    --
  7970. --            ===========================================             --
  7971. --                                                                    --
  7972. --                                                                    --
  7973. --            Produced by Veda Incorporated                           --
  7974. --            Version  1.0      April 15, 1985                        --
  7975. --                                                                    --
  7976. --                                                                    --
  7977. --            This program unit is a member of the GMHF. It           --
  7978. --            was developed using TeleSoft's Ada compiler,            --
  7979. --            version 2.1 in a VAX/VMS environment, version           --
  7980. --            3.7                                                     --
  7981. --                                                                    --
  7982. --                                                                    --
  7983. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  7984. --
  7985. -----------------------------------------------------------------------
  7986. --
  7987. --  This procedure is necessary to create a new version of the internal
  7988. --      message data base directory.
  7989. --
  7990. -----------------------------------------------------------------------
  7991. with text_io; use text_io;
  7992. with type_list; use type_list;
  7993. with calendar;
  7994. with direct_io;
  7995. procedure directory_build is
  7996. --
  7997. type classification is (unclassified);
  7998. --
  7999. type directory_structure;
  8000. type directory_entry is access directory_structure;
  8001. --
  8002. type directory_structure is
  8003.   record
  8004.     message_type : available_types;
  8005.     message_filename : string(1..9);
  8006.     number_of_messages : integer;
  8007.     previous_message_type : directory_entry;
  8008.     next_message_type : directory_entry;
  8009.     type_string : string ( 1 .. 11 );
  8010.     number_string : string ( 1 .. 5 );
  8011.   end record;
  8012. --
  8013.   current_record : directory_structure;
  8014. --
  8015.   package dir_io is new direct_io(directory_structure);use dir_io;
  8016.   file_1 : dir_io.file_type;
  8017.   record_number : dir_io.positive_count := 1;
  8018. --
  8019. --
  8020.   type msg_format is array(1..25) of string(1..80);
  8021.   type message_record is
  8022.    record
  8023.      class : classification;
  8024.      number_of_lines : positive;
  8025.      month,day,year : integer;
  8026.      content : msg_format;
  8027.    end record;
  8028. --
  8029.   package msg_io is new direct_io(message_record);use msg_io;
  8030.   file_2 : msg_io.file_type;
  8031. --
  8032.   msg_data : message_record;
  8033. --
  8034.   package message_type_io is new enumeration_io(available_types);
  8035.           use message_type_io;
  8036.   package natural_io is new integer_io(natural);
  8037.           use natural_io;
  8038. --
  8039.   compute_time : calendar.time;
  8040.   month, day, year : integer;
  8041. --
  8042. begin
  8043.    --
  8044.       compute_time := calendar.clock;
  8045.    --
  8046.       month := calendar.month(compute_time);
  8047.       day := calendar.day(compute_time);
  8048.       year := calendar.year(compute_time);
  8049.   --
  8050.   --
  8051.   -- fill a message record with default prototype message format
  8052.   --
  8053.      msg_data.class := unclassified;
  8054.      msg_data.number_of_lines := 1;
  8055.      msg_data.month := month;
  8056.      msg_data.day := day;
  8057.      msg_data.year := year;
  8058.   --
  8059.   -- create the directory file
  8060.   --
  8061.      put_line(
  8062.         "Creating the message directory file entries and files for :");
  8063.      put_line(" ");
  8064.      create(file_1,inout_file,"MSGDRCTRY.DAT","");
  8065.   --
  8066.   -- loop on available types
  8067.   --
  8068.      for msg_type in available_types'first .. available_types'last loop
  8069.        --
  8070.         put(msg_type);put_line(" ");
  8071.        --
  8072.         case msg_type is
  8073.        --
  8074.         when rainform =>
  8075.        --
  8076.               msg_data.content(1) := "NARR/ Prototype message line  "&
  8077.                  "                                                  ";
  8078.        --
  8079.         when unitrep =>
  8080.        --
  8081.               msg_data.content(1) := "     A                        "&
  8082.                  "                                                  ";
  8083.        --
  8084.         when others =>
  8085.        --
  8086.               msg_data.content(1) := "                              "&
  8087.                  "                                                  ";
  8088.        --
  8089.         end case;
  8090.        --
  8091.         current_record.message_type := msg_type;
  8092.         put( to => current_record.message_filename,
  8093.                         item => msg_type);
  8094.         current_record.number_of_messages := 0;
  8095.         put( to => current_record.type_string,
  8096.              item => msg_type );
  8097.         put( to => current_record.number_string,
  8098.              item => current_record.number_of_messages );
  8099.        --
  8100.         write(file_1,current_record,record_number);
  8101.        --
  8102.        -- create a msg file and load the first record
  8103.        --
  8104.           create(file_2,inout_file,
  8105.                     current_record.message_filename&".msg","");
  8106.           write(file_2,msg_data,1);
  8107.           close(file_2);
  8108.        --
  8109.         record_number := record_number + 1;
  8110.      end loop;
  8111.   --
  8112.   -- close the file
  8113.   --
  8114.      close(file_1);
  8115. --
  8116.      put_line(" ");put_line(" ");put_line(" ");
  8117.      put_line("File creation complete ...");
  8118. --
  8119. end directory_build;
  8120. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8121. --lnsandfds.sp
  8122. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8123. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8124. --                                                                    --
  8125. --            Program unit:  PACKAGE MINI_LINES_AND_FIELDS            --
  8126. --            File name :    LNSANDFDS.SP                             --
  8127. --                                                                    --
  8128. --            ===========================================             --
  8129. --                                                                    --
  8130. --                                                                    --
  8131. --            Produced by Veda Incorporated                           --
  8132. --            Version  1.0      April 15, 1985                        --
  8133. --                                                                    --
  8134. --                                                                    --
  8135. --            This program unit is a member of the GMHF. It           --
  8136. --            was developed using TeleSoft's Ada compiler,            --
  8137. --            version 2.1 in a VAX/VMS environment, version           --
  8138. --            3.7                                                     --
  8139. --                                                                    --
  8140. --                                                                    --
  8141. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8142. --
  8143. with TEXT_IO;  use TEXT_IO; 
  8144. package MINI_LINES_AND_FIELDS is 
  8145.  
  8146.    --
  8147.    -- this package contains the line type and field type definitions for
  8148.    -- the unclassified version of the Rainform instance. In addition, it
  8149.    -- defines a subtype of the set of lines. The subtype is required so
  8150.    -- that parse line type can correctly identify an 'incoming' line
  8151.    -- type. Several types of lines have multiple forms, eg. AREA.
  8152.    -- Therefore we define each of the different forms by subscripting
  8153.    -- with a 'qualifier'. However, when the line is actually parsed, the
  8154.    -- qualifier will not be present. Thus we need the line name in its
  8155.    -- 'pure' form for the parser.
  8156.    --
  8157.  
  8158.    type UNCLASSIFIED_RAINFORM_LINES is (ACFT,     ADD,      AFTER,    
  8159.                                         ALT,      AMBTN,    AREA_LL,  
  8160.                                         AREA_C,   AREA_A,   ASSOC,    
  8161.                                         BATHY,    CHG,      CREW,     
  8162.                                         DELET,    ELLIP_R,  ELLIP_A,  
  8163.                                         EMCON,    ENDAT,    FLTTM,    
  8164.                                         GRID,     LAMP,     NARR,     
  8165.                                         POSEL,    RMKS,     ROUTE_LL, 
  8166.                                         ROUTE_LP, ROUTE_PL, ROUTE_PP, 
  8167.                                         SECT,     TIMPD,    TRACK_LL, 
  8168.                                         TRACK_N,  TRAIN,    WEA,      
  8169.                                         WEX,      FREE,     AREA,     
  8170.                                         ELLIP,    ROUTE,    TRACK);
  8171.  
  8172.    
  8173.    subtype USED_RAINFORM_LINES       is
  8174.                            UNCLASSIFIED_RAINFORM_LINES range ACFT..WEX; 
  8175.    
  8176.    type SUBSET_OF_RAINFORM_FIELDS is (  
  8177.          --
  8178.          -- first the composite and constrained field types
  8179.          --
  8180.    ALTITUDE_LIMITS,      BEARING,              COMMENT,
  8181.    DATE_TIME_GROUP,      DECIMAL_DIGITS,       DIGITAL,              
  8182.    DIGITAL_BIG,          FILLED_DIGITS,        FLT_TIME,             
  8183.    FREQUENCY,            GRID_POINT,           LATITUDE,             
  8184.    LONGITUDE,            OTHER_ALT,            PC_OR_TC,             
  8185.    SCORE,                TEMPERATURE,          WEX_TEMP,             
  8186.          --
  8187.          -- now the enumeration types
  8188.          --
  8189.    FLIGHT_TIME_CATEGORY, MEAN_SEA_LEVEL,       MONTH,                
  8190.    PAD,                  TURBULENCE,           TYPE_CHANGE,          
  8191.    TYPE_CLOUDS,          UNITS,                WEATHER,              
  8192.    NIL
  8193.              ); 
  8194.    
  8195.    
  8196.    type FLIGHT_TIME_CATEGORY_TYPE is (PILOT,   PNATOPS, PPIP,    INSTR,   
  8197.                                       ACCEP,   FERRY,   LAL,     ARFAM,   
  8198.                                       AIRWAYS, ADMIN,   TNATOPS, CNATOPS, 
  8199.                                       X_OTHER                                
  8200.              ); 
  8201.    
  8202.    type MEAN_SEA_LEVEL_TYPE is (MSL                                          
  8203.              ); 
  8204.    
  8205.    type MONTH_TYPE is (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, 
  8206.                        NOV, DEC                                              
  8207.              ); 
  8208.    
  8209.    type PAD_TYPE is (X_OUT, X_IN                                             
  8210.              ); 
  8211.    
  8212.    type TURBULENCE_TYPE is (NON, LGT, MDT, SEV, EXT                          
  8213.              ); 
  8214.    
  8215.    type TYPE_CHANGE_TYPE is (CANCEL,     REPLACE,    CORRECTION              
  8216.              ); 
  8217.    
  8218.    type TYPE_CLOUDS_TYPE is (ST, SC, CU, CB, AS, AC, CI                      
  8219.              ); 
  8220.    
  8221.    type UNITS_TYPE is (MET, ENG                                              
  8222.              ); 
  8223.    
  8224.    type WEATHER_TYPE is (R,    HR,   LR,   RW,   HRW,  LRW,  TS,   HTS,  
  8225.                          LTS,  ZR,   HZR,  LZR,  L,    ZL,   S,    HS,   
  8226.                          LS,   SW,   HSW,  LSW,  A,    HA,   LA,   F,    
  8227.                          HF,   LF,   GF,   HGF,  LGF,  X_IF, HIF,  LIF,  
  8228.                          H,    HH,   LH,   K,    HK,   LK,   D,    HD,   
  8229.                          LD,   CLR                                           
  8230.              ); 
  8231.    
  8232.    --
  8233.    -- here we the enumerated types which are used as components within
  8234.    -- fields
  8235.    --
  8236.    type CARDINAL_POINT is (N, S, E, W                                        
  8237.              ); 
  8238.    
  8239.    subtype NS_CARDINAL               is CARDINAL_POINT range N..S; 
  8240.    
  8241.    subtype EW_CARDINAL               is CARDINAL_POINT range E..W; 
  8242.    
  8243.    type PC_TC is (PC, TC                                                     
  8244.              ); 
  8245.    
  8246.    type AL_OR_FL is (AL, FL                                                  
  8247.              ); 
  8248.    
  8249. end MINI_LINES_AND_FIELDS; 
  8250. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8251. --subgrf1.txt
  8252. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8253. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  8254. --                                                                    --
  8255. --            Program unit:  PACKAGE SUB_PKG_1                        --
  8256. --            File name :    SUBGRF1.TXT                              --
  8257. --                                                                    --
  8258. --            ===========================================             --
  8259. --                                                                    --
  8260. --                                                                    --
  8261. --            Produced by Veda Incorporated                           --
  8262. --            Version  1.0      April 15, 1985                        --
  8263. --                                                                    --
  8264. --                                                                    --
  8265. --            This program unit is a member of the GMHF. It           --
  8266. --            was developed using TeleSoft's Ada compiler,            --
  8267. --            version 2.1 in a VAX/VMS environment, version           --
  8268. --            3.7                                                     --
  8269. --                                                                    --
  8270. --                                                                    --
  8271. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8272. --
  8273. with TEXT_IO;                      use TEXT_IO; 
  8274. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  8275. with MAN_MACHINE_INTERFACE;        use MAN_MACHINE_INTERFACE; 
  8276. with MINI_LINES_AND_FIELDS;        use MINI_LINES_AND_FIELDS; 
  8277. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  8278.  
  8279. package SUB_PKG_1 is 
  8280.  
  8281.    --
  8282.    -- this package is required due to Telesoft size limitations.
  8283.    -- here we instantiate input routines for several enumerated
  8284.    -- types, and define an input routine - grf_sub_1 - which
  8285.    -- stands for Get_Rainform_Subroutine_1 and is called by
  8286.    -- get_Rainform_field. The instantiations are based upon generic
  8287.    -- definitions found in generic_get_field_utilities.
  8288.    --
  8289.    package ENUM1 is new ENUMERATION_IO (FLIGHT_TIME_CATEGORY_TYPE); 
  8290.    procedure GET_FLIGHT_TIME is new GET_X_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8291.              FLIGHT_TIME_CATEGORY_TYPE, 
  8292.    GET_PROC => ENUM1.GET); 
  8293.    
  8294.    package ENUM2 is new ENUMERATION_IO (MEAN_SEA_LEVEL_TYPE); 
  8295.    procedure GET_MSL is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8296.              MEAN_SEA_LEVEL_TYPE, 
  8297.    GET_PROC => ENUM2.GET); 
  8298.    
  8299.    
  8300.    package ENUM3 is new ENUMERATION_IO (MONTH_TYPE); 
  8301.    procedure GET_MONTH is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8302.              MONTH_TYPE, 
  8303.    GET_PROC => ENUM3.GET); 
  8304.    
  8305.    
  8306.    
  8307.    procedure GRF_SUB_1 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8308.                         FIELD_GOTTEN    : in out STRING; 
  8309.                         FIELD_POSITION  : POSITIVE; 
  8310.                         FIELD_LENGTH    : POSITIVE; 
  8311.                         COMMAND_FLAG    : in out BOOLEAN; 
  8312.                         COMMAND_GOTTEN  : in out COMMAND); 
  8313.    
  8314. end SUB_PKG_1; 
  8315.  
  8316. package body SUB_PKG_1 is 
  8317.    procedure GRF_SUB_1 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8318.                         FIELD_GOTTEN    : in out STRING; 
  8319.                         FIELD_POSITION  : POSITIVE; 
  8320.                         FIELD_LENGTH    : POSITIVE; 
  8321.                         COMMAND_FLAG    : in out BOOLEAN; 
  8322.                         COMMAND_GOTTEN  : in out COMMAND) is 
  8323.    
  8324.       LAST  : POSITIVE; 
  8325.       
  8326.    begin 
  8327.    --
  8328.    
  8329.       case FIELD_TYPE is 
  8330.          --
  8331.          when FLIGHT_TIME_CATEGORY => 
  8332.             GET_FLIGHT_TIME (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8333.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8334.          --
  8335.          when MEAN_SEA_LEVEL => 
  8336.             GET_MSL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8337.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8338.          --
  8339.          when MONTH => 
  8340.             GET_MONTH (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8341.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8342.             
  8343.          when others => 
  8344.             null; 
  8345.          --
  8346.       end case; 
  8347.    end GRF_SUB_1; 
  8348. end SUB_PKG_1; 
  8349. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8350. --subgrf2.txt
  8351. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8352. -- 
  8353. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8354. --                                                                    --
  8355. --            Program unit:  PACKAGE SUB_PKG_2                        --
  8356. --            File name :    SUBGRF2.TXT                              --
  8357. --                                                                    --
  8358. --            ===========================================             --
  8359. --                                                                    --
  8360. --                                                                    --
  8361. --            Produced by Veda Incorporated                           --
  8362. --            Version  1.0      April 15, 1985                        --
  8363. --                                                                    --
  8364. --                                                                    --
  8365. --            This program unit is a member of the GMHF. It           --
  8366. --            was developed using TeleSoft's Ada compiler,            --
  8367. --            version 2.1 in a VAX/VMS environment, version           --
  8368. --            3.7                                                     --
  8369. --                                                                    --
  8370. --                                                                    --
  8371. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8372. with TEXT_IO;                      use TEXT_IO; 
  8373. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  8374. with MAN_MACHINE_INTERFACE;        use MAN_MACHINE_INTERFACE; 
  8375. with MINI_LINES_AND_FIELDS;        use MINI_LINES_AND_FIELDS; 
  8376. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  8377.  
  8378. package SUB_PKG_2 is 
  8379.  
  8380.    --
  8381.    -- this package is required due to Telesoft size limitations.
  8382.    -- here we instantiate input routines for several enumerated
  8383.    -- types, and define an input routine - grf_sub_2 - which
  8384.    -- stands for Get_Rainform_Subroutine_2 and is called by
  8385.    -- get_Rainform_field. The instantiations are based upon generic
  8386.    -- definitions found in generic_get_field_utilities.
  8387.    --
  8388.  
  8389.    package ENUM7 is new ENUMERATION_IO (TYPE_CLOUDS_TYPE); 
  8390.    procedure GET_CLOUDS is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8391.              TYPE_CLOUDS_TYPE, 
  8392.    GET_PROC => ENUM7.GET); 
  8393.    
  8394.    
  8395.    package ENUM8 is new ENUMERATION_IO (UNITS_TYPE); 
  8396.    procedure GET_UNITS is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8397.              UNITS_TYPE, 
  8398.    GET_PROC => ENUM8.GET); 
  8399.    
  8400.    
  8401.    package ENUM13 is new ENUMERATION_IO (AL_OR_FL); 
  8402.    procedure GET_AL_OR_FL is new GET_X_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8403.              AL_OR_FL, 
  8404.    GET_PROC => ENUM13.GET); 
  8405.    
  8406.    
  8407.    procedure GRF_SUB_2 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8408.                         FIELD_GOTTEN    : in out STRING; 
  8409.                         FIELD_POSITION  : POSITIVE; 
  8410.                         FIELD_LENGTH    : POSITIVE; 
  8411.                         COMMAND_FLAG    : in out BOOLEAN; 
  8412.                         COMMAND_GOTTEN  : in out COMMAND); 
  8413.    
  8414.    
  8415. end SUB_PKG_2; 
  8416.  
  8417. package body SUB_PKG_2 is 
  8418.    procedure GRF_SUB_2 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8419.                         FIELD_GOTTEN    : in out STRING; 
  8420.                         FIELD_POSITION  : POSITIVE; 
  8421.                         FIELD_LENGTH    : POSITIVE; 
  8422.                         COMMAND_FLAG    : in out BOOLEAN; 
  8423.                         COMMAND_GOTTEN  : in out COMMAND) is 
  8424.    
  8425.       LAST  : POSITIVE; 
  8426.       
  8427.    begin 
  8428.    
  8429.       case FIELD_TYPE is 
  8430.       
  8431.          --
  8432.          when TYPE_CLOUDS => 
  8433.             GET_CLOUDS (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8434.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8435.             
  8436.          when UNITS => 
  8437.             GET_UNITS (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8438.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8439.             
  8440.          when OTHER_ALT => 
  8441.             GET_AL_OR_FL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8442.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8443.             
  8444.          when others => 
  8445.             null; 
  8446.          --
  8447.       end case; 
  8448.    end GRF_SUB_2; 
  8449. end SUB_PKG_2; 
  8450. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8451. --subgrf3.txt
  8452. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8453. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  8454. --                                                                    --
  8455. --            Program unit:  PACKAGE SUB_PKG_3                        --
  8456. --            File name :    SUBGRF3.TXT                              --
  8457. --                                                                    --
  8458. --            ===========================================             --
  8459. --                                                                    --
  8460. --                                                                    --
  8461. --            Produced by Veda Incorporated                           --
  8462. --            Version  1.0      April 15, 1985                        --
  8463. --                                                                    --
  8464. --                                                                    --
  8465. --            This program unit is a member of the GMHF. It           --
  8466. --            was developed using TeleSoft's Ada compiler,            --
  8467. --            version 2.1 in a VAX/VMS environment, version           --
  8468. --            3.7                                                     --
  8469. --                                                                    --
  8470. --                                                                    --
  8471. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8472. --
  8473. with TEXT_IO;                      use TEXT_IO; 
  8474. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  8475. with MAN_MACHINE_INTERFACE;        use MAN_MACHINE_INTERFACE; 
  8476. with MINI_LINES_AND_FIELDS;        use MINI_LINES_AND_FIELDS; 
  8477. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  8478. with STATIC_GET_FIELD_UTILITIES;   use STATIC_GET_FIELD_UTILITIES; 
  8479. package SUB_PKG_3 is 
  8480.  
  8481.    --
  8482.    -- this package is required due to Telesoft size limitations.
  8483.    -- here we instantiate input routines for several enumerated
  8484.    -- types, and define an input routine - grf_sub_3 - which
  8485.    -- stands for Get_Rainform_Subroutine_3 and is called by
  8486.    -- get_Rainform_field. The instantiations are based upon generic
  8487.    -- definitions found in generic_get_field_utilities.
  8488.    --
  8489.    package ENUM9 is new ENUMERATION_IO (WEATHER_TYPE); 
  8490.    procedure GET_WEATHER is new GET_X_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8491.              WEATHER_TYPE, 
  8492.    GET_PROC => ENUM9.GET); 
  8493.    
  8494.    
  8495.    package ENUM12 is new ENUMERATION_IO (PC_TC); 
  8496.    procedure GET_PC_TC is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => PC_TC, 
  8497.    GET_PROC => ENUM12.GET); 
  8498.    
  8499.    
  8500.    procedure GRF_SUB_3 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8501.                         FIELD_GOTTEN    : in out STRING; 
  8502.                         FIELD_POSITION  : POSITIVE; 
  8503.                         FIELD_LENGTH    : POSITIVE; 
  8504.                         COMMAND_FLAG    : in out BOOLEAN; 
  8505.                         COMMAND_GOTTEN  : in out COMMAND); 
  8506.    
  8507.    
  8508. end SUB_PKG_3; 
  8509.  
  8510. package body SUB_PKG_3 is 
  8511.    procedure GRF_SUB_3 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8512.                         FIELD_GOTTEN    : in out STRING; 
  8513.                         FIELD_POSITION  : POSITIVE; 
  8514.                         FIELD_LENGTH    : POSITIVE; 
  8515.                         COMMAND_FLAG    : in out BOOLEAN; 
  8516.                         COMMAND_GOTTEN  : in out COMMAND) is 
  8517.    
  8518.       LAST  : POSITIVE; 
  8519.       
  8520.    begin 
  8521.    
  8522.       case FIELD_TYPE is 
  8523.       
  8524.          when WEATHER => 
  8525.             GET_WEATHER (FIELD_GOTTEN (1..3), 
  8526.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8527.             
  8528.             
  8529.          when PC_OR_TC => 
  8530.             GET_PC_TC (FIELD_GOTTEN (1..2), 
  8531.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8532.          --
  8533.          when BEARING => 
  8534.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8535.             FIELD_POSITION, 0.0, 359.9, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8536.          --
  8537.          when DECIMAL_DIGITS => 
  8538.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8539.             FIELD_POSITION, 0.0, 100.0, ' ', COMMAND_FLAG, COMMAND_GOTTEN); 
  8540.          --
  8541.          when DIGITAL => 
  8542.             DIGITAL_BLOCK : 
  8543.             declare 
  8544.                UPPER_LIMIT  : INTEGER; 
  8545.             begin 
  8546.                UPPER_LIMIT := 10 ** (FIELD_LENGTH) - 1; 
  8547.                GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8548.                FIELD_POSITION, 0, UPPER_LIMIT, ' ', COMMAND_FLAG, 
  8549.                COMMAND_GOTTEN); 
  8550.             end DIGITAL_BLOCK; 
  8551.          --
  8552.          when DIGITAL_BIG => 
  8553.             for INDEX in 1..FIELD_LENGTH loop 
  8554.                GET_CONSTRAINED_CHARACTER (FIELD_GOTTEN (INDEX..INDEX), 
  8555.                FIELD_POSITION, '0', '9', COMMAND_FLAG, COMMAND_GOTTEN); 
  8556.             end loop; 
  8557.          --
  8558.          when FILLED_DIGITS => 
  8559.             FILLED_DIGITS_BLOCK : 
  8560.             declare 
  8561.                UPPER_LIMIT  : INTEGER; 
  8562.             begin 
  8563.                UPPER_LIMIT := 10 ** (FIELD_LENGTH) - 1; 
  8564.                GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8565.                FIELD_POSITION, 0, UPPER_LIMIT, '0', COMMAND_FLAG, 
  8566.                COMMAND_GOTTEN); 
  8567.             end FILLED_DIGITS_BLOCK; 
  8568.          --
  8569.          when FLT_TIME => 
  8570.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8571.             FIELD_POSITION, 0.0, 9999.9, ' ', COMMAND_FLAG, COMMAND_GOTTEN); 
  8572.          --
  8573.          when FREQUENCY => 
  8574.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8575.             FIELD_POSITION, 0.0, 9999.0, ' ', COMMAND_FLAG, COMMAND_GOTTEN); 
  8576.          --
  8577.          when SCORE => 
  8578.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8579.             FIELD_POSITION, 0.0, 100.0, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8580.          --
  8581.          when TEMPERATURE => 
  8582.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8583.             FIELD_POSITION, 0.0, 99.9, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8584.          --
  8585.          when WEX_TEMP => 
  8586.             GET_CONSTRAINED_DECIMAL (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8587.             FIELD_POSITION, 0.0, 99.9, ' ', COMMAND_FLAG, COMMAND_GOTTEN); 
  8588.          --
  8589.          when others => 
  8590.             null; 
  8591.          --
  8592.       end case; 
  8593.    exception 
  8594.       when ERASE_ERROR => 
  8595.          COMMAND_FLAG := TRUE; 
  8596.          COMMAND_GOTTEN := ERASE_FIELD; 
  8597.       when others => 
  8598.          COMMAND_FLAG := TRUE; 
  8599.          COMMAND_GOTTEN := ERASE_FIELD; 
  8600.    end GRF_SUB_3; 
  8601. end SUB_PKG_3; 
  8602. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8603. --subgrf4.txt
  8604. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8605. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  8606. --                                                                    --
  8607. --            Program unit:  PACKAGE SUB_PKG_4                        --
  8608. --            File name :    SUBGRF4.TXT                              --
  8609. --                                                                    --
  8610. --            ===========================================             --
  8611. --                                                                    --
  8612. --                                                                    --
  8613. --            Produced by Veda Incorporated                           --
  8614. --            Version  1.0      April 15, 1985                        --
  8615. --                                                                    --
  8616. --                                                                    --
  8617. --            This program unit is a member of the GMHF. It           --
  8618. --            was developed using TeleSoft's Ada compiler,            --
  8619. --            version 2.1 in a VAX/VMS environment, version           --
  8620. --            3.7                                                     --
  8621. --                                                                    --
  8622. --                                                                    --
  8623. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8624. --
  8625. with TEXT_IO;                      use TEXT_IO; 
  8626. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  8627. with MAN_MACHINE_INTERFACE;        use MAN_MACHINE_INTERFACE; 
  8628. with MINI_LINES_AND_FIELDS;        use MINI_LINES_AND_FIELDS; 
  8629. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  8630. with STATIC_GET_FIELD_UTILITIES;   use STATIC_GET_FIELD_UTILITIES; 
  8631.  
  8632. package SUB_PKG_4 is 
  8633.  
  8634.    package ENUM10 is new ENUMERATION_IO (NS_CARDINAL); 
  8635.    procedure GET_NS is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8636.              NS_CARDINAL, 
  8637.    GET_PROC => ENUM10.GET); 
  8638.    
  8639.    package ENUM11 is new ENUMERATION_IO (EW_CARDINAL); 
  8640.    procedure GET_EW is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8641.              EW_CARDINAL, 
  8642.    GET_PROC => ENUM11.GET); 
  8643.    
  8644.    procedure GRF_SUB_4 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8645.                         FIELD_GOTTEN    : in out STRING; 
  8646.                         FIELD_POSITION  : POSITIVE; 
  8647.                         FIELD_LENGTH    : POSITIVE; 
  8648.                         COMMAND_FLAG    : in out BOOLEAN; 
  8649.                         COMMAND_GOTTEN  : in out COMMAND); 
  8650.    
  8651.    
  8652. end SUB_PKG_4; 
  8653.  
  8654. package body SUB_PKG_4 is 
  8655.    procedure GRF_SUB_4 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8656.                         FIELD_GOTTEN    : in out STRING; 
  8657.                         FIELD_POSITION  : POSITIVE; 
  8658.                         FIELD_LENGTH    : POSITIVE; 
  8659.                         COMMAND_FLAG    : in out BOOLEAN; 
  8660.                         COMMAND_GOTTEN  : in out COMMAND) is 
  8661.    
  8662.       LAST            : POSITIVE := 1; 
  8663.       DUMMY_STRING    : STRING (1..20) := (1..20 => ' '); 
  8664.       BLANK_FLAG      : BOOLEAN; 
  8665.       NON_BLANK_FLAG  : BOOLEAN; 
  8666.       
  8667.       procedure CHECK_FOR_BLANKS (LENGTH  : in NATURAL) is 
  8668.       begin 
  8669.       --
  8670.       -- the purpose of this routine is to determine whether a field
  8671.       -- which should be all blank is in fact all blank, or whether a
  8672.       -- field which should contain no blanks actually has some.
  8673.       --
  8674.          if LENGTH = 1 then 
  8675.             return; 
  8676.          end if; 
  8677.          for I in 2..LENGTH loop 
  8678.             if FIELD_GOTTEN (I) /= ' ' then 
  8679.                if BLANK_FLAG = TRUE then 
  8680.                   raise DATA_ERROR; 
  8681.                end if; 
  8682.             else 
  8683.                if NON_BLANK_FLAG = TRUE then 
  8684.                   raise DATA_ERROR; 
  8685.                end if; 
  8686.             end if; 
  8687.          end loop; 
  8688.       end CHECK_FOR_BLANKS; 
  8689.    begin 
  8690.    
  8691.       case FIELD_TYPE is 
  8692.       
  8693.          when DATE_TIME_GROUP => 
  8694.             begin 
  8695.                loop 
  8696.                   begin 
  8697.                      GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..2), 
  8698.                                FIELD_POSITION, 
  8699.                      1, 31, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8700.                      
  8701.                      DUMMY_STRING (1..2) := FIELD_GOTTEN (3..4); 
  8702.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), 
  8703.                      FIELD_POSITION + 2, 0, 23, '0', COMMAND_FLAG, 
  8704.                                COMMAND_GOTTEN); 
  8705.                      FIELD_GOTTEN (3..4) := DUMMY_STRING (1..2); 
  8706.                      
  8707.                      DUMMY_STRING (1..2) := FIELD_GOTTEN (5..6); 
  8708.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), 
  8709.                      FIELD_POSITION + 4, 0, 59, '0', COMMAND_FLAG, 
  8710.                                COMMAND_GOTTEN); 
  8711.                      FIELD_GOTTEN (5..6) := DUMMY_STRING (1..2); 
  8712.                      
  8713.                      CHECKSUM (FIELD_GOTTEN (1..6), DUMMY_STRING (1..1)); 
  8714.                      FIELD_GOTTEN (8..8) := DUMMY_STRING (1..1); 
  8715.                      if FIELD_GOTTEN (8) /= ' ' then 
  8716.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 
  8717.                                   7); 
  8718.                         PUT (FIELD_GOTTEN (8..8)); 
  8719.                      end if; 
  8720.                      
  8721.                      if FIELD_GOTTEN (1) = ' ' then 
  8722.                         BLANK_FLAG := TRUE; 
  8723.                      else 
  8724.                         NON_BLANK_FLAG := TRUE; 
  8725.                      end if; 
  8726.                      CHECK_FOR_BLANKS (6); 
  8727.                      exit; 
  8728.                   exception 
  8729.                      when DATA_ERROR => 
  8730.                         PROMPT 
  8731.                          ("Must either have complete dtg or all blanks"); 
  8732.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8733.                         
  8734.                      when ERASE_ERROR => 
  8735.                         COMMAND_FLAG := FALSE; 
  8736.                         COMMAND_GOTTEN := NIL; 
  8737.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8738.                         FIELD_GOTTEN (1..8) := "      Z "; 
  8739.                         PUT ("      Z "); 
  8740.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8741.                   end; 
  8742.                end loop; 
  8743.             end; 
  8744.          --
  8745.          when LATITUDE => 
  8746.             begin 
  8747.                loop 
  8748.                   begin 
  8749.                      GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..2), 
  8750.                                FIELD_POSITION, 
  8751.                      0, 89, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8752.                      
  8753.                      DUMMY_STRING (1..2) := FIELD_GOTTEN (3..4); 
  8754.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), 
  8755.                      FIELD_POSITION + 2, 0, 59, '0', COMMAND_FLAG, 
  8756.                                COMMAND_GOTTEN); 
  8757.                      FIELD_GOTTEN (3..4) := DUMMY_STRING (1..2); 
  8758.                      
  8759.                      DUMMY_STRING (1..1) := FIELD_GOTTEN (5..5); 
  8760.                      GET_NS (DUMMY_STRING (1..1), FIELD_POSITION + 4, LAST, 
  8761.                      COMMAND_FLAG, COMMAND_GOTTEN); 
  8762.                      FIELD_GOTTEN (5..5) := DUMMY_STRING (1..1); 
  8763.                      
  8764.                      CHECKSUM (FIELD_GOTTEN (1..4), DUMMY_STRING (1..1)); 
  8765.                      FIELD_GOTTEN (6..6) := DUMMY_STRING (1..1); 
  8766.                      if FIELD_GOTTEN (6) /= ' ' then 
  8767.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 
  8768.                                   5); 
  8769.                         PUT (FIELD_GOTTEN (6..6)); 
  8770.                      end if; 
  8771.                      if FIELD_GOTTEN (1) = ' ' then 
  8772.                         BLANK_FLAG := TRUE; 
  8773.                      else 
  8774.                         NON_BLANK_FLAG := TRUE; 
  8775.                      end if; 
  8776.                      CHECK_FOR_BLANKS (6); 
  8777.                      exit; 
  8778.                   exception 
  8779.                      when DATA_ERROR => 
  8780.                         PROMPT 
  8781.                          ("Must either have complete latitude or all blanks"); 
  8782.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8783.                         COMMAND_FLAG := FALSE; 
  8784.                         COMMAND_GOTTEN := NIL; 
  8785.                         
  8786.                      when ERASE_ERROR => 
  8787.                         COMMAND_FLAG := FALSE; 
  8788.                         COMMAND_GOTTEN := NIL; 
  8789.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8790.                         FIELD_GOTTEN (1..6) := "      "; 
  8791.                         PUT ("      "); 
  8792.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8793.                   end; 
  8794.                end loop; 
  8795.             end; 
  8796.         --
  8797.          when LONGITUDE => 
  8798.             begin 
  8799.                loop 
  8800.                   begin 
  8801.                      GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), 
  8802.                                FIELD_POSITION, 
  8803.                      0, 179, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  8804.                      
  8805.                      DUMMY_STRING (1..2) := FIELD_GOTTEN (4..5); 
  8806.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), 
  8807.                      FIELD_POSITION + 3, 0, 59, '0', COMMAND_FLAG, 
  8808.                                COMMAND_GOTTEN); 
  8809.                      FIELD_GOTTEN (4..5) := DUMMY_STRING (1..2); 
  8810.                      
  8811.                      DUMMY_STRING (1..1) := FIELD_GOTTEN (6..6); 
  8812.                      GET_EW (DUMMY_STRING (1..1), FIELD_POSITION + 5, LAST, 
  8813.                      COMMAND_FLAG, COMMAND_GOTTEN); 
  8814.                      FIELD_GOTTEN (6..6) := DUMMY_STRING (1..1); 
  8815.                      
  8816.                      CHECKSUM (FIELD_GOTTEN (1..5), DUMMY_STRING (1..1)); 
  8817.                      FIELD_GOTTEN (7..7) := DUMMY_STRING (1..1); 
  8818.                      if FIELD_GOTTEN (7) /= ' ' then 
  8819.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 
  8820.                                   6); 
  8821.                         PUT (FIELD_GOTTEN (7..7)); 
  8822.                      end if; 
  8823.                      
  8824.                      if FIELD_GOTTEN (1) = ' ' then 
  8825.                         BLANK_FLAG := TRUE; 
  8826.                      else 
  8827.                         NON_BLANK_FLAG := TRUE; 
  8828.                      end if; 
  8829.                      CHECK_FOR_BLANKS (7); 
  8830.                      exit; 
  8831.                   exception 
  8832.                      when DATA_ERROR => 
  8833.                         PROMPT 
  8834.                          
  8835.                          ("Must either have complete longitude or all blanks"); 
  8836.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8837.                         COMMAND_FLAG := FALSE; 
  8838.                         COMMAND_GOTTEN := NIL; 
  8839.                         
  8840.                      when ERASE_ERROR => 
  8841.                         COMMAND_FLAG := FALSE; 
  8842.                         COMMAND_GOTTEN := NIL; 
  8843.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8844.                         FIELD_GOTTEN (1..7) := "       "; 
  8845.                         PUT ("       "); 
  8846.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  8847.                   end; 
  8848.                end loop; 
  8849.             end; 
  8850.             
  8851.          --
  8852.          when others => 
  8853.             null; 
  8854.          --
  8855.       end case; 
  8856.    end GRF_SUB_4; 
  8857. end SUB_PKG_4; 
  8858. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8859. --subgrf5.txt
  8860. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8861. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  8862. --                                                                    --
  8863. --            Program unit:  PACKAGE SUB_PKG_5                        --
  8864. --            File name :    SUBGRF5.TXT                              --
  8865. --                                                                    --
  8866. --            ===========================================             --
  8867. --                                                                    --
  8868. --                                                                    --
  8869. --            Produced by Veda Incorporated                           --
  8870. --            Version  1.0      April 15, 1985                        --
  8871. --                                                                    --
  8872. --                                                                    --
  8873. --            This program unit is a member of the GMHF. It           --
  8874. --            was developed using TeleSoft's Ada compiler,            --
  8875. --            version 2.1 in a VAX/VMS environment, version           --
  8876. --            3.7                                                     --
  8877. --                                                                    --
  8878. --                                                                    --
  8879. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8880. --
  8881. with TEXT_IO;                      use TEXT_IO; 
  8882. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  8883. with MAN_MACHINE_INTERFACE;        use MAN_MACHINE_INTERFACE; 
  8884. with MINI_LINES_AND_FIELDS;        use MINI_LINES_AND_FIELDS; 
  8885. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  8886.  
  8887. package SUB_PKG_5 is 
  8888.  
  8889.    --
  8890.    -- this package is required due to Telesoft size limitations.
  8891.    -- here we instantiate input routines for several enumerated
  8892.    -- types, and define an input routine - grf_sub_1 - which
  8893.    -- stands for Get_Rainform_Subroutine_1 and is called by
  8894.    -- get_Rainform_field. The instantiations are based upon generic
  8895.    -- definitions found in generic_get_field_utilities.
  8896.    --
  8897.    package ENUM4 is new ENUMERATION_IO (PAD_TYPE); 
  8898.    procedure GET_PAD is new GET_X_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8899.              PAD_TYPE, 
  8900.    GET_PROC => ENUM4.GET); 
  8901.    
  8902.    package ENUM5 is new ENUMERATION_IO (TURBULENCE_TYPE); 
  8903.    procedure GET_TURBULENCE is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8904.              TURBULENCE_TYPE, 
  8905.    GET_PROC => ENUM5.GET); 
  8906.    
  8907.    
  8908.    package ENUM6 is new ENUMERATION_IO (TYPE_CHANGE_TYPE); 
  8909.    procedure GET_CHANGE is new GET_ENUMERATED_FIELD (ENUMERATED_TYPE => 
  8910.              TYPE_CHANGE_TYPE, 
  8911.    GET_PROC => ENUM6.GET); 
  8912.    
  8913.    
  8914.    procedure GRF_SUB_5 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8915.                         FIELD_GOTTEN    : in out STRING; 
  8916.                         FIELD_POSITION  : POSITIVE; 
  8917.                         FIELD_LENGTH    : POSITIVE; 
  8918.                         COMMAND_FLAG    : in out BOOLEAN; 
  8919.                         COMMAND_GOTTEN  : in out COMMAND); 
  8920.    
  8921. end SUB_PKG_5; 
  8922.  
  8923. package body SUB_PKG_5 is 
  8924.    procedure GRF_SUB_5 (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8925.                         FIELD_GOTTEN    : in out STRING; 
  8926.                         FIELD_POSITION  : POSITIVE; 
  8927.                         FIELD_LENGTH    : POSITIVE; 
  8928.                         COMMAND_FLAG    : in out BOOLEAN; 
  8929.                         COMMAND_GOTTEN  : in out COMMAND) is 
  8930.    
  8931.       LAST  : POSITIVE; 
  8932.       
  8933.    begin 
  8934.    --
  8935.    
  8936.       case FIELD_TYPE is 
  8937.          --
  8938.          when PAD => 
  8939.             GET_PAD (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8940.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8941.          --
  8942.          when TURBULENCE => 
  8943.             GET_TURBULENCE (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8944.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8945.          --
  8946.          when TYPE_CHANGE => 
  8947.             GET_CHANGE (FIELD_GOTTEN (1..FIELD_LENGTH), 
  8948.             FIELD_POSITION, LAST, COMMAND_FLAG, COMMAND_GOTTEN); 
  8949.          --
  8950.          when others => 
  8951.             null; 
  8952.          --
  8953.       end case; 
  8954.    end GRF_SUB_5; 
  8955. end SUB_PKG_5; 
  8956. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8957. --fgparams.sp
  8958. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8959. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8960. --                                                                    --
  8961. --            Program unit:  PACKAGE FORMAL_GENERIC_PARAMETERS        --
  8962. --            File name :    FGPARAMS                                 --
  8963. --                                                                    --
  8964. --            ===========================================             --
  8965. --                                                                    --
  8966. --                                                                    --
  8967. --            Produced by Veda Incorporated                           --
  8968. --            Version  1.0      April 15, 1985                        --
  8969. --                                                                    --
  8970. --                                                                    --
  8971. --            This program unit is a member of the GMHF. It           --
  8972. --            was developed using TeleSoft's Ada compiler,            --
  8973. --            version 2.1 in a VAX/VMS environment, version           --
  8974. --            3.7                                                     --
  8975. --                                                                    --
  8976. --                                                                    --
  8977. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  8978. --
  8979. with TEXT_IO;                 use TEXT_IO; 
  8980. with MINI_LINES_AND_FIELDS;   use MINI_LINES_AND_FIELDS; 
  8981. with MAN_MACHINE_INTERFACE;   use MAN_MACHINE_INTERFACE; 
  8982. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  8983. with EDITOR_TYPES;            use EDITOR_TYPES;           -- think this not reqd
  8984.  
  8985. package FORMAL_GENERIC_PARAMETERS is 
  8986.  
  8987.    procedure GET_RAINFORM_FIELD (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  8988.                                  FIELD_GOTTEN    : in out STRING; 
  8989.                                  FIELD_POSITION  : POSITIVE; 
  8990.                                  FIELD_LENGTH    : POSITIVE; 
  8991.                                  COMMAND_GOTTEN  : in out COMMAND; 
  8992.                                  COMMAND_FLAG    : in out BOOLEAN); 
  8993.    
  8994.    package INT_IO is new INTEGER_IO (INTEGER); 
  8995.    
  8996. end FORMAL_GENERIC_PARAMETERS; 
  8997. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8998. --fgparams.txt
  8999. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9000. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  9001. --                                                                    --
  9002. --            Program unit:  PACKAGE FORMAL_GENERIC_PARAMETERS        --
  9003. --            File name :    FGPARAMS.TXT                             --
  9004. --                                                                    --
  9005. --            ===========================================             --
  9006. --                                                                    --
  9007. --                                                                    --
  9008. --            Produced by Veda Incorporated                           --
  9009. --            Version  1.0      April 15, 1985                        --
  9010. --                                                                    --
  9011. --                                                                    --
  9012. --            This program unit is a member of the GMHF. It           --
  9013. --            was developed using TeleSoft's Ada compiler,            --
  9014. --            version 2.1 in a VAX/VMS environment, version           --
  9015. --            3.7                                                     --
  9016. --                                                                    --
  9017. --                                                                    --
  9018. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9019. --
  9020. with SUB_PKG_1;                    use SUB_PKG_1; 
  9021. with SUB_PKG_2;                    use SUB_PKG_2; 
  9022. with SUB_PKG_3;                    use SUB_PKG_3; 
  9023. with SUB_PKG_4;                    use SUB_PKG_4; 
  9024. with SUB_PKG_5;                    use SUB_PKG_5; 
  9025. with TERMINAL_DEFINITION;          use TERMINAL_DEFINITION; 
  9026. with GENERIC_GET_FIELD_UTILITIES;  use GENERIC_GET_FIELD_UTILITIES; 
  9027. with STATIC_GET_FIELD_UTILITIES;   use STATIC_GET_FIELD_UTILITIES; 
  9028.  
  9029. package body FORMAL_GENERIC_PARAMETERS is 
  9030.  
  9031.    procedure GET_RAINFORM_FIELD (FIELD_TYPE      : in SUBSET_OF_RAINFORM_FIELDS; 
  9032.                                  FIELD_GOTTEN    : in out STRING; 
  9033.                                  FIELD_POSITION  : POSITIVE; 
  9034.                                  FIELD_LENGTH    : POSITIVE; 
  9035.                                  COMMAND_GOTTEN  : in out COMMAND; 
  9036.                                  COMMAND_FLAG    : in out BOOLEAN) is 
  9037.    --
  9038.       BLANKS          : STRING (1..69) := (1..69 => ' '); 
  9039.       DUMMY_STRING    : STRING (1..69) := (1..69 => ' '); 
  9040.       BLANK_FLAG      : BOOLEAN; 
  9041.       NON_BLANK_FLAG  : BOOLEAN; 
  9042.       
  9043.    --
  9044.    begin     -- beginning body of get_Rainform_field
  9045.    --
  9046.       COMMAND_FLAG := FALSE; 
  9047.       COMMAND_GOTTEN := NIL; 
  9048.       
  9049.       case FIELD_TYPE is 
  9050.          --
  9051.          when ALTITUDE_LIMITS => 
  9052.             ALTITUDE_LIMITS_BLOCK : 
  9053.             declare 
  9054.                LOW_LIMIT  : INTEGER; 
  9055.                LAST       : POSITIVE := 1; 
  9056.             begin 
  9057.                loop 
  9058.                   begin 
  9059.                      GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), 
  9060.                                FIELD_POSITION, 
  9061.                      0, 999, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  9062.                      if FIELD_GOTTEN (1..3) /= "   " then 
  9063.                         STR_INT (FIELD_GOTTEN (1..3), LOW_LIMIT); 
  9064.                         
  9065.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 
  9066.                                   4); 
  9067.                         DUMMY_STRING (1..3) := FIELD_GOTTEN (5..7); 
  9068.                         GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..3), 
  9069.                         FIELD_POSITION + 4, LOW_LIMIT, 999, '0', COMMAND_FLAG, 
  9070.                         COMMAND_GOTTEN); 
  9071.                         FIELD_GOTTEN (5..7) := DUMMY_STRING (1..3); 
  9072.                         INT_IO.GET (FIELD_GOTTEN (5..7), LOW_LIMIT, LAST); 
  9073.                      else 
  9074.                         FIELD_GOTTEN (5..7) := "   "; 
  9075.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 
  9076.                                   4); 
  9077.                         PUT (FIELD_GOTTEN (5..7)); 
  9078.                      end if; 
  9079.                      exit; 
  9080.                   exception 
  9081.                      when DATA_ERROR => 
  9082.                         PROMPT ("Invalid limits given. Please reenter."); 
  9083.                         COMMAND_FLAG := FALSE; 
  9084.                         COMMAND_GOTTEN := NIL; 
  9085.                      when ERASE_ERROR => 
  9086.                         COMMAND_FLAG := FALSE; 
  9087.                         COMMAND_GOTTEN := NIL; 
  9088.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9089.                         FIELD_GOTTEN (1..7) := "   -   "; 
  9090.                         PUT ("   -   "); 
  9091.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9092.                   end; 
  9093.                end loop; 
  9094.             end ALTITUDE_LIMITS_BLOCK; 
  9095.          --
  9096.          when COMMENT => 
  9097.             READ (FIELD_GOTTEN, FIELD_LENGTH, COMMAND_FLAG, 
  9098.             COMMAND_GOTTEN); 
  9099.          --
  9100.          when GRID_POINT => 
  9101.             begin 
  9102.                loop 
  9103.                   begin 
  9104.                      GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..4), 
  9105.                      FIELD_POSITION, 0, 9999, '0', COMMAND_FLAG, 
  9106.                                COMMAND_GOTTEN); 
  9107.                      DUMMY_STRING (1..1) := FIELD_GOTTEN (5..5); 
  9108.                      GET_CONSTRAINED_CHARACTER (DUMMY_STRING (1..1), 
  9109.                      FIELD_POSITION + 4, '-', '-', COMMAND_FLAG, 
  9110.                                COMMAND_GOTTEN, TRUE); 
  9111.                      FIELD_GOTTEN (5..5) := DUMMY_STRING (1..1); 
  9112.                      DUMMY_STRING (1..3) := FIELD_GOTTEN (6..8); 
  9113.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..3), 
  9114.                      FIELD_POSITION + 5, 10, 999, '0', COMMAND_FLAG, 
  9115.                                COMMAND_GOTTEN); 
  9116.                      FIELD_GOTTEN (6..8) := DUMMY_STRING (1..3); 
  9117.                      if FIELD_GOTTEN (1..4) = "    " and FIELD_GOTTEN (5..8) 
  9118.                                /= "    " then 
  9119.                         raise DATA_ERROR; 
  9120.                      elsif FIELD_GOTTEN (5) = '-' and FIELD_GOTTEN (6..8) = 
  9121.                                "   " then 
  9122.                         raise DATA_ERROR; 
  9123.                      elsif FIELD_GOTTEN (5) = ' ' and FIELD_GOTTEN (6..8) /= 
  9124.                                "   " then 
  9125.                         raise DATA_ERROR; 
  9126.                      end if; 
  9127.                      exit; 
  9128.                   exception 
  9129.                      when DATA_ERROR => 
  9130.                         PROMPT 
  9131.                          ("Must either have valid grid point or all blanks"); 
  9132.                         COMMAND_FLAG := FALSE; 
  9133.                         COMMAND_GOTTEN := NIL; 
  9134.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9135.                         
  9136.                      when ERASE_ERROR => 
  9137.                         COMMAND_FLAG := FALSE; 
  9138.                         COMMAND_GOTTEN := NIL; 
  9139.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9140.                         FIELD_GOTTEN (1..8) := "        "; 
  9141.                         PUT ("        "); 
  9142.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9143.                   end; 
  9144.                end loop; 
  9145.             end; 
  9146.         --
  9147.          when OTHER_ALT => 
  9148.             begin 
  9149.                loop 
  9150.                   begin 
  9151.                      GRF_SUB_2 (FIELD_TYPE, FIELD_GOTTEN (1..2), 
  9152.                                FIELD_POSITION, 2, 
  9153.                      COMMAND_FLAG, COMMAND_GOTTEN); 
  9154.                      DUMMY_STRING (1..3) := FIELD_GOTTEN (3..5); 
  9155.                      GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..3), 
  9156.                      FIELD_POSITION + 2, 0, 999, '0', COMMAND_FLAG, 
  9157.                                COMMAND_GOTTEN); 
  9158.                      FIELD_GOTTEN (3..5) := DUMMY_STRING (1..3); 
  9159.                      
  9160.                      if (FIELD_GOTTEN (1..2) /= "  " and FIELD_GOTTEN (3..5) = 
  9161.                                "   ") or (FIELD_GOTTEN (1..2) = "  " and 
  9162.                                FIELD_GOTTEN (3..5) /= "   ") then 
  9163.                         raise DATA_ERROR; 
  9164.                      end if; 
  9165.                      exit; 
  9166.                   exception 
  9167.                      when DATA_ERROR => 
  9168.                         PROMPT 
  9169.                          ("Must either have complete altitude or all blanks"); 
  9170.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9171.                         COMMAND_FLAG := FALSE; 
  9172.                         COMMAND_GOTTEN := NIL; 
  9173.                      when ERASE_ERROR => 
  9174.                         COMMAND_FLAG := FALSE; 
  9175.                         COMMAND_GOTTEN := NIL; 
  9176.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9177.                         FIELD_GOTTEN (1..5) := "     "; 
  9178.                         PUT ("     "); 
  9179.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9180.                   end; 
  9181.                end loop; 
  9182.             end; 
  9183.          --
  9184.          when PC_OR_TC => 
  9185.             begin 
  9186.                loop 
  9187.                   begin 
  9188.                      GRF_SUB_3 (FIELD_TYPE, FIELD_GOTTEN (1..2), 
  9189.                                FIELD_POSITION, 
  9190.                      2, COMMAND_FLAG, COMMAND_GOTTEN); 
  9191.                      GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION + 3); 
  9192.                      DUMMY_STRING (1..17) := FIELD_GOTTEN (4..20); 
  9193.                      if COMMAND_FLAG = FALSE then 
  9194.                         READ (DUMMY_STRING (1..17), 17, COMMAND_FLAG, 
  9195.                                   COMMAND_GOTTEN); 
  9196.                      end if; 
  9197.                      FIELD_GOTTEN (4..20) := DUMMY_STRING (1..17); 
  9198.                      if (FIELD_GOTTEN (1..2) = "  " and FIELD_GOTTEN (4..20) 
  9199.                                /= BLANKS (1..17)) or (FIELD_GOTTEN (1..2) /= 
  9200.                                "  " and FIELD_GOTTEN (4..20) = BLANKS (1..17)) 
  9201.                                then 
  9202.                         raise DATA_ERROR; 
  9203.                      end if; 
  9204.                      exit; 
  9205.                   exception 
  9206.                      when DATA_ERROR => 
  9207.                         PROMPT 
  9208.                          
  9209.                          
  9210.                          ("Must either have complete crew entry or all blanks"); 
  9211.                         COMMAND_FLAG := FALSE; 
  9212.                         COMMAND_GOTTEN := NIL; 
  9213.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9214.                      when ERASE_ERROR => 
  9215.                         COMMAND_FLAG := FALSE; 
  9216.                         COMMAND_GOTTEN := NIL; 
  9217.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9218.                         FIELD_GOTTEN (1..20) := "  -                 "; 
  9219.                         PUT ("  -                 "); 
  9220.                         GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  9221.                   end; 
  9222.                end loop; 
  9223.             end; 
  9224.          --
  9225.          when FLIGHT_TIME_CATEGORY | MEAN_SEA_LEVEL | MONTH => 
  9226.             GRF_SUB_1 (FIELD_TYPE, FIELD_GOTTEN, FIELD_POSITION, 
  9227.             FIELD_LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  9228.          --
  9229.          when TYPE_CLOUDS | UNITS => 
  9230.             GRF_SUB_2 (FIELD_TYPE, FIELD_GOTTEN, FIELD_POSITION, 
  9231.             FIELD_LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  9232.          --
  9233.          when WEATHER | BEARING | DECIMAL_DIGITS | DIGITAL | DIGITAL_BIG | 
  9234.                    FILLED_DIGITS | FREQUENCY | SCORE | TEMPERATURE | FLT_TIME 
  9235.                    | WEX_TEMP => 
  9236.             GRF_SUB_3 (FIELD_TYPE, FIELD_GOTTEN, FIELD_POSITION, 
  9237.             FIELD_LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  9238.          --
  9239.          when DATE_TIME_GROUP | LATITUDE | LONGITUDE => 
  9240.             GRF_SUB_4 (FIELD_TYPE, FIELD_GOTTEN, FIELD_POSITION, 
  9241.             FIELD_LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  9242.             
  9243.          --
  9244.          when PAD | TURBULENCE | TYPE_CHANGE => 
  9245.             GRF_SUB_5 (FIELD_TYPE, FIELD_GOTTEN, FIELD_POSITION, 
  9246.             FIELD_LENGTH, COMMAND_FLAG, COMMAND_GOTTEN); 
  9247.             
  9248.          when others => 
  9249.             null; 
  9250.          --
  9251.       end case; 
  9252.    exception 
  9253.       when ERASE_ERROR => 
  9254.          COMMAND_FLAG := TRUE; 
  9255.          COMMAND_GOTTEN := ERASE_FIELD; 
  9256.    end GET_RAINFORM_FIELD; 
  9257.    
  9258. end FORMAL_GENERIC_PARAMETERS; 
  9259. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9260. --fgp2.sp
  9261. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9262. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9263. --                                                                    --
  9264. --            Program unit:  PACKAGE MORE_FORMAL_GENERIC_PARAMETERS   --
  9265. --            File name :    FGP2.SP                                  --
  9266. --                                                                    --
  9267. --            ===========================================             --
  9268. --                                                                    --
  9269. --                                                                    --
  9270. --            Produced by Veda Incorporated                           --
  9271. --            Version  1.0      April 15, 1985                        --
  9272. --                                                                    --
  9273. --                                                                    --
  9274. --            This program unit is a member of the GMHF. It           --
  9275. --            was developed using TeleSoft's Ada compiler,            --
  9276. --            version 2.1 in a VAX/VMS environment, version           --
  9277. --            3.7                                                     --
  9278. --                                                                    --
  9279. --                                                                    --
  9280. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9281. --
  9282. with TEXT_IO;                 use TEXT_IO; 
  9283. with MINI_LINES_AND_FIELDS;   use MINI_LINES_AND_FIELDS; 
  9284. with LINKED_LIST_PROCEDURES;  use LINKED_LIST_PROCEDURES; 
  9285. with EDITOR_TYPES;            use EDITOR_TYPES; 
  9286.  
  9287. package MORE_FORMAL_GENERIC_PARAMETERS is 
  9288.  
  9289. --
  9290. -- Things (Get_Rainform_field) got too big to put all the formal generic
  9291. -- parameters in one place so we put the rest of them here.
  9292. --
  9293.  
  9294.    package INT_IO is new INTEGER_IO (INTEGER); 
  9295.    
  9296.    procedure PACK_RAINFORM_LINE (LINE_TO_PACK  : in out LINE_OF_TEXT; 
  9297.                                  LINE_FORMAT   : in LINE_DEFINITION); 
  9298.    
  9299.    procedure UNPACK_RAINFORM_LINE (LINE_TO_UNPACK  : in out LINE_OF_TEXT; 
  9300.                                    LINE_FORMAT     : in LINE_DEFINITION); 
  9301.    
  9302.    package LINE_NAME_IO is new ENUMERATION_IO (USED_RAINFORM_LINES); 
  9303.    
  9304.    package ALL_LINE_NAME_IO is new ENUMERATION_IO 
  9305.              (UNCLASSIFIED_RAINFORM_LINES); 
  9306.    
  9307.    procedure GET_RAINFORM_LINE_NAME (LINE_NAME  : out 
  9308.               UNCLASSIFIED_RAINFORM_LINES); 
  9309.  
  9310.    procedure RAINFORM_LINE_INSERTION; 
  9311.    
  9312.    procedure PARSE_RAINFORM_LINE_TYPE (LINE_TO_PARSE    : NODE; 
  9313.                                        LINE_TYPE_FOUND  : out 
  9314.                                        UNCLASSIFIED_RAINFORM_LINES); 
  9315.    
  9316. end MORE_FORMAL_GENERIC_PARAMETERS; 
  9317. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9318. --fgp2.txt
  9319. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9320. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  9321. --                                                                    --
  9322. --            Program unit:  PACKAGE MORE_FORMAL_GENERIC_PARAMETERS   --
  9323. --            File name :    FGP2.TXT                                 --
  9324. --                                                                    --
  9325. --            ===========================================             --
  9326. --                                                                    --
  9327. --                                                                    --
  9328. --            Produced by Veda Incorporated                           --
  9329. --            Version  1.0      April 15, 1985                        --
  9330. --                                                                    --
  9331. --                                                                    --
  9332. --            This program unit is a member of the GMHF. It           --
  9333. --            was developed using TeleSoft's Ada compiler,            --
  9334. --            version 2.1 in a VAX/VMS environment, version           --
  9335. --            3.7                                                     --
  9336. --                                                                    --
  9337. --                                                                    --
  9338. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9339. --
  9340. with TERMINAL_DEFINITION;    use TERMINAL_DEFINITION; 
  9341. with MAN_MACHINE_INTERFACE;  use MAN_MACHINE_INTERFACE; 
  9342.  
  9343. package body MORE_FORMAL_GENERIC_PARAMETERS is 
  9344.  
  9345.    procedure PACK_RAINFORM_LINE (LINE_TO_PACK  : in out LINE_OF_TEXT; 
  9346.                                  LINE_FORMAT   : in LINE_DEFINITION) is 
  9347.    
  9348.       TEMP_LINE          : LINE_OF_TEXT; -- working text to hold non-empty fields
  9349.       POINTER            : INTEGER range 1..71; -- points to next spot in temp_line
  9350.       FIRST_NON_BLANK    : INTEGER range 1..69; --points to 1st /' ' in fld
  9351.       LAST_NON_BLANK     : INTEGER range 1..69;          -- similar to above
  9352.       NUMBER_NON_BLANK   : INTEGER range 0..69;    -- number /= ' ' in fld
  9353.       NUMBER_OF_FILLERS  : INTEGER range 0..69;   --number of spots to blank
  9354.       FIELD_POSITION     : NATURAL; 
  9355.       LINE_LENGTH        : INTEGER; 
  9356.       FIELD_LENGTH       : NATURAL; 
  9357.       LEADING_CONTENT    : NATURAL; 
  9358.       TRAILING_CONTENT   : NATURAL; 
  9359.       NUMBER_TO_REWRITE  : NATURAL; 
  9360.       END_OF_FIELD       : NATURAL; 
  9361.       BLANK_LINE         : STRING (1..69) := (others => ' '); 
  9362.       STRING_TO_REWRITE  : STRING (1..69); 
  9363.       LEAD_STRING        : STRING (1..69); 
  9364.       TRAIL_STRING       : STRING (1..69); 
  9365.       
  9366.    begin 
  9367. --
  9368.       -- if the line has no fields, don't pack it.
  9369.       --
  9370.       if LINE_FORMAT.NUMBER_OF_FIELDS = 0 then 
  9371.          return; 
  9372.       end if; 
  9373.       --
  9374.       -- we're going to pack, so put passed line into temp line
  9375.       -- and initialize pointer
  9376.       --
  9377.       LINE_LENGTH := LINE_FORMAT.COMPONENT 
  9378.                 (LINE_FORMAT.NUMBER_OF_FIELDS).FIELD_LENGTH + 
  9379.                 LINE_FORMAT.COMPONENT 
  9380.                 (LINE_FORMAT.NUMBER_OF_FIELDS).FIELD_POSITION - 1; 
  9381.       
  9382.       --
  9383.       -- any trailing content ?
  9384.       --
  9385.       declare TEMP_PTR : INTEGER := 0; 
  9386.       begin 
  9387.          for I in 1..10 loop 
  9388.             if (LINE_LENGTH + I) > 69 or else LINE_FORMAT.PROTOTYPE_LINE 
  9389.                       (LINE_LENGTH + I) = ' ' then 
  9390.                TEMP_PTR := I; 
  9391.                exit; 
  9392.             end if; 
  9393.          end loop; 
  9394.          LINE_LENGTH := LINE_LENGTH + TEMP_PTR - 1; 
  9395.       end; 
  9396.       
  9397.       TEMP_LINE := LINE_TO_PACK; 
  9398.       
  9399.       POINTER := LINE_FORMAT.COMPONENT (1).FIELD_POSITION; 
  9400.       for I in reverse 1..LINE_FORMAT.COMPONENT (1).FIELD_POSITION loop 
  9401.          if LINE_FORMAT.PROTOTYPE_LINE (I - 1) /= '/' then 
  9402.             POINTER := POINTER - 1; 
  9403.          else 
  9404.             exit; 
  9405.          end if; 
  9406.       end loop; 
  9407.       --
  9408.       -- we pack field at a time. first we determine whether the field
  9409.       -- is empty. if so, the field becomes null. if not, we strip off
  9410.       -- leading and trailing blanks.
  9411.       --
  9412.       for I in 1..LINE_FORMAT.NUMBER_OF_FIELDS loop 
  9413.          --
  9414.          -- for readibility
  9415.          --
  9416.          FIELD_POSITION := LINE_FORMAT.COMPONENT (I).FIELD_POSITION; 
  9417.          FIELD_LENGTH := LINE_FORMAT.COMPONENT (I).FIELD_LENGTH; 
  9418.          END_OF_FIELD := FIELD_POSITION + FIELD_LENGTH - 1; 
  9419.          --
  9420.          -- compare to prototype field to see if this field is empty
  9421.          --
  9422.          --
  9423.          if LINE_TO_PACK (FIELD_POSITION..END_OF_FIELD) /= 
  9424.                    LINE_FORMAT.PROTOTYPE_LINE (FIELD_POSITION..END_OF_FIELD) 
  9425.                    then 
  9426.             --
  9427.             -- non-null field. first strip off leading blanks.
  9428.             --
  9429.          
  9430.             LEADING_CONTENT := 0; 
  9431.             TRAILING_CONTENT := 0; 
  9432.             STRING_TO_REWRITE := (1..69 => ' '); 
  9433.             LEAD_STRING := (1..69 => ' '); 
  9434.             TRAIL_STRING := (1..69 => ' '); 
  9435.             
  9436.             for J in 1..10 loop -- 10 is more than enough
  9437.                if LINE_FORMAT.PROTOTYPE_LINE (FIELD_POSITION - J) /= '/' then 
  9438.                   LEADING_CONTENT := LEADING_CONTENT + 1; 
  9439.                else 
  9440.                   exit; 
  9441.                end if; 
  9442.             end loop; 
  9443.             if LEADING_CONTENT > 0 then 
  9444.                LEAD_STRING (1..LEADING_CONTENT) := LINE_FORMAT.PROTOTYPE_LINE 
  9445.                          (FIELD_POSITION - LEADING_CONTENT..FIELD_POSITION - 
  9446.                          1); 
  9447.             end if; 
  9448.             for J in 1..10 loop 
  9449.                if LINE_FORMAT.PROTOTYPE_LINE (END_OF_FIELD + J) /= '/' and 
  9450.                          (END_OF_FIELD + J) <= LINE_LENGTH then 
  9451.                   TRAILING_CONTENT := TRAILING_CONTENT + 1; 
  9452.                else 
  9453.                   exit; 
  9454.                end if; 
  9455.             end loop; 
  9456.             if TRAILING_CONTENT > 0 then 
  9457.                TRAIL_STRING (1..TRAILING_CONTENT) := 
  9458.                          LINE_FORMAT.PROTOTYPE_LINE (END_OF_FIELD + 
  9459.                          1..END_OF_FIELD + TRAILING_CONTENT); 
  9460.             end if; 
  9461.             
  9462.             FIRST_NON_BLANK := FIELD_POSITION; 
  9463.             LAST_NON_BLANK := END_OF_FIELD; 
  9464.             --
  9465.             for J in 1..FIELD_LENGTH loop 
  9466.                --
  9467.                -- assuming this character is not blank. if it is, exit.
  9468.                -- if not, assume the next is non-blank,and continue loop
  9469.                --
  9470.                if LINE_TO_PACK (FIELD_POSITION + J - 1) = ' ' then 
  9471.                   FIRST_NON_BLANK := FIRST_NON_BLANK + 1; 
  9472.                else 
  9473.                   exit; 
  9474.                end if; 
  9475.                   --
  9476.             end loop; 
  9477.             --
  9478.             -- now strip off trailing blanks.
  9479.             --
  9480.             for J in reverse 1..FIELD_LENGTH loop 
  9481.                --
  9482.                -- assuming this character is not blank. if it is, exit.
  9483.                -- if not, assume the next is non-blank,and continue loop
  9484.                --
  9485.                if LINE_TO_PACK (FIELD_POSITION + J - 1) = ' ' then 
  9486.                   LAST_NON_BLANK := LAST_NON_BLANK - 1; 
  9487.                else 
  9488.                   exit; 
  9489.                end if; 
  9490.                   --
  9491.             end loop; 
  9492.             --
  9493.             -- let's be sure that first_non_blank <= last_non_blank
  9494.             --
  9495.             if FIRST_NON_BLANK > LAST_NON_BLANK then 
  9496.                PROMPT ("something's wrong in pack"); 
  9497.             end if; 
  9498.             
  9499.             NUMBER_NON_BLANK := LAST_NON_BLANK - FIRST_NON_BLANK + 1; 
  9500.             --
  9501.             -- now lets put the non-blank substring into temp_line
  9502.             --
  9503.             NUMBER_TO_REWRITE := 0; 
  9504.             if LEADING_CONTENT > 0 then 
  9505.                STRING_TO_REWRITE (1..LEADING_CONTENT) := LEAD_STRING 
  9506.                          (1..LEADING_CONTENT); 
  9507.                NUMBER_TO_REWRITE := LEADING_CONTENT; 
  9508.             end if; 
  9509.             
  9510.             STRING_TO_REWRITE (NUMBER_TO_REWRITE + 1..NUMBER_TO_REWRITE + 
  9511.                       NUMBER_NON_BLANK) := LINE_TO_PACK 
  9512.                       (FIRST_NON_BLANK..LAST_NON_BLANK); 
  9513.             NUMBER_TO_REWRITE := NUMBER_TO_REWRITE + NUMBER_NON_BLANK; 
  9514.             
  9515.             if TRAILING_CONTENT > 0 then 
  9516.                STRING_TO_REWRITE (NUMBER_TO_REWRITE + 1..NUMBER_TO_REWRITE + 
  9517.                          TRAILING_CONTENT) := TRAIL_STRING 
  9518.                          (1..TRAILING_CONTENT); 
  9519.                NUMBER_TO_REWRITE := NUMBER_TO_REWRITE + TRAILING_CONTENT; 
  9520.             end if; 
  9521.             
  9522.             TEMP_LINE (POINTER..POINTER + NUMBER_TO_REWRITE) := 
  9523.                       STRING_TO_REWRITE (1..NUMBER_TO_REWRITE) & "/"; 
  9524.             --
  9525.             -- finally we update pointer
  9526.             --
  9527.             POINTER := POINTER + NUMBER_TO_REWRITE + 1; 
  9528.             --
  9529.          else 
  9530.          --
  9531.          -- here the field was null, so just add a '/'
  9532.          --
  9533.             TEMP_LINE (POINTER) := '/'; 
  9534.             POINTER := POINTER + 1; 
  9535.          --
  9536.          end if; 
  9537.       end loop; 
  9538.       --
  9539.       -- strip off any trailing /'s
  9540.       --
  9541.       while TEMP_LINE (POINTER - 1) = '/' loop 
  9542.          TEMP_LINE (POINTER - 1) := ' '; 
  9543.          POINTER := POINTER - 1; 
  9544.       end loop; 
  9545.       --
  9546.       if POINTER <= 69 then 
  9547.          NUMBER_OF_FILLERS := 69 - POINTER + 1; 
  9548.          TEMP_LINE (POINTER..69) := BLANK_LINE (1..NUMBER_OF_FILLERS); 
  9549.       end if; 
  9550.       --
  9551.       -- replace line_to_pack with temp_line
  9552.       --
  9553.       LINE_TO_PACK := TEMP_LINE; 
  9554.       --
  9555.    end PACK_RAINFORM_LINE; 
  9556.    --
  9557.    
  9558.    procedure UNPACK_RAINFORM_LINE (LINE_TO_UNPACK  : in out LINE_OF_TEXT; 
  9559.                                    LINE_FORMAT     : in LINE_DEFINITION) is 
  9560.    
  9561.       TEMP_LINE          : LINE_OF_TEXT := (1..80 => ' ');        -- working text
  9562.       POINTER            : INTEGER range 1..71;  --points to next spot in ln_to_upk
  9563.       FIRST_NON_BLANK    : INTEGER range 1..69; --points to 1st /' ' in fld
  9564.       LAST_NON_BLANK     : INTEGER range 1..69;          -- similar to above
  9565.       NUMBER_NON_BLANK   : INTEGER range 0..69;    -- number /= ' ' in fld
  9566.       NUMBER_BLANK       : INTEGER;                -- number = ' ' to left pad
  9567.       NUMBER_OF_FILLERS  : INTEGER range 0..69;   --number of spots to blank
  9568.       FIELD_POSITION     : NATURAL; 
  9569.       STR                : STRING (1..1); 
  9570.       LEADING_CONTENT    : NATURAL := 0; 
  9571.       TRAILING_CONTENT   : NATURAL := 0; 
  9572.       LINE_LENGTH        : NATURAL; 
  9573.       FIELD_LENGTH       : NATURAL; 
  9574.       END_OF_FIELD       : NATURAL; 
  9575.       BLANK_LINE         : STRING (1..69) := (others => ' '); 
  9576.       TEMP_NON_BLANK     : POSITIVE; 
  9577.       LOOP_LENGTH        : POSITIVE; 
  9578.       
  9579.    begin 
  9580.       --
  9581.       if LINE_FORMAT.NUMBER_OF_FIELDS = 0 then 
  9582.          return; 
  9583.       end if; 
  9584.       --
  9585.       -- we're going to unpack.
  9586.       -- initialize pointer to the first possible character,
  9587.       -- and we initialize temp_line to the prototype line.
  9588.       --
  9589.       
  9590.       LINE_LENGTH := LINE_FORMAT.COMPONENT 
  9591.                 (LINE_FORMAT.NUMBER_OF_FIELDS).FIELD_LENGTH + 
  9592.                 LINE_FORMAT.COMPONENT 
  9593.                 (LINE_FORMAT.NUMBER_OF_FIELDS).FIELD_POSITION - 1; 
  9594.       
  9595.       --
  9596.       -- any trailing content ?
  9597.       --
  9598.       declare TEMP_PTR : INTEGER := 0; 
  9599.       begin 
  9600.          for I in 1..10 loop 
  9601.             if (LINE_LENGTH + I) > 69 or else LINE_FORMAT.PROTOTYPE_LINE 
  9602.                       (LINE_LENGTH + I) = ' ' then 
  9603.                TEMP_PTR := I; 
  9604.                exit; 
  9605.             end if; 
  9606.          end loop; 
  9607.          LINE_LENGTH := LINE_LENGTH + TEMP_PTR - 1; 
  9608.       end; 
  9609.       
  9610.       TEMP_LINE (1..LINE_LENGTH) := LINE_FORMAT.PROTOTYPE_LINE 
  9611.                 (1..LINE_LENGTH); 
  9612.       
  9613.       TEMP_NON_BLANK := LINE_LENGTH; 
  9614.       
  9615.       for I in reverse 1..LINE_LENGTH loop 
  9616.          if LINE_TO_UNPACK (I) /= ' ' then 
  9617.             TEMP_NON_BLANK := I; 
  9618.             exit; 
  9619.          end if; 
  9620.       end loop; 
  9621.       
  9622.       LINE_TO_UNPACK (TEMP_NON_BLANK + 1..TEMP_NON_BLANK + 2) := "/ "; 
  9623.       
  9624.       for I in 1..LINE_LENGTH loop 
  9625.          if LINE_TO_UNPACK (I) = '/' then 
  9626.             POINTER := I + 1; 
  9627.             exit; 
  9628.          end if; 
  9629.       end loop; 
  9630.       
  9631.       --
  9632.       -- we unpack field at a time. first we determine whether the field
  9633.       -- is null. if so, the field is filled with blanks. if not, we
  9634.       -- place the characters right-justified into the field.
  9635.       --
  9636.       for I in 1..LINE_FORMAT.NUMBER_OF_FIELDS + 1 loop 
  9637.          --
  9638.          -- see if field is null or if we are at the end of the line
  9639.          --
  9640.          if LINE_TO_UNPACK (POINTER) = '/' then 
  9641.             -- 
  9642.             -- null field so leave temp_line as prototype
  9643.             -- 
  9644.             POINTER := POINTER + 1; 
  9645.             --
  9646.          elsif LINE_TO_UNPACK (POINTER) = ' ' then 
  9647.             -- 
  9648.             -- we're done with this line so exit loop
  9649.             -- 
  9650.             exit; 
  9651.             -- 
  9652.          else 
  9653.             -- 
  9654.             -- there's something here, so isolate it, pad on the
  9655.             -- left with blanks, and put it in temp_line.
  9656.             -- to do this, initialize first & last non-blank to
  9657.             -- first non blank character. then increment pointer
  9658.             -- and update last_non_blank as appropriate while looping
  9659.             -- through the field
  9660.             --
  9661.             --
  9662.             -- for readibility
  9663.             --
  9664.             FIELD_POSITION := LINE_FORMAT.COMPONENT (I).FIELD_POSITION; 
  9665.             FIELD_LENGTH := LINE_FORMAT.COMPONENT (I).FIELD_LENGTH; 
  9666.             END_OF_FIELD := FIELD_POSITION + FIELD_LENGTH - 1; 
  9667.             
  9668.             LEADING_CONTENT := 0; 
  9669.             TRAILING_CONTENT := 0; 
  9670.             
  9671.             for J in 1..10 loop -- 10 is more than enough
  9672.                if LINE_FORMAT.PROTOTYPE_LINE (FIELD_POSITION - J) /= '/' then 
  9673.                   LEADING_CONTENT := LEADING_CONTENT + 1; 
  9674.                else 
  9675.                   exit; 
  9676.                end if; 
  9677.             end loop; 
  9678.             
  9679.             for J in 1..10 loop 
  9680.                if LINE_FORMAT.PROTOTYPE_LINE (END_OF_FIELD + J) /= '/' and 
  9681.                          (END_OF_FIELD + J) < LINE_LENGTH then 
  9682.                   TRAILING_CONTENT := TRAILING_CONTENT + 1; 
  9683.                else 
  9684.                   exit; 
  9685.                end if; 
  9686.             end loop; 
  9687.             
  9688.             FIRST_NON_BLANK := POINTER; 
  9689.             --
  9690.             -- isolate the last character of the field
  9691.             --
  9692.             LOOP_LENGTH := FIRST_NON_BLANK + FIELD_LENGTH + LEADING_CONTENT + 
  9693.                       TRAILING_CONTENT; 
  9694.             
  9695.             if LINE_TO_UNPACK (1..5) = "ASSOC" then 
  9696.                for J in reverse 7..69 loop 
  9697.                   if LINE_TO_UNPACK (J) /= ' ' then 
  9698.                      LAST_NON_BLANK := J; 
  9699.                      POINTER := J + 1; 
  9700.                      exit; 
  9701.                   end if; 
  9702.                end loop; 
  9703.             else 
  9704.                for J in FIRST_NON_BLANK..LOOP_LENGTH loop 
  9705.                   if J = LOOP_LENGTH or else LINE_TO_UNPACK (J) = '/' then 
  9706.                      LAST_NON_BLANK := J - 1; 
  9707.                      POINTER := J + 1; 
  9708.                      exit; 
  9709.                   end if; 
  9710.                end loop; 
  9711.             end if; 
  9712.             --
  9713.             -- compute number of non_blanks and left pad
  9714.             --
  9715.             NUMBER_NON_BLANK := LAST_NON_BLANK - FIRST_NON_BLANK - 
  9716.                       LEADING_CONTENT - TRAILING_CONTENT + 1; 
  9717.             NUMBER_BLANK := FIELD_LENGTH - NUMBER_NON_BLANK; 
  9718.             TEMP_LINE (FIELD_POSITION..END_OF_FIELD) := LINE_TO_UNPACK 
  9719.                       (FIRST_NON_BLANK + LEADING_CONTENT..LAST_NON_BLANK - 
  9720.                       TRAILING_CONTENT) & BLANK_LINE (1..NUMBER_BLANK); 
  9721.          end if; 
  9722.          
  9723.       end loop; 
  9724.       --
  9725.       -- replace line_to_pack with temp_line
  9726.       --
  9727.       LINE_TO_UNPACK (1..LINE_LENGTH) := TEMP_LINE (1..LINE_LENGTH); 
  9728.       if LINE_LENGTH < 69 then 
  9729.          LINE_TO_UNPACK (LINE_LENGTH + 1..69) := BLANK_LINE (LINE_LENGTH + 
  9730.                    1..69); 
  9731.       end if; 
  9732.       --
  9733.    exception 
  9734.    
  9735.       when CONSTRAINT_ERROR => 
  9736.          PROMPT ("Constraint error in unpack"); 
  9737.          
  9738.    end UNPACK_RAINFORM_LINE; 
  9739.    
  9740.    
  9741.    
  9742.    procedure GET_RAINFORM_LINE_NAME (LINE_NAME  : out 
  9743.                                     UNCLASSIFIED_RAINFORM_LINES) is
  9744.  
  9745.       DUMMY_STRING       : STRING (1..8); 
  9746.       CHARACTERS_GOTTEN  : POSITIVE; 
  9747.       COMMAND_FLAG       : BOOLEAN; 
  9748.       COMMAND_GOTTEN     : COMMAND; 
  9749.    begin 
  9750.       loop 
  9751.          begin 
  9752.             READ (DUMMY_STRING, 8, COMMAND_FLAG, COMMAND_GOTTEN); 
  9753.             LINE_NAME_IO.GET (DUMMY_STRING, LINE_NAME, CHARACTERS_GOTTEN); 
  9754.             exit; 
  9755.          exception 
  9756.             when END_ERROR => 
  9757.                exit; 
  9758.             when others => 
  9759.                PROMPT ("Invalid line name entry. Please reenter data."); 
  9760.                GOTO_CRT_POSITION (TOP_OF_AMP_AREA + 4, 70); 
  9761.          end; 
  9762.       end loop; 
  9763.       
  9764.    end GET_RAINFORM_LINE_NAME; 
  9765.    
  9766.    procedure RAINFORM_LINE_INSERTION is 
  9767.    
  9768.    begin 
  9769.       null; 
  9770.    end RAINFORM_LINE_INSERTION; 
  9771.    
  9772.    
  9773.    
  9774.    procedure PARSE_RAINFORM_LINE_TYPE (LINE_TO_PARSE    : NODE; 
  9775.                                        LINE_TYPE_FOUND  : out 
  9776.                                        UNCLASSIFIED_RAINFORM_LINES) is 
  9777.    
  9778.       TEMP_LINE_TYPE        : UNCLASSIFIED_RAINFORM_LINES; 
  9779.       NUMBER_OF_CHARACTERS  : INTEGER range 3..10; 
  9780.       N_CHAR                : POSITIVE; 
  9781.       
  9782.    begin 
  9783.    --
  9784.    -- we proceed from head to tail of the message in wd, and
  9785.    -- for each line, we deterime the line type from the first 3-5
  9786.    -- characters of the line of text
  9787.    -- we then determine the position of that line type in the type
  9788.    -- Rainform_lines, and store the position in the line_type
  9789.    -- field of the message component.
  9790.    --
  9791.       GET_BLOCK : 
  9792.       begin 
  9793.          ALL_LINE_NAME_IO.GET (LINE_TO_PARSE.TEXT_LINE, 
  9794.          TEMP_LINE_TYPE, N_CHAR); 
  9795.       exception 
  9796.          when DATA_ERROR => 
  9797.             TEMP_LINE_TYPE := FREE; 
  9798.             PROMPT ("illegal linetype found - set to freeform"); 
  9799.       end GET_BLOCK; 
  9800.       
  9801.       if TEMP_LINE_TYPE = FREE then 
  9802.          LINE_TYPE_FOUND := FREE; 
  9803.          return; 
  9804.       end if; 
  9805.       --
  9806.       -- in certain cases, one line type is a prefix of another. check
  9807.       -- to determine which type we have here.
  9808.       --
  9809.       for I in reverse 1..69 loop 
  9810.          if LINE_TO_PARSE.TEXT_LINE (I) /= ' ' then 
  9811.             N_CHAR := I; 
  9812.             exit; 
  9813.          end if; 
  9814.       end loop; 
  9815.       case TEMP_LINE_TYPE is 
  9816.          --
  9817.          when AREA => 
  9818.             if N_CHAR <= 5 then 
  9819.                TEMP_LINE_TYPE := AREA_LL; 
  9820.             elsif LINE_TO_PARSE.TEXT_LINE (6) = 'A' then 
  9821.                TEMP_LINE_TYPE := AREA_A; 
  9822.             elsif LINE_TO_PARSE.TEXT_LINE (N_CHAR - 1..N_CHAR) = "NM" then 
  9823.                TEMP_LINE_TYPE := AREA_C; 
  9824.             else 
  9825.                TEMP_LINE_TYPE := AREA_LL; 
  9826.             end if; 
  9827.             
  9828.          when ELLIP => 
  9829.             if LINE_TO_PARSE.TEXT_LINE (N_CHAR - 3..N_CHAR) = "SQNM" then 
  9830.                TEMP_LINE_TYPE := ELLIP_A; 
  9831.             else 
  9832.                TEMP_LINE_TYPE := ELLIP_R; 
  9833.             end if; 
  9834.             
  9835.          when ROUTE => 
  9836.             if N_CHAR <= 6 then 
  9837.                TEMP_LINE_TYPE := ROUTE_LL; 
  9838.             elsif LINE_TO_PARSE.TEXT_LINE (7) = 'P' then 
  9839.                           --
  9840.                           -- first find next '/' then see if there is
  9841.                           -- a "P-" following.
  9842.                           --
  9843.                TEMP_LINE_TYPE := ROUTE_PL; 
  9844.                OUTER : 
  9845.                for I in 7..N_CHAR loop 
  9846.                   if LINE_TO_PARSE.TEXT_LINE (I) = '/' then 
  9847.                      INNER : 
  9848.                      for J in I..N_CHAR loop 
  9849.                         if LINE_TO_PARSE.TEXT_LINE (J..J + 1) = "P-" then 
  9850.                            TEMP_LINE_TYPE := ROUTE_PP; 
  9851.                            exit OUTER; 
  9852.                         end if; 
  9853.                      end loop INNER; 
  9854.                   end if; 
  9855.                end loop OUTER; 
  9856.             else 
  9857.                        --
  9858.                        -- its a route_lx. fill in the x
  9859.                        --
  9860.                TEMP_LINE_TYPE := ROUTE_LL; 
  9861.                INNER2 : 
  9862.                for I in 7..N_CHAR loop 
  9863.                   if LINE_TO_PARSE.TEXT_LINE (I..I + 1) = "P-" then 
  9864.                      TEMP_LINE_TYPE := ROUTE_LP; 
  9865.                      exit; 
  9866.                   end if; 
  9867.                end loop INNER2; 
  9868.             end if; 
  9869.             
  9870.          when TRACK => 
  9871.             if N_CHAR >= 7 and LINE_TO_PARSE.TEXT_LINE (7) = 'T' then 
  9872.                TEMP_LINE_TYPE := TRACK_N; 
  9873.             else 
  9874.                TEMP_LINE_TYPE := TRACK_LL; 
  9875.             end if; 
  9876.             
  9877.          when others => 
  9878.             null; 
  9879.          --
  9880.       end case; 
  9881.       LINE_TYPE_FOUND := TEMP_LINE_TYPE; 
  9882.       
  9883.    end PARSE_RAINFORM_LINE_TYPE; 
  9884. end MORE_FORMAL_GENERIC_PARAMETERS; 
  9885. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9886. --rfeditor.txt
  9887. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9888. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  9889. --                                                                    --
  9890. --            Program unit:  PACKAGE RF_EDITOR                        --
  9891. --            File name :    RFEDITOR.TXT                             --
  9892. --                                                                    --
  9893. --            ===========================================             --
  9894. --                                                                    --
  9895. --                                                                    --
  9896. --            Produced by Veda Incorporated                           --
  9897. --            Version  1.0      April 15, 1985                        --
  9898. --                                                                    --
  9899. --                                                                    --
  9900. --            This program unit is a member of the GMHF. It           --
  9901. --            was developed using TeleSoft's Ada compiler,            --
  9902. --            version 2.1 in a VAX/VMS environment, version           --
  9903. --            3.7                                                     --
  9904. --                                                                    --
  9905. --                                                                    --
  9906. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9907. --
  9908. with MINI_LINES_AND_FIELDS;           use MINI_LINES_AND_FIELDS; 
  9909. with FILE_GENERIC;                    use FILE_GENERIC; 
  9910. with FORMAL_GENERIC_PARAMETERS;       use FORMAL_GENERIC_PARAMETERS; 
  9911. with MORE_FORMAL_GENERIC_PARAMETERS;  use MORE_FORMAL_GENERIC_PARAMETERS; 
  9912. with LINKED_LIST_PROCEDURES;          use LINKED_LIST_PROCEDURES; 
  9913. with CLASSIFICATION_DEFINITION;       use CLASSIFICATION_DEFINITION; 
  9914. --
  9915. package RF_EDITOR is 
  9916.    package RAINFORM_ED is new FILE_GENERIC.FILED_GENERIC_MESSAGE_EDITOR 
  9917.              (MAXIMUM_FIELDS_PER_LINE => 17, MAXIMUM_CHARACTERS_PER_LINE => 
  9918.              69, MAXIMUM_LINES_PER_MESSAGE => 100, LINE_NAME => 
  9919.              UNCLASSIFIED_RAINFORM_LINES, GET_LINE_NAME => 
  9920.              GET_RAINFORM_LINE_NAME, FIELD_NAME => SUBSET_OF_RAINFORM_FIELDS, 
  9921.              LINE_STRUCTURE_FILE_NAME => "RAINFORM.DES", 
  9922.              FIELD_PROMPT_FILE_NAME => "RNPROMPT.DES", 
  9923.              PROMPT_VECTOR_FILE_NAME => "RAINLUT.DES", GET_FIELD => 
  9924.              GET_RAINFORM_FIELD, PACK_LINE => PACK_RAINFORM_LINE, UNPACK_LINE 
  9925.              => UNPACK_RAINFORM_LINE, VALIDATE_LINE_INSERTION => 
  9926.              RAINFORM_LINE_INSERTION, PARSE_LINE_TYPE => 
  9927.              PARSE_RAINFORM_LINE_TYPE); 
  9928.    --
  9929. --
  9930. end RF_EDITOR; 
  9931. --
  9932. package body RF_EDITOR is 
  9933.    --
  9934. end RF_EDITOR; 
  9935. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9936. --urlnsflds.sp
  9937. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9938. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9939. --                                                                    --
  9940. --            Program unit:  PACKAGE UNITREP_LINES_AND_FIELDS         --
  9941. --            File name :    URLNSFLDS.SP                             --
  9942. --                                                                    --
  9943. --            ===========================================             --
  9944. --                                                                    --
  9945. --                                                                    --
  9946. --            Produced by Veda Incorporated                           --
  9947. --            Version  1.0      April 15, 1985                        --
  9948. --                                                                    --
  9949. --                                                                    --
  9950. --            This program unit is a member of the GMHF. It           --
  9951. --            was developed using TeleSoft's Ada compiler,            --
  9952. --            version 2.1 in a VAX/VMS environment, version           --
  9953. --            3.7                                                     --
  9954. --                                                                    --
  9955. --                                                                    --
  9956. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  9957. --
  9958. package UNITREP_LINES_AND_FIELDS is 
  9959. --
  9960. -- FIRST, define the line types used in Unitrep messages
  9961. --
  9962.    type UNITREP_LINE_NAMES is (A,   B,   C,   D,   G,   J,   K,   L,   M,   
  9963.                                N,   P,   Q,   T,   V,   X,   R,   DM1, DN1, 
  9964.                                JM1, KF1, KF2, KF3, KF4, KN1, RM3, TF1, H,   
  9965.                                E,   NIL); 
  9966. --
  9967. -- ALSO, define values for the number of lines, number of characters
  9968. --       per line, and number of fields per line
  9969. --
  9970.    UNITREP_MAXIMUM_FIELDS_PER_LINE      : POSITIVE := 34; 
  9971. --
  9972.    UNITREP_MAXIMUM_CHARACTERS_PER_LINE  : POSITIVE := 80; 
  9973. --
  9974.    UNITREP_MAXIMUM_LINES_PER_MESSAGE    : POSITIVE := 75; 
  9975. --
  9976. -- NEXT, define the names of the fields for Unitrep messages
  9977. --
  9978.    type UNITREP_FIELD_NAMES is (CARD_NUMBER,      CLASSIFICATION,   
  9979.                                 UAC,              RECORD_ID,        
  9980.                                 UIC,              ORIGINATORS_UIC,  
  9981.                                 MESSAGE_TYPE,     MESSAGE_NUMBER,   
  9982.                                 UDC,              ANAME,            
  9983.                                 UTC,              ULC,              
  9984.                                 MJCOM,            MAJOR,            
  9985.                                 REVAL,            TPSN,             
  9986.                                 SCLAS,            LNAME,            
  9987.                                 COAFF,            MONOR,            
  9988.                                 CSERV,            OPCON,            
  9989.                                 ADCON,            HOGEO,            
  9990.                                 PRGEO,            EMBRK,            
  9991.                                 ACTIV,            FLAG,             
  9992.                                 PUIC,             CBCOM,            
  9993.                                 DFCON,            POINT,            
  9994.                                 NUCIN,            PCTEF,            
  9995.                                 BILET,            CORNK,            
  9996.                                 CONAM,            MMCMD,            
  9997.                                 NTASK,            MODFG,            
  9998.                                 PLETD,            NDEST,            
  9999.                                 DETA,             CXMRS,            
  10000.                                 TCAA,             MEDIA,            
  10001.                                 TADC,             ROUTE,            
  10002.                                 RWDTE,            XRTE,             
  10003.                                 XDATE,            TPERS,            
  10004.                                 PEGEO,            STRUC,            
  10005.                                 AUTH,             ASGD,             
  10006.                                 POSTR,            PICDA,            
  10007.                                 DEPS,             TDEPS,            
  10008.                                 CASPW,            CCASP,            
  10009.                                 CCEBY,            SCATD,            
  10010.                                 MGO,              AGO,              
  10011.                                 NA,               NFO,              
  10012.                                 MENL,             NAVO,             
  10013.                                 NAVE,             OTHOF,            
  10014.                                 OTHEN,            PIAOD,            
  10015.                                 TREAD,            READY,            
  10016.                                 REASN,            PRRAT,            
  10017.                                 PRRES,            ESRAT,            
  10018.                                 ESRES,            ERRAT,            
  10019.                                 ERRES,            TRRAT,            
  10020.                                 TRRES,            SECRN,            
  10021.                                 TERRN,            CARAT,            
  10022.                                 CADAT,            LIM,              
  10023.                                 RLIM,             RICDA,            
  10024.                                 DOCNR,            DOCID,            
  10025.                                 PERTP,            TPAUT,            
  10026.                                 TPASG,            TPAVL,            
  10027.                                 PERTC,            CPAUR,            
  10028.                                 CPASG,            CPAVL,            
  10029.                                 TRUTC,            TMTHD,            
  10030.                                 TCARQ,            TCRAS,            
  10031.                                 TCRAV,            TRSA1,            
  10032.                                 TRSA2,            TRSA3,            
  10033.                                 TRSA4,            TRSA5,            
  10034.                                 EQSEE,            EQSSE,            
  10035.                                 MEARD,            MEASG,            
  10036.                                 MEPOS,            ESSA1,            
  10037.                                 ESSA2,            ESSA3,            
  10038.                                 ESSA4,            ESSA5,            
  10039.                                 ESSA6,            ESSA7,            
  10040.                                 ESSA8,            ESSA9,            
  10041.                                 EQREE,            EQRED,            
  10042.                                 MEMRA,            ERSA1,            
  10043.                                 ERSA2,            ERSA3,            
  10044.                                 ERSA4,            ERSA5,            
  10045.                                 ERSA6,            ERSA7,            
  10046.                                 ERSA8,            SDOC,             
  10047.                                 READF,            REASF,            
  10048.                                 PRRAF,            PRREF,            
  10049.                                 ESRAF,            ESREF,            
  10050.                                 ERRAF,            ERREF,            
  10051.                                 TRRAF,            TRREF,            
  10052.                                 SECRF,            TERRF,            
  10053.                                 CARAF,            CADAF,            
  10054.                                 LIMF,             RLIMF,            
  10055.                                 RICDF,            RESPF,            
  10056.                                 SMCC1,            SMRA1,            
  10057.                                 SMAA1,            SMRC1,            
  10058.                                 SMAC1,            SMCC2,            
  10059.                                 SMRA2,            SMAA2,            
  10060.                                 SMRC2,            SMAC2,            
  10061.                                 SMCC3,            SMRA3,            
  10062.                                 SMAA3,            SMRC3,            
  10063.                                 SMAC3,            SMCC4,            
  10064.                                 SMRA4,            SMAA4,            
  10065.                                 SMRC4,            SMAC4,            
  10066.                                 GCCLA,            GCCLB,            
  10067.                                 GCCLC,            SPCLU,            
  10068.                                 PRMA,             MARAT,            
  10069.                                 MAREA,            CHDAT,            
  10070.                                 FMART,            FCDAT,            
  10071.                                 MEQPT,            FORDV,            
  10072.                                 MEPSA,            METAL,            
  10073.                                 MEPSD,            MEORD,            
  10074.                                 MEORN,            MEORC,            
  10075.                                 MEORO,            CREWA,            
  10076.                                 CREAL,            CREWF,            
  10077.                                 CRMRD,            CRMRN,            
  10078.                                 CRMRC,            CRMRO,            
  10079.                                 MEREC,            TEGEO,            
  10080.                                 PIN,              FRQNO,            
  10081.                                 PLEAC,            DDP,              
  10082.                                 DDPRD,            MDT,              
  10083.                                 PUTCV,            PEQPT,            
  10084.                                 TPGEO,            ALTYP,            
  10085.                                 NUMBR,            NUMEA,            
  10086.                                 ALRET,            NUSEQ,            
  10087.                                 WPNCO,            NUQPT,            
  10088.                                 DSGEO,            NUMWR,            
  10089.                                 NUMWB,            NUGUN,            
  10090.                                 RTIME,            DSSTA,            
  10091.                                 RFGDS,            NUSTO,            
  10092.                                 NUECC,            SEQ,              
  10093.                                 TOT,              LABEL,            
  10094.                                 RMKID,            REMRK,            
  10095.                                 TEQPT,            MESEN,            
  10096.                                 DECON,            MECUS,            
  10097.                                 AVCAT,            RESND,            
  10098.                                 ERDTE,            EXDAC,            
  10099.                                 CPGEO,            CFGEO,            
  10100.                                 EQDEP,            EQARR,            
  10101.                                 TPIN,             TLEAC,            
  10102.                                 TLEQE,            UEQPT,            
  10103.                                 MEQS,             SEDY,             
  10104.                                 TEDY,             ERRDY,            
  10105.                                 AVAIL,            DCNDY,            
  10106.                                 EQRET,            GEOGR,            
  10107.                                 OPERL,            DAFLD,            
  10108.                                 ACGEO,            ACITY,            
  10109.                                 ADATE,            MDATE,            
  10110.                                 RDATE,            GCMD,             
  10111.                                 TDATE,            TRGEO,            
  10112.                                 DEPDT,            ARRDT,            
  10113.                                 RPTOR,            INTR1,            
  10114.                                 INTR2,            SBRPT,            
  10115.                                 ATACH,            NOT_USED,         
  10116.                                 H_CARD_NUMBER,    DAY_OF_MONTH,     
  10117.                                 MONTH,            YEAR,             
  10118.                                 REAL_OR_EXERCISE, NIL                        
  10119.              ); 
  10120. --
  10121. -------------------------------------------------------------------
  10122. --
  10123. -- Turns out need subtypes for the get_field case statement under
  10124. --    the TeleSoft compiler
  10125. --
  10126.    subtype STANDARD_NAMES    is UNITREP_FIELD_NAMES range 
  10127.              CARD_NUMBER..MESSAGE_NUMBER; 
  10128.   --
  10129.    subtype ABC_NAMES         is UNITREP_FIELD_NAMES range UDC..MONOR; 
  10130.   --
  10131.    subtype DGJ_NAMES         is UNITREP_FIELD_NAMES range CSERV..PIAOD; 
  10132.   --
  10133.    subtype K_NAMES           is UNITREP_FIELD_NAMES range TREAD..FCDAT; 
  10134.   --
  10135.    subtype LM_NAMES          is UNITREP_FIELD_NAMES range MEQPT..TEGEO; 
  10136.   --
  10137.    subtype NPQ_NAMES         is UNITREP_FIELD_NAMES range PIN..NUECC; 
  10138.   --
  10139.    subtype RTV_NAMES         is UNITREP_FIELD_NAMES range SEQ..RDATE; 
  10140.   --
  10141.    subtype XEH_NAMES         is UNITREP_FIELD_NAMES range GCMD..REAL_OR_EXERCISE; 
  10142. --
  10143. end UNITREP_LINES_AND_FIELDS; 
  10144. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10145. --urfldtyps.sp
  10146. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10147. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  10148. --                                                                    --
  10149. --            Program unit:  PACKAGE UNITREP_FIELD_TYPES              --
  10150. --            File name :    URFLDTYPS.SP                             --
  10151. --                                                                    --
  10152. --            ===========================================             --
  10153. --                                                                    --
  10154. --                                                                    --
  10155. --            Produced by Veda Incorporated                           --
  10156. --            Version  1.0      April 15, 1985                        --
  10157. --                                                                    --
  10158. --                                                                    --
  10159. --            This program unit is a member of the GMHF. It           --
  10160. --            was developed using TeleSoft's Ada compiler,            --
  10161. --            version 2.1 in a VAX/VMS environment, version           --
  10162. --            3.7                                                     --
  10163. --                                                                    --
  10164. --                                                                    --
  10165. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  10166. --
  10167. package Unitrep_field_types is
  10168.  
  10169. --
  10170. -- DEFINE the field types associated with the field names
  10171. --
  10172.  
  10173. --------------------------------------------------------------
  10174. --      these are the common field types used in Unitrep
  10175. --------------------------------------------------------------
  10176.  
  10177.   subtype Card_number_type is integer range 0..999;
  10178.  
  10179.   type Classification_type is ( U,C,S,T );
  10180.  
  10181.   type UAC_type is ( A,C,D,R );
  10182.  
  10183.   subtype Record_id_type is string ( 1..3 );
  10184.        -- the 3 character string of line_names
  10185.  
  10186.   type UIC_type is ( DDAAAA,DEAAAA,DJJ010,DJ1000,
  10187.                      DJ1200,DJ2000,DJ3000,DJ3020,DJ3021,
  10188.                      DJ3023,DJ3024,DJ3025,DJ3026,DJ3090,
  10189.                      DJ4000,DJ5000,DJ6000,DJ7000,DJ8000,
  10190.                      DJ9000,DLAAAA,DMAAAA,W0ZUFF,W00QAA,
  10191.                      W00YFF,W38BFF,W38AFF,W3VYFF,W3YBFF,WATMFF,
  10192.                      W0ALFF,W0ANFF,W0ATFF,W32FFF,W0GTAA,W0GVAA,
  10193.                      W0GWFF,W0QFAA,WATGFF,W4NHFF,N00011,N00033,
  10194.                      N00060,N00061,N00070,N00072,N00071,FFQT10,
  10195.                      FFB370,FFB790,FFBBB0,FFBCC0,FFBSD0,
  10196.                      FFC4D0,FFCL80,FFCLM0,FFCMF0,FFCMJ0,FFCRS0,
  10197.                      FFFHL0,FFFTC0,FFGKT0,FFGTW0,FFH5M0,
  10198.                      FFH7B0,FFH7BA,FFH7BB,FFHCS0,FFJQ20,
  10199.                      FFVGB0,M54000,M00400,M14000,M20000,
  10200.                      M20020,E70098,E73130,E75120,E75150,XXAAAA,
  10201.                      ZZZDAA,ZZZDAB,ZZZDAC,ZZZDAD,ZZZDAE,ZZZDAF,
  10202.                      ZZZDAG,ZZZDAH,ZZZDAJ );
  10203.  
  10204.   subtype Originators_UIC_type is UIC_type;
  10205.  
  10206.   subtype Message_type_type is string ( 1..2 );
  10207.  
  10208.   subtype Message_number_type is integer range 0..999;
  10209.  
  10210. -- day/month/year formats
  10211.  
  10212.   type DDDYY_type is
  10213.     record
  10214.       ddd : integer range 1..366;
  10215.       yy  : integer range 0..99;
  10216.     end record;
  10217.  
  10218.   type YYMMDD_type is
  10219.     record
  10220.       yy : integer range 0..99;
  10221.       mm : integer range 1..12;
  10222.       dd : integer range 1..31;
  10223.     end record;
  10224.  
  10225.   type YYMMDDHH_type is
  10226.     record
  10227.       yy : integer range 0..99;
  10228.       mm : integer range 1..12;
  10229.       dd : integer range 1..31;
  10230.       hh : integer range 0..24;
  10231.     end record;
  10232.  
  10233.   type DDDHH_type is
  10234.     record
  10235.       ddd : integer range 1..366;
  10236.       hh  : integer range 0..24;
  10237.     end record;
  10238.  
  10239.   type HHHMM_type is
  10240.     record
  10241.       hhh : integer range 0..999;
  10242.       mm  : integer range 0..59;
  10243.     end record;
  10244.  
  10245.   type MMDDHH_type is
  10246.     record
  10247.       year : integer;
  10248.       mm   : integer range 1..12;
  10249.       dd   : integer range 1..31;
  10250.       hh   : integer range 0..24;
  10251.     end record;
  10252.  
  10253. --------------------------------------------------------------
  10254. --  Unitrep field types for A, B, C
  10255. --------------------------------------------------------------
  10256.  
  10257.   type UDC_type is ( A,B,C,D,E,F,T,U,V,W,X,Y,Z,
  10258.                      G,H,L,N,J,K,P,Q,R,S );
  10259.           -- special check for 1,3,5,7,9,2,4,6,8,0 is necessary
  10260.  
  10261.   subtype ANAME_type is string ( 1..30 );
  10262.  
  10263.   subtype UTC_type is string ( 1..5 );
  10264.  
  10265.   type ULC_type is ( A  ,ACD,ACT,ADM,AF ,AFY,AGP,AGY,ANX,
  10266.                      AP ,AR ,ARS,AST,AUG,B  ,BAS,BD ,BDE,
  10267.                      BKS,BLT,BN ,BND,BR ,BSN,BT ,BTY,CAY,
  10268.                      CEC,CEP,CGC,CGE,CLN,CMD,CMN,CMP,CO ,
  10269.                      CPS,CRW,CTP,CTR,DAY,DEP,DET,DIR,DIV,
  10270.                      DMB,DMF,DML,DMM,DMP,DMR,DMT,DMU,DSP,
  10271.                      DST,DTL,ELE,FAC,FAR,FLO,FLT,FMF,FTR,
  10272.                      FT ,GAR,GRP,HBD,HHB,HHC,HHD,HHS,HHT,
  10273.                      HM ,HMC,HQ ,HQC,HQD,HQS,HSB,HSC,HSP,
  10274.                      INS,ISP,IST,LAB,LIB,MAA,MAB,MAF,MAG,
  10275.                      MAU,MAW,MER,MGR,MGZ,MIS,MSC,MSF,MTF,
  10276.                      MUS,NSC,NSL,OBS,OFC,OFF,OIC,OL ,
  10277.                      PKG,PKT,PLN,PLT,PO ,PRT,PTY,PVG,RCT,
  10278.                      REP,RES,RGN,RGT,RLT,RNG,SCH,SCM,SCO,
  10279.                      SCT,SEC,SHP,SIP,SQ ,SQD,SS ,SST,STA,
  10280.                      STF,STP,STR,SU ,SUP,SVC,SYD,SYS,TE ,
  10281.                      TF ,TG ,TM ,TML,TRN,TRP,TU ,U  ,USS,
  10282.                      WG ,WKS );
  10283.                 -- special check for FOR is required
  10284.  
  10285.   subtype MJCOM_type is string ( 1..6 );
  10286.  
  10287.   type MAJOR_type is ( X );
  10288.  
  10289.   type REVAL_type is ( G,R,X );
  10290.  
  10291.   subtype TPSN_type is string ( 1..7 );
  10292.  
  10293.   type SCLAS_type is ( U,C,S,T );
  10294.  
  10295. -------------------------  B  --------------------------------
  10296.  
  10297.   subtype LNAME_type is string ( 1..55 );
  10298.  
  10299. -------------------------  C  --------------------------------
  10300.  
  10301.   type COAFF_type is ( AC, AF, AG, AL, AN, AO, AQ, AR, AS, AU, AV, AY,
  10302.                        BA, BB, BC, BD, BE, BF, BG, BH ,BL, BM, BP, BQ,
  10303.                        BR, BT, BU, BV, BX, BY, BZ, CA, CB, CD, CE, CF,
  10304.                        CG, CH, CI, CJ, CK, CL, CM, CN, CO, CQ, CS, CT,
  10305.                        CU, CV, CW, CY, CZ, DA, DJ, DM, DR, EC, EG, EI,
  10306.                        EK, EQ, ES, ET, FA, FG, FI, FJ, FO, FP, FR, FS,
  10307.                        FT, GA, GB, GC, GE, GH, GI, GJ, GL, GP, GQ, GR,
  10308.                        GT, GV, GY, GZ, HA, HK, HM, HO, HU, IC, ID, IO,
  10309.                        IQ, IR, IT, IV, IY, IZ, JA, JM, JO, JQ, JS, KE,
  10310.                        KN, KR, KS, KT, KU, LA, LE, LI, LS, LT, LU, LY,
  10311.                        MA, MB, MC, MG, MH, MI, ML, MN, MO, MP, MQ, MR,
  10312.                        MT, MU, MV, MX, MY, MZ, NA, NC, NE, NF, NG, NH,
  10313.                        NI, NL, NO, NP, NQ, NR, NS, NU, NZ, PA, PC, PE,
  10314.                        PF, PG, PK, PL, PM, PO, PP, PQ, PU, QA, RE, RO,
  10315.                        RP, RQ, RW, SA, SB, SC, SE, SF, SG, SH, SL, SM,
  10316.                        SN, SO, SP, SQ, ST, SU, SW, SY, SZ, TC, TD, TH,
  10317.                        TK, TL, TN, TO, TP, TQ, TS, TU, TV, TW, TZ, UG,
  10318.                        UK, UN, UR, US, UV, UY, VC, VE, VI, VM, VQ, VT,
  10319.                        WA, WF, WI, WQ, WS, WZ, YE, YO, YS, ZA, ZI );
  10320.                    -- special check for DO, IN, IS required
  10321.  
  10322.   subtype MONOR_type is string ( 1..6 );
  10323.  
  10324. --------------------------------------------------------------
  10325. --  Unitrep field types for D
  10326. --------------------------------------------------------------
  10327.  
  10328.   type CSERV_type is ( C,D,A,N,F,M,E,J );
  10329.               -- special check for 1,2,3,4,5,6,7,8,9
  10330.  
  10331.   subtype OPCON_type is string ( 1..6 );
  10332.  
  10333.   subtype ADCON_type is string ( 1..6 );
  10334.  
  10335.   subtype HOGEO_type is string ( 1..4 );
  10336.  
  10337.   subtype PRGEO_type is string ( 1..4 );
  10338.  
  10339.   subtype EMBRK_type is string ( 1..6 );
  10340.  
  10341.   type ACTIV_type is ( AC,CW,DE,ED,ER,NP,PD,PH,PK,PL,PS,
  10342.                        RD,UM,UN,XX,AN,AS,CA,CD,CJ,CM,CS,
  10343.                        DA,DR,FP,FR,GF,IP,LD,LE,ON,OP,
  10344.                        PC,PM,PO,PA,PV,PW,RC,RE,RF,RO,RR,
  10345.                        SM,SR,CR,CV,MA,OH,RA,RX,DS,FO,OE,
  10346.                        OT,SD,TE,TO,BT,NA,RT,TA,TB,TR,TS,
  10347.                        TU,TW,AD,AU,EX,GW,MR );
  10348.                -- special check for IN required
  10349.  
  10350.   type FLAG_type is ( X );
  10351.  
  10352.   subtype PUIC_type is UIC_type;
  10353.  
  10354.   type CBCOM_type is ( A,B,E,K,N,P,T );
  10355.  
  10356.   type DFCON_type is ( N,T,V,S,R,G );
  10357.               -- special check for 5,4,3,2,1
  10358.  
  10359.   subtype POINT_type is string ( 1..15 );
  10360.  
  10361.   type NUCIN_type is ( X );
  10362.  
  10363.   subtype PCTEF_type is string ( 1..1 );
  10364.  
  10365. -------------------------  DM1  ------------------------------
  10366.  
  10367.   type BILET_type is ( CG, CO, OIC, NCO );
  10368.  
  10369.   type CORNK_type is ( SGT, LT, CAPT, MAJ, LTCOL, COL, GEN );
  10370.  
  10371.   subtype CONAM_type is string ( 1..17 );
  10372.  
  10373.   type MMCMD_type is ( M00048,M00049,M00051,M00053,M00055,M00070,
  10374.                        M00074,M00101,M00201,M00300,M00400,M00407,
  10375.                        M01333,M01369,M01531,M11000,M12000,M13000,
  10376.                        M14000,M18032,M18045,M18172,M19001,M19009,
  10377.                        M19012,M19015,M19033,M19100,M19137,M19500,
  10378.                        M20000,M20020,M20040,M20051,M20080,M20128,
  10379.                        M20135,M20146,M21580,M21610,M27100,M28300,
  10380.                        M29000,M54000,M61610,M96300 );
  10381.                        -- MAJOR MARINE COMMAND
  10382.                        --       SPECIAL CHECK FOR Mmcmd_Types "#     "
  10383.  
  10384. -------------------------  DN1  ------------------------------
  10385.  
  10386.   subtype NTASK_type is string ( 1..13 );
  10387.  
  10388.   subtype MODFG_type is string ( 1..1 );
  10389.  
  10390.   subtype PLETD_type is MMDDHH_type;
  10391.  
  10392.   subtype NDEST_type is string ( 1..11 );
  10393.  
  10394.   subtype DETA_type is MMDDHH_type;
  10395.  
  10396.   subtype CXMRS_type is string ( 1..1 );
  10397.  
  10398. --------------------------------------------------------------
  10399. --  Unitrep field types for E
  10400. --------------------------------------------------------------
  10401.  
  10402.   subtype Not_Used_type is string ( 1..2 );
  10403.  
  10404. --------------------------------------------------------------
  10405. --  Unitrep field types for G
  10406. --------------------------------------------------------------
  10407.  
  10408.   subtype TCAA_type is string ( 1..29 );
  10409.  
  10410.   type MEDIA_type is ( C,L,M,T );
  10411.  
  10412.   type TADC_type is ( X );
  10413.  
  10414.   subtype ROUTE_type is string ( 1..7 );
  10415.  
  10416.   subtype RWDTE_type is DDDYY_type;
  10417.  
  10418.   subtype XRTE_type is string ( 1..7 );
  10419.  
  10420.   subtype XDATE_type is DDDYY_type;
  10421.  
  10422. --------------------------------------------------------------
  10423. --  Unitrep field types for H
  10424. --------------------------------------------------------------
  10425.  
  10426.   subtype H_card_number_type is integer range 0..9;
  10427.  
  10428.   subtype Day_of_month_type is integer range 1..31;
  10429.  
  10430.   type Month_type is ( JAN,FEB,MAR,APR,MAY,JUN,
  10431.                           JUL,AUG,SEP,OCT,NOV,DEC );
  10432.  
  10433.   subtype Year_type is integer range 0..99;
  10434.  
  10435.   type Real_or_Exercise_type is ( R,X );
  10436.  
  10437. --------------------------------------------------------------
  10438. --  Unitrep field types for J
  10439. --------------------------------------------------------------
  10440.  
  10441.   type TPERS_type is (CS,CQ,CP,AC,NC,MC,FC,EC,AW,NW,MW,
  10442.                        FW,EW,AE,NE,ME,FE,EE,ZA,ZE,ZC,RC,
  10443.                        RE,RW,AK,NK,MK,FK,EK,AX,NX,MX,FX,
  10444.                        EX,NT,MT,FT,ET,AM,NM,MM,FM,EM,AI,
  10445.                        NI,MI,FI,EI,AD,ND,MD,FD,ED,AH,NH,
  10446.                        MH,FH,EH,AL,NL,ML,FL,EL,ZZ);
  10447.                        --       SPECIAL CHECK FOR Tpers_Types "AT"
  10448.  
  10449.   subtype PEGEO_type is string ( 1..6 );
  10450.  
  10451.   subtype STRUC_type is string ( 1..5 );
  10452.  
  10453.   subtype AUTH_type is string ( 1..5 );
  10454.  
  10455.   subtype ASGD_type is string ( 1..5 );
  10456.  
  10457.   subtype POSTR_type is string ( 1..5 );
  10458.  
  10459.   subtype PICDA_type is YYMMDD_type;
  10460.  
  10461.   subtype DEPS_type is string ( 1..5 );
  10462.  
  10463.   subtype TDEPS_type is string ( 1..5 );
  10464.  
  10465.   subtype CASPW_type is string ( 1..5 );
  10466.  
  10467.   subtype CCASP_type is string ( 1..5 );
  10468.  
  10469.   type CCEBY_type is ( X );
  10470.  
  10471. -------------------------  JM1  ------------------------------
  10472.  
  10473.   type SCATD_type is ( TO );
  10474.  
  10475.   subtype MGO_type is string ( 1..5 );
  10476.  
  10477.   subtype AGO_type is string ( 1..5 );
  10478.  
  10479.   subtype NA_type is string ( 1..5 );
  10480.  
  10481.   subtype NFO_type is string ( 1..5 );
  10482.  
  10483.   subtype MENL_type is string ( 1..5 );
  10484.  
  10485.   subtype NAVO_type is string ( 1..5 );
  10486.  
  10487.   subtype NAVE_type is string ( 1..5 );
  10488.  
  10489.   subtype OTHOF_type is string ( 1..5 );
  10490.  
  10491.   subtype OTHEN_type is string ( 1..5 );
  10492.  
  10493.   subtype PIAOD_type is string ( 1..6 );
  10494.  
  10495. --------------------------------------------------------------
  10496. --  Unitrep field types for K
  10497. --------------------------------------------------------------
  10498. --
  10499. ---  special enumerated type used for a number of K card fields
  10500. --
  10501.   type PRIMARY_REASON is ( P01,P02,P03,P04,P05,P06,P07,P08,P09,
  10502.                            P10,P11,P12,P13,P14,P15,P16,P17,P18,
  10503.                            P19,P20,P21,P22,P23,P24,P25,P26,P27,
  10504.                            P28,P29,P30,P31,P32,P33,P34,P35,P36,
  10505.                            P37,P38,P39,P40,P41,P42,P43,P44,P45,
  10506.                            P46,P47,P48,P49,P50,P51,P52,P53,P54,
  10507.                            P55,P56,P57,P58,P59,P60,P61,P62,P63,
  10508.                            P64,P65,P66,P67,P68,P69,P70,P71,P72,
  10509.                            P73,P74,P75,P76,P77,P78,P79,P80,PUP,
  10510.                            S01,S02,S03,S04,S05,S06,S07,S08,S09,
  10511.                            S10,S11,S12,S13,S14,S15,S16,S17,S18,
  10512.                            S19,S20,S21,S22,S23,S24,S25,S26,S27,
  10513.                            S28,S29,S30,S31,S32,S33,S34,S35,S36,
  10514.                            S37,S38,S39,S40,S41,S42,S43,S44,S45,
  10515.                            S46,S47,S48,S49,S50,S51,S52,S53,S54,
  10516.                            S55,S56,S57,S58,S59,S60,S61,S62,S63,
  10517.                            S64,S65,S66,S67,S68,S69,S70,S71,S72,
  10518.                            S73,S74,S75,S76,S77,S78,S79,S80,S81,
  10519.                            S82,S83,S84,S85,S86,S87,S88,S89,S90,
  10520.                            S91,S92,S93,S94,S95,S96,S97,S98,SUP,
  10521.                            R00,R01,R02,R03,R04,R05,R06,R07,R08,
  10522.                            R09,R10,R11,R12,R13,R14,R15,R16,R17,
  10523.                            R18,R19,R20,R21,R22,R23,R24,R25,R26,
  10524.                            R27,R28,R29,R30,R31,R32,R33,R34,R35,
  10525.                            R36,R37,R38,R39,R40,R41,R42,R43,R44,
  10526.                            R45,R46,R47,R48,R49,R50,R51,R52,R53,
  10527.                            R54,R55,R56,R57,R58,R59,R60,R61,R62,
  10528.                            R63,R64,R65,R66,R67,R68,R69,R70,R71,
  10529.                            R72,R73,R74,R75,R76,R77,R78,R79,R80,
  10530.                            R81,R82,R83,R84,R85,R86,R87,R88,R89,
  10531.                            R90,R91,R92,R93,R94,R95,R96,R97,R98,
  10532.                            R99,RAA,RAB,RAC,RAD,RAE,RAF,RAG,RAH,
  10533.                            RAL,RAN,RAP,RAQ,RAR,RAS,RAT,RAU,RAV,
  10534.                            RAW,RAX,RAY,RBA,RBB,RBC,RBD,RBE,RBF,
  10535.                            RBG,RBH,RBI,RBJ,RBK,RBL,RBM,RBN,RUP,
  10536.                            T01,T02,T03,T04,T05,T06,T07,T08,T09,
  10537.                            T10,T11,T12,T13,T14,T15,T16,T17,T18,
  10538.                            T19,T20,T21,T22,T23,T24,T25,T26,T27,
  10539.                            T28,T29,T30,T31,T32,T33,T34,T35,T36,
  10540.                            T37,T38,T39,T40,T41,T42,T43,T44,T45,
  10541.                            T46,T47,T48,T49,T50,T51,T52,T53,T54,
  10542.                            T55,T56,T57,T58,T59,T60,T61,T62,T63,
  10543.                            T64,T65,T66,T67,T68,T69,T70,T71,T72,
  10544.                            T73,T74,T75,T76,T77,T78,T79,T80,T81,
  10545.                            T82,T83,TUP);
  10546.  
  10547. --------------------------------------------------------------
  10548.  
  10549.   type TREAD_type is ( JCRR1,POMCS );
  10550.  
  10551.   subtype READY_type is string ( 1..1 );
  10552.  
  10553.   type REASN_type is ( P,S,R,T,M,N,X ); 
  10554.  
  10555.   subtype PRRAT_type is string ( 1..1 );
  10556.  
  10557.   subtype PRRES_type is PRIMARY_REASON range P01..P80;
  10558.  
  10559.   subtype ESRAT_type is string ( 1..1 );
  10560.  
  10561.   subtype ESRES_type is PRIMARY_REASON range S01..S98;
  10562.  
  10563.   subtype ERRAT_type is string ( 1..1 );
  10564.  
  10565.   subtype ERRES_type is PRIMARY_REASON range R00..RBN;
  10566.  
  10567.   subtype TRRAT_type is string ( 1..1 );
  10568.  
  10569.   subtype TRRES_type is PRIMARY_REASON range T01..T83;
  10570.  
  10571.   subtype SECRN_type is string ( 1..3 );
  10572.  
  10573.   subtype TERRN_type is string ( 1..3 );
  10574.  
  10575.   subtype CARAT_type is string ( 1..1 );
  10576.  
  10577.   subtype CADAT_type is YYMMDD_type;
  10578.  
  10579.   subtype LIM_type is string ( 1..1 );
  10580.  
  10581.   type RLIM_type is ( P,S,R,T );
  10582.  
  10583.   subtype RICDA_type is YYMMDD_type;
  10584.  
  10585. -------------------------  KF1  ------------------------------
  10586.  
  10587.   subtype DOCNR_type is string ( 1..1 );
  10588.  
  10589.   type DOCID_type is ( AM22,AG23,AM24,BM22,BG23,BM24,BG25,CM22,
  10590.                        CG23,CM24,CG25,CD26,CM28,CM29,DM22,DG23,
  10591.                        DM24,DG25,DM26,DG27,DM28,DG29,DM32,DG33,
  10592.                        DM34,DG35,DG36,DG37,EM22,EG23,EM24,EG25,
  10593.                        EM26,EG27,FM22,FG23,FD24,FM25,FG26,FM27,
  10594.                        FG28,FM29,FG33,FM34,FG35,FM36,FG37,FD38,
  10595.                        GM22,GG23,HM22,HG23,HM24,HG25,HM26,HG27,
  10596.                        JM22,JG23,JM24,JG25,JM26,JG27,KM22,KG23,
  10597.                        LM22,LG23,LM24,LG25,LM26,LG27,LM28,LG29,
  10598.                        MM22,MG23,MM24,MG25,MM26,MM27,MM28,MM29,
  10599.                        MM32,MM33,NM22,NG23,NM24,NG25,NM26,NG27,
  10600.                        OA22,OA23,OG24,OG25,PM22,PG23,PM24,PG25,
  10601.                        QM22,QG23,QM24,QG25,QG26,QM27,QD28,QD29,
  10602.                        QD32,QD33,QD34,QD35,QD36,RM22,RM24,RM25,
  10603.                        RM26,RM27,RM28,RM29,RM32,RM33,RG34,RG35,
  10604.                        RG36,RG37,RG38,RG39,SM22,SM23,SG24,SG25,
  10605.                        SM26,SG27,SG28,SG29,SM32,SD33,TM22,TG23,
  10606.                        UG22,UG23,UG24,UM25,UD26,UM27,WS22,WS23,
  10607.                        WS24,WS25,WS26,WS27,WS28,ZG23,ZM24,ZG25,
  10608.                        ZM26 );
  10609.  
  10610.   subtype PERTP_type is string ( 1..2 );
  10611.  
  10612.   subtype TPAUT_type is string ( 1..4 );
  10613.  
  10614.   subtype TPASG_type is string ( 1..4 );
  10615.  
  10616.   subtype TPAVL_type is string ( 1..4 );
  10617.  
  10618.   subtype PERTC_type is string ( 1..2 );
  10619.  
  10620.   subtype CPAUR_type is string ( 1..4 );
  10621.  
  10622.   subtype CPASG_type is string ( 1..4 );
  10623.  
  10624.   subtype CPAVL_type is string ( 1..4 );
  10625.  
  10626.   subtype TRUTC_type is string ( 1..2 );
  10627.  
  10628.   type TMTHD_type is ( B,C );
  10629.  
  10630.   subtype TCARQ_type is string ( 1..3 );
  10631.  
  10632.   subtype TCRAS_type is string ( 1..3 );
  10633.  
  10634.   subtype TCRAV_type is string ( 1..3 );
  10635.  
  10636.   subtype TRSA1_type is string ( 1..2 );
  10637.  
  10638.   subtype TRSA2_type is string ( 1..2 );
  10639.  
  10640.   subtype TRSA3_type is string ( 1..2 );
  10641.  
  10642.   subtype TRSA4_type is string ( 1..2 );
  10643.  
  10644.   subtype TRSA5_type is string ( 1..2 );
  10645.  
  10646. -------------------------  KF2  ------------------------------
  10647.  
  10648.   subtype EQSEE_type is string ( 1..2 );
  10649.  
  10650.   subtype EQSSE_type is string ( 1..2 );
  10651.  
  10652.   subtype MEARD_type is string ( 1..3 );
  10653.  
  10654.   subtype MEASG_type is string ( 1..3 );
  10655.  
  10656.   subtype MEPOS_type is string ( 1..3 );
  10657.  
  10658.   subtype ESSA1_type is string ( 1..2 );
  10659.  
  10660.   subtype ESSA2_type is string ( 1..2 );
  10661.  
  10662.   subtype ESSA3_type is string ( 1..2 );
  10663.  
  10664.   subtype ESSA4_type is string ( 1..2 );
  10665.  
  10666.   subtype ESSA5_type is string ( 1..2 );
  10667.  
  10668.   subtype ESSA6_type is string ( 1..2 );
  10669.  
  10670.   subtype ESSA7_type is string ( 1..2 );
  10671.  
  10672.   subtype ESSA8_type is string ( 1..2 );
  10673.  
  10674.   subtype ESSA9_type is string ( 1..2 );
  10675.  
  10676.   subtype EQREE_type is string ( 1..2 );
  10677.  
  10678.   subtype EQRED_type is string ( 1..2 );
  10679.  
  10680.   subtype MEMRA_type is string ( 1..3 );
  10681.  
  10682.   subtype ERSA1_type is string ( 1..2 );
  10683.  
  10684.   subtype ERSA2_type is string ( 1..2 );
  10685.  
  10686.   subtype ERSA3_type is string ( 1..2 );
  10687.  
  10688.   subtype ERSA4_type is string ( 1..2 );
  10689.  
  10690.   subtype ERSA5_type is string ( 1..2 );
  10691.  
  10692.   subtype ERSA6_type is string ( 1..2 );
  10693.  
  10694.   subtype ERSA7_type is string ( 1..2 );
  10695.  
  10696.   subtype ERSA8_type is string ( 1..2 );
  10697.  
  10698. -------------------------  KF3  ------------------------------
  10699.  
  10700.   subtype SDOC_type is string ( 1..4 );
  10701.  
  10702.   subtype READF_type is string ( 1..1 );
  10703.  
  10704.   subtype REASF_type is string ( 1..1 );
  10705.  
  10706.   subtype PRRAF_type is string ( 1..1 );
  10707.  
  10708.   subtype PRREF_type is string ( 1..3 );
  10709.  
  10710.   subtype ESRAF_type is string ( 1..1 );
  10711.  
  10712.   subtype ESREF_type is string ( 1..3 );
  10713.  
  10714.   subtype ERRAF_type is string ( 1..1 );
  10715.  
  10716.   subtype ERREF_type is string ( 1..3 );
  10717.  
  10718.   subtype TRRAF_type is string ( 1..1 );
  10719.  
  10720.   subtype TRREF_type is string ( 1..3 );
  10721.  
  10722.   subtype SECRF_type is string ( 1..3 );
  10723.  
  10724.   subtype TERRF_type is string ( 1..3 );
  10725.  
  10726.   subtype CARAF_type is string ( 1..1 );
  10727.  
  10728.   subtype CADAF_type is YYMMDD_type;
  10729.  
  10730.   subtype LIMF_type is string ( 1..1 );
  10731.  
  10732.   subtype RLIMF_type is string ( 1..1 );
  10733.  
  10734.   subtype RICDF_type is YYMMDD_type;
  10735.  
  10736.   subtype RESPF_type is string ( 1..5 );
  10737.  
  10738. -------------------------  KF4  ------------------------------
  10739.  
  10740.   subtype SMCC1_type is string ( 1..2 );
  10741.  
  10742.   subtype SMRA1_type is string ( 1..2 );
  10743.  
  10744.   subtype SMAA1_type is string ( 1..2 );
  10745.  
  10746.   subtype SMRC1_type is string ( 1..2 );
  10747.  
  10748.   subtype SMAC1_type is string ( 1..2 );
  10749.  
  10750.   subtype SMCC2_type is string ( 1..2 );
  10751.  
  10752.   subtype SMRA2_type is string ( 1..2 );
  10753.  
  10754.   subtype SMAA2_type is string ( 1..2 );
  10755.  
  10756.   subtype SMRC2_type is string ( 1..2 );
  10757.  
  10758.   subtype SMAC2_type is string ( 1..2 );
  10759.  
  10760.   subtype SMCC3_type is string ( 1..2 );
  10761.  
  10762.   subtype SMRA3_type is string ( 1..2 );
  10763.  
  10764.   subtype SMAA3_type is string ( 1..2 );
  10765.  
  10766.   subtype SMRC3_type is string ( 1..2 );
  10767.  
  10768.   subtype SMAC3_type is string ( 1..2 );
  10769.  
  10770.   subtype SMCC4_type is string ( 1..2 );
  10771.  
  10772.   subtype SMRA4_type is string ( 1..2 );
  10773.  
  10774.   subtype SMAA4_type is string ( 1..2 );
  10775.  
  10776.   subtype SMRC4_type is string ( 1..2 );
  10777.  
  10778.   subtype SMAC4_type is string ( 1..2 );
  10779.  
  10780.   subtype GCCLA_type is string ( 1..2 );
  10781.  
  10782.   subtype GCCLB_type is string ( 1..2 );
  10783.  
  10784.   subtype GCCLC_type is string ( 1..2 );
  10785.  
  10786.   subtype SPCLU_type is string ( 1..9 );
  10787.  
  10788. -------------------------  KN1  ------------------------------
  10789.  
  10790.   type PRMA_type is ( AAW  ,AMW  ,ASU  ,ASW  ,CCC  ,CON  ,ELW  ,
  10791.                       FSO  ,INT  ,LOG  ,MIW  ,MOB  ,NCO  ,SPW  ,
  10792.                       STW  ,ATN  ,ELT  ,IOP  ,MEP  ,MSA  ,SAR  );
  10793.  
  10794.   subtype MARAT_type is string ( 1..1 );
  10795.  
  10796.   subtype MAREA_type is string ( 1..3 );
  10797.  
  10798.   subtype CHDAT_type is YYMMDD_type;
  10799.  
  10800.   subtype FMART_type is string ( 1..1 );
  10801.  
  10802.   subtype FCDAT_type is YYMMDD_type;
  10803.  
  10804. --------------------------------------------------------------
  10805. --  Unitrep field types for L, M
  10806. --------------------------------------------------------------
  10807.  
  10808.   subtype MEQPT_type is string ( 1..13 );
  10809.  
  10810.   type FORDV_type is ( C,B,F,H,D,I,J,K,T,U,G,X,Y );
  10811.  
  10812.   subtype MEPSA_type is string ( 1..3 );
  10813.  
  10814.   subtype METAL_type is string ( 1..3 );
  10815.  
  10816.   subtype MEPSD_type is string ( 1..3 );
  10817.  
  10818.   subtype MEORD_type is string ( 1..3 );
  10819.  
  10820.   subtype MEORN_type is string ( 1..3 );
  10821.  
  10822.   subtype MEORC_type is string ( 1..3 );
  10823.  
  10824.   subtype MEORO_type is string ( 1..3 );
  10825.  
  10826.   subtype CREWA_type is string ( 1..2 );
  10827.  
  10828.   subtype CREAL_type is string ( 1..2 );
  10829.  
  10830.   subtype CREWF_type is string ( 1..2 );
  10831.  
  10832.   subtype CRMRD_type is string ( 1..2 );
  10833.  
  10834.   subtype CRMRN_type is string ( 1..2 );
  10835.  
  10836.   subtype CRMRC_type is string ( 1..2 );
  10837.  
  10838.   subtype CRMRO_type is string ( 1..2 );
  10839.  
  10840.   type MEREC_type is ( AL,AS,CM,CO,DF,DL,EC,EM,EL,FL,HH,
  10841.                        HY,IR,LL,LA,MO,OP,PH,RA,RM,SG,SL,
  10842.                        SP,TL,TM,TV,UV,VI,WX,MP,XX );
  10843.                        --        SPECIAL CHECK FOR Merec_Types "#"
  10844.  
  10845. -------------------------  M  --------------------------------
  10846.  
  10847.   subtype TEGEO_type is string ( 1..6 );
  10848.  
  10849. --------------------------------------------------------------
  10850. --  Unitrep field types for N, P, Q
  10851. --------------------------------------------------------------
  10852.  
  10853.   type PIN_type is ( A,B,D,E,F,G,H,K,L,M,N,P,R,S );
  10854.  
  10855.   subtype FRQNO_type is string ( 1..5 );
  10856.  
  10857.   type PLEAC_type is ( A,C );
  10858.  
  10859.   type DDP_type is ( ND,ID,AD,MD,LD );
  10860.  
  10861.   subtype DDPRD_type is YYMMDDHH_type;
  10862.  
  10863.   subtype MDT_type is DDDHH_type;
  10864.  
  10865.   subtype PUTCV_type is string ( 1..5 );
  10866.  
  10867. -------------------------  P  --------------------------------
  10868.  
  10869.  
  10870.   subtype PEQPT_type is string ( 1..13 );
  10871.  
  10872.   subtype TPGEO_type is string ( 1..6 );
  10873.  
  10874.   type ALTYP_type is ( AA,AB,AE,AL,AP,AR,AU,BD,BG,BN,
  10875.                        BO,CD,CP,CS,DA,DB,DC,DD,DE,DF,
  10876.                        DG,DH,DJ,DK,DL,DM,DN,DS,DW,EA,
  10877.                        EG,IP,LC,LS,LT,ME,NE,PE,PG,PN,
  10878.                        PS,RC,RN,RP,SA,SC,SD,SG,SI,SL,
  10879.                        SM,SN,TA,TC,TD,TE,TF,TG,TL,TM,
  10880.                        TN,TP,TR,TS,TT,TW,WR,WX );
  10881.  
  10882.   subtype NUMBR_type is string ( 1..3 );
  10883.  
  10884.   subtype NUMEA_type is string ( 1..3 );
  10885.  
  10886.   subtype ALRET_type is HHHMM_type;
  10887.  
  10888. -------------------------  Q  --------------------------------
  10889.  
  10890.   subtype NUSEQ_type is string ( 1..3 );
  10891.  
  10892.   type WPNCO_type is ( CO, EL, IR, PH, RA, SG, SL, VI );
  10893.  
  10894.   subtype NUQPT_type is string ( 1..10 );
  10895.  
  10896.   subtype DSGEO_type is string ( 1..6 );
  10897.  
  10898.   subtype NUMWR_type is string ( 1..2 );
  10899.  
  10900.   subtype NUMWB_type is string ( 1..2 );
  10901.  
  10902.   subtype NUGUN_type is string ( 1..2 );
  10903.  
  10904.   subtype RTIME_type is string ( 1..5 );
  10905.  
  10906.   subtype DSSTA_type is string ( 1..1 );
  10907.  
  10908.   subtype RFDGS_type is string ( 1..5 );
  10909.  
  10910.   subtype NUSTO_type is string ( 1..3 );
  10911.  
  10912.   subtype NUECC_type is string ( 1..2 );
  10913.  
  10914. --------------------------------------------------------------
  10915. --  Unitrep field types for R
  10916. --------------------------------------------------------------
  10917.  
  10918.   subtype SEQ_type is integer range 1..9;
  10919.  
  10920.   subtype TOT_type is integer range 1..9;
  10921.  
  10922.   subtype LABEL_type is string ( 1..5 );
  10923.  
  10924.   subtype RMKID_type is string ( 1..27 );
  10925.  
  10926.   subtype REMRK_type is string ( 1.. 21 );
  10927.  
  10928. --------------------------------------------------------------
  10929. --  Unitrep field types for T
  10930. --------------------------------------------------------------
  10931.  
  10932.   subtype TEQPT_type is string ( 1..11 );
  10933.  
  10934.   subtype MESEN_type is string ( 1..4 );
  10935.  
  10936.   subtype DECON_type is string ( 1..1 );
  10937.  
  10938.   type MECUS_type is ( CT,TT,MT,DT,XT,CF,TF,MF,DF,XF,
  10939.                        CE,CS,RA,FT );
  10940.  
  10941.   type AVCAT_type is ( A,B,C,D,F,G,H,J );
  10942.  
  10943.   type RESND_type is ( A,B,C,E,F );
  10944.  
  10945.   subtype ERDTE_type is YYMMDD_type;
  10946.  
  10947.   subtype EXDAC_type is string ( 1..1 );
  10948.  
  10949.   subtype CPGEO_type is string ( 1..4 );
  10950.  
  10951.   subtype CFGEO_type is string ( 1..4 );
  10952.  
  10953.   subtype EQDEP_type is YYMMDD_type;
  10954.  
  10955.   subtype EQARR_type is YYMMDD_type;
  10956.  
  10957.   subtype TPIN_type is string ( 1..5 );
  10958.  
  10959.   subtype TLEAC_type is string ( 1..1 );
  10960.  
  10961.   subtype TLEQE_type is string ( 1..2 );
  10962.  
  10963. -------------------------  TF1  ------------------------------
  10964.  
  10965.   subtype UEQPT_type is string ( 1..11 );
  10966.  
  10967.   type MEQS_type is ( A,D,F,G,K,L,M,N,P,Q,R,T,U,V,
  10968.                       Y,Z,X,B,C,E,H,J,S,W );
  10969.  
  10970.   type SEDY_type is ( A,B,C,F,I,J,M,N,R,V,W,Y,Z,X );
  10971.                -- special check for 0,5,7,9
  10972.  
  10973.   type TEDY_type is ( C,D,F,G,H,M,N,P,T,X,Z );
  10974.  
  10975.   subtype ERRDY_type is YYMMDD_type;
  10976.  
  10977.   type AVAIL_type is ( A,B,C,D,E,F );
  10978.  
  10979.   subtype DCNDY_type is string ( 1..5 );
  10980.  
  10981.   subtype EQRET_type is YYMMDD_type;
  10982.  
  10983.   subtype GEOGR_type is string ( 1..4 );
  10984.  
  10985.   subtype OPERL_type is YYMMDD_type;
  10986.  
  10987.   subtype DAFLD_type is string ( 1..4 );
  10988.  
  10989. --------------------------------------------------------------
  10990. --  Unitrep field types for V
  10991. --------------------------------------------------------------
  10992.  
  10993.   subtype ACGEO_type is string ( 1..4 );
  10994.  
  10995.   subtype ACITY_type is string ( 1..2 );
  10996.  
  10997.   subtype ADATE_type is YYMMDD_type;
  10998.  
  10999.   subtype MDATE_type is string ( 1..4 );
  11000.  
  11001.   subtype RDATE_type is YYMMDD_type;
  11002.  
  11003. --------------------------------------------------------------
  11004. --  Unitrep field types for X
  11005. --------------------------------------------------------------
  11006.  
  11007.   subtype GCMD_type is string ( 1..6 );
  11008.  
  11009.   subtype TDATE_type is YYMMDD_type;
  11010.  
  11011.   subtype TRGEO_type is string ( 1..4 );
  11012.  
  11013.   subtype DEPDT_type is YYMMDD_type;
  11014.  
  11015.   subtype ARRDT_type is YYMMDD_type;
  11016.  
  11017.   subtype RPTOR_type is string ( 1..6 );
  11018.  
  11019.   subtype INTR1_type is string ( 1..6 );
  11020.  
  11021.   subtype INTR2_type is string ( 1..6 );
  11022.  
  11023.   subtype SBRPT_type is string ( 1..6 );
  11024.  
  11025. --------------------------------------------------------------------
  11026. --  THESE ARE FIELDS DEFINED BY SAI 
  11027. --------------------------------------------------------------------
  11028. --
  11029.   type Department_type is ( W,F,M,N,E,D,X,Z );
  11030.   type UIC2_Department_type is ( C,D,E,G,H,K,L,N,R,S );
  11031.   type RECONN_type is ( AL, AS, CM, CO, DF, DL, EC, EM, EL, FL, HH, HY,
  11032.                         IR, LL, LA, MO, OP, PH, RA, RM, SG, SL, SP, TL,
  11033.                         TM, TV, UV, VI, WX, MP, XX );
  11034.   type Alphabetic_Types is ( A, B, C, D, E, F, G, H, I, J, K, L, M, N,
  11035.                              O, P, Q, R, S, T, U, V, W, X, Y, Z );
  11036.   type Error_Msg_Types is ( Bad_Field, Bad_Sequence, No_Header, No_End,
  11037.                             Field_Required, Bad_Card_Type,
  11038.                             Mutually_Exclusive,
  11039.                             Can_Not_Validate_Correctly );
  11040. --
  11041. --
  11042. end Unitrep_field_types;
  11043. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11044. --urprocs.sp
  11045. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11046. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11047. --                                                                    --
  11048. --            Program unit:  PACKAGE UR_PROCEDURES                    --
  11049. --            File name :    URPROCS.SP                               --
  11050. --                                                                    --
  11051. --            ===========================================             --
  11052. --                                                                    --
  11053. --                                                                    --
  11054. --            Produced by Veda Incorporated                           --
  11055. --            Version  1.0      April 15, 1985                        --
  11056. --                                                                    --
  11057. --                                                                    --
  11058. --            This program unit is a member of the GMHF. It           --
  11059. --            was developed using TeleSoft's Ada compiler,            --
  11060. --            version 2.1 in a VAX/VMS environment, version           --
  11061. --            3.7                                                     --
  11062. --                                                                    --
  11063. --                                                                    --
  11064. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11065. --
  11066. with Unitrep_lines_and_fields; use Unitrep_lines_and_fields;
  11067. package UR_procedures is
  11068. --
  11069. -- This package is used to validate the operator entry for subtypes
  11070. --   of the Unitrep_field_names. This approach was necessary due
  11071. --   to the size of the case statement and limitations of TeleSoft.
  11072. --
  11073. -- Note : once again, the VALUE attribute is used to determine the
  11074. --        the validity of discrete fields; constraint_errors are
  11075. --        passed thru to the Get_Unitrep_Field exception handler.
  11076. --
  11077. --
  11078.    procedure Validate_ABC_Fields( field_string : in string;
  11079.                                   field_length : in natural;
  11080.                                   field_type : in Unitrep_field_names );
  11081. --
  11082.    procedure Validate_DGJ_Fields( field_string : in string;
  11083.                                   field_length : in natural;
  11084.                                   field_type : in Unitrep_field_names );
  11085. --
  11086.    procedure Validate_K_Fields( field_string : in string;
  11087.                                 field_length : in natural;
  11088.                                 field_type : in Unitrep_field_names );
  11089. --
  11090.    procedure Validate_LM_Fields( field_string : in string;
  11091.                                  field_length : in natural;
  11092.                                  field_type : in Unitrep_field_names );
  11093. --
  11094.    procedure Validate_NPQ_Fields( field_string : in string;
  11095.                                   field_length : in natural;
  11096.                                   field_type : in Unitrep_field_names );
  11097. --
  11098.    procedure Validate_RTV_Fields( field_string : in string;
  11099.                                   field_length : in natural;
  11100.                                   field_type : in Unitrep_field_names );
  11101. --
  11102.    procedure Validate_XEH_Fields( field_string : in string;
  11103.                                   field_length : in natural;
  11104.                                   field_type : in Unitrep_field_names );
  11105. --
  11106. end UR_procedures;
  11107. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11108. --urprocs.txt
  11109. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11110. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11111. --                                                                    --
  11112. --            Program unit:  PACKAGE UR_PROCEDURES                    --
  11113. --            File name :    URPROCS.TXT                              --
  11114. --                                                                    --
  11115. --            ===========================================             --
  11116. --                                                                    --
  11117. --                                                                    --
  11118. --            Produced by Veda Incorporated                           --
  11119. --            Version  1.0      April 15, 1985                        --
  11120. --                                                                    --
  11121. --                                                                    --
  11122. --            This program unit is a member of the GMHF. It           --
  11123. --            was developed using TeleSoft's Ada compiler,            --
  11124. --            version 2.1 in a VAX/VMS environment, version           --
  11125. --            3.7                                                     --
  11126. --                                                                    --
  11127. --                                                                    --
  11128. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11129. --
  11130. with Unitrep_field_types; use Unitrep_field_types;
  11131. package body UR_procedures is
  11132. --
  11133. --
  11134.   -----------------------------
  11135.   procedure Validate_ABC_Fields( field_string : in string;
  11136.                                 field_length : in natural;
  11137.                                 field_type : in Unitrep_field_names ) is
  11138.   -----------------------------
  11139.   --
  11140.   UDC_value : UDC_type;
  11141.   ULC_value : ULC_type;
  11142.   MAJOR_value : MAJOR_type;
  11143.   REVAL_value : REVAL_type;
  11144.   SCLAS_value : SCLAS_type;
  11145.   COAFF_value : COAFF_type;
  11146.   --
  11147.   begin
  11148.   --
  11149.   case field_type is
  11150.    --
  11151.    -------------------------------  A  -----------------------------
  11152.    --
  11153.      when UDC => 
  11154.         if field_string(1..1) < "0" or 
  11155.            field_string(1..1) > "9" then
  11156.               UDC_value :=
  11157.                    UDC_type'value(field_string(1..field_length));
  11158.         end if;
  11159.    --
  11160.      when ANAME => null;
  11161.    --
  11162.      when UTC => null;
  11163.    --
  11164.      when ULC => 
  11165.         if field_string(1..3) /= "FOR" then
  11166.            ULC_value := ULC_type'value(field_string(1..field_length));
  11167.         end if;
  11168.    --
  11169.      when MJCOM => null;
  11170.    --
  11171.      when MAJOR => MAJOR_value :=
  11172.                    MAJOR_type'value(field_string(1..field_length));
  11173.    --
  11174.      when REVAL => REVAL_value :=
  11175.                    REVAL_type'value(field_string(1..field_length));
  11176.    --
  11177.      when TPSN => null;
  11178.    --
  11179.      when SCLAS => SCLAS_value :=
  11180.                    SCLAS_type'value(field_string(1..field_length));
  11181.    --
  11182.    ---------------------------  B  --------------------------
  11183.    --
  11184.      when LNAME => null;
  11185.    --
  11186.    ---------------------------  C  --------------------------
  11187.    --
  11188.      when COAFF => 
  11189.         if field_string(1..2) /= "DO" or
  11190.            field_string(1..2) /= "IN" or
  11191.            field_string(1..2) /= "IS" then
  11192.               COAFF_value :=
  11193.                         COAFF_type'value(field_string(1..field_length));
  11194.         end if;
  11195.    --
  11196.      when MONOR => null;
  11197.    --
  11198.      when others => null;
  11199.    --
  11200.   end case;
  11201.   --
  11202.   end Validate_ABC_Fields;
  11203. --
  11204.   -----------------------------
  11205.    procedure Validate_DGJ_Fields( field_string : in string;
  11206.                                 field_length : in natural;
  11207.                                 field_type : in Unitrep_field_names ) is
  11208.   -----------------------------
  11209.   --
  11210.   CSERV_value : CSERV_type;
  11211.   ACTIV_value : ACTIV_type;
  11212.   FLAG_value : FLAG_type;
  11213.   PUIC_value : PUIC_type;
  11214.   CBCOM_value : CBCOM_type;
  11215.   DFCON_value : DFCON_type;
  11216.   NUCIN_value : NUCIN_type;
  11217.   --
  11218.   BILET_value : BILET_type;
  11219.   CORNK_value : CORNK_type;
  11220.   MMCMD_value : MMCMD_type;
  11221.   --
  11222.   MEDIA_value : MEDIA_type;
  11223.   TADC_value : TADC_type;
  11224.   --
  11225.   TPERS_value : TPERS_type;
  11226.   CCEBY_value : CCEBY_type;
  11227.   --
  11228.   begin
  11229.   --
  11230.   case field_type is
  11231.    --
  11232.    -----------------------------------  D  --------------------------
  11233.    --
  11234.      when CSERV => 
  11235.         if field_string(1..1) < "1" or
  11236.            field_string(1..1) > "9" then
  11237.               CSERV_value :=
  11238.                    CSERV_type'value(field_string(1..field_length));
  11239.         end if;
  11240.    --
  11241.      when  OPCON | ADCON => null;
  11242.    --
  11243.      when HOGEO | PRGEO => null;
  11244.    --
  11245.      when EMBRK => null;
  11246.    --
  11247.      when ACTIV => 
  11248.         if field_string(1..2) /= "IN" then
  11249.            ACTIV_value :=
  11250.                    ACTIV_type'value(field_string(1..field_length));
  11251.         end if;
  11252.    --
  11253.      when FLAG => FLAG_value :=
  11254.                   FLAG_type'value(field_string(1..field_length));
  11255.    --
  11256.      when PUIC => PUIC_value :=
  11257.                   PUIC_type'value(field_string(1..field_length));
  11258.    --
  11259.      when CBCOM => CBCOM_value := 
  11260.                    CBCOM_type'value(field_string(1..field_length));
  11261.    --
  11262.      when DFCON => 
  11263.         if field_string(1..1) < "1" or
  11264.            field_string(1..1) > "5" then
  11265.               DFCON_value :=
  11266.                    DFCON_type'value(field_string(1..field_length));
  11267.         end if;
  11268.    --
  11269.      when POINT => null;
  11270.    --
  11271.      when NUCIN => NUCIN_value :=
  11272.                    NUCIN_type'value(field_string(1..field_length));
  11273.    --
  11274.      when PCTEF => null;
  11275.    --
  11276.    -------------------------   DM1    --------------------------
  11277.    --
  11278.      when BILET => BILET_value :=
  11279.                    BILET_type'value(field_string(1..field_length));
  11280.    --
  11281.      when CORNK => CORNK_value :=
  11282.                    CORNK_type'value(field_string(1..field_length));
  11283.    --
  11284.      when CONAM => null;
  11285.    --
  11286.      when MMCMD => 
  11287.         if field_string(1..1) /= "#" then
  11288.            MMCMD_value := 
  11289.                    MMCMD_type'value(field_string(1..field_length));
  11290.         end if;
  11291.    --
  11292.    -------------------------   DN1    --------------------------
  11293.    --
  11294.      when NTASK => null;
  11295.    --
  11296.      when MODFG => null;
  11297.    --
  11298.      when NDEST => null;
  11299.    --
  11300.      when CXMRS => null;
  11301.    --
  11302.    -------------------------   G    --------------------------
  11303.    --
  11304.      when TCAA => null;
  11305.    --
  11306.      when MEDIA => MEDIA_value :=
  11307.                    MEDIA_type'value(field_string(1..field_length));
  11308.    --
  11309.      when TADC => TADC_value :=
  11310.                   TADC_type'value(field_string(1..field_length));
  11311.    --
  11312.      when ROUTE | XRTE => null;
  11313.    --
  11314.    -------------------------   J    --------------------------
  11315.    --
  11316.      when TPERS => 
  11317.         if field_string(1..2) /= "AT" then
  11318.            TPERS_value :=
  11319.                    TPERS_type'value(field_string(1..field_length));
  11320.         end if;
  11321.    --
  11322.      when PEGEO => null;
  11323.    --
  11324.      when STRUC | AUTH | ASGD | POSTR => null;
  11325.    --
  11326.      when DEPS | TDEPS | CASPW | CCASP => null;
  11327.    --
  11328.      when CCEBY => CCEBY_value :=
  11329.                    CCEBY_type'value(field_string(1..field_length));
  11330.    --
  11331.    -------------------------  JM1    --------------------------
  11332.    --
  11333.      when SCATD => null;
  11334.    --
  11335.      when MGO | AGO | NA | NFO | MENL | NAVO | NAVE |
  11336.           OTHOF | OTHEN | PIAOD => null;
  11337.    --
  11338.      when others => null;
  11339.    --
  11340.   end case;
  11341.   --
  11342.   end Validate_DGJ_Fields;
  11343. --
  11344.   ---------------------------
  11345.    procedure Validate_K_Fields( field_string : in string;
  11346.                                 field_length : in natural;
  11347.                                 field_type : in Unitrep_field_names ) is
  11348.   ---------------------------
  11349.   --
  11350.   TREAD_value : TREAD_type;
  11351.   REASN_value : REASN_type;
  11352.   PRRES_value : PRRES_type;
  11353.   ESRES_value : ESRES_type;
  11354.   ERRES_value : ERRES_type;
  11355.   TRRES_value : TRRES_type;
  11356.   --
  11357.   DOCID_value : DOCID_type;
  11358.   TMTHD_value : TMTHD_type;
  11359.   --
  11360.   PRMA_value : PRMA_type;
  11361.   --
  11362.   begin
  11363.   --
  11364.   case field_type is
  11365.    --
  11366.    -------------------------   K    --------------------------
  11367.    --
  11368.      when TREAD => TREAD_value :=
  11369.                    TREAD_type'value(field_string(1..field_length));
  11370.    --
  11371.      when READY | PRRAT | ESRAT | ERRAT | TRRAT | 
  11372.           CARAT | LIM => null; 
  11373.    --
  11374.      when REASN => REASN_value :=
  11375.                    REASN_type'value(field_string(1..field_length)); 
  11376.    --
  11377.      when PRRES => PRRES_value := 
  11378.                    PRRES_type'value(field_string(1..field_length)); 
  11379.    --
  11380.      when ESRES => ESRES_value :=
  11381.                    ESRES_type'value(field_string(1..field_length)); 
  11382.    --
  11383.      when ERRES => ERRES_value :=
  11384.                    ESRES_type'value(field_string(1..field_length)); 
  11385.    --
  11386.      when TRRES => TRRES_value :=
  11387.                    TRRES_type'value(field_string(1..field_length));
  11388.    --
  11389.      when SECRN => null; 
  11390.    --
  11391.      when TERRN => null; 
  11392.    --
  11393.      when RLIM  => null; 
  11394.    --
  11395.    -------------------------   KF1    --------------------------
  11396.    --
  11397.      when DOCNR => null; 
  11398.    --
  11399.      when DOCID => DOCID_value :=
  11400.                    DOCID_type'value(field_string(1..field_length)); 
  11401.    --
  11402.      when PERTP | PERTC | TRUTC => null; 
  11403.    --
  11404.      when TPAUT | TPASG | TPAVL | CPAUR | CPASG | CPAVL => null; 
  11405.    --
  11406.      when TMTHD => TMTHD_value :=
  11407.                    TMTHD_type'value(field_string(1..field_length)); 
  11408.    --
  11409.      when TCARQ | TCRAS | TCRAV => null; 
  11410.    --
  11411.      when TRSA1 | TRSA2 | TRSA3 | TRSA4 | TRSA5 => null; 
  11412.    --
  11413.    -------------------------   KF2    --------------------------
  11414.    --
  11415.      when EQSEE | EQSSE | EQREE | EQRED => null; 
  11416.    --
  11417.      when MEARD | MEASG | MEPOS => null; 
  11418.    --
  11419.      when ESSA1 | ESSA2 | ESSA3 | ESSA4 | ESSA5 | ESSA6 |
  11420.           ESSA7 | ESSA8 | ESSA9 => null; 
  11421.    --
  11422.      when MEMRA => null; 
  11423.    --
  11424.      when ERSA1 | ERSA2 | ERSA3 | ERSA4 | ERSA5 | ERSA6 |
  11425.           ERSA7 | ERSA8 => null; 
  11426.    --
  11427.    -------------------------   KF3    --------------------------
  11428.    --
  11429.      when SDOC  => null; 
  11430.    --
  11431.      when READF | REASF => null; 
  11432.    --
  11433.      when PRRAF | ESRAF | ERRAF | TRRAF => null; 
  11434.    --
  11435.      when PRREF | ESREF | ERREF | TRREF | SECRF | TERRF => null; 
  11436.    --
  11437.      when CARAF => null; 
  11438.    --
  11439.      when LIMF | RLIMF => null; 
  11440.    --
  11441.      when RESPF => null; 
  11442.    --
  11443.    -------------------------   KF4    --------------------------
  11444.    --
  11445.      when SMCC1 | SMCC2 | SMCC3 | SMCC4 => null; 
  11446.    --
  11447.      when SMRA1 | SMRA2 | SMRA3 | SMRA4 => null; 
  11448.    --
  11449.      when SMAA1 | SMAA2 | SMAA3 | SMAA4 => null; 
  11450.    --
  11451.      when SMRC1 | SMRC2 | SMRC3 | SMRC4 => null; 
  11452.    --
  11453.      when SMAC1 | SMAC2 | SMAC3 | SMAC4 => null; 
  11454.    --
  11455.      when GCCLA | GCCLB | GCCLC => null; 
  11456.    --
  11457.      when SPCLU => null; 
  11458.    --
  11459.    -------------------------   KN1    --------------------------
  11460.    --
  11461.      when PRMA  => PRMA_value :=
  11462.                    PRMA_type'value(field_string(1..field_length));
  11463.    --
  11464.      when MARAT | FMART => null; 
  11465.    --
  11466.      when MAREA => null; 
  11467.    --
  11468.      when others => null;
  11469.    --
  11470.   end case;
  11471.   --
  11472.   end Validate_K_Fields;
  11473. --
  11474.   ----------------------------
  11475.    procedure Validate_LM_Fields( field_string : in string;
  11476.                                 field_length : in natural;
  11477.                                 field_type : in Unitrep_field_names ) is
  11478.   ----------------------------
  11479.   --
  11480.   FORDV_value : FORDV_type;
  11481.   MEREC_value : MEREC_type;
  11482.   --
  11483.   begin
  11484.   --
  11485.   case field_type is
  11486.    --
  11487.    -------------------------   L, M    --------------------------
  11488.    --
  11489.      when MEQPT => null; 
  11490.    --
  11491.      when FORDV => FORDV_value :=
  11492.                    FORDV_type'value(field_string(1..field_length));
  11493.    --
  11494.      when MEPSA | METAL | MEPSD | MEORD | MEORN |
  11495.           MEORC | MEORO => null; 
  11496.    --
  11497.      when CREWA | CREAL | CREWF | CRMRD | CRMRN |
  11498.           CRMRC | CRMRO => null; 
  11499.    --
  11500.      when MEREC => 
  11501.         if field_string(1..1) /= "#" then
  11502.            MEREC_value :=
  11503.                    MEREC_type'value(field_string(1..field_length)); 
  11504.         end if;
  11505.    --
  11506.    -------------------------   M    --------------------------
  11507.    --
  11508.      when TEGEO => null; 
  11509.    --
  11510.      when others => null;
  11511.    --
  11512.   end case;
  11513.   --
  11514.   end Validate_LM_Fields;
  11515. --
  11516.   -----------------------------
  11517.    procedure Validate_NPQ_Fields( field_string : in string;
  11518.                                 field_length : in natural;
  11519.                                 field_type : in Unitrep_field_names ) is
  11520.   -----------------------------
  11521.   --
  11522.   PIN_value : PIN_type;
  11523.   PLEAC_value : PLEAC_type;
  11524.   DDP_value : DDP_type;
  11525.   --
  11526.   ALTYP_value : ALTYP_type;
  11527.   --
  11528.   WPNCO_value : WPNCO_type;
  11529.   --
  11530.   begin
  11531.   --
  11532.   case field_type is
  11533.    --
  11534.    -------------------------  N, P, Q    --------------------------
  11535.    --
  11536.      when PIN => PIN_value :=
  11537.                  PIN_type'value(field_string(1..field_length));
  11538.    --
  11539.      when FRQNO => null; 
  11540.    --
  11541.      when PLEAC => PLEAC_value :=
  11542.                    PLEAC_type'value(field_string(1..field_length));
  11543.    --
  11544.      when DDP => DDP_value :=
  11545.                  DDP_type'value(field_string(1..field_length));
  11546.    --
  11547.      when PUTCV => null; 
  11548.    --
  11549.    -------------------------   P    --------------------------
  11550.    --
  11551.      when PEQPT => null; 
  11552.    --
  11553.      when TPGEO => null; 
  11554.    --
  11555.      when ALTYP => ALTYP_value :=
  11556.                    ALTYP_type'value(field_string(1..field_length));
  11557.    --
  11558.      when NUMBR | NUMEA => null; 
  11559.    --
  11560.    -------------------------   Q    --------------------------
  11561.    --
  11562.      when NUSEQ => null; 
  11563.    --
  11564.      when WPNCO => WPNCO_value :=
  11565.                    WPNCO_type'value(field_string(1..field_length)); 
  11566.    --
  11567.      when NUQPT => null; 
  11568.    --
  11569.      when DSGEO => null; 
  11570.    --
  11571.      when NUMWR | NUMWB | NUGUN => null; 
  11572.    --
  11573.      when RTIME | RFGDS => null; 
  11574.    --
  11575.      when DSSTA => null; 
  11576.    --
  11577.      when NUSTO => null; 
  11578.    --
  11579.      when NUECC => null; 
  11580.    --
  11581.      when others => null;
  11582.    --
  11583.   end case;
  11584.   --
  11585.   end Validate_NPQ_Fields;
  11586. --
  11587.   -----------------------------
  11588.    procedure Validate_RTV_Fields( field_string : in string;
  11589.                                field_length : in natural;
  11590.                                field_type : in Unitrep_field_names ) is
  11591.   -----------------------------
  11592.   --
  11593.   SEQ_value : SEQ_type;
  11594.   TOT_value : TOT_type;
  11595.   --
  11596.   MECUS_value : MECUS_type;
  11597.   AVCAT_value : AVCAT_type;
  11598.   RESND_value : RESND_type;
  11599.   --
  11600.   MEQS_value : MEQS_type;
  11601.   SEDY_value : SEDY_type;
  11602.   TEDY_value : TEDY_type;
  11603.   AVAIL_value : AVAIL_type;
  11604.   --
  11605.   begin
  11606.   --
  11607.   case field_type is
  11608.    --
  11609.    -------------------------   R    --------------------------
  11610.    --
  11611.      when SEQ => SEQ_value :=
  11612.                  SEQ_type'value(field_string(1..field_length)); 
  11613.    --
  11614.      when TOT => TOT_value :=
  11615.                  TOT_type'value(field_string(1..field_length)); 
  11616.    --
  11617.      when LABEL => null; 
  11618.    --
  11619.      when RMKID => null; 
  11620.    --
  11621.      when REMRK => null; 
  11622.    --
  11623.    -------------------------   T    --------------------------
  11624.    --
  11625.      when TEQPT => null; 
  11626.    --
  11627.      when MESEN => null; 
  11628.    --
  11629.      when DECON => null; 
  11630.    --
  11631.      when MECUS => MECUS_value :=
  11632.                    MECUS_type'value(field_string(1..field_length));
  11633.    --
  11634.      when AVCAT => AVCAT_value :=
  11635.                    AVCAT_type'value(field_string(1..field_length));
  11636.    --
  11637.      when RESND => RESND_value := 
  11638.                    RESND_type'value(field_string(1..field_length));
  11639.    --
  11640.      when EXDAC => null; 
  11641.    --
  11642.      when CPGEO | CFGEO => null; 
  11643.    --
  11644.      when TPIN  => null; 
  11645.    --
  11646.      when TLEAC => null; 
  11647.    --
  11648.      when TLEQE => null; 
  11649.    --
  11650.    -------------------------   TF1   --------------------------
  11651.    --
  11652.      when UEQPT => null; 
  11653.    --
  11654.      when MEQS  => MEQS_value :=
  11655.                    MEQS_type'value(field_string(1..field_length));
  11656.    --
  11657.      when SEDY  => SEDY_value :=
  11658.                    SEDY_type'value(field_string(1..field_length));
  11659.    --
  11660.      when TEDY  => TEDY_value := 
  11661.                    TEDY_type'value(field_string(1..field_length));
  11662.    --
  11663.      when AVAIL => AVAIL_value :=
  11664.                    AVAIL_type'value(field_string(1..field_length));
  11665.    --
  11666.      when DCNDY => null; 
  11667.    --
  11668.      when GEOGR | DAFLD => null; 
  11669.    --
  11670.    -------------------------    V     --------------------------
  11671.    --
  11672.      when ACGEO | MDATE => null; 
  11673.    --
  11674.      when ACITY => null; 
  11675.    --
  11676.      when others => null;
  11677.    --
  11678.   end case;
  11679.   --
  11680.   end Validate_RTV_Fields;
  11681. --
  11682.   -----------------------------
  11683.    procedure Validate_XEH_Fields( field_string : in string;
  11684.                                 field_length : in natural;
  11685.                                 field_type : in Unitrep_field_names ) is
  11686.   -----------------------------
  11687.   --
  11688.   H_card_number_value : H_card_number_type;
  11689.   Day_of_month_value : Day_of_month_type;
  11690.   Month_value : Month_type;
  11691.   Year_value : Year_type;
  11692.   Real_or_Exercise_value : Real_or_Exercise_type;
  11693.   --
  11694.   begin
  11695.   --
  11696.   case field_type is
  11697.    --
  11698.    -------------------------   X    --------------------------
  11699.    --
  11700.      when GCMD | RPTOR | INTR1 | INTR2 | SBRPT => null; 
  11701.    --
  11702.      when TRGEO => null; 
  11703.    --
  11704.      when ATACH => null; 
  11705.    --
  11706.    -------------------------   E    --------------------------
  11707.    --
  11708.      when NOT_USED => null; 
  11709.    --
  11710.    -------------------------   H    --------------------------
  11711.    --
  11712.      when H_CARD_NUMBER => H_card_number_value :=
  11713.                H_card_number_type'value(field_string(1..field_length));
  11714.    --
  11715.      when DAY_OF_MONTH => Day_of_month_value :=
  11716.                Day_of_month_type'value(field_string(1..field_length));
  11717.    --
  11718.      when MONTH => Month_value :=
  11719.                    Month_type'value(field_string(1..field_length));
  11720.    --
  11721.      when YEAR => Year_value := 
  11722.                    Year_type'value(field_string(1..field_length));
  11723.    --
  11724.      when REAL_OR_EXERCISE => Real_or_exercise_value :=
  11725.           Real_or_exercise_type'value(field_string(1..field_length));
  11726.    --
  11727.      when others => null;
  11728.    --
  11729.   end case;
  11730.   --
  11731.   end Validate_XEH_Fields;
  11732. --
  11733. --
  11734. end UR_procedures;
  11735. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11736. --unitrep.sp
  11737. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11738. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11739. --                                                                    --
  11740. --            Program unit:  PACKAGE UNITREP_INTERFACE                --
  11741. --            File name :    UNITREP.SP                               --
  11742. --                                                                    --
  11743. --            ===========================================             --
  11744. --                                                                    --
  11745. --                                                                    --
  11746. --            Produced by Veda Incorporated                           --
  11747. --            Version  1.0      April 15, 1985                        --
  11748. --                                                                    --
  11749. --                                                                    --
  11750. --            This program unit is a member of the GMHF. It           --
  11751. --            was developed using TeleSoft's Ada compiler,            --
  11752. --            version 2.1 in a VAX/VMS environment, version           --
  11753. --            3.7                                                     --
  11754. --                                                                    --
  11755. --                                                                    --
  11756. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11757. --
  11758. with UNITREP_LINES_AND_FIELDS;  use UNITREP_LINES_AND_FIELDS; 
  11759. with MAN_MACHINE_INTERFACE;     use MAN_MACHINE_INTERFACE; 
  11760. with LINKED_LIST_PROCEDURES;    use LINKED_LIST_PROCEDURES; 
  11761. package UNITREP_INTERFACE is 
  11762. --
  11763.    --------------------------------
  11764.    procedure GET_UNITREP_LINE_TYPE (LINE_TYPE  : out UNITREP_LINE_NAMES); 
  11765.    --------------------------------
  11766.    --
  11767.    --
  11768.    ----------------------------------
  11769.    procedure PARSE_UNITREP_LINE_TYPE (MESSAGE_LINE  : in NODE; 
  11770.                                       LINE_TYPE     : out UNITREP_LINE_NAMES); 
  11771.    ----------------------------------
  11772.    --
  11773.    --
  11774.    ----------------------------
  11775.    procedure GET_UNITREP_FIELD (FIELD_TYPE      : in UNITREP_FIELD_NAMES; 
  11776.                                 FIELD_GOTTEN    : in out STRING; 
  11777.                                 FIELD_POSITION  : in POSITIVE; 
  11778.                                 FIELD_LENGTH    : in POSITIVE; 
  11779.                                 COMMAND_GOTTEN  : in out COMMAND; 
  11780.                                 COMMAND_FLAG    : in out BOOLEAN); 
  11781.    ----------------------------
  11782.    --
  11783.    --
  11784. end UNITREP_INTERFACE; 
  11785. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11786. --unitrep.txt
  11787. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11788. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  11789. --                                                                    --
  11790. --            Program unit:  PACKAGE UNITREP_INTERFACE                --
  11791. --            File name :    UNITREP.TXT                              --
  11792. --                                                                    --
  11793. --            ===========================================             --
  11794. --                                                                    --
  11795. --                                                                    --
  11796. --            Produced by Veda Incorporated                           --
  11797. --            Version  1.0      April 15, 1985                        --
  11798. --                                                                    --
  11799. --                                                                    --
  11800. --            This program unit is a member of the GMHF. It           --
  11801. --            was developed using TeleSoft's Ada compiler,            --
  11802. --            version 2.1 in a VAX/VMS environment, version           --
  11803. --            3.7                                                     --
  11804. --                                                                    --
  11805. --                                                                    --
  11806. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  11807. --
  11808. with TEXT_IO;                     use TEXT_IO; 
  11809. with UNITREP_FIELD_TYPES;         use UNITREP_FIELD_TYPES; 
  11810. with TERMINAL_DEFINITION;         use TERMINAL_DEFINITION; 
  11811. with UR_PROCEDURES;               use UR_PROCEDURES; 
  11812. with STATIC_GET_FIELD_UTILITIES;  use STATIC_GET_FIELD_UTILITIES; 
  11813. package body UNITREP_INTERFACE is 
  11814. --
  11815.    LEN  : NATURAL;   -- used by most routines in conjunction with the
  11816.                -- following local procedure
  11817. --
  11818.    --------------------------------------------
  11819.    --             string parser              --
  11820.    --             -------------              --
  11821.    -- compute number of non-blank characters --
  11822.    --------------------------------------------
  11823.    ----------------------------
  11824.    procedure GET_STRING_LENGTH (IN_STRING  : in STRING; 
  11825.                                 LENGTH     : out NATURAL) is 
  11826.    ----------------------------
  11827.    --
  11828.       TEMPORARY_LENGTH  : NATURAL := 0; 
  11829.    --
  11830.    begin 
  11831.    --
  11832.       for I in IN_STRING'FIRST..IN_STRING'LAST loop 
  11833.          if IN_STRING (I..I) /= " " then 
  11834.             TEMPORARY_LENGTH := TEMPORARY_LENGTH + 1; 
  11835.          end if; 
  11836.       end loop; 
  11837.    --
  11838.       LENGTH := TEMPORARY_LENGTH; 
  11839.    --
  11840.    end GET_STRING_LENGTH; 
  11841.    --
  11842.    --------------------------------
  11843.    procedure GET_UNITREP_LINE_TYPE (LINE_TYPE  : out UNITREP_LINE_NAMES) is 
  11844.    --------------------------------
  11845.    --
  11846.       LINE_TYPE_STRING  : STRING (1..3); 
  11847.    --
  11848.    -- using mmip.read, so need to ignore any edit commands
  11849.    --
  11850.       IGNORE_COMMAND    : BOOLEAN; 
  11851.       NO_COMMAND        : COMMAND; 
  11852.    --
  11853.    begin 
  11854.    --
  11855.    -- get the line type input from the user ( mmip routine )
  11856.    --
  11857.       GOTO_CRT_POSITION (12, 60); 
  11858.       READ (TEXT => LINE_TYPE_STRING, 
  11859.       NUM_CHAR => 3, 
  11860.       COMMAND_FLAG => IGNORE_COMMAND, 
  11861.       EDIT_COMMAND => NO_COMMAND); 
  11862.    -- 
  11863.    -- compute length of non-blank input
  11864.    --
  11865.       GET_STRING_LENGTH (LINE_TYPE_STRING, LEN); 
  11866.    --
  11867.    -- make sure its a valid type
  11868.    --
  11869.       LINE_TYPE := UNITREP_LINE_NAMES'VALUE (LINE_TYPE_STRING (1..LEN)); 
  11870.    --
  11871.    -- display error message and get the new input
  11872.    --
  11873.    exception 
  11874.    --
  11875.       when CONSTRAINT_ERROR => 
  11876.       --
  11877.          PROMPT ("Illegal Unitrep line type, try again"); 
  11878.          GET_UNITREP_LINE_TYPE (LINE_TYPE); 
  11879.       --
  11880.    --
  11881.    end GET_UNITREP_LINE_TYPE; 
  11882.    --
  11883.    --
  11884.    ----------------------------------
  11885.    procedure PARSE_UNITREP_LINE_TYPE (MESSAGE_LINE  : in NODE; 
  11886.                                       LINE_TYPE     : out UNITREP_LINE_NAMES) 
  11887.              is 
  11888.    ----------------------------------
  11889.    --
  11890.    --
  11891.    begin 
  11892.    --
  11893.    -- the line_type in a Unitrep message is contained in the Record_ID
  11894.    -- field; a fixed location within the string. Need to compute the 
  11895.    -- number of non-blank characters first, then convert to enum type
  11896.    --
  11897.       GET_STRING_LENGTH (MESSAGE_LINE.TEXT_LINE (6..8), LEN); 
  11898.    --
  11899.       LINE_TYPE := UNITREP_LINE_NAMES'VALUE (MESSAGE_LINE.TEXT_LINE (6..6 + 
  11900.                 LEN - 1)); 
  11901.    --
  11902.    -- if the line is illegal, pick the nil default
  11903.    --
  11904.    exception 
  11905.       --
  11906.       when CONSTRAINT_ERROR => 
  11907.          LINE_TYPE := NIL; 
  11908.       --
  11909.       -- display an alert
  11910.       --
  11911.          PROMPT ("This line is not a legal Unitrep message type"); 
  11912.       --
  11913.    end PARSE_UNITREP_LINE_TYPE; 
  11914.    --
  11915.    --
  11916.    procedure ACCEPT_DATE_TIME_TYPE (FIELD_TYPE      : in UNITREP_FIELD_NAMES; 
  11917.                                     FIELD_GOTTEN    : in out STRING; 
  11918.                                     FIELD_POSITION  : in POSITIVE; 
  11919.                                     FIELD_LENGTH    : in POSITIVE; 
  11920.                                     COMMAND_GOTTEN  : in out COMMAND; 
  11921.                                     COMMAND_FLAG    : in out BOOLEAN) is 
  11922.    --
  11923.       DUMMY_STRING  : STRING (1..3); 
  11924.       BLANK_STRING  : STRING (1..80) := (others => ' '); 
  11925.    --
  11926.    -- Note : dummy_string is used because of a TeleSoft bug -- one
  11927.    --        should only have to pass the substring of field_gotten
  11928.    --
  11929.    begin 
  11930.    --
  11931.       case FIELD_TYPE is 
  11932.    --
  11933.          when DDPRD => 
  11934.       --
  11935.       -- yymmddhh
  11936.       --
  11937.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..2), FIELD_POSITION, 
  11938.             0, 99, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11939.             
  11940.             DUMMY_STRING (1..2) := FIELD_GOTTEN (3..4); 
  11941.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 2, 
  11942.             1, 12, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11943.             FIELD_GOTTEN (3..4) := DUMMY_STRING (1..2); 
  11944.             
  11945.             DUMMY_STRING (1..2) := FIELD_GOTTEN (5..6); 
  11946.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 4, 
  11947.             1, 31, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11948.             FIELD_GOTTEN (5..6) := DUMMY_STRING (1..2); 
  11949.             
  11950.             DUMMY_STRING (1..2) := FIELD_GOTTEN (7..8); 
  11951.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 6, 
  11952.             0, 24, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11953.             FIELD_GOTTEN (7..8) := DUMMY_STRING (1..2); 
  11954.       --
  11955.          when MDT => 
  11956.       --
  11957.       -- dddhh
  11958.       --
  11959.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), FIELD_POSITION, 
  11960.             1, 366, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11961.             
  11962.             DUMMY_STRING (1..2) := FIELD_GOTTEN (4..5); 
  11963.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 3, 
  11964.             0, 24, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11965.             FIELD_GOTTEN (4..5) := DUMMY_STRING (1..2); 
  11966.       --
  11967.          when ALRET => 
  11968.       --
  11969.       -- hhhmm
  11970.       --
  11971.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), FIELD_POSITION, 
  11972.             0, 999, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11973.             
  11974.             DUMMY_STRING (1..2) := FIELD_GOTTEN (4..5); 
  11975.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 3, 
  11976.             0, 59, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11977.             FIELD_GOTTEN (4..5) := DUMMY_STRING (1..2); 
  11978.       --
  11979.          when PLETD | DETA => 
  11980.       --
  11981.       -- mmddhh
  11982.       --
  11983.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..2), FIELD_POSITION, 
  11984.             1, 12, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11985.             
  11986.             DUMMY_STRING (1..2) := FIELD_GOTTEN (3..4); 
  11987.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 2, 
  11988.             1, 31, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11989.             FIELD_GOTTEN (3..4) := DUMMY_STRING (1..2); 
  11990.             
  11991.             DUMMY_STRING (1..2) := FIELD_GOTTEN (5..6); 
  11992.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 4, 
  11993.             0, 24, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  11994.             FIELD_GOTTEN (5..6) := DUMMY_STRING (1..2); 
  11995.       --
  11996.          when RWDTE | XDATE => 
  11997.       --
  11998.       -- dddyy
  11999.       --
  12000.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), FIELD_POSITION, 
  12001.             1, 366, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  12002.             
  12003.             DUMMY_STRING (1..2) := FIELD_GOTTEN (4..5); 
  12004.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 3, 
  12005.             0, 99, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  12006.             FIELD_GOTTEN (4..5) := DUMMY_STRING (1..2); 
  12007.       --
  12008.          when PICDA | CADAT | RICDA | CADAF | RICDF | CHDAT | FCDAT | ERDTE | 
  12009.                    EQDEP | EQARR | ERRDY | EQRET | OPERL | ADATE | RDATE | 
  12010.                    TDATE | DEPDT | ARRDT => 
  12011.       --
  12012.       -- yymmdd
  12013.       --
  12014.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..2), FIELD_POSITION, 
  12015.             0, 99, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  12016.             
  12017.             DUMMY_STRING (1..2) := FIELD_GOTTEN (3..4); 
  12018.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 2, 
  12019.             1, 12, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  12020.             FIELD_GOTTEN (3..4) := DUMMY_STRING (1..2); 
  12021.             
  12022.             DUMMY_STRING (1..2) := FIELD_GOTTEN (5..6); 
  12023.             GET_CONSTRAINED_INTEGER (DUMMY_STRING (1..2), FIELD_POSITION + 4, 
  12024.             1, 31, '0', COMMAND_FLAG, COMMAND_GOTTEN); 
  12025.             FIELD_GOTTEN (5..6) := DUMMY_STRING (1..2); 
  12026.       --
  12027.          when others => 
  12028.             null; 
  12029.       --
  12030.       end case; 
  12031.    --
  12032.    -- if the entire string is not blank, don't accept it
  12033.    --
  12034.       if FIELD_GOTTEN (1) = ' ' and FIELD_GOTTEN (1..FIELD_LENGTH) /= 
  12035.                 BLANK_STRING (1..FIELD_LENGTH) then 
  12036.          raise CONSTRAINT_ERROR; 
  12037.       end if; 
  12038.    --
  12039.    exception 
  12040.       --
  12041.       -- handle an erase field locally
  12042.       --
  12043.       when ERASE_ERROR => 
  12044.          --
  12045.          COMMAND_FLAG := FALSE; 
  12046.          COMMAND_GOTTEN := NIL; 
  12047.          GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  12048.          PUT (BLANK_STRING (1..FIELD_LENGTH)); 
  12049.          GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  12050.          ACCEPT_DATE_TIME_TYPE (FIELD_TYPE, FIELD_GOTTEN, 
  12051.          FIELD_POSITION, FIELD_LENGTH, 
  12052.          COMMAND_GOTTEN, COMMAND_FLAG); 
  12053.          --
  12054.    --
  12055.    end ACCEPT_DATE_TIME_TYPE; 
  12056.    --
  12057.    --
  12058.    -------------------------------------------------------------------
  12059.    --
  12060.    ----------------------------
  12061.    procedure GET_UNITREP_FIELD (FIELD_TYPE      : in UNITREP_FIELD_NAMES; 
  12062.                                 FIELD_GOTTEN    : in out STRING; 
  12063.                                 FIELD_POSITION  : in POSITIVE; 
  12064.                                 FIELD_LENGTH    : in POSITIVE; 
  12065.                                 COMMAND_GOTTEN  : in out COMMAND; 
  12066.                                 COMMAND_FLAG    : in out BOOLEAN) is 
  12067.    ----------------------------
  12068.    --
  12069.       CLASS_VALUE   : CLASSIFICATION_TYPE; 
  12070.       UAC_VALUE     : UAC_TYPE; 
  12071.       UIC_VALUE     : UIC_TYPE; 
  12072.    --
  12073.       BLANK_STRING  : STRING (1..80) := (others => ' '); 
  12074.       DUMMY_STRING  : STRING (1..3); 
  12075.    --
  12076.    begin 
  12077.    --
  12078.       COMMAND_GOTTEN := NIL; 
  12079.       COMMAND_FLAG := FALSE; 
  12080.    --
  12081.    --------------------------------------------------------------
  12082.       case FIELD_TYPE is 
  12083.    --------------------------------------------------------------
  12084.    --
  12085.    --  first check for date/time field types -- use special input
  12086.    --
  12087.          when DDPRD | MDT | ALRET | PLETD | DETA | RWDTE | XDATE | PICDA | 
  12088.                    CADAT | RICDA | CADAF | RICDF | CHDAT | FCDAT | ERDTE | 
  12089.                    EQDEP | EQARR | ERRDY | EQRET | OPERL | ADATE | RDATE | 
  12090.                    TDATE | DEPDT | ARRDT => 
  12091.       --
  12092.             ACCEPT_DATE_TIME_TYPE (FIELD_TYPE, FIELD_GOTTEN, 
  12093.             FIELD_POSITION, FIELD_LENGTH, 
  12094.             COMMAND_GOTTEN, COMMAND_FLAG); 
  12095.       --
  12096.       --  card number and message number also use special input
  12097.       --
  12098.          when CARD_NUMBER => 
  12099.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), 
  12100.             FIELD_POSITION, 1, 999, '0', 
  12101.             COMMAND_FLAG, COMMAND_GOTTEN); 
  12102.       --
  12103.          when MESSAGE_NUMBER => 
  12104.             GET_CONSTRAINED_INTEGER (FIELD_GOTTEN (1..3), 
  12105.             FIELD_POSITION, 1, 999, '0', 
  12106.             COMMAND_FLAG, COMMAND_GOTTEN); 
  12107.       --
  12108.       -- else, use the standard character read
  12109.       --------------------------------------------------
  12110.          when others => 
  12111.       --------------------------------------------------
  12112.             READ (TEXT => FIELD_GOTTEN, 
  12113.             NUM_CHAR => FIELD_LENGTH, 
  12114.             COMMAND_FLAG => COMMAND_FLAG, 
  12115.             EDIT_COMMAND => COMMAND_GOTTEN); 
  12116.          --
  12117.          -- check for the entry of a command or a blank field
  12118.          --
  12119.             if not COMMAND_FLAG and FIELD_GOTTEN (1..FIELD_LENGTH) /= 
  12120.                       BLANK_STRING (1..FIELD_LENGTH) then 
  12121.          --
  12122.          -- can now compute the length of the non-blank input string
  12123.          --
  12124.                GET_STRING_LENGTH (FIELD_GOTTEN, LEN); 
  12125.          --
  12126.          -- the actual validation is done by the following case 
  12127.          --   For discrete types, the VALUE attribute is used to convert
  12128.          --     the string to the appropriate type, raising 
  12129.          --     constraint_error when the input is illegal.
  12130.          --
  12131.             ---------------------------------------------------
  12132.                case FIELD_TYPE is 
  12133.             ---------------------------------------------------
  12134.                --
  12135.                   when STANDARD_NAMES => 
  12136.                --
  12137.                      case FIELD_TYPE is 
  12138.                   --
  12139.                         when CLASSIFICATION => 
  12140.                            CLASS_VALUE := CLASSIFICATION_TYPE'VALUE 
  12141.                                      (FIELD_GOTTEN (1..1)); 
  12142.                   --
  12143.                         when UAC => 
  12144.                            UAC_VALUE := UAC_TYPE'VALUE (FIELD_GOTTEN 
  12145.                                      (1..LEN)); 
  12146.                   --
  12147.                         when RECORD_ID => 
  12148.                            null; 
  12149.                   --
  12150.                         when UIC | ORIGINATORS_UIC => 
  12151.                            UIC_VALUE := UIC_TYPE'VALUE (FIELD_GOTTEN 
  12152.                                      (1..LEN)); 
  12153.                   --
  12154.                         when MESSAGE_TYPE => 
  12155.                            null; 
  12156.                   --
  12157.                         when others => 
  12158.                            null; 
  12159.                   --
  12160.                      end case; 
  12161.                --
  12162.                   when ABC_NAMES => 
  12163.                      VALIDATE_ABC_FIELDS (FIELD_GOTTEN, 
  12164.                      LEN, 
  12165.                      FIELD_TYPE); 
  12166.                --
  12167.                   when DGJ_NAMES => 
  12168.                      VALIDATE_DGJ_FIELDS (FIELD_GOTTEN, 
  12169.                      LEN, 
  12170.                      FIELD_TYPE); 
  12171.                --
  12172.                   when K_NAMES => 
  12173.                      VALIDATE_K_FIELDS (FIELD_GOTTEN, 
  12174.                      LEN, 
  12175.                      FIELD_TYPE); 
  12176.                --
  12177.                   when LM_NAMES => 
  12178.                      VALIDATE_LM_FIELDS (FIELD_GOTTEN, 
  12179.                      LEN, 
  12180.                      FIELD_TYPE); 
  12181.                --
  12182.                   when NPQ_NAMES => 
  12183.                      VALIDATE_NPQ_FIELDS (FIELD_GOTTEN, 
  12184.                      LEN, 
  12185.                      FIELD_TYPE); 
  12186.                --
  12187.                   when RTV_NAMES => 
  12188.                      VALIDATE_RTV_FIELDS (FIELD_GOTTEN, 
  12189.                      LEN, 
  12190.                      FIELD_TYPE); 
  12191.                --
  12192.                   when XEH_NAMES => 
  12193.                      VALIDATE_XEH_FIELDS (FIELD_GOTTEN, 
  12194.                      LEN, 
  12195.                      FIELD_TYPE); 
  12196.                --
  12197.                   when NIL => 
  12198.                      null; 
  12199.                --
  12200.                end case; 
  12201.          --
  12202.             end if; 
  12203.       --
  12204.       end case; 
  12205.       ------------------------------------------------------------
  12206.       --
  12207.    exception 
  12208.       --
  12209.       -- process an illegal enumeration type conversion
  12210.       --
  12211.       when CONSTRAINT_ERROR => 
  12212.          --
  12213.          PROMPT ("Illegal Unitrep field entry"); 
  12214.          GOTO_CRT_POSITION (TOP_OF_WORK_AREA, FIELD_POSITION); 
  12215.          COMMAND_FLAG := FALSE; 
  12216.          COMMAND_GOTTEN := NIL; 
  12217.          GET_UNITREP_FIELD (FIELD_TYPE, 
  12218.          FIELD_GOTTEN, 
  12219.          FIELD_POSITION, 
  12220.          FIELD_LENGTH, 
  12221.          COMMAND_GOTTEN, 
  12222.          COMMAND_FLAG); 
  12223.          --
  12224.       when ERASE_ERROR => 
  12225.          --
  12226.          COMMAND_FLAG := TRUE; 
  12227.          COMMAND_GOTTEN := ERASE_FIELD; 
  12228.          --
  12229.      --
  12230.    end GET_UNITREP_FIELD; 
  12231. --
  12232. --
  12233. end UNITREP_INTERFACE; 
  12234. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12235. --ureditor.txt
  12236. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12237. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-- 
  12238. --                                                                    --
  12239. --            Program unit:  PACKAGE UR_EDITOR                        --
  12240. --            File name :    UREDITOR.TXT                             --
  12241. --                                                                    --
  12242. --            ===========================================             --
  12243. --                                                                    --
  12244. --                                                                    --
  12245. --            Produced by Veda Incorporated                           --
  12246. --            Version  1.0      April 15, 1985                        --
  12247. --                                                                    --
  12248. --                                                                    --
  12249. --            This program unit is a member of the GMHF. It           --
  12250. --            was developed using TeleSoft's Ada compiler,            --
  12251. --            version 2.1 in a VAX/VMS environment, version           --
  12252. --            3.7                                                     --
  12253. --                                                                    --
  12254. --                                                                    --
  12255. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  12256. --
  12257. with UNITREP_LINES_AND_FIELDS;  use UNITREP_LINES_AND_FIELDS; 
  12258. with UNITREP_INTERFACE;         use UNITREP_INTERFACE; 
  12259.  
  12260. with FILE_GENERIC;              use FILE_GENERIC; 
  12261.  
  12262. package UR_EDITOR is 
  12263.  
  12264.    package UNITREP_ED is new FILE_GENERIC.FILED_GENERIC_MESSAGE_EDITOR 
  12265.              (MAXIMUM_FIELDS_PER_LINE => UNITREP_MAXIMUM_FIELDS_PER_LINE, 
  12266.    MAXIMUM_CHARACTERS_PER_LINE => UNITREP_MAXIMUM_CHARACTERS_PER_LINE, 
  12267.    MAXIMUM_LINES_PER_MESSAGE => UNITREP_MAXIMUM_LINES_PER_MESSAGE, 
  12268.    LINE_NAME => UNITREP_LINE_NAMES, 
  12269.    GET_LINE_NAME => GET_UNITREP_LINE_TYPE, 
  12270.    FIELD_NAME => UNITREP_FIELD_NAMES, 
  12271.    LINE_STRUCTURE_FILE_NAME => "UNITREP.DES", 
  12272.    FIELD_PROMPT_FILE_NAME => "URPROMPT.DES", 
  12273.    PROMPT_VECTOR_FILE_NAME => "URPMTLUT.DES", 
  12274.    GET_FIELD => GET_UNITREP_FIELD, 
  12275.    PARSE_LINE_TYPE => PARSE_UNITREP_LINE_TYPE); 
  12276.        --
  12277. end UR_EDITOR; 
  12278. --
  12279. package body UR_EDITOR is 
  12280.    --
  12281. end UR_EDITOR; 
  12282. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12283. --saifap.txt
  12284. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12285. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  12286. --                                                                    --
  12287. --            Program unit:  PACKAGE FILE_ACCESS                      --
  12288. --            File name :    FAP.TXT                                  --
  12289. --                                                                    --
  12290. --            ===========================================             --
  12291. --                                                                    --
  12292. --                                                                    --
  12293. --            Produced by Veda Incorporated                           --
  12294. --            Version  1.0      April 15, 1985                        --
  12295. --                                                                    --
  12296. --                                                                    --
  12297. --            This program unit is a member of the GMHF. It           --
  12298. --            was developed using TeleSoft's Ada compiler,            --
  12299. --            version 2.1 in a VAX/VMS environment, version           --
  12300. --            3.7                                                     --
  12301. --                                                                    --
  12302. --                                                                    --
  12303. --||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--
  12304. --
  12305. with CLASSIFICATION_DEFINITION;  use CLASSIFICATION_DEFINITION; 
  12306. with MAN_MACHINE_INTERFACE;      use MAN_MACHINE_INTERFACE; 
  12307. with TERMINAL_DEFINITION;        use TERMINAL_DEFINITION; 
  12308. with DIRECT_IO;                  
  12309. with CALENDAR;                   
  12310. with TEXT_IO;                    use TEXT_IO; 
  12311.  
  12312. package body FILE_ACCESS is 
  12313. --
  12314. -- This package is available only to routines internal to
  12315. -- the system driver package. The routines deal mainly with 
  12316. -- managing the messages of the internal database.
  12317. -- External users may not utilize any of these routines.
  12318. --
  12319. ---------------------------------------------------
  12320. --        SAIC      *******************************
  12321. ---------------------------------------------------
  12322.   suffix : string(1..3);
  12323.   file_5 : text_io.file_type;
  12324. ---------------------------------------------------
  12325. --        SAIC      *******************************
  12326. ---------------------------------------------------
  12327.    -----------------------------------------------
  12328.    --
  12329.    -- local variables and direct_io instantiations
  12330.    --
  12331.    -----------------------------------------------
  12332.    --
  12333.    RECORD_ERROR  : exception; 
  12334.    --
  12335.    -- define the internal storage format of a message
  12336.    --
  12337.    type MESSAGE_FORMAT  is array (1..25) of STRING (1..80); 
  12338.    --
  12339.    type MESSAGE_RECORD  is record 
  12340.       CLASS             : CLASSIFICATION; 
  12341.       NUMBER_OF_LINES   : POSITIVE; 
  12342.       MONTH, DAY, YEAR  : INTEGER; 
  12343.       CONTENT           : MESSAGE_FORMAT; 
  12344.    end record; 
  12345.    --
  12346.    package DIRECTORY_IO is new DIRECT_IO (DIRECTORY_STRUCTURE); 
  12347.    use DIRECTORY_IO; 
  12348.    FILE_1            : DIRECTORY_IO.FILE_TYPE; 
  12349.    RECORD_NUMBER     : DIRECTORY_IO.POSITIVE_COUNT; 
  12350.    --
  12351.    DIRECTORY_RECORD  : DIRECTORY_STRUCTURE; 
  12352.    --
  12353.    package MESSAGE_IO is new DIRECT_IO (MESSAGE_RECORD); 
  12354.    use MESSAGE_IO; 
  12355.    FILE_2                 : MESSAGE_IO.FILE_TYPE; 
  12356.    MESSAGE_RECORD_NUMBER  : MESSAGE_IO.POSITIVE_COUNT; 
  12357.    --
  12358.    MESSAGE_DATA           : MESSAGE_RECORD; 
  12359.    --
  12360.    LINE_NUMBER            : POSITIVE; 
  12361.    FOUND                  : BOOLEAN; 
  12362.    --
  12363.    MONTH, DAY, YEAR       : INTEGER; 
  12364.    --
  12365.    package MESSAGE_TYPE_IO is new ENUMERATION_IO (AVAILABLE_TYPES); 
  12366.    package NATURAL_IO is new INTEGER_IO (NATURAL); 
  12367.   --
  12368.   ----------------------------------------
  12369.   --  local date routine
  12370.   ----------------------------------------
  12371.    procedure GET_THE_DATE (MONTH, DAY, YEAR  : out INTEGER) is 
  12372.    --
  12373.       COMPUTE_TIME  : CALENDAR.TIME; 
  12374.    --
  12375.    begin 
  12376.       --
  12377.       COMPUTE_TIME := CALENDAR.CLOCK; 
  12378.       --
  12379.       MONTH := CALENDAR.MONTH (COMPUTE_TIME); 
  12380.       DAY := CALENDAR.DAY (COMPUTE_TIME); 
  12381.       YEAR := CALENDAR.YEAR (COMPUTE_TIME); 
  12382.       --
  12383.    end GET_THE_DATE; 
  12384.   --
  12385.   --
  12386.   ----------------------------------------
  12387.    procedure GET_DIRECTORY (TOP_OF_DIRECTORY  : out DIRECTORY_ENTRY) is 
  12388.   ----------------------------------------
  12389.    
  12390.       CURRENT_POINTER  : DIRECTORY_ENTRY; 
  12391.       NEXT_POINTER     : DIRECTORY_ENTRY; 
  12392.       --
  12393.       --
  12394.    begin
  12395.       --
  12396.       -- open the directory
  12397.       --
  12398.       OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  12399.       --
  12400.       -- save the top of the directory linked list
  12401.       --
  12402.       CURRENT_POINTER := new DIRECTORY_STRUCTURE; 
  12403.       TOP_OF_DIRECTORY := CURRENT_POINTER; 
  12404.       --
  12405.       -- load the first directory entry
  12406.       --
  12407.       RECORD_NUMBER := 1; 
  12408.       READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12409.       --
  12410.       -- store the contents at current_pointer
  12411.       --
  12412.       CURRENT_POINTER.MESSAGE_TYPE := DIRECTORY_RECORD.MESSAGE_TYPE; 
  12413.       CURRENT_POINTER.MESSAGE_FILENAME := DIRECTORY_RECORD.MESSAGE_FILENAME; 
  12414.       CURRENT_POINTER.NUMBER_OF_MESSAGES := 
  12415.                 DIRECTORY_RECORD.NUMBER_OF_MESSAGES; 
  12416.       CURRENT_POINTER.PREVIOUS_MESSAGE_TYPE := null; 
  12417.       CURRENT_POINTER.TYPE_STRING := DIRECTORY_RECORD.TYPE_STRING; 
  12418.       CURRENT_POINTER.NUMBER_STRING := DIRECTORY_RECORD.NUMBER_STRING; 
  12419.       --
  12420.       -- now get the rest of the records
  12421.       --
  12422.       while not END_OF_FILE (FILE_1) loop 
  12423.          --
  12424.          NEXT_POINTER := new DIRECTORY_STRUCTURE; 
  12425.          RECORD_NUMBER := RECORD_NUMBER + 1; 
  12426.          READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12427.             --
  12428.          NEXT_POINTER.MESSAGE_TYPE := DIRECTORY_RECORD.MESSAGE_TYPE; 
  12429.          NEXT_POINTER.MESSAGE_FILENAME := DIRECTORY_RECORD.MESSAGE_FILENAME; 
  12430.          NEXT_POINTER.NUMBER_OF_MESSAGES := 
  12431.                    DIRECTORY_RECORD.NUMBER_OF_MESSAGES; 
  12432.          NEXT_POINTER.PREVIOUS_MESSAGE_TYPE := CURRENT_POINTER; 
  12433.          NEXT_POINTER.TYPE_STRING := DIRECTORY_RECORD.TYPE_STRING; 
  12434.          NEXT_POINTER.NUMBER_STRING := DIRECTORY_RECORD.NUMBER_STRING; 
  12435.             --
  12436.          CURRENT_POINTER.NEXT_MESSAGE_TYPE := NEXT_POINTER; 
  12437.          CURRENT_POINTER := NEXT_POINTER; 
  12438.          --
  12439.       end loop; 
  12440.        --
  12441.       CLOSE (FILE_1); 
  12442.        --
  12443.    end GET_DIRECTORY; 
  12444.   --
  12445.   --------------------------------------
  12446.    procedure GET_MESSAGE_OUT (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  12447.                               MESSAGE_NUMBER     : in NATURAL; 
  12448.                               MESSAGE_TEXT       : in out MESSAGE) is 
  12449.   --------------------------------------
  12450.   --
  12451.       MESSAGE_POINTER  : NODE;
  12452.   --
  12453.   --
  12454.    begin 
  12455.    --
  12456.       PROMPT("Retrieving data base message");
  12457.     --
  12458.     -- open the message file and read the first record
  12459.     --
  12460.       OPEN (FILE_2, INOUT_FILE, 
  12461.       DIRECTORY_POINTER.MESSAGE_FILENAME & ".MSG", ""); 
  12462.     --
  12463.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES OR
  12464.          MESSAGE_NUMBER = 0 then 
  12465.          MESSAGE_RECORD_NUMBER := 1; 
  12466.       else 
  12467.          MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT ((MESSAGE_NUMBER 
  12468.                    * 4 + 1)); 
  12469.       end if; 
  12470.     --
  12471.       READ (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  12472.     --
  12473.     -- load the first record into memory
  12474.     --
  12475.       MESSAGE_POINTER := new MESSAGE_COMPONENT; 
  12476.     --
  12477.       MESSAGE_TEXT.HEAD := MESSAGE_POINTER; 
  12478.       MESSAGE_TEXT.TAIL := MESSAGE_POINTER; 
  12479.       MESSAGE_TEXT.CLASS := MESSAGE_DATA.CLASS; 
  12480.       MESSAGE_TEXT.NUMBER_OF_LINES := MESSAGE_DATA.NUMBER_OF_LINES; 
  12481.     --
  12482.       MESSAGE_POINTER.NEXT_LINE := null; 
  12483.       MESSAGE_POINTER.PREV_LINE := null; 
  12484.       MESSAGE_POINTER.TEXT_LINE := MESSAGE_DATA.CONTENT (1); 
  12485.     --
  12486.     -- load the remaining lines into memory; an additional record must
  12487.     -- be read after 25, 50 and 75 lines
  12488.     --
  12489.       LINE_NUMBER := 1; 
  12490.       for I in 2..MESSAGE_DATA.NUMBER_OF_LINES loop 
  12491.          LINE_NUMBER := LINE_NUMBER + 1; 
  12492.          if LINE_NUMBER > 25 then 
  12493.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  12494.             if NATURAL (MESSAGE_RECORD_NUMBER) >= (MESSAGE_NUMBER + 1) * 4 + 1 
  12495.                       then 
  12496.                raise RECORD_ERROR; 
  12497.             end if; 
  12498.             LINE_NUMBER := 1; 
  12499.             READ (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  12500.          end if; 
  12501.          INSERT_AFTER (MESSAGE_TEXT, MESSAGE_POINTER); 
  12502.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  12503.          MESSAGE_POINTER.TEXT_LINE := MESSAGE_DATA.CONTENT (LINE_NUMBER); 
  12504.       end loop; 
  12505.     --
  12506.     --
  12507.       CLOSE (FILE_2); 
  12508.   --
  12509.    exception 
  12510.      --
  12511.       when RECORD_ERROR => 
  12512.          CLOSE (FILE_2); 
  12513.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  12514.   --
  12515.    end GET_MESSAGE_OUT; 
  12516.   --
  12517.   -----------------------------------------
  12518.    procedure PUT_NEW_MESSAGE_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  12519.                                  MESSAGE_TEXT       : in MESSAGE) is 
  12520.   -----------------------------------------
  12521.   --
  12522.       MESSAGE_POINTER  : NODE; 
  12523.   --
  12524.    begin 
  12525.     --
  12526.     -- find the directory record and update the directory file
  12527.     --
  12528.       RECORD_NUMBER := 1; 
  12529.       OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  12530.       while not END_OF_FILE (FILE_1) loop 
  12531.          READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12532.          if DIRECTORY_RECORD.MESSAGE_TYPE = DIRECTORY_POINTER.MESSAGE_TYPE 
  12533.                    then 
  12534.             DIRECTORY_RECORD.NUMBER_OF_MESSAGES := 
  12535.                       DIRECTORY_RECORD.NUMBER_OF_MESSAGES + 1; 
  12536.             NATURAL_IO.PUT (TO => DIRECTORY_RECORD.NUMBER_STRING, 
  12537.             ITEM => DIRECTORY_RECORD.NUMBER_OF_MESSAGES); 
  12538.             exit; 
  12539.          else 
  12540.             RECORD_NUMBER := RECORD_NUMBER + 1; 
  12541.          end if; 
  12542.       end loop; 
  12543.     --
  12544.       WRITE (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12545.       CLOSE (FILE_1); 
  12546.     --
  12547.     -- open the message file
  12548.     --
  12549.       OPEN (FILE_2, INOUT_FILE, 
  12550.       DIRECTORY_RECORD.MESSAGE_FILENAME & ".MSG", ""); 
  12551.     --
  12552.       MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT 
  12553.                 ((DIRECTORY_RECORD.NUMBER_OF_MESSAGES) * 4 + 1); 
  12554.     --
  12555.       MESSAGE_DATA.CLASS := MESSAGE_TEXT.CLASS; 
  12556.       MESSAGE_DATA.NUMBER_OF_LINES := MESSAGE_TEXT.NUMBER_OF_LINES; 
  12557.     --
  12558.       GET_THE_DATE (MONTH, DAY, YEAR); 
  12559.       MESSAGE_DATA.MONTH := MONTH; 
  12560.       MESSAGE_DATA.DAY := DAY; 
  12561.       MESSAGE_DATA.YEAR := YEAR; 
  12562.     --
  12563.     -- write the message to disk, 25 lines per record
  12564.     --
  12565.       MESSAGE_POINTER := MESSAGE_TEXT.HEAD; 
  12566.     --
  12567.       LINE_NUMBER := 1;
  12568.       for I in 1..MESSAGE_TEXT.NUMBER_OF_LINES loop 
  12569.          MESSAGE_DATA.CONTENT (LINE_NUMBER) := MESSAGE_POINTER.TEXT_LINE; 
  12570.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  12571.          LINE_NUMBER := LINE_NUMBER + 1; 
  12572.          if LINE_NUMBER > 25 or I >= MESSAGE_TEXT.NUMBER_OF_LINES then 
  12573.             LINE_NUMBER := 1; 
  12574.             WRITE (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  12575.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  12576.             if MESSAGE_RECORD_NUMBER >= MESSAGE_IO.POSITIVE_COUNT 
  12577.                       (((DIRECTORY_RECORD.NUMBER_OF_MESSAGES) + 1) * 4 + 1) 
  12578.                       then 
  12579.                raise RECORD_ERROR; 
  12580.             end if; 
  12581.          end if; 
  12582.       end loop; 
  12583.     --
  12584.       CLOSE (FILE_2); 
  12585.       PROMPT("New message saved in data base");
  12586.     --
  12587.     ---------------------------------------------------------------
  12588.     -- create sequential message file for SAIC interface
  12589.     ---------------------------------------------------------------
  12590.        SUFFIX(1..3) := DIRECTORY_RECORD.NUMBER_STRING(3..5);
  12591.        FOR I IN 1..2 LOOP
  12592.            IF SUFFIX(I) = ' ' THEN
  12593.               SUFFIX(I) := '0';
  12594.            END IF;
  12595.        END LOOP;
  12596.        text_io.create(file_5,out_file,"message"&"."&SUFFIX,"");
  12597.     --
  12598.        message_pointer := message_text.head;
  12599.     --
  12600.        line_number := 1;
  12601.        for i in 1 .. message_text.number_of_lines loop
  12602.           text_io.put_line(file_5,message_pointer.text_line);
  12603.           message_pointer := message_pointer.next_line;
  12604.        end loop;
  12605.     --
  12606.        text_io.close(file_5);
  12607. -------------------------------------------------------------------
  12608. --       stuff for SAIC         ^^^^^^^^^^^^^^
  12609. -------------------------------------------------------------------
  12610.    exception 
  12611.      --
  12612.       when RECORD_ERROR => 
  12613.          CLOSE (FILE_2); 
  12614.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  12615.   --
  12616.    end PUT_NEW_MESSAGE_IN; 
  12617.   --
  12618.   ----------------------------------------------
  12619.    procedure PUT_OLD_MESSAGE_BACK_IN (DIRECTORY_POINTER  : in DIRECTORY_ENTRY; 
  12620.                                       MESSAGE_NUMBER     : in NATURAL; 
  12621.                                       MESSAGE_TEXT       : in MESSAGE) is 
  12622.   ----------------------------------------------
  12623.   --
  12624.       MESSAGE_POINTER  : NODE; 
  12625.   --
  12626.    begin 
  12627.     --
  12628.     -- validate the message number
  12629.     --
  12630.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES then 
  12631.          PROMPT ("illegal record number selected"); 
  12632.          return; 
  12633.       end if; 
  12634.     --
  12635.     -- open the message file
  12636.     --
  12637.       OPEN (FILE_2, INOUT_FILE, 
  12638.       DIRECTORY_POINTER.MESSAGE_FILENAME & ".MSG", ""); 
  12639.     --
  12640.     -- must be a valid selection, process it
  12641.     --
  12642.       MESSAGE_RECORD_NUMBER := MESSAGE_IO.POSITIVE_COUNT (MESSAGE_NUMBER * 4 
  12643.                 + 1); 
  12644.     --
  12645.       MESSAGE_DATA.CLASS := MESSAGE_TEXT.CLASS; 
  12646.       MESSAGE_DATA.NUMBER_OF_LINES := MESSAGE_TEXT.NUMBER_OF_LINES; 
  12647.     --
  12648.       GET_THE_DATE (MONTH, DAY, YEAR); 
  12649.       MESSAGE_DATA.MONTH := MONTH; 
  12650.       MESSAGE_DATA.DAY := DAY; 
  12651.       MESSAGE_DATA.YEAR := YEAR; 
  12652.     --
  12653.     -- write the message to disk, 25 lines per record
  12654.     --
  12655.       MESSAGE_POINTER := MESSAGE_TEXT.HEAD; 
  12656.     --
  12657.       LINE_NUMBER := 1; 
  12658.       for I in 1..MESSAGE_TEXT.NUMBER_OF_LINES loop 
  12659.          MESSAGE_DATA.CONTENT (LINE_NUMBER) := MESSAGE_POINTER.TEXT_LINE; 
  12660.          MESSAGE_POINTER := MESSAGE_POINTER.NEXT_LINE; 
  12661.          LINE_NUMBER := LINE_NUMBER + 1; 
  12662.          if LINE_NUMBER > 25 or I >= MESSAGE_TEXT.NUMBER_OF_LINES then 
  12663.             LINE_NUMBER := 1; 
  12664.             WRITE (FILE_2, MESSAGE_DATA, MESSAGE_RECORD_NUMBER); 
  12665.             MESSAGE_RECORD_NUMBER := MESSAGE_RECORD_NUMBER + 1; 
  12666.             if NATURAL (MESSAGE_RECORD_NUMBER) >= (MESSAGE_NUMBER + 1) * 4 + 1 
  12667.                       then 
  12668.                raise RECORD_ERROR; 
  12669.             end if; 
  12670.          end if; 
  12671.       end loop; 
  12672.     --
  12673.       CLOSE (FILE_2); 
  12674.       PROMPT("Old message restored in data base");
  12675.   --
  12676.     ---------------------------------------------------------------
  12677.     -- create sequential message file for SAIC interface
  12678.     ---------------------------------------------------------------
  12679.        SUFFIX(1..3) := DIRECTORY_RECORD.NUMBER_STRING(3..5);
  12680.        FOR I IN 1..2 LOOP
  12681.            IF SUFFIX(I) = ' ' THEN
  12682.               SUFFIX(I) := '0';
  12683.            END IF;
  12684.        END LOOP;
  12685.        text_io.create(file_5,out_file,"message"&"."&SUFFIX,"");
  12686.     --
  12687.        message_pointer := message_text.head;
  12688.     --
  12689.        line_number := 1;
  12690.        for i in 1 .. message_text.number_of_lines loop
  12691.           text_io.put_line(file_5,message_pointer.text_line);
  12692.           message_pointer := message_pointer.next_line;
  12693.        end loop;
  12694.     --
  12695.        text_io.close(file_5);
  12696. -------------------------------------------------------------------
  12697. --       stuff for SAIC         ^^^^^^^^^^^^^^
  12698. -------------------------------------------------------------------
  12699.  
  12700.    exception 
  12701.      --
  12702.       when RECORD_ERROR => 
  12703.          CLOSE (FILE_2); 
  12704.          PROMPT ("Too many lines this message, only 100 lines saved"); 
  12705.   --
  12706.    end PUT_OLD_MESSAGE_BACK_IN; 
  12707.   --
  12708.   --------------------------------------
  12709.    procedure DELETE_MESSAGE_FROM_DATABASE (DIRECTORY_POINTER  : in out 
  12710.              DIRECTORY_ENTRY; 
  12711.                                            MESSAGE_NUMBER     : in NATURAL) is 
  12712.   --------------------------------------
  12713.    --
  12714.       SCRATCH_MESSAGE  : MESSAGE; 
  12715.       ENTRY_NUMBER     : NATURAL; 
  12716.    --
  12717.    begin 
  12718.       --
  12719.       -- validate the message number to be deleted
  12720.       --
  12721.       if MESSAGE_NUMBER > DIRECTORY_POINTER.NUMBER_OF_MESSAGES or 
  12722.                 MESSAGE_NUMBER = 0 then 
  12723.          PROMPT ("Illegal Message Delete Attempted"); 
  12724.          return; 
  12725.       --
  12726.       else 
  12727.          --
  12728.          PROMPT ("Deleting Message Entry"); 
  12729.          --
  12730.          OPEN (FILE_1, INOUT_FILE, "MSGDRCTRY.DAT", ""); 
  12731.          --
  12732.          -- last entry deletion does not require repacking
  12733.          --
  12734.          if MESSAGE_NUMBER /= DIRECTORY_POINTER.NUMBER_OF_MESSAGES then 
  12735.             --
  12736.             -- must re-pack the message file
  12737.             --
  12738.             for I in MESSAGE_NUMBER + 1..DIRECTORY_POINTER.NUMBER_OF_MESSAGES 
  12739.                       loop 
  12740.                ENTRY_NUMBER := NATURAL (I); 
  12741.                GET_MESSAGE_OUT (DIRECTORY_POINTER, ENTRY_NUMBER, 
  12742.                SCRATCH_MESSAGE); 
  12743.                ENTRY_NUMBER := ENTRY_NUMBER - 1; 
  12744.                PUT_OLD_MESSAGE_BACK_IN (DIRECTORY_POINTER, ENTRY_NUMBER, 
  12745.                SCRATCH_MESSAGE); 
  12746.             end loop; 
  12747.          end if; 
  12748.          --
  12749.          RECORD_NUMBER := 1; 
  12750.          while not END_OF_FILE (FILE_1) loop 
  12751.             READ (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12752.             exit when DIRECTORY_RECORD.MESSAGE_TYPE = 
  12753.                       DIRECTORY_POINTER.MESSAGE_TYPE; 
  12754.             RECORD_NUMBER := RECORD_NUMBER + 1; 
  12755.          end loop; 
  12756.          --
  12757.          DIRECTORY_RECORD.NUMBER_OF_MESSAGES := 
  12758.                    DIRECTORY_RECORD.NUMBER_OF_MESSAGES - 1; 
  12759.          NATURAL_IO.PUT (TO => DIRECTORY_RECORD.NUMBER_STRING, 
  12760.          ITEM => DIRECTORY_RECORD.NUMBER_OF_MESSAGES); 
  12761.          WRITE (FILE_1, DIRECTORY_RECORD, RECORD_NUMBER); 
  12762.          CLOSE (FILE_1); 
  12763.          --
  12764.       end if; 
  12765.    --
  12766.    end DELETE_MESSAGE_FROM_DATABASE; 
  12767. --
  12768. --
  12769. end FILE_ACCESS; 
  12770.  
  12771.