home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / metric / sinstool.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  1.1 MB  |  32,068 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. --lists.spc
  3. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4.  
  5. generic
  6.   type ITEMTYPE is private;  --| This is the data being manipulated.
  7.  
  8.   with function EQUAL(X, Y : in ITEMTYPE) return BOOLEAN is "="; 
  9.   --| This allows the user to define
  10.   --| equality on ItemType.  For instance
  11.   --| if ItemType is an abstract type
  12.   --| then equality is defined in terms of
  13.   --| the abstract type.  If this function
  14.   --| is not provided equality defaults to
  15.   --| =.
  16. package LISTS is 
  17.  
  18. --| This package provides singly linked lists with elements of type
  19. --| ItemType, where ItemType is specified by a generic parameter.
  20.  
  21. --| Overview
  22. --| When this package is instantiated, it provides a linked list type for
  23. --| lists of objects of type ItemType, which can be any desired type.  A
  24. --| complete set of operations for manipulation, and releasing
  25. --| those lists is also provided.  For instance, to make lists of strings,
  26. --| all that is necessary is:
  27. --|
  28. --| type StringType is string(1..10);
  29. --|
  30. --| package Str_List is new Lists(StringType); use Str_List;
  31. --| 
  32. --|    L:List;
  33. --|    S:StringType;
  34. --|
  35. --| Then to add a string S, to the list L, all that is necessary is
  36. --|
  37. --|    L := Create;
  38. --|    Attach(S,L);
  39. --| 
  40. --| 
  41. --| This package provides basic list operations.
  42. --|
  43. --| Attach          append an object to an object, an object to a list,
  44. --|                 or a list to an object, or a list to a list.
  45. --| Copy            copy a list using := on elements
  46. --| CopyDeep        copy a list by copying the elements using a copy
  47. --|                 operation provided by the user
  48. --| Create          Creates an empty list
  49. --| DeleteHead      removes the head of a list
  50. --| DeleteItem      delete the first occurrence of an element from a list
  51. --| DeleteItems     delete all occurrences of an element from a list
  52. --| Destroy         remove a list
  53. --| Equal           are two lists equal
  54. --| FirstValue      get the information from the first element of a list
  55. --| IsInList        determines whether a given element is in a given list
  56. --| IsEmpty         returns true if the list is empty
  57. --| LastValue       return the last value of a list
  58. --| Length          Returns the length of a list 
  59. --| MakeListIter    prepares for an iteration over a list
  60. --| More            are there any more items in the list
  61. --| Next            get the next item in a list
  62. --| ReplaceHead     replace the information at the head of the list
  63. --| ReplaceTail     replace the tail of a list with a new list
  64. --| Tail            get the tail of a list
  65. --|   
  66.  
  67. --| N/A: Effects, Requires, Modifies, and Raises.
  68.  
  69. --| Notes
  70. --| Programmer Buddy Altus
  71.  
  72. --|                           Types
  73. --|                           -----
  74.  
  75.   type LIST is private; 
  76.   type LISTITER is private; 
  77.  
  78.  
  79.   --|                           Exceptions
  80.   --|                           ----------
  81.  
  82.   CIRCULARLIST   : exception;  --| Raised if an attemp is made to
  83.   --| create a circular list.  This
  84.   --| results when a list is attempted
  85.   --| to be attached to itself.
  86.  
  87.   EMPTYLIST      : exception;  --| Raised if an attemp is made to
  88.   --| manipulate an empty list.
  89.  
  90.   ITEMNOTPRESENT : exception;  --| Raised if an attempt is made to
  91.   --| remove an element from a list in
  92.   --| which it does not exist.
  93.  
  94.   NOMORE         : exception;  --| Raised if an attemp is made to
  95.   --| get the next element from a list
  96.   --| after iteration is complete.
  97.  
  98.  
  99.  
  100.   --|                           Operations
  101.   --|                           ---------- 
  102.  
  103.   ----------------------------------------------------------------------------
  104.  
  105.   procedure ATTACH( --| appends List2 to List1
  106.                    LIST1 : in out LIST;  --| The list being appended to.
  107.                    LIST2 : in LIST --| The list being appended.
  108.                    ); 
  109.  
  110.   --| Raises
  111.   --| CircularList
  112.  
  113.   --| Effects
  114.   --| Appends List1 to List2.  This makes the next field of the last element
  115.   --| of List1 refer to List2.  This can possibly change the value of List1
  116.   --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  117.   --| user Destroys List1 then List2 will be a dangling reference.
  118.   --| This procedure raises CircularList if List1 equals List2.  If it is 
  119.   --| necessary to Attach a list to itself first make a copy of the list and 
  120.   --| attach the copy.
  121.  
  122.   --| Modifies
  123.   --| Changes the next field of the last element in List1 to be List2.
  124.  
  125. -------------------------------------------------------------------------------
  126.  
  127.   function ATTACH( --| Creates a new list containing the two
  128.   --| Elements.
  129.                   ELEMENT1 : in ITEMTYPE; 
  130.                                  --| This will be first element in list.
  131.                   ELEMENT2 : in ITEMTYPE
  132.                                  --| This will be second element in list.
  133.                   ) return LIST; 
  134.  
  135.   --| Effects
  136.   --| This creates a list containing the two elements in the order
  137.   --| specified.
  138.  
  139. -------------------------------------------------------------------------------
  140.   procedure ATTACH( --| List L is appended with Element.
  141.                    L       : in out LIST;  --| List being appended to.
  142.                    ELEMENT : in ITEMTYPE
  143.                                     --| This will be last element in l    ist.
  144.                    ); 
  145.  
  146.   --| Effects
  147.   --| Appends Element onto the end of the list L.  If L is empty then this
  148.   --| may change the value of L.
  149.   --|
  150.   --| Modifies
  151.   --| This appends List L with Element by changing the next field in List.
  152.  
  153. --------------------------------------------------------------------------------
  154.   procedure ATTACH( --| Makes Element first item in list L.
  155.                    ELEMENT : in ITEMTYPE; 
  156.                                     --| This will be the first element in list.
  157.                    L       : in out LIST --| The List which Element is being
  158.                    --| prepended to.
  159.                    ); 
  160.  
  161.   --| Effects
  162.   --| This prepends list L with Element.
  163.   --|
  164.   --| Modifies
  165.   --| This modifies the list L.
  166.  
  167.   --------------------------------------------------------------------------
  168.  
  169.   function ATTACH( --| attaches two lists
  170.                   LIST1 : in LIST;  --| first list
  171.                   LIST2 : in LIST --| second list
  172.                   ) return LIST; 
  173.  
  174.   --| Raises
  175.   --| CircularList
  176.  
  177.   --| Effects
  178.   --| This returns a list which is List1 attached to List2.  If it is desired
  179.   --| to make List1 be the new attached list the following ada code should be
  180.   --| used.
  181.   --|  
  182.   --| List1 := Attach (List1, List2);
  183.   --| This procedure raises CircularList if List1 equals List2.  If it is 
  184.   --| necessary to Attach a list to itself first make a copy of the list and 
  185.   --| attach the copy.
  186.  
  187.   -------------------------------------------------------------------------
  188.  
  189.   function ATTACH( --| prepends an element onto a list
  190.                   ELEMENT : in ITEMTYPE;  --| element being prepended to list
  191.                   L       : in LIST --| List which element is being added
  192.                   --| to
  193.                   ) return LIST; 
  194.  
  195.   --| Effects
  196.   --| Returns a new list which is headed by Element and followed by L.
  197.  
  198.   ------------------------------------------------------------------------
  199.  
  200.   function ATTACH( --| Adds an element to the end of a list
  201.                   L       : in LIST; 
  202.                                    --| The list which element is being added to.
  203.                   ELEMENT : in ITEMTYPE
  204.                                    --| The element being added to the end of
  205.                   --| the list.
  206.                   ) return LIST; 
  207.  
  208.   --| Effects
  209.   --| Returns a new list which is L followed by Element.
  210.  
  211.   --------------------------------------------------------------------------  
  212.  
  213.  
  214.   function COPY( --| returns a copy of list1 
  215.                 L : in LIST --| list being copied
  216.                 ) return LIST; 
  217.  
  218.   --| Effects
  219.   --| Returns a copy of L.
  220.  
  221.   --------------------------------------------------------------------------
  222.  
  223.   generic
  224.     with function COPY(I : in ITEMTYPE) return ITEMTYPE; 
  225.  
  226.  
  227.   function COPYDEEP( --| returns a copy of list using a user supplied
  228.   --| copy function.  This is helpful if the type
  229.   --| of a list is an abstract data type.
  230.                     L : in LIST --| List being copied.
  231.                     ) return LIST; 
  232.  
  233.   --| Effects
  234.   --| This produces a new list whose elements have been duplicated using
  235.   --| the Copy function provided by the user.
  236.  
  237. ------------------------------------------------------------------------------
  238.  
  239.   function CREATE --| Returns an empty List
  240.  
  241.   return LIST; 
  242.  
  243. ------------------------------------------------------------------------------
  244.  
  245.   procedure DELETEHEAD( --| Remove the head element from a list.
  246.                        L : in out LIST --| The list whose head is being removed.
  247.                        ); 
  248.  
  249.   --| Raises
  250.   --| EmptyList
  251.   --|
  252.   --| Effects
  253.   --| This will return the space occupied by the first element in the list
  254.   --| to the heap.  If sharing exists between lists this procedure
  255.   --| could leave a dangling reference.  If L is empty EmptyList will be
  256.   --| raised.
  257.  
  258. ------------------------------------------------------------------------------
  259.  
  260.   procedure DELETEITEM( --| remove the first occurrence of Element
  261.   --| from L
  262.                        L       : in out LIST; 
  263.                                 --| list element is being  removed from
  264.                        ELEMENT : in ITEMTYPE --| element being removed
  265.                        ); 
  266.  
  267.   --| Raises
  268.   --| ItemNotPresent
  269.  
  270.   --| Effects
  271.   --| Removes the first element of the list equal to Element.  If there is
  272.   --| not an element equal to Element than ItemNotPresent is raised.
  273.  
  274.   --| Modifies
  275.   --| This operation is destructive, it returns the storage occupied by
  276.   --| the elements being deleted.
  277.  
  278. ------------------------------------------------------------------------------
  279.  
  280.   procedure DELETEITEMS( --| remove all occurrences of Element
  281.   --| from  L.
  282.                         L       : in out LIST; 
  283.                                 --| The List element is being removed from
  284.                         ELEMENT : in ITEMTYPE --| element being removed
  285.                         ); 
  286.  
  287.   --| Raises
  288.   --| ItemNotPresent
  289.   --|
  290.   --| Effects
  291.   --| This procedure walks down the list L and removes all elements of the
  292.   --| list equal to Element.  If there are not any elements equal to Element
  293.   --| then raise ItemNotPresent.
  294.  
  295.   --| Modifies
  296.   --| This operation is destructive the storage occupied by the items
  297.   --| removed is returned.
  298.  
  299. ------------------------------------------------------------------------------
  300.  
  301.   procedure DESTROY( --| removes the list
  302.                     L : in out LIST --| the list being removed
  303.                     ); 
  304.  
  305.   --| Effects
  306.   --| This returns to the heap all the storage that a list occupies.  Keep in
  307.   --| mind if there exists sharing between lists then this operation can leave
  308.   --| dangling references.
  309.  
  310. ------------------------------------------------------------------------------
  311.  
  312.   function FIRSTVALUE( --| returns the contents of the first record of the 
  313.   --| list
  314.                       L : in LIST --| the list whose first element is being
  315.                       --| returned
  316.  
  317.                       ) return ITEMTYPE; 
  318.  
  319.   --| Raises
  320.   --| EmptyList
  321.   --|
  322.   --| Effects
  323.   --| This returns the Item in the first position in the list.  If the list
  324.   --| is empty EmptyList is raised.
  325.  
  326. -------------------------------------------------------------------------------
  327.  
  328.   function ISEMPTY( --| Checks if a list is empty.
  329.                    L : in LIST --| List being checked.
  330.                    ) return BOOLEAN; 
  331.  
  332.   --------------------------------------------------------------------------
  333.  
  334.   function ISINLIST( --| Checks if element is an element of
  335.   --| list.
  336.                     L       : in LIST;  --| list being scanned for element
  337.                     ELEMENT : in ITEMTYPE --| element being searched for
  338.                     ) return BOOLEAN; 
  339.  
  340.   --| Effects
  341.   --| Walks down the list L looking for an element whose value is Element.
  342.  
  343. ------------------------------------------------------------------------------
  344.  
  345.   function LASTVALUE( --| Returns the contents of the last record of
  346.   --| the list.
  347.                      L : in LIST --| The list whose first element is being
  348.                      --| returned.
  349.                      ) return ITEMTYPE; 
  350.  
  351.   --| Raises
  352.   --| EmptyList
  353.   --|
  354.   --| Effects
  355.   --| Returns the last element in a list.  If the list is empty EmptyList is
  356.   --| raised.
  357.  
  358.  
  359. ------------------------------------------------------------------------------
  360.  
  361.   function LENGTH( --| count the number of elements on a list
  362.                   L : in LIST --| list whose length is being computed
  363.                   ) return INTEGER; 
  364.  
  365. ------------------------------------------------------------------------------
  366.  
  367.   function MAKELISTITER( --| Sets a variable to point to  the head
  368.   --| of the list.  This will be used to
  369.   --| prepare for iteration over a list.
  370.                         L : in LIST --| The list being iterated over.
  371.                         ) return LISTITER; 
  372.  
  373.  
  374. --| This prepares a user for iteration operation over a list.  The iterater is
  375.   --| an operation which returns successive elements of the list on successive
  376.   --| calls to the iterator.  There needs to be a mechanism which marks the
  377.   --| position in the list, so on successive calls to the Next operation the
  378.   --| next item in the list can be returned.  This is the function of the
  379.   --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  380.   --| the beginning  of the list. On subsequent calls to Next the Iter
  381.   --| is updated with each call.
  382.  
  383.   -----------------------------------------------------------------------------
  384.  
  385.   function MORE( --| Returns true if there are more elements in
  386.   --| the and false if there aren't any more
  387.   --| the in the list.
  388.                 L : in LISTITER --| List being checked for elements.
  389.                 ) return BOOLEAN; 
  390.  
  391. ------------------------------------------------------------------------------
  392.  
  393.   procedure NEXT( --| This is the iterator operation.  Given
  394.   --| a ListIter in the list it returns the
  395.   --| current item and updates the ListIter.
  396.   --| If ListIter is at the end of the list,
  397.   --| More returns false otherwise it
  398.   --| returns true.
  399.                  PLACE : in out LISTITER; 
  400.                                 --| The Iter which marks the position in
  401.                  --| the list.
  402.                  INFO  : out ITEMTYPE --| The element being returned.
  403.  
  404.                  ); 
  405.  
  406.   --| The iterators subprograms MakeListIter, More, and Next should be used
  407.   --| in the following way:
  408.   --|
  409.   --|         L:        List;
  410.   --|         Place:    ListIter;
  411.   --|         Info:     SomeType;
  412.   --|
  413.   --|     
  414.   --|         Place := MakeListIter(L);
  415.   --|
  416.   --|         while ( More(Place) ) loop
  417.   --|               Next(Place, Info);
  418.   --|               process each element of list L;
  419.   --|               end loop;
  420.  
  421.  
  422.   ----------------------------------------------------------------------------
  423.  
  424.   procedure REPLACEHEAD( --| Replace the Item at the head of the list
  425.   --| with the parameter Item.
  426.                         L    : in out LIST;  --| The list being modified.
  427.                         INFO : in ITEMTYPE --| The information being entered.
  428.                         ); 
  429.   --| Raises 
  430.   --| EmptyList
  431.  
  432.   --| Effects
  433.   --| Replaces the information in the first element in the list.  Raises
  434.   --| EmptyList if the list is empty.
  435.  
  436. ------------------------------------------------------------------------------
  437.  
  438.   procedure REPLACETAIL( --| Replace the Tail of a list
  439.   --| with a new list.
  440.                         L       : in out LIST;  --| List whose Tail is replaced.
  441.                         NEWTAIL : in LIST --| The list which will become the
  442.                         --| tail of Oldlist.
  443.                         ); 
  444.   --| Raises
  445.   --| EmptyList
  446.   --|
  447.   --| Effects
  448.   --| Replaces the tail of a list with a new list.  If the list whose tail
  449.   --| is being replaced is null EmptyList is raised.
  450.  
  451. -------------------------------------------------------------------------------
  452.  
  453.   function TAIL( --| returns the tail of a list L
  454.                 L : in LIST --| the list whose tail is being returned
  455.                 ) return LIST; 
  456.  
  457.   --| Raises
  458.   --| EmptyList
  459.   --|
  460.   --| Effects
  461.   --| Returns a list which is the tail of the list L.  Raises EmptyList if
  462.   --| L is empty.  If L only has one element then Tail returns the Empty
  463.   --| list.
  464.  
  465. ------------------------------------------------------------------------------
  466.  
  467.   function EQUAL( --| compares list1 and list2 for equality
  468.                  LIST1 : in LIST;  --| first list
  469.                  LIST2 : in LIST --| second list
  470.                  ) return BOOLEAN; 
  471.  
  472.   --| Effects
  473.   --| Returns true if for all elements of List1 the corresponding element
  474.   --| of List2 has the same value.  This function uses the Equal operation
  475.   --| provided by the user.  If one is not provided then = is used.
  476.  
  477. ------------------------------------------------------------------------------
  478. private
  479.   type CELL; 
  480.  
  481.   type LIST is access CELL;  --| pointer added by this package
  482.   --| in order to make a list
  483.  
  484.  
  485.   type CELL is  --| Cell for the lists being created
  486.     record
  487.       INFO : ITEMTYPE; 
  488.       NEXT : LIST; 
  489.     end record; 
  490.  
  491.  
  492.   type LISTITER is new LIST;  --| This prevents Lists being assigned to
  493.   --| iterators and vice versa
  494.  
  495. end LISTS; 
  496. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  497. --lists.bdy
  498. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  499.  
  500. with UNCHECKED_DEALLOCATION; 
  501.  
  502. package body LISTS is 
  503.  
  504.   procedure FREE is 
  505.     new UNCHECKED_DEALLOCATION(CELL, LIST); 
  506.  
  507.     --------------------------------------------------------------------------
  508.  
  509.   function LAST(L : in LIST) return LIST is 
  510.  
  511.     PLACE_IN_L      : LIST; 
  512.     TEMP_PLACE_IN_L : LIST; 
  513.  
  514.     --|  Link down the list L and return the pointer to the last element
  515.     --| of L.  If L is null raise the EmptyList exception.
  516.  
  517.   begin
  518.     if L = null then 
  519.       raise EMPTYLIST; 
  520.     else 
  521.  
  522.       --|  Link down L saving the pointer to the previous element in 
  523.       --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  524.       --|  points to the last element in the list.
  525.       PLACE_IN_L := L; 
  526.       while PLACE_IN_L /= null loop
  527.         TEMP_PLACE_IN_L := PLACE_IN_L; 
  528.         PLACE_IN_L := PLACE_IN_L.NEXT; 
  529.       end loop; 
  530.       return TEMP_PLACE_IN_L; 
  531.     end if; 
  532.   end LAST; 
  533.  
  534.  
  535.   --------------------------------------------------------------------------
  536.  
  537.   procedure ATTACH(LIST1 : in out LIST; 
  538.                    LIST2 : in LIST) is 
  539.     ENDOFLIST1 : LIST; 
  540.  
  541.     --| Attach List2 to List1. 
  542.     --| If List1 is null return List2
  543.     --| If List1 equals List2 then raise CircularList
  544.     --| Otherwise get the pointer to the last element of List1 and change
  545.     --| its Next field to be List2.
  546.  
  547.   begin
  548.     if LIST1 = null then 
  549.       LIST1 := LIST2; 
  550.       return; 
  551.     elsif LIST1 = LIST2 then 
  552.       raise CIRCULARLIST; 
  553.     else 
  554.       ENDOFLIST1 := LAST(LIST1); 
  555.       ENDOFLIST1.NEXT := LIST2; 
  556.     end if; 
  557.   end ATTACH; 
  558.  
  559.   --------------------------------------------------------------------------
  560.  
  561.   procedure ATTACH(L       : in out LIST; 
  562.                    ELEMENT : in ITEMTYPE) is 
  563.  
  564.     NEWEND : LIST; 
  565.  
  566.     --| Create a list containing Element and attach it to the end of L
  567.  
  568.   begin
  569.     NEWEND := new CELL'(INFO => ELEMENT, NEXT => null); 
  570.     ATTACH(L, NEWEND); 
  571.   end ATTACH; 
  572.  
  573.   --------------------------------------------------------------------------
  574.  
  575.   function ATTACH(ELEMENT1 : in ITEMTYPE; 
  576.                   ELEMENT2 : in ITEMTYPE) return LIST is 
  577.     NEWLIST : LIST; 
  578.  
  579.     --| Create a new list containing the information in Element1 and
  580.     --| attach Element2 to that list.
  581.  
  582.   begin
  583.     NEWLIST := new CELL'(INFO => ELEMENT1, NEXT => null); 
  584.     ATTACH(NEWLIST, ELEMENT2); 
  585.     return NEWLIST; 
  586.   end ATTACH; 
  587.  
  588.   --------------------------------------------------------------------------
  589.  
  590.   procedure ATTACH(ELEMENT : in ITEMTYPE; 
  591.                    L       : in out LIST) is 
  592.  
  593.   --|  Create a new cell whose information is Element and whose Next
  594.   --|  field is the list L.  This prepends Element to the List L.
  595.  
  596.   begin
  597.     L := new CELL'(INFO => ELEMENT, NEXT => L); 
  598.   end ATTACH; 
  599.  
  600.   --------------------------------------------------------------------------
  601.  
  602.   function ATTACH(LIST1 : in LIST; 
  603.                   LIST2 : in LIST) return LIST is 
  604.  
  605.     LAST_OF_LIST1 : LIST; 
  606.  
  607.   begin
  608.     if LIST1 = null then 
  609.       return LIST2; 
  610.     elsif LIST1 = LIST2 then 
  611.       raise CIRCULARLIST; 
  612.     else 
  613.       LAST_OF_LIST1 := LAST(LIST1); 
  614.       LAST_OF_LIST1.NEXT := LIST2; 
  615.       return LIST1; 
  616.     end if; 
  617.   end ATTACH; 
  618.  
  619.   -------------------------------------------------------------------------
  620.  
  621.   function ATTACH(L       : in LIST; 
  622.                   ELEMENT : in ITEMTYPE) return LIST is 
  623.  
  624.     NEWEND    : LIST; 
  625.     LAST_OF_L : LIST; 
  626.  
  627.     --| Create a list called NewEnd and attach it to the end of L.
  628.     --| If L is null return NewEnd 
  629.     --| Otherwise get the last element in L and make its Next field
  630.     --| NewEnd.
  631.  
  632.   begin
  633.     NEWEND := new CELL'(INFO => ELEMENT, NEXT => null); 
  634.     if L = null then 
  635.       return NEWEND; 
  636.     else 
  637.       LAST_OF_L := LAST(L); 
  638.       LAST_OF_L.NEXT := NEWEND; 
  639.       return L; 
  640.     end if; 
  641.   end ATTACH; 
  642.  
  643.   --------------------------------------------------------------------------
  644.  
  645.   function ATTACH(ELEMENT : in ITEMTYPE; 
  646.                   L       : in LIST) return LIST is 
  647.  
  648.   begin
  649.     return (new CELL'(INFO => ELEMENT, NEXT => L)); 
  650.   end ATTACH; 
  651.  
  652.   --------------------------------------------------------------------------
  653.  
  654.   function COPY(L : in LIST) return LIST is 
  655.  
  656.   --| If L is null return null
  657.   --| Otherwise recursively copy the list by first copying the information
  658.   --| at the head of the list and then making the Next field point to 
  659.   --| a copy of the tail of the list.
  660.  
  661.   begin
  662.     if L = null then 
  663.       return null; 
  664.     else 
  665.       return new CELL'(INFO => L.INFO, NEXT => COPY(L.NEXT)); 
  666.     end if; 
  667.   end COPY; 
  668.  
  669.  
  670.   --------------------------------------------------------------------------
  671.  
  672.   function COPYDEEP(L : in LIST) return LIST is 
  673.  
  674.   --|  If L is null then return null.
  675.   --|  Otherwise copy the first element of the list into the head of the
  676.   --|  new list and copy the tail of the list recursively using CopyDeep.
  677.  
  678.   begin
  679.     if L = null then 
  680.       return null; 
  681.     else 
  682.       return new CELL'(INFO => COPY(L.INFO), NEXT => COPYDEEP(L.NEXT)); 
  683.     end if; 
  684.   end COPYDEEP; 
  685.  
  686.   --------------------------------------------------------------------------
  687.  
  688.   function CREATE return LIST is 
  689.  
  690.   --| Return the empty list.
  691.  
  692.   begin
  693.     return null; 
  694.   end CREATE; 
  695.  
  696.   --------------------------------------------------------------------------
  697.   procedure DELETEHEAD(L : in out LIST) is 
  698.  
  699.     TEMPLIST : LIST; 
  700.  
  701.     --| Remove the element of the head of the list and return it to the heap.
  702.     --| If L is null EmptyList.
  703.     --| Otherwise save the Next field of the first element, remove the first
  704.     --| element and then assign to L the Next field of the first element.
  705.  
  706.   begin
  707.     if L = null then 
  708.       raise EMPTYLIST; 
  709.     else 
  710.       TEMPLIST := L.NEXT; 
  711.       FREE(L); 
  712.       L := TEMPLIST; 
  713.     end if; 
  714.   end DELETEHEAD; 
  715.  
  716.   --------------------------------------------------------------------------
  717.  
  718.   procedure DELETEITEM(L       : in out LIST; 
  719.                        ELEMENT : in ITEMTYPE) is 
  720.  
  721.     TEMP_L : LIST; 
  722.  
  723.     --| Remove the first element in the list with the value Element.
  724.     --| If the first element of the list is equal to element then
  725.     --| remove it.  Otherwise, recurse on the tail of the list.
  726.  
  727.   begin
  728.     if EQUAL(L.INFO, ELEMENT) then 
  729.       DELETEHEAD(L); 
  730.     else 
  731.       DELETEITEM(L.NEXT, ELEMENT); 
  732.     end if; 
  733.   exception
  734.     when CONSTRAINT_ERROR => 
  735.       raise ITEMNOTPRESENT; 
  736.   end DELETEITEM; 
  737.  
  738.   --------------------------------------------------------------------------
  739.  
  740.   procedure DELETEITEMS(L       : in out LIST; 
  741.                         ELEMENT : in ITEMTYPE) is 
  742.  
  743.     PLACE_IN_L      : LIST;  --| Current place in L.
  744.     LAST_PLACE_IN_L : LIST;  --| Last place in L.
  745.     TEMP_PLACE_IN_L : LIST;  --| Holds a place in L to be removed.
  746.     FOUND           : BOOLEAN := FALSE;  --| Indicates if an element with
  747.     --| the correct value was found. 
  748.  
  749.     --| Walk over the list removing all elements with the value Element.
  750.  
  751.   begin
  752.     PLACE_IN_L := L; 
  753.     LAST_PLACE_IN_L := null; 
  754.     while (PLACE_IN_L /= null) loop
  755.  
  756.       --| Found an element equal to Element
  757.       if EQUAL(PLACE_IN_L.INFO, ELEMENT) then 
  758.         FOUND := TRUE; 
  759.  
  760.         --| If Last_Place_In_L is null then we are at first element
  761.         --| in L.
  762.         if LAST_PLACE_IN_L = null then 
  763.           TEMP_PLACE_IN_L := PLACE_IN_L; 
  764.           L := PLACE_IN_L.NEXT; 
  765.         else 
  766.           TEMP_PLACE_IN_L := PLACE_IN_L; 
  767.  
  768.           --| Relink the list Last's Next gets Place's Next
  769.           LAST_PLACE_IN_L.NEXT := PLACE_IN_L.NEXT; 
  770.         end if; 
  771.  
  772.         --| Move Place_In_L to the next position in the list.
  773.         --| Free the element.
  774.         --| Do not update the last element in the list it remains the
  775.         --| same. 
  776.         PLACE_IN_L := PLACE_IN_L.NEXT; 
  777.         FREE(TEMP_PLACE_IN_L); 
  778.       else 
  779.  
  780.         --| Update the last place in L and the place in L.
  781.         LAST_PLACE_IN_L := PLACE_IN_L; 
  782.         PLACE_IN_L := PLACE_IN_L.NEXT; 
  783.       end if; 
  784.     end loop; 
  785.  
  786.     --| If we have not found an element raise an exception.
  787.     if not FOUND then 
  788.       raise ITEMNOTPRESENT; 
  789.     end if; 
  790.  
  791.   end DELETEITEMS; 
  792.  
  793.   --------------------------------------------------------------------------
  794.  
  795.   procedure DESTROY(L : in out LIST) is 
  796.  
  797.     PLACE_IN_L : LIST; 
  798.     HOLDPLACE  : LIST; 
  799.  
  800.     --| Walk down the list removing all the elements and set the list to
  801.     --| the empty list. 
  802.  
  803.   begin
  804.     PLACE_IN_L := L; 
  805.     while PLACE_IN_L /= null loop
  806.       HOLDPLACE := PLACE_IN_L; 
  807.       PLACE_IN_L := PLACE_IN_L.NEXT; 
  808.       FREE(HOLDPLACE); 
  809.     end loop; 
  810.     L := null; 
  811.   end DESTROY; 
  812.  
  813.   --------------------------------------------------------------------------
  814.  
  815.   function FIRSTVALUE(L : in LIST) return ITEMTYPE is 
  816.  
  817.   --| Return the first value in the list.
  818.  
  819.   begin
  820.     if L = null then 
  821.       raise EMPTYLIST; 
  822.     else 
  823.       return (L.INFO); 
  824.     end if; 
  825.   end FIRSTVALUE; 
  826.  
  827.   --------------------------------------------------------------------------
  828.  
  829.   procedure FORWORD(I : in out LISTITER) is 
  830.  
  831.   --| Return the pointer to the next member of the list.
  832.  
  833.   begin
  834.     I := LISTITER(I.NEXT); 
  835.   end FORWORD; 
  836.  
  837.   --------------------------------------------------------------------------
  838.  
  839.   function ISINLIST(L       : in LIST; 
  840.                     ELEMENT : in ITEMTYPE) return BOOLEAN is 
  841.  
  842.     PLACE_IN_L : LIST; 
  843.  
  844.     --| Check if Element is in L.  If it is return true otherwise return false.
  845.  
  846.   begin
  847.     PLACE_IN_L := L; 
  848.     while PLACE_IN_L /= null loop
  849.       if EQUAL(PLACE_IN_L.INFO, ELEMENT) then 
  850.         return TRUE; 
  851.       end if; 
  852.       PLACE_IN_L := PLACE_IN_L.NEXT; 
  853.     end loop; 
  854.     return FALSE; 
  855.   end ISINLIST; 
  856.  
  857.   --------------------------------------------------------------------------
  858.  
  859.   function ISEMPTY(L : in LIST) return BOOLEAN is 
  860.  
  861.   --| Is the list L empty.
  862.  
  863.   begin
  864.     return (L = null); 
  865.   end ISEMPTY; 
  866.  
  867.   --------------------------------------------------------------------------
  868.  
  869.   function LASTVALUE(L : in LIST) return ITEMTYPE is 
  870.  
  871.     LASTELEMENT : LIST; 
  872.  
  873.     --| Return the value of the last element of the list. Get the pointer
  874.     --| to the last element of L and then return its information.
  875.  
  876.   begin
  877.     LASTELEMENT := LAST(L); 
  878.     return LASTELEMENT.INFO; 
  879.   end LASTVALUE; 
  880.  
  881.   --------------------------------------------------------------------------
  882.  
  883.   function LENGTH(L : in LIST) return INTEGER is 
  884.  
  885.   --| Recursively compute the length of L.  The length of a list is
  886.   --| 0 if it is null or  1 + the length of the tail.
  887.  
  888.   begin
  889.     if L = null then 
  890.       return (0); 
  891.     else 
  892.       return (1 + LENGTH(TAIL(L))); 
  893.     end if; 
  894.   end LENGTH; 
  895.  
  896.   --------------------------------------------------------------------------
  897.  
  898.   function MAKELISTITER(L : in LIST) return LISTITER is 
  899.  
  900.   --| Start an iteration operation on the list L.  Do a type conversion
  901.   --| from List to ListIter.
  902.  
  903.   begin
  904.     return LISTITER(L); 
  905.   end MAKELISTITER; 
  906.  
  907.   --------------------------------------------------------------------------
  908.  
  909.   function MORE(L : in LISTITER) return BOOLEAN is 
  910.  
  911.   --| This is a test to see whether an iteration is complete.
  912.  
  913.   begin
  914.     return L /= null; 
  915.   end MORE; 
  916.  
  917.   --------------------------------------------------------------------------
  918.  
  919.   procedure NEXT(PLACE : in out LISTITER; 
  920.                  INFO  : out ITEMTYPE) is 
  921.     PLACEINLIST : LIST; 
  922.  
  923.     --| This procedure gets the information at the current place in the List
  924.     --| and moves the ListIter to the next postion in the list.
  925.     --| If we are at the end of a list then exception NoMore is raised.
  926.  
  927.   begin
  928.     if PLACE = null then 
  929.       raise NOMORE; 
  930.     else 
  931.       PLACEINLIST := LIST(PLACE); 
  932.       INFO := PLACEINLIST.INFO; 
  933.       PLACE := LISTITER(PLACEINLIST.NEXT); 
  934.     end if; 
  935.   end NEXT; 
  936.  
  937.   --------------------------------------------------------------------------
  938.  
  939.   procedure REPLACEHEAD(L    : in out LIST; 
  940.                         INFO : in ITEMTYPE) is 
  941.  
  942.   --| This procedure replaces the information at the head of a list
  943.   --| with the given information. If the list is empty the exception
  944.   --| EmptyList is raised.
  945.  
  946.   begin
  947.     if L = null then 
  948.       raise EMPTYLIST; 
  949.     else 
  950.       L.INFO := INFO; 
  951.     end if; 
  952.   end REPLACEHEAD; 
  953.  
  954.   --------------------------------------------------------------------------
  955.  
  956.   procedure REPLACETAIL(L       : in out LIST; 
  957.                         NEWTAIL : in LIST) is 
  958.     TEMP_L : LIST; 
  959.  
  960.     --| This destroys the tail of a list and replaces the tail with
  961.     --| NewTail.  If L is empty EmptyList is raised.
  962.  
  963.   begin
  964.     DESTROY(L.NEXT); 
  965.     L.NEXT := NEWTAIL; 
  966.   exception
  967.     when CONSTRAINT_ERROR => 
  968.       raise EMPTYLIST; 
  969.   end REPLACETAIL; 
  970.  
  971.   --------------------------------------------------------------------------
  972.  
  973.   function TAIL(L : in LIST) return LIST is 
  974.  
  975.   --| This returns the list which is the tail of L.  If L is null Empty
  976.   --| List is raised.
  977.  
  978.   begin
  979.     if L = null then 
  980.       raise EMPTYLIST; 
  981.     else 
  982.       return L.NEXT; 
  983.     end if; 
  984.   end TAIL; 
  985.  
  986.   --------------------------------------------------------------------------
  987.   function EQUAL(LIST1 : in LIST; 
  988.                  LIST2 : in LIST) return BOOLEAN is 
  989.  
  990.     PLACEINLIST1 : LIST; 
  991.     PLACEINLIST2 : LIST; 
  992.     CONTENTS1    : ITEMTYPE; 
  993.     CONTENTS2    : ITEMTYPE; 
  994.  
  995.     --| This function tests to see if two lists are equal.  Two lists
  996.     --| are equal if for all the elements of List1 the corresponding
  997.     --| element of List2 has the same value.  Thus if the 1st elements
  998.     --| are equal and the second elements are equal and so up to n.
  999.     --|  Thus a necessary condition for two lists to be equal is that
  1000.     --| they have the same number of elements.
  1001.  
  1002.     --| This function walks over the two list and checks that the
  1003.     --| corresponding elements are equal.  As soon as we reach 
  1004.     --| the end of a list (PlaceInList = null) we fall out of the loop.
  1005.     --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  1006.     --| then the lists are equal.  If they both are not null the lists aren't 
  1007.     --| equal.  Note that equality on elements is based on a user supplied
  1008.     --| function Equal which is used to test for item equality.
  1009.  
  1010.   begin
  1011.     PLACEINLIST1 := LIST1; 
  1012.     PLACEINLIST2 := LIST2; 
  1013.     while (PLACEINLIST1 /= null) and (PLACEINLIST2 /= null) loop
  1014.       if not EQUAL(PLACEINLIST1.INFO, PLACEINLIST2.INFO) then 
  1015.         return FALSE; 
  1016.       end if; 
  1017.       PLACEINLIST1 := PLACEINLIST1.NEXT; 
  1018.       PLACEINLIST2 := PLACEINLIST2.NEXT; 
  1019.     end loop; 
  1020.     return ((PLACEINLIST1 = null) and (PLACEINLIST2 = null)); 
  1021.   end EQUAL; 
  1022. end LISTS; 
  1023.  
  1024. --------------------------------------------------------------------------
  1025. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1026. --stack.spc
  1027. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1028.  
  1029. with LISTS;  --| Implementation uses lists.  (private)
  1030.  
  1031. generic
  1032.   type ELEM_TYPE is private;  --| Component element type.
  1033.  
  1034. package STACK_PKG is 
  1035.  
  1036. --| Overview:
  1037. --| This package provides the stack abstract data type.  Element type is
  1038. --| a generic formal parameter to the package.  There are no explicit
  1039. --| bounds on the number of objects that can be pushed onto a given stack.
  1040. --| All standard stack operations are provided.
  1041. --|
  1042. --| The following is a complete list of operations, written in the order
  1043. --| in which they appear in the spec.  Overloaded subprograms are followed
  1044. --| by (n), where n is the number of subprograms of that name.
  1045. --|
  1046. --| Constructors:
  1047. --|        create 
  1048. --|        push
  1049. --|        pop (2)
  1050. --|        copy
  1051. --| Query Operations:
  1052. --|        top
  1053. --|        size
  1054. --|        is_empty
  1055. --| Heap Management: 
  1056. --|        destroy
  1057.  
  1058.  
  1059. --| Notes:
  1060. --| Programmer: Ron Kownacki
  1061.  
  1062.   type STACK is private;  --| The stack abstract data type.
  1063.  
  1064.   -- Exceptions:
  1065.  
  1066.   UNINITIALIZED_STACK : exception; 
  1067.   --| Raised on attempt to manipulate an uninitialized stack object.
  1068.   --| The initialization operations are create and copy.
  1069.  
  1070.   EMPTY_STACK         : exception; 
  1071.   --| Raised by some operations when empty.
  1072.  
  1073.  
  1074.   -- Constructors:
  1075.  
  1076.   function CREATE return STACK; 
  1077.  
  1078.   --| Effects:
  1079.   --| Return the empty stack.
  1080.  
  1081.   procedure PUSH(S : in out STACK; 
  1082.                  E : in ELEM_TYPE); 
  1083.  
  1084.   --| Raises: uninitialized_stack
  1085.   --| Effects:
  1086.   --| Push e onto the top of s.
  1087.   --| Raises uninitialized_stack iff s has not been initialized.
  1088.  
  1089.   procedure POP(S : in out STACK); 
  1090.  
  1091.   --| Raises: empty_stack, uninitialized_stack
  1092.   --| Effects:
  1093.   --| Pops the top element from s, and throws it away.
  1094.   --| Raises empty_stack iff s is empty.
  1095.   --| Raises uninitialized_stack iff s has not been initialized.
  1096.  
  1097.   procedure POP(S : in out STACK; 
  1098.                 E : out ELEM_TYPE); 
  1099.  
  1100.   --| Raises: empty_stack, uninitialized_stack
  1101.   --| Effects:
  1102.   --| Pops the top element from s, returns it as the e parameter.
  1103.   --| Raises empty_stack iff s is empty.
  1104.   --| Raises uninitialized_stack iff s has not been initialized.
  1105.  
  1106.   function COPY(S : in STACK) return STACK; 
  1107.  
  1108.   --| Raises: uninitialized_stack
  1109.   --| Return a copy of s.
  1110.   --| Stack assignment and passing stacks as subprogram parameters
  1111.   --| result in the sharing of a single stack value by two stack
  1112.   --| objects; changes to one will be visible through the others.
  1113.   --| copy can be used to prevent this sharing.
  1114.   --| Raises uninitialized_stack iff s has not been initialized.
  1115.  
  1116.  
  1117.   -- Queries:
  1118.  
  1119.   function TOP(S : in STACK) return ELEM_TYPE; 
  1120.  
  1121.   --| Raises: empty_stack, uninitialized_stack
  1122.   --| Effects:
  1123.   --| Return the element on the top of s.  Raises empty_stack iff s is
  1124.   --| empty.
  1125.   --| Raises uninitialized_stack iff s has not been initialized.
  1126.  
  1127.   function SIZE(S : in STACK) return NATURAL; 
  1128.  
  1129.   --| Raises: uninitialized_stack
  1130.   --| Effects:
  1131.   --| Return the current number of elements in s.
  1132.   --| Raises uninitialized_stack iff s has not been initialized.
  1133.  
  1134.   function IS_EMPTY(S : in STACK) return BOOLEAN; 
  1135.  
  1136.   --| Raises: uninitialized_stack
  1137.   --| Effects:
  1138.   --| Return true iff s is empty.
  1139.   --| Raises uninitialized_stack iff s has not been initialized.
  1140.  
  1141.  
  1142.   -- Heap Management:
  1143.  
  1144.   procedure DESTROY(S : in out STACK); 
  1145.  
  1146.   --| Effects:
  1147.   --| Return the space consumed by s to the heap.  No effect if s is
  1148.   --| uninitialized.  In any case, leaves s in uninitialized state.
  1149.  
  1150.  
  1151. private
  1152.  
  1153.   package ELEM_LIST_PKG is 
  1154.     new LISTS(ELEM_TYPE); 
  1155.   subtype ELEM_LIST is ELEM_LIST_PKG.LIST; 
  1156.  
  1157.   type STACK_REC is 
  1158.     record
  1159.       SIZE : NATURAL := 0; 
  1160.       ELTS : ELEM_LIST := ELEM_LIST_PKG.CREATE; 
  1161.     end record; 
  1162.  
  1163.   type STACK is access STACK_REC; 
  1164.  
  1165.   --| Let an instance of the representation type, r, be denoted by the
  1166.   --| pair, <size, elts>.  Dot selection is used to refer to these
  1167.   --| components.
  1168.   --|
  1169.   --| Representation Invariants:
  1170.   --|     r /= null
  1171.   --|     elem_list_pkg.length(r.elts) = r.size.
  1172.   --|
  1173.   --| Abstraction Function:
  1174.   --|     A(<size, elem_list_pkg.create>) = stack_pkg.create.
  1175.   --|     A(<size, elem_list_pkg.attach(e, l)>) = push(A(<size, l>), e).
  1176.  
  1177. end STACK_PKG; 
  1178. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1179. --stack.bdy
  1180. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1181.  
  1182. with UNCHECKED_DEALLOCATION; 
  1183.  
  1184. package body STACK_PKG is 
  1185.  
  1186. --| Overview:
  1187. --| Implementation scheme is totally described by the statements of the
  1188. --| representation invariants and abstraction function that appears in
  1189. --| the package specification.  The implementation is so trivial that
  1190. --| further documentation is unnecessary.
  1191.  
  1192.   use ELEM_LIST_PKG; 
  1193.  
  1194.  
  1195.   -- Constructors:
  1196.  
  1197.   function CREATE return STACK is 
  1198.   begin
  1199.     return new STACK_REC'(SIZE => 0, ELTS => CREATE); 
  1200.   end CREATE; 
  1201.  
  1202.   procedure PUSH(S : in out STACK; 
  1203.                  E : in ELEM_TYPE) is 
  1204.   begin
  1205.     S.SIZE := S.SIZE + 1; 
  1206.     S.ELTS := ATTACH(E, S.ELTS); 
  1207.   exception
  1208.     when CONSTRAINT_ERROR => 
  1209.       raise UNINITIALIZED_STACK; 
  1210.   end PUSH; 
  1211.  
  1212.   procedure POP(S : in out STACK) is 
  1213.   begin
  1214.     DELETEHEAD(S.ELTS); 
  1215.     S.SIZE := S.SIZE - 1; 
  1216.   exception
  1217.     when EMPTYLIST => 
  1218.       raise EMPTY_STACK; 
  1219.     when CONSTRAINT_ERROR => 
  1220.       raise UNINITIALIZED_STACK; 
  1221.   end POP; 
  1222.  
  1223.   procedure POP(S : in out STACK; 
  1224.                 E : out ELEM_TYPE) is 
  1225.   begin
  1226.     E := FIRSTVALUE(S.ELTS); 
  1227.     DELETEHEAD(S.ELTS); 
  1228.     S.SIZE := S.SIZE - 1; 
  1229.   exception
  1230.     when EMPTYLIST => 
  1231.       raise EMPTY_STACK; 
  1232.     when CONSTRAINT_ERROR => 
  1233.       raise UNINITIALIZED_STACK; 
  1234.   end POP; 
  1235.  
  1236.   function COPY(S : in STACK) return STACK is 
  1237.   begin
  1238.     if S = null then 
  1239.       raise UNINITIALIZED_STACK; 
  1240.     end if; 
  1241.  
  1242.     return new STACK_REC'(SIZE => S.SIZE, ELTS => COPY(S.ELTS)); 
  1243.   end COPY; 
  1244.  
  1245.  
  1246.   -- Queries:
  1247.  
  1248.   function TOP(S : in STACK) return ELEM_TYPE is 
  1249.   begin
  1250.     return FIRSTVALUE(S.ELTS); 
  1251.   exception
  1252.     when EMPTYLIST => 
  1253.       raise EMPTY_STACK; 
  1254.     when CONSTRAINT_ERROR => 
  1255.       raise UNINITIALIZED_STACK; 
  1256.   end TOP; 
  1257.  
  1258.   function SIZE(S : in STACK) return NATURAL is 
  1259.   begin
  1260.     return S.SIZE; 
  1261.   exception
  1262.     when CONSTRAINT_ERROR => 
  1263.       raise UNINITIALIZED_STACK; 
  1264.   end SIZE; 
  1265.  
  1266.   function IS_EMPTY(S : in STACK) return BOOLEAN is 
  1267.   begin
  1268.     return S.SIZE = 0; 
  1269.   exception
  1270.     when CONSTRAINT_ERROR => 
  1271.       raise UNINITIALIZED_STACK; 
  1272.   end IS_EMPTY; 
  1273.  
  1274.  
  1275.   -- Heap Management:
  1276.  
  1277.   procedure DESTROY(S : in out STACK) is 
  1278.     procedure FREE_STACK is 
  1279.       new UNCHECKED_DEALLOCATION(STACK_REC, STACK); 
  1280.   begin
  1281.     DESTROY(S.ELTS); 
  1282.     FREE_STACK(S); 
  1283.   exception
  1284.     when CONSTRAINT_ERROR => 
  1285.  
  1286.       -- stack is null
  1287.       return; 
  1288.   end DESTROY; 
  1289.  
  1290. end STACK_PKG; 
  1291. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1292. --string.spc
  1293. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1294.  
  1295. package STRING_PKG is 
  1296.  
  1297. --| Overview:
  1298. --| Package string_pkg exports an abstract data type, string_type.  A
  1299. --| string_type value is a sequence of characters.  The values have arbitrary
  1300. --| length.  For a value, s, with length, l, the individual characters are
  1301. --| numbered from 1 to l.  These values are immutable; characters cannot be
  1302. --| replaced or appended in a destructive fashion.  
  1303. --|
  1304. --| In the documentation for this package, we are careful to distinguish 
  1305. --| between string_type objects, which are Ada objects in the usual sense, 
  1306. --| and string_type values, the members of this data abstraction as described
  1307. --| above.  A string_type value is said to be associated with, or bound to,
  1308. --| a string_type object after an assignment (:=) operation.  
  1309. --| 
  1310. --| The operations provided in this package fall into three categories: 
  1311. --|
  1312. --| 1. Constructors:  These functions typically take one or more string_type
  1313. --|      objects as arguments.  They work with the values associated with 
  1314. --|      these objects, and return new string_type values according to 
  1315. --|      specification.  By a slight abuse of language, we will sometimes 
  1316. --|      coerce from string_type objects to values for ease in description.
  1317. --|
  1318. --| 2. Heap Management:   
  1319. --|      These operations (make_persistent, flush, mark, release) control the
  1320. --|      management of heap space.  Because string_type values are
  1321. --|      allocated on the heap, and the type is not limited, it is necessary
  1322. --|      for a user to assume some responsibility for garbage collection.  
  1323. --|      String_type is not limited because of the convenience of
  1324. --|      the assignment operation, and the usefulness of being able to 
  1325. --|      instantiate generic units that contain private type formals.  
  1326. --|      ** Important: To use this package properly, it is necessary to read
  1327. --|      the descriptions of the operations in this section.
  1328. --|
  1329. --| 3. Queries:  These functions return information about the values 
  1330. --|      that are associated with the argument objects.  The same conventions 
  1331. --|      for description of operations used in (1) is adopted.
  1332. --| 
  1333. --| A note about design decisions...  The decision to not make the type 
  1334. --| limited causes two operations to be carried over from the representation.
  1335. --| These are the assignment operation, :=, and the "equality" operator, "=".
  1336. --| See the discussion at the beginning of the Heap Management section for a 
  1337. --| discussion of :=.
  1338. --| See the spec for the first of the equal functions for a discussion of "=".
  1339. --| 
  1340. --| The following is a complete list of operations, written in the order
  1341. --| in which they appear in the spec.  Overloaded subprograms are followed
  1342. --| by (n), where n is the number of subprograms of that name.
  1343. --|
  1344. --| 1. Constructors:
  1345. --|        create
  1346. --|        "&" (3)
  1347. --|        substr
  1348. --|        splice
  1349. --|        insert (3)
  1350. --|        lower (2) 
  1351. --|        upper (2)
  1352. --| 2. Heap Management:
  1353. --|        make_persistent (2)
  1354. --|        flush
  1355. --|        mark, release
  1356. --| 3. Queries:
  1357. --|        is_empty
  1358. --|        length
  1359. --|        value
  1360. --|        fetch
  1361. --|        equal (3)
  1362. --|        "<" (3), 
  1363. --|       "<=" (3)
  1364. --|        match_c
  1365. --|        match_not_c
  1366. --|        match_s (2)
  1367. --|        match_any (2)
  1368. --|        match_none (2)
  1369.  
  1370. --| Notes:
  1371. --| Programmer: Ron Kownacki
  1372.  
  1373.   type STRING_TYPE is private; 
  1374.  
  1375.   BOUNDS          : exception;  --| Raised on index out of bounds.
  1376.   ANY_EMPTY       : exception;  --| Raised on incorrect use of match_any.
  1377.   ILLEGAL_ALLOC   : exception;  --| Raised by value creating operations.
  1378.   ILLEGAL_DEALLOC : exception;  --| Raised by release.
  1379.  
  1380.  
  1381.   -- Constructors:
  1382.  
  1383.   function CREATE(S : in STRING) return STRING_TYPE; 
  1384.  
  1385.   --| Raises: illegal_alloc
  1386.   --| Effects:
  1387.   --| Return a value consisting of the sequence of characters in s.
  1388.   --| Sometimes useful for array or record aggregates.
  1389.   --| Raises illegal_alloc if string space has been improperly
  1390.   --| released.  (See procedures mark/release.)
  1391.  
  1392.   function "&"(S1, S2 : in STRING_TYPE) return STRING_TYPE; 
  1393.  
  1394.   --| Raises: illegal_alloc
  1395.   --| Effects:
  1396.   --| Return the concatenation of s1 and s2.
  1397.   --| Raises illegal_alloc if string space has been improperly
  1398.   --| released.  (See procedures mark/release.)
  1399.  
  1400.   function "&"(S1 : in STRING_TYPE; 
  1401.                S2 : in STRING) return STRING_TYPE; 
  1402.  
  1403.   --| Raises: illegal_alloc
  1404.   --| Effects:
  1405.   --| Return the concatenation of s1 and create(s2).
  1406.   --| Raises illegal_alloc if string space has been improperly
  1407.   --| released.  (See procedures mark/release.)
  1408.  
  1409.   function "&"(S1 : in STRING; 
  1410.                S2 : in STRING_TYPE) return STRING_TYPE; 
  1411.  
  1412.   --| Raises: illegal_alloc
  1413.   --| Effects:
  1414.   --| Return the concatenation of create(s1) and s2.
  1415.   --| Raises illegal_alloc if string space has been improperly
  1416.   --| released.  (See procedures mark/release.)
  1417.  
  1418.   function SUBSTR(S   : in STRING_TYPE; 
  1419.                   I   : in POSITIVE; 
  1420.                   LEN : in NATURAL) return STRING_TYPE; 
  1421.  
  1422.   --| Raises: bounds, illegal_alloc
  1423.   --| Effects:
  1424.   --| Return the substring, of specified length, that occurs in s at
  1425.   --| position i.  If len = 0, then returns the empty value.  
  1426.   --| Otherwise, raises bounds if either i or (i + len - 1)
  1427.   --| is not in 1..length(s).
  1428.   --| Raises illegal_alloc if string space has been improperly
  1429.   --| released.  (See procedures mark/release.)
  1430.  
  1431.   function SPLICE(S   : in STRING_TYPE; 
  1432.                   I   : in POSITIVE; 
  1433.                   LEN : in NATURAL) return STRING_TYPE; 
  1434.  
  1435.   --| Raises: bounds, illegal_alloc
  1436.   --| Effects:
  1437.   --| Let s be the string, abc, where a, b and c are substrings.  If
  1438.   --| substr(s, i, length(b)) = b, for some i in 1..length(s), then
  1439.   --| splice(s, i, length(b)) = ac.  
  1440.   --| Returns a value equal to s if len = 0.  Otherwise, raises bounds if
  1441.   --| either i or (i + len - 1) is not in 1..length(s).
  1442.   --| Raises illegal_alloc if string space has been improperly
  1443.   --| released.  (See procedures mark/release.)
  1444.  
  1445.   function INSERT(S1, S2 : in STRING_TYPE; 
  1446.                   I      : in POSITIVE) return STRING_TYPE; 
  1447.  
  1448.   --| Raises: bounds, illegal_alloc
  1449.   --| Effects:
  1450.   --| Return substr(s1, 1, i - 1) & s2 &
  1451.   --|        substr(s1, i, length(s1) - i + 1).
  1452.   --| equal(splice(insert(s1, s2, i), i, length(s2)), s1) holds if no
  1453.   --| exception is raised by insert.
  1454.   --| Raises bounds if is_empty(s1) or else i is not in 1..length(s1).
  1455.   --| Raises illegal_alloc if string space has been improperly
  1456.   --| released.  (See procedures mark/release.)
  1457.  
  1458.   function INSERT(S1 : in STRING_TYPE; 
  1459.                   S2 : in STRING; 
  1460.                   I  : in POSITIVE) return STRING_TYPE; 
  1461.  
  1462.   --| Raises: bounds, illegal_alloc
  1463.   --| Effects:
  1464.   --| Return substr(s1, 1, i - 1) & s2 &
  1465.   --|        substr(s1, i, length(s1) - i + 1).
  1466.   --| equal(splice(insert(s1, s2, i), i, length(s2)), s1) holds if no
  1467.   --| exception is raised by insert.
  1468.   --| Raises bounds if is_empty(s1) or else i is not in 1..length(s1).
  1469.   --| Raises illegal_alloc if string space has been improperly
  1470.   --| released.  (See procedures mark/release.)
  1471.  
  1472.   function INSERT(S1 : in STRING; 
  1473.                   S2 : in STRING_TYPE; 
  1474.                   I  : in POSITIVE) return STRING_TYPE; 
  1475.  
  1476.   --| Raises: bounds, illegal_alloc
  1477.   --| Effects:
  1478.   --| Return s1(s1'first..i - 1) & s2 &
  1479.   --|        s1(i..length(s1) - i + 1).
  1480.   --| equal(splice(insert(s1, s2, i), i, length(s2)), s1) holds if no
  1481.   --| exception is raised by insert.
  1482.   --| Raises bounds if i is not in s'range.
  1483.   --| Raises illegal_alloc if string space has been improperly
  1484.   --| released.  (See procedures mark/release.)
  1485.  
  1486.   function LOWER(S : in STRING) return STRING_TYPE; 
  1487.  
  1488.   --| Raises: illegal_alloc
  1489.   --| Effects:
  1490.   --| Return a value that contains exactly those characters in s with
  1491.   --| the exception that all upper case characters are replaced by their 
  1492.   --| lower case counterparts.
  1493.   --| Raises illegal_alloc if string space has been improperly
  1494.   --| released.  (See procedures mark/release.)
  1495.  
  1496.   function LOWER(S : in STRING_TYPE) return STRING_TYPE; 
  1497.  
  1498.   --| Raises: illegal_alloc
  1499.   --| Effects:
  1500.   --| Return a value that is a copy of s with the exception that all
  1501.   --| upper case characters are replaced by their lower case counterparts.
  1502.   --| Raises illegal_alloc if string space has been improperly
  1503.   --| released.  (See procedures mark/release.)
  1504.  
  1505.   function UPPER(S : in STRING) return STRING_TYPE; 
  1506.  
  1507.   --| Raises: illegal_alloc
  1508.   --| Effects:
  1509.   --| Return a value that contains exactly those characters in s with
  1510.   --| the exception that all lower case characters are replaced by their 
  1511.   --| upper case counterparts.
  1512.   --| Raises illegal_alloc if string space has been improperly
  1513.   --| released.  (See procedures mark/release.)
  1514.  
  1515.   function UPPER(S : in STRING_TYPE) return STRING_TYPE; 
  1516.  
  1517.   --| Raises: illegal_alloc
  1518.   --| Effects:
  1519.   --| Return a value that is a copy of s with the exception that all
  1520.   --| lower case characters are replaced by their upper case counterparts.
  1521.   --| Raises illegal_alloc if string space has been improperly
  1522.   --| released.  (See procedures mark/release.)
  1523.  
  1524.  
  1525.   -- Heap Management (including object/value binding):
  1526.   --
  1527. -- Two forms of heap management are provided.  The general scheme is to "mark"
  1528.   -- the current state of heap usage, and to "release" in order to reclaim all
  1529.   -- space that has been used since the last mark.  However, this alone is 
  1530.   -- insufficient because it is frequently desirable for objects to remain 
  1531.   -- associated with values for longer periods of time, and this may come into 
  1532.   -- conflict with the need to clean up after a period of "string hacking."
  1533.   -- To deal with this problem, we introduce the notions of "persistent" and
  1534.   -- "nonpersistent" values.
  1535.   --
  1536.   -- The nonpersistent values are those that are generated by the constructors 
  1537.   -- in the previous section.  These are claimed by the release procedure.
  1538.   -- Persistent values are generated by the two make_persistent functions
  1539. -- described below.  These values must be disposed of individually by means of
  1540.   -- the flush procedure.  
  1541.   --
  1542.   -- This allows a description of the meaning of the ":=" operation.  For a 
  1543.   -- statement of the form, s := expr, where expr is a string_type expression, 
  1544.   -- the result is that the value denoted/created by expr becomes bound to the
  1545.   -- the object, s.  Assignment in no way affects the persistence of the value.
  1546. -- If expr happens to be an object, then the value associated  with it will be
  1547.   -- shared.  Ideally, this sharing would not be visible, since values are
  1548.   -- immutable.  However, the sharing may be visible because of the memory
  1549. -- management, as described below.  Programs which depend on such sharing are 
  1550.   -- erroneous.
  1551.  
  1552.   function MAKE_PERSISTENT(S : in STRING_TYPE) return STRING_TYPE; 
  1553.  
  1554.   --| Effects: 
  1555.   --| Returns a persistent value, v, containing exactly those characters in
  1556.   --| value(s).  The value v will not be claimed by any subsequent release.
  1557.   --| Only an invocation of flush will claim v.  After such a claiming
  1558.   --| invocation of flush, the use (other than :=) of any other object to 
  1559.   --| which v was bound is erroneous, and program_error may be raised for
  1560.   --| such a use.
  1561.  
  1562.   function MAKE_PERSISTENT(S : in STRING) return STRING_TYPE; 
  1563.  
  1564.   --| Effects: 
  1565.   --| Returns a persistent value, v, containing exactly those chars in s.
  1566.   --| The value v will not be claimed by any subsequent release.
  1567.   --| Only an invocation of flush will reclaim v.  After such a claiming
  1568.   --| invocation of flush, the use (other than :=) of any other object to 
  1569.   --| which v was bound is erroneous, and program_error may be raised for
  1570.   --| such a use.
  1571.  
  1572.   procedure FLUSH(S : in out STRING_TYPE); 
  1573.  
  1574.   --| Effects:
  1575.   --| Return heap space used by the value associated with s, if any, to 
  1576.   --| the heap.  s becomes associated with the empty value.  After an
  1577.   --| invocation of flush claims the value, v, then any use (other than :=)
  1578.   --| of an object to which v was bound is erroneous, and program_error 
  1579.   --| may be raised for such a use.
  1580.   --| 
  1581.   --| This operation should be used only for persistent values.  The mark 
  1582.   --| and release operations are used to deallocate space consumed by other
  1583.   --| values.  For example, flushing a nonpersistent value implies that a
  1584.   --| release that tries to claim this value will be erroneous, and
  1585.   --| program_error may be raised for such a use.
  1586.  
  1587.   procedure MARK; 
  1588.  
  1589.   --| Effects:
  1590.   --| Marks the current state of heap usage for use by release.  
  1591.   --| An implicit mark is performed at the beginning of program execution.
  1592.  
  1593.   procedure RELEASE; 
  1594.  
  1595.   --| Raises: illegal_dealloc
  1596.   --| Effects:
  1597.   --| Releases all heap space used by nonpersistent values that have been
  1598.   --| allocated since the last mark.  The values that are claimed include
  1599.   --| those bound to objects as well as those produced and discarded during
  1600.   --| the course of general "string hacking."  If an invocation of release
  1601.   --| claims a value, v, then any subsequent use (other than :=) of any 
  1602.   --| other object to which v is bound is erroneous, and program_error may
  1603.   --| be raised for such a use.
  1604.   --|
  1605.   --| Raises illegal_dealloc if the invocation of release does not balance
  1606.   --| an invocation of mark.  It is permissible to match the implicit
  1607.   --| initial invocation of mark.  However, subsequent invocations of 
  1608.   --| constructors will raise the illegal_alloc exception until an 
  1609.   --| additional mark is performed.  (Anyway, there is no good reason to 
  1610.   --| do this.)  In any case, a number of releases matching the number of
  1611.   --| currently active marks is implicitly performed at the end of program
  1612.   --| execution.
  1613.   --|
  1614.   --| Good citizens generally perform their own marks and releases
  1615.   --| explicitly.  Extensive string hacking without cleaning up will 
  1616.   --| cause your program to run very slowly, since the heap manager will
  1617.   --| be forced to look hard for chunks of space to allocate.
  1618.  
  1619.   -- Queries:
  1620.  
  1621.   function IS_EMPTY(S : in STRING_TYPE) return BOOLEAN; 
  1622.  
  1623.   --| Effects:
  1624.   --| Return true iff s is the empty sequence of characters.
  1625.  
  1626.   function LENGTH(S : in STRING_TYPE) return NATURAL; 
  1627.  
  1628.   --| Effects:
  1629.   --| Return number of characters in s.
  1630.  
  1631.   function VALUE(S : in STRING_TYPE) return STRING; 
  1632.  
  1633.   --| Effects:
  1634.   --| Return a string, s2, that contains the same characters that s
  1635.   --| contains.  The properties, s2'first = 1 and s2'last = length(s),
  1636.   --| are satisfied.  This implies that, for a given string, s3,
  1637.   --| value(create(s3))'first may not equal s3'first, even though
  1638.   --| value(create(s3)) = s3 holds.  Thus, "content equality" applies
  1639.   --| although the string objects may be distinguished by the use of
  1640.   --| the array attributes.
  1641.  
  1642.   function FETCH(S : in STRING_TYPE; 
  1643.                  I : in POSITIVE) return CHARACTER; 
  1644.  
  1645.   --| Raises: bounds
  1646.   --| Effects:
  1647.   --| Return the ith character in s.  Characters are numbered from
  1648.   --| 1 to length(s).  Raises bounds if i not in 1..length(s).
  1649.  
  1650.   function EQUAL(S1, S2 : in STRING_TYPE) return BOOLEAN; 
  1651.  
  1652.   --| Effects:
  1653.   --| Value equality relation; return true iff length(s1) = length(s2) 
  1654.   --| and, for all i in 1..length(s1), fetch(s1, i) = fetch(s2, i).
  1655.   --| The "=" operation is carried over from the representation.
  1656.   --| It allows one to distinguish among the heap addresses of
  1657.   --| string_type values.  Even "equal" values may not be "=", although
  1658.   --| s1 = s2 implies equal(s1, s2).  
  1659.   --| There is no reason to use "=".
  1660.  
  1661.   function EQUAL(S1 : in STRING_TYPE; 
  1662.                  S2 : in STRING) return BOOLEAN; 
  1663.  
  1664.   --| Effects:
  1665.   --| Return equal(s1, create(s2)).
  1666.  
  1667.   function EQUAL(S1 : in STRING; 
  1668.                  S2 : in STRING_TYPE) return BOOLEAN; 
  1669.  
  1670.   --| Effects:
  1671.   --| Return equal(create(s1), s2).
  1672.  
  1673.   function "<"(S1 : in STRING_TYPE; 
  1674.                S2 : in STRING_TYPE) return BOOLEAN; 
  1675.  
  1676.   --| Effects: 
  1677.   --| Lexicographic comparison; return value(s1) < value(s2).
  1678.  
  1679.   function "<"(S1 : in STRING_TYPE; 
  1680.                S2 : in STRING) return BOOLEAN; 
  1681.  
  1682.   --| Effects: 
  1683.   --| Lexicographic comparison; return value(s1) < s2.
  1684.  
  1685.   function "<"(S1 : in STRING; 
  1686.                S2 : in STRING_TYPE) return BOOLEAN; 
  1687.  
  1688.   --| Effects: 
  1689.   --| Lexicographic comparison; return s1 < value(s2).
  1690.  
  1691.   function "<="(S1 : in STRING_TYPE; 
  1692.                 S2 : in STRING_TYPE) return BOOLEAN; 
  1693.  
  1694.   --| Effects: 
  1695.   --| Lexicographic comparison; return value(s1) <= value(s2).
  1696.  
  1697.   function "<="(S1 : in STRING_TYPE; 
  1698.                 S2 : in STRING) return BOOLEAN; 
  1699.  
  1700.   --| Effects: 
  1701.   --| Lexicographic comparison; return value(s1) <= s2.
  1702.  
  1703.   function "<="(S1 : in STRING; 
  1704.                 S2 : in STRING_TYPE) return BOOLEAN; 
  1705.  
  1706.   --| Effects: 
  1707.   --| Lexicographic comparison; return s1 <= value(s2).
  1708.  
  1709.   function MATCH_C(S     : in STRING_TYPE; 
  1710.                    C     : in CHARACTER; 
  1711.                    START : in POSITIVE := 1) return NATURAL; 
  1712.  
  1713.   --| Raises: no_match
  1714.   --| Effects:
  1715.   --| Return the minimum index, i in start..length(s), such that
  1716.   --| fetch(s, i) = c.  Returns 0 if no such i exists, 
  1717.   --| including the case where is_empty(s).
  1718.  
  1719.   function MATCH_NOT_C(S     : in STRING_TYPE; 
  1720.                        C     : in CHARACTER; 
  1721.                        START : in POSITIVE := 1) return NATURAL; 
  1722.  
  1723.   --| Raises: no_match
  1724.   --| Effects:
  1725.   --| Return the minimum index, i in start..length(s), such that
  1726.   --| fetch(s, i) /= c.  Returns 0 if no such i exists,
  1727.   --| including the case where is_empty(s).
  1728.  
  1729.   function MATCH_S(S1, S2 : in STRING_TYPE; 
  1730.                    START  : in POSITIVE := 1) return NATURAL; 
  1731.  
  1732.   --| Raises: no_match.
  1733.   --| Effects:
  1734.   --| Return the minimum index, i, in start..length(s1), such that,
  1735.   --| for all j in 1..length(s2), fetch(s2, j) = fetch(s1, i + j - 1).
  1736.   --| This is the position of the substring, s2, in s1.
  1737.   --| Returns 0 if no such i exists, including the cases
  1738.   --| where is_empty(s1) or is_empty(s2).
  1739.   --| Note that equal(substr(s1, match_s(s1, s2, i), length(s2)), s2)
  1740.   --| holds, providing that match_s does not raise an exception.
  1741.  
  1742.   function MATCH_S(S1    : in STRING_TYPE; 
  1743.                    S2    : in STRING; 
  1744.                    START : in POSITIVE := 1) return NATURAL; 
  1745.  
  1746.   --| Raises: no_match.
  1747.   --| Effects:
  1748.   --| Return the minimum index, i, in start..length(s1), such that,
  1749.   --| for all j in s2'range, s2(j) = fetch(s1, i + j - 1).
  1750.   --| This is the position of the substring, s2, in s1.
  1751.   --| Returns 0 if no such i exists, including the cases
  1752.   --| where is_empty(s1) or s2 = "".
  1753.   --| Note that equal(substr(s1, match_s(s1, s2, i), s2'length), s2)
  1754.   --| holds, providing that match_s does not raise an exception.
  1755.  
  1756.   function MATCH_ANY(S, ANY : in STRING_TYPE; 
  1757.                      START  : in POSITIVE := 1) return NATURAL; 
  1758.  
  1759.   --| Raises: no_match, any_empty
  1760.   --| Effects:
  1761.   --| Return the minimum index, i in start..length(s), such that
  1762.   --| fetch(s, i) = fetch(any, j), for some j in 1..length(any).
  1763.   --| Raises any_empty if is_empty(any).
  1764.   --| Otherwise, returns 0 if no such i exists, including the case
  1765.   --| where is_empty(s).
  1766.  
  1767.  
  1768.   function MATCH_ANY(S     : in STRING_TYPE; 
  1769.                      ANY   : in STRING; 
  1770.                      START : in POSITIVE := 1) return NATURAL; 
  1771.  
  1772.   --| Raises: no_match, any_empty
  1773.   --| Effects:
  1774.   --| Return the minimum index, i, in start..length(s), such that
  1775.   --| fetch(s, i) = any(j), for some j in any'range.
  1776.   --| Raises any_empty if any = "".
  1777.   --| Otherwise, returns 0 if no such i exists, including the case
  1778.   --| where is_empty(s).
  1779.  
  1780.   function MATCH_NONE(S, NONE : in STRING_TYPE; 
  1781.                       START   : in POSITIVE := 1) return NATURAL; 
  1782.  
  1783.   --| Raises: no_match
  1784.   --| Effects:
  1785.   --| Return the minimum index, i in start..length(s), such that
  1786.   --| fetch(s, i) /= fetch(none, j) for each j in 1..length(none).
  1787.   --| If (not is_empty(s)) and is_empty(none), then i is 1.
  1788.   --| Returns 0 if no such i exists, including the case
  1789.   --| where is_empty(s).
  1790.  
  1791.   function MATCH_NONE(S     : in STRING_TYPE; 
  1792.                       NONE  : in STRING; 
  1793.                       START : in POSITIVE := 1) return NATURAL; 
  1794.  
  1795.   --| Raises: no_match.
  1796.   --| Effects:
  1797.   --| Return the minimum index, i in start..length(s), such that
  1798.   --| fetch(s, i) /= none(j) for each j in none'range.
  1799.   --| If not is_empty(s) and none = "", then i is 1.
  1800.   --| Returns 0 if no such i exists, including the case
  1801.   --| where is_empty(s).
  1802.  
  1803.  
  1804. private
  1805.  
  1806.   type STRING_TYPE is access STRING; 
  1807.  
  1808.   --| Abstract data type, string_type, is a constant sequence of chars
  1809.   --| of arbitrary length.  Representation type is access string.
  1810.   --| It is important to distinguish between an object of the rep type
  1811.   --| and its value; for an object, r, val(r) denotes the value.
  1812.   --|
  1813.   --| Representation Invariant:  I: rep --> boolean
  1814.   --| I(r: rep) = (val(r) = null) or else
  1815.   --|             (val(r).all'first = 1 &
  1816.   --|              val(r).all'last >= 0 &
  1817.   --|              (for all r2, val(r) = val(r2) /= null => r is r2))
  1818.   --|
  1819.   --| Abstraction Function:  A: rep --> string_type
  1820.   --| A(r: rep) = if r = null then
  1821.   --|                 the empty sequence
  1822.   --|             elsif r'last = 0 then  
  1823.   --|                 the empty sequence
  1824.   --|             else
  1825.   --|                 the sequence consisting of r(1),...,r(r'last).
  1826.  
  1827. end STRING_PKG; 
  1828. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1829. --string.bdy
  1830. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1831.  
  1832. with UNCHECKED_DEALLOCATION; 
  1833. with LISTS, STACK_PKG; 
  1834.  
  1835. package body STRING_PKG is 
  1836.  
  1837. --| Overview:
  1838. --| The implementation for most operations is fairly straightforward.
  1839. --| The interesting aspects involve the allocation and deallocation of
  1840. --| heap space.  This is done as follows:
  1841. --|
  1842. --|     1. A stack of accesses to lists of string_type values is set up
  1843. --|        so that the top of the stack always refers to a list of values
  1844. --|        that were allocated since the last invocation of mark.
  1845. --|        The stack is called scopes, referring to the dynamic scopes
  1846. --|        defined by the invocations of mark and release.
  1847. --|        There is an implicit invocation of mark when the
  1848. --|        package body is elaborated; this is implemented with an explicit 
  1849. --|        invocation in the package initialization code.
  1850. --|
  1851. --|     2. At each invocation of mark, a pointer to an empty list
  1852. --|        is pushed onto the stack.
  1853. --|
  1854. --|     3. At each invocation of release, all of the values in the
  1855. --|        list referred to by the pointer at the top of the stack are
  1856. --|        returned to the heap.  Then the list, and the pointer to it,
  1857. --|        are returned to the heap.  Finally, the stack is popped.
  1858.  
  1859.   package STRING_LIST_PKG is 
  1860.     new LISTS(STRING_TYPE); 
  1861.   subtype STRING_LIST is STRING_LIST_PKG.LIST; 
  1862.  
  1863.   type STRING_LIST_PTR is access STRING_LIST; 
  1864.  
  1865.   package SCOPE_STACK_PKG is 
  1866.     new STACK_PKG(STRING_LIST_PTR); 
  1867.   subtype SCOPE_STACK is SCOPE_STACK_PKG.STACK; 
  1868.  
  1869.   use STRING_LIST_PKG; 
  1870.   use SCOPE_STACK_PKG; 
  1871.  
  1872.   SCOPES : SCOPE_STACK;  -- See package body overview.
  1873.  
  1874.  
  1875.   -- Utility functions/procedures:
  1876.  
  1877.   function ENTER(S : in STRING_TYPE) return STRING_TYPE; 
  1878.  
  1879.   --| Raises: illegal_alloc
  1880.   --| Effects:
  1881.   --| Stores s, the address of s.all, in current scope list (top(scopes)),
  1882.   --| and returns s.  Useful for functions that create and return new
  1883.   --| string_type values.
  1884.   --| Raises illegal_alloc if the scopes stack is empty.
  1885.  
  1886.   function MATCH_STRING(S1, S2 : in STRING; 
  1887.                         START  : in POSITIVE := 1) return NATURAL; 
  1888.  
  1889.   --| Raises: no_match
  1890.   --| Effects:
  1891.   --| Returns the minimum index, i, in s1'range such that
  1892.   --| s1(i..i + s2'length - 1) = s2.  Returns 0 if no such index.
  1893.   --| Requires:
  1894.   --| s1'first = 1.
  1895.  
  1896.   -- Constructors:
  1897.  
  1898.   function CREATE(S : in STRING) return STRING_TYPE is 
  1899.     subtype CONSTR_STR is STRING(1 .. S'LENGTH); 
  1900.     DEC_S : CONSTR_STR := S; 
  1901.   begin
  1902.     return ENTER(new CONSTR_STR'(DEC_S)); 
  1903.  
  1904.   -- DECada bug; above code (and decl of dec_s) replaces the following: 
  1905.   --        return enter(new constr_str'(s));
  1906.   end CREATE; 
  1907.  
  1908.   function "&"(S1, S2 : in STRING_TYPE) return STRING_TYPE is 
  1909.   begin
  1910.     if IS_EMPTY(S1) then 
  1911.       return ENTER(MAKE_PERSISTENT(S2)); 
  1912.     end if; 
  1913.     if IS_EMPTY(S2) then 
  1914.       return ENTER(MAKE_PERSISTENT(S1)); 
  1915.     end if; 
  1916.     return CREATE(S1.all & S2.all); 
  1917.   end "&"; 
  1918.  
  1919.   function "&"(S1 : in STRING_TYPE; 
  1920.                S2 : in STRING) return STRING_TYPE is 
  1921.   begin
  1922.     if S1 = null then 
  1923.       return CREATE(S2); 
  1924.     end if; 
  1925.     return CREATE(S1.all & S2); 
  1926.   end "&"; 
  1927.  
  1928.   function "&"(S1 : in STRING; 
  1929.                S2 : in STRING_TYPE) return STRING_TYPE is 
  1930.   begin
  1931.     if S2 = null then 
  1932.       return CREATE(S1); 
  1933.     end if; 
  1934.     return CREATE(S1 & S2.all); 
  1935.   end "&"; 
  1936.  
  1937.   function SUBSTR(S   : in STRING_TYPE; 
  1938.                   I   : in POSITIVE; 
  1939.                   LEN : in NATURAL) return STRING_TYPE is 
  1940.   begin
  1941.     if LEN = 0 then 
  1942.       return null; 
  1943.     end if; 
  1944.     return CREATE(S(I .. (I + LEN - 1))); 
  1945.   exception
  1946.     when CONSTRAINT_ERROR => 
  1947.  
  1948.       -- on array fetch or null deref
  1949.       raise BOUNDS; 
  1950.   end SUBSTR; 
  1951.  
  1952.   function SPLICE(S   : in STRING_TYPE; 
  1953.                   I   : in POSITIVE; 
  1954.                   LEN : in NATURAL) return STRING_TYPE is 
  1955.   begin
  1956.     if LEN = 0 then 
  1957.       return ENTER(MAKE_PERSISTENT(S)); 
  1958.     end if; 
  1959.     if I + LEN - 1 > LENGTH(S) then 
  1960.       raise BOUNDS; 
  1961.     end if; 
  1962.  
  1963.     return CREATE(S(1 .. (I - 1)) & S((I + LEN) .. LENGTH(S))); 
  1964.   end SPLICE; 
  1965.  
  1966.   function INSERT(S1, S2 : in STRING_TYPE; 
  1967.                   I      : in POSITIVE) return STRING_TYPE is 
  1968.   begin
  1969.     if I > LENGTH(S1) then 
  1970.       raise BOUNDS; 
  1971.     end if; 
  1972.     if IS_EMPTY(S2) then 
  1973.       return CREATE(S1.all); 
  1974.     end if; 
  1975.  
  1976.     return CREATE(S1(1 .. (I - 1)) & S2.all & S1(I .. S1'LAST)); 
  1977.   end INSERT; 
  1978.  
  1979.   function INSERT(S1 : in STRING_TYPE; 
  1980.                   S2 : in STRING; 
  1981.                   I  : in POSITIVE) return STRING_TYPE is 
  1982.   begin
  1983.     if I > LENGTH(S1) then 
  1984.       raise BOUNDS; 
  1985.     end if; 
  1986.  
  1987.     return CREATE(S1(1 .. (I - 1)) & S2 & S1(I .. S1'LAST)); 
  1988.   end INSERT; 
  1989.  
  1990.   function INSERT(S1 : in STRING; 
  1991.                   S2 : in STRING_TYPE; 
  1992.                   I  : in POSITIVE) return STRING_TYPE is 
  1993.   begin
  1994.     if not (I in S1'range ) then 
  1995.       raise BOUNDS; 
  1996.     end if; 
  1997.     if S2 = null then 
  1998.       return CREATE(S1); 
  1999.     end if; 
  2000.  
  2001.     return CREATE(S1(S1'FIRST .. (I - 1)) & S2.all & S1(I .. S1'LAST)); 
  2002.   end INSERT; 
  2003.  
  2004.   function LOWER(S : in STRING) return STRING_TYPE is 
  2005.     S2 : STRING_TYPE := CREATE(S); 
  2006.  
  2007.     procedure LC(C : in out CHARACTER) is 
  2008.     begin
  2009.       if ('A' <= C) and then (C <= 'Z') then 
  2010.         C := CHARACTER'VAL(CHARACTER'POS(C) - CHARACTER'POS('A') + CHARACTER'POS
  2011.           ('a')); 
  2012.       end if; 
  2013.     end LC; 
  2014.  
  2015.   begin
  2016.     for I in S2'range loop
  2017.       LC(S2(I)); 
  2018.     end loop; 
  2019.     return S2; 
  2020.   end LOWER; 
  2021.  
  2022.   function LOWER(S : in STRING_TYPE) return STRING_TYPE is 
  2023.   begin
  2024.     if S = null then 
  2025.       return null; 
  2026.     end if; 
  2027.     return LOWER(S.all); 
  2028.   end LOWER; 
  2029.  
  2030.   function UPPER(S : in STRING) return STRING_TYPE is 
  2031.     S2 : STRING_TYPE := CREATE(S); 
  2032.  
  2033.     procedure UC(C : in out CHARACTER) is 
  2034.     begin
  2035.       if ('a' <= C) and then (C <= 'z') then 
  2036.         C := CHARACTER'VAL(CHARACTER'POS(C) - CHARACTER'POS('a') + CHARACTER'POS
  2037.           ('A')); 
  2038.       end if; 
  2039.     end UC; 
  2040.  
  2041.   begin
  2042.     for I in S2'range loop
  2043.       UC(S2(I)); 
  2044.     end loop; 
  2045.     return S2; 
  2046.   end UPPER; 
  2047.  
  2048.   function UPPER(S : in STRING_TYPE) return STRING_TYPE is 
  2049.   begin
  2050.     if S = null then 
  2051.       return null; 
  2052.     end if; 
  2053.     return UPPER(S.all); 
  2054.   end UPPER; 
  2055.  
  2056.  
  2057.   -- Heap Management:
  2058.  
  2059.   function MAKE_PERSISTENT(S : in STRING_TYPE) return STRING_TYPE is 
  2060.     subtype CONSTR_STR is STRING(1 .. LENGTH(S)); 
  2061.   begin
  2062.     if S = null or else S.all = "" then 
  2063.       return null; 
  2064.     else 
  2065.       return new CONSTR_STR'(S.all); 
  2066.     end if; 
  2067.   end MAKE_PERSISTENT; 
  2068.  
  2069.   function MAKE_PERSISTENT(S : in STRING) return STRING_TYPE is 
  2070.     subtype CONSTR_STR is STRING(1 .. S'LENGTH); 
  2071.   begin
  2072.     if S = "" then 
  2073.       return null; 
  2074.     else 
  2075.       return new CONSTR_STR'(S); 
  2076.     end if; 
  2077.   end MAKE_PERSISTENT; 
  2078.  
  2079.   procedure REAL_FLUSH is 
  2080.     new UNCHECKED_DEALLOCATION(STRING, STRING_TYPE); 
  2081.     --| Effect:
  2082.     --| Return space used by argument to heap.  Does nothing if null.
  2083.     --| Notes:
  2084.     --| This procedure is actually the body for the flush procedure,
  2085.     --| but a generic instantiation cannot be used as a body for another
  2086.     --| procedure.  You tell me why.
  2087.  
  2088.   procedure FLUSH(S : in out STRING_TYPE) is 
  2089.   begin
  2090.     if S /= null then 
  2091.       REAL_FLUSH(S); 
  2092.     end if; 
  2093.  
  2094.   -- Actually, the if isn't needed; however, DECada compiler chokes
  2095.   -- on deallocation of null.
  2096.   end FLUSH; 
  2097.  
  2098.   procedure MARK is 
  2099.   begin
  2100.     PUSH(SCOPES, new STRING_LIST'(CREATE)); 
  2101.   end MARK; 
  2102.  
  2103.   procedure RELEASE is 
  2104.     procedure FLUSH_LIST_PTR is 
  2105.       new UNCHECKED_DEALLOCATION(STRING_LIST, STRING_LIST_PTR); 
  2106.     ITER     : STRING_LIST_PKG.LISTITER; 
  2107.     TOP_LIST : STRING_LIST_PTR; 
  2108.     S        : STRING_TYPE; 
  2109.   begin
  2110.     POP(SCOPES, TOP_LIST); 
  2111.     ITER := MAKELISTITER(TOP_LIST.all); 
  2112.     while MORE(ITER) loop
  2113.       NEXT(ITER, S); 
  2114.       FLUSH(S); 
  2115.  
  2116.     -- real_flush is bad, DECada bug
  2117.     --          real_flush(s);            
  2118.     end loop; 
  2119.     DESTROY(TOP_LIST.all); 
  2120.     FLUSH_LIST_PTR(TOP_LIST); 
  2121.   exception
  2122.     when EMPTY_STACK => 
  2123.       raise ILLEGAL_DEALLOC; 
  2124.   end RELEASE; 
  2125.  
  2126.  
  2127.   -- Queries:
  2128.  
  2129.   function IS_EMPTY(S : in STRING_TYPE) return BOOLEAN is 
  2130.   begin
  2131.     return (S = null) or else (S.all = ""); 
  2132.   end IS_EMPTY; 
  2133.  
  2134.   function LENGTH(S : in STRING_TYPE) return NATURAL is 
  2135.   begin
  2136.     if S = null then 
  2137.       return 0; 
  2138.     end if; 
  2139.     return (S.all'LENGTH); 
  2140.   end LENGTH; 
  2141.  
  2142.   function VALUE(S : in STRING_TYPE) return STRING is 
  2143.     subtype NULL_RANGE is POSITIVE range 1 .. 0; 
  2144.     subtype NULL_STRING is STRING(NULL_RANGE); 
  2145.   begin
  2146.     if S = null then 
  2147.       return NULL_STRING'(""); 
  2148.     end if; 
  2149.     return S.all; 
  2150.   end VALUE; 
  2151.  
  2152.   function FETCH(S : in STRING_TYPE; 
  2153.                  I : in POSITIVE) return CHARACTER is 
  2154.   begin
  2155.     if IS_EMPTY(S) or else (not (I in S'range )) then 
  2156.       raise BOUNDS; 
  2157.     end if; 
  2158.     return S(I); 
  2159.   end FETCH; 
  2160.  
  2161.   function EQUAL(S1, S2 : in STRING_TYPE) return BOOLEAN is 
  2162.   begin
  2163.     if IS_EMPTY(S1) then 
  2164.       return IS_EMPTY(S2); 
  2165.     end if; 
  2166.     return (S2 /= null) and then (S1.all = S2.all); 
  2167.  
  2168.   -- The above code replaces the following.  (DECada buggy)
  2169.   --        return s1.all = s2.all;
  2170.   --    exception
  2171.   --    when constraint_error =>     -- s is null
  2172.   --        return is_empty(s1) and is_empty(s2);
  2173.   end EQUAL; 
  2174.  
  2175.   function EQUAL(S1 : in STRING_TYPE; 
  2176.                  S2 : in STRING) return BOOLEAN is 
  2177.   begin
  2178.     if S1 = null then 
  2179.       return S2 = ""; 
  2180.     end if; 
  2181.     return S1.all = S2; 
  2182.   end EQUAL; 
  2183.  
  2184.   function EQUAL(S1 : in STRING; 
  2185.                  S2 : in STRING_TYPE) return BOOLEAN is 
  2186.   begin
  2187.     if S2 = null then 
  2188.       return S1 = ""; 
  2189.     end if; 
  2190.     return S1 = S2.all; 
  2191.   end EQUAL; 
  2192.  
  2193.   function "<"(S1 : in STRING_TYPE; 
  2194.                S2 : in STRING_TYPE) return BOOLEAN is 
  2195.   begin
  2196.     if IS_EMPTY(S1) then 
  2197.       return (not IS_EMPTY(S2)); 
  2198.     else 
  2199.       return (S1.all < S2); 
  2200.     end if; 
  2201.  
  2202.   -- Got rid of the following code:  (Think that DECada is buggy)
  2203.   --return s1.all < s2.all; 
  2204.   --exception
  2205.   --when constraint_error =>   -- on null deref
  2206.   --return (not is_empty(s2)); 
  2207.   -- one of them must be empty
  2208.   end "<"; 
  2209.  
  2210.   function "<"(S1 : in STRING_TYPE; 
  2211.                S2 : in STRING) return BOOLEAN is 
  2212.   begin
  2213.     if S1 = null then 
  2214.       return S2 /= ""; 
  2215.     end if; 
  2216.     return S1.all < S2; 
  2217.   end "<"; 
  2218.  
  2219.   function "<"(S1 : in STRING; 
  2220.                S2 : in STRING_TYPE) return BOOLEAN is 
  2221.   begin
  2222.     if S2 = null then 
  2223.       return FALSE; 
  2224.     end if; 
  2225.     return S1 < S2.all; 
  2226.   end "<"; 
  2227.  
  2228.   function "<="(S1 : in STRING_TYPE; 
  2229.                 S2 : in STRING_TYPE) return BOOLEAN is 
  2230.   begin
  2231.     if IS_EMPTY(S1) then 
  2232.       return TRUE; 
  2233.     end if; 
  2234.     return (S1.all <= S2); 
  2235.  
  2236.   -- Replaces the following:  (I think DECada is buggy)
  2237.   --return s1.all <= s2.all; 
  2238.   --exception
  2239.   --when constraint_error =>   -- on null deref
  2240.   --return is_empty(s1);   -- one must be empty, so s1<=s2 iff s1 = ""
  2241.   end "<="; 
  2242.  
  2243.   function "<="(S1 : in STRING_TYPE; 
  2244.                 S2 : in STRING) return BOOLEAN is 
  2245.   begin
  2246.     if S1 = null then 
  2247.       return TRUE; 
  2248.     end if; 
  2249.     return S1.all <= S2; 
  2250.   end "<="; 
  2251.  
  2252.   function "<="(S1 : in STRING; 
  2253.                 S2 : in STRING_TYPE) return BOOLEAN is 
  2254.   begin
  2255.     if S2 = null then 
  2256.       return S1 = ""; 
  2257.     end if; 
  2258.     return S1 <= S2.all; 
  2259.   end "<="; 
  2260.  
  2261.   function MATCH_C(S     : in STRING_TYPE; 
  2262.                    C     : in CHARACTER; 
  2263.                    START : in POSITIVE := 1) return NATURAL is 
  2264.   begin
  2265.     if S = null then 
  2266.       return 0; 
  2267.     end if; 
  2268.     for I in START .. S.all'LAST loop
  2269.       if S(I) = C then 
  2270.         return I; 
  2271.       end if; 
  2272.     end loop; 
  2273.     return 0; 
  2274.   end MATCH_C; 
  2275.  
  2276.   function MATCH_NOT_C(S     : in STRING_TYPE; 
  2277.                        C     : in CHARACTER; 
  2278.                        START : in POSITIVE := 1) return NATURAL is 
  2279.   begin
  2280.     if S = null then 
  2281.       return 0; 
  2282.     end if; 
  2283.     for I in START .. S.all'LAST loop
  2284.       if S(I) /= C then 
  2285.         return I; 
  2286.       end if; 
  2287.     end loop; 
  2288.     return 0; 
  2289.   end MATCH_NOT_C; 
  2290.  
  2291.   function MATCH_S(S1, S2 : in STRING_TYPE; 
  2292.                    START  : in POSITIVE := 1) return NATURAL is 
  2293.   begin
  2294.     if (S1 = null) or else (S2 = null) then 
  2295.       return 0; 
  2296.     end if; 
  2297.     return MATCH_STRING(S1.all, S2.all, START); 
  2298.   end MATCH_S; 
  2299.  
  2300.   function MATCH_S(S1    : in STRING_TYPE; 
  2301.                    S2    : in STRING; 
  2302.                    START : in POSITIVE := 1) return NATURAL is 
  2303.   begin
  2304.     if S1 = null then 
  2305.       return 0; 
  2306.     end if; 
  2307.     return MATCH_STRING(S1.all, S2, START); 
  2308.   end MATCH_S; 
  2309.  
  2310.   function MATCH_ANY(S, ANY : in STRING_TYPE; 
  2311.                      START  : in POSITIVE := 1) return NATURAL is 
  2312.   begin
  2313.     if ANY = null then 
  2314.       raise ANY_EMPTY; 
  2315.     end if; 
  2316.     return MATCH_ANY(S, ANY.all, START); 
  2317.   end MATCH_ANY; 
  2318.  
  2319.   function MATCH_ANY(S     : in STRING_TYPE; 
  2320.                      ANY   : in STRING; 
  2321.                      START : in POSITIVE := 1) return NATURAL is 
  2322.   begin
  2323.     if ANY = "" then 
  2324.       raise ANY_EMPTY; 
  2325.     end if; 
  2326.     if S = null then 
  2327.       return 0; 
  2328.     end if; 
  2329.  
  2330.     for I in START .. S.all'LAST loop
  2331.       for J in ANY'range loop
  2332.         if S(I) = ANY(J) then 
  2333.           return I; 
  2334.         end if; 
  2335.       end loop; 
  2336.     end loop; 
  2337.     return 0; 
  2338.   end MATCH_ANY; 
  2339.  
  2340.   function MATCH_NONE(S, NONE : in STRING_TYPE; 
  2341.                       START   : in POSITIVE := 1) return NATURAL is 
  2342.   begin
  2343.     if IS_EMPTY(S) then 
  2344.       return 0; 
  2345.     end if; 
  2346.     if IS_EMPTY(NONE) then 
  2347.       return 1; 
  2348.     end if; 
  2349.  
  2350.     return MATCH_NONE(S, NONE.all, START); 
  2351.   end MATCH_NONE; 
  2352.  
  2353.   function MATCH_NONE(S     : in STRING_TYPE; 
  2354.                       NONE  : in STRING; 
  2355.                       START : in POSITIVE := 1) return NATURAL is 
  2356.     FOUND : BOOLEAN; 
  2357.   begin
  2358.     if IS_EMPTY(S) then 
  2359.       return 0; 
  2360.     end if; 
  2361.  
  2362.     for I in START .. S.all'LAST loop
  2363.       FOUND := TRUE; 
  2364.       for J in NONE'range loop
  2365.         if S(I) = NONE(J) then 
  2366.           FOUND := FALSE; 
  2367.           exit; 
  2368.         end if; 
  2369.       end loop; 
  2370.       if FOUND then 
  2371.         return I; 
  2372.       end if; 
  2373.     end loop; 
  2374.     return 0; 
  2375.   end MATCH_NONE; 
  2376.  
  2377.  
  2378.   -- Utilities:
  2379.  
  2380.   function ENTER(S : in STRING_TYPE) return STRING_TYPE is 
  2381.   begin
  2382.     TOP(SCOPES).all := ATTACH(TOP(SCOPES).all, S); 
  2383.     return S; 
  2384.   exception
  2385.     when EMPTY_STACK => 
  2386.       raise ILLEGAL_ALLOC; 
  2387.   end ENTER; 
  2388.  
  2389.   function MATCH_STRING(S1, S2 : in STRING; 
  2390.                         START  : in POSITIVE := 1) return NATURAL is 
  2391.     OFFSET : NATURAL; 
  2392.   begin
  2393.     OFFSET := S2'LENGTH - 1; 
  2394.     for I in START .. (S1'LAST - OFFSET) loop
  2395.       if S1(I .. (I + OFFSET)) = S2 then 
  2396.         return I; 
  2397.       end if; 
  2398.     end loop; 
  2399.     return 0; 
  2400.   exception
  2401.     when CONSTRAINT_ERROR => 
  2402.  
  2403.       -- on offset := s2'length (= 0)
  2404.       return 0; 
  2405.   end MATCH_STRING; 
  2406.  
  2407. begin
  2408.  
  2409.   -- Initialize the scopes stack with an implicit mark.
  2410.   SCOPES := CREATE; 
  2411.   MARK; 
  2412. end STRING_PKG; 
  2413. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2414. --scanner.spc
  2415. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2416. with STRING_PKG; use STRING_PKG; 
  2417.  
  2418. package STRING_SCANNER is 
  2419.  
  2420. --| Functions for scanning tokens from strings.
  2421.   pragma PAGE; 
  2422.   --| Overview
  2423.   --| This package provides a set of functions used to scan tokens from
  2424.   --| strings.  After the function make_Scanner is called to convert a string
  2425.   --| into a string Scanner, the following functions may be called to scan
  2426.   --| various tokens from the string:
  2427.   --|-
  2428.   --| Make_Scanner    Given a string returns a Scanner
  2429.   --| Destroy_Scanner    Free storage used by Scanner
  2430.   --| More        Return TRUE iff unscanned characters remain
  2431.   --| Forward             Bump the Scanner
  2432.   --| Backward        Bump back the Scanner
  2433.   --| Get            Return character 
  2434.   --| Next        Return character and bump the Scanner
  2435.   --| Get_String        Return String_Type in Scanner
  2436.   --| Get_Remainder    Return String_Type in Scanner from current Index
  2437.   --| Mark        Mark the current Index for Restore 
  2438.   --| Restore        Restore the previously marked Index
  2439.   --| Position        Return the current position of the Scanner
  2440.   --| Is_Word        Return TRUE iff Scanner is at a non-blank character
  2441.   --| Scan_Word        Return sequence of non blank characters
  2442.   --| Is_Number        Return TRUE iff Scanner is at a digit
  2443.   --| Scan_Number (2)    Return sequence of decimal digits
  2444.   --| Is_Signed_Number    Return TRUE iff Scanner is at a digit or sign
  2445.   --| Scan_Signed_Number (2)
  2446.   --|            sequence of decimal digits with optional sign (+/-)
  2447.   --| Is_Space        Return TRUE iff Scanner is at a space or tab
  2448.   --| Scan_Space        Return sequence of spaces or tabs
  2449.   --| Skip_Space        Advance Scanner past white space
  2450.   --| Is_Ada_Id        Return TRUE iff Scanner is at first character of ada id
  2451.   --| Scan_Ada_Id        Scan an Ada identifier
  2452.   --| Is_Quoted        Return TRUE iff Scanner is at a double quote
  2453.   --| Scan_Quoted        Scan quoted string, embedded quotes doubled
  2454.   --| Is_Enclosed        Return TRUE iff Scanner is at an enclosing character
  2455.   --| Scan_Enclosed    Scan enclosed string, embedded enclosing character doubled
  2456.   --| Is_Sequence        Return TRUE iff Scanner is at some character in sequence
  2457.   --| Scan_Sequence    Scan user specified sequence of chars
  2458. --| Is_Not_Sequence    Return TRUE iff Scanner is not at the characters in sequence
  2459. --| Scan_Not_Sequence    Scan string up to but not including a given sequence of chars
  2460.   --| Is_Literal            Return TRUE iff Scanner is at literal
  2461.   --| Scan_Literal    Scan user specified literal
  2462.   --| Is_Not_Literal    Return TRUE iff Scanner is not a given literal
  2463.   --| Scan_Not_Literal    Scan string up to but not including a given literal
  2464.   --|+
  2465.  
  2466.   ----------------------------------------------------------------
  2467.  
  2468.   OUT_OF_BOUNDS          : exception; 
  2469.                                 --| Raised when a operation is attempted on a
  2470.   --| Scanner that has passed the end
  2471.   SCANNER_ALREADY_MARKED : exception; 
  2472.   --| Raised when a Mark is attemped on a Scanner
  2473.   --| that has already been marked
  2474.  
  2475.   ----------------------------------------------------------------
  2476.  
  2477.   type SCANNER is private;  --| Scanner type
  2478.  
  2479.   ----------------------------------------------------------------
  2480.   pragma PAGE; 
  2481.   function MAKE_SCANNER( --| Construct a Scanner from S.
  2482.                         S : in STRING_TYPE --| String to be scanned.
  2483.                         ) return SCANNER; 
  2484.  
  2485.   --| Effects: Construct a Scanner from S.
  2486.   --| N/A: Raises, Modifies, Errors
  2487.  
  2488.   ----------------------------------------------------------------
  2489.  
  2490.   procedure DESTROY_SCANNER( --| Free Scanner storage
  2491.                             T : in out SCANNER --| Scanner to be freed
  2492.                             ); 
  2493.  
  2494.   --| Effects: Free space occupied by the Scanner.
  2495.   --| N/A: Raises, Modifies, Errors
  2496.  
  2497.   ----------------------------------------------------------------
  2498.  
  2499.   function MORE( --| Check if Scanner is exhausted
  2500.                 T : in SCANNER --| Scanner to check
  2501.                 ) return BOOLEAN; 
  2502.  
  2503.   --| Effects: Return TRUE iff additional characters remain to be scanned.
  2504.   --| N/A: Raises, Modifies, Errors
  2505.  
  2506.   ----------------------------------------------------------------
  2507.  
  2508.   procedure FORWARD( --| Bump scanner
  2509.                     T : in SCANNER --| Scanner
  2510.                     ); 
  2511.  
  2512.   --| Effects: Update the scanner position.
  2513.   --| N/A: Raises, Modifies, Errors
  2514.  
  2515.   ----------------------------------------------------------------
  2516.  
  2517.   procedure BACKWARD( --| Bump back scanner
  2518.                      T : in SCANNER --| Scanner
  2519.                      ); 
  2520.  
  2521.   --| Effects: Update the scanner position.
  2522.   --| N/A: Raises, Modifies, Errors
  2523.  
  2524.   ----------------------------------------------------------------
  2525.  
  2526.   function GET( --| Return character
  2527.                T : in SCANNER --| Scanner to check
  2528.                ) return CHARACTER; 
  2529.  
  2530.   --| Raises: Out_Of_Bounds
  2531.   --| Effects: Return character at the current Scanner position.
  2532.   --| The scanner position remains unchanged.
  2533.   --| N/A: Modifies, Errors
  2534.  
  2535.   ----------------------------------------------------------------
  2536.  
  2537.   procedure NEXT( --| Return character and bump scanner
  2538.                  T : in SCANNER;  --| Scanner to check
  2539.                  C : out CHARACTER --| Character to be returned
  2540.                  ); 
  2541.  
  2542.   --| Raises: Out_Of_Bounds
  2543.   --| Effects: Return character at the current Scanner position and update
  2544.   --| the position.
  2545.   --| N/A: Modifies, Errors
  2546.  
  2547.   ----------------------------------------------------------------
  2548.  
  2549.   function POSITION( --| Return current Scanner position
  2550.                     T : in SCANNER --| Scanner to check
  2551.                     ) return POSITIVE; 
  2552.  
  2553.   --| Raises: Out_Of_Bounds
  2554. --| Effects: Return a positive integer indicating the current Scanner position,
  2555.   --| N/A: Modifies, Errors
  2556.  
  2557.   ----------------------------------------------------------------
  2558.  
  2559.   function GET_STRING( --| Return contents of Scanner
  2560.                       T : in SCANNER --| Scanner
  2561.                       ) return STRING_TYPE; 
  2562.  
  2563. --| Effects: Return a String_Type corresponding to the contents of the Scanner
  2564.   --| N/A: Raises, Modifies, Errors
  2565.  
  2566.   ----------------------------------------------------------------
  2567.  
  2568.   function GET_REMAINDER( --| Return contents of Scanner from index
  2569.                          T : in SCANNER) return STRING_TYPE; 
  2570.  
  2571. --| Effects: Return a String_Type starting at the current index of the Scanner
  2572.   --| N/A: Raises, Modifies, Errors
  2573.  
  2574.   ----------------------------------------------------------------
  2575.  
  2576.   procedure MARK(T : in SCANNER); 
  2577.  
  2578.   --| Raises: Scanner_Already_Marked
  2579.   --| Effects: Mark the current index for possible future use
  2580.   --| N/A: Modifies, Errors
  2581.  
  2582.   ----------------------------------------------------------------
  2583.  
  2584.   procedure RESTORE(T : in SCANNER); 
  2585.  
  2586.   --| Effects: Restore the index to the previously marked value
  2587.   --| N/A: Raises, Modifies, Errors
  2588.  
  2589.   ----------------------------------------------------------------
  2590.  
  2591.   pragma PAGE; 
  2592.   function IS_WORD( --| Check if Scanner is at the start of a word.
  2593.                    T : in SCANNER --| Scanner to check
  2594.                    ) return BOOLEAN; 
  2595.  
  2596.   --| Effects: Return TRUE iff Scanner is at the start of a word.
  2597.   --| N/A: Raises, Modifies, Errors
  2598.  
  2599.   ----------------------------------------------------------------
  2600.  
  2601.   procedure SCAN_WORD( --| Scan sequence of non blank characters
  2602.                       T      : in SCANNER;  --| String to be scanned
  2603.                       FOUND  : out BOOLEAN;  --| TRUE iff a word found
  2604.                       RESULT : out STRING_TYPE;  --| Word scanned from string
  2605.                       SKIP   : in BOOLEAN := FALSE
  2606.                       --| Skip white spaces before scan
  2607.                       ); 
  2608.  
  2609.   --| Effects: Scan T for a sequence of non blank 
  2610.   --| characters.  If at least one is found, return Found => TRUE, 
  2611.   --| Result => <the characters>.
  2612.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2613.  
  2614.   --| N/A: Raises, Modifies, Errors
  2615.   pragma PAGE; 
  2616.   function IS_NUMBER( --| Return TRUE iff Scanner is at a decimal digit
  2617.                      T : in SCANNER --| The string being scanned
  2618.                      ) return BOOLEAN; 
  2619.  
  2620.   --| Effects: Return TRUE iff Scan_Number would return a non-null string.
  2621.   --| N/A: Raises, Modifies, Errors
  2622.  
  2623.   ----------------------------------------------------------------
  2624.  
  2625.   procedure SCAN_NUMBER( --| Scan sequence of digits
  2626.                         T      : in SCANNER;  --| String to be scanned
  2627.                         FOUND  : out BOOLEAN; 
  2628.                                 --| TRUE iff one or more digits found
  2629.                         RESULT : out STRING_TYPE; 
  2630.                                 --| Number scanned from string
  2631.                         SKIP   : in BOOLEAN := FALSE
  2632.                         --| Skip white spaces before scan
  2633.                         ); 
  2634.  
  2635.   --| Effects: Scan T for a sequence of digits.
  2636.   --| If at least one is found, return Found => TRUE, Result => <the digits>.
  2637.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2638.  
  2639.   --| Modifies: Raises, Modifies, Errors
  2640.  
  2641.   ----------------------------------------------------------------
  2642.  
  2643.   procedure SCAN_NUMBER( --| Scan sequence of digits
  2644.                         T      : in SCANNER;  --| String to be scanned
  2645.                         FOUND  : out BOOLEAN; 
  2646.                                 --| TRUE iff one or more digits found
  2647.                         RESULT : out INTEGER;  --| Number scanned from string
  2648.                         SKIP   : in BOOLEAN := FALSE
  2649.                         --| Skip white spaces before scan
  2650.                         ); 
  2651.  
  2652.   --| Effects: Scan T for a sequence of digits.
  2653.   --| If at least one is found, return Found => TRUE, Result => <the digits>.
  2654.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2655.  
  2656.   --| Modifies: Raises, Modifies, Errors
  2657.   pragma PAGE; 
  2658.   function IS_SIGNED_NUMBER( --| Check if Scanner is at a decimal digit or
  2659.   --| sign (+/-)
  2660.                             T : in SCANNER --| The string being scanned
  2661.                             ) return BOOLEAN; 
  2662.  
  2663.   --| Effects: Return TRUE iff Scan_Signed_Number would return a non-null
  2664.   --| string.
  2665.  
  2666.   --| N/A: Raises, Modifies, Errors
  2667.  
  2668.   ----------------------------------------------------------------
  2669.  
  2670.   procedure SCAN_SIGNED_NUMBER( --| Scan signed sequence of digits 
  2671.                                T      : in SCANNER;  --| String to be scanned
  2672.                                FOUND  : out BOOLEAN; 
  2673.                                 --| TRUE iff one or more digits found
  2674.                                RESULT : out STRING_TYPE; 
  2675.                                 --| Number scanned from string
  2676.                                SKIP   : in BOOLEAN := FALSE
  2677.                                --| Skip white spaces before scan
  2678.                                ); 
  2679.  
  2680.   --| Effects: Scan T for a sequence of digits preceeded with optional sign.
  2681.   --| If at least one digit is found, return Found => TRUE, 
  2682.   --| Result => <the digits>.
  2683.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2684.  
  2685.   --| Modifies: Raises, Modifies, Errors
  2686.  
  2687.   ----------------------------------------------------------------
  2688.  
  2689.   procedure SCAN_SIGNED_NUMBER( --| Scan signed sequence of digits 
  2690.                                T      : in SCANNER;  --| String to be scanned
  2691.                                FOUND  : out BOOLEAN; 
  2692.                                 --| TRUE iff one or more digits found
  2693.                                RESULT : out INTEGER; 
  2694.                                 --| Number scanned from string
  2695.                                SKIP   : in BOOLEAN := FALSE
  2696.                                --| Skip white spaces before scan
  2697.                                ); 
  2698.  
  2699.   --| Effects: Scan T for a sequence of digits preceeded with optional sign.
  2700.   --| If at least one digit is found, return Found => TRUE, 
  2701.   --| Result => <the digits>.
  2702.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2703.  
  2704.   --| Modifies: Raises, Modifies, Errors
  2705.   pragma PAGE; 
  2706.   function IS_SPACE( --| Check if T is at a space or tab
  2707.                     T : in SCANNER --| The string being scanned
  2708.                     ) return BOOLEAN; 
  2709.  
  2710.   --| Effects: Return TRUE iff Scan_Space would return a non-null string.
  2711.   --| Modifies: Raises, Modifies, Errors
  2712.  
  2713.   ----------------------------------------------------------------
  2714.  
  2715.   procedure SCAN_SPACE( --| Scan sequence of white space characters
  2716.                        T      : in SCANNER;  --| String to be scanned
  2717.                        FOUND  : out BOOLEAN;  --| TRUE iff space found
  2718.                        RESULT : out STRING_TYPE --| Spaces scanned from string
  2719.                        ); 
  2720.  
  2721.   --| Effects: Scan T past all white space (spaces
  2722.   --| and tabs.  If at least one is found, return Found => TRUE,
  2723.   --| Result => <the characters>.
  2724.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2725.  
  2726.   --| Modifies: Raises, Modifies, Errors
  2727.  
  2728.   ----------------------------------------------------------------
  2729.  
  2730.   procedure SKIP_SPACE( --| Skip white space
  2731.                        T : in SCANNER --| String to be scanned
  2732.                        ); 
  2733.  
  2734.   --| Effects: Scan T past all white space (spaces and tabs).  
  2735.   --| Modifies: Raises, Modifies, Errors
  2736.   pragma PAGE; 
  2737.   function IS_ADA_ID( --| Check if T is at an Ada identifier
  2738.                      T : in SCANNER --| The string being scanned
  2739.                      ) return BOOLEAN; 
  2740.  
  2741.   --| Effects: Return TRUE iff Scan_Ada_Id would return a non-null string.
  2742.   --| Modifies: Raises, Modifies, Errors
  2743.  
  2744.   ----------------------------------------------------------------
  2745.  
  2746.   procedure SCAN_ADA_ID( --| Scan Ada identifier
  2747.                         T      : in SCANNER;  --| String to be scanned
  2748.                         FOUND  : out BOOLEAN; 
  2749.                                 --| TRUE iff an Ada identifier found
  2750.                         RESULT : out STRING_TYPE; 
  2751.                                 --| Identifier scanned from string
  2752.                         SKIP   : in BOOLEAN := FALSE
  2753.                         --| Skip white spaces before scan
  2754.                         ); 
  2755.  
  2756.   --| Effects: Scan T for a valid Ada identifier.
  2757.   --| If one is found, return Found => TRUE, Result => <the characters>.
  2758.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2759.  
  2760.   --| Modifies: Raises, Modifies, Errors
  2761.   pragma PAGE; 
  2762.   function IS_QUOTED( --| Check if T is at a double quote
  2763.                      T : in SCANNER --| The string being scanned
  2764.                      ) return BOOLEAN; 
  2765.  
  2766.   --| Effects: Return TRUE iff T is at a quoted string (eg. ... "Hello" ...).
  2767.   --| Modifies: Raises, Modifies, Errors
  2768.  
  2769.   ----------------------------------------------------------------
  2770.  
  2771.   procedure SCAN_QUOTED( --| Scan a quoted string
  2772.                         T      : in SCANNER;  --| String to be scanned
  2773.                         FOUND  : out BOOLEAN; 
  2774.                                 --| TRUE iff a quoted string found
  2775.                         RESULT : out STRING_TYPE; 
  2776.                                 --| Quoted string scanned from string
  2777.                         SKIP   : in BOOLEAN := FALSE
  2778.                         --| Skip white spaces before scan
  2779.                         ); 
  2780.  
  2781.   --| Effects: Scan at T for an opening quote
  2782.   --| followed by a sequence of characters and ending with a closing
  2783.   --| quote.  If successful, return Found => TRUE, Result => <the characters>.
  2784.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2785.   --| A pair of quotes within the quoted string is converted to a single quote.
  2786.   --| The outer quotes are stripped. 
  2787.  
  2788.   --| Modifies: Raises, Modifies, Errors
  2789.   pragma PAGE; 
  2790.   function IS_ENCLOSED( --| Check if T is at an enclosing character
  2791.                        B : in CHARACTER;  --| Enclosing open character
  2792.                        E : in CHARACTER;  --| Enclosing close character
  2793.                        T : in SCANNER --| The string being scanned
  2794.                        ) return BOOLEAN; 
  2795.  
  2796.   --| Effects: Return TRUE iff T as encosed by B and E (eg. ... [ABC] ...).
  2797.   --| Modifies: Raises, Modifies, Errors
  2798.  
  2799.   ----------------------------------------------------------------
  2800.  
  2801.   procedure SCAN_ENCLOSED( --| Scan an enclosed string
  2802.                           B      : in CHARACTER;  --| Enclosing open character
  2803.                           E      : in CHARACTER;  --| Enclosing close character
  2804.                           T      : in SCANNER;  --| String to be scanned
  2805.                           FOUND  : out BOOLEAN; 
  2806.                                 --| TRUE iff a quoted string found
  2807.                           RESULT : out STRING_TYPE; 
  2808.                                 --| Quoted string scanned from string
  2809.                           SKIP   : in BOOLEAN := FALSE
  2810.                           --| Skip white spaces before scan
  2811.                           ); 
  2812.  
  2813.   --| Effects: Scan at T for an enclosing character
  2814. --| followed by a sequence of characters and ending with an enclosing character.
  2815.   --| If successful, return Found => TRUE, Result => <the characters>.
  2816.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2817.   --| The enclosing characters are stripped. 
  2818.  
  2819.   --| Modifies: Raises, Modifies, Errors
  2820.   pragma PAGE; 
  2821.   function IS_SEQUENCE( --| Check if T is at some sequence characters 
  2822.                        CHARS : in STRING_TYPE;  --| Characters to be scanned
  2823.                        T     : in SCANNER --| The string being scanned
  2824.                        ) return BOOLEAN; 
  2825.  
  2826.   --| Effects: Return TRUE iff T is at some character of Chars.
  2827.   --| Modifies: Raises, Modifies, Errors
  2828.  
  2829.   ----------------------------------------------------------------
  2830.  
  2831.   function IS_SEQUENCE( --| Check if T is at some sequence characters 
  2832.                        CHARS : in STRING;  --| Characters to be scanned
  2833.                        T     : in SCANNER --| The string being scanned
  2834.                        ) return BOOLEAN; 
  2835.  
  2836.   --| Effects: Return TRUE iff T is at some character of Chars.
  2837.   --| Modifies: Raises, Modifies, Errors
  2838.  
  2839.   ----------------------------------------------------------------
  2840.  
  2841.   procedure SCAN_SEQUENCE( --| Scan arbitrary sequence of characters
  2842.                           CHARS  : in STRING_TYPE; 
  2843.                                 --| Characters that should be scanned
  2844.                           T      : in SCANNER;  --| String to be scanned
  2845.                           FOUND  : out BOOLEAN;  --| TRUE iff a sequence found
  2846.                           RESULT : out STRING_TYPE; 
  2847.                                 --| Sequence scanned from string
  2848.                           SKIP   : in BOOLEAN := FALSE
  2849.                           --| Skip white spaces before scan
  2850.                           ); 
  2851.  
  2852.   --| Effects: Scan T for a sequence of characters C such that C appears in 
  2853.   --| Char.  If at least one is found, return Found => TRUE, 
  2854.   --| Result => <the characters>.
  2855.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2856.  
  2857.   --| Modifies: Raises, Modifies, Errors
  2858.  
  2859.   --| Notes:
  2860.   --| Scan_Sequence("0123456789", S, Index, Found, Result)
  2861.   --| is equivalent to Scan_Number(S, Index, Found, Result)
  2862.   --| but is less efficient.
  2863.  
  2864.   ----------------------------------------------------------------
  2865.  
  2866.   procedure SCAN_SEQUENCE( --| Scan arbitrary sequence of characters
  2867.                           CHARS  : in STRING; 
  2868.                                 --| Characters that should be scanned
  2869.                           T      : in SCANNER;  --| String to be scanned
  2870.                           FOUND  : out BOOLEAN;  --| TRUE iff a sequence found
  2871.                           RESULT : out STRING_TYPE; 
  2872.                                 --| Sequence scanned from string
  2873.                           SKIP   : in BOOLEAN := FALSE
  2874.                           --| Skip white spaces before scan
  2875.                           ); 
  2876.  
  2877.   --| Effects: Scan T for a sequence of characters C such that C appears in 
  2878.   --| Char.  If at least one is found, return Found => TRUE, 
  2879.   --| Result => <the characters>.
  2880.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2881.  
  2882.   --| Modifies: Raises, Modifies, Errors
  2883.  
  2884.   --| Notes:
  2885.   --| Scan_Sequence("0123456789", S, Index, Found, Result)
  2886.   --| is equivalent to Scan_Number(S, Index, Found, Result)
  2887.   --| but is less efficient.
  2888.   pragma PAGE; 
  2889.   function IS_NOT_SEQUENCE( --| Check if T is not at some seuqnce of character 
  2890.                            CHARS : in STRING_TYPE;  --| Characters to be scanned
  2891.                            T     : in SCANNER --| The string being scanned
  2892.                            ) return BOOLEAN; 
  2893.  
  2894.   --| Effects: Return TRUE iff T is not at some character of Chars.
  2895.   --| Modifies: Raises, Modifies, Errors
  2896.  
  2897.   ----------------------------------------------------------------
  2898.  
  2899.   function IS_NOT_SEQUENCE( --| Check if T is at some sequence of characters 
  2900.                            CHARS : in STRING;  --| Characters to be scanned
  2901.                            T     : in SCANNER --| The string being scanned
  2902.                            ) return BOOLEAN; 
  2903.  
  2904.   --| Effects: Return TRUE iff T is not at some character of Chars.
  2905.   --| Modifies: Raises, Modifies, Errors
  2906.  
  2907.   ----------------------------------------------------------------
  2908.  
  2909.   procedure SCAN_NOT_SEQUENCE( --| Scan arbitrary sequence of characters
  2910.                               CHARS  : in STRING_TYPE; 
  2911.                                 --| Characters that should be scanned
  2912.                               T      : in SCANNER;  --| String to be scanned
  2913.                               FOUND  : out BOOLEAN; 
  2914.                                 --| TRUE iff a sequence found
  2915.                               RESULT : out STRING_TYPE; 
  2916.                                 --| Sequence scanned from string
  2917.                               SKIP   : in BOOLEAN := FALSE
  2918.                               --| Skip white spaces before scan
  2919.                               ); 
  2920.  
  2921. --| Effects: Scan T for a sequence of characters C such that C does not appear
  2922.   --| in Chars.  If at least one such C is found, return Found => TRUE, 
  2923.   --| Result => <the characters>.
  2924.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2925.  
  2926.   --| Modifies: Raises, Modifies, Errors
  2927.  
  2928.   ----------------------------------------------------------------
  2929.  
  2930.   procedure SCAN_NOT_SEQUENCE( --| Scan arbitrary sequence of characters
  2931.                               CHARS  : in STRING; 
  2932.                                 --| Characters that should be scanned
  2933.                               T      : in SCANNER;  --| String to be scanned
  2934.                               FOUND  : out BOOLEAN; 
  2935.                                 --| TRUE iff a sequence found
  2936.                               RESULT : out STRING_TYPE; 
  2937.                                 --| Sequence scanned from string
  2938.                               SKIP   : in BOOLEAN := FALSE
  2939.                               --| Skip white spaces before scan
  2940.                               ); 
  2941.  
  2942. --| Effects: Scan T for a sequence of characters C such that C does not appear
  2943.   --| in Chars.  If at least one such C is found, return Found => TRUE, 
  2944.   --| Result => <the characters>.
  2945.   --| Otherwise return Found => FALSE and Result is unpredictable.
  2946.  
  2947.   --| Modifies: Raises, Modifies, Errors
  2948.   pragma PAGE; 
  2949.   function IS_LITERAL( --| Check if T is at literal Chars
  2950.                       CHARS : in STRING_TYPE;  --| Characters to be scanned
  2951.                       T     : in SCANNER --| The string being scanned
  2952.                       ) return BOOLEAN; 
  2953.  
  2954.   --| Effects: Return TRUE iff T is at literal Chars.
  2955.   --| Modifies: Raises, Modifies, Errors
  2956.  
  2957.   ----------------------------------------------------------------
  2958.  
  2959.   function IS_LITERAL( --| Check if T is at literal Chars
  2960.                       CHARS : in STRING;  --| Characters to be scanned
  2961.                       T     : in SCANNER --| The string being scanned
  2962.                       ) return BOOLEAN; 
  2963.  
  2964.   --| Effects: Return TRUE iff T is at literal Chars.
  2965.   --| Modifies: Raises, Modifies, Errors
  2966.  
  2967.   ----------------------------------------------------------------
  2968.  
  2969.   procedure SCAN_LITERAL( --| Scan arbitrary literal
  2970.                          CHARS : in STRING_TYPE; 
  2971.                                 --| Literal that should be scanned
  2972.                          T     : in SCANNER;  --| String to be scanned
  2973.                          FOUND : out BOOLEAN;  --| TRUE iff a sequence found
  2974.                          SKIP  : in BOOLEAN := FALSE
  2975.                          --| Skip white spaces before scan
  2976.                          ); 
  2977.  
  2978.   --| Effects: Scan T for a litral Chars such that Char matches the sequence
  2979.   --| of characters in T.  If found, return Found => TRUE, 
  2980.   --| Otherwise return Found => FALSE
  2981.  
  2982.   --| Modifies: Raises, Modifies, Errors
  2983.  
  2984.   ----------------------------------------------------------------
  2985.  
  2986.   procedure SCAN_LITERAL( --| Scan arbitrary literal
  2987.                          CHARS : in STRING;  --| Literal that should be scanned
  2988.                          T     : in SCANNER;  --| String to be scanned
  2989.                          FOUND : out BOOLEAN;  --| TRUE iff a sequence found
  2990.                          SKIP  : in BOOLEAN := FALSE
  2991.                          --| Skip white spaces before scan
  2992.                          ); 
  2993.  
  2994.   --| Effects: Scan T for a litral Chars such that Char matches the sequence
  2995.   --| of characters in T.  If found, return Found => TRUE, 
  2996.   --| Otherwise return Found => FALSE
  2997.  
  2998.   --| Modifies: Raises, Modifies, Errors
  2999.   pragma PAGE; 
  3000.   function IS_NOT_LITERAL( --| Check if T is not at literal Chars
  3001.                           CHARS : in STRING;  --| Characters to be scanned
  3002.                           T     : in SCANNER --| The string being scanned
  3003.                           ) return BOOLEAN; 
  3004.  
  3005.   --| Effects: Return TRUE iff T is not at literal Chars
  3006.   --| Modifies: Raises, Modifies, Errors
  3007.  
  3008.   ----------------------------------------------------------------
  3009.  
  3010.   function IS_NOT_LITERAL( --| Check if T is not at literal Chars
  3011.                           CHARS : in STRING_TYPE;  --| Characters to be scanned
  3012.                           T     : in SCANNER --| The string being scanned
  3013.                           ) return BOOLEAN; 
  3014.  
  3015.   --| Effects: Return TRUE iff T is not at literal Chars
  3016.   --| Modifies: Raises, Modifies, Errors
  3017.  
  3018.   ----------------------------------------------------------------
  3019.  
  3020.   procedure SCAN_NOT_LITERAL( --| Scan arbitrary literal
  3021.                              CHARS  : in STRING; 
  3022.                                 --| Literal that should be scanned
  3023.                              T      : in SCANNER;  --| String to be scanned
  3024.                              FOUND  : out BOOLEAN; 
  3025.                                 --| TRUE iff a sequence found
  3026.                              RESULT : out STRING_TYPE;  --| String up to literal
  3027.                              SKIP   : in BOOLEAN := FALSE
  3028.                              --| Skip white spaces before scan
  3029.                              ); 
  3030.  
  3031.   --| Effects: Scan T for a litral Chars such that Char does not match the
  3032.   --| sequence of characters in T.  If found, return Found => TRUE, 
  3033.   --| Otherwise return Found => FALSE
  3034.  
  3035.   --| Modifies: Raises, Modifies, Errors
  3036.  
  3037.   ----------------------------------------------------------------
  3038.  
  3039.   procedure SCAN_NOT_LITERAL( --| Scan arbitrary literal
  3040.                              CHARS  : in STRING_TYPE; 
  3041.                                 --| Literal that should be scanned
  3042.                              T      : in SCANNER;  --| String to be scanned
  3043.                              FOUND  : out BOOLEAN; 
  3044.                                 --| TRUE iff a sequence found
  3045.                              RESULT : out STRING_TYPE;  --| String up to literal
  3046.                              SKIP   : in BOOLEAN := FALSE
  3047.                              --| Skip white spaces before scan
  3048.                              ); 
  3049.  
  3050.   --| Effects: Scan T for a litral Chars such that Char does not match the
  3051.   --| sequence of characters in T.  If found, return Found => TRUE, 
  3052.   --| Otherwise return Found => FALSE
  3053.  
  3054.   --| Modifies: Raises, Modifies, Errors
  3055.   pragma PAGE; 
  3056. private
  3057.   pragma LIST(OFF); 
  3058.   type SCAN_RECORD is 
  3059.     record
  3060.       TEXT  : STRING_TYPE;  --| Copy of string being scanned
  3061.       INDEX : POSITIVE := 1;  --| Current position of Scanner
  3062.       MARK  : NATURAL := 0;  --| Mark
  3063.     end record; 
  3064.  
  3065.   type SCANNER is access SCAN_RECORD; 
  3066.   pragma LIST(ON); 
  3067. end STRING_SCANNER; 
  3068. pragma PAGE; 
  3069. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3070. --scanner.bdy
  3071. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3072. with STRING_PKG; use STRING_PKG; 
  3073. with UNCHECKED_DEALLOCATION; 
  3074.  
  3075. package body STRING_SCANNER is 
  3076.  
  3077.  
  3078.   WHITE_SPACE : constant STRING := " " & ASCII.HT; 
  3079.   NUMBER_1    : constant STRING := "0123456789"; 
  3080.   NUMBER      : constant STRING := NUMBER_1 & "_"; 
  3081.   QUOTE       : constant STRING := """"; 
  3082.   ADA_ID_1    : constant STRING := 
  3083.     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 
  3084.   ADA_ID      : constant STRING := ADA_ID_1 & NUMBER; 
  3085.  
  3086.   procedure FREE_SCANNER is 
  3087.     new UNCHECKED_DEALLOCATION(SCAN_RECORD, SCANNER); 
  3088.   pragma PAGE; 
  3089.   function IS_VALID(T : in SCANNER) return BOOLEAN is 
  3090.  
  3091.   begin
  3092.  
  3093.     return T /= null; 
  3094.  
  3095.   end IS_VALID; 
  3096.  
  3097.   function MAKE_SCANNER(S : in STRING_TYPE) return SCANNER is 
  3098.  
  3099.     T : SCANNER := new SCAN_RECORD; 
  3100.  
  3101.   begin
  3102.  
  3103.     T.TEXT := STRING_PKG.MAKE_PERSISTENT(S); 
  3104.     return T; 
  3105.  
  3106.   end MAKE_SCANNER; 
  3107.  
  3108.   ----------------------------------------------------------------
  3109.  
  3110.   procedure DESTROY_SCANNER(T : in out SCANNER) is 
  3111.  
  3112.   begin
  3113.  
  3114.     if IS_VALID(T) then 
  3115.       STRING_PKG.FLUSH(T.TEXT); 
  3116.       FREE_SCANNER(T); 
  3117.     end if; 
  3118.  
  3119.   end DESTROY_SCANNER; 
  3120.  
  3121.   ----------------------------------------------------------------
  3122.  
  3123.   function MORE(T : in SCANNER) return BOOLEAN is 
  3124.  
  3125.   begin
  3126.  
  3127.     if IS_VALID(T) then 
  3128.       if T.INDEX > STRING_PKG.LENGTH(T.TEXT) then 
  3129.         return FALSE; 
  3130.       else 
  3131.         return TRUE; 
  3132.       end if; 
  3133.     else 
  3134.       return FALSE; 
  3135.     end if; 
  3136.  
  3137.   end MORE; 
  3138.  
  3139.   ----------------------------------------------------------------
  3140.  
  3141.   function GET(T : in SCANNER) return CHARACTER is 
  3142.  
  3143.   begin
  3144.  
  3145.     if not MORE(T) then 
  3146.       raise OUT_OF_BOUNDS; 
  3147.     end if; 
  3148.     return STRING_PKG.FETCH(T.TEXT, T.INDEX); 
  3149.  
  3150.   end GET; 
  3151.  
  3152.   ----------------------------------------------------------------
  3153.  
  3154.   procedure FORWARD(T : in SCANNER) is 
  3155.  
  3156.   begin
  3157.  
  3158.     if IS_VALID(T) then 
  3159.       if STRING_PKG.LENGTH(T.TEXT) >= T.INDEX then 
  3160.         T.INDEX := T.INDEX + 1; 
  3161.       end if; 
  3162.     end if; 
  3163.  
  3164.   end FORWARD; 
  3165.  
  3166.   ----------------------------------------------------------------
  3167.  
  3168.   procedure BACKWARD(T : in SCANNER) is 
  3169.  
  3170.   begin
  3171.  
  3172.     if IS_VALID(T) then 
  3173.       if T.INDEX > 1 then 
  3174.         T.INDEX := T.INDEX - 1; 
  3175.       end if; 
  3176.     end if; 
  3177.  
  3178.   end BACKWARD; 
  3179.  
  3180.   ----------------------------------------------------------------
  3181.  
  3182.   procedure NEXT(T : in SCANNER; 
  3183.                  C : out CHARACTER) is 
  3184.  
  3185.   begin
  3186.  
  3187.     C := GET(T); 
  3188.     FORWARD(T); 
  3189.  
  3190.   end NEXT; 
  3191.  
  3192.   ----------------------------------------------------------------
  3193.  
  3194.   function POSITION(T : in SCANNER) return POSITIVE is 
  3195.  
  3196.   begin
  3197.  
  3198.     if not MORE(T) then 
  3199.       raise OUT_OF_BOUNDS; 
  3200.     end if; 
  3201.     return T.INDEX; 
  3202.  
  3203.   end POSITION; 
  3204.  
  3205.   ----------------------------------------------------------------
  3206.  
  3207.   function GET_STRING(T : in SCANNER) return STRING_TYPE is 
  3208.  
  3209.   begin
  3210.  
  3211.     if IS_VALID(T) then 
  3212.       return STRING_PKG.MAKE_PERSISTENT(T.TEXT); 
  3213.     else 
  3214.       return STRING_PKG.MAKE_PERSISTENT(""); 
  3215.     end if; 
  3216.  
  3217.   end GET_STRING; 
  3218.  
  3219.   ----------------------------------------------------------------
  3220.  
  3221.   function GET_REMAINDER(T : in SCANNER) return STRING_TYPE is 
  3222.  
  3223.     S_STR : STRING_TYPE; 
  3224.  
  3225.   begin
  3226.  
  3227.     if MORE(T) then 
  3228.       STRING_PKG.MARK; 
  3229.       S_STR := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, 
  3230.         STRING_PKG.LENGTH(T.TEXT) - T.INDEX + 1)); 
  3231.       STRING_PKG.RELEASE; 
  3232.     else 
  3233.       S_STR := STRING_PKG.MAKE_PERSISTENT(""); 
  3234.     end if; 
  3235.     return S_STR; 
  3236.  
  3237.   end GET_REMAINDER; 
  3238.  
  3239.   ----------------------------------------------------------------
  3240.  
  3241.   procedure MARK(T : in SCANNER) is 
  3242.  
  3243.   begin
  3244.  
  3245.     if IS_VALID(T) then 
  3246.       if T.MARK /= 0 then 
  3247.         raise SCANNER_ALREADY_MARKED; 
  3248.       else 
  3249.         T.MARK := T.INDEX; 
  3250.       end if; 
  3251.     end if; 
  3252.  
  3253.   end MARK; 
  3254.  
  3255.   ----------------------------------------------------------------
  3256.  
  3257.   procedure RESTORE(T : in SCANNER) is 
  3258.  
  3259.   begin
  3260.  
  3261.     if IS_VALID(T) then 
  3262.       if T.MARK /= 0 then 
  3263.         T.INDEX := T.MARK; 
  3264.         T.MARK := 0; 
  3265.       end if; 
  3266.     end if; 
  3267.  
  3268.   end RESTORE; 
  3269.   pragma PAGE; 
  3270.   function IS_ANY(T : in SCANNER; 
  3271.                   Q : in STRING) return BOOLEAN is 
  3272.  
  3273.     N : NATURAL; 
  3274.  
  3275.   begin
  3276.  
  3277.     if not MORE(T) then 
  3278.       return FALSE; 
  3279.     end if; 
  3280.     STRING_PKG.MARK; 
  3281.     N := STRING_PKG.MATCH_ANY(T.TEXT, Q, T.INDEX); 
  3282.     if N /= T.INDEX then 
  3283.       N := 0; 
  3284.     end if; 
  3285.     STRING_PKG.RELEASE; 
  3286.     return N /= 0; 
  3287.  
  3288.   end IS_ANY; 
  3289.   pragma PAGE; 
  3290.   procedure SCAN_ANY(T      : in SCANNER; 
  3291.                      Q      : in STRING; 
  3292.                      FOUND  : out BOOLEAN; 
  3293.                      RESULT : in out STRING_TYPE) is 
  3294.  
  3295.     S_STR : STRING_TYPE; 
  3296.     N     : NATURAL; 
  3297.  
  3298.   begin
  3299.  
  3300.     if IS_ANY(T, Q) then 
  3301.       N := STRING_PKG.MATCH_NONE(T.TEXT, Q, T.INDEX); 
  3302.       if N = 0 then 
  3303.         N := STRING_PKG.LENGTH(T.TEXT) + 1; 
  3304.       end if; 
  3305.       RESULT := RESULT & STRING_PKG.SUBSTR(T.TEXT, T.INDEX, N - T.INDEX); 
  3306.       T.INDEX := N; 
  3307.       FOUND := TRUE; 
  3308.     else 
  3309.       FOUND := FALSE; 
  3310.     end if; 
  3311.  
  3312.   end SCAN_ANY; 
  3313.   pragma PAGE; 
  3314.   function QUOTED_STRING(T : in SCANNER) return INTEGER is 
  3315.  
  3316.     COUNT : INTEGER := 0; 
  3317.     I     : POSITIVE; 
  3318.     N     : NATURAL; 
  3319.  
  3320.   begin
  3321.  
  3322.     if not IS_VALID(T) then 
  3323.       return COUNT; 
  3324.     end if; 
  3325.     I := T.INDEX; 
  3326.     while IS_ANY(T, """") loop
  3327.       T.INDEX := T.INDEX + 1; 
  3328.       if not MORE(T) then 
  3329.         T.INDEX := I; 
  3330.         return 0; 
  3331.       end if; 
  3332.       STRING_PKG.MARK; 
  3333.       N := STRING_PKG.MATCH_ANY(T.TEXT, """", T.INDEX); 
  3334.       STRING_PKG.RELEASE; 
  3335.       if N = 0 then 
  3336.         T.INDEX := I; 
  3337.         return 0; 
  3338.       end if; 
  3339.       T.INDEX := N + 1; 
  3340.     end loop; 
  3341.     COUNT := T.INDEX - I; 
  3342.     T.INDEX := I; 
  3343.     return COUNT; 
  3344.  
  3345.   end QUOTED_STRING; 
  3346.   pragma PAGE; 
  3347.   function ENCLOSED_STRING(B : in CHARACTER; 
  3348.                            E : in CHARACTER; 
  3349.                            T : in SCANNER) return NATURAL is 
  3350.  
  3351.     COUNT : NATURAL := 1; 
  3352.     I     : POSITIVE; 
  3353.     INX_B : NATURAL; 
  3354.     INX_E : NATURAL; 
  3355.     DEPTH : NATURAL := 1; 
  3356.  
  3357.   begin
  3358.  
  3359.     if not IS_ANY(T, B & "") then 
  3360.       return 0; 
  3361.     end if; 
  3362.     I := T.INDEX; 
  3363.     FORWARD(T); 
  3364.     while DEPTH /= 0 loop
  3365.       if not MORE(T) then 
  3366.         T.INDEX := I; 
  3367.         return 0; 
  3368.       end if; 
  3369.       STRING_PKG.MARK; 
  3370.       INX_B := STRING_PKG.MATCH_ANY(T.TEXT, B & "", T.INDEX); 
  3371.       INX_E := STRING_PKG.MATCH_ANY(T.TEXT, E & "", T.INDEX); 
  3372.       STRING_PKG.RELEASE; 
  3373.       if INX_E = 0 then 
  3374.         T.INDEX := I; 
  3375.         return 0; 
  3376.       end if; 
  3377.       if INX_B /= 0 and then INX_B < INX_E then 
  3378.         DEPTH := DEPTH + 1; 
  3379.       else 
  3380.         INX_B := INX_E; 
  3381.         DEPTH := DEPTH - 1; 
  3382.       end if; 
  3383.       T.INDEX := INX_B + 1; 
  3384.     end loop; 
  3385.     COUNT := T.INDEX - I; 
  3386.     T.INDEX := I; 
  3387.     return COUNT; 
  3388.  
  3389.   end ENCLOSED_STRING; 
  3390.   pragma PAGE; 
  3391.   function IS_WORD(T : in SCANNER) return BOOLEAN is 
  3392.  
  3393.   begin
  3394.  
  3395.     if not MORE(T) then 
  3396.       return FALSE; 
  3397.     else 
  3398.       return not IS_ANY(T, WHITE_SPACE); 
  3399.     end if; 
  3400.  
  3401.   end IS_WORD; 
  3402.  
  3403.   ----------------------------------------------------------------
  3404.  
  3405.   procedure SCAN_WORD(T      : in SCANNER; 
  3406.                       FOUND  : out BOOLEAN; 
  3407.                       RESULT : out STRING_TYPE; 
  3408.                       SKIP   : in BOOLEAN := FALSE) is 
  3409.  
  3410.     S_STR : STRING_TYPE; 
  3411.     N     : NATURAL; 
  3412.  
  3413.   begin
  3414.  
  3415.     if SKIP then 
  3416.       SKIP_SPACE(T); 
  3417.     end if; 
  3418.     if IS_WORD(T) then 
  3419.       STRING_PKG.MARK; 
  3420.       N := STRING_PKG.MATCH_ANY(T.TEXT, WHITE_SPACE, T.INDEX); 
  3421.       if N = 0 then 
  3422.         N := STRING_PKG.LENGTH(T.TEXT) + 1; 
  3423.       end if; 
  3424.       RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, N
  3425.         - T.INDEX)); 
  3426.       T.INDEX := N; 
  3427.       FOUND := TRUE; 
  3428.       STRING_PKG.RELEASE; 
  3429.     else 
  3430.       FOUND := FALSE; 
  3431.     end if; 
  3432.     return; 
  3433.  
  3434.   end SCAN_WORD; 
  3435.   pragma PAGE; 
  3436.   function IS_NUMBER(T : in SCANNER) return BOOLEAN is 
  3437.  
  3438.   begin
  3439.  
  3440.     return IS_ANY(T, NUMBER_1); 
  3441.  
  3442.   end IS_NUMBER; 
  3443.  
  3444.   ----------------------------------------------------------------
  3445.  
  3446.   procedure SCAN_NUMBER(T      : in SCANNER; 
  3447.                         FOUND  : out BOOLEAN; 
  3448.                         RESULT : out STRING_TYPE; 
  3449.                         SKIP   : in BOOLEAN := FALSE) is 
  3450.  
  3451.     C     : CHARACTER; 
  3452.     S_STR : STRING_TYPE; 
  3453.  
  3454.   begin
  3455.  
  3456.     if SKIP then 
  3457.       SKIP_SPACE(T); 
  3458.     end if; 
  3459.     if not IS_NUMBER(T) then 
  3460.       FOUND := FALSE; 
  3461.       return; 
  3462.     end if; 
  3463.     STRING_PKG.MARK; 
  3464.     while IS_NUMBER(T) loop
  3465.       SCAN_ANY(T, NUMBER_1, FOUND, S_STR); 
  3466.       if MORE(T) then 
  3467.         C := GET(T); 
  3468.         if C = '_' then 
  3469.           FORWARD(T); 
  3470.           if IS_NUMBER(T) then 
  3471.             S_STR := S_STR & "_"; 
  3472.           else 
  3473.             BACKWARD(T); 
  3474.           end if; 
  3475.         end if; 
  3476.       end if; 
  3477.     end loop; 
  3478.     RESULT := STRING_PKG.MAKE_PERSISTENT(S_STR); 
  3479.     STRING_PKG.RELEASE; 
  3480.  
  3481.   end SCAN_NUMBER; 
  3482.  
  3483.   ----------------------------------------------------------------
  3484.  
  3485.   procedure SCAN_NUMBER(T      : in SCANNER; 
  3486.                         FOUND  : out BOOLEAN; 
  3487.                         RESULT : out INTEGER; 
  3488.                         SKIP   : in BOOLEAN := FALSE) is 
  3489.  
  3490.     F     : BOOLEAN; 
  3491.     S_STR : STRING_TYPE; 
  3492.  
  3493.   begin
  3494.  
  3495.     SCAN_NUMBER(T, F, S_STR, SKIP); 
  3496.     if F then 
  3497.       RESULT := INTEGER'VALUE(STRING_PKG.VALUE(S_STR)); 
  3498.     end if; 
  3499.     FOUND := F; 
  3500.  
  3501.   end SCAN_NUMBER; 
  3502.   pragma PAGE; 
  3503.   function IS_SIGNED_NUMBER(T : in SCANNER) return BOOLEAN is 
  3504.  
  3505.     I : POSITIVE; 
  3506.     C : CHARACTER; 
  3507.     F : BOOLEAN; 
  3508.  
  3509.   begin
  3510.  
  3511.     if MORE(T) then 
  3512.       I := T.INDEX; 
  3513.       C := GET(T); 
  3514.       if C = '+' or C = '-' then 
  3515.         T.INDEX := T.INDEX + 1; 
  3516.       end if; 
  3517.       F := IS_ANY(T, NUMBER_1); 
  3518.       T.INDEX := I; 
  3519.       return F; 
  3520.     else 
  3521.       return FALSE; 
  3522.     end if; 
  3523.  
  3524.   end IS_SIGNED_NUMBER; 
  3525.  
  3526.   ----------------------------------------------------------------
  3527.  
  3528.   procedure SCAN_SIGNED_NUMBER(T      : in SCANNER; 
  3529.                                FOUND  : out BOOLEAN; 
  3530.                                RESULT : out STRING_TYPE; 
  3531.                                SKIP   : in BOOLEAN := FALSE) is 
  3532.  
  3533.     C     : CHARACTER; 
  3534.     S_STR : STRING_TYPE; 
  3535.  
  3536.   begin
  3537.  
  3538.     if SKIP then 
  3539.       SKIP_SPACE(T); 
  3540.     end if; 
  3541.     if IS_SIGNED_NUMBER(T) then 
  3542.       C := GET(T); 
  3543.       if C = '+' or C = '-' then 
  3544.         FORWARD(T); 
  3545.       end if; 
  3546.       SCAN_NUMBER(T, FOUND, S_STR); 
  3547.       STRING_PKG.MARK; 
  3548.       if C = '+' or C = '-' then 
  3549.         RESULT := STRING_PKG.MAKE_PERSISTENT(("" & C) & S_STR); 
  3550.       else 
  3551.         RESULT := STRING_PKG.MAKE_PERSISTENT(S_STR); 
  3552.       end if; 
  3553.       STRING_PKG.RELEASE; 
  3554.       STRING_PKG.FLUSH(S_STR); 
  3555.     else 
  3556.       FOUND := FALSE; 
  3557.     end if; 
  3558.  
  3559.   end SCAN_SIGNED_NUMBER; 
  3560.  
  3561.   ----------------------------------------------------------------
  3562.  
  3563.   procedure SCAN_SIGNED_NUMBER(T      : in SCANNER; 
  3564.                                FOUND  : out BOOLEAN; 
  3565.                                RESULT : out INTEGER; 
  3566.                                SKIP   : in BOOLEAN := FALSE) is 
  3567.  
  3568.     F     : BOOLEAN; 
  3569.     S_STR : STRING_TYPE; 
  3570.  
  3571.   begin
  3572.  
  3573.     SCAN_SIGNED_NUMBER(T, F, S_STR, SKIP); 
  3574.     if F then 
  3575.       RESULT := INTEGER'VALUE(STRING_PKG.VALUE(S_STR)); 
  3576.     end if; 
  3577.     FOUND := F; 
  3578.  
  3579.   end SCAN_SIGNED_NUMBER; 
  3580.   pragma PAGE; 
  3581.   function IS_SPACE(T : in SCANNER) return BOOLEAN is 
  3582.  
  3583.   begin
  3584.  
  3585.     return IS_ANY(T, WHITE_SPACE); 
  3586.  
  3587.   end IS_SPACE; 
  3588.  
  3589.   ----------------------------------------------------------------
  3590.  
  3591.   procedure SCAN_SPACE(T      : in SCANNER; 
  3592.                        FOUND  : out BOOLEAN; 
  3593.                        RESULT : out STRING_TYPE) is 
  3594.  
  3595.     S_STR : STRING_TYPE; 
  3596.  
  3597.   begin
  3598.  
  3599.     STRING_PKG.MARK; 
  3600.     SCAN_ANY(T, WHITE_SPACE, FOUND, S_STR); 
  3601.     RESULT := STRING_PKG.MAKE_PERSISTENT(S_STR); 
  3602.     STRING_PKG.RELEASE; 
  3603.  
  3604.   end SCAN_SPACE; 
  3605.  
  3606.   ----------------------------------------------------------------
  3607.  
  3608.   procedure SKIP_SPACE(T : in SCANNER) is 
  3609.  
  3610.     S_STR : STRING_TYPE; 
  3611.     FOUND : BOOLEAN; 
  3612.  
  3613.   begin
  3614.  
  3615.     STRING_PKG.MARK; 
  3616.     SCAN_ANY(T, WHITE_SPACE, FOUND, S_STR); 
  3617.     STRING_PKG.RELEASE; 
  3618.  
  3619.   end SKIP_SPACE; 
  3620.   pragma PAGE; 
  3621.   function IS_ADA_ID(T : in SCANNER) return BOOLEAN is 
  3622.  
  3623.   begin
  3624.  
  3625.     return IS_ANY(T, ADA_ID_1); 
  3626.  
  3627.   end IS_ADA_ID; 
  3628.  
  3629.   ----------------------------------------------------------------
  3630.  
  3631.   procedure SCAN_ADA_ID(T      : in SCANNER; 
  3632.                         FOUND  : out BOOLEAN; 
  3633.                         RESULT : out STRING_TYPE; 
  3634.                         SKIP   : in BOOLEAN := FALSE) is 
  3635.  
  3636.     C     : CHARACTER; 
  3637.     F     : BOOLEAN; 
  3638.     S_STR : STRING_TYPE; 
  3639.  
  3640.   begin
  3641.  
  3642.     if SKIP then 
  3643.       SKIP_SPACE(T); 
  3644.     end if; 
  3645.     if IS_ADA_ID(T) then 
  3646.       STRING_PKG.MARK; 
  3647.       NEXT(T, C); 
  3648.       SCAN_ANY(T, ADA_ID, F, S_STR); 
  3649.       RESULT := STRING_PKG.MAKE_PERSISTENT(("" & C) & S_STR); 
  3650.       FOUND := TRUE; 
  3651.       STRING_PKG.RELEASE; 
  3652.     else 
  3653.       FOUND := FALSE; 
  3654.     end if; 
  3655.  
  3656.   end SCAN_ADA_ID; 
  3657.   pragma PAGE; 
  3658.   function IS_QUOTED(T : in SCANNER) return BOOLEAN is 
  3659.  
  3660.   begin
  3661.  
  3662.     if QUOTED_STRING(T) = 0 then 
  3663.       return FALSE; 
  3664.     else 
  3665.       return TRUE; 
  3666.     end if; 
  3667.  
  3668.   end IS_QUOTED; 
  3669.  
  3670.   ----------------------------------------------------------------
  3671.  
  3672.   procedure SCAN_QUOTED(T      : in SCANNER; 
  3673.                         FOUND  : out BOOLEAN; 
  3674.                         RESULT : out STRING_TYPE; 
  3675.                         SKIP   : in BOOLEAN := FALSE) is 
  3676.  
  3677.     COUNT : INTEGER; 
  3678.  
  3679.   begin
  3680.  
  3681.     if SKIP then 
  3682.       SKIP_SPACE(T); 
  3683.     end if; 
  3684.     COUNT := QUOTED_STRING(T); 
  3685.     if COUNT /= 0 then 
  3686.       COUNT := COUNT - 2; 
  3687.       T.INDEX := T.INDEX + 1; 
  3688.       if COUNT /= 0 then 
  3689.         STRING_PKG.MARK; 
  3690.         RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, 
  3691.           POSITIVE(COUNT))); 
  3692.         STRING_PKG.RELEASE; 
  3693.       else 
  3694.         RESULT := STRING_PKG.MAKE_PERSISTENT(""); 
  3695.       end if; 
  3696.       T.INDEX := T.INDEX + COUNT + 1; 
  3697.       FOUND := TRUE; 
  3698.     else 
  3699.       FOUND := FALSE; 
  3700.     end if; 
  3701.  
  3702.   end SCAN_QUOTED; 
  3703.   pragma PAGE; 
  3704.   function IS_ENCLOSED(B : in CHARACTER; 
  3705.                        E : in CHARACTER; 
  3706.                        T : in SCANNER) return BOOLEAN is 
  3707.  
  3708.   begin
  3709.  
  3710.     if ENCLOSED_STRING(B, E, T) = 0 then 
  3711.       return FALSE; 
  3712.     else 
  3713.       return TRUE; 
  3714.     end if; 
  3715.  
  3716.   end IS_ENCLOSED; 
  3717.  
  3718.   ----------------------------------------------------------------
  3719.  
  3720.   procedure SCAN_ENCLOSED(B      : in CHARACTER; 
  3721.                           E      : in CHARACTER; 
  3722.                           T      : in SCANNER; 
  3723.                           FOUND  : out BOOLEAN; 
  3724.                           RESULT : out STRING_TYPE; 
  3725.                           SKIP   : in BOOLEAN := FALSE) is 
  3726.  
  3727.     COUNT : NATURAL; 
  3728.  
  3729.   begin
  3730.  
  3731.     if SKIP then 
  3732.       SKIP_SPACE(T); 
  3733.     end if; 
  3734.     COUNT := ENCLOSED_STRING(B, E, T); 
  3735.     if COUNT /= 0 then 
  3736.       COUNT := COUNT - 2; 
  3737.       T.INDEX := T.INDEX + 1; 
  3738.       if COUNT /= 0 then 
  3739.         STRING_PKG.MARK; 
  3740.         RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, 
  3741.           POSITIVE(COUNT))); 
  3742.         STRING_PKG.RELEASE; 
  3743.       else 
  3744.         RESULT := STRING_PKG.MAKE_PERSISTENT(""); 
  3745.       end if; 
  3746.       T.INDEX := T.INDEX + COUNT + 1; 
  3747.       FOUND := TRUE; 
  3748.     else 
  3749.       FOUND := FALSE; 
  3750.     end if; 
  3751.  
  3752.   end SCAN_ENCLOSED; 
  3753.   pragma PAGE; 
  3754.   function IS_SEQUENCE(CHARS : in STRING_TYPE; 
  3755.                        T     : in SCANNER) return BOOLEAN is 
  3756.  
  3757.   begin
  3758.  
  3759.     return IS_ANY(T, STRING_PKG.VALUE(CHARS)); 
  3760.  
  3761.   end IS_SEQUENCE; 
  3762.  
  3763.   ----------------------------------------------------------------
  3764.  
  3765.   function IS_SEQUENCE(CHARS : in STRING; 
  3766.                        T     : in SCANNER) return BOOLEAN is 
  3767.  
  3768.   begin
  3769.  
  3770.     return IS_ANY(T, CHARS); 
  3771.  
  3772.   end IS_SEQUENCE; 
  3773.  
  3774.   ----------------------------------------------------------------
  3775.  
  3776.   procedure SCAN_SEQUENCE(CHARS  : in STRING_TYPE; 
  3777.                           T      : in SCANNER; 
  3778.                           FOUND  : out BOOLEAN; 
  3779.                           RESULT : out STRING_TYPE; 
  3780.                           SKIP   : in BOOLEAN := FALSE) is 
  3781.  
  3782.     I     : POSITIVE; 
  3783.     COUNT : INTEGER := 0; 
  3784.  
  3785.   begin
  3786.  
  3787.     if SKIP then 
  3788.       SKIP_SPACE(T); 
  3789.     end if; 
  3790.     if not IS_VALID(T) then 
  3791.       FOUND := FALSE; 
  3792.       return; 
  3793.     end if; 
  3794.     I := T.INDEX; 
  3795.     while IS_ANY(T, VALUE(CHARS)) loop
  3796.       FORWARD(T); 
  3797.       COUNT := COUNT + 1; 
  3798.     end loop; 
  3799.     if COUNT /= 0 then 
  3800.       STRING_PKG.MARK; 
  3801.       RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, I, POSITIVE
  3802.         (COUNT))); 
  3803.       FOUND := TRUE; 
  3804.       STRING_PKG.RELEASE; 
  3805.     else 
  3806.       FOUND := FALSE; 
  3807.     end if; 
  3808.  
  3809.   end SCAN_SEQUENCE; 
  3810.  
  3811.   ----------------------------------------------------------------
  3812.  
  3813.   procedure SCAN_SEQUENCE(CHARS  : in STRING; 
  3814.                           T      : in SCANNER; 
  3815.                           FOUND  : out BOOLEAN; 
  3816.                           RESULT : out STRING_TYPE; 
  3817.                           SKIP   : in BOOLEAN := FALSE) is 
  3818.  
  3819.   begin
  3820.  
  3821.     STRING_PKG.MARK; 
  3822.     SCAN_SEQUENCE(STRING_PKG.CREATE(CHARS), T, FOUND, RESULT, SKIP); 
  3823.     STRING_PKG.RELEASE; 
  3824.  
  3825.   end SCAN_SEQUENCE; 
  3826.   pragma PAGE; 
  3827.   function IS_NOT_SEQUENCE(CHARS : in STRING_TYPE; 
  3828.                            T     : in SCANNER) return BOOLEAN is 
  3829.  
  3830.     N : NATURAL; 
  3831.  
  3832.   begin
  3833.  
  3834.     if not IS_VALID(T) then 
  3835.       return FALSE; 
  3836.     end if; 
  3837.     STRING_PKG.MARK; 
  3838.     N := STRING_PKG.MATCH_ANY(T.TEXT, CHARS, T.INDEX); 
  3839.     if N = T.INDEX then 
  3840.       N := 0; 
  3841.     end if; 
  3842.     STRING_PKG.RELEASE; 
  3843.     return N /= 0; 
  3844.  
  3845.   end IS_NOT_SEQUENCE; 
  3846.  
  3847.   ----------------------------------------------------------------
  3848.  
  3849.   function IS_NOT_SEQUENCE(CHARS : in STRING; 
  3850.                            T     : in SCANNER) return BOOLEAN is 
  3851.  
  3852.   begin
  3853.  
  3854.     return IS_NOT_SEQUENCE(STRING_PKG.CREATE(CHARS), T); 
  3855.  
  3856.   end IS_NOT_SEQUENCE; 
  3857.  
  3858.   ----------------------------------------------------------------
  3859.  
  3860.   procedure SCAN_NOT_SEQUENCE(CHARS  : in STRING; 
  3861.                               T      : in SCANNER; 
  3862.                               FOUND  : out BOOLEAN; 
  3863.                               RESULT : out STRING_TYPE; 
  3864.                               SKIP   : in BOOLEAN := FALSE) is 
  3865.  
  3866.     N : NATURAL; 
  3867.  
  3868.   begin
  3869.  
  3870.     if SKIP then 
  3871.       SKIP_SPACE(T); 
  3872.     end if; 
  3873.     if IS_NOT_SEQUENCE(CHARS, T) then 
  3874.       STRING_PKG.MARK; 
  3875.       N := STRING_PKG.MATCH_ANY(T.TEXT, CHARS, T.INDEX); 
  3876.       RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, N
  3877.         - T.INDEX)); 
  3878.       T.INDEX := N; 
  3879.       FOUND := TRUE; 
  3880.       STRING_PKG.RELEASE; 
  3881.     else 
  3882.       FOUND := FALSE; 
  3883.     end if; 
  3884.  
  3885.   end SCAN_NOT_SEQUENCE; 
  3886.  
  3887.   ----------------------------------------------------------------
  3888.  
  3889.   procedure SCAN_NOT_SEQUENCE(CHARS  : in STRING_TYPE; 
  3890.                               T      : in SCANNER; 
  3891.                               FOUND  : out BOOLEAN; 
  3892.                               RESULT : out STRING_TYPE; 
  3893.                               SKIP   : in BOOLEAN := FALSE) is 
  3894.  
  3895.   begin
  3896.  
  3897.     SCAN_NOT_SEQUENCE(STRING_PKG.VALUE(CHARS), T, FOUND, RESULT, SKIP); 
  3898.  
  3899.   end SCAN_NOT_SEQUENCE; 
  3900.   pragma PAGE; 
  3901.   function IS_LITERAL(CHARS : in STRING_TYPE; 
  3902.                       T     : in SCANNER) return BOOLEAN is 
  3903.  
  3904.     N : NATURAL; 
  3905.  
  3906.   begin
  3907.  
  3908.     if not IS_VALID(T) then 
  3909.       return FALSE; 
  3910.     end if; 
  3911.     STRING_PKG.MARK; 
  3912.     N := STRING_PKG.MATCH_S(T.TEXT, CHARS, T.INDEX); 
  3913.     if N /= T.INDEX then 
  3914.       N := 0; 
  3915.     end if; 
  3916.     STRING_PKG.RELEASE; 
  3917.     return N /= 0; 
  3918.  
  3919.   end IS_LITERAL; 
  3920.  
  3921.   ----------------------------------------------------------------
  3922.  
  3923.   function IS_LITERAL(CHARS : in STRING; 
  3924.                       T     : in SCANNER) return BOOLEAN is 
  3925.  
  3926.     FOUND : BOOLEAN; 
  3927.  
  3928.   begin
  3929.  
  3930.     STRING_PKG.MARK; 
  3931.     FOUND := IS_LITERAL(STRING_PKG.CREATE(CHARS), T); 
  3932.     STRING_PKG.RELEASE; 
  3933.     return FOUND; 
  3934.  
  3935.   end IS_LITERAL; 
  3936.  
  3937.   ----------------------------------------------------------------
  3938.  
  3939.   procedure SCAN_LITERAL(CHARS : in STRING_TYPE; 
  3940.                          T     : in SCANNER; 
  3941.                          FOUND : out BOOLEAN; 
  3942.                          SKIP  : in BOOLEAN := FALSE) is 
  3943.  
  3944.   begin
  3945.  
  3946.     if SKIP then 
  3947.       SKIP_SPACE(T); 
  3948.     end if; 
  3949.     if IS_LITERAL(CHARS, T) then 
  3950.       T.INDEX := T.INDEX + STRING_PKG.LENGTH(CHARS); 
  3951.       FOUND := TRUE; 
  3952.     else 
  3953.       FOUND := FALSE; 
  3954.     end if; 
  3955.  
  3956.   end SCAN_LITERAL; 
  3957.  
  3958.   ----------------------------------------------------------------
  3959.  
  3960.   procedure SCAN_LITERAL(CHARS : in STRING; 
  3961.                          T     : in SCANNER; 
  3962.                          FOUND : out BOOLEAN; 
  3963.                          SKIP  : in BOOLEAN := FALSE) is 
  3964.  
  3965.   begin
  3966.  
  3967.     STRING_PKG.MARK; 
  3968.     SCAN_LITERAL(STRING_PKG.CREATE(CHARS), T, FOUND, SKIP); 
  3969.     STRING_PKG.RELEASE; 
  3970.  
  3971.   end SCAN_LITERAL; 
  3972.   pragma PAGE; 
  3973.   function IS_NOT_LITERAL(CHARS : in STRING; 
  3974.                           T     : in SCANNER) return BOOLEAN is 
  3975.  
  3976.     N : NATURAL; 
  3977.  
  3978.   begin
  3979.  
  3980.     if not IS_VALID(T) then 
  3981.       return FALSE; 
  3982.     end if; 
  3983.     STRING_PKG.MARK; 
  3984.     N := STRING_PKG.MATCH_S(T.TEXT, CHARS, T.INDEX); 
  3985.     if N = T.INDEX then 
  3986.       N := 0; 
  3987.     end if; 
  3988.     STRING_PKG.RELEASE; 
  3989.     return N /= 0; 
  3990.  
  3991.   end IS_NOT_LITERAL; 
  3992.  
  3993.   ----------------------------------------------------------------
  3994.  
  3995.   function IS_NOT_LITERAL(CHARS : in STRING_TYPE; 
  3996.                           T     : in SCANNER) return BOOLEAN is 
  3997.  
  3998.   begin
  3999.  
  4000.     if not MORE(T) then 
  4001.       return FALSE; 
  4002.     end if; 
  4003.     return IS_NOT_LITERAL(STRING_PKG.VALUE(CHARS), T); 
  4004.  
  4005.   end IS_NOT_LITERAL; 
  4006.  
  4007.   ----------------------------------------------------------------
  4008.  
  4009.   procedure SCAN_NOT_LITERAL(CHARS  : in STRING; 
  4010.                              T      : in SCANNER; 
  4011.                              FOUND  : out BOOLEAN; 
  4012.                              RESULT : out STRING_TYPE; 
  4013.                              SKIP   : in BOOLEAN := FALSE) is 
  4014.  
  4015.     N : NATURAL; 
  4016.  
  4017.   begin
  4018.  
  4019.     if SKIP then 
  4020.       SKIP_SPACE(T); 
  4021.     end if; 
  4022.     if IS_NOT_LITERAL(CHARS, T) then 
  4023.       STRING_PKG.MARK; 
  4024.       N := STRING_PKG.MATCH_S(T.TEXT, CHARS, T.INDEX); 
  4025.       RESULT := STRING_PKG.MAKE_PERSISTENT(STRING_PKG.SUBSTR(T.TEXT, T.INDEX, N
  4026.         - T.INDEX)); 
  4027.       T.INDEX := N; 
  4028.       FOUND := TRUE; 
  4029.       STRING_PKG.RELEASE; 
  4030.     else 
  4031.       FOUND := FALSE; 
  4032.       return; 
  4033.     end if; 
  4034.  
  4035.   end SCAN_NOT_LITERAL; 
  4036.  
  4037.   ----------------------------------------------------------------
  4038.  
  4039.   procedure SCAN_NOT_LITERAL(CHARS  : in STRING_TYPE; 
  4040.                              T      : in SCANNER; 
  4041.                              FOUND  : out BOOLEAN; 
  4042.                              RESULT : out STRING_TYPE; 
  4043.                              SKIP   : in BOOLEAN := FALSE) is 
  4044.  
  4045.   begin
  4046.  
  4047.     SCAN_NOT_LITERAL(STRING_PKG.VALUE(CHARS), T, FOUND, RESULT, SKIP); 
  4048.  
  4049.   end SCAN_NOT_LITERAL; 
  4050.  
  4051.  
  4052. end STRING_SCANNER; 
  4053. pragma PAGE; 
  4054. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4055. --sort.spc
  4056. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4057.  
  4058. generic
  4059.   type ITEM_TYPE is private; 
  4060.   --| Component type of array to be sorted.
  4061.  
  4062.   with function "<="(X, Y : in ITEM_TYPE) return BOOLEAN; 
  4063.   --| Required to totally order item_type;
  4064.  
  4065.   type INDEX_TYPE is (<>); 
  4066.   --| Index type of array to be sorted.
  4067.  
  4068.   type SEQUENCE is array(INDEX_TYPE range <>) of ITEM_TYPE; 
  4069.   --| Type of array to be sorted.
  4070.  
  4071. procedure HEAP_SORT(S : in out SEQUENCE); 
  4072. --| Overview:
  4073. --| Heap sort is an O(n lg n) guaranteed time sorting algorithm.
  4074. --| This procedure provides heap sort for arrays of arbitrary index
  4075. --| and component type.
  4076.  
  4077. --| Notes:
  4078. --| Programmer: Ron Kownacki
  4079.  
  4080. --| Effects:
  4081. --|     Let s1 and s2 denote the value of s before and after an
  4082. --| invocation of heap_sort.  Then s1 and s2 have the following
  4083. --| properties:
  4084. --|   1. For i,j in s'range, i <= j implies that s2(i) <= s2(j).
  4085. --|   2. s2(s'first) through s2(s'last) is a permutation of
  4086. --|      s1(s'first) through s1(s'last).
  4087. --|
  4088. --| Requires:
  4089. --|     <= must form a total order over item_type.
  4090. --|
  4091. --| Algorithm:
  4092. --|     The algorithm is described in Knuth, vol 3, and Aho et al,
  4093. --| The Design and Analysis of Computer Algorithms.
  4094. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4095. --sort.bdy
  4096. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4097.  
  4098. procedure HEAP_SORT(S : in out SEQUENCE) is 
  4099.  
  4100. --| Notes:
  4101. --| Implementation is taken directly from The Design and Analysis of
  4102. --| Computer Algorithms, by Aho, Hopcroft and Ullman.  The only change
  4103. --| of any significance is code to map between the index_type subrange
  4104. --| defined by the sequence bounds and the subrange, 1..s'length, of
  4105. --| the integers.  This mapping is necessary because the algorithm
  4106. --| represents binary trees as an array such that the sons of s(i) are
  4107. --| located at s(2i) and s(2i + 1).
  4108.  
  4109.   subtype INT_RANGE is INTEGER range 1 .. S'LENGTH; 
  4110.  
  4111.   function INT_RANGE_TO_INDEX(I : in INT_RANGE) return INDEX_TYPE is 
  4112.   --| Effects:
  4113.   --| Map 1 --> s'first, ..., s'length --> s'last.
  4114.   begin
  4115.     return INDEX_TYPE'VAL(I + INDEX_TYPE'POS(S'FIRST) - 1); 
  4116.   end INT_RANGE_TO_INDEX; 
  4117.  
  4118.   function INDEX_TO_INT_RANGE(I : in INDEX_TYPE) return INT_RANGE is 
  4119.   --| Effects:
  4120.   --| Map s'first --> 1, ..., s'last --> s'length.
  4121.   begin
  4122.     return (INDEX_TYPE'POS(I) - INDEX_TYPE'POS(S'FIRST) + 1); 
  4123.   end INDEX_TO_INT_RANGE; 
  4124.  
  4125.   procedure SWAP(I, J : in INDEX_TYPE) is 
  4126.   --| Effects:
  4127.   --| Exchange the values of s(i) and s(j).
  4128.  
  4129.     T : ITEM_TYPE := S(I); 
  4130.   begin
  4131.     S(I) := S(J); 
  4132.     S(J) := T; 
  4133.   end SWAP; 
  4134.  
  4135.   procedure HEAPIFY(ROOT, BOUNDARY : in INDEX_TYPE) is 
  4136.   --| Effects:
  4137.   --|     Give s(root..boundary) the heap property:
  4138.   --|        s(i) > s(2i) and s(i) > s(2i + 1).
  4139.   --| (provided that 2i, 2i + 1 are less than boundary.  Note that
  4140.   --| the property is being expressed in terms of the integer range,
  4141.   --| 1..s'last.)
  4142.   --| Requires:
  4143.   --|     s(i + 1, ..., boundary) already has the heap property.
  4144.  
  4145.     MAX                : INDEX_TYPE := ROOT; 
  4146.     BOUNDARY_POSITION  : INT_RANGE := INDEX_TO_INT_RANGE(BOUNDARY); 
  4147.     LEFT_SON_POSITION  : INTEGER := 2*INDEX_TO_INT_RANGE(ROOT); 
  4148.     RIGHT_SON_POSITION : INTEGER := 2*INDEX_TO_INT_RANGE(ROOT) + 1; 
  4149.     LEFT_SON           : INDEX_TYPE; 
  4150.     RIGHT_SON          : INDEX_TYPE; 
  4151.   begin
  4152.  
  4153.     -- If root is not a leaf, and if a son of root contains a larger
  4154.     -- value than the root value, then let max be the son with the
  4155.     -- largest value.
  4156.     if LEFT_SON_POSITION <= BOUNDARY_POSITION then 
  4157.  
  4158.       -- has left son?
  4159.       LEFT_SON := INT_RANGE_TO_INDEX(LEFT_SON_POSITION); 
  4160.       if S(ROOT) <= S(LEFT_SON) then 
  4161.         MAX := LEFT_SON; 
  4162.       end if; 
  4163.     else 
  4164.       return; 
  4165.  
  4166.     -- no sons, meets heap property trivially.
  4167.     end if; 
  4168.  
  4169.     if RIGHT_SON_POSITION <= BOUNDARY_POSITION then 
  4170.  
  4171.       -- has right son?
  4172.       RIGHT_SON := INT_RANGE_TO_INDEX(RIGHT_SON_POSITION); 
  4173.       if S(MAX) <= S(RIGHT_SON) then 
  4174.  
  4175.         -- biggest so far?
  4176.         MAX := RIGHT_SON; 
  4177.       end if; 
  4178.     end if; 
  4179.  
  4180.     if MAX /= ROOT then 
  4181.  
  4182.       -- If a larger son found then
  4183.       SWAP(ROOT, MAX); 
  4184.  
  4185.       -- carry out exchange and
  4186.       HEAPIFY(MAX, BOUNDARY); 
  4187.  
  4188.     -- propagate heap propery to subtree
  4189.     end if; 
  4190.   end HEAPIFY; 
  4191.  
  4192.   procedure BUILD_HEAP is 
  4193.   --| Effects:
  4194.   --| Give all of s the heap property.
  4195.  
  4196.     MID : INDEX_TYPE := INT_RANGE_TO_INDEX(INDEX_TO_INT_RANGE(S'LAST)/2); 
  4197.   begin
  4198.     for I in reverse S'FIRST .. MID loop
  4199.       HEAPIFY(I, S'LAST); 
  4200.     end loop; 
  4201.   end BUILD_HEAP; 
  4202.  
  4203. begin
  4204.  
  4205.   -- Make s into a heap.  Then, repeat until sorted:
  4206.   --   1. exchange the largest element, located at the root, with the
  4207.   --      last element that has not yet been ordered, and
  4208.   --   2. reheapify the unsorted portion of s.
  4209.   BUILD_HEAP; 
  4210.   for I in reverse INDEX_TYPE'SUCC(S'FIRST) .. S'LAST loop
  4211.     SWAP(S'FIRST, I); 
  4212.     HEAPIFY(S'FIRST, INDEX_TYPE'PRED(I)); 
  4213.   end loop; 
  4214.  
  4215. exception
  4216.   when CONSTRAINT_ERROR => 
  4217.  
  4218.     -- On succ(s'first) for array of length <= 1.
  4219.     return; 
  4220.  
  4221. -- Such arrays are trivially sorted.
  4222. end HEAP_SORT; 
  4223. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4224. --simplepo.spc
  4225. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4226. with TEXT_IO; 
  4227. with STRING_PKG; 
  4228.  
  4229. package SIMPLE_PAGINATED_OUTPUT is 
  4230.  
  4231. --| Create paginated text files with user defined heading,
  4232. --| footing, and page length.
  4233.  
  4234. --| Overview:
  4235.  
  4236. --| The Paginated_Output package is used to create paginated
  4237. --| output files.  When such a file is created, the page length,
  4238. --| and page header length are specified. Several operations are
  4239. --| provided for setting the header text which will appear 
  4240. --| on each output page.  The following escapes can be used in the 
  4241. --| header text:
  4242. --|-
  4243. --|     ~f    the current external file name
  4244. --|     ~p    the current page number
  4245. --|     ~d    the current date (eg. 03/15/85)
  4246. --|     ~c    the current calendar date (eg. March 15, 1985)
  4247. --|     ~t    the current time (eg. 04:53:32)
  4248. --|+
  4249. --| Case is not significant after the tilde (~).  If the tilde
  4250. --| is followed by any other character, only the second character
  4251. --| is printed unless the line ends with a tilde in which case
  4252. --| the line will be terminated one character before the tilde.
  4253. --| 
  4254. --| The header is printed just before the first line of a page
  4255. --| is output.  Thus, if a paginated file is opened and closed without 
  4256. --| any calls to print a line in between, the output is a null file.
  4257. --|
  4258. --| This package knows nothing about (and places no limits on)
  4259. --| the length or contents of each line sent to the output file.  
  4260. --| In particular, if the line contains ASCII control codes
  4261. --| for new line, form feed, and/or vertical tab the output file
  4262. --| will not be properly paginated.  Normal usage is to call
  4263. --| Create_Paginated_File, call Set_Header, call Put and Put_Line
  4264. --| repeatedly to output a sequence of lines of text, and finally
  4265. --| call Close_Paginated_File to complete the last page and close
  4266. --| the file.
  4267.  
  4268. --| N/A: Effects, Requires, Modifies, Raises
  4269.  
  4270. -- Exceptions --
  4271.  
  4272.   FILE_ALREADY_OPEN : exception;  --| Raised if create is attempted
  4273.   --| for an already existing file.
  4274.   FILE_ERROR        : exception;  --| Raised if unable to open a file
  4275.   --| other than File_Already_Open
  4276.   FILE_NOT_OPEN     : exception;  --| Raised if close is attempted
  4277.   --| for an unopened file.
  4278.   INVALID_COUNT     : exception;  --| Raised if a requested count 
  4279.   --| can not be serviced.
  4280.   INVALID_FILE      : exception;  --| Raised if output is attempted
  4281.   --| with an invalid file handle.
  4282.   OUTPUT_ERROR      : exception;  --| Raised if error is encountered
  4283.   --| during an output operation.
  4284.   PAGE_LAYOUT_ERROR : exception;  --| Raised if page specification
  4285.   --| is invalid.
  4286.   PAGE_OVERFLOW     : exception;  --| Raised if specified reserve
  4287.   --| value exceeds the page size.
  4288.   TEXT_OVERFLOW     : exception;  --| Raised if header text
  4289.   --| overflows area.
  4290.   TEXT_UNDERFLOW    : exception;  --| Raised if header text
  4291.   --| underflows area.
  4292.  
  4293.   -- Types --
  4294.  
  4295.   subtype HOST_FILE_NAME is STRING; 
  4296.   --| String of valid characters for
  4297.   --| external file name.
  4298.  
  4299.   type VARIABLE_STRING_ARRAY is  --| Array of variable length strings
  4300.   array(POSITIVE range <>) of STRING_PKG.STRING_TYPE; 
  4301.  
  4302.   type PAGINATED_FILE_HANDLE is  --| Handle to be passed around in a
  4303.   limited private;  --| program that uses paginated output.
  4304.  
  4305.  
  4306.   -- Operations --
  4307.  
  4308.   procedure CREATE_PAGINATED_FILE( --| Create a paginated output file
  4309.   --| and return the file handle.
  4310.                                   FILE_NAME   : in HOST_FILE_NAME := ""; 
  4311.                                   --| The name of the file to be created.
  4312.                                   FILE_HANDLE : in out PAGINATED_FILE_HANDLE; 
  4313.                                   --| Handle to be used for subsequent
  4314.                                   --| operations
  4315.                                   PAGE_SIZE   : in INTEGER := 60; 
  4316.                                   --| The number of lines per page
  4317.                                   HEADER_SIZE : in INTEGER := 6
  4318.                                   --| The number of header text lines
  4319.                                   ); 
  4320.  
  4321.   --| Raises:
  4322.   --| File_Already_Open, File_Error, Page_Layout_Error
  4323.  
  4324.   --| Requires:
  4325.   --| File_Name is an valid external name of the file to be created (If
  4326.   --| it is omitted, the current output file is selected).  Page_Size,
  4327.   --| and Header_Size are optional values (if omitted 60, and 6 are
  4328.   --| respectively) to be used for the page layout of the file to be 
  4329.   --| created.  Page_Size specifies the total number of lines per page 
  4330.   --| (including the areas for the header).
  4331.   --| Header_Size specifies the number of lines to be reserved for the
  4332.   --| header area.
  4333.  
  4334.   --| Effects:
  4335.   --| Creates a new paginated file with Page_Size number of lines
  4336.   --| per page and Header_Size and number of lines reserved for the header.
  4337.   --| Access to the paginated file control structure Paginated_File_Handle 
  4338.   --| is returned for use in subsequent operations.
  4339.  
  4340.   --| Errors:
  4341.   --| If any of the page layout values are negative, the exception
  4342.   --| Page_Layout_Error is raised.  Also if the total number of lines
  4343.   --| in the header plus one exceeds Page_Size, the same
  4344.   --| exception is raised.  This guarantees that at least one line of
  4345.   --| text can appear on each output page.
  4346.   --| If the output file with the specified File_Name is already open
  4347.   --| File_Already_Open exception is raised.
  4348.   --| If the file cannot be opened for any other reason, the exception
  4349.   --| File_Error is raise.
  4350.  
  4351.   --| N/A: Modifies
  4352.  
  4353.   procedure SET_PAGE_LAYOUT( --| Set the page layout for the 
  4354.   --| paginated file.
  4355.                             FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4356.                             --| The paginated file to be set 
  4357.                             --| with the given page layout
  4358.                             PAGE_SIZE   : in INTEGER; 
  4359.                                 --| The number of lines per page
  4360.                             HEADER_SIZE : in INTEGER
  4361.                                 --| The number of header text lines
  4362.                             ); 
  4363.  
  4364.   --| Raises:
  4365.   --| Page_Layout_Error
  4366.  
  4367.   --| Requires:
  4368.   --| File_Handle is the access to the paginated file control structure
  4369.   --| returned by Create_Paginated_File.  Page_Size specifies the total
  4370.   --| number of lines per page (including the area for header).
  4371.   --| Header_Size and specifies the number of lines to be
  4372.   --| reserved for the header area.
  4373.  
  4374.   --| Effects:
  4375.   --| A paginated file is set with Page_Size number of lines per
  4376.   --| page and Header_Size number of lines reserved for the 
  4377.   --| header.A page eject is performed if not at the top of the page before
  4378.   --| the new page layout values are set.
  4379.  
  4380.   --| Errors:
  4381.   --| If any of the page layout values are negative, the exception
  4382.   --| Page_Layout_Error is raised.  Also if the total number of lines
  4383.   --| in the header plus one exceeds Page_Size, the exception
  4384.   --| Page_Layout_Error is raised.
  4385.  
  4386.   --| N/A: Modifies
  4387.  
  4388.   procedure SET_HEADER( --| Set the header text on a paginated
  4389.   --| output file.
  4390.                        FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4391.                        --| Paginated file to be set 
  4392.                        --| with the header text
  4393.                        HEADER_TEXT : in VARIABLE_STRING_ARRAY
  4394.                        --| Sequence of header lines
  4395.                        ); 
  4396.  
  4397.   --| Raises:
  4398.   --| Invalid_File, Text_Overflow
  4399.  
  4400.   --| Requires:
  4401.   --| File_Handle is the access to the paginated file control structure
  4402.   --| returned by Create_Paginated_File.  Header_Text is the array
  4403.   --| of text to be used for the page header.
  4404.  
  4405.   --| Effects:
  4406.   --| The header text of File_Handle is set to Header_Text.  Note that
  4407.   --| the replaced header text will not be printed until the next
  4408.   --| page of the output.
  4409.  
  4410.   --| Errors:
  4411.   --| If File_Handle is not a valid access to a paginated file control
  4412.   --| structure exception Invalid_File is raised.
  4413.   --| Specification of a header text array which implies a greater
  4414.   --| number of lines than reserved for by Create_Paginated_File or
  4415.   --| Set_Page_Layout results in Text_Overflow exception to be raised.
  4416.  
  4417.   --| N/A: Modifies
  4418.  
  4419.   procedure SET_HEADER( --| Replace a line of header text on a
  4420.   --| paginated output file.
  4421.                        FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4422.                        --| Paginated file to be set 
  4423.                        --| with the header text
  4424.                        HEADER_LINE : in INTEGER; 
  4425.                                 --| Line number of header to be replaced
  4426.                        HEADER_TEXT : in STRING --| Header line to replace
  4427.                        ); 
  4428.  
  4429.   --| Raises:
  4430.   --| Invalid_File, Text_Overflow, Text_Underflow
  4431.  
  4432.   --| Requires:
  4433.   --| File_Handle is the access to the paginated file control structure
  4434.   --| returned by Create_Paginated_File.  Header_Text is the text
  4435.   --| to replace the existing header line at Header_Line.
  4436.  
  4437.   --| Effects:
  4438.   --| The header text of File_Handle at Header_Line is set to Header_Text.
  4439.   --| Note that the replaced header text will not be printed until
  4440.   --| the next page of the output.
  4441.  
  4442.   --| Errors:
  4443.   --| If File_Handle is not a valid access to a paginated file control
  4444.   --| structure exception Invalid_File is raised.
  4445.   --| Specification of Header_Line greater than the number of header
  4446.   --| lines reserved by Create_Paginated_File or Set_Page_Layout
  4447.   --| results in Text_Overflow exception to be raised.
  4448.   --| If the specified Header_Line is less than or equal to 0 then
  4449.   --| Text_Underflow exception is raised.
  4450.  
  4451.   --| N/A: Modifies
  4452.  
  4453.   procedure SET_HEADER( --| Replace a line of header text on a
  4454.   --| paginated output file.
  4455.                        FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4456.                        --| Paginated file to be set 
  4457.                        --| with the header text
  4458.                        HEADER_LINE : in INTEGER; 
  4459.                                 --| Line number of header to be replaced
  4460.                        HEADER_TEXT : in STRING_PKG.STRING_TYPE
  4461.                        --| Header line to replace
  4462.                        ); 
  4463.  
  4464.   --| Raises:
  4465.   --| Invalid_File, Text_Overflow, Text_Underflow
  4466.  
  4467.   --| Requires:
  4468.   --| File_Handle is the access to the paginated file control structure
  4469.   --| returned by Create_Paginated_File.  Header_Text is the text
  4470.   --| to replace the existing header line at Header_Line.
  4471.  
  4472.   --| Effects:
  4473.   --| The header text of File_Handle at Header_Line is set to Header_Text.
  4474.   --| Note that the replaced header text will not be printed until
  4475.   --| the next page of the output.
  4476.  
  4477.   --| Errors:
  4478.   --| If File_Handle is not a valid access to a paginated file control
  4479.   --| structure exception Invalid_File is raised.
  4480.   --| Specification of Header_Line greater than the number of header
  4481.   --| lines reserved by Create_Paginated_File or Set_Page_Layout
  4482.   --| results in Text_Overflow exception to be raised.
  4483.   --| If the specified Header_Line is less than or equal to 0 then
  4484.   --| Text_Underflow exception is raised.
  4485.  
  4486.   --| N/A: Modifies
  4487.  
  4488.   procedure CLOSE_PAGINATED_FILE( --| Complete the last page and close
  4489.   --| the paginated file.
  4490.                                  FILE_HANDLE : in out PAGINATED_FILE_HANDLE
  4491.                                  --| The paginated file to be closed
  4492.                                  ); 
  4493.  
  4494.   --| Raises:
  4495.   --| Invalid_File, File_Not_Open
  4496.  
  4497.   --| Requires:
  4498.   --| File_Handle is the access to the paginated file control structure
  4499.   --| returned by Create_Paginated_File.
  4500.  
  4501.   --| Effects:
  4502.   --| Completes the last page of output and closes the output file.
  4503.  
  4504.   --| Errors:
  4505.   --| If File_Handle is not a valid Paginated_File_Handle, the exception
  4506.   --| Invalid_File is raised.  If an error occurs in closing the file,
  4507.   --| File_Not_Open is raised.
  4508.  
  4509.   --| N/A: Modifies
  4510.  
  4511.   procedure PUT( --| Output a line on a paginated file
  4512.                 FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4513.                 --| The paginated file to
  4514.                 --| output the text
  4515.                 TEXT        : in VARIABLE_STRING_ARRAY
  4516.                 --| The text to be output.
  4517.                 ); 
  4518.  
  4519.   --| Raises:
  4520.   --| Invalid_File, Output_Error
  4521.  
  4522.   --| Requires:
  4523.   --| File_Handle is the access to the paginated file control structure
  4524.   --| returned by Create_Paginated_File.  Text is a string of 
  4525.   --| characters to be written to the paginated output file.
  4526.  
  4527.   --| Effects:
  4528.   --| Outputs Text of text to File_Handle.  If Text is the first string of the
  4529.   --| first line to be printed on a page, the page header is printed before
  4530.   --| printing the text.  
  4531.  
  4532.   --| Errors:
  4533.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4534.   --| the exception Invalid_File is raised.  If an error
  4535.   --| occurs during output, Output_Error is raised.
  4536.  
  4537.   --| N/A: Modifies
  4538.  
  4539.   procedure PUT( --| Output a line on a paginated file
  4540.                 FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4541.                 --| The paginated file to
  4542.                 --| output the text
  4543.                 TEXT        : in STRING_PKG.STRING_TYPE
  4544.                 --| The text to be output.
  4545.                 ); 
  4546.  
  4547.   --| Raises:
  4548.   --| Invalid_File, Output_Error
  4549.  
  4550.   --| Requires:
  4551.   --| File_Handle is the access to the paginated file control structure
  4552.   --| returned by Create_Paginated_File.  Text is a string of 
  4553.   --| characters to be written to the paginated output file.
  4554.  
  4555.   --| Effects:
  4556.   --| Outputs Text of text to File_Handle.  If Text is the first string of the
  4557.   --| first line to be printed on a page, the page header is printed before
  4558.   --| printing the text.
  4559.  
  4560.   --| Errors:
  4561.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4562.   --| the exception Invalid_File is raised.  If an error
  4563.   --| occurs during output, Output_Error is raised.
  4564.  
  4565.   --| N/A: Modifies
  4566.  
  4567.   procedure PUT( --| Output a line on a paginated file
  4568.                 FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4569.                 --| The paginated file to
  4570.                 --| output the text
  4571.                 TEXT        : in STRING --| The text to be output.
  4572.                 ); 
  4573.  
  4574.   --| Raises:
  4575.   --| Invalid_File, Output_Error
  4576.  
  4577.   --| Requires:
  4578.   --| File_Handle is the access to the paginated file control structure
  4579.   --| returned by Create_Paginated_File.  Text is a string of 
  4580.   --| characters to be written to the paginated output file.
  4581.  
  4582.   --| Effects:
  4583.   --| Outputs Text of text to File_Handle.  If Text is the first string of the
  4584.   --| first line to be printed on a page, the page header is printed before
  4585.   --| printing the string.  
  4586.  
  4587.   --| Errors:
  4588.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4589.   --| the exception Invalid_File is raised.  If an error
  4590.   --| occurs during output, Output_Error is raised.
  4591.  
  4592.   --| N/A: Modifies
  4593.  
  4594.   procedure PUT( --| Output a line on a paginated file
  4595.                 FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4596.                 --| The paginated file to
  4597.                 --| output the text
  4598.                 TEXT        : in CHARACTER --| The text to be output.
  4599.                 ); 
  4600.  
  4601.   --| Raises:
  4602.   --| Invalid_File, Output_Error
  4603.  
  4604.   --| Requires:
  4605.   --| File_Handle is the access to the paginated file control structure
  4606.   --| returned by Create_Paginated_File.  Text is a the characters to be
  4607.   --| written to the paginated output file.
  4608.  
  4609.   --| Effects:
  4610. --| Outputs Text of text to File_Handle.  If Text is the first character of the
  4611.   --| first line to be printed on a page, the page header is printed before
  4612.   --| printing the string.  
  4613.  
  4614.   --| Errors:
  4615.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4616.   --| the exception Invalid_File is raised.  If an error
  4617.   --| occurs during output, Output_Error is raised.
  4618.  
  4619.   --| N/A: Modifies
  4620.  
  4621.   procedure SPACE( --| Output a specified number of spaces
  4622.                   FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4623.                   --| The paginated file to output the line
  4624.                   COUNT       : in INTEGER --| Number of spaces
  4625.                   ); 
  4626.  
  4627.   --| Raises:
  4628.   --| Invalid_File, Output_Error
  4629.  
  4630.   --| Requires:
  4631.   --| File_Handle is the access to the paginated file control structure
  4632.   --| returned by Create_Paginated_File.  Count is the number of horizontal
  4633.   --| spaces to be output.
  4634.  
  4635.   --| Effects:
  4636.   --| Output Count number of blanks to File_Handle.
  4637.  
  4638.   --| Errors:
  4639.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4640.   --| the exception Invalid_File is raised.  If an error
  4641.   --| occurs during output, Output_Error is raised.
  4642.  
  4643.   --| N/A: Modifies
  4644.  
  4645.   procedure PUT_LINE( --| Output a line on a paginated file
  4646.                      FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4647.                      --| The paginated file to output the line
  4648.                      TEXT_LINE   : in VARIABLE_STRING_ARRAY
  4649.                      --| The line to be output.
  4650.                      ); 
  4651.  
  4652.   --| Raises:
  4653.   --| Invalid_File, Output_Error
  4654.  
  4655.   --| Requires:
  4656.   --| File_Handle is the access to the paginated file control structure
  4657.   --| returned by Create_Paginated_File.  Text_Line is a string of 
  4658.   --| characters to be written to the paginated output file.
  4659.  
  4660.   --| Effects:
  4661.   --| Outputs Text_Line of text to File_Handle.  If Text_Line is the
  4662.   --| first line to be printed on a page, the page header is printed
  4663.   --| before the line.  
  4664.  
  4665.   --| Errors:
  4666.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4667.   --| the exception Invalid_File is raised.  If an error
  4668.   --| occurs during output, Output_Error is raised.
  4669.  
  4670.   --| N/A: Modifies
  4671.  
  4672.   procedure PUT_LINE( --| Output a line on a paginated file
  4673.                      FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4674.                      --| The paginated file to
  4675.                      --| output the line
  4676.                      TEXT_LINE   : in STRING_PKG.STRING_TYPE
  4677.                      --| The line to be output.
  4678.                      ); 
  4679.  
  4680.   --| Raises:
  4681.   --| Invalid_File, Output_Error
  4682.  
  4683.   --| Requires:
  4684.   --| File_Handle is the access to the paginated file control structure
  4685.   --| returned by Create_Paginated_File.  Text_Line is a string of 
  4686.   --| characters to be written to the paginated output file.
  4687.  
  4688.   --| Effects:
  4689.   --| Outputs Text_Line of text to File_Handle.  If Text_Line is the
  4690.   --| first line to be printed on a page, the page header is printed
  4691.   --| before the line.
  4692.  
  4693.   --| Errors:
  4694.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4695.   --| the exception Invalid_File is raised.  If an error
  4696.   --| occurs during output, Output_Error is raised.
  4697.  
  4698.   --| N/A: Modifies
  4699.  
  4700.   procedure PUT_LINE( --| Output a line on a paginated file
  4701.                      FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4702.                      --| The paginated file to
  4703.                      --| output the line
  4704.                      TEXT_LINE   : in STRING --| The line to be output.
  4705.                      ); 
  4706.  
  4707.   --| Raises:
  4708.   --| Invalid_File, Output_Error
  4709.  
  4710.   --| Requires:
  4711.   --| File_Handle is the access to the paginated file control structure
  4712.   --| returned by Create_Paginated_File.  Text_Line is a string of 
  4713.   --| characters to be written to the paginated output file.
  4714.  
  4715.   --| Effects:
  4716.   --| Outputs Text_Line of text to File_Handle.  If Text_Line is the
  4717.   --| first line to be printed on a page, the page header is printed
  4718.   --| before the line. 
  4719.  
  4720.   --| Errors:
  4721.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4722.   --| the exception Invalid_File is raised.  If an error
  4723.   --| occurs during output, Output_Error is raised.
  4724.  
  4725.   --| N/A: Modifies
  4726.  
  4727.   procedure SPACE_LINE( --| Output one or more spaces on a
  4728.   --| paginated file
  4729.                        FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4730.                        --| The paginated file to 
  4731.                        --| output spaces
  4732.                        COUNT       : in INTEGER := 1
  4733.                        --| The number of spaces.
  4734.                        ); 
  4735.  
  4736.   --| Raises:
  4737.   --| Invalid_File, Output_Error, Invalid_Count
  4738.  
  4739.   --| Requires:
  4740.   --| File_Handle is the access to the paginated file control structure
  4741.   --| returned by Create_Paginated_File.  Count is the number of
  4742.   --| spaces to be output to File_Handle.  If Count is omitted, 1 is
  4743.   --| assumed.
  4744.  
  4745.   --| Effects:
  4746.   --| Count number of line terminators are output to File_Handle.
  4747.   --| If Count is greater than the number of lines remaining on
  4748.   --| the page, a page terminator, and the page header
  4749.   --| are written before the remainder of the spaces are output.
  4750.   --| If the specified Count is less than equal to 0, no operation
  4751.   --| takes place.
  4752.  
  4753.   --| Errors:
  4754.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4755.   --| the exception Invalid_File is raised.  If the requested space
  4756.   --| count is greater than a predetermined amount, Invalid_Count
  4757.   --| is raised.  If an error occurs during output, Output_Error
  4758.   --| is raised.
  4759.  
  4760.   --| N/A: Modifies
  4761.  
  4762.   procedure SKIP_LINE( --| Output one or more spaces on a
  4763.   --| paginated file
  4764.                       FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4765.                       --| The paginated file to
  4766.                       --| output skips
  4767.                       COUNT       : in INTEGER := 1
  4768.                       --| The number of spaces.
  4769.                       ); 
  4770.  
  4771.   --| Raises:
  4772.   --| Invalid_File, Output_Error, Invalid_Count
  4773.  
  4774.   --| Requires:
  4775.   --| File_Handle is the access to the paginated file control structure
  4776.   --| returned by Create_Paginated_File.  Count is the number of
  4777.   --| spaces to be output to File_Handle.  If Count is omitted, 1 is
  4778.   --| assumed.
  4779.  
  4780.   --| Effects:
  4781.   --| Count number of line terminators are output to File_Handle.
  4782.   --| If Count is greater than the number of lines remaining on
  4783.   --| the page, a page terminator is
  4784.   --| output and the remainder of the skips are NOT output.
  4785.   --| If the specified Count is less than equal to 0, no operation
  4786.   --| takes place.
  4787.  
  4788.   --| Errors:
  4789.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4790.   --| the exception Invalid_File is raised.  If the requested skip
  4791.   --| count is greater than a predetermined amount, Invalid_Count
  4792.   --| is raised.  If an error occurs during output, Output_Error
  4793.   --| is raised.
  4794.  
  4795.   --| N/A: Modifies
  4796.  
  4797.   procedure PUT_PAGE( --| Output one or more page ejects
  4798.   --| on a paginated file
  4799.                      FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  4800.                      --| The paginated file to
  4801.                      --| output page ejects
  4802.                      COUNT       : in INTEGER := 1
  4803.                      --| The number of pages.
  4804.                      ); 
  4805.  
  4806.   --| Raises:
  4807.   --| Invalid_File, Output_Error, Invalid_Count
  4808.  
  4809.   --| Requires:
  4810.   --| File_Handle is the access to the paginated file control structure
  4811.   --| returned by Create_Paginated_File.  Count is the number of
  4812.   --| pages to be output to File_Handle.  If Count is omitted, 1 is
  4813.   --| assumed.
  4814.  
  4815.   --| Effects:
  4816.   --| Outputs Count number of page ejects. The page header is printed as
  4817. --| appropriate.  If the specified Count is less than equal to 0, no operation
  4818.   --| takes place.
  4819.  
  4820.   --| Errors:
  4821.   --| If File_Handle is not a valid, open Paginated_File_Handle,
  4822.   --| the exception Invalid_File is raised.  If the requested page
  4823.   --| count is greater than a predetermined amount, Invalid_Count
  4824.   --| is raised.  If an error occurs during output, Output_Error
  4825.   --| is raised.
  4826.  
  4827.   --| N/A: Modifies
  4828. private
  4829.  
  4830.   type VARIABLE_STRING_ARRAY_HANDLE is access VARIABLE_STRING_ARRAY; 
  4831.   --| Handle to array of variable length
  4832.   --| strings
  4833.  
  4834.   type PAGINATED_FILE_STRUCTURE; 
  4835.   --| Data structure to store state of
  4836.   --| the output file.
  4837.  
  4838.   type PAGINATED_FILE_HANDLE is access PAGINATED_FILE_STRUCTURE; 
  4839.   --| Handle to be passed around in a
  4840.   --| program that uses paginated_output.
  4841.  
  4842.   type PAGINATED_FILE_STRUCTURE is 
  4843.   --| a structure to store state of
  4844.     record --| the output file.
  4845.       FILE_NAME        : STRING_PKG.STRING_TYPE; 
  4846.       --| External file name
  4847.       FILE_REFERENCE   : TEXT_IO.FILE_TYPE; 
  4848.       --| External file reference
  4849.       PAGE_SIZE        : INTEGER; 
  4850.       --| The number of lines per page
  4851.       MAXIMUM_LINE     : INTEGER; 
  4852.       --| The maximum number of text lines
  4853.       CURRENT_CALENDAR : STRING_PKG.STRING_TYPE; 
  4854.       --| Creation date (eg. March 15, 1985)
  4855.       CURRENT_DATE     : STRING(1 .. 8); 
  4856.       --| Creation date (eg. 03/15/85)
  4857.       CURRENT_TIME     : STRING(1 .. 8); 
  4858.       --| Creation time (eg. 15:24:07)
  4859.       CURRENT_PAGE     : INTEGER := 0; 
  4860.       --| The number of lines per page
  4861.       CURRENT_LINE     : INTEGER := 0; 
  4862.       --| The number of lines used
  4863.       HEADER_SIZE      : INTEGER; 
  4864.       --| Number of lines of header text
  4865.       PAGE_HEADER      : VARIABLE_STRING_ARRAY_HANDLE := null; 
  4866.       --| Access to page header text
  4867.     end record; 
  4868.  
  4869. end SIMPLE_PAGINATED_OUTPUT; 
  4870. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4871. --simplepo.bdy
  4872. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4873. with TEXT_IO; use TEXT_IO; 
  4874. with CALENDAR; use CALENDAR; 
  4875. with STRING_PKG; use STRING_PKG; 
  4876. with UNCHECKED_DEALLOCATION; 
  4877.  
  4878.  
  4879. package body SIMPLE_PAGINATED_OUTPUT is 
  4880.  
  4881.   package INT_IO is 
  4882.     new INTEGER_IO(INTEGER); 
  4883.  
  4884.   MONTH_NAME : constant VARIABLE_STRING_ARRAY(1 .. 12) := (1 => CREATE("January"
  4885.     ), 2 => CREATE("February"), 3 => CREATE("March"), 4 => CREATE("April"), 5
  4886.     => CREATE("May"), 6 => CREATE("June"), 7 => CREATE("July"), 8 => CREATE(
  4887.     "August"), 9 => CREATE("September"), 10 => CREATE("October"), 11 => CREATE(
  4888.     "November"), 12 => CREATE("December")); 
  4889.  
  4890.   function CONVERT(INPUT_NUMBER : in INTEGER; 
  4891.                    DIGIT        : in INTEGER := 0) return STRING is 
  4892.  
  4893.   --|-Algorithm:
  4894.   --| If integer value is negative or greater than 99
  4895.   --|    then return null text
  4896.   --| If input value is less than 10 (ie. single decimal digit)
  4897.   --|    then concatenate 0 and character equivalent of the given value
  4898.   --|    else convert value to character equivalent
  4899.   --| Return converted text
  4900.   --|+
  4901.  
  4902.     TEMP_TEXT : STRING(1 .. 16); 
  4903.     INDEX     : INTEGER; 
  4904.  
  4905.   begin
  4906.  
  4907.     if DIGIT > TEMP_TEXT'LAST then 
  4908.       return ""; 
  4909.     end if; 
  4910.     INT_IO.PUT(TEMP_TEXT, INPUT_NUMBER); 
  4911.     if DIGIT <= 0 then 
  4912.       INDEX := TEMP_TEXT'LAST; 
  4913.       for I in TEMP_TEXT'range loop
  4914.         if TEMP_TEXT(I) /= ' ' then 
  4915.           INDEX := I; 
  4916.           exit; 
  4917.         end if; 
  4918.       end loop; 
  4919.     else 
  4920.       INDEX := TEMP_TEXT'LAST - DIGIT + 1; 
  4921.       for I in INDEX .. TEMP_TEXT'LAST loop
  4922.         if TEMP_TEXT(I) = ' ' then 
  4923.           TEMP_TEXT(I) := '0'; 
  4924.         end if; 
  4925.       end loop; 
  4926.     end if; 
  4927.     return TEMP_TEXT(INDEX .. TEMP_TEXT'LAST); 
  4928.  
  4929.   end CONVERT; 
  4930.   pragma PAGE; 
  4931.   procedure SET_DATE_TIME(FILE_HANDLE : in PAGINATED_FILE_HANDLE) is 
  4932.  
  4933.   --|-Algorithm:
  4934.   --| Get the current system date/time
  4935.   --| Separate date/time into appropriate components
  4936.   --| Calculate in terms of hours, minutes, and seconds
  4937.   --| Set current date/time in the file structure
  4938.   --| Set the current date in "English" (eg. January 1, 1985)
  4939.   --|    in the file structure
  4940.   --| Exit
  4941.   --|+
  4942.  
  4943.     CLOCK_VALUE : CALENDAR.TIME; 
  4944.     YEAR        : CALENDAR.YEAR_NUMBER; 
  4945.     MONTH       : CALENDAR.MONTH_NUMBER; 
  4946.     DAY         : CALENDAR.DAY_NUMBER; 
  4947.     DURATION    : CALENDAR.DAY_DURATION; 
  4948.  
  4949.   begin
  4950.  
  4951.     CLOCK_VALUE := CALENDAR.CLOCK; 
  4952.     CALENDAR.SPLIT(CLOCK_VALUE, YEAR, MONTH, DAY, DURATION); 
  4953.     FILE_HANDLE.CURRENT_DATE := CONVERT(INTEGER(MONTH), 2) & "/" & CONVERT(
  4954.       INTEGER(DAY), 2) & "/" & CONVERT(INTEGER(YEAR mod 100), 2); 
  4955.     FILE_HANDLE.CURRENT_TIME := CONVERT(INTEGER(DURATION)/(60*60), 2) & ":" & 
  4956.       CONVERT((INTEGER(DURATION) mod (60*60))/60, 2) & ":" & CONVERT(INTEGER(
  4957.       DURATION) mod 60, 2); 
  4958.     STRING_PKG.MARK; 
  4959.     FILE_HANDLE.CURRENT_CALENDAR := STRING_PKG.MAKE_PERSISTENT(MONTH_NAME(
  4960.       INTEGER(MONTH)) & INTEGER'IMAGE(DAY) & "," & INTEGER'IMAGE(YEAR)); 
  4961.     STRING_PKG.RELEASE; 
  4962.  
  4963.   end SET_DATE_TIME; 
  4964.   pragma PAGE; 
  4965.   procedure CHECK_VALID(FILE_HANDLE : in PAGINATED_FILE_HANDLE) is 
  4966.  
  4967.   --|-Algorithm:
  4968.   --| If handle is null or external file name is null
  4969.   --|    then raise an error
  4970.   --| Exit
  4971.   --|+
  4972.  
  4973.   begin
  4974.  
  4975.     if FILE_HANDLE = null then 
  4976.       raise INVALID_FILE; 
  4977.     end if; 
  4978.  
  4979.   end CHECK_VALID; 
  4980.   pragma PAGE; 
  4981.   procedure CLEAR_TEXT(TEXT_HANDLE : in VARIABLE_STRING_ARRAY_HANDLE) is 
  4982.  
  4983.   --|-Algorithm:
  4984.   --| If valid access to text array
  4985.   --|    then return text array storage to the heap (access set to null)
  4986.   --| Exit
  4987.   --|+
  4988.  
  4989.   begin
  4990.  
  4991.     if TEXT_HANDLE /= null then 
  4992.       for I in TEXT_HANDLE'range loop
  4993.         STRING_PKG.FLUSH(TEXT_HANDLE(I)); 
  4994.       end loop; 
  4995.     end if; 
  4996.  
  4997.   end CLEAR_TEXT; 
  4998.   pragma PAGE; 
  4999.   procedure SET_TEXT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5000.                      TEXT_STRING : in VARIABLE_STRING_ARRAY) is 
  5001.  
  5002.   --|-Algorithm:
  5003.   --| Validate paginated file structure (raise error if not valid)
  5004.   --| If requested text array is too large
  5005.   --|    then raise an error
  5006.   --| Clear old text array
  5007.   --| Set new text array with specified justification (top or bottom)
  5008.   --| in the area as specified
  5009.   --| Exit
  5010.   --|+
  5011.  
  5012.     TEXT_INDEX : INTEGER; 
  5013.  
  5014.   begin
  5015.     CHECK_VALID(FILE_HANDLE); 
  5016.     TEXT_INDEX := 1; 
  5017.     if FILE_HANDLE.HEADER_SIZE < TEXT_STRING'LAST then 
  5018.       raise TEXT_OVERFLOW; 
  5019.     end if; 
  5020.     CLEAR_TEXT(FILE_HANDLE.PAGE_HEADER); 
  5021.     for I in TEXT_STRING'range loop
  5022.       FILE_HANDLE.PAGE_HEADER(TEXT_INDEX) := STRING_PKG.MAKE_PERSISTENT(
  5023.         TEXT_STRING(I)); 
  5024.       TEXT_INDEX := TEXT_INDEX + 1; 
  5025.     end loop; 
  5026.   end SET_TEXT; 
  5027.   pragma PAGE; 
  5028.   function TILDE_SUBSTITUTE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5029.                             INPUT_TEXT  : in STRING_PKG.STRING_TYPE) return
  5030.     STRING is 
  5031.  
  5032.   --|-Algorithm:
  5033.   --| Set the length of the text in question
  5034.   --| Clear the result string to null
  5035.   --| Loop until all input characters are processed
  5036.   --|    Fetch one character
  5037.   --|    If the character is a tilde (~) 
  5038.   --|       then bump input index and if past the end exit the loop
  5039.   --|            Fetch the next character
  5040.   --|            Based on this character substitute appropriately
  5041.   --|        else add this to the output
  5042.   --|     Bump input index and loop
  5043.   --| Return the output (substituted) string
  5044.   --| Exit
  5045.   --|+
  5046.  
  5047.     OUTPUT_TEXT : STRING_PKG.STRING_TYPE; 
  5048.     S_STR       : STRING_PKG.STRING_TYPE; 
  5049.     LETTER      : CHARACTER; 
  5050.     INDEX       : NATURAL; 
  5051.  
  5052.   begin
  5053.  
  5054.     S_STR := INPUT_TEXT; 
  5055.     loop
  5056.       INDEX := STRING_PKG.MATCH_C(S_STR, '~'); 
  5057.       if INDEX = 0 then 
  5058.         OUTPUT_TEXT := OUTPUT_TEXT & S_STR; 
  5059.         exit; 
  5060.       end if; 
  5061.       if INDEX > 1 then 
  5062.         OUTPUT_TEXT := OUTPUT_TEXT & STRING_PKG.SUBSTR(S_STR, 1, INDEX - 1); 
  5063.       end if; 
  5064.       if INDEX < STRING_PKG.LENGTH(S_STR) then 
  5065.         LETTER := STRING_PKG.FETCH(S_STR, INDEX + 1); 
  5066.       else 
  5067.         exit; 
  5068.       end if; 
  5069.       case LETTER is 
  5070.         when 'f' | 'F' => 
  5071.           OUTPUT_TEXT := OUTPUT_TEXT & FILE_HANDLE.FILE_NAME; 
  5072.         when 'c' | 'C' => 
  5073.           OUTPUT_TEXT := OUTPUT_TEXT & FILE_HANDLE.CURRENT_CALENDAR; 
  5074.         when 'd' | 'D' => 
  5075.           OUTPUT_TEXT := OUTPUT_TEXT & FILE_HANDLE.CURRENT_DATE; 
  5076.         when 't' | 'T' => 
  5077.           OUTPUT_TEXT := OUTPUT_TEXT & FILE_HANDLE.CURRENT_TIME; 
  5078.         when 'p' | 'P' => 
  5079.           OUTPUT_TEXT := OUTPUT_TEXT & CONVERT(FILE_HANDLE.CURRENT_PAGE, 0); 
  5080.         when others => 
  5081.           OUTPUT_TEXT := OUTPUT_TEXT & ("" & LETTER); 
  5082.       end case; 
  5083.       INDEX := INDEX + 2; 
  5084.       if INDEX > STRING_PKG.LENGTH(S_STR) then 
  5085.         exit; 
  5086.       end if; 
  5087.       S_STR := STRING_PKG.SUBSTR(S_STR, INDEX, STRING_PKG.LENGTH(S_STR) - INDEX
  5088.         + 1); 
  5089.     end loop; 
  5090.  
  5091.     return STRING_PKG.VALUE(OUTPUT_TEXT); 
  5092.  
  5093.   end TILDE_SUBSTITUTE; 
  5094.   pragma PAGE; 
  5095.   procedure PUT_TEXT(FILE_HANDLE : in PAGINATED_FILE_HANDLE) is 
  5096.  
  5097.   --|-Algorithm:
  5098.   --| If access to text array is null
  5099.   --|    then write appropriate number of line terminators
  5100.   --|         exit
  5101.   --| Loop over the depth of the text array
  5102.   --|    If text is null
  5103.   --|       then write line terminator
  5104.   --|       else resolve tilde substitution
  5105.   --|            write a line of text followed by a line terminator
  5106.   --| Exit
  5107.   --|+
  5108.  
  5109.     TEXT_SIZE : INTEGER; 
  5110.  
  5111.   begin
  5112.     if FILE_HANDLE.HEADER_SIZE = 0 then 
  5113.       return; 
  5114.     end if; 
  5115.     TEXT_SIZE := FILE_HANDLE.HEADER_SIZE; 
  5116.     if FILE_HANDLE.PAGE_HEADER = null then 
  5117.       TEXT_IO.NEW_LINE(FILE_HANDLE.FILE_REFERENCE, TEXT_IO.POSITIVE_COUNT(
  5118.         TEXT_SIZE)); 
  5119.       return; 
  5120.     end if; 
  5121.     for I in 1 .. TEXT_SIZE loop
  5122.       STRING_PKG.MARK; 
  5123.       if STRING_PKG.IS_EMPTY(FILE_HANDLE.PAGE_HEADER(I)) then 
  5124.         TEXT_IO.NEW_LINE(FILE_HANDLE.FILE_REFERENCE, 1); 
  5125.       else 
  5126.         TEXT_IO.PUT_LINE(FILE_HANDLE.FILE_REFERENCE, TILDE_SUBSTITUTE(
  5127.           FILE_HANDLE, FILE_HANDLE.PAGE_HEADER(I))); 
  5128.       end if; 
  5129.       STRING_PKG.RELEASE; 
  5130.     end loop; 
  5131.  
  5132.   end PUT_TEXT; 
  5133.   pragma PAGE; 
  5134.   procedure FREE_STRUCTURE is 
  5135.     new UNCHECKED_DEALLOCATION(PAGINATED_FILE_STRUCTURE, PAGINATED_FILE_HANDLE)
  5136.       ; 
  5137.  
  5138.   procedure ABORT_PAGINATED_OUTPUT(FILE_HANDLE : in out PAGINATED_FILE_HANDLE)
  5139.     is 
  5140.  
  5141.   --|-Algorithm:
  5142.   --| If given handle is null
  5143.   --|    return
  5144.   --| Return header/footer text array storage to the heap
  5145.   --| Close file
  5146.   --| Return file structure storage to the heap
  5147.   --| Exit
  5148.   --|+        
  5149.  
  5150.   begin
  5151.     if FILE_HANDLE = null then 
  5152.       return; 
  5153.     end if; 
  5154.     CLEAR_TEXT(FILE_HANDLE.PAGE_HEADER); 
  5155.     STRING_PKG.FLUSH(FILE_HANDLE.CURRENT_CALENDAR); 
  5156.     STRING_PKG.FLUSH(FILE_HANDLE.FILE_NAME); 
  5157.     TEXT_IO.CLOSE(FILE_HANDLE.FILE_REFERENCE); 
  5158.     FREE_STRUCTURE(FILE_HANDLE); 
  5159.  
  5160.   exception
  5161.  
  5162.     when TEXT_IO.STATUS_ERROR => 
  5163.       FREE_STRUCTURE(FILE_HANDLE); 
  5164.  
  5165.   end ABORT_PAGINATED_OUTPUT; 
  5166.   pragma PAGE; 
  5167.   procedure LINE_FEED(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5168.                       COUNT       : in INTEGER) is 
  5169.  
  5170.   --|-Algorithm:
  5171.   --| If at top of the page
  5172.   --|    then write header 
  5173.   --| If the request count is 0
  5174.   --|    then return
  5175.   --| If the request is greater than the remainder on the page
  5176.   --|    then write remainder number of new lines
  5177.   --|         decrement request by this amount
  5178.   --|         write footer
  5179.   --|         eject page and update page and line count
  5180.   --|         if more space needed
  5181.   --|            then recursively call self with count
  5182.   --|    else write requested number of new lines
  5183.   --|         update line count
  5184.   --| Exit
  5185.   --|+
  5186.  
  5187.     SKIP_COUNT : INTEGER; 
  5188.  
  5189.   begin
  5190.  
  5191.     if FILE_HANDLE.CURRENT_LINE = 0 and FILE_HANDLE.PAGE_SIZE /= 0 then 
  5192.       FILE_HANDLE.CURRENT_LINE := 1; 
  5193.       FILE_HANDLE.CURRENT_PAGE := FILE_HANDLE.CURRENT_PAGE + 1; 
  5194.       TEXT_IO.NEW_PAGE(FILE_HANDLE.FILE_REFERENCE); 
  5195.       PUT_TEXT(FILE_HANDLE); 
  5196.     end if; 
  5197.     if COUNT <= 0 then 
  5198.       return; 
  5199.     end if; 
  5200.     SKIP_COUNT := FILE_HANDLE.MAXIMUM_LINE - FILE_HANDLE.CURRENT_LINE + 1; 
  5201.     if COUNT >= SKIP_COUNT and FILE_HANDLE.PAGE_SIZE /= 0 then 
  5202.       TEXT_IO.NEW_LINE(FILE_HANDLE.FILE_REFERENCE, TEXT_IO.POSITIVE_COUNT(
  5203.         SKIP_COUNT)); 
  5204.       SKIP_COUNT := COUNT - SKIP_COUNT; 
  5205.       FILE_HANDLE.CURRENT_LINE := 0; 
  5206.       if SKIP_COUNT /= 0 then 
  5207.         LINE_FEED(FILE_HANDLE, SKIP_COUNT); 
  5208.       end if; 
  5209.     else 
  5210.       TEXT_IO.NEW_LINE(FILE_HANDLE.FILE_REFERENCE, TEXT_IO.POSITIVE_COUNT(COUNT)
  5211.         ); 
  5212.       if FILE_HANDLE.PAGE_SIZE /= 0 then 
  5213.         FILE_HANDLE.CURRENT_LINE := FILE_HANDLE.CURRENT_LINE + COUNT; 
  5214.       end if; 
  5215.     end if; 
  5216.  
  5217.   end LINE_FEED; 
  5218.   pragma PAGE; 
  5219.   procedure PAGE_EJECT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5220.                        COUNT       : in INTEGER := 1) is 
  5221.  
  5222.   --|-Algorithm:
  5223.   --| Validate paginated file structure (raise error if not valid)
  5224.   --| Raise Invalid_Count if page request is too large
  5225.   --| Convert the number of pages to skip into number of lines  
  5226.   --| Write out this number of new line control characters
  5227.   --| while taking into account header, footer, and pagination.
  5228.   --| Exit
  5229.   --|+
  5230.  
  5231.   begin
  5232.  
  5233.     if FILE_HANDLE.PAGE_SIZE = 0 then 
  5234.       LINE_FEED(FILE_HANDLE, 1); 
  5235.       return; 
  5236.     end if; 
  5237.     if COUNT > 99 then 
  5238.       raise INVALID_COUNT; 
  5239.     end if; 
  5240.     if FILE_HANDLE.CURRENT_LINE = 0 then 
  5241.       LINE_FEED(FILE_HANDLE, (COUNT*FILE_HANDLE.MAXIMUM_LINE)); 
  5242.     else 
  5243.       LINE_FEED(FILE_HANDLE, (COUNT*FILE_HANDLE.MAXIMUM_LINE - FILE_HANDLE.
  5244.         CURRENT_LINE + 1)); 
  5245.     end if; 
  5246.  
  5247.   end PAGE_EJECT; 
  5248.   pragma PAGE; 
  5249.   procedure SET_TEXT_AREA(TEXT_HANDLE : in out VARIABLE_STRING_ARRAY_HANDLE; 
  5250.                           AREA_SIZE   : in INTEGER) is 
  5251.  
  5252.     TEMP_HANDLE : VARIABLE_STRING_ARRAY_HANDLE; 
  5253.  
  5254.   begin
  5255.  
  5256.     if AREA_SIZE <= 0 then 
  5257.       return; 
  5258.     end if; 
  5259.     if TEXT_HANDLE = null or else TEXT_HANDLE'LAST < AREA_SIZE then 
  5260.       TEMP_HANDLE := TEXT_HANDLE; 
  5261.       TEXT_HANDLE := new VARIABLE_STRING_ARRAY(1 .. AREA_SIZE); 
  5262.       if TEMP_HANDLE /= null then 
  5263.         for I in TEMP_HANDLE'range loop
  5264.           TEXT_HANDLE(I) := STRING_PKG.MAKE_PERSISTENT(TEMP_HANDLE(I)); 
  5265.         end loop; 
  5266.         CLEAR_TEXT(TEMP_HANDLE); 
  5267.       end if; 
  5268.     end if; 
  5269.  
  5270.   end SET_TEXT_AREA; 
  5271.   pragma PAGE; 
  5272.   procedure WRITE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5273.                   TEXT_LINE   : in STRING; 
  5274.                   FEED        : in BOOLEAN) is 
  5275.  
  5276.   --|-Algorithm:
  5277.   --| Validate paginated file structure (raise error if not valid)
  5278.   --| If at the top of the page
  5279.   --|    then write out the header
  5280.   --| Output the given line of text to the paginated file
  5281.   --| Write out a new line control character
  5282.   --| If at the bottom of the page
  5283.   --|    then write out the footer and eject the page
  5284.   --| Exit
  5285.   --|+
  5286.  
  5287.   begin
  5288.  
  5289.     CHECK_VALID(FILE_HANDLE); 
  5290.     LINE_FEED(FILE_HANDLE, 0); 
  5291.     TEXT_IO.PUT(FILE_HANDLE.FILE_REFERENCE, TEXT_LINE); 
  5292.     if FEED then 
  5293.       LINE_FEED(FILE_HANDLE, 1); 
  5294.     end if; 
  5295.   end WRITE; 
  5296.   pragma PAGE; 
  5297.   procedure CREATE_PAGINATED_FILE(FILE_NAME   : in HOST_FILE_NAME := ""; 
  5298.                                   FILE_HANDLE : in out PAGINATED_FILE_HANDLE; 
  5299.                                   PAGE_SIZE   : in INTEGER := 60; 
  5300.                                   HEADER_SIZE : in INTEGER := 6) is 
  5301.  
  5302.   --|-Algorithm:
  5303.   --| If an active (ie. non-null) handle is given
  5304.   --|    then close that file first
  5305.   --| Create a paginated file structure
  5306.   --| If no file name is given
  5307.   --|    then assume standard output
  5308.   --|    else create (open) an external file 
  5309.   --| Fill the paginated file structure with external file information,
  5310.   --| page layout information, and current date/time
  5311.   --| Return access to the completed structure
  5312.   --| Exit
  5313.   --|+
  5314.  
  5315.   begin
  5316.  
  5317.     CLOSE_PAGINATED_FILE(FILE_HANDLE); 
  5318.     FILE_HANDLE := new PAGINATED_FILE_STRUCTURE; 
  5319.     if FILE_NAME /= "" then 
  5320.       FILE_HANDLE.FILE_NAME := STRING_PKG.MAKE_PERSISTENT(FILE_NAME); 
  5321.       TEXT_IO.CREATE(FILE => FILE_HANDLE.FILE_REFERENCE, NAME => FILE_NAME); 
  5322.     end if; 
  5323.     SET_PAGE_LAYOUT(FILE_HANDLE, PAGE_SIZE, HEADER_SIZE); 
  5324.     SET_DATE_TIME(FILE_HANDLE); 
  5325.  
  5326.   exception
  5327.  
  5328.     when TEXT_IO.STATUS_ERROR => 
  5329.       ABORT_PAGINATED_OUTPUT(FILE_HANDLE); 
  5330.       raise FILE_ALREADY_OPEN; 
  5331.     when TEXT_IO.NAME_ERROR | TEXT_IO.USE_ERROR => 
  5332.       ABORT_PAGINATED_OUTPUT(FILE_HANDLE); 
  5333.       raise FILE_ERROR; 
  5334.     when PAGE_LAYOUT_ERROR => 
  5335.       ABORT_PAGINATED_OUTPUT(FILE_HANDLE); 
  5336.       raise PAGE_LAYOUT_ERROR; 
  5337.  
  5338.   end CREATE_PAGINATED_FILE; 
  5339.   pragma PAGE; 
  5340.   pragma PAGE; 
  5341.   procedure SET_PAGE_LAYOUT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5342.                             PAGE_SIZE   : in INTEGER; 
  5343.                             HEADER_SIZE : in INTEGER) is 
  5344.  
  5345.   --|-Algorithm:
  5346.   --| Validate paginated file structure (raise error if not valid)
  5347.   --| If page layout is contradictory
  5348.   --|    then raise an error
  5349.   --| If not at the top of the page
  5350.   --|    then eject current page
  5351.   --| Set page size, header size, footer size, and text area size
  5352.   --| per page
  5353.   --| Exit
  5354.   --|+
  5355.  
  5356.     TEMP_HANDLE : VARIABLE_STRING_ARRAY_HANDLE; 
  5357.  
  5358.   begin
  5359.  
  5360.     CHECK_VALID(FILE_HANDLE); 
  5361.     if PAGE_SIZE < 0 or HEADER_SIZE < 0 or (PAGE_SIZE /= 0 and PAGE_SIZE <= 
  5362.       HEADER_SIZE) then 
  5363.       raise PAGE_LAYOUT_ERROR; 
  5364.     end if; 
  5365.     if FILE_HANDLE.CURRENT_LINE /= 0 and FILE_HANDLE.PAGE_SIZE /= 0 then 
  5366.       PAGE_EJECT(FILE_HANDLE, 1); 
  5367.     end if; 
  5368.     FILE_HANDLE.PAGE_SIZE := PAGE_SIZE; 
  5369.     if PAGE_SIZE = 0 then 
  5370.       FILE_HANDLE.MAXIMUM_LINE := 0; 
  5371.     else 
  5372.       FILE_HANDLE.MAXIMUM_LINE := PAGE_SIZE - HEADER_SIZE; 
  5373.     end if; 
  5374.     FILE_HANDLE.HEADER_SIZE := HEADER_SIZE; 
  5375.     SET_TEXT_AREA(FILE_HANDLE.PAGE_HEADER, FILE_HANDLE.HEADER_SIZE); 
  5376.   end SET_PAGE_LAYOUT; 
  5377.  
  5378.   procedure SET_HEADER(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5379.                        HEADER_TEXT : in VARIABLE_STRING_ARRAY) is 
  5380.  
  5381.   --|-Algorithm:
  5382.   --| Set given header text as odd page header 
  5383.   --| Exit
  5384.   --|+
  5385.  
  5386.   begin
  5387.  
  5388.     SET_TEXT(FILE_HANDLE, HEADER_TEXT); 
  5389.  
  5390.   end SET_HEADER; 
  5391.   pragma PAGE; 
  5392.   procedure SET_HEADER(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5393.                        HEADER_LINE : in INTEGER; 
  5394.                        HEADER_TEXT : in STRING_PKG.STRING_TYPE) is 
  5395.  
  5396.   --|-Algorithm:
  5397.   --| Validate paginated file structure (raise error if not valid)
  5398.   --| If requested header line number is out of range
  5399.   --|     then raise an error
  5400.   --| Set header text at requested line for odd pages
  5401.   --| Exit
  5402.   --|+
  5403.  
  5404.   begin
  5405.  
  5406.     CHECK_VALID(FILE_HANDLE); 
  5407.     if HEADER_LINE < 1 then 
  5408.       raise TEXT_UNDERFLOW; 
  5409.     end if; 
  5410.     if HEADER_LINE > FILE_HANDLE.HEADER_SIZE then 
  5411.       raise TEXT_OVERFLOW; 
  5412.     end if; 
  5413.     FILE_HANDLE.PAGE_HEADER(HEADER_LINE) := STRING_PKG.MAKE_PERSISTENT(
  5414.       HEADER_TEXT); 
  5415.  
  5416.   end SET_HEADER; 
  5417.   pragma PAGE; 
  5418.   procedure SET_HEADER(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5419.                        HEADER_LINE : in INTEGER; 
  5420.                        HEADER_TEXT : in STRING) is 
  5421.  
  5422.   --|-Algorithm:
  5423.   --| Create a variable string
  5424.   --| Set odd page header
  5425.   --| Exit
  5426.   --|+
  5427.  
  5428.     TEXT : STRING_PKG.STRING_TYPE; 
  5429.  
  5430.   begin
  5431.  
  5432.     TEXT := STRING_PKG.MAKE_PERSISTENT(HEADER_TEXT); 
  5433.     SET_HEADER(FILE_HANDLE, HEADER_LINE, TEXT); 
  5434.     STRING_PKG.FLUSH(TEXT); 
  5435.  
  5436.   end SET_HEADER; 
  5437.  
  5438.   procedure CLOSE_PAGINATED_FILE(FILE_HANDLE : in out PAGINATED_FILE_HANDLE) is 
  5439.  
  5440.   --|-Algorithm:
  5441.   --| If no file (ie. handle is null)
  5442.   --|    then return
  5443.   --| If not at the top of the page
  5444.   --|    then eject current page
  5445.   --| Return all storage used for this file to the heap
  5446.   --| Close the external file
  5447.   --| Exit
  5448.   --|+
  5449.  
  5450.   begin
  5451.  
  5452.     if FILE_HANDLE = null then 
  5453.       return; 
  5454.     end if; 
  5455.     if FILE_HANDLE.CURRENT_LINE /= 0 and FILE_HANDLE.PAGE_SIZE /= 0 then 
  5456.       PAGE_EJECT(FILE_HANDLE, 1); 
  5457.     end if; 
  5458.     ABORT_PAGINATED_OUTPUT(FILE_HANDLE); 
  5459.  
  5460.   end CLOSE_PAGINATED_FILE; 
  5461.   pragma PAGE; 
  5462.   procedure PUT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5463.                 TEXT        : in CHARACTER) is 
  5464.  
  5465.   begin
  5466.  
  5467.     WRITE(FILE_HANDLE, "" & TEXT, FALSE); 
  5468.  
  5469.   end PUT; 
  5470.   pragma PAGE; 
  5471.   procedure PUT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5472.                 TEXT        : in STRING) is 
  5473.  
  5474.   --|-Algorithm:
  5475.   --| Execute Write procedure with feed
  5476.   --| Exit
  5477.   --|+
  5478.  
  5479.   begin
  5480.  
  5481.     WRITE(FILE_HANDLE, TEXT, FALSE); 
  5482.  
  5483.   end PUT; 
  5484.   pragma PAGE; 
  5485.   procedure PUT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5486.                 TEXT        : in STRING_PKG.STRING_TYPE) is 
  5487.  
  5488.   --|-Algorithm:
  5489.   --| Create a fixed length string
  5490.   --| Output the line
  5491.   --| Exit
  5492.   --|+
  5493.  
  5494.   begin
  5495.  
  5496.     WRITE(FILE_HANDLE, STRING_PKG.VALUE(TEXT), FALSE); 
  5497.  
  5498.   end PUT; 
  5499.   pragma PAGE; 
  5500.   procedure PUT(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5501.                 TEXT        : in VARIABLE_STRING_ARRAY) is 
  5502.  
  5503.   --|-Algorithm:
  5504.   --| Loop for all elements of the variable string array
  5505.   --|    Create a fixed length string
  5506.   --|    Output the line
  5507.   --| Exit
  5508.   --|+
  5509.  
  5510.   begin
  5511.  
  5512.     for I in TEXT'range loop
  5513.       WRITE(FILE_HANDLE, STRING_PKG.VALUE(TEXT(I)), FALSE); 
  5514.     end loop; 
  5515.  
  5516.   end PUT; 
  5517.   pragma PAGE; 
  5518.   procedure SPACE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5519.                   COUNT       : in INTEGER) is 
  5520.  
  5521.   begin
  5522.  
  5523.     CHECK_VALID(FILE_HANDLE); 
  5524.     if COUNT <= 0 then 
  5525.       return; 
  5526.     end if; 
  5527.     declare
  5528.       SPACE_STRING : STRING(1 .. COUNT) := (1 .. COUNT => ' '); 
  5529.     begin
  5530.       WRITE(FILE_HANDLE, SPACE_STRING, FALSE); 
  5531.     end; 
  5532.  
  5533.   end SPACE; 
  5534.   pragma PAGE; 
  5535.   procedure PUT_LINE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5536.                      TEXT_LINE   : in STRING) is 
  5537.  
  5538.   --|-Algorithm:
  5539.   --| Execute Write procedure with feed
  5540.   --| Exit
  5541.   --|+
  5542.  
  5543.   begin
  5544.  
  5545.     WRITE(FILE_HANDLE, TEXT_LINE, TRUE); 
  5546.  
  5547.   end PUT_LINE; 
  5548.   pragma PAGE; 
  5549.   procedure PUT_LINE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5550.                      TEXT_LINE   : in STRING_PKG.STRING_TYPE) is 
  5551.  
  5552.   --|-Algorithm:
  5553.   --| Create a fixed length string
  5554.   --| Output the line
  5555.   --| Exit
  5556.   --|+
  5557.  
  5558.   begin
  5559.  
  5560.     WRITE(FILE_HANDLE, STRING_PKG.VALUE(TEXT_LINE), TRUE); 
  5561.  
  5562.   end PUT_LINE; 
  5563.   pragma PAGE; 
  5564.   procedure PUT_LINE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5565.                      TEXT_LINE   : in VARIABLE_STRING_ARRAY) is 
  5566.  
  5567.   --|-Algorithm:
  5568.   --| Loop for all elements of the variable string array
  5569.   --|    Create a fixed length string
  5570.   --|    Output the line
  5571.   --| Exit
  5572.   --|+
  5573.  
  5574.   begin
  5575.  
  5576.     for I in TEXT_LINE'range loop
  5577.       WRITE(FILE_HANDLE, STRING_PKG.VALUE(TEXT_LINE(I)), TRUE); 
  5578.     end loop; 
  5579.  
  5580.   end PUT_LINE; 
  5581.   pragma PAGE; 
  5582.   procedure SPACE_LINE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5583.                        COUNT       : in INTEGER := 1) is 
  5584.  
  5585.   --|-Algorithm:
  5586.   --| Validate paginated file structure (raise error if not valid)
  5587.   --| Raise Invalid_Count if space request is too large
  5588.   --| Write out the given number of new line control characters
  5589.   --| while taking into account header, footer, and pagination.
  5590.   --| Exit
  5591.   --|+
  5592.  
  5593.   begin
  5594.  
  5595.     CHECK_VALID(FILE_HANDLE); 
  5596.     LINE_FEED(FILE_HANDLE, COUNT); 
  5597.  
  5598.   end SPACE_LINE; 
  5599.   pragma PAGE; 
  5600.   procedure SKIP_LINE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5601.                       COUNT       : in INTEGER := 1) is 
  5602.  
  5603.   --|-Algorithm:
  5604.   --| Validate paginated file structure (raise error if not valid)
  5605.   --| Set the number of new line characters to be written as the
  5606.   --| number specified or the number of lines remaining on the 
  5607.   --| page which ever is smaller.
  5608.   --| Write out this number of new line control characters
  5609.   --| while taking into account header, footer, and pagination.
  5610.   --| (If at the top of the page then Skip_Lines does nothing)
  5611.   --| Exit
  5612.   --|+
  5613.  
  5614.     SKIP_COUNT : INTEGER; 
  5615.  
  5616.   begin
  5617.  
  5618.     CHECK_VALID(FILE_HANDLE); 
  5619.     if FILE_HANDLE.CURRENT_LINE /= 0 or FILE_HANDLE.PAGE_SIZE = 0 then 
  5620.       SKIP_COUNT := FILE_HANDLE.MAXIMUM_LINE - FILE_HANDLE.CURRENT_LINE + 1; 
  5621.       if SKIP_COUNT > COUNT or FILE_HANDLE.PAGE_SIZE = 0 then 
  5622.         SKIP_COUNT := COUNT; 
  5623.       end if; 
  5624.       LINE_FEED(FILE_HANDLE, SKIP_COUNT); 
  5625.     end if; 
  5626.   end SKIP_LINE; 
  5627.   pragma PAGE; 
  5628.   procedure PUT_PAGE(FILE_HANDLE : in PAGINATED_FILE_HANDLE; 
  5629.                      COUNT       : in INTEGER := 1) is 
  5630.  
  5631.   --|-Algorithm:
  5632.   --| Validate paginated file structure (raise error if not valid)
  5633.   --| Raise Invalid_Count if page request is too large
  5634.   --| Convert the number of pages to skip into number of lines  
  5635.   --| Write out this number of new line control characters
  5636.   --| while taking into account header, footer, and pagination.
  5637.   --| Exit
  5638.   --|+
  5639.  
  5640.   begin
  5641.  
  5642.     CHECK_VALID(FILE_HANDLE); 
  5643.     PAGE_EJECT(FILE_HANDLE, COUNT); 
  5644.  
  5645.   end PUT_PAGE; 
  5646.   pragma PAGE; 
  5647.   function AVAILABLE_LINES(FILE_HANDLE : in PAGINATED_FILE_HANDLE) return
  5648.     INTEGER is 
  5649.  
  5650.   --|-Algorithm:
  5651.   --| Validate paginated file structure (raise error if not valid)
  5652.   --| Return the number of lines remaining on the page
  5653.   --|+
  5654.  
  5655.   begin
  5656.  
  5657.     CHECK_VALID(FILE_HANDLE); 
  5658.     if FILE_HANDLE.PAGE_SIZE = 0 then 
  5659.       return -1; 
  5660.     end if; 
  5661.     if FILE_HANDLE.CURRENT_LINE = 0 then 
  5662.       return FILE_HANDLE.MAXIMUM_LINE; 
  5663.     else 
  5664.       return FILE_HANDLE.MAXIMUM_LINE - FILE_HANDLE.CURRENT_LINE + 1; 
  5665.     end if; 
  5666.  
  5667.   end AVAILABLE_LINES; 
  5668.  
  5669. end SIMPLE_PAGINATED_OUTPUT; 
  5670. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5671. --cli.spc
  5672. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5673. with STRING_PKG; use STRING_PKG; 
  5674.  
  5675. --------------------------------------------------------------------
  5676.  
  5677. package COMMAND_LINE_INTERFACE is 
  5678. --| Provides primitives for getting at the command line arguments.
  5679.  
  5680. --| Overview
  5681. --| This package provides a universal and portable interface to 
  5682. --| the arguments typed on a command line when a program is invoked.
  5683. --| Each command line argument is either a Word (sequence of non-blank
  5684. --| characters) or a quoted string, with embedded quotes doubled.
  5685. --| 
  5686. --| Both named and positional arguments may be given on the command
  5687. --| line.  However, once a named parameter is used, all the subseqent
  5688. --| parameters on the command line must be named parameters.  For example, 
  5689. --| the commands
  5690. --|-
  5691. --|     compile  abc pqr xyz library => plib
  5692. --|     compile  abc,pqr,unit=>xyz,library=>plib
  5693. --|+
  5694. --| have one named argument and three positional arguments.  This
  5695. --| package separates the named parameters from the positional
  5696. --| parameters, ignores spaces around the "bound to" (=>) symbol, and
  5697. --| allows parameters to be separated by either spaces or commas,
  5698. --| so these command lines are indistinguishable.
  5699. --| 
  5700. --| At program elaboration time, the command line string is automatically
  5701. --| obtained from the host operating system and parsed into
  5702. --| individual arguments.  The following operations may then be used:
  5703. --|-
  5704. --| Named_arg_count()        Returns number of named arguments entered
  5705. --| Positional_arg_count()    Returns number of positional arguments
  5706. --| Positional_arg_value(N)    Returns the Nth positional argument
  5707. --| Named_arg_value(Name, Fnd, val) Returns value of a named argument
  5708. --| Arguments()            Returns the entire command line 
  5709. --|+
  5710.  
  5711. ----------------------------------------------------------------
  5712.  
  5713.   MAX_ARGS : constant := 255; 
  5714.   --| Maximum number of command line arguments (arbitrary).
  5715.  
  5716.   subtype ARGUMENT_COUNT is INTEGER range 0 .. MAX_ARGS; 
  5717.   --| For number of arguments
  5718.   subtype ARGUMENT_INDEX is ARGUMENT_COUNT range 1 .. ARGUMENT_COUNT'LAST; 
  5719.   --| Used to number the command line arguments.
  5720.  
  5721.   NO_ARG                    : exception; 
  5722.   --| Raised when request made for nonexistent argument
  5723.  
  5724.   MISSING_POSITIONAL_ARG    : exception; 
  5725.   --| Raised when command line is missing positional argument (A,,B)
  5726.  
  5727.   INVALID_NAMED_ASSOCIATION : exception; 
  5728.   --| Raised when command line is missing named argument value (output=> ,A,B)
  5729.  
  5730.   UNREFERENCED_NAMED_ARG    : exception; 
  5731.   --| Raised when not all named parameters have been retrieved
  5732.  
  5733.   INVALID_PARAMETER_ORDER   : exception; 
  5734.   --| Raised when a positional parameter occurs after a named parameter
  5735.   --  in the command line
  5736.  
  5737.   ----------------------------------------------------------------
  5738.  
  5739.   procedure INITIALIZE( --| Initializes command_line_interface
  5740.                        ARG_STRING : in STRING); 
  5741.  
  5742.   --| N/A: modifies, errors, raises
  5743.  
  5744.   ---------------------------------------------------------------------
  5745.  
  5746.   function NAMED_ARG_COUNT --| Return number of named arguments
  5747.   return ARGUMENT_COUNT; 
  5748.   --| N/A: modifies, errors, raises
  5749.  
  5750.  
  5751.   function POSITIONAL_ARG_COUNT --| Return number of positional arguments
  5752.   return ARGUMENT_COUNT; 
  5753.   --| N/A: modifies, errors, raises
  5754.  
  5755.  
  5756.   ----------------------------------------------------------------
  5757.  
  5758.   function POSITIONAL_ARG_VALUE( --| Return an argument value
  5759.                                 N : in ARGUMENT_INDEX
  5760.                                 --| Position of desired argument
  5761.                                 ) return STRING;  --| Raises: no_arg
  5762.  
  5763.   --| Effects: Return the Nth argument.  If there is no argument at
  5764.   --| position N, no_arg is raised.
  5765.  
  5766.   --| N/A: modifies, errors
  5767.  
  5768.  
  5769.   function POSITIONAL_ARG_VALUE( --| Return an argument value
  5770.                                 N : in ARGUMENT_INDEX
  5771.                                     --| Position of desired argument
  5772.                                 ) return STRING_TYPE;  --| Raises: no_arg
  5773.  
  5774.   --| Effects: Return the Nth argument.  If there is no argument at
  5775.   --| position N, no_arg is raised.
  5776.  
  5777.   --| N/A: modifies, errors
  5778.  
  5779.   --------------------------------------------------------------------
  5780.  
  5781.   procedure NAMED_ARG_VALUE( --| Return a named argument value
  5782.                             NAME      : in STRING; 
  5783.                             FOUND     : out BOOLEAN; 
  5784.                             ARG_VALUE : out STRING); 
  5785.  
  5786.   --| Effects: Return the value associated with Name on the command
  5787.   --| line.  If there was none, return Default.
  5788.  
  5789.   --| N/A: modifies, errors
  5790.  
  5791.  
  5792.   procedure NAMED_ARG_VALUE( --| Return a named argument value
  5793.                             NAME      : in STRING; 
  5794.                             FOUND     : out BOOLEAN; 
  5795.                             ARG_VALUE : out STRING_TYPE); 
  5796.  
  5797.   --| Effects: Return the value associated with Name on the command
  5798.   --| line.  If there was none, return Default.
  5799.  
  5800.   --| N/A: modifies, errors
  5801.  
  5802.   ----------------------------------------------------------------
  5803.  
  5804.   function ARGUMENTS --| Return the entire argument string
  5805.   return STRING; 
  5806.   --| Effects: Return the entire command line, except for the name
  5807.   --| of the command itself.
  5808.  
  5809.   --| N/A: modifies, errors, raises
  5810.  
  5811.   ----------------------------------------------------------------
  5812.  
  5813.   procedure FINALIZE;  --| Raises: unrecognized parameters
  5814.  
  5815.   --| Effects: If not all named parameters have been retrieved
  5816.   --| unrecognized parameters is raised.
  5817.   --| N/A: modifies, errors
  5818.  
  5819. end COMMAND_LINE_INTERFACE; 
  5820.  
  5821. ----------------------------------------------------------------
  5822. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5823. --cli.bdy
  5824. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5825. with TEXT_IO; use TEXT_IO; 
  5826. with STRING_PKG; 
  5827. with STRING_SCANNER; 
  5828. ----------------------------------------------------------------
  5829.  
  5830. package body COMMAND_LINE_INTERFACE is 
  5831. --| Provides primitives for getting at the command line arguments.
  5832.  
  5833. --| Overview
  5834.  
  5835.   package SP renames STRING_PKG; 
  5836.   package SS renames STRING_SCANNER; 
  5837.  
  5838.   type NAME_VALUE is  --| Name/Value pair
  5839.     record
  5840.       NAME          : SP.STRING_TYPE;  --| Name of value
  5841.       VALUE         : SP.STRING_TYPE;  --| Value associated with name
  5842.       WAS_RETRIEVED : BOOLEAN := FALSE;  --| Flag indicating whether name-value
  5843.     end record;  --  association has been retrieved by tool
  5844.  
  5845.   type TOKEN_TYPE is (ADA_ID, WORD, BOUND_TO, NONE); 
  5846.  
  5847.   package TOKEN_TYPE_IO is 
  5848.     new ENUMERATION_IO(TOKEN_TYPE); 
  5849.   use TOKEN_TYPE_IO; 
  5850.  
  5851.   ARGUMENT_STRING : STRING(1 .. 132); 
  5852.   BLANKS          : STRING(1 .. 132) := (others => ' '); 
  5853.   N_ARG_COUNT     : ARGUMENT_COUNT;  --| Count of named args 
  5854.   P_ARG_COUNT     : ARGUMENT_COUNT;  --| Count of positional args 
  5855.   REJECTED        : BOOLEAN := FALSE; 
  5856.  
  5857.   NAMED_ARGS      : array(ARGUMENT_INDEX) of NAME_VALUE; 
  5858.  
  5859.   POSITIONAL_ARGS : array(ARGUMENT_INDEX) of SP.STRING_TYPE; 
  5860.  
  5861.   ----------------------------------------------------------------
  5862.  
  5863.   -- Local functions:
  5864.  
  5865.   procedure GET_TOKEN(SCAN_STRING : in out SS.SCANNER; 
  5866.                       ARGUMENT    : in out SP.STRING_TYPE; 
  5867.                       KIND        : in out TOKEN_TYPE) is 
  5868.  
  5869.     LAST_ARG     : SP.STRING_TYPE; 
  5870.     LAST_KIND    : TOKEN_TYPE; 
  5871.     FOUND        : BOOLEAN; 
  5872.     DELIMETER    : SP.STRING_TYPE; 
  5873.     DELIM_STRING : SS.SCANNER; 
  5874.     MORE_COMMAS  : BOOLEAN := FALSE; 
  5875.     TAIL         : SP.STRING_TYPE; 
  5876.  
  5877.   begin
  5878.  
  5879.     if REJECTED then 
  5880.       ARGUMENT := LAST_ARG; 
  5881.       KIND := LAST_KIND; 
  5882.       REJECTED := FALSE; 
  5883.     else 
  5884.       if SS.IS_SEQUENCE(" ,", SCAN_STRING) then 
  5885.         SS.SCAN_SEQUENCE(" ,", SCAN_STRING, FOUND, DELIMETER); 
  5886.         DELIM_STRING := SS.MAKE_SCANNER(DELIMETER); 
  5887.         loop
  5888.           SS.SKIP_SPACE(DELIM_STRING); 
  5889.           exit when not SS.MORE(DELIM_STRING); 
  5890.           SS.FORWARD(DELIM_STRING); 
  5891.           if MORE_COMMAS then 
  5892.             raise MISSING_POSITIONAL_ARG; 
  5893.           end if; 
  5894.           MORE_COMMAS := TRUE; 
  5895.         end loop; 
  5896.       end if; 
  5897.       if SS.IS_ADA_ID(SCAN_STRING) then 
  5898.         SS.SCAN_ADA_ID(SCAN_STRING, FOUND, ARGUMENT); 
  5899.         if SS.IS_LITERAL("=>", SCAN_STRING) or SS.IS_LITERAL("""", SCAN_STRING)
  5900.           or SS.IS_SEQUENCE(" ,", SCAN_STRING) or not SS.MORE(SCAN_STRING)
  5901.           then 
  5902.           KIND := ADA_ID; 
  5903.         else 
  5904.           if SS.IS_NOT_SEQUENCE(" ,", SCAN_STRING) then 
  5905.             SS.SCAN_NOT_SEQUENCE(" ,", SCAN_STRING, FOUND, TAIL); 
  5906.             ARGUMENT := SP."&"(ARGUMENT, TAIL); 
  5907.             KIND := WORD; 
  5908.           else 
  5909.             SS.SCAN_WORD(SCAN_STRING, FOUND, TAIL); 
  5910.             ARGUMENT := SP."&"(ARGUMENT, TAIL); 
  5911.             KIND := WORD; 
  5912.           end if; 
  5913.         end if; 
  5914.       elsif SS.IS_LITERAL("=>", SCAN_STRING) then 
  5915.         SS.SCAN_LITERAL("=>", SCAN_STRING, FOUND); 
  5916.         ARGUMENT := SP.CREATE("=>"); 
  5917.         KIND := BOUND_TO; 
  5918.       elsif SS.IS_QUOTED(SCAN_STRING) then 
  5919.         SS.SCAN_QUOTED(SCAN_STRING, FOUND, ARGUMENT); 
  5920.         KIND := WORD; 
  5921.       elsif SS.IS_ENCLOSED('(', ')', SCAN_STRING) then 
  5922.         SS.SCAN_ENCLOSED('(', ')', SCAN_STRING, FOUND, ARGUMENT); 
  5923.         KIND := WORD; 
  5924.       elsif SS.IS_NOT_SEQUENCE(" ,", SCAN_STRING) then 
  5925.         SS.SCAN_NOT_SEQUENCE(" ,", SCAN_STRING, FOUND, ARGUMENT); 
  5926.         KIND := WORD; 
  5927.       elsif SS.IS_WORD(SCAN_STRING) then 
  5928.         SS.SCAN_WORD(SCAN_STRING, FOUND, ARGUMENT); 
  5929.         KIND := WORD; 
  5930.       else 
  5931.         ARGUMENT := SP.CREATE(""); 
  5932.         KIND := NONE; 
  5933.       end if; 
  5934.       LAST_KIND := KIND; 
  5935.       LAST_ARG := ARGUMENT; 
  5936.     end if; 
  5937.   end GET_TOKEN; 
  5938.  
  5939.   -----------------------------------------------------------------------
  5940.  
  5941.   procedure SAVE_NAMED(NAME  : in SP.STRING_TYPE; 
  5942.                        VALUE : in SP.STRING_TYPE) is 
  5943.  
  5944.   begin
  5945.     N_ARG_COUNT := N_ARG_COUNT + 1; 
  5946.     NAMED_ARGS(N_ARG_COUNT).NAME := NAME; 
  5947.     NAMED_ARGS(N_ARG_COUNT).VALUE := VALUE; 
  5948.   end SAVE_NAMED; 
  5949.  
  5950.   procedure SAVE_POSITIONAL(VALUE : in SP.STRING_TYPE) is 
  5951.  
  5952.   begin
  5953.     if N_ARG_COUNT > 0 then 
  5954.       raise INVALID_PARAMETER_ORDER; 
  5955.     end if; 
  5956.     P_ARG_COUNT := P_ARG_COUNT + 1; 
  5957.     POSITIONAL_ARGS(P_ARG_COUNT) := VALUE; 
  5958.   end SAVE_POSITIONAL; 
  5959.  
  5960.   procedure REJECT_TOKEN is 
  5961.  
  5962.   begin
  5963.     REJECTED := TRUE; 
  5964.   end REJECT_TOKEN; 
  5965.  
  5966.   ----------------------------------------------------------------
  5967.  
  5968.   procedure INITIALIZE(ARG_STRING : in STRING) is 
  5969.  
  5970.   begin
  5971.  
  5972.     declare
  5973.  
  5974.       type STATE_TYPE is (HAVE_NOTHING, HAVE_ADA_ID, HAVE_BOUND_TO); 
  5975.  
  5976.       INDEX       : INTEGER;  --| Index of characters in argument string
  5977.       SCAN_STRING : SS.SCANNER;  --| Scanned argument string
  5978.       ARGUMENT    : SP.STRING_TYPE;  --| Argument scanned from argument string
  5979.       KIND        : TOKEN_TYPE;  --| Kind of argument- WORD, =>, Ada_ID
  5980.       OLD_ARG     : SP.STRING_TYPE;  --| Previously scanned argument 
  5981.       FOUND       : BOOLEAN; 
  5982.  
  5983.       STATE       : STATE_TYPE := HAVE_NOTHING; 
  5984.       --| State of argument in decision tree 
  5985.  
  5986.     begin
  5987.  
  5988.       INDEX := ARG_STRING'FIRST; 
  5989.       N_ARG_COUNT := 0; 
  5990.       P_ARG_COUNT := 0; 
  5991.  
  5992.       -- Remove trailing blanks and final semicolon  
  5993.       for I in reverse ARG_STRING'range loop
  5994.         if ARG_STRING(I) /= ' ' then 
  5995.           if ARG_STRING(I) = ';' then 
  5996.             INDEX := I - 1; 
  5997.           else 
  5998.             INDEX := I; 
  5999.           end if; 
  6000.           exit; 
  6001.         end if; 
  6002.       end loop; 
  6003.  
  6004.       -- Convert argument string to scanner and remove enclosing parantheses
  6005.       SCAN_STRING := SS.MAKE_SCANNER(SP.CREATE(ARG_STRING(ARG_STRING'FIRST .. 
  6006.         INDEX))); 
  6007.       if SS.IS_ENCLOSED('(', ')', SCAN_STRING) then 
  6008.         SS.MARK(SCAN_STRING); 
  6009.         SS.SCAN_ENCLOSED('(', ')', SCAN_STRING, FOUND, ARGUMENT); 
  6010.         SS.SKIP_SPACE(SCAN_STRING); 
  6011.         if not SS.MORE(SCAN_STRING) then 
  6012.           SS.DESTROY_SCANNER(SCAN_STRING); 
  6013.           SCAN_STRING := SS.MAKE_SCANNER(ARGUMENT); 
  6014.         else 
  6015.           SS.RESTORE(SCAN_STRING); 
  6016.         end if; 
  6017.       end if; 
  6018.  
  6019.       -- Parse argument string and save arguments 
  6020.       loop
  6021.         GET_TOKEN(SCAN_STRING, ARGUMENT, KIND); 
  6022.         case STATE is 
  6023.           when HAVE_NOTHING => 
  6024.             case KIND is 
  6025.               when ADA_ID => 
  6026.                 OLD_ARG := ARGUMENT; 
  6027.                 STATE := HAVE_ADA_ID; 
  6028.               when WORD => 
  6029.                 SAVE_POSITIONAL(ARGUMENT); 
  6030.                 STATE := HAVE_NOTHING; 
  6031.               when BOUND_TO => 
  6032.                 STATE := HAVE_NOTHING; 
  6033.                 raise INVALID_NAMED_ASSOCIATION; 
  6034.               when NONE => 
  6035.                 null; 
  6036.             end case; 
  6037.           when HAVE_ADA_ID => 
  6038.             case KIND is 
  6039.               when ADA_ID => 
  6040.                 SAVE_POSITIONAL(OLD_ARG); 
  6041.                 OLD_ARG := ARGUMENT; 
  6042.                 STATE := HAVE_ADA_ID; 
  6043.               when WORD => 
  6044.                 SAVE_POSITIONAL(OLD_ARG); 
  6045.                 SAVE_POSITIONAL(ARGUMENT); 
  6046.                 STATE := HAVE_NOTHING; 
  6047.               when BOUND_TO => 
  6048.                 STATE := HAVE_BOUND_TO; 
  6049.               when NONE => 
  6050.                 SAVE_POSITIONAL(OLD_ARG); 
  6051.             end case; 
  6052.           when HAVE_BOUND_TO => 
  6053.             case KIND is 
  6054.               when ADA_ID | WORD => 
  6055.                 SAVE_NAMED(OLD_ARG, ARGUMENT); 
  6056.                 STATE := HAVE_NOTHING; 
  6057.               when BOUND_TO => 
  6058.                 STATE := HAVE_BOUND_TO; 
  6059.                 raise INVALID_NAMED_ASSOCIATION; 
  6060.               when NONE => 
  6061.                 raise INVALID_NAMED_ASSOCIATION; 
  6062.  
  6063.             end case; 
  6064.         end case; 
  6065.         exit when KIND = NONE; 
  6066.       end loop; 
  6067.     end; 
  6068.     ARGUMENT_STRING(1 .. ARG_STRING'LENGTH) := ARG_STRING; 
  6069.     ARGUMENT_STRING(ARG_STRING'LENGTH + 1 .. 132) := BLANKS(ARG_STRING'LENGTH + 
  6070.       1 .. 132); 
  6071.   end INITIALIZE; 
  6072.  
  6073.   --------------------------------------------------------------------------
  6074.  
  6075.   function NAMED_ARG_COUNT --| Return number of named arguments
  6076.   return ARGUMENT_COUNT is 
  6077.  
  6078.   begin
  6079.     return N_ARG_COUNT; 
  6080.   end NAMED_ARG_COUNT; 
  6081.  
  6082.   ----------------------------------------------------------------
  6083.  
  6084.   function POSITIONAL_ARG_COUNT --| Return number of positional arguments
  6085.   return ARGUMENT_COUNT is 
  6086.  
  6087.   begin
  6088.     return P_ARG_COUNT; 
  6089.   end POSITIONAL_ARG_COUNT; 
  6090.  
  6091.   ----------------------------------------------------------------
  6092.  
  6093.   function POSITIONAL_ARG_VALUE( --| Return an argument value
  6094.                                 N : in ARGUMENT_INDEX
  6095.                                 --| Position of desired argument
  6096.                                 ) return STRING is  --| Raises: no_arg
  6097.  
  6098.   --| Effects: Return the Nth argument.  If there is no argument at
  6099.   --| position N, no_arg is raised.
  6100.  
  6101.   --| N/A: modifies, errors
  6102.  
  6103.   begin
  6104.     if N > P_ARG_COUNT then 
  6105.       raise NO_ARG; 
  6106.     else 
  6107.       return SP.VALUE(POSITIONAL_ARGS(N)); 
  6108.     end if; 
  6109.   end POSITIONAL_ARG_VALUE; 
  6110.  
  6111.   ----------------------------------------------------------------
  6112.  
  6113.   function POSITIONAL_ARG_VALUE( --| Return an argument value
  6114.                                 N : in ARGUMENT_INDEX
  6115.                                 --| Position of desired argument
  6116.                                 ) return SP.STRING_TYPE is  --| Raises: no_arg
  6117.  
  6118.   --| Effects: Return the Nth argument.  If there is no argument at
  6119.   --| position N, no_arg is raised.
  6120.  
  6121.   --| N/A: modifies, errors
  6122.  
  6123.   begin
  6124.     if N > P_ARG_COUNT then 
  6125.       raise NO_ARG; 
  6126.     else 
  6127.       return POSITIONAL_ARGS(N); 
  6128.     end if; 
  6129.   end POSITIONAL_ARG_VALUE; 
  6130.  
  6131.   ----------------------------------------------------------------
  6132.  
  6133.   procedure NAMED_ARG_VALUE( --| Return a named argument value
  6134.                             NAME      : in STRING; 
  6135.                             FOUND     : out BOOLEAN; 
  6136.                             ARG_VALUE : out STRING) is 
  6137.  
  6138.   --| Effects: Return the value associated with Name on the command
  6139.   --| line. 
  6140.     FOUND_FLAG : BOOLEAN := FALSE; 
  6141.  
  6142.   begin
  6143.     for I in 1 .. N_ARG_COUNT loop
  6144.       if SP.EQUAL(SP.UPPER(NAMED_ARGS(I).NAME), SP.UPPER(SP.CREATE(NAME))) then 
  6145.         NAMED_ARGS(I).WAS_RETRIEVED := TRUE; 
  6146.         ARG_VALUE := SP.VALUE(NAMED_ARGS(I).VALUE); 
  6147.         FOUND_FLAG := TRUE; 
  6148.         exit; 
  6149.       end if; 
  6150.     end loop; 
  6151.     if FOUND_FLAG = FALSE then 
  6152.       ARG_VALUE := "   "; 
  6153.     end if; 
  6154.     FOUND := FOUND_FLAG; 
  6155.   end NAMED_ARG_VALUE; 
  6156.   ----------------------------------------------------------------
  6157.  
  6158.   procedure NAMED_ARG_VALUE( --| Return a named argument value
  6159.                             NAME      : in STRING; 
  6160.                             FOUND     : out BOOLEAN; 
  6161.                             ARG_VALUE : out SP.STRING_TYPE) is 
  6162.  
  6163.   --| Effects: Return the value associated with Name on the command
  6164.   --| line.  If there was none, return Default.
  6165.  
  6166.  
  6167.   begin
  6168.     FOUND := FALSE; 
  6169.     for I in 1 .. N_ARG_COUNT loop
  6170.       if SP.EQUAL(SP.UPPER(NAMED_ARGS(I).NAME), SP.UPPER(SP.CREATE(NAME))) then 
  6171.         NAMED_ARGS(I).WAS_RETRIEVED := TRUE; 
  6172.         ARG_VALUE := NAMED_ARGS(I).VALUE; 
  6173.         FOUND := TRUE; 
  6174.         exit; 
  6175.       end if; 
  6176.     end loop; 
  6177.   end NAMED_ARG_VALUE; 
  6178.  
  6179.   ----------------------------------------------------------------
  6180.  
  6181.   function ARGUMENTS --| Return the entire argument string
  6182.   return STRING is 
  6183.  
  6184.   --| Effects: Return the entire command line, except for the name
  6185.   --| of the command itself.
  6186.  
  6187.   begin
  6188.     return ARGUMENT_STRING; 
  6189.   end ARGUMENTS; 
  6190.   ----------------------------------------------------------------
  6191.  
  6192.   procedure FINALIZE is  --| Raises: unreferenced_named_arg
  6193.  
  6194.   begin
  6195.     for I in 1 .. NAMED_ARG_COUNT loop
  6196.       if NAMED_ARGS(I).WAS_RETRIEVED = FALSE then 
  6197.         raise UNREFERENCED_NAMED_ARG; 
  6198.       end if; 
  6199.     end loop; 
  6200.   end FINALIZE; 
  6201.  
  6202.   -------------------------------------------------------------------
  6203.  
  6204. end COMMAND_LINE_INTERFACE; 
  6205. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6206. --fileman.spc
  6207. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6208. package File_Manager is
  6209.  
  6210. --| Overview
  6211. --| This package provides some host independent file functions.  The provided 
  6212. --| functions are: Copy, Rename, and Append.  Each of these works on text
  6213. --| files only and with a maximun line length of 255 (constant declared in
  6214. --| the body which can be changed).  Due to Ada's limitations each file
  6215. --| ends up with a form feed inserted as the last character.
  6216.  
  6217. --| Requires
  6218. --| Each procedure is passed two strings which are the file names to be used.
  6219.  
  6220.   procedure Copy(In_File_Name : in string;
  6221.                  Out_File_Name: in string);
  6222.  
  6223. --| Effects
  6224. --| This procedure will take the file specified as In_file_name and make a
  6225. --| second copy of the file in the file specified in Out_file_name.
  6226. --| The copy of the file in Out_file_name will have a form feed inserted
  6227. --| as the last character of the file.
  6228.  
  6229. --| Requires
  6230. --| The parameter In_file_name must specify a valid file name of an existing
  6231. --| file.  The parameter Out_file_name must specify a valid file name for a
  6232. --| file that currently does not exist
  6233.  
  6234. --| Raises
  6235. --| status_error, name_error, use_error
  6236.  
  6237.   procedure Rename(In_File_Name : in string;
  6238.                    Out_File_Name: in string);
  6239.  
  6240. --| Effects
  6241. --| This procedure will take the file specified in In_file_name and rename
  6242. --| it as the file specified as Out_file_name.  The original file will no
  6243. --| longer exist.  The new file will have a form feed inserted as the last
  6244. --| character of the file.
  6245.  
  6246. --| Requires
  6247. --| The parameter In_file_name must specify a valid file name of an existing
  6248. --| file.  The parameter Out_file_name must specify a valid file name for a
  6249. --| file that currently does not exist
  6250.  
  6251. --| Raises
  6252. --| status_error, use_error, name_error
  6253.  
  6254.   procedure Append(Append_File_Name : in string;
  6255.                    To_File_Name     : in string);
  6256.  
  6257. --| Effects
  6258. --| This procedure will Append one file onto the end of another file.  The 
  6259. --| First file specified will be added onto the end of the second file 
  6260. --| specified.  
  6261.  
  6262. --| Requires
  6263. --| Both parameters must be valid file names and must specify files that 
  6264. --| currently exist.
  6265.  
  6266. --| Raises
  6267. --| status_error, name_error, use_error
  6268.  
  6269. end File_Manager;
  6270. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6271. --fileman.bdy
  6272. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6273. with Text_Io; use Text_Io;
  6274. package body File_Manager is
  6275.  
  6276. --| Overview
  6277. --| This package provides some host independent file functions.  These
  6278. --| functions work on text files.  The maximun line lengths of the 
  6279. --| files is specified in the parameter Maximun_Line_Size which can be
  6280. --| changed.
  6281.  
  6282.   Maximum_Line_Size: constant := 255;
  6283.  
  6284.   procedure Copy(In_File_Name : in string;
  6285.                  Out_File_Name: in string) is
  6286.     Input_Buffer: string(1..Maximum_Line_Size);
  6287.     Input_File: File_Type;
  6288.     Output_File: File_Type;
  6289.     Line_Length: natural;
  6290.   begin
  6291.     Open(Input_File,In_File, In_File_Name);
  6292.     Create(Output_File,Out_File, Out_File_Name);
  6293.     
  6294.     while not End_Of_File(Input_File) loop
  6295.       Get_Line(Input_File, Input_Buffer, Line_Length);
  6296.       Put_Line(Output_File, Input_Buffer(1..Line_Length));
  6297.       end loop;
  6298.  
  6299.     Close(Input_File);
  6300.     Close(Output_File);
  6301.   exception
  6302.     when
  6303.       status_error =>
  6304.         put_line("status_error - trying to open a file that is already open");
  6305.     when
  6306.       name_error =>
  6307.         put_line("name_error - trying to open a file that does not exist");
  6308.     when 
  6309.       use_error =>
  6310.         put_line("use_error - incorrect form of file name"); 
  6311.   end Copy;
  6312.  
  6313.   procedure Rename(In_File_Name : in string;
  6314.                    Out_File_Name: in string) is
  6315.     Input_File: File_Type;
  6316.   begin
  6317.     Copy(In_File_Name,Out_File_Name);
  6318.     Open(Input_File,In_File,In_File_Name);
  6319.     Delete(Input_File);
  6320.   exception
  6321.     when
  6322.       status_error =>
  6323.         put_line("status_error - trying to open/close file");
  6324.     when
  6325.       name_error =>
  6326.         put_line("name_error - trying to open a file that does not exist");
  6327.     when
  6328.       use_error =>
  6329.         put_line("use_error - delete access not allowed");
  6330.   end Rename;
  6331.  
  6332.   procedure Append(Append_File_Name : in string;
  6333.                    To_File_Name     : in string) is
  6334.     Append_File: File_Type;
  6335.     To_File: File_Type;
  6336.     Input_Buffer: string(1..Maximum_Line_Size);
  6337.     Line_Length: natural;
  6338.   begin
  6339.     Rename(To_File_Name,"temp0097.rlr");
  6340.     Open(Append_File,In_File, "temp0097.rlr");
  6341.     Create(To_File,Out_File, To_File_Name);
  6342.     
  6343.     while not End_Of_File(Append_File) loop
  6344.       Get_Line(Append_File, Input_Buffer, Line_Length);
  6345.       Put_Line(To_File, Input_Buffer(1..Line_Length));
  6346.       end loop;
  6347.  
  6348.     Delete(Append_File);
  6349.     Open(Append_File,In_File, Append_File_Name);
  6350.  
  6351.     while not End_Of_File(Append_File) loop
  6352.       Get_Line(Append_File, Input_Buffer, Line_Length);
  6353.       Put_Line(To_File, Input_Buffer(1..Line_Length));
  6354.       end loop;
  6355.  
  6356.     Close(Append_File);
  6357.     Close(To_File);
  6358.   exception
  6359.     when
  6360.       status_error =>
  6361.         put_line("status_error - trying to open/close file");
  6362.     when
  6363.       name_error =>
  6364.         put_line("name_error - trying to open a file that does not exist");
  6365.     when
  6366.       use_error =>
  6367.         put_line("use_error - delete access not allowed");
  6368.   end Append;
  6369.  
  6370. end File_Manager;
  6371. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6372. --dynarray.spc
  6373. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6374.  
  6375.  
  6376. generic
  6377.   type ELEM_TYPE is private; 
  6378.   --| Component element type.  
  6379.  
  6380.   with function EQUAL(E1, E2 : in ELEM_TYPE) return BOOLEAN is "="; 
  6381.                                  --| An equality relation on elem_type.
  6382.  
  6383. package DYNARRAY_PKG is 
  6384.  
  6385. --| Overview:
  6386. --| This package provides the dynamic array (darray) abstract data type.
  6387. --| A darray has completely dynamic bounds, which change during runtime as
  6388. --| elements are added to/removed from the top/bottom. darrays are similar
  6389. --| to deques, differing only in that operations for indexing into the
  6390. --| structure are also provided.  A darray is indexed by integers that
  6391. --| fall within the current bounds.  The component type, elem_type, of a
  6392. --| darray is a generic formal parameter of this package, along with a
  6393. --| function, equal, that is assumed to form an equality relation over
  6394. --| over elem_type.
  6395. --|
  6396. --| The notation, <first, elts>, will be used to denote a darray.
  6397. --| first is the current low bound of the darray.  elts is the sequence
  6398. --| of elements contained in the darray.  For a given darray, d, the
  6399. --| dot selection mechanism is used to refer to these components, e.g.,
  6400. --| d.first and d.elts.  & is used for sequence concatenation, and also
  6401. --| for prepending/postpending a single element to a sequence.  |s| is
  6402. --| the number of elements in a sequence, s, and () is the null sequence.
  6403. --| Standard Ada array indexing notation is adopted for sequences.
  6404. --|
  6405. --| The following is a complete list of operations, written in the order
  6406. --| in which they appear in the spec:
  6407. --|
  6408. --| Constructors:
  6409. --|        create
  6410. --|        array_to_darray
  6411. --|        set_first
  6412. --|        add_low, add_high
  6413. --|        remove_low, remove_high
  6414. --|        store
  6415. --|        copy, copy_deep (generic)
  6416. --|        
  6417. --| Query Operations:
  6418. --|        fetch
  6419. --|        low, high
  6420. --|        first, last
  6421. --|        is_empty
  6422. --|        length
  6423. --|        equal
  6424. --|        
  6425. --| Iterators:
  6426. --|        make_elements_iter, more, next
  6427. --|
  6428. --| Heap Management:
  6429. --|        destroy
  6430. --|        
  6431.  
  6432. --| Notes:
  6433. --| Programmer: Ron Kownacki
  6434.  
  6435. -- Primary Types:
  6436.  
  6437.   type DARRAY is private;  --| The darray abstract data type.
  6438.  
  6439.   type ARRAY_TYPE is array(INTEGER range <>) of ELEM_TYPE; 
  6440.   --| darray/array_type conversion operations are provided.
  6441.  
  6442.  
  6443.   -- Storage Management Constants and Types:  (see create procedure)
  6444.  
  6445.   DEFAULT_PREDICT      : constant POSITIVE := 100; 
  6446.  
  6447.   DEFAULT_HIGH         : constant POSITIVE := 50; 
  6448.  
  6449.   DEFAULT_EXPAND       : constant POSITIVE := 100; 
  6450.  
  6451.  
  6452.   -- Exceptions:
  6453.  
  6454.   NO_MORE              : exception;  --| Raised on incorrect use of an iterator.
  6455.  
  6456.   OUT_OF_BOUNDS        : exception;  --| Raised on index out of current bounds.
  6457.  
  6458.   UNINITIALIZED_DARRAY : exception; 
  6459.   --| Raised on use of uninitialized darray by most operations.
  6460.  
  6461.  
  6462.   -- Iterators:
  6463.  
  6464.   type ELEMENTS_ITER is private;  --| Component elements iterator.
  6465.  
  6466.  
  6467.   -- Constructors:
  6468.  
  6469.   procedure CREATE(FIRST          : in INTEGER := 1; 
  6470.                    PREDICT        : in POSITIVE := DEFAULT_PREDICT; 
  6471.                    HIGH_PERCENT   : in POSITIVE := DEFAULT_HIGH; 
  6472.                    EXPAND_PERCENT : in POSITIVE := DEFAULT_EXPAND; 
  6473.                    D              : in out DARRAY); 
  6474.  
  6475.   --| Effects:
  6476.   --| Sets d to <first, ()>.  If d has previously been initialized,
  6477.   --| then a destroy(d) is first performed.  The predict parameter
  6478.   --| specifies the initial space allocated.  (predict  = #elements).
  6479.   --| The high_percent parameter is the caller's expectation of the
  6480.   --| percentage of add_highs, out of total adds, to the darray.  For
  6481.   --| example, a caller would specify 100 if it was known that no
  6482.   --| add_lows would be performed.  The expand_percent parameter
  6483.   --| specifies the amount of additional space, as a percentage of
  6484.   --| currently allocated space, that is to be allocated whenever an
  6485.   --| expansion becomes necessary.  For example, 100 doubles the
  6486.   --| allocated space.
  6487.  
  6488.   procedure ARRAY_TO_DARRAY(A              : in ARRAY_TYPE; 
  6489.                             FIRST          : in INTEGER := 1; 
  6490.                             PREDICT        : in POSITIVE; 
  6491.                             HIGH_PERCENT   : in POSITIVE := DEFAULT_HIGH; 
  6492.                             EXPAND_PERCENT : in POSITIVE := DEFAULT_EXPAND; 
  6493.                             D              : in out DARRAY); 
  6494.  
  6495.   --| Raises: out_of_bounds
  6496.   --| Effects:
  6497.   --| Sets d to <first, a(a'first..a'last)>.  If d has previously
  6498.   --| been initialized, then an implicit destroy(d) is performed.
  6499.   --| The high_percent and expand_percent parameters are defined
  6500.   --| as for create.  Raises out_of_bounds iff predict < a'length.
  6501.  
  6502.   procedure SET_FIRST(D     : in out DARRAY; 
  6503.                       FIRST : in INTEGER); 
  6504.  
  6505.   --| Raises: uninitialized_darray
  6506.   --| Effects:
  6507.   --| Sets d.first to first.
  6508.   --| Raises uninitialized_darray if d has not been initialized.
  6509.  
  6510.   procedure ADD_LOW(D : in out DARRAY; 
  6511.                     E : in ELEM_TYPE); 
  6512.  
  6513.   --| Raises: uninitialized_darray
  6514.   --| Effects:
  6515.   --| Sets d to <d.first - 1, e & d.elts>.
  6516.   --| Raises uninitialized_darray if d has not been initialized.
  6517.  
  6518.   procedure ADD_HIGH(D : in out DARRAY; 
  6519.                      E : in ELEM_TYPE); 
  6520.  
  6521.   --| Raises: uninitialized_darray
  6522.   --| Effects:
  6523.   --| Sets d.elts to d.elts & e.
  6524.   --| Raises uninitialized_darray if d has not been initialized.
  6525.  
  6526.   procedure REMOVE_LOW(D : in out DARRAY); 
  6527.  
  6528.   --| Raises: out_of_bounds, uninitialized_darray
  6529.   --| Effects:
  6530.   --| Sets d to <d.first + 1, d.elts(d.first + 1 .. last(d))>.
  6531.   --| Raises out_of_bounds iff is_empty(d).
  6532.   --| Raises uninitialized_darray if d has not been initialized.
  6533.  
  6534.   procedure REMOVE_HIGH(D : in out DARRAY); 
  6535.  
  6536.   --| Raises: out_of_bounds, uninitialized_darray
  6537.   --| Effects:
  6538.   --| Sets d.elts to d.elts(d.first..last(d) - 1).
  6539.   --| Raises out_of_bounds iff is_empty(d).
  6540.   --| Raises uninitialized_darray if d has not been initialized.
  6541.  
  6542.   procedure STORE(D : in out DARRAY; 
  6543.                   I : in INTEGER; 
  6544.                   E : in ELEM_TYPE); 
  6545.  
  6546.   --| Raises: out_of_bounds, uninitialized_darray
  6547.   --| Effects:
  6548.   --| Replaces d.elts(i) with e.  Raises out_of_bounds iff
  6549.   --| either is_empty(d) or i is not in d.first..last(d).
  6550.   --| Raises uninitialized_darray if d has not been initialized.
  6551.  
  6552.   function COPY(D : in DARRAY) return DARRAY; 
  6553.  
  6554.   --| Raises: uninitialized_darray
  6555.   --| Effects:
  6556.   --| Returns a copy of d.  Subsequent changes to the structure of d
  6557.   --| will not be visible through the application of operations to
  6558.   --| the copy of d, and vice versa.  Assignment or parameter passing
  6559.   --| without using copy (or copy_deep, described below) will result
  6560.   --| in a single darray value being shared among objects.
  6561.   --| Raises uninitialized_darray if d has not been initialized.
  6562.   --| The assignment operation is used to transfer the values of
  6563.   --| the elem_type component objects of d; consequently, changes
  6564.   --| in these values may be observable through both darrays if
  6565.   --| elem_type is an access type, or contains access type
  6566.   --| components.
  6567.  
  6568.   generic
  6569.     with function COPY(E : in ELEM_TYPE) return ELEM_TYPE; 
  6570.  
  6571.   function COPY_DEEP(D : in DARRAY) return DARRAY; 
  6572.  
  6573.   --| Raises: uninitialized_darray
  6574.   --| Effects:
  6575.   --| Returns a copy of d.  Subsequent changes to the structure of d
  6576.   --| will not be visible through the application of operations to
  6577.   --| the copy of d, and vice versa.  Assignment or parameter passing
  6578.   --| without using copy_deep or copy will result in a single
  6579.   --| darray value being shared among objects.
  6580.   --| Raises uninitialized_darray if d has not been initialized.
  6581.   --| The transfer of elem_type component objects is accomplished by
  6582.   --| using the assignment operation in conjunction with the copy
  6583.   --| function.  Consequently, the user can prevent sharing of
  6584.   --| elem_type access components.
  6585.  
  6586.  
  6587.   -- Query Operations:
  6588.  
  6589.   function FETCH(D : in DARRAY; 
  6590.                  I : in INTEGER) return ELEM_TYPE; 
  6591.  
  6592.   --| Raises: out_of_bounds, uninitialized_darray
  6593.   --| Effects:
  6594.   --| Returns d.elts(i).  Raises out_of_bounds iff either is_empty(d)
  6595.   --| or i is not in d.first..last(d).
  6596.   --| Raises uninitialized_darray if d has not been initialized.
  6597.  
  6598.   function LOW(D : in DARRAY) return ELEM_TYPE; 
  6599.  
  6600.   --| Raises: out_of_bounds, uninitialized_darray
  6601.   --| Effects:
  6602.   --| Returns d.elts(d.first).  Raises out_of_bounds iff is_empty(d).
  6603.   --| Raises uninitialized_darray if d has not been initialized.
  6604.  
  6605.   function HIGH(D : in DARRAY) return ELEM_TYPE; 
  6606.  
  6607.   --| Raises: out_of_bounds, uninitialized_darray
  6608.   --| Effects:
  6609.   --| Returns d.elts(last(d)).  Raises out_of_bounds iff is_empty(d).
  6610.   --| Raises uninitialized_darray if d has not been initialized.
  6611.  
  6612.   function FIRST(D : in DARRAY) return INTEGER; 
  6613.  
  6614.   --| Raises: uninitialized_darray
  6615.   --| Effects:
  6616.   --| Returns d.first.
  6617.   --| Raises uninitialized_darray if d has not been initialized.
  6618.  
  6619.   function LAST(D : in DARRAY) return INTEGER; 
  6620.  
  6621.   --| Raises: uninitialized_darray
  6622.   --| Effects:
  6623.   --| Returns d.first + |d.elts| - 1.
  6624.   --| Raises uninitialized_darray if d has not been initialized.
  6625.  
  6626.   function IS_EMPTY(D : in DARRAY) return BOOLEAN; 
  6627.  
  6628.   --| Raises: uninitialized_darray
  6629.   --| Effects:
  6630.   --| Returns length(d) = 0, or equivalently, last(d) < d.first.
  6631.   --| Raises uninitialized_darray if d has not been initialized.
  6632.  
  6633.   function LENGTH(D : in DARRAY) return NATURAL; 
  6634.  
  6635.   --| Raises: uninitialized_darray
  6636.   --| Effects:
  6637.   --| Returns |d.elts|.
  6638.   --| Raises uninitialized_darray if d has not been initialized.
  6639.  
  6640.   function EQUAL(D1, D2 : in DARRAY) return BOOLEAN; 
  6641.  
  6642.   --| Raises: uninitialized_darray
  6643.   --| Effects:
  6644.   --| Return (d1.first = d2.first and
  6645.   --|         last(d1) = last(d2) and
  6646.   --|         for each i in d1.first..last(d1),
  6647.   --|             equal(d1.elts(i), d2.elts(i)).
  6648.   --| Raises uninitialized_darray if either d1 or d2 has not been
  6649.   --| initialized.  Note that (d1 = d2) implies that equal(d1, d2)
  6650.   --| will always hold.  "=" is object equality, equal is state
  6651.   --| equality.
  6652.  
  6653.   function DARRAY_TO_ARRAY(D : in DARRAY) return ARRAY_TYPE; 
  6654.  
  6655.   --| Raises: uninitialized_darray
  6656.   --| Effects:
  6657.   --| Let bounds_range be d.first..d.first + length(d) - 1.  If
  6658.   --| bounds_range is empty, then return an empty array with bounds
  6659.   --| of 1..0.  Otherwise, return bounds_range'(d.elts).
  6660.   --| Raises uninitialized_darray if d has not been initialized.
  6661.  
  6662.  
  6663.   -- Iterators:
  6664.  
  6665.   function MAKE_ELEMENTS_ITER(D : in DARRAY) return ELEMENTS_ITER; 
  6666.  
  6667.   --| Raises: uninitialized_darray
  6668.   --| Effects:
  6669.   --| Create and return an elements itererator based on d.  This
  6670.   --| object can then be used in conjunction with the more function
  6671.   --| and the next procedure to iterate over the components of d.
  6672.   --| Raises uninitialized_darray if d has not been initialized.
  6673.  
  6674.   function MORE(ITER : in ELEMENTS_ITER) return BOOLEAN; 
  6675.  
  6676.   --| Effects:
  6677.   --| Return true iff the elements iterator has not been exhausted.
  6678.  
  6679.   procedure NEXT(ITER : in out ELEMENTS_ITER; 
  6680.                  E    : out ELEM_TYPE); 
  6681.  
  6682.   --| Raises: no_more
  6683.   --| Effects:
  6684.   --| Let iter be based on the darray, d.  Successive calls of next
  6685.   --| will return, in e, successive elements of d.elts.  Each call
  6686.   --| updates the state of the elements iterator.  After all elements
  6687.   --| have been returned, an invocation of next will raise no_more.
  6688.   --| Requires:
  6689.   --| d must not be changed between the invocations of
  6690.   --| make_elements_iterator(d) and next.
  6691.  
  6692.  
  6693.   -- Heap Management:
  6694.  
  6695.   procedure DESTROY(D : in out DARRAY); 
  6696.   --| Effects:
  6697.   --| Return space consumed by the darray value associated with object
  6698.   --| d to the heap.  (If d is uninitialized, this operation does
  6699.   --| nothing.)  If other objects share the same darray value, then
  6700.   --| further use of these objects is erroneous.  Components of type
  6701.   --| elem_type, if they are access types, are not garbage collected.
  6702.   --| It is the user's responsibility to dispose of these objects.
  6703.   --| d is left in the uninitialized state.
  6704.  
  6705.  
  6706. private
  6707.  
  6708.   type ARRAY_PTR is access ARRAY_TYPE; 
  6709.  
  6710.   type DARRAY_INFO is 
  6711.     record
  6712.       FIRST_IDX      : POSITIVE; 
  6713.       LAST_IDX       : NATURAL; 
  6714.       FIRST          : INTEGER; 
  6715.       HIGH_PERCENT   : POSITIVE; 
  6716.       EXPAND_PERCENT : POSITIVE; 
  6717.       ARR            : ARRAY_PTR := null; 
  6718.     end record; 
  6719.  
  6720.   type DARRAY is access DARRAY_INFO; 
  6721.  
  6722.   --| Let r be an instance of the representation type.
  6723.   --| Representation Invariants:
  6724.   --| 1. r /= null, r.arr /= null (must be initialized to be valid.)
  6725.   --| 2. r.arr'first = 1 and
  6726.   --|    r.arr'last >= 1
  6727.   --| 3. r.first_idx <= r.last_idx or
  6728.   --|    r.first_idx = r.last_idx + 1
  6729.   --| 4. r.first_idx <= r.last_idx =>
  6730.   --|        r.first_idx, r.last_idx in r.arr'range
  6731.   --| 5. r.expand_percent, r.high_percent get values at creation time,
  6732.   --|    and these never change.
  6733.   --|
  6734.   --| Abstraction Function:  (denoted by A(r))
  6735.   --| if r.last_idx < r.first_idx then
  6736.   --|     <r.first, ()>
  6737.   --| else
  6738.   --|     <r.first, (r.arr(r.first_idx),...,r.arr(r.last_idx))>
  6739.   --|
  6740.   --| These properties follow:
  6741.   --| 1. length(A(r)) = r.last_idx - r.first_idx + 1
  6742.   --| 2. last(A(r)) = r.first + r.last_idx - r.first_idx
  6743.   --| 3. fetch(A(r), i) =
  6744.   --|        if (i - r.first + r.first_idx) in r.first_idx..r.last_idx
  6745.   --|            then r.arr(i - r.first + r.first_idx)
  6746.   --|            else undefined.  (out_of_bounds)
  6747.  
  6748.   type ELEMENTS_ITER is 
  6749.     record
  6750.       LAST    : INTEGER := 0; 
  6751.       CURRENT : INTEGER := 1; 
  6752.       ARR     : ARRAY_PTR; 
  6753.     end record; 
  6754.  
  6755.     --| Let d be the darray that an elements_iter, i, is based on.
  6756.     --| Initially, i.current = d.first_idx, i.last = d.last_idx, and
  6757.     --| i.arr = d.arr.
  6758.     --| more(i) = i.current <= i.last.
  6759.     --| next(i) = i.arr(current).  i.current incremented by next.
  6760.     --| Note that if an elements_iter object is not initialized, then
  6761.     --| more is false.
  6762.  
  6763. end DYNARRAY_PKG; 
  6764. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6765. --dynarray.bdy
  6766. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6767.  
  6768. with UNCHECKED_DEALLOCATION; 
  6769.  
  6770. package body DYNARRAY_PKG is 
  6771.  
  6772. -- Utilities:
  6773.  
  6774.   procedure FREE_ARRAY_PTR is 
  6775.     new UNCHECKED_DEALLOCATION(ARRAY_TYPE, ARRAY_PTR); 
  6776.  
  6777.   procedure FREE_DARRAY is 
  6778.     new UNCHECKED_DEALLOCATION(DARRAY_INFO, DARRAY); 
  6779.  
  6780.   function DOWN_INDEX(I : in INTEGER; 
  6781.                       D : in DARRAY) return INTEGER; 
  6782.  
  6783.   --| Raises: out_of_bounds
  6784.   --| Effects:
  6785.   --| Map from abstraction indices to representation indices.
  6786.   --| Raises out_of_bounds iff either is_empty(d) or i is not in
  6787.   --| d.first..last(d).
  6788.   --| Requires: d must be initialized.
  6789.  
  6790.   procedure INITIALIZATION_CHECK(D : in DARRAY); 
  6791.  
  6792.   --| Raises: uninitialized_darray
  6793.   --| Effects:
  6794.   --| Returns normally iff d has been the target of a create, copy,
  6795.   --| or array_to_darray operation, and has not since been destroyed.
  6796.   --| Otherwise, raises uninitialized_darray.
  6797.   --| This procedure will not detect the case where another object
  6798.   --| sharing the same darray value has been destroyed; this is
  6799.   --| erroneous use.
  6800.  
  6801.   procedure EXPAND(D : in out DARRAY); 
  6802.  
  6803.   --| Effects:
  6804.   --| Allocates additional space in d.arr.  The old contents of d.arr
  6805.   --| are copied to a slice of the new array.  The expansion amount is
  6806.   --| a percentage (d.expand_percent) of currently allocated space.
  6807.   --| Sets d.first_idx and d.last_idx to appropriate positions in the
  6808.   --| new array; these positions are selected according to the
  6809.   --| expected distribution of add_highs/add_lows (d.high_percent).
  6810.   --| Requires: d must be initialized.
  6811.  
  6812.   procedure CONTRACT(D : in out DARRAY); 
  6813.  
  6814.   --| Effects:
  6815.   --| Checks whether d.arr consumes too much space in proportion to
  6816.   --| the slice that is being used to hold the darray elements.  If
  6817.   --| so, halves the size of d.arr.  The old contents of d.arr are
  6818.   --| copied to a slice of the new array.  Sets d.first_idx and
  6819.   --| and d.last_idx to appropriate positions in the new array; these
  6820.   --| positions are selected according to the expected distribution of
  6821.   --| add_highs/add_lows (d.high_percent).
  6822.   --| Requires: d must be initialized and nonempty.
  6823.  
  6824.   procedure REALLOCATE(D          : in out DARRAY; 
  6825.                        NEW_LENGTH : in POSITIVE); 
  6826.  
  6827.   --| Raises: out_of_bounds
  6828.   --| Effects:
  6829.   --| Replaces d.arr with a pointer to an array of length new_length,
  6830.   --| fills a slice of this array with the old contents of d.arr, and
  6831.   --| adjusts d.first_idx and d.last_idx appropriately.  Everything is
  6832.   --| done according to d.high_percent.  Used by both expand/contract.
  6833.   --| Raises out_of_bounds iff new_length < length(d).
  6834.   --| Requires: d must be initialized.
  6835.  
  6836.   procedure DETERMINE_POSITION(ARRAY_LENGTH : in POSITIVE; 
  6837.                                SLICE_LENGTH : in NATURAL; 
  6838.                                HIGH_PERCENT : in POSITIVE; 
  6839.                                FIRST_IDX    : out POSITIVE; 
  6840.                                LAST_IDX     : out NATURAL); 
  6841.  
  6842.   --| Raises: out_of_bounds
  6843.   --| Effects:
  6844.   --| Determines the appropriate position of a slice of length
  6845.   --| slice_length in an array with range 1..array_length.  This
  6846.   --| position is calculated according to the high_percent parameter.
  6847.   --| Raises out_of_bounds iff slice_length > array_length.
  6848.   --| Used by create, array_to_darray, reallocate.
  6849.  
  6850.  
  6851.   -- Constructors:
  6852.  
  6853.   procedure CREATE(FIRST          : in INTEGER := 1; 
  6854.                    PREDICT        : in POSITIVE := DEFAULT_PREDICT; 
  6855.                    HIGH_PERCENT   : in POSITIVE := DEFAULT_HIGH; 
  6856.                    EXPAND_PERCENT : in POSITIVE := DEFAULT_EXPAND; 
  6857.                    D              : in out DARRAY) is 
  6858.   begin
  6859.     DESTROY(D); 
  6860.     D := new DARRAY_INFO; 
  6861.     DETERMINE_POSITION(PREDICT, 0, HIGH_PERCENT, D.FIRST_IDX, D.LAST_IDX); 
  6862.     D.FIRST := FIRST; 
  6863.     D.HIGH_PERCENT := HIGH_PERCENT; 
  6864.     D.EXPAND_PERCENT := EXPAND_PERCENT; 
  6865.     D.ARR := new ARRAY_TYPE(1 .. PREDICT); 
  6866.   exception
  6867.     when OUT_OF_BOUNDS => 
  6868.  
  6869.       -- determine_position fails
  6870.       DESTROY(D); 
  6871.       raise; 
  6872.   end CREATE; 
  6873.  
  6874.   procedure ARRAY_TO_DARRAY(A              : in ARRAY_TYPE; 
  6875.                             FIRST          : in INTEGER := 1; 
  6876.                             PREDICT        : in POSITIVE; 
  6877.                             HIGH_PERCENT   : in POSITIVE := DEFAULT_HIGH; 
  6878.                             EXPAND_PERCENT : in POSITIVE := DEFAULT_EXPAND; 
  6879.                             D              : in out DARRAY) is 
  6880.   begin
  6881.     if D /= null then 
  6882.       FREE_ARRAY_PTR(D.ARR); 
  6883.     end if; 
  6884.     D := new DARRAY_INFO; 
  6885.     DETERMINE_POSITION(PREDICT, A'LENGTH, HIGH_PERCENT, D.FIRST_IDX, D.LAST_IDX)
  6886.       ; 
  6887.     D.FIRST := FIRST; 
  6888.     D.HIGH_PERCENT := HIGH_PERCENT; 
  6889.     D.EXPAND_PERCENT := EXPAND_PERCENT; 
  6890.     D.ARR := new ARRAY_TYPE(1 .. PREDICT); 
  6891.     D.ARR.all := A; 
  6892.   exception
  6893.     when OUT_OF_BOUNDS => 
  6894.  
  6895.       -- determine_position fails
  6896.       DESTROY(D); 
  6897.       raise; 
  6898.   end ARRAY_TO_DARRAY; 
  6899.  
  6900.   procedure SET_FIRST(D     : in out DARRAY; 
  6901.                       FIRST : in INTEGER) is 
  6902.   begin
  6903.     INITIALIZATION_CHECK(D); 
  6904.     D.FIRST := FIRST; 
  6905.   end SET_FIRST; 
  6906.  
  6907.   procedure ADD_LOW(D : in out DARRAY; 
  6908.                     E : in ELEM_TYPE) is 
  6909.   begin
  6910.     INITIALIZATION_CHECK(D); 
  6911.     D.ARR(D.FIRST_IDX - 1) := E; 
  6912.     D.FIRST_IDX := D.FIRST_IDX - 1; 
  6913.     D.FIRST := D.FIRST - 1; 
  6914.   exception
  6915.     when CONSTRAINT_ERROR => 
  6916.  
  6917.       -- on array store
  6918.       EXPAND(D); 
  6919.       D.ARR(D.FIRST_IDX - 1) := E; 
  6920.       D.FIRST_IDX := D.FIRST_IDX - 1; 
  6921.       D.FIRST := D.FIRST - 1; 
  6922.   end ADD_LOW; 
  6923.  
  6924.   procedure ADD_HIGH(D : in out DARRAY; 
  6925.                      E : in ELEM_TYPE) is 
  6926.   begin
  6927.     INITIALIZATION_CHECK(D); 
  6928.     D.ARR(D.LAST_IDX + 1) := E; 
  6929.     D.LAST_IDX := D.LAST_IDX + 1; 
  6930.   exception
  6931.     when CONSTRAINT_ERROR => 
  6932.  
  6933.       -- on array store
  6934.       EXPAND(D); 
  6935.       D.ARR(D.LAST_IDX + 1) := E; 
  6936.       D.LAST_IDX := D.LAST_IDX + 1; 
  6937.   end ADD_HIGH; 
  6938.  
  6939.   procedure REMOVE_LOW(D : in out DARRAY) is 
  6940.   begin
  6941.     INITIALIZATION_CHECK(D); 
  6942.     if D.LAST_IDX < D.FIRST_IDX then 
  6943.       raise OUT_OF_BOUNDS; 
  6944.     end if; 
  6945.  
  6946.     D.FIRST_IDX := D.FIRST_IDX + 1; 
  6947.     D.FIRST := D.FIRST + 1; 
  6948.     CONTRACT(D); 
  6949.   end REMOVE_LOW; 
  6950.  
  6951.   procedure REMOVE_HIGH(D : in out DARRAY) is 
  6952.   begin
  6953.     INITIALIZATION_CHECK(D); 
  6954.     if D.LAST_IDX < D.FIRST_IDX then 
  6955.       raise OUT_OF_BOUNDS; 
  6956.     end if; 
  6957.  
  6958.     D.LAST_IDX := D.LAST_IDX - 1; 
  6959.     CONTRACT(D); 
  6960.   end REMOVE_HIGH; 
  6961.  
  6962.   procedure STORE(D : in out DARRAY; 
  6963.                   I : in INTEGER; 
  6964.                   E : in ELEM_TYPE) is 
  6965.   begin
  6966.     INITIALIZATION_CHECK(D); 
  6967.     D.ARR(DOWN_INDEX(I, D)) := E; 
  6968.   end STORE; 
  6969.  
  6970.   function COPY(D : in DARRAY) return DARRAY is 
  6971.     D2 : DARRAY; 
  6972.   begin
  6973.     INITIALIZATION_CHECK(D); 
  6974.     D2 := new DARRAY_INFO'(FIRST_IDX => D.FIRST_IDX, LAST_IDX => D.LAST_IDX, 
  6975.       FIRST => D.FIRST, HIGH_PERCENT => D.HIGH_PERCENT, EXPAND_PERCENT => D.
  6976.       EXPAND_PERCENT, ARR => new ARRAY_TYPE(1 .. D.ARR'LENGTH)); 
  6977.     D2.ARR.all := D.ARR.all; 
  6978.     return D2; 
  6979.   end COPY; 
  6980.  
  6981.   function COPY_DEEP(D : in DARRAY) return DARRAY is 
  6982.     D2 : DARRAY; 
  6983.     I  : INTEGER; 
  6984.   begin
  6985.     INITIALIZATION_CHECK(D); 
  6986.     D2 := new DARRAY_INFO'(FIRST_IDX => D.FIRST_IDX, LAST_IDX => D.LAST_IDX, 
  6987.       FIRST => D.FIRST, HIGH_PERCENT => D.HIGH_PERCENT, EXPAND_PERCENT => D.
  6988.       EXPAND_PERCENT, ARR => new ARRAY_TYPE(1 .. D.ARR'LENGTH)); 
  6989.     for I in D.FIRST_IDX .. D.LAST_IDX loop
  6990.       D2.ARR(I) := COPY(D.ARR(I)); 
  6991.     end loop; 
  6992.     return D2; 
  6993.   end COPY_DEEP; 
  6994.  
  6995.  
  6996.   -- Query Operations:
  6997.  
  6998.   function FETCH(D : in DARRAY; 
  6999.                  I : in INTEGER) return ELEM_TYPE is 
  7000.   begin
  7001.     INITIALIZATION_CHECK(D); 
  7002.     return D.ARR(DOWN_INDEX(I, D)); 
  7003.   end FETCH; 
  7004.  
  7005.   function LOW(D : in DARRAY) return ELEM_TYPE is 
  7006.   begin
  7007.     INITIALIZATION_CHECK(D); 
  7008.     return D.ARR(DOWN_INDEX(D.FIRST, D)); 
  7009.   end LOW; 
  7010.  
  7011.   function HIGH(D : in DARRAY) return ELEM_TYPE is 
  7012.   begin
  7013.     if IS_EMPTY(D) then 
  7014.  
  7015.       -- is_empty checks for initialization
  7016.       raise OUT_OF_BOUNDS; 
  7017.     end if; 
  7018.     return D.ARR(D.LAST_IDX); 
  7019.   end HIGH; 
  7020.  
  7021.   function FIRST(D : in DARRAY) return INTEGER is 
  7022.   begin
  7023.     INITIALIZATION_CHECK(D); 
  7024.     return D.FIRST; 
  7025.   end FIRST; 
  7026.  
  7027.   function LAST(D : in DARRAY) return INTEGER is 
  7028.   begin
  7029.     INITIALIZATION_CHECK(D); 
  7030.     return D.FIRST + D.LAST_IDX - D.FIRST_IDX; 
  7031.   end LAST; 
  7032.  
  7033.   function IS_EMPTY(D : in DARRAY) return BOOLEAN is 
  7034.   begin
  7035.     INITIALIZATION_CHECK(D); 
  7036.     return D.LAST_IDX < D.FIRST_IDX; 
  7037.   end IS_EMPTY; 
  7038.  
  7039.   function LENGTH(D : in DARRAY) return NATURAL is 
  7040.   begin
  7041.     INITIALIZATION_CHECK(D); 
  7042.     return D.LAST_IDX - D.FIRST_IDX + 1; 
  7043.   end LENGTH; 
  7044.  
  7045.   function EQUAL(D1, D2 : in DARRAY) return BOOLEAN is 
  7046.     I2 : INTEGER; 
  7047.   begin
  7048.     INITIALIZATION_CHECK(D1); 
  7049.     INITIALIZATION_CHECK(D2); 
  7050.  
  7051.     if D1.FIRST /= D2.FIRST or else LENGTH(D1) /= LENGTH(D2) then 
  7052.       return FALSE; 
  7053.     end if; 
  7054.  
  7055.     I2 := D2.FIRST_IDX; 
  7056.     for I1 in D1.FIRST_IDX .. D1.LAST_IDX loop
  7057.       if not EQUAL(D1.ARR(I1), D2.ARR(I2)) then 
  7058.         return FALSE; 
  7059.       end if; 
  7060.       I2 := I2 + 1; 
  7061.     end loop; 
  7062.  
  7063.     return TRUE; 
  7064.   end EQUAL; 
  7065.  
  7066.   function DARRAY_TO_ARRAY(D : in DARRAY) return ARRAY_TYPE is 
  7067.     subtype DBOUNDS_ARRAY is ARRAY_TYPE(D.FIRST .. LAST(D)); 
  7068.     -- invocation of last performs initialization check.
  7069.   begin
  7070.     return DBOUNDS_ARRAY'(D.ARR(D.FIRST_IDX .. D.LAST_IDX)); 
  7071.   end DARRAY_TO_ARRAY; 
  7072.  
  7073.  
  7074.   -- Iterators:
  7075.  
  7076.   function MAKE_ELEMENTS_ITER(D : in DARRAY) return ELEMENTS_ITER is 
  7077.   begin
  7078.     INITIALIZATION_CHECK(D); 
  7079.     return (CURRENT => D.FIRST_IDX, LAST => D.LAST_IDX, ARR => D.ARR); 
  7080.   end MAKE_ELEMENTS_ITER; 
  7081.  
  7082.   function MORE(ITER : in ELEMENTS_ITER) return BOOLEAN is 
  7083.   begin
  7084.     return ITER.CURRENT <= ITER.LAST; 
  7085.   end MORE; 
  7086.  
  7087.   procedure NEXT(ITER : in out ELEMENTS_ITER; 
  7088.                  E    : out ELEM_TYPE) is 
  7089.   begin
  7090.     if not MORE(ITER) then 
  7091.       raise NO_MORE; 
  7092.     end if; 
  7093.  
  7094.     E := ITER.ARR(ITER.CURRENT); 
  7095.     ITER.CURRENT := ITER.CURRENT + 1; 
  7096.   end NEXT; 
  7097.  
  7098.  
  7099.   -- Heap Management:
  7100.  
  7101.   procedure DESTROY(D : in out DARRAY) is 
  7102.   begin
  7103.     FREE_ARRAY_PTR(D.ARR); 
  7104.     FREE_DARRAY(D); 
  7105.   exception
  7106.     when CONSTRAINT_ERROR => 
  7107.  
  7108.       -- d is null, d.arr is illegal.
  7109.       return; 
  7110.   end DESTROY; 
  7111.  
  7112.  
  7113.   -- Utilities:
  7114.  
  7115.   function DOWN_INDEX(I : in INTEGER; 
  7116.                       D : in DARRAY) return INTEGER is 
  7117.     DOWN_IDX : INTEGER := I - D.FIRST + D.FIRST_IDX; 
  7118.   begin
  7119.     if D.LAST_IDX < D.FIRST_IDX or else 
  7120.  
  7121.     -- empty array
  7122.     not (DOWN_IDX in D.FIRST_IDX .. D.LAST_IDX) then 
  7123.  
  7124.       -- bogus index
  7125.       raise OUT_OF_BOUNDS; 
  7126.     end if; 
  7127.  
  7128.     return DOWN_IDX; 
  7129.   end DOWN_INDEX; 
  7130.  
  7131.   procedure INITIALIZATION_CHECK(D : in DARRAY) is 
  7132.   begin
  7133.     if D = null then 
  7134.       raise UNINITIALIZED_DARRAY; 
  7135.     end if; 
  7136.   end INITIALIZATION_CHECK; 
  7137.  
  7138.   procedure EXPAND(D : in out DARRAY) is 
  7139.     NEW_LENGTH : INTEGER := (D.ARR'LENGTH*(100 + D.EXPAND_PERCENT))/100; 
  7140.   begin
  7141.  
  7142.     -- Specified percent, in relation to length, may be too small to
  7143.     -- force any growth.  In this case, force growth.  This is rare.
  7144.     -- The choice to double is arbitrary.
  7145.     if NEW_LENGTH = D.ARR'LENGTH then 
  7146.       NEW_LENGTH := 2*D.ARR'LENGTH; 
  7147.     end if; 
  7148.  
  7149.     REALLOCATE(D, NEW_LENGTH); 
  7150.   end EXPAND; 
  7151.  
  7152.   procedure CONTRACT(D : in out DARRAY) is 
  7153.   -- <<A better contraction strategy is needed.  Justification is weak
  7154.   -- for this one.>>
  7155.   begin
  7156.     null; 
  7157.   end CONTRACT; 
  7158.  
  7159.   procedure REALLOCATE(D          : in out DARRAY; 
  7160.                        NEW_LENGTH : in POSITIVE) is 
  7161.  
  7162.     NEW_ARR       : ARRAY_PTR; 
  7163.     NEW_FIRST_IDX : INTEGER; 
  7164.     NEW_LAST_IDX  : INTEGER; 
  7165.  
  7166.   begin
  7167.     DETERMINE_POSITION(NEW_LENGTH, LENGTH(D), D.HIGH_PERCENT, NEW_FIRST_IDX, 
  7168.       NEW_LAST_IDX); 
  7169.     NEW_ARR := new ARRAY_TYPE(1 .. NEW_LENGTH); 
  7170.     NEW_ARR(NEW_FIRST_IDX .. NEW_LAST_IDX) := D.ARR(D.FIRST_IDX .. D.LAST_IDX); 
  7171.     FREE_ARRAY_PTR(D.ARR); 
  7172.     D.ARR := NEW_ARR; 
  7173.     D.FIRST_IDX := NEW_FIRST_IDX; 
  7174.     D.LAST_IDX := NEW_LAST_IDX; 
  7175.   end REALLOCATE; 
  7176.  
  7177.   procedure DETERMINE_POSITION(ARRAY_LENGTH : in POSITIVE; 
  7178.                                SLICE_LENGTH : in NATURAL; 
  7179.                                HIGH_PERCENT : in POSITIVE; 
  7180.                                FIRST_IDX    : out POSITIVE; 
  7181.                                LAST_IDX     : out NATURAL) is 
  7182.  
  7183.     LEFT_OVER  : INTEGER := ARRAY_LENGTH - SLICE_LENGTH; 
  7184.     HIGH_SPACE : INTEGER := (HIGH_PERCENT*LEFT_OVER)/100; 
  7185.     LOW_SPACE  : INTEGER := LEFT_OVER - HIGH_SPACE; 
  7186.  
  7187.   begin
  7188.     if LEFT_OVER < 0 then 
  7189.       raise OUT_OF_BOUNDS; 
  7190.     end if; 
  7191.  
  7192.     FIRST_IDX := LOW_SPACE + 1; 
  7193.     LAST_IDX := LOW_SPACE + SLICE_LENGTH; 
  7194.   end DETERMINE_POSITION; 
  7195.  
  7196. end DYNARRAY_PKG; 
  7197. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7198. --dynarray.ada
  7199. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7200. with DYNARRAY_PKG; 
  7201. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; 
  7202. package DYNAMIC_ARRAY_PKG is 
  7203.   new DYNARRAY_PKG(COUNT_RANGE); 
  7204.  
  7205.   --|overview
  7206.   --|This is the instantiation of the dynamic array package for the
  7207.   --|path analyzer report writer. It must be used by both the Breakpoint
  7208.   --|package and the report writer itself. It is instantiated with the 
  7209.   --|count_range data type to facilitate the tracking of breakpoint 
  7210.   --|execution count data which is of this type.
  7211.  
  7212.   --|n/a effects,requires,modifies,errors,tuning,notes
  7213. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7214. --hostdep.spc
  7215. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7216.  
  7217. package HOST_DEPENDENCIES is 
  7218. --| Simple data types and constants involving the Host Machine.
  7219.  
  7220. -- Types and Objects --
  7221.  
  7222.   MAXCOLUMN : constant := 250; 
  7223.   subtype SOURCE_COLUMN is NATURAL range 0 .. MAXCOLUMN; 
  7224.   MAXLINE : constant := 100000;  -- This is completely arbitrary
  7225.   subtype SOURCE_LINE is NATURAL range 0 .. MAXLINE; 
  7226.  
  7227.   -- Operations --
  7228.  
  7229.   function FINDTABCOLUMN( --| returns source column a tab is in
  7230.                          INCOLUMN : in SOURCE_COLUMN
  7231.                                    --| source column before tab
  7232.                          ) return SOURCE_COLUMN; 
  7233.  
  7234.   --| Effects
  7235.  
  7236.   --| This subprogram implements the tab positioning strategy
  7237.   --| of the Host system.
  7238.  
  7239. end HOST_DEPENDENCIES; 
  7240. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7241. --hostdep.bdy
  7242. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7243.  
  7244. package body HOST_DEPENDENCIES is 
  7245. --| Simple data types and constants involving the host machine
  7246.  
  7247. -- Operations --
  7248.  
  7249.   function FINDTABCOLUMN( -- see subprogram specification
  7250.                          INCOLUMN : in SOURCE_COLUMN) return SOURCE_COLUMN is 
  7251.  
  7252.   --| Effects
  7253.   --| Tabs are positioned every eight columns starting at column 1.
  7254.  
  7255.     TAB_WIDTH : constant := 8;  --| number of columns a tab takes up.
  7256.  
  7257.   begin
  7258.     return (INCOLUMN + (TAB_WIDTH - (INCOLUMN mod TAB_WIDTH))); 
  7259.   end FINDTABCOLUMN; 
  7260.  
  7261. end HOST_DEPENDENCIES; 
  7262. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7263. --errmsg.spc
  7264. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7265.  
  7266.  
  7267. ----------------------------------------------------------------------
  7268.  
  7269. with HOST_DEPENDENCIES;  -- host dependent constants
  7270.  
  7271. package LEXICAL_ERROR_MESSAGE is  --| handles lexical error messages
  7272.  
  7273. --| Overview
  7274. --|
  7275. --| Contains text, identifiers of text, and output subprograms
  7276. --| for package Lex.
  7277. --|
  7278.  
  7279.   package HD renames HOST_DEPENDENCIES; 
  7280.  
  7281.   --------------------------------------------------------------
  7282.   -- Declarations Global to Package Lexical_Error_Message
  7283.   ------------------------------------------------------------------
  7284.  
  7285.   type MESSAGE_TYPE is (BASE_OUT_OF_LEGAL_RANGE_USE_16, 
  7286.     BASED_LITERAL_DELIMITER_MISMATCH, CHARACTER_CAN_NOT_START_TOKEN, 
  7287.     CHARACTER_IS_NON_ASCII, CHARACTER_IS_NON_GRAPHIC, CONSECUTIVE_UNDERLINES, 
  7288.     DIGIT_INVALID_FOR_BASE, DIGIT_NEEDED_AFTER_RADIX_POINT, 
  7289.     DIGIT_NEEDED_BEFORE_RADIX_POINT, EXPONENT_MISSING_INTEGER_FIELD, 
  7290.     ILLEGAL_USE_OF_SINGLE_QUOTE, INTEGER_LITERAL_CONVERSION_EXCEPTION_USE_1, 
  7291.     LEADING_UNDERLINE, MISSING_SECOND_BASED_LITERAL_DELIMITER, 
  7292.     NEGATIVE_EXPONENT_ILLEGAL_IN_INTEGER, NO_ENDING_STRING_DELIMITER, 
  7293.     NO_INTEGER_IN_BASED_NUMBER, ONLY_GRAPHIC_CHARACTERS_IN_STRINGS, 
  7294.     REAL_LITERAL_CONVERSION_EXCEPTION_USE_1, SOURCE_LINE_MAXIMUM_EXCEEDED, 
  7295.     SOURCE_LINE_TOO_LONG, SPACE_MUST_SEPARATE_NUM_AND_IDS, TERMINAL_UNDERLINE, 
  7296.     TOO_MANY_RADIX_POINTS); 
  7297.  
  7298.   --------------------------------------------------------------
  7299.   -- Subprogram Bodies Global to Package Lexical_Error_Message
  7300.   --------------------------------------------------------------
  7301.  
  7302.   procedure OUTPUT_MESSAGE( --| output lexical error message
  7303.                            IN_LINE       : in HD.SOURCE_LINE; 
  7304.                                           --| line number of error.
  7305.                            IN_COLUMN     : in HD.SOURCE_COLUMN; 
  7306.                                           --| column number of error.
  7307.                            IN_MESSAGE_ID : in MESSAGE_TYPE); 
  7308.                                           --| which message to output.
  7309.  
  7310.   --| Effects
  7311.   --|
  7312.   --| Output error message for lexer.
  7313.   --|
  7314.  
  7315.   ------------------------------------------------------------------
  7316.  
  7317.   procedure OUTPUT_MESSAGE( --| output lexical error message
  7318.                            IN_LINE           : in HD.SOURCE_LINE; 
  7319.                                           --| line number of error.
  7320.                            IN_COLUMN         : in HD.SOURCE_COLUMN; 
  7321.                                           --| column number of error.
  7322.                            IN_INSERTION_TEXT : in STRING;  --| text to insert.
  7323.                            IN_MESSAGE_ID     : in MESSAGE_TYPE); 
  7324.                                           --| which message to output.
  7325.  
  7326.   --| Effects
  7327.   --|
  7328.   --| Output error message with inserted text.  The text is appended
  7329.   --| to the message if there are no insertion flags.
  7330.  
  7331.   ------------------------------------------------------------------
  7332.  
  7333. end LEXICAL_ERROR_MESSAGE; 
  7334.  
  7335. ----------------------------------------------------------------------
  7336. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7337. --errmsg.bdy
  7338. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7339.  
  7340.  
  7341.  
  7342. ------------------------------------------------------------------
  7343.  
  7344. with TEXT_IO; 
  7345.  
  7346. package body LEXICAL_ERROR_MESSAGE is 
  7347.  
  7348. ------------------------------------------------------------------
  7349. -- Declarations Local to Package Lexical_Error_Message
  7350. ------------------------------------------------------------------
  7351.  
  7352.   INSERTION_FLAG : CHARACTER := '@'; 
  7353.  
  7354.   subtype MESSAGE_TEXT_RANGE is POSITIVE range 1 .. 64; 
  7355.  
  7356.   MESSAGE_TEXT : constant array(MESSAGE_TYPE) of STRING(MESSAGE_TEXT_RANGE) := (
  7357.   -- 1234567890123456789012345678901234567890123456789012345678901234
  7358.   -- Base_Out_Of_Legal_Range_Use_16   =>
  7359.   "This base " & INSERTION_FLAG -- insert a String
  7360.   & " is not in the range 2 to 16. Assuming base 16.      ", 
  7361.   -- Based_Literal_Delimiter_Mismatch =>
  7362.   "Based_literal delimiters must be the same.                      ", 
  7363.   -- Character_Can_Not_Start_Token    =>
  7364.   "This character " & INSERTION_FLAG -- insert a character
  7365.   & " can not start a token.                         ", 
  7366.   -- Character_Is_Non_ASCII  =>
  7367.   "This value x@VALUE@x is not an ASCII character.                 ", 
  7368.   --|? should display the value, but this message is unlikely.
  7369.   --|? see Lex.bdy
  7370.   -- Character_Is_Non_Graphic=>
  7371.   "This character with decimal value" & INSERTION_FLAG
  7372.   -- insert the decimal value
  7373.   & " is not a graphic_character.  ", 
  7374.   -- Consecutive_Underlines  =>
  7375.   "Consecutive underlines are not allowed.                         ", 
  7376.   -- Digit_Invalid_For_Base  =>
  7377.   "This digit " & INSERTION_FLAG -- insert a Character
  7378.   & " is out of range for the base specified.            ", 
  7379.   -- Digit_Needed_After_Radix_Point   =>
  7380.   "At least one digit must appear after a radix point              ", 
  7381.   -- Digit_Needed_Before_Radix_Point  =>
  7382.   "At least one digit must appear before a radix point             ", 
  7383.   -- Exponent_Missing_Integer_Field   =>
  7384.   "The exponent is missing its integer field.                      ", 
  7385.   -- Illegal_Use_Of_Single_Quote  =>
  7386.   "Single quote is not used for an attribute or character literal. ", 
  7387.   -- Integer_Literal_Conversion_Exception_Using_1 =>
  7388.   "Error while evaluating a integer_literal. Using a value of '1'. ", 
  7389.   -- Leading_Underline    =>
  7390.   "Initial underlines are not allowed.                             ", 
  7391.   -- Missing_Second_Based_Literal_Delimiter   =>
  7392.   "Second based_literal delimiter is missing.                      ", 
  7393.   -- Negative_Exponent_Illegal_In_Integer =>
  7394.   "A negative exponent is illegal in an integer literal.           ", 
  7395.   -- No_Ending_String_Delimiter   =>
  7396.   "String is improperly terminated by the end of the line.         ", 
  7397.   -- No_Integer_In_Based_Number   =>
  7398.   "A based number must have a value.                               ", 
  7399.   -- Only_Graphic_Characters_In_Strings   =>
  7400.   "This non-graphic character with decimal value" & INSERTION_FLAG
  7401.   -- insert the decimal value
  7402.   & " found in string. ", 
  7403.   -- Real_Literal_Conversion_Exception_Using_1    =>
  7404.   "Error while evaluating a real_literal. Using a value of '1.0'.  ", 
  7405.   -- Source_Line_Maximum_Exceeded =>
  7406.   "Maximum allowable source line number of " & INSERTION_FLAG
  7407.   -- insert an Integer'IMAGE
  7408.   & " exceeded.             ", 
  7409.   -- Source_Line_Too_Long =>
  7410.   "Source line number " & INSERTION_FLAG -- insert an Integer'IMAGE
  7411.   & " is too long.                               ", 
  7412.   -- Space_Must_Separate_Num_And_Ids      =>
  7413.   "A space must separate numeric_literals and identifiers.         ", 
  7414.   -- Terminal_Underline   =>
  7415.   "Terminal underlines are not allowed.                            ", 
  7416.   -- Too_Many_Radix_Points        =>
  7417.   "A real_literal may have only one radix point.                   "); 
  7418.  
  7419.   ------------------------------------------------------------------
  7420.   -- Subprogram Bodies Global to Package Lexical_Error_Message
  7421.   ------------------------------------------------------------------
  7422.  
  7423.   procedure OUTPUT_MESSAGE(IN_LINE       : in HD.SOURCE_LINE; 
  7424.                            IN_COLUMN     : in HD.SOURCE_COLUMN; 
  7425.                            IN_MESSAGE_ID : in MESSAGE_TYPE) is 
  7426.  
  7427.   begin
  7428.  
  7429.     -- output error message including line and column number
  7430.     TEXT_IO.NEW_LINE(TEXT_IO.STANDARD_OUTPUT); 
  7431.     TEXT_IO.PUT_LINE(FILE => TEXT_IO.STANDARD_OUTPUT, ITEM => 
  7432.       "Lexical Error: Line: " & HD.SOURCE_LINE'IMAGE(IN_LINE) & " Column: " & HD
  7433.       .SOURCE_COLUMN'IMAGE(IN_COLUMN) & " - " & MESSAGE_TEXT(IN_MESSAGE_ID)); 
  7434.  
  7435.   end OUTPUT_MESSAGE; 
  7436.  
  7437.   ------------------------------------------------------------------
  7438.  
  7439.   procedure OUTPUT_MESSAGE(IN_LINE           : in HD.SOURCE_LINE; 
  7440.                            IN_COLUMN         : in HD.SOURCE_COLUMN; 
  7441.                            IN_INSERTION_TEXT : in STRING;  --| text to insert.
  7442.                            IN_MESSAGE_ID     : in MESSAGE_TYPE) is 
  7443.  
  7444.   --------------------------------------------------------------
  7445.   -- Declarations for SubProgram Output_Message
  7446.   --------------------------------------------------------------
  7447.  
  7448.     INSERTION_INDEX : POSITIVE := (MESSAGE_TEXT_RANGE'LAST + 1); 
  7449.     --| if insertion flag is not found,
  7450.     --| then we append the In_Message_Text to the message
  7451.  
  7452.     ------------------------------------------------------------------
  7453.  
  7454.   begin
  7455.  
  7456.     --| Algorithm
  7457.     --|
  7458.     --| Find the insertion point.
  7459.     --| if the Message_Text doesn't have an Insertion_Flag,
  7460.     --| then set the Insertion_Index to the end of the message.
  7461.     for I in MESSAGE_TEXT_RANGE loop
  7462.       if (INSERTION_FLAG = MESSAGE_TEXT(IN_MESSAGE_ID)(I)) then 
  7463.         INSERTION_INDEX := I; 
  7464.         exit; 
  7465.       end if; 
  7466.     end loop; 
  7467.  
  7468.     -- output error message with test, line and column number
  7469.     TEXT_IO.NEW_LINE(TEXT_IO.STANDARD_OUTPUT); 
  7470.     TEXT_IO.PUT_LINE(FILE => TEXT_IO.STANDARD_OUTPUT, ITEM => 
  7471.       "Lexical Error: Line: " & HD.SOURCE_LINE'IMAGE(IN_LINE) & " Column: " & HD
  7472.       .SOURCE_COLUMN'IMAGE(IN_COLUMN) & " - " & MESSAGE_TEXT(IN_MESSAGE_ID)(1
  7473.       .. (INSERTION_INDEX - 1)) & IN_INSERTION_TEXT & MESSAGE_TEXT(
  7474.       IN_MESSAGE_ID)((INSERTION_INDEX + 1) .. MESSAGE_TEXT_RANGE'LAST)); 
  7475.  
  7476.   end OUTPUT_MESSAGE; 
  7477.  
  7478.   ------------------------------------------------------------------
  7479.  
  7480. end LEXICAL_ERROR_MESSAGE; 
  7481.  
  7482. ----------------------------------------------------------------------
  7483. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7484. --grmconst.spc
  7485. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7486.  
  7487. --+ GRMCONST.SPC +--
  7488.  
  7489. package GRAMMAR_CONSTANTS is 
  7490.  
  7491.  
  7492.   type PARSERINTEGERCOMMON is range 0 .. 450000; 
  7493.   --| range of possible values for parser's integer values (found
  7494.   --| in NYU parse tables generator output)
  7495.  
  7496.   subtype PARSERINTEGER is PARSERINTEGERCOMMON; 
  7497.   --| range of possible values for parser's integer types (found
  7498.   --| in NYU parse tables generator output)
  7499.  
  7500.   function SETGRAMMARSYMBOLCOUNT return PARSERINTEGER; 
  7501.  
  7502.   function SETACTIONCOUNT return PARSERINTEGER; 
  7503.  
  7504.   function SETSTATECOUNTPLUSONE return PARSERINTEGER; 
  7505.  
  7506.   function SETLEFTHANDSIDECOUNT return PARSERINTEGER; 
  7507.  
  7508.   function SETRIGHTHANDSIDECOUNT return PARSERINTEGER; 
  7509.  
  7510. end GRAMMAR_CONSTANTS; 
  7511. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7512. --ptbls.spc
  7513. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7514.  
  7515. ----------------------------------------------------------------------
  7516. with HOST_DEPENDENCIES;  -- host dependent constants for the compiler.
  7517. with GRAMMAR_CONSTANTS;  -- constants generated by parser generator
  7518. use GRAMMAR_CONSTANTS; 
  7519.  
  7520. package PARSETABLES is  --| Table output of parse tables generator
  7521.  
  7522. --| Overview
  7523. --|
  7524. --| This package contains the constants and tables generated by running
  7525. --| the LALR(1) parse tables generator on the Ada Grammar.
  7526. --| It also contains subprograms to access values in the more complex
  7527. --| tables, that could have their structures tuned later.
  7528. --|
  7529.  
  7530. --| Tuning
  7531. --|
  7532. --| --------------------------------------------------------------
  7533. --|
  7534. --| The Parser Generator has two options that effect the speed of
  7535. --| compilation:
  7536. --|
  7537. --| NODEFAULT : Eliminates the default reductions.
  7538. --| This also would improve error recovery.
  7539. --| Note that the table DefaultMap is still produced, though it
  7540. --| will never be referenced.
  7541. --| Thus, there need be no change to the code
  7542. --| in ParserUtilities.GetAction .
  7543. --|
  7544. --| LF : This changes the load factor used to pack and size the
  7545. --| ActionTables. It can range between 0 and 100.
  7546. --| A low LF means fewer collisions and faster parsing.
  7547. --| A high LF means more collisions and slower parsing.
  7548. --| ----------------------------------------------------------------
  7549. --|
  7550. --| The types GrammarSymbolRecord and FollowSymbolRecord
  7551. --| have a lot of unused space. The space/time tradeoff of
  7552. --| converting these into discriminated records or another
  7553. --| alternative representation, could be investigated.
  7554. --| This investigation should take the elaboration time
  7555. --| of the initializing aggregates into account.
  7556. --|
  7557. --| ----------------------------------------------------------------
  7558. --|
  7559. --| The Action Tables might be made made smaller by a restructuring of
  7560. --| the grammar.
  7561. --| For example: Have a rule for the token sequence:
  7562. --|
  7563. --| BEGIN seq_Of_Statements [EXCP..]
  7564. --|
  7565. --| ----------------------------------------------------------------
  7566. --|
  7567. --| The ParserGenerator might be modified along with
  7568. --| ParseTables.GetAction to produce smaller tables.
  7569. --| See:
  7570. --|
  7571. --| "Combined Actions to Reduce LR-Parsertables"
  7572. --| by K.Groneing. SIGPLAN Notices, Volume 19, Number 3, March 1984.
  7573. --|
  7574. --| ----------------------------------------------------------------
  7575. --|
  7576.  
  7577. --| Notes
  7578. --|
  7579. --| Abbreviations Used
  7580. --|
  7581. --| Rep : Representation
  7582. --|
  7583.  
  7584. --| RUN-TIME INPUT OF NYU LALR GENERATED TABLES AND CONSTANTS
  7585. --|
  7586. --|
  7587. --| followed by the current correct value of the
  7588. --| constant supplied by the NYU LALR Parser Generator:
  7589. --|
  7590. --| GrammarSymbolCount
  7591. --| LeftHandSideCount
  7592. --| RightHandSideCount
  7593. --| ActionTableOneLength
  7594. --| ActionTableTwoLength
  7595. --| DefaultMapLength
  7596. --| InSymbolMapLength
  7597. --| FollowMapLength
  7598. --| StateCountPlusOne
  7599. --| GrammarSymbolCountPlusOne
  7600. --| ActionCount
  7601. --| ActionTableSize
  7602. --|
  7603. --| in each of the eight declarations:
  7604. --|
  7605. --| GrammarSymbolTable
  7606. --| LeftHandSide
  7607. --| RightHandSide
  7608. --| ActionTableOne
  7609. --| ActionTableTwo
  7610. --| DefaultMap
  7611. --| InSymbolMap
  7612. --| FollowSymbolMap
  7613. --|
  7614.  
  7615.   package GC renames GRAMMAR_CONSTANTS; 
  7616.  
  7617.   ------------------------------------------------------------------
  7618.   -- Common Declarations for Action_Token_Map
  7619.   ------------------------------------------------------------------
  7620.  
  7621.   MAX_ACTION_TOKEN_COUNT : constant := 48; 
  7622.   --| This constant may need to be made larger if the grammar
  7623.   --| ever gets too large.
  7624.   --| It could be automatically generated.
  7625.  
  7626.  
  7627.   ------------------------------------------------------------------
  7628.   -- Common Declarations for Shift_State_Map
  7629.   ------------------------------------------------------------------
  7630.  
  7631.   MAX_SHIFT_STATE_COUNT  : constant := 90; 
  7632.   --| This constant may need to be made larger if the grammar
  7633.   --| ever gets too large.
  7634.   --| It could be automatically generated.
  7635.  
  7636.  
  7637.  
  7638.   subtype PARSERSTRINGRANGEPLUSZEROCOMMON is NATURAL range 0 .. 
  7639.     HOST_DEPENDENCIES.MAXCOLUMN; 
  7640.   --| Parser's string should never be greater than a source line
  7641.   --| worth of text.
  7642.  
  7643.   subtype GRAMMARSYMBOLREPRANGEPLUSZEROCOMMON is PARSERSTRINGRANGEPLUSZEROCOMMON
  7644.     range 0 .. 57; 
  7645.  
  7646.   subtype FOLLOWSYMBOLRANGECOMMON is GC.PARSERINTEGER range 1 .. 50; 
  7647.  
  7648.   ------------------------------------------------------------------
  7649.   -- Declarations Global to Package ParseTables
  7650.   ------------------------------------------------------------------
  7651.  
  7652.   subtype POSITIVEPARSERINTEGER is GC.PARSERINTEGER range 1 .. GC.PARSERINTEGER'
  7653.     LAST; 
  7654.  
  7655.   subtype PARSERSTRINGRANGEPLUSZERO is PARSERSTRINGRANGEPLUSZEROCOMMON; 
  7656.   --| Parser's string should never be greater than a source line
  7657.   --| worth of text.
  7658.  
  7659.   ----------------------------------------------------------------------
  7660.   -- The first constant used to  the Parse Tables
  7661.   ----------------------------------------------------------------------
  7662.  
  7663.   GRAMMARSYMBOLCOUNT : constant GC.PARSERINTEGER := GC.SETGRAMMARSYMBOLCOUNT; 
  7664.   --| Number of terminals and nonterminals in the Ada grammar
  7665.   --| rules input to the parse tables generator
  7666.  
  7667.   subtype GRAMMARSYMBOLRANGE is GC.PARSERINTEGER range 1 .. GRAMMARSYMBOLCOUNT; 
  7668.   --| valid range of values for grammar symbols
  7669.  
  7670.   ------------------------------------------------------------------
  7671.   -- Parser Table Generated Token Values for Terminals
  7672.   ------------------------------------------------------------------
  7673.  
  7674.   -- WARNING: need to be checked after each Parser Generator Run.
  7675.   -- This could be made part of the ParseTables/ErrorParseTables
  7676.   -- generator program(s) at some point.
  7677.  
  7678.   ------------------------------------------------------------------
  7679.   -- Special Empty Terminal
  7680.   ------------------------------------------------------------------
  7681.  
  7682.   EMPTY_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 1; 
  7683.  
  7684.   ------------------------------------------------------------------
  7685.   -- Reserved Words
  7686.   ------------------------------------------------------------------
  7687.  
  7688.   ABORTTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 2; 
  7689.   ABSTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 3; 
  7690.   ACCEPTTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 4; 
  7691.   ACCESSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 5; 
  7692.   ALLTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 6; 
  7693.   ANDTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 7; 
  7694.   ARRAYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 8; 
  7695.   ATTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 9; 
  7696.   BEGINTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 10; 
  7697.   BODYTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 11; 
  7698.   CASETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 12; 
  7699.   CONSTANTTOKENVALUE    : constant GRAMMARSYMBOLRANGE := 13; 
  7700.   DECLARETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 14; 
  7701.   DELAYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 15; 
  7702.   DELTATOKENVALUE       : constant GRAMMARSYMBOLRANGE := 16; 
  7703.   DIGITSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 17; 
  7704.   DOTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 18; 
  7705.   ELSETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 19; 
  7706.   ELSIFTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 20; 
  7707.   ENDTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 21; 
  7708.   ENTRYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 22; 
  7709.   EXCEPTIONTOKENVALUE   : constant GRAMMARSYMBOLRANGE := 23; 
  7710.   EXITTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 24; 
  7711.   FORTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 25; 
  7712.   FUNCTIONTOKENVALUE    : constant GRAMMARSYMBOLRANGE := 26; 
  7713.   GENERICTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 27; 
  7714.   GOTOTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 28; 
  7715.   IFTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 29; 
  7716.   INTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 30; 
  7717.   ISTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 31; 
  7718.   LIMITEDTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 32; 
  7719.   LOOPTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 33; 
  7720.   MODTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 34; 
  7721.   NEWTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 35; 
  7722.   NOTTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 36; 
  7723.   NULLTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 37; 
  7724.   OFTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 38; 
  7725.   ORTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 39; 
  7726.   OTHERSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 40; 
  7727.   OUTTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 41; 
  7728.   PACKAGETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 42; 
  7729.   PRAGMATOKENVALUE      : constant GRAMMARSYMBOLRANGE := 43; 
  7730.   PRIVATETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 44; 
  7731.   PROCEDURETOKENVALUE   : constant GRAMMARSYMBOLRANGE := 45; 
  7732.   RAISETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 46; 
  7733.   RANGETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 47; 
  7734.   RECORDTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 48; 
  7735.   REMTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 49; 
  7736.   RENAMESTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 50; 
  7737.   RETURNTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 51; 
  7738.   REVERSETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 52; 
  7739.   SELECTTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 53; 
  7740.   SEPARATETOKENVALUE    : constant GRAMMARSYMBOLRANGE := 54; 
  7741.   SUBTYPETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 55; 
  7742.   TASKTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 56; 
  7743.   TERMINATETOKENVALUE   : constant GRAMMARSYMBOLRANGE := 57; 
  7744.   THENTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 58; 
  7745.   TYPETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 59; 
  7746.   USETOKENVALUE         : constant GRAMMARSYMBOLRANGE := 60; 
  7747.   WHENTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 61; 
  7748.   WHILETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 62; 
  7749.   WITHTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 63; 
  7750.   XORTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 64; 
  7751.  
  7752.   ------------------------------------------------------------------
  7753.   -- Identifier and Literals
  7754.   ------------------------------------------------------------------
  7755.  
  7756.   IDENTIFIERTOKENVALUE  : constant GRAMMARSYMBOLRANGE := 65; 
  7757.   NUMERICTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 66; 
  7758.   STRINGTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 67; 
  7759.   CHARACTERTOKENVALUE   : constant GRAMMARSYMBOLRANGE := 68; 
  7760.  
  7761.   ------------------------------------------------------------------
  7762.   -- Single Delimiters
  7763.   ------------------------------------------------------------------
  7764.  
  7765.   AMPERSAND_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 69; 
  7766.   APOSTROPHE_TOKENVALUE : constant GRAMMARSYMBOLRANGE := 70; 
  7767.   LEFTPAREN_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 71; 
  7768.   RIGHTPAREN_TOKENVALUE : constant GRAMMARSYMBOLRANGE := 72; 
  7769.   STAR_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 73; 
  7770.   PLUS_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 74; 
  7771.   COMMA_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 75; 
  7772.   MINUS_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 76; 
  7773.   DOT_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 77; 
  7774.   SLASH_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 78; 
  7775.   COLON_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 79; 
  7776.   SEMICOLON_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 80; 
  7777.   LT_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 81; 
  7778.   EQ_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 82; 
  7779.   GT_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 83; 
  7780.   BAR_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 84; 
  7781.  
  7782.  
  7783.   ------------------------------------------------------------------
  7784.   -- Double Delimiters
  7785.   ------------------------------------------------------------------
  7786.  
  7787.   EQGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 85; 
  7788.   DOTDOT_TOKENVALUE     : constant GRAMMARSYMBOLRANGE := 86; 
  7789.   STARSTAR_TOKENVALUE   : constant GRAMMARSYMBOLRANGE := 87; 
  7790.   COLONEQ_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 88; 
  7791.   SLASHEQ_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 89; 
  7792.   GTEQ_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 90; 
  7793.   LTEQ_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 91; 
  7794.   LTLT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 92; 
  7795.   GTGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 93; 
  7796.   LTGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 94; 
  7797.  
  7798.   ------------------------------------------------------------------
  7799.   -- Comment Terminal
  7800.   ------------------------------------------------------------------
  7801.  
  7802.   COMMENT_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 95; 
  7803.  
  7804.   ------------------------------------------------------------------
  7805.   -- Special Terminals
  7806.   ------------------------------------------------------------------
  7807.  
  7808.   EOF_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 96; 
  7809.  
  7810.   ------------------------------------------------------------------
  7811.   -- Special Non-Terminals
  7812.   ------------------------------------------------------------------
  7813.  
  7814.   ACC_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 97; 
  7815.  
  7816.   ------------------------------------------------------------------
  7817.   -- Grammar Symbol Classes
  7818.   ------------------------------------------------------------------
  7819.  
  7820.   subtype TOKENRANGE is GRAMMARSYMBOLRANGE range 1 .. EOF_TOKENVALUE; 
  7821.  
  7822.   subtype TOKENRANGELESSEOF is GRAMMARSYMBOLRANGE range 1 .. (EOF_TOKENVALUE - 1
  7823.     ); 
  7824.  
  7825.   subtype NONTOKENRANGE is GRAMMARSYMBOLRANGE range (EOF_TOKENVALUE + 1) .. 
  7826.     GRAMMARSYMBOLCOUNT; 
  7827.  
  7828.   ACTIONCOUNT       : constant GC.PARSERINTEGER := GC.SETACTIONCOUNT; 
  7829.   --| Number of actions in the parse tables.
  7830.   -- NYU Reference Name: NUM_ACTIONS
  7831.  
  7832.   STATECOUNTPLUSONE : constant GC.PARSERINTEGER := GC.SETSTATECOUNTPLUSONE; 
  7833.   --| Number of states plus one in the parse tables.
  7834.   -- NYU Reference Name: NUM_STATES
  7835.  
  7836.   subtype STATERANGE is GC.PARSERINTEGER range 1 .. (STATECOUNTPLUSONE - 1); 
  7837.  
  7838.   subtype ACTIONRANGE is GC.PARSERINTEGER range 0 .. ACTIONCOUNT; 
  7839.  
  7840.   LEFTHANDSIDECOUNT : constant GC.PARSERINTEGER := GC.SETLEFTHANDSIDECOUNT; 
  7841.   --| Number of left hand sides in the Ada grammar rules.
  7842.  
  7843.   subtype LEFTHANDSIDERANGE is GC.PARSERINTEGER range 1 .. LEFTHANDSIDECOUNT; 
  7844.  
  7845.   function GET_LEFTHANDSIDE(GRAMMARRULE : in LEFTHANDSIDERANGE) return
  7846.     GRAMMARSYMBOLRANGE; 
  7847.   pragma INLINE(GET_LEFTHANDSIDE); 
  7848.  
  7849.   RIGHTHANDSIDECOUNT : constant GC.PARSERINTEGER := GC.SETRIGHTHANDSIDECOUNT; 
  7850.   --| Number of right hand sides in the Ada grammar rules.
  7851.  
  7852.   subtype RIGHTHANDSIDERANGE is GC.PARSERINTEGER range 1 .. RIGHTHANDSIDECOUNT; 
  7853.  
  7854.   function GET_RIGHTHANDSIDE(GRAMMARRULE : in RIGHTHANDSIDERANGE) return GC.
  7855.     PARSERINTEGER; 
  7856.   pragma INLINE(GET_RIGHTHANDSIDE); 
  7857.  
  7858.   ------------------------------------------------------------------
  7859.   -- Subprogram Bodies Global to Package ParseTables
  7860.   ------------------------------------------------------------------
  7861.  
  7862.   function GETACTION(INSTATEVALUE  : in STATERANGE; 
  7863.                      INSYMBOLVALUE : in GRAMMARSYMBOLRANGE) return ACTIONRANGE; 
  7864.  
  7865.   function GET_GRAMMAR_SYMBOL( --| return the string representation
  7866.   --| of the grammar symbol
  7867.                               IN_INDEX : in GRAMMARSYMBOLRANGE) return STRING; 
  7868.  
  7869.   --| Effects
  7870.   --|
  7871.   --| This subprogram returns the string representation of the
  7872.   --| GrammarSymbolRange passed in.
  7873.   --|
  7874.  
  7875.   ------------------------------------------------------------------
  7876.   subtype FOLLOWMAPRANGE is NONTOKENRANGE; 
  7877.  
  7878.   type FOLLOWSYMBOLARRAY is array(POSITIVEPARSERINTEGER range <>) of 
  7879.     GRAMMARSYMBOLRANGE; 
  7880.  
  7881.   type FOLLOWSYMBOLRECORD is 
  7882.     record
  7883.       FOLLOW_SYMBOL_COUNT : TOKENRANGE; 
  7884.       FOLLOW_SYMBOL       : FOLLOWSYMBOLARRAY(TOKENRANGE); 
  7885.     end record; 
  7886.     ------------------------------------------------------------------
  7887.  
  7888.   function GET_FOLLOW_MAP( --| return the array of follow symbols
  7889.   --| of the grammar symbol passed in
  7890.                           IN_INDEX : in FOLLOWMAPRANGE) return
  7891.     FOLLOWSYMBOLRECORD; 
  7892.  
  7893.  
  7894.   --| Effects
  7895.   --|
  7896.   --| This subprogram returns the array of follow symbols for the
  7897.   --| grammar symbol passed in.
  7898.   --|
  7899.  
  7900.   ------------------------------------------------------------------
  7901.   -- The following declarations are for Error Recovery.
  7902.   ------------------------------------------------------------------
  7903.   ------------------------------------------------------------------
  7904.   -- Action_Token_Map
  7905.   ------------------------------------------------------------------
  7906.  
  7907.   subtype ACTION_TOKEN_RANGE is GC.PARSERINTEGER range 1 .. 
  7908.     MAX_ACTION_TOKEN_COUNT; 
  7909.  
  7910.   subtype ACTION_TOKEN_RANGE_PLUS_ZERO is GC.PARSERINTEGER range 0 .. 
  7911.     MAX_ACTION_TOKEN_COUNT; 
  7912.   --| for the set_size (which could be null!)
  7913.  
  7914.   type ACTION_TOKEN_ARRAY is array(POSITIVEPARSERINTEGER range <>) of 
  7915.     TOKENRANGELESSEOF; 
  7916.  
  7917.   type ACTION_TOKEN_RECORD is 
  7918.     record
  7919.       SET_SIZE : ACTION_TOKEN_RANGE_PLUS_ZERO; 
  7920.       SET      : ACTION_TOKEN_ARRAY(ACTION_TOKEN_RANGE); 
  7921.     end record; 
  7922.  
  7923.     ------------------------------------------------------------------
  7924.     -- Shift_State_Map
  7925.     ------------------------------------------------------------------
  7926.  
  7927.   subtype SHIFT_STATE_RANGE is GC.PARSERINTEGER range 1 .. MAX_SHIFT_STATE_COUNT
  7928.     ; 
  7929.  
  7930.   subtype SHIFT_STATE_RANGE_PLUS_ZERO is GC.PARSERINTEGER range 0 .. 
  7931.     MAX_SHIFT_STATE_COUNT; 
  7932.   --| for the set_size (which could be null!)
  7933.  
  7934.   type SHIFT_STATE_ARRAY is array(POSITIVEPARSERINTEGER range <>) of STATERANGE
  7935.     ; 
  7936.  
  7937.   type SHIFT_STATE_RECORD is 
  7938.     record
  7939.       SET_SIZE : SHIFT_STATE_RANGE_PLUS_ZERO; 
  7940.       SET      : SHIFT_STATE_ARRAY(SHIFT_STATE_RANGE); 
  7941.     end record; 
  7942.  
  7943.     ------------------------------------------------------------------
  7944.  
  7945.   function GET_ACTION_TOKEN_MAP( --| return the array of action tokens
  7946.   --| for the state passed in.
  7947.                                 IN_INDEX : in STATERANGE
  7948.                                 --| the state to return action tokens
  7949.                                 --| for.
  7950.                                 ) return ACTION_TOKEN_RECORD; 
  7951.  
  7952.   ------------------------------------------------------------------
  7953.  
  7954.   function GET_SHIFT_STATE_MAP( --| return the array of shift states
  7955.   --| for the grammar symbol passed in.
  7956.                                IN_INDEX : in GRAMMARSYMBOLRANGE
  7957.                                --| grammar symbol to return shifts
  7958.                                --| for.
  7959.                                ) return SHIFT_STATE_RECORD; 
  7960.  
  7961.   -- The following variables contain statistics information
  7962.   -- collected during the parse:
  7963.   PARSERDECISIONCOUNT : NATURAL := 0;  --| Total number of times that
  7964.   --| GetAction was called.
  7965.   MAXCOLLISIONS       : NATURAL := 0;  --| Of all the calls to GetAction
  7966.   --| The one which resulted in the greatest number of collisions
  7967.   TOTALCOLLISIONS     : NATURAL := 0; 
  7968.   --| Total number of collisions which occurred during parsing.
  7969.  
  7970. end PARSETABLES; 
  7971. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7972. --lexidval.spc
  7973. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7974.  
  7975.  
  7976. ----------------------------------------------------------------------
  7977.  
  7978. with PARSETABLES;  -- tables from parser generator
  7979.  
  7980. package LEX_IDENTIFIER_TOKEN_VALUE is 
  7981. --| Classify identifiers and reserved words and determine which
  7982. --| identifiers are in package STANDARD.
  7983.  
  7984. ------------------------------------------------------------------
  7985. -- Subprogram Bodies Global to
  7986. -- Package Lex_Identifier_Token_Value
  7987. ------------------------------------------------------------------
  7988.  
  7989.   procedure FIND(
  7990.   --| returns token value and whether identifier is in package STANDARD.
  7991.  
  7992.                  IN_IDENTIFIER   : in STRING; 
  7993.                                        --| text of identifier to identify
  7994.  
  7995.                  OUT_TOKEN_VALUE : out PARSETABLES.TOKENRANGE); 
  7996.   --| TokenValue of this identifier
  7997.  
  7998.   --| Effects
  7999.   --|
  8000.   --| This subprogram determines if the identifier is
  8001.   --| a reserved word or a plain identifier.
  8002.   --|
  8003.   --| The answer is indicated by returning the appropriate TokenValue.
  8004.   --|
  8005.  
  8006.   ------------------------------------------------------------------
  8007.  
  8008. end LEX_IDENTIFIER_TOKEN_VALUE; 
  8009.  
  8010. ----------------------------------------------------------------------
  8011. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8012. --pdecls.spc
  8013. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8014.  
  8015.  
  8016. -----------------------------------------------------------------------
  8017.  
  8018. with HOST_DEPENDENCIES;  -- host dependent constants
  8019. with PARSETABLES;  -- constants and state tables
  8020. use PARSETABLES; 
  8021.  
  8022. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS; 
  8023.  
  8024. package PARSERDECLARATIONS is  --| Objects used by the Parser
  8025.  
  8026. --| Notes
  8027.  
  8028. --| Abbreviations used in this compilation unit:
  8029. --|
  8030. --| gram : grammar
  8031. --| sym  : symbol
  8032. --| val  : value
  8033. --|
  8034.  
  8035.   package HD renames HOST_DEPENDENCIES; 
  8036.   package PT renames PARSETABLES; 
  8037.   package GC renames GRAMMAR_CONSTANTS; 
  8038.  
  8039.   -- Exceptions --
  8040.  
  8041.   MEMORYOVERFLOW            : exception;  --| raised if Parser runs out of
  8042.   --| newable memory.
  8043.   PARSER_ERROR              : exception;  --| raised if an error occurs during
  8044.   --| parsing.
  8045.  
  8046.   --| The double delimiters were named with a combination of the name of
  8047.   --| each component symbol.
  8048.  
  8049.   ARROW_TOKENVALUE          : GRAMMARSYMBOLRANGE renames EQGT_TOKENVALUE; 
  8050.   EXPONENTIATION_TOKENVALUE : GRAMMARSYMBOLRANGE renames STARSTAR_TOKENVALUE; 
  8051.   ASSIGNMENT_TOKENVALUE     : GRAMMARSYMBOLRANGE renames COLONEQ_TOKENVALUE; 
  8052.   NOTEQUALS_TOKENVALUE      : GRAMMARSYMBOLRANGE renames SLASHEQ_TOKENVALUE; 
  8053.   STARTLABEL_TOKENVALUE     : GRAMMARSYMBOLRANGE renames LTLT_TOKENVALUE; 
  8054.   ENDLABEL_TOKENVALUE       : GRAMMARSYMBOLRANGE renames GTGT_TOKENVALUE; 
  8055.   BOX_TOKENVALUE            : GRAMMARSYMBOLRANGE renames LTGT_TOKENVALUE; 
  8056.  
  8057.   ------------------------------------------------------------------
  8058.   -- Grammar Symbol Classes
  8059.   ------------------------------------------------------------------
  8060.  
  8061.   subtype RESERVEDWORDRANGE is GRAMMARSYMBOLRANGE range ABORTTOKENVALUE .. 
  8062.     XORTOKENVALUE; 
  8063.  
  8064.   subtype SINGLEDELIMITERRANGE is GRAMMARSYMBOLRANGE range AMPERSAND_TOKENVALUE
  8065.     .. BAR_TOKENVALUE; 
  8066.  
  8067.   subtype DOUBLEDELIMITERRANGE is GRAMMARSYMBOLRANGE range ARROW_TOKENVALUE .. 
  8068.     BOX_TOKENVALUE; 
  8069.  
  8070.   ------------------------------------------------------------------
  8071.   -- ParseTables.GetAction return values
  8072.   ------------------------------------------------------------------
  8073.  
  8074.   subtype ERROR_ACTION_RANGE is  --| ActionRange that indicates
  8075.   ACTIONRANGE range 0 .. 0;  --| the error range
  8076.  
  8077.   subtype SHIFT_ACTION_RANGE is  --| ActionRange that indicates
  8078.   --| a shift action.
  8079.   ACTIONRANGE range 1 .. (STATECOUNTPLUSONE - 1); 
  8080.  
  8081.   subtype ACCEPT_ACTION_RANGE is  --| ActionRange that indicates
  8082.   --| the accept action.
  8083.   ACTIONRANGE range STATECOUNTPLUSONE .. STATECOUNTPLUSONE; 
  8084.  
  8085.   subtype REDUCE_ACTION_RANGE is  --| ActionRange that indicates
  8086.   --| a reduce action.
  8087.   ACTIONRANGE range (STATECOUNTPLUSONE + 1) .. ACTIONCOUNT; 
  8088.  
  8089.   ------------------------------------------------------------------
  8090.   -- Queue and Stack Management
  8091.   ------------------------------------------------------------------
  8092.  
  8093.   subtype STATEPARSESTACKSINDEX is  --| range of index values for
  8094.   GC.PARSERINTEGER range 0 .. 200;  --| StateStack and ParseStack
  8095.  
  8096.   subtype STATEPARSESTACKSRANGE is  --| array index values for
  8097.   --| StateStack and ParseStack
  8098.   STATEPARSESTACKSINDEX range 1 .. STATEPARSESTACKSINDEX'LAST; 
  8099.  
  8100.   LOOK_AHEAD_LIMIT : POSITIVE := 5;  --| Look ahead limit for parser
  8101.  
  8102.   ------------------------------------------------------------------
  8103.   -- StateStack Element
  8104.   ------------------------------------------------------------------
  8105.  
  8106.   subtype STATESTACKELEMENT is STATERANGE; 
  8107.  
  8108.   type SOURCE_TEXT is access STRING; 
  8109.  
  8110.   NULL_SOURCE_TEXT : constant SOURCE_TEXT := null; 
  8111.  
  8112.   ------------------------------------------------------------------
  8113.   -- ParseStack and Grammar Symbol Elements
  8114.   ------------------------------------------------------------------
  8115.  
  8116.   type TOKEN is 
  8117.     record
  8118.       TEXT          : SOURCE_TEXT; 
  8119.       SRCPOS_LINE   : HD.SOURCE_LINE; 
  8120.       SRCPOS_COLUMN : HD.SOURCE_COLUMN; 
  8121.     end record; 
  8122.  
  8123.   type PARSESTACKELEMENT is 
  8124.     record
  8125.       GRAM_SYM_VAL : GRAMMARSYMBOLRANGE; 
  8126.       --| used by parser to identify kind of grammar symbol
  8127.       LEXED_TOKEN  : TOKEN; 
  8128.       --| lexed tokens not yet reduced (eliminated)
  8129.       --| by ReduceActions.
  8130.     end record; 
  8131.  
  8132.     ------------------------------------------------------------------
  8133.  
  8134.   CURTOKEN : PARSESTACKELEMENT; 
  8135.   --| return from Lex.GetNextSourceToken
  8136.   --| Token used in subprogram Parse to determine
  8137.   --| next action from.
  8138.   --| Also used in ReduceActionsUtilities to determine last
  8139.   --| compilation unit in a compilation.
  8140.  
  8141.   ------------------------------------------------------------------
  8142.   -- Subprogram Bodies Global to Package ParserDeclarations
  8143.   ------------------------------------------------------------------
  8144.  
  8145.   function GET_SOURCE_TEXT( --| get a string from a Source_Text
  8146.   --| object
  8147.                            IN_SOURCE_TEXT : 
  8148.                                     --| the object to get the string from
  8149.                            in SOURCE_TEXT) return STRING; 
  8150.  
  8151.   --| Effects
  8152.  
  8153.   --| This subprogram gets a string from a Source_Text object.
  8154.   --| It exists to concentrate the interface to Source_Text objects.
  8155.  
  8156.   ------------------------------------------------------------------
  8157.  
  8158.   procedure PUT_SOURCE_TEXT( --| put a string into a Source_Text
  8159.   --| object
  8160.                             IN_STRING          : in STRING; 
  8161.                                    --| the string to store
  8162.                             IN_OUT_SOURCE_TEXT : 
  8163.                                    --| the object to store the string in
  8164.                             in out SOURCE_TEXT); 
  8165.  
  8166.  
  8167.   --| Effects
  8168.  
  8169.   --| This subprogram stores a string in a Source_Text object.
  8170.   --| It exists to concentrate the interface to Source_Text objects.
  8171.  
  8172.   ------------------------------------------------------------------
  8173.  
  8174.   function DUMP_PARSE_STACK_ELEMENT( --| return the data in a
  8175.   --| ParseStackElement or
  8176.   --| TokenQueueElement as a string
  8177.                                     IN_PSE : in PARSESTACKELEMENT
  8178.                                         --| the Element to display.
  8179.                                     ) return STRING; 
  8180.  
  8181.   --| Effects
  8182.  
  8183.   --| This subprogram returns the data in a ParseStackElement or its
  8184.   --| sub-type a TokenQueueElement as a string.
  8185.  
  8186.   --| Notes
  8187.  
  8188.   --| Abbreviations used in this compilation unit
  8189.   --|
  8190.   --| PSE : ParseStackElement
  8191.   --|
  8192.   --| Only the lexed_token variant is currently fully displayed.
  8193.   --| The other variants would have to make use of an IDL
  8194.   --| writer.
  8195.  
  8196.   ------------------------------------------------------------------
  8197.  
  8198. end PARSERDECLARATIONS; 
  8199.  
  8200. ----------------------------------------------------------------------
  8201. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8202. --lex.spc
  8203. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8204.  
  8205.  
  8206. ----------------------------------------------------------------------
  8207.  
  8208. with PARSERDECLARATIONS;  -- declarations for the Parser
  8209. with HOST_DEPENDENCIES;  -- Host dependents constants
  8210.  
  8211. package LEX is  --| perform lexical analysis
  8212.  
  8213. --| Overview
  8214. --|
  8215. --| This package is used to identify tokens in the source file and
  8216. --| return them to subprogram Parser.
  8217. --|
  8218. --| The useful reference is Chapter 2 of the Ada (Trade Mark) LRM.
  8219.  
  8220. --| Effects
  8221. --|
  8222. --| The subprograms in package Lex are used to sequentially read
  8223. --| a source file and identify lexical units (tokens) in the file.
  8224. --| Comments and error messages are saved for use by the lister.
  8225.  
  8226.   package HD renames HOST_DEPENDENCIES; 
  8227.   package PD renames PARSERDECLARATIONS; 
  8228.   -- other package renames are in the package body
  8229.  
  8230.   ------------------------------------------------------------------
  8231.   -- Subprogram Declarations Global to Package Lex
  8232.   ------------------------------------------------------------------
  8233.  
  8234.   procedure INITIALIZATION;  --| Initializes the lexer
  8235.  
  8236.   --| Effects
  8237.   --|
  8238.   --| This subprogram initializes the lexer.
  8239.  
  8240.   ------------------------------------------------------------------
  8241.  
  8242.   function GETNEXTNONCOMMENTTOKEN --| returns next non-comment token
  8243.   --| in source file.
  8244.   return PD.PARSESTACKELEMENT; 
  8245.  
  8246.   --| Effects
  8247.   --|
  8248.   --| This subprogram scans the source file for the next token not
  8249.   --| including comment tokens.
  8250.  
  8251.   --| Requires
  8252.   --|
  8253.   --| This subprogram requires an opened source file,
  8254.   --| and the state information internal to the package body.
  8255.  
  8256.   ------------------------------------------------------------------
  8257.  
  8258.   function GETNEXTSOURCETOKEN --| returns next token in source file.
  8259.   return PD.PARSESTACKELEMENT; 
  8260.  
  8261.   --| Effects
  8262.   --|
  8263.   --| This subprogram scans the source file for the next token.
  8264.   --| The tokens returned include any comment literal tokens.
  8265.  
  8266.   --| Requires
  8267.   --|
  8268.   --| This subprogram requires an opened source file,
  8269.   --| and the state information internal to the package body.
  8270.  
  8271.   ------------------------------------------------------------------
  8272.  
  8273.   function SHOW_CURRENT_LINE return HD.SOURCE_LINE; 
  8274.  
  8275.   --| Effects
  8276.   --|
  8277.   --| Returns the current line number being processed
  8278.  
  8279.   ------------------------------------------------------------------
  8280.  
  8281. end LEX; 
  8282.  
  8283. ----------------------------------------------------------------------
  8284. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8285. --lex.bdy
  8286. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8287.  
  8288.  
  8289. ----------------------------------------------------------------------
  8290.  
  8291. with HOST_DEPENDENCIES;  -- Host dependents constants
  8292. with LEX_IDENTIFIER_TOKEN_VALUE; 
  8293. -- contains data structures and subprogram
  8294. --    to distinguish identifiers from
  8295. --    reserved words
  8296. with LEXICAL_ERROR_MESSAGE;  -- outputs error messages.
  8297. with PARSETABLES;  -- tables from parser generator
  8298. use PARSETABLES; 
  8299. with GRAMMAR_CONSTANTS;  -- constants from the parser generator
  8300. use GRAMMAR_CONSTANTS; 
  8301. with TEXT_IO; 
  8302.  
  8303.  
  8304. package body LEX is 
  8305.  
  8306. --| Overview
  8307. --| 
  8308. --| Package Lex is implemented as a state machine via case statements.
  8309. --| The implementation is optimized to minimize the number of times
  8310. --| each character is handled.  Each character is handled twice: once
  8311. --| on input and once on lexing based on the character.
  8312. --| 
  8313. --| The algorithm depends on having an End_Of_Line_Character
  8314. --| terminate each source file line.  This concludes the final token
  8315. --| on the line for the case statement scanners.
  8316.  
  8317. --| Notes
  8318. --| 
  8319. --| Abbreviations Used:
  8320. --|
  8321. --| Char : Character
  8322. --| CST  : Current_Source_Token
  8323. --| gram : grammar
  8324. --| sym  : symbol
  8325. --| val  : value
  8326. --| RW   : Reserved Word
  8327. --| 
  8328.  
  8329.   use PARSERDECLARATIONS; 
  8330.   package LEM renames LEXICAL_ERROR_MESSAGE; 
  8331.   package PT renames PARSETABLES; 
  8332.   package GC renames GRAMMAR_CONSTANTS; 
  8333.   -- other package renames are in the package spec
  8334.  
  8335.   ------------------------------------------------------------------
  8336.   -- Character Types
  8337.   ------------------------------------------------------------------
  8338.  
  8339.   subtype GRAPHIC_CHARACTER is CHARACTER range ' ' .. ASCII.TILDE; 
  8340.  
  8341.   subtype UPPER_CASE_LETTER is CHARACTER range 'A' .. 'Z'; 
  8342.  
  8343.   subtype LOWER_CASE_LETTER is CHARACTER range ASCII.LC_A .. ASCII.LC_Z; 
  8344.  
  8345.   subtype DIGIT is CHARACTER range '0' .. '9'; 
  8346.  
  8347.   subtype VALID_BASE_RANGE is GC.PARSERINTEGER range 2 .. 16; 
  8348.  
  8349.   subtype END_OF_LINE_CHARACTER is CHARACTER range ASCII.LF .. ASCII.CR; 
  8350.  
  8351.   ------------------------------------------------------------------
  8352.   -- Source position management
  8353.   ------------------------------------------------------------------
  8354.  
  8355.   CURRENT_COLUMN     : HD.SOURCE_COLUMN := 1; 
  8356.   CURRENT_LINE       : HD.SOURCE_LINE := 1; 
  8357.   --| the position of Next_Char in the source file.
  8358.   --| Visible so the Lexical_Error_message package can use them.
  8359.  
  8360.   ------------------------------------------------------------------
  8361.   -- Source Input Buffers and their Management
  8362.   ------------------------------------------------------------------
  8363.  
  8364.   NEXT_CHAR          : CHARACTER := ' ';  --| input buffer for next character
  8365.   --| to scan from source file
  8366.  
  8367.   END_OF_LINE_BUFFER :  --| character that signals end of
  8368.   --| line buffer
  8369.   constant CHARACTER := END_OF_LINE_CHARACTER'FIRST; 
  8370.  
  8371.   subtype LINE_BUFFER_RANGE is POSITIVE range 1 .. ((HD.SOURCE_COLUMN'LAST) + 2)
  8372.     ; 
  8373.   --| The first extra element is needed to hold the End_Of_Line_Buffer
  8374.   --| character. The second extra element allows Line_Buffer_Index
  8375.   --| to exceed Line_Buffer_Last.
  8376.  
  8377.   LINE_BUFFER         : STRING(LINE_BUFFER_RANGE) := ( -- 1 =>
  8378.   END_OF_LINE_BUFFER, others => ' '); 
  8379.   --| input buffer containing source file line being lexed.
  8380.  
  8381.   LINE_BUFFER_LAST    : HD.SOURCE_COLUMN := LINE_BUFFER'FIRST; 
  8382.   --| length of source file line being lexed.
  8383.  
  8384.   LINE_BUFFER_INDEX   : LINE_BUFFER_RANGE; 
  8385.   --| index of character being lexed.
  8386.  
  8387.   END_OF_FILE_REACHED : BOOLEAN := FALSE; 
  8388.   --| true when end of the input source has been reached
  8389.  
  8390.   ------------------------------------------------------------------
  8391.   -- Token to be Returned and its Management
  8392.   ------------------------------------------------------------------
  8393.  
  8394.   CST                 : PD.PARSESTACKELEMENT; 
  8395.                                    --| token being assembled for return by
  8396.   --| subprogram GetNextSourceToken
  8397.  
  8398.   subtype CST_INITIALIZATION_TYPE is PD.PARSESTACKELEMENT; 
  8399.  
  8400.   CST_INITIALIZER          : CST_INITIALIZATION_TYPE; 
  8401.   --| short cut to initializing discriminants properly
  8402.  
  8403.   END_OF_FILE_TOKEN        : CST_INITIALIZATION_TYPE; 
  8404.  
  8405.   ------------------------------------------------------------------
  8406.   -- Other objects
  8407.   ------------------------------------------------------------------
  8408.  
  8409.   EXIT_AFTER_GET_NEXT_CHAR : BOOLEAN := FALSE; 
  8410.   --| true; call Get_Next_Char before exiting, so that
  8411.   --| Next_Char contains the next character to be scanned.
  8412.   --| This object is not located in subprogram GetNextSourceToken,
  8413.   --| to save the time of re-elaboration on each call.
  8414.  
  8415.   PREVIOUS_TOKEN_VALUE     : PT.TOKENRANGE := PT.STRINGTOKENVALUE; 
  8416.   --| used to resolve tick use as a token in T'('a') versus
  8417.   --| use as a delimiter in a character literal.
  8418.  
  8419.   SOURCE_FILE              : TEXT_IO.FILE_TYPE; 
  8420.  
  8421.   ------------------------------------------------------------------
  8422.   -- Declarations for Scan_Numeric_Literal and Scan_Comment
  8423.   ------------------------------------------------------------------
  8424.  
  8425.   TEMP_SOURCE_TEXT         : PD.SOURCE_TEXT;  --| temporary to hold value of
  8426.   --| Source_Text
  8427.  
  8428.   ------------------------------------------------------------------
  8429.  
  8430.   subtype WORK_STRING_RANGE_PLUS_ZERO is NATURAL range 0 .. NATURAL(HD.
  8431.     SOURCE_COLUMN'LAST); 
  8432.  
  8433.   WORK_STRING        : STRING(1 .. WORK_STRING_RANGE_PLUS_ZERO'LAST); 
  8434.  
  8435.   WORK_STRING_LENGTH : WORK_STRING_RANGE_PLUS_ZERO; 
  8436.   -- Must initialize to 0 before each use.
  8437.  
  8438.   ------------------------------------------------------------------
  8439.   -- Declarations for Procedures:
  8440.   --
  8441.   -- Scan_Exponent, Scan_Based_Integer, Scan_Integer,
  8442.   -- and Scan_Numeric_Literal
  8443.   ------------------------------------------------------------------
  8444.  
  8445.   SEEN_RADIX_POINT   : BOOLEAN := FALSE; 
  8446.   --| true  : real
  8447.   --| false : integer
  8448.  
  8449.   ------------------------------------------------------------------
  8450.   -- Subprogram Specifications Local to Package Lex
  8451.   ------------------------------------------------------------------
  8452.  
  8453.   procedure GET_NEXT_CHAR;  --| Obtains next character
  8454.  
  8455.   --| Requires
  8456.   --|
  8457.   --| This subprogram requires an opened source file, and
  8458.   --| Current Column > Line_Buffer_Last on its first call to initialize
  8459.   --| the input buffers Next_Char and Line_Buffer correctly.
  8460.   --|
  8461.  
  8462.   --| Effects
  8463.   --|
  8464.   --| This subprogram places the next character from the source file
  8465.   --| in Next_Char and updates the source file position.
  8466.   --| Subprogram Get_Next_Line sets End_Of_File_Reached true, and causes
  8467.   --| Next_Char to be set to the last character in Line_Buffer.
  8468.   --|
  8469.  
  8470.   --| Modifies
  8471.   --|
  8472.   --| Current_Column
  8473.   --| Current_Line
  8474.   --| Next_Char
  8475.   --| Line_Buffer
  8476.   --| Line_Buffer_Last
  8477.   --| Line_Buffer_Index
  8478.   --| End_Of_File_Reached
  8479.   --|
  8480.  
  8481.   ------------------------------------------------------------------
  8482.  
  8483.   procedure GET_NEXT_LINE;  --| gets next source file line to lex
  8484.  
  8485.   --| Requires
  8486.   --|
  8487.   --| This subprogram requires the source file to be open.
  8488.   --|
  8489.  
  8490.   --| Effects
  8491.   --|
  8492.   --| This subprogram gets next source line from input file.
  8493.   --| Sets Current_Column and Line_Buffer_Index to 1, and
  8494.   --| increments Current_Line.
  8495.   --| If the End of File is detected,
  8496.   --| End_Of_File_Reached is set true,
  8497.   --| End_Of_File_Token is set up,
  8498.   --| and Next_Char is set to End_Of_Line_Buffer.
  8499.   --|
  8500.  
  8501.   --| Modifies
  8502.   --|
  8503.   --| Current_Line
  8504.   --| End_Of_File_Reached
  8505.   --| End_Of_File_Token - only when the end of file is reached.
  8506.   --| Line_Buffer
  8507.   --| Line_Buffer_Last
  8508.   --|
  8509.  
  8510.   ------------------------------------------------------------------
  8511.  
  8512.   function LOOK_AHEAD( --| Return character n columns ahead
  8513.   --| in current in current line.
  8514.                       IN_COLUMNS_AHEAD :  --| Number of columns ahead to get
  8515.                       in HD.SOURCE_COLUMN --| return character from.
  8516.                       ) return CHARACTER; 
  8517.  
  8518.   --| Requires
  8519.   --|
  8520.   --| Line_Buffer
  8521.   --| Line_Buffer_Last
  8522.   --|
  8523.  
  8524.   --| Effects
  8525.   --|
  8526.   --| Return character In_Columns_Ahead in Line_Buffer.
  8527.   --| If this character is off the end of Line_Buffer,
  8528.   --| End_Of_Line_Buffer character is returned.
  8529.   --|
  8530.  
  8531.   ------------------------------------------------------------------
  8532.  
  8533.   procedure SET_CST_GRAM_SYM_VAL( --| Sets gram_sym_val for current
  8534.   --| token.
  8535.                                  IN_TOKEN_VALUE : in PT.TOKENRANGE); 
  8536.                                             --| value of token
  8537.  
  8538.   --| Effects
  8539.   --|
  8540.   --| This subprogram fills in gram_sym_val for the current token.
  8541.   --|
  8542.  
  8543.   ------------------------------------------------------------------
  8544.  
  8545.   procedure SET_CST_SOURCE_REP( --| Saves the symbol representation
  8546.   --| in the current token.
  8547.                                IN_STRING : in STRING); 
  8548.                                      --| string holding symbol.
  8549.  
  8550.   --| Effects
  8551.   --|
  8552.   --| This subprogram fills in lexed_token.symrep for the current token.
  8553.   --|
  8554.  
  8555.   ------------------------------------------------------------------
  8556.  
  8557.   procedure INITIALIZE_CST;  --| Sets lx_srcpos for current token.
  8558.  
  8559.   --| Requires
  8560.   --|
  8561.   --| This subprogram requires Current_Column and Current_Line.
  8562.   --|
  8563.  
  8564.   --| Effects
  8565.   --|
  8566.   --| This subprogram sets common fields in CST.
  8567.   --|
  8568.  
  8569.   ------------------------------------------------------------------
  8570.  
  8571.   procedure ADD_NEXT_CHAR_TO_SOURCE_REP; 
  8572.   --| appends Next_Char to growing
  8573.   --| source representation
  8574.  
  8575.   --| Requires
  8576.   --|
  8577.   --| Next_Char
  8578.   --|
  8579.  
  8580.   --| Effects
  8581.   --|
  8582.   --| This subprogram appends Next_Char to the growing source
  8583.   --| representation.
  8584.   --|
  8585.  
  8586.   --| Modifies
  8587.   --|
  8588.   --| Work_String
  8589.   --| Work_String_Length
  8590.   --|
  8591.  
  8592.   ------------------------------------------------------------------
  8593.  
  8594.   procedure CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  8595.   --| Issues an error message if
  8596.   --| consecutive underlines occur.
  8597.  
  8598.   --| Requires
  8599.   --|
  8600.   --| Work_String
  8601.   --| Work_String_Length
  8602.   --|
  8603.  
  8604.   --| Effects
  8605.   --|
  8606.   --| Issues an error message if consecutive underlines occur.
  8607.   --|
  8608.  
  8609.   ------------------------------------------------------------------
  8610.  
  8611.   procedure CHECK_FOR_TERMINAL_UNDERLINE; 
  8612.   --| Issues an error message if
  8613.   --| a terminal underline occurs.
  8614.  
  8615.   --| Requires
  8616.   --|
  8617.   --| Work_String
  8618.   --| Work_String_Length
  8619.   --|
  8620.  
  8621.   --| Effects
  8622.   --|
  8623.   --| This subprogram issues an error message if a terminal underline
  8624.   --| occurs.
  8625.  
  8626.   ------------------------------------------------------------------
  8627.  
  8628.   procedure SCAN_COMMENT;  --| Scans comments.
  8629.  
  8630.   --| Requires
  8631.   --|
  8632.   --| This subprogram requires an opened source file.
  8633.   --|
  8634.  
  8635.   --| Effects
  8636.   --|
  8637.   --| This subprogram scans the rest of a comment.
  8638.   --|
  8639.  
  8640.   --| Modifies
  8641.   --|
  8642.   --| CST
  8643.   --|
  8644.  
  8645.   ------------------------------------------------------------------
  8646.  
  8647.   procedure SCAN_IDENTIFIER_INCLUDING_RW; 
  8648.   --| Scans identifiers including
  8649.   --| reserved words
  8650.  
  8651.   --| Requires
  8652.   --|
  8653.   --| This subprogram requires an opened source file.
  8654.   --|
  8655.  
  8656.   --| Effects
  8657.   --|
  8658.   --| This subprogram scans the rest of the identifier,
  8659.   --| and determines if its a reserved word.
  8660.   --|
  8661.  
  8662.   --| Modifies
  8663.   --|
  8664.   --| CST
  8665.   --|
  8666.  
  8667.   ------------------------------------------------------------------
  8668.  
  8669.   procedure SCAN_EXPONENT;  --| Scans exponent field in
  8670.   --| appropriate numeric_literals
  8671.  
  8672.   --| Requires
  8673.   --|
  8674.   --| This subprogram requires an opened source file.
  8675.   --|
  8676.  
  8677.   --| Effects
  8678.   --|
  8679.   --| This subprogram scans the end of numeric_literals which
  8680.   --| contain exponents.
  8681.   --|
  8682.  
  8683.   --| Modifies
  8684.   --|
  8685.   --| Work_String
  8686.   --| Work_String_Length
  8687.   --|
  8688.  
  8689.   ------------------------------------------------------------------
  8690.  
  8691.   procedure SCAN_BASED_INTEGER( --| scans a based integer field of
  8692.   --| a numeric literal
  8693.                                IN_BASE_TO_USE :  --| the base to use for lexing.
  8694.                                in VALID_BASE_RANGE); 
  8695.  
  8696.   --| Requires
  8697.   --|
  8698.   --| This subprogram requires an opened source file.
  8699.  
  8700.   --| Effects
  8701.   --|
  8702.   --| This subprogram scans a based integer field in a numeric literal,
  8703.   --| verifying that is lexically correct.
  8704.   --|
  8705.  
  8706.   --| Modifies
  8707.   --|
  8708.   --| Work_String
  8709.   --| Work_String_Length
  8710.   --|
  8711.  
  8712.   --| Notes
  8713.   --|
  8714.   --| This subprogram and Scan_Integer are nearly identical.
  8715.   --| They are separate to save the overhead of:
  8716.   --|
  8717.   --| - passing a base in for decimal literals; and
  8718.   --|
  8719.   --| - distinguishing the extended digit 'E' from the exponent
  8720.   --| delimiter 'E'.
  8721.   --|
  8722.  
  8723.   ------------------------------------------------------------------
  8724.  
  8725.   procedure SCAN_INTEGER;  --| scans an integer field of
  8726.   --|  a numeric literal
  8727.  
  8728.   --| Requires
  8729.   --|
  8730.   --| This subprogram requires an opened source file.
  8731.   --| 
  8732.  
  8733.   --| Effects
  8734.   --| 
  8735.   --| This subprogram scans an integer field in a numeric literal,
  8736.   --| verifying it is lexically correct.
  8737.   --| 
  8738.  
  8739.   --| Modifies
  8740.   --|
  8741.   --| Work_String
  8742.   --| Work_String_Length
  8743.   --| 
  8744.  
  8745.   --| Notes
  8746.   --| 
  8747.   --| This subprogram and Scan_Based_Integer are nearly identical.
  8748.   --| They are separate to save the overhead of:
  8749.   --| 
  8750.   --| - passing a base in for decimal literals; and
  8751.   --| 
  8752.   --| - distinguishing the extended digit 'E' from the exponent
  8753.   --| delimiter 'E'.
  8754.   --| 
  8755.  
  8756.   ------------------------------------------------------------------
  8757.  
  8758.   procedure SCAN_NUMERIC_LITERAL;  --| Scans numbers
  8759.  
  8760.   --| Requires
  8761.   --|
  8762.   --| This subprogram requires an opened source file, and the
  8763.   --| Universal Arithmetic package to handle conversions.
  8764.   --|
  8765.  
  8766.   --| Effects
  8767.   --|
  8768.   --| This subprogram scans the rest of the numeric literal and converts
  8769.   --| it to internal universal number format.
  8770.   --|
  8771.  
  8772.   --| Modifies
  8773.   --|
  8774.   --| CST
  8775.   --|
  8776.  
  8777.   -------------------------------------------------------------------
  8778.  
  8779.   procedure SCAN_STRING_LITERAL;  --| Scans string literals
  8780.  
  8781.   --| Requires
  8782.   --| 
  8783.   --| This subprogram requires an opened source file.
  8784.   --| 
  8785.  
  8786.   --| Effects
  8787.   --| 
  8788.   --| This subprogram scans the rest of the string literal.
  8789.   --| 
  8790.  
  8791.   --| Modifies
  8792.   --|
  8793.   --| CST
  8794.   --|
  8795.  
  8796.   ------------------------------------------------------------------
  8797.   -- Subprogram Bodies Global to Package Lex
  8798.   -- (declared in package specification).
  8799.   ------------------------------------------------------------------
  8800.  
  8801.   procedure INITIALIZATION is 
  8802.  
  8803.   begin
  8804.  
  8805.     END_OF_FILE_REACHED := FALSE; 
  8806.  
  8807.     -- forces Get_Next_Char to call Get_Next_Line
  8808.     CURRENT_COLUMN := LINE_BUFFER_LAST + 1; 
  8809.     GET_NEXT_CHAR; 
  8810.  
  8811.   end INITIALIZATION; 
  8812.  
  8813.   ------------------------------------------------------------------
  8814.  
  8815.   function GETNEXTNONCOMMENTTOKEN return PD.PARSESTACKELEMENT is separate; 
  8816.  
  8817.   ------------------------------------------------------------------
  8818.  
  8819.   function GETNEXTSOURCETOKEN return PD.PARSESTACKELEMENT is 
  8820.  
  8821.   --| Overview
  8822.   --|
  8823.   --| Note the following LRM Sections:
  8824.   --|     LRM Section 2.2  - Lexical Elements, Separators and Delimiters
  8825.   --|     LRM Section 2.2  - Notes
  8826.   --|     LRM Section 2.5  - Character Literals
  8827.   --|     LRM Section 2.7  - Comments
  8828.   --|     LRM Section 2.7  - Note
  8829.   --|     LRM Section 2.10 - Allowed Replacements of Characters
  8830.   --|
  8831.  
  8832.   begin
  8833.  
  8834.     if (END_OF_FILE_REACHED) then 
  8835.       CST := END_OF_FILE_TOKEN; 
  8836.     else 
  8837.  
  8838.       -- this else terminates
  8839.       -- shortly before the return statement
  8840.  
  8841.       -- This loop performs the following functions:
  8842.       --
  8843.       -- 1) It scans for and ignores repeated separators.
  8844.       -- 2) It reports illegal characters between tokens.
  8845.       -- 3) It identifies and lexes tokens.
  8846.       --    Delimiters and character literals are handled
  8847.       --    by code inside this loop.
  8848.       --    Complex tokens: identifiers, string and
  8849.       --    numeric literals are lexed by called
  8850.       --    subprograms.
  8851.       -- 4) It recognizes and processes comments that
  8852.       --    occur before the first token found.  Comments
  8853.       --    after tokens are processed by a separate loop
  8854.       --    after this one.
  8855.       SCAN_FOR_TOKEN : loop
  8856.         case NEXT_CHAR is 
  8857.           when UPPER_CASE_LETTER | LOWER_CASE_LETTER => 
  8858.             INITIALIZE_CST; 
  8859.             SCAN_IDENTIFIER_INCLUDING_RW; 
  8860.             exit SCAN_FOR_TOKEN; 
  8861.  
  8862.           -- Next_Char already updated
  8863.           when DIGIT => 
  8864.             INITIALIZE_CST; 
  8865.             SCAN_NUMERIC_LITERAL; 
  8866.             exit SCAN_FOR_TOKEN; 
  8867.  
  8868.           -- Next_Char already updated
  8869.           when ASCII.QUOTATION | 
  8870.  
  8871.           -- '"'
  8872.           ASCII.PERCENT => 
  8873.  
  8874.             -- '%'
  8875.             INITIALIZE_CST; 
  8876.             SCAN_STRING_LITERAL; 
  8877.             exit SCAN_FOR_TOKEN; 
  8878.  
  8879.           -- Next_Char already updated
  8880.           when ''' => 
  8881.             INITIALIZE_CST; 
  8882.             if ((GC."="(PREVIOUS_TOKEN_VALUE, PT.IDENTIFIERTOKENVALUE)) or else 
  8883.               (GC."="(PREVIOUS_TOKEN_VALUE, PT.ALLTOKENVALUE)) or else (GC."="(
  8884.               PREVIOUS_TOKEN_VALUE, PT.STRINGTOKENVALUE)) or else (GC."="(
  8885.               PREVIOUS_TOKEN_VALUE, PT.CHARACTERTOKENVALUE)) or else (GC."="(
  8886.               PREVIOUS_TOKEN_VALUE, PT.RIGHTPAREN_TOKENVALUE))) then 
  8887.  
  8888.               --  CST is a ' delimiter
  8889.               SET_CST_GRAM_SYM_VAL(PT.APOSTROPHE_TOKENVALUE); 
  8890.             elsif (LOOK_AHEAD(2) = ''') then 
  8891.  
  8892.               -- CST is a character literal
  8893.               CST.GRAM_SYM_VAL := PT.CHARACTERTOKENVALUE; 
  8894.               GET_NEXT_CHAR; 
  8895.               if not (NEXT_CHAR in GRAPHIC_CHARACTER) then 
  8896.  
  8897.                 -- flag as an error
  8898.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(
  8899.                   CHARACTER'POS(NEXT_CHAR))
  8900.  
  8901.                 -- convert to string
  8902.                 , LEM.CHARACTER_IS_NON_GRAPHIC); 
  8903.               end if; 
  8904.  
  8905.               -- save the source representation.
  8906.               SET_CST_SOURCE_REP("'" & NEXT_CHAR); 
  8907.               GET_NEXT_CHAR; 
  8908.  
  8909.             -- pass by the closing
  8910.             -- single quote
  8911.             else 
  8912.  
  8913.               -- flag single quote use as illegal
  8914.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  8915.                 ILLEGAL_USE_OF_SINGLE_QUOTE); 
  8916.  
  8917.               --  assume CST is a ' delimiter;
  8918.               SET_CST_GRAM_SYM_VAL(PT.APOSTROPHE_TOKENVALUE); 
  8919.             end if; 
  8920.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8921.  
  8922.  
  8923.           when ASCII.AMPERSAND => 
  8924.  
  8925.             -- '&'
  8926.             INITIALIZE_CST; 
  8927.             SET_CST_GRAM_SYM_VAL(PT.AMPERSAND_TOKENVALUE); 
  8928.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8929.  
  8930.           when '(' => 
  8931.             INITIALIZE_CST; 
  8932.             SET_CST_GRAM_SYM_VAL(PT.LEFTPAREN_TOKENVALUE); 
  8933.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8934.  
  8935.           when ')' => 
  8936.             INITIALIZE_CST; 
  8937.             SET_CST_GRAM_SYM_VAL(PT.RIGHTPAREN_TOKENVALUE); 
  8938.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8939.  
  8940.           when '*' => 
  8941.             INITIALIZE_CST; 
  8942.             GET_NEXT_CHAR; 
  8943.             case NEXT_CHAR is 
  8944.               when '*' => 
  8945.                 SET_CST_GRAM_SYM_VAL(PD.EXPONENTIATION_TOKENVALUE); 
  8946.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8947.               when others => 
  8948.                 SET_CST_GRAM_SYM_VAL(PT.STAR_TOKENVALUE); 
  8949.                 exit SCAN_FOR_TOKEN; 
  8950.  
  8951.             -- Next_Char already updated
  8952.             end case; 
  8953.  
  8954.           when '+' => 
  8955.             INITIALIZE_CST; 
  8956.             SET_CST_GRAM_SYM_VAL(PT.PLUS_TOKENVALUE); 
  8957.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8958.  
  8959.           when ',' => 
  8960.             INITIALIZE_CST; 
  8961.             SET_CST_GRAM_SYM_VAL(PT.COMMA_TOKENVALUE); 
  8962.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8963.  
  8964.           when '-' => 
  8965.  
  8966.             -- Minus_Sign or Hyphen
  8967.             INITIALIZE_CST; 
  8968.             GET_NEXT_CHAR; 
  8969.             case NEXT_CHAR is 
  8970.               when '-' => 
  8971.  
  8972.                 -- Minus_Sign or Hyphen
  8973.                 -- two hyphens indicate a comment
  8974.                 SET_CST_GRAM_SYM_VAL(PT.COMMENT_TOKENVALUE); 
  8975.                 SCAN_COMMENT; 
  8976.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8977.               when others => 
  8978.                 SET_CST_GRAM_SYM_VAL(PT.MINUS_TOKENVALUE); 
  8979.                 exit SCAN_FOR_TOKEN; 
  8980.  
  8981.             -- Next_Char already updated
  8982.             end case; 
  8983.  
  8984.           when '.' => 
  8985.             INITIALIZE_CST; 
  8986.             GET_NEXT_CHAR; 
  8987.             case NEXT_CHAR is 
  8988.               when '.' => 
  8989.                 SET_CST_GRAM_SYM_VAL(PT.DOTDOT_TOKENVALUE); 
  8990.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  8991.               when others => 
  8992.                 SET_CST_GRAM_SYM_VAL(PT.DOT_TOKENVALUE); 
  8993.                 exit SCAN_FOR_TOKEN; 
  8994.  
  8995.             -- Next_Char already updated
  8996.             end case; 
  8997.  
  8998.           when '/' => 
  8999.             INITIALIZE_CST; 
  9000.             GET_NEXT_CHAR; 
  9001.             case NEXT_CHAR is 
  9002.               when '=' => 
  9003.                 SET_CST_GRAM_SYM_VAL(PD.NOTEQUALS_TOKENVALUE); 
  9004.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9005.               when others => 
  9006.                 SET_CST_GRAM_SYM_VAL(PT.SLASH_TOKENVALUE); 
  9007.                 exit SCAN_FOR_TOKEN; 
  9008.  
  9009.             -- Next_Char already updated
  9010.             end case; 
  9011.  
  9012.           when ASCII.COLON => 
  9013.  
  9014.             -- ':'
  9015.             INITIALIZE_CST; 
  9016.             GET_NEXT_CHAR; 
  9017.             case NEXT_CHAR is 
  9018.               when '=' => 
  9019.                 SET_CST_GRAM_SYM_VAL(PD.ASSIGNMENT_TOKENVALUE); 
  9020.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9021.               when others => 
  9022.                 SET_CST_GRAM_SYM_VAL(PT.COLON_TOKENVALUE); 
  9023.                 exit SCAN_FOR_TOKEN; 
  9024.  
  9025.             -- Next_Char already updated
  9026.             end case; 
  9027.  
  9028.           when ASCII.SEMICOLON => 
  9029.  
  9030.             -- ';'
  9031.             INITIALIZE_CST; 
  9032.             SET_CST_GRAM_SYM_VAL(PT.SEMICOLON_TOKENVALUE); 
  9033.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9034.  
  9035.           when '<' => 
  9036.             INITIALIZE_CST; 
  9037.             GET_NEXT_CHAR; 
  9038.             case NEXT_CHAR is 
  9039.               when '=' => 
  9040.                 SET_CST_GRAM_SYM_VAL(PT.LTEQ_TOKENVALUE); 
  9041.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9042.               when '<' => 
  9043.                 SET_CST_GRAM_SYM_VAL(PD.STARTLABEL_TOKENVALUE); 
  9044.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9045.               when '>' => 
  9046.                 SET_CST_GRAM_SYM_VAL(PD.BOX_TOKENVALUE); 
  9047.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9048.               when others => 
  9049.                 SET_CST_GRAM_SYM_VAL(PT.LT_TOKENVALUE); 
  9050.                 exit SCAN_FOR_TOKEN; 
  9051.  
  9052.             -- Next_Char already updated
  9053.             end case; 
  9054.  
  9055.           when '=' => 
  9056.             INITIALIZE_CST; 
  9057.             GET_NEXT_CHAR; 
  9058.             case NEXT_CHAR is 
  9059.               when '>' => 
  9060.                 SET_CST_GRAM_SYM_VAL(PD.ARROW_TOKENVALUE); 
  9061.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9062.               when others => 
  9063.                 SET_CST_GRAM_SYM_VAL(PT.EQ_TOKENVALUE); 
  9064.                 exit SCAN_FOR_TOKEN; 
  9065.  
  9066.             -- Next_Char already updated
  9067.             end case; 
  9068.  
  9069.           when '>' => 
  9070.             INITIALIZE_CST; 
  9071.             GET_NEXT_CHAR; 
  9072.             case NEXT_CHAR is 
  9073.               when '=' => 
  9074.                 SET_CST_GRAM_SYM_VAL(PT.GTEQ_TOKENVALUE); 
  9075.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9076.               when '>' => 
  9077.                 SET_CST_GRAM_SYM_VAL(PD.ENDLABEL_TOKENVALUE); 
  9078.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9079.               when others => 
  9080.                 SET_CST_GRAM_SYM_VAL(PT.GT_TOKENVALUE); 
  9081.                 exit SCAN_FOR_TOKEN; 
  9082.  
  9083.             -- Next_Char already updated
  9084.             end case; 
  9085.  
  9086.           when ASCII.BAR | 
  9087.  
  9088.           -- '|'
  9089.           ASCII.EXCLAM => 
  9090.  
  9091.             -- '!'
  9092.             -- vertical bar and its alternative
  9093.             INITIALIZE_CST; 
  9094.             SET_CST_GRAM_SYM_VAL(PT.BAR_TOKENVALUE); 
  9095.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  9096.  
  9097.           when ASCII.HT => 
  9098.  
  9099.             -- Horizontal Tab
  9100.             -- a lexical unit separator - skip it.
  9101.             -- position Current_Column properly. This is done
  9102.             --     here to save the cost of a test on every
  9103.             --     character in Get_Next_Char.
  9104.             CURRENT_COLUMN := HD.FINDTABCOLUMN(CURRENT_COLUMN); 
  9105.  
  9106.           when ' ' | END_OF_LINE_CHARACTER => 
  9107.  
  9108.             -- rest of the lexical unit separators
  9109.             if (END_OF_FILE_REACHED) then 
  9110.               return END_OF_FILE_TOKEN; 
  9111.             end if; 
  9112.  
  9113.  
  9114.           when ASCII.UNDERLINE => 
  9115.  
  9116.             -- '_'
  9117.             case LOOK_AHEAD(1) is 
  9118.               when UPPER_CASE_LETTER | LOWER_CASE_LETTER => 
  9119.  
  9120.                 -- flag illegal leading under line
  9121.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9122.                   LEADING_UNDERLINE); 
  9123.                 INITIALIZE_CST; 
  9124.                 SCAN_IDENTIFIER_INCLUDING_RW; 
  9125.                 exit SCAN_FOR_TOKEN; 
  9126.  
  9127.               -- Next_Char already updated
  9128.               when DIGIT => 
  9129.  
  9130.                 -- flag illegal leading under line
  9131.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9132.                   LEADING_UNDERLINE); 
  9133.                 INITIALIZE_CST; 
  9134.                 SCAN_NUMERIC_LITERAL; 
  9135.                 exit SCAN_FOR_TOKEN; 
  9136.  
  9137.               -- Next_Char already updated
  9138.               when others => 
  9139.  
  9140.                 -- flag illegal character for start
  9141.                 -- of token
  9142.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "_", LEM.
  9143.                   CHARACTER_CAN_NOT_START_TOKEN); 
  9144.             end case; 
  9145.  
  9146.  
  9147.           when ASCII.SHARP | 
  9148.  
  9149.           -- '#'
  9150.           ASCII.DOLLAR | 
  9151.  
  9152.           -- '$'
  9153.           ASCII.QUERY | 
  9154.  
  9155.           -- '?'
  9156.           ASCII.AT_SIGN | 
  9157.  
  9158.           -- '@'
  9159.           ASCII.L_BRACKET | 
  9160.  
  9161.           -- '['
  9162.           ASCII.BACK_SLASH | 
  9163.  
  9164.           -- '\'
  9165.           ASCII.R_BRACKET | 
  9166.  
  9167.           -- ']'
  9168.           ASCII.CIRCUMFLEX | 
  9169.  
  9170.           -- '^'
  9171.           ASCII.GRAVE | 
  9172.  
  9173.           -- '`'
  9174.           ASCII.L_BRACE | 
  9175.  
  9176.           -- '{'
  9177.           ASCII.R_BRACE | 
  9178.  
  9179.           -- '}'
  9180.           ASCII.TILDE => 
  9181.  
  9182.             -- '~'
  9183.             -- flag illegal character for start of token
  9184.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  9185.  
  9186.             -- convert to string
  9187.             , LEM.CHARACTER_CAN_NOT_START_TOKEN); 
  9188.  
  9189.           when ASCII.NUL .. 
  9190.  
  9191.           -- Null to
  9192.           ASCII.BS | 
  9193.  
  9194.           --  Back Space
  9195.           ASCII.SO .. 
  9196.  
  9197.           -- Shift Out to
  9198.           ASCII.US | 
  9199.  
  9200.           --  Unit Separator
  9201.           ASCII.DEL => 
  9202.  
  9203.             -- Delete
  9204.             -- flag as non-graphic ASCII control character
  9205.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(
  9206.               CHARACTER'POS(NEXT_CHAR))
  9207.  
  9208.             -- convert to string
  9209.             , LEM.CHARACTER_IS_NON_GRAPHIC); 
  9210.  
  9211.           when others => 
  9212.  
  9213.             -- should never happen due to 's
  9214.             -- definition of CHARACTER. flag as illegal anyhow
  9215.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9216.               CHARACTER_IS_NON_ASCII); 
  9217.         end case; 
  9218.  
  9219.         GET_NEXT_CHAR; 
  9220.  
  9221.         -- for next time through loop.
  9222.         if (EXIT_AFTER_GET_NEXT_CHAR) then 
  9223.           EXIT_AFTER_GET_NEXT_CHAR := FALSE; 
  9224.           exit SCAN_FOR_TOKEN; 
  9225.         end if; 
  9226.  
  9227.       end loop SCAN_FOR_TOKEN; 
  9228.  
  9229.       -- Next_Char already updated
  9230.       PREVIOUS_TOKEN_VALUE := CST.GRAM_SYM_VAL; 
  9231.  
  9232.     -- for resolving T'('c')
  9233.     end if; 
  9234.  
  9235.     -- (End_Of_File_Reached)
  9236.     return CST; 
  9237.  
  9238.   -- On leaving: object Next_Char should contain character
  9239.   -- to scan on next call of this function.
  9240.   end GETNEXTSOURCETOKEN; 
  9241.  
  9242.   ------------------------------------------------------------------
  9243.   -- Subprogram Bodies Local to Package Lex
  9244.   ------------------------------------------------------------------
  9245.  
  9246.   procedure GET_NEXT_CHAR is 
  9247.  
  9248.   begin
  9249.  
  9250.     --| Algorithm
  9251.     --| 
  9252.     --| Source File is scanned returning each character until the
  9253.     --| end of the file is found. Proper column positioning for a tab
  9254.     --| character is done in GetNextSourceToken for speed.
  9255.     --| 
  9256.  
  9257.     -- The End_Of_Line_Character that Get_Next_Line
  9258.     -- inserts needs to be seen by the scanning
  9259.     -- case statements to terminate tokens correctly.
  9260.     CURRENT_COLUMN := CURRENT_COLUMN + 1; 
  9261.     LINE_BUFFER_INDEX := LINE_BUFFER_INDEX + 1; 
  9262.     NEXT_CHAR := LINE_BUFFER(LINE_BUFFER_INDEX); 
  9263.  
  9264.     if (LINE_BUFFER_INDEX > LINE_BUFFER_LAST) then 
  9265.       GET_NEXT_LINE; 
  9266.  
  9267.       -- Current_Column and Line_Buffer_Index are handled there.
  9268.       NEXT_CHAR := LINE_BUFFER(LINE_BUFFER_INDEX); 
  9269.     end if; 
  9270.  
  9271.   end GET_NEXT_CHAR;  -- procedure
  9272.  
  9273.   ------------------------------------------------------------------
  9274.  
  9275.   procedure GET_NEXT_LINE is 
  9276.  
  9277.   begin
  9278.  
  9279.     -- Get next source line from CURRENT_INPUT. Update column and
  9280.     -- line counts
  9281.     CURRENT_COLUMN := 1; 
  9282.     LINE_BUFFER_INDEX := 1; 
  9283.  
  9284.     IGNORE_NULL_LINE : loop
  9285.  
  9286.       -- do NOT move next statement out of loop
  9287.       if (CURRENT_LINE < HD.SOURCE_LINE'LAST) then 
  9288.         begin -- block
  9289.           CURRENT_LINE := HD.SOURCE_LINE -- type conversion
  9290.           (TEXT_IO.LINE(FILE => TEXT_IO.CURRENT_INPUT)); 
  9291.           if (CURRENT_LINE >= HD.SOURCE_LINE'LAST) then 
  9292.             raise CONSTRAINT_ERROR; 
  9293.           end if; 
  9294.         exception
  9295.           when others => 
  9296.             CURRENT_LINE := HD.SOURCE_LINE'LAST; 
  9297.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, HD.SOURCE_LINE'
  9298.               IMAGE(HD.SOURCE_LINE'LAST), LEM.SOURCE_LINE_MAXIMUM_EXCEEDED); 
  9299.         end;  -- block
  9300.       end if; 
  9301.       TEXT_IO.GET_LINE(FILE => TEXT_IO.CURRENT_INPUT, ITEM => LINE_BUFFER(1 .. (
  9302.         LINE_BUFFER'LAST - 1)), LAST => LINE_BUFFER_LAST); 
  9303.       -- flag a line that is too long as an error
  9304.       if (LINE_BUFFER_LAST >= LINE_BUFFER'LAST - 1) and then (TEXT_IO.
  9305.         END_OF_LINE(FILE => TEXT_IO.CURRENT_INPUT)) then 
  9306.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9307.           SOURCE_LINE_TOO_LONG); 
  9308.       end if; 
  9309.       exit IGNORE_NULL_LINEwhen (LINE_BUFFER_LAST /= (LINE_BUFFER'FIRST - 1)); 
  9310.     end loop IGNORE_NULL_LINE; 
  9311.  
  9312.     LINE_BUFFER_LAST := LINE_BUFFER_LAST + 1; 
  9313.     LINE_BUFFER(LINE_BUFFER_LAST) := END_OF_LINE_BUFFER; 
  9314.  
  9315.   exception
  9316.   -- when end of file is reached
  9317.     when TEXT_IO.END_ERROR => 
  9318.     -- save that state for GetNextSourceToken
  9319.       END_OF_FILE_REACHED := TRUE; 
  9320.  
  9321.       -- update column and line counts
  9322.       LINE_BUFFER_LAST := 1; 
  9323.       LINE_BUFFER(LINE_BUFFER_LAST) := END_OF_LINE_BUFFER; 
  9324.       LINE_BUFFER_INDEX := 1; 
  9325.       CURRENT_COLUMN := 1; 
  9326.       -- Current_Line is ok.
  9327.       -- Last call to GET_LINE advanced it one.
  9328.  
  9329.       -- set the value of End_Of_File_Token
  9330.       -- the discriminants were set up by the object declaration
  9331.       END_OF_FILE_TOKEN.GRAM_SYM_VAL := PT.EOF_TOKENVALUE; 
  9332.       END_OF_FILE_TOKEN.LEXED_TOKEN := (SRCPOS_LINE => CURRENT_LINE, 
  9333.         SRCPOS_COLUMN => CURRENT_COLUMN, TEXT => PD.NULL_SOURCE_TEXT); 
  9334.  
  9335.   end GET_NEXT_LINE; 
  9336.  
  9337.   ------------------------------------------------------------------
  9338.   function LOOK_AHEAD(IN_COLUMNS_AHEAD : in HD.SOURCE_COLUMN) return CHARACTER
  9339.     is 
  9340.  
  9341.     ------------------------------------------------------------------
  9342.     -- Declarations for subprogram Look_Ahead
  9343.     ------------------------------------------------------------------
  9344.     POSITION_TO_TRY : INTEGER := INTEGER
  9345.  
  9346.     --type conversion
  9347.     (LINE_BUFFER_INDEX + IN_COLUMNS_AHEAD); 
  9348.  
  9349.   ------------------------------------------------------------------
  9350.   begin
  9351.  
  9352.   -- if request is past the end of line
  9353.     if (POSITION_TO_TRY > INTEGER(LINE_BUFFER_LAST)) then 
  9354.     -- type conversion
  9355.     -- return the end_of_line character
  9356.       return END_OF_LINE_BUFFER; 
  9357.     else 
  9358.     -- else return the requested character
  9359.       return LINE_BUFFER(POSITION_TO_TRY); 
  9360.     end if; 
  9361.  
  9362.   end LOOK_AHEAD; 
  9363.  
  9364.   -- function
  9365.  
  9366.   ------------------------------------------------------------------
  9367.   procedure SET_CST_GRAM_SYM_VAL(IN_TOKEN_VALUE : in PT.TOKENRANGE) is 
  9368.  
  9369.   begin
  9370.  
  9371.     CST.GRAM_SYM_VAL := IN_TOKEN_VALUE; 
  9372.  
  9373.   end SET_CST_GRAM_SYM_VAL; 
  9374.  
  9375.   ----------------------------------------------------------------------
  9376.   procedure SET_CST_SOURCE_REP(IN_STRING : in STRING) is 
  9377.  
  9378.   begin
  9379.  
  9380.   -- store the representation
  9381.     PD.PUT_SOURCE_TEXT(IN_STRING, CST.LEXED_TOKEN.TEXT); 
  9382.  
  9383.   end SET_CST_SOURCE_REP; 
  9384.  
  9385.   ------------------------------------------------------------------
  9386.   procedure INITIALIZE_CST is 
  9387.  
  9388.   begin
  9389.  
  9390.   -- Set up discriminants, and source position properly
  9391.   -- Set other CST fields to null values
  9392.     CST := CST_INITIALIZER; 
  9393.  
  9394.     CST.LEXED_TOKEN := (SRCPOS_LINE => CURRENT_LINE, SRCPOS_COLUMN => 
  9395.       CURRENT_COLUMN, TEXT => PD.NULL_SOURCE_TEXT); 
  9396.  
  9397.   end INITIALIZE_CST; 
  9398.  
  9399.   ------------------------------------------------------------------
  9400.   procedure ADD_NEXT_CHAR_TO_SOURCE_REP is 
  9401.  
  9402.   begin
  9403.  
  9404.   -- append the character to growing source representation
  9405.     WORK_STRING_LENGTH := WORK_STRING_LENGTH + 1; 
  9406.     WORK_STRING(WORK_STRING_LENGTH) := NEXT_CHAR; 
  9407.  
  9408.   end ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9409.  
  9410.   ------------------------------------------------------------------
  9411.   procedure CHECK_FOR_CONSECUTIVE_UNDERLINES is 
  9412.  
  9413.   begin
  9414.  
  9415.   -- flag consecutive underlines as an error (leading
  9416.   -- underlines are handled in GetNextSourceToken).
  9417.     if (WORK_STRING(WORK_STRING_LENGTH) = ASCII.UNDERLINE) then 
  9418.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9419.         CONSECUTIVE_UNDERLINES); 
  9420.     end if; 
  9421.  
  9422.   end CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  9423.  
  9424.   -- procedure
  9425.  
  9426.   ------------------------------------------------------------------
  9427.   procedure CHECK_FOR_TERMINAL_UNDERLINE is 
  9428.  
  9429.   begin
  9430.  
  9431.   -- flag a trailing underline as an error.
  9432.   -- trailing underlines are saved for the same
  9433.   -- reason as leading ones.
  9434.   -- See comment in GetNextSourceToken.
  9435.  
  9436.     if (WORK_STRING(WORK_STRING_LENGTH) = ASCII.UNDERLINE)
  9437.     -- check the preceeding character
  9438.     then 
  9439.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.TERMINAL_UNDERLINE); 
  9440.     end if; 
  9441.  
  9442.   end CHECK_FOR_TERMINAL_UNDERLINE; 
  9443.  
  9444.   ------------------------------------------------------------------
  9445.   procedure SCAN_COMMENT is 
  9446.  
  9447.   --| Overview
  9448.   --|
  9449.   --| Note the following LRM Sections:
  9450.   --|     LRM Section 2.7  - Comments
  9451.   --|     LRM Section 2.7  - Note
  9452.   --|
  9453.   begin
  9454.  
  9455.   -- get to the beginning of the comment
  9456.     GET_NEXT_CHAR; 
  9457.     SET_CST_SOURCE_REP(LINE_BUFFER(LINE_BUFFER_INDEX .. LINE_BUFFER_LAST - 1)); 
  9458.     -- subtract 1 so that the carridge return is not also returned.
  9459.  
  9460.     LINE_BUFFER_INDEX := LINE_BUFFER_LAST + 1; 
  9461.     -- force next call to Get_Next_Char to call Get_Next_Line
  9462.  
  9463.   end SCAN_COMMENT; 
  9464.  
  9465.   ------------------------------------------------------------------
  9466.   procedure SCAN_IDENTIFIER_INCLUDING_RW is 
  9467.  
  9468.   --| Overview
  9469.   --|
  9470.   --| Note the following LRM Sections:
  9471.   --|     LRM Section 2.3 - Identifiers
  9472.   --|     LRM Section 2.3 - Note
  9473.   --|     LRM Section 2.9 - Reserved Words
  9474.   --|     LRM Section 2.9 - Notes
  9475.   --|
  9476.  
  9477.   ------------------------------------------------------------------
  9478.   begin
  9479.  
  9480.     WORK_STRING_LENGTH := 0; 
  9481.  
  9482.     -- scan source file for rest of token
  9483.     -- note that first character of the token is stored first
  9484.     SCAN_FOR_IDENTIFIER_INCLUDING_RW : loop
  9485.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9486.  
  9487.       -- set up for processing next characte
  9488.       GET_NEXT_CHAR; 
  9489.  
  9490.       case NEXT_CHAR is 
  9491.         when UPPER_CASE_LETTER | LOWER_CASE_LETTER | DIGIT => 
  9492.         -- action is at start of next loop cycle
  9493.           null; 
  9494.         when ASCII.UNDERLINE =>  -- '_'
  9495.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  9496.         when others => 
  9497.           CHECK_FOR_TERMINAL_UNDERLINE; 
  9498.  
  9499.           -- token is terminated by any character except letter
  9500.           --     digit, or underline;
  9501.           exit SCAN_FOR_IDENTIFIER_INCLUDING_RW;  -- this loop
  9502.       end case; 
  9503.  
  9504.     end loop SCAN_FOR_IDENTIFIER_INCLUDING_RW; 
  9505.  
  9506.     -- find out what kind of token it is
  9507.     LEX_IDENTIFIER_TOKEN_VALUE.FIND(IN_IDENTIFIER => WORK_STRING(1 .. 
  9508.       WORK_STRING_LENGTH), OUT_TOKEN_VALUE => CST.GRAM_SYM_VAL); 
  9509.  
  9510.     -- store the source representation of the token found
  9511.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  9512.  
  9513.   end SCAN_IDENTIFIER_INCLUDING_RW; 
  9514.  
  9515.   ------------------------------------------------------------------
  9516.   procedure SCAN_EXPONENT is 
  9517.  
  9518.   --| Overview
  9519.   --|
  9520.   --| Note the following LRM Sections:
  9521.   --|     LRM Section 2.4.1 - Decimal Literals
  9522.   --|     LRM Section 2.4.1 - Notes
  9523.   --|     LRM Section 2.4.2 - Based Literals
  9524.   --|
  9525.   begin
  9526.  
  9527.   -- Check for missing 'E' or 'e',
  9528.   -- and for existence of the exponent
  9529.     case NEXT_CHAR is 
  9530.       when 'E' | 'e' => 
  9531.         null;  -- normal case
  9532.       when others => 
  9533.         return;  -- no exponent to process
  9534.     end case; 
  9535.     -- add first character to growing literal
  9536.     ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9537.  
  9538.  
  9539.     -- scan source file for rest of the exponent
  9540.     -- verify that next character is legal for an integer field
  9541.     GET_NEXT_CHAR; 
  9542.  
  9543.     case NEXT_CHAR is 
  9544.       when '+' => 
  9545.       -- add sign character to growing literal
  9546.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9547.  
  9548.         GET_NEXT_CHAR; 
  9549.       when '-' =>  -- Minus_Sign
  9550.         if not (SEEN_RADIX_POINT) then 
  9551.         -- flag negative exponent as illegal in an integer
  9552.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9553.             NEGATIVE_EXPONENT_ILLEGAL_IN_INTEGER); 
  9554.         end if; 
  9555.  
  9556.         -- add sign character to growing literal
  9557.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9558.  
  9559.         GET_NEXT_CHAR; 
  9560.       when others => 
  9561.         null; 
  9562.     end case; 
  9563.  
  9564.     case NEXT_CHAR is 
  9565.       when DIGIT => 
  9566.       -- scan the integer field of the exponent
  9567.         SCAN_INTEGER; 
  9568.       when ASCII.UNDERLINE =>  -- '_'
  9569.         if (LOOK_AHEAD(1) in DIGIT) then 
  9570.         -- flag illegal leading under line
  9571.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.LEADING_UNDERLINE
  9572.             ); 
  9573.           -- scan the integer field of the exponent
  9574.           SCAN_INTEGER; 
  9575.         else 
  9576.         -- issue error message that integer field is missing
  9577.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9578.             EXPONENT_MISSING_INTEGER_FIELD); 
  9579.         end if; 
  9580.       when others => 
  9581.       -- issue an error message that integer field is missing
  9582.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9583.           EXPONENT_MISSING_INTEGER_FIELD); 
  9584.     end case; 
  9585.  
  9586.   end SCAN_EXPONENT; 
  9587.  
  9588.   ------------------------------------------------------------------
  9589.   procedure SCAN_BASED_INTEGER(IN_BASE_TO_USE : in VALID_BASE_RANGE) is 
  9590.  
  9591.     --| Overview
  9592.     --|
  9593.     --| Note the following LRM Sections:
  9594.     --|     LRM Section 2.4   - Numeric Literals
  9595.     --|     LRM Section 2.4.2 - Based Literals
  9596.     --|
  9597.  
  9598.     ------------------------------------------------------------------
  9599.     -- Declarations for Procedure Scan_Based_Integer
  9600.     ------------------------------------------------------------------
  9601.     BAD       : constant GC.PARSERINTEGER := GC.PARSERINTEGER'LAST; 
  9602.  
  9603.     --| an integer value greater than 15 to use as a flag to indicate
  9604.     --| illegal values.
  9605.     TRANSFORM : constant array(CHARACTER) of GC.PARSERINTEGER := 
  9606.  
  9607.     -------- ( nul,  soh,  stx,  etx,     eot,  enq,  ack,  bel,
  9608.     (BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9609.  
  9610.     --------   bs,   ht,   lf,   vt,      ff,   cr,   so,   si,
  9611.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9612.  
  9613.     --------   dle,  dc1,  dc2,  dc3,     dc4,  nak,  syn,  etb,
  9614.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9615.  
  9616.     --------   can,  em,   sub,  esc,     fs,   gs,   rs,   us,
  9617.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9618.  
  9619.     --------   ' ',  '!',  '"',  '#',     '$',  '%',  '&',  ''',
  9620.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9621.  
  9622.     --------   '(',  ')',  '*',  '+',     ',',  '-',  '.',  '/',
  9623.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9624.  
  9625.     --------   '0',  '1',  '2',  '3',     '4',  '5',  '6',  '7',
  9626.     0, 1, 2, 3, 4, 5, 6, 7, 
  9627.  
  9628.     --------   '8',  '9',  ':',  ';',     '<',  '=',  '>',  '?',
  9629.     8, 9, BAD, BAD, BAD, BAD, BAD, BAD, 
  9630.  
  9631.     --------   '@',  'A',  'B',  'C',     'D',  'E',  'F',  'G',
  9632.     BAD, 10, 11, 12, 13, 14, 15, BAD, 
  9633.  
  9634.     --------   'H',  'I',  'J',  'K',     'L',  'M',  'N',  'O',
  9635.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9636.  
  9637.     --------   'P',  'Q',  'R',  'S',     'T',  'U',  'V',  'W',
  9638.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9639.  
  9640.     --------   'X',  'Y',  'Z',  '[',     '\',  ']',  '^',  '_',
  9641.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9642.  
  9643.     --------   '`',  'a',  'b',  'c',     'd',  'e',  'f',  'g',
  9644.     BAD, 10, 11, 12, 13, 14, 15, BAD, 
  9645.  
  9646.     --------   'h',  'i',  'j',  'k',     'l',  'm',  'n',  'o',
  9647.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9648.  
  9649.     --------   'p',  'q',  'r',  's',     't',  'u',  'v',  'w',
  9650.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  9651.  
  9652.     --------   'x',  'y',  'z',  '{',     '|',  '}',  '~',   del);
  9653.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD); 
  9654.  
  9655.   --| used to transform a character value to an integer value for
  9656.   --| purpose of checking that a digit is within the legal range
  9657.   --| for the base passed in via In_Base_To_Use.
  9658.  
  9659.   ------------------------------------------------------------------
  9660.   begin
  9661.  
  9662.   -- check that first character, if not an under line,
  9663.   -- is a valid digit for base being used.
  9664.     if (NEXT_CHAR /= ASCII.UNDERLINE) and then (TRANSFORM(NEXT_CHAR) >= 
  9665.       IN_BASE_TO_USE) then 
  9666.     -- flag digit as invalid for base
  9667.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  9668.                                   -- convert to string
  9669.       , LEM.DIGIT_INVALID_FOR_BASE); 
  9670.     end if; 
  9671.  
  9672.     -- scan source file for rest of the field
  9673.     -- note that first character of the field is stored first
  9674.     SCAN_FOR_BASED_INTEGER : loop
  9675.  
  9676.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9677.  
  9678.       -- set up for processing next character
  9679.       GET_NEXT_CHAR; 
  9680.  
  9681.       case NEXT_CHAR is 
  9682.         when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  9683.         -- check if Next_Char is in valid base range
  9684.           if (TRANSFORM(NEXT_CHAR) >= IN_BASE_TO_USE) then 
  9685.           -- flag digit as invalid for base
  9686.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  9687.                                               -- convert to string
  9688.             , LEM.DIGIT_INVALID_FOR_BASE); 
  9689.           end if; 
  9690.           -- rest of action is at start of next loop cycle
  9691.         when ASCII.UNDERLINE =>  -- '_'
  9692.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  9693.         when others => 
  9694.           CHECK_FOR_TERMINAL_UNDERLINE; 
  9695.           -- field is terminated by any character except
  9696.           -- extended digit (letters a to f and digits),
  9697.           -- or underline
  9698.           exit SCAN_FOR_BASED_INTEGER;  -- this loop
  9699.       end case; 
  9700.  
  9701.     end loop SCAN_FOR_BASED_INTEGER; 
  9702.     -- Next_Char already updated
  9703.  
  9704.   end SCAN_BASED_INTEGER; 
  9705.  
  9706.   ------------------------------------------------------------------
  9707.   procedure SCAN_INTEGER is 
  9708.  
  9709.   --| Overview
  9710.   --|
  9711.   --| Note the following LRM Sections:
  9712.   --|     LRM Section 2.4   - Numeric Literals
  9713.   --|     LRM Section 2.4.1 - Decimal Literals
  9714.   --|     LRM Section 2.4.1 - Notes
  9715.   --|
  9716.   begin
  9717.  
  9718.   -- scan source file for rest of the field
  9719.   -- note that first character of the field is stored first
  9720.     SCAN_FOR_INTEGER : loop
  9721.  
  9722.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9723.  
  9724.       -- set up for processing next character
  9725.       GET_NEXT_CHAR; 
  9726.  
  9727.       case NEXT_CHAR is 
  9728.         when DIGIT => 
  9729.         -- rest of action is at start of next loop cycle
  9730.           null; 
  9731.         when ASCII.UNDERLINE =>  -- '_'
  9732.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  9733.         when others => 
  9734.           CHECK_FOR_TERMINAL_UNDERLINE; 
  9735.  
  9736.           -- field is terminated by any character except
  9737.           --     digit, or underline
  9738.           exit SCAN_FOR_INTEGER;  -- this loop
  9739.       end case; 
  9740.  
  9741.     end loop SCAN_FOR_INTEGER;  -- Next_Char already updated
  9742.  
  9743.   end SCAN_INTEGER; 
  9744.  
  9745.   ------------------------------------------------------------------
  9746.   procedure SCAN_NUMERIC_LITERAL is 
  9747.  
  9748.     --| Overview
  9749.     --|
  9750.     --| Note the following LRM Sections:
  9751.     --|     LRM Section 2.4   - Numeric Literals
  9752.     --|     LRM Section 2.4.1 - Decimal Literals
  9753.     --|     LRM Section 2.4.1 - Notes
  9754.     --|     LRM Section 2.4.2 - Based Literals
  9755.     --|     LRM Section 2.10  - Allowed Replacements of Characters
  9756.     --|
  9757.  
  9758.     ------------------------------------------------------------------
  9759.     -- Declarations for Scan_Numeric_Literal
  9760.     ------------------------------------------------------------------
  9761.     BASED_LITERAL_DELIMITER : CHARACTER; 
  9762.  
  9763.     --| holds value of first based_literal delimeter:
  9764.     --| ASCII.COLON (':') or ASCII.SHARP ('#');
  9765.     --| so the second one can be checked to be identical.
  9766.     BASE_BEING_USED         : GC.PARSERINTEGER; 
  9767.  
  9768.   --| base value to be passed to Scan_Based_Literal.
  9769.  
  9770.   ------------------------------------------------------------------
  9771.   begin
  9772.  
  9773.     CST.GRAM_SYM_VAL := PT.NUMERICTOKENVALUE; 
  9774.  
  9775.     WORK_STRING_LENGTH := 0; 
  9776.     -- also used by sub-scanners called from this subprogram.
  9777.  
  9778.     -- Scan first field
  9779.     SCAN_INTEGER; 
  9780.  
  9781.     -- Now, scan rest of literal dependent on what Next_char is
  9782.     case NEXT_CHAR is 
  9783.  
  9784.     -- have a decimal_literal
  9785.       when '.' => 
  9786.         if (LOOK_AHEAD(1) = '.') then 
  9787.         -- next token is a range double delimiter.
  9788.         -- finished with numeric_literal.
  9789.           SEEN_RADIX_POINT := FALSE;  -- have an integer_literal
  9790.           -- already set_up for next scanner,
  9791.           -- no call to Get_Next_Char.
  9792.         else 
  9793.           SEEN_RADIX_POINT := TRUE; 
  9794.           ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9795.           GET_NEXT_CHAR; 
  9796.           case NEXT_CHAR is 
  9797.             when DIGIT => 
  9798.               SCAN_INTEGER; 
  9799.               -- check and flag multiple radix points
  9800.               while (NEXT_CHAR = '.') and then (LOOK_AHEAD(1) in DIGIT) loop
  9801.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9802.                   TOO_MANY_RADIX_POINTS); 
  9803.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9804.                 GET_NEXT_CHAR; 
  9805.                 SCAN_INTEGER; 
  9806.               end loop; 
  9807.             when ASCII.UNDERLINE =>  -- '_'
  9808.             -- flag illegal leading under line
  9809.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9810.                 LEADING_UNDERLINE); 
  9811.               SCAN_INTEGER; 
  9812.               -- not flagging an integer consisting of a
  9813.               -- single underline as a trailing radix
  9814.               -- point case.  Check and flag multiple radix
  9815.               -- points.
  9816.               while (NEXT_CHAR = '.') and then (LOOK_AHEAD(1) in DIGIT) loop
  9817.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9818.                   TOO_MANY_RADIX_POINTS); 
  9819.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9820.                 GET_NEXT_CHAR; 
  9821.                 SCAN_INTEGER; 
  9822.               end loop; 
  9823.             when others => 
  9824.             -- flag trailing radix point as an error
  9825.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9826.                 DIGIT_NEEDED_AFTER_RADIX_POINT); 
  9827.           end case; 
  9828.  
  9829.           SCAN_EXPONENT;  -- check for and process exponent
  9830.  
  9831.         end if; 
  9832.  
  9833.         -- have a based_literal
  9834.       when ASCII.SHARP |  -- '#'
  9835.       ASCII.COLON =>  -- ':'
  9836.         BASED_LITERAL_DELIMITER := NEXT_CHAR; 
  9837.         BASE_BEING_USED := GC.PARSERINTEGER'VALUE(WORK_STRING(1 .. 
  9838.           WORK_STRING_LENGTH)); 
  9839.         if (BASE_BEING_USEDnot  in VALID_BASE_RANGE) then 
  9840.         -- flag illegal bases as errors
  9841.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, WORK_STRING(1 .. 
  9842.             WORK_STRING_LENGTH), LEM.BASE_OUT_OF_LEGAL_RANGE_USE_16); 
  9843.           BASE_BEING_USED := 16; 
  9844.           -- we use the maximum base to pass all the
  9845.           -- extended_digits as legal.
  9846.         end if; 
  9847.  
  9848.         ADD_NEXT_CHAR_TO_SOURCE_REP;  -- save the base delimiter
  9849.         GET_NEXT_CHAR; 
  9850.  
  9851.         case NEXT_CHAR is 
  9852.           when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  9853.             SCAN_BASED_INTEGER(BASE_BEING_USED); 
  9854.           when ASCII.UNDERLINE =>  -- '_'
  9855.           -- flag illegal leading under line
  9856.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9857.               LEADING_UNDERLINE); 
  9858.             -- not flagging an integer consisting of a single
  9859.             -- under line as a trailing radix point case.
  9860.             SCAN_BASED_INTEGER(BASE_BEING_USED); 
  9861.           when '.' => 
  9862.           -- flag leading radix point as an error
  9863.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9864.               DIGIT_NEEDED_BEFORE_RADIX_POINT); 
  9865.           when ASCII.SHARP |  -- '#'
  9866.           ASCII.COLON =>  -- ':'
  9867.           -- flag missing field as an error
  9868.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9869.               NO_INTEGER_IN_BASED_NUMBER); 
  9870.  
  9871.             -- based_literal_delimiter_mismatch handled in
  9872.             -- next case statement.
  9873.           when others => 
  9874.           -- flag missing field as an error
  9875.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9876.               NO_INTEGER_IN_BASED_NUMBER); 
  9877.         end case; 
  9878.  
  9879.         case NEXT_CHAR is 
  9880.           when '.' => 
  9881.             SEEN_RADIX_POINT := TRUE;  -- have a real_literal
  9882.             ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9883.  
  9884.             GET_NEXT_CHAR; 
  9885.             case NEXT_CHAR is 
  9886.               when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  9887.                 SCAN_BASED_INTEGER(BASE_BEING_USED); 
  9888.                 -- check and flag multiple radix points
  9889.                 while (NEXT_CHAR = '.') and then ((LOOK_AHEAD(1) in DIGIT) or (
  9890.                   LOOK_AHEAD(1) in 'A' .. 'F') or (LOOK_AHEAD(1) in 'a' .. 'f'))
  9891.                   loop
  9892.                   LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9893.                     TOO_MANY_RADIX_POINTS); 
  9894.                   ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9895.                   GET_NEXT_CHAR; 
  9896.                   SCAN_BASED_INTEGER(BASE_BEING_USED); 
  9897.                 end loop; 
  9898.               when ASCII.UNDERLINE =>  -- '_'
  9899.               -- flag illegal leading under lined
  9900.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9901.                   LEADING_UNDERLINE); 
  9902.                 -- not flagging an integer consisting of
  9903.                 -- a single underline as a trailing
  9904.                 -- radix point case.
  9905.                 SCAN_BASED_INTEGER(BASE_BEING_USED); 
  9906.               when others => 
  9907.               -- flag trailing radix point as an error
  9908.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9909.                   DIGIT_NEEDED_AFTER_RADIX_POINT); 
  9910.             end case; 
  9911.  
  9912.             case NEXT_CHAR is 
  9913.               when ASCII.SHARP |  -- '#'
  9914.               ASCII.COLON =>  -- ':'
  9915.  
  9916.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9917.                 -- save the base delimiter
  9918.  
  9919.                 if (NEXT_CHAR /= BASED_LITERAL_DELIMITER) then 
  9920.                 -- flag based_literal delimiter
  9921.                 -- mismatch as an error
  9922.                   LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "Opener: " & 
  9923.                     BASED_LITERAL_DELIMITER & " Closer: " & NEXT_CHAR, LEM.
  9924.                     BASED_LITERAL_DELIMITER_MISMATCH); 
  9925.                 end if; 
  9926.  
  9927.                 GET_NEXT_CHAR;  -- after base delimiter
  9928.                 -- check for and process exponent
  9929.                 SCAN_EXPONENT; 
  9930.  
  9931.               when others => 
  9932.               -- flag missing second
  9933.               -- based_literal delimiter as an error
  9934.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9935.                   MISSING_SECOND_BASED_LITERAL_DELIMITER); 
  9936.             end case; 
  9937.  
  9938.           when ASCII.SHARP |  -- '#'
  9939.           ASCII.COLON =>  -- ':'
  9940.           -- have an integer_literal
  9941.             SEEN_RADIX_POINT := FALSE; 
  9942.             -- save the base delimiter
  9943.             ADD_NEXT_CHAR_TO_SOURCE_REP; 
  9944.  
  9945.             if (NEXT_CHAR /= BASED_LITERAL_DELIMITER) then 
  9946.             -- flag based_literal delimiter mismatch error
  9947.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "Opener: " & 
  9948.                 BASED_LITERAL_DELIMITER & " Closer: " & NEXT_CHAR, LEM.
  9949.                 BASED_LITERAL_DELIMITER_MISMATCH); 
  9950.             end if; 
  9951.  
  9952.             GET_NEXT_CHAR;  -- get character after base delimiter
  9953.             SCAN_EXPONENT;  -- check for and process exponent
  9954.  
  9955.           when others => 
  9956.           -- assume an integer_literal
  9957.             SEEN_RADIX_POINT := FALSE; 
  9958.             -- flag missing second
  9959.             -- based_literal delimiter as an error
  9960.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9961.               MISSING_SECOND_BASED_LITERAL_DELIMITER); 
  9962.         end case; 
  9963.  
  9964.         --we have an integer_literal
  9965.       when others => 
  9966.         SEEN_RADIX_POINT := FALSE;  -- have an integer_literal
  9967.         SCAN_EXPONENT;  -- check for and process exponent
  9968.     end case; 
  9969.  
  9970.     -- one last error check
  9971.     if (NEXT_CHAR in UPPER_CASE_LETTER) or (NEXT_CHAR in LOWER_CASE_LETTER)
  9972.       then 
  9973.     -- flag missing space between numeric_literal and
  9974.     -- identifier (including RW) as an error.
  9975.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  9976.         SPACE_MUST_SEPARATE_NUM_AND_IDS); 
  9977.     end if; 
  9978.  
  9979.     -- now store the source representation of the token found.
  9980.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  9981.  
  9982.   end SCAN_NUMERIC_LITERAL; 
  9983.  
  9984.   ------------------------------------------------------------------
  9985.   procedure SCAN_STRING_LITERAL is 
  9986.  
  9987.     --| Overview
  9988.     --|
  9989.     --| Note the following LRM Sections:
  9990.     --|     LRM Section 2.6  - String Literals
  9991.     --|     LRM Section 2.6  - Note
  9992.     --|     LRM Section 2.10 - Allowed Replacements of Characters
  9993.     --|
  9994.     STRING_DELIMITER : CHARACTER := NEXT_CHAR; 
  9995.  
  9996.   begin
  9997.  
  9998.     WORK_STRING_LENGTH := 0; 
  9999.  
  10000.     CST.GRAM_SYM_VAL := PT.STRINGTOKENVALUE; 
  10001.  
  10002.     -- scan until matching string delimiter or end of line is found
  10003.     SCAN_FOR_STRING : loop
  10004.       GET_NEXT_CHAR; 
  10005.  
  10006.       if (NEXT_CHAR = STRING_DELIMITER) then 
  10007.         GET_NEXT_CHAR; 
  10008.         if (NEXT_CHAR = STRING_DELIMITER) then 
  10009.         -- add one string delimiter to growing string
  10010.           ADD_NEXT_CHAR_TO_SOURCE_REP; 
  10011.         else  -- string is ended
  10012.           exit SCAN_FOR_STRING; 
  10013.         end if; 
  10014.       elsif (NEXT_CHAR in GRAPHIC_CHARACTER) then 
  10015.       -- add graphic character to growing string
  10016.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  10017.       elsif (NEXT_CHAR in END_OF_LINE_CHARACTER) then 
  10018.       -- string is ended. flag the error.
  10019.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  10020.           NO_ENDING_STRING_DELIMITER); 
  10021.         exit SCAN_FOR_STRING; 
  10022.       else  -- flag non-graphic characters as errors
  10023.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(CHARACTER
  10024.           'POS(NEXT_CHAR))
  10025.         -- convert to string
  10026.         , LEM.ONLY_GRAPHIC_CHARACTERS_IN_STRINGS); 
  10027.       end if; 
  10028.  
  10029.     end loop SCAN_FOR_STRING;  -- Next_Char already updated
  10030.  
  10031.     -- now store the source representation found without the
  10032.     -- string delimiters
  10033.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  10034.  
  10035.     return; 
  10036.  
  10037.   end SCAN_STRING_LITERAL; 
  10038.  
  10039.   ------------------------------------------------------------------
  10040.   function SHOW_CURRENT_LINE return HD.SOURCE_LINE is 
  10041.  
  10042.   --| Overview
  10043.   --| Return current line number
  10044.   begin
  10045.  
  10046.     return CURRENT_LINE; 
  10047.  
  10048.   end SHOW_CURRENT_LINE; 
  10049.  
  10050. ------------------------------------------------------------------
  10051. end LEX; 
  10052.  
  10053. ----------------------------------------------------------------------
  10054. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10055. --lexidval.bdy
  10056. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10057.  
  10058.  
  10059.  
  10060. ----------------------------------------------------------------------
  10061.  
  10062. with GRAMMAR_CONSTANTS;  -- constants from the parser generator
  10063. use GRAMMAR_CONSTANTS; 
  10064. --| to gain visibility on ParserInteger's operations
  10065.  
  10066. package body LEX_IDENTIFIER_TOKEN_VALUE is 
  10067.  
  10068. --| Overview
  10069. --|
  10070. --| This perfect hash algorithm taken from
  10071. --|  "A Perfect Hash Function for Ada Reserved Words"
  10072. --|  by David Wolverton, published in Ada Letters Jul-Aug 1984
  10073. --|
  10074.   use PARSETABLES; 
  10075.   package PT renames PARSETABLES; 
  10076.  
  10077.   ------------------------------------------------------------------
  10078.   -- Declarations Local to Package Lex_Identifier_Token_Value
  10079.   ------------------------------------------------------------------
  10080.  
  10081.   subtype HASHRANGE is INTEGER; 
  10082.   subtype HASHIDENTIFIERSUBRANGE is HASHRANGE range 0 .. 70; 
  10083.  
  10084.   type XLATEARRAY is array(CHARACTER) of HASHRANGE; 
  10085.   XLATE : constant XLATEARRAY := XLATEARRAY'('A' => 0, 'B' => 49, 'C' => 0, 'D'
  10086.     =>  -7, 'E' =>  -20, 'F' => 18, 'G' =>  -2, 'H' =>  -38, 'I' => 33, 'J' => 
  10087.     0, 'K' =>  -9, 'L' => 9, 'M' => 29, 'N' =>  -9, 'O' => 6, 'P' => 26, 'Q' => 
  10088.     0, 'R' => 8, 'S' => 1, 'T' => 1, 'U' =>  -9, 'V' => 0, 'W' => 56, 'X' =>  -
  10089.     28, 'Y' => 11, 'Z' => 0, others => 0); 
  10090.  
  10091.   type HASHTABLEARRAY is array(HASHIDENTIFIERSUBRANGE) of PARSETABLES.TOKENRANGE
  10092.     ; 
  10093.   --| Mapping from hash value into the token values.
  10094.  
  10095.   HASHTABLE  : constant HASHTABLEARRAY := HASHTABLEARRAY'(40 => 2,  -- ABORT
  10096.   6 => 3,  -- ABS
  10097.   37 => 4,  -- ACCEPT
  10098.   43 => 5,  -- ACCESS
  10099.   34 => 6,  -- ALL
  10100.   22 => 7,  -- AND
  10101.   16 => 8,  -- ARRAY
  10102.   3 => 9,  -- AT
  10103.   61 => 10,  -- BEGIN
  10104.   70 => 11,  -- BODY
  10105.   20 => 12,  -- CASE
  10106.   35 => 13,  -- CONSTANT
  10107.   14 => 14,  -- DECLARE
  10108.   9 => 15,  -- DELAY
  10109.   36 => 16,  -- DELTA
  10110.   38 => 17,  -- DIGITS
  10111.   7 => 18,  -- DO
  10112.   0 => 19,  -- ELSE
  10113.   19 => 20,  -- ELSIF
  10114.   2 => 21,  -- END
  10115.   30 => 22,  -- ENTRY
  10116.   8 => 23,  -- EXCEPTION
  10117.   1 => 24,  -- EXIT
  10118.   57 => 25,  -- FOR
  10119.   45 => 26,  -- FUNCTION
  10120.   21 => 27,  -- GENERIC
  10121.   46 => 28,  -- GOTO
  10122.   69 => 29,  -- IF
  10123.   42 => 30,  -- IN
  10124.   52 => 31,  -- IS
  10125.   17 => 32,  -- LIMITED
  10126.   67 => 33,  -- LOOP
  10127.   53 => 34,  -- MOD
  10128.   58 => 35,  -- NEW
  10129.   23 => 36,  -- NOT
  10130.   26 => 37,  -- NULL
  10131.   54 => 38,  -- OF
  10132.   44 => 39,  -- OR
  10133.   47 => 40,  -- OTHERS
  10134.   50 => 41,  -- OUT
  10135.   25 => 42,  -- PACKAGE
  10136.   56 => 43,  -- PRAGMA
  10137.   51 => 44,  -- PRIVATE
  10138.   49 => 45,  -- PROCEDURE
  10139.   29 => 46,  -- RAISE
  10140.   5 => 47,  -- RANGE
  10141.   41 => 48,  -- RECORD
  10142.   48 => 49,  -- REM
  10143.   24 => 50,  -- RENAMES
  10144.   39 => 51,  -- RETURN
  10145.   31 => 52,  -- REVERSE
  10146.   12 => 53,  -- SELECT
  10147.   27 => 54,  -- SEPARATE
  10148.   18 => 55,  -- SUBTYPE
  10149.   32 => 56,  -- TASK
  10150.   28 => 57,  -- TERMINATE
  10151.   4 => 58,  -- THEN
  10152.   15 => 59,  -- TYPE
  10153.   10 => 60,  -- USE
  10154.   59 => 61,  -- WHEN
  10155.   63 => 62,  -- WHILE
  10156.   60 => 63,  -- WITH
  10157.   11 => 64,  -- XOR
  10158.   others => PT.IDENTIFIERTOKENVALUE); 
  10159.  
  10160.   --| These are used to convert lower to upper case.
  10161.   CONVERT    : array(CHARACTER) of CHARACTER; 
  10162.   DIFFERENCE : constant := CHARACTER'POS('a') - CHARACTER'POS('A'); 
  10163.  
  10164.   ------------------------------------------------------------------
  10165.   -- Subprogram Specifications Local to
  10166.   -- Package Lex_Identifier_Token_Value
  10167.   ------------------------------------------------------------------
  10168.  
  10169.   function NORMALIZETOUPPERCASE( --| normalize SYMREP to upper case
  10170.                                 IN_STRING : in STRING) return STRING; 
  10171.  
  10172.   ------------------------------------------------------------------
  10173.   -- Subprogram Bodies Global to Package Lex_Identifier_Token_Value
  10174.   ------------------------------------------------------------------
  10175.  
  10176.   procedure FIND(IN_IDENTIFIER   : in STRING; 
  10177.                  OUT_TOKEN_VALUE : out PARSETABLES.TOKENRANGE) is 
  10178.  
  10179.     subtype ID_STRING is STRING(IN_IDENTIFIER'range ); 
  10180.  
  10181.     IN_IDENTIFIER_NORMALIZED : ID_STRING; 
  10182.  
  10183.     LENGTH                   : HASHRANGE := IN_IDENTIFIER_NORMALIZED'LENGTH; 
  10184.     --| Length of string
  10185.  
  10186.     FIRST                    : HASHRANGE := IN_IDENTIFIER_NORMALIZED'FIRST; 
  10187.     --| Lower bound
  10188.  
  10189.     FIRSTCHAR, LASTCHAR      : CHARACTER; 
  10190.     --| First and last characters
  10191.  
  10192.     SECONDTOLASTCHAR         : CHARACTER; 
  10193.     --| Second to last character
  10194.  
  10195.     SECONDTOLAST             : HASHRANGE; 
  10196.     --| Alphabetic position of 2nd to last char.
  10197.  
  10198.     HASHVALUE                : HASHRANGE; 
  10199.     --| Perfect hash value.
  10200.  
  10201.     TOKENVALUE               : PARSETABLES.GRAMMARSYMBOLRANGE; 
  10202.  
  10203.   begin
  10204.     IN_IDENTIFIER_NORMALIZED := NORMALIZETOUPPERCASE(IN_IDENTIFIER); 
  10205.  
  10206.     -- Assume In_Identifier is a plain identifier.
  10207.     OUT_TOKEN_VALUE := PT.IDENTIFIERTOKENVALUE; 
  10208.  
  10209.     if (LENGTH <= 1) or else (LENGTH >= 10) then 
  10210.  
  10211.       -- Couldn't be a reserved word.
  10212.       return; 
  10213.     else 
  10214.       FIRSTCHAR := IN_IDENTIFIER_NORMALIZED(FIRST); 
  10215.       LASTCHAR := IN_IDENTIFIER_NORMALIZED((FIRST + LENGTH) - 1); 
  10216.       SECONDTOLASTCHAR := IN_IDENTIFIER_NORMALIZED((FIRST + LENGTH) - 2); 
  10217.       SECONDTOLAST := CHARACTER'POS(SECONDTOLASTCHAR) - CHARACTER'POS('A'); 
  10218.       HASHVALUE := XLATE(FIRSTCHAR) + XLATE(LASTCHAR) + 2*SECONDTOLAST + LENGTH
  10219.         ; 
  10220.     end if; 
  10221.  
  10222.     if HASHVALUE in HASHIDENTIFIERSUBRANGE then 
  10223.  
  10224.       -- index and see if it matches a reserved word value.
  10225.       -- if so, then compare the string to the reserved word text.
  10226.       TOKENVALUE := PARSETABLES.GRAMMARSYMBOLRANGE(HASHTABLE(HASHVALUE)); 
  10227.  
  10228.       -- conversion
  10229.       if TOKENVALUE /= PT.IDENTIFIERTOKENVALUE then 
  10230.         if (IN_IDENTIFIER_NORMALIZED = PT.GET_GRAMMAR_SYMBOL(TOKENVALUE)) then 
  10231.           OUT_TOKEN_VALUE := PT.TOKENRANGE(TOKENVALUE); 
  10232.  
  10233.         -- conversion
  10234.         end if; 
  10235.       end if; 
  10236.     end if; 
  10237.   end FIND; 
  10238.  
  10239.   ------------------------------------------------------------------
  10240.   -- Subprogram Bodies Local to
  10241.   -- Package Lex_Identifier_Token_Value
  10242.   ------------------------------------------------------------------
  10243.  
  10244.   function NORMALIZETOUPPERCASE( --| normalize SYMREP to upper case
  10245.                                 IN_STRING : in STRING) return STRING is 
  10246.  
  10247.     OUTSTRING : STRING(IN_STRING'range ); 
  10248.  
  10249.   begin
  10250.     for I in IN_STRING'range loop
  10251.       OUTSTRING(I) := CONVERT(IN_STRING(I)); 
  10252.     end loop; 
  10253.     return OUTSTRING; 
  10254.   end NORMALIZETOUPPERCASE; 
  10255.  
  10256.   ------------------------------------------------------------------
  10257.  
  10258. begin
  10259.  
  10260.   --| Initialize the conversion array for lower to upper case conversion
  10261.   for I in CHARACTER loop
  10262.     case I is 
  10263.       when 'a' .. 'z' => 
  10264.         CONVERT(I) := CHARACTER'VAL(CHARACTER'POS(I) - DIFFERENCE); 
  10265.       when others => 
  10266.         CONVERT(I) := I; 
  10267.     end case; 
  10268.   end loop; 
  10269.  
  10270. ------------------------------------------------------------------
  10271. end LEX_IDENTIFIER_TOKEN_VALUE; 
  10272.  
  10273. ----------------------------------------------------------------------
  10274. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10275. --pdecls.bdy
  10276. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10277.  
  10278.  
  10279. ----------------------------------------------------------------------
  10280.  
  10281. package body PARSERDECLARATIONS is 
  10282.  
  10283.   subtype DUMP_STRING_RANGE_PLUS_ZERO is STANDARD.NATURAL range 0 .. 4000; 
  10284.  
  10285.   DUMP_STRING        : STRING(1 .. DUMP_STRING_RANGE_PLUS_ZERO'LAST); 
  10286.  
  10287.   DUMP_STRING_LENGTH : DUMP_STRING_RANGE_PLUS_ZERO; 
  10288.   -- must be set to zero before each use.
  10289.  
  10290.   ------------------------------------------------------------------
  10291.   -- Subprograms Local to Package ParserDeclarations
  10292.   ------------------------------------------------------------------
  10293.  
  10294.   procedure APPEND_TO_DUMP_STRING( --| Add In_String to Dump_String
  10295.                                   IN_STRING : in STRING --| String to append
  10296.                                   ); 
  10297.  
  10298.   --| Effects
  10299.  
  10300.   --| This subprogram appends In_String to the package Body global
  10301.   --| Dump_String.
  10302.  
  10303.   --| Modifies
  10304.   --|
  10305.   --| Dump_String
  10306.   --| Dump_String_Length
  10307.  
  10308.   ------------------------------------------------------------------
  10309.   -- Subprogram Bodies Global to Package ParserDeclarations
  10310.   -- (declared in package specification).
  10311.   ------------------------------------------------------------------
  10312.  
  10313.   function GET_SOURCE_TEXT(IN_SOURCE_TEXT : in SOURCE_TEXT) return STRING is 
  10314.  
  10315.   begin
  10316.  
  10317.     if (IN_SOURCE_TEXT = NULL_SOURCE_TEXT) then 
  10318.       return ""; 
  10319.     else 
  10320.       return IN_SOURCE_TEXT.all; 
  10321.     end if; 
  10322.  
  10323.   end GET_SOURCE_TEXT; 
  10324.  
  10325.   ------------------------------------------------------------------
  10326.  
  10327.   procedure PUT_SOURCE_TEXT(IN_STRING          : in STRING; 
  10328.                             IN_OUT_SOURCE_TEXT : in out SOURCE_TEXT) is 
  10329.  
  10330.   begin
  10331.  
  10332.     IN_OUT_SOURCE_TEXT := new STRING'(IN_STRING); 
  10333.  
  10334.   end PUT_SOURCE_TEXT; 
  10335.  
  10336.   ------------------------------------------------------------------
  10337.  
  10338.   function DUMP_PARSE_STACK_ELEMENT(IN_PSE : in PARSESTACKELEMENT) return STRING
  10339.     is 
  10340.  
  10341.   --| Notes
  10342.  
  10343.   --| Abbreviations used in this compilation unit
  10344.   --|
  10345.   --| PSE : ParseStackElement
  10346.   --|
  10347.  
  10348.   begin
  10349.  
  10350.     DUMP_STRING_LENGTH := 0; 
  10351.  
  10352.     -- Output data common to all ParseStackElements
  10353.     APPEND_TO_DUMP_STRING("Element Kind:  " & PT.GET_GRAMMAR_SYMBOL(IN_PSE.
  10354.       GRAM_SYM_VAL) & " "
  10355.  
  10356.     -- give extra space to help highlight delimiters
  10357.     ); 
  10358.  
  10359.     -- Output data common to all lexed_tokens
  10360.     APPEND_TO_DUMP_STRING(" Token - Line: " & HD.SOURCE_LINE'IMAGE(IN_PSE.
  10361.       LEXED_TOKEN.SRCPOS_LINE) & " Column: " & HD.SOURCE_COLUMN'IMAGE(IN_PSE.
  10362.       LEXED_TOKEN.SRCPOS_COLUMN)); 
  10363.  
  10364.     APPEND_TO_DUMP_STRING(" Text: %" & GET_SOURCE_TEXT(IN_PSE.LEXED_TOKEN.TEXT)
  10365.       & "%"); 
  10366.  
  10367.     -- Finally, finish up the message
  10368.     APPEND_TO_DUMP_STRING(""); 
  10369.  
  10370.     return DUMP_STRING(1 .. DUMP_STRING_LENGTH); 
  10371.  
  10372.   end DUMP_PARSE_STACK_ELEMENT; 
  10373.  
  10374.   ------------------------------------------------------------------
  10375.   -- Subprogram Bodies Local to Package ParserDeclarations
  10376.   ------------------------------------------------------------------
  10377.  
  10378.   procedure APPEND_TO_DUMP_STRING(IN_STRING : in STRING --| String to append
  10379.                                   ) is 
  10380.  
  10381.   begin
  10382.  
  10383.     DUMP_STRING((DUMP_STRING_LENGTH + 1) .. (DUMP_STRING_LENGTH + IN_STRING'LAST
  10384.       )) := IN_STRING; 
  10385.  
  10386.     DUMP_STRING_LENGTH := DUMP_STRING_LENGTH + IN_STRING'LENGTH; 
  10387.  
  10388.   end APPEND_TO_DUMP_STRING; 
  10389.  
  10390.   ------------------------------------------------------------------
  10391.  
  10392. end PARSERDECLARATIONS; 
  10393.  
  10394. ----------------------------------------------------------------------
  10395. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10396. --parsestk.spc
  10397. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10398.  
  10399. -- $Source: /nosc/work/parser/RCS/ParseStk.spc,v $
  10400. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:33:03 $ -- $Author: carol $
  10401.  
  10402. ----------------------------------------------------------------------
  10403.  
  10404. with PARSERDECLARATIONS;  -- declarations for the Parser
  10405. use PARSERDECLARATIONS; 
  10406.  
  10407. package PARSESTACK is  --| Elements awaiting parsing
  10408.  
  10409. --| Overview
  10410. --|
  10411. --| The ParseStack used by the parser.
  10412. --|
  10413. --| This data structure has the following sets of operations:
  10414. --|
  10415. --| 1) A set that add and delete elements.  This set can
  10416. --| raise the exceptions: UnderFlow and OverFlow.
  10417. --| The set includes:
  10418. --|
  10419. --|     Pop
  10420. --|     Push
  10421. --|     Reduce
  10422. --|
  10423. --| 2) A function that returns the number of elements in the
  10424. --| data structure. This set raises no exceptions.
  10425. --| The set includes:
  10426. --|
  10427. --|     Length
  10428.  
  10429. --|
  10430. --| Notes
  10431. --|
  10432. --|     Under some implementations the exception
  10433. --| ParserDeclarations.MemoryOverflow could be raised.
  10434. --|
  10435.  
  10436.   package PD renames PARSERDECLARATIONS; 
  10437.  
  10438.   ------------------------------------------------------------------
  10439.   -- Declarations Global to Package ParseStack
  10440.   ------------------------------------------------------------------
  10441.  
  10442.   OVERFLOW  : exception; 
  10443.   --| raised if no more space in stack.
  10444.   UNDERFLOW : exception; 
  10445.   --| raised if no more elements in stack.
  10446.  
  10447.   ------------------------------------------------------------------
  10448.  
  10449.   procedure PUSH( --| Adds new top element to stack
  10450.                  ELEMENT : in PD.PARSESTACKELEMENT);  --| element to add
  10451.  
  10452.   --| Raises
  10453.   --|
  10454.   --| OverFlow - no more space in stack.
  10455.  
  10456.   --| Effects
  10457.   --|
  10458.   --| This subprogram adds an element to the top of the stack.
  10459.   --|
  10460.  
  10461.   ------------------------------------------------------------------
  10462.  
  10463.   function POP --| Removes top element in stack
  10464.   return PD.PARSESTACKELEMENT; 
  10465.  
  10466.   --| Raises
  10467.   --|
  10468.   --| UnderFlow - no more elements in stack.
  10469.  
  10470.   --| Effects
  10471.   --|
  10472.   --| This subprogram obtains the element at the top of the stack.
  10473.   --|
  10474.  
  10475.   ------------------------------------------------------------------
  10476.  
  10477.   function LENGTH --| Returns the number of
  10478.   --| elements in the stack
  10479.   return PD.STATEPARSESTACKSINDEX; 
  10480.  
  10481.   --| Effects
  10482.   --|
  10483.   --| This subprogram returns the number of elements in the stack.
  10484.   --|
  10485.  
  10486.   ----------------------------------------------------------------------
  10487.  
  10488.   procedure REDUCE( --| Pops and discards top n elements on
  10489.   --| the stack.
  10490.                    TOPN : in PD.STATEPARSESTACKSINDEX); 
  10491.   --| Number of elements to pop.
  10492.  
  10493.   --| Raises
  10494.   --|
  10495.   --| Underflow - no more elements in stack.
  10496.  
  10497.   --| Effects
  10498.   --|
  10499.   --| Pops and discards top N elements on the stack.
  10500.   --| If TopN is greater than the number of elements in the stack,
  10501.   --| Underflow is raised.
  10502.   --| This subprogram is used by the parser to reduce the stack during
  10503.   --| a reduce action.
  10504.   --| This stack reduction could be done with a for loop and
  10505.   --| the Pop subprogram at a considerable cost in execution time.
  10506.   --|
  10507.  
  10508.   ----------------------------------------------------------------------
  10509.  
  10510. end PARSESTACK; 
  10511.  
  10512. ----------------------------------------------------------------------
  10513. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10514. --statestk.spc
  10515. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10516.  
  10517. -- $Source: /nosc/work/parser/RCS/StateStk.spc,v $
  10518. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:43:44 $ -- $Author: carol $
  10519.  
  10520. ----------------------------------------------------------------------
  10521.  
  10522. with PARSERDECLARATIONS;  -- declarations for the Parser
  10523. use PARSERDECLARATIONS; 
  10524.  
  10525. package STATESTACK is  --| Elements awaiting parsing
  10526.  
  10527. --| Overview
  10528. --|
  10529. --| The StateStack used by the parser.
  10530. --|
  10531. --| This data structure has the following sets of operations:
  10532. --|
  10533. --| 1) A set that add and delete elements.
  10534. --| This set can raise the exceptions Underflow and Overflow.
  10535. --| The set includes:
  10536. --|
  10537. --|     Pop
  10538. --|     Push
  10539. --|     Reduce
  10540. --|
  10541. --| 2) A function that returns the number of elements in the
  10542. --| data structure.
  10543. --| This set raises no exceptions.
  10544. --| The set includes:
  10545. --|
  10546. --|     Length
  10547. --|
  10548. --| 3) A copy operations, to return the top of the stack.
  10549. --| The exception, UnderFlow,
  10550. --| is utilized to indicate the end of a sequential examination.
  10551. --| The set includes:
  10552. --|
  10553. --|     CopyTop
  10554. --|     InitCopy
  10555. --|     CopyNext
  10556.  
  10557. --| Notes
  10558. --|
  10559. --|     Under some implementations the exception
  10560. --| ParserDeclarations.MemoryOverflow could be raised.
  10561. --|
  10562.  
  10563. ------------------------------------------------------------------
  10564. -- Declarations Global to Package StateStack
  10565. ------------------------------------------------------------------
  10566.  
  10567.   OVERFLOW  : exception; 
  10568.   --| raised if no more space in stack.
  10569.   UNDERFLOW : exception; 
  10570.   --| raised if no more elements in stack.
  10571.  
  10572.   ------------------------------------------------------------------
  10573.  
  10574.   procedure PUSH( --| Adds new top element to stack
  10575.                  ELEMENT : in STATESTACKELEMENT);  --| element to add
  10576.  
  10577.   --|
  10578.   --| Raises
  10579.   --|
  10580.   --| OverFlow - no more space in stack.
  10581.  
  10582.   --| Effects
  10583.   --|
  10584.   --| This subprogram adds an element to the top of the stack.
  10585.   --|
  10586.  
  10587.   ------------------------------------------------------------------
  10588.  
  10589.   function POP return STATESTACKELEMENT;  --| Removes top element in stack
  10590.  
  10591.   --| Raises
  10592.   --|
  10593.   --| UnderFlow - no more elements in stack.
  10594.  
  10595.   --| Effects
  10596.   --|
  10597.   --| This subprogram pops the element at the top of the stack.
  10598.   --|
  10599.  
  10600.   ------------------------------------------------------------------
  10601.  
  10602.   function COPYTOP return STATESTACKELEMENT; 
  10603.   --| Copy top element in stack
  10604.  
  10605.   --| Raises
  10606.   --|
  10607.   --| UnderFlow - no more elements in stack.
  10608.   --|
  10609.  
  10610.   --| Effects
  10611.   --|
  10612.   --| Returns the top of the stack.
  10613.  
  10614.   ------------------------------------------------------------------
  10615.  
  10616.   function COPYNEXT return STATESTACKELEMENT; 
  10617.   --| Copy element after previous one copied
  10618.  
  10619.   --| Raises
  10620.   --|
  10621.   --| UnderFlow - no more elements in stack.
  10622.  
  10623.   --| Effects
  10624.   --|
  10625.   --| This subprogram is used in conjunction with
  10626.   --| CopyTop or Init Copy to sequentially examine the stack.
  10627.   --|
  10628.  
  10629.   ------------------------------------------------------------------
  10630.  
  10631.   function LENGTH return STATEPARSESTACKSINDEX; 
  10632.   --| Returns the number of elements in the stack
  10633.  
  10634.   --| Effects
  10635.   --|
  10636.   --| This subprogram returns the number of elements in the stack.
  10637.   --|
  10638.  
  10639.   ------------------------------------------------------------------
  10640.  
  10641.   procedure INITCOPY;  --| Initialize sequential examination of
  10642.   --| the data structure
  10643.  
  10644.   --| Effects
  10645.   --|
  10646.   --| Initializes the copy function,
  10647.   --| so that subsequent calls to CopyNext will sequentially examine
  10648.   --| the elements in the data structure.
  10649.   --|
  10650.  
  10651.   ------------------------------------------------------------------
  10652.  
  10653.   function COPYTHISONE( --| returns element given by parm 'which_one'
  10654.                        WHICH_ONE : in STATEPARSESTACKSRANGE) return
  10655.     STATESTACKELEMENT; 
  10656.  
  10657.   --| Overview
  10658.   --|
  10659.   --| Returns the state stack element indicated by the parameter
  10660.   --| 'which_one'.  This operation is needed by LocalStateStack
  10661.   --| because, in essence, the state stack is being copied in two
  10662.   --| nested loops and the Next_To_Copy counter can therefore only
  10663.   --| be used for one of the series of copies.
  10664.  
  10665.   ------------------------------------------------------------------
  10666.  
  10667.   procedure REDUCE( --| Pops and discards top n elements on
  10668.   --| the stack.
  10669.                    TOPN : in STATEPARSESTACKSINDEX); 
  10670.                                       --| Number of elements to pop.
  10671.  
  10672.   --| Raises:
  10673.   --|
  10674.   --| Underflow - no more elements in stack.
  10675.  
  10676.   --| Effects
  10677.   --|
  10678.   --| Pops and discards TopN elements on the stack.
  10679.   --| If TopN is greater than the number of elements in the stack,
  10680.   --| Underflow is raised.
  10681.   --| This subprogram is used by the parser to reduce the stack during
  10682.   --| a reduce action.
  10683.   --| This stack reduction could be done with a for
  10684.   --| loop and the Pop subprogram at a considerable cost in execution
  10685.   --| time.
  10686.   --|
  10687.  
  10688.   ------------------------------------------------------------------
  10689.  
  10690. end STATESTACK; 
  10691.  
  10692. ----------------------------------------------------------------------
  10693. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10694. --parse.spc
  10695. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10696.  
  10697. -- $Source: /nosc/work/parser/RCS/Parse.spc,v $
  10698. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:48:41 $ -- $Author: carol $
  10699.  
  10700. ----------------------------------------------------------------------
  10701.  
  10702. with PARSERDECLARATIONS;  -- declarations for the Parser
  10703. use PARSERDECLARATIONS; 
  10704.  
  10705. package PARSER is 
  10706.  
  10707. --| Notes
  10708. --| 
  10709. --| WARNING:
  10710. --| 
  10711. --| Some of the code for this package is in the grammar source that is
  10712. --| input to the parse table generator. One of the ouputs of the
  10713. --| parse table generator is the source for the body of the procedure
  10714. --| Apply_Actions used in this package. This procedure provides case
  10715. --| statements to select the number of the rule to be used.
  10716. --| This procedure is declared as separate subunits in the
  10717. --| body of this package. It is strongly recommended that
  10718. --| the code of these functions be kept integrated with the grammar
  10719. --| for the following reasons.
  10720. --|
  10721. --| 1) to keep the case select numbers consistent with the reduce
  10722. --| action numbers in the parse tables.
  10723. --| 
  10724. --| 2) to associate each grammar rule with the code for its actions.
  10725. --| 
  10726.  
  10727.   package PD renames PARSERDECLARATIONS; 
  10728.  
  10729.   ------------------------------------------------------------------
  10730.  
  10731.   procedure APPLY_ACTIONS(RULE_NUMBER : in PT.LEFTHANDSIDERANGE); 
  10732.  
  10733.   ------------------------------------------------------------------
  10734.  
  10735.   function PARSE --| NYU LALR style parser
  10736.   return PD.PARSESTACKELEMENT; 
  10737.  
  10738.   --| Raises
  10739.   --|
  10740.   --| ParserDeclarations.MemoryOverflow
  10741.   --|
  10742.  
  10743.   --| Effects
  10744.   --|
  10745.   --| This parser takes input from a Lexer and parses it according
  10746.   --| to a set of grammar rules that have been converted into a set of
  10747.   --| ParseTables by the NYU LALR Parser Generator.
  10748.  
  10749.   --| Requires
  10750.   --|
  10751.   --| The parser expects the Lexer and other units it uses to be
  10752.   --| initialized.
  10753.   --|
  10754.   --| The units that stay the same for different grammars are:
  10755.   --|
  10756.   --| Parser.Parse (this subprogram)
  10757.   --| ParseStack
  10758.   --|
  10759.   --| The units that need to be changed for different grammars are:
  10760.   --|
  10761.   --| Parser.Apply_Actions
  10762.   --| Lex
  10763.   --| ParserDeclarations
  10764.   --| ParseTables
  10765.   --|
  10766.  
  10767.   --| Modifies
  10768.   --|
  10769.   --| The following are modified:
  10770.   --|
  10771.   --| ParseStack
  10772.   --|
  10773.  
  10774.   ------------------------------------------------------------------
  10775.  
  10776. end PARSER; 
  10777.  
  10778. ----------------------------------------------------------------------
  10779. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10780. --parsestk.bdy
  10781. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10782.  
  10783. -- $Source: /nosc/work/parser/RCS/ParseStk.bdy,v $
  10784. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:34:13 $ -- $Author: carol $
  10785.  
  10786. ----------------------------------------------------------------------
  10787.  
  10788. with PARSETABLES;  -- state tables generated by parser
  10789. --     generator
  10790. use PARSETABLES; 
  10791.  
  10792. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS; 
  10793.                                 -- to have visibility on operations
  10794. -- on type ParserInteger declared there.
  10795. package body PARSESTACK is 
  10796.  
  10797. --| Overview
  10798. --|
  10799. --| The data structure is implemented as an array.
  10800. --|
  10801.  
  10802. ------------------------------------------------------------------
  10803. -- Declarations Global to Package Body ParseStack
  10804. ------------------------------------------------------------------
  10805.  
  10806.   INDEX : PD.STATEPARSESTACKSINDEX := 0; 
  10807.   --| top element in stack.
  10808.  
  10809.   SPACE : array(PD.STATEPARSESTACKSRANGE) of PD.PARSESTACKELEMENT; 
  10810.   --| Storage used to hold stack elements
  10811.  
  10812.   ------------------------------------------------------------------
  10813.   -- Subprogram Bodies Global to Package ParseStack
  10814.   -- (declared in package specification).
  10815.   ------------------------------------------------------------------
  10816.  
  10817.   procedure PUSH(ELEMENT : in PD.PARSESTACKELEMENT) is 
  10818.  
  10819.   begin
  10820.  
  10821.     if (INDEX >= PD.STATEPARSESTACKSRANGE'LAST) then 
  10822.       raise OVERFLOW; 
  10823.     end if; 
  10824.  
  10825.     INDEX := INDEX + 1; 
  10826.     SPACE(INDEX) := ELEMENT; 
  10827.  
  10828.   end PUSH; 
  10829.  
  10830.   ------------------------------------------------------------------
  10831.  
  10832.   function POP return PD.PARSESTACKELEMENT is 
  10833.  
  10834.   begin
  10835.  
  10836.     if (INDEX < PD.STATEPARSESTACKSRANGE'FIRST) then 
  10837.       raise UNDERFLOW; 
  10838.     end if; 
  10839.  
  10840.     INDEX := INDEX - 1; 
  10841.     return SPACE(INDEX + 1); 
  10842.  
  10843.   end POP; 
  10844.  
  10845.   ------------------------------------------------------------------
  10846.  
  10847.   function LENGTH return PD.STATEPARSESTACKSINDEX is 
  10848.  
  10849.   begin
  10850.  
  10851.     return INDEX; 
  10852.  
  10853.   end LENGTH; 
  10854.  
  10855.   ------------------------------------------------------------------
  10856.  
  10857.   procedure REDUCE(TOPN : in PD.STATEPARSESTACKSINDEX) is 
  10858.  
  10859.   begin
  10860.     if (TOPN > INDEX) then 
  10861.       raise UNDERFLOW; 
  10862.     end if; 
  10863.  
  10864.     INDEX := INDEX - TOPN; 
  10865.  
  10866.   end REDUCE;  -- procedure
  10867.  
  10868.   ------------------------------------------------------------------
  10869.  
  10870. end PARSESTACK; 
  10871.  
  10872. ----------------------------------------------------------------------
  10873. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10874. --statestk.bdy
  10875. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10876.  
  10877. -- $Source: /nosc/work/parser/RCS/StateStk.bdy,v $
  10878. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:45:59 $ -- $Author: carol $
  10879.  
  10880. ----------------------------------------------------------------------
  10881.  
  10882. with PARSETABLES;  -- state tables generated
  10883. -- by parser generator
  10884. use PARSETABLES; 
  10885. with GRAMMAR_CONSTANTS;  -- constants generated by parser generator
  10886. use GRAMMAR_CONSTANTS;  -- to have visiblity on operations
  10887. -- on type ParserInteger.
  10888.  
  10889. package body STATESTACK is 
  10890.  
  10891. --| Overview
  10892. --|
  10893. --| The data structure is implemented as an array.
  10894. --|
  10895.  
  10896. --| Notes
  10897. --|
  10898. --| Abbreviations used in this compilation unit:
  10899. --|
  10900. --| Init : used as prefix for Initialize
  10901. --|
  10902.  
  10903. ------------------------------------------------------------------
  10904. -- Declarations Global to Package Body StateStack
  10905. ------------------------------------------------------------------
  10906.  
  10907.   INDEX        : STATEPARSESTACKSINDEX := 0; 
  10908.   --| top element in stack.
  10909.   NEXT_TO_COPY : STATEPARSESTACKSINDEX := 0; 
  10910.   --| next element to copy in stack.
  10911.  
  10912.   SPACE        : array(STATEPARSESTACKSRANGE) of STATESTACKELEMENT; 
  10913.   --| Storage used to hold stack elements
  10914.  
  10915.  
  10916.   ------------------------------------------------------------------
  10917.   -- Subprogram Bodies Global to Package StateStack
  10918.   -- (declared in package specification).
  10919.   ------------------------------------------------------------------
  10920.  
  10921.   procedure PUSH(ELEMENT : in STATESTACKELEMENT) is 
  10922.  
  10923.   begin
  10924.  
  10925.     if (INDEX >= STATEPARSESTACKSRANGE'LAST) then 
  10926.       raise OVERFLOW; 
  10927.     end if; 
  10928.  
  10929.     INDEX := INDEX + 1; 
  10930.     SPACE(INDEX) := ELEMENT; 
  10931.  
  10932.   end PUSH; 
  10933.  
  10934.   ------------------------------------------------------------------
  10935.  
  10936.   function POP return STATESTACKELEMENT is 
  10937.  
  10938.   begin
  10939.  
  10940.     if (INDEX < STATEPARSESTACKSRANGE'FIRST) then 
  10941.       raise UNDERFLOW; 
  10942.     end if; 
  10943.  
  10944.     INDEX := INDEX - 1; 
  10945.     return SPACE(INDEX + 1); 
  10946.  
  10947.   end POP; 
  10948.  
  10949.   ------------------------------------------------------------------
  10950.  
  10951.   function COPYTOP return STATESTACKELEMENT is 
  10952.  
  10953.   begin
  10954.  
  10955.     INITCOPY; 
  10956.     return COPYNEXT; 
  10957.  
  10958.   end COPYTOP; 
  10959.  
  10960.   ------------------------------------------------------------------
  10961.  
  10962.   function COPYNEXT return STATESTACKELEMENT is 
  10963.  
  10964.   begin
  10965.  
  10966.     NEXT_TO_COPY := NEXT_TO_COPY - 1; 
  10967.  
  10968.     if (NEXT_TO_COPY < STATEPARSESTACKSRANGE'FIRST) then 
  10969.       raise UNDERFLOW; 
  10970.     end if; 
  10971.  
  10972.     return SPACE(NEXT_TO_COPY); 
  10973.  
  10974.   end COPYNEXT; 
  10975.  
  10976.   ------------------------------------------------------------------
  10977.  
  10978.   function LENGTH return STATEPARSESTACKSINDEX is 
  10979.  
  10980.   begin
  10981.  
  10982.     return INDEX; 
  10983.  
  10984.   end LENGTH; 
  10985.  
  10986.   ------------------------------------------------------------------
  10987.  
  10988.   procedure INITCOPY is 
  10989.  
  10990.   begin
  10991.  
  10992.     NEXT_TO_COPY := INDEX + 1; 
  10993.  
  10994.   -- start examination here
  10995.   end INITCOPY; 
  10996.  
  10997.   ------------------------------------------------------------------
  10998.  
  10999.   function COPYTHISONE( --| returns the which_oneth element
  11000.                        WHICH_ONE : in STATEPARSESTACKSRANGE) return
  11001.     STATESTACKELEMENT is 
  11002.  
  11003.   begin
  11004.  
  11005.     if WHICH_ONE > INDEX then 
  11006.       raise OVERFLOW; 
  11007.     end if; 
  11008.  
  11009.     return (SPACE(WHICH_ONE)); 
  11010.  
  11011.   end COPYTHISONE; 
  11012.  
  11013.   ------------------------------------------------------------------
  11014.  
  11015.   procedure REDUCE(TOPN : in STATEPARSESTACKSINDEX) is 
  11016.  
  11017.   begin
  11018.  
  11019.     if (TOPN > INDEX) then 
  11020.       raise UNDERFLOW; 
  11021.     end if; 
  11022.  
  11023.     INDEX := INDEX - TOPN; 
  11024.  
  11025.   end REDUCE; 
  11026.  
  11027.   ------------------------------------------------------------------
  11028.  
  11029. end STATESTACK; 
  11030.  
  11031. ----------------------------------------------------------------------
  11032. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11033. --impldep.spc
  11034. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11035. -----------------------------------
  11036. package Implementation_Dependencies is --| Ada Compiler dependencies
  11037. -----------------------------------
  11038.  
  11039. --| Overview
  11040. --| This package contains Ada Compiler Implementation dependencies.
  11041. --| The purpose of this package is to isolate compiler dependencies
  11042. --| to a single package to simplify rehosting of the Ada Testing
  11043. --| and Evaluation Tools Set (ATETS).
  11044.  
  11045. --| This version of Implementation_Dependencies is configured for:
  11046. --|
  11047. --|   - DEC VAX Ada Compiler
  11048. --|
  11049. --|   - TeleSoft Ada Compiler ( VAX VMS Version 2.5 )
  11050.  
  11051.  
  11052. -- Jeff England  04/30/85 (TeleSoft Ada)
  11053. --               05/09/85 (DEC VAX Ada)
  11054.  
  11055. --------------------------------------
  11056.  
  11057.  
  11058.     type Long_Integer  is new integer;  --| Not implemented in TeleSoft Ada
  11059.  
  11060. --    type Long_Float    is new float;    --| Not implemented in TeleSoft Ada
  11061.  
  11062. --    type Short_Integer is new integer;  --| Not implemented in TeleSoft Ada
  11063.  
  11064.     type Short_Float   is new float;    --| Not implemented in TeleSoft Ada
  11065.  
  11066.     Line_length : constant := 256;
  11067.  
  11068. end Implementation_Dependencies;
  11069.  
  11070. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11071. --Timelib1.spc
  11072. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11073. with Calendar, Text_IO;
  11074.  
  11075. ----------------------
  11076. package Time_Library_1 is
  11077. ----------------------
  11078.  
  11079. --| Overview
  11080. --| TimeLib contains procedures and functions for getting, putting,
  11081. --| and calculating times, and dates. It augments the
  11082. --| predefined library package Calendar to simplify IO and provide
  11083. --| additional time routines common to all Ada Test and Evaluation
  11084. --| Tool Set (ATETS) tools.
  11085.  
  11086. --| Requires
  11087. --| All procedures and functions that perform IO use the
  11088. --| predefined library package Text_IO and require that the
  11089. --| specified file be opened by the calling program prior to use.
  11090. --| All times and durations must be of types declared in the
  11091. --| predefined library package Calendar.
  11092.  
  11093. --| Errors
  11094. --| No error messages or exceptions are raised by any of the TimeLib
  11095. --| procedures and functions. However, any Text_IO and Calendar
  11096. --| exceptions that may be raised are allowed to pass, unhandled,
  11097. --| back to the calling program.
  11098.  
  11099. --| N/A:  Raises, Modifies
  11100.  
  11101. --  Version         : 1.0
  11102. --  Author          : Jeff England
  11103. --  Initial Release : 05/19/85
  11104. --  Last Modified   : 05/19/85
  11105.  
  11106.  
  11107.  
  11108. type Timing_Type is ( Raw, Wall_Clock );
  11109.  
  11110.  
  11111. ----------------
  11112. function Date_of ( --| Convert the date to a string
  11113.     Date : Calendar.Time    --| The date to be converted
  11114.     ) return string;
  11115.  
  11116.   --| Effects
  11117.   --| Converts the date to a string in the format MM/DD/YYYY
  11118.  
  11119.   --| N/A:  Raises, Requires, Modifies, Errors
  11120.  
  11121.  
  11122. ----------------------
  11123. function Wall_Clock_of ( --| Convert seconds to wall clock time
  11124.     Seconds : Calendar.Day_Duration  --| The time to be converted
  11125.     ) return string;
  11126.  
  11127.   --| Effects
  11128.   --| Converts the time of day or elapsed time, in seconds,
  11129.   --| to a string in the format HH:MM:SS.FF.
  11130.  
  11131.   --| N/A:  Raises, Requires, Modifies, Errors
  11132.  
  11133.  
  11134. -------------------------
  11135. procedure Put_Time_of_Day ( --| Put the time of day to the file
  11136.     Fyle    : in Text_IO.File_Type;    --| The output file
  11137.     Seconds : in Calendar.Day_Duration --| The time to be output
  11138.     );
  11139.  
  11140.   --| Effects
  11141.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11142.   --| format HH:MM:SS.FF. If Timing = RAW then the time of
  11143.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11144.   --|
  11145.   --| Requires
  11146.   --| Fyle must have been previously opened by the calling program.
  11147.  
  11148.   --| N/A:  Raises, Modifies, Errors
  11149.  
  11150.  
  11151. ------------------
  11152. procedure Put_Time ( --| Put the time to the file
  11153.     Fyle : in Text_IO.File_Type;  --| The output file
  11154.     Date : in Calendar.Time       --| The time to be output
  11155.     );
  11156.  
  11157.   --| Effects
  11158.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11159.   --| format MM/DD/YYYY HH:MM:SS.FF. If Timing = RAW then the time of
  11160.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11161.   --|
  11162.   --| Requires
  11163.   --| Fyle must have been previously opened by the calling program.
  11164.  
  11165.   --| N/A:  Raises, Modifies, Errors
  11166.  
  11167.  
  11168. --------------------
  11169. procedure Set_Timing ( --| Set the method of recording timing data
  11170.  
  11171.     Timing : Timing_Type  --| The type of timing data to be recorded
  11172.  
  11173.     );
  11174.  
  11175.   --| Effects
  11176.   --| Sets th method of recording timing data to either RAW or Wall_Clock.
  11177.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11178.   --| format MM/DD/YYYY HH:MM:SS.FF. If Timing = RAW then the time of
  11179.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11180.   --| Overhead for either method may vary from system to system.
  11181.  
  11182.   --| N/A:  Raises, Requires, Modifies, Errors
  11183.  
  11184.  
  11185. end Time_Library_1;
  11186. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11187. --timelib1.bdy
  11188. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11189. with Text_IO, Calendar;
  11190.  
  11191. ---------------------------
  11192. package body Time_Library_1 is
  11193. ---------------------------
  11194.  
  11195. --| Overview
  11196. --| TimeLib contains procedures and functions for getting, putting,
  11197. --| and calculating times, and dates. It augments the
  11198. --| predefined library package Calendar to simplify IO and provide
  11199. --| additional time routines common to all Ada Test and Evaluation
  11200. --| Tool Set (ATETS) tools.
  11201.  
  11202. --| Requires
  11203. --| All procedures and functions that perform IO use the
  11204. --| predefined library package Text_IO and require that the
  11205. --| specified file be opened by the calling program prior to use.
  11206. --| All times and durations must be of types declared in the
  11207. --| predefined library package Calendar.
  11208.  
  11209. --| Errors
  11210. --| No error messages or exceptions are raised by any of the TimeLib
  11211. --| procedures and functions. However, any Text_IO and Calendar
  11212. --| exceptions that may be raised are allowed to pass, unhandled,
  11213. --| back to the calling program.
  11214.  
  11215. --| N/A:  Raises, Modifies
  11216.  
  11217. --  Version         : 1.1
  11218. --  Author          : Jeff England
  11219. --  Initial Release : 05/19/85
  11220. --  Last Modified   : 06/07/85
  11221.  
  11222.  
  11223. package Time_IO is new Text_IO.Fixed_IO( Calendar.Day_Duration );
  11224. package Int_IO  is new Text_IO.Integer_IO( Integer );
  11225.  
  11226. Timing_Method : Timing_Type := Wall_Clock;
  11227.             --| When Timing_Method = WALL_CLOCK then Put_Time
  11228.             --| puts the time to the file in the form HH:MM:SS:FF.
  11229.             --| When Timing_Method = RAW the time put using
  11230.             --| Fixed_IO(Day_Duration).
  11231.  
  11232.  
  11233. ----------------
  11234. function Convert( --| Convert an integer to a string
  11235.     Input_Number : in integer;
  11236.     Width        : in integer := 0
  11237.     ) return string is
  11238.  
  11239.   --| Effects:
  11240.   --| Converts an integer to a string of length Width. If the
  11241.   --| number if digits in Input_Number is less than Width then
  11242.   --| the digits are right justified in the output string and
  11243.   --| filled with zeros (0) on the left.
  11244.  
  11245.     Temp_Text : string (1 .. 16);
  11246.     Index     : integer;
  11247.  
  11248.  
  11249. begin
  11250.  
  11251.     Int_IO.Put(Temp_Text, Input_Number);
  11252.     if Width <= 0 then
  11253.         Index := Temp_Text'last;
  11254.         for i in Temp_Text'range loop
  11255.             if Temp_Text(i) /= ' ' then
  11256.                 Index := i;
  11257.                 exit;
  11258.             end if;
  11259.         end loop;
  11260.     else
  11261.         Index := Temp_Text'last - Width + 1;
  11262.         for i in Index .. Temp_Text'last loop
  11263.             if Temp_Text(i) = ' ' then
  11264.                 Temp_Text(i) := '0';
  11265.             end if;
  11266.         end loop;
  11267.     end if;
  11268.     return Temp_Text(Index .. Temp_Text'last);
  11269.  
  11270. end Convert;
  11271.  
  11272.  
  11273. -----------------
  11274. function Fraction ( --| returns the fraction portion of the time in seconds
  11275.     Seconds : Calendar.Day_Duration
  11276.     ) return string is
  11277.  
  11278. Temp_Secs : String(1..10);
  11279.  
  11280. begin
  11281.     Time_IO.Put( Temp_Secs, Seconds, 2, 0 );
  11282.     return Temp_Secs( Temp_Secs'Last-2 .. Temp_Secs'Last );
  11283. end Fraction;
  11284.  
  11285.  
  11286. ----------------
  11287. function Date_of ( --| Convert the date to a string
  11288.     Date : Calendar.Time    --| The date to be converted
  11289.     ) return string is
  11290.  
  11291.   --| Effects
  11292.   --| Converts the date to a string in the format MM/DD/YY
  11293.  
  11294.   --| N/A:  Raises, Requires, Modifies, Errors
  11295.  
  11296.     Year        : Calendar.Year_Number;
  11297.     Month       : Calendar.Month_Number;
  11298.     Day         : Calendar.Day_Number;
  11299.     Seconds     : Calendar.Day_Duration;
  11300.  
  11301. begin
  11302.  
  11303.     Calendar.Split(Date, Year, Month, Day, Seconds );
  11304.     return Convert(integer(Month), 2) & "/"
  11305.            & Convert(integer(Day), 2) & "/"
  11306.            & Convert(integer(Year mod 100), 2);
  11307.  
  11308. end Date_of;
  11309.  
  11310.  
  11311.  
  11312. ----------------------
  11313. function Wall_Clock_of ( --| Convert seconds to wall clock time
  11314.     Seconds : Calendar.Day_Duration  --| The time to be converted
  11315.     ) return string is
  11316.  
  11317.   --| Effects
  11318.   --| Converts the time of day or elapsed time, in seconds,
  11319.   --| to a string in the format HH:MM:SS.FF.
  11320.  
  11321.   --| N/A:  Raises, Requires, Modifies, Errors
  11322.  
  11323.     use Calendar;  -- For "-" of times and durations
  11324.  
  11325.     Half_Second : Day_Duration := 0.5;
  11326.  
  11327. begin
  11328.  
  11329.     If Seconds < Half_Second then
  11330.         Half_Second := 0.0;
  11331.     end if;
  11332.  
  11333.     return Convert(   integer(Seconds - Half_Second) / 3600, 2)
  11334.          & ":"
  11335.          & Convert( ( integer(Seconds - Half_Second) mod 3600 ) / 60, 2 )
  11336.          & ":"
  11337.          & Convert(   integer(Seconds - Half_Second) mod 60, 2 ) 
  11338.          & Fraction( Seconds );
  11339.  
  11340. end Wall_Clock_of;
  11341.  
  11342.  
  11343. -------------------------
  11344. procedure Put_Time_of_Day ( --| Put the time of day to the file
  11345.     Fyle : in Text_IO.File_Type;        --| The output file
  11346.     Seconds : in Calendar.Day_Duration  --| The time to be output
  11347.     ) is
  11348.  
  11349.   --| Effects
  11350.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11351.   --| format HH:MM:SS.FF. If Timing = RAW then the time of
  11352.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11353.   --|
  11354.   --| Requires
  11355.   --| Fyle must have been previously opened by the calling program.
  11356.  
  11357.   --| N/A:  Raises, Modifies, Errors
  11358.  
  11359.  
  11360. begin
  11361.  
  11362.     if Timing_Method = Wall_Clock then
  11363.         Text_IO.Put( Fyle, Wall_Clock_of( Seconds ) );
  11364.     else
  11365.         Time_IO.Put( Fyle, Seconds, 0, 2, 0 );
  11366.     end if;
  11367.  
  11368. end Put_Time_of_Day;
  11369.  
  11370.  
  11371. ------------------
  11372. procedure Put_Time ( --| Put the time to the file
  11373.     Fyle : in Text_IO.File_Type;  --| The output file
  11374.     Date : in Calendar.Time       --| The time to be output
  11375.     ) is
  11376.  
  11377.   --| Effects
  11378.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11379.   --| format MM/DD/YYYY HH:MM:SS.FF. If Timing = RAW then the time of
  11380.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11381.   --|
  11382.   --| Requires
  11383.   --| Fyle must have been previously opened by the calling program.
  11384.  
  11385.   --| N/A:  Raises, Modifies, Errors
  11386.  
  11387.  
  11388. begin
  11389.  
  11390.     Text_IO.Put( Fyle, Date_of( Date ) );
  11391.  
  11392.     Text_IO.Put( Fyle, ' ' );
  11393.  
  11394.     Put_Time_of_Day( Fyle, Calendar.Seconds( Date ) );
  11395.  
  11396. end Put_Time;
  11397.  
  11398.  
  11399. --------------------
  11400. procedure Set_Timing ( --| Set the method of recording timing data
  11401.  
  11402.     Timing : Timing_Type  --| The type of timing data to be recorded
  11403.  
  11404.     ) is
  11405.  
  11406.   --| Effects
  11407.   --| Sets th method of recording timing data to either RAW or Wall_Clock.
  11408.   --| If Timing = WALL_CLOCK then the time is put to the file in the
  11409.   --| format MM/DD/YYYY HH:MM:SS.FF. If Timing = RAW then the time of
  11410.   --| day is put to the file using new Fixed_IO( Day_Duration ).
  11411.   --| Overhead for either method may vary from system to system.
  11412.  
  11413.   --| N/A:  Raises, Requires, Modifies, Errors
  11414.  
  11415. begin
  11416.  
  11417.     Timing_Method := Timing; --| Set timing method to RAW or WALL_CLOCK
  11418.  
  11419. end Set_Timing;
  11420.  
  11421. end Time_Library_1;
  11422. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11423. --prefix.spc
  11424. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11425. package Test_Library_prefix_Definition
  11426.  
  11427. is
  11428.   
  11429.   File_Prefix_Limit   : constant natural := 8;
  11430.   
  11431.   Test_Library_Prefix : constant string := "[USER.MRKTOOL.TESTLIB]";
  11432.  
  11433. end;
  11434. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11435. --ptbls.bdy
  11436. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11437. --+ PTBLS.BDY +--
  11438.  
  11439. package body ParseTables is
  11440. ----------------------------------------------------------------------
  11441. -- The rest of the constants used to define the Parse Tables
  11442. ----------------------------------------------------------------------
  11443.  
  11444.     DefaultValue : constant := 1 ; -- default for aggregates.
  11445.     
  11446.     ActionTableOneLength : constant GC.ParserInteger :=
  11447.          8573 ;
  11448.         --| Length (number of entries) in map ActionTableOne.
  11449.     subtype ActionTableOneRange is GC.ParserInteger
  11450.             range 1..ActionTableOneLength;
  11451.     
  11452.     ActionTableTwoLength : constant GC.ParserInteger :=
  11453.          8573 ;
  11454.         --| Length (number of entries) in map ActionTableTwo.
  11455.     subtype ActionTableTwoRange is GC.ParserInteger
  11456.             range 1..ActionTableTwoLength;
  11457.     
  11458.     DefaultMapLength : constant GC.ParserInteger :=
  11459.          1039 ;
  11460.         --| Length (number of entries) in map Defaults.
  11461.     subtype DefaultMapRange is GC.ParserInteger range 1..DefaultMapLength;
  11462.     
  11463.     FollowMapLength : constant GC.ParserInteger :=
  11464.           300 ;
  11465.         --| Length (number of entries) in the FollowMap.
  11466.     
  11467.     GrammarSymbolCountPlusOne : constant GC.ParserInteger :=
  11468.           397 ;
  11469.         --| Number of symbols plus one in the parse tables.
  11470.         -- NYU Reference Name: NUM_INPUTS
  11471.     
  11472.     ActionTableSize : constant GC.ParserInteger :=
  11473.          5737 ;
  11474.         --| Maximum entry in Action Tables referenced by hash
  11475.         --| function. Entries above TableSize are collision chains.
  11476.         -- NYU Reference Name: TABLE_SIZE
  11477.     
  11478.     ------------------------------------------------------------------
  11479.     -- Tables generated by Parse Tables Generator
  11480.     ------------------------------------------------------------------
  11481.  
  11482.     subtype GrammarSymbolRepRangePlusZero is
  11483.         GrammarSymbolRepRangePlusZeroCommon;
  11484.  
  11485.     GrammarSymbolTableIndex : constant
  11486.         array (GrammarSymbolRange'first .. GrammarSymbolRange'last * 2)
  11487.         of GC.ParserInteger :=
  11488.          (    1,    0,    1,    5,    6,    8,    9,   14,   15,   20
  11489. ,   21,   23,   24,   26,   27,   31,   32,   33,   34,   38
  11490. ,   39,   42,   43,   46,   47,   54,   55,   61,   62,   66
  11491. ,   67,   71,   72,   77,   78,   79,   80,   83,   84,   88
  11492. ,   89,   91,   92,   96,   97,  105,  106,  109,  110,  112
  11493. ,  113,  120,  121,  127,  128,  131,  132,  133,  134,  135
  11494. ,  136,  137,  138,  144,  145,  148,  149,  151,  152,  154
  11495. ,  155,  157,  158,  161,  162,  163,  164,  165,  166,  171
  11496. ,  172,  174,  175,  181,  182,  187,  188,  194,  195,  203
  11497. ,  204,  208,  209,  213,  214,  219,  220,  222,  223,  229
  11498. ,  230,  235,  236,  242,  243,  248,  249,  256,  257,  263
  11499. ,  264,  267,  268,  276,  277,  280,  281,  284,  285,  287
  11500. ,  288,  291,  292,  296,  297,  300,  301,  303,  304,  313
  11501. ,  314,  328,  329,  342,  343,  359,  360,  360,  361,  361
  11502. ,  362,  362,  363,  363,  364,  364,  365,  365,  366,  366
  11503. ,  367,  367,  368,  368,  369,  369,  370,  370,  371,  371
  11504. ,  372,  372,  373,  373,  374,  374,  375,  377,  378,  379
  11505. ,  380,  381,  382,  383,  384,  385,  386,  387,  388,  389
  11506. ,  390,  391,  392,  393,  394,  395,  396,  397,  398,  412
  11507. ,  413,  416,  417,  420,  421,  431,  432,  461,  462,  467
  11508. ,  468,  483,  484,  500,  501,  519,  520,  541,  542,  560
  11509. ,  561,  578,  579,  599,  600,  620,  621,  640,  641,  658
  11510. ,  659,  681,  682,  699,  700,  720,  721,  746,  747,  761
  11511. ,  762,  779,  780,  793,  794,  802,  803,  830,  831,  837
  11512. ,  838,  847,  848,  862,  863,  880,  881,  901,  902,  928
  11513. ,  929,  952,  953,  967,  968,  982,  983,  992,  993, 1018
  11514. , 1019, 1047, 1048, 1058, 1059, 1085, 1086, 1108, 1109, 1128
  11515. , 1129, 1149, 1150, 1171, 1172, 1193, 1194, 1216, 1217, 1225
  11516. , 1226, 1235, 1236, 1257, 1258, 1273, 1274, 1298, 1299, 1320
  11517. , 1321, 1339, 1340, 1356, 1357, 1389, 1390, 1425, 1426, 1444
  11518. , 1445, 1472, 1473, 1490, 1491, 1515, 1516, 1545, 1546, 1569
  11519. , 1570, 1596, 1597, 1612, 1613, 1616, 1617, 1630, 1631, 1647
  11520. , 1648, 1652, 1653, 1672, 1673, 1687, 1688, 1701, 1702, 1714
  11521. , 1715, 1737, 1738, 1758, 1759, 1779, 1780, 1803, 1804, 1815
  11522. , 1816, 1829, 1830, 1849, 1850, 1885, 1886, 1905, 1906, 1948
  11523. , 1949, 1955, 1956, 1979, 1980, 1985, 1986, 1994, 1995, 2018
  11524. , 2019, 2034, 2035, 2038, 2039, 2062, 2063, 2084, 2085, 2105
  11525. , 2106, 2115, 2116, 2137, 2138, 2148, 2149, 2157, 2158, 2172
  11526. , 2173, 2184, 2185, 2193, 2194, 2210, 2211, 2228, 2229, 2237
  11527. , 2238, 2245, 2246, 2265, 2266, 2287, 2288, 2296, 2297, 2330
  11528. , 2331, 2351, 2352, 2378, 2379, 2408, 2409, 2426, 2427, 2455
  11529. , 2456, 2490, 2491, 2528, 2529, 2536, 2537, 2559, 2560, 2581
  11530. , 2582, 2604, 2605, 2633, 2634, 2661, 2662, 2701, 2702, 2708
  11531. , 2709, 2765, 2766, 2801, 2802, 2805, 2806, 2812, 2813, 2846
  11532. , 2847, 2852, 2853, 2882, 2883, 2906, 2907, 2915, 2916, 2935
  11533. , 2936, 2954, 2955, 2976, 2977, 2997, 2998, 3017, 3018, 3040
  11534. , 3041, 3053, 3054, 3065, 3066, 3074, 3075, 3085, 3086, 3107
  11535. , 3108, 3123, 3124, 3141, 3142, 3160, 3161, 3168, 3169, 3189
  11536. , 3190, 3209, 3210, 3223, 3224, 3235, 3236, 3251, 3252, 3265
  11537. , 3266, 3280, 3281, 3295, 3296, 3310, 3311, 3322, 3323, 3336
  11538. , 3337, 3352, 3353, 3368, 3369, 3383, 3384, 3403, 3404, 3417
  11539. , 3418, 3431, 3432, 3445, 3446, 3460, 3461, 3474, 3475, 3479
  11540. , 3480, 3518, 3519, 3566, 3567, 3596, 3597, 3605, 3606, 3625
  11541. , 3626, 3695, 3696, 3727, 3728, 3753, 3754, 3774, 3775, 3792
  11542. , 3793, 3805, 3806, 3817, 3818, 3831, 3832, 3846, 3847, 3879
  11543. , 3880, 3893, 3894, 3937, 3938, 3961, 3962, 3980, 3981, 3996
  11544. , 3997, 4020, 4021, 4036, 4037, 4059, 4060, 4085, 4086, 4095
  11545. , 4096, 4099, 4100, 4121, 4122, 4149, 4150, 4165, 4166, 4186
  11546. , 4187, 4215, 4216, 4240, 4241, 4256, 4257, 4291, 4292, 4317
  11547. , 4318, 4329, 4330, 4344, 4345, 4370, 4371, 4414, 4415, 4446
  11548. , 4447, 4478, 4479, 4509, 4510, 4526, 4527, 4553, 4554, 4610
  11549. , 4611, 4639, 4640, 4678, 4679, 4692, 4693, 4714, 4715, 4730
  11550. , 4731, 4745, 4746, 4763, 4764, 4787, 4788, 4834, 4835, 4860
  11551. , 4861, 4878, 4879, 4895, 4896, 4916, 4917, 4948, 4949, 4972
  11552. , 4973, 5003, 5004, 5015, 5016, 5055, 5056, 5068, 5069, 5079
  11553. , 5080, 5111, 5112, 5141, 5142, 5148, 5149, 5166, 5167, 5179
  11554. , 5180, 5195, 5196, 5209, 5210, 5234, 5235, 5241, 5242, 5266
  11555. , 5267, 5283, 5284, 5303, 5304, 5314, 5315, 5343, 5344, 5363
  11556. , 5364, 5379, 5380, 5396, 5397, 5410, 5411, 5457, 5458, 5475
  11557. , 5476, 5501, 5502, 5517, 5518, 5536, 5537, 5552, 5553, 5583
  11558. , 5584, 5612, 5613, 5635, 5636, 5653, 5654, 5675, 5676, 5694
  11559. , 5695, 5716, 5717, 5740, 5741, 5792, 5793, 5816, 5817, 5840
  11560. , 5841, 5853, 5854, 5886, 5887, 5900, 5901, 5928, 5929, 5951
  11561. , 5952, 5970, 5971, 5986, 5987, 6002, 6003, 6018, 6019, 6030
  11562. , 6031, 6045, 6046, 6054, 6055, 6063, 6064, 6117, 6118, 6142
  11563. , 6143, 6155, 6156, 6168, 6169, 6183, 6184, 6205, 6206, 6233
  11564. , 6234, 6251, 6252, 6282, 6283, 6294, 6295, 6313, 6314, 6336
  11565. , 6337, 6367, 6368, 6382, 6383, 6401, 6402, 6419, 6420, 6435
  11566. , 6436, 6462, 6463, 6478, 6479, 6497, 6498, 6523, 6524, 6554
  11567. , 6555, 6580)  ;
  11568.         
  11569.     GrammarSymbolTable : constant String :=
  11570.          ('A','B','O','R','T','A','B','S','A','C'
  11571. ,'C','E','P','T','A','C','C','E','S','S'
  11572. ,'A','L','L','A','N','D','A','R','R','A'
  11573. ,'Y','A','T','B','E','G','I','N','B','O'
  11574. ,'D','Y','C','A','S','E','C','O','N','S'
  11575. ,'T','A','N','T','D','E','C','L','A','R'
  11576. ,'E','D','E','L','A','Y','D','E','L','T'
  11577. ,'A','D','I','G','I','T','S','D','O','E'
  11578. ,'L','S','E','E','L','S','I','F','E','N'
  11579. ,'D','E','N','T','R','Y','E','X','C','E'
  11580. ,'P','T','I','O','N','E','X','I','T','F'
  11581. ,'O','R','F','U','N','C','T','I','O','N'
  11582. ,'G','E','N','E','R','I','C','G','O','T'
  11583. ,'O','I','F','I','N','I','S','L','I','M'
  11584. ,'I','T','E','D','L','O','O','P','M','O'
  11585. ,'D','N','E','W','N','O','T','N','U','L'
  11586. ,'L','O','F','O','R','O','T','H','E','R'
  11587. ,'S','O','U','T','P','A','C','K','A','G'
  11588. ,'E','P','R','A','G','M','A','P','R','I'
  11589. ,'V','A','T','E','P','R','O','C','E','D'
  11590. ,'U','R','E','R','A','I','S','E','R','A'
  11591. ,'N','G','E','R','E','C','O','R','D','R'
  11592. ,'E','M','R','E','N','A','M','E','S','R'
  11593. ,'E','T','U','R','N','R','E','V','E','R'
  11594. ,'S','E','S','E','L','E','C','T','S','E'
  11595. ,'P','A','R','A','T','E','S','U','B','T'
  11596. ,'Y','P','E','T','A','S','K','T','E','R'
  11597. ,'M','I','N','A','T','E','T','H','E','N'
  11598. ,'T','Y','P','E','U','S','E','W','H','E'
  11599. ,'N','W','H','I','L','E','W','I','T','H'
  11600. ,'X','O','R','i','d','e','n','t','i','f'
  11601. ,'i','e','r','n','u','m','e','r','i','c'
  11602. ,'_','l','i','t','e','r','a','l','s','t'
  11603. ,'r','i','n','g','_','l','i','t','e','r'
  11604. ,'a','l','c','h','a','r','a','c','t','e'
  11605. ,'r','_','l','i','t','e','r','a','l','&'
  11606. ,''','(',')','*','+',',','-','.','/',':'
  11607. ,';','<','=','>',''','|',''','=','>','.'
  11608. ,'.','*','*',':','=','/','=','>','=','<'
  11609. ,'=','<','<','>','>','<','>','c','o','m'
  11610. ,'m','e','n','t','_','l','i','t','e','r'
  11611. ,'a','l','$','E','O','F','$','A','C','C'
  11612. ,'c','o','m','p','i','l','a','t','i','o'
  11613. ,'n','g','e','n','e','r','a','l','_','c'
  11614. ,'o','m','p','o','n','e','n','t','_','a'
  11615. ,'s','s','o','c','i','a','t','i','o','n'
  11616. ,'s','p','r','a','g','m','a','t','y','p'
  11617. ,'e','_','d','e','c','l','a','r','a','t'
  11618. ,'i','o','n','b','a','s','i','c','_','d'
  11619. ,'e','c','l','a','r','a','t','i','o','n'
  11620. ,'s','u','b','t','y','p','e','_','d','e'
  11621. ,'c','l','a','r','a','t','i','o','n','s'
  11622. ,'u','b','p','r','o','g','r','a','m','_'
  11623. ,'d','e','c','l','a','r','a','t','i','o'
  11624. ,'n','p','a','c','k','a','g','e','_','d'
  11625. ,'e','c','l','a','r','a','t','i','o','n'
  11626. ,'t','a','s','k','_','s','p','e','c','i'
  11627. ,'f','i','c','a','t','i','o','n','g','e'
  11628. ,'n','e','r','i','c','_','s','p','e','c'
  11629. ,'i','f','i','c','a','t','i','o','n','g'
  11630. ,'e','n','e','r','i','c','_','i','n','s'
  11631. ,'t','a','n','t','i','a','t','i','o','n'
  11632. ,'r','e','n','a','m','i','n','g','_','d'
  11633. ,'e','c','l','a','r','a','t','i','o','n'
  11634. ,'o','b','j','e','c','t','_','d','e','c'
  11635. ,'l','a','r','a','t','i','o','n','b','a'
  11636. ,'s','i','c','_','c','o','l','o','n','_'
  11637. ,'d','e','c','l','a','r','a','t','i','o'
  11638. ,'n','n','u','m','b','e','r','_','d','e'
  11639. ,'c','l','a','r','a','t','i','o','n','e'
  11640. ,'x','c','e','p','t','i','o','n','_','d'
  11641. ,'e','c','l','a','r','a','t','i','o','n'
  11642. ,'r','e','n','a','m','i','n','g','_','c'
  11643. ,'o','l','o','n','_','d','e','c','l','a'
  11644. ,'r','a','t','i','o','n','i','d','e','n'
  11645. ,'t','i','f','i','e','r','_','l','i','s'
  11646. ,'t','s','u','b','t','y','p','e','_','i'
  11647. ,'n','d','i','c','a','t','i','o','n','['
  11648. ,':','=','e','x','p','r','e','s','s','i'
  11649. ,'o','n',']','s','t','a','r','t','_','c'
  11650. ,'a','d','c','o','n','s','t','r','a','i'
  11651. ,'n','e','d','_','a','r','r','a','y','_'
  11652. ,'d','e','f','i','n','i','t','i','o','n'
  11653. ,'e','n','d','_','c','a','d','e','x','p'
  11654. ,'r','e','s','s','i','o','n','s','a','v'
  11655. ,'e','_','i','d','e','n','t','i','f','i'
  11656. ,'e','r','{',',','s','a','v','e','_','i'
  11657. ,'d','e','n','t','i','f','i','e','r','}'
  11658. ,'f','u','l','l','_','t','y','p','e','_'
  11659. ,'d','e','c','l','a','r','a','t','i','o'
  11660. ,'n','i','n','c','o','m','p','l','e','t'
  11661. ,'e','_','t','y','p','e','_','d','e','c'
  11662. ,'l','a','r','a','t','i','o','n','p','r'
  11663. ,'i','v','a','t','e','_','t','y','p','e'
  11664. ,'_','d','e','c','l','a','r','a','t','i'
  11665. ,'o','n','t','y','p','e','_','i','d','e'
  11666. ,'n','t','i','f','i','e','r','t','y','p'
  11667. ,'e','_','d','e','f','i','n','i','t','i'
  11668. ,'o','n','l','e','f','t','_','p','a','r'
  11669. ,'e','n','d','i','s','c','r','i','m','i'
  11670. ,'n','a','n','t','_','s','p','e','c','i'
  11671. ,'f','i','c','a','t','i','o','n','{',';'
  11672. ,'d','i','s','c','r','i','m','i','n','a'
  11673. ,'n','t','_','s','p','e','c','i','f','i'
  11674. ,'c','a','t','i','o','n','}','r','i','g'
  11675. ,'h','t','_','p','a','r','e','n','e','n'
  11676. ,'u','m','e','r','a','t','i','o','n','_'
  11677. ,'t','y','p','e','_','d','e','f','i','n'
  11678. ,'i','t','i','o','n','i','n','t','e','g'
  11679. ,'e','r','_','t','y','p','e','_','d','e'
  11680. ,'f','i','n','i','t','i','o','n','r','e'
  11681. ,'a','l','_','t','y','p','e','_','d','e'
  11682. ,'f','i','n','i','t','i','o','n','a','r'
  11683. ,'r','a','y','_','t','y','p','e','_','d'
  11684. ,'e','f','i','n','i','t','i','o','n','r'
  11685. ,'e','c','o','r','d','_','t','y','p','e'
  11686. ,'_','d','e','f','i','n','i','t','i','o'
  11687. ,'n','a','c','c','e','s','s','_','t','y'
  11688. ,'p','e','_','d','e','f','i','n','i','t'
  11689. ,'i','o','n','d','e','r','i','v','e','d'
  11690. ,'_','t','y','p','e','_','d','e','f','i'
  11691. ,'n','i','t','i','o','n','t','y','p','e'
  11692. ,'_','m','a','r','k','c','o','n','s','t'
  11693. ,'r','a','i','n','t','t','y','p','e','_'
  11694. ,'n','a','m','e','|','s','u','b','t','y'
  11695. ,'p','e','_','n','a','m','e','r','a','n'
  11696. ,'g','e','_','c','o','n','s','t','r','a'
  11697. ,'i','n','t','f','l','o','a','t','i','n'
  11698. ,'g','_','p','o','i','n','t','_','c','o'
  11699. ,'n','s','t','r','a','i','n','t','f','i'
  11700. ,'x','e','d','_','p','o','i','n','t','_'
  11701. ,'c','o','n','s','t','r','a','i','n','t'
  11702. ,'s','t','a','r','t','_','e','x','p','a'
  11703. ,'n','d','e','d','_','n','a','m','e','s'
  11704. ,'i','m','p','l','e','_','e','x','p','r'
  11705. ,'e','s','s','i','o','n','e','n','u','m'
  11706. ,'e','r','a','t','i','o','n','_','l','i'
  11707. ,'t','e','r','a','l','_','s','p','e','c'
  11708. ,'i','f','i','c','a','t','i','o','n','{'
  11709. ,',','e','n','u','m','e','r','a','t','i'
  11710. ,'o','n','_','l','i','t','e','r','a','l'
  11711. ,'_','s','p','e','c','i','f','i','c','a'
  11712. ,'t','i','o','n','}','e','n','u','m','e'
  11713. ,'r','a','t','i','o','n','_','l','i','t'
  11714. ,'e','r','a','l','f','l','o','a','t','i'
  11715. ,'n','g','_','a','c','c','u','r','a','c'
  11716. ,'y','_','d','e','f','i','n','i','t','i'
  11717. ,'o','n','[','r','a','n','g','e','_','c'
  11718. ,'o','n','s','t','r','a','i','n','t',']'
  11719. ,'f','i','x','e','d','_','a','c','c','u'
  11720. ,'r','a','c','y','_','d','e','f','i','n'
  11721. ,'i','t','i','o','n','u','n','c','o','n'
  11722. ,'s','t','r','a','i','n','e','d','_','a'
  11723. ,'r','r','a','y','_','d','e','f','i','n'
  11724. ,'i','t','i','o','n','i','n','d','e','x'
  11725. ,'_','s','u','b','t','y','p','e','_','d'
  11726. ,'e','f','i','n','i','t','i','o','n','{'
  11727. ,',','i','n','d','e','x','_','s','u','b'
  11728. ,'t','y','p','e','_','d','e','f','i','n'
  11729. ,'i','t','i','o','n','}','i','n','d','e'
  11730. ,'x','_','c','o','n','s','t','r','a','i'
  11731. ,'n','t','n','a','m','e','d','i','s','c'
  11732. ,'r','e','t','e','_','r','a','n','g','e'
  11733. ,'{',',','d','i','s','c','r','e','t','e'
  11734. ,'_','r','a','n','g','e','}','r','a','n'
  11735. ,'g','e','s','t','a','r','t','_','o','f'
  11736. ,'_','r','e','c','o','r','d','_','t','y'
  11737. ,'p','e','r','e','c','o','r','d','_','t'
  11738. ,'e','r','m','i','n','a','l','c','o','m'
  11739. ,'p','o','n','e','n','t','_','l','i','s'
  11740. ,'t','{','p','r','a','g','m','a','_','d'
  11741. ,'e','c','l','}','{','c','o','m','p','o'
  11742. ,'n','e','n','t','_','d','e','c','l','a'
  11743. ,'r','a','t','i','o','n','}','c','o','m'
  11744. ,'p','o','n','e','n','t','_','d','e','c'
  11745. ,'l','a','r','a','t','i','o','n','c','l'
  11746. ,'o','s','i','n','g','_','{','p','r','a'
  11747. ,'g','m','a','_','d','e','c','l','}','{'
  11748. ,'c','o','m','p','o','n','e','n','t','_'
  11749. ,'d','e','c','l','a','r','a','t','i','o'
  11750. ,'n','}',''','v','a','r','i','a','n','t'
  11751. ,'_','p','a','r','t','n','u','l','l','_'
  11752. ,'s','t','a','t','e','m','e','n','t','C'
  11753. ,'A','S','E','_','_','i','d','e','n','t'
  11754. ,'i','f','i','e','r','_','_','I','S','{'
  11755. ,'p','r','a','g','m','a','_','v','a','r'
  11756. ,'i','a','n','t','}','_','_','v','a','r'
  11757. ,'i','a','n','t','_','_','{','v','a','r'
  11758. ,'i','a','n','t','}','s','t','a','r','t'
  11759. ,'_','r','e','c','o','r','d','_','v','a'
  11760. ,'r','i','a','n','t','W','H','E','N','_'
  11761. ,'_','v','a','r','i','a','n','t','_','c'
  11762. ,'h','o','i','c','e','_','_','{','|','v'
  11763. ,'a','r','i','a','n','t','_','c','h','o'
  11764. ,'i','c','e','}','_','_','=','>','v','a'
  11765. ,'r','i','a','n','t','W','H','E','N','_'
  11766. ,'_','v','a','r','i','a','n','t','_','O'
  11767. ,'T','H','E','R','S','_','_','=','>','c'
  11768. ,'h','o','i','c','e','s','t','a','r','t'
  11769. ,'_','b','d','i','{','b','a','s','i','c'
  11770. ,'_','d','e','c','l','a','r','a','t','i'
  11771. ,'v','e','_','i','t','e','m','}','d','e'
  11772. ,'c','l','a','r','a','t','i','v','e','_'
  11773. ,'p','a','r','t','b','o','d','y','{','l'
  11774. ,'a','t','e','r','_','d','e','c','l','a'
  11775. ,'r','a','t','i','v','e','_','i','t','e'
  11776. ,'m','}','b','a','s','i','c','_','d','e'
  11777. ,'c','l','a','r','a','t','i','v','e','_'
  11778. ,'i','t','e','m','r','e','p','r','e','s'
  11779. ,'e','n','t','a','t','i','o','n','_','c'
  11780. ,'l','a','u','s','e','u','s','e','_','c'
  11781. ,'l','a','u','s','e','l','a','t','e','r'
  11782. ,'_','d','e','c','l','a','r','a','t','i'
  11783. ,'v','e','_','i','t','e','m','p','r','o'
  11784. ,'p','e','r','_','b','o','d','y','b','o'
  11785. ,'d','y','_','s','t','u','b','s','u','b'
  11786. ,'p','r','o','g','r','a','m','_','b','o'
  11787. ,'d','y','p','a','c','k','a','g','e','_'
  11788. ,'b','o','d','y','t','a','s','k','_','b'
  11789. ,'o','d','y','i','n','d','e','x','e','d'
  11790. ,'_','c','o','m','p','o','n','e','n','t'
  11791. ,'s','e','l','e','c','t','e','d','_','c'
  11792. ,'o','m','p','o','n','e','n','t','a','t'
  11793. ,'t','r','i','b','u','t','e','s','e','l'
  11794. ,'e','c','t','o','r','a','t','t','r','i'
  11795. ,'b','u','t','e','_','d','e','s','i','g'
  11796. ,'n','a','t','o','r','c','o','m','p','o'
  11797. ,'n','e','n','t','_','a','s','s','o','c'
  11798. ,'i','a','t','i','o','n','s','a','g','g'
  11799. ,'r','e','g','a','t','e','e','x','p','r'
  11800. ,'e','s','s','i','o','n',',','e','x','p'
  11801. ,'r','e','s','s','i','o','n','{',',','e'
  11802. ,'x','p','r','e','s','s','i','o','n','}'
  11803. ,'[',',','o','t','h','e','r','s','=','>'
  11804. ,'e','x','p','r','e','s','s','i','o','n'
  11805. ,']','c','h','o','i','c','e','{','|','c'
  11806. ,'h','o','i','c','e','}','=','>','e','x'
  11807. ,'p','r','e','s','s','i','o','n','{',','
  11808. ,'c','h','o','i','c','e','{','|','c','h'
  11809. ,'o','i','c','e','}','=','>','e','x','p'
  11810. ,'r','e','s','s','i','o','n','}','o','t'
  11811. ,'h','e','r','s','=','>','e','x','p','r'
  11812. ,'e','s','s','i','o','n','g','a','_','e'
  11813. ,'x','p','r','e','s','s','i','o','n','{'
  11814. ,',','g','a','_','e','x','p','r','e','s'
  11815. ,'s','i','o','n','}','i','d','e','n','t'
  11816. ,'i','f','i','e','r','{','|','i','d','e'
  11817. ,'n','t','i','f','i','e','r','}','=','>'
  11818. ,'e','x','p','r','e','s','s','i','o','n'
  11819. ,'{',',','i','d','e','n','t','i','f','i'
  11820. ,'e','r','{','|','i','d','e','n','t','i'
  11821. ,'f','i','e','r','}','=','>','e','x','p'
  11822. ,'r','e','s','s','i','o','n','}','r','e'
  11823. ,'l','a','t','i','o','n','r','e','l','a'
  11824. ,'t','i','o','n','{','A','N','D','_','_'
  11825. ,'r','e','l','a','t','i','o','n','}','r'
  11826. ,'e','l','a','t','i','o','n','{','O','R'
  11827. ,'_','_','r','e','l','a','t','i','o','n'
  11828. ,'}','r','e','l','a','t','i','o','n','{'
  11829. ,'X','O','R','_','_','r','e','l','a','t'
  11830. ,'i','o','n','}','r','e','l','a','t','i'
  11831. ,'o','n','{','A','N','D','_','_','T','H'
  11832. ,'E','N','_','_','r','e','l','a','t','i'
  11833. ,'o','n','}','r','e','l','a','t','i','o'
  11834. ,'n','{','O','R','_','_','E','L','S','E'
  11835. ,'_','_','r','e','l','a','t','i','o','n'
  11836. ,'}','[','r','e','l','a','t','i','o','n'
  11837. ,'a','l','_','o','p','e','r','a','t','o'
  11838. ,'r','_','_','s','i','m','p','l','e','_'
  11839. ,'e','x','p','r','e','s','s','i','o','n'
  11840. ,']','[','N','O','T',']','I','N','[','u'
  11841. ,'n','a','r','y','_','a','d','d','i','n'
  11842. ,'g','_','o','p','e','r','a','t','o','r'
  11843. ,']','t','e','r','m','{','b','i','n','a'
  11844. ,'r','y','_','a','d','d','i','n','g','_'
  11845. ,'o','p','e','r','a','t','o','r','_','_'
  11846. ,'t','e','r','m','}','f','a','c','t','o'
  11847. ,'r','{','m','u','l','t','i','p','l','y'
  11848. ,'i','n','g','_','o','p','e','r','a','t'
  11849. ,'o','r','_','_','f','a','c','t','o','r'
  11850. ,'}','t','e','r','m','p','r','i','m','a'
  11851. ,'r','y','[','e','x','p','o','n','e','n'
  11852. ,'t','i','a','t','i','n','g','_','o','p'
  11853. ,'e','r','a','t','o','r','_','_','p','r'
  11854. ,'i','m','a','r','y',']','f','a','c','t'
  11855. ,'o','r','h','i','g','h','_','p','r','e'
  11856. ,'c','e','d','e','n','c','e','_','u','n'
  11857. ,'a','r','y','_','o','p','e','r','a','t'
  11858. ,'o','r','p','a','r','e','n','t','h','e'
  11859. ,'s','i','z','e','d','_','e','x','p','r'
  11860. ,'e','s','s','i','o','n','a','l','l','o'
  11861. ,'c','a','t','o','r','q','u','a','l','i'
  11862. ,'f','i','e','d','_','e','x','p','r','e'
  11863. ,'s','s','i','o','n','r','e','l','a','t'
  11864. ,'i','o','n','a','l','_','o','p','e','r'
  11865. ,'a','t','o','r','b','i','n','a','r','y'
  11866. ,'_','a','d','d','i','n','g','_','o','p'
  11867. ,'e','r','a','t','o','r','u','n','a','r'
  11868. ,'y','_','a','d','d','i','n','g','_','o'
  11869. ,'p','e','r','a','t','o','r','m','u','l'
  11870. ,'t','i','p','l','y','i','n','g','_','o'
  11871. ,'p','e','r','a','t','o','r','e','x','p'
  11872. ,'o','n','e','n','t','i','a','t','i','n'
  11873. ,'g','_','o','p','e','r','a','t','o','r'
  11874. ,'e','x','p','a','n','d','e','d','_','n'
  11875. ,'a','m','e','{','p','r','a','g','m','a'
  11876. ,'_','s','t','m','}','s','t','a','t','e'
  11877. ,'m','e','n','t','{','s','t','a','t','e'
  11878. ,'m','e','n','t','}','s','e','q','u','e'
  11879. ,'n','c','e','_','o','f','_','s','t','a'
  11880. ,'t','e','m','e','n','t','s','s','i','m'
  11881. ,'p','l','e','_','s','t','a','t','e','m'
  11882. ,'e','n','t','c','o','m','p','o','u','n'
  11883. ,'d','_','s','t','a','t','e','m','e','n'
  11884. ,'t','a','m','b','i','g','u','o','u','s'
  11885. ,'_','s','t','a','t','e','m','e','n','t'
  11886. ,'{','l','a','b','e','l','}','+','b','r'
  11887. ,'e','a','k','_','e','v','e','r','y','_'
  11888. ,'s','t','a','t','e','m','e','n','t','b'
  11889. ,'r','e','a','k','_','d','e','c','i','s'
  11890. ,'i','o','n','_','p','o','i','n','t','e'
  11891. ,'x','i','t','_','s','t','a','t','e','m'
  11892. ,'e','n','t','b','r','e','a','k','_','a'
  11893. ,'l','w','a','y','s','r','e','t','u','r'
  11894. ,'n','_','s','t','a','t','e','m','e','n'
  11895. ,'t','g','o','t','o','_','s','t','a','t'
  11896. ,'e','m','e','n','t','d','e','l','a','y'
  11897. ,'_','s','t','a','t','e','m','e','n','t'
  11898. ,'a','b','o','r','t','_','s','t','a','t'
  11899. ,'e','m','e','n','t','r','a','i','s','e'
  11900. ,'_','s','t','a','t','e','m','e','n','t'
  11901. ,'i','f','_','s','t','a','t','e','m','e'
  11902. ,'n','t','c','a','s','e','_','s','t','a'
  11903. ,'t','e','m','e','n','t','a','c','c','e'
  11904. ,'p','t','_','s','t','a','t','e','m','e'
  11905. ,'n','t','s','e','l','e','c','t','_','s'
  11906. ,'t','a','t','e','m','e','n','t','b','r'
  11907. ,'e','a','k','_','a','m','b','i','g','u'
  11908. ,'o','u','s','a','s','s','i','g','n','m'
  11909. ,'e','n','t','_','s','t','a','t','e','m'
  11910. ,'e','n','t','c','a','l','l','_','s','t'
  11911. ,'a','t','e','m','e','n','t','c','o','d'
  11912. ,'e','_','s','t','a','t','e','m','e','n'
  11913. ,'t','l','o','o','p','_','s','t','a','t'
  11914. ,'e','m','e','n','t','b','l','o','c','k'
  11915. ,'_','s','t','a','t','e','m','e','n','t'
  11916. ,'r','e','s','o','l','v','e','_','s','i'
  11917. ,'m','p','l','e','l','a','b','e','l','c'
  11918. ,'o','n','d','i','t','i','o','n','_','_'
  11919. ,'T','H','E','N','_','_','s','e','q','u'
  11920. ,'e','n','c','e','_','o','f','_','s','t'
  11921. ,'a','t','e','m','e','n','t','s','{','E'
  11922. ,'L','S','I','F','_','_','c','o','n','d'
  11923. ,'i','t','i','o','n','_','_','T','H','E'
  11924. ,'N','_','_','s','e','q','u','e','n','c'
  11925. ,'e','_','o','f','_','s','t','a','t','e'
  11926. ,'m','e','n','t','s','}','[','E','L','S'
  11927. ,'E','_','_','s','e','q','u','e','n','c'
  11928. ,'e','_','o','f','_','s','t','a','t','e'
  11929. ,'m','e','n','t','s',']','c','o','n','d'
  11930. ,'i','t','i','o','n','C','A','S','E','_'
  11931. ,'_','e','x','p','r','e','s','s','i','o'
  11932. ,'n','_','_','I','S','{','p','r','a','g'
  11933. ,'m','a','_','a','l','t','}','_','_','c'
  11934. ,'a','s','e','_','s','t','a','t','e','m'
  11935. ,'e','n','t','_','a','l','t','e','r','n'
  11936. ,'a','t','i','v','e','_','_','{','c','a'
  11937. ,'s','e','_','s','t','a','t','e','m','e'
  11938. ,'n','t','_','a','l','t','e','r','n','a'
  11939. ,'t','i','v','e','}','W','H','E','N','_'
  11940. ,'_','c','a','s','e','_','c','h','o','i'
  11941. ,'c','e','_','_','{','|','c','h','o','i'
  11942. ,'c','e','}','_','_','=','>','c','a','s'
  11943. ,'e','_','s','t','a','t','e','m','e','n'
  11944. ,'t','_','a','l','t','e','r','n','a','t'
  11945. ,'i','v','e','W','H','E','N','_','_','c'
  11946. ,'a','s','e','_','O','T','H','E','R','S'
  11947. ,'_','_','=','>','[','l','o','o','p','_'
  11948. ,'i','d','e','n','t','i','f','i','e','r'
  11949. ,':',']','l','o','o','p','_','t','e','r'
  11950. ,'m','i','n','a','l','[','i','d','e','n'
  11951. ,'t','i','f','i','e','r',']','i','t','e'
  11952. ,'r','a','t','i','o','n','_','r','u','l'
  11953. ,'e','b','e','g','i','n','_','e','n','d'
  11954. ,'_','b','l','o','c','k','d','e','c','l'
  11955. ,'a','r','a','t','i','v','e','_','p','a'
  11956. ,'r','t','_','_','b','e','g','i','n','_'
  11957. ,'e','n','d','_','b','l','o','c','k','b'
  11958. ,'e','g','i','n','_','t','e','r','m','i'
  11959. ,'n','a','l','s','e','q','u','e','n','c'
  11960. ,'e','_','o','f','_','s','t','a','t','e'
  11961. ,'m','e','n','t','s','_','_','e','n','d'
  11962. ,'_','b','l','o','c','k','_','s','t','a'
  11963. ,'t','e','m','e','n','t','s','[','e','x'
  11964. ,'c','e','p','t','i','o','n','_','h','a'
  11965. ,'n','d','l','e','r','_','p','a','r','t'
  11966. ,']','[','b','l','o','c','k','_','i','d'
  11967. ,'e','n','t','i','f','i','e','r',':',']'
  11968. ,'d','e','c','l','a','r','e','_','t','e'
  11969. ,'r','m','i','n','a','l','s','u','b','p'
  11970. ,'r','o','g','r','a','m','_','s','p','e'
  11971. ,'c','i','f','i','c','a','t','i','o','n'
  11972. ,'s','t','a','r','t','_','i','d','e','n'
  11973. ,'t','i','f','i','e','r','p','a','r','a'
  11974. ,'m','e','t','e','r','_','s','p','e','c'
  11975. ,'i','f','i','c','a','t','i','o','n','{'
  11976. ,';','p','a','r','a','m','e','t','e','r'
  11977. ,'_','s','p','e','c','i','f','i','c','a'
  11978. ,'t','i','o','n','}','d','e','s','i','g'
  11979. ,'n','a','t','o','r','m','o','d','e','g'
  11980. ,'e','n','e','r','i','c','_','p','a','r'
  11981. ,'a','m','e','t','e','r','_','m','o','d'
  11982. ,'e','s','u','b','p','r','o','g','r','a'
  11983. ,'m','_','s','p','e','c','i','f','i','c'
  11984. ,'a','t','i','o','n','_','_','I','S','['
  11985. ,'e','n','d','_','d','e','s','i','g','n'
  11986. ,'a','t','o','r',']','p','a','c','k','a'
  11987. ,'g','e','_','s','p','e','c','i','f','i'
  11988. ,'c','a','t','i','o','n','P','A','C','K'
  11989. ,'A','G','E','_','_','s','t','a','r','t'
  11990. ,'_','i','d','e','n','t','i','f','i','e'
  11991. ,'r','_','_','I','S','{','b','a','s','i'
  11992. ,'c','_','d','e','c','l','a','r','a','t'
  11993. ,'i','v','e','_','i','t','e','m','}','''
  11994. ,'p','r','i','v','a','t','e','_','t','e'
  11995. ,'r','m','i','n','a','l','P','A','C','K'
  11996. ,'A','G','E','_','_','B','O','D','Y','_'
  11997. ,'_','s','t','a','r','t','_','i','d','e'
  11998. ,'n','t','i','f','i','e','r','_','_','I'
  11999. ,'S','d','e','c','l','a','r','a','t','i'
  12000. ,'v','e','_','p','a','r','t','_','_','n'
  12001. ,'o','_','b','e','g','i','n','p','a','c'
  12002. ,'k','a','g','e','_','n','a','m','e','{'
  12003. ,',','p','a','c','k','a','g','e','_','n'
  12004. ,'a','m','e','}','T','A','S','K','_','_'
  12005. ,'s','t','a','r','t','_','i','d','e','n'
  12006. ,'t','i','f','i','e','r','_','_','I','S'
  12007. ,'{','e','n','t','r','y','_','d','e','c'
  12008. ,'l','a','r','a','t','i','o','n','}','_'
  12009. ,'_','{','r','e','p','r','e','s','e','n'
  12010. ,'t','a','t','i','o','n','_','c','l','a'
  12011. ,'u','s','e','}','T','A','S','K','_','_'
  12012. ,'T','Y','P','E','_','_','s','t','a','r'
  12013. ,'t','_','i','d','e','n','t','i','f','i'
  12014. ,'e','r','_','_','I','S','T','A','S','K'
  12015. ,'_','_','B','O','D','Y','_','_','s','t'
  12016. ,'a','r','t','_','i','d','e','n','t','i'
  12017. ,'f','i','e','r','_','_','I','S','[','('
  12018. ,'d','i','s','c','r','e','t','e','_','r'
  12019. ,'a','n','g','e',')',']','[','f','o','r'
  12020. ,'m','a','l','_','p','a','r','t',']','e'
  12021. ,'n','t','r','y','_','d','e','c','l','a'
  12022. ,'r','a','t','i','o','n','[','(','e','x'
  12023. ,'p','r','e','s','s','i','o','n',')',']'
  12024. ,'[','f','o','r','m','a','l','_','p','a'
  12025. ,'r','t',']','A','C','C','E','P','T','_'
  12026. ,'_','s','t','a','r','t','_','i','d','e'
  12027. ,'n','t','i','f','i','e','r','_','_','['
  12028. ,'(','e','x','p','r','e','s','s','i','o'
  12029. ,'n',')',']','[','f','o','r','m','a','l'
  12030. ,'_','p','a','r','t',']','_','_','D','O'
  12031. ,'D','E','L','A','Y','_','_','s','t','a'
  12032. ,'r','t','_','d','e','l','a','y','_','e'
  12033. ,'x','p','r','e','s','s','i','o','n','s'
  12034. ,'i','m','p','l','e','_','e','x','p','r'
  12035. ,'e','s','s','i','o','n','_','_','e','n'
  12036. ,'d','_','d','e','l','a','y','_','e','x'
  12037. ,'p','r','e','s','s','i','o','n','s','e'
  12038. ,'l','e','c','t','i','v','e','_','w','a'
  12039. ,'i','t','c','o','n','d','i','t','i','o'
  12040. ,'n','a','l','_','e','n','t','r','y','_'
  12041. ,'c','a','l','l','t','i','m','e','d','_'
  12042. ,'e','n','t','r','y','_','c','a','l','l'
  12043. ,'s','e','l','e','c','t','_','t','e','r'
  12044. ,'m','i','n','a','l','s','e','l','e','c'
  12045. ,'t','_','a','l','t','e','r','n','a','t'
  12046. ,'i','v','e','{','O','R','_','_','s','e'
  12047. ,'l','e','c','t','_','a','l','t','e','r'
  12048. ,'n','a','t','i','v','e','}','W','H','E'
  12049. ,'N','_','_','c','o','n','d','i','t','i'
  12050. ,'o','n','_','_','=','>','_','_','s','e'
  12051. ,'l','e','c','t','i','v','e','_','w','a'
  12052. ,'i','t','_','a','l','t','e','r','n','a'
  12053. ,'t','i','v','e','s','e','l','e','c','t'
  12054. ,'i','v','e','_','w','a','i','t','_','a'
  12055. ,'l','t','e','r','n','a','t','i','v','e'
  12056. ,'a','c','c','e','p','t','_','a','l','t'
  12057. ,'e','r','n','a','t','i','v','e','d','e'
  12058. ,'l','a','y','_','a','l','t','e','r','n'
  12059. ,'a','t','i','v','e','t','e','r','m','i'
  12060. ,'n','a','t','e','_','a','l','t','e','r'
  12061. ,'n','a','t','i','v','e','a','c','c','e'
  12062. ,'p','t','_','s','t','a','t','e','m','e'
  12063. ,'n','t','_','_','d','e','c','i','s','i'
  12064. ,'o','n','_','p','o','i','n','t','[','s'
  12065. ,'e','q','u','e','n','c','e','_','o','f'
  12066. ,'_','s','t','a','t','e','m','e','n','t'
  12067. ,'s',']','d','e','l','a','y','_','s','t'
  12068. ,'a','t','e','m','e','n','t','_','_','d'
  12069. ,'e','c','i','s','i','o','n','_','p','o'
  12070. ,'i','n','t','T','E','R','M','I','N','A'
  12071. ,'T','E','_','_',';','c','a','l','l','_'
  12072. ,'s','t','a','t','e','m','e','n','t','_'
  12073. ,'_','[','s','e','q','u','e','n','c','e'
  12074. ,'_','o','f','_','s','t','a','t','e','m'
  12075. ,'e','n','t','s',']','e','l','s','e','_'
  12076. ,'t','e','r','m','i','n','a','l','o','r'
  12077. ,'_','t','e','r','m','i','n','a','l','d'
  12078. ,'e','l','a','y','_','a','l','t','e','r'
  12079. ,'n','a','t','i','v','e','_','i','n','_'
  12080. ,'t','i','m','e','d','_','e','n','t','r'
  12081. ,'y','c','a','l','l','_','s','t','a','t'
  12082. ,'e','m','e','n','t','_','_','d','e','c'
  12083. ,'i','s','i','o','n','_','p','o','i','n'
  12084. ,'t','{',',','n','a','m','e','}','{','c'
  12085. ,'o','m','p','i','l','a','t','i','o','n'
  12086. ,'_','u','n','i','t','}','p','r','a','g'
  12087. ,'m','a','_','h','e','a','d','e','r','c'
  12088. ,'o','m','p','i','l','a','t','i','o','n'
  12089. ,'_','u','n','i','t','c','o','n','t','e'
  12090. ,'x','t','_','c','l','a','u','s','e','l'
  12091. ,'i','b','r','a','r','y','_','o','r','_'
  12092. ,'s','e','c','o','n','d','a','r','y','_'
  12093. ,'u','n','i','t','s','u','b','u','n','i'
  12094. ,'t','{','w','i','t','h','_','c','l','a'
  12095. ,'u','s','e','{','u','s','e','_','c','l'
  12096. ,'a','u','s','e','}','}','l','i','b','r'
  12097. ,'a','r','y','_','u','n','i','t','_','n'
  12098. ,'a','m','e','{',',','l','i','b','r','a'
  12099. ,'r','y','_','u','n','i','t','_','n','a'
  12100. ,'m','e','}','w','i','t','h','_','c','l'
  12101. ,'a','u','s','e','S','E','P','A','R','A'
  12102. ,'T','E','_','_','(','_','_','e','x','p'
  12103. ,'a','n','d','e','d','_','n','a','m','e'
  12104. ,'_','_',')','{','n','o','n','_','o','t'
  12105. ,'h','e','r','s','_','h','a','n','d','l'
  12106. ,'e','r','}','[','o','t','h','e','r','s'
  12107. ,'_','h','a','n','d','l','e','r',']','e'
  12108. ,'x','c','e','p','t','i','o','n','_','h'
  12109. ,'a','n','d','l','e','r','o','t','h','e'
  12110. ,'r','s','_','h','a','n','d','l','e','r'
  12111. ,'W','H','E','N','_','_','e','x','c','e'
  12112. ,'p','t','i','o','n','_','c','h','o','i'
  12113. ,'c','e','_','_','{','|','e','x','c','e'
  12114. ,'p','t','i','o','n','_','c','h','o','i'
  12115. ,'c','e','}','_','_','=','>','n','o','n'
  12116. ,'_','o','t','h','e','r','s','_','h','a'
  12117. ,'n','d','l','e','r','W','H','E','N','_'
  12118. ,'_','e','x','c','e','p','t','i','o','n'
  12119. ,'_','O','T','H','E','R','S','_','_','='
  12120. ,'>','e','x','c','e','p','t','i','o','n'
  12121. ,'_','c','h','o','i','c','e','g','e','n'
  12122. ,'e','r','i','c','_','f','o','r','m','a'
  12123. ,'l','_','p','a','r','t','g','e','n','e'
  12124. ,'r','i','c','_','t','e','r','m','i','n'
  12125. ,'a','l','{','g','e','n','e','r','i','c'
  12126. ,'_','p','a','r','a','m','e','t','e','r'
  12127. ,'_','d','e','c','l','a','r','a','t','i'
  12128. ,'o','n','}','g','e','n','e','r','i','c'
  12129. ,'_','p','a','r','a','m','e','t','e','r'
  12130. ,'_','d','e','c','l','a','r','a','t','i'
  12131. ,'o','n','g','e','n','e','r','i','c','_'
  12132. ,'t','y','p','e','_','d','e','f','i','n'
  12133. ,'i','t','i','o','n','[','I','S','_','_'
  12134. ,'n','a','m','e','_','_','o','r','_','_'
  12135. ,'<','>',']','I','S','_','_','N','E','W'
  12136. ,'_','_','e','x','p','a','n','d','e','d'
  12137. ,'_','n','a','m','e','g','e','n','e','r'
  12138. ,'i','c','_','a','s','s','o','c','i','a'
  12139. ,'t','i','o','n','{',',','g','e','n','e'
  12140. ,'r','i','c','_','a','s','s','o','c','i'
  12141. ,'a','t','i','o','n','}','g','e','n','e'
  12142. ,'r','i','c','_','i','n','s','t','a','n'
  12143. ,'t','i','a','t','i','o','n','_','I','S'
  12144. ,'[','g','e','n','e','r','i','c','_','f'
  12145. ,'o','r','m','a','l','_','p','a','r','a'
  12146. ,'m','e','t','e','r','=','>',']','g','e'
  12147. ,'n','e','r','i','c','_','a','c','t','u'
  12148. ,'a','l','_','p','a','r','a','m','e','t'
  12149. ,'e','r','g','e','n','e','r','i','c','_'
  12150. ,'f','o','r','m','a','l','_','p','a','r'
  12151. ,'a','m','e','t','e','r','g','e','n','e'
  12152. ,'r','i','c','_','a','c','t','u','a','l'
  12153. ,'_','p','a','r','a','m','e','t','e','r'
  12154. ,'l','e','n','g','t','h','_','c','l','a'
  12155. ,'u','s','e','e','n','u','m','e','r','a'
  12156. ,'t','i','o','n','_','r','e','p','r','e'
  12157. ,'s','e','n','t','a','t','i','o','n','_'
  12158. ,'c','l','a','u','s','e','a','d','d','r'
  12159. ,'e','s','s','_','c','l','a','u','s','e'
  12160. ,'r','e','c','o','r','d','_','r','e','p'
  12161. ,'r','e','s','e','n','t','a','t','i','o'
  12162. ,'n','_','c','l','a','u','s','e','r','e'
  12163. ,'p','s','p','e','c','_','r','e','c','o'
  12164. ,'r','d','_','t','e','r','m','i','n','a'
  12165. ,'l','{','c','o','m','p','o','n','e','n'
  12166. ,'t','_','c','l','a','u','s','e','}','''
  12167. ,'a','l','i','g','n','m','e','n','t','_'
  12168. ,'c','l','a','u','s','e','c','o','m','p'
  12169. ,'o','n','e','n','t','_','c','l','a','u'
  12170. ,'s','e','{','p','r','a','g','m','a','_'
  12171. ,'v','a','r','i','a','n','t','}','{','p'
  12172. ,'r','a','g','m','a','_','a','l','t','}'
  12173. ,'d','i','s','c','r','i','m','i','n','a'
  12174. ,'n','t','_','_',';','{','v','a','r','i'
  12175. ,'a','n','t','}','{','|','c','h','o','i'
  12176. ,'c','e','}','{','b','a','s','i','c','_'
  12177. ,'d','e','c','l','a','r','a','t','i','v'
  12178. ,'e','_','i','t','e','m','}','_','_','b'
  12179. ,'a','s','i','c','_','d','e','c','l','a'
  12180. ,'r','a','t','i','v','e','_','i','t','e'
  12181. ,'m','|','E','M','P','T','Y','{','b','a'
  12182. ,'s','i','c','_','c','o','l','o','n','_'
  12183. ,'d','e','c','l','a','r','a','t','i','o'
  12184. ,'n','}','g','a','_','e','x','p','r','e'
  12185. ,'s','s','i','o','n','{','|','i','d','e'
  12186. ,'n','t','i','f','i','e','r','}','c','o'
  12187. ,'n','d','i','t','i','o','n','_','_','T'
  12188. ,'H','E','N','E','L','S','I','F','_','_'
  12189. ,'c','o','n','d','i','t','i','o','n','_'
  12190. ,'_','T','H','E','N','{','c','a','s','e'
  12191. ,'_','s','t','a','t','e','m','e','n','t'
  12192. ,'_','a','l','t','e','r','n','a','t','i'
  12193. ,'v','e','}','e','x','c','e','p','t','i'
  12194. ,'o','n','_','t','e','r','m','i','n','a'
  12195. ,'l','{','p','r','a','g','m','a','_','a'
  12196. ,'l','t','}','_','_','e','x','c','e','p'
  12197. ,'t','i','o','n','_','h','a','n','d','l'
  12198. ,'e','r','p','a','r','a','m','e','t','e'
  12199. ,'r','_','_',';','{','e','n','t','r','y'
  12200. ,'_','d','e','c','l','a','r','a','t','i'
  12201. ,'o','n','}','{','r','e','p','r','e','s'
  12202. ,'e','n','t','a','t','i','o','n','_','c'
  12203. ,'l','a','u','s','e','}','o','p','t','i'
  12204. ,'o','n','a','l','_','s','e','q','u','e'
  12205. ,'n','c','e','_','o','f','_','s','t','a'
  12206. ,'t','e','m','e','n','t','s','u','s','e'
  12207. ,'_','c','l','a','u','s','e','_','l','i'
  12208. ,'s','t','{','|','e','x','c','e','p','t'
  12209. ,'i','o','n','_','c','h','o','i','c','e'
  12210. ,'}','{','c','o','m','p','o','n','e','n'
  12211. ,'t','_','c','l','a','u','s','e','}','C'
  12212. ,'A','S','E','_','_','i','d','e','n','t'
  12213. ,'i','f','i','e','r','W','H','E','N','_'
  12214. ,'_','c','h','o','i','c','e','_','_','{'
  12215. ,'|','c','h','o','i','c','e','}','_','_'
  12216. ,'=','>','W','H','E','N','_','_','O','T'
  12217. ,'H','E','R','S','_','_','=','>','W','H'
  12218. ,'E','N','_','_','c','o','n','d','i','t'
  12219. ,'i','o','n','_','_','=','>','S','E','P'
  12220. ,'A','R','A','T','E','_','_','(','_','_'
  12221. ,'e','x','p','a','n','d','e','d','_','n'
  12222. ,'a','m','e','s','t','a','r','t','_','{'
  12223. ,'b','a','s','i','c','_','c','o','l','o'
  12224. ,'n','_','d','e','c','l','a','r','a','t'
  12225. ,'i','o','n','}','{','b','a','s','i','c'
  12226. ,'_','c','o','l','o','n','_','d','e','c'
  12227. ,'l','a','r','a','t','i','o','n','}','''
  12228.  ) ;
  12229.         --| Table of symbols used in the grammar.
  12230.         -- NYU Reference Name: NO_SYM
  12231.     
  12232.     LeftHandSide :
  12233.          constant array (LeftHandSideRange)
  12234.          of GrammarSymbolRange :=
  12235.           (  100,  100,  102,  102,  102,  102,  102,  102,  102,  102
  12236. ,  111,  111,  111,  111,  110,  110,  110,  110,  118,  120
  12237. ,  112,  115,  122,  101,  101,  101,  124,  124,  127,  128
  12238. ,  128,  128,  128,  128,  128,  128,  103,  116,  116,  140
  12239. ,  141,  141,  141,  141,  139,  143,  143,  133,  148,  150
  12240. ,  150,  134,  135,  135,  144,  151,  145,  153,  136,  136
  12241. ,  154,  119,  155,  157,  159,  159,  161,  161,  137,  164
  12242. ,  164,  164,  167,  130,  170,  176,  176,  174,  178,  178
  12243. ,  178,  138,  125,  125,  181,  181,  179,  184,  184,  184
  12244. ,  187,  187,  187,  187,  187,  187,  187,  182,  182,  188
  12245. ,  188,  188,  158,  158,  158,  158,  158,  158,  193,  194
  12246. ,  194,  196,  196,  196,  195,  197,  197,  197,  197,  199
  12247. ,  198,  198,  198,  198,  198,  198,   99,   99,   99,  121
  12248. ,  121,  121,  121,  121,  121,  208,  208,  147,  218,  221
  12249. ,  221,  223,  219,  219,  219,  219,  219,  219,  219,  226
  12250. ,  226,  226,  226,  226,  226,  227,  227,  227,  228,  228
  12251. ,  222,  222,  229,  229,  229,  229,  230,  225,  225,  224
  12252. ,  224,  224,  224,  235,  233,  233,  233,  233,  233,  233
  12253. ,  236,  236,  236,  236,  236,  236,  236,  237,  237,  237
  12254. ,  237,  238,  238,  238,  238,  238,  240,  241,  243,  253
  12255. ,  259,  260,  171,  254,  249,  264,  250,  268,  268,  257
  12256. ,  257,  273,  273,  273,  275,  274,  277,  258,  258,  242
  12257. ,  242,  242,  242,  244,  244,  245,  104,  281,  281,  281
  12258. ,  281,  285,  285,  283,  286,  286,  287,  287,  287,  190
  12259. ,  255,  105,  290,  290,  191,  191,  295,  126,  126,  126
  12260. ,  126,  186,  296,  114,  114,  109,  109,  106,  106,  106
  12261. ,  106,  192,  303,  251,  251,  246,  306,  307,  252,  252
  12262. ,  252,  308,  312,  312,  315,  315,  315,  316,  317,  318
  12263. ,  322,  309,  310,  319,  321,  327,  247,   98,  330,  331
  12264. ,  331,  331,  333,  333,  333,  333,  333,  333,  333,  332
  12265. ,  338,  336,  189,  189,  189,  334,  113,  342,  342,  345
  12266. ,  343,  347,  248,  248,  107,  107,  348,  351,  351,  351
  12267. ,  351,  352,  352,  352,  352,  352,  352,  352,  352,  108
  12268. ,  108,  108,  108,  108,  108,  354,  357,  355,  359,  359
  12269. ,  360,  185,  185,  185,  185,  361,  362,  364,  364,  368
  12270. ,  367,  363,  256,  165,  165,  369,  369,  232,  232,  370
  12271. ,  370,  117,  117,  123,  123,  142,  231,  231,  149,  149
  12272. ,  152,  152,  156,  156,  160,  160,  166,  166,  131,  131
  12273. ,  372,  372,  373,  373,  180,  180,  180,  183,  183,  200
  12274. ,  200,  202,  203,  203,  201,  201,  204,  376,  376,  376
  12275. ,  205,  205,  206,  207,  207,  377,  377,  209,  209,  210
  12276. ,  210,  211,  211,  212,  212,  213,  213,  214,  214,  215
  12277. ,  215,  216,  216,  216,  217,  217,  220,  220,  234,  234
  12278. ,  239,  239,  261,  262,  262,  263,  263,  380,  380,  270
  12279. ,  270,  272,  272,  279,  279,  278,  278,  382,  340,  340
  12280. ,  341,  341,  284,  284,  289,  289,  289,  297,  297,  384
  12281. ,  384,  385,  385,  302,  302,  302,  302,  304,  304,  304
  12282. ,  304,  313,  313,  320,  320,  328,  328,  329,  329,  335
  12283. ,  335,  387,  387,  337,  337,  388,  388,  350,  350,  353
  12284. ,  353,  353,  356,  356,  358,  358,  389,  389,  163,  168
  12285. ,  169,  162,  365,  172,  391,  392,  265,  349,  390,  175
  12286. ,  177,  267,  269,  266,  271,  276,  173,  280,  291,  282
  12287. ,  292,  299,  293,  294,  298,  300,  301,  305,  311,  323
  12288. ,  386,  326,  314,  393,  381,  344,  346,  288,  366,  339
  12289. ,  394,  146,  375,  395,  396,  396,  374,  374,  378,  379
  12290. ,  324,  325,  371,  383,  129,  132)  ;
  12291.         --| Map of the grammar rule number (constant array index) to
  12292.         --| numeric value of left hand side symbol.
  12293.         -- NYU Reference Name: LHS
  12294.  
  12295.     RightHandSide :
  12296.          constant array (RightHandSideRange)
  12297.          of GC.ParserInteger :=
  12298.           (    6,    3,    1,    1,    1,    1,    1,    1,    1,    1
  12299. ,    1,    1,    1,    1,    5,    6,    7,    8,    0,    0
  12300. ,    6,    2,    1,    1,    1,    1,    4,    8,    1,    2
  12301. ,    2,    2,    2,    2,    2,    2,    5,    1,    2,    1
  12302. ,    1,    1,    1,    3,    3,    2,    4,    4,    1,    1
  12303. ,    1,    1,    1,    1,    2,    2,    2,    2,    1,    1
  12304. ,    7,    4,    3,    4,    2,    1,    1,    3,    5,    4
  12305. ,    4,    2,    5,    5,    5,    3,    3,    0,    1,    3
  12306. ,    2,    2,    3,    7,    2,    4,    0,    1,    1,    1
  12307. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1
  12308. ,    1,    1,    1,    1,    1,    1,    1,    1,    4,    3
  12309. ,    3,    1,    1,    1,    3,    1,    1,    1,    1,    3
  12310. ,    2,    5,    5,    3,    3,    1,    1,    4,    2,    1
  12311. ,    1,    1,    1,    1,    1,    2,    3,    1,    1,    2
  12312. ,    2,    3,    1,    1,    1,    1,    1,    1,    1,    1
  12313. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1
  12314. ,    1,    1,    1,    1,    1,    1,    1,    3,    3,    2
  12315. ,    5,    4,    4,    3,    1,    1,    1,    2,    2,    2
  12316. ,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2
  12317. ,    2,    2,    2,    2,    2,    2,    0,    0,    0,    0
  12318. ,    0,    3,    2,    5,    7,    1,    5,    2,    2,    7
  12319. ,    8,    2,    4,    5,    2,    4,    1,    5,    4,    2
  12320. ,    4,    3,    5,    2,    3,    3,    2,    2,    6,    5
  12321. ,    9,    1,    1,    4,    1,    2,    1,    2,    3,    4
  12322. ,    3,    2,    4,    6,    5,    4,    1,    6,   10,    5
  12323. ,    9,    4,    2,    6,    6,    5,    4,    3,    4,    5
  12324. ,    5,    4,    4,    4,    5,    3,    1,    1,    1,    1
  12325. ,    1,    7,    2,    2,    1,    1,    1,    2,    2,    2
  12326. ,    2,    8,    9,    1,    1,    1,    4,    1,    2,    5
  12327. ,    2,    2,    1,    1,    1,    1,    1,    1,    1,    1
  12328. ,    4,    1,    4,    6,    6,    2,    4,    2,    1,    2
  12329. ,    2,    1,    2,    3,    3,    3,    2,    5,    5,    9
  12330. ,    4,    3,    2,    2,    2,    2,    1,    1,    1,    4
  12331. ,    8,    4,    8,    3,    7,    4,    1,    1,    1,    1
  12332. ,    1,    1,    1,    1,    1,    5,    5,    9,   10,    5
  12333. ,    4,    6,    5,    0,    2,    0,    2,    0,    2,    0
  12334. ,    2,    0,    2,    0,    3,    1,    1,    3,    0,    3
  12335. ,    0,    1,    0,    3,    0,    3,    0,    3,    0,    3
  12336. ,    0,    2,    0,    3,    1,    3,    2,    1,    3,    3
  12337. ,    3,    4,    0,    3,    0,    2,    3,    1,    3,    2
  12338. ,    1,    3,    4,    0,    3,    0,    3,    3,    3,    3
  12339. ,    3,    3,    3,    4,    4,    4,    4,    0,    2,    1
  12340. ,    2,    1,    2,    3,    1,    3,    0,    2,    1,    3
  12341. ,    1,    2,    2,    0,    3,    0,    2,    0,    2,    0
  12342. ,    2,    0,    1,    0,    2,    0,    2,    2,    1,    2
  12343. ,    0,    1,    0,    3,    0,    1,    1,    0,    3,    1
  12344. ,    3,    0,    3,    0,    4,    3,    7,    0,    4,    3
  12345. ,    7,    0,    3,    1,    1,    0,    3,    1,    2,    0
  12346. ,    3,    1,    3,    0,    3,    0,    3,    0,    2,    0
  12347. ,    2,    2,    0,    3,    1,    3,    1,    3,    1,    1
  12348. ,    1,    0,    1,    2,    4,    3,    3,    1,    2,    1
  12349. ,    1,    1,    1,    3,    1,    1,    3,    1,    3,    1
  12350. ,    1,    2,    1,    4,    3,    4,    4,    4,    1,    2
  12351. ,    3,    1,    2,    3,    1,    4,    3,    2,    1,    2
  12352. ,    4,    0,    4,    0,    3,    0,    3,    1,    2,    3
  12353. ,    1,    1,    1,    1,    1,    1)  ;
  12354.         --| Map of the grammar rule number (constant array index) to
  12355.         --| size of right hand sides (number of symbols).
  12356.         -- NYU Reference Name: RHS
  12357.  
  12358.     ActionTableOne :
  12359.          constant array (ActionTableOneRange)
  12360.          of GC.ParserInteger :=
  12361.           ( 7335,  413,  414,    0, 7337,    0, 7339,   33,  249,    0
  12362. ,    0,    0,  929,    0, 7342,   65, 7344,   67,    0, 7346
  12363. , 7348, 7350, 7353, 7355,    0,    0,   73,  672,    0,    0
  12364. ,    0,  893,  286,  492,  618,    0,    0,    0,    0,    0
  12365. ,   25,    0,   26, 7357,    0,    0,   28,    0,    0,    0
  12366. ,  218,    0,  219,  106,    0,    0,    0,    0,    0,    0
  12367. ,    0,    0,    0,  195,    0,    0,    0,    0,    0,    0
  12368. ,    0,  265,    0,    0,    0, 1036,    0,    0, 7360, 7362
  12369. ,   54,    0,  796,  797,   55, 7364,    0,    0,  589,    0
  12370. ,    0,  333,    0,   58,   59,   60,   61, 7366, 7368,    0
  12371. ,   32, 7370,   65,   66,   67,    0,   68,   69,   70,   71
  12372. ,   72,    0,    0,   73,    0,    0,    0, 7372,   53,   54
  12373. ,    0,    0,    0,   55,    0,  174,    0,    0,    0,    0
  12374. ,    0,    0,    0,    0,    0,    0,  241,    0,    0,    0
  12375. ,   64,   65, 7375,   67,  340,   68,   69,   70,   71, 7377
  12376. ,    0,    0, 7379,    0,    0,    0,    0,    0,    0, 1578
  12377. ,    0,    0,    0,    0,    0,    0,    0,  626,    0,    0
  12378. ,    0,    0,    0,    0, 7381, 1578, 7383,    0,    0,    0
  12379. ,    0,  443,  444, 7385, 7387,  447,  448,  349,    0,    0
  12380. ,    0, 1578, 1578,  243, 1578,    0,    0,    0,    0,    0
  12381. ,  116,    0,    0,  493, 1578, 1578,    0,    0, 1578, 1578
  12382. ,    0,  269,  270,    0, 1578,    0,    0,    0,    0,    0
  12383. ,    0,    0,    0,   37,    0,    0,    0,    0,    0,   78
  12384. ,    0,    0,    0,    0,    0,    0,  879,    0,    0,    0
  12385. , 1018,    0,  271,    0,    0,  691,    0,    0,    0,    0
  12386. ,    0, 1010,    0,    0,    0,   38,   39,   40,    0,    0
  12387. ,  272,    0,  604,    0,    0, 7389,   45,    0,    0,  942
  12388. ,    0,    0,  943,  852,    0,  550,    0,  118,    0,    0
  12389. ,    0,    0,   91,   79,    0,  122,   42,   43,   44,    0
  12390. ,    0, 7391,    0,    0,   46,    0,   47, 7393,  360,   37
  12391. ,    0,    0,    0,    0,    0, 1143,    0,    0,    0,    0
  12392. ,    0,    0,    0,  424, 7395,   79,    0,    0,  627,    0
  12393. ,  147,    0,    0,    0,    0,    0,  741,    0, 1143,    0
  12394. ,    0,   38, 7397,   40, 1143,    0,    0, 1143,    0,    0
  12395. , 7399,  635,   43,   44,    0, 1143,   84, 1143,    0,    0
  12396. ,    0,    0,    0,    0,    0,    0,    0,    0,  456,  799
  12397. ,  555, 7401, 7404, 7406,   44,    0,  390, 7408, 1143, 7411
  12398. , 1143, 1143, 7413, 7415, 7417, 1143, 1143, 1063,  171, 1143
  12399. , 1143, 1143,    0,  176, 1143, 1143,    0, 1143, 1143, 1143
  12400. ,    0,  144,  273,    0,  274,    0,    0,  930,    0,    0
  12401. ,    0,    0,  122,   42,   43,   44,    0,    0,   45,    0
  12402. ,    0,   46,    0, 7419,   53, 7421,    0,    0,  275,   55
  12403. ,    0,    0,    0,    0,    0,    0,  377,  854,   58, 7423
  12404. , 7425,   61,   62, 7427,    0,    0,   64,   65,   66,   67
  12405. ,    2, 7430, 7432,   70,   71,   72,    0,    0, 7434,    0
  12406. ,    0,   86,    0,  503, 7436,    0,    0,    0,  635,    0
  12407. ,    0,    0,    0,    0,    0,    0,    0,    0,   52,   53
  12408. ,   54,    0,    0,    0,    0,    0,    0,    0,    0,  836
  12409. ,    0,    0,  154,    0, 7438,  674,    0,  675,  676, 7440
  12410. ,   53, 7442,    0,    0,    0, 7444,    0,  574,    0,    0
  12411. ,   80,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12412. ,   37,    0,    0,   65, 7450,   67,    0, 7452,   69, 7454
  12413. ,   71,   72,    0,    0, 7456,  614,    0,    0,    0,  337
  12414. ,   52,   53, 7458,   37,    0,    0,   55,    0,    0,    0
  12415. ,    0,    0,   38,   39,   40,   58,   59, 7460, 7464,   62
  12416. ,   63,    0,  378,   64, 7466,   66, 7468,  804,   68,   69
  12417. ,   70,   71,   72,  805,    0, 7470,   39,   40,    0,    0
  12418. ,    0,  730,  122,   42,   43, 7472,    0,    0,   45,    0
  12419. ,    0,   46,    0, 7474,    0,    0,    0,    0,    0,    0
  12420. ,    0,    0,    0,    0,  403, 7476,   42,   43,   44,    0
  12421. ,    0, 7478,    0,    0,   46,    0,   47,    0,    0,    0
  12422. ,    0, 7480,  404,    0,    0,    0,    0,    0,    0,    0
  12423. , 7482,    0,    0,   86,  247,    0,    0,   38,   39, 7484
  12424. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12425. ,    0,  381,  692, 7486,   39,   40,    0,  872,    0,    0
  12426. ,    0,   49,    0,    0,  462,    0,  341, 7488,   42,   43
  12427. , 7490,    0,    0,   45,    0, 7492,   46,    0,   47,    0
  12428. ,    0,    0,    0,  309,   42,  310,   44,   50,  429, 7494
  12429. ,   79,    0,   46,    0, 7496,  126,    0,  424, 7498, 7500
  12430. ,   39, 7502,    0,    0, 7504,  718,    0,    0,    0,    0
  12431. ,   52,   53,   54,    0,    0,    0,   55,    0,    0,  466
  12432. ,    0, 7506,  649, 7508,    0, 1237,    0,    0,  826,  122
  12433. , 7510, 7512,   44, 7514, 7517, 7519, 7523, 7526, 7528, 7531
  12434. , 7535,   71, 7538,    0,    0, 7541, 7544,  540,   58, 7546
  12435. , 7549,   61, 7551, 7553, 7556,    0,   64,   65, 7558, 7560
  12436. , 7562,   68,   69, 7564, 7566, 7568,  761, 7572,   73,  763
  12437. ,  764,    0, 1239,    0, 1238,  145, 7574,   37,    0,  731
  12438. ,    0,    0,  147, 1240,   79,  123, 1240,  299, 1240, 1240
  12439. ,    0,    0,    0,    0,    0,   52,   53,   54,  189,    0
  12440. , 7576,   55,    0,    0,    0,    0,    0,   56,   57, 7579
  12441. , 7581, 7583, 7587, 7589,   62,   63,    0,   55,   64, 7592
  12442. ,   66,   67,  125,   68,   69,   70, 7594, 7596,   60,   61
  12443. , 7598,   63,  116,    0,   64,   65, 7600,   67,    0, 7602
  12444. , 7604, 7606, 7609, 7613,    0,   45,   73,    0, 7615,    0
  12445. ,   47,    0,    0,    0,    0, 7617,    0,   52,   53,   54
  12446. ,    0,    0,  127,   55, 7619,    0,  129,    0,  130, 7622
  12447. ,    0,  122, 7624, 7626, 7629, 7631,   62, 7633,    0,    0
  12448. , 7636,   65, 7638, 7640,  857, 7642, 7646, 7648, 7650, 7653
  12449. ,    0,    0,   73,    0,    0,   49,   38,   39,   40,  100
  12450. ,    0,    0,    0,    0,    0,    0,    0, 7655,    0,  118
  12451. ,    0,    0,    0,    0,    0,    0, 7657,  309,   42,  310
  12452. ,   44, 7659,    0,   45,    0,    0, 7661, 7663, 7665,   44
  12453. ,    0,    0, 7667,    0,    0,   46,    0,   47,    0,    0
  12454. ,    0,    0,  960,    0,    0,    0,    0,    0,    0,    0
  12455. ,    0,    0,    0,  286, 7669, 7671,    0,  409,  410,  411
  12456. , 7673,  413,  414, 7675, 7677,  241,  390,   52,   53,   54
  12457. ,  805,    0,    0, 7680,  416,    0,  313,  314, 7683,   56
  12458. ,   57,  417,   58,   59,   60,   61, 7685,   63,  192,    0
  12459. ,   64,   65, 7688,   67,    0,   68,   69,   70, 7690, 7692
  12460. ,   53, 7695,   73,    0,    0, 7697,    0,    0, 7699,  424
  12461. , 7701,    0,    0,    0,   58, 7703, 7705,   61,   62, 7707
  12462. ,  975,    0, 7709,   65,   66,   67,    0,   68,   69,   70
  12463. ,   71, 7712,    0,  102, 7714,  104,    0,    0,    0,    0
  12464. ,    0,    0,    0,    0,  882,   52,   53,   54,    0,  693
  12465. ,    0,   55,    0,    0,   52,   53,   54,    0,    0,    0
  12466. , 7716,   59, 7718, 7720, 7723,   63,  279,  280,   64, 7725
  12467. , 7727,   67,  581,   68,   69,   70,   71, 7729,   65,   66
  12468. , 7731,    0,   68,   69,   70,   71,   72,    0,    0,   73
  12469. ,    0,  323,    0,   82,  324,    0,    0,    0,    0,    0
  12470. ,  323,    0,  719,  743,    0,    0,  377,    0,  862,    0
  12471. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12472. ,    0,    0,    0,    0, 7733,    0,    0,  733,    0,    0
  12473. ,    0,   25,    0,    0,    0,    0, 7735,   28,    0,    0
  12474. ,    0,    0,    0,    0,  106,    0,    0,    0,    0,    0
  12475. ,   74,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12476. ,  363,    0,    0,  620,    0,    0,    0,    0,    0,  841
  12477. ,  863, 1003,    0,    0,  471,    0,    0,    0,    0,    0
  12478. ,    0,    0,    0,  997,    0,    0,    0,    0,    0,    0
  12479. ,    0,    0,    0,    0,    0,  281,    0,  344,    0,    0
  12480. ,    0,  651,    0,  652,    0,    0,    0,  615,  263,    0
  12481. , 7737,  314,  315,    0,  818,    0,    0,    0,    0,    0
  12482. ,   37,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12483. ,    0,    0,  608,    0,  894,    0,    0,    0,    0,    0
  12484. ,    0,    0,    0,    0,  819,    0,    0,    0,    0,    0
  12485. ,    0,    0,   38,   39,   40,    0,    0,    0,    0,    0
  12486. ,  931,    0,    0,    0,    0,    0,   98,    0,    0,    0
  12487. ,    0,    0,    0,    0,  790,    0,    0,    0,    0,    0
  12488. ,    0,    0, 7739,   42,   43, 7742,  744,    0,   45,    0
  12489. ,    0,    0,    0,    0,    0,    0,  249, 1040,    0,  961
  12490. ,    0,    0,    0,  450,    0,    0,    0,    0,    0,    0
  12491. ,    0,    0,    0,    0,   37,    0,    0,    0,    0,    0
  12492. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12493. ,    0,    0,    0,    0,    0,    0,    0,  188,    0,    0
  12494. ,    0,  653,    0,  156,    0,    0,   38,   39,   40,    0
  12495. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12496. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12497. ,    0,    0,  724,  323,    0, 7744, 7746,   42,   43,   44
  12498. ,    0,    0,   45,    0,    0,   46,    0,   47,    0,    0
  12499. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,  364
  12500. ,    0,    0,  194,    0,    0,    0,    0,    0,    0,    0
  12501. ,   52,   53,   54,    0,    0,    0,   55,    0,    0,    0
  12502. ,    0,    0,    0,    0,    0,    0,    0,  248,    0,    0
  12503. ,    0,    0,    0,    0, 7748,  296, 7750,    0,   68,   69
  12504. ,   70,   71,   72,    0,    0,    0,  694,    0,    0,    0
  12505. ,    0,    0,    0,    0,  229,    0,    0,    0,  467,  407
  12506. ,    0,    0,    0,  686,    0,    0,  687,    0,    0, 7752
  12507. ,    0,    0,    0,    0,    0,    0,    0,    0,    0, 7754
  12508. ,    0,    0,  431,    0,    0,    0,    0,    0,    0,    0
  12509. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12510. ,  241,    0,    0,    0,   52,   53,   54,    0,    0,    0
  12511. , 7756,   38,   39,   40,    0,    0,    0,    0,    0,    0
  12512. ,    0,  108,  176,    0,    0,    0,    0,   64,   65,   66
  12513. , 7758, 7760,   68,   69,   70,   71,   72,    0,    0,   73
  12514. ,    0,  122,   42,   43,   44,    0,  944,   45, 7762,    0
  12515. , 7764,    0, 7767,    0,    0,    0,    0,  243,    0,    0
  12516. ,    0,    0,    0,    0,    0,    0,    0, 7769,    0,    0
  12517. ,    0,    0,    0,    0,    0,    0,    0,  543,  229,    0
  12518. ,  433,    0,  495,    0,  496,    0,    0,    0,    0,    0
  12519. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12520. ,    0, 7771,  800,  190,    0,    0,    0,  655,    0,  472
  12521. ,  116,    0,  553,    0,    0,  554,    0,    0,    0,  838
  12522. ,  839,    0,    0, 7773, 7775, 1520,    0,    0,    0,    0
  12523. ,    0,    0,    0,    0,  811,  986,    0,  798,    0, 7777
  12524. , 1520,    2,    0, 1520,    0,    0,    0,    0,    0,  604
  12525. ,    0,  593, 1520,    0,  594,    0,    0,    0,    0,    0
  12526. ,    0, 7779,    0,    0,  705,    0,    0,    0,    0,   52
  12527. , 7784,   54,    0,    0,    0,   55,    0,  616, 7786,    0
  12528. ,  340,    0,    0,  157,    0,  550,    0,  118,    0,    0
  12529. ,    0,    0,   64, 7788, 7790,   67,  397,   68,   69,   70
  12530. ,   71,   72,    0,    0,   73,  194,    0,    0,    0,    0
  12531. , 7792,   37,    0,    0,    0,    0,    0,    0,  301,    0
  12532. ,  229,    0,    0,  745,    0, 1425,  561,    0,    0,    0
  12533. ,  545,    0,    0,    0,    0,    0, 1425,    0,    0,    0
  12534. , 1425, 1425, 1425, 7794,   39, 7797,    0,    0,    0,  451
  12535. ,    0,    0,    0,    0,    0,  777,    0, 1425,  194, 1425
  12536. , 1425,  575,  657,    0,    0,    0, 1029, 7799,    0,    0
  12537. , 7801, 1425,    0, 7803, 7805, 7807, 7809,    0,    0,   45
  12538. , 1588,    0,   46,  895,   47,  351,    0,    0,    0,    0
  12539. ,    0,    0,    0,    0,  883,    0, 7811,    0,  116,    0
  12540. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12541. ,    0,    0,    0,    0,    0,  195,    0,    0,  550,    0
  12542. ,  118,    0,    0,    0,    0,    0,    0,    0,   38,   39
  12543. ,   40,    0,    0,    0,    0,    0,    0,    0, 7813,  251
  12544. ,    0,    0,    0, 7816,    0,    0,    0,    0,    0, 1012
  12545. ,    0,  583,    0,    0,    0,  468,    0,    0,   41, 7818
  12546. ,   43,   44,    0,  840,   45,    0, 7820,   46, 1237,   47
  12547. ,    0,    0,    0,  550, 1240,  118, 1238,    0, 1240, 1237
  12548. ,    0,    0,    0, 1214, 1214, 1214,  249, 1214, 1238, 1240
  12549. ,    0,    0, 1237, 1238,    0,    0,    0, 1240,    0,    0
  12550. ,    0, 7822,   53, 7824,    0,    0,    0,   55,    0,  390
  12551. , 1237,    0, 7826,  116,   49, 1239,    0, 1238,    0,    0
  12552. ,    0,    0,    0,    0, 7828, 7830, 7833, 7835,    5, 7838
  12553. , 7842, 7845, 7848, 7850,    0,    0,   73,    0,    0,    0
  12554. ,   50,  352,    0,    0,    0,  175,    0,    0,    0,    0
  12555. ,    0,   51,    0,    0,    0,    0,  406,    0,    0,  598
  12556. ,    0,    0,    0,    0,  390,  176,  821,    0,    0,    0
  12557. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,  842
  12558. ,    0,  269,  270,    0, 7853,    0,   52, 7855,   54,    0
  12559. ,    0,   37,   55,    0,    0,    0,    0,    0,    0,  282
  12560. ,    0,   58,   59,   60,   61,   62,   63,    0,    0,   64
  12561. ,   65, 7858, 7860,  679,   68, 7862, 7864,   71,   72,    0
  12562. ,    0,   73,    0, 7866,   39,   40,    0,    0,    0, 1237
  12563. ,  272, 1237,    0,    0,    0, 7868,    0, 1240,    0, 1238
  12564. ,    0, 1240, 1237,    0,    0,    0,    0,    0,   38,   39
  12565. ,   40, 7870, 7872, 7874, 7876, 7878, 7880,    0,  932, 7882
  12566. , 1240, 7886,   46,  502, 7888,    0,   11,    0,    0,  241
  12567. ,  194,    0,    0, 1237, 7890,   12,    0,  822, 7892, 7894
  12568. , 7896,   44,    0,    0,   45,  977,    0,   46,    0, 7898
  12569. ,    0,    0, 1240,    0, 1240, 1240,    0,  621,    0,  680
  12570. , 7900,  410, 7902,  412,  413,  414,  111,  415,    0,    0
  12571. ,  706,    0, 7904,    0,   88,    0,  751,  416,    0, 7906
  12572. ,  752,    0,    0,    0, 7908,    0, 7910, 7912,    0,    0
  12573. ,  326,   37,    0,    0,  599,  286,    0,  196,   13,   14
  12574. ,    0,    0, 1418,    0, 1031,    0,  171,    0,    0,    0
  12575. ,  390, 1540,    0,    0,  197,  778,    0,   16,    0,  407
  12576. ,  265,    0,  273,   38, 7914,   40, 1039,  198,  199,  283
  12577. ,    0, 7917, 7919,  194,  798,    0,    0,    0,    0,  122
  12578. ,    0, 7921, 7923,   54,    0,    0,    0,   55,    0,    0
  12579. ,    0, 1540,    0,  122,   42, 7926, 7928,    0,    0,   45
  12580. ,    0,    0,   46,    0, 7930,   65, 7932, 7934, 7936,   68
  12581. ,   69,   70, 7938, 7940,  203,  204, 7943, 7945,  207,  208
  12582. ,  209, 7947,    0,    0,    0,    0,    0,    0,    0,   64
  12583. , 7949,   66,   67,    0,   68,   69, 7951, 7955, 7957,    0
  12584. , 7959,   73, 1143,    0,    0, 1143,    0,    0,  178,  366
  12585. ,    0,   86,   52,   53,   54, 1143,  828,  241,    0,    0
  12586. , 7961,    0,    0,  409,  410, 7963,  412,  413,  414,    0
  12587. , 7965,    0,  905,    0,    0, 7967, 1143, 1143, 1143, 7969
  12588. , 7971, 1143, 7973, 7975, 1143,    0,  171, 7977, 1143, 1143
  12589. ,    0, 1379,    0, 1143,    0, 1143, 7979, 7982,  216,    0
  12590. ,    0,    0,    0,    0,    0,  754,    0, 7984,   53,   54
  12591. ,  755,    0,    0,    0, 7986, 7988,  969,  779,  734,    0
  12592. ,    0,   52,   53,   54,    0,    0,    0,   55,   38,   39
  12593. ,   40,    0,    0,    0,    0,    0,   58,   59,   60,   61
  12594. ,   62,   63, 7990,    0,   64,   65,   66,   67,  584,   68
  12595. ,   69,   70,   71,   72,    0,    0, 7992,    0,  122, 7994
  12596. ,   43,   44,    0,    0, 7996, 7998,    0,   46,    0,   47
  12597. ,    0,  555,  556,  757, 8000, 8003, 8005,  761,  762,    0
  12598. ,  763,  764,  765,    0,    0,  323,  766,    0, 8007, 1005
  12599. ,    0,    0,    0,  217,    0,   79,    0,   38,   39,   40
  12600. ,    0,    0, 8009,   27,  122, 8011, 8013, 8015,   40,    0
  12601. , 8017,    0,  219,   46,  896,   47,    0,  915,    0,    0
  12602. ,   38, 8019,   40,    0,    0,    0,  673,  122, 8021,   43
  12603. ,   44,    0,    0,   45,    0,    0, 8023,   42, 8026,   44
  12604. ,  286,    0,   45,    0,    0,   46,    0,   47,    0,    0
  12605. ,  122, 8028, 8031,   44,    0,    0,   45,    0,    0,   46
  12606. ,   32, 8033,    0,  659,  660,  661, 8036,  663, 8038, 8040
  12607. ,   40,    0,    0,  220,  221,  222,  223,    0,  195,    0
  12608. ,    0,    0,    0,    0,    0,    0, 8042,   53,   54,    0
  12609. ,    0,    0,   55,    0,  452,  600, 8044, 8046, 8048, 8051
  12610. , 8053, 8055,   59,   60, 8057, 8059, 8061,   46, 8063, 8065
  12611. ,   65,   66, 8068,    0,   68,   69,   70,   71, 8070,    0
  12612. ,  171,   73,    0,    0,    0,    0,    0,  962,   37,  171
  12613. ,  224,    0, 8072,   53, 8074,    0,    0,    0,   55,  159
  12614. ,    0,    0,  435,  171,  160,    0,  161,    0,    0,    0
  12615. ,    0,    0,    0,  225,  865, 8076, 8078, 8080,   67,  601
  12616. , 8082, 8084, 8087,   71, 8089,   53,   54,   73,    0,    0
  12617. ,   55,    0,    0,  179,    0,    0,  604,  284, 8091, 8093
  12618. , 8095,   67,    0,   68, 8098,   70,   71, 8100,   65,   66
  12619. , 8102, 8106, 8108, 8111, 8114, 8116, 8118,    0,    0, 8121
  12620. ,    0, 8123,   65,   66,   67, 8126,   68,   69,   70,   71
  12621. , 8128,    0,  236,   73,    0,    0,  194,    0,    0,    0
  12622. ,    0,    0,   38,   39, 8130,    0,   52,   53,   54,    0
  12623. ,    0,    0,   55, 1145,    0,    0,    0, 1145,  471, 1145
  12624. ,    0,   58, 8132,   60,   61, 8134, 8136, 1559,    0,   64
  12625. ,   65, 8139, 8141, 8146, 8148, 8150, 8152,   71, 8154,    0
  12626. ,    0, 8156,    0, 8159,    0,    0,    0, 8161, 8163, 8165
  12627. , 1559, 1559, 8167, 8169, 1145, 1145, 1145, 1145, 1145, 8171
  12628. , 1145, 8174, 1559,  171, 8176, 8178, 8182, 1426, 1380,    0
  12629. , 1145, 1559, 1145, 1145, 1145,    0,    0, 8185, 8187,    0
  12630. ,    0, 1426, 1426,    0,    0,    0,    0, 1587,    0,    0
  12631. ,    0,    0,    0,    0,    0,    0,    0,    0,   52,   53
  12632. ,   54,    0,   80,    0,   55,    0,    0,  721,    0,    0
  12633. ,  134,  135,  136,   58, 8189, 8191,   61,   62, 8193, 8195
  12634. ,  140,   64, 8197,   66,   67,  171, 8199,   69,   70,   71
  12635. ,   72,    0,    0,   73,    0,    0,    0,    0,    0,  949
  12636. ,    0,  950,    0,    0,    0,  585,    0,  113,    0, 8201
  12637. ,    0,   38,   39,   40,    0,    0,    0,    0,  604,    0
  12638. ,   52,   53, 8203,    0,    0,    0,   55,    0,    0,  935
  12639. ,    0,    0,  471,    0,    0,  287,    0,    0, 1022,    0
  12640. ,  472, 8205, 8207, 8210, 8214,   66,   67, 8216,   68,   69
  12641. , 8219,   71, 8221,    0,    0, 8223,   14,    0,    0,    0
  12642. ,    0,    0,    0,    0,  116,    0,    0,    0,    0,    0
  12643. ,    0, 8225,   42,   43, 8227,    0,    0,   45,    0,    0
  12644. ,   46,    0,   47,   17,  418,    0,    0,    0,    0,    0
  12645. ,    0,    0,  477,    0,    0,    0,    0,    0,    0,    0
  12646. ,  866,    0,    0,  141,  142,    0,    0,    0,    0,    0
  12647. ,    0,    0,    0,    0,    0,  143,    0,  424, 8229,    0
  12648. ,    0,    0,    0,  682,  147,    0,    0,  963,    0,    0
  12649. ,    0,  454,    0,   18, 8231,    0,   20,   21,    0,    0
  12650. ,    0,  163,    0,    0,    0,    0,    0,    0,    0,    0
  12651. ,    0,  116,    0,  264,    0,    0,  164,    0,    0,    0
  12652. ,    0,    0,    0,    0,  171,    0,    0,    0,    0, 8233
  12653. ,   53,   54,    0,    0,    0,   55,    0,    0,    0,    0
  12654. , 8235, 8238, 8240,  222, 8242,  166,    0,    0, 8244,  474
  12655. , 1238,    0, 8246, 8248,   66,   67,    0,   68,   69, 8250
  12656. , 8252, 8254, 1238, 1240,   73,   55, 1237, 1238,  505,    0
  12657. ,    0, 1240,    0,    0,    0, 1237,    0,    0,    0, 8256
  12658. , 8258,    0,   64,   65, 8260,   67,    0, 8262,   69, 8265
  12659. , 8267, 8269,    0,  114,   73,    0,    0,    0,    0,    0
  12660. , 1240,    0,    0, 8271,    0, 1240, 1240,    0,    0,  642
  12661. ,    0,    0,    0,    0,    0,    0,    0,  253,    0,   38
  12662. , 8273,   40,    0,    0,    0,    0,    0,    0,    0,  194
  12663. ,  406,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12664. ,  906,    0,  229,    0,    0,  829,    0,    0,    0,  122
  12665. , 8275,   43,   44,    0,    0,   45,    0,    0,   46,    0
  12666. ,   47,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12667. ,   24,    0,    0,    0,    0,    0,    0, 8277,    0,   26
  12668. ,   27,    0,    0,   28,    0,    0,  195,    0,    0,    0
  12669. ,    0,    0,    0,  144,  305, 8279, 8281,   37,    0,  419
  12670. ,    0,    0, 8283, 8285, 8287,    0,   43,   44,  323,    0
  12671. ,    0,  628,    0,    0,    0,    0, 8289,  146,    0,    0
  12672. ,    0,    0,   29, 8291,    0,    0,    0,    0,   31,   38
  12673. ,   39, 8293,  656,  609,    0,    0,    0,   32,   33,    0
  12674. ,    0,    0,  171,    0,    0,    0,    0,    0,    0,    0
  12675. ,    0,    0,    0,    0,    0,  345,    0,    0,    0,  122
  12676. ,   42,   43,   44,    0,    0,   45,  353,    0, 8295,    0
  12677. ,   47,    0,    0,    0, 8297,  498,  499, 8299, 8301, 8303
  12678. ,    0,  415,    0, 8305,    0,    0,    0,    0,    0, 8308
  12679. ,    0, 8310, 8312,  978,    0,    0,    0,  436,  500,    0
  12680. ,   64,   65, 8314,   67,  238, 8316, 8318,   70,   71, 8320
  12681. ,    0,    0, 8322, 8324,    0, 8326,    0,    0,    0,    0
  12682. ,  590, 8328,    0,   38,   39,   40,  380,    0,  844,  988
  12683. ,    0,    0, 8330,   53,   54,    0, 8332,   38,   39,   40
  12684. ,    0,  286,    0,    0,    0,    0,    0,    0,  593, 8334
  12685. ,    0,  594, 8336,  122,   42,   43,   44,    0,    0,   45
  12686. ,    0,    0,   46,    0,   47,    0,    0,  122,   42,   43
  12687. ,   44,    0,  549,   45,    0,  595, 8338,    0,    0,    0
  12688. ,    0, 8340,    0,    0,    0,    0,    0, 8342,   53,   54
  12689. ,    0,    0,   37,   55,    0,    0,  550,    0,  118,    0
  12690. ,    0,  228,   58,   59,   60,   61, 8345,   63, 8347, 8349
  12691. , 8351,   65,   66, 8353,    0, 8355,   69,   70,   71,   72
  12692. ,    0,    0, 8357,  561,   38,   39,   40,    0,    0,    0
  12693. ,  769,    0,    0,    0,    0,  462,    0,  501,  122, 8359
  12694. , 8361,   44,  597,    0,   45,    0,  125, 8363,   39, 8365
  12695. ,  503,    0,    0,    0, 8368, 8370, 8372,   44,  575,  121
  12696. , 8374,    0,  999, 8376,  194,   47,  845,    0,    0,    0
  12697. ,   37,    0, 8378,    0,    0,    0,    0,  122, 8380,   43
  12698. ,   44, 8382,   53, 8385, 8387,   42, 8389, 8391, 8394,    0
  12699. ,   45,    0,    0,   46,    0, 8396,   53,   54,    0,  329
  12700. ,    0,   55,   38,   39, 8398,   65, 8400,   67,    0,   68
  12701. , 8402,   70, 8404,   72, 8406,  661, 8408, 8411,   40,    0
  12702. ,  629, 8414,    0, 8416, 8418, 8420, 8422, 8424,  255,    0
  12703. ,    0, 8426, 8428, 8431, 8433, 8435, 8437,    0,   45, 8439
  12704. , 8441,   46,   86,   47,    0,    0,  122, 8443,   43,   44
  12705. ,    0,    0,   45,    0,    0,   46,    0,   47,    0,  665
  12706. ,  424,  146,    0,    0,    0,    0, 8445, 8447,   54,    0
  12707. ,  171,  604,   55,    0,  806,    0,    0,  125,    0, 8449
  12708. ,    0,    0, 8451,   53,   54,  241,    0,    0, 8453, 8455
  12709. ,   65,   66, 8457,    0, 8459, 8461,   70, 8463, 8466,   60
  12710. , 8468, 8470,   63,    0,    0, 8472, 8474, 8477,   67,  736
  12711. ,   68, 8479, 8481, 8483, 8485,    0,    0, 8488,   55,    0
  12712. ,    0,  369,    0,  370, 8490,  171,  990,   58, 8492, 8495
  12713. , 8497, 8499,   63,   68,   69, 8501, 8504, 8507,   67,  171
  12714. , 8509,   69, 8511, 8513,   72,    0,    0,   73,    0, 8515
  12715. ,   39,   40,    0,  176,    0,    0, 8517,  142,    0,    0
  12716. ,   52,   53,   54,    0,    0,  229,   55,    0,  143,    0
  12717. ,    0,  937,    0,    0,   52, 8519, 8521, 8523,   61, 8525
  12718. , 8528, 8534, 8536, 8538, 8540, 8544, 8546,    0, 8549, 8551
  12719. , 8554,   71,   72,    0,    0,   73,    0,   64,   65,   66
  12720. ,   67,    0,   68,   69,   70,   71,   72,    0,    0,   73
  12721. ,    0,  182,    0,    0,    0,    0,    0,    0,    0,    0
  12722. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12723. ,    0,    0,  424, 8556,    0,  311,  242,    0,    0,  147
  12724. ,  513,  514,    0,  243,    0,  867,  587,    0,    0,    0
  12725. ,  832,    0,    0,    0,  495,    0, 8558, 1485,    0,    0
  12726. ,    0, 8560,  727,    0,    0,   74,    0,    0,    0,    0
  12727. ,    0,  424, 8562,   37,    0,    0,  684,    0,  147,    0
  12728. , 8565,    0,    0,    0,    0,    0,  421,  116,    0,    0
  12729. ,    0,    0,    0,    0,    0,  422,    0,    0,    0,    0
  12730. ,    0,    0,    0, 8567,    0,   38, 8569, 8571,   53, 8573
  12731. ,    0,    0,   37,   55,    0,  899,    0,    0,    0, 8576
  12732. ,  979,    0,   58,   59,   60,   61,   62,   63,    0,    0
  12733. ,   64,   65,   66,   67,    0, 8578, 8580, 8582, 8584, 8586
  12734. ,    0,   45,   73,  474, 8588,   39, 8591,    0,  168,  121
  12735. ,    0,   38,   39, 8593,    0,    0,  516,    0,    0,    0
  12736. ,    0,  517, 8595,  195,  118,  229,    0,    0,    0,    0
  12737. ,    0,    0, 1007,    0,  122,   42,   43,   44,    0,  354
  12738. ,   45, 8597, 8599, 8601,   44, 8603,  144,   45,  554,    0
  12739. , 8606, 8608, 8610,    0,  457,  144, 8612, 8614,    0,    0
  12740. ,    0,    0,    0,    0,    0,  807,    0,    0,    0,  145
  12741. ,  146,    0,  953,   38,   39, 8616,  147, 8618,    0,    0
  12742. , 8620,    0,    0,    0,  954,    0,    0,  144,  171,  887
  12743. ,  666,    0, 8622,    0,    0,    0,    0,    0,    0,    0
  12744. ,  971,    0,   91,  122, 8624,   43,   44,    0,    0,   45
  12745. ,    0,  560,   46,  119, 8626,    0,  124, 8628,    0,    0
  12746. ,    0,    0,    0, 8631,   53,   54,    0,  125,    0,   55
  12747. ,    0,    0,  244,    0, 8633,    0,    0,    0,   58,   59
  12748. ,   60, 8635, 8638,   63,    0,  390,   64, 8641,   66,   67
  12749. ,    0, 8643,   69,   70,   71,   72,    0,    0,   73,  561
  12750. ,  698,    0,   52,   53,   54,    0,    0,  127, 8646, 8648
  12751. ,   53, 8650,    0, 8652, 8654, 8657, 8660, 8662, 8665, 8667
  12752. , 8669,   62,   63,  570,  571, 8671,   65,   66,   67,    0
  12753. ,   68, 8674, 8676, 8678, 8681,   67,  171, 8684,   69,   70
  12754. ,   71,   72,  576,    0,   73,    0,    0,    0,    0,    0
  12755. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12756. ,    0,  384,    0,    0,    0,    0,    0,  645,    0,  346
  12757. ,    0,   52, 8686,   54,  519,    0, 1583,   55,    0,    0
  12758. ,    0,  520,  521,    0,  522,    0,  291, 1583,  249,    0
  12759. ,    0, 1583, 1583, 1583,   64,   65,   66, 8688,    0,   68
  12760. ,   69,   70,   71,   72,    0,    0,   73, 8690, 1583,  194
  12761. , 1583, 1583,    0,    0,    0,    0, 1023,    0,    0,    0
  12762. ,    0, 1583, 1583,  991,    0, 8693, 1583,    0,    0,    0
  12763. ,    0, 1585,    0,    0,    0,    0,    0,    0,  116,    0
  12764. ,  524,  525, 8695, 8697,   54,    0,    0,    0,  308,    0
  12765. ,    0,   94,    0,    0,  241,    0,    0,    0,    0,  728
  12766. ,  269,  270,    0,    0,    0,    0,  195,    0,    0,  176
  12767. ,    0,    0,  423,    0,    0,    0,    0,    0,    0,    0
  12768. ,    0,    0,    0,    0,    0,  980,    0,    0,    0,    0
  12769. ,    0,  271,    0,    0,    0,    0,  809,    0,    0,    0
  12770. ,  332,    0,    0,    0,    0,    0,    0,    0,    0,  272
  12771. ,    0,  606,    0,  389,    0,  118,    0,    0,  231,    0
  12772. ,    0,    0,    0,    0,  938,    0,  458,  965,  632,    0
  12773. ,    0,    0,  116,    0,    0,    0,    0,    0,    0,    0
  12774. ,    0,    0,    0,    0,    0,    0,    0,  633,    0,    0
  12775. ,    0,    0,    0,    0,  667, 8699, 1000,    0, 8701,    0
  12776. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12777. ,    0,    0,    0,    0,    0,    0,    0,    0,   37,    0
  12778. ,  528,    0,    0,    0,    0,    0,    0,   38,   39,   40
  12779. ,    0,    0,  144,    0,    0,    0,    0,    0,    0,    0
  12780. ,    0,    0,    0,    0,  390,    0,    0,    0,  874,    0
  12781. ,   38,   39,   40,    0,    0, 1014,    0, 8703,   42,   43
  12782. ,   44,    0,    0,   45,    0,  889, 8705,    0,   47,    0
  12783. ,    0, 8707,    0,    0, 1034,    0,    0,    0,    0,    0
  12784. ,  122, 8709,   43,   44,    0,    0,   45,    0,    0, 8711
  12785. ,   39, 8713,  438,  323,    0,    0,  868,    0, 8715, 8717
  12786. ,   40,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12787. ,    0,    0,   37,    0,    0,    0,  399,    0,    0,  309
  12788. ,   42,  310, 8719,    0,    0,   45, 1578,    0, 8721, 8724
  12789. , 8726, 8728,    0,    0,   45,    0,    0, 8730,  634, 8732
  12790. ,    0, 1578, 1578, 8734,   38,   39,   40,    0,    0,    0
  12791. ,  171, 8736,    0,    0,    0,    0,  407,    0, 1578, 1578
  12792. ,    0, 1578,  286,    0,    0,    0,    0,    0,    0,    0
  12793. ,    0, 1578, 1578, 8738,  122, 8740, 8743,   44,    0,  195
  12794. ,   45, 1578,    0,   46,  635, 8745,   53,   54,    0,    0
  12795. ,    0,   55,    0,    0,    0,  646,  146,    0,  900,    0
  12796. ,  385,  286, 8747,    0,    0,    0,    0,    0, 8749, 8751
  12797. , 8753, 8757,  171, 8759, 8762,   70, 8764, 8766,    0,   88
  12798. , 8768,  171,    0,  292,    0,    0,  711,    0,    0,  686
  12799. ,    0,   64, 8770,   66,   67,    0,   68,   69,   70,   71
  12800. ,   72,    0,    0,   73,    0,    0,    0,   52,   53,   54
  12801. ,    0,    0, 8772, 8774,   40,    0, 8776,   53,   54,    0
  12802. ,    0,    0, 8778,   59,   60,   61,   62, 8780, 8782,    0
  12803. , 8785, 8787, 8789, 8792,   61, 8794, 8796,   70,   71, 8798
  12804. ,   65,   66, 8800,   42, 8803, 8805,   70, 8808, 8810,  391
  12805. ,  924, 8812,    0,   47,    0,    0,    0,    0,  122,   42
  12806. ,   43,   44, 8814,   53, 8816,    0,    0, 8818,   55,    0
  12807. ,    0,  668,  688,   89,  689,  472,   48,    0,    0, 8820
  12808. ,  146,  713,    0,    0,    0,   64, 8822, 8824,   67,    0
  12809. , 8826, 8828, 8830,   71, 8832,    0,    0, 8834, 8837,   38
  12810. ,   39,   40,  195,  714,    0,  118,    0,    0,    0,  257
  12811. ,    0,    0,    0,  459,  981,    0,    0,    0,    0,    0
  12812. , 8839, 8841, 8843,   44,   50,    0,   45,  966,  623, 8846
  12813. ,   42,   43,   44, 8848,    0, 8850, 1484,  763, 8852,    0
  12814. , 8854,    0,  973,    0,  647,    0,    0,    0,    0,    0
  12815. ,    0, 8856,    0,    0,    0,    0,    0,    0,    0, 8858
  12816. ,    0,   76,    0,    0,    0,    0,    0,    0,    0,  312
  12817. ,   52,   53, 8860,  314,  315,   37, 8862,    0,    0, 8864
  12818. ,    0,    0,   56, 8866,   37, 8868, 8871, 8874, 8876,   62
  12819. , 8880,  530,   55, 8882, 8884, 8888,   67,  890,   68, 8891
  12820. ,   70,   71,   72,    0,    0, 8893,    0,   38,   39,   40
  12821. ,    0, 8895,  298,  171,  848, 8897, 8899, 8901, 8903,    0
  12822. ,    0,    0,  171,    0,  993,    0,    0,    0,    0,    0
  12823. ,  134,  135,  136,    0,    0,    0,    0,  122, 8905, 8907
  12824. , 8909,    0,    0,   45,    0,    0, 8911,   42, 8913, 8917
  12825. ,   54,    0,   45,    0,   55,   46,  392, 8919,   53,   54
  12826. ,    0,    0,    0,   55,    0,    0,  974,    0,    0, 8923
  12827. ,    0,    0,   58,   59, 8925, 8927,   62,   63,   70,   71
  12828. , 8929,   65,   66, 8931,  531,   68,   69,   70, 8933,   72
  12829. ,    0,    0,   73,    0,    0,    0,    0,    0,    0,    0
  12830. ,    0,   38, 8935,   40,    0,    0,    0,    0,    0,    0
  12831. ,    0,    0,    0,    0,  334,    0,    0,    0,    0, 8937
  12832. ,   53,   54,    0,    0,    0,  636,  243,    0, 8940,    0
  12833. ,  171,  122,   42,   43,   44,    0,    0,   45,    0,  171
  12834. ,   46,    0,   47,    0,    0,    0,  901,    0,    0,  553
  12835. ,    0,    0,  554,   74,   37,    0, 1001,    0,    0,    0
  12836. ,  555,  556,    0,  141,  142,   52,   53,   54,    0,    0
  12837. ,   79, 8942,    0,    0,   52, 8944, 8946,    0,  474, 8948
  12838. , 8950,  533,  534,  535,  536,    0,   38, 8953, 8955, 8958
  12839. , 8960, 8962,   61, 8965, 8967,   70, 8969, 8971,   65, 8973
  12840. , 8975,    0,   68,   69,   70, 8977,   72,    0,    0,   73
  12841. , 1024,    0,  357,  286,    0, 8979,  122,   42,   43,   44
  12842. , 1143,    0,   45,    0,  171, 8981,    0,   47,  940,  852
  12843. ,    0,    0,  680,    0,   37,    0,    0,    0,    0,    0
  12844. ,    0,    0,  638, 1143,    0,    0,    0, 1143,    0, 1143
  12845. ,    0,    0, 1143,    0,  715,    0,    0,    0,    0,   52
  12846. , 8983, 8986, 1143,  561,    0,   55, 8988, 8990,   40,    0
  12847. ,    0,    0,  562,    0,   58,   59,   60, 8993, 8996, 8998
  12848. , 9000,  567, 9002, 9005, 9008, 9010, 1143, 9012, 9016, 9019
  12849. , 9022, 9024,    0,    0, 9026, 9029, 9031, 9033, 9036, 9040
  12850. , 1143,    0, 9042, 9045, 1143,   46,  576,   47,    0,  171
  12851. ,    0,    0,  266,    0,    0,    0,    0,  855,    0,   37
  12852. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12853. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12854. ,    0,    0,    0,    0,   52,   53,   54,    0,    0,    0
  12855. ,   55,   38,   39,   40,    0,    0,  336,    0,    0,    0
  12856. ,    0,    0,    0,    0,    0,    0,    0,   64,   65,   66
  12857. ,   67,    0,   68,   69,   70,   71,   72,    0,  982,   73
  12858. ,  670,  810,   42, 9047,   44,    0,    0, 9049,    0, 9052
  12859. ,   46,    0,   47,    0,    0,    0,    0,    0,    0,    0
  12860. ,    0,    0,    0,    0,    0,  259,    0,    0,    0,    0
  12861. ,    0,    0,  926,    0,  502,    0,    0,    0,    0,    0
  12862. ,  229,    0,    0,    0,   52, 9054,   54,  294,    0,    0
  12863. ,   55,  300,    0,    0,    0,    0,    0,    0,  243,    0
  12864. ,    0,    0,  176,    0,    0,    0,    0,   64,   65, 9056
  12865. , 9058,  394,   68, 9060,   70,   71,   72,    0,  723,   73
  12866. ,    0,    0,    0,  265,    0,    0,    0,  751,    0,    0
  12867. ,    0,  752,    0,  612,  811,  812,  479,  798,  739,    0
  12868. ,    0,    0,    0,    0,    0,    0,    0,  870,    0,    0
  12869. ,    0,    0,    0,    0,  249,    0,    0,  740,  122,    0
  12870. , 9062,   44,  701,    0,    0,  116,  149,    0,    0,   52
  12871. , 9064,   54,    0,    0,    0,   55,    0,    0,    0,    0
  12872. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  12873. ,    0,  260,   64,   65,   66,   67,    0,   68,   69,   70
  12874. ,   71, 9066,    0,    0,   73,  194,    0,    0,    0,    0
  12875. ,  185,   37,  194,   37,  316,    0,    0,   91,    0,    0
  12876. ,    0,    0,    0,    0,    0,    0,    0,   37,    0,    0
  12877. ,    0,    0,   92,    0,    0,    0,    0,    0,    0,    0
  12878. ,    0,    0,    0,   38,   39, 9068,   39,   40,    0,    0
  12879. ,  120, 9070,  902,    0,    0,    0,    0,    0,    0, 9072
  12880. ,   39,   40,  195,    0,    0,    0,  471,    0,    0,  195
  12881. ,    0,    0,    0,  122, 9074, 9076, 9078,   43,   44,   45
  12882. ,    0,   45,   46,    0, 9081,    0, 9083, 9086,   54,  309
  12883. ,   42,  310,   44,    0,  180,   45,   75,    0, 9088,    0
  12884. ,   47,    0,    0,    0,  941,    0,    0,    0,    0,    0
  12885. ,    0,  716,    0,  426,    0,  377,  754,    0,    0,    0
  12886. ,    0,  755,    0,    0,    0,    0,  825,    0,    0,    0
  12887. ,    0, 9090,    0,    0,    0,    0,    0,    0,    0,    0
  12888. ,    0,    0,  891,    0,   93, 9092,    0,    0,  323,    0
  12889. ,    0,  786,    0,    0,    0,  267,    0, 9094,    0,  233
  12890. ,    0,    0,    0,    0,    0,    0,  171,   37,  171,    0
  12891. ,    0,  286,    0,    0,    0,  513,  514,    0,    0,    0
  12892. ,    0,    0,  171,    0,  757,  758,  759,  760, 9096,  762
  12893. ,    0, 9098, 9100,    0,    0,    0,    0,    0,    0,   38
  12894. ,   39, 9102, 9104, 9106, 9108, 9110,   37,   55,    0,   55
  12895. ,    0,    0,    0,    0,    0,    0,    0,   52,   53,   54
  12896. ,    0,    0,    0,   55, 9112, 9114, 9116, 9120,   66, 9122
  12897. , 9125, 9128, 9131, 9136, 9139, 9142, 9145, 9147, 9149,   39
  12898. , 9152, 9155,   66,   67,    0, 9158,   69,   70,   71,   72
  12899. ,    0,    0,   73, 9160,  122,   42,   43,   44,    0,    0
  12900. ,   45,  877,    0, 9162,    0,   47,    0,    0,  122,   42
  12901. , 9164,   44,    0,    0,   45,  702,    0,   46,    0,   47
  12902. ,    0,    0,    0,    0,    0, 9166,    0,    0,    0,    0
  12903. , 9168,   13,   14,    0,    0,    0,    0,    0,    0,    0
  12904. ,  471,    0,  442,    0,    0,    0,    0, 9170,  472,    0
  12905. ,   16,  124,    0,    0,    0,    0,   77,    0,    0,    0
  12906. ,  198,  318,  125,    0,  200,  201,    0,    0,    0,    0
  12907. ,  613,    0,    0,  479,    0,    0,  265,    0,    0,    0
  12908. ,    0,    0,  126,    0,    0,    0,    0,  811,  928,    0
  12909. , 9172,    0,    0,    0,    0,    0,    0,   52,   53,   54
  12910. ,  957,  171, 9175,   55,    0,  809, 9177,  203, 9179,  205
  12911. , 9181,  207, 9183, 9186, 9188,   61,   62, 9190, 1240,  395
  12912. , 9192,   65, 9194, 9199, 9203, 9205, 9207, 9209, 9211, 9213
  12913. , 9216,  213, 9218, 9221,  122,    0, 9223, 9226,   54,    0
  12914. ,    0, 9229,   55,    0,   16, 9231,   65, 9233, 9235,    0
  12915. ,   68, 9237,   70,   71, 9240,  318,    0, 9242,  358, 9244
  12916. , 9247, 9249,   67,  359,   68,   69, 9251,   71, 9253,    0
  12917. , 9255,   73,    0, 1240,    0, 1240, 1240,    0,    0,    0
  12918. ,   38,   39,   40,    0,    0,    0,    0,  319,    0,  214
  12919. ,  215,  216,    0,  320,  321, 9257,  103,  104,  717,    0
  12920. ,  406,    0,    0, 9259,  485,  486,  487,  488,  407,    0
  12921. ,  122,   42,   43,   44,    0,    0,   45,    0,  941,   46
  12922. ,    0,   47,    0,    0,    0,    0,    0,  903, 1009,    0
  12923. ,    0,  427,    0,    0,    0, 9261,    0,    0,    0,    0
  12924. ,    0,    0,    0,    0,  967,    0,    0,    0,    0,    0
  12925. ,  849,    0,    0,  577,    0,    0,    0,    0,    0,    0
  12926. ,  243,    0,   52, 9263, 9267,    0,    0,   38, 9270,   40
  12927. ,    0,    0,    0,    0,   37,    0,    0,    0,    0,    0
  12928. ,    0,  489,    0,    0,   97,  490, 9272,  320,  321,  102
  12929. ,  103,  104, 9275,   25,    0,   26,   27,  122,   42, 9277
  12930. ,   44,    0,    0, 9279,    0,  219, 9282,   39, 9285,    0
  12931. ,    0,  460,    0,  241,    0,  858,  859,    0,    0,    0
  12932. ,    0,    0,    0,    0,    0,    0,    0,  229,    0,    0
  12933. ,    0,    0,    0,    0,    0,    0,  122,   42, 9287, 9290
  12934. ,   54,  919,   45,    0, 9292, 9295,  411,  412,   47,  474
  12935. ,  415,  194,  635,   32,  416,   64,  577,   66,  220,   68
  12936. ,  221,   69,  417,  222,   70,  223,   71,  243,   72,  171
  12937. ,   27,  402,   52,  729,  795,   53,  798,  151,   62,   79
  12938. ,  958,   63,   64,   33,   52,  703,  152,   66,  153,   72
  12939. ,  774,   73,  116, 1578,   84,  996, 1578,  788,  445, 1377
  12940. ,  446,  968,  249, 1025,   45,  405,  187,  146,  334, 1143
  12941. ,   39,  122,   37,  860,  556,  122, 1143,   42,  175,   43
  12942. , 1143,  286,   45, 1143,  469,   38, 1143,   39, 1063,   40
  12943. , 1143,   47,   52,   54,  673,  505,   59,  984,   60, 1019
  12944. ,  985,   63,   68,  177,  502,   69,   73,   85,  262,  171
  12945. ,  286,  850,  677,   52,   94,   54,  959,  171,  751,  573
  12946. ,   55,    3,  323,  173,  775,   68,  742,   70,  880,  188
  12947. ,   54,  428,   60,  904,  145,  121,   61,  146,   65,  147
  12948. , 1037,   67,   73,   38,  254,   44, 1026,   47,   41,   37
  12949. ,  910,   45,  494,   37,  881,   85,  361,   40,  116,   38
  12950. ,   41,   37,  579,   44,  580,  125,  704,   45,  754,   47
  12951. ,  146,   51,  755,   38,  276,   40,  147,  121,  176,  376
  12952. , 1237,   49,  118,   42, 1240,   43, 1238,   64,   52,   65
  12953. ,   53, 1240,   66,   54,   45, 1237,   67,    4,  430,    5
  12954. ,   68,   46,    6,   69,  311,   55,    7, 1571,   70,   47
  12955. , 1571,   72,    8, 1238,   73,   56, 1240,   57, 1237,   59
  12956. ,   50, 1238,   60,  144,   62,  513,  619,   63, 1240,  514
  12957. , 1237,   66,  541,   67, 1571,   51,  861,   70,  759,   71
  12958. ,  911,  760,  286,   72, 1237,  762,  146,  171,  116,  342
  12959. ,  190,   37,   38,   39,   58,   40,   52,   59,  124,   53
  12960. ,   60,  406,   54,   61,  390,   65,   58,   71,   59,   72
  12961. ,   62,   73,  505,   66,   41,   68,   42,   69,   38,   43
  12962. ,   70,   39,   44,   71,  126,   40,   72,  881,   46,  815
  12963. ,   37,   37,  838,  128,   98,    9,   42,   58,   43,  542
  12964. ,   59,   44,   60,  470,   61,   45,  118,   63,   46,   64
  12965. ,   47,   66,  816,   67,  817,  343,   68,   99,  851,   69
  12966. ,   38,   70,   39,   71,   16,   40,   72,  550,   81,  789
  12967. ,   74,   50,  155,  122,   46,   42,  635,   43,   47,   45
  12968. ,   51,  621,  732,  648,  449,  412,  776, 1038,  649,  804
  12969. ,  415,  171,  311,   55,  396,  315,   74, 1011,   62,  191
  12970. ,  650,   66,  390,   71,   52,  286,   72,   54,  350,   55
  12971. ,  277,  265,   45,  146,  171,  300,   59,  147,   60,  811
  12972. ,   63,  243,  798,   64,   72,  101,   73,  103,   55,   58
  12973. ,   60,  424,   61,  146,  341,   62,  278,   65,  147,  837
  12974. ,   66,   64,   72,   67,   73,  249,  105,  362,  325,  313
  12975. ,  193,  343,  122,  107,   44,   16,  639,  171,  912,  122
  12976. ,   65,  249,  745,   67,  791,  171,   37,  640,  194,   55
  12977. ,   67,  109,  432,   27,  689,  229, 1027,   46,  300, 1028
  12978. ,   47,  407,  234,  654,  471,  265,  590,  591, 1520,  592
  12979. ,  544,  678,  582,  473,  405, 1520,   53,  792,  820,  595
  12980. ,   65,  793,   66, 1328,  544,   84,  116,  596,   38,  597
  12981. ,   40, 1030,  546,  323, 1425,  913,  122,   42, 1425,   43
  12982. , 1425,  390,   44,  365,   37, 1020,  864,  250,  945,  695
  12983. ,  827,   42, 1237,  171, 1237,   52,   54,  302,  474,  303
  12984. ,  841,   64, 1214,   65,  174, 1240,   66,  976,   67,  131
  12985. ,  746, 1240,   68,   10,  747,   69,    7,  748, 1240,   70
  12986. , 1240,   71, 1004,   72,    8,  116,   85,   86,   53,  110
  12987. , 1557,   66,  271,   67,  914,   69,   37,   70,   38,  177
  12988. ,  801,  379, 1118, 1238,  176, 1240,  749,  122,  750,   42
  12989. , 1237,   43, 1238,   44,  933,  550,   87,   45,  118,   88
  12990. , 1237,   47,  503,  617,  122, 1239,   42,  434,   43, 1238
  12991. ,   47, 1240,  725,  409,  194,  411,   87,  158,  577,  406
  12992. ,  122,  417,   43,  243,   44,  407, 1015,  194,   39,  811
  12993. ,  200,  797,  201,   43,   52,   44,  656,   53, 1418,   43
  12994. ,  387,   44,   64,   47,   52,   66,   53,   67,   54,  235
  12995. ,   55,   71, 1143,   72,  202,   73,  205,  753,  206,  657
  12996. ,  210,  195,   65,   70, 1143,  252,  211,   71,  212,   72
  12997. ,  213,  696, 1143,  408,  304,  411,  284,  415, 1143, 1143
  12998. ,  286,  720, 1143,  416, 1143,  475, 1143,  707, 1143,  417
  12999. , 1143,   37, 1143,  214, 1143,  215,  946,   52,  243,  756
  13000. ,  372,  249,  116,   37,   73,   79,  947,   42,   45,  513
  13001. ,  514,   37,   37,  758,   38,  759,   39,  760,   40,  920
  13002. ,   37,  144,   26,  823,   42,   38,   43,   39,   44,   45
  13003. ,  218,  194,   39, 1021,   42,  122,   37,   46,   43,   47
  13004. ,  171,  401,   42,  767,   43,  658,   47,   33,  662,  122
  13005. ,   38,   43,   39,   44,   52,  681,  674,  112,  726,  171
  13006. ,  604,  122,  675,   42,  676,   43,  677,   58,   44,   61
  13007. ,   45,   62,   79,   63,  573,  574,  780,   64,   47,  547
  13008. ,   67,  327,  934,   72,   52,  286,   54,  176,   64,   52
  13009. ,   65,   53,   66,   54,   68,   38,   69,   55,   39,   70
  13010. ,   40,   52,   72,   64,   52,   65,   53,  286,   66,   54
  13011. ,   69,   55,   64,   72,   67,   73,  122,   37,  171,   42
  13012. ,   68,  453,   43,   69,  388,   44,   70,   52,   71,   53
  13013. ,   72,   54,   45,   73,   46,  948,   64,   47,  998,  196
  13014. , 1145,   72,  781,   40,   59, 1145,   62,  285,  472,   63
  13015. ,  367,   66, 1559,   67, 1426, 1145, 1559,  122, 1559,   42
  13016. ,   68,   43,   69,   44,   70,  735,   72,   45,   73, 1377
  13017. ,   46, 1426,   47, 1426, 1145, 1426, 1559, 1426, 1559, 1145
  13018. ,  286,  407, 1145,  476, 1145,  132, 1145, 1559, 1426, 1145
  13019. ,  194, 1145, 1559,  133, 1426, 1145, 1559, 1426,  162, 1032
  13020. , 1426,   59,  286,   60,  137,   63,  138,   37,  139,  195
  13021. ,   65,  987,   68,  768,   37,  921,   54,  122,   38,   42
  13022. ,   39,  226,  843,   43,   64,   40,   44,   65,  897,   45
  13023. ,  237,   46,   70,   47,   72,   73,   13,  122,   15,   44
  13024. ,   16,  146,  602,  171,   19,   52,  641,  708, 1237,  165
  13025. ,  884,  220,  221, 1237,  885,  223, 1240,  229,   64, 1240
  13026. ,   65, 1237,   70,   52,   71,   53,   72,   54,  951,   22
  13027. ,  471,   23, 1237,   66,  664,   37,   68, 1239,   70,  548
  13028. ,   71, 1238,   72, 1240,  288,   39,  254,  830,   42,  780
  13029. ,   25,  821,  803,  804,  167,  916,  805,  474,  306,  604
  13030. ,  122,  180,  145,  147,   30,   40,  286,   46,  382,  643
  13031. ,  497,  683,   52,  413,   53,  414,   54, 1006,   55,   34
  13032. ,  478,  148,   37,  416,  479,  289,  420,   66,   37,   68
  13033. ,  898,   69,  553,   72,  554,   73,  936,  455,  644,  115
  13034. ,  591,  116,  989,   52,  592,  603,  586,   35,  709,  171
  13035. ,   37,  120,  461,  227,  886,   52,  456,   62,  328,   38
  13036. ,   43,   39,   44,   64,   40,   67,  188,   37,   68,   73
  13037. ,   37,   42,  502,  596,   43,   38,   46,   40,   47, 1458
  13038. ,   41,   38,   42,   39,   43,   40,   45,  171,   46,  504
  13039. ,  505,  132,   42,  133,   52,  506, 1458,   54,   45,  122
  13040. ,   37,   46,   43,   55,  390,   44,  794,   47,   47,   52
  13041. ,   64,   40,   66, 1458,   69,   49,   71,  782,  783, 1458
  13042. ,   73,  784,   38,  663,   39, 1458,  195,   67,  297,  134
  13043. ,   69,  135,   70,  136,   71, 1119,   72, 1119,  171,  138
  13044. ,  471,  810,  139,   42,  140,   43,   52,   44,   53,   50
  13045. ,  330,  229,  181,  472,  368,   51,   42,   52,  124,  147
  13046. ,   53,  873,  194,  300,   52,  831,   55,  243,   64, 1033
  13047. ,   67,   56,   68,   57,   69,   58,   71,  126,   59,   72
  13048. ,  952,   61,   62,   73,   64,   52,   65,   53,  507,   66
  13049. ,   54,   69,   55,   70,   52,   71,   53,  286,   72,   54
  13050. ,   73,   37,   98,   36,   64,   59,  286,   65,   60,   66
  13051. ,   61,   67,   62,   70,   64,  300,   71,  195,   65,   72
  13052. ,   66,   73,   68,   70,  243,   71,   16,  116,   38,  964
  13053. ,  141,   58,   53,   59,   54,   60,  189,   62,  122,  190
  13054. ,   63,  630,  508,   42,   55,  239,  509,   43,  510,   44
  13055. ,   64,  511,  745,   65,  551,  240,   66,   45,   67,  512
  13056. ,  241,   68,   46,  907,   69,  290,   70,   47,  146,  552
  13057. ,  970,  802, 1485,  286,  146, 1481,  171, 1481,  604,   79
  13058. ,  307,  194,   39,   40,   52, 1481,  605,   54,  116,   37
  13059. ,  122,   68,   42,   69,   43,   70,   44,   71, 1013,   72
  13060. ,   38,   46,  515,   40,   47,  398,   40,  922,  117,  122
  13061. ,   37,  833,   42,   46,   43,  553,   47,  518,  746,   46
  13062. ,  917,  631,  748,   47,  555,  118,  556,  471,  558,   40
  13063. ,  323,  286,  846,  383,  888,   83,  834,   42,  437,   47
  13064. ,  808,  737,   92,   52,  371,  480,  171,   61,  169,   84
  13065. ,   62,  116,  256,  126,   65,  697,   68,  170,  955,   55
  13066. ,  128,   52,  129,   54,  563,  130,  564,  749,  122,  565
  13067. ,  750,   55,  566,   43,  567,   58,   44,  568,   59,  569
  13068. ,   60,   61,  331,  572,   64,  286,  573,   69,   70,   64
  13069. ,  574,   71,   65,  575,   72,   66,   73,   68,   53,  230
  13070. ,  523,   67,  791,  685,  622, 1583,  183,   52,  526,   53
  13071. ,  527,   37,   85,  194,   86,  122,   37,   37,   46,  503
  13072. ,  793,  273,   42,   38,   46,   40,   47,   38,  610,  194
  13073. ,   39,  194,   44,  122,  697,   46, 1015,   42,   43,   47
  13074. , 1016,   44,   46,  699,   47,  286,  770, 1578,   79, 1377
  13075. ,  588,  171,   42,  311, 1578,   43, 1578,   47,   52,  847
  13076. ,  147,   64,   52,   65,   53,  923,  286,   66,   54,   67
  13077. ,  355,  529,   79,   68,   69,   55,  710,   71,   72,   87
  13078. ,   73,   37,  687,   65,  824,   38,   55,   39,   52,  462
  13079. ,   55,   58,  125,   63,  992,  116,   38,   64,   40,   58
  13080. ,   65,  852,   59,   66,   60,   67,   62,   68,   63,   69
  13081. ,   64,   72,   67,   73,   41,   68,   43,   69,  194,   44
  13082. ,   71,  463,   72,   45,   73,   46,  754,   52,   54,   45
  13083. ,  471,   37,  712,  424,   65,  147,  738,   66,   68,   38
  13084. ,   69,  333,   70,   40,  323,   72,  785,   73,   79,  869
  13085. ,   49,  853,  122,  771,   42,  514,  116,   43,  772,  122
  13086. ,  972,  439,   45,   51,  241,   46,   47, 1484, 1480,  171
  13087. , 1480,   75,  313,   54,  908,   55,  132,  356,  669,   57
  13088. ,  635,  133,   58,  854,   52,   59,   53,   60,  300, 1480
  13089. ,   54,   61,  481,   63,   43,   64,  390,   44,  372,   65
  13090. ,  243,  373,   66,  118,   69,  258,   73,  323,  286,  925
  13091. ,  440,   38,   70,   39,   71,   40,   72,  138,   42,  139
  13092. ,   43,  140,   44,  122,   46,   43,  441,   47,   52,   44
  13093. ,   53,  875,   47,   52,  393,  241,   37,   60,  172,   61
  13094. ,   90,   64,   72,  994,   67,  390,   71,  722,   39,  300
  13095. ,   52,  286,  286,  637, 1008,   55,   53,  143,   54,  557
  13096. ,  558,  232,   55,  532,  293,  464,   39,  559,   64,   40
  13097. ,   58,   65,   59,   66,   60,  144,   67,   62,   68,   63
  13098. ,   69,  537,   71,   64,   72,  918,   66,   67,   73,   71
  13099. ,  538,  560,  339,  939,   46,   53,  145, 1143,   54,  146
  13100. ,   38,  425,   39,  347,  147,  563,   61, 1143,  564,   62
  13101. ,  565,   63,  229,  566,  568,   64, 1143,  569,   65, 1143
  13102. ,   66, 1143,   67, 1143,  611,  570,   68, 1143,  571,   69
  13103. , 1143,  572,   70, 1143,   71, 1143,   72, 1143,   73,  335
  13104. , 1143,  573, 1143,  122, 1143,   42,  574, 1446,   43,  575
  13105. ,  265, 1446,   44, 1143,   45,   78, 1143,  773, 1143,  854
  13106. ,   43,   45,  700,  482, 1017,  171,   53,  503,   66,  245
  13107. ,   67,  116,   69,  194,  956,   43,  407,   53,   72,  184
  13108. ,   38,   40,  771,  876,  813,   38,  807,   42,  122,   43
  13109. ,   42,  400,   44,   46,   47,   47,   52,  856,   53,  835
  13110. ,   46,   76,  194,  624,  194,  311,  268,  871,  195,  761
  13111. ,  763,  892,  764,   37,   40,   52,  195,   53,   52,   54
  13112. ,   53,  121,   54,  348,   38,   64,   39,   65,   64,   40
  13113. ,   66,   94,   65,   67,   67,  122,   68,  909,   42,   69
  13114. ,   68,   43,   70,   69,   58,   44,  337,   71,   70,   59
  13115. ,   72,   71,  249,   60,   72,   61,   45,   62,   73,  671
  13116. ,   63,   73,   38,   46,   64,   40,   47,  927,  607,   65
  13117. ,   68,  295,  814,  401,  767,   46,  838,   43, 1035,  374
  13118. ,  857,  196,   79,  317,  995,  798,  286,  878,  186,  375
  13119. ,  202,  376,  204, 1237,  206, 1237,   58,  208,   59,  209
  13120. ,   60,  210,  625,   63, 1238,   64,   52, 1240,  313,   66
  13121. ,  338,   53, 1237,  314,   67,   54,  315,   13,   68,   14
  13122. ,   69, 1514,   70,   55,   71, 1514,   72,  211,  212,  261
  13123. ,  144, 1238,   73, 1240,  787, 1237,   43,   52, 1238,   44
  13124. ,   53, 1240,  483,   64, 1237,   66, 1514,   67,   37,   69
  13125. ,  194,  386,   72, 1237,   73,  181, 1239,  201,   64,   86
  13126. ,   65, 1238,   66,   70,  201,   72,   87, 1240,   95,  690
  13127. ,  102,  241,  484,   37,  150,  983,   53,  255,  465,   54
  13128. ,  331,   96,   39,  578,  249,  491,  322,  268,  246,   43
  13129. ,   28,   45,  218,  171,   38,   46,  106,   40,   47,   43
  13130. ,  539,   52,   44,   53, 1002,  409,   55,  410,   46,    0
  13131. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13132. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13133. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13134. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13135. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13136. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13137. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13138. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13139. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13140. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13141. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13142. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13143. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13144. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13145. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13146. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13147. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13148. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13149. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13150. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13151. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13152. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13153. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13154. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13155. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13156. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13157. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13158. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13159. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13160. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13161. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13162. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13163. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13164. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13165. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13166. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13167. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13168. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13169. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13170. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13171. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13172. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13173. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13174. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13175. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13176. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13177. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13178. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13179. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13180. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13181. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13182. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13183. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13184. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13185. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13186. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13187. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13188. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13189. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13190. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13191. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13192. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13193. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13194. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13195. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13196. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13197. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13198. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13199. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13200. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13201. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13202. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13203. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13204. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13205. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13206. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13207. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13208. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13209. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13210. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13211. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13212. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13213. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13214. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13215. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13216. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13217. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13218. ,    0,    0,    0)  ;
  13219.         --| Actions to perform for all combinations of parser
  13220.         --| states and input tokens.
  13221.         -- NYU Reference Name: ACTION_TABLE1
  13222.  
  13223.     ActionTableTwo :
  13224.         constant array (ActionTableTwoRange)
  13225.         of GC.ParserInteger :=
  13226.          (    0,338484,338485,    0,    0,    0,    0,74588,154907,    0
  13227. ,    0,    0,344232,    0,    0,57385,    0,57387,    0,    0
  13228. ,    0,    0,    0,    0,    0,    0,57396,218033,    0,    0
  13229. ,    0,321303,258197,160669,195092,    0,    0,    0,    0,    0
  13230. ,160676,    0,160678,    0,    0,    0,160682,    0,    0,    0
  13231. ,160686,    0,160688,160689,    0,    0,    0,    0,    0,    0
  13232. ,    0,    0,    0,281176,    0,    0,    0,    0,    0,    0
  13233. ,    0,269710,    0,    0,    0,407402,    0,    0,    0,    0
  13234. ,258245,    0,269721,269722,258249,    0,    0,    0,177935,    0
  13235. ,    0,126305,    0,258258,258259,258260,258261,    0,    0,    0
  13236. ,160736,    0,258267,258268,258269,    0,258271,258272,258273,258274
  13237. ,258275,    0,    0,258278,    0,    0,    0,    0,269757,269758
  13238. ,    0,    0,    0,269762,    0,86180,    0,    0,    0,    0
  13239. ,    0,    0,    0,    0,    0,    0,137824,    0,    0,    0
  13240. ,269779,269780,    0,269782,86199,269784,269785,269786,269787,    0
  13241. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,160795
  13242. ,    0,    0,    0,    0,    0,    0,    0,200962,    0,    0
  13243. ,    0,    0,    0,    0,    0,160811,    0,    0,    0,    0
  13244. ,    0,137869,137870,    0,    0,137873,137874,91979,    0,    0
  13245. ,    0,160827,160828,137881,160830,    0,    0,    0,    0,    0
  13246. ,390316,    0,    0,160839,160840,160841,    0,    0,160844,160845
  13247. ,    0,57581,57582,    0,160850,    0,    0,    0,    0,    0
  13248. ,    0,    0,    0,298547,    0,    0,    0,    0,    0, 5966
  13249. ,    0,    0,    0,    0,    0,    0,315771,    0,    0,    0
  13250. ,396093,    0,57612,    0,    0,223988,    0,    0,    0,    0
  13251. ,    0,390367,    0,    0,    0,298579,298580,298581,    0,    0
  13252. ,57630,    0,401852,    0,    0,    0,57636,    0,    0,350226
  13253. ,    0,    0,350229,304334,    0,390391,    0,390393,    0,    0
  13254. ,    0,    0,34704, 6020,    0,298609,298610,298611,298612,    0
  13255. ,    0,    0,    0,    0,298618,    0,298620,    0,97827,28984
  13256. ,    0,    0,    0,    0,    0,321577,    0,    0,    0,    0
  13257. ,    0,    0,    0,247004,    0,132266,    0,    0,201113,    0
  13258. ,247011,    0,    0,    0,    0,    0,252754,    0,321600,    0
  13259. ,    0,29016,    0,29018,321606,    0,    0,321609,    0,    0
  13260. ,    0,298665,373247,373248,    0,321617,195404,321619,    0,    0
  13261. ,    0,    0,    0,    0,    0,    0,    0,    0,155257,269998
  13262. ,218366,    0,    0,    0,29049,    0,390482,    0,321640,    0
  13263. ,321642,321643,    0,    0,    0,321647,321648,321649,298702,321651
  13264. ,321652,321653,    0,92175,321656,321657,    0,321659,321660,321661
  13265. ,    0,218397,57762,    0,57764,    0,    0,344617,    0,    0
  13266. ,    0,    0,333148,333149,333150,333151,    0,    0,333154,    0
  13267. ,    0,333157,    0,    0,298738,    0,    0,    0,57788,298743
  13268. ,    0,    0,    0,    0,    0,    0,103692,304488,298752,    0
  13269. ,    0,298755,298756,    0,    0,    0,298760,298761,298762,298763
  13270. ,  440,    0,    0,298767,298768,298769,    0,    0,    0,    0
  13271. ,    0,86506,    0,304514,    0,    0,    0,    0,333204,    0
  13272. ,    0,    0,    0,    0,    0,    0,    0,    0,373373,373374
  13273. ,373375,    0,    0,    0,    0,    0,    0,    0,    0,293066
  13274. ,    0,    0,23430,    0,    0,218491,    0,218493,218494,    0
  13275. ,29175,    0,    0,    0,    0,    0,    0,218503,    0,    0
  13276. , 6237,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13277. ,149672,    0,    0,29198,    0,29200,    0,    0,29203,    0
  13278. ,29205,29206,    0,    0,    0,189846,    0,    0,    0,230009
  13279. ,333276,333277,    0,98062,    0,    0,333282,    0,    0,    0
  13280. ,    0,    0,149704,149705,149706,333291,333292,    0,    0,333295
  13281. ,333296,    0,103818,333299,    0,333301,    0,407884,333304,333305
  13282. ,333306,333307,333308,407890,    0,    0,98095,98096,    0,    0
  13283. ,    0,247262,149734,149735,149736,    0,    0,    0,149740,    0
  13284. ,    0,149743,    0,    0,    0,    0,    0,    0,    0,    0
  13285. ,    0,    0,    0,    0,126808,    0,98125,98126,98127,    0
  13286. ,    0,    0,    0,    0,98133,    0,98135,    0,    0,    0
  13287. ,    0,    0,126826,    0,    0,    0,    0,    0,    0,    0
  13288. ,    0,    0,    0,195681,46520,    0,    0,57997,57998,    0
  13289. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13290. ,    0,109644,224385,    0,121121,121122,    0,310445,    0,    0
  13291. ,    0,98180,    0,    0,149816,    0,86711,    0,58028,58029
  13292. ,    0,    0,    0,58033,    0,    0,58036,    0,58038,    0
  13293. ,    0,    0,    0,121150,121151,121152,121153,98206,132629,    0
  13294. , 6417,    0,121159,    0,    0,149847,    0,299011,    0,    0
  13295. ,17901,    0,    0,    0,    0,235912,    0,    0,    0,    0
  13296. ,149862,149863,149864,    0,    0,    0,149868,    0,    0,149871
  13297. ,    0,    0,258877,    0,    0,385094,    0,    0,287568,17930
  13298. ,    0,    0,17933,    0,    0,    0,    0,    0,    0,    0
  13299. ,    0,149893,    0,    0,    0,    0,    0,167110,98267,    0
  13300. ,    0,98270,    0,    0,    0,    0,98275,98276,    0,    0
  13301. ,    0,98280,98281,    0,    0,    0,304817,    0,98287,304820
  13302. ,304821,    0,385141,    0,385143,322037,    0,167140,    0,247460
  13303. ,    0,    0,322044,385152,92566,17986,385155,69621,385157,385158
  13304. ,    0,    0,    0,    0,    0,58155,58156,58157,35210,    0
  13305. ,    0,58161,    0,    0,    0,    0,    0,58167,58168,    0
  13306. ,    0,    0,    0,    0,58174,58175,    0,121284,58178,    0
  13307. ,58180,58181,18023,58183,58184,58185,    0,    0,121295,121296
  13308. ,    0,121298,281935,    0,121301,121302,    0,121304,    0,    0
  13309. ,    0,    0,    0,    0,    0,167208,121313,    0,    0,    0
  13310. ,167213,    0,    0,    0,    0,    0,    0,18058,18059,18060
  13311. ,    0,    0,18063,18064,    0,    0,18067,    0,18069,    0
  13312. ,    0,293448,    0,    0,    0,    0,18077,    0,    0,    0
  13313. ,    0,18082,    0,    0,304935,    0,    0,    0,    0,    0
  13314. ,    0,    0,18093,    0,    0,167258,368054,368055,368056,12363
  13315. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,282012
  13316. ,    0,    0,    0,    0,    0,    0,    0,190228,190229,190230
  13317. ,190231,    0,    0,190234,    0,    0,    0,    0,    0,368087
  13318. ,    0,    0,    0,    0,    0,368093,    0,368095,    0,    0
  13319. ,    0,    0,356626,    0,    0,    0,    0,    0,    0,    0
  13320. ,    0,    0,    0,293530,    0,    0,    0,385326,385327,385328
  13321. ,    0,385330,385331,    0,    0,379597,155855,167330,167331,167332
  13322. ,408287,    0,    0,    0,385343,    0,121443,121444,    0,167342
  13323. ,167343,385350,167345,167346,167347,167348,    0,167350,35400,    0
  13324. ,167353,167354,    0,167356,    0,167358,167359,167360,    0,    0
  13325. ,293577,    0,167365,    0,    0,    0,    0,    0,    0,391115
  13326. ,    0,    0,    0,    0,293591,    0,    0,293594,293595,    0
  13327. ,368178,    0,    0,293600,293601,293602,    0,293604,293605,293606
  13328. ,293607,    0,    0,12497,    0,12499,    0,    0,    0,    0
  13329. ,    0,    0,    0,    0,316569,190356,190357,190358,    0,224782
  13330. ,    0,190362,    0,    0,368212,368213,368214,    0,    0,    0
  13331. ,    0,190372,    0,    0,    0,190376,58426,58427,190379,    0
  13332. ,    0,190382,173172,190384,190385,190386,190387,    0,368236,368237
  13333. ,    0,    0,368240,368241,368242,368243,368244,    0,    0,368247
  13334. ,    0,75662,    0, 6820,75665,    0,    0,    0,    0,    0
  13335. ,253518,    0,236309,253521,    0,    0,184680,    0,305159,    0
  13336. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13337. ,    0,    0,    0,    0,    0,    0,    0,247808,    0,    0
  13338. ,    0,12595,    0,    0,    0,    0,    0,12601,    0,    0
  13339. ,    0,    0,    0,    0,12608,    0,    0,    0,    0,    0
  13340. ,167513,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13341. ,98679,    0,    0,196211,    0,    0,    0,    0,    0,305220
  13342. ,305221,385540,    0,    0,322436,    0,    0,    0,    0,    0
  13343. ,    0,    0,    0,379815,    0,    0,    0,    0,    0,    0
  13344. ,    0,    0,    0,    0,    0,58555,    0,87242,    0,    0
  13345. ,    0,213460,    0,213462,    0,    0,    0,190518,52831,    0
  13346. ,    0,190522,190523,    0,282317,    0,    0,    0,    0,    0
  13347. ,64317,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13348. ,    0,    0,184806,    0,322496,    0,    0,    0,    0,    0
  13349. ,    0,    0,    0,    0,282347,    0,    0,    0,    0,    0
  13350. ,    0,    0,64349,64350,64351,    0,    0,    0,    0,    0
  13351. ,345470,    0,    0,    0,    0,    0,12730,    0,    0,    0
  13352. ,    0,    0,    0,    0,265166,    0,    0,    0,    0,    0
  13353. ,    0,    0,    0,64380,64381,    0,253704,    0,64385,    0
  13354. ,    0,    0,    0,    0,    0,    0,356980, 1287,    0,356983
  13355. ,    0,    0,    0,138981,    0,    0,    0,    0,    0,    0
  13356. ,    0,    0,    0,    0,150466,    0,    0,    0,    0,    0
  13357. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13358. ,    0,    0,    0,    0,    0,    0,    0,213596,    0,    0
  13359. ,    0,213600,    0,24281,    0,    0,150498,150499,150500,    0
  13360. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13361. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13362. ,    0,    0,242316,334109,    0,    0,    0,150529,150530,150531
  13363. ,    0,    0,150534,    0,    0,150537,    0,150539,    0,    0
  13364. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,98918
  13365. ,    0,    0,339875,    0,    0,    0,    0,    0,    0,    0
  13366. ,64507,64508,64509,    0,    0,    0,64513,    0,    0,    0
  13367. ,    0,    0,    0,    0,    0,    0,    0,47313,    0,    0
  13368. ,    0,    0,    0,    0,    0,64532,    0,    0,64535,64536
  13369. ,64537,64538,64539,    0,    0,    0,225179,    0,    0,    0
  13370. ,    0,    0,    0,    0,173554,    0,    0,    0,150610,339932
  13371. ,    0,    0,    0,351410,    0,    0,351413,    0,    0,    0
  13372. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13373. ,    0,    0,133423,    0,    0,    0,    0,    0,    0,    0
  13374. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13375. ,70334,    0,    0,    0,150656,150657,150658,    0,    0,    0
  13376. ,    0,374406,374407,374408,    0,    0,    0,    0,    0,    0
  13377. ,    0,12985,133463,    0,    0,    0,    0,150679,150680,150681
  13378. ,    0,    0,150684,150685,150686,150687,150688,    0,    0,150691
  13379. ,    0,374436,374437,374438,374439,    0,351493,374442,    0,    0
  13380. ,    0,    0,    0,    0,    0,    0,    0,70391,    0,    0
  13381. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13382. ,    0,    0,    0,    0,    0,    0,    0,167940,93360,    0
  13383. ,133521,    0,162208,    0,162210,    0,    0,    0,    0,    0
  13384. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13385. ,    0,    0,271231,213862,    0,    0,    0,213866,    0,156498
  13386. ,219606,    0,179449,    0,    0,179452,    0,    0,    0,294196
  13387. ,294197,    0,    0,    0,    0, 1615,    0,    0,    0,    0
  13388. ,    0,    0,    0,    0,374529,374530,    0,374532,    0,    0
  13389. , 1630, 1631,    0, 1633,    0,    0,    0,    0,    0,282752
  13390. ,    0,179488, 1642,    0,179491,    0,    0,    0,    0,    0
  13391. ,    0,    0,    0,    0,231134,    0,    0,    0,    0,374564
  13392. ,    0,374566,    0,    0,    0,374570,    0,190988,    0,    0
  13393. ,127884,    0,    0,24621,    0,219681,    0,219683,    0,    0
  13394. ,    0,    0,374587,    0,    0,374590,122163,374592,374593,374594
  13395. ,374595,374596,    0,    0,374599,254123,    0,    0,    0,    0
  13396. ,    0,150863,    0,    0,    0,    0,    0,    0,70552,    0
  13397. ,368878,    0,    0,254141,    0,36137,179563,    0,    0,    0
  13398. ,168093,    0,    0,    0,    0,    0,36148,    0,    0,    0
  13399. ,36152,36153,36154,    0,150896,    0,    0,    0,    0,139427
  13400. ,    0,    0,    0,    0,    0,259910,    0,36169,36170,36171
  13401. ,36172,179598,254180,    0,    0,    0,403346,    0,    0,    0
  13402. ,    0,36183,    0,    0,    0,    0,    0,    0,    0,150931
  13403. ,36192,    0,150934,323045,150936,93567,    0,    0,    0,    0
  13404. ,    0,    0,    0,    0,317319,    0,    0,    0,391904,    0
  13405. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13406. ,    0,    0,    0,    0,    0,36227,    0,    0,317343,    0
  13407. ,317345,    0,    0,    0,    0,    0,    0,    0,59188,59189
  13408. ,59190,    0,    0,    0,    0,    0,    0,    0,    0,47725
  13409. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,391955
  13410. ,    0,173951,    0,    0,    0,151007,    0,    0,59218,    0
  13411. ,59220,59221,    0,294440,59224,    0,    0,59227,196916,59229
  13412. ,    0,    0,    0,391979,196922,391981,196924,    0,196926,196927
  13413. ,    0,    0,    0,196931,196932,196933,122353,196935,196936,196937
  13414. ,    0,    0,196940,196941,    0,    0,    0,196945,    0,    0
  13415. ,    0,    0,151054,    0,    0,    0,    0,151059,    0,317434
  13416. ,196958,    0,    0,133854,59274,196963,    0,196965,    0,    0
  13417. ,    0,    0,    0,    0,    0,    0,    0,    0, 1918,    0
  13418. ,    0,    0,    0,    0,    0,    0,151088,    0,    0,    0
  13419. ,59300,93723,    0,    0,    0,30620,    0,    0,    0,    0
  13420. ,    0,59311,    0,    0,    0,    0,197004,    0,    0,179796
  13421. ,    0,    0,    0,    0,392070,30640,283069,    0,    0,    0
  13422. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,294556
  13423. ,    0,168344,168345,    0,    0,    0,59346,    0,59348,    0
  13424. ,    0,116721,59352,    0,    0,    0,    0,    0,    0,59359
  13425. ,    0,59361,59362,59363,59364,59365,59366,    0,    0,59369
  13426. ,59370,    0,    0,220009,59374,    0,    0,59377,59378,    0
  13427. ,    0,59381,    0,    0,116754,116755,    0,    0,    0,128233
  13428. ,168393,128235,    0,    0,    0,    0,    0,128241,    0,128243
  13429. ,    0,128245,128246,    0,    0,    0,    0,    0,357732,357733
  13430. ,357734,    0,    0,    0,    0,    0,    0,    0,346268,    0
  13431. ,128264,    0,116792,254481,    0,    0, 2056,    0,    0,179906
  13432. ,128274,    0,    0,128277,    0, 2065,    0,283180,    0,    0
  13433. ,    0,357765,    0,    0,357768,369243,    0,357771,    0,    0
  13434. ,    0,    0,128296,    0,128298,128299,    0,197145,    0,220095
  13435. ,    0,197149,    0,197151,197152,197153,13570,197155,    0,    0
  13436. ,231580,    0,    0,    0,42263,    0,254534,197165,    0,    0
  13437. ,254538,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13438. ,76701,99650,    0,    0,179971,116865,    0,36549,36550,36551
  13439. ,    0,    0,392248,    0,403724,    0,116876,    0,    0,    0
  13440. ,271779,392257,    0,    0,36566,260310,    0,36569,    0,254577
  13441. ,357844,    0,168525,99682,    0,99684,409483,36579,36580,59529
  13442. ,    0,    0,    0,392279,357858,    0,    0,    0,    0,329178
  13443. ,    0,    0,    0,116913,    0,    0,    0,116917,    0,    0
  13444. ,    0,392297,    0,99712,99713,    0,    0,    0,    0,99718
  13445. ,    0,    0,99721,    0,    0,116935,    0,    0,    0,116939
  13446. ,116940,116941,    0,    0,36626,36627,    0,    0,36630,36631
  13447. ,36632,    0,    0,    0,    0,    0,    0,    0,    0,357913
  13448. ,    0,357915,357916,    0,357918,357919,    0,    0,    0,    0
  13449. ,    0,357925,122709,    0,    0,122712,    0,    0,30923,99768
  13450. ,    0,30926,254670,254671,254672,122722,289096,352204,    0,    0
  13451. ,    0,    0,    0,128467,128468,    0,128470,128471,128472,    0
  13452. ,    0,    0,329271,    0,    0,    0,122743,122744,122745,    0
  13453. ,    0,122748,    0,    0,122751,    0,99805,    0,122755,122756
  13454. ,    0,122758,    0,122760,    0,122762,    0,    0,36710,    0
  13455. ,    0,    0,    0,    0,    0,254723,    0,    0,329307,329308
  13456. ,254728,    0,    0,    0,    0,    0,363737,260472,248999,    0
  13457. ,    0,99840,99841,99842,    0,    0,    0,99846,323590,323591
  13458. ,323592,    0,    0,    0,    0,    0,99855,99856,99857,99858
  13459. ,99859,99860,    0,    0,99863,99864,99865,99866,174448,99868
  13460. ,99869,99870,99871,99872,    0,    0,    0,    0,323620,    0
  13461. ,323622,323623,    0,    0,    0,    0,    0,323629,    0,323631
  13462. ,    0,283474,283475,254791,    0,    0,    0,254795,254796,    0
  13463. ,254798,254799,254800,    0,    0,340858,254804,    0,    0,386758
  13464. ,    0,    0,    0,36805,    0,42544,    0,168760,168761,168762
  13465. ,    0,    0,    0,36815,220400,    0,    0,    0,346618,    0
  13466. ,    0,    0,36824,220409,323676,220411,    0,335153,    0,    0
  13467. ,117150,    0,117152,    0,    0,    0,283529,168790,    0,168792
  13468. ,168793,    0,    0,168796,    0,    0,    0,346647,    0,346649
  13469. ,323702,    0,346652,    0,    0,346655,    0,346657,    0,    0
  13470. ,117180,    0,    0,117183,    0,    0,117186,    0,    0,117189
  13471. ,36872,    0,    0,214722,214723,214724,    0,214726,    0,    0
  13472. ,306521,    0,    0,36885,36886,36887,36888,    0,231948,    0
  13473. ,    0,    0,    0,    0,    0,    0,    0,323749,323750,    0
  13474. ,    0,    0,323754,    0,140172,180332,    0,    0,    0,    0
  13475. ,    0,    0,323764,323765,    0,    0,    0,306558,    0,    0
  13476. ,323772,323773,    0,    0,323776,323777,323778,323779,    0,    0
  13477. ,168883,323783,    0,    0,    0,    0,    0,358211,100047,346739
  13478. ,36942,    0,    0,220529,    0,    0,    0,    0,220534,25477
  13479. ,    0,    0,134483,117273,25482,    0,25484,    0,    0,    0
  13480. ,    0,    0,    0,36965,306605,    0,    0,    0,220554,180396
  13481. ,    0,    0,    0,220559,    0,346775,346776,220563,    0,    0
  13482. ,346780,    0,    0,31248,    0,    0,381208,151729,    0,    0
  13483. ,    0,168944,    0,168946,    0,168948,168949,    0,346798,346799
  13484. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13485. ,    0,    0,117332,117333,117334,    0,117336,117337,117338,117339
  13486. ,    0,    0,42761,117343,    0,    0,289456,    0,    0,    0
  13487. ,    0,    0,59982,59983,    0,    0,306677,306678,306679,    0
  13488. ,    0,    0,306683,123100,    0,    0,    0,123104,404218,123106
  13489. ,    0,306692,    0,306694,306695,    0,    0,71481,    0,306700
  13490. ,306701,    0,    0,    0,    0,    0,    0,306708,    0,    0
  13491. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13492. ,71504,71505,    0,    0,123141,123142,123143,123144,123145,    0
  13493. ,123147,    0,71516,100202,    0,    0,    0,134628,123155,    0
  13494. ,123157,71525,123159,123160,123161,    0,    0,    0,    0,    0
  13495. ,    0,134642,134643,    0,    0,    0,    0,134648,    0,    0
  13496. ,    0,    0,    0,    0,    0,    0,    0,    0,100237,100238
  13497. ,100239,    0,192033,    0,100243,    0,    0,237934,    0,    0
  13498. ,19931,19932,19933,100252,    0,    0,100255,100256,    0,    0
  13499. ,19941,100260,    0,100262,100263,60105,    0,100266,100267,100268
  13500. ,100269,    0,    0,100272,    0,    0,    0,    0,    0,352706
  13501. ,    0,352708,    0,    0,    0,174865,    0,14231,    0,    0
  13502. ,    0,220767,220768,220769,    0,    0,    0,    0,324040,    0
  13503. ,60140,60141,    0,    0,    0,    0,60146,    0,    0,346999
  13504. ,    0,    0,157681,    0,    0,60155,    0,    0,398641,    0
  13505. ,157689,    0,    0,    0,    0,60165,60166,    0,60168,60169
  13506. ,    0,60171,    0,    0,    0,    0, 2806,    0,    0,    0
  13507. ,    0,    0,    0,    0,169187,    0,    0,    0,    0,    0
  13508. ,    0,    0,54455,54456,    0,    0,    0,54460,    0,    0
  13509. ,54463,    0,54465, 2833,129048,    0,    0,    0,    0,    0
  13510. ,    0,    0,157741,    0,    0,    0,    0,    0,    0,    0
  13511. ,306911,    0,    0,20064,20065,    0,    0,    0,    0,    0
  13512. ,    0,    0,    0,    0,    0,20076,    0,358561,    0,    0
  13513. ,    0,    0,    0,220879,358568,    0,    0,358571,    0,    0
  13514. ,    0,140569,    0, 2883,    0,    0, 2886, 2887,    0,    0
  13515. ,    0,25839,    0,    0,    0,    0,    0,    0,    0,    0
  13516. ,    0,370069,    0,54536,    0,    0,25854,    0,    0,    0
  13517. ,    0,    0,    0,    0,54547,    0,    0,    0,    0,    0
  13518. ,220926,220927,    0,    0,    0,220931,    0,    0,    0,    0
  13519. ,    0,    0,    0,175043,    0,25883,    0,    0,    0,404529
  13520. ,163576,    0,    0,    0,220950,220951,    0,220953,220954,    0
  13521. ,    0,    0,163588,163589,220960,54588,163592,163593,278334,    0
  13522. ,    0,163597,    0,    0,    0,163601,    0,    0,    0,    0
  13523. ,    0,    0,54605,54606,    0,54608,    0,    0,54611,    0
  13524. ,    0,    0,    0,14457,54617,    0,    0,    0,    0,    0
  13525. ,163626,    0,    0,    0,    0,163631,163632,    0,    0,209531
  13526. ,    0,    0,    0,    0,    0,    0,    0,48903,    0,60379
  13527. ,    0,60381,    0,    0,    0,    0,    0,    0,    0,352976
  13528. ,163656,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13529. ,330039,    0,175142,    0,    0,289885,    0,    0,    0,60409
  13530. ,    0,60411,60412,    0,    0,60415,    0,    0,60418,    0
  13531. ,60420,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13532. , 3060,    0,    0,    0,    0,    0,    0,    0,    0, 3069
  13533. , 3070,    0,    0, 3073,    0,    0,353033,    0,    0,    0
  13534. ,    0,    0,    0,20294,71928,    0,    0,209619,    0,129303
  13535. ,    0,    0,    0,    0,    0,    0,135047,135048,203893,    0
  13536. ,    0,203896,    0,    0,    0,    0,    0,20318,    0,    0
  13537. ,    0,    0, 3112,    0,    0,    0,    0,    0, 3118,209651
  13538. ,209652,    0,261287,186707,    0,    0,    0, 3127, 3128,    0
  13539. ,    0,    0,60502,    0,    0,    0,    0,    0,    0,    0
  13540. ,    0,    0,    0,    0,    0,89200,    0,    0,    0,209681
  13541. ,209682,209683,209684,    0,    0,209687,94948,    0,    0,    0
  13542. ,209692,    0,    0,    0,    0,163801,163802,    0,    0,    0
  13543. ,    0,163807,    0,    0,    0,    0,    0,    0,    0,    0
  13544. ,    0,    0,    0,370351,    0,    0,    0,135138,163824,    0
  13545. ,60560,60561,    0,60563,43353,    0,    0,60567,60568,    0
  13546. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13547. ,358904,    0,    0,295800,295801,295802,106482,    0,295805,376124
  13548. ,    0,    0,    0,135174,135175,    0,    0,66334,66335,66336
  13549. ,    0,209763,    0,    0,    0,    0,    0,    0,358932,    0
  13550. ,    0,358935,    0,295830,295831,295832,295833,    0,    0,295836
  13551. ,    0,    0,295839,    0,295841,    0,    0,66364,66365,66366
  13552. ,66367,    0,169635,66370,    0,358959,    0,    0,    0,    0
  13553. ,    0,    0,    0,    0,    0,    0,    0,    0,209810,209811
  13554. ,    0,    0,267184,209815,    0,    0,169659,    0,169661,    0
  13555. ,    0,37713,209824,209825,209826,209827,    0,209829,    0,    0
  13556. ,    0,209833,209834,    0,    0,    0,209838,209839,209840,209841
  13557. ,    0,    0,    0,359007,267216,267217,267218,    0,    0,    0
  13558. ,255748,    0,    0,    0,    0,295912,    0,163963,204123,    0
  13559. ,    0,204126,359026,    0,204129,    0,295923,    0,215607,    0
  13560. ,163976,    0,    0,    0,    0,    0,    0,267249,359042,100878
  13561. ,    0,    0,381994,    0,393470,267257,295943,    0,    0,    0
  13562. ,290210,    0,    0,    0,    0,    0,    0,215636,    0,215638
  13563. ,215639,    0,295959,    0,    0,100904,    0,    0,    0,    0
  13564. ,100909,    0,    0,100912,    0,    0,66493,66494,    0,77970
  13565. ,    0,66498,290242,290243,    0,295982,    0,295984,    0,295986
  13566. ,    0,295988,    0,295990,    0,261570,    0,    0,60778,    0
  13567. ,204205,    0,    0,    0,    0,    0,    0,    0,49314,    0
  13568. ,    0,    0,    0,    0,    0,    0,    0,    0,290278,    0
  13569. ,    0,290281,32117,290283,    0,    0,60806,    0,60808,60809
  13570. ,    0,    0,60812,    0,    0,60815,    0,60817,    0,215718
  13571. ,238667,238668,    0,    0,    0,    0,    0,    0,204253,    0
  13572. ,215729,353418,204257,    0,278840,    0,    0,100996,    0,    0
  13573. ,    0,    0,    0,267375,267376,72319,    0,    0,    0,    0
  13574. ,204275,204276,    0,    0,    0,    0,204281,    0,    0,267391
  13575. ,    0,    0,267394,    0,    0,    0,    0,    0,267400,250190
  13576. ,267402,    0,    0,    0,    0,    0,    0,    0,101037,    0
  13577. ,    0,101040,    0,101042,    0,290365,376421,101046,    0,    0
  13578. ,    0,    0,101051,215792,215793,    0,    0,    0,101057,60899
  13579. ,    0,101060,    0,    0,101063,    0,    0,101066,    0,    0
  13580. ,158439,158440,    0,32228,    0,    0,    0,49443,    0,    0
  13581. ,290400,290401,290402,    0,    0,387934,290406,    0,49454,    0
  13582. ,    0,347781,    0,    0,60934,    0,    0,    0,290418,    0
  13583. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13584. ,    0,290431,290432,    0,    0,290435,    0,60957,60958,60959
  13585. ,60960,    0,60962,60963,60964,60965,60966,    0,    0,60969
  13586. ,    0,32286,    0,    0,    0,    0,    0,    0,    0,    0
  13587. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13588. ,    0,    0,347842,    0,    0,158524,43785,    0,    0,347849
  13589. ,164266,164267,    0,43792,    0,307696,175746,    0,    0,    0
  13590. ,290490,    0,    0,    0,365075,    0,    0,256075,    0,    0
  13591. ,    0,    0,244606,    0,    0,267557,    0,    0,    0,    0
  13592. ,    0,359355,    0,204458,    0,    0,221672,    0,359362,    0
  13593. ,    0,    0,    0,    0,    0,    0,129890,15151,    0,    0
  13594. ,    0,    0,    0,    0,    0,129899,    0,    0,    0,    0
  13595. ,    0,    0,    0,    0,    0,204490,    0,    0,158597,    0
  13596. ,    0,    0,215971,158602,    0,324977,    0,    0,    0,    0
  13597. ,370878,    0,158611,158612,158613,158614,158615,158616,    0,    0
  13598. ,158619,158620,158621,158622,    0,    0,    0,    0,    0,    0
  13599. ,    0,204526,158631,405323,    0,216004,    0,    0,26686,216008
  13600. ,    0,101270,101271,    0,    0,    0,164382,    0,    0,    0
  13601. ,    0,164387,    0,319288,15228,38177,    0,    0,    0,    0
  13602. ,    0,    0,388141,    0,216033,216034,216035,216036,    0,95561
  13603. ,216039,    0,    0,    0,101303,    0,49672,101306,353735,    0
  13604. ,    0,    0,    0,    0,141472,227528,    0,    0,    0,    0
  13605. ,    0,    0,    0,    0,    0,279171,    0,    0,    0,49695
  13606. ,49696,    0,353759,61173,61174,    0,49702,    0,    0,    0
  13607. ,    0,    0,    0,    0,353771,    0,    0,353774,204613,319354
  13608. ,216089,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13609. ,365261,    0,89887,61203,    0,61205,61206,    0,    0,61209
  13610. ,    0,353798,61212,15317,    0,    0,216115,    0,    0,    0
  13611. ,    0,    0,    0,    0,204649,204650,    0,216126,    0,204654
  13612. ,    0,    0,44021,    0,    0,    0,    0,    0,204663,204664
  13613. ,204665,    0,    0,204668,    0,141563,204671,    0,204673,204674
  13614. ,    0,    0,204677,204678,204679,204680,    0,    0,204683,353846
  13615. ,227633,    0,216161,216162,216163,    0,    0,216166,    0,    0
  13616. ,101429,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13617. ,    0,216180,216181,353870,353871,    0,216185,216186,216187,    0
  13618. ,216189,    0,    0,    0,    0,101454,61296,    0,101457,101458
  13619. ,101459,101460,353889,    0,101463,    0,    0,    0,    0,    0
  13620. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13621. ,    0,112954,    0,    0,    0,    0,    0,210489,    0,90014
  13622. ,    0,61331,    0,61333,164600,    0,233446,61337,    0,    0
  13623. ,    0,164607,164608,    0,164610,    0,61346,233457,158877,    0
  13624. ,    0,233461,233462,233463,61354,61355,61356,    0,    0,61359
  13625. ,61360,61361,61362,61363,    0,    0,61366,    0,233478,233479
  13626. ,233480,233481,    0,    0,    0,    0,399859,    0,    0,    0
  13627. ,    0,233491,233492,376918,    0,    0,233496,    0,    0,    0
  13628. ,    0,233501,    0,    0,    0,    0,    0,    0,118768,    0
  13629. ,164666,164667,    0,    0,199092,    0,    0,    0,72882,    0
  13630. ,    0,90096,    0,    0,181891,    0,    0,    0,    0,245003
  13631. ,256478,256479,    0,    0,    0,    0,233536,    0,    0,359753
  13632. ,    0,    0,130276,    0,    0,    0,    0,    0,    0,    0
  13633. ,    0,    0,    0,    0,    0,371243,    0,    0,    0,    0
  13634. ,    0,256509,    0,    0,    0,    0,279462,    0,    0,    0
  13635. ,78671,    0,    0,    0,    0,    0,    0,    0,    0,256527
  13636. ,    0,181948,    0,118843,    0,118845,    0,    0,38530,    0
  13637. ,    0,    0,    0,    0,348334,    0,141804,359811,204913,    0
  13638. ,    0,    0,204917,    0,    0,    0,    0,    0,    0,    0
  13639. ,    0,    0,    0,    0,    0,    0,    0,204932,    0,    0
  13640. ,    0,    0,    0,    0,216413,    0,382788,    0,    0,    0
  13641. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13642. ,    0,    0,    0,    0,    0,    0,    0,    0,61538,    0
  13643. ,164806,    0,    0,    0,    0,    0,    0,113180,113181,113182
  13644. ,    0,    0,227925,    0,    0,    0,    0,    0,    0,    0
  13645. ,    0,    0,    0,    0,118934,    0,    0,    0,313996,    0
  13646. ,61570,61571,61572,    0,    0,394321,    0,    0,113211,113212
  13647. ,113213,    0,    0,113216,    0,319750,    0,    0,113221,    0
  13648. ,    0,    0,    0,    0,405814,    0,    0,    0,    0,    0
  13649. ,61600,    0,61602,61603,    0,    0,61606,    0,    0,    0
  13650. ,73084,    0,136193,308304,    0,    0,308307,    0,    0,    0
  13651. ,250941,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13652. ,    0,    0,147687,    0,    0,    0,124743,    0,    0,73113
  13653. ,73114,73115,    0,    0,    0,73119,32961,    0,    0,    0
  13654. ,    0,    0,    0,    0,250975,    0,    0,    0,205083,    0
  13655. ,    0,32976,32977,    0,147719,147720,147721,    0,    0,    0
  13656. ,113303,    0,    0,    0,    0,    0,365737,    0,32993,32994
  13657. ,    0,32996,61682,    0,    0,    0,    0,    0,    0,    0
  13658. ,    0,33006,33007,    0,147749,    0,    0,147752,    0,314127
  13659. ,147755,33016,    0,147758,251025,    0,113339,113340,    0,    0
  13660. ,    0,113344,    0,    0,    0,210877,210878,    0,325620,    0
  13661. ,113353,73195,    0,    0,    0,    0,    0,    0,    0,    0
  13662. ,    0,    0,73206,    0,    0,113368,    0,    0,    0,10106
  13663. ,    0,251062,    0,61743,    0,    0,233856,    0,    0,222385
  13664. ,    0,61751,    0,61753,61754,    0,61756,61757,61758,61759
  13665. ,61760,    0,    0,61763,    0,    0,    0,73241,73242,73243
  13666. ,    0,    0,    0,    0, 4404,    0,    0,251098,251099,    0
  13667. ,    0,    0,    0,73257,73258,73259,73260,    0,    0,    0
  13668. ,    0,    0,    0,    0,251115,    0,    0,73271,73272,    0
  13669. ,251121,251122,    0, 4433,    0,    0,251127,    0,    0,119179
  13670. ,342923,    0,    0, 4443,    0,    0,    0,    0,67555,67556
  13671. ,67557,67558,    0,147878,    0,    0,    0,    0,147883,    0
  13672. ,    0,216730,222468,10200,222470,360159, 4466,    0,    0,    0
  13673. ,130684,233951,    0,    0,    0,147900,    0,    0,147903,    0
  13674. ,    0,    0,    0,147908,    0,    0,    0,    0,    0,205284
  13675. ,205285,205286,245446,233973,    0,233975,    0,    0,    0,50395
  13676. ,    0,    0,    0,142191,371672,    0,    0,    0,    0,    0
  13677. ,    0,    0,    0,27461, 4514,    0,27464,360211,199576,    0
  13678. ,205315,205316,205317,    0,    0,    0,165162,365958,    0,    0
  13679. ,    0,    0,365963,    0,211066,    0,    0,    0,    0,    0
  13680. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13681. ,    0,38973,    0,    0,    0,    0,    0,    0,    0,73403
  13682. , 4560, 4561,    0,73407,73408,61935,    0,    0,    0,    0
  13683. ,    0,    0, 4572,    0,239791,    0,    0,    0,    0, 4579
  13684. ,    0,165217,67689,    0,    0,    0, 4586,320122, 4588,    0
  13685. , 4590, 4591, 4592,    0,    0,    0,    0,61967,61968,61969
  13686. ,    0,    0,67709,27551,297191,    0,    0,    0,    0,    0
  13687. ,    0,    0,205407,    0,377519,    0,    0,    0,    0,    0
  13688. ,113623,113624,113625,    0,    0,    0,    0,61997,    0,    0
  13689. ,    0,    0,    0,62003,    0,    0,    0,239854,    0,    0
  13690. ,27588,    0,239859,    0,27592,239862,119386,    0,205443,205444
  13691. ,    0,    0,    0,205448,    0,    0,366087,    0,    0,    0
  13692. ,    0,    0,205457,205458,    0,    0,205461,205462,27616,27617
  13693. ,    0,205466,205467,    0,165310,205470,205471,205472,    0,205474
  13694. ,    0,    0,205477,    0,    0,    0,    0,    0,    0,    0
  13695. ,    0,148116,    0,148118,    0,    0,    0,    0,    0,    0
  13696. ,    0,    0,    0,    0,79285,    0,    0,    0,    0,    0
  13697. ,165346,165347,    0,    0,    0,205510,188300,    0,    0,    0
  13698. ,62090,148146,148147,148148,148149,    0,    0,148152,    0,239946
  13699. ,148155,    0,148157,    0,    0,    0,326008,    0,    0,171112
  13700. ,    0,    0,171115, 4743,56377,    0,383388,    0,    0,    0
  13701. ,171123,171124,    0,113756,113757,62125,62126,62127,    0,    0
  13702. ,159659,    0,    0,    0,239981,    0,    0,    0,360462,    0
  13703. ,    0,165407,165408,165409,165410,    0,56409,    0,    0,    0
  13704. ,    0,    0,239999,    0,    0,62155,    0,    0,240005,    0
  13705. ,    0,    0,240009,240010,240011,    0,240013,    0,    0,240016
  13706. ,400653,    0,96594,148228,    0,    0,56439,56440,56441,56442
  13707. ,16284,    0,56445,    0,148239,    0,    0,56450,349038,303143
  13708. ,    0,    0,326094,    0,371992,    0,    0,    0,    0,    0
  13709. ,    0,    0,205627,16307,    0,    0,    0,16311,    0,16313
  13710. ,    0,    0,16316,    0,234324,    0,    0,    0,    0,148274
  13711. ,    0,    0,16326,171226,    0,148280,    0,    0,372026,    0
  13712. ,    0,    0,171235,    0,148289,148290,148291,    0,    0,    0
  13713. ,    0,171244,    0,    0,    0,    0,16350,    0,    0,    0
  13714. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13715. ,16364,    0,    0,    0,16368,372063,171269,372065,    0,56532
  13716. ,    0,    0,56535,    0,    0,    0,    0,303231,    0,280285
  13717. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13718. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13719. ,    0,    0,    0,    0,56567,56568,56569,    0,    0,    0
  13720. ,56573,280317,280318,280319,    0,    0,79527,    0,    0,    0
  13721. ,    0,    0,    0,    0,    0,    0,    0,56590,56591,56592
  13722. ,56593,    0,56595,56596,56597,56598,56599,    0,372136,56602
  13723. ,217239,280347,280348,    0,280350,    0,    0,    0,    0,    0
  13724. ,280356,    0,280358,    0,    0,    0,    0,    0,    0,    0
  13725. ,    0,    0,    0,    0,    0,50891,    0,    0,    0,    0
  13726. ,    0,    0,343485,    0,366435,    0,    0,    0,    0,    0
  13727. ,291860,    0,    0,    0,372182,    0,372184,62387,    0,    0
  13728. ,372188,280397,    0,    0,    0,    0,    0,    0,280404,    0
  13729. ,    0,    0,354989,    0,    0,    0,    0,372205,372206,    0
  13730. ,    0,119781,372210,    0,372212,372213,372214,    0,240265,372217
  13731. ,    0,    0,    0,280429,    0,    0,    0,366488,    0,    0
  13732. ,    0,366492,    0,188647,280440,280441,188650,280443,251759,    0
  13733. ,    0,    0,    0,    0,    0,    0,    0,309138,    0,    0
  13734. ,    0,    0,    0,    0,251775,    0,    0,251778,314886,    0
  13735. ,    0,314889,228835,    0,    0,200153,22307,    0,    0,280475
  13736. ,    0,280477,    0,    0,    0,280481,    0,    0,    0,    0
  13737. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13738. ,    0,51017,280498,280499,280500,280501,    0,280503,280504,280505
  13739. ,280506,    0,    0,    0,280510,160034,    0,    0,    0,    0
  13740. ,33825,56774,45301,349363,73988,    0,    0,10884,    0,    0
  13741. ,    0,    0,    0,    0,    0,    0,    0,119897,    0,    0
  13742. ,    0,    0,10899,    0,    0,    0,    0,    0,    0,    0
  13743. ,    0,    0,    0,56806,56807,    0,349396,349397,    0,    0
  13744. ,16654,    0,326454,    0,    0,    0,    0,    0,    0,    0
  13745. ,119930,119931,160091,    0,    0,    0,286309,    0,    0,45358
  13746. ,    0,    0,    0,56836,    0,    0,    0,349427,349428,56842
  13747. ,    0,349431,56845,    0,    0,    0,    0,    0,315016,119959
  13748. ,119960,119961,119962,    0,131438,119965, 5226,    0,    0,    0
  13749. ,119970,    0,    0,    0,349454,    0,    0,    0,    0,    0
  13750. ,    0,234721,    0,131457,    0,183092,366677,    0,    0,    0
  13751. ,    0,366682,    0,    0,    0,    0,286369,    0,    0,    0
  13752. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13753. ,    0,    0,320807,    0,11011,    0,    0,    0,263443,    0
  13754. ,    0,263446,    0,    0,    0,56918,    0,    0,    0,39711
  13755. ,    0,    0,    0,    0,    0,    0,56929,102826,349518,    0
  13756. ,    0,120041,    0,    0,    0,366736,366737,    0,    0,    0
  13757. ,    0,    0,120052,    0,366745,366746,366747,366748,    0,366750
  13758. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,102858
  13759. ,102859,    0,    0,    0,    0,    0,114339,56970,    0,349559
  13760. ,    0,    0,    0,    0,    0,    0,    0,120087,120088,120089
  13761. ,    0,    0,    0,120093,    0,    0,    0,    0,349578,    0
  13762. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,114372
  13763. ,    0,    0,120112,120113,    0,    0,120116,120117,120118,120119
  13764. ,    0,    0,120122,    0,343867,343868,343869,343870,    0,    0
  13765. ,343873,315189,    0,    0,    0,343878,    0,    0,114401,114402
  13766. ,    0,114404,    0,    0,114407,229148,    0,114410,    0,114412
  13767. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13768. ,    0,74265,74266,    0,    0,    0,    0,    0,    0,    0
  13769. ,355387,    0,137383,    0,    0,    0,    0,    0,355395,    0
  13770. ,74284,102970,    0,    0,    0,    0, 5446,    0,    0,    0
  13771. ,74294,74295,102981,    0,74298,74299,    0,    0,    0,    0
  13772. ,189044,    0,    0,189047,    0,    0,343949,    0,    0,    0
  13773. ,    0,    0,103001,    0,    0,    0,    0,343960,343961,    0
  13774. ,    0,    0,    0,    0,    0,    0,    0,103016,103017,103018
  13775. ,355447,114494,    0,103022,    0,286608,    0,74341,    0,74343
  13776. ,    0,74345,    0,    0,    0,103034,103035,    0,338254,120249
  13777. ,    0,103040,    0,    0,    0,    0,    0,    0,    0,    0
  13778. ,    0,74365,    0,    0,326796,    0,    0,    0,114531,    0
  13779. ,    0,    0,114535,    0,160433,    0,344019,    0,    0,    0
  13780. ,344023,    0,344025,344026,    0,160444,    0,    0,97340,    0
  13781. ,    0,    0,114555,97345,114557,114558,    0,114560,    0,    0
  13782. ,    0,114564,    0,338309,    0,338311,338312,    0,    0,    0
  13783. ,57203,57204,57205,    0,    0,    0,    0,74421,    0,74423
  13784. ,74424,74425,    0,74427,74428,    0,74430,74431,235068,    0
  13785. ,338336,    0,    0,    0,160493,160494,160495,160496,338344,    0
  13786. ,57233,57234,57235,57236,    0,    0,57239,    0,401461,57242
  13787. ,    0,57244,    0,    0,    0,    0,    0,326889,389997,    0
  13788. ,    0,131835,    0,    0,    0,    0,    0,    0,    0,    0
  13789. ,    0,    0,    0,    0,361328,    0,    0,    0,    0,    0
  13790. ,298227,    0,    0,172016,    0,    0,    0,    0,    0,    0
  13791. ,172023,    0,326924,    0,    0,    0,    0,258085,    0,258087
  13792. ,    0,    0,    0,    0,269566,    0,    0,    0,    0,    0
  13793. ,    0,160570,    0,    0,11411,160574,    0,160576,160577,160578
  13794. ,160579,160580,    0,74527,    0,74529,74530,258115,258116,    0
  13795. ,258118,    0,    0,    0,    0,74539,    0,269599,    0,    0
  13796. ,    0,143389,    0,321238,    0,304029,304030,    0,    0,    0
  13797. ,    0,    0,    0,    0,    0,    0,    0,91772,    0,    0
  13798. ,    0,    0,    0,    0,    0,    0,269628,269629,    0,    0
  13799. ,57363,338477,269634,    0,    0,    0,338482,338483,269639,355698
  13800. ,338487,281119,258171,74587,338497,57384,321288,57386,74600,57389
  13801. ,74601,57390,338504,74602,57391,74603,57392,321295,57393,258208
  13802. ,160679,126257,258243,246769,269718,258244,269724,23033,258262,126311
  13803. ,355792,258263,258266,160737,269756,229597,23065,269781,23090,269788
  13804. ,258314,269791,200947,160810,86229,378818,160812,264085,137871,160820
  13805. ,137872,361696,172375,401881,298615,195355,34719,247005,126528,321604
  13806. ,29017,373245,333086,304422,218367,29046,321634,29047,92155,29048
  13807. ,321639,298691,29052,321641,155268,333118,321644,333119,321645,333120
  13808. ,321646,333159,298737,298739,218421,407756,298753,373335,298754,396286
  13809. ,373338,298757,298765,92233,304503,298766,298772,86503,52087,29139
  13810. ,333230,298808,218495,29174,34913,29176,356189,333241,304556,218501
  13811. ,29180,  495,258679,29199,258682,29202,252947,29204,316059,34946
  13812. ,333278,132483,333293,327556,316082,149709,333294,316083,333300,316089
  13813. ,407883,333302,333311,98094,264477,149737,402173,149745,98124,57965
  13814. ,333347,98130,161247,121088,316155,195678,98158,57999,287493,121120
  13815. ,58027,17868,172770,58030,172775,149827,230159,121156,304745,121161
  13816. ,299012,98217,304750,17900,58061,17902,299018,17905,247402,149873
  13817. ,385092,58083,287570,17931,385100,17932,385102,149885,98252,149886
  13818. ,98253,385104,149887,98254,17936,385105,149888,  726,132678,  727
  13819. ,149890,17939,  728,149891,121206,98258,  729,385109,149892,17941
  13820. ,385111,149894,  732,385114,149897,98264,385115,98265,385118,98268
  13821. ,58109,385119,98269,322014,98271,304804,195801,98272,385123,304805
  13822. ,385127,98277,167122,98278,385129,58120,304814,98282,304815,98283
  13823. ,333501,304816,121232,98284,385136,304818,322038,121243,155689,86845
  13824. ,35212,293386,167172,167173,58170,167174,121278,58171,18012,121279
  13825. ,58172,385182,121280,58173,287659,58179,121293,58186,121294,58187
  13826. ,121297,58190,408153,121303,167202,121306,167203,121307,293418,167204
  13827. ,121308,293419,167205,121309,18043,293420,121310,322110,167211,281958
  13828. ,190166,368022,304915,18065,12333,  859,293449,18073,293450,167236
  13829. ,18074,293451,18075,155764,18076,293454,155766,18078,293457,18081
  13830. ,293459,18083,281986,18084,281988,86930,18086,12349,299200,18087
  13831. ,190198,18088,190199,18089,12352,190200,18090,282010, 6634,264808
  13832. ,98435,167284,23859,368084,190237,368085,293504,368086,190239,368090
  13833. ,167295,385323,247635,213214,138633,385329,259115,408280,213222,408281
  13834. ,385333,293541,190284,167336,121440,121445,58338,391092,167349,35398
  13835. ,213251,167355,282101,167361,293576,190310,167362,293578,92783,293582
  13836. ,58365,368166,98527,391116,190321,379647,293592,391122,293593,368177
  13837. ,293596,379654,368180,293599,293608,12495,293611,12498,368218,190371
  13838. ,190373,173162,190374,173163,87108,190375,58424,190380,173169,293647
  13839. ,190381,368235,190388,368238,190391,247805,12588,98655,75707,190521
  13840. ,35622,87327,64379,12746,64382,12749,207897,64472,334112,150528
  13841. ,64531,47320,403016,64533,265361,150621,374374,208001,196558,150662
  13842. ,150682,12994,133472,12995,351495,259703,403130,374445,70384,403132
  13843. ,374447,196615,41716,213860,156490,374518,179460,179461, 1614,179476
  13844. ,168002,219657,173761,156550,127865, 1651,374565,265562,282781,179515
  13845. ,374588,265585,374589, 1684,305761,127914,317268,179580,150895,179582
  13846. ,150897,403347,168130,334506,36182,334509,150925,150926,36186,150927
  13847. ,36187,219772,150928,99315,59156,397681,305889,47724,351790,225576
  13848. ,288699,59219,196914,151018,196949,151053,151055,70737,156801,70746
  13849. ,294501,151076,196973,151077,30600,196974,151078,369085,151079,19128
  13850. ,254347,196977,151081, 1919,254348,151082, 1920,254349,196979,151083
  13851. ,196980,151084,386302,151085, 1923,271613,128188,128191,59347,13451
  13852. ,409328,59371,168375,59372,334751,59375,357700,59376,116753,30698
  13853. ,271664,105291,409368,128255,231522,128256,254471,116783,254472,116784
  13854. ,128259,116785,128260,116786,346269,271688,260214,116789,271690,260216
  13855. ,128268,116794,254492,191385,357762,128282,357763,134020,357764,128284
  13856. ,357773,128293,243044,197148,254520,197150,42261,25050,179956,128323
  13857. ,254542,197172,254544,179963,254545,128331,409481,214423,99683,357855
  13858. ,36583,357856,36584,329180,116911,329181,214441,116912,392301,99714
  13859. ,116926,99715,116934,99723,357890,116936,357891,116937,357892,42357
  13860. ,357896,116942,122680,116943,36625,116946,36628,254635,36629,214480
  13861. ,36633,392336,357914,357920,122703,48122,36648,357921,36649,357922
  13862. ,36650,225973,122707,128464,71094,128469,59625,128474,122737,122742
  13863. ,99794,237486,122746,128484,122747,157171,122749,231753,122750,128491
  13864. ,122754,323558,122763,36708,122764,36709,352254,329306,352261,254732
  13865. ,363736,248996,260497,220338,99875,31031,352306,323621,323626,254782
  13866. ,254783,168728,346584,254792,220370,254793,220371,254794,220372,340861
  13867. ,117118,283505,36814,283508,220401,346616,220402,346617,220403,220406
  13868. ,36822,231891,117151,398271,168791,346646,306487,168799,346648,168801
  13869. ,323713,191762,117181,254870,117182,214720,117191,36873,214725,180303
  13870. ,306519,180305,306520,180306,323748,220482,283599,13960,243441,220493
  13871. ,358182,306549,283601,306550,283602,306551,283603,323763,306552,323766
  13872. ,306555,323767,191816,323768,283609,283611,260663,323771,306560,168872
  13873. ,323774,77083,346728,323780,220528,117262,220530,140212,220551,168918
  13874. ,220552,168919,220553,168920,220556,100079,220557,168924,100080,220558
  13875. ,100081,346774,220560,168941,117308,168942,117309,306631,168943,117310
  13876. ,168947,117314,346797,168950,346800,168953,100109,59950,306642,100110
  13877. ,346802,140270,100111,346803,117323,100112,346804,180431,346805,180432
  13878. ,346806,180433,100115,346809,100118,352548,117331,100120,381237,174705
  13879. ,123077,117340,260779,59984,306693,123109,306696,60005,404226,306697
  13880. ,100165,306702,71485,306703,134593,123119,71486,60012,71487,60013
  13881. ,306705,60014,306706,60015,306707,249337,306709,60018,306712,71495
  13882. ,60021,134604,60023,134608,123134,134609,71502,134610,71503,123139
  13883. ,100191,289513,123140,157568,123146,19880,123148,71515,134625,123151
  13884. ,134626,123152,71519,19886,134627,123153,71520,134638,25635,404278
  13885. ,134639,100253,60094,100254,19936,100257,19939,220735,19940,134683
  13886. ,100261,375641,100265,255187,54392,341255,60142,220797,54424,220798
  13887. ,54425,37214,295380,220799,60163,54426,220800,60164,324069,220803
  13888. ,42956,220806,60170,220808,60172,60175, 2805,54454, 2821,54457
  13889. , 2824,358562,180715,220890, 2884,220925,209451,232410,163566,25878
  13890. ,318466,175041,175042,163568,318469,175044,163574,88993,220948,163578
  13891. ,220949,163579,220955,54582,220956,54583,220957,54584,352926, 2969
  13892. ,329979, 2970,163610,54607,215246,60347,54610,163615,54612,169353
  13893. ,54613,163617,54614,163629,60363,60380,48906,289890,60410,370235
  13894. , 3067,324357,278461,278462,26034,335838,278468,157992,71937,186678
  13895. ,135045,31791,20317,20324, 3113,209653,60491,209690,112161,209696
  13896. ,163800,221173,60537,163804,60538,163805,60539,387552,60543, 3173
  13897. ,158078,20390,295768,163817,158081,60552,129406,60562,66302,60565
  13898. ,324468,60566,358893,60569,358896,60572,347423,140891,209737,14679
  13899. ,358905,169584,376127,135173,358920,181073,175349, 3239,232722,209774
  13900. ,204061,152428,146696,37693,318812,209809,140965,209828,77877,204093
  13901. ,77879,204094,77880,209832,204095,209835,37725,215574,209837,209844
  13902. ,100841,204124,163965,359024,204125,215606,204132,215608,204134,49235
  13903. ,267246,100873,267247,100874,267248,100875,267252,66457,267255,163989
  13904. ,163998,49258,215637,49264,295958,164007,49267,295960,215642,100903
  13905. ,60744,215645,100905,295964,169750,100906,267280,215647,100914,66492
  13906. ,295981,290244,295983,49292,295987,267302,295989,261567,261569,49300
  13907. ,295993,261571,60776,261572,60777,49303,393527,66518,66520,49309
  13908. ,66521,49310,66522,49311,66523,49312,66524,49313,204216,49317
  13909. ,405012,290272,49318,290273,49319,290274,78005,290275,78006,267328
  13910. ,78007,175539,32114,405020,100959,267339,60807,204251,100985,238674
  13911. ,204252,313267,135420,290322,267374,290328,267380,290329,204274,405072
  13912. ,204277,267386,204279,267387,204280,267389,204282,101016,267390,204283
  13913. ,353447,267392,267393,204286,267397,215764,267398,215765,164132,267399
  13914. ,215766,267403,215770,267404,101031,267405,101032,290354,267406,101033
  13915. ,267409,158406,95306, 3514,215787,101047,60888,215788,101048,215789
  13916. ,101049,215790,101050,215794,101054,72369,215795,135477,101055,215796
  13917. ,101056,215799,101059,101061,72376,101062,95325,324811,158438,359240
  13918. ,49442,290415,60935,290416,60936,290417,37989,290419,158468,37991
  13919. ,290420,204365,164206,158469,60940,43729,164207,158470,164208,158471
  13920. ,290423,164209,336320,290424,169947,43733,290425,158474,290426,164212
  13921. ,43735,290428,158477,330588,290429,60949,290430,158479,347843,169996
  13922. ,365077,273285,256079,158550,359356,256090,158561,256098,181517,78274
  13923. ,72537,319231,204491,204492,158596,256127,181546,158598,141397,101238
  13924. ,204520,158624,204521,158625,204522,158626,204523,158627,393845,158628
  13925. ,216003,204529,164370,216005,204531,124220,101272,342235,15226,101300
  13926. ,61141,290622,101301,216042,101302,353732,216044,164411,336526,101309
  13927. ,336527,204576,336528,101311,353743,141474,353744,279163,353762,61175
  13928. ,296394,204602,296397,112813,319357, 9559,290684,61204,135795,61214
  13929. ,279223,250538,89902,204648,101382,158763,101393,204666,26819, 9608
  13930. ,204667,72716,49768,216146,204672,227624,204676,26829,353855,216167
  13931. ,216168,101428,216170,101430,353860,216172,353861,336650,198962,353862
  13932. ,336651,101434,353863,198964,353864,216176,198965,353865,216177,353866
  13933. ,216178,216179,78491,353872,216184,61285,353878,216190,216191,101451
  13934. ,353880,216192,101452,353881,216193,101453,216196,101456,61332,38384
  13935. ,164623,61357,313795,222003,199055,233495,32700,199090,164668,199091
  13936. ,164669,113148, 9882,394264, 9885,113210,73051,250907,113219,365652
  13937. ,314019,256659,61601,73083,61609,73085,61611,250939,187832,365680
  13938. ,250940,314070,73116,250969,228021,73122,394395,250970,250971,73124
  13939. ,394397,250972,250978,228030,250980,113292,256721,32978,199359,32986
  13940. ,176433,61693,147750,73169,33010,147751,33011,147760,113338,296939
  13941. ,210884,113361,61728,113362,61729,342843,251051,113363,61730,113364
  13942. ,96153,164999,159262,113366,113367,61734,233846,113369,113370,10104
  13943. ,113373, 4370,222388,61752,285515, 4402,73247, 4403,251097,147831
  13944. ,251103,73256,147842,73261,377323,233898,67525,73264,67527,251112
  13945. ,73265,302746,251113,73266,251114,73267,251116,73269,251117,73270
  13946. ,251120,73273,251123,73276, 4432,251125, 4434,251126,245389, 4435
  13947. ,251128,147862,251129, 4438,251132, 4441,365883,147877,147879,67561
  13948. ,360151,205252,233949,130683,147901,130690,251168,147902,147905,27428
  13949. ,147906,79062,147907,27430,262649,147909,262652,147912,79068,308549
  13950. , 4488,302834,27458,256939,27459,365943,320047,27460,256947,205314
  13951. ,365954,136474,205320, 4525,383170,205323,205325,165166,165177,67648
  13952. ,165185,38971,73406, 4562,331575, 4566,113572,96361,216842, 4573
  13953. ,205370,113578, 4575,302900,67683, 4576,67684, 4577,383220,165214
  13954. ,67685, 4578,159479, 4580,165219, 4583,234064,165220,102113, 4584
  13955. ,383227,102114, 4585,320124, 4589,50491, 4595,297188,205396,343088
  13956. ,136556,239823,67713,239824,67714,239825,67715,113631,61998,113632
  13957. ,61999,113633,62000,239853,62006,239855,136589,62008,27586,239856
  13958. ,27587,314445,239864,205442,119387,188243,148084,205459,27612,205460
  13959. ,10402,205465,27618,377578,205468,320213,205473,239909,148117,188293
  13960. ,165345,62079,239935,205513,389140,62131,239982,113768,239983,171139
  13961. ,171142,39191,239987,165406,62140,148202,56410,171151,62148,56411
  13962. ,239996,62149,239997,62150,239998,171154,62151,240000,62153,240001
  13963. ,62154,165422,62156,240004,62157,337535,240006,240007,62160,240012
  13964. ,165431,171178,85123,349035,56448,148275,67957,16324,148276,67958
  13965. ,372024,131070,372025,90912,67964,171240,148292,16341,171241,148293
  13966. ,171242,148294,308931,171243,171245,148297,16346,171246,148298,16347
  13967. ,148299,16348,148300,16349,188461,171250,148302,16351,171251,148303
  13968. ,16352,171252,148304,16353,148305,16354,148306,16355,148309,79465
  13969. ,16358,171258,16359,372054,16360,372055,171260,16361,372056,171261
  13970. ,56521,16362,372057,16363,372060,39314,16366,257321,16367,303297
  13971. ,280349,280353,228720,159876,395095,372147,372183,366446,372207,45198
  13972. ,372208,125517,372211,366474,355047,314888,366531,280476,280507,33816
  13973. ,349395,56808,337927,314979,280565,119929,286317,56837,349425,56838
  13974. ,349426,125683,56839,349434,56847,349436,315014,303540,315015,292067
  13975. ,119968, 5228,372429,200319,142963,120015,349507,309348,372486,366749
  13976. ,366752,320856,366753,343805,102860,56964,143020,56965,349553,56966
  13977. ,349554,102863,349555,91390,343837,56987,343838,56988,349576,343839
  13978. ,56989,11093,349577,56990,349579,102888,56992,332369,102889,56993
  13979. ,349581,102890,56994,349582,120102,102891,79943,56995,349583,120103
  13980. ,56996,349584,217633,120104,349585,120105,102894,120106,56999,217636
  13981. ,120107,349588,114371,102897,120110,114373,102899,343854,183218,120111
  13982. ,120115,62745,280759,125860,366824,343876,303724,114403,407005,102944
  13983. ,303744,74264,125914,74281,378385,343963,114483,315290,34177,103025
  13984. ,74340,103027,74342,338246,74344,338248,103031,74346,103032,74347
  13985. ,103033,74348,200565,103036,338256,103039,343995,338258,120252,103041
  13986. ,80093,343996,338259,120253,103042,343997,120254,160414,103044,160415
  13987. ,103045,338263,103046,344001,103047,338265,103048,74363,74364,51416
  13988. ,389901,338268,103051,338269,263688,338272,326798,114529,338273,326799
  13989. ,114530,338277,160430,344018,338281,344020,338283,344021,57171,344024
  13990. ,338287,114544,344027,338290,344030,131761,338295,160448,114552,131764
  13991. ,114553,338297,114554,114559,45715,114561,11295,338306,11297,223591
  13992. ,74429,171966,160492,258053,22836,372821,326925,183500,149078,326926
  13993. ,126131,11391,258086,172031,309737,160575,74520,57315,45841,258117
  13994. ,74533,258121,74537,57326,269598,258124,74540,269600,258126,269630
  13995. ,166364,57361,269631,57362,384376,338480,57367,338481,269637,    0
  13996. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13997. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13998. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  13999. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14000. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14001. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14002. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14003. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14004. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14005. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14006. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14007. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14008. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14009. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14010. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14011. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14012. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14013. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14014. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14015. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14016. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14017. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14018. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14019. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14020. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14021. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14022. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14023. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14024. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14025. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14026. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14027. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14028. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14029. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14030. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14031. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14032. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14033. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14034. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14035. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14036. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14037. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14038. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14039. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14040. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14041. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14042. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14043. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14044. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14045. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14046. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14047. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14048. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14049. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14050. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14051. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14052. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14053. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14054. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14055. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14056. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14057. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14058. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14059. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14060. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14061. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14062. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14063. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14064. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14065. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14066. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14067. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14068. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14069. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14070. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14071. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14072. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14073. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14074. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14075. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14076. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14077. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14078. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14079. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14080. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14081. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14082. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  14083. ,    0,    0,    0)  ;
  14084.         --| Hash values to check against to verify that
  14085.         --| correct action has been found for this
  14086.         --| parser state and input token.
  14087.         -- NYU Reference Name: ACTION_TABLE2
  14088.  
  14089.     DefaultMap :
  14090.         constant array (DefaultMapRange) of GC.ParserInteger :=
  14091.          ( 1520,    0,    0,    0,    0, 1518,    0, 1340, 1329, 1519
  14092. ,    0, 1331,    0, 1548,    0,    0,    0, 1333, 1334, 1335
  14093. , 1336, 1337, 1338,    0, 1127,    0, 1394, 1127, 1332, 1339
  14094. ,    0,    0, 1528,    0,    0, 1394, 1201,    0, 1202, 1184
  14095. ,    0, 1183, 1145, 1144,    0, 1199, 1200,    0, 1438, 1458
  14096. , 1185, 1146, 1147, 1148, 1188, 1167, 1444, 1170, 1171, 1172
  14097. , 1173, 1174, 1175, 1178, 1179, 1462, 1467, 1465,    0, 1189
  14098. , 1186, 1187,    0, 1441, 1272, 1273,    0,    0, 1560,    0
  14099. , 1268, 1582,    0, 1267,    0,    0, 1394,    0, 1495, 1282
  14100. ,    0, 1561,    0, 1584, 1287, 1482,    0,    0,    0,    0
  14101. , 1346, 1140, 1141, 1142,    0, 1127,    0,    0,    0, 1357
  14102. , 1580, 1342, 1524, 1522, 1521, 1407, 1210, 1080, 1406,    0
  14103. ,    0, 1143,    0,    0, 1185, 1423,    0, 1435, 1433, 1166
  14104. ,    0, 1460,    0, 1192, 1190, 1194,    0, 1191, 1195, 1193
  14105. , 1176,    0,    0,    0,    0,    0,    0, 1440,    0, 1169
  14106. ,    0,    0,    0,    0,    0,    0,    0,    0, 1198, 1196
  14107. , 1197,    0, 1205, 1206, 1203, 1204,    0, 1207, 1180,    0
  14108. , 1185, 1181, 1463, 1377, 1582, 1595,    0,    0,    0,    0
  14109. ,    0,    0,    0,    0, 1374, 1582, 1125, 1556, 1255, 1398
  14110. , 1496, 1497,    0,    0, 1395,    0,    0,    0,    0,    0
  14111. , 1582, 1043, 1128, 1044, 1045, 1046, 1047, 1048, 1049, 1050
  14112. , 1064, 1065, 1066, 1394, 1129, 1130,    0, 1394, 1394, 1382
  14113. , 1383, 1384, 1385, 1482, 1563, 1394, 1427, 1586, 1483,    0
  14114. , 1482,    0,    0, 1578, 1482,    0, 1355, 1356,    0,    0
  14115. , 1063,    0, 1404, 1529,    0, 1394,    0,    0,    0,    0
  14116. ,    0,    0, 1182,    0,    0, 1121,    0, 1160,    0, 1161
  14117. , 1435, 1330, 1461, 1439, 1107, 1177, 1459, 1086, 1158, 1157
  14118. , 1159, 1156, 1155, 1208, 1209,    0, 1151, 1152, 1154, 1153
  14119. , 1150, 1444, 1442,    0,    0, 1458, 1448,    0, 1450, 1452
  14120. , 1449, 1451, 1453,    0,    0, 1464, 1466, 1468,    0,    0
  14121. , 1493,    0, 1372, 1564,    0, 1370, 1493, 1581,    0,    0
  14122. , 1381, 1533, 1378,    0, 1535,    0,    0,    0, 1394, 1138
  14123. , 1139,    0,    0, 1257, 1486, 1280,    0, 1143,    0, 1148
  14124. ,    0,    0,    0,    0, 1069,    0,    0, 1498,    0,    0
  14125. , 1500,    0, 1502,    0, 1283,    0,    0, 1286,    0,    0
  14126. ,    0, 1559,    0, 1530, 1277,    0, 1062,    0, 1341, 1523
  14127. ,    0, 1213, 1212, 1408, 1447, 1443, 1437, 1430, 1433, 1165
  14128. , 1120,    0,    0, 1431, 1433, 1436,    0, 1164,    0,    0
  14129. , 1149, 1168, 1446, 1445, 1454, 1456, 1455, 1457, 1270, 1406
  14130. , 1277,    0, 1275,    0, 1533, 1533,    0,    0,    0, 1376
  14131. ,    0,    0, 1428, 1126,    0,    0, 1399, 1398, 1215, 1216
  14132. , 1217,    0,    0,    0,    0,    0, 1471, 1575,    0, 1400
  14133. ,    0, 1042, 1542,    0,    0,    0,    0,    0, 1565, 1298
  14134. , 1542, 1123,    0, 1293,    0,    0, 1482,    0, 1394, 1562
  14135. , 1482, 1482, 1051, 1394, 1052, 1053, 1054,    0, 1285, 1567
  14136. , 1302,    0,    0,    0,    0, 1278, 1402,    0, 1525, 1211
  14137. , 1435, 1119, 1424, 1432, 1435, 1434, 1108, 1087, 1276, 1402
  14138. , 1596, 1594,    0,    0,    0,    0, 1269,    0,    0, 1536
  14139. ,    0,    0,    0, 1132, 1133, 1134, 1135, 1137, 1131, 1136
  14140. , 1394,    0,    0,    0, 1469,    0, 1218, 1219, 1220, 1472
  14141. ,    0,    0, 1307,    0,    0,    0, 1221, 1224, 1225, 1226
  14142. , 1227, 1230, 1398,    0,    0,    0,    0, 1569, 1222, 1228
  14143. , 1229, 1231, 1400, 1309, 1310, 1311, 1398,    0, 1223, 1143
  14144. , 1241, 1232, 1233, 1234, 1235, 1236,    0,    0, 1256,    0
  14145. , 1487,    0,    0,    0,    0,    0,    0,    0,    0, 1078
  14146. , 1566, 1299,    0,    0,    0,    0,    0, 1582,    0,    0
  14147. , 1100, 1067,    0,    0,    0,    0,    0,    0,    0, 1092
  14148. , 1093, 1094, 1411, 1411, 1099,    0,    0, 1419, 1582, 1292
  14149. , 1297,    0, 1504, 1501, 1394,    0, 1284,    0, 1059,    0
  14150. ,    0,    0, 1367,    0,    0, 1368, 1369,    0, 1419, 1532
  14151. , 1531, 1361, 1279,    0,    0, 1405, 1163, 1162, 1274, 1582
  14152. , 1494,    0,    0, 1375, 1534, 1564, 1567, 1429, 1343, 1242
  14153. , 1398, 1516, 1508,    0, 1243, 1353,    0,    0, 1308,    0
  14154. ,    0,    0, 1260,    0, 1246, 1474,    0, 1398,    0,    0
  14155. ,    0, 1512, 1264,    0,    0, 1241,    0,    0, 1555,    0
  14156. , 1398,    0, 1558, 1482, 1127,    0, 1401, 1491, 1488, 1349
  14157. , 1398, 1489, 1398,    0,    0,    0, 1543, 1394, 1387, 1386
  14158. , 1296, 1077,    0, 1079, 1081, 1082, 1083, 1122,    0,    0
  14159. , 1098, 1096,    0,    0, 1290, 1090, 1091, 1409, 1089, 1070
  14160. , 1071, 1072, 1073, 1074, 1075, 1076, 1412, 1095, 1097, 1539
  14161. , 1394, 1582,    0, 1499, 1300,    0,    0, 1503, 1301, 1059
  14162. ,    0, 1402,    0, 1078, 1365, 1364, 1366, 1363,    0, 1359
  14163. ,    0, 1403, 1358,    0, 1373, 1371,    0,    0, 1470,    0
  14164. ,    0,    0, 1266, 1354, 1482, 1306, 1547,    0,    0, 1262
  14165. , 1476, 1589, 1473,    0,    0, 1398, 1478, 1398, 1552, 1553
  14166. ,    0,    0, 1241, 1325, 1324, 1326, 1313, 1314, 1315, 1316
  14167. , 1317, 1398, 1398, 1398,    0, 1398,    0, 1476, 1265,    0
  14168. , 1281,    0,    0, 1252,    0, 1398,    0, 1482,    0, 1352
  14169. , 1526, 1348, 1492, 1490, 1350, 1351, 1041, 1392,    0, 1394
  14170. , 1537,    0, 1579,    0, 1413, 1185, 1415, 1106,    0, 1288
  14171. , 1085,    0,    0, 1417, 1394,    0, 1593,    0,    0,    0
  14172. , 1185,    0, 1493, 1303,    0, 1402,    0,    0, 1347,    0
  14173. ,    0, 1060,    0, 1362,    0, 1271, 1344, 1345,    0, 1327
  14174. ,    0, 1493, 1568, 1304,    0, 1261,    0, 1591,    0,    0
  14175. , 1398, 1398,    0,    0, 1423, 1248, 1554, 1249, 1321,    0
  14176. ,    0,    0, 1318, 1515, 1319, 1320, 1592, 1398, 1398, 1570
  14177. , 1573,    0, 1398,    0,    0,    0,    0,    0, 1259,    0
  14178. , 1577,    0,    0,    0,    0,    0, 1394, 1084,    0,    0
  14179. , 1105,    0, 1102, 1088,    0,    0, 1541,    0, 1112, 1402
  14180. , 1542, 1124, 1420, 1506,    0,    0,    0, 1060,    0, 1055
  14181. ,    0, 1402,    0,    0, 1517, 1510,    0, 1305, 1263,    0
  14182. ,    0, 1477, 1475, 1247, 1546,    0, 1479, 1574, 1398,    0
  14183. ,    0,    0,    0, 1513, 1393, 1244,    0, 1253, 1482,    0
  14184. , 1258,    0, 1576,    0,    0,    0,    0, 1538,    0,    0
  14185. , 1103, 1104,    0, 1410, 1109,    0, 1394,    0, 1394, 1396
  14186. ,    0, 1114,    0,    0, 1068,    0, 1505, 1061, 1056, 1402
  14187. , 1295,    0, 1294,    0,    0, 1509, 1590,    0, 1545,    0
  14188. ,    0, 1572,    0,    0, 1254,    0, 1482, 1527, 1391,    0
  14189. , 1388,    0,    0, 1414,    0, 1416,    0,    0, 1110, 1549
  14190. , 1111,    0, 1118, 1544,    0, 1291, 1493,    0, 1057, 1360
  14191. , 1493, 1245,    0,    0, 1312, 1250,    0, 1389,    0, 1101
  14192. ,    0, 1402,    0, 1397,    0, 1421, 1289,    0, 1058,    0
  14193. , 1322,    0, 1251, 1390,    0,    0, 1394, 1394, 1550, 1551
  14194. ,    0, 1507, 1511, 1323, 1113, 1115, 1116, 1117, 1422)  ;
  14195.         --| Map of states (constant array index) to default reductions.
  14196.         -- NYU Reference Name: DEFAULT
  14197.   
  14198.     type FollowSymbolIndexArray is array ( PositiveParserInteger range <>)
  14199.         of GC.ParserInteger ;
  14200.  
  14201.     FollowSymbolMapIndex : constant FollowSymbolIndexArray :=
  14202.          (    1,    1,    2,    2,    3,    3,    4,   43,   44,   57
  14203. ,   58,   71,   72,   85,   86,  102,  103,  119,  120,  133
  14204. ,  134,  150,  151,  167,  168,  181,  182,  195,  196,  209
  14205. ,  210,  223,  224,  237,  238,  251,  252,  252,  253,  254
  14206. ,  255,  256,  257,  257,  258,  259,  260,  261,  262,  268
  14207. ,  269,  270,  271,  272,  273,  286,  287,  300,  301,  314
  14208. ,  315,  317,  318,  331,  332,  342,  343,  344,  345,  346
  14209. ,  347,  352,  353,  353,  354,  354,  355,  355,  356,  356
  14210. ,  357,  357,  358,  358,  359,  359,  360,  393,  394,  395
  14211. ,  396,  429,  430,  436,  437,  438,  439,  440,  441,  441
  14212. ,  442,  463,  464,  465,  466,  467,  468,  469,  470,  472
  14213. ,  473,  474,  475,  477,  478,  478,  479,  480,  481,  482
  14214. ,  483,  483,  484,  517,  518,  520,  521,  522,  523,  532
  14215. ,  533,  533,  534,  537,  538,  539,  540,  560,  561,  562
  14216. ,  563,  567,  568,  569,  570,  570,  571,  573,  574,  600
  14217. ,  601,  602,  603,  603,  604,  604,  605,  608,  609,  610
  14218. ,  611,  614,  615,  616,  617,  629,  630,  641,  642,  643
  14219. ,  644,  652,  653,  660,  661,  674,  675,  688,  689,  704
  14220. ,  705,  713,  714,  725,  726,  734,  735,  746,  747,  758
  14221. ,  759,  770,  771,  804,  805,  838,  839,  873,  874,  907
  14222. ,  908,  942,  943,  943,  944,  973,  974,  975,  976,  976
  14223. ,  977,  978,  979,  980,  981,  981,  982,  983,  984,  985
  14224. ,  986,  987,  988,  997,  998, 1005, 1006, 1013, 1014, 1021
  14225. , 1022, 1029, 1030, 1037, 1038, 1047, 1048, 1058, 1059, 1083
  14226. , 1084, 1112, 1113, 1137, 1138, 1167, 1168, 1196, 1197, 1225
  14227. , 1226, 1232, 1233, 1262, 1263, 1292, 1293, 1322, 1323, 1333
  14228. , 1334, 1342, 1343, 1351, 1352, 1360, 1361, 1367, 1368, 1404
  14229. , 1405, 1432, 1433, 1459, 1460, 1485, 1486, 1490, 1491, 1517
  14230. , 1518, 1544, 1545, 1571, 1572, 1591, 1592, 1597, 1598, 1601
  14231. , 1602, 1628, 1629, 1629, 1630, 1656, 1657, 1683, 1684, 1710
  14232. , 1711, 1737, 1738, 1764, 1765, 1791, 1792, 1818, 1819, 1845
  14233. , 1846, 1872, 1873, 1880, 1881, 1907, 1908, 1934, 1935, 1961
  14234. , 1962, 1988, 1989, 2015, 2016, 2018, 2019, 2038, 2039, 2041
  14235. , 2042, 2044, 2045, 2045, 2046, 2049, 2050, 2051, 2052, 2052
  14236. , 2053, 2073, 2074, 2075, 2076, 2096, 2097, 2099, 2100, 2120
  14237. , 2121, 2121, 2122, 2122, 2123, 2125, 2126, 2128, 2129, 2149
  14238. , 2150, 2151, 2152, 2152, 2153, 2154, 2155, 2166, 2167, 2169
  14239. , 2170, 2174, 2175, 2176, 2177, 2178, 2179, 2181, 2182, 2182
  14240. , 2183, 2183, 2184, 2195, 2196, 2196, 2197, 2197, 2198, 2210
  14241. , 2211, 2212, 2213, 2224, 2225, 2237, 2238, 2238, 2239, 2240
  14242. , 2241, 2242, 2243, 2246, 2247, 2247, 2248, 2251, 2252, 2263
  14243. , 2264, 2264, 2265, 2268, 2269, 2270, 2271, 2291, 2292, 2302
  14244. , 2303, 2303, 2304, 2330, 2331, 2357, 2358, 2384, 2385, 2392
  14245. , 2393, 2395, 2396, 2398, 2399, 2401, 2402, 2404, 2405, 2407
  14246. , 2408, 2410, 2411, 2413, 2414, 2437, 2438, 2440, 2441, 2464
  14247. , 2465, 2468, 2469, 2470, 2471, 2491, 2492, 2496, 2497, 2497
  14248. , 2498, 2520, 2521, 2522, 2523, 2530, 2531, 2532, 2533, 2540
  14249. , 2541, 2545, 2546, 2553, 2554, 2561, 2562, 2567, 2568, 2569
  14250. , 2570, 2571, 2572, 2579, 2580, 2583, 2584, 2585, 2586, 2586
  14251. , 2587, 2587, 2588, 2588, 2589, 2609, 2610, 2611, 2612, 2632
  14252. , 2633, 2634, 2635, 2637, 2638, 2643, 2644, 2649, 2650, 2655
  14253. , 2656, 2656, 2657, 2657, 2658, 2659, 2660, 2661, 2662, 2663
  14254. , 2664, 2664, 2665, 2666, 2667, 2667, 2668, 2669, 2670, 2683
  14255. , 2684, 2697, 2698, 2711, 2712, 2725, 2726, 2730, 2731, 2731
  14256. , 2732, 2736, 2737, 2741, 2742, 2743, 2744, 2745, 2746, 2746
  14257. , 2747, 2748, 2749, 2750, 2751, 2751, 2752, 2763, 2764, 2765
  14258. , 2766, 2767, 2768, 2788, 2789, 2809, 2810, 2811, 2812, 2813
  14259. , 2814, 2814, 2815, 2815, 2816, 2818, 2819, 2820, 2821, 2823
  14260. , 2824, 2830, 2831, 2832, 2833, 2836, 2837, 2837, 2838, 2858
  14261. , 2859, 2879, 2880, 2882, 2883, 2883, 2884, 2884, 2885, 2885
  14262.  ) ;
  14263.   
  14264.     FollowSymbolMap : constant FollowSymbolArray :=
  14265.          (   96,   96,   72,    2,    4,   10,   12,   14,   15,   19
  14266. ,   20,   21,   22,   23,   24,   25,   26,   27,   28,   29
  14267. ,   33,   37,   39,   42,   43,   44,   45,   46,   51,   53
  14268. ,   54,   55,   56,   57,   59,   60,   61,   62,   63,   65
  14269. ,   67,   68,   92,   10,   21,   25,   26,   27,   42,   43
  14270. ,   44,   45,   55,   56,   59,   60,   65,   10,   21,   25
  14271. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  14272. ,   65,   10,   21,   25,   26,   27,   42,   43,   44,   45
  14273. ,   55,   56,   59,   60,   65,   10,   21,   25,   26,   27
  14274. ,   42,   43,   44,   45,   54,   55,   56,   59,   60,   63
  14275. ,   65,   96,   10,   21,   25,   26,   27,   42,   43,   44
  14276. ,   45,   54,   55,   56,   59,   60,   63,   65,   96,   10
  14277. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  14278. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  14279. ,   44,   45,   54,   55,   56,   59,   60,   63,   65,   96
  14280. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   54
  14281. ,   55,   56,   59,   60,   63,   65,   96,   10,   21,   25
  14282. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  14283. ,   65,   10,   21,   25,   26,   27,   42,   43,   44,   45
  14284. ,   55,   56,   59,   60,   65,   10,   21,   25,   26,   27
  14285. ,   42,   43,   44,   45,   55,   56,   59,   60,   65,   10
  14286. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  14287. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  14288. ,   44,   45,   55,   56,   59,   60,   65,   10,   21,   25
  14289. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  14290. ,   65,   79,   80,   88,   72,   80,    8,   80,   88,   80
  14291. ,   88,   31,   33,   58,   72,   75,   80,   85,   75,   79
  14292. ,   75,   79,   10,   21,   25,   26,   27,   42,   43,   44
  14293. ,   45,   55,   56,   59,   60,   65,   10,   21,   25,   26
  14294. ,   27,   42,   43,   44,   45,   55,   56,   59,   60,   65
  14295. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   55
  14296. ,   56,   59,   60,   65,   31,   71,   80,   10,   21,   25
  14297. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  14298. ,   65,    3,   35,   36,   37,   65,   66,   67,   68,   71
  14299. ,   74,   76,   72,   80,   72,   80,   18,   31,   50,   51
  14300. ,   71,   80,   80,   80,   80,   80,   80,   80,   80,    7
  14301. ,   16,   17,   30,   31,   33,   34,   36,   39,   47,   49
  14302. ,   50,   58,   64,   69,   71,   72,   73,   74,   75,   76
  14303. ,   78,   80,   81,   82,   83,   84,   85,   86,   87,   88
  14304. ,   89,   90,   91,   80,   88,    7,   16,   17,   30,   31
  14305. ,   33,   34,   36,   39,   47,   49,   50,   58,   64,   69
  14306. ,   71,   72,   73,   74,   75,   76,   78,   80,   81,   82
  14307. ,   83,   84,   85,   86,   87,   88,   89,   90,   91,   33
  14308. ,   72,   75,   80,   84,   85,   88,   80,   88,   80,   88
  14309. ,   65,    7,   30,   31,   33,   36,   39,   47,   58,   64
  14310. ,   72,   75,   80,   81,   82,   83,   84,   85,   86,   88
  14311. ,   89,   90,   91,   72,   75,   72,   75,   72,   75,   47
  14312. ,   80,   88,   80,   88,   47,   80,   88,   80,   72,   75
  14313. ,   72,   75,   38,    7,    9,   30,   31,   33,   34,   36
  14314. ,   39,   47,   49,   58,   64,   69,   70,   71,   72,   73
  14315. ,   74,   75,   76,   77,   78,   80,   81,   82,   83,   84
  14316. ,   85,   86,   87,   88,   89,   90,   91,   33,   72,   75
  14317. ,   72,   75,    7,   31,   33,   39,   58,   64,   72,   75
  14318. ,   80,   85,   48,   12,   37,   43,   65,   21,   61,   10
  14319. ,   12,   21,   22,   25,   26,   27,   42,   43,   44,   45
  14320. ,   54,   55,   56,   59,   60,   61,   63,   65,   67,   68
  14321. ,   12,   65,   12,   21,   43,   61,   65,   21,   61,   12
  14322. ,   21,   43,   61,    2,    4,   10,   12,   14,   15,   19
  14323. ,   20,   21,   23,   24,   25,   28,   29,   33,   37,   39
  14324. ,   43,   46,   51,   53,   61,   62,   65,   67,   68,   92
  14325. ,   43,   61,   21,   61,   12,   37,   43,   65,   21,   61
  14326. ,   12,   37,   43,   65,   84,   85,   10,   21,   25,   26
  14327. ,   27,   42,   43,   45,   55,   56,   59,   60,   65,   10
  14328. ,   21,   25,   26,   27,   42,   44,   45,   55,   56,   59
  14329. ,   60,   10,   21,   10,   21,   26,   27,   42,   43,   45
  14330. ,   56,   60,   10,   21,   26,   27,   42,   45,   56,   60
  14331. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   55
  14332. ,   56,   59,   60,   65,   10,   21,   25,   26,   27,   42
  14333. ,   43,   44,   45,   55,   56,   59,   60,   65,   10,   21
  14334. ,   25,   26,   27,   42,   43,   44,   45,   54,   55,   56
  14335. ,   59,   60,   63,   65,   10,   21,   26,   27,   42,   43
  14336. ,   45,   56,   60,   10,   21,   26,   27,   42,   43,   45
  14337. ,   54,   56,   60,   63,   96,   10,   21,   26,   27,   42
  14338. ,   43,   45,   56,   60,   10,   21,   26,   27,   42,   43
  14339. ,   45,   54,   56,   60,   63,   96,   10,   21,   26,   27
  14340. ,   42,   43,   45,   54,   56,   60,   63,   96,   10,   21
  14341. ,   26,   27,   42,   43,   45,   54,   56,   60,   63,   96
  14342. ,    7,    9,   30,   31,   33,   34,   36,   39,   47,   49
  14343. ,   58,   64,   69,   70,   71,   72,   73,   74,   75,   76
  14344. ,   77,   78,   80,   81,   82,   83,   84,   85,   86,   87
  14345. ,   88,   89,   90,   91,    7,    9,   30,   31,   33,   34
  14346. ,   36,   39,   47,   49,   58,   64,   69,   70,   71,   72
  14347. ,   73,   74,   75,   76,   77,   78,   80,   81,   82,   83
  14348. ,   84,   85,   86,   87,   88,   89,   90,   91,    7,    9
  14349. ,   30,   31,   33,   34,   36,   39,   47,   49,   58,   60
  14350. ,   64,   69,   70,   71,   72,   73,   74,   75,   76,   77
  14351. ,   78,   80,   81,   82,   83,   84,   85,   86,   87,   88
  14352. ,   89,   90,   91,    7,    9,   30,   31,   33,   34,   36
  14353. ,   39,   47,   49,   58,   64,   69,   70,   71,   72,   73
  14354. ,   74,   75,   76,   77,   78,   80,   81,   82,   83,   84
  14355. ,   85,   86,   87,   88,   89,   90,   91,    7,    9,   30
  14356. ,   31,   33,   34,   36,   39,   47,   49,   58,   60,   64
  14357. ,   69,   70,   71,   72,   73,   74,   75,   76,   77,   78
  14358. ,   80,   81,   82,   83,   84,   85,   86,   87,   88,   89
  14359. ,   90,   91,   72,    7,   30,   31,   33,   34,   36,   39
  14360. ,   47,   49,   58,   64,   69,   72,   73,   74,   75,   76
  14361. ,   78,   80,   81,   82,   83,   84,   85,   86,   87,   88
  14362. ,   89,   90,   91,   72,   75,   72,   72,   75,   72,   75
  14363. ,   72,   72,   75,   72,   75,   72,   75,    7,   31,   33
  14364. ,   39,   58,   64,   72,   75,   80,   85,    7,   31,   33
  14365. ,   58,   72,   75,   80,   85,   31,   33,   39,   58,   72
  14366. ,   75,   80,   85,   31,   33,   58,   64,   72,   75,   80
  14367. ,   85,    7,   31,   33,   58,   72,   75,   80,   85,   31
  14368. ,   33,   39,   58,   72,   75,   80,   85,    7,   31,   33
  14369. ,   39,   58,   64,   72,   75,   80,   85,    3,   35,   36
  14370. ,   37,   65,   66,   67,   68,   71,   74,   76,    7,   30
  14371. ,   31,   33,   36,   39,   47,   58,   64,   69,   72,   74
  14372. ,   75,   76,   80,   81,   82,   83,   84,   85,   86,   88
  14373. ,   89,   90,   91,    7,   30,   31,   33,   34,   36,   39
  14374. ,   47,   49,   58,   64,   69,   72,   73,   74,   75,   76
  14375. ,   78,   80,   81,   82,   83,   84,   85,   86,   88,   89
  14376. ,   90,   91,    7,   30,   31,   33,   36,   39,   47,   58
  14377. ,   64,   69,   72,   74,   75,   76,   80,   81,   82,   83
  14378. ,   84,   85,   86,   88,   89,   90,   91,    7,   30,   31
  14379. ,   33,   34,   36,   39,   47,   49,   58,   64,   69,   72
  14380. ,   73,   74,   75,   76,   78,   80,   81,   82,   83,   84
  14381. ,   85,   86,   87,   88,   89,   90,   91,    7,   30,   31
  14382. ,   33,   34,   36,   39,   47,   49,   58,   64,   69,   72
  14383. ,   73,   74,   75,   76,   78,   80,   81,   82,   83,   84
  14384. ,   85,   86,   88,   89,   90,   91,    7,   30,   31,   33
  14385. ,   34,   36,   39,   47,   49,   58,   64,   69,   72,   73
  14386. ,   74,   75,   76,   78,   80,   81,   82,   83,   84,   85
  14387. ,   86,   88,   89,   90,   91,   35,   37,   65,   66,   67
  14388. ,   68,   71,    7,   30,   31,   33,   34,   36,   39,   47
  14389. ,   49,   58,   64,   69,   72,   73,   74,   75,   76,   78
  14390. ,   80,   81,   82,   83,   84,   85,   86,   87,   88,   89
  14391. ,   90,   91,    7,   30,   31,   33,   34,   36,   39,   47
  14392. ,   49,   58,   64,   69,   72,   73,   74,   75,   76,   78
  14393. ,   80,   81,   82,   83,   84,   85,   86,   87,   88,   89
  14394. ,   90,   91,    7,   30,   31,   33,   34,   36,   39,   47
  14395. ,   49,   58,   64,   69,   72,   73,   74,   75,   76,   78
  14396. ,   80,   81,   82,   83,   84,   85,   86,   87,   88,   89
  14397. ,   90,   91,    3,   35,   36,   37,   65,   66,   67,   68
  14398. ,   71,   74,   76,    3,   35,   36,   37,   65,   66,   67
  14399. ,   68,   71,    3,   35,   36,   37,   65,   66,   67,   68
  14400. ,   71,    3,   35,   36,   37,   65,   66,   67,   68,   71
  14401. ,   35,   37,   65,   66,   67,   68,   71,    7,   16,   17
  14402. ,   30,   31,   33,   34,   36,   39,   47,   49,   50,   58
  14403. ,   61,   64,   69,   70,   71,   72,   73,   74,   75,   76
  14404. ,   77,   78,   80,   81,   82,   83,   84,   85,   86,   87
  14405. ,   88,   89,   90,   91,    2,    4,   10,   12,   14,   15
  14406. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  14407. ,   39,   43,   46,   51,   53,   57,   61,   62,   65,   67
  14408. ,   68,   92,    2,    4,   10,   12,   14,   15,   19,   20
  14409. ,   21,   23,   24,   25,   28,   29,   33,   37,   39,   43
  14410. ,   46,   51,   53,   61,   62,   65,   67,   68,   92,    2
  14411. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  14412. ,   25,   28,   29,   33,   37,   39,   46,   51,   53,   61
  14413. ,   62,   65,   67,   68,   92,   19,   20,   21,   23,   61
  14414. ,    2,    4,   10,   12,   14,   15,   19,   20,   21,   23
  14415. ,   24,   25,   28,   29,   33,   37,   39,   43,   46,   51
  14416. ,   53,   61,   62,   65,   67,   68,   92,    2,    4,   10
  14417. ,   12,   14,   15,   19,   20,   21,   23,   24,   25,   28
  14418. ,   29,   33,   37,   39,   43,   46,   51,   53,   61,   62
  14419. ,   65,   67,   68,   92,    2,    4,   10,   12,   14,   15
  14420. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  14421. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  14422. ,   92,    2,    4,   10,   12,   14,   15,   24,   25,   28
  14423. ,   29,   33,   37,   46,   51,   53,   62,   65,   67,   68
  14424. ,   92,    2,    4,   15,   28,   37,   46,   12,   24,   29
  14425. ,   53,    2,    4,   10,   12,   14,   15,   19,   20,   21
  14426. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  14427. ,   51,   53,   61,   62,   65,   67,   68,   92,   51,    2
  14428. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  14429. ,   25,   28,   29,   33,   37,   39,   43,   46,   51,   53
  14430. ,   61,   62,   65,   67,   68,   92,    2,    4,   10,   12
  14431. ,   14,   15,   19,   20,   21,   23,   24,   25,   28,   29
  14432. ,   33,   37,   39,   43,   46,   51,   53,   61,   62,   65
  14433. ,   67,   68,   92,    2,    4,   10,   12,   14,   15,   19
  14434. ,   20,   21,   23,   24,   25,   28,   29,   33,   37,   39
  14435. ,   43,   46,   51,   53,   61,   62,   65,   67,   68,   92
  14436. ,    2,    4,   10,   12,   14,   15,   19,   20,   21,   23
  14437. ,   24,   25,   28,   29,   33,   37,   39,   43,   46,   51
  14438. ,   53,   61,   62,   65,   67,   68,   92,    2,    4,   10
  14439. ,   12,   14,   15,   19,   20,   21,   23,   24,   25,   28
  14440. ,   29,   33,   37,   39,   43,   46,   51,   53,   61,   62
  14441. ,   65,   67,   68,   92,    2,    4,   10,   12,   14,   15
  14442. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  14443. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  14444. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  14445. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  14446. ,   51,   53,   61,   62,   65,   67,   68,   92,    2,    4
  14447. ,   10,   12,   14,   15,   19,   20,   21,   23,   24,   25
  14448. ,   28,   29,   33,   37,   39,   43,   46,   51,   53,   61
  14449. ,   62,   65,   67,   68,   92,    2,    4,   10,   12,   14
  14450. ,   15,   19,   20,   21,   23,   24,   25,   28,   29,   33
  14451. ,   37,   39,   43,   46,   51,   53,   61,   62,   65,   67
  14452. ,   68,   92,   10,   14,   25,   33,   62,   65,   67,   68
  14453. ,    2,    4,   10,   12,   14,   15,   19,   20,   21,   23
  14454. ,   24,   25,   28,   29,   33,   37,   39,   43,   46,   51
  14455. ,   53,   61,   62,   65,   67,   68,   92,    2,    4,   10
  14456. ,   12,   14,   15,   19,   20,   21,   23,   24,   25,   28
  14457. ,   29,   33,   37,   39,   43,   46,   51,   53,   61,   62
  14458. ,   65,   67,   68,   92,    2,    4,   10,   12,   14,   15
  14459. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  14460. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  14461. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  14462. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  14463. ,   51,   53,   61,   62,   65,   67,   68,   92,    2,    4
  14464. ,   10,   12,   14,   15,   19,   20,   21,   23,   24,   25
  14465. ,   28,   29,   33,   37,   39,   43,   46,   51,   53,   61
  14466. ,   62,   65,   67,   68,   92,   71,   80,   88,    2,    4
  14467. ,   10,   12,   14,   15,   24,   25,   28,   29,   33,   37
  14468. ,   46,   51,   53,   62,   65,   67,   68,   92,   19,   20
  14469. ,   21,   19,   20,   21,   21,   33,   58,   80,   85,   43
  14470. ,   61,   21,    2,    4,   10,   12,   14,   15,   24,   25
  14471. ,   28,   29,   33,   37,   43,   46,   51,   53,   62,   65
  14472. ,   67,   68,   92,   21,   61,    2,    4,   10,   12,   14
  14473. ,   15,   24,   25,   28,   29,   33,   37,   43,   46,   51
  14474. ,   53,   62,   65,   67,   68,   92,   25,   33,   62,    2
  14475. ,    4,   10,   12,   14,   15,   24,   25,   28,   29,   33
  14476. ,   37,   43,   46,   51,   53,   62,   65,   67,   68,   92
  14477. ,   80,   33,   65,   67,   80,   65,   67,   80,    2,    4
  14478. ,   10,   12,   14,   15,   24,   25,   28,   29,   33,   37
  14479. ,   43,   46,   51,   53,   62,   65,   67,   68,   92,   21
  14480. ,   23,   21,   10,   14,   10,   25,   26,   27,   42,   43
  14481. ,   45,   55,   56,   59,   60,   65,   31,   50,   80,   18
  14482. ,   31,   50,   71,   80,   72,   80,   72,   80,   31,   51
  14483. ,   71,   65,   65,   10,   25,   26,   27,   42,   43,   45
  14484. ,   55,   56,   59,   60,   65,   80,   80,   21,   25,   26
  14485. ,   27,   42,   43,   44,   45,   55,   56,   59,   60,   65
  14486. ,   21,   44,   21,   25,   26,   27,   42,   43,   45,   55
  14487. ,   56,   59,   60,   65,   10,   21,   25,   26,   27,   42
  14488. ,   43,   45,   55,   56,   59,   60,   65,   21,   75,   80
  14489. ,   75,   80,   21,   22,   25,   43,   21,   21,   22,   25
  14490. ,   43,   10,   25,   26,   27,   42,   43,   45,   55,   56
  14491. ,   59,   60,   65,   80,   21,   22,   25,   43,   18,   80
  14492. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  14493. ,   33,   37,   43,   46,   51,   53,   62,   65,   67,   68
  14494. ,   92,    3,   35,   36,   37,   65,   66,   67,   68,   71
  14495. ,   74,   76,   80,    2,    4,   10,   12,   14,   15,   19
  14496. ,   20,   21,   23,   24,   25,   28,   29,   33,   37,   39
  14497. ,   43,   46,   51,   53,   61,   62,   65,   67,   68,   92
  14498. ,    2,    4,   10,   12,   14,   15,   19,   20,   21,   23
  14499. ,   24,   25,   28,   29,   33,   37,   39,   43,   46,   51
  14500. ,   53,   61,   62,   65,   67,   68,   92,    2,    4,   10
  14501. ,   12,   14,   15,   19,   20,   21,   23,   24,   25,   28
  14502. ,   29,   33,   37,   39,   43,   46,   51,   53,   61,   62
  14503. ,   65,   67,   68,   92,    4,   15,   43,   57,   61,   65
  14504. ,   67,   68,   19,   21,   39,   19,   21,   39,   19,   21
  14505. ,   39,   19,   21,   39,   19,   21,   39,   19,   21,   39
  14506. ,   19,   21,   39,    2,    4,   10,   12,   14,   15,   19
  14507. ,   21,   24,   25,   28,   29,   33,   37,   39,   43,   46
  14508. ,   51,   53,   62,   65,   67,   68,   92,   19,   21,   39
  14509. ,    2,    4,   10,   12,   14,   15,   19,   21,   24,   25
  14510. ,   28,   29,   33,   37,   39,   43,   46,   51,   53,   62
  14511. ,   65,   67,   68,   92,   19,   21,   39,   43,   19,   39
  14512. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  14513. ,   33,   37,   43,   46,   51,   53,   62,   65,   67,   68
  14514. ,   92,    4,   15,   43,   57,   61,   21,    2,    4,   10
  14515. ,   12,   14,   15,   19,   24,   25,   28,   29,   33,   37
  14516. ,   39,   43,   46,   51,   53,   62,   65,   67,   68,   92
  14517. ,   75,   80,   26,   27,   42,   43,   45,   54,   63,   96
  14518. ,   71,   80,   26,   27,   42,   43,   45,   54,   63,   96
  14519. ,   26,   27,   42,   45,   54,   26,   27,   42,   43,   45
  14520. ,   54,   63,   96,   26,   27,   42,   43,   45,   54,   63
  14521. ,   96,   26,   27,   42,   45,   54,   63,   75,   80,   75
  14522. ,   80,   26,   27,   42,   43,   45,   54,   60,   63,   26
  14523. ,   42,   45,   56,   21,   61,   21,   21,   21,    2,    4
  14524. ,   10,   12,   14,   15,   24,   25,   28,   29,   33,   37
  14525. ,   43,   46,   51,   53,   62,   65,   67,   68,   92,   21
  14526. ,   61,    2,    4,   10,   12,   14,   15,   24,   25,   28
  14527. ,   29,   33,   37,   43,   46,   51,   53,   62,   65,   67
  14528. ,   68,   92,   84,   85,   26,   42,   45,   26,   42,   45
  14529. ,   59,   63,   65,   26,   42,   45,   59,   63,   65,   26
  14530. ,   42,   45,   59,   63,   65,   80,   80,   71,   80,   72
  14531. ,   75,   72,   75,   35,   72,   75,   85,   72,   75,   10
  14532. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  14533. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  14534. ,   44,   45,   55,   56,   59,   60,   65,   10,   21,   25
  14535. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  14536. ,   65,   10,   21,   25,   26,   27,   42,   43,   44,   45
  14537. ,   55,   56,   59,   60,   65,   21,   43,   65,   67,   68
  14538. ,   21,   21,   43,   65,   67,   68,   21,   43,   65,   67
  14539. ,   68,   43,   61,   43,   61,   65,   21,   61,   84,   85
  14540. ,   65,   10,   21,   25,   26,   27,   42,   44,   45,   55
  14541. ,   56,   59,   60,   72,   75,   84,   85,    2,    4,   10
  14542. ,   12,   14,   15,   24,   25,   28,   29,   33,   37,   43
  14543. ,   46,   51,   53,   62,   65,   67,   68,   92,    2,    4
  14544. ,   10,   12,   14,   15,   24,   25,   28,   29,   33,   37
  14545. ,   43,   46,   51,   53,   62,   65,   67,   68,   92,   21
  14546. ,   61,   43,   61,   21,   65,   21,   22,   25,   21,   25
  14547. ,   19,   21,   39,   26,   27,   42,   45,   54,   60,   63
  14548. ,   84,   85,   21,   65,   67,   68,   31,    2,    4,   10
  14549. ,   12,   14,   15,   24,   25,   28,   29,   33,   37,   43
  14550. ,   46,   51,   53,   62,   65,   67,   68,   92,    2,    4
  14551. ,   10,   12,   14,   15,   24,   25,   28,   29,   33,   37
  14552. ,   43,   46,   51,   53,   62,   65,   67,   68,   92,    4
  14553. ,   15,   57,   72,   65,   65)  ;
  14554.         --| Map of states to sets of follow symbols
  14555.         -- NYU Reference Name: FOLLOW
  14556.  
  14557.     ------------------------------------------------------------------
  14558.     -- Action_Token_Map
  14559.     ------------------------------------------------------------------
  14560.  
  14561.     
  14562.     type Action_Token_Array_Index is array(
  14563.         PositiveParserInteger range <>) of GC.ParserInteger ;
  14564.         --| For indexing the All Action Token Array.
  14565.         --| Maps a given state into the lower and upper bounds of a slice
  14566.         --| of the All Action Index Array.
  14567.     
  14568.     Action_Token_MapIndex : constant Action_Token_Array_Index :=
  14569.          (    1,    1,    2,    2,    3,    2,    3,    9,   10,   11
  14570. ,   12,   11,   12,   16,   17,   17,   18,   17,   18,   17
  14571. ,   18,   28,   29,   28,   29,   30,   31,   30,   31,   32
  14572. ,   33,   33,   34,   34,   35,   34,   35,   34,   35,   34
  14573. ,   35,   34,   35,   34,   35,   34,   35,   36,   37,   36
  14574. ,   37,   37,   38,   37,   38,   37,   38,   37,   38,   37
  14575. ,   38,   41,   42,   44,   45,   44,   45,   45,   46,   46
  14576. ,   47,   46,   47,   46,   47,   47,   48,   47,   48,   47
  14577. ,   48,   75,   76,   75,   76,   75,   76,   75,   76,   87
  14578. ,   88,   87,   88,   87,   88,   88,   89,   88,   89,   97
  14579. ,   98,  101,  102,  101,  102,  101,  102,  101,  102,  101
  14580. ,  102,  102,  103,  102,  103,  105,  106,  106,  107,  107
  14581. ,  108,  108,  109,  109,  110,  110,  111,  113,  114,  117
  14582. ,  118,  117,  118,  118,  119,  118,  119,  125,  126,  125
  14583. ,  126,  125,  126,  125,  126,  134,  135,  134,  135,  134
  14584. ,  135,  134,  135,  137,  138,  138,  139,  138,  139,  139
  14585. ,  140,  140,  141,  140,  141,  153,  154,  153,  154,  155
  14586. ,  156,  156,  157,  156,  157,  157,  158,  159,  160,  159
  14587. ,  160,  173,  174,  182,  183,  184,  185,  184,  185,  185
  14588. ,  186,  186,  187,  187,  188,  189,  190,  190,  191,  191
  14589. ,  192,  191,  192,  191,  192,  191,  192,  191,  192,  192
  14590. ,  193,  192,  193,  193,  194,  194,  195,  195,  196,  198
  14591. ,  199,  198,  199,  198,  199,  198,  199,  199,  200,  200
  14592. ,  201,  200,  201,  201,  202,  201,  202,  203,  204,  205
  14593. ,  206,  206,  207,  206,  207,  208,  209,  224,  225,  228
  14594. ,  229,  228,  229,  229,  230,  230,  231,  230,  231,  230
  14595. ,  231,  231,  232,  231,  232,  232,  233,  232,  233,  232
  14596. ,  233,  232,  233,  243,  244,  243,  244,  243,  244,  243
  14597. ,  244,  243,  244,  254,  255,  265,  266,  276,  277,  281
  14598. ,  282,  292,  293,  296,  297,  296,  297,  307,  308,  308
  14599. ,  309,  320,  321,  332,  333,  343,  344,  354,  355,  365
  14600. ,  366,  376,  377,  377,  378,  378,  379,  378,  379,  378
  14601. ,  379,  378,  379,  387,  388,  387,  388,  387,  388,  387
  14602. ,  388,  387,  388,  396,  397,  396,  397,  396,  397,  403
  14603. ,  404,  406,  407,  406,  407,  406,  407,  406,  407,  406
  14604. ,  407,  406,  407,  407,  408,  409,  410,  410,  411,  424
  14605. ,  425,  426,  427,  427,  428,  428,  429,  439,  440,  439
  14606. ,  440,  439,  440,  448,  449,  448,  449,  448,  449,  448
  14607. ,  449,  448,  449,  448,  449,  449,  450,  450,  451,  450
  14608. ,  451,  453,  454,  454,  455,  455,  456,  457,  458,  458
  14609. ,  459,  458,  459,  458,  459,  458,  459,  458,  459,  458
  14610. ,  459,  458,  459,  458,  459,  458,  459,  458,  459,  458
  14611. ,  459,  458,  459,  458,  459,  458,  459,  458,  459,  458
  14612. ,  459,  458,  459,  461,  462,  461,  462,  461,  462,  461
  14613. ,  462,  461,  462,  461,  462,  461,  462,  462,  463,  462
  14614. ,  463,  462,  463,  462,  463,  462,  463,  462,  463,  463
  14615. ,  464,  464,  465,  466,  467,  467,  468,  467,  468,  468
  14616. ,  469,  469,  470,  469,  470,  469,  470,  470,  471,  472
  14617. ,  473,  472,  473,  473,  474,  473,  474,  473,  474,  475
  14618. ,  476,  475,  476,  486,  487,  487,  488,  488,  489,  489
  14619. ,  490,  500,  501,  511,  512,  511,  512,  523,  524,  534
  14620. ,  535,  534,  535,  536,  537,  536,  537,  548,  549,  548
  14621. ,  549,  549,  550,  549,  550,  549,  550,  549,  550,  550
  14622. ,  551,  550,  551,  550,  551,  551,  552,  551,  552,  551
  14623. ,  552,  551,  552,  551,  552,  551,  552,  551,  552,  551
  14624. ,  552,  552,  553,  552,  553,  552,  553,  552,  553,  552
  14625. ,  553,  552,  553,  552,  553,  552,  553,  553,  554,  564
  14626. ,  565,  572,  573,  572,  573,  583,  584,  583,  584,  583
  14627. ,  584,  583,  584,  583,  584,  583,  584,  594,  595,  605
  14628. ,  606,  605,  606,  605,  606,  605,  606,  606,  607,  607
  14629. ,  608,  607,  608,  618,  619,  618,  619,  618,  619,  629
  14630. ,  630,  629,  630,  629,  630,  630,  631,  655,  656,  680
  14631. ,  681,  680,  681,  680,  681,  680,  681,  681,  682,  681
  14632. ,  682,  682,  683,  684,  685,  687,  688,  687,  688,  687
  14633. ,  688,  687,  688,  690,  691,  711,  712,  711,  712,  712
  14634. ,  713,  712,  713,  714,  715,  715,  716,  718,  719,  719
  14635. ,  720,  721,  722,  722,  723,  723,  724,  725,  726,  725
  14636. ,  726,  728,  729,  729,  730,  729,  730,  743,  744,  746
  14637. ,  747,  747,  748,  748,  749,  749,  750,  750,  751,  750
  14638. ,  751,  751,  752,  752,  753,  752,  753,  753,  754,  754
  14639. ,  755,  755,  756,  755,  756,  757,  758,  758,  759,  759
  14640. ,  760,  760,  761,  761,  762,  762,  763,  762,  763,  763
  14641. ,  764,  764,  765,  764,  765,  764,  765,  764,  765,  764
  14642. ,  765,  764,  765,  764,  765,  764,  765,  764,  765,  764
  14643. ,  765,  764,  765,  775,  776,  786,  787,  786,  787,  786
  14644. ,  787,  786,  787,  798,  799,  798,  799,  809,  810,  820
  14645. ,  821,  820,  821,  821,  822,  821,  822,  821,  822,  821
  14646. ,  822,  821,  822,  821,  822,  821,  822,  821,  822,  822
  14647. ,  823,  824,  825,  825,  826,  825,  826,  827,  828,  827
  14648. ,  828,  827,  828,  829,  830,  831,  832,  842,  843,  843
  14649. ,  844,  844,  845,  845,  846,  846,  847,  852,  853,  866
  14650. ,  867,  867,  868,  867,  868,  867,  868,  867,  868,  867
  14651. ,  868,  867,  868,  887,  888,  893,  894,  897,  898,  898
  14652. ,  899,  906,  907,  906,  907,  906,  907,  907,  908,  907
  14653. ,  908,  918,  919,  918,  919,  920,  921,  924,  925,  935
  14654. ,  936,  936,  937,  937,  938,  939,  940,  939,  940,  939
  14655. ,  940,  948,  949,  948,  949,  949,  950,  950,  951,  952
  14656. ,  953,  956,  957,  957,  958,  958,  959,  958,  959,  959
  14657. ,  960,  960,  961,  961,  962,  961,  962,  961,  962,  961
  14658. ,  962,  961,  962,  961,  962,  962,  963,  962,  963,  962
  14659. ,  963,  962,  963,  970,  971,  971,  972,  975,  976,  976
  14660. ,  977,  977,  978,  978,  979,  979,  980,  979,  980,  979
  14661. ,  980,  980,  981,  981,  982,  981,  982,  981,  982,  982
  14662. ,  983,  982,  983,  982,  983,  982,  983,  982,  983,  983
  14663. ,  984,  983,  984,  983,  984,  984,  985,  985,  986,  987
  14664. ,  988,  989,  990,  989,  990,  990,  991, 1001, 1002, 1001
  14665. , 1002, 1002, 1003, 1003, 1004, 1005, 1006, 1005, 1006, 1005
  14666. , 1006, 1005, 1006, 1005, 1006, 1005, 1006, 1005, 1006, 1005
  14667. , 1006, 1005, 1006, 1007, 1008, 1008, 1009, 1009, 1010, 1010
  14668. , 1011, 1035, 1036, 1035, 1036, 1035, 1036, 1035, 1036, 1035
  14669. , 1036, 1038, 1039, 1039, 1040, 1039, 1040, 1040, 1041, 1041
  14670. , 1042, 1043, 1044, 1043, 1044, 1043, 1044, 1043, 1044, 1043
  14671. , 1044, 1043, 1044, 1043, 1044, 1043, 1044, 1054, 1055, 1065
  14672. , 1066, 1068, 1069, 1079, 1080, 1079, 1080, 1079, 1080, 1079
  14673. , 1080, 1079, 1080, 1079, 1080, 1079, 1080, 1079, 1080, 1079
  14674. , 1080, 1079, 1080, 1079, 1080, 1091, 1092, 1091, 1092, 1092
  14675. , 1093, 1095, 1096, 1095, 1096, 1095, 1096, 1095, 1096, 1095
  14676. , 1096, 1095, 1096, 1098, 1099, 1100, 1101, 1100, 1101, 1102
  14677. , 1103, 1102, 1103, 1103, 1104, 1114, 1115, 1126, 1127, 1127
  14678. , 1128, 1128, 1129, 1129, 1130, 1131, 1132, 1132, 1133, 1136
  14679. , 1137, 1136, 1137, 1136, 1137, 1137, 1138, 1138, 1139, 1149
  14680. , 1150, 1160, 1161, 1161, 1162, 1161, 1162, 1162, 1163, 1164
  14681. , 1165, 1164, 1165, 1164, 1165, 1165, 1166, 1166, 1167, 1167
  14682. , 1168, 1168, 1169, 1169, 1170, 1170, 1171, 1171, 1172, 1171
  14683. , 1172, 1171, 1172, 1171, 1172, 1172, 1173, 1173, 1174, 1173
  14684. , 1174, 1174, 1175, 1175, 1176, 1175, 1176, 1175, 1176, 1175
  14685. , 1176, 1175, 1176, 1176, 1177, 1177, 1178, 1178, 1179, 1178
  14686. , 1179, 1179, 1180, 1179, 1180, 1193, 1194, 1196, 1197, 1197
  14687. , 1198, 1198, 1199, 1199, 1200, 1199, 1200, 1200, 1201, 1201
  14688. , 1202, 1201, 1202, 1201, 1202, 1202, 1203, 1202, 1203, 1202
  14689. , 1203, 1205, 1206, 1205, 1206, 1205, 1206, 1216, 1217, 1217
  14690. , 1218, 1217, 1218, 1217, 1218, 1217, 1218, 1217, 1218, 1217
  14691. , 1218, 1217, 1218, 1218, 1219, 1219, 1220, 1219, 1220, 1219
  14692. , 1220, 1220, 1221, 1221, 1222, 1222, 1223, 1222, 1223, 1222
  14693. , 1223, 1222, 1223, 1225, 1226, 1226, 1227, 1228, 1229, 1228
  14694. , 1229, 1228, 1229, 1230, 1231, 1231, 1232, 1231, 1232, 1232
  14695. , 1233, 1233, 1234, 1244, 1245, 1244, 1245, 1247, 1248, 1247
  14696. , 1248, 1247, 1248, 1248, 1249, 1248, 1249, 1249, 1250, 1251
  14697. , 1252, 1259, 1260, 1259, 1260, 1259, 1260, 1260, 1261, 1265
  14698. , 1266, 1269, 1270, 1271, 1272, 1272, 1273, 1272, 1273, 1283
  14699. , 1284, 1283, 1284, 1284, 1285, 1284, 1285, 1285, 1286, 1285
  14700. , 1286, 1287, 1288, 1287, 1288, 1288, 1289, 1288, 1289, 1288
  14701. , 1289, 1288, 1289, 1288, 1289, 1288, 1289, 1289, 1290, 1290
  14702. , 1291, 1291, 1292, 1292, 1293, 1292, 1293, 1292, 1293, 1292
  14703. , 1293, 1292, 1293, 1292, 1293, 1303, 1304, 1303, 1304, 1303
  14704. , 1304, 1303, 1304, 1303, 1304, 1303, 1304, 1314, 1315, 1315
  14705. , 1316, 1315, 1316, 1315, 1316, 1316, 1317, 1317, 1318, 1317
  14706. , 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317
  14707. , 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317
  14708. , 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317, 1318, 1317
  14709. , 1318, 1318, 1319, 1318, 1319, 1320, 1321, 1320, 1321, 1320
  14710. , 1321, 1331, 1332, 1332, 1333, 1333, 1334, 1333, 1334, 1335
  14711. , 1336, 1337, 1338, 1338, 1339, 1339, 1340, 1344, 1345, 1344
  14712. , 1345, 1344, 1345, 1344, 1345, 1344, 1345, 1345, 1346, 1345
  14713. , 1346, 1347, 1348, 1347, 1348, 1347, 1348, 1348, 1349, 1348
  14714. , 1349, 1348, 1349, 1349, 1350, 1350, 1351, 1351, 1352, 1353
  14715. , 1354, 1364, 1365, 1366, 1367, 1366, 1367, 1366, 1367, 1367
  14716. , 1368, 1367, 1368, 1367, 1368, 1368, 1369, 1379, 1380, 1379
  14717. , 1380, 1381, 1382, 1381, 1382, 1381, 1382, 1382, 1383, 1394
  14718. , 1395, 1394, 1395, 1394, 1395, 1394, 1395, 1394, 1395, 1394
  14719. , 1395, 1395, 1396, 1406, 1407, 1409, 1410, 1409, 1410, 1409
  14720. , 1410, 1409, 1410, 1409, 1410, 1409, 1410, 1409, 1410, 1409
  14721. , 1410, 1409, 1410, 1409, 1410, 1409, 1410, 1409, 1410, 1411
  14722. , 1412, 1411, 1412, 1414, 1415, 1416, 1417, 1416, 1417, 1417
  14723. , 1418, 1417, 1418, 1428, 1429, 1429, 1430, 1429, 1430, 1430
  14724. , 1431, 1430, 1431, 1431, 1432, 1432, 1433, 1433, 1434, 1434
  14725. , 1435, 1434, 1435, 1434, 1435, 1434, 1435, 1434, 1435, 1434
  14726. , 1435, 1434, 1435, 1434, 1435, 1434, 1435, 1435, 1436, 1435
  14727. , 1436, 1436, 1437, 1437, 1438, 1440, 1441, 1441, 1442, 1441
  14728. , 1442, 1445, 1446, 1445, 1446, 1445, 1446, 1446, 1447, 1446
  14729. , 1447, 1446, 1447, 1448, 1449, 1449, 1450, 1450, 1451, 1450
  14730. , 1451, 1451, 1452, 1451, 1452, 1453, 1454, 1454, 1455, 1481
  14731. , 1482, 1485, 1486, 1486, 1487, 1486, 1487, 1486, 1487, 1497
  14732. , 1498, 1498, 1499, 1499, 1500, 1500, 1501, 1500, 1501, 1501
  14733. , 1502, 1502, 1503, 1502, 1503, 1505, 1506, 1505, 1506, 1506
  14734. , 1507, 1506, 1507, 1506, 1507, 1506, 1507, 1509, 1510, 1509
  14735. , 1510, 1510, 1511, 1510, 1511, 1510, 1511, 1510, 1511, 1511
  14736. , 1512, 1511, 1512, 1512, 1513, 1512, 1513, 1523, 1524, 1524
  14737. , 1525, 1524, 1525, 1524, 1525, 1525, 1526, 1526, 1527, 1526
  14738. , 1527, 1526, 1527, 1527, 1528, 1527, 1528, 1527, 1528, 1528
  14739. , 1529, 1529, 1530, 1553, 1554, 1553, 1554, 1553, 1554, 1553
  14740. , 1554, 1554, 1555, 1554, 1555, 1554, 1555, 1554, 1555, 1554
  14741. , 1555, 1554, 1555, 1555, 1556, 1555, 1556, 1556, 1557, 1557
  14742. , 1558, 1569, 1570, 1570, 1571, 1571, 1572, 1571, 1572, 1572
  14743. , 1573, 1572, 1573, 1574, 1575, 1585, 1586, 1586, 1587, 1587
  14744. , 1588, 1591, 1592, 1591, 1592, 1591, 1592, 1593, 1594, 1605
  14745. , 1606, 1605, 1606, 1607, 1608, 1607, 1608, 1607, 1608, 1609
  14746. , 1610, 1610, 1611, 1611, 1612, 1612, 1613, 1613, 1614, 1614
  14747. , 1615, 1623, 1624, 1623, 1624, 1623, 1624, 1624, 1625, 1626
  14748. , 1627, 1627, 1628, 1628, 1629, 1628, 1629, 1630, 1631, 1630
  14749. , 1631, 1641, 1642, 1642, 1643, 1646, 1647, 1654, 1655, 1657
  14750. , 1658, 1658, 1659, 1660, 1661, 1660, 1661, 1660, 1661, 1661
  14751. , 1662, 1662, 1663, 1662, 1663, 1662, 1663, 1662, 1663, 1662
  14752. , 1663, 1664, 1665, 1664, 1665, 1664, 1665, 1664, 1665, 1665
  14753. , 1666, 1667, 1668, 1668, 1669, 1673, 1674, 1673, 1674, 1673
  14754. , 1674, 1673, 1674, 1684, 1685, 1684, 1685, 1685, 1686, 1686
  14755. , 1687, 1686, 1687, 1687, 1688, 1687, 1688, 1688, 1689, 1689
  14756. , 1690, 1690, 1691, 1701, 1702, 1702, 1703, 1703, 1704, 1706
  14757. , 1707, 1706, 1707, 1706, 1707, 1717, 1718, 1717, 1718, 1717
  14758. , 1718, 1718, 1719, 1718, 1719, 1719, 1720, 1719, 1720, 1719
  14759. , 1720, 1720, 1721, 1720, 1721, 1721, 1722, 1722, 1723, 1722
  14760. , 1723, 1723, 1724, 1723, 1724, 1723, 1724, 1723, 1724, 1724
  14761. , 1725, 1724, 1725, 1725, 1726, 1725, 1726, 1726, 1727, 1727
  14762. , 1728, 1727, 1728, 1727, 1728, 1728, 1729, 1728, 1729, 1751
  14763. , 1752, 1752, 1753, 1752, 1753, 1753, 1754, 1754, 1755, 1754
  14764. , 1755, 1755, 1756, 1756, 1757, 1756, 1757, 1756, 1757, 1757
  14765. , 1758, 1757, 1758, 1758, 1759, 1759, 1760, 1759, 1760, 1763
  14766. , 1764, 1763, 1764, 1764, 1765, 1769, 1770, 1769, 1770, 1769
  14767. , 1770, 1770, 1771, 1771, 1772, 1772, 1773, 1772, 1773, 1773
  14768. , 1774, 1773, 1774, 1773, 1774, 1774, 1775, 1774, 1775, 1774
  14769. , 1775, 1774, 1775, 1774, 1775, 1775, 1776, 1776, 1777, 1776
  14770. , 1777, 1776, 1777, 1777, 1778, 1777, 1778, 1778, 1779, 1778
  14771. , 1779, 1779, 1780, 1780, 1781, 1781, 1782, 1781, 1782, 1782
  14772. , 1783, 1782, 1783, 1782, 1783, 1784, 1785, 1784, 1785, 1786
  14773. , 1787, 1786, 1787, 1787, 1788, 1787, 1788, 1787, 1788, 1788
  14774. , 1789, 1789, 1790, 1790, 1791, 1791, 1792, 1791, 1792, 1791
  14775. , 1792, 1793, 1794, 1793, 1794, 1793, 1794, 1793, 1794, 1793
  14776. , 1794, 1793, 1794, 1793, 1794, 1793, 1794, 1793)  ;
  14777.     
  14778.     Action_Token_Map : constant Action_Token_Array :=
  14779.          (   43,   65,   27,   42,   43,   45,   54,   26,   63,   71
  14780. ,   80,   27,   54,   26,   42,   45,   63,   37,   66,   76
  14781. ,    3,   35,   36,   65,   67,   68,   71,   74,   65,   67
  14782. ,   11,   65,   65,   71,   31,   80,   80,   56,   26,   42
  14783. ,   45,   26,   42,   45,   72,   65,   65,    7,   30,   34
  14784. ,   36,   39,   49,   73,   87,   91,   47,   64,   69,   70
  14785. ,   71,   72,   74,   75,   76,   77,   78,   81,   82,   83
  14786. ,   84,   85,   86,   89,   90,   36,   65,   68,    3,   35
  14787. ,   37,   40,   66,   67,   71,   74,   76,   72,   81,   82
  14788. ,   83,   91,   30,   36,   86,   89,   90,   47,   71,   70
  14789. ,   77,   75,    7,   39,   64,    7,   39,   64,    7,   39
  14790. ,   69,   74,   76,   34,   49,   78,   73,   87,   68,   71
  14791. ,   35,   37,   65,   66,   67,    3,   35,   37,   68,   36
  14792. ,   65,   66,   67,   71,   51,   71,   31,   65,   31,   71
  14793. ,   10,   25,   26,   42,   43,   45,   55,   56,   65,   27
  14794. ,   35,   59,   60,   80,   71,   35,   10,   67,   65,   10
  14795. ,   21,   25,   26,   27,   42,   43,   44,   45,   56,   65
  14796. ,   55,   59,   60,   25,   26,   27,   42,   45,   55,   56
  14797. ,   59,   60,   21,   44,   10,   65,   21,   67,   65,   11
  14798. ,   11,   31,   65,   80,   80,   59,   63,   65,   43,   60
  14799. ,   71,   70,   77,   85,   84,   85,   72,   75,   86,    7
  14800. ,   30,   36,   39,   64,   72,   75,   81,   82,   83,   84
  14801. ,   85,   89,   90,   91,   47,   70,   71,   77,   72,   75
  14802. ,   80,   30,   66,   67,   71,   74,   76,    3,   35,   36
  14803. ,   37,   65,   68,    3,   35,   65,   66,   67,   68,   71
  14804. ,   76,   36,   37,   74,    3,   35,   36,   65,   71,   74
  14805. ,   37,   66,   67,   68,   76,   35,   36,   37,   65,   66
  14806. ,   67,   68,   71,   74,   76,    3,   16,   17,   47,   65
  14807. ,   71,   35,   36,   66,   67,   71,   74,   76,    3,   37
  14808. ,   65,   68,   67,   68,    6,   65,   35,   36,   37,   65
  14809. ,   67,   68,   71,   74,   76,    3,   66,   75,   35,   36
  14810. ,    3,   37,   58,   65,   66,   67,   68,   71,   74,   76
  14811. ,   35,   37,   65,   67,   68,   71,   74,   76,    3,   19
  14812. ,   36,   66,   37,   65,   67,   68,   71,   74,   76,    3
  14813. ,   35,   36,   66,   35,   36,   65,   67,   68,   71,   74
  14814. ,    3,   37,   66,   76,    3,   35,   36,   37,   65,   67
  14815. ,   68,   71,   66,   74,   76,    3,   35,   36,   37,   65
  14816. ,   71,   66,   67,   68,   74,   76,   58,   19,    3,   35
  14817. ,   36,   37,   66,   67,   71,   65,   68,   35,   36,   37
  14818. ,   65,   66,   67,   68,   71,    3,   65,   66,   67,   68
  14819. ,   35,   37,   71,   70,   71,   77,   65,   71,   80,   31
  14820. ,   21,   44,   45,   56,   65,   25,   26,   27,   35,   42
  14821. ,   43,   55,   59,   60,   71,   80,   65,   65,   36,   65
  14822. ,   66,   67,   71,    3,   35,   37,   68,   74,   76,   26
  14823. ,   27,   45,   55,   56,   59,   60,   25,   42,   80,   65
  14824. ,   65,   67,   68,   65,   65,   59,   65,   65,   31,   50
  14825. ,   80,   65,   80,   65,   71,   51,   65,   65,   31,   65
  14826. ,   26,   45,   79,   75,   80,    3,   36,   37,   66,   67
  14827. ,   68,   74,   76,   35,   65,   71,   71,   65,   65,    3
  14828. ,   35,   37,   65,   66,   71,   74,   36,   67,   68,   76
  14829. ,    3,   35,   36,   37,   65,   66,   67,   68,   71,   74
  14830. ,   76,   40,   66,   71,   74,    3,   35,   36,   37,   65
  14831. ,   67,   68,   76,   35,   36,   68,   71,    3,   37,   65
  14832. ,   66,   67,   74,   76,   84,   85,    3,   35,   36,   37
  14833. ,   40,   65,   66,   67,   68,   71,   74,   76,   75,   86
  14834. ,   86,   72,   65,   35,   36,   37,   66,   67,   68,   71
  14835. ,   76,    3,   65,   74,   81,   82,   83,   30,   36,   89
  14836. ,   90,   91,    3,   36,   65,   66,   68,   71,   74,   76
  14837. ,   35,   37,   67,    3,   36,   37,   74,   35,   65,   66
  14838. ,   67,   68,   71,   76,   35,   37,   65,   68,   71,   74
  14839. ,    3,   36,   66,   67,   76,   65,   79,    3,   36,   37
  14840. ,   65,   66,   67,   68,   71,   76,   35,   74,   36,   37
  14841. ,   65,   66,   67,   68,   74,    3,   35,   71,   76,   77
  14842. ,   36,   39,   49,   70,   71,   72,   75,   78,   82,   83
  14843. ,   85,   87,   89,    7,   30,   34,   64,   69,   73,   74
  14844. ,   76,   77,   81,   90,   91,   30,   34,   36,   71,   72
  14845. ,   73,   74,   75,   77,   85,   87,   89,   90,   91,    7
  14846. ,   39,   49,   64,   69,   70,   76,   78,   81,   82,   83
  14847. ,   85,   65,   11,   65,   59,   11,   65,   50,   31,   80
  14848. ,    2,    4,   10,   12,   14,   15,   33,   43,   46,   65
  14849. ,   67,   68,   24,   25,   28,   29,   37,   51,   53,   62
  14850. ,   92,   23,   71,   80,   60,   71,   70,   77,   60,   31
  14851. ,   50,   31,   65,   31,   80,   31,   71,   80,   65,   45
  14852. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  14853. ,   44,   55,   56,   67,   68,   65,   43,   21,   22,   21
  14854. ,   21,   65,   80,   31,   80,   31,   71,   31,   30,   65
  14855. ,   75,   65,   43,   72,    3,   35,   36,   37,   65,   68
  14856. ,   71,   74,   66,   67,   76,   35,   37,   65,   66,   67
  14857. ,   68,   71,   74,   76,    3,   36,    3,   35,   36,   37
  14858. ,   65,   66,   67,   71,   74,   40,   68,   76,    3,   35
  14859. ,   36,   37,   66,   67,   68,   71,   74,   76,   65,    3
  14860. ,   36,   71,   74,   76,   35,   37,   65,   66,   67,   68
  14861. ,   75,   77,   30,   41,   65,   80,   72,   72,   80,   72
  14862. ,   75,   36,   37,    3,   35,   65,   66,   67,   68,   71
  14863. ,   74,   76,   77,   65,   65,   43,   45,   56,   26,   27
  14864. ,   42,   60,   10,   26,   42,   43,   45,   54,   55,   56
  14865. ,   59,   60,   65,   25,   27,   35,   65,   12,   24,   25
  14866. ,   28,   29,   33,   37,   62,   67,   68,   92,    2,    4
  14867. ,   10,   14,   15,   46,   51,   53,   65,    2,   15,    4
  14868. ,   28,   37,   46,   24,   29,   12,   53,   51,   10,   65
  14869. ,   14,   25,   33,   62,   67,   68,   21,    3,   71,   76
  14870. ,   35,   36,   37,   65,   66,   67,   68,   74,    9,   71
  14871. ,   16,   17,   65,   47,   35,   36,   37,   65,   67,   68
  14872. ,   71,    3,   66,   74,   76,   65,   65,   31,   80,    5
  14873. ,    8,   16,   17,   32,   35,   44,   47,   71,   65,   77
  14874. ,   75,   80,   80,   70,   71,   77,   65,   65,   25,   65
  14875. ,   65,   79,    5,    8,   44,   47,   16,   17,   32,   71
  14876. ,   65,   94,   65,   67,   68,   80,   41,   88,   65,   75
  14877. ,   86,   75,   88,   51,   65,   72,   75,   72,   75,   80
  14878. ,   65,   66,   67,   68,   71,    3,   35,   36,   37,   74
  14879. ,   76,   31,   31,   11,   65,   80,   31,   80,   93,   43
  14880. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  14881. ,   25,   28,   29,   33,   46,   51,   53,   92,    2,   37
  14882. ,   61,   62,   65,   67,   68,   65,   67,   68,   65,   65
  14883. ,   80,   80,   65,   65,   68,   71,    3,   35,   36,   37
  14884. ,   66,   67,   74,   76,    3,   35,   71,   36,   37,   65
  14885. ,   66,   67,   68,   74,   76,   61,   65,   80,   35,   36
  14886. ,   37,   66,   67,   68,    3,   65,   71,   74,   76,    3
  14887. ,   35,   36,   65,   66,   67,   68,   71,   76,   37,   74
  14888. ,   80,   79,   70,   71,   77,   25,   33,   62,   10,   14
  14889. ,   43,   61,   72,   36,   65,   67,   68,    3,   35,   37
  14890. ,   66,   71,   74,   76,    3,   36,   40,   65,   66,   67
  14891. ,   68,   71,   35,   37,   74,   76,   48,   80,   80,   77
  14892. ,   80,   80,   16,   47,   17,   71,   65,   71,   65,   74
  14893. ,   76,    3,   35,   36,   37,   66,   67,   68,   71,   35
  14894. ,   36,   37,    3,   65,   66,   67,   68,   71,   74,   76
  14895. ,   44,   80,   65,   68,   80,   80,   80,   80,   80,   80
  14896. ,   80,   47,   47,   48,   79,   80,   71,   43,   80,   10
  14897. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  14898. ,   60,   65,   59,   23,   13,   65,   94,   94,   44,   94
  14899. ,   94,   80,   70,   71,   77,    3,   66,   71,   74,   35
  14900. ,   36,   37,   65,   67,   68,   76,   80,   80,   80,   54
  14901. ,   54,   43,   70,   77,   71,   71,   80,   77,   80,   77
  14902. ,   21,   80,   31,   37,   71,    3,   35,   36,   65,   66
  14903. ,   67,   68,   74,   76,   61,   77,   80,   58,   21,   43
  14904. ,   61,    4,   57,   61,   15,   43,   65,   67,   68,   80
  14905. ,   10,   14,   25,   33,   62,   16,   17,   47,   65,   80
  14906. ,   88,   65,   35,   37,   65,   66,   68,    3,   36,   67
  14907. ,   71,   74,   76,   33,   65,   40,   65,   61,   80,   80
  14908. ,   75,    9,    3,   35,   36,   37,   68,   76,   65,   66
  14909. ,   67,   71,   74,    3,   36,   65,   66,   71,   76,   35
  14910. ,   37,   67,   68,   74,   38,   80,   65,   37,   80,   72
  14911. ,    3,   35,   36,   37,   65,   66,   68,   74,   76,   67
  14912. ,   71,   80,   43,   65,   88,   50,   80,   88,    8,   16
  14913. ,   17,   71,   47,   50,   72,   72,   80,   65,   80,   80
  14914. ,   43,   75,   80,    3,   35,   36,   71,   74,   76,   37
  14915. ,   65,   66,   67,   68,   18,   80,   65,   80,   65,    3
  14916. ,   35,   36,   37,   66,   67,   68,   71,   74,   76,   19
  14917. ,   20,   12,   35,   36,   37,   40,   65,   66,   67,   68
  14918. ,   71,   74,   76,    3,   80,    3,   35,   36,   37,   65
  14919. ,   66,   67,   68,   74,   76,   71,   70,   71,   77,   19
  14920. ,   39,   15,    4,   57,   39,   19,   71,   37,   74,    3
  14921. ,   35,   36,   65,   66,   67,   68,   71,   76,   30,   21
  14922. ,   80,   65,   85,   77,   34,   43,   21,   65,   68,   67
  14923. ,   72,   47,   70,   71,   77,   65,   72,   75,   21,   43
  14924. ,   65,   31,   80,   65,    7,   30,   36,   39,   47,   49
  14925. ,   70,   72,   73,   77,   78,   79,   81,   82,   83,   86
  14926. ,   87,   89,   90,   91,   34,   64,   69,   71,   74,   75
  14927. ,   76,   70,   77,   47,   71,   72,   35,   36,   37,   65
  14928. ,   67,   68,   74,   76,    3,   66,   71,   88,    8,   65
  14929. ,   80,   71,   65,   67,   68,   31,   65,   67,   68,   72
  14930. ,   80,   80,   65,   66,   67,   68,   71,   74,    3,   35
  14931. ,   36,   37,   76,   21,   80,   85,   61,   85,   80,   10
  14932. ,   65,   67,   68,   92,    2,    4,   12,   14,   15,   19
  14933. ,   21,   24,   25,   28,   29,   33,   37,   39,   43,   46
  14934. ,   51,   53,   62,   43,   21,   80,   80,   65,   66,   67
  14935. ,   68,   71,   76,    3,   35,   36,   37,   52,   74,   33
  14936. ,   21,   80,   84,   85,   37,   66,   68,   71,   74,   76
  14937. ,    3,   35,   36,   65,   67,   21,   48,    9,   70,   77
  14938. ,   71,   75,   72,    3,   36,   37,   67,   68,   71,   94
  14939. ,   35,   65,   66,   74,   76,   72,   75,   65,   68,   48
  14940. ,   65,   12,   43,   88,    8,   32,   44,   47,   71,    5
  14941. ,   16,   17,   35,   71,   72,   80,   80,   80,   77,   80
  14942. ,   35,   36,   37,   68,   71,   74,    3,   65,   66,   67
  14943. ,   76,   88,   70,   77,   80,   71,   16,   44,   47,   71
  14944. ,    5,    8,   17,   32,   70,   77,   71,   71,   80,   72
  14945. ,   58,   29,   85,   84,   21,   15,   43,   53,    4,   57
  14946. ,   61,   15,   43,   35,   36,   37,   68,   74,   76,    3
  14947. ,   65,   66,   67,   71,   65,   33,   65,   80,   48,   80
  14948. ,    3,   37,   74,   76,   35,   36,   65,   66,   67,   68
  14949. ,   71,   43,   38,   67,   68,   65,   35,   36,   37,   65
  14950. ,   66,   67,   68,   71,    3,   74,   76,   79,   65,   31
  14951. ,   44,   80,   65,   88,   80,   80,   65,   80,    4,   51
  14952. ,   53,   62,   65,   67,   68,    2,   10,   12,   14,   15
  14953. ,   19,   21,   24,   25,   28,   29,   33,   37,   39,   46
  14954. ,   92,   53,   21,   80,   80,   65,   80,   47,   65,   70
  14955. ,   47,   71,   77,   65,   12,   21,   43,   61,   65,   43
  14956. ,   21,   43,   80,   80,   80,   53,   80,   80,   94,   88
  14957. ,   12,   61,   72,   80,   72,   80,   80,   80,   80,   37
  14958. ,   37,   21,   61)  ;
  14959.         --| Action_Token_Map is an array that
  14960.         --| maps from each state (using action index map) to a set of
  14961.         --| action tokens. An action token is a terminal symbol
  14962.         --| (except EOF_Token) for which in the given state an
  14963.         --| explicit (non-default) shift or reduce action
  14964.         --| is defined.
  14965.         --| Used to cut reduce the
  14966.         --| number of primary recovery candidates.
  14967.     
  14968.     ------------------------------------------------------------------
  14969.     -- Shift_State_Map
  14970.     ------------------------------------------------------------------
  14971.     
  14972.     type Shift_State_Index_Array is array(
  14973.         PositiveParserInteger range <>) of GC.ParserInteger;
  14974.        --| For indexing the All Action Token Array.
  14975.        --| Maps a given state into the lower and upper bounds of a slice
  14976.        --| of the All Action Index Array.
  14977.  
  14978.     Shift_State_MapIndex : constant Shift_State_Index_Array :=
  14979.          (    1,    1,    2,    2,    3,    3,    4,    4,    5,    5
  14980. ,    6,    6,    7,    9,   10,   11,   12,   14,   15,   15
  14981. ,   16,   19,   20,   23,   24,   24,   25,   25,   26,   26
  14982. ,   27,   29,   30,   32,   33,   33,   34,   36,   37,   37
  14983. ,   38,   55,   56,   56,   57,   58,   59,   59,   60,   61
  14984. ,   62,   63,   64,   64,   65,   65,   66,   67,   68,   71
  14985. ,   72,   91,   92,   94,   95,   97,   98,   99,  100,  102
  14986. ,  103,  104,  105,  106,  107,  108,  109,  112,  113,  115
  14987. ,  116,  117,  118,  123,  124,  125,  126,  132,  133,  133
  14988. ,  134,  134,  135,  139,  140,  144,  145,  145,  146,  149
  14989. ,  150,  152,  153,  153,  154,  157,  158,  161,  162,  162
  14990. ,  163,  165,  166,  166,  167,  170,  171,  173,  174,  176
  14991. ,  177,  181,  182,  182,  183,  184,  185,  186,  187,  215
  14992. ,  216,  216,  217,  221,  222,  224,  225,  225,  226,  229
  14993. ,  230,  245,  246,  261,  262,  262,  263,  264,  265,  277
  14994. ,  278,  279,  280,  281,  282,  282,  283,  288,  289,  382
  14995. ,  383,  383,  384,  384,  385,  385,  386,  388,  389,  397
  14996. ,  398,  401,  402,  402,  403,  405,  406,  406,  407,  407
  14997. ,  408,  408,  409,  409,  410,  410,  411,  416,  417,  416
  14998. ,  417,  416,  417,  416,  417,  417,  418,  422,  423,  426
  14999. ,  427,  427,  428,  428,  429,  429,  430,  432,  433,  435
  15000. ,  436,  437,  438,  440,  441,  443,  444,  444,  445,  445
  15001. ,  446,  446,  447,  447,  448,  448,  449,  449,  450,  454
  15002. ,  455,  462,  463,  470,  471,  472,  473,  475,  476,  477
  15003. ,  478,  493,  494,  495,  496,  496,  497,  497,  498,  498
  15004. ,  499,  499,  500,  500,  501,  502,  503,  510,  511,  513
  15005. ,  514,  515,  516,  525,  526,  526,  527,  527,  528,  528
  15006. ,  529,  530,  531,  531,  532,  533,  534,  534,  535,  542
  15007. ,  543,  543,  544,  544,  545,  551,  552,  553,  554,  555
  15008. ,  556,  562,  563,  580,  581,  582,  583,  583,  584,  584
  15009. ,  585,  585,  586,  587,  588,  588,  589,  589,  590,  591
  15010. ,  592,  592,  593,  593,  594,  608,  609,  613,  614,  614
  15011. ,  615,  616,  617,  618,  619,  619,  620,  622,  623,  638
  15012. ,  639,  639,  640,  640,  641,  641,  642,  642,  643,  643
  15013. ,  644,  645,  646,  646,  647,  647,  648,  648,  649,  649
  15014. ,  650,  651,  652,  652,  653,  655,  656,  656,  657,  658
  15015. ,  659,  660,  661,  662,  663,  663,  664,  664,  665,  666
  15016. ,  667,  669,  670,  670,  671,  672,  673,  673,  674,  675
  15017. ,  676,  677,  678,  678,  679,  679,  680,  680,  681,  682
  15018. ,  683,  683,  684,  684,  685,  685,  686,  690,  691,  691
  15019. ,  692,  695,  696,  699,  700,  702,  703,  705,  706,  706
  15020. ,  707,  709,  710,  711,  712,  722,  723,  723,  724,  724
  15021. ,  725,  725,  726,  726,  727,  727,  728,  728,  729,  729
  15022. ,  730,  730,  731,  731,  732,  734,  735,  737,  738,  738
  15023. ,  739,  740,  741,  741,  742,  744,  745,  745,  746,  746
  15024. ,  747,  747,  748,  748,  749,  749,  750,  750,  751,  751
  15025. ,  752,  762,  763,  770,  771,  773,  774,  775,  776,  787
  15026. ,  788,  789,  790,  791,  792,  793,  794,  794,  795,  795
  15027. ,  796,  796,  797,  797,  798,  798,  799,  799,  800,  800
  15028. ,  801,  802,  803,  803,  804,  804,  805,  805,  806,  806
  15029. ,  807,  808,  809,  809,  810,  810,  811,  811,  812,  813
  15030. ,  814,  814,  815,  815,  816,  816,  817,  819,  820,  821
  15031. ,  822,  822,  823,  823,  824,  825,  826,  831,  832,  832
  15032. ,  833,  833,  834,  834,  835,  836,  837,  837,  838,  838
  15033. ,  839,  840,  841,  852,  853,  853,  854,  855,  856,  859
  15034. ,  860,  860,  861,  861,  862,  862,  863,  863,  864,  864
  15035. ,  865,  871,  872,  882,  883,  889,  890,  895,  896,  897
  15036. ,  898,  898,  899,  900,  901,  901,  902,  902,  903,  904
  15037. ,  905,  905,  906,  907,  908,  908,  909,  909,  910,  910
  15038. ,  911,  912,  913,  913,  914,  914,  915,  916,  917,  917
  15039. ,  918,  918,  919,  919,  920,  920,  921,  921,  922,  922
  15040. ,  923,  923,  924,  924,  925,  925,  926,  926,  927,  927
  15041. ,  928,  928,  929,  930,  931,  931,  932,  932,  933,  934
  15042. ,  935,  935,  936,  937,  938,  938,  939,  939,  940,  942
  15043. ,  943,  943,  944,  944,  945,  945,  946,  947,  948,  949
  15044. ,  950,  950,  951,  951,  952,  952,  953,  953,  954,  954
  15045. ,  955,  956,  957,  957,  958,  958,  959,  959,  960,  960
  15046. ,  961,  961,  962,  962,  963,  963,  964,  964,  965,  965
  15047. ,  966,  966,  967,  967,  968,  969,  970,  970,  971,  972
  15048. ,  973,  973,  974,  975,  976,  976,  977,  977,  978,  978
  15049. ,  979,  979,  980,  981,  982,  982,  983,  985,  986,  989
  15050. ,  990,  992,  993,  993,  994,  994,  995,  995,  996,  997
  15051. ,  998,  998,  999,  999, 1000, 1000, 1001, 1001, 1002, 1002
  15052. , 1003, 1004, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1009
  15053. , 1010, 1010, 1011, 1011, 1012, 1013, 1014, 1014, 1015, 1015
  15054. , 1016, 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021
  15055. , 1022, 1022, 1023, 1023, 1024, 1024, 1025, 1025, 1026, 1026
  15056. , 1027, 1027, 1028, 1028, 1029, 1029, 1030, 1030, 1031, 1031
  15057. , 1032, 1033, 1034, 1035, 1036, 1036, 1037, 1037, 1038, 1038
  15058. , 1039, 1039)  ;
  15059.     
  15060.     Shift_State_Map : constant Shift_State_Array :=
  15061.          (    1,  501,   37,  502,  553,  277,  151,  154,  157,  554
  15062. ,  821,  543,  789,  937,  188,   78,  233,  401,  402,  515
  15063. ,  843,  948, 1026,  710,  653,  503,  269,  555,  590,  270
  15064. ,  556,  591,  833,  288,  295,  838,  839,  224,  231,  437
  15065. ,  441,  442,  539,  735,  744,  867,  875,  886,  911,  922
  15066. ,  930,  935,  971, 1004, 1013,  438,  418,  711,  516,  196
  15067. ,  648,   13,   98,   14,  504,  517,  968,  132,  263,  456
  15068. ,  866,   83,  174,  180,  234,  304,  352,  405,  427,  429
  15069. ,  431,  450,  452,  454,  551,  616,  617,  737,  891,  904
  15070. ,  994,  557,  592,  953,  649,  929,  977,  163,  873,   38
  15071. ,  186,  558,   39,  133,   40,  505,  799,  983,  152,  155
  15072. ,  158,  857,  121,  779,  844,  469,  603,   15,   99,  107
  15073. ,  197,  317,  483,    2,  194,  225,  559,  593,  683,  717
  15074. ,  954,  995,   16,  506,  144,  271,  594,  880, 1011,  667
  15075. ,  700,  936,  945,  980,  164,  340,  426,  818,  823,  175
  15076. ,  528,  610,  927,  518,  974, 1003, 1022,   17,  493,  727
  15077. ,  728,  198,  100,  199,  318,  751,  285,  294,  742,  967
  15078. ,  200,  239,  333,  201,  423,  425,  632,  656,  739,  745
  15079. ,  752,  650,   35,  240,  153,  156,    9,   41,   75,   79
  15080. ,  112,  116,  122,  191,  229,  241,  272,  278,  309,  327
  15081. ,  328,  332,  335,  353,  364,  365,  383,  459,  494,  530
  15082. ,  583,  686,  773,  810,  990,   42,   43,   76,  192,  279
  15083. ,  310,   44,  280,  687,  159,  145,  248,  424,  646,   11
  15084. ,   45,   82,  146,  176,  184,  247,  302,  305,  421,  544
  15085. ,  560,  595,  673,  679,  901,  111,  131,  253,  258,  381
  15086. ,  460,  471,  478,  612,  613,  664,  824,  878,  884,  939
  15087. ,  942,  165,   46,  160,  149,  254,  259,  284,  358,  377
  15088. ,  458,  479,  579,  829,  885,  940,  943,   47,  161,  147
  15089. ,  249,  166,  355,  391,  589,  645,  702,  987,   12,   84
  15090. ,   90,  185,  237,  238,  262,  303,  306,  326,  348,  359
  15091. ,  422,  430,  432,  449,  451,  472,  552,  580,  581,  602
  15092. ,  614,  619,  625,  626,  633,  643,  669,  670,  671,  672
  15093. ,  685,  690,  691,  692,  693,  694,  695,  696,  705,  709
  15094. ,  720,  723,  725,  726,  733,  734,  736,  740,  769,  771
  15095. ,  787,  788,  800,  807,  814,  819,  827,  828,  830,  834
  15096. ,  836,  849,  869,  892,  900,  908,  909,  914,  925,  926
  15097. ,  931,  958,  959,  961,  963,  979,  981,  996,  999, 1000
  15098. , 1002, 1005, 1006, 1008, 1017, 1019, 1021, 1023, 1024, 1034
  15099. , 1035, 1036,  134,  135,  136,  250,  372,  932,  251,  252
  15100. ,  373,  399,  871,  915,  918,  933,  969,  137,  255,  379
  15101. ,  380,  168,  604,  772,  815,  138,  139,  140,  406,  620
  15102. ,  600,  715,  716,  718,  719,  941,    3,   48,  276,  361
  15103. ,  542,  794,  195,  407,  657, 1014,  202,  203,  204,   18
  15104. ,  205,  484,   19,  206,  485,  207,  486,   20,  208,  487
  15105. ,   21,  209,  488,  210,  443,  444,  445,  446,  447,  242
  15106. ,  300,  448,  577,  946,  549,  678,  712,  801,  816,  883
  15107. , 1010, 1012,  605,  609,  820,  897,  952,  962,  998, 1025
  15108. ,  713,  817,  561,  822,  898,  902,  960,   49,  123,  311
  15109. ,  366,  367,  368,  374,  464,  631,  635,  644,  666,  722
  15110. ,  831,  865,  896,  243,  606,  357,  211,  212,  213,  336
  15111. ,  562,  955,  177,  182,  433,  453,  706,  731,  956,  965
  15112. ,  578,  599,  893,  703,  721,  473,  477,  808,  825,  894
  15113. ,  906,  957,  966, 1032, 1033,  563,  564,  565,  566,  596
  15114. ,  567,  568,  597,  569,  117,  389,  457,  470,  550,  714
  15115. ,  826,  890,  674,  118,  148,  256,  570,  675,  697,  881
  15116. , 1009,  571,  676,  572,  677,  183,  299,  316,  337,  684
  15117. ,  724,  806,   50,  124,  264,  265,  267,  268,  286,  371
  15118. ,  462,  467,  468,  547,  629,  665,  681,  682,  934,  982
  15119. ,  688,  944,  802,  689,  573,  698,  699,  574,  575,  795
  15120. ,  984,  879,  680,   51,  125,  171,  329,  436,  531,  601
  15121. ,  622,  753,  796,  811,  876,  903,  905,  985,  797,  812
  15122. ,  928,  975,  986,  882,  266,  798,  545,  576,  701,  803
  15123. , 1037, 1038,   91,  114,  339,  341,  360,  403,  584,  588
  15124. ,  618,  708,  791,  804,  889,  938,  988,  991,  887,  947
  15125. ,  989,  888,  949,  507,  805,  950,  992, 1015, 1027, 1016
  15126. , 1039, 1028,  126,  463,  845,   87,   92,  187,   88,   95
  15127. ,  319,  489,  404,  214,  215,  585,  216,  246,  490,  491
  15128. ,  101,  320,  321,   22,  102,   23,  103,  104,   52,   53
  15129. ,   54,  330,  281,  273,  127,   55,  274,  362,  546,  864
  15130. ,  128,  260,  378,  607,  608,  129,  369,  375,  466,  261
  15131. ,  461,  465,  130,  370,  376,   56,   57,  282,  384,  150
  15132. ,  382,   58,  287,  289,  290,  291,  292,  293,  385,  386
  15133. ,  387,  388,   59,   60,   61,   62,   63,  141,  142,   64
  15134. ,   65,   66,  173,  296,   67,  172,  298,  169,   68,  297
  15135. ,   69,   70,  275,  363,   71,   72,  143,  162,   73,  167
  15136. ,  170,  119,  308,  390,  400,  434,  548,  624,  627,  634
  15137. ,  780,  899,  323,  495,  641,  729,  852,  856,  921,  923
  15138. ,  408,  621,  919,  496,  970,  324,  628,  743,  775,  785
  15139. ,  786,  846,  848,  868,  912,  913,  920,  409,  497,  410
  15140. ,  498,  411,  499,  412,  413,  414,  519,  415,  529,  508
  15141. ,  509,  754,  510,  511,  520,  521,  512,  755,  522,  416
  15142. ,  532,  533,  756,  534,  535,  536,  647,  770,  851,  417
  15143. ,  500,  636,  741,  840,  862,  637,  738,  774,  837,  850
  15144. ,  910,  523,  639,  746,  747,  917,  748,  537,  651,  776
  15145. ,  230,  345,  349,  351,  582,  586,  587,  777,  835,  870
  15146. ,  976, 1007,  652,  189,  654,   89,   96,  235,  778,  190
  15147. ,  325,  419,  538,  655,   24,  105,  108,  217,  322,  354
  15148. ,  492,   80,   81,  179,  236,  331,  334,  350,  428,  481
  15149. ,  482,  623,  301,  307,  611,  813,  832,  997, 1001,  394
  15150. ,  397,  895,  907, 1018, 1020,   77,  232,  392,  356,  393
  15151. ,   25,  193,   26,  109,   27,   93,  346,  226,   28,   97
  15152. ,  338,  704,  435,  218,  342,  344,  219,  106,  707,  439
  15153. ,  732,  513,  514,  630,  524,  525,  526,  527,  642,  924
  15154. ,  768,  757,  758,  861,  759,  760,  972,  761,  762,  853
  15155. ,  855,  860,  763,  764,  765,  841,  858,  859,  863,  973
  15156. ,  766,  730,    4,    5,    6,   10,    7,   29,   30,    8
  15157. ,  113,  245,   36,   31,  658,  782,  659,  660,  783,  661
  15158. ,  662,  784,  663,  781,  978,   32,   33,  110,  244,  598
  15159. ,  964,  455,   85,  178,  181,  312,  395,  396,  615,  398
  15160. ,  475,  476,   86,  313,  314,  315,  480,  220,  221,  222
  15161. ,  223,  668,  792,  874,  790,  877,  993,  540,  640,  809
  15162. , 1031,  257,  916,   94,  227,   74,  283,  120,  638,  842
  15163. ,  847,  420,  541,  474,  343,  440,  854,  115,  872,  793
  15164. ,  951,  749, 1029,  750, 1030,  767,   34,  228,  347)  ;
  15165.         --| Shift_State_ is an array that
  15166.         --| maps from non-terminals (using shift index map) to sets
  15167.         --| of states in which
  15168.         --| a shift to the non-terminal is defined.
  15169.         --| Used to determine the number of trials in primary
  15170.         --| error recovery.
  15171.  
  15172.     ------------------------------------------------------------------
  15173.     -- Subprogram Bodies Global to Package ErrorParseTables
  15174.     ------------------------------------------------------------------
  15175.  
  15176.     function Get_Action_Token_Map ( --| return the array of action tokens
  15177.                     --| for the state passed in.
  15178.         In_Index : in StateRange
  15179.                     --| the state to return action tokens
  15180.                     --| for.
  15181.         )
  15182.         return Action_Token_Record
  15183.         is
  15184.         --| Returns
  15185.         --| This subprogram returns the action token record for the
  15186.         --| state passed in.
  15187.         Result : Action_Token_Record ;
  15188.         LowerBound, UpperBound : GC.ParserInteger ;
  15189.         --| Lower and upper bounds of the slice of Action Token Map
  15190.     begin
  15191.         LowerBound := Action_Token_MapIndex ( In_Index*2 - 1 ) ;
  15192.         UpperBound := Action_Token_MapIndex ( In_Index*2 ) ;
  15193.  
  15194.         Result.set_size := UpperBound - LowerBound + 1;
  15195.         Result.set := (others => DefaultValue) ;
  15196.         Result.set(Result.set'first .. Result.set_size) :=
  15197.         Action_Token_Map(LowerBound..UpperBound) ;
  15198.       
  15199.         return Result ;
  15200.     end Get_Action_Token_Map ;
  15201.  
  15202.     ------------------------------------------------------------------
  15203.  
  15204.     function Get_Shift_State_Map (  --| return the array of shift states
  15205.                     --| for the grammar symbol passed in.
  15206.         In_Index : in GrammarSymbolRange
  15207.                     --| the grammar symbol to return shifts
  15208.                     --| for.
  15209.         )
  15210.         --| Raises: This subprogram raises no exceptions.
  15211.         return Shift_State_Record
  15212.         --| Returns
  15213.         --| This subprogram returns the array of shift states for the
  15214.         --| grammar symbol passed in.
  15215.         is
  15216.         
  15217.         Result : Shift_State_Record ;
  15218.         LowerBound, UpperBound : GC.ParserInteger ;
  15219.           --| Lower and upper bounds of the slice of Shift State Map
  15220.     begin
  15221.         LowerBound := Shift_State_MapIndex ( In_Index*2 - 1 ) ;
  15222.         UpperBound := Shift_State_MapIndex ( In_Index*2 ) ;
  15223.     
  15224.         Result.set_size := UpperBound - LowerBound + 1;
  15225.         Result.set := (others => DefaultValue) ;
  15226.         Result.set(Result.set'first .. Result.set_size) :=
  15227.             Shift_State_Map(LowerBound..UpperBound) ;
  15228.       
  15229.         return Result ;
  15230.     end Get_Shift_State_Map ;
  15231.  
  15232.     function Get_Grammar_Symbol (   --| return the string representation
  15233.                     --| of the grammar symbol
  15234.         In_Index : in GrammarSymbolRange
  15235.         )
  15236.         return string
  15237.         is
  15238.         LowerBound, UpperBound : GC.ParserInteger ;
  15239.       --| Lower and upper bounds of the slice of Shift State Map
  15240.     begin
  15241.         LowerBound := GrammarSymbolTableIndex ( In_Index*2 - 1 ) ;
  15242.         UpperBound := GrammarSymbolTableIndex ( In_Index*2 ) ;
  15243.  
  15244.         return GrammarSymbolTable(
  15245.             Integer(LowerBound) .. Integer(UpperBound)) ;
  15246.     end Get_Grammar_Symbol ;
  15247.  
  15248.     ------------------------------------------------------------------
  15249.  
  15250.     function Get_Follow_Map (       --| return the array of follow symbols
  15251.                     --| of the grammar symbol passed in
  15252.         In_Index : in FollowMapRange
  15253.         )
  15254.         -- |
  15255.         -- |Raises: This subprogram raises no exceptions.
  15256.         -- |
  15257.     
  15258.       return FollowSymbolRecord
  15259.       is
  15260.         Result : FollowSymbolRecord ;
  15261.         LowerBound, UpperBound : GC.ParserInteger ;
  15262.         Adjusted_Index : GC.ParserInteger :=
  15263.           (In_Index - FollowMapRange'first) + 1;
  15264.     begin
  15265.         LowerBound := FollowSymbolMapIndex ( Adjusted_Index*2 - 1 ) ;
  15266.         UpperBound := FollowSymbolMapIndex ( Adjusted_Index*2 ) ;
  15267.     
  15268.         Result.follow_symbol_count := UpperBound - LowerBound + 1;
  15269.         Result.follow_symbol := (others => DefaultValue) ;
  15270.         Result.follow_symbol(
  15271.           Result.follow_symbol'first ..
  15272.           Result.follow_symbol_count) :=
  15273.             FollowSymbolMap(LowerBound..UpperBound) ;
  15274.           
  15275.         return Result ;
  15276.     end Get_Follow_Map ;
  15277.  
  15278.     ------------------------------------------------------------------
  15279.  
  15280.     function GetAction (            -- see subprogram declaration
  15281.       InStateValue  : in StateRange;
  15282.       InSymbolValue : in GrammarSymbolRange
  15283.       )
  15284.       return ActionRange
  15285.       is
  15286.         
  15287.         Unique : GC.ParserInteger;
  15288.             --| unique value to hash for Index.
  15289.         Index  : GC.ParserInteger;
  15290.             --| index into Action Tables.
  15291.         Action : GC.ParserInteger;
  15292.             --| value from Action Tables.
  15293.         CollisionCount : Natural := 0 ; --| Number of collisions.
  15294.     begin -- GetAction function
  15295.     --| Algorithm
  15296.     --|-
  15297.     --| Definitions of key objects from package ParseTables:
  15298.     --|
  15299.     --| ActionCount: the number of actions in the action tables.
  15300.     --|
  15301.     --| ActionTableOne: table of action values for all combinations of
  15302.     --|     states and input actions.
  15303.     --|
  15304.     --| ActionTableTwo: hash values to check against to verify that action
  15305.     --|     value at same index in ActionTableOne is correct one.
  15306.     --|
  15307.     --| ActionTableSize: last index in ActionTableOne and ActionTableTwo
  15308.     --|     before the hash collision chains.
  15309.     --|
  15310.     --| DefaultMap: default action for each state.
  15311.     --|+
  15312.     --| The action to be returned is computed from parameters InStateValue
  15313.     --| and InSymbolValue. First, determine the unique single value:
  15314.     --|
  15315.     --|     Unique := (InStateValue * GrammarSymbolCountPlusOne) +
  15316.     --|                InSymbolValue;
  15317.     --|
  15318.     --| Unique is hashed by reducing modulo ActionTableSize and adding 1:
  15319.     --|
  15320.     --|     Index := (Unique mod ActionTableSize) + 1;
  15321.     --|
  15322.     --| This hash value, Index, is used to index ActionTableOne to
  15323.     --| obtain an Action:
  15324.     --|
  15325.     --|     Action := ActionTableOne(Index);
  15326.     --|
  15327.     --| Action is then used to determine the return value:
  15328.     --|
  15329.     --| Action = 0:
  15330.     --|     return DefaultMap(InStateValue);
  15331.     --|
  15332.     --| Action < ActionCount:
  15333.     --|     if (Unique = ActionTableTwo(Index)) then
  15334.     --|         return Action;
  15335.     --|     else
  15336.     --|         return DefaultMap(InStateValue);
  15337.     --|     end if;
  15338.     --|
  15339.     --| Action >= ActionCount:
  15340.     --|     --Search the hash collision chain
  15341.     --|     Index := Action - ActionCount;
  15342.     --|     while (Action /= 0) loop
  15343.     --|         Index := Index + 1;
  15344.     --|         Action := ActionTableTwo(Index);
  15345.     --|         if (Action = Unique) then
  15346.     --|             return ActionTableOne(Index);
  15347.     --|         end if;
  15348.     --|     end loop;
  15349.     --|     return DefaultMap(InStateValue);
  15350.  
  15351.     ------------------------------------------------------------------
  15352.  
  15353.   --| The actual code used folds this algorithm into a more efficient one:
  15354.         ParserDecisionCount := Natural'succ(ParserDecisionCount) ;
  15355.                                                                     
  15356.         Unique := (InStateValue * GrammarSymbolCountPlusOne) +          
  15357.                         InSymbolValue;                                  
  15358.         Index := (Unique mod ActionTableSize) + 1;                      
  15359.         Action := ActionTableOne(Index);                                
  15360.                                                                         
  15361.         if (Action >= ActionCount) then                                 
  15362.             Index := Action - ActionCount + 1;                          
  15363.             while ( (ActionTableTwo(Index) /= Unique) and then          
  15364.                     (ActionTableTwo(Index) /= 0) ) loop                 
  15365.                 Index := Index + 1;
  15366.             CollisionCount := Natural'succ(CollisionCount) ;
  15367.             end loop;                                                   
  15368.             Action := ActionTableOne(Index);                            
  15369.         end if;
  15370.         
  15371.         -- Collect statistics information.
  15372.         TotalCollisions := CollisionCount + TotalCollisions ;
  15373.         if CollisionCount > MaxCollisions then
  15374.             MaxCollisions := CollisionCount ;
  15375.         end if;
  15376.                                                                         
  15377.         if (ActionTableTwo(Index) /= Unique) then                       
  15378.             return DefaultMap(InStateValue);                            
  15379.         else                                                            
  15380.             return Action;                                              
  15381.         end if;                                                         
  15382.     
  15383.     end GetAction; -- function
  15384.  
  15385.     function Get_LeftHandSide(
  15386.       GrammarRule : in LeftHandSideRange
  15387.       ) return GrammarSymbolRange is
  15388.     begin
  15389.         return LeftHandSide(GrammarRule) ;
  15390.     end Get_LeftHandSide ;
  15391.     
  15392.     function Get_RightHandSide(
  15393.       GrammarRule : in RightHandSideRange
  15394.       ) return GC.ParserInteger is
  15395.     begin
  15396.         return RightHandSide(GrammarRule) ;
  15397.     end Get_RightHandSide ;
  15398.     
  15399. end ParseTables;
  15400.  
  15401. ----------------------------------------------------------------------
  15402. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15403. --grmconst.bdy
  15404. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15405. --+ GRMCONST.BDY +--
  15406.  
  15407. Package body Grammar_Constants is
  15408.  
  15409.     function setGrammarSymbolCount return ParserInteger is
  15410.     begin
  15411.         return   396 ;
  15412.     end setGrammarSymbolCount;
  15413.     
  15414.     function setActionCount return ParserInteger is
  15415.     begin
  15416.         return  1598 ;
  15417.     end setActionCount;
  15418.     
  15419.     function setStateCountPlusOne return ParserInteger is
  15420.     begin
  15421.         return  1040 ;
  15422.     end setStateCountPlusOne;
  15423.     
  15424.     function setLeftHandSideCount return ParserInteger is
  15425.     begin
  15426.     return   556 ;
  15427.     end setLeftHandSideCount;
  15428.     
  15429.     function setRightHandSideCount return ParserInteger is
  15430.     begin
  15431.         return   556 ;
  15432.     end setRightHandSideCount;
  15433.     
  15434. end Grammar_Constants;
  15435.  
  15436. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15437. --sidecls.dat
  15438. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15439.  
  15440. with ParseTables;
  15441. with Simple_Paginated_Output;
  15442. with LISTS;
  15443. with STRING_PKG;
  15444.  
  15445. package Source_Instrumenter_Declarations is
  15446. --| Declarations for Source Instrumenter tool
  15447.  
  15448. --| Overview
  15449.  
  15450. --| This package contains declarations for the Source Instrumenter.
  15451.  
  15452. --| Notes
  15453.  
  15454. --| Abbreviations Used:
  15455. --|
  15456. --| RH: Right Hand
  15457.  
  15458.     ----------------------------------------------------------------
  15459.     --  File Declarations
  15460.     ----------------------------------------------------------------
  15461.  
  15462.     Instrumented_File : Simple_Paginated_Output.Paginated_File_Handle;
  15463.     --| File handle to pass to Paginated Output routines for
  15464.     --| Instrumented source
  15465.  
  15466.     Listing_File: Simple_Paginated_Output.Paginated_File_Handle;
  15467.     --| File handle for listing file
  15468.  
  15469.     ----------------------------------------------------------------
  15470.     -- Declarations to parameterize Printing
  15471.     ----------------------------------------------------------------
  15472.  
  15473.     type Delimiter_Name is (Basic,     --| %, :, !
  15474.                             Extended); --| ", #, |
  15475.     Delimiters : Delimiter_Name := Extended;
  15476.     --| Determines whether to use the Basic or Extended character set for
  15477.     --| output.
  15478.  
  15479.     Max_Columns : constant := 133;
  15480.     subtype Column_Range is Positive range Positive'First .. Max_Columns;
  15481.     Page_Width : Column_Range := 74;
  15482.     --| Width of output page
  15483.  
  15484.     RH_Margin : Column_Range := 60;
  15485.     --| The column beyond which no indenting is performed.
  15486.  
  15487.     subtype Indentation_Range is
  15488.         Natural range 0 .. RH_Margin;
  15489.     Indentation_Level : Indentation_Range := 2;
  15490.     --| Indentation Level for all constructs
  15491.  
  15492.     prefix: constant string := "tbx7_";
  15493.  
  15494.  
  15495.     package STRING_LISTS is
  15496.       new LISTS (STRING_PKG.STRING_TYPE);
  15497.  
  15498.     subtype STRING_LIST is STRING_LISTS.LIST;
  15499.  
  15500.     type Spacing is
  15501.         (After, Before, Around, None);
  15502.  
  15503.     Spacing_Table : Array(1 .. ParseTables.Comment_TokenValue) of Spacing := (
  15504.     -- unfortunately, type of ParseTables.xxxTokenValue has non-static bound,
  15505.     -- so positional rather than named associations must be used to initialize
  15506.     -- Spacing_Table.
  15507.  
  15508.     -- The spacing table determines, in general, how to space each token.
  15509.     -- However, the spacing of some tokens is context dependent, and so
  15510.     -- some of the spacing is dynamically handled in other places.  
  15511.     -- Spaced_Token refers to Pretty_Printer_Utilities.Spaced_Token.
  15512.     -- The special cases are described below.
  15513.  
  15514.      -- ParseTables.Empty_TokenValue =>
  15515.         None,
  15516.      -- ParseTables.AbortTokenValue => 
  15517.         After,
  15518.      -- ParseTables.AbsTokenValue =>  -- Spaced_Token inserts space after
  15519.         None,                         -- unless followed by '('
  15520.      -- ParseTables.AcceptTokenValue => 
  15521.         After,
  15522.      -- ParseTables.AccessTokenValue => 
  15523.         After,
  15524.      -- ParseTables.AllTokenValue => 
  15525.         None,
  15526.      -- ParseTables.AndTokenValue => 
  15527.         Around,
  15528.      -- ParseTables.ArrayTokenValue => 
  15529.         None, 
  15530.      -- ParseTables.AtTokenValue => 
  15531.         Around,
  15532.      -- ParseTables.BeginTokenValue => 
  15533.         None, 
  15534.      -- ParseTables.BodyTokenValue => 
  15535.         After,
  15536.      -- ParseTables.CaseTokenValue =>  -- Spaced_Token inserts space after if
  15537.         None,                          -- not followed by ';'
  15538.      -- ParseTables.ConstantTokenValue =>  -- Spaced_Token inserts space before
  15539.         After,                             -- if not following ':='
  15540.      -- ParseTables.DeclareTokenValue => 
  15541.         None, 
  15542.      -- ParseTables.DelayTokenValue => 
  15543.         After, 
  15544.      -- ParseTables.DeltaTokenValue =>  -- Spaced_Token inserts space before if
  15545.         None,                           -- not following ''' or 'IS', after if
  15546.                                         -- not followed by ';'
  15547.      -- ParseTables.DigitsTokenValue => -- Spaced_Token inserts space before if
  15548.         None,                           -- not following ''', or 'IS' after if
  15549.                                         -- not followed by ';'
  15550.      -- ParseTables.DoTokenValue => 
  15551.         Before, 
  15552.      -- ParseTables.ElseTokenValue => 
  15553.         After,
  15554.      -- ParseTables.ElsifTokenValue => 
  15555.         After, 
  15556.      -- ParseTables.EndTokenValue =>  -- Spaced_Token inserts space after if
  15557.         None,                         -- not followed by ';'
  15558.      -- ParseTables.EntryTokenValue => 
  15559.         After, 
  15560.      -- ParseTables.ExceptionTokenValue => 
  15561.         None,
  15562.      -- ParseTables.ExitTokenValue =>  -- Spaced_Token inserts space after if
  15563.         None,                          -- not followed by ';' 
  15564.      -- ParseTables.ForTokenValue => 
  15565.         After,
  15566.      -- ParseTables.FunctionTokenValue => 
  15567.         After, 
  15568.      -- ParseTables.GenericTokenValue => 
  15569.         None,
  15570.      -- ParseTables.GotoTokenValue => 
  15571.         After, 
  15572.      -- ParseTables.IfTokenValue =>  -- Spaced_Token inserts space after if 
  15573.         None,                        -- not followed by ';'
  15574.      -- ParseTables.InTokenValue =>  -- Spaced_Token inserts space before if
  15575.         After,                       -- not following ':'
  15576.      -- ParseTables.IsTokenValue => 
  15577.         Around,
  15578.      -- ParseTables.LimitedTokenValue => 
  15579.         After, 
  15580.      -- ParseTables.LoopTokenValue =>  -- Spaced_Token inserts space after if 
  15581.         None,                          -- not followed by ';' and space before
  15582.                                        -- if not following ':'
  15583.      -- ParseTables.ModTokenValue =>  -- Spaced_Token inserts space before if
  15584.         After,                        -- not following 'AT'
  15585.      -- ParseTables.NewTokenValue => 
  15586.         After,
  15587.      -- ParseTables.NotTokenValue => 
  15588.         After, 
  15589.      -- ParseTables.NullTokenValue => 
  15590.         None,
  15591.      -- ParseTables.OfTokenValue => 
  15592.         Around, 
  15593.      -- ParseTables.OrTokenValue => 
  15594.         Around,
  15595.      -- ParseTables.OthersTokenValue => 
  15596.         None,    
  15597.      -- ParseTables.OutTokenValue => 
  15598.         After,
  15599.      -- ParseTables.PackageTokenValue => 
  15600.         After, 
  15601.      -- ParseTables.PragmaTokenValue => 
  15602.         After,
  15603.      -- ParseTables.PrivateTokenValue => 
  15604.         None,  
  15605.      -- ParseTables.ProcedureTokenValue => 
  15606.         After,
  15607.      -- ParseTables.RaiseTokenValue =>  -- Spaced_Token inserts space after if
  15608.         None,                           -- not followed by ';'
  15609.      -- ParseTables.RangeTokenValue =>  -- Spaced_Token inserts space before if
  15610.         None,                           -- not following ''' or 'IS', after if
  15611.                                         -- not followed by ';'
  15612.      -- ParseTables.RecordTokenValue =>  -- Spaced_Token inserts space after if
  15613.         None,                            -- not followed by ';'
  15614.      -- ParseTables.RemTokenValue => 
  15615.         Around,
  15616.      -- ParseTables.RenamesTokenValue => 
  15617.         Around, 
  15618.      -- ParseTables.ReturnTokenValue =>  -- Spaced_Token inserts space after if
  15619.         Before,                          -- not followed by ';'
  15620.      -- ParseTables.ReverseTokenValue => 
  15621.         After, 
  15622.      -- ParseTables.SelectTokenValue =>  -- Spaced_Token inserts space after if
  15623.         None,                            -- not followed by ';'
  15624.      -- ParseTables.SeparateTokenValue => 
  15625.         None,
  15626.      -- ParseTables.SubtypeTokenValue => 
  15627.         After,
  15628.      -- ParseTables.TaskTokenValue => 
  15629.         After,
  15630.      -- ParseTables.TerminateTokenValue => 
  15631.         None,
  15632.      -- ParseTables.ThenTokenValue =>  -- Spaced_Token inserts space before if 
  15633.         After,                         -- not preceded by "and"  
  15634.      -- ParseTables.TypeTokenValue => 
  15635.         After, 
  15636.      -- ParseTables.UseTokenValue =>   -- Spaced_Token inserts space before if
  15637.         After,                         -- not preceded by ';'
  15638.      -- ParseTables.WhenTokenValue => 
  15639.         After,
  15640.      -- ParseTables.WhileTokenValue => 
  15641.         After,
  15642.      -- ParseTables.WithTokenValue => 
  15643.         After,
  15644.      -- ParseTables.XorTokenValue => 
  15645.         Around, 
  15646.      -- ParseTables.IdentifierTokenValue => 
  15647.         None,
  15648.      -- ParseTables.NumericTokenValue => 
  15649.         None,
  15650.      -- ParseTables.StringTokenValue => 
  15651.         None,
  15652.      -- ParseTables.CharacterTokenValue => 
  15653.         None,
  15654.      -- ParseTables.Ampersand_TokenValue => 
  15655.         Around,
  15656.      -- ParseTables.Apostrophe_TokenValue => 
  15657.         None,
  15658.      -- ParseTables.LeftParen_TokenValue => 
  15659.         None,
  15660.      -- ParseTables.RightParen_TokenValue => 
  15661.         None,
  15662.      -- ParseTables.Star_TokenValue => 
  15663.         None,
  15664.      -- ParseTables.Plus_TokenValue =>  -- Parser.Apply_Actions inserts space
  15665.         None,                           -- after if it is a binary operator,
  15666.                                         -- before if not following '('
  15667.      -- ParseTables.Comma_TokenValue =>  
  15668.         After,                           
  15669.      -- ParseTables.Minus_TokenValue =>  -- Parser.Apply_Actions inserts space
  15670.         None,                            -- after if it is a binary operator,
  15671.                                          -- before if not following '('
  15672.      -- ParseTables.Dot_TokenValue =>
  15673.         None,
  15674.      -- ParseTables.Slash_TokenValue => 
  15675.         None,
  15676.      -- ParseTables.Colon_TokenValue => 
  15677.         Around,
  15678.      -- ParseTables.SemiColon_TokenValue => 
  15679.         After,
  15680.      -- ParseTables.LT_TokenValue => 
  15681.         Around,
  15682.      -- ParseTables.EQ_TokenValue => 
  15683.         Around,
  15684.      -- ParseTables.GT_TokenValue => 
  15685.         Around,
  15686.      -- ParseTables.Bar_TokenValue => 
  15687.         Around,
  15688.      -- ParseTables.EQGT_TokenValue => 
  15689.         Around,
  15690.      -- ParseTables.DotDot_TokenValue => 
  15691.         Around,
  15692.      -- ParseTables.StarStar_TokenValue => 
  15693.         None,
  15694.      -- ParseTables.ColonEQ_TokenValue => 
  15695.         After,
  15696.      -- ParseTables.SlashEQ_TokenValue => 
  15697.         Around,
  15698.      -- ParseTables.GTEQ_TokenValue => 
  15699.         Around,
  15700.      -- ParseTables.LTEQ_TokenValue => 
  15701.         Around,
  15702.      -- ParseTables.LTLT_TokenValue => 
  15703.         None,
  15704.      -- ParseTables.GTGT_TokenValue => 
  15705.         After,
  15706.      -- ParseTables.LTGT_TokenValue => 
  15707.         None,
  15708.      -- ParseTables.Comment_TokenValue => 
  15709.         None);
  15710.  
  15711. end Source_Instrumenter_Declarations;
  15712. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15713. --ui.spc
  15714. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15715. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS; 
  15716. with LISTS; 
  15717. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; 
  15718. package USER_INTERFACE is 
  15719.  
  15720. --|  Overview
  15721. --|  
  15722. --|  This package performs the user interface function for the source
  15723. --|  instrumenter.  It queries the user for the information neccesary for
  15724. --|  instrumenting a program.  The definitons of possible tracing modes(type and
  15725.  
  15726.   type TRACE_MODES is (ENTRY_EXIT, DECISION_POINT, ALL_STATEMENTS, MIXED); 
  15727.    --|  The possible trace modes.  Mixed mode means that the user specifies
  15728.    --|  a trace level for each program unit in a compilation.
  15729.  
  15730.   subtype TRACE_LEVEL is TRACE_MODES range ENTRY_EXIT .. ALL_STATEMENTS; 
  15731.    --|  The possible trace levels for a program unit.  Mixed mode can only
  15732.    --|  be for a compilation unit.  Each program unit must have a trace level
  15733.  
  15734.   subtype UNIT_SPECIFICATION is STRING; 
  15735.    --|  The string containing the specification unit of a unit used for printing
  15736.  
  15737.   procedure GET_INSTRUMENTING_INSTRUCTIONS(TRACING_MODE      : out TRACE_MODES; 
  15738.                                            TYPE_TRACING_MODE : out BOOLEAN); 
  15739.  
  15740. --|  Overview
  15741. --|  
  15742. --|  This unit gets the instrumenting instructions for a compilation unit.  The
  15743. --|  statement trace level and type tracing are both returned.  These are used 
  15744. --|  throughtout the compilation unit.  If the user picks mixed statement
  15745. --|  mode then each program unit in the compilation unit gets its own statement
  15746. --|  trace level.
  15747.  
  15748.   procedure GET_UNIT_INSTRUCTIONS(CURRENT_UNIT         : in UNIT_SPECIFICATION; 
  15749.                                  IS_PACKAGE_SPEC       : in BOOLEAN; 
  15750.                                  REQUESTED_TRACE_LEVEL : out TRACE_LEVEL; 
  15751.                                  SCOPE_NAME            : in STRING; 
  15752.                                  LIST_OF_VARIABLES     : out STRING_LIST); 
  15753.  
  15754. --|  Overview
  15755. --|  
  15756. --|  This procedure will get the instrumenting instructions for an individual
  15757. --|  unit.  This procedure is called only when type tracing is being
  15758. --|  done or statment trace mode is mixed.  In these cases, This unit is
  15759. --|  called to get either the variables to trace, the trace level for the
  15760. --|  unit, or both.
  15761.  
  15762. end USER_INTERFACE; 
  15763. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15764. --ui.bdy
  15765. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15766. with TEXT_IO; use TEXT_IO; 
  15767. with IMPLEMENTATION_DEPENDENCIES; 
  15768. with STRING_PKG; use STRING_PKG; 
  15769.  
  15770. package body USER_INTERFACE is 
  15771.  
  15772. --|  Overview
  15773. --|  
  15774. --|  This package performs the user interface for the source instrumenter.
  15775. --|  The procedures are used to return the statement trace level and 
  15776. --|  variable trace mode for the unit. The first procedure gets the options
  15777. --|  for a compilation unit and the second gets any optins needed for an
  15778. --|  individual program unit.
  15779.  
  15780.   INPUT_LINE      : STRING(1 .. IMPLEMENTATION_DEPENDENCIES.LINE_LENGTH); 
  15781.     --|  Used to hold the users input.
  15782.  
  15783.   LENGTH_OF_INPUT : NATURAL; 
  15784.     --|  The number of characters in the users input
  15785.  
  15786.   TRACE_MODE      : TRACE_MODES := DECISION_POINT; 
  15787.     --|  The tracing level for the compilation unit.  If the tracing mode
  15788.     --|  for the compilation unit is mixed.  Then the user is asked for
  15789.     --|  the tracing mode for each nested unit.
  15790.  
  15791.   DO_TYPE_TRACING : BOOLEAN; 
  15792.     --|  Indicates whether type tracing is being done for the current
  15793.     --|  compilation unit.
  15794.  
  15795.   --------------------------------------------------------------------
  15796.   --  Local Procedure Definitions
  15797.   --------------------------------------------------------------------
  15798.  
  15799.   procedure GET_USER_OPTIONS(TRACING_MODE      : out TRACE_MODES; 
  15800.                              TYPE_TRACING_MODE : out BOOLEAN); 
  15801.     --|  Get user options when he wants to supply his own optins
  15802.  
  15803.   --------------------------------------------------------------------
  15804.  
  15805.   procedure PRINT_INSTRUMENTING_HELP; 
  15806.     --|  Prints an explantion of tracing options
  15807.  
  15808.   --------------------------------------------------------------------
  15809.  
  15810.   procedure PRINT_TRACING_HELP; 
  15811.     --|  Prints an explanation of statement tracing options for a
  15812.     --|  compilation unit.
  15813.  
  15814.   --------------------------------------------------------------------
  15815.  
  15816.   procedure PRINT_UNIT_TRACING_HELP; 
  15817.     --|  Prints an explanation of statement tracing options for a
  15818.     --|  program unit.
  15819.  
  15820.   --------------------------------------------------------------------
  15821.  
  15822.   procedure PRINT_TYPE_HELP; 
  15823.     --|  Prints an explanation of type tracing.
  15824.  
  15825.   --------------------------------------------------------------------
  15826.   --  External Procedures
  15827.   --------------------------------------------------------------------
  15828.  
  15829.   procedure GET_INSTRUMENTING_INSTRUCTIONS(TRACING_MODE      : out TRACE_MODES; 
  15830.                                            TYPE_TRACING_MODE : out BOOLEAN) is 
  15831.  
  15832.   --|  Effects
  15833.   --|  
  15834.   --|  This procedure will get the instrumenting instructions from the user
  15835.   --|  for the current compilation unit.  The variables TRACE_MODE and
  15836.   --|  DO_TYPE_TRACING are set to indeicate the user selected options for
  15837.   --|  the compilation unit.  These options are also returned to the 
  15838.   --|  calling procedure.
  15839.  
  15840.     VALID_INPUT : BOOLEAN := FALSE; 
  15841.       --|  Used to loop until the user supplies a valid input.
  15842.  
  15843.  
  15844.     procedure DISPLAY_OPTIONS is 
  15845.  
  15846.     --|  Effects
  15847.     --|  
  15848.     --|  This procedure will display the menu for selecting trace options
  15849.     --|  for a compilation unit.
  15850.  
  15851.     begin
  15852.       PUT_LINE("Instrumenting Options are:"); 
  15853.       NEW_LINE; 
  15854.       PUT_LINE("1 - Path/Autopath Analyzer Defaults"); 
  15855.       PUT_LINE("2 - Performance Analyzer Defaults"); 
  15856.       PUT_LINE("3 - Self Metric Defaults"); 
  15857.       PUT_LINE("4 - User Supplied Options"); 
  15858.       NEW_LINE; 
  15859.       PUT("Enter option (1, 2, 3, 4, ?, or <cr> for default of 1): "); 
  15860.     end DISPLAY_OPTIONS; 
  15861.  
  15862.  
  15863.   begin     -- GET_INSTRUMENTING_INSTRUCTIONS
  15864.     NEW_LINE; 
  15865.     PUT_LINE("       Source Instrumenter Version 1.0"); 
  15866.     NEW_LINE; 
  15867.     NEW_LINE; 
  15868.     DISPLAY_OPTIONS; 
  15869.  
  15870.  --  Loop until the user provides a valid input.
  15871.  
  15872.     while not VALID_INPUT loop
  15873.       GET_LINE(TEXT_IO.STANDARD_INPUT, INPUT_LINE, LENGTH_OF_INPUT); 
  15874.       if LENGTH_OF_INPUT < 1 then -- no input, use defaults
  15875.         TRACE_MODE := DECISION_POINT; 
  15876.         DO_TYPE_TRACING := FALSE; 
  15877.         VALID_INPUT := TRUE; 
  15878.       else -- determine users input and set appropriate trace modes
  15879.         case INPUT_LINE(1) is 
  15880.           when '1' => 
  15881.             TRACE_MODE := DECISION_POINT; 
  15882.             DO_TYPE_TRACING := FALSE; 
  15883.             VALID_INPUT := TRUE; 
  15884.           when '2' => 
  15885.             TRACE_MODE := ENTRY_EXIT; 
  15886.             DO_TYPE_TRACING := FALSE; 
  15887.             VALID_INPUT := TRUE; 
  15888.           when '3' => 
  15889.             TRACE_MODE := DECISION_POINT; 
  15890.             DO_TYPE_TRACING := TRUE; 
  15891.             VALID_INPUT := TRUE; 
  15892.           when '4' =>   --  user doesn't want defaults, so prompt for input
  15893.             GET_USER_OPTIONS(TRACE_MODE, DO_TYPE_TRACING); 
  15894.             VALID_INPUT := TRUE; 
  15895.           when '?' => 
  15896.             PRINT_INSTRUMENTING_HELP; 
  15897.             DISPLAY_OPTIONS; 
  15898.           when others =>   -- bad input, repeat loop
  15899.             PUT_LINE("Invalid input, try again:  "); 
  15900.             NEW_LINE; 
  15901.             DISPLAY_OPTIONS; 
  15902.         end case; 
  15903.       end if; 
  15904.     end loop; 
  15905.  
  15906. -- Set the TRACING_MODE and TYPE_TRACING_MODE for the compilation unit.
  15907. -- These will be used in determining what to prompt the user for, for
  15908. -- nested unit.
  15909.  
  15910.     TRACING_MODE := TRACE_MODE; 
  15911.     TYPE_TRACING_MODE := DO_TYPE_TRACING; 
  15912.   end GET_INSTRUMENTING_INSTRUCTIONS; 
  15913.  
  15914.   --------------------------------------------------------------------
  15915.  
  15916.   procedure GET_UNIT_INSTRUCTIONS(CURRENT_UNIT         : in UNIT_SPECIFICATION; 
  15917.                                  IS_PACKAGE_SPEC       : in BOOLEAN; 
  15918.                                  REQUESTED_TRACE_LEVEL : out TRACE_LEVEL; 
  15919.                                  SCOPE_NAME            : in STRING; 
  15920.                                  LIST_OF_VARIABLES     : out STRING_LIST) is 
  15921.  
  15922. --|  Effects
  15923. --|  
  15924. --|  This procedure gets the instrumenting instruction for a nested unit.
  15925. --|  It determines whether it needs to ask for statement trace level, type
  15926. --|  tracing level, or both,by looking at the modes for the compilation
  15927. --|  unit.  The current units name is displayed and then the user is 
  15928. --|  prompted for the required inputs
  15929.  
  15930.     VALID_INPUT : BOOLEAN := FALSE; 
  15931.       --|  Used to loop until user supplies valid input
  15932.  
  15933.     TEMP_LIST   : STRING_LIST := STRING_LISTS.CREATE; 
  15934.       --|  Used to contain the list of variables the user wants to trace
  15935.  
  15936.     procedure DISPLAY_UNIT_TRACE_OPTIONS is 
  15937.  
  15938.     --|  Effects
  15939.     --|  
  15940.     --|  This procedure displays the menu of statement trace options for
  15941.     --|  a program unit.
  15942.  
  15943.     begin
  15944.       NEW_LINE; 
  15945.       NEW_LINE; 
  15946.       PUT_LINE("Available trace levels are:"); 
  15947.       PUT_LINE("1 - Entry/Exit only"); 
  15948.       PUT_LINE("2 - Entry/Exit and Decision Point"); 
  15949.       PUT_LINE("3 - Every statement"); 
  15950.       NEW_LINE; 
  15951.       PUT("Enter option ( default is 2): "); 
  15952.     end DISPLAY_UNIT_TRACE_OPTIONS; 
  15953.  
  15954.     procedure DISPLAY_UNIT(UNIT_TO_DISPLAY : in UNIT_SPECIFICATION) is 
  15955.  
  15956.     --|  Effects
  15957.     --|  
  15958.     --|  This program displays the Name of the current unit.
  15959.  
  15960.     begin
  15961.       NEW_LINE; 
  15962.       NEW_LINE; 
  15963.       PUT_LINE("Current Unit Being Instrumented is:"); 
  15964.       NEW_LINE; 
  15965.       for INDEX in 1 .. UNIT_TO_DISPLAY'LAST loop
  15966.         PUT(UNIT_TO_DISPLAY(INDEX)); 
  15967.         if UNIT_TO_DISPLAY(INDEX) = ';' then 
  15968.           NEW_LINE; 
  15969.           PUT("       "); 
  15970.         end if; 
  15971.       end loop; 
  15972.       NEW_LINE; 
  15973.       NEW_LINE; 
  15974.     end DISPLAY_UNIT; 
  15975.  
  15976.     procedure STRIP_BLANKS(FROM : in out STRING; 
  15977.                            LEN  : in out NATURAL) is 
  15978.  
  15979.     --|  Effects
  15980.     --|  
  15981.     --|  This procedure strips all of the blanks out of a string. It
  15982.     --|  returns the string padded with blank on the right, and it
  15983.     --|  returns the length of the string.
  15984.  
  15985.       INDEX : NATURAL := 1; 
  15986.         --|  Used to index into the string.
  15987.  
  15988.     begin
  15989.       while INDEX <= LEN loop  -- loop through the string 
  15990.         if FROM(INDEX) = ' ' then 
  15991.           FROM(INDEX .. LEN - 1) := FROM(INDEX + 1 .. LEN); 
  15992.           LEN := LEN - 1; 
  15993.         else
  15994.           INDEX := INDEX + 1; 
  15995.         end if; 
  15996.       end loop; 
  15997.     end STRIP_BLANKS; 
  15998.  
  15999.   begin
  16000.  
  16001.     -- Display current unit
  16002.     DISPLAY_UNIT(CURRENT_UNIT); 
  16003.  
  16004.   -- Determine if statement trace level needs to be prompted for
  16005.  
  16006.     if not IS_PACKAGE_SPEC then   -- package specs have no statements
  16007.       if TRACE_MODE = MIXED then  -- only need to get if in mixed mode
  16008.         DISPLAY_UNIT_TRACE_OPTIONS; 
  16009.         while not VALID_INPUT loop  -- loop until valid statement trace option
  16010.           GET_LINE(TEXT_IO.STANDARD_INPUT, INPUT_LINE, LENGTH_OF_INPUT); 
  16011.           if LENGTH_OF_INPUT < 1 then   -- no input, use defaults
  16012.             REQUESTED_TRACE_LEVEL := DECISION_POINT; 
  16013.             VALID_INPUT := TRUE; 
  16014.           else   -- determine user response
  16015.             case INPUT_LINE(1) is 
  16016.               when '1' => 
  16017.                 REQUESTED_TRACE_LEVEL := ENTRY_EXIT; 
  16018.                 VALID_INPUT := TRUE; 
  16019.               when '2' => 
  16020.                 REQUESTED_TRACE_LEVEL := DECISION_POINT; 
  16021.                 VALID_INPUT := TRUE; 
  16022.               when '3' => 
  16023.                 REQUESTED_TRACE_LEVEL := ALL_STATEMENTS; 
  16024.                 VALID_INPUT := TRUE; 
  16025.               when '?' => 
  16026.                 PRINT_UNIT_TRACING_HELP; 
  16027.                 DISPLAY_UNIT_TRACE_OPTIONS; 
  16028.               when others => 
  16029.                 PUT_LINE("Invalid input, try again:  "); 
  16030.                 DISPLAY_UNIT_TRACE_OPTIONS; 
  16031.             end case; 
  16032.           end if; 
  16033.         end loop; 
  16034.       else   --  trace mode is not mixed
  16035.         REQUESTED_TRACE_LEVEL := TRACE_MODE;   -- return trace level for comp
  16036.       end if; 
  16037.     end if; 
  16038.  
  16039. -- Do we need to prompt for variables to trace?
  16040.  
  16041.     if DO_TYPE_TRACING then 
  16042.       PUT_LINE("Enter variables to trace.  Enter one variable per line "); 
  16043.       PUT_LINE("or *ALL to trace all variables in the scope.");
  16044.       PUT_LINE("Terminate the list with a blank line"); 
  16045.       loop   -- loop until blank line encountered
  16046.         PUT(">> ");
  16047.         GET_LINE(TEXT_IO.STANDARD_INPUT, INPUT_LINE, LENGTH_OF_INPUT); 
  16048.         exit when LENGTH_OF_INPUT < 1; 
  16049.  
  16050.   -- strip blanks out of user requested variable name and then add
  16051.   -- the variable name to the list with its scope name prepended
  16052.  
  16053.         STRIP_BLANKS (INPUT_LINE(1..LENGTH_OF_INPUT), LENGTH_OF_INPUT);
  16054.         if SCOPE_NAME = "" then 
  16055.           STRING_LISTS.ATTACH(TEMP_LIST, CREATE(INPUT_LINE(1 .. LENGTH_OF_INPUT)
  16056.             )); 
  16057.         else 
  16058.           STRING_LISTS.ATTACH(TEMP_LIST, CREATE(SCOPE_NAME) & "." & INPUT_LINE(1
  16059.             .. LENGTH_OF_INPUT)); 
  16060.         end if; 
  16061.       end loop; 
  16062.     end if; 
  16063.     LIST_OF_VARIABLES := TEMP_LIST; -- return the list of variables
  16064.   end GET_UNIT_INSTRUCTIONS; 
  16065.  
  16066.  
  16067.   --------------------------------------------------------------
  16068.   --  Local Procedure Bodies
  16069.   --------------------------------------------------------------
  16070.  
  16071.   procedure GET_USER_OPTIONS(TRACING_MODE      : out TRACE_MODES; 
  16072.                              TYPE_TRACING_MODE : out BOOLEAN) is 
  16073.  
  16074. --|  Effects
  16075. --|  
  16076. --|  This procedure is called when the user specifies that she wants to
  16077. --|  select her own instrumenting options instead of using one of
  16078. --|  the predefined options.  The procedure will prompt the user for
  16079. --|  the statement trace level and whether to do type tracing.
  16080.  
  16081.     VALID_INPUT : BOOLEAN := FALSE; 
  16082.       --|  used to loop until valid user input
  16083.  
  16084.     procedure DISPLAY_TRACE_OPTIONS is 
  16085.  
  16086.     --|  Effects
  16087.     --|  
  16088.     --|  This procedure displays the possible trace modes for a compilation unit.
  16089.  
  16090.     begin
  16091.       NEW_LINE; 
  16092.       NEW_LINE; 
  16093.       PUT_LINE("Available trace levels are:"); 
  16094.       PUT_LINE("1 - Entry/Exit only"); 
  16095.       PUT_LINE("2 - Entry/Exit and Decision Point"); 
  16096.       PUT_LINE("3 - Every statement"); 
  16097.       PUT_LINE("4 - Mixed (Each program unit has its own trace level)"); 
  16098.       NEW_LINE; 
  16099.       PUT("Enter option ( default is 2): "); 
  16100.     end DISPLAY_TRACE_OPTIONS; 
  16101.  
  16102.   begin
  16103.  
  16104.  -- Prompt user for statement trace mode and loop until he responds
  16105.  -- with a valid input
  16106.  
  16107.     DISPLAY_TRACE_OPTIONS; 
  16108.     while not VALID_INPUT loop
  16109.       GET_LINE(TEXT_IO.STANDARD_INPUT, INPUT_LINE, LENGTH_OF_INPUT); 
  16110.       if LENGTH_OF_INPUT < 1 then 
  16111.         TRACING_MODE := DECISION_POINT; 
  16112.         VALID_INPUT := TRUE; 
  16113.       else 
  16114.         case INPUT_LINE(1) is 
  16115.           when '1' => 
  16116.             TRACING_MODE := ENTRY_EXIT; 
  16117.             VALID_INPUT := TRUE; 
  16118.           when '2' => 
  16119.             TRACING_MODE := DECISION_POINT; 
  16120.             VALID_INPUT := TRUE; 
  16121.           when '3' => 
  16122.             TRACING_MODE := ALL_STATEMENTS; 
  16123.             VALID_INPUT := TRUE; 
  16124.           when '4' => 
  16125.             TRACING_MODE := MIXED; 
  16126.             VALID_INPUT := TRUE; 
  16127.           when '?' => 
  16128.             PRINT_TRACING_HELP; 
  16129.             DISPLAY_TRACE_OPTIONS; 
  16130.           when others => 
  16131.             PUT_LINE("Invalid input, try again:  "); 
  16132.             DISPLAY_TRACE_OPTIONS; 
  16133.         end case; 
  16134.       end if; 
  16135.     end loop; 
  16136.  
  16137. -- now determine whether the user wants to do type tracing
  16138.  
  16139.     VALID_INPUT := FALSE; 
  16140.     NEW_LINE; 
  16141.     NEW_LINE; 
  16142.     PUT("Do you want to do type tracing (default is no): "); 
  16143.     while not VALID_INPUT loop
  16144.       GET_LINE(TEXT_IO.STANDARD_INPUT, INPUT_LINE, LENGTH_OF_INPUT); 
  16145.       if LENGTH_OF_INPUT < 1 then 
  16146.         TYPE_TRACING_MODE := FALSE; 
  16147.         VALID_INPUT := TRUE; 
  16148.       elsif INPUT_LINE(1) = 'y' or INPUT_LINE(1) = 'Y' then 
  16149.         TYPE_TRACING_MODE := TRUE; 
  16150.         VALID_INPUT := TRUE; 
  16151.       elsif INPUT_LINE(1) = 'n' or INPUT_LINE(1) = 'N' then 
  16152.         TYPE_TRACING_MODE := FALSE; 
  16153.         VALID_INPUT := TRUE; 
  16154.       elsif INPUT_LINE(1) = '?' then 
  16155.         PRINT_TYPE_HELP; 
  16156.         PUT("Do you want to do type tracing (default is no): "); 
  16157.       else 
  16158.         PUT_LINE("Invalid input, try again: "); 
  16159.         NEW_LINE; 
  16160.         NEW_LINE; 
  16161.         PUT("Do you want to do type tracing (default is no): "); 
  16162.       end if; 
  16163.     end loop; 
  16164.   end GET_USER_OPTIONS; 
  16165.  
  16166.   --------------------------------------------------------------
  16167.  
  16168.   procedure PRINT_INSTRUMENTING_HELP is 
  16169.  
  16170.   --|  Effects
  16171.   --|  
  16172.   --|  This procedure displays help on selecting trace modes
  16173.  
  16174.   begin
  16175.     NEW_LINE; 
  16176.     NEW_LINE; 
  16177.     PUT_LINE("When instrumenting code two options need to be specified."); 
  16178.     PUT_LINE("The user can use the defaults provided for one of the"); 
  16179.     PUT_LINE("tools (options 1 to 3) or may supply his own options."); 
  16180.     NEW_LINE; 
  16181.     PUT_LINE("The first option determines where breakpoints are put."); 
  16182.     PUT_LINE("There are four choices for this option: "); 
  16183.     PUT_LINE("   Entry/Exit       - breakpoints are placed at entry exit only")
  16184.       ; 
  16185.     PUT_LINE(
  16186.       "   Decision Point   - breakpoints are also placed at decision points"); 
  16187.     PUT_LINE("   Every Statement  - A breakpoint is placed at each statement"); 
  16188.     PUT_LINE("   Mixed            - Each program unit gets its own trace level")
  16189.       ; 
  16190.     NEW_LINE; 
  16191.     PUT_LINE("The second option determines whether variables and types are"); 
  16192.     PUT_LINE("traced.  This option is either on or off."); 
  16193.     NEW_LINE; 
  16194.     PUT_LINE("When selecting options, the user can use either one of the"); 
  16195.     PUT_LINE("sets of predefined defaults or specify his own options.  The"); 
  16196.     PUT_LINE("predefined defaults are as follows:"); 
  16197.     NEW_LINE; 
  16198.     PUT_LINE("DEFAULT                      TRACE                   TYPE"); 
  16199.     PUT_LINE("NAME                         LEVEL                  TRACING"); 
  16200.     PUT_LINE("-------------------------------------------------------------"); 
  16201.     NEW_LINE; 
  16202.     PUT_LINE("Path/Autopath Analyzer      Decision point           No"); 
  16203.     PUT_LINE("Performance Analyzer        Entry/Exit               No"); 
  16204.     PUT_LINE("Self Metric                 Decision point           Yes"); 
  16205.     NEW_LINE; 
  16206.   end PRINT_INSTRUMENTING_HELP; 
  16207.  
  16208.   --------------------------------------------------------------
  16209.  
  16210.   procedure PRINT_TRACING_HELP is 
  16211.  
  16212.   --|  Effects
  16213.   --|  
  16214.   --|  Display information about trace modes
  16215.  
  16216.   begin
  16217.     NEW_LINE; 
  16218.     NEW_LINE; 
  16219.     PUT_LINE("There are four possible trace modes.  The four modes are:"); 
  16220.     NEW_LINE; 
  16221.     PUT_LINE("Entry/Exit      - This mode provides breakpoints at entry to"); 
  16222.     PUT_LINE("                  and exit from each program unit"); 
  16223.     PUT_LINE("Decision Point  - This mode provides breakpoints at every "); 
  16224.     PUT_LINE("                  decision point as well as at entry to and"); 
  16225.     PUT_LINE("                  exit from each program unit"); 
  16226.     PUT_LINE("Every Statement - This mode provides breakpoints at every"); 
  16227.     PUT_LINE("                  statement"); 
  16228.     PUT_LINE("Mixed           - This mode allows the user to instrument"); 
  16229.     PUT_LINE("                  each program unit at any level.  The user"); 
  16230.     PUT_LINE("                  will be prompted to provide the desired"); 
  16231.     PUT_LINE("                  trace level for each program unit in the"); 
  16232.     PUT_LINE("                  compilation"); 
  16233.     NEW_LINE; 
  16234.   end PRINT_TRACING_HELP; 
  16235.  
  16236.   --------------------------------------------------------------
  16237.  
  16238.   procedure PRINT_UNIT_TRACING_HELP is 
  16239.  
  16240.   --|  Effects
  16241.   --|  
  16242.   --|  Display possible trace modes for a unit
  16243.  
  16244.   begin
  16245.     NEW_LINE; 
  16246.     NEW_LINE; 
  16247.     PUT_LINE("There are three possible trace modes.  They are:"); 
  16248.     NEW_LINE; 
  16249.     PUT_LINE("Entry/Exit      - This mode provides breakpoints at entry to"); 
  16250.     PUT_LINE("                  and exit from each program unit"); 
  16251.     PUT_LINE("Decision Point  - This mode provides breakpoints at every "); 
  16252.     PUT_LINE("                  decision point as well as at entry to and"); 
  16253.     PUT_LINE("                  exit from each program unit"); 
  16254.     PUT_LINE("Every Statement - This mode provides breakpoints at every"); 
  16255.     PUT_LINE("                  statement"); 
  16256.     NEW_LINE; 
  16257.   end PRINT_UNIT_TRACING_HELP;
  16258.  
  16259.   --------------------------------------------------------------
  16260.  
  16261.   procedure PRINT_TYPE_HELP is 
  16262.  
  16263.   --|  Effects
  16264.   --|  
  16265.   --|  Displays informatin about type tracing
  16266.  
  16267.   begin
  16268.     NEW_LINE; 
  16269.     NEW_LINE; 
  16270.     PUT_LINE("The user can enable or disable type and variable tracing. "); 
  16271.     PUT_LINE("If the user responds yes to this question then type tracing"); 
  16272.     PUT_LINE("will be enabled, and the user will be prompted to provide"); 
  16273.     PUT_LINE("the variables to be traced."); 
  16274.     NEW_LINE; 
  16275.     PUT_LINE("NOTE:  If a package specification is instrumented without"); 
  16276.     PUT_LINE("type tracing, then all modules that with that package must"); 
  16277.     PUT_LINE("also be instrumented without type tracing"); 
  16278.     NEW_LINE; 
  16279.   end PRINT_TYPE_HELP; 
  16280.  
  16281. end USER_INTERFACE; 
  16282. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16283. --change.spc
  16284. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16285. with Source_Instrumenter_Declarations; use Source_Instrumenter_Declarations; 
  16286. with ParserDeclarations;
  16287.  
  16288. package Change_Text is
  16289. --| Subprograms for the manipulation of source text
  16290.  
  16291. --| Overview
  16292.  
  16293. --| This package provides several subprograms which manipulate source text
  16294. --| in various ways.
  16295. --| 
  16296. --| Change_Case alters the case of the text passed in,
  16297. --| Change_Sharp changes the extended delimiter character '#' to the basic
  16298. --|     character ':' in the text of a based literal.
  16299. --| String_Value returns the text of a string with the extended and basic
  16300. --|     string delimiters represented appropriately within the string.
  16301.  
  16302.     package PD  renames ParserDeclarations;
  16303.  
  16304.     type Case_Name is (Uppercase, Lowercase);
  16305.  
  16306.     -----------------------------------------------------------------------
  16307.  
  16308.     function Change_Case(Token_Text : PD.Source_Text;  --| text to be changed
  16309.                          To_Case    : Case_Name        --| case in which to 
  16310.                                                        --| represent Token_Text
  16311.                          ) return String;
  16312.     --| Changes the case of Token_Text
  16313.  
  16314.     --| Effects
  16315.  
  16316.     --| The Token_Text is changed according to the To_Case passed in.  When
  16317.     --| To_Case is SID.Bold, the return value is the same as if lowercase
  16318.     --| had been requested.  The actual bold printing is handled in procedure
  16319.     --| Bold_Print rather than here for two reasons:
  16320.     --|
  16321.     --|      1.  Tokens which would ordinarily be bold printed should be only
  16322.     --|          lowercased when bold printing is selected with
  16323.     --|          Paginated_Format off.  This is to prevent control characters
  16324.     --|          from being inserted into a file which is supposed to be
  16325.     --|          valid Ada.
  16326.     --|
  16327.     --|      2.  In determining the length of a token for placement in the
  16328.     --|          output, control characters which have no printable form,
  16329.     --|          and therefore do not take up any columns on the page, should
  16330.     --|          not be counted.
  16331.     --|
  16332.  
  16333.     -----------------------------------------------------------------------
  16334.  
  16335.     function Change_Sharp(Token_Text : PD.Source_Text) return String;
  16336.     --| Changes the extended character '#' to the basic character ':'
  16337.  
  16338.     --| Effects
  16339.  
  16340.     --| This function changes all of the '#' characters in the passed-in
  16341.     --| Token_Text to ':' characters.  Its primary use should be for changing
  16342.     --| these characters in the text of a based literal.
  16343.  
  16344.  
  16345.     -----------------------------------------------------------------------
  16346.  
  16347.     function String_Value(Token_Text : PD.Source_Text) return String;
  16348.     --| Returns the correct text for a string, based on its delimiters
  16349.  
  16350.     --| Effects
  16351.  
  16352.     --| This function returns a string with the correct delimiters (basic
  16353.     --| or extended) and embedded delimiter characters represented correctly.
  16354.     --| For example, the input string "Here is a % character" when output
  16355.     --| with Basic Delimiters must be converted to %Here is a %% character"
  16356.     --| with the embedded delimiter character doubled.  This ensures that
  16357.     --| valid Ada strings are reproduced.
  16358.  
  16359.     -----------------------------------------------------------------------
  16360.  
  16361.     function Convert_periods_to_Underscores(Input_String: in String)
  16362.                                                   return string;
  16363.     --| Effects
  16364.     --| 
  16365.     --| This procedure will convert all periods in a string to underscores.
  16366.  
  16367. end Change_Text;
  16368. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16369. --change.bdy
  16370. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16371.  
  16372. with Source_instrumenter_Declarations; 
  16373.  
  16374. package body Change_Text is
  16375. --| Subprograms for the manipulation of source text
  16376.  
  16377. --| Overview
  16378.  
  16379. --| Change_Text, Change_Sharp and String_Value are all functions which which
  16380. --| take a parameter of type PD.Source_Text which is an access to a string
  16381. --| type and return a string.  Each dereferences its parameter, performs the
  16382. --| appropriate manipulations and returns the manipulated string.  
  16383.  
  16384.     package SID renames Source_Instrumenter_Declarations;
  16385.  
  16386.     -----------------------------------------------------------------------
  16387.     -- Local Subprogram Specifications
  16388.     -----------------------------------------------------------------------
  16389.  
  16390.     function Uppercase (Char : Character) return Character;
  16391.     --| Returns the uppercase value of the passed in character
  16392.  
  16393.     --| Effects
  16394.  
  16395.     --| If Char is alphabetic, its uppercase value is returned.  Otherwise,
  16396.     --| Char is returned unchanged.
  16397.  
  16398.     -----------------------------------------------------------------------
  16399.  
  16400.     function Lowercase (Char : Character) return Character;
  16401.     --| Returns the lowercase value of the passed in character
  16402.  
  16403.     --| Effects
  16404.  
  16405.     --| If Char is alphabetic, its lowercase value is returned.  Otherwise,
  16406.     --| Char is returned unchanged.
  16407.  
  16408.     -----------------------------------------------------------------------
  16409.     -- External Subprogram Bodies
  16410.     -----------------------------------------------------------------------
  16411.  
  16412.     function Change_Case (Token_Text : PD.Source_Text;
  16413.                           To_Case    : Case_Name) return String is
  16414.  
  16415.         Preceding_Underscore : Boolean := True;
  16416.         --| Flags that the preceding character is an underscore, indicating
  16417.         --| that the following character should be capitalized.  Initialized
  16418.         --| to True so that the first character of the Token will be 
  16419.         --| capitalized.
  16420.  
  16421.     begin
  16422.  
  16423.         -- case selectors match enumeration type Case_Name
  16424.         case To_Case is
  16425.             when Uppercase =>
  16426.                 for I in Token_Text.all'First .. Token_Text.all'Last loop
  16427.                     Token_Text.all(I) := Uppercase(Token_Text.all(I));
  16428.                 end loop;
  16429.                 return Token_Text.all;
  16430.             when Lowercase  => 
  16431.                 for I in Token_Text.all'First .. Token_Text.all'Last loop
  16432.                     Token_Text.all(I) := Lowercase(Token_Text.all(I));
  16433.                 end loop;
  16434.                 return Token_Text.all;
  16435.         end case;
  16436.     end Change_Case;
  16437.  
  16438.     -----------------------------------------------------------------------
  16439.  
  16440.     function Change_Sharp (Token_Text : PD.Source_Text) return String is
  16441.     begin
  16442.         for I in Token_Text.all'First .. Token_Text.all'Last loop
  16443.             if Token_Text.all(I) = '#' then 
  16444.                 Token_Text.all(I) := ':';
  16445.             end if;
  16446.         end loop;
  16447.         return Token_Text.all;
  16448.     end Change_Sharp;
  16449.  
  16450.     -----------------------------------------------------------------------
  16451.  
  16452.     function String_Value (Token_Text : PD.Source_Text) return String is
  16453.         Mark : positive; --| Marks a point in the input string as the start of
  16454.                          --| where to copy the next section of string.
  16455.         String_Text : PD.Source_Text; --| String being built
  16456.         Delimiter_Character : Character := '"'; --| String delimiter character
  16457.         Delimiter_String : String(1 .. 1) := """";
  16458.         --| String to insert into the string being built as delimiter character
  16459.  
  16460.     begin
  16461.         if SID.Delimiters = SID.Basic then
  16462.             Delimiter_Character := '%';
  16463.             Delimiter_String := "%";
  16464.         else
  16465.             Delimiter_Character := '"';
  16466.             Delimiter_String := """"; 
  16467.         end if;
  16468.         String_Text := new String'(Delimiter_String);
  16469.         Mark := Token_Text'First;
  16470.         for I in Token_Text'First .. Token_Text'Last loop
  16471.             if Token_Text.all(i) = Delimiter_Character then
  16472.                 String_Text := new String'(
  16473.                     String_Text.all & Token_Text.all(Mark .. I) & 
  16474.                     Delimiter_String);
  16475.                 Mark := I + 1;
  16476.             end if;
  16477.         end loop;
  16478.         return String_Text.all & Token_Text.all(Mark .. Token_Text.all'Last) &
  16479.             Delimiter_String;
  16480.     end String_Value;         
  16481.  
  16482.     -----------------------------------------------------------------------
  16483.     -- Local Subprogram Bodies
  16484.     -----------------------------------------------------------------------
  16485.  
  16486.     function Uppercase (Char : Character) return Character is
  16487.     begin
  16488.         if Char in 'a' .. 'z' then
  16489.             return Character'Val(Character'Pos(Char) - Character'Pos('a') +
  16490.                 Character'Pos('A'));
  16491.         else
  16492.             return Char;
  16493.         end if;
  16494.     end Uppercase; 
  16495.  
  16496.     -----------------------------------------------------------------------
  16497.  
  16498.     function Lowercase (Char : Character) return Character is
  16499.     begin
  16500.         if Char in 'A' .. 'Z' then
  16501.             return Character'Val(Character'Pos(Char) - Character'Pos('A') +
  16502.                 Character'Pos('a'));
  16503.         else
  16504.             return Char;
  16505.         end if;
  16506.     end Lowercase;
  16507.  
  16508.     -----------------------------------------------------------------------
  16509.  
  16510.     function CONVERT_PERIODS_TO_UNDERSCORES(INPUT_STRING: in STRING)
  16511.                                                          return STRING is
  16512.       OUTPUT_STRING: STRING(1..INPUT_STRING'length);
  16513.     begin
  16514.       for INDEX in INPUT_STRING'range loop
  16515.         if INPUT_STRING(INDEX) = '.' then
  16516.           OUTPUT_STRING(INDEX) := '_';
  16517.         else
  16518.           OUTPUT_STRING(INDEX) := INPUT_STRING(INDEX);   
  16519.         end if;
  16520.       end loop;
  16521.       return OUTPUT_STRING;
  16522.     end;
  16523.  
  16524. end Change_Text;
  16525.  
  16526. ---------------------------------------------------------------------------
  16527. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16528. --bkpt.spc
  16529. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16530. with STRING_PKG; use STRING_PKG; 
  16531. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; 
  16532.  
  16533. package CREATE_BREAKPOINT is 
  16534.  
  16535. --| Overview
  16536. --| 
  16537. --| This package is used to insert calls into the source.  It maintains
  16538. --| a scope stack to maintain the current scope.  The create procedures
  16539. --| are used to do the actual insertion of code.  The other procedures
  16540. --| are used to tell this package when programs are started and ended
  16541.  
  16542.   BREAKPOINT_PRINTED_LAST        : BOOLEAN;  -- Used to prevent two consecutive
  16543.                                              -- breakpoints
  16544.  
  16545.   BREAKPOINT_NUMBER_FOR_PRINTING : STRING(1 .. 6) := "      "; 
  16546.                                                 -- breakpoint number in string
  16547.                                                 -- format for printing in 
  16548.                                                 -- listing file
  16549.  
  16550.   procedure NEW_COMPILATION_UNIT(UNIT_NAME    : in CURRENT_UNIT_NAME; 
  16551.                                  TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE); 
  16552.  
  16553.   --| Effects
  16554.   --| 
  16555.   --| This procedure is used to define a new compilation unit.
  16556.   --| Each time a new compilation unit is entered, this procedure
  16557.   --| is called.  Any information about a previous compilation unit
  16558.   --| is cleared and the new compilation unit becomes the current 
  16559.   --| compilation unit.
  16560.  
  16561.   procedure START_PROGRAM_UNIT(UNIT_NAME    : in CURRENT_UNIT_NAME; 
  16562.                                TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE); 
  16563.  
  16564.   --| Effects
  16565.   --| 
  16566.   --| This procedure is used to define a new program unit.  Each time a new
  16567.   --| program unit is entered, this procedure is called.  The procedure
  16568.   --| name and type are used in constructing entering/exiting units and
  16569.   --| breakpoints.  The procedure is also added to the list of procedures
  16570.   --| for the current compilation unit.
  16571.  
  16572.   procedure CREATE_ENTERING_UNIT; 
  16573.  
  16574.   --| Effects
  16575.   --| 
  16576.   --| This procedure is called whenever an entering_unit procedure
  16577.   --| call needs to be added to the instrumented source.  The information
  16578.   --| about the current compilation unit and current program unit are used
  16579.   --| to construct the Entering_Unit procedure call.
  16580.  
  16581.   procedure CREATE_EXITING_UNIT; 
  16582.  
  16583.   --| Effects
  16584.   --| 
  16585.   --| This procedure creates an exiting unit call for the current program 
  16586.   --| unit.  This unit will be called before each return statement, at 
  16587.   --| the end of the program unit, and at the end of each exception
  16588.   --| handler.
  16589.  
  16590.   procedure END_PROGRAM_UNIT; 
  16591.  
  16592.   --| Effects
  16593.   --| 
  16594.   --| This procedure tells when a program unit has ended.  The current
  16595.   --| unit is set to the enclosing scope (if there is one).  All future
  16596.   --| calls to the create procedures will use this new unit.
  16597.  
  16598.   procedure CREATE_BREAKPOINT(TYPE_OF_BREAKPOINT : in BREAKPOINT_TYPES; 
  16599.                               PUTVARS_TO_CALL    : in ADA_NAME); 
  16600.  
  16601.   --| Effects
  16602.   --| 
  16603.   --| This procedure is called each time a breakpoint needs to be added.  
  16604.   --| This procedure may be called at the same point in the source, so a 
  16605.   --| flag is maintained to tell when the last line output was a breakpoint.
  16606.   --| If it was, then another breakpoint is added.  This flag is reset in
  16607.   --| Source_Instrumenter_Utilities each time a new line of user code
  16608.   --| is output.
  16609.  
  16610.   procedure CREATE_UNIT_INFORMATION; 
  16611.  
  16612.   --| Effects
  16613.   --| 
  16614.   --| This procedure is called when a Unit_Information procedure call
  16615.   --| needs to be added to the source.  This procedure uses the current
  16616.   --| compilation unit and the list of procedures defined for that unit.
  16617.  
  16618.   --| Requires
  16619.   --| 
  16620.   --| This procedure must be the last one called for a compilation unit.
  16621.  
  16622.   function GET_PROGRAM_UNIT return STRING_TYPE; 
  16623.  
  16624.   --| Effects
  16625.   --|
  16626.   --| This procedure return a String_type containing the current
  16627.   --| Program unit identifier.  This can be used for printing the 
  16628.   --| Current Program unit for calls to the RTM
  16629.  
  16630. end CREATE_BREAKPOINT; 
  16631. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16632. --bkpt.bdy
  16633. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16634. with STACK_PKG; 
  16635. with LISTS; 
  16636. with SIMPLE_PAGINATED_OUTPUT; use SIMPLE_PAGINATED_OUTPUT; 
  16637. with SOURCE_INSTRUMENTER_DECLARATIONS; 
  16638. with CHANGE_TEXT;
  16639.  
  16640. package body CREATE_BREAKPOINT is 
  16641.  
  16642. --|  Overview
  16643. --|  
  16644. --|  This package takes care of creating calls to the RTM.  It creates
  16645. --|  breakpoints, Entering_units, and Exiting units with the appropriate
  16646. --|  parameters.  It also exports a function that returns a 
  16647. --|  program_unit_unique_identifier for the current unit.  This function
  16648. --|  is called to create the identifier for the calls create in tracing
  16649. --|  variables
  16650. --|  
  16651. --|  There are several routines called by the source instrumenter to tell
  16652. --|  this package when a unit is entered or exited.  These calls are:
  16653. --|  New_compilation_unit, Start_Program_Unit, and End_program_unit. 
  16654. --|  The information passed to these procedures allows the package to
  16655. --|  determine the name, type, and other info about the current unit
  16656. --|  and current compilation unit.
  16657. --|  
  16658. --|  Four other procedure are used to output instrumented source.  They are
  16659. --|  Create_entering_Unit, Create_exiting_unit, Create_Breakpoint, and
  16660. --|  Create_Unit_Information.  These procedures when called will output
  16661. --|  the appropriate call to the run time monitor.
  16662. --|  
  16663. --|  The current program unit is identified by three elements: The compilation
  16664. --|  unit containing it, a unique number assigned to the unit, and the type of
  16665. --|  unit.  The current compilation unit is always maintained in 
  16666. --|  CURRENT_COMPILATION_UNIT, and the other elements are maintained in 
  16667. --|  a record.  These records are stacked for nested procedures in order 
  16668. --|  to maintain the current unit properly.
  16669. --|  
  16670. --|  A list of the units in the current compilation unit is also maintained.  
  16671. --|  This list is used in the Unit_Information call to the Run time monitor to
  16672. --|  identify the units in a compilation unit.  This is the only place where
  16673. --|  the unit names are used.  All other places use the three elements used 
  16674. --|  above.  When the name of a unit is needed. Its unique number is used to 
  16675. --|  select the correct element of the list containing the program unit name.
  16676.  
  16677.   
  16678.   use STRING_PKG; 
  16679.  
  16680.   package SID renames SOURCE_INSTRUMENTER_DECLARATIONS; 
  16681.  
  16682.   type PROGRAM_UNIT_INFORMATION is   --|  Information needed to identify a unit
  16683.     record
  16684.       UNIT_NUMBER : PROGRAM_UNIT_NUMBER_RANGE; --|  unique unit number
  16685.       UNIT_TYPE   : PROGRAM_UNIT_TYPE;         --|  type of unit
  16686.     end record; 
  16687.  
  16688.   CURRENT_COMPILATION_UNIT : CURRENT_UNIT_NAME; 
  16689.     --|  The name of the current compilation unit being processed
  16690.  
  16691.   BREAKPOINT_NUMBER        : BREAKPOINT_NUMBER_RANGE; 
  16692.     --|  The number of breakpoints that have been created
  16693.  
  16694.   NUMBER_OF_PROGRAM_UNITS  : PROGRAM_UNIT_NUMBER_RANGE; 
  16695.     --|  The number of program units in the current compilation unit that have
  16696.     --|  been processed so far
  16697.  
  16698.   CURRENT_PROGRAM_UNIT     : PROGRAM_UNIT_INFORMATION; 
  16699.     --|  Contains the information about the program unit currently being processed
  16700.  
  16701.   CURRENT_NESTING_LEVEL    : NATURAL; 
  16702.     --|  The current level of nesting
  16703.  
  16704.   package PROGRAM_UNIT_STACK_PACKAGE is      -- Used to Maintain the current
  16705.     new STACK_PKG(PROGRAM_UNIT_INFORMATION); -- unit info through nesting
  16706.  
  16707.   package PROGRAM_UNIT_LIST_PACKAGE is       -- Used to keep a list of the units
  16708.     new LISTS(PROGRAM_UNIT_NAME);            -- in the current comp unit
  16709.  
  16710.   PROGRAM_UNIT_LIST  : PROGRAM_UNIT_LIST_PACKAGE.LIST; 
  16711.     --|  The list of units in the current compilation unit
  16712.  
  16713.   PROGRAM_UNIT_STACK : PROGRAM_UNIT_STACK_PACKAGE.STACK; 
  16714.     --|  The stack used to maintain the current unit
  16715.  
  16716. -------------------------------------------------------------------------
  16717.  
  16718.   procedure NEW_COMPILATION_UNIT(UNIT_NAME    : in CURRENT_UNIT_NAME; 
  16719.                                  TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE) is 
  16720.  
  16721. --|  Effects
  16722. --|
  16723. --|  This procedure is used to define the current compilation unit.  Since a
  16724. --|  compilation can contain several compilation units, all variables
  16725. --|  must be re-initialized when a new compilation unit is started.
  16726.  
  16727.   begin
  16728.     CURRENT_NESTING_LEVEL := 1; 
  16729.     PROGRAM_UNIT_STACK := PROGRAM_UNIT_STACK_PACKAGE.CREATE; 
  16730.     PROGRAM_UNIT_LIST := PROGRAM_UNIT_LIST_PACKAGE.CREATE; 
  16731.     CURRENT_COMPILATION_UNIT := MAKE_PERSISTENT(UNIT_NAME); 
  16732.     BREAKPOINT_NUMBER := 0; 
  16733.  
  16734. --  If the compilation unit is a procedure or function then the procedure
  16735. --  or function is program unit number one.  In a package the first nested
  16736. --  unit will be unit number 1.
  16737.  
  16738.     if TYPE_OF_UNIT = PACKAGE_TYPE then 
  16739.       NUMBER_OF_PROGRAM_UNITS := 0; 
  16740.     else  
  16741.       -- add the procedure or function to the list of program units
  16742.       NUMBER_OF_PROGRAM_UNITS := 1; 
  16743.       PROGRAM_UNIT_LIST_PACKAGE.ATTACH(PROGRAM_UNIT_LIST, (UNIT_NAME, 
  16744.         TYPE_OF_UNIT)); 
  16745.     end if; 
  16746.     CURRENT_PROGRAM_UNIT := (NUMBER_OF_PROGRAM_UNITS, TYPE_OF_UNIT); 
  16747.  
  16748.   end NEW_COMPILATION_UNIT; 
  16749.  
  16750. -------------------------------------------------------------------------
  16751.  
  16752.   procedure START_PROGRAM_UNIT(UNIT_NAME    : in CURRENT_UNIT_NAME; 
  16753.                                TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE) is 
  16754.  
  16755. --|  Effects
  16756. --|  
  16757. --|  This procedure defines a new program unit for the current compilation
  16758. --|  unit.  The nesting level is updated, the information about the enclosing
  16759. --|  unit is pushed on the stack, the new unit is defined to be the current
  16760. --|  unit and it is added to the list of units.
  16761.  
  16762.   begin
  16763.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL + 1; 
  16764.     PROGRAM_UNIT_STACK_PACKAGE.PUSH(PROGRAM_UNIT_STACK, CURRENT_PROGRAM_UNIT); 
  16765.     NUMBER_OF_PROGRAM_UNITS := NUMBER_OF_PROGRAM_UNITS + 1; 
  16766.     CURRENT_PROGRAM_UNIT := (NUMBER_OF_PROGRAM_UNITS, TYPE_OF_UNIT); 
  16767.     PROGRAM_UNIT_LIST_PACKAGE.ATTACH(PROGRAM_UNIT_LIST, 
  16768.       (UNIT_NAME, TYPE_OF_UNIT)); 
  16769.   end START_PROGRAM_UNIT; 
  16770.  
  16771. -------------------------------------------------------------------------
  16772.  
  16773.   procedure CREATE_ENTERING_UNIT is 
  16774.  
  16775. --|  Effects
  16776. --|
  16777. --|  This procedure outputs the entering unit call to the run time monitor
  16778. --|  for the current unit.  The call is put to the instrumented file only
  16779.  
  16780.   begin
  16781.  
  16782.     -- Currently, entering unit call is not made for package body 
  16783.     -- initialization at outer level.  This may be added back later 
  16784.     -- if the problems can be overcome
  16785.  
  16786.     if not (CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE and
  16787.       CURRENT_NESTING_LEVEL > 1) then
  16788.       SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16789.       if CURRENT_NESTING_LEVEL = 1 and CURRENT_PROGRAM_UNIT.UNIT_TYPE = 
  16790.            PROCEDURE_TYPE then
  16791.         PUT_LINE(SID.INSTRUMENTED_FILE, 
  16792.          CHANGE_TEXT.CONVERT_PERIODS_TO_UNDERSCORES(
  16793.          VALUE(CURRENT_COMPILATION_UNIT))
  16794.          & "_Call_Unit_Information;");
  16795.       end if;
  16796.       PUT(SID.INSTRUMENTED_FILE, "RTM.Entering_Unit"); 
  16797.       PUT(SID.INSTRUMENTED_FILE, GET_PROGRAM_UNIT); 
  16798.       PUT(SID.INSTRUMENTED_FILE, ";"); 
  16799.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE then
  16800.         SPACE_LINE(SID.INSTRUMENTED_FILE, 1);
  16801.       end if;
  16802.     end if;
  16803.   end CREATE_ENTERING_UNIT; 
  16804.  
  16805. -------------------------------------------------------------------------
  16806.  
  16807.   procedure CREATE_EXITING_UNIT is 
  16808.  
  16809. --|  Effects
  16810. --|  
  16811. --|  This procedure creates the exiting unit call to the run time monitor.
  16812. --|  
  16813.  
  16814.   begin
  16815.  
  16816.     -- Currently, exiting unit call is not made for package body 
  16817.     -- initialization at outer level.  This may be added back later 
  16818.     -- if the problems can be overcome
  16819.  
  16820.     if not (CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE and
  16821.       CURRENT_NESTING_LEVEL > 1) then
  16822.       SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16823.       PUT(SID.INSTRUMENTED_FILE, "RTM.Exiting_Unit("); 
  16824.       PUT(SID.INSTRUMENTED_FILE, GET_PROGRAM_UNIT); 
  16825.       PUT_LINE(SID.INSTRUMENTED_FILE, ");"); 
  16826.       BREAKPOINT_PRINTED_LAST := FALSE; 
  16827.     end if;
  16828.   end CREATE_EXITING_UNIT; 
  16829.  
  16830. -------------------------------------------------------------------------
  16831.  
  16832.   procedure END_PROGRAM_UNIT is 
  16833.  
  16834. --|  Effects
  16835. --|  
  16836. --|  This is procedure is called to inform the create_breakpoint package
  16837. --|  that the current unit has ended.  If we are nested then the outer
  16838. --|  scope information is popped from the stack.  If the unit that
  16839. --|  we have just complete processing is a procedure that is a compilation
  16840. --|  unit, then output the call_unit_Information unit is created.
  16841. --|  
  16842.  
  16843.   begin
  16844.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL - 1; 
  16845.  
  16846.     if CURRENT_NESTING_LEVEL = 0 then 
  16847.  
  16848.   --  If this is an non-nested procedure then create a call_unit_info
  16849.   --  procedure.
  16850.   
  16851.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = PROCEDURE_TYPE then 
  16852.         SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16853.         PUT_LINE(SID.INSTRUMENTED_FILE, "separate(" & CURRENT_COMPILATION_UNIT
  16854.           & ")"); 
  16855.         PUT_LINE(SID.INSTRUMENTED_FILE, "procedure "
  16856.           & CHANGE_TEXT.CONVERT_PERIODS_TO_UNDERSCORES(
  16857.           VALUE(CURRENT_COMPILATION_UNIT))
  16858.           & "_Call_Unit_Information is"); 
  16859.         PUT_LINE(SID.INSTRUMENTED_FILE, "begin"); 
  16860.         CREATE_UNIT_INFORMATION; 
  16861.         PUT_LINE(SID.INSTRUMENTED_FILE, "end;"); 
  16862.       end if; 
  16863.     else   -- we are nested so pop the outer scope from the stack
  16864.       PROGRAM_UNIT_STACK_PACKAGE.POP(PROGRAM_UNIT_STACK, CURRENT_PROGRAM_UNIT); 
  16865.     end if; 
  16866.   end END_PROGRAM_UNIT; 
  16867.  
  16868. -------------------------------------------------------------------------
  16869.  
  16870.   procedure CREATE_BREAKPOINT(TYPE_OF_BREAKPOINT : in BREAKPOINT_TYPES; 
  16871.                               PUTVARS_TO_CALL    : in ADA_NAME) is 
  16872.  
  16873. --|  Effects
  16874. --|  
  16875. --|  This procedure will create a breakpoint in the souce code.  The breakpoint
  16876. --|  type is added to the breakpoint call.  If we are tracing variables then 
  16877. --|  a call to the current putvars is added after the breakpoint.  Due to
  16878. --|  grammar ambiguities, there are several places where multiple calls to
  16879. --|  create breakpoint are made.  To prevent multiple breakpoints from being
  16880. --|  printed a flag is maintained that identifies whether a breakpoint was
  16881. --|  the last item printed to the instrumented source.  If this flag is
  16882. --|  true then no breakpoint is added
  16883.  
  16884.     BREAKPOINT_LENGTH : INTEGER; 
  16885.       --|  The length of the string representation of the current bkpt number
  16886.  
  16887.     BLANK_STRING      : STRING(1 .. 5) := "     "; 
  16888.       --|  The string into which the bkpt number is put for printing in the
  16889.       --|  listing file.
  16890.  
  16891.   begin
  16892.  
  16893. --  Currently breakpoints are not added to package initializations
  16894.  
  16895.     if CURRENT_PROGRAM_UNIT.UNIT_TYPE /= PACKAGE_TYPE then
  16896.       if not BREAKPOINT_PRINTED_LAST then 
  16897.  
  16898.         -- Increment the breakpoint number and then make a string
  16899.         -- representation of the number for use in the listing
  16900.  
  16901.         BREAKPOINT_NUMBER := BREAKPOINT_NUMBER + 1; 
  16902.         BREAKPOINT_LENGTH := INTEGER'IMAGE(BREAKPOINT_NUMBER)'LENGTH; 
  16903.         BREAKPOINT_NUMBER_FOR_PRINTING := INTEGER'IMAGE(BREAKPOINT_NUMBER) & 
  16904.           BLANK_STRING(BREAKPOINT_LENGTH .. 5); 
  16905.         BREAKPOINT_NUMBER_FOR_PRINTING := BREAKPOINT_NUMBER_FOR_PRINTING(2 .. 6)
  16906.           & " "; 
  16907.  
  16908.         --  output the breakpoint
  16909.  
  16910.         SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16911.         PUT(SID.INSTRUMENTED_FILE, "RTM.Breakpoint_At("); 
  16912.         PUT(SID.INSTRUMENTED_FILE, GET_PROGRAM_UNIT); 
  16913.         PUT(SID.INSTRUMENTED_FILE, ","); 
  16914.         SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16915.         if TYPE_OF_BREAKPOINT = OTHER_BREAKPOINT then 
  16916.           PUT(SID.INSTRUMENTED_FILE, "       Other_Breakpoint, "); 
  16917.         else 
  16918.           PUT(SID.INSTRUMENTED_FILE, "       Loop_Breakpoint, "); 
  16919.         end if; 
  16920.         PUT(SID.INSTRUMENTED_FILE, NATURAL'IMAGE(BREAKPOINT_NUMBER)); 
  16921.         PUT(SID.INSTRUMENTED_FILE, ");"); 
  16922.         BREAKPOINT_PRINTED_LAST := TRUE; 
  16923.  
  16924.         -- If there is a putvars to call, then add the call to
  16925.         -- the instrumented source
  16926.  
  16927.         if not IS_EMPTY(PUTVARS_TO_CALL) then 
  16928.           SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16929.           PUT(SID.INSTRUMENTED_FILE, PUTVARS_TO_CALL & "_" & SID.PREFIX & 
  16930.             "putvars;"); 
  16931.         end if; 
  16932.       end if; 
  16933.     end if;
  16934.   end CREATE_BREAKPOINT; 
  16935.  
  16936. -------------------------------------------------------------------------
  16937.  
  16938.   procedure CREATE_UNIT_INFORMATION is 
  16939.  
  16940. --|  Effects
  16941. --|  
  16942. --|  This procedure is called to output the unit information call to the
  16943. --|  instrumented file.  This call must be made after all procedures in
  16944. --|  the compilation unit are defined.  No further calls can be made for
  16945. --|  the compilation unit after the unit information call is made.
  16946. --|  The unit Information includes a list of the names and types of the
  16947. --|  program units contained in the compilation unit.
  16948.  
  16949.     NEXT_PROGRAM_UNIT          : PROGRAM_UNIT_NAME; 
  16950.       --|  Used to contain the next program unit when iterating the p.u. list
  16951.  
  16952.     PROGRAM_UNIT_LIST_ITERATOR : PROGRAM_UNIT_LIST_PACKAGE.LISTITER; 
  16953.       --|  The iterator used in iterating the program unit list
  16954.  
  16955.     PROGRAM_UNIT_NUMBER        : POSITIVE := 1; 
  16956.       --|  Used to maintain unit number for program unit list
  16957.  
  16958.   begin
  16959.     PUT(SID.INSTRUMENTED_FILE, "RTM.Unit_Information(Create(""" & VALUE(
  16960.       CURRENT_COMPILATION_UNIT) & """), "); 
  16961.     PUT(SID.INSTRUMENTED_FILE, NATURAL'IMAGE(BREAKPOINT_NUMBER)); 
  16962.     PUT(SID.INSTRUMENTED_FILE, ", ("); 
  16963.  
  16964.     --  Iterate throught the list of program units printing each to
  16965.     --  the listing file
  16966.  
  16967.     PROGRAM_UNIT_LIST_ITERATOR := PROGRAM_UNIT_LIST_PACKAGE.MAKELISTITER(
  16968.       PROGRAM_UNIT_LIST); 
  16969.     while PROGRAM_UNIT_LIST_PACKAGE.MORE(PROGRAM_UNIT_LIST_ITERATOR) loop
  16970.       PROGRAM_UNIT_LIST_PACKAGE.NEXT(PROGRAM_UNIT_LIST_ITERATOR, 
  16971.         NEXT_PROGRAM_UNIT); 
  16972.       SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16973.       PUT(SID.INSTRUMENTED_FILE, INTEGER'IMAGE(PROGRAM_UNIT_NUMBER) & " => "); 
  16974.       PUT(SID.INSTRUMENTED_FILE, "(Create("""); 
  16975.       PUT(SID.INSTRUMENTED_FILE, NEXT_PROGRAM_UNIT.UNIT_IDENTIFIER); 
  16976.       PUT(SID.INSTRUMENTED_FILE, """),"); 
  16977.       PUT(SID.INSTRUMENTED_FILE, PROGRAM_UNIT_TYPE'IMAGE(NEXT_PROGRAM_UNIT.
  16978.         UNIT_TYPE)); 
  16979.       PUT(SID.INSTRUMENTED_FILE, ")"); 
  16980.       if PROGRAM_UNIT_LIST_PACKAGE.MORE(PROGRAM_UNIT_LIST_ITERATOR) then 
  16981.         PUT(SID.INSTRUMENTED_FILE, ","); 
  16982.       end if; 
  16983.       PROGRAM_UNIT_NUMBER := PROGRAM_UNIT_NUMBER + 1; 
  16984.     end loop; 
  16985.     PUT(SID.INSTRUMENTED_FILE, "));"); 
  16986.     SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  16987.   end CREATE_UNIT_INFORMATION; 
  16988.  
  16989. -------------------------------------------------------------------------
  16990.  
  16991.   function GET_PROGRAM_UNIT return STRING_TYPE is 
  16992.  
  16993. --|  Effects
  16994. --|  
  16995. --|  Returns the program unit for the current unit.  The program unit 
  16996. --|  description is returned as a string for printing in the instrumented
  16997. --|  file.  This call is used to add the program unit description to
  16998. --|  put value calls for variable tracing as well as for breakpoints
  16999. --|  and entering/exiting units
  17000.  
  17001.   begin
  17002.     return CREATE("(Create(""" & VALUE(CURRENT_COMPILATION_UNIT) & """), " & 
  17003.       NATURAL'IMAGE(CURRENT_PROGRAM_UNIT.UNIT_NUMBER) & ", " & PROGRAM_UNIT_TYPE
  17004.       'IMAGE(CURRENT_PROGRAM_UNIT.UNIT_TYPE) & ", " & SID.PREFIX & 
  17005.       "Task_Number)"); 
  17006.   end GET_PROGRAM_UNIT; 
  17007.  
  17008. end CREATE_BREAKPOINT; 
  17009. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17010. --bufrfile.spc
  17011. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17012.  
  17013. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  17014. with SIMPLE_PAGINATED_OUTPUT; 
  17015. with DIRECT_IO; 
  17016. with LISTS; 
  17017. with STRING_PKG; use STRING_PKG; 
  17018.  
  17019. package BUFFER_FILE_PACKAGE --| This package creates and manages the
  17020. --| files needed by the source instrumenter
  17021. --| for saving information needed for
  17022. --| tracing types and variables.
  17023.  
  17024. is 
  17025.  
  17026. --| Overview
  17027. --|     This package contains file management procedures needed by the
  17028. --| Source Instrumenter for saving type and variable tracing information.
  17029. --| The Source Instrumenter prepares programs for testing by the Ada Test 
  17030. --| and Analysis Tool Set.
  17031. --|
  17032. --|     A general purpose scratch file is maintained for saving procedure
  17033. --| bodies created by the instrumenter until the end of the current 
  17034. --| declarative part, where they can then be copied into the instrumented
  17035. --| source file.  The specifications for these procedures are added
  17036. --| directly to the instrumented source file and do not need to be saved.
  17037. --|
  17038. --|     Four new files may be created for each package specification to
  17039. --| contain the instrumenting information needed by the source instrumenter
  17040. --| for tracing variables and types declared in the package specification.
  17041. --| The procedures in this package manage these files and allows the Source
  17042. --| Instrumenter to access the correct file when necessary.  A table which 
  17043. --| equates a unique filename prefix with each package name is maintained by 
  17044. --| this package, and saved in an external file when the instrumentation is 
  17045. --| finished.
  17046. --|
  17047. --|
  17048. --| Requires
  17049. --| The following declarations for file naming are used:
  17050. --|
  17051. --| "File_Prefix_Limit" is currently set to 8 characters, and indicates
  17052. --| the number of characters in a filename to the left of the dot.
  17053. --|
  17054. --| "File_Suffix_Limit" is currently set to 4 characters; a dot and
  17055. --| a 3 character file extension.
  17056. --|
  17057. --| The external file which saves the package_name - file_name information
  17058. --| is named "PKGFILES.SII".
  17059. --|
  17060. --| The current extensions used for the package tracing files are:
  17061. --|  ".PBS"  -- For the Public_Spec_File
  17062. --|  ".PBB"  -- For the Public_Body_File
  17063. --|  ".PVS"  -- For the Private_Spec_File
  17064. --|  ".PVB"  -- For the Private_Body_File
  17065. --|
  17066. --| These may be changed if they cause conflicts or are otherwise unsuitable
  17067. --| for the host system.
  17068.  
  17069. --| N/A: Errors, Raises, Modifies
  17070.  
  17071.  
  17072. --------------------------------------------------------------------------
  17073.  
  17074.   package DIO is 
  17075.     new DIRECT_IO(CHARACTER); 
  17076.   use DIO; 
  17077.  
  17078.   package SPO renames SIMPLE_PAGINATED_OUTPUT; 
  17079.  
  17080.   BUFFER_FILE, 
  17081.   --| a temporary "scratch" file used by the source instrumenter
  17082.   --| to save type tracing procedure bodies until end of the
  17083.   --| current declarative part
  17084.  
  17085.   PUBLIC_SPEC_FILE, 
  17086.   --| file which has the package spec for tracing types and variables
  17087.   --| declared in the visible part of a package.
  17088.  
  17089.   PUBLIC_BODY_FILE, 
  17090.   --| the corresponding package body
  17091.  
  17092.   PRIVATE_SPEC_FILE, 
  17093.   --| file which has the procedure declarations for tracing types
  17094.   --| and variables declared in the private part of a package
  17095.  
  17096.   PRIVATE_BODY_FILE   : DIO.FILE_TYPE; 
  17097.   --| the corresponding procedure bodies
  17098.  
  17099.  
  17100.   type FILE_INDICATOR is 
  17101.   --| indicates which file to copy into the instrumented source file
  17102.   (PUBLIC_SPEC, PUBLIC_BODY, PRIVATE_SPEC, PRIVATE_BODY); 
  17103.  
  17104.   type FILE_GROUP is (PUBLIC_FILES, PRIVATE_FILES, ALL_FILES); 
  17105.   --| used by various procedures when the operation is not always 
  17106.   --| performed on all files 
  17107.  
  17108.   FILE_PREFIX_LIMIT        : constant := 8; 
  17109.   FILE_SUFFIX_LIMIT        : constant := 4; 
  17110.  
  17111.   PUBLIC_SPEC_FILE_SUFFIX  : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".PBS"; 
  17112.   PUBLIC_BODY_FILE_SUFFIX  : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".PBB"; 
  17113.   PRIVATE_SPEC_FILE_SUFFIX : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".PVS"; 
  17114.   PRIVATE_BODY_FILE_SUFFIX : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".PVB"; 
  17115.  
  17116.   EXTERNAL_FILENAME        : constant STRING := "PKGFILES.SII"; 
  17117.   --| Filename extension means "Source Instrumenter Information"
  17118.  
  17119.   subtype FILENAME_PREFIX_STRING is STRING(1 .. FILE_PREFIX_LIMIT); 
  17120.   NO_FILENAME : constant FILENAME_PREFIX_STRING := (others => ' '); 
  17121.  
  17122.  
  17123.   ------------------------------------------------------------------------
  17124.   -- The following procedures manage the Buffer_File 
  17125.   ------------------------------------------------------------------------
  17126.  
  17127.   procedure INITIALIZE;  --| Initialize the Buffer_File
  17128.  
  17129.   --| Effects
  17130.   --|   This procedure initializes Buffer_File as a temporary Direct_IO file.
  17131.   --| The Source Instrumenter writes text to this file in sections which
  17132.   --| correspond to scoping levels in the source program.  Initialize
  17133.   --| also creates an Index_Stack to keep track of the Starting Indices for
  17134.   --| the sections.
  17135.  
  17136.   -----------------------------------------------------------------------------
  17137.  
  17138.   procedure START_NEW_SECTION;  --| Starts a new section in Buffer_File
  17139.  
  17140.   --| Effects
  17141.   --|   This procedure marks a new section in the buffer file by pushing
  17142.   --| the current Starting_Index onto the Index_Stack and assigning the
  17143.   --| current DIO.Index to Starting_Index.
  17144.  
  17145.   ----------------------------------------------------------------------------
  17146.  
  17147.   procedure RELEASE_SECTION;  --| Release the section in Buffer_File
  17148.  
  17149.   --| Effects
  17150.   --|   This procedure releases a section in Buffer_File by setting the Index
  17151.   --| to Starting_Index and popping the previous Starting_Index off the
  17152.   --| stack.
  17153.  
  17154.   -----------------------------------------------------------------------------
  17155.  
  17156.   procedure WRITELN_TO_BUFFER( --| Write a string to the specified file
  17157.                               DIO_FILE     : in DIO.FILE_TYPE := BUFFER_FILE; 
  17158.                               LINE_OF_TEXT : in STRING); 
  17159.   --| Effects
  17160.   --|   This procedure writes the line to the specified file.  If no file
  17161.   --| is specified, the line is written to the Buffer_File.
  17162.  
  17163.   -----------------------------------------------------------------------------
  17164.  
  17165.   procedure SAVE_BUFFER_FILE( --| Save the current section of the Buffer_File
  17166.                              PO_FILE : in SPO.PAGINATED_FILE_HANDLE); 
  17167.  
  17168.   --| Effects
  17169.   --|   This procedure saves the section starting at the current Starting_Index
  17170.   --| to the specified Simple_Paginated_Output file (the instrumented source 
  17171.   --| file).
  17172.  
  17173.  
  17174.  
  17175.   ----------------------------------------------------------------------------
  17176.   -- The following procedures manage the package tracing files.
  17177.   ----------------------------------------------------------------------------
  17178.  
  17179.   procedure CREATE_PACKAGE_FILES( --| Create the files neccesary to
  17180.   --| save package information.
  17181.                                  PACKAGE_NAME : in STRING; 
  17182.                                  WHICH_FILES  : in FILE_GROUP); 
  17183.  
  17184.   --| Effects
  17185.   --|  This procedure obtains a filename prefix based on the current package
  17186.   --| name, appends the appropriate suffix, and creates the Direct_IO files. 
  17187.   --| The source instrumenter saves package tracing information in these files.
  17188.   --| The Which_Files parameter will normally be "All_Files".  However, if a 
  17189.   --| package specification is nested in another package specification, then 
  17190.   --| only new private files are created. The information from the public part 
  17191.   --| of the nested package is included in the public files of the enclosing 
  17192.   --| package.
  17193.  
  17194.   ----------------------------------------------------------------------------
  17195.  
  17196.   procedure CLOSE_PACKAGE_FILES( --| Close the specified package files
  17197.                                 WHICH_FILES : in FILE_GROUP); 
  17198.  
  17199.   --| Effects
  17200.   --|  This procedure closes the specified group of package files.  
  17201.   --| Usually "Which_Files" parameter will be "All_Files".  If a package is 
  17202.   --| nested in another package, then the outer package's private files will
  17203.   --| be closed (temporarily) and reopened after the inner package is done.
  17204.   --|
  17205.   --|  The public information for the nested package is included in the
  17206.   --| enclosing package's public files.  Therefore, it isn't necessary to
  17207.   --| close and reopen the public_files. 
  17208.  
  17209.   ---------------------------------------------------------------------------
  17210.  
  17211.   procedure REOPEN_PRIVATE_FILES( --| Reopen the private files associated
  17212.   --| with the Package_Name
  17213.                                  PACKAGE_NAME : in STRING); 
  17214.  
  17215.   --| Effects
  17216.   --|  This procedure reopens the private files for the specified package,
  17217.   --| which were closed to process a nested package.  The file index is set
  17218.   --| to the end of the file so further writes to this files will be appended.
  17219.  
  17220.   ----------------------------------------------------------------------------
  17221.  
  17222.   function PACKAGE_FILES_EXIST( --| Check for the existence of instrumenting
  17223.   --| information files for the given package 
  17224.                                PACKAGE_NAME : in STRING; 
  17225.                                WHICH_FILES  : in FILE_GROUP) return BOOLEAN; 
  17226.  
  17227.   --| Effects
  17228.   --|   This function determines if the specified group of instrumenting 
  17229.   --| information files exist for a package.  Both the spec and the body
  17230.   --| files must exist.  If one exists without the other, which could
  17231.   --| happed if the user deleted or misplaced one of the files, it is
  17232.   --| deleted, and False is returned. 
  17233.  
  17234.   ----------------------------------------------------------------------------
  17235.  
  17236.   procedure DELETE_PACKAGE_FILES( --| Delete the instrumenting information 
  17237.   --| files for the given package, and
  17238.   --| remove the entry from the external file.
  17239.                                  PACKAGE_NAME            : in STRING; 
  17240.                                  WHICH_FILES             : in FILE_GROUP := 
  17241.                                    ALL_FILES; 
  17242.                                  CURRENT_FILENAME_PREFIX : in 
  17243.                                    FILENAME_PREFIX_STRING := NO_FILENAME); 
  17244.  
  17245.   --| Effects
  17246.   --|   This procedure determines the name of the external files if the
  17247.   --| Current_Filename_Prefix is not already known, and deletes the 
  17248.   --| "Which_Files" group of files, if they exist.   
  17249.  
  17250.   -----------------------------------------------------------------------------
  17251.  
  17252.   procedure COPY_PACKAGE_FILES( --| Copy the specified file into the
  17253.   --| instrumented source file
  17254.                                WHICH_FILE   : in FILE_INDICATOR; 
  17255.                                PACKAGE_NAME : in STRING; 
  17256.                                SI_FILE      : in SPO.PAGINATED_FILE_HANDLE); 
  17257.  
  17258.   --| Effects
  17259.   --|   This procedure copies the contents of the indicated file into the 
  17260.   --| specified Simple_Paginated_Output file (The instrumented source).
  17261.  
  17262.   ---------------------------------------------------------
  17263.  
  17264.   procedure SAVE_SPEC_WITH_LIST( --| Save the with list for the
  17265.   --| current package specification
  17266.                                 UNIT_NAME : in STRING; 
  17267.                                 WITH_LIST : in STRING_LIST); 
  17268.   --| Effects
  17269.   --|   This procecufe saves the list of library unit names that were
  17270.   --| in the with_clause for the indicated package specification.
  17271.  
  17272.   ---------------------------------------------------------
  17273.  
  17274.   function GET_SPEC_WITH_LIST( --| Retrieve the saved with list for
  17275.   --| current unit
  17276.                               UNIT_NAME : in STRING) return STRING_LIST; 
  17277.  
  17278.   --| Effects
  17279.   --|   This function retrieves the saved list of library unit names 
  17280.   --| that were in the with_clause for the indicated unit and returns
  17281.   --| it to the calling procedure as a list of string_types.
  17282.  
  17283.   -----------------------------------------------------------------------------
  17284.  
  17285.   procedure SAVE_EXTERNAL_FILE;  --| Update the external file
  17286.  
  17287.   --| Effects
  17288.   --|   This procedure writes the internal table of package_name-file_name
  17289.   --| information to the permanent external table file.
  17290.  
  17291.   -----------------------------------------------------------------------------
  17292.  
  17293. end BUFFER_FILE_PACKAGE; 
  17294. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17295. --bufrfile.bdy
  17296. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17297. with TEXT_IO; use TEXT_IO; 
  17298. with CALENDAR; 
  17299. with TIME_LIBRARY_1; use TIME_LIBRARY_1; 
  17300. with STACK_PKG; 
  17301.  
  17302. package body BUFFER_FILE_PACKAGE --| File management for the SI
  17303.  
  17304. is 
  17305.   use STRING_LISTS;  -- declared in the package spec
  17306.  
  17307.   subtype DATE_STRING is STRING(1 .. 8); 
  17308.   subtype TIME_STRING is STRING(1 .. 8); 
  17309.  
  17310.   NO_DATE : constant DATE_STRING := (others => ' '); 
  17311.   NO_TIME : constant TIME_STRING := (others => ' '); 
  17312.   NO_NAME : constant STRING_PKG.STRING_TYPE := CREATE(""); 
  17313.  
  17314.   -- note: NO_FILENAME is declared in the spec because it is used
  17315.   -- as a default value for an external procedure
  17316.  
  17317.   type TABLE_ENTRY_RECORD is  --| Record format for table entries
  17318.     record
  17319.       PACKAGE_ADA_NAME : STRING_PKG.STRING_TYPE := NO_NAME; 
  17320.       --| Fully qualified package name
  17321.       PACKAGE_FILENAME : FILENAME_PREFIX_STRING := NO_FILENAME; 
  17322.       --| Filename prefix
  17323.       WITHED_UNITS     : STRING_PKG.STRING_TYPE := NO_NAME; 
  17324.       --| List of units named in the context clause of a specification
  17325.       DATE_CREATED     : DATE_STRING := NO_DATE; 
  17326.       --| Date the file was created
  17327.       TIME_CREATED     : TIME_STRING := NO_TIME; 
  17328.       --| Time the file was created
  17329.     end record; 
  17330.  
  17331.  
  17332.   -- Function EQUAL for the instantiation of the Lists package
  17333.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN; 
  17334.  
  17335.   package INTERNAL_LIST_PACKAGE is 
  17336.     new LISTS(TABLE_ENTRY_RECORD, TABLE_EQUAL); 
  17337.   use INTERNAL_LIST_PACKAGE; 
  17338.  
  17339.   INTERNAL_TABLE         : INTERNAL_LIST_PACKAGE.LIST; 
  17340.   --| A linked list of table entry records, for equating package names
  17341.   --| with their filename prefix for instrumenting information files.  The
  17342.   --| list is built by reading the external file.
  17343.  
  17344.   INTERNAL_TABLE_CREATED : BOOLEAN := FALSE; 
  17345.   INTERNAL_TABLE_CHANGED : BOOLEAN := FALSE; 
  17346.  
  17347.   EXTERNAL_FILE          : TEXT_IO.FILE_TYPE; 
  17348.   --| The external file of package name, filename prefix information.
  17349.   --| The internal table is written to the external file at the end
  17350.   --| of instrumentation.
  17351.  
  17352.   TERMINATOR             : constant CHARACTER := '*'; 
  17353.   --| Mark the end of a table_entry_record field in the external file
  17354.  
  17355.   subtype LONG_STRING is STRING(1 .. 255); 
  17356.   --| Used for reading a line of text from one of the files.  It is
  17357.   --| assumed that most lines will be less than 255 characters and
  17358.   --| this choice should be adequate most of the time.  Procedures
  17359.   --| which do the reading must allow for cases where lines are longer
  17360.   --| than 255.
  17361.  
  17362.  
  17363.   --| Varaibles for marking and releasing sections in the Buffer_File 
  17364.  
  17365.   package INDEX_STACK_PKG is 
  17366.     new STACK_PKG(DIO.POSITIVE_COUNT); 
  17367.   INDEX_STACK    : INDEX_STACK_PKG.STACK; 
  17368.   STARTING_INDEX : DIO.POSITIVE_COUNT; 
  17369.  
  17370.  
  17371.   ------------------------------------------------------------------------
  17372.   --  Local procedure specificatons
  17373.   -------------------------------------------------------------------------
  17374.  
  17375.  
  17376.   ----------------------------------------------------------------------------
  17377.  
  17378.   procedure CREATE_INTERNAL_TABLE; 
  17379.   --| Reads the external file and build an internal version of it 
  17380.   --| as a linked list.
  17381.  
  17382.   --------------------------------------------------------------------------
  17383.  
  17384.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) 
  17385.       return BOOLEAN; 
  17386.  
  17387.   --| Searches the Internal_Table for the occurrence of the 
  17388.   --| specified filename prefix.
  17389.  
  17390.   ----------------------------------------------------------------------------
  17391.  
  17392.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING)
  17393.       return FILENAME_PREFIX_STRING; 
  17394.  
  17395.   --| Formulates and returns a unique filename prefix for each package name. 
  17396.  
  17397.   ----------------------------------------------------------------------------
  17398.  
  17399.   function CONVERT_LIST_TO_STRING_TYPE(L : in STRING_LIST) return STRING_TYPE; 
  17400.   --| Converts a list of string_types to a single string_type
  17401.   --| with each element separated by one blank.
  17402.  
  17403.   ---------------------------------------------------------
  17404.  
  17405.   function CONVERT_STRING_TO_LIST(S : in STRING) return STRING_LIST; 
  17406.   --| Converts a literal string into a list of string_types.
  17407.  
  17408.   ---------------------------------------------------------
  17409.  
  17410.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) return STRING; 
  17411.   --| Returns a string of the next "length" characters read 
  17412.   --| from the external file.
  17413.  
  17414.   ---------------------------------------------------------
  17415.  
  17416.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE; 
  17417.   --| Reads any number of characters in the external file until
  17418.   --| the terminator character ('*') is found and returns them
  17419.   --| as a string_type.
  17420.  
  17421.   ---------------------------------------------------------
  17422.  
  17423.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  17424.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  17425.                                      FOUND        : in out BOOLEAN); 
  17426.   --| Scan the internal table for an entry for Package_Name, 
  17427.   --| and if found, pass it back to the calling procedure.
  17428.  
  17429.   ---------------------------------------------------------
  17430.  
  17431.   function START_PACKAGE(PACKAGE_NAME : in STRING)
  17432.       return FILENAME_PREFIX_STRING; 
  17433.  
  17434.   --| Create an entry in the Internal_Table for this package, 
  17435.   --| and return the unique filename prefix.
  17436.  
  17437.   ---------------------------------------------------------
  17438.  
  17439.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING)
  17440.       return FILENAME_PREFIX_STRING; 
  17441.  
  17442.   --| If the package is in the table, return its filename prefix.  If 
  17443.   --| there isn't an entry return No_Filename.
  17444.  
  17445.   ---------------------------------------------------------
  17446.  
  17447.   procedure DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING); 
  17448.   --| Delete the entry for this package from the Internal_Table.
  17449.  
  17450.  
  17451.  
  17452.   ---------------------------------------------------------------
  17453.   --  External procedures for managing the package tracing files.
  17454.   ---------------------------------------------------------------
  17455.  
  17456.  
  17457.   procedure CREATE_PACKAGE_FILES(PACKAGE_NAME : in STRING;
  17458.                                  WHICH_FILES  : in FILE_GROUP) is 
  17459.   --| Set up the requested set of package tracing files.
  17460.  
  17461.     PACKAGE_FILENAME_PREFIX : FILENAME_PREFIX_STRING; 
  17462.  
  17463.   begin
  17464.  
  17465.     -- Call Start_Package which will make an entry in the internal
  17466.     -- table and then return the unique filename prefix
  17467.     PACKAGE_FILENAME_PREFIX := START_PACKAGE(PACKAGE_NAME); 
  17468.  
  17469.     if WHICH_FILES /= PRIVATE_FILES then 
  17470.  
  17471.       -- create the public_spec file
  17472.       begin
  17473.  
  17474.         DIO.OPEN(PUBLIC_SPEC_FILE, OUT_FILE, 
  17475.           PACKAGE_FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17476.         DIO.DELETE(PUBLIC_SPEC_FILE); 
  17477.         DIO.CREATE(PUBLIC_SPEC_FILE, OUT_FILE, 
  17478.           PACKAGE_FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17479.  
  17480.       exception
  17481.         when DIO.NAME_ERROR => 
  17482.           DIO.CREATE(PUBLIC_SPEC_FILE, OUT_FILE, 
  17483.             PACKAGE_FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17484.       end; 
  17485.  
  17486.       -- create the public_body file
  17487.       begin
  17488.  
  17489.         DIO.OPEN(PUBLIC_BODY_FILE, OUT_FILE, 
  17490.           PACKAGE_FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17491.         DIO.DELETE(PUBLIC_BODY_FILE); 
  17492.         DIO.CREATE(PUBLIC_BODY_FILE, OUT_FILE, 
  17493.           PACKAGE_FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17494.  
  17495.       exception
  17496.         when DIO.NAME_ERROR => 
  17497.           DIO.CREATE(PUBLIC_BODY_FILE, OUT_FILE, 
  17498.             PACKAGE_FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17499.       end; 
  17500.  
  17501.     end if; -- Which_Files /= Private_Files
  17502.  
  17503.     if WHICH_FILES /= PUBLIC_FILES then 
  17504.  
  17505.       -- create the private_spec file
  17506.       begin
  17507.  
  17508.         DIO.OPEN(PRIVATE_SPEC_FILE, OUT_FILE, 
  17509.           PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17510.         DIO.DELETE(PRIVATE_SPEC_FILE); 
  17511.         DIO.CREATE(PRIVATE_SPEC_FILE, OUT_FILE, 
  17512.           PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17513.  
  17514.       exception
  17515.         when DIO.NAME_ERROR => 
  17516.           DIO.CREATE(PRIVATE_SPEC_FILE, OUT_FILE, 
  17517.             PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17518.       end; 
  17519.  
  17520.       -- create the private_body file
  17521.       begin
  17522.  
  17523.         DIO.OPEN(PRIVATE_BODY_FILE, OUT_FILE, 
  17524.           PACKAGE_FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  17525.         DIO.DELETE(PRIVATE_BODY_FILE); 
  17526.         DIO.CREATE(PRIVATE_BODY_FILE, OUT_FILE, 
  17527.           PACKAGE_FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  17528.  
  17529.       exception
  17530.         when DIO.NAME_ERROR => 
  17531.           DIO.CREATE(PRIVATE_BODY_FILE, OUT_FILE, 
  17532.             PACKAGE_FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  17533.       end; 
  17534.     end if;   -- Which_Files /= Public_Files 
  17535.   end CREATE_PACKAGE_FILES; 
  17536.  
  17537.   ---------------------------------------------------------
  17538.  
  17539.   procedure CLOSE_PACKAGE_FILES(WHICH_FILES : in FILE_GROUP) is
  17540.   --| Close the specified group of package tracing files.
  17541.  
  17542.   begin
  17543.     if WHICH_FILES /= PRIVATE_FILES then 
  17544.       DIO.CLOSE(PUBLIC_SPEC_FILE); 
  17545.       DIO.CLOSE(PUBLIC_BODY_FILE); 
  17546.     end if; 
  17547.  
  17548.     if WHICH_FILES /= PUBLIC_FILES then 
  17549.       DIO.CLOSE(PRIVATE_SPEC_FILE); 
  17550.       DIO.CLOSE(PRIVATE_BODY_FILE); 
  17551.     end if; 
  17552.  
  17553.   exception
  17554.     when others => 
  17555.       null; 
  17556.   end CLOSE_PACKAGE_FILES; 
  17557.  
  17558.   ----------------------------------------------------------------------
  17559.  
  17560.   procedure REOPEN_PRIVATE_FILES(PACKAGE_NAME : in STRING) is
  17561.   --| Open the private files for the given package and set
  17562.   --| the file index to the end so that further writes are
  17563.   --| appended to the file rather that overwriting it.
  17564.  
  17565.     PACKAGE_FILENAME_PREFIX : FILENAME_PREFIX_STRING; 
  17566.     FILE_INDEX              : DIO.COUNT; 
  17567.  
  17568.   begin
  17569.     PACKAGE_FILENAME_PREFIX := GET_FILENAME_PREFIX(PACKAGE_NAME); 
  17570.  
  17571.     -- If the files are not empty set the index to the next write
  17572.     -- write position, so the current stuff is not overwritten.
  17573.     DIO.OPEN(PRIVATE_SPEC_FILE, INOUT_FILE, 
  17574.       PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17575.  
  17576.     FILE_INDEX := DIO.SIZE(PRIVATE_SPEC_FILE); 
  17577.     if FILE_INDEX /= 0 then 
  17578.       DIO.SET_INDEX(PRIVATE_SPEC_FILE, FILE_INDEX + 1); 
  17579.     end if; 
  17580.  
  17581.     DIO.OPEN(PRIVATE_BODY_FILE, INOUT_FILE, PACKAGE_FILENAME_PREFIX & 
  17582.       PRIVATE_BODY_FILE_SUFFIX); 
  17583.  
  17584.     FILE_INDEX := DIO.SIZE(PRIVATE_BODY_FILE); 
  17585.     if FILE_INDEX /= 0 then 
  17586.       DIO.SET_INDEX(PRIVATE_BODY_FILE, FILE_INDEX + 1); 
  17587.     end if; 
  17588.  
  17589.   exception
  17590.     when others => 
  17591.       null; 
  17592.  
  17593.   end REOPEN_PRIVATE_FILES; 
  17594.  
  17595.   ---------------------------------------------------------------------------
  17596.  
  17597.   function PACKAGE_FILES_EXIST(PACKAGE_NAME : in STRING; 
  17598.                                WHICH_FILES  : in FILE_GROUP) return BOOLEAN is 
  17599.   --| See if the requested set of instrumenting information files
  17600.   --| exist for the given package.  Both the spec and body file must
  17601.   --| exist, as the body contains the bodies for the subprograms
  17602.   --| declared in the spec file.  If one exists without the other,
  17603.   --| delete it and return false.
  17604.  
  17605.     FILENAME_PREFIX     : FILENAME_PREFIX_STRING := 
  17606.        GET_FILENAME_PREFIX(PACKAGE_NAME); 
  17607.  
  17608.     PUBLIC_SPEC_EXISTS  : BOOLEAN := TRUE; 
  17609.     PUBLIC_BODY_EXISTS  : BOOLEAN := TRUE; 
  17610.     PRIVATE_SPEC_EXISTS : BOOLEAN := TRUE; 
  17611.     PRIVATE_BODY_EXISTS : BOOLEAN := TRUE; 
  17612.     DIO_FILE            : DIO.FILE_TYPE; 
  17613.  
  17614.   begin
  17615.     if FILENAME_PREFIX = NO_FILENAME then  -- they don't exist
  17616.       return FALSE; 
  17617.     end if; 
  17618.  
  17619.     -- The internal table has an entry for the given package name.
  17620.     -- Make sure that the necessary files exist and can be opened.  
  17621.     -- If some of the files exist and not the others, delete those 
  17622.     -- that do and update the table.  This could happen if the user 
  17623.     -- has deleted the files other than by re-instrumenting...
  17624.  
  17625.     if WHICH_FILES /= PRIVATE_FILES then 
  17626.  
  17627.       -- check if the public spec and body files exist
  17628.       begin
  17629.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17630.         DIO.CLOSE(DIO_FILE); 
  17631.       exception
  17632.         when others => 
  17633.           PUBLIC_SPEC_EXISTS := FALSE; 
  17634.       end; 
  17635.  
  17636.       begin
  17637.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17638.         DIO.CLOSE(DIO_FILE); 
  17639.       exception
  17640.         when others => 
  17641.           PUBLIC_BODY_EXISTS := FALSE; 
  17642.       end; 
  17643.  
  17644.       if WHICH_FILES = PUBLIC_FILES then 
  17645.         if not (PUBLIC_SPEC_EXISTS and PUBLIC_BODY_EXISTS) then 
  17646.           DELETE_PACKAGE_FILES(PACKAGE_NAME, PUBLIC_FILES, FILENAME_PREFIX); 
  17647.           return FALSE; 
  17648.         end if; 
  17649.         return TRUE; 
  17650.       end if; 
  17651.     end if;     -- Which_Files /= Private_Files
  17652.  
  17653.     if WHICH_FILES /= PUBLIC_FILES then 
  17654.  
  17655.       -- check if the private spec and body files exist
  17656.       begin
  17657.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX);
  17658.         DIO.CLOSE(DIO_FILE); 
  17659.       exception
  17660.         when others => 
  17661.           PRIVATE_SPEC_EXISTS := FALSE; 
  17662.       end; 
  17663.  
  17664.       begin
  17665.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX);
  17666.         DIO.CLOSE(DIO_FILE); 
  17667.       exception
  17668.         when others => 
  17669.           PRIVATE_BODY_EXISTS := FALSE; 
  17670.       end; 
  17671.  
  17672.       if WHICH_FILES = PRIVATE_FILES then 
  17673.         if not (PRIVATE_SPEC_EXISTS and PRIVATE_BODY_EXISTS) then 
  17674.           DELETE_PACKAGE_FILES(PACKAGE_NAME, PRIVATE_FILES, FILENAME_PREFIX); 
  17675.           return FALSE; 
  17676.         end if; 
  17677.         return TRUE; 
  17678.       end if; 
  17679.     end if;     -- Which_Files /= Public_Files
  17680.  
  17681.  
  17682.     -- if we've gotten this far without hitting one of the
  17683.     -- returns then Which_Files = All_Files 
  17684.     if not (PUBLIC_SPEC_EXISTS and 
  17685.             PUBLIC_BODY_EXISTS  and 
  17686.             PRIVATE_SPEC_EXISTS and
  17687.             PRIVATE_BODY_EXISTS) then 
  17688.       DELETE_PACKAGE_FILES(PACKAGE_NAME, ALL_FILES, FILENAME_PREFIX); 
  17689.       return FALSE; 
  17690.     end if; 
  17691.  
  17692.     return TRUE; 
  17693.  
  17694.   end PACKAGE_FILES_EXIST; 
  17695.  
  17696.   -----------------------------------------------------------------------------
  17697.  
  17698.   procedure DELETE_PACKAGE_FILES(PACKAGE_NAME            : in STRING; 
  17699.                                  WHICH_FILES             : in FILE_GROUP := 
  17700.                                    ALL_FILES; 
  17701.                                  CURRENT_FILENAME_PREFIX : in 
  17702.                                    FILENAME_PREFIX_STRING := NO_FILENAME) is
  17703.   --| Delete the indicated set of package tracing files.  If all the
  17704.   --| files are deleted, then also delete the internal table entry for 
  17705.   --| the package.
  17706.  
  17707.     DIO_FILE                : DIO.FILE_TYPE; 
  17708.     PACKAGE_FILENAME_PREFIX : FILENAME_PREFIX_STRING; 
  17709.  
  17710.   begin
  17711.  
  17712.     -- if this procedure is called from Package_Files_Exist then
  17713.     -- the filename prefix has already been looked up, and is
  17714.     -- passed as Current_Filename_Prefix.
  17715.     if CURRENT_FILENAME_PREFIX = NO_FILENAME then 
  17716.       PACKAGE_FILENAME_PREFIX := GET_FILENAME_PREFIX(PACKAGE_NAME); 
  17717.     else 
  17718.       PACKAGE_FILENAME_PREFIX := CURRENT_FILENAME_PREFIX; 
  17719.     end if; 
  17720.  
  17721.     -- if the files can be opened, then they exist.  Delete them.
  17722.     -- Otherwise, there is nothing to delete so ignore it.
  17723.     if PACKAGE_FILENAME_PREFIX /= NO_FILENAME then 
  17724.  
  17725.       if WHICH_FILES /= PRIVATE_FILES then 
  17726.  
  17727.         -- delete the public_spec_file
  17728.         begin
  17729.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  17730.             PACKAGE_FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17731.           DIO.DELETE(DIO_FILE); 
  17732.         exception
  17733.           when DIO.NAME_ERROR => 
  17734.             null; 
  17735.         end; 
  17736.  
  17737.         -- delete the public_body_file
  17738.         begin
  17739.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  17740.             PACKAGE_FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17741.           DIO.DELETE(DIO_FILE); 
  17742.         exception
  17743.           when DIO.NAME_ERROR => 
  17744.             null; 
  17745.         end; 
  17746.       end if; -- Which_Files /= Private_Files
  17747.  
  17748.       if WHICH_FILES /= PUBLIC_FILES then 
  17749.  
  17750.         -- delete the private_spec_file
  17751.         begin
  17752.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  17753.             PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17754.           DIO.DELETE(DIO_FILE); 
  17755.         exception
  17756.           when DIO.NAME_ERROR => 
  17757.             null; 
  17758.         end; 
  17759.  
  17760.         -- delete the private_body_file
  17761.         begin
  17762.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  17763.             PACKAGE_FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  17764.           DIO.DELETE(DIO_FILE); 
  17765.         exception
  17766.           when DIO.NAME_ERROR => 
  17767.             null; 
  17768.         end; 
  17769.       end if; -- Which_Files /= Public_Files
  17770.  
  17771.       if WHICH_FILES = ALL_FILES then 
  17772.         DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME); 
  17773.       end if; 
  17774.  
  17775.     end if; -- Filename /= No_Filename
  17776.   end DELETE_PACKAGE_FILES; 
  17777.  
  17778.   -----------------------------------------------------------------------------
  17779.  
  17780.   procedure COPY_PACKAGE_FILES(WHICH_FILE   : in FILE_INDICATOR; 
  17781.                                PACKAGE_NAME : in STRING; 
  17782.                                SI_FILE      : in SPO.PAGINATED_FILE_HANDLE) is
  17783.   --| Copy the indicated package tracing file into the instrumented
  17784.   --| source file.
  17785.  
  17786.     PACKAGE_FILENAME_PREFIX : FILENAME_PREFIX_STRING; 
  17787.     DIO_FILE                : DIO.FILE_TYPE; 
  17788.  
  17789.     FILE_START_INDEX        : DIO.COUNT := 1; 
  17790.     FILE_END_INDEX          : DIO.COUNT; 
  17791.     CH                      : CHARACTER; 
  17792.  
  17793.   begin
  17794.  
  17795.     PACKAGE_FILENAME_PREFIX := GET_FILENAME_PREFIX(PACKAGE_NAME); 
  17796.     case WHICH_FILE is 
  17797.       when PUBLIC_SPEC => 
  17798.         OPEN(DIO_FILE, IN_FILE, 
  17799.           PACKAGE_FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  17800.  
  17801.       when PUBLIC_BODY => 
  17802.         OPEN(DIO_FILE, IN_FILE, 
  17803.           PACKAGE_FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  17804.  
  17805.       when PRIVATE_SPEC => 
  17806.         OPEN(DIO_FILE, IN_FILE, 
  17807.           PACKAGE_FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  17808.  
  17809.       when PRIVATE_BODY => 
  17810.         OPEN(DIO_FILE, IN_FILE, 
  17811.           PACKAGE_FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  17812.     end case; 
  17813.  
  17814.     SPO.SPACE_LINE(SI_FILE, 1); 
  17815.  
  17816.     -- while not DIO.end_of_file (DIO_File) loop
  17817.     -- Compiler Bug?  
  17818.     -- When trying to copy the private files, end_of_file is true immediately,
  17819.     -- even though the file index = 1, file size > 1, the file exists and
  17820.     -- can be read.  So read it explicitly from start to end.
  17821.  
  17822.     FILE_START_INDEX := 1; 
  17823.     FILE_END_INDEX := DIO.SIZE(DIO_FILE); 
  17824.     for I in FILE_START_INDEX .. FILE_END_INDEX loop
  17825.       DIO.READ(DIO_FILE, CH); 
  17826.       if CH = ASCII.CR then 
  17827.         SPO.PUT_LINE(SI_FILE, ""); 
  17828.       else 
  17829.         SPO.PUT(SI_FILE, CH); 
  17830.       end if; 
  17831.     end loop; 
  17832.     DIO.CLOSE(DIO_FILE); 
  17833.  
  17834.   exception
  17835.     when others => 
  17836.       null; 
  17837.  
  17838.   end COPY_PACKAGE_FILES; 
  17839.  
  17840.   ---------------------------------------------------------
  17841.  
  17842.   procedure SAVE_SPEC_WITH_LIST(UNIT_NAME : in STRING; 
  17843.                                 WITH_LIST : in STRING_LIST) is 
  17844.   --| This procedure is called by the source instrumenter when
  17845.   --| a package specification has a with list.  Convert the
  17846.   --| string_list to a string_type, and save it so that it
  17847.   --| can be retrieved when the package body is found.
  17848.  
  17849.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  17850.     FOUND        : BOOLEAN; 
  17851.     LIST_TO_SAVE : STRING_TYPE; 
  17852.   begin
  17853.     GET_INTERNAL_TABLE_ENTRY(UNIT_NAME, TABLE_ENTRY, FOUND); 
  17854.     if not FOUND then  -- make an entry
  17855.       TABLE_ENTRY.PACKAGE_ADA_NAME := MAKE_PERSISTENT(UNIT_NAME); 
  17856.     else 
  17857.       INTERNAL_LIST_PACKAGE.DELETEITEM(INTERNAL_TABLE, TABLE_ENTRY); 
  17858.     end if; 
  17859.  
  17860.     -- convert the list to a string_type and save it
  17861.     TABLE_ENTRY.WITHED_UNITS := MAKE_PERSISTENT(CONVERT_LIST_TO_STRING_TYPE(
  17862.       WITH_LIST)); 
  17863.     ATTACH(INTERNAL_TABLE, TABLE_ENTRY); 
  17864.     INTERNAL_TABLE_CHANGED := TRUE; 
  17865.   end SAVE_SPEC_WITH_LIST; 
  17866.  
  17867.   ---------------------------------------------------------
  17868.  
  17869.   function GET_SPEC_WITH_LIST(UNIT_NAME : in STRING) return STRING_LIST is 
  17870.   --| Retrieve the with_list that was saved for the package
  17871.   --| specification, convert it to a string_list, and return 
  17872.   --| it to the source instrumenter.
  17873.  
  17874.     TEMP        : STRING_LIST := STRING_LISTS.CREATE; 
  17875.     TABLE_ENTRY : TABLE_ENTRY_RECORD; 
  17876.     FOUND       : BOOLEAN; 
  17877.   begin
  17878.     GET_INTERNAL_TABLE_ENTRY(UNIT_NAME, TABLE_ENTRY, FOUND); 
  17879.     if FOUND and then not STRING_PKG.IS_EMPTY(TABLE_ENTRY.WITHED_UNITS) then 
  17880.       TEMP := CONVERT_STRING_TO_LIST(VALUE(TABLE_ENTRY.WITHED_UNITS)); 
  17881.     end if; 
  17882.     return TEMP; 
  17883.   end GET_SPEC_WITH_LIST; 
  17884.  
  17885.   -----------------------------------------------------------------------------
  17886.  
  17887.   procedure SAVE_EXTERNAL_FILE is 
  17888.   --| Write the internal table list to the extenal file if it has changed.
  17889.  
  17890.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  17891.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  17892.  
  17893.   begin
  17894.     if INTERNAL_TABLE_CREATED and INTERNAL_TABLE_CHANGED then 
  17895.       begin
  17896.         OPEN(EXTERNAL_FILE, OUT_FILE, EXTERNAL_FILENAME); 
  17897.         RESET(EXTERNAL_FILE); 
  17898.  
  17899.       exception
  17900.         when TEXT_IO.NAME_ERROR => 
  17901.           CREATE(EXTERNAL_FILE, OUT_FILE, EXTERNAL_FILENAME); 
  17902.       end; 
  17903.  
  17904.       TABLE_POINTER := MAKELISTITER(INTERNAL_TABLE); 
  17905.  
  17906.       while MORE(TABLE_POINTER) loop
  17907.         NEXT(TABLE_POINTER, TABLE_ENTRY); 
  17908.  
  17909.         PUT(EXTERNAL_FILE, VALUE(TABLE_ENTRY.PACKAGE_ADA_NAME)); 
  17910.         PUT(EXTERNAL_FILE, TERMINATOR); 
  17911.  
  17912.         PUT(EXTERNAL_FILE, TABLE_ENTRY.PACKAGE_FILENAME); 
  17913.         PUT(EXTERNAL_FILE, TERMINATOR); 
  17914.  
  17915.         PUT(EXTERNAL_FILE, VALUE(TABLE_ENTRY.WITHED_UNITS)); 
  17916.         PUT(EXTERNAL_FILE, TERMINATOR); 
  17917.  
  17918.         PUT(EXTERNAL_FILE, TABLE_ENTRY.DATE_CREATED); 
  17919.         PUT(EXTERNAL_FILE, TERMINATOR); 
  17920.  
  17921.         PUT(EXTERNAL_FILE, TABLE_ENTRY.TIME_CREATED); 
  17922.         PUT(EXTERNAL_FILE, TERMINATOR); 
  17923.         NEW_LINE(EXTERNAL_FILE); 
  17924.       end loop; 
  17925.  
  17926.       CLOSE(EXTERNAL_FILE); 
  17927.       INTERNAL_LIST_PACKAGE.DESTROY(INTERNAL_TABLE); 
  17928.       INTERNAL_TABLE_CREATED := FALSE; 
  17929.       INTERNAL_TABLE_CHANGED := FALSE; 
  17930.     end if; 
  17931.   end SAVE_EXTERNAL_FILE; 
  17932.  
  17933.   ---------------------------------------------------------------
  17934.   --  External procedures for managing the temporary buffer file.
  17935.   ----------------------------------------------------------------
  17936.  
  17937.   procedure INITIALIZE is 
  17938.   begin
  17939.     if DIO.IS_OPEN(BUFFER_FILE) then
  17940.       DIO.RESET(BUFFER_FILE);
  17941.     else
  17942.       DIO.CREATE(BUFFER_FILE); 
  17943.     end if;
  17944.     INDEX_STACK := INDEX_STACK_PKG.CREATE; 
  17945.     STARTING_INDEX := DIO.INDEX(BUFFER_FILE); 
  17946.   end INITIALIZE; 
  17947.  
  17948.   ----------------------------------------------------------------
  17949.  
  17950.   procedure START_NEW_SECTION is 
  17951.  
  17952.   begin
  17953.     INDEX_STACK_PKG.PUSH(INDEX_STACK, STARTING_INDEX); 
  17954.     STARTING_INDEX := DIO.INDEX(BUFFER_FILE); 
  17955.   end START_NEW_SECTION; 
  17956.  
  17957.   ---------------------------------------------------------------
  17958.  
  17959.   procedure RELEASE_SECTION is 
  17960.  
  17961.   begin
  17962.     SET_INDEX(BUFFER_FILE, STARTING_INDEX); 
  17963.     INDEX_STACK_PKG.POP(INDEX_STACK, STARTING_INDEX); 
  17964.   end RELEASE_SECTION; 
  17965.  
  17966.   ----------------------------------------------------------------
  17967.  
  17968.   procedure WRITELN_TO_BUFFER(DIO_FILE     : in DIO.FILE_TYPE := BUFFER_FILE; 
  17969.                               LINE_OF_TEXT : in STRING) is
  17970.  
  17971.   begin
  17972.     for I in LINE_OF_TEXT'FIRST .. LINE_OF_TEXT'LAST loop
  17973.       DIO.WRITE(DIO_FILE, LINE_OF_TEXT(I)); 
  17974.     end loop; 
  17975.  
  17976.     DIO.WRITE(DIO_FILE, ASCII.CR); 
  17977.   end WRITELN_TO_BUFFER; 
  17978.  
  17979.   ----------------------------------------------------------------------
  17980.  
  17981.   procedure SAVE_BUFFER_FILE(PO_FILE : in SPO.PAGINATED_FILE_HANDLE) is 
  17982.  
  17983.     CURRENT_INDEX : DIO.COUNT; 
  17984.     CH            : CHARACTER; 
  17985.  
  17986.   begin
  17987.     CURRENT_INDEX := DIO.INDEX(BUFFER_FILE) - 1; 
  17988.     if STARTING_INDEX <= CURRENT_INDEX then 
  17989.       SPO.PUT_LINE(PO_FILE, ""); 
  17990.     end if; 
  17991.  
  17992.     for I in STARTING_INDEX .. CURRENT_INDEX loop
  17993.       DIO.READ(BUFFER_FILE, CH, I); 
  17994.       if CH = ASCII.CR then 
  17995.         SPO.PUT_LINE(PO_FILE, ""); 
  17996.       else 
  17997.         SPO.PUT(PO_FILE, CH); 
  17998.       end if; 
  17999.     end loop; 
  18000.   end SAVE_BUFFER_FILE; 
  18001.  
  18002.   ------------------------------------------------------------------------
  18003.   --  Local procedure bodies
  18004.   -------------------------------------------------------------------------
  18005.  
  18006.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN is 
  18007.  
  18008.   begin
  18009.     return EQUAL(X.PACKAGE_ADA_NAME, Y.PACKAGE_ADA_NAME) and then 
  18010.            X.PACKAGE_FILENAME = Y.PACKAGE_FILENAME and then 
  18011.            X.DATE_CREATED = Y.DATE_CREATED and then 
  18012.            X.TIME_CREATED = Y.TIME_CREATED; 
  18013.   end TABLE_EQUAL; 
  18014.  
  18015.   ---------------------------------------------------------
  18016.  
  18017.   function CONVERT_LIST_TO_STRING_TYPE(L : in STRING_LIST) 
  18018.        return STRING_TYPE is 
  18019.   
  18020.   --| Iterate through a list of string_types and collect
  18021.   --| all of the objects into one string_type, with each
  18022.   --| one separated by a blank.
  18023.  
  18024.     ITERATOR    : STRING_LISTS.LISTITER; 
  18025.     NEXT_OBJECT : STRING_TYPE; 
  18026.     TEMP        : STRING_TYPE := NO_NAME; 
  18027.     SPACE       : STRING_TYPE := CREATE(" "); 
  18028.   begin
  18029.     ITERATOR := STRING_LISTS.MAKELISTITER(L); 
  18030.     while MORE(ITERATOR) loop
  18031.       NEXT(ITERATOR, NEXT_OBJECT); 
  18032.       if EQUAL(TEMP, NO_NAME) then 
  18033.         TEMP := NEXT_OBJECT; 
  18034.       else 
  18035.         TEMP := TEMP & SPACE & NEXT_OBJECT; 
  18036.       end if; 
  18037.     end loop; 
  18038.     return TEMP; 
  18039.   end CONVERT_LIST_TO_STRING_TYPE; 
  18040.  
  18041.   ---------------------------------------------------------
  18042.  
  18043.   function CONVERT_STRING_TO_LIST(S : in STRING) return STRING_LIST is 
  18044.  
  18045.   --| Make a list of string_types out of a literal string.  Scan
  18046.   --| the input string for the next blank, or the end, and create
  18047.   --| a string_type object out of it to attach to the list.
  18048.  
  18049.     START : POSITIVE := 1; 
  18050.     TEMP  : STRING_LIST; 
  18051.  
  18052.   begin
  18053.     TEMP := STRING_LISTS.CREATE; 
  18054.     for I in S'FIRST .. S'LAST + 1 loop
  18055.       if (I = S'LAST + 1 or else S(I) = ' ') and then START < I then 
  18056.         STRING_LISTS.ATTACH(TEMP, CREATE(S(START .. I - 1))); 
  18057.         START := I + 1; 
  18058.       end if; 
  18059.     end loop; 
  18060.     return TEMP; 
  18061.   end CONVERT_STRING_TO_LIST; 
  18062.  
  18063.   ---------------------------------------------------------
  18064.  
  18065.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) 
  18066.        return STRING is 
  18067.  
  18068.   --| Read the next LENGTH characters from the external file
  18069.   --| and return them as a string.
  18070.  
  18071.     RETURN_STRING : STRING(1 .. LENGTH); 
  18072.     CH            : CHARACTER; 
  18073.     INDEX         : POSITIVE; 
  18074.   begin
  18075.     for I in RETURN_STRING'range loop
  18076.       GET(EXTERNAL_FILE, CH); 
  18077.       RETURN_STRING(I) := CH; 
  18078.     end loop; 
  18079.  
  18080.     -- read past the terminator
  18081.     if CH /= TERMINATOR then 
  18082.       GET(EXTERNAL_FILE, CH); 
  18083.     end if; 
  18084.     return RETURN_STRING; 
  18085.   end GET_FIXED_LENGTH_TABLE_ENTRY; 
  18086.  
  18087.   ---------------------------------------------------------
  18088.  
  18089.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE is 
  18090.   --| Scan the external file until a terminator ('*') is found,
  18091.   --| and return a string_type of the characters scanned.
  18092.  
  18093.     RETURN_STRING : STRING_TYPE; 
  18094.     CH            : CHARACTER := ' '; 
  18095.     TMP_STRING    : LONG_STRING; 
  18096.     INDEX         : NATURAL := 0; 
  18097.   begin
  18098.     RETURN_STRING := CREATE(""); 
  18099.     while CH /= TERMINATOR loop
  18100.       for I in LONG_STRING'range loop
  18101.         GET(EXTERNAL_FILE, CH); 
  18102.         exit when CH = TERMINATOR; 
  18103.         INDEX := I; 
  18104.         TMP_STRING(INDEX) := CH; 
  18105.       end loop; 
  18106.       RETURN_STRING := RETURN_STRING & CREATE(TMP_STRING(1 .. INDEX)); 
  18107.     end loop; 
  18108.     return RETURN_STRING; 
  18109.   end GET_VARIABLE_LENGTH_TABLE_ENTRY; 
  18110.  
  18111.   ---------------------------------------------------------
  18112.  
  18113.   procedure CREATE_INTERNAL_TABLE is 
  18114.     TABLE_ENTRY : TABLE_ENTRY_RECORD; 
  18115.   begin
  18116.     INTERNAL_TABLE := INTERNAL_LIST_PACKAGE.CREATE; 
  18117.     TEXT_IO.OPEN(EXTERNAL_FILE, IN_FILE, EXTERNAL_FILENAME); 
  18118.  
  18119.     while not TEXT_IO.END_OF_FILE(EXTERNAL_FILE) loop
  18120.       TABLE_ENTRY.PACKAGE_ADA_NAME := 
  18121.          MAKE_PERSISTENT(GET_VARIABLE_LENGTH_TABLE_ENTRY); 
  18122.       TABLE_ENTRY.PACKAGE_FILENAME := 
  18123.          GET_FIXED_LENGTH_TABLE_ENTRY(FILE_PREFIX_LIMIT); 
  18124.       TABLE_ENTRY.WITHED_UNITS := 
  18125.          MAKE_PERSISTENT(GET_VARIABLE_LENGTH_TABLE_ENTRY); 
  18126.       TABLE_ENTRY.DATE_CREATED := 
  18127.          GET_FIXED_LENGTH_TABLE_ENTRY(DATE_STRING'LENGTH); 
  18128.       TABLE_ENTRY.TIME_CREATED := 
  18129.          GET_FIXED_LENGTH_TABLE_ENTRY(TIME_STRING'LENGTH); 
  18130.       TEXT_IO.SKIP_LINE(EXTERNAL_FILE); 
  18131.       ATTACH(INTERNAL_TABLE, TABLE_ENTRY); 
  18132.     end loop; 
  18133.  
  18134.     INTERNAL_TABLE_CREATED := TRUE; 
  18135.     TEXT_IO.CLOSE(EXTERNAL_FILE); 
  18136.  
  18137.   exception
  18138.     when TEXT_IO.NAME_ERROR => 
  18139.       INTERNAL_TABLE_CREATED := TRUE; 
  18140.   end CREATE_INTERNAL_TABLE; 
  18141.  
  18142.   ---------------------------------------------------------
  18143.  
  18144.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) 
  18145.       return BOOLEAN is 
  18146.   --| Search the Internal_Table to see if the filename prefix
  18147.   --| string already exists.
  18148.  
  18149.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  18150.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  18151.  
  18152.   begin
  18153.     TABLE_POINTER := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  18154.  
  18155.     while MORE(TABLE_POINTER) loop
  18156.       NEXT(TABLE_POINTER, TABLE_ENTRY); 
  18157.       if TABLE_ENTRY.PACKAGE_FILENAME = FILENAME then 
  18158.         return TRUE; 
  18159.       end if; 
  18160.     end loop; 
  18161.  
  18162.     return FALSE; 
  18163.  
  18164.   end FILENAME_IN_TABLE; 
  18165.  
  18166.   ---------------------------------------------------------
  18167.  
  18168.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  18169.       return FILENAME_PREFIX_STRING is
  18170.   --| Formulate a unique filename prefix for each package name.
  18171.  
  18172.     FILENAME_STRING : FILENAME_PREFIX_STRING := (others => 'X'); 
  18173.     --| Name that will be returned
  18174.  
  18175.     FINDEX          : NATURAL := 1; 
  18176.  
  18177.     subtype A_TO_Z is CHARACTER range 'A' .. 'Z'; 
  18178.  
  18179.   begin
  18180.  
  18181.   -- Loop to extract the first "file_prefix_limit" characters 
  18182.   -- from the package name to form the prefix of the filename.
  18183.     for I in 1 .. PACKAGE_NAME'LENGTH loop
  18184.       if PACKAGE_NAME(I) /= '_' and PACKAGE_NAME(I) /= '.' then 
  18185.         FILENAME_STRING(FINDEX) := PACKAGE_NAME(I); 
  18186.         FINDEX := FINDEX + 1; 
  18187.         exit when FINDEX > FILE_PREFIX_LIMIT; 
  18188.       end if; 
  18189.     end loop; 
  18190.  
  18191.     --  Now check the Internal_Table to be sure that Filename_String
  18192.     --  is unique.  If not, replace successive characters in it from
  18193.     --  A to Z until a unique name is found.  This scheme allows 
  18194.     --  208,827,100,000 unique names.  If this is not sufficient, 
  18195.     --  digits could also be used for filename characters.
  18196.  
  18197.     MAIN_LOOP : for I in reverse 1 .. FILE_PREFIX_LIMIT loop
  18198.       for CH in A_TO_Z loop
  18199.         exit MAIN_LOOP when not FILENAME_IN_TABLE(FILENAME_STRING); 
  18200.         FILENAME_STRING(I) := CH; 
  18201.       end loop; 
  18202.     end loop MAIN_LOOP; 
  18203.  
  18204.     return FILENAME_STRING; 
  18205.  
  18206.   end MAKE_FILENAME_PREFIX; 
  18207.  
  18208.   ---------------------------------------------------------
  18209.  
  18210.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  18211.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  18212.                                      FOUND        : in out BOOLEAN) is 
  18213.  
  18214.     ITERATOR      : INTERNAL_LIST_PACKAGE.LISTITER; 
  18215.     NEXT_ENTRY    : TABLE_ENTRY_RECORD; 
  18216.     NAME_TO_MATCH : STRING_PKG.STRING_TYPE; 
  18217.  
  18218.   begin
  18219.     if not INTERNAL_TABLE_CREATED then 
  18220.       CREATE_INTERNAL_TABLE; 
  18221.     end if; 
  18222.  
  18223.     STRING_PKG.MARK; 
  18224.     NAME_TO_MATCH := UPPER(PACKAGE_NAME); 
  18225.  
  18226.     -- Initialize the OUT parameters to a Table_Entry_Record with
  18227.     -- all fields initialized to null, and false.
  18228.     TABLE_ENTRY := NEXT_ENTRY; 
  18229.     FOUND := FALSE; 
  18230.  
  18231.     ITERATOR := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  18232.     while MORE(ITERATOR) and not FOUND loop
  18233.       NEXT(ITERATOR, NEXT_ENTRY); 
  18234.       if EQUAL(NEXT_ENTRY.PACKAGE_ADA_NAME, NAME_TO_MATCH) then 
  18235.       -- update the OUT parameters
  18236.         TABLE_ENTRY := NEXT_ENTRY; 
  18237.         FOUND := TRUE; 
  18238.       end if; 
  18239.     end loop; 
  18240.  
  18241.     STRING_PKG.RELEASE; 
  18242.   end GET_INTERNAL_TABLE_ENTRY; 
  18243.  
  18244.   ---------------------------------------------------------
  18245.  
  18246.   function START_PACKAGE(PACKAGE_NAME : in STRING) 
  18247.       return FILENAME_PREFIX_STRING is 
  18248.   --| Create a table entry for the package and return its unique
  18249.   --| filename prefix.  This is called at the start of procedure
  18250.   --| Create_Package_Files.
  18251.  
  18252.     ENTRY_EXISTS          : BOOLEAN := FALSE; 
  18253.     CURRENT_TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  18254.     CURRENT_DATE_AND_TIME : CALENDAR.TIME; 
  18255.     CURRENT_DATE          : DATE_STRING; 
  18256.     CURRENT_TIME          : STRING(1 .. 11); 
  18257.  
  18258.   begin
  18259.  
  18260.   --  Check the Internal_Table to see if there is already an
  18261.   --  entry for this package.
  18262.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, CURRENT_TABLE_ENTRY, ENTRY_EXISTS); 
  18263.  
  18264.     if not ENTRY_EXISTS then 
  18265.       CURRENT_TABLE_ENTRY.PACKAGE_ADA_NAME := 
  18266.          MAKE_PERSISTENT(UPPER(PACKAGE_NAME)); 
  18267.       CURRENT_TABLE_ENTRY.PACKAGE_FILENAME :=
  18268.          MAKE_FILENAME_PREFIX(PACKAGE_NAME); 
  18269.     else 
  18270.     -- If the table entry exists, then delete it so the
  18271.     -- new one can be added with updated date and
  18272.     -- time fields.
  18273.  
  18274.       DELETEITEM(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  18275.  
  18276.     end if; 
  18277.  
  18278.     -- Get the date and time that the files are created or updated
  18279.     CURRENT_DATE_AND_TIME := CALENDAR.CLOCK; 
  18280.     CURRENT_DATE := DATE_OF(CALENDAR.CLOCK); 
  18281.     CURRENT_TIME := WALL_CLOCK_OF(CALENDAR.SECONDS(CURRENT_DATE_AND_TIME)); 
  18282.  
  18283.     CURRENT_TABLE_ENTRY.DATE_CREATED := CURRENT_DATE; 
  18284.     CURRENT_TABLE_ENTRY.TIME_CREATED := 
  18285.        CURRENT_TIME(1 .. TIME_STRING'LENGTH); 
  18286.  
  18287.     -- Attach the Current_Table_Entry to the list and set the "changed" flag
  18288.     -- so that the external file will be rewritten.
  18289.  
  18290.     ATTACH(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  18291.     INTERNAL_TABLE_CHANGED := TRUE; 
  18292.  
  18293.     return CURRENT_TABLE_ENTRY.PACKAGE_FILENAME; 
  18294.  
  18295.   end START_PACKAGE; 
  18296.  
  18297.   ---------------------------------------------------------------------------
  18298.  
  18299.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  18300.       return FILENAME_PREFIX_STRING is 
  18301.   --| Return the filename prefix for the specified package, or
  18302.   --| NO_FILENAME if there isn't an entry for the package.
  18303.  
  18304.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  18305.     ENTRY_EXISTS : BOOLEAN := FALSE; 
  18306.  
  18307.   begin
  18308.  
  18309.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  18310.  
  18311.     if not ENTRY_EXISTS then 
  18312.       return NO_FILENAME; 
  18313.     else 
  18314.       return TABLE_ENTRY.PACKAGE_FILENAME; 
  18315.     end if; 
  18316.  
  18317.   end GET_FILENAME_PREFIX; 
  18318.  
  18319.   -------------------------------------------------------------------------
  18320.  
  18321.   procedure DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING) is 
  18322.   --| Delete an entry from the internal table.
  18323.  
  18324.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  18325.     ENTRY_EXISTS : BOOLEAN := FALSE; 
  18326.  
  18327.   begin
  18328.  
  18329.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  18330.  
  18331.     if ENTRY_EXISTS then 
  18332.       DELETEITEM(INTERNAL_TABLE, TABLE_ENTRY); 
  18333.       INTERNAL_TABLE_CHANGED := TRUE; 
  18334.     end if; 
  18335.  
  18336.   end DELETE_INTERNAL_TABLE_ENTRY; 
  18337.  
  18338. ----------------------------------------------------------------------
  18339. end BUFFER_FILE_PACKAGE; 
  18340. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18341. --siutils.spc
  18342. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18343. with PARSERDECLARATIONS; 
  18344. with LISTS; 
  18345. with USER_INTERFACE; use USER_INTERFACE; 
  18346. package SOURCE_INSTRUMENTER_UTILITIES is 
  18347. --| Utilities for Source Instrumenter
  18348.  
  18349.  
  18350. --| Overview
  18351.  
  18352. --| This package contains all the utility subprograms for the source
  18353. --| instrumenter called from Parser.Parse and Parser.Apply_Actions.  Each
  18354. --| utility is described in detail below in its specification.
  18355.  
  18356.   package PD renames PARSERDECLARATIONS; 
  18357.  
  18358.   package COMMENT_LISTS is 
  18359.     new LISTS(PD.PARSESTACKELEMENT); 
  18360.  
  18361.   COMMENT_BUFFER : COMMENT_LISTS.LIST; 
  18362.   --| List of comments in between two tokens
  18363.  
  18364.   type POP_TO_WHERE is (TO_OUTPUT, TO_NOWHERE); 
  18365.   --| Used in popping closing identifiers/designators
  18366.  
  18367.   type ADD_BREAKPOINT_TYPE is (EVERY_STATEMENT, DECISION_POINT, ALWAYS, 
  18368.     AMBIGUOUS); 
  18369.  
  18370.   type RESOLVE_BREAKPOINT_TYPE is (SIMPLE_STATEMENT, LOOP_NO_IDENTIFIER, 
  18371.     LOOP_WITH_IDENTIFIER, BLOCK_NO_IDENTIFIER, BLOCK_WITH_IDENTIFIER); 
  18372.   type SCOPE_TYPE is (PACKAGE_SPECIFICATION, PACKAGE_BODY, TASK_BODY, 
  18373.     SUBPROGRAM_BODY, A_BLOCK); 
  18374.  
  18375.   type IDENTIFIER_MODE is (READ_ONLY, WRITE_ONLY, READ_WRITE, NONE); 
  18376.  
  18377.   type IDENTIFIER_LIST_TYPE is (OBJECT_LIST, RECORD_FIELD_LIST, 
  18378.     DISCRIMINANT_LIST, PARAMETER_LIST, RENAMING_LIST, EXCEPTION_LIST, 
  18379.     GENERIC_OBJECT_LIST); 
  18380.  
  18381.   type TYPE_CLASS is (DERIVED_TYPE, ENUMERATION_TYPE, INTEGER_TYPE, FLOAT_TYPE, 
  18382.     FIXED_TYPE, ACCESS_TYPE, ARRAY_TYPE, RECORD_TYPE, LIMITED_PRIVATE_TYPE, 
  18383.     PRIVATE_TYPE, TASK_TYPE); 
  18384.  
  18385.   DO_TYPE_TRACING     : BOOLEAN; 
  18386.   CURRENT_TRACE_MODE : TRACE_MODES; 
  18387.  
  18388.  
  18389.   -----------------------------------------------------------------
  18390.   --| Procedures for output formatting
  18391.   -----------------------------------------------------------------
  18392.  
  18393.   -----------------------------------------------------------------
  18394.  
  18395.   procedure INITIALIZE;  --| Initializes the utilities
  18396.  
  18397.   -----------------------------------------------------------------
  18398.  
  18399.   procedure PUT( --| Puts the token in the buffer or in the output file
  18400.                 NEXT_TOKEN : in out PD.PARSESTACKELEMENT); 
  18401.   --| Token that was just pushed on parse stack
  18402.  
  18403.   --| Effects
  18404.  
  18405.   --| Put examines the Buffering flag in 
  18406.   --| Pretty_Printer_Declarations to see whether buffering is turned on.
  18407.   --| If buffering is turned on, the token is placed in the buffer; if not,
  18408.   --| Print_Token is called to print the token.
  18409.  
  18410.   -----------------------------------------------------------------
  18411.  
  18412.   procedure PUT_SPACE(SPACES : in NATURAL := 1); 
  18413.   --| Puts a space in the output file.
  18414.  
  18415.   --| Effects
  18416.  
  18417.   --| Paginated Output is used to put a space in the output file.  The
  18418.   --| current column information is also updated.
  18419.  
  18420.   -----------------------------------------------------------------
  18421.  
  18422.   procedure PRINT_COMMENTS(BUFFER : in out COMMENT_LISTS.LIST); 
  18423.   --| Outputs buffered comments
  18424.  
  18425.   --| Effects
  18426.  
  18427.   --| If comment formatting is off, comments are output at the same
  18428.   --| line and column position as they appeared in the source.  If this
  18429.   --| is not possible, the comment is positioned at the next line and the
  18430.   --| source column.  If comment formatting is on, comments in the 
  18431.   --| declarative parts are printed alongside declarations; comments in
  18432.   --| the body are preceded by a blank line and indented to the level of
  18433.   --| the source if possible.  If a comment cannot be indented to the level
  18434.   --| of the source, it is handled the same way as comments with comment
  18435.   --| formatting off.
  18436.  
  18437.   -----------------------------------------------------------------
  18438.  
  18439.   procedure NEW_LINE;  --| Requests a new line in the buffer or output
  18440.  
  18441.   --| Effects
  18442.  
  18443.   --| New_Line examines the Buffering flag in Pretty_Printer_Declarations
  18444.   --| to see whether buffering is turned on, and requests a new line
  18445.   --| in the buffer or the output.
  18446.  
  18447.   -----------------------------------------------------------------
  18448.  
  18449.   procedure START_BUFFERING_COLON_DECLARATIONS; 
  18450.   --| Starts buffering colon declarations
  18451.  
  18452.   --| Effects
  18453.  
  18454.   --| Starts buffering the colon declarations or other constructs
  18455.   --| containing colons.
  18456.  
  18457.   -----------------------------------------------------------------
  18458.  
  18459.   procedure PRINT_COLON_DECLARATIONS_BUFFER; 
  18460.   --| Writes the colon declarations buffer to the output file
  18461.  
  18462.   --| Effects
  18463.  
  18464.   --| Writes the contents of the buffer to the output file,
  18465.   --| after lining up the colons.
  18466.  
  18467.   -----------------------------------------------------------------
  18468.  
  18469.   procedure INCREASE_INDENT;  --| Increases indent 
  18470.  
  18471.   --| Effects
  18472.  
  18473.   --| Requests an increase of the indent by PPD.Indentation_Level.
  18474.  
  18475.   --| Requires
  18476.  
  18477.   --| It is expected that New_Line will be called with each call to
  18478.   --| Increase_Indent, in order to keep the Current_Column information
  18479.   --| up to date.
  18480.  
  18481.   -----------------------------------------------------------------
  18482.  
  18483.   procedure DECREASE_INDENT;  --| Decreases indent 
  18484.  
  18485.   --| Effects
  18486.  
  18487.   --| Requests a decrease of the indent by PPD.Indentation_Level.
  18488.  
  18489.   --| Requires
  18490.  
  18491.   --| It is expected that New_Line will have been called before each call to
  18492.   --| Increase_Indent, in order to keep the Current_Column information
  18493.   --| up to date.
  18494.  
  18495.   -----------------------------------------------------------------
  18496.  
  18497.   procedure CHANGE_INDENT;  --| Changes the indent
  18498.  
  18499.   --| Effects
  18500.  
  18501.   --| Requests a change in  the indent by an amount other than 
  18502.   --| PPD.Indentation_Level.  Indent is changed to the current column.
  18503.   --| This procedure is used to line up parameter lists or discriminant 
  18504.   --| specification lists.
  18505.  
  18506.   --| Requires
  18507.  
  18508.   --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
  18509.   --| are expected to be called without any intervening Increase_Indent
  18510.   --| or Decrease_Indent calls.
  18511.  
  18512.   -----------------------------------------------------------------
  18513.  
  18514.   procedure RESUME_NORMAL_INDENTATION;  --| Changes the indent back
  18515.  
  18516.   --| Effects
  18517.  
  18518.   --| Changes the indent back to what it was before Change_Indent was
  18519.   --| called.
  18520.  
  18521.   --| Requires
  18522.  
  18523.   --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
  18524.   --| are expected to be called without any intervening Increase_Indent
  18525.   --| or Decrease_Indent calls.
  18526.  
  18527.   -----------------------------------------------------------------
  18528.  
  18529.   procedure POP_IDENTIFIER(WHERE : in POP_TO_WHERE := TO_NOWHERE); 
  18530.  
  18531.   --| Effects
  18532.  
  18533.   --| Pops an identifier off the stack of identifiers/designators.  Stack is
  18534.   --| used for keeping track of beginning and closing identifiers/designators
  18535.   --| so that default closing identifiers/designators can be output.
  18536.  
  18537.   -----------------------------------------------------------------
  18538.  
  18539.   procedure PUSH_IDENTIFIER; 
  18540.  
  18541.   --| Effects
  18542.  
  18543.   --| Pushes an identifier/designator on the identifier stack, which is used
  18544.   --| for keeping track of beginning and closing identifiers/designators, so
  18545.   --| that default closing identifiers can be filled in.
  18546.  
  18547.   -----------------------------------------------------------------
  18548.  
  18549.   procedure PUSH_EMPTY_TOKEN; 
  18550.  
  18551.   --| Effects
  18552.  
  18553.   --| Pushes the empty token on the stack of beginning/closing
  18554.   --| identifiers/designators.  This procedure exists to handle loop and
  18555.   --| block identifiers which are optional at both the beginning and end
  18556.   --| of the block.  If the identifier is left off, the empty
  18557.   --| empty token is pushed as the loop or block identifer in order
  18558.   --| to synchronize the stack when it is automatically popped at
  18559.   --| the end of a loop or block.
  18560.  
  18561.   -----------------------------------------------------------------
  18562.  
  18563.   procedure INSERT_IN_TOKEN; 
  18564.  
  18565.   --| Effects
  18566.  
  18567.   --| Inserts the token "in" into the output.  Called when subprogram
  18568.   --| specification with default parameters is found in the source.
  18569.  
  18570.   -----------------------------------------------------------------
  18571.  
  18572.   procedure SWITCH_COMMENT_CONTEXT; 
  18573.  
  18574.   -----------------------------------------------------------------
  18575.  
  18576.  
  18577.   -----------------------------------------------------------------
  18578.   --| Procedures for source instrumenting
  18579.   -----------------------------------------------------------------
  18580.  
  18581.  
  18582.   procedure USE_PACKAGE_NAME; 
  18583.  
  18584.   --| Effects
  18585.  
  18586.   --| The current expanded name is the package name in the
  18587.   --| use clause.  Turn off the Saving_Expanded_Name flag.
  18588.  
  18589.   -----------------------------------------------------------------
  18590.  
  18591.   procedure WITH_LIBRARY_UNIT; 
  18592.  
  18593.   --| Effects
  18594.  
  18595.   --| The current saved token is the name of a library unit
  18596.   --| in a with clause.  If Type_Tracing is on, then add its 
  18597.   --| name to the with_list.
  18598.  
  18599.   -----------------------------------------------------------------
  18600.  
  18601.   procedure START_SAVING_EXPANDED_NAME; 
  18602.  
  18603.   --| Effects
  18604.  
  18605.   --| Turn on the Saving_Expanded_Name flag to start saving
  18606.   --| tokens for an expanded name.
  18607.  
  18608.   -----------------------------------------------------------------
  18609.  
  18610.   procedure SAVE_SEPARATE_NAME; 
  18611.  
  18612.   --| Effects
  18613.  
  18614.   --| The current expanded name is the name of the parent unit.
  18615.   --| Turn off the Saving_Expanded_Name flag.
  18616.  
  18617.   -----------------------------------------------------------------
  18618.  
  18619.   procedure SAVE_GENERIC_NAME; 
  18620.  
  18621.   --| Effects
  18622.  
  18623.   --| The current expanded name is the generic unit name.
  18624.   --| Turn off the Saving_Expanded_Name flag.
  18625.  
  18626.   ------------------------------------------------------------------
  18627.  
  18628.   procedure SUBPROGRAM_TYPE(INTYPE : in STRING); 
  18629.  
  18630.   --| Effects
  18631.  
  18632.   --| This is called by apply_actions when it is known whether
  18633.   --| the current subprogram is a procedure or function.
  18634.  
  18635.   ------------------------------------------------------------------
  18636.  
  18637.   procedure START_BEGIN_END_BLOCK; 
  18638.  
  18639.   ------------------------------------------------------------------
  18640.  
  18641.   procedure END_BLOCK_SEQUENCE_OF_STATEMENTS; 
  18642.  
  18643.   ------------------------------------------------------------------
  18644.  
  18645.   procedure ADD_BREAKPOINT(TYPE_OF_BREAKPOINT : in ADD_BREAKPOINT_TYPE); 
  18646.  
  18647.   ------------------------------------------------------------------
  18648.  
  18649.   procedure RESOLVE_BREAKPOINT(RESOLVE_TYPE : in RESOLVE_BREAKPOINT_TYPE); 
  18650.  
  18651.   ------------------------------------------------------------------
  18652.  
  18653.   procedure START_LOOP; 
  18654.  
  18655.   -----------------------------------------------------------------
  18656.  
  18657.   procedure START_DELAY_EXPRESSION; 
  18658.  
  18659.   --| Effects
  18660.  
  18661.   --| Start the "Starting_Delay" function call to inform the
  18662.   --| profiler tool that the currently executing unit is 
  18663.   --| about to delay for the given amount of time.
  18664.  
  18665.   -----------------------------------------------------------------
  18666.  
  18667.   procedure END_DELAY_EXPRESSION; 
  18668.  
  18669.   --| Effects
  18670.  
  18671.   --| End the "Starting_Delay" function call.
  18672.  
  18673.   ------------------------------------------------------------------
  18674.  
  18675.   procedure ADD_PACKAGE_BODY_BEGIN; 
  18676.  
  18677.   ------------------------------------------------------------------
  18678.  
  18679.   procedure START_EXCEPTION_BRANCH; 
  18680.  
  18681.   ------------------------------------------------------------------
  18682.  
  18683.   procedure END_EXCEPTION_SEQUENCE_OF_STATEMENTS; 
  18684.  
  18685.   ------------------------------------------------------------------
  18686.  
  18687.   procedure ADD_OTHERS_HANDLER; 
  18688.  
  18689.   ------------------------------------------------------------------
  18690.  
  18691.   procedure END_BLOCK_STATEMENT;
  18692.  
  18693.   ------------------------------------------------------------------
  18694.  
  18695.   procedure ADD_EXCEPTION_HANDLER; 
  18696.  
  18697.   -----------------------------------------------------------------
  18698.  
  18699.   procedure END_COMPILATION_UNIT; 
  18700.  
  18701.   --| Effects
  18702.  
  18703.   --| Finish processing the current compilation unit, and reset
  18704.   --| local variables in case more compilation units follow.
  18705.  
  18706.   -----------------------------------------------------------------
  18707.  
  18708.   procedure INCREMENT_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE); 
  18709.  
  18710.   --| Effects
  18711.  
  18712.   --| This is called following the "is" of a program unit 
  18713.   --| declaration.  Stack any information from the outer scope.
  18714.   --| If the new scope is a package specification, and 
  18715.   --| Type_Tracing is on, then initialize the buffer files
  18716.   --| which will containg the information for tracing the 
  18717.   --| types and variables declared in the package.
  18718.  
  18719.   -----------------------------------------------------------------
  18720.  
  18721.   procedure DECREMENT_SCOPE; 
  18722.  
  18723.   --| Effects
  18724.  
  18725.   --| This is called following the "end [identifier];" of
  18726.   --| a program unit declaration.  If the program unit was
  18727.   --| a package specification, and Type_Tracing is on, then
  18728.   --| close the tracing packages.
  18729.   --| Pop any stacked information from the enclosing scope.
  18730.  
  18731.   -----------------------------------------------------------------
  18732.  
  18733.   procedure START_DECLARATIVE_PART; 
  18734.  
  18735.   --| Effects
  18736.  
  18737.   --| This is called at the start of a declarative part for
  18738.   --| a body.  If Type_Tracing is on, and then add the
  18739.   --| procedure declaration for tracing local variables.
  18740.   --| If the unit is a package body, then retrieve the
  18741.   --| declarations for tracing the private part of its 
  18742.   --| specification.
  18743.  
  18744.   ----------------------------------------------------------------
  18745.  
  18746.   procedure END_DECLARATIVE_PART; 
  18747.  
  18748.   --| Effects
  18749.  
  18750.   --| If Type_Tracing is on, then copy the subprogram bodies
  18751.   --| for type tracing into the instrumented source.  They were
  18752.   --| buffered until the end of the declarative part because
  18753.   --| bodies cannot be added until the "later declarative"
  18754.   --| part.  Procedure declarations for all of the bodies will
  18755.   --| have already been written to the instrumented source.
  18756.  
  18757.   -----------------------------------------------------------------
  18758.   procedure ADD_IDENTIFIER_TO_LIST; 
  18759.  
  18760.   --| Effects
  18761.  
  18762.   --| If Type_Tracing is on, then add the current identifier 
  18763.   --| to the identifier list. 
  18764.  
  18765.   -----------------------------------------------------------------
  18766.  
  18767.   procedure SET_IDENTIFIER_MODE(MODE : in IDENTIFIER_MODE); 
  18768.  
  18769.   --| Effects
  18770.  
  18771.   --| This procedure is called when the mode of current
  18772.   --| identifier list is known.  The type of the list is
  18773.   --| not known yet, so save the mode.
  18774.   --| The modes are:
  18775.   --|   READ_ONLY  :  IN parameters and constants
  18776.   --|   WRITE_ONLY : OUT parameters
  18777.   --|   READ_WRITE : IN OUT parameters and variables
  18778.   --|   NONE       : task type varaibles, exception identifiers
  18779.  
  18780.   -----------------------------------------------------------------
  18781.  
  18782.   procedure PROCESS_IDENTIFIER_LIST(LIST_TYPE : in IDENTIFIER_LIST_TYPE); 
  18783.  
  18784.   --| Effects
  18785.  
  18786.   --| This is called at the end of the current identifier list.
  18787.   --| Update the mode and type for all identifiers in the list,
  18788.   --| and save the list for later processing, depending on the
  18789.   --| List_Type.
  18790.  
  18791.   -----------------------------------------------------------------
  18792.  
  18793.   procedure SAVE_TYPE_IDENTIFIER; 
  18794.  
  18795.   --| Effects
  18796.  
  18797.   --| The current identifier is the name of the type in
  18798.   --| a type declaration.  Save it for later use.
  18799.  
  18800.   -----------------------------------------------------------------
  18801.  
  18802.   procedure START_TRACE_PROCEDURE(TYPE_KIND : in TYPE_CLASS); 
  18803.  
  18804.   --| Effects
  18805.  
  18806.   --| If type tracing is on, then start generating a 
  18807.   --| procedure to trace the current type declaration.
  18808.  
  18809.   -----------------------------------------------------------------
  18810.  
  18811.   procedure END_TYPE_DECLARATION; 
  18812.  
  18813.   --| Effects
  18814.  
  18815.   --| Finish the procedure to trace the current type
  18816.   --| declaration, and add the corresponding procedure
  18817.   --| declaration to the instrumented source.
  18818.  
  18819.   -----------------------------------------------------------------
  18820.  
  18821.   procedure START_ANONYMOUS_ARRAY_DEFINITION; 
  18822.  
  18823.   --| Effects
  18824.  
  18825.   --| These procedures are currently not implemented, and just
  18826.   --| discard the current identifier list.  It is intended that
  18827.   --| they will create a named type so a tracing procedure
  18828.   --| can be generated to trace the anonymous variables.
  18829.  
  18830.   -----------------------------------------------------------------
  18831.  
  18832.   procedure END_TYPEMARK; 
  18833.  
  18834.   --| Effects
  18835.  
  18836.   --| The current expanded name is a typemark name, (before
  18837.   --| any constraints which may follow).  Turn off the
  18838.   --| Saving_Expanded_Name flag.
  18839.  
  18840.   -----------------------------------------------------------------
  18841.  
  18842.   procedure START_PRIVATE_PART; 
  18843.  
  18844.   --| Effects
  18845.  
  18846.   --| If Type_Tracing is on, then initialize the private 
  18847.   --| type tracing files.
  18848.  
  18849.  
  18850. end SOURCE_INSTRUMENTER_UTILITIES; 
  18851. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18852. --siutils.bdy
  18853. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18854.  
  18855.  
  18856. -- packages needed by parsing 
  18857. with PARSETABLES; 
  18858. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS;  -- to get visibility on =
  18859. with PARSERDECLARATIONS; use PARSERDECLARATIONS; 
  18860.  
  18861. -- packages for abstract data types --
  18862. with UNCHECKED_DEALLOCATION; 
  18863. with STACK_PKG; 
  18864. with STRING_PKG; use STRING_PKG; 
  18865.  
  18866. -- packages needed for source instrumenting --
  18867. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS; 
  18868. with CREATE_BREAKPOINT; 
  18869. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; 
  18870.  
  18871. -- packages needed for source instrumenter output --
  18872. with CHANGE_TEXT; 
  18873. with SIMPLE_PAGINATED_OUTPUT; 
  18874. with BUFFER_FILE_PACKAGE; use BUFFER_FILE_PACKAGE; 
  18875. with TEXT_IO; 
  18876.  
  18877. package body SOURCE_INSTRUMENTER_UTILITIES is 
  18878. --| Utilities for the Source Instrumenter
  18879.  
  18880.   package SID renames SOURCE_INSTRUMENTER_DECLARATIONS; 
  18881.   package CT renames CHANGE_TEXT; 
  18882.   package PO renames SIMPLE_PAGINATED_OUTPUT; 
  18883.   package PT renames PARSETABLES; 
  18884.   package BFP renames BUFFER_FILE_PACKAGE; 
  18885.  
  18886.   package TOKEN_STACK_PKG is 
  18887.     new STACK_PKG(PD.PARSESTACKELEMENT); 
  18888.  
  18889.   -----------------------------------------------------------------
  18890.   -- Local declarations for formatting output
  18891.   -----------------------------------------------------------------
  18892.  
  18893.   IDENTIFIER_STACK      : TOKEN_STACK_PKG.STACK; 
  18894.   --| Stack of identifiers/designators
  18895.  
  18896.   BEGINNING_OF_LINE     : BOOLEAN := TRUE; 
  18897.   --| Tells whether the current column is at the beginning of a line
  18898.  
  18899.   CURRENT_COLUMN        : SID.COLUMN_RANGE := SID.COLUMN_RANGE'FIRST; 
  18900.   --| Current column in output file
  18901.  
  18902.   CURRENT_INDENT        : SID.INDENTATION_RANGE := 0; 
  18903.   --| Current indentation in output file
  18904.  
  18905.   TEMPORARY_INDENT      : SID.INDENTATION_RANGE := 0; 
  18906.   --| Temporary indentation in output file, when statement or declaration
  18907.   --| with no embedded requests for newlines is too big to fit on one line.
  18908.  
  18909.   PREVIOUS_INDENT       : SID.INDENTATION_RANGE := 0; 
  18910.   --| Saved indent for returning to after parameters or discriminants are
  18911.   --| lined up.
  18912.  
  18913.   CURRENT_CHANGE_COLUMN : SID.INDENTATION_RANGE := 0; 
  18914.   --| Column to change indent to
  18915.  
  18916.   UNPERFORMED_INDENTS   : NATURAL := 0; 
  18917.   --| The number of indents "requested" after the RH_Margin has been exceeded
  18918.   --| for situations where nesting is so deep that it is not
  18919.   --| worthwhile to further indent.
  18920.  
  18921.   EMPTY_TOKEN           : PD.PARSESTACKELEMENT := 
  18922.     (GRAM_SYM_VAL => PT.EMPTY_TOKENVALUE, 
  18923.      LEXED_TOKEN  => (TEXT => new STRING'(""), 
  18924.                       SRCPOS_LINE => 0, 
  18925.                       SRCPOS_COLUMN => 0)); 
  18926.  
  18927.   IDENTIFIER_TOKEN      : PD.PARSESTACKELEMENT := 
  18928.     (GRAM_SYM_VAL => PT.IDENTIFIERTOKENVALUE, 
  18929.      LEXED_TOKEN  => (TEXT => new STRING'(""), 
  18930.                       SRCPOS_LINE => 0, 
  18931.                       SRCPOS_COLUMN => 0)); 
  18932.  
  18933.   COLON_TOKEN           : PD.PARSESTACKELEMENT := 
  18934.     (GRAM_SYM_VAL => PT.COLON_TOKENVALUE, 
  18935.      LEXED_TOKEN  => (TEXT => new STRING'(":"), 
  18936.                       SRCPOS_LINE => 0, 
  18937.                       SRCPOS_COLUMN => 0)); 
  18938.  
  18939.   PREVIOUS_TOKEN        : PD.PARSESTACKELEMENT := EMPTY_TOKEN; 
  18940.   --| Previous Token from the input stream
  18941.  
  18942.   SAVED_TOKEN           : PD.PARSESTACKELEMENT := EMPTY_TOKEN; 
  18943.   --| Previous identifier or string literal, saved so that it may be stacked
  18944.   --| and closing identifiers printed. 
  18945.  
  18946.   type CONTEXT is (DECLARATIVE_PART, BODY_PART); 
  18947.   COMMENT_CONTEXT : CONTEXT := DECLARATIVE_PART; 
  18948.   --| Current Context for formatting comments
  18949.  
  18950.   type REQUEST_DESCRIPTOR is 
  18951.     record
  18952.       NEW_LINES : NATURAL := 0; 
  18953.       --| Number of times New_Line was called before printing new lines.
  18954.       INCREASES : NATURAL := 0; 
  18955.       --| Number of times Increase_Indent was called before processing
  18956.       --| any of these requests.
  18957.       DECREASES : NATURAL := 0; 
  18958.       --| Number of times Decrease_Indent was called before processing
  18959.       --| any of these requests.
  18960.       CHANGES   : NATURAL := 0; 
  18961.       --| Number of times Change_Indent was called before processing
  18962.       --| any of these requests.
  18963.       RESUMES   : NATURAL := 0; 
  18964.       --| Number of times Resume_Normal_Indentation was called before 
  18965.       --| processing any of these requests
  18966.     end record; 
  18967.  
  18968.   REQUESTS : REQUEST_DESCRIPTOR; 
  18969.  
  18970.   type TOKEN_DESCRIPTOR is 
  18971.     record
  18972.       TOKEN                 : PD.PARSESTACKELEMENT; 
  18973.       COMMENTS              : COMMENT_LISTS.LIST; 
  18974.       REQUESTS              : REQUEST_DESCRIPTOR; 
  18975.       CURRENT_CHANGE_COLUMN : SID.INDENTATION_RANGE := 0; 
  18976.       -- for lining up parameter/discriminant lists
  18977.       LEFT_SIDE_LENGTH      : NATURAL := 0;  -- for lining up colons
  18978.     end record; 
  18979.  
  18980.   TOKEN_TO_BUFFER        : TOKEN_DESCRIPTOR; 
  18981.  
  18982.   CURRENT_BUFFERED_TOKEN : TOKEN_DESCRIPTOR; 
  18983.  
  18984.   package TOKEN_LISTS is 
  18985.     new LISTS(TOKEN_DESCRIPTOR); 
  18986.  
  18987.   TOKEN_BUFFER                 : TOKEN_LISTS.LIST; 
  18988.   --|  The buffer used when buffering colon declarations.
  18989.  
  18990.   BUFFERED_TOKENS              : TOKEN_LISTS.LIST; 
  18991.   --|  The buffer used when buffering ambiguous statements.  For example, 
  18992.   --|  when processing a procedure call we don't know if it needs a
  18993.   --|  breakpont until the whole statement is processed.
  18994.  
  18995.   BUFFERING_COLON_DECLARATIONS : BOOLEAN := FALSE; 
  18996.   --| Whether or not to save declarations in order to line up the colons.
  18997.  
  18998.   BUFFERING_TOKENS             : BOOLEAN := TRUE; 
  18999.   --|  Whether not we are currently buffering an ambiguous statement.
  19000.  
  19001.   CURRENT_BLOCK_NUMBER         : NATURAL := 0; 
  19002.   --|  The number of current block(within the compilation unit).  Used to
  19003.   --|  assign an unique ID for unnamed blocks.
  19004.  
  19005.   CURRENT_NESTING_LEVEL        : NATURAL := 0; 
  19006.   --|  The current level of nesting.
  19007.  
  19008.   SUBPROGRAM_UNIT_TYPE         : PROGRAM_UNIT_TYPE; 
  19009.   --|  Saves the type of the current subprogram.
  19010.  
  19011.   CREATE_SUBUNIT               : BOOLEAN := FALSE; 
  19012.   --|  Whether or not a subunit containing a unit_information call should
  19013.   --|  be created for the current compilation unit.
  19014.  
  19015.   SEPARATE_UNIT                : BOOLEAN := FALSE; 
  19016.   --|  Whether or not the current compilation unit is a subunit.
  19017.  
  19018.   CURRENT_TRACE_LEVEL          : TRACE_LEVEL := DECISION_POINT; 
  19019.   --|  The statement trace level of the current unit.
  19020.  
  19021.   type SCOPE_DESCRIPTOR is 
  19022.     record
  19023.       SCOPE_NAME        : ADA_NAME; 
  19024.       QUALIFIED_NAME    : ADA_NAME; 
  19025.       TYPE_OF_SCOPE     : SCOPE_TYPE; 
  19026.       PUTVAR_NAME       : ADA_NAME; 
  19027.       IN_PRIVATE_PART   : BOOLEAN := FALSE; 
  19028.       SCOPE_TRACE_LEVEL : TRACE_LEVEL := DECISION_POINT; 
  19029.     end record; 
  19030.   --|  Maintains the information about a unit.
  19031.  
  19032.   package SCOPE_STACK_PKG is 
  19033.     new STACK_PKG(SCOPE_DESCRIPTOR); 
  19034.  
  19035.   SCOPE_STACK                  : SCOPE_STACK_PKG.STACK; 
  19036.   --|  Used to maintain the information about units when nesting occurs.
  19037.   --|  When a nested unit is encountered the enclosing units descriptor
  19038.   --|  is pushed onto the stack. When a nested unit is exited the stack
  19039.   --|  is popped to retrieve the enclosing units information.
  19040.  
  19041.   CURRENT_SCOPE                : SCOPE_DESCRIPTOR; 
  19042.   --|  Contains the information about the current unit.
  19043.  
  19044.   CURRENT_OUTER_SCOPE          : SCOPE_DESCRIPTOR; 
  19045.   --|  Contains the information about the enclosing unit(if any).
  19046.  
  19047.   CURRENT_SCOPE_QUALIFIED_NAME : STRING_TYPE; 
  19048.   --|  Maintains the full dot notated name of the current unit.
  19049.  
  19050.   CURRENT_SCOPE_SIMPLE_NAME    : STRING_TYPE; 
  19051.   --|  Contains the simple name of the current unit.  It is set in
  19052.   --|  pop identifier and then retrieved in increment_scope when a
  19053.   --|  unit body is found.
  19054.  
  19055.   -----------------------------------------------------------------
  19056.   -- Declarations for type and identifier tracing 
  19057.   -----------------------------------------------------------------
  19058.  
  19059.   OUTPUT_SOURCE                : BOOLEAN := TRUE; 
  19060.   --| The user may set this flag to False if he does not want the
  19061.   --| source for top level package specs included in the instrumented
  19062.   --| source file.  If the source is not included, then the package
  19063.   --| spec itself won't get re-compiled when the instrumented source 
  19064.   --| is compiled.  This allows for instrumenting a package spec
  19065.   --| without changing it.
  19066.  
  19067.   EXPANDED_NAME                : STRING_TYPE; 
  19068.   --| An Expanded_Name is a qualified name, as in X.Y.Z 
  19069.   --| Expanded_Name is a string_type collection of the tokens
  19070.   --| which make up the complete qualified name.  This is used
  19071.   --| in various places when a name which needs to be saved is 
  19072.   --| not a simple identifier.
  19073.  
  19074.   SAVING_EXPANDED_NAME         : BOOLEAN := FALSE; 
  19075.   --| This is set to true by applyactions at the start of an
  19076.   --| expanded name.  The text of all following tokens is
  19077.   --| appened to Expanded_Name until Saving_Expanded_Name is
  19078.   --| again set to false.
  19079.  
  19080.   GENERATE_TRACEVAR_SPEC       : BOOLEAN := FALSE; 
  19081.   --| This is set to true when the instrumenter is creating a
  19082.   --| a procedure body for tracing a type declaration.  The
  19083.   --| corresponding procedure declaration must be added to the
  19084.   --| instrumented source.
  19085.  
  19086.   CURRENT_TYPE_IDENTIFIER      : STRING_TYPE; 
  19087.   --| Save the last "Expanded_Name" that was built.  It is
  19088.   --| the name of the current type being declared, and will
  19089.   --| be needed to generate the tracing procedure.
  19090.  
  19091.   TRACEVAR_HEADER              : array(1 .. 4) of STRING_TYPE := 
  19092.     ((CREATE("Procedure Source_Instrumenter_Added_Tracevar")), 
  19093.      (CREATE("  (Current_Unit: Program_Unit_Unique_Identifier;")), 
  19094.      (CREATE("   Variable_Name: String;")), 
  19095.      (CREATE("   Current_Value:")));  -- the rest of this depends on
  19096.                                       -- the current type definition
  19097.   --| This is the invariant part of the tracevar procedure
  19098.   --| declaration.  
  19099.   --| Note: It is declared as an array of variable length strings
  19100.   --| rather than as one string with imbedded "ascii.cr" characters
  19101.   --| so that a "put_line" may be done on each array element,
  19102.   --| without regard to whether some systems need a line feed
  19103.   --| character before or after the carriage return.
  19104.  
  19105.   type NAME_RECORD is 
  19106.   --| for each identifier in an identifier list, save its name
  19107.   --| and its mode (Read_Only, Write_Only, Both, or None)
  19108.     record
  19109.       OBJECT_NAME : ADA_NAME; 
  19110.       OBJECT_MODE : IDENTIFIER_MODE; 
  19111.     end record; 
  19112.  
  19113.   package NAME_LISTS is 
  19114.     new LISTS(NAME_RECORD); 
  19115.     --| A list of name records for collecting identifier lists.
  19116.  
  19117.   package LIST_STACK_PKG is 
  19118.     new STACK_PKG(NAME_LISTS.LIST); 
  19119.     --| A stack of lists of Name_Records.
  19120.  
  19121.   VISIBLE_LIST_STACK : LIST_STACK_PKG.STACK; 
  19122.   --| The list of visible variables for the current scope
  19123.   --| is stacked when a nested scope is entered.
  19124.  
  19125.   package STRING_STACK_PKG is 
  19126.     new STACK_PKG(STRING_LIST); 
  19127.     --| A stack of lists of String_Type.
  19128.  
  19129.   VARS_TO_TRACE_STACK: STRING_STACK_PKG.STACK;
  19130.   --| The list of variables to be traced in this scope is
  19131.   --| stacked when a new scope is entered;
  19132.  
  19133.   PACKAGE_LIST_STACK : STRING_STACK_PKG.STACK; 
  19134.   --| The list of names of packages declared in the current
  19135.   --| scope is stacked when a new scope is entered.
  19136.  
  19137.   PARAM_LIST         : NAME_LISTS.LIST; 
  19138.   --| A list of formal parameters and their mode (in, out, or
  19139.   --| in out)
  19140.  
  19141.   VISIBLE_LIST       : NAME_LISTS.LIST; 
  19142.   --| A list of local variables and their mode (constant
  19143.   --| or variable)
  19144.  
  19145.   CURRENT_LIST       : NAME_LISTS.LIST; 
  19146.   --| A temporary list to collect identifiers until the type
  19147.   --| of identifier list is known.
  19148.  
  19149.   VARS_TO_TRACE     : STRING_lIST;
  19150.   --| A list of the variables the user wants to have traced
  19151.   --| in the current scope.
  19152.  
  19153.   PACKAGE_LIST       : STRING_LIST; 
  19154.   --| A list of packages declared in the current scope
  19155.  
  19156.   WITH_LIST          : STRING_LIST; 
  19157.   --| A list of instrumented library units from the current
  19158.   --| context clause.
  19159.  
  19160.   CURRENT_MODE       : IDENTIFIER_MODE := NONE; 
  19161.   --| This is set by a call from applyactions when the mode 
  19162.   --| of the current identifier list is known (following the
  19163.   --| colon in "identifer_list : ....".  Parsing has not
  19164.   --| reached the end of the list yet, so the mode must
  19165.   --| be saved.
  19166.  
  19167.   -----------------------------------------------------------------
  19168.   -- Local subprogram specifications for pretty printing
  19169.   -----------------------------------------------------------------
  19170.  
  19171.   procedure INITIALIZE_DESCRIPTOR(DESCRIPTOR : in out TOKEN_DESCRIPTOR); 
  19172.   --| Initializes an object of type Token_Descriptor
  19173.  
  19174.   -----------------------------------------------------------------
  19175.  
  19176.   procedure FREE is 
  19177.     new UNCHECKED_DEALLOCATION(STRING, PD.SOURCE_TEXT); 
  19178.  
  19179.     -----------------------------------------------------------------
  19180.  
  19181.   procedure PRINT_TOKEN(NEXT_TOKEN : in out PD.PARSESTACKELEMENT); 
  19182.   --| Prints Next_Token and updates column information
  19183.  
  19184.   -----------------------------------------------------------------
  19185.  
  19186.   function TOKEN_TEXT(TOKEN : in PD.PARSESTACKELEMENT) return STRING; 
  19187.   --| Returns the canonical "text" of a token (in extended character set)
  19188.  
  19189.   -----------------------------------------------------------------
  19190.  
  19191.   function SPACED_TOKEN(CURRENT, PREVIOUS : in PD.PARSESTACKELEMENT) 
  19192.     return STRING; 
  19193.   --| Returns the text of a token with appropriate spaces around it, in
  19194.   --| accordance with SID.Spacing_Table and any extra spaces that are
  19195.   --| necessary.
  19196.  
  19197.   -----------------------------------------------------------------
  19198.  
  19199.   procedure PRINT_NEW_LINE; 
  19200.   --| Puts a newline in the output and updates column information.
  19201.  
  19202.   -----------------------------------------------------------------
  19203.  
  19204.   procedure PROCESS_INCREASE_REQUESTS; 
  19205.   --| Increases the indentation unless SID.RH_Margin is exceeded, 
  19206.   --| in which case Unperformed_Indents is incremented.
  19207.  
  19208.   -----------------------------------------------------------------
  19209.  
  19210.   procedure PROCESS_DECREASE_REQUESTS; 
  19211.   --| Decreases the indentation unless there were unperformed indents,
  19212.   --| in which case Unperformed_Indents is decremented.
  19213.  
  19214.   -----------------------------------------------------------------
  19215.  
  19216.   procedure PROCESS_CHANGE_REQUESTS; 
  19217.   --| Changes the indentation to the current column
  19218.  
  19219.   -----------------------------------------------------------------
  19220.  
  19221.   procedure PROCESS_RESUME_REQUESTS; 
  19222.   --| Resumes the indentation level before the call to 
  19223.   --| Process_Change_Requests.
  19224.  
  19225.   -----------------------------------------------------------------
  19226.   -- Local subprogram specifications for source instrumenting
  19227.   -----------------------------------------------------------------
  19228.  
  19229.   -----------------------------------------------------------------
  19230.  
  19231.   procedure PRINT_BUFFERED_TOKENS; 
  19232.   --|  Prints any tokens that have been buffered due to an ambiguous
  19233.   --|  statement.
  19234.  
  19235.   -----------------------------------------------------------------
  19236.  
  19237.   function MATCH_NAMES(USER_NAME, SI_NAME : in STRING) return BOOLEAN;
  19238.   --| Compares the fully qualified name of the variable the user 
  19239.   --| wants to trace with the fully qualified variable name found 
  19240.   --| in the program.  The user requested variable name may have
  19241.   --| selected or indexed components.
  19242.  
  19243.   -----------------------------------------------------------------
  19244.  
  19245.   procedure CHECK_LISTS;
  19246.   --| In each scope, compare the list of variables the user requested 
  19247.   --| to trace with the list of variables found in the program.  If 
  19248.   --| the variable exists, trace it using the name the user gave to
  19249.   --| allow selected and indexed components.  
  19250.  
  19251.   -----------------------------------------------------------------
  19252.  
  19253.   function GET_UNIT_NAME(TYPE_OF_SCOPE : in SCOPE_TYPE) return STRING; 
  19254.   --|  Returns a string that contains the specification of the current
  19255.   --|  unit.  This string is printed to inform the user of the 
  19256.   --|  current unit being processed.
  19257.  
  19258.   -----------------------------------------------------------------
  19259.  
  19260.   procedure WRITE_BODY_LINE(LINE : in STRING); 
  19261.   --| The line of text is part of a procedure body being generated
  19262.   --| for type tracing.  It must be saved in one of the buffer files
  19263.   --| until the end of the current scope's "later_declarative_part".
  19264.  
  19265.   -----------------------------------------------------------------
  19266.  
  19267.   procedure WRITE_SPEC_LINE(LINE : in STRING); 
  19268.   --| The line of text is a procedure declaration or part of a
  19269.   --| package specification being generated for type tracing.
  19270.   --| Write it to either the instrumented source file or one
  19271.   --| of the package specification tracing files.
  19272.  
  19273.   -----------------------------------------------------------------
  19274.  
  19275.   procedure RETRIEVE_SPEC_WITH_LIST; 
  19276.   --| Get the names of any instrumented units that were named in
  19277.   --| the context clause of the package specification and merge
  19278.   --| the names into the with_list for the package body.
  19279.  
  19280.   -----------------------------------------------------------------
  19281.  
  19282.   procedure GENERATE_TRACEVAR_CALL(VARNAME : in STRING); 
  19283.   --| Add the code to the appropriate buffer to call the tracing
  19284.   --| procedure for the current variable.  This procedure is called
  19285.   --| by Generate_Putvars for each local variable.
  19286.  
  19287.   -----------------------------------------------------------------
  19288.  
  19289.   procedure GENERATE_PUTVARS; 
  19290.   --| Generate the body of the procedure which traces all of
  19291.   --| the variables visible in the current scope.
  19292.  
  19293.   -----------------------------------------------------------------
  19294.  
  19295.   procedure DISCARD_LIST(WHICH_LIST : in out NAME_LISTS.LIST); 
  19296.   --| A general purpose procedure which flushes the string_type
  19297.   --| field of a name_record before destroying the list.
  19298.  
  19299.   -----------------------------------------------------------------
  19300.  
  19301.   procedure ADD_WITHS_TO_BODY; 
  19302.   --| Add the necessary with and use clauses to a subprogram or
  19303.   --| package body.
  19304.  
  19305.   -----------------------------------------------------------------
  19306.  
  19307.   procedure ADD_WITHS_TO_TRACE_PACKAGES; 
  19308.   --| Add the necessary with and use clauses to the packages 
  19309.   --| generated to trace a package specification.  This procedure
  19310.   --| is called by Initialize_Trace_Packages.
  19311.  
  19312.   -----------------------------------------------------------------
  19313.  
  19314.   procedure INITIALIZE_TRACE_PACKAGES; 
  19315.   --| Start the packages that are created by the instrumenter for
  19316.   --| tracing package specifications.
  19317.  
  19318.   -----------------------------------------------------------------
  19319.  
  19320.   procedure CLOSE_TRACE_PACKAGES; 
  19321.   --| Finish and save the packages that are created for tracing
  19322.   --| package specificatiosn.
  19323.  
  19324.   -----------------------------------------------------------------
  19325.  
  19326.   procedure SET_SCOPE_RECORDS(TYPE_OF_SCOPE : in SCOPE_TYPE); 
  19327.   --| This is called by Increment_Scope to set the various fields
  19328.   --| of the Current_Scope and Current_Outer_Scope variables
  19329.   --| according to the current type of scope.
  19330.  
  19331.   -----------------------------------------------------------------
  19332.  
  19333.   function ASK_USER_ABOUT_PACKAGE return BOOLEAN; 
  19334.   --| Ask the user if he really wants to recompile a library unit
  19335.   --| that is a package specification. Doing so will require
  19336.   --| recompilation of the corresponding body, which only the user 
  19337.   --| knows if he has access to.
  19338.   --| If the answer is NO, then the text of the package specification
  19339.   --| will not be included in the instrumented source.
  19340.  
  19341.  
  19342.   -----------------------------------------------------------------
  19343.   -- External Subprogram Bodies for pretty printing
  19344.   -----------------------------------------------------------------
  19345.  
  19346.   procedure INITIALIZE is 
  19347.   begin
  19348.     IDENTIFIER_STACK := TOKEN_STACK_PKG.CREATE; 
  19349.     SCOPE_STACK := SCOPE_STACK_PKG.CREATE; 
  19350.     BEGINNING_OF_LINE := TRUE; 
  19351.     CURRENT_COLUMN := 1; 
  19352.     CURRENT_INDENT := 0; 
  19353.     TEMPORARY_INDENT := 0; 
  19354.     UNPERFORMED_INDENTS := 0; 
  19355.     EMPTY_TOKEN := (GRAM_SYM_VAL => PT.EMPTY_TOKENVALUE, 
  19356.                     LEXED_TOKEN  => (TEXT=> new STRING'(""), 
  19357.                                      SRCPOS_LINE => 0, 
  19358.                                      SRCPOS_COLUMN => 0)); 
  19359.     PREVIOUS_TOKEN := EMPTY_TOKEN; 
  19360.     SAVED_TOKEN := EMPTY_TOKEN; 
  19361.     REQUESTS := (0, 0, 0, 0, 0); 
  19362.  
  19363.     BUFFERING_COLON_DECLARATIONS := FALSE; 
  19364.     BUFFERING_TOKENS := TRUE; 
  19365.     BUFFERED_TOKENS := TOKEN_LISTS.CREATE; 
  19366.     INITIALIZE_DESCRIPTOR(CURRENT_BUFFERED_TOKEN); 
  19367.     INITIALIZE_DESCRIPTOR(TOKEN_TO_BUFFER);
  19368.  
  19369.     if CURRENT_TRACE_MODE /= MIXED then 
  19370.       CURRENT_TRACE_LEVEL := CURRENT_TRACE_MODE; 
  19371.     end if; 
  19372.  
  19373.     if DO_TYPE_TRACING then 
  19374.       BFP.INITIALIZE; 
  19375.     end if; 
  19376.  
  19377.     OUTPUT_SOURCE := TRUE; 
  19378.  
  19379.     WITH_LIST     := STRING_LISTS.CREATE; 
  19380.     PACKAGE_LIST  := STRING_LISTS.CREATE; 
  19381.     VARS_TO_TRACE := STRING_LISTS.CREATE;
  19382.     PARAM_LIST    := NAME_LISTS.CREATE; 
  19383.     VISIBLE_LIST  := NAME_LISTS.CREATE; 
  19384.     CURRENT_LIST  := NAME_LISTS.CREATE; 
  19385.  
  19386.     VISIBLE_LIST_STACK  := LIST_STACK_PKG.CREATE; 
  19387.     VARS_TO_TRACE_STACK := STRING_STACK_PKG.CREATE; 
  19388.     PACKAGE_LIST_STACK  := STRING_STACK_PKG.CREATE; 
  19389.   end INITIALIZE; 
  19390.  
  19391.   -----------------------------------------------------------------
  19392.  
  19393.   procedure PUT(NEXT_TOKEN : in out PD.PARSESTACKELEMENT) is 
  19394.     TEMP_TOKEN : TOKEN_DESCRIPTOR; 
  19395.   begin
  19396.  
  19397.     -- if the Token_To_Buffer belonged in the colon Token_Buffer, attach
  19398.     -- it there.  (Values have been assigned to Token_To_Buffer but it
  19399.     -- has not been attached to the buffer)
  19400.     if BUFFERING_COLON_DECLARATIONS and 
  19401.        (TOKEN_TO_BUFFER.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE) then 
  19402.       TOKEN_LISTS.ATTACH(TOKEN_BUFFER, TOKEN_TO_BUFFER); 
  19403.       INITIALIZE_DESCRIPTOR(TOKEN_TO_BUFFER); 
  19404.     end if; 
  19405.  
  19406.     if BUFFERING_TOKENS and 
  19407.        (CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE) and 
  19408.        not BUFFERING_COLON_DECLARATIONS then 
  19409.       CURRENT_BUFFERED_TOKEN.REQUESTS := REQUESTS; 
  19410.       REQUESTS := (0, 0, 0, 0, 0); 
  19411.       TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  19412.       INITIALIZE_DESCRIPTOR(CURRENT_BUFFERED_TOKEN); 
  19413.     end if; 
  19414.  
  19415.     -- function designator can be string literal or identifier, so save
  19416.     -- both, so closing identifier/designator can be printed.
  19417.     if (NEXT_TOKEN.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE) or 
  19418.        (NEXT_TOKEN.GRAM_SYM_VAL = PT.STRINGTOKENVALUE) then 
  19419.       SAVED_TOKEN := NEXT_TOKEN; 
  19420.     end if; 
  19421.  
  19422.     if SAVING_EXPANDED_NAME then 
  19423.       if IS_EMPTY(EXPANDED_NAME) then 
  19424.         EXPANDED_NAME := CREATE(TOKEN_TEXT(NEXT_TOKEN)); 
  19425.       else 
  19426.         EXPANDED_NAME := EXPANDED_NAME & TOKEN_TEXT(NEXT_TOKEN); 
  19427.       end if; 
  19428.     end if; 
  19429.  
  19430.     if BUFFERING_COLON_DECLARATIONS then 
  19431.       TOKEN_TO_BUFFER.TOKEN := NEXT_TOKEN; 
  19432.       TOKEN_TO_BUFFER.COMMENTS := COMMENT_BUFFER; 
  19433.     elsif BUFFERING_TOKENS then 
  19434.       INITIALIZE_DESCRIPTOR(CURRENT_BUFFERED_TOKEN); 
  19435.       CURRENT_BUFFERED_TOKEN.TOKEN := NEXT_TOKEN; 
  19436.       CURRENT_BUFFERED_TOKEN.COMMENTS := COMMENT_BUFFER; 
  19437.     else 
  19438.       PRINT_COMMENTS(COMMENT_BUFFER); 
  19439.       PRINT_TOKEN(NEXT_TOKEN); 
  19440.     end if; 
  19441.     CREATE_BREAKPOINT.BREAKPOINT_PRINTED_LAST := FALSE; 
  19442.   end PUT; 
  19443.  
  19444.   -----------------------------------------------------------------
  19445.  
  19446.   procedure PUT_SPACE(SPACES : in NATURAL := 1) is 
  19447.     BLANK : constant STRING := "                    " & 
  19448.       "                                                            "; 
  19449.   begin
  19450.     if BUFFERING_COLON_DECLARATIONS then 
  19451.       TOKEN_LISTS.ATTACH(TOKEN_BUFFER, TOKEN_TO_BUFFER); 
  19452.       INITIALIZE_DESCRIPTOR(TOKEN_TO_BUFFER); 
  19453.       TOKEN_TO_BUFFER.TOKEN := EMPTY_TOKEN; 
  19454.       TOKEN_TO_BUFFER.TOKEN.LEXED_TOKEN.TEXT := 
  19455.          new STRING'(BLANK(1 .. SPACES)); 
  19456.     elsif BUFFERING_TOKENS then 
  19457.       if CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE
  19458.         then 
  19459.         TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  19460.         INITIALIZE_DESCRIPTOR(CURRENT_BUFFERED_TOKEN); 
  19461.         CURRENT_BUFFERED_TOKEN.TOKEN := EMPTY_TOKEN; 
  19462.         CURRENT_BUFFERED_TOKEN.TOKEN.LEXED_TOKEN.TEXT := 
  19463.            new STRING'(BLANK(1 .. SPACES)); 
  19464.       else 
  19465.         null; --?????
  19466.       end if; 
  19467.     else 
  19468.       if CURRENT_COLUMN + SPACES - 1 > SID.PAGE_WIDTH then 
  19469.         PRINT_NEW_LINE; 
  19470.         TEMPORARY_INDENT := SID.INDENTATION_LEVEL; 
  19471.         CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  19472.       end if; 
  19473.  
  19474.       if BEGINNING_OF_LINE then 
  19475.         PO.SPACE(SID.LISTING_FILE, CURRENT_COLUMN - 1); 
  19476.         if OUTPUT_SOURCE then 
  19477.           PO.SPACE(SID.INSTRUMENTED_FILE, CURRENT_COLUMN - 1); 
  19478.         end if; 
  19479.       end if; 
  19480.       PO.SPACE(SID.LISTING_FILE, SPACES); 
  19481.       if OUTPUT_SOURCE then 
  19482.         PO.SPACE(SID.INSTRUMENTED_FILE, SPACES); 
  19483.       end if; 
  19484.       CURRENT_COLUMN := CURRENT_COLUMN + SPACES; 
  19485.     end if; 
  19486.   end PUT_SPACE; 
  19487.  
  19488.   -----------------------------------------------------------------
  19489.  
  19490.   procedure PRINT_COMMENTS(BUFFER : in out COMMENT_LISTS.LIST) is 
  19491.  
  19492.     ITER               : COMMENT_LISTS.LISTITER;  --| Iterates down comment list
  19493.     COMMENT_TOKEN      : PD.PARSESTACKELEMENT;  --| Element in list of comments
  19494.     NEW_LINES          : NATURAL := 0;  --| number of new_lines
  19495.     --| between comments
  19496.     SAVE_OUTPUT_SOURCE : BOOLEAN := OUTPUT_SOURCE; 
  19497.  
  19498.   begin
  19499.     OUTPUT_SOURCE := FALSE; 
  19500.     ITER := COMMENT_LISTS.MAKELISTITER(BUFFER); 
  19501.     if not COMMENT_LISTS.ISEMPTY(BUFFER) and (COMMENT_CONTEXT = BODY_PART) then 
  19502.  
  19503.       -- process all "requests" dealing with indentation before printing
  19504.       -- comments if comments are being formatted and the context is the 
  19505.       -- body part.  Process these first, so that Print_New_Line takes
  19506.       -- indentation into account.
  19507.  
  19508.       PROCESS_INCREASE_REQUESTS; 
  19509.       PROCESS_DECREASE_REQUESTS; 
  19510.       PROCESS_CHANGE_REQUESTS; 
  19511.       PROCESS_RESUME_REQUESTS; 
  19512.       if REQUESTS.NEW_LINES > 0 then 
  19513.         PRINT_NEW_LINE; 
  19514.         REQUESTS.NEW_LINES := 0; 
  19515.       end if; 
  19516.  
  19517.       -- print extra new line if not at the beginning of the line,
  19518.       -- to get to the beginning of a new line
  19519.       if not BEGINNING_OF_LINE then 
  19520.         PRINT_NEW_LINE; 
  19521.       end if; 
  19522.       PRINT_NEW_LINE; 
  19523.     end if; 
  19524.     while COMMENT_LISTS.MORE(ITER) loop
  19525.       COMMENT_LISTS.NEXT(ITER, COMMENT_TOKEN); 
  19526.  
  19527.       -- Print new lines between this comment token and
  19528.       -- previous token in source, unless new lines were already printed
  19529.       -- for comment formatting.
  19530.       NEW_LINES := 
  19531.         COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 
  19532.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE; 
  19533.       if (COMMENT_CONTEXT = DECLARATIVE_PART) or 
  19534.          (PREVIOUS_TOKEN.GRAM_SYM_VAL = PT.COMMENT_TOKENVALUE) then 
  19535.         for I in 1 .. NEW_LINES loop
  19536.           PRINT_NEW_LINE; 
  19537.         end loop; 
  19538.       end if; 
  19539.  
  19540.       -- try to indent to level of source 
  19541.       if ((SID.PAGE_WIDTH - CURRENT_COLUMN) >= TOKEN_TEXT(COMMENT_TOKEN)'LENGTH)
  19542.         then 
  19543.         if BEGINNING_OF_LINE then 
  19544.           PO.SPACE(SID.LISTING_FILE, 
  19545.                    CURRENT_COLUMN - 1 + 
  19546.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  19547.         else 
  19548.           -- put extra space in so comment is separated from previous
  19549.           -- token
  19550.           PUT_SPACE; 
  19551.         end if; 
  19552.       else 
  19553.         if NEW_LINES > 0 then 
  19554.           CURRENT_COLUMN := 1; 
  19555.         end if; 
  19556.  
  19557.         -- if comment can't go where it was in source, put it at same
  19558.         -- column on next line.
  19559.         if COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN < CURRENT_COLUMN then 
  19560.           PO.SKIP_LINE(SID.LISTING_FILE); 
  19561.           PO.SPACE(SID.LISTING_FILE, 
  19562.                    COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - 1 +
  19563.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  19564.         else 
  19565.           PO.SPACE(SID.LISTING_FILE, 
  19566.                    COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - 
  19567.                    CURRENT_COLUMN + 
  19568.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  19569.         end if; 
  19570.       end if; 
  19571.       PO.PUT(SID.LISTING_FILE, TOKEN_TEXT(COMMENT_TOKEN)); 
  19572.  
  19573.       FREE(COMMENT_TOKEN.LEXED_TOKEN.TEXT); 
  19574.       PREVIOUS_TOKEN := COMMENT_TOKEN; 
  19575.     end loop; 
  19576.  
  19577.     -- process any requests not handled earlier
  19578.     PROCESS_INCREASE_REQUESTS; 
  19579.     PROCESS_DECREASE_REQUESTS; 
  19580.     PROCESS_CHANGE_REQUESTS; 
  19581.     PROCESS_RESUME_REQUESTS; 
  19582.  
  19583.     OUTPUT_SOURCE := SAVE_OUTPUT_SOURCE; 
  19584.  
  19585.     -- if there were some comments in buffer put new line after them
  19586.     if (not COMMENT_LISTS.ISEMPTY(BUFFER)) then 
  19587.       PRINT_NEW_LINE; 
  19588.     else 
  19589.       for I in 1 .. REQUESTS.NEW_LINES loop
  19590.         PRINT_NEW_LINE; 
  19591.       end loop; 
  19592.     end if; 
  19593.     REQUESTS.NEW_LINES := 0; 
  19594.  
  19595.     COMMENT_LISTS.DESTROY(BUFFER); 
  19596.  
  19597.   end PRINT_COMMENTS; 
  19598.  
  19599.   -----------------------------------------------------------------
  19600.  
  19601.   procedure NEW_LINE is 
  19602.  
  19603.   --| Effects
  19604.   --|
  19605.   --| Requests a new_line for the output.  The newline is not actually
  19606.   --| printed here, in order that comments are put in the appropriate
  19607.   --| place.  The actual newline is printed in Print_New_Line.
  19608.   begin
  19609.     if BUFFERING_COLON_DECLARATIONS then 
  19610.       TOKEN_TO_BUFFER.REQUESTS.NEW_LINES := 
  19611.          TOKEN_TO_BUFFER.REQUESTS.NEW_LINES + 1; 
  19612.     else 
  19613.       REQUESTS.NEW_LINES := REQUESTS.NEW_LINES + 1; 
  19614.     end if; 
  19615.   end NEW_LINE; 
  19616.  
  19617.   -----------------------------------------------------------------
  19618.  
  19619.   procedure START_BUFFERING_COLON_DECLARATIONS is 
  19620.   begin
  19621.  
  19622.     -- create new list if not already buffering tokens 
  19623.     if not BUFFERING_COLON_DECLARATIONS then 
  19624.       BUFFERING_COLON_DECLARATIONS := TRUE; 
  19625.       TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  19626.       TOKEN_BUFFER := TOKEN_LISTS.CREATE; 
  19627.     end if; 
  19628.   end START_BUFFERING_COLON_DECLARATIONS; 
  19629.  
  19630.   -----------------------------------------------------------------
  19631.  
  19632.   procedure PRINT_COLON_DECLARATIONS_BUFFER is 
  19633.     ITERATOR       : TOKEN_LISTS.LISTITER; 
  19634.     BUFFERED_TOKEN : TOKEN_DESCRIPTOR; 
  19635.     SECOND_BUFFER  : TOKEN_LISTS.LIST := TOKEN_LISTS.CREATE; 
  19636.     CURRENT_LENGTH : NATURAL := 0; 
  19637.     MAX_LENGTH     : NATURAL := 0; 
  19638.   begin
  19639.     if CURRENT_NESTING_LEVEL > 0 then 
  19640.  
  19641.       -- attach last token to list.  Token would usually be attached
  19642.       -- in the call to put for the token following Token_To_Buffer.
  19643.       TOKEN_LISTS.ATTACH(TOKEN_BUFFER, TOKEN_TO_BUFFER); 
  19644.  
  19645.       BUFFERING_COLON_DECLARATIONS := FALSE; 
  19646.  
  19647.       -- get maximum identifier list length, updating tokens with length
  19648.       -- information, and attach each token to Second_Buffer with this
  19649.       -- new information.
  19650.       ITERATOR := TOKEN_LISTS.MAKELISTITER(TOKEN_BUFFER); 
  19651.       while TOKEN_LISTS.MORE(ITERATOR) loop
  19652.         TOKEN_LISTS.NEXT(ITERATOR, BUFFERED_TOKEN); 
  19653.  
  19654.         -- This can't be a case statement because of non-static bound
  19655.         -- of type for PT.xxxTokenValue
  19656.         if (BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE) or 
  19657.            (BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL = PT.COMMA_TOKENVALUE) then 
  19658.           if not COMMENT_LISTS.ISEMPTY(BUFFERED_TOKEN.COMMENTS) then 
  19659.             if CURRENT_LENGTH > MAX_LENGTH then 
  19660.               MAX_LENGTH := CURRENT_LENGTH; 
  19661.             end if; 
  19662.             CURRENT_LENGTH := 0; 
  19663.           end if; 
  19664.           CURRENT_LENGTH := CURRENT_LENGTH + 
  19665.             SPACED_TOKEN(BUFFERED_TOKEN.TOKEN, PREVIOUS_TOKEN)'LENGTH; 
  19666.           TOKEN_LISTS.ATTACH(SECOND_BUFFER, BUFFERED_TOKEN); 
  19667.         elsif (BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL = PT.COLON_TOKENVALUE) or
  19668.               (BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL = PT.NULLTOKENVALUE) then 
  19669.           if CURRENT_LENGTH > MAX_LENGTH then 
  19670.             MAX_LENGTH := CURRENT_LENGTH; 
  19671.           end if; 
  19672.           if COMMENT_LISTS.ISEMPTY(BUFFERED_TOKEN.COMMENTS) then 
  19673.             BUFFERED_TOKEN.LEFT_SIDE_LENGTH := CURRENT_LENGTH; 
  19674.           end if; 
  19675.           CURRENT_LENGTH := 0; 
  19676.           TOKEN_LISTS.ATTACH(SECOND_BUFFER, BUFFERED_TOKEN); 
  19677.  
  19678.           -- skip to semicolon
  19679.           while TOKEN_LISTS.MORE(ITERATOR) and 
  19680.              BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE loop
  19681.             TOKEN_LISTS.NEXT(ITERATOR, BUFFERED_TOKEN); 
  19682.             TOKEN_LISTS.ATTACH(SECOND_BUFFER, BUFFERED_TOKEN); 
  19683.           end loop; 
  19684.         elsif BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL in PT.GRAMMARSYMBOLRANGE then 
  19685.           TOKEN_LISTS.ATTACH(SECOND_BUFFER, BUFFERED_TOKEN); 
  19686.         end if; 
  19687.       end loop; 
  19688.  
  19689.       -- Print out Second_Buffer
  19690.       ITERATOR := TOKEN_LISTS.MAKELISTITER(SECOND_BUFFER); 
  19691.       while TOKEN_LISTS.MORE(ITERATOR) loop
  19692.         TOKEN_LISTS.NEXT(ITERATOR, BUFFERED_TOKEN); 
  19693.         PRINT_COMMENTS(BUFFERED_TOKEN.COMMENTS); 
  19694.         if (BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL = PT.COLON_TOKENVALUE) then 
  19695.           PUT_SPACE(MAX_LENGTH - BUFFERED_TOKEN.LEFT_SIDE_LENGTH); 
  19696.         end if; 
  19697.         PRINT_TOKEN(BUFFERED_TOKEN.TOKEN); 
  19698.         REQUESTS := BUFFERED_TOKEN.REQUESTS; 
  19699.         CURRENT_CHANGE_COLUMN := BUFFERED_TOKEN.CURRENT_CHANGE_COLUMN; 
  19700.       end loop; 
  19701.       TOKEN_LISTS.DESTROY(SECOND_BUFFER); 
  19702.  
  19703.       INITIALIZE_DESCRIPTOR(TOKEN_TO_BUFFER); 
  19704.       BUFFERING_COLON_DECLARATIONS := FALSE; 
  19705.     end if; 
  19706.   end PRINT_COLON_DECLARATIONS_BUFFER; 
  19707.  
  19708.   -----------------------------------------------------------------
  19709.  
  19710.   procedure INCREASE_INDENT is 
  19711.  
  19712.   --| Effects
  19713.   --|
  19714.   --| Requests an increase in indentation.  The increase is not actually
  19715.   --| processed here, in order that comments are put in the appropriate
  19716.   --| place.  The actual increase is processed in Process_Increase_Requests.
  19717.   begin
  19718.     if BUFFERING_COLON_DECLARATIONS then 
  19719.       TOKEN_TO_BUFFER.REQUESTS.INCREASES := 
  19720.          TOKEN_TO_BUFFER.REQUESTS.INCREASES + 1; 
  19721.     else 
  19722.       REQUESTS.INCREASES := REQUESTS.INCREASES + 1; 
  19723.     end if; 
  19724.   end INCREASE_INDENT; 
  19725.  
  19726.   -----------------------------------------------------------------
  19727.  
  19728.   procedure DECREASE_INDENT is 
  19729.  
  19730.   --| Effects
  19731.   --|
  19732.   --| Requests a decrease in indentation.  The decrease is not actually
  19733.   --| processed here, in order that comments are put in the appropriate
  19734.   --| place.  The actual decrease is processed in Process_Decrease_Requests.
  19735.   begin
  19736.     if BUFFERING_COLON_DECLARATIONS then 
  19737.       TOKEN_TO_BUFFER.REQUESTS.DECREASES := 
  19738.          TOKEN_TO_BUFFER.REQUESTS.DECREASES + 1; 
  19739.     else 
  19740.       REQUESTS.DECREASES := REQUESTS.DECREASES + 1; 
  19741.     end if; 
  19742.   end DECREASE_INDENT; 
  19743.  
  19744.   -----------------------------------------------------------------
  19745.  
  19746.   procedure CHANGE_INDENT is 
  19747.  
  19748.   --| Effects
  19749.   --|
  19750.   --| Requests a change in indentation.  The change is not actually
  19751.   --| processed here, in order that comments are put in the appropriate
  19752.   --| place.  The actual change is processed in Process_Change_Requests.
  19753.   begin
  19754.     if BUFFERING_COLON_DECLARATIONS then 
  19755.       TOKEN_TO_BUFFER.REQUESTS.CHANGES := TOKEN_TO_BUFFER.REQUESTS.CHANGES + 1; 
  19756.       TOKEN_TO_BUFFER.CURRENT_CHANGE_COLUMN := CURRENT_COLUMN; 
  19757.     elsif BUFFERING_TOKENS then 
  19758.       CURRENT_BUFFERED_TOKEN.REQUESTS.CHANGES := 
  19759.         CURRENT_BUFFERED_TOKEN.REQUESTS.CHANGES + 1; 
  19760.       CURRENT_BUFFERED_TOKEN.CURRENT_CHANGE_COLUMN := 
  19761.         CURRENT_BUFFERED_TOKEN.TOKEN.LEXED_TOKEN.SRCPOS_COLUMN; 
  19762.     else 
  19763.       REQUESTS.CHANGES := REQUESTS.CHANGES + 1; 
  19764.       CURRENT_CHANGE_COLUMN := CURRENT_COLUMN; 
  19765.     end if; 
  19766.   end CHANGE_INDENT; 
  19767.  
  19768.   -----------------------------------------------------------------
  19769.  
  19770.   procedure RESUME_NORMAL_INDENTATION is 
  19771.  
  19772.   --| Effects
  19773.   --|
  19774.   --| Requests a resume of the previous indentation.  This is not actually
  19775.   --| processed here, in order that comments are put in the appropriate
  19776.   --| place.  The actual resume is processed in Process_Resume_Requests.
  19777.   begin
  19778.     if BUFFERING_COLON_DECLARATIONS then 
  19779.       TOKEN_TO_BUFFER.REQUESTS.RESUMES := TOKEN_TO_BUFFER.REQUESTS.RESUMES + 1; 
  19780.     else 
  19781.       REQUESTS.RESUMES := REQUESTS.RESUMES + 1; 
  19782.     end if; 
  19783.   end RESUME_NORMAL_INDENTATION; 
  19784.  
  19785.   -----------------------------------------------------------------
  19786.  
  19787.   procedure POP_IDENTIFIER(WHERE : in POP_TO_WHERE := TO_NOWHERE) is 
  19788.     POPPED_TOKEN : PD.PARSESTACKELEMENT;  --| The token popped off stack 
  19789.   begin
  19790.     if (WHERE = TO_NOWHERE) then 
  19791.       TOKEN_STACK_PKG.POP(IDENTIFIER_STACK); 
  19792.     else 
  19793.       TOKEN_STACK_PKG.POP(IDENTIFIER_STACK, POPPED_TOKEN); 
  19794.       PUT(POPPED_TOKEN); 
  19795.     end if; 
  19796.  
  19797.     -- In case this was a subprogram declaration, then discard the
  19798.     -- parameter list that was built.
  19799.     TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  19800.     DISCARD_LIST(PARAM_LIST); 
  19801.     SAVING_EXPANDED_NAME := FALSE;
  19802.   end POP_IDENTIFIER; 
  19803.  
  19804.   -----------------------------------------------------------------
  19805.  
  19806.   procedure PUSH_IDENTIFIER is 
  19807.   begin
  19808.  
  19809.     -- set source line and column to 0 so that new column and line may
  19810.     -- be assigned when the pushed token is output as a closing designator
  19811.     -- or identifier.
  19812.     SAVED_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 0; 
  19813.     SAVED_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 0; 
  19814.     CURRENT_SCOPE_SIMPLE_NAME := CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  19815.     TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, SAVED_TOKEN); 
  19816.     TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  19817.   end PUSH_IDENTIFIER; 
  19818.  
  19819.   -----------------------------------------------------------------
  19820.  
  19821.   procedure PUSH_EMPTY_TOKEN is 
  19822.   begin
  19823.     TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, EMPTY_TOKEN); 
  19824.   end PUSH_EMPTY_TOKEN; 
  19825.  
  19826.   -----------------------------------------------------------------
  19827.  
  19828.   procedure INSERT_IN_TOKEN is 
  19829.     IN_TOKEN : PD.PARSESTACKELEMENT := 
  19830.       (GRAM_SYM_VAL => PT.INTOKENVALUE, 
  19831.        LEXED_TOKEN  => (TEXT => new STRING'("in"), 
  19832.                         SRCPOS_LINE => 0, 
  19833.                         SRCPOS_COLUMN => 0)); 
  19834.     --| "In" token with source line and column positions set to 0 so that
  19835.     --| new line and column positions may be assigned the token when it
  19836.     --| is output. 
  19837.   begin
  19838.     PUT(IN_TOKEN); 
  19839.   end INSERT_IN_TOKEN; 
  19840.  
  19841.   -----------------------------------------------------------------
  19842.  
  19843.   procedure SWITCH_COMMENT_CONTEXT is 
  19844.   begin
  19845.     if COMMENT_CONTEXT = DECLARATIVE_PART then 
  19846.       COMMENT_CONTEXT := BODY_PART; 
  19847.     else 
  19848.       COMMENT_CONTEXT := DECLARATIVE_PART; 
  19849.     end if; 
  19850.   end SWITCH_COMMENT_CONTEXT; 
  19851.  
  19852.  
  19853.   -----------------------------------------------------------------
  19854.   -- Local subprogram bodies for pretty printing
  19855.   -----------------------------------------------------------------
  19856.  
  19857.   procedure INITIALIZE_DESCRIPTOR(DESCRIPTOR : in out TOKEN_DESCRIPTOR) is 
  19858.   begin
  19859.  
  19860.     DESCRIPTOR.TOKEN := EMPTY_TOKEN; 
  19861.  
  19862.     -- Change grammar symbol to comment token value which it
  19863.     -- can never be (since comments are buffered separately)
  19864.     DESCRIPTOR.TOKEN.GRAM_SYM_VAL := PT.COMMENT_TOKENVALUE; 
  19865.     DESCRIPTOR.REQUESTS := (0, 0, 0, 0, 0); 
  19866.     DESCRIPTOR.CURRENT_CHANGE_COLUMN := 0; 
  19867.     DESCRIPTOR.LEFT_SIDE_LENGTH := 0; 
  19868.   end INITIALIZE_DESCRIPTOR; 
  19869.  
  19870.   -----------------------------------------------------------------
  19871.  
  19872.   procedure PRINT_TOKEN(NEXT_TOKEN : in out PD.PARSESTACKELEMENT) is 
  19873.  
  19874.     TOKEN_LENGTH : NATURAL := 0; 
  19875.     BLANK_LINES  : INTEGER := 0; 
  19876.  
  19877.   begin
  19878.  
  19879.     -- give line and column position to tokens being inserted that weren't
  19880.     -- in the source.
  19881.     if NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE = 0 then 
  19882.       NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 
  19883.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE; 
  19884.       NEXT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 
  19885.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN; 
  19886.     end if; 
  19887.  
  19888.     if (COMMENT_CONTEXT = DECLARATIVE_PART) or 
  19889.         ((COMMENT_CONTEXT = BODY_PART) and 
  19890.          (PREVIOUS_TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE)) then 
  19891.  
  19892.       -- print out any blank lines that appeared in source between the
  19893.       -- previous token and this one.
  19894.       BLANK_LINES := NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 
  19895.                      PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 1; 
  19896.  
  19897.       -- print extra new line if not at beginning of line, so blank line
  19898.       -- will be printed rather than just a new line
  19899.       if not BEGINNING_OF_LINE and (BLANK_LINES > 0) then 
  19900.         PRINT_NEW_LINE; 
  19901.       end if; 
  19902.       PO.SKIP_LINE(SID.LISTING_FILE, BLANK_LINES); 
  19903.       if OUTPUT_SOURCE then 
  19904.         PO.SKIP_LINE(SID.INSTRUMENTED_FILE, BLANK_LINES); 
  19905.       end if; 
  19906.     end if; 
  19907.  
  19908.     TOKEN_LENGTH := SPACED_TOKEN(NEXT_TOKEN, PREVIOUS_TOKEN)'LENGTH; 
  19909.  
  19910.     -- If adding this token will make the line longer than the
  19911.     -- page width then go to the next line and indent. 
  19912.     if (CURRENT_COLUMN + TOKEN_LENGTH - 1) > SID.PAGE_WIDTH then 
  19913.       PRINT_NEW_LINE; 
  19914.       TEMPORARY_INDENT := SID.INDENTATION_LEVEL; 
  19915.       CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  19916.     end if; 
  19917.  
  19918.     -- output spaces if at the beginning of the line to get to the current
  19919.     -- indentation level.
  19920.     if BEGINNING_OF_LINE then 
  19921.       PO.PUT(SID.LISTING_FILE, 
  19922.              CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING); 
  19923.       CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING := "      "; 
  19924.       PO.SPACE(SID.LISTING_FILE, CURRENT_COLUMN - 1); 
  19925.       if OUTPUT_SOURCE then 
  19926.         PO.SPACE(SID.INSTRUMENTED_FILE, CURRENT_COLUMN - 1); 
  19927.       end if; 
  19928.     end if; 
  19929.  
  19930.     -- Output token
  19931.     PO.PUT(SID.LISTING_FILE, SPACED_TOKEN(NEXT_TOKEN, PREVIOUS_TOKEN)); 
  19932.     if OUTPUT_SOURCE then 
  19933.       PO.PUT(SID.INSTRUMENTED_FILE, SPACED_TOKEN(NEXT_TOKEN, PREVIOUS_TOKEN)); 
  19934.     end if; 
  19935.  
  19936.     BEGINNING_OF_LINE := FALSE; 
  19937.  
  19938.     -- if the token was too big to fit even on the new line allocated it,
  19939.     -- set the current_column to the next line
  19940.     if TOKEN_LENGTH > SID.PAGE_WIDTH - CURRENT_INDENT then 
  19941.       PRINT_NEW_LINE; 
  19942.       TEMPORARY_INDENT := SID.INDENTATION_LEVEL; 
  19943.       CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  19944.     else 
  19945.       CURRENT_COLUMN := CURRENT_COLUMN + TOKEN_LENGTH; 
  19946.     end if; 
  19947.  
  19948.     if NEXT_TOKEN.GRAM_SYM_VAL /= PT.EMPTY_TOKENVALUE then 
  19949.       PREVIOUS_TOKEN := NEXT_TOKEN; 
  19950.     end if; 
  19951.   end PRINT_TOKEN; 
  19952.  
  19953.   -----------------------------------------------------------------
  19954.  
  19955.   function TOKEN_TEXT(TOKEN : in PD.PARSESTACKELEMENT) return STRING is 
  19956.   begin
  19957.     if (TOKEN.GRAM_SYM_VAL in PD.SINGLEDELIMITERRANGE) or (TOKEN.GRAM_SYM_VAL
  19958.       in PD.DOUBLEDELIMITERRANGE) then 
  19959.       if TOKEN.GRAM_SYM_VAL = PT.BAR_TOKENVALUE then 
  19960.         if SID.DELIMITERS = SID.BASIC then 
  19961.           return ("!"); 
  19962.         else 
  19963.           return ("|"); 
  19964.         end if; 
  19965.       else 
  19966.         return PT.GET_GRAMMAR_SYMBOL(TOKEN.GRAM_SYM_VAL); 
  19967.       end if; 
  19968.     elsif TOKEN.GRAM_SYM_VAL = PT.STRINGTOKENVALUE then 
  19969.       return CT.STRING_VALUE(TOKEN.LEXED_TOKEN.TEXT); 
  19970.     elsif TOKEN.GRAM_SYM_VAL = PT.CHARACTERTOKENVALUE then 
  19971.       return (TOKEN.LEXED_TOKEN.TEXT.all & "'"); 
  19972.     elsif TOKEN.GRAM_SYM_VAL = PT.COMMENT_TOKENVALUE then 
  19973.       return ("--" & TOKEN.LEXED_TOKEN.TEXT.all); 
  19974.     elsif TOKEN.GRAM_SYM_VAL in PD.RESERVEDWORDRANGE then 
  19975.       return CT.CHANGE_CASE(TOKEN.LEXED_TOKEN.TEXT, CT.LOWERCASE); 
  19976.     elsif TOKEN.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE then 
  19977.       return CT.CHANGE_CASE(TOKEN.LEXED_TOKEN.TEXT, CT.UPPERCASE); 
  19978.     elsif (TOKEN.GRAM_SYM_VAL = PT.NUMERICTOKENVALUE) and 
  19979.           (SID.DELIMITERS = SID.BASIC) then 
  19980.       return CT.CHANGE_SHARP(TOKEN.LEXED_TOKEN.TEXT); 
  19981.     else 
  19982.       return TOKEN.LEXED_TOKEN.TEXT.all; 
  19983.     end if; 
  19984.   end TOKEN_TEXT; 
  19985.  
  19986.   -----------------------------------------------------------------
  19987.  
  19988.   function SPACED_TOKEN(CURRENT, PREVIOUS : in PD.PARSESTACKELEMENT) return
  19989.     STRING is 
  19990.     PRECEDING_SPACE : BOOLEAN := FALSE; 
  19991.   begin
  19992.  
  19993.     -- Given context of Current and Previous grammar symbols, determine
  19994.     -- whether space should precede current token.
  19995.     -- This can't be a case statement because of non-static bound of
  19996.     -- GrammarSymbolRange, which is the type of all names of the
  19997.     -- form PT.xxxTokenValue
  19998.     if (CURRENT.GRAM_SYM_VAL = PT.MODTOKENVALUE) then 
  19999.       if PREVIOUS.GRAM_SYM_VAL /= PT.ATTOKENVALUE then 
  20000.         PRECEDING_SPACE := TRUE; 
  20001.       end if; 
  20002.     elsif (CURRENT.GRAM_SYM_VAL = PT.USETOKENVALUE) then 
  20003.       if PREVIOUS.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE then 
  20004.         PRECEDING_SPACE := TRUE; 
  20005.       end if; 
  20006.     elsif (CURRENT.GRAM_SYM_VAL = PT.COLONEQ_TOKENVALUE) then 
  20007.       if PREVIOUS.GRAM_SYM_VAL /= PT.CONSTANTTOKENVALUE then 
  20008.         PRECEDING_SPACE := TRUE; 
  20009.       end if; 
  20010.     elsif (CURRENT.GRAM_SYM_VAL = PT.THENTOKENVALUE) then 
  20011.       if PREVIOUS.GRAM_SYM_VAL /= PT.ANDTOKENVALUE then 
  20012.         PRECEDING_SPACE := TRUE; 
  20013.       end if; 
  20014.     elsif (CURRENT.GRAM_SYM_VAL = PT.INTOKENVALUE) or 
  20015.           (CURRENT.GRAM_SYM_VAL = PT.LOOPTOKENVALUE) then 
  20016.       if PREVIOUS.GRAM_SYM_VAL /= PT.COLON_TOKENVALUE then 
  20017.         PRECEDING_SPACE := TRUE; 
  20018.       end if; 
  20019.     elsif (CURRENT.GRAM_SYM_VAL = PT.PLUS_TOKENVALUE) or 
  20020.           (CURRENT.GRAM_SYM_VAL = PT.MINUS_TOKENVALUE) then 
  20021.       if PREVIOUS.GRAM_SYM_VAL /= PT.LEFTPAREN_TOKENVALUE then 
  20022.         PRECEDING_SPACE := TRUE; 
  20023.       end if; 
  20024.     elsif (CURRENT.GRAM_SYM_VAL = PT.WHENTOKENVALUE) then 
  20025.       if PREVIOUS.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE then 
  20026.         PRECEDING_SPACE := TRUE; 
  20027.       end if; 
  20028.     elsif (CURRENT.GRAM_SYM_VAL = PT.RANGETOKENVALUE) or 
  20029.           (CURRENT.GRAM_SYM_VAL = PT.DIGITSTOKENVALUE) or 
  20030.           (CURRENT.GRAM_SYM_VAL = PT.DELTATOKENVALUE) then 
  20031.       if (PREVIOUS.GRAM_SYM_VAL /= PT.APOSTROPHE_TOKENVALUE) and 
  20032.          (PREVIOUS.GRAM_SYM_VAL /= PT.ISTOKENVALUE) then 
  20033.         PRECEDING_SPACE := TRUE; 
  20034.       end if; 
  20035.     elsif (CURRENT.GRAM_SYM_VAL = PT.NOTTOKENVALUE) and
  20036.           (PREVIOUS.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE) then
  20037.       PRECEDING_SPACE := TRUE;
  20038.     elsif (PREVIOUS.GRAM_SYM_VAL = PT.CASETOKENVALUE) or 
  20039.           (PREVIOUS.GRAM_SYM_VAL = PT.DELTATOKENVALUE) or 
  20040.           (PREVIOUS.GRAM_SYM_VAL = PT.DIGITSTOKENVALUE) or
  20041.           (PREVIOUS.GRAM_SYM_VAL = PT.ENDTOKENVALUE) or 
  20042.           (PREVIOUS.GRAM_SYM_VAL = PT.EXITTOKENVALUE) or 
  20043.           (PREVIOUS.GRAM_SYM_VAL = PT.IFTOKENVALUE) or 
  20044.           (PREVIOUS.GRAM_SYM_VAL = PT.LOOPTOKENVALUE) or 
  20045.           (PREVIOUS.GRAM_SYM_VAL = PT.RETURNTOKENVALUE) or 
  20046.           (PREVIOUS.GRAM_SYM_VAL = PT.RAISETOKENVALUE) or 
  20047.           (PREVIOUS.GRAM_SYM_VAL = PT.RANGETOKENVALUE) or 
  20048.           (PREVIOUS.GRAM_SYM_VAL = PT.SELECTTOKENVALUE) then 
  20049.       if (CURRENT.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE) and 
  20050.           -- Empty Token handles pop of loop or block identifier. 
  20051.          (CURRENT.GRAM_SYM_VAL /= PT.EMPTY_TOKENVALUE) then 
  20052.         PRECEDING_SPACE := TRUE; 
  20053.       end if; 
  20054.     elsif (PREVIOUS.GRAM_SYM_VAL = PT.ABSTOKENVALUE) then 
  20055.       if CURRENT.GRAM_SYM_VAL /= PT.LEFTPAREN_TOKENVALUE then 
  20056.         PRECEDING_SPACE := TRUE; 
  20057.       end if; 
  20058.     end if; 
  20059.  
  20060.     -- Return the spaced token
  20061.     case SID.SPACING_TABLE(CURRENT.GRAM_SYM_VAL) is 
  20062.       when SID.AFTER => 
  20063.         if BEGINNING_OF_LINE or not PRECEDING_SPACE then 
  20064.           return TOKEN_TEXT(CURRENT) & " "; 
  20065.         else 
  20066.           return " " & TOKEN_TEXT(CURRENT) & " "; 
  20067.         end if; 
  20068.       when SID.BEFORE => 
  20069.         if BEGINNING_OF_LINE then 
  20070.           return TOKEN_TEXT(CURRENT); 
  20071.         else 
  20072.           return " " & TOKEN_TEXT(CURRENT); 
  20073.         end if; 
  20074.       when SID.AROUND => 
  20075.         if BEGINNING_OF_LINE then 
  20076.           return TOKEN_TEXT(CURRENT) & " "; 
  20077.         else 
  20078.           return " " & TOKEN_TEXT(CURRENT) & " "; 
  20079.         end if; 
  20080.       when SID.NONE => 
  20081.         if BEGINNING_OF_LINE or not PRECEDING_SPACE then 
  20082.           return TOKEN_TEXT(CURRENT); 
  20083.         else 
  20084.           return " " & TOKEN_TEXT(CURRENT); 
  20085.         end if; 
  20086.     end case; 
  20087.   end SPACED_TOKEN; 
  20088.  
  20089.   -----------------------------------------------------------------
  20090.  
  20091.   procedure PRINT_NEW_LINE is 
  20092.   begin
  20093.     TEMPORARY_INDENT := 0; 
  20094.     CURRENT_COLUMN := CURRENT_INDENT + 1; 
  20095.     if OUTPUT_SOURCE then 
  20096.       PO.SKIP_LINE(SID.INSTRUMENTED_FILE); 
  20097.     end if; 
  20098.     PO.SKIP_LINE(SID.LISTING_FILE); 
  20099.     BEGINNING_OF_LINE := TRUE; 
  20100.   end PRINT_NEW_LINE; 
  20101.  
  20102.   -----------------------------------------------------------------
  20103.  
  20104.   procedure PROCESS_INCREASE_REQUESTS is 
  20105.   begin
  20106.     for I in 1 .. REQUESTS.INCREASES loop
  20107.       if CURRENT_INDENT + SID.INDENTATION_LEVEL < SID.RH_MARGIN then 
  20108.         CURRENT_INDENT := CURRENT_INDENT + SID.INDENTATION_LEVEL; 
  20109.       else 
  20110.         UNPERFORMED_INDENTS := UNPERFORMED_INDENTS + 1; 
  20111.       end if; 
  20112.     end loop; 
  20113.     REQUESTS.INCREASES := 0; 
  20114.   end PROCESS_INCREASE_REQUESTS; 
  20115.  
  20116.   -----------------------------------------------------------------
  20117.  
  20118.   procedure PROCESS_DECREASE_REQUESTS is 
  20119.   begin
  20120.     for I in 1 .. REQUESTS.DECREASES loop
  20121.       if UNPERFORMED_INDENTS = 0 then 
  20122.         CURRENT_INDENT := CURRENT_INDENT - SID.INDENTATION_LEVEL; 
  20123.       else 
  20124.         UNPERFORMED_INDENTS := UNPERFORMED_INDENTS - 1; 
  20125.       end if; 
  20126.     end loop; 
  20127.     REQUESTS.DECREASES := 0; 
  20128.   end PROCESS_DECREASE_REQUESTS; 
  20129.  
  20130.   -----------------------------------------------------------------
  20131.  
  20132.   procedure PROCESS_CHANGE_REQUESTS is 
  20133.   begin
  20134.     if REQUESTS.CHANGES > 0 then 
  20135.       PREVIOUS_INDENT := CURRENT_INDENT; 
  20136.       if CURRENT_CHANGE_COLUMN < SID.RH_MARGIN then 
  20137.         CURRENT_INDENT := CURRENT_CHANGE_COLUMN - 1; 
  20138.       end if; 
  20139.  
  20140.       -- Since new line does not always occur before change_indent,
  20141.       -- need to update current column info.
  20142.       TEMPORARY_INDENT := 0; 
  20143.       CURRENT_COLUMN := CURRENT_INDENT + 1; 
  20144.     end if; 
  20145.     REQUESTS.CHANGES := 0; 
  20146.   end PROCESS_CHANGE_REQUESTS; 
  20147.  
  20148.   -----------------------------------------------------------------
  20149.  
  20150.   procedure PROCESS_RESUME_REQUESTS is 
  20151.   begin
  20152.     if REQUESTS.RESUMES > 0 then 
  20153.       CURRENT_INDENT := PREVIOUS_INDENT; 
  20154.     end if; 
  20155.     REQUESTS.RESUMES := 0; 
  20156.   end PROCESS_RESUME_REQUESTS; 
  20157.  
  20158.   -----------------------------------------------------------------
  20159.   --  External Procedures for Source Instrumenter
  20160.   -----------------------------------------------------------------
  20161.  
  20162.   procedure USE_PACKAGE_NAME is 
  20163.  
  20164.   --| Effects
  20165.   --|
  20166.   --| The current expanded name is the package name in the
  20167.   --| use clause.
  20168.  
  20169.   begin
  20170.     SAVING_EXPANDED_NAME := FALSE; 
  20171.   end USE_PACKAGE_NAME; 
  20172.  
  20173.   -----------------------------------------------------------------
  20174.  
  20175.   procedure WITH_LIBRARY_UNIT is 
  20176.  
  20177.   --| Effects
  20178.   --|
  20179.   --| If the library unit is instrumented and type tracing is on,
  20180.   --| then add the name to the "with_list".  Its tracing package
  20181.   --| will have to be added to the context clause in the instrumented
  20182.   --| source.
  20183.  
  20184.     WITHED_PACKAGE : NAME_RECORD; 
  20185.   begin
  20186.     if DO_TYPE_TRACING and then 
  20187.        BFP.PACKAGE_FILES_EXIST(SAVED_TOKEN.LEXED_TOKEN.TEXT.all, 
  20188.                                PUBLIC_FILES) then 
  20189.       STRING_LISTS.ATTACH(WITH_LIST, CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all)); 
  20190.     end if; 
  20191.   end WITH_LIBRARY_UNIT; 
  20192.  
  20193.   ------------------------------------------------------------------
  20194.  
  20195.   procedure START_SAVING_EXPANDED_NAME is 
  20196.  
  20197.   --| Effects
  20198.   --|
  20199.   --| Start saving tokens for an expanded name.
  20200.  
  20201.   begin
  20202.     FLUSH(EXPANDED_NAME); 
  20203.     SAVING_EXPANDED_NAME := TRUE; 
  20204.   end START_SAVING_EXPANDED_NAME; 
  20205.  
  20206.   -----------------------------------------------------------------
  20207.  
  20208.   procedure SAVE_SEPARATE_NAME is 
  20209.  
  20210.   --| Effects
  20211.   --|
  20212.   --| The current expanded name is the name of the parent unit.
  20213.   --| Use it to set the Current_Outer_Scope and turn off the
  20214.   --| "Saving_Expanded_Name" flag.
  20215.  
  20216.   begin
  20217.     SAVING_EXPANDED_NAME := FALSE; 
  20218.     SEPARATE_UNIT := TRUE; 
  20219.     CURRENT_OUTER_SCOPE := 
  20220.       (CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all), 
  20221.        EXPANDED_NAME, 
  20222.        A_BLOCK, 
  20223.        CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all), 
  20224.        FALSE, 
  20225.        ENTRY_EXIT); 
  20226.   end SAVE_SEPARATE_NAME; 
  20227.  
  20228.   -----------------------------------------------------------------
  20229.  
  20230.   procedure SAVE_GENERIC_NAME is 
  20231.  
  20232.   --| Effects
  20233.   --|
  20234.   --| The current expanded name is the generic unit name.  The
  20235.   --| instantiated name is in "Saved_Identifier".  Turn off the
  20236.   --| "Saving_Expanded_Name" flag.  Tracing generics is currently
  20237.   --| unimplemented.
  20238.  
  20239.   begin
  20240.     SAVING_EXPANDED_NAME := FALSE; 
  20241.   end SAVE_GENERIC_NAME; 
  20242.  
  20243.   ------------------------------------------------------------------
  20244.  
  20245.   procedure SUBPROGRAM_TYPE(INTYPE : in STRING) is 
  20246.  
  20247.   --|  Effects
  20248.   --|  
  20249.   --|  Saves the type of the current subprogram.  At increment scope
  20250.   --|  if the current unit is a subprogram then subprogram_unit_type
  20251.   --|  will be used to determine what kind of subprogram it is.
  20252.  
  20253.   begin
  20254.     if INTYPE = "procedure" then 
  20255.       SUBPROGRAM_UNIT_TYPE := PROCEDURE_TYPE; 
  20256.     else 
  20257.       SUBPROGRAM_UNIT_TYPE := FUNCTION_TYPE; 
  20258.       SAVING_EXPANDED_NAME := FALSE;
  20259.     end if; 
  20260.   end SUBPROGRAM_TYPE; 
  20261.  
  20262.   ------------------------------------------------------------------
  20263.  
  20264.   procedure START_BEGIN_END_BLOCK is 
  20265.  
  20266.   --|  Effects
  20267.   --|  
  20268.   --|  If this is a package body then add the call to UNIT_INFORMATION(we
  20269.   --|  are in the package body begin-end).  If the current unit is not
  20270.   --|  an block then output an entering unit call and a breakpoint.
  20271.  
  20272.   begin
  20273.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  20274.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  20275.          CURRENT_NESTING_LEVEL = 1 then 
  20276.         PRINT_COMMENTS(COMMENT_BUFFER); 
  20277.         CREATE_BREAKPOINT.CREATE_UNIT_INFORMATION; 
  20278.       end if; 
  20279.       CREATE_BREAKPOINT.CREATE_ENTERING_UNIT; 
  20280.       CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20281.                                           CURRENT_SCOPE.PUTVAR_NAME); 
  20282.     end if; 
  20283.   end START_BEGIN_END_BLOCK; 
  20284.  
  20285.   ------------------------------------------------------------------
  20286.  
  20287.   procedure END_BLOCK_SEQUENCE_OF_STATEMENTS is 
  20288.  
  20289.   --|  Effects
  20290.   --|  
  20291.   --|  If we are not in a block then output an exiting unit call and
  20292.   --|  a breakpoint.
  20293.  
  20294.   begin
  20295.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  20296.       CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20297.                                           CURRENT_SCOPE.PUTVAR_NAME); 
  20298.       CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  20299.     end if; 
  20300.   end END_BLOCK_SEQUENCE_OF_STATEMENTS; 
  20301.  
  20302.   -----------------------------------------------------------------
  20303.  
  20304.   procedure END_BLOCK_STATEMENT is
  20305.  
  20306.   --|  Effects
  20307.   --|  
  20308.   --|  We are exiting a scope, so if there is an outer scope then pop
  20309.   --|  the information about that scope so that it becomes the current 
  20310.   --|  unit.
  20311.  
  20312.   begin
  20313.     SCOPE_STACK_PKG.POP(SCOPE_STACK, CURRENT_SCOPE); 
  20314.     if not SCOPE_STACK_PKG.IS_EMPTY(SCOPE_STACK) then 
  20315.       CURRENT_OUTER_SCOPE := SCOPE_STACK_PKG.TOP(SCOPE_STACK); 
  20316.     else 
  20317.       CURRENT_OUTER_SCOPE := 
  20318.          (CREATE(""), 
  20319.           CREATE(""), 
  20320.           A_BLOCK, 
  20321.           CREATE(""), 
  20322.           FALSE, 
  20323.           ENTRY_EXIT); 
  20324.     end if; 
  20325.     CURRENT_SCOPE_QUALIFIED_NAME := CURRENT_SCOPE.QUALIFIED_NAME; 
  20326.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL - 1; 
  20327.   end END_BLOCK_STATEMENT;
  20328.  
  20329.   -----------------------------------------------------------------
  20330.  
  20331.   procedure ADD_BREAKPOINT(TYPE_OF_BREAKPOINT : in ADD_BREAKPOINT_TYPE) is 
  20332.  
  20333.   --|  Effects
  20334.   --|  
  20335.   --|  This procedure is called before every statement within a begin-end.
  20336.   --|  Based on the current trace_level and the type of statement, a 
  20337.   --|  decision is made whether to output a breakpoint.  If we don't
  20338.   --|  know whether or not to output a breakpont yet, then start
  20339.   --|  buffering tokens until we know.
  20340.  
  20341.   begin
  20342.     case TYPE_OF_BREAKPOINT is 
  20343.      
  20344.       when EVERY_STATEMENT => 
  20345.  
  20346.    -- current statement is a simple(non decision point) statement, so
  20347.    -- add a breakpoint only if trace level is every statement.
  20348.  
  20349.         if CURRENT_SCOPE.SCOPE_TRACE_LEVEL = ALL_STATEMENTS then 
  20350.           CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20351.                                               CURRENT_SCOPE.PUTVAR_NAME); 
  20352.         end if; 
  20353.       when DECISION_POINT => 
  20354.  
  20355.    -- Current statement is a decision point.  Add a breakpoint if
  20356.    -- we are not tracing entry/exit
  20357.  
  20358.         if CURRENT_SCOPE.SCOPE_TRACE_LEVEL /= ENTRY_EXIT then 
  20359.           CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20360.                                               CURRENT_SCOPE.PUTVAR_NAME); 
  20361.         end if; 
  20362.       when ALWAYS => 
  20363.  
  20364.    --  Current statement is a return statement.  Add a breakpoint and
  20365.    --  an exiting unit.
  20366.  
  20367.         CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20368.                                             CURRENT_SCOPE.PUTVAR_NAME); 
  20369.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  20370.       when AMBIGUOUS => 
  20371.  
  20372.    --  Type of Current statement is unknown, so if trace level is
  20373.    --  decision point start buffering tokens.  If trace level is
  20374.    --  every statement add a breakpoint.  If trace level is entry/exit
  20375.    --  then do nothing.
  20376.  
  20377.         case CURRENT_SCOPE.SCOPE_TRACE_LEVEL is 
  20378.           when ALL_STATEMENTS => 
  20379.             CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20380.                                                 CURRENT_SCOPE.PUTVAR_NAME); 
  20381.           when DECISION_POINT => 
  20382.             BUFFERING_TOKENS := TRUE; 
  20383.  
  20384.             --start buffer
  20385.             TOKEN_LISTS.DESTROY(BUFFERED_TOKENS);
  20386.             BUFFERED_TOKENS := TOKEN_LISTS.CREATE; 
  20387.             PRINT_COMMENTS(COMMENT_BUFFER); 
  20388.           when ENTRY_EXIT => 
  20389.             null; 
  20390.         end case; 
  20391.     end case; 
  20392.   end ADD_BREAKPOINT; 
  20393.  
  20394.   ------------------------------------------------------------------
  20395.  
  20396.   procedure RESOLVE_BREAKPOINT(RESOLVE_TYPE : in RESOLVE_BREAKPOINT_TYPE) is 
  20397.  
  20398.   --|  Effects
  20399.   --|  
  20400.   --|  The type of an ambiguous statement is now known.  If it was a decision
  20401.   --|  point then add a breakpoint. If it is a block statement, then
  20402.   --|  make the block the current scope.  If the block had no name then
  20403.   --|  make up a unique name for it.
  20404.  
  20405.     CURRENT_BLOCK_NUMBER_STRING : STRING_TYPE; 
  20406.   begin
  20407.     if CURRENT_SCOPE.SCOPE_TRACE_LEVEL = DECISION_POINT then 
  20408.       if (RESOLVE_TYPE = LOOP_NO_IDENTIFIER) or 
  20409.          (RESOLVE_TYPE = LOOP_WITH_IDENTIFIER) then 
  20410.         CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20411.                                             CURRENT_SCOPE.PUTVAR_NAME); 
  20412.       end if; 
  20413.       PRINT_BUFFERED_TOKENS; 
  20414.     end if; 
  20415.  
  20416.  -- The current statement is a block.  Add it to the scope stack.
  20417.  
  20418.     if (RESOLVE_TYPE = BLOCK_NO_IDENTIFIER) or 
  20419.        (RESOLVE_TYPE = BLOCK_WITH_IDENTIFIER) then 
  20420.       CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL + 1; 
  20421.       SCOPE_STACK_PKG.PUSH(SCOPE_STACK, CURRENT_SCOPE); 
  20422.       CURRENT_OUTER_SCOPE := CURRENT_SCOPE; 
  20423.  
  20424.   -- The block does not have a name, so make one for it.
  20425.  
  20426.       if RESOLVE_TYPE = BLOCK_NO_IDENTIFIER then 
  20427.         CURRENT_BLOCK_NUMBER := CURRENT_BLOCK_NUMBER + 1; 
  20428.         CURRENT_BLOCK_NUMBER_STRING := 
  20429.           CREATE(INTEGER'IMAGE(CURRENT_BLOCK_NUMBER)); 
  20430.         CURRENT_BLOCK_NUMBER_STRING := 
  20431.           "_" & SUBSTR(CURRENT_BLOCK_NUMBER_STRING, 2, 
  20432.                        LENGTH(CURRENT_BLOCK_NUMBER_STRING) - 1); 
  20433.         CURRENT_SCOPE_SIMPLE_NAME := 
  20434.           CREATE(PREFIX & "BLOCK" & VALUE(CURRENT_BLOCK_NUMBER_STRING)); 
  20435.         CURRENT_SCOPE_QUALIFIED_NAME := 
  20436.           CURRENT_SCOPE_QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  20437.         CURRENT_SCOPE := 
  20438.           (CURRENT_SCOPE_SIMPLE_NAME, 
  20439.            CURRENT_SCOPE_QUALIFIED_NAME, 
  20440.            A_BLOCK, 
  20441.            CURRENT_OUTER_SCOPE.PUTVAR_NAME, 
  20442.            FALSE, 
  20443.            CURRENT_TRACE_LEVEL); 
  20444.         if DO_TYPE_TRACING then 
  20445.           IDENTIFIER_TOKEN.LEXED_TOKEN.TEXT := 
  20446.             new STRING'(PREFIX & "BLOCK" & VALUE(CURRENT_BLOCK_NUMBER_STRING)); 
  20447.           IDENTIFIER_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 0; 
  20448.           IDENTIFIER_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 0; 
  20449.           TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, IDENTIFIER_TOKEN); 
  20450.           PUT(IDENTIFIER_TOKEN); 
  20451.           COLON_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 0; 
  20452.           COLON_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 0; 
  20453.           PUT(COLON_TOKEN); 
  20454.         else 
  20455.           PUSH_EMPTY_TOKEN; 
  20456.         end if; 
  20457.       else   -- block with identifier
  20458.         CURRENT_SCOPE_QUALIFIED_NAME := 
  20459.           CURRENT_SCOPE_QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  20460.         CURRENT_SCOPE := 
  20461.           (CURRENT_SCOPE_SIMPLE_NAME, 
  20462.            CURRENT_SCOPE_QUALIFIED_NAME, 
  20463.            A_BLOCK, 
  20464.            CURRENT_OUTER_SCOPE.PUTVAR_NAME, 
  20465.            FALSE, 
  20466.            CURRENT_TRACE_LEVEL); 
  20467.       end if; 
  20468.     end if; 
  20469.   end RESOLVE_BREAKPOINT; 
  20470.  
  20471.   ------------------------------------------------------------------
  20472.  
  20473.   procedure START_LOOP is 
  20474.  
  20475.   --|  Effects
  20476.   --|  
  20477.   --|  If trace level is not entry/exit then add a breakpoint that
  20478.   --|  identifies this statement as a loop.
  20479.  
  20480.   begin
  20481.     if CURRENT_SCOPE.SCOPE_TRACE_LEVEL /= ENTRY_EXIT then 
  20482.       CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_BREAKPOINT, 
  20483.                                           CURRENT_SCOPE.PUTVAR_NAME); 
  20484.     end if; 
  20485.   end START_LOOP; 
  20486.  
  20487.   -----------------------------------------------------------------
  20488.  
  20489.   procedure START_DELAY_EXPRESSION is 
  20490.  
  20491.   --| Effects
  20492.   --|
  20493.   --| Convert the delay expresstion into a function call to
  20494.   --| "Starting_Delay" which is a function that informs the profiler
  20495.   --| that the currently executing unit is about to delay the
  20496.   --| given amount of time.
  20497.  
  20498.   begin
  20499.     PO.PUT(SID.INSTRUMENTED_FILE, 
  20500.            "Starting_Delay (" & 
  20501.            VALUE(CREATE_BREAKPOINT.GET_PROGRAM_UNIT) & 
  20502.            ","); 
  20503.   end START_DELAY_EXPRESSION; 
  20504.  
  20505.   -----------------------------------------------------------------
  20506.  
  20507.   procedure END_DELAY_EXPRESSION is 
  20508.  
  20509.   --| Effects
  20510.   --|
  20511.   --| Finish the function call to "Starting_Delay".
  20512.  
  20513.   begin
  20514.     PO.PUT(SID.INSTRUMENTED_FILE, ")"); 
  20515.   end END_DELAY_EXPRESSION; 
  20516.  
  20517.   ------------------------------------------------------------------
  20518.  
  20519.   procedure ADD_PACKAGE_BODY_BEGIN is 
  20520.  
  20521.   --|  Effects
  20522.   --|  
  20523.   --|  If a package body that is a compilation unit does not have a
  20524.   --|  begin end block then add one that makes a call to unit
  20525.   --|  information.
  20526.  
  20527.   begin
  20528.     if CURRENT_NESTING_LEVEL = 1 then 
  20529.       PRINT_COMMENTS(COMMENT_BUFFER); 
  20530.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, "begin"); 
  20531.       CREATE_BREAKPOINT.CREATE_UNIT_INFORMATION; 
  20532.     end if; 
  20533.   end ADD_PACKAGE_BODY_BEGIN; 
  20534.  
  20535.   ------------------------------------------------------------------
  20536.  
  20537.   procedure START_EXCEPTION_BRANCH is 
  20538.  
  20539.   --|  Effects
  20540.   --|  
  20541.   --|  We are starting an exception branch in the source.  We must nest this 
  20542.   --|  in a begin-end block so that we can handle any exceptions raised
  20543.   --|  during execution of the exception handler.  
  20544.  
  20545.   begin
  20546.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then
  20547.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  20548.               CURRENT_NESTING_LEVEL > 1) then 
  20549.         PO.PUT(SID.INSTRUMENTED_FILE, "begin"); 
  20550.       end if; 
  20551.     end if;
  20552.   end START_EXCEPTION_BRANCH; 
  20553.  
  20554.   ------------------------------------------------------------------
  20555.  
  20556.   procedure END_EXCEPTION_SEQUENCE_OF_STATEMENTS is 
  20557.  
  20558.   --|  Effects
  20559.   --|  
  20560.   --|  The block that contains the exception handler must now be finished.
  20561.   --|  Add an others hanler for the block that calls exiting unit and then
  20562.   --|  re raises the exception.  This will inform the RTM that the unit
  20563.   --|  has exited, and then by reraising the exception will allow the
  20564.   --|  users code to execute normally.
  20565.  
  20566.   begin
  20567.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then
  20568.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  20569.               CURRENT_NESTING_LEVEL > 1) then 
  20570.         CREATE_BREAKPOINT.CREATE_BREAKPOINT(OTHER_BREAKPOINT, 
  20571.                                             CURRENT_SCOPE.PUTVAR_NAME); 
  20572.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  20573.         PO.PUT_LINE(SID.INSTRUMENTED_FILE, "exception"); 
  20574.         ADD_OTHERS_HANDLER; 
  20575.         PO.SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  20576.         PO.PUT(SID.INSTRUMENTED_FILE, "end;"); 
  20577.       end if; 
  20578.     end if;
  20579.   end END_EXCEPTION_SEQUENCE_OF_STATEMENTS; 
  20580.  
  20581.   ------------------------------------------------------------------
  20582.  
  20583.   procedure ADD_OTHERS_HANDLER is 
  20584.  
  20585.   --|  The source did not have an others handler so add one.  The others
  20586.   --|  handler that we add will call exiting unit and then reraise the
  20587.   --|  exception.
  20588.  
  20589.   begin
  20590.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  20591.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  20592.               CURRENT_NESTING_LEVEL > 1) then 
  20593.         PO.SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  20594.         PO.PUT(SID.INSTRUMENTED_FILE, "  when others =>"); 
  20595.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  20596.         PO.PUT(SID.INSTRUMENTED_FILE, "raise;"); 
  20597.       end if; 
  20598.     end if; 
  20599.   end ADD_OTHERS_HANDLER; 
  20600.  
  20601.   ------------------------------------------------------------------
  20602.  
  20603.   procedure ADD_EXCEPTION_HANDLER is 
  20604.  
  20605.   --|  Effects
  20606.   --|  
  20607.   --|  The source had no exception handler so add an exception handler
  20608.   --|  with an others branch.  In the others branch call exiting
  20609.   --|  unit and then re-raise the exception.
  20610.  
  20611.   begin
  20612.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  20613.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  20614.               CURRENT_NESTING_LEVEL > 1) then 
  20615.         PO.PUT(SID.INSTRUMENTED_FILE, "exception"); 
  20616.         PO.PUT_LINE(SID.INSTRUMENTED_FILE, "  when others =>"); 
  20617.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  20618.         PO.PUT(SID.INSTRUMENTED_FILE, "raise;"); 
  20619.       end if; 
  20620.     end if; 
  20621.   end ADD_EXCEPTION_HANDLER; 
  20622.  
  20623.   -----------------------------------------------------------------
  20624.  
  20625.   procedure END_COMPILATION_UNIT is 
  20626.  
  20627.   --| Effects
  20628.   --|
  20629.   --| Print any buffered tokens, and reset buffering and lists
  20630.   --| in case more compilation units follow.
  20631.  
  20632.   begin
  20633.  
  20634.     -- if the compilation unit was a subprogram declaration, then
  20635.     -- print any buffered tokens, and discard the with_list if
  20636.     -- there is one.
  20637.     if BUFFERING_TOKENS then 
  20638.       PRINT_BUFFERED_TOKENS; 
  20639.     end if; 
  20640.  
  20641.     if BUFFERING_COLON_DECLARATIONS then 
  20642.       PRINT_COLON_DECLARATIONS_BUFFER; 
  20643.     end if; 
  20644.  
  20645.     PROCESS_DECREASE_REQUESTS; 
  20646.  
  20647.     STRING_LISTS.DESTROY(WITH_LIST); 
  20648.  
  20649.     -- The current version of the file which maps package names to
  20650.     -- type tracing information files might have changed if there
  20651.     -- were any package specs in the program, so update it.
  20652.     BFP.SAVE_EXTERNAL_FILE; 
  20653.  
  20654.     -- End the current compilation unit with a new line, and restart
  20655.     -- buffering in case there are more compilation units to come.
  20656.     PRINT_NEW_LINE; 
  20657.     OUTPUT_SOURCE := TRUE; 
  20658.     BUFFERING_TOKENS := TRUE; 
  20659.     TOKEN_LISTS.DESTROY(BUFFERED_TOKENS);
  20660.     BUFFERED_TOKENS := TOKEN_LISTS.CREATE; 
  20661.   end END_COMPILATION_UNIT; 
  20662.  
  20663.   ----------------------------------------------------------------------------
  20664.  
  20665.   procedure INCREMENT_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE) is 
  20666.  
  20667.   --|Effects
  20668.   --|
  20669.   --|We have entered a new unit, so we must set up to process it.
  20670.   --|First determine the type of unit.  Next call set_scope_records
  20671.   --|to push any enclosing unit on the stack and to set up the current
  20672.   --|unit. If we need instrumenting instructions(doing type tracing or
  20673.   --|statement trace mode is mixed) then get the user input. Determine
  20674.   --|if this is a nested unit or a compilation unit and inform the
  20675.   --|create_breakpoint package.
  20676.  
  20677.     TYPE_OF_UNIT       : PROGRAM_UNIT_TYPE; 
  20678.  
  20679.   begin
  20680.     case TYPE_OF_SCOPE is 
  20681.       when PACKAGE_SPECIFICATION | PACKAGE_BODY => 
  20682.         TYPE_OF_UNIT := PACKAGE_TYPE; 
  20683.       when TASK_BODY => 
  20684.         TYPE_OF_UNIT := TASK_TYPE; 
  20685.       when SUBPROGRAM_BODY => 
  20686.         TYPE_OF_UNIT := SUBPROGRAM_UNIT_TYPE; 
  20687.       when others => 
  20688.         null; 
  20689.     end case; 
  20690.    
  20691.     SET_SCOPE_RECORDS (TYPE_OF_SCOPE); 
  20692.  
  20693.     if DO_TYPE_TRACING then 
  20694.       STRING_STACK_PKG.PUSH(VARS_TO_TRACE_STACK, VARS_TO_TRACE);
  20695.       VARS_TO_TRACE := STRING_LISTS.CREATE;
  20696.     end if;
  20697.     
  20698.     if DO_TYPE_TRACING or (CURRENT_TRACE_MODE = MIXED) then 
  20699.       GET_UNIT_INSTRUCTIONS(GET_UNIT_NAME (TYPE_OF_SCOPE), 
  20700.                             TYPE_OF_SCOPE = PACKAGE_SPECIFICATION, 
  20701.                             CURRENT_TRACE_LEVEL, 
  20702.                             VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  20703.                             VARS_TO_TRACE); 
  20704.     end if; 
  20705.  
  20706.     CURRENT_SCOPE.SCOPE_TRACE_LEVEL := CURRENT_TRACE_LEVEL;
  20707.  
  20708.     if TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  20709.  
  20710.       -- Delete any old type tracing files. New ones will be made if
  20711.       -- type tracing is on.
  20712.       BFP.DELETE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), ALL_FILES); 
  20713.  
  20714.       if CURRENT_NESTING_LEVEL = 0 then 
  20715.         -- ask user if he wants to recompile this package spec --
  20716.         OUTPUT_SOURCE := ASK_USER_ABOUT_PACKAGE; 
  20717.       end if; 
  20718.  
  20719.       if DO_TYPE_TRACING then 
  20720.         INITIALIZE_TRACE_PACKAGES; 
  20721.       end if; 
  20722.     end if;     -- type of scope = package spec
  20723.  
  20724.     if CURRENT_NESTING_LEVEL = 0 then 
  20725.       CREATE_SUBUNIT := (TYPE_OF_SCOPE = SUBPROGRAM_BODY); 
  20726.       if TYPE_OF_SCOPE = SUBPROGRAM_BODY or TYPE_OF_SCOPE = PACKAGE_BODY then 
  20727.         ADD_WITHS_TO_BODY; 
  20728.       end if; 
  20729.       CREATE_BREAKPOINT.NEW_COMPILATION_UNIT(CURRENT_SCOPE_QUALIFIED_NAME, 
  20730.                                              TYPE_OF_UNIT); 
  20731.     elsif TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then 
  20732.       -- Current_Nesting_Level /= 0
  20733.       CREATE_BREAKPOINT.START_PROGRAM_UNIT(CURRENT_SCOPE_QUALIFIED_NAME, 
  20734.                                            TYPE_OF_UNIT); 
  20735.     end if; 
  20736.  
  20737.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL + 1; 
  20738.     SAVING_EXPANDED_NAME := FALSE;
  20739.     PRINT_BUFFERED_TOKENS; 
  20740.  
  20741.     if BUFFERING_COLON_DECLARATIONS then 
  20742.       PRINT_COLON_DECLARATIONS_BUFFER; 
  20743.     end if; 
  20744.  
  20745.     SEPARATE_UNIT := FALSE; 
  20746.     SCOPE_STACK_PKG.PUSH(SCOPE_STACK, CURRENT_OUTER_SCOPE); 
  20747.   end INCREMENT_SCOPE; 
  20748.  
  20749.   ---------------------------------------------------------------
  20750.  
  20751.   procedure DECREMENT_SCOPE is 
  20752.  
  20753.   --|Effects
  20754.   --|
  20755.   --|We are exiting a unit.  Close trace packages if we are type tracing
  20756.   --|a package spec. Pop the enclosing unit's list of user requested
  20757.   --|variables to trace. Inform the create_breakpoint package that
  20758.   --|we are exiting the current unit.  Pop the information about
  20759.   --|the outer scope(if any) and set up the scope descriptors for
  20760.   --|current unit and current outer unit.
  20761.  
  20762.     USER_LIST_ITER      : STRING_LISTS.LISTITER;
  20763.     NEXT_USER_LIST_NAME : STRING_TYPE;
  20764.   begin
  20765.     if DO_TYPE_TRACING then 
  20766.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  20767.         CLOSE_TRACE_PACKAGES; 
  20768.       end if; 
  20769.  
  20770.       -- see if all requested variables were found
  20771.       if not STRING_LISTS.ISEMPTY (VARS_TO_TRACE) then
  20772.         USER_LIST_ITER := STRING_LISTS.MAKELISTITER(VARS_TO_TRACE); 
  20773.         STRING_LISTS.NEXT(USER_LIST_ITER, NEXT_USER_LIST_NAME); 
  20774.         if MATCH_S(UPPER(NEXT_USER_LIST_NAME),"*ALL") /= 0 then
  20775.           FLUSH(NEXT_USER_LIST_NAME);
  20776.         else
  20777.           -- if there are any names left in the user_list, 
  20778.           -- issue an error message.
  20779.           loop
  20780.             TEXT_IO.PUT_LINE(VALUE(NEXT_USER_LIST_NAME) & " not found"); 
  20781.             FLUSH(NEXT_USER_LIST_NAME);
  20782.             exit when not STRING_LISTS.MORE(USER_LIST_ITER);
  20783.             STRING_LISTS.NEXT(USER_LIST_ITER, NEXT_USER_LIST_NAME); 
  20784.           end loop; 
  20785.         end if; -- next_name /= *ALL
  20786.       end if; -- vars_to_trace not empty
  20787.  
  20788.       STRING_STACK_PKG.POP(VARS_TO_TRACE_STACK, VARS_TO_TRACE);
  20789.     end if;  -- if do_type_tracing
  20790.  
  20791.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION or 
  20792.       CURRENT_NESTING_LEVEL = 1 then 
  20793.       CREATE_BREAKPOINT.END_PROGRAM_UNIT; 
  20794.     end if; 
  20795.  
  20796.     SCOPE_STACK_PKG.POP(SCOPE_STACK, CURRENT_SCOPE); 
  20797.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL - 1; 
  20798.     if CURRENT_NESTING_LEVEL /= 0 then 
  20799.       CURRENT_OUTER_SCOPE := SCOPE_STACK_PKG.TOP(SCOPE_STACK); 
  20800.       CURRENT_SCOPE_QUALIFIED_NAME := CURRENT_SCOPE.QUALIFIED_NAME; 
  20801.       -- Push_Identifer always resets Current_Scope_Simple_Name
  20802.     end if; 
  20803.     TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  20804.   end DECREMENT_SCOPE; 
  20805.  
  20806.   -------------------------------------------------------------------
  20807.  
  20808.   procedure START_DECLARATIVE_PART is 
  20809.  
  20810.   --|Effects
  20811.   --|
  20812.   --|If we are in a subprogram that is a compilation unit, then define
  20813.   --|a unique call_unit_info for that unit.  For all units define a
  20814.   --|task number used in calls to the RTM. If type tracing is on then
  20815.   --|stack the outer scope's tracing information, re-initialize
  20816.   --|everything for the current scope, and generate the putvar procedure 
  20817.   --|declaration.
  20818.  
  20819.     TEMP_SCOPE : PD.PARSESTACKELEMENT; 
  20820.   begin
  20821.     if (CURRENT_NESTING_LEVEL = 1) and (CREATE_SUBUNIT = TRUE) then 
  20822.       PO.SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  20823.       PO.PUT(SID.INSTRUMENTED_FILE, 
  20824.         "procedure "
  20825.         & CT.CONVERT_PERIODS_TO_UNDERSCORES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME))
  20826.         & "_Call_Unit_Information;"); 
  20827.     end if; 
  20828.  
  20829.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  20830.       PO.SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  20831.       PO.PUT(SID.INSTRUMENTED_FILE, PREFIX & "Task_Number: natural := 1;"); 
  20832.     else 
  20833.       TEMP_SCOPE := TOKEN_STACK_PKG.TOP(IDENTIFIER_STACK); 
  20834.       CURRENT_SCOPE.PUTVAR_NAME := CREATE(TEMP_SCOPE.LEXED_TOKEN.TEXT.all); 
  20835.     end if; 
  20836.  
  20837.     -- Set up type tracing; the current declarative part is for
  20838.     -- a body or a block.
  20839.     if DO_TYPE_TRACING then 
  20840.       LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20841.       STRING_STACK_PKG.PUSH(PACKAGE_LIST_STACK, PACKAGE_LIST); 
  20842.       VISIBLE_LIST := NAME_LISTS.CREATE; 
  20843.       PACKAGE_LIST := STRING_LISTS.CREATE; 
  20844.  
  20845.       -- add procedure declaration for "putvars"
  20846.       WRITE_SPEC_LINE(""); 
  20847.       WRITE_SPEC_LINE("Procedure " & 
  20848.                        VALUE(CURRENT_SCOPE.SCOPE_NAME) & "_" & 
  20849.                        PREFIX & "Putvars;"); 
  20850.  
  20851.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then 
  20852.         BFP.COPY_PACKAGE_FILES(PRIVATE_SPEC, 
  20853.                                VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20854.                                SID.INSTRUMENTED_FILE); 
  20855.       end if; 
  20856.  
  20857.       if not NAME_LISTS.ISEMPTY(PARAM_LIST) then 
  20858.         NAME_LISTS.ATTACH(VISIBLE_LIST, NAME_LISTS.COPY(PARAM_LIST)); 
  20859.         NAME_LISTS.DESTROY(PARAM_LIST); 
  20860.       end if; 
  20861.  
  20862.       BFP.START_NEW_SECTION; 
  20863.     end if; 
  20864.   end START_DECLARATIVE_PART; 
  20865.  
  20866.   ----------------------------------------------------------------
  20867.  
  20868.   procedure END_DECLARATIVE_PART is 
  20869.  
  20870.   --|Effects
  20871.   --|
  20872.   --|If this is the declarative part of a compilation unit that is a procedure
  20873.   --|then define the unique call_unit_information to be a subunit.  If
  20874.   --|we are doing type tracing 1) if it is a package body, then retieve
  20875.   --|the instrumenting information file for the private part of the 
  20876.   --|corresponding package spec. 2) Finish generating th tracing procedures.
  20877.   --|3) Copy the procedure bodies from the buffer file that were saved
  20878.   --|until the end of the later declarative part. 4) If there were
  20879.   --|any user requested variables to trace that weren't found then
  20880.   --|issue an error message.
  20881.  
  20882.     ITER        : STRING_LISTS.LISTITER; 
  20883.     NEXT_OBJECT : STRING_TYPE; 
  20884.   begin
  20885.     if (CURRENT_NESTING_LEVEL = 1) and (CREATE_SUBUNIT = TRUE) then 
  20886.       PO.SPACE_LINE(SID.INSTRUMENTED_FILE, 1); 
  20887.       PO.PUT(SID.INSTRUMENTED_FILE, 
  20888.        "procedure "
  20889.         & CT.CONVERT_PERIODS_TO_UNDERSCORES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME))
  20890.         & "_Call_Unit_Information is separate;"); 
  20891.     end if; 
  20892.  
  20893.     -- Finish the type tracing for this declarative part; the
  20894.     -- "begin ... end" part follows next.
  20895.     if DO_TYPE_TRACING then 
  20896.       GENERATE_PUTVARS;
  20897.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then 
  20898.         BFP.COPY_PACKAGE_FILES(PRIVATE_BODY, 
  20899.                                VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  20900.                                SID.INSTRUMENTED_FILE); 
  20901.       end if; 
  20902.  
  20903.       ITER := STRING_LISTS.MAKELISTITER(PACKAGE_LIST); 
  20904.       while STRING_LISTS.MORE(ITER) loop
  20905.         STRING_LISTS.NEXT(ITER, NEXT_OBJECT); 
  20906.         BFP.COPY_PACKAGE_FILES(PUBLIC_BODY, 
  20907.                                VALUE(CURRENT_SCOPE.QUALIFIED_NAME & 
  20908.                                      "." & NEXT_OBJECT), 
  20909.                                SID.INSTRUMENTED_FILE); 
  20910.         FLUSH(NEXT_OBJECT); 
  20911.       end loop; 
  20912.       STRING_LISTS.DESTROY(PACKAGE_LIST); 
  20913.  
  20914.       BFP.SAVE_BUFFER_FILE(SID.INSTRUMENTED_FILE); 
  20915.       BFP.RELEASE_SECTION; 
  20916.       LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20917.       STRING_STACK_PKG.POP(PACKAGE_LIST_STACK, PACKAGE_LIST); 
  20918.     end if; 
  20919.   end END_DECLARATIVE_PART; 
  20920.  
  20921.   -----------------------------------------------------------------
  20922.   procedure ADD_IDENTIFIER_TO_LIST is 
  20923.  
  20924.   --| Effects
  20925.   --|
  20926.   --| If type tracing is on, add the current identifier to "current_list". 
  20927.   --| The current identifier's name is in Saved_Token.
  20928.  
  20929.     CURRENT_NAME : NAME_RECORD; 
  20930.  
  20931.   begin
  20932.     if DO_TYPE_TRACING then 
  20933.       CURRENT_NAME.OBJECT_NAME := 
  20934.         MAKE_PERSISTENT(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  20935.       -- The mode will be set later...
  20936.       NAME_LISTS.ATTACH(CURRENT_LIST, CURRENT_NAME); 
  20937.     end if; 
  20938.   end ADD_IDENTIFIER_TO_LIST; 
  20939.  
  20940.   -----------------------------------------------------------------
  20941.  
  20942.   procedure SET_IDENTIFIER_MODE(MODE : in IDENTIFIER_MODE) is 
  20943.  
  20944.   --| Effects
  20945.   --|
  20946.   --| Save the mode of the current identifier list.
  20947.  
  20948.   begin
  20949.     CURRENT_MODE := MODE; 
  20950.   end SET_IDENTIFIER_MODE; 
  20951.  
  20952.   -----------------------------------------------------------------
  20953.  
  20954.   procedure PROCESS_IDENTIFIER_LIST(LIST_TYPE : in IDENTIFIER_LIST_TYPE) is 
  20955.  
  20956.   --| Effects
  20957.   --|
  20958.   --| This is called at the end of the current identifier list.
  20959.   --| Update the mode and type for all identifiers in the list,
  20960.   --| and save the list for later processing, depending on the
  20961.   --| type of list this is.
  20962.  
  20963.     ITER        : NAME_LISTS.LISTITER; 
  20964.     NEXT_OBJECT : NAME_RECORD; 
  20965.  
  20966.   begin
  20967.  
  20968.     -- Note: anonymous array processing currently discards the
  20969.     -- current_list
  20970.     if DO_TYPE_TRACING then 
  20971.       case LIST_TYPE is 
  20972.         when OBJECT_LIST | PARAMETER_LIST | DISCRIMINANT_LIST | 
  20973.           RECORD_FIELD_LIST => 
  20974.  
  20975.           ITER := NAME_LISTS.MAKELISTITER(CURRENT_LIST); 
  20976.           while NAME_LISTS.MORE(ITER) loop
  20977.             NAME_LISTS.NEXT(ITER, NEXT_OBJECT); 
  20978.             NEXT_OBJECT.OBJECT_MODE := CURRENT_MODE; 
  20979.             case LIST_TYPE is 
  20980.               when DISCRIMINANT_LIST => 
  20981.                 -- TBD do tracevar things to handle discriminants --
  20982.                 FLUSH(EXPANDED_NAME); 
  20983.  
  20984.               when RECORD_FIELD_LIST => 
  20985.                 -- TBD do tracevar things for record fields --
  20986.                 null; 
  20987.  
  20988.               when OBJECT_LIST => 
  20989.                 NEXT_OBJECT.OBJECT_NAME := 
  20990.                   CURRENT_SCOPE.QUALIFIED_NAME & "." & NEXT_OBJECT.OBJECT_NAME; 
  20991.                 NAME_LISTS.ATTACH(VISIBLE_LIST, NEXT_OBJECT); 
  20992.  
  20993.               when PARAMETER_LIST => 
  20994.                 if CURRENT_NESTING_LEVEL = 0 then
  20995.                   NEXT_OBJECT.OBJECT_NAME := 
  20996.                      CURRENT_SCOPE_SIMPLE_NAME & "." & NEXT_OBJECT.OBJECT_NAME; 
  20997.                 else
  20998.                   NEXT_OBJECT.OBJECT_NAME := 
  20999.                      CURRENT_SCOPE.QUALIFIED_NAME & "." & 
  21000.                      CURRENT_SCOPE_SIMPLE_NAME & "." & 
  21001.                      NEXT_OBJECT.OBJECT_NAME; 
  21002.                 end if;
  21003.                 NAME_LISTS.ATTACH(PARAM_LIST, NEXT_OBJECT); 
  21004.  
  21005.               when others => 
  21006.                 null; 
  21007.             end case; 
  21008.           end loop; 
  21009.  
  21010.         when others => 
  21011.           null; 
  21012.       end case; 
  21013.  
  21014.       NAME_LISTS.DESTROY(CURRENT_LIST); 
  21015.     end if; 
  21016.     CURRENT_MODE := NONE; 
  21017.   end PROCESS_IDENTIFIER_LIST; 
  21018.  
  21019.   -----------------------------------------------------------------
  21020.  
  21021.   procedure SAVE_TYPE_IDENTIFIER is 
  21022.  
  21023.   --| Effects
  21024.   --|
  21025.   --| The current saved_token is a type identifier.  If type tracing
  21026.   --| is on, save the type identifier for use in generating the
  21027.   --| "tracevar" procedures.
  21028.  
  21029.   begin
  21030.     if DO_TYPE_TRACING then 
  21031.       FLUSH(CURRENT_TYPE_IDENTIFIER); 
  21032.       CURRENT_TYPE_IDENTIFIER := 
  21033.         CURRENT_SCOPE.QUALIFIED_NAME & "." & 
  21034.         CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  21035.     end if; 
  21036.   end SAVE_TYPE_IDENTIFIER; 
  21037.  
  21038.   -----------------------------------------------------------------
  21039.  
  21040.   procedure START_TRACE_PROCEDURE(TYPE_KIND : in TYPE_CLASS) is 
  21041.  
  21042.   --| Effects
  21043.   --|
  21044.   --| Generate the body of the tracing procedure for the current
  21045.   --| type declaration.
  21046.  
  21047.   begin
  21048.     if DO_TYPE_TRACING then 
  21049.       GENERATE_TRACEVAR_SPEC := TRUE; 
  21050.  
  21051.       if TYPE_KIND = TASK_TYPE then 
  21052.         CURRENT_TYPE_IDENTIFIER := 
  21053.           CURRENT_SCOPE.QUALIFIED_NAME & "." & 
  21054.           CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  21055.       end if; 
  21056.  
  21057.       -- write out the constant part of the header
  21058.       for I in 1 .. TRACEVAR_HEADER'LAST - 1 loop
  21059.         WRITE_BODY_LINE(VALUE(TRACEVAR_HEADER(I))); 
  21060.       end loop; 
  21061.  
  21062.       -- write out the last line, filling in the type name
  21063.       -- for "current_value"
  21064.       WRITE_BODY_LINE(VALUE(TRACEVAR_HEADER(TRACEVAR_HEADER'LAST)) & 
  21065.                       " " & VALUE(CURRENT_TYPE_IDENTIFIER) & ") is"); 
  21066.  
  21067.       -- beware that records and arrays will need local vars --
  21068.       WRITE_BODY_LINE("begin"); 
  21069.  
  21070.       case TYPE_KIND is 
  21071.  
  21072.         when ENUMERATION_TYPE => 
  21073.           WRITE_BODY_LINE("   RTM.Put_Value"); 
  21074.           WRITE_BODY_LINE("      (Current_Unit, Variable_Name, " & 
  21075.                           VALUE(CURRENT_TYPE_IDENTIFIER) & 
  21076.                           "'image (Current_Value));"); 
  21077.  
  21078.         when INTEGER_TYPE => 
  21079.           WRITE_BODY_LINE("   RTM.Put_Value"); 
  21080.           WRITE_BODY_LINE("      (Current_Unit, Variable_Name, " & 
  21081.                           "Integer(Current_Value));"); 
  21082.  
  21083.         when FLOAT_TYPE | FIXED_TYPE => 
  21084.           WRITE_BODY_LINE("   RTM.Put_Value"); 
  21085.           WRITE_BODY_LINE("      (Current_Unit, Variable_Name, " & 
  21086.                           "Float(Current_Value));"); 
  21087.  
  21088.         when DERIVED_TYPE => 
  21089.           -- expanded name is the parent type name --
  21090.           WRITE_BODY_LINE("   Source_Instrumenter_Added_Tracevar"); 
  21091.           WRITE_BODY_LINE("      (Current_Unit, Variable_Name, " & 
  21092.                           VALUE(EXPANDED_NAME) & 
  21093.                           "(Current_Value));"); 
  21094.           FLUSH(EXPANDED_NAME); 
  21095.  
  21096.         when others => 
  21097.           WRITE_BODY_LINE("   RTM.Put_Value"); 
  21098.           WRITE_BODY_LINE("      (Current_Unit, Variable_Name, "); 
  21099.           WRITE_BODY_LINE("      ""Values of type " & 
  21100.                           VALUE(CURRENT_TYPE_IDENTIFIER) & 
  21101.                           " cannot be displayed"");"); 
  21102.       end case; 
  21103.  
  21104.       WRITE_BODY_LINE("exception"); 
  21105.       WRITE_BODY_LINE("   when others => null;"); 
  21106.       WRITE_BODY_LINE("end;"); 
  21107.     end if; 
  21108.   end START_TRACE_PROCEDURE; 
  21109.  
  21110.   -----------------------------------------------------------------
  21111.  
  21112.   procedure END_TYPE_DECLARATION is 
  21113.  
  21114.   --| Effects
  21115.   --|
  21116.   --| Generate a procedure declaration for the current tracevar
  21117.   --| procedure.
  21118.  
  21119.   begin
  21120.     if DO_TYPE_TRACING then 
  21121.       if GENERATE_TRACEVAR_SPEC then 
  21122.         WRITE_SPEC_LINE(""); 
  21123.  
  21124.         -- write out the constant part of the header
  21125.         for I in 1 .. TRACEVAR_HEADER'LAST - 1 loop
  21126.           WRITE_SPEC_LINE(VALUE(TRACEVAR_HEADER(I))); 
  21127.         end loop; 
  21128.  
  21129.         -- write out the last line, filling in the type name
  21130.         -- for "current_value"
  21131.         WRITE_SPEC_LINE(VALUE(TRACEVAR_HEADER(TRACEVAR_HEADER'LAST)) & 
  21132.                         " " & 
  21133.                         VALUE(CURRENT_TYPE_IDENTIFIER) & ");"); 
  21134.       end if; 
  21135.       GENERATE_TRACEVAR_SPEC := FALSE; 
  21136.       FLUSH(CURRENT_TYPE_IDENTIFIER); 
  21137.     end if; 
  21138.     TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  21139.   end END_TYPE_DECLARATION; 
  21140.  
  21141.   -----------------------------------------------------------------
  21142.  
  21143.   procedure START_ANONYMOUS_ARRAY_DEFINITION is 
  21144.  
  21145.   --| Effects
  21146.   --|
  21147.   --| For now, the current identifier list is destroyed.  When 
  21148.   --| implemented, this procedure will generate a type name for the 
  21149.   --| anonymous array definition so that a tracevar procedure can be
  21150.   --| written for the type.
  21151.  
  21152.   begin
  21153.     if DO_TYPE_TRACING then 
  21154.       NAME_LISTS.DESTROY(CURRENT_LIST);  -- temporary
  21155.     end if; 
  21156.  
  21157.   -- stop buffering colon decls
  21158.   -- attach current token_to_buffer to buffer
  21159.   -- set current_type_identifier to a name we create (foo) and
  21160.   --   create a new token_to_buffer for it
  21161.   -- write "type foo is" to output files
  21162.   -- call start_trace (array type) to generate tracevar proc
  21163.   end START_ANONYMOUS_ARRAY_DEFINITION; 
  21164.  
  21165.   -----------------------------------------------------------------
  21166.  
  21167.   procedure END_TYPEMARK is 
  21168.  
  21169.   --| Effects
  21170.   --|
  21171.   --| The current expanded name is a typemark name, before any
  21172.   --| constraints which may follow.  Not all typemarks are saved
  21173.   --| but in all cases turn off the "Saving_Expanded_Name" flag.
  21174.  
  21175.   begin
  21176.     SAVING_EXPANDED_NAME := FALSE; 
  21177.   end END_TYPEMARK; 
  21178.  
  21179.   -----------------------------------------------------------------
  21180.  
  21181.   procedure START_PRIVATE_PART is 
  21182.  
  21183.   --| Effects
  21184.   --|
  21185.   --| This procedure is called at the start of the private part
  21186.   --| of a package specification.  If type tracing is on, stack 
  21187.   --| the visible variables list from the public part and set the
  21188.   --| "In_Private_Part" field of the current scope record so that
  21189.   --| tracing information will be written to the private tracing
  21190.   --| files.
  21191.  
  21192.   begin
  21193.     if DO_TYPE_TRACING then 
  21194.       LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  21195.       VISIBLE_LIST := NAME_LISTS.CREATE; 
  21196.       CURRENT_SCOPE.IN_PRIVATE_PART := TRUE; 
  21197.       WRITE_SPEC_LINE("Procedure " & 
  21198.                       VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21199.                       "priv_" & PREFIX & "Putvars;"); 
  21200.     end if; 
  21201.   end START_PRIVATE_PART; 
  21202.  
  21203.   --------------------------------------------------------------
  21204.   --     Local Subprogram Bodies
  21205.   --------------------------------------------------------------
  21206.  
  21207.   procedure PRINT_BUFFERED_TOKENS is 
  21208.  
  21209.   --|Effects
  21210.   --|
  21211.   --|If there were any tokens that were buffered then print them out now.
  21212.   --|The last token that was buffered must first be added to the list
  21213.   --|of buffered tokens from the place holder.
  21214.  
  21215.     ITERATOR      : TOKEN_LISTS.LISTITER; 
  21216.     CURRENT_TOKEN : TOKEN_DESCRIPTOR; 
  21217.   begin
  21218.     if CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE then 
  21219.       REQUESTS.CHANGES := REQUESTS.CHANGES + 
  21220.                           CURRENT_BUFFERED_TOKEN.REQUESTS.CHANGES; 
  21221.       CURRENT_BUFFERED_TOKEN.REQUESTS := REQUESTS; 
  21222.       REQUESTS := (0, 0, 0, 0, 0); 
  21223.       TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  21224.       INITIALIZE_DESCRIPTOR(CURRENT_BUFFERED_TOKEN); 
  21225.     end if; 
  21226.     ITERATOR := TOKEN_LISTS.MAKELISTITER(BUFFERED_TOKENS); 
  21227.     while TOKEN_LISTS.MORE(ITERATOR) loop
  21228.       TOKEN_LISTS.NEXT(ITERATOR, CURRENT_TOKEN); 
  21229.       PRINT_COMMENTS(CURRENT_TOKEN.COMMENTS); 
  21230.       PRINT_TOKEN(CURRENT_TOKEN.TOKEN); 
  21231.       REQUESTS := CURRENT_TOKEN.REQUESTS; 
  21232.       CURRENT_CHANGE_COLUMN := CURRENT_TOKEN.CURRENT_CHANGE_COLUMN; 
  21233.     end loop; 
  21234.     TOKEN_LISTS.DESTROY(BUFFERED_TOKENS);
  21235.     BUFFERING_TOKENS := FALSE; 
  21236.   end PRINT_BUFFERED_TOKENS;
  21237.  
  21238.   -----------------------------------------------------------------
  21239.  
  21240.   function MATCH_NAMES(USER_NAME, SI_NAME : in STRING) return BOOLEAN is 
  21241.  
  21242.   --| Effects
  21243.   --|
  21244.   --| USER_NAME is the name of the variable the user requested to
  21245.   --| trace.  SI_NAME is the name of a variable found in the 
  21246.   --| program.  See if they match, not counting indexed and
  21247.   --| selected components.
  21248.  
  21249.     CH : CHARACTER; 
  21250.   begin
  21251.     if USER_NAME = SI_NAME then 
  21252.       return TRUE; 
  21253.     end if; 
  21254.  
  21255.     if USER_NAME'LENGTH > SI_NAME'LENGTH and then 
  21256.        USER_NAME(1 .. SI_NAME'LENGTH) = SI_NAME then 
  21257.       CH := USER_NAME (SI_NAME'LENGTH + 1); 
  21258.       return (CH = '.' or CH = ' ' or CH = '(' ); 
  21259.     end if; 
  21260.     return FALSE; 
  21261.   end MATCH_NAMES; 
  21262.  
  21263.   -----------------------------------------------------------------
  21264.  
  21265.   procedure CHECK_LISTS is 
  21266.  
  21267.   --| Effects
  21268.   --|
  21269.   --| Compare the list of variables the user wants to trace
  21270.   --| (VARS_TO_TRACE) with the list of visible variables
  21271.   --| found by the instrumenter (VISIBLE_LIST). If there is a
  21272.   --| match, then change the visible list's version of the name
  21273.   --| to what the user requested, to allow for selected components.
  21274.  
  21275.   --| At the end, the VISIBLE_LIST will be a new list which has the 
  21276.   --| revised variable names. 
  21277.  
  21278.     USER_LIST_ITER      : STRING_LISTS.LISTITER; 
  21279.     NEXT_USER_LIST_NAME : STRING_TYPE; 
  21280.     VIS_LIST_ITER       : NAME_LISTS.LISTITER; 
  21281.     NEXT_VIS_LIST_NAME  : NAME_RECORD; 
  21282.     TEMP_LIST           : NAME_LISTS.LIST := NAME_LISTS.CREATE;
  21283.   begin
  21284.  
  21285.     if not STRING_LISTS.ISEMPTY (VARS_TO_TRACE) then
  21286.       USER_LIST_ITER := STRING_LISTS.MAKELISTITER(VARS_TO_TRACE);
  21287.       STRING_LISTS.NEXT(USER_LIST_ITER, NEXT_USER_LIST_NAME);
  21288.  
  21289.       if STRING_PKG.MATCH_S (UPPER(NEXT_USER_LIST_NAME),"*ALL") /= 0 then
  21290.         return;
  21291.       end if;
  21292.  
  21293.       -- loop through the list of user requested vars to trace
  21294.       loop
  21295.          -- see if the var is in the visible list
  21296.         VIS_LIST_ITER := NAME_LISTS.MAKELISTITER(VISIBLE_LIST); 
  21297.      
  21298.         while NAME_LISTS.MORE(VIS_LIST_ITER) loop
  21299.           NAME_LISTS.NEXT(VIS_LIST_ITER, NEXT_VIS_LIST_NAME); 
  21300.           if MATCH_NAMES(VALUE (UPPER (NEXT_USER_LIST_NAME)), 
  21301.                          VALUE (UPPER (NEXT_VIS_LIST_NAME.OBJECT_NAME)))
  21302.           then  -- save this name, and delete it from user_list
  21303.             NEXT_VIS_LIST_NAME.OBJECT_NAME := 
  21304.                MAKE_PERSISTENT(NEXT_USER_LIST_NAME); 
  21305.             NAME_LISTS.ATTACH(TEMP_LIST, NEXT_VIS_LIST_NAME); 
  21306.             STRING_LISTS.DELETEITEM(VARS_TO_TRACE, NEXT_USER_LIST_NAME);
  21307.             exit; 
  21308.           end if; -- names match
  21309.         end loop; -- while more in vis_list
  21310.  
  21311.         exit when not STRING_LISTS.MORE(USER_LIST_ITER);
  21312.         STRING_LISTS.NEXT(USER_LIST_ITER, NEXT_USER_LIST_NAME);
  21313.       end loop; -- while more in users lilst
  21314.  
  21315.     end if; -- not is empty (user's list)
  21316.  
  21317.     -- save the temp list as the new visible list
  21318.     DISCARD_LIST (VISIBLE_LIST);
  21319.     NAME_LISTS.ATTACH (VISIBLE_LIST, NAME_LISTS.COPY(TEMP_LIST)); 
  21320.     NAME_LISTS.DESTROY(TEMP_LIST);
  21321.  
  21322.   end CHECK_LISTS; 
  21323.  
  21324.   -----------------------------------------------------------------
  21325.  
  21326.   function GET_UNIT_NAME(TYPE_OF_SCOPE : in SCOPE_TYPE) return STRING is 
  21327.  
  21328.   --| Effects
  21329.   --|
  21330.   --|  This function searches through the buffered tokens and forms a
  21331.   --|  string representation of the current unit specification.  The
  21332.   --|  function will add spaces where neccesary but will not add and 
  21333.   --|  carriage control.  
  21334.  
  21335.   --  Define an access to a string to hold the unit specification as it
  21336.   --  is constructed
  21337.  
  21338.     type UNIT_DESCRIPTOR is access STRING; 
  21339.     UNIT_NAME       : UNIT_DESCRIPTOR; 
  21340.     BUFFER_ITERATOR : TOKEN_LISTS.LISTITER;  -- Iterator to walk the lists
  21341.     CURRENT_TOKEN   : TOKEN_DESCRIPTOR; 
  21342.                                    -- Holder for token currently being processed
  21343.  
  21344.   begin
  21345.  
  21346.     case TYPE_OF_SCOPE is 
  21347.       when PACKAGE_SPECIFICATION => 
  21348.         UNIT_NAME := new STRING'("package "); 
  21349.       when PACKAGE_BODY => 
  21350.         UNIT_NAME := new STRING'("package body "); 
  21351.       when TASK_BODY => 
  21352.         UNIT_NAME := new STRING'("task body "); 
  21353.       when SUBPROGRAM_BODY => 
  21354.         if SUBPROGRAM_UNIT_TYPE = PROCEDURE_TYPE then 
  21355.           UNIT_NAME := new STRING'("procedure "); 
  21356.         else 
  21357.           UNIT_NAME := new STRING'("function "); 
  21358.         end if; 
  21359.       when others => 
  21360.         UNIT_NAME := new STRING'(""); 
  21361.     end case; 
  21362.  
  21363.     UNIT_NAME := new STRING'(UNIT_NAME.all & VALUE(CURRENT_SCOPE_SIMPLE_NAME)); 
  21364.  
  21365.     if not TOKEN_LISTS.ISEMPTY(TOKEN_BUFFER) then 
  21366.       UNIT_NAME := new STRING'(UNIT_NAME.all & '('); 
  21367.  
  21368.       --  process second buffer. This buffer will contain all of the parameter
  21369.       --  specifications(if any).  Add the tokens to the list, and put spaces
  21370.       --  where appropriate
  21371.       BUFFER_ITERATOR := TOKEN_LISTS.MAKELISTITER(TOKEN_BUFFER); 
  21372.       while TOKEN_LISTS.MORE(BUFFER_ITERATOR) loop
  21373.         TOKEN_LISTS.NEXT(BUFFER_ITERATOR, CURRENT_TOKEN); 
  21374.         exit when CURRENT_TOKEN.TOKEN.GRAM_SYM_VAL = PT.RETURNTOKENVALUE;
  21375.         if CURRENT_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COLON_TOKENVALUE and 
  21376.            CURRENT_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.RIGHTPAREN_TOKENVALUE then 
  21377.           UNIT_NAME := new STRING'(UNIT_NAME.all & ' ' & 
  21378.                                    TOKEN_TEXT(CURRENT_TOKEN.TOKEN)); 
  21379.         else 
  21380.           UNIT_NAME := new STRING'(UNIT_NAME.all & 
  21381.                                    TOKEN_TEXT(CURRENT_TOKEN.TOKEN)); 
  21382.         end if; 
  21383.       end loop; 
  21384.     end if; 
  21385.     if TYPE_OF_SCOPE = SUBPROGRAM_BODY and 
  21386.        SUBPROGRAM_UNIT_TYPE = FUNCTION_TYPE then
  21387.       UNIT_NAME := new STRING'(UNIT_NAME.all & " return " & 
  21388.                                VALUE(EXPANDED_NAME));
  21389.     end if; 
  21390.     if Current_Nesting_Level > 0 and not BUFFERING_COLON_DECLARATIONS then
  21391.       TOKEN_LISTS.DESTROY(TOKEN_BUFFER);
  21392.     end if;
  21393.     return UNIT_NAME.all;   --  return the string 
  21394.   end GET_UNIT_NAME; 
  21395.  
  21396.   -----------------------------------------------------------------
  21397.  
  21398.   procedure WRITE_BODY_LINE(LINE : in STRING) is 
  21399.  
  21400.   --| Effects
  21401.   --|
  21402.   --| The line is part of a procedure body. Write it to the
  21403.   --| appropriate buffer file.
  21404.  
  21405.   begin
  21406.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  21407.       if CURRENT_SCOPE.IN_PRIVATE_PART then 
  21408.         BFP.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, LINE); 
  21409.       else 
  21410.         BFP.WRITELN_TO_BUFFER(PUBLIC_BODY_FILE, LINE); 
  21411.       end if; 
  21412.     else 
  21413.       BFP.WRITELN_TO_BUFFER(BUFFER_FILE, LINE); 
  21414.     end if; 
  21415.   end WRITE_BODY_LINE; 
  21416.  
  21417.   -----------------------------------------------------------------------
  21418.  
  21419.   procedure WRITE_SPEC_LINE(LINE : in STRING) is 
  21420.  
  21421.   --| Effects
  21422.   --|
  21423.   --| The current line is a declaration or part of a package spec.  
  21424.   --| If the current unit is a package specification, write the line
  21425.   --| to the appropriate package tracing file.  Otherwise write it
  21426.   --| directly to the instrumented source file.
  21427.  
  21428.   begin
  21429.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  21430.       if CURRENT_SCOPE.IN_PRIVATE_PART then 
  21431.         BFP.WRITELN_TO_BUFFER(PRIVATE_SPEC_FILE, LINE); 
  21432.       else 
  21433.         BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, LINE); 
  21434.       end if; 
  21435.     else 
  21436.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, LINE); 
  21437.     end if; 
  21438.   end WRITE_SPEC_LINE; 
  21439.  
  21440.   ---------------------------------------------------------------
  21441.  
  21442.   procedure RETRIEVE_SPEC_WITH_LIST is 
  21443.  
  21444.   --| Effects
  21445.   --|
  21446.   --| Get the with list that was saved for the package spec.
  21447.   --| If it named any units that are not in the with list
  21448.   --| for the body, then add those names to the current
  21449.   --| with list.  This is used to generate "Putvar" calls to
  21450.   --| those units.
  21451.  
  21452.     TEMP_LIST           : STRING_LISTS.LIST; 
  21453.     TEMP_LIST_ITERATOR  : STRING_LISTS.LISTITER; 
  21454.     TEMP_LIST_OBJECT    : STRING_TYPE; 
  21455.  
  21456.     SAVED_LIST          : STRING_LISTS.LIST; 
  21457.     SAVED_LIST_ITERATOR : STRING_LISTS.LISTITER; 
  21458.     SAVED_LIST_OBJECT   : STRING_TYPE; 
  21459.     MATCHED             : BOOLEAN; 
  21460.   begin
  21461.  
  21462.     SAVED_LIST := BFP.GET_SPEC_WITH_LIST(VALUE(CURRENT_SCOPE.SCOPE_NAME)); 
  21463.  
  21464.     if not STRING_LISTS.ISEMPTY(SAVED_LIST) then 
  21465.       TEMP_LIST := STRING_LISTS.COPY(WITH_LIST); 
  21466.       SAVED_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(SAVED_LIST); 
  21467.       while STRING_LISTS.MORE(SAVED_LIST_ITERATOR) loop
  21468.         STRING_LISTS.NEXT(SAVED_LIST_ITERATOR, SAVED_LIST_OBJECT); 
  21469.         MATCHED := FALSE; 
  21470.  
  21471.         TEMP_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(TEMP_LIST); 
  21472.         while STRING_LISTS.MORE(TEMP_LIST_ITERATOR) and not MATCHED loop
  21473.           STRING_LISTS.NEXT(TEMP_LIST_ITERATOR, TEMP_LIST_OBJECT); 
  21474.           MATCHED := EQUAL(UPPER(TEMP_LIST_OBJECT), UPPER(SAVED_LIST_OBJECT)); 
  21475.         end loop; 
  21476.         if not MATCHED then 
  21477.           STRING_LISTS.ATTACH(WITH_LIST, SAVED_LIST_OBJECT); 
  21478.         else 
  21479.           STRING_LISTS.DELETEITEM(TEMP_LIST, TEMP_LIST_OBJECT); 
  21480.         end if; -- not matched
  21481.       end loop; -- while more (saved_list)
  21482.     end if; -- not empty (saved_list)
  21483.   end RETRIEVE_SPEC_WITH_LIST; 
  21484.  
  21485.   ----------------------------------------------------------------------
  21486.  
  21487.   procedure GENERATE_TRACEVAR_CALL(VARNAME : in STRING) is 
  21488.  
  21489.   --| Effects
  21490.   --|
  21491.   --| Write the text for a call to Source_Instrumenter_Added_Tracevar
  21492.   --| to the appropriate buffer file.
  21493.  
  21494.   begin
  21495.     WRITE_BODY_LINE("   begin"); 
  21496.     WRITE_BODY_LINE("      Source_Instrumenter_Added_Tracevar "); 
  21497.     WRITE_BODY_LINE("        (" & 
  21498.                     VALUE(CREATE_BREAKPOINT.GET_PROGRAM_UNIT) & 
  21499.                     ","); 
  21500.     WRITE_BODY_LINE("          " & """" & VARNAME & """, "); 
  21501.     WRITE_BODY_LINE("          " & VARNAME & ");"); 
  21502.     WRITE_BODY_LINE("   exception"); 
  21503.     WRITE_BODY_LINE("      when others => null;"); 
  21504.     WRITE_BODY_LINE("   end;"); 
  21505.   end GENERATE_TRACEVAR_CALL; 
  21506.  
  21507.   ---------------------------------------------------------------
  21508.  
  21509.   procedure GENERATE_PUTVARS is 
  21510.  
  21511.   --| Effects
  21512.   --|
  21513.   --| Generate the procedure "putvars" for the current scope.
  21514.   --| "Putvars" first calls "Tracevar" for the variables being 
  21515.   --| traced in this scope, and then calls the "putvars" for 
  21516.   --| enclosing scopes.  
  21517.   --| It is only called if Do_Type_Tracing is True.
  21518.  
  21519.     NAME_LIST_ITERATOR   : NAME_LISTS.LISTITER; 
  21520.     NEXT_VARIABLE        : NAME_RECORD; 
  21521.     STRING_LIST_ITERATOR : STRING_LISTS.LISTITER; 
  21522.     NEXT_NAME            : STRING_TYPE; 
  21523.     WROTE_SOMETHING      : BOOLEAN := FALSE; 
  21524.  
  21525.   begin
  21526.  
  21527.     -- write the procedure spec --
  21528.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  21529.       if CURRENT_SCOPE.IN_PRIVATE_PART then 
  21530.         WRITE_BODY_LINE("Procedure " & 
  21531.                          VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21532.                          "priv_" & PREFIX & "Putvars is"); 
  21533.       else 
  21534.         WRITE_BODY_LINE("Procedure " & 
  21535.                          VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21536.                          "spec_" & PREFIX & "Putvars is"); 
  21537.         if CURRENT_NESTING_LEVEL = 1 then 
  21538.           WRITE_BODY_LINE("   TBX7_Task_Number: Natural := 1;"); 
  21539.         end if; 
  21540.       end if; 
  21541.     else 
  21542.       WRITE_BODY_LINE("Procedure " & 
  21543.                       VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21544.                       "_" & PREFIX & "Putvars is"); 
  21545.     end if; 
  21546.  
  21547.     WRITE_BODY_LINE("begin"); 
  21548.  
  21549.     -- first, call tracevar for the variables being traced in this scope 
  21550.     -- and then destroy the list.
  21551.  
  21552.     CHECK_LISTS;
  21553.     NAME_LIST_ITERATOR := NAME_LISTS.MAKELISTITER(VISIBLE_LIST); 
  21554.     while NAME_LISTS.MORE(NAME_LIST_ITERATOR) loop
  21555.       NAME_LISTS.NEXT(NAME_LIST_ITERATOR, NEXT_VARIABLE); 
  21556.       if NEXT_VARIABLE.OBJECT_MODE = READ_ONLY or 
  21557.          NEXT_VARIABLE.OBJECT_MODE = READ_WRITE then 
  21558.         GENERATE_TRACEVAR_CALL(VALUE(NEXT_VARIABLE.OBJECT_NAME)); 
  21559.         WROTE_SOMETHING := TRUE; 
  21560.       end if; 
  21561.       FLUSH(NEXT_VARIABLE.OBJECT_NAME); 
  21562.     end loop; 
  21563.     NAME_LISTS.DESTROY(VISIBLE_LIST); 
  21564.  
  21565.     -- If the current unit is a package body, and if its spec was
  21566.     -- instrumented for type tracing, then trace any variables
  21567.     -- from the spec (public and private).  
  21568.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then 
  21569.  
  21570.       -- trace the variables from the private part
  21571.       if BFP.PACKAGE_FILES_EXIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21572.         PRIVATE_FILES) then 
  21573.         WRITE_BODY_LINE("   " & 
  21574.                         VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21575.                         "priv_" & PREFIX & "Putvars;"); 
  21576.       end if; -- private files exist
  21577.  
  21578.       -- trace the variables from the public part
  21579.       if BFP.PACKAGE_FILES_EXIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21580.                                  PUBLIC_FILES) then 
  21581.         WRITE_BODY_LINE("   " & 
  21582.                         "Trace_Public_" & 
  21583.                         VALUE(CURRENT_SCOPE.SCOPE_NAME) & "." & 
  21584.                         VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21585.                         "spec_" & PREFIX & "Putvars;"); 
  21586.         WROTE_SOMETHING := TRUE; 
  21587.       end if; -- public_files exist
  21588.     end if; -- current scope = package body
  21589.  
  21590.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then 
  21591.  
  21592.       -- Call putvars for package specs declared in this scope.  
  21593.       -- Package specs nested in other package specs are handled by
  21594.       -- the package tracing files.  The Package_List will still be 
  21595.       -- needed in "End_Declarative_Part" so leave it intact.
  21596.       STRING_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(PACKAGE_LIST); 
  21597.       while STRING_LISTS.MORE(STRING_LIST_ITERATOR) loop
  21598.         STRING_LISTS.NEXT(STRING_LIST_ITERATOR, NEXT_NAME); 
  21599.         WRITE_BODY_LINE("   " & 
  21600.                         VALUE(CURRENT_SCOPE.QUALIFIED_NAME) & 
  21601.                         ".Trace_Public_" & VALUE(NEXT_NAME) & "." & 
  21602.                         VALUE(NEXT_NAME) & 
  21603.                         "spec_" & PREFIX & "Putvars;"); 
  21604.         WROTE_SOMETHING := TRUE; 
  21605.       end loop; 
  21606.  
  21607.       -- if this is the outer scope, then call putvars for packages
  21608.       -- named in the context_clause 
  21609.       if CURRENT_NESTING_LEVEL = 1 then 
  21610.         STRING_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST); 
  21611.         while STRING_LISTS.MORE(STRING_LIST_ITERATOR) loop
  21612.           STRING_LISTS.NEXT(STRING_LIST_ITERATOR, NEXT_NAME); 
  21613.           WRITE_BODY_LINE("   Trace_Public_" & 
  21614.                           VALUE(NEXT_NAME) & "." & 
  21615.                           VALUE(NEXT_NAME) & "spec_" & PREFIX & "Putvars;"); 
  21616.           FLUSH(NEXT_NAME); 
  21617.           WROTE_SOMETHING := TRUE; 
  21618.         end loop; 
  21619.         STRING_LISTS.DESTROY(WITH_LIST); 
  21620.       end if; 
  21621.  
  21622.       -- call putvars for the outer scope
  21623.       if not IS_EMPTY(CURRENT_OUTER_SCOPE.SCOPE_NAME) then 
  21624.         WRITE_BODY_LINE("   " & 
  21625.                         VALUE(CURRENT_OUTER_SCOPE.PUTVAR_NAME) & "_" & 
  21626.                         PREFIX & "Putvars;"); 
  21627.         WROTE_SOMETHING := TRUE; 
  21628.       end if; 
  21629.     end if; 
  21630.  
  21631.     -- current_scope /= package_spec
  21632.     if not WROTE_SOMETHING then 
  21633.       WRITE_BODY_LINE("   null;"); 
  21634.     end if; 
  21635.  
  21636.     WRITE_BODY_LINE("end;"); 
  21637.   end GENERATE_PUTVARS; 
  21638.  
  21639.   ---------------------------------------------------------------
  21640.  
  21641.   function ASK_USER_ABOUT_PACKAGE return BOOLEAN is 
  21642.  
  21643.   --| Effects
  21644.   --|
  21645.   --| Before instrumenting a package specification which is a
  21646.   --| library unit, ask the user if the text of the package
  21647.   --| spec should be included in the instrumented source which
  21648.   --| will be compiled.  The user ought not to recompile a package
  21649.   --| specification if the body is not available for recompilation.
  21650.  
  21651.     ANSWER : STRING(1 .. 80); 
  21652.     INDEX  : INTEGER; 
  21653.   begin
  21654.     TEXT_IO.NEW_LINE(2); 
  21655.     TEXT_IO.PUT_LINE(ASCII.BEL & ASCII.BEL & 
  21656.       "Instrumenting the package specification for "); 
  21657.     TEXT_IO.PUT_LINE(VALUE(CURRENT_SCOPE_SIMPLE_NAME)); 
  21658.     TEXT_IO.PUT_LINE("Do you want this package specification included in "); 
  21659.     TEXT_IO.PUT_LINE("the instrumented source?  Recompiling it will require "); 
  21660.     TEXT_IO.PUT_LINE("recompiling its body and all dependent units."); 
  21661.  
  21662.     loop
  21663.       TEXT_IO.PUT("Y/N "); 
  21664.       TEXT_IO.GET_LINE(TEXT_IO.STANDARD_INPUT, ANSWER, INDEX); 
  21665.       TEXT_IO.PUT_LINE(""); 
  21666.       case ANSWER(1) is 
  21667.         when 'Y' | 'y' => 
  21668.           return TRUE; 
  21669.         when 'N' | 'n' => 
  21670.           return FALSE; 
  21671.         when others => 
  21672.           null; 
  21673.       end case; 
  21674.     end loop; 
  21675.   end ASK_USER_ABOUT_PACKAGE; 
  21676.  
  21677.   ---------------------------------------------------------------
  21678.  
  21679.   procedure DISCARD_LIST(WHICH_LIST : in out NAME_LISTS.LIST) is 
  21680.  
  21681.   --| Effects
  21682.   --|
  21683.   --| Before destroying a name_list, the string_type field
  21684.   --| needs to be flushed.
  21685.  
  21686.     ITER        : NAME_LISTS.LISTITER; 
  21687.     NEXT_OBJECT : NAME_RECORD; 
  21688.   begin
  21689.     if not NAME_LISTS.ISEMPTY(WHICH_LIST) then 
  21690.       ITER := NAME_LISTS.MAKELISTITER(WHICH_LIST); 
  21691.       while NAME_LISTS.MORE(ITER) loop
  21692.         NAME_LISTS.NEXT(ITER, NEXT_OBJECT); 
  21693.         FLUSH(NEXT_OBJECT.OBJECT_NAME); 
  21694.       end loop; 
  21695.       NAME_LISTS.DESTROY(WHICH_LIST); 
  21696.     end if; 
  21697.   end DISCARD_LIST; 
  21698.  
  21699.   --------------------------------------------------------------------
  21700.  
  21701.   procedure SET_SCOPE_RECORDS(TYPE_OF_SCOPE : in SCOPE_TYPE) is 
  21702.  
  21703.   --| Effects
  21704.   --|
  21705.   --| This is called by Increment_Scope to set the
  21706.   --| Current_Scope and Current_Outer_Scope variables.
  21707.  
  21708.   begin
  21709.     if CURRENT_NESTING_LEVEL = 0 then 
  21710.       if not SEPARATE_UNIT then 
  21711.         CURRENT_SCOPE_QUALIFIED_NAME := CURRENT_SCOPE_SIMPLE_NAME; 
  21712.         CURRENT_OUTER_SCOPE := 
  21713.            (CREATE(""), 
  21714.             CREATE(""), 
  21715.             A_BLOCK, 
  21716.             CREATE(""), 
  21717.             FALSE, 
  21718.             ENTRY_EXIT); 
  21719.       else 
  21720.         CURRENT_SCOPE_QUALIFIED_NAME := 
  21721.           EXPANDED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  21722.           -- Current_Outer_Scope was set up in Save_Separate_Name
  21723.       end if; 
  21724.     else  -- Current_Nesting_Level /= 0 
  21725.       CURRENT_SCOPE_QUALIFIED_NAME := 
  21726.         CURRENT_SCOPE.QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  21727.       CURRENT_OUTER_SCOPE := CURRENT_SCOPE; 
  21728.     end if; 
  21729.  
  21730.     CURRENT_SCOPE := 
  21731.        (CURRENT_SCOPE_SIMPLE_NAME, 
  21732.         CURRENT_SCOPE_QUALIFIED_NAME, 
  21733.         TYPE_OF_SCOPE, 
  21734.         CREATE(""), 
  21735.         FALSE, 
  21736.         CURRENT_TRACE_LEVEL); 
  21737.  
  21738.     if DO_TYPE_TRACING then 
  21739.       CURRENT_SCOPE.PUTVAR_NAME := CURRENT_SCOPE_SIMPLE_NAME; 
  21740.     end if; 
  21741.   end SET_SCOPE_RECORDS; 
  21742.  
  21743.   ---------------------------------------------------------------
  21744.   procedure ADD_WITHS_TO_BODY is 
  21745.  
  21746.   --| Effects
  21747.   --|
  21748.   --| This is called from Increment_Scope when the current
  21749.   --| nesting level is 0, and the type of unit is either
  21750.   --| a subprogram body or a package body.  Add the with
  21751.   --| and use clauses that will be needed by the instrumented 
  21752.   --| source and retrieve any with clauses that were given for
  21753.   --| the specification.
  21754.  
  21755.     ITERATOR    : STRING_LISTS.LISTITER; 
  21756.     NEXT_OBJECT : STRING_TYPE; 
  21757.  
  21758.   begin
  21759.     if not SEPARATE_UNIT then 
  21760.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21761.         "with Run_Time_Monitor, Type_Definitions, String_Pkg;"); 
  21762.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21763.         "use Run_Time_Monitor, Type_Definitions, String_Pkg;"); 
  21764.       if DO_TYPE_TRACING then 
  21765.         PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21766.           "with Trace_Predefined_Types; use Trace_Predefined_Types;"); 
  21767.         RETRIEVE_SPEC_WITH_LIST; 
  21768.       end if; -- not separate and type tracing
  21769.     end if; -- not separate
  21770.  
  21771.     -- if the current unit is a package body and its spec was instrumented
  21772.     -- then with and use its public trace package
  21773.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and then 
  21774.        DO_TYPE_TRACING and then 
  21775.        BFP.PACKAGE_FILES_EXIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21776.                                PUBLIC_FILES) then 
  21777.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21778.         "with Trace_Public_" & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & "; " &
  21779.         "use Trace_Public_" & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & ";"); 
  21780.     end if; -- package_body and type_tracing  
  21781.  
  21782.     -- now add with and use for anything in the with list that
  21783.     -- has been instrumented.  Note that the with list won't have
  21784.     -- anything in it if type_tracing is turned off.
  21785.     ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST); 
  21786.     while STRING_LISTS.MORE(ITERATOR) loop
  21787.       STRING_LISTS.NEXT(ITERATOR, NEXT_OBJECT); 
  21788.       PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21789.         "with Trace_Public_" & VALUE(NEXT_OBJECT) & "; " &
  21790.         "use Trace_Public_" & VALUE(NEXT_OBJECT) & ";"); 
  21791.     end loop; 
  21792.  
  21793.   end ADD_WITHS_TO_BODY; 
  21794.  
  21795.   ------------------------------------------------------------------
  21796.  
  21797.   procedure ADD_WITHS_TO_TRACE_PACKAGES is 
  21798.  
  21799.   --| Effects
  21800.   --|
  21801.   --| This is called by Initialize_Trace_Packages when the current
  21802.   --| nesting level is 0. The tracing packages have to have visibility
  21803.   --| of the package specification being traced, the public tracing
  21804.   --| packages of any instrumented units in the context clause, and
  21805.   --| other assorted utility packages.
  21806.  
  21807.     ITERATOR    : STRING_LISTS.LISTITER; 
  21808.     NEXT_OBJECT : STRING_TYPE; 
  21809.  
  21810.   begin
  21811.  
  21812.     -- with and use the package being traced
  21813.     BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21814.       "with " & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & "; " &
  21815.       "use " & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & ";"); 
  21816.  
  21817.     -- with and use the support packages
  21818.     BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21819.       "with Run_Time_Monitor, Type_Definitions," &
  21820.       " String_Pkg, Trace_Predefined_Types;"); 
  21821.     BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21822.       "use  Run_Time_Monitor, Type_Definitions," &
  21823.       " String_Pkg, Trace_Predefined_Types;"); 
  21824.  
  21825.     -- with and use the public trace packages of anything
  21826.     -- in the with list that was instrumented.
  21827.     ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST); 
  21828.     while STRING_LISTS.MORE(ITERATOR) loop
  21829.       STRING_LISTS.NEXT(ITERATOR, NEXT_OBJECT); 
  21830.       BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21831.         "with Trace_Public_" & VALUE(NEXT_OBJECT) & "; " &
  21832.         "use Trace_Public_" & VALUE(NEXT_OBJECT) & ";"); 
  21833.     end loop; 
  21834.  
  21835.   end ADD_WITHS_TO_TRACE_PACKAGES; 
  21836.  
  21837.   -----------------------------------------------------------------
  21838.  
  21839.   procedure INITIALIZE_TRACE_PACKAGES is 
  21840.  
  21841.   --| Effects
  21842.   --|
  21843.   --| This procedure is called by Increment_Scope when the
  21844.   --| current scope is a package specification and type tracing
  21845.   --| is on.
  21846.  
  21847.   begin
  21848.     if CURRENT_OUTER_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  21849.  
  21850.       -- close the private files for the outer package 
  21851.       -- and open new ones for the current package.
  21852.       BFP.CLOSE_PACKAGE_FILES(PRIVATE_FILES); 
  21853.       BFP.CREATE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21854.         PRIVATE_FILES); 
  21855.     else 
  21856.       BFP.CREATE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), ALL_FILES); 
  21857.  
  21858.       if CURRENT_NESTING_LEVEL = 0 then 
  21859.         if not STRING_LISTS.ISEMPTY(WITH_LIST) then 
  21860.           BFP.SAVE_SPEC_WITH_LIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21861.                                   WITH_LIST); 
  21862.         end if; 
  21863.         ADD_WITHS_TO_TRACE_PACKAGES; 
  21864.       end if; -- Current_Nesting_Level = 0
  21865.  
  21866.       -- Start the public trace packages
  21867.       BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21868.         "package Trace_Public_" & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & " is"); 
  21869.       BFP.WRITELN_TO_BUFFER(PUBLIC_BODY_FILE, 
  21870.         "package body Trace_Public_" & 
  21871.          VALUE(CURRENT_SCOPE_SIMPLE_NAME) & " is "); 
  21872.  
  21873.       BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21874.         "Procedure " & 
  21875.          VALUE(CURRENT_SCOPE_SIMPLE_NAME) & "spec_" & PREFIX & "Putvars;"); 
  21876.  
  21877.       -- start new visible variable list
  21878.       LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  21879.       VISIBLE_LIST := NAME_LISTS.CREATE; 
  21880.     end if; -- if current_outer_scope = package_spec 
  21881.   end INITIALIZE_TRACE_PACKAGES; 
  21882.  
  21883.   -----------------------------------------------------------------
  21884.  
  21885.   procedure CLOSE_TRACE_PACKAGES is 
  21886.  
  21887.   --| Effects
  21888.   --|
  21889.   --| This procedure is called by Decrement_Scope when type
  21890.   --| tracing is true and the current unit is a package
  21891.   --| specification.  Finish the tracing information packaages.
  21892.  
  21893.   begin
  21894.  
  21895.     -- Finish the private tracing packages
  21896.     if CURRENT_SCOPE.IN_PRIVATE_PART then 
  21897.       GENERATE_PUTVARS; -- for variables declared in the private part
  21898.       LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  21899.  
  21900.     else  -- there was no private part
  21901.       CURRENT_SCOPE.IN_PRIVATE_PART := TRUE; 
  21902.       BFP.WRITELN_TO_BUFFER(PRIVATE_SPEC_FILE, 
  21903.         "Procedure " & VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21904.         "priv_" & PREFIX & "Putvars;"); 
  21905.       BFP.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, 
  21906.         "Procedure " & VALUE(CURRENT_SCOPE.SCOPE_NAME) & 
  21907.         "priv_" & PREFIX & "Putvars is"); 
  21908.       BFP.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, "begin"); 
  21909.       BFP.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, "   null;"); 
  21910.       BFP.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, "end;"); 
  21911.     end if; 
  21912.     CURRENT_SCOPE.IN_PRIVATE_PART := FALSE; 
  21913.  
  21914.     -- finish the public tracing packages
  21915.     if CURRENT_OUTER_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  21916.  
  21917.       -- reopen private files for outer scope and continue
  21918.       BFP.CLOSE_PACKAGE_FILES(PRIVATE_FILES); 
  21919.       BFP.REOPEN_PRIVATE_FILES(VALUE(CURRENT_OUTER_SCOPE.QUALIFIED_NAME)); 
  21920.     else 
  21921.       GENERATE_PUTVARS; 
  21922.       LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  21923.  
  21924.       -- End the public trace packages
  21925.       BFP.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, 
  21926.         "end Trace_Public_" & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  21927.       BFP.WRITELN_TO_BUFFER(PUBLIC_BODY_FILE, 
  21928.         "end Trace_Public_" & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  21929.       BFP.CLOSE_PACKAGE_FILES(ALL_FILES); 
  21930.  
  21931.       BFP.COPY_PACKAGE_FILES(PUBLIC_SPEC, 
  21932.                              VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  21933.                              SID.INSTRUMENTED_FILE); 
  21934.  
  21935.       if CURRENT_NESTING_LEVEL = 1 then 
  21936.         BFP.COPY_PACKAGE_FILES(PUBLIC_BODY, 
  21937.                                VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  21938.                                SID.INSTRUMENTED_FILE); 
  21939.       else 
  21940.         PO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  21941.           "use Trace_Public_" & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  21942.         STRING_LISTS.ATTACH(PACKAGE_LIST, 
  21943.                             MAKE_PERSISTENT(CURRENT_SCOPE.SCOPE_NAME)); 
  21944.       end if; -- if current nesting level = 1
  21945.     end if; -- if outer_scope = package_spec
  21946.   end CLOSE_TRACE_PACKAGES; 
  21947.  
  21948.   -----------------------------------------------------------------
  21949. end SOURCE_INSTRUMENTER_UTILITIES; 
  21950. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21951. --parse.bdy
  21952. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21953. with Lex;                       -- the lexical analyzer
  21954. with ParseStack;                -- elements awaiting parsing
  21955. with StateStack;                -- stack of parse states
  21956. with ParseTables;               -- state tables generated by parser
  21957.                                 -- generator
  21958. use ParseTables;
  21959.  
  21960. with Grammar_Constants;         -- constants generated by parser generator
  21961. use Grammar_Constants;
  21962.  
  21963. with Source_Instrumenter_Utilities;-- 
  21964.  
  21965. package body Parser is
  21966.  
  21967.     ------------------------------------------------------------------
  21968.  
  21969.     procedure Apply_Actions(
  21970.         Rule_Number : in PT.LeftHandSideRange) is separate;
  21971.  
  21972.     ------------------------------------------------------------------
  21973.  
  21974.     function Parse return PD.ParseStackElement is
  21975.  
  21976.     --| Overview
  21977.     --|
  21978.     --| The appropriate reference is:
  21979.     --|
  21980.     --| Using the NYU LALR Parser Generator. Philippe Charles and
  21981.     --| Gerald Fisher. Courant Institute, New York University, 251 Mercer
  21982.     --| Street, New York, N.Y.  10012. Unpublished paper. 1981.
  21983.     --|
  21984.  
  21985.     --|
  21986.     --| Notes
  21987.     --|
  21988.     --| Abbreviations Used:
  21989.     --|
  21990.     --| Cur : Current - used as prefix
  21991.     --| LH  : LeftHand
  21992.     --| RH  : RightHand
  21993.     --|
  21994.  
  21995.     ------------------------------------------------------------------
  21996.     -- Reduce Action Work Variables
  21997.     ------------------------------------------------------------------
  21998.  
  21999.     Reduce_Action_Number   : PT.LeftHandSideRange;
  22000.         --| reduction to perform
  22001.  
  22002.     Reduce_Action_LH_Value : GrammarSymbolRange;
  22003.         --| grammar symbol number of left hand side of reduction
  22004.  
  22005.     Reduce_Action_RH_Size  : PD.StateParseStacksIndex;
  22006.         --| number of elements in right hand side of reduction
  22007.  
  22008.     ------------------------------------------------------------------
  22009.     -- Other Objects
  22010.     ------------------------------------------------------------------
  22011.  
  22012.     Current_Action      : ActionRange;
  22013.         --| return from PT.GetAction.
  22014.  
  22015.     Start_State         : constant := 1;
  22016.         --| Start state for parser.
  22017.  
  22018.     Last_Element_Popped : PD.ParseStackElement;
  22019.         --| Last element popped from parse stack
  22020.  
  22021.     ------------------------------------------------------------------
  22022.  
  22023.     begin
  22024.  
  22025.     --|
  22026.     --| Algorithm
  22027.     --|
  22028.     --| Function PT.GetAction returns an action value,
  22029.     --| which indicate one of four possible actions:
  22030.     --|
  22031.     --| Error:  action value = 0.
  22032.     --| Shift:  0 < action value < StateCountPlusOne.
  22033.     --| Accept: action value = StateCountPlusOne.
  22034.     --| Reduce: action value > StateCountPlusOne.
  22035.     --|
  22036.     --| The action is processed (as described below).
  22037.     --| This is repeated until no more tokens are obtained.
  22038.     --|
  22039.     --| The basic action processing is:
  22040.     --|
  22041.     --| SHIFT ACTION: the next token is placed on the ParseStack.
  22042.     --|
  22043.     --| REDUCE ACTION: the handle (a grammar rule's right hand side)
  22044.     --| found on the ParseStack is replaced with a
  22045.     --| non-terminal (grammar rule's left hand side) to which
  22046.     --| it has been reduced, and a new state.
  22047.     --|
  22048.     --| ACCEPT ACTION: the ParseStack contains the root
  22049.     --| of the parse tree, and processing is finished for
  22050.     --| If another compilation unit is present, parsing continues.
  22051.     --|
  22052.     --| ERROR ACTION: the exception Parser_Error is raised.
  22053.  
  22054.     ------------------------------------------------------------------
  22055.     
  22056.         -- Initialize Lexical Analyzer
  22057.         Lex.Initialization;
  22058.  
  22059.         PD.CurToken := Lex.GetNextNonCommentToken;
  22060.  
  22061.         StateStack.Push(Start_State);
  22062.  
  22063.         Do_Parse: loop
  22064.  
  22065.             Current_Action := PT.GetAction(
  22066.                 StateStack.CopyTop,
  22067.                 PD.CurToken.gram_sym_val);
  22068.  
  22069.             -- Accept action
  22070.             exit when (Current_Action in PD.Accept_Action_Range);
  22071.         
  22072.             if Current_Action in PD.Shift_Action_Range then
  22073.  
  22074.                 -- Pretty Printer Utility call
  22075.                 Source_Instrumenter_Utilities.Put(PD.CurToken);
  22076.  
  22077.                 -- Shift token from CurToken to ParseStack.
  22078.                 ParseStack.Push(PD.CurToken);
  22079.  
  22080.                 -- Add new state to top of StateStack
  22081.                 StateStack.Push(Current_Action);
  22082.          
  22083.                 -- Get next token.
  22084.                 PD.CurToken := Lex.GetNextNonCommentToken;
  22085.         
  22086.             elsif Current_Action in PD.Reduce_Action_Range then
  22087.         
  22088.                 Reduce_Action_Number := Current_Action -
  22089.                     StateCountPlusOne;
  22090.  
  22091.                 Reduce_Action_LH_Value  :=
  22092.                     PT.Get_LeftHandSide(Reduce_Action_Number);
  22093.  
  22094.                 Reduce_Action_RH_Size :=
  22095.                     PT.Get_RightHandSide(Reduce_Action_Number);
  22096.  
  22097.                 -- Reduce Parse Stack
  22098.                 ParseStack.Reduce(Reduce_Action_RH_Size);
  22099.  
  22100.                 ParseStack.Push((
  22101.                     gram_sym_val => Reduce_Action_LH_Value,
  22102.                     lexed_token => (
  22103.                         text => PD.Null_Source_Text,
  22104.                         srcpos_line => 0,
  22105.                         srcpos_column => 0)));
  22106.  
  22107.                 -- Reduce State Stack
  22108.                 StateStack.Reduce(Reduce_Action_RH_Size);
  22109.  
  22110.                 StateStack.Push(PT.GetAction(
  22111.                     StateStack.CopyTop,
  22112.                     Reduce_Action_LH_Value));
  22113.  
  22114.                 Apply_Actions(Reduce_Action_Number);
  22115.  
  22116.                 else -- Current_Action is in PD.Error_Action_Range
  22117.                     raise PD.Parser_Error;
  22118.             end if;
  22119.         end loop Do_Parse;
  22120.         return ParseStack.Pop;
  22121.     
  22122.     exception
  22123.         when PD.MemoryOverflow =>
  22124.             -- raised if Parse runs out of newable memory.
  22125.             raise PD.MemoryOverflow;
  22126.     
  22127.     end Parse;
  22128.     
  22129.     ------------------------------------------------------------------
  22130.  
  22131. end Parser;
  22132.  
  22133. ----------------------------------------------------------------------
  22134. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22135. --getnext.sub
  22136. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22137.  
  22138. with Source_Instrumenter_Utilities;
  22139. separate (Lex)
  22140. function GetNextNonCommentToken return PD.ParseStackElement is
  22141.  
  22142.     package SIU renames Source_Instrumenter_Utilities;
  22143.  
  22144. begin
  22145.     SIU.Comment_Buffer := SIU.Comment_Lists.Create;
  22146.     loop
  22147.         CST := GetNextSourceToken;
  22148.         exit when (CST.gram_sym_val = PT.EOF_TokenValue) or
  22149.             (CST.gram_sym_val /= PT.Comment_TokenValue);
  22150.         SIU.Comment_Lists.Attach(SIU.Comment_Buffer, CST);
  22151.     end loop;
  22152.     return CST;    -- return the token that is not a comment
  22153. end GetNextNonCommentToken;
  22154. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22155. --applyact.sub
  22156. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22157.  
  22158.  separate (Parser)
  22159.  procedure Apply_Actions(Rule_Number : in PT.LeftHandSideRange) is
  22160.  
  22161.     -- all procedure calls in this unit are procedures in package
  22162.     -- Source_Instrumenter_Utilities
  22163.  
  22164.      use Source_Instrumenter_Utilities;
  22165.  
  22166.  begin
  22167.  
  22168.      case Rule_Number is
  22169.  
  22170.  
  22171.  -------------------------------------------------------------------
  22172.  -- pragma ::= PRAGMA identifier ( general_component_associations ) ;  
  22173.  
  22174.   when 1
  22175.  
  22176.  -------------------------------------------------------------------
  22177.  -- pragma ::= PRAGMA identifier ;  
  22178.  
  22179.   | 2 =>
  22180.  
  22181.          New_Line;
  22182.  
  22183.  -------------------------------------------------------------------
  22184.  -- basic_declaration ::= type_declaration  
  22185.  
  22186.   when 3 =>
  22187.  
  22188.          End_Type_Declaration;
  22189.  
  22190.  -------------------------------------------------------------------
  22191.  -- basic_colon_declaration ::= object_declaration  
  22192.  
  22193.   when 11
  22194.  
  22195.  -------------------------------------------------------------------
  22196.  -- basic_colon_declaration ::= number_declaration  
  22197.  
  22198.   | 12
  22199.  
  22200.  -------------------------------------------------------------------
  22201.  -- basic_colon_declaration ::= exception_declaration  
  22202.  
  22203.   | 13
  22204.  
  22205.  -------------------------------------------------------------------
  22206.  -- basic_colon_declaration ::= renaming_colon_declaration  
  22207.  
  22208.   | 14 =>
  22209.  
  22210.          New_Line;
  22211.  
  22212.  -------------------------------------------------------------------
  22213.  -- object_declaration ::= identifier_list : subtype_indication [:=expression] ; 
  22214.  
  22215.   when 15 =>
  22216.  
  22217.          Set_Identifier_Mode (Read_Write);
  22218.          Process_Identifier_List (Object_List);
  22219.  
  22220.  -------------------------------------------------------------------
  22221.  -- object_declaration ::= identifier_list : CONSTANT subtype_indication ;  
  22222.  
  22223.   when 16 =>
  22224.  
  22225.          Set_Identifier_Mode (Read_Only);
  22226.          Process_Identifier_List (Object_List);
  22227.  
  22228.  -------------------------------------------------------------------
  22229.  -- object_declaration ::= identifier_list : start_cad  
  22230.  --     constrained_array_definition  
  22231.  
  22232.   when 17 =>
  22233.  
  22234.          Set_Identifier_Mode (Read_Write);
  22235.          Process_Identifier_List (Object_List);
  22236.  
  22237.  -------------------------------------------------------------------
  22238.  -- object_declaration ::= identifier_list : CONSTANT start_cad end_cad ;  
  22239.  
  22240.   when 18 =>
  22241.  
  22242.          Set_Identifier_Mode (Read_Only);
  22243.          Process_Identifier_List (Object_List);
  22244.  
  22245.  -------------------------------------------------------------------
  22246.  -- start_cad ::= empty  
  22247.  
  22248.   when 19 =>
  22249.  
  22250.          Start_Anonymous_Array_Definition;
  22251.  
  22252.  -------------------------------------------------------------------
  22253.  -- number_declaration ::= identifier_list : CONSTANT := expression ;  
  22254.  
  22255.   when 21 =>
  22256.  
  22257.          Set_Identifier_Mode (Read_Only);
  22258.          Process_Identifier_List (Object_List);
  22259.  
  22260.  -------------------------------------------------------------------
  22261.  -- save_identifier ::= identifier  
  22262.  
  22263.   when 23 =>
  22264.  
  22265.          Add_Identifier_To_List;
  22266.  
  22267.  -------------------------------------------------------------------
  22268.  -- type_identifier ::= identifier  
  22269.  
  22270.   when 29 =>
  22271.  
  22272.           Save_Type_Identifier;
  22273.  
  22274.  -------------------------------------------------------------------
  22275.  -- type_definition ::= array_type_definition ;  
  22276.  
  22277.   when 33 =>
  22278.  
  22279.          -- temporary until array processing done --
  22280.          -- beware generic array type definitions --
  22281.          Start_Trace_Procedure (Array_Type);
  22282.  
  22283.  -------------------------------------------------------------------
  22284.  -- type_definition ::= record_type_definition ;  
  22285.  
  22286.   when 34 =>
  22287.  
  22288.          Decrease_Indent;
  22289.  
  22290.          -- temporary until record processing done --
  22291.          Start_Trace_Procedure (Record_Type);
  22292.  
  22293.  -------------------------------------------------------------------
  22294.  -- type_definition ::= access_type_definition ;  
  22295.  
  22296.   when 35 =>
  22297.  
  22298.  
  22299.          -- temporary:  beware generic access type definitions --
  22300.          Start_Trace_Procedure (Access_Type);
  22301.  
  22302.  -------------------------------------------------------------------
  22303.  -- type_mark ::= type_name|subtype_name  
  22304.  
  22305.   when 40 =>
  22306.  
  22307.          End_Typemark;
  22308.  
  22309.  -------------------------------------------------------------------
  22310.  -- derived_type_definition ::= NEW start_expanded_name subtype_indication  
  22311.  
  22312.   when 45 =>
  22313.  
  22314.          Start_Trace_Procedure (Derived_Type);
  22315.  
  22316.  -------------------------------------------------------------------
  22317.  -- enumeration_type_definition ::= ( enumeration_literal_specification )  
  22318.  
  22319.   when 48 =>
  22320.  
  22321.          Start_Trace_Procedure (Enumeration_Type);
  22322.  
  22323.  -------------------------------------------------------------------
  22324.  -- integer_type_definition ::= range_constraint  
  22325.  
  22326.   when 52 =>
  22327.  
  22328.          Start_Trace_Procedure (Integer_Type);
  22329.  
  22330.  -------------------------------------------------------------------
  22331.  -- real_type_definition ::= floating_point_constraint  
  22332.  
  22333.   when 53 =>
  22334.  
  22335.          Start_Trace_Procedure (Float_Type);
  22336.  
  22337.  -------------------------------------------------------------------
  22338.  -- real_type_definition ::= fixed_point_constraint  
  22339.  
  22340.   when 54 =>
  22341.  
  22342.          Start_Trace_Procedure (Fixed_Type);
  22343.  
  22344.  -------------------------------------------------------------------
  22345.  -- component_list ::= {pragma_decl} {component_declaration}  
  22346.  --     component_declaration  
  22347.  
  22348.   when 70
  22349.  
  22350.  -------------------------------------------------------------------
  22351.  -- component_list ::= {pragma_decl} {component_declaration}' variant_part  
  22352.  
  22353.   | 71 =>
  22354.  
  22355.           Decrease_Indent;
  22356.  
  22357.  -------------------------------------------------------------------
  22358.  -- component_list ::= null_statement {pragma_decl}  
  22359.  
  22360.   when 72 =>
  22361.  
  22362.          -- buffering started at record_terminal so must print out
  22363.          Print_Colon_Declarations_Buffer;
  22364.          Decrease_Indent;
  22365.  
  22366.  -------------------------------------------------------------------
  22367.  -- component_declaration ::= identifier_list : subtype_indication  
  22368.  --     [:=expression] ;  
  22369.  
  22370.   when 73 =>
  22371.  
  22372.          New_Line;
  22373.          Process_Identifier_List (Record_Field_List);
  22374.  
  22375.  -------------------------------------------------------------------
  22376.  -- discriminant_specification ::= identifier_list : start_expanded_name  
  22377.  --     type_mark  
  22378.  
  22379.   when 74 =>
  22380.  
  22381.          Process_Identifier_List (Discriminant_List);
  22382.  
  22383.  -------------------------------------------------------------------
  22384.  -- variant_part ::= CASE__identifier__IS {pragma_variant}__variant__{variant}  
  22385.  --     END  
  22386.  
  22387.   when 75 =>
  22388.  
  22389.          New_Line;
  22390.  
  22391.  -------------------------------------------------------------------
  22392.  -- declarative_part ::= start_bdi {basic_declarative_item}  
  22393.  
  22394.   when 85
  22395.  
  22396.  -------------------------------------------------------------------
  22397.  -- declarative_part ::= start_bdi {basic_declarative_item} body  
  22398.  
  22399.   | 86 =>
  22400.  
  22401.          Decrease_Indent;
  22402.          End_Declarative_Part;
  22403.  
  22404.  -------------------------------------------------------------------
  22405.  -- start_bdi ::= empty  
  22406.  
  22407.   when 87 =>
  22408.  
  22409.          Start_Declarative_Part;
  22410.  
  22411.  -------------------------------------------------------------------
  22412.  -- basic_declarative_item ::= basic_declaration  
  22413.  
  22414.   when 88
  22415.  
  22416.  -------------------------------------------------------------------
  22417.  -- basic_declarative_item ::= representation_clause  
  22418.  
  22419.   | 89
  22420.  
  22421.  -------------------------------------------------------------------
  22422.  -- basic_declarative_item ::= use_clause  
  22423.  
  22424.   | 90
  22425.  
  22426.  -------------------------------------------------------------------
  22427.  -- later_declarative_item ::= subprogram_declaration  
  22428.  
  22429.   | 92
  22430.  
  22431.  -------------------------------------------------------------------
  22432.  -- later_declarative_item ::= package_declaration  
  22433.  
  22434.   | 93
  22435.  
  22436.  -------------------------------------------------------------------
  22437.  -- later_declarative_item ::= task_specification  
  22438.  
  22439.   | 94
  22440.  
  22441.  -------------------------------------------------------------------
  22442.  -- later_declarative_item ::= generic_specification  
  22443.  
  22444.   | 95
  22445.  
  22446.  -------------------------------------------------------------------
  22447.  -- later_declarative_item ::= use_clause  
  22448.  
  22449.   | 96
  22450.  
  22451.  -------------------------------------------------------------------
  22452.  -- later_declarative_item ::= generic_instantiation  
  22453.  
  22454.   | 97
  22455.  
  22456.  -------------------------------------------------------------------
  22457.  -- body ::= proper_body  
  22458.  
  22459.   | 98
  22460.  
  22461.  -------------------------------------------------------------------
  22462.  -- body ::= body_stub  
  22463.  
  22464.   | 99 =>
  22465.  
  22466.          New_Line;
  22467.  
  22468.  -------------------------------------------------------------------
  22469.  -- proper_body ::= subprogram_body  
  22470.  
  22471.   when 100
  22472.  
  22473.  -------------------------------------------------------------------
  22474.  -- proper_body ::= package_body  
  22475.  
  22476.   | 101
  22477.  
  22478.  -------------------------------------------------------------------
  22479.  -- proper_body ::= task_body  
  22480.  
  22481.   | 102 =>
  22482.  
  22483.          Switch_Comment_Context;
  22484.  
  22485.  -------------------------------------------------------------------
  22486.  -- binary_adding_operator ::= +  
  22487.  
  22488.   when 156
  22489.  
  22490.  -------------------------------------------------------------------
  22491.  -- binary_adding_operator ::= -  
  22492.  
  22493.   | 157 =>
  22494.  
  22495.          Put_Space;
  22496.  
  22497.  -------------------------------------------------------------------
  22498.  -- sequence_of_statements ::= {pragma_stm} statement {statement}  
  22499.  
  22500.   when 174 =>
  22501.  
  22502.          Decrease_Indent;
  22503.  
  22504.  -------------------------------------------------------------------
  22505.  -- simple_statement ::= break_decision_point exit_statement  
  22506.  
  22507.   when 182
  22508.  
  22509.  -------------------------------------------------------------------
  22510.  -- simple_statement ::= break_always return_statement  
  22511.  
  22512.   | 183
  22513.  
  22514.  -------------------------------------------------------------------
  22515.  -- simple_statement ::= break_every_statement goto_statement  
  22516.  
  22517.   | 184
  22518.  
  22519.  -------------------------------------------------------------------
  22520.  -- simple_statement ::= break_every_statement abort_statement  
  22521.  
  22522.   | 186
  22523.  
  22524.  -------------------------------------------------------------------
  22525.  -- simple_statement ::= break_every_statement raise_statement  
  22526.  
  22527.   | 187
  22528.  
  22529.  -------------------------------------------------------------------
  22530.  -- compound_statement ::= break_decision_point if_statement  
  22531.  
  22532.   | 188
  22533.  
  22534.  -------------------------------------------------------------------
  22535.  -- compound_statement ::= break_decision_point case_statement  
  22536.  
  22537.   | 189
  22538.  
  22539.  -------------------------------------------------------------------
  22540.  -- compound_statement ::= break_decision_point select_statement  
  22541.  
  22542.   | 191
  22543.  
  22544.  -------------------------------------------------------------------
  22545.  -- ambiguous_statement ::= break_ambiguous assignment_statement  
  22546.  
  22547.   | 192
  22548.  
  22549.  -------------------------------------------------------------------
  22550.  -- ambiguous_statement ::= break_ambiguous code_statement  
  22551.  
  22552.   | 194
  22553.  
  22554.  -------------------------------------------------------------------
  22555.  -- ambiguous_statement ::= break_ambiguous loop_statement  
  22556.  
  22557.   | 195
  22558.  
  22559.  -------------------------------------------------------------------
  22560.  -- ambiguous_statement ::= break_ambiguous block_statement  
  22561.  
  22562.   | 196 =>
  22563.  
  22564.          New_Line;
  22565.  
  22566.  -------------------------------------------------------------------
  22567.  -- break_every_statement ::= empty  
  22568.  
  22569.   when 197 =>
  22570.  
  22571.          Add_Breakpoint (Every_Statement);
  22572.  
  22573.  -------------------------------------------------------------------
  22574.  -- break_decision_point ::= empty  
  22575.  
  22576.   when 198 =>
  22577.  
  22578.          Add_Breakpoint (Decision_Point);
  22579.  
  22580.  -------------------------------------------------------------------
  22581.  -- break_always ::= empty  
  22582.  
  22583.   when 199 =>
  22584.  
  22585.          Add_Breakpoint (Always);
  22586.  
  22587.  -------------------------------------------------------------------
  22588.  -- break_ambiguous ::= empty  
  22589.  
  22590.   when 200 =>
  22591.  
  22592.          Add_Breakpoint (Ambiguous);
  22593.  
  22594.  -------------------------------------------------------------------
  22595.  -- resolve_simple ::= empty  
  22596.  
  22597.   when 201 =>
  22598.  
  22599.          Resolve_Breakpoint (Simple_Statement);
  22600.  
  22601.  -------------------------------------------------------------------
  22602.  -- null_statement ::= NULL ;  
  22603.  
  22604.   when 203 =>
  22605.  
  22606.          New_Line;
  22607.  
  22608.  -------------------------------------------------------------------
  22609.  -- sequence_of_statements__end_block_statements ::= sequence_of_statements  
  22610.  
  22611.   when 217 =>
  22612.  
  22613.          End_Block_Sequence_of_Statements;
  22614.  
  22615.  -------------------------------------------------------------------
  22616.  
  22617.  -- block_statement ::= [block_identifier:] declare_terminal 
  22618.  -- declarative_part__begin_end_block [identifier] ;
  22619.  
  22620.    when 218
  22621.          
  22622.  -------------------------------------------------------------------
  22623.  
  22624.  -- block_statement ::= [block_identifier:] begin_end_block [identifier] ;
  22625.  
  22626.       | 219 => 
  22627.          
  22628.          End_Block_Statement;
  22629.  
  22630.  -------------------------------------------------------------------
  22631.  
  22632.  -- subprogram_declaration ::= subprogram_specification ;  
  22633.  
  22634.   when 227 =>
  22635.  
  22636.          Pop_Identifier;
  22637.  
  22638.  -------------------------------------------------------------------
  22639.  -- subprogram_specification ::= PROCEDURE start_identifier  
  22640.  
  22641.   when 228
  22642.  
  22643.  -------------------------------------------------------------------
  22644.  -- subprogram_specification ::= PROCEDURE start_identifier left_paren  
  22645.  
  22646.   | 229 =>
  22647.  
  22648.          Subprogram_Type ("procedure");
  22649.  
  22650.  -------------------------------------------------------------------
  22651.  -- subprogram_specification ::= FUNCTION designator RETURN start_expanded_name  
  22652.  
  22653.   when 230
  22654.  
  22655.  -------------------------------------------------------------------
  22656.  -- subprogram_specification ::= FUNCTION designator left_paren right_paren  
  22657.  
  22658.   | 231 =>
  22659.  
  22660.          Subprogram_Type ("function");
  22661.  
  22662.  -------------------------------------------------------------------
  22663.  -- designator ::= identifier  
  22664.  
  22665.   when 232
  22666.  
  22667.  -------------------------------------------------------------------
  22668.  -- designator ::= string_literal  
  22669.  
  22670.   | 233 =>
  22671.  
  22672.          Push_Identifier;
  22673.  
  22674.  -------------------------------------------------------------------
  22675.  -- parameter_specification ::= identifier_list mode type_mark [:=expression]  
  22676.  
  22677.   when 234 =>
  22678.  
  22679.          Process_Identifier_List (Parameter_List);
  22680.  
  22681.  -------------------------------------------------------------------
  22682.  -- mode ::= : OUT  
  22683.  
  22684.   when 236 =>
  22685.  
  22686.          Set_Identifier_Mode (Write_Only);
  22687.  
  22688.  -------------------------------------------------------------------
  22689.  -- generic_parameter_mode ::= :  
  22690.  
  22691.   when 237 =>
  22692.  
  22693.          Insert_In_Token;
  22694.          Set_Identifier_Mode (Read_Only);
  22695.  
  22696.  -------------------------------------------------------------------
  22697.  -- generic_parameter_mode ::= : IN  
  22698.  
  22699.   when 238 =>
  22700.  
  22701.          null;
  22702.          Set_Identifier_Mode (Read_Only);
  22703.  
  22704.  -------------------------------------------------------------------
  22705.  -- generic_parameter_mode ::= : IN OUT  
  22706.  
  22707.   when 239 =>
  22708.  
  22709.          Set_Identifier_Mode (Read_Write);
  22710.  
  22711.  -------------------------------------------------------------------
  22712.  -- subprogram_body ::= subprogram_specification__IS [end_designator] ;  
  22713.  
  22714.   when 240 =>
  22715.  
  22716.          Decrement_Scope;
  22717.  
  22718.  -------------------------------------------------------------------
  22719.  -- call_statement ::= name resolve_simple ;  
  22720.  
  22721.   when 241 =>
  22722.  
  22723.          New_Line;
  22724.  
  22725.  -------------------------------------------------------------------
  22726.  -- package_declaration ::= package_specification ;  
  22727.  
  22728.   when 242 =>
  22729.  
  22730.          Decrement_Scope;
  22731.  
  22732.  -------------------------------------------------------------------
  22733.  -- package_body ::= PACKAGE__BODY__start_identifier__IS  
  22734.  --     declarative_part__no_begin  
  22735.  
  22736.   when 245
  22737.  
  22738.  -------------------------------------------------------------------
  22739.  -- package_body ::= PACKAGE__BODY__start_identifier__IS [identifier] ;  
  22740.  
  22741.   | 246 =>
  22742.  
  22743.          Decrement_Scope;
  22744.  
  22745.  -------------------------------------------------------------------
  22746.  -- declarative_part__no_begin ::= declarative_part  
  22747.  
  22748.   when 247 =>
  22749.  
  22750.          Add_Package_Body_Begin;
  22751.  
  22752.  -------------------------------------------------------------------
  22753.  -- private_type_declaration ::= TYPE type_identifier IS LIMITED PRIVATE ;  
  22754.  
  22755.   when 248 =>
  22756.  
  22757.          Start_Trace_Procedure (Limited_Private_Type);
  22758.  
  22759.  -------------------------------------------------------------------
  22760.  -- private_type_declaration ::= TYPE type_identifier left_paren right_paren IS  
  22761.  
  22762.   when 249 =>
  22763.  
  22764.          Start_Trace_Procedure (Limited_Private_Type);
  22765.  
  22766.  -------------------------------------------------------------------
  22767.  -- private_type_declaration ::= TYPE type_identifier IS PRIVATE ;  
  22768.  
  22769.   when 250 =>
  22770.  
  22771.          Start_Trace_Procedure (Private_Type);
  22772.  
  22773.  -------------------------------------------------------------------
  22774.  -- private_type_declaration ::= TYPE type_identifier left_paren right_paren IS  
  22775.  
  22776.   when 251 =>
  22777.  
  22778.          Start_Trace_Procedure (Private_Type);
  22779.  
  22780.  -------------------------------------------------------------------
  22781.  -- package_name ::= start_expanded_name expanded_name  
  22782.  
  22783.   when 253 =>
  22784.  
  22785.          Use_Package_Name;
  22786.  
  22787.  -------------------------------------------------------------------
  22788.  -- renaming_colon_declaration ::= identifier_list : type_mark RENAMES name ;  
  22789.  
  22790.   when 254
  22791.  
  22792.  -------------------------------------------------------------------
  22793.  -- renaming_colon_declaration ::= identifier_list : EXCEPTION RENAMES ;  
  22794.  
  22795.   | 255 =>
  22796.  
  22797.          Process_Identifier_List (Renaming_List);
  22798.  
  22799.  -------------------------------------------------------------------
  22800.  -- renaming_declaration ::= PACKAGE start_identifier RENAMES expanded_name ;  
  22801.  
  22802.   when 256
  22803.  
  22804.  -------------------------------------------------------------------
  22805.  -- renaming_declaration ::= subprogram_specification RENAMES name ;  
  22806.  
  22807.   | 257
  22808.  
  22809.  -------------------------------------------------------------------
  22810.  -- task_specification ::= TASK start_identifier ;  
  22811.  
  22812.   | 258 =>
  22813.  
  22814.          Pop_Identifier;
  22815.  
  22816.  -------------------------------------------------------------------
  22817.  -- task_specification ::= TASK TYPE start_identifier ;  
  22818.  
  22819.   when 259 =>
  22820.  
  22821.          Pop_Identifier;
  22822.          Start_Trace_Procedure (Task_Type);
  22823.          End_Type_Declaration;
  22824.  
  22825.  -------------------------------------------------------------------
  22826.   when 261 =>
  22827.          End_Type_Declaration;
  22828.  
  22829.  -------------------------------------------------------------------
  22830.  -- task_body ::= TASK__BODY__start_identifier__IS [identifier] ;  
  22831.  
  22832.   when 262 =>
  22833.  
  22834.          Decrement_Scope;
  22835.  
  22836.  -------------------------------------------------------------------
  22837.  -- entry_declaration ::= ENTRY identifier [(discrete_range)][formal_part] ;  
  22838.  
  22839.   when 263 =>
  22840.  
  22841.          New_Line;
  22842.  
  22843.  -------------------------------------------------------------------
  22844.  -- accept_statement ::= ACCEPT start_identifier [(expression)][formal_part] ;  
  22845.  
  22846.   when 264 =>
  22847.  
  22848.          Pop_Identifier;
  22849.          New_Line;
  22850.  
  22851.  -------------------------------------------------------------------
  22852.  -- accept_statement ::=  
  22853.  --     ACCEPT__start_identifier__[(expression)][formal_part]__DO  
  22854.  
  22855.   when 265
  22856.  
  22857.  -------------------------------------------------------------------
  22858.  -- delay_statement ::= DELAY__start_delay_expression ;  
  22859.  
  22860.   | 266 =>
  22861.  
  22862.          New_Line;
  22863.  
  22864.  -------------------------------------------------------------------
  22865.  -- DELAY__start_delay_expression ::= DELAY  
  22866.  
  22867.   when 267 =>
  22868.  
  22869.          Start_Delay_Expression;
  22870.  
  22871.  -------------------------------------------------------------------
  22872.  -- simple_expression__end_delay_expression ::= simple_expression  
  22873.  
  22874.   when 268 =>
  22875.  
  22876.          End_Delay_Expression;
  22877.  
  22878.  -------------------------------------------------------------------
  22879.  -- select_alternative ::= {pragma_stm}  
  22880.  
  22881.   when 273
  22882.  
  22883.  -------------------------------------------------------------------
  22884.  -- select_alternative ::= {pragma_stm} selective_wait_alternative  
  22885.  
  22886.   | 274 =>
  22887.  
  22888.          Decrease_Indent;
  22889.  
  22890.  -------------------------------------------------------------------
  22891.  -- TERMINATE__; ::= TERMINATE ;  
  22892.  
  22893.   when 281 =>
  22894.  
  22895.          New_Line;
  22896.  
  22897.  -------------------------------------------------------------------
  22898.  -- accept_statement__decision_point ::= accept_statement  
  22899.  
  22900.   when 284
  22901.  
  22902.  -------------------------------------------------------------------
  22903.  -- delay_statement__decision_point ::= delay_statement  
  22904.  
  22905.   | 285
  22906.  
  22907.  -------------------------------------------------------------------
  22908.  -- call_statement__decision_point ::= call_statement  
  22909.  
  22910.   | 286 =>
  22911.  
  22912.          Add_Breakpoint (Decision_Point);
  22913.  
  22914.  -------------------------------------------------------------------
  22915.  -- compilation_unit ::= pragma_header ( general_component_associations ) ;  
  22916.  
  22917.   when 290
  22918.  
  22919.  -------------------------------------------------------------------
  22920.  -- compilation_unit ::= pragma_header ;  
  22921.  
  22922.   | 291 =>
  22923.  
  22924.          New_Line;
  22925.  
  22926.  -------------------------------------------------------------------
  22927.  -- compilation_unit ::= context_clause library_or_secondary_unit  
  22928.  
  22929.   when 292 =>
  22930.  
  22931.          End_Compilation_Unit;
  22932.  
  22933.  -------------------------------------------------------------------
  22934.  -- library_or_secondary_unit ::= subprogram_body  
  22935.  
  22936.   when 297
  22937.  
  22938.  -------------------------------------------------------------------
  22939.  -- library_or_secondary_unit ::= package_body  
  22940.  
  22941.   | 298 =>
  22942.  
  22943.          Switch_Comment_Context;
  22944.  
  22945.  -------------------------------------------------------------------
  22946.  -- library_unit_name ::= identifier  
  22947.  
  22948.   when 302 =>
  22949.  
  22950.          With_Library_Unit;
  22951.  
  22952.  -------------------------------------------------------------------
  22953.  -- body_stub ::= subprogram_specification IS SEPARATE ;  
  22954.  
  22955.   when 303
  22956.  
  22957.  -------------------------------------------------------------------
  22958.  -- body_stub ::= PACKAGE BODY start_identifier IS SEPARATE ;  
  22959.  
  22960.   | 304
  22961.  
  22962.  -------------------------------------------------------------------
  22963.  -- body_stub ::= TASK BODY start_identifier IS SEPARATE ;  
  22964.  
  22965.   | 305 =>
  22966.  
  22967.          Pop_Identifier;
  22968.  
  22969.  -------------------------------------------------------------------
  22970.  -- exception_declaration ::= identifier_list : EXCEPTION ;  
  22971.  
  22972.   when 307 =>
  22973.  
  22974.          Process_Identifier_List (Exception_List);
  22975.  
  22976.  -------------------------------------------------------------------
  22977.  -- non_others_handler ::= WHEN__exception_choice__{|exception_choice}__=>  
  22978.  
  22979.   when 310
  22980.  
  22981.  -------------------------------------------------------------------
  22982.  -- others_handler ::= WHEN__exception_OTHERS__=> sequence_of_statements  
  22983.  
  22984.   | 311 =>
  22985.  
  22986.          End_Exception_Sequence_of_Statements;
  22987.  
  22988.  -------------------------------------------------------------------
  22989.  -- generic_specification ::= generic_formal_part subprogram_specification ;  
  22990.  
  22991.   when 315 =>
  22992.  
  22993.          Pop_Identifier;
  22994.  
  22995.  -------------------------------------------------------------------
  22996.  -- generic_specification ::= generic_formal_part package_specification ;  
  22997.  
  22998.   when 316 =>
  22999.  
  23000.           Decrement_Scope;
  23001.  
  23002.  -------------------------------------------------------------------
  23003.  -- generic_formal_part ::= generic_terminal {generic_parameter_declaration}  
  23004.  
  23005.   when 317 =>
  23006.  
  23007.          Decrease_Indent;
  23008.  
  23009.  -------------------------------------------------------------------
  23010.  -- generic_parameter_declaration ::= identifier_list generic_parameter_mode ;  
  23011.  
  23012.   when 318 =>
  23013.  
  23014.         New_Line;
  23015.         Process_Identifier_List (Generic_Object_List);
  23016.  
  23017.  -------------------------------------------------------------------
  23018.  -- generic_parameter_declaration ::= TYPE identifier IS generic_type_definition 
  23019.  --     ;  
  23020.  
  23021.   when 319
  23022.  
  23023.  -------------------------------------------------------------------
  23024.  -- generic_parameter_declaration ::= TYPE identifier left_paren right_paren IS  
  23025.  
  23026.   | 320 =>
  23027.  
  23028.          New_Line;
  23029.  
  23030.  -------------------------------------------------------------------
  23031.  -- generic_parameter_declaration ::= WITH subprogram_specification ;  
  23032.  
  23033.   when 321 =>
  23034.  
  23035.          New_Line;
  23036.          Pop_Identifier;
  23037.  
  23038.  -------------------------------------------------------------------
  23039.  -- generic_instantiation ::= PACKAGE start_identifier IS__NEW__expanded_name ;  
  23040.  
  23041.   when 330
  23042.  
  23043.  -------------------------------------------------------------------
  23044.  -- generic_instantiation ::= PACKAGE start_identifier IS__NEW__expanded_name (  
  23045.  --     )  
  23046.  
  23047.   | 331
  23048.  
  23049.  -------------------------------------------------------------------
  23050.  -- generic_instantiation ::= FUNCTION designator IS__NEW__expanded_name ;  
  23051.  
  23052.   | 332
  23053.  
  23054.  -------------------------------------------------------------------
  23055.  -- generic_instantiation ::= FUNCTION designator IS__NEW__expanded_name ( ) ;  
  23056.  
  23057.   | 333
  23058.  
  23059.  -------------------------------------------------------------------
  23060.  -- generic_instantiation ::= subprogram_specification IS__NEW__expanded_name ;  
  23061.  
  23062.   | 334
  23063.  
  23064.  -------------------------------------------------------------------
  23065.  -- generic_instantiation ::= subprogram_specification IS__NEW__expanded_name (  
  23066.  --     )  
  23067.  
  23068.   | 335 =>
  23069.  
  23070.          Decrease_Indent;
  23071.          Pop_Identifier;
  23072.  
  23073.  -------------------------------------------------------------------
  23074.  -- IS__NEW__expanded_name ::= generic_instantiation_IS NEW start_expanded_name  
  23075.  
  23076.   when 336 =>
  23077.  
  23078.          Save_Generic_Name;
  23079.  
  23080.  -------------------------------------------------------------------
  23081.  -- generic_instantiation_IS ::= IS  
  23082.  
  23083.   when 337 =>
  23084.  
  23085.          New_Line;
  23086.          Increase_Indent;
  23087.  
  23088.  -------------------------------------------------------------------
  23089.  -- representation_clause ::= record_representation_clause  
  23090.  
  23091.   when 345 =>
  23092.  
  23093.          Decrease_Indent;
  23094.  
  23095.  -------------------------------------------------------------------
  23096.  -- component_clause ::= name AT simple_expression range_constraint ;  
  23097.  
  23098.   when 350 =>
  23099.  
  23100.          New_Line;
  23101.  
  23102.  -------------------------------------------------------------------
  23103.  -- alignment_clause ::= AT MOD simple_expression ;  
  23104.  
  23105.   when 351 =>
  23106.  
  23107.          New_Line;
  23108.          Increase_Indent;
  23109.  
  23110.  -------------------------------------------------------------------
  23111.  -- [loop_identifier:] ::= empty  
  23112.  
  23113.   when 440 =>
  23114.  
  23115.          Push_Empty_Token;
  23116.          Resolve_Breakpoint (Loop_No_Identifier);
  23117.  
  23118.  -------------------------------------------------------------------
  23119.  -- [loop_identifier:] ::= identifier :  
  23120.  
  23121.   when 441 =>
  23122.  
  23123.          Push_Identifier;
  23124.          Resolve_Breakpoint (Loop_With_Identifier);
  23125.  
  23126.  -------------------------------------------------------------------
  23127.  -- [identifier] ::= empty  
  23128.  
  23129.   when 442 =>
  23130.  
  23131.          Pop_Identifier(To_Output);
  23132.  
  23133.  -------------------------------------------------------------------
  23134.  -- [identifier] ::= identifier  
  23135.  
  23136.   when 443 =>
  23137.  
  23138.          Pop_Identifier;
  23139.  
  23140.  -------------------------------------------------------------------
  23141.  -- [block_identifier:] ::= empty  
  23142.  
  23143.   when 444 =>
  23144.  
  23145.          Resolve_Breakpoint (Block_No_Identifier);
  23146.  
  23147.  -------------------------------------------------------------------
  23148.  -- [block_identifier:] ::= identifier :  
  23149.  
  23150.   when 445 =>
  23151.  
  23152.          Push_Identifier;
  23153.          Resolve_Breakpoint (Block_With_Identifier);
  23154.  
  23155.  -------------------------------------------------------------------
  23156.  -- [exception_handler_part] ::= empty  
  23157.  
  23158.   when 446 =>
  23159.  
  23160.          Add_Exception_Handler;
  23161.  
  23162.  -------------------------------------------------------------------
  23163.  -- {pragma_alt}__exception_handler ::= {pragma_alt} exception_handler  
  23164.  
  23165.   when 448 =>
  23166.  
  23167.          Decrease_Indent;
  23168.  
  23169.  -------------------------------------------------------------------
  23170.  -- [others_handler] ::= empty  
  23171.  
  23172.   when 451 =>
  23173.  
  23174.          Add_Others_Handler;
  23175.  
  23176.  -------------------------------------------------------------------
  23177.  -- [end_designator] ::= empty  
  23178.  
  23179.   when 455 =>
  23180.  
  23181.          Pop_Identifier(To_Output);
  23182.  
  23183.  -------------------------------------------------------------------
  23184.  -- [end_designator] ::= identifier  
  23185.  
  23186.   when 456
  23187.  
  23188.  -------------------------------------------------------------------
  23189.  -- [end_designator] ::= string_literal  
  23190.  
  23191.   | 457 =>
  23192.  
  23193.          Pop_Identifier;
  23194.  
  23195.  -------------------------------------------------------------------
  23196.  -- {with_clause{use_clause}} ::= {with_clause{use_clause}} with_clause  
  23197.  
  23198.   when 481 =>
  23199.  
  23200.          New_Line;
  23201.  
  23202.  -------------------------------------------------------------------
  23203.    when 485 =>
  23204.          With_Library_Unit;
  23205.   
  23206.  -------------------------------------------------------------------
  23207.  -- record_terminal ::= RECORD  
  23208.  
  23209.   when 499 =>
  23210.  
  23211.          New_Line;
  23212.          Increase_Indent;
  23213.          Start_Buffering_Colon_Declarations;
  23214.          -- Generate ("start of record type tracevar");
  23215.  
  23216.  -------------------------------------------------------------------
  23217.  -- closing_{pragma_decl} ::= {pragma_decl}  
  23218.  
  23219.   when 500
  23220.  
  23221.  -------------------------------------------------------------------
  23222.  -- {component_declaration}' ::= {component_declaration}  
  23223.  
  23224.   | 501 =>
  23225.  
  23226.          Print_Colon_Declarations_Buffer;
  23227.  
  23228.  -------------------------------------------------------------------
  23229.  -- start_of_record_type ::= EMPTY  
  23230.  
  23231.   when 502
  23232.  
  23233.  -------------------------------------------------------------------
  23234.  -- repspec_record_terminal ::= RECORD  
  23235.  
  23236.   | 503
  23237.  
  23238.  -------------------------------------------------------------------
  23239.  -- CASE__identifier__IS ::= CASE__identifier IS  
  23240.  
  23241.   | 504
  23242.  
  23243.  -------------------------------------------------------------------
  23244.  -- WHEN__choice__{|choice}__=> ::= WHEN choice {|choice} =>  
  23245.  
  23246.   | 505
  23247.  
  23248.  -------------------------------------------------------------------
  23249.  -- WHEN__OTHERS__=> ::= WHEN OTHERS =>  
  23250.  
  23251.   | 506
  23252.  
  23253.  -------------------------------------------------------------------
  23254.  -- CASE__expression__IS ::= CASE expression IS  
  23255.  
  23256.   | 507 =>
  23257.  
  23258.          New_Line;
  23259.          Increase_Indent;
  23260.  
  23261.  -------------------------------------------------------------------
  23262.  -- generic_terminal ::= GENERIC  
  23263.  
  23264.   when 508 =>
  23265.  
  23266.          New_Line;
  23267.          Increase_Indent;
  23268.  
  23269.  -------------------------------------------------------------------
  23270.  -- CASE__identifier ::= CASE identifier  
  23271.  
  23272.   when 509 =>
  23273.  
  23274.          null;
  23275.          -- Generate ("case var.identifier for record variant");
  23276.  
  23277.  -------------------------------------------------------------------
  23278.  -- WHEN__variant_choice__{|variant_choice}__=> ::= WHEN__choice__{|choice}__=>  
  23279.  
  23280.   when 510
  23281.  
  23282.  -------------------------------------------------------------------
  23283.  -- WHEN__variant_OTHERS__=> ::= WHEN__OTHERS__=>  
  23284.  
  23285.   | 511 =>
  23286.  
  23287.          Start_Buffering_Colon_Declarations;
  23288.  
  23289.  -------------------------------------------------------------------
  23290.  -- WHEN__case_choice__{|choice}__=> ::= WHEN__choice__{|choice}__=>  
  23291.  
  23292.   when 512
  23293.  
  23294.  -------------------------------------------------------------------
  23295.  -- WHEN__case_OTHERS__=> ::= WHEN__OTHERS__=>  
  23296.  
  23297.   | 513 =>
  23298.  
  23299.          Add_Breakpoint (Decision_Point);
  23300.  
  23301.  -------------------------------------------------------------------
  23302.  -- {pragma_alt}__case_statement_alternative__{case_statement_alternative} ::=  
  23303.  
  23304.   when 514 =>
  23305.  
  23306.          Decrease_Indent;
  23307.  
  23308.  -------------------------------------------------------------------
  23309.  -- loop_terminal ::= LOOP  
  23310.  
  23311.   when 515 =>
  23312.  
  23313.          New_Line;
  23314.          Increase_Indent;
  23315.          Start_Loop;
  23316.  
  23317.  -------------------------------------------------------------------
  23318.  -- begin_terminal ::= BEGIN  
  23319.  
  23320.   when 516 =>
  23321.  
  23322.          Switch_Comment_Context;
  23323.          New_Line;
  23324.          Increase_Indent;
  23325.          Start_Begin_End_Block;
  23326.  
  23327.  -------------------------------------------------------------------
  23328.  -- {pragma_variant}__variant__{variant} ::= {pragma_variant} variant {variant}  
  23329.  
  23330.   when 517 =>
  23331.  
  23332.          Decrease_Indent;
  23333.  
  23334.  -------------------------------------------------------------------
  23335.  -- declare_terminal ::= DECLARE  
  23336.  
  23337.   when 518 =>
  23338.  
  23339.          Switch_Comment_Context;
  23340.          New_Line;
  23341.          Increase_Indent;
  23342.  
  23343.  -------------------------------------------------------------------
  23344.  -- PACKAGE__start_identifier__IS ::= PACKAGE start_identifier IS  
  23345.  
  23346.   when 519 =>
  23347.  
  23348.          Increment_Scope (Package_Specification);
  23349.          New_Line;
  23350.          Increase_Indent;
  23351.  
  23352.  -------------------------------------------------------------------
  23353.  -- start_identifier ::= identifier  
  23354.  
  23355.   when 520 =>
  23356.  
  23357.          Push_Identifier;
  23358.  
  23359.  -------------------------------------------------------------------
  23360.  -- {basic_declarative_item}' ::= {basic_declarative_item}  
  23361.  
  23362.   when 521
  23363.  
  23364.  -------------------------------------------------------------------
  23365.  -- {entry_declaration}__{representation_clause} ::= {entry_declaration}  
  23366.  
  23367.   | 522 =>
  23368.  
  23369.          Decrease_Indent;
  23370.  
  23371.  -------------------------------------------------------------------
  23372.  -- private_terminal ::= PRIVATE  
  23373.  
  23374.   when 523 =>
  23375.  
  23376.          New_Line;
  23377.          Increase_Indent;
  23378.          Start_Private_Part;
  23379.  
  23380.  -------------------------------------------------------------------
  23381.  -- PACKAGE__BODY__start_identifier__IS ::= PACKAGE BODY start_identifier IS  
  23382.  
  23383.   when 524 =>
  23384.  
  23385.          Increment_Scope (Package_Body);
  23386.          New_Line;
  23387.          Increase_Indent;
  23388.  
  23389.  -------------------------------------------------------------------
  23390.  -- TASK__start_identifier__IS ::= TASK start_identifier IS  
  23391.  
  23392.   when 525 =>
  23393.  
  23394.          New_Line;
  23395.          Increase_Indent;
  23396.  
  23397.  -------------------------------------------------------------------
  23398.  -- TASK__TYPE__start_identifier__IS ::= TASK TYPE start_identifier IS  
  23399.  
  23400.   when 526 =>
  23401.  
  23402.          New_Line;
  23403.          Increase_Indent;
  23404.          Start_Trace_Procedure (Task_Type);
  23405.  
  23406.  -------------------------------------------------------------------
  23407.  -- TASK__BODY__start_identifier__IS ::= TASK BODY start_identifier IS  
  23408.  
  23409.   when 527 =>
  23410.  
  23411.          Increment_Scope (Task_Body);
  23412.          New_Line;
  23413.          Increase_Indent;
  23414.  
  23415.  -------------------------------------------------------------------
  23416.  -- ACCEPT__start_identifier__[(expression)][formal_part]__DO ::= ACCEPT DO  
  23417.  
  23418.   when 528
  23419.  
  23420.  -------------------------------------------------------------------
  23421.  -- select_terminal ::= SELECT  
  23422.  
  23423.   | 529 =>
  23424.  
  23425.          New_Line;
  23426.          Increase_Indent;
  23427.  
  23428.  -------------------------------------------------------------------
  23429.  -- call_statement__[sequence_of_statements] ::= call_statement__decision_point  
  23430.  
  23431.   when 530 =>
  23432.  
  23433.          Decrease_Indent;
  23434.  
  23435.  -------------------------------------------------------------------
  23436.  -- delay_alternative_in_timed_entry ::= delay_alternative  
  23437.  
  23438.   when 532
  23439.  
  23440.  -------------------------------------------------------------------
  23441.  -- WHEN__condition__=>__selective_wait_alternative ::= WHEN__condition__=>  
  23442.  
  23443.   | 533 =>
  23444.  
  23445.          Decrease_Indent;
  23446.  
  23447.  -------------------------------------------------------------------
  23448.  -- WHEN__condition__=> ::= WHEN condition =>  
  23449.  
  23450.   when 534
  23451.  
  23452.  -------------------------------------------------------------------
  23453.  -- exception_terminal ::= EXCEPTION  
  23454.  
  23455.   | 535 =>
  23456.  
  23457.          New_Line;
  23458.          Increase_Indent;
  23459.  
  23460.  -------------------------------------------------------------------
  23461.  -- WHEN__exception_choice__{|exception_choice}__=> ::= WHEN exception_choice => 
  23462.  
  23463.   when 536
  23464.  
  23465.  -------------------------------------------------------------------
  23466.  -- WHEN__exception_OTHERS__=> ::= WHEN OTHERS =>  
  23467.  
  23468.   | 537 =>
  23469.  
  23470.          New_Line;
  23471.          Increase_Indent;
  23472.          Start_Exception_Branch;
  23473.  
  23474.  -------------------------------------------------------------------
  23475.  -- subprogram_specification__IS ::= subprogram_specification IS  
  23476.  
  23477.   when 538 =>
  23478.  
  23479.          Increment_Scope (Subprogram_Body);
  23480.          New_Line;
  23481.          Increase_Indent;
  23482.  
  23483.  -------------------------------------------------------------------
  23484.  -- {component_clause}' ::= {component_clause}  
  23485.  
  23486.   when 539 =>
  23487.  
  23488.          Decrease_Indent;
  23489.  
  23490.  -------------------------------------------------------------------
  23491.  -- SEPARATE__(__expanded_name__) ::= SEPARATE__(__expanded_name )  
  23492.  
  23493.   when 540 =>
  23494.  
  23495.          New_Line;
  23496.  
  23497.  -------------------------------------------------------------------
  23498.  -- SEPARATE__(__expanded_name ::= SEPARATE ( start_expanded_name expanded_name  
  23499.  
  23500.   when 541 =>
  23501.  
  23502.          Save_Separate_Name;
  23503.  
  23504.  -------------------------------------------------------------------
  23505.  -- start_expanded_name ::= empty  
  23506.  
  23507.   when 542 =>
  23508.  
  23509.          Start_Saving_Expanded_Name;
  23510.  
  23511.  -------------------------------------------------------------------
  23512.  -- {basic_colon_declaration} ::= start_{basic_colon_declaration} {pragma_decl}  
  23513.  
  23514.   when 543 =>
  23515.  
  23516.          Print_Colon_Declarations_Buffer;
  23517.  
  23518.  -------------------------------------------------------------------
  23519.  -- start_{basic_colon_declaration} ::= EMPTY  
  23520.  
  23521.   when 544 =>
  23522.  
  23523.          Start_Buffering_Colon_Declarations;
  23524.  
  23525.  -------------------------------------------------------------------
  23526.  -- condition__THEN ::= condition THEN  
  23527.  
  23528.   when 549
  23529.  
  23530.  -------------------------------------------------------------------
  23531.  -- ELSIF__condition__THEN ::= ELSIF condition THEN  
  23532.  
  23533.   | 550
  23534.  
  23535.  -------------------------------------------------------------------
  23536.  -- else_terminal ::= ELSE  
  23537.  
  23538.   | 551 =>
  23539.  
  23540.          New_Line;
  23541.          Increase_Indent;
  23542.          Add_Breakpoint (Decision_Point);
  23543.  
  23544.  -------------------------------------------------------------------
  23545.  -- or_terminal ::= OR  
  23546.  
  23547.   when 552 =>
  23548.  
  23549.          New_Line;
  23550.          Increase_Indent;
  23551.  
  23552.  -------------------------------------------------------------------
  23553.  -- discriminant__; ::= ;  
  23554.  
  23555.   when 553
  23556.  
  23557.  -------------------------------------------------------------------
  23558.  -- parameter__; ::= ;  
  23559.  
  23560.   | 554 =>
  23561.  
  23562.          New_Line;
  23563.  
  23564.  -------------------------------------------------------------------
  23565.  -- left_paren ::= (  
  23566.  
  23567.   when 555 =>
  23568.  
  23569.          Change_Indent;
  23570.          Start_Buffering_Colon_Declarations;
  23571.  
  23572.  -------------------------------------------------------------------
  23573.  -- right_paren ::= )  
  23574.  
  23575.   when 556 =>
  23576.  
  23577.          Print_Colon_Declarations_Buffer;
  23578.          Resume_Normal_Indentation;
  23579.  
  23580.      when others =>
  23581.          null;
  23582.      end case;
  23583.  end Apply_Actions;
  23584.  
  23585. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23586. --si.ada
  23587. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23588.  
  23589. with Source_Instrumenter_Declarations;   -- Parameters of pretty printer
  23590. with Source_Instrumenter_Utilities;
  23591. with ParserDeclarations;            -- declarations for parser
  23592. with Parser;                        -- contains parse and Apply_Actions
  23593. with Host_Dependencies;
  23594. with Simple_Paginated_Output;
  23595. with TEXT_IO;
  23596. with User_Interface;
  23597.  
  23598. procedure Source_Instrument(
  23599.     Source_File : in String;
  23600.     Listing_File : in String := "";
  23601.     Instrumented_File : in String := "") is
  23602.  
  23603.     package SID renames Source_Instrumenter_Declarations;
  23604.     package SIU renames Source_Instrumenter_Utilities;
  23605.     package PD  renames ParserDeclarations;
  23606.     package HD  renames Host_Dependencies;
  23607.     package PO  renames Simple_Paginated_Output;
  23608.  
  23609.                          -- Objects --
  23610.  
  23611.     Return_Value : PD.ParseStackElement;
  23612.     Input_File   : TEXT_IO.FILE_TYPE;
  23613.  
  23614. begin
  23615.     TEXT_IO.OPEN(FILE => Input_File,
  23616.                  MODE => TEXT_IO.IN_FILE,
  23617.                  NAME => Source_File);
  23618.  
  23619.  
  23620.       PO.Create_Paginated_File(File_Handle => SID.Listing_File,
  23621.                                File_Name => Listing_File,
  23622.                                Header_Size => 6);
  23623.       PO.Set_Header(File_Handle => SID.Listing_File, Header_Line => 1,
  23624.           Header_Text => "Source Instrumenter Output on ~d at " & 
  23625.           "~t                    ~p");
  23626.       PO.Set_Header(File_Handle => SID.Listing_File, Header_Line => 2,
  23627.           Header_Text => "Source File: " & Source_File);
  23628.       PO.Set_Header(File_Handle => SID.Listing_File, Header_Line => 4,
  23629.           Header_Text => "Bkpt");
  23630.       PO.Set_Header(File_Handle => SID.Listing_File, Header_Line => 5,
  23631.           header_Text => "Number  Source Text");
  23632.       PO.Set_Header(File_Handle => SID.Listing_File, Header_Line => 6,
  23633.           Header_Text => "------  -----------");
  23634.       PO.Create_Paginated_File(File_Handle => SID.Instrumented_File,
  23635.                                File_Name => Instrumented_File,
  23636.                                Header_Size => 0,
  23637.                                Page_Size => 0);
  23638.  
  23639.     User_Interface.Get_Instrumenting_instructions(SIU.Current_Trace_Mode,
  23640.           SIU.Do_Type_tracing);
  23641.     SIU.Initialize;
  23642.  
  23643.     TEXT_IO.SET_INPUT(Input_File);
  23644.     Return_Value := Parser.Parse;
  23645.  
  23646.     -- print any comments following the last token in the file.
  23647.     SIU.Print_Comments(SIU.Comment_Buffer);
  23648.     PO.Close_Paginated_File(SID.Listing_File);
  23649.     PO.Close_Paginated_File(SID.Instrumented_File);
  23650.     TEXT_IO.CLOSE(Input_File);
  23651.     TEXT_IO.SET_INPUT(TEXT_IO.STANDARD_INPUT);
  23652.  
  23653. exception
  23654.     when TEXT_IO.NAME_ERROR =>
  23655.         TEXT_IO.PUT_LINE(ITEM => "Error opening file " & Source_File & 
  23656.             " for input.");
  23657.     when PD.Parser_Error =>
  23658.         TEXT_IO.NEW_LINE;
  23659.         TEXT_IO.PUT_LINE(ITEM => "Syntax Error in Source: Line: " &
  23660.             HD.Source_Line'Image(PD.CurToken.lexed_token.srcpos_line) &
  23661.             " Column: " & HD.Source_Column'Image(
  23662.             PD.CurToken.lexed_token.srcpos_column));
  23663.     when PO.File_Error =>
  23664.         TEXT_IO.PUT_LINE(ITEM => "Error opening file " & 
  23665.             " for output.");
  23666.  
  23667.     -- Handle others in driver.
  23668.     when others =>
  23669.         raise;
  23670. end Source_Instrument;
  23671.  
  23672. ---------------------------------------------------------------------
  23673. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23674. --COMPLIST.SPC
  23675. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23676. with TYPE_DEFINITIONS; 
  23677.  
  23678. ------------------------------
  23679. package COMPILATION_UNIT_LISTS is 
  23680. ------------------------------
  23681.  
  23682.   use TYPE_DEFINITIONS; 
  23683.  
  23684.   UNDEFINED_COMPILATION_UNIT : exception; 
  23685.   UNDEFINED_PROGRAM_UNIT     : exception; 
  23686.  
  23687.  
  23688.   ---------------------------------
  23689.   procedure ADD_COMPILATION_UNIT(--| Insert Compilation Unit into the list
  23690.     COMPILATION_UNIT_NAME : in ADA_NAME; 
  23691.     NUMBER_OF_BREAKPOINTS : in BREAKPOINT_NUMBER_RANGE); 
  23692.  
  23693.   -----------------------------
  23694.   procedure ADD_PROGRAM_UNIT(--| Insert Program Unit into the list
  23695.     UNIT_ID           : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  23696.     PROGRAM_UNIT_NAME : in ADA_NAME); 
  23697.  
  23698.   -----------------------------------
  23699.   procedure GET_NUMBER_OF_BREAKPOINTS(--| Get the number of breakpoints
  23700.                                       --| in the compilation unit
  23701.     COMPILATION_UNIT_NAME : in  ADA_NAME; 
  23702.     NUMBER_OF_BREAKPOINTS : out BREAKPOINT_NUMBER_RANGE); 
  23703.  
  23704.   -------------------------------
  23705.   procedure GET_PROGRAM_UNIT_NAME(--| Get the program unit name for the
  23706.                                   --| Specified program unit
  23707.     UNIT_ID           : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  23708.     PROGRAM_UNIT_NAME : out ADA_NAME); 
  23709.  
  23710.   -------------------
  23711.   procedure DUMP_LIST; --| Debug procedure to dump the list
  23712.  
  23713.  
  23714. end COMPILATION_UNIT_LISTS; 
  23715. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23716. --COMPLIST.BDY
  23717. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23718. with TYPE_DEFINITIONS, TEXT_IO, STRING_PKG; 
  23719.  
  23720. -----------------------------------
  23721. package body COMPILATION_UNIT_LISTS is 
  23722. -----------------------------------
  23723.  
  23724.   use TYPE_DEFINITIONS, TEXT_IO, STRING_PKG; 
  23725.  
  23726.   package INT_IO is 
  23727.     new INTEGER_IO(INTEGER); 
  23728.   use INT_IO; 
  23729.  
  23730.  
  23731.   type PROGRAM_UNIT_LIST; 
  23732.  
  23733.   type NEXT_PROGRAM_UNITS is access PROGRAM_UNIT_LIST; 
  23734.  
  23735.   type PROGRAM_UNIT_LIST is 
  23736.     record
  23737.       NAME   : ADA_NAME;                   --| the name of this PU
  23738.       NUMBER : PROGRAM_UNIT_NUMBER_RANGE;  --| assigned by source instrumenter
  23739.       NEXT   : NEXT_PROGRAM_UNITS;         --| pointer to next PU for this CU
  23740.     end record; 
  23741.  
  23742.  
  23743.   type COMPILATION_UNIT_LIST; 
  23744.  
  23745.   type NEXT_COMPILATION_UNITS is access COMPILATION_UNIT_LIST; 
  23746.  
  23747.   type COMPILATION_UNIT_LIST is 
  23748.     record
  23749.       NAME                  : ADA_NAME;               --| the name of this CU
  23750.       NUMBER_OF_BREAKPOINTS : BREAKPOINT_NUMBER_RANGE;--| the no of breakpoints
  23751.       NEXT                  : NEXT_COMPILATION_UNITS; --| pointer to next CU
  23752.       PROGRAM_UNIT_LIST     : NEXT_PROGRAM_UNITS;     --| the PU's for this CU
  23753.     end record; 
  23754.  
  23755.  
  23756.   CURRENT_COMPILATION_UNIT : NEXT_COMPILATION_UNITS := null; 
  23757.   LAST_COMPILATION_UNIT    : NEXT_COMPILATION_UNITS := null; 
  23758.   ROOT                     : NEXT_COMPILATION_UNITS := null; 
  23759.   CURRENT_PROGRAM_UNIT     : NEXT_PROGRAM_UNITS := null; 
  23760.   LAST_PROGRAM_UNIT        : NEXT_PROGRAM_UNITS := null; 
  23761.  
  23762.   DEBUG                    : BOOLEAN := FALSE; 
  23763.                              -- if DEBUG statements are removed, Text_IO
  23764.                              -- is not needed.
  23765.  
  23766.  
  23767.   ------------------------------
  23768.   procedure SET_COMPILATION_UNIT(--| Set list pointer to current Comp Unit
  23769.     COMPILATION_UNIT_NAME : in ADA_NAME
  23770.  
  23771.     ) is 
  23772.  
  23773.   begin
  23774.  
  23775.     CURRENT_COMPILATION_UNIT := ROOT; 
  23776.  
  23777.     if DEBUG then 
  23778.       PUT("In Set_Compilation_Unit "); 
  23779.       PUT("Find "); 
  23780.       PUT_LINE(VALUE(COMPILATION_UNIT_NAME)); 
  23781.     end if; 
  23782.  
  23783.     loop
  23784.       if CURRENT_COMPILATION_UNIT = null then 
  23785.         -- The Compilation Unit is not in the list. Exit with
  23786.         -- Current_Compilation_Unit positioned at the null node
  23787.         -- so it can be allocated, if necessary.
  23788.         if DEBUG then 
  23789.           PUT_LINE("** No Match **"); 
  23790.         end if; 
  23791.         exit; 
  23792.       elsif EQUAL(CURRENT_COMPILATION_UNIT.NAME, COMPILATION_UNIT_NAME) then 
  23793.         -- Found a match.
  23794.         if DEBUG then 
  23795.           PUT_LINE("** CU Matched **"); 
  23796.         end if; 
  23797.         exit; 
  23798.       else 
  23799.         if DEBUG then 
  23800.           PUT("** CU Cell Used by "); 
  23801.           PUT_LINE(VALUE(CURRENT_COMPILATION_UNIT.NAME)); 
  23802.         end if; 
  23803.         LAST_COMPILATION_UNIT := CURRENT_COMPILATION_UNIT; 
  23804.         CURRENT_COMPILATION_UNIT := CURRENT_COMPILATION_UNIT.NEXT; 
  23805.       end if; 
  23806.     end loop; 
  23807.  
  23808.   end SET_COMPILATION_UNIT; 
  23809.  
  23810.  
  23811.   ------------------------------
  23812.   procedure ADD_COMPILATION_UNIT(--| ADD Compilation Unit to the list
  23813.     COMPILATION_UNIT_NAME : in ADA_NAME; 
  23814.     NUMBER_OF_BREAKPOINTS : in BREAKPOINT_NUMBER_RANGE
  23815.  
  23816.     ) is 
  23817.  
  23818.   begin
  23819.  
  23820.     -- Position the list pointer to the node containing the compilation
  23821.     -- unit name specified in Unit_ID. If it is not already in the list,
  23822.     -- leave the list pointer on a null node.
  23823.     SET_COMPILATION_UNIT(COMPILATION_UNIT_NAME); 
  23824.  
  23825.     if CURRENT_COMPILATION_UNIT = null then 
  23826.  
  23827.       --  Add the new compilation unit to the list.
  23828.       if DEBUG then 
  23829.         PUT_LINE("** Add CU **"); 
  23830.       end if; 
  23831.  
  23832.       if ROOT = null then   -- the list is empty
  23833.         ROOT := new COMPILATION_UNIT_LIST; 
  23834.         CURRENT_COMPILATION_UNIT := ROOT; 
  23835.       else 
  23836.         CURRENT_COMPILATION_UNIT   := new COMPILATION_UNIT_LIST; 
  23837.         LAST_COMPILATION_UNIT.NEXT := CURRENT_COMPILATION_UNIT; 
  23838.       end if; 
  23839.  
  23840.       CURRENT_COMPILATION_UNIT.NAME := MAKE_PERSISTENT(COMPILATION_UNIT_NAME); 
  23841.       CURRENT_COMPILATION_UNIT.NEXT := null; 
  23842.       CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST := null; 
  23843.       CURRENT_COMPILATION_UNIT.NUMBER_OF_BREAKPOINTS := NUMBER_OF_BREAKPOINTS; 
  23844.       if DEBUG then 
  23845.         PUT_LINE("** CU Added **"); 
  23846.       end if; 
  23847.  
  23848.     end if; 
  23849.  
  23850.   end ADD_COMPILATION_UNIT; 
  23851.  
  23852.  
  23853.   -----------------------------------
  23854.   procedure GET_NUMBER_OF_BREAKPOINTS(--| Get the number of breakpoints
  23855.                                       --| in the compilation unit
  23856.  
  23857.     COMPILATION_UNIT_NAME : in  ADA_NAME; 
  23858.     NUMBER_OF_BREAKPOINTS : out BREAKPOINT_NUMBER_RANGE
  23859.  
  23860.     ) is 
  23861.  
  23862.   begin
  23863.  
  23864.     --  Position the list pointer to the node containing the compilation
  23865.     --  unit name specified in Unit_ID. If it is not already in the list,
  23866.     --  then raise the exception Undefined_Compilation_Unit.
  23867.  
  23868.     SET_COMPILATION_UNIT(COMPILATION_UNIT_NAME); 
  23869.  
  23870.     if CURRENT_COMPILATION_UNIT = null then 
  23871.  
  23872.       PUT_LINE("Undefined Compilation Unit Error"); 
  23873.       PUT("Unit = "); 
  23874.       PUT(VALUE(COMPILATION_UNIT_NAME)); 
  23875.       NEW_LINE; 
  23876.  
  23877.       raise UNDEFINED_COMPILATION_UNIT; 
  23878.  
  23879.     end if; 
  23880.  
  23881.     NUMBER_OF_BREAKPOINTS := CURRENT_COMPILATION_UNIT.NUMBER_OF_BREAKPOINTS; 
  23882.  
  23883.   end GET_NUMBER_OF_BREAKPOINTS; 
  23884.  
  23885.  
  23886.   --------------------------
  23887.   procedure SET_PROGRAM_UNIT(--| Set list pointer to specified program unit
  23888.     UNIT_ID : in PROGRAM_UNIT_UNIQUE_IDENTIFIER
  23889.  
  23890.     ) is 
  23891.  
  23892.     COMPILATION_UNIT_NAME : ADA_NAME; 
  23893.  
  23894.   begin
  23895.  
  23896.     -- Position the list pointer to the node containing the compilation
  23897.     -- unit name specified in Unit_ID. If it is not already in the list,
  23898.     -- then leave the list pointer on a null node.
  23899.     if DEBUG then 
  23900.       PUT("In Set_Program_Unit "); 
  23901.       PUT("Find "); 
  23902.       PUT(VALUE(UNIT_ID.ENCLOSING_UNIT_IDENTIFIER)); 
  23903.       PUT(' '); 
  23904.       PUT(UNIT_ID.PROGRAM_UNIT_NUMBER); 
  23905.       NEW_LINE; 
  23906.     end if; 
  23907.     COMPILATION_UNIT_NAME := UNIT_ID.ENCLOSING_UNIT_IDENTIFIER; 
  23908.     SET_COMPILATION_UNIT(COMPILATION_UNIT_NAME); 
  23909.  
  23910.     if CURRENT_COMPILATION_UNIT /= null then 
  23911.  
  23912.       CURRENT_PROGRAM_UNIT := CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST; 
  23913.  
  23914.       loop
  23915.  
  23916.         if CURRENT_PROGRAM_UNIT = null then 
  23917.           --  The program unit is not in the list.
  23918.           if DEBUG then 
  23919.             PUT_LINE("** PU Not Matched PU **"); 
  23920.           end if; 
  23921.           exit; 
  23922.  
  23923.         elsif CURRENT_PROGRAM_UNIT.NUMBER = UNIT_ID.PROGRAM_UNIT_NUMBER then 
  23924.           --  Found a match.
  23925.           if DEBUG then 
  23926.             PUT_LINE("** PU Matched **"); 
  23927.           end if; 
  23928.           exit; 
  23929.  
  23930.         else 
  23931.           if DEBUG then 
  23932.             PUT_LINE("** PU Cell Used **"); 
  23933.           end if; 
  23934.           LAST_PROGRAM_UNIT := CURRENT_PROGRAM_UNIT; 
  23935.           CURRENT_PROGRAM_UNIT := CURRENT_PROGRAM_UNIT.NEXT; 
  23936.  
  23937.         end if; 
  23938.  
  23939.       end loop; 
  23940.  
  23941.     end if; 
  23942.  
  23943.   end SET_PROGRAM_UNIT; 
  23944.  
  23945.  
  23946.   --------------------------
  23947.   procedure ADD_PROGRAM_UNIT(--| Add Program Unit to the list
  23948.     UNIT_ID           : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  23949.     PROGRAM_UNIT_NAME : in ADA_NAME
  23950.  
  23951.     ) is 
  23952.  
  23953.     COMPILATION_UNIT_NAME : ADA_NAME; 
  23954.  
  23955.   begin
  23956.  
  23957.     -- Position the list pointer to the node containing the compilation
  23958.     -- unit name and program unit number specified in Unit_ID.
  23959.     SET_PROGRAM_UNIT(UNIT_ID); 
  23960.  
  23961.     if CURRENT_PROGRAM_UNIT = null then 
  23962.       --  The program unit is not in the list. Allocate a new node.
  23963.       if DEBUG then 
  23964.         PUT_LINE("** Allocate PU Node **"); 
  23965.       end if; 
  23966.       CURRENT_PROGRAM_UNIT := new PROGRAM_UNIT_LIST; 
  23967.  
  23968.       if CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST = null then 
  23969.         CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST := CURRENT_PROGRAM_UNIT; 
  23970.         LAST_PROGRAM_UNIT := CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST; 
  23971.       end if; 
  23972.  
  23973.       LAST_PROGRAM_UNIT.NEXT      := CURRENT_PROGRAM_UNIT; 
  23974.       CURRENT_PROGRAM_UNIT.NAME   := MAKE_PERSISTENT(PROGRAM_UNIT_NAME); 
  23975.       CURRENT_PROGRAM_UNIT.NUMBER := UNIT_ID.PROGRAM_UNIT_NUMBER; 
  23976.       CURRENT_PROGRAM_UNIT.NEXT   := null; 
  23977.       if DEBUG then 
  23978.         PUT_LINE("** PU Added **"); 
  23979.       end if; 
  23980.  
  23981.     end if; 
  23982.  
  23983.   end ADD_PROGRAM_UNIT; 
  23984.  
  23985.  
  23986.   -------------------------------
  23987.   procedure GET_PROGRAM_UNIT_NAME(--| Get the program unit name for the
  23988.                                   --| Specified program unit
  23989.     UNIT_ID           : in  PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  23990.     PROGRAM_UNIT_NAME : out ADA_NAME
  23991.  
  23992.     ) is 
  23993.  
  23994.   begin
  23995.  
  23996.     --| Position the list pointer to the node containing the compilation
  23997.     --| unit name and program unit number specified in Unit_ID.
  23998.  
  23999.     SET_PROGRAM_UNIT(UNIT_ID); 
  24000.  
  24001.  
  24002.     --| If the list pointer is null then this program unit is not in
  24003.     --| the list.  That means that this is the main procedure in
  24004.     --| the compilation unit or that the unit is undefined.
  24005.     if CURRENT_PROGRAM_UNIT = null then 
  24006.  
  24007.       if UNIT_ID.PROGRAM_UNIT_NUMBER = 0 then
  24008.  
  24009.         --| If the program unit number is zero then this is the
  24010.         --| main program unit for the compilation unit. It should 
  24011.         --| have the same name as the compilation unit
  24012.         PROGRAM_UNIT_NAME := UNIT_ID.ENCLOSING_UNIT_IDENTIFIER; 
  24013.  
  24014.       else
  24015.  
  24016.         --| The unit is undefined. Nothing else can be done but
  24017.         --| raise an exception. Before raising the exception
  24018.         --| display the compilation unit name and unit number
  24019.         --| of the offender
  24020.         PUT_LINE("Undefined Program Unit Error"); 
  24021.         PUT("Unit = "); 
  24022.         PUT(VALUE(UNIT_ID.ENCLOSING_UNIT_IDENTIFIER)); 
  24023.         PUT("   Program Unit = "); 
  24024.         PUT(UNIT_ID.PROGRAM_UNIT_NUMBER); 
  24025.         NEW_LINE; 
  24026.  
  24027.         raise UNDEFINED_PROGRAM_UNIT; 
  24028.  
  24029.       end if;
  24030.  
  24031.     else
  24032.  
  24033.       --| The program unit has been found
  24034.       PROGRAM_UNIT_NAME := CURRENT_PROGRAM_UNIT.NAME; 
  24035.  
  24036.     end if; 
  24037.  
  24038.   end GET_PROGRAM_UNIT_NAME; 
  24039.  
  24040.   -------------------
  24041.   procedure DUMP_LIST is  --| Debug procedure to dump the list
  24042.  
  24043.     CU_NUMBER : NATURAL := 0; 
  24044.     PU_NUMBER : PROGRAM_UNIT_NUMBER_RANGE; 
  24045.  
  24046.   begin
  24047.  
  24048.     CURRENT_COMPILATION_UNIT := ROOT; 
  24049.  
  24050.     while CURRENT_COMPILATION_UNIT /= null loop
  24051.       CU_NUMBER := CU_NUMBER + 1; 
  24052.       PUT(CU_NUMBER, 0); 
  24053.       PUT(' '); 
  24054.       PUT(VALUE(CURRENT_COMPILATION_UNIT.NAME)); 
  24055.       PUT(' '); 
  24056.       PUT(CURRENT_COMPILATION_UNIT.NUMBER_OF_BREAKPOINTS, 0); 
  24057.       PUT(' '); 
  24058.       if CURRENT_COMPILATION_UNIT.NEXT = null then 
  24059.         PUT("null"); 
  24060.       else 
  24061.         PUT(CU_NUMBER + 1, 0); 
  24062.       end if; 
  24063.       PUT(' '); 
  24064.  
  24065.       if CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST = null then 
  24066.         PUT("null"); 
  24067.       else 
  24068.         PUT(1, 0); 
  24069.       end if; 
  24070.       PUT(' '); 
  24071.       NEW_LINE; 
  24072.  
  24073.       CURRENT_PROGRAM_UNIT := CURRENT_COMPILATION_UNIT.PROGRAM_UNIT_LIST; 
  24074.  
  24075.       while CURRENT_PROGRAM_UNIT /= null loop
  24076.         PU_NUMBER := CURRENT_PROGRAM_UNIT.NUMBER; 
  24077.         PUT(PU_NUMBER, 0); 
  24078.         PUT(' '); 
  24079.         PUT(VALUE(CURRENT_PROGRAM_UNIT.NAME)); 
  24080.         PUT(' '); 
  24081.         if CURRENT_PROGRAM_UNIT.NEXT = null then 
  24082.           PUT("null"); 
  24083.         else 
  24084.           PUT(PU_NUMBER + 1, 0); 
  24085.         end if; 
  24086.         PUT(' '); 
  24087.         NEW_LINE; 
  24088.         CURRENT_PROGRAM_UNIT := CURRENT_PROGRAM_UNIT.NEXT; 
  24089.  
  24090.       end loop; 
  24091.  
  24092.       NEW_LINE; 
  24093.       CURRENT_COMPILATION_UNIT := CURRENT_COMPILATION_UNIT.NEXT; 
  24094.  
  24095.     end loop; 
  24096.  
  24097.   end DUMP_LIST; 
  24098.  
  24099. end COMPILATION_UNIT_LISTS; 
  24100. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24101. --TIMELIB2.SPC
  24102. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24103. with TEXT_IO, CALENDAR, TIME_LIBRARY_1; 
  24104.  
  24105. ----------------------
  24106. package TIME_LIBRARY_2 is 
  24107. ----------------------
  24108.  
  24109. --| Overview
  24110. --| TimeLib contains procedures and functions for getting, putting,
  24111. --| and calculating times, dates, and durations. It augments the
  24112. --| predefined library package Calendar to simplify IO and provide
  24113. --| additional time routines common to all Ada Test and Evaluation
  24114. --| Tool Set (ATETS) tools.
  24115.  
  24116. --| Requires
  24117. --| All procedures and functions that perform IO use use the
  24118. --| predefined library package Text_IO and require that the
  24119. --| specified file be opened by the calling program prior to use.
  24120. --| All times and durations must be of types declared in the
  24121. --| predefined library package Calendar.
  24122.  
  24123. --| Errors
  24124. --| No error messages or exceptions are raised by any of the TimeLib
  24125. --| procedures and functions. However, any Text_IO and Calendar
  24126. --| exceptions that may be raised are allowed to pass, unhandled,
  24127. --| back to the calling program.
  24128.  
  24129. --| N/A:  Raises, Modifies
  24130.  
  24131. --  Version         : 1.0
  24132. --  Author          : Jeff England
  24133. --  Initial Release : 05/21/85
  24134.  
  24135.  
  24136.   type WEEKDAYS is (SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, 
  24137.                     SATURDAY); 
  24138.  
  24139.   ------------------
  24140.   procedure GET_TIME_OF_DAY(--| Get the time of day from the file
  24141.     FYLE    : in TEXT_IO.FILE_TYPE;     --| The input file
  24142.     SECONDS : out CALENDAR.DAY_DURATION --| The time read from fyle
  24143.     ); 
  24144.  
  24145.   --| Effects
  24146.   --| Gets and returns the time of day from the file.
  24147.  
  24148.   --| Requires
  24149.   --| Fyle must have been previously opened by the calling program.
  24150.   --| The time must have been previously put to fyle in the format
  24151.   --| output by Put_Time_of_Day.
  24152.  
  24153.   --| N/A:  Raises, Modifies, Errors
  24154.  
  24155.  
  24156.   ------------------
  24157.   procedure GET_TIME(  --| Get the time from the file
  24158.     FYLE : in TEXT_IO.FILE_TYPE;  --| The input file
  24159.     DATE : out CALENDAR.TIME      --| The time read from fyle
  24160.     ); 
  24161.  
  24162.   --| Effects
  24163.   --| Gets and returns the time from the file.
  24164.  
  24165.   --| Requires
  24166.   --| Fyle must have been previously opened by the calling program.
  24167.   --| The time must have been previously put to fyle in the format
  24168.   --| output by Put_Time.
  24169.  
  24170.   --| N/A:  Raises, Modifies, Errors
  24171.  
  24172.  
  24173.   ----------------
  24174.   function MAXIMUM(--| Return the MAXIMUM of two Day_Durations
  24175.  
  24176.     TIME1, TIME2 : in CALENDAR.DAY_DURATION  --| The two times to be compared
  24177.  
  24178.     ) return CALENDAR.DAY_DURATION; 
  24179.  
  24180.   --| Effects
  24181.   --| Compares Time1 to Time2 and returns the MAXIMUM of the two times.
  24182.  
  24183.   --| N/A:  Raises, Requires, Modifies, Errors
  24184.  
  24185.  
  24186.   ----------------
  24187.   function MINIMUM(--| Return the MINIMUM of two Day_Durations
  24188.  
  24189.     TIME1, TIME2 : in CALENDAR.DAY_DURATION  --| The two times to be compared
  24190.  
  24191.     ) return CALENDAR.DAY_DURATION; 
  24192.  
  24193.   --| Effects
  24194.   --| Compares Time1 to Time2 and returns the MINIMUM of the two times.
  24195.  
  24196.   --| N/A:  Raises, Requires, Modifies, Errors
  24197.  
  24198.  
  24199.   -------------------
  24200.   function WEEKDAY_OF( --| Return the day of week for the specified date
  24201.  
  24202.     DATE : in CALENDAR.TIME  --| The date to be converted
  24203.  
  24204.     ) return WEEKDAYS; 
  24205.  
  24206.   --| Effects
  24207.   --| Returns the day of week (Sunday..Saturday) for the specified date
  24208.  
  24209.   --| N/A:  Raises, Requires, Modifies, Errors
  24210.  
  24211.  
  24212.   -------------------
  24213.   function WEEKDAY_OF( --| Return the day of week for the specified date
  24214.  
  24215.     DATE : in CALENDAR.TIME  --| The date to be converted
  24216.  
  24217.     ) return STRING; 
  24218.  
  24219.   --| Effects
  24220.   --| Returns the day of week (Sunday..Saturday) for the specified date
  24221.  
  24222.   --| N/A:  Raises, Requires, Modifies, Errors
  24223.  
  24224.  
  24225.   -------------------
  24226.   procedure TIMING_IS(--| Sets the timing method for times recorded in
  24227.                       --| the logfile to Raw or Wall_Clock
  24228.  
  24229.     TIME_TYPE : in TIME_LIBRARY_1.TIMING_TYPE
  24230.             --| The timing method used to record timing data
  24231.     ); 
  24232.  
  24233.   --| Effects
  24234.   --| Sets the timing method for GETting times from the logfile to
  24235.   --| correspond to the timing method used for recording times in
  24236.   --| the logfile by the Run Time Monitor (RTM). Timing methods are
  24237.   --| RAW and WALL_CLOCK.
  24238.  
  24239.   --| N/A:  Raises, Requires, Modifies, Errors
  24240.  
  24241.  
  24242.  
  24243. end TIME_LIBRARY_2; 
  24244. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24245. --TIMELIB2.BDY
  24246. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24247. with TEXT_IO, CALENDAR, TIME_LIBRARY_1; 
  24248.  
  24249. ---------------------------
  24250. package body TIME_LIBRARY_2 is 
  24251. ---------------------------
  24252.  
  24253. --| Overview
  24254. --| TimeLib contains procedures and functions for getting, putting,
  24255. --| and calculating times, dates, and durations. It augments the
  24256. --| predefined library package Calendar to simplify IO and provide
  24257. --| additional time routines common to all Ada Test and Evaluation
  24258. --| Tool Set (ATETS) tools.
  24259.  
  24260. --| Requires
  24261. --| All procedures and functions that perform IO use use the
  24262. --| predefined library package Text_IO and require that the
  24263. --| specified file be opened by the calling program prior to use.
  24264. --| All times and durations must be of types declared in the
  24265. --| predefined library package Calendar.
  24266.  
  24267. --| Errors
  24268. --| No error messages or exceptions are raised by any of the TimeLib
  24269. --| procedures and functions. However, any Text_IO and Calendar
  24270. --| exceptions that may be raised are allowed to pass, unhandled,
  24271. --| back to the calling program.
  24272.  
  24273. --| N/A:  Raises, Modifies
  24274.  
  24275. --  Version         : 1.0
  24276. --  Author          : Jeff England
  24277. --  Initial Release : 05/21/85
  24278.  
  24279.   package INT_IO is 
  24280.     new TEXT_IO.INTEGER_IO(INTEGER); 
  24281.  
  24282.   package TIME_IO is 
  24283.     new TEXT_IO.FIXED_IO(CALENDAR.DAY_DURATION); 
  24284.  
  24285.   TIMING_METHOD : TIME_LIBRARY_1.TIMING_TYPE; --| Methods are Raw and Wall_Clock
  24286.  
  24287.  
  24288.   ------------------
  24289.   procedure GET_TIME_OF_DAY(--| Get the time of day from the file
  24290.     FYLE    : in TEXT_IO.FILE_TYPE;      --| The input file
  24291.     SECONDS : out CALENDAR.DAY_DURATION  --| The time read from fyle
  24292.  
  24293.       ) is 
  24294.  
  24295.     --| Effects
  24296.     --| Gets and returns the time of day from the file.
  24297.   
  24298.     --| Requires
  24299.     --| Fyle must have been previously opened by the calling program.
  24300.     --| The time must have been previously put to fyle in the format
  24301.     --| output by Put_Time_of_Day.
  24302.  
  24303.     --| N/A:  Raises, Modifies, Errors
  24304.  
  24305.  
  24306.     use TIME_LIBRARY_1; 
  24307.                       --| For Timing_Type
  24308.     use CALENDAR;     --| For "+" of Times and Day_Durations
  24309.  
  24310.     subtype HOUR_NUMBER is INTEGER range 0 .. 23; 
  24311.     subtype MINUTE_NUMBER is INTEGER range 0 .. 59; 
  24312.  
  24313.     HRS     : HOUR_NUMBER; 
  24314.     MINS    : MINUTE_NUMBER; 
  24315.     SECS    : CALENDAR.DAY_DURATION; 
  24316.  
  24317.     TEMP_CH : CHARACTER;       --  temporary storage for field delimiter
  24318.  
  24319.   begin
  24320.  
  24321.     if TIMING_METHOD = RAW then 
  24322.       TIME_IO.GET(FYLE, SECONDS); 
  24323.     else  -- Timing Method is Wall_Clock
  24324.       INT_IO.GET(FYLE, HRS, 2); 
  24325.       TEXT_IO.GET(FYLE, TEMP_CH); 
  24326.       INT_IO.GET(FYLE, MINS, 2); 
  24327.       TEXT_IO.GET(FYLE, TEMP_CH); 
  24328.       TIME_IO.GET(FYLE, SECS, 5); 
  24329.       SECONDS := SECS + DAY_DURATION(HRS*3600 + MINS*60); 
  24330.     end if; 
  24331.  
  24332.   end GET_TIME_OF_DAY; 
  24333.  
  24334.  
  24335.   ------------------
  24336.   procedure GET_TIME(  --| Get the time from the file
  24337.     FYLE : in TEXT_IO.FILE_TYPE; --| The input file
  24338.     DATE : out CALENDAR.TIME     --| The time read from fyle
  24339.  
  24340.       ) is 
  24341.  
  24342.     --| Effects
  24343.     --| Gets and returns the time from the file.
  24344.  
  24345.     --| Requires
  24346.     --| Fyle must have been previously opened by the calling program.
  24347.     --| The time must have been previously put to fyle in the format
  24348.     --| output by Put_Time.
  24349.  
  24350.     --| N/A:  Raises, Modifies, Errors
  24351.  
  24352.  
  24353.     use TIME_LIBRARY_1;  --| For Timing_Type
  24354.     use CALENDAR;        --| For "+" of Times and Day_Durations
  24355.  
  24356.     YEAR       : CALENDAR.YEAR_NUMBER; --  range 1901 .. 2099
  24357.     MONTH      : CALENDAR.MONTH_NUMBER;--  range    1 ..   12
  24358.     DAY        : CALENDAR.DAY_NUMBER;  --  range    1 ..   31
  24359.     SECONDS    : CALENDAR.DAY_DURATION;
  24360.  
  24361.     TEMP_CH    : CHARACTER;    --  temporary storage for field delimiter
  24362.  
  24363.     SHORT_YEAR : INTEGER range 0 .. 99; -- a 2 digit of the year
  24364.  
  24365.   begin
  24366.  
  24367.     INT_IO.GET(FYLE, MONTH, 2); 
  24368.     TEXT_IO.GET(FYLE, TEMP_CH); 
  24369.     INT_IO.GET(FYLE, DAY, 2); 
  24370.     TEXT_IO.GET(FYLE, TEMP_CH); 
  24371.     INT_IO.GET(FYLE, SHORT_YEAR, 2); 
  24372.     TEXT_IO.GET(FYLE, TEMP_CH); 
  24373.  
  24374.     -- The following assignment will produce an invalid year after 2084
  24375.     -- However, it enables the use of 2 digit year numbers in the log
  24376.     -- file and will still produce a valid date when the date is written
  24377.     -- in one year and read back in another year.
  24378.     if SHORT_YEAR < 85 then 
  24379.       YEAR := SHORT_YEAR + 2000; 
  24380.     else 
  24381.       YEAR := SHORT_YEAR + 1900; 
  24382.     end if; 
  24383.  
  24384.     GET_TIME_OF_DAY(FYLE, SECONDS); 
  24385.  
  24386.     DATE := CALENDAR.TIME_OF(YEAR, MONTH, DAY, 0.0) + SECONDS; 
  24387.  
  24388.   end GET_TIME; 
  24389.  
  24390.  
  24391.   -----------------
  24392.   function MAXIMUM(--| Return the MAXIMUM of two Day_Durations
  24393.  
  24394.     TIME1, TIME2 : in CALENDAR.DAY_DURATION  --| The two times to be compared
  24395.  
  24396.       ) return CALENDAR.DAY_DURATION is 
  24397.  
  24398.     --| Effects
  24399.     --| Compares Time1 to Time2 and returns the MAXIMUM of the two times.
  24400.  
  24401.     --| N/A:  Raises, Requires, Modifies, Errors
  24402.  
  24403.     use CALENDAR; 
  24404.  
  24405.   begin
  24406.     if TIME1 > TIME2 then 
  24407.       return TIME1; 
  24408.     else 
  24409.       return TIME2; 
  24410.     end if; 
  24411.   end MAXIMUM; 
  24412.  
  24413.  
  24414.   -----------------
  24415.   function MINIMUM(--| Return the MINIMUM of two Day_Durations
  24416.  
  24417.     TIME1, TIME2 : in CALENDAR.DAY_DURATION  --| The two times to be compared
  24418.  
  24419.       ) return CALENDAR.DAY_DURATION is 
  24420.  
  24421.     --| Effects
  24422.     --| Compares Time1 to Time2 and returns the MINIMUM of the two times.
  24423.  
  24424.     --| N/A:  Raises, Requires, Modifies, Errors
  24425.  
  24426.     use CALENDAR; 
  24427.  
  24428.   begin
  24429.     if TIME1 > TIME2 then 
  24430.       return TIME2; 
  24431.     else 
  24432.       return TIME1; 
  24433.     end if; 
  24434.   end MINIMUM; 
  24435.  
  24436.  
  24437.   --------------------
  24438.   function WEEKDAY_OF( --| Return the day of week for the specified date
  24439.  
  24440.     DATE : in CALENDAR.TIME  --| The date to be converted
  24441.  
  24442.       ) return WEEKDAYS is 
  24443.  
  24444.     --| Effects
  24445.     --| Returns the day of week (Sunday..Saturday) for the specified date
  24446.  
  24447.     --| N/A:  Raises, Requires, Modifies, Errors
  24448.  
  24449.  
  24450.     use CALENDAR; 
  24451.  
  24452.     Y      : INTEGER; -- A temporary variable for the year. A short name
  24453.                       -- makes the algorithm more readable.
  24454.  
  24455.     OFFSET : constant array(1 .. 12) of INTEGER 
  24456.                         := (1, 4, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5); 
  24457.  
  24458.   begin
  24459.     if MONTH(DATE) = 1 or MONTH(DATE) = 2 then 
  24460.       Y := YEAR(DATE) - 1901; 
  24461.     else 
  24462.       Y := YEAR(DATE) - 1900; 
  24463.     end if; 
  24464.     return WEEKDAYS'VAL((OFFSET(MONTH(DATE)) + Y + Y/4 + DAY(DATE)) mod 7); 
  24465.   end WEEKDAY_OF; 
  24466.  
  24467.  
  24468.   --------------------
  24469.   function WEEKDAY_OF( --| Return the day of week for the specified date
  24470.  
  24471.     DATE : in CALENDAR.TIME  --| The date to be converted
  24472.  
  24473.       ) return STRING is 
  24474.  
  24475.     --| Effects
  24476.     --| Returns the day of week (Sunday..Saturday) for the specified date
  24477.  
  24478.     --| N/A:  Raises, Requires, Modifies, Errors
  24479.  
  24480.  
  24481.   begin
  24482.  
  24483.     return WEEKDAYS'IMAGE(WEEKDAY_OF(DATE)); 
  24484.  
  24485.   end WEEKDAY_OF; 
  24486.  
  24487.   -------------------
  24488.   procedure TIMING_IS(--| Sets the timing method for times recorded in
  24489.                       --| the logfile to Raw or Wall_Clock
  24490.  
  24491.     TIME_TYPE : in TIME_LIBRARY_1.TIMING_TYPE  
  24492.             --| The timing method used to record timing data in the logfile
  24493.  
  24494.       ) is 
  24495.  
  24496.     --| Effects
  24497.     --| Sets the timing method for GETting times from the logfile to
  24498.     --| correspond to the timing method used for recording times in
  24499.     --| the logfile by the Run Time Monitor (RTM). Timing methods are
  24500.     --| RAW and WALL_CLOCK.
  24501.  
  24502.     --| N/A:  Raises, Requires, Modifies, Errors
  24503.  
  24504.  
  24505.   begin
  24506.  
  24507.     TIMING_METHOD := TIME_TYPE; 
  24508.  
  24509.   end TIMING_IS; 
  24510.  
  24511. end TIME_LIBRARY_2; 
  24512. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24513. --CLOCKS.SPC
  24514. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24515. with TYPE_DEFINITIONS, CALENDAR; 
  24516.  
  24517. --------------
  24518. package CLOCKS is 
  24519. --------------
  24520.  
  24521. --| Overview
  24522. --|
  24523. --|     This package contains procedures and functions for managing
  24524. --| program unit startng and ending times. In a non-tasking
  24525. --| program environment it functions merely as a stack. When a
  24526. --| program unit begins execution its starting time is pushed onto
  24527. --| the stack. When the unit ends execution its starting time is
  24528. --| popped from the stack.
  24529. --|
  24530. --|      However, in a tasking environment when a program unit
  24531. --| ends execution its starting time may not necessarily be the top
  24532. --| element on the stack. This is true not only for tasks but also
  24533. --| for other program units called by tasks. Therefore, tasks
  24534. --| must be handled differently than other program units. There must
  24535. --| also be a mechanism for determining whether a program unit
  24536. --| that is ending execution was also the last currently active
  24537. --| program unit to begin execution.
  24538. --|
  24539. --|     To accomplish this, two separate dynamic structures are
  24540. --| maintained. Tasks are managed in a dynamic array. All other
  24541. --| program units are maintained on a stack with a mechanism
  24542. --| for fetching the starting times for units other than the
  24543. --| last active unit started. However, when this happens, a
  24544. --| fault occurs and the calling program is informed via the
  24545. --| boolean flag "Clock_Fault".
  24546.  
  24547. --| Requires:
  24548. --| Prior to use the calling program must create the clock
  24549. --| structures via a call to Create_Clocks.
  24550.  
  24551. --| N/A: Requires, Modifies, Errors
  24552.  
  24553.  
  24554.   use TYPE_DEFINITIONS; 
  24555.  
  24556.   INACTIVE_PROGRAM_UNIT : exception; 
  24557.   NO_MORE_UNITS         : exception; 
  24558.   NO_MORE_TASKS         : exception; 
  24559.   NO_MORE_CLOCK_FAULTS  : exception; 
  24560.  
  24561.   type UNIT_START_TIMES is 
  24562.     record
  24563.       UNIT_NUM   : NATURAL; 
  24564.       START_TIME : CALENDAR.TIME; 
  24565.       STOP_WATCH : CALENDAR.DAY_DURATION; 
  24566.       SONS       : NATURAL; 
  24567.       GRANDSONS  : NATURAL; 
  24568.     end record; 
  24569.  
  24570.  
  24571. ------------------------ Heap Management --------------------------------
  24572.  
  24573.   -----------------------
  24574.   procedure CREATE_CLOCKS; --| Create a dynamic Clock structure
  24575.  
  24576.     --| Effects
  24577.     --| Creates the dynamic program unit clock structures
  24578.  
  24579.     --| N/A: Raises, Modifies, Errors
  24580.  
  24581.   ------------------------
  24582.   procedure DESTROY_CLOCKS; --| Destroy the clock structure
  24583.  
  24584.     --| Effects
  24585.     --| Destroys the dynamic program unit clock structures
  24586.  
  24587.     --| N/A: Raises, Modifies, Errors
  24588.  
  24589.  
  24590. ----------------------- Constructors ------------------------------------
  24591.  
  24592.  
  24593.   --------------------
  24594.   procedure START_UNIT(--| Store a unit starting time in the clock structure
  24595.     UNIT_ID         : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  24596.     UNIT_START_TIME : in UNIT_START_TIMES); 
  24597.  
  24598.     --| Effects
  24599.     --| Saves the starting time of the program unit in a dynamic clock
  24600.     --| structure
  24601.  
  24602.     --| N/A: Raises, Modifies, Errors
  24603.  
  24604.   ----------------------
  24605.   procedure RESTART_UNIT(--| Restore a unit starting time to the clock structure
  24606.  
  24607.     UNIT_START_TIME : in UNIT_START_TIMES); 
  24608.  
  24609.     --| Effects
  24610.     --| Saves the starting time of the program unit in a dynamic clock
  24611.     --| structure
  24612.  
  24613.     --| N/A: Raises, Modifies, Errors
  24614.  
  24615.   -------------------
  24616.   procedure STOP_UNIT(--| Fetch a unit starting time from the clock structure
  24617.     UNIT_NUM        : in NATURAL; 
  24618.     UNIT_ID         : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  24619.     UNIT_START_TIME : out UNIT_START_TIMES; 
  24620.     CLOCK_FAULT     : out BOOLEAN); 
  24621.  
  24622.     --| Raises: Inactive_Program_Unit
  24623.  
  24624.     --| Effects
  24625.     --| Retrieves the starting time of the terminating program unit.
  24626.     --| If the program unit is not a task and and is not the last
  24627.     --| active program unit started the Clock_Fault is returned true.
  24628.     --| Otherwise, Clock_Fault is returned false.
  24629.  
  24630.     --| Modifies
  24631.     --| The Unit_Start_Time for the specified unit is deleted from
  24632.     --| the clock structure.
  24633.  
  24634.     --| N/A: Errors
  24635.  
  24636.   --------------------
  24637.   procedure PAUSE_UNIT(--| Remove a unit starting time from the clock
  24638.     UNIT_START_TIME : out UNIT_START_TIMES); 
  24639.  
  24640.     --| Raises: No_More_Units
  24641.  
  24642.     --| Effects
  24643.     --| Retrieves the starting time of the last currently active
  24644.     --| non-task program unit from the clock structure.
  24645.  
  24646.     --| Modifies
  24647.     --| The Unit_Start_Time for the specified unit is deleted from
  24648.     --| the clock structure.
  24649.  
  24650.     --| N/A: Errors
  24651.  
  24652.   ----------------------
  24653.   function DANGLING_UNIT  --| Fetch the unit starting time for a dangling
  24654.                           --| unit from the clock structure
  24655.  
  24656.     return UNIT_START_TIMES; 
  24657.  
  24658.     --| Raises: No_More_Units
  24659.  
  24660.     --| Effects
  24661.     --| Returns the starting time of a "dangling" unit.
  24662.     --| A dangling unit is a unit that has been left in the clock
  24663.     --| structure after all records have been read from the log file.
  24664.     --| Under normal circumstances this should not occur unless
  24665.     --| the instrumented program that generated the log file terminated
  24666.     --| abnormally.
  24667.  
  24668.     --| Modifies
  24669.     --| The Unit_Start_Time for the specified unit is deleted from
  24670.     --| the clock structure.
  24671.  
  24672.     --| N/A: Requires, Errors
  24673.  
  24674.  
  24675.   ----------------------
  24676.   function DANGLING_TASK  --| Fetch the unit starting time for a dangling
  24677.                           --| task from the clock structure
  24678.  
  24679.     return UNIT_START_TIMES; 
  24680.  
  24681.     --| Raises: No_More_Tasks
  24682.  
  24683.     --| Effects
  24684.     --| Returns the starting time of a "dangling" task.
  24685.     --| A dangling task is a task that has been left in the clock
  24686.     --| structure after all records have been read from the log file.
  24687.     --| Under normal circumstances this should not occur unless
  24688.     --| the task was aborted or the instrumented program that
  24689.     --| generated the log file terminated abnormally.
  24690.  
  24691.     --| Modifies
  24692.     --| The Unit_Start_Time for the specified task is deleted from
  24693.     --| the clock structure.
  24694.  
  24695.     --| N/A: Requires, Errors
  24696.  
  24697.  
  24698.   -------------------------
  24699.   function NEXT_CLOCK_FAULT  --| Clear and return the unit number of the
  24700.                              --| next clock fault
  24701.     return NATURAL; 
  24702.  
  24703.     --| Raises: No_More_Clock_Faults
  24704.  
  24705.     --| Effects
  24706.     --| Clears one clock fault and returns the unit number of a non-task
  24707.     --| program unit that was active when the fault occurred. If no clock
  24708.     --| faults are outstanding then the exception No_More_Clock_Faults
  24709.     --| is raised.
  24710.  
  24711.     --| Requires;
  24712.     --| The calling program must check for outstanding clock faults via
  24713.     --| the function More_Clock_Faults.
  24714.  
  24715.     --| N/A: Modifies, Errors
  24716.  
  24717.  
  24718.  
  24719.   ----------------------- Queries --------------------------------------
  24720.  
  24721.  
  24722.   ----------------------
  24723.   function PREVIOUS_UNIT  --| Return the starting time of the last active
  24724.                           --| non task program unit to begin execution
  24725.     return UNIT_START_TIMES; 
  24726.  
  24727.     --| Raises: No_More_Units
  24728.  
  24729.     --| Effects
  24730.     --| Returns the starting time of the last active non-task
  24731.     --| program unit to begin execution. This function is
  24732.     --| non-destructive, i.e., the starting time of the unit is
  24733.     --| not deleted from the structure.
  24734.  
  24735.     --| N/A: Modifies, Errors
  24736.  
  24737.   -------------------
  24738.   function MORE_UNITS  --| Return true if more non-task program units in clock
  24739.     return BOOLEAN; 
  24740.  
  24741.     --| Effects
  24742.     --| Returns true if one or more non-task program units remain in
  24743.     --| the clock structure.
  24744.  
  24745.     --| N/A: Raises, Modifies, Errors
  24746.  
  24747.   -------------------
  24748.   function MORE_TASKS  --| Return true if more tasks in  clock
  24749.     return BOOLEAN; 
  24750.  
  24751.     --| Effects
  24752.     --| Returns true if one or tasks remain in the clock structure.
  24753.  
  24754.     --| N/A: Raises, Modifies, Errors
  24755.  
  24756.  
  24757.   --------------------------
  24758.   function MORE_CLOCK_FAULTS --| Returns true if clock faults remain uncleared
  24759.     return BOOLEAN; 
  24760.  
  24761.     --| Effects
  24762.     --| Checks to see if any clock faults remain uncleared. Returns true if
  24763.     --| any clock faults remain, otherwise returns false;
  24764.  
  24765.     --| N/A: Raises, Requires, Modifies, Errors
  24766.  
  24767.  
  24768. end CLOCKS; 
  24769. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24770. --CLOCKS.BDY
  24771. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24772. with TYPE_DEFINITIONS, STACK_PKG, DYNARRAY_PKG, CALENDAR; 
  24773.  
  24774. -------------------
  24775. package body CLOCKS is 
  24776. -------------------
  24777.  
  24778. --| Overview
  24779. --|
  24780. --|     This package contains procedures and functions for managing
  24781. --| program unit startng and ending times. In a non-tasking
  24782. --| program environment it functions merely as a stack. When a
  24783. --| program unit begins execution its starting time is pushed onto
  24784. --| the stack. When the unit ends execution its starting time is
  24785. --| popped from the stack.
  24786. --|
  24787. --|      However, in a tasking environment when a program unit
  24788. --| ends execution its starting time may not necessarily be the top
  24789. --| element on the stack. This is true not only for tasks but also
  24790. --| for other program units called by tasks. Therefore, tasks
  24791. --| must be handled differently than other program units. There must
  24792. --| also be a mechanism for determining whether a program unit
  24793. --| that is ending execution was also the last currently active
  24794. --| program unit to begin execution.
  24795. --|
  24796. --|     To accomplish this, two separate dynamic structures are
  24797. --| maintained. Tasks are managed in a dynamic array. All other
  24798. --| program units are maintained on a stack with a mechanism
  24799. --| for fetching the starting times for units other than the
  24800. --| last active unit started. However, when this happens, a
  24801. --| fault occurs and the calling program is informed via the
  24802. --| boolean flag "Clock_Fault".
  24803.  
  24804. --| Requires:
  24805. --| Prior to use the calling program must create the clock
  24806. --| structures via a call to Create_Clocks.
  24807.  
  24808. --| N/A: Requires, Modifies, Errors
  24809.  
  24810.  
  24811.   use TYPE_DEFINITIONS; 
  24812.  
  24813.   package TIME_STACK_PKG is 
  24814.     new STACK_PKG(UNIT_START_TIMES); 
  24815.  
  24816.   use TIME_STACK_PKG; 
  24817.  
  24818.   PRIMARY : TIME_STACK_PKG.STACK; 
  24819.   FAULTS  : TIME_STACK_PKG.STACK; 
  24820.  
  24821.   type TASK_START_TIMES is 
  24822.     record
  24823.       UNIT_NUM                    : NATURAL; 
  24824.       TASK_TYPE_ACTIVATION_NUMBER : TASK_TYPE_ACTIVATION_NUMBER_RANGE; 
  24825.       START_TIME                  : CALENDAR.TIME; 
  24826.       STOP_WATCH                  : CALENDAR.DAY_DURATION; 
  24827.       SONS                        : NATURAL; 
  24828.       GRANDSONS                   : NATURAL; 
  24829.     end record; 
  24830.  
  24831.   package TASK_CLOCKS is 
  24832.     new DYNARRAY_PKG(TASK_START_TIMES); 
  24833.   use TASK_CLOCKS; 
  24834.  
  24835.   TASKS           : TASK_CLOCKS.DARRAY; 
  24836.  
  24837.   UNIT_START_TIME : UNIT_START_TIMES; 
  24838.   TASK_START_TIME : TASK_START_TIMES; 
  24839.  
  24840.  
  24841. ------------------------ Local Procedures ------------------------------
  24842.  
  24843.   ----------------
  24844.   function TASK_OF(--| Fetch the starting time for the specified task
  24845.     UNIT_NUM : in POSITIVE; 
  24846.     UNIT_ID  : in PROGRAM_UNIT_UNIQUE_IDENTIFIER
  24847.  
  24848.       ) return UNIT_START_TIMES
  24849.  
  24850.     is 
  24851.  
  24852.   --| Raises: Inactive_Program_Unit
  24853.  
  24854.   --| Effects
  24855.   --| Searches the task clock array for the Task_Start_Time corresponding
  24856.   --| to the the specified task. If found, the entry is removed from the
  24857.   --| array, converted into Unit_Start_Times form, and returned to
  24858.   --| the calling program. If not found then the exception
  24859.   --| Inactive program unit is raised.
  24860.   
  24861.   --| Modifies
  24862.   --| If found, the Task_Start_Time corresponding to Unit_Num and Unit_ID
  24863.   --| is removed from the dask array.
  24864.  
  24865.   --| N/A: Requires, Errors
  24866.  
  24867.  
  24868.     FOUND : BOOLEAN := FALSE; 
  24869.  
  24870.   begin
  24871.     FOUND := FALSE; 
  24872.     for TASK_NUMBER in 1 .. LENGTH(TASKS) loop
  24873.       TASK_START_TIME := FETCH(TASKS, TASK_NUMBER); 
  24874.       if TASK_START_TIME.UNIT_NUM = UNIT_NUM 
  24875.          and TASK_START_TIME.TASK_TYPE_ACTIVATION_NUMBER 
  24876.            = UNIT_ID.TASK_TYPE_ACTIVATION_NUMBER then 
  24877.         UNIT_START_TIME := (UNIT_NUM, TASK_START_TIME.START_TIME, 
  24878.                             TASK_START_TIME.STOP_WATCH, TASK_START_TIME.SONS,
  24879.                             TASK_START_TIME.GRANDSONS); 
  24880.         FOUND := TRUE; 
  24881.         for NEXT_TASK in TASK_NUMBER + 1 .. LENGTH(TASKS) loop
  24882.           STORE(TASKS, NEXT_TASK - 1, FETCH(TASKS, NEXT_TASK)); 
  24883.         end loop; 
  24884.         REMOVE_HIGH(TASKS); 
  24885.         exit; 
  24886.       end if; 
  24887.     end loop; 
  24888.     if not FOUND then 
  24889.       raise INACTIVE_PROGRAM_UNIT; 
  24890.     else 
  24891.       return UNIT_START_TIME; 
  24892.     end if; 
  24893.   end TASK_OF; 
  24894.  
  24895.  
  24896.   ------------------------ Heap Management ------------------------------
  24897.  
  24898.   -----------------------
  24899.   procedure CREATE_CLOCKS  --| Create a dynamic Clock structure
  24900.  
  24901.     is 
  24902.  
  24903.     --| Effects
  24904.     --| Creates the dynamic program unit clock structures
  24905.  
  24906.     --| N/A: Raises, Modifies, Errors
  24907.  
  24908.   begin
  24909.  
  24910.     --| Create primary stack for non-task program units and another to
  24911.     --| hold units which are active when a clock fault occurs.
  24912.     PRIMARY := TIME_STACK_PKG.CREATE; 
  24913.     FAULTS := TIME_STACK_PKG.CREATE; 
  24914.  
  24915.     --| Create a dynamic array of unit clocks for tasks
  24916.     CREATE(1, 10,       --| Start with elements 1..10
  24917.     100,                --| 100% of adds will be at high end of array
  24918.     50,                 --| Expand the array by 50% each time necessary
  24919.     TASKS);             --| The name of the array is Tasks
  24920.  
  24921.   end CREATE_CLOCKS; 
  24922.  
  24923.   ------------------------
  24924.   procedure DESTROY_CLOCKS  --| Destroy the clock structure
  24925.  
  24926.     is 
  24927.  
  24928.     --| Effects
  24929.     --| Destroys the dynamic program unit clock structures
  24930.  
  24931.     --| N/A: Raises, Modifies, Errors
  24932.  
  24933.   begin
  24934.  
  24935.     TIME_STACK_PKG.DESTROY(PRIMARY); 
  24936.     TIME_STACK_PKG.DESTROY(FAULTS); 
  24937.     TASK_CLOCKS.DESTROY(TASKS); 
  24938.  
  24939.   end DESTROY_CLOCKS; 
  24940.  
  24941.  
  24942.   --------------------- Constructors ------------------------------------
  24943.  
  24944.  
  24945.   --------------------
  24946.   procedure START_UNIT(--| Store a unit starting time in the clock structure
  24947.  
  24948.     UNIT_ID         : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  24949.  
  24950.     UNIT_START_TIME : in UNIT_START_TIMES
  24951.  
  24952.       ) is 
  24953.  
  24954.     --| Effects
  24955.     --| Saves the starting time of the program unit in a dynamic clock
  24956.     --| structure. Any tasks that are currently active are charged
  24957.     --| with a grandson for the purpose accumulating overhead time.
  24958.  
  24959.     --| N/A: Raises, Modifies, Errors
  24960.  
  24961.   begin
  24962.  
  24963.     --| If there are any tasks active then each must be charged with a
  24964.     --| a grandson. This will enable each task's execution time to be later
  24965.     --| adjusted for the overhead imposed by the Run Time Monitor.
  24966.     for TASK_NUMBER in 1 .. LENGTH(TASKS) loop
  24967.       TASK_START_TIME := FETCH(TASKS, TASK_NUMBER); 
  24968.       TASK_START_TIME.GRANDSONS := TASK_START_TIME.GRANDSONS + 1; 
  24969.       STORE(TASKS, TASK_NUMBER, TASK_START_TIME); 
  24970.     end loop; 
  24971.  
  24972.     --| Start the current unit
  24973.     case UNIT_ID.UNIT_TYPE is 
  24974.  
  24975.       when TASK_TYPE => 
  24976.         --| Store tasks in the the task array
  24977.         TASK_START_TIME := (UNIT_START_TIME.UNIT_NUM,
  24978.                             UNIT_ID.TASK_TYPE_ACTIVATION_NUMBER, 
  24979.                             UNIT_START_TIME.START_TIME, 
  24980.                             UNIT_START_TIME.STOP_WATCH, UNIT_START_TIME.SONS,
  24981.                             UNIT_START_TIME.GRANDSONS); 
  24982.         ADD_HIGH(TASKS, TASK_START_TIME); 
  24983.  
  24984.       when others => 
  24985.         --| All non-tasks go on the unit stack
  24986.         PUSH(PRIMARY, UNIT_START_TIME); 
  24987.  
  24988.     end case; 
  24989.  
  24990.   end START_UNIT; 
  24991.  
  24992.   ----------------------
  24993.   procedure RESTART_UNIT(--| Restore a unit starting time to the clock
  24994.  
  24995.     UNIT_START_TIME : in UNIT_START_TIMES
  24996.  
  24997.       ) is 
  24998.  
  24999.     --| Effects
  25000.     --| Saves the starting time of the program unit in a dynamic clock
  25001.     --| structure
  25002.  
  25003.     --| N/A: Raises, Modifies, Errors
  25004.  
  25005.   begin
  25006.  
  25007.     PUSH(PRIMARY, UNIT_START_TIME); 
  25008.  
  25009.   end RESTART_UNIT; 
  25010.  
  25011.   -------------------
  25012.   procedure STOP_UNIT(--| Fetch a unit starting time from the clock structure
  25013.  
  25014.     UNIT_NUM        : in NATURAL; 
  25015.  
  25016.     UNIT_ID         : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25017.  
  25018.     UNIT_START_TIME : out UNIT_START_TIMES; 
  25019.  
  25020.     CLOCK_FAULT     : out BOOLEAN
  25021.  
  25022.       ) is 
  25023.  
  25024.     --| Raises: Inactive_Program_Unit
  25025.  
  25026.     --| Effects
  25027.     --| Retrieves the starting time of the terminating program unit.
  25028.     --| If the program unit is not a task and and is not the last
  25029.     --| active program unit started the Clock_Fault is returned true.
  25030.     --| Otherwise, Clock_Fault is returned false.
  25031.  
  25032.     --| Modifies
  25033.     --| The Unit_Start_Time for the specified unit is deleted from
  25034.     --| the clock structure.
  25035.  
  25036.     --| N/A: Errors
  25037.  
  25038.     NEXT_TIME : UNIT_START_TIMES; 
  25039.  
  25040.     FOUND     : BOOLEAN := FALSE; 
  25041.  
  25042.   begin
  25043.  
  25044.     CLOCK_FAULT := FALSE; 
  25045.  
  25046.     case UNIT_ID.UNIT_TYPE is 
  25047.  
  25048.       when TASK_TYPE => 
  25049.         UNIT_START_TIME := TASK_OF(UNIT_NUM, UNIT_ID); 
  25050.  
  25051.       when others => 
  25052.         while not IS_EMPTY(PRIMARY) loop
  25053.           POP(PRIMARY, NEXT_TIME); 
  25054.           if NEXT_TIME.UNIT_NUM = UNIT_NUM then 
  25055.             FOUND := TRUE; 
  25056.             UNIT_START_TIME := NEXT_TIME; 
  25057.             exit; 
  25058.           else 
  25059.             PUSH(FAULTS, NEXT_TIME); 
  25060.           end if; 
  25061.         end loop; 
  25062.  
  25063.         if not IS_EMPTY(FAULTS) then 
  25064.           CLOCK_FAULT := TRUE; 
  25065.         end if; 
  25066.  
  25067.         if not FOUND then 
  25068.           raise INACTIVE_PROGRAM_UNIT; 
  25069.         end if; 
  25070.  
  25071.     end case; 
  25072.  
  25073.   end STOP_UNIT; 
  25074.  
  25075.   --------------------
  25076.   procedure PAUSE_UNIT(--| Fetch a unit starting time from the clock structure
  25077.  
  25078.     UNIT_START_TIME : out UNIT_START_TIMES
  25079.  
  25080.       ) is 
  25081.  
  25082.     --| Raises: No_More_Units
  25083.  
  25084.     --| Effects
  25085.     --| Retrieves the starting time of the last currently active
  25086.     --| non-task program unit from the clock structure.
  25087.  
  25088.     --| Modifies
  25089.     --| The Unit_Start_Time for the specified unit is deleted from
  25090.     --| the clock structure.
  25091.  
  25092.     --| N/A: Errors
  25093.  
  25094.   begin
  25095.  
  25096.     POP(PRIMARY, UNIT_START_TIME); 
  25097.  
  25098.   end PAUSE_UNIT; 
  25099.  
  25100.   ----------------------
  25101.   function DANGLING_UNIT  --| Fetch the unit starting time for a dangling
  25102.                           --| unit from the clock structure
  25103.     return UNIT_START_TIMES
  25104.  
  25105.       is 
  25106.  
  25107.       --| Raises: No_More_Units
  25108.  
  25109.       --| Effects
  25110.       --| Returns the starting time of a "dangling" unit.
  25111.       --| A dangling unit is a unit that has been left in the clock
  25112.       --| structure after all records have been read from the log file.
  25113.       --| Under normal circumstances this should not occur unless
  25114.       --| the instrumented program that generated the log file terminated
  25115.       --| abnormally.
  25116.  
  25117.       --| Modifies
  25118.       --| The Unit_Start_Time for the specified unit is deleted from
  25119.       --| the clock structure.
  25120.  
  25121.       --| N/A: Requires, Errors
  25122.  
  25123.   begin
  25124.  
  25125.     POP(PRIMARY, UNIT_START_TIME); 
  25126.     return UNIT_START_TIME; 
  25127.  
  25128.   end DANGLING_UNIT; 
  25129.  
  25130.  
  25131.  
  25132.   ----------------------
  25133.   function DANGLING_TASK  --| Fetch the unit starting time for a dangling
  25134.                           --| task from the clock structure
  25135.     return UNIT_START_TIMES
  25136.  
  25137.     is 
  25138.  
  25139.     --| Raises: No_More_Tasks
  25140.  
  25141.     --| Effects
  25142.     --| Returns the starting time of a "dangling" task.
  25143.     --| A dangling task is a task that has been left in the clock
  25144.     --| structure after all records have been read from the log file.
  25145.     --| Under normal circumstances this should not occur unless
  25146.     --| the task was aborted or the instrumented program that
  25147.     --| generated the log file terminated abnormally.
  25148.  
  25149.     --| Modifies
  25150.     --| The Unit_Start_Time for the specified task is deleted from
  25151.     --| the clock structure.
  25152.  
  25153.     --| N/A: Requires, Errors
  25154.  
  25155.   begin
  25156.     TASK_START_TIME := FETCH(TASKS, LENGTH(TASKS)); 
  25157.     UNIT_START_TIME := (TASK_START_TIME.UNIT_NUM, TASK_START_TIME.START_TIME, 
  25158.                         TASK_START_TIME.STOP_WATCH, TASK_START_TIME.SONS, 
  25159.                         TASK_START_TIME.GRANDSONS); 
  25160.     REMOVE_HIGH(TASKS); 
  25161.     return UNIT_START_TIME; 
  25162.   end DANGLING_TASK; 
  25163.  
  25164.  
  25165.   -------------------------
  25166.   function NEXT_CLOCK_FAULT  --| Clear and return the unit number of the
  25167.                              --| next clock fault
  25168.     return NATURAL
  25169.  
  25170.     is 
  25171.  
  25172.     --| Raises: No_More_Clock_Faults
  25173.  
  25174.     --| Effects
  25175.     --| Clears one clock fault and returns the unit number of a non-task
  25176.     --| program unit that was active when the fault occurred. If no clock
  25177.     --| faults are outstanding then the exception No_More_Clock_Faults
  25178.     --| is raised.
  25179.  
  25180.     --| Requires;
  25181.     --| The calling program must check for outstanding clock faults via
  25182.     --| the function More_Clock_Faults.
  25183.  
  25184.     --| N/A: Modifies, Errors
  25185.  
  25186.   begin
  25187.     if not IS_EMPTY(FAULTS) then 
  25188.       POP(FAULTS, UNIT_START_TIME); 
  25189.       PUSH(PRIMARY, UNIT_START_TIME); 
  25190.       return UNIT_START_TIME.UNIT_NUM; 
  25191.     else 
  25192.       raise NO_MORE_CLOCK_FAULTS; 
  25193.     end if; 
  25194.   end NEXT_CLOCK_FAULT; 
  25195.  
  25196.  
  25197. ------------------------- Queries --------------------------------------
  25198.  
  25199.   ----------------------
  25200.   function PREVIOUS_UNIT  --| Return the starting time of the last active
  25201.                           --| non-task program unit to begin execution
  25202.     return UNIT_START_TIMES
  25203.  
  25204.     is 
  25205.  
  25206.     --| Raises: No_More_Units
  25207.  
  25208.     --| Effects
  25209.     --| Returns the starting time of the last active non-task
  25210.     --| program unit to begin execution. This function is
  25211.     --| non-destructive, i.e., the starting time of the unit is
  25212.     --| not deleted from the structure.
  25213.  
  25214.     --| N/A: Modifies, Errors
  25215.  
  25216.   begin
  25217.     return TOP(PRIMARY); 
  25218.   end PREVIOUS_UNIT; 
  25219.  
  25220.   -------------------
  25221.   function MORE_UNITS  --| Return true if more non-task program units in clock
  25222.     return BOOLEAN
  25223.  
  25224.     is 
  25225.  
  25226.     --| Effects
  25227.     --| Returns true if one or more non-task program units remain in
  25228.     --| the clock structure.
  25229.   
  25230.     --| N/A: Raises, Modifies, Errors
  25231.  
  25232.   begin
  25233.     return not IS_EMPTY(PRIMARY); 
  25234.   end MORE_UNITS; 
  25235.  
  25236.   -------------------
  25237.   function MORE_TASKS  --| Return true if more tasks in  clock
  25238.     return BOOLEAN
  25239.  
  25240.     is 
  25241.  
  25242.     --| Effects
  25243.     --| Returns true if one or tasks remain in the clock structure.
  25244.  
  25245.     --| N/A: Raises, Modifies, Errors
  25246.  
  25247.   begin
  25248.     return LENGTH(TASKS) > 0; 
  25249.   end MORE_TASKS; 
  25250.  
  25251.  
  25252.  
  25253.   --------------------------
  25254.   function MORE_CLOCK_FAULTS  --| Returns true if clock faults remain uncleared
  25255.     return BOOLEAN
  25256.  
  25257.     is 
  25258.  
  25259.     --| Effects
  25260.     --| Checks to see if any clock faults remain uncleared. Returns true if
  25261.     --| any clock faults remain, otherwise returns false;
  25262.  
  25263.     --| N/A: Raises, Requires, Modifies, Errors
  25264.  
  25265.   begin
  25266.     return not IS_EMPTY(FAULTS); 
  25267.   end MORE_CLOCK_FAULTS; 
  25268.  
  25269. end CLOCKS; 
  25270. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25271. --READLOG.SPC
  25272. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25273. with TYPE_DEFINITIONS, IMPLEMENTATION_DEPENDENCIES, CALENDAR; 
  25274. ----------------
  25275. package READ_LOG is 
  25276. ----------------
  25277.  
  25278. --| Overview
  25279. --| Read_Log is an input package used by the report generators for
  25280. --| the Ada Testing and Evaluation Tools. It performs all input from the
  25281. --| Execution Log File (ELF) that is used to dynamically record
  25282. --| information about programs written in the Ada language. The
  25283. --| ELF is used for output by the Run Time Monitor (RTM) to record
  25284. --| runtime information about the execution of the Ada program being
  25285. --| tested. It is used as input by various report generators which
  25286. --| summarize the information and present it in a meaningful format.
  25287. --| All output to the ELF by the Run Time Monitor is performed by the
  25288. --| package Write_Log.
  25289.  
  25290. --| N/A: Errors, Raises, Modifies, Requires
  25291.  
  25292. --  Version         : 3.1
  25293. --  Author          : Jeff England
  25294. --  Initial Release : 02/27/85
  25295. --  Last Modified   : 05/14/85
  25296.  
  25297.   use TYPE_DEFINITIONS,          --| Global type declarations common to
  25298.                                  --| all of the Ada Testing and Analysis
  25299.                                  --| Tools
  25300.  
  25301.   IMPLEMENTATION_DEPENDENCIES,   --| Ada compiler dependencies
  25302.  
  25303.   CALENDAR;    --| Logfile_Input uses the standard Ada package Calendar
  25304.                --| to provide the standard interface to the system clock.
  25305.  
  25306.  
  25307.   LOGFILE_ACCESS_ERROR   : exception; --| Attempt to access unopened logfile
  25308.   LOGFILE_SEQUENCE_ERROR : exception; --| Attempt to access in wrong order
  25309.   INVALID_LOGFILE_FORMAT : exception; --| Invalid or no configuration data
  25310.   END_OF_LOGFILE         : exception; --| Unchecked end of file reached
  25311.   UNDEFINED_UNIT         : exception; --| No unit name defined for unit id
  25312.  
  25313.  
  25314.   ------------------
  25315.   procedure OPEN_LOG( --| Opens the ELF for input by the report generators.
  25316.  
  25317.     LOGFILE_NAME : in FILENAME;  --| The name of the log file to be created
  25318.  
  25319.     PROGRAM_NAME : out ADA_NAME; --| The name of the main program unit
  25320.  
  25321.     TEST_IDENT   : out TEST_IDENTIFIER; --| A unique ID assigned by the tester
  25322.  
  25323.     TEST_DATE    : out TIME      --| The date and time of the test
  25324.  
  25325.       ); 
  25326.  
  25327.     --| Raises: Invalid_Log_File_Format, Logfile_Access_Error
  25328.  
  25329.     --| Effects
  25330.     --| This procedure opens the ELF for input by the report generators.
  25331.     --| If the file is successfully opened, it returns test configuration
  25332.     --| data recorded in the ELF by the RTM during execution of the Ada
  25333.     --| program under test. If the file is already open then the exception
  25334.     --| Logfile_Access_Error is raised. If the file is not successfully
  25335.     --| opened due to an IO error, then the standard Text_IO exceptions are
  25336.     --| allowed to pass unhandled back to the calling program. If the ELF is
  25337.     --| is determined to contain invalid or missing configuration data,
  25338.     --| then the exception Invalid_Log_File_Format is raised.
  25339.  
  25340.     --| Requires
  25341.     --| The ELF must contain test configuration data in the format
  25342.     --| created by the RTM via a call to the procedure Create_Log.
  25343.  
  25344.     --| N/A:  Modifies, Errors
  25345.  
  25346.  
  25347.   ----------------------
  25348.   procedure GET_NEXT_KEY(--| Gets the next log file key from the ELF
  25349.  
  25350.     KEY : in out LOGFILE_KEYS  --| Defines the type of data that is
  25351.                                --| contained in the current ELF record
  25352.       ); 
  25353.  
  25354.     --| Effects
  25355.     --| This procedure reads the next log file key (Key) from the ELF and
  25356.     --| returns it to the calling program.
  25357.  
  25358.     --| Requires
  25359.     --| The ELF must have been previously opened for input by the
  25360.     --| calling program via a call to the procedure Open_Log.
  25361.  
  25362.     --| N/A:  Raises, Modifies, Errors
  25363.  
  25364.  
  25365.   ------------------------------
  25366.   procedure FLUSH_LOGFILE_RECORD(--| Flush the current Logfile record
  25367.  
  25368.     KEY : in LOGFILE_KEYS  --| The current logfile key
  25369.  
  25370.       ); 
  25371.  
  25372.     --| Effects
  25373.     --| If Key is equal to the current log file key then the remainder of the
  25374.     --| current logfile record is flushed and the logfile is positioned at
  25375.     --| the beginning of the next logfile record.
  25376.  
  25377.     --| Requires
  25378.     --| The ELF must have been previously opened for input by the
  25379.     --| calling program via a call to the procedure Open_Log.
  25380.     --| The Logfile key for the current record must have already been
  25381.     --| read. The Key passed by the calling program must match the
  25382.     --| key for the current logfile record.
  25383.  
  25384.     --| N/A:  Raises, Modifies, Errors
  25385.  
  25386.  
  25387.   -----------------------
  25388.   procedure GET_UNIT_ID(--| Gets unit ID for current unit from the ELF
  25389.  
  25390.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER
  25391.     --| A unique ID assigned by the Source Instrumenter
  25392.  
  25393.       ); 
  25394.  
  25395.     --| Effects
  25396.     --| Gets and returns the program unit id (Unit_Identifier) from the ELF
  25397.  
  25398.     --| Requires
  25399.     --| The log file must have been previously opened by the calling
  25400.     --| program via a call to Open_Log.
  25401.     --| The current log file key (i.e., the previously read key)
  25402.     --| must be in UNIT_START..UNIT_STOP.
  25403.  
  25404.     --| N/A:  Raises, Modifies, Errors
  25405.  
  25406.  
  25407.   -----------------------
  25408.   procedure GET_UNIT_TIME(--| Gets the unit ID and start/stop time from ELF
  25409.  
  25410.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25411.     --| A unique ID assigned by the Source Instrumenter
  25412.  
  25413.     LOGGED_TIME     : out CALENDAR.DAY_DURATION
  25414.     --| The time that the unit was entered or exited
  25415.  
  25416.       ); 
  25417.  
  25418.     --| Effects
  25419.     --| Gets and returns the program unit id (Unit_Identifier) and logged
  25420.     --| time (Log_Time)  from the ELF.
  25421.  
  25422.     --| Requires
  25423.     --| The log file must have been previously opened by the calling
  25424.     --| program via a call to Open_Log.
  25425.     --| The current log file key (i.e., the previously read key)
  25426.     --| must be in UNIT_START..UNIT_STOP.
  25427.  
  25428.     --| N/A:  Raises, Modifies, Errors
  25429.  
  25430.   ------------------------
  25431.   procedure GET_BREAKPOINT( --| Gets current breakpoint from the ELF
  25432.  
  25433.     UNIT_IDENTIFIER    : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25434.     --| A unique ID assigned by the Source Instrumenter
  25435.  
  25436.     CURRENT_BREAKPOINT : out BREAKPOINT_NUMBER_RANGE
  25437.     --| The breakpoint number assigned by the Source Instrumenter
  25438.  
  25439.       ); 
  25440.  
  25441.     --| Effects
  25442.     --| Gets the program unit, and current breakpoint number from the
  25443.     --| Execution Log File.
  25444.  
  25445.     --| Requires
  25446.     --| The log file must have been previously opened by the calling
  25447.     --| program via a call to Open_Log.
  25448.     --| The current log file key (i.e., the previously read key)
  25449.     --| must be in BEGIN_IF..OTHER_BREAKPOINT.
  25450.  
  25451.     --| N/A:  Raises, Modifies, Errors
  25452.  
  25453.  
  25454.   -------------------
  25455.   function CALL_PARAMETERS  --| Gets AutoPath procedure call parameter list
  25456.  
  25457.   return USER_INPUT_STRING; --| The user specified input parameter list
  25458.  
  25459.     --| Raises:  Logfile_Access_Error, Logfile_Sequence_Error,
  25460.     --|          End_of_Log_File
  25461.  
  25462.     --| Effects
  25463.     --| Gets the AutoPath procedure call parameter list from the logfile
  25464.     --| for a single execution of the target Ada program.
  25465.     --| If the logfile is not open then the exception Logfile_Access_Error
  25466.     --| is raised.
  25467.     --| If an End of File (EOF) in the ELF is encountered, the exception
  25468.     --| End_of_Log_File is raised.
  25469.     --| If the current logfile key is not AUTOPATH_CALL
  25470.     --| then the exception Logfile_Sequence_Error is raised.
  25471.  
  25472.     --| Requires
  25473.     --| The log file must have been previously opened by the calling
  25474.     --| program via a call to Open_Log.
  25475.     --| The current log file key (i.e., the previously read key)
  25476.     --| must be AUTOPATH_CALL.
  25477.  
  25478.     --| N/A:  Modifies, Errors
  25479.  
  25480.  
  25481.   -------------------
  25482.   procedure GET_VALUE(--| Gets value of INTEGER variable from ELF
  25483.  
  25484.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25485.     --| A unique ID assigned by the Source Instrumenter
  25486.  
  25487.     VARIABLE_NAME   : out ADA_NAME; --| The unqualified variable name
  25488.  
  25489.     VALUE           : out INTEGER   --| The current value of variable
  25490.  
  25491.       ); 
  25492.  
  25493.     --| Effects
  25494.     --| Gets integer values from the execution log file.
  25495.  
  25496.     --| Requires
  25497.     --| The log file must have been previously opened by the calling
  25498.     --| program via a call to Open_Log.
  25499.     --| The current log file key (i.e., the previously read key)
  25500.     --| must be INTEGER_VARIABLE.
  25501.  
  25502.     --| N/A:  Raises, Modifies, Errors
  25503.  
  25504.  
  25505.   -------------------
  25506.   procedure GET_VALUE(--| Gets value of LONG_INTEGER variable from ELF
  25507.  
  25508.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25509.     --| A unique ID assigned by the Source Instrumenter
  25510.  
  25511.     VARIABLE_NAME   : out ADA_NAME;     --| The unqualified variable name
  25512.  
  25513.     VALUE           : out LONG_INTEGER  --| The current value of variable
  25514.  
  25515.       ); 
  25516.  
  25517.     --| Effects
  25518.     --| Gets long_integer values from the execution log file.
  25519.  
  25520.     --| Requires
  25521.     --| The log file must have been previously opened by the calling
  25522.     --| program via a call to Open_Log.
  25523.     --| The current log file key (i.e., the previously read key)
  25524.     --| must be LONG_INTEGER_VARIABLE.
  25525.  
  25526.     --| N/A:  Raises, Modifies, Errors
  25527.  
  25528.  
  25529.   -------------------
  25530.   procedure GET_VALUE(--| Gets value of FLOAT variable from ELF
  25531.  
  25532.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25533.     --| A unique ID assigned by the Source Instrumenter
  25534.  
  25535.     VARIABLE_NAME   : out ADA_NAME;  --| The unqualified variable name
  25536.  
  25537.     VALUE           : out FLOAT      --| The current value of variable
  25538.  
  25539.       ); 
  25540.  
  25541.     --| Effects
  25542.     --| Gets floating point values from the execution log file.
  25543.   
  25544.     --| Requires
  25545.     --| The log file must have been previously opened by the calling
  25546.     --| program via a call to Open_Log.
  25547.     --| The current log file key (i.e., the previously read key)
  25548.     --| must be FLOAT_VARIABLE.
  25549.  
  25550.     --| N/A:  Raises, Modifies, Errors
  25551.  
  25552.  
  25553.   -------------------
  25554.   procedure GET_VALUE(--| Gets value of LONG_FLOAT variable from ELF
  25555.  
  25556.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25557.     --| A unique ID assigned by the Source Instrumenter
  25558.  
  25559.     VARIABLE_NAME   : out ADA_NAME;   --| The unqualified variable name
  25560.     VALUE           : out LONG_FLOAT  --| The current value of variable
  25561.  
  25562.       ); 
  25563.  
  25564.     --| Effects
  25565.     --| Gets long_float values from the execution log file.
  25566.  
  25567.     --| Requires
  25568.     --| The log file must have been previously opened by the calling
  25569.     --| program via a call to Open_Log.
  25570.     --| The current log file key (i.e., the previously read key)
  25571.     --| must be LONG_FLOAT_VARIABLE.
  25572.  
  25573.     --| N/A:  Raises, Modifies, Errors
  25574.  
  25575.  
  25576.   -------------------
  25577.   procedure GET_VALUE(--| Gets value of STRING variable from ELF
  25578.  
  25579.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25580.     --| A unique ID assigned by the Source Instrumenter
  25581.  
  25582.     VARIABLE_NAME   : out ADA_NAME;        --| The unqualified variable name
  25583.  
  25584.     STRING_VALUE    : out STRING_VARIABLES --| The current value of variable
  25585.  
  25586.       ); 
  25587.  
  25588.     --| Effects
  25589.     --| Gets string values from the execution log file.
  25590.     --| This procedure used to get the value of
  25591.     --|        strings
  25592.     --|        characters
  25593.     --|        enumerated data types (including booleans)
  25594.  
  25595.     --| Requires
  25596.     --| The current log file key (i.e., the previously read key)
  25597.     --| must be STRING_VARIABLE.
  25598.  
  25599.     --| N/A:  Raises, Modifies, Errors
  25600.  
  25601.  
  25602.   -------------------
  25603.   function END_OF_LOG  --| Checks for End Of file in the ELF
  25604.     return BOOLEAN;    --| True if EOF is reached else false
  25605.  
  25606.     --| Raises:  Logfile_Access_Error
  25607.  
  25608.     --| Effects
  25609.     --| This function checks for End Of File in the ELF and returns true
  25610.     --| if an EOF has been reached.
  25611.     --| If the logfile is not open then the exception Logfile_Access_Error
  25612.     --| is raised.
  25613.     --| Text_IO exceptions that may be raised are allowed to pass, unhandled,
  25614.     --| back to the calling program.
  25615.  
  25616.     --| Requires
  25617.     --| The log file must have been previously opened by the calling
  25618.     --| program via a call to Open_Log.
  25619.  
  25620.     --| N/A:  Modifies, Errors
  25621.  
  25622.  
  25623.   ------------------------
  25624.   procedure FIND_UNIT_NAME( --| Finds the name of a program unit
  25625.  
  25626.     UNIT_IDENTIFIER : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  25627.     --| A unique ID assigned by the Source Instrumenter
  25628.  
  25629.     UNIT_NAME       : out ADA_NAME  --| The name of program unit
  25630.  
  25631.       ); 
  25632.  
  25633.     --| Raises: Undefined_Program_Unit
  25634.  
  25635.     --| Effects
  25636.     --| Finds the program unit unit name (Unit_Name) corresponding to the
  25637.     --| program unit ID. If no UNIT_DEF record has been previously
  25638.     --| encountered in the ELF to associate a program unit name with
  25639.     --| the specified unit ID then the Undefined_Program_Unit exception
  25640.     --| is raised.
  25641.  
  25642.     --| Requires
  25643.     --| A program unit name (Unit_Name) must have been previously recorded
  25644.     --| in the ELF and assosiated with the specified unit id (Unit_Identifier)
  25645.     --| by the program that originally generated the log file via a call
  25646.     --| to the procedure Define_Comp_Unit.
  25647.  
  25648.     --| N/A:  Modifies, Errors
  25649.  
  25650.  
  25651.   ------------------------------
  25652.   function NUMBER_OF_BREAKPOINTS(--| Finds the number of breakpoints
  25653.                                  --| in a compilation unit
  25654.  
  25655.     COMPILATION_UNIT_NAME : in ADA_NAME --| The name of the compilation unit
  25656.  
  25657.       ) return BREAKPOINT_NUMBER_RANGE; 
  25658.  
  25659.     --| Raises: Undefined_Program_Unit
  25660.  
  25661.     --| Effects
  25662.     --| Gets and returns the total number of breakpoints in the
  25663.     --| specified compilation unit. If the compilation unit has
  25664.     --| not been previously defined in the logfile then the
  25665.     --| exception Undefined_Program_Unit is raised.
  25666.  
  25667.     --| Requires
  25668.     --| The compilation unit name must have been previously
  25669.     --| returned to the calling program in a Unit ID by the
  25670.     --| the procedure Get_Unit_ID.
  25671.  
  25672.     --| N/A:  Modifies, Errors
  25673.  
  25674.  
  25675.   --------------------
  25676.   function TIMING_DATA --| Returns true if the logfile contains timing data
  25677.  
  25678.     return BOOLEAN; 
  25679.  
  25680.     --| Raises: Logfile_Access_Error
  25681.  
  25682.     --| Effects
  25683.     --| Returns true if the logfile contains timing data. Otherwise
  25684.     --| returns false. This function provides a mechanism for the
  25685.     --| calling program to determine whether or not timing data
  25686.     --| has been recorded in the logfile prior to calling other
  25687.     --| Read_Log procedures that read times from the logfile.
  25688.     --| If the logfile is not open then the exception
  25689.     --| Logfile_Access_Error is raised.
  25690.  
  25691.     --| Requires
  25692.     --| The target Ada program must have been executed with
  25693.     --| Tool_Name = Profile_Tool in order for timing data to have
  25694.     --| been recorded in the log file and the current log file
  25695.     --| key must be Timing_Overhead. The log file must have been
  25696.     --| previously opened by the calling program via a call to Open_Log.
  25697.  
  25698.     --| N/A:  Modifies, Errors
  25699.  
  25700.  
  25701.   -----------------------------
  25702.   function ACCUMULATED_OVERHEAD --| Returns the Accumulated timing overhead
  25703.                                 --| calculated during test program execution
  25704.  
  25705.     return CALENDAR.DAY_DURATION; 
  25706.  
  25707.     --| Raises: Logfile_Access_Error
  25708.  
  25709.     --| Effects
  25710.     --| Gets and returns the total accumulated timing overhead
  25711.     --| calculated during execution of the target Ada program.
  25712.     --| If the logfile is not open or the current logfile key is
  25713.     --| not then the exception Logfile_Access_Error is raised.
  25714.  
  25715.     --| Requires
  25716.     --| The target Ada program must have been executed with
  25717.     --| Tool_Name = Profile_Tool in order for timing data to have
  25718.     --| been recorded in the log file and the current log file
  25719.     --| key must be Timing_Overhead.
  25720.  
  25721.     --| N/A:  Modifies, Errors
  25722.  
  25723.  
  25724.   -------------------
  25725.   procedure CLOSE_LOG; --| Closes the execution log file
  25726.  
  25727.     --| Raises:  Logfile_Access_Error
  25728.  
  25729.     --| Effects
  25730.     --| Closes the execution log file.
  25731.     --| If the logfile is not open then the exception Logfile_Access_Error
  25732.     --| is raised.
  25733.  
  25734.     --| Requires
  25735.     --| The log file must have been previously opened by the calling
  25736.     --| program via a call to Open_Log.
  25737.  
  25738.     --| N/A:  Modifies, Errors
  25739.  
  25740. end READ_LOG; 
  25741. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25742. --READLOG.BDY
  25743. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25744. with TYPE_DEFINITIONS, COMPILATION_UNIT_LISTS, CALENDAR, TEXT_IO, 
  25745.      TIME_LIBRARY_1, TIME_LIBRARY_2, STRING_PKG, IMPLEMENTATION_DEPENDENCIES; 
  25746. ---------------------
  25747. package body READ_LOG is 
  25748. ---------------------
  25749.  
  25750. --| Overview
  25751. --| Read_Log is an input package used by the report generators for
  25752. --| the Ada Testing and Evaluation Tools. It performs all input from the
  25753. --| Execution Log File (ELF) that is used to dynamically record
  25754. --| information about programs written in the Ada language. The
  25755. --| ELF is used for output by the Run Time Monitor (RTM) to record
  25756. --| runtime information about the execution of the Ada program being
  25757. --| tested. It is used as input by various report generators which
  25758. --| summarize the information and present it in a meaningful format.
  25759. --| All output to the ELF by the Run Time Monitor is performed by the
  25760. --| package Write_Log.
  25761.  
  25762. --| N/A: Errors, Raises, Modifies, Requires
  25763.  
  25764. --  Version         : 3.1
  25765. --  Author          : Jeff England
  25766. --  Initial Release : 02/27/85
  25767. --  Last Modified   : 05/14/85
  25768.  
  25769.   use TYPE_DEFINITIONS,        --| Global type declarations common to all
  25770.                                --| of the Ada Testing and Analysis Tools.
  25771.  
  25772.   IMPLEMENTATION_DEPENDENCIES, --| Ada compiler dependencies
  25773.  
  25774.   TEXT_IO;                     --| The logfile is in text format
  25775.  
  25776.   package INT_IO              is new INTEGER_IO(INTEGER); 
  25777.   package NEW_LONG_INTEGER_IO is new INTEGER_IO(LONG_INTEGER); 
  25778.   package NEW_FLOAT_IO        is new FLOAT_IO(FLOAT); 
  25779.   package NEW_LONG_FLOAT_IO   is new FLOAT_IO(LONG_FLOAT); 
  25780.  
  25781.   use INT_IO; 
  25782.  
  25783.   type LOGFILE_STATES    is (OPENED,  CLOSED); 
  25784.   type LOGFILE_POSITIONS is (LOG_KEY, LOG_DATA); 
  25785.  
  25786.   LOGFILE         : TEXT_IO.FILE_TYPE;
  25787.  
  25788.   TOOL_NAME       : TOOL_NAMES;       --| Name of the tool
  25789.   TIMING          : BOOLEAN := FALSE; --| Timing option is used by Profile
  25790.   LOGFILE_IS_OPEN : BOOLEAN := FALSE; --| Goes true when logfile is opened
  25791.  
  25792.   TIMING_METHOD   : TIME_LIBRARY_1.TIMING_TYPE; --| method of recording times
  25793.   CURRENT_KEY     : LOGFILE_KEYS := PROGRAM;    --| The current logfile key
  25794.  
  25795.   NUMBER_OF_COMPILATION_UNITS : NATURAL := 0; 
  25796.  
  25797.   NEXT_LOGFILE_ITEM : LOGFILE_POSITIONS := LOG_KEY; 
  25798.   MAX_LINE_LENGTH   : constant INTEGER  := 255; --| Max length of logfile entry
  25799.   TEMP_STRING       : STRING(1 .. MAX_LINE_LENGTH); 
  25800.  
  25801.   ----------------------------
  25802.   procedure DUMP_LOGFILE_STATE is 
  25803.  
  25804.   begin
  25805.  
  25806.     PUT("Key      = "); 
  25807.     PUT(LOGFILE_KEYS'POS(CURRENT_KEY)); 
  25808.     NEW_LINE; 
  25809.     PUT("Position = "); 
  25810.     PUT(LOGFILE_POSITIONS'POS(NEXT_LOGFILE_ITEM)); 
  25811.     NEW_LINE; 
  25812.  
  25813.   end DUMP_LOGFILE_STATE; 
  25814.  
  25815.  
  25816.   ------------------------
  25817.   procedure VERIFY_LOGFILE(--| Verify the current state of the logfile
  25818.     DESIRED_STATE    : in LOGFILE_STATES; 
  25819.     DESIRED_POSITION : in LOGFILE_POSITIONS := NEXT_LOGFILE_ITEM; 
  25820.     FIRST_KEY        : in LOGFILE_KEYS := LOGFILE_KEYS'FIRST; 
  25821.     LAST_KEY         : in LOGFILE_KEYS := LOGFILE_KEYS'LAST
  25822.  
  25823.       ) is 
  25824.  
  25825.     --| Raises: Logfile_Access_Error, Logfile_Sequence_Error, End_of_Logfile
  25826.  
  25827.     --| Effects
  25828.     --| This is an internal procedure that checks the current status of the
  25829.     --| logfile for the following error conditions:
  25830.     --|
  25831.     --| Logfile State:    If the desired state is open and the logfile is
  25832.     --|                   closed then the exception Logfile_Access_Error
  25833.     --|                   is raised.
  25834.     --|
  25835.     --| Logfile Position: If the desired position does not match the current
  25836.     --|                   position then the exception Logfile_Sequence_Error
  25837.     --|                   is raised.
  25838.     --|
  25839.     --| Logfile Key:      If the current logfile key is not in the desired
  25840.     --|                   range then the exception Logfile_Sequence_Error
  25841.     --|                   is raised.
  25842.     --|
  25843.     --| End_of_File:      If the logfile is open and is currently positioned
  25844.     --|                   at the end of file then the exception
  25845.     --|                   End_of_Logfile is raised.
  25846.    
  25847.  
  25848.     --| N/A: Requires, Modifies, Errors
  25849.  
  25850.   begin
  25851.  
  25852.     --| Check Logfile state
  25853.     if DESIRED_STATE = OPENED and not LOGFILE_IS_OPEN then 
  25854.       PUT_LINE("Logfile Access Error: Logfile not open"); 
  25855.       DUMP_LOGFILE_STATE; 
  25856.       raise LOGFILE_ACCESS_ERROR; 
  25857.     end if; 
  25858.  
  25859.     if DESIRED_STATE = CLOSED and LOGFILE_IS_OPEN then 
  25860.       PUT_LINE("Logfile Access Error: Logfile already open"); 
  25861.       DUMP_LOGFILE_STATE; 
  25862.       raise LOGFILE_ACCESS_ERROR; 
  25863.     end if; 
  25864.  
  25865.     --| Check Logfile position
  25866.     if DESIRED_POSITION /= NEXT_LOGFILE_ITEM then 
  25867.       PUT_LINE("Logfile Sequence Error - Position"); 
  25868.       DUMP_LOGFILE_STATE; 
  25869.       raise LOGFILE_SEQUENCE_ERROR; 
  25870.     end if; 
  25871.  
  25872.     --| Check for valid Logfile key
  25873.     if CURRENT_KEY not  in FIRST_KEY .. LAST_KEY then 
  25874.       PUT_LINE("Logfile Sequence Error - Key"); 
  25875.       DUMP_LOGFILE_STATE; 
  25876.       raise LOGFILE_SEQUENCE_ERROR; 
  25877.     end if; 
  25878.  
  25879.     --| Test for unchecked End Of File
  25880.     if LOGFILE_IS_OPEN then 
  25881.       if END_OF_FILE(LOGFILE) then 
  25882.         PUT_LINE("Error - Unchecked EOF"); 
  25883.         DUMP_LOGFILE_STATE; 
  25884.         raise END_OF_LOGFILE; 
  25885.       end if; 
  25886.     end if; 
  25887.  
  25888.   end VERIFY_LOGFILE; 
  25889.  
  25890.  
  25891.   ------------------------------
  25892.   procedure FLUSH_LOGFILE_RECORD(--| Flush the current Logfile record
  25893.  
  25894.     KEY : in LOGFILE_KEYS  --| The current logfile key
  25895.  
  25896.       ) is 
  25897.  
  25898.     --| Effects
  25899.     --| If Key is equal to the current log file key then the remainder of the
  25900.     --| current logfile record is flushed and the logfile is positioned at
  25901.     --| the beginning of the next logfile record.
  25902.   
  25903.     --| Requires
  25904.     --| The ELF must have been previously opened for input by the
  25905.     --| calling program via a call to the procedure Open_Log.
  25906.     --| The Logfile key for the current record must have already been
  25907.     --| read. The Key passed by the calling program must match the
  25908.     --| key for the current logfile record.
  25909.  
  25910.     --| N/A:  Raises, Modifies, Errors
  25911.  
  25912.   begin
  25913.  
  25914.     --| Flush the current logfile record and reset the
  25915.     --| current logfile position to Log_Key.
  25916.  
  25917.     SKIP_LINE(LOGFILE); 
  25918.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  25919.  
  25920.   end FLUSH_LOGFILE_RECORD; 
  25921.  
  25922.  
  25923.   -----------------
  25924.   function NEXT_KEY return LOGFILE_KEYS is 
  25925.  
  25926.     KEY_NUMBER : NATURAL; 
  25927.     SPACE      : CHARACTER; 
  25928.  
  25929.   begin
  25930.  
  25931.     GET(LOGFILE, KEY_NUMBER);                    --| Get the logfile key
  25932.     GET(LOGFILE, SPACE);                         --| Discard next delimiter
  25933.     NEXT_LOGFILE_ITEM := LOG_DATA;               --| Set new logfile position
  25934.     CURRENT_KEY := LOGFILE_KEYS'VAL(KEY_NUMBER); --| Convert key to a value
  25935.  
  25936.     return CURRENT_KEY; 
  25937.  
  25938.   end NEXT_KEY; 
  25939.  
  25940.  
  25941.   ------------------------
  25942.   procedure GET_ADA_NAME(  --| Get the next token from Logfile
  25943.  
  25944.     NAME : out ADA_NAME  --| The token is returned as a string type
  25945.  
  25946.     ) is 
  25947.  
  25948.     use STRING_PKG; 
  25949.  
  25950.     TOKEN : STRING(1 .. MAX_LINE_LENGTH); 
  25951.  
  25952.   begin
  25953.  
  25954.     for NEXT_CHARACTER in 1 .. MAX_LINE_LENGTH loop
  25955.  
  25956.       GET(LOGFILE, TOKEN(NEXT_CHARACTER)); 
  25957.  
  25958.       if TOKEN(NEXT_CHARACTER) = ' ' then 
  25959.         NAME := MAKE_PERSISTENT(UPPER(TOKEN(1 .. NEXT_CHARACTER - 1))); 
  25960.         exit; 
  25961.       end if; 
  25962.  
  25963.     end loop; 
  25964.  
  25965.   end GET_ADA_NAME; 
  25966.  
  25967.  
  25968.   -----------------------------
  25969.   procedure GET_UNIT_IDENTIFIER(--| Gets unit ID for current unit from the ELF
  25970.  
  25971.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER
  25972.     --| A unique ID assigned by the Source Instrumenter
  25973.  
  25974.       ) is 
  25975.  
  25976.     --| Effects
  25977.     --| This is an internal procedure that gets and returns the
  25978.     --| program unit identifier from the ELF
  25979.  
  25980.     --| Requires
  25981.     --| The log file must have been previously opened by the calling
  25982.     --| program via a call to Open_Log. Tests for logfile open,
  25983.     --| logfile position, correct logfile key, and NOT end of logfile
  25984.     --| must have already been made.
  25985.   
  25986.     --| N/A:  Raises, Modifies, Errors
  25987.  
  25988.     COMPILATION_UNIT : ADA_NAME; 
  25989.     SPACE            : CHARACTER;      --| spaces are field delimiters
  25990.     TEMP_STRING      : STRING(1 .. 3); 
  25991.     UNIT_TYPE        : CHARACTER; 
  25992.  
  25993.   begin
  25994.  
  25995.     GET_ADA_NAME(UNIT_IDENTIFIER.ENCLOSING_UNIT_IDENTIFIER); 
  25996.     GET(LOGFILE, UNIT_IDENTIFIER.PROGRAM_UNIT_NUMBER); 
  25997.     UNIT_IDENTIFIER.TASK_TYPE_ACTIVATION_NUMBER := 0; 
  25998.     GET(LOGFILE, TEMP_STRING); 
  25999.     UNIT_TYPE := TEMP_STRING(2); 
  26000.  
  26001.     case UNIT_TYPE is 
  26002.       when 'P' => 
  26003.         UNIT_IDENTIFIER.UNIT_TYPE := PROCEDURE_TYPE; 
  26004.       when 'F' => 
  26005.         UNIT_IDENTIFIER.UNIT_TYPE := FUNCTION_TYPE; 
  26006.       when 'G' => 
  26007.         UNIT_IDENTIFIER.UNIT_TYPE := GENERIC_TYPE; 
  26008.       when 'K' => 
  26009.         UNIT_IDENTIFIER.UNIT_TYPE := PACKAGE_TYPE; 
  26010.       when 'T' => 
  26011.         UNIT_IDENTIFIER.UNIT_TYPE := TASK_TYPE; 
  26012.         GET(LOGFILE, UNIT_IDENTIFIER.TASK_TYPE_ACTIVATION_NUMBER); 
  26013.         GET(LOGFILE, SPACE);                   -- delimiter
  26014.       when others => 
  26015.         null; 
  26016.     end case; 
  26017.  
  26018.   end GET_UNIT_IDENTIFIER; 
  26019.  
  26020.  
  26021.  
  26022.   -----------------------
  26023.   procedure GET_UNIT_ID(--| Gets unit ID for current unit from the ELF
  26024.  
  26025.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER
  26026.     --| A unique ID assigned by the Source Instrumenter
  26027.  
  26028.       ) is 
  26029.  
  26030.     --| Effects
  26031.     --| Gets and returns the program unit id (Unit_ID) from the ELF
  26032.  
  26033.     --| Requires
  26034.     --| The log file must have been previously opened by the calling
  26035.     --| program via a call to Open_Log.
  26036.     --| The current log file key (i.e., the previously read key)
  26037.     --| must be in UNIT_START..UNIT_STOP.
  26038.  
  26039.     --| N/A:  Raises, Modifies, Errors
  26040.  
  26041.   begin
  26042.  
  26043.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26044.     SKIP_LINE(LOGFILE); 
  26045.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26046.  
  26047.   end GET_UNIT_ID; 
  26048.  
  26049.  
  26050.  
  26051.   ---------------------------------
  26052.   procedure DEFINE_COMPILATION_UNIT is --| Defines a new compilation unit
  26053.  
  26054.     use COMPILATION_UNIT_LISTS; --| List management package for
  26055.                                 --| compilation units and program units.
  26056.  
  26057.     COMPILATION_UNIT      : ADA_NAME; 
  26058.     NUMBER_OF_BREAKPOINTS : BREAKPOINT_NUMBER_RANGE; 
  26059.  
  26060.   begin
  26061.  
  26062.     GET_ADA_NAME(COMPILATION_UNIT);         -- get the name of the unit
  26063.     GET(LOGFILE, NUMBER_OF_BREAKPOINTS);    -- and the number of breakpoints
  26064.                                             -- add them to the unit list
  26065.     ADD_COMPILATION_UNIT(COMPILATION_UNIT, NUMBER_OF_BREAKPOINTS); 
  26066.     SKIP_LINE(LOGFILE); 
  26067.     NEXT_LOGFILE_ITEM := LOG_KEY;           -- set the new logfile position
  26068.  
  26069.   end DEFINE_COMPILATION_UNIT; 
  26070.  
  26071.  
  26072.   -----------------------------
  26073.   procedure DEFINE_PROGRAM_UNIT is --| Defines a new program unit
  26074.  
  26075.     use COMPILATION_UNIT_LISTS; --| List management package for
  26076.                                 --| compilation units and program units.
  26077.     use STRING_PKG;             --| A string handling package for String_Type's
  26078.  
  26079.     UNIT_ID   : PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26080.               --| Assigned by Source Instrumenter
  26081.  
  26082.     UNIT_NAME : ADA_NAME;       --| The name of the program unit
  26083.     LAST      : NATURAL;        --| Index to last character read
  26084.  
  26085.   begin
  26086.  
  26087.     GET_UNIT_IDENTIFIER(UNIT_ID);             -- get the program unit ID
  26088.     GET_LINE(LOGFILE, TEMP_STRING, LAST);     -- get the name of the unit
  26089.  
  26090.     STRING_PKG.FLUSH(UNIT_NAME); 
  26091.     UNIT_NAME := MAKE_PERSISTENT(UPPER(TEMP_STRING(1 .. LAST))); 
  26092.     ADD_PROGRAM_UNIT(UNIT_ID, UNIT_NAME);     -- Add this unit to the unit list
  26093.     NEXT_LOGFILE_ITEM := LOG_KEY;             -- set new position for logfile
  26094.  
  26095.   end DEFINE_PROGRAM_UNIT; 
  26096.  
  26097.  
  26098.   ------------------
  26099.   procedure OPEN_LOG( --| Opens the ELF for input by the report generators.
  26100.  
  26101.     LOGFILE_NAME : in FILENAME;         --| Name of the log file to be created
  26102.  
  26103.     PROGRAM_NAME : out ADA_NAME;        --| The name of the main program unit
  26104.  
  26105.     TEST_IDENT   : out TEST_IDENTIFIER; --| A unique ID assigned by the tester
  26106.  
  26107.     TEST_DATE    : out CALENDAR.TIME    --| The date and time of the test
  26108.  
  26109.       ) is 
  26110.  
  26111.     --| Raises: Invalid_Log_File_Format, Logfile_Access_Error
  26112.  
  26113.     --| Effects
  26114.     --| This procedure opens the ELF for input by the report generators.
  26115.     --| If the file is successfully opened, it returns test configuration
  26116.     --| data recorded in the ELF by the RTM during execution of the Ada
  26117.     --| program under test. If the file is already open then the exception
  26118.     --| Logfile_Access_Error is raised. If the file is not successfully
  26119.     --| opened due to an IO error, then the standard Text_IO exceptions are
  26120.     --| allowed to pass unhandled back to the calling program. If the ELF is
  26121.     --| is determined to contain invalid or missing configuration data,
  26122.     --| then the exception Invalid_Log_File_Format is raised.
  26123.  
  26124.     --| Requires
  26125.     --| The ELF must contain test configuration data in the format
  26126.     --| created by the RTM via a call to the procedure Create_Log.
  26127.  
  26128.     --| N/A:  Modifies, Errors
  26129.  
  26130.     use TIME_LIBRARY_1; --| for Timing_Type
  26131.     use TIME_LIBRARY_2; --| for Timing_Is Get_Time and Get_Time_of_Day
  26132.     use STRING_PKG;     --| for Mark, Release, Create, Substr, Make_Persistent
  26133.  
  26134.     KEY           : LOGFILE_KEYS; 
  26135.     LAST          : NATURAL; 
  26136.  
  26137.     PROGRAM_KEY   : BOOLEAN := FALSE; -- a test configuration key
  26138.     TOOL_KEY      : BOOLEAN := FALSE; -- a test configuration key
  26139.     TEST_TIME_KEY : BOOLEAN := FALSE; -- a test configuration key
  26140.     TEST_ID_KEY   : BOOLEAN := FALSE; -- a test configuration key
  26141.  
  26142.     TIME_TYPE     : CHARACTER; -- a temp variable for the timing method used
  26143.     DELIMITER     : CHARACTER; -- a temp variable for logfile field delimiters
  26144.  
  26145.   begin
  26146.  
  26147.     --| Verify that the logfile is not already open. If it is
  26148.     --| already open then raise the exception Logfile_Access_Error.
  26149.  
  26150.     VERIFY_LOGFILE(CLOSED); 
  26151.  
  26152.     --| If no exception has been raised the open the logfile
  26153.     --| for input.
  26154.  
  26155.     OPEN(LOGFILE, IN_FILE, VALUE(LOGFILE_NAME)); 
  26156.     LOGFILE_IS_OPEN := TRUE;        -- logfile is open for business
  26157.  
  26158.     ------------------
  26159.     CONFIGURATION_DATA : while not END_OF_FILE(LOGFILE) loop
  26160.  
  26161.       case NEXT_KEY is 
  26162.  
  26163.         when PROGRAM => 
  26164.           GET_LINE(LOGFILE, TEMP_STRING, LAST); 
  26165.           PROGRAM_NAME := MAKE_PERSISTENT(UPPER(TEMP_STRING(1 .. LAST))); 
  26166.           PROGRAM_KEY := TRUE; 
  26167.  
  26168.         when TOOL => 
  26169.           GET_LINE(LOGFILE, TEMP_STRING, LAST); 
  26170.           TOOL_KEY := TRUE; 
  26171.           if TEMP_STRING(1 .. LAST) = "PROFILE_TOOL" then 
  26172.             TIMING := TRUE; 
  26173.           end if; 
  26174.  
  26175.         when TEST_TIME => 
  26176.           GET(LOGFILE, TIME_TYPE); 
  26177.           case TIME_TYPE is 
  26178.             when 'W' => 
  26179.               TIMING_IS(WALL_CLOCK); 
  26180.             when 'R' => 
  26181.               TIMING_IS(RAW); 
  26182.             when others => 
  26183.               raise INVALID_LOGFILE_FORMAT; 
  26184.           end case; 
  26185.           GET(LOGFILE, DELIMITER);       -- a field delimiter
  26186.           GET_TIME(LOGFILE, TEST_DATE); 
  26187.           SKIP_LINE(LOGFILE); 
  26188.           TEST_TIME_KEY := TRUE; 
  26189.  
  26190.         when TEST_ID => 
  26191.           GET_LINE(LOGFILE, TEMP_STRING, LAST); 
  26192.           TEST_IDENT := MAKE_PERSISTENT(TEMP_STRING(1 .. LAST)); 
  26193.           TEST_ID_KEY := TRUE; 
  26194.  
  26195.         when COMPILATION_UNIT_DEFINITION =>
  26196.           DEFINE_COMPILATION_UNIT;         
  26197.   
  26198.         when PROGRAM_UNIT_DEFINITION =>    
  26199.           DEFINE_PROGRAM_UNIT;             
  26200.   
  26201.         when others => 
  26202.           FLUSH_LOGFILE_RECORD(CURRENT_KEY); 
  26203.  
  26204.       end case; 
  26205.  
  26206.       exit CONFIGURATION_DATA when  -- all config keys have been read
  26207.       PROGRAM_KEY and TOOL_KEY and TEST_TIME_KEY and TEST_ID_KEY; 
  26208.  
  26209.     end loop CONFIGURATION_DATA; 
  26210.  
  26211.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26212.  
  26213.     --| We have reached the end of the logfile. Verify that all configuration
  26214.     --| data has been found. If not, raise an exception.
  26215.     if not (PROGRAM_KEY and TOOL_KEY and TEST_TIME_KEY and TEST_ID_KEY) then 
  26216.       raise INVALID_LOGFILE_FORMAT; 
  26217.     end if; 
  26218.  
  26219.     RESET(LOGFILE);  --| The logfile must be reset in the event runtime
  26220.                      --| execution data has been interleaved with
  26221.                      --| Configuration data due to tasking or WITH'ing
  26222.                      --| of instrumented packages.
  26223.  
  26224.   end OPEN_LOG; 
  26225.  
  26226.  
  26227.   ----------------------
  26228.   procedure GET_NEXT_KEY(--| Gets the next log file key from the ELF
  26229.  
  26230.     KEY : in out LOGFILE_KEYS  --| Defines the type of data that is
  26231.                                --| contained in the current ELF record
  26232.  
  26233.       ) is 
  26234.  
  26235.     --| Effects
  26236.     --| This procedure reads the next log file key (Key) from the ELF and
  26237.     --| returns it to the calling program.
  26238.  
  26239.     --| Requires
  26240.     --| The ELF must have been previously opened for input by the
  26241.     --| calling program via a call to the procedure Open_Log.
  26242.  
  26243.     --| N/A:  Raises, Modifies, Errors
  26244.  
  26245.   begin
  26246.  
  26247.     KEY := NEXT_KEY;  --  Get the next logfile key;
  26248.  
  26249.     case KEY is 
  26250.  
  26251.       when PROGRAM .. TEST_ID =>
  26252.         --| This is a Configuration key. It was read when the log file
  26253.         --| was opened. Ignore it.
  26254.         FLUSH_LOGFILE_RECORD(KEY);
  26255.         GET_NEXT_KEY(KEY);        
  26256.  
  26257.       when COMPILATION_UNIT_DEFINITION =>
  26258.         --| This key defines a new compilation unit. It should have
  26259.         --| already been read when the log file was opened. Just in
  26260.         --| case try to add it to the compilation unit list. If it's
  26261.         --| already there then a little time will be lost but it's
  26262.         --| better to be safe than sorry.
  26263.         DEFINE_COMPILATION_UNIT;         
  26264.         GET_NEXT_KEY(KEY);               
  26265.  
  26266.       when PROGRAM_UNIT_DEFINITION =>        
  26267.         --| This key defines a new program unit. It should have
  26268.         --| already been read when the log file was opened. Just in
  26269.         --| case try to add it to the program unit list for this
  26270.         --| compilation unit. If it's already there then a little 
  26271.         --| time will be lost but it's better to be safe than sorry.
  26272.         DEFINE_PROGRAM_UNIT;                 
  26273.         GET_NEXT_KEY(KEY);                   
  26274.  
  26275.       when others =>  --| No other keys require special processing
  26276.         null;                         
  26277.  
  26278.     end case; 
  26279.  
  26280.   end GET_NEXT_KEY; 
  26281.  
  26282.  
  26283.   -----------------------
  26284.   procedure GET_UNIT_TIME(--| Gets the unit ID and start/stop time from ELF
  26285.  
  26286.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26287.     --| A unique ID assigned by the Source Instrumenter
  26288.  
  26289.     LOGGED_TIME     : out CALENDAR.DAY_DURATION --| The time that the unit
  26290.                                                 --| was entered or exited
  26291.       ) is 
  26292.  
  26293.     --| Effects
  26294.     --| Gets and returns the program unit id (Unit_Identifier) and logged
  26295.     --| time (Log_Time)  from the ELF.
  26296.  
  26297.     --| Requires
  26298.     --| The log file must have been previously opened by the calling
  26299.     --| program via a call to Open_Log.
  26300.     --| The current log file key (i.e., the previously read key)
  26301.     --| must be in UNIT_START..UNIT_STOP.
  26302.  
  26303.     --| N/A:  Raises, Modifies, Errors
  26304.  
  26305.  
  26306.   begin
  26307.  
  26308.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26309.     TIME_LIBRARY_2.GET_TIME_OF_DAY(LOGFILE, LOGGED_TIME); 
  26310.     SKIP_LINE(LOGFILE); 
  26311.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26312.  
  26313.   end GET_UNIT_TIME; 
  26314.  
  26315.  
  26316.   ------------------------
  26317.   procedure GET_BREAKPOINT( --| Gets current breakpoint from the ELF
  26318.  
  26319.     UNIT_IDENTIFIER    : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26320.     --| A unique ID assigned by the Source Instrumenter
  26321.  
  26322.     CURRENT_BREAKPOINT : out BREAKPOINT_NUMBER_RANGE
  26323.     --| The breakpoint number assigned by the Source Instrumenter
  26324.  
  26325.       ) is 
  26326.  
  26327.     --| Effects
  26328.     --| Gets the program unit, and current breakpoint number from the
  26329.     --| Execution Log File.
  26330.  
  26331.     --| Requires
  26332.     --| The log file must have been previously opened by the calling
  26333.     --| program via a call to Open_Log.
  26334.     --| The current log file key (i.e., the previously read key)
  26335.     --| must be in LOOP_BREAKPOINT..OTHER_BREAKPOINT.
  26336.  
  26337.     --| N/A:  Raises, Modifies, Errors
  26338.  
  26339.   begin
  26340.  
  26341.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26342.     GET(LOGFILE, CURRENT_BREAKPOINT); 
  26343.     SKIP_LINE(LOGFILE); 
  26344.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26345.  
  26346.   end GET_BREAKPOINT; 
  26347.  
  26348.  
  26349.  
  26350.   ------------------------
  26351.   function CALL_PARAMETERS  --| Gets AutoPath procedure call parameter list
  26352.  
  26353.     return USER_INPUT_STRING  --| The user specified parameter list
  26354.  
  26355.         is 
  26356.  
  26357.     --| Raises:  Logfile_Access_Error, Logfile_Sequence_Error,
  26358.     --|          End_of_Log_File
  26359.  
  26360.     --| Effects
  26361.     --| Gets the AutoPath procedure call parameter list from the logfile
  26362.     --| for a single execution of the target Ada program.
  26363.     --| If the logfile is not open then the exception Logfile_Access_Error
  26364.     --| is raised.
  26365.     --| If an End of File (EOF) in the ELF is encountered, the exception
  26366.     --| End_of_Log_File is raised.
  26367.     --| If the current logfile key is not AUTOPATH_CALL
  26368.     --| then the exception Logfile_Sequence_Error is raised.
  26369.  
  26370.     --| Requires
  26371.     --| The log file must have been previously opened by the calling
  26372.     --| program via a call to Open_Log.
  26373.     --| The current log file key (i.e., the previously read key)
  26374.     --| must be AUTOPATH_CALL.
  26375.  
  26376.     --| N/A:  Modifies, Errors
  26377.  
  26378.     use STRING_PKG; --| for handling of String_Type's
  26379.  
  26380.     PARAMETER_LIST : USER_INPUT_STRING; 
  26381.     LAST           : NATURAL;           --| The length of the parameter list
  26382.  
  26383.   begin
  26384.  
  26385.     --| Verify that the logfile is currently open, that the current
  26386.     --| logfile position is Log_Data, and that the current logfile
  26387.     --| key is AutoPath_Call. If any of these conditions
  26388.     --| is false then raise the appropriate exception.
  26389.  
  26390.     VERIFY_LOGFILE(OPENED, LOG_DATA, AUTOPATH_CALL, AUTOPATH_CALL); 
  26391.  
  26392.     GET_LINE(LOGFILE, TEMP_STRING, LAST); 
  26393.     STRING_PKG.FLUSH(PARAMETER_LIST); 
  26394.     PARAMETER_LIST := MAKE_PERSISTENT(UPPER(TEMP_STRING(1 .. LAST))); 
  26395.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26396.  
  26397.     return PARAMETER_LIST; 
  26398.  
  26399.   end CALL_PARAMETERS; 
  26400.  
  26401.   -------------------
  26402.   procedure GET_VALUE(--| Gets value of INTEGER variable from ELF
  26403.  
  26404.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26405.     --| A unique ID assigned by the Source Instrumenter
  26406.  
  26407.     VARIABLE_NAME   : out ADA_NAME; --| The unqualified variable name
  26408.  
  26409.     VALUE           : out INTEGER   --| The current value of variable
  26410.  
  26411.       ) is 
  26412.  
  26413.     --| Effects
  26414.     --| Gets integer values from the execution log file.
  26415.  
  26416.     --| Requires
  26417.     --| The log file must have been previously opened by the calling
  26418.     --| program via a call to Open_Log.
  26419.     --| The current log file key (i.e., the previously read key)
  26420.     --| must be INTEGER_VARIABLE.
  26421.  
  26422.     --| N/A:  Raises, Modifies, Errors
  26423.  
  26424.   begin
  26425.  
  26426.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26427.     GET_ADA_NAME(VARIABLE_NAME); 
  26428.     GET(LOGFILE, VALUE); 
  26429.     SKIP_LINE(LOGFILE); 
  26430.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26431.  
  26432.   end GET_VALUE; 
  26433.  
  26434.  
  26435.   -------------------
  26436.   procedure GET_VALUE(--| Gets value of LONG_INTEGER variable from ELF
  26437.  
  26438.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26439.     --| A unique ID assigned by the Source Instrumenter
  26440.  
  26441.     VARIABLE_NAME   : out ADA_NAME;    --| The unqualified variable name
  26442.  
  26443.     VALUE           : out LONG_INTEGER --| The current value of variable
  26444.  
  26445.       ) is 
  26446.  
  26447.     --| Effects
  26448.     --| Gets long_integer values from the execution log file.
  26449.  
  26450.     --| Requires
  26451.     --| The log file must have been previously opened by the calling
  26452.     --| program via a call to Open_Log.
  26453.     --| The current log file key (i.e., the previously read key)
  26454.     --| must be LONG_INTEGER_VARIABLE.
  26455.  
  26456.     --| N/A:  Raises, Modifies, Errors
  26457.  
  26458.     use NEW_LONG_INTEGER_IO; 
  26459.  
  26460.   begin
  26461.  
  26462.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26463.     GET_ADA_NAME(VARIABLE_NAME); 
  26464.     GET(LOGFILE, VALUE); 
  26465.     SKIP_LINE(LOGFILE); 
  26466.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26467.  
  26468.   end GET_VALUE; 
  26469.  
  26470.  
  26471.  
  26472.   -------------------
  26473.   procedure GET_VALUE(--| Gets value of FLOAT variable from ELF
  26474.  
  26475.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26476.     --| A unique ID assigned by the Source Instrumenter
  26477.  
  26478.     VARIABLE_NAME   : out ADA_NAME; --| The unqualified variable name
  26479.  
  26480.     VALUE           : out FLOAT     --| The current value of variable
  26481.  
  26482.       ) is 
  26483.  
  26484.     --| Effects
  26485.     --| Gets floating point values from the execution log file.
  26486.  
  26487.     --| Requires
  26488.     --| The log file must have been previously opened by the calling
  26489.     --| program via a call to Open_Log.
  26490.     --| The current log file key (i.e., the previously read key)
  26491.     --| must be FLOAT_VARIABLE.
  26492.  
  26493.     --| N/A:  Raises, Modifies, Errors
  26494.  
  26495.     use NEW_FLOAT_IO; 
  26496.  
  26497.   begin
  26498.  
  26499.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26500.     GET_ADA_NAME(VARIABLE_NAME); 
  26501.     GET(LOGFILE, VALUE); 
  26502.     SKIP_LINE(LOGFILE); 
  26503.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26504.  
  26505.   end GET_VALUE; 
  26506.  
  26507.  
  26508.  
  26509.   -------------------
  26510.   procedure GET_VALUE(--| Gets value of LONG_FLOAT variable from ELF
  26511.  
  26512.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26513.     --| A unique ID assigned by the Source Instrumenter
  26514.  
  26515.     VARIABLE_NAME   : out ADA_NAME;   --| The unqualified variable name
  26516.  
  26517.     VALUE           : out LONG_FLOAT  --| The current value of variable
  26518.  
  26519.       ) is 
  26520.  
  26521.     --| Effects
  26522.     --| Gets long_float values from the execution log file.
  26523.  
  26524.     --| Requires
  26525.     --| The log file must have been previously opened by the calling
  26526.     --| program via a call to Open_Log.
  26527.     --| The current log file key (i.e., the previously read key)
  26528.     --| must be LONG_FLOAT_VARIABLE.
  26529.  
  26530.     --| N/A:  Raises, Modifies, Errors
  26531.  
  26532.     use NEW_LONG_FLOAT_IO; 
  26533.  
  26534.   begin
  26535.  
  26536.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26537.     GET_ADA_NAME(VARIABLE_NAME); 
  26538.     GET(LOGFILE, VALUE); 
  26539.     SKIP_LINE(LOGFILE); 
  26540.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26541.  
  26542.   end GET_VALUE; 
  26543.  
  26544.  
  26545.  
  26546.   -------------------
  26547.   procedure GET_VALUE(--| Gets value of STRING variable from ELF
  26548.  
  26549.     UNIT_IDENTIFIER : out PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26550.     --| A unique ID assigned by the Source Instrumenter
  26551.  
  26552.     VARIABLE_NAME   : out ADA_NAME;        --| The unqualified variable name
  26553.  
  26554.     STRING_VALUE    : out STRING_VARIABLES --| current value of variable
  26555.  
  26556.       ) is 
  26557.  
  26558.     --| Effects
  26559.     --| Gets string values from the execution log file.
  26560.     --| This procedure used to get the value of
  26561.     --|        strings
  26562.     --|        characters
  26563.     --|        enumerated data types (including booleans)
  26564.  
  26565.     --| Requires
  26566.     --| The current log file key (i.e., the previously read key)
  26567.     --| must be STRING_VARIABLE.
  26568.  
  26569.     --| N/A:  Raises, Modifies, Errors
  26570.  
  26571.     use STRING_PKG; --| for handling of String_Type's
  26572.  
  26573.     LAST : NATURAL;  --| The length of the string variable's value
  26574.  
  26575.   begin
  26576.  
  26577.     GET_UNIT_IDENTIFIER(UNIT_IDENTIFIER); 
  26578.     GET_ADA_NAME(VARIABLE_NAME); 
  26579.     GET_LINE(LOGFILE, TEMP_STRING, LAST); 
  26580.     STRING_VALUE := MAKE_PERSISTENT(TEMP_STRING(1 .. LAST)); 
  26581.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26582.  
  26583.   end GET_VALUE; 
  26584.  
  26585.  
  26586.  
  26587.   -------------------
  26588.   function END_OF_LOG  --| Checks for End Of file in the ELF
  26589.     return BOOLEAN     --| True if EOF is reached else false
  26590.  
  26591.         is 
  26592.  
  26593.     --| Raises:  Logfile_Access_Error
  26594.   
  26595.     --| Effects
  26596.     --| This function checks for End Of File in the ELF and returns true
  26597.     --| if an EOF has been reached.
  26598.     --| If the logfile is not open then the exception Logfile_Access_Error
  26599.     --| is raised.
  26600.     --| Text_IO exceptions that may be raised are allowed to pass, unhandled,
  26601.     --| back to the calling program.
  26602.   
  26603.     --| Requires
  26604.     --| The log file must have been previously opened by the calling
  26605.     --| program via a call to Open_Log.
  26606.  
  26607.     --| N/A:  Modifies, Errors
  26608.  
  26609.  
  26610.   begin
  26611.     if not LOGFILE_IS_OPEN then 
  26612.       PUT_LINE("In End_of_Log"); 
  26613.       PUT_LINE("Logfile Access Error: Logfile not open"); 
  26614.       DUMP_LOGFILE_STATE; 
  26615.       raise LOGFILE_ACCESS_ERROR; 
  26616.     else 
  26617.       return END_OF_FILE(LOGFILE); 
  26618.     end if; 
  26619.   end END_OF_LOG; 
  26620.  
  26621.  
  26622.  
  26623.   ------------------------
  26624.   procedure FIND_UNIT_NAME( --| Finds the name of a program unit
  26625.  
  26626.     UNIT_IDENTIFIER : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  26627.     --| A unique ID assigned by the Source Instrumenter
  26628.  
  26629.     UNIT_NAME       : out ADA_NAME  --| The name of program unit
  26630.  
  26631.       ) is 
  26632.  
  26633.     --| Raises: Undefined_Program_Unit
  26634.  
  26635.     --| Effects
  26636.     --| Finds the program unit unit name (Unit_Name) corresponding to the
  26637.     --| program unit ID. If no UNIT_DEF record has been previously
  26638.     --| encountered in the ELF to associate a program unit name with
  26639.     --| the specified unit ID then the Undefined_Program_Unit exception
  26640.     --| is raised.
  26641.  
  26642.     --| Requires
  26643.     --| A program unit name (Unit_Name) must have been previously recorded
  26644.     --| in the ELF and assosiated with the specified unit id (Unit_Identifier)
  26645.     --| by the program that originally generated the log file via a call
  26646.     --| to the procedure Define_Comp_Unit.
  26647.  
  26648.     --| N/A:  Modifies, Errors
  26649.  
  26650.     use COMPILATION_UNIT_LISTS; --| List management package for
  26651.                                 --| compilation units and program units.
  26652.   begin
  26653.  
  26654.     GET_PROGRAM_UNIT_NAME(UNIT_IDENTIFIER, UNIT_NAME); 
  26655.  
  26656.   end FIND_UNIT_NAME; 
  26657.  
  26658.  
  26659.  
  26660.   ------------------------------
  26661.   function NUMBER_OF_BREAKPOINTS(--| Finds the number of breakpoints
  26662.                                  --| in a compilation unit
  26663.  
  26664.     COMPILATION_UNIT_NAME : in ADA_NAME --| The name of the compilation unit
  26665.  
  26666.       ) return BREAKPOINT_NUMBER_RANGE is 
  26667.  
  26668.     --| Raises: Undefined_Program_Unit
  26669.  
  26670.     --| Effects
  26671.     --| Gets and returns the total number of breakpoints in the
  26672.     --| specified compilation unit. If the compilation unit has
  26673.     --| not been previously defined in the logfile then the
  26674.     --| exception Undefined_Program_Unit is raised.
  26675.  
  26676.     --| Requires
  26677.     --| The compilation unit name must have been previously
  26678.     --| returned to the calling program in a Unit ID by the
  26679.     --| the procedure Get_Unit_ID.
  26680.  
  26681.     --| N/A:  Modifies, Errors
  26682.  
  26683.     use COMPILATION_UNIT_LISTS;  --| List management package for
  26684.                                  --| compilation units and program units.
  26685.  
  26686.     TOTAL_BREAKPOINTS : BREAKPOINT_NUMBER_RANGE; 
  26687.  
  26688.   begin
  26689.  
  26690.     GET_NUMBER_OF_BREAKPOINTS(COMPILATION_UNIT_NAME, TOTAL_BREAKPOINTS); 
  26691.     return TOTAL_BREAKPOINTS; 
  26692.  
  26693.   end NUMBER_OF_BREAKPOINTS; 
  26694.  
  26695.  
  26696.   --------------------
  26697.   function TIMING_DATA  --| Returns true if the logfile contains timing data
  26698.  
  26699.     return BOOLEAN
  26700.  
  26701.     is 
  26702.  
  26703.     --| Raises: Logfile_Access_Error
  26704.  
  26705.     --| Effects
  26706.     --| Returns true if the logfile contains timing data. Otherwise
  26707.     --| returns false. This function provides a mechanism for the
  26708.     --| calling program to determine whether or not timing data
  26709.     --| has been recorded in the logfile prior to calling other
  26710.     --| Read_Log procedures that read times from the logfile.
  26711.     --| If the logfile is not open then the exception
  26712.     --| Logfile_Access_Error is raised.
  26713.  
  26714.     --| Requires
  26715.     --| The target Ada program must have been executed with
  26716.     --| Tool_Name = Profile_Tool in order for timing data to have
  26717.     --| been recorded in the log file and the current log file
  26718.     --| key must be Timing_Overhead. The log file must have been
  26719.     --| previously opened by the calling program via a call to Open_Log.
  26720.  
  26721.     --| N/A:  Modifies, Errors
  26722.  
  26723.  
  26724.   begin
  26725.  
  26726.     return TIMING; 
  26727.  
  26728.   end TIMING_DATA; 
  26729.  
  26730.  
  26731.   -----------------------------
  26732.   function ACCUMULATED_OVERHEAD --| Returns the Accumulated timing overhead
  26733.                                 --| calculated during test program execution
  26734.  
  26735.     return CALENDAR.DAY_DURATION
  26736.  
  26737.     is 
  26738.  
  26739.     --| Raises: Logfile_Access_Error
  26740.  
  26741.     --| Effects
  26742.     --| Gets and returns the total accumulated timing overhead
  26743.     --| calculated during execution of the target Ada program.
  26744.     --| If the logfile is not open or the current logfile key is
  26745.     --| not then the exception Logfile_Access_Error is raised.
  26746.  
  26747.     --| Requires
  26748.     --| The target Ada program must have been executed with
  26749.     --| Tool_Name = Profile_Tool in order for timing data to have
  26750.     --| been recorded in the log file and the current log file
  26751.     --| key must be Timing_Overhead.
  26752.  
  26753.     --| N/A:  Modifies, Errors
  26754.  
  26755.     LOGGED_TIME : CALENDAR.DAY_DURATION; 
  26756.  
  26757.   begin
  26758.  
  26759.     --| Verify that the logfile is currently open, that the current
  26760.     --| logfile position is Log_Data, and that the current logfile
  26761.     --| key is in Unit_Start..Unit_Stop. If any of these conditions
  26762.     --| is false then raise the appropriate exception.
  26763.  
  26764.     VERIFY_LOGFILE(OPENED, LOG_DATA, TIMING_OVERHEAD, TIMING_OVERHEAD); 
  26765.  
  26766.     TIME_LIBRARY_2.GET_TIME_OF_DAY(LOGFILE, LOGGED_TIME); 
  26767.     SKIP_LINE(LOGFILE); 
  26768.     NEXT_LOGFILE_ITEM := LOG_KEY; 
  26769.     return LOGGED_TIME; 
  26770.  
  26771.   end ACCUMULATED_OVERHEAD; 
  26772.  
  26773.   -------------------
  26774.   procedure CLOSE_LOG is --| Closes the execution log file
  26775.  
  26776.     --| Raises:  Logfile_Access_Error
  26777.  
  26778.     --| Effects
  26779.     --| Closes the execution log file.
  26780.     --| If the logfile is not open then the exception Logfile_Access_Error
  26781.     --| is raised.
  26782.  
  26783.     --| Requires
  26784.     --| The log file must have been previously opened by the calling
  26785.     --| program via a call to Open_Log.
  26786.  
  26787.     --| N/A:  Modifies, Errors
  26788.  
  26789.   begin
  26790.     if LOGFILE_IS_OPEN then 
  26791.       CLOSE(LOGFILE); 
  26792.       LOGFILE_IS_OPEN := FALSE;
  26793.     else 
  26794.       PUT_LINE("In Close_Log"); 
  26795.       PUT_LINE("Logfile_Access_Error: Logfile already closed"); 
  26796.       raise LOGFILE_ACCESS_ERROR; 
  26797.     end if; 
  26798.   end CLOSE_LOG; 
  26799.  
  26800.  
  26801. end READ_LOG; 
  26802. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26803. --REPLIB.SPC
  26804. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26805. with TYPE_DEFINITIONS, SIMPLE_PAGINATED_OUTPUT, STRING_PKG, CALENDAR; 
  26806.  
  26807. ----------------------
  26808. package REPORT_LIBRARY is --| Ada Test and Evaluation Tools Report Library
  26809. ----------------------
  26810.  
  26811. --| Overview
  26812. --| NOSC_Report_Library is a library of procedures common to all of the
  26813. --| NOSC Ada Test and Evaluation Tool Set (ATETS) report generators.
  26814.  
  26815. --| N/A: Raises, Requires, Modifies, Errors
  26816.  
  26817.   use TYPE_DEFINITIONS;        --| Global type declarations for all ATETS tools
  26818.  
  26819.   use SIMPLE_PAGINATED_OUTPUT; --| Output writer uses Text_IO;
  26820.  
  26821.  
  26822.   MINIMUM_CPL : constant INTEGER :=  40; 
  26823.   MAXIMUM_CPL : constant INTEGER := 132; 
  26824.   MINIMUM_LPP : constant INTEGER :=  24; 
  26825.   MAXIMUM_LPP : constant INTEGER :=  66; 
  26826.  
  26827.   subtype CHARACTERS_PER_LINE is INTEGER range MINIMUM_CPL .. MAXIMUM_CPL; 
  26828.   subtype LINES_PER_PAGE      is INTEGER range MINIMUM_LPP .. MAXIMUM_LPP; 
  26829.  
  26830.   type OPTIONS is    --| Report formatting options
  26831.     record
  26832.       CPL          : CHARACTERS_PER_LINE; 
  26833.       PAGE_SIZE    : LINES_PER_PAGE; 
  26834.       TOOL_NAME    : TOOL_NAMES; 
  26835.       TOOL_VERSION : STRING(1 .. 20); 
  26836.     end record; 
  26837.  
  26838.   subtype HEADER_TEXT is STRING_PKG.STRING_TYPE; 
  26839.  
  26840.  
  26841.   --------------------------
  26842.   procedure OPEN_REPORT_FILE(--| Open the report file and set up formatting
  26843.  
  26844.     REPORT           : in out PAGINATED_FILE_HANDLE; 
  26845.                    --| A "handle" for the report file
  26846.  
  26847.     REPORT_FILE_NAME : in FILENAME; --| The name of the report file
  26848.  
  26849.     FORMAT_OPTIONS   : in OPTIONS   --| Report formatting options
  26850.  
  26851.       ); 
  26852.  
  26853.     --| Effects
  26854.     --| This procedure opens the report file for output and sets up the
  26855.     --| report formatting options. If the report file already exists then
  26856.     --| it is overwritten. A "handle" for the report file is returned to
  26857.     --| the calling program. All output to the report file is performed via
  26858.     --| the package Pagenated_Output. Report formatting  options for the
  26859.     --| output writer are set up according to the parameters specified in
  26860.     --| Format_Options. Although no exceptions are raised by this procedure,
  26861.     --| any Text_IO or Pagenated_Output exceptions that may be raised are
  26862.     --| allowed to pass, unhandled, back to the calling program.
  26863.  
  26864.     --| N/A:  Raises, Requires, Modifies, Errors
  26865.  
  26866.  
  26867.   -----------------------------------------
  26868.   procedure PRINT_TEST_CONFIGURATION_REPORT(
  26869.   --| Print log file test configuration data to report file
  26870.  
  26871.     REPORT        : in out PAGINATED_FILE_HANDLE;--| Output report file handle
  26872.  
  26873.     PROGRAM_NAME  : in ADA_NAME;       --| Name of program under test
  26874.  
  26875.     LOG_FILE_NAME : in FILENAME;       --| Name of the log file
  26876.  
  26877.     TEST_DATE     : in CALENDAR.TIME;  --| Date the log file was created
  26878.  
  26879.     TEST_IDENT    : in TEST_IDENTIFIER --| Test id specified by the user
  26880.  
  26881.       ); 
  26882.  
  26883.     --| Effects
  26884.     --| This procedure prints configuration information obtained from
  26885.     --| the command line parameters and the Execution Log File  on the
  26886.     --| first page of the report file. All output to the report file
  26887.     --| is performed via the package Pagenated_Output. No logfile is specified
  26888.     --| as access to the logfile is not visible to the calling program.
  26889.     --| The following information is printed on the configuration page
  26890.     --| of the report file:
  26891.     --|
  26892.     --|     Program Name:  name of program under test
  26893.     --|     Test Date:     date of log file generation
  26894.     --|     Test Time:     time of log file generation
  26895.     --|     Report Date:   date of report generation
  26896.     --|     Report Time:   time of report generation
  26897.     --|     Logfile:       log file name
  26898.  
  26899.     --| N/A:  Raises, Requires, Modifies, Errors
  26900.  
  26901.  
  26902.   -------------------------------------
  26903.   procedure PUT_TEST_CONFIGURATION_DATA(
  26904.   --| Put log file test configuration data to current output
  26905.  
  26906.     PROGRAM_NAME : in ADA_NAME;        --| The name of the program under test
  26907.     TEST_DATE    : in CALENDAR.TIME;   --| Date the log file was created
  26908.     TEST_IDENT   : in TEST_IDENTIFIER  --| Test id specified by the user
  26909.  
  26910.       ); 
  26911.  
  26912.     --| Effects
  26913.     --| This procedure puts test configuration information obtained from
  26914.     --| the Execution Log File  to current output. The following information
  26915.     --| is output:
  26916.     --|
  26917.     --|     Program Under Test:  name of program under test
  26918.     --|     Test Date:           date of log file generation
  26919.     --|     Test Time:           time of log file generation
  26920.     --|     Test ID:             the test ID obtained from the log file
  26921.     --|
  26922.  
  26923.     --| N/A:  Raises, Requires, Modifies, Errors
  26924.  
  26925.  
  26926.   --------------
  26927.   function QUERY(--| Put a Yes or No question and get a response
  26928.  
  26929.     QUESTION : in STRING  --| A query to be answered Y or N
  26930.  
  26931.       ) return BOOLEAN;   --| True if answered Y, False if answered N
  26932.  
  26933.     --| Effects
  26934.     --| The user is then prompted with Question. The user's response is then
  26935.     --| tested for Y or N. Only the first character input is tested and
  26936.     --| case is not significant. If Y is input then Response is returned
  26937.     --| true. In N is input then Response is  returned false. If Neither
  26938.     --| Y nor N then the user is prompted again with Query.
  26939.  
  26940.     --| N/A:  Raises, Requires, Modifies, Errors
  26941.  
  26942.  
  26943.   ------------------
  26944.   function STRING_OF(--| Convert an integer to a string of length 1..Width
  26945.  
  26946.     INT   : in INTEGER;      --| The Integer to be converted
  26947.  
  26948.     WIDTH : in NATURAL := 0  --| The width of the string to be returned
  26949.  
  26950.       ) return STRING; 
  26951.  
  26952.     --| Effects
  26953.     --| Converts the integer Int to a string of length Width. If Width = 0
  26954.     --| then the length of the string is equal to the number of digits in
  26955.     --| INT. If Width is greater than the number of digits in Int then the
  26956.     --| integer is right justified in the string and padded with blanks.
  26957.  
  26958.  
  26959.   ----------------
  26960.   function REPLACE(--| Replace characters in S1 at position Pos with S2
  26961.  
  26962.     S1  : in STRING_PKG.STRING_TYPE; 
  26963.       --| String_Type with characters to be replaced
  26964.  
  26965.     S2  : in STRING_PKG.STRING_TYPE; 
  26966.       --| String_Type to be inserted into copy of S2
  26967.  
  26968.     POS : in NATURAL
  26969.       --| Position in S1 at which S2 is to be inserted
  26970.  
  26971.       ) return STRING_PKG.STRING_TYPE; 
  26972.  
  26973.     --| Effects
  26974.     --| Returns  Substr( S1, 1, Pos-1 ) & S2 &
  26975.     --|              Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
  26976.  
  26977.     --| N/A:  Raises, Requires, Modifies, Errors
  26978.  
  26979.  
  26980.   ----------------
  26981.   function REPLACE(--| Replace characters in S1 at position Pos with S2
  26982.  
  26983.     S1  : in STRING_PKG.STRING_TYPE; 
  26984.       --| String_Type with characters to be replaced
  26985.  
  26986.     S2  : in STRING; 
  26987.       --| String to be inserted into copy of S2
  26988.  
  26989.     POS : in NATURAL
  26990.       --| Position in S1 at which S2 is to be inserted
  26991.  
  26992.       ) return STRING_PKG.STRING_TYPE; 
  26993.  
  26994.     --| Effects
  26995.     --| Returns  Substr( S1, 1, Pos-1 ) & S2 &
  26996.     --|              Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
  26997.  
  26998.     --| N/A:  Raises, Requires, Modifies, Errors
  26999.  
  27000.  
  27001.   ---------------
  27002.   function CENTER( --| Center text on header line
  27003.  
  27004.     TEXT : in STRING;              --| The text to be centered
  27005.  
  27006.     CPL  : in CHARACTERS_PER_LINE  --| Length of header text, in characters,
  27007.                                    --| to be created
  27008.  
  27009.       ) return HEADER_TEXT; 
  27010.  
  27011.     --| Effects
  27012.     --| Returns a Header_Text line of length CPL with the input Text string
  27013.     --| centered on the line.
  27014.  
  27015.     --| N/A:  Raises, Requires, Modifies, Errors
  27016.  
  27017.  
  27018. end REPORT_LIBRARY; 
  27019. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27020. --REPLIB.BDY
  27021. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27022. with TYPE_DEFINITIONS, STRING_PKG, SIMPLE_PAGINATED_OUTPUT, TEXT_IO; 
  27023. with CALENDAR, TIME_LIBRARY_1, TIME_LIBRARY_2; 
  27024.  
  27025. ---------------------------
  27026. package body REPORT_LIBRARY is  --| Ada Test and Evaluation Tools Report Lib
  27027. ---------------------------
  27028.  
  27029. --| Overview
  27030. --| NOSC_Report_Library is a library of procedures common to all of the
  27031. --| NOSC Ada Test and Evaluation Tool Set (ATETS) report generators.
  27032.  
  27033. --| N/A: Raises, Requires, Modifies, Errors
  27034.  
  27035.  
  27036.   use TYPE_DEFINITIONS;        --| Global type declarations common to all 
  27037.                                --| Ada Testing and Analysis Tools
  27038.  
  27039.   use SIMPLE_PAGINATED_OUTPUT; --| Output writer uses Text_IO;
  27040.  
  27041.   use STRING_PKG;              --| String handling package for String_Types;
  27042.  
  27043.  
  27044.   REPORT_OPTIONS : OPTIONS;    --| Report formatting options;
  27045.  
  27046.   HEADER         : VARIABLE_STRING_ARRAY(1 .. 7); 
  27047.  
  27048.  
  27049.   ------------------
  27050.   function STRING_OF(--| Convert an integer to a string of length 1..Width
  27051.  
  27052.     INT   : in INTEGER;      --| The Integer to be converted
  27053.  
  27054.     WIDTH : in NATURAL := 0  --| The width of the string to be returned
  27055.  
  27056.       ) return STRING is 
  27057.  
  27058.     --| Effects
  27059.     --| Converts the integer Int to a string of length Width. If Width = 0
  27060.     --| then the length of the string is equal to the number of digits in
  27061.     --| INT. If Width is greater than the number of digits in Int then the
  27062.     --| integer is right justified in the string and padded with blanks.
  27063.  
  27064.     package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER); 
  27065.  
  27066.     STR   : STRING(1 .. 20); 
  27067.     INDEX : NATURAL; 
  27068.  
  27069.   begin
  27070.  
  27071.     INT_IO.PUT(STR, INT); 
  27072.  
  27073.     if WIDTH > STR'LAST then 
  27074.       INDEX := STR'FIRST; 
  27075.  
  27076.     elsif WIDTH = 0 then 
  27077.       for I in reverse STR'range loop
  27078.         exit when STR(I) = ' '; 
  27079.         INDEX := I; 
  27080.       end loop; 
  27081.  
  27082.     else 
  27083.       INDEX := STR'LAST - WIDTH + 1; 
  27084.  
  27085.     end if; 
  27086.  
  27087.     return STR(INDEX .. STR'LAST); 
  27088.  
  27089.   end STRING_OF; 
  27090.  
  27091.  
  27092.   ----------------
  27093.   function REPLACE(--| Replace characters in S1 at position Pos with S2
  27094.  
  27095.     S1  : in STRING_TYPE; 
  27096.       --| String_Type with characters to be replaced
  27097.  
  27098.     S2  : in STRING_TYPE; 
  27099.       --| String_Type to be inserted into copy of S2
  27100.  
  27101.     POS : in NATURAL
  27102.       --| Position in S1 at which S2 is to be inserted
  27103.  
  27104.       ) return STRING_TYPE is 
  27105.  
  27106.     --| Effects
  27107.     --| Returns  Substr( S1, 1, Pos-1 ) & S2 &
  27108.     --|          Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
  27109.   
  27110.     --| N/A:  Raises, Requires, Modifies, Errors
  27111.  
  27112.   begin
  27113.     return INSERT(SPLICE(S1, POS, LENGTH(S2)), S2, POS); 
  27114.   end REPLACE; 
  27115.  
  27116.  
  27117.   ----------------
  27118.   function REPLACE(--| Replace characters in S1 at position Pos with S2
  27119.  
  27120.     S1  : in STRING_TYPE; 
  27121.       --| String_Type with characters to be replaced
  27122.     S2  : in STRING; 
  27123.       --| String to be inserted into copy of S2
  27124.     POS : in NATURAL
  27125.       --| Position in S1 at which S2 is to be inserted
  27126.  
  27127.       ) return STRING_TYPE is 
  27128.  
  27129.     --| Effects
  27130.     --| Returns  Substr( S1, 1, Pos-1 ) & S2 &
  27131.     --|              Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
  27132.  
  27133.     --| N/A:  Raises, Requires, Modifies, Errors
  27134.  
  27135.   begin
  27136.     return INSERT(SPLICE(S1, POS, LENGTH(CREATE(S2))), S2, POS); 
  27137.   end REPLACE; 
  27138.  
  27139.  
  27140.   ---------------
  27141.   function CENTER( --| Center text on header line
  27142.  
  27143.     TEXT : in STRING;              --| The text to be centered
  27144.  
  27145.     CPL  : in CHARACTERS_PER_LINE  --| Length of header text, in characters,
  27146.                                    --| to be created
  27147.  
  27148.       ) return HEADER_TEXT is 
  27149.  
  27150.     --| Effects
  27151.     --| Returns a Header_Text line of length CPL with the input Text string
  27152.     --| centered on the line.
  27153.  
  27154.     --| N/A:  Raises, Requires, Modifies, Errors
  27155.  
  27156.     HEADER_LINE : HEADER_TEXT; 
  27157.  
  27158.   begin
  27159.  
  27160.     HEADER_LINE := MAKE_PERSISTENT(TEXT); 
  27161.  
  27162.     for I in 1 .. ((CPL - LENGTH(HEADER_LINE))/2) loop
  27163.       HEADER_LINE := INSERT(HEADER_LINE, " ", 1); 
  27164.     end loop; 
  27165.  
  27166.     return HEADER_LINE; 
  27167.  
  27168.   end CENTER; 
  27169.  
  27170.  
  27171.   --------------------------
  27172.   procedure OPEN_REPORT_FILE(--| Open the report file and set up formatting
  27173.  
  27174.     REPORT           : in out PAGINATED_FILE_HANDLE; 
  27175.                    --| A "handle" for the report file
  27176.  
  27177.     REPORT_FILE_NAME : in FILENAME; --| The name of the report file
  27178.  
  27179.     FORMAT_OPTIONS   : in OPTIONS   --| Report formatting options
  27180.  
  27181.       ) is 
  27182.  
  27183.     --| Effects
  27184.     --| This procedure opens the report file for output and sets up the
  27185.     --| report formatting options. If the report file already exists then
  27186.     --| it is overwritten. A "handle" for the report file is returned to
  27187.     --| the calling program. All output to the report file is performed via
  27188.     --| the package Pagenated_Output. Report formatting  options for the
  27189.     --| output writer are set up according to the parameters specified in
  27190.     --| Format_Options. Although no exceptions are raised by this procedure,
  27191.     --| any Text_IO or Pagenated_Output exceptions that may be raised are
  27192.     --| allowed to pass, unhandled, back to the calling program.
  27193.  
  27194.     --| N/A:  Raises, Requires, Modifies, Errors
  27195.  
  27196.     HEADER_SIZE : constant INTEGER := 7; 
  27197.     FOOTER_SIZE : constant INTEGER := 3; 
  27198.  
  27199.   begin
  27200.  
  27201.     --| Create the report file.
  27202.     CREATE_PAGINATED_FILE(VALUE(REPORT_FILE_NAME), REPORT,
  27203.                           FORMAT_OPTIONS.PAGE_SIZE, HEADER_SIZE);
  27204.  
  27205.     --| Save the report formatting options for later
  27206.     REPORT_OPTIONS := FORMAT_OPTIONS; 
  27207.  
  27208.   end OPEN_REPORT_FILE; 
  27209.  
  27210.  
  27211.   -----------------------------------------
  27212.   procedure PRINT_TEST_CONFIGURATION_REPORT(
  27213.   --| Print test configuration data to report file
  27214.  
  27215.     REPORT        : in out PAGINATED_FILE_HANDLE; --| Output report file handle
  27216.  
  27217.     PROGRAM_NAME  : in ADA_NAME;       --| The name of the program under test
  27218.  
  27219.     LOG_FILE_NAME : in FILENAME;       --| Name of the log file
  27220.  
  27221.     TEST_DATE     : in CALENDAR.TIME;  --| Date the log file was created
  27222.  
  27223.     TEST_IDENT    : in TEST_IDENTIFIER --| Test id specified by the user
  27224.  
  27225.       ) is 
  27226.  
  27227.     --| Effects
  27228.     --| This procedure prints configuration information obtained from
  27229.     --| the command line parameters and the Execution Log File  on the
  27230.     --| first page of the report file. All output to the report file
  27231.     --| is performed via the package Pagenated_Output. No logfile is specified
  27232.     --| as access to the logfile is not visible to the calling program.
  27233.     --| The following information is printed on the configuration page
  27234.     --| of the report file:
  27235.     --|
  27236.     --|     Program Name:  name of program under test
  27237.     --|     Test Date:     date of log file generation
  27238.     --|     Test Time:     time of log file generation
  27239.     --|     Report Date:   date of report generation
  27240.     --|     Report Time:   time of report generation
  27241.     --|     Logfile:       log file name
  27242.     --|     Test ID:       the test ID obtained from the log file
  27243.  
  27244.     --| N/A:  Raises, Requires, Modifies, Errors
  27245.  
  27246.     use CALENDAR, TIME_LIBRARY_1, TIME_LIBRARY_2; 
  27247.  
  27248.     DASHES : constant STRING(1 .. MAXIMUM_CPL) := (1 .. MAXIMUM_CPL => '-'); 
  27249.     BLANKS : constant STRING(1 .. MAXIMUM_CPL) := (1 .. MAXIMUM_CPL => ' '); 
  27250.  
  27251.     PATH_TITLE     : constant STRING := "Ada Path Analyzer"; 
  27252.     AUTOPATH_TITLE : constant STRING := "Ada Automatic Path Analyzer"; 
  27253.     PROFILE_TITLE  : constant STRING := "Ada Performance Analyzer"; 
  27254.     SMART_TITLE    : constant STRING := "Ada Self Metric Analysis " & 
  27255.                                         "and Reporting Tool"; 
  27256.  
  27257.     REPORT_TITLE   : constant STRING := " - Test Configuration Report"; 
  27258.     TEST_TIME      : STRING(1 .. 11);    -- the time of the test
  27259.  
  27260.  
  27261.   begin
  27262.  
  27263.     --| Create 7 header lines. Lines 1 and 5 are initially created
  27264.     --| with a length of 132 characters. Line 1 includes the day of the
  27265.     --| week and escape sequences for Paginated_Output to print the
  27266.     --| calendar date (~c), the time (~t), and the page number (~p).
  27267.  
  27268.     STRING_PKG.MARK; 
  27269.  
  27270.     HEADER(1) := MAKE_PERSISTENT(BLANKS); 
  27271.     HEADER(1) := REPLACE(HEADER(1), WEEKDAY_OF(CLOCK), 85); 
  27272.     HEADER(1) := REPLACE(HEADER(1), "~d    ~t    Page:  ~p", 98); 
  27273.     HEADER(2) := MAKE_PERSISTENT(" "); 
  27274.     HEADER(3) := MAKE_PERSISTENT(" "); 
  27275.  
  27276.     --| Center the name of the tool and the report title on line 4
  27277.     case REPORT_OPTIONS.TOOL_NAME is 
  27278.  
  27279.       when PATH_TOOL => 
  27280.         HEADER(4) := CENTER(PATH_TITLE & REPORT_TITLE, REPORT_OPTIONS.CPL); 
  27281.       when AUTOPATH_TOOL => 
  27282.         HEADER(4) := CENTER(AUTOPATH_TITLE & REPORT_TITLE, REPORT_OPTIONS.CPL); 
  27283.       when PROFILE_TOOL => 
  27284.         HEADER(4) := CENTER(PROFILE_TITLE & REPORT_TITLE, REPORT_OPTIONS.CPL); 
  27285.       when SMART_TOOL => 
  27286.         HEADER(4) := CENTER(SMART_TITLE & REPORT_TITLE, REPORT_OPTIONS.CPL); 
  27287.       when others => 
  27288.         null; 
  27289.  
  27290.     end case; 
  27291.  
  27292.     HEADER(5) := MAKE_PERSISTENT(DASHES); 
  27293.     HEADER(6) := MAKE_PERSISTENT(" "); 
  27294.     HEADER(7) := MAKE_PERSISTENT(" "); 
  27295.  
  27296.     --| Set header lines 1 & 5 to the number of Character per line (CPL)
  27297.     --| specified in Report_Options
  27298.     HEADER(1) := SUBSTR(HEADER(1), MAXIMUM_CPL - REPORT_OPTIONS.CPL + 1, 
  27299.                         REPORT_OPTIONS.CPL - 14);  -- ~d and ~t add 14 chars
  27300.  
  27301.     HEADER(5) := SUBSTR(HEADER(5), MAXIMUM_CPL - REPORT_OPTIONS.CPL + 1, 
  27302.                         REPORT_OPTIONS.CPL); 
  27303.  
  27304.     --| Insert the tool version number into the first header line
  27305.     HEADER(1) := REPLACE(HEADER(1), REPORT_OPTIONS.TOOL_VERSION, 1); 
  27306.  
  27307.  
  27308.     --| Print the report
  27309.     TEST_TIME := WALL_CLOCK_OF(SECONDS(TEST_DATE)); 
  27310.  
  27311.     SET_HEADER(REPORT, HEADER);   --| Set up the new header
  27312.  
  27313.     PUT      (REPORT, "       Program Under Test:      "); 
  27314.     PUT_LINE (REPORT, VALUE(PROGRAM_NAME)); 
  27315.     SKIP_LINE(REPORT, 1); 
  27316.     PUT      (REPORT, "       Test Date:               "); 
  27317.     PUT_LINE (REPORT, DATE_OF(TEST_DATE)); 
  27318.     SKIP_LINE(REPORT, 1); 
  27319.     PUT      (REPORT, "       Test Day:                "); 
  27320.     PUT_LINE (REPORT, WEEKDAY_OF(TEST_DATE)); 
  27321.     SKIP_LINE(REPORT, 1); 
  27322.     PUT      (REPORT, "       Test Time:               "); 
  27323.     PUT_LINE (REPORT, TEST_TIME(1 .. 8)); 
  27324.     SKIP_LINE(REPORT, 1); 
  27325.     PUT      (REPORT, "       Log File:                "); 
  27326.     PUT_LINE (REPORT, VALUE(LOG_FILE_NAME)); 
  27327.     SKIP_LINE(REPORT, 1); 
  27328.     PUT      (REPORT, "       Test ID:                 "); 
  27329.     PUT_LINE (REPORT, VALUE(TEST_IDENT)); 
  27330.  
  27331.     STRING_PKG.RELEASE; 
  27332.  
  27333.   end PRINT_TEST_CONFIGURATION_REPORT; 
  27334.  
  27335.  
  27336.   -------------------------------------
  27337.   procedure PUT_TEST_CONFIGURATION_DATA(
  27338.   --| Put log file test configuration data to current output
  27339.  
  27340.     PROGRAM_NAME : in ADA_NAME;        --| The name of the program under test
  27341.  
  27342.     TEST_DATE    : in CALENDAR.TIME;   --| Date the log file was created
  27343.  
  27344.     TEST_IDENT   : in TEST_IDENTIFIER  --| Test id specified by the user
  27345.  
  27346.       ) is 
  27347.  
  27348.     --| Effects
  27349.     --| This procedure puts test configuration information obtained from
  27350.     --| the Execution Log File  to current output. The following information
  27351.     --| is output:
  27352.     --|
  27353.     --|     Program Under Test:  name of program under test
  27354.     --|     Test Date:           date of log file generation
  27355.     --|     Test Time:           time of log file generation
  27356.     --|     Test ID:             the test ID obtained from the log file
  27357.     --|
  27358.  
  27359.     --| N/A:  Raises, Requires, Modifies, Errors
  27360.  
  27361.     use CALENDAR, TIME_LIBRARY_1; 
  27362.  
  27363.     TEST_TIME : STRING(1 .. 11); --| the time of the test
  27364.  
  27365.   begin
  27366.  
  27367.     TEST_TIME := WALL_CLOCK_OF(SECONDS(TEST_DATE)); 
  27368.  
  27369.     TEXT_IO.NEW_LINE; 
  27370.     TEXT_IO.PUT     ("Program Under Test:        "); 
  27371.     TEXT_IO.PUT_LINE(VALUE(PROGRAM_NAME)); 
  27372.     TEXT_IO.PUT     ("Test Date:                 "); 
  27373.     TEXT_IO.PUT_LINE(DATE_OF(TEST_DATE)); 
  27374.     TEXT_IO.PUT     ("Test Time:                 "); 
  27375.     TEXT_IO.PUT_LINE(TEST_TIME(1 .. 8)); 
  27376.     TEXT_IO.PUT     ("Test ID:                   "); 
  27377.     TEXT_IO.PUT_LINE(VALUE(TEST_IDENT)); 
  27378.     TEXT_IO.NEW_LINE; 
  27379.  
  27380.   end PUT_TEST_CONFIGURATION_DATA; 
  27381.  
  27382.  
  27383.   --------------
  27384.   function QUERY(--| Put a Yes or No question and get a response
  27385.  
  27386.     QUESTION : in STRING  --| A query to be answered Y or N
  27387.  
  27388.       ) return BOOLEAN is 
  27389.  
  27390.     --| Effects
  27391.     --| The user is then prompted with Question. The user's response is then
  27392.     --| tested for Y or N. Only the first character input is tested and
  27393.     --| case is not significant. If Y is input then Response is returned
  27394.     --| true. In N is input then Response is  returned false. If Neither
  27395.     --| Y nor N then the user is prompted again with Query.
  27396.  
  27397.     --| N/A:  Raises, Requires, Modifies, Errors
  27398.  
  27399.     ANSWER : STRING(1 .. 80); --| temporary string for user's answer
  27400.  
  27401.     LAST   : NATURAL;         --| temporary variable used by Text_IO to
  27402.                               --| return the index of the last character 
  27403.                               --| input by the user 
  27404.  
  27405.   begin
  27406.  
  27407.     loop
  27408.       TEXT_IO.PUT(QUESTION); 
  27409.       TEXT_IO.GET_LINE(ANSWER, LAST); 
  27410.       TEXT_IO.NEW_LINE; 
  27411.       TEXT_IO.NEW_LINE; 
  27412.  
  27413.       if LAST > 0 then 
  27414.         case ANSWER(1) is 
  27415.           when 'Y' | 'y' => return TRUE; 
  27416.           when 'N' | 'n' => return FALSE; 
  27417.           when others    => null; 
  27418.         end case; 
  27419.       end if; 
  27420.     end loop; 
  27421.  
  27422.   end QUERY; 
  27423.  
  27424. end REPORT_LIBRARY; 
  27425. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27426. --BREAK.SPC
  27427. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27428. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; 
  27429. with STRING_PKG; use STRING_PKG; 
  27430. with DYNAMIC_ARRAY_PKG; use DYNAMIC_ARRAY_PKG; 
  27431. package BREAKPOINT is 
  27432.  
  27433. --| overview
  27434. --| Breakpoint is a package containing all of the common procedures to be
  27435. --| used by the report writer for the path analyzer. This package is used
  27436. --| to keep a running record of breakpoints encountered via an execution 
  27437. --| count for each breakpoint in a given unit. This information is utilized
  27438. --| by the report writer for the path analyzer.
  27439.  
  27440. --| raises
  27441. --| No user defined exceptions are raised during package initialization.
  27442.  
  27443. --| effects
  27444. --| package initialization has no effect on outside and/or "withing" units.
  27445.  
  27446. --| n/a  requires,errors,tuning,notes
  27447.  
  27448.  
  27449.  
  27450.  
  27451.   type BREAKPOINT_INFORMATION; 
  27452.   type TABLE_ACCESS is access BREAKPOINT_INFORMATION; 
  27453.  
  27454.   type BREAKPOINT_INFORMATION is 
  27455.     record
  27456.       UNIT_NAME       : ADA_NAME; 
  27457.       EXECUTION_COUNT : DARRAY; 
  27458.     end record; 
  27459.  
  27460.  
  27461.  
  27462.   procedure INITIALIZE_BREAKPOINTS( --| add entry to table
  27463.                                    UNIT_NAME             : in ADA_NAME; 
  27464.                                            --| name of library unit
  27465.                                    NUMBER_OF_BREAKPOINTS : in 
  27466.                                      BREAKPOINT_NUMBER_RANGE
  27467.                                    --| number of brkpts in library unit
  27468.                                    ); 
  27469.   --| overview
  27470.   --| Adds an entry to the table for the current library unit, in which to
  27471.   --| store the execution count data.
  27472.  
  27473.   --| effects
  27474.   --| The table is searched for the current library unit,
  27475.   --| if it is not found, an entry is added for each breakpoint in the
  27476.   --| current library unit.
  27477.   --| The total execution count for each breakpoint is initialized to 0.
  27478.  
  27479.   --| modifies
  27480.   --| The internal Breakpoint_Information Data structure is modified if
  27481.   --| the current unit is not found.
  27482.  
  27483.  
  27484.   --| n/a
  27485.   --| errors, raises, requires
  27486.  
  27487.   procedure BREAK( --| called at each breakpoint
  27488.                   UNIT_NAME         : in ADA_NAME;  --| procedure name
  27489.                   BREAKPOINT_NUMBER : in BREAKPOINT_NUMBER_RANGE
  27490.                   --| breakpoint number
  27491.                   ); 
  27492.   --| overview
  27493.   --| Increments the execution count for the current breakpoint.
  27494.  
  27495.   --| effects
  27496.   --| Break increments the execution count for Breakpoint_Number in 
  27497.   --| the unit Unit_Name.
  27498.  
  27499.   --| requires
  27500.   --| Initialize_Breakpoints must be called for the Unit_Name prior
  27501.   --| to calling Break.
  27502.  
  27503.   --| modifies
  27504.   --| The Execution_Count is modified for the given Breakpoint_Number
  27505.  
  27506.  
  27507.   --| errors
  27508.   --| The unit name can't be found in the table
  27509.  
  27510.   --| raises Unit_Name_Not_Found
  27511.  
  27512.   --| n/a tuning,notes
  27513.  
  27514.  
  27515.   procedure DUMP( --| dump totals to logfile
  27516.  
  27517.                  BREAKPOINT_TABLE_ACCESS : in out TABLE_ACCESS; 
  27518.                  --|unit name, breakpoints and counts
  27519.                  MORE_UNITS_AVAILABLE    : out BOOLEAN
  27520.                  --|false if all units have been dumped
  27521.                  ); 
  27522.  
  27523.   --| overview
  27524.   --| Dump is called to list execution count totals.
  27525.   --| Dump should be be used by any tool that requires total execution
  27526.   --| counts for each breakpoint. Each invocation of Dump will return
  27527.   --| information for only one compilation unit. When all compilation unit
  27528.   --| information has been dumped, more_Units_Available will assume a false
  27529.   --| value.
  27530.  
  27531.   --| effects
  27532.   --| A unit name and breakpoint Execution_Count data is returned to the
  27533.   --| calling unit. The internal storage space for that Unit_Information is
  27534.   --| then released. This does not affect the data returned to the user of 
  27535.   --| this procedure. Upon encountering the last piece of Unit_Information,
  27536.   --| the boolean More_Units_Available is set to false. If a calling program
  27537.   --| invokes this procedure after the boolean More_Units_Available is set to
  27538.   --| false, the exeception No_Units_Available will be raised.
  27539.  
  27540.   --| modifies
  27541.   --| Breakpoint_Table_Access, More_Units_Available, Internal Unit_Information
  27542.   --| storage.
  27543.  
  27544.   --| errors 
  27545.   --| If a calling program invokes the procedure after the boolean 
  27546.   --| More_Units_Available has been set to false, an exception will 
  27547.   --| be raised (No_Units_Available).
  27548.  
  27549.   --| raises No_Units_Available
  27550.  
  27551.  
  27552.   --| n/a
  27553.   --| tuning,notes,requires
  27554.  
  27555.  
  27556.   UNIT_NAME_NOT_FOUND : exception;  --|raised when break is called with an
  27557.   --|uninitialized unit name.
  27558.  
  27559.   NO_UNITS_AVAILABLE  : exception;  --|raised when dump is called and no
  27560.   --|breakpoint information is available.
  27561.  
  27562. end BREAKPOINT; 
  27563. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27564. --BREAK.BDY
  27565. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27566. package body BREAKPOINT is 
  27567. --|overview
  27568. --|Three procedures are provided to initialize, update , and recall
  27569. --|breakpoint information for a given unit. A dynamic data structure
  27570. --|consisting of a linked list is utilized as well as the dynamic array
  27571. --|and dynamic string data structures provided via library packages.
  27572.  
  27573. --|effects
  27574. --|package initialization has no effect on outside and/or "withing" units.
  27575.  
  27576. --|raises
  27577. --|No user defined exceptions are raised during package initialization.
  27578.  
  27579. --|n/a requires,errors,tuning,notes.
  27580.  
  27581.  
  27582.  
  27583.  
  27584.   type BREAKPOINT_TABLE; 
  27585.   type NEXT_POINTER is access BREAKPOINT_TABLE; 
  27586.  
  27587.   type BREAKPOINT_TABLE is 
  27588.     record
  27589.       TABLE_UNIT_NAME : ADA_NAME; 
  27590.       NEXT_TABLE      : NEXT_POINTER; 
  27591.       EXECUTION_COUNT : DARRAY; 
  27592.  
  27593.     end record; 
  27594.  
  27595.   TOP_POINTER : NEXT_POINTER;  --| global pointer for top of list
  27596.  
  27597.   procedure INITIALIZE_BREAKPOINTS( --| add entry to table
  27598.                                    UNIT_NAME             : in ADA_NAME; 
  27599.                                            --| name of library unit
  27600.                                    NUMBER_OF_BREAKPOINTS : in 
  27601.                                      BREAKPOINT_NUMBER_RANGE
  27602.                                    --| number of brkpts in library unit
  27603.                                    ) is 
  27604.  
  27605.   --|effects
  27606.   --|The table is searched for the current library unit, if it is not found
  27607.   --|an entry is added for each breakpoint in the current library unit. The 
  27608.   --|total execution count for each breakpoint is initialized to 0.
  27609.  
  27610.   --|modifies
  27611.   --|The internal Breakpoint_Information data structure is modified if the
  27612.   --|current unit is not found.
  27613.  
  27614.   --|n/a errors,requires,raises
  27615.  
  27616.  
  27617.  
  27618.     LOCAL_BREAKPOINT_ARRAY : ARRAY_TYPE(1 .. NUMBER_OF_BREAKPOINTS) := (others
  27619.       => 0);  --| local breakpoint table used
  27620.     --| to initialize counts to zero      
  27621.  
  27622.     POINT_TO               : NEXT_POINTER := TOP_POINTER; 
  27623.                                            --| local pointer for table access,
  27624.     --| initially is null
  27625.   begin
  27626.     while POINT_TO /= null and then not EQUAL(POINT_TO.TABLE_UNIT_NAME, 
  27627.       UNIT_NAME) loop
  27628.  
  27629.       -- search for library unit in table
  27630.       POINT_TO := POINT_TO.NEXT_TABLE; 
  27631.     end loop; 
  27632.     if POINT_TO = null then 
  27633.  
  27634.       -- library unit not found so add it
  27635.  
  27636.       -- use dynamic array funcs convert array of proper length, initialized
  27637.       -- to zero counts to a darray.
  27638.       POINT_TO := new BREAKPOINT_TABLE; 
  27639.       POINT_TO.TABLE_UNIT_NAME := UNIT_NAME; 
  27640.       POINT_TO.NEXT_TABLE := TOP_POINTER; 
  27641.       ARRAY_TO_DARRAY(A => LOCAL_BREAKPOINT_ARRAY, PREDICT => 
  27642.         NUMBER_OF_BREAKPOINTS, D => POINT_TO.EXECUTION_COUNT); 
  27643.       TOP_POINTER := POINT_TO; 
  27644.     end if; 
  27645.   end INITIALIZE_BREAKPOINTS; 
  27646.  
  27647.   procedure BREAK( --| called at each breakpoint
  27648.                   UNIT_NAME         : in ADA_NAME;  --| procedure name
  27649.                   BREAKPOINT_NUMBER : in BREAKPOINT_NUMBER_RANGE
  27650.                   --| breakpoint number
  27651.                   ) is 
  27652.  
  27653.   --|effects
  27654.   --|Break increments the execution count for Breakpoint_Number in the
  27655.   --|current Unit_Name.
  27656.  
  27657.   --|requires
  27658.   --|Initialize_Breakpoints must be called for the Unit_Name prior
  27659.   --|to calling Break.
  27660.  
  27661.   --|modifies
  27662.   --|The Execution_Count is modified for the given Breakpoint_Number.
  27663.  
  27664.   --|errors
  27665.   --|The Unit_Name can't be found in the table.
  27666.  
  27667.   --|raises
  27668.   --|Unit_Name_Not_Found
  27669.  
  27670.   --|n/a tuning,notes
  27671.  
  27672.  
  27673.  
  27674.     POINTER_TO : NEXT_POINTER := TOP_POINTER; 
  27675.                                              --| local pointer for table access
  27676.     COUNT      : COUNT_RANGE; 
  27677.  
  27678.   begin
  27679.     while POINTER_TO /= null and then not EQUAL(POINTER_TO.TABLE_UNIT_NAME, 
  27680.       UNIT_NAME) loop
  27681.  
  27682.       -- search for unit name in table
  27683.       POINTER_TO := POINTER_TO.NEXT_TABLE; 
  27684.     end loop; 
  27685.     if POINTER_TO /= null then 
  27686.  
  27687.       -- unit name found
  27688.       -- increment the execution count
  27689.       COUNT := FETCH(D => POINTER_TO.EXECUTION_COUNT, I => BREAKPOINT_NUMBER); 
  27690.       COUNT := COUNT + 1; 
  27691.       STORE(D => POINTER_TO.EXECUTION_COUNT, I => BREAKPOINT_NUMBER, E => COUNT)
  27692.         ; 
  27693.     else 
  27694.  
  27695.       -- unit name not found in table
  27696.       -- error condition
  27697.       raise UNIT_NAME_NOT_FOUND; 
  27698.     end if; 
  27699.   end BREAK; 
  27700.  
  27701.   procedure DUMP( --| dump totals to logfile
  27702.  
  27703.                  BREAKPOINT_TABLE_ACCESS : in out TABLE_ACCESS; 
  27704.                  --|unit name, breakpoints and counts
  27705.                  MORE_UNITS_AVAILABLE    : out BOOLEAN
  27706.                  --|false if all units have been dumped
  27707.                  ) is 
  27708.  
  27709.   --|effects
  27710.   --|A unit name and breakpoint Execution_Count data is returned to the 
  27711.   --|calling unit. The internal storage space for that Unit_Information is
  27712.   --|then released. This does not affect the data returned to the user of
  27713.   --|this procedure. Upon encountering the last piece of Unit_Information,
  27714.   --|the boolean More_Units_Available is set to false. If a calling program
  27715.   --|invokes this procedure after the boolean More_Units_Available is set to
  27716.   --|false, the exeception No_Units_Available will be raised.
  27717.  
  27718.   --|modifies
  27719.   --|Breakpoint_Table_Access, More_Units_Available, Internal Unit_Information
  27720.   --|storage.
  27721.  
  27722.   --|errors
  27723.   --|If a calling program invokes the procedure after the boolean
  27724.   --|More_Units_Available has been set to false, an exception will
  27725.   --|be raised (No_Units_Available).
  27726.  
  27727.   --|raises No_Units_Available
  27728.  
  27729.   --|n/a 
  27730.   --|tuning,notes,requires
  27731.  
  27732.  
  27733.  
  27734.  
  27735.  
  27736.  
  27737.  
  27738.     POINTS_TO : NEXT_POINTER := TOP_POINTER;  --| local pointer for table access
  27739.  
  27740.   begin
  27741.     if POINTS_TO /= null then 
  27742.       BREAKPOINT_TABLE_ACCESS := new BREAKPOINT_INFORMATION'(POINTS_TO.
  27743.         TABLE_UNIT_NAME, COPY(POINTS_TO.EXECUTION_COUNT)); 
  27744.       TOP_POINTER := POINTS_TO.NEXT_TABLE; 
  27745.       if TOP_POINTER /= null then 
  27746.         MORE_UNITS_AVAILABLE := TRUE; 
  27747.       else 
  27748.         MORE_UNITS_AVAILABLE := FALSE; 
  27749.       end if; 
  27750.       DESTROY(POINTS_TO.EXECUTION_COUNT); 
  27751.     else 
  27752.       MORE_UNITS_AVAILABLE := FALSE; 
  27753.  
  27754.       --| Error condition encountered, no breakpoint information available
  27755.       raise NO_UNITS_AVAILABLE; 
  27756.     end if; 
  27757.   end DUMP; 
  27758.  
  27759.  
  27760. end BREAKPOINT; 
  27761. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27762. --AVERAGE.SPC
  27763. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27764. with TEXT_IO; 
  27765. with IMPLEMENTATION_DEPENDENCIES; 
  27766. with TYPE_DEFINITIONS; use TYPE_DEFINITIONS; use TEXT_IO; use 
  27767.   IMPLEMENTATION_DEPENDENCIES; 
  27768. --
  27769. --
  27770. package AVERAGE is 
  27771. --:Overview
  27772. --:average is a package for calculating the average value from arbitrary
  27773. --:number of elements.  to avoid the overflow condition, an incremental
  27774. --:average algorithm is used:
  27775. --:            previous_average             current_value
  27776. --: new_ave= -------------------- * (n-1) + --------------
  27777. --:                   n                           n
  27778. --: where n = current number of element read
  27779.  
  27780. --:N/A:errors, raises, modifies, requires
  27781.  
  27782. --version          : 0.0
  27783. --author           : Alex Wei
  27784. --initial release  : 05/13/85
  27785.  
  27786.   procedure AVERAGER(--:calculates the integer average value
  27787.                      NEW_AVERAGE    : out INTEGER; 
  27788.                                   --: the calculated average number
  27789.                      COUNT          : in POSITIVE; 
  27790.                                   --: the current number of element
  27791.                      CURRENT_VALUE  : in INTEGER; 
  27792.                                   --: the current element
  27793.                      PREVIOUS_VALUE : in INTEGER); 
  27794.                                   --: the previous average number
  27795. --:raises:
  27796. --:effects
  27797. --:calaulates the average value for an arbitrary number of integers
  27798.  
  27799. --:requires
  27800.  
  27801. --:N/A: modifies, errors
  27802.  
  27803. --:
  27804.   procedure AVERAGER(  --:calculates the long_integer average value
  27805.                      NEW_AVERAGE    : out LONG_INTEGER; 
  27806.                                   --: the calculated average number
  27807.                      COUNT          : in POSITIVE; 
  27808.                                   --: the current number of element
  27809.                      CURRENT_VALUE  : in LONG_INTEGER; 
  27810.                                   --: the current element
  27811.                      PREVIOUS_VALUE : in LONG_INTEGER); 
  27812.                                   --: the previous average number
  27813. --:raises:
  27814. --:effects
  27815. --:calaulates the average value for an arbitrary number of long_integers
  27816.  
  27817. --:requires
  27818.  
  27819. --:N/A: modifies, errors
  27820.  
  27821.   procedure AVERAGER(--:calculates the float average value
  27822.                      NEW_AVERAGE    : out FLOAT; 
  27823.                                   --: the calculated average number
  27824.                      COUNT          : in POSITIVE; 
  27825.                                   --: the current number of element
  27826.                      CURRENT_VALUE  : in FLOAT; 
  27827.                                   --: the current element
  27828.                      PREVIOUS_VALUE : in FLOAT); 
  27829.                                   --: the previous average number
  27830. --:raises:
  27831. --:effects
  27832. --:calaulates the average value for an arbitrary number of float elements
  27833.  
  27834. --:requires
  27835.  
  27836. --:N/A: modifies, errors
  27837.  
  27838.   procedure AVERAGER(--:calculates the long_float average value
  27839.                      NEW_AVERAGE    : out LONG_FLOAT; 
  27840.                                   --: the calculated average number
  27841.                      COUNT          : in POSITIVE; 
  27842.                                   --: the current number of element
  27843.                      CURRENT_VALUE  : in LONG_FLOAT; 
  27844.                                   --: the current element
  27845.                      PREVIOUS_VALUE : in LONG_FLOAT); 
  27846.                                   --: the previous average number
  27847. --:raises:
  27848. --:effects
  27849. --:calaulates the average value for an arbitrary number of long_float elements
  27850.  
  27851. --:requires
  27852.  
  27853. --:N/A: modifies, errors
  27854.  
  27855. --procedure averager( --:calculates the fixed_point average value
  27856. --                  new_average:  out fixed_point;
  27857. --                                --: the calculated average number
  27858. --                  count      :  in  positive;
  27859. --                                --: the current number of element
  27860. --              current_value  :  in  fixed_point;
  27861. --                                --: the current element
  27862. --             previous_value  :  in  fixed_point);
  27863.                                   --: the previous average number
  27864. --:raises:
  27865. --:effects
  27866. --:calaulates the average value for an arbitrary number of fixed_points
  27867.  
  27868. --:requires
  27869.  
  27870. --:N/A: modifies, errors
  27871.  
  27872. end AVERAGE; 
  27873. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27874. --AVERAGE.BDY
  27875. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27876.  
  27877. package body AVERAGE is 
  27878.  
  27879.   use TEXT_IO; 
  27880.   use IMPLEMENTATION_DEPENDENCIES; 
  27881.   use TYPE_DEFINITIONS; 
  27882.   procedure AVERAGER(NEW_AVERAGE    : out INTEGER; 
  27883.                      COUNT          : in POSITIVE; 
  27884.                      CURRENT_VALUE  : in INTEGER; 
  27885.                      PREVIOUS_VALUE : in INTEGER) is 
  27886.  
  27887.     TEMPORARY_VALUE : FLOAT := 0.0; 
  27888.  
  27889.   begin
  27890.     if COUNT > 1 then 
  27891.       TEMPORARY_VALUE := (FLOAT(PREVIOUS_VALUE)*FLOAT(COUNT - 1)) + FLOAT(
  27892.         CURRENT_VALUE); 
  27893.       NEW_AVERAGE := INTEGER(TEMPORARY_VALUE/FLOAT(COUNT)); 
  27894.     elsif COUNT = 1 then 
  27895.       NEW_AVERAGE := CURRENT_VALUE; 
  27896.     end if; 
  27897.   end AVERAGER; 
  27898. --
  27899.  
  27900.   procedure AVERAGER(NEW_AVERAGE    : out LONG_INTEGER; 
  27901.                      COUNT          : in POSITIVE; 
  27902.                      CURRENT_VALUE  : in LONG_INTEGER; 
  27903.                      PREVIOUS_VALUE : in LONG_INTEGER) is 
  27904.  
  27905.     TEMPORARY_VALUE : FLOAT := 0.0; 
  27906.  
  27907.   begin
  27908.     if COUNT > 1 then 
  27909.       TEMPORARY_VALUE := (FLOAT(PREVIOUS_VALUE)*FLOAT(COUNT - 1)) + FLOAT(
  27910.         CURRENT_VALUE); 
  27911.       NEW_AVERAGE := LONG_INTEGER(TEMPORARY_VALUE/FLOAT(COUNT)); 
  27912.     elsif COUNT = 1 then 
  27913.       NEW_AVERAGE := CURRENT_VALUE; 
  27914.     end if; 
  27915.   end AVERAGER; 
  27916.  
  27917.  
  27918.   procedure AVERAGER(NEW_AVERAGE    : out FLOAT; 
  27919.                      COUNT          : in POSITIVE; 
  27920.                      CURRENT_VALUE  : in FLOAT; 
  27921.                      PREVIOUS_VALUE : in FLOAT) is 
  27922.  
  27923.     TEMPORARY_VALUE : FLOAT := 0.0; 
  27924.  
  27925.   begin
  27926.     if COUNT > 1 then 
  27927.       TEMPORARY_VALUE := (PREVIOUS_VALUE*(FLOAT(COUNT) - 1.0)) + CURRENT_VALUE; 
  27928.       NEW_AVERAGE := TEMPORARY_VALUE/FLOAT(COUNT); 
  27929.     elsif COUNT = 1 then 
  27930.       NEW_AVERAGE := CURRENT_VALUE; 
  27931.     end if; 
  27932.   end AVERAGER; 
  27933.  
  27934.  
  27935.   procedure AVERAGER(NEW_AVERAGE    : out LONG_FLOAT; 
  27936.                      COUNT          : in POSITIVE; 
  27937.                      CURRENT_VALUE  : in LONG_FLOAT; 
  27938.                      PREVIOUS_VALUE : in LONG_FLOAT) is 
  27939.  
  27940.     TEMPORARY_VALUE : LONG_FLOAT := 0.0; 
  27941.  
  27942.   begin
  27943.     if COUNT > 1 then 
  27944.       TEMPORARY_VALUE := (PREVIOUS_VALUE*(LONG_FLOAT(COUNT) - 1.0)) + 
  27945.         CURRENT_VALUE; 
  27946.       NEW_AVERAGE := TEMPORARY_VALUE/LONG_FLOAT(COUNT); 
  27947.     elsif COUNT = 1 then 
  27948.       NEW_AVERAGE := CURRENT_VALUE; 
  27949.     end if; 
  27950.   end AVERAGER; 
  27951.  
  27952. --procedure averager(new_average:  out fixed_point;
  27953. --                  count      :  in  positive;
  27954. --              current_value  :  in  fixed_point;
  27955. --             previous_value  :  in  fixed_point) is
  27956. --
  27957. --temporary_value:  fixed_point;
  27958.  
  27959. --begin
  27960. --if count > 1  then
  27961. --temporary_value:= previous_value  * (fixed_point(count) - 1.0 );
  27962. --temporary_value:= temporary_value + current_value;
  27963. --new_average:= temporary_value / fixed_point(count);
  27964. --elsif count = 1 then
  27965. --new_average:= current_value;
  27966. --end if;
  27967. --end averager;
  27968.  
  27969. end AVERAGE; 
  27970. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27971. --VARHAND.SPC
  27972. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27973. with TEXT_IO; 
  27974. with DYNARRAY_PKG; 
  27975. with TYPE_DEFINITIONS, IMPLEMENTATION_DEPENDENCIES; 
  27976. with STRING_PKG; 
  27977.  
  27978. package VARHAND is 
  27979.  
  27980. --| overview
  27981. --| VARiableHANDler is a package to handle the initialization, assignment,
  27982. --| and other operations of variable record arrays.  it also defines all
  27983. --| variable related types.
  27984.  
  27985. --| n/a: errors, raises, modifies, requires
  27986.  
  27987. --version:             0.0
  27988. --author:              Alexis Wei
  27989. --initial release:     05/14/85
  27990.  
  27991.   use TYPE_DEFINITIONS, IMPLEMENTATION_DEPENDENCIES; 
  27992.  
  27993.   subtype VARIABLE_KIND is LOGFILE_KEYS range INTEGER_VARIABLE .. 
  27994.     FIXED_POINT_VARIABLE; 
  27995.  
  27996.   type VARIABLE_RECORD(WHICHKIND : VARIABLE_KIND) is 
  27997.     record
  27998.       PROGRAMID     : PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  27999.       VARIABLENAME  : FILENAME; 
  28000.       UNITNAME      : FILENAME; 
  28001.       VARIABLECOUNT : POSITIVE; 
  28002.       case WHICHKIND is 
  28003.         when INTEGER_VARIABLE => 
  28004.           CURRENT_V : INTEGER; 
  28005.           MAX_V     : INTEGER; 
  28006.           MIN_V     : INTEGER; 
  28007.           AVERAGE_V : INTEGER; 
  28008.  
  28009.         when FLOAT_VARIABLE => 
  28010.           CURRENT_FV : FLOAT; 
  28011.           MAX_FV     : FLOAT; 
  28012.           MIN_FV     : FLOAT; 
  28013.           AVERAGE_FV : FLOAT; 
  28014.  
  28015.         when LONG_INTEGER_VARIABLE => 
  28016.           CURRENT_LIV : LONG_INTEGER; 
  28017.           MAX_LIV     : LONG_INTEGER; 
  28018.           MIN_LIV     : LONG_INTEGER; 
  28019.           AVERAGE_LIV : LONG_INTEGER; 
  28020.  
  28021.  
  28022.         when LONG_FLOAT_VARIABLE => 
  28023.           CURRENT_LFV : LONG_FLOAT; 
  28024.           MAX_LFV     : LONG_FLOAT; 
  28025.           MIN_LFV     : LONG_FLOAT; 
  28026.           AVERAGE_LFV : LONG_FLOAT; 
  28027.  
  28028. -- when fixed_point_variable =>
  28029. -- current_fpv:       fixed_point;
  28030. -- max_fpv:           fixed_point;
  28031. -- min_fpv:           fixed_point;
  28032. -- average_fpv:       fixed_point;
  28033.  
  28034.         when others => 
  28035.           null; 
  28036.       end case; 
  28037.     end record; 
  28038.  
  28039.   type LOOP_RECORD is 
  28040.     record
  28041.       PROGRAMID  : PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28042.       BRKPT_NO   : BREAKPOINT_NUMBER_RANGE; 
  28043.       BRKPTCOUNT : POSITIVE; 
  28044.       UNITNAME   : FILENAME; 
  28045.     end record; 
  28046.  
  28047.   subtype IVRECORD is VARIABLE_RECORD(INTEGER_VARIABLE); 
  28048.   subtype LIVRECORD is VARIABLE_RECORD(LONG_INTEGER_VARIABLE); 
  28049.   subtype FVRECORD is VARIABLE_RECORD(FLOAT_VARIABLE); 
  28050.   subtype LFVRECORD is VARIABLE_RECORD(LONG_FLOAT_VARIABLE); 
  28051.  
  28052.   package IVDARRAY_PKG is 
  28053.     new DYNARRAY_PKG(IVRECORD); 
  28054.   use IVDARRAY_PKG; 
  28055.   package LIVDARRAY_PKG is 
  28056.     new DYNARRAY_PKG(LIVRECORD); 
  28057.   use LIVDARRAY_PKG; 
  28058.   package FVDARRAY_PKG is 
  28059.     new DYNARRAY_PKG(FVRECORD); 
  28060.   use FVDARRAY_PKG; 
  28061.   package LFVDARRAY_PKG is 
  28062.     new DYNARRAY_PKG(LFVRECORD); 
  28063.   use LFVDARRAY_PKG; 
  28064.  
  28065.  
  28066.   procedure INITARRAY( --| to initialize the 1st element of variable array
  28067.                       IVARRAY  : in out IVRECORD; 
  28068.                       IDARRAY  : in out IVDARRAY_PKG.DARRAY; 
  28069.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28070.                       VNAME    : in FILENAME; 
  28071.                       UNITNAME : in FILENAME; 
  28072.                       VALUE    : in INTEGER; 
  28073.                       KUNT     : in NATURAL); 
  28074.  
  28075.  
  28076.   procedure INITARRAY( --| to initialize the 1st element of variable array
  28077.                       LIVARRAY : in out LIVRECORD; 
  28078.                       LIDARRAY : in out LIVDARRAY_PKG.DARRAY; 
  28079.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28080.                       VNAME    : in FILENAME; 
  28081.                       UNITNAME : in FILENAME; 
  28082.                       VALUE    : in LONG_INTEGER; 
  28083.                       KUNT     : in NATURAL); 
  28084.  
  28085.  
  28086.   procedure INITARRAY( --| to initialize the 1st element of variable array
  28087.                       FVARRAY  : in out FVRECORD; 
  28088.                       FDARRAY  : in out FVDARRAY_PKG.DARRAY; 
  28089.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28090.                       VNAME    : in FILENAME; 
  28091.                       UNITNAME : in FILENAME; 
  28092.                       VALUE    : in FLOAT; 
  28093.                       KUNT     : in NATURAL); 
  28094.  
  28095.  
  28096.   procedure INITARRAY( --| to initialize the 1st element of variable array
  28097.                       LFVARRAY : in out LFVRECORD; 
  28098.                       LFDARRAY : in out LFVDARRAY_PKG.DARRAY; 
  28099.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28100.                       VNAME    : in FILENAME; 
  28101.                       UNITNAME : in FILENAME; 
  28102.                       VALUE    : in LONG_FLOAT; 
  28103.                       KUNT     : in NATURAL); 
  28104.  
  28105.  
  28106. --procedure initarray (--| to initialize the 1st element of variable array
  28107. --                     fparray:            in out fpvrecord;
  28108. --                     fpdarray:           in out fpvdarray_pkg.darray;
  28109. --                     pid:                in program_unit_unique_identifier;
  28110. --                     vname:              in filename;
  28111. --                     unitname:           in filename;
  28112. --                     value:              in fixed_point;
  28113. --                     kunt:               in natural);
  28114.  
  28115.   procedure FIND_VARIABLE(--| check to see if the variable read is an
  28116.                           --| existing variable, it also return the
  28117.                           --| array index if found
  28118.                           PID     : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28119.                           IDARRAY : in out IVDARRAY_PKG.DARRAY; 
  28120.                           IVARRAY : in out IVRECORD; 
  28121.                           VNAME   : in FILENAME; 
  28122.                           KUNT    : in NATURAL; 
  28123.                           IDX     : out NATURAL; 
  28124.                           FOUND   : out BOOLEAN); 
  28125.  
  28126.   procedure FIND_VARIABLE(--| check to see if the variable read is an
  28127.                           --| existing variable, it also return the
  28128.                           --| array index if found
  28129.                           PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28130.                           LIDARRAY : in out LIVDARRAY_PKG.DARRAY; 
  28131.                           LIVARRAY : in out LIVRECORD; 
  28132.                           VNAME    : in FILENAME; 
  28133.                           KUNT     : in NATURAL; 
  28134.                           IDX      : out NATURAL; 
  28135.                           FOUND    : out BOOLEAN); 
  28136.  
  28137.   procedure FIND_VARIABLE(--| check to see if the variable read is an
  28138.                           --| existing variable, it also return the
  28139.                           --| array index if found
  28140.                           PID     : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28141.                           FDARRAY : in out FVDARRAY_PKG.DARRAY; 
  28142.                           FVARRAY : in out FVRECORD; 
  28143.                           VNAME   : in FILENAME; 
  28144.                           KUNT    : in NATURAL; 
  28145.                           IDX     : out NATURAL; 
  28146.                           FOUND   : out BOOLEAN); 
  28147.  
  28148.   procedure FIND_VARIABLE(--| check to see if the variable read is an
  28149.                           --| existing variable, it also return the
  28150.                           --| array index if found
  28151.                           PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28152.                           LFDARRAY : in out LFVDARRAY_PKG.DARRAY; 
  28153.                           LFVARRAY : in out LFVRECORD; 
  28154.                           VNAME    : in FILENAME; 
  28155.                           KUNT     : in NATURAL; 
  28156.                           IDX      : out NATURAL; 
  28157.                           FOUND    : out BOOLEAN); 
  28158.  
  28159. --procedure find_variable(--| check to see if the variable read is an --janus
  28160. --                        --| existing variable, it also return the   --janus
  28161. --                        --| array index if found                    --janus
  28162. --                        pid:             in     program_unit_unique_identifier;
  28163. --                        fpdarray:        in out fpdarray_pkg.darray;
  28164. --                        fparray:         in out variable_record(fixed_point_variable);
  28165. --                        vname:           in filename;
  28166. --                        kunt:            in natural;
  28167. --                        idx:             out natural;
  28168. --                        found:           out boolean);
  28169.  
  28170.  
  28171.   procedure FIND_MAXMIN(IVARRAY : in out IVRECORD; 
  28172.                         IDARRAY : in out IVDARRAY_PKG.DARRAY; 
  28173.                         IDX     : in NATURAL; 
  28174.                         VALUE   : in INTEGER); 
  28175.  
  28176.  
  28177.   procedure FIND_MAXMIN(LIVARRAY : in out LIVRECORD; 
  28178.                         LIDARRAY : in out LIVDARRAY_PKG.DARRAY; 
  28179.                         IDX      : in NATURAL; 
  28180.                         VALUE    : in LONG_INTEGER); 
  28181.  
  28182.  
  28183.   procedure FIND_MAXMIN(FVARRAY : in out FVRECORD; 
  28184.                         FDARRAY : in out FVDARRAY_PKG.DARRAY; 
  28185.                         IDX     : in NATURAL; 
  28186.                         VALUE   : in FLOAT); 
  28187.  
  28188.  
  28189.  
  28190.   procedure FIND_MAXMIN(LFVARRAY : in out LFVRECORD; 
  28191.                         LFDARRAY : in out LFVDARRAY_PKG.DARRAY; 
  28192.                         IDX      : in NATURAL; 
  28193.                         VALUE    : in LONG_FLOAT); 
  28194.  
  28195.  
  28196. --procedure find_maxmin(
  28197. --                        fpvarray:        in out variable_record(fixed_point_variable);
  28198. --                        fpdarray:        in out fpvdarray_pkg.darray;
  28199. --                        idx:             in natural;
  28200. --                        value:           in fixed_point);
  28201.  
  28202.  
  28203. function LAST_VALUE( --| Return the last value of the string variable
  28204.   UNIT_ID       : PROGRAM_UNIT_UNIQUE_IDENTIFIER;
  28205.   VARIABLE_NAME : ADA_NAME;
  28206.   CURRENT_VALUE : STRING_VARIABLES
  28207.   ) return string;
  28208.  
  28209. --| Effects
  28210. --| Searches the String_Variable_Array for the last value of
  28211. --| the specified string variable. If it is the first occurrence
  28212. --| of the string variable then it is added to the array and
  28213. --| a null String_Type is returned. Otherwise the last value
  28214. --| stored in the array for the string variable is returned.
  28215. --| If the current value of the string variable is different
  28216. --| than the previous value then the array is updated with the
  28217. --| new current value.
  28218.  
  28219. --| Modifies
  28220. --| If it is the first occurrence of the string value of the string
  28221. --| variable of if the current value is different than the previous
  28222. --| value then the String_Array is updated
  28223.  
  28224. --| N/A: Raises, Requires, Errors
  28225.  
  28226.  
  28227.   function LONG_INTEGER_TO_STR(
  28228.     LINT  : LONG_INTEGER;
  28229.     WIDTH : NATURAL := 0
  28230.     ) return STRING; 
  28231.  
  28232.   function FLOAT_TO_STR(
  28233.     FLO   : FLOAT;
  28234.     WIDTH : NATURAL := 0
  28235.     ) return STRING; 
  28236.  
  28237.   function LONG_FLOAT_TO_STR(
  28238.     LFLO  : LONG_FLOAT;
  28239.     WIDTH : NATURAL := 0
  28240.     ) return STRING; 
  28241.  
  28242. end VARHAND; 
  28243. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28244. --VARHAND.BDY
  28245. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28246.  
  28247.  
  28248.  
  28249.  
  28250.  
  28251. package body VARHAND is 
  28252.  
  28253. --| overview
  28254. --| VARiableHANDler is a package to handle the initialization, assignment,
  28255. --| and other operations of variable record arrays.  it also defines all
  28256. --| variable related types.
  28257.  
  28258. --| n/a: errors, raises, modifies, requires
  28259.  
  28260. --version:             0.0
  28261. --author:              Alexis Wei
  28262. --initial release:     05/14/85
  28263.  
  28264.   use IMPLEMENTATION_DEPENDENCIES; 
  28265.   use TYPE_DEFINITIONS; 
  28266.   use TEXT_IO; 
  28267.   use STRING_PKG; 
  28268.   use IVDARRAY_PKG; 
  28269.   use LIVDARRAY_PKG; 
  28270.   use FVDARRAY_PKG; 
  28271.   use LFVDARRAY_PKG; 
  28272.  
  28273.   package FLO_IO is 
  28274.     new FLOAT_IO(FLOAT); 
  28275.   package LFLO_IO is 
  28276.     new FLOAT_IO(LONG_FLOAT); 
  28277.   package INT_IO is 
  28278.     new TEXT_IO.INTEGER_IO(INTEGER); 
  28279.   package LINT_IO is 
  28280.     new TEXT_IO.INTEGER_IO(LONG_INTEGER); 
  28281.  
  28282.  
  28283.   type STRING_VARIABLE_ARRAY_ELEMENTS is
  28284.     record
  28285.       UNIT_ID       : PROGRAM_UNIT_UNIQUE_IDENTIFIER;
  28286.       VARIABLE_NAME : ADA_NAME;
  28287.       VALUE         : STRING_VARIABLES;
  28288.     end record;
  28289.  
  28290.   package STRING_VARIABLE_ARRAY_PKG is
  28291.     new DYNARRAY_PKG(STRING_VARIABLE_ARRAY_ELEMENTS);
  28292.  
  28293.   STRING_VARIABLE_ARRAY : STRING_VARIABLE_ARRAY_PKG.DARRAY;
  28294.  
  28295.   FIRST_STRING_VARIABLE : boolean := TRUE;
  28296.  
  28297.   procedure INITARRAY(IVARRAY  : in out IVRECORD; 
  28298.                       IDARRAY  : in out IVDARRAY_PKG.DARRAY; 
  28299.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28300.                       VNAME    : in FILENAME; 
  28301.                       UNITNAME : in FILENAME; 
  28302.                       VALUE    : in INTEGER; 
  28303.                       KUNT     : in NATURAL) is 
  28304.  
  28305.   begin
  28306.     IVARRAY.PROGRAMID     := PID; 
  28307.     IVARRAY.VARIABLENAME  := VNAME; 
  28308.     IVARRAY.UNITNAME      := UNITNAME; 
  28309.     IVARRAY.CURRENT_V     := VALUE; 
  28310.     IVARRAY.VARIABLECOUNT := 1; 
  28311.     IVARRAY.MAX_V         := VALUE; 
  28312.     IVARRAY.MIN_V         := VALUE; 
  28313.     IVARRAY.AVERAGE_V     := VALUE; 
  28314.     ADD_HIGH(IDARRAY, IVARRAY); 
  28315.   end INITARRAY; 
  28316.  
  28317.  
  28318.  
  28319.  
  28320.   procedure INITARRAY(LIVARRAY : in out LIVRECORD; 
  28321.                       LIDARRAY : in out LIVDARRAY_PKG.DARRAY; 
  28322.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28323.                       VNAME    : in FILENAME; 
  28324.                       UNITNAME : in FILENAME; 
  28325.                       VALUE    : in LONG_INTEGER; 
  28326.                       KUNT     : in NATURAL) is 
  28327.  
  28328.  
  28329.   begin
  28330.     LIVARRAY.PROGRAMID     := PID; 
  28331.     LIVARRAY.VARIABLENAME  := VNAME; 
  28332.     LIVARRAY.UNITNAME      := UNITNAME; 
  28333.     LIVARRAY.CURRENT_LIV   := VALUE; 
  28334.     LIVARRAY.VARIABLECOUNT := 1; 
  28335.     LIVARRAY.MAX_LIV       := VALUE; 
  28336.     LIVARRAY.MIN_LIV       := VALUE; 
  28337.     LIVARRAY.AVERAGE_LIV   := VALUE; 
  28338.     ADD_HIGH(LIDARRAY, LIVARRAY); 
  28339.   end INITARRAY; 
  28340.  
  28341.  
  28342.   procedure INITARRAY(FVARRAY  : in out FVRECORD; 
  28343.                       FDARRAY  : in out FVDARRAY_PKG.DARRAY; 
  28344.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28345.                       VNAME    : in FILENAME; 
  28346.                       UNITNAME : in FILENAME; 
  28347.                       VALUE    : in FLOAT; 
  28348.                       KUNT     : in NATURAL) is 
  28349.  
  28350.  
  28351.   begin
  28352.     FVARRAY.PROGRAMID     := PID; 
  28353.     FVARRAY.VARIABLENAME  := VNAME; 
  28354.     FVARRAY.UNITNAME      := UNITNAME; 
  28355.     FVARRAY.CURRENT_FV    := VALUE; 
  28356.     FVARRAY.VARIABLECOUNT := 1; 
  28357.     FVARRAY.MAX_FV        := VALUE; 
  28358.     FVARRAY.MIN_FV        := VALUE; 
  28359.     FVARRAY.AVERAGE_FV    := VALUE; 
  28360.     ADD_HIGH(FDARRAY, FVARRAY); 
  28361.   end INITARRAY; 
  28362.  
  28363.  
  28364.   procedure INITARRAY(LFVARRAY : in out LFVRECORD; 
  28365.                       LFDARRAY : in out LFVDARRAY_PKG.DARRAY; 
  28366.                       PID      : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28367.                       VNAME    : in FILENAME; 
  28368.                       UNITNAME : in FILENAME; 
  28369.                       VALUE    : in LONG_FLOAT; 
  28370.                       KUNT     : in NATURAL) is 
  28371.  
  28372.  
  28373.   begin
  28374.     LFVARRAY.PROGRAMID     := PID; 
  28375.     LFVARRAY.VARIABLENAME  := VNAME; 
  28376.     LFVARRAY.UNITNAME      := UNITNAME; 
  28377.     LFVARRAY.CURRENT_LFV   := VALUE; 
  28378.     LFVARRAY.VARIABLECOUNT := 1; 
  28379.     LFVARRAY.MAX_LFV       := VALUE; 
  28380.     LFVARRAY.MIN_LFV       := VALUE; 
  28381.     LFVARRAY.AVERAGE_LFV   := VALUE; 
  28382.     ADD_HIGH(LFDARRAY, LFVARRAY); 
  28383.   end INITARRAY; 
  28384.  
  28385.  
  28386. --procedure initarray (fparray:            in out fpvrecord;
  28387. --                     fpdarray:           in out fpvdarray_pkg.darray;
  28388. --                     pid:                in program_unit_unique_identifier;
  28389. --                     vname:              in filename;
  28390. --                     unitname:           in filename;
  28391. --                     value:              in fixed_point;
  28392. --                     kunt:               in natural) is
  28393. --
  28394. --
  28395. --begin
  28396. -- fparray.programid := pid;
  28397. -- fparray.variablename := vname;
  28398. -- fparray.unitname := unitname;
  28399. -- fparray.current_fpv := value;
  28400. -- fparray.variablecount := 1;
  28401. -- fparray.max_fpv := value;
  28402. -- fparray.min_fpv := value;
  28403. -- fparray.average_fpv := value;
  28404. -- add_high (fpdarray, fparray);
  28405. --end initarray;                                   
  28406.  
  28407.  
  28408.   procedure FIND_VARIABLE(PID     : in PROGRAM_UNIT_UNIQUE_IDENTIFIER; 
  28409.                           IDARRAY : in out IVDARRAY_PKG.DARRAY; 
  28410.                           IVARRAY : in out IVRECORD; 
  28411.                           VNAME   : in FILENAME; 
  28412.                           KUNT    : in NATURAL; 
  28413.                           IDX     : out NATURAL; 
  28414.                           FOUND   : out BOOLEAN) is 
  28415.  
  28416.  
  28417.   begin
  28418.     FOUND := FALSE; 
  28419.     IDX   := 0; 
  28420.     SEARCH_LOOP : for I in INTEGER range 1 .. KUNT loop
  28421.       IVARRAY := FETCH(IDARRAY, I); 
  28422.       if (IVARRAY.PROGRAMID.PROGRAM_UNIT_NUMBER = PID.PROGRAM_UNIT_NUMBER) and 
  28423.         EQUAL(IVARRAY.VARIABLENAME, VN