home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / debug / sd.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  868.2 KB  |  23,053 lines

  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.     DEC_S : CONSTR_STR := S;
  2072.   begin
  2073.     if S = "" then 
  2074.       return null; 
  2075.     else 
  2076.       return new CONSTR_STR'(DEC_S); 
  2077.     end if; 
  2078.   end MAKE_PERSISTENT; 
  2079.  
  2080.   procedure REAL_FLUSH is 
  2081.     new UNCHECKED_DEALLOCATION(STRING, STRING_TYPE); 
  2082.     --| Effect:
  2083.     --| Return space used by argument to heap.  Does nothing if null.
  2084.     --| Notes:
  2085.     --| This procedure is actually the body for the flush procedure,
  2086.     --| but a generic instantiation cannot be used as a body for another
  2087.     --| procedure.  You tell me why.
  2088.  
  2089.   procedure FLUSH(S : in out STRING_TYPE) is 
  2090.   begin
  2091.     if S /= null then 
  2092.       REAL_FLUSH(S); 
  2093.     end if; 
  2094.  
  2095.   -- Actually, the if isn't needed; however, DECada compiler chokes
  2096.   -- on deallocation of null.
  2097.   end FLUSH; 
  2098.  
  2099.   procedure MARK is 
  2100.   begin
  2101.     PUSH(SCOPES, new STRING_LIST'(CREATE)); 
  2102.   end MARK; 
  2103.  
  2104.   procedure RELEASE is 
  2105.     procedure FLUSH_LIST_PTR is 
  2106.       new UNCHECKED_DEALLOCATION(STRING_LIST, STRING_LIST_PTR); 
  2107.     ITER     : STRING_LIST_PKG.LISTITER; 
  2108.     TOP_LIST : STRING_LIST_PTR; 
  2109.     S        : STRING_TYPE; 
  2110.   begin
  2111.     POP(SCOPES, TOP_LIST); 
  2112.     ITER := MAKELISTITER(TOP_LIST.all); 
  2113.     while MORE(ITER) loop
  2114.       NEXT(ITER, S); 
  2115.       begin
  2116.         FLUSH(S); 
  2117.       exception
  2118.         -- to prevent program error when trying to flush unpersistent strings
  2119.         -- 1-16-86
  2120.         when others => null;
  2121.       end;
  2122.     -- real_flush is bad, DECada bug
  2123.     --          real_flush(s);            
  2124.     end loop; 
  2125.     DESTROY(TOP_LIST.all); 
  2126.     FLUSH_LIST_PTR(TOP_LIST); 
  2127.   exception
  2128.     when EMPTY_STACK => 
  2129.       raise ILLEGAL_DEALLOC; 
  2130.   end RELEASE; 
  2131.  
  2132.  
  2133.   -- Queries:
  2134.  
  2135.   function IS_EMPTY(S : in STRING_TYPE) return BOOLEAN is 
  2136.   begin
  2137.     return (S = null) or else (S.all = ""); 
  2138.   end IS_EMPTY; 
  2139.  
  2140.   function LENGTH(S : in STRING_TYPE) return NATURAL is 
  2141.   begin
  2142.     if S = null then 
  2143.       return 0; 
  2144.     end if; 
  2145.     return (S.all'LENGTH); 
  2146.   end LENGTH; 
  2147.  
  2148.   function VALUE(S : in STRING_TYPE) return STRING is 
  2149.     subtype NULL_RANGE is POSITIVE range 1 .. 0; 
  2150.     subtype NULL_STRING is STRING(NULL_RANGE); 
  2151.   begin
  2152.     if S = null then 
  2153.       return NULL_STRING'(""); 
  2154.     end if; 
  2155.     return S.all; 
  2156.   end VALUE; 
  2157.  
  2158.   function FETCH(S : in STRING_TYPE; 
  2159.                  I : in POSITIVE) return CHARACTER is 
  2160.   begin
  2161.     if IS_EMPTY(S) or else (not (I in S'range )) then 
  2162.       raise BOUNDS; 
  2163.     end if; 
  2164.     return S(I); 
  2165.   end FETCH; 
  2166.  
  2167.   function EQUAL(S1, S2 : in STRING_TYPE) return BOOLEAN is 
  2168.   begin
  2169.     if IS_EMPTY(S1) then 
  2170.       return IS_EMPTY(S2); 
  2171.     end if; 
  2172.     return (S2 /= null) and then (S1.all = S2.all); 
  2173.  
  2174.   -- The above code replaces the following.  (DECada buggy)
  2175.   --        return s1.all = s2.all;
  2176.   --    exception
  2177.   --    when constraint_error =>     -- s is null
  2178.   --        return is_empty(s1) and is_empty(s2);
  2179.   end EQUAL; 
  2180.  
  2181.   function EQUAL(S1 : in STRING_TYPE; 
  2182.                  S2 : in STRING) return BOOLEAN is 
  2183.   begin
  2184.     if S1 = null then 
  2185.       return S2 = ""; 
  2186.     end if; 
  2187.     return S1.all = S2; 
  2188.   end EQUAL; 
  2189.  
  2190.   function EQUAL(S1 : in STRING; 
  2191.                  S2 : in STRING_TYPE) return BOOLEAN is 
  2192.   begin
  2193.     if S2 = null then 
  2194.       return S1 = ""; 
  2195.     end if; 
  2196.     return S1 = S2.all; 
  2197.   end EQUAL; 
  2198.  
  2199.   function "<"(S1 : in STRING_TYPE; 
  2200.                S2 : in STRING_TYPE) return BOOLEAN is 
  2201.   begin
  2202.     if IS_EMPTY(S1) then 
  2203.       return (not IS_EMPTY(S2)); 
  2204.     else 
  2205.       return (S1.all < S2); 
  2206.     end if; 
  2207.  
  2208.   -- Got rid of the following code:  (Think that DECada is buggy)
  2209.   --return s1.all < s2.all; 
  2210.   --exception
  2211.   --when constraint_error =>   -- on null deref
  2212.   --return (not is_empty(s2)); 
  2213.   -- one of them must be empty
  2214.   end "<"; 
  2215.  
  2216.   function "<"(S1 : in STRING_TYPE; 
  2217.                S2 : in STRING) return BOOLEAN is 
  2218.   begin
  2219.     if S1 = null then 
  2220.       return S2 /= ""; 
  2221.     end if; 
  2222.     return S1.all < S2; 
  2223.   end "<"; 
  2224.  
  2225.   function "<"(S1 : in STRING; 
  2226.                S2 : in STRING_TYPE) return BOOLEAN is 
  2227.   begin
  2228.     if S2 = null then 
  2229.       return FALSE; 
  2230.     end if; 
  2231.     return S1 < S2.all; 
  2232.   end "<"; 
  2233.  
  2234.   function "<="(S1 : in STRING_TYPE; 
  2235.                 S2 : in STRING_TYPE) return BOOLEAN is 
  2236.   begin
  2237.     if IS_EMPTY(S1) then 
  2238.       return TRUE; 
  2239.     end if; 
  2240.     return (S1.all <= S2); 
  2241.  
  2242.   -- Replaces the following:  (I think DECada is buggy)
  2243.   --return s1.all <= s2.all; 
  2244.   --exception
  2245.   --when constraint_error =>   -- on null deref
  2246.   --return is_empty(s1);   -- one must be empty, so s1<=s2 iff s1 = ""
  2247.   end "<="; 
  2248.  
  2249.   function "<="(S1 : in STRING_TYPE; 
  2250.                 S2 : in STRING) return BOOLEAN is 
  2251.   begin
  2252.     if S1 = null then 
  2253.       return TRUE; 
  2254.     end if; 
  2255.     return S1.all <= S2; 
  2256.   end "<="; 
  2257.  
  2258.   function "<="(S1 : in STRING; 
  2259.                 S2 : in STRING_TYPE) return BOOLEAN is 
  2260.   begin
  2261.     if S2 = null then 
  2262.       return S1 = ""; 
  2263.     end if; 
  2264.     return S1 <= S2.all; 
  2265.   end "<="; 
  2266.  
  2267.   function MATCH_C(S     : in STRING_TYPE; 
  2268.                    C     : in CHARACTER; 
  2269.                    START : in POSITIVE := 1) return NATURAL is 
  2270.   begin
  2271.     if S = null then 
  2272.       return 0; 
  2273.     end if; 
  2274.     for I in START .. S.all'LAST loop
  2275.       if S(I) = C then 
  2276.         return I; 
  2277.       end if; 
  2278.     end loop; 
  2279.     return 0; 
  2280.   end MATCH_C; 
  2281.  
  2282.   function MATCH_NOT_C(S     : in STRING_TYPE; 
  2283.                        C     : in CHARACTER; 
  2284.                        START : in POSITIVE := 1) return NATURAL is 
  2285.   begin
  2286.     if S = null then 
  2287.       return 0; 
  2288.     end if; 
  2289.     for I in START .. S.all'LAST loop
  2290.       if S(I) /= C then 
  2291.         return I; 
  2292.       end if; 
  2293.     end loop; 
  2294.     return 0; 
  2295.   end MATCH_NOT_C; 
  2296.  
  2297.   function MATCH_S(S1, S2 : in STRING_TYPE; 
  2298.                    START  : in POSITIVE := 1) return NATURAL is 
  2299.   begin
  2300.     if (S1 = null) or else (S2 = null) then 
  2301.       return 0; 
  2302.     end if; 
  2303.     return MATCH_STRING(S1.all, S2.all, START); 
  2304.   end MATCH_S; 
  2305.  
  2306.   function MATCH_S(S1    : in STRING_TYPE; 
  2307.                    S2    : in STRING; 
  2308.                    START : in POSITIVE := 1) return NATURAL is 
  2309.   begin
  2310.     if S1 = null then 
  2311.       return 0; 
  2312.     end if; 
  2313.     return MATCH_STRING(S1.all, S2, START); 
  2314.   end MATCH_S; 
  2315.  
  2316.   function MATCH_ANY(S, ANY : in STRING_TYPE; 
  2317.                      START  : in POSITIVE := 1) return NATURAL is 
  2318.   begin
  2319.     if ANY = null then 
  2320.       raise ANY_EMPTY; 
  2321.     end if; 
  2322.     return MATCH_ANY(S, ANY.all, START); 
  2323.   end MATCH_ANY; 
  2324.  
  2325.   function MATCH_ANY(S     : in STRING_TYPE; 
  2326.                      ANY   : in STRING; 
  2327.                      START : in POSITIVE := 1) return NATURAL is 
  2328.   begin
  2329.     if ANY = "" then 
  2330.       raise ANY_EMPTY; 
  2331.     end if; 
  2332.     if S = null then 
  2333.       return 0; 
  2334.     end if; 
  2335.  
  2336.     for I in START .. S.all'LAST loop
  2337.       for J in ANY'range loop
  2338.         if S(I) = ANY(J) then 
  2339.           return I; 
  2340.         end if; 
  2341.       end loop; 
  2342.     end loop; 
  2343.     return 0; 
  2344.   end MATCH_ANY; 
  2345.  
  2346.   function MATCH_NONE(S, NONE : in STRING_TYPE; 
  2347.                       START   : in POSITIVE := 1) return NATURAL is 
  2348.   begin
  2349.     if IS_EMPTY(S) then 
  2350.       return 0; 
  2351.     end if; 
  2352.     if IS_EMPTY(NONE) then 
  2353.       return 1; 
  2354.     end if; 
  2355.  
  2356.     return MATCH_NONE(S, NONE.all, START); 
  2357.   end MATCH_NONE; 
  2358.  
  2359.   function MATCH_NONE(S     : in STRING_TYPE; 
  2360.                       NONE  : in STRING; 
  2361.                       START : in POSITIVE := 1) return NATURAL is 
  2362.     FOUND : BOOLEAN; 
  2363.   begin
  2364.     if IS_EMPTY(S) then 
  2365.       return 0; 
  2366.     end if; 
  2367.  
  2368.     for I in START .. S.all'LAST loop
  2369.       FOUND := TRUE; 
  2370.       for J in NONE'range loop
  2371.         if S(I) = NONE(J) then 
  2372.           FOUND := FALSE; 
  2373.           exit; 
  2374.         end if; 
  2375.       end loop; 
  2376.       if FOUND then 
  2377.         return I; 
  2378.       end if; 
  2379.     end loop; 
  2380.     return 0; 
  2381.   end MATCH_NONE; 
  2382.  
  2383.  
  2384.   -- Utilities:
  2385.  
  2386.   function ENTER(S : in STRING_TYPE) return STRING_TYPE is 
  2387.   begin
  2388.     TOP(SCOPES).all := ATTACH(TOP(SCOPES).all, S); 
  2389.     return S; 
  2390.   exception
  2391.     when EMPTY_STACK => 
  2392.       raise ILLEGAL_ALLOC; 
  2393.   end ENTER; 
  2394.  
  2395.   function MATCH_STRING(S1, S2 : in STRING; 
  2396.                         START  : in POSITIVE := 1) return NATURAL is 
  2397.     OFFSET : NATURAL; 
  2398.   begin
  2399.     OFFSET := S2'LENGTH - 1; 
  2400.     for I in START .. (S1'LAST - OFFSET) loop
  2401.       if S1(I .. (I + OFFSET)) = S2 then 
  2402.         return I; 
  2403.       end if; 
  2404.     end loop; 
  2405.     return 0; 
  2406.   exception
  2407.     when CONSTRAINT_ERROR => 
  2408.  
  2409.       -- on offset := s2'length (= 0)
  2410.       return 0; 
  2411.   end MATCH_STRING; 
  2412.  
  2413. begin
  2414.  
  2415.   -- Initialize the scopes stack with an implicit mark.
  2416.   SCOPES := CREATE; 
  2417.   MARK; 
  2418. end STRING_PKG; 
  2419. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2420. --sysparms.ada
  2421. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2422. with STRING_PKG;
  2423. package SYSTEM_PARAMETERS is
  2424.  
  2425.   ---------------------------------------------------------------
  2426.   --  This package contains parameters that may need to be changed
  2427.   --  depending on the host system being used and the compiler being
  2428.   --  used.
  2429.   ---------------------------------------------------------------
  2430.  
  2431.   ---------------------------------------------------------------
  2432.   --  These declarations are used by the parser
  2433.   ---------------------------------------------------------------
  2434.  
  2435.   MAXCOLUMN : constant := 250; 
  2436.   subtype SOURCE_COLUMN is NATURAL range 0 .. MAXCOLUMN; 
  2437.   MAXLINE : constant := 100000;  -- This is completely arbitrary
  2438.   subtype SOURCE_LINE is NATURAL range 0 .. MAXLINE; 
  2439.  
  2440.  
  2441.   ----------------------------------------------------------------
  2442.   -- Declarations to parameterize Printing
  2443.   ----------------------------------------------------------------
  2444.  
  2445.   type DELIMITER_NAME is (BASIC,      --| %, :, !
  2446.                           EXTENDED);  --| ", #, |
  2447.   DELIMITERS  : DELIMITER_NAME := EXTENDED; 
  2448.   --| Determines whether to use the Basic or Extended character set for
  2449.   --| output.
  2450.  
  2451.   MAX_SOURCE_LINE_LENGTH : constant := 80; 
  2452.   --|  Used to determine the maximum size of line that the source 
  2453.   --|  instrumenter should generate.
  2454.  
  2455.   MAX_COLUMNS : constant := 133; 
  2456.   subtype COLUMN_RANGE is POSITIVE range POSITIVE'FIRST .. MAX_COLUMNS; 
  2457.   PAGE_WIDTH : COLUMN_RANGE := 74; 
  2458.   --| Width of output page for the listing file used for display.  74 is
  2459.   --| used instead of 80 to leave room for the breakpoint number.
  2460.  
  2461.   RH_MARGIN  : COLUMN_RANGE := 60; 
  2462.   --| The column beyond which no indenting is performed.
  2463.  
  2464.   subtype INDENTATION_RANGE is NATURAL range 0 .. RH_MARGIN; 
  2465.   INDENTATION_LEVEL   : INDENTATION_RANGE := 2; 
  2466.   --| Indentation Level for all constructs
  2467.  
  2468.   PREFIX              : constant STRING := "SD_"; 
  2469.   SD_PREFIX           : constant STRING := "SI2AFSD_1861_"; 
  2470.   --|  These prefixes are used when the source instrumenter creates
  2471.   --|  objects or procedures.
  2472.  
  2473.    PROGRAM_NAME_AND_VERSION : constant string
  2474.                             := "SYMBOLIC DEBUGGER VERSION 1.0";
  2475.  
  2476. ---------------------------------------------------------------------
  2477. --  The following are file related parameters
  2478. ---------------------------------------------------------------------
  2479.  
  2480.   FILE_PREFIX_LIMIT  : constant := 8; 
  2481.   -- Defines the maximum size of a filename prefix
  2482.  
  2483.   FILE_SUFFIX_LIMIT  : constant := 4; 
  2484.   --  Defines the maximum size of a filename suffix.  On DEC Ada
  2485.   --  this suffix includes the period.
  2486.  
  2487.    BASE_PROGRAM_LIBRARY    : STRING_PKG.STRING_TYPE;
  2488.    -- This object specifies the location of the base program library.
  2489.    -- The base program library contains files used by all users of the
  2490.    -- debugger on a system.  
  2491.  
  2492.    CURRENT_PROGRAM_LIBRARY : STRING_PKG.STRING_TYPE;
  2493.    -- This defines the name of the current program library.  This is
  2494.    -- where the users listings and instrumenting files will be stored.
  2495.  
  2496.    PROGRAM_LIBRARY_CATALOG : constant STRING := "PKGFILES.CAT";
  2497.    --| The program library catalog contains the filenames of all
  2498.    --| compilation units in the program library that have been
  2499.    --| instrumented by the Source Instrumenter
  2500.  
  2501.    CATALOG_FILENAME_EXTENSION : constant STRING := ".CAT";
  2502.  
  2503. ---------------------------------------------------------------------
  2504. --  The following are used to define the suffixes used by files created by
  2505. --  the insrumenter when instrumenting packages.
  2506. ---------------------------------------------------------------------
  2507.  
  2508.   PUBLIC_SPEC_FILE_SUFFIX  : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".DPS"; 
  2509.   PUBLIC_BODY_FILE_SUFFIX  : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".DPB"; 
  2510.   PRIVATE_SPEC_FILE_SUFFIX : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".DVS"; 
  2511.   PRIVATE_BODY_FILE_SUFFIX : constant STRING(1 .. FILE_SUFFIX_LIMIT) := ".DVB"; 
  2512.  
  2513. ---------------------------------------------------------------------
  2514.  
  2515.   EXTERNAL_FILENAME        : constant STRING := "SDFNAMES.MAP"; 
  2516.   --  The name of the file containing the catalog for the package files
  2517.  
  2518.   TEMP_LISTFILE       : STRING(1 .. 10) := "SDTEMP.OUT";
  2519.   -- The name of the temporary listing file created
  2520.  
  2521.   TEMP_CPLFILE        : STRING(1 .. 11) := "CPLTEMP.OUT";
  2522.   -- The name of a file containg the name of the current program library.
  2523.   -- This file is used when the debugger is run from the shell to allow
  2524.   -- for passing the name of the program library.
  2525.  
  2526.   DEFAULT_INST_FILE_EXT : constant STRING := "INS";
  2527.   -- default extension for instrumented files.
  2528.  
  2529. --------------------------------------------------------------------
  2530. --  These items are used to define the areas on the screen used
  2531. --  by the debugger in screen mode
  2532. --------------------------------------------------------------------
  2533.  
  2534.   NUMBER_OF_SOURCE_LINES : NATURAL := 8;
  2535.   -- Number of lines used for displaying source
  2536.  
  2537.   SOURCE_LINES_ABOVE     : NATURAL := 3;
  2538.   -- Number of lines above the current breakpoint that are displayed
  2539.  
  2540.   SOURCE_LINES_BELOW     : NATURAL := 4;
  2541.   -- number of lines below the current breakpoint that are displayed
  2542.  
  2543.   NUMBER_OF_OUTPUT_LINES : POSITIVE := 8;
  2544.   --| number of lines in the middle third of the screen
  2545.  
  2546.  
  2547.   MAX_INPUT_LENGTH       : INTEGER := 255; --| maximum size of input string
  2548.  
  2549. end SYSTEM_PARAMETERS;  
  2550. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2551. --sysdep.spc
  2552. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2553. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  2554.  
  2555. PACKAGE sysdep IS
  2556.  
  2557. --  This package contains system dependencies.  The pacakge body
  2558. --  should be configured for the intended host system
  2559.  
  2560. -------------------------------------------------------------
  2561. -- the following functions are used by the virtual terminal
  2562. -------------------------------------------------------------
  2563.  
  2564.     PROCEDURE open;
  2565.     --
  2566.     -- Open the console for binary I/O, no echo.
  2567.     --
  2568.  
  2569.     PROCEDURE close;
  2570.     --
  2571.     -- Close the console.  Parameters should be reset to original condition.
  2572.     --
  2573.  
  2574.     PROCEDURE put ( data : IN string );
  2575.  
  2576.     --
  2577.     -- Put a string to the terminal.  There should be no translation of
  2578.     -- the characters. There can be exceptions to this rule (like CTRL-S and
  2579.     -- CTRL-Q)  and these exceptions must be identified in valid_character
  2580.     -- below.
  2581.     --
  2582.  
  2583.     PROCEDURE start_input;
  2584.  
  2585.     -- This procedure causes the virtual terminal to grab control of
  2586.     -- the input channel from the actual terminal.  This is done before
  2587.     -- we try to get input from the user.
  2588.  
  2589.     PROCEDURE stop_input;
  2590.  
  2591.     -- This procedure releases the input channel so that it can be used 
  2592.     -- by the program being tested.
  2593.  
  2594.     PROCEDURE get ( data : IN OUT string;
  2595.                     last : OUT natural );
  2596.  
  2597.     --
  2598.     -- Get a string from the terminal keyboard.  This ocurrs with no echo
  2599.     -- and no translations.
  2600.     --
  2601.  
  2602.     PROCEDURE tcf_name ( name : OUT string;
  2603.                          last : OUT natural );
  2604.     --
  2605.     -- Returns the name of the terminal capabilities file as a string.
  2606.     -- You better pass in a string of sufficient length to handle the name
  2607.     -- that is returned or you will get a constraint error.  80 is a good
  2608.     -- random number.
  2609.     --
  2610.  
  2611.     PROCEDURE  terminal_name ( name : OUT string;
  2612.                                last : OUT natural );
  2613.     --
  2614.     -- Returns the name of the terminal.  This name of a string like "tv970".
  2615.     -- If the name cannot be determined then last is returned as 0 (zero).
  2616.     -- Again,  you better make the name parameter big enough to hold the
  2617.     -- value returned.
  2618.     --
  2619.  
  2620.     FUNCTION valid_character ( item : IN character ) RETURN boolean;
  2621.  
  2622.     --
  2623.     -- Returns a boolean value identifying whether the character passed in
  2624.     -- is safe to use in the environment.  Suspicious characters include
  2625.     -- CTRL-S  CTRL-Q  CTRL-C  CTRL-Y.
  2626.  
  2627.   -- Operations --
  2628.  
  2629.   function FINDTABCOLUMN( --| returns source column a tab is in
  2630.                          INCOLUMN : in SOURCE_COLUMN
  2631.                                    --| source column before tab
  2632.                          ) return SOURCE_COLUMN; 
  2633.  
  2634.   --| Effects
  2635.  
  2636.   --| This subprogram implements the tab positioning strategy
  2637.   --| of the Host system.
  2638.  
  2639.  
  2640.    PROCEDURE spawn (command_string : in string);
  2641.    PRAGMA interface( EXTERNAL, spawn);
  2642.    PRAGMA import_procedure( spawn, "LIB$SPAWN");
  2643.  
  2644.    PROCEDURE SD_COMPILE(filename : in string);
  2645.  
  2646.     -- This procedure will invoke the compiler to compile the specified
  2647.     -- filename.
  2648.  
  2649.    PROCEDURE SD_LINK(compilation_unit : in string);
  2650.  
  2651.     --  This procedure will invoke the linker to link the specified
  2652.     --  unit.
  2653.  
  2654.    PROCEDURE SD_RUN(compilation_unit : in string);
  2655.  
  2656.     -- This procedure will run the specified program.
  2657.  
  2658.    PROCEDURE SD_SYS(command : in string);
  2659.  
  2660.     -- This procedure will invoke the specified system command.
  2661.  
  2662.    procedure SET_SCROLL_REGION(TOP    : in POSITIVE;
  2663.                                BOTTOM : in POSITIVE);
  2664.  
  2665.     -- This procedure defines an area of the terminal to be a scroll
  2666.     -- region.  It is used to define the bottom of the terminal as a
  2667.     -- scroll region.  This is used for target program output which will
  2668.     -- bypass the virtual terminal.
  2669.  
  2670.   package PREDEFINED_TYPES is
  2671.  
  2672. --  This procedure defines those optional types that are not defined 
  2673. --  by the current compiler.  Dec Ada does not have LONG_INTEGER, or
  2674. --  SHORT_FLOAT so they are defined here.
  2675.  
  2676.     type Long_Integer  is new integer;  --| Not implemented in DEC Ada
  2677.  
  2678. --    type Long_Float    is new float;   
  2679.  
  2680. --    type Short_Integer is new integer; 
  2681.  
  2682.     type Short_Float   is new float;    --| Not implemented in DEC Ada
  2683.  
  2684.   end PREDEFINED_TYPES;
  2685.  
  2686. END sysdep;
  2687.  
  2688. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2689. --errmsg.spc
  2690. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2691.  
  2692. with SYSTEM_PARAMETERS;  -- host dependent constants
  2693.  
  2694. package LEXICAL_ERROR_MESSAGE is  --| handles lexical error messages
  2695.  
  2696. --| Overview
  2697. --|
  2698. --| Contains text, identifiers of text, and output subprograms
  2699. --| for package Lex.
  2700. --|
  2701.  
  2702.   package SP renames SYSTEM_PARAMETERS; 
  2703.  
  2704.   --------------------------------------------------------------
  2705.   -- Declarations Global to Package Lexical_Error_Message
  2706.   ------------------------------------------------------------------
  2707.  
  2708.   type MESSAGE_TYPE is (BASE_OUT_OF_LEGAL_RANGE_USE_16, 
  2709.     BASED_LITERAL_DELIMITER_MISMATCH, CHARACTER_CAN_NOT_START_TOKEN, 
  2710.     CHARACTER_IS_NON_ASCII, CHARACTER_IS_NON_GRAPHIC, CONSECUTIVE_UNDERLINES, 
  2711.     DIGIT_INVALID_FOR_BASE, DIGIT_NEEDED_AFTER_RADIX_POINT, 
  2712.     DIGIT_NEEDED_BEFORE_RADIX_POINT, EXPONENT_MISSING_INTEGER_FIELD, 
  2713.     ILLEGAL_USE_OF_SINGLE_QUOTE, INTEGER_LITERAL_CONVERSION_EXCEPTION_USE_1, 
  2714.     LEADING_UNDERLINE, MISSING_SECOND_BASED_LITERAL_DELIMITER, 
  2715.     NEGATIVE_EXPONENT_ILLEGAL_IN_INTEGER, NO_ENDING_STRING_DELIMITER, 
  2716.     NO_INTEGER_IN_BASED_NUMBER, ONLY_GRAPHIC_CHARACTERS_IN_STRINGS, 
  2717.     REAL_LITERAL_CONVERSION_EXCEPTION_USE_1, SOURCE_LINE_MAXIMUM_EXCEEDED, 
  2718.     SOURCE_LINE_TOO_LONG, SPACE_MUST_SEPARATE_NUM_AND_IDS, TERMINAL_UNDERLINE, 
  2719.     TOO_MANY_RADIX_POINTS); 
  2720.  
  2721.   --------------------------------------------------------------
  2722.   -- Subprogram Bodies Global to Package Lexical_Error_Message
  2723.   --------------------------------------------------------------
  2724.  
  2725.   procedure OUTPUT_MESSAGE( --| output lexical error message
  2726.                            IN_LINE       : in SP.SOURCE_LINE; 
  2727.                                           --| line number of error.
  2728.                            IN_COLUMN     : in SP.SOURCE_COLUMN; 
  2729.                                           --| column number of error.
  2730.                            IN_MESSAGE_ID : in MESSAGE_TYPE); 
  2731.                                           --| which message to output.
  2732.  
  2733.   --| Effects
  2734.   --|
  2735.   --| Output error message for lexer.
  2736.   --|
  2737.  
  2738.   ------------------------------------------------------------------
  2739.  
  2740.   procedure OUTPUT_MESSAGE( --| output lexical error message
  2741.                            IN_LINE           : in SP.SOURCE_LINE; 
  2742.                                           --| line number of error.
  2743.                            IN_COLUMN         : in SP.SOURCE_COLUMN; 
  2744.                                           --| column number of error.
  2745.                            IN_INSERTION_TEXT : in STRING;  --| text to insert.
  2746.                            IN_MESSAGE_ID     : in MESSAGE_TYPE); 
  2747.                                           --| which message to output.
  2748.  
  2749.   --| Effects
  2750.   --|
  2751.   --| Output error message with inserted text.  The text is appended
  2752.   --| to the message if there are no insertion flags.
  2753.  
  2754.   ------------------------------------------------------------------
  2755.  
  2756. end LEXICAL_ERROR_MESSAGE; 
  2757.  
  2758. ----------------------------------------------------------------------
  2759. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2760. --errmsg.bdy
  2761. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2762.  
  2763.  
  2764.  
  2765. ------------------------------------------------------------------
  2766.  
  2767. with TEXT_IO; 
  2768.  
  2769. package body LEXICAL_ERROR_MESSAGE is 
  2770.  
  2771. ------------------------------------------------------------------
  2772. -- Declarations Local to Package Lexical_Error_Message
  2773. ------------------------------------------------------------------
  2774.  
  2775.   INSERTION_FLAG : CHARACTER := '@'; 
  2776.  
  2777.   subtype MESSAGE_TEXT_RANGE is POSITIVE range 1 .. 64; 
  2778.  
  2779.   MESSAGE_TEXT : constant array(MESSAGE_TYPE) of STRING(MESSAGE_TEXT_RANGE) := (
  2780.   -- 1234567890123456789012345678901234567890123456789012345678901234
  2781.   -- Base_Out_Of_Legal_Range_Use_16   =>
  2782.   "This base " & INSERTION_FLAG -- insert a String
  2783.   & " is not in the range 2 to 16. Assuming base 16.      ", 
  2784.   -- Based_Literal_Delimiter_Mismatch =>
  2785.   "Based_literal delimiters must be the same.                      ", 
  2786.   -- Character_Can_Not_Start_Token    =>
  2787.   "This character " & INSERTION_FLAG -- insert a character
  2788.   & " can not start a token.                         ", 
  2789.   -- Character_Is_Non_ASCII  =>
  2790.   "This value x@VALUE@x is not an ASCII character.                 ", 
  2791.   --|? should display the value, but this message is unlikely.
  2792.   --|? see Lex.bdy
  2793.   -- Character_Is_Non_Graphic=>
  2794.   "This character with decimal value" & INSERTION_FLAG
  2795.   -- insert the decimal value
  2796.   & " is not a graphic_character.  ", 
  2797.   -- Consecutive_Underlines  =>
  2798.   "Consecutive underlines are not allowed.                         ", 
  2799.   -- Digit_Invalid_For_Base  =>
  2800.   "This digit " & INSERTION_FLAG -- insert a Character
  2801.   & " is out of range for the base specified.            ", 
  2802.   -- Digit_Needed_After_Radix_Point   =>
  2803.   "At least one digit must appear after a radix point              ", 
  2804.   -- Digit_Needed_Before_Radix_Point  =>
  2805.   "At least one digit must appear before a radix point             ", 
  2806.   -- Exponent_Missing_Integer_Field   =>
  2807.   "The exponent is missing its integer field.                      ", 
  2808.   -- Illegal_Use_Of_Single_Quote  =>
  2809.   "Single quote is not used for an attribute or character literal. ", 
  2810.   -- Integer_Literal_Conversion_Exception_Using_1 =>
  2811.   "Error while evaluating a integer_literal. Using a value of '1'. ", 
  2812.   -- Leading_Underline    =>
  2813.   "Initial underlines are not allowed.                             ", 
  2814.   -- Missing_Second_Based_Literal_Delimiter   =>
  2815.   "Second based_literal delimiter is missing.                      ", 
  2816.   -- Negative_Exponent_Illegal_In_Integer =>
  2817.   "A negative exponent is illegal in an integer literal.           ", 
  2818.   -- No_Ending_String_Delimiter   =>
  2819.   "String is improperly terminated by the end of the line.         ", 
  2820.   -- No_Integer_In_Based_Number   =>
  2821.   "A based number must have a value.                               ", 
  2822.   -- Only_Graphic_Characters_In_Strings   =>
  2823.   "This non-graphic character with decimal value" & INSERTION_FLAG
  2824.   -- insert the decimal value
  2825.   & " found in string. ", 
  2826.   -- Real_Literal_Conversion_Exception_Using_1    =>
  2827.   "Error while evaluating a real_literal. Using a value of '1.0'.  ", 
  2828.   -- Source_Line_Maximum_Exceeded =>
  2829.   "Maximum allowable source line number of " & INSERTION_FLAG
  2830.   -- insert an Integer'IMAGE
  2831.   & " exceeded.             ", 
  2832.   -- Source_Line_Too_Long =>
  2833.   "Source line number " & INSERTION_FLAG -- insert an Integer'IMAGE
  2834.   & " is too long.                               ", 
  2835.   -- Space_Must_Separate_Num_And_Ids      =>
  2836.   "A space must separate numeric_literals and identifiers.         ", 
  2837.   -- Terminal_Underline   =>
  2838.   "Terminal underlines are not allowed.                            ", 
  2839.   -- Too_Many_Radix_Points        =>
  2840.   "A real_literal may have only one radix point.                   "); 
  2841.  
  2842.   ------------------------------------------------------------------
  2843.   -- Subprogram Bodies Global to Package Lexical_Error_Message
  2844.   ------------------------------------------------------------------
  2845.  
  2846.   procedure OUTPUT_MESSAGE(IN_LINE       : in SP.SOURCE_LINE; 
  2847.                            IN_COLUMN     : in SP.SOURCE_COLUMN; 
  2848.                            IN_MESSAGE_ID : in MESSAGE_TYPE) is 
  2849.  
  2850.   begin
  2851.  
  2852.     -- output error message including line and column number
  2853.     TEXT_IO.NEW_LINE(TEXT_IO.STANDARD_OUTPUT); 
  2854.     TEXT_IO.PUT_LINE(FILE => TEXT_IO.STANDARD_OUTPUT, ITEM => 
  2855.       "Lexical Error: Line: " & SP.SOURCE_LINE'IMAGE(IN_LINE) & " Column: " & SP
  2856.       .SOURCE_COLUMN'IMAGE(IN_COLUMN) & " - " & MESSAGE_TEXT(IN_MESSAGE_ID)); 
  2857.  
  2858.   end OUTPUT_MESSAGE; 
  2859.  
  2860.   ------------------------------------------------------------------
  2861.  
  2862.   procedure OUTPUT_MESSAGE(IN_LINE           : in SP.SOURCE_LINE; 
  2863.                            IN_COLUMN         : in SP.SOURCE_COLUMN; 
  2864.                            IN_INSERTION_TEXT : in STRING;  --| text to insert.
  2865.                            IN_MESSAGE_ID     : in MESSAGE_TYPE) is 
  2866.  
  2867.   --------------------------------------------------------------
  2868.   -- Declarations for SubProgram Output_Message
  2869.   --------------------------------------------------------------
  2870.  
  2871.     INSERTION_INDEX : POSITIVE := (MESSAGE_TEXT_RANGE'LAST + 1); 
  2872.     --| if insertion flag is not found,
  2873.     --| then we append the In_Message_Text to the message
  2874.  
  2875.     ------------------------------------------------------------------
  2876.  
  2877.   begin
  2878.  
  2879.     --| Algorithm
  2880.     --|
  2881.     --| Find the insertion point.
  2882.     --| if the Message_Text doesn't have an Insertion_Flag,
  2883.     --| then set the Insertion_Index to the end of the message.
  2884.     for I in MESSAGE_TEXT_RANGE loop
  2885.       if (INSERTION_FLAG = MESSAGE_TEXT(IN_MESSAGE_ID)(I)) then 
  2886.         INSERTION_INDEX := I; 
  2887.         exit; 
  2888.       end if; 
  2889.     end loop; 
  2890.  
  2891.     -- output error message with test, line and column number
  2892.     TEXT_IO.NEW_LINE(TEXT_IO.STANDARD_OUTPUT); 
  2893.     TEXT_IO.PUT_LINE(FILE => TEXT_IO.STANDARD_OUTPUT, ITEM => 
  2894.       "Lexical Error: Line: " & SP.SOURCE_LINE'IMAGE(IN_LINE) & " Column: " & SP
  2895.       .SOURCE_COLUMN'IMAGE(IN_COLUMN) & " - " & MESSAGE_TEXT(IN_MESSAGE_ID)(1
  2896.       .. (INSERTION_INDEX - 1)) & IN_INSERTION_TEXT & MESSAGE_TEXT(
  2897.       IN_MESSAGE_ID)((INSERTION_INDEX + 1) .. MESSAGE_TEXT_RANGE'LAST)); 
  2898.  
  2899.   end OUTPUT_MESSAGE; 
  2900.  
  2901.   ------------------------------------------------------------------
  2902.  
  2903. end LEXICAL_ERROR_MESSAGE; 
  2904.  
  2905. ----------------------------------------------------------------------
  2906. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2907. --grmconst.spc
  2908. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2909.  
  2910. --+ GRMCONST.SPC +--
  2911.  
  2912. package GRAMMAR_CONSTANTS is 
  2913.  
  2914.  
  2915.   type PARSERINTEGERCOMMON is range 0 .. 450000; 
  2916.   --| range of possible values for parser's integer values (found
  2917.   --| in NYU parse tables generator output)
  2918.  
  2919.   subtype PARSERINTEGER is PARSERINTEGERCOMMON; 
  2920.   --| range of possible values for parser's integer types (found
  2921.   --| in NYU parse tables generator output)
  2922.  
  2923.   function SETGRAMMARSYMBOLCOUNT return PARSERINTEGER; 
  2924.  
  2925.   function SETACTIONCOUNT return PARSERINTEGER; 
  2926.  
  2927.   function SETSTATECOUNTPLUSONE return PARSERINTEGER; 
  2928.  
  2929.   function SETLEFTHANDSIDECOUNT return PARSERINTEGER; 
  2930.  
  2931.   function SETRIGHTHANDSIDECOUNT return PARSERINTEGER; 
  2932.  
  2933. end GRAMMAR_CONSTANTS; 
  2934. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2935. --ptbls.spc
  2936. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2937.  
  2938. ----------------------------------------------------------------------
  2939. with SYSTEM_PARAMETERS;  -- host dependent constants for the compiler.
  2940. with GRAMMAR_CONSTANTS;  -- constants generated by parser generator
  2941. use GRAMMAR_CONSTANTS; 
  2942.  
  2943. package PARSETABLES is  --| Table output of parse tables generator
  2944.  
  2945. --| Overview
  2946. --|
  2947. --| This package contains the constants and tables generated by running
  2948. --| the LALR(1) parse tables generator on the Ada Grammar.
  2949. --| It also contains subprograms to access values in the more complex
  2950. --| tables, that could have their structures tuned later.
  2951. --|
  2952.  
  2953. --| Tuning
  2954. --|
  2955. --| --------------------------------------------------------------
  2956. --|
  2957. --| The Parser Generator has two options that effect the speed of
  2958. --| compilation:
  2959. --|
  2960. --| NODEFAULT : Eliminates the default reductions.
  2961. --| This also would improve error recovery.
  2962. --| Note that the table DefaultMap is still produced, though it
  2963. --| will never be referenced.
  2964. --| Thus, there need be no change to the code
  2965. --| in ParserUtilities.GetAction .
  2966. --|
  2967. --| LF : This changes the load factor used to pack and size the
  2968. --| ActionTables. It can range between 0 and 100.
  2969. --| A low LF means fewer collisions and faster parsing.
  2970. --| A high LF means more collisions and slower parsing.
  2971. --| ----------------------------------------------------------------
  2972. --|
  2973. --| The types GrammarSymbolRecord and FollowSymbolRecord
  2974. --| have a lot of unused space. The space/time tradeoff of
  2975. --| converting these into discriminated records or another
  2976. --| alternative representation, could be investigated.
  2977. --| This investigation should take the elaboration time
  2978. --| of the initializing aggregates into account.
  2979. --|
  2980. --| ----------------------------------------------------------------
  2981. --|
  2982. --| The Action Tables might be made made smaller by a restructuring of
  2983. --| the grammar.
  2984. --| For example: Have a rule for the token sequence:
  2985. --|
  2986. --| BEGIN seq_Of_Statements [EXCP..]
  2987. --|
  2988. --| ----------------------------------------------------------------
  2989. --|
  2990. --| The ParserGenerator might be modified along with
  2991. --| ParseTables.GetAction to produce smaller tables.
  2992. --| See:
  2993. --|
  2994. --| "Combined Actions to Reduce LR-Parsertables"
  2995. --| by K.Groneing. SIGPLAN Notices, Volume 19, Number 3, March 1984.
  2996. --|
  2997. --| ----------------------------------------------------------------
  2998. --|
  2999.  
  3000. --| Notes
  3001. --|
  3002. --| Abbreviations Used
  3003. --|
  3004. --| Rep : Representation
  3005. --|
  3006.  
  3007. --| RUN-TIME INPUT OF NYU LALR GENERATED TABLES AND CONSTANTS
  3008. --|
  3009. --|
  3010. --| followed by the current correct value of the
  3011. --| constant supplied by the NYU LALR Parser Generator:
  3012. --|
  3013. --| GrammarSymbolCount
  3014. --| LeftHandSideCount
  3015. --| RightHandSideCount
  3016. --| ActionTableOneLength
  3017. --| ActionTableTwoLength
  3018. --| DefaultMapLength
  3019. --| InSymbolMapLength
  3020. --| FollowMapLength
  3021. --| StateCountPlusOne
  3022. --| GrammarSymbolCountPlusOne
  3023. --| ActionCount
  3024. --| ActionTableSize
  3025. --|
  3026. --| in each of the eight declarations:
  3027. --|
  3028. --| GrammarSymbolTable
  3029. --| LeftHandSide
  3030. --| RightHandSide
  3031. --| ActionTableOne
  3032. --| ActionTableTwo
  3033. --| DefaultMap
  3034. --| InSymbolMap
  3035. --| FollowSymbolMap
  3036. --|
  3037.  
  3038.   package GC renames GRAMMAR_CONSTANTS; 
  3039.  
  3040.   ------------------------------------------------------------------
  3041.   -- Common Declarations for Action_Token_Map
  3042.   ------------------------------------------------------------------
  3043.  
  3044.   MAX_ACTION_TOKEN_COUNT : constant := 48; 
  3045.   --| This constant may need to be made larger if the grammar
  3046.   --| ever gets too large.
  3047.   --| It could be automatically generated.
  3048.  
  3049.  
  3050.   ------------------------------------------------------------------
  3051.   -- Common Declarations for Shift_State_Map
  3052.   ------------------------------------------------------------------
  3053.  
  3054.   MAX_SHIFT_STATE_COUNT  : constant := 90; 
  3055.   --| This constant may need to be made larger if the grammar
  3056.   --| ever gets too large.
  3057.   --| It could be automatically generated.
  3058.  
  3059.  
  3060.  
  3061.   subtype PARSERSTRINGRANGEPLUSZEROCOMMON is NATURAL range 0 .. 
  3062.     SYSTEM_PARAMETERS.MAXCOLUMN; 
  3063.   --| Parser's string should never be greater than a source line
  3064.   --| worth of text.
  3065.  
  3066.   subtype GRAMMARSYMBOLREPRANGEPLUSZEROCOMMON is PARSERSTRINGRANGEPLUSZEROCOMMON
  3067.     range 0 .. 57; 
  3068.  
  3069.   subtype FOLLOWSYMBOLRANGECOMMON is GC.PARSERINTEGER range 1 .. 50; 
  3070.  
  3071.   ------------------------------------------------------------------
  3072.   -- Declarations Global to Package ParseTables
  3073.   ------------------------------------------------------------------
  3074.  
  3075.   subtype POSITIVEPARSERINTEGER is GC.PARSERINTEGER range 1 .. GC.PARSERINTEGER'
  3076.     LAST; 
  3077.  
  3078.   subtype PARSERSTRINGRANGEPLUSZERO is PARSERSTRINGRANGEPLUSZEROCOMMON; 
  3079.   --| Parser's string should never be greater than a source line
  3080.   --| worth of text.
  3081.  
  3082.   ----------------------------------------------------------------------
  3083.   -- The first constant used to  the Parse Tables
  3084.   ----------------------------------------------------------------------
  3085.  
  3086.   GRAMMARSYMBOLCOUNT : constant GC.PARSERINTEGER := GC.SETGRAMMARSYMBOLCOUNT; 
  3087.   --| Number of terminals and nonterminals in the Ada grammar
  3088.   --| rules input to the parse tables generator
  3089.  
  3090.   subtype GRAMMARSYMBOLRANGE is GC.PARSERINTEGER range 1 .. GRAMMARSYMBOLCOUNT; 
  3091.   --| valid range of values for grammar symbols
  3092.  
  3093.   ------------------------------------------------------------------
  3094.   -- Parser Table Generated Token Values for Terminals
  3095.   ------------------------------------------------------------------
  3096.  
  3097.   -- WARNING: need to be checked after each Parser Generator Run.
  3098.   -- This could be made part of the ParseTables/ErrorParseTables
  3099.   -- generator program(s) at some point.
  3100.  
  3101.   ------------------------------------------------------------------
  3102.   -- Special Empty Terminal
  3103.   ------------------------------------------------------------------
  3104.  
  3105.   EMPTY_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 1; 
  3106.  
  3107.   ------------------------------------------------------------------
  3108.   -- Reserved Words
  3109.   ------------------------------------------------------------------
  3110.  
  3111.   ABORTTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 2; 
  3112.   ABSTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 3; 
  3113.   ACCEPTTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 4; 
  3114.   ACCESSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 5; 
  3115.   ALLTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 6; 
  3116.   ANDTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 7; 
  3117.   ARRAYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 8; 
  3118.   ATTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 9; 
  3119.   BEGINTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 10; 
  3120.   BODYTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 11; 
  3121.   CASETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 12; 
  3122.   CONSTANTTOKENVALUE    : constant GRAMMARSYMBOLRANGE := 13; 
  3123.   DECLARETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 14; 
  3124.   DELAYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 15; 
  3125.   DELTATOKENVALUE       : constant GRAMMARSYMBOLRANGE := 16; 
  3126.   DIGITSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 17; 
  3127.   DOTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 18; 
  3128.   ELSETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 19; 
  3129.   ELSIFTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 20; 
  3130.   ENDTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 21; 
  3131.   ENTRYTOKENVALUE       : constant GRAMMARSYMBOLRANGE := 22; 
  3132.   EXCEPTIONTOKENVALUE   : constant GRAMMARSYMBOLRANGE := 23; 
  3133.   EXITTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 24; 
  3134.   FORTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 25; 
  3135.   FUNCTIONTOKENVALUE    : constant GRAMMARSYMBOLRANGE := 26; 
  3136.   GENERICTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 27; 
  3137.   GOTOTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 28; 
  3138.   IFTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 29; 
  3139.   INTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 30; 
  3140.   ISTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 31; 
  3141.   LIMITEDTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 32; 
  3142.   LOOPTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 33; 
  3143.   MODTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 34; 
  3144.   NEWTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 35; 
  3145.   NOTTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 36; 
  3146.   NULLTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 37; 
  3147.   OFTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 38; 
  3148.   ORTOKENVALUE          : constant GRAMMARSYMBOLRANGE := 39; 
  3149.   OTHERSTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 40; 
  3150.   OUTTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 41; 
  3151.   PACKAGETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 42; 
  3152.   PRAGMATOKENVALUE      : constant GRAMMARSYMBOLRANGE := 43; 
  3153.   PRIVATETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 44; 
  3154.   PROCEDURETOKENVALUE   : constant GRAMMARSYMBOLRANGE := 45; 
  3155.   RAISETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 46; 
  3156.   RANGETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 47; 
  3157.   RECORDTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 48; 
  3158.   REMTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 49; 
  3159.   RENAMESTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 50; 
  3160.   RETURNTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 51; 
  3161.   REVERSETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 52; 
  3162.   SELECTTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 53; 
  3163.   SEPARATETOKENVALUE    : constant GRAMMARSYMBOLRANGE := 54; 
  3164.   SUBTYPETOKENVALUE     : constant GRAMMARSYMBOLRANGE := 55; 
  3165.   TASKTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 56; 
  3166.   TERMINATETOKENVALUE   : constant GRAMMARSYMBOLRANGE := 57; 
  3167.   THENTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 58; 
  3168.   TYPETOKENVALUE        : constant GRAMMARSYMBOLRANGE := 59; 
  3169.   USETOKENVALUE         : constant GRAMMARSYMBOLRANGE := 60; 
  3170.   WHENTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 61; 
  3171.   WHILETOKENVALUE       : constant GRAMMARSYMBOLRANGE := 62; 
  3172.   WITHTOKENVALUE        : constant GRAMMARSYMBOLRANGE := 63; 
  3173.   XORTOKENVALUE         : constant GRAMMARSYMBOLRANGE := 64; 
  3174.  
  3175.   ------------------------------------------------------------------
  3176.   -- Identifier and Literals
  3177.   ------------------------------------------------------------------
  3178.  
  3179.   IDENTIFIERTOKENVALUE  : constant GRAMMARSYMBOLRANGE := 65; 
  3180.   NUMERICTOKENVALUE     : constant GRAMMARSYMBOLRANGE := 66; 
  3181.   STRINGTOKENVALUE      : constant GRAMMARSYMBOLRANGE := 67; 
  3182.   CHARACTERTOKENVALUE   : constant GRAMMARSYMBOLRANGE := 68; 
  3183.  
  3184.   ------------------------------------------------------------------
  3185.   -- Single Delimiters
  3186.   ------------------------------------------------------------------
  3187.  
  3188.   AMPERSAND_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 69; 
  3189.   APOSTROPHE_TOKENVALUE : constant GRAMMARSYMBOLRANGE := 70; 
  3190.   LEFTPAREN_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 71; 
  3191.   RIGHTPAREN_TOKENVALUE : constant GRAMMARSYMBOLRANGE := 72; 
  3192.   STAR_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 73; 
  3193.   PLUS_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 74; 
  3194.   COMMA_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 75; 
  3195.   MINUS_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 76; 
  3196.   DOT_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 77; 
  3197.   SLASH_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 78; 
  3198.   COLON_TOKENVALUE      : constant GRAMMARSYMBOLRANGE := 79; 
  3199.   SEMICOLON_TOKENVALUE  : constant GRAMMARSYMBOLRANGE := 80; 
  3200.   LT_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 81; 
  3201.   EQ_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 82; 
  3202.   GT_TOKENVALUE         : constant GRAMMARSYMBOLRANGE := 83; 
  3203.   BAR_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 84; 
  3204.  
  3205.  
  3206.   ------------------------------------------------------------------
  3207.   -- Double Delimiters
  3208.   ------------------------------------------------------------------
  3209.  
  3210.   EQGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 85; 
  3211.   DOTDOT_TOKENVALUE     : constant GRAMMARSYMBOLRANGE := 86; 
  3212.   STARSTAR_TOKENVALUE   : constant GRAMMARSYMBOLRANGE := 87; 
  3213.   COLONEQ_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 88; 
  3214.   SLASHEQ_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 89; 
  3215.   GTEQ_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 90; 
  3216.   LTEQ_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 91; 
  3217.   LTLT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 92; 
  3218.   GTGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 93; 
  3219.   LTGT_TOKENVALUE       : constant GRAMMARSYMBOLRANGE := 94; 
  3220.  
  3221.   ------------------------------------------------------------------
  3222.   -- Comment Terminal
  3223.   ------------------------------------------------------------------
  3224.  
  3225.   COMMENT_TOKENVALUE    : constant GRAMMARSYMBOLRANGE := 95; 
  3226.  
  3227.   ------------------------------------------------------------------
  3228.   -- Special Terminals
  3229.   ------------------------------------------------------------------
  3230.  
  3231.   EOF_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 96; 
  3232.  
  3233.   ------------------------------------------------------------------
  3234.   -- Special Non-Terminals
  3235.   ------------------------------------------------------------------
  3236.  
  3237.   ACC_TOKENVALUE        : constant GRAMMARSYMBOLRANGE := 97; 
  3238.  
  3239.   ------------------------------------------------------------------
  3240.   -- Grammar Symbol Classes
  3241.   ------------------------------------------------------------------
  3242.  
  3243.   subtype TOKENRANGE is GRAMMARSYMBOLRANGE range 1 .. EOF_TOKENVALUE; 
  3244.  
  3245.   subtype TOKENRANGELESSEOF is GRAMMARSYMBOLRANGE range 1 .. (EOF_TOKENVALUE - 1
  3246.     ); 
  3247.  
  3248.   subtype NONTOKENRANGE is GRAMMARSYMBOLRANGE range (EOF_TOKENVALUE + 1) .. 
  3249.     GRAMMARSYMBOLCOUNT; 
  3250.  
  3251.   ACTIONCOUNT       : constant GC.PARSERINTEGER := GC.SETACTIONCOUNT; 
  3252.   --| Number of actions in the parse tables.
  3253.   -- NYU Reference Name: NUM_ACTIONS
  3254.  
  3255.   STATECOUNTPLUSONE : constant GC.PARSERINTEGER := GC.SETSTATECOUNTPLUSONE; 
  3256.   --| Number of states plus one in the parse tables.
  3257.   -- NYU Reference Name: NUM_STATES
  3258.  
  3259.   subtype STATERANGE is GC.PARSERINTEGER range 1 .. (STATECOUNTPLUSONE - 1); 
  3260.  
  3261.   subtype ACTIONRANGE is GC.PARSERINTEGER range 0 .. ACTIONCOUNT; 
  3262.  
  3263.   LEFTHANDSIDECOUNT : constant GC.PARSERINTEGER := GC.SETLEFTHANDSIDECOUNT; 
  3264.   --| Number of left hand sides in the Ada grammar rules.
  3265.  
  3266.   subtype LEFTHANDSIDERANGE is GC.PARSERINTEGER range 1 .. LEFTHANDSIDECOUNT; 
  3267.  
  3268.   function GET_LEFTHANDSIDE(GRAMMARRULE : in LEFTHANDSIDERANGE) return
  3269.     GRAMMARSYMBOLRANGE; 
  3270.   pragma INLINE(GET_LEFTHANDSIDE); 
  3271.  
  3272.   RIGHTHANDSIDECOUNT : constant GC.PARSERINTEGER := GC.SETRIGHTHANDSIDECOUNT; 
  3273.   --| Number of right hand sides in the Ada grammar rules.
  3274.  
  3275.   subtype RIGHTHANDSIDERANGE is GC.PARSERINTEGER range 1 .. RIGHTHANDSIDECOUNT; 
  3276.  
  3277.   function GET_RIGHTHANDSIDE(GRAMMARRULE : in RIGHTHANDSIDERANGE) return GC.
  3278.     PARSERINTEGER; 
  3279.   pragma INLINE(GET_RIGHTHANDSIDE); 
  3280.  
  3281.   ------------------------------------------------------------------
  3282.   -- Subprogram Bodies Global to Package ParseTables
  3283.   ------------------------------------------------------------------
  3284.  
  3285.   function GETACTION(INSTATEVALUE  : in STATERANGE; 
  3286.                      INSYMBOLVALUE : in GRAMMARSYMBOLRANGE) return ACTIONRANGE; 
  3287.  
  3288.   function GET_GRAMMAR_SYMBOL( --| return the string representation
  3289.   --| of the grammar symbol
  3290.                               IN_INDEX : in GRAMMARSYMBOLRANGE) return STRING; 
  3291.  
  3292.   --| Effects
  3293.   --|
  3294.   --| This subprogram returns the string representation of the
  3295.   --| GrammarSymbolRange passed in.
  3296.   --|
  3297.  
  3298.   ------------------------------------------------------------------
  3299.   subtype FOLLOWMAPRANGE is NONTOKENRANGE; 
  3300.  
  3301.   type FOLLOWSYMBOLARRAY is array(POSITIVEPARSERINTEGER range <>) of 
  3302.     GRAMMARSYMBOLRANGE; 
  3303.  
  3304.   type FOLLOWSYMBOLRECORD is 
  3305.     record
  3306.       FOLLOW_SYMBOL_COUNT : TOKENRANGE; 
  3307.       FOLLOW_SYMBOL       : FOLLOWSYMBOLARRAY(TOKENRANGE); 
  3308.     end record; 
  3309.     ------------------------------------------------------------------
  3310.  
  3311.   function GET_FOLLOW_MAP( --| return the array of follow symbols
  3312.   --| of the grammar symbol passed in
  3313.                           IN_INDEX : in FOLLOWMAPRANGE) return
  3314.     FOLLOWSYMBOLRECORD; 
  3315.  
  3316.  
  3317.   --| Effects
  3318.   --|
  3319.   --| This subprogram returns the array of follow symbols for the
  3320.   --| grammar symbol passed in.
  3321.   --|
  3322.  
  3323.   ------------------------------------------------------------------
  3324.   -- The following declarations are for Error Recovery.
  3325.   ------------------------------------------------------------------
  3326.   ------------------------------------------------------------------
  3327.   -- Action_Token_Map
  3328.   ------------------------------------------------------------------
  3329.  
  3330.   subtype ACTION_TOKEN_RANGE is GC.PARSERINTEGER range 1 .. 
  3331.     MAX_ACTION_TOKEN_COUNT; 
  3332.  
  3333.   subtype ACTION_TOKEN_RANGE_PLUS_ZERO is GC.PARSERINTEGER range 0 .. 
  3334.     MAX_ACTION_TOKEN_COUNT; 
  3335.   --| for the set_size (which could be null!)
  3336.  
  3337.   type ACTION_TOKEN_ARRAY is array(POSITIVEPARSERINTEGER range <>) of 
  3338.     TOKENRANGELESSEOF; 
  3339.  
  3340.   type ACTION_TOKEN_RECORD is 
  3341.     record
  3342.       SET_SIZE : ACTION_TOKEN_RANGE_PLUS_ZERO; 
  3343.       SET      : ACTION_TOKEN_ARRAY(ACTION_TOKEN_RANGE); 
  3344.     end record; 
  3345.  
  3346.     ------------------------------------------------------------------
  3347.     -- Shift_State_Map
  3348.     ------------------------------------------------------------------
  3349.  
  3350.   subtype SHIFT_STATE_RANGE is GC.PARSERINTEGER range 1 .. MAX_SHIFT_STATE_COUNT
  3351.     ; 
  3352.  
  3353.   subtype SHIFT_STATE_RANGE_PLUS_ZERO is GC.PARSERINTEGER range 0 .. 
  3354.     MAX_SHIFT_STATE_COUNT; 
  3355.   --| for the set_size (which could be null!)
  3356.  
  3357.   type SHIFT_STATE_ARRAY is array(POSITIVEPARSERINTEGER range <>) of STATERANGE
  3358.     ; 
  3359.  
  3360.   type SHIFT_STATE_RECORD is 
  3361.     record
  3362.       SET_SIZE : SHIFT_STATE_RANGE_PLUS_ZERO; 
  3363.       SET      : SHIFT_STATE_ARRAY(SHIFT_STATE_RANGE); 
  3364.     end record; 
  3365.  
  3366.     ------------------------------------------------------------------
  3367.  
  3368.   function GET_ACTION_TOKEN_MAP( --| return the array of action tokens
  3369.   --| for the state passed in.
  3370.                                 IN_INDEX : in STATERANGE
  3371.                                 --| the state to return action tokens
  3372.                                 --| for.
  3373.                                 ) return ACTION_TOKEN_RECORD; 
  3374.  
  3375.   ------------------------------------------------------------------
  3376.  
  3377.   function GET_SHIFT_STATE_MAP( --| return the array of shift states
  3378.   --| for the grammar symbol passed in.
  3379.                                IN_INDEX : in GRAMMARSYMBOLRANGE
  3380.                                --| grammar symbol to return shifts
  3381.                                --| for.
  3382.                                ) return SHIFT_STATE_RECORD; 
  3383.  
  3384.   -- The following variables contain statistics information
  3385.   -- collected during the parse:
  3386.   PARSERDECISIONCOUNT : NATURAL := 0;  --| Total number of times that
  3387.   --| GetAction was called.
  3388.   MAXCOLLISIONS       : NATURAL := 0;  --| Of all the calls to GetAction
  3389.   --| The one which resulted in the greatest number of collisions
  3390.   TOTALCOLLISIONS     : NATURAL := 0; 
  3391.   --| Total number of collisions which occurred during parsing.
  3392.  
  3393. end PARSETABLES; 
  3394. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3395. --lexidval.spc
  3396. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3397.  
  3398.  
  3399. ----------------------------------------------------------------------
  3400.  
  3401. with PARSETABLES;  -- tables from parser generator
  3402.  
  3403. package LEX_IDENTIFIER_TOKEN_VALUE is 
  3404. --| Classify identifiers and reserved words and determine which
  3405. --| identifiers are in package STANDARD.
  3406.  
  3407. ------------------------------------------------------------------
  3408. -- Subprogram Bodies Global to
  3409. -- Package Lex_Identifier_Token_Value
  3410. ------------------------------------------------------------------
  3411.  
  3412.   procedure FIND(
  3413.   --| returns token value and whether identifier is in package STANDARD.
  3414.  
  3415.                  IN_IDENTIFIER   : in STRING; 
  3416.                                        --| text of identifier to identify
  3417.  
  3418.                  OUT_TOKEN_VALUE : out PARSETABLES.TOKENRANGE); 
  3419.   --| TokenValue of this identifier
  3420.  
  3421.   --| Effects
  3422.   --|
  3423.   --| This subprogram determines if the identifier is
  3424.   --| a reserved word or a plain identifier.
  3425.   --|
  3426.   --| The answer is indicated by returning the appropriate TokenValue.
  3427.   --|
  3428.  
  3429.   ------------------------------------------------------------------
  3430.  
  3431. end LEX_IDENTIFIER_TOKEN_VALUE; 
  3432.  
  3433. ----------------------------------------------------------------------
  3434. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3435. --pdecls.spc
  3436. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3437.  
  3438.  
  3439. -----------------------------------------------------------------------
  3440.  
  3441. with SYSTEM_PARAMETERS;  -- host dependent constants
  3442. with PARSETABLES;  -- constants and state tables
  3443. use PARSETABLES; 
  3444.  
  3445. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS; 
  3446.  
  3447. package PARSERDECLARATIONS is  --| Objects used by the Parser
  3448.  
  3449. --| Notes
  3450.  
  3451. --| Abbreviations used in this compilation unit:
  3452. --|
  3453. --| gram : grammar
  3454. --| sym  : symbol
  3455. --| val  : value
  3456. --|
  3457.  
  3458.   package SP renames SYSTEM_PARAMETERS; 
  3459.   package PT renames PARSETABLES; 
  3460.   package GC renames GRAMMAR_CONSTANTS; 
  3461.  
  3462.   -- Exceptions --
  3463.  
  3464.   MEMORYOVERFLOW            : exception;  --| raised if Parser runs out of
  3465.   --| newable memory.
  3466.   PARSER_ERROR              : exception;  --| raised if an error occurs during
  3467.   --| parsing.
  3468.  
  3469.   --| The double delimiters were named with a combination of the name of
  3470.   --| each component symbol.
  3471.  
  3472.   ARROW_TOKENVALUE          : GRAMMARSYMBOLRANGE renames EQGT_TOKENVALUE; 
  3473.   EXPONENTIATION_TOKENVALUE : GRAMMARSYMBOLRANGE renames STARSTAR_TOKENVALUE; 
  3474.   ASSIGNMENT_TOKENVALUE     : GRAMMARSYMBOLRANGE renames COLONEQ_TOKENVALUE; 
  3475.   NOTEQUALS_TOKENVALUE      : GRAMMARSYMBOLRANGE renames SLASHEQ_TOKENVALUE; 
  3476.   STARTLABEL_TOKENVALUE     : GRAMMARSYMBOLRANGE renames LTLT_TOKENVALUE; 
  3477.   ENDLABEL_TOKENVALUE       : GRAMMARSYMBOLRANGE renames GTGT_TOKENVALUE; 
  3478.   BOX_TOKENVALUE            : GRAMMARSYMBOLRANGE renames LTGT_TOKENVALUE; 
  3479.  
  3480.   ------------------------------------------------------------------
  3481.   -- Grammar Symbol Classes
  3482.   ------------------------------------------------------------------
  3483.  
  3484.   subtype RESERVEDWORDRANGE is GRAMMARSYMBOLRANGE range ABORTTOKENVALUE .. 
  3485.     XORTOKENVALUE; 
  3486.  
  3487.   subtype SINGLEDELIMITERRANGE is GRAMMARSYMBOLRANGE range AMPERSAND_TOKENVALUE
  3488.     .. BAR_TOKENVALUE; 
  3489.  
  3490.   subtype DOUBLEDELIMITERRANGE is GRAMMARSYMBOLRANGE range ARROW_TOKENVALUE .. 
  3491.     BOX_TOKENVALUE; 
  3492.  
  3493.   ------------------------------------------------------------------
  3494.   -- ParseTables.GetAction return values
  3495.   ------------------------------------------------------------------
  3496.  
  3497.   subtype ERROR_ACTION_RANGE is  --| ActionRange that indicates
  3498.   ACTIONRANGE range 0 .. 0;  --| the error range
  3499.  
  3500.   subtype SHIFT_ACTION_RANGE is  --| ActionRange that indicates
  3501.   --| a shift action.
  3502.   ACTIONRANGE range 1 .. (STATECOUNTPLUSONE - 1); 
  3503.  
  3504.   subtype ACCEPT_ACTION_RANGE is  --| ActionRange that indicates
  3505.   --| the accept action.
  3506.   ACTIONRANGE range STATECOUNTPLUSONE .. STATECOUNTPLUSONE; 
  3507.  
  3508.   subtype REDUCE_ACTION_RANGE is  --| ActionRange that indicates
  3509.   --| a reduce action.
  3510.   ACTIONRANGE range (STATECOUNTPLUSONE + 1) .. ACTIONCOUNT; 
  3511.  
  3512.   ------------------------------------------------------------------
  3513.   -- Queue and Stack Management
  3514.   ------------------------------------------------------------------
  3515.  
  3516.   subtype STATEPARSESTACKSINDEX is  --| range of index values for
  3517.   GC.PARSERINTEGER range 0 .. 200;  --| StateStack and ParseStack
  3518.  
  3519.   subtype STATEPARSESTACKSRANGE is  --| array index values for
  3520.   --| StateStack and ParseStack
  3521.   STATEPARSESTACKSINDEX range 1 .. STATEPARSESTACKSINDEX'LAST; 
  3522.  
  3523.   LOOK_AHEAD_LIMIT : POSITIVE := 5;  --| Look ahead limit for parser
  3524.  
  3525.   ------------------------------------------------------------------
  3526.   -- StateStack Element
  3527.   ------------------------------------------------------------------
  3528.  
  3529.   subtype STATESTACKELEMENT is STATERANGE; 
  3530.  
  3531.   type SOURCE_TEXT is access STRING; 
  3532.  
  3533.   NULL_SOURCE_TEXT : constant SOURCE_TEXT := null; 
  3534.  
  3535.   ------------------------------------------------------------------
  3536.   -- ParseStack and Grammar Symbol Elements
  3537.   ------------------------------------------------------------------
  3538.  
  3539.   type TOKEN is 
  3540.     record
  3541.       TEXT          : SOURCE_TEXT; 
  3542.       SRCPOS_LINE   : SP.SOURCE_LINE; 
  3543.       SRCPOS_COLUMN : SP.SOURCE_COLUMN; 
  3544.     end record; 
  3545.  
  3546.   type PARSESTACKELEMENT is 
  3547.     record
  3548.       GRAM_SYM_VAL : GRAMMARSYMBOLRANGE; 
  3549.       --| used by parser to identify kind of grammar symbol
  3550.       LEXED_TOKEN  : TOKEN; 
  3551.       --| lexed tokens not yet reduced (eliminated)
  3552.       --| by ReduceActions.
  3553.     end record; 
  3554.  
  3555.     ------------------------------------------------------------------
  3556.  
  3557.   CURTOKEN : PARSESTACKELEMENT; 
  3558.   --| return from Lex.GetNextSourceToken
  3559.   --| Token used in subprogram Parse to determine
  3560.   --| next action from.
  3561.   --| Also used in ReduceActionsUtilities to determine last
  3562.   --| compilation unit in a compilation.
  3563.  
  3564.   ------------------------------------------------------------------
  3565.   -- Subprogram Bodies Global to Package ParserDeclarations
  3566.   ------------------------------------------------------------------
  3567.  
  3568.   function GET_SOURCE_TEXT( --| get a string from a Source_Text
  3569.   --| object
  3570.                            IN_SOURCE_TEXT : 
  3571.                                     --| the object to get the string from
  3572.                            in SOURCE_TEXT) return STRING; 
  3573.  
  3574.   --| Effects
  3575.  
  3576.   --| This subprogram gets a string from a Source_Text object.
  3577.   --| It exists to concentrate the interface to Source_Text objects.
  3578.  
  3579.   ------------------------------------------------------------------
  3580.  
  3581.   procedure PUT_SOURCE_TEXT( --| put a string into a Source_Text
  3582.   --| object
  3583.                             IN_STRING          : in STRING; 
  3584.                                    --| the string to store
  3585.                             IN_OUT_SOURCE_TEXT : 
  3586.                                    --| the object to store the string in
  3587.                             in out SOURCE_TEXT); 
  3588.  
  3589.  
  3590.   --| Effects
  3591.  
  3592.   --| This subprogram stores a string in a Source_Text object.
  3593.   --| It exists to concentrate the interface to Source_Text objects.
  3594.  
  3595.   ------------------------------------------------------------------
  3596.  
  3597.   function DUMP_PARSE_STACK_ELEMENT( --| return the data in a
  3598.   --| ParseStackElement or
  3599.   --| TokenQueueElement as a string
  3600.                                     IN_PSE : in PARSESTACKELEMENT
  3601.                                         --| the Element to display.
  3602.                                     ) return STRING; 
  3603.  
  3604.   --| Effects
  3605.  
  3606.   --| This subprogram returns the data in a ParseStackElement or its
  3607.   --| sub-type a TokenQueueElement as a string.
  3608.  
  3609.   --| Notes
  3610.  
  3611.   --| Abbreviations used in this compilation unit
  3612.   --|
  3613.   --| PSE : ParseStackElement
  3614.   --|
  3615.   --| Only the lexed_token variant is currently fully displayed.
  3616.   --| The other variants would have to make use of an IDL
  3617.   --| writer.
  3618.  
  3619.   ------------------------------------------------------------------
  3620.  
  3621. end PARSERDECLARATIONS; 
  3622.  
  3623. ----------------------------------------------------------------------
  3624. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3625. --lex.spc
  3626. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3627.  
  3628.  
  3629. ----------------------------------------------------------------------
  3630.  
  3631. with PARSERDECLARATIONS;  -- declarations for the Parser
  3632. with SYSTEM_PARAMETERS;  -- Host dependents constants
  3633.  
  3634. package LEX is  --| perform lexical analysis
  3635.  
  3636. --| Overview
  3637. --|
  3638. --| This package is used to identify tokens in the source file and
  3639. --| return them to subprogram Parser.
  3640. --|
  3641. --| The useful reference is Chapter 2 of the Ada (Trade Mark) LRM.
  3642.  
  3643. --| Effects
  3644. --|
  3645. --| The subprograms in package Lex are used to sequentially read
  3646. --| a source file and identify lexical units (tokens) in the file.
  3647. --| Comments and error messages are saved for use by the lister.
  3648.  
  3649.   package SP renames SYSTEM_PARAMETERS; 
  3650.   package PD renames PARSERDECLARATIONS; 
  3651.   -- other package renames are in the package body
  3652.  
  3653.   ------------------------------------------------------------------
  3654.   -- Subprogram Declarations Global to Package Lex
  3655.   ------------------------------------------------------------------
  3656.  
  3657.   procedure INITIALIZATION;  --| Initializes the lexer
  3658.  
  3659.   --| Effects
  3660.   --|
  3661.   --| This subprogram initializes the lexer.
  3662.  
  3663.   ------------------------------------------------------------------
  3664.  
  3665.   function GETNEXTNONCOMMENTTOKEN --| returns next non-comment token
  3666.   --| in source file.
  3667.   return PD.PARSESTACKELEMENT; 
  3668.  
  3669.   --| Effects
  3670.   --|
  3671.   --| This subprogram scans the source file for the next token not
  3672.   --| including comment tokens.
  3673.  
  3674.   --| Requires
  3675.   --|
  3676.   --| This subprogram requires an opened source file,
  3677.   --| and the state information internal to the package body.
  3678.  
  3679.   ------------------------------------------------------------------
  3680.  
  3681.   function GETNEXTSOURCETOKEN --| returns next token in source file.
  3682.   return PD.PARSESTACKELEMENT; 
  3683.  
  3684.   --| Effects
  3685.   --|
  3686.   --| This subprogram scans the source file for the next token.
  3687.   --| The tokens returned include any comment literal tokens.
  3688.  
  3689.   --| Requires
  3690.   --|
  3691.   --| This subprogram requires an opened source file,
  3692.   --| and the state information internal to the package body.
  3693.  
  3694.   ------------------------------------------------------------------
  3695.  
  3696.   function SHOW_CURRENT_LINE return SP.SOURCE_LINE; 
  3697.  
  3698.   --| Effects
  3699.   --|
  3700.   --| Returns the current line number being processed
  3701.  
  3702.   ------------------------------------------------------------------
  3703.  
  3704. end LEX; 
  3705.  
  3706. ----------------------------------------------------------------------
  3707. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3708. --lex.bdy
  3709. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3710.  
  3711.  
  3712. ----------------------------------------------------------------------
  3713.  
  3714. with SYSDEP;  -- Host dependents constants
  3715. with LEX_IDENTIFIER_TOKEN_VALUE; 
  3716. -- contains data structures and subprogram
  3717. --    to distinguish identifiers from
  3718. --    reserved words
  3719. with LEXICAL_ERROR_MESSAGE;  -- outputs error messages.
  3720. with PARSETABLES;  -- tables from parser generator
  3721. use PARSETABLES; 
  3722. with GRAMMAR_CONSTANTS;  -- constants from the parser generator
  3723. use GRAMMAR_CONSTANTS; 
  3724. with TEXT_IO; 
  3725.  
  3726.  
  3727. package body LEX is 
  3728.  
  3729. --| Overview
  3730. --| 
  3731. --| Package Lex is implemented as a state machine via case statements.
  3732. --| The implementation is optimized to minimize the number of times
  3733. --| each character is handled.  Each character is handled twice: once
  3734. --| on input and once on lexing based on the character.
  3735. --| 
  3736. --| The algorithm depends on having an End_Of_Line_Character
  3737. --| terminate each source file line.  This concludes the final token
  3738. --| on the line for the case statement scanners.
  3739.  
  3740. --| Notes
  3741. --| 
  3742. --| Abbreviations Used:
  3743. --|
  3744. --| Char : Character
  3745. --| CST  : Current_Source_Token
  3746. --| gram : grammar
  3747. --| sym  : symbol
  3748. --| val  : value
  3749. --| RW   : Reserved Word
  3750. --| 
  3751.  
  3752.   use PARSERDECLARATIONS; 
  3753.   package LEM renames LEXICAL_ERROR_MESSAGE; 
  3754.   package PT renames PARSETABLES; 
  3755.   package GC renames GRAMMAR_CONSTANTS; 
  3756.   -- other package renames are in the package spec
  3757.  
  3758.   ------------------------------------------------------------------
  3759.   -- Character Types
  3760.   ------------------------------------------------------------------
  3761.  
  3762.   subtype GRAPHIC_CHARACTER is CHARACTER range ' ' .. ASCII.TILDE; 
  3763.  
  3764.   subtype UPPER_CASE_LETTER is CHARACTER range 'A' .. 'Z'; 
  3765.  
  3766.   subtype LOWER_CASE_LETTER is CHARACTER range ASCII.LC_A .. ASCII.LC_Z; 
  3767.  
  3768.   subtype DIGIT is CHARACTER range '0' .. '9'; 
  3769.  
  3770.   subtype VALID_BASE_RANGE is GC.PARSERINTEGER range 2 .. 16; 
  3771.  
  3772.   subtype END_OF_LINE_CHARACTER is CHARACTER range ASCII.LF .. ASCII.CR; 
  3773.  
  3774.   ------------------------------------------------------------------
  3775.   -- Source position management
  3776.   ------------------------------------------------------------------
  3777.  
  3778.   CURRENT_COLUMN     : SP.SOURCE_COLUMN := 1; 
  3779.   CURRENT_LINE       : SP.SOURCE_LINE := 1; 
  3780.   --| the position of Next_Char in the source file.
  3781.   --| Visible so the Lexical_Error_message package can use them.
  3782.  
  3783.   ------------------------------------------------------------------
  3784.   -- Source Input Buffers and their Management
  3785.   ------------------------------------------------------------------
  3786.  
  3787.   NEXT_CHAR          : CHARACTER := ' ';  --| input buffer for next character
  3788.   --| to scan from source file
  3789.  
  3790.   END_OF_LINE_BUFFER :  --| character that signals end of
  3791.   --| line buffer
  3792.   constant CHARACTER := END_OF_LINE_CHARACTER'FIRST; 
  3793.  
  3794.   subtype LINE_BUFFER_RANGE is POSITIVE range 1 .. ((SP.SOURCE_COLUMN'LAST) + 2)
  3795.     ; 
  3796.   --| The first extra element is needed to hold the End_Of_Line_Buffer
  3797.   --| character. The second extra element allows Line_Buffer_Index
  3798.   --| to exceed Line_Buffer_Last.
  3799.  
  3800.   LINE_BUFFER         : STRING(LINE_BUFFER_RANGE) := ( -- 1 =>
  3801.   END_OF_LINE_BUFFER, others => ' '); 
  3802.   --| input buffer containing source file line being lexed.
  3803.  
  3804.   LINE_BUFFER_LAST    : SP.SOURCE_COLUMN := LINE_BUFFER'FIRST; 
  3805.   --| length of source file line being lexed.
  3806.  
  3807.   LINE_BUFFER_INDEX   : LINE_BUFFER_RANGE; 
  3808.   --| index of character being lexed.
  3809.  
  3810.   END_OF_FILE_REACHED : BOOLEAN := FALSE; 
  3811.   --| true when end of the input source has been reached
  3812.  
  3813.   ------------------------------------------------------------------
  3814.   -- Token to be Returned and its Management
  3815.   ------------------------------------------------------------------
  3816.  
  3817.   CST                 : PD.PARSESTACKELEMENT; 
  3818.                                    --| token being assembled for return by
  3819.   --| subprogram GetNextSourceToken
  3820.  
  3821.   subtype CST_INITIALIZATION_TYPE is PD.PARSESTACKELEMENT; 
  3822.  
  3823.   CST_INITIALIZER          : CST_INITIALIZATION_TYPE; 
  3824.   --| short cut to initializing discriminants properly
  3825.  
  3826.   END_OF_FILE_TOKEN        : CST_INITIALIZATION_TYPE; 
  3827.  
  3828.   ------------------------------------------------------------------
  3829.   -- Other objects
  3830.   ------------------------------------------------------------------
  3831.  
  3832.   EXIT_AFTER_GET_NEXT_CHAR : BOOLEAN := FALSE; 
  3833.   --| true; call Get_Next_Char before exiting, so that
  3834.   --| Next_Char contains the next character to be scanned.
  3835.   --| This object is not located in subprogram GetNextSourceToken,
  3836.   --| to save the time of re-elaboration on each call.
  3837.  
  3838.   PREVIOUS_TOKEN_VALUE     : PT.TOKENRANGE := PT.STRINGTOKENVALUE; 
  3839.   --| used to resolve tick use as a token in T'('a') versus
  3840.   --| use as a delimiter in a character literal.
  3841.  
  3842.   SOURCE_FILE              : TEXT_IO.FILE_TYPE; 
  3843.  
  3844.   ------------------------------------------------------------------
  3845.   -- Declarations for Scan_Numeric_Literal and Scan_Comment
  3846.   ------------------------------------------------------------------
  3847.  
  3848.   TEMP_SOURCE_TEXT         : PD.SOURCE_TEXT;  --| temporary to hold value of
  3849.   --| Source_Text
  3850.  
  3851.   ------------------------------------------------------------------
  3852.  
  3853.   subtype WORK_STRING_RANGE_PLUS_ZERO is NATURAL range 0 .. NATURAL(SP.
  3854.     SOURCE_COLUMN'LAST); 
  3855.  
  3856.   WORK_STRING        : STRING(1 .. WORK_STRING_RANGE_PLUS_ZERO'LAST); 
  3857.  
  3858.   WORK_STRING_LENGTH : WORK_STRING_RANGE_PLUS_ZERO; 
  3859.   -- Must initialize to 0 before each use.
  3860.  
  3861.   ------------------------------------------------------------------
  3862.   -- Declarations for Procedures:
  3863.   --
  3864.   -- Scan_Exponent, Scan_Based_Integer, Scan_Integer,
  3865.   -- and Scan_Numeric_Literal
  3866.   ------------------------------------------------------------------
  3867.  
  3868.   SEEN_RADIX_POINT   : BOOLEAN := FALSE; 
  3869.   --| true  : real
  3870.   --| false : integer
  3871.  
  3872.   ------------------------------------------------------------------
  3873.   -- Subprogram Specifications Local to Package Lex
  3874.   ------------------------------------------------------------------
  3875.  
  3876.   procedure GET_NEXT_CHAR;  --| Obtains next character
  3877.  
  3878.   --| Requires
  3879.   --|
  3880.   --| This subprogram requires an opened source file, and
  3881.   --| Current Column > Line_Buffer_Last on its first call to initialize
  3882.   --| the input buffers Next_Char and Line_Buffer correctly.
  3883.   --|
  3884.  
  3885.   --| Effects
  3886.   --|
  3887.   --| This subprogram places the next character from the source file
  3888.   --| in Next_Char and updates the source file position.
  3889.   --| Subprogram Get_Next_Line sets End_Of_File_Reached true, and causes
  3890.   --| Next_Char to be set to the last character in Line_Buffer.
  3891.   --|
  3892.  
  3893.   --| Modifies
  3894.   --|
  3895.   --| Current_Column
  3896.   --| Current_Line
  3897.   --| Next_Char
  3898.   --| Line_Buffer
  3899.   --| Line_Buffer_Last
  3900.   --| Line_Buffer_Index
  3901.   --| End_Of_File_Reached
  3902.   --|
  3903.  
  3904.   ------------------------------------------------------------------
  3905.  
  3906.   procedure GET_NEXT_LINE;  --| gets next source file line to lex
  3907.  
  3908.   --| Requires
  3909.   --|
  3910.   --| This subprogram requires the source file to be open.
  3911.   --|
  3912.  
  3913.   --| Effects
  3914.   --|
  3915.   --| This subprogram gets next source line from input file.
  3916.   --| Sets Current_Column and Line_Buffer_Index to 1, and
  3917.   --| increments Current_Line.
  3918.   --| If the End of File is detected,
  3919.   --| End_Of_File_Reached is set true,
  3920.   --| End_Of_File_Token is set up,
  3921.   --| and Next_Char is set to End_Of_Line_Buffer.
  3922.   --|
  3923.  
  3924.   --| Modifies
  3925.   --|
  3926.   --| Current_Line
  3927.   --| End_Of_File_Reached
  3928.   --| End_Of_File_Token - only when the end of file is reached.
  3929.   --| Line_Buffer
  3930.   --| Line_Buffer_Last
  3931.   --|
  3932.  
  3933.   ------------------------------------------------------------------
  3934.  
  3935.   function LOOK_AHEAD( --| Return character n columns ahead
  3936.   --| in current in current line.
  3937.                       IN_COLUMNS_AHEAD :  --| Number of columns ahead to get
  3938.                       in SP.SOURCE_COLUMN --| return character from.
  3939.                       ) return CHARACTER; 
  3940.  
  3941.   --| Requires
  3942.   --|
  3943.   --| Line_Buffer
  3944.   --| Line_Buffer_Last
  3945.   --|
  3946.  
  3947.   --| Effects
  3948.   --|
  3949.   --| Return character In_Columns_Ahead in Line_Buffer.
  3950.   --| If this character is off the end of Line_Buffer,
  3951.   --| End_Of_Line_Buffer character is returned.
  3952.   --|
  3953.  
  3954.   ------------------------------------------------------------------
  3955.  
  3956.   procedure SET_CST_GRAM_SYM_VAL( --| Sets gram_sym_val for current
  3957.   --| token.
  3958.                                  IN_TOKEN_VALUE : in PT.TOKENRANGE); 
  3959.                                             --| value of token
  3960.  
  3961.   --| Effects
  3962.   --|
  3963.   --| This subprogram fills in gram_sym_val for the current token.
  3964.   --|
  3965.  
  3966.   ------------------------------------------------------------------
  3967.  
  3968.   procedure SET_CST_SOURCE_REP( --| Saves the symbol representation
  3969.   --| in the current token.
  3970.                                IN_STRING : in STRING); 
  3971.                                      --| string holding symbol.
  3972.  
  3973.   --| Effects
  3974.   --|
  3975.   --| This subprogram fills in lexed_token.symrep for the current token.
  3976.   --|
  3977.  
  3978.   ------------------------------------------------------------------
  3979.  
  3980.   procedure INITIALIZE_CST;  --| Sets lx_srcpos for current token.
  3981.  
  3982.   --| Requires
  3983.   --|
  3984.   --| This subprogram requires Current_Column and Current_Line.
  3985.   --|
  3986.  
  3987.   --| Effects
  3988.   --|
  3989.   --| This subprogram sets common fields in CST.
  3990.   --|
  3991.  
  3992.   ------------------------------------------------------------------
  3993.  
  3994.   procedure ADD_NEXT_CHAR_TO_SOURCE_REP; 
  3995.   --| appends Next_Char to growing
  3996.   --| source representation
  3997.  
  3998.   --| Requires
  3999.   --|
  4000.   --| Next_Char
  4001.   --|
  4002.  
  4003.   --| Effects
  4004.   --|
  4005.   --| This subprogram appends Next_Char to the growing source
  4006.   --| representation.
  4007.   --|
  4008.  
  4009.   --| Modifies
  4010.   --|
  4011.   --| Work_String
  4012.   --| Work_String_Length
  4013.   --|
  4014.  
  4015.   ------------------------------------------------------------------
  4016.  
  4017.   procedure CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  4018.   --| Issues an error message if
  4019.   --| consecutive underlines occur.
  4020.  
  4021.   --| Requires
  4022.   --|
  4023.   --| Work_String
  4024.   --| Work_String_Length
  4025.   --|
  4026.  
  4027.   --| Effects
  4028.   --|
  4029.   --| Issues an error message if consecutive underlines occur.
  4030.   --|
  4031.  
  4032.   ------------------------------------------------------------------
  4033.  
  4034.   procedure CHECK_FOR_TERMINAL_UNDERLINE; 
  4035.   --| Issues an error message if
  4036.   --| a terminal underline occurs.
  4037.  
  4038.   --| Requires
  4039.   --|
  4040.   --| Work_String
  4041.   --| Work_String_Length
  4042.   --|
  4043.  
  4044.   --| Effects
  4045.   --|
  4046.   --| This subprogram issues an error message if a terminal underline
  4047.   --| occurs.
  4048.  
  4049.   ------------------------------------------------------------------
  4050.  
  4051.   procedure SCAN_COMMENT;  --| Scans comments.
  4052.  
  4053.   --| Requires
  4054.   --|
  4055.   --| This subprogram requires an opened source file.
  4056.   --|
  4057.  
  4058.   --| Effects
  4059.   --|
  4060.   --| This subprogram scans the rest of a comment.
  4061.   --|
  4062.  
  4063.   --| Modifies
  4064.   --|
  4065.   --| CST
  4066.   --|
  4067.  
  4068.   ------------------------------------------------------------------
  4069.  
  4070.   procedure SCAN_IDENTIFIER_INCLUDING_RW; 
  4071.   --| Scans identifiers including
  4072.   --| reserved words
  4073.  
  4074.   --| Requires
  4075.   --|
  4076.   --| This subprogram requires an opened source file.
  4077.   --|
  4078.  
  4079.   --| Effects
  4080.   --|
  4081.   --| This subprogram scans the rest of the identifier,
  4082.   --| and determines if its a reserved word.
  4083.   --|
  4084.  
  4085.   --| Modifies
  4086.   --|
  4087.   --| CST
  4088.   --|
  4089.  
  4090.   ------------------------------------------------------------------
  4091.  
  4092.   procedure SCAN_EXPONENT;  --| Scans exponent field in
  4093.   --| appropriate numeric_literals
  4094.  
  4095.   --| Requires
  4096.   --|
  4097.   --| This subprogram requires an opened source file.
  4098.   --|
  4099.  
  4100.   --| Effects
  4101.   --|
  4102.   --| This subprogram scans the end of numeric_literals which
  4103.   --| contain exponents.
  4104.   --|
  4105.  
  4106.   --| Modifies
  4107.   --|
  4108.   --| Work_String
  4109.   --| Work_String_Length
  4110.   --|
  4111.  
  4112.   ------------------------------------------------------------------
  4113.  
  4114.   procedure SCAN_BASED_INTEGER( --| scans a based integer field of
  4115.   --| a numeric literal
  4116.                                IN_BASE_TO_USE :  --| the base to use for lexing.
  4117.                                in VALID_BASE_RANGE); 
  4118.  
  4119.   --| Requires
  4120.   --|
  4121.   --| This subprogram requires an opened source file.
  4122.  
  4123.   --| Effects
  4124.   --|
  4125.   --| This subprogram scans a based integer field in a numeric literal,
  4126.   --| verifying that is lexically correct.
  4127.   --|
  4128.  
  4129.   --| Modifies
  4130.   --|
  4131.   --| Work_String
  4132.   --| Work_String_Length
  4133.   --|
  4134.  
  4135.   --| Notes
  4136.   --|
  4137.   --| This subprogram and Scan_Integer are nearly identical.
  4138.   --| They are separate to save the overhead of:
  4139.   --|
  4140.   --| - passing a base in for decimal literals; and
  4141.   --|
  4142.   --| - distinguishing the extended digit 'E' from the exponent
  4143.   --| delimiter 'E'.
  4144.   --|
  4145.  
  4146.   ------------------------------------------------------------------
  4147.  
  4148.   procedure SCAN_INTEGER;  --| scans an integer field of
  4149.   --|  a numeric literal
  4150.  
  4151.   --| Requires
  4152.   --|
  4153.   --| This subprogram requires an opened source file.
  4154.   --| 
  4155.  
  4156.   --| Effects
  4157.   --| 
  4158.   --| This subprogram scans an integer field in a numeric literal,
  4159.   --| verifying it is lexically correct.
  4160.   --| 
  4161.  
  4162.   --| Modifies
  4163.   --|
  4164.   --| Work_String
  4165.   --| Work_String_Length
  4166.   --| 
  4167.  
  4168.   --| Notes
  4169.   --| 
  4170.   --| This subprogram and Scan_Based_Integer are nearly identical.
  4171.   --| They are separate to save the overhead of:
  4172.   --| 
  4173.   --| - passing a base in for decimal literals; and
  4174.   --| 
  4175.   --| - distinguishing the extended digit 'E' from the exponent
  4176.   --| delimiter 'E'.
  4177.   --| 
  4178.  
  4179.   ------------------------------------------------------------------
  4180.  
  4181.   procedure SCAN_NUMERIC_LITERAL;  --| Scans numbers
  4182.  
  4183.   --| Requires
  4184.   --|
  4185.   --| This subprogram requires an opened source file, and the
  4186.   --| Universal Arithmetic package to handle conversions.
  4187.   --|
  4188.  
  4189.   --| Effects
  4190.   --|
  4191.   --| This subprogram scans the rest of the numeric literal and converts
  4192.   --| it to internal universal number format.
  4193.   --|
  4194.  
  4195.   --| Modifies
  4196.   --|
  4197.   --| CST
  4198.   --|
  4199.  
  4200.   -------------------------------------------------------------------
  4201.  
  4202.   procedure SCAN_STRING_LITERAL;  --| Scans string literals
  4203.  
  4204.   --| Requires
  4205.   --| 
  4206.   --| This subprogram requires an opened source file.
  4207.   --| 
  4208.  
  4209.   --| Effects
  4210.   --| 
  4211.   --| This subprogram scans the rest of the string literal.
  4212.   --| 
  4213.  
  4214.   --| Modifies
  4215.   --|
  4216.   --| CST
  4217.   --|
  4218.  
  4219.   ------------------------------------------------------------------
  4220.   -- Subprogram Bodies Global to Package Lex
  4221.   -- (declared in package specification).
  4222.   ------------------------------------------------------------------
  4223.  
  4224.   ------------------------------------------------------------------
  4225.   procedure INITIALIZATION is 
  4226.  
  4227.   begin
  4228.  
  4229.     END_OF_FILE_REACHED := FALSE; 
  4230.  
  4231.     -- forces Get_Next_Char to call Get_Next_Line
  4232.  
  4233.     -- revised 1/31/86
  4234.     -- no it doesn't because get_next_char never checks what current_column is,
  4235.     -- just increments it again.
  4236.  
  4237.    -- revise to do real initializing of necessary values.
  4238.  
  4239.     LINE_BUFFER := (END_OF_LINE_BUFFER, others => ' ');
  4240.       -- END_OF_LINE_BUFFER is a constant CHARACTER = ASCII.LF
  4241.     LINE_BUFFER_LAST := LINE_BUFFER'FIRST; -- 1
  4242.     LINE_BUFFER_INDEX := LINE_BUFFER_RANGE'FIRST; -- 1
  4243.     CURRENT_COLUMN := LINE_BUFFER_LAST + 1; 
  4244.  
  4245.     WORK_STRING := (others => ' ');
  4246.     WORK_STRING_LENGTH := WORK_STRING_RANGE_PLUS_ZERO'FIRST; -- 0
  4247.  
  4248.     GET_NEXT_CHAR; 
  4249.  
  4250.   end INITIALIZATION; 
  4251.  
  4252.   ------------------------------------------------------------------
  4253.  
  4254.   function GETNEXTNONCOMMENTTOKEN return PD.PARSESTACKELEMENT is separate; 
  4255.  
  4256.   ------------------------------------------------------------------
  4257.  
  4258.   function GETNEXTSOURCETOKEN return PD.PARSESTACKELEMENT is 
  4259.  
  4260.   --| Overview
  4261.   --|
  4262.   --| Note the following LRM Sections:
  4263.   --|     LRM Section 2.2  - Lexical Elements, Separators and Delimiters
  4264.   --|     LRM Section 2.2  - Notes
  4265.   --|     LRM Section 2.5  - Character Literals
  4266.   --|     LRM Section 2.7  - Comments
  4267.   --|     LRM Section 2.7  - Note
  4268.   --|     LRM Section 2.10 - Allowed Replacements of Characters
  4269.   --|
  4270.  
  4271.   begin
  4272.  
  4273.     if (END_OF_FILE_REACHED) then 
  4274.       CST := END_OF_FILE_TOKEN; 
  4275.     else 
  4276.  
  4277.       -- this else terminates
  4278.       -- shortly before the return statement
  4279.  
  4280.       -- This loop performs the following functions:
  4281.       --
  4282.       -- 1) It scans for and ignores repeated separators.
  4283.       -- 2) It reports illegal characters between tokens.
  4284.       -- 3) It identifies and lexes tokens.
  4285.       --    Delimiters and character literals are handled
  4286.       --    by code inside this loop.
  4287.       --    Complex tokens: identifiers, string and
  4288.       --    numeric literals are lexed by called
  4289.       --    subprograms.
  4290.       -- 4) It recognizes and processes comments that
  4291.       --    occur before the first token found.  Comments
  4292.       --    after tokens are processed by a separate loop
  4293.       --    after this one.
  4294.       SCAN_FOR_TOKEN : loop
  4295.         case NEXT_CHAR is 
  4296.           when UPPER_CASE_LETTER | LOWER_CASE_LETTER => 
  4297.             INITIALIZE_CST; 
  4298.             SCAN_IDENTIFIER_INCLUDING_RW; 
  4299.             exit SCAN_FOR_TOKEN; 
  4300.  
  4301.           -- Next_Char already updated
  4302.           when DIGIT => 
  4303.             INITIALIZE_CST; 
  4304.             SCAN_NUMERIC_LITERAL; 
  4305.             exit SCAN_FOR_TOKEN; 
  4306.  
  4307.           -- Next_Char already updated
  4308.           when ASCII.QUOTATION | 
  4309.  
  4310.           -- '"'
  4311.           ASCII.PERCENT => 
  4312.  
  4313.             -- '%'
  4314.             INITIALIZE_CST; 
  4315.             SCAN_STRING_LITERAL; 
  4316.             exit SCAN_FOR_TOKEN; 
  4317.  
  4318.           -- Next_Char already updated
  4319.           when ''' => 
  4320.             INITIALIZE_CST; 
  4321.             if ((GC."="(PREVIOUS_TOKEN_VALUE, PT.IDENTIFIERTOKENVALUE)) or else 
  4322.               (GC."="(PREVIOUS_TOKEN_VALUE, PT.ALLTOKENVALUE)) or else (GC."="(
  4323.               PREVIOUS_TOKEN_VALUE, PT.STRINGTOKENVALUE)) or else (GC."="(
  4324.               PREVIOUS_TOKEN_VALUE, PT.CHARACTERTOKENVALUE)) or else (GC."="(
  4325.               PREVIOUS_TOKEN_VALUE, PT.RIGHTPAREN_TOKENVALUE))) then 
  4326.  
  4327.               --  CST is a ' delimiter
  4328.               SET_CST_GRAM_SYM_VAL(PT.APOSTROPHE_TOKENVALUE); 
  4329.             elsif (LOOK_AHEAD(2) = ''') then 
  4330.  
  4331.               -- CST is a character literal
  4332.               CST.GRAM_SYM_VAL := PT.CHARACTERTOKENVALUE; 
  4333.               GET_NEXT_CHAR; 
  4334.               if not (NEXT_CHAR in GRAPHIC_CHARACTER) then 
  4335.  
  4336.                 -- flag as an error
  4337.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(
  4338.                   CHARACTER'POS(NEXT_CHAR))
  4339.  
  4340.                 -- convert to string
  4341.                 , LEM.CHARACTER_IS_NON_GRAPHIC); 
  4342.               end if; 
  4343.  
  4344.               -- save the source representation.
  4345.               SET_CST_SOURCE_REP("'" & NEXT_CHAR); 
  4346.               GET_NEXT_CHAR; 
  4347.  
  4348.             -- pass by the closing
  4349.             -- single quote
  4350.             else 
  4351.  
  4352.               -- flag single quote use as illegal
  4353.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4354.                 ILLEGAL_USE_OF_SINGLE_QUOTE); 
  4355.  
  4356.               --  assume CST is a ' delimiter;
  4357.               SET_CST_GRAM_SYM_VAL(PT.APOSTROPHE_TOKENVALUE); 
  4358.             end if; 
  4359.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4360.  
  4361.  
  4362.           when ASCII.AMPERSAND => 
  4363.  
  4364.             -- '&'
  4365.             INITIALIZE_CST; 
  4366.             SET_CST_GRAM_SYM_VAL(PT.AMPERSAND_TOKENVALUE); 
  4367.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4368.  
  4369.           when '(' => 
  4370.             INITIALIZE_CST; 
  4371.             SET_CST_GRAM_SYM_VAL(PT.LEFTPAREN_TOKENVALUE); 
  4372.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4373.  
  4374.           when ')' => 
  4375.             INITIALIZE_CST; 
  4376.             SET_CST_GRAM_SYM_VAL(PT.RIGHTPAREN_TOKENVALUE); 
  4377.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4378.  
  4379.           when '*' => 
  4380.             INITIALIZE_CST; 
  4381.             GET_NEXT_CHAR; 
  4382.             case NEXT_CHAR is 
  4383.               when '*' => 
  4384.                 SET_CST_GRAM_SYM_VAL(PD.EXPONENTIATION_TOKENVALUE); 
  4385.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4386.               when others => 
  4387.                 SET_CST_GRAM_SYM_VAL(PT.STAR_TOKENVALUE); 
  4388.                 exit SCAN_FOR_TOKEN; 
  4389.  
  4390.             -- Next_Char already updated
  4391.             end case; 
  4392.  
  4393.           when '+' => 
  4394.             INITIALIZE_CST; 
  4395.             SET_CST_GRAM_SYM_VAL(PT.PLUS_TOKENVALUE); 
  4396.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4397.  
  4398.           when ',' => 
  4399.             INITIALIZE_CST; 
  4400.             SET_CST_GRAM_SYM_VAL(PT.COMMA_TOKENVALUE); 
  4401.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4402.  
  4403.           when '-' => 
  4404.  
  4405.             -- Minus_Sign or Hyphen
  4406.             INITIALIZE_CST; 
  4407.             GET_NEXT_CHAR; 
  4408.             case NEXT_CHAR is 
  4409.               when '-' => 
  4410.  
  4411.                 -- Minus_Sign or Hyphen
  4412.                 -- two hyphens indicate a comment
  4413.                 SET_CST_GRAM_SYM_VAL(PT.COMMENT_TOKENVALUE); 
  4414.                 SCAN_COMMENT; 
  4415.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4416.               when others => 
  4417.                 SET_CST_GRAM_SYM_VAL(PT.MINUS_TOKENVALUE); 
  4418.                 exit SCAN_FOR_TOKEN; 
  4419.  
  4420.             -- Next_Char already updated
  4421.             end case; 
  4422.  
  4423.           when '.' => 
  4424.             INITIALIZE_CST; 
  4425.             GET_NEXT_CHAR; 
  4426.             case NEXT_CHAR is 
  4427.               when '.' => 
  4428.                 SET_CST_GRAM_SYM_VAL(PT.DOTDOT_TOKENVALUE); 
  4429.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4430.               when others => 
  4431.                 SET_CST_GRAM_SYM_VAL(PT.DOT_TOKENVALUE); 
  4432.                 exit SCAN_FOR_TOKEN; 
  4433.  
  4434.             -- Next_Char already updated
  4435.             end case; 
  4436.  
  4437.           when '/' => 
  4438.             INITIALIZE_CST; 
  4439.             GET_NEXT_CHAR; 
  4440.             case NEXT_CHAR is 
  4441.               when '=' => 
  4442.                 SET_CST_GRAM_SYM_VAL(PD.NOTEQUALS_TOKENVALUE); 
  4443.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4444.               when others => 
  4445.                 SET_CST_GRAM_SYM_VAL(PT.SLASH_TOKENVALUE); 
  4446.                 exit SCAN_FOR_TOKEN; 
  4447.  
  4448.             -- Next_Char already updated
  4449.             end case; 
  4450.  
  4451.           when ASCII.COLON => 
  4452.  
  4453.             -- ':'
  4454.             INITIALIZE_CST; 
  4455.             GET_NEXT_CHAR; 
  4456.             case NEXT_CHAR is 
  4457.               when '=' => 
  4458.                 SET_CST_GRAM_SYM_VAL(PD.ASSIGNMENT_TOKENVALUE); 
  4459.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4460.               when others => 
  4461.                 SET_CST_GRAM_SYM_VAL(PT.COLON_TOKENVALUE); 
  4462.                 exit SCAN_FOR_TOKEN; 
  4463.  
  4464.             -- Next_Char already updated
  4465.             end case; 
  4466.  
  4467.           when ASCII.SEMICOLON => 
  4468.  
  4469.             -- ';'
  4470.             INITIALIZE_CST; 
  4471.             SET_CST_GRAM_SYM_VAL(PT.SEMICOLON_TOKENVALUE); 
  4472.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4473.  
  4474.           when '<' => 
  4475.             INITIALIZE_CST; 
  4476.             GET_NEXT_CHAR; 
  4477.             case NEXT_CHAR is 
  4478.               when '=' => 
  4479.                 SET_CST_GRAM_SYM_VAL(PT.LTEQ_TOKENVALUE); 
  4480.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4481.               when '<' => 
  4482.                 SET_CST_GRAM_SYM_VAL(PD.STARTLABEL_TOKENVALUE); 
  4483.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4484.               when '>' => 
  4485.                 SET_CST_GRAM_SYM_VAL(PD.BOX_TOKENVALUE); 
  4486.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4487.               when others => 
  4488.                 SET_CST_GRAM_SYM_VAL(PT.LT_TOKENVALUE); 
  4489.                 exit SCAN_FOR_TOKEN; 
  4490.  
  4491.             -- Next_Char already updated
  4492.             end case; 
  4493.  
  4494.           when '=' => 
  4495.             INITIALIZE_CST; 
  4496.             GET_NEXT_CHAR; 
  4497.             case NEXT_CHAR is 
  4498.               when '>' => 
  4499.                 SET_CST_GRAM_SYM_VAL(PD.ARROW_TOKENVALUE); 
  4500.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4501.               when others => 
  4502.                 SET_CST_GRAM_SYM_VAL(PT.EQ_TOKENVALUE); 
  4503.                 exit SCAN_FOR_TOKEN; 
  4504.  
  4505.             -- Next_Char already updated
  4506.             end case; 
  4507.  
  4508.           when '>' => 
  4509.             INITIALIZE_CST; 
  4510.             GET_NEXT_CHAR; 
  4511.             case NEXT_CHAR is 
  4512.               when '=' => 
  4513.                 SET_CST_GRAM_SYM_VAL(PT.GTEQ_TOKENVALUE); 
  4514.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4515.               when '>' => 
  4516.                 SET_CST_GRAM_SYM_VAL(PD.ENDLABEL_TOKENVALUE); 
  4517.                 EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4518.               when others => 
  4519.                 SET_CST_GRAM_SYM_VAL(PT.GT_TOKENVALUE); 
  4520.                 exit SCAN_FOR_TOKEN; 
  4521.  
  4522.             -- Next_Char already updated
  4523.             end case; 
  4524.  
  4525.           when ASCII.BAR | 
  4526.  
  4527.           -- '|'
  4528.           ASCII.EXCLAM => 
  4529.  
  4530.             -- '!'
  4531.             -- vertical bar and its alternative
  4532.             INITIALIZE_CST; 
  4533.             SET_CST_GRAM_SYM_VAL(PT.BAR_TOKENVALUE); 
  4534.             EXIT_AFTER_GET_NEXT_CHAR := TRUE; 
  4535.  
  4536.           when ASCII.HT => 
  4537.  
  4538.             -- Horizontal Tab
  4539.             -- a lexical unit separator - skip it.
  4540.             -- position Current_Column properly. This is done
  4541.             --     here to save the cost of a test on every
  4542.             --     character in Get_Next_Char.
  4543.             CURRENT_COLUMN := SYSDEP.FINDTABCOLUMN(CURRENT_COLUMN); 
  4544.  
  4545.           when ' ' | END_OF_LINE_CHARACTER => 
  4546.  
  4547.             -- rest of the lexical unit separators
  4548.             if (END_OF_FILE_REACHED) then 
  4549.               return END_OF_FILE_TOKEN; 
  4550.             end if; 
  4551.  
  4552.  
  4553.           when ASCII.UNDERLINE => 
  4554.  
  4555.             -- '_'
  4556.             case LOOK_AHEAD(1) is 
  4557.               when UPPER_CASE_LETTER | LOWER_CASE_LETTER => 
  4558.  
  4559.                 -- flag illegal leading under line
  4560.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4561.                   LEADING_UNDERLINE); 
  4562.                 INITIALIZE_CST; 
  4563.                 SCAN_IDENTIFIER_INCLUDING_RW; 
  4564.                 exit SCAN_FOR_TOKEN; 
  4565.  
  4566.               -- Next_Char already updated
  4567.               when DIGIT => 
  4568.  
  4569.                 -- flag illegal leading under line
  4570.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4571.                   LEADING_UNDERLINE); 
  4572.                 INITIALIZE_CST; 
  4573.                 SCAN_NUMERIC_LITERAL; 
  4574.                 exit SCAN_FOR_TOKEN; 
  4575.  
  4576.               -- Next_Char already updated
  4577.               when others => 
  4578.  
  4579.                 -- flag illegal character for start
  4580.                 -- of token
  4581.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "_", LEM.
  4582.                   CHARACTER_CAN_NOT_START_TOKEN); 
  4583.             end case; 
  4584.  
  4585.  
  4586.           when ASCII.SHARP | 
  4587.  
  4588.           -- '#'
  4589.           ASCII.DOLLAR | 
  4590.  
  4591.           -- '$'
  4592.           ASCII.QUERY | 
  4593.  
  4594.           -- '?'
  4595.           ASCII.AT_SIGN | 
  4596.  
  4597.           -- '@'
  4598.           ASCII.L_BRACKET | 
  4599.  
  4600.           -- '['
  4601.           ASCII.BACK_SLASH | 
  4602.  
  4603.           -- '\'
  4604.           ASCII.R_BRACKET | 
  4605.  
  4606.           -- ']'
  4607.           ASCII.CIRCUMFLEX | 
  4608.  
  4609.           -- '^'
  4610.           ASCII.GRAVE | 
  4611.  
  4612.           -- '`'
  4613.           ASCII.L_BRACE | 
  4614.  
  4615.           -- '{'
  4616.           ASCII.R_BRACE | 
  4617.  
  4618.           -- '}'
  4619.           ASCII.TILDE => 
  4620.  
  4621.             -- '~'
  4622.             -- flag illegal character for start of token
  4623.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  4624.  
  4625.             -- convert to string
  4626.             , LEM.CHARACTER_CAN_NOT_START_TOKEN); 
  4627.  
  4628.           when ASCII.NUL .. 
  4629.  
  4630.           -- Null to
  4631.           ASCII.BS | 
  4632.  
  4633.           --  Back Space
  4634.           ASCII.SO .. 
  4635.  
  4636.           -- Shift Out to
  4637.           ASCII.US | 
  4638.  
  4639.           --  Unit Separator
  4640.           ASCII.DEL => 
  4641.  
  4642.             -- Delete
  4643.             -- flag as non-graphic ASCII control character
  4644.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(
  4645.               CHARACTER'POS(NEXT_CHAR))
  4646.  
  4647.             -- convert to string
  4648.             , LEM.CHARACTER_IS_NON_GRAPHIC); 
  4649.  
  4650.           when others => 
  4651.  
  4652.             -- should never happen due to 's
  4653.             -- definition of CHARACTER. flag as illegal anyhow
  4654.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4655.               CHARACTER_IS_NON_ASCII); 
  4656.         end case; 
  4657.  
  4658.         GET_NEXT_CHAR; 
  4659.  
  4660.         -- for next time through loop.
  4661.         if (EXIT_AFTER_GET_NEXT_CHAR) then 
  4662.           EXIT_AFTER_GET_NEXT_CHAR := FALSE; 
  4663.           exit SCAN_FOR_TOKEN; 
  4664.         end if; 
  4665.  
  4666.       end loop SCAN_FOR_TOKEN; 
  4667.  
  4668.       -- Next_Char already updated
  4669.       PREVIOUS_TOKEN_VALUE := CST.GRAM_SYM_VAL; 
  4670.  
  4671.     -- for resolving T'('c')
  4672.     end if; 
  4673.  
  4674.     -- (End_Of_File_Reached)
  4675.     return CST; 
  4676.  
  4677.   -- On leaving: object Next_Char should contain character
  4678.   -- to scan on next call of this function.
  4679.   end GETNEXTSOURCETOKEN; 
  4680.  
  4681.   ------------------------------------------------------------------
  4682.   -- Subprogram Bodies Local to Package Lex
  4683.   ------------------------------------------------------------------
  4684.  
  4685.   procedure GET_NEXT_CHAR is 
  4686.  
  4687.   begin
  4688.  
  4689.     --| Algorithm
  4690.     --| 
  4691.     --| Source File is scanned returning each character until the
  4692.     --| end of the file is found. Proper column positioning for a tab
  4693.     --| character is done in GetNextSourceToken for speed.
  4694.     --| 
  4695.  
  4696.     -- The End_Of_Line_Character that Get_Next_Line
  4697.     -- inserts needs to be seen by the scanning
  4698.     -- case statements to terminate tokens correctly.
  4699.     CURRENT_COLUMN := CURRENT_COLUMN + 1; 
  4700.     LINE_BUFFER_INDEX := LINE_BUFFER_INDEX + 1; 
  4701.     NEXT_CHAR := LINE_BUFFER(LINE_BUFFER_INDEX); 
  4702.  
  4703.     if (LINE_BUFFER_INDEX > LINE_BUFFER_LAST) then 
  4704.       GET_NEXT_LINE; 
  4705.  
  4706.       -- Current_Column and Line_Buffer_Index are handled there.
  4707.       NEXT_CHAR := LINE_BUFFER(LINE_BUFFER_INDEX); 
  4708.     end if; 
  4709.  
  4710.   end GET_NEXT_CHAR;  -- procedure
  4711.  
  4712.   ------------------------------------------------------------------
  4713.  
  4714.   procedure GET_NEXT_LINE is 
  4715.  
  4716.   begin
  4717.  
  4718.     -- Get next source line from CURRENT_INPUT. Update column and
  4719.     -- line counts
  4720.     CURRENT_COLUMN := 1; 
  4721.     LINE_BUFFER_INDEX := 1; 
  4722.  
  4723.     IGNORE_NULL_LINE : loop
  4724.  
  4725.       -- do NOT move next statement out of loop
  4726.       if (CURRENT_LINE < SP.SOURCE_LINE'LAST) then 
  4727.         begin -- block
  4728.           CURRENT_LINE := SP.SOURCE_LINE -- type conversion
  4729.           (TEXT_IO.LINE(FILE => TEXT_IO.CURRENT_INPUT)); 
  4730.           if (CURRENT_LINE >= SP.SOURCE_LINE'LAST) then 
  4731.             raise CONSTRAINT_ERROR; 
  4732.           end if; 
  4733.         exception
  4734.           when others => 
  4735.             CURRENT_LINE := SP.SOURCE_LINE'LAST; 
  4736.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, SP.SOURCE_LINE'
  4737.               IMAGE(SP.SOURCE_LINE'LAST), LEM.SOURCE_LINE_MAXIMUM_EXCEEDED); 
  4738.         end;  -- block
  4739.       end if; 
  4740.       TEXT_IO.GET_LINE(FILE => TEXT_IO.CURRENT_INPUT, ITEM => LINE_BUFFER(1 .. (
  4741.         LINE_BUFFER'LAST - 1)), LAST => LINE_BUFFER_LAST); 
  4742.       -- flag a line that is too long as an error
  4743.       if (LINE_BUFFER_LAST >= LINE_BUFFER'LAST - 1) and then (TEXT_IO.
  4744.         END_OF_LINE(FILE => TEXT_IO.CURRENT_INPUT)) then 
  4745.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4746.           SOURCE_LINE_TOO_LONG); 
  4747.       end if; 
  4748.       exit IGNORE_NULL_LINE when (LINE_BUFFER_LAST /= (LINE_BUFFER'FIRST - 1)); 
  4749.     end loop IGNORE_NULL_LINE; 
  4750.  
  4751.     LINE_BUFFER_LAST := LINE_BUFFER_LAST + 1; 
  4752.     LINE_BUFFER(LINE_BUFFER_LAST) := END_OF_LINE_BUFFER; 
  4753.  
  4754.   exception
  4755.   -- when end of file is reached
  4756.     when TEXT_IO.END_ERROR => 
  4757.     -- save that state for GetNextSourceToken
  4758.       END_OF_FILE_REACHED := TRUE; 
  4759.  
  4760.       -- update column and line counts
  4761.       LINE_BUFFER_LAST := 1; 
  4762.       LINE_BUFFER(LINE_BUFFER_LAST) := END_OF_LINE_BUFFER; 
  4763.       LINE_BUFFER_INDEX := 1; 
  4764.       CURRENT_COLUMN := 1; 
  4765.       -- Current_Line is ok.
  4766.       -- Last call to GET_LINE advanced it one.
  4767.  
  4768.       -- set the value of End_Of_File_Token
  4769.       -- the discriminants were set up by the object declaration
  4770.       END_OF_FILE_TOKEN.GRAM_SYM_VAL := PT.EOF_TOKENVALUE; 
  4771.       END_OF_FILE_TOKEN.LEXED_TOKEN := (SRCPOS_LINE => CURRENT_LINE, 
  4772.         SRCPOS_COLUMN => CURRENT_COLUMN, TEXT => PD.NULL_SOURCE_TEXT); 
  4773.  
  4774.   end GET_NEXT_LINE; 
  4775.  
  4776.   ------------------------------------------------------------------
  4777.   function LOOK_AHEAD(IN_COLUMNS_AHEAD : in SP.SOURCE_COLUMN) return CHARACTER
  4778.     is 
  4779.  
  4780.     ------------------------------------------------------------------
  4781.     -- Declarations for subprogram Look_Ahead
  4782.     ------------------------------------------------------------------
  4783.     POSITION_TO_TRY : INTEGER := INTEGER
  4784.  
  4785.     --type conversion
  4786.     (LINE_BUFFER_INDEX + IN_COLUMNS_AHEAD); 
  4787.  
  4788.   ------------------------------------------------------------------
  4789.   begin
  4790.  
  4791.   -- if request is past the end of line
  4792.     if (POSITION_TO_TRY > INTEGER(LINE_BUFFER_LAST)) then 
  4793.     -- type conversion
  4794.     -- return the end_of_line character
  4795.       return END_OF_LINE_BUFFER; 
  4796.     else 
  4797.     -- else return the requested character
  4798.       return LINE_BUFFER(POSITION_TO_TRY); 
  4799.     end if; 
  4800.  
  4801.   end LOOK_AHEAD; 
  4802.  
  4803.   -- function
  4804.  
  4805.   ------------------------------------------------------------------
  4806.   procedure SET_CST_GRAM_SYM_VAL(IN_TOKEN_VALUE : in PT.TOKENRANGE) is 
  4807.  
  4808.   begin
  4809.  
  4810.     CST.GRAM_SYM_VAL := IN_TOKEN_VALUE; 
  4811.  
  4812.   end SET_CST_GRAM_SYM_VAL; 
  4813.  
  4814.   ----------------------------------------------------------------------
  4815.   procedure SET_CST_SOURCE_REP(IN_STRING : in STRING) is 
  4816.  
  4817.   begin
  4818.  
  4819.   -- store the representation
  4820.     PD.PUT_SOURCE_TEXT(IN_STRING, CST.LEXED_TOKEN.TEXT); 
  4821.  
  4822.   end SET_CST_SOURCE_REP; 
  4823.  
  4824.   ------------------------------------------------------------------
  4825.   procedure INITIALIZE_CST is 
  4826.  
  4827.   begin
  4828.  
  4829.   -- Set up discriminants, and source position properly
  4830.   -- Set other CST fields to null values
  4831.     CST := CST_INITIALIZER; 
  4832.  
  4833.     CST.LEXED_TOKEN := (SRCPOS_LINE => CURRENT_LINE, SRCPOS_COLUMN => 
  4834.       CURRENT_COLUMN, TEXT => PD.NULL_SOURCE_TEXT); 
  4835.  
  4836.   end INITIALIZE_CST; 
  4837.  
  4838.   ------------------------------------------------------------------
  4839.   procedure ADD_NEXT_CHAR_TO_SOURCE_REP is 
  4840.  
  4841.   begin
  4842.  
  4843.   -- append the character to growing source representation
  4844.     WORK_STRING_LENGTH := WORK_STRING_LENGTH + 1; 
  4845.     WORK_STRING(WORK_STRING_LENGTH) := NEXT_CHAR; 
  4846.  
  4847.   end ADD_NEXT_CHAR_TO_SOURCE_REP; 
  4848.  
  4849.   ------------------------------------------------------------------
  4850.   procedure CHECK_FOR_CONSECUTIVE_UNDERLINES is 
  4851.  
  4852.   begin
  4853.  
  4854.   -- flag consecutive underlines as an error (leading
  4855.   -- underlines are handled in GetNextSourceToken).
  4856.     if (WORK_STRING(WORK_STRING_LENGTH) = ASCII.UNDERLINE) then 
  4857.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4858.         CONSECUTIVE_UNDERLINES); 
  4859.     end if; 
  4860.  
  4861.   end CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  4862.  
  4863.   -- procedure
  4864.  
  4865.   ------------------------------------------------------------------
  4866.   procedure CHECK_FOR_TERMINAL_UNDERLINE is 
  4867.  
  4868.   begin
  4869.  
  4870.   -- flag a trailing underline as an error.
  4871.   -- trailing underlines are saved for the same
  4872.   -- reason as leading ones.
  4873.   -- See comment in GetNextSourceToken.
  4874.  
  4875.     if (WORK_STRING(WORK_STRING_LENGTH) = ASCII.UNDERLINE)
  4876.     -- check the preceeding character
  4877.     then 
  4878.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.TERMINAL_UNDERLINE); 
  4879.     end if; 
  4880.  
  4881.   end CHECK_FOR_TERMINAL_UNDERLINE; 
  4882.  
  4883.   ------------------------------------------------------------------
  4884.   procedure SCAN_COMMENT is 
  4885.  
  4886.   --| Overview
  4887.   --|
  4888.   --| Note the following LRM Sections:
  4889.   --|     LRM Section 2.7  - Comments
  4890.   --|     LRM Section 2.7  - Note
  4891.   --|
  4892.   begin
  4893.  
  4894.   -- get to the beginning of the comment
  4895.     GET_NEXT_CHAR; 
  4896.     SET_CST_SOURCE_REP(LINE_BUFFER(LINE_BUFFER_INDEX .. LINE_BUFFER_LAST - 1)); 
  4897.     -- subtract 1 so that the carridge return is not also returned.
  4898.  
  4899.     LINE_BUFFER_INDEX := LINE_BUFFER_LAST + 1; 
  4900.     -- force next call to Get_Next_Char to call Get_Next_Line
  4901.  
  4902.   end SCAN_COMMENT; 
  4903.  
  4904.   ------------------------------------------------------------------
  4905.   procedure SCAN_IDENTIFIER_INCLUDING_RW is 
  4906.  
  4907.   --| Overview
  4908.   --|
  4909.   --| Note the following LRM Sections:
  4910.   --|     LRM Section 2.3 - Identifiers
  4911.   --|     LRM Section 2.3 - Note
  4912.   --|     LRM Section 2.9 - Reserved Words
  4913.   --|     LRM Section 2.9 - Notes
  4914.   --|
  4915.  
  4916.   ------------------------------------------------------------------
  4917.   begin
  4918.  
  4919.     WORK_STRING_LENGTH := 0; 
  4920.  
  4921.     -- scan source file for rest of token
  4922.     -- note that first character of the token is stored first
  4923.     SCAN_FOR_IDENTIFIER_INCLUDING_RW : loop
  4924.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  4925.  
  4926.       -- set up for processing next characte
  4927.       GET_NEXT_CHAR; 
  4928.  
  4929.       case NEXT_CHAR is 
  4930.         when UPPER_CASE_LETTER | LOWER_CASE_LETTER | DIGIT => 
  4931.         -- action is at start of next loop cycle
  4932.           null; 
  4933.         when ASCII.UNDERLINE =>  -- '_'
  4934.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  4935.         when others => 
  4936.           CHECK_FOR_TERMINAL_UNDERLINE; 
  4937.  
  4938.           -- token is terminated by any character except letter
  4939.           --     digit, or underline;
  4940.           exit SCAN_FOR_IDENTIFIER_INCLUDING_RW;  -- this loop
  4941.       end case; 
  4942.  
  4943.     end loop SCAN_FOR_IDENTIFIER_INCLUDING_RW; 
  4944.  
  4945.     -- find out what kind of token it is
  4946.     LEX_IDENTIFIER_TOKEN_VALUE.FIND(IN_IDENTIFIER => WORK_STRING(1 .. 
  4947.       WORK_STRING_LENGTH), OUT_TOKEN_VALUE => CST.GRAM_SYM_VAL); 
  4948.  
  4949.     -- store the source representation of the token found
  4950.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  4951.  
  4952.   end SCAN_IDENTIFIER_INCLUDING_RW; 
  4953.  
  4954.   ------------------------------------------------------------------
  4955.   procedure SCAN_EXPONENT is 
  4956.  
  4957.   --| Overview
  4958.   --|
  4959.   --| Note the following LRM Sections:
  4960.   --|     LRM Section 2.4.1 - Decimal Literals
  4961.   --|     LRM Section 2.4.1 - Notes
  4962.   --|     LRM Section 2.4.2 - Based Literals
  4963.   --|
  4964.   begin
  4965.  
  4966.   -- Check for missing 'E' or 'e',
  4967.   -- and for existence of the exponent
  4968.     case NEXT_CHAR is 
  4969.       when 'E' | 'e' => 
  4970.         null;  -- normal case
  4971.       when others => 
  4972.         return;  -- no exponent to process
  4973.     end case; 
  4974.     -- add first character to growing literal
  4975.     ADD_NEXT_CHAR_TO_SOURCE_REP; 
  4976.  
  4977.  
  4978.     -- scan source file for rest of the exponent
  4979.     -- verify that next character is legal for an integer field
  4980.     GET_NEXT_CHAR; 
  4981.  
  4982.     case NEXT_CHAR is 
  4983.       when '+' => 
  4984.       -- add sign character to growing literal
  4985.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  4986.  
  4987.         GET_NEXT_CHAR; 
  4988.       when '-' =>  -- Minus_Sign
  4989.         if not (SEEN_RADIX_POINT) then 
  4990.         -- flag negative exponent as illegal in an integer
  4991.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  4992.             NEGATIVE_EXPONENT_ILLEGAL_IN_INTEGER); 
  4993.         end if; 
  4994.  
  4995.         -- add sign character to growing literal
  4996.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  4997.  
  4998.         GET_NEXT_CHAR; 
  4999.       when others => 
  5000.         null; 
  5001.     end case; 
  5002.  
  5003.     case NEXT_CHAR is 
  5004.       when DIGIT => 
  5005.       -- scan the integer field of the exponent
  5006.         SCAN_INTEGER; 
  5007.       when ASCII.UNDERLINE =>  -- '_'
  5008.         if (LOOK_AHEAD(1) in DIGIT) then 
  5009.         -- flag illegal leading under line
  5010.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.LEADING_UNDERLINE
  5011.             ); 
  5012.           -- scan the integer field of the exponent
  5013.           SCAN_INTEGER; 
  5014.         else 
  5015.         -- issue error message that integer field is missing
  5016.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5017.             EXPONENT_MISSING_INTEGER_FIELD); 
  5018.         end if; 
  5019.       when others => 
  5020.       -- issue an error message that integer field is missing
  5021.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5022.           EXPONENT_MISSING_INTEGER_FIELD); 
  5023.     end case; 
  5024.  
  5025.   end SCAN_EXPONENT; 
  5026.  
  5027.   ------------------------------------------------------------------
  5028.   procedure SCAN_BASED_INTEGER(IN_BASE_TO_USE : in VALID_BASE_RANGE) is 
  5029.  
  5030.     --| Overview
  5031.     --|
  5032.     --| Note the following LRM Sections:
  5033.     --|     LRM Section 2.4   - Numeric Literals
  5034.     --|     LRM Section 2.4.2 - Based Literals
  5035.     --|
  5036.  
  5037.     ------------------------------------------------------------------
  5038.     -- Declarations for Procedure Scan_Based_Integer
  5039.     ------------------------------------------------------------------
  5040.     BAD       : constant GC.PARSERINTEGER := GC.PARSERINTEGER'LAST; 
  5041.  
  5042.     --| an integer value greater than 15 to use as a flag to indicate
  5043.     --| illegal values.
  5044.     TRANSFORM : constant array(CHARACTER) of GC.PARSERINTEGER := 
  5045.  
  5046.     -------- ( nul,  soh,  stx,  etx,     eot,  enq,  ack,  bel,
  5047.     (BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5048.  
  5049.     --------   bs,   ht,   lf,   vt,      ff,   cr,   so,   si,
  5050.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5051.  
  5052.     --------   dle,  dc1,  dc2,  dc3,     dc4,  nak,  syn,  etb,
  5053.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5054.  
  5055.     --------   can,  em,   sub,  esc,     fs,   gs,   rs,   us,
  5056.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5057.  
  5058.     --------   ' ',  '!',  '"',  '#',     '$',  '%',  '&',  ''',
  5059.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5060.  
  5061.     --------   '(',  ')',  '*',  '+',     ',',  '-',  '.',  '/',
  5062.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5063.  
  5064.     --------   '0',  '1',  '2',  '3',     '4',  '5',  '6',  '7',
  5065.     0, 1, 2, 3, 4, 5, 6, 7, 
  5066.  
  5067.     --------   '8',  '9',  ':',  ';',     '<',  '=',  '>',  '?',
  5068.     8, 9, BAD, BAD, BAD, BAD, BAD, BAD, 
  5069.  
  5070.     --------   '@',  'A',  'B',  'C',     'D',  'E',  'F',  'G',
  5071.     BAD, 10, 11, 12, 13, 14, 15, BAD, 
  5072.  
  5073.     --------   'H',  'I',  'J',  'K',     'L',  'M',  'N',  'O',
  5074.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5075.  
  5076.     --------   'P',  'Q',  'R',  'S',     'T',  'U',  'V',  'W',
  5077.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5078.  
  5079.     --------   'X',  'Y',  'Z',  '[',     '\',  ']',  '^',  '_',
  5080.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5081.  
  5082.     --------   '`',  'a',  'b',  'c',     'd',  'e',  'f',  'g',
  5083.     BAD, 10, 11, 12, 13, 14, 15, BAD, 
  5084.  
  5085.     --------   'h',  'i',  'j',  'k',     'l',  'm',  'n',  'o',
  5086.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5087.  
  5088.     --------   'p',  'q',  'r',  's',     't',  'u',  'v',  'w',
  5089.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, 
  5090.  
  5091.     --------   'x',  'y',  'z',  '{',     '|',  '}',  '~',   del);
  5092.     BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD); 
  5093.  
  5094.   --| used to transform a character value to an integer value for
  5095.   --| purpose of checking that a digit is within the legal range
  5096.   --| for the base passed in via In_Base_To_Use.
  5097.  
  5098.   ------------------------------------------------------------------
  5099.   begin
  5100.  
  5101.   -- check that first character, if not an under line,
  5102.   -- is a valid digit for base being used.
  5103.     if (NEXT_CHAR /= ASCII.UNDERLINE) and then (TRANSFORM(NEXT_CHAR) >= 
  5104.       IN_BASE_TO_USE) then 
  5105.     -- flag digit as invalid for base
  5106.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  5107.                                   -- convert to string
  5108.       , LEM.DIGIT_INVALID_FOR_BASE); 
  5109.     end if; 
  5110.  
  5111.     -- scan source file for rest of the field
  5112.     -- note that first character of the field is stored first
  5113.     SCAN_FOR_BASED_INTEGER : loop
  5114.  
  5115.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5116.  
  5117.       -- set up for processing next character
  5118.       GET_NEXT_CHAR; 
  5119.  
  5120.       case NEXT_CHAR is 
  5121.         when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  5122.         -- check if Next_Char is in valid base range
  5123.           if (TRANSFORM(NEXT_CHAR) >= IN_BASE_TO_USE) then 
  5124.           -- flag digit as invalid for base
  5125.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, NEXT_CHAR & ""
  5126.                                               -- convert to string
  5127.             , LEM.DIGIT_INVALID_FOR_BASE); 
  5128.           end if; 
  5129.           -- rest of action is at start of next loop cycle
  5130.         when ASCII.UNDERLINE =>  -- '_'
  5131.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  5132.         when others => 
  5133.           CHECK_FOR_TERMINAL_UNDERLINE; 
  5134.           -- field is terminated by any character except
  5135.           -- extended digit (letters a to f and digits),
  5136.           -- or underline
  5137.           exit SCAN_FOR_BASED_INTEGER;  -- this loop
  5138.       end case; 
  5139.  
  5140.     end loop SCAN_FOR_BASED_INTEGER; 
  5141.     -- Next_Char already updated
  5142.  
  5143.   end SCAN_BASED_INTEGER; 
  5144.  
  5145.   ------------------------------------------------------------------
  5146.   procedure SCAN_INTEGER is 
  5147.  
  5148.   --| Overview
  5149.   --|
  5150.   --| Note the following LRM Sections:
  5151.   --|     LRM Section 2.4   - Numeric Literals
  5152.   --|     LRM Section 2.4.1 - Decimal Literals
  5153.   --|     LRM Section 2.4.1 - Notes
  5154.   --|
  5155.   begin
  5156.  
  5157.   -- scan source file for rest of the field
  5158.   -- note that first character of the field is stored first
  5159.     SCAN_FOR_INTEGER : loop
  5160.  
  5161.       ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5162.  
  5163.       -- set up for processing next character
  5164.       GET_NEXT_CHAR; 
  5165.  
  5166.       case NEXT_CHAR is 
  5167.         when DIGIT => 
  5168.         -- rest of action is at start of next loop cycle
  5169.           null; 
  5170.         when ASCII.UNDERLINE =>  -- '_'
  5171.           CHECK_FOR_CONSECUTIVE_UNDERLINES; 
  5172.         when others => 
  5173.           CHECK_FOR_TERMINAL_UNDERLINE; 
  5174.  
  5175.           -- field is terminated by any character except
  5176.           --     digit, or underline
  5177.           exit SCAN_FOR_INTEGER;  -- this loop
  5178.       end case; 
  5179.  
  5180.     end loop SCAN_FOR_INTEGER;  -- Next_Char already updated
  5181.  
  5182.   end SCAN_INTEGER; 
  5183.  
  5184.   ------------------------------------------------------------------
  5185.   procedure SCAN_NUMERIC_LITERAL is 
  5186.  
  5187.     --| Overview
  5188.     --|
  5189.     --| Note the following LRM Sections:
  5190.     --|     LRM Section 2.4   - Numeric Literals
  5191.     --|     LRM Section 2.4.1 - Decimal Literals
  5192.     --|     LRM Section 2.4.1 - Notes
  5193.     --|     LRM Section 2.4.2 - Based Literals
  5194.     --|     LRM Section 2.10  - Allowed Replacements of Characters
  5195.     --|
  5196.  
  5197.     ------------------------------------------------------------------
  5198.     -- Declarations for Scan_Numeric_Literal
  5199.     ------------------------------------------------------------------
  5200.     BASED_LITERAL_DELIMITER : CHARACTER; 
  5201.  
  5202.     --| holds value of first based_literal delimeter:
  5203.     --| ASCII.COLON (':') or ASCII.SHARP ('#');
  5204.     --| so the second one can be checked to be identical.
  5205.     BASE_BEING_USED         : GC.PARSERINTEGER; 
  5206.  
  5207.   --| base value to be passed to Scan_Based_Literal.
  5208.  
  5209.   ------------------------------------------------------------------
  5210.   begin
  5211.  
  5212.     CST.GRAM_SYM_VAL := PT.NUMERICTOKENVALUE; 
  5213.  
  5214.     WORK_STRING_LENGTH := 0; 
  5215.     -- also used by sub-scanners called from this subprogram.
  5216.  
  5217.     -- Scan first field
  5218.     SCAN_INTEGER; 
  5219.  
  5220.     -- Now, scan rest of literal dependent on what Next_char is
  5221.     case NEXT_CHAR is 
  5222.  
  5223.     -- have a decimal_literal
  5224.       when '.' => 
  5225.         if (LOOK_AHEAD(1) = '.') then 
  5226.         -- next token is a range double delimiter.
  5227.         -- finished with numeric_literal.
  5228.           SEEN_RADIX_POINT := FALSE;  -- have an integer_literal
  5229.           -- already set_up for next scanner,
  5230.           -- no call to Get_Next_Char.
  5231.         else 
  5232.           SEEN_RADIX_POINT := TRUE; 
  5233.           ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5234.           GET_NEXT_CHAR; 
  5235.           case NEXT_CHAR is 
  5236.             when DIGIT => 
  5237.               SCAN_INTEGER; 
  5238.               -- check and flag multiple radix points
  5239.               while (NEXT_CHAR = '.') and then (LOOK_AHEAD(1) in DIGIT) loop
  5240.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5241.                   TOO_MANY_RADIX_POINTS); 
  5242.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5243.                 GET_NEXT_CHAR; 
  5244.                 SCAN_INTEGER; 
  5245.               end loop; 
  5246.             when ASCII.UNDERLINE =>  -- '_'
  5247.             -- flag illegal leading under line
  5248.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5249.                 LEADING_UNDERLINE); 
  5250.               SCAN_INTEGER; 
  5251.               -- not flagging an integer consisting of a
  5252.               -- single underline as a trailing radix
  5253.               -- point case.  Check and flag multiple radix
  5254.               -- points.
  5255.               while (NEXT_CHAR = '.') and then (LOOK_AHEAD(1) in DIGIT) loop
  5256.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5257.                   TOO_MANY_RADIX_POINTS); 
  5258.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5259.                 GET_NEXT_CHAR; 
  5260.                 SCAN_INTEGER; 
  5261.               end loop; 
  5262.             when others => 
  5263.             -- flag trailing radix point as an error
  5264.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5265.                 DIGIT_NEEDED_AFTER_RADIX_POINT); 
  5266.           end case; 
  5267.  
  5268.           SCAN_EXPONENT;  -- check for and process exponent
  5269.  
  5270.         end if; 
  5271.  
  5272.         -- have a based_literal
  5273.       when ASCII.SHARP |  -- '#'
  5274.       ASCII.COLON =>  -- ':'
  5275.         BASED_LITERAL_DELIMITER := NEXT_CHAR; 
  5276.         BASE_BEING_USED := GC.PARSERINTEGER'VALUE(WORK_STRING(1 .. 
  5277.           WORK_STRING_LENGTH)); 
  5278.         if (BASE_BEING_USED not  in VALID_BASE_RANGE) then 
  5279.         -- flag illegal bases as errors
  5280.           LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, WORK_STRING(1 .. 
  5281.             WORK_STRING_LENGTH), LEM.BASE_OUT_OF_LEGAL_RANGE_USE_16); 
  5282.           BASE_BEING_USED := 16; 
  5283.           -- we use the maximum base to pass all the
  5284.           -- extended_digits as legal.
  5285.         end if; 
  5286.  
  5287.         ADD_NEXT_CHAR_TO_SOURCE_REP;  -- save the base delimiter
  5288.         GET_NEXT_CHAR; 
  5289.  
  5290.         case NEXT_CHAR is 
  5291.           when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  5292.             SCAN_BASED_INTEGER(BASE_BEING_USED); 
  5293.           when ASCII.UNDERLINE =>  -- '_'
  5294.           -- flag illegal leading under line
  5295.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5296.               LEADING_UNDERLINE); 
  5297.             -- not flagging an integer consisting of a single
  5298.             -- under line as a trailing radix point case.
  5299.             SCAN_BASED_INTEGER(BASE_BEING_USED); 
  5300.           when '.' => 
  5301.           -- flag leading radix point as an error
  5302.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5303.               DIGIT_NEEDED_BEFORE_RADIX_POINT); 
  5304.           when ASCII.SHARP |  -- '#'
  5305.           ASCII.COLON =>  -- ':'
  5306.           -- flag missing field as an error
  5307.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5308.               NO_INTEGER_IN_BASED_NUMBER); 
  5309.  
  5310.             -- based_literal_delimiter_mismatch handled in
  5311.             -- next case statement.
  5312.           when others => 
  5313.           -- flag missing field as an error
  5314.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5315.               NO_INTEGER_IN_BASED_NUMBER); 
  5316.         end case; 
  5317.  
  5318.         case NEXT_CHAR is 
  5319.           when '.' => 
  5320.             SEEN_RADIX_POINT := TRUE;  -- have a real_literal
  5321.             ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5322.  
  5323.             GET_NEXT_CHAR; 
  5324.             case NEXT_CHAR is 
  5325.               when 'A' .. 'F' | 'a' .. 'f' | DIGIT => 
  5326.                 SCAN_BASED_INTEGER(BASE_BEING_USED); 
  5327.                 -- check and flag multiple radix points
  5328.                 while (NEXT_CHAR = '.') and then ((LOOK_AHEAD(1) in DIGIT) or (
  5329.                   LOOK_AHEAD(1) in 'A' .. 'F') or (LOOK_AHEAD(1) in 'a' .. 'f'))
  5330.                   loop
  5331.                   LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5332.                     TOO_MANY_RADIX_POINTS); 
  5333.                   ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5334.                   GET_NEXT_CHAR; 
  5335.                   SCAN_BASED_INTEGER(BASE_BEING_USED); 
  5336.                 end loop; 
  5337.               when ASCII.UNDERLINE =>  -- '_'
  5338.               -- flag illegal leading under lined
  5339.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5340.                   LEADING_UNDERLINE); 
  5341.                 -- not flagging an integer consisting of
  5342.                 -- a single underline as a trailing
  5343.                 -- radix point case.
  5344.                 SCAN_BASED_INTEGER(BASE_BEING_USED); 
  5345.               when others => 
  5346.               -- flag trailing radix point as an error
  5347.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5348.                   DIGIT_NEEDED_AFTER_RADIX_POINT); 
  5349.             end case; 
  5350.  
  5351.             case NEXT_CHAR is 
  5352.               when ASCII.SHARP |  -- '#'
  5353.               ASCII.COLON =>  -- ':'
  5354.  
  5355.                 ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5356.                 -- save the base delimiter
  5357.  
  5358.                 if (NEXT_CHAR /= BASED_LITERAL_DELIMITER) then 
  5359.                 -- flag based_literal delimiter
  5360.                 -- mismatch as an error
  5361.                   LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "Opener: " & 
  5362.                     BASED_LITERAL_DELIMITER & " Closer: " & NEXT_CHAR, LEM.
  5363.                     BASED_LITERAL_DELIMITER_MISMATCH); 
  5364.                 end if; 
  5365.  
  5366.                 GET_NEXT_CHAR;  -- after base delimiter
  5367.                 -- check for and process exponent
  5368.                 SCAN_EXPONENT; 
  5369.  
  5370.               when others => 
  5371.               -- flag missing second
  5372.               -- based_literal delimiter as an error
  5373.                 LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5374.                   MISSING_SECOND_BASED_LITERAL_DELIMITER); 
  5375.             end case; 
  5376.  
  5377.           when ASCII.SHARP |  -- '#'
  5378.           ASCII.COLON =>  -- ':'
  5379.           -- have an integer_literal
  5380.             SEEN_RADIX_POINT := FALSE; 
  5381.             -- save the base delimiter
  5382.             ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5383.  
  5384.             if (NEXT_CHAR /= BASED_LITERAL_DELIMITER) then 
  5385.             -- flag based_literal delimiter mismatch error
  5386.               LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, "Opener: " & 
  5387.                 BASED_LITERAL_DELIMITER & " Closer: " & NEXT_CHAR, LEM.
  5388.                 BASED_LITERAL_DELIMITER_MISMATCH); 
  5389.             end if; 
  5390.  
  5391.             GET_NEXT_CHAR;  -- get character after base delimiter
  5392.             SCAN_EXPONENT;  -- check for and process exponent
  5393.  
  5394.           when others => 
  5395.           -- assume an integer_literal
  5396.             SEEN_RADIX_POINT := FALSE; 
  5397.             -- flag missing second
  5398.             -- based_literal delimiter as an error
  5399.             LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5400.               MISSING_SECOND_BASED_LITERAL_DELIMITER); 
  5401.         end case; 
  5402.  
  5403.         --we have an integer_literal
  5404.       when others => 
  5405.         SEEN_RADIX_POINT := FALSE;  -- have an integer_literal
  5406.         SCAN_EXPONENT;  -- check for and process exponent
  5407.     end case; 
  5408.  
  5409.     -- one last error check
  5410.     if (NEXT_CHAR in UPPER_CASE_LETTER) or (NEXT_CHAR in LOWER_CASE_LETTER)
  5411.       then 
  5412.     -- flag missing space between numeric_literal and
  5413.     -- identifier (including RW) as an error.
  5414.       LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5415.         SPACE_MUST_SEPARATE_NUM_AND_IDS); 
  5416.     end if; 
  5417.  
  5418.     -- now store the source representation of the token found.
  5419.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  5420.  
  5421.   end SCAN_NUMERIC_LITERAL; 
  5422.  
  5423.   ------------------------------------------------------------------
  5424.   procedure SCAN_STRING_LITERAL is 
  5425.  
  5426.     --| Overview
  5427.     --|
  5428.     --| Note the following LRM Sections:
  5429.     --|     LRM Section 2.6  - String Literals
  5430.     --|     LRM Section 2.6  - Note
  5431.     --|     LRM Section 2.10 - Allowed Replacements of Characters
  5432.     --|
  5433.     STRING_DELIMITER : CHARACTER := NEXT_CHAR; 
  5434.  
  5435.   begin
  5436.  
  5437.     WORK_STRING_LENGTH := 0; 
  5438.  
  5439.     CST.GRAM_SYM_VAL := PT.STRINGTOKENVALUE; 
  5440.  
  5441.     -- scan until matching string delimiter or end of line is found
  5442.     SCAN_FOR_STRING : loop
  5443.       GET_NEXT_CHAR; 
  5444.  
  5445.       if (NEXT_CHAR = STRING_DELIMITER) then 
  5446.         GET_NEXT_CHAR; 
  5447.         if (NEXT_CHAR = STRING_DELIMITER) then 
  5448.         -- add one string delimiter to growing string
  5449.           ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5450.         else  -- string is ended
  5451.           exit SCAN_FOR_STRING; 
  5452.         end if; 
  5453.       elsif (NEXT_CHAR in GRAPHIC_CHARACTER) then 
  5454.       -- add graphic character to growing string
  5455.         ADD_NEXT_CHAR_TO_SOURCE_REP; 
  5456.       elsif (NEXT_CHAR in END_OF_LINE_CHARACTER) then 
  5457.       -- string is ended. flag the error.
  5458.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, LEM.
  5459.           NO_ENDING_STRING_DELIMITER); 
  5460.         exit SCAN_FOR_STRING; 
  5461.       else  -- flag non-graphic characters as errors
  5462.         LEM.OUTPUT_MESSAGE(CURRENT_LINE, CURRENT_COLUMN, INTEGER'IMAGE(CHARACTER
  5463.           'POS(NEXT_CHAR))
  5464.         -- convert to string
  5465.         , LEM.ONLY_GRAPHIC_CHARACTERS_IN_STRINGS); 
  5466.       end if; 
  5467.  
  5468.     end loop SCAN_FOR_STRING;  -- Next_Char already updated
  5469.  
  5470.     -- now store the source representation found without the
  5471.     -- string delimiters
  5472.     SET_CST_SOURCE_REP(WORK_STRING(1 .. WORK_STRING_LENGTH)); 
  5473.  
  5474.     return; 
  5475.  
  5476.   end SCAN_STRING_LITERAL; 
  5477.  
  5478.   ------------------------------------------------------------------
  5479.   function SHOW_CURRENT_LINE return SP.SOURCE_LINE is 
  5480.  
  5481.   --| Overview
  5482.   --| Return current line number
  5483.   begin
  5484.  
  5485.     return CURRENT_LINE; 
  5486.  
  5487.   end SHOW_CURRENT_LINE; 
  5488.  
  5489. ------------------------------------------------------------------
  5490. end LEX; 
  5491.  
  5492. ----------------------------------------------------------------------
  5493. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5494. --lexidval.bdy
  5495. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5496.  
  5497.  
  5498.  
  5499. ----------------------------------------------------------------------
  5500.  
  5501. with GRAMMAR_CONSTANTS;  -- constants from the parser generator
  5502. use GRAMMAR_CONSTANTS; 
  5503. --| to gain visibility on ParserInteger's operations
  5504.  
  5505. package body LEX_IDENTIFIER_TOKEN_VALUE is 
  5506.  
  5507. --| Overview
  5508. --|
  5509. --| This perfect hash algorithm taken from
  5510. --|  "A Perfect Hash Function for Ada Reserved Words"
  5511. --|  by David Wolverton, published in Ada Letters Jul-Aug 1984
  5512. --|
  5513.   use PARSETABLES; 
  5514.   package PT renames PARSETABLES; 
  5515.  
  5516.   ------------------------------------------------------------------
  5517.   -- Declarations Local to Package Lex_Identifier_Token_Value
  5518.   ------------------------------------------------------------------
  5519.  
  5520.   subtype HASHRANGE is INTEGER; 
  5521.   subtype HASHIDENTIFIERSUBRANGE is HASHRANGE range 0 .. 70; 
  5522.  
  5523.   type XLATEARRAY is array(CHARACTER) of HASHRANGE; 
  5524.   XLATE : constant XLATEARRAY := XLATEARRAY'('A' => 0, 'B' => 49, 'C' => 0, 'D'
  5525.     =>  -7, 'E' =>  -20, 'F' => 18, 'G' =>  -2, 'H' =>  -38, 'I' => 33, 'J' => 
  5526.     0, 'K' =>  -9, 'L' => 9, 'M' => 29, 'N' =>  -9, 'O' => 6, 'P' => 26, 'Q' => 
  5527.     0, 'R' => 8, 'S' => 1, 'T' => 1, 'U' =>  -9, 'V' => 0, 'W' => 56, 'X' =>  -
  5528.     28, 'Y' => 11, 'Z' => 0, others => 0); 
  5529.  
  5530.   type HASHTABLEARRAY is array(HASHIDENTIFIERSUBRANGE) of PARSETABLES.TOKENRANGE
  5531.     ; 
  5532.   --| Mapping from hash value into the token values.
  5533.  
  5534.   HASHTABLE  : constant HASHTABLEARRAY := HASHTABLEARRAY'(40 => 2,  -- ABORT
  5535.   6 => 3,  -- ABS
  5536.   37 => 4,  -- ACCEPT
  5537.   43 => 5,  -- ACCESS
  5538.   34 => 6,  -- ALL
  5539.   22 => 7,  -- AND
  5540.   16 => 8,  -- ARRAY
  5541.   3 => 9,  -- AT
  5542.   61 => 10,  -- BEGIN
  5543.   70 => 11,  -- BODY
  5544.   20 => 12,  -- CASE
  5545.   35 => 13,  -- CONSTANT
  5546.   14 => 14,  -- DECLARE
  5547.   9 => 15,  -- DELAY
  5548.   36 => 16,  -- DELTA
  5549.   38 => 17,  -- DIGITS
  5550.   7 => 18,  -- DO
  5551.   0 => 19,  -- ELSE
  5552.   19 => 20,  -- ELSIF
  5553.   2 => 21,  -- END
  5554.   30 => 22,  -- ENTRY
  5555.   8 => 23,  -- EXCEPTION
  5556.   1 => 24,  -- EXIT
  5557.   57 => 25,  -- FOR
  5558.   45 => 26,  -- FUNCTION
  5559.   21 => 27,  -- GENERIC
  5560.   46 => 28,  -- GOTO
  5561.   69 => 29,  -- IF
  5562.   42 => 30,  -- IN
  5563.   52 => 31,  -- IS
  5564.   17 => 32,  -- LIMITED
  5565.   67 => 33,  -- LOOP
  5566.   53 => 34,  -- MOD
  5567.   58 => 35,  -- NEW
  5568.   23 => 36,  -- NOT
  5569.   26 => 37,  -- NULL
  5570.   54 => 38,  -- OF
  5571.   44 => 39,  -- OR
  5572.   47 => 40,  -- OTHERS
  5573.   50 => 41,  -- OUT
  5574.   25 => 42,  -- PACKAGE
  5575.   56 => 43,  -- PRAGMA
  5576.   51 => 44,  -- PRIVATE
  5577.   49 => 45,  -- PROCEDURE
  5578.   29 => 46,  -- RAISE
  5579.   5 => 47,  -- RANGE
  5580.   41 => 48,  -- RECORD
  5581.   48 => 49,  -- REM
  5582.   24 => 50,  -- RENAMES
  5583.   39 => 51,  -- RETURN
  5584.   31 => 52,  -- REVERSE
  5585.   12 => 53,  -- SELECT
  5586.   27 => 54,  -- SEPARATE
  5587.   18 => 55,  -- SUBTYPE
  5588.   32 => 56,  -- TASK
  5589.   28 => 57,  -- TERMINATE
  5590.   4 => 58,  -- THEN
  5591.   15 => 59,  -- TYPE
  5592.   10 => 60,  -- USE
  5593.   59 => 61,  -- WHEN
  5594.   63 => 62,  -- WHILE
  5595.   60 => 63,  -- WITH
  5596.   11 => 64,  -- XOR
  5597.   others => PT.IDENTIFIERTOKENVALUE); 
  5598.  
  5599.   --| These are used to convert lower to upper case.
  5600.   CONVERT    : array(CHARACTER) of CHARACTER; 
  5601.   DIFFERENCE : constant := CHARACTER'POS('a') - CHARACTER'POS('A'); 
  5602.  
  5603.   ------------------------------------------------------------------
  5604.   -- Subprogram Specifications Local to
  5605.   -- Package Lex_Identifier_Token_Value
  5606.   ------------------------------------------------------------------
  5607.  
  5608.   function NORMALIZETOUPPERCASE( --| normalize SYMREP to upper case
  5609.                                 IN_STRING : in STRING) return STRING; 
  5610.  
  5611.   ------------------------------------------------------------------
  5612.   -- Subprogram Bodies Global to Package Lex_Identifier_Token_Value
  5613.   ------------------------------------------------------------------
  5614.  
  5615.   procedure FIND(IN_IDENTIFIER   : in STRING; 
  5616.                  OUT_TOKEN_VALUE : out PARSETABLES.TOKENRANGE) is 
  5617.  
  5618.     subtype ID_STRING is STRING(IN_IDENTIFIER'range ); 
  5619.  
  5620.     IN_IDENTIFIER_NORMALIZED : ID_STRING; 
  5621.  
  5622.     LENGTH                   : HASHRANGE := IN_IDENTIFIER_NORMALIZED'LENGTH; 
  5623.     --| Length of string
  5624.  
  5625.     FIRST                    : HASHRANGE := IN_IDENTIFIER_NORMALIZED'FIRST; 
  5626.     --| Lower bound
  5627.  
  5628.     FIRSTCHAR, LASTCHAR      : CHARACTER; 
  5629.     --| First and last characters
  5630.  
  5631.     SECONDTOLASTCHAR         : CHARACTER; 
  5632.     --| Second to last character
  5633.  
  5634.     SECONDTOLAST             : HASHRANGE; 
  5635.     --| Alphabetic position of 2nd to last char.
  5636.  
  5637.     HASHVALUE                : HASHRANGE; 
  5638.     --| Perfect hash value.
  5639.  
  5640.     TOKENVALUE               : PARSETABLES.GRAMMARSYMBOLRANGE; 
  5641.  
  5642.   begin
  5643.     IN_IDENTIFIER_NORMALIZED := NORMALIZETOUPPERCASE(IN_IDENTIFIER); 
  5644.  
  5645.     -- Assume In_Identifier is a plain identifier.
  5646.     OUT_TOKEN_VALUE := PT.IDENTIFIERTOKENVALUE; 
  5647.  
  5648.     if (LENGTH <= 1) or else (LENGTH >= 10) then 
  5649.  
  5650.       -- Couldn't be a reserved word.
  5651.       return; 
  5652.     else 
  5653.       FIRSTCHAR := IN_IDENTIFIER_NORMALIZED(FIRST); 
  5654.       LASTCHAR := IN_IDENTIFIER_NORMALIZED((FIRST + LENGTH) - 1); 
  5655.       SECONDTOLASTCHAR := IN_IDENTIFIER_NORMALIZED((FIRST + LENGTH) - 2); 
  5656.       SECONDTOLAST := CHARACTER'POS(SECONDTOLASTCHAR) - CHARACTER'POS('A'); 
  5657.       HASHVALUE := XLATE(FIRSTCHAR) + XLATE(LASTCHAR) + 2*SECONDTOLAST + LENGTH
  5658.         ; 
  5659.     end if; 
  5660.  
  5661.     if HASHVALUE in HASHIDENTIFIERSUBRANGE then 
  5662.  
  5663.       -- index and see if it matches a reserved word value.
  5664.       -- if so, then compare the string to the reserved word text.
  5665.       TOKENVALUE := PARSETABLES.GRAMMARSYMBOLRANGE(HASHTABLE(HASHVALUE)); 
  5666.  
  5667.       -- conversion
  5668.       if TOKENVALUE /= PT.IDENTIFIERTOKENVALUE then 
  5669.         if (IN_IDENTIFIER_NORMALIZED = PT.GET_GRAMMAR_SYMBOL(TOKENVALUE)) then 
  5670.           OUT_TOKEN_VALUE := PT.TOKENRANGE(TOKENVALUE); 
  5671.  
  5672.         -- conversion
  5673.         end if; 
  5674.       end if; 
  5675.     end if; 
  5676.   end FIND; 
  5677.  
  5678.   ------------------------------------------------------------------
  5679.   -- Subprogram Bodies Local to
  5680.   -- Package Lex_Identifier_Token_Value
  5681.   ------------------------------------------------------------------
  5682.  
  5683.   function NORMALIZETOUPPERCASE( --| normalize SYMREP to upper case
  5684.                                 IN_STRING : in STRING) return STRING is 
  5685.  
  5686.     OUTSTRING : STRING(IN_STRING'range ); 
  5687.  
  5688.   begin
  5689.     for I in IN_STRING'range loop
  5690.       OUTSTRING(I) := CONVERT(IN_STRING(I)); 
  5691.     end loop; 
  5692.     return OUTSTRING; 
  5693.   end NORMALIZETOUPPERCASE; 
  5694.  
  5695.   ------------------------------------------------------------------
  5696.  
  5697. begin
  5698.  
  5699.   --| Initialize the conversion array for lower to upper case conversion
  5700.   for I in CHARACTER loop
  5701.     case I is 
  5702.       when 'a' .. 'z' => 
  5703.         CONVERT(I) := CHARACTER'VAL(CHARACTER'POS(I) - DIFFERENCE); 
  5704.       when others => 
  5705.         CONVERT(I) := I; 
  5706.     end case; 
  5707.   end loop; 
  5708.  
  5709. ------------------------------------------------------------------
  5710. end LEX_IDENTIFIER_TOKEN_VALUE; 
  5711.  
  5712. ----------------------------------------------------------------------
  5713. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5714. --pdecls.bdy
  5715. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5716.  
  5717.  
  5718. ----------------------------------------------------------------------
  5719.  
  5720. package body PARSERDECLARATIONS is 
  5721.  
  5722.   subtype DUMP_STRING_RANGE_PLUS_ZERO is STANDARD.NATURAL range 0 .. 4000; 
  5723.  
  5724.   DUMP_STRING        : STRING(1 .. DUMP_STRING_RANGE_PLUS_ZERO'LAST); 
  5725.  
  5726.   DUMP_STRING_LENGTH : DUMP_STRING_RANGE_PLUS_ZERO; 
  5727.   -- must be set to zero before each use.
  5728.  
  5729.   ------------------------------------------------------------------
  5730.   -- Subprograms Local to Package ParserDeclarations
  5731.   ------------------------------------------------------------------
  5732.  
  5733.   procedure APPEND_TO_DUMP_STRING( --| Add In_String to Dump_String
  5734.                                   IN_STRING : in STRING --| String to append
  5735.                                   ); 
  5736.  
  5737.   --| Effects
  5738.  
  5739.   --| This subprogram appends In_String to the package Body global
  5740.   --| Dump_String.
  5741.  
  5742.   --| Modifies
  5743.   --|
  5744.   --| Dump_String
  5745.   --| Dump_String_Length
  5746.  
  5747.   ------------------------------------------------------------------
  5748.   -- Subprogram Bodies Global to Package ParserDeclarations
  5749.   -- (declared in package specification).
  5750.   ------------------------------------------------------------------
  5751.  
  5752.   function GET_SOURCE_TEXT(IN_SOURCE_TEXT : in SOURCE_TEXT) return STRING is 
  5753.  
  5754.   begin
  5755.  
  5756.     if (IN_SOURCE_TEXT = NULL_SOURCE_TEXT) then 
  5757.       return ""; 
  5758.     else 
  5759.       return IN_SOURCE_TEXT.all; 
  5760.     end if; 
  5761.  
  5762.   end GET_SOURCE_TEXT; 
  5763.  
  5764.   ------------------------------------------------------------------
  5765.  
  5766.   procedure PUT_SOURCE_TEXT(IN_STRING          : in STRING; 
  5767.                             IN_OUT_SOURCE_TEXT : in out SOURCE_TEXT) is 
  5768.  
  5769.   begin
  5770.  
  5771.     IN_OUT_SOURCE_TEXT := new STRING'(IN_STRING); 
  5772.  
  5773.   end PUT_SOURCE_TEXT; 
  5774.  
  5775.   ------------------------------------------------------------------
  5776.  
  5777.   function DUMP_PARSE_STACK_ELEMENT(IN_PSE : in PARSESTACKELEMENT) return STRING
  5778.     is 
  5779.  
  5780.   --| Notes
  5781.  
  5782.   --| Abbreviations used in this compilation unit
  5783.   --|
  5784.   --| PSE : ParseStackElement
  5785.   --|
  5786.  
  5787.   begin
  5788.  
  5789.     DUMP_STRING_LENGTH := 0; 
  5790.  
  5791.     -- Output data common to all ParseStackElements
  5792.     APPEND_TO_DUMP_STRING("Element Kind:  " & PT.GET_GRAMMAR_SYMBOL(IN_PSE.
  5793.       GRAM_SYM_VAL) & " "
  5794.  
  5795.     -- give extra space to help highlight delimiters
  5796.     ); 
  5797.  
  5798.     -- Output data common to all lexed_tokens
  5799.     APPEND_TO_DUMP_STRING(" Token - Line: " & SP.SOURCE_LINE'IMAGE(IN_PSE.
  5800.       LEXED_TOKEN.SRCPOS_LINE) & " Column: " & SP.SOURCE_COLUMN'IMAGE(IN_PSE.
  5801.       LEXED_TOKEN.SRCPOS_COLUMN)); 
  5802.  
  5803.     APPEND_TO_DUMP_STRING(" Text: %" & GET_SOURCE_TEXT(IN_PSE.LEXED_TOKEN.TEXT)
  5804.       & "%"); 
  5805.  
  5806.     -- Finally, finish up the message
  5807.     APPEND_TO_DUMP_STRING(""); 
  5808.  
  5809.     return DUMP_STRING(1 .. DUMP_STRING_LENGTH); 
  5810.  
  5811.   end DUMP_PARSE_STACK_ELEMENT; 
  5812.  
  5813.   ------------------------------------------------------------------
  5814.   -- Subprogram Bodies Local to Package ParserDeclarations
  5815.   ------------------------------------------------------------------
  5816.  
  5817.   procedure APPEND_TO_DUMP_STRING(IN_STRING : in STRING --| String to append
  5818.                                   ) is 
  5819.  
  5820.   begin
  5821.  
  5822.     DUMP_STRING((DUMP_STRING_LENGTH + 1) .. (DUMP_STRING_LENGTH + IN_STRING'LAST
  5823.       )) := IN_STRING; 
  5824.  
  5825.     DUMP_STRING_LENGTH := DUMP_STRING_LENGTH + IN_STRING'LENGTH; 
  5826.  
  5827.   end APPEND_TO_DUMP_STRING; 
  5828.  
  5829.   ------------------------------------------------------------------
  5830.  
  5831. end PARSERDECLARATIONS; 
  5832.  
  5833. ----------------------------------------------------------------------
  5834. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5835. --parsestk.spc
  5836. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5837.  
  5838. -- $Source: /nosc/work/parser/RCS/ParseStk.spc,v $
  5839. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:33:03 $ -- $Author: carol $
  5840.  
  5841. ----------------------------------------------------------------------
  5842.  
  5843. with PARSERDECLARATIONS;  -- declarations for the Parser
  5844. use PARSERDECLARATIONS; 
  5845.  
  5846. package PARSESTACK is  --| Elements awaiting parsing
  5847.  
  5848. --| Overview
  5849. --|
  5850. --| The ParseStack used by the parser.
  5851. --|
  5852. --| This data structure has the following sets of operations:
  5853. --|
  5854. --| 1) A set that add and delete elements.  This set can
  5855. --| raise the exceptions: UnderFlow and OverFlow.
  5856. --| The set includes:
  5857. --|
  5858. --|     Pop
  5859. --|     Push
  5860. --|     Reduce
  5861. --|
  5862. --| 2) A function that returns the number of elements in the
  5863. --| data structure. This set raises no exceptions.
  5864. --| The set includes:
  5865. --|
  5866. --|     Length
  5867.  
  5868. --|
  5869. --| Notes
  5870. --|
  5871. --|     Under some implementations the exception
  5872. --| ParserDeclarations.MemoryOverflow could be raised.
  5873. --|
  5874.  
  5875.   package PD renames PARSERDECLARATIONS; 
  5876.  
  5877.   ------------------------------------------------------------------
  5878.   -- Declarations Global to Package ParseStack
  5879.   ------------------------------------------------------------------
  5880.  
  5881.   OVERFLOW  : exception; 
  5882.   --| raised if no more space in stack.
  5883.   UNDERFLOW : exception; 
  5884.   --| raised if no more elements in stack.
  5885.  
  5886.   ------------------------------------------------------------------
  5887.  
  5888.   procedure PUSH( --| Adds new top element to stack
  5889.                  ELEMENT : in PD.PARSESTACKELEMENT);  --| element to add
  5890.  
  5891.   --| Raises
  5892.   --|
  5893.   --| OverFlow - no more space in stack.
  5894.  
  5895.   --| Effects
  5896.   --|
  5897.   --| This subprogram adds an element to the top of the stack.
  5898.   --|
  5899.  
  5900.   ------------------------------------------------------------------
  5901.  
  5902.   function POP --| Removes top element in stack
  5903.   return PD.PARSESTACKELEMENT; 
  5904.  
  5905.   --| Raises
  5906.   --|
  5907.   --| UnderFlow - no more elements in stack.
  5908.  
  5909.   --| Effects
  5910.   --|
  5911.   --| This subprogram obtains the element at the top of the stack.
  5912.   --|
  5913.  
  5914.   ------------------------------------------------------------------
  5915.  
  5916.   function LENGTH --| Returns the number of
  5917.   --| elements in the stack
  5918.   return PD.STATEPARSESTACKSINDEX; 
  5919.  
  5920.   --| Effects
  5921.   --|
  5922.   --| This subprogram returns the number of elements in the stack.
  5923.   --|
  5924.  
  5925.   ----------------------------------------------------------------------
  5926.  
  5927.   procedure REDUCE( --| Pops and discards top n elements on
  5928.   --| the stack.
  5929.                    TOPN : in PD.STATEPARSESTACKSINDEX); 
  5930.   --| Number of elements to pop.
  5931.  
  5932.   --| Raises
  5933.   --|
  5934.   --| Underflow - no more elements in stack.
  5935.  
  5936.   --| Effects
  5937.   --|
  5938.   --| Pops and discards top N elements on the stack.
  5939.   --| If TopN is greater than the number of elements in the stack,
  5940.   --| Underflow is raised.
  5941.   --| This subprogram is used by the parser to reduce the stack during
  5942.   --| a reduce action.
  5943.   --| This stack reduction could be done with a for loop and
  5944.   --| the Pop subprogram at a considerable cost in execution time.
  5945.   --|
  5946.  
  5947.   ----------------------------------------------------------------------
  5948.  
  5949. end PARSESTACK; 
  5950.  
  5951. ----------------------------------------------------------------------
  5952. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5953. --statestk.spc
  5954. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5955.  
  5956. -- $Source: /nosc/work/parser/RCS/StateStk.spc,v $
  5957. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:43:44 $ -- $Author: carol $
  5958.  
  5959. ----------------------------------------------------------------------
  5960.  
  5961. with PARSERDECLARATIONS;  -- declarations for the Parser
  5962. use PARSERDECLARATIONS; 
  5963.  
  5964. package STATESTACK is  --| Elements awaiting parsing
  5965.  
  5966. --| Overview
  5967. --|
  5968. --| The StateStack used by the parser.
  5969. --|
  5970. --| This data structure has the following sets of operations:
  5971. --|
  5972. --| 1) A set that add and delete elements.
  5973. --| This set can raise the exceptions Underflow and Overflow.
  5974. --| The set includes:
  5975. --|
  5976. --|     Pop
  5977. --|     Push
  5978. --|     Reduce
  5979. --|
  5980. --| 2) A function that returns the number of elements in the
  5981. --| data structure.
  5982. --| This set raises no exceptions.
  5983. --| The set includes:
  5984. --|
  5985. --|     Length
  5986. --|
  5987. --| 3) A copy operations, to return the top of the stack.
  5988. --| The exception, UnderFlow,
  5989. --| is utilized to indicate the end of a sequential examination.
  5990. --| The set includes:
  5991. --|
  5992. --|     CopyTop
  5993. --|     InitCopy
  5994. --|     CopyNext
  5995.  
  5996. --| Notes
  5997. --|
  5998. --|     Under some implementations the exception
  5999. --| ParserDeclarations.MemoryOverflow could be raised.
  6000. --|
  6001.  
  6002. ------------------------------------------------------------------
  6003. -- Declarations Global to Package StateStack
  6004. ------------------------------------------------------------------
  6005.  
  6006.   OVERFLOW  : exception; 
  6007.   --| raised if no more space in stack.
  6008.   UNDERFLOW : exception; 
  6009.   --| raised if no more elements in stack.
  6010.  
  6011.   ------------------------------------------------------------------
  6012.  
  6013.   procedure PUSH( --| Adds new top element to stack
  6014.                  ELEMENT : in STATESTACKELEMENT);  --| element to add
  6015.  
  6016.   --|
  6017.   --| Raises
  6018.   --|
  6019.   --| OverFlow - no more space in stack.
  6020.  
  6021.   --| Effects
  6022.   --|
  6023.   --| This subprogram adds an element to the top of the stack.
  6024.   --|
  6025.  
  6026.   ------------------------------------------------------------------
  6027.  
  6028.   function POP return STATESTACKELEMENT;  --| Removes top element in stack
  6029.  
  6030.   --| Raises
  6031.   --|
  6032.   --| UnderFlow - no more elements in stack.
  6033.  
  6034.   --| Effects
  6035.   --|
  6036.   --| This subprogram pops the element at the top of the stack.
  6037.   --|
  6038.  
  6039.   ------------------------------------------------------------------
  6040.  
  6041.   function COPYTOP return STATESTACKELEMENT; 
  6042.   --| Copy top element in stack
  6043.  
  6044.   --| Raises
  6045.   --|
  6046.   --| UnderFlow - no more elements in stack.
  6047.   --|
  6048.  
  6049.   --| Effects
  6050.   --|
  6051.   --| Returns the top of the stack.
  6052.  
  6053.   ------------------------------------------------------------------
  6054.  
  6055.   function COPYNEXT return STATESTACKELEMENT; 
  6056.   --| Copy element after previous one copied
  6057.  
  6058.   --| Raises
  6059.   --|
  6060.   --| UnderFlow - no more elements in stack.
  6061.  
  6062.   --| Effects
  6063.   --|
  6064.   --| This subprogram is used in conjunction with
  6065.   --| CopyTop or Init Copy to sequentially examine the stack.
  6066.   --|
  6067.  
  6068.   ------------------------------------------------------------------
  6069.  
  6070.   function LENGTH return STATEPARSESTACKSINDEX; 
  6071.   --| Returns the number of elements in the stack
  6072.  
  6073.   --| Effects
  6074.   --|
  6075.   --| This subprogram returns the number of elements in the stack.
  6076.   --|
  6077.  
  6078.   ------------------------------------------------------------------
  6079.  
  6080.   procedure INITCOPY;  --| Initialize sequential examination of
  6081.   --| the data structure
  6082.  
  6083.   --| Effects
  6084.   --|
  6085.   --| Initializes the copy function,
  6086.   --| so that subsequent calls to CopyNext will sequentially examine
  6087.   --| the elements in the data structure.
  6088.   --|
  6089.  
  6090.   ------------------------------------------------------------------
  6091.  
  6092.   function COPYTHISONE( --| returns element given by parm 'which_one'
  6093.                        WHICH_ONE : in STATEPARSESTACKSRANGE) return
  6094.     STATESTACKELEMENT; 
  6095.  
  6096.   --| Overview
  6097.   --|
  6098.   --| Returns the state stack element indicated by the parameter
  6099.   --| 'which_one'.  This operation is needed by LocalStateStack
  6100.   --| because, in essence, the state stack is being copied in two
  6101.   --| nested loops and the Next_To_Copy counter can therefore only
  6102.   --| be used for one of the series of copies.
  6103.  
  6104.   ------------------------------------------------------------------
  6105.  
  6106.   procedure REDUCE( --| Pops and discards top n elements on
  6107.   --| the stack.
  6108.                    TOPN : in STATEPARSESTACKSINDEX); 
  6109.                                       --| Number of elements to pop.
  6110.  
  6111.   --| Raises:
  6112.   --|
  6113.   --| Underflow - no more elements in stack.
  6114.  
  6115.   --| Effects
  6116.   --|
  6117.   --| Pops and discards TopN elements on the stack.
  6118.   --| If TopN is greater than the number of elements in the stack,
  6119.   --| Underflow is raised.
  6120.   --| This subprogram is used by the parser to reduce the stack during
  6121.   --| a reduce action.
  6122.   --| This stack reduction could be done with a for
  6123.   --| loop and the Pop subprogram at a considerable cost in execution
  6124.   --| time.
  6125.   --|
  6126.  
  6127.   ------------------------------------------------------------------
  6128.  
  6129. end STATESTACK; 
  6130.  
  6131. ----------------------------------------------------------------------
  6132. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6133. --parse.spc
  6134. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6135.  
  6136. -- $Source: /nosc/work/parser/RCS/Parse.spc,v $
  6137. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:48:41 $ -- $Author: carol $
  6138.  
  6139. ----------------------------------------------------------------------
  6140.  
  6141. with PARSERDECLARATIONS;  -- declarations for the Parser
  6142. use PARSERDECLARATIONS; 
  6143.  
  6144. package PARSER is 
  6145.  
  6146. --| Notes
  6147. --| 
  6148. --| WARNING:
  6149. --| 
  6150. --| Some of the code for this package is in the grammar source that is
  6151. --| input to the parse table generator. One of the ouputs of the
  6152. --| parse table generator is the source for the body of the procedure
  6153. --| Apply_Actions used in this package. This procedure provides case
  6154. --| statements to select the number of the rule to be used.
  6155. --| This procedure is declared as separate subunits in the
  6156. --| body of this package. It is strongly recommended that
  6157. --| the code of these functions be kept integrated with the grammar
  6158. --| for the following reasons.
  6159. --|
  6160. --| 1) to keep the case select numbers consistent with the reduce
  6161. --| action numbers in the parse tables.
  6162. --| 
  6163. --| 2) to associate each grammar rule with the code for its actions.
  6164. --| 
  6165.  
  6166.   package PD renames PARSERDECLARATIONS; 
  6167.  
  6168.   ------------------------------------------------------------------
  6169.  
  6170.   procedure APPLY_ACTIONS(RULE_NUMBER : in PT.LEFTHANDSIDERANGE); 
  6171.  
  6172.   ------------------------------------------------------------------
  6173.  
  6174.   function PARSE --| NYU LALR style parser
  6175.   return PD.PARSESTACKELEMENT; 
  6176.  
  6177.   --| Raises
  6178.   --|
  6179.   --| ParserDeclarations.MemoryOverflow
  6180.   --|
  6181.  
  6182.   --| Effects
  6183.   --|
  6184.   --| This parser takes input from a Lexer and parses it according
  6185.   --| to a set of grammar rules that have been converted into a set of
  6186.   --| ParseTables by the NYU LALR Parser Generator.
  6187.  
  6188.   --| Requires
  6189.   --|
  6190.   --| The parser expects the Lexer and other units it uses to be
  6191.   --| initialized.
  6192.   --|
  6193.   --| The units that stay the same for different grammars are:
  6194.   --|
  6195.   --| Parser.Parse (this subprogram)
  6196.   --| ParseStack
  6197.   --|
  6198.   --| The units that need to be changed for different grammars are:
  6199.   --|
  6200.   --| Parser.Apply_Actions
  6201.   --| Lex
  6202.   --| ParserDeclarations
  6203.   --| ParseTables
  6204.   --|
  6205.  
  6206.   --| Modifies
  6207.   --|
  6208.   --| The following are modified:
  6209.   --|
  6210.   --| ParseStack
  6211.   --|
  6212.  
  6213.   ------------------------------------------------------------------
  6214.  
  6215. end PARSER; 
  6216.  
  6217. ----------------------------------------------------------------------
  6218. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6219. --parsestk.bdy
  6220. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6221.  
  6222. -- $Source: /nosc/work/parser/RCS/ParseStk.bdy,v $
  6223. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:34:13 $ -- $Author: carol $
  6224.  
  6225. ----------------------------------------------------------------------
  6226.  
  6227. with PARSETABLES;  -- state tables generated by parser
  6228. --     generator
  6229. use PARSETABLES; 
  6230.  
  6231. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS; 
  6232.                                 -- to have visibility on operations
  6233. -- on type ParserInteger declared there.
  6234. package body PARSESTACK is 
  6235.  
  6236. --| Overview
  6237. --|
  6238. --| The data structure is implemented as an array.
  6239. --|
  6240.  
  6241. ------------------------------------------------------------------
  6242. -- Declarations Global to Package Body ParseStack
  6243. ------------------------------------------------------------------
  6244.  
  6245.   INDEX : PD.STATEPARSESTACKSINDEX := 0; 
  6246.   --| top element in stack.
  6247.  
  6248.   SPACE : array(PD.STATEPARSESTACKSRANGE) of PD.PARSESTACKELEMENT; 
  6249.   --| Storage used to hold stack elements
  6250.  
  6251.   ------------------------------------------------------------------
  6252.   -- Subprogram Bodies Global to Package ParseStack
  6253.   -- (declared in package specification).
  6254.   ------------------------------------------------------------------
  6255.  
  6256.   procedure PUSH(ELEMENT : in PD.PARSESTACKELEMENT) is 
  6257.  
  6258.   begin
  6259.  
  6260.     if (INDEX >= PD.STATEPARSESTACKSRANGE'LAST) then 
  6261.       raise OVERFLOW; 
  6262.     end if; 
  6263.  
  6264.     INDEX := INDEX + 1; 
  6265.     SPACE(INDEX) := ELEMENT; 
  6266.  
  6267.   end PUSH; 
  6268.  
  6269.   ------------------------------------------------------------------
  6270.  
  6271.   function POP return PD.PARSESTACKELEMENT is 
  6272.  
  6273.   begin
  6274.  
  6275.     if (INDEX < PD.STATEPARSESTACKSRANGE'FIRST) then 
  6276.       raise UNDERFLOW; 
  6277.     end if; 
  6278.  
  6279.     INDEX := INDEX - 1; 
  6280.     return SPACE(INDEX + 1); 
  6281.  
  6282.   end POP; 
  6283.  
  6284.   ------------------------------------------------------------------
  6285.  
  6286.   function LENGTH return PD.STATEPARSESTACKSINDEX is 
  6287.  
  6288.   begin
  6289.  
  6290.     return INDEX; 
  6291.  
  6292.   end LENGTH; 
  6293.  
  6294.   ------------------------------------------------------------------
  6295.  
  6296.   procedure REDUCE(TOPN : in PD.STATEPARSESTACKSINDEX) is 
  6297.  
  6298.   begin
  6299.     if (TOPN > INDEX) then 
  6300.       raise UNDERFLOW; 
  6301.     end if; 
  6302.  
  6303.     INDEX := INDEX - TOPN; 
  6304.  
  6305.   end REDUCE;  -- procedure
  6306.  
  6307.   ------------------------------------------------------------------
  6308.  
  6309. end PARSESTACK; 
  6310.  
  6311. ----------------------------------------------------------------------
  6312. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6313. --statestk.bdy
  6314. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6315.  
  6316. -- $Source: /nosc/work/parser/RCS/StateStk.bdy,v $
  6317. -- $Revision: 4.0 $ -- $Date: 85/02/19 11:45:59 $ -- $Author: carol $
  6318.  
  6319. ----------------------------------------------------------------------
  6320.  
  6321. with PARSETABLES;  -- state tables generated
  6322. -- by parser generator
  6323. use PARSETABLES; 
  6324. with GRAMMAR_CONSTANTS;  -- constants generated by parser generator
  6325. use GRAMMAR_CONSTANTS;  -- to have visiblity on operations
  6326. -- on type ParserInteger.
  6327.  
  6328. package body STATESTACK is 
  6329.  
  6330. --| Overview
  6331. --|
  6332. --| The data structure is implemented as an array.
  6333. --|
  6334.  
  6335. --| Notes
  6336. --|
  6337. --| Abbreviations used in this compilation unit:
  6338. --|
  6339. --| Init : used as prefix for Initialize
  6340. --|
  6341.  
  6342. ------------------------------------------------------------------
  6343. -- Declarations Global to Package Body StateStack
  6344. ------------------------------------------------------------------
  6345.  
  6346.   INDEX        : STATEPARSESTACKSINDEX := 0; 
  6347.   --| top element in stack.
  6348.   NEXT_TO_COPY : STATEPARSESTACKSINDEX := 0; 
  6349.   --| next element to copy in stack.
  6350.  
  6351.   SPACE        : array(STATEPARSESTACKSRANGE) of STATESTACKELEMENT; 
  6352.   --| Storage used to hold stack elements
  6353.  
  6354.  
  6355.   ------------------------------------------------------------------
  6356.   -- Subprogram Bodies Global to Package StateStack
  6357.   -- (declared in package specification).
  6358.   ------------------------------------------------------------------
  6359.  
  6360.   procedure PUSH(ELEMENT : in STATESTACKELEMENT) is 
  6361.  
  6362.   begin
  6363.  
  6364.     if (INDEX >= STATEPARSESTACKSRANGE'LAST) then 
  6365.       raise OVERFLOW; 
  6366.     end if; 
  6367.  
  6368.     INDEX := INDEX + 1; 
  6369.     SPACE(INDEX) := ELEMENT; 
  6370.  
  6371.   end PUSH; 
  6372.  
  6373.   ------------------------------------------------------------------
  6374.  
  6375.   function POP return STATESTACKELEMENT is 
  6376.  
  6377.   begin
  6378.  
  6379.     if (INDEX < STATEPARSESTACKSRANGE'FIRST) then 
  6380.       raise UNDERFLOW; 
  6381.     end if; 
  6382.  
  6383.     INDEX := INDEX - 1; 
  6384.     return SPACE(INDEX + 1); 
  6385.  
  6386.   end POP; 
  6387.  
  6388.   ------------------------------------------------------------------
  6389.  
  6390.   function COPYTOP return STATESTACKELEMENT is 
  6391.  
  6392.   begin
  6393.  
  6394.     INITCOPY; 
  6395.     return COPYNEXT; 
  6396.  
  6397.   end COPYTOP; 
  6398.  
  6399.   ------------------------------------------------------------------
  6400.  
  6401.   function COPYNEXT return STATESTACKELEMENT is 
  6402.  
  6403.   begin
  6404.  
  6405.     NEXT_TO_COPY := NEXT_TO_COPY - 1; 
  6406.  
  6407.     if (NEXT_TO_COPY < STATEPARSESTACKSRANGE'FIRST) then 
  6408.       raise UNDERFLOW; 
  6409.     end if; 
  6410.  
  6411.     return SPACE(NEXT_TO_COPY); 
  6412.  
  6413.   end COPYNEXT; 
  6414.  
  6415.   ------------------------------------------------------------------
  6416.  
  6417.   function LENGTH return STATEPARSESTACKSINDEX is 
  6418.  
  6419.   begin
  6420.  
  6421.     return INDEX; 
  6422.  
  6423.   end LENGTH; 
  6424.  
  6425.   ------------------------------------------------------------------
  6426.  
  6427.   procedure INITCOPY is 
  6428.  
  6429.   begin
  6430.  
  6431.     NEXT_TO_COPY := INDEX + 1; 
  6432.  
  6433.   -- start examination here
  6434.   end INITCOPY; 
  6435.  
  6436.   ------------------------------------------------------------------
  6437.  
  6438.   function COPYTHISONE( --| returns the which_oneth element
  6439.                        WHICH_ONE : in STATEPARSESTACKSRANGE) return
  6440.     STATESTACKELEMENT is 
  6441.  
  6442.   begin
  6443.  
  6444.     if WHICH_ONE > INDEX then 
  6445.       raise OVERFLOW; 
  6446.     end if; 
  6447.  
  6448.     return (SPACE(WHICH_ONE)); 
  6449.  
  6450.   end COPYTHISONE; 
  6451.  
  6452.   ------------------------------------------------------------------
  6453.  
  6454.   procedure REDUCE(TOPN : in STATEPARSESTACKSINDEX) is 
  6455.  
  6456.   begin
  6457.  
  6458.     if (TOPN > INDEX) then 
  6459.       raise UNDERFLOW; 
  6460.     end if; 
  6461.  
  6462.     INDEX := INDEX - TOPN; 
  6463.  
  6464.   end REDUCE; 
  6465.  
  6466.   ------------------------------------------------------------------
  6467.  
  6468. end STATESTACK; 
  6469.  
  6470. ----------------------------------------------------------------------
  6471. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6472. --PTBLS.BDY
  6473. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6474. --+ PTBLS.BDY +--
  6475.  
  6476. package body ParseTables is
  6477. ----------------------------------------------------------------------
  6478. -- The rest of the constants used to define the Parse Tables
  6479. ----------------------------------------------------------------------
  6480.  
  6481.     DefaultValue : constant := 1 ; -- default for aggregates.
  6482.     
  6483.     ActionTableOneLength : constant GC.ParserInteger :=
  6484.          8610 ;
  6485.         --| Length (number of entries) in map ActionTableOne.
  6486.     subtype ActionTableOneRange is GC.ParserInteger
  6487.             range 1..ActionTableOneLength;
  6488.     
  6489.     ActionTableTwoLength : constant GC.ParserInteger :=
  6490.          8610 ;
  6491.         --| Length (number of entries) in map ActionTableTwo.
  6492.     subtype ActionTableTwoRange is GC.ParserInteger
  6493.             range 1..ActionTableTwoLength;
  6494.     
  6495.     DefaultMapLength : constant GC.ParserInteger :=
  6496.          1043 ;
  6497.         --| Length (number of entries) in map Defaults.
  6498.     subtype DefaultMapRange is GC.ParserInteger range 1..DefaultMapLength;
  6499.     
  6500.     FollowMapLength : constant GC.ParserInteger :=
  6501.           298 ;
  6502.         --| Length (number of entries) in the FollowMap.
  6503.     
  6504.     GrammarSymbolCountPlusOne : constant GC.ParserInteger :=
  6505.           395 ;
  6506.         --| Number of symbols plus one in the parse tables.
  6507.         -- NYU Reference Name: NUM_INPUTS
  6508.     
  6509.     ActionTableSize : constant GC.ParserInteger :=
  6510.          5737 ;
  6511.         --| Maximum entry in Action Tables referenced by hash
  6512.         --| function. Entries above TableSize are collision chains.
  6513.         -- NYU Reference Name: TABLE_SIZE
  6514.     
  6515.     ------------------------------------------------------------------
  6516.     -- Tables generated by Parse Tables Generator
  6517.     ------------------------------------------------------------------
  6518.  
  6519.     subtype GrammarSymbolRepRangePlusZero is
  6520.         GrammarSymbolRepRangePlusZeroCommon;
  6521.  
  6522.     GrammarSymbolTableIndex : constant
  6523.         array (GrammarSymbolRange'first .. GrammarSymbolRange'last * 2)
  6524.         of GC.ParserInteger :=
  6525.          (    1,    0,    1,    5,    6,    8,    9,   14,   15,   20
  6526. ,   21,   23,   24,   26,   27,   31,   32,   33,   34,   38
  6527. ,   39,   42,   43,   46,   47,   54,   55,   61,   62,   66
  6528. ,   67,   71,   72,   77,   78,   79,   80,   83,   84,   88
  6529. ,   89,   91,   92,   96,   97,  105,  106,  109,  110,  112
  6530. ,  113,  120,  121,  127,  128,  131,  132,  133,  134,  135
  6531. ,  136,  137,  138,  144,  145,  148,  149,  151,  152,  154
  6532. ,  155,  157,  158,  161,  162,  163,  164,  165,  166,  171
  6533. ,  172,  174,  175,  181,  182,  187,  188,  194,  195,  203
  6534. ,  204,  208,  209,  213,  214,  219,  220,  222,  223,  229
  6535. ,  230,  235,  236,  242,  243,  248,  249,  256,  257,  263
  6536. ,  264,  267,  268,  276,  277,  280,  281,  284,  285,  287
  6537. ,  288,  291,  292,  296,  297,  300,  301,  303,  304,  313
  6538. ,  314,  328,  329,  342,  343,  359,  360,  360,  361,  361
  6539. ,  362,  362,  363,  363,  364,  364,  365,  365,  366,  366
  6540. ,  367,  367,  368,  368,  369,  369,  370,  370,  371,  371
  6541. ,  372,  372,  373,  373,  374,  374,  375,  377,  378,  379
  6542. ,  380,  381,  382,  383,  384,  385,  386,  387,  388,  389
  6543. ,  390,  391,  392,  393,  394,  395,  396,  397,  398,  412
  6544. ,  413,  416,  417,  420,  421,  431,  432,  461,  462,  467
  6545. ,  468,  483,  484,  500,  501,  519,  520,  541,  542,  560
  6546. ,  561,  578,  579,  599,  600,  620,  621,  640,  641,  658
  6547. ,  659,  681,  682,  699,  700,  720,  721,  746,  747,  761
  6548. ,  762,  779,  780,  793,  794,  802,  803,  830,  831,  837
  6549. ,  838,  847,  848,  862,  863,  880,  881,  901,  902,  928
  6550. ,  929,  952,  953,  967,  968,  982,  983,  992,  993, 1018
  6551. , 1019, 1047, 1048, 1058, 1059, 1085, 1086, 1108, 1109, 1128
  6552. , 1129, 1149, 1150, 1171, 1172, 1193, 1194, 1216, 1217, 1225
  6553. , 1226, 1235, 1236, 1257, 1258, 1273, 1274, 1298, 1299, 1320
  6554. , 1321, 1339, 1340, 1356, 1357, 1389, 1390, 1425, 1426, 1444
  6555. , 1445, 1472, 1473, 1490, 1491, 1515, 1516, 1545, 1546, 1561
  6556. , 1562, 1585, 1586, 1612, 1613, 1629, 1630, 1645, 1646, 1649
  6557. , 1650, 1663, 1664, 1680, 1681, 1685, 1686, 1705, 1706, 1720
  6558. , 1721, 1734, 1735, 1747, 1748, 1770, 1771, 1791, 1792, 1812
  6559. , 1813, 1836, 1837, 1848, 1849, 1862, 1863, 1882, 1883, 1918
  6560. , 1919, 1938, 1939, 1981, 1982, 1988, 1989, 2012, 2013, 2018
  6561. , 2019, 2027, 2028, 2051, 2052, 2067, 2068, 2071, 2072, 2095
  6562. , 2096, 2117, 2118, 2138, 2139, 2148, 2149, 2170, 2171, 2181
  6563. , 2182, 2190, 2191, 2205, 2206, 2217, 2218, 2226, 2227, 2243
  6564. , 2244, 2261, 2262, 2270, 2271, 2278, 2279, 2298, 2299, 2320
  6565. , 2321, 2329, 2330, 2363, 2364, 2384, 2385, 2411, 2412, 2441
  6566. , 2442, 2459, 2460, 2488, 2489, 2523, 2524, 2561, 2562, 2569
  6567. , 2570, 2592, 2593, 2614, 2615, 2637, 2638, 2666, 2667, 2694
  6568. , 2695, 2734, 2735, 2741, 2742, 2798, 2799, 2834, 2835, 2838
  6569. , 2839, 2845, 2846, 2879, 2880, 2885, 2886, 2915, 2916, 2939
  6570. , 2940, 2948, 2949, 2968, 2969, 2987, 2988, 3009, 3010, 3030
  6571. , 3031, 3050, 3051, 3073, 3074, 3086, 3087, 3098, 3099, 3107
  6572. , 3108, 3118, 3119, 3140, 3141, 3156, 3157, 3174, 3175, 3182
  6573. , 3183, 3193, 3194, 3213, 3214, 3227, 3228, 3239, 3240, 3255
  6574. , 3256, 3269, 3270, 3284, 3285, 3299, 3300, 3314, 3315, 3328
  6575. , 3329, 3342, 3343, 3354, 3355, 3368, 3369, 3382, 3383, 3397
  6576. , 3398, 3413, 3414, 3429, 3430, 3434, 3435, 3473, 3474, 3521
  6577. , 3522, 3551, 3552, 3560, 3561, 3580, 3581, 3650, 3651, 3682
  6578. , 3683, 3708, 3709, 3729, 3730, 3747, 3748, 3760, 3761, 3772
  6579. , 3773, 3786, 3787, 3801, 3802, 3834, 3835, 3848, 3849, 3892
  6580. , 3893, 3916, 3917, 3935, 3936, 3951, 3952, 3975, 3976, 3991
  6581. , 3992, 4014, 4015, 4040, 4041, 4050, 4051, 4054, 4055, 4076
  6582. , 4077, 4104, 4105, 4120, 4121, 4141, 4142, 4170, 4171, 4195
  6583. , 4196, 4211, 4212, 4246, 4247, 4272, 4273, 4284, 4285, 4299
  6584. , 4300, 4325, 4326, 4369, 4370, 4401, 4402, 4433, 4434, 4464
  6585. , 4465, 4481, 4482, 4508, 4509, 4565, 4566, 4590, 4591, 4604
  6586. , 4605, 4626, 4627, 4642, 4643, 4657, 4658, 4675, 4676, 4699
  6587. , 4700, 4746, 4747, 4772, 4773, 4790, 4791, 4807, 4808, 4828
  6588. , 4829, 4860, 4861, 4884, 4885, 4915, 4916, 4927, 4928, 4967
  6589. , 4968, 4980, 4981, 4991, 4992, 5023, 5024, 5053, 5054, 5060
  6590. , 5061, 5078, 5079, 5091, 5092, 5107, 5108, 5121, 5122, 5146
  6591. , 5147, 5153, 5154, 5178, 5179, 5195, 5196, 5215, 5216, 5226
  6592. , 5227, 5255, 5256, 5275, 5276, 5291, 5292, 5308, 5309, 5322
  6593. , 5323, 5369, 5370, 5387, 5388, 5413, 5414, 5429, 5430, 5448
  6594. , 5449, 5464, 5465, 5495, 5496, 5524, 5525, 5547, 5548, 5570
  6595. , 5571, 5588, 5589, 5610, 5611, 5629, 5630, 5651, 5652, 5675
  6596. , 5676, 5727, 5728, 5751, 5752, 5775, 5776, 5788, 5789, 5821
  6597. , 5822, 5835, 5836, 5863, 5864, 5886, 5887, 5905, 5906, 5921
  6598. , 5922, 5937, 5938, 5953, 5954, 5965, 5966, 5980, 5981, 5989
  6599. , 5990, 5998, 5999, 6052, 6053, 6077, 6078, 6090, 6091, 6103
  6600. , 6104, 6118, 6119, 6140, 6141, 6168, 6169, 6186, 6187, 6217
  6601. , 6218, 6229, 6230, 6248, 6249, 6271, 6272, 6302, 6303, 6317
  6602. , 6318, 6336, 6337, 6354, 6355, 6370, 6371, 6397, 6398, 6413
  6603. , 6414, 6432, 6433, 6458, 6459, 6489, 6490, 6515)  ;
  6604.         
  6605.     GrammarSymbolTable : constant String :=
  6606.          ('A','B','O','R','T','A','B','S','A','C'
  6607. ,'C','E','P','T','A','C','C','E','S','S'
  6608. ,'A','L','L','A','N','D','A','R','R','A'
  6609. ,'Y','A','T','B','E','G','I','N','B','O'
  6610. ,'D','Y','C','A','S','E','C','O','N','S'
  6611. ,'T','A','N','T','D','E','C','L','A','R'
  6612. ,'E','D','E','L','A','Y','D','E','L','T'
  6613. ,'A','D','I','G','I','T','S','D','O','E'
  6614. ,'L','S','E','E','L','S','I','F','E','N'
  6615. ,'D','E','N','T','R','Y','E','X','C','E'
  6616. ,'P','T','I','O','N','E','X','I','T','F'
  6617. ,'O','R','F','U','N','C','T','I','O','N'
  6618. ,'G','E','N','E','R','I','C','G','O','T'
  6619. ,'O','I','F','I','N','I','S','L','I','M'
  6620. ,'I','T','E','D','L','O','O','P','M','O'
  6621. ,'D','N','E','W','N','O','T','N','U','L'
  6622. ,'L','O','F','O','R','O','T','H','E','R'
  6623. ,'S','O','U','T','P','A','C','K','A','G'
  6624. ,'E','P','R','A','G','M','A','P','R','I'
  6625. ,'V','A','T','E','P','R','O','C','E','D'
  6626. ,'U','R','E','R','A','I','S','E','R','A'
  6627. ,'N','G','E','R','E','C','O','R','D','R'
  6628. ,'E','M','R','E','N','A','M','E','S','R'
  6629. ,'E','T','U','R','N','R','E','V','E','R'
  6630. ,'S','E','S','E','L','E','C','T','S','E'
  6631. ,'P','A','R','A','T','E','S','U','B','T'
  6632. ,'Y','P','E','T','A','S','K','T','E','R'
  6633. ,'M','I','N','A','T','E','T','H','E','N'
  6634. ,'T','Y','P','E','U','S','E','W','H','E'
  6635. ,'N','W','H','I','L','E','W','I','T','H'
  6636. ,'X','O','R','i','d','e','n','t','i','f'
  6637. ,'i','e','r','n','u','m','e','r','i','c'
  6638. ,'_','l','i','t','e','r','a','l','s','t'
  6639. ,'r','i','n','g','_','l','i','t','e','r'
  6640. ,'a','l','c','h','a','r','a','c','t','e'
  6641. ,'r','_','l','i','t','e','r','a','l','&'
  6642. ,''','(',')','*','+',',','-','.','/',':'
  6643. ,';','<','=','>',''','|',''','=','>','.'
  6644. ,'.','*','*',':','=','/','=','>','=','<'
  6645. ,'=','<','<','>','>','<','>','c','o','m'
  6646. ,'m','e','n','t','_','l','i','t','e','r'
  6647. ,'a','l','$','E','O','F','$','A','C','C'
  6648. ,'c','o','m','p','i','l','a','t','i','o'
  6649. ,'n','g','e','n','e','r','a','l','_','c'
  6650. ,'o','m','p','o','n','e','n','t','_','a'
  6651. ,'s','s','o','c','i','a','t','i','o','n'
  6652. ,'s','p','r','a','g','m','a','t','y','p'
  6653. ,'e','_','d','e','c','l','a','r','a','t'
  6654. ,'i','o','n','b','a','s','i','c','_','d'
  6655. ,'e','c','l','a','r','a','t','i','o','n'
  6656. ,'s','u','b','t','y','p','e','_','d','e'
  6657. ,'c','l','a','r','a','t','i','o','n','s'
  6658. ,'u','b','p','r','o','g','r','a','m','_'
  6659. ,'d','e','c','l','a','r','a','t','i','o'
  6660. ,'n','p','a','c','k','a','g','e','_','d'
  6661. ,'e','c','l','a','r','a','t','i','o','n'
  6662. ,'t','a','s','k','_','s','p','e','c','i'
  6663. ,'f','i','c','a','t','i','o','n','g','e'
  6664. ,'n','e','r','i','c','_','s','p','e','c'
  6665. ,'i','f','i','c','a','t','i','o','n','g'
  6666. ,'e','n','e','r','i','c','_','i','n','s'
  6667. ,'t','a','n','t','i','a','t','i','o','n'
  6668. ,'r','e','n','a','m','i','n','g','_','d'
  6669. ,'e','c','l','a','r','a','t','i','o','n'
  6670. ,'o','b','j','e','c','t','_','d','e','c'
  6671. ,'l','a','r','a','t','i','o','n','b','a'
  6672. ,'s','i','c','_','c','o','l','o','n','_'
  6673. ,'d','e','c','l','a','r','a','t','i','o'
  6674. ,'n','n','u','m','b','e','r','_','d','e'
  6675. ,'c','l','a','r','a','t','i','o','n','e'
  6676. ,'x','c','e','p','t','i','o','n','_','d'
  6677. ,'e','c','l','a','r','a','t','i','o','n'
  6678. ,'r','e','n','a','m','i','n','g','_','c'
  6679. ,'o','l','o','n','_','d','e','c','l','a'
  6680. ,'r','a','t','i','o','n','i','d','e','n'
  6681. ,'t','i','f','i','e','r','_','l','i','s'
  6682. ,'t','s','u','b','t','y','p','e','_','i'
  6683. ,'n','d','i','c','a','t','i','o','n','['
  6684. ,':','=','e','x','p','r','e','s','s','i'
  6685. ,'o','n',']','s','t','a','r','t','_','c'
  6686. ,'a','d','c','o','n','s','t','r','a','i'
  6687. ,'n','e','d','_','a','r','r','a','y','_'
  6688. ,'d','e','f','i','n','i','t','i','o','n'
  6689. ,'e','n','d','_','c','a','d','e','x','p'
  6690. ,'r','e','s','s','i','o','n','s','a','v'
  6691. ,'e','_','i','d','e','n','t','i','f','i'
  6692. ,'e','r','{',',','s','a','v','e','_','i'
  6693. ,'d','e','n','t','i','f','i','e','r','}'
  6694. ,'f','u','l','l','_','t','y','p','e','_'
  6695. ,'d','e','c','l','a','r','a','t','i','o'
  6696. ,'n','i','n','c','o','m','p','l','e','t'
  6697. ,'e','_','t','y','p','e','_','d','e','c'
  6698. ,'l','a','r','a','t','i','o','n','p','r'
  6699. ,'i','v','a','t','e','_','t','y','p','e'
  6700. ,'_','d','e','c','l','a','r','a','t','i'
  6701. ,'o','n','t','y','p','e','_','i','d','e'
  6702. ,'n','t','i','f','i','e','r','t','y','p'
  6703. ,'e','_','d','e','f','i','n','i','t','i'
  6704. ,'o','n','l','e','f','t','_','p','a','r'
  6705. ,'e','n','d','i','s','c','r','i','m','i'
  6706. ,'n','a','n','t','_','s','p','e','c','i'
  6707. ,'f','i','c','a','t','i','o','n','{',';'
  6708. ,'d','i','s','c','r','i','m','i','n','a'
  6709. ,'n','t','_','s','p','e','c','i','f','i'
  6710. ,'c','a','t','i','o','n','}','r','i','g'
  6711. ,'h','t','_','p','a','r','e','n','e','n'
  6712. ,'u','m','e','r','a','t','i','o','n','_'
  6713. ,'t','y','p','e','_','d','e','f','i','n'
  6714. ,'i','t','i','o','n','i','n','t','e','g'
  6715. ,'e','r','_','t','y','p','e','_','d','e'
  6716. ,'f','i','n','i','t','i','o','n','r','e'
  6717. ,'a','l','_','t','y','p','e','_','d','e'
  6718. ,'f','i','n','i','t','i','o','n','a','r'
  6719. ,'r','a','y','_','t','y','p','e','_','d'
  6720. ,'e','f','i','n','i','t','i','o','n','r'
  6721. ,'e','c','o','r','d','_','t','y','p','e'
  6722. ,'_','d','e','f','i','n','i','t','i','o'
  6723. ,'n','a','c','c','e','s','s','_','t','y'
  6724. ,'p','e','_','d','e','f','i','n','i','t'
  6725. ,'i','o','n','d','e','r','i','v','e','d'
  6726. ,'_','t','y','p','e','_','d','e','f','i'
  6727. ,'n','i','t','i','o','n','t','y','p','e'
  6728. ,'_','m','a','r','k','c','o','n','s','t'
  6729. ,'r','a','i','n','t','t','y','p','e','_'
  6730. ,'n','a','m','e','|','s','u','b','t','y'
  6731. ,'p','e','_','n','a','m','e','r','a','n'
  6732. ,'g','e','_','c','o','n','s','t','r','a'
  6733. ,'i','n','t','f','l','o','a','t','i','n'
  6734. ,'g','_','p','o','i','n','t','_','c','o'
  6735. ,'n','s','t','r','a','i','n','t','f','i'
  6736. ,'x','e','d','_','p','o','i','n','t','_'
  6737. ,'c','o','n','s','t','r','a','i','n','t'
  6738. ,'s','t','a','r','t','_','e','x','p','a'
  6739. ,'n','d','e','d','_','n','a','m','e','s'
  6740. ,'i','m','p','l','e','_','e','x','p','r'
  6741. ,'e','s','s','i','o','n','e','n','u','m'
  6742. ,'e','r','a','t','i','o','n','_','l','i'
  6743. ,'t','e','r','a','l','_','s','p','e','c'
  6744. ,'i','f','i','c','a','t','i','o','n','{'
  6745. ,',','e','n','u','m','e','r','a','t','i'
  6746. ,'o','n','_','l','i','t','e','r','a','l'
  6747. ,'_','s','p','e','c','i','f','i','c','a'
  6748. ,'t','i','o','n','}','e','n','u','m','e'
  6749. ,'r','a','t','i','o','n','_','l','i','t'
  6750. ,'e','r','a','l','f','l','o','a','t','i'
  6751. ,'n','g','_','a','c','c','u','r','a','c'
  6752. ,'y','_','d','e','f','i','n','i','t','i'
  6753. ,'o','n','[','r','a','n','g','e','_','c'
  6754. ,'o','n','s','t','r','a','i','n','t',']'
  6755. ,'f','i','x','e','d','_','a','c','c','u'
  6756. ,'r','a','c','y','_','d','e','f','i','n'
  6757. ,'i','t','i','o','n','u','n','c','o','n'
  6758. ,'s','t','r','a','i','n','e','d','_','a'
  6759. ,'r','r','a','y','_','d','e','f','i','n'
  6760. ,'i','t','i','o','n','i','n','d','e','x'
  6761. ,'_','l','e','f','t','_','p','a','r','e'
  6762. ,'n','i','n','d','e','x','_','s','u','b'
  6763. ,'t','y','p','e','_','d','e','f','i','n'
  6764. ,'i','t','i','o','n','{',',','i','n','d'
  6765. ,'e','x','_','s','u','b','t','y','p','e'
  6766. ,'_','d','e','f','i','n','i','t','i','o'
  6767. ,'n','}','i','n','d','e','x','_','r','i'
  6768. ,'g','h','t','_','p','a','r','e','n','i'
  6769. ,'n','d','e','x','_','c','o','n','s','t'
  6770. ,'r','a','i','n','t','n','a','m','e','d'
  6771. ,'i','s','c','r','e','t','e','_','r','a'
  6772. ,'n','g','e','{',',','d','i','s','c','r'
  6773. ,'e','t','e','_','r','a','n','g','e','}'
  6774. ,'r','a','n','g','e','s','t','a','r','t'
  6775. ,'_','o','f','_','r','e','c','o','r','d'
  6776. ,'_','t','y','p','e','r','e','c','o','r'
  6777. ,'d','_','t','e','r','m','i','n','a','l'
  6778. ,'c','o','m','p','o','n','e','n','t','_'
  6779. ,'l','i','s','t','{','p','r','a','g','m'
  6780. ,'a','_','d','e','c','l','}','{','c','o'
  6781. ,'m','p','o','n','e','n','t','_','d','e'
  6782. ,'c','l','a','r','a','t','i','o','n','}'
  6783. ,'c','o','m','p','o','n','e','n','t','_'
  6784. ,'d','e','c','l','a','r','a','t','i','o'
  6785. ,'n','c','l','o','s','i','n','g','_','{'
  6786. ,'p','r','a','g','m','a','_','d','e','c'
  6787. ,'l','}','{','c','o','m','p','o','n','e'
  6788. ,'n','t','_','d','e','c','l','a','r','a'
  6789. ,'t','i','o','n','}',''','v','a','r','i'
  6790. ,'a','n','t','_','p','a','r','t','n','u'
  6791. ,'l','l','_','s','t','a','t','e','m','e'
  6792. ,'n','t','C','A','S','E','_','_','i','d'
  6793. ,'e','n','t','i','f','i','e','r','_','_'
  6794. ,'I','S','{','p','r','a','g','m','a','_'
  6795. ,'v','a','r','i','a','n','t','}','_','_'
  6796. ,'v','a','r','i','a','n','t','_','_','{'
  6797. ,'v','a','r','i','a','n','t','}','s','t'
  6798. ,'a','r','t','_','r','e','c','o','r','d'
  6799. ,'_','v','a','r','i','a','n','t','W','H'
  6800. ,'E','N','_','_','v','a','r','i','a','n'
  6801. ,'t','_','c','h','o','i','c','e','_','_'
  6802. ,'{','|','v','a','r','i','a','n','t','_'
  6803. ,'c','h','o','i','c','e','}','_','_','='
  6804. ,'>','v','a','r','i','a','n','t','W','H'
  6805. ,'E','N','_','_','v','a','r','i','a','n'
  6806. ,'t','_','O','T','H','E','R','S','_','_'
  6807. ,'=','>','c','h','o','i','c','e','s','t'
  6808. ,'a','r','t','_','b','d','i','{','b','a'
  6809. ,'s','i','c','_','d','e','c','l','a','r'
  6810. ,'a','t','i','v','e','_','i','t','e','m'
  6811. ,'}','d','e','c','l','a','r','a','t','i'
  6812. ,'v','e','_','p','a','r','t','b','o','d'
  6813. ,'y','{','l','a','t','e','r','_','d','e'
  6814. ,'c','l','a','r','a','t','i','v','e','_'
  6815. ,'i','t','e','m','}','b','a','s','i','c'
  6816. ,'_','d','e','c','l','a','r','a','t','i'
  6817. ,'v','e','_','i','t','e','m','r','e','p'
  6818. ,'r','e','s','e','n','t','a','t','i','o'
  6819. ,'n','_','c','l','a','u','s','e','u','s'
  6820. ,'e','_','c','l','a','u','s','e','l','a'
  6821. ,'t','e','r','_','d','e','c','l','a','r'
  6822. ,'a','t','i','v','e','_','i','t','e','m'
  6823. ,'p','r','o','p','e','r','_','b','o','d'
  6824. ,'y','b','o','d','y','_','s','t','u','b'
  6825. ,'s','u','b','p','r','o','g','r','a','m'
  6826. ,'_','b','o','d','y','p','a','c','k','a'
  6827. ,'g','e','_','b','o','d','y','t','a','s'
  6828. ,'k','_','b','o','d','y','i','n','d','e'
  6829. ,'x','e','d','_','c','o','m','p','o','n'
  6830. ,'e','n','t','s','e','l','e','c','t','e'
  6831. ,'d','_','c','o','m','p','o','n','e','n'
  6832. ,'t','a','t','t','r','i','b','u','t','e'
  6833. ,'s','e','l','e','c','t','o','r','a','t'
  6834. ,'t','r','i','b','u','t','e','_','d','e'
  6835. ,'s','i','g','n','a','t','o','r','c','o'
  6836. ,'m','p','o','n','e','n','t','_','a','s'
  6837. ,'s','o','c','i','a','t','i','o','n','s'
  6838. ,'a','g','g','r','e','g','a','t','e','e'
  6839. ,'x','p','r','e','s','s','i','o','n',','
  6840. ,'e','x','p','r','e','s','s','i','o','n'
  6841. ,'{',',','e','x','p','r','e','s','s','i'
  6842. ,'o','n','}','[',',','o','t','h','e','r'
  6843. ,'s','=','>','e','x','p','r','e','s','s'
  6844. ,'i','o','n',']','c','h','o','i','c','e'
  6845. ,'{','|','c','h','o','i','c','e','}','='
  6846. ,'>','e','x','p','r','e','s','s','i','o'
  6847. ,'n','{',',','c','h','o','i','c','e','{'
  6848. ,'|','c','h','o','i','c','e','}','=','>'
  6849. ,'e','x','p','r','e','s','s','i','o','n'
  6850. ,'}','o','t','h','e','r','s','=','>','e'
  6851. ,'x','p','r','e','s','s','i','o','n','g'
  6852. ,'a','_','e','x','p','r','e','s','s','i'
  6853. ,'o','n','{',',','g','a','_','e','x','p'
  6854. ,'r','e','s','s','i','o','n','}','i','d'
  6855. ,'e','n','t','i','f','i','e','r','{','|'
  6856. ,'i','d','e','n','t','i','f','i','e','r'
  6857. ,'}','=','>','e','x','p','r','e','s','s'
  6858. ,'i','o','n','{',',','i','d','e','n','t'
  6859. ,'i','f','i','e','r','{','|','i','d','e'
  6860. ,'n','t','i','f','i','e','r','}','=','>'
  6861. ,'e','x','p','r','e','s','s','i','o','n'
  6862. ,'}','r','e','l','a','t','i','o','n','r'
  6863. ,'e','l','a','t','i','o','n','{','A','N'
  6864. ,'D','_','_','r','e','l','a','t','i','o'
  6865. ,'n','}','r','e','l','a','t','i','o','n'
  6866. ,'{','O','R','_','_','r','e','l','a','t'
  6867. ,'i','o','n','}','r','e','l','a','t','i'
  6868. ,'o','n','{','X','O','R','_','_','r','e'
  6869. ,'l','a','t','i','o','n','}','r','e','l'
  6870. ,'a','t','i','o','n','{','A','N','D','_'
  6871. ,'_','T','H','E','N','_','_','r','e','l'
  6872. ,'a','t','i','o','n','}','r','e','l','a'
  6873. ,'t','i','o','n','{','O','R','_','_','E'
  6874. ,'L','S','E','_','_','r','e','l','a','t'
  6875. ,'i','o','n','}','[','r','e','l','a','t'
  6876. ,'i','o','n','a','l','_','o','p','e','r'
  6877. ,'a','t','o','r','_','_','s','i','m','p'
  6878. ,'l','e','_','e','x','p','r','e','s','s'
  6879. ,'i','o','n',']','[','N','O','T',']','I'
  6880. ,'N','[','u','n','a','r','y','_','a','d'
  6881. ,'d','i','n','g','_','o','p','e','r','a'
  6882. ,'t','o','r',']','t','e','r','m','{','b'
  6883. ,'i','n','a','r','y','_','a','d','d','i'
  6884. ,'n','g','_','o','p','e','r','a','t','o'
  6885. ,'r','_','_','t','e','r','m','}','f','a'
  6886. ,'c','t','o','r','{','m','u','l','t','i'
  6887. ,'p','l','y','i','n','g','_','o','p','e'
  6888. ,'r','a','t','o','r','_','_','f','a','c'
  6889. ,'t','o','r','}','t','e','r','m','p','r'
  6890. ,'i','m','a','r','y','[','e','x','p','o'
  6891. ,'n','e','n','t','i','a','t','i','n','g'
  6892. ,'_','o','p','e','r','a','t','o','r','_'
  6893. ,'_','p','r','i','m','a','r','y',']','f'
  6894. ,'a','c','t','o','r','h','i','g','h','_'
  6895. ,'p','r','e','c','e','d','e','n','c','e'
  6896. ,'_','u','n','a','r','y','_','o','p','e'
  6897. ,'r','a','t','o','r','p','a','r','e','n'
  6898. ,'t','h','e','s','i','z','e','d','_','e'
  6899. ,'x','p','r','e','s','s','i','o','n','a'
  6900. ,'l','l','o','c','a','t','o','r','q','u'
  6901. ,'a','l','i','f','i','e','d','_','e','x'
  6902. ,'p','r','e','s','s','i','o','n','r','e'
  6903. ,'l','a','t','i','o','n','a','l','_','o'
  6904. ,'p','e','r','a','t','o','r','b','i','n'
  6905. ,'a','r','y','_','a','d','d','i','n','g'
  6906. ,'_','o','p','e','r','a','t','o','r','u'
  6907. ,'n','a','r','y','_','a','d','d','i','n'
  6908. ,'g','_','o','p','e','r','a','t','o','r'
  6909. ,'m','u','l','t','i','p','l','y','i','n'
  6910. ,'g','_','o','p','e','r','a','t','o','r'
  6911. ,'e','x','p','o','n','e','n','t','i','a'
  6912. ,'t','i','n','g','_','o','p','e','r','a'
  6913. ,'t','o','r','e','x','p','a','n','d','e'
  6914. ,'d','_','n','a','m','e','{','p','r','a'
  6915. ,'g','m','a','_','s','t','m','}','s','t'
  6916. ,'a','t','e','m','e','n','t','{','s','t'
  6917. ,'a','t','e','m','e','n','t','}','s','e'
  6918. ,'q','u','e','n','c','e','_','o','f','_'
  6919. ,'s','t','a','t','e','m','e','n','t','s'
  6920. ,'s','i','m','p','l','e','_','s','t','a'
  6921. ,'t','e','m','e','n','t','c','o','m','p'
  6922. ,'o','u','n','d','_','s','t','a','t','e'
  6923. ,'m','e','n','t','{','l','a','b','e','l'
  6924. ,'}','+','b','r','e','a','k','_','p','o'
  6925. ,'i','n','t','a','s','s','i','g','n','m'
  6926. ,'e','n','t','_','s','t','a','t','e','m'
  6927. ,'e','n','t','e','x','i','t','_','s','t'
  6928. ,'a','t','e','m','e','n','t','b','r','e'
  6929. ,'a','k','_','r','e','t','u','r','n','r'
  6930. ,'e','t','u','r','n','_','s','t','a','t'
  6931. ,'e','m','e','n','t','g','o','t','o','_'
  6932. ,'s','t','a','t','e','m','e','n','t','d'
  6933. ,'e','l','a','y','_','s','t','a','t','e'
  6934. ,'m','e','n','t','a','b','o','r','t','_'
  6935. ,'s','t','a','t','e','m','e','n','t','r'
  6936. ,'a','i','s','e','_','s','t','a','t','e'
  6937. ,'m','e','n','t','c','o','d','e','_','s'
  6938. ,'t','a','t','e','m','e','n','t','c','a'
  6939. ,'l','l','_','s','t','a','t','e','m','e'
  6940. ,'n','t','i','f','_','s','t','a','t','e'
  6941. ,'m','e','n','t','c','a','s','e','_','s'
  6942. ,'t','a','t','e','m','e','n','t','l','o'
  6943. ,'o','p','_','s','t','a','t','e','m','e'
  6944. ,'n','t','b','l','o','c','k','_','s','t'
  6945. ,'a','t','e','m','e','n','t','a','c','c'
  6946. ,'e','p','t','_','s','t','a','t','e','m'
  6947. ,'e','n','t','s','e','l','e','c','t','_'
  6948. ,'s','t','a','t','e','m','e','n','t','l'
  6949. ,'a','b','e','l','c','o','n','d','i','t'
  6950. ,'i','o','n','_','_','T','H','E','N','_'
  6951. ,'_','s','e','q','u','e','n','c','e','_'
  6952. ,'o','f','_','s','t','a','t','e','m','e'
  6953. ,'n','t','s','{','E','L','S','I','F','_'
  6954. ,'_','c','o','n','d','i','t','i','o','n'
  6955. ,'_','_','T','H','E','N','_','_','s','e'
  6956. ,'q','u','e','n','c','e','_','o','f','_'
  6957. ,'s','t','a','t','e','m','e','n','t','s'
  6958. ,'}','[','E','L','S','E','_','_','s','e'
  6959. ,'q','u','e','n','c','e','_','o','f','_'
  6960. ,'s','t','a','t','e','m','e','n','t','s'
  6961. ,']','c','o','n','d','i','t','i','o','n'
  6962. ,'C','A','S','E','_','_','e','x','p','r'
  6963. ,'e','s','s','i','o','n','_','_','I','S'
  6964. ,'{','p','r','a','g','m','a','_','a','l'
  6965. ,'t','}','_','_','c','a','s','e','_','s'
  6966. ,'t','a','t','e','m','e','n','t','_','a'
  6967. ,'l','t','e','r','n','a','t','i','v','e'
  6968. ,'_','_','{','c','a','s','e','_','s','t'
  6969. ,'a','t','e','m','e','n','t','_','a','l'
  6970. ,'t','e','r','n','a','t','i','v','e','}'
  6971. ,'W','H','E','N','_','_','c','a','s','e'
  6972. ,'_','c','h','o','i','c','e','_','_','{'
  6973. ,'|','c','h','o','i','c','e','}','_','_'
  6974. ,'=','>','c','a','s','e','_','s','t','a'
  6975. ,'t','e','m','e','n','t','_','a','l','t'
  6976. ,'e','r','n','a','t','i','v','e','W','H'
  6977. ,'E','N','_','_','c','a','s','e','_','O'
  6978. ,'T','H','E','R','S','_','_','=','>','['
  6979. ,'l','o','o','p','_','i','d','e','n','t'
  6980. ,'i','f','i','e','r',':',']','l','o','o'
  6981. ,'p','_','t','e','r','m','i','n','a','l'
  6982. ,'[','i','d','e','n','t','i','f','i','e'
  6983. ,'r',']','l','o','o','p','_','p','a','r'
  6984. ,'a','m','e','t','e','r','b','e','g','i'
  6985. ,'n','_','e','n','d','_','b','l','o','c'
  6986. ,'k','d','e','c','l','a','r','a','t','i'
  6987. ,'v','e','_','p','a','r','t','_','_','b'
  6988. ,'e','g','i','n','_','e','n','d','_','b'
  6989. ,'l','o','c','k','b','e','g','i','n','_'
  6990. ,'t','e','r','m','i','n','a','l','s','e'
  6991. ,'q','u','e','n','c','e','_','o','f','_'
  6992. ,'s','t','a','t','e','m','e','n','t','s'
  6993. ,'_','_','e','n','d','_','b','l','o','c'
  6994. ,'k','_','s','t','a','t','e','m','e','n'
  6995. ,'t','s','[','e','x','c','e','p','t','i'
  6996. ,'o','n','_','h','a','n','d','l','e','r'
  6997. ,'_','p','a','r','t',']','[','b','l','o'
  6998. ,'c','k','_','i','d','e','n','t','i','f'
  6999. ,'i','e','r',':',']','d','e','c','l','a'
  7000. ,'r','e','_','t','e','r','m','i','n','a'
  7001. ,'l','s','u','b','p','r','o','g','r','a'
  7002. ,'m','_','s','p','e','c','i','f','i','c'
  7003. ,'a','t','i','o','n','s','t','a','r','t'
  7004. ,'_','i','d','e','n','t','i','f','i','e'
  7005. ,'r','p','a','r','a','m','e','t','e','r'
  7006. ,'_','s','p','e','c','i','f','i','c','a'
  7007. ,'t','i','o','n','{',';','p','a','r','a'
  7008. ,'m','e','t','e','r','_','s','p','e','c'
  7009. ,'i','f','i','c','a','t','i','o','n','}'
  7010. ,'d','e','s','i','g','n','a','t','o','r'
  7011. ,'m','o','d','e','g','e','n','e','r','i'
  7012. ,'c','_','p','a','r','a','m','e','t','e'
  7013. ,'r','_','m','o','d','e','s','u','b','p'
  7014. ,'r','o','g','r','a','m','_','s','p','e'
  7015. ,'c','i','f','i','c','a','t','i','o','n'
  7016. ,'_','_','I','S','[','e','n','d','_','d'
  7017. ,'e','s','i','g','n','a','t','o','r',']'
  7018. ,'p','a','c','k','a','g','e','_','s','p'
  7019. ,'e','c','i','f','i','c','a','t','i','o'
  7020. ,'n','P','A','C','K','A','G','E','_','_'
  7021. ,'s','t','a','r','t','_','i','d','e','n'
  7022. ,'t','i','f','i','e','r','_','_','I','S'
  7023. ,'{','b','a','s','i','c','_','d','e','c'
  7024. ,'l','a','r','a','t','i','v','e','_','i'
  7025. ,'t','e','m','}',''','p','r','i','v','a'
  7026. ,'t','e','_','t','e','r','m','i','n','a'
  7027. ,'l','P','A','C','K','A','G','E','_','_'
  7028. ,'B','O','D','Y','_','_','s','t','a','r'
  7029. ,'t','_','i','d','e','n','t','i','f','i'
  7030. ,'e','r','_','_','I','S','d','e','c','l'
  7031. ,'a','r','a','t','i','v','e','_','p','a'
  7032. ,'r','t','_','_','n','o','_','b','e','g'
  7033. ,'i','n','p','a','c','k','a','g','e','_'
  7034. ,'n','a','m','e','{',',','p','a','c','k'
  7035. ,'a','g','e','_','n','a','m','e','}','T'
  7036. ,'A','S','K','_','_','s','t','a','r','t'
  7037. ,'_','i','d','e','n','t','i','f','i','e'
  7038. ,'r','_','_','I','S','{','e','n','t','r'
  7039. ,'y','_','d','e','c','l','a','r','a','t'
  7040. ,'i','o','n','}','_','_','{','r','e','p'
  7041. ,'r','e','s','e','n','t','a','t','i','o'
  7042. ,'n','_','c','l','a','u','s','e','}','T'
  7043. ,'A','S','K','_','_','T','Y','P','E','_'
  7044. ,'_','s','t','a','r','t','_','i','d','e'
  7045. ,'n','t','i','f','i','e','r','_','_','I'
  7046. ,'S','T','A','S','K','_','_','B','O','D'
  7047. ,'Y','_','_','s','t','a','r','t','_','i'
  7048. ,'d','e','n','t','i','f','i','e','r','_'
  7049. ,'_','I','S','[','(','d','i','s','c','r'
  7050. ,'e','t','e','_','r','a','n','g','e',')'
  7051. ,']','[','f','o','r','m','a','l','_','p'
  7052. ,'a','r','t',']','e','n','t','r','y','_'
  7053. ,'d','e','c','l','a','r','a','t','i','o'
  7054. ,'n','[','(','e','x','p','r','e','s','s'
  7055. ,'i','o','n',')',']','[','f','o','r','m'
  7056. ,'a','l','_','p','a','r','t',']','A','C'
  7057. ,'C','E','P','T','_','_','s','t','a','r'
  7058. ,'t','_','i','d','e','n','t','i','f','i'
  7059. ,'e','r','_','_','[','(','e','x','p','r'
  7060. ,'e','s','s','i','o','n',')',']','[','f'
  7061. ,'o','r','m','a','l','_','p','a','r','t'
  7062. ,']','_','_','D','O','d','o','_','s','e'
  7063. ,'q','u','e','n','c','e','_','o','f','_'
  7064. ,'s','t','a','t','e','m','e','n','t','s'
  7065. ,'s','e','l','e','c','t','i','v','e','_'
  7066. ,'w','a','i','t','c','o','n','d','i','t'
  7067. ,'i','o','n','a','l','_','e','n','t','r'
  7068. ,'y','_','c','a','l','l','t','i','m','e'
  7069. ,'d','_','e','n','t','r','y','_','c','a'
  7070. ,'l','l','s','e','l','e','c','t','_','t'
  7071. ,'e','r','m','i','n','a','l','s','e','l'
  7072. ,'e','c','t','_','a','l','t','e','r','n'
  7073. ,'a','t','i','v','e','{','O','R','_','_'
  7074. ,'s','e','l','e','c','t','_','a','l','t'
  7075. ,'e','r','n','a','t','i','v','e','}','W'
  7076. ,'H','E','N','_','_','c','o','n','d','i'
  7077. ,'t','i','o','n','_','_','=','>','_','_'
  7078. ,'s','e','l','e','c','t','i','v','e','_'
  7079. ,'w','a','i','t','_','a','l','t','e','r'
  7080. ,'n','a','t','i','v','e','s','e','l','e'
  7081. ,'c','t','i','v','e','_','w','a','i','t'
  7082. ,'_','a','l','t','e','r','n','a','t','i'
  7083. ,'v','e','a','c','c','e','p','t','_','a'
  7084. ,'l','t','e','r','n','a','t','i','v','e'
  7085. ,'d','e','l','a','y','_','a','l','t','e'
  7086. ,'r','n','a','t','i','v','e','t','e','r'
  7087. ,'m','i','n','a','t','e','_','a','l','t'
  7088. ,'e','r','n','a','t','i','v','e','a','c'
  7089. ,'c','e','p','t','_','s','t','a','t','e'
  7090. ,'m','e','n','t','_','_','d','e','c','i'
  7091. ,'s','i','o','n','_','p','o','i','n','t'
  7092. ,'[','s','e','q','u','e','n','c','e','_'
  7093. ,'o','f','_','s','t','a','t','e','m','e'
  7094. ,'n','t','s',']','d','e','l','a','y','_'
  7095. ,'s','t','a','t','e','m','e','n','t','_'
  7096. ,'_','d','e','c','i','s','i','o','n','_'
  7097. ,'p','o','i','n','t','T','E','R','M','I'
  7098. ,'N','A','T','E','_','_',';','c','a','l'
  7099. ,'l','_','s','t','a','t','e','m','e','n'
  7100. ,'t','_','_','[','s','e','q','u','e','n'
  7101. ,'c','e','_','o','f','_','s','t','a','t'
  7102. ,'e','m','e','n','t','s',']','e','l','s'
  7103. ,'e','_','t','e','r','m','i','n','a','l'
  7104. ,'o','r','_','t','e','r','m','i','n','a'
  7105. ,'l','d','e','l','a','y','_','a','l','t'
  7106. ,'e','r','n','a','t','i','v','e','_','i'
  7107. ,'n','_','t','i','m','e','d','_','e','n'
  7108. ,'t','r','y','c','a','l','l','_','s','t'
  7109. ,'a','t','e','m','e','n','t','_','_','d'
  7110. ,'e','c','i','s','i','o','n','_','p','o'
  7111. ,'i','n','t','{',',','n','a','m','e','}'
  7112. ,'{','c','o','m','p','i','l','a','t','i'
  7113. ,'o','n','_','u','n','i','t','}','p','r'
  7114. ,'a','g','m','a','_','h','e','a','d','e'
  7115. ,'r','c','o','m','p','i','l','a','t','i'
  7116. ,'o','n','_','u','n','i','t','c','o','n'
  7117. ,'t','e','x','t','_','c','l','a','u','s'
  7118. ,'e','l','i','b','r','a','r','y','_','o'
  7119. ,'r','_','s','e','c','o','n','d','a','r'
  7120. ,'y','_','u','n','i','t','s','u','b','u'
  7121. ,'n','i','t','{','w','i','t','h','_','c'
  7122. ,'l','a','u','s','e','{','u','s','e','_'
  7123. ,'c','l','a','u','s','e','}','}','l','i'
  7124. ,'b','r','a','r','y','_','u','n','i','t'
  7125. ,'_','n','a','m','e','{',',','l','i','b'
  7126. ,'r','a','r','y','_','u','n','i','t','_'
  7127. ,'n','a','m','e','}','w','i','t','h','_'
  7128. ,'c','l','a','u','s','e','S','E','P','A'
  7129. ,'R','A','T','E','_','_','(','_','_','e'
  7130. ,'x','p','a','n','d','e','d','_','n','a'
  7131. ,'m','e','_','_',')','{','n','o','n','_'
  7132. ,'o','t','h','e','r','s','_','h','a','n'
  7133. ,'d','l','e','r','}','[','o','t','h','e'
  7134. ,'r','s','_','h','a','n','d','l','e','r'
  7135. ,']','e','x','c','e','p','t','i','o','n'
  7136. ,'_','h','a','n','d','l','e','r','o','t'
  7137. ,'h','e','r','s','_','h','a','n','d','l'
  7138. ,'e','r','W','H','E','N','_','_','e','x'
  7139. ,'c','e','p','t','i','o','n','_','c','h'
  7140. ,'o','i','c','e','_','_','{','|','e','x'
  7141. ,'c','e','p','t','i','o','n','_','c','h'
  7142. ,'o','i','c','e','}','_','_','=','>','n'
  7143. ,'o','n','_','o','t','h','e','r','s','_'
  7144. ,'h','a','n','d','l','e','r','W','H','E'
  7145. ,'N','_','_','e','x','c','e','p','t','i'
  7146. ,'o','n','_','O','T','H','E','R','S','_'
  7147. ,'_','=','>','e','x','c','e','p','t','i'
  7148. ,'o','n','_','c','h','o','i','c','e','g'
  7149. ,'e','n','e','r','i','c','_','f','o','r'
  7150. ,'m','a','l','_','p','a','r','t','g','e'
  7151. ,'n','e','r','i','c','_','t','e','r','m'
  7152. ,'i','n','a','l','{','g','e','n','e','r'
  7153. ,'i','c','_','p','a','r','a','m','e','t'
  7154. ,'e','r','_','d','e','c','l','a','r','a'
  7155. ,'t','i','o','n','}','g','e','n','e','r'
  7156. ,'i','c','_','p','a','r','a','m','e','t'
  7157. ,'e','r','_','d','e','c','l','a','r','a'
  7158. ,'t','i','o','n','g','e','n','e','r','i'
  7159. ,'c','_','t','y','p','e','_','i','d','e'
  7160. ,'n','t','i','f','i','e','r','g','e','n'
  7161. ,'e','r','i','c','_','t','y','p','e','_'
  7162. ,'d','e','f','i','n','i','t','i','o','n'
  7163. ,'[','I','S','_','_','n','a','m','e','_'
  7164. ,'_','o','r','_','_','<','>',']','I','S'
  7165. ,'_','_','N','E','W','_','_','e','x','p'
  7166. ,'a','n','d','e','d','_','n','a','m','e'
  7167. ,'g','e','n','e','r','i','c','_','a','s'
  7168. ,'s','o','c','i','a','t','i','o','n','{'
  7169. ,',','g','e','n','e','r','i','c','_','a'
  7170. ,'s','s','o','c','i','a','t','i','o','n'
  7171. ,'}','g','e','n','e','r','i','c','_','i'
  7172. ,'n','s','t','a','n','t','i','a','t','i'
  7173. ,'o','n','_','I','S','[','g','e','n','e'
  7174. ,'r','i','c','_','f','o','r','m','a','l'
  7175. ,'_','p','a','r','a','m','e','t','e','r'
  7176. ,'=','>',']','g','e','n','e','r','i','c'
  7177. ,'_','a','c','t','u','a','l','_','p','a'
  7178. ,'r','a','m','e','t','e','r','g','e','n'
  7179. ,'e','r','i','c','_','f','o','r','m','a'
  7180. ,'l','_','p','a','r','a','m','e','t','e'
  7181. ,'r','g','e','n','e','r','i','c','_','a'
  7182. ,'c','t','u','a','l','_','p','a','r','a'
  7183. ,'m','e','t','e','r','l','e','n','g','t'
  7184. ,'h','_','c','l','a','u','s','e','e','n'
  7185. ,'u','m','e','r','a','t','i','o','n','_'
  7186. ,'r','e','p','r','e','s','e','n','t','a'
  7187. ,'t','i','o','n','_','c','l','a','u','s'
  7188. ,'e','a','d','d','r','e','s','s','_','c'
  7189. ,'l','a','u','s','e','r','e','c','o','r'
  7190. ,'d','_','r','e','p','r','e','s','e','n'
  7191. ,'t','a','t','i','o','n','_','c','l','a'
  7192. ,'u','s','e','r','e','p','s','p','e','c'
  7193. ,'_','r','e','c','o','r','d','_','t','e'
  7194. ,'r','m','i','n','a','l','{','c','o','m'
  7195. ,'p','o','n','e','n','t','_','c','l','a'
  7196. ,'u','s','e','}',''','a','l','i','g','n'
  7197. ,'m','e','n','t','_','c','l','a','u','s'
  7198. ,'e','c','o','m','p','o','n','e','n','t'
  7199. ,'_','c','l','a','u','s','e','{','p','r'
  7200. ,'a','g','m','a','_','v','a','r','i','a'
  7201. ,'n','t','}','{','p','r','a','g','m','a'
  7202. ,'_','a','l','t','}','d','i','s','c','r'
  7203. ,'i','m','i','n','a','n','t','_','_',';'
  7204. ,'{','v','a','r','i','a','n','t','}','{'
  7205. ,'|','c','h','o','i','c','e','}','{','b'
  7206. ,'a','s','i','c','_','d','e','c','l','a'
  7207. ,'r','a','t','i','v','e','_','i','t','e'
  7208. ,'m','}','_','_','b','a','s','i','c','_'
  7209. ,'d','e','c','l','a','r','a','t','i','v'
  7210. ,'e','_','i','t','e','m','|','E','M','P'
  7211. ,'T','Y','{','b','a','s','i','c','_','c'
  7212. ,'o','l','o','n','_','d','e','c','l','a'
  7213. ,'r','a','t','i','o','n','}','g','a','_'
  7214. ,'e','x','p','r','e','s','s','i','o','n'
  7215. ,'{','|','i','d','e','n','t','i','f','i'
  7216. ,'e','r','}','c','o','n','d','i','t','i'
  7217. ,'o','n','_','_','T','H','E','N','E','L'
  7218. ,'S','I','F','_','_','c','o','n','d','i'
  7219. ,'t','i','o','n','_','_','T','H','E','N'
  7220. ,'{','c','a','s','e','_','s','t','a','t'
  7221. ,'e','m','e','n','t','_','a','l','t','e'
  7222. ,'r','n','a','t','i','v','e','}','e','x'
  7223. ,'c','e','p','t','i','o','n','_','t','e'
  7224. ,'r','m','i','n','a','l','{','p','r','a'
  7225. ,'g','m','a','_','a','l','t','}','_','_'
  7226. ,'e','x','c','e','p','t','i','o','n','_'
  7227. ,'h','a','n','d','l','e','r','p','a','r'
  7228. ,'a','m','e','t','e','r','_','_',';','{'
  7229. ,'e','n','t','r','y','_','d','e','c','l'
  7230. ,'a','r','a','t','i','o','n','}','{','r'
  7231. ,'e','p','r','e','s','e','n','t','a','t'
  7232. ,'i','o','n','_','c','l','a','u','s','e'
  7233. ,'}','o','p','t','i','o','n','a','l','_'
  7234. ,'s','e','q','u','e','n','c','e','_','o'
  7235. ,'f','_','s','t','a','t','e','m','e','n'
  7236. ,'t','s','u','s','e','_','c','l','a','u'
  7237. ,'s','e','_','l','i','s','t','{','|','e'
  7238. ,'x','c','e','p','t','i','o','n','_','c'
  7239. ,'h','o','i','c','e','}','{','c','o','m'
  7240. ,'p','o','n','e','n','t','_','c','l','a'
  7241. ,'u','s','e','}','C','A','S','E','_','_'
  7242. ,'i','d','e','n','t','i','f','i','e','r'
  7243. ,'W','H','E','N','_','_','c','h','o','i'
  7244. ,'c','e','_','_','{','|','c','h','o','i'
  7245. ,'c','e','}','_','_','=','>','W','H','E'
  7246. ,'N','_','_','O','T','H','E','R','S','_'
  7247. ,'_','=','>','W','H','E','N','_','_','c'
  7248. ,'o','n','d','i','t','i','o','n','_','_'
  7249. ,'=','>','S','E','P','A','R','A','T','E'
  7250. ,'_','_','(','_','_','e','x','p','a','n'
  7251. ,'d','e','d','_','n','a','m','e','s','t'
  7252. ,'a','r','t','_','{','b','a','s','i','c'
  7253. ,'_','c','o','l','o','n','_','d','e','c'
  7254. ,'l','a','r','a','t','i','o','n','}','{'
  7255. ,'b','a','s','i','c','_','c','o','l','o'
  7256. ,'n','_','d','e','c','l','a','r','a','t'
  7257. ,'i','o','n','}',''')  ;
  7258.         --| Table of symbols used in the grammar.
  7259.         -- NYU Reference Name: NO_SYM
  7260.     
  7261.     LeftHandSide :
  7262.          constant array (LeftHandSideRange)
  7263.          of GrammarSymbolRange :=
  7264.           (  100,  100,  102,  102,  102,  102,  102,  102,  102,  102
  7265. ,  111,  111,  111,  111,  110,  110,  110,  110,  118,  120
  7266. ,  112,  115,  122,  101,  101,  101,  124,  124,  127,  128
  7267. ,  128,  128,  128,  128,  128,  128,  103,  116,  116,  140
  7268. ,  141,  141,  141,  141,  139,  143,  143,  133,  148,  150
  7269. ,  150,  134,  135,  135,  144,  151,  145,  153,  136,  136
  7270. ,  154,  119,  156,  159,  155,  158,  161,  161,  163,  163
  7271. ,  137,  166,  166,  166,  169,  130,  172,  178,  178,  176
  7272. ,  180,  180,  180,  138,  125,  125,  183,  183,  181,  186
  7273. ,  186,  186,  189,  189,  189,  189,  189,  189,  189,  184
  7274. ,  184,  190,  190,  190,  160,  160,  160,  160,  160,  160
  7275. ,  195,  196,  196,  198,  198,  198,  197,  199,  199,  199
  7276. ,  199,  201,  200,  200,  200,  200,  200,  200,   99,   99
  7277. ,   99,  121,  121,  121,  121,  121,  121,  210,  210,  147
  7278. ,  220,  223,  223,  225,  221,  221,  221,  221,  221,  221
  7279. ,  221,  228,  228,  228,  228,  228,  228,  229,  229,  229
  7280. ,  230,  230,  224,  224,  231,  231,  231,  231,  232,  227
  7281. ,  227,  226,  226,  226,  226,  237,  235,  235,  235,  235
  7282. ,  238,  238,  238,  238,  238,  238,  238,  238,  238,  238
  7283. ,  239,  239,  239,  239,  239,  239,  241,  244,  258,  173
  7284. ,  242,  252,  262,  253,  266,  266,  254,  254,  254,  254
  7285. ,  271,  273,  272,  275,  255,  255,  243,  243,  243,  243
  7286. ,  245,  245,  246,  104,  279,  279,  279,  279,  283,  283
  7287. ,  281,  284,  284,  285,  285,  285,  192,  251,  105,  288
  7288. ,  288,  193,  193,  293,  126,  126,  126,  126,  188,  294
  7289. ,  114,  114,  109,  109,  106,  106,  106,  106,  194,  301
  7290. ,  256,  256,  304,  247,  257,  257,  257,  305,  309,  309
  7291. ,  312,  312,  312,  313,  314,  315,  319,  306,  307,  316
  7292. ,  318,  324,  248,   98,  327,  328,  328,  328,  330,  330
  7293. ,  330,  330,  330,  330,  330,  329,  335,  333,  191,  191
  7294. ,  191,  331,  113,  339,  339,  342,  340,  344,  249,  249
  7295. ,  107,  107,  345,  348,  348,  348,  348,  349,  350,  350
  7296. ,  350,  350,  350,  350,  350,  350,  108,  108,  108,  108
  7297. ,  108,  108,  352,  355,  353,  357,  357,  358,  187,  187
  7298. ,  187,  187,  359,  360,  362,  362,  366,  365,  361,  250
  7299. ,  167,  167,  367,  367,  234,  234,  368,  368,  117,  117
  7300. ,  123,  123,  142,  233,  233,  149,  149,  152,  152,  157
  7301. ,  157,  162,  162,  168,  168,  131,  131,  370,  370,  371
  7302. ,  371,  182,  182,  182,  185,  185,  202,  202,  204,  205
  7303. ,  205,  203,  203,  206,  374,  374,  374,  207,  207,  208
  7304. ,  209,  209,  375,  375,  211,  211,  212,  212,  213,  213
  7305. ,  214,  214,  215,  215,  216,  216,  217,  217,  218,  218
  7306. ,  218,  219,  219,  222,  222,  236,  236,  240,  240,  259
  7307. ,  260,  260,  261,  261,  378,  378,  268,  268,  270,  270
  7308. ,  277,  277,  276,  276,  380,  337,  337,  338,  338,  282
  7309. ,  282,  287,  287,  287,  295,  295,  382,  382,  383,  383
  7310. ,  300,  300,  300,  300,  302,  302,  302,  302,  310,  310
  7311. ,  317,  317,  325,  325,  326,  326,  332,  332,  385,  385
  7312. ,  334,  334,  386,  386,  347,  347,  351,  351,  351,  354
  7313. ,  354,  356,  356,  387,  387,  165,  170,  171,  164,  363
  7314. ,  174,  389,  390,  263,  346,  388,  177,  179,  265,  267
  7315. ,  264,  269,  274,  175,  278,  289,  280,  290,  297,  291
  7316. ,  292,  296,  298,  299,  303,  308,  320,  384,  323,  311
  7317. ,  391,  379,  341,  343,  286,  364,  336,  392,  146,  373
  7318. ,  393,  394,  394,  372,  372,  376,  377,  321,  322,  369
  7319. ,  381,  129,  132)  ;
  7320.         --| Map of the grammar rule number (constant array index) to
  7321.         --| numeric value of left hand side symbol.
  7322.         -- NYU Reference Name: LHS
  7323.  
  7324.     RightHandSide :
  7325.          constant array (RightHandSideRange)
  7326.          of GC.ParserInteger :=
  7327.           (    6,    3,    1,    1,    1,    1,    1,    1,    1,    1
  7328. ,    1,    1,    1,    1,    5,    6,    7,    8,    0,    0
  7329. ,    6,    2,    1,    1,    1,    1,    4,    8,    1,    2
  7330. ,    2,    2,    2,    2,    2,    2,    5,    1,    2,    1
  7331. ,    1,    1,    1,    3,    3,    2,    4,    4,    1,    1
  7332. ,    1,    1,    1,    1,    2,    2,    2,    2,    1,    1
  7333. ,    7,    4,    3,    4,    1,    1,    2,    1,    1,    3
  7334. ,    5,    4,    4,    2,    5,    4,    5,    3,    3,    0
  7335. ,    1,    3,    2,    2,    3,    7,    2,    4,    0,    1
  7336. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1
  7337. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1
  7338. ,    4,    3,    3,    1,    1,    1,    3,    1,    1,    1
  7339. ,    1,    3,    2,    5,    5,    3,    3,    1,    1,    4
  7340. ,    2,    1,    1,    1,    1,    1,    1,    2,    3,    1
  7341. ,    1,    2,    2,    3,    1,    1,    1,    1,    1,    1
  7342. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1
  7343. ,    1,    1,    1,    1,    1,    1,    1,    1,    1,    3
  7344. ,    3,    2,    5,    4,    4,    3,    1,    1,    2,    2
  7345. ,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2
  7346. ,    2,    2,    2,    2,    2,    2,    0,    0,    3,    2
  7347. ,    4,    7,    1,    5,    2,    2,    7,   11,   12,    9
  7348. ,    1,    2,    4,    1,    5,    4,    2,    4,    3,    5
  7349. ,    2,    3,    3,    2,    2,    6,    4,    8,    1,    1
  7350. ,    4,    1,    2,    1,    2,    3,    4,    2,    2,    4
  7351. ,    6,    5,    4,    1,    6,   10,    5,    9,    4,    2
  7352. ,    6,    6,    5,    4,    3,    4,    5,    5,    4,    4
  7353. ,    4,    5,    1,    3,    1,    1,    1,    7,    2,    2
  7354. ,    1,    1,    1,    2,    2,    2,    2,    8,    9,    1
  7355. ,    1,    1,    4,    1,    2,    5,    2,    2,    1,    1
  7356. ,    1,    1,    1,    1,    1,    1,    4,    1,    4,    6
  7357. ,    6,    2,    4,    2,    1,    2,    2,    1,    2,    3
  7358. ,    3,    3,    2,    5,    5,    9,    4,    1,    3,    2
  7359. ,    2,    2,    2,    1,    1,    1,    4,    8,    4,    8
  7360. ,    3,    7,    4,    1,    1,    1,    1,    1,    1,    1
  7361. ,    1,    1,    5,    5,    9,   10,    5,    4,    6,    4
  7362. ,    0,    2,    0,    2,    0,    2,    0,    2,    0,    2
  7363. ,    0,    3,    1,    1,    3,    0,    3,    0,    1,    0
  7364. ,    3,    0,    3,    0,    3,    0,    3,    0,    2,    0
  7365. ,    3,    1,    3,    2,    1,    3,    3,    3,    4,    0
  7366. ,    3,    0,    2,    3,    1,    3,    2,    1,    3,    4
  7367. ,    0,    3,    0,    3,    3,    3,    3,    3,    3,    3
  7368. ,    4,    4,    4,    4,    0,    2,    1,    2,    1,    2
  7369. ,    3,    1,    3,    0,    2,    1,    3,    1,    2,    2
  7370. ,    0,    3,    0,    2,    0,    2,    0,    2,    0,    1
  7371. ,    0,    2,    0,    2,    2,    1,    2,    0,    1,    0
  7372. ,    3,    0,    1,    1,    0,    3,    1,    3,    0,    3
  7373. ,    0,    4,    3,    7,    0,    4,    3,    7,    0,    3
  7374. ,    1,    1,    0,    3,    1,    2,    0,    3,    1,    3
  7375. ,    0,    3,    0,    3,    0,    2,    0,    2,    2,    0
  7376. ,    3,    1,    3,    1,    3,    1,    1,    1,    0,    1
  7377. ,    2,    4,    3,    3,    1,    2,    1,    1,    1,    1
  7378. ,    3,    1,    1,    3,    1,    3,    1,    1,    2,    1
  7379. ,    4,    3,    4,    4,    4,    1,    2,    3,    1,    2
  7380. ,    3,    1,    4,    3,    2,    1,    2,    4,    0,    4
  7381. ,    0,    3,    0,    3,    1,    2,    3,    1,    1,    1
  7382. ,    1,    1,    1)  ;
  7383.         --| Map of the grammar rule number (constant array index) to
  7384.         --| size of right hand sides (number of symbols).
  7385.         -- NYU Reference Name: RHS
  7386.  
  7387.     ActionTableOne :
  7388.          constant array (ActionTableOneRange)
  7389.          of GC.ParserInteger :=
  7390.           (  824,  152,    0,    0,    0,    0,  116,    0,    0,    0
  7391. ,    0,    0,   85,    0,    0, 7332,  859,    0,  572,  987
  7392. ,    0,    0,    0,   41,   42, 7334, 7336,    0,    0,   45
  7393. ,    0,    0, 7338,  594,   47,    0,    0,    0,    0,   37
  7394. ,    0,    0,    0,    0,   79,    0,    0,    0,    0,    0
  7395. ,    0,    0,    0,    0,    0,    0,    0,  789,    0,    0
  7396. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7397. ,    0, 7341,   39,   40,    0,    0,    0,    0,  679,   49
  7398. ,    0,  467,    0,  118,    0,    0,    0,    0,    0,  383
  7399. ,    0,    0,    0,    0,    0,  705,  892,    0,    0,    0
  7400. ,    0,   41,   42,   43, 7343, 7345, 7347,   45,  777,  743
  7401. , 7349, 7353, 7355, 7358,    0,    0,    0,    0,   51,    0
  7402. ,  838,  273,    0,    0,    0,  187,    0,    0,    0,    0
  7403. ,  275,    0,    0,    0,    0,  363,    0,    0,    0,    0
  7404. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7405. ,    0,    0,    0, 7360,   53,   54,    0,   49,    0,   55
  7406. ,    0,    0,    0,    0,    0,   56,   57,    0,   58,   59
  7407. , 7362,   61,   62,   63,  300,    0,   64,   65,   66,   67
  7408. ,    0,   68,   69, 7364,   71, 7366,   39, 7368, 7370,    0
  7409. ,    0,    0,  262,    0,    0,    0,   51,    0,    0,   78
  7410. ,    0,    0,    0,    0,    0, 1032,    0,    0,    0,    0
  7411. ,    0,    0,    0,    0,    0,  122,   42,   43,   44,    0
  7412. ,    0,   45,  342,    0,    0,    0,    0,    0,    0,    0
  7413. ,    0,   52,   53, 7372,  747,    0,    0,   55,  880,    0
  7414. ,    0,  881,    0, 7374, 7376,    0,   58,   59,   60,   61
  7415. ,   62,   63,    0,   79,   64,   65,   66,   67,    0, 7378
  7416. ,   69,   70,   71,   72,    0,    0,   73,    0,    0,    0
  7417. ,    0,    0,    0,  421,  146,    0,   38, 7380,   40,    0
  7418. ,  147,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7419. ,  401,    0,  930,    0,    0,  931,    0,    0,    0,   37
  7420. ,    0,    0,    0,   37,    0,    0,  122,   42, 7382,   44
  7421. ,  171,    0,   45,    0,    0, 7384,    0,   47,   37,    0
  7422. ,   37,    0,    0,  852,    0,    0,    0,    0,    0,    0
  7423. ,    0,   38, 7386,   40,    0,   38,   39,   40,    0,    0
  7424. ,    0,    0,    0,    0,   79,   52, 7388,   54,  188,    0
  7425. ,   38, 7390, 7392, 7395,   40,    0,    0,    0,    0,    0
  7426. ,    0,  122,   42, 7397, 7399, 7401, 7403, 7405,   44,   65
  7427. , 7407, 7409,   47,   68, 7412, 7414, 7416,   72,  932,    0
  7428. ,  805,   42, 7418, 7420,   43,   44,   45,    0, 7422,   46
  7429. ,  247, 7424,  595,   47,    0,    0,   37,    0,  144, 7426
  7430. ,    0,  171,    0,    0,    0,  426,  860,   38,   39,   40
  7431. ,   74,    0, 1020,    0,    0,    0,    0,  625,    0,    0
  7432. ,    0, 7428,    0,  118,    0,    0,    0,    0,   38,   39
  7433. , 7430,    0,    0,    0,    0,    0, 7432, 7434, 7438,   43
  7434. ,   44,    0,   55, 7441,  786,  723,   46,   50,   47,    0
  7435. ,  988,    0,    0,    0,  427,    0,  171,    0, 7443, 7445
  7436. , 7447, 7450, 7452,    0, 7454,   69,   70, 7457, 7459,   47
  7437. ,    0,   73,    0,  854,  801,  171,  118,  171,    0,  176
  7438. ,    0,    0,    0,    0,    0,    0,    0,    0,  498,    0
  7439. ,    0,   52,   53, 7461, 7465, 7467,   53, 7469,    0,  500
  7440. ,    0,   55,   45,    0,    0,    0, 7471, 7473, 7475,   61
  7441. , 7477, 7480, 7483, 7486, 7488, 7493, 7495,   67, 7497, 7499
  7442. , 7502, 7504,   71, 7506,   69, 7509, 7511, 7514,   61,   62
  7443. , 7516,    0,  171,   64,   65, 7519, 7521, 7523, 7525, 7528
  7444. , 7530, 7534, 7537, 7539,   72,   73,   37,   73,    0,    0
  7445. ,    0,    0,    0,  171,    0,    0,    0,    0,  851,   80
  7446. ,    0,    0,    0,    0,    0,    0,    0, 7541, 7544, 7546
  7447. ,   43,   44,    0,   55,   45,  680,    0,   46,   38, 7548
  7448. ,   40,    0,   58, 7550,   60,   61,   62,   63,   52,   53
  7449. , 7552,   65,   66,   67,   55,   68, 7554,   70,   71, 7556
  7450. ,   39,   40,   73,   58, 7558,   60,   61,   62, 7560,   42
  7451. , 7562, 7564, 7566,   66, 7568,    0,   68, 7570, 7573, 7575
  7452. ,   72,    0,    0,   73,    0,    0,    0,    0,    0,  122
  7453. ,   42,   43, 7577,    0,  750,   45,    0,   37,   46,   37
  7454. ,   47,  867, 7580,    0,   43,   44,    0,    0,   79,    0
  7455. , 7582,   39,   40,    0,  958,    0,  365,    0,    0,    0
  7456. ,    0,  324,    0,  125, 7584,    0,    0,    0,    0,   38
  7457. ,   39, 7587,   39,   40,   74,    0,  121,    0,    0,    0
  7458. ,  122,   42,   43, 7589,    0,  123, 7591,    0,    0,   46
  7459. , 7593,   47,  580,    0,    0,    0,    0,    0,   52, 7595
  7460. , 7597, 7599, 7602, 7604, 7607,   45,  325,   45,   46,  933
  7461. , 7609,  124, 7611,    0,    0,  194,    0,    0,    0,    0
  7462. ,    0, 7613, 7615, 7617, 7620,    0,   68, 7623, 7625,   71
  7463. ,   72,  758,    0, 7627,    0,    0,    0,  976,   52,   53
  7464. , 7630,    0,    0,    0, 7632,    0,  396, 7635,    0, 7637
  7465. ,  315,  316,    0,    0,    0,    0,    0,  661,  492,   52
  7466. , 7639, 7643, 7646, 7650, 7652,   55, 7654,   69, 7656, 7659
  7467. , 7661,  634, 7663, 7665, 7668, 7670,   60, 7672,   62,   63
  7468. ,    0,  265,   64, 7674,   66,   67,    0, 7676,   69,   70
  7469. , 7678, 7680,    0,    0, 7682,  911, 7684, 7686, 7689,  765
  7470. , 7691,  468,  767, 7693,    0,    0,    0,    0,    0,  802
  7471. ,   52, 7695,   54,   99,    0, 1584, 7697,    0,    0,    0
  7472. ,    0, 7701,    0,    0,    0,    0, 1584,  100,    0,   52
  7473. , 7703, 7705, 7708, 7711,   65, 7713, 7715,   55, 7717, 7719
  7474. , 7721,   71, 7724,    0,    0,   73,   58, 7726, 7728, 7730
  7475. , 7732,   63,   64,   65, 7734, 7736,   66, 7739,   69, 7741
  7476. , 7743, 7746,   71, 7750, 7753, 7756, 7758,  223,  638,    0
  7477. , 1586,    0,    0,    0,    0,  468,  639,    0,    0,    0
  7478. ,    0,    0,    0,  469,    0,    0,   37,    0,    0,    0
  7479. ,    0,  366,    0,  281,    0,    0,    0,    0,  831,    0
  7480. ,    0,    0,    0,    0,  681, 7760,    0,    0,    0,    0
  7481. ,    0,    0,    0,    0,    0,    0,    0,    0, 7762,   39
  7482. ,   40,  901,    0,    0,    0,    0,    0,    0,    0,    0
  7483. ,    0,    0,  263,    0,    0,  948,    0,    0,    0,    0
  7484. ,    0,    0,    0,    0,    0,  543,    0,    0, 7764,   42
  7485. ,   43,   44,    0,    0,   45,    0,    0,    0,    0,    0
  7486. ,    0,  101,    0,  102,  103, 7766,    0,    0,    0,  599
  7487. ,    0,    0,    0,    0,    0,    0,    0,  883,    0,    0
  7488. ,    0,    0,    0,    0,    0,    0,  639,    0,  447,    0
  7489. ,    0,    0,    0,    0,    0, 1033,    0,    0,  604,    0
  7490. ,    0,  324,    0,    0,  751,    0,    0,    0,    0,    0
  7491. ,  977,    0,    0,    0, 1013,    0,    0,    0,  492,    0
  7492. , 7768,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7493. ,    0,    0,  736,    0,    0,    0,    0,    0,    0,    0
  7494. ,    0,    0,    0,  171,    0,    0,    0,    0,    0,   82
  7495. ,  105,    0,    0,    0,    0,    0,  919,   25,    0,  144
  7496. ,    0,    0,    0,   28,    0,    0,    0,    0,    0,    0
  7497. ,  106,    0,    0,    0,    0,    0,    0,    0,   52, 7771
  7498. ,   54,    0,    0,    0,   55,    0,    0,    0,  868,    0
  7499. ,    0,    0,    0,    0,    0,    0,    0,    0, 7773,    0
  7500. ,    0,    0,   65,  296,   67,    0,   68,   69,   70,   71
  7501. ,   72,    0, 7775,    0,    0,    0,    0,    0,    0,  674
  7502. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,  598
  7503. ,    0,    0,  324,    0,    0,  841,  241,    0,    0,    0
  7504. ,  862,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7505. ,    0,    0,    0,    0,    0,  693,    0,    0,    0,    0
  7506. ,    0,    0,    0,    0,  695,    0,    0,    0,    0,    0
  7507. ,  581,    0,  116,    0,    0,    0,    0,    0,    0,  248
  7508. ,    0,    0,    0,    0,  471,    0, 7777,    0, 1004,  324
  7509. ,    0,    0, 7779,  243,    0,  428,    0,    0,    0,    0
  7510. , 7781,  863,    0,  894,    0,    0,    0,  676,  107,    0
  7511. ,    0, 7783,  146,  706,    0,    0,    0,    0,  147,    0
  7512. ,    0,    0,  995, 7786,  194,  241,    0,    0,    0,    0
  7513. ,    0,    0,    0,    0,    0,  176,    0,    0,    0,    0
  7514. ,    0,    0,    0,    0,  429,    0,    0,  545,  188,  118
  7515. ,    0,    0,  642,    0,    0,    0,    0,    0,    0,    0
  7516. ,    0,    0,    0,  324,    0,  116,  912,    0,    0,    0
  7517. ,    0,    0,    0,    0,    0,  301,    0,    0,  949,    0
  7518. ,    0, 7788,  243,    0,  682,    0,  367,  683,    0,    0
  7519. ,    0,    0,    0,  430,    0,    0,    0,    0,    0,    0
  7520. ,    0,    0,    0,  352,    0,    0,    0,    0,    0,    0
  7521. ,    0,    0,    0,    0,    0,    0,  708,    0,  709,    0
  7522. ,    0,    0,  122,    0,   43,   44,    0,    0,    0,    0
  7523. ,    0,    0,    0,    0,    0,    0,   37,    0,    0,    0
  7524. , 7790,    0,  118,    0,    0,    0,    0,  234,    0,    0
  7525. ,    0,    0,  302,    0,    0,    0,    0,    0,    0,    0
  7526. ,  229,    0,    0,    0,    0,    0,    0,  684,   38, 7792
  7527. ,   40,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7528. ,    0,    0,    0,    0,  819,    0,    0,    0,    0,    0
  7529. ,    0,   37,    0,   37,  663,    0,    0,    0,  122,   42
  7530. ,   43,   44,  405,    0,   45,    0,    0,   46,    0,   47
  7531. ,    0,    0,    0,    0,    0,    0,    0,  617,    0,    0
  7532. ,    0,  341,    0,   38,   39, 7794,   39,   40,    0,    0
  7533. ,    0,    0,  448,  300,    0,    0,    0,    0,    0,    0
  7534. ,    0,  989,    0,    0,    0,  108,    0,    0,    0,    0
  7535. ,    0,   84,   52, 7796, 7798, 7801, 7804, 7806,   44, 7808
  7536. ,    0,   45,   46,    0, 7810,  397,   47,    0,    0,    0
  7537. ,    0,    0,    0,    0,    0,    0,    0,  930,    0,    0
  7538. , 7812,    0,    0,    0,    0,    0,    0,    0,   37,    0
  7539. ,    0,    0,    0,  171,    0,  381,    0,    0,    0,    0
  7540. ,    0,    0,    0,    0,    0,    0,  664,    0,    0,  718
  7541. ,  643,    0,  190,    0,    0,    0,  644,    0,    0,    0
  7542. ,   38,   39,   40,    0,    0,    0,    0,  122,   52, 7815
  7543. , 7817,    0,    0, 7819,   55,  286,    0, 7821,    0,    0
  7544. ,    0,    0,    0,    0, 1426,    0,  304,    0, 7823, 7825
  7545. , 7827, 7830, 7832, 7834,   67,    0, 7836,   69,   70, 7838
  7546. ,   72,   47,    0, 7840,    0, 7843,  194, 1426, 1426,    0
  7547. ,    0,  599,    0,    0,    0,    0,    0,    0, 1426, 1426
  7548. ,    0,    0, 7845, 7848,   53, 7850,   53,   54, 7853, 7855
  7549. ,    0,   55,    0,    0,    0,    0,    0,    0,   58,   59
  7550. , 7858, 7861,   62, 7863,    0,  599, 7865, 7869, 7871, 7873
  7551. ,   66, 7875,   69, 7877, 7879, 7881,   71, 7883,   73,   37
  7552. ,   73,    0, 7885, 7888,  116, 1521,    0,    0,    0,    0
  7553. ,    0,    0,   50,    0, 7890,    0,    0,    0,    0,    0
  7554. ,    0,    0,    0, 1521,    0,   51,    0,    0,    0,    0
  7555. ,    0,   38, 7893,   40,    0,  249,    0,   52,   53,   54
  7556. ,    0,    0,    0,    0,    0,    0,   38,   39,   40,    0
  7557. ,    0,  842,    0,  950,  407,    0, 7895,    0,  118,    0
  7558. ,   52, 7897, 7900,   43,   44,    0,   55,   45,    0,  711
  7559. ,   46,    0,   47,  282,    0,   58, 7902, 7904, 7906, 7908
  7560. ,   63,    0,   45,   64,   65, 7910,   67,   47,   68,   69
  7561. ,   70, 7912,   72, 1241,    0,   73,    0,   79,    0, 1241
  7562. ,    0, 1241,    0, 7914, 1241,    0,   86,    0,    0,    0
  7563. ,  885,   37,    0, 1241, 7916,    0,    0, 7918, 1241,    0
  7564. ,    0,    0, 1241,    0,    0,    0, 1241,    0,    0,    0
  7565. ,    0,    0,  625,    0,  864, 1241,    0,    0,    0,    0
  7566. , 1242,  174, 1241, 7920,   39, 7922,    0,    0, 1241,  300
  7567. , 1241, 1241,    0,    0, 1241,    0, 7924, 1241, 7928,    0
  7568. , 1241, 7930,    0,    0,    0, 1034,    0,    0,   37,    0
  7569. , 1241, 7932,  431,  122, 7934, 7936,   44,   38,   39, 7938
  7570. ,    0, 7941,   46, 1241,   47,    0,    0,    0,    0,  194
  7571. ,    0,   52, 7943,   54,    0,    0,    0, 7945,    0, 1241
  7572. ,   38, 7947,   40,    0,    0,    0, 7950, 7952, 7956, 7961
  7573. , 7963, 7965,   55, 7967, 7969,   65, 7971,   67,   47,   68
  7574. ,   69, 7973, 7975, 7977,   61,   62, 7979,    0,    0,   64
  7575. , 7981, 7984, 7986,   44,   68,   69, 7988,   71, 7990, 7992
  7576. ,    0, 7995,    0,  719,    0,    0,  407,  324,    0,    0
  7577. ,  645,    0,    0,    0,    0, 7997,    0,    0,    0,    0
  7578. ,    0,    0,    0,    0,    0,    0,    0,    0, 7999,    0
  7579. ,    0,    0, 8001,  902,   88,    0,    0,  968,    0,    0
  7580. ,    0,  665,    0,  122,    0,   43,   44,    5, 8004, 8006
  7581. ,    0,    0,    8,    0,    0,    0,    0,   37,    0,    0
  7582. ,    0,    0, 8008, 8010, 8012, 8014,    0,    0,    0, 8017
  7583. ,    0,    0, 8019,    0,    0,    0,    0,  646,    0,    0
  7584. ,    0,    0,    0, 8021,   13, 8023,   64, 8025, 8027, 8029
  7585. , 8031, 8033,   69, 8035,   71, 8037,    0,   52, 8039,   54
  7586. ,  197,    0,    0, 8041,    0,    0,    0, 8043,    0,    0
  7587. ,    0,    0,    0,  198,  199,  829,  158,  200,  201, 8045
  7588. , 8047, 8051, 8054,   67, 8058, 8060, 8062,   70, 8064,   72
  7589. ,   47,    0,   73,    0,    0,  390,  469,    0,  896,    0
  7590. ,  601,  408,    0, 8067, 8069, 8071, 8073, 8075,   68, 8077
  7591. , 8079,   71, 8081,    0,   37,   73,    0,    0,    0,  202
  7592. ,  203,  204, 8083,  206, 8086,  208,  209,  210, 8088,  301
  7593. ,    0,    0,    0,   52,   53,   54,  243, 1149,    0,    0
  7594. ,    0,    0, 8090, 8092, 8094, 1149, 8096, 8099, 8102, 1149
  7595. , 8105, 1149,    0,    0, 1149, 8107, 1149,    0, 1380,    0
  7596. , 1149,  265, 1149, 1149, 1149,    0,    0,    0,    0,    0
  7597. ,    0,    0,    0,    0,  806,  807,  122, 8109,   43,   44
  7598. ,    0,    0, 8111,   39, 8114, 8116,    0,   47,    0,    0
  7599. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7600. ,    0,    0,    0,    0,  214,  215, 8118,    0, 8120,   52
  7601. , 8122,   54,  122,   42, 8124, 8127,  499,  605, 8129,  500
  7602. ,    0,   46,    0,   47,    0,    0,    0,    0,  501, 1481
  7603. ,    0,    0, 8131, 8134,   66, 8137,    0, 8139,   69,   70
  7604. ,   71, 8141,    0,    0,   73,    0,    0,    0,    0,    0
  7605. ,  505,    0,    0,    0,    0,    0,    0,  506,  286,    0
  7606. ,  572,    0,    0,    0,    0,    0, 1481,  243,  619,  507
  7607. ,    0, 8144,   44,    0,  468,  886,    0,    0,    0,    0
  7608. , 1035,    0,  802,    0,    0,    0,    0,    0,    0,    0
  7609. ,   79,    0,    0,    0,  286,  808,    0,  217,    0,    0
  7610. ,    0,    0,    0,    0,    0,    0, 8147, 8149,   54,    0
  7611. ,    0,    0,   55,    0,  218,    0,  219,    0,  998,    0
  7612. ,  782,   58,   59,   60,   61, 8152,   63,    0,    0,   64
  7613. ,   65,   66,   67,    0, 8154,   69,   70,   71,   72,    0
  7614. ,    0,   73,   52,   53,   54,    0,    0,    0,   55,  432
  7615. ,    0,    0,  583,    0,    0,    0,    0,   58,   59,   60
  7616. ,   61,   62,   63,   32, 8156,   64,   65,   66,   67,    0
  7617. ,   68,   69,   70,   71,   72,    0,  698, 8158, 8162,  222
  7618. ,  223, 1560, 1560, 1560,    0,    0,    0,    0,    0,    0
  7619. ,    0, 1378,    0, 8164,  914,    0,  666,  471, 1560, 8166
  7620. , 8168, 8170,    0,    0,    0,    0,    0,    0,    0,    0
  7621. ,   38, 8172, 8174,    0,    0, 1560, 1560,    0,    0,    0
  7622. ,    0, 1560,    0,    0,    0,   38,   39,   40,    0,    0
  7623. ,    0,    0,    0,  285,  224,    0,    0,    0,    0,    0
  7624. ,  122,   42,   43,   44,    0,    0, 8176,  511,    0,   46
  7625. ,  512, 8178,  514,  515,  516, 8180, 8182, 8184, 8187, 8189
  7626. ,  522, 8191,    0,    0,   46,    0,   47,  524,  498,    0
  7627. , 1427,    0,  525,    0, 1427, 8193, 1427,    0,    0,  500
  7628. ,    0,  526,    0,  475,    0,    0, 8195,    0,    0,  809
  7629. ,    0, 8197,  194, 1427, 1427,    0,    0,    0, 1151,    0
  7630. ,    0, 8199, 1151,    0, 8201, 8203,  160, 8205, 8208, 8210
  7631. ,  529, 8213,  531,    0, 1588,    0,  112, 1151,    0,    0
  7632. ,    0,  755,  286,    0,    0,  756,    0,    0,    0,  713
  7633. ,    0,    0, 1151,    0,    0,  171,    0, 8215, 1151, 1151
  7634. , 1151, 1151, 8217, 1151, 1151, 8219, 1151, 1149,    0, 8221
  7635. , 8223, 1151,    0, 1381,    0, 1151,    0, 1151, 1151, 1151
  7636. ,  249,    0,    0,  952,  407,    0,  545,    0,  118,    0
  7637. , 8225, 8227,   54,    0, 1149,    0, 8229,   38,   39, 8231
  7638. ,    0,    0,    0,    0,  686, 8233,   53, 8236,    0, 1149
  7639. ,  229,   55,    0,   64,   65,   66,   67,    0,   68,   69
  7640. , 8238, 8240, 8242,   61, 8244, 8246,    0,  122, 8248, 8250
  7641. , 8253, 8256, 1149, 8258, 8261, 8263, 8265, 8268, 8271, 8274
  7642. ,   73, 1149, 1149, 1149,    0,    0, 8276, 1149,    0, 1149
  7643. , 1149, 1149,  504,    0,    0, 1241,    0, 1241,    0,    0
  7644. ,    0,    0,    0, 1241,    0, 1241,    0, 8278, 8280,   43
  7645. , 8282,    0, 8284,   45, 1572,    0,   46, 1241, 8286,  300
  7646. ,    0, 8288, 1241,    0,    0,    0, 1241,    0,  449,  132
  7647. , 1241,    0, 1572,    0,    0,  133,  301,    0,    0, 8290
  7648. ,    0,  237,    0,  243, 1242,    0, 1241,    0,    0,  620
  7649. ,    0,    0,    0,  284,    0, 1241,  384,    0, 1241,    0
  7650. , 8292, 1241,  171,    0,  226,    0,    0,    0,  176,    0
  7651. ,    0,  758,    0,    0,    0,  783,    0,    0,    0,    0
  7652. , 8294,  135,  136,    0,    0, 8296,    0,    0,  138, 8298
  7653. ,  140,  249,    0,    0,  738,    0,  921,   52,   53,   54
  7654. ,    0,    0,  171,   55,    0,    0,    0,    0,    0,    0
  7655. ,    0,    0,    0,    0,    0, 8300,    0,    0, 8302,  897
  7656. ,   64, 8304, 8306,   67,    0,   68, 8308, 8310, 8312,   72
  7657. ,    0,    0,   73,   37,    0,  761,  762, 8314, 8316, 8319
  7658. , 8321,    0,  767, 8323,  113,    0,    0,    0,    0, 8325
  7659. ,    0,  667,  548,    0,  873, 8327,    0,    0,    0,    0
  7660. ,   64,   65,   66, 8329,  551, 8331, 8333, 8335,   71, 8337
  7661. ,    0,  922,   73,    0,    0,    0,    0,  145,  146,  552
  7662. ,    0,    0, 8339,  699,  147,    0,   37,    0,    0,    0
  7663. ,    0, 8341,    0, 1419,  144,  122,   42,   43, 8343,    0
  7664. ,  685, 8345, 8347,   40, 8350,    0,   47,  194,    0,    0
  7665. ,    0,    0,    0,    0,    0, 8352,  142,    0, 8354,   39
  7666. ,   40, 8356,    0, 8358, 8360,    0,    0,  143,  616,    0
  7667. ,    0, 8362, 8364, 8366, 8368,    0,  164, 8370,    0,    0
  7668. ,   46,    0, 8372,    0,    0,    0, 1419,    0,  122,   42
  7669. , 8374, 8376,   14,    0,   45,    0,    0,   46,    0,   47
  7670. ,  165,    0,    0,    0, 8379,  166,  556,   15,    0,  122
  7671. ,   16,   43,   44,    0,    0,  557,    0,  286,    0,   17
  7672. ,  558, 8381,  560,  561,  562,  563,  564,  312,  599,    0
  7673. , 8383, 8385, 8387,    0,    0,    0,   38,   39, 8390,    0
  7674. ,  569, 8393,    0,    0,    0,  865,    0,    0,    0,    0
  7675. ,    0,  571,    0,  286,    0,    0,    0,  990,    0,    0
  7676. ,    0,   37,    0,    0,    0,   52, 8395, 8398,   43, 8400
  7677. , 8402,   55, 8404,   21,    0,   46,    0,   47,    0, 8406
  7678. ,  289, 1024,  144,  791,  792,    0,  793,    0,   64,   65
  7679. ,   66,   67,    0, 8409, 8411, 8413,   71,   72,  621,    0
  7680. ,   73,   52, 8415,   54, 8417,  145, 8419, 8421,    0,    0
  7681. ,    0,    0,  147,  114,    0,    0,   58, 8423, 8425, 8427
  7682. , 8429,   63,  370,  122, 8431, 8434, 8436, 8438,  607, 8440
  7683. ,   69, 8442,   71,   72,    0,  417,   73,    0,    0,   52
  7684. ,   53, 8444,   65,   66,   67,    0, 8446,   69, 8448,   71
  7685. ,   72,    0,    0,   73,    0,    0,    0,   22, 8450, 1486
  7686. ,    0,  125,  355, 8452,    0,    0,    0,    0,    0,    0
  7687. ,    0,    0,    0,    0, 1482,    0,  238,    0,  874,    0
  7688. ,    0, 8454, 1482,    0,    0,    0,    0,    0,    0,    0
  7689. ,    0,    0,    0,    0,    0,    0,   52,   53,   54,  330
  7690. ,    0,    0,   55,    0,  145, 8457,    0,  372,    0,    0
  7691. ,    0, 8460,   59,   60,   61,   62,   63,    0,  171,   64
  7692. ,   65,   66, 8463,  551,   68,   69,   70,   71,   72,    0
  7693. ,    0,   73,    0,  937, 8465,   53,  331,    0,    0,    0
  7694. ,    0,    0,    0,    0,   24,    0,    0,    0,    0,    0
  7695. , 8467, 8469,    0, 8471, 8476,   54, 1037, 8478,    0,   55
  7696. ,    0,    0,    0,  800,  477,    0,    0,    0,   37,    0
  7697. ,  623,    0,    0,    0,    0,    0,    0, 8480,    0,   67
  7698. ,    0, 8482,   69,   70,   71,   72,  726,    0,    0,    0
  7699. ,    0, 8484, 1026,    0,    0,   29,   30,    0,    0,    0
  7700. ,   38, 8486,   40,    0,    0,    0,    0,    0,    0,    0
  7701. ,   32, 8489,    0,  188,  132,    0,    0,    0,    0,    0
  7702. ,  133,    0,    0, 1459,    0,    0,    0,    0,    0,    0
  7703. ,  122, 8491,   43, 8493,    0,    0,   45,    0,  379,   46
  7704. ,    0, 8495,    0, 8497,    0,    0, 1015,  669, 1459,  670
  7705. ,  671,  672,  500,    0,    0,    0, 8499, 8501,    0, 8503
  7706. ,    0,  301,    0,    0,    0,  134,  135,  136, 8505, 1125
  7707. ,  255,    0,    0,  138,  139,  140,   37,    0,  249,    0
  7708. ,  194,    0,  194,    0,    0,    0,    0,    0,    0,    0
  7709. ,    0,    0,    0,    0,  755,    0,    0,    0,  756,   37
  7710. ,    0,    0,  122,    0, 8507,   44,    0,    0,   38,   39
  7711. ,   40,    0,  286,    0,    0,    0,    0,    0,    0,  116
  7712. ,    0,    0,    0,   35,    0,  171,    0,  176,    0,    0
  7713. ,    0,   38,   39,   40,    0,    0,    0,  407,  122, 8509
  7714. ,   43,   44,  385,    0,   45,    0,    0,   46,    0,   47
  7715. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7716. ,   52, 8511, 8513,   43,   44,    0, 8515, 8517,    0,  714
  7717. , 8519,    0,   47,    0,  688,  290,  923,  924,    0,    0
  7718. ,    0,  700,    0, 8521,   65, 8523,   67,  356, 8525,   69
  7719. ,   70,   71,   72,    0,    0,   73,    0, 8527,  844,   79
  7720. ,  141,  142,  468,    0,    0,    0,    0,    0,    0,    0
  7721. ,    0,    0,  143,    0,    0,    0,    0,    0,    0,    0
  7722. ,  265,    0,    0,  608,    0, 8529,  476,  308,    0,    0
  7723. ,    0,    0,   52, 8531, 8533,    0,  793,    0,    0,    0
  7724. ,    0,    0,    0,  373,    0,    0,    0,    0, 1041,    0
  7725. ,  239,    0,    0,    0,  240,    0, 8536,  453,    0,    0
  7726. ,  269,  270,  887,    0,    0,    0,    0,    0,   52,   53
  7727. ,   54,    0,    0,    0,   55,  189,    0,  190,    0,    0
  7728. ,    0,  176,   91,    0,  758,  386,    0,  775,  759,    0
  7729. ,    0, 8538, 8541, 8543,   67,    0,   68, 8546,   70,   71
  7730. ,   72,    0,    0,   73,    0,    0,  242,    0,    0,  272
  7731. ,    0,    0,    0,  243,   64, 8549,   66, 8551,    0,   68
  7732. ,   69, 8553,   71,   72,    0,    0, 8555,    0,    0,    0
  7733. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,  182
  7734. ,  527,    0,    0,    0,    0,  241,    0,  647,  761,  762
  7735. ,  763,  764,  765,  766,    0,  767,  768,  769,  728,    0
  7736. ,    0,  770,    0,   37,    0,  624,    0, 1027,    0,    0
  7737. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7738. ,    0,    0,    0,    0,  916,    0,    0,    0,    0,    0
  7739. ,    0,    0,    0,    0,  831, 8557,   39,   40,  970,    0
  7740. ,    0,    0,  243,    0,    0,  347,  116,    0,    0,    0
  7741. ,    0,    0,  398,    0,  332,    0,    0,    0,    0,    0
  7742. ,    0,    0,  648,    0,    0,  122, 8561,   43, 8563,    0
  7743. ,    0,   45,    0,    0,   46,    0,   47,    0,    0,    0
  7744. ,    0,    0,  241,  273,  255,  739,    0,    0,    0, 8565
  7745. ,  146,    0,    0, 1042,    0,  434,  147,    0,    0,  116
  7746. ,    0,   79,    0,  229,    0,    0,    0,    0,    0,    0
  7747. ,    0,    0,    0,    0,    0,   37,    0,    0,    0,    0
  7748. ,    0,    0, 8567,    0,    0,    0,    0,   94,    0,    0
  7749. ,   37,    0,  572,    0,    0,    0,    0,    0,    0,  243
  7750. ,    0,  116,    0,    0,  168,    0,  613, 8569,   39,   40
  7751. , 8572,   37,  812,    0,    0,    0,    0,    0,    0,    0
  7752. ,  171,    0, 8574,   39,   40,    0,    0,    0,    0,    0
  7753. ,   37,    0,    0,    0,  545,    0,  118,  122,   42, 8576
  7754. ,   44,    0,    0, 8578,   39,   40,   46,    0,   47,    0
  7755. ,    0,    0,  122,   42,   43, 8580, 8582,   54,   45,    0
  7756. ,    0, 8584,   38, 8586, 8588,    0,    0,    0,    0,  689
  7757. ,  291,    0,    0,  122, 8590,   43, 8592,    0, 8594, 8596
  7758. ,   66,   67,   46,   68, 8598, 8600,   71,   72,  649,    0
  7759. , 8602,    0,  122,   42, 8604,   44,  639,    0,   45,    0
  7760. ,    0,   46,    0,   47,    0,  534,    0,    0,    0,    0
  7761. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,  286
  7762. ,    0,    0,    0,    0,    0,    0,    0,  300,    0,  650
  7763. ,    0,    0,  171,    0,  925,    0,  833,    0,    0, 8606
  7764. ,    0,    0,    0,    0,  584,    0,    0,  171,  625,  170
  7765. ,    0,    0,    0,    0,    0,  286,    0,    0,    0,   37
  7766. ,    0,    0,    0,    0,  229,    0,    0,   52, 8608, 8611
  7767. ,    0,    0,    0,   55, 8613,    0,  478,    0,    0,    0
  7768. ,    0,    0, 8615,   53,   54,    0,    0, 8617,   55,    0
  7769. ,   64, 8620, 8622, 8624,    0,   68, 8626,   70, 8629,   72
  7770. ,    0,  420,   73,   52, 8631, 8633, 8635,   66, 8637, 8639
  7771. ,   68,   69,   70, 8641,   72, 1515,    0,   73, 8643, 8645
  7772. ,   60, 8647, 8649, 8653, 8659,    0,   64, 8661, 8664,   67
  7773. ,   46, 8666, 8668, 8670,   71,   72,    0, 8672, 8675, 8677
  7774. , 8679,   62, 8681,    0,    0, 8683,   65, 8685,   67,    0
  7775. ,   68, 8687, 8689,   71,   72,    0, 1241,   73,   37, 1241
  7776. ,    0, 1241, 8691,    0,  118,  405,    0,    0,    0,    0
  7777. ,    0,   38,   39,   40,    0,    0,    0,  357,  122,    0
  7778. ,   43,   44,    0,    0,    0,    0, 8693,  786,    0,  627
  7779. ,   38,   39,   40,    0,  407,    0,    0,  116,  720,    0
  7780. ,  118,  310,   42, 8695, 8697,    0,    0, 8699,    0,    0
  7781. ,   46,    0,   47,    0, 8702,    0,  806,  961,    0,  793
  7782. ,  122,   42,   43,   44,    0,    0,   45,    0,    0,   46
  7783. ,    0,   47,  845,    0,    0,    0,    0,    0,    0,  813
  7784. ,    0,    0,    0,    0,    0,    0,    0,  941, 8704, 8706
  7785. ,    0, 8709,   53,   54,    0,  300,   79, 8711,    0,  468
  7786. ,    0,    0,    0,    0,    0,    0,    0,  469,    0, 8713
  7787. ,    0,    0,  545,  898, 8715,   65,   66,   67,    0,   68
  7788. ,   69,   70,   71, 8717,    0,    0,   73,    0,    0,    0
  7789. ,    0,  300,    0,    0,    0,    0,  171,  132,    0,    0
  7790. ,    0,    0,  286, 8719,    0,    0,  195,    0,   52,   53
  7791. ,   54,    0,    0,    0,    0,  171,    0,    0,    0, 1028
  7792. ,    0,    0,    0,    0,  971,    0,  730,    0,    0,  917
  7793. ,    0,   52, 8722, 8724, 8728,  412,    0,   55,  413,    0
  7794. ,  147,    0,    0,  954,    0,    0,   58,   59, 8730, 8732
  7795. , 8734, 8737, 8739,    0,   64,   65, 8741, 8744,  140,   68
  7796. ,   69,   70,   71,   72,  690, 8746,   73,    0,    0,    0
  7797. ,  374,  375,    0,   64,   65,   66,   67,    0, 8748, 8750
  7798. , 8752, 8754,   72, 8756,  787,   73,    0,    0,    0,   79
  7799. ,    0,    0,    0,    0,    0,   85, 1558,    0,   86,    0
  7800. ,    0,    0,  629,    0,    0,    0,    0,  788,  122,   42
  7801. , 8758,   44,    0,    0,   45,    0,    0,    0,    0,    0
  7802. ,    0,  609,    0,    0,    0, 1579, 1579, 1579,    0,    0
  7803. ,    0,    0,    0,    0,    0, 1378, 1124,   37,    0,    0
  7804. ,    0,    0, 1579, 1579,    0, 1579,    0,    0,    0,    0
  7805. ,    0,    0,    0,    0,    0, 1579, 1579,    0,    0, 1579
  7806. , 1579,    0,    0,  943,    0, 1579,    0,    0,    0,   38
  7807. ,   39, 8760,    0,    0,    0,    0,    0,    0,    0,    0
  7808. ,    0,    0,    0,  141, 8762,    0,   85,    0,    0, 8764
  7809. ,    0,    0, 8766, 8768,  316,  143,    0,  982,    0,  122
  7810. ,   42,   43,   44,  171,    0,   45,  421,  146,   46,    0
  7811. ,   47,    0,    0, 8770,    0,    0,    0,    0,    0,    0
  7812. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7813. ,  436,    0,    0,    0,  391,    0,    0,    0,   52,   53
  7814. ,   54,    0,    0,    0,   55,  257,    0,    0,    0,    0
  7815. ,    0, 1009,  701, 8772,    0,  740,  116,    0,    0,    0
  7816. ,    0,    0,    0,    0,  298,    0,    0,    0, 8774,   71
  7817. , 8776,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7818. ,    0,  286,    0,    0,    0,   38,   39,   40,    0,    0
  7819. ,    0,    0,    0,    0,  171,    0,    0,    0,    0,    0
  7820. ,    0,    0,    0,    0,  335,    0,    0,  673,   37,  614
  7821. ,    0,    0,  437,    0,    0,  122, 8778,   43,   44,   87
  7822. ,    0, 8780, 1007,    0,   46,    0,   47,    0,    0, 8782
  7823. ,   53, 8784,    0,  118,    0,   55,    0,    0,    0,    0
  7824. ,   38, 8786, 8788,    0, 8791, 8794,   60, 8796, 8798,   63
  7825. ,    0,    0,   64, 8800,   66, 8802,    0,   68,   69,   70
  7826. ,   71,   72,    0,  548,   73,    0,  549,    0,    0,    0
  7827. ,  122,   42, 8804, 8807, 8809, 8811, 8813,   39, 8815, 8817
  7828. ,   38, 8819,   40,  795,    0,    0,  195,  972,    0,    0
  7829. ,  587,    0,    0,    0,    0,    0,    0,  286,    0,  348
  7830. ,  992,  815, 8821,    0,    0,  589,  122,   42,   43,   44
  7831. , 8823, 8825, 8827,   44,    0,   46,   45,   47,   37,   46
  7832. ,  962,   47,    0,    0,  300,  927,    0,    0,    0,  590
  7833. ,    0,    0,    0,    0,    0,    0,    0,    0,    0, 8829
  7834. ,  393,    0,    0,    0,   48,   52,   53, 8831,    0,    0
  7835. ,   38, 8833, 8835,    0,    0,    0,    0,    0,    0, 8837
  7836. , 8839,    0,  625,    0,    0,  125,   49,  171,   64,   65
  7837. ,   66, 8841,   39, 8843,   69,   70,   71, 8845,    0,    0
  7838. , 8848, 8851, 8853,   44,  336,  460,   45,    0,  286,   46
  7839. ,    0,   47, 8855,   39, 8857,    0,  592,  630,    0,    0
  7840. ,   52, 8859, 8862, 8865, 8867,   51,   55,   45, 8869, 8871
  7841. , 8873,   40, 8875,    0,    0,  147,    0,    0,    0,    0
  7842. ,    0,    0,  122, 8877, 8879, 8881,   67,    0, 8883,   69
  7843. ,   70, 8886, 8888, 8890,   72,   73, 8893,   53,   54,   41
  7844. , 8895, 8897, 8899,    0,    0,   45, 8902,    0,   46,    0
  7845. , 8904,   58, 8906, 8909,   61, 8911, 8913, 8915,   61, 8917
  7846. , 8919,   66, 8921, 8923, 8925, 8927, 8929, 8931, 8933, 8935
  7847. ,   70, 8937,   72,  537,    0, 8940,    0,  112,    0,    0
  7848. ,    0,    0,    0,  286,    0,    0,    0,    0,    0,    0
  7849. ,    0,  422,    0,    0,    0,   49,  171,    0,    0,    0
  7850. ,    0,    0,    0,  731,  265,    0,    0,    0,    0,    0
  7851. ,   52,   53,   54,   90,    0,    0,   55,  171,    0,    0
  7852. ,  266,   50,    0,    0,    0,   58,   59,   60, 8942,   62
  7853. , 8944,   52,   53, 8946, 8948,   66,   67,   55, 8950,   69
  7854. ,   70,   71,   72,    0,    0,   73,   58,   59,   60,   61
  7855. , 8952,   63,   52,   53, 8954,   65,   66, 8956,   55,   68
  7856. ,   69,   70,   71,   72,    0,    0,   73,    0,    0,   52
  7857. ,   53,   54,    0,    0,    0, 8958,   65,   66,   67,    0
  7858. ,   68, 8961, 8963,   71, 8965,   59,   60, 8967,   62,   63
  7859. ,    0,    0,   64,   65, 8970,   67,  702,   68,   69,   70
  7860. ,   71,   72,    0, 8973,   73,    0,    0,   13, 8975,    0
  7861. ,    0,    0,    0,    0,    0,    0,    0,  615,  379,   74
  7862. ,    0,    0,    0,  480,    0,    0,   16,    0, 1149,    0
  7863. ,    0,    0,  421,  146,    0, 8977,   39, 8979,    0, 8981
  7864. ,    0, 8984,  576,    0,    0,  676,    0,    0,    0,  468
  7865. ,    0, 1149,    0,    0,    0, 1149,    0, 8986,    0,    0
  7866. , 8989,    0,    0,  116,    0,  122,   42,   43, 8991,    0
  7867. , 1149,   45,  317,    0,   46,    0,   47,    0,    0,   37
  7868. ,  241,  928,  116,    0,    0, 8993,  482,  483,  484, 8995
  7869. , 1149, 1149, 8997, 9000, 9003, 1149, 9006, 1149, 9008, 1149
  7870. ,    0,    0, 1149, 9010, 1149, 1447, 1447, 1149, 1149, 1029
  7871. , 9012, 9014, 9016,   40, 9018,    0,  121,    0,    0,    0
  7872. ,    0,  461,  122, 9020, 9022,   44,    0,    0,   45,    0
  7873. , 9024,   46,  394,   47,    0,  716,  194,  243,  545,    0
  7874. ,  118,  122, 9026, 9028,   44,  456,  603, 9030,   74,  147
  7875. ,   46,    0,   47,    0, 9032,   37,    0,    0,    0,    0
  7876. ,  171,    0,    0,    0,    0,  486,    0, 9034,    0,  487
  7877. ,  488,  321, 9036,  102, 9038, 9040,    0,    0,    0,    0
  7878. ,    0,    0,    0,    0,    0,    0,    0,   38,   39,   40
  7879. ,    0,    0,    0,  652,    0,   52,   53, 9043,  599,    0
  7880. ,    0,   55,    0,    0,  286,    0,    0,    0,    0,    0
  7881. ,   58,   59,   60, 9045, 9047,   63,    0, 9049, 9051, 9053
  7882. , 9055,   67,    0, 9057,   69,   70, 9060, 9062,   47,    0
  7883. ,   73,  300,    0,    0,    0,    0,  125, 1019,    0,    0
  7884. ,    0,    0,    0,    0,    0,    0,    0,  822,   37,    0
  7885. ,  775,    0,   52,   53,   54,    0,  126,  180, 9064,    0
  7886. , 9066,  184,    0,    0,    0,  548,    0, 9068,  549,   26
  7887. , 9071, 9073,   53, 9076,    0,   64, 9078, 9081,   67,  219
  7888. , 9085, 9089, 9091,   71, 9094,  742,   58, 9097,   60,   61
  7889. ,   62,   63,  944,    0,   64, 9099, 9101,   67,    0, 9103
  7890. ,   69,   70,   71,   72,  945,  194, 9105,  144,    0,    0
  7891. ,  310,   42, 9107,   44,    0,    0, 9109,   39,   40,   46
  7892. ,    0,   47,    0,  722,  652,  854,   32,   33,    0,    0
  7893. ,    0,  555,    0,    0,    0,    0,    0,    0,    0,    0
  7894. ,    0,    0,    0,    0,    0,    0, 9111, 9113, 9116, 9119
  7895. ,    0,    0,   45,   55,    0,   46,    0,   47, 9121,  295
  7896. ,    0,  776, 9123, 9125,    0,    0, 9127,    0,    0,    0
  7897. ,   64,   65,   66,   67,    0,   68, 9129, 9131,   71, 9133
  7898. ,  200,  201,   73,    0,    0,    0, 1579,    0,  946, 9135
  7899. ,  550,  551, 9137, 9139,  559, 9141, 9143, 9145,  563,  564
  7900. ,    0, 1579, 1579, 9147,  566, 9149,    0,    0,  339,    0
  7901. ,   92, 9151,    0,  569,  570,    0,    0,    0, 9153, 9155
  7902. ,    0, 9157, 9159,  203, 9161,  205,  206,  207, 9164,  209
  7903. , 9166, 1579, 9169,  655,  656, 9172, 9176,    0,    0,    0
  7904. ,   52, 9178,   54,    0,  401, 9181, 9183,  213,    0,    0
  7905. ,    0,    0,    0,    0,    0,   58,   59,   60,   61,   62
  7906. ,   63,    0,  908,   64, 9185, 9187, 9189,    0,   68,   69
  7907. ,   70,   71,   72,    0,    0,   73,   52,   53,   54,    0
  7908. ,    0,    0,   55,    0,    0,    0,    0,    0,    0,  743
  7909. ,  744,  745,  732,    0,  122,   42,   43,   44,   79,   64
  7910. , 9191,   66, 9194,   46,   68, 9196,   70, 9199, 9201,  216
  7911. ,    0, 9204,  322, 9208,  103, 9210,    0,  670, 9212, 9214
  7912. ,    0,    0,    0,    0,    0,  568,    0,  569,    0,    0
  7913. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7914. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7915. , 9216,    0,    0,  549,    0,  229,    0,  611,    0,    0
  7916. ,    0,  585,  586,    0,  261,    0,    0,    0,    0,    0
  7917. ,  856,    0,    0,  538,    0,    0,  974, 9218,  181,    0
  7918. ,  900, 9220,   38,   39,   40,    0,  632,    0,    0, 9222
  7919. ,    0,    0,  589, 1039,    0,    0,    0,    0,  395,    0
  7920. , 9225,  314,  315,  316,    0,  194,    0,   25,  229,   26
  7921. ,   27,    0,  122, 9227, 9231,   44,  590,  218,   45,  219
  7922. , 9233,   46,    0,   47, 9235,   53, 9238,  577,    0,    0
  7923. ,   55,    0,    0,    0,  929,  539,    0,    0,    0,    0
  7924. ,    0,    0,    0,    0,    0,  194,    0,   64, 9240,   66
  7925. ,   67,    0, 9242,   69,   70,   71,   72,    0,    0,   73
  7926. ,    0,    0,  407,    0,  556,    0,   32,   33,    0,    0
  7927. ,    0,    0,    0,    0,    0,    0,    0,    0, 1002,   37
  7928. ,  220, 9244,  222, 9246,  748,    0,    0,    0,    0,    0
  7929. ,    0,    0,    0,    0,  268,    0,    0,    0,    0,  570
  7930. ,    0,    0,  195,    0,    0,    0,    0,  171,    0,    0
  7931. ,    0,   38,   39, 9248,    0,    0, 1241,  194, 9250,    0
  7932. ,    0,    0,    0,    0, 1241,    0, 1241,    0, 9252, 1241
  7933. ,    0,    0,    0, 9255, 1220, 1220,    0, 1220, 1241, 1241
  7934. ,    0,  122, 9257, 9260, 9263,    0,    0, 9265,   55,    0
  7935. , 9268, 1241,   47,    0,  246,    0,    0,    0,    0,    0
  7936. , 9270,    0,    0,    0,    0, 9272,   65, 9275,   67,    0
  7937. , 9277,   69,   70,   71, 9279, 1220, 1241, 9281,    0, 1241
  7938. ,    0, 1241, 1241,    0,    0,    0,    0,    0,    0,    0
  7939. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7940. , 1031,    0,    0,    0,   87,    0, 9283,    0,    0,    0
  7941. ,    0,    0,    0, 9285,    0,    0,    0,  578,    0,    0
  7942. ,    0,    0,    0,  678,  704,    0,    0,    0,    0,    0
  7943. ,  837,    0,    0,    0,    0,    0, 9287,    0,    0,  402
  7944. ,    0,    0,    0,    0,    0,  362,    0,    0,    0,    0
  7945. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  7946. ,    0,    0,    0,    0,    0,    0, 1011,  194,  651,    0
  7947. ,    0,   52,   53,   54,  241,    0,    0,   55,    0,    0
  7948. ,    0,    0,    0,    0,    0,    0,    0,  334,    0,    0
  7949. ,  749,    0,    0,   79,   64, 9289, 9291,   67,    0,   68
  7950. ,   69,   70,   71, 9293,    0,    0, 9295,    0,    0,    0
  7951. ,    0,    0,    0,    0,    0,  468,   97,    0,    0,  440
  7952. ,  441,  442,  443, 9297, 9299,    0,    0,    0,    0,    0
  7953. ,    0,  243,    0,    0,    0,    0,  175,    0,    0,    0
  7954. ,    0,  379,  742,    0,    0,    0,    0,    0,    0,  616
  7955. ,    0,    0, 9301, 9303,  411, 9305,  176,    0, 9307,  270
  7956. ,    0,    0,    0,    0,    0,  116,    0,    0,    0,    0
  7957. ,    0,    0, 9309,  146,    0, 9311,  270,    0,    0,  147
  7958. ,    0,    0,  634,    0,    0,    0,    0,    0,    0,  271
  7959. ,  635,    0,    0,    0,    0,  462,    0,    0,   37,    0
  7960. ,    0,    0,    0,    0,    0,  241, 9313,  272,    0,    0
  7961. ,    0,    0,    0, 9315,  177,    0,    0,    0,  850,    0
  7962. ,  229,    0,    0,    0,  272,    0,    0,    0,    0,    0
  7963. ,   38,   39, 9317,  858,   86,   43,  243,   44,  153,   46
  7964. ,  457,  380,  335,   38,   44,  273,  798,   50,  799,  274
  7965. ,  909,  778,   46,   91,  745,  656,  800,  779,   47,  194
  7966. ,  658,   52,   37,  195,   60,   70,   50,   72,   38,  471
  7967. ,   40, 1040,   73,  746,   54,  994,   56,   37,   57,  425
  7968. ,   68,   39,  579,   43,   79,   46,   94,   39,   74,  116
  7969. ,   53,   39,   55,   40,   38,  343,   39,  403,   43,  122
  7970. ,   44,  154,   43,   41,   44,   42,   45,   43,   46,  173
  7971. ,  404,   45,   67,   46,   69,   37,   70,   47,   71,   43
  7972. ,  122,   44,   42,  660,   45,   47,   46,  116,  276,  299
  7973. ,   49,  301,   40,  825,   52,  243,  122,   53,  344,   42
  7974. ,   54,    2,  286,   45,  596,  310,   64,   42,   65,  311
  7975. ,   51,   66,   44,  286,   67,   68,  542,   45,   71,   46
  7976. ,   72,   80,   54,  625,   52,    3, 1003,   53,   54,   52
  7977. ,   55,   54,   58,   37,   59,   56,   60,   57,   62,   52
  7978. ,   58,   63,   53,   59,   54,   52,   60,   53,   61,   64
  7979. ,   54,  312,  300,   62,   65,   63,   66,   55,   55,   64
  7980. ,   68,  286,   65,   69,   66,   70,   67,   72,  351,   68
  7981. ,   58,   70,   73,   59,   71,   60,   72,   63,  196,   73
  7982. ,   66,   64,   67,   65,  947,   66,   38,   68,   67,   39
  7983. ,   69,   40,   70,   68,  286,  755,   71,   69,   72,   70
  7984. ,  839,   71,  300,   52,   37,  122,   53,   42,   54,   47
  7985. ,   39,   59,  121,   64,   54,  826,   69,   72,   38,   59
  7986. ,  121,  122,   63,   43,  189,   44,   64,   65,  190,   45
  7987. ,   67,   46,   69,  342,   37,   70,   47,   71,  882,  364
  7988. ,   44,  122,  446,   38,  459,  918,  788,  144,   40,   38
  7989. ,   44,  840,   45,  910,  797,  459,  122,   53,   42,   54
  7990. ,   43,  122,  277,   44,   42,   43,  125,  324,   55,   44
  7991. ,   47,   46,   47,  636,   64,    4,   65,    5,   66,  126
  7992. ,    6,   67,  125,    7,   69,    8,   70,  827,  975,  893
  7993. ,   73,  760,   54,   55,  326,  126,  463,  345,  378,  314
  7994. ,  693,  493,  278,   53,  421,   64,   54,  268,  146,   65
  7995. ,  279,   66,  280,   67,  127,   68,  128,  147,   70,  129
  7996. ,  694,   71,   72,  130,   52,  195,   53,  597,   73,   54
  7997. ,   58,  171,   59,  116,   61,  124,   65,  527,   68,  828
  7998. ,   71,  155,   72,  806,   73,  861,  125,  793,  763,   98
  7999. ,  764,  191,  766,  192,  768,  468,   53,  469,   55,  126
  8000. ,  637,   16,  933, 1012,   53, 1584,   54, 1584,   52, 1584
  8001. ,   53,  344,   64,   54,   66,   55,   67,  127,   68,  128
  8002. ,   69,  735,   70,  724,  129,   72,  130, 1584,   59,  194
  8003. ,   60, 1584,   61, 1584,   62,   66,   64,   67,   65,    9
  8004. ,   68,   67,   70,   68,   71, 1584,   69,   72,  803, 1584
  8005. ,   70,   72,  470,   81,   73, 1584,  220, 1584,  221,   73
  8006. ,  222,  195,  640,  857,   38,  599,  122,  229,  104,  965
  8007. ,  959,  193,  662,   53,  804,  229,  641,  471,  301,  249
  8008. ,  780,   98,  966,  834,  421,  156,   16,  707,  544,  195
  8009. , 1044,  710,  300,  685,   39,   40,   38,  122,   53,   42
  8010. ,   54,  109,   43,  122,   27,   44,   42,  913,   43,   45
  8011. ,  353,   47,   46,  934,  472,  464,   43,   53,   44,   54
  8012. ,  546, 1426,  286,  303,  171, 1426, 1426,  157,  171,   41
  8013. , 1426,   64,   42,   65,   43,   66,   44,   68,   45,   71
  8014. ,   46,  935,  895,   73,  582, 1426,  324,  547, 1426,   52
  8015. , 1426,  996,   54,   52,  250, 1589,  500,   55,  251,   60
  8016. ,  600,  389,  116,   61,  324,   63,  737,   64,   49, 1521
  8017. ,   65, 1521,   66,   64,   67,   65,   68,   67,   70,   68
  8018. ,   71,   69,   72,   70,  194,   72,  869,  229, 1521,  195
  8019. ,    2, 1021,   37, 1521, 1005,   39,  545, 1328,  884,  122
  8020. ,   53,   42,   54,  122,   59,   42,   60,   43,   61,   44
  8021. ,   62,   46,   66, 1241,   71, 1241,   85, 1241,  327, 1241
  8022. ,  368,   38,  286,   37,   40,  997, 1241, 1241,  171,  286
  8023. , 1241, 1241,  175,  171, 1241,   42, 1241,   43, 1241,   40
  8024. ,   45, 1241,  406,  176, 1241,   53, 1242,   55,  758,   39
  8025. ,  131,   52,   58,  122,   53,  752,   59,   42,   54,  870
  8026. , 1241,   60,   43,   61,   44,   62, 1241,   63,   45, 1241
  8027. , 1241,   64,   46,   66,   58,   70,   59,   71,   60,   72
  8028. ,   63,   73,   65,  696,  122,   66,   42,   67,   43,   70
  8029. ,   45,   72,  406,   46,  283,  177,   73,   47,  473,  465
  8030. ,  967,  171,  767,  305,   87,  110,   10,  265,    7,  806
  8031. ,  324,  978,   52, 1022,   53,  793,  843,   54,  871,   55
  8032. ,  618,  286,  241,  196,  171,   14,  494,   65,  495,   66
  8033. ,   38,   67,   39,  412,   40,   68,  413,   70,   72,  284
  8034. ,   53,   73,   55,   16,  697,  496,  805,  324,   64,   42
  8035. , 1149,   52,   65,   43,   53,   66,   44,  781,   54,  252
  8036. ,  235,   68,   45,   69,   55,   71,   46,  468, 1149,   64
  8037. ,  409,   65,  410,   66,  411,   67,  412, 1149, 1149,   69
  8038. ,  413,   70, 1149,   72,  969, 1149,  205,  414,  207,  920
  8039. ,  111, 1149,  211, 1149,  212, 1149,  213, 1149,   38,   11
  8040. ,  903, 1149,   39,  474, 1149,   40,   37, 1149, 1149,   12
  8041. ,  793,   42,   38,   45,  178,  712,   40,   46,   86,  497
  8042. ,  216,  951,  498,  241,   53,   43, 1485,  328,   55,   44
  8043. ,   45, 1485,   64,  502,  369,   65,   87,  503,   67,   88
  8044. ,   68, 1481,  249,   72,  504,   43,  171,   79,   52,   26
  8045. ,  171,   53,   27,  753,   62,  820,   68,  508,   33,   73
  8046. ,  509, 1560,  220,   37,  221,   37,  249,   52, 1560,   53
  8047. , 1560,   54, 1560, 1560,   39, 1560,   40,  510,   45,  513
  8048. ,   47,  122,  517,   42,  518,   43,  519,  225,   44,  520
  8049. ,  521, 1427,   45,  523, 1427, 1151,  476,  236,  116, 1427
  8050. , 1014,  159, 1427, 1151, 1427,  179,  194,  527, 1151, 1427
  8051. ,  161,  872,  528, 1427,  625,  530,  286, 1151, 1006, 1151
  8052. ,   37, 1151,  195, 1151,  171, 1151, 1149,   52,  804,   53
  8053. , 1149,   55, 1149,   40,   52,  287,   37, 1149,   54,   58
  8054. ,   70,   59,   71,   60,   72, 1149,   62,   63,   73,   64
  8055. ,   42, 1149,   65,   43, 1149,   66,   44, 1149,   67, 1149
  8056. ,   68,   45, 1149,   69, 1067,   70, 1149,   71,   46, 1149
  8057. ,   72,   38, 1149,   47,   39, 1067,   40, 1149,  241, 1241
  8058. ,  122, 1241,   42,  532,   44, 1572,  830, 1241,   47, 1241
  8059. ,  162, 1241,  415, 1241,  725,  760,  134,  406,  137,  264
  8060. ,  139,  682,  324,  683,  904, 1036,   65,  799,   66,   69
  8061. ,  450,  527,   70,  800,   71,  763,   52,  764,  354,   53
  8062. ,  765,   54,  766,  382,  768,   55,  915,  288,  549,  346
  8063. ,  550,   67,   38,   68,   39,   69,   40,   70,   37,   72
  8064. ,  553,  306,  554,  307,  936,   44,   38,   45, 1541,  606
  8065. ,   39,  533,   46,  771,  141,   38,  555,  253,  163,  742
  8066. ,  754,  194,  254,  409,  122,  410,   42,  411,   43,  412
  8067. ,   44,  413,   45, 1541,   47,  874,   43,  414,   44,   13
  8068. ,  195,   37,  195,  559,  565,  171,  421,  566,  146,  567
  8069. ,  416,  147,  568,   40,  570,  121,  171,  122,   53,   42
  8070. ,   54,   44,   18,  265,   19,   45,   20, 1023,  790,  687
  8071. ,   38,   68,   39,   69,   40,   70,  116,   53,  433,  329
  8072. ,  146,   43,   55,   44,  622,   59,   52,   60,   53,   61
  8073. ,   54,   62,   55,   64,   42,   65,   43,   66,   44,  504
  8074. ,   67,   68,   45,  476,   70,   64,   54,   68,  180,   70
  8075. ,  124,  167,   23, 1486,  451,  999,  126,  144,  254,  371
  8076. ,  146, 1482,   58,  147,  550,   67,   98,   52,  374,  324
  8077. ,  960,   25,  905,  144,   16,   52,   26,   53,   27,  799
  8078. ,   28,  668,  148,  297,  227, 1025, 1459,   39,  228,   31
  8079. ,  241,   33,   42,  115,  338,   44,  498,   47,  229,  324
  8080. ,  794, 1459,  568,   34,  569, 1459,  243, 1125,  875,   43
  8081. ,   42,  195,  122,   53,   42,   54,  602,   55,   45,  181
  8082. ,   46,   86,  452,   64,  727,   66,  120,   68,  757,  116
  8083. , 1016,  458,  806,   53,  792,  784,   54,  171,  241,   64
  8084. ,  271,   52,   65,   53,   66,  760,   54,   69,   55,   92
  8085. ,  539,   65,  418,   67,  979,   70,  419,   73,  938,  832
  8086. ,   38,   36,   42,  144,  771,   44,  939,  145,  810,  729
  8087. ,  573,   38,  286,  991,  811,   38,  256,   43,  244,   38
  8088. ,   45,   44,   52,  599,   53,   46,   55,   47,   39,  715
  8089. ,   40,   42,  309,   44,  117,   64,  118,   45,   65,   47
  8090. ,   69,  953,   70,  785,   73,   43,  333, 1000,  169,  171
  8091. ,   53,  230,   54,  119,  286,   83,   52,  387,  940,  171
  8092. ,  116,   38,   65,   39,   66,   40,   67, 1241,  834,   69
  8093. , 1241,   71, 1241,   53,   64,   54,   65, 1241,   67, 1241
  8094. , 1241,   55,   71, 1515, 1241,   58, 1241,   59,  122,   61
  8095. ,   42, 1241,   62,   52,   43, 1241,  116,   63,   53,   84
  8096. ,   44,   54,   45, 1241,   65,   66,   55, 1241,   68,   47
  8097. ,   69, 1515,   70,  194,   58,  249,   73,   59,   60,   37
  8098. , 1241,   61,  772,   63, 1242,   64, 1241,   66,   69,  183
  8099. ,  835,   70, 1241,  454,  406,  626,  265,  311,  980,   44
  8100. ,  981,  888,   45,   84,  231, 1043,  876,  194,  942,  249
  8101. ,   52,  435,   55,  312, 1017,  814,   64,  118,   72,  286
  8102. ,  926,  628,  133,  409,   53,  421,  410,  399,   54,  146
  8103. ,  411,  134,   60,  135,   61,  136,   62,   52,   63,   53
  8104. ,  414,   54,  138,   66,   55,  139,   67,  300,  292,   38
  8105. ,   68,  846,   69,   40,   70,  906,   71,  358,  334,   43
  8106. , 1579,   40,  479,  639,  142,   86,  313,  455,  314, 1001
  8107. ,  315,  194,  147, 1038,   37,  471,   70,  195,   72,  359
  8108. ,   42,   45,   88,   52,  194,   54,  545,   39,  258,  574
  8109. ,   40,   38,   58,   37,   40,   59,  438,   61,  575,   62
  8110. ,   37,   65,   75,   67,   76,  599,   43,  122,   44,   42
  8111. ,  585,   43,  586,   44,   38,   45,   40,   45,   46,  340
  8112. ,   47,   39,  588,  773,  171,   41,   89,   42,   45,   43
  8113. ,   37,  392,  535,   54,   39,   55,   40,  459,  691,  536
  8114. ,  293,   37,   38,   67,   40,   68,  556,   37,   72,  122
  8115. ,  852,   73,  907,   42,   43,  116,   38,   50,  591,   40
  8116. ,  171,  310,   53,   42,   54,   52,  311,   53,   44,   54
  8117. ,  145,   55,   38,  146,   46,   39,  570,   47,   64,   42
  8118. ,   65,   43,   66,   44,   68,   45,  172,   71,   46,   72
  8119. ,   70,  847,   47,   71,  889,   52,   42,   52,   43,   53
  8120. ,   55,   44,   54,  337,   55,  741,   47,  821,   59,   56
  8121. ,   60,   57,   62,   58,   63,   59,  312,   60,   64,   62
  8122. ,   65,   63,  286,   67,  853,   64,   68,   65,   69,   66
  8123. ,   70,   67,  963,   71,   72,   68, 1018,   69,   73,  232
  8124. ,   71,  171,   73,   61,  721,   63,  854,   64,   54,   65
  8125. ,   51,   68,  176,  631,   62,   64,   54,  674,   67,  468
  8126. ,   55,   64,   56,   69,   57,   70,   58,   72,  816,   61
  8127. ,   73,  983,   66,   78,   37,  294,  955,   14,  899,   38
  8128. ,  319,   40,  194,  147,  259,  675,  201,  469,  774, 1149
  8129. ,   37, 1149,   44, 1149,  481, 1149,  610,  485,  314,   38
  8130. , 1149,  315,   39, 1149,  316,   40, 1149, 1008, 1149,  817
  8131. , 1149,  116, 1149,  245, 1149,   38, 1149,   39, 1149,  973
  8132. ,  796,  421,   42,  146,   43,  301,  147,  421,   42,  146
  8133. ,   43,  286,   45,  692,  651,  703,  260, 1009,  322, 1010
  8134. ,  103,  852,  104,  349,   54,  376,  229,   61,   62,  194
  8135. ,  171,  122,   64,   42,   65,   43,   66,   44,   68,  124
  8136. ,   45,   71,   46,  890,   72,  855,   55,  489,  338,  194
  8137. ,   25,  388,   27,  185,  400,   52,  195,   28,   54,  550
  8138. ,  423,   65,  551,  218,   66,   55,  106,   38,   68,  377
  8139. ,   39,   69,   40,   70,  378,   37,   72,  149,   73,   59
  8140. ,  553,   65,  993,   66,   68,  267,  229,   73,  311,  171
  8141. ,   38,   45,  122,  196,   42,   13,   52,   43,   14,   53
  8142. ,   44,   54,  471,  360,  195,  194,  361,  318,  312,   16
  8143. ,  198,   69,  319,   70,  556,   72,  877,  233,  878,  286
  8144. , 1030,  558,  560,   91,  561,  120,  984,  562,  565, 1579
  8145. ,  567,  171,  568, 1378,  848, 1579,  407, 1579,  144, 1579
  8146. ,  229,  202,  571,  818,  204,  677,  208,  653,  490,  210
  8147. ,   37,  654, 1579,  836,  657, 1579,  439,  658, 1579,  171
  8148. , 1579,   53,  668,  211,   55,  212,   38,   65,   39,   66
  8149. ,   40,   67,   45,   65,   75,   67,   76,   47,   69,  320
  8150. ,   71,  214,  249,   72,  215,  964,  733,   73,  321,  816
  8151. ,  102,  669,  104,  671,   93,  176,  672,  548,   37,  956
  8152. ,  587,  717,   86,  985,  171,  588,  323,   94,  746,  453
  8153. ,   28,   42,  747,   43,  106,  186,   52,  891,  466,   54
  8154. ,  201,  986,   65,   68,  424,  591,  221,  592,  223,   40
  8155. ,  332, 1241,   77, 1241,  540,  174,  879, 1220,   42, 1241
  8156. ,   52,   43, 1241,   53,   44,   54,   45, 1241,  341,  831
  8157. ,   46, 1241,  350, 1242,  541,   64, 1241,   66,  857,   68
  8158. ,  407,   72,   84,   73,  406,   95,  849,  150,  171,  491
  8159. ,   65,  593,   66,   96,  249,   72,  734,   73,  469,  444
  8160. ,  195,  445,  409,  612,  866,  410,  659,  412,  413,  269
  8161. ,  633,  414,  957,  269,  271,  151,  504,   45,  823,   40
  8162. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8163. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8164. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8165. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8166. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8167. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8168. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8169. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8170. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8171. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8172. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8173. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8174. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8175. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8176. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8177. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8178. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8179. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8180. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8181. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8182. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8183. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8184. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8185. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8186. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8187. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8188. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8189. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8190. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8191. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8192. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8193. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8194. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8195. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8196. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8197. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8198. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8199. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8200. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8201. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8202. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8203. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8204. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8205. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8206. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8207. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8208. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8209. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8210. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8211. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8212. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8213. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8214. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8215. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8216. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8217. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8218. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8219. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8220. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8221. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8222. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8223. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8224. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8225. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8226. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8227. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8228. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8229. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8230. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8231. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8232. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8233. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8234. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8235. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8236. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8237. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8238. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8239. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8240. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8241. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8242. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8243. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8244. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8245. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8246. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8247. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8248. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8249. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8250. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8251.  ) ;
  8252.         --| Actions to perform for all combinations of parser
  8253.         --| states and input tokens.
  8254.         -- NYU Reference Name: ACTION_TABLE1
  8255.  
  8256.     ActionTableTwo :
  8257.         constant array (ActionTableTwoRange)
  8258.         of GC.ParserInteger :=
  8259.          (286850,22949,    0,    0,    0,    0,154905,    0,    0,    0
  8260. ,    0,    0,86067,    0,    0,    0,304077,    0,177865,372924
  8261. ,    0,    0,    0,263925,263926,    0,    0,    0,    0,263931
  8262. ,    0,    0,    0,177880,263936,    0,    0,    0,    0,97568
  8263. ,    0,    0,    0,    0,131995,    0,    0,    0,    0,    0
  8264. ,    0,    0,    0,    0,    0,    0,    0,263959,    0,    0
  8265. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8266. ,    0,    0,97601,97602,    0,    0,    0,    0,218084,263981
  8267. ,    0,154980,    0,154982,    0,    0,    0,    0,    0,109092
  8268. ,    0,    0,    0,    0,    0,229575,321368,    0,    0,    0
  8269. ,    0,97630,97631,97632,    0,    0,    0,97636,258273,332855
  8270. ,    0,    0,    0,    0,    0,    0,    0,    0,264020,    0
  8271. ,292707,166494,    0,    0,    0,34547,    0,    0,    0,    0
  8272. ,57500,    0,    0,    0,    0,97664,    0,    0,    0,    0
  8273. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8274. ,    0,    0,    0,    0,264056,264057,    0,97686,    0,264061
  8275. ,    0,    0,    0,    0,    0,264067,264068,    0,264070,264071
  8276. ,    0,264073,264074,264075,155073,    0,264078,264079,264080,264081
  8277. ,    0,264083,264084,    0,264086,    0,28871,    0,    0,    0
  8278. ,    0,    0,51825,    0,    0,    0,97725,    0,    0, 5936
  8279. ,    0,    0,    0,    0,    0,401795,    0,    0,    0,    0
  8280. ,    0,    0,    0,    0,    0,28900,28901,28902,28903,    0
  8281. ,    0,28906,86277,    0,    0,    0,    0,    0,    0,    0
  8282. ,    0,97760,97761,    0,332980,    0,    0,97766,315773,    0
  8283. ,    0,315776,    0,    0,    0,    0,97775,97776,97777,97778
  8284. ,97779,97780,    0, 5990,97783,97784,97785,97786,    0,    0
  8285. ,97789,97790,97791,97792,    0,    0,97795,    0,    0,    0
  8286. ,    0,    0,    0,235490,235491,    0,212545,    0,212547,    0
  8287. ,235497,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8288. ,189611,    0,344512,    0,    0,344515,    0,    0,    0,298623
  8289. ,    0,    0,    0,57673,    0,    0,212575,212576,    0,212578
  8290. ,28995,    0,212581,    0,    0,    0,    0,212586,287168,    0
  8291. ,166693,    0,    0,304384,    0,    0,    0,    0,    0,    0
  8292. ,    0,298655,    0,298657,    0,57705,57706,57707,    0,    0
  8293. ,    0,    0,    0,    0,189665,29030,    0,29032,34770,    0
  8294. ,287200,    0,    0,    0,166727,    0,    0,    0,    0,    0
  8295. ,    0,298685,298686,    0,    0,    0,    0,    0,57738,29054
  8296. ,    0,    0,298696,29058,    0,    0,    0,29062,344598,    0
  8297. ,287230,287231,    0,    0,166757,166758,287236,    0,    0,287239
  8298. ,46286,    0,178239,166766,    0,    0,120873,    0,384777,    0
  8299. ,    0,212670,    0,    0,    0,132356,304467,252835,252836,252837
  8300. ,97939,    0,396265,    0,    0,    0,    0,298741,    0,    0
  8301. ,    0,    0,    0,69267,    0,    0,    0,    0,120905,120906
  8302. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,252867
  8303. ,252868,    0,212711,    0,310242,241399,252874,57817,252876,    0
  8304. ,373355,    0,    0,    0,132405,    0,298780,    0,    0,    0
  8305. ,    0,    0,    0,    0,    0,212734,212735,    0,    0,120946
  8306. ,    0,212740,    0,304534,275850,287325,275852,166850,    0,350436
  8307. ,    0,    0,    0,    0,    0,    0,    0,    0,304549,    0
  8308. ,    0,298815,298816,    0,    0,    0,57866,    0,    0,304560
  8309. ,    0,57871,98031,    0,    0,    0,    0,    0,    0,298833
  8310. ,    0,    0,    0,    0,    0,    0,    0,298841,    0,    0
  8311. ,    0,    0,298846,    0,57894,    0,    0,    0,287378,287379
  8312. ,    0,    0,252960,287383,287384,    0,    0,    0,    0,    0
  8313. ,    0,    0,    0,    0,166917,287395,149708,166920,    0,    0
  8314. ,    0,    0,    0,121030,    0,    0,    0,    0,298882,189880
  8315. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8316. ,293157,293158,    0,253001,293161,218581,    0,293164,149740,    0
  8317. ,149742,    0,253010,    0,253012,253013,253014,253015,121065,121066
  8318. ,    0,253019,253020,253021,121071,253023,    0,253025,253026,    0
  8319. ,17811,17812,253030,121080,    0,121082,121083,121084,    0,149771
  8320. ,    0,    0,    0,121090,    0,    0,121093,    0,    0,    0
  8321. ,121097,    0,    0,121100,    0,    0,    0,    0,    0,17840
  8322. ,17841,17842,    0,    0,253062,17846,    0,333383,17849,212908
  8323. ,17851,310439,    0,    0,367812,367813,    0,    0, 6385,    0
  8324. ,    0,344871,344872,    0,356348,    0,98185,    0,    0,    0
  8325. ,    0,339144,    0,293250,    0,    0,    0,    0,    0,333415
  8326. ,333416,    0,212941,212942,58044,    0,212945,    0,    0,    0
  8327. ,344900,344901,344902,    0,    0,17896,    0,    0,    0,344909
  8328. ,    0,344911,172802,    0,    0,    0,    0,    0,293285,    0
  8329. ,    0,    0,    0,    0,    0,333451,75287,212976,333454,344929
  8330. ,    0,17922,    0,    0,    0,310513,    0,    0,    0,    0
  8331. ,    0,    0,    0,    0,    0,    0,293313,    0,    0,293316
  8332. ,293317,304792,    0,    0,    0,    0,    0,367905,149900,149901
  8333. ,    0,    0,    0,    0,    0,    0,121223,    0,    0,    0
  8334. ,121227,121228,    0,    0,    0,    0,    0,213026,161394,17970
  8335. ,    0,    0,    0,    0,    0,17976,    0,149929,    0,    0
  8336. ,    0,299095,    0,    0,    0,    0,17987,    0,17989,17990
  8337. ,    0,333527,17993,    0,17995,17996,    0,    0,17999,18000
  8338. ,    0,    0,    0,    0,    0,333541,    0,    0,    0,304860
  8339. ,    0,276177,304863,    0,    0,    0,    0,    0,    0,276185
  8340. ,345030,    0,345032,12287,    0,230295,    0,    0,    0,    0
  8341. ,    0,    0,    0,    0,    0,    0,230306,12301,    0,333575
  8342. ,    0,    0,    0,    0,345054,    0,    0,213106,    0,    0
  8343. ,    0,345061,    0,    0,    0,345065,213115,    0,    0,    0
  8344. ,    0,213120,333598,333599,    0,    0,213125,    0,333604,    0
  8345. ,    0,    0,213131,    0,    0,    0,    0,172977,207400,    0
  8346. ,230350,    0,    0,    0,    0,350832,207408,    0,    0,    0
  8347. ,    0,    0,    0,350840,    0,    0,63993,    0,    0,    0
  8348. ,    0,98420,    0,58263,    0,    0,    0,    0,304959,    0
  8349. ,    0,    0,    0,    0,218910,    0,    0,    0,    0,    0
  8350. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,64026
  8351. ,64027,327930,    0,    0,    0,    0,    0,    0,    0,    0
  8352. ,    0,    0,52565,    0,    0,350892,    0,    0,    0,    0
  8353. ,    0,    0,    0,    0,    0,167318,    0,    0,    0,64056
  8354. ,64057,64058,    0,    0,64061,    0,    0,    0,    0,    0
  8355. ,    0,12435,    0,12437,12438,    0,    0,    0,    0,184553
  8356. ,    0,    0,    0,    0,    0,    0,    0,316512,    0,    0
  8357. ,    0,    0,    0,    0,    0,    0,379628,    0,138676,    0
  8358. ,    0,    0,    0,    0,    0,402585,    0,    0,184582,    0
  8359. ,    0,253429,    0,    0,253432,    0,    0,    0,    0,    0
  8360. ,368178,    0,    0,    0,391130,    0,    0,    0,362449,    0
  8361. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8362. ,    0,    0,247723,    0,    0,    0,    0,    0,    0,    0
  8363. ,    0,    0,    0,64150,    0,    0,    0,    0,    0, 6786
  8364. ,12524,    0,    0,    0,    0,    0,339539,12531,    0,224802
  8365. ,    0,    0,    0,12537,    0,    0,    0,    0,    0,    0
  8366. ,12544,    0,    0,    0,    0,    0,    0,    0,64185,    0
  8367. ,64187,    0,    0,    0,64191,    0,    0,    0,310886,    0
  8368. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8369. ,    0,    0,64209,64210,64211,    0,64213,64214,64215,64216
  8370. ,64217,    0,    0,    0,    0,    0,    0,    0,    0,322391
  8371. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,178976
  8372. ,    0,    0,293719,    0,    0,293722,69980,    0,    0,    0
  8373. ,305201,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8374. ,    0,    0,    0,    0,    0,224898,    0,    0,    0,    0
  8375. ,    0,    0,    0,    0,224907,    0,    0,    0,    0,    0
  8376. ,173280,    0,167545,    0,    0,    0,    0,    0,    0,47075
  8377. ,    0,    0,    0,    0,351141,    0,    0,    0,385567,259354
  8378. ,    0,    0,    0,70037,    0,133146,    0,    0,    0,    0
  8379. ,    0,305262,    0,322475,    0,    0,    0,322479,12682,    0
  8380. ,    0,    0,385591,230693,    0,    0,    0,    0,385597,    0
  8381. ,    0,    0,379864,    0,242178,374130,    0,    0,    0,    0
  8382. ,    0,    0,    0,    0,    0,133186,    0,    0,    0,    0
  8383. ,    0,    0,    0,    0,133195,    0,    0,167620,207780,167622
  8384. ,    0,    0,207784,    0,    0,    0,    0,    0,    0,    0
  8385. ,    0,    0,    0,334009,    0,230745,334012,    0,    0,    0
  8386. ,    0,    0,    0,    0,    0,374180,    0,    0,351235,    0
  8387. ,    0,    0,374187,    0,219290,    0,98815,219293,    0,    0
  8388. ,    0,    0,    0,133244,    0,    0,    0,    0,    0,    0
  8389. ,    0,    0,    0,93095,    0,    0,    0,    0,    0,    0
  8390. ,    0,    0,    0,    0,    0,    0,230796,    0,230798,    0
  8391. ,    0,    0,196380,    0,196382,196383,    0,    0,    0,    0
  8392. ,    0,    0,    0,    0,    0,    0,150498,    0,    0,    0
  8393. ,    0,    0,230822,    0,    0,    0,    0,41506,    0,    0
  8394. ,    0,    0,70196,    0,    0,    0,    0,    0,    0,    0
  8395. ,173470,    0,    0,    0,    0,    0,    0,219373,150530,    0
  8396. ,150532,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8397. ,    0,    0,    0,    0,282497,    0,    0,    0,    0,    0
  8398. ,    0,236608,    0,116133,213663,    0,    0,    0,150560,150561
  8399. ,150562,150563,127616,    0,150566,    0,    0,150569,    0,150571
  8400. ,    0,    0,    0,    0,    0,    0,    0,196475,    0,    0
  8401. ,    0,127635,    0,236640,236641,    0,116166,116167,    0,    0
  8402. ,    0,    0,139120,230913,    0,    0,    0,    0,    0,    0
  8403. ,    0,374346,    0,    0,    0,12919,    0,    0,    0,    0
  8404. ,    0,127665,196510,    0,    0,    0,    0,    0,116198,    0
  8405. ,    0,116201,236679,    0,    0,121942,116206,    0,    0,    0
  8406. ,    0,    0,    0,    0,    0,    0,    0,345697,    0,    0
  8407. ,    0,    0,    0,    0,    0,    0,    0,    0,58858,    0
  8408. ,    0,    0,    0,150655,    0,104761,    0,    0,    0,    0
  8409. ,    0,    0,    0,    0,    0,    0,213775,    0,    0,236726
  8410. ,208042,    0,208044,    0,    0,    0,208048,    0,    0,    0
  8411. ,58890,58891,58892,    0,    0,    0,    0,311325,150690,    0
  8412. ,    0,    0,    0,    0,150696,236752,    0,    0,    0,    0
  8413. ,    0,    0,    0,    0,35966,    0,70390,    0,    0,    0
  8414. ,    0,    0,    0,    0,150716,    0,    0,150719,150720,    0
  8415. ,150722,58931,    0,    0,    0,    0,35988,35989,35990,    0
  8416. ,    0,179418,    0,    0,    0,    0,    0,    0,36000,36001
  8417. ,    0,    0,    0,    0,236801,    0,116326,116327,    0,    0
  8418. ,    0,116331,    0,    0,    0,    0,    0,    0,236815,236816
  8419. ,    0,    0,236819,    0,    0,397458,    0,    0,    0,    0
  8420. ,116350,    0,236829,    0,    0,    0,116356,    0,236835,99148
  8421. ,116360,    0,    0,    0,133575, 1625,    0,    0,    0,    0
  8422. ,    0,    0,59002,    0,    0,    0,    0,    0,    0,    0
  8423. ,    0,    0,    0, 1643,    0,59015,    0,    0,    0,    0
  8424. ,    0,99180,    0,99182,    0,122132,    0,311455,311456,311457
  8425. ,    0,    0,    0,    0,    0,    0,328675,328676,328677,    0
  8426. ,    0,294258,    0,351630,363105,    0,    0,    0,386057,    0
  8427. ,59050,    0,    0,99212,99213,    0,59056,99216,    0,231169
  8428. ,99219,    0,99221,59063,    0,59065,    0,    0,    0,    0
  8429. ,59070,    0,328711,59073,59074,    0,59076,328716,59078,59079
  8430. ,59080,    0,59082,162349,    0,59085,    0,196775,    0,162355
  8431. ,    0,162357,    0,    0,162360,    0,127940,    0,    0,    0
  8432. ,317265,150893,    0,162369,    0,    0,    0,    0,162374,    0
  8433. ,    0,    0,162378,    0,    0,    0,162382,    0,    0,    0
  8434. ,    0,    0,328761,    0,305815,162391,    0,    0,    0,    0
  8435. ,162396,30446,162398,    0,150926,    0,    0,    0,127982,386148
  8436. ,127984,162407,    0,    0,162410,    0,    0,162413,    0,    0
  8437. ,127994,    0,    0,    0,    0,403375,    0,    0,116528,    0
  8438. ,128004,    0,133743,150955,    0,    0,150958,368965,368966,    0
  8439. ,    0,    0,150964,128017,150966,    0,    0,    0,    0,128023
  8440. ,    0,99340,    0,99342,    0,    0,    0,    0,    0,128033
  8441. ,116560,    0,116562,    0,    0,    0,    0,    0,    0,    0
  8442. ,    0,    0,328841,    0,    0,99364,    0,99366,369006,99368
  8443. ,99369,    0,    0,    0,328853,328854,    0,    0,    0,328858
  8444. ,    0,    0,    0,116593,328863,328864,    0,328866,    0,    0
  8445. ,    0,    0,    0,237080,    0,    0,128080,208399,    0,    0
  8446. ,208402,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8447. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8448. ,    0,    0,    0,328902,42053,    0,    0,363328,    0,    0
  8449. ,    0,214170,    0,323175,    0,323177,323178, 1907,    0,    0
  8450. ,    0,    0, 1912,    0,    0,    0,    0,277293,    0,    0
  8451. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8452. ,    0,    0,    0,    0,    0,    0,    0,208469,    0,    0
  8453. ,    0,    0,    0,    0,36366,    0,151108,    0,    0,    0
  8454. ,    0,    0,151114,    0,151116,    0,    0,369125,    0,369127
  8455. ,36382,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8456. ,    0,    0,    0,36395,36396,288825,24924,36399,36400,    0
  8457. ,    0,    0,    0,369151,    0,    0,    0,369155,    0,369157
  8458. ,277366,    0,369160,    0,    0,116735,156895,    0,323270,    0
  8459. ,179847,128215,    0,    0,    0,    0,    0,    0,116748,    0
  8460. ,    0,116751,    0,    0,99543,116755,    0,    0,    0,36441
  8461. ,36442,36443,    0,36445,    0,36447,36448,36449,    0,277405
  8462. ,    0,    0,    0,323305,323306,323307,277412,122514,    0,    0
  8463. ,    0,    0,    0,    0,    0,122522,    0,    0,    0,122526
  8464. ,    0,122528,    0,    0,122531,    0,122533,    0,122535,    0
  8465. ,122537,277437,122539,122540,122541,    0,    0,    0,    0,    0
  8466. ,    0,    0,    0,    0,277450,277451,99605,    0,99607,99608
  8467. ,    0,    0,    0,197141,    0,    0,    0,99616,    0,    0
  8468. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8469. ,    0,    0,    0,    0,36526,36527,    0,    0,    0,277485
  8470. ,    0,277487,197170,197171,    0,    0,162752,185701,    0,162755
  8471. ,    0,197179,    0,197181,    0,    0,    0,    0,162764,162765
  8472. ,    0,    0,    0,    0,277510,    0,    0,    0,277514,277515
  8473. ,277516,    0,    0,    0,277520,    0,    0,    0,    0,    0
  8474. ,162786,    0,    0,    0,    0,    0,    0,162793,99687,    0
  8475. ,317695,    0,    0,    0,    0,    0,162802,317702,197226,162805
  8476. ,    0,    0,162808,    0,283287,317710,    0,    0,    0,    0
  8477. ,403770,    0,283295,    0,    0,    0,    0,    0,    0,    0
  8478. ,30875,    0,    0,    0,197252,277571,    0,36619,    0,    0
  8479. ,    0,    0,    0,    0,    0,    0,    0,    0,99737,    0
  8480. ,    0,    0,99741,    0,36636,    0,36638,    0,380860,    0
  8481. ,260385,99750,99751,99752,99753,    0,99755,    0,    0,99758
  8482. ,99759,99760,99761,    0,    0,99764,99765,99766,99767,    0
  8483. ,    0,99770,197300,197301,197302,    0,    0,    0,197306,134200
  8484. ,    0,    0,174362,    0,    0,    0,    0,197315,197316,197317
  8485. ,197318,197319,197320,36685,    0,197323,197324,197325,197326,    0
  8486. ,197328,197329,197330,197331,197332,    0,226019,    0,    0,36701
  8487. ,36702,71125,71126,71127,    0,    0,    0,    0,    0,    0
  8488. ,    0,71135,    0,    0,335040,    0,214565,157196,71142,    0
  8489. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8490. ,59680,    0,    0,    0,    0,71159,71160,    0,    0,    0
  8491. ,    0,71165,    0,    0,    0,289175,289176,289177,    0,    0
  8492. ,    0,    0,    0,59703,36756,    0,    0,    0,    0,    0
  8493. ,59710,59711,59712,59713,    0,    0,    0,162983,    0,59719
  8494. ,162986,    0,162988,162989,162990,    0,    0,    0,    0,    0
  8495. ,162996,    0,    0,    0,289214,    0,289216,163003,363799,    0
  8496. ,134321,    0,163008,    0,134325,    0,134327,    0,    0,363810
  8497. ,    0,163017,    0,157282,    0,    0,    0,    0,    0,277765
  8498. ,    0,    0,134343,134344,134345,    0,    0,    0,122875,    0
  8499. ,    0,    0,122879,    0,    0,    0,25354,    0,    0,    0
  8500. ,163046,    0,163048,    0,134365,    0,13890,122894,    0,    0
  8501. ,    0,363852,59792,    0,    0,363856,    0,    0,    0,231909
  8502. ,    0,    0,122909,    0,    0,59805,    0,    0,122915,122916
  8503. ,122917,122918,    0,122920,122921,    0,122923,317982,    0,    0
  8504. ,    0,122928,    0,122930,    0,122932,    0,122934,122935,122936
  8505. ,352417,    0,    0,352420,363895,    0,386845,    0,386847,    0
  8506. ,    0,    0,59842,    0,318009,    0,    0,197535,197536,    0
  8507. ,    0,    0,    0,    0,220490,    0,289336,    0,    0,318024
  8508. ,88545,289341,    0,59863,59864,59865,59866,    0,59868,59869
  8509. ,    0,    0,    0,289353,    0,    0,    0,197565,    0,    0
  8510. ,    0,    0,318047,    0,    0,    0,    0,    0,    0,    0
  8511. ,289370,318056,318057,318058,    0,    0,    0,318062,    0,318064
  8512. ,318065,318066,404122,    0,    0,381177,    0,381179,    0,    0
  8513. ,    0,    0,    0,381185,    0,381187,    0,    0,    0,54182
  8514. ,    0,    0,    0,54186,381196,    0,54189,381199,    0,386938
  8515. ,    0,    0,381204,    0,    0,    0,381208,    0,140256,19780
  8516. ,381212,    0,381214,    0,    0,19786,186160,    0,    0,    0
  8517. ,    0,42740,    0,186167,381226,    0,381228,    0,    0,197647
  8518. ,    0,    0,    0,151755,    0,381237,111599,    0,381240,    0
  8519. ,    0,381243,197660,    0,37026,    0,    0,    0,140296,    0
  8520. ,    0,364042,    0,    0,    0,260780,    0,    0,    0,    0
  8521. ,    0,19832,19833,    0,    0,    0,    0,    0,19839,    0
  8522. ,19841,249322,    0,    0,249325,    0,341119,197695,197696,197697
  8523. ,    0,    0,54275,197701,    0,    0,    0,    0,    0,    0
  8524. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,323931
  8525. ,197718,    0,    0,197721,    0,197723,    0,    0,    0,197727
  8526. ,    0,    0,197730,60043,    0,364106,364107,    0,    0,    0
  8527. ,    0,    0,364113,    0,14158,    0,    0,    0,    0,    0
  8528. ,    0,214960,169065,    0,312492,    0,    0,    0,    0,    0
  8529. ,54333,54334,54335,    0,169077,    0,    0,    0,54341,    0
  8530. ,    0,341194,54345,    0,    0,    0,    0,312515,312516,169092
  8531. ,    0,    0,    0,226466,312522,    0,266628,    0,    0,    0
  8532. ,    0,    0,    0,387112,169107,60105,60106,60107,    0,    0
  8533. ,346960,    0,    0,157642,    0,    0,60116,278123,    0,    0
  8534. ,    0,    0,    0,    0,    0,    0,19967,    0,    0,266661
  8535. ,266662,    0,    0,    0,    0,    0,    0,19978,381410,    0
  8536. ,    0,    0,    0,    0,    0,    0,25724,    0,    0,    0
  8537. ,157679,    0,    0,    0,    0,    0,387165,    0,266690,266691
  8538. ,    0,    0, 2792,    0,266696,    0,    0,266699,    0,266701
  8539. ,25748,    0,    0,    0,    0,25753,169179, 2807,    0,134760
  8540. , 2810,134762,134763,    0,    0,169188,    0,60187,    0, 2819
  8541. ,169193,    0,169195,169196,169197,169198,169199,157726,375733,    0
  8542. ,    0,    0,    0,    0,    0,    0,100365,100366,    0,    0
  8543. ,169213,    0,    0,    0,    0,306906,    0,    0,    0,    0
  8544. ,    0,169224,    0,157752,    0,    0,    0,375762,    0,    0
  8545. ,    0,65968,    0,    0,    0,60235,    0,    0,100397,    0
  8546. ,    0,60241,    0, 2873,    0,100404,    0,100406,    0,    0
  8547. ,60250,398734,318417,266785,266786,    0,266788,    0,60258,60259
  8548. ,60260,60261,    0,    0,    0,    0,60266,60267,197956,    0
  8549. ,60270,157800,    0,157802,    0,318440,    0,    0,    0,    0
  8550. ,    0,    0,318447,14387,    0,    0,157815,    0,    0,    0
  8551. ,    0,157820,100451,66030,    0,    0,    0,    0,186512,    0
  8552. ,157829,    0,157831,157832,    0,129149,157835,    0,    0,134890
  8553. ,134891,    0,266844,266845,266846,    0,    0,266849,    0,266851
  8554. ,266852,    0,    0,266855,    0,    0,    0, 2957,    0,249650
  8555. ,    0,100490,94754,    0,    0,    0,    0,    0,    0,    0
  8556. ,    0,    0,    0,    0,249665,    0,43135,    0,318513,    0
  8557. ,    0,    0,249673,    0,    0,    0,    0,    0,    0,    0
  8558. ,    0,    0,    0,    0,    0,    0,100525,100526,100527,77580
  8559. ,    0,    0,100531,    0,20215,    0,    0,100536,    0,    0
  8560. ,    0,    0,100541,100542,100543,100544,100545,    0,66125,100548
  8561. ,100549,100550,    0,215292,100553,100554,100555,100556,100557,    0
  8562. ,    0,100560,    0,347253,    0,77616,77617,    0,    0,    0
  8563. ,    0,    0,    0,    0, 3044,    0,    0,    0,    0,    0
  8564. ,    0,    0,    0,    0,    0,66162,404646,    0,    0,66166
  8565. ,    0,    0,    0,404653,157963,    0,    0,    0,60438,    0
  8566. ,198128,    0,    0,    0,    0,    0,    0,    0,    0,66186
  8567. ,    0,    0,66189,66190,66191,66192,244040,    0,    0,    0
  8568. ,    0,    0,398945,    0,    0, 3095, 3096,    0,    0,    0
  8569. ,60470,    0,60472,    0,    0,    0,    0,    0,    0,    0
  8570. , 3110,    0,    0,37535,49010,    0,    0,    0,    0,    0
  8571. ,49016,    0,    0,49019,    0,    0,    0,    0,    0,    0
  8572. ,60500,    0,60502,    0,    0,    0,60506,    0,180985,60509
  8573. ,    0,    0,    0,    0,    0,    0,393262,215416,49044,215418
  8574. ,215419,215420,255580,    0,    0,    0,    0,    0,    0,    0
  8575. ,    0,72005,    0,    0,    0,49061,49062,49063,    0,49065
  8576. ,49066,    0,    0,49069,49070,49071,353133,    0,158077,    0
  8577. ,255608,    0,135133,    0,    0,    0,    0,    0,    0,    0
  8578. ,    0,    0,    0,    0,255622,    0,    0,    0,255626,100728
  8579. ,    0,    0,255630,    0,    0,255633,    0,    0,353165,353166
  8580. ,353167,    0,60582,    0,    0,    0,    0,    0,    0,364650
  8581. ,    0,    0,    0, 3223,    0,60595,    0,244181,    0,    0
  8582. ,    0,100760,100761,100762,    0,    0,    0,255665,353195,    0
  8583. ,353197,353198,112245,    0,353201,    0,    0,353204,    0,353206
  8584. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8585. ,60630,    0,    0,100792,100793,    0,    0,    0,    0,232749
  8586. ,    0,    0,100801,    0,221280,60645,341759,341760,    0,    0
  8587. ,    0,227024,    0,    0,60654,    0,60656,95079,    0,60659
  8588. ,60660,60661,60662,    0,    0,60665,    0,    0,295885,77880
  8589. ,49196,49197,318837,    0,    0,    0,    0,    0,    0,    0
  8590. ,    0,    0,49208,    0,    0,    0,    0,    0,    0,    0
  8591. ,353277,    0,    0,186907,    0,    0,186910,72171,    0,    0
  8592. ,    0,    0,255760,    0,    0,    0,353293,    0,    0,    0
  8593. ,    0,    0,    0,100872,    0,    0,    0,    0,410675,    0
  8594. ,43509,    0,    0,    0,43513,    0,    0,141045,    0,    0
  8595. ,250051,250052,318897,    0,    0,    0,    0,    0,353325,353326
  8596. ,353327,    0,    0,    0,353331,37797,    0,37799,    0,    0
  8597. ,    0,32066,89437,    0,255812,112388,    0,364818,255816,    0
  8598. ,    0,    0,    0,    0,353351,    0,353353,    0,353355,353356
  8599. ,353357,    0,    0,353360,    0,    0,43565,    0,    0,250100
  8600. ,    0,    0,    0,43572,100943,    0,100945,    0,    0,100948
  8601. ,100949,    0,100951,100952,    0,    0,    0,    0,    0,    0
  8602. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,32124
  8603. ,255868,    0,    0,    0,    0,347665,    0,209979,255876,255877
  8604. ,255878,255879,255880,255881,    0,255883,255884,255885,244412,    0
  8605. ,    0,255889,    0,60833,    0,198523,    0,399320,    0,    0
  8606. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8607. ,    0,    0,    0,    0,336230,    0,    0,    0,    0,    0
  8608. ,    0,    0,    0,    0,290344,    0,60866,60867,364929,    0
  8609. ,    0,    0,347722,    0,    0,89560,72350,    0,    0,    0
  8610. ,    0,    0,123989,    0,78095,    0,    0,    0,    0,    0
  8611. ,    0,    0,210054,    0,    0,60895,    0,60897,    0,    0
  8612. ,    0,60901,    0,    0,60904,    0,60906,    0,    0,    0
  8613. ,    0,    0,169915,250234,181391,250236,    0,    0,    0,    0
  8614. ,49446,    0,    0,410880,    0,135506,49452,    0,    0,278935
  8615. ,    0,158460,    0,37985,    0,    0,    0,    0,    0,    0
  8616. ,    0,    0,    0,    0,    0,112578,    0,    0,    0,    0
  8617. ,    0,    0,    0,    0,    0,    0,    0,89642,    0,    0
  8618. ,342073,    0,169965,    0,    0,    0,    0,    0,    0,169972
  8619. ,    0,15075,    0,    0,26552,    0,192927,    0,112611,112612
  8620. ,    0,210143,278988,    0,    0,    0,    0,    0,    0,    0
  8621. ,60990,    0,    0,342106,342107,    0,    0,    0,    0,    0
  8622. ,198688,    0,    0,    0,279010,    0,279012,112640,112641,    0
  8623. ,112643,    0,    0,    0,210176,210177,112649,    0,112651,    0
  8624. ,    0,    0,342135,342136,342137,    0,    0,61027,342141,    0
  8625. ,    0,    0,198720,    0,    0,    0,    0,    0,    0,221675
  8626. ,61040,    0,    0,210205,    0,210207,    0,    0,    0,    0
  8627. ,61050,61051,210214,61053,    0,    0,61056,61057,210220,    0
  8628. ,    0,    0,198750,198751,    0,198753,296283,    0,198756,    0
  8629. ,    0,198759,    0,198761,    0,164341,    0,    0,    0,    0
  8630. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,112722
  8631. ,    0,    0,    0,    0,    0,    0,    0,279103,    0,210261
  8632. ,    0,    0,112735,    0,342217,    0,290586,    0,    0,    0
  8633. ,    0,    0,    0,    0,175854,    0,    0,342230,198806,26697
  8634. ,    0,    0,    0,    0,    0,210287,    0,    0,    0,359453
  8635. ,    0,    0,    0,    0,393880,    0,    0,112770,    0,    0
  8636. ,    0,    0,    0,112776,    0,    0,158675,    0,    0,    0
  8637. ,    0,    0,    0,342266,342267,    0,    0,    0,342271,    0
  8638. ,112793,    0,    0,    0,    0,112798,    0,112800,    0,112802
  8639. ,    0,130015,112805,210335,    0,    0,    0,342290,    0,    0
  8640. ,342293,342294,342295,    0,342297,336561,    0,342300,    0,    0
  8641. ,210352,    0,    0,    0,    0,    0,210358,    0,    0,210361
  8642. ,359524,    0,    0,    0,210366,210367,    0,    0,    0,    0
  8643. ,    0,198899,    0,    0,    0,    0,198904,    0,198906,    0
  8644. ,198908,    0,    0,198911,198912,    0,336602,198915,61228,336605
  8645. ,    0,336607,    0,    0,141552,193186,    0,    0,    0,    0
  8646. ,    0,72715,72716,72717,    0,    0,    0,95669,325150,    0
  8647. ,325152,325153,    0,    0,    0,    0,    0,262052,    0,198947
  8648. ,61260,61261,61262,    0,336640,    0,    0,313695,239115,    0
  8649. ,239117,72745,72746,    0,    0,    0,    0,    0,    0,    0
  8650. ,72754,    0,72756,    0,    0,    0,359610,359611,    0,359613
  8651. ,61290,61291,61292,61293,    0,    0,61296,    0,    0,61299
  8652. ,    0,61301,296519,    0,    0,    0,    0,    0,    0,279315
  8653. ,    0,    0,    0,    0,    0,    0,    0,348167,    0,    0
  8654. ,    0,    0,359646,359647,    0,141643,158855,    0,    0,399812
  8655. ,    0,    0,    0,    0,    0,    0,    0,399820,    0,    0
  8656. ,    0,    0,313770,325245,    0,359669,359670,359671,    0,359673
  8657. ,359674,359675,359676,    0,    0,    0,359680,    0,    0,    0
  8658. ,    0,239208,    0,    0,    0,    0,72840,113000,    0,    0
  8659. ,    0,    0,61372,    0,    0,    0,388385,    0,325280,325281
  8660. ,325282,    0,    0,    0,    0,61385,    0,    0,    0,399872
  8661. ,    0,    0,    0,    0,365455,    0,244980,    0,    0,336775
  8662. ,    0,72875,    0,    0,    0,336781,    0,72881,336784,    0
  8663. ,353997,    0,    0,354000,    0,    0,72890,72891,    0,    0
  8664. ,    0,    0,    0,    0,72898,72899,    0,    0,113061,72903
  8665. ,72904,72905,72906,72907,222070,    0,72910,    0,    0,    0
  8666. ,101599,101600,    0,61443,61444,61445,61446,    0,    0,    0
  8667. ,    0,    0,61452,    0,262249,61455,    0,    0,    0,78670
  8668. ,    0,    0,    0,    0,    0, 9832,405686,    0, 9835,    0
  8669. ,    0,    0,199160,    0,    0,    0,    0,262272,67215,67216
  8670. ,    0,67218,    0,    0,67221,    0,    0,    0,    0,    0
  8671. ,    0,187705,    0,    0,    0,32810,32811,32812,    0,    0
  8672. ,    0,    0,    0,    0,    0,32820,405726,250828,    0,    0
  8673. ,    0,    0,32827,32828,    0,32830,    0,    0,    0,    0
  8674. ,    0,    0,    0,    0,    0,32840,32841,    0,    0,32844
  8675. ,32845,    0,    0,348383,    0,32850,    0,    0,    0,250860
  8676. ,250861,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8677. ,    0,    0,    0,113186,    0,    0,193507,    0,    0,    0
  8678. ,    0,    0,    0,    0,73038,113198,    0,371365,    0,250890
  8679. ,250891,250892,250893,67310,    0,250896,130420,130421,250899,    0
  8680. ,250901,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8681. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8682. ,136181,    0,    0,    0,118974,    0,    0,    0,67345,67346
  8683. ,67347,    0,    0,    0,67351,50141,    0,    0,    0,    0
  8684. ,    0,405841,227995,    0,    0,250946,216525,    0,    0,    0
  8685. ,    0,    0,    0,    0,67371,    0,    0,    0,    0,67376
  8686. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8687. ,    0,250972,    0,    0,    0,61655,61656,61657,    0,    0
  8688. ,    0,    0,    0,    0,250985,    0,    0,    0,    0,    0
  8689. ,    0,    0,    0,    0,78885,    0,    0,216576,147733,193630
  8690. ,    0,    0,136263,    0,    0,61685,    0,61687,61688,10056
  8691. ,    0,    0,388701,    0,61694,    0,61696,    0,    0,    0
  8692. ,251021,    0,    0,216602,    0,251026,    0,    0,    0,    0
  8693. ,147765,    0,    0,    0,    0,    0,251037,    0,    0,251040
  8694. ,    0,    0,251043,    0,251045,    0,    0,251048,251049,251050
  8695. ,251051,251052,    0,354320,251055,    0,354323,    0,    0,    0
  8696. ,147795,147796,    0,    0,    0,    0,    0,245331,    0,    0
  8697. , 4380,    0, 4382,268285,    0,    0,159285,365818,    0,    0
  8698. ,354347,    0,    0,    0,    0,    0,    0,61767,    0,90454
  8699. ,377305,279777,    0,    0,    0,354362,245360,245361,245362,245363
  8700. ,    0,    0,    0, 4413,    0,245369, 4416,245371,319953, 4419
  8701. ,360114, 4421,    0,    0,216693,342908,    0,    0,    0,354386
  8702. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8703. ,119180,    0,    0,    0, 4444,61815,61816,    0,    0,    0
  8704. ,319985,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8705. ,    0,    0,245416,    0,    0,147890, 4466,27415,61838,61839
  8706. ,61840,    0,188056,    0,61844,61845,61846,    0,    0,    0
  8707. ,    0,    0,    0,320018,79065,147910,320021,    0,245442,320024
  8708. ,    0,320026,    0,56126,    0,    0,354453,199555,    0,    0
  8709. ,147925,    0,    0,    0,    0, 4505,147931,188091,    0,    0
  8710. ,    0,165147,    0,    0,    0,67622,    0,    0,    0,    0
  8711. ,    0,    0,56155,    0,    0,    0,147951,    0,    0,147954
  8712. ,147955,    0,    0,    0,27482,147960,    0,245491,245492,165175
  8713. ,    0,    0,    0,    0,    0,165181,    0,    0,165184,    0
  8714. ,    0,245505,    0,    0,245508,    0,    0,    0, 4558,    0
  8715. ,    0,245515,    0,    0,    0,    0,    0,    0,    0,    0
  8716. , 4570,    0, 4572,165209,    0,    0,    0,142265,    0,    0
  8717. ,    0,    0,    0,188167,    0,    0,    0,    0,    0,    0
  8718. ,    0,130805,    0,    0,    0,165231,188180,    0,    0,    0
  8719. ,    0,    0,    0,245557,56237,    0,    0,    0,    0,    0
  8720. ,320145,320146,320147,10350,    0,    0,320151,56250,    0,    0
  8721. ,56253,165257,    0,    0,    0,320160,320161,320162,    0,320164
  8722. ,    0,188215,188216,    0,    0,320170,320171,188221,    0,320174
  8723. ,320175,320176,320177,    0,    0,320180,188230,188231,188232,188233
  8724. ,    0,188235,56285,56286,    0,188239,188240,    0,56291,188243
  8725. ,188244,188245,188246,188247,    0,    0,188250,    0,    0,165305
  8726. ,165306,165307,    0,    0,    0,    0,56309,56310,56311,    0
  8727. ,56313,    0,    0,56316,    0,165321,165322,    0,165324,165325
  8728. ,    0,    0,165328,165329,    0,165331,228439,165333,165334,165335
  8729. ,165336,165337,    0,    0,165340,    0,    0,159606,    0,    0
  8730. ,    0,    0,    0,    0,    0,    0,    0,194038,182565, 4719
  8731. ,    0,    0,    0,159622,    0,    0,159625,    0,16202,    0
  8732. ,    0,    0,171105,171106,    0,    0,148161,    0,    0,    0
  8733. ,    0,    0,171115,    0,    0,217014,    0,    0,    0,400602
  8734. ,    0,16225,    0,    0,    0,16229,    0,    0,    0,    0
  8735. ,    0,    0,    0,268665,    0,148190,148191,148192,    0,    0
  8736. ,16244,148196,73616,    0,148199,    0,148201,    0,    0,102308
  8737. ,377685,343264,257210,    0,    0,    0,159685,159686,159687,    0
  8738. ,16264,16265,    0,    0,    0,16269,    0,16271,    0,16273
  8739. ,    0,    0,16276,    0,16278,16279,16280,16281,16282,400662
  8740. ,    0,    0,    0,102342,    0,    0,102345,    0,    0,    0
  8741. ,    0,148246,113825,    0,    0,113828,    0,    0,113831,    0
  8742. ,    0,113834,119572,113836,    0,234315,211368,377742,268740,    0
  8743. ,268742,102370,    0,    0,102373,142533,182693,    0,165484,343332
  8744. ,102379,    0,102381,    0,    0,56488,    0,    0,    0,    0
  8745. ,148285,    0,    0,    0,    0,159764,    0,    0,    0,159768
  8746. ,159769,159770,    0,159772,    0,    0,    0,    0,    0,    0
  8747. ,    0,    0,    0,    0,    0,    0,    0,56520,56521,56522
  8748. ,    0,    0,    0,211425,    0,148320,148321,    0,320433,    0
  8749. ,    0,148326,    0,    0,113907,    0,    0,    0,    0,    0
  8750. ,148335,148336,148337,    0,    0,148340,    0,    0,    0,    0
  8751. ,    0,148346,    0,    0,148349,148350,    0,    0,56561,    0
  8752. ,148355,268833,    0,    0,    0,    0,102465,395053,    0,    0
  8753. ,    0,    0,    0,    0,    0,    0,    0,286060,119688,    0
  8754. ,257378,    0,113955,113956,113957,    0,102485,131171,    0,    0
  8755. ,    0,33646,    0,    0,    0,349185,    0,    0,349188,159868
  8756. ,    0,    0,102501,    0,    0,113978,    0,    0,113981,159878
  8757. ,    0,    0,    0,113986,    0,251676,102515,    0,102517,102518
  8758. ,102519,102520,349212,    0,102523,    0,    0,102526,    0,    0
  8759. ,102529,102530,102531,102532,349224,228748,    0,349227,    0,    0
  8760. ,119750,119751,    0,119753,    0,    0,    0,217286,217287,119759
  8761. ,    0,119761,    0,240240,251715,303349,159925,159926,    0,    0
  8762. ,    0,349251,    0,    0,    0,    0,    0,    0,    0,    0
  8763. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8764. ,    0,    0,217321,56686,    0,217324,    0,217326,    0,62429
  8765. ,    0,257489,    0,    0,    0,    0,    0,    0,    0,    0
  8766. ,56703,56704,56705,56706,    0,56708,    0,    0,56711,    0
  8767. ,73924,73925,56715,    0,    0,    0,159985,    0,349308,    0
  8768. ,280466,280467,    0,    0,349314,    0,    0,    0,349318,349319
  8769. ,    0,160000,160001,    0,349324,    0,    0,    0,79689,    0
  8770. ,10847,    0,    0,349333,349334,    0,    0,    0,    0,    0
  8771. ,    0,    0,    0,73967,    0,73969,73970,73971,    0,73973
  8772. ,    0,160030,    0,211665,211666,    0,    0,    0,    0,    0
  8773. ,119880,    0,119882,    0,125621,    0,    0,73991,    0,    0
  8774. ,    0,    0,    0,    0,    0,119895,119896,119897,119898,119899
  8775. ,119900,    0,332171,119903,    0,    0,    0,    0,119908,119909
  8776. ,119910,119911,119912,    0,    0,119915,217445,217446,217447,    0
  8777. ,    0,    0,217451,    0,    0,    0,    0,    0,    0,251880
  8778. ,251881,251882,246146,    0,366625,366626,366627,366628,125675,217468
  8779. ,    0,217470,    0,366634,217473,    0,217475,    0,    0,74053
  8780. ,    0,    0,74056,    0,74058,    0,    0,280593,    0,    0
  8781. ,    0,    0,    0,    0,    0,280601,    0,280603,    0,    0
  8782. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8783. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8784. ,    0,    0,    0,177363,    0,91310,    0,188841,    0,    0
  8785. ,    0,177371,177372,    0,51160,    0,    0,    0,    0,    0
  8786. ,303594,    0,    0,165909,    0,    0,366707,    0,131492,    0
  8787. ,326552,    0,56915,56916,56917,    0,200344,    0,    0,    0
  8788. ,    0,    0,177402,406883,    0,    0,    0,    0,120038,    0
  8789. ,    0,120041,120042,120043,    0,286418,    0,74151,297895,74153
  8790. ,74154,    0,56945,    0,    0,56948,177426,74161,56951,74163
  8791. ,    0,56954,    0,56956,    0,366756,    0,171700,    0,    0
  8792. ,366761,    0,    0,    0,343817,165971,    0,    0,    0,    0
  8793. ,    0,    0,    0,    0,    0,143033,    0,366778,    0,366780
  8794. ,366781,    0,    0,366784,366785,366786,366787,    0,    0,366790
  8795. ,    0,    0,286475,    0,177474,    0,74210,74211,    0,    0
  8796. ,    0,    0,    0,    0,    0,    0,    0,    0,384020,217648
  8797. ,74224,    0,74226,    0,252075,    0,    0,    0,    0,    0
  8798. ,    0,    0,    0,    0,57027,    0,    0,    0,    0,177509
  8799. ,    0,    0,143090,    0,    0,    0,    0,57040,    0,    0
  8800. ,    0,217680,217681,    0,    0,    0,194737,338163,    0,    0
  8801. ,    0,    0,    0,    0,194745,    0,194747,    0,    0,194750
  8802. ,    0,    0,    0,    0,194755,194756,    0,194758,194759,194760
  8803. ,    0,217710,    0,    0,    0,    0,    0,    0,57081,    0
  8804. ,    0,194772,217721,    0,45613,    0,    0,    0,    0,    0
  8805. ,    0,    0,    0,    0,    0,    0,57099,    0,57101,    0
  8806. ,    0,57104,57105,57106,    0,194796,194797,    0,    0,194800
  8807. ,    0,194802,194803,    0,    0,    0,    0,    0,    0,    0
  8808. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8809. ,401353,    0,    0,    0,11241,    0,    0,    0,    0,    0
  8810. ,    0,    0,    0,    0,    0,    0,    0,171890,    0,    0
  8811. ,    0,    0,    0,217792,229267,    0,    0,    0,    0,    0
  8812. ,292380,    0,    0,    0,    0,    0,    0,    0,    0,126016
  8813. ,    0,    0,    0,    0,    0,97337,    0,    0,    0,    0
  8814. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  8815. ,    0,    0,    0,    0,    0,    0,389945,366998,257996,    0
  8816. ,    0,217840,217841,217842,137525,    0,    0,217846,    0,    0
  8817. ,    0,    0,    0,    0,    0,    0,    0,126064,    0,    0
  8818. ,252281,    0,    0,126070,217863,    0,    0,217866,    0,217868
  8819. ,217869,217870,217871,    0,    0,    0,    0,    0,    0,    0
  8820. ,    0,    0,    0,    0,    0,355572,11353,    0,    0,137570
  8821. ,137571,137572,137573,    0,    0,    0,    0,    0,    0,    0
  8822. ,    0,137582,    0,    0,    0,    0,91691,    0,    0,    0
  8823. ,    0,103170,332651,    0,    0,    0,    0,    0,    0,194970
  8824. ,    0,    0,    0,    0,194975,    0,91711,    0,    0,57292
  8825. ,    0,    0,    0,    0,    0,321200,    0,    0,    0,    0
  8826. ,    0,    0,    0,200731,    0,    0,166312,    0,    0,200737
  8827. ,    0,    0,200740,    0,    0,    0,    0,    0,    0,57322
  8828. ,200748,    0,    0,    0,    0,149120,    0,    0,263863,    0
  8829. ,    0,    0,    0,    0,    0,177815,    0,57340,    0,    0
  8830. ,    0,    0,    0,    0,91769,    0,    0,    0,298305,    0
  8831. ,407310,    0,    0,    0,166360,    0,    0,    0,    0,    0
  8832. ,263895,263896,    0,304076,86070,263927,177872,263928,22974,263934
  8833. ,143457,103298,126285,97600,97633,57474,275481,264007,275482,57476
  8834. ,332856,258275,97639,34532,332857,258276,275488,258277,97641,315648
  8835. ,258278,264055,28838,315705,264072,264085,97712,264087,28870,355881
  8836. ,28872,407515,264090,332979,97762,378885,97772,212513,97773,132210
  8837. ,97788,212546,172387,212577,92100,212584,34737,298656,264234,69190
  8838. ,29031,287201,29036,287202,166725,86407,166726,126567,298687,178210
  8839. ,298688,23312,178212,57735,178213,57736,298691,57737,298694,29055
  8840. ,126585,57741,29056,57744,29059,252803,29060,57746,29061,287232
  8841. ,166755,287233,166756,212657,166761,287241,166764,275775,57769,69265
  8842. ,57791,287280,120907,287286,212705,287287,252865,212706,86492,252866
  8843. ,212707,  438,298767,252871,178305,120935,212728,120936,212729,120937
  8844. ,57830,212730,120938,287312,212731,212733,166837,120941,212736,120944
  8845. ,212737, 6205,298817,252921,178340,  493,384873,178341,178342,57865
  8846. ,298821,57867,298830,293093,298831,57877,298832,57878,298834,287360
  8847. ,57880,298835,287361,57881,287362,166885,57882,166886,57883,298838
  8848. ,166887,120991,69358,57884,298839,57885,298840,287366,166891,57888
  8849. ,298843,252947,57889,298844,57890,298845,57891,298847,92315,57893
  8850. ,287375,57895,298850,287376,57896,287377,57897,287380,172640,57900
  8851. ,287385,166908,287386,166909,350494,166910,293125,287388,166911,293126
  8852. ,287389,293127,287390,166913,121017,304602,287391,166914,287392,166915
  8853. ,293130,166916,275943,252995,17778,293155,252996,293156,252997,293166
  8854. ,149741,253011,149745,253018,121067,287446,253024,253027,17810,121081
  8855. ,17815,149770,121085,149772,35032,149773,121088,121089,35034,149776
  8856. ,121091,149779,121094,86672,344838,121095,149781,121096,316167,98161
  8857. ,17843,367810,138330,344870,293237,339147,310462,224407,333417,212940
  8858. ,344903,293270,344906,333432,270329,149852,333445,293286,333446,293287
  8859. ,333447,212970,58071,333448,212971,212972,149865,75284,293291,212973
  8860. ,333456,212979,212981,207244,293308,  721,293309,  722,293310,149885
  8861. ,  723,293311,17935,  724,293314,  727,293315,287578,367901,322005
  8862. ,293320,304801,149902,149906,75325,17955,149909,86802,149911,121226
  8863. ,224503,161396,58130,17971,299085,149923,17972,344982,299086,149924
  8864. ,58132,149925,58133,149926,17975,149928,17977,299092,149930,17979
  8865. ,224512,149931,149932,17981,367940,310570,367941,178620,149935,367942
  8866. ,17985,344995,17986,167150,17988,213052,17994,304848,17998,287640
  8867. ,18001,23739,18002,333540,18005,304857,213065,333543,304858,12271
  8868. ,304859,35220,304861,35222,304864,155702,345031,155710,345036,213085
  8869. ,207348,12290,396674,390937,333576,230310,333577,230311,213100,230312
  8870. ,213101,86887,345053,213102,345055,333581,345056,213105,345058,213107
  8871. ,345059,247530,345060,241794,213109,345062,213111,230327,213116,230328
  8872. ,213117,230329,213118,230330,213119,333600,213123,333601,213124,  855
  8873. ,333603,213126,333605,213128,333606,230340,213129,333607,276237,230341
  8874. ,213130,213132,155762, 6600,333610,230344,172974,230345,172975,213135
  8875. ,172976,230385,207437,304979,64025,316483,64055,173075,12439,362451
  8876. ,356714,35442,213348,64186,276474,92890,207644,156011,70030,47082
  8877. ,259357,12666,362631,305261,385590,24159,12685,230703,167596,242235
  8878. , 1281,230820,167713,219375,150531,236642,116165,236670,196511,236671
  8879. ,196512,12928,236672,116195,12929,236673,116196,334203,116197,236676
  8880. ,93251,236681,116204,345700,156379,150642,311327,150691,311328,150692
  8881. ,167906,35955,116277,70381,236765,35970,35971,24497,116290,58920
  8882. ,35972,150713,58921,150714,58922,150715,58923,150718,58926,150721
  8883. ,58929,345783,322835,150725,173675,35987,380224,167955,36004,236800
  8884. ,36005,380227,236802,116325,47484,36010,363020,236806,47485,236817
  8885. ,179447,116340,385980,236818,248294,236820,248297,236823,58976, 1606
  8886. ,236824, 1607,236825,116348,236826,116349,236828,116351,236830,116353
  8887. ,236831,116354,236832,116355,363048,116357,311420,254050, 1622,36045
  8888. , 1623,397487,328643, 1634,386031,99181,386055, 1676,317216,99210
  8889. ,59051,99211,59052,328705,59066,328706,59067,328707,59068,328708
  8890. ,59069,328714,59075,162347,59081,162359,127937,162370,76315,162373
  8891. ,99266,150925,99292,368933,150927,380418,162412,127990,99305,328787
  8892. ,127992,127995,30466,328800,128005,150956,128008,150957,128009,368967
  8893. ,150961,128013,162437,30486,128026,99341,128031,99346,363252,116561
  8894. ,19032,328835,99355,368995,328836,254255,99356,368996,328837,311626
  8895. ,128042,99357,368997,99358,368998,99359,128045,99360,369001,128047
  8896. ,128048,99363,369004,99365,328850,99370,328851,99371,328852,99372
  8897. ,328855,99375,328859,225593,116590,328860,116591,328861,116592,328865
  8898. ,116596,328867,128072,116599,59229,30544,328870,116601,156774,151037
  8899. ,363319,151050,363323,70736,42051,13382, 1908,369077, 1909,369090
  8900. ,294509,369091,151085,397777,151086,369093,294512,151087,311727,151091
  8901. ,196990,116672,179790,36365,116685,36367,162583,151109,162584,151110
  8902. ,277325,151111,277326,162586,277327,151113,162589,151115,151117,59325
  8903. ,369126,151120,369131,36385,225710,162603,277355,260144,369148,277356
  8904. ,122457,116720,369149,277357,116721,369150,277358,260147,116722,47880
  8905. ,42143,369153,277361,369154,116726,369156,277364,156887,122480,116743
  8906. ,128218,116744,128219,116745,128220,116746,128221,122484,122486,116749
  8907. ,128224,116750,122489,116752,363453,122499,36444,128238,36446,340511
  8908. ,13502,122519,36464,122520,36465,122521,36466,122523,99575, 2046
  8909. ,329056,122524,99576,156947,122525,99577,197108,122527,122532, 2055
  8910. ,277453,99606,197140,99611,30767,231564,197142,99614,30770,162742
  8911. ,36528,352065,162744,317645,277486,197172,162750,76695,277491,197173
  8912. ,197176,162754,277508,162768,99661,277509,254561,162769,277511,254563
  8913. ,277513,162773,306202,277517,162777,162807,99700,42330,99735,36628
  8914. ,197265,99736,36629,254653,99754,283347,99763,162900,36686,197335
  8915. ,162913,71121,36699,59648,36700,289143,214562,162935,71143,162936
  8916. ,71144,162937,71145,71155,59681,71156,59682,162982,59716,162987
  8917. ,59721,289205,162991,289206,162992,289207,162993,36779,289208,162994
  8918. ,162995,134310,289211,162997,134326,122852,157285,42545,386770,134342
  8919. ,392517,25349,134355,122881,134356,31090,363838,163043,122884,134359
  8920. ,25356,312207,163045,134360,289261,163047,289287,122914,386821,122919
  8921. ,197503,122922,134400,122926,289300,122927,318005,59840,283584,59841
  8922. ,318011,59846,318014,197537,289335,59855,54118,318022,289337,289350
  8923. ,59870,289351,59871,289352,59872,318039,289354,289355,59875,289358
  8924. ,197566,318044,289359,197567,318045,289360,197568,318046,289361,318048
  8925. ,289363,197571,318049,289364,318050,289365,318051,289366,197574,318052
  8926. ,289367,54150,318053,197576,54151,318054,54152,318061,186110,381189
  8927. ,54180,381190,54181,163186,54183,381194,289402,381200,54191,381203
  8928. ,25509,381221,128793,381242,243554,364051,19831,381267,19836,54262
  8929. ,19840,346875,329664,346878,329667,404251,197719,404252,197720,197724
  8930. ,140354,364098,197725,404258,197726,364108,54310,364109,94470,54311
  8931. ,364110,54312,364111,105946,364114,54316,335435,60059,169068,88750
  8932. ,169076,54336,60075,54338,60076,54339,60077,54340,157608,54342
  8933. ,169095,71566,169104,71575,346958,60108,157640,60111,387121,186326
  8934. ,157641,163380,60114,364186,19966,266660,169131,48657,25709,398616
  8935. ,255191,387143,48660,381413,157670,381414,157671,381415,157672,381416
  8936. ,157673,381419,157676,387161,157681,312588,266692,381433,266693, 2791
  8937. ,278180,100333,387200,169194,169203,60200,243785,169204,243786,169205
  8938. ,129046,243792,169211,100367,169214,100370,157765,100395,60236,100396
  8939. ,60237,100398, 2869,266772, 2870,100401, 2872,398732,266781,220885
  8940. ,66000,60263,66001,60264,66002,60265,197960,157801,134855,77485
  8941. ,318441,77487,157806,77488,197975,157816,266820,157817,266821,157818
  8942. ,266822,157819,266826,157823,66031,157824,66032,157825,66033,404517
  8943. ,157826,157828,66036,186515,157830,266843,134892,266848,31631,266850
  8944. ,100477,25906, 2958,249654,140651,381623,100510,20192,261170,100534
  8945. ,20216,249702,100540,20222,215291,100551,94826,77615,358744,330059
  8946. ,358745, 3051,330062,215322,94845,66160, 3053,66161, 3054,404647
  8947. , 3057,215346,20288,66188,37503,398944,48987,60471,37523, 3101
  8948. ,71955, 3111,60501,14605,226876,60503,255569,60511,410470,393259
  8949. ,267058,49052,215426, 3157,215428,49055,72012,49064,313002,255632
  8950. ,353196,135190,100790,60631,100791,60632,181113,60636,100796,31952
  8951. ,100799,31955,140971,60653,244239,60655,152450,60658,255725,198355
  8952. ,393441,146750,353290,255761,353291,261499,255762,100885,43515,353348
  8953. ,250082,100920,353349,100921,353350,255821,100922,353354,100926,89452
  8954. ,250106,100944,129631,100946,370589,100950,129640,100955,347715,290345
  8955. ,60865, 3495,60896,49422,255956,60898,347769,49445,278958,244536
  8956. ,169980,112610,60977,376515,278986,342105,49518,112642,43798,210175
  8957. ,112646,342138,61025,353613,61026,342144,61031,342146,198721,233144
  8958. ,198722,210206,72518,210208,15150,61048,15152,210211,61049,210216
  8959. ,61054,353642,61055,261855,61060,198752,78275,382381,26687,210300
  8960. ,112771,38190,112772,15243,198832, 9511,342265,112785,348007,198845
  8961. ,141475,359485,112794,359486,112795,359487,112796,336542,290646,112799
  8962. ,336544,112801,336550,210336,342288,210337,342289,336552,342291,336554
  8963. ,336555,210341,342296,336559,336564,210350,336565,210351,359515,210353
  8964. ,359516,336568,210354,198880,359517,336569,239040,210355,198881, 9560
  8965. ,359518,198882,359521,336573,210359,210360,198886,336577,210363,359526
  8966. ,210364,336579,210365,336583,198895,118577,210370,198896,198897,72683
  8967. ,336586,198898,256270,198900,336591,198903,336593,198905,198909,32536
  8968. ,290702,198910,336608,141550,336632,198944,359597,72747,371072,72748
  8969. ,371075,319442,72751,193235,38336,411275,313746,388328,348169,170322
  8970. ,359645,135902,359651,72801,394085,279345,359668,313772,359677,72827
  8971. ,342486,199061,113006,336778,72876,353990,336779,124510,72877,353991
  8972. ,336780,113051,72892,113052,72893,113053,72894,61420,72895,61421
  8973. ,336798,61422,113059,72900,61426,113060,72901,313863,61435,67185
  8974. ,61448,296666,61449,67187,61450,331090,61451,95875,78664,67217
  8975. ,32795,250862,159070,359878,113187,193510,73033,141880,73036,382835
  8976. ,73037,348433,130427,405843,61623,400121,67375,348490,67377,96108
  8977. ,61686,61691,10058,251020,159228,251022,216600,147766,50237,170715
  8978. ,147767,27290,251035,245298,27292,251036,136296,251038,170720,251039
  8979. , 4348,251044,38775,251046,38777,279748,147797,27320,147798,27321
  8980. ,354331,27322,354332,27323,245330,147801,245332,27326,147804,84697
  8981. ,147806, 4381,354359,256830,61780, 4410,10148, 4411,245366, 4412
  8982. ,188023,119179,165083,61817,319986,61821,319987,147877,222465,165095
  8983. ,61830,56093,188055,61841,188057,61843,354434,165113,61847,320015
  8984. ,302804,61850,331490,320016,320017,199540,56125, 4492,354451,56127
  8985. ,245455,188085,147926,188086,147927,27450,188087,27451,188088,27452
  8986. ,67615,27456,165145,67616,188094,165146,354469,188096,147948,56156
  8987. ,147949,56157,147950,56158,147953,56161,27476,147956,56164,147957
  8988. ,27480,297120,56166,27481,320071,245490,165176, 4540,165177, 4541
  8989. ,245496,165178, 4542,79127, 4546,251241,165186,285665,245506, 4552
  8990. ,245507, 4553,245509, 4555,245510, 4556,188141, 4557,245513, 4559
  8991. ,245514, 4560,320097,245516,302887, 4563,245518, 4564,245519, 4565
  8992. ,245520, 4566,360261,245521,245522, 4568,394685, 4569,245525,38993
  8993. , 4571,320110, 4575,320163,239845,320165,302954,320168,188217,320169
  8994. ,165270,320173,228381,199708,188234,188238,56287,216926,188241,325947
  8995. ,165311,56308,165317,56314,165318,56315,165320,56317,280063,165323
  8996. ,56320,371862,165330,39116,148128,62073,354665,159607,326007,148160
  8997. ,159636,148162,389118,171112,50635,217010,159640,400610,257185,16231
  8998. ,113763,16234,148193,16242,159684,16259,188373,159688,188376,113795
  8999. ,16266,188377,113796,16267,188378,113797,16268,389175,16270,280174
  9000. ,16272,125280,16277,44969,16284,102340,16285,102341,16286,366245
  9001. ,268716,354780,113826,354781,113827,377735,354787,343325,102371,343326
  9002. ,102372,148272,102376,222860,211386,228610,50763,389251,159771,389253
  9003. ,159773,303199,159774,90930,148322,102426,297500,148338,148339,45073
  9004. ,113920,56550,148343,56551,148344,56552,148345,56553,148348,102452
  9005. ,56556,148351,56559,320462,148352,303282,113961,159859,79541,251658
  9006. ,159866,113970,159869,33655,125448,102500,45130,159872,102502,349196
  9007. ,131190,113979,349197,159876,113980,102506,159879,119720,113983,102509
  9008. ,119721,113984,119722,113985,102511,217253,113987,22195,113990,102516
  9009. ,349215,102524,377901,102525,102528,56632,360700,102535,119752,56645
  9010. ,217285,119756,217315,73890,217316,73891,56680,217317,73892,56681
  9011. ,217318,56682,400911,96850,228805,194383,96855,73907,119806,73910
  9012. ,73920,56709,73921,56710,349299,56712,314887,39511,314890,119832
  9013. ,400946,349313,349315,10832,349316,16570,372265,349317,349323,160002
  9014. ,349325,119845,349331,160010,297705,160017,194440,160018,280497,160020
  9015. ,171495,73966,349344,280500,73968,217397,73972,211662,160029,73974
  9016. ,366563,211664,160031,291985,211667,160034,137086,211668,160035,217410
  9017. ,160040,119881,280521,73989,119886,73990,366595,119904,366596,119905
  9018. ,366597,119906,366631,217469, 5200,217471, 5202,366636,217474,74049
  9019. ,217476,74051,246162,217477,74052,360905,246165,217480,74055,320748
  9020. ,74057,280591,74059,280594,10955,355176,280595,177360,56883,355234
  9021. ,177387,234761,131495,372457,366720,177399,74144,11037,252004,154475
  9022. ,74157,56946,252005,56947,74164,34005,366755,320859,154486,366757
  9023. ,45485,372516,366779,366783,131566,177491,74225,177493,74227,217682
  9024. ,125890,194739, 5418,194749,166064,85746,315231,194754,217711,194763
  9025. ,57075,217712,194764,57076,217713,57077,217716,194768,85765,303774
  9026. ,217719,194781,91515,194786,166101,57098,194788,57100,303794,57103
  9027. ,338220,57107,85795,57110,194827,11243,298100,22724,217805,160435
  9028. ,217864,177705,217865,11333,246557,217872,246560,217875,355580,137574
  9029. ,367055,137575,194973,189236,309714,194974,212187,194976,194979,57291
  9030. ,200730,194993,355632,166311,166342,22917,275352,57346,286845,263897
  9031. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9032. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9033. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9034. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9035. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9036. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9037. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9038. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9039. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9040. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9041. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9042. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9043. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9044. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9045. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9046. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9047. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9048. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9049. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9050. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9051. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9052. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9053. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9054. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9055. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9056. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9057. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9058. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9059. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9060. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9061. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9062. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9063. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9064. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9065. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9066. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9067. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9068. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9069. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9070. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9071. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9072. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9073. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9074. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9075. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9076. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9077. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9078. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9079. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9080. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9081. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9082. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9083. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9084. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9085. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9086. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9087. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9088. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9089. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9090. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9091. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9092. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9093. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9094. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9095. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9096. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9097. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9098. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9099. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9100. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9101. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9102. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9103. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9104. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9105. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9106. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9107. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9108. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9109. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9110. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9111. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9112. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9113. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9114. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9115. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9116. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9117. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9118. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9119. ,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  9120.  ) ;
  9121.         --| Hash values to check against to verify that
  9122.         --| correct action has been found for this
  9123.         --| parser state and input token.
  9124.         -- NYU Reference Name: ACTION_TABLE2
  9125.  
  9126.     DefaultMap :
  9127.         constant array (DefaultMapRange) of GC.ParserInteger :=
  9128.          ( 1521,    0,    0,    0,    0, 1519,    0, 1340, 1329, 1520
  9129. ,    0, 1331,    0, 1549,    0,    0,    0, 1333, 1334, 1335
  9130. , 1336, 1337, 1338,    0, 1133,    0, 1395, 1133, 1332, 1339
  9131. ,    0,    0, 1529,    0,    0, 1395, 1207,    0, 1208, 1190
  9132. ,    0, 1189, 1151, 1150,    0, 1205, 1206,    0, 1439, 1459
  9133. , 1191, 1152, 1153, 1154, 1194, 1173, 1445, 1176, 1177, 1178
  9134. , 1179, 1180, 1181, 1184, 1185, 1463, 1468, 1466,    0, 1195
  9135. , 1192, 1193,    0, 1442, 1273, 1274,    0,    0, 1561,    0
  9136. , 1269, 1583,    0, 1268,    0,    0, 1395,    0, 1496, 1283
  9137. ,    0, 1562,    0, 1585, 1288, 1483,    0,    0,    0,    0
  9138. , 1346, 1146, 1147, 1148,    0, 1133,    0,    0,    0, 1357
  9139. , 1581, 1342, 1525, 1523, 1522, 1408, 1216, 1084, 1407,    0
  9140. ,    0, 1149,    0,    0, 1191, 1424,    0, 1436, 1434, 1172
  9141. ,    0, 1461,    0, 1198, 1196, 1200,    0, 1197, 1201, 1199
  9142. , 1182,    0,    0,    0,    0,    0,    0, 1441,    0, 1175
  9143. ,    0,    0,    0,    0,    0,    0,    0,    0, 1204, 1202
  9144. , 1203,    0, 1211, 1212, 1209, 1210,    0, 1213, 1186,    0
  9145. , 1191, 1187, 1464, 1378,    0, 1596,    0,    0,    0,    0
  9146. ,    0,    0,    0,    0, 1375, 1583, 1131, 1557, 1256, 1399
  9147. , 1497, 1498,    0,    0, 1396,    0,    0,    0,    0,    0
  9148. , 1583, 1047, 1134, 1048, 1049, 1050, 1051, 1052, 1053, 1054
  9149. , 1068, 1069, 1070, 1395, 1135, 1136,    0, 1395, 1395, 1383
  9150. , 1384, 1385, 1386, 1483, 1564, 1395, 1428, 1587, 1484,    0
  9151. , 1483,    0,    0, 1579, 1483,    0, 1355, 1356,    0,    0
  9152. , 1067,    0, 1405, 1530,    0, 1395,    0,    0,    0,    0
  9153. ,    0,    0, 1188,    0,    0, 1127,    0, 1166,    0, 1167
  9154. , 1436, 1330, 1462, 1440, 1113, 1183, 1460, 1090, 1164, 1163
  9155. , 1165, 1162, 1161, 1214, 1215,    0, 1157, 1158, 1160, 1159
  9156. , 1156, 1445, 1443,    0,    0, 1459, 1449,    0, 1451, 1453
  9157. , 1450, 1452, 1454,    0,    0, 1465, 1467, 1469, 1271, 1407
  9158. ,    0, 1494,    0, 1373, 1565,    0, 1371, 1494, 1582,    0
  9159. ,    0, 1382, 1534, 1379,    0, 1536,    0,    0,    0, 1395
  9160. , 1144, 1145,    0,    0, 1258, 1487, 1281,    0, 1149,    0
  9161. , 1154,    0,    0,    0,    0, 1073,    0,    0, 1499,    0
  9162. ,    0, 1501,    0, 1503,    0, 1284,    0,    0, 1287,    0
  9163. ,    0,    0, 1560, 1362,    0, 1531, 1278,    0, 1066,    0
  9164. , 1341, 1524,    0, 1219, 1218, 1409, 1448, 1444, 1438, 1431
  9165. , 1434, 1171, 1126,    0,    0, 1432, 1434, 1437,    0, 1170
  9166. ,    0,    0, 1155, 1174, 1447, 1446, 1455, 1457, 1456, 1458
  9167. , 1278,    0, 1276,    0, 1534, 1534,    0,    0,    0, 1377
  9168. ,    0,    0, 1429, 1132,    0,    0, 1400, 1399, 1221, 1222
  9169. ,    0,    0,    0, 1472, 1576,    0, 1401,    0, 1046, 1543
  9170. ,    0,    0,    0,    0,    0, 1566, 1299, 1543, 1129,    0
  9171. , 1294,    0,    0, 1483,    0, 1395, 1563, 1483, 1483, 1055
  9172. , 1395, 1056, 1057, 1058,    0, 1286, 1568, 1303,    0,    0
  9173. ,    0,    0, 1279, 1403,    0, 1526, 1217, 1436, 1125, 1425
  9174. , 1433, 1436, 1435, 1114, 1091, 1277, 1403, 1597, 1595,    0
  9175. ,    0,    0,    0, 1270,    0,    0, 1537,    0,    0,    0
  9176. , 1138, 1139, 1140, 1141, 1143, 1137, 1142, 1395,    0,    0
  9177. ,    0, 1470,    0, 1223, 1224, 1473,    0,    0,    0,    0
  9178. ,    0,    0,    0,    0,    0, 1570, 1149,    0, 1225, 1226
  9179. , 1227, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237
  9180. , 1238, 1239, 1240, 1401,    0,    0, 1399, 1309, 1310, 1311
  9181. , 1399,    0, 1228, 1257,    0, 1488,    0,    0,    0,    0
  9182. ,    0,    0,    0,    0, 1082, 1567, 1300,    0,    0,    0
  9183. ,    0,    0, 1583,    0,    0, 1104, 1071,    0,    0,    0
  9184. ,    0,    0,    0,    0, 1096, 1097, 1098, 1412, 1412, 1103
  9185. ,    0,    0, 1420, 1583, 1293, 1298,    0, 1505, 1502, 1395
  9186. ,    0, 1285,    0, 1063,    0,    0,    0, 1368,    0,    0
  9187. , 1369, 1370,    0, 1420, 1533, 1532, 1361, 1280,    0,    0
  9188. , 1406, 1169, 1168, 1275,    0, 1495,    0,    0, 1376, 1535
  9189. , 1565, 1568, 1430, 1343, 1243, 1399, 1517, 1509,    0,    0
  9190. ,    0, 1261,    0,    0, 1247, 1475,    0, 1399, 1244, 1353
  9191. ,    0,    0,    0, 1282,    0,    0,    0,    0, 1556,    0
  9192. , 1399, 1559, 1483, 1133, 1307,    0,    0, 1513, 1265,    0
  9193. ,    0, 1402, 1492, 1489, 1349, 1399, 1490, 1399,    0,    0
  9194. ,    0, 1544, 1395, 1388, 1387, 1297, 1081,    0, 1083, 1085
  9195. , 1086, 1087, 1128, 1109,    0,    0, 1102, 1100,    0,    0
  9196. , 1291, 1094, 1095, 1410, 1093, 1074, 1075, 1076, 1077, 1078
  9197. , 1079, 1080, 1413, 1099, 1101, 1540, 1395,    0,    0, 1500
  9198. , 1301,    0,    0, 1504, 1302, 1063,    0, 1403,    0, 1082
  9199. , 1366, 1365, 1367, 1364,    0, 1359,    0, 1404, 1358, 1272
  9200. , 1374, 1372,    0,    0, 1471,    0,    0,    0, 1548, 1308
  9201. ,    0,    0, 1263, 1267, 1477, 1590, 1474, 1354,    0,    0
  9202. ,    0,    0, 1399, 1479, 1399, 1553, 1554, 1255,    0,    0
  9203. ,    0,    0, 1483, 1483,    0,    0,    0, 1325, 1326, 1324
  9204. , 1313, 1314, 1315, 1316, 1317, 1399, 1399, 1399,    0, 1399
  9205. ,    0, 1477, 1266,    0, 1352, 1527, 1348, 1493, 1491, 1350
  9206. , 1351, 1045, 1393,    0, 1395, 1538,    0, 1580,    0, 1414
  9207. , 1191, 1416, 1112,    0, 1289, 1089,    0,    0, 1418, 1395
  9208. , 1403, 1594,    0,    0,    0, 1191,    0, 1494, 1304,    0
  9209. , 1403,    0,    0, 1347,    0,    0, 1064,    0, 1363,    0
  9210. , 1344, 1345,    0, 1327,    0, 1494, 1569, 1305, 1262,    0
  9211. , 1592,    0,    0, 1399, 1399, 1394, 1245,    0,    0, 1424
  9212. , 1249, 1555, 1250,    0, 1399,    0, 1260,    0,    0, 1321
  9213. ,    0,    0, 1318, 1516, 1319, 1320, 1593, 1399, 1399, 1571
  9214. , 1574,    0, 1399, 1578,    0,    0,    0,    0,    0, 1395
  9215. , 1088,    0,    0, 1111,    0, 1106, 1092,    0,    0, 1542
  9216. ,    0, 1118, 1120, 1543, 1130, 1421, 1507,    0,    0,    0
  9217. , 1064,    0, 1059,    0, 1403,    0,    0, 1518, 1511,    0
  9218. , 1264,    0,    0, 1478, 1476, 1248, 1547,    0, 1480,    0
  9219. ,    0,    0, 1483, 1259, 1306, 1575, 1399,    0,    0,    0
  9220. ,    0, 1514,    0, 1577,    0,    0,    0,    0, 1539, 1110
  9221. ,    0,    0, 1107,    0, 1108, 1411, 1115,    0, 1395,    0
  9222. , 1395, 1397,    0,    0,    0, 1072,    0, 1506, 1065, 1060
  9223. , 1403, 1296,    0, 1295,    0,    0, 1510, 1591,    0, 1546
  9224. ,    0, 1399,    0,    0,    0,    0, 1573,    0,    0, 1528
  9225. , 1392,    0, 1389,    0, 1415,    0,    0, 1417,    0,    0
  9226. , 1116, 1550, 1117,    0, 1124, 1545,    0, 1292, 1494,    0
  9227. , 1061, 1360, 1494, 1246, 1399,    0, 1483, 1251,    0,    0
  9228. , 1312, 1390,    0,    0, 1105, 1403,    0, 1398,    0, 1422
  9229. , 1290,    0, 1062,    0,    0,    0,    0, 1322,    0, 1391
  9230. ,    0,    0, 1395, 1395, 1551, 1552,    0, 1508, 1512,    0
  9231. , 1483, 1254, 1323, 1119, 1121, 1122, 1123, 1423, 1483,    0
  9232. ,    0, 1252, 1253)  ;
  9233.         --| Map of states (constant array index) to default reductions.
  9234.         -- NYU Reference Name: DEFAULT
  9235.   
  9236.     type FollowSymbolIndexArray is array ( PositiveParserInteger range <>)
  9237.         of GC.ParserInteger ;
  9238.  
  9239.     FollowSymbolMapIndex : constant FollowSymbolIndexArray :=
  9240.          (    1,    1,    2,    2,    3,    3,    4,   43,   44,   57
  9241. ,   58,   71,   72,   85,   86,  102,  103,  119,  120,  133
  9242. ,  134,  150,  151,  167,  168,  181,  182,  195,  196,  209
  9243. ,  210,  223,  224,  237,  238,  251,  252,  252,  253,  254
  9244. ,  255,  256,  257,  257,  258,  259,  260,  261,  262,  268
  9245. ,  269,  270,  271,  272,  273,  286,  287,  300,  301,  314
  9246. ,  315,  317,  318,  331,  332,  342,  343,  344,  345,  346
  9247. ,  347,  352,  353,  353,  354,  354,  355,  355,  356,  356
  9248. ,  357,  357,  358,  358,  359,  359,  360,  393,  394,  395
  9249. ,  396,  429,  430,  436,  437,  438,  439,  440,  441,  441
  9250. ,  442,  463,  464,  465,  466,  467,  468,  469,  470,  472
  9251. ,  473,  474,  475,  477,  478,  478,  479,  489,  490,  491
  9252. ,  492,  493,  494,  494,  495,  495,  496,  529,  530,  532
  9253. ,  533,  534,  535,  544,  545,  545,  546,  549,  550,  551
  9254. ,  552,  572,  573,  574,  575,  579,  580,  581,  582,  582
  9255. ,  583,  585,  586,  612,  613,  614,  615,  615,  616,  616
  9256. ,  617,  620,  621,  622,  623,  626,  627,  628,  629,  641
  9257. ,  642,  653,  654,  655,  656,  664,  665,  672,  673,  686
  9258. ,  687,  700,  701,  716,  717,  725,  726,  737,  738,  746
  9259. ,  747,  758,  759,  770,  771,  782,  783,  816,  817,  850
  9260. ,  851,  885,  886,  919,  920,  954,  955,  955,  956,  985
  9261. ,  986,  987,  988,  988,  989,  990,  991,  992,  993,  993
  9262. ,  994,  995,  996,  997,  998,  999, 1000, 1009, 1010, 1017
  9263. , 1018, 1025, 1026, 1033, 1034, 1041, 1042, 1049, 1050, 1059
  9264. , 1060, 1070, 1071, 1095, 1096, 1124, 1125, 1149, 1150, 1179
  9265. , 1180, 1208, 1209, 1237, 1238, 1244, 1245, 1274, 1275, 1304
  9266. , 1305, 1334, 1335, 1345, 1346, 1354, 1355, 1363, 1364, 1372
  9267. , 1373, 1379, 1380, 1416, 1417, 1444, 1445, 1471, 1472, 1497
  9268. , 1498, 1502, 1503, 1529, 1530, 1556, 1557, 1576, 1577, 1594
  9269. , 1595, 1621, 1622, 1648, 1649, 1649, 1650, 1676, 1677, 1703
  9270. , 1704, 1730, 1731, 1757, 1758, 1784, 1785, 1811, 1812, 1838
  9271. , 1839, 1865, 1866, 1892, 1893, 1919, 1920, 1946, 1947, 1973
  9272. , 1974, 2000, 2001, 2020, 2021, 2023, 2024, 2026, 2027, 2027
  9273. , 2028, 2031, 2032, 2033, 2034, 2034, 2035, 2055, 2056, 2057
  9274. , 2058, 2078, 2079, 2081, 2082, 2102, 2103, 2103, 2104, 2104
  9275. , 2105, 2107, 2108, 2110, 2111, 2131, 2132, 2133, 2134, 2134
  9276. , 2135, 2136, 2137, 2148, 2149, 2151, 2152, 2156, 2157, 2158
  9277. , 2159, 2160, 2161, 2163, 2164, 2164, 2165, 2165, 2166, 2177
  9278. , 2178, 2178, 2179, 2179, 2180, 2192, 2193, 2194, 2195, 2206
  9279. , 2207, 2219, 2220, 2220, 2221, 2222, 2223, 2224, 2225, 2228
  9280. , 2229, 2229, 2230, 2233, 2234, 2245, 2246, 2246, 2247, 2250
  9281. , 2251, 2252, 2253, 2273, 2274, 2274, 2275, 2301, 2302, 2328
  9282. , 2329, 2355, 2356, 2363, 2364, 2366, 2367, 2369, 2370, 2372
  9283. , 2373, 2375, 2376, 2378, 2379, 2381, 2382, 2384, 2385, 2408
  9284. , 2409, 2411, 2412, 2435, 2436, 2439, 2440, 2441, 2442, 2462
  9285. , 2463, 2467, 2468, 2468, 2469, 2491, 2492, 2493, 2494, 2501
  9286. , 2502, 2503, 2504, 2511, 2512, 2516, 2517, 2524, 2525, 2532
  9287. , 2533, 2538, 2539, 2540, 2541, 2542, 2543, 2550, 2551, 2554
  9288. , 2555, 2556, 2557, 2557, 2558, 2558, 2559, 2559, 2560, 2580
  9289. , 2581, 2582, 2583, 2603, 2604, 2605, 2606, 2608, 2609, 2614
  9290. , 2615, 2620, 2621, 2626, 2627, 2628, 2629, 2629, 2630, 2630
  9291. , 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2637, 2638, 2639
  9292. , 2640, 2640, 2641, 2642, 2643, 2656, 2657, 2670, 2671, 2684
  9293. , 2685, 2698, 2699, 2703, 2704, 2704, 2705, 2709, 2710, 2714
  9294. , 2715, 2716, 2717, 2718, 2719, 2719, 2720, 2721, 2722, 2723
  9295. , 2724, 2724, 2725, 2736, 2737, 2738, 2739, 2740, 2741, 2761
  9296. , 2762, 2782, 2783, 2784, 2785, 2786, 2787, 2787, 2788, 2788
  9297. , 2789, 2791, 2792, 2793, 2794, 2796, 2797, 2803, 2804, 2805
  9298. , 2806, 2809, 2810, 2810, 2811, 2831, 2832, 2852, 2853, 2855
  9299. , 2856, 2856, 2857, 2857, 2858, 2858)  ;
  9300.   
  9301.     FollowSymbolMap : constant FollowSymbolArray :=
  9302.          (   96,   96,   72,    2,    4,   10,   12,   14,   15,   19
  9303. ,   20,   21,   22,   23,   24,   25,   26,   27,   28,   29
  9304. ,   33,   37,   39,   42,   43,   44,   45,   46,   51,   53
  9305. ,   54,   55,   56,   57,   59,   60,   61,   62,   63,   65
  9306. ,   67,   68,   92,   10,   21,   25,   26,   27,   42,   43
  9307. ,   44,   45,   55,   56,   59,   60,   65,   10,   21,   25
  9308. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  9309. ,   65,   10,   21,   25,   26,   27,   42,   43,   44,   45
  9310. ,   55,   56,   59,   60,   65,   10,   21,   25,   26,   27
  9311. ,   42,   43,   44,   45,   54,   55,   56,   59,   60,   63
  9312. ,   65,   96,   10,   21,   25,   26,   27,   42,   43,   44
  9313. ,   45,   54,   55,   56,   59,   60,   63,   65,   96,   10
  9314. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  9315. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  9316. ,   44,   45,   54,   55,   56,   59,   60,   63,   65,   96
  9317. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   54
  9318. ,   55,   56,   59,   60,   63,   65,   96,   10,   21,   25
  9319. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  9320. ,   65,   10,   21,   25,   26,   27,   42,   43,   44,   45
  9321. ,   55,   56,   59,   60,   65,   10,   21,   25,   26,   27
  9322. ,   42,   43,   44,   45,   55,   56,   59,   60,   65,   10
  9323. ,   21,   25,   26,   27,   42,   43,   44,   45,   55,   56
  9324. ,   59,   60,   65,   10,   21,   25,   26,   27,   42,   43
  9325. ,   44,   45,   55,   56,   59,   60,   65,   10,   21,   25
  9326. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  9327. ,   65,   79,   80,   88,   72,   80,    8,   80,   88,   80
  9328. ,   88,   31,   33,   58,   72,   75,   80,   85,   75,   79
  9329. ,   75,   79,   10,   21,   25,   26,   27,   42,   43,   44
  9330. ,   45,   55,   56,   59,   60,   65,   10,   21,   25,   26
  9331. ,   27,   42,   43,   44,   45,   55,   56,   59,   60,   65
  9332. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   55
  9333. ,   56,   59,   60,   65,   31,   71,   80,   10,   21,   25
  9334. ,   26,   27,   42,   43,   44,   45,   55,   56,   59,   60
  9335. ,   65,    3,   35,   36,   37,   65,   66,   67,   68,   71
  9336. ,   74,   76,   72,   80,   72,   80,   18,   31,   50,   51
  9337. ,   71,   80,   80,   80,   80,   80,   80,   80,   80,    7
  9338. ,   16,   17,   30,   31,   33,   34,   36,   39,   47,   49
  9339. ,   50,   58,   64,   69,   71,   72,   73,   74,   75,   76
  9340. ,   78,   80,   81,   82,   83,   84,   85,   86,   87,   88
  9341. ,   89,   90,   91,   80,   88,    7,   16,   17,   30,   31
  9342. ,   33,   34,   36,   39,   47,   49,   50,   58,   64,   69
  9343. ,   71,   72,   73,   74,   75,   76,   78,   80,   81,   82
  9344. ,   83,   84,   85,   86,   87,   88,   89,   90,   91,   33
  9345. ,   72,   75,   80,   84,   85,   88,   80,   88,   80,   88
  9346. ,   65,    7,   30,   31,   33,   36,   39,   47,   58,   64
  9347. ,   72,   75,   80,   81,   82,   83,   84,   85,   86,   88
  9348. ,   89,   90,   91,   72,   75,   72,   75,   72,   75,   47
  9349. ,   80,   88,   80,   88,   47,   80,   88,   80,    3,   35
  9350. ,   36,   37,   65,   66,   67,   68,   71,   74,   76,   72
  9351. ,   75,   72,   75,   38,   38,    7,    9,   30,   31,   33
  9352. ,   34,   36,   39,   47,   49,   58,   64,   69,   70,   71
  9353. ,   72,   73,   74,   75,   76,   77,   78,   80,   81,   82
  9354. ,   83,   84,   85,   86,   87,   88,   89,   90,   91,   33
  9355. ,   72,   75,   72,   75,    7,   31,   33,   39,   58,   64
  9356. ,   72,   75,   80,   85,   48,   12,   37,   43,   65,   21
  9357. ,   61,   10,   12,   21,   22,   25,   26,   27,   42,   43
  9358. ,   44,   45,   54,   55,   56,   59,   60,   61,   63,   65
  9359. ,   67,   68,   12,   65,   12,   21,   43,   61,   65,   21
  9360. ,   61,   12,   21,   43,   61,    2,    4,   10,   12,   14
  9361. ,   15,   19,   20,   21,   23,   24,   25,   28,   29,   33
  9362. ,   37,   39,   43,   46,   51,   53,   61,   62,   65,   67
  9363. ,   68,   92,   43,   61,   21,   61,   12,   37,   43,   65
  9364. ,   21,   61,   12,   37,   43,   65,   84,   85,   10,   21
  9365. ,   25,   26,   27,   42,   43,   45,   55,   56,   59,   60
  9366. ,   65,   10,   21,   25,   26,   27,   42,   44,   45,   55
  9367. ,   56,   59,   60,   10,   21,   10,   21,   26,   27,   42
  9368. ,   43,   45,   56,   60,   10,   21,   26,   27,   42,   45
  9369. ,   56,   60,   10,   21,   25,   26,   27,   42,   43,   44
  9370. ,   45,   55,   56,   59,   60,   65,   10,   21,   25,   26
  9371. ,   27,   42,   43,   44,   45,   55,   56,   59,   60,   65
  9372. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   54
  9373. ,   55,   56,   59,   60,   63,   65,   10,   21,   26,   27
  9374. ,   42,   43,   45,   56,   60,   10,   21,   26,   27,   42
  9375. ,   43,   45,   54,   56,   60,   63,   96,   10,   21,   26
  9376. ,   27,   42,   43,   45,   56,   60,   10,   21,   26,   27
  9377. ,   42,   43,   45,   54,   56,   60,   63,   96,   10,   21
  9378. ,   26,   27,   42,   43,   45,   54,   56,   60,   63,   96
  9379. ,   10,   21,   26,   27,   42,   43,   45,   54,   56,   60
  9380. ,   63,   96,    7,    9,   30,   31,   33,   34,   36,   39
  9381. ,   47,   49,   58,   64,   69,   70,   71,   72,   73,   74
  9382. ,   75,   76,   77,   78,   80,   81,   82,   83,   84,   85
  9383. ,   86,   87,   88,   89,   90,   91,    7,    9,   30,   31
  9384. ,   33,   34,   36,   39,   47,   49,   58,   64,   69,   70
  9385. ,   71,   72,   73,   74,   75,   76,   77,   78,   80,   81
  9386. ,   82,   83,   84,   85,   86,   87,   88,   89,   90,   91
  9387. ,    7,    9,   30,   31,   33,   34,   36,   39,   47,   49
  9388. ,   58,   60,   64,   69,   70,   71,   72,   73,   74,   75
  9389. ,   76,   77,   78,   80,   81,   82,   83,   84,   85,   86
  9390. ,   87,   88,   89,   90,   91,    7,    9,   30,   31,   33
  9391. ,   34,   36,   39,   47,   49,   58,   64,   69,   70,   71
  9392. ,   72,   73,   74,   75,   76,   77,   78,   80,   81,   82
  9393. ,   83,   84,   85,   86,   87,   88,   89,   90,   91,    7
  9394. ,    9,   30,   31,   33,   34,   36,   39,   47,   49,   58
  9395. ,   60,   64,   69,   70,   71,   72,   73,   74,   75,   76
  9396. ,   77,   78,   80,   81,   82,   83,   84,   85,   86,   87
  9397. ,   88,   89,   90,   91,   72,    7,   30,   31,   33,   34
  9398. ,   36,   39,   47,   49,   58,   64,   69,   72,   73,   74
  9399. ,   75,   76,   78,   80,   81,   82,   83,   84,   85,   86
  9400. ,   87,   88,   89,   90,   91,   72,   75,   72,   72,   75
  9401. ,   72,   75,   72,   72,   75,   72,   75,   72,   75,    7
  9402. ,   31,   33,   39,   58,   64,   72,   75,   80,   85,    7
  9403. ,   31,   33,   58,   72,   75,   80,   85,   31,   33,   39
  9404. ,   58,   72,   75,   80,   85,   31,   33,   58,   64,   72
  9405. ,   75,   80,   85,    7,   31,   33,   58,   72,   75,   80
  9406. ,   85,   31,   33,   39,   58,   72,   75,   80,   85,    7
  9407. ,   31,   33,   39,   58,   64,   72,   75,   80,   85,    3
  9408. ,   35,   36,   37,   65,   66,   67,   68,   71,   74,   76
  9409. ,    7,   30,   31,   33,   36,   39,   47,   58,   64,   69
  9410. ,   72,   74,   75,   76,   80,   81,   82,   83,   84,   85
  9411. ,   86,   88,   89,   90,   91,    7,   30,   31,   33,   34
  9412. ,   36,   39,   47,   49,   58,   64,   69,   72,   73,   74
  9413. ,   75,   76,   78,   80,   81,   82,   83,   84,   85,   86
  9414. ,   88,   89,   90,   91,    7,   30,   31,   33,   36,   39
  9415. ,   47,   58,   64,   69,   72,   74,   75,   76,   80,   81
  9416. ,   82,   83,   84,   85,   86,   88,   89,   90,   91,    7
  9417. ,   30,   31,   33,   34,   36,   39,   47,   49,   58,   64
  9418. ,   69,   72,   73,   74,   75,   76,   78,   80,   81,   82
  9419. ,   83,   84,   85,   86,   87,   88,   89,   90,   91,    7
  9420. ,   30,   31,   33,   34,   36,   39,   47,   49,   58,   64
  9421. ,   69,   72,   73,   74,   75,   76,   78,   80,   81,   82
  9422. ,   83,   84,   85,   86,   88,   89,   90,   91,    7,   30
  9423. ,   31,   33,   34,   36,   39,   47,   49,   58,   64,   69
  9424. ,   72,   73,   74,   75,   76,   78,   80,   81,   82,   83
  9425. ,   84,   85,   86,   88,   89,   90,   91,   35,   37,   65
  9426. ,   66,   67,   68,   71,    7,   30,   31,   33,   34,   36
  9427. ,   39,   47,   49,   58,   64,   69,   72,   73,   74,   75
  9428. ,   76,   78,   80,   81,   82,   83,   84,   85,   86,   87
  9429. ,   88,   89,   90,   91,    7,   30,   31,   33,   34,   36
  9430. ,   39,   47,   49,   58,   64,   69,   72,   73,   74,   75
  9431. ,   76,   78,   80,   81,   82,   83,   84,   85,   86,   87
  9432. ,   88,   89,   90,   91,    7,   30,   31,   33,   34,   36
  9433. ,   39,   47,   49,   58,   64,   69,   72,   73,   74,   75
  9434. ,   76,   78,   80,   81,   82,   83,   84,   85,   86,   87
  9435. ,   88,   89,   90,   91,    3,   35,   36,   37,   65,   66
  9436. ,   67,   68,   71,   74,   76,    3,   35,   36,   37,   65
  9437. ,   66,   67,   68,   71,    3,   35,   36,   37,   65,   66
  9438. ,   67,   68,   71,    3,   35,   36,   37,   65,   66,   67
  9439. ,   68,   71,   35,   37,   65,   66,   67,   68,   71,    7
  9440. ,   16,   17,   30,   31,   33,   34,   36,   39,   47,   49
  9441. ,   50,   58,   61,   64,   69,   70,   71,   72,   73,   74
  9442. ,   75,   76,   77,   78,   80,   81,   82,   83,   84,   85
  9443. ,   86,   87,   88,   89,   90,   91,    2,    4,   10,   12
  9444. ,   14,   15,   19,   20,   21,   23,   24,   25,   28,   29
  9445. ,   33,   37,   39,   43,   46,   51,   53,   57,   61,   62
  9446. ,   65,   67,   68,   92,    2,    4,   10,   12,   14,   15
  9447. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  9448. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  9449. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  9450. ,   23,   24,   25,   28,   29,   33,   37,   39,   46,   51
  9451. ,   53,   61,   62,   65,   67,   68,   92,   19,   20,   21
  9452. ,   23,   61,    2,    4,   10,   12,   14,   15,   19,   20
  9453. ,   21,   23,   24,   25,   28,   29,   33,   37,   39,   43
  9454. ,   46,   51,   53,   61,   62,   65,   67,   68,   92,    2
  9455. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  9456. ,   25,   28,   29,   33,   37,   39,   43,   46,   51,   53
  9457. ,   61,   62,   65,   67,   68,   92,    2,    4,   10,   12
  9458. ,   14,   15,   24,   25,   28,   29,   33,   37,   46,   51
  9459. ,   53,   62,   65,   67,   68,   92,    2,    4,   10,   12
  9460. ,   14,   15,   24,   25,   28,   29,   33,   37,   46,   53
  9461. ,   62,   65,   67,   68,    2,    4,   10,   12,   14,   15
  9462. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  9463. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  9464. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  9465. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  9466. ,   51,   53,   61,   62,   65,   67,   68,   92,   51,    2
  9467. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  9468. ,   25,   28,   29,   33,   37,   39,   43,   46,   51,   53
  9469. ,   61,   62,   65,   67,   68,   92,    2,    4,   10,   12
  9470. ,   14,   15,   19,   20,   21,   23,   24,   25,   28,   29
  9471. ,   33,   37,   39,   43,   46,   51,   53,   61,   62,   65
  9472. ,   67,   68,   92,    2,    4,   10,   12,   14,   15,   19
  9473. ,   20,   21,   23,   24,   25,   28,   29,   33,   37,   39
  9474. ,   43,   46,   51,   53,   61,   62,   65,   67,   68,   92
  9475. ,    2,    4,   10,   12,   14,   15,   19,   20,   21,   23
  9476. ,   24,   25,   28,   29,   33,   37,   39,   43,   46,   51
  9477. ,   53,   61,   62,   65,   67,   68,   92,    2,    4,   10
  9478. ,   12,   14,   15,   19,   20,   21,   23,   24,   25,   28
  9479. ,   29,   33,   37,   39,   43,   46,   51,   53,   61,   62
  9480. ,   65,   67,   68,   92,    2,    4,   10,   12,   14,   15
  9481. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  9482. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  9483. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  9484. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  9485. ,   51,   53,   61,   62,   65,   67,   68,   92,    2,    4
  9486. ,   10,   12,   14,   15,   19,   20,   21,   23,   24,   25
  9487. ,   28,   29,   33,   37,   39,   43,   46,   51,   53,   61
  9488. ,   62,   65,   67,   68,   92,    2,    4,   10,   12,   14
  9489. ,   15,   19,   20,   21,   23,   24,   25,   28,   29,   33
  9490. ,   37,   39,   43,   46,   51,   53,   61,   62,   65,   67
  9491. ,   68,   92,    2,    4,   10,   12,   14,   15,   19,   20
  9492. ,   21,   23,   24,   25,   28,   29,   33,   37,   39,   43
  9493. ,   46,   51,   53,   61,   62,   65,   67,   68,   92,    2
  9494. ,    4,   10,   12,   14,   15,   19,   20,   21,   23,   24
  9495. ,   25,   28,   29,   33,   37,   39,   43,   46,   51,   53
  9496. ,   61,   62,   65,   67,   68,   92,    2,    4,   10,   12
  9497. ,   14,   15,   19,   20,   21,   23,   24,   25,   28,   29
  9498. ,   33,   37,   39,   43,   46,   51,   53,   61,   62,   65
  9499. ,   67,   68,   92,    2,    4,   10,   12,   14,   15,   19
  9500. ,   20,   21,   23,   24,   25,   28,   29,   33,   37,   39
  9501. ,   43,   46,   51,   53,   61,   62,   65,   67,   68,   92
  9502. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  9503. ,   33,   37,   46,   51,   53,   62,   65,   67,   68,   92
  9504. ,   19,   20,   21,   19,   20,   21,   21,   33,   58,   80
  9505. ,   85,   43,   61,   21,    2,    4,   10,   12,   14,   15
  9506. ,   24,   25,   28,   29,   33,   37,   43,   46,   51,   53
  9507. ,   62,   65,   67,   68,   92,   21,   61,    2,    4,   10
  9508. ,   12,   14,   15,   24,   25,   28,   29,   33,   37,   43
  9509. ,   46,   51,   53,   62,   65,   67,   68,   92,   25,   33
  9510. ,   62,    2,    4,   10,   12,   14,   15,   24,   25,   28
  9511. ,   29,   33,   37,   43,   46,   51,   53,   62,   65,   67
  9512. ,   68,   92,   80,   30,   65,   67,   80,   65,   67,   80
  9513. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  9514. ,   33,   37,   43,   46,   51,   53,   62,   65,   67,   68
  9515. ,   92,   21,   23,   21,   10,   14,   10,   25,   26,   27
  9516. ,   42,   43,   45,   55,   56,   59,   60,   65,   31,   50
  9517. ,   80,   18,   31,   50,   71,   80,   72,   80,   72,   80
  9518. ,   31,   51,   71,   65,   65,   10,   25,   26,   27,   42
  9519. ,   43,   45,   55,   56,   59,   60,   65,   80,   80,   21
  9520. ,   25,   26,   27,   42,   43,   44,   45,   55,   56,   59
  9521. ,   60,   65,   21,   44,   21,   25,   26,   27,   42,   43
  9522. ,   45,   55,   56,   59,   60,   65,   10,   21,   25,   26
  9523. ,   27,   42,   43,   45,   55,   56,   59,   60,   65,   21
  9524. ,   75,   80,   75,   80,   21,   22,   25,   43,   21,   21
  9525. ,   22,   25,   43,   10,   25,   26,   27,   42,   43,   45
  9526. ,   55,   56,   59,   60,   65,   80,   21,   22,   25,   43
  9527. ,   18,   80,    2,    4,   10,   12,   14,   15,   24,   25
  9528. ,   28,   29,   33,   37,   43,   46,   51,   53,   62,   65
  9529. ,   67,   68,   92,   21,    2,    4,   10,   12,   14,   15
  9530. ,   19,   20,   21,   23,   24,   25,   28,   29,   33,   37
  9531. ,   39,   43,   46,   51,   53,   61,   62,   65,   67,   68
  9532. ,   92,    2,    4,   10,   12,   14,   15,   19,   20,   21
  9533. ,   23,   24,   25,   28,   29,   33,   37,   39,   43,   46
  9534. ,   51,   53,   61,   62,   65,   67,   68,   92,    2,    4
  9535. ,   10,   12,   14,   15,   19,   20,   21,   23,   24,   25
  9536. ,   28,   29,   33,   37,   39,   43,   46,   51,   53,   61
  9537. ,   62,   65,   67,   68,   92,    4,   15,   43,   57,   61
  9538. ,   65,   67,   68,   19,   21,   39,   19,   21,   39,   19
  9539. ,   21,   39,   19,   21,   39,   19,   21,   39,   19,   21
  9540. ,   39,   19,   21,   39,    2,    4,   10,   12,   14,   15
  9541. ,   19,   21,   24,   25,   28,   29,   33,   37,   39,   43
  9542. ,   46,   51,   53,   62,   65,   67,   68,   92,   19,   21
  9543. ,   39,    2,    4,   10,   12,   14,   15,   19,   21,   24
  9544. ,   25,   28,   29,   33,   37,   39,   43,   46,   51,   53
  9545. ,   62,   65,   67,   68,   92,   19,   21,   39,   43,   19
  9546. ,   39,    2,    4,   10,   12,   14,   15,   24,   25,   28
  9547. ,   29,   33,   37,   43,   46,   51,   53,   62,   65,   67
  9548. ,   68,   92,    4,   15,   43,   57,   61,   21,    2,    4
  9549. ,   10,   12,   14,   15,   19,   24,   25,   28,   29,   33
  9550. ,   37,   39,   43,   46,   51,   53,   62,   65,   67,   68
  9551. ,   92,   75,   80,   26,   27,   42,   43,   45,   54,   63
  9552. ,   96,   71,   80,   26,   27,   42,   43,   45,   54,   63
  9553. ,   96,   26,   27,   42,   45,   54,   26,   27,   42,   43
  9554. ,   45,   54,   63,   96,   26,   27,   42,   43,   45,   54
  9555. ,   63,   96,   26,   27,   42,   45,   54,   63,   75,   80
  9556. ,   75,   80,   26,   27,   42,   43,   45,   54,   60,   63
  9557. ,   26,   42,   45,   56,   21,   61,   21,   21,   21,    2
  9558. ,    4,   10,   12,   14,   15,   24,   25,   28,   29,   33
  9559. ,   37,   43,   46,   51,   53,   62,   65,   67,   68,   92
  9560. ,   21,   61,    2,    4,   10,   12,   14,   15,   24,   25
  9561. ,   28,   29,   33,   37,   43,   46,   51,   53,   62,   65
  9562. ,   67,   68,   92,   84,   85,   26,   42,   45,   26,   42
  9563. ,   45,   59,   63,   65,   26,   42,   45,   59,   63,   65
  9564. ,   26,   42,   45,   59,   63,   65,   31,   71,   80,   80
  9565. ,   71,   80,   72,   75,   72,   75,   35,   72,   75,   85
  9566. ,   72,   75,   10,   21,   25,   26,   27,   42,   43,   44
  9567. ,   45,   55,   56,   59,   60,   65,   10,   21,   25,   26
  9568. ,   27,   42,   43,   44,   45,   55,   56,   59,   60,   65
  9569. ,   10,   21,   25,   26,   27,   42,   43,   44,   45,   55
  9570. ,   56,   59,   60,   65,   10,   21,   25,   26,   27,   42
  9571. ,   43,   44,   45,   55,   56,   59,   60,   65,   21,   43
  9572. ,   65,   67,   68,   21,   21,   43,   65,   67,   68,   21
  9573. ,   43,   65,   67,   68,   43,   61,   43,   61,   65,   21
  9574. ,   61,   84,   85,   65,   10,   21,   25,   26,   27,   42
  9575. ,   44,   45,   55,   56,   59,   60,   72,   75,   84,   85
  9576. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  9577. ,   33,   37,   43,   46,   51,   53,   62,   65,   67,   68
  9578. ,   92,    2,    4,   10,   12,   14,   15,   24,   25,   28
  9579. ,   29,   33,   37,   43,   46,   51,   53,   62,   65,   67
  9580. ,   68,   92,   21,   61,   43,   61,   21,   65,   21,   22
  9581. ,   25,   21,   25,   19,   21,   39,   26,   27,   42,   45
  9582. ,   54,   60,   63,   84,   85,   21,   65,   67,   68,   31
  9583. ,    2,    4,   10,   12,   14,   15,   24,   25,   28,   29
  9584. ,   33,   37,   43,   46,   51,   53,   62,   65,   67,   68
  9585. ,   92,    2,    4,   10,   12,   14,   15,   24,   25,   28
  9586. ,   29,   33,   37,   43,   46,   51,   53,   62,   65,   67
  9587. ,   68,   92,    4,   15,   57,   72,   65,   65)  ;
  9588.         --| Map of states to sets of follow symbols
  9589.         -- NYU Reference Name: FOLLOW
  9590.  
  9591.     ------------------------------------------------------------------
  9592.     -- Action_Token_Map
  9593.     ------------------------------------------------------------------
  9594.  
  9595.     
  9596.     type Action_Token_Array_Index is array(
  9597.         PositiveParserInteger range <>) of GC.ParserInteger ;
  9598.         --| For indexing the All Action Token Array.
  9599.         --| Maps a given state into the lower and upper bounds of a slice
  9600.         --| of the All Action Index Array.
  9601.     
  9602.     Action_Token_MapIndex : constant Action_Token_Array_Index :=
  9603.          (    1,    1,    2,    2,    3,    2,    3,    9,   10,   11
  9604. ,   12,   11,   12,   16,   17,   17,   18,   17,   18,   17
  9605. ,   18,   28,   29,   28,   29,   30,   31,   30,   31,   32
  9606. ,   33,   33,   34,   34,   35,   34,   35,   34,   35,   34
  9607. ,   35,   34,   35,   34,   35,   34,   35,   36,   37,   36
  9608. ,   37,   37,   38,   37,   38,   37,   38,   37,   38,   37
  9609. ,   38,   41,   42,   44,   45,   44,   45,   45,   46,   46
  9610. ,   47,   46,   47,   46,   47,   47,   48,   47,   48,   47
  9611. ,   48,   75,   76,   75,   76,   75,   76,   75,   76,   87
  9612. ,   88,   87,   88,   87,   88,   88,   89,   88,   89,   97
  9613. ,   98,  101,  102,  101,  102,  101,  102,  101,  102,  101
  9614. ,  102,  102,  103,  102,  103,  105,  106,  106,  107,  107
  9615. ,  108,  108,  109,  109,  110,  110,  111,  113,  114,  117
  9616. ,  118,  117,  118,  118,  119,  118,  119,  125,  126,  125
  9617. ,  126,  125,  126,  125,  126,  134,  135,  134,  135,  134
  9618. ,  135,  134,  135,  137,  138,  138,  139,  138,  139,  139
  9619. ,  140,  140,  141,  140,  141,  153,  154,  153,  154,  155
  9620. ,  156,  156,  157,  156,  157,  157,  158,  159,  160,  159
  9621. ,  160,  173,  174,  182,  183,  184,  185,  184,  185,  185
  9622. ,  186,  186,  187,  187,  188,  189,  190,  190,  191,  191
  9623. ,  192,  191,  192,  191,  192,  191,  192,  191,  192,  192
  9624. ,  193,  192,  193,  193,  194,  194,  195,  195,  196,  198
  9625. ,  199,  198,  199,  198,  199,  198,  199,  199,  200,  200
  9626. ,  201,  200,  201,  201,  202,  201,  202,  203,  204,  205
  9627. ,  206,  206,  207,  206,  207,  208,  209,  224,  225,  228
  9628. ,  229,  228,  229,  229,  230,  230,  231,  230,  231,  230
  9629. ,  231,  231,  232,  231,  232,  232,  233,  232,  233,  232
  9630. ,  233,  232,  233,  243,  244,  243,  244,  243,  244,  243
  9631. ,  244,  243,  244,  254,  255,  265,  266,  276,  277,  281
  9632. ,  282,  292,  293,  296,  297,  296,  297,  307,  308,  308
  9633. ,  309,  320,  321,  332,  333,  343,  344,  354,  355,  365
  9634. ,  366,  376,  377,  377,  378,  378,  379,  378,  379,  378
  9635. ,  379,  378,  379,  387,  388,  387,  388,  387,  388,  387
  9636. ,  388,  387,  388,  396,  397,  396,  397,  396,  397,  403
  9637. ,  404,  406,  407,  406,  407,  406,  407,  406,  407,  407
  9638. ,  408,  407,  408,  408,  409,  410,  411,  411,  412,  425
  9639. ,  426,  427,  428,  428,  429,  429,  430,  440,  441,  440
  9640. ,  441,  440,  441,  449,  450,  449,  450,  449,  450,  449
  9641. ,  450,  449,  450,  449,  450,  450,  451,  451,  452,  451
  9642. ,  452,  454,  455,  455,  456,  456,  457,  458,  459,  459
  9643. ,  460,  459,  460,  459,  460,  459,  460,  459,  460,  459
  9644. ,  460,  459,  460,  459,  460,  459,  460,  459,  460,  459
  9645. ,  460,  459,  460,  459,  460,  459,  460,  459,  460,  459
  9646. ,  460,  459,  460,  462,  463,  462,  463,  462,  463,  462
  9647. ,  463,  462,  463,  462,  463,  462,  463,  463,  464,  463
  9648. ,  464,  463,  464,  463,  464,  463,  464,  463,  464,  464
  9649. ,  465,  465,  466,  467,  468,  468,  469,  468,  469,  469
  9650. ,  470,  470,  471,  470,  471,  470,  471,  471,  472,  473
  9651. ,  474,  473,  474,  474,  475,  474,  475,  474,  475,  476
  9652. ,  477,  476,  477,  487,  488,  488,  489,  489,  490,  490
  9653. ,  491,  501,  502,  512,  513,  512,  513,  524,  525,  535
  9654. ,  536,  535,  536,  537,  538,  537,  538,  549,  550,  549
  9655. ,  550,  550,  551,  550,  551,  550,  551,  550,  551,  551
  9656. ,  552,  551,  552,  551,  552,  552,  553,  552,  553,  552
  9657. ,  553,  552,  553,  552,  553,  552,  553,  552,  553,  552
  9658. ,  553,  553,  554,  553,  554,  553,  554,  553,  554,  553
  9659. ,  554,  553,  554,  553,  554,  553,  554,  554,  555,  565
  9660. ,  566,  573,  574,  573,  574,  584,  585,  584,  585,  584
  9661. ,  585,  584,  585,  584,  585,  584,  585,  595,  596,  606
  9662. ,  607,  606,  607,  606,  607,  606,  607,  606,  607,  607
  9663. ,  608,  608,  609,  608,  609,  619,  620,  619,  620,  619
  9664. ,  620,  630,  631,  630,  631,  630,  631,  631,  632,  656
  9665. ,  657,  681,  682,  681,  682,  681,  682,  681,  682,  682
  9666. ,  683,  682,  683,  683,  684,  685,  686,  688,  689,  688
  9667. ,  689,  688,  689,  688,  689,  691,  692,  712,  713,  712
  9668. ,  713,  713,  714,  713,  714,  715,  716,  716,  717,  719
  9669. ,  720,  720,  721,  722,  723,  723,  724,  724,  725,  726
  9670. ,  727,  726,  727,  729,  730,  730,  731,  730,  731,  744
  9671. ,  745,  747,  748,  748,  749,  749,  750,  750,  751,  751
  9672. ,  752,  751,  752,  752,  753,  753,  754,  753,  754,  754
  9673. ,  755,  755,  756,  756,  757,  756,  757,  756,  757,  758
  9674. ,  759,  759,  760,  760,  761,  761,  762,  762,  763,  763
  9675. ,  764,  763,  764,  764,  765,  765,  766,  765,  766,  765
  9676. ,  766,  765,  766,  765,  766,  765,  766,  765,  766,  765
  9677. ,  766,  765,  766,  765,  766,  765,  766,  776,  777,  787
  9678. ,  788,  787,  788,  787,  788,  787,  788,  799,  800,  799
  9679. ,  800,  810,  811,  821,  822,  821,  822,  822,  823,  822
  9680. ,  823,  822,  823,  822,  823,  822,  823,  822,  823,  822
  9681. ,  823,  824,  825,  825,  826,  825,  826,  827,  828,  827
  9682. ,  828,  827,  828,  829,  830,  831,  832,  842,  843,  843
  9683. ,  844,  844,  845,  845,  846,  846,  847,  852,  853,  866
  9684. ,  867,  867,  868,  867,  868,  867,  868,  867,  868,  867
  9685. ,  868,  887,  888,  905,  906,  906,  907,  906,  907,  906
  9686. ,  907,  907,  908,  907,  908,  918,  919,  918,  919,  920
  9687. ,  921,  924,  925,  935,  936,  936,  937,  937,  938,  939
  9688. ,  940,  939,  940,  939,  940,  948,  949,  948,  949,  949
  9689. ,  950,  950,  951,  952,  953,  956,  957,  957,  958,  958
  9690. ,  959,  958,  959,  959,  960,  960,  961,  961,  962,  961
  9691. ,  962,  961,  962,  961,  962,  961,  962,  961,  962,  962
  9692. ,  963,  962,  963,  962,  963,  962,  963,  970,  971,  971
  9693. ,  972,  975,  976,  976,  977,  977,  978,  978,  979,  979
  9694. ,  980,  979,  980,  979,  980,  980,  981,  981,  982,  981
  9695. ,  982,  981,  982,  982,  983,  982,  983,  982,  983,  982
  9696. ,  983,  982,  983,  983,  984,  983,  984,  983,  984,  984
  9697. ,  985,  985,  986,  987,  988,  989,  990,  989,  990,  990
  9698. ,  991, 1001, 1002, 1001, 1002, 1002, 1003, 1003, 1004, 1005
  9699. , 1006, 1005, 1006, 1005, 1006, 1005, 1006, 1005, 1006, 1005
  9700. , 1006, 1005, 1006, 1005, 1006, 1005, 1006, 1007, 1008, 1008
  9701. , 1009, 1009, 1010, 1010, 1011, 1035, 1036, 1035, 1036, 1035
  9702. , 1036, 1035, 1036, 1038, 1039, 1039, 1040, 1050, 1051, 1061
  9703. , 1062, 1064, 1065, 1065, 1066, 1076, 1077, 1077, 1078, 1079
  9704. , 1080, 1079, 1080, 1080, 1081, 1085, 1086, 1085, 1086, 1085
  9705. , 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1085
  9706. , 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1085
  9707. , 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1085, 1086, 1088
  9708. , 1089, 1090, 1091, 1090, 1091, 1090, 1091, 1090, 1091, 1090
  9709. , 1091, 1090, 1091, 1102, 1103, 1102, 1103, 1102, 1103, 1104
  9710. , 1105, 1104, 1105, 1105, 1106, 1116, 1117, 1128, 1129, 1129
  9711. , 1130, 1130, 1131, 1131, 1132, 1133, 1134, 1134, 1135, 1138
  9712. , 1139, 1138, 1139, 1138, 1139, 1139, 1140, 1140, 1141, 1151
  9713. , 1152, 1162, 1163, 1163, 1164, 1163, 1164, 1164, 1165, 1166
  9714. , 1167, 1166, 1167, 1166, 1167, 1167, 1168, 1168, 1169, 1169
  9715. , 1170, 1170, 1171, 1171, 1172, 1172, 1173, 1173, 1174, 1173
  9716. , 1174, 1173, 1174, 1173, 1174, 1174, 1175, 1175, 1176, 1175
  9717. , 1176, 1176, 1177, 1177, 1178, 1177, 1178, 1177, 1178, 1177
  9718. , 1178, 1177, 1178, 1178, 1179, 1179, 1180, 1180, 1181, 1180
  9719. , 1181, 1181, 1182, 1181, 1182, 1195, 1196, 1198, 1199, 1199
  9720. , 1200, 1200, 1201, 1201, 1202, 1201, 1202, 1202, 1203, 1203
  9721. , 1204, 1203, 1204, 1203, 1204, 1204, 1205, 1204, 1205, 1204
  9722. , 1205, 1207, 1208, 1207, 1208, 1207, 1208, 1218, 1219, 1219
  9723. , 1220, 1219, 1220, 1219, 1220, 1219, 1220, 1219, 1220, 1220
  9724. , 1221, 1220, 1221, 1221, 1222, 1222, 1223, 1222, 1223, 1222
  9725. , 1223, 1223, 1224, 1224, 1225, 1225, 1226, 1225, 1226, 1225
  9726. , 1226, 1225, 1226, 1228, 1229, 1229, 1230, 1230, 1231, 1231
  9727. , 1232, 1242, 1243, 1242, 1243, 1245, 1246, 1247, 1248, 1247
  9728. , 1248, 1247, 1248, 1248, 1249, 1248, 1249, 1248, 1249, 1248
  9729. , 1249, 1250, 1251, 1255, 1256, 1260, 1261, 1260, 1261, 1271
  9730. , 1272, 1272, 1273, 1274, 1275, 1275, 1276, 1275, 1276, 1286
  9731. , 1287, 1286, 1287, 1286, 1287, 1287, 1288, 1287, 1288, 1287
  9732. , 1288, 1288, 1289, 1296, 1297, 1296, 1297, 1296, 1297, 1297
  9733. , 1298, 1299, 1300, 1299, 1300, 1300, 1301, 1300, 1301, 1300
  9734. , 1301, 1300, 1301, 1300, 1301, 1300, 1301, 1301, 1302, 1302
  9735. , 1303, 1303, 1304, 1304, 1305, 1304, 1305, 1304, 1305, 1304
  9736. , 1305, 1304, 1305, 1304, 1305, 1315, 1316, 1315, 1316, 1315
  9737. , 1316, 1315, 1316, 1315, 1316, 1315, 1316, 1315, 1316, 1326
  9738. , 1327, 1327, 1328, 1327, 1328, 1327, 1328, 1328, 1329, 1329
  9739. , 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329
  9740. , 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329
  9741. , 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329, 1330, 1329
  9742. , 1330, 1329, 1330, 1330, 1331, 1331, 1332, 1333, 1334, 1333
  9743. , 1334, 1333, 1334, 1344, 1345, 1345, 1346, 1346, 1347, 1346
  9744. , 1347, 1348, 1349, 1350, 1351, 1351, 1352, 1352, 1353, 1357
  9745. , 1358, 1357, 1358, 1357, 1358, 1357, 1358, 1357, 1358, 1358
  9746. , 1359, 1358, 1359, 1360, 1361, 1360, 1361, 1360, 1361, 1360
  9747. , 1361, 1360, 1361, 1360, 1361, 1361, 1362, 1362, 1363, 1363
  9748. , 1364, 1365, 1366, 1376, 1377, 1378, 1379, 1378, 1379, 1378
  9749. , 1379, 1379, 1380, 1390, 1391, 1390, 1391, 1390, 1391, 1392
  9750. , 1393, 1392, 1393, 1392, 1393, 1392, 1393, 1393, 1394, 1394
  9751. , 1395, 1395, 1396, 1407, 1408, 1407, 1408, 1407, 1408, 1407
  9752. , 1408, 1407, 1408, 1407, 1408, 1407, 1408, 1408, 1409, 1409
  9753. , 1410, 1410, 1411, 1411, 1412, 1412, 1413, 1413, 1414, 1414
  9754. , 1415, 1425, 1426, 1429, 1430, 1429, 1430, 1429, 1430, 1429
  9755. , 1430, 1429, 1430, 1429, 1430, 1429, 1430, 1429, 1430, 1429
  9756. , 1430, 1429, 1430, 1429, 1430, 1429, 1430, 1431, 1432, 1431
  9757. , 1432, 1434, 1435, 1436, 1437, 1436, 1437, 1437, 1438, 1438
  9758. , 1439, 1438, 1439, 1438, 1439, 1438, 1439, 1438, 1439, 1438
  9759. , 1439, 1438, 1439, 1438, 1439, 1438, 1439, 1439, 1440, 1439
  9760. , 1440, 1440, 1441, 1441, 1442, 1444, 1445, 1445, 1446, 1445
  9761. , 1446, 1449, 1450, 1449, 1450, 1449, 1450, 1450, 1451, 1450
  9762. , 1451, 1450, 1451, 1452, 1453, 1453, 1454, 1454, 1455, 1454
  9763. , 1455, 1455, 1456, 1455, 1456, 1457, 1458, 1458, 1459, 1485
  9764. , 1486, 1489, 1490, 1490, 1491, 1490, 1491, 1490, 1491, 1501
  9765. , 1502, 1502, 1503, 1503, 1504, 1504, 1505, 1504, 1505, 1505
  9766. , 1506, 1506, 1507, 1506, 1507, 1509, 1510, 1509, 1510, 1510
  9767. , 1511, 1510, 1511, 1510, 1511, 1513, 1514, 1513, 1514, 1514
  9768. , 1515, 1514, 1515, 1514, 1515, 1514, 1515, 1514, 1515, 1515
  9769. , 1516, 1515, 1516, 1526, 1527, 1527, 1528, 1527, 1528, 1527
  9770. , 1528, 1527, 1528, 1527, 1528, 1528, 1529, 1529, 1530, 1529
  9771. , 1530, 1529, 1530, 1530, 1531, 1530, 1531, 1542, 1543, 1542
  9772. , 1543, 1543, 1544, 1543, 1544, 1544, 1545, 1545, 1546, 1545
  9773. , 1546, 1546, 1547, 1570, 1571, 1570, 1571, 1570, 1571, 1570
  9774. , 1571, 1571, 1572, 1571, 1572, 1571, 1572, 1571, 1572, 1571
  9775. , 1572, 1571, 1572, 1572, 1573, 1572, 1573, 1572, 1573, 1574
  9776. , 1575, 1585, 1586, 1586, 1587, 1587, 1588, 1591, 1592, 1591
  9777. , 1592, 1591, 1592, 1593, 1594, 1605, 1606, 1605, 1606, 1607
  9778. , 1608, 1607, 1608, 1607, 1608, 1609, 1610, 1610, 1611, 1611
  9779. , 1612, 1612, 1613, 1613, 1614, 1613, 1614, 1622, 1623, 1622
  9780. , 1623, 1622, 1623, 1623, 1624, 1625, 1626, 1626, 1627, 1627
  9781. , 1628, 1627, 1628, 1629, 1630, 1629, 1630, 1640, 1641, 1641
  9782. , 1642, 1645, 1646, 1653, 1654, 1656, 1657, 1657, 1658, 1659
  9783. , 1660, 1659, 1660, 1660, 1661, 1661, 1662, 1661, 1662, 1661
  9784. , 1662, 1661, 1662, 1661, 1662, 1663, 1664, 1663, 1664, 1674
  9785. , 1675, 1675, 1676, 1676, 1677, 1677, 1678, 1677, 1678, 1677
  9786. , 1678, 1677, 1678, 1677, 1678, 1678, 1679, 1680, 1681, 1681
  9787. , 1682, 1686, 1687, 1686, 1687, 1687, 1688, 1687, 1688, 1688
  9788. , 1689, 1689, 1690, 1690, 1691, 1701, 1702, 1702, 1703, 1702
  9789. , 1703, 1705, 1706, 1706, 1707, 1706, 1707, 1717, 1718, 1717
  9790. , 1718, 1717, 1718, 1717, 1718, 1718, 1719, 1718, 1719, 1719
  9791. , 1720, 1719, 1720, 1719, 1720, 1720, 1721, 1721, 1722, 1722
  9792. , 1723, 1722, 1723, 1723, 1724, 1723, 1724, 1723, 1724, 1723
  9793. , 1724, 1724, 1725, 1724, 1725, 1725, 1726, 1725, 1726, 1726
  9794. , 1727, 1727, 1728, 1727, 1728, 1727, 1728, 1728, 1729, 1728
  9795. , 1729, 1729, 1730, 1729, 1730, 1730, 1731, 1731, 1732, 1754
  9796. , 1755, 1755, 1756, 1755, 1756, 1756, 1757, 1757, 1758, 1757
  9797. , 1758, 1757, 1758, 1758, 1759, 1758, 1759, 1759, 1760, 1759
  9798. , 1760, 1763, 1764, 1764, 1765, 1764, 1765, 1765, 1766, 1770
  9799. , 1771, 1770, 1771, 1770, 1771, 1771, 1772, 1772, 1773, 1773
  9800. , 1774, 1773, 1774, 1774, 1775, 1774, 1775, 1774, 1775, 1775
  9801. , 1776, 1775, 1776, 1775, 1776, 1775, 1776, 1775, 1776, 1775
  9802. , 1776, 1776, 1777, 1777, 1778, 1777, 1778, 1778, 1779, 1779
  9803. , 1780, 1779, 1780, 1779, 1780, 1780, 1781, 1781, 1782, 1781
  9804. , 1782, 1782, 1783, 1783, 1784, 1783, 1784, 1784, 1785, 1784
  9805. , 1785, 1784, 1785, 1786, 1787, 1786, 1787, 1788, 1789, 1789
  9806. , 1790, 1790, 1791, 1791, 1792, 1791, 1792, 1792, 1793, 1792
  9807. , 1793, 1793, 1794, 1794, 1795, 1795, 1796, 1796, 1797, 1796
  9808. , 1797, 1796, 1797, 1798, 1799, 1798, 1799, 1798, 1799, 1799
  9809. , 1800, 1800, 1801, 1800, 1801, 1800, 1801, 1800, 1801, 1800
  9810. , 1801, 1800, 1801, 1800, 1801, 1800, 1801, 1801, 1802, 1802
  9811. , 1803, 1803, 1804, 1803, 1804, 1803)  ;
  9812.     
  9813.     Action_Token_Map : constant Action_Token_Array :=
  9814.          (   43,   65,   45,   63,   26,   27,   42,   43,   54,   71
  9815. ,   80,   27,   42,   45,   54,   26,   63,   35,   37,   68
  9816. ,   71,   74,   76,    3,   36,   65,   66,   67,   65,   67
  9817. ,   11,   65,   65,   71,   31,   80,   80,   42,   56,   26
  9818. ,   45,   42,   26,   45,   72,   65,   65,    7,   30,   34
  9819. ,   49,   69,   70,   74,   76,   78,   81,   83,   84,   85
  9820. ,   86,   87,   36,   39,   47,   64,   71,   72,   73,   75
  9821. ,   77,   82,   89,   90,   91,   36,   37,   65,   66,   67
  9822. ,   71,   74,   76,    3,   35,   40,   68,   72,   30,   36
  9823. ,   82,   83,   89,   91,   81,   86,   90,   70,   47,   71
  9824. ,   77,   75,   39,   64,    7,    7,   39,   64,    7,   39
  9825. ,   74,   69,   76,   49,   73,   78,   34,   87,   35,   37
  9826. ,   65,   66,   67,   68,   71,   36,   65,   66,   67,   68
  9827. ,   71,    3,   35,   37,   31,   51,   71,   65,   31,   71
  9828. ,   25,   26,   27,   35,   42,   43,   45,   55,   56,   59
  9829. ,   60,   65,   10,   71,   80,   35,   10,   65,   67,   21
  9830. ,   43,   44,   45,   55,   56,   10,   25,   26,   27,   42
  9831. ,   59,   60,   65,   26,   42,   55,   56,   59,   60,   25
  9832. ,   27,   45,   21,   44,   10,   65,   21,   65,   67,   11
  9833. ,   11,   31,   65,   80,   80,   59,   63,   65,   43,   60
  9834. ,   71,   70,   77,   84,   85,   85,   72,   75,   30,   36
  9835. ,   39,   64,   81,   82,   83,   85,   86,   89,   90,   91
  9836. ,    7,   72,   75,   84,   71,   77,   47,   70,   72,   75
  9837. ,   80,   30,   67,   71,   74,    3,   35,   36,   37,   65
  9838. ,   66,   68,   76,   36,   65,    3,   35,   37,   66,   67
  9839. ,   68,   71,   74,   76,    3,   35,   36,   37,   76,   65
  9840. ,   66,   67,   68,   71,   74,   35,   36,   37,   65,   68
  9841. ,   71,   74,   76,    3,   66,   67,   17,   47,   65,   16
  9842. ,   71,    3,   35,   36,   37,   68,   65,   66,   67,   71
  9843. ,   74,   76,    6,   65,   67,   68,    3,   35,   36,   37
  9844. ,   76,   65,   66,   67,   68,   71,   74,   75,   35,   58
  9845. ,   65,   66,   67,   68,   74,    3,   36,   37,   71,   76
  9846. ,    3,   65,   66,   67,   76,   19,   35,   36,   37,   68
  9847. ,   71,   74,    3,   35,   37,   65,   67,   71,   74,   36
  9848. ,   66,   68,   76,    3,   36,   37,   65,   67,   71,   74
  9849. ,   76,   35,   66,   68,    3,   35,   36,   37,   65,   66
  9850. ,   67,   68,   71,   74,   76,   35,   36,   37,   65,   67
  9851. ,   68,   74,   76,    3,   66,   71,   58,   19,    3,   36
  9852. ,   37,   66,   67,   68,   71,   35,   65,    3,   65,   35
  9853. ,   36,   37,   66,   67,   68,   71,   65,   66,   68,   71
  9854. ,   35,   37,   67,   77,   70,   71,   65,   65,   80,   71
  9855. ,   31,   25,   26,   27,   35,   42,   59,   60,   65,   21
  9856. ,   43,   44,   45,   55,   56,   71,   80,   65,   65,   35
  9857. ,   36,   37,   65,   66,   74,   76,    3,   67,   68,   71
  9858. ,   59,   60,   25,   26,   27,   42,   45,   55,   56,   80
  9859. ,   65,   65,   67,   68,   65,   65,   65,   59,   65,   31
  9860. ,   50,   80,   65,   80,   65,   51,   71,   65,   65,   31
  9861. ,   65,   26,   45,   79,   75,   80,    3,   36,   37,   65
  9862. ,   66,   67,   71,   35,   68,   74,   76,   71,   65,   65
  9863. ,    3,   35,   37,   67,   68,   71,   74,   76,   36,   65
  9864. ,   66,    3,   65,   67,   68,   76,   35,   36,   37,   66
  9865. ,   71,   74,   35,   36,   67,   74,   76,    3,   37,   40
  9866. ,   65,   66,   68,   71,    3,   35,   36,   37,   67,   68
  9867. ,   76,   65,   66,   71,   74,   84,   85,    3,   37,   40
  9868. ,   65,   68,   74,   76,   35,   36,   66,   67,   71,   75
  9869. ,   86,   86,   72,   65,    3,   36,   37,   65,   66,   68
  9870. ,   74,   76,   35,   67,   71,   30,   91,   36,   81,   82
  9871. ,   83,   89,   90,   65,   68,   71,   74,   76,    3,   35
  9872. ,   36,   37,   66,   67,    3,   36,   37,   68,   71,   76
  9873. ,   35,   65,   66,   67,   74,    3,   35,   37,   68,   36
  9874. ,   65,   66,   67,   71,   74,   76,   77,   79,    3,   65
  9875. ,   66,   68,   74,   76,   35,   36,   37,   67,   71,    3
  9876. ,   35,   36,   76,   37,   65,   66,   67,   68,   71,   74
  9877. ,   77,   64,   72,   76,   78,   81,   83,   85,   87,   89
  9878. ,   90,   91,    7,   30,   34,   36,   39,   49,   69,   70
  9879. ,   71,   73,   74,   75,   77,   82,   30,   34,   49,   64
  9880. ,   70,   71,   72,   73,   75,   76,   78,   83,   85,   87
  9881. ,   89,   90,   91,    7,   36,   39,   69,   74,   77,   81
  9882. ,   82,   85,   65,   11,   65,   11,   59,   65,   31,   50
  9883. ,   80,    2,    4,   14,   24,   37,   43,   53,   10,   12
  9884. ,   15,   25,   28,   29,   33,   46,   51,   62,   65,   67
  9885. ,   68,   92,   23,   71,   80,   60,   70,   71,   77,   60
  9886. ,   31,   50,   31,   65,   31,   80,   31,   71,   80,   65
  9887. ,   21,   25,   27,   43,   44,   45,   65,   10,   26,   42
  9888. ,   55,   56,   59,   60,   65,   67,   68,   43,   21,   22
  9889. ,   21,   21,   65,   80,   31,   80,   31,   71,   31,   30
  9890. ,   65,   75,   65,   43,   72,    3,   35,   65,   66,   36
  9891. ,   37,   67,   68,   71,   74,   76,   36,   65,   66,   67
  9892. ,   71,   74,   76,    3,   35,   37,   68,    3,   35,   37
  9893. ,   66,   36,   40,   65,   67,   68,   71,   74,   76,    3
  9894. ,   35,   37,   65,   66,   67,   68,   71,   74,   76,   36
  9895. ,    3,   36,   65,   68,   74,   76,   35,   37,   66,   67
  9896. ,   71,   75,   30,   41,   65,   72,   80,   80,   72,   72
  9897. ,   75,   37,   74,    3,   35,   36,   65,   66,   67,   68
  9898. ,   71,   76,   77,   65,   65,   43,   26,   42,   45,   27
  9899. ,   56,   60,   10,   25,   26,   55,   27,   35,   42,   43
  9900. ,   45,   54,   56,   59,   60,   65,   65,    4,   10,   12
  9901. ,   15,   24,   29,   33,   37,   46,   51,   53,   62,   65
  9902. ,   68,    2,   14,   25,   28,   67,   92,   12,   15,   24
  9903. ,   25,   46,   53,   62,   65,   68,    2,    4,   10,   14
  9904. ,   28,   29,   33,   37,   67,   51,   21,   37,   65,   71
  9905. ,   74,    3,   35,   36,   66,   67,   68,   76,    9,   71
  9906. ,   17,   65,   16,   47,    3,   37,   67,   68,   76,   35
  9907. ,   36,   65,   66,   71,   74,   65,   65,   31,   80,    5
  9908. ,   17,   32,   47,    8,   16,   35,   44,   71,   65,   77
  9909. ,   75,   80,   70,   71,   80,   77,   65,   65,   25,   65
  9910. ,   65,   79,    8,   16,   17,   47,   71,    5,   32,   44
  9911. ,   65,   94,   65,   67,   68,   80,   41,   88,   65,   75
  9912. ,   86,   75,   88,   51,   65,   72,   75,   72,   75,   80
  9913. ,   36,   71,    3,   35,   37,   65,   66,   67,   68,   74
  9914. ,   76,   31,   31,   11,   65,   31,   80,   80,   93,   43
  9915. ,    2,   10,   12,   15,   20,   21,   23,   24,   25,   37
  9916. ,   61,   62,   65,   67,   68,    4,   14,   19,   28,   29
  9917. ,   33,   46,   51,   53,   92,   65,   67,   68,   65,   36
  9918. ,   65,   66,   74,   76,    3,   35,   37,   67,   68,   71
  9919. ,   35,   36,   65,    3,   37,   66,   67,   68,   71,   74
  9920. ,   76,   61,   65,   80,   65,    3,   35,   65,   66,   68
  9921. ,   71,   74,   76,   36,   37,   67,   80,   80,   65,   79
  9922. ,   71,   77,   80,   88,   70,   25,   33,   62,   10,   14
  9923. ,    3,   36,   37,   65,   67,   74,   80,   35,   66,   68
  9924. ,   71,   76,   43,   61,   72,   35,   37,   65,   66,   68
  9925. ,   71,   76,    3,   36,   67,   74,    3,   36,   37,   40
  9926. ,   71,   35,   65,   66,   67,   68,   74,   76,   48,   80
  9927. ,   80,   80,   77,   80,   17,   16,   47,   71,   65,   71
  9928. ,   36,   37,   71,   74,   76,    3,   35,   65,   66,   67
  9929. ,   68,    3,   35,   36,   65,   76,   37,   66,   67,   68
  9930. ,   71,   74,   44,   80,   65,   68,   80,   80,   80,   80
  9931. ,   80,   80,   80,   47,   47,   48,   79,   80,   71,   43
  9932. ,   80,   10,   21,   65,   25,   26,   27,   42,   43,   44
  9933. ,   45,   55,   56,   59,   60,   13,   65,   23,   94,   94
  9934. ,   44,   94,   94,   80,   70,   71,   77,    3,   35,   36
  9935. ,   74,   37,   65,   66,   67,   68,   71,   76,   80,   65
  9936. ,   80,   80,   54,   54,   43,   70,   71,   77,   71,   31
  9937. ,   80,   36,   65,   66,   67,   68,   74,   76,    3,   35
  9938. ,   37,   71,   61,   77,   80,   77,   80,   58,   77,   80
  9939. ,   10,   25,   33,   14,   62,   16,   17,   65,   47,   71
  9940. ,    3,   35,   36,   65,   66,   67,   68,   71,   74,   76
  9941. ,   37,   21,   61,   43,   65,   35,   36,   37,   67,   68
  9942. ,   74,   76,    3,   65,   66,   71,   65,   21,   15,   43
  9943. ,   57,   61,   65,   68,    4,   67,   80,   65,   40,   61
  9944. ,   80,   80,   75,    9,   65,   66,   71,   76,    3,   35
  9945. ,   36,   67,   68,   74,   37,    3,   36,   37,   65,   66
  9946. ,   71,   74,   76,   35,   67,   68,   38,   80,   65,   37
  9947. ,   65,   72,   80,    3,   76,   35,   36,   37,   65,   66
  9948. ,   67,   68,   71,   74,   80,   43,   65,   88,   50,   80
  9949. ,   88,    8,   16,   17,   47,   50,   71,   72,   72,   80
  9950. ,   80,   80,   43,   80,   75,    3,   35,   65,   66,   71
  9951. ,   74,   36,   37,   67,   68,   76,   18,   80,   80,   35
  9952. ,   36,   37,   74,   76,    3,   65,   66,   67,   68,   71
  9953. ,   19,   20,   80,   80,   12,   67,   68,   71,   74,    3
  9954. ,   35,   36,   37,   40,   65,   66,   76,   30,   33,   21
  9955. ,   80,   65,   65,   80,    3,   35,   37,   65,   66,   76
  9956. ,   36,   67,   68,   71,   74,   80,   70,   71,   77,   19
  9957. ,   39,    4,   15,   57,   19,   39,   85,   77,   34,   43
  9958. ,   21,   65,   67,   68,   72,   47,   70,   71,   77,   65
  9959. ,   72,   75,   21,   43,   88,   80,   31,   65,    7,   34
  9960. ,   49,   72,   81,   82,   83,   87,   89,   90,   91,   30
  9961. ,   36,   39,   47,   64,   69,   70,   71,   73,   74,   75
  9962. ,   76,   77,   78,   79,   86,   47,   70,   77,   71,   72
  9963. ,    3,   35,   68,   71,   74,   76,   36,   37,   65,   66
  9964. ,   67,   88,    8,   65,   80,   71,   65,   67,   68,   31
  9965. ,   65,   67,   68,   72,   80,   35,   36,   37,   71,   76
  9966. ,    3,   65,   66,   67,   68,   74,   21,   80,   85,   61
  9967. ,    3,   35,   36,   71,   74,   37,   52,   65,   66,   67
  9968. ,   68,   76,   33,   80,   80,   85,   21,   62,   65,   67
  9969. ,    2,    4,   10,   12,   14,   15,   19,   24,   25,   28
  9970. ,   29,   33,   37,   39,   43,   46,   51,   53,   68,   92
  9971. ,   43,   21,   84,   85,    3,   36,   37,   65,   66,   67
  9972. ,   71,   35,   68,   74,   76,   21,   48,    9,   77,   70
  9973. ,   71,   72,   75,   36,   37,   65,   66,   67,   74,   76
  9974. ,   94,    3,   35,   68,   71,   72,   75,   65,   68,   48
  9975. ,   65,   12,   43,    5,    8,   32,   44,   47,   71,   16
  9976. ,   17,   35,   71,   72,   80,   80,   80,   77,   80,    3
  9977. ,   35,   36,   37,   65,   67,   68,   71,   74,   76,   66
  9978. ,   88,   77,   80,   70,   71,    5,    8,   32,   47,   71
  9979. ,   16,   17,   44,   70,   71,   77,   71,   72,   80,   58
  9980. ,   29,   84,   85,    3,   74,   35,   36,   37,   65,   66
  9981. ,   67,   68,   71,   76,   33,   21,   65,   21,   15,   43
  9982. ,   53,    4,   15,   57,   61,   43,   65,   80,   48,   80
  9983. ,   65,   66,   67,   68,   74,    3,   35,   36,   37,   71
  9984. ,   76,   43,   67,   68,   65,   38,   35,   36,   76,    3
  9985. ,   37,   65,   66,   67,   68,   71,   74,   79,   65,   31
  9986. ,   44,   80,   65,   88,   80,   80,   65,   80,   33,   33
  9987. ,   80,    2,    4,   10,   12,   21,   24,   29,   33,   37
  9988. ,   39,   51,   53,   62,   65,   68,   14,   15,   19,   25
  9989. ,   28,   46,   67,   92,   53,   21,   80,   80,   47,   47
  9990. ,   71,   77,   70,   65,   65,   12,   65,   21,   43,   61
  9991. ,   43,   21,   43,   80,   80,   21,   65,   80,   53,   80
  9992. ,   94,   88,   12,   61,   72,   80,   72,   80,   21,   33
  9993. ,   80,   80,   80,   80,   37,   37,   21,   61,   33,   65
  9994. ,   65,   80,   80)  ;
  9995.         --| Action_Token_Map is an array that
  9996.         --| maps from each state (using action index map) to a set of
  9997.         --| action tokens. An action token is a terminal symbol
  9998.         --| (except EOF_Token) for which in the given state an
  9999.         --| explicit (non-default) shift or reduce action
  10000.         --| is defined.
  10001.         --| Used to cut reduce the
  10002.         --| number of primary recovery candidates.
  10003.     
  10004.     ------------------------------------------------------------------
  10005.     -- Shift_State_Map
  10006.     ------------------------------------------------------------------
  10007.     
  10008.     type Shift_State_Index_Array is array(
  10009.         PositiveParserInteger range <>) of GC.ParserInteger;
  10010.        --| For indexing the All Action Token Array.
  10011.        --| Maps a given state into the lower and upper bounds of a slice
  10012.        --| of the All Action Index Array.
  10013.  
  10014.     Shift_State_MapIndex : constant Shift_State_Index_Array :=
  10015.          (    1,    1,    2,    2,    3,    3,    4,    4,    5,    5
  10016. ,    6,    6,    7,    9,   10,   11,   12,   14,   15,   15
  10017. ,   16,   19,   20,   23,   24,   24,   25,   25,   26,   26
  10018. ,   27,   29,   30,   32,   33,   33,   34,   36,   37,   37
  10019. ,   38,   57,   58,   58,   59,   60,   61,   61,   62,   63
  10020. ,   64,   65,   66,   66,   67,   67,   68,   69,   70,   73
  10021. ,   74,   93,   94,   96,   97,  101,  102,  103,  104,  106
  10022. ,  107,  108,  109,  110,  111,  112,  113,  116,  117,  119
  10023. ,  120,  121,  122,  127,  128,  129,  130,  136,  137,  137
  10024. ,  138,  138,  139,  143,  144,  148,  149,  149,  150,  153
  10025. ,  154,  156,  157,  157,  158,  161,  162,  165,  166,  166
  10026. ,  167,  169,  170,  170,  171,  174,  175,  177,  178,  180
  10027. ,  181,  185,  186,  186,  187,  188,  189,  190,  191,  218
  10028. ,  219,  219,  220,  224,  225,  227,  228,  228,  229,  232
  10029. ,  233,  247,  248,  262,  263,  263,  264,  265,  266,  278
  10030. ,  279,  280,  281,  282,  283,  283,  284,  289,  290,  385
  10031. ,  386,  386,  387,  387,  388,  388,  389,  391,  392,  400
  10032. ,  401,  404,  405,  405,  406,  408,  409,  409,  410,  410
  10033. ,  411,  411,  412,  412,  413,  413,  414,  419,  420,  419
  10034. ,  420,  419,  420,  419,  420,  420,  421,  425,  426,  429
  10035. ,  430,  430,  431,  431,  432,  432,  433,  435,  436,  438
  10036. ,  439,  440,  441,  443,  444,  446,  447,  447,  448,  448
  10037. ,  449,  449,  450,  450,  451,  451,  452,  452,  453,  457
  10038. ,  458,  465,  466,  473,  474,  475,  476,  478,  479,  480
  10039. ,  481,  496,  497,  498,  499,  499,  500,  500,  501,  501
  10040. ,  502,  502,  503,  503,  504,  505,  506,  513,  514,  516
  10041. ,  517,  518,  519,  528,  529,  529,  530,  530,  531,  531
  10042. ,  532,  533,  534,  534,  535,  536,  537,  537,  538,  545
  10043. ,  546,  546,  547,  547,  548,  554,  555,  556,  557,  558
  10044. ,  559,  562,  563,  580,  581,  582,  583,  583,  584,  584
  10045. ,  585,  585,  586,  587,  588,  588,  589,  589,  590,  591
  10046. ,  592,  593,  594,  594,  595,  596,  597,  597,  598,  612
  10047. ,  613,  617,  618,  618,  619,  620,  621,  622,  623,  623
  10048. ,  624,  626,  627,  642,  643,  643,  644,  644,  645,  645
  10049. ,  646,  646,  647,  647,  648,  649,  650,  650,  651,  651
  10050. ,  652,  652,  653,  653,  654,  655,  656,  656,  657,  659
  10051. ,  660,  660,  661,  662,  663,  664,  665,  666,  667,  667
  10052. ,  668,  668,  669,  670,  671,  673,  674,  674,  675,  676
  10053. ,  677,  677,  678,  679,  680,  681,  682,  682,  683,  683
  10054. ,  684,  684,  685,  686,  687,  687,  688,  688,  689,  689
  10055. ,  690,  694,  695,  695,  696,  699,  700,  703,  704,  706
  10056. ,  707,  709,  710,  710,  711,  713,  714,  715,  716,  726
  10057. ,  727,  727,  728,  728,  729,  729,  730,  730,  731,  731
  10058. ,  732,  732,  733,  733,  734,  734,  735,  735,  736,  738
  10059. ,  739,  741,  742,  742,  743,  744,  745,  745,  746,  748
  10060. ,  749,  749,  750,  750,  751,  751,  752,  752,  753,  753
  10061. ,  754,  754,  755,  755,  756,  766,  767,  774,  775,  777
  10062. ,  778,  779,  780,  793,  794,  795,  796,  797,  798,  798
  10063. ,  799,  799,  800,  800,  801,  801,  802,  802,  803,  803
  10064. ,  804,  804,  805,  806,  807,  807,  808,  808,  809,  809
  10065. ,  810,  811,  812,  812,  813,  813,  814,  814,  815,  815
  10066. ,  816,  817,  818,  818,  819,  820,  821,  821,  822,  822
  10067. ,  823,  824,  825,  830,  831,  831,  832,  832,  833,  833
  10068. ,  834,  835,  836,  836,  837,  837,  838,  841,  842,  855
  10069. ,  856,  856,  857,  858,  859,  862,  863,  863,  864,  864
  10070. ,  865,  865,  866,  866,  867,  867,  868,  874,  875,  885
  10071. ,  886,  892,  893,  898,  899,  900,  901,  901,  902,  903
  10072. ,  904,  904,  905,  905,  906,  907,  908,  908,  909,  910
  10073. ,  911,  911,  912,  912,  913,  913,  914,  915,  916,  916
  10074. ,  917,  917,  918,  919,  920,  920,  921,  921,  922,  922
  10075. ,  923,  923,  924,  924,  925,  925,  926,  926,  927,  927
  10076. ,  928,  928,  929,  929,  930,  930,  931,  932,  933,  933
  10077. ,  934,  934,  935,  936,  937,  937,  938,  939,  940,  940
  10078. ,  941,  941,  942,  944,  945,  945,  946,  946,  947,  947
  10079. ,  948,  949,  950,  951,  952,  952,  953,  953,  954,  954
  10080. ,  955,  955,  956,  956,  957,  958,  959,  959,  960,  960
  10081. ,  961,  961,  962,  962,  963,  964,  965,  965,  966,  966
  10082. ,  967,  967,  968,  968,  969,  969,  970,  970,  971,  972
  10083. ,  973,  973,  974,  975,  976,  976,  977,  978,  979,  979
  10084. ,  980,  980,  981,  981,  982,  982,  983,  983,  984,  985
  10085. ,  986,  986,  987,  989,  990,  993,  994,  996,  997,  997
  10086. ,  998,  998,  999,  999, 1000, 1001, 1002, 1002, 1003, 1003
  10087. , 1004, 1004, 1005, 1005, 1006, 1006, 1007, 1008, 1009, 1009
  10088. , 1010, 1010, 1011, 1011, 1012, 1013, 1014, 1014, 1015, 1015
  10089. , 1016, 1017, 1018, 1018, 1019, 1019, 1020, 1021, 1022, 1022
  10090. , 1023, 1023, 1024, 1024, 1025, 1025, 1026, 1026, 1027, 1027
  10091. , 1028, 1028, 1029, 1029, 1030, 1030, 1031, 1031, 1032, 1032
  10092. , 1033, 1033, 1034, 1034, 1035, 1035, 1036, 1037, 1038, 1039
  10093. , 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043)  ;
  10094.     
  10095.     Shift_State_Map : constant Shift_State_Array :=
  10096.          (    1,  497,   37,  498,  548,  277,  151,  154,  157,  549
  10097. ,  816,  538,  784,  928,  188,   78,  233,  401,  402,  499
  10098. ,  838,  940, 1022,  706,  642,  500,  269,  550,  585,  270
  10099. ,  551,  586,  827,  288,  295,  831,  832,  224,  231,  434
  10100. ,  438,  439,  534,  741,  754,  846,  868,  879,  903,  920
  10101. ,  926,  963,  966, 1000, 1007, 1016, 1030,  435,  415,  707
  10102. ,  501,  196,  638,   13,   98,   14,  502,  503,  959,  132
  10103. ,  263,  453,  844,   83,  174,  180,  234,  305,  353,  405
  10104. ,  424,  426,  428,  447,  449,  451,  546,  611,  612,  729
  10105. ,  884,  897,  986,  552,  587,  944,  639,  913,  997, 1031
  10106. , 1039,  163,  866,   38,  186,  553,   39,  133,   40,  504
  10107. ,  794,  977,  152,  155,  158,  857,  121,  774,  839,  466
  10108. ,  598,   15,   99,  107,  197,  318,  480,    2,  194,  225
  10109. ,  554,  588,  679,  713,  945,  987,   16,  505,  144,  271
  10110. ,  589,  873, 1004,  662,  696,  927,  937,  972,  164,  341
  10111. ,  423,  813,  818,  175,  532,  605,  910,  506,  969,  999
  10112. , 1019,   17,  490,  723,  724,  198,  100,  199,  319,  755
  10113. ,  285,  294,  736,  958,  200,  239,  334,  201,  420,  422
  10114. ,  621,  651,  732,  742,  756,  640,   35,  240,  153,  156
  10115. ,    9,   41,   75,   79,  112,  116,  122,  191,  229,  241
  10116. ,  272,  278,  310,  328,  329,  333,  336,  354,  366,  367
  10117. ,  385,  491,  507,  578,  682,  748,  805,  982,   42,   43
  10118. ,   76,  192,  279,  311,   44,  280,  683,  159,  145,  248
  10119. ,  421,  633,   11,   45,   82,  146,  176,  184,  247,  303
  10120. ,  306,  418,  539,  555,  590,  668,  674,  111,  131,  253
  10121. ,  258,  383,  457,  468,  475,  607,  608,  659,  819,  871
  10122. ,  877,  930,  165,   46,  160,  149,  254,  259,  284,  360
  10123. ,  379,  455,  476,  574,  823,  878,  931,  934,   47,  161
  10124. ,  147,  249,  166,  357,  391,  584,  632,  698,  979,   12
  10125. ,   84,   90,  185,  237,  238,  262,  304,  307,  327,  349
  10126. ,  361,  419,  427,  429,  446,  448,  469,  547,  575,  576
  10127. ,  597,  609,  614,  622,  629,  630,  634,  649,  664,  665
  10128. ,  666,  667,  681,  686,  687,  688,  689,  690,  691,  692
  10129. ,  701,  705,  716,  719,  721,  722,  730,  733,  734,  738
  10130. ,  773,  782,  783,  795,  802,  809,  814,  821,  822,  824
  10131. ,  828,  829,  836,  837,  847,  850,  885,  893,  901,  906
  10132. ,  914,  915,  949,  950,  952,  954,  971,  973,  988,  991
  10133. ,  992,  994,  998, 1001, 1002, 1011, 1013, 1018, 1020, 1032
  10134. , 1033, 1034, 1035, 1042, 1043,  134,  135,  136,  250,  374
  10135. ,  923,  251,  252,  375,  399,  864,  907,  916,  924,  960
  10136. ,  137,  255,  381,  382,  168,  599,  635,  810,  138,  139
  10137. ,  140,  406,  615,  595,  711,  712,  714,  715,  933,    3
  10138. ,   48,  276,  363,  537,  789,  195,  407,  652, 1008,  202
  10139. ,  203,  204,   18,  205,  481,   19,  206,  482,  207,  483
  10140. ,   20,  208,  484,   21,  209,  485,  210,  440,  441,  442
  10141. ,  443,  444,  242,  301,  445,  572,  938,  544,  673,  708
  10142. ,  796,  811,  876, 1005, 1006,  600,  604,  815,  883,  890
  10143. ,  953,  990, 1021,  709,  812,  556,  817,  891,  895,  951
  10144. ,   49,  123,  312,  368,  369,  370,  376,  461,  619,  625
  10145. ,  650,  661,  718,  740,  825,  889,  243,  601,  359,  211
  10146. ,  212,  213,  337,  557,  946,  177,  182,  430,  450,  702
  10147. ,  727,  947,  956,  573,  594,  886,  699,  717,  470,  474
  10148. ,  803,  820,  887,  899,  948,  957, 1028, 1029,  558,  559
  10149. ,  560,  561,  591,  562,  563,  592,  564,  117,  299,  454
  10150. ,  467,  545,  710,  720,  801,  669,  118,  148,  256,  565
  10151. ,  670,  693,  874, 1003,  566,  671,  567,  672,  183,  317
  10152. ,  338,  680,   50,  124,  264,  265,  267,  268,  286,  373
  10153. ,  459,  464,  465,  542,  620,  660,  677,  678,  925,  974
  10154. ,  684,  936,  797,  685,  568,  694,  695,  569,  570,  675
  10155. ,  894,  790,  975,  872,  932,  935,  676,   51,  125,  171
  10156. ,  330,  433,  508,  596,  617,  757,  791,  806,  869,  896
  10157. ,  898,  976,  792,  807,  911,  961,  978,  875,  266,  793
  10158. ,  540,  571,  697,  798, 1036, 1037,   91,  114,  340,  342
  10159. ,  362,  403,  579,  583,  613,  704,  786,  799,  882,  929
  10160. ,  980,  983,  880,  939,  981,  881,  941,  509,  800,  942
  10161. ,  984, 1009, 1023, 1010, 1038, 1024,  126,  460,  840,   87
  10162. ,   92,  187,   88,   95,  320,  486,  404,  214,  215,  580
  10163. ,  216,  246,  487,  488,  101,  321,  322,   22,  102,   23
  10164. ,  103,  104,   52,   53,   54,  331,  281,  273,  127,   55
  10165. ,  274,  364,  541,  739,  128,  260,  380,  602,  603,  129
  10166. ,  371,  377,  463,  261,  458,  462,  130,  372,  378,   56
  10167. ,   57,  282,  386,  150,  384,   58,  287,  289,  290,  291
  10168. ,  292,  293,  387,  388,  389,  390,   59,   60,   61,   62
  10169. ,   63,  141,  142,   64,   65,   66,  173,  296,   67,  172
  10170. ,  298,  169,   68,  297,   69,   70,  275,  365,   71,   72
  10171. ,  143,  162,   73,  167,  170,  119,  300,  309,  400,  431
  10172. ,  543,  623,  624,  631,  775,  892,  324,  492,  647,  725
  10173. ,  852,  856,  919,  921,  408,  616,  917,  493,  965,  325
  10174. ,  645,  737,  751,  780,  781,  841,  843,  904,  905,  912
  10175. ,  918,  996, 1015,  409,  494,  410,  495,  411,  412,  510
  10176. ,  511,  413,  533,  512,  513,  758,  514,  515,  516,  517
  10177. ,  759,  518,  519,  520,  521,  522,  760,  523,  414,  496
  10178. ,  626,  735,  833,  862,  627,  731,  750,  830,  851,  902
  10179. ,  524,  636,  743,  744,  909,  745,  525,  641,  845,  962
  10180. ,  995,  230,  346,  350,  352,  577,  581,  582,  752,  848
  10181. ,  849,  964, 1017, 1040, 1041,  749,  189,  643,   89,   96
  10182. ,  235,  753,  190,  326,  416,  526,  644,   24,  105,  108
  10183. ,  217,  323,  356,  489,   80,   81,  179,  236,  332,  335
  10184. ,  351,  425,  478,  479,  618,  302,  308,  606,  808,  826
  10185. ,  989,  993,  394,  397,  888,  900, 1012, 1014,   77,  232
  10186. ,  392,  358,  393,   25,  193,   26,  109,   27,   93,  347
  10187. ,  226,   28,   97,  339,  700,  432,  218,  343,  345,  219
  10188. ,  106,  703,  436,  728,  527,  646,  528,  529,  530,  531
  10189. ,  648,  922,  772,  761,  762,  861,  763,  764,  967,  765
  10190. ,  766,  853,  855,  860,  767,  768,  769,  834,  858,  859
  10191. ,  863,  968,  770,  726,    4,    5,    6,   10,    7,   29
  10192. ,   30,    8,  113,  456,  245,   36,   31,  653,  777,  654
  10193. ,  655,  778,  656,  657,  779,  658,  776,  970,   32,   33
  10194. ,  110,  244,  355,  593,  955,  452,   85,  178,  181,  313
  10195. ,  395,  396,  610,  398,  472,  473,   86,  314,  315,  316
  10196. ,  477,  220,  221,  222,  223,  663,  787,  867,  785,  870
  10197. ,  985,  535,  637,  804, 1027,  257,  908,   94,  227,   74
  10198. ,  283,  120,  628,  835,  842,  417,  536,  471,  344,  437
  10199. ,  854,  115,  865,  788,  943,  746, 1025,  747, 1026,  771
  10200. ,   34,  228,  348)  ;
  10201.         --| Shift_State_ is an array that
  10202.         --| maps from non-terminals (using shift index map) to sets
  10203.         --| of states in which
  10204.         --| a shift to the non-terminal is defined.
  10205.         --| Used to determine the number of trials in primary
  10206.         --| error recovery.
  10207.  
  10208.     ------------------------------------------------------------------
  10209.     -- Subprogram Bodies Global to Package ErrorParseTables
  10210.     ------------------------------------------------------------------
  10211.  
  10212.     function Get_Action_Token_Map ( --| return the array of action tokens
  10213.                     --| for the state passed in.
  10214.         In_Index : in StateRange
  10215.                     --| the state to return action tokens
  10216.                     --| for.
  10217.         )
  10218.         return Action_Token_Record
  10219.         is
  10220.         --| Returns
  10221.         --| This subprogram returns the action token record for the
  10222.         --| state passed in.
  10223.         Result : Action_Token_Record ;
  10224.         LowerBound, UpperBound : GC.ParserInteger ;
  10225.         --| Lower and upper bounds of the slice of Action Token Map
  10226.     begin
  10227.         LowerBound := Action_Token_MapIndex ( In_Index*2 - 1 ) ;
  10228.         UpperBound := Action_Token_MapIndex ( In_Index*2 ) ;
  10229.  
  10230.         Result.set_size := UpperBound - LowerBound + 1;
  10231.         Result.set := (others => DefaultValue) ;
  10232.         Result.set(Result.set'first .. Result.set_size) :=
  10233.         Action_Token_Map(LowerBound..UpperBound) ;
  10234.       
  10235.         return Result ;
  10236.     end Get_Action_Token_Map ;
  10237.  
  10238.     ------------------------------------------------------------------
  10239.  
  10240.     function Get_Shift_State_Map (  --| return the array of shift states
  10241.                     --| for the grammar symbol passed in.
  10242.         In_Index : in GrammarSymbolRange
  10243.                     --| the grammar symbol to return shifts
  10244.                     --| for.
  10245.         )
  10246.         --| Raises: This subprogram raises no exceptions.
  10247.         return Shift_State_Record
  10248.         --| Returns
  10249.         --| This subprogram returns the array of shift states for the
  10250.         --| grammar symbol passed in.
  10251.         is
  10252.         
  10253.         Result : Shift_State_Record ;
  10254.         LowerBound, UpperBound : GC.ParserInteger ;
  10255.           --| Lower and upper bounds of the slice of Shift State Map
  10256.     begin
  10257.         LowerBound := Shift_State_MapIndex ( In_Index*2 - 1 ) ;
  10258.         UpperBound := Shift_State_MapIndex ( In_Index*2 ) ;
  10259.     
  10260.         Result.set_size := UpperBound - LowerBound + 1;
  10261.         Result.set := (others => DefaultValue) ;
  10262.         Result.set(Result.set'first .. Result.set_size) :=
  10263.             Shift_State_Map(LowerBound..UpperBound) ;
  10264.       
  10265.         return Result ;
  10266.     end Get_Shift_State_Map ;
  10267.  
  10268.     function Get_Grammar_Symbol (   --| return the string representation
  10269.                     --| of the grammar symbol
  10270.         In_Index : in GrammarSymbolRange
  10271.         )
  10272.         return string
  10273.         is
  10274.         LowerBound, UpperBound : GC.ParserInteger ;
  10275.       --| Lower and upper bounds of the slice of Shift State Map
  10276.     begin
  10277.         LowerBound := GrammarSymbolTableIndex ( In_Index*2 - 1 ) ;
  10278.         UpperBound := GrammarSymbolTableIndex ( In_Index*2 ) ;
  10279.  
  10280.         return GrammarSymbolTable(
  10281.             Integer(LowerBound) .. Integer(UpperBound)) ;
  10282.     end Get_Grammar_Symbol ;
  10283.  
  10284.     ------------------------------------------------------------------
  10285.  
  10286.     function Get_Follow_Map (       --| return the array of follow symbols
  10287.                     --| of the grammar symbol passed in
  10288.         In_Index : in FollowMapRange
  10289.         )
  10290.         -- |
  10291.         -- |Raises: This subprogram raises no exceptions.
  10292.         -- |
  10293.     
  10294.       return FollowSymbolRecord
  10295.       is
  10296.         Result : FollowSymbolRecord ;
  10297.         LowerBound, UpperBound : GC.ParserInteger ;
  10298.         Adjusted_Index : GC.ParserInteger :=
  10299.           (In_Index - FollowMapRange'first) + 1;
  10300.     begin
  10301.         LowerBound := FollowSymbolMapIndex ( Adjusted_Index*2 - 1 ) ;
  10302.         UpperBound := FollowSymbolMapIndex ( Adjusted_Index*2 ) ;
  10303.     
  10304.         Result.follow_symbol_count := UpperBound - LowerBound + 1;
  10305.         Result.follow_symbol := (others => DefaultValue) ;
  10306.         Result.follow_symbol(
  10307.           Result.follow_symbol'first ..
  10308.           Result.follow_symbol_count) :=
  10309.             FollowSymbolMap(LowerBound..UpperBound) ;
  10310.           
  10311.         return Result ;
  10312.     end Get_Follow_Map ;
  10313.  
  10314.     ------------------------------------------------------------------
  10315.  
  10316.     function GetAction (            -- see subprogram declaration
  10317.       InStateValue  : in StateRange;
  10318.       InSymbolValue : in GrammarSymbolRange
  10319.       )
  10320.       return ActionRange
  10321.       is
  10322.         
  10323.         Unique : GC.ParserInteger;
  10324.             --| unique value to hash for Index.
  10325.         Index  : GC.ParserInteger;
  10326.             --| index into Action Tables.
  10327.         Action : GC.ParserInteger;
  10328.             --| value from Action Tables.
  10329.         CollisionCount : Natural := 0 ; --| Number of collisions.
  10330.     begin -- GetAction function
  10331.     --| Algorithm
  10332.     --|-
  10333.     --| Definitions of key objects from package ParseTables:
  10334.     --|
  10335.     --| ActionCount: the number of actions in the action tables.
  10336.     --|
  10337.     --| ActionTableOne: table of action values for all combinations of
  10338.     --|     states and input actions.
  10339.     --|
  10340.     --| ActionTableTwo: hash values to check against to verify that action
  10341.     --|     value at same index in ActionTableOne is correct one.
  10342.     --|
  10343.     --| ActionTableSize: last index in ActionTableOne and ActionTableTwo
  10344.     --|     before the hash collision chains.
  10345.     --|
  10346.     --| DefaultMap: default action for each state.
  10347.     --|+
  10348.     --| The action to be returned is computed from parameters InStateValue
  10349.     --| and InSymbolValue. First, determine the unique single value:
  10350.     --|
  10351.     --|     Unique := (InStateValue * GrammarSymbolCountPlusOne) +
  10352.     --|                InSymbolValue;
  10353.     --|
  10354.     --| Unique is hashed by reducing modulo ActionTableSize and adding 1:
  10355.     --|
  10356.     --|     Index := (Unique mod ActionTableSize) + 1;
  10357.     --|
  10358.     --| This hash value, Index, is used to index ActionTableOne to
  10359.     --| obtain an Action:
  10360.     --|
  10361.     --|     Action := ActionTableOne(Index);
  10362.     --|
  10363.     --| Action is then used to determine the return value:
  10364.     --|
  10365.     --| Action = 0:
  10366.     --|     return DefaultMap(InStateValue);
  10367.     --|
  10368.     --| Action < ActionCount:
  10369.     --|     if (Unique = ActionTableTwo(Index)) then
  10370.     --|         return Action;
  10371.     --|     else
  10372.     --|         return DefaultMap(InStateValue);
  10373.     --|     end if;
  10374.     --|
  10375.     --| Action >= ActionCount:
  10376.     --|     --Search the hash collision chain
  10377.     --|     Index := Action - ActionCount;
  10378.     --|     while (Action /= 0) loop
  10379.     --|         Index := Index + 1;
  10380.     --|         Action := ActionTableTwo(Index);
  10381.     --|         if (Action = Unique) then
  10382.     --|             return ActionTableOne(Index);
  10383.     --|         end if;
  10384.     --|     end loop;
  10385.     --|     return DefaultMap(InStateValue);
  10386.  
  10387.     ------------------------------------------------------------------
  10388.  
  10389.   --| The actual code used folds this algorithm into a more efficient one:
  10390.         ParserDecisionCount := Natural'succ(ParserDecisionCount) ;
  10391.                                                                     
  10392.         Unique := (InStateValue * GrammarSymbolCountPlusOne) +          
  10393.                         InSymbolValue;                                  
  10394.         Index := (Unique mod ActionTableSize) + 1;                      
  10395.         Action := ActionTableOne(Index);                                
  10396.                                                                         
  10397.         if (Action >= ActionCount) then                                 
  10398.             Index := Action - ActionCount + 1;                          
  10399.             while ( (ActionTableTwo(Index) /= Unique) and then          
  10400.                     (ActionTableTwo(Index) /= 0) ) loop                 
  10401.                 Index := Index + 1;
  10402.             CollisionCount := Natural'succ(CollisionCount) ;
  10403.             end loop;                                                   
  10404.             Action := ActionTableOne(Index);                            
  10405.         end if;
  10406.         
  10407.         -- Collect statistics information.
  10408.         TotalCollisions := CollisionCount + TotalCollisions ;
  10409.         if CollisionCount > MaxCollisions then
  10410.             MaxCollisions := CollisionCount ;
  10411.         end if;
  10412.                                                                         
  10413.         if (ActionTableTwo(Index) /= Unique) then                       
  10414.             return DefaultMap(InStateValue);                            
  10415.         else                                                            
  10416.             return Action;                                              
  10417.         end if;                                                         
  10418.     
  10419.     end GetAction; -- function
  10420.  
  10421.     function Get_LeftHandSide(
  10422.       GrammarRule : in LeftHandSideRange
  10423.       ) return GrammarSymbolRange is
  10424.     begin
  10425.         return LeftHandSide(GrammarRule) ;
  10426.     end Get_LeftHandSide ;
  10427.     
  10428.     function Get_RightHandSide(
  10429.       GrammarRule : in RightHandSideRange
  10430.       ) return GC.ParserInteger is
  10431.     begin
  10432.         return RightHandSide(GrammarRule) ;
  10433.     end Get_RightHandSide ;
  10434.     
  10435. end ParseTables;
  10436.  
  10437. ----------------------------------------------------------------------
  10438. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10439. --GRMCONST.BDY
  10440. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10441. --+ GRMCONST.BDY +--
  10442.  
  10443. Package body Grammar_Constants is
  10444.  
  10445.     function setGrammarSymbolCount return ParserInteger is
  10446.     begin
  10447.         return   394 ;
  10448.     end setGrammarSymbolCount;
  10449.     
  10450.     function setActionCount return ParserInteger is
  10451.     begin
  10452.         return  1599 ;
  10453.     end setActionCount;
  10454.     
  10455.     function setStateCountPlusOne return ParserInteger is
  10456.     begin
  10457.         return  1044 ;
  10458.     end setStateCountPlusOne;
  10459.     
  10460.     function setLeftHandSideCount return ParserInteger is
  10461.     begin
  10462.     return   553 ;
  10463.     end setLeftHandSideCount;
  10464.     
  10465.     function setRightHandSideCount return ParserInteger is
  10466.     begin
  10467.         return   553 ;
  10468.     end setRightHandSideCount;
  10469.     
  10470. end Grammar_Constants;
  10471.  
  10472. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10473. --STRUTILS.SPC
  10474. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10475.  
  10476. package STRING_UTILITIES is
  10477.  
  10478.    -----------------------------------------------------------------
  10479.    function POSITION_OF(PATTERN : CHARACTER; SOURCE : STRING)
  10480.       return NATURAL;
  10481.  
  10482.    -- Return the index position in Source of the first occurrence
  10483.    -- of the character or 0 if the pattern was not found.
  10484.  
  10485.    -----------------------------------------------------------------
  10486.    function POSITION_OF_REVERSE(PATTERN : CHARACTER; SOURCE : STRING)
  10487.       return NATURAL;
  10488.  
  10489.    -- Scan the source string in reverse for the given character, and
  10490.    -- return its index position, or 0 if it was not found.
  10491.  
  10492.    -----------------------------------------------------------------
  10493.    function POSITION_OF(PATTERN : STRING; SOURCE : STRING)
  10494.       return NATURAL;
  10495.  
  10496.    -- Return the index position of the first occurrence of the pattern
  10497.    -- string in the source string, or 0 if the pattern is not found.
  10498.  
  10499.    -----------------------------------------------------------------
  10500.    function POSITION_OF_REVERSE(PATTERN : STRING; SOURCE : STRING)
  10501.       return NATURAL;
  10502.  
  10503.    -- Scan the source string in reverse for the pattern string, and
  10504.    -- return its index position, or 0 if the pattern is not found.
  10505.  
  10506.    -----------------------------------------------------------------
  10507.    function SKIP_BLANKS(SOURCE: STRING) return NATURAL;
  10508.  
  10509.    -- Return the index of the first non-blank character in the source
  10510.    -- string, or Source'Last + 1 if there are no non-blank characters.
  10511.  
  10512.    -----------------------------------------------------------------
  10513.    function SKIP_BLANKS_REVERSE(SOURCE: STRING) return NATURAL;
  10514.  
  10515.    -- Scan the source string in reverse and return the index position 
  10516.    -- of the first non-blank character. Return Source'First - 1 if
  10517.    -- no non-blank characters are found.
  10518.  
  10519.    -----------------------------------------------------------------
  10520.    function STRIP_BLANKS(SOURCE: STRING) return STRING;
  10521.  
  10522.    -- Return a copy of the source string with all blanks removed.
  10523.  
  10524.  
  10525.    -----------------------------------------------------------------
  10526.    function STRIP_NON_LITERAL_BLANKS(SOURCE: STRING) return STRING;
  10527.  
  10528.    -- Return a copy of the source string with all blanks removed except
  10529.    -- character literal blanks and blanks in an embedded string literal.
  10530.  
  10531.    -----------------------------------------------------------------
  10532.    function UPPER_CASE(SOURCE : STRING) return STRING;
  10533.   
  10534.    -- Return an upper cased copy of the source string.
  10535.  
  10536.    -----------------------------------------------------------------
  10537.    function UPPER_CASE(SOURCE : CHARACTER) return CHARACTER;
  10538.  
  10539.    -- Return the upper case of the given character.
  10540.  
  10541.    -----------------------------------------------------------------
  10542.    function UPPER_CASE_NON_LITERALS(SOURCE : STRING) return STRING;
  10543.  
  10544.    -- Return a copy of the source string with all characters upper
  10545.    -- cased except character literals and embedded strings.
  10546.  
  10547.    -----------------------------------------------------------------
  10548.    procedure NEXT_WORD(SOURCE: STRING; 
  10549.                        WORD_START: in out NATURAL;
  10550.                        WORD_END: in out NATURAL);
  10551.  
  10552.    -- Mark the starting and ending positions of the next set of
  10553.    -- non-blank characters in the source string.  If none are found,
  10554.    -- Word_Start = Word_End + 1.
  10555.  
  10556.    -----------------------------------------------------------------
  10557.    function INTEGER_STRING(INT_VALUE : INTEGER) return STRING;
  10558.  
  10559.    -- Return the image string of the integer with no leading blanks.
  10560.  
  10561.    -----------------------------------------------------------------
  10562.    procedure FIND_EMBEDDED_STRING(SOURCE: STRING;
  10563.                                   FIRST, LAST: out NATURAL);
  10564.  
  10565.    -- Find a string literal within the source string.  First and/or
  10566.    -- Last will be 0 if the opening and/or closing delimeters are not
  10567.    -- found.  
  10568.  
  10569.    -----------------------------------------------------------------
  10570.    function STRIP_DOUBLE_DELIMITERS(SOURCE: STRING;
  10571.                                     DELIMITER: CHARACTER) return STRING;
  10572.  
  10573.    -- Return a copy of the input string, replacing any doubled
  10574.    -- delimiters by a single one.  The Delimiter parameter indicates
  10575.    -- whether the string delimter is a quote or a percent sign.
  10576.  
  10577.    -- The enclosing delimiters are NOT part of the source string.
  10578.  
  10579.    -----------------------------------------------------------------
  10580.  
  10581. end STRING_UTILITIES;
  10582. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10583. --STRUTILS.BDY
  10584. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10585.  
  10586. package body STRING_UTILITIES is
  10587.  
  10588.    --------------------------------------------------------------------
  10589.    function POSITION_OF(PATTERN : CHARACTER; SOURCE : STRING)
  10590.       return NATURAL is
  10591.        
  10592.       -- Return the position of Pattern in Source, or 0 if
  10593.       -- not found.
  10594.  
  10595.    begin
  10596.       for I in SOURCE'RANGE loop
  10597.          if SOURCE(I) = PATTERN then
  10598.             return I;
  10599.          end if;
  10600.       end loop;
  10601.       return 0;
  10602.    end POSITION_OF;
  10603.  
  10604.    --------------------------------------------------------------------
  10605.    function POSITION_OF_REVERSE(PATTERN : CHARACTER; SOURCE : STRING)
  10606.       return NATURAL is
  10607.  
  10608.       -- Scan backwards for the next occurence of Pattern in Source.
  10609.       -- Return its index position, or 0 if not found.
  10610.  
  10611.    begin
  10612.       for I in reverse SOURCE'RANGE loop
  10613.          if SOURCE(I) = PATTERN then
  10614.             return I;
  10615.          end if;
  10616.       end loop;
  10617.       return 0;
  10618.    end POSITION_OF_REVERSE;
  10619.  
  10620.    --------------------------------------------------------------------
  10621.    function POSITION_OF(PATTERN : STRING; SOURCE : STRING)
  10622.       return NATURAL is
  10623.  
  10624.       -- Return the Pattern string in the Source string, and return
  10625.       -- its starting index,  or 0 if not found.
  10626.  
  10627.    begin
  10628.       for I in SOURCE'FIRST .. SOURCE'LAST - PATTERN'LENGTH + 1 loop
  10629.          if SOURCE(I .. I + PATTERN'LENGTH - 1) = PATTERN then
  10630.             return I;
  10631.          end if;
  10632.       end loop;
  10633.       return 0;
  10634.    end POSITION_OF;
  10635.  
  10636.    --------------------------------------------------------------------
  10637.    function POSITION_OF_REVERSE(PATTERN : STRING; SOURCE : STRING)
  10638.       return NATURAL is
  10639.  
  10640.       -- Scan backward for the Pattern string in the Source string. 
  10641.       -- Return its starting index, or 0 if not found.
  10642.       
  10643.    begin
  10644.       for I in reverse SOURCE'FIRST .. SOURCE'LAST - PATTERN'LENGTH + 1 loop
  10645.          if SOURCE(I .. I + PATTERN'LENGTH - 1) = PATTERN then
  10646.             return I;
  10647.          end if;
  10648.       end loop;
  10649.       return 0;
  10650.    end POSITION_OF_REVERSE;
  10651.  
  10652.    --------------------------------------------------------------------
  10653.    function SKIP_BLANKS(SOURCE: STRING) return NATURAL is
  10654.  
  10655.       -- Return the index of the next non-blank character, or
  10656.       -- Source'Last + 1 if the string is all blanks.
  10657.  
  10658.    begin
  10659.       for I in SOURCE'RANGE loop
  10660.          if SOURCE(I) /= ' ' then
  10661.             return I;
  10662.          end if;
  10663.       end loop;
  10664.       return SOURCE'LAST + 1;
  10665.    end SKIP_BLANKS;
  10666.  
  10667.    --------------------------------------------------------------------
  10668.    function SKIP_BLANKS_REVERSE(SOURCE: STRING) return NATURAL is
  10669.  
  10670.       -- Scan the source string backwards for the next non-blank
  10671.       -- character.  Return Source'First - 1 if non are found.
  10672.  
  10673.    begin
  10674.       for I in reverse SOURCE'RANGE loop
  10675.          if SOURCE(I) /= ' ' then
  10676.             return I;
  10677.          end if;
  10678.       end loop;
  10679.       return SOURCE'FIRST - 1;
  10680.    end SKIP_BLANKS_REVERSE;
  10681.  
  10682.    --------------------------------------------------------------------
  10683.    function STRIP_BLANKS(SOURCE: STRING) return STRING is
  10684.       RESULT: STRING(1..SOURCE'LENGTH) := SOURCE;
  10685.       INDEX : NATURAL := RESULT'FIRST;
  10686.       LEN   : NATURAL := RESULT'LAST;
  10687.     begin
  10688.       while INDEX <= LEN loop
  10689.         if RESULT(INDEX) = ' ' then 
  10690.           RESULT(INDEX .. LEN - 1) := RESULT(INDEX + 1 .. LEN); 
  10691.           LEN := LEN - 1; 
  10692.         else
  10693.           INDEX := INDEX + 1; 
  10694.         end if; 
  10695.       end loop; 
  10696.       return RESULT(1..LEN);
  10697.    end STRIP_BLANKS;         
  10698.  
  10699.    --------------------------------------------------------------------
  10700.    function STRIP_NON_LITERAL_BLANKS(SOURCE: STRING) return STRING is
  10701.  
  10702.       -- Strip all blanks except character literal blanks, and blankss
  10703.       -- embedded in string literals.
  10704.  
  10705.       RESULT: STRING(1..SOURCE'LENGTH) := SOURCE;
  10706.       INDEX : NATURAL := RESULT'FIRST;
  10707.       LEN   : NATURAL := RESULT'LAST;
  10708.       J     : NATURAL;
  10709.  
  10710.     begin
  10711.        while INDEX <= LEN loop
  10712.          case RESULT(INDEX) is
  10713.             when ''' =>
  10714.                if INDEX <= LEN - 2 and then RESULT(INDEX + 2) = ''' then
  10715.                   INDEX := INDEX + 2;
  10716.                end if;
  10717.  
  10718.             when '"' | '%' =>
  10719.                FIND_EMBEDDED_STRING(RESULT(INDEX..RESULT'LAST), INDEX, J);
  10720.                if J /= 0 then
  10721.                   INDEX := J;
  10722.                end if;
  10723.  
  10724.             when ' ' =>
  10725.                RESULT(INDEX .. LEN - 1) := RESULT(INDEX + 1 .. LEN); 
  10726.                LEN := LEN - 1; 
  10727.                INDEX := INDEX - 1;
  10728.  
  10729.             when others => null;
  10730.          end case;
  10731.          INDEX := INDEX + 1; 
  10732.       end loop; 
  10733.       return RESULT(1..LEN);
  10734.    end STRIP_NON_LITERAL_BLANKS;         
  10735.  
  10736.    --------------------------------------------------------------------
  10737.    function UPPER_CASE(SOURCE : STRING) return STRING is
  10738.       RESULT : STRING(1 .. SOURCE'LENGTH) := SOURCE;
  10739.    begin
  10740.       for I in RESULT'RANGE loop
  10741.          if RESULT(I) in 'a' .. 'z' then
  10742.             RESULT(I) := CHARACTER'VAL(CHARACTER'POS(RESULT(I)) - 32);
  10743.          end if;
  10744.       end loop;
  10745.       return RESULT;
  10746.    end UPPER_CASE;
  10747.  
  10748.    --------------------------------------------------------------------
  10749.    function UPPER_CASE(SOURCE : CHARACTER) return CHARACTER is
  10750.    begin
  10751.      if SOURCE in 'a' .. 'z' then
  10752.         return CHARACTER'VAL(CHARACTER'POS(SOURCE) - 32);
  10753.      else
  10754.         return SOURCE;
  10755.      end if;
  10756.    end UPPER_CASE;
  10757.  
  10758.    --------------------------------------------------------------------
  10759.    function UPPER_CASE_NON_LITERALS(SOURCE : STRING) return STRING is
  10760.  
  10761.       -- Upper case all characters in the string except character
  10762.       -- literals and embedded string literals/
  10763.  
  10764.       RESULT : STRING(SOURCE'RANGE) := SOURCE;
  10765.       I, J   : NATURAL := SOURCE'FIRST;
  10766.    begin
  10767.       while I <= RESULT'LAST loop
  10768.          case RESULT(I) is
  10769.             when ''' =>
  10770.                if I < RESULT'LAST - 2 and then RESULT(I + 2) = ''' then
  10771.                   I := I + 2;
  10772.                end if;
  10773.  
  10774.             when '"' | '%' =>
  10775.                FIND_EMBEDDED_STRING(RESULT(I .. RESULT'LAST), I, J);
  10776.                if J /= 0 then 
  10777.                   I := J;
  10778.                end if;
  10779.  
  10780.             when 'a' .. 'z' =>
  10781.                RESULT(I) := CHARACTER'VAL(CHARACTER'POS(RESULT(I)) - 32);
  10782.   
  10783.             when others => null;
  10784.          end case;
  10785.  
  10786.          I := I + 1;
  10787.       end loop;
  10788.       return RESULT;
  10789.    end UPPER_CASE_NON_LITERALS;
  10790.  
  10791.    --------------------------------------------------------------------
  10792.    procedure NEXT_WORD(SOURCE: STRING; 
  10793.                        WORD_START: in out NATURAL;
  10794.                        WORD_END: in out NATURAL) is
  10795.  
  10796.       -- Find the starting and ending indices of the next sequence of
  10797.       -- non-blank characters in the source string.  If none are found,
  10798.       -- Word_Start will be set to Source'Last + 1, and Word_End will
  10799.       -- Source'Last.
  10800.  
  10801.    begin
  10802.       WORD_START := SKIP_BLANKS(SOURCE);
  10803.       WORD_END := POSITION_OF(' ', SOURCE(WORD_START..SOURCE'LAST));
  10804.       if WORD_END = 0 then
  10805.          WORD_END := SOURCE'LAST;
  10806.       else
  10807.          WORD_END := WORD_END - 1;
  10808.       end if;
  10809.    end NEXT_WORD;
  10810.  
  10811.    --------------------------------------------------------------------
  10812.    function INTEGER_STRING(INT_VALUE : INTEGER) return STRING is
  10813.  
  10814.      -- Return the left justified string image of the integer.
  10815.  
  10816.    begin
  10817.       if INT_VALUE < 0 then
  10818.          return INTEGER'IMAGE(INT_VALUE);
  10819.       end if;
  10820.       return INTEGER'IMAGE(INT_VALUE)(2..INTEGER'IMAGE(INT_VALUE)'LENGTH);
  10821.    end INTEGER_STRING;
  10822.  
  10823.    --------------------------------------------------------------------
  10824.    procedure FIND_EMBEDDED_STRING(SOURCE: STRING;
  10825.                                   FIRST, LAST: out NATURAL) is
  10826.  
  10827.       -- If an embedded string literal is found, First and Last will 
  10828.       -- be the index positions of the opening and closing delimiters.
  10829.       -- If both the opening and closing delimiters are not found, 
  10830.       -- First and/or Last will be 0.
  10831.  
  10832.       INDEX     : NATURAL;
  10833.       DELIMITER : CHARACTER;  
  10834.    begin
  10835.       FIRST := 0;
  10836.       LAST  := 0;
  10837.  
  10838.       INDEX := SKIP_BLANKS(SOURCE);
  10839.       if INDEX < SOURCE'LAST and then 
  10840.          (SOURCE(INDEX) = '"' or else SOURCE(INDEX) = '%') then
  10841.          DELIMITER := SOURCE(INDEX);
  10842.          FIRST := INDEX;
  10843.          INDEX := INDEX + 1;
  10844.          while INDEX <= SOURCE'LAST loop
  10845.             if SOURCE(INDEX) = DELIMITER then
  10846.                if INDEX = SOURCE'LAST or else SOURCE(INDEX+1) /= DELIMITER then
  10847.                   LAST := INDEX;
  10848.                   return;
  10849.                end if;
  10850.                INDEX := INDEX + 1;
  10851.             end if;
  10852.             INDEX := INDEX + 1;
  10853.          end loop;
  10854.       end if;
  10855.    end FIND_EMBEDDED_STRING;
  10856.  
  10857.    --------------------------------------------------------------------
  10858.    function STRIP_DOUBLE_DELIMITERS(SOURCE: STRING; 
  10859.                                     DELIMITER: CHARACTER) return STRING is
  10860.  
  10861.       -- Return a copy of the source string with any doubled
  10862.       -- delimeters replaced by single delimiters.  The source string
  10863.       -- does not include enclosing delimiters.
  10864.  
  10865.       TMP_STRING : STRING(1 .. SOURCE'LENGTH) := SOURCE;
  10866.       INDEX      : INTEGER := TMP_STRING'FIRST - 1;
  10867.       LAST       : INTEGER := TMP_STRING'LAST;
  10868.    begin
  10869.       loop
  10870.          INDEX := POSITION_OF(DELIMITER, TMP_STRING(INDEX + 1 .. LAST));
  10871.          exit when INDEX = 0;
  10872.          TMP_STRING(INDEX + 1 .. LAST - 1) := TMP_STRING(INDEX + 2 .. LAST);
  10873.          LAST := LAST - 1;
  10874.       end loop;
  10875.       return TMP_STRING(1 .. LAST);
  10876.    end STRIP_DOUBLE_DELIMITERS;
  10877.  
  10878.    --------------------------------------------------------------------
  10879.  
  10880. end STRING_UTILITIES;
  10881. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10882. --SIOINS.ADA
  10883. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10884. with DIRECT_IO;
  10885. PACKAGE STRING_IO_INSTANTIATION IS
  10886.  
  10887.   subtype FILE_STRING is STRING(1..80);
  10888.  
  10889.   package SIO is new DIRECT_IO(FILE_STRING);
  10890. end STRING_IO_INSTANTIATION;
  10891. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10892. --STRING_IO.SPC
  10893. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10894. package STRING_IO is
  10895. --| overview
  10896. --| String_io is used to write to a direct access file.  All records are
  10897. --| 80 characters.
  10898.  
  10899.   procedure OPEN(FILENAME  : in STRING);
  10900.   --| Effects 
  10901.   --| Open creates the external file Filename and opens it for direct io.
  10902.  
  10903.   procedure PUT(TEXT       : in STRING);
  10904.   --| Effects
  10905.   --| Put writes the string Text to Filename.
  10906.  
  10907.   procedure PUT_LINE(TEXT  : in STRING);
  10908.   --| Effects
  10909.   --| Put_line writes the string Text to Filename, appends blanks to fill
  10910.   --| in the line and adds a carriage return.
  10911.  
  10912.   procedure NEW_LINE(COUNT : in NATURAL := 1);
  10913.   --| Effects
  10914.   --| New_Line writes blank lines to Filename.
  10915.  
  10916.   procedure CLOSE;
  10917.   --| Effects
  10918.   --| Close closes Filename.
  10919.  
  10920. end STRING_IO;
  10921.  
  10922. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10923. --STRING_IO.BDY
  10924. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10925. with STRING_IO_INSTANTIATION; use STRING_IO_INSTANTIATION;
  10926.  
  10927. package body STRING_IO is
  10928.  
  10929.   LIST_FILE          : SIO.FILE_TYPE; --| Name of direct_io string file.
  10930.   INPUT_STRING       : FILE_STRING; --| Buffer for current output record.
  10931.   INPUT_STRING_INDEX : NATURAL := 1; --| Index for current position in buffer.
  10932.   BLANKS             : FILE_STRING := (OTHERS => ' '); --| A blank record.
  10933.   OUT_FILE           : SIO.FILE_MODE := SIO.OUT_FILE;
  10934.   FILE_OPEN          : BOOLEAN := FALSE;
  10935.  
  10936.   procedure OPEN(FILENAME : in STRING) is  
  10937.   begin
  10938.     INPUT_STRING := BLANKS; -- clear input buffer
  10939.     FILE_OPEN := TRUE;
  10940.     if SIO.IS_OPEN(LIST_FILE) then
  10941.       SIO.CLOSE(LIST_FILE);
  10942.     end if;
  10943.     SIO.OPEN(LIST_FILE, OUT_FILE, FILENAME);
  10944.     -- The file exists so delete it and create it.  This must be done for
  10945.     -- direct io, otherwise if the new file is smaller than the old file
  10946.     -- the bottom of the old file will be left at the bottom of the new file.
  10947.     SIO.DELETE(LIST_FILE);
  10948.     SIO.CREATE(LIST_FILE, OUT_FILE, FILENAME);
  10949.   exception
  10950.     when
  10951.       SIO.NAME_ERROR =>
  10952.         -- file doesn't exist
  10953.         SIO.CREATE(LIST_FILE, OUT_FILE, FILENAME);
  10954.   end OPEN;
  10955.   
  10956.   procedure PUT(TEXT : in STRING) is
  10957.   begin
  10958.     if FILE_OPEN then
  10959.       if TEXT'LENGTH > 81 - INPUT_STRING_INDEX then
  10960.         -- Text is too long to fit in buffer so write the buffer to the
  10961.         -- file and clear the buffer and reset the index.
  10962.         INPUT_STRING(INPUT_STRING_INDEX .. INPUT_STRING'LENGTH) :=
  10963.           TEXT(TEXT'FIRST .. INPUT_STRING'LENGTH - INPUT_STRING_INDEX + 1);
  10964.         INPUT_STRING_INDEX := INPUT_STRING'LENGTH + 1;
  10965.       else
  10966.         INPUT_STRING(INPUT_STRING_INDEX..INPUT_STRING_INDEX + TEXT'LENGTH - 1) 
  10967.           := TEXT;
  10968.         INPUT_STRING_INDEX := INPUT_STRING_INDEX + TEXT'LENGTH;
  10969.       end if;
  10970.     end if;
  10971.   end PUT;
  10972.  
  10973.   procedure PUT_LINE(TEXT : in STRING) is
  10974.   begin
  10975.     if FILE_OPEN then
  10976.       PUT(TEXT); -- write Text to buffer
  10977.       SIO.WRITE(LIST_FILE, INPUT_STRING);  -- write buffer to output file
  10978.       INPUT_STRING := BLANKS; -- clear buffer
  10979.       INPUT_STRING_INDEX := 1; -- reset index
  10980.     end if;
  10981.   end PUT_LINE;
  10982.  
  10983.   procedure NEW_LINE(COUNT : in NATURAL := 1) is
  10984.   begin
  10985.     if FILE_OPEN then
  10986.       if COUNT > 0 then
  10987.         -- Write the buffer to the output file, 
  10988.         -- clear the buffer and reset the index.
  10989.         SIO.WRITE(LIST_FILE, INPUT_STRING);
  10990.         INPUT_STRING := BLANKS;
  10991.         INPUT_STRING_INDEX := 1;
  10992.         for I in 1 .. COUNT - 1 loop
  10993.           SIO.WRITE(LIST_FILE, BLANKS); -- write a blank line
  10994.         end loop;
  10995.       end if;
  10996.     end if;
  10997.   end NEW_LINE;
  10998.  
  10999.   procedure CLOSE is
  11000.   begin
  11001.     if FILE_OPEN then
  11002.       if INPUT_STRING_INDEX > 1 then
  11003.         -- There is Text in the buffer so write the buffer to the output file.
  11004.         SIO.WRITE(LIST_FILE, INPUT_STRING);
  11005.       end if;
  11006.       SIO.CLOSE(LIST_FILE);
  11007.       FILE_OPEN := FALSE;
  11008.     end if;
  11009.   end CLOSE;
  11010.  
  11011. end STRING_IO;
  11012. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11013. --TYPEDEFS.ADA
  11014. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11015. with STRING_PKG; use STRING_PKG;    --| for String_Types
  11016.  
  11017. ------------------------
  11018. package SD_TYPE_DEFINITIONS is
  11019. ------------------------
  11020.  
  11021. --| Overview
  11022. --| TypeDefs contains global type declarations used by all of the Ada
  11023. --| Testing and Analysis Tools.  Its purpose is to provide consistency
  11024. --| and uniformity of type declarations for objects common to all of
  11025. --| the tools.
  11026.  
  11027. --| N/A: Errors, Raises, Modifies, Requires
  11028.  
  11029. --) Version:       2.0
  11030. --)
  11031. --) Last Modified: 05/10/85 JEE Converted all records with string lengths
  11032. --)                             as discriminants to String_Type
  11033. --)
  11034. --)                09/16/85 JEE Added LINE_NUMBER_RANGE
  11035. --)                             Added FIRST_BREAKPOINT and LAST_BREAKPOINT
  11036. --)                                   to PROGRAM_UNIT_NAME
  11037.  
  11038.   type TOOL_NAMES is ( --| The names of the Testing and Analysis Tools
  11039.   PATH_TOOL,           --| Path Analyzer
  11040.   AUTOPATH_TOOL,       --| Automatic Path Analyzer
  11041.   SMART_TOOL,          --| Self Metric Analysis and Reporting Tool
  11042.   PROFILE_TOOL,        --| Performance Analyzer
  11043.   DEBUG_TOOL           --| Symbolic Debugger
  11044.   );
  11045.  
  11046.   type LOGFILE_KEYS is ( --| A unique key for each log file record type
  11047.                          --| defines the format of each log file record
  11048.   PROGRAM, TOOL, TEST_TIME, TEST_ID,        --| Logfile configuration
  11049.   COMPILATION_UNIT_DEFINITION,              --| Unit definitions
  11050.   PROGRAM_UNIT_DEFINITION,                  --| Unit definitions
  11051.   UNIT_START, UNIT_STOP,                    --| Unit starts and stops
  11052.   LOOP_BREAKPOINT, OTHER_BREAKPOINT,        --| All other breakpoints
  11053.   AUTOPATH_CALL,                            --| AutoPath procedure call
  11054.   INTEGER_VARIABLE,                         --| Variable data types
  11055.   LONG_INTEGER_VARIABLE,                    --| Variable data types
  11056.   FLOAT_VARIABLE,
  11057.   LONG_FLOAT_VARIABLE,
  11058.   FIXED_POINT_VARIABLE,
  11059.   STRING_VARIABLE,
  11060.   DELAY_TIME,                               --| For delays of program units
  11061.   TIMING_OVERHEAD                           --| For Unit_Start and Unit_Stop
  11062.   );
  11063.  
  11064.   subtype FILENAME is STRING_TYPE;   --| filenames are string_types
  11065.  
  11066.   subtype TEST_IDENTIFIER is STRING_TYPE;
  11067.  
  11068.   subtype BREAKPOINT_TYPES is
  11069.     LOGFILE_KEYS range LOOP_BREAKPOINT .. OTHER_BREAKPOINT;
  11070.     --| The type of each breakpoint is assigned by the source instrumenter
  11071.  
  11072.  
  11073.   --| Numeric Type Definitions
  11074.  
  11075.   subtype PROGRAM_UNIT_NUMBER_RANGE is NATURAL;
  11076.   --| The source instrumenter assigns a unique number to each
  11077.   --| program unit within a compilation unit.
  11078.  
  11079.   subtype TASK_TYPE_ACTIVATION_NUMBER_RANGE is NATURAL;
  11080.   --| Each activation of a task type is assigned a unique number.
  11081.  
  11082.   subtype BREAKPOINT_NUMBER_RANGE is NATURAL;
  11083.   --| The source instrumenter assigns a unique number to each
  11084.   --| breakpoint in the compilation unit.
  11085.  
  11086.   subtype LINE_NUMBER_RANGE is NATURAL;
  11087.   --| The source instrumenter assigns a unique number to each
  11088.   --| source code line in the compilation unit.
  11089.  
  11090.   subtype COUNT_RANGE is NATURAL;
  11091.   --| A count is a non-negative number in the range 0 .. MAX_INT;
  11092.  
  11093.   type LONG_COUNT is
  11094.     record
  11095.       OVERFLOW_COUNT : COUNT_RANGE;
  11096.       CURRENT_COUNT  : COUNT_RANGE;
  11097.     end record;
  11098.     --| A Long_Count record provides a "long integer" type of count
  11099.     --| consisting of the current count and a count of the number of
  11100.     --| times the current count has overflowed.
  11101.  
  11102.  
  11103.   --| Program Unit Type definitions
  11104.  
  11105.   type PROGRAM_UNIT_TYPE is ( --| Ada program units can be
  11106.     PROCEDURE_TYPE,           --| procedures
  11107.     FUNCTION_TYPE,            --| functions
  11108.     TASK_TYPE,                --| tasks
  11109.     GENERIC_TYPE,             --| generics
  11110.     PACKAGE_TYPE              --| and packages
  11111.   );
  11112.  
  11113.   subtype ADA_NAME is STRING_TYPE;
  11114.   --| An Ada name is a string type of variable length
  11115.  
  11116.   type PROGRAM_UNIT_NAME is
  11117.     record
  11118.       UNIT_IDENTIFIER  : ADA_NAME;
  11119.       UNIT_TYPE        : PROGRAM_UNIT_TYPE;
  11120.       FIRST_BREAKPOINT : BREAKPOINT_NUMBER_RANGE := 0;
  11121.       LAST_BREAKPOINT  : BREAKPOINT_NUMBER_RANGE := 0;
  11122.     end record;
  11123.   --| A table of the names and program unit types of all of the
  11124.   --| program units contained within a compilation unit.
  11125.   --| FIRST_BREAKPOINT and LAST_BREAKPOINT define thr range of
  11126.   --| breakpoint numbers included in the program unit.
  11127.  
  11128.   type PROCEDURE_LIST is array(POSITIVE range <>) of PROGRAM_UNIT_NAME;
  11129.   --| A table of the names and program unit types of all of the
  11130.   --| program units contained within a compilation unit.
  11131.  
  11132.   type PROGRAM_UNIT_UNIQUE_IDENTIFIER is
  11133.     record
  11134.       ENCLOSING_UNIT_IDENTIFIER   : ADA_NAME;
  11135.       PROGRAM_UNIT_NUMBER         : PROGRAM_UNIT_NUMBER_RANGE := 0;
  11136.       UNIT_TYPE                   : PROGRAM_UNIT_TYPE;
  11137.       TASK_TYPE_ACTIVATION_NUMBER : TASK_TYPE_ACTIVATION_NUMBER_RANGE := 1;
  11138.     end record;
  11139.     --| A Program_Unit_Unique_Identifier record consists of the identifier
  11140.     --| of the enclosing unit, a unique number for the current program unit,
  11141.     --| and for task types, a unique activation number.
  11142.  
  11143.   subtype INPUT_PARAMETER_LIST is STRING_TYPE;
  11144.  
  11145. end SD_TYPE_DEFINITIONS;
  11146. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11147. --PREDEFIO.SPC
  11148. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11149.  
  11150. with TEXT_IO; use TEXT_IO;
  11151. with SYSDEP; use SYSDEP;
  11152. with CALENDAR;
  11153. package PREDEFINED_IO is
  11154.  
  11155.   use SYSDEP.PREDEFINED_TYPES;
  11156.  
  11157.    package SI2AFSD_1861_Integer_IO      is new Integer_IO (Integer);
  11158.    package SI2AFSD_1861_Long_Integer_IO is new Integer_IO (Long_Integer);
  11159.    package SI2AFSD_1861_Real_IO         is new Float_IO (Float);
  11160.    package SI2AFSD_1861_Long_Real_IO    is new Float_IO (Long_Float);
  11161.    package SI2AFSD_1861_TIME_IO         is new FIXED_IO(CALENDAR.DAY_DURATION);
  11162.  
  11163. end PREDEFINED_IO;
  11164. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11165. --TIMELIB1.SPC
  11166. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11167. with CALENDAR; 
  11168.  
  11169. ----------------------
  11170. package TIME_LIBRARY_1 is 
  11171. ----------------------
  11172.  
  11173. --| Overview
  11174. --| TimeLib contains procedures and functions for getting, putting,
  11175. --| and calculating times, and dates. It augments the
  11176. --| predefined library package Calendar to simplify IO and provide
  11177. --| additional time routines common to all Ada Test and Evaluation
  11178. --| Tool Set (ATETS) tools.
  11179.  
  11180. --| Requires
  11181. --| All procedures and functions that perform IO use the
  11182. --| predefined library package Text_IO and require that the
  11183. --| specified file be opened by the calling program prior to use.
  11184. --| All times and durations must be of types declared in the
  11185. --| predefined library package Calendar.
  11186.  
  11187. --| Errors
  11188. --| No error messages or exceptions are raised by any of the TimeLib
  11189. --| procedures and functions. However, any Text_IO and Calendar
  11190. --| exceptions that may be raised are allowed to pass, unhandled,
  11191. --| back to the calling program.
  11192.  
  11193. --| N/A:  Raises, Modifies
  11194.  
  11195. --  Version         : 1.0
  11196. --  Author          : Jeff England
  11197. --  Initial Release : 05/19/85
  11198. --  Last Modified   : 05/19/85
  11199.  
  11200.  
  11201.  
  11202.   ----------------
  11203.   function DATE_OF(--| Convert the date to a string
  11204.  
  11205.     DATE : in CALENDAR.TIME  --| The date to be converted
  11206.  
  11207.     ) return STRING; 
  11208.  
  11209.   --| Effects
  11210.   --| Converts the date to a string in the format MM/DD/YYYY
  11211.  
  11212.   --| N/A:  Raises, Requires, Modifies, Errors
  11213.  
  11214.  
  11215.   ----------------------
  11216.   function WALL_CLOCK_OF(--| Convert seconds to wall clock time
  11217.  
  11218.     SECONDS : in CALENDAR.DAY_DURATION  --| The time to be converted
  11219.  
  11220.     ) return STRING; 
  11221.  
  11222.   --| Effects
  11223.   --| Converts the time of day or elapsed time, in seconds,
  11224.   --| to a string in the format HH:MM:SS.FF.
  11225.  
  11226.   --| N/A:  Raises, Requires, Modifies, Errors
  11227.  
  11228.  
  11229. end TIME_LIBRARY_1; 
  11230. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11231. --TIMELIB1.BDY
  11232. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11233. with CALENDAR, PREDEFINED_IO; 
  11234.  
  11235. ---------------------------
  11236. package body TIME_LIBRARY_1 is 
  11237. ---------------------------
  11238.  
  11239. --| Overview
  11240. --| TimeLib contains procedures and functions for getting, putting,
  11241. --| and calculating times, and dates. It augments the
  11242. --| predefined library package Calendar to simplify IO and provide
  11243. --| additional time routines common to all Ada Test and Evaluation
  11244. --| Tool Set (ATETS) tools.
  11245.  
  11246. --| Requires
  11247. --| All procedures and functions that perform IO use the
  11248. --| predefined library package Text_IO and require that the
  11249. --| specified file be opened by the calling program prior to use.
  11250. --| All times and durations must be of types declared in the
  11251. --| predefined library package Calendar.
  11252.  
  11253. --| Errors
  11254. --| No error messages or exceptions are raised by any of the TimeLib
  11255. --| procedures and functions. However, any Text_IO and Calendar
  11256. --| exceptions that may be raised are allowed to pass, unhandled,
  11257. --| back to the calling program.
  11258.  
  11259. --| N/A:  Raises, Modifies
  11260.  
  11261. --  Version         : 1.1
  11262. --  Author          : Jeff England
  11263. --  Initial Release : 05/19/85
  11264. --  Last Modified   : 06/07/85
  11265.  
  11266.   TIME_STRING   : STRING(1..10);
  11267.  
  11268.   ----------------
  11269.   function CONVERT( --| Convert an integer to a string
  11270.  
  11271.     INPUT_NUMBER : in INTEGER; 
  11272.  
  11273.     WIDTH        : in INTEGER := 0
  11274.  
  11275.     ) return STRING is 
  11276.  
  11277.     --| Effects:
  11278.     --| Converts an integer to a string of length Width. If the
  11279.     --| number if digits in Input_Number is less than Width then
  11280.     --| the digits are right justified in the output string and
  11281.     --| filled with zeros (0) on the left.
  11282.  
  11283.     TEMP_TEXT : STRING(1 .. 16); 
  11284.     INDEX     : INTEGER; 
  11285.  
  11286.  
  11287.   begin
  11288.  
  11289.     PREDEFINED_IO.SI2AFSD_1861_INTEGER_IO.PUT(TEMP_TEXT, INPUT_NUMBER); 
  11290.     if WIDTH <= 0 then 
  11291.       INDEX := TEMP_TEXT'LAST; 
  11292.       for I in TEMP_TEXT'range loop
  11293.         if TEMP_TEXT(I) /= ' ' then 
  11294.           INDEX := I; 
  11295.           exit; 
  11296.         end if; 
  11297.       end loop; 
  11298.     else 
  11299.       INDEX := TEMP_TEXT'LAST - WIDTH + 1; 
  11300.       for I in INDEX .. TEMP_TEXT'LAST loop
  11301.         if TEMP_TEXT(I) = ' ' then 
  11302.           TEMP_TEXT(I) := '0'; 
  11303.         end if; 
  11304.       end loop; 
  11305.     end if; 
  11306.     return TEMP_TEXT(INDEX .. TEMP_TEXT'LAST); 
  11307.  
  11308.   end CONVERT; 
  11309.  
  11310.  
  11311.   -----------------
  11312.   function FRACTION( --| returns the fraction portion of the time in seconds
  11313.  
  11314.     SECONDS : in CALENDAR.DAY_DURATION
  11315.  
  11316.     ) return STRING is 
  11317.  
  11318.     TEMP_SECS : STRING(1 .. 10); 
  11319.  
  11320.   begin
  11321.     PREDEFINED_IO.SI2AFSD_1861_TIME_IO.PUT(TEMP_SECS, SECONDS, 2, 0); 
  11322.     return TEMP_SECS(TEMP_SECS'LAST - 2 .. TEMP_SECS'LAST); 
  11323.   end FRACTION; 
  11324.  
  11325.  
  11326.   ----------------
  11327.   function DATE_OF(--| Convert the date to a string
  11328.  
  11329.     DATE : in CALENDAR.TIME  --| The date to be converted
  11330.  
  11331.     ) return STRING is 
  11332.  
  11333.     --| Effects
  11334.     --| Converts the date to a string in the format MM/DD/YY
  11335.  
  11336.     --| N/A:  Raises, Requires, Modifies, Errors
  11337.  
  11338.     YEAR    : CALENDAR.YEAR_NUMBER; 
  11339.     MONTH   : CALENDAR.MONTH_NUMBER; 
  11340.     DAY     : CALENDAR.DAY_NUMBER; 
  11341.     SECONDS : CALENDAR.DAY_DURATION; 
  11342.  
  11343.   begin
  11344.  
  11345.     CALENDAR.SPLIT(DATE, YEAR, MONTH, DAY, SECONDS); 
  11346.     return CONVERT(INTEGER(MONTH), 2) & "/" &
  11347.            CONVERT(INTEGER(DAY),   2) & "/" & 
  11348.            CONVERT(INTEGER(YEAR mod 100), 2); 
  11349.  
  11350.   end DATE_OF; 
  11351.  
  11352.  
  11353.  
  11354.   ----------------------
  11355.   function WALL_CLOCK_OF(--| Convert seconds to wall clock time
  11356.  
  11357.     SECONDS : in CALENDAR.DAY_DURATION  --| The time to be converted
  11358.  
  11359.     ) return STRING is 
  11360.  
  11361.     --| Effects
  11362.     --| Converts the time of day or elapsed time, in seconds,
  11363.     --| to a string in the format HH:MM:SS.FF.
  11364.  
  11365.     --| N/A:  Raises, Requires, Modifies, Errors
  11366.  
  11367.     use CALENDAR;  -- For "-" of times and durations
  11368.  
  11369.     HALF_SECOND : DAY_DURATION := 0.5; 
  11370.  
  11371.   begin
  11372.  
  11373.     if SECONDS < HALF_SECOND then 
  11374.       HALF_SECOND := 0.0; 
  11375.     end if; 
  11376.  
  11377.     return CONVERT( INTEGER(SECONDS - HALF_SECOND)/3600, 2)         & ":" & 
  11378.            CONVERT((INTEGER(SECONDS - HALF_SECOND) mod 3600)/60, 2) & ":" & 
  11379.            CONVERT( INTEGER(SECONDS - HALF_SECOND) mod 60, 2)       & 
  11380.            FRACTION(SECONDS); 
  11381.  
  11382.   end WALL_CLOCK_OF; 
  11383.  
  11384.  
  11385. end TIME_LIBRARY_1; 
  11386. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11387. --WD_HELP.SPC
  11388. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11389. ---------------
  11390. package WD_HELP is
  11391. ---------------
  11392.  
  11393. --| Overview
  11394. --| Provides on-line help for the Ada Symbolic Debugger.
  11395. --| Text displayed by the procedure HELP is extracted from
  11396. --| the specified HELP_FILE_NAME.
  11397.  
  11398. --------------
  11399. procedure HELP ( -- Provides on-line help for Symbolic Debugger
  11400.                  -- commands and features
  11401.  
  11402.   HELP_FILE_NAME : in STRING; --| The name of the HELP file
  11403.  
  11404.   COMMAND_STRING : in STRING  --| The user's input command
  11405.  
  11406.   );
  11407.  
  11408. --| Effects
  11409. --| Extracts the user specified topic from COMMAND_STRING. If
  11410. --| no topic is specified then a menu of all available topics
  11411. --| is displayed.  If an ambiguous topic is specified then a
  11412. --| list of possible topics matching the ambiguous request is
  11413. --| listed the user's console along with the minimum acceptable
  11414. --| abbreviation for each topic.
  11415. --|
  11416. --| If a topic is specified and it is not ambiguous then information
  11417. --| about the topic is extracted from the specified HELP_FILE_NAME
  11418. --| and displayed at the user's console.
  11419.  
  11420.  
  11421. end WD_HELP;
  11422. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11423. --WD_HELP.BDY
  11424. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11425. with TEXT_IO;    use TEXT_IO;
  11426. with STRING_PKG; use STRING_PKG;
  11427.  
  11428. --------------------
  11429. package body WD_HELP is
  11430. --------------------
  11431.  
  11432. --| Overview
  11433. --| Provides on-line help for the Ada Symbolic Debugger.
  11434. --| Text displayed by the procedure HELP is extracted from
  11435. --| the specified HELP_FILE_NAME.
  11436.  
  11437.  
  11438.   HELP_FILE            : TEXT_IO.FILE_TYPE;
  11439.   FILE_IS_OPEN         : BOOLEAN := FALSE;
  11440.   COMMAND              : STRING_PKG.STRING_TYPE;
  11441.   HELP_LINE            : STRING_PKG.STRING_TYPE;
  11442.   CURRENT_TOPIC        : STRING_PKG.STRING_TYPE;
  11443.   MINIMUM_ABBREVIATION : STRING_PKG.STRING_TYPE;
  11444.   KEYBOARD_MACRO       : STRING_PKG.STRING_TYPE;
  11445.   LINE                 : STRING(1..80);
  11446.   LAST_CHAR            : NATURAL;
  11447.   TOPIC_DEFINITION     : POSITIVE;
  11448.  
  11449.  
  11450.   --------------------
  11451.   function FILE_EXISTS(  --| Returns TRUE if file exists, otherwise FALSE
  11452.  
  11453.     FILE_NAME : STRING   --| The name of the file to be tested
  11454.  
  11455.     ) return BOOLEAN is
  11456.  
  11457.   --| Effects
  11458.   --| Attempts to open the file HELP_FILE using TEXT_IO.OPEN.
  11459.   --| If no exception is raised then the file is closed and the
  11460.   --| function returns TRUE. If a TEXT_IO.NAME_ERROR is raised
  11461.   --| the exception is handled and the function returns FALSE.
  11462.  
  11463.   --| N/A: Raises, Requires, Modifies, Errors
  11464.  
  11465.   begin
  11466.  
  11467.     OPEN(HELP_FILE, IN_FILE, FILE_NAME );
  11468.     -- If NAME_ERROR exception was not raised then the file exists
  11469.     CLOSE(HELP_FILE);
  11470.     return TRUE;
  11471.  
  11472.   exception
  11473.     when TEXT_IO.NAME_ERROR =>
  11474.       -- The file does not exist
  11475.       return FALSE;
  11476.  
  11477.   end FILE_EXISTS;
  11478.  
  11479.  
  11480.   --------------
  11481.   function STRIP( --| Strips the command string of all but the topic
  11482.  
  11483.     WHOLE_STRING : in STRING
  11484.  
  11485.     ) return STRING_TYPE is
  11486.  
  11487.   --| Strips the command string passed by the user of all but the
  11488.   --| topic. If no topic was specified then a null string_type is
  11489.   --| returned.
  11490.  
  11491.     NEW_STRING : STRING_PKG.STRING_TYPE := CREATE("");
  11492.     OLD_STRING : STRING_PKG.STRING_TYPE;
  11493.     HELP_COMMAND : constant STRING := "HELP";
  11494.  
  11495.   begin
  11496.  
  11497.     -- Make the old string a STRING_TYPE
  11498.     OLD_STRING := UPPER( CREATE(WHOLE_STRING) );
  11499.  
  11500.     -- Strip any leading blanks
  11501.     for I in 1..LENGTH(OLD_STRING) loop
  11502.       if FETCH(OLD_STRING, I) /= ' ' then
  11503.         OLD_STRING := SUBSTR(OLD_STRING, I, LENGTH(OLD_STRING) - I + 1 );
  11504.         exit;
  11505.       end if;
  11506.     end loop;
  11507.  
  11508.     -- Remove the HELP command
  11509.     for I in 1..4 loop
  11510.       if LENGTH(OLD_STRING) > 0 then
  11511.         if FETCH(OLD_STRING, 1) = HELP_COMMAND(I) then
  11512.           OLD_STRING := SUBSTR(OLD_STRING, 2, LENGTH(OLD_STRING) - 1 );
  11513.         else
  11514.           exit;  -- No match
  11515.         end if;
  11516.       else
  11517.         exit;    -- No more characters
  11518.       end if;
  11519.     end loop;
  11520.  
  11521.     -- Strip embedded blanks, parens, and semicolons
  11522.     for I in 1..LENGTH(OLD_STRING) loop
  11523.       if FETCH(OLD_STRING,I) /= ' ' and FETCH(OLD_STRING,I) /= '(' and
  11524.          FETCH(OLD_STRING,I) /= ')' and FETCH(OLD_STRING,I) /= ';' then
  11525.         NEW_STRING := NEW_STRING & SUBSTR(OLD_STRING, I, 1);
  11526.       end if;
  11527.     end loop;
  11528.  
  11529.     return NEW_STRING;
  11530.  
  11531.   end STRIP;
  11532.  
  11533.  
  11534.   ------------------------
  11535.   procedure GET_NEXT_TOPIC is --| Separate the HELP_LINE into topic,
  11536.                               --| abbreviation, macro, and definition
  11537.  
  11538.   --| Effects
  11539.   --| Separates the current HELP_LINE into topic, minimum
  11540.   --| abbreviation, keyboard macro, and definition.
  11541.  
  11542.   --| Modifies CURRENT_TOPIC, MINIMUM_ABBREVIATION, KEYBOARD_MACRO,
  11543.   --| and TOPIC_DEFINITION
  11544.  
  11545.   --| N/A: Raises, Requires, Errors
  11546.  
  11547.     START : POSITIVE;
  11548.  
  11549.   begin
  11550.  
  11551.     -- Get the topic. It begins in column 2 and is terminated by a "\"
  11552.     for CH_POS in 2 .. LENGTH(HELP_LINE) loop
  11553.       if FETCH(HELP_LINE, CH_POS) = '\' then
  11554.         CURRENT_TOPIC := SUBSTR(HELP_LINE, 2, CH_POS - 2);
  11555.         START := CH_POS + 1;
  11556.         exit;
  11557.       end if;
  11558.     end loop;
  11559.  
  11560.     -- Get the minimum abbreviation. It begins in character position
  11561.     -- START and is terminated by a "\"
  11562.     for CH_POS in START + 1 .. LENGTH(HELP_LINE) loop
  11563.       if FETCH(HELP_LINE, CH_POS) = '\' then
  11564.         MINIMUM_ABBREVIATION := SUBSTR(HELP_LINE, START, CH_POS - START);
  11565.         START := CH_POS + 1;
  11566.         exit;
  11567.       end if;
  11568.     end loop;
  11569.  
  11570.     -- Get keyboard macro and topic definition. The keyboard macro
  11571.     -- begins in character position START and is terminated by a "\".
  11572.     for CH_POS in START + 1 .. LENGTH(HELP_LINE) loop
  11573.       if FETCH(HELP_LINE, CH_POS) = '\' then
  11574.         KEYBOARD_MACRO := SUBSTR(HELP_LINE, START, CH_POS - START);
  11575.         -- Set up starting character position of the topic definition
  11576.         TOPIC_DEFINITION := CH_POS + 1;
  11577.         exit;
  11578.       end if;
  11579.     end loop;
  11580.  
  11581.   end GET_NEXT_TOPIC;
  11582.  
  11583.  
  11584.   -------------------------------
  11585.   procedure SHOW_AMBIGUOUS_TOPICS is
  11586.  
  11587.   --| Effects
  11588.   --| Displays all HELP topics and their minimum abbreviations
  11589.   --| that match the ambiguous user specified topic.
  11590.  
  11591.   --| Errors
  11592.   --| Issues the error message "The topic XXX is ambiguous"
  11593.   --| where XXX is the ambiguous user specified topic.
  11594.  
  11595.   --| N/A: Raises, Modifies, Errors
  11596.  
  11597.     TOPIC_LINE : STRING_PKG.STRING_TYPE;
  11598.  
  11599.   begin
  11600.  
  11601.     PUT_LINE("The topic " & VALUE(COMMAND) & " is ambiguous. " &
  11602.              "Possiblities are:");
  11603.  
  11604.     -- Loop until all topics that match the ambiguous request
  11605.     -- have been displayed
  11606.     while not END_OF_FILE(HELP_FILE) loop
  11607.  
  11608.       -- Display the current command and its minimum abbreviation
  11609.       TOPIC_LINE := "  Topic: " & CURRENT_TOPIC;
  11610.       -- Align abbreviations in column 25
  11611.       for I in LENGTH(TOPIC_LINE)..25 loop
  11612.         TOPIC_LINE := TOPIC_LINE & " ";
  11613.       end LOOP;
  11614.       PUT_LINE( VALUE(TOPIC_LINE)  & "  Abbreviation: " &
  11615.                 VALUE(MINIMUM_ABBREVIATION) );
  11616.  
  11617.       -- Find the next topic
  11618.       while not END_OF_FILE(HELP_FILE) loop
  11619.         GET_LINE(HELP_FILE, LINE, LAST_CHAR);
  11620.         exit when LINE(1) = '\' or LINE(1) = '$';
  11621.       end loop;
  11622.  
  11623.       if LINE(1) = '\' or LINE(1) = '$' then
  11624.         -- This is a new topic
  11625.         if LAST_CHAR >= LENGTH(COMMAND) + 1 then
  11626.           -- Check to see if this is a match
  11627.           HELP_LINE := CREATE(LINE(1..LAST_CHAR));
  11628.           if VALUE(SUBSTR(HELP_LINE, 2, LENGTH(COMMAND))) > VALUE(COMMAND)
  11629.           then
  11630.             -- The topic is alphabetically greater than
  11631.             -- the ambiguous command. Must be done.
  11632.             exit;
  11633.           else
  11634.             -- Separate HELP_LINE into CURRENT_TOPIC,
  11635.             -- MINIMUM_ABBREVIATION, KEYBOARD_MACRO,
  11636.             -- and TOPIC_DEFINITION
  11637.             GET_NEXT_TOPIC;
  11638.           end if;
  11639.         end if;
  11640.       end if;
  11641.     end loop;
  11642.     PUT_LINE("Enter ""HELP(topic);"" for more information");
  11643.   end SHOW_AMBIGUOUS_TOPICS;
  11644.  
  11645.  
  11646.   --------------------
  11647.   procedure SHOW_TOPIC is
  11648.  
  11649.   --| Displays information about the current topic at the user's
  11650.   --| console. Information about the HELP topic is extracted
  11651.   --| from the specified HELP_FILE_NAME.
  11652.  
  11653.     QUESTION : STRING_PKG.STRING_TYPE;
  11654.     ANSWER   : STRING(1..20);
  11655.     QUERY    : BOOLEAN;
  11656.     CHARS    : NATURAL;
  11657.  
  11658.   begin
  11659.  
  11660.     -- Display the current topic
  11661.     if LINE(1) = '\' then
  11662.       -- The topic is a UICL command
  11663.       PUT_LINE("Command: " & VALUE(CURRENT_TOPIC) & " - " &
  11664.                VALUE( SUBSTR(HELP_LINE, TOPIC_DEFINITION,
  11665.                              LENGTH(HELP_LINE) - TOPIC_DEFINITION + 1) ) );
  11666.       PUT_LINE("Abbreviation:   " & VALUE(MINIMUM_ABBREVIATION) );
  11667.       -- If the command has a keyboard macro then print it
  11668.       if not EQUAL( UPPER(KEYBOARD_MACRO), "NONE") then
  11669.         PUT_LINE("Keyboard Macro: " & VALUE(KEYBOARD_MACRO) );
  11670.       end if;
  11671.     else
  11672.       -- The topic is a "feature". No abbreviation or keyboard macro
  11673.       PUT_LINE( VALUE(SUBSTR(HELP_LINE, TOPIC_DEFINITION,
  11674.                       LENGTH(HELP_LINE) - TOPIC_DEFINITION + 1) ) );
  11675.     end if;
  11676.  
  11677.     while not END_OF_FILE(HELP_FILE) loop
  11678.       -- Display remaining info about this topic
  11679.       GET_LINE(HELP_FILE, LINE, LAST_CHAR);
  11680.       if LAST_CHAR > 0 then
  11681.  
  11682.         case LINE(1) is
  11683.  
  11684.           when '?' =>
  11685.             -- Pause and query the user
  11686.             QUERY := TRUE;
  11687.             QUESTION := CREATE("Enter RETURN for more information " &
  11688.                                "or ""Q"" to quit: ");
  11689.           when 'E' =>
  11690.             -- Example. Pause and query the user
  11691.             QUERY := TRUE;
  11692.             QUESTION := CREATE("Enter RETURN for examples " &
  11693.                                "or ""Q"" to quit: ");
  11694.           when '+' =>
  11695.             QUERY := FALSE;  -- Continue with no query
  11696.  
  11697.           when others =>
  11698.             exit;            -- Done with this topic
  11699.  
  11700.         end case;
  11701.  
  11702.         if QUERY then
  11703.           NEW_LINE;                          -- Skip 1 line
  11704.           PUT( VALUE(QUESTION)  & ">> ");   -- Ask if he wants to continue
  11705.           GET_LINE(ANSWER, CHARS);           -- Get user's response
  11706.           if CHARS >0 then                   -- There was an answer
  11707.             if ANSWER(1) = 'Q' or ANSWER(1) = 'q' then
  11708.               -- The user wants to quit
  11709.               exit;
  11710.             end if;
  11711.           end if;
  11712.         end if;
  11713.  
  11714.         -- Display the current line except for the control
  11715.         -- character in column 1
  11716.         if LAST_CHAR > 1 then
  11717.           PUT_LINE( LINE(2..LAST_CHAR) );
  11718.         else
  11719.           NEW_LINE;
  11720.         end if;
  11721.  
  11722.       end if;
  11723.  
  11724.     end loop;
  11725.  
  11726.   end SHOW_TOPIC;
  11727.  
  11728.  
  11729.   --------------
  11730.   procedure HELP ( --| Provides on-line help for Symbolic Debugger
  11731.                    --| commands and features
  11732.  
  11733.     HELP_FILE_NAME : in STRING; --| The name of the HELP file
  11734.  
  11735.     COMMAND_STRING : in STRING  --| The user's input command
  11736.  
  11737.     ) is
  11738.  
  11739.   --| Effects
  11740.   --| Extracts the user specified topic from COMMAND_STRING. If
  11741.   --| no topic is specified then a menu of all available topics
  11742.   --| is displayed.  If an ambiguous topic is specified then a
  11743.   --| list of possible topics matching the ambiguous request is
  11744.   --| listed the user's console along with the minimum acceptable
  11745.   --| abbreviation for each topic.
  11746.   --|
  11747.   --| If a topic is specified and it is not ambiguous then information
  11748.   --| about the topic is extracted from the specified HELP_FILE_NAME
  11749.   --| displayed at the user's console.
  11750.  
  11751.     FOUND : BOOLEAN := FALSE;
  11752.  
  11753.   begin
  11754.  
  11755.     STRING_PKG.MARK;
  11756.  
  11757.     if not FILE_IS_OPEN then
  11758.       if FILE_EXISTS(HELP_FILE_NAME) then
  11759.         -- The file exists but is not open yet. Open it.
  11760.         OPEN(HELP_FILE, IN_FILE, HELP_FILE_NAME);
  11761.         FILE_IS_OPEN := TRUE;
  11762.       else
  11763.         -- Help file is not found
  11764.         PUT_LINE("File " & HELP_FILE_NAME & " not found. " &
  11765.                  "No help available.");
  11766.         FOUND := TRUE;  -- Suppress "Topic not found" message
  11767.       end if;
  11768.     else
  11769.       -- The file is already open. Reset to beginning of file.
  11770.       RESET(HELP_FILE);
  11771.     end if;
  11772.  
  11773.     COMMAND := STRIP(COMMAND_STRING);
  11774.  
  11775.     if FILE_IS_OPEN and VALUE(COMMAND) = "" then
  11776.       -- HELP was entered with no argument. Display a menu of topics.
  11777.       PUT_LINE("Topics available are:");
  11778.     end if;
  11779.  
  11780.     -- Find the command in the help file
  11781.     while FILE_IS_OPEN loop
  11782.       exit when END_OF_FILE(HELP_FILE);
  11783.       -- Get the next line of text from the HELP file
  11784.       GET_LINE(HELP_FILE, LINE, LAST_CHAR);
  11785.       if VALUE(COMMAND) = "" then
  11786.         -- HELP command was entered with no arguments
  11787.         -- Display a menu of topics available
  11788.         if LINE(1) = '#' then
  11789.           -- # indicates a menu item line. Display it
  11790.           PUT_LINE("  " & LINE(2..LAST_CHAR) );
  11791.         else
  11792.           -- No more menu item lines
  11793.           PUT_LINE("Enter ""HELP(topic);"" for more information");
  11794.           FOUND := TRUE;
  11795.           exit;
  11796.         end if;
  11797.       elsif LINE(1) = '\' or LINE(1) = '$' then
  11798.         -- This is a new topic
  11799.         if LAST_CHAR >= LENGTH(COMMAND) + 1 then
  11800.           -- Check to see if this is a match
  11801.           HELP_LINE := CREATE(LINE(1..LAST_CHAR));
  11802.           if EQUAL(COMMAND, SUBSTR(HELP_LINE, 2, LENGTH(COMMAND))) then
  11803.             -- Found a match
  11804.             -- Check to see if the command is a unique abbreviation
  11805.             FOUND := TRUE;
  11806.             -- Separate HELP_LINE into CURRENT_TOPIC, MINIMUM_ABBREVIATION,
  11807.             -- KEYBOARD_MACRO, and TOPIC_DEFINITION
  11808.             GET_NEXT_TOPIC;
  11809.             if LENGTH(COMMAND) >= LENGTH(MINIMUM_ABBREVIATION) then
  11810.               -- It's a valid abbreviation
  11811.               SHOW_TOPIC;
  11812.               exit;
  11813.             else
  11814.               -- Ambiguous abbreviation. Show all commands
  11815.               -- that match the current abbreviation
  11816.               SHOW_AMBIGUOUS_TOPICS;
  11817.               exit;
  11818.             end if;
  11819.           elsif VALUE(SUBSTR(HELP_LINE, 2, LENGTH(COMMAND))) > VALUE(COMMAND)
  11820.           then
  11821.             -- The topic is alphabetically greater
  11822.             -- than the command. Must be done.
  11823.             exit;
  11824.           end if;
  11825.         end if;
  11826.       elsif VALUE(COMMAND) = "" then
  11827.         -- HELP command was entered with no arguments
  11828.         -- Display a menu of topics available
  11829.         if LINE(1) = '#' then
  11830.           -- # indicates a menu item line. Display it
  11831.           PUT_LINE("  " & LINE(2..LAST_CHAR) );
  11832.         else
  11833.           -- No more menu item lines
  11834.           PUT_LINE("Enter ""HELP(topic);"" for more information");
  11835.           FOUND := TRUE;
  11836.           exit;
  11837.         end if;
  11838.       end if;
  11839.     end loop;
  11840.  
  11841.     if not FOUND then
  11842.       PUT("The topic " & VALUE(COMMAND) & " is not found. ");
  11843.       HELP(HELP_FILE_NAME, "HELP");
  11844.     end if;
  11845.  
  11846.     STRING_PKG.RELEASE;
  11847.  
  11848.   end HELP;
  11849.  
  11850. end WD_HELP;
  11851. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11852. --SIDECLS.DAT
  11853. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11854. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  11855. with PARSETABLES; 
  11856. with TEXT_IO; 
  11857. with LISTS; 
  11858. with STRING_PKG; use STRING_PKG; 
  11859. with STACK_PKG; 
  11860. with PARSERDECLARATIONS; 
  11861.  
  11862. package SOURCE_INSTRUMENTER_DECLARATIONS is 
  11863. --| Declarations for Source Instrumenter tool
  11864.  
  11865. --| Overview
  11866.  
  11867. --| This package contains declarations for the Source Instrumenter.
  11868.  
  11869. --| Notes
  11870.  
  11871. --| Abbreviations Used:
  11872. --|
  11873. --| RH: Right Hand
  11874.  
  11875.   package PD renames PARSERDECLARATIONS; 
  11876.  
  11877.   subtype SOURCE_LINE_BUFFER is STRING(1 .. MAX_SOURCE_LINE_LENGTH); 
  11878.   BLANK_LINE        : constant SOURCE_LINE_BUFFER := (others => ' '); 
  11879.  
  11880.   ----------------------------------------------------------------
  11881.   --  File Declarations
  11882.   ----------------------------------------------------------------
  11883.  
  11884.   INSTRUMENTED_FILE : TEXT_IO.FILE_TYPE; 
  11885.   --| File handle to pass to Paginated Output routines for
  11886.   --| Instrumented source
  11887.  
  11888.   LISTING_FILE      : TEXT_IO.FILE_TYPE; 
  11889.   --| File handle for listing file
  11890.  
  11891.   SD_LIST_FILE      : TEXT_IO.FILE_TYPE; 
  11892.   --| File type for debugger listing
  11893.  
  11894.   -----------------------------------------------------------------
  11895.   --    Declarations used by source_instrumenter
  11896.   -----------------------------------------------------------------
  11897.  
  11898.   CURRENT_LINE_NUMBER : NATURAL; 
  11899.  
  11900.   package STRING_LISTS is 
  11901.     new LISTS(STRING_PKG.STRING_TYPE); 
  11902.  
  11903.   package TOKEN_STACK_PKG is 
  11904.     new STACK_PKG(PD.PARSESTACKELEMENT); 
  11905.  
  11906.   type REQUEST_DESCRIPTOR is 
  11907.     record
  11908.       NEW_LINES : NATURAL := 0; 
  11909.       --| Number of times New_Line was called before printing new lines.
  11910.       INCREASES : NATURAL := 0; 
  11911.       --| Number of times Increase_Indent was called before processing
  11912.       --| any of these requests.
  11913.       DECREASES : NATURAL := 0; 
  11914.       --| Number of times Decrease_Indent was called before processing
  11915.       --| any of these requests.
  11916.       CHANGES   : NATURAL := 0; 
  11917.       --| Number of times Change_Indent was called before processing
  11918.       --| any of these requests.
  11919.       RESUMES   : NATURAL := 0; 
  11920.       --| Number of times Resume_Normal_Indentation was called before 
  11921.       --| processing any of these requests
  11922.     end record; 
  11923.  
  11924.   package COMMENT_LISTS is 
  11925.     new LISTS(PD.PARSESTACKELEMENT); 
  11926.  
  11927.   type TOKEN_DESCRIPTOR is 
  11928.     record
  11929.       TOKEN                 : PD.PARSESTACKELEMENT; 
  11930.       COMMENTS              : COMMENT_LISTS.LIST; 
  11931.       REQUESTS              : REQUEST_DESCRIPTOR; 
  11932.       CURRENT_CHANGE_COLUMN : INDENTATION_RANGE := 0; 
  11933.       -- for lining up parameter/discriminant lists
  11934.       LEFT_SIDE_LENGTH      : NATURAL := 0;  -- for lining up colons
  11935.     end record; 
  11936.  
  11937.   package TOKEN_LISTS is 
  11938.     new LISTS(TOKEN_DESCRIPTOR); 
  11939.  
  11940.   type SCOPE_TYPE is (PACKAGE_SPECIFICATION, PACKAGE_BODY, TASK_BODY, 
  11941.     SUBPROGRAM_BODY, A_BLOCK, ACCEPT_STATEMENT); 
  11942.  
  11943.   type TYPE_CLASS is (INTEGER_TYPE, FLOAT_TYPE, FIXED_TYPE, ENUMERATION_TYPE, 
  11944.     ACCESS_TYPE, ARRAY_TYPE, RECORD_TYPE, PRIVATE_TYPE, LIMITED_PRIVATE_TYPE, 
  11945.     TASK_TYPE, DERIVED_TYPE); 
  11946.  
  11947.  
  11948.   type IDENTIFIER_MODE is (READ_ONLY, WRITE_ONLY, READ_WRITE, CONST, NONE); 
  11949.  
  11950.   type NAME_RECORD is 
  11951.   --| for each identifier in an identifier list, save its name
  11952.   --| and its mode.
  11953.     record
  11954.       OBJECT_NAME : STRING_TYPE; 
  11955.       OBJECT_MODE : IDENTIFIER_MODE; 
  11956.       OBJECT_TYPE : STRING_TYPE; 
  11957.     end record; 
  11958.  
  11959.   package NAME_LISTS is 
  11960.     new LISTS(NAME_RECORD); 
  11961.     --| A list of name records for collecting identifier lists.
  11962.  
  11963.   type REC_FIELD_RECORD is 
  11964.   --| for each record type save its identifier list, and its case
  11965.   --| choices.
  11966.     record
  11967.       CHOICE_TEXT : STRING_LISTS.LIST; 
  11968.       REC_FIELD   : STRING_LISTS.LIST; 
  11969.     end record; 
  11970.  
  11971.   package RECORD_LISTS is 
  11972.     new LISTS(REC_FIELD_RECORD); 
  11973.     --| A list of rec_field_records for collecting record information.
  11974.  
  11975.   package LIST_STACK_PKG is 
  11976.     new STACK_PKG(NAME_LISTS.LIST); 
  11977.     --| A stack of lists of Name_Records.
  11978.  
  11979.   package STRING_STACK_PKG is 
  11980.     new STACK_PKG(STRING_LISTS.LIST); 
  11981.     --| A stack of lists of String_Type.
  11982.  
  11983.   type SPACING is (AFTER, BEFORE, AROUND, NONE); 
  11984.  
  11985.     Spacing_Table : Array(1 .. ParseTables.Comment_TokenValue) of Spacing := (
  11986.     -- unfortunately, type of ParseTables.xxxTokenValue has non-static bound,
  11987.     -- so positional rather than named associations must be used to initialize
  11988.     -- Spacing_Table.
  11989.  
  11990.     -- The spacing table determines, in general, how to space each token.
  11991.     -- However, the spacing of some tokens is context dependent, and so
  11992.     -- some of the spacing is dynamically handled in other places.  
  11993.     -- Spaced_Token refers to Pretty_Printer_Utilities.Spaced_Token.
  11994.     -- The special cases are described below.
  11995.  
  11996.      -- ParseTables.Empty_TokenValue =>
  11997.         None,
  11998.      -- ParseTables.AbortTokenValue => 
  11999.         After,
  12000.      -- ParseTables.AbsTokenValue =>  -- Spaced_Token inserts space after
  12001.         None,                         -- unless followed by '('
  12002.      -- ParseTables.AcceptTokenValue => 
  12003.         After,
  12004.      -- ParseTables.AccessTokenValue => 
  12005.         After,
  12006.      -- ParseTables.AllTokenValue => 
  12007.         None,
  12008.      -- ParseTables.AndTokenValue => 
  12009.         Around,
  12010.      -- ParseTables.ArrayTokenValue => 
  12011.         None, 
  12012.      -- ParseTables.AtTokenValue => 
  12013.         Around,
  12014.      -- ParseTables.BeginTokenValue => 
  12015.         None, 
  12016.      -- ParseTables.BodyTokenValue => 
  12017.         After,
  12018.      -- ParseTables.CaseTokenValue =>  -- Spaced_Token inserts space after if
  12019.         None,                          -- not followed by ';'
  12020.      -- ParseTables.ConstantTokenValue =>  -- Spaced_Token inserts space before
  12021.         After,                             -- if not following ':='
  12022.      -- ParseTables.DeclareTokenValue => 
  12023.         None, 
  12024.      -- ParseTables.DelayTokenValue => 
  12025.         After, 
  12026.      -- ParseTables.DeltaTokenValue =>  -- Spaced_Token inserts space before if
  12027.         None,                           -- not following ''' or 'IS', after if
  12028.                                         -- not followed by ';'
  12029.      -- ParseTables.DigitsTokenValue => -- Spaced_Token inserts space before if
  12030.         None,                           -- not following ''', or 'IS' after if
  12031.                                         -- not followed by ';'
  12032.      -- ParseTables.DoTokenValue => 
  12033.         Before, 
  12034.      -- ParseTables.ElseTokenValue => 
  12035.         After,
  12036.      -- ParseTables.ElsifTokenValue => 
  12037.         After, 
  12038.      -- ParseTables.EndTokenValue =>  -- Spaced_Token inserts space after if
  12039.         None,                         -- not followed by ';'
  12040.      -- ParseTables.EntryTokenValue => 
  12041.         After, 
  12042.      -- ParseTables.ExceptionTokenValue => 
  12043.         None,
  12044.      -- ParseTables.ExitTokenValue =>  -- Spaced_Token inserts space after if
  12045.         None,                          -- not followed by ';' 
  12046.      -- ParseTables.ForTokenValue => 
  12047.         After,
  12048.      -- ParseTables.FunctionTokenValue => 
  12049.         After, 
  12050.      -- ParseTables.GenericTokenValue => 
  12051.         None,
  12052.      -- ParseTables.GotoTokenValue => 
  12053.         After, 
  12054.      -- ParseTables.IfTokenValue =>  -- Spaced_Token inserts space after if 
  12055.         None,                        -- not followed by ';'
  12056.      -- ParseTables.InTokenValue =>  -- Spaced_Token inserts space before if
  12057.         After,                       -- not following ':'
  12058.      -- ParseTables.IsTokenValue => 
  12059.         Around,
  12060.      -- ParseTables.LimitedTokenValue => 
  12061.         After, 
  12062.      -- ParseTables.LoopTokenValue =>  -- Spaced_Token inserts space after if 
  12063.         None,                          -- not followed by ';' and space before
  12064.                                        -- if not following ':'
  12065.      -- ParseTables.ModTokenValue =>  -- Spaced_Token inserts space before if
  12066.         After,                        -- not following 'AT'
  12067.      -- ParseTables.NewTokenValue => 
  12068.         After,
  12069.      -- ParseTables.NotTokenValue => 
  12070.         After, 
  12071.      -- ParseTables.NullTokenValue => 
  12072.         None,
  12073.      -- ParseTables.OfTokenValue => 
  12074.         Around, 
  12075.      -- ParseTables.OrTokenValue => 
  12076.         Around,
  12077.      -- ParseTables.OthersTokenValue => 
  12078.         None,    
  12079.      -- ParseTables.OutTokenValue => 
  12080.         After,
  12081.      -- ParseTables.PackageTokenValue => 
  12082.         After, 
  12083.      -- ParseTables.PragmaTokenValue => 
  12084.         After,
  12085.      -- ParseTables.PrivateTokenValue => 
  12086.         None,  
  12087.      -- ParseTables.ProcedureTokenValue => 
  12088.         After,
  12089.      -- ParseTables.RaiseTokenValue =>  -- Spaced_Token inserts space after if
  12090.         None,                           -- not followed by ';'
  12091.      -- ParseTables.RangeTokenValue =>  -- Spaced_Token inserts space before if
  12092.         None,                           -- not following ''' or 'IS', after if
  12093.                                         -- not followed by ';'
  12094.      -- ParseTables.RecordTokenValue =>  -- Spaced_Token inserts space after if
  12095.         None,                            -- not followed by ';'
  12096.      -- ParseTables.RemTokenValue => 
  12097.         Around,
  12098.      -- ParseTables.RenamesTokenValue => 
  12099.         Around, 
  12100.      -- ParseTables.ReturnTokenValue =>  -- Spaced_Token inserts space after if
  12101.         Before,                          -- not followed by ';'
  12102.      -- ParseTables.ReverseTokenValue => 
  12103.         After, 
  12104.      -- ParseTables.SelectTokenValue =>  -- Spaced_Token inserts space after if
  12105.         None,                            -- not followed by ';'
  12106.      -- ParseTables.SeparateTokenValue => 
  12107.         None,
  12108.      -- ParseTables.SubtypeTokenValue => 
  12109.         After,
  12110.      -- ParseTables.TaskTokenValue => 
  12111.         After,
  12112.      -- ParseTables.TerminateTokenValue => 
  12113.         None,
  12114.      -- ParseTables.ThenTokenValue =>  -- Spaced_Token inserts space before if 
  12115.         After,                         -- not preceded by "and"  
  12116.      -- ParseTables.TypeTokenValue => 
  12117.         After, 
  12118.      -- ParseTables.UseTokenValue =>   -- Spaced_Token inserts space before if
  12119.         After,                         -- not preceded by ';'
  12120.      -- ParseTables.WhenTokenValue => 
  12121.         After,
  12122.      -- ParseTables.WhileTokenValue => 
  12123.         After,
  12124.      -- ParseTables.WithTokenValue => 
  12125.         After,
  12126.      -- ParseTables.XorTokenValue => 
  12127.         Around, 
  12128.      -- ParseTables.IdentifierTokenValue => 
  12129.         None,
  12130.      -- ParseTables.NumericTokenValue => 
  12131.         None,
  12132.      -- ParseTables.StringTokenValue => 
  12133.         None,
  12134.      -- ParseTables.CharacterTokenValue => 
  12135.         None,
  12136.      -- ParseTables.Ampersand_TokenValue => 
  12137.         Around,
  12138.      -- ParseTables.Apostrophe_TokenValue => 
  12139.         None,
  12140.      -- ParseTables.LeftParen_TokenValue => 
  12141.         None,
  12142.      -- ParseTables.RightParen_TokenValue => 
  12143.         None,
  12144.      -- ParseTables.Star_TokenValue => 
  12145.         None,
  12146.      -- ParseTables.Plus_TokenValue =>  -- Parser.Apply_Actions inserts space
  12147.         None,                           -- after if it is a binary operator,
  12148.                                         -- before if not following '('
  12149.      -- ParseTables.Comma_TokenValue =>  
  12150.         After,                           
  12151.      -- ParseTables.Minus_TokenValue =>  -- Parser.Apply_Actions inserts space
  12152.         None,                            -- after if it is a binary operator,
  12153.                                          -- before if not following '('
  12154.      -- ParseTables.Dot_TokenValue =>
  12155.         None,
  12156.      -- ParseTables.Slash_TokenValue => 
  12157.         None,
  12158.      -- ParseTables.Colon_TokenValue => 
  12159.         Around,
  12160.      -- ParseTables.SemiColon_TokenValue => 
  12161.         After,
  12162.      -- ParseTables.LT_TokenValue => 
  12163.         Around,
  12164.      -- ParseTables.EQ_TokenValue => 
  12165.         Around,
  12166.      -- ParseTables.GT_TokenValue => 
  12167.         Around,
  12168.      -- ParseTables.Bar_TokenValue => 
  12169.         Around,
  12170.      -- ParseTables.EQGT_TokenValue => 
  12171.         Around,
  12172.      -- ParseTables.DotDot_TokenValue => 
  12173.         Around,
  12174.      -- ParseTables.StarStar_TokenValue => 
  12175.         None,
  12176.      -- ParseTables.ColonEQ_TokenValue => 
  12177.         After,
  12178.      -- ParseTables.SlashEQ_TokenValue => 
  12179.         Around,
  12180.      -- ParseTables.GTEQ_TokenValue => 
  12181.         Around,
  12182.      -- ParseTables.LTEQ_TokenValue => 
  12183.         Around,
  12184.      -- ParseTables.LTLT_TokenValue => 
  12185.         None,
  12186.      -- ParseTables.GTGT_TokenValue => 
  12187.         After,
  12188.      -- ParseTables.LTGT_TokenValue => 
  12189.         None,
  12190.      -- ParseTables.Comment_TokenValue => 
  12191.         None);
  12192.  
  12193. end SOURCE_INSTRUMENTER_DECLARATIONS;
  12194. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12195. --SCOPE.SPC
  12196. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12197. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  12198. with STRING_PKG; use STRING_PKG;
  12199.  
  12200. package SCOPE_PACKAGE is
  12201.  
  12202. --  This package is used to maintain the current scope.  Whenever a
  12203. --  new scope is entered the current scope is pushed onto a stack and
  12204. --  becomes the current outer scope.  When a scope is ended it is deleted,
  12205. --  and the current outer scope becomes the current scope.  All information
  12206. --  needed for each scope is maintained in a record of type scope_descriptor.
  12207.  
  12208.   CURRENT_NESTING_LEVEL        : NATURAL := 0; 
  12209.   --|  The current level of nesting.
  12210.  
  12211.   type SCOPE_DESCRIPTOR is 
  12212.     record
  12213.       SCOPE_NAME            : STRING_TYPE; 
  12214.         -- The name of the current scope
  12215.       QUALIFIED_NAME        : STRING_TYPE; 
  12216.         -- The fully dot qualified name of the current scope
  12217.       QUALIFIED_NAME_STRING : STRING_TYPE;
  12218.         -- Same as qualified names, except operators are replaced by string
  12219.         -- representations of the operator(i.e. "+" becomes ""+"")
  12220.       TYPE_OF_SCOPE         : SCOPE_TYPE; 
  12221.         -- Type of current scope(procedure, task, block, etc.)
  12222.       SCOPE_NUMBER          : NATURAL;
  12223.         -- Sequential count of the scope in the current comp unit
  12224.       TRACING_PREFIX        : STRING_TYPE; 
  12225.         -- Prefix used when making unique subprogram names for trace procs
  12226.       IN_PRIVATE_PART       : BOOLEAN;
  12227.         -- Are we currently in the private part of a package
  12228.       IN_ACCEPT             : BOOLEAN;
  12229.         -- Are we currently in an accept statement
  12230.     end record; 
  12231.   --|  Maintains the information about a unit.
  12232.  
  12233.   NULL_SCOPE                   : constant SCOPE_DESCRIPTOR :=
  12234.     (CREATE(""),
  12235.      CREATE(""),                -- Used to initialize a scope descriptor
  12236.      CREATE(""),
  12237.      A_BLOCK,
  12238.      0,
  12239.      CREATE(""),
  12240.      FALSE,
  12241.      FALSE);
  12242.  
  12243.   CURRENT_SCOPE                : SCOPE_DESCRIPTOR := NULL_SCOPE;
  12244.   --|  Contains the information about the current unit.
  12245.  
  12246.   CURRENT_OUTER_SCOPE          : SCOPE_DESCRIPTOR := NULL_SCOPE;
  12247.   --|  Contains the information about the enclosing unit(if any).
  12248.  
  12249.   CURRENT_SCOPE_QUALIFIED_NAME : STRING_TYPE; 
  12250.   --|  Maintains the full dot notated name of the current unit.
  12251.  
  12252.   CURRENT_SCOPE_SIMPLE_NAME    : STRING_TYPE; 
  12253.   --|  Contains the simple name of the current unit.  It is set in
  12254.   --|  pop identifier and then retrieved in increment_scope when a
  12255.   --|  unit body is found.
  12256.  
  12257.   CURRENT_SCOPE_STRING_NAME    : STRING_TYPE;
  12258.   --|  Contains the simple name of the current unit; however, if
  12259.   --|  the unit is an operator("+","-",etc.) then the name
  12260.   --|  of the scope contains double quotes around the operator.
  12261.  
  12262.   procedure ENTER_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE);
  12263.   --|  This procedure is called whenever a new scope is entered
  12264.   --|  during instrumenting.  The type of scope is passed into the
  12265.   --|  procedure.  The current scope is changed to the new scope and the
  12266.   --|  old current scope becomes the outer scope.
  12267.  
  12268.   procedure EXIT_SCOPE;
  12269.   --|  This procedue is called when a scope is exited.   The current scope
  12270.   --|  is destroyed, and the current outer scope becomes the current scope.
  12271.  
  12272.   function MAKE_TRACING_PREFIX (OUTER_SCOPE  : in SCOPE_DESCRIPTOR;
  12273.                                 CURRENT_NAME : in STRING_TYPE;
  12274.                                 TYPE_OF_SCOPE: in SCOPE_TYPE)
  12275.     return STRING_TYPE;
  12276.   --|  This procedure makes a unique tracing prefix used for creating
  12277.   --|  the trace procedures for a scope.  The name of the tracing prefix
  12278.   --|  is based on the name of the current scope and current outer scope
  12279.  
  12280.   function MAKE_TRACING_PREFIX_FOR_SEPARATE (SEPARATE_NAME : in STRING_TYPE)
  12281.     return STRING_TYPE;
  12282.   --|  Same procedure as above special cased for a separate unit.
  12283.  
  12284. end SCOPE_PACKAGE;
  12285.  
  12286. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12287. --SCOPE.BDY
  12288. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12289.  
  12290. with STACK_PKG; 
  12291. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  12292. with STRING_UTILITIES; use STRING_UTILITIES;
  12293. package body SCOPE_PACKAGE is
  12294.  
  12295. --  This pacakge provides the mechanism for maintaining the current
  12296. --  scope.  A stack is used to maintain outer scopes during nesting.
  12297. --  Scope descriptors are used to maintain the information about
  12298. --  each scope.
  12299.  
  12300.   package SCOPE_STACK_PKG is 
  12301.     new STACK_PKG(SCOPE_DESCRIPTOR); 
  12302.   --  The scope stack maintains the scope records when we nest scopes
  12303.  
  12304.   SCOPE_STACK     : SCOPE_STACK_PKG.STACK := SCOPE_STACK_PKG.CREATE; 
  12305.   --|  Used to maintain the information about units when nesting occurs.
  12306.   --|  When a nested unit is encountered the enclosing units descriptor
  12307.   --|  is pushed onto the stack. When a nested unit is exited the stack
  12308.   --|  is popped to retrieve the enclosing units information.
  12309.  
  12310.   MAX_NAME_LENGTH : POSITIVE := 75 - SD_PREFIX'LENGTH;
  12311.   --  maximum length for a name that we generate
  12312.  
  12313.   ---------------------------------------------------------------------
  12314.   -- local subprogram declarations --
  12315.   ---------------------------------------------------------------------
  12316.  
  12317.   function TRUNCATE(S : in STRING_TYPE) return STRING_TYPE;
  12318.   -- Insures that the last character of a generated name is not an underscore
  12319.  
  12320.   function INCREMENT_COUNT_SUFFIX(NAME : in STRING) return STRING;
  12321.   -- A count is used to insure a unique name.  Each time a scope with the
  12322.   -- same name is encountered a unique count is added to the generated names
  12323.  
  12324.   function SAME_NAME(NAME1, NAME2 : in STRING_TYPE) return BOOLEAN;
  12325.   --  Returns true is the two names are equal
  12326.  
  12327.   ---------------------------------------------------------------------
  12328.   -- external subprograms --
  12329.   ---------------------------------------------------------------------
  12330.  
  12331.  
  12332.   procedure ENTER_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE) is
  12333.   -- Start a new scope.  Push the outer scope onto the scope stack, and
  12334.   -- the current scope becomes the current outer scope.  Then construct
  12335.   -- the current scope.
  12336.  
  12337.     CURRENT_SCOPE_QUALIFIED_NAME_STRING : STRING_TYPE;
  12338.     -- Used to construct the string version of the current qualified
  12339.     -- scope name.
  12340.     
  12341.   begin
  12342.  
  12343.     -- push outer scope onto stack, and set current outer scope to current
  12344.     -- scope.
  12345.  
  12346.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL + 1;
  12347.     SCOPE_STACK_PKG.PUSH(SCOPE_STACK, CURRENT_OUTER_SCOPE);
  12348.     CURRENT_OUTER_SCOPE := CURRENT_SCOPE;
  12349.  
  12350.     --Construct the string version of the current qualified scope name
  12351.     if IS_EMPTY(CURRENT_OUTER_SCOPE.QUALIFIED_NAME_STRING) then
  12352.       -- This is the outermost level. Do not prepend with outer scope
  12353.       CURRENT_SCOPE_QUALIFIED_NAME_STRING := CURRENT_SCOPE_STRING_NAME;
  12354.     else  --  nested scope
  12355.       CURRENT_SCOPE_QUALIFIED_NAME_STRING := 
  12356.         CURRENT_OUTER_SCOPE.QUALIFIED_NAME_STRING & "." &
  12357.         CURRENT_SCOPE_STRING_NAME;
  12358.     end if;
  12359.  
  12360.     -- set up the current scope record
  12361.  
  12362.     CURRENT_SCOPE := (CURRENT_SCOPE_SIMPLE_NAME,
  12363.                       CURRENT_SCOPE_QUALIFIED_NAME,
  12364.                       CURRENT_SCOPE_QUALIFIED_NAME_STRING,
  12365.                       TYPE_OF_SCOPE,
  12366.                       CURRENT_OUTER_SCOPE.SCOPE_NUMBER,
  12367.                       MAKE_TRACING_PREFIX(CURRENT_OUTER_SCOPE,
  12368.                                           CURRENT_SCOPE_SIMPLE_NAME,
  12369.                                           TYPE_OF_SCOPE),
  12370.                       FALSE,
  12371.                       CURRENT_OUTER_SCOPE.IN_ACCEPT);
  12372.  
  12373.   --  If we are in an accept statement then set the scope record appropriatly
  12374.  
  12375.     if TYPE_OF_SCOPE = ACCEPT_STATEMENT then
  12376.       CURRENT_SCOPE.IN_ACCEPT := TRUE;
  12377.     end if;
  12378.  
  12379.   end ENTER_SCOPE;
  12380.  
  12381.   ---------------------------------------------------------------------------
  12382.   procedure EXIT_SCOPE is
  12383.    -- Exit the current scope.  Pop the stack, and set up current_scope and
  12384.    -- current_outer_scope
  12385.  
  12386.   begin
  12387.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL - 1;
  12388.     if CURRENT_NESTING_LEVEL = 0 then  -- Finished current comp unit
  12389.       CURRENT_SCOPE := NULL_SCOPE;
  12390.     else  -- nested procedure
  12391.       CURRENT_SCOPE := CURRENT_OUTER_SCOPE;
  12392.     end if;
  12393.     SCOPE_STACK_PKG.POP(SCOPE_STACK, CURRENT_OUTER_SCOPE);
  12394.     CURRENT_SCOPE_QUALIFIED_NAME := CURRENT_SCOPE.QUALIFIED_NAME;
  12395.   end EXIT_SCOPE;
  12396.  
  12397.   ---------------------------------------------------------------------------
  12398.   function MAKE_TRACING_PREFIX(OUTER_SCOPE  : in SCOPE_DESCRIPTOR;
  12399.                                CURRENT_NAME : in STRING_TYPE;
  12400.                                TYPE_OF_SCOPE: in SCOPE_TYPE)
  12401.   return STRING_TYPE is
  12402.   -- Generate a unique name for current scopes tracing procedures
  12403.  
  12404.     TEMP_NAME : STRING_TYPE := CURRENT_NAME;
  12405.   begin
  12406.     -- if current scope is an operator(i.e. '+') then change temp name to
  12407.     -- operator
  12408.  
  12409.     if FETCH(TEMP_NAME, 1) = '"' then
  12410.       TEMP_NAME := CREATE("OPERATOR");
  12411.     end if;
  12412.  
  12413.     -- If we are nested in a scope with the same name as ours, then
  12414.     -- generate a unique name.
  12415.  
  12416.     if SAME_NAME(OUTER_SCOPE.SCOPE_NAME, TEMP_NAME) then
  12417.       return CREATE(INCREMENT_COUNT_SUFFIX(VALUE(OUTER_SCOPE.TRACING_PREFIX)));
  12418.     end if;
  12419.  
  12420.     -- A block uses the tracing prefix name of its enclosing scope
  12421.  
  12422.     if TYPE_OF_SCOPE = A_BLOCK then
  12423.       return CREATE(VALUE(OUTER_SCOPE.TRACING_PREFIX));
  12424.     end if;
  12425.  
  12426.     --  construct the unique name
  12427.  
  12428.     if LENGTH(TEMP_NAME) <= MAX_NAME_LENGTH then
  12429.       return TEMP_NAME & "_" & SD_PREFIX;
  12430.     end if;
  12431.  
  12432.     -- name is too long call truncate to shorten it
  12433.  
  12434.     return TRUNCATE(TEMP_NAME) & "_" & SD_PREFIX;
  12435.  
  12436.   end MAKE_TRACING_PREFIX;   
  12437.  
  12438.   ---------------------------------------------------------------------------
  12439.   function MAKE_TRACING_PREFIX_FOR_SEPARATE(SEPARATE_NAME: in STRING_TYPE)
  12440.   -- Special case of above procedure for a scope that is a separate
  12441.  
  12442.   return STRING_TYPE is
  12443.  
  12444.     CURRENT_NAME  : STRING_TYPE;
  12445.     PREVIOUS_NAME : STRING_TYPE;
  12446.     START         : POSITIVE := 1;
  12447.     DOT           : NATURAL := 0;
  12448.     COUNT         : NATURAL := 0;
  12449.  
  12450.   begin
  12451.     -- We need to determine a unique name for our tracing prefix, based
  12452.     -- on whether any names in the separate clause have the same name.
  12453.     -- Each time two components in the separate clause have the same 
  12454.     -- name the count is update.  count is used to create a unique name.
  12455.  
  12456.     PREVIOUS_NAME := CREATE("");
  12457.     while START < LENGTH(SEPARATE_NAME) loop      
  12458.       DOT := MATCH_C(SEPARATE_NAME, '.', START);
  12459.       if DOT = 0 then
  12460.         DOT := LENGTH(SEPARATE_NAME) + 1;
  12461.       end if;
  12462.       CURRENT_NAME := UPPER(SUBSTR(SEPARATE_NAME, START, DOT - START));
  12463.       if SAME_NAME(PREVIOUS_NAME, CURRENT_NAME) then
  12464.         COUNT := COUNT + 1;  -- scopes have the same name
  12465.       else
  12466.         COUNT := 0;  -- scopes have different names
  12467.       end if;
  12468.       START := DOT + 1;
  12469.       PREVIOUS_NAME := CURRENT_NAME;
  12470.     end loop;
  12471.  
  12472.     -- Replace operators with the word operator
  12473.  
  12474.     if FETCH(CURRENT_NAME, 1) = '"' then
  12475.       CURRENT_NAME := CREATE("OPERATOR");
  12476.     end if;
  12477.  
  12478.     --  If the name is too long then truncate it
  12479.  
  12480.     if LENGTH(CURRENT_NAME) > MAX_NAME_LENGTH then
  12481.       CURRENT_NAME := TRUNCATE(CURRENT_NAME);
  12482.     end if;
  12483.  
  12484.     -- If count is zero then we have a unique name
  12485.  
  12486.     if COUNT = 0 then
  12487.       return(CURRENT_NAME & "_" & SD_PREFIX);
  12488.     end if;    
  12489.  
  12490.     -- We don't have a unique name so add count to name to make it unique
  12491.  
  12492.     return(CURRENT_NAME & "_" & SD_PREFIX & INTEGER_STRING(COUNT) & "_");
  12493.  
  12494.   end MAKE_TRACING_PREFIX_FOR_SEPARATE;
  12495.  
  12496.   ---------------------------------------------------------------------
  12497.   -- local subprogram bodies --
  12498.   ---------------------------------------------------------------------
  12499.  
  12500.   --------------------------------------------------------------------------
  12501.   function TRUNCATE(S : in STRING_TYPE) return STRING_TYPE is
  12502.   -- Insure that the last character of the name is not an underscore
  12503.  
  12504.     LAST : POSITIVE := MAX_NAME_LENGTH;
  12505.   begin
  12506.     if FETCH(S, MAX_NAME_LENGTH) = '_' then
  12507.       LAST := LAST - 1;   -- last character is an underscore so delete it
  12508.     end if;
  12509.     return SUBSTR(S, 1, LAST);
  12510.   end TRUNCATE;       
  12511.  
  12512.   --------------------------------------------------------------------------
  12513.   function INCREMENT_COUNT_SUFFIX(NAME : in STRING) return STRING is
  12514.   -- Extract count suffix from name and update it so it can be added to
  12515.   -- current tracing prefix
  12516.  
  12517.     LAST_COUNT : NATURAL := 0;
  12518.     INDEX      : NATURAL := NAME'LAST - 1;
  12519.   begin
  12520.     while NAME(INDEX) /= '_' loop  -- find beginning index of count
  12521.       INDEX := INDEX - 1;
  12522.     end loop;
  12523.     
  12524.     -- convert count from string into an integer
  12525.  
  12526.     LAST_COUNT := INTEGER'VALUE(NAME(INDEX + 1 .. NAME'LAST-1));
  12527.  
  12528.     if LAST_COUNT = 1861 then  -- count was not used on outer scopes name
  12529.       return NAME & "1_";
  12530.     end if;
  12531.  
  12532.    -- update count and add it to the end of name
  12533.  
  12534.     LAST_COUNT := LAST_COUNT + 1;
  12535.     return NAME(1 .. INDEX) & INTEGER_STRING(LAST_COUNT) & "_";
  12536.   end INCREMENT_COUNT_SUFFIX;
  12537.  
  12538.   --------------------------------------------------------------------------
  12539.   function SAME_NAME(NAME1, NAME2 : in STRING_TYPE) return BOOLEAN is
  12540.     -- Assumes Name1 and Name2 are both upper cased before the call
  12541.   begin
  12542.     if EQUAL(NAME1, NAME2) then  -- Are names equal?
  12543.       return TRUE;
  12544.     end if;
  12545.  
  12546.     if LENGTH(NAME1) > MAX_NAME_LENGTH and    -- are names the same up to
  12547.        LENGTH(NAME2) > MAX_NAME_LENGTH then   -- the max_name_length?
  12548.        for I in 1 .. MAX_NAME_LENGTH loop
  12549.          if FETCH(NAME1, I) /= FETCH(NAME2, I) then
  12550.            return FALSE;  --  names differ on this char
  12551.          end if;
  12552.        end loop;
  12553.        return TRUE;  -- names are the same for first max_name_length chars
  12554.     end if;
  12555.     return FALSE;
  12556.   end SAME_NAME;
  12557.  
  12558.   ---------------------------------------------------------------------------
  12559.  
  12560. end SCOPE_PACKAGE;    
  12561.  
  12562. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12563. --SDBUFFERS.SPC
  12564. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12565. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  12566. with TEXT_IO; use TEXT_IO;
  12567. with DIRECT_IO; 
  12568. with LISTS; 
  12569. with STRING_PKG; use STRING_PKG; 
  12570.  
  12571. package SD_BUFFER_FILES is
  12572.  
  12573.   --| Overview
  12574.   --|     This package contains file management procedures needed by the
  12575.   --| Source Instrumenter for saving type and variable tracing information.
  12576.   --| The Source Instrumenter prepares programs for testing by the Ada Test 
  12577.   --| and Analysis Tool Set.
  12578.   --|
  12579.   --|     A general purpose scratch file is maintained for saving procedure
  12580.   --| bodies created by the instrumenter until the end of the current 
  12581.   --| declarative part, where they can then be copied into the instrumented
  12582.   --| source file.  The specifications for these procedures are added
  12583.   --| directly to the instrumented source file and do not need to be saved.
  12584.   --|
  12585.   --|     Four new files may be created for each package specification to
  12586.   --| contain the instrumenting information needed by the source instrumenter
  12587.   --| for tracing variables and types declared in the package specification.
  12588.   --| The procedures in this package manage these files and allows the Source
  12589.   --| Instrumenter to access the correct file when necessary.  A table which 
  12590.   --| equates a unique filename prefix with each package name is maintained by 
  12591.   --| this package, and saved in an external file when the instrumentation is 
  12592.   --| finished.
  12593.   --|
  12594.   --|
  12595.   --| Requires
  12596.   --| The following declarations for file naming are used:
  12597.   --|
  12598.   --| "File_Prefix_Limit" is currently set to 8 characters, and indicates
  12599.   --| the number of characters in a filename to the left of the dot.
  12600.   --|
  12601.   --| "File_Suffix_Limit" is currently set to 4 characters; a dot and
  12602.   --| a 3 character file extension.
  12603.   --|
  12604.   --| The external file which saves the package_name - file_name information
  12605.   --| is named "SDFNAMES.MAP"
  12606.   --|
  12607.   --| The current extensions used for the package tracing files are:
  12608.   --|  ".DPS"  -- For the Public_Spec_File
  12609.   --|  ".DPB"  -- For the Public_Body_File
  12610.   --|  ".DVS"  -- For the Private_Spec_File
  12611.   --|  ".DVB"  -- For the Private_Body_File
  12612.   --|
  12613.   --| These may be changed if they cause conflicts or are otherwise unsuitable
  12614.   --| for the host system.
  12615.  
  12616.   --| N/A: Errors, Raises, Modifies
  12617.  
  12618.  
  12619.   --------------------------------------------------------------------------
  12620.  
  12621.   package DIO is 
  12622.     new DIRECT_IO(SOURCE_LINE_BUFFER);
  12623.   use DIO; 
  12624.  
  12625.   subtype STRING_LIST is STRING_LISTS.LIST;
  12626.  
  12627.   BUFFER_FILE, 
  12628.   --| a temporary "scratch" file used by the source instrumenter
  12629.   --| to save type tracing procedure bodies until end of the
  12630.   --| current declarative part
  12631.  
  12632.   PUBLIC_SPEC_FILE, 
  12633.   --| file which has the package spec for tracing types and variables
  12634.   --| declared in the visible part of a package.
  12635.  
  12636.   PUBLIC_BODY_FILE, 
  12637.   --| the corresponding package body
  12638.  
  12639.   PRIVATE_SPEC_FILE, 
  12640.   --| file which has the procedure declarations for tracing types
  12641.   --| and variables declared in the private part of a package
  12642.  
  12643.   PRIVATE_BODY_FILE   : DIO.FILE_TYPE; 
  12644.   --| the corresponding procedure bodies
  12645.  
  12646.   type FILE_INDICATOR is 
  12647.      (PUBLIC_SPEC, PUBLIC_BODY, PRIVATE_SPEC, PRIVATE_BODY); 
  12648.   --| indicates which file to copy into the instrumented source file
  12649.  
  12650.   type FILE_GROUP is (PUBLIC_FILES, PRIVATE_FILES, ALL_FILES); 
  12651.   --| used by various procedures when the operation is not always 
  12652.   --| performed on all files 
  12653.  
  12654.   ------------------------------------------------------------------------
  12655.   -- The following procedures manage the Buffer_File 
  12656.   ------------------------------------------------------------------------
  12657.  
  12658.   procedure INITIALIZE;
  12659.  
  12660.   --| Effects
  12661.  
  12662.   --| This procedure initializes Buffer_File as a temporary Direct_IO file.
  12663.   --| The Source Instrumenter writes text to this file in sections which
  12664.   --| correspond to scoping levels in the source program.  Initialize
  12665.   --| also creates an Index_Stack to keep track of the Starting Indices for
  12666.   --| the sections.
  12667.  
  12668.   -----------------------------------------------------------------------------
  12669.  
  12670.   procedure START_NEW_SECTION;
  12671.  
  12672.   --| Effects
  12673.  
  12674.   --| This procedure marks a new section in the buffer file by pushing
  12675.   --| the current Starting_Index onto the Index_Stack and assigning the
  12676.   --| current DIO.Index to Starting_Index.
  12677.  
  12678.   ----------------------------------------------------------------------------
  12679.  
  12680.   procedure RELEASE_SECTION;
  12681.  
  12682.   --| Effects
  12683.  
  12684.   --| This procedure releases a section in Buffer_File by setting the Index
  12685.   --| to Starting_Index and popping the previous Starting_Index off the
  12686.   --| stack.
  12687.  
  12688.   -----------------------------------------------------------------------------
  12689.  
  12690.   procedure WRITELN_TO_BUFFER(DIO_FILE : in DIO.FILE_TYPE := BUFFER_FILE; 
  12691.                               LINE     : in SOURCE_LINE_BUFFER);
  12692.   --| Effects
  12693.  
  12694.   --| This procedure writes the line and a carriage return to the specified 
  12695.   --| file.  If no file is specified, the line is written to the Buffer_File.
  12696.  
  12697.   -----------------------------------------------------------------------------
  12698.  
  12699.   procedure SAVE_BUFFER_FILE(INSTRUMENTED_FILE : in TEXT_IO.FILE_TYPE); 
  12700.  
  12701.   --| Effects
  12702.  
  12703.   --| This procedure saves the section starting at the current Starting_Index
  12704.   --| to the instrumented source file.
  12705.  
  12706.  
  12707.  
  12708.   ----------------------------------------------------------------------------
  12709.   -- The following procedures manage the package tracing files.
  12710.   ----------------------------------------------------------------------------
  12711.  
  12712.   procedure CREATE_PACKAGE_FILES(PACKAGE_NAME : in STRING; 
  12713.                                  WHICH_FILES  : in FILE_GROUP); 
  12714.  
  12715.   --| Effects
  12716.  
  12717.   --| This procedure obtains a filename prefix based on the current package
  12718.   --| name, appends the appropriate suffix, and creates the Direct_IO files. 
  12719.   --| The source instrumenter saves package tracing information in these files.
  12720.   --| The Which_Files parameter will normally be "All_Files".  However, if a 
  12721.   --| package specification is nested in another package specification, then 
  12722.   --| only new private files are created. The information from the public part 
  12723.   --| of the nested package is included in the public files of the enclosing 
  12724.   --| package.
  12725.  
  12726.   ----------------------------------------------------------------------------
  12727.  
  12728.   procedure CLOSE_PACKAGE_FILES(WHICH_FILES : in FILE_GROUP); 
  12729.  
  12730.   --| Effects
  12731.  
  12732.   --| This procedure closes the specified group of package files.  
  12733.   --| Usually "Which_Files" parameter will be "All_Files".  If a package is 
  12734.   --| nested in another package, then the outer package's private files will
  12735.   --| be closed (temporarily) and reopened after the inner package is done.
  12736.   --|
  12737.   --| The public information for the nested package is included in the
  12738.   --| enclosing package's public files.  Therefore, it isn't necessary to
  12739.   --| close and reopen the public_files. 
  12740.  
  12741.   ---------------------------------------------------------------------------
  12742.  
  12743.   procedure REOPEN_FILES(PACKAGE_NAME : in STRING;
  12744.                          WHICH_FILES  : in FILE_GROUP); 
  12745.  
  12746.   --| Effects
  12747.  
  12748.   --| This procedure reopens the private files for the specified package,
  12749.   --| which were closed to process a nested package.  The file index is set
  12750.   --| to the end of the file so further writes to this files will be appended.
  12751.  
  12752.   ----------------------------------------------------------------------------
  12753.  
  12754.   function PACKAGE_FILES_EXIST(PACKAGE_NAME : in STRING; 
  12755.                                WHICH_FILES  : in FILE_GROUP) return BOOLEAN; 
  12756.  
  12757.   --| Effects
  12758.  
  12759.   --| This function determines if the specified group of instrumenting 
  12760.   --| information files exist for a package.  Both the spec and the body
  12761.   --| files must exist.  If one exists without the other, which could
  12762.   --| happed if the user deleted or misplaced one of the files, it is
  12763.   --| deleted, and False is returned. 
  12764.  
  12765.   -----------------------------------------------------------------------------
  12766.  
  12767.   procedure COPY_PACKAGE_FILES(WHICH_FILE   : in FILE_INDICATOR; 
  12768.                                PACKAGE_NAME : in STRING; 
  12769.                                SI_FILE      : in TEXT_IO.FILE_TYPE); 
  12770.  
  12771.   --| Effects
  12772.  
  12773.   --| This procedure copies the contents of the indicated file into the 
  12774.   --| instrumented source file.
  12775.  
  12776.   -----------------------------------------------------------------------------
  12777.  
  12778.   procedure COPY_AND_DELETE(FROM, INTO: in out DIO.FILE_TYPE);
  12779.  
  12780.   --| Effects
  12781.  
  12782.   --| Reset the first file (FROM) to the beginning, and copy it to the end
  12783.   --| of the second file (INTO).  Then delete FROM.
  12784.  
  12785.   ----------------------------------------------------------------------------
  12786.  
  12787.   procedure DELETE_PACKAGE_FILES(PACKAGE_NAME     : in STRING; 
  12788.                                  WHICH_FILES      : in FILE_GROUP := ALL_FILES;
  12789.                                  CURRENT_FILENAME : in STRING := "";
  12790.                                  DELETE_ENTRY     : in BOOLEAN := TRUE);
  12791.  
  12792.   --| Effects
  12793.  
  12794.   --| This procedure determines the name of the external files if the
  12795.   --| Current_Filename_Prefix is not already known, and deletes the 
  12796.   --| "Which_Files" group of files, if they exist.   
  12797.  
  12798.   ----------------------------------------------------------------------------
  12799.  
  12800.   procedure PURGE_PACKAGE_FILES(PROGRAM_NAME : in STRING);
  12801.  
  12802.   --| Effects
  12803.  
  12804.   ---------------------------------------------------------
  12805.  
  12806.   procedure SAVE_SPEC_WITH_LIST(UNIT_NAME : in STRING; 
  12807.                                 WITH_LIST : in STRING_LIST); 
  12808.   --| Effects
  12809.  
  12810.   --| This procecufe saves the list of library unit names that were
  12811.   --| in the with_clause for the indicated package specification.
  12812.  
  12813.   ---------------------------------------------------------
  12814.  
  12815.   function GET_SPEC_WITH_LIST(UNIT_NAME : in STRING) return STRING_LIST; 
  12816.  
  12817.   --| Effects
  12818.  
  12819.   --| This function retrieves the saved list of library unit names 
  12820.   --| that were in the with_clause for the indicated unit and returns
  12821.   --| it to the calling procedure as a list of string_types.
  12822.  
  12823.   -----------------------------------------------------------------------------
  12824.  
  12825.   procedure SAVE_EXTERNAL_FILE;
  12826.  
  12827.   --| Effects
  12828.  
  12829.   --| This procedure writes the internal table of package_name-file_name
  12830.   --| information to the permanent external table file.
  12831.  
  12832.   -----------------------------------------------------------------------------
  12833.  
  12834. end SD_BUFFER_FILES;
  12835.  
  12836. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12837. --SDBUFFERS.BDY
  12838. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12839.  
  12840. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  12841. with CALENDAR; 
  12842. with STACK_PKG; 
  12843. with TIME_LIBRARY_1; use TIME_LIBRARY_1; 
  12844. with SYSTEM_PARAMETERS;
  12845.  
  12846. package body SD_BUFFER_FILES is
  12847.   use STRING_LISTS;
  12848.  
  12849.   package SP renames SYSTEM_PARAMETERS;
  12850.  
  12851.   subtype DATE_STRING is STRING(1 .. 8); 
  12852.   subtype TIME_STRING is STRING(1 .. 8); 
  12853.   subtype FILENAME_PREFIX_STRING is STRING(1 .. FILE_PREFIX_LIMIT); 
  12854.  
  12855.   NO_FILENAME : constant FILENAME_PREFIX_STRING := (others => ' '); 
  12856.   NO_DATE     : constant DATE_STRING := (others => ' '); 
  12857.   NO_TIME     : constant TIME_STRING := (others => ' '); 
  12858.   NO_NAME     : constant STRING_PKG.STRING_TYPE := CREATE(""); 
  12859.  
  12860.   type TABLE_ENTRY_RECORD is  --| Record format for table entries
  12861.     record
  12862.       PACKAGE_ADA_NAME : STRING_PKG.STRING_TYPE := NO_NAME; 
  12863.       --| Fully qualified package name
  12864.       PACKAGE_FILENAME : FILENAME_PREFIX_STRING := NO_FILENAME; 
  12865.       --| Filename prefix
  12866.       WITHED_UNITS     : STRING_PKG.STRING_TYPE := NO_NAME; 
  12867.       --| List of units named in the context clause of a specification
  12868.       DATE_CREATED     : DATE_STRING := NO_DATE; 
  12869.       --| Date the file was created
  12870.       TIME_CREATED     : TIME_STRING := NO_TIME; 
  12871.       --| Time the file was created
  12872.     end record; 
  12873.  
  12874.  
  12875.   -- Function EQUAL for the instantiation of the Lists package
  12876.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN; 
  12877.  
  12878.   package INTERNAL_LIST_PACKAGE is 
  12879.     new LISTS(TABLE_ENTRY_RECORD, TABLE_EQUAL); 
  12880.   use INTERNAL_LIST_PACKAGE; 
  12881.  
  12882.   INTERNAL_TABLE         : INTERNAL_LIST_PACKAGE.LIST; 
  12883.   --| A linked list of table entry records, for equating package names
  12884.   --| with their filename prefix for instrumenting information files.  The
  12885.   --| list is built by reading the external file.
  12886.  
  12887.   INTERNAL_TABLE_CREATED : BOOLEAN := FALSE; 
  12888.   INTERNAL_TABLE_CHANGED : BOOLEAN := FALSE; 
  12889.  
  12890.   EXTERNAL_FILE          : TEXT_IO.FILE_TYPE; 
  12891.   --| The external file of package name, filename prefix information.
  12892.   --| The internal table is written to the external file at the end
  12893.   --| of instrumentation.
  12894.  
  12895.   TERMINATOR             : constant CHARACTER := '*'; 
  12896.   --| Mark the end of a table_entry_record field in the external file
  12897.  
  12898.   subtype LONG_STRING is STRING(1 .. 255); 
  12899.   --| Used for reading a line of text from one of the files.  It is
  12900.   --| assumed that most lines will be less than 255 characters and
  12901.   --| this choice should be adequate most of the time.  Procedures
  12902.   --| which do the reading must allow for cases where lines are longer
  12903.   --| than 255.
  12904.  
  12905.  
  12906.   --| Varaibles for marking and releasing sections in the Buffer_File 
  12907.  
  12908.   package INDEX_STACK_PKG is 
  12909.     new STACK_PKG(DIO.POSITIVE_COUNT); 
  12910.   INDEX_STACK    : INDEX_STACK_PKG.STACK; 
  12911.   STARTING_INDEX : DIO.POSITIVE_COUNT; 
  12912.  
  12913.  
  12914.   ------------------------------------------------------------------------
  12915.   --  Local procedure specificatons
  12916.   -------------------------------------------------------------------------
  12917.  
  12918.  
  12919.   ----------------------------------------------------------------------------
  12920.  
  12921.   procedure CREATE_INTERNAL_TABLE; 
  12922.   --| Reads the external file and builds an internal version of it 
  12923.   --| as a linked list.
  12924.  
  12925.   --------------------------------------------------------------------------
  12926.  
  12927.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) 
  12928.       return BOOLEAN; 
  12929.  
  12930.   --| Searches the Internal_Table for the occurrence of the 
  12931.   --| specified filename prefix.
  12932.  
  12933.   ----------------------------------------------------------------------------
  12934.  
  12935.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING)
  12936.       return FILENAME_PREFIX_STRING; 
  12937.  
  12938.   --| Formulates and returns a unique filename prefix for each package name. 
  12939.  
  12940.   ----------------------------------------------------------------------------
  12941.  
  12942.   function CONVERT_LIST_TO_STRING_TYPE(L : in STRING_LIST) return STRING_TYPE; 
  12943.   --| Converts a list of string_types to a single string_type
  12944.   --| with each element separated by one blank.
  12945.  
  12946.   ---------------------------------------------------------
  12947.  
  12948.   function CONVERT_STRING_TO_LIST(S : in STRING) return STRING_LIST; 
  12949.   --| Converts a literal string into a list of string_types.
  12950.  
  12951.   ---------------------------------------------------------
  12952.  
  12953.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) return STRING; 
  12954.   --| Returns a string of the next "length" characters read 
  12955.   --| from the external file.
  12956.  
  12957.   ---------------------------------------------------------
  12958.  
  12959.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE; 
  12960.   --| Reads any number of characters in the external file until
  12961.   --| the terminator character ('*') is found and returns them
  12962.   --| as a string_type.
  12963.  
  12964.   ---------------------------------------------------------
  12965.  
  12966.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  12967.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  12968.                                      FOUND        : in out BOOLEAN); 
  12969.   --| Scan the internal table for an entry for Package_Name, 
  12970.   --| and if found, pass it back to the calling procedure.
  12971.  
  12972.   ---------------------------------------------------------
  12973.  
  12974.   function START_PACKAGE(PACKAGE_NAME : in STRING)
  12975.       return FILENAME_PREFIX_STRING; 
  12976.  
  12977.   --| Create an entry in the Internal_Table for this package, 
  12978.   --| and return the unique filename prefix.
  12979.  
  12980.   ---------------------------------------------------------
  12981.  
  12982.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING)
  12983.       return FILENAME_PREFIX_STRING; 
  12984.  
  12985.   --| If the package is in the table, return its filename prefix.
  12986.   --| If there isn't an entry return No_Filename.
  12987.  
  12988.   ---------------------------------------------------------
  12989.  
  12990.  
  12991.   ---------------------------------------------------------------
  12992.   --  External procedures for managing the package tracing files.
  12993.   ---------------------------------------------------------------
  12994.  
  12995.  
  12996.   procedure CREATE_PACKAGE_FILES(PACKAGE_NAME : in STRING;
  12997.                                  WHICH_FILES  : in FILE_GROUP) is 
  12998.   --| Set up the requested set of package tracing files.
  12999.  
  13000.     FILENAME_PREFIX : constant STRING := 
  13001.        VALUE(SP.CURRENT_PROGRAM_LIBRARY) & START_PACKAGE(PACKAGE_NAME);
  13002.  
  13003.   begin
  13004.     if WHICH_FILES /= PRIVATE_FILES then 
  13005.       -- create the public_spec file
  13006.       begin
  13007.         DIO.OPEN(PUBLIC_SPEC_FILE, INOUT_FILE, 
  13008.                  FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13009.         DIO.DELETE(PUBLIC_SPEC_FILE); 
  13010.         DIO.CREATE(PUBLIC_SPEC_FILE, INOUT_FILE, 
  13011.                    FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13012.       exception
  13013.         when DIO.NAME_ERROR => 
  13014.           DIO.CREATE(PUBLIC_SPEC_FILE, INOUT_FILE, 
  13015.                      FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13016.       end; 
  13017.  
  13018.       -- create the public_body file
  13019.       begin
  13020.         DIO.OPEN(PUBLIC_BODY_FILE, INOUT_FILE, 
  13021.                  FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13022.         DIO.DELETE(PUBLIC_BODY_FILE); 
  13023.         DIO.CREATE(PUBLIC_BODY_FILE, INOUT_FILE, 
  13024.                    FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13025.       exception
  13026.         when DIO.NAME_ERROR => 
  13027.           DIO.CREATE(PUBLIC_BODY_FILE, INOUT_FILE, 
  13028.                      FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13029.       end; 
  13030.     end if; -- Which_Files /= Private_Files
  13031.  
  13032.  
  13033.     if WHICH_FILES /= PUBLIC_FILES then 
  13034.       -- create the private_spec file
  13035.       begin
  13036.         DIO.OPEN(PRIVATE_SPEC_FILE, INOUT_FILE, 
  13037.                  FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13038.         DIO.DELETE(PRIVATE_SPEC_FILE); 
  13039.         DIO.CREATE(PRIVATE_SPEC_FILE, INOUT_FILE, 
  13040.                    FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13041.       exception
  13042.         when DIO.NAME_ERROR => 
  13043.           DIO.CREATE(PRIVATE_SPEC_FILE, INOUT_FILE, 
  13044.                      FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13045.       end; 
  13046.  
  13047.       -- create the private_body file
  13048.       begin
  13049.         DIO.OPEN(PRIVATE_BODY_FILE, INOUT_FILE, 
  13050.                  FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13051.         DIO.DELETE(PRIVATE_BODY_FILE); 
  13052.         DIO.CREATE(PRIVATE_BODY_FILE, INOUT_FILE, 
  13053.                    FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13054.       exception
  13055.         when DIO.NAME_ERROR => 
  13056.           DIO.CREATE(PRIVATE_BODY_FILE, INOUT_FILE, 
  13057.                      FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13058.       end; 
  13059.     end if;   -- Which_Files /= Public_Files 
  13060.  
  13061.   end CREATE_PACKAGE_FILES; 
  13062.  
  13063.   ---------------------------------------------------------
  13064.  
  13065.   procedure CLOSE_PACKAGE_FILES(WHICH_FILES : in FILE_GROUP) is
  13066.   --| Close the specified group of package tracing files.
  13067.  
  13068.   begin
  13069.     if WHICH_FILES /= PRIVATE_FILES then 
  13070.       DIO.CLOSE(PUBLIC_SPEC_FILE); 
  13071.       DIO.CLOSE(PUBLIC_BODY_FILE); 
  13072.     end if; 
  13073.  
  13074.     if WHICH_FILES /= PUBLIC_FILES then 
  13075.       DIO.CLOSE(PRIVATE_SPEC_FILE); 
  13076.       DIO.CLOSE(PRIVATE_BODY_FILE); 
  13077.     end if; 
  13078.  
  13079.   exception
  13080.     when others => 
  13081.       null; 
  13082.   end CLOSE_PACKAGE_FILES; 
  13083.  
  13084.   ----------------------------------------------------------------------
  13085.  
  13086.   procedure REOPEN_FILES(PACKAGE_NAME : in STRING;
  13087.                          WHICH_FILES  : in FILE_GROUP) is 
  13088.  
  13089.     FILENAME_PREFIX : constant STRING :=
  13090.        VALUE(SP.CURRENT_PROGRAM_LIBRARY) & GET_FILENAME_PREFIX(PACKAGE_NAME);
  13091.  
  13092.     FILE_INDEX              : DIO.COUNT; 
  13093.  
  13094.   begin
  13095.     if WHICH_FILES /= PUBLIC_FILES then
  13096.  
  13097.       DIO.OPEN(PRIVATE_SPEC_FILE, INOUT_FILE, 
  13098.                FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13099.  
  13100.       FILE_INDEX := DIO.SIZE(PRIVATE_SPEC_FILE); 
  13101.       if FILE_INDEX /= 0 then 
  13102.         DIO.SET_INDEX(PRIVATE_SPEC_FILE, FILE_INDEX + 1); 
  13103.       end if; 
  13104.  
  13105.       DIO.OPEN(PRIVATE_BODY_FILE, INOUT_FILE, 
  13106.                FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13107.       FILE_INDEX := DIO.SIZE(PRIVATE_BODY_FILE); 
  13108.       if FILE_INDEX /= 0 then 
  13109.         DIO.SET_INDEX(PRIVATE_BODY_FILE, FILE_INDEX + 1); 
  13110.       end if; 
  13111.     end if;
  13112.  
  13113.     if WHICH_FILES /= PRIVATE_FILES then
  13114.  
  13115.       DIO.OPEN(PUBLIC_SPEC_FILE, INOUT_FILE, 
  13116.                FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13117.  
  13118.       FILE_INDEX := DIO.SIZE(PUBLIC_SPEC_FILE); 
  13119.       if FILE_INDEX /= 0 then 
  13120.         DIO.SET_INDEX(PUBLIC_SPEC_FILE, FILE_INDEX + 1); 
  13121.       end if; 
  13122.  
  13123.       DIO.OPEN(PUBLIC_BODY_FILE, INOUT_FILE, 
  13124.                FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13125.       FILE_INDEX := DIO.SIZE(PUBLIC_BODY_FILE); 
  13126.       if FILE_INDEX /= 0 then 
  13127.         DIO.SET_INDEX(PUBLIC_BODY_FILE, FILE_INDEX + 1); 
  13128.       end if; 
  13129.     end if;
  13130.  
  13131.   exception
  13132.     when others => 
  13133.       null; 
  13134.  
  13135.   end REOPEN_FILES; 
  13136.  
  13137.   ---------------------------------------------------------------------------
  13138.  
  13139.   function PACKAGE_FILES_EXIST(PACKAGE_NAME : in STRING; 
  13140.                                WHICH_FILES  : in FILE_GROUP) return BOOLEAN is 
  13141.   --| See if the requested set of instrumenting information files
  13142.   --| exist for the given package.  Both the spec and body file must
  13143.   --| exist, as the body contains the bodies for the subprograms
  13144.   --| declared in the spec file.  If one exists without the other,
  13145.   --| delete it and return false.
  13146.  
  13147.     FILENAME_PREFIX     : constant STRING :=
  13148.        VALUE(SP.CURRENT_PROGRAM_LIBRARY) & GET_FILENAME_PREFIX(PACKAGE_NAME); 
  13149.  
  13150.     PUBLIC_SPEC_EXISTS  : BOOLEAN := TRUE; 
  13151.     PUBLIC_BODY_EXISTS  : BOOLEAN := TRUE; 
  13152.     PRIVATE_SPEC_EXISTS : BOOLEAN := TRUE; 
  13153.     PRIVATE_BODY_EXISTS : BOOLEAN := TRUE; 
  13154.     DIO_FILE            : DIO.FILE_TYPE; 
  13155.  
  13156.   begin
  13157.     if FILENAME_PREFIX = VALUE(SP.CURRENT_PROGRAM_LIBRARY) & NO_FILENAME then
  13158.       -- they don't exist
  13159.       return FALSE; 
  13160.     end if; 
  13161.  
  13162.     -- The internal table has an entry for the given package name.
  13163.     -- Make sure that the necessary files exist and can be opened.  
  13164.     -- If some of the files exist and not the others, delete those 
  13165.     -- that do and update the table.  This could happen if the user 
  13166.     -- has deleted the files other than by re-instrumenting...
  13167.  
  13168.     if WHICH_FILES /= PRIVATE_FILES then 
  13169.       -- check if the public spec and body files exist
  13170.       begin
  13171.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13172.         DIO.CLOSE(DIO_FILE); 
  13173.       exception
  13174.         when others => 
  13175.           PUBLIC_SPEC_EXISTS := FALSE; 
  13176.       end; 
  13177.  
  13178.       begin
  13179.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13180.         DIO.CLOSE(DIO_FILE); 
  13181.       exception
  13182.         when others => 
  13183.           PUBLIC_BODY_EXISTS := FALSE; 
  13184.       end; 
  13185.  
  13186.       if WHICH_FILES = PUBLIC_FILES then 
  13187.         if not (PUBLIC_SPEC_EXISTS and PUBLIC_BODY_EXISTS) then 
  13188.           DELETE_PACKAGE_FILES(PACKAGE_NAME, PUBLIC_FILES, FILENAME_PREFIX); 
  13189.           return FALSE; 
  13190.         end if; 
  13191.         return TRUE; 
  13192.       end if; 
  13193.     end if;     -- Which_Files /= Private_Files
  13194.  
  13195.     if WHICH_FILES /= PUBLIC_FILES then 
  13196.       -- check if the private spec and body files exist
  13197.       begin
  13198.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX);
  13199.         DIO.CLOSE(DIO_FILE); 
  13200.       exception
  13201.         when others => 
  13202.           PRIVATE_SPEC_EXISTS := FALSE; 
  13203.       end; 
  13204.  
  13205.       begin
  13206.         DIO.OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX);
  13207.         DIO.CLOSE(DIO_FILE); 
  13208.       exception
  13209.         when others => 
  13210.           PRIVATE_BODY_EXISTS := FALSE; 
  13211.       end; 
  13212.  
  13213.       if WHICH_FILES = PRIVATE_FILES then 
  13214.         if not (PRIVATE_SPEC_EXISTS and PRIVATE_BODY_EXISTS) then 
  13215.           DELETE_PACKAGE_FILES(PACKAGE_NAME, PRIVATE_FILES, FILENAME_PREFIX); 
  13216.           return FALSE; 
  13217.         end if; 
  13218.         return TRUE; 
  13219.       end if; 
  13220.     end if;     -- Which_Files /= Public_Files
  13221.  
  13222.  
  13223.     -- if we've gotten this far without hitting one of the
  13224.     -- returns then Which_Files = All_Files 
  13225.     if not (PUBLIC_SPEC_EXISTS and 
  13226.             PUBLIC_BODY_EXISTS  and 
  13227.             PRIVATE_SPEC_EXISTS and
  13228.             PRIVATE_BODY_EXISTS) then 
  13229.       DELETE_PACKAGE_FILES(PACKAGE_NAME, ALL_FILES, FILENAME_PREFIX); 
  13230.       return FALSE; 
  13231.     end if; 
  13232.  
  13233.     return TRUE; 
  13234.  
  13235.   end PACKAGE_FILES_EXIST; 
  13236.  
  13237.   -----------------------------------------------------------------------------
  13238.  
  13239.   procedure DELETE_PACKAGE_FILES(PACKAGE_NAME     : in STRING; 
  13240.                                  WHICH_FILES      : in FILE_GROUP := ALL_FILES; 
  13241.                                  CURRENT_FILENAME : in STRING := "";
  13242.                                  DELETE_ENTRY     : in BOOLEAN := TRUE) IS
  13243.  
  13244.   --| Delete the indicated set of package tracing files.  If all the
  13245.   --| files are deleted, then also delete the internal table entry for 
  13246.   --| the package.
  13247.  
  13248.     DIO_FILE        : DIO.FILE_TYPE; 
  13249.     FILENAME_PREFIX : STRING(1 .. LENGTH(SP.CURRENT_PROGRAM_LIBRARY) + 
  13250.                                   FILE_PREFIX_LIMIT);
  13251.     TABLE_ENTRY     : TABLE_ENTRY_RECORD; 
  13252.     ENTRY_EXISTS    : BOOLEAN := FALSE; 
  13253.  
  13254.   begin
  13255.  
  13256.     -- if this procedure is called from Package_Files_Exist then
  13257.     -- the filename prefix has already been looked up, and is
  13258.     -- passed as Current_Filename.
  13259.  
  13260.     if CURRENT_FILENAME = "" then 
  13261.       FILENAME_PREFIX := VALUE(SP.CURRENT_PROGRAM_LIBRARY) & 
  13262.                                GET_FILENAME_PREFIX(PACKAGE_NAME);
  13263.     else
  13264.       FILENAME_PREFIX := CURRENT_FILENAME;
  13265.     end if; 
  13266.  
  13267.     -- if the files can be opened, then they exist.  Delete them.
  13268.     -- Otherwise, there is nothing to delete so ignore it.
  13269.     if FILENAME_PREFIX /= VALUE(SP.CURRENT_PROGRAM_LIBRARY) & NO_FILENAME then
  13270.  
  13271.       if WHICH_FILES /= PRIVATE_FILES then 
  13272.         -- delete the public_spec_file
  13273.         begin
  13274.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  13275.                    FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13276.           DIO.DELETE(DIO_FILE); 
  13277.         exception
  13278.           when DIO.NAME_ERROR => 
  13279.             null; 
  13280.         end; 
  13281.  
  13282.         -- delete the public_body_file
  13283.         begin
  13284.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  13285.                    FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13286.           DIO.DELETE(DIO_FILE); 
  13287.         exception
  13288.           when DIO.NAME_ERROR => 
  13289.             null; 
  13290.         end; 
  13291.       end if; -- Which_Files /= Private_Files
  13292.  
  13293.       if WHICH_FILES /= PUBLIC_FILES then 
  13294.         -- delete the private_spec_file
  13295.         begin
  13296.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  13297.                    FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13298.           DIO.DELETE(DIO_FILE); 
  13299.         exception
  13300.           when DIO.NAME_ERROR => 
  13301.             null; 
  13302.         end; 
  13303.  
  13304.         -- delete the private_body_file
  13305.         begin
  13306.           DIO.OPEN(DIO_FILE, OUT_FILE, 
  13307.                    FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13308.           DIO.DELETE(DIO_FILE); 
  13309.         exception
  13310.           when DIO.NAME_ERROR => 
  13311.             null; 
  13312.         end; 
  13313.       end if; -- Which_Files /= Public_Files
  13314.  
  13315.       if WHICH_FILES = ALL_FILES and DELETE_ENTRY then 
  13316.         GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  13317.         if ENTRY_EXISTS then 
  13318.           DELETEITEM(INTERNAL_TABLE, TABLE_ENTRY); 
  13319.           INTERNAL_TABLE_CHANGED := TRUE; 
  13320.         end if; 
  13321.       end if; 
  13322.  
  13323.     end if; -- Filename /= No_Filename
  13324.   end DELETE_PACKAGE_FILES; 
  13325.  
  13326.   ----------------------------------------------------------------------------
  13327.  
  13328.   procedure PURGE_PACKAGE_FILES(PROGRAM_NAME : in STRING) is
  13329.     ITERATOR   : INTERNAL_LIST_PACKAGE.LISTITER;
  13330.     NEXT_ENTRY : TABLE_ENTRY_RECORD;
  13331.   begin
  13332.     if not INTERNAL_TABLE_CREATED then
  13333.       CREATE_INTERNAL_TABLE;
  13334.     end if;
  13335.  
  13336.     ITERATOR := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE);
  13337.     while INTERNAL_LIST_PACKAGE.MORE(ITERATOR) loop
  13338.       INTERNAL_LIST_PACKAGE.NEXT(ITERATOR, NEXT_ENTRY);
  13339.       if MATCH_S(NEXT_ENTRY.PACKAGE_ADA_NAME & ".", PROGRAM_NAME & ".") = 1 then
  13340.         DELETE_PACKAGE_FILES(VALUE(NEXT_ENTRY.PACKAGE_ADA_NAME),
  13341.                              ALL_FILES,
  13342.                              VALUE(SP.CURRENT_PROGRAM_LIBRARY) & 
  13343.                                    NEXT_ENTRY.PACKAGE_FILENAME,
  13344.                              FALSE);
  13345.         DELETEITEM(INTERNAL_TABLE, NEXT_ENTRY); 
  13346.         INTERNAL_TABLE_CHANGED := TRUE; 
  13347.       end if;
  13348.     end loop;
  13349.     SAVE_EXTERNAL_FILE;    
  13350.   end PURGE_PACKAGE_FILES; 
  13351.  
  13352.   -----------------------------------------------------------------------------
  13353.  
  13354.   procedure COPY_PACKAGE_FILES(WHICH_FILE   : in FILE_INDICATOR; 
  13355.                                PACKAGE_NAME : in STRING; 
  13356.                                SI_FILE      : in TEXT_IO.FILE_TYPE) is
  13357.   --| Copy the indicated package tracing file into the instrumented
  13358.   --| source file.
  13359.  
  13360.     DIO_FILE                : DIO.FILE_TYPE; 
  13361.  
  13362.     FILE_START_INDEX        : DIO.COUNT := 1; 
  13363.     FILE_END_INDEX          : DIO.COUNT; 
  13364.     LINE                    : SOURCE_LINE_BUFFER;
  13365.     FILENAME_PREFIX : constant STRING :=
  13366.        VALUE(SP.CURRENT_PROGRAM_LIBRARY) & GET_FILENAME_PREFIX(PACKAGE_NAME);
  13367.  
  13368.   begin
  13369.     case WHICH_FILE is 
  13370.       when PUBLIC_SPEC => 
  13371.         OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_SPEC_FILE_SUFFIX); 
  13372.  
  13373.       when PUBLIC_BODY => 
  13374.         OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PUBLIC_BODY_FILE_SUFFIX); 
  13375.  
  13376.       when PRIVATE_SPEC => 
  13377.         OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_SPEC_FILE_SUFFIX); 
  13378.  
  13379.       when PRIVATE_BODY => 
  13380.         OPEN(DIO_FILE, IN_FILE, FILENAME_PREFIX & PRIVATE_BODY_FILE_SUFFIX); 
  13381.     end case; 
  13382.  
  13383.     TEXT_IO.NEW_LINE (SI_FILE);
  13384.  
  13385.     -- while not DIO.end_of_file (DIO_File) loop
  13386.     -- Compiler Bug?  
  13387.     -- When trying to copy the private files, end_of_file is true immediately,
  13388.     -- even though the file index = 1, file size > 1, the file exists and
  13389.     -- can be read.  So read it explicitly from start to end.
  13390.  
  13391.     FILE_START_INDEX := 1; 
  13392.     FILE_END_INDEX := DIO.SIZE(DIO_FILE); 
  13393.     for I in FILE_START_INDEX .. FILE_END_INDEX loop
  13394.       DIO.READ(DIO_FILE, LINE);
  13395.       TEXT_IO.PUT_LINE(SI_FILE, LINE); 
  13396.     end loop; 
  13397.     DIO.CLOSE(DIO_FILE); 
  13398.  
  13399.   exception
  13400.     when others => 
  13401.       null; 
  13402.  
  13403.   end COPY_PACKAGE_FILES; 
  13404.  
  13405.   -----------------------------------------------------------------------------
  13406.  
  13407.   procedure COPY_AND_DELETE(FROM, INTO: in out DIO.FILE_TYPE) is 
  13408.  
  13409.     FILE_START_INDEX  : DIO.COUNT := 1; 
  13410.     FILE_END_INDEX    : DIO.COUNT; 
  13411.     LINE              : SOURCE_LINE_BUFFER;
  13412.  
  13413.   begin
  13414.     -- The FROM file has to be reset to the start.  The INTO file is 
  13415.     -- already at the end.  In fact, currently this procedure is only
  13416.     -- called from CLOSE_TRACING_PACKAGES, and the INTO files (private
  13417.     -- files) have just been reopened.
  13418.  
  13419.     DIO.SET_INDEX(FROM, FILE_START_INDEX);
  13420.     FILE_END_INDEX := DIO.SIZE(FROM); 
  13421.     for I in FILE_START_INDEX .. FILE_END_INDEX loop
  13422.       DIO.READ(FROM, LINE); 
  13423.       DIO.WRITE(INTO, LINE);
  13424.     end loop; 
  13425.  
  13426.     DIO.DELETE(FROM); 
  13427.  
  13428.   end COPY_AND_DELETE;
  13429.  
  13430.   ---------------------------------------------------------
  13431.  
  13432.   procedure SAVE_SPEC_WITH_LIST(UNIT_NAME : in STRING; 
  13433.                                 WITH_LIST : in STRING_LIST) is 
  13434.   --| This procedure is called by the source instrumenter when
  13435.   --| a package specification has a with list.  Convert the
  13436.   --| string_list to a string_type, and save it so that it
  13437.   --| can be retrieved when the package body is found.
  13438.  
  13439.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  13440.     FOUND        : BOOLEAN; 
  13441.     LIST_TO_SAVE : STRING_TYPE; 
  13442.   begin
  13443.     GET_INTERNAL_TABLE_ENTRY(UNIT_NAME, TABLE_ENTRY, FOUND); 
  13444.     if not FOUND then  -- make an entry
  13445.       TABLE_ENTRY.PACKAGE_ADA_NAME := MAKE_PERSISTENT(UNIT_NAME); 
  13446.     else 
  13447.       INTERNAL_LIST_PACKAGE.DELETEITEM(INTERNAL_TABLE, TABLE_ENTRY); 
  13448.     end if; 
  13449.  
  13450.     TABLE_ENTRY.WITHED_UNITS := 
  13451.        MAKE_PERSISTENT(CONVERT_LIST_TO_STRING_TYPE(WITH_LIST)); 
  13452.     ATTACH(INTERNAL_TABLE, TABLE_ENTRY); 
  13453.     INTERNAL_TABLE_CHANGED := TRUE; 
  13454.   end SAVE_SPEC_WITH_LIST; 
  13455.  
  13456.   ---------------------------------------------------------
  13457.  
  13458.   function GET_SPEC_WITH_LIST(UNIT_NAME : in STRING) return STRING_LIST is 
  13459.   --| Retrieve the with_list that was saved for the package
  13460.   --| specification, convert it to a string_list, and return 
  13461.   --| it to the source instrumenter.
  13462.  
  13463.     TEMP        : STRING_LIST := STRING_LISTS.CREATE; 
  13464.     TABLE_ENTRY : TABLE_ENTRY_RECORD; 
  13465.     FOUND       : BOOLEAN; 
  13466.   begin
  13467.     GET_INTERNAL_TABLE_ENTRY(UNIT_NAME, TABLE_ENTRY, FOUND); 
  13468.     if FOUND and then not STRING_PKG.IS_EMPTY(TABLE_ENTRY.WITHED_UNITS) then 
  13469.       TEMP := CONVERT_STRING_TO_LIST(VALUE(TABLE_ENTRY.WITHED_UNITS)); 
  13470.     end if; 
  13471.     return TEMP; 
  13472.   end GET_SPEC_WITH_LIST; 
  13473.  
  13474.   -----------------------------------------------------------------------------
  13475.  
  13476.   procedure SAVE_EXTERNAL_FILE is 
  13477.   --| Write the internal table list to the extenal file if it has changed.
  13478.  
  13479.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  13480.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  13481.     FILENAME      : constant STRING := 
  13482.        VALUE(SP.CURRENT_PROGRAM_LIBRARY) & EXTERNAL_FILENAME;
  13483.  
  13484.   begin
  13485.     if INTERNAL_TABLE_CREATED and INTERNAL_TABLE_CHANGED then 
  13486.       begin
  13487.         OPEN(EXTERNAL_FILE, OUT_FILE, FILENAME); 
  13488.         RESET(EXTERNAL_FILE); 
  13489.       exception
  13490.         when TEXT_IO.NAME_ERROR => 
  13491.           CREATE(EXTERNAL_FILE, OUT_FILE, FILENAME); 
  13492.       end; 
  13493.       
  13494.       if INTERNAL_LIST_PACKAGE.ISEMPTY(INTERNAL_TABLE) then
  13495.          DELETE(EXTERNAL_FILE);
  13496.       else
  13497.         TABLE_POINTER := MAKELISTITER(INTERNAL_TABLE); 
  13498.         while MORE(TABLE_POINTER) loop
  13499.           NEXT(TABLE_POINTER, TABLE_ENTRY); 
  13500.  
  13501.           PUT(EXTERNAL_FILE, VALUE(TABLE_ENTRY.PACKAGE_ADA_NAME)); 
  13502.           PUT(EXTERNAL_FILE, TERMINATOR); 
  13503.  
  13504.           PUT(EXTERNAL_FILE, TABLE_ENTRY.PACKAGE_FILENAME); 
  13505.           PUT(EXTERNAL_FILE, TERMINATOR); 
  13506.  
  13507.           PUT(EXTERNAL_FILE, VALUE(TABLE_ENTRY.WITHED_UNITS)); 
  13508.           PUT(EXTERNAL_FILE, TERMINATOR); 
  13509.  
  13510.           PUT(EXTERNAL_FILE, TABLE_ENTRY.DATE_CREATED); 
  13511.           PUT(EXTERNAL_FILE, TERMINATOR); 
  13512.  
  13513.           PUT(EXTERNAL_FILE, TABLE_ENTRY.TIME_CREATED); 
  13514.           PUT(EXTERNAL_FILE, TERMINATOR); 
  13515.           NEW_LINE(EXTERNAL_FILE); 
  13516.         end loop; 
  13517.  
  13518.         CLOSE(EXTERNAL_FILE); 
  13519.         INTERNAL_LIST_PACKAGE.DESTROY(INTERNAL_TABLE); 
  13520.       end if;
  13521.       INTERNAL_TABLE_CREATED := FALSE; 
  13522.       INTERNAL_TABLE_CHANGED := FALSE; 
  13523.     end if; 
  13524.   end SAVE_EXTERNAL_FILE; 
  13525.  
  13526.   ---------------------------------------------------------------
  13527.   --  External procedures for managing the temporary buffer file.
  13528.   ----------------------------------------------------------------
  13529.  
  13530.   procedure INITIALIZE is 
  13531.   begin
  13532.     if DIO.IS_OPEN(BUFFER_FILE) then
  13533.       DIO.RESET(BUFFER_FILE);
  13534.     else
  13535.       DIO.CREATE(BUFFER_FILE); 
  13536.     end if;
  13537.     INDEX_STACK := INDEX_STACK_PKG.CREATE; 
  13538.     STARTING_INDEX := DIO.INDEX(BUFFER_FILE); 
  13539.   end INITIALIZE; 
  13540.  
  13541.   ----------------------------------------------------------------
  13542.  
  13543.   procedure START_NEW_SECTION is 
  13544.  
  13545.   begin
  13546.     INDEX_STACK_PKG.PUSH(INDEX_STACK, STARTING_INDEX); 
  13547.     STARTING_INDEX := DIO.INDEX(BUFFER_FILE); 
  13548.   end START_NEW_SECTION; 
  13549.  
  13550.   ---------------------------------------------------------------
  13551.  
  13552.   procedure RELEASE_SECTION is 
  13553.  
  13554.   begin
  13555.     SET_INDEX(BUFFER_FILE, STARTING_INDEX); 
  13556.     INDEX_STACK_PKG.POP(INDEX_STACK, STARTING_INDEX); 
  13557.   end RELEASE_SECTION; 
  13558.  
  13559.   ----------------------------------------------------------------
  13560.  
  13561.   procedure WRITELN_TO_BUFFER(DIO_FILE : in DIO.FILE_TYPE := BUFFER_FILE; 
  13562.                               LINE     : in SOURCE_LINE_BUFFER) is
  13563.  
  13564.   begin
  13565.     DIO.WRITE(DIO_FILE, LINE);
  13566.   end WRITELN_TO_BUFFER; 
  13567.  
  13568.   ----------------------------------------------------------------------
  13569.  
  13570.   procedure SAVE_BUFFER_FILE(INSTRUMENTED_FILE : in TEXT_IO.FILE_TYPE) is 
  13571.  
  13572.     CURRENT_INDEX : DIO.COUNT; 
  13573.     LINE          : SOURCE_LINE_BUFFER;
  13574.  
  13575.   begin
  13576.     CURRENT_INDEX := DIO.INDEX(BUFFER_FILE) - 1; 
  13577.     if STARTING_INDEX <= CURRENT_INDEX then 
  13578.       TEXT_IO.PUT_LINE(INSTRUMENTED_FILE, ""); 
  13579.     end if; 
  13580.  
  13581.     for I in STARTING_INDEX .. CURRENT_INDEX loop
  13582.       DIO.READ(BUFFER_FILE, LINE, I); 
  13583.       TEXT_IO.PUT_LINE(INSTRUMENTED_FILE, LINE); 
  13584.     end loop; 
  13585.   end SAVE_BUFFER_FILE; 
  13586.  
  13587.   ------------------------------------------------------------------------
  13588.   --  Local procedure bodies
  13589.   -------------------------------------------------------------------------
  13590.  
  13591.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN is 
  13592.  
  13593.   begin
  13594.     return EQUAL(X.PACKAGE_ADA_NAME, Y.PACKAGE_ADA_NAME) and then 
  13595.            X.PACKAGE_FILENAME = Y.PACKAGE_FILENAME and then 
  13596.            X.DATE_CREATED = Y.DATE_CREATED and then 
  13597.            X.TIME_CREATED = Y.TIME_CREATED; 
  13598.   end TABLE_EQUAL; 
  13599.  
  13600.   ---------------------------------------------------------
  13601.  
  13602.   function CONVERT_LIST_TO_STRING_TYPE(L : in STRING_LIST) 
  13603.        return STRING_TYPE is 
  13604.   
  13605.   --| Iterate through a list of string_types and collect
  13606.   --| all of the objects into one string_type, with each
  13607.   --| one separated by a blank.
  13608.  
  13609.     ITERATOR    : STRING_LISTS.LISTITER; 
  13610.     NEXT_OBJECT : STRING_TYPE; 
  13611.     TEMP        : STRING_TYPE := NO_NAME; 
  13612.     SPACE       : STRING_TYPE := CREATE(" "); 
  13613.   begin
  13614.     ITERATOR := STRING_LISTS.MAKELISTITER(L); 
  13615.     while MORE(ITERATOR) loop
  13616.       NEXT(ITERATOR, NEXT_OBJECT); 
  13617.       if EQUAL(TEMP, NO_NAME) then 
  13618.         TEMP := NEXT_OBJECT; 
  13619.       else 
  13620.         TEMP := TEMP & SPACE & NEXT_OBJECT; 
  13621.       end if; 
  13622.     end loop; 
  13623.     return TEMP; 
  13624.   end CONVERT_LIST_TO_STRING_TYPE; 
  13625.  
  13626.   ---------------------------------------------------------
  13627.  
  13628.   function CONVERT_STRING_TO_LIST(S : in STRING) return STRING_LIST is 
  13629.  
  13630.   --| Make a list of string_types out of a literal string.  Scan
  13631.   --| the input string for the next blank, or the end, and create
  13632.   --| a string_type object out of it to attach to the list.
  13633.  
  13634.     START : POSITIVE := 1; 
  13635.     TEMP  : STRING_LIST; 
  13636.  
  13637.   begin
  13638.     TEMP := STRING_LISTS.CREATE; 
  13639.     for I in S'FIRST .. S'LAST + 1 loop
  13640.       if (I = S'LAST + 1 or else S(I) = ' ') and then START < I then 
  13641.         STRING_LISTS.ATTACH(TEMP, CREATE(S(START .. I - 1))); 
  13642.         START := I + 1; 
  13643.       end if; 
  13644.     end loop; 
  13645.     return TEMP; 
  13646.   end CONVERT_STRING_TO_LIST; 
  13647.  
  13648.   ---------------------------------------------------------
  13649.  
  13650.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) 
  13651.        return STRING is 
  13652.  
  13653.   --| Read the next LENGTH characters from the external file
  13654.   --| and return them as a string.
  13655.  
  13656.     RETURN_STRING : STRING(1 .. LENGTH); 
  13657.     CH            : CHARACTER; 
  13658.     INDEX         : POSITIVE; 
  13659.   begin
  13660.     for I in RETURN_STRING'range loop
  13661.       GET(EXTERNAL_FILE, CH); 
  13662.       RETURN_STRING(I) := CH; 
  13663.     end loop; 
  13664.  
  13665.     -- read past the terminator
  13666.     if CH /= TERMINATOR then 
  13667.       GET(EXTERNAL_FILE, CH); 
  13668.     end if; 
  13669.     return RETURN_STRING; 
  13670.   end GET_FIXED_LENGTH_TABLE_ENTRY; 
  13671.  
  13672.   ---------------------------------------------------------
  13673.  
  13674.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE is 
  13675.   --| Scan the external file until a terminator ('*') is found,
  13676.   --| and return a string_type of the characters scanned.
  13677.  
  13678.     RETURN_STRING : STRING_TYPE; 
  13679.     CH            : CHARACTER := ' '; 
  13680.     TMP_STRING    : LONG_STRING; 
  13681.     INDEX         : NATURAL := 0; 
  13682.   begin
  13683.     RETURN_STRING := CREATE(""); 
  13684.     while CH /= TERMINATOR loop
  13685.       for I in LONG_STRING'range loop
  13686.         GET(EXTERNAL_FILE, CH); 
  13687.         exit when CH = TERMINATOR; 
  13688.         INDEX := I; 
  13689.         TMP_STRING(INDEX) := CH; 
  13690.       end loop; 
  13691.       RETURN_STRING := RETURN_STRING & CREATE(TMP_STRING(1 .. INDEX)); 
  13692.     end loop; 
  13693.     return RETURN_STRING; 
  13694.   end GET_VARIABLE_LENGTH_TABLE_ENTRY; 
  13695.  
  13696.   ---------------------------------------------------------
  13697.  
  13698.   procedure CREATE_INTERNAL_TABLE is 
  13699.  
  13700.   --| Read the external file and build an internal version of it 
  13701.   --| as a linked list.
  13702.  
  13703.     TABLE_ENTRY : TABLE_ENTRY_RECORD; 
  13704.   begin
  13705.     INTERNAL_TABLE := INTERNAL_LIST_PACKAGE.CREATE; 
  13706.     TEXT_IO.OPEN(EXTERNAL_FILE, IN_FILE, 
  13707.                  VALUE(SP.CURRENT_PROGRAM_LIBRARY) & EXTERNAL_FILENAME); 
  13708.  
  13709.     while not TEXT_IO.END_OF_FILE(EXTERNAL_FILE) loop
  13710.       TABLE_ENTRY.PACKAGE_ADA_NAME := 
  13711.          MAKE_PERSISTENT(GET_VARIABLE_LENGTH_TABLE_ENTRY); 
  13712.       TABLE_ENTRY.PACKAGE_FILENAME := 
  13713.          GET_FIXED_LENGTH_TABLE_ENTRY(FILE_PREFIX_LIMIT); 
  13714.       TABLE_ENTRY.WITHED_UNITS := 
  13715.          MAKE_PERSISTENT(GET_VARIABLE_LENGTH_TABLE_ENTRY); 
  13716.       TABLE_ENTRY.DATE_CREATED := 
  13717.          GET_FIXED_LENGTH_TABLE_ENTRY(DATE_STRING'LENGTH); 
  13718.       TABLE_ENTRY.TIME_CREATED := 
  13719.          GET_FIXED_LENGTH_TABLE_ENTRY(TIME_STRING'LENGTH); 
  13720.       TEXT_IO.SKIP_LINE(EXTERNAL_FILE); 
  13721.       ATTACH(INTERNAL_TABLE, TABLE_ENTRY); 
  13722.     end loop; 
  13723.  
  13724.     INTERNAL_TABLE_CREATED := TRUE; 
  13725.     TEXT_IO.CLOSE(EXTERNAL_FILE); 
  13726.  
  13727.   exception
  13728.     when TEXT_IO.NAME_ERROR => 
  13729.       INTERNAL_TABLE_CREATED := TRUE; 
  13730.   end CREATE_INTERNAL_TABLE; 
  13731.  
  13732.   ---------------------------------------------------------
  13733.  
  13734.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) 
  13735.       return BOOLEAN is 
  13736.  
  13737.   --| Search the Internal_Table to see if the filename prefix
  13738.   --| string already exists.
  13739.  
  13740.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  13741.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  13742.  
  13743.   begin
  13744.     TABLE_POINTER := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  13745.  
  13746.     while MORE(TABLE_POINTER) loop
  13747.       NEXT(TABLE_POINTER, TABLE_ENTRY); 
  13748.       if TABLE_ENTRY.PACKAGE_FILENAME = FILENAME then 
  13749.         return TRUE; 
  13750.       end if; 
  13751.     end loop; 
  13752.  
  13753.     return FALSE; 
  13754.  
  13755.   end FILENAME_IN_TABLE; 
  13756.  
  13757.   ---------------------------------------------------------
  13758.  
  13759.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  13760.       return FILENAME_PREFIX_STRING is
  13761.  
  13762.   --| Formulate a unique filename prefix for each package name.
  13763.  
  13764.     TEMP, FILENAME_STRING : FILENAME_PREFIX_STRING := (others => 'X'); 
  13765.     FILENAME_INDEX        : NATURAL := 1; 
  13766.     subtype A_TO_Z is CHARACTER range 'A' .. 'Z'; 
  13767.  
  13768.     function NEXT_CHARACTER(CH : in A_TO_Z) return A_TO_Z is
  13769.     begin
  13770.       if CH not in A_TO_Z or else CH = A_TO_Z'LAST then
  13771.         return A_TO_Z'FIRST;
  13772.       else
  13773.         return A_TO_Z'SUCC(CH);
  13774.       end if;
  13775.     end NEXT_CHARACTER;
  13776.  
  13777.   begin
  13778.  
  13779.     -- Extract the first "file_prefix_limit" characters from the
  13780.     -- package name to form the basic prefix of the filename.
  13781.  
  13782.     for I in 1 .. PACKAGE_NAME'LENGTH loop
  13783.       if PACKAGE_NAME(I) /= '_' and PACKAGE_NAME(I) /= '.' then 
  13784.         FILENAME_STRING(FILENAME_INDEX) := PACKAGE_NAME(I); 
  13785.         FILENAME_INDEX := FILENAME_INDEX + 1; 
  13786.         exit when FILENAME_INDEX > FILE_PREFIX_LIMIT; 
  13787.       end if; 
  13788.     end loop; 
  13789.  
  13790.     --  Now check the Internal_Table to be sure that the Filename_String
  13791.     --  is unique.  If not, try all permutations of A to Z until a unique 
  13792.     --  name is found.  This scheme allows 26**8 unique names.
  13793.  
  13794.     TEMP := FILENAME_STRING;    
  13795.     loop
  13796.       if not FILENAME_IN_TABLE(TEMP) then
  13797.          return TEMP;
  13798.       end if;
  13799.       for I in reverse 1 .. FILE_PREFIX_LIMIT loop
  13800.         TEMP(I) := NEXT_CHARACTER(TEMP(I));
  13801.         exit when TEMP(I) /= FILENAME_STRING(I);
  13802.       end loop; 
  13803.       exit when TEMP = FILENAME_STRING;
  13804.     end loop; 
  13805.  
  13806.     TEXT_IO.PUT_LINE
  13807.       ("Symbolic Debugger terminating:");
  13808.     TEXT_IO.PUT_LINE("Unable to create a unique" &
  13809.                      INTEGER'IMAGE(FILE_PREFIX_LIMIT) & 
  13810.                      " character filename for");
  13811.     TEXT_IO.PUT_LINE(PACKAGE_NAME);
  13812.  
  13813.     raise STORAGE_ERROR; -- for lack of a better one at the moment.
  13814.  
  13815.   end MAKE_FILENAME_PREFIX; 
  13816.  
  13817.   ---------------------------------------------------------
  13818.  
  13819.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  13820.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  13821.                                      FOUND        : in out BOOLEAN) is 
  13822.  
  13823.     ITERATOR      : INTERNAL_LIST_PACKAGE.LISTITER; 
  13824.     NEXT_ENTRY    : TABLE_ENTRY_RECORD; 
  13825.     NAME_TO_MATCH : STRING_PKG.STRING_TYPE; 
  13826.  
  13827.   begin
  13828.     if not INTERNAL_TABLE_CREATED then 
  13829.       CREATE_INTERNAL_TABLE; 
  13830.     end if; 
  13831.  
  13832.     STRING_PKG.MARK; 
  13833.     NAME_TO_MATCH := UPPER(PACKAGE_NAME); 
  13834.  
  13835.     TABLE_ENTRY := NEXT_ENTRY; 
  13836.     FOUND := FALSE; 
  13837.  
  13838.     ITERATOR := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  13839.     while MORE(ITERATOR) and not FOUND loop
  13840.       NEXT(ITERATOR, NEXT_ENTRY); 
  13841.       if EQUAL(NEXT_ENTRY.PACKAGE_ADA_NAME, NAME_TO_MATCH) then 
  13842.         TABLE_ENTRY := NEXT_ENTRY; 
  13843.         FOUND := TRUE; 
  13844.       end if; 
  13845.     end loop; 
  13846.  
  13847.     STRING_PKG.RELEASE; 
  13848.   end GET_INTERNAL_TABLE_ENTRY; 
  13849.  
  13850.   ---------------------------------------------------------
  13851.  
  13852.   function START_PACKAGE(PACKAGE_NAME : in STRING) 
  13853.       return FILENAME_PREFIX_STRING is 
  13854.  
  13855.   --| Create a table entry for the package and return its unique
  13856.   --| filename prefix.  This is called at the start of procedure
  13857.   --| Create_Package_Files.
  13858.  
  13859.     ENTRY_EXISTS          : BOOLEAN := FALSE; 
  13860.     CURRENT_TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  13861.     CURRENT_DATE_AND_TIME : CALENDAR.TIME; 
  13862.     CURRENT_DATE          : DATE_STRING; 
  13863.     CURRENT_TIME          : STRING(1 .. 11); 
  13864.  
  13865.   begin
  13866.  
  13867.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, CURRENT_TABLE_ENTRY, ENTRY_EXISTS); 
  13868.  
  13869.     if not ENTRY_EXISTS then 
  13870.       CURRENT_TABLE_ENTRY.PACKAGE_ADA_NAME := 
  13871.          MAKE_PERSISTENT(UPPER(PACKAGE_NAME)); 
  13872.       CURRENT_TABLE_ENTRY.PACKAGE_FILENAME :=
  13873.          MAKE_FILENAME_PREFIX(PACKAGE_NAME); 
  13874.     else 
  13875.       -- If the table entry exists, delete it so a new one can be added
  13876.       -- with updated date and time fields.
  13877.       DELETEITEM(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  13878.  
  13879.     end if; 
  13880.  
  13881.     CURRENT_DATE_AND_TIME := CALENDAR.CLOCK; 
  13882.     CURRENT_DATE := DATE_OF(CALENDAR.CLOCK); 
  13883.     CURRENT_TIME := WALL_CLOCK_OF(CALENDAR.SECONDS(CURRENT_DATE_AND_TIME)); 
  13884.  
  13885.     CURRENT_TABLE_ENTRY.DATE_CREATED := CURRENT_DATE; 
  13886.     CURRENT_TABLE_ENTRY.TIME_CREATED := 
  13887.        CURRENT_TIME(1 .. TIME_STRING'LENGTH); 
  13888.  
  13889.     ATTACH(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  13890.     INTERNAL_TABLE_CHANGED := TRUE; 
  13891.  
  13892.     return CURRENT_TABLE_ENTRY.PACKAGE_FILENAME; 
  13893.  
  13894.   end START_PACKAGE; 
  13895.  
  13896.   ---------------------------------------------------------------------------
  13897.  
  13898.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  13899.       return FILENAME_PREFIX_STRING is 
  13900.  
  13901.   --| Return the filename prefix for the specified package, or
  13902.   --| NO_FILENAME if there isn't an entry for the package.
  13903.  
  13904.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  13905.     ENTRY_EXISTS : BOOLEAN := FALSE; 
  13906.  
  13907.   begin
  13908.  
  13909.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  13910.  
  13911.     if not ENTRY_EXISTS then 
  13912.       return NO_FILENAME; 
  13913.     else 
  13914.       return TABLE_ENTRY.PACKAGE_FILENAME; 
  13915.     end if; 
  13916.  
  13917.   end GET_FILENAME_PREFIX; 
  13918.  
  13919.   -------------------------------------------------------------------------
  13920.  
  13921.  
  13922. end SD_BUFFER_FILES;
  13923. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13924. --CATALOG.SPC
  13925. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13926. with TEXT_IO; use TEXT_IO; 
  13927. with LISTS; 
  13928. with STRING_PKG; use STRING_PKG; 
  13929. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  13930.  
  13931. package CATALOG_PKG is 
  13932.  
  13933. --| Overview
  13934. --| This package contains cataloging procedures needed by the debugger
  13935. --| for source file tracing.  The Source Instrumenter prepares programs 
  13936. --| for use with the debugger.
  13937. --|
  13938. --| A procedure is supplied for storing the indicated source file in the
  13939. --| library creating a unique name for cataloging.  Another procedure is
  13940. --| provided for deleting the file from the library removing the 
  13941. --| corrosponding reference in the catalog.
  13942. --|
  13943. --| A file is created for each compilation_unit to contain the listing
  13944. --| file needed by the debugger for display.  The procedures in this 
  13945. --| package manage these files.  A table which equates a unique filename 
  13946. --| prefix with each package name is maintained in an external file.
  13947. --|
  13948. --| Requires
  13949. --| The following declarations for file naming are used:
  13950. --|
  13951. --| "File_Prefix_Limit" is currently set to 8 characters, and indicates
  13952. --| the number of characters in a filename to the left of the dot.
  13953. --|
  13954. --| "File_Suffix_Limit" is currently set to 4 characters; a dot and
  13955. --| a 3 character file extension.
  13956. --|
  13957. --| N/A: Errors, Raises, Modifies
  13958.  
  13959.  
  13960. --------------------------------------------------------------------------
  13961.  
  13962.   PUBLIC_FILE        : FILE_TYPE; 
  13963.   --| the corresponding package body
  13964.  
  13965.   PUBLIC_FILE_SUFFIX : constant STRING(1 .. FILE_SUFFIX_LIMIT) := 
  13966.                        CATALOG_FILENAME_EXTENSION; 
  13967.  
  13968.   EXTERNAL_FILENAME  : constant STRING := PROGRAM_LIBRARY_CATALOG;
  13969.  
  13970.   subtype FILENAME_PREFIX_STRING is STRING(1 .. FILE_PREFIX_LIMIT); 
  13971.  
  13972.   ----------------------------------------------------------------------------
  13973.   -- The following procedures manage the package tracing files.
  13974.   ----------------------------------------------------------------------------
  13975.  
  13976.   function CATALOG_FILE(PACKAGE_NAME : in STRING) return 
  13977.            FILENAME_PREFIX_STRING; 
  13978.  
  13979.   --| Effects
  13980.  
  13981.   --| This procedure obtains a filename prefix based on the current package
  13982.   --| name, appends the appropriate suffix, and creates the Text_IO files. 
  13983.   --| The source instrumenter saves package tracing information in these files.
  13984.  
  13985.   ----------------------------------------------------------------------------
  13986.  
  13987.   procedure REMOVE_CATALOG_FILE(PACKAGE_NAME : in STRING); 
  13988.  
  13989.   --| Effects
  13990.  
  13991.   --| This procedure determines the name of the external files if the
  13992.   --| Current_Filename_Prefix is not already known, and deletes the 
  13993.   --| files if they exist.   
  13994.  
  13995.   -----------------------------------------------------------------------------
  13996.  
  13997. end CATALOG_PKG; 
  13998. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13999. --CATALOG.BDY
  14000. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14001. with CALENDAR; 
  14002. with TIME_LIBRARY_1; use TIME_LIBRARY_1; 
  14003.  
  14004. package body CATALOG_PKG is 
  14005.  
  14006.   subtype DATE_STRING is STRING(1 .. 8); 
  14007.   subtype TIME_STRING is STRING(1 .. 8); 
  14008.  
  14009.   NO_DATE     : constant DATE_STRING := (others => ' '); 
  14010.   NO_TIME     : constant TIME_STRING := (others => ' '); 
  14011.   NO_NAME     : constant STRING_PKG.STRING_TYPE := CREATE(""); 
  14012.  
  14013.   NO_FILENAME : constant FILENAME_PREFIX_STRING := (others => ' '); 
  14014.  
  14015.   type TABLE_ENTRY_RECORD is  --| Record format for table entries
  14016.     record
  14017.       PACKAGE_ADA_NAME : STRING_PKG.STRING_TYPE := NO_NAME; 
  14018.       --| Fully qualified package name
  14019.       PACKAGE_FILENAME : FILENAME_PREFIX_STRING := NO_FILENAME; 
  14020.       --| Filename prefix
  14021.       DATE_CREATED     : DATE_STRING := NO_DATE; 
  14022.       --| Date the file was created
  14023.       TIME_CREATED     : TIME_STRING := NO_TIME; 
  14024.       --| Time the file was created
  14025.     end record; 
  14026.  
  14027.   -- Function EQUAL for the instantiation of the Lists package
  14028.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN; 
  14029.  
  14030.   package INTERNAL_LIST_PACKAGE is 
  14031.     new LISTS(TABLE_ENTRY_RECORD, TABLE_EQUAL); 
  14032.   use INTERNAL_LIST_PACKAGE; 
  14033.  
  14034.   INTERNAL_TABLE         : INTERNAL_LIST_PACKAGE.LIST; 
  14035.   --| A linked list of table entry records, for equating package names
  14036.   --| with their filename prefix for instrumenting information files.  The
  14037.   --| list is built by reading the external file.
  14038.  
  14039.   INTERNAL_TABLE_CREATED : BOOLEAN := FALSE; 
  14040.   INTERNAL_TABLE_CHANGED : BOOLEAN := FALSE; 
  14041.  
  14042.   EXTERNAL_FILE          : TEXT_IO.FILE_TYPE; 
  14043.   --| The external file of package name, filename prefix information.
  14044.   --| The internal table is written to the external file each time a
  14045.   --| change occurs.
  14046.  
  14047.   TERMINATOR             : constant CHARACTER := '*'; 
  14048.   --| Mark the end of a table_entry_record field in the external file
  14049.  
  14050.   subtype LONG_STRING is STRING(1 .. 255); 
  14051.   --| Used for reading a line of text from one of the files.  It is
  14052.   --| assumed that most lines will be less than 255 characters and
  14053.   --| this choice should be adequate most of the time.  Procedures
  14054.   --| which do the reading must allow for cases where lines are longer
  14055.   --| than 255.
  14056.  
  14057.   
  14058.   ------------------------------------------------------------------------
  14059.   --  Local procedure specificatons
  14060.   -------------------------------------------------------------------------
  14061.  
  14062.   procedure CREATE_INTERNAL_TABLE; 
  14063.  
  14064.   --| overview
  14065.   --| Reads the external file and builds an internal version of it 
  14066.   --| as a linked list.
  14067.  
  14068.   --------------------------------------------------------------------------
  14069.  
  14070.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) return
  14071.     BOOLEAN; 
  14072.  
  14073.   --| overview
  14074.   --| Searches the Internal_Table for the occurrence of the 
  14075.   --| specified filename prefix.
  14076.  
  14077.   ----------------------------------------------------------------------------
  14078.  
  14079.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING) return
  14080.     FILENAME_PREFIX_STRING; 
  14081.  
  14082.   --| overview
  14083.   --| Formulates and returns a unique filename prefix for each package name. 
  14084.  
  14085.   ----------------------------------------------------------------------------
  14086.  
  14087.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) return STRING; 
  14088.  
  14089.   --| overview
  14090.   --| Retuns a string of the next "length" characters read from the
  14091.   --| external file.
  14092.  
  14093.   ----------------------------------------------------------------------------
  14094.  
  14095.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE; 
  14096.  
  14097.   --| overview
  14098.   --| Reads any number of characters in the external file until the
  14099.   --| terminator character ('*') is found and returns them as a string_type.
  14100.  
  14101.   ----------------------------------------------------------------------------
  14102.  
  14103.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  14104.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  14105.                                      FOUND        : in out BOOLEAN); 
  14106.  
  14107.   --| overview
  14108.   --| Scan the internal table for an entry for Package_Name, 
  14109.   --| and if found, pass it back to the calling procedure.
  14110.  
  14111.   ---------------------------------------------------------
  14112.  
  14113.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  14114.            return FILENAME_PREFIX_STRING; 
  14115.  
  14116.   --| overview
  14117.   --| If the package is in the table, return its filename prefix.  If 
  14118.   --| there isn't an entry return No_Filename.
  14119.  
  14120.   ---------------------------------------------------------
  14121.  
  14122.   procedure DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING); 
  14123.  
  14124.   --| overview
  14125.   --| Delete the entry for this package from the Internal_Table.
  14126.  
  14127.   ---------------------------------------------------------
  14128.  
  14129.   procedure SAVE_EXTERNAL_FILE; 
  14130.  
  14131.   --| effects
  14132.   --| This procedure writes the internal table of package_name-file_name
  14133.   --| information to the permanent external table file.
  14134.  
  14135.   ---------------------------------------------------------------
  14136.   --  External procedures for managing the package tracing files.
  14137.   ---------------------------------------------------------------
  14138.  
  14139.   function CATALOG_FILE(PACKAGE_NAME : in STRING) 
  14140.            return FILENAME_PREFIX_STRING is 
  14141.  
  14142.     --| overview
  14143.     --| Create a table entry for the package and return its unique
  14144.     --| filename prefix.  
  14145.  
  14146.     ENTRY_EXISTS          : BOOLEAN := FALSE; 
  14147.     CURRENT_TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  14148.     CURRENT_DATE_AND_TIME : CALENDAR.TIME; 
  14149.     CURRENT_DATE          : DATE_STRING; 
  14150.     CURRENT_TIME          : STRING(1 .. 11); 
  14151.  
  14152.   begin
  14153.  
  14154.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, CURRENT_TABLE_ENTRY, ENTRY_EXISTS); 
  14155.  
  14156.     if not ENTRY_EXISTS then 
  14157.       CURRENT_TABLE_ENTRY.PACKAGE_ADA_NAME := MAKE_PERSISTENT(UPPER(PACKAGE_NAME
  14158.         )); 
  14159.       CURRENT_TABLE_ENTRY.PACKAGE_FILENAME := MAKE_FILENAME_PREFIX(PACKAGE_NAME)
  14160.         ; 
  14161.     else 
  14162.     -- If the table entry exists, delete it so a new one can be added
  14163.     -- with updated date and time fields.
  14164.       DELETEITEM(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  14165.  
  14166.     end if; 
  14167.  
  14168.     CURRENT_DATE_AND_TIME := CALENDAR.CLOCK; 
  14169.     CURRENT_DATE := DATE_OF(CALENDAR.CLOCK); 
  14170.     CURRENT_TIME := WALL_CLOCK_OF(CALENDAR.SECONDS(CURRENT_DATE_AND_TIME)); 
  14171.  
  14172.     CURRENT_TABLE_ENTRY.DATE_CREATED := CURRENT_DATE; 
  14173.     CURRENT_TABLE_ENTRY.TIME_CREATED := CURRENT_TIME(1 .. TIME_STRING'LENGTH); 
  14174.  
  14175.     ATTACH(INTERNAL_TABLE, CURRENT_TABLE_ENTRY); 
  14176.     INTERNAL_TABLE_CHANGED := TRUE; 
  14177.  
  14178.     SAVE_EXTERNAL_FILE;
  14179.     return CURRENT_TABLE_ENTRY.PACKAGE_FILENAME; 
  14180.  
  14181.   end CATALOG_FILE; 
  14182.  
  14183.   ---------------------------------------------------------
  14184.  
  14185.   procedure REMOVE_CATALOG_FILE(PACKAGE_NAME : in STRING) is 
  14186.  
  14187.     --| overview
  14188.     --| Delete the indicated set of package tracing files.  If all the
  14189.     --| files are deleted, then also delete the internal table entry for 
  14190.     --| the package.
  14191.  
  14192.     CATALOG_FILE            : FILE_TYPE; 
  14193.     PACKAGE_FILENAME_PREFIX : FILENAME_PREFIX_STRING; 
  14194.  
  14195.   begin
  14196.  
  14197.     PACKAGE_FILENAME_PREFIX := GET_FILENAME_PREFIX(PACKAGE_NAME); 
  14198.  
  14199.     -- if the files can be opened, then they exist.  Delete them.
  14200.     -- Otherwise, there is nothing to delete so ignore it.
  14201.  
  14202.     if PACKAGE_FILENAME_PREFIX /= NO_FILENAME then 
  14203.  
  14204.       begin
  14205.         OPEN(CATALOG_FILE, OUT_FILE, VALUE(CURRENT_PROGRAM_LIBRARY)
  14206.            & PACKAGE_FILENAME_PREFIX
  14207.           & PUBLIC_FILE_SUFFIX); 
  14208.         DELETE(CATALOG_FILE); 
  14209.  
  14210.       exception
  14211.         when NAME_ERROR => 
  14212.           null; 
  14213.  
  14214.       end; 
  14215.  
  14216.       DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME); 
  14217.       SAVE_EXTERNAL_FILE; 
  14218.  
  14219.     end if; 
  14220.  
  14221.   -- Filename /= No_Filename
  14222.   end REMOVE_CATALOG_FILE; 
  14223.  
  14224.   ------------------------------------------------------------------------
  14225.   --  Local procedure bodies
  14226.   -------------------------------------------------------------------------
  14227.  
  14228.   procedure SAVE_EXTERNAL_FILE is 
  14229.  
  14230.   --| overview
  14231.   --| Write the internal table list to the extenal file if it has changed.
  14232.  
  14233.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  14234.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  14235.  
  14236.   begin
  14237.  
  14238.     if INTERNAL_TABLE_CREATED and INTERNAL_TABLE_CHANGED then 
  14239.       begin
  14240.         OPEN(EXTERNAL_FILE, OUT_FILE, VALUE(CURRENT_PROGRAM_LIBRARY) 
  14241.              & EXTERNAL_FILENAME); 
  14242.         RESET(EXTERNAL_FILE); 
  14243.       exception
  14244.         when TEXT_IO.NAME_ERROR => 
  14245.           CREATE(EXTERNAL_FILE, OUT_FILE, VALUE(CURRENT_PROGRAM_LIBRARY) 
  14246.                & EXTERNAL_FILENAME)
  14247.             ; 
  14248.       end; 
  14249.  
  14250.       TABLE_POINTER := MAKELISTITER(INTERNAL_TABLE); 
  14251.  
  14252.       while MORE(TABLE_POINTER) loop
  14253.         NEXT(TABLE_POINTER, TABLE_ENTRY); 
  14254.  
  14255.         PUT(EXTERNAL_FILE, VALUE(TABLE_ENTRY.PACKAGE_ADA_NAME)); 
  14256.         PUT(EXTERNAL_FILE, TERMINATOR); 
  14257.  
  14258.         PUT(EXTERNAL_FILE, TABLE_ENTRY.PACKAGE_FILENAME); 
  14259.         PUT(EXTERNAL_FILE, TERMINATOR); 
  14260.  
  14261.         PUT(EXTERNAL_FILE, TABLE_ENTRY.DATE_CREATED); 
  14262.         PUT(EXTERNAL_FILE, TERMINATOR); 
  14263.  
  14264.         PUT(EXTERNAL_FILE, TABLE_ENTRY.TIME_CREATED); 
  14265.         PUT(EXTERNAL_FILE, TERMINATOR); 
  14266.         NEW_LINE(EXTERNAL_FILE); 
  14267.       end loop; 
  14268.  
  14269.       if ISEMPTY(INTERNAL_TABLE) then
  14270.         DELETE(EXTERNAL_FILE);
  14271.       else
  14272.         CLOSE(EXTERNAL_FILE); 
  14273.       end if;
  14274.  
  14275.       INTERNAL_LIST_PACKAGE.DESTROY(INTERNAL_TABLE); 
  14276.       INTERNAL_TABLE_CREATED := FALSE; 
  14277.       INTERNAL_TABLE_CHANGED := FALSE; 
  14278.     end if; 
  14279.   end SAVE_EXTERNAL_FILE; 
  14280.  
  14281.   -----------------------------------------------------------------------------
  14282.  
  14283.   procedure CREATE_INTERNAL_TABLE is 
  14284.  
  14285.     --| overview
  14286.     --| Read the external file and build an internal version of it 
  14287.     --| as a linked list.
  14288.  
  14289.     TABLE_ENTRY : TABLE_ENTRY_RECORD; 
  14290.  
  14291.   begin
  14292.  
  14293.     INTERNAL_TABLE := INTERNAL_LIST_PACKAGE.CREATE; 
  14294.     TEXT_IO.OPEN(EXTERNAL_FILE, IN_FILE, VALUE(CURRENT_PROGRAM_LIBRARY) 
  14295.           & EXTERNAL_FILENAME)
  14296.       ; 
  14297.  
  14298.     while not TEXT_IO.END_OF_FILE(EXTERNAL_FILE) loop
  14299.       TABLE_ENTRY.PACKAGE_ADA_NAME := MAKE_PERSISTENT(
  14300.         GET_VARIABLE_LENGTH_TABLE_ENTRY); 
  14301.       TABLE_ENTRY.PACKAGE_FILENAME := GET_FIXED_LENGTH_TABLE_ENTRY(
  14302.         FILE_PREFIX_LIMIT); 
  14303.       TABLE_ENTRY.DATE_CREATED := GET_FIXED_LENGTH_TABLE_ENTRY(DATE_STRING'
  14304.         LENGTH); 
  14305.       TABLE_ENTRY.TIME_CREATED := GET_FIXED_LENGTH_TABLE_ENTRY(TIME_STRING'
  14306.         LENGTH); 
  14307.       TEXT_IO.SKIP_LINE(EXTERNAL_FILE); 
  14308.       ATTACH(INTERNAL_TABLE, TABLE_ENTRY); 
  14309.     end loop; 
  14310.  
  14311.     INTERNAL_TABLE_CREATED := TRUE; 
  14312.     TEXT_IO.CLOSE(EXTERNAL_FILE); 
  14313.  
  14314.   exception
  14315.     when TEXT_IO.NAME_ERROR => 
  14316.       INTERNAL_TABLE_CREATED := TRUE; 
  14317.  
  14318.   end CREATE_INTERNAL_TABLE; 
  14319.  
  14320.   ---------------------------------------------------------
  14321.  
  14322.   function FILENAME_IN_TABLE(FILENAME : in FILENAME_PREFIX_STRING) 
  14323.            return BOOLEAN is 
  14324.  
  14325.     --| overview
  14326.     --| Search the Internal_Table to see if the filename prefix
  14327.     --| string already exists.
  14328.  
  14329.     TABLE_POINTER : INTERNAL_LIST_PACKAGE.LISTITER; 
  14330.     TABLE_ENTRY   : TABLE_ENTRY_RECORD; 
  14331.  
  14332.   begin
  14333.  
  14334.     TABLE_POINTER := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  14335.  
  14336.     while MORE(TABLE_POINTER) loop
  14337.       NEXT(TABLE_POINTER, TABLE_ENTRY); 
  14338.       if TABLE_ENTRY.PACKAGE_FILENAME = FILENAME then 
  14339.         return TRUE; 
  14340.       end if; 
  14341.     end loop; 
  14342.  
  14343.     return FALSE; 
  14344.  
  14345.   end FILENAME_IN_TABLE; 
  14346.  
  14347.   ---------------------------------------------------------
  14348.  
  14349.   function MAKE_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  14350.            return FILENAME_PREFIX_STRING is 
  14351.  
  14352.   --| overview
  14353.   --| Formulate a unique filename prefix for each package name.
  14354.  
  14355.   TEMP, FILENAME_STRING : FILENAME_PREFIX_STRING := (others => 'X'); 
  14356.   FILENAME_INDEX        : NATURAL := 1; 
  14357.   subtype A_TO_Z is CHARACTER range 'A' .. 'Z'; 
  14358.   NUMBER_OF_TRIES       : INTEGER := 1;
  14359.  
  14360.   function NEXT_CHARACTER(CH : in CHARACTER) return A_TO_Z is
  14361.  
  14362.   begin
  14363.     if CH not in A_TO_Z or else CH = A_TO_Z'LAST then
  14364.       return A_TO_Z'FIRST;
  14365.     else
  14366.       return A_TO_Z'SUCC(CH);
  14367.     end if;
  14368.   end NEXT_CHARACTER;
  14369.  
  14370.   begin
  14371.  
  14372.   -- Extract the first "file_prefix_limit" characters from the
  14373.   -- package name to form the basic prefix of the filename.
  14374.  
  14375.     for I in 1 .. PACKAGE_NAME'LENGTH loop
  14376.       if PACKAGE_NAME(I) /= '_' and PACKAGE_NAME(I) /= '.' then 
  14377.         FILENAME_STRING(FILENAME_INDEX) := PACKAGE_NAME(I); 
  14378.         FILENAME_INDEX := FILENAME_INDEX + 1; 
  14379.         exit when FILENAME_INDEX > FILE_PREFIX_LIMIT; 
  14380.       end if; 
  14381.     end loop; 
  14382.  
  14383.     --  Now check the Internal_Table to be sure that the Filename_String
  14384.     --  is unique.  If not, try all permutations of A to Z until a unique 
  14385.     --  name is found.  This scheme allows 26**8 unique names.
  14386.  
  14387.     TEMP := FILENAME_STRING;    
  14388.     loop
  14389.       if not FILENAME_IN_TABLE(TEMP) then
  14390.          return TEMP;
  14391.       end if;
  14392.       for I in reverse 1 .. FILE_PREFIX_LIMIT loop
  14393.         TEMP(I) := NEXT_CHARACTER(TEMP(I));
  14394.         exit when NUMBER_OF_TRIES < 26;
  14395.         NUMBER_OF_TRIES := 1;
  14396.       end loop; 
  14397.       NUMBER_OF_TRIES := NUMBER_OF_TRIES + 1;
  14398.       exit when TEMP = FILENAME_STRING;
  14399.     end loop; 
  14400.  
  14401.   end MAKE_FILENAME_PREFIX; 
  14402.  
  14403.   ---------------------------------------------------------
  14404.  
  14405.   procedure GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING; 
  14406.                                      TABLE_ENTRY  : out TABLE_ENTRY_RECORD; 
  14407.                                      FOUND        : in out BOOLEAN) is 
  14408.  
  14409.     ITERATOR      : INTERNAL_LIST_PACKAGE.LISTITER; 
  14410.     NEXT_ENTRY    : TABLE_ENTRY_RECORD; 
  14411.     NAME_TO_MATCH : STRING_PKG.STRING_TYPE; 
  14412.  
  14413.   begin
  14414.  
  14415.     if not INTERNAL_TABLE_CREATED then 
  14416.       CREATE_INTERNAL_TABLE; 
  14417.     end if; 
  14418.  
  14419.     STRING_PKG.MARK; 
  14420.     NAME_TO_MATCH := UPPER(PACKAGE_NAME); 
  14421.  
  14422.     TABLE_ENTRY := NEXT_ENTRY; 
  14423.     FOUND := FALSE; 
  14424.  
  14425.     ITERATOR := INTERNAL_LIST_PACKAGE.MAKELISTITER(INTERNAL_TABLE); 
  14426.     while MORE(ITERATOR) and not FOUND loop
  14427.       NEXT(ITERATOR, NEXT_ENTRY); 
  14428.       if EQUAL(NEXT_ENTRY.PACKAGE_ADA_NAME, NAME_TO_MATCH) then 
  14429.         TABLE_ENTRY := NEXT_ENTRY; 
  14430.         FOUND := TRUE; 
  14431.       end if; 
  14432.     end loop; 
  14433.  
  14434.     STRING_PKG.RELEASE; 
  14435.  
  14436.   end GET_INTERNAL_TABLE_ENTRY; 
  14437.  
  14438.   ---------------------------------------------------------
  14439.  
  14440.   function GET_FILENAME_PREFIX(PACKAGE_NAME : in STRING) 
  14441.            return FILENAME_PREFIX_STRING is 
  14442.  
  14443.     --| overview
  14444.     --| Return the filename prefix for the specified package, or
  14445.     --| NO_FILENAME if there isn't an entry for the package.
  14446.  
  14447.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  14448.     ENTRY_EXISTS : BOOLEAN := FALSE; 
  14449.  
  14450.   begin
  14451.  
  14452.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  14453.  
  14454.     if not ENTRY_EXISTS then 
  14455.       return NO_FILENAME; 
  14456.     else 
  14457.       return TABLE_ENTRY.PACKAGE_FILENAME; 
  14458.     end if; 
  14459.  
  14460.   end GET_FILENAME_PREFIX; 
  14461.  
  14462.   -------------------------------------------------------------------------
  14463.  
  14464.   procedure DELETE_INTERNAL_TABLE_ENTRY(PACKAGE_NAME : in STRING) is 
  14465.  
  14466.     --| overview
  14467.     --| Delete an entry from the internal table.
  14468.  
  14469.     TABLE_ENTRY  : TABLE_ENTRY_RECORD; 
  14470.     ENTRY_EXISTS : BOOLEAN := FALSE; 
  14471.  
  14472.   begin
  14473.  
  14474.     GET_INTERNAL_TABLE_ENTRY(PACKAGE_NAME, TABLE_ENTRY, ENTRY_EXISTS); 
  14475.  
  14476.     if ENTRY_EXISTS then 
  14477.       DELETEITEM(INTERNAL_TABLE, TABLE_ENTRY); 
  14478.       INTERNAL_TABLE_CHANGED := TRUE; 
  14479.     end if; 
  14480.  
  14481.   end DELETE_INTERNAL_TABLE_ENTRY; 
  14482.  
  14483.   -----------------------------------------------------------
  14484.  
  14485.   function GET_FIXED_LENGTH_TABLE_ENTRY(LENGTH : in POSITIVE) return STRING is 
  14486.  
  14487.     --| overview
  14488.     --| Read the next LENGTH characters from the external file and 
  14489.     --| return them as a string.
  14490.  
  14491.     RETURN_STRING : STRING(1 .. LENGTH); 
  14492.     CH            : CHARACTER; 
  14493.     INDEX         : POSITIVE; 
  14494.  
  14495.   begin
  14496.     for I in RETURN_STRING'range loop
  14497.       GET(EXTERNAL_FILE, CH); 
  14498.       RETURN_STRING(I) := CH; 
  14499.     end loop; 
  14500.  
  14501.     -- read past the terminator
  14502.     if CH /= TERMINATOR then 
  14503.       GET(EXTERNAL_FILE, CH); 
  14504.     end if; 
  14505.  
  14506.     return RETURN_STRING; 
  14507.  
  14508.   end GET_FIXED_LENGTH_TABLE_ENTRY; 
  14509.  
  14510.   ----------------------------------------------------------------------
  14511.  
  14512.   function GET_VARIABLE_LENGTH_TABLE_ENTRY return STRING_TYPE is 
  14513.  
  14514.     --| overview
  14515.     --| Scan the external file until a terminator ('*') is found and
  14516.     --| return a string_type of the characters scanned.
  14517.  
  14518.     RETURN_STRING : STRING_TYPE; 
  14519.     CH            : CHARACTER := ' '; 
  14520.     TMP_STRING    : LONG_STRING; 
  14521.     INDEX         : NATURAL := 0; 
  14522.  
  14523.   begin
  14524.     RETURN_STRING := CREATE(""); 
  14525.     while CH /= TERMINATOR loop
  14526.  
  14527.       for I in LONG_STRING'range loop
  14528.         GET(EXTERNAL_FILE, CH); 
  14529.         exit when CH = TERMINATOR; 
  14530.         INDEX := I; 
  14531.         TMP_STRING(INDEX) := CH; 
  14532.       end loop; 
  14533.  
  14534.       RETURN_STRING := RETURN_STRING & CREATE(TMP_STRING(1 .. INDEX)); 
  14535.  
  14536.     end loop; 
  14537.  
  14538.     return RETURN_STRING; 
  14539.  
  14540.   end GET_VARIABLE_LENGTH_TABLE_ENTRY; 
  14541.  
  14542.   ----------------------------------------------------------------------
  14543.  
  14544.   function TABLE_EQUAL(X, Y : in TABLE_ENTRY_RECORD) return BOOLEAN is 
  14545.  
  14546.   begin
  14547.     return EQUAL(X.PACKAGE_ADA_NAME, Y.PACKAGE_ADA_NAME) and then X.
  14548.       PACKAGE_FILENAME = Y.PACKAGE_FILENAME and then X.DATE_CREATED = Y.
  14549.       DATE_CREATED and then X.TIME_CREATED = Y.TIME_CREATED; 
  14550.   end TABLE_EQUAL; 
  14551.  
  14552. ---------------------------------------------------------------------
  14553. end CATALOG_PKG; 
  14554. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14555. --SRCBUFF.SPC
  14556. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14557.  
  14558. package SD_SOURCE_BUFFERING is 
  14559.  
  14560.   -- These procedures are used in conjunction with the procedures in
  14561.   -- SD_BUFFER_FILES to insure that all lines being added to the
  14562.   -- instrumented source file are no longer than MAX_SOURCE_LINE_LENGTH.
  14563.   -- There are many times when the length of a line might exceed this
  14564.   -- limit, as for example, when the fully qualified name of the
  14565.   -- current scope is prepended to a variable name in the scope.
  14566.  
  14567.   -- If a line is going to be too long, it is wrapped around to the
  14568.   -- next line at an appropriate place.  If we are in the middle of 
  14569.   -- a string literal, a closing quote, ampersand, and beginning quote 
  14570.   -- on the next line are added.
  14571.  
  14572.   -- When a line is ready to be written, it is passed to the 
  14573.   -- SD_BUFFER_FILES package if it is not something that can be
  14574.   -- written directly to the instrumented source at this time.
  14575.  
  14576.   -- The spec buffer is used to format subprogram declaration and 
  14577.   -- package specifications. 
  14578.  
  14579.   -- The body buffer is used to format code that is part of subprogram
  14580.   -- and package bodies added for variable tracing.
  14581.  
  14582.   -- The source buffer is used to format code that will go directly
  14583.   -- into the instrumented source.
  14584.  
  14585.   ------------------------------------------------------------------
  14586.   
  14587.   procedure WRITE_BODY_BUFFER(SOURCE : in STRING);
  14588.   
  14589.   -- Add SOURCE to the body buffer.  The buffer is only written out 
  14590.   -- when it is full.
  14591.  
  14592.   ------------------------------------------------------------------
  14593.  
  14594.   procedure WRITE_LINE_BODY_BUFFER(SOURCE : in STRING);
  14595.  
  14596.   -- This first calls WRITE_BODY_BUFFER and then writes out the buffer. 
  14597.  
  14598.   ------------------------------------------------------------------
  14599.  
  14600.   procedure WRITE_SPEC_BUFFER(SOURCE : in STRING);
  14601.  
  14602.   -- Add SOURCE to the spec buffer. The buffer is only written out 
  14603.   -- when it is full.
  14604.  
  14605.   ------------------------------------------------------------------
  14606.  
  14607.   procedure WRITE_LINE_SPEC_BUFFER(SOURCE : in STRING);
  14608.  
  14609.   -- This first calls WRITE_SPEC_BUFFER, and then writes out the buffer.
  14610.  
  14611.   ------------------------------------------------------------------
  14612.  
  14613.   procedure WRITE_INST_SOURCE(SOURCE : in STRING);
  14614.  
  14615.   -- Add SOURCE to the source buffer.  The buffer is only written out
  14616.   -- when it is full.
  14617.  
  14618.   ------------------------------------------------------------------
  14619.  
  14620.   procedure WRITE_LINE_INST_SOURCE(SOURCE : in STRING);
  14621.  
  14622.   -- This first calls WRIT_INST_SOURCE and then writes the buffer
  14623.   -- directly to the instrumented source file.
  14624.  
  14625.   ------------------------------------------------------------------
  14626.  
  14627.   procedure CLEAR_SOURCE_BUFFER;
  14628.  
  14629.   -- Write out the current source buffer, but don't add a carriage
  14630.   -- return to the instrumented source.
  14631.  
  14632.   ------------------------------------------------------------------
  14633.  
  14634. end SD_SOURCE_BUFFERING; 
  14635. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14636. --SRCBUFF.BDY
  14637. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14638.  
  14639.  
  14640. with TEXT_IO; use TEXT_IO; 
  14641. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  14642. with STRING_UTILITIES; use STRING_UTILITIES; 
  14643. with SCOPE_PACKAGE; use SCOPE_PACKAGE;
  14644. with SD_BUFFER_FILES; use SD_BUFFER_FILES;
  14645.  
  14646. package body SD_SOURCE_BUFFERING is 
  14647.  
  14648.   type BUFFER_INDICATOR is (SPC, BDY, SRC); 
  14649.   type BUFFER_REC(WHICH_BUFFER : BUFFER_INDICATOR) is 
  14650.     record
  14651.       TEXT  : SOURCE_LINE_BUFFER := BLANK_LINE; 
  14652.       INDEX : NATURAL range 0 .. SOURCE_LINE_BUFFER'LAST := 0; 
  14653.     end record; 
  14654.  
  14655.   SPEC_BUFFER   : BUFFER_REC(SPC); 
  14656.   BODY_BUFFER   : BUFFER_REC(BDY); 
  14657.   SOURCE_BUFFER : BUFFER_REC(SRC);
  14658.   
  14659.   -----------------------------------------------------------------------------
  14660.   -- Local subprogram specifications --
  14661.   -----------------------------------------------------------------------------
  14662.  
  14663.   -----------------------------------------------------------------------------
  14664.  
  14665.   function IS_DOUBLE_DELIMITER(SOURCE : in STRING; 
  14666.                                INDEX  : in NATURAL) return BOOLEAN; 
  14667.  
  14668.   -- This is checked when looking for a place to break a line.  Don't
  14669.   -- break it in the middle of a double delimiter.
  14670.  
  14671.   -----------------------------------------------------------------------------
  14672.  
  14673.   function IS_CHARACTER_LITERAL(SOURCE : in STRING; 
  14674.                                 INDEX  : in NATURAL) return BOOLEAN; 
  14675.  
  14676.  
  14677.   -- This is checked when looking for a place to break a line.  Don't
  14678.   -- break it in the middle of a character literal.
  14679.  
  14680.   -----------------------------------------------------------------------------
  14681.  
  14682.   function FIND_WRAP_POINT(DELIMITERS : in STRING; 
  14683.                            LINE       : in STRING) return NATURAL;
  14684.  
  14685.   -- Find the best place to break the LINE.  The characters in the
  14686.   -- DELIMITERS parameter are what to look for in determining the
  14687.   -- best wrap point.
  14688.  
  14689.   -----------------------------------------------------------------------------
  14690.   procedure WRITE_BUFFER(BUFFER : in out BUFFER_REC); 
  14691.  
  14692.   -- Write the contents of the indicated buffer to either the instrumented
  14693.   -- source file or to one of the buffer files in SD_BUFFER_FILES.
  14694.  
  14695.   -----------------------------------------------------------------------------
  14696.  
  14697.   procedure ADD_TO_BUFFER(SOURCE : in STRING; 
  14698.                           BUFFER : in out BUFFER_REC); 
  14699.  
  14700.   -- Add the SOURCE string to the indicated buffer, and update the buffer
  14701.   -- index.  It has already been determined that there is enough room in
  14702.   -- the buffer for SOURCE.
  14703.  
  14704.   -----------------------------------------------------------------------------
  14705.  
  14706.   procedure BUFFER_LINE(LINE   : in STRING; 
  14707.                         BUFFER : in out BUFFER_REC); 
  14708.  
  14709.   -- Add LINE to the indicated buffer, breaking it at appropriate places if
  14710.   -- it won't all fit in the room left.
  14711.  
  14712.   -----------------------------------------------------------------------------
  14713.  
  14714.   procedure BUFFER_STRING(SOURCE : in STRING; 
  14715.                           BUFFER : in out BUFFER_REC); 
  14716.  
  14717.   -- Add the string literal SOURCE to the indicated buffer, breaking it at 
  14718.   -- appropriate places if it won't all fit in the room left.
  14719.  
  14720.   -----------------------------------------------------------------------------
  14721.  
  14722.   -----------------------------------------------------------------------------
  14723.   -- External subprogram bodies --
  14724.   -----------------------------------------------------------------------------
  14725.  
  14726.   procedure WRITE_BODY_BUFFER(SOURCE : in STRING) is 
  14727.  
  14728.     -- Add SOURCE to the body buffer
  14729.  
  14730.     QUOTE1, QUOTE2 : NATURAL; 
  14731.   begin
  14732.     if SOURCE'LENGTH <= BODY_BUFFER.TEXT'LAST - BODY_BUFFER.INDEX then 
  14733.       -- It will fit, so add it to the buffer and return.
  14734.       ADD_TO_BUFFER(SOURCE, BODY_BUFFER); 
  14735.       return; 
  14736.     else 
  14737.       -- if SOURCE contains a literal string then it has to be
  14738.       -- buffered separately.  Buffer everything up to the first
  14739.       -- quote as a regular line, then buffer the string, the
  14740.       -- call this procedure again to buffer the rest of it.
  14741.       QUOTE1 := POSITION_OF('"', SOURCE);
  14742.       if QUOTE1 >= SOURCE'FIRST then 
  14743.         QUOTE2 := POSITION_OF('"', SOURCE(QUOTE1 + 1 .. SOURCE'LAST));
  14744.         BUFFER_LINE(SOURCE(SOURCE'FIRST .. QUOTE1 - 1), BODY_BUFFER); 
  14745.         BUFFER_STRING(SOURCE(QUOTE1 .. QUOTE2), BODY_BUFFER); 
  14746.         WRITE_BODY_BUFFER(SOURCE(QUOTE2 + 1 .. SOURCE'LAST)); 
  14747.       else 
  14748.         -- no string literals are involved
  14749.         BUFFER_LINE(SOURCE, BODY_BUFFER); 
  14750.       end if; 
  14751.     end if; 
  14752.   end WRITE_BODY_BUFFER; 
  14753.  
  14754.   -----------------------------------------------------------------------------
  14755.   procedure WRITE_LINE_BODY_BUFFER(SOURCE : in STRING) is 
  14756.  
  14757.     -- Buffer SOURCE and then write out the body buffer.
  14758.  
  14759.   begin
  14760.     WRITE_BODY_BUFFER(SOURCE); 
  14761.     WRITE_BUFFER(BODY_BUFFER); 
  14762.   end WRITE_LINE_BODY_BUFFER; 
  14763.  
  14764.   -----------------------------------------------------------------------------
  14765.   procedure WRITE_SPEC_BUFFER(SOURCE : in STRING) is 
  14766.  
  14767.     -- This works the same way as WRITE_BODY_BUFFER, except that the
  14768.     -- spec buffer is the parameter passed to local processing procedures
  14769.     -- instead of the body buffer.
  14770.     
  14771.     QUOTE1, QUOTE2 : NATURAL; 
  14772.   begin
  14773.     if SOURCE'LENGTH <= SPEC_BUFFER.TEXT'LAST - SPEC_BUFFER.INDEX  then 
  14774.       ADD_TO_BUFFER(SOURCE, SPEC_BUFFER); 
  14775.       return; 
  14776.     else 
  14777.       QUOTE1 := POSITION_OF('"', SOURCE);
  14778.       if QUOTE1 >= SOURCE'FIRST then 
  14779.         QUOTE2 := POSITION_OF('"', SOURCE(QUOTE1 + 1 .. SOURCE'LAST));
  14780.         BUFFER_LINE(SOURCE(SOURCE'FIRST .. QUOTE1 - 1), SPEC_BUFFER); 
  14781.         BUFFER_STRING(SOURCE(QUOTE1 .. QUOTE2), SPEC_BUFFER); 
  14782.         WRITE_SPEC_BUFFER(SOURCE(QUOTE2 + 1 .. SOURCE'LAST)); 
  14783.       else 
  14784.         BUFFER_LINE(SOURCE, SPEC_BUFFER); 
  14785.       end if; 
  14786.     end if; 
  14787.   end WRITE_SPEC_BUFFER; 
  14788.  
  14789.   -----------------------------------------------------------------------------
  14790.   procedure WRITE_LINE_SPEC_BUFFER(SOURCE : in STRING) is 
  14791.  
  14792.     -- Buffer SOURCE and then write out the spec buffer.
  14793.  
  14794.   begin
  14795.     WRITE_SPEC_BUFFER(SOURCE); 
  14796.     WRITE_BUFFER(SPEC_BUFFER); 
  14797.   end WRITE_LINE_SPEC_BUFFER; 
  14798.  
  14799.   -----------------------------------------------------------------------------
  14800.   procedure WRITE_INST_SOURCE(SOURCE : in STRING) is 
  14801.  
  14802.     -- This works the same way as WRITE_BODY_BUFFER, except that the
  14803.     -- source buffer is the parameter passed to local processing procedures
  14804.     -- instead of the body buffer.
  14805.     
  14806.     QUOTE1, QUOTE2 : NATURAL; 
  14807.   begin
  14808.     if SOURCE'LENGTH <= SOURCE_BUFFER.TEXT'LAST - SOURCE_BUFFER.INDEX then 
  14809.       ADD_TO_BUFFER(SOURCE, SOURCE_BUFFER); 
  14810.       return; 
  14811.     else 
  14812.       QUOTE1 := POSITION_OF('"', SOURCE);
  14813.       if QUOTE1 >= SOURCE'FIRST then 
  14814.         QUOTE2 := POSITION_OF('"', SOURCE(QUOTE1 + 1 .. SOURCE'LAST));
  14815.         BUFFER_LINE(SOURCE(SOURCE'FIRST .. QUOTE1 - 1), SOURCE_BUFFER); 
  14816.         BUFFER_STRING(SOURCE(QUOTE1 .. QUOTE2), SOURCE_BUFFER); 
  14817.         WRITE_INST_SOURCE(SOURCE(QUOTE2 + 1 .. SOURCE'LAST)); 
  14818.       else 
  14819.         BUFFER_LINE(SOURCE, SOURCE_BUFFER); 
  14820.       end if; 
  14821.     end if; 
  14822.   end WRITE_INST_SOURCE; 
  14823.  
  14824.   -----------------------------------------------------------------------------
  14825.   procedure WRITE_LINE_INST_SOURCE(SOURCE : in STRING) is 
  14826.  
  14827.     -- Buffer SOURCE and then write out the source buffer.
  14828.  
  14829.   begin
  14830.     WRITE_INST_SOURCE(SOURCE); 
  14831.     WRITE_BUFFER(SOURCE_BUFFER); 
  14832.   end WRITE_LINE_INST_SOURCE; 
  14833.  
  14834.   -----------------------------------------------------------------------------
  14835.   procedure CLEAR_SOURCE_BUFFER is
  14836.  
  14837.     -- If there is anything in the source buffer, write it to the instrumented
  14838.     -- file and clear the source buffer.  Do not write a carriage return to
  14839.     -- the instrumented source.
  14840.  
  14841.   begin
  14842.     if SOURCE_BUFFER.INDEX > 0 THEN
  14843.       TEXT_IO.PUT(INSTRUMENTED_FILE, 
  14844.                   SOURCE_BUFFER.TEXT(1..SOURCE_BUFFER.INDEX));
  14845.       SOURCE_BUFFER.TEXT := BLANK_LINE;
  14846.       SOURCE_BUFFER.INDEX := 0;
  14847.     end if;
  14848.   end CLEAR_SOURCE_BUFFER;
  14849.  
  14850.   -----------------------------------------------------------------------------
  14851.   -- Local subprogram bodies --
  14852.   -----------------------------------------------------------------------------
  14853.  
  14854.   -----------------------------------------------------------------------------
  14855.   function IS_DOUBLE_DELIMITER(SOURCE : in STRING; 
  14856.                                INDEX  : in NATURAL) return BOOLEAN is 
  14857.     S2     : STRING(1 .. 2);
  14858.     RESULT : BOOLEAN := FALSE;
  14859.   begin
  14860.     if INDEX < SOURCE'LAST then
  14861.       S2 := SOURCE(INDEX .. INDEX + 1);
  14862.       RESULT := S2 = ".." or else 
  14863.                 S2 = ":=" or else 
  14864.                 S2 = "/=" or else 
  14865.                 S2 = ">=" or else 
  14866.                 S2 = "<=" or else 
  14867.                 S2 = "<>" or else
  14868.                 S2 = "<<" or else 
  14869.                 S2 = ">>" or else 
  14870.                 S2 = "**";
  14871.     end if;
  14872.     return RESULT;
  14873.   end IS_DOUBLE_DELIMITER; 
  14874.   
  14875.   -----------------------------------------------------------------------------
  14876.   function IS_CHARACTER_LITERAL(SOURCE : in STRING; 
  14877.                                 INDEX  : in NATURAL) return BOOLEAN is 
  14878.     RESULT : BOOLEAN := FALSE;
  14879.   begin
  14880.     if INDEX > SOURCE'FIRST and then INDEX < SOURCE'LAST then
  14881.       RESULT := SOURCE(INDEX - 1) = ''' and SOURCE(INDEX + 1) = '''; 
  14882.     end if;
  14883.     return RESULT;
  14884.   end IS_CHARACTER_LITERAL; 
  14885.  
  14886.   -----------------------------------------------------------------------------
  14887.   function FIND_WRAP_POINT(DELIMITERS : in STRING;
  14888.                            LINE       : in STRING) return NATURAL is
  14889.  
  14890.     -- Scan LINE backwards looking for each character in DELIMITERS.
  14891.     -- Return the highest index found, so that we can put as much of
  14892.     -- LINE as possible into the current buffer.  If no delimeters
  14893.     -- are found, return LINE'FIRST - 1.
  14894.  
  14895.     BEST_SO_FAR : NATURAL := LINE'FIRST - 1;
  14896.     INDEX       : NATURAL;
  14897.   begin
  14898.     for I in DELIMITERS'RANGE loop
  14899.       INDEX := POSITION_OF_REVERSE(DELIMITERS(I), LINE);
  14900.       if INDEX > BEST_SO_FAR and then
  14901.          not IS_DOUBLE_DELIMITER(LINE, INDEX) and then
  14902.          not IS_CHARACTER_LITERAL(LINE, INDEX) then
  14903.            BEST_SO_FAR := INDEX;
  14904.       end if;
  14905.     end loop;
  14906.     return BEST_SO_FAR;
  14907.   end FIND_WRAP_POINT;
  14908.  
  14909.   -----------------------------------------------------------------------------
  14910.   procedure WRITE_BUFFER(BUFFER : in out BUFFER_REC) is 
  14911.   begin
  14912.     if BUFFER.WHICH_BUFFER = SRC then
  14913.       -- write it directly to the instrumented source file
  14914.       TEXT_IO.PUT_LINE(INSTRUMENTED_FILE, BUFFER.TEXT(1 .. BUFFER.INDEX));
  14915.  
  14916.     elsif BUFFER.WHICH_BUFFER = BDY then 
  14917.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then
  14918.         -- Add it to the package bodies being created for tracing the
  14919.         -- current package specification
  14920.         if CURRENT_SCOPE.IN_PRIVATE_PART then
  14921.           SD_BUFFER_FILES.WRITELN_TO_BUFFER(PRIVATE_BODY_FILE, BUFFER.TEXT);
  14922.         else
  14923.           SD_BUFFER_FILES.WRITELN_TO_BUFFER(PUBLIC_BODY_FILE, BUFFER.TEXT);
  14924.         end if;
  14925.       else
  14926.         -- This is not for a package spec, so write it to the temporary
  14927.         -- buffer, which is written to the instrumented source file at
  14928.         -- the end of the current declarative part.
  14929.         SD_BUFFER_FILES.WRITELN_TO_BUFFER(BUFFER_FILE, BUFFER.TEXT);
  14930.       end if;
  14931.  
  14932.     else -- buffer = spec buffer
  14933.  
  14934.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then
  14935.         -- Add it to the package specs being created for tracing the
  14936.         -- current package specification
  14937.         if CURRENT_SCOPE.IN_PRIVATE_PART then
  14938.           SD_BUFFER_FILES.WRITELN_TO_BUFFER(PRIVATE_SPEC_FILE, BUFFER.TEXT);
  14939.         else
  14940.           SD_BUFFER_FILES.WRITELN_TO_BUFFER(PUBLIC_SPEC_FILE, BUFFER.TEXT);
  14941.         end if;
  14942.       else
  14943.         -- Write the buffer directly to the instrumented source file.
  14944.         TEXT_IO.PUT_LINE(INSTRUMENTED_FILE, BUFFER.TEXT(1 .. BUFFER.INDEX));
  14945.       end if;
  14946.     end if; 
  14947.  
  14948.     BUFFER.TEXT := BLANK_LINE; 
  14949.     BUFFER.INDEX := 0; 
  14950.   end WRITE_BUFFER; 
  14951.  
  14952.   -----------------------------------------------------------------------------
  14953.   procedure ADD_TO_BUFFER(SOURCE : in STRING; 
  14954.                           BUFFER : in out BUFFER_REC) is 
  14955.   begin
  14956.     BUFFER.TEXT(BUFFER.INDEX + 1 .. BUFFER.INDEX + SOURCE'LENGTH) := SOURCE;
  14957.     BUFFER.INDEX := BUFFER.INDEX + SOURCE'LENGTH; 
  14958.   end ADD_TO_BUFFER; 
  14959.  
  14960.   -----------------------------------------------------------------------------
  14961.   procedure BUFFER_LINE(LINE   : in STRING; 
  14962.                         BUFFER : in out BUFFER_REC) is 
  14963.  
  14964.     -- This is the procedure called by WRITE_BODY/SPEC/SOURCE_BUFFER to 
  14965.     -- add the LINE to the specified buffer, wrapping the line and
  14966.     -- writing out the current contents of the buffer when necessary.  
  14967.  
  14968.     LINE_INDEX  : POSITIVE := LINE'FIRST; 
  14969.     LINE_LEFT   : NATURAL := LINE'LENGTH;
  14970.     BUFFER_LEFT : NATURAL;
  14971.     WRAP_POINT  : NATURAL;
  14972.     MAX_INDEX   : NATURAL;
  14973.  
  14974.   begin
  14975.     while LINE_INDEX <= LINE'LAST loop
  14976.       BUFFER_LEFT := BUFFER.TEXT'LAST - BUFFER.INDEX; 
  14977.       if BUFFER_LEFT = 0 then
  14978.         WRITE_BUFFER(BUFFER);
  14979.       elsif LINE_LEFT <= BUFFER_LEFT then 
  14980.         ADD_TO_BUFFER(LINE(LINE_INDEX .. LINE'LAST), BUFFER); 
  14981.         return; 
  14982.       else 
  14983.         MAX_INDEX := LINE_INDEX + BUFFER_LEFT - 1;
  14984.         if IS_DOUBLE_DELIMITER(LINE, MAX_INDEX) or else
  14985.            IS_CHARACTER_LITERAL(LINE, MAX_INDEX) then
  14986.              MAX_INDEX := MAX_INDEX - 1;
  14987.         end if;
  14988.         WRAP_POINT := FIND_WRAP_POINT(" .,:();",
  14989.                                       LINE(LINE_INDEX .. MAX_INDEX));
  14990.         ADD_TO_BUFFER(LINE(LINE_INDEX .. WRAP_POINT), BUFFER); 
  14991.         WRITE_BUFFER(BUFFER); 
  14992.         LINE_INDEX := WRAP_POINT + 1; 
  14993.         LINE_LEFT := LINE'LAST - WRAP_POINT;
  14994.       end if; 
  14995.     end loop; 
  14996.   end BUFFER_LINE; 
  14997.  
  14998.   -----------------------------------------------------------------------------
  14999.   procedure BUFFER_STRING(SOURCE : in STRING; 
  15000.                           BUFFER : in out BUFFER_REC) is 
  15001.  
  15002.     -- This is the procedure called by WRITE_BODY/SPEC/SOURCE_BUFFER to 
  15003.     -- add the a string literal to the specified buffer, concatenating
  15004.     -- the string over multiple lines when necessary.
  15005.  
  15006.     SOURCE_INDEX : POSITIVE := SOURCE'FIRST; 
  15007.     WRAP_POINT   : NATURAL := SOURCE'FIRST; 
  15008.     SOURCE_LEFT  : NATURAL := SOURCE'LENGTH;
  15009.     BUFFER_LEFT  : NATURAL := BUFFER.TEXT'LAST - BUFFER.INDEX;
  15010.     MAX_INDEX    : NATURAL;
  15011.  
  15012.   begin
  15013.     if BUFFER_LEFT <= 5 then
  15014.       -- We need to add 3 characters after the opening quote: 
  15015.       -- a closing quote, a blank and an ampersand.  If there are only
  15016.       -- 5 spaces left, we could put only the first character of the
  15017.       -- string on this line.  Dump the buffer and start the string on
  15018.       -- the next line.
  15019.       WRITE_BUFFER(BUFFER);
  15020.       BUFFER_LEFT := BUFFER.TEXT'LAST - BUFFER.INDEX; 
  15021.     end if;
  15022.     while SOURCE_INDEX < SOURCE'LAST loop
  15023.       if SOURCE_LEFT <= BUFFER_LEFT then 
  15024.         ADD_TO_BUFFER(SOURCE(SOURCE_INDEX .. SOURCE'LAST), BUFFER); 
  15025.         return; 
  15026.       else 
  15027.         MAX_INDEX := SOURCE_INDEX + BUFFER_LEFT - 4;
  15028.         -- allow room for the closing quote and ampersand.
  15029.  
  15030.         WRAP_POINT := FIND_WRAP_POINT(" ,.", SOURCE(SOURCE_INDEX .. MAX_INDEX));
  15031.         
  15032.         if WRAP_POINT < SOURCE_INDEX  then
  15033.           -- none of the delimiters were found, so we'll break the string
  15034.           -- in the middle of a word.
  15035.           WRAP_POINT := MAX_INDEX;
  15036.         end if;
  15037.  
  15038.         ADD_TO_BUFFER(SOURCE(SOURCE_INDEX .. WRAP_POINT) & """ &", BUFFER); 
  15039.         WRITE_BUFFER(BUFFER); 
  15040.         ADD_TO_BUFFER("""", BUFFER);
  15041.         SOURCE_INDEX := WRAP_POINT + 1; 
  15042.         SOURCE_LEFT := SOURCE'LAST - SOURCE_INDEX;
  15043.         BUFFER_LEFT := BUFFER.TEXT'LAST - BUFFER.INDEX; 
  15044.       end if; 
  15045.     end loop; 
  15046.   end BUFFER_STRING; 
  15047.   -----------------------------------------------------------------------------
  15048.  
  15049. end SD_SOURCE_BUFFERING; 
  15050. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15051. --SYSDEP2.SPC
  15052. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15053.  
  15054. PACKAGE sysdep2 IS
  15055.  
  15056.   --|  The following two procedures are used by the virtual terminal
  15057.   --|  pacakge to set and reset the terminal characteristics. The
  15058.   --|  actual procedures are written in MACRO.  The OBJ for the procs
  15059.   --|  can be entered as the body for this package.
  15060.  
  15061.     FUNCTION setterminfo (chan : short_integer) RETURN integer;
  15062.     PRAGMA interface( MACRO, setterminfo );
  15063.     PRAGMA import_function( internal    =>     setterminfo,
  15064.                             parameter_types => (short_integer),
  15065.                             result_type =>     integer,
  15066.                             external =>        "SETTERMINFO" );
  15067.     
  15068.     FUNCTION resetterminfo (chan : short_integer) RETURN integer;
  15069.     PRAGMA interface( MACRO, resetterminfo );
  15070.     PRAGMA import_function( internal    =>     resetterminfo,
  15071.                             parameter_types => (short_integer),
  15072.                             result_type =>     integer,
  15073.                             external =>        "RESETTERMINFO" );
  15074.  
  15075.  
  15076.   --|  This procedure is used to shut down the debugger.  It is used when a 
  15077.   --|  quit, or <cntl>-c is entered by the user.  It is used to shut down
  15078.   --|  all tasks, including uninstrumented user tasks.
  15079.  
  15080.     PROCEDURE do_exit (STATUS : out INTEGER;
  15081.                        EXIT_STATUS : in INTEGER := 1);
  15082.     PRAGMA INTERFACE( VMS, do_exit);
  15083.     PRAGMA import_valued_procedure(do_exit, 
  15084.                                    "SYS$EXIT",
  15085.                                     mechanism => (VALUE, VALUE));
  15086.  
  15087. END sysdep2;
  15088. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15089. --SYSDEP.BDY
  15090. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15091. with sysdep2,
  15092.     text_io,
  15093.     system,
  15094.     tasking_services,
  15095.     starlet,
  15096.     condition_handling,
  15097.     system_parameters,
  15098.     string_pkg;
  15099.     
  15100.  
  15101. USE
  15102.     sysdep2,
  15103.     text_io,
  15104.     system,
  15105.     tasking_services,
  15106.     starlet,
  15107.     system_parameters,
  15108.     condition_handling;
  15109.  
  15110. PACKAGE BODY sysdep IS
  15111.  
  15112.   --|  This package contains system dependent procedures.  This version
  15113.   --|  is for the VAX with VMS 4.0 using the Ada compilation system.
  15114.  
  15115.  
  15116. ----------------------------------------------------------------------
  15117. --  The following are used by the virtual terminal package
  15118. ----------------------------------------------------------------------
  15119.  
  15120.     TYPE status_enum IS (io_ok, io_not_ok );
  15121.       --|  status of the last io operation
  15122.  
  15123.     PROCEDURE alloc (
  15124.     status    : OUT integer;
  15125.     devnam    : IN  string;
  15126.     phylen    : OUT integer;
  15127.     phybuf    : OUT string;
  15128.     acmode    : IN  integer := 0 );
  15129.  
  15130.     PRAGMA interface (EXTERNAL, alloc);
  15131.  
  15132.     PRAGMA import_valued_procedure (alloc, "SYS$ALLOC",
  15133.     (integer, string,        integer,   string,        integer),
  15134.     (value,   descriptor(s), reference, descriptor(s), value));
  15135.  
  15136.  
  15137.     PROCEDURE assign (
  15138.     status    : OUT integer;
  15139.     devnam    : IN  string;
  15140.     chan    : OUT short_integer;
  15141.     acmode    : IN  integer := 0;
  15142.     mbxnam    : IN  string := string'NULL_PARAMETER);
  15143.  
  15144.     PRAGMA interface (external, assign);
  15145.  
  15146.     PRAGMA import_valued_procedure (assign, "SYS$ASSIGN",
  15147.     (integer, string,        short_integer,   integer, string),
  15148.     (value,   descriptor(s), reference,       value,   descriptor(s)));
  15149.  
  15150.  
  15151.     PROCEDURE dassgn (
  15152.     status    : OUT condition_handling.cond_value_type;
  15153.     chan    : IN  starlet.channel_type);
  15154.  
  15155.     PRAGMA interface (external, dassgn);
  15156.  
  15157.     PRAGMA import_valued_procedure (dassgn, "sys$dassgn",
  15158.     (condition_handling.cond_value_type, starlet.channel_type),
  15159.     (value, value));
  15160.  
  15161.     PROCEDURE trnlog (
  15162.     status    : OUT integer;
  15163.     lognam    : IN  string;
  15164.     rsllen    : OUT short_integer;
  15165.     rslbuf    : OUT string;
  15166.     table    : IN  integer := 0;
  15167.     acmode    : OUT integer;
  15168.     dsbmsk    : IN  integer := 0 );
  15169.  
  15170.     PRAGMA interface (external, trnlog);
  15171.  
  15172.     PRAGMA import_valued_procedure (trnlog, "SYS$TRNLOG",
  15173.     (integer, string, short_integer, string, integer, integer, integer),
  15174.     (value, descriptor(s), reference, descriptor(s), value, reference,
  15175.            value));
  15176.  
  15177.  
  15178.     terminal_in_channel : short_integer;
  15179.     terminal_out_channel : short_integer;
  15180.  
  15181.     PROCEDURE open IS
  15182.     status : integer;
  15183.     BEGIN
  15184.  
  15185.         assign
  15186.             ( status,
  15187.               "SYS$OUTPUT:",
  15188.           terminal_out_channel );
  15189.  
  15190.         IF status /= 1
  15191.         THEN
  15192.             text_io.put_line
  15193.                ( "In open (assign sys$output)  status : " & 
  15194.                  integer'image( status ) );
  15195.         END IF;
  15196.  
  15197.      END open;
  15198.  
  15199.  
  15200.     PROCEDURE close IS
  15201.     status : integer;
  15202.     BEGIN
  15203.  
  15204.         dassgn( condition_handling.cond_value_type( status ),
  15205.                 starlet.channel_type(  terminal_out_channel ) );
  15206.  
  15207.         dassgn( condition_handling.cond_value_type( status ),
  15208.                 starlet.channel_type(  terminal_in_channel ) );
  15209.  
  15210.     END close;
  15211.  
  15212.  
  15213.     PROCEDURE put ( data : IN string ) IS
  15214.     status : integer;
  15215.     temp_buffer : string( 1..data'LENGTH );
  15216.     ios_block : starlet.iosb_type;
  15217.     BEGIN
  15218.  
  15219.          tasking_services.task_qiow
  15220.              ( status => condition_handling.cond_value_type( status ),
  15221.                chan => starlet.channel_type( terminal_out_channel ),
  15222.                func => starlet.io_writevblk,
  15223.                iosb => ios_block,
  15224.                p1 => system.to_unsigned_longword( data(data'FIRST)'ADDRESS ),
  15225.                p2 => system.unsigned_longword( data'LENGTH )
  15226.              );
  15227.  
  15228.         IF status /= 1
  15229.         THEN
  15230.             text_io.put_line
  15231.                ( "In put  status : " & 
  15232.                  integer'image( status ) );
  15233.         END IF;
  15234.     END put;
  15235.  
  15236.     PROCEDURE low_level_get 
  15237.              ( data : OUT character; io_status : OUT status_enum  ) IS
  15238.     status : integer;
  15239.     length : CONSTANT positive := 1;
  15240.     temp_buffer : string( 1..1 );
  15241.     ios_block : starlet.iosb_type;
  15242.     BEGIN
  15243.  
  15244.          tasking_services.task_qiow
  15245.              ( status => condition_handling.cond_value_type( status ),
  15246.                chan => starlet.channel_type( terminal_in_channel ),
  15247.                func => ( starlet.io_readvblk OR 
  15248.                          starlet.io_m_nofiltr),
  15249.                iosb => ios_block,
  15250.                p1 => system.to_unsigned_longword( temp_buffer(1)'ADDRESS ),
  15251.                p2 => system.unsigned_longword( length )
  15252.              );
  15253.  
  15254.          IF (status /= 1) OR
  15255.             (ios_block.status /= 1)
  15256.          THEN
  15257.              io_status := io_not_ok;
  15258.          ELSE
  15259.              io_status := io_ok;
  15260.              data := temp_buffer(1);
  15261.          END IF;
  15262.     END low_level_get;
  15263.  
  15264. -------------------------------------------------------------------
  15265. --  The following procedures were added to allow us to return control
  15266. --  to the test program when we are not inputting something.  This is
  15267. --  so the program can get input from the terminal
  15268. --------------------------------------------------------------------
  15269.  
  15270.     procedure START_INPUT is
  15271.       status : integer;
  15272.     begin
  15273.         assign
  15274.         ( status,
  15275.           "SYS$INPUT:",
  15276.               terminal_in_channel );
  15277.  
  15278.       status := setterminfo( terminal_in_channel );
  15279.     end START_INPUT;
  15280.  
  15281. -------------------------------------------------------------------
  15282.  
  15283.     procedure STOP_INPUT is
  15284.       STATUS : INTEGER;
  15285.     begin
  15286.         status := resetterminfo( terminal_in_channel );
  15287.  
  15288.         dassgn( condition_handling.cond_value_type( status ),
  15289.                 starlet.channel_type(  terminal_in_channel ) );
  15290.  
  15291.     end STOP_INPUT;
  15292.  
  15293. -------------------------------------------------------------------
  15294. --  This procedure was changed to get only one character at a time.
  15295. --  This is so the program being tested can get its own output from
  15296. --  the terminal. If we get too many characters, we might pick up 
  15297. --  input intended for the target program.
  15298. --------------------------------------------------------------------
  15299.  
  15300.     PROCEDURE get ( data : IN OUT string;
  15301.                     last : OUT natural ) IS
  15302.       buffer : character;
  15303.       status : status_enum;
  15304.       returned_status : integer;
  15305.       INSTATUS : INTEGER;
  15306.     BEGIN
  15307.  
  15308.       low_level_get( buffer, status );
  15309.  
  15310.       if Character'Pos(Buffer) = 3 then
  15311.         set_scroll_region(1, 24);
  15312.         instatus := resetterminfo(terminal_in_channel);
  15313.         close;
  15314.         SYSDEP2.DO_EXIT(RETURNED_STATUS);
  15315.       end if;
  15316.  
  15317.       data(1) := buffer;
  15318.       last := 1;
  15319.    END get;
  15320.  
  15321.     PROCEDURE tcf_name ( name : OUT string;
  15322.                          last : OUT natural ) IS
  15323.     status : integer;
  15324.     temp_buffer : string( 1..80 ) := string'( 1..80 => ' ' );
  15325.     short_temp_length : short_integer;
  15326.     integer_temp_length : integer;
  15327.     ac_mode : integer;
  15328.     BEGIN
  15329.       NAME(1 .. STRING_PKG.LENGTH(SYSTEM_PARAMETERS.BASE_PROGRAM_LIBRARY) 
  15330.         + 7) := STRING_PKG.VALUE(SYSTEM_PARAMETERS.BASE_PROGRAM_LIBRARY) 
  15331.         & "TCF.DAT";
  15332.       LAST := STRING_PKG.LENGTH(SYSTEM_PARAMETERS.BASE_PROGRAM_LIBRARY) + 
  15333.         7;
  15334.     END tcf_name;
  15335.  
  15336.  
  15337.  
  15338.     PROCEDURE  terminal_name ( name : OUT string;
  15339.                                last : OUT natural ) IS
  15340.     status : integer;
  15341.     temp_buffer : string( 1..80 ) := string'( 1..80 => ' ' );
  15342.     short_temp_length : short_integer;
  15343.     integer_temp_length : integer;
  15344.     ac_mode : integer;
  15345.     BEGIN
  15346.         trnlog( status, "TERM", short_temp_length, temp_buffer, 0, ac_mode );
  15347.         integer_temp_length := integer( short_temp_length );
  15348.         IF status /= 1
  15349.         THEN
  15350.             last := 0;
  15351.         ELSE
  15352.             name( name'FIRST..name'FIRST+integer_temp_length-1 ) := 
  15353.                    temp_buffer( 1..integer_temp_length );
  15354.             last := name'FIRST+integer_temp_length-1;
  15355.         END IF;
  15356.     END terminal_name;
  15357.  
  15358.     FUNCTION valid_character ( item : IN character ) RETURN boolean IS
  15359.     BEGIN
  15360.         CASE item IS
  15361.             WHEN ascii.dc3 => RETURN false; -- xon
  15362.             WHEN ascii.dc1 => RETURN false; -- xoff
  15363.             WHEN OTHERS => RETURN true;
  15364.         END CASE;
  15365.     END valid_character;
  15366.  
  15367.  
  15368.   function FINDTABCOLUMN( -- see subprogram specification
  15369.                          INCOLUMN : in SOURCE_COLUMN) return SOURCE_COLUMN is 
  15370.  
  15371.   --| Effects
  15372.   --| Tabs are positioned every eight columns starting at column 1.
  15373.  
  15374.     TAB_WIDTH : constant := 8;  --| number of columns a tab takes up.
  15375.  
  15376.   begin
  15377.     return (INCOLUMN + (TAB_WIDTH - (INCOLUMN mod TAB_WIDTH))); 
  15378.   end FINDTABCOLUMN; 
  15379.  
  15380.   procedure SD_COMPILE(FILENAME : in STRING) is
  15381.      --|  This procedure will spawn a process to compile the file 
  15382.      --|  specified by FILENAME.
  15383.   begin
  15384.     SPAWN("ADA " & FILENAME);
  15385.   end SD_COMPILE;
  15386.  
  15387.   procedure SD_LINK(COMPILATION_UNIT : in STRING) is
  15388.      --|  This procedure will spawn a process to link the unit
  15389.      --|  specified by COMPILATION_UNIT.
  15390.   begin
  15391.     SPAWN("ACS LINK " & COMPILATION_UNIT);
  15392.   end SD_LINK;
  15393.   
  15394.   procedure SD_RUN(COMPILATION_UNIT : in STRING) is
  15395.      --|  This procedure will spawn a process to run the program
  15396.      --|  specified by COMPILATION_UNIT.
  15397.   begin
  15398.     SPAWN("RUN " & COMPILATION_UNIT);
  15399.   end SD_RUN;
  15400.  
  15401.   procedure SD_SYS(COMMAND: in STRING) is
  15402.     --|  This procedure will spawn a process to execute the command
  15403.     --|  specified in COMMAND.  
  15404.   begin
  15405.     SPAWN(COMMAND);
  15406.   end SD_SYS;
  15407.  
  15408. procedure SET_SCROLL_REGION(TOP    : in POSITIVE;
  15409.                             BOTTOM : in POSITIVE) is
  15410.  
  15411. --|  This procedure is used to define the bottom lines of the screen
  15412. --|  as a scroll region.  Since we do not have control of the output
  15413. --|  from the target program, this will cause that output to scroll
  15414. --|  in the area at the bottom of the screen.
  15415.  
  15416.   function STRING_OF(VALUE : in INTEGER) return STRING is
  15417.     TEMP_STRING : constant STRING := INTEGER'image(VALUE);
  15418.   begin
  15419.     return TEMP_STRING((TEMP_STRING'first + 1) .. TEMP_STRING'last);
  15420.   end;
  15421.  
  15422. begin
  15423.   PUT_LINE(ASCII.ESC & "[" & STRING_OF(TOP) & ";" & STRING_OF(BOTTOM) 
  15424.     & "r" & ASCII.CR);
  15425. end;
  15426.  
  15427. END sysdep;
  15428. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15429. --CHANGE.SPC
  15430. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15431. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS; 
  15432. with PARSERDECLARATIONS;
  15433.  
  15434. package CHANGE_TEXT is
  15435. --| Subprograms for the manipulation of source text
  15436.  
  15437. --| Overview
  15438.  
  15439. --| This package provides several subprograms which manipulate source text
  15440. --| in various ways.
  15441. --| 
  15442. --| Change_Case alters the case of the text passed in,
  15443. --| Change_Sharp changes the extended delimiter character '#' to the basic
  15444. --|     character ':' in the text of a based literal.
  15445. --| String_Value returns the text of a string with the extended and basic
  15446. --|     string delimiters represented appropriately within the string.
  15447.  
  15448.     package PD  renames PARSERDECLARATIONS;
  15449.  
  15450.     type CASE_NAME is (UPPERCASE, LOWERCASE);
  15451.  
  15452.     -----------------------------------------------------------------------
  15453.  
  15454.     function CHANGE_CASE(TOKEN_TEXT : in PD.SOURCE_TEXT;--| text to be changed
  15455.                          TO_CASE    : in CASE_NAME      --| case in which to 
  15456.                                                         --| represent Token_Text
  15457.                          ) return STRING;
  15458.     --| Changes the case of Token_Text
  15459.  
  15460.     --| Effects
  15461.  
  15462.     --| The Token_Text is changed according to the To_Case passed in.  When
  15463.     --| To_Case is SID.Bold, the return value is the same as if lowercase
  15464.     --| had been requested.  The actual bold printing is handled in procedure
  15465.     --| Bold_Print rather than here for two reasons:
  15466.     --|
  15467.     --|      1.  Tokens which would ordinarily be bold printed should be only
  15468.     --|          lowercased when bold printing is selected with
  15469.     --|          Paginated_Format off.  This is to prevent control characters
  15470.     --|          from being inserted into a file which is supposed to be
  15471.     --|          valid Ada.
  15472.     --|
  15473.     --|      2.  In determining the length of a token for placement in the
  15474.     --|          output, control characters which have no printable form,
  15475.     --|          and therefore do not take up any columns on the page, should
  15476.     --|          not be counted.
  15477.     --|
  15478.  
  15479.     -----------------------------------------------------------------------
  15480.  
  15481.     function CHANGE_SHARP(TOKEN_TEXT : in PD.SOURCE_TEXT) return STRING;
  15482.     --| Changes the extended character '#' to the basic character ':'
  15483.  
  15484.     --| Effects
  15485.  
  15486.     --| This function changes all of the '#' characters in the passed-in
  15487.     --| Token_Text to ':' characters.  Its primary use should be for changing
  15488.     --| these characters in the text of a based literal.
  15489.  
  15490.  
  15491.     -----------------------------------------------------------------------
  15492.  
  15493.     function STRING_VALUE(TOKEN_TEXT : in PD.SOURCE_TEXT) return STRING;
  15494.     --| Returns the correct text for a string, based on its delimiters
  15495.  
  15496.     --| Effects
  15497.  
  15498.     --| This function returns a string with the correct delimiters (basic
  15499.     --| or extended) and embedded delimiter characters represented correctly.
  15500.     --| For example, the input string "Here is a % character" when output
  15501.     --| with Basic Delimiters must be converted to %Here is a %% character"
  15502.     --| with the embedded delimiter character doubled.  This ensures that
  15503.     --| valid Ada strings are reproduced.
  15504.  
  15505.     -----------------------------------------------------------------------
  15506.  
  15507.     function CONVERT_PERIODS_TO_UNDERSCORES(INPUT_STRING: in STRING)
  15508.                                                   return STRING;
  15509.     --| Effects
  15510.     --| 
  15511.     --| This procedure will convert all periods in a string to underscores.
  15512.  
  15513.     -----------------------------------------------------------------
  15514.  
  15515.     function TOKEN_TEXT(TOKEN : in PD.PARSESTACKELEMENT) return STRING; 
  15516.  
  15517.     --| Effects
  15518.  
  15519.     --| Returns the canonical "text" of a token (in extended character set)
  15520.  
  15521.     -----------------------------------------------------------------
  15522.  
  15523.     function SPACED_TOKEN(CURRENT, PREVIOUS : in PD.PARSESTACKELEMENT;
  15524.                           BEGINNING_OF_LINE : in BOOLEAN) return STRING; 
  15525.     --| Effects
  15526.     --| Returns the text of a token with appropriate spaces around it, in
  15527.     --| accordance with SID.Spacing_Table and any extra spaces that are
  15528.     --| necessary.
  15529.  
  15530. end Change_Text;
  15531. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15532. --CHANGE.BDY
  15533. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15534. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS;
  15535. with SYSTEM_PARAMETERS, PARSETABLES; use SYSTEM_PARAMETERS; 
  15536. with SOURCE_INSTRUMENTER_DECLARATIONS; 
  15537. package body CHANGE_TEXT is
  15538.  
  15539. --| Subprograms for the manipulation of source text
  15540.  
  15541. --| Overview
  15542.  
  15543. --| Change_Text, Change_Sharp and String_Value are all functions which which
  15544. --| take a parameter of type PD.Source_Text which is an access to a string
  15545. --| type and return a string.  Each dereferences its parameter, performs the
  15546. --| appropriate manipulations and returns the manipulated string.  
  15547.  
  15548.     package SP renames SYSTEM_PARAMETERS;
  15549.     package PT renames PARSETABLES;
  15550.     package SID renames SOURCE_INSTRUMENTER_DECLARATIONS;
  15551.  
  15552.     -----------------------------------------------------------------------
  15553.     -- Local Subprogram Specifications
  15554.     -----------------------------------------------------------------------
  15555.  
  15556.     function UPPERCASE (CHAR : in CHARACTER) return CHARACTER;
  15557.     --| Returns the uppercase value of the passed in character
  15558.  
  15559.     --| Effects
  15560.  
  15561.     --| If Char is alphabetic, its uppercase value is returned.  Otherwise,
  15562.     --| Char is returned unchanged.
  15563.  
  15564.     -----------------------------------------------------------------------
  15565.  
  15566.     function LOWERCASE (CHAR : in CHARACTER) return CHARACTER;
  15567.     --| Returns the lowercase value of the passed in character
  15568.  
  15569.     --| Effects
  15570.  
  15571.     --| If Char is alphabetic, its lowercase value is returned.  Otherwise,
  15572.     --| Char is returned unchanged.
  15573.  
  15574.     -----------------------------------------------------------------------
  15575.     -- External Subprogram Bodies
  15576.     -----------------------------------------------------------------------
  15577.  
  15578.     function CHANGE_CASE (TOKEN_TEXT : in PD.SOURCE_TEXT;
  15579.                           TO_CASE    : in CASE_NAME) return STRING is
  15580.  
  15581.         PRECEDING_UNDERSCORE : BOOLEAN := TRUE;
  15582.         --| Flags that the preceding character is an underscore, indicating
  15583.         --| that the following character should be capitalized.  Initialized
  15584.         --| to True so that the first character of the Token will be 
  15585.         --| capitalized.
  15586.  
  15587.     begin
  15588.  
  15589.         -- case selectors match enumeration type Case_Name
  15590.         case TO_CASE is
  15591.             when UPPERCASE =>
  15592.                 for I in TOKEN_TEXT.ALL'FIRST .. TOKEN_TEXT.ALL'LAST loop
  15593.                     TOKEN_TEXT.ALL(I) := UPPERCASE(TOKEN_TEXT.ALL(I));
  15594.                 end loop;
  15595.                 return TOKEN_TEXT.ALL;
  15596.             when LOWERCASE  => 
  15597.                 for I in TOKEN_TEXT.ALL'FIRST .. TOKEN_TEXT.ALL'LAST loop
  15598.                     TOKEN_TEXT.ALL(I) := LOWERCASE(TOKEN_TEXT.ALL(I));
  15599.                 end loop;
  15600.                 return TOKEN_TEXT.ALL;
  15601.         end case;
  15602.     end CHANGE_CASE;
  15603.  
  15604.     -----------------------------------------------------------------------
  15605.  
  15606.     function CHANGE_SHARP (TOKEN_TEXT : in PD.SOURCE_TEXT) return STRING is
  15607.     begin
  15608.         for I in TOKEN_TEXT.ALL'FIRST .. TOKEN_TEXT.ALL'LAST loop
  15609.             if TOKEN_TEXT.ALL(I) = '#' then 
  15610.                 TOKEN_TEXT.ALL(I) := ':';
  15611.             end if;
  15612.         end loop;
  15613.         return TOKEN_TEXT.ALL;
  15614.     end CHANGE_SHARP;
  15615.  
  15616.     -----------------------------------------------------------------------
  15617.  
  15618.     function STRING_VALUE (TOKEN_TEXT : in PD.SOURCE_TEXT) return STRING is
  15619.         MARK : POSITIVE; --| Marks a point in the input string as the start of
  15620.                          --| where to copy the next section of string.
  15621.         STRING_TEXT : PD.SOURCE_TEXT; --| String being built
  15622.         DELIMITER_CHARACTER : CHARACTER := '"'; --| String delimiter character
  15623.         DELIMITER_STRING : STRING(1 .. 1) := """";
  15624.         --| String to insert into the string being built as delimiter character
  15625.  
  15626.     begin
  15627.         if SP.DELIMITERS = SP.BASIC then
  15628.             DELIMITER_CHARACTER := '%';
  15629.             DELIMITER_STRING := "%";
  15630.         else
  15631.             DELIMITER_CHARACTER := '"';
  15632.             DELIMITER_STRING := """"; 
  15633.         end if;
  15634.         STRING_TEXT := new STRING'(DELIMITER_STRING);
  15635.         MARK := TOKEN_TEXT'FIRST;
  15636.         for I in TOKEN_TEXT'FIRST .. TOKEN_TEXT'LAST loop
  15637.             if TOKEN_TEXT.ALL(I) = DELIMITER_CHARACTER then
  15638.                 STRING_TEXT := new STRING'(
  15639.                     STRING_TEXT.ALL & TOKEN_TEXT.ALL(MARK .. I) & 
  15640.                     DELIMITER_STRING);
  15641.                 MARK := I + 1;
  15642.             end if;
  15643.         end loop;
  15644.         return STRING_TEXT.ALL & TOKEN_TEXT.ALL(MARK .. TOKEN_TEXT.ALL'LAST) &
  15645.             DELIMITER_STRING;
  15646.     end STRING_VALUE;         
  15647.  
  15648.     -----------------------------------------------------------------------
  15649.     -- Local Subprogram Bodies
  15650.     -----------------------------------------------------------------------
  15651.  
  15652.     function UPPERCASE (CHAR : in CHARACTER) return CHARACTER is
  15653.     begin
  15654.         if CHAR in 'a' .. 'z' then
  15655.             return CHARACTER'VAL(CHARACTER'POS(CHAR) - CHARACTER'POS('a') +
  15656.                 CHARACTER'POS('A'));
  15657.         else
  15658.             return CHAR;
  15659.         end if;
  15660.     end UPPERCASE; 
  15661.  
  15662.     -----------------------------------------------------------------------
  15663.  
  15664.     function LOWERCASE (CHAR : in CHARACTER) return CHARACTER is
  15665.     begin
  15666.         if CHAR in 'A' .. 'Z' then
  15667.             return CHARACTER'VAL(CHARACTER'POS(CHAR) - CHARACTER'POS('A') +
  15668.                 CHARACTER'POS('a'));
  15669.         else
  15670.             return CHAR;
  15671.         end if;
  15672.     end LOWERCASE;
  15673.  
  15674.     -----------------------------------------------------------------------
  15675.  
  15676.     function CONVERT_PERIODS_TO_UNDERSCORES(INPUT_STRING: in STRING)
  15677.                                                          return STRING is
  15678.       OUTPUT_STRING: STRING(1..INPUT_STRING'length);
  15679.     begin
  15680.       for INDEX in INPUT_STRING'range loop
  15681.         if INPUT_STRING(INDEX) = '.' then
  15682.           OUTPUT_STRING(INDEX) := '_';
  15683.         else
  15684.           OUTPUT_STRING(INDEX) := INPUT_STRING(INDEX);   
  15685.         end if;
  15686.       end loop;
  15687.       return OUTPUT_STRING;
  15688.     end;
  15689.  
  15690.   function TOKEN_TEXT(TOKEN : in PD.PARSESTACKELEMENT) return STRING is 
  15691.   begin
  15692.     if (TOKEN.GRAM_SYM_VAL in PD.SINGLEDELIMITERRANGE) or (TOKEN.GRAM_SYM_VAL
  15693.       in PD.DOUBLEDELIMITERRANGE) then 
  15694.       if TOKEN.GRAM_SYM_VAL = PT.BAR_TOKENVALUE then 
  15695.         if SP.DELIMITERS = SP.BASIC then 
  15696.           return ("!"); 
  15697.         else 
  15698.           return ("|"); 
  15699.         end if; 
  15700.       else 
  15701.         return PT.GET_GRAMMAR_SYMBOL(TOKEN.GRAM_SYM_VAL); 
  15702.       end if; 
  15703.     elsif TOKEN.GRAM_SYM_VAL = PT.STRINGTOKENVALUE then 
  15704.       return STRING_VALUE(TOKEN.LEXED_TOKEN.TEXT); 
  15705.     elsif TOKEN.GRAM_SYM_VAL = PT.CHARACTERTOKENVALUE then 
  15706.       return (TOKEN.LEXED_TOKEN.TEXT.all & "'"); 
  15707.     elsif TOKEN.GRAM_SYM_VAL = PT.COMMENT_TOKENVALUE then 
  15708.       return ("--" & TOKEN.LEXED_TOKEN.TEXT.all); 
  15709.     elsif TOKEN.GRAM_SYM_VAL in PD.RESERVEDWORDRANGE then 
  15710.       return CHANGE_CASE(TOKEN.LEXED_TOKEN.TEXT, LOWERCASE); 
  15711.     elsif TOKEN.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE then 
  15712.       return CHANGE_CASE(TOKEN.LEXED_TOKEN.TEXT, UPPERCASE); 
  15713.     elsif (TOKEN.GRAM_SYM_VAL = PT.NUMERICTOKENVALUE) and 
  15714.           (SP.DELIMITERS = SP.BASIC) then 
  15715.       return CHANGE_SHARP(TOKEN.LEXED_TOKEN.TEXT); 
  15716.     else 
  15717.       return TOKEN.LEXED_TOKEN.TEXT.all; 
  15718.     end if; 
  15719.   end TOKEN_TEXT; 
  15720.  
  15721.   -----------------------------------------------------------------
  15722.  
  15723.   function SPACED_TOKEN(CURRENT, PREVIOUS : in PD.PARSESTACKELEMENT;
  15724.                         BEGINNING_OF_LINE : in BOOLEAN) return
  15725.     STRING is 
  15726.     PRECEDING_SPACE : BOOLEAN := FALSE; 
  15727.   begin
  15728.  
  15729.     -- Given context of Current and Previous grammar symbols, determine
  15730.     -- whether space should precede current token.
  15731.     -- This can't be a case statement because of non-static bound of
  15732.     -- GrammarSymbolRange, which is the type of all names of the
  15733.     -- form PT.xxxTokenValue
  15734.     if (CURRENT.GRAM_SYM_VAL = PT.MODTOKENVALUE) then 
  15735.       if PREVIOUS.GRAM_SYM_VAL /= PT.ATTOKENVALUE then 
  15736.         PRECEDING_SPACE := TRUE; 
  15737.       end if; 
  15738.     elsif (CURRENT.GRAM_SYM_VAL = PT.USETOKENVALUE) then 
  15739.       if PREVIOUS.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE then 
  15740.         PRECEDING_SPACE := TRUE; 
  15741.       end if; 
  15742.     elsif (CURRENT.GRAM_SYM_VAL = PT.COLONEQ_TOKENVALUE) then 
  15743.       if PREVIOUS.GRAM_SYM_VAL /= PT.CONSTANTTOKENVALUE then 
  15744.         PRECEDING_SPACE := TRUE; 
  15745.       end if; 
  15746.     elsif (CURRENT.GRAM_SYM_VAL = PT.THENTOKENVALUE) then 
  15747.       if PREVIOUS.GRAM_SYM_VAL /= PT.ANDTOKENVALUE then 
  15748.         PRECEDING_SPACE := TRUE; 
  15749.       end if; 
  15750.     elsif (CURRENT.GRAM_SYM_VAL = PT.INTOKENVALUE) or 
  15751.           (CURRENT.GRAM_SYM_VAL = PT.LOOPTOKENVALUE) then 
  15752.       if PREVIOUS.GRAM_SYM_VAL /= PT.COLON_TOKENVALUE then 
  15753.         PRECEDING_SPACE := TRUE; 
  15754.       end if; 
  15755.     elsif (CURRENT.GRAM_SYM_VAL = PT.PLUS_TOKENVALUE) or 
  15756.           (CURRENT.GRAM_SYM_VAL = PT.MINUS_TOKENVALUE) then 
  15757.       if PREVIOUS.GRAM_SYM_VAL /= PT.LEFTPAREN_TOKENVALUE then 
  15758.         PRECEDING_SPACE := TRUE; 
  15759.       end if; 
  15760.     elsif (CURRENT.GRAM_SYM_VAL = PT.WHENTOKENVALUE) then 
  15761.       if PREVIOUS.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE then 
  15762.         PRECEDING_SPACE := TRUE; 
  15763.       end if; 
  15764.     elsif (CURRENT.GRAM_SYM_VAL = PT.RANGETOKENVALUE) or 
  15765.           (CURRENT.GRAM_SYM_VAL = PT.DIGITSTOKENVALUE) or 
  15766.           (CURRENT.GRAM_SYM_VAL = PT.DELTATOKENVALUE) then 
  15767.       if (PREVIOUS.GRAM_SYM_VAL /= PT.APOSTROPHE_TOKENVALUE) and 
  15768.          (PREVIOUS.GRAM_SYM_VAL /= PT.ISTOKENVALUE) then 
  15769.         PRECEDING_SPACE := TRUE; 
  15770.       end if; 
  15771.     elsif (CURRENT.GRAM_SYM_VAL = PT.NOTTOKENVALUE) and
  15772.           (PREVIOUS.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE) then
  15773.       PRECEDING_SPACE := TRUE;
  15774.     elsif (PREVIOUS.GRAM_SYM_VAL = PT.CASETOKENVALUE) or 
  15775.           (PREVIOUS.GRAM_SYM_VAL = PT.DELTATOKENVALUE) or 
  15776.           (PREVIOUS.GRAM_SYM_VAL = PT.DIGITSTOKENVALUE) or
  15777.           (PREVIOUS.GRAM_SYM_VAL = PT.ENDTOKENVALUE) or 
  15778.           (PREVIOUS.GRAM_SYM_VAL = PT.EXITTOKENVALUE) or 
  15779.           (PREVIOUS.GRAM_SYM_VAL = PT.IFTOKENVALUE) or 
  15780.           (PREVIOUS.GRAM_SYM_VAL = PT.LOOPTOKENVALUE) or 
  15781.           (PREVIOUS.GRAM_SYM_VAL = PT.RETURNTOKENVALUE) or 
  15782.           (PREVIOUS.GRAM_SYM_VAL = PT.RAISETOKENVALUE) or 
  15783.           (PREVIOUS.GRAM_SYM_VAL = PT.RANGETOKENVALUE) or 
  15784.           (PREVIOUS.GRAM_SYM_VAL = PT.SELECTTOKENVALUE) then 
  15785.       if (CURRENT.GRAM_SYM_VAL /= PT.SEMICOLON_TOKENVALUE) and 
  15786.           -- Empty Token handles pop of loop or block identifier. 
  15787.          (CURRENT.GRAM_SYM_VAL /= PT.EMPTY_TOKENVALUE) then 
  15788.         PRECEDING_SPACE := TRUE; 
  15789.       end if; 
  15790.     elsif (PREVIOUS.GRAM_SYM_VAL = PT.ABSTOKENVALUE) then 
  15791.       if CURRENT.GRAM_SYM_VAL /= PT.LEFTPAREN_TOKENVALUE then 
  15792.         PRECEDING_SPACE := TRUE; 
  15793.       end if; 
  15794.     end if; 
  15795.  
  15796.     -- Return the spaced token
  15797.     case SID.SPACING_TABLE(CURRENT.GRAM_SYM_VAL) is 
  15798.       when SID.AFTER => 
  15799.         if BEGINNING_OF_LINE or not PRECEDING_SPACE then 
  15800.           return TOKEN_TEXT(CURRENT) & " "; 
  15801.         else 
  15802.           return " " & TOKEN_TEXT(CURRENT) & " "; 
  15803.         end if; 
  15804.       when SID.BEFORE => 
  15805.         if BEGINNING_OF_LINE then 
  15806.           return TOKEN_TEXT(CURRENT); 
  15807.         else 
  15808.           return " " & TOKEN_TEXT(CURRENT); 
  15809.         end if; 
  15810.       when SID.AROUND => 
  15811.         if BEGINNING_OF_LINE then 
  15812.           return TOKEN_TEXT(CURRENT) & " "; 
  15813.         else 
  15814.           return " " & TOKEN_TEXT(CURRENT) & " "; 
  15815.         end if; 
  15816.       when SID.NONE => 
  15817.         if BEGINNING_OF_LINE or not PRECEDING_SPACE then 
  15818.           return TOKEN_TEXT(CURRENT); 
  15819.         else 
  15820.           return " " & TOKEN_TEXT(CURRENT); 
  15821.         end if; 
  15822.     end case; 
  15823.   end SPACED_TOKEN; 
  15824.  
  15825. end Change_Text;
  15826. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15827. --GENUTILS.SPC
  15828. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15829. with STRING_PKG; use STRING_PKG;
  15830. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  15831.  
  15832. package SD_GENERATION_UTILITIES is
  15833.  
  15834.    -- This package contains the procedures which generate the
  15835.    -- code for tracing variables which is added to the instrumented 
  15836.    -- source file.
  15837.  
  15838.    --------------------------------------------------------------------------
  15839.  
  15840.    procedure GENERATE_FINDVAR_SPEC;
  15841.    -- Generate the procedure specification for this scope's "Find_Variable"
  15842.    -- procedure.
  15843.  
  15844.    --------------------------------------------------------------------------
  15845.  
  15846.    procedure GENERATE_FINDVAR_BODY(VARIABLE_LIST : NAME_LISTS.LIST;
  15847.                                    PACKAGE_LIST  : STRING_LISTS.LIST;
  15848.                                    WITH_LIST     : STRING_LISTS.LIST;
  15849.                                    USE_LIST      : STRING_LISTS.LIST);
  15850.  
  15851.    -- Generate the body of the "Find_Variable" procedure  for a scope that 
  15852.    -- is not a package specification.
  15853.  
  15854.    -----------------------------------------------------------------------
  15855.  
  15856.    procedure GENERATE_PACKAGE_FINDVAR(VARIABLE_LIST : NAME_LISTS.LIST;
  15857.                                       PACKAGE_LIST  : STRING_LISTS.LIST;
  15858.                                       USE_LIST      : STRING_LISTS.LIST);
  15859.  
  15860.    -- Generate the body of the "Find_Variable" procedure for a package 
  15861.    -- specification. 
  15862.  
  15863.    --------------------------------------------------------------------------
  15864.  
  15865.    procedure GENERATE_LOCAL_BREAK(PROGRAM_UNIT_NUMBER : NATURAL;
  15866.                                   IS_A_TASK           : BOOLEAN);
  15867.    
  15868.    -- Generate an instantion of the Local_Break template.
  15869.  
  15870.    --------------------------------------------------------------------------
  15871.  
  15872.    procedure GENERATE_DUMMY_LOCALS(PARAM_LIST : in out NAME_LISTS.LIST);
  15873.  
  15874.    -- Create a local variable for each OUT mode formal parameter.
  15875.    -- This is necessary because setting procedures have parameters
  15876.    -- of mode IN OUT. The dummy variable will be passed to the 
  15877.    -- setting procedure, and then its value will be assigned to the 
  15878.    -- formal parameter.
  15879.  
  15880.    --------------------------------------------------------------------------
  15881.  
  15882.    procedure GENERATE_TRACING_SPECS(TYPE_NAME : STRING);
  15883.  
  15884.    -- Generate specifications for the tracing procedures that will
  15885.    -- be created for this type.  It is not a type for which there
  15886.    -- are generic tracing templates, so we will have to create the
  15887.    -- procedures.  The procedure bodies will be written to the buffer
  15888.    -- file and copied into the instrumented source file later.
  15889.  
  15890.    --------------------------------------------------------------------------
  15891.  
  15892.    procedure GENERATE_TRACING_INSTANTIATION(TYPE_NAME : STRING;
  15893.                                             TYPE_KIND : TYPE_CLASS);
  15894.  
  15895.    -- The current type is one for which there are tracing templates,
  15896.    -- so generate instantiations for the procedures.
  15897.  
  15898.  
  15899.    --------------------------------------------------------------------------
  15900.  
  15901.    procedure GENERATE_ANON_TYPE(ANON_TEXT : STRING_LISTS.LIST);
  15902.  
  15903.    -- Generate a type definition for an anonymous array types.  The
  15904.    -- set and display procedures are called with an explicit type conversion
  15905.    -- of the anonymous array object to this type.
  15906.  
  15907.    --------------------------------------------------------------------------
  15908.  
  15909.    procedure GENERATE_DERIVED_TRACE(TYPE_NAME   : STRING;
  15910.                                     PARENT_NAME : STRING);
  15911.  
  15912.    -- Generate procedure bodies for tracing a derived type.  The
  15913.    -- set and display procedures are called with an explicit type
  15914.    -- conversion of the variable to its parent type.
  15915.  
  15916.  
  15917.    --------------------------------------------------------------------------
  15918.  
  15919.    procedure GENERATE_ARRAY_TRACE(TYPE_NAME  : STRING; 
  15920.                                   DIMENSIONS : NATURAL);
  15921.    
  15922.    -- Generate procedure bodies for tracing array types.  Different
  15923.    -- code is generated for tracing one dimensional and multi-dimensional
  15924.    -- arrays.
  15925.  
  15926.  
  15927.    --------------------------------------------------------------------------
  15928.  
  15929.    procedure GENERATE_RECORD_TRACE(TYPE_NAME        : STRING;
  15930.                                    LIST_OF_FIELDS   : RECORD_LISTS.LIST;
  15931.                                    LIST_OF_DISCRIMS : STRING_LISTS.LIST;
  15932.                                    CASE_DISCRIM     : STRING_TYPE);
  15933.  
  15934.    -- Generate the bodies of the procedures to set and display record
  15935.    -- types.
  15936.  
  15937.    --------------------------------------------------------------------------
  15938.  
  15939.    procedure GENERATE_ACCESS_TRACE(TYPE_NAME : STRING);
  15940.  
  15941.    -- Generate the bodies of the procedures to set and display access
  15942.    -- types.  
  15943.  
  15944.    --------------------------------------------------------------------------
  15945.  
  15946. end SD_GENERATION_UTILITIES;
  15947.  
  15948. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15949. --GENUTILS.BDY
  15950. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15951. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  15952. with SCOPE_PACKAGE; use SCOPE_PACKAGE;
  15953. with TEXT_IO; use TEXT_IO;
  15954. with SD_BUFFER_FILES; use SD_BUFFER_FILES;
  15955. with STRING_UTILITIES; use STRING_UTILITIES;
  15956. with SD_SOURCE_BUFFERING; use SD_SOURCE_BUFFERING;
  15957.  
  15958. package body SD_GENERATION_UTILITIES is
  15959.  
  15960.    -- This package has the procedures which generate code to the
  15961.    -- instrumented source to accomplish variable tracing.
  15962.  
  15963.    --------------------------------------------------------------------------
  15964.    -- Procedure Local_Break --
  15965.  
  15966.    -- Each scope has a Local_Break which is called before each executable
  15967.    -- statement.  If the breakpoint for this statement has been set,
  15968.    -- the User_Interface task is called and the user can issue any
  15969.    -- interactive requests.  If the request is to set or display a variable, 
  15970.    -- procedure F is called.
  15971.  
  15972.    --------------------------------------------------------------------------
  15973.    -- Procedure F --
  15974.  
  15975.    -- One uniquely named procedure "F" (short for "find variable") is 
  15976.    -- generated in each scope.  This procedure checks to see if the
  15977.    -- variable the user wants to trace is declared in this scope.
  15978.    -- If so, F calls set or display with the specified variable as the
  15979.    -- parameter, and then raises an exception so that no further scopes
  15980.    -- are searched.  The exception is handled and Local_Break resumes.
  15981.    -- 
  15982.    -- If the variaible was not found here, other Fs are called:
  15983.    --   1. If this is a package body, check the package body variables,
  15984.    --      check the private variables, and check the package spec.
  15985.    --   2. Check any local packages.
  15986.    --   3. Check the outer scope.    
  15987.    -- If the variable still hasn't been found, an error message is issued.
  15988.    --
  15989.    -- The procedure name is formed by prefixing F with the scope name, a
  15990.    -- special prefix, and sometimes "SPEC" or "PRIV".  The name has to 
  15991.    -- be unique so one F can call other Fs.
  15992.    -- 
  15993.    -- The actual content of each procedure "F" will vary depending on the
  15994.    -- type of scope, and whether there are local packages and enclosing
  15995.    -- scopes. A typical example of "F" for a procedure P with variables 
  15996.    -- X and Y is given below, with commentary in parentheses.
  15997.    -- 
  15998.    -- procedure P_SI2AFSD_1861_F(S: String) is
  15999.    --  (the use list will be a parameter if this is for a package spec.
  16000.    --   S has any loop params and their current value.)
  16001.  
  16002.    -- begin
  16003.    --   SD_Runtime_Utilities.Searching_Scope("P.");
  16004.    --     (Initialize variable scanner and value string if this is a new
  16005.    --      variable. See if the user explicitly gave this scope.)
  16006.    --
  16007.    --   SD_Runtime_Utilities.Check_Loop_Param(S);
  16008.    --      (S is a string representing the current FOR loop parameter and
  16009.    --       its current value, if we are in a FOR loop. If the user wants
  16010.    --       to display the loop parameter, then get the value part of S,
  16011.    --       and stop searching.)
  16012.    --
  16013.    --   case SD_Runtime_Utilities.Search_For_Variable("X Y ") is
  16014.    --      (The string parameter is generated from the current visible
  16015.    --       variable list.  Search_For_Variable returns the number
  16016.    --       of which item in the list it matched or 0 if no match.)
  16017.    -- 
  16018.    --       when 1 => (assume X can be set and displayed)
  16019.    --          (All set and display procedures have the same names.)
  16020.    --          if SD_Runtime_Utilities.Command = PUT_VAR then
  16021.    --            SI2AFSD_1861_D ("P.X", P.X); 
  16022.    --          else
  16023.    --            SI2AFSD_1861_S (P.X);       
  16024.    --          end if;
  16025.    --          raise Stop_Searching;
  16026.    --          (Exit by exception so no further searching is done.)
  16027.    --
  16028.    --       when 2 => (assume Y is a constant)
  16029.    --          if SD_Runtime_Utilities.Command = PUT_VAR then
  16030.    --            SI2AFSD_1861_D ("P.Y", P.Y);
  16031.    --          else
  16032.    --            Error_Message("Constants can't be set");
  16033.    --          end if;
  16034.    -- 
  16035.    --       when others =>
  16036.    --          null;
  16037.    --          (If this is a package body, call F to search its 
  16038.    --           private and public variables.
  16039.    --           Call F to search any local packages.)
  16040.    --   end case;
  16041.  
  16042.    --   (if there is an outer scope then)
  16043.    --   if SD_Runtime_Utilities.Search_Outer_Scope then
  16044.    --        (Determines whether to keep looking according
  16045.    --         to the current scope and what the user typed in.)
  16046.    --      OUTER_SCOPE_NAME_SI2AFSD_1861_F;
  16047.    --   else
  16048.    --      Error_Message("Variable not found");
  16049.    --   end if;
  16050.    --
  16051.    --   (If there is no outer scope then search through library units 
  16052.    --    given in the with clause before giving the error message.)
  16053.    --
  16054.    --   exception  
  16055.    --     when Constraint_Error => 
  16056.    --        Error_Message("Constraint_Error raised");
  16057.    --     when others => null; 
  16058.    --        (If the variable was found in this scope, Stop_Searching is
  16059.    --         raised. Handle it here and go back to interacting with the user.)
  16060.    -- end;
  16061.  
  16062.    --------------------------------------------------------------------------
  16063.    -- Set and Display and Make_String procedures
  16064.  
  16065.    -- Procedures to set and display a variable will be added for each type
  16066.    -- definition encountered in the user's program.  The set procedure is
  16067.    -- named SI2AFSD_1861_S; the display procedure is named SI2AFSD_1861_D;
  16068.    -- the make_string function is named SI2AFSD_1861_M and returns a string.
  16069.  
  16070.    -- The Make_String function returns the string image of the current value
  16071.    -- for discrete values, or a null string otherwise.  This is used
  16072.    -- for matching array indices.
  16073.  
  16074.    -- When F calls the set or display procedure for a variable, it is
  16075.    -- guaranteed that these subprograms for that type have been created and 
  16076.    -- are visible.  The compiler will resolve the overloading.
  16077.  
  16078.    -- The tracing procedures for all predefined types are provided in the 
  16079.    -- package SD_TRACE_PREDEFINED_TYPES.  Generic templated are provided in
  16080.    -- SD_GENERIC_TEMPLATES for enumeration types, numeric types, and private
  16081.    -- types. Only an instantiation is generated to the instrumented source.
  16082.  
  16083.    --------------------------------------------------------------------------
  16084.  
  16085.  
  16086.    --------------------------------------------------------------------------
  16087.  
  16088.    type OUT_PARAM_TYPE_CLASS is 
  16089.       (PREDEFINED_STRING, PREDEFINED_SCALAR, USER_DEFINED);
  16090.  
  16091.    type DISPLAY_OR_SET is (DISPLAY, SET);
  16092.  
  16093.  
  16094.    --------------------------------------------------------------------------
  16095.    -- local subprogram declarations --
  16096.    --------------------------------------------------------------------------
  16097.  
  16098.    --------------------------------------------------------------------------
  16099.    procedure GENERATE_LIST_PARAMETER(L : NAME_LISTS.LIST);
  16100.  
  16101.    -- Generate a literal string consisting of the Object_Name field of
  16102.    -- each item in the list, followed by one blank.
  16103.  
  16104.    --------------------------------------------------------------------------
  16105.    procedure GENERATE_LIST_PARAMETER(L : STRING_LISTS.LIST);
  16106.  
  16107.    -- Generate a literal string consisting of each item in the list,
  16108.    -- followed by one blank.
  16109.  
  16110.    --------------------------------------------------------------------------
  16111.    function CHECK_TYPE_NAME(TYPE_NAME : STRING) return OUT_PARAM_TYPE_CLASS;
  16112.  
  16113.    -- Check the type name for an OUT mode parameter.  If it is STRING,
  16114.    -- return PREDEFINED_STRING; if it is a known predefined scalar type, 
  16115.    -- return; otherwise return USER_DEFINED.
  16116.  
  16117.    --------------------------------------------------------------------------
  16118.    procedure GENERATE_F_CASE_STMT(VARIABLE_LIST : NAME_LISTS.LIST;
  16119.                                   PACKAGE_LIST  : STRING_LISTS.LIST;
  16120.                                   USE_LIST      : STRING_LISTS.LIST);
  16121.  
  16122.    -- Generate the case statement of procedure F.
  16123.  
  16124.    --------------------------------------------------------------------------
  16125.    procedure GENERATE_F_CASE_BRANCH(CURRENT_VAR : NAME_RECORD;
  16126.                                     VAR_NUMBER  : POSITIVE;
  16127.                                     IN_ACCEPT   : BOOLEAN);
  16128.  
  16129.    -- Generate a branch in the case statement for the current variable.
  16130.  
  16131.    --------------------------------------------------------------------------
  16132.    procedure GENERATE_NOT_FOUND_BRANCH(PACKAGE_LIST : STRING_LISTS.LIST;
  16133.                                        USE_LIST     : STRING_LISTS.LIST);
  16134.  
  16135.    -- Generate the "when others =>" branch of the case statement.  If the
  16136.    -- current scope is a package body, call F for its private declarations,
  16137.    -- and then call F for its spec.  If there were any local packages
  16138.    -- in the current scope, then call F for them.  Otherwise, generate 
  16139.    -- "null;".
  16140.  
  16141.    --------------------------------------------------------------------------
  16142.    procedure GENERATE_TRACE_LOCAL_PACKAGES(PACKAGE_LIST : STRING_LISTS.LIST;
  16143.                                            USE_LIST     : STRING_LISTS.LIST);
  16144.  
  16145.    -- If there are local packages to trace, generate the call to their
  16146.    -- procedure F.  
  16147.  
  16148.    --------------------------------------------------------------------------
  16149.    procedure GENERATE_TRACE_WITHED_UNITS(WITH_LIST : STRING_LISTS.LIST;
  16150.                                          USE_LIST  : STRING_LISTS.LIST);
  16151.  
  16152.    -- If there are any packages in the context clause, generate a call to
  16153.    -- their procedure F.
  16154.  
  16155.    --------------------------------------------------------------------------
  16156.    procedure GENERATE_ONE_DIMENSION_ARRAY_TRACE(TYPE_NAME : STRING);
  16157.  
  16158.    -- Generate the D and S procedures for a one dimensional array.
  16159.  
  16160.    --------------------------------------------------------------------------
  16161.    procedure GENERATE_N_DIMENSION_ARRAY_TRACE(TYPE_NAME  : STRING;
  16162.                                               DIMENSIONS : INTEGER);
  16163.  
  16164.    -- Generate the D and S procedures for a multi_dimensional array.
  16165.  
  16166.    --------------------------------------------------------------------------
  16167.    procedure WRITE_CHOICE_TEXT(TEXT : STRING_LISTS.LIST);
  16168.  
  16169.    -- Recreate the choice text from a variant record.  The text has been
  16170.    -- saved as a list of string_types.  Each item in the text will be
  16171.    -- separated by one blank.
  16172.  
  16173.    --------------------------------------------------------------------------
  16174.    procedure GENERATE_TRACE_RECORD_FIELD(FIELDS      : STRING_LISTS.LIST;
  16175.                                          PROC        : DISPLAY_OR_SET;
  16176.                                          FOUND_CASE  : BOOLEAN;
  16177.                                          FOUND_FIELD : out BOOLEAN);
  16178.  
  16179.    -- Generate the if statment that determines if the current record field
  16180.    -- should be traced.
  16181.  
  16182.    --------------------------------------------------------------------------
  16183.  
  16184.  
  16185.    --------------------------------------------------------------------------
  16186.    -- External subprogram bodies --
  16187.    --------------------------------------------------------------------------
  16188.  
  16189.    --------------------------------------------------------------------------
  16190.    procedure GENERATE_FINDVAR_SPEC is
  16191.  
  16192.       -- Generate the procedure specification for this scope's procedure "F".
  16193.  
  16194.    begin
  16195.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then
  16196.          if CURRENT_SCOPE.IN_PRIVATE_PART then
  16197.             WRITE_LINE_SPEC_BUFFER(
  16198.                "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) & 
  16199.                "PRIV_F(S: STRING := """");");
  16200.          else
  16201.             WRITE_LINE_SPEC_BUFFER(
  16202.                "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) & 
  16203.                "SPEC_F(UL: STRING);");
  16204.          end if;
  16205.       else
  16206.          TEXT_IO.NEW_LINE(INSTRUMENTED_FILE);
  16207.          WRITE_LINE_INST_SOURCE(
  16208.             "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) &
  16209.             "F(S: STRING := """");");
  16210.       end if;
  16211.    end GENERATE_FINDVAR_SPEC;
  16212.  
  16213.    --------------------------------------------------------------------------
  16214.    procedure GENERATE_FINDVAR_BODY(VARIABLE_LIST : NAME_LISTS.LIST;
  16215.                                    PACKAGE_LIST  : STRING_LISTS.LIST;
  16216.                                    WITH_LIST     : STRING_LISTS.LIST;
  16217.                                    USE_LIST      : STRING_LISTS.LIST) is
  16218.  
  16219.       -- Generate the body of procedure "F" for a scope that is not
  16220.       -- a package specification.
  16221.  
  16222.    begin
  16223.       WRITE_LINE_BODY_BUFFER(
  16224.         "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) &
  16225.         "F(S: STRING := """") is");
  16226.       WRITE_LINE_BODY_BUFFER("begin");
  16227.  
  16228.       WRITE_LINE_BODY_BUFFER(
  16229.         "SD_Runtime_Utilities.Searching_Scope(" &
  16230.         """STANDARD." & VALUE(CURRENT_SCOPE.QUALIFIED_NAME_STRING) & 
  16231.         "."");");
  16232.       WRITE_LINE_BODY_BUFFER("SD_Runtime_Utilities.Check_Loop_Param(S);");
  16233.       GENERATE_F_CASE_STMT(VARIABLE_LIST, PACKAGE_LIST, USE_LIST);
  16234.       
  16235.       if not IS_EMPTY(CURRENT_OUTER_SCOPE.SCOPE_NAME) then
  16236.          WRITE_LINE_BODY_BUFFER(
  16237.            "if SD_Runtime_Utilities.Search_Outer_Scope then");
  16238.          if CURRENT_NESTING_LEVEL = 1 then
  16239.            GENERATE_TRACE_WITHED_UNITS(WITH_LIST, USE_LIST);
  16240.          end if;
  16241.          WRITE_LINE_BODY_BUFFER(
  16242.            "  " & VALUE(CURRENT_OUTER_SCOPE.TRACING_PREFIX) & "F;");
  16243.          WRITE_LINE_BODY_BUFFER("else");
  16244.          WRITE_LINE_BODY_BUFFER(
  16245.           "  SD_Runtime_Utilities.Error_Message(""Variable not found"");");
  16246.          WRITE_LINE_BODY_BUFFER("end if;");
  16247.  
  16248.       else
  16249.          GENERATE_TRACE_WITHED_UNITS(WITH_LIST, USE_LIST);
  16250.          WRITE_LINE_BODY_BUFFER(
  16251.            "SD_Runtime_Utilities.Error_Message(""Variable not found"");");
  16252.       end if;
  16253.  
  16254.       WRITE_LINE_BODY_BUFFER("exception");
  16255.       WRITE_LINE_BODY_BUFFER("  when Constraint_Error =>");
  16256.       WRITE_LINE_BODY_BUFFER(
  16257.         "    SD_Runtime_Utilities.Error_Message(" &
  16258.         """Constraint error raised"");");
  16259.       WRITE_LINE_BODY_BUFFER("  when others => null;");
  16260.       WRITE_LINE_BODY_BUFFER( "end;");
  16261.    end GENERATE_FINDVAR_BODY;
  16262.  
  16263.    -----------------------------------------------------------------------
  16264.    procedure GENERATE_PACKAGE_FINDVAR(VARIABLE_LIST : NAME_LISTS.LIST;
  16265.                                       PACKAGE_LIST  : STRING_LISTS.LIST;
  16266.                                       USE_LIST      : STRING_LISTS.LIST) is
  16267.  
  16268.       -- Generate the body of procedure "F" for a package specification.
  16269.       -- It is basically the same as the procedure for other types of
  16270.       -- scopes except:
  16271.       -- 1: The use list is a parameter
  16272.       -- 2: The determination of whether to look here is made by calling
  16273.       --    Runtime_Utilities "Search_This_Package" instead of 
  16274.       --    "Search_This_Scope".  
  16275.       -- 3: Local packages are searched regardless of whether the enclosing 
  16276.       --    package is searched because they may be visible by specific dot 
  16277.       --    notation, or a nested package may be named in a use clause.
  16278.       -- 4: No exception handler for stop searching is included so that the 
  16279.       --    calling procedure "F" will handle the exception and quit searching.
  16280.       -- 5: If this is for the private part of a package, searching is
  16281.       --    unconditional.  The procedure won't be called if it shouldn't
  16282.       --    be searched.
  16283.  
  16284.    begin
  16285.       if CURRENT_SCOPE.IN_PRIVATE_PART then
  16286.          WRITE_LINE_BODY_BUFFER(
  16287.            "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) & 
  16288.            "PRIV_F(S: STRING := """") is");
  16289.          WRITE_LINE_BODY_BUFFER("begin");         
  16290.          GENERATE_F_CASE_STMT(VARIABLE_LIST, PACKAGE_LIST, USE_LIST);
  16291.       else
  16292.          WRITE_LINE_BODY_BUFFER(
  16293.            "procedure " & VALUE(CURRENT_SCOPE.TRACING_PREFIX) & 
  16294.            "SPEC_F(UL: String) is");
  16295.          WRITE_LINE_BODY_BUFFER("begin");
  16296.          WRITE_LINE_BODY_BUFFER(
  16297.            "if SD_Runtime_Utilities.Search_This_Package(" &
  16298.            """STANDARD." & VALUE(CURRENT_SCOPE.QUALIFIED_NAME) & "."",UL) then");
  16299.          GENERATE_F_CASE_STMT(VARIABLE_LIST, PACKAGE_LIST, USE_LIST);
  16300.          WRITE_LINE_BODY_BUFFER("end if;");
  16301.       end if;
  16302.  
  16303.       if not STRING_LISTS.ISEMPTY(PACKAGE_LIST) then
  16304.          GENERATE_TRACE_LOCAL_PACKAGES(PACKAGE_LIST, USE_LIST);
  16305.       end if;
  16306.       WRITE_LINE_BODY_BUFFER("end;");
  16307.    end GENERATE_PACKAGE_FINDVAR;
  16308.  
  16309.    --------------------------------------------------------------------------
  16310.    procedure GENERATE_LOCAL_BREAK(PROGRAM_UNIT_NUMBER : NATURAL;
  16311.                                   IS_A_TASK           : BOOLEAN) is
  16312.    begin
  16313.       WRITE_SPEC_BUFFER("procedure " & SD_PREFIX & "Local_Break is new ");
  16314.  
  16315.       if IS_A_TASK then
  16316.          WRITE_LINE_SPEC_BUFFER("SD_Task_Local_Break(");
  16317.          WRITE_SPEC_BUFFER(
  16318.            "  " & PREFIX & "Current_Compilation_Unit," &
  16319.            NATURAL'IMAGE(PROGRAM_UNIT_NUMBER) & "," & PREFIX & "Task_Number,");
  16320.       else
  16321.          WRITE_LINE_SPEC_BUFFER("SD_Local_Break(");
  16322.          WRITE_SPEC_BUFFER(
  16323.            "  " & PREFIX & "Current_Compilation_Unit," &
  16324.            NATURAL'IMAGE(PROGRAM_UNIT_NUMBER) & ",");
  16325.       end if;
  16326.       WRITE_LINE_SPEC_BUFFER(VALUE(CURRENT_SCOPE.TRACING_PREFIX) & "F);");
  16327.    end GENERATE_LOCAL_BREAK;
  16328.  
  16329.    --------------------------------------------------------------------------
  16330.    procedure GENERATE_DUMMY_LOCALS(PARAM_LIST : in out NAME_LISTS.LIST) is
  16331.  
  16332.       -- Create a local variable for each OUT mode formal parameter.
  16333.       -- This is necessary because setting procedures have parameters
  16334.       -- of mode IN OUT. The dummy variable will be passed to the 
  16335.       -- setting procedure, and then its value will be assigned to the 
  16336.       -- formal parameter.
  16337.  
  16338.       ITERATOR   : NAME_LISTS.LISTITER;
  16339.       NEXT_PARAM : NAME_RECORD;
  16340.       FIRST_ONE  : BOOLEAN := TRUE;
  16341.       PARAM_TYPE : OUT_PARAM_TYPE_CLASS;
  16342.    begin
  16343.       ITERATOR := NAME_LISTS.MAKELISTITER(PARAM_LIST);
  16344.       while NAME_LISTS.MORE(ITERATOR) loop
  16345.          NAME_LISTS.NEXT(ITERATOR, NEXT_PARAM);
  16346.          if NEXT_PARAM.OBJECT_MODE = WRITE_ONLY then
  16347.             PARAM_TYPE := CHECK_TYPE_NAME(VALUE(NEXT_PARAM.OBJECT_TYPE));
  16348.             if PARAM_TYPE = USER_DEFINED then
  16349.                NAME_LISTS.DELETEITEM(PARAM_LIST, NEXT_PARAM);
  16350.                FLUSH(NEXT_PARAM.OBJECT_TYPE);
  16351.                NEXT_PARAM.OBJECT_TYPE := CREATE("");
  16352.                NAME_LISTS.ATTACH(NEXT_PARAM, PARAM_LIST);
  16353.             else
  16354.                if FIRST_ONE then
  16355.                   TEXT_IO.NEW_LINE(INSTRUMENTED_FILE);
  16356.                   FIRST_ONE := FALSE;
  16357.                end if;
  16358.                WRITE_SPEC_BUFFER(
  16359.                  SD_PREFIX & "DUMMY_" & VALUE(NEXT_PARAM.OBJECT_NAME) & " :");
  16360.                WRITE_SPEC_BUFFER(VALUE(NEXT_PARAM.OBJECT_TYPE));
  16361.                if PARAM_TYPE = PREDEFINED_STRING then
  16362.                   WRITE_SPEC_BUFFER(
  16363.                     "(" & VALUE(NEXT_PARAM.OBJECT_NAME) & "'Range)");
  16364.                end if;
  16365.                WRITE_LINE_SPEC_BUFFER(";");
  16366.             end if;
  16367.          end if;
  16368.       end loop;
  16369.    end GENERATE_DUMMY_LOCALS;
  16370.  
  16371.    --------------------------------------------------------------------------
  16372.    procedure GENERATE_TRACING_SPECS(TYPE_NAME : STRING) is
  16373.  
  16374.       -- Generate specifications for the tracing procedures that will
  16375.       -- be created for this type.  It is not a type for which there
  16376.       -- are generic tracing templates, so we will have to create the
  16377.       -- procedures.  The procedure bodies will be written to the buffer
  16378.       -- file and copied into the instrumented source file later.
  16379.  
  16380.    begin
  16381.       if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then
  16382.          TEXT_IO.NEW_LINE(INSTRUMENTED_FILE);
  16383.       end if;
  16384.  
  16385.       WRITE_LINE_SPEC_BUFFER(
  16386.         "procedure " & SD_PREFIX & "D(Name: String; Var: " & TYPE_NAME & ");" );
  16387.  
  16388.       WRITE_LINE_SPEC_BUFFER(
  16389.         "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ");" );
  16390.  
  16391.       WRITE_LINE_SPEC_BUFFER(
  16392.         "function " & SD_PREFIX & "M(Var: " & TYPE_NAME & ") return String;");
  16393.  
  16394.    end GENERATE_TRACING_SPECS;
  16395.  
  16396.    --------------------------------------------------------------------------
  16397.    procedure GENERATE_TRACING_INSTANTIATION(TYPE_NAME : STRING;
  16398.                                             TYPE_KIND : TYPE_CLASS) is
  16399.  
  16400.       -- The current type is one for which there are tracing templates,
  16401.       -- so generate instantiations for the procedures.
  16402.  
  16403.    begin
  16404.       if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then
  16405.          TEXT_IO.NEW_LINE(INSTRUMENTED_FILE);
  16406.       end if;
  16407.  
  16408.       for I in 1..3 loop
  16409.          case I is
  16410.             when 1 => 
  16411.                WRITE_SPEC_BUFFER(
  16412.                  "procedure " & SD_PREFIX & "D is new SD_Display_");
  16413.             when 2 => 
  16414.                WRITE_SPEC_BUFFER(
  16415.                  "procedure " & SD_PREFIX & "S is new SD_Set_");
  16416.             when 3 => 
  16417.                WRITE_SPEC_BUFFER(
  16418.                  "function " & SD_PREFIX & "M is new SD_Make_String_");
  16419.             when others => null;
  16420.          end case;
  16421.          case TYPE_KIND is
  16422.             when ENUMERATION_TYPE => 
  16423.                WRITE_SPEC_BUFFER("Enum_Type");
  16424.             when INTEGER_TYPE => 
  16425.                WRITE_SPEC_BUFFER("Integer_Type");
  16426.             when FLOAT_TYPE => 
  16427.                WRITE_SPEC_BUFFER("Float_Type");
  16428.             when FIXED_TYPE => 
  16429.                WRITE_SPEC_BUFFER("Fixed_Type");
  16430.             when TASK_TYPE | PRIVATE_TYPE | LIMITED_PRIVATE_TYPE => 
  16431.                WRITE_SPEC_BUFFER("NoNo");
  16432.             when others => null;
  16433.          end case;
  16434.          WRITE_LINE_SPEC_BUFFER("(" & TYPE_NAME & ");");
  16435.       end loop;
  16436.    end GENERATE_TRACING_INSTANTIATION;
  16437.  
  16438.    --------------------------------------------------------------------------
  16439.    procedure GENERATE_ANON_TYPE(ANON_TEXT : STRING_LISTS.LIST) is
  16440.       ITER      : STRING_LISTS.LISTITER;
  16441.       NEXT_TEXT : STRING_TYPE;
  16442.    begin
  16443.       ITER := STRING_LISTS.MAKELISTITER(ANON_TEXT);
  16444.       while STRING_LISTS.MORE(ITER) loop
  16445.          STRING_LISTS.NEXT(ITER, NEXT_TEXT);
  16446.          WRITE_SPEC_BUFFER(VALUE(NEXT_TEXT) & " ");
  16447.       end loop;
  16448.       WRITE_LINE_SPEC_BUFFER("");
  16449.    end GENERATE_ANON_TYPE;
  16450.  
  16451.    --------------------------------------------------------------------------
  16452.    procedure GENERATE_DERIVED_TRACE(TYPE_NAME   : STRING;
  16453.                                     PARENT_NAME : STRING) is
  16454.  
  16455.      -- Generate procedure bodies for tracing a derived type.  The
  16456.      -- set and display procedures are called with an explicit type
  16457.      -- conversion of the variable to its parent type.
  16458.  
  16459.    begin
  16460.       WRITE_LINE_BODY_BUFFER(
  16461.         "procedure " & SD_PREFIX & "D(Name: String; Var: " & 
  16462.         TYPE_NAME & ") is");
  16463.       WRITE_LINE_BODY_BUFFER("begin");
  16464.       WRITE_LINE_BODY_BUFFER(
  16465.         "  " & SD_PREFIX & "D(Name," & PARENT_NAME & "(Var));");
  16466.       WRITE_LINE_BODY_BUFFER("end;");
  16467.  
  16468.       WRITE_LINE_BODY_BUFFER(
  16469.         "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ") is");
  16470.       WRITE_LINE_BODY_BUFFER("begin");
  16471.       WRITE_LINE_BODY_BUFFER(
  16472.         "  " & SD_PREFIX & "S(" & PARENT_NAME & "(Var));" );
  16473.       WRITE_LINE_BODY_BUFFER("end;");
  16474.  
  16475.       WRITE_LINE_BODY_BUFFER(
  16476.         "function " & SD_PREFIX & "M(Var: " & TYPE_NAME & ") return String is");
  16477.       WRITE_LINE_BODY_BUFFER("begin");
  16478.       WRITE_LINE_BODY_BUFFER(
  16479.         "  return " & SD_PREFIX & "M(" & PARENT_NAME & "(Var));");
  16480.       WRITE_LINE_BODY_BUFFER("end;");
  16481.    end GENERATE_DERIVED_TRACE;
  16482.  
  16483.    --------------------------------------------------------------------------
  16484.    procedure GENERATE_ARRAY_TRACE(TYPE_NAME  : STRING; 
  16485.                                   DIMENSIONS : NATURAL) is
  16486.    begin
  16487.       if DIMENSIONS > 1 then
  16488.          GENERATE_N_DIMENSION_ARRAY_TRACE(TYPE_NAME, DIMENSIONS);
  16489.       else
  16490.          GENERATE_ONE_DIMENSION_ARRAY_TRACE(TYPE_NAME);
  16491.       end if;
  16492.  
  16493.       WRITE_LINE_BODY_BUFFER(
  16494.         "function " & SD_PREFIX & "M(Var: " & TYPE_NAME & ") return String is");
  16495.       WRITE_LINE_BODY_BUFFER("begin");
  16496.       WRITE_LINE_BODY_BUFFER("  return """";");
  16497.       WRITE_LINE_BODY_BUFFER("end;");
  16498.  
  16499.    end GENERATE_ARRAY_TRACE;
  16500.  
  16501.    --------------------------------------------------------------------------
  16502.    procedure GENERATE_RECORD_TRACE(TYPE_NAME        : STRING;
  16503.                                    LIST_OF_FIELDS   : RECORD_LISTS.LIST;
  16504.                                    LIST_OF_DISCRIMS : STRING_LISTS.LIST;
  16505.                                    CASE_DISCRIM     : STRING_TYPE) is
  16506.  
  16507.       -- Generate the bodies of the procedures to set and display record
  16508.       -- types.
  16509.  
  16510.      DISC_LIST_ITER    : STRING_LISTS.LISTITER;
  16511.      NEXT_DISC         : STRING_TYPE;
  16512.      FIELD_LIST_ITER   : RECORD_LISTS.LISTITER;
  16513.      NEXT_FIELD_RECORD : REC_FIELD_RECORD;
  16514.      NULL_RECORD       : BOOLEAN := TRUE;
  16515.      FOUND_FIELD       : BOOLEAN := FALSE;
  16516.      FOUND_CASE        : BOOLEAN;
  16517.  
  16518.    begin
  16519.       for PROC in DISPLAY_OR_SET loop
  16520.          if PROC = DISPLAY then
  16521.             WRITE_LINE_BODY_BUFFER(
  16522.               "procedure " & SD_PREFIX & "D(Name: String; Var: " & 
  16523.               TYPE_NAME & ") is");
  16524.          else
  16525.             WRITE_LINE_BODY_BUFFER(
  16526.               "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ") is");
  16527.          end if;
  16528.  
  16529.          WRITE_LINE_BODY_BUFFER(
  16530.            "  Field : String_Pkg.String_Type" &
  16531.            " := Sd_Runtime_Utilities.Find_Record_Field;");
  16532.          WRITE_LINE_BODY_BUFFER("  Found : Boolean := False;");
  16533.          WRITE_LINE_BODY_BUFFER("begin");
  16534.  
  16535.          if not STRING_LISTS.ISEMPTY(LIST_OF_DISCRIMS) then
  16536.            NULL_RECORD := FALSE;
  16537.            if PROC = DISPLAY then
  16538.               GENERATE_TRACE_RECORD_FIELD(
  16539.                 LIST_OF_DISCRIMS, DISPLAY, FALSE, FOUND_FIELD);
  16540.            else
  16541.               WRITE_LINE_BODY_BUFFER("if String_Pkg.Is_Empty(Field) then");
  16542.               WRITE_LINE_BODY_BUFFER("  SD_Runtime_Utilities.Error_Message(" &
  16543.                 """Assigning whole records with discriminants " &
  16544.                 "is unimplemented"");");
  16545.               WRITE_BODY_BUFFER("elsif ");
  16546.  
  16547.               DISC_LIST_ITER := STRING_LISTS.MAKELISTITER(LIST_OF_DISCRIMS);
  16548.               loop
  16549.                 STRING_LISTS.NEXT(DISC_LIST_ITER, NEXT_DISC);
  16550.                 WRITE_BODY_BUFFER(
  16551.                   "String_Pkg.Equal(Field,""" & VALUE(NEXT_DISC) & """) ");
  16552.                 if STRING_LISTS.MORE(DISC_LIST_ITER) then
  16553.                   WRITE_LINE_BODY_BUFFER("or else");
  16554.                 else
  16555.                   WRITE_LINE_BODY_BUFFER("then");
  16556.                   exit;
  16557.                 end if;
  16558.               end loop;
  16559.  
  16560.               WRITE_LINE_BODY_BUFFER(
  16561.                 "  SD_Runtime_Utilities.Error_Message(" &
  16562.                 """Discriminants may not be set"");");
  16563.               WRITE_LINE_BODY_BUFFER("end if;");
  16564.            end if;
  16565.          end if;
  16566.  
  16567.          FOUND_CASE := FALSE;
  16568.          FIELD_LIST_ITER := RECORD_LISTS.MAKELISTITER(LIST_OF_FIELDS);
  16569.          while RECORD_LISTS.MORE(FIELD_LIST_ITER) loop
  16570.            RECORD_LISTS.NEXT(FIELD_LIST_ITER, NEXT_FIELD_RECORD);
  16571.            if not STRING_LISTS.ISEMPTY(NEXT_FIELD_RECORD.CHOICE_TEXT) then
  16572.              if not FOUND_CASE then
  16573.                WRITE_LINE_BODY_BUFFER("case VAR." & VALUE(CASE_DISCRIM) & " is");
  16574.                FOUND_CASE := TRUE;
  16575.              end if;
  16576.              WRITE_CHOICE_TEXT(NEXT_FIELD_RECORD.CHOICE_TEXT);
  16577.            end if;
  16578.            GENERATE_TRACE_RECORD_FIELD(
  16579.              NEXT_FIELD_RECORD.REC_FIELD, PROC, FOUND_CASE, FOUND_FIELD);
  16580.            if FOUND_FIELD then
  16581.              NULL_RECORD := FALSE;
  16582.            end if;
  16583.          end loop;
  16584.  
  16585.          if FOUND_CASE then
  16586.            WRITE_LINE_BODY_BUFFER("end case;");
  16587.          end if;
  16588.  
  16589.          if not NULL_RECORD then
  16590.            WRITE_LINE_BODY_BUFFER("if not Found then");
  16591.            WRITE_LINE_BODY_BUFFER(
  16592.              "  Sd_Runtime_Utilities.Unscan_Variable(""Variable not found"");");
  16593.            WRITE_LINE_BODY_BUFFER("end if;");
  16594.          else
  16595.            WRITE_LINE_BODY_BUFFER(
  16596.              "  Sd_Runtime_Utilities.Error_Message(""Null record"");");
  16597.          end if;
  16598.  
  16599.          WRITE_LINE_BODY_BUFFER("end;");
  16600.       end loop;
  16601.  
  16602.       WRITE_LINE_BODY_BUFFER(
  16603.         "function " & SD_PREFIX & "M(Var: " & TYPE_NAME & ") return String is");
  16604.       WRITE_LINE_BODY_BUFFER("begin");
  16605.       WRITE_LINE_BODY_BUFFER("  return """";");
  16606.       WRITE_LINE_BODY_BUFFER("end;");
  16607.  
  16608.    end GENERATE_RECORD_TRACE;
  16609.  
  16610.    --------------------------------------------------------------------------
  16611.    procedure GENERATE_ACCESS_TRACE(TYPE_NAME : STRING) is
  16612.       -- Generate the bodies of the procedures to set and display access
  16613.       -- types.  
  16614.    begin
  16615.       WRITE_LINE_BODY_BUFFER(
  16616.         "procedure " & SD_PREFIX & "D(Name: String; Var: " & 
  16617.         TYPE_NAME & ") is");
  16618.       WRITE_LINE_BODY_BUFFER("begin");
  16619.       WRITE_LINE_BODY_BUFFER("  if VAR = NULL then");
  16620.       WRITE_LINE_BODY_BUFFER(
  16621.         "    SD_Runtime_Utilities.General_Message(Name & "" = NULL"");");
  16622.       WRITE_LINE_BODY_BUFFER("  else");
  16623.  
  16624.       WRITE_LINE_BODY_BUFFER("  case Sd_Runtime_Utilities.Check_Access_Var is");
  16625.       WRITE_LINE_BODY_BUFFER("    when 0 => ");
  16626.       WRITE_LINE_BODY_BUFFER("      SI2AFSD_1861_D(Name, Var.all'address);");
  16627.       WRITE_LINE_BODY_BUFFER("    when 1 => ");
  16628.       WRITE_LINE_BODY_BUFFER("      SI2AFSD_1861_D(Name &"".ALL"", Var.All);");
  16629.       WRITE_LINE_BODY_BUFFER("    when others => ");
  16630.       WRITE_LINE_BODY_BUFFER("      SI2AFSD_1861_D(Name, Var.All);");
  16631.       WRITE_LINE_BODY_BUFFER("  end case;");
  16632.       WRITE_LINE_BODY_BUFFER("  end if;");
  16633.       WRITE_LINE_BODY_BUFFER("end;");
  16634.  
  16635.       WRITE_LINE_BODY_BUFFER(
  16636.         "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ") is");
  16637.       WRITE_LINE_BODY_BUFFER("begin");
  16638.       WRITE_LINE_BODY_BUFFER(
  16639.         " if SD_Runtime_Utilities.Check_Access_Var = 0 then");
  16640.       WRITE_LINE_BODY_BUFFER("    SD_Runtime_Utilities.General_Message(" &
  16641.         """Access values cannot be set"");");
  16642.       WRITE_LINE_BODY_BUFFER("  elsif Var /= NULL then");
  16643.       WRITE_LINE_BODY_BUFFER("    SI2AFSD_1861_S(Var.All);");
  16644.       WRITE_LINE_BODY_BUFFER("  else");
  16645.       WRITE_LINE_BODY_BUFFER(
  16646.         "    SD_Runtime_Utilities.Error_Message(""Access value is null"");");
  16647.       WRITE_LINE_BODY_BUFFER("  end if;");
  16648.  
  16649.       WRITE_LINE_BODY_BUFFER("end;");
  16650.  
  16651.       WRITE_LINE_BODY_BUFFER(
  16652.         "function " & SD_PREFIX & "M(Var: " & TYPE_NAME & ") return String is");
  16653.       WRITE_LINE_BODY_BUFFER("begin");
  16654.       WRITE_LINE_BODY_BUFFER("  return """";");
  16655.       WRITE_LINE_BODY_BUFFER("end;");
  16656.  
  16657.    end GENERATE_ACCESS_TRACE;
  16658.  
  16659.  
  16660.    --------------------------------------------------------------------------
  16661.    -- Local subprogram bodies --
  16662.    --------------------------------------------------------------------------
  16663.  
  16664.    ---------------------------------------------------------------------------
  16665.    procedure GENERATE_LIST_PARAMETER(L : NAME_LISTS.LIST) is
  16666.  
  16667.       -- Generate a literal string consisiting of the object_name field of
  16668.       -- each item in the list.  Each name in the generated string is followed
  16669.       -- by one blank space.  This string becomes an actual parameter to one
  16670.       -- of the SD_Runtime_Utilities procedures.
  16671.  
  16672.       ITERATOR  : NAME_LISTS.LISTITER;
  16673.       NEXT_NAME : NAME_RECORD;
  16674.       TEMP      : STRING_TYPE;
  16675.    begin
  16676.       STRING_PKG.MARK;
  16677.       TEMP := CREATE("""");
  16678.       ITERATOR := NAME_LISTS.MAKELISTITER(L);
  16679.       while NAME_LISTS.MORE(ITERATOR) loop
  16680.          NAME_LISTS.NEXT(ITERATOR, NEXT_NAME);
  16681.          TEMP := TEMP & NEXT_NAME.OBJECT_NAME & " ";
  16682.       end loop;
  16683.       TEMP := TEMP & """";
  16684.       WRITE_BODY_BUFFER(VALUE(TEMP));
  16685.       STRING_PKG.RELEASE;
  16686.    end GENERATE_LIST_PARAMETER;
  16687.  
  16688.    --------------------------------------------------------------------------
  16689.    procedure GENERATE_LIST_PARAMETER(L : STRING_LISTS.LIST) is
  16690.  
  16691.       -- Generate a literal string consisiting of the name in each item
  16692.       -- in the list.  Each name in the generated string is followed by
  16693.       -- one blank space.  This string becomes an actual parameter to one
  16694.       -- of the SD_Runtime_Utilities procedures.
  16695.  
  16696.       ITERATOR  : STRING_LISTS.LISTITER;
  16697.       NEXT_NAME : STRING_TYPE;
  16698.       TEMP      : STRING_TYPE;
  16699.    begin
  16700.       STRING_PKG.MARK;
  16701.       TEMP := CREATE("""");
  16702.       ITERATOR := STRING_LISTS.MAKELISTITER(L);
  16703.       while STRING_LISTS.MORE(ITERATOR) loop
  16704.          STRING_LISTS.NEXT(ITERATOR, NEXT_NAME);
  16705.          TEMP := TEMP & VALUE(NEXT_NAME) & " ";
  16706.       end loop;
  16707.       TEMP := TEMP & """";
  16708.       WRITE_BODY_BUFFER(VALUE(TEMP));
  16709.       STRING_PKG.RELEASE;
  16710.    end GENERATE_LIST_PARAMETER;
  16711.  
  16712.    --------------------------------------------------------------------------
  16713.    function CHECK_TYPE_NAME(TYPE_NAME : STRING) return OUT_PARAM_TYPE_CLASS is
  16714.       DOT    : NATURAL := POSITION_OF_REVERSE('.', TYPE_NAME);
  16715.       S      : STRING(1 .. TYPE_NAME'LAST - DOT) :=  
  16716.                  TYPE_NAME(DOT + 1 .. TYPE_NAME'LAST);
  16717.       RESULT : OUT_PARAM_TYPE_CLASS := USER_DEFINED;
  16718.    begin
  16719.       if S = "STRING" then
  16720.          RESULT := PREDEFINED_STRING;
  16721.       elsif S = "INTEGER" or else
  16722.             S = "NATURAL" or else
  16723.             S = "POSITIVE" or else
  16724.             S = "BOOLEAN" or else
  16725.             S = "CHARACTER" or else
  16726.             S = "FLOAT" or else
  16727.             S = "LONG_INTEGER" or else
  16728.             S = "SHORT_INTEGER" or else
  16729.             S = "LONG_FLOAT" or else
  16730.             S = "SHORT_FLOAT" then
  16731.          RESULT := PREDEFINED_SCALAR;
  16732.       end if;  
  16733.       return RESULT;
  16734.    end CHECK_TYPE_NAME;
  16735.    -----------------------------------------------------------------------
  16736.    procedure GENERATE_F_CASE_STMT(VARIABLE_LIST : NAME_LISTS.LIST;
  16737.                                   PACKAGE_LIST  : STRING_LISTS.LIST;
  16738.                                   USE_LIST      : STRING_LISTS.LIST) is
  16739.  
  16740.       -- Generate the case statement in procedure "F" that calls the 
  16741.       -- set and display procedures for the variables declared in the
  16742.       -- current scope.
  16743.       
  16744.       ITERATOR : NAME_LISTS.LISTITER;
  16745.       NEXT_VAR : NAME_RECORD;
  16746.       COUNTER  : POSITIVE := 1;
  16747.  
  16748.    begin
  16749.       WRITE_BODY_BUFFER("case SD_Runtime_Utilities.Search_For_Variable(");
  16750.       GENERATE_LIST_PARAMETER(VARIABLE_LIST);
  16751.       WRITE_LINE_BODY_BUFFER(") is");
  16752.       ITERATOR := NAME_LISTS.MAKELISTITER(VARIABLE_LIST);
  16753.       while NAME_LISTS.MORE(ITERATOR) loop
  16754.          NAME_LISTS.NEXT(ITERATOR, NEXT_VAR);
  16755.          GENERATE_F_CASE_BRANCH(NEXT_VAR, COUNTER, CURRENT_SCOPE.IN_ACCEPT);
  16756.          COUNTER := COUNTER + 1;
  16757.       end loop;
  16758.       GENERATE_NOT_FOUND_BRANCH(PACKAGE_LIST, USE_LIST);
  16759.       WRITE_LINE_BODY_BUFFER( "end case;");
  16760.    end GENERATE_F_CASE_STMT;
  16761.  
  16762.    -----------------------------------------------------------------------
  16763.    procedure GENERATE_F_CASE_BRANCH(CURRENT_VAR : NAME_RECORD;
  16764.                                     VAR_NUMBER  : POSITIVE;
  16765.                                     IN_ACCEPT   : BOOLEAN ) is
  16766.  
  16767.       -- Generate a branch in the case statement of procedure "F" to
  16768.       -- set or display this variable, or to issue an error message if
  16769.       -- setting and/or displaying is not allowed for this variable.
  16770.       -- Then raise the exception to cause searching to stop.
  16771.  
  16772.       VAR_NAME     : STRING_TYPE;
  16773.  
  16774.       LEN          : INTEGER := LENGTH(CURRENT_SCOPE.QUALIFIED_NAME_STRING) +
  16775.                                 LENGTH(CURRENT_VAR.OBJECT_NAME) + 1;
  16776.       DISPLAY_NAME : STRING(1..LEN) :=
  16777.          VALUE(CURRENT_SCOPE.QUALIFIED_NAME_STRING) & "." &
  16778.          VALUE(CURRENT_VAR.OBJECT_NAME);
  16779.  
  16780.       ANON_TYPE    : BOOLEAN :=
  16781.         POSITION_OF("." & SD_PREFIX & "ANON", 
  16782.                     VALUE(CURRENT_VAR.OBJECT_TYPE)) /= 0;
  16783.    begin
  16784.       STRING_PKG.MARK;
  16785.  
  16786.       if IN_ACCEPT then
  16787.          VAR_NAME := CURRENT_SCOPE.SCOPE_NAME & "." & CURRENT_VAR.OBJECT_NAME;
  16788.       else
  16789.          VAR_NAME := "STANDARD." & CURRENT_SCOPE.QUALIFIED_NAME & "." &
  16790.                       CURRENT_VAR.OBJECT_NAME;
  16791.       end if;
  16792.  
  16793.       WRITE_LINE_BODY_BUFFER("when" & INTEGER'IMAGE(VAR_NUMBER) & " =>"); 
  16794.       
  16795.       case CURRENT_VAR.OBJECT_MODE is
  16796.  
  16797.          when READ_WRITE =>
  16798.             WRITE_LINE_BODY_BUFFER(
  16799.               "  if SD_Runtime_Utilities.Command = " &
  16800.               "SD_Runtime_Declarations.Set_Var then");
  16801.             WRITE_BODY_BUFFER("    " & SD_PREFIX & "S(");
  16802.             if ANON_TYPE then
  16803.                WRITE_LINE_BODY_BUFFER(
  16804.                  VALUE(CURRENT_VAR.OBJECT_TYPE) & 
  16805.                  "(" & VALUE(VAR_NAME) & "));");
  16806.             else
  16807.                WRITE_LINE_BODY_BUFFER(VALUE(VAR_NAME) & ");" );
  16808.             end if;
  16809.             WRITE_LINE_BODY_BUFFER("  else");
  16810.             WRITE_BODY_BUFFER("    " & SD_PREFIX & "D(""" & DISPLAY_NAME
  16811.                & """,");
  16812.             if ANON_TYPE then
  16813.                WRITE_LINE_BODY_BUFFER(
  16814.                  VALUE(CURRENT_VAR.OBJECT_TYPE) & 
  16815.                  "(" & VALUE(VAR_NAME) & "));");
  16816.             else
  16817.                WRITE_LINE_BODY_BUFFER(VALUE(VAR_NAME) & ");");
  16818.             end if;
  16819.  
  16820.             WRITE_LINE_BODY_BUFFER("  end if;");           
  16821.  
  16822.          when READ_ONLY | CONST =>
  16823.             WRITE_LINE_BODY_BUFFER(
  16824.               "  if SD_Runtime_Utilities.Command = " &
  16825.               "SD_Runtime_Declarations.Set_Var then");
  16826.             WRITE_LINE_BODY_BUFFER(
  16827.               "    SD_Runtime_Utilities.General_Message(" &
  16828.               """Constants or IN parameters cannot be set"");");
  16829.             WRITE_LINE_BODY_BUFFER("  else");
  16830.             WRITE_BODY_BUFFER("    " & SD_PREFIX & "D(""" & DISPLAY_NAME
  16831.                & """, ");
  16832.             if ANON_TYPE then
  16833.                WRITE_LINE_BODY_BUFFER(
  16834.                  VALUE(CURRENT_VAR.OBJECT_TYPE) & 
  16835.                  "(" & VALUE(VAR_NAME) & "));");
  16836.             elsif CURRENT_VAR.OBJECT_MODE = CONST then
  16837.                WRITE_LINE_BODY_BUFFER("Float(" & VALUE(VAR_NAME) & "));");
  16838.             else
  16839.                WRITE_LINE_BODY_BUFFER(VALUE(VAR_NAME) & ");");
  16840.             end if;
  16841.             WRITE_LINE_BODY_BUFFER("  end if;");           
  16842.  
  16843.          when WRITE_ONLY =>
  16844.             WRITE_LINE_BODY_BUFFER(
  16845.                "  if SD_Runtime_Utilities.Command /= " &
  16846.                "SD_Runtime_Declarations.Set_Var then");
  16847.             WRITE_LINE_BODY_BUFFER(
  16848.               "    SD_Runtime_Utilities.General_Message(" &
  16849.               """OUT parameters can not be displayed"");");
  16850.             WRITE_LINE_BODY_BUFFER("  else");
  16851.             if IS_EMPTY(CURRENT_VAR.OBJECT_TYPE) then
  16852.                WRITE_LINE_BODY_BUFFER(
  16853.                  "    SD_Runtime_Utilities.General_Message(" &
  16854.                  """Setting OUT parameters of user defined " &
  16855.                  "types is unimplemented"");");
  16856.             else
  16857.                WRITE_LINE_BODY_BUFFER(
  16858.                  "    " & SD_PREFIX & "S(" & SD_PREFIX & "DUMMY_" & 
  16859.                  VALUE(CURRENT_VAR.OBJECT_NAME) & ");");
  16860.                WRITE_LINE_BODY_BUFFER(
  16861.                  "    " & VALUE(VAR_NAME) & " := " &
  16862.                  SD_PREFIX & "DUMMY_" & VALUE(CURRENT_VAR.OBJECT_NAME) & ";");
  16863.             end if;
  16864.             WRITE_LINE_BODY_BUFFER("  end if;");          
  16865.  
  16866.          when others =>
  16867.             WRITE_LINE_BODY_BUFFER(
  16868.               "  SD_Runtime_Utilities.Error_Message(" &
  16869.               """Variable cannot be set or displayed"");");
  16870.       end case;
  16871.       WRITE_LINE_BODY_BUFFER("  raise SD_Runtime_Utilities.Stop_Searching;");
  16872.       STRING_PKG.RELEASE;
  16873.    end GENERATE_F_CASE_BRANCH;
  16874.  
  16875.    -----------------------------------------------------------------------
  16876.    procedure GENERATE_NOT_FOUND_BRANCH(PACKAGE_LIST : STRING_LISTS.LIST;
  16877.                                        USE_LIST     : STRING_LISTS.LIST) is
  16878.  
  16879.       -- Generate the "when others =>" branch of the case statement for
  16880.       -- procedure "F".  If the current unit is a package body, search
  16881.       -- its private declarations, and then its public declarations. If
  16882.       -- there were any local packages declared, then search them.
  16883.       -- Otherwise, generate a null.
  16884.  
  16885.       WROTE_SOMETHING : BOOLEAN := FALSE;
  16886.    
  16887.    begin
  16888.       WRITE_LINE_BODY_BUFFER("when others =>");
  16889.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then
  16890.          if SD_BUFFER_FILES.PACKAGE_FILES_EXIST
  16891.             (VALUE(CURRENT_SCOPE.QUALIFIED_NAME), PRIVATE_FILES) 
  16892.          then
  16893.             WRITE_LINE_BODY_BUFFER(
  16894.               VALUE(CURRENT_SCOPE.TRACING_PREFIX) & "PRIV_F;");
  16895.             WROTE_SOMETHING := TRUE;
  16896.          end if;
  16897.          if SD_BUFFER_FILES.PACKAGE_FILES_EXIST
  16898.             (VALUE(CURRENT_SCOPE.QUALIFIED_NAME), PUBLIC_FILES) 
  16899.          then
  16900.             WRITE_BODY_BUFFER(VALUE(CURRENT_SCOPE.TRACING_PREFIX) & "SPEC_F(");
  16901.             GENERATE_LIST_PARAMETER(USE_LIST);
  16902.             WRITE_LINE_BODY_BUFFER(");");
  16903.             WROTE_SOMETHING := TRUE;
  16904.          end if;
  16905.       end if;
  16906.  
  16907.       if not STRING_LISTS.ISEMPTY(PACKAGE_LIST) and
  16908.          CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then
  16909.          -- if the current unit is a package specification, local
  16910.          -- packages will be traced after the case statement instead
  16911.          -- of in the "when others" branch.
  16912.          GENERATE_TRACE_LOCAL_PACKAGES(PACKAGE_LIST, USE_LIST);
  16913.          WROTE_SOMETHING := TRUE;
  16914.       end if;
  16915.  
  16916.       if not WROTE_SOMETHING then
  16917.          WRITE_LINE_BODY_BUFFER("  null;");
  16918.       end if;      
  16919.  
  16920.    end GENERATE_NOT_FOUND_BRANCH;
  16921.  
  16922.    -----------------------------------------------------------------------
  16923.    procedure GENERATE_TRACE_LOCAL_PACKAGES(PACKAGE_LIST : STRING_LISTS.LIST;
  16924.                                            USE_LIST     : STRING_LISTS.LIST) is
  16925.  
  16926.       -- Loop through the list of local packages and generate a call to
  16927.       -- search their specs for the variable.  Local packages are traced
  16928.       -- when the variable was not found among the current unit's local 
  16929.       -- variables. 
  16930.  
  16931.       ITERATOR  : STRING_LISTS.LISTITER;
  16932.       NEXT_NAME : STRING_TYPE;
  16933.    begin
  16934.       ITERATOR := STRING_LISTS.MAKELISTITER(PACKAGE_LIST);
  16935.       while STRING_LISTS.MORE(ITERATOR) loop
  16936.          STRING_LISTS.NEXT(ITERATOR, NEXT_NAME);
  16937.          WRITE_BODY_BUFFER(
  16938.            VALUE(MAKE_TRACING_PREFIX(CURRENT_SCOPE,NEXT_NAME,
  16939.            CURRENT_SCOPE.TYPE_OF_SCOPE)) & "SPEC_F(");
  16940.          GENERATE_LIST_PARAMETER(USE_LIST);
  16941.          WRITE_LINE_BODY_BUFFER(");");
  16942.       end loop;
  16943.    end GENERATE_TRACE_LOCAL_PACKAGES;
  16944.  
  16945.    -----------------------------------------------------------------------
  16946.    procedure GENERATE_TRACE_WITHED_UNITS(WITH_LIST : STRING_LISTS.LIST;
  16947.                                          USE_LIST  : STRING_LISTS.LIST) is
  16948.  
  16949.       -- Generate procedure calls to search for variables in packages
  16950.       -- that are in the with list.  Note that a unit won't be in the
  16951.       -- with list if it wasn't instrumented.  
  16952.  
  16953.       ITERATOR  : STRING_LISTS.LISTITER;
  16954.       NEXT_NAME : STRING_TYPE;
  16955.  
  16956.    begin
  16957.       ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST);
  16958.       while STRING_LISTS.MORE(ITERATOR) loop
  16959.          STRING_LISTS.NEXT(ITERATOR, NEXT_NAME);
  16960.          WRITE_BODY_BUFFER(
  16961.            SD_PREFIX & VALUE(NEXT_NAME) & "." &
  16962.            VALUE(NEXT_NAME) & "_"  & SD_PREFIX & "SPEC_F(");
  16963.          GENERATE_LIST_PARAMETER(USE_LIST);
  16964.          WRITE_LINE_BODY_BUFFER(");");
  16965.       end loop;
  16966.    end GENERATE_TRACE_WITHED_UNITS;
  16967.  
  16968.    -----------------------------------------------------------------------
  16969.    procedure GENERATE_ONE_DIMENSION_ARRAY_TRACE(TYPE_NAME : STRING) is
  16970.  
  16971.       -- Generate Display and Set procedures for a one dimensional
  16972.       -- array when the index type is not known.
  16973.  
  16974.    begin
  16975.       for PROC in DISPLAY_OR_SET loop
  16976.          if PROC = DISPLAY then
  16977.             WRITE_LINE_BODY_BUFFER(
  16978.               "procedure " & SD_PREFIX & "D(Name: String; Var: " & 
  16979.               TYPE_NAME & ") is");
  16980.          else
  16981.             WRITE_LINE_BODY_BUFFER(
  16982.               "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ") is");
  16983.          end if;
  16984.          WRITE_LINE_BODY_BUFFER("  X: SD_Runtime_Utilities.Array_Info;");
  16985.          WRITE_LINE_BODY_BUFFER("  Y: Boolean;");
  16986.          WRITE_LINE_BODY_BUFFER("begin");
  16987.          WRITE_LINE_BODY_BUFFER("for i in Var'Range loop");
  16988.          WRITE_LINE_BODY_BUFFER(
  16989.            "  SD_Runtime_Utilities.Check_This_Element(" &
  16990.            SD_PREFIX & "M(i),X,Y);");
  16991.          WRITE_LINE_BODY_BUFFER("  if Y then");
  16992.          if PROC = DISPLAY then
  16993.             WRITE_LINE_BODY_BUFFER(
  16994.               "    " & SD_PREFIX & "D(Name & ""("" & " & 
  16995.               SD_PREFIX & "M(i) & "")"", Var(i));");
  16996.          else
  16997.             WRITE_LINE_BODY_BUFFER("    " & SD_PREFIX & "S(Var(i));");
  16998.          end if;
  16999.          WRITE_LINE_BODY_BUFFER("  end if;");
  17000.          WRITE_LINE_BODY_BUFFER("  exit when X.Stop_Tracing_Array;");
  17001.          WRITE_LINE_BODY_BUFFER("end loop;");
  17002.          WRITE_LINE_BODY_BUFFER("SD_Runtime_Utilities.Check_Array(X);");
  17003.          WRITE_LINE_BODY_BUFFER("end;");
  17004.       end loop;
  17005.    end GENERATE_ONE_DIMENSION_ARRAY_TRACE;
  17006.  
  17007.    -----------------------------------------------------------------------
  17008.    procedure GENERATE_N_DIMENSION_ARRAY_TRACE(TYPE_NAME  : STRING;
  17009.                                               DIMENSIONS : INTEGER) is
  17010.    begin
  17011.       for PROC in DISPLAY_OR_SET loop
  17012.          if PROC = DISPLAY then
  17013.             WRITE_LINE_BODY_BUFFER(
  17014.               "procedure " & SD_PREFIX & "D(Name: String; Var: " & 
  17015.               TYPE_NAME & ") is");
  17016.          else
  17017.             WRITE_LINE_BODY_BUFFER(
  17018.               "procedure " & SD_PREFIX & "S(Var: in out " & TYPE_NAME & ") is");
  17019.          end if;
  17020.          WRITE_LINE_BODY_BUFFER("  X: SD_Runtime_Utilities.Array_Info;");
  17021.          WRITE_LINE_BODY_BUFFER("  Y: Boolean;");
  17022.          WRITE_LINE_BODY_BUFFER("begin");
  17023.          for I in 1 .. DIMENSIONS loop
  17024.             WRITE_LINE_BODY_BUFFER("SD_Runtime_Utilities.Get_N_Dim_Index(X);");
  17025.             if I = 1 then
  17026.                WRITE_LINE_BODY_BUFFER("Outer:");
  17027.             end if;       
  17028.             WRITE_LINE_BODY_BUFFER(
  17029.               "for i" & INTEGER_STRING(I) & 
  17030.               " in Var'Range(" & INTEGER_STRING(I) & ") loop");
  17031.             WRITE_LINE_BODY_BUFFER(
  17032.               "SD_Runtime_Utilities.Check_N_Dim_Element(" &
  17033.               SD_PREFIX & "M(i" & INTEGER_STRING(I) & "),X,Y);");
  17034.             WRITE_LINE_BODY_BUFFER("if Y then");
  17035.          end loop;      
  17036.  
  17037.          WRITE_LINE_BODY_BUFFER("if not X.FOUND_RIGHT_PAREN then");
  17038.          WRITE_LINE_BODY_BUFFER("  SD_Runtime_Utilities.Error_Message(" &
  17039.                                 """Invalid array index"");");
  17040.          WRITE_LINE_BODY_BUFFER("end if;");
  17041.  
  17042.          if PROC = DISPLAY then
  17043.             WRITE_BODY_BUFFER(SD_PREFIX & "D(Name & ""("" & ");
  17044.             for I in 1 .. DIMENSIONS loop
  17045.                WRITE_BODY_BUFFER(SD_PREFIX & "M(i" & INTEGER_STRING(I) & ")");
  17046.                if I = DIMENSIONS then
  17047.                   WRITE_BODY_BUFFER(" & "")"",");
  17048.                else
  17049.                   WRITE_BODY_BUFFER(" & "","" & ");
  17050.                end if;
  17051.             end loop;
  17052.             WRITE_BODY_BUFFER("Var(");
  17053.          else
  17054.             WRITE_BODY_BUFFER(SD_PREFIX & "S(Var(");
  17055.          end if;
  17056.  
  17057.          for I in 1 .. DIMENSIONS loop
  17058.             WRITE_BODY_BUFFER("i" & INTEGER_STRING(I));
  17059.             if I < DIMENSIONS then
  17060.                WRITE_BODY_BUFFER(",");
  17061.             end if;
  17062.          end loop;
  17063.          WRITE_LINE_BODY_BUFFER("));");
  17064.          WRITE_LINE_BODY_BUFFER("exit Outer when not X.Trace_Whole_Array;");
  17065.          for I in 1 .. DIMENSIONS loop
  17066.             WRITE_LINE_BODY_BUFFER("end if;");
  17067.             WRITE_BODY_BUFFER("end loop");
  17068.             if I = DIMENSIONS then
  17069.                WRITE_BODY_BUFFER(" Outer");
  17070.             end if;
  17071.             WRITE_LINE_BODY_BUFFER(";");
  17072.             if I < DIMENSIONS then
  17073.                WRITE_LINE_BODY_BUFFER(
  17074.                  "exit Outer when not X.Trace_Whole_Array;");
  17075.             end if;
  17076.          end loop;
  17077.          WRITE_LINE_BODY_BUFFER("if not X.Found_An_Element then");
  17078.          WRITE_LINE_BODY_BUFFER(
  17079.            "  SD_Runtime_Utilities.Unscan_Variable(" &
  17080.            """Invalid index expression"");");
  17081.          WRITE_LINE_BODY_BUFFER("end if;");
  17082.          WRITE_LINE_BODY_BUFFER("end;");
  17083.       end loop;
  17084.    end GENERATE_N_DIMENSION_ARRAY_TRACE;
  17085.  
  17086.    --------------------------------------------------------------------------
  17087.    procedure WRITE_CHOICE_TEXT(TEXT : STRING_LISTS.LIST) is
  17088.       ITER       : STRING_LISTS.LISTITER;
  17089.       NEXT_TOKEN : STRING_TYPE;
  17090.       TEMP       : STRING_TYPE;
  17091.    begin
  17092.       STRING_PKG.MARK;
  17093.       TEMP := CREATE("    ");
  17094.       ITER := STRING_LISTS.MAKELISTITER(TEXT);
  17095.       while STRING_LISTS.MORE(ITER) loop
  17096.          STRING_LISTS.NEXT(ITER, NEXT_TOKEN);
  17097.          TEMP := TEMP & NEXT_TOKEN & " ";
  17098.       end loop;
  17099.       WRITE_LINE_BODY_BUFFER(VALUE(TEMP));
  17100.       STRING_PKG.RELEASE;
  17101.    end WRITE_CHOICE_TEXT;
  17102.  
  17103.    -----------------------------------------------------------------------
  17104.    procedure GENERATE_TRACE_RECORD_FIELD(FIELDS      : STRING_LISTS.LIST;
  17105.                                          PROC        : DISPLAY_OR_SET;
  17106.                                          FOUND_CASE  : BOOLEAN;
  17107.                                          FOUND_FIELD : out BOOLEAN) is
  17108.  
  17109.       ITER       : STRING_LISTS.LISTITER;
  17110.       NEXT_FIELD : STRING_TYPE;
  17111.    begin
  17112.       FOUND_FIELD := FALSE;
  17113.       ITER := STRING_LISTS.MAKELISTITER(FIELDS);
  17114.       while STRING_LISTS.MORE(ITER) loop
  17115.          STRING_LISTS.NEXT(ITER, NEXT_FIELD);
  17116.          if EQUAL(NEXT_FIELD, "NULL") then
  17117.             if FOUND_CASE then
  17118.                WRITE_LINE_BODY_BUFFER("null;");
  17119.             end if;
  17120.          else
  17121.             FOUND_FIELD := TRUE;
  17122.             WRITE_LINE_BODY_BUFFER(
  17123.               "if String_Pkg.Is_Empty(Field) or else String_Pkg.Equal(Field," &
  17124.               """" & VALUE(NEXT_FIELD) & """) then");
  17125.             if PROC = DISPLAY then
  17126.                WRITE_LINE_BODY_BUFFER(
  17127.                  "  " & SD_PREFIX & "D(Name & ""." & VALUE(NEXT_FIELD) & 
  17128.                  """,Var." & VALUE(NEXT_FIELD) & ");");
  17129.             else
  17130.                WRITE_LINE_BODY_BUFFER(
  17131.                  "  " & SD_PREFIX & "S(Var." & VALUE(NEXT_FIELD) & ");");
  17132.             end if;
  17133.             WRITE_LINE_BODY_BUFFER("  Found := True;");
  17134.             WRITE_LINE_BODY_BUFFER("end if;");
  17135.          end if;
  17136.       end loop;
  17137.    end GENERATE_TRACE_RECORD_FIELD;
  17138.  
  17139.    -----------------------------------------------------------------------
  17140.  
  17141. end SD_GENERATION_UTILITIES;
  17142. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17143. --SIUTILS.SPC
  17144. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17145. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  17146. with PARSERDECLARATIONS; 
  17147. with LISTS; 
  17148. package SOURCE_INSTRUMENTER_UTILITIES is 
  17149. --| Utilities for Source Instrumenter
  17150.  
  17151.  
  17152. --| Overview
  17153.  
  17154. --| This package contains all the utility subprograms for the source
  17155. --| instrumenter called from Parser.Parse and Parser.Apply_Actions.  Each
  17156. --| utility is described in detail below in its specification.
  17157.  
  17158.   package PD renames PARSERDECLARATIONS; 
  17159.  
  17160.   COMMENT_BUFFER : COMMENT_LISTS.LIST; 
  17161.   --| List of comments in between two tokens
  17162.  
  17163.   type POP_TO_WHERE is (TO_OUTPUT, TO_NOWHERE); 
  17164.   --| Used in popping closing identifiers/designators
  17165.  
  17166.   type IDENTIFIER_LIST_TYPE is (OBJECT_LIST, RECORD_FIELD_LIST, 
  17167.     DISCRIMINANT_LIST, PARAMETER_LIST, RENAMING_LIST, EXCEPTION_LIST, 
  17168.     GENERIC_OBJECT_LIST); 
  17169.  
  17170.   -----------------------------------------------------------------
  17171.   --| Procedures for output formatting
  17172.   -----------------------------------------------------------------
  17173.  
  17174.   -----------------------------------------------------------------
  17175.  
  17176.   procedure INITIALIZE;  --| Initializes the utilities
  17177.  
  17178.   -----------------------------------------------------------------
  17179.  
  17180.   procedure PUT( --| Puts the token in the buffer or in the output file
  17181.                 NEXT_TOKEN : in out PD.PARSESTACKELEMENT); 
  17182.   --| Token that was just pushed on parse stack
  17183.  
  17184.   --| Effects
  17185.  
  17186.   --| Put examines the Buffering flag in to see whether buffering is turned on.
  17187.   --| If buffering is turned on, the token is placed in the buffer; if not,
  17188.   --| Print_Token is called to print the token.
  17189.  
  17190.   -----------------------------------------------------------------
  17191.  
  17192.   procedure PUT_SPACE(SPACES : in NATURAL := 1); 
  17193.   --| Puts a space in the output file.
  17194.  
  17195.   --| Effects
  17196.  
  17197.   --| The specified number of spaces is put into the output file.  The
  17198.   --| current column information is also updated.
  17199.  
  17200.   -----------------------------------------------------------------
  17201.  
  17202.   procedure PRINT_COMMENTS(BUFFER : in out COMMENT_LISTS.LIST); 
  17203.   --| Outputs buffered comments
  17204.  
  17205.   --| Effects
  17206.  
  17207.   --| If comment formatting is off, comments are output at the same
  17208.   --| line and column position as they appeared in the source.  If this
  17209.   --| is not possible, the comment is positioned at the next line and the
  17210.   --| source column.  If comment formatting is on, comments in the 
  17211.   --| declarative parts are printed alongside declarations; comments in
  17212.   --| the body are preceded by a blank line and indented to the level of
  17213.   --| the source if possible.  If a comment cannot be indented to the level
  17214.   --| of the source, it is handled the same way as comments with comment
  17215.   --| formatting off.
  17216.  
  17217.   -----------------------------------------------------------------
  17218.  
  17219.   procedure NEW_LINE;  --| Requests a new line in the buffer or output
  17220.  
  17221.   --| Effects
  17222.  
  17223.   --| New_Line examines the Buffering flag in Pretty_Printer_Declarations
  17224.   --| to see whether buffering is turned on, and requests a new line
  17225.   --| in the buffer or the output.
  17226.  
  17227.   -----------------------------------------------------------------
  17228.  
  17229.   procedure INCREASE_INDENT;  --| Increases indent 
  17230.  
  17231.   --| Effects
  17232.  
  17233.   --| Requests an increase of the indent by PPD.Indentation_Level.
  17234.  
  17235.   --| Requires
  17236.  
  17237.   --| It is expected that New_Line will be called with each call to
  17238.   --| Increase_Indent, in order to keep the Current_Column information
  17239.   --| up to date.
  17240.  
  17241.   -----------------------------------------------------------------
  17242.  
  17243.   procedure DECREASE_INDENT;  --| Decreases indent 
  17244.  
  17245.   --| Effects
  17246.  
  17247.   --| Requests a decrease of the indent by PPD.Indentation_Level.
  17248.  
  17249.   --| Requires
  17250.  
  17251.   --| It is expected that New_Line will have been called before each call to
  17252.   --| Increase_Indent, in order to keep the Current_Column information
  17253.   --| up to date.
  17254.  
  17255.   -----------------------------------------------------------------
  17256.  
  17257.   procedure CHANGE_INDENT;  --| Changes the indent
  17258.  
  17259.   --| Effects
  17260.  
  17261.   --| Requests a change in  the indent by an amount other than 
  17262.   --| Indentation_Level.  Indent is changed to the current column.
  17263.   --| This procedure is used to line up parameter lists or discriminant 
  17264.   --| specification lists.
  17265.  
  17266.   --| Requires
  17267.  
  17268.   --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
  17269.   --| are expected to be called without any intervening Increase_Indent
  17270.   --| or Decrease_Indent calls.
  17271.  
  17272.   -----------------------------------------------------------------
  17273.  
  17274.   procedure RESUME_NORMAL_INDENTATION;  --| Changes the indent back
  17275.  
  17276.   --| Effects
  17277.  
  17278.   --| Changes the indent back to what it was before Change_Indent was
  17279.   --| called.
  17280.  
  17281.   --| Requires
  17282.  
  17283.   --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
  17284.   --| are expected to be called without any intervening Increase_Indent
  17285.   --| or Decrease_Indent calls.
  17286.  
  17287.   -----------------------------------------------------------------
  17288.  
  17289.   procedure POP_IDENTIFIER(WHERE : in POP_TO_WHERE := TO_NOWHERE); 
  17290.  
  17291.   --| Effects
  17292.  
  17293.   --| Pops an identifier off the stack of identifiers/designators.  Stack is
  17294.   --| used for keeping track of beginning and closing identifiers/designators
  17295.   --| so that default closing identifiers/designators can be output.
  17296.  
  17297.   -----------------------------------------------------------------
  17298.  
  17299.   procedure PUSH_IDENTIFIER; 
  17300.  
  17301.   --| Effects
  17302.  
  17303.   --| Pushes an identifier/designator on the identifier stack, which is used
  17304.   --| for keeping track of beginning and closing identifiers/designators, so
  17305.   --| that default closing identifiers can be filled in.
  17306.  
  17307.   -----------------------------------------------------------------
  17308.  
  17309.   procedure PUSH_EMPTY_TOKEN; 
  17310.  
  17311.   --| Effects
  17312.  
  17313.   --| Pushes the empty token on the stack of beginning/closing
  17314.   --| identifiers/designators.  This procedure exists to handle loop and
  17315.   --| block identifiers which are optional at both the beginning and end
  17316.   --| of the block.  If the identifier is left off, the empty
  17317.   --| empty token is pushed as the loop or block identifer in order
  17318.   --| to synchronize the stack when it is automatically popped at
  17319.   --| the end of a loop or block.
  17320.  
  17321.   -----------------------------------------------------------------
  17322.  
  17323.  
  17324.   -----------------------------------------------------------------
  17325.   --| Procedures for source instrumenting
  17326.   -----------------------------------------------------------------
  17327.  
  17328.  
  17329.   procedure USE_PACKAGE_NAME; 
  17330.  
  17331.   --| Effects
  17332.  
  17333.   --| The current expanded name is the package name in the
  17334.   --| use clause.  Turn off the Saving_Expanded_Name flag.
  17335.  
  17336.   -----------------------------------------------------------------
  17337.  
  17338.   procedure WITH_LIBRARY_UNIT; 
  17339.  
  17340.   --| Effects
  17341.  
  17342.   --| The current saved token is the name of a library unit
  17343.   --| in a with clause.  Add its name to the with_list.
  17344.  
  17345.   -----------------------------------------------------------------
  17346.  
  17347.   procedure START_SAVING_EXPANDED_NAME; 
  17348.  
  17349.   --| Effects
  17350.  
  17351.   --| Turn on the Saving_Expanded_Name flag to start saving
  17352.   --| tokens for an expanded name.
  17353.  
  17354.   -----------------------------------------------------------------
  17355.  
  17356.   procedure SAVE_SEPARATE_NAME; 
  17357.  
  17358.   --| Effects
  17359.  
  17360.   --| The current expanded name is the name of the parent unit.
  17361.   --| Turn off the Saving_Expanded_Name flag.
  17362.  
  17363.   -----------------------------------------------------------------
  17364.  
  17365.   procedure SAVE_GENERIC_NAME; 
  17366.  
  17367.   --| Effects
  17368.  
  17369.   --| The current expanded name is the generic unit name.
  17370.   --| Turn off the Saving_Expanded_Name flag.
  17371.  
  17372.   ------------------------------------------------------------------
  17373.  
  17374.   procedure SUBPROGRAM_TYPE(INTYPE : in STRING); 
  17375.  
  17376.   --| Effects
  17377.  
  17378.   --| This is called by Apply_Actions when it is known whether
  17379.   --| the current subprogram is a procedure or function.
  17380.  
  17381.   ------------------------------------------------------------------
  17382.  
  17383.   procedure START_BEGIN_END_BLOCK; 
  17384.  
  17385.   -- Called at the begining of each begin end block. If were not in
  17386.   -- a block or a package body then add an entering unit call
  17387.  
  17388.   ------------------------------------------------------------------
  17389.  
  17390.   procedure END_BLOCK_SEQUENCE_OF_STATEMENTS; 
  17391.  
  17392.   --  Called at the end of a begin-end block.  If we are not in a
  17393.   --  block or a package body then create an exiting unit.
  17394.  
  17395.   ------------------------------------------------------------------
  17396.  
  17397.   procedure START_DO_SEQUENCE_OF_STATEMENTS;
  17398.   
  17399.   -- Called at the "do" following an accept statement.  Create a block
  17400.   -- and add tracing procedues for an parameters to the accept.
  17401.  
  17402.   ------------------------------------------------------------------
  17403.  
  17404.   procedure END_DO_SEQUENCE_OF_STATEMENTS; 
  17405.  
  17406.   -- Called at the end of the block for an accept statement.  Close the
  17407.   -- block that we created, and create a breakpoint.
  17408.  
  17409.   ------------------------------------------------------------------
  17410.  
  17411.   procedure ADD_BREAKPOINT; 
  17412.  
  17413.   -- Add a breakpoint to the instrumented source.
  17414.  
  17415.   ------------------------------------------------------------------
  17416.  
  17417.   procedure START_RETURN_STATEMENT;
  17418.  
  17419.   -- We are at a return statement.  Add a breakpoint and an exiting
  17420.   -- unit.
  17421.  
  17422.   ------------------------------------------------------------------
  17423.  
  17424.   procedure START_BLOCK(HAS_NAME : in BOOLEAN);
  17425.  
  17426.   -- Called when a block is encountered.  If the block has no name
  17427.   -- then one is created for it.  Scope names are set up to reflect
  17428.   -- the block name, and the scope package is called to set up a
  17429.   -- new scope.
  17430.  
  17431.   ------------------------------------------------------------------
  17432.  
  17433.   procedure END_FOR_LOOP; 
  17434.  
  17435.   -- Called at the end of a for loop.  Cleanup is done on the loop
  17436.   -- variable tracing information.
  17437.  
  17438.   -----------------------------------------------------------------
  17439.  
  17440.   procedure ADD_PACKAGE_BODY_BEGIN; 
  17441.  
  17442.   --  The package has no begin end block. If it is a compilation unit
  17443.   --  Then add a begin to the instrumented file, and call 
  17444.   --  create_unit_information for the package.
  17445.  
  17446.   ------------------------------------------------------------------
  17447.  
  17448.   procedure START_EXCEPTION_BRANCH; 
  17449.  
  17450.   --  We are beginning an exception branch.  Next the handler in a
  17451.   --  block and check to see if we caused the exception
  17452.  
  17453.   ------------------------------------------------------------------
  17454.  
  17455.   procedure END_EXCEPTION_SEQUENCE_OF_STATEMENTS; 
  17456.  
  17457.   --  Close the block that we created.  Include a when others exception
  17458.   --  handler that does an exiting unit and reraises the exception
  17459.  
  17460.   ------------------------------------------------------------------
  17461.  
  17462.   procedure ADD_OTHERS_HANDLER; 
  17463.  
  17464.   -- Add and others exception handler that calls exiting unit.
  17465.  
  17466.   ------------------------------------------------------------------
  17467.  
  17468.   procedure END_BLOCK_STATEMENT;
  17469.  
  17470.   -- Exit the scope created for a block statement
  17471.  
  17472.   ------------------------------------------------------------------
  17473.  
  17474.   procedure ADD_EXCEPTION_HANDLER; 
  17475.   
  17476.   -- Add an exception handler with an others branch that does an
  17477.   -- exiting unit.
  17478.  
  17479.   -----------------------------------------------------------------
  17480.  
  17481.   procedure END_COMPILATION_UNIT; 
  17482.  
  17483.   --| Effects
  17484.  
  17485.   --| Finish processing the current compilation unit, and reset
  17486.   --| local variables in case more compilation units follow.
  17487.  
  17488.   -----------------------------------------------------------------
  17489.  
  17490.   procedure INCREMENT_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE); 
  17491.  
  17492.   --| Effects
  17493.  
  17494.   --| This is called following the "is" of a program unit 
  17495.   --| declaration.  Stack any information from the outer scope.
  17496.   --| If the new scope is a package specification
  17497.   --| then initialize the buffer files
  17498.   --| which will contain the information for tracing the 
  17499.   --| types and variables declared in the package.
  17500.  
  17501.   -----------------------------------------------------------------
  17502.  
  17503.   procedure DECREMENT_SCOPE; 
  17504.  
  17505.   --| Effects
  17506.  
  17507.   --| This is called following the "end [identifier];" of
  17508.   --| a program unit declaration.  If the program unit was
  17509.   --| a package specification then close the tracing packages.
  17510.   --| Pop any stacked information from the enclosing scope.
  17511.  
  17512.   -----------------------------------------------------------------
  17513.  
  17514.   procedure START_DECLARATIVE_PART; 
  17515.  
  17516.   --| Effects
  17517.  
  17518.   --| This is called at the start of a declarative part for
  17519.   --| a body.  Add the procedure declaration for tracing local variables.
  17520.   --| If the unit is a package body, then retrieve the
  17521.   --| declarations for tracing the private part of its 
  17522.   --| specification.
  17523.  
  17524.   ----------------------------------------------------------------
  17525.  
  17526.   procedure END_DECLARATIVE_PART; 
  17527.  
  17528.   --| Effects
  17529.  
  17530.   --| Copy the subprogram bodies
  17531.   --| for type tracing into the instrumented source.  They were
  17532.   --| buffered until the end of the declarative part because
  17533.   --| bodies cannot be added until the "later declarative"
  17534.   --| part.  Procedure declarations for all of the bodies will
  17535.   --| have already been written to the instrumented source.
  17536.  
  17537.   -----------------------------------------------------------------
  17538.   procedure ADD_IDENTIFIER_TO_LIST; 
  17539.  
  17540.   --| Effects
  17541.  
  17542.   --| Add the current identifier to the identifier list. 
  17543.  
  17544.   -----------------------------------------------------------------
  17545.  
  17546.   procedure SET_IDENTIFIER_MODE(MODE : in IDENTIFIER_MODE); 
  17547.  
  17548.   --| Effects
  17549.  
  17550.   --| This procedure is called when the mode of current
  17551.   --| identifier list is known.  The type of the list is
  17552.   --| not known yet, so save the mode.
  17553.   --| The modes are:
  17554.   --|   READ_ONLY  : IN parameters and constants
  17555.   --|   WRITE_ONLY : OUT parameters
  17556.   --|   READ_WRITE : IN OUT parameters and variables
  17557.   --|   NONE       : task type varaibles, exception identifiers
  17558.  
  17559.   -----------------------------------------------------------------
  17560.  
  17561.   procedure PROCESS_IDENTIFIER_LIST(LIST_TYPE : in IDENTIFIER_LIST_TYPE); 
  17562.  
  17563.   --| Effects
  17564.  
  17565.   --| This is called at the end of the current identifier list.
  17566.   --| Update the mode and type for all identifiers in the list,
  17567.   --| and save the list for later processing, depending on the
  17568.   --| List_Type.
  17569.  
  17570.   -----------------------------------------------------------------
  17571.  
  17572.   procedure SAVE_TYPE_IDENTIFIER; 
  17573.  
  17574.   --| Effects
  17575.  
  17576.   --| The current identifier is the name of the type in
  17577.   --| a type declaration.  Save it for later use.
  17578.  
  17579.   -----------------------------------------------------------------
  17580.  
  17581.   procedure SAVE_TYPE_CLASS(TYPE_KIND : in TYPE_CLASS); 
  17582.  
  17583.   -- Remember what category of type defintion was encountered.
  17584.  
  17585.   -----------------------------------------------------------------
  17586.  
  17587.   procedure END_TYPE_DECLARATION; 
  17588.  
  17589.   -- Signal the end of a type declaration. Generate the tracing
  17590.   -- procedures for the type.
  17591.  
  17592.   -----------------------------------------------------------------
  17593.  
  17594.   procedure START_ANONYMOUS_ARRAY_DEFINITION; 
  17595.  
  17596.   -- An anonymous array is encountered.  Start generating trace procedures
  17597.   -- for the anonymous array
  17598.  
  17599.   procedure END_ANONYMOUS_ARRAY_DEFINITION; 
  17600.  
  17601.   --  Finish trace procedures for anonymous array
  17602.  
  17603.   -----------------------------------------------------------------
  17604.  
  17605.   procedure END_TYPEMARK; 
  17606.  
  17607.   --| Effects
  17608.  
  17609.   --| The current expanded name is a typemark name, (before
  17610.   --| any constraints which may follow).  Turn off the
  17611.   --| Saving_Expanded_Name flag.
  17612.  
  17613.   -----------------------------------------------------------------
  17614.  
  17615.   procedure START_PRIVATE_PART; 
  17616.  
  17617.   --| Effects
  17618.  
  17619.   --| Initialize the private type tracing files.
  17620.  
  17621.   -----------------------------------------------------------------
  17622.  
  17623.   procedure START_RECORD_VARIANT; 
  17624.  
  17625.   -- Perform processing required when a record variant is encountered
  17626.  
  17627.   -----------------------------------------------------------------
  17628.  
  17629.   procedure END_RECORD_VARIANT; 
  17630.  
  17631.   -- Complete processing for the record variant
  17632.  
  17633.   -----------------------------------------------------------------
  17634.  
  17635.   procedure NULL_RECORD_FIELD;
  17636.  
  17637.   -- Called when a null record field is encountered.  This is  saved
  17638.   -- so that we can put in a place holder if neccesary
  17639.  
  17640.   -----------------------------------------------------------------
  17641.  
  17642.   procedure SAVE_CASE_IDENTIFIER;
  17643.  
  17644.   -- Save the identifier used in a record case statment
  17645.  
  17646.   -----------------------------------------------------------------
  17647.  
  17648.   procedure SAVE_LOOP_PARAMETER; 
  17649.  
  17650.   -- Save information about a loop parameter.  Needed to enable tracing
  17651.   -- of the loop parameter.
  17652.  
  17653.   -----------------------------------------------------------------
  17654.  
  17655.   procedure START_GENERIC_SPECIFICATION; 
  17656.  
  17657.   -- Start processing a generic spec
  17658.  
  17659.   -----------------------------------------------------------------
  17660.   procedure END_GENERIC_SPECIFICATION;
  17661.  
  17662.   -- Stop processing a generic spec.  Reset flag indicating the a 
  17663.   -- generic is being processed.
  17664.  
  17665.   -----------------------------------------------------------------
  17666.  
  17667.   procedure END_GENERIC_TYPE;
  17668.  
  17669.   --  Add tracing procedures for the generic type.
  17670.  
  17671.   -----------------------------------------------------------------
  17672.  
  17673.   procedure INCREMENT_ARRAY_INDEX; 
  17674.  
  17675.   -- Used when processing a multi-dimension array.  Keeps count of
  17676.   -- the number of dimensions in the array.
  17677.  
  17678.   -----------------------------------------------------------------
  17679.  
  17680.   procedure START_ARRAY_INDEX; 
  17681.  
  17682.   -- Used to start counting the number of dimensions in an array
  17683.  
  17684.   -----------------------------------------------------------------
  17685.  
  17686.   procedure END_ARRAY_INDEX; 
  17687.  
  17688.   -- Stop counting the number of dims.  The current number is correct
  17689.  
  17690.   -----------------------------------------------------------------
  17691.  
  17692. end SOURCE_INSTRUMENTER_UTILITIES; 
  17693. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17694. --BKPT.SPC
  17695. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17696. with STRING_PKG; use STRING_PKG; 
  17697. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS;
  17698. with SD_TYPE_DEFINITIONS; use SD_TYPE_DEFINITIONS; 
  17699.  
  17700. package CREATE_BREAKPOINT is 
  17701.  
  17702. --| Overview
  17703. --| 
  17704. --| This package is used to insert calls into the source.  It maintains
  17705. --| a scope stack to maintain the current scope.  The create procedures
  17706. --| are used to do the actual insertion of code.  The other procedures
  17707. --| are used to tell this package when programs are started and ended
  17708.  
  17709.   BREAKPOINT_PRINTED_LAST        : BOOLEAN;  -- Used to prevent two consecutive
  17710.                                              -- breakpoints
  17711.  
  17712.   BREAKPOINT_NUMBER_FOR_PRINTING : STRING(1 .. 6) := "      "; 
  17713.                                                 -- breakpoint number in string
  17714.                                                 -- format for printing in 
  17715.                                                 -- listing file
  17716.  
  17717.   procedure NEW_COMPILATION_UNIT(UNIT_NAME    : in ADA_NAME; 
  17718.                                  TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE); 
  17719.  
  17720.   --| Effects
  17721.   --| 
  17722.   --| This procedure is used to define a new compilation unit.
  17723.   --| Each time a new compilation unit is entered, this procedure
  17724.   --| is called.  Any information about a previous compilation unit
  17725.   --| is cleared and the new compilation unit becomes the current 
  17726.   --| compilation unit.
  17727.  
  17728.   procedure START_PROGRAM_UNIT(UNIT_NAME    : in ADA_NAME; 
  17729.                                TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE); 
  17730.  
  17731.   --| Effects
  17732.   --| 
  17733.   --| This procedure is used to define a new program unit.  Each time a new
  17734.   --| program unit is entered, this procedure is called.  The procedure
  17735.   --| name and type are used in constructing entering/exiting units and
  17736.   --| breakpoints.  
  17737.  
  17738.   procedure CREATE_ENTERING_UNIT; 
  17739.  
  17740.   --| Effects
  17741.   --| 
  17742.   --| This procedure is called whenever an entering_unit procedure
  17743.   --| call needs to be added to the instrumented source.  The information
  17744.   --| about the current compilation unit and current program unit are used
  17745.   --| to construct the Entering_Unit procedure call.
  17746.  
  17747.   procedure CREATE_EXITING_UNIT; 
  17748.  
  17749.   --| Effects
  17750.   --| 
  17751.   --| This procedure creates an exiting unit call for the current program 
  17752.   --| unit.  This unit will be called before each return statement, at 
  17753.   --| the end of the program unit, and at the end of each exception
  17754.   --| handler.
  17755.  
  17756.   procedure END_PROGRAM_UNIT; 
  17757.  
  17758.   --| Effects
  17759.   --| 
  17760.   --| This procedure tells when a program unit has ended.  The current
  17761.   --| unit is set to the enclosing scope (if there is one).  All future
  17762.   --| calls to the create procedures will use this new unit.
  17763.  
  17764.   procedure CREATE_BREAKPOINT(LOOP_LIST : in STRING_LISTS.LIST); 
  17765.  
  17766.   --| Effects
  17767.   --| 
  17768.   --| This procedure is called each time a breakpoint needs to be added.  
  17769.   --| This procedure may be called at the same point in the source, so a 
  17770.   --| flag is maintained to tell when the last line output was a breakpoint.
  17771.   --| If it was, then another breakpoint is added.  This flag is reset in
  17772.   --| Source_Instrumenter_Utilities each time a new line of user code
  17773.   --| is output.
  17774.  
  17775.   procedure CREATE_UNIT_INFORMATION; 
  17776.  
  17777.   --| Effects
  17778.   --| 
  17779.   --| This procedure is called when a Unit_Information procedure call
  17780.   --| needs to be added to the source.  This procedure uses the current
  17781.   --| compilation unit and the list of procedures defined for that unit.
  17782.  
  17783.   --| Requires
  17784.   --| 
  17785.   --| This procedure must be the last one called for a compilation unit.
  17786.  
  17787.   function GET_PROGRAM_UNIT return STRING;
  17788.  
  17789.   --| Returns a string containing the program unit record for the current
  17790.   --| task. Used for printing the record in the instrumented source.
  17791.  
  17792.   function GET_PROGRAM_UNIT_NON_TASK return STRING;
  17793.  
  17794.   --|  Same as above for program units that are not tasks.
  17795.  
  17796. end CREATE_BREAKPOINT; 
  17797. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17798. --BKPT.BDY
  17799. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17800. with STACK_PKG; 
  17801. with LISTS; 
  17802. with TEXT_IO; use TEXT_IO; 
  17803. with CHANGE_TEXT;
  17804. with SD_SOURCE_BUFFERING;
  17805. with SYSTEM_PARAMETERS;
  17806. with SCOPE_PACKAGE;
  17807.  
  17808. package body CREATE_BREAKPOINT is 
  17809.  
  17810. --|  Overview
  17811. --|  
  17812. --|  This package takes care of creating calls to the RTM.  It creates
  17813. --|  breakpoints, Entering_units, and Exiting units with the appropriate
  17814. --|  parameters.  It also exports a function that returns a 
  17815. --|  program_unit_unique_identifier for the current unit.  This function
  17816. --|  is called to create the identifier for the calls create in tracing
  17817. --|  variables
  17818. --|  
  17819. --|  There are several routines called by the source instrumenter to tell
  17820. --|  this package when a unit is entered or exited.  These calls are:
  17821. --|  New_compilation_unit, Start_Program_Unit, and End_program_unit. 
  17822. --|  The information passed to these procedures allows the package to
  17823. --|  determine the name, type, and other info about the current unit
  17824. --|  and current compilation unit.
  17825. --|  
  17826. --|  Four other procedure are used to output instrumented source.  They are
  17827. --|  Create_entering_Unit, Create_exiting_unit, Create_Breakpoint, and
  17828. --|  Create_Unit_Information.  These procedures when called will output
  17829. --|  the appropriate call to the run time monitor.
  17830. --|  
  17831. --|  The current program unit is identified by three elements: The compilation
  17832. --|  unit containing it, a unique number assigned to the unit, and the type of
  17833. --|  unit.  The current compilation unit is always maintained in 
  17834. --|  CURRENT_COMPILATION_UNIT, and the other elements are maintained in 
  17835. --|  a record.  These records are stacked for nested procedures in order 
  17836. --|  to maintain the current unit properly.
  17837. --|  
  17838. --|  A list of the units in the current compilation unit is also maintained.  
  17839. --|  This list is used in the Unit_Information call to the Run time monitor to
  17840. --|  identify the units in a compilation unit.  This is the only place where
  17841. --|  the unit names are used.  All other places use the three elements used 
  17842. --|  above.  When the name of a unit is needed. Its unique number is used to 
  17843. --|  select the correct element of the list containing the program unit name.
  17844.  
  17845.   
  17846.   use STRING_PKG; 
  17847.   package SP  renames SYSTEM_PARAMETERS;
  17848.   package SID renames SOURCE_INSTRUMENTER_DECLARATIONS; 
  17849.   package SDB renames SD_SOURCE_BUFFERING;
  17850.  
  17851.   type PROGRAM_UNIT_INFORMATION is   --|  Information needed to identify a unit
  17852.     record
  17853.       UNIT_NAME   : ADA_NAME;
  17854.       UNIT_TYPE   : PROGRAM_UNIT_TYPE;         --|  type of unit
  17855.     end record; 
  17856.  
  17857.   type UNIT_DESCRIPTOR is
  17858.     record
  17859.       UNIT_NAME            : ADA_NAME;
  17860.       UNIT_TYPE            : PROGRAM_UNIT_TYPE;
  17861.       FIRST_BREAKPOINT     : BREAKPOINT_NUMBER_RANGE;
  17862.       LAST_BREAKPOINT      : BREAKPOINT_NUMBER_RANGE;
  17863.     end record;
  17864.  
  17865.   CURRENT_COMPILATION_UNIT : ADA_NAME; 
  17866.     --|  The name of the current compilation unit being processed
  17867.  
  17868.   BREAKPOINT_NUMBER        : BREAKPOINT_NUMBER_RANGE; 
  17869.     --|  The number of breakpoints that have been created
  17870.  
  17871.   CURRENT_PROGRAM_UNIT     : PROGRAM_UNIT_INFORMATION; 
  17872.     --|  Contains the information about the program unit currently being processed
  17873.  
  17874.   CURRENT_NESTING_LEVEL    : NATURAL; 
  17875.     --|  The current level of nesting
  17876.  
  17877.   package PROGRAM_UNIT_STACK_PACKAGE is      -- Used to Maintain the current
  17878.     new STACK_PKG(PROGRAM_UNIT_INFORMATION); -- unit info through nesting
  17879.  
  17880.   package PROGRAM_UNIT_LIST_PACKAGE is       -- Used to keep a list of the units
  17881.     new LISTS(UNIT_DESCRIPTOR);            -- in the current comp unit
  17882.  
  17883.   PROGRAM_UNIT_LIST  : PROGRAM_UNIT_LIST_PACKAGE.LIST; 
  17884.     --|  The list of units in the current compilation unit
  17885.  
  17886.   PROGRAM_UNIT_STACK : PROGRAM_UNIT_STACK_PACKAGE.STACK; 
  17887.     --|  The stack used to maintain the current unit
  17888.  
  17889. -------------------------------------------------------------------------
  17890.  
  17891.   procedure NEW_COMPILATION_UNIT(UNIT_NAME    : in ADA_NAME; 
  17892.                                  TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE) is 
  17893.  
  17894. --|  Effects
  17895. --|
  17896. --|  This procedure is used to define the current compilation unit.  Since a
  17897. --|  compilation can contain several compilation units, all variables
  17898. --|  must be re-initialized when a new compilation unit is started.
  17899.  
  17900.   begin
  17901.     CURRENT_NESTING_LEVEL := 1; 
  17902.     PROGRAM_UNIT_STACK := PROGRAM_UNIT_STACK_PACKAGE.CREATE; 
  17903.     PROGRAM_UNIT_LIST := PROGRAM_UNIT_LIST_PACKAGE.CREATE; 
  17904.     CURRENT_COMPILATION_UNIT := MAKE_PERSISTENT(UNIT_NAME); 
  17905.     BREAKPOINT_NUMBER := 0; 
  17906.  
  17907. --  If the compilation unit is a procedure or function then the procedure
  17908. --  or function is program unit number one.  In a package the first nested
  17909. --  unit will be unit number 1.
  17910.  
  17911.     CURRENT_PROGRAM_UNIT := (UNIT_NAME, TYPE_OF_UNIT); 
  17912.  
  17913.   end NEW_COMPILATION_UNIT; 
  17914.  
  17915. -------------------------------------------------------------------------
  17916.  
  17917.   procedure START_PROGRAM_UNIT(UNIT_NAME    : in ADA_NAME; 
  17918.                                TYPE_OF_UNIT : in PROGRAM_UNIT_TYPE) is 
  17919.  
  17920. --|  Effects
  17921. --|  
  17922. --|  This procedure defines a new program unit for the current compilation
  17923. --|  unit.  The nesting level is updated, the information about the enclosing
  17924. --|  unit is pushed on the stack, the new unit is defined to be the current
  17925. --|  unit and it is added to the list of units.
  17926.  
  17927.   begin
  17928.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL + 1; 
  17929.     PROGRAM_UNIT_STACK_PACKAGE.PUSH(PROGRAM_UNIT_STACK, CURRENT_PROGRAM_UNIT); 
  17930.     CURRENT_PROGRAM_UNIT := (UNIT_NAME, TYPE_OF_UNIT); 
  17931.   end START_PROGRAM_UNIT; 
  17932.  
  17933. -------------------------------------------------------------------------
  17934.  
  17935.   procedure CREATE_ENTERING_UNIT is 
  17936.  
  17937. --|  Effects
  17938. --|
  17939. --|  This procedure outputs the entering unit call to the run time monitor
  17940. --|  for the current unit.  The call is put to the instrumented file only
  17941.  
  17942.     CURRENT_UNIT : UNIT_DESCRIPTOR;
  17943.  
  17944.   begin
  17945.  
  17946.     -- Currently, entering unit call is not made for package body 
  17947.     -- initialization at outer level.  This may be added back later 
  17948.     -- if the problems can be overcome
  17949.  
  17950.     if CURRENT_PROGRAM_UNIT.UNIT_TYPE /= PACKAGE_TYPE then
  17951.       CURRENT_UNIT := (CURRENT_PROGRAM_UNIT.UNIT_NAME, 
  17952.         CURRENT_PROGRAM_UNIT.UNIT_TYPE, 
  17953.         BREAKPOINT_NUMBER + 1,
  17954.         0);
  17955.       PROGRAM_UNIT_LIST_PACKAGE.ATTACH(PROGRAM_UNIT_LIST, CURRENT_UNIT);
  17956.     end if;
  17957.  
  17958.     if not (CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE and
  17959.             CURRENT_NESTING_LEVEL > 1) then
  17960.       NEW_LINE(SID.INSTRUMENTED_FILE); 
  17961.       SDB.WRITE_INST_SOURCE(SP.PREFIX & "RTM.Entering_Unit("); 
  17962.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = TASK_TYPE then
  17963.         SDB.WRITE_INST_SOURCE(GET_PROGRAM_UNIT);
  17964.       else
  17965.         SDB.WRITE_INST_SOURCE(GET_PROGRAM_UNIT_NON_TASK); 
  17966.       end if;
  17967.       SDB.WRITE_INST_SOURCE(");"); 
  17968.       SDB.CLEAR_SOURCE_BUFFER;
  17969.  
  17970.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE then
  17971.         NEW_LINE(SID.INSTRUMENTED_FILE);
  17972.       end if;
  17973.     end if;
  17974.  
  17975.   end CREATE_ENTERING_UNIT; 
  17976.  
  17977. -------------------------------------------------------------------------
  17978.  
  17979.   procedure CREATE_EXITING_UNIT is 
  17980.  
  17981. --|  Effects
  17982. --|  
  17983. --|  This procedure creates the exiting unit call to the run time monitor.
  17984. --|  
  17985.  
  17986.   begin
  17987.  
  17988.     -- Currently, exiting unit call is not made for package body 
  17989.     -- initialization at outer level.  This may be added back later 
  17990.     -- if the problems can be overcome
  17991.  
  17992.     if not (CURRENT_PROGRAM_UNIT.UNIT_TYPE = PACKAGE_TYPE and
  17993.             CURRENT_NESTING_LEVEL > 1) then
  17994.       SDB.WRITE_INST_SOURCE(SP.PREFIX & "RTM.Exiting_Unit("); 
  17995.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = TASK_TYPE then
  17996.         SDB.WRITE_INST_SOURCE(GET_PROGRAM_UNIT); 
  17997.       else
  17998.         SDB.WRITE_INST_SOURCE(GET_PROGRAM_UNIT_NON_TASK); 
  17999.       end if;
  18000.       SDB.WRITE_LINE_INST_SOURCE(");"); 
  18001.       BREAKPOINT_PRINTED_LAST := FALSE; 
  18002.     end if;
  18003.   end CREATE_EXITING_UNIT; 
  18004.  
  18005. -------------------------------------------------------------------------
  18006.  
  18007.   procedure END_PROGRAM_UNIT is 
  18008.  
  18009. --|  Effects
  18010. --|  
  18011. --|  This is procedure is called to inform the create_breakpoint package
  18012. --|  that the current unit has ended.  If we are nested then the outer
  18013. --|  scope information is popped from the stack.  If the unit that
  18014. --|  we have just complete processing is a procedure that is a compilation
  18015. --|  unit, then output the call_unit_Information unit is created.
  18016. --|  
  18017.  
  18018.   begin
  18019.     CURRENT_NESTING_LEVEL := CURRENT_NESTING_LEVEL - 1; 
  18020.  
  18021.     if CURRENT_NESTING_LEVEL = 0 then 
  18022.  
  18023.   --  If this is an non-nested procedure then create a call_unit_info
  18024.   --  procedure.
  18025.   
  18026.       if CURRENT_PROGRAM_UNIT.UNIT_TYPE = PROCEDURE_TYPE or 
  18027.          CURRENT_PROGRAM_UNIT.UNIT_TYPE = FUNCTION_TYPE or
  18028.          CURRENT_PROGRAM_UNIT.UNIT_TYPE = TASK_TYPE then 
  18029.         NEW_LINE(SID.INSTRUMENTED_FILE); 
  18030.         SDB.WRITE_LINE_INST_SOURCE( 
  18031.           "with SD_RUN_TIME_MONITOR; use SD_RUN_TIME_MONITOR;");       
  18032.         SDB.WRITE_LINE_INST_SOURCE( 
  18033.           "with SD_TYPE_DEFINITIONS, STRING_PKG; use SD_TYPE_DEFINITIONS;");
  18034.         SDB.WRITE_LINE_INST_SOURCE( 
  18035.           "package body SD_" &
  18036.            CHANGE_TEXT.CONVERT_PERIODS_TO_UNDERSCORES(
  18037.              VALUE(CURRENT_COMPILATION_UNIT))
  18038.            & " is");
  18039.         SDB.WRITE_LINE_INST_SOURCE( "begin"); 
  18040.         CREATE_UNIT_INFORMATION; 
  18041.         SDB.WRITE_LINE_INST_SOURCE( "end;"); 
  18042.       end if; 
  18043.     else   -- we are nested so pop the outer scope from the stack
  18044.       PROGRAM_UNIT_STACK_PACKAGE.POP(PROGRAM_UNIT_STACK, CURRENT_PROGRAM_UNIT); 
  18045.     end if; 
  18046.   end END_PROGRAM_UNIT; 
  18047.  
  18048. -------------------------------------------------------------------------
  18049.  
  18050.   procedure CREATE_BREAKPOINT(LOOP_LIST : in STRING_LISTS.LIST) is 
  18051.  
  18052. --|  Effects
  18053. --|  
  18054. --|  This procedure will create a breakpoint in the souce code. 
  18055. --|  To prevent multiple breakpoints from being printed a flag is maintained 
  18056. --|  that identifies whether a breakpoint was the last item printed to the 
  18057. --|  instrumented source.  If this flag is true then no breakpoint is added.
  18058.  
  18059.     BREAKPOINT_LENGTH : INTEGER; 
  18060.       --|  The length of the string representation of the current bkpt number
  18061.  
  18062.     BLANK_STRING      : STRING(1 .. 5) := "     "; 
  18063.       --|  The string into which the bkpt number is put for printing in the
  18064.       --|  listing file.
  18065.  
  18066.     ITER              : STRING_LISTS.LISTITER;
  18067.     NEXT_NAME         : STRING_TYPE;
  18068.     TEMP              : STRING_TYPE;
  18069.   begin
  18070.  
  18071. --  Currently breakpoints are not added to package initializations
  18072.  
  18073.     if CURRENT_PROGRAM_UNIT.UNIT_TYPE /= PACKAGE_TYPE 
  18074.        and not BREAKPOINT_PRINTED_LAST then 
  18075.  
  18076.       -- Increment the breakpoint number and then make a string
  18077.       -- representation of the number for use in the listing
  18078.  
  18079.       BREAKPOINT_NUMBER := BREAKPOINT_NUMBER + 1; 
  18080.       BREAKPOINT_LENGTH := INTEGER'IMAGE(BREAKPOINT_NUMBER)'LENGTH; 
  18081.       BREAKPOINT_NUMBER_FOR_PRINTING := INTEGER'IMAGE(BREAKPOINT_NUMBER) & 
  18082.         BLANK_STRING(BREAKPOINT_LENGTH .. 5); 
  18083.       BREAKPOINT_NUMBER_FOR_PRINTING := BREAKPOINT_NUMBER_FOR_PRINTING(2 .. 6)
  18084.         & " "; 
  18085.  
  18086.       --  output the breakpoint
  18087.  
  18088.       SD_SOURCE_BUFFERING.WRITE_INST_SOURCE
  18089.         (SP.SD_PREFIX & "Local_Break(" & 
  18090.          INTEGER'IMAGE(BREAKPOINT_NUMBER) & "," & 
  18091.          INTEGER'IMAGE(SID.CURRENT_LINE_NUMBER));
  18092.  
  18093.       STRING_PKG.MARK;
  18094.       if STRING_LISTS.ISEMPTY(LOOP_LIST) then
  18095.         TEMP := CREATE("");
  18096.       else
  18097.         TEMP := CREATE(",");
  18098.         ITER := STRING_LISTS.MAKELISTITER(LOOP_LIST);
  18099.         loop
  18100.           STRING_LISTS.NEXT(ITER, NEXT_NAME);
  18101.           TEMP := TEMP & """ " & NEXT_NAME & " """ & 
  18102.                   " & " & SP.SD_PREFIX & "M(" &
  18103.                   NEXT_NAME & ")";
  18104.           exit when not STRING_LISTS.MORE(ITER);
  18105.           TEMP := TEMP & " & ";
  18106.         end loop;
  18107.       end if;
  18108.       SD_SOURCE_BUFFERING.WRITE_LINE_INST_SOURCE(VALUE(TEMP) & ");");
  18109.       STRING_PKG.RELEASE;
  18110.  
  18111.       BREAKPOINT_PRINTED_LAST := TRUE; 
  18112.  
  18113.     end if;
  18114.   end CREATE_BREAKPOINT; 
  18115.  
  18116. -------------------------------------------------------------------------
  18117.  
  18118.   procedure CREATE_UNIT_INFORMATION is 
  18119.  
  18120. --|  Effects
  18121. --|  
  18122. --|  This procedure is called to output the unit information call to the
  18123. --|  instrumented file.  This call must be made after all procedures in
  18124. --|  the compilation unit are defined.  No further calls can be made for
  18125. --|  the compilation unit after the unit information call is made.
  18126. --|  The unit Information includes a list of the names and types of the
  18127. --|  program units contained in the compilation unit.
  18128.  
  18129.     NEXT_PROGRAM_UNIT          : UNIT_DESCRIPTOR; 
  18130.       --|  Used to contain the next program unit when iterating the p.u. list
  18131.  
  18132.     PROGRAM_UNIT_LIST_ITERATOR : PROGRAM_UNIT_LIST_PACKAGE.LISTITER; 
  18133.       --|  The iterator used in iterating the program unit list
  18134.  
  18135.     PROGRAM_UNIT_NUMBER        : POSITIVE := 1; 
  18136.       --|  Used to maintain unit number for program unit list
  18137.  
  18138.   begin
  18139.     SDB.WRITE_LINE_INST_SOURCE(
  18140.       SP.PREFIX & "RTM.Unit_Information(""" & 
  18141.       VALUE(CURRENT_COMPILATION_UNIT) & """, " &
  18142.       NATURAL'IMAGE(BREAKPOINT_NUMBER) &  ", ("); 
  18143.  
  18144.     --  Iterate throught the list of program units printing each to
  18145.     --  the listing file
  18146.  
  18147.     if not PROGRAM_UNIT_LIST_PACKAGE.ISEMPTY(PROGRAM_UNIT_LIST) then
  18148.       PROGRAM_UNIT_LIST_ITERATOR := PROGRAM_UNIT_LIST_PACKAGE.MAKELISTITER(
  18149.         PROGRAM_UNIT_LIST); 
  18150.       while PROGRAM_UNIT_LIST_PACKAGE.MORE(PROGRAM_UNIT_LIST_ITERATOR) loop
  18151.         PROGRAM_UNIT_LIST_PACKAGE.NEXT(PROGRAM_UNIT_LIST_ITERATOR, 
  18152.           NEXT_PROGRAM_UNIT); 
  18153.         SDB.WRITE_INST_SOURCE(
  18154.           INTEGER'IMAGE(PROGRAM_UNIT_NUMBER) & " => (STRING_PKG.CREATE(""" &
  18155.           VALUE(NEXT_PROGRAM_UNIT.UNIT_NAME) & """)," &
  18156.           PROGRAM_UNIT_TYPE'IMAGE(NEXT_PROGRAM_UNIT.UNIT_TYPE) & "," &
  18157.           INTEGER'IMAGE(NEXT_PROGRAM_UNIT.FIRST_BREAKPOINT) & "," &
  18158.           INTEGER'IMAGE(NEXT_PROGRAM_UNIT.LAST_BREAKPOINT) & ")");
  18159.         if PROGRAM_UNIT_LIST_PACKAGE.MORE(PROGRAM_UNIT_LIST_ITERATOR) then 
  18160.           SDB.WRITE_LINE_INST_SOURCE( ","); 
  18161.         end if; 
  18162.         PROGRAM_UNIT_NUMBER := PROGRAM_UNIT_NUMBER + 1; 
  18163.       end loop; 
  18164.     else
  18165.       SDB.WRITE_INST_SOURCE( 
  18166.         "1 => (STRING_PKG.CREATE(""" & VALUE(CURRENT_COMPILATION_UNIT) &
  18167.         """),PACKAGE_TYPE,1,1)");
  18168.     end if;
  18169.     SDB.WRITE_LINE_INST_SOURCE( "));"); 
  18170.   end CREATE_UNIT_INFORMATION; 
  18171.  
  18172. -------------------------------------------------------------------------
  18173.  
  18174.   function GET_PROGRAM_UNIT return STRING is 
  18175.  
  18176. --|  Effects
  18177. --|  
  18178. --|  Returns the program unit for the current unit.  The program unit 
  18179. --|  description is returned as a string for printing in the instrumented
  18180. --|  file.  This call is used to add the program unit description to
  18181. --|  put value calls for variable tracing as well as for breakpoints
  18182. --|  and entering/exiting units
  18183.  
  18184.   begin
  18185.     return SP.PREFIX & "CURRENT_COMPILATION_UNIT, " & 
  18186.       INTEGER'IMAGE(SCOPE_PACKAGE.CURRENT_SCOPE.SCOPE_NUMBER) & ", " & 
  18187.       SP.PREFIX & "Task_Number"; 
  18188.   end GET_PROGRAM_UNIT; 
  18189.  
  18190. -------------------------------------------------------------------------
  18191.  
  18192.   function GET_PROGRAM_UNIT_NON_TASK return STRING is 
  18193.  
  18194. --|  Effects
  18195. --|  
  18196. --|  Returns the program unit for the current unit.  The program unit 
  18197. --|  description is returned as a string for printing in the instrumented
  18198. --|  file.  This call is used to add the program unit description to
  18199. --|  put value calls for variable tracing as well as for breakpoints
  18200. --|  and entering/exiting units
  18201.  
  18202.     PROGRAM_UNIT_NUMBER : INTEGER;
  18203.  
  18204.   begin
  18205.     if CURRENT_NESTING_LEVEL = 1 and CURRENT_PROGRAM_UNIT.UNIT_TYPE =
  18206.              PACKAGE_TYPE then
  18207.       PROGRAM_UNIT_NUMBER := 0;
  18208.     else
  18209.       PROGRAM_UNIT_NUMBER := SCOPE_PACKAGE.CURRENT_SCOPE.SCOPE_NUMBER;
  18210.     end if;
  18211.     return SP.PREFIX & "CURRENT_COMPILATION_UNIT, " & 
  18212.       INTEGER'IMAGE(PROGRAM_UNIT_NUMBER);
  18213.   end GET_PROGRAM_UNIT_NON_TASK; 
  18214.  
  18215. end CREATE_BREAKPOINT; 
  18216. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18217. --SIUTILS.BDY
  18218. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18219.  
  18220. -- packages needed by parsing 
  18221. with PARSETABLES; 
  18222. with GRAMMAR_CONSTANTS; use GRAMMAR_CONSTANTS;  -- to get visibility on =
  18223. with PARSERDECLARATIONS; use PARSERDECLARATIONS; 
  18224. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  18225.  
  18226. -- packages for abstract data types --
  18227. with UNCHECKED_DEALLOCATION; 
  18228. with STACK_PKG; 
  18229. with STRING_PKG; use STRING_PKG; 
  18230.  
  18231. -- packages needed for source instrumenting --
  18232. with SOURCE_INSTRUMENTER_DECLARATIONS; use SOURCE_INSTRUMENTER_DECLARATIONS; 
  18233. with CREATE_BREAKPOINT; 
  18234. with SD_TYPE_DEFINITIONS; use SD_TYPE_DEFINITIONS; 
  18235. with SCOPE_PACKAGE; use SCOPE_PACKAGE;
  18236. with SD_GENERATION_UTILITIES; 
  18237.  
  18238. -- packages needed for source instrumenter output --
  18239. with CHANGE_TEXT; 
  18240. with SD_BUFFER_FILES; use SD_BUFFER_FILES; 
  18241. with SD_SOURCE_BUFFERING;
  18242. with TEXT_IO; 
  18243. with STRING_IO;
  18244. with CATALOG_PKG;
  18245.  
  18246. package body SOURCE_INSTRUMENTER_UTILITIES is 
  18247. --| Utilities for the Source Instrumenter
  18248.  
  18249.   package SID renames SOURCE_INSTRUMENTER_DECLARATIONS; 
  18250.   package SP renames SYSTEM_PARAMETERS;
  18251.   package CT renames CHANGE_TEXT; 
  18252.   package PT renames PARSETABLES; 
  18253.   package SDBF renames SD_BUFFER_FILES; 
  18254.   package SDSB renames SD_SOURCE_BUFFERING;
  18255.   package SDGU renames SD_GENERATION_UTILITIES;
  18256.  
  18257.   -----------------------------------------------------------------
  18258.   -- Local declarations for formatting output
  18259.   -----------------------------------------------------------------
  18260.  
  18261.   IDENTIFIER_STACK      : TOKEN_STACK_PKG.STACK; 
  18262.   --| Stack of identifiers/designators
  18263.  
  18264.   BEGINNING_OF_LINE     : BOOLEAN := TRUE; 
  18265.   --| Tells whether the current column is at the beginning of a line
  18266.  
  18267.   CURRENT_COLUMN        : SP.COLUMN_RANGE := SP.COLUMN_RANGE'FIRST; 
  18268.   --| Current column in output file
  18269.  
  18270.   CURRENT_INDENT        : SP.INDENTATION_RANGE := 0; 
  18271.   --| Current indentation in output file
  18272.  
  18273.   TEMPORARY_INDENT      : SP.INDENTATION_RANGE := 0; 
  18274.   --| Temporary indentation in output file, when statement or declaration
  18275.   --| with no embedded requests for newlines is too big to fit on one line.
  18276.  
  18277.   PREVIOUS_INDENT       : SP.INDENTATION_RANGE := 0; 
  18278.   --| Saved indent for returning to after parameters or discriminants are
  18279.   --| lined up.
  18280.  
  18281.   CURRENT_CHANGE_COLUMN : SP.INDENTATION_RANGE := 0; 
  18282.   --| Column to change indent to
  18283.  
  18284.   UNPERFORMED_INDENTS   : NATURAL := 0; 
  18285.   --| The number of indents "requested" after the RH_Margin has been exceeded
  18286.   --| for situations where nesting is so deep that it is not
  18287.   --| worthwhile to further indent.
  18288.  
  18289.   EMPTY_TOKEN           : PD.PARSESTACKELEMENT := 
  18290.     (GRAM_SYM_VAL => PT.EMPTY_TOKENVALUE, 
  18291.      LEXED_TOKEN  => (TEXT => new STRING'(""), 
  18292.                       SRCPOS_LINE => 0, 
  18293.                       SRCPOS_COLUMN => 0)); 
  18294.  
  18295.   IDENTIFIER_TOKEN      : PD.PARSESTACKELEMENT := 
  18296.     (GRAM_SYM_VAL => PT.IDENTIFIERTOKENVALUE, 
  18297.      LEXED_TOKEN  => (TEXT => new STRING'(""), 
  18298.                       SRCPOS_LINE => 0, 
  18299.                       SRCPOS_COLUMN => 0)); 
  18300.  
  18301.   COLON_TOKEN           : PD.PARSESTACKELEMENT := 
  18302.     (GRAM_SYM_VAL => PT.COLON_TOKENVALUE, 
  18303.      LEXED_TOKEN  => (TEXT => new STRING'(":"), 
  18304.                       SRCPOS_LINE => 0, 
  18305.                       SRCPOS_COLUMN => 0)); 
  18306.  
  18307.   INITIALIZED_DESCRIPTOR : TOKEN_DESCRIPTOR :=
  18308.     (TOKEN=> (GRAM_SYM_VAL => PT.EMPTY_TOKENVALUE,
  18309.               LEXED_TOKEN  => (TEXT => new STRING'(""),
  18310.                                SRCPOS_LINE => 0,
  18311.                                SRCPOS_COLUMN => 0)),
  18312.      COMMENTS => COMMENT_LISTS.CREATE,
  18313.      REQUESTS => (0, 0, 0, 0, 0),
  18314.      CURRENT_CHANGE_COLUMN => 0,
  18315.      LEFT_SIDE_LENGTH => 0);
  18316.  
  18317.   PREVIOUS_TOKEN        : PD.PARSESTACKELEMENT := EMPTY_TOKEN; 
  18318.   --| Previous Token from the input stream
  18319.  
  18320.   SAVED_TOKEN           : PD.PARSESTACKELEMENT := EMPTY_TOKEN; 
  18321.   --| Previous identifier or string literal, saved so that it may be stacked
  18322.   --| and closing identifiers printed. 
  18323.  
  18324.   REQUESTS : REQUEST_DESCRIPTOR; 
  18325.  
  18326.   CURRENT_BUFFERED_TOKEN : TOKEN_DESCRIPTOR; 
  18327.  
  18328.   BUFFERED_TOKENS              : TOKEN_LISTS.LIST; 
  18329.   -- Used at beginning of compilation unit.  Tokens are buffered untill
  18330.   -- we know what the current unit is
  18331.  
  18332.   BUFFERING_TOKENS             : BOOLEAN := TRUE; 
  18333.   --|  Whether not we are currently buffering
  18334.  
  18335.   CURRENT_BLOCK_NUMBER         : NATURAL := 0; 
  18336.   --|  The number of current block(within the compilation unit).  Used to
  18337.   --|  assign an unique ID for unnamed blocks.
  18338.  
  18339.   SUBPROGRAM_UNIT_TYPE         : PROGRAM_UNIT_TYPE; 
  18340.   --|  Saves the type of the current subprogram.
  18341.  
  18342.   CREATE_SUBUNIT               : BOOLEAN := FALSE; 
  18343.   --|  Whether or not a subunit containing a unit_information call should
  18344.   --|  be created for the current compilation unit.
  18345.  
  18346.   SEPARATE_UNIT                : BOOLEAN := FALSE; 
  18347.   --|  Whether or not the current compilation unit is a subunit.
  18348.  
  18349.   CURRENT_COMPILATION_UNIT     : STRING_TYPE;
  18350.   --|  The name of the current compilation unit
  18351.  
  18352.   PARENT_UNIT_NAME             : STRING_TYPE;
  18353.   NUMBER_OF_PROGRAM_UNITS      : NATURAL := 0;
  18354.   GENERIC_STARTED              : BOOLEAN := FALSE;
  18355.  
  18356.   -----------------------------------------------------------------
  18357.   -- Declarations for type and identifier tracing 
  18358.   -----------------------------------------------------------------
  18359.  
  18360.   OUTPUT_SOURCE                : BOOLEAN := TRUE; 
  18361.   --| The user may set this flag to False if he does not want the
  18362.   --| source for top level package specs included in the instrumented
  18363.   --| source file.  If the source is not included, then the package
  18364.   --| spec itself won't get re-compiled when the instrumented source 
  18365.   --| is compiled.  This allows for instrumenting a package spec
  18366.   --| without changing it.
  18367.  
  18368.   EXPANDED_NAME                : STRING_TYPE; 
  18369.   --| An Expanded_Name is a qualified name, as in X.Y.Z 
  18370.   --| Expanded_Name is a string_type collection of the tokens
  18371.   --| which make up the complete qualified name.  This is used
  18372.   --| in various places when a name which needs to be saved is 
  18373.   --| not a simple identifier.
  18374.  
  18375.   SAVE_EXPANDED_NAME         : BOOLEAN := FALSE; 
  18376.   --| This is set to true by applyactions at the start of an
  18377.   --| expanded name.  The text of all following tokens is
  18378.   --| appened to Expanded_Name until SAVE_EXPANDED_NAME is
  18379.   --| again set to false.
  18380.  
  18381.   NOT_INCOMPLETE_TYPE          : BOOLEAN := FALSE; 
  18382.  
  18383.   CURRENT_TYPE_IDENTIFIER      : STRING_TYPE; 
  18384.   --| Save the last "Expanded_Name" that was built.  It is
  18385.   --| the name of the current type being declared, and will
  18386.   --| be needed to generate the tracing procedure.
  18387.  
  18388.   CURRENT_TYPE_CLASS           : TYPE_CLASS;
  18389.   
  18390.   CURRENT_MODE       : IDENTIFIER_MODE := NONE; 
  18391.   --| This is set by a call from applyactions when the mode 
  18392.   --| of the current identifier list is known (following the
  18393.   --| colon in "identifer_list : ....".  Parsing has not
  18394.   --| reached the end of the list yet, so the mode must
  18395.   --| be saved.
  18396.  
  18397.   -- variables for array tracing --
  18398.   PARSING_ARRAY_INDEX    : BOOLEAN;
  18399.   NUMBER_OF_DIMENSIONS   : NATURAL;
  18400.   ANON_ARRAY_TEXT        : STRING_LISTS.LIST;
  18401.   SAVE_ANON_ARRAY_TEXT   : BOOLEAN := FALSE;
  18402.   ANON_NUMBER            : NATURAL := 0;
  18403.  
  18404.   -- variables for record tracing --
  18405.   CURRENT_RECORD_FIELD   : REC_FIELD_RECORD;
  18406.   SAVE_RECORD_VARIANT    : BOOLEAN := FALSE;
  18407.   CASE_DISCRIMINANT      : STRING_TYPE;
  18408.   SAVE_CASE_DISCRIMINANT : BOOLEAN := FALSE;
  18409.   ---------------------------------
  18410.  
  18411.   CURRENT_LIST       : NAME_LISTS.LIST; 
  18412.   --| A temporary list to collect identifiers until the type
  18413.   --| of identifier list is known.
  18414.  
  18415.   PARAM_LIST         : NAME_LISTS.LIST; 
  18416.   --| A list of formal parameters and their mode (in, out, or
  18417.   --| in out)
  18418.  
  18419.   VISIBLE_LIST       : NAME_LISTS.LIST; 
  18420.   --| A list of local variables and their mode (constant
  18421.   --| or variable)
  18422.  
  18423.   REC_FIELD_LIST     : RECORD_LISTS.LIST;
  18424.   --| A list of the fields in the current record 
  18425.  
  18426.   DISCRIM_LIST       : STRING_LIST;
  18427.   --| A list of the discriminants in the current record
  18428.  
  18429.   PACKAGE_LIST       : STRING_LIST; 
  18430.   --| A list of packages declared in the current scope
  18431.  
  18432.   WITH_LIST          : STRING_LIST; 
  18433.   --| A list of instrumented library units from the current
  18434.   --| context clause.
  18435.  
  18436.   USE_LIST           : STRING_LIST; 
  18437.   --| A list of the packages named in a use clause.
  18438.  
  18439.   LOOP_LIST          : STRING_LIST;
  18440.  
  18441.   VISIBLE_LIST_STACK : LIST_STACK_PKG.STACK; 
  18442.   --| The list of visible variables for the current scope
  18443.   --| is stacked when a nested scope is entered.
  18444.  
  18445.   USE_LIST_STACK     : STRING_STACK_PKG.STACK;
  18446.   --| The list of used units for the current scope is stacked
  18447.   --| when a new scope is entered.
  18448.  
  18449.   PACKAGE_LIST_STACK : STRING_STACK_PKG.STACK; 
  18450.   --| The list of names of packages declared in the current
  18451.   --| scope is stacked when a new scope is entered.
  18452.  
  18453.   GENERIC_TYPE_LIST  : STRING_LISTS.LIST;
  18454.  
  18455.   -----------------------------------------------------------------
  18456.   -- Local subprogram specifications for pretty printing
  18457.   -----------------------------------------------------------------
  18458.  
  18459.   procedure FREE is 
  18460.     new UNCHECKED_DEALLOCATION(STRING, PD.SOURCE_TEXT); 
  18461.  
  18462.     -----------------------------------------------------------------
  18463.  
  18464.   procedure PRINT_TOKEN(NEXT_TOKEN : in out PD.PARSESTACKELEMENT); 
  18465.   --| Prints Next_Token and updates column information
  18466.  
  18467.   -----------------------------------------------------------------
  18468.  
  18469.   procedure PRINT_NEW_LINE; 
  18470.   --| Puts a newline in the output and updates column information.
  18471.  
  18472.   -----------------------------------------------------------------
  18473.  
  18474.   procedure PROCESS_REQUESTS; 
  18475.   -- Perform requests associated with current token
  18476.  
  18477.   -----------------------------------------------------------------
  18478.  
  18479.   procedure SPACE(FILE : in TEXT_IO.FILE_TYPE;
  18480.                   COUNT : in INTEGER);
  18481.   -- Add the specified number of spaces to the file
  18482.  
  18483.   -----------------------------------------------------------------
  18484.  
  18485.   procedure SPACE(COUNT : in INTEGER);
  18486.   -- Add the specified number of spaces to the listing file
  18487.  
  18488.   -----------------------------------------------------------------
  18489.   -- Local subprogram specifications for source instrumenting
  18490.   -----------------------------------------------------------------
  18491.  
  18492.   -----------------------------------------------------------------
  18493.  
  18494.   procedure PRINT_BUFFERED_TOKENS; 
  18495.   --|  Prints any tokens that have been buffered 
  18496.  
  18497.   -----------------------------------------------------------------
  18498.  
  18499.   function MAKE_ANON_TYPE_NAME return STRING_TYPE;
  18500.   -- Used in processing anonymous array types
  18501.  
  18502.   -----------------------------------------------------------------
  18503.  
  18504.   procedure RETRIEVE_SPEC_WITH_LIST; 
  18505.   --| Get the names of any instrumented units that were named in
  18506.   --| the context clause of the package specification and merge
  18507.   --| the names into the with_list for the package body.
  18508.  
  18509.   -----------------------------------------------------------------
  18510.  
  18511.   procedure DISCARD_LIST(WHICH_LIST : in out NAME_LISTS.LIST); 
  18512.   --| A general purpose procedure which flushes the string_type
  18513.   --| fields of a name_record before destroying the list.
  18514.  
  18515.   -----------------------------------------------------------------
  18516.  
  18517.   procedure DISCARD_LIST(WHICH_LIST : in out RECORD_LISTS.LIST); 
  18518.   --| A general purpose procedure which flushes the string_type
  18519.   --| fields of a rec_field_record before destroying the list.
  18520.  
  18521.   -----------------------------------------------------------------
  18522.  
  18523.   procedure DISCARD_LIST(WHICH_LIST : in out STRING_LISTS.LIST); 
  18524.   --| A general purpose procedure which flushes the string_type
  18525.   --| fields before destroying the list.
  18526.  
  18527.   -----------------------------------------------------------------
  18528.  
  18529.   procedure ADD_WITHS_TO_BODY; 
  18530.   --| Add the necessary with and use clauses to a subprogram or
  18531.   --| package body.
  18532.  
  18533.   -----------------------------------------------------------------
  18534.  
  18535.   procedure ADD_WITHS_TO_TRACE_PACKAGES; 
  18536.   --| Add the necessary with and use clauses to the packages 
  18537.   --| generated to trace a package specification.  This procedure
  18538.   --| is called by Initialize_Trace_Packages.
  18539.  
  18540.   -----------------------------------------------------------------
  18541.  
  18542.   procedure INITIALIZE_TRACE_PACKAGES; 
  18543.   --| Start the packages that are created by the instrumenter for
  18544.   --| tracing package specifications.
  18545.  
  18546.   -----------------------------------------------------------------
  18547.  
  18548.   procedure CLOSE_TRACE_PACKAGES; 
  18549.   --| Finish and save the packages that are created for tracing
  18550.   --| package specificatiosn.
  18551.  
  18552.   -----------------------------------------------------------------
  18553.  
  18554.   procedure DISPLAY_MESSAGE;
  18555.   --| This procedure displays the help message from 
  18556.   --| ASK_USER_ABOUT_PACKAGE;
  18557.  
  18558.   -----------------------------------------------------------------
  18559.  
  18560.   function ASK_USER_ABOUT_PACKAGE return BOOLEAN; 
  18561.   --| Ask the user if he really wants to recompile a library unit
  18562.   --| that is a package specification.
  18563.   --| If the answer is NO, then the text of the package specification
  18564.   --| will not be included in the instrumented source.
  18565.  
  18566.  
  18567.   -----------------------------------------------------------------
  18568.   -- External Subprogram Bodies for pretty printing
  18569.   -----------------------------------------------------------------
  18570.  
  18571.   procedure INITIALIZE is 
  18572.   begin
  18573.     IDENTIFIER_STACK := TOKEN_STACK_PKG.CREATE; 
  18574.     BEGINNING_OF_LINE := TRUE; 
  18575.     CURRENT_COLUMN := 1; 
  18576.     CURRENT_INDENT := 0; 
  18577.     TEMPORARY_INDENT := 0; 
  18578.     PREVIOUS_INDENT := 0;
  18579.     CURRENT_CHANGE_COLUMN := 0;
  18580.     UNPERFORMED_INDENTS := 0; 
  18581.  
  18582.     EMPTY_TOKEN := (GRAM_SYM_VAL => PT.EMPTY_TOKENVALUE, 
  18583.                     LEXED_TOKEN  => (TEXT=> new STRING'(""), 
  18584.                                      SRCPOS_LINE => 0, 
  18585.                                      SRCPOS_COLUMN => 0)); 
  18586.     PREVIOUS_TOKEN := EMPTY_TOKEN; 
  18587.     SAVED_TOKEN := EMPTY_TOKEN; 
  18588.     REQUESTS := (0, 0, 0, 0, 0); 
  18589.  
  18590.     BUFFERING_TOKENS := TRUE; 
  18591.     BUFFERED_TOKENS := TOKEN_LISTS.CREATE; 
  18592.     CURRENT_BUFFERED_TOKEN := INITIALIZED_DESCRIPTOR; 
  18593.  
  18594.     CURRENT_LINE_NUMBER := 1;
  18595.     CURRENT_NESTING_LEVEL := 0;
  18596.     CURRENT_SCOPE := NULL_SCOPE;
  18597.     CURRENT_OUTER_SCOPE := NULL_SCOPE;
  18598.  
  18599.     CURRENT_BLOCK_NUMBER := 0;
  18600.     NUMBER_OF_PROGRAM_UNITS := 0;
  18601.     NUMBER_OF_DIMENSIONS := 0;
  18602.     ANON_NUMBER := 0;
  18603.     
  18604.     OUTPUT_SOURCE := TRUE; 
  18605.     CREATE_SUBUNIT := FALSE;
  18606.     SEPARATE_UNIT := FALSE;
  18607.     NOT_INCOMPLETE_TYPE := FALSE;
  18608.     PARSING_ARRAY_INDEX := FALSE;
  18609.     SAVE_EXPANDED_NAME := FALSE;
  18610.     SAVE_ANON_ARRAY_TEXT := FALSE;
  18611.     SAVE_RECORD_VARIANT := FALSE;
  18612.     SAVE_CASE_DISCRIMINANT := FALSE;
  18613.     GENERIC_STARTED := FALSE;
  18614.  
  18615.     USE_LIST        := STRING_LISTS.CREATE; 
  18616.     WITH_LIST       := STRING_LISTS.CREATE; 
  18617.     PACKAGE_LIST    := STRING_LISTS.CREATE; 
  18618.     PARAM_LIST      := NAME_LISTS.CREATE; 
  18619.     VISIBLE_LIST    := NAME_LISTS.CREATE; 
  18620.     DISCRIM_LIST    := STRING_LISTS.CREATE;
  18621.     LOOP_LIST       := STRING_LISTS.CREATE;
  18622.     ANON_ARRAY_TEXT := STRING_LISTS.CREATE;
  18623.     REC_FIELD_LIST  := RECORD_LISTS.CREATE;
  18624.     CURRENT_LIST    := NAME_LISTS.CREATE; 
  18625.     CURRENT_RECORD_FIELD.REC_FIELD   := STRING_LISTS.CREATE;
  18626.     CURRENT_RECORD_FIELD.CHOICE_TEXT := STRING_LISTS.CREATE;
  18627.     GENERIC_TYPE_LIST := STRING_LISTS.CREATE;
  18628.  
  18629.     VISIBLE_LIST_STACK  := LIST_STACK_PKG.CREATE; 
  18630.     PACKAGE_LIST_STACK  := STRING_STACK_PKG.CREATE; 
  18631.     USE_LIST_STACK      := STRING_STACK_PKG.CREATE; 
  18632.  
  18633.     SDBF.INITIALIZE; 
  18634.  
  18635.   end INITIALIZE; 
  18636.  
  18637.   -----------------------------------------------------------------
  18638.  
  18639.   procedure PUT(NEXT_TOKEN : in out PD.PARSESTACKELEMENT) is 
  18640.     TEMP_TOKEN : TOKEN_DESCRIPTOR; 
  18641.   begin
  18642.  
  18643.   -- If we are buffering tokens the add previous token to buffer
  18644.  
  18645.     if BUFFERING_TOKENS and 
  18646.       (CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE) then 
  18647.       CURRENT_BUFFERED_TOKEN.REQUESTS := REQUESTS; 
  18648.       CURRENT_BUFFERED_TOKEN.CURRENT_CHANGE_COLUMN := CURRENT_CHANGE_COLUMN;
  18649.       CURRENT_CHANGE_COLUMN := 0;
  18650.       REQUESTS := (0, 0, 0, 0, 0); 
  18651.       TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  18652.       CURRENT_BUFFERED_TOKEN := INITIALIZED_DESCRIPTOR; 
  18653.     end if; 
  18654.  
  18655.     -- function designator can be string literal or identifier, so save
  18656.     -- both, so closing identifier/designator can be printed.
  18657.     if (NEXT_TOKEN.GRAM_SYM_VAL = PT.IDENTIFIERTOKENVALUE) or 
  18658.        (NEXT_TOKEN.GRAM_SYM_VAL = PT.STRINGTOKENVALUE) then 
  18659.       SAVED_TOKEN := NEXT_TOKEN; 
  18660.     end if; 
  18661.  
  18662.     if SAVE_EXPANDED_NAME then 
  18663.       EXPANDED_NAME := EXPANDED_NAME & UPPER(CT.TOKEN_TEXT(NEXT_TOKEN)); 
  18664.     end if; 
  18665.  
  18666.     if SAVE_ANON_ARRAY_TEXT then
  18667.       STRING_LISTS.ATTACH(ANON_ARRAY_TEXT,
  18668.         MAKE_PERSISTENT(CT.TOKEN_TEXT(NEXT_TOKEN)));
  18669.     end if;
  18670.  
  18671.     if SAVE_CASE_DISCRIMINANT then
  18672.       CASE_DISCRIMINANT := MAKE_PERSISTENT(SAVED_TOKEN.LEXED_TOKEN.TEXT.ALL);
  18673.       SAVE_CASE_DISCRIMINANT := FALSE;
  18674.     end if;
  18675.  
  18676.     if SAVE_RECORD_VARIANT then
  18677.       -- this is the 'when =>' portion of a case statement in a record 
  18678.       -- declaration
  18679.       STRING_LISTS.ATTACH(CURRENT_RECORD_FIELD.CHOICE_TEXT, 
  18680.         MAKE_PERSISTENT(CT.TOKEN_TEXT(NEXT_TOKEN)));
  18681.     end if;
  18682.  
  18683.     if BUFFERING_TOKENS then 
  18684.       CURRENT_BUFFERED_TOKEN := INITIALIZED_DESCRIPTOR; 
  18685.       CURRENT_BUFFERED_TOKEN.TOKEN := NEXT_TOKEN; 
  18686.       CURRENT_BUFFERED_TOKEN.COMMENTS := COMMENT_BUFFER; 
  18687.     else 
  18688.       PRINT_COMMENTS(COMMENT_BUFFER); 
  18689.       PRINT_TOKEN(NEXT_TOKEN); 
  18690.     end if; 
  18691.     CREATE_BREAKPOINT.BREAKPOINT_PRINTED_LAST := FALSE; 
  18692.   end PUT; 
  18693.  
  18694.   -----------------------------------------------------------------
  18695.  
  18696.   procedure PUT_SPACE(SPACES : in NATURAL := 1) is 
  18697.     BLANK : constant STRING := "                    " & 
  18698.       "                                                            "; 
  18699.   begin
  18700.     if BUFFERING_TOKENS then 
  18701.       if CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE
  18702.         then 
  18703.         TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  18704.         CURRENT_BUFFERED_TOKEN := INITIALIZED_DESCRIPTOR; 
  18705.         CURRENT_BUFFERED_TOKEN.TOKEN := EMPTY_TOKEN; 
  18706.         CURRENT_BUFFERED_TOKEN.TOKEN.LEXED_TOKEN.TEXT := 
  18707.            new STRING'(BLANK(1 .. SPACES)); 
  18708.       else 
  18709.         null; --?????
  18710.       end if; 
  18711.     else 
  18712.       if CURRENT_COLUMN + SPACES - 1 > SP.PAGE_WIDTH then 
  18713.         PRINT_NEW_LINE; 
  18714.         TEMPORARY_INDENT := SP.INDENTATION_LEVEL; 
  18715.         CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  18716.       end if; 
  18717.  
  18718.       if BEGINNING_OF_LINE then 
  18719.         SPACE(SID.LISTING_FILE, CURRENT_COLUMN - 1); 
  18720.         SPACE(CURRENT_COLUMN - 1);
  18721.         if OUTPUT_SOURCE then 
  18722.           SPACE(SID.INSTRUMENTED_FILE, CURRENT_COLUMN - 1); 
  18723.         end if; 
  18724.       end if; 
  18725.       SPACE(SID.LISTING_FILE, SPACES); 
  18726.       SPACE(SPACES);
  18727.       if OUTPUT_SOURCE then 
  18728.         SPACE(SID.INSTRUMENTED_FILE, SPACES); 
  18729.       end if; 
  18730.       CURRENT_COLUMN := CURRENT_COLUMN + SPACES; 
  18731.     end if; 
  18732.   end PUT_SPACE; 
  18733.  
  18734.   -----------------------------------------------------------------
  18735.  
  18736.   procedure PRINT_COMMENTS(BUFFER : in out COMMENT_LISTS.LIST) is 
  18737.  
  18738.     ITER               : COMMENT_LISTS.LISTITER;  --| Iterates down comment list
  18739.     COMMENT_TOKEN      : PD.PARSESTACKELEMENT;    --| Element in list of comments
  18740.     NEW_LINES          : NATURAL := 0;            --| number of new_lines
  18741.                                                   --| between comments
  18742.     SAVE_OUTPUT_SOURCE : BOOLEAN := OUTPUT_SOURCE;
  18743.  
  18744.   begin
  18745.     OUTPUT_SOURCE := FALSE;
  18746.     ITER := COMMENT_LISTS.MAKELISTITER(BUFFER); 
  18747.     while COMMENT_LISTS.MORE(ITER) loop
  18748.       COMMENT_LISTS.NEXT(ITER, COMMENT_TOKEN); 
  18749.  
  18750.       -- Print new lines between this comment token and
  18751.       -- previous token in source, unless new lines were already printed
  18752.       -- for comment formatting.
  18753.       NEW_LINES := 
  18754.         COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 
  18755.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE; 
  18756.       for I in 1 .. NEW_LINES loop
  18757.         PRINT_NEW_LINE; 
  18758.       end loop; 
  18759.  
  18760.       -- try to indent to level of source 
  18761.       if ((SP.PAGE_WIDTH - CURRENT_COLUMN) >= 
  18762.            CT.TOKEN_TEXT(COMMENT_TOKEN)'LENGTH) then 
  18763.         if BEGINNING_OF_LINE then 
  18764.           SPACE(SID.LISTING_FILE, 
  18765.                    CURRENT_COLUMN - 1 + 
  18766.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  18767.           SPACE(CURRENT_COLUMN - 1 +
  18768.                   CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH);
  18769.         else 
  18770.           -- put extra space in so comment is separated from previous token
  18771.           PUT_SPACE; 
  18772.         end if; 
  18773.       else 
  18774.         if NEW_LINES > 0 then 
  18775.           CURRENT_COLUMN := 1; 
  18776.         end if; 
  18777.  
  18778.         -- if comment can't go where it was in source, put it at same
  18779.         -- column on next line.
  18780.         if COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN < CURRENT_COLUMN then 
  18781.           TEXT_IO.NEW_LINE(SID.LISTING_FILE);
  18782.           CURRENT_LINE_NUMBER := CURRENT_LINE_NUMBER + 1;
  18783.           STRING_IO.NEW_LINE;
  18784.           SPACE(SID.LISTING_FILE, 
  18785.                    COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - 1 +
  18786.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  18787.           SPACE(COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - 1 +
  18788.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH);
  18789.         else 
  18790.           SPACE(SID.LISTING_FILE, 
  18791.                    COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - 
  18792.                    CURRENT_COLUMN + 
  18793.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH); 
  18794.           SPACE(COMMENT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN - CURRENT_COLUMN +
  18795.                    CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING'LENGTH);
  18796.         end if; 
  18797.       end if; 
  18798.       TEXT_IO.PUT(SID.LISTING_FILE, CT.TOKEN_TEXT(COMMENT_TOKEN)); 
  18799.       STRING_IO.PUT(CT.TOKEN_TEXT(COMMENT_TOKEN));
  18800.  
  18801.       FREE(COMMENT_TOKEN.LEXED_TOKEN.TEXT); 
  18802.       PREVIOUS_TOKEN := COMMENT_TOKEN; 
  18803.     end loop; 
  18804.  
  18805.     -- process any requests not handled earlier
  18806.     PROCESS_REQUESTS; 
  18807.  
  18808.     OUTPUT_SOURCE := SAVE_OUTPUT_SOURCE;
  18809.  
  18810.     -- if there were some comments in buffer put new line after them
  18811.     if (not COMMENT_LISTS.ISEMPTY(BUFFER)) then 
  18812.       PRINT_NEW_LINE; 
  18813.     else 
  18814.       for I in 1 .. REQUESTS.NEW_LINES loop
  18815.         PRINT_NEW_LINE; 
  18816.       end loop; 
  18817.     end if; 
  18818.     REQUESTS.NEW_LINES := 0; 
  18819.  
  18820.     COMMENT_LISTS.DESTROY(BUFFER); 
  18821.  
  18822.   end PRINT_COMMENTS; 
  18823.  
  18824.   -----------------------------------------------------------------
  18825.  
  18826.   procedure NEW_LINE is 
  18827.  
  18828.   --| Effects
  18829.   --|
  18830.   --| Requests a new_line for the output.  The newline is not actually
  18831.   --| printed here, in order that comments are put in the appropriate
  18832.   --| place.  The actual newline is printed in Print_New_Line.
  18833.   begin
  18834.       REQUESTS.NEW_LINES := REQUESTS.NEW_LINES + 1; 
  18835.   end NEW_LINE; 
  18836.  
  18837.   -----------------------------------------------------------------
  18838.  
  18839.   procedure INCREASE_INDENT is 
  18840.  
  18841.   --| Effects
  18842.   --|
  18843.   --| Requests an increase in indentation.  The increase is not actually
  18844.   --| processed here, in order that comments are put in the appropriate
  18845.   --| place.  The actual increase is processed in Process_Increase_Requests.
  18846.   begin
  18847.       REQUESTS.INCREASES := REQUESTS.INCREASES + 1; 
  18848.   end INCREASE_INDENT; 
  18849.  
  18850.   -----------------------------------------------------------------
  18851.  
  18852.   procedure DECREASE_INDENT is 
  18853.  
  18854.   --| Effects
  18855.   --|
  18856.   --| Requests a decrease in indentation.  The decrease is not actually
  18857.   --| processed here, in order that comments are put in the appropriate
  18858.   --| place.  The actual decrease is processed in Process_Decrease_Requests.
  18859.   begin
  18860.       REQUESTS.DECREASES := REQUESTS.DECREASES + 1; 
  18861.   end DECREASE_INDENT; 
  18862.  
  18863.   -----------------------------------------------------------------
  18864.  
  18865.   procedure CHANGE_INDENT is 
  18866.  
  18867.   --| Effects
  18868.   --|
  18869.   --| Requests a change in indentation.  The change is not actually
  18870.   --| processed here, in order that comments are put in the appropriate
  18871.   --| place.  The actual change is processed in Process_Change_Requests.
  18872.   begin
  18873.       REQUESTS.CHANGES := REQUESTS.CHANGES + 1; 
  18874.       if CURRENT_COLUMN in SP.INDENTATION_RANGE then
  18875.         CURRENT_CHANGE_COLUMN := CURRENT_COLUMN; 
  18876.       elsif CURRENT_INDENT + SP.INDENTATION_LEVEL + 2 < SP.RH_MARGIN then
  18877.         CURRENT_CHANGE_COLUMN := CURRENT_INDENT + SP.INDENTATION_LEVEL + 2;
  18878.       else
  18879.         CURRENT_CHANGE_COLUMN := CURRENT_INDENT;
  18880.       end if;
  18881.   end CHANGE_INDENT; 
  18882.  
  18883.   -----------------------------------------------------------------
  18884.  
  18885.   procedure RESUME_NORMAL_INDENTATION is 
  18886.  
  18887.   --| Effects
  18888.   --|
  18889.   --| Requests a resume of the previous indentation.  This is not actually
  18890.   --| processed here, in order that comments are put in the appropriate
  18891.   --| place.  The actual resume is processed in Process_Resume_Requests.
  18892.   begin
  18893.       REQUESTS.RESUMES := REQUESTS.RESUMES + 1; 
  18894.   end RESUME_NORMAL_INDENTATION; 
  18895.  
  18896.   -----------------------------------------------------------------
  18897.  
  18898.   procedure SPACE(FILE : in TEXT_IO.FILE_TYPE;
  18899.                   COUNT : in INTEGER) is
  18900.     SPACE_STRING : STRING(1 .. COUNT) := (1 .. COUNT => ' '); 
  18901.   begin
  18902.     if COUNT > 0 then 
  18903.       TEXT_IO.PUT(FILE, SPACE_STRING); 
  18904.     end if; 
  18905.   end SPACE; 
  18906.  
  18907.   -----------------------------------------------------------------
  18908.  
  18909.   procedure SPACE(COUNT : in INTEGER) is
  18910.     SPACE_STRING : STRING(1 .. COUNT) := (1 .. COUNT => ' '); 
  18911.   begin
  18912.     if COUNT > 0 then 
  18913.      STRING_IO.PUT(SPACE_STRING); 
  18914.     end if; 
  18915.   end SPACE; 
  18916.  
  18917.   -----------------------------------------------------------------
  18918.  
  18919.   procedure POP_IDENTIFIER(WHERE : in POP_TO_WHERE := TO_NOWHERE) is 
  18920.     POPPED_TOKEN : PD.PARSESTACKELEMENT;  --| The token popped off stack 
  18921.   begin
  18922.     if (WHERE = TO_NOWHERE) then 
  18923.       TOKEN_STACK_PKG.POP(IDENTIFIER_STACK); 
  18924.     else 
  18925.       TOKEN_STACK_PKG.POP(IDENTIFIER_STACK, POPPED_TOKEN); 
  18926.       if MATCH_S(CREATE(POPPED_TOKEN.LEXED_TOKEN.TEXT.ALL),SD_PREFIX) = 1 then
  18927.         TEXT_IO.PUT(SID.INSTRUMENTED_FILE," " & 
  18928.            POPPED_TOKEN.LEXED_TOKEN.TEXT.ALL);
  18929.       else
  18930.         PUT(POPPED_TOKEN);
  18931.       end if;
  18932.     end if; 
  18933.  
  18934.     -- In case this was a subprogram declaration, then discard the
  18935.     -- parameter list that was built.
  18936.     DISCARD_LIST(PARAM_LIST); 
  18937.     SAVE_EXPANDED_NAME := FALSE;
  18938.   end POP_IDENTIFIER; 
  18939.  
  18940.   -----------------------------------------------------------------
  18941.  
  18942.   procedure PUSH_IDENTIFIER is 
  18943.   begin
  18944.  
  18945.     -- set source line and column to 0 so that new column and line may
  18946.     -- be assigned when the pushed token is output as a closing designator
  18947.     -- or identifier.
  18948.     SAVED_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 0; 
  18949.     SAVED_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 0; 
  18950.     CURRENT_SCOPE_SIMPLE_NAME := CREATE(CT.TOKEN_TEXT(SAVED_TOKEN));
  18951.     TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, SAVED_TOKEN); 
  18952.   end PUSH_IDENTIFIER; 
  18953.  
  18954.   -----------------------------------------------------------------
  18955.  
  18956.   procedure PUSH_EMPTY_TOKEN is 
  18957.   begin
  18958.     TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, EMPTY_TOKEN); 
  18959.   end PUSH_EMPTY_TOKEN; 
  18960.  
  18961.   -----------------------------------------------------------------
  18962.  
  18963.  
  18964.   -----------------------------------------------------------------
  18965.   -- Local subprogram bodies for pretty printing
  18966.   -----------------------------------------------------------------
  18967.  
  18968.   procedure PRINT_TOKEN(NEXT_TOKEN : in out PD.PARSESTACKELEMENT) is 
  18969.  
  18970.     TOKEN_LENGTH : NATURAL := 0; 
  18971.     BLANK_LINES  : INTEGER := 0; 
  18972.  
  18973.   begin
  18974.  
  18975.     -- give line and column position to tokens being inserted that weren't
  18976.     -- in the source.
  18977.     if NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE = 0 then 
  18978.       NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 
  18979.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE; 
  18980.       NEXT_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 
  18981.         PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN; 
  18982.     end if; 
  18983.  
  18984.     -- print out any blank lines that appeared in source between the
  18985.     -- previous token and this one.
  18986.     BLANK_LINES := NEXT_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 
  18987.                    PREVIOUS_TOKEN.LEXED_TOKEN.SRCPOS_LINE - 1; 
  18988.  
  18989.     if BLANK_LINES > 0 then
  18990.       -- print extra new line if not at beginning of line, so blank line
  18991.       -- will be printed rather than just a new line
  18992.       if not BEGINNING_OF_LINE then 
  18993.         PRINT_NEW_LINE; 
  18994.       end if; 
  18995.       TEXT_IO.NEW_LINE(SID.LISTING_FILE, TEXT_IO.COUNT(BLANK_LINES)); 
  18996.     end if;
  18997.  
  18998.     TOKEN_LENGTH := CT.SPACED_TOKEN(NEXT_TOKEN, PREVIOUS_TOKEN,
  18999.         BEGINNING_OF_LINE)'LENGTH; 
  19000.  
  19001.     -- If adding this token will make the line longer than the
  19002.     -- page width then go to the next line and indent. 
  19003.     if (CURRENT_COLUMN + TOKEN_LENGTH - 1) > SP.PAGE_WIDTH then 
  19004.       PRINT_NEW_LINE; 
  19005.       TEMPORARY_INDENT := SP.INDENTATION_LEVEL; 
  19006.       CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  19007.     end if; 
  19008.  
  19009.     -- output spaces if at the beginning of the line to get to the current
  19010.     -- indentation level.
  19011.     if BEGINNING_OF_LINE then 
  19012.       TEXT_IO.PUT(SID.LISTING_FILE, 
  19013.              CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING); 
  19014.       STRING_IO.PUT(CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING);
  19015.       CREATE_BREAKPOINT.BREAKPOINT_NUMBER_FOR_PRINTING := "      "; 
  19016.       SPACE(SID.LISTING_FILE, CURRENT_COLUMN - 1); 
  19017.       SPACE(CURRENT_COLUMN - 1);
  19018.       if OUTPUT_SOURCE then 
  19019.         SPACE(SID.INSTRUMENTED_FILE, CURRENT_COLUMN - 1); 
  19020.       end if; 
  19021.     end if; 
  19022.  
  19023.     -- Output token
  19024.     declare
  19025.       PRINT_TOKEN : constant string := 
  19026.         CT.SPACED_TOKEN(NEXT_TOKEN,PREVIOUS_TOKEN,BEGINNING_OF_LINE);
  19027.     begin
  19028.       TEXT_IO.PUT(SID.LISTING_FILE, PRINT_TOKEN); 
  19029.       STRING_IO.PUT(PRINT_TOKEN);
  19030.       if OUTPUT_SOURCE then 
  19031.         TEXT_IO.PUT(SID.INSTRUMENTED_FILE, PRINT_TOKEN); 
  19032.       end if; 
  19033.     end;
  19034.  
  19035.     BEGINNING_OF_LINE := FALSE; 
  19036.  
  19037.     -- if the token was too big to fit even on the new line allocated it,
  19038.     -- set the current_column to the next line
  19039.     if TOKEN_LENGTH > SP.PAGE_WIDTH - CURRENT_INDENT then 
  19040.       PRINT_NEW_LINE; 
  19041.       TEMPORARY_INDENT := SP.INDENTATION_LEVEL; 
  19042.       CURRENT_COLUMN := CURRENT_INDENT + TEMPORARY_INDENT + 1; 
  19043.     else 
  19044.       CURRENT_COLUMN := CURRENT_COLUMN + TOKEN_LENGTH; 
  19045.     end if; 
  19046.  
  19047.     if NEXT_TOKEN.GRAM_SYM_VAL /= PT.EMPTY_TOKENVALUE then 
  19048.       PREVIOUS_TOKEN := NEXT_TOKEN; 
  19049.     end if; 
  19050.   end PRINT_TOKEN; 
  19051.  
  19052.   -----------------------------------------------------------------
  19053.  
  19054.  procedure PRINT_NEW_LINE is 
  19055.   begin
  19056.     TEMPORARY_INDENT := 0; 
  19057.     CURRENT_COLUMN := CURRENT_INDENT + 1; 
  19058.     if OUTPUT_SOURCE then 
  19059.       TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE); 
  19060.     end if; 
  19061.     TEXT_IO.NEW_LINE(SID.LISTING_FILE); 
  19062.     CURRENT_LINE_NUMBER := CURRENT_LINE_NUMBER + 1;
  19063.     STRING_IO.NEW_LINE;
  19064.     BEGINNING_OF_LINE := TRUE; 
  19065.   end PRINT_NEW_LINE; 
  19066.  
  19067.   -----------------------------------------------------------------
  19068.  
  19069.   procedure PROCESS_REQUESTS is 
  19070.   begin
  19071.     for I in 1 .. REQUESTS.INCREASES loop
  19072.       if CURRENT_INDENT + SP.INDENTATION_LEVEL < SP.RH_MARGIN then 
  19073.         CURRENT_INDENT := CURRENT_INDENT + SP.INDENTATION_LEVEL; 
  19074.       else 
  19075.         UNPERFORMED_INDENTS := UNPERFORMED_INDENTS + 1; 
  19076.       end if; 
  19077.     end loop; 
  19078.     REQUESTS.INCREASES := 0; 
  19079.  
  19080.     for I in 1 .. REQUESTS.DECREASES loop
  19081.       if UNPERFORMED_INDENTS = 0 then 
  19082.         CURRENT_INDENT := CURRENT_INDENT - SP.INDENTATION_LEVEL; 
  19083.       else 
  19084.         UNPERFORMED_INDENTS := UNPERFORMED_INDENTS - 1; 
  19085.       end if; 
  19086.     end loop; 
  19087.     REQUESTS.DECREASES := 0; 
  19088.  
  19089.     if REQUESTS.CHANGES > 0 then 
  19090.       PREVIOUS_INDENT := CURRENT_INDENT; 
  19091.       CURRENT_INDENT := CURRENT_CHANGE_COLUMN - 1; 
  19092.  
  19093.       -- Since new line does not always occur before change_indent,
  19094.       -- need to update current column info.
  19095.       TEMPORARY_INDENT := 0; 
  19096.       CURRENT_COLUMN := CURRENT_INDENT + 1; 
  19097.     end if; 
  19098.     REQUESTS.CHANGES := 0; 
  19099.  
  19100.     if REQUESTS.RESUMES > 0 then 
  19101.       CURRENT_INDENT := PREVIOUS_INDENT; 
  19102.     end if; 
  19103.     REQUESTS.RESUMES := 0; 
  19104.   end PROCESS_REQUESTS; 
  19105.  
  19106.   -----------------------------------------------------------------
  19107.   --  External Procedures for Source Instrumenter
  19108.   -----------------------------------------------------------------
  19109.  
  19110.  
  19111.   -----------------------------------------------------------------
  19112.   procedure USE_PACKAGE_NAME is 
  19113.  
  19114.   --| Effects
  19115.   --|
  19116.   --| The current expanded name is the package name in the
  19117.   --| use clause.
  19118.  
  19119.   begin
  19120.     SAVE_EXPANDED_NAME := FALSE; 
  19121.     STRING_LISTS.ATTACH(USE_LIST, MAKE_PERSISTENT(EXPANDED_NAME));
  19122.   end USE_PACKAGE_NAME; 
  19123.  
  19124.   -----------------------------------------------------------------
  19125.  
  19126.   procedure WITH_LIBRARY_UNIT is 
  19127.  
  19128.   --| Effects
  19129.   --|
  19130.   --| If the library unit is instrumented 
  19131.   --| then add the name to the "with_list".  Its tracing package
  19132.   --| will have to be added to the context clause in the instrumented
  19133.   --| source.
  19134.  
  19135.   begin
  19136.     if SDBF.PACKAGE_FILES_EXIST(SAVED_TOKEN.LEXED_TOKEN.TEXT.all, 
  19137.                                 PUBLIC_FILES) then 
  19138.       STRING_LISTS.ATTACH(WITH_LIST, 
  19139.         UPPER(CREATE(SAVED_TOKEN.LEXED_TOKEN.TEXT.all))); 
  19140.     end if; 
  19141.   end WITH_LIBRARY_UNIT; 
  19142.  
  19143.   ------------------------------------------------------------------
  19144.  
  19145.   procedure START_SAVING_EXPANDED_NAME is 
  19146.  
  19147.   --| Effects
  19148.   --|
  19149.   --| Start saving tokens for an expanded name.
  19150.  
  19151.   begin
  19152.     FLUSH(EXPANDED_NAME); 
  19153.     SAVE_EXPANDED_NAME := TRUE; 
  19154.   end START_SAVING_EXPANDED_NAME; 
  19155.  
  19156.   -----------------------------------------------------------------
  19157.  
  19158.   procedure SAVE_SEPARATE_NAME is 
  19159.  
  19160.   --| Effects
  19161.   --|
  19162.   --| The current expanded name is the name of the parent unit.
  19163.   --| Use it to set the Current_Scope and turn off the
  19164.   --| "SAVE_EXPANDED_NAME" flag.
  19165.  
  19166.   begin
  19167.     SAVE_EXPANDED_NAME := FALSE; 
  19168.     SEPARATE_UNIT := TRUE; 
  19169.  
  19170.     FLUSH(PARENT_UNIT_NAME);
  19171.     PARENT_UNIT_NAME := MAKE_PERSISTENT(EXPANDED_NAME);
  19172.  
  19173.     CURRENT_SCOPE := 
  19174.       (UPPER(SAVED_TOKEN.LEXED_TOKEN.TEXT.all),
  19175.        MAKE_PERSISTENT(EXPANDED_NAME), 
  19176.        MAKE_PERSISTENT(EXPANDED_NAME), 
  19177.        A_BLOCK, 
  19178.        0,
  19179.        MAKE_TRACING_PREFIX_FOR_SEPARATE(EXPANDED_NAME),
  19180.        FALSE,
  19181.        FALSE);  
  19182.   end SAVE_SEPARATE_NAME; 
  19183.  
  19184.   -----------------------------------------------------------------
  19185.  
  19186.   procedure SAVE_GENERIC_NAME is 
  19187.  
  19188.   begin
  19189.     SAVE_EXPANDED_NAME := FALSE; 
  19190.   end SAVE_GENERIC_NAME; 
  19191.  
  19192.   ------------------------------------------------------------------
  19193.  
  19194.   procedure SUBPROGRAM_TYPE(INTYPE : in STRING) is 
  19195.  
  19196.   --|  Effects
  19197.   --|  
  19198.   --|  Saves the type of the current subprogram.  At increment scope
  19199.   --|  if the current unit is a subprogram then subprogram_unit_type
  19200.   --|  will be used to determine what kind of subprogram it is.
  19201.  
  19202.   begin
  19203.     if INTYPE = "procedure" then 
  19204.       SUBPROGRAM_UNIT_TYPE := PROCEDURE_TYPE; 
  19205.     else 
  19206.       SUBPROGRAM_UNIT_TYPE := FUNCTION_TYPE; 
  19207.       SAVE_EXPANDED_NAME := FALSE;
  19208.     end if; 
  19209.   end SUBPROGRAM_TYPE; 
  19210.  
  19211.   ------------------------------------------------------------------
  19212.  
  19213.   procedure START_BEGIN_END_BLOCK is 
  19214.  
  19215.   --|  Effects
  19216.   --|  
  19217.   --|  If this is a package body then add the call to UNIT_INFORMATION (we
  19218.   --|  are in the package body begin-end).  If the current unit is not
  19219.   --|  a block then output an entering unit call and a breakpoint.
  19220.  
  19221.   begin
  19222.  
  19223.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  19224.       if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  19225.          CURRENT_NESTING_LEVEL = 1 then 
  19226.         PRINT_COMMENTS(COMMENT_BUFFER); 
  19227.         CREATE_BREAKPOINT.CREATE_UNIT_INFORMATION;
  19228.       end if; 
  19229.       CREATE_BREAKPOINT.CREATE_ENTERING_UNIT; 
  19230.     end if; 
  19231.   end START_BEGIN_END_BLOCK; 
  19232.  
  19233.   ------------------------------------------------------------------
  19234.  
  19235.   procedure END_BLOCK_SEQUENCE_OF_STATEMENTS is 
  19236.  
  19237.   --|  Effects
  19238.   --|  
  19239.   --|  If we are not in a block then output an exiting unit call and
  19240.   --|  a breakpoint.
  19241.  
  19242.   begin
  19243.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  19244.       PRINT_COMMENTS(COMMENT_BUFFER);
  19245.       CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_LIST); 
  19246.       CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19247.     end if; 
  19248.   end END_BLOCK_SEQUENCE_OF_STATEMENTS; 
  19249.  
  19250.   -----------------------------------------------------------------
  19251.  
  19252.   procedure START_DO_SEQUENCE_OF_STATEMENTS is
  19253.   begin
  19254.     if not NAME_LISTS.ISEMPTY(PARAM_LIST) then
  19255.       CURRENT_SCOPE_STRING_NAME := CURRENT_SCOPE_SIMPLE_NAME;
  19256.       CURRENT_SCOPE_QUALIFIED_NAME := 
  19257.         CURRENT_SCOPE.QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME;
  19258.       ENTER_SCOPE(ACCEPT_STATEMENT);
  19259.       TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE);
  19260.       TEXT_IO.PUT(SID.INSTRUMENTED_FILE, "DECLARE");
  19261.       SDGU.GENERATE_DUMMY_LOCALS(PARAM_LIST);
  19262.       SDBF.START_NEW_SECTION;
  19263.       SDGU.GENERATE_FINDVAR_BODY(PARAM_LIST, PACKAGE_LIST, WITH_LIST, USE_LIST);
  19264.       SDBF.SAVE_BUFFER_FILE(SID.INSTRUMENTED_FILE);
  19265.       SDBF.RELEASE_SECTION;
  19266.       SDGU.GENERATE_LOCAL_BREAK(CURRENT_SCOPE.SCOPE_NUMBER, FALSE);
  19267.       DISCARD_LIST(PARAM_LIST);
  19268.       TEXT_IO.PUT(SID.INSTRUMENTED_FILE, "BEGIN");
  19269.     end if;
  19270.   end START_DO_SEQUENCE_OF_STATEMENTS; 
  19271.  
  19272.   -----------------------------------------------------------------
  19273.  
  19274.   procedure END_DO_SEQUENCE_OF_STATEMENTS is
  19275.   begin
  19276.     if EQUAL(CURRENT_SCOPE.SCOPE_NAME,
  19277.              TOKEN_STACK_PKG.TOP(IDENTIFIER_STACK).LEXED_TOKEN.TEXT.ALL) then
  19278.       TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE);
  19279.       CURRENT_LINE_NUMBER := CURRENT_LINE_NUMBER + 1;
  19280.       CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_LIST);
  19281.       CURRENT_LINE_NUMBER := CURRENT_LINE_NUMBER - 1;
  19282.       TEXT_IO.PUT(SID.INSTRUMENTED_FILE, "END;");
  19283.       EXIT_SCOPE;
  19284.     end if;
  19285.   end END_DO_SEQUENCE_OF_STATEMENTS; 
  19286.  
  19287.   -----------------------------------------------------------------
  19288.  
  19289.   procedure END_BLOCK_STATEMENT is
  19290.  
  19291.   --|  Effects
  19292.   --|  
  19293.   --|  Pop the scope for the block.
  19294.  
  19295.   begin
  19296.     EXIT_SCOPE;
  19297.   end END_BLOCK_STATEMENT;
  19298.  
  19299.   -----------------------------------------------------------------
  19300.  
  19301.   procedure ADD_BREAKPOINT is 
  19302.  
  19303.   --|  Effects
  19304.   --|  
  19305.   --|  This procedure is called before every statement within a begin-end.
  19306.  
  19307.   begin
  19308.     PRINT_COMMENTS(COMMENT_BUFFER);
  19309.     CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_LIST); 
  19310.   end ADD_BREAKPOINT; 
  19311.  
  19312.   -----------------------------------------------------------------
  19313.  
  19314.   procedure START_RETURN_STATEMENT is
  19315.  
  19316.    --  Current statement is a return statement.  Add a breakpoint and
  19317.    --  an exiting unit.
  19318.  
  19319.   begin
  19320.     PRINT_COMMENTS(COMMENT_BUFFER);
  19321.     CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_LIST); 
  19322.     CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19323.   end START_RETURN_STATEMENT;
  19324.  
  19325.   ------------------------------------------------------------------
  19326.  
  19327.   procedure START_BLOCK (HAS_NAME: in BOOLEAN) is 
  19328.  
  19329.   --|  Effects
  19330.   --|  
  19331.   --|  Make the block the current scope.  If the block had no name then
  19332.   --|  make up a unique name for it.
  19333.  
  19334.     function INTEGER_STRING(NUM : INTEGER) return STRING is
  19335.     begin
  19336.       return INTEGER'IMAGE(NUM)(2..INTEGER'IMAGE(NUM)'LENGTH);
  19337.     end INTEGER_STRING;
  19338.  
  19339.   begin
  19340.     if not HAS_NAME then 
  19341.       -- The block does not have a name, so make one for it.
  19342.       CURRENT_BLOCK_NUMBER := CURRENT_BLOCK_NUMBER + 1; 
  19343.       CURRENT_SCOPE_SIMPLE_NAME := 
  19344.         CREATE(SD_PREFIX & "BLOCK" & INTEGER_STRING(CURRENT_BLOCK_NUMBER));
  19345.  
  19346.       IDENTIFIER_TOKEN.LEXED_TOKEN.TEXT := 
  19347.         new STRING'(VALUE(CURRENT_SCOPE_SIMPLE_NAME));
  19348.       IDENTIFIER_TOKEN.LEXED_TOKEN.SRCPOS_LINE := 0; 
  19349.       IDENTIFIER_TOKEN.LEXED_TOKEN.SRCPOS_COLUMN := 0; 
  19350.       TOKEN_STACK_PKG.PUSH(IDENTIFIER_STACK, IDENTIFIER_TOKEN); 
  19351.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE,
  19352.         IDENTIFIER_TOKEN.LEXED_TOKEN.TEXT.ALL & ":");
  19353.     end if;
  19354.     CURRENT_SCOPE_STRING_NAME := CURRENT_SCOPE_SIMPLE_NAME;
  19355.     CURRENT_SCOPE_QUALIFIED_NAME := 
  19356.       CURRENT_SCOPE_QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  19357.     ENTER_SCOPE(A_BLOCK);
  19358.   end START_BLOCK; 
  19359.  
  19360.   -----------------------------------------------------------------
  19361.  
  19362.   procedure SAVE_LOOP_PARAMETER is 
  19363.     TEMP : STRING_TYPE;
  19364.   begin
  19365.     STRING_PKG.MARK;
  19366.     TEMP := CREATE(TOKEN_STACK_PKG.TOP(IDENTIFIER_STACK).LEXED_TOKEN.TEXT.ALL);
  19367.     if not IS_EMPTY(TEMP) THEN
  19368.       TEMP := TEMP & ".";
  19369.     end if;
  19370.     STRING_LISTS.ATTACH
  19371.       (MAKE_PERSISTENT(TEMP & SAVED_TOKEN.LEXED_TOKEN.TEXT.ALL), LOOP_LIST); 
  19372.     STRING_PKG.RELEASE;
  19373.   end SAVE_LOOP_PARAMETER; 
  19374.  
  19375.   ------------------------------------------------------------------
  19376.  
  19377.   procedure END_FOR_LOOP is 
  19378.     TEMP : STRING_TYPE := STRING_LISTS.FIRSTVALUE(LOOP_LIST);
  19379.   begin
  19380.     FLUSH(TEMP);
  19381.     STRING_LISTS.DELETEHEAD(LOOP_LIST);
  19382.   end END_FOR_LOOP; 
  19383.  
  19384.   -----------------------------------------------------------------
  19385.  
  19386.  
  19387.   procedure ADD_PACKAGE_BODY_BEGIN is 
  19388.  
  19389.   --|  Effects
  19390.   --|  
  19391.   --|  If a package body that is a compilation unit does not have a
  19392.   --|  begin end block then add one that makes a call to unit
  19393.   --|  information.
  19394.  
  19395.   begin
  19396.     if CURRENT_NESTING_LEVEL = 1 then 
  19397.       PRINT_COMMENTS(COMMENT_BUFFER); 
  19398.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "begin"); 
  19399.       CREATE_BREAKPOINT.CREATE_UNIT_INFORMATION;
  19400.     end if; 
  19401.   end ADD_PACKAGE_BODY_BEGIN; 
  19402.  
  19403.   ------------------------------------------------------------------
  19404.  
  19405.   procedure START_EXCEPTION_BRANCH is 
  19406.  
  19407.   --|  Effects
  19408.   --|  
  19409.   --|  We are starting an exception branch in the source.  We must nest this 
  19410.   --|  in a begin-end block so that we can handle any exceptions raised
  19411.   --|  during execution of the exception handler.  
  19412.  
  19413.   begin
  19414.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then
  19415.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  19416.               CURRENT_NESTING_LEVEL > 1) then 
  19417.         TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE);
  19418.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "begin"); 
  19419.         TEXT_IO.PUT(SID.INSTRUMENTED_FILE,
  19420.          "if SD_RTM'CALLABLE then ");
  19421.       end if; 
  19422.     end if;
  19423.   end START_EXCEPTION_BRANCH; 
  19424.  
  19425.   ------------------------------------------------------------------
  19426.  
  19427.   procedure END_EXCEPTION_SEQUENCE_OF_STATEMENTS is 
  19428.  
  19429.   --|  Effects
  19430.   --|  
  19431.   --|  The block that contains the exception handler must now be finished.
  19432.   --|  Add an others hanler for the block that calls exiting unit and then
  19433.   --|  re-raises the exception.  This will inform the RTM that the unit
  19434.   --|  has exited, and then by re-raising the exception will allow the
  19435.   --|  user's code to execute normally.
  19436.  
  19437.   begin
  19438.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then
  19439.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  19440.               CURRENT_NESTING_LEVEL > 1) then 
  19441.         PRINT_COMMENTS(COMMENT_BUFFER);
  19442.         CREATE_BREAKPOINT.CREATE_BREAKPOINT(LOOP_LIST); 
  19443.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19444.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE,"end if;");
  19445.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "exception"); 
  19446.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "  when others =>"); 
  19447.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19448.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "raise;"); 
  19449.         TEXT_IO.PUT(SID.INSTRUMENTED_FILE, "end;"); 
  19450.       end if; 
  19451.     end if;
  19452.   end END_EXCEPTION_SEQUENCE_OF_STATEMENTS; 
  19453.  
  19454.   ------------------------------------------------------------------
  19455.  
  19456.   procedure ADD_OTHERS_HANDLER is 
  19457.  
  19458.   --|  The source did not have an others handler so add one.  The others
  19459.   --|  handler that we add will call exiting unit and then re-raise the
  19460.   --|  exception.
  19461.  
  19462.   begin
  19463.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  19464.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  19465.               CURRENT_NESTING_LEVEL > 1) then 
  19466.         TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE); 
  19467.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "  when others =>"); 
  19468.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE,
  19469.          "    if SD_RTM'CALLABLE then ");
  19470.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19471.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "      raise;"); 
  19472.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "  end if;");
  19473.       end if; 
  19474.     end if; 
  19475.   end ADD_OTHERS_HANDLER; 
  19476.  
  19477.   ------------------------------------------------------------------
  19478.  
  19479.   procedure ADD_EXCEPTION_HANDLER is 
  19480.  
  19481.   --|  Effects
  19482.   --|  
  19483.   --|  The source had no exception handler so add an exception handler
  19484.   --|  with an others branch.  In the others branch call exiting
  19485.   --|  unit and then re-raise the exception.
  19486.  
  19487.   begin
  19488.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then 
  19489.       if not (CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and 
  19490.               CURRENT_NESTING_LEVEL > 1) then 
  19491.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "exception"); 
  19492.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "  when others =>"); 
  19493.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE,
  19494.          "    if SD_RTM'CALLABLE then ");
  19495.         CREATE_BREAKPOINT.CREATE_EXITING_UNIT; 
  19496.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "      raise;"); 
  19497.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "    end if;");
  19498.       end if; 
  19499.     end if; 
  19500.   end ADD_EXCEPTION_HANDLER; 
  19501.  
  19502.   -----------------------------------------------------------------
  19503.  
  19504.   procedure END_COMPILATION_UNIT is 
  19505.  
  19506.   begin
  19507.  
  19508.     -- if the compilation unit was a subprogram declaration, then
  19509.     -- print any buffered tokens, and discard the with_list if
  19510.     -- there is one.
  19511.     if BUFFERING_TOKENS then 
  19512.       PRINT_BUFFERED_TOKENS; 
  19513.     end if; 
  19514.  
  19515.     PROCESS_REQUESTS; 
  19516.  
  19517.  
  19518.     -- The current version of the file which maps package names to
  19519.     -- type tracing information files might have changed if there
  19520.     -- were any package specs in the program, so update it.
  19521.     SDBF.SAVE_EXTERNAL_FILE; 
  19522.  
  19523.     -- End the current compilation unit with a new line, and restart
  19524.     -- buffering in case there are more compilation units to come.
  19525.     PRINT_NEW_LINE; 
  19526.  
  19527.     if CURRENT_NESTING_LEVEL = 0 then
  19528.       STRING_IO.CLOSE;
  19529.     end if;
  19530.  
  19531.     STRING_LISTS.DESTROY(WITH_LIST); 
  19532.     FLUSH(PARENT_UNIT_NAME);
  19533.     FLUSH(EXPANDED_NAME);
  19534.     FLUSH(CURRENT_TYPE_IDENTIFIER);
  19535.  
  19536.     OUTPUT_SOURCE := TRUE; 
  19537.     BUFFERING_TOKENS := TRUE; 
  19538.     TOKEN_LISTS.DESTROY(BUFFERED_TOKENS);
  19539.     BUFFERED_TOKENS := TOKEN_LISTS.CREATE; 
  19540.     CURRENT_LINE_NUMBER := 1;
  19541.     GENERIC_STARTED := FALSE;
  19542.     NUMBER_OF_PROGRAM_UNITS := 0;
  19543.  
  19544.     -- Source_Instrument does a mark before instrumenting the current
  19545.     -- file, and a release afterward.
  19546.     STRING_PKG.RELEASE;
  19547.     STRING_PKG.MARK;
  19548.   end END_COMPILATION_UNIT; 
  19549.  
  19550.   ----------------------------------------------------------------------------
  19551.  
  19552.   procedure INCREMENT_SCOPE(TYPE_OF_SCOPE : in SCOPE_TYPE) is 
  19553.  
  19554.     TYPE_OF_UNIT       : PROGRAM_UNIT_TYPE; 
  19555.  
  19556.   begin
  19557.  
  19558.     case TYPE_OF_SCOPE is 
  19559.       when PACKAGE_SPECIFICATION | PACKAGE_BODY => 
  19560.         TYPE_OF_UNIT := PACKAGE_TYPE; 
  19561.       when TASK_BODY => 
  19562.         TYPE_OF_UNIT := TASK_TYPE; 
  19563.       when SUBPROGRAM_BODY => 
  19564.         TYPE_OF_UNIT := SUBPROGRAM_UNIT_TYPE; 
  19565.       when others => 
  19566.         null; 
  19567.     end case; 
  19568.    
  19569.     if FETCH(CURRENT_SCOPE_SIMPLE_NAME,1) = '"' then
  19570.       CURRENT_SCOPE_STRING_NAME := """" & CURRENT_SCOPE_SIMPLE_NAME & """";
  19571.     else
  19572.       CURRENT_SCOPE_STRING_NAME := CURRENT_SCOPE_SIMPLE_NAME;
  19573.     end if;
  19574.  
  19575.     if CURRENT_NESTING_LEVEL = 0 then 
  19576.       if not SEPARATE_UNIT then 
  19577.         CURRENT_SCOPE_QUALIFIED_NAME := CURRENT_SCOPE_SIMPLE_NAME; 
  19578.       else 
  19579.         CURRENT_SCOPE_QUALIFIED_NAME := 
  19580.           PARENT_UNIT_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  19581.       end if; 
  19582.  
  19583.       STRING_IO.OPEN(
  19584.         VALUE(SP.CURRENT_PROGRAM_LIBRARY) &
  19585.         CATALOG_PKG.CATALOG_FILE(VALUE(CURRENT_SCOPE_QUALIFIED_NAME)) & 
  19586.         SP.CATALOG_FILENAME_EXTENSION);
  19587.  
  19588.     else  -- Current_Nesting_Level /= 0 
  19589.       CURRENT_SCOPE_QUALIFIED_NAME := 
  19590.         CURRENT_SCOPE.QUALIFIED_NAME & "." & CURRENT_SCOPE_SIMPLE_NAME; 
  19591.     end if; 
  19592.  
  19593.     ENTER_SCOPE(TYPE_OF_SCOPE);
  19594.  
  19595.     if TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  19596.  
  19597.       -- Delete any old type tracing files. New ones will be made if
  19598.       -- type tracing is on.
  19599.       SDBF.DELETE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  19600.                                 ALL_FILES); 
  19601.  
  19602.       if CURRENT_NESTING_LEVEL = 1 and not GENERIC_STARTED then 
  19603.         -- ask user if he wants to recompile this package spec --
  19604.         OUTPUT_SOURCE := ASK_USER_ABOUT_PACKAGE; 
  19605.       end if; 
  19606.  
  19607.       INITIALIZE_TRACE_PACKAGES; 
  19608.     end if;     -- type of scope = package spec
  19609.  
  19610.     if CURRENT_NESTING_LEVEL = 1 then 
  19611.       CREATE_SUBUNIT := (TYPE_OF_SCOPE = SUBPROGRAM_BODY); 
  19612.       CURRENT_COMPILATION_UNIT := CURRENT_SCOPE_QUALIFIED_NAME;
  19613.       if TYPE_OF_SCOPE = SUBPROGRAM_BODY or TYPE_OF_SCOPE = TASK_BODY then
  19614.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "package SD_" &
  19615.           CT.CONVERT_PERIODS_TO_UNDERSCORES(VALUE(CURRENT_COMPILATION_UNIT))
  19616.           & " is end;");
  19617.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE,"with SD_" &
  19618.           CT.CONVERT_PERIODS_TO_UNDERSCORES(VALUE(CURRENT_COMPILATION_UNIT))
  19619.           & ";");          
  19620.       end if;
  19621.       if TYPE_OF_SCOPE = SUBPROGRAM_BODY or 
  19622.          TYPE_OF_SCOPE = PACKAGE_BODY or
  19623.          TYPE_OF_SCOPE = TASK_BODY then 
  19624.         ADD_WITHS_TO_BODY; 
  19625.       end if; 
  19626.       CREATE_BREAKPOINT.NEW_COMPILATION_UNIT(CURRENT_SCOPE_QUALIFIED_NAME, 
  19627.                                              TYPE_OF_UNIT); 
  19628.     elsif TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION then 
  19629.       CREATE_BREAKPOINT.START_PROGRAM_UNIT(CURRENT_SCOPE.QUALIFIED_NAME_STRING, 
  19630.                                            TYPE_OF_UNIT); 
  19631.     end if; 
  19632.  
  19633.     SAVE_EXPANDED_NAME := FALSE;
  19634.     PRINT_BUFFERED_TOKENS; 
  19635.  
  19636.     GENERIC_STARTED := FALSE;
  19637.     SEPARATE_UNIT := FALSE; 
  19638.   end INCREMENT_SCOPE; 
  19639.  
  19640.   ---------------------------------------------------------------
  19641.  
  19642.   procedure DECREMENT_SCOPE is 
  19643.  
  19644.   begin
  19645.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  19646.       CLOSE_TRACE_PACKAGES; 
  19647.     end if; 
  19648.  
  19649.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_SPECIFICATION or 
  19650.        CURRENT_NESTING_LEVEL = 1 then 
  19651.       CREATE_BREAKPOINT.END_PROGRAM_UNIT; 
  19652.     end if; 
  19653.  
  19654.     EXIT_SCOPE;
  19655.   end DECREMENT_SCOPE; 
  19656.  
  19657.   -------------------------------------------------------------------
  19658.  
  19659.   procedure START_DECLARATIVE_PART is 
  19660.  
  19661.   --|Effects
  19662.   --|
  19663.   --|If we are in a subprogram that is a compilation unit, then define
  19664.   --|a unique call_unit_info for that unit.  For all units define a
  19665.   --|task number used in calls to the RTM. 
  19666.   --|Stack the outer scope's tracing information, re-initialize
  19667.   --|everything for the current scope, and generate the putvar procedure 
  19668.   --|declaration.
  19669.  
  19670.   begin
  19671.  
  19672.     if CURRENT_NESTING_LEVEL = 1 then 
  19673.       TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE); 
  19674.       SDSB.WRITE_INST_SOURCE(
  19675.         PREFIX & "CURRENT_COMPILATION_UNIT: constant String := " &
  19676.         """" & VALUE(CURRENT_COMPILATION_UNIT) & """;");
  19677.       SDSB.CLEAR_SOURCE_BUFFER;
  19678.     end if;
  19679.       
  19680.     if CURRENT_SCOPE.TYPE_OF_SCOPE = A_BLOCK then
  19681.      -- the block has a declarative part so change the tracing prefix to
  19682.      -- the block name
  19683.       CURRENT_SCOPE.TRACING_PREFIX := MAKE_TRACING_PREFIX(CURRENT_OUTER_SCOPE,
  19684.          CURRENT_SCOPE.SCOPE_NAME, SUBPROGRAM_BODY);
  19685.     end if;
  19686.  
  19687.     if CURRENT_SCOPE.TYPE_OF_SCOPE = TASK_BODY then 
  19688.       TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE); 
  19689.       TEXT_IO.PUT(SID.INSTRUMENTED_FILE, 
  19690.         PREFIX & "TASK_NUMBER: NATURAL := 1;"); 
  19691.     end if;
  19692.  
  19693.     LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  19694.     STRING_STACK_PKG.PUSH(PACKAGE_LIST_STACK, PACKAGE_LIST); 
  19695.     STRING_STACK_PKG.PUSH(USE_LIST_STACK, STRING_LISTS.COPY(USE_LIST));
  19696.  
  19697.     VISIBLE_LIST := NAME_LISTS.CREATE; 
  19698.     PACKAGE_LIST := STRING_LISTS.CREATE; 
  19699.     REC_FIELD_LIST := RECORD_LISTS.CREATE;
  19700.     CURRENT_RECORD_FIELD.CHOICE_TEXT := STRING_LISTS.CREATE;
  19701.     CURRENT_RECORD_FIELD.REC_FIELD := STRING_LISTS.CREATE;
  19702.     DISCRIM_LIST := STRING_LISTS.CREATE;
  19703.  
  19704.     if not NAME_LISTS.ISEMPTY(PARAM_LIST) then 
  19705.       SDGU.GENERATE_DUMMY_LOCALS(PARAM_LIST);
  19706.       NAME_LISTS.ATTACH(VISIBLE_LIST, NAME_LISTS.COPY(PARAM_LIST)); 
  19707.       NAME_LISTS.DESTROY(PARAM_LIST); 
  19708.     end if; 
  19709.  
  19710.     SDGU.GENERATE_FINDVAR_SPEC;
  19711.  
  19712.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then 
  19713.       SDBF.COPY_PACKAGE_FILES(PRIVATE_SPEC, 
  19714.                               VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  19715.                               SID.INSTRUMENTED_FILE); 
  19716.     end if; 
  19717.     SDBF.START_NEW_SECTION; 
  19718.   end START_DECLARATIVE_PART; 
  19719.  
  19720.   ----------------------------------------------------------------
  19721.  
  19722.   procedure END_DECLARATIVE_PART is 
  19723.  
  19724.   --|Effects
  19725.   --|
  19726.   --|If this is the declarative part of a compilation unit that is a procedure
  19727.   --|then define the unique call_unit_information to be a subunit.  
  19728.   --|1) if it is a package body, then retieve
  19729.   --|the instrumenting information file for the private part of the 
  19730.   --|corresponding package spec. 2) Finish generating the tracing procedures.
  19731.   --|3) Copy the procedure bodies from the buffer file that were saved
  19732.   --|until the end of the later declarative part. 
  19733.  
  19734.     ITER        : STRING_LISTS.LISTITER; 
  19735.     NEXT_OBJECT : STRING_TYPE; 
  19736.   begin
  19737.  
  19738.     -- Finish the type tracing for this declarative part; the
  19739.     -- "begin ... end" part follows next.
  19740.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY then 
  19741.       SDBF.COPY_PACKAGE_FILES(PRIVATE_BODY, 
  19742.                               VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  19743.                               SID.INSTRUMENTED_FILE); 
  19744.     end if; 
  19745.  
  19746.     ITER := STRING_LISTS.MAKELISTITER(PACKAGE_LIST); 
  19747.     while STRING_LISTS.MORE(ITER) loop
  19748.       STRING_LISTS.NEXT(ITER, NEXT_OBJECT); 
  19749.       SDBF.COPY_PACKAGE_FILES(PUBLIC_BODY, 
  19750.                               VALUE(CURRENT_SCOPE.QUALIFIED_NAME & 
  19751.                                     "." & NEXT_OBJECT), 
  19752.                               SID.INSTRUMENTED_FILE); 
  19753.     end loop; 
  19754.  
  19755.     SDGU.GENERATE_FINDVAR_BODY(VISIBLE_LIST, PACKAGE_LIST, WITH_LIST, USE_LIST);
  19756.     SDBF.SAVE_BUFFER_FILE(SID.INSTRUMENTED_FILE); 
  19757.     SDBF.RELEASE_SECTION; 
  19758.     
  19759.     if CURRENT_SCOPE.TYPE_OF_SCOPE /= PACKAGE_BODY then
  19760.       if CURRENT_SCOPE.TYPE_OF_SCOPE /= A_BLOCK then
  19761.         NUMBER_OF_PROGRAM_UNITS := NUMBER_OF_PROGRAM_UNITS+ 1;  
  19762.         CURRENT_SCOPE.SCOPE_NUMBER := NUMBER_OF_PROGRAM_UNITS;
  19763.       end if;
  19764.       SDGU.GENERATE_LOCAL_BREAK(CURRENT_SCOPE.SCOPE_NUMBER,
  19765.                                 CURRENT_SCOPE.TYPE_OF_SCOPE = TASK_BODY);
  19766.     end if;
  19767.  
  19768.     STRING_LISTS.DESTROY(PACKAGE_LIST); 
  19769.     STRING_LISTS.DESTROY(USE_LIST); 
  19770.     DISCARD_LIST(VISIBLE_LIST);
  19771.  
  19772.     LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  19773.     STRING_STACK_PKG.POP(PACKAGE_LIST_STACK, PACKAGE_LIST); 
  19774.     STRING_STACK_PKG.POP(USE_LIST_STACK, USE_LIST);
  19775.   end END_DECLARATIVE_PART; 
  19776.  
  19777.   -----------------------------------------------------------------
  19778.   procedure ADD_IDENTIFIER_TO_LIST is 
  19779.  
  19780.   --| Effects
  19781.   --|
  19782.   --| Add the current identifier to "current_list". 
  19783.   --| The current identifier's name is in Saved_Token.
  19784.  
  19785.     CURRENT_NAME : NAME_RECORD; 
  19786.  
  19787.   begin
  19788.     CURRENT_NAME.OBJECT_NAME := 
  19789.       MAKE_PERSISTENT(UPPER(SAVED_TOKEN.LEXED_TOKEN.TEXT.all)); 
  19790.     NAME_LISTS.ATTACH(CURRENT_LIST, CURRENT_NAME); 
  19791.   end ADD_IDENTIFIER_TO_LIST; 
  19792.  
  19793.   -----------------------------------------------------------------
  19794.  
  19795.   procedure SET_IDENTIFIER_MODE(MODE : in IDENTIFIER_MODE) is 
  19796.  
  19797.   --| Effects
  19798.   --|
  19799.   --| Save the mode of the current identifier list.
  19800.  
  19801.   begin
  19802.     CURRENT_MODE := MODE; 
  19803.     if CURRENT_MODE = WRITE_ONLY then
  19804.        -- prepare to save the type_mark which will follow
  19805.        FLUSH(EXPANDED_NAME);
  19806.        SAVE_EXPANDED_NAME := TRUE;
  19807.     end if;
  19808.   end SET_IDENTIFIER_MODE; 
  19809.  
  19810.   -----------------------------------------------------------------
  19811.  
  19812.   procedure PROCESS_IDENTIFIER_LIST(LIST_TYPE : in IDENTIFIER_LIST_TYPE) is 
  19813.  
  19814.   --| Effects
  19815.   --|
  19816.   --| This is called at the end of the current identifier list.
  19817.   --| Update the mode and type for all identifiers in the list,
  19818.   --| and save the list for later processing, depending on the
  19819.   --| type of list this is.
  19820.  
  19821.     ITER        : NAME_LISTS.LISTITER; 
  19822.     NEXT_OBJECT : NAME_RECORD; 
  19823.  
  19824.   begin
  19825.  
  19826.     case LIST_TYPE is 
  19827.       when OBJECT_LIST | PARAMETER_LIST | DISCRIMINANT_LIST |
  19828.            RECORD_FIELD_LIST =>
  19829.  
  19830.         ITER := NAME_LISTS.MAKELISTITER(CURRENT_LIST); 
  19831.         while NAME_LISTS.MORE(ITER) loop
  19832.           NAME_LISTS.NEXT(ITER, NEXT_OBJECT); 
  19833.           case LIST_TYPE is 
  19834.  
  19835.             when OBJECT_LIST => 
  19836.               NEXT_OBJECT.OBJECT_MODE := CURRENT_MODE; 
  19837.               NEXT_OBJECT.OBJECT_TYPE := MAKE_PERSISTENT(EXPANDED_NAME);
  19838.               NAME_LISTS.ATTACH(VISIBLE_LIST, NEXT_OBJECT); 
  19839.               if not STRING_LISTS.ISEMPTY(ANON_ARRAY_TEXT) then
  19840.                 TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE);
  19841.                 SDGU.GENERATE_ANON_TYPE(ANON_ARRAY_TEXT);
  19842.                 CURRENT_TYPE_CLASS := ARRAY_TYPE;
  19843.                 NOT_INCOMPLETE_TYPE := TRUE;
  19844.                 END_TYPE_DECLARATION;
  19845.                 DISCARD_LIST(ANON_ARRAY_TEXT);
  19846.               end if;
  19847.  
  19848.  
  19849.             when PARAMETER_LIST => 
  19850.               NEXT_OBJECT.OBJECT_MODE := CURRENT_MODE; 
  19851.               NEXT_OBJECT.OBJECT_TYPE := MAKE_PERSISTENT(EXPANDED_NAME);
  19852.               NAME_LISTS.ATTACH(PARAM_LIST, NEXT_OBJECT); 
  19853.  
  19854.             when DISCRIMINANT_LIST => 
  19855.               STRING_LISTS.ATTACH(DISCRIM_LIST, NEXT_OBJECT.OBJECT_NAME);
  19856.  
  19857.             when RECORD_FIELD_LIST =>
  19858.               STRING_LISTS.ATTACH(CURRENT_RECORD_FIELD.REC_FIELD, 
  19859.                 NEXT_OBJECT.OBJECT_NAME);
  19860.  
  19861.             when others => 
  19862.               null; 
  19863.           end case; 
  19864.         end loop; 
  19865.  
  19866.       when others => 
  19867.         null; 
  19868.     end case; 
  19869.  
  19870.  
  19871.     FLUSH(EXPANDED_NAME);
  19872.     NAME_LISTS.DESTROY(CURRENT_LIST); 
  19873.     CURRENT_MODE := NONE; 
  19874.   end PROCESS_IDENTIFIER_LIST; 
  19875.  
  19876.   -----------------------------------------------------------------
  19877.  
  19878.   procedure SAVE_TYPE_IDENTIFIER is 
  19879.  
  19880.   --| Effects
  19881.   --|
  19882.   --| The current saved_token is a type identifier. 
  19883.   --| Save the type identifier for use in generating the
  19884.   --| "tracevar" procedures.
  19885.  
  19886.   begin
  19887.     FLUSH(CURRENT_TYPE_IDENTIFIER); 
  19888.     CURRENT_TYPE_IDENTIFIER := UPPER(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  19889.   end SAVE_TYPE_IDENTIFIER; 
  19890.  
  19891.   -----------------------------------------------------------------
  19892.  
  19893.   procedure END_GENERIC_TYPE is
  19894.   begin
  19895.     GENERIC_TYPE_LIST := 
  19896.       STRING_LISTS.ATTACH(MAKE_PERSISTENT(CURRENT_TYPE_IDENTIFIER), 
  19897.                           GENERIC_TYPE_LIST);
  19898.   end END_GENERIC_TYPE;
  19899.  
  19900.   -----------------------------------------------------------------
  19901.  
  19902.   procedure SAVE_TYPE_CLASS(TYPE_KIND : in TYPE_CLASS) is 
  19903.  
  19904.   --| Effects
  19905.   --|
  19906.  
  19907.   begin
  19908.     NOT_INCOMPLETE_TYPE := TRUE; 
  19909.     CURRENT_TYPE_CLASS := TYPE_KIND;
  19910.  
  19911.     if TYPE_KIND = TASK_TYPE then 
  19912.       CURRENT_TYPE_IDENTIFIER := UPPER(SAVED_TOKEN.LEXED_TOKEN.TEXT.all); 
  19913.     end if; 
  19914.  
  19915.   end SAVE_TYPE_CLASS; 
  19916.  
  19917.   -----------------------------------------------------------------
  19918.  
  19919.   procedure END_TYPE_DECLARATION is 
  19920.  
  19921.   --| Effects
  19922.   --|
  19923.       
  19924.     GENERATE_SPEC : BOOLEAN := TRUE;
  19925.     TYPE_NAME     : STRING_TYPE;
  19926.   begin
  19927.  
  19928.     if NOT_INCOMPLETE_TYPE then 
  19929.       STRING_PKG.MARK;
  19930.       TYPE_NAME := "STANDARD." & CURRENT_SCOPE.QUALIFIED_NAME & "." & 
  19931.                    CURRENT_TYPE_IDENTIFIER;
  19932.  
  19933.       case CURRENT_TYPE_CLASS is 
  19934.  
  19935.         when ENUMERATION_TYPE | INTEGER_TYPE | FLOAT_TYPE | FIXED_TYPE 
  19936.              | PRIVATE_TYPE | LIMITED_PRIVATE_TYPE | TASK_TYPE => 
  19937.            SDGU.GENERATE_TRACING_INSTANTIATION(VALUE(TYPE_NAME), 
  19938.                                                CURRENT_TYPE_CLASS);
  19939.            GENERATE_SPEC := FALSE;
  19940.  
  19941.         when DERIVED_TYPE => 
  19942.           -- expanded name is the parent type name --
  19943.           SDGU.GENERATE_DERIVED_TRACE(VALUE(TYPE_NAME), VALUE(EXPANDED_NAME));
  19944.           FLUSH(EXPANDED_NAME);
  19945.  
  19946.         when ARRAY_TYPE => 
  19947.           if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION and
  19948.              not STRING_LISTS.ISEMPTY(ANON_ARRAY_TEXT) then
  19949.             TYPE_NAME := "STANDARD." & EXPANDED_NAME;
  19950.           end if;
  19951.           SDGU.GENERATE_ARRAY_TRACE(VALUE(TYPE_NAME), NUMBER_OF_DIMENSIONS);
  19952.  
  19953.         when RECORD_TYPE => 
  19954.           if not STRING_LISTS.ISEMPTY(CURRENT_RECORD_FIELD.REC_FIELD) then
  19955.             RECORD_LISTS.ATTACH(REC_FIELD_LIST, CURRENT_RECORD_FIELD);
  19956.           end if;
  19957.           SDGU.GENERATE_RECORD_TRACE
  19958.             (VALUE(TYPE_NAME), REC_FIELD_LIST, DISCRIM_LIST, CASE_DISCRIMINANT);
  19959.           FLUSH(CASE_DISCRIMINANT);
  19960.           DISCARD_LIST(REC_FIELD_LIST);
  19961.           CURRENT_RECORD_FIELD.CHOICE_TEXT := STRING_LISTS.CREATE;
  19962.           CURRENT_RECORD_FIELD.REC_FIELD := STRING_LISTS.CREATE;
  19963.           REC_FIELD_LIST := RECORD_LISTS.CREATE;
  19964.  
  19965.         when ACCESS_TYPE => 
  19966.           SDGU.GENERATE_ACCESS_TRACE(VALUE(TYPE_NAME));
  19967.       end case; 
  19968.  
  19969.       if GENERATE_SPEC then
  19970.         SDGU.GENERATE_TRACING_SPECS(VALUE(TYPE_NAME));
  19971.       end if;
  19972.       STRING_PKG.RELEASE;
  19973.     end if; 
  19974.  
  19975.     NOT_INCOMPLETE_TYPE := FALSE; 
  19976.     FLUSH(CURRENT_TYPE_IDENTIFIER); 
  19977.     DISCARD_LIST(DISCRIM_LIST);
  19978.     DISCRIM_LIST := STRING_LISTS.CREATE;
  19979.   end END_TYPE_DECLARATION; 
  19980.  
  19981.   -----------------------------------------------------------------
  19982.  
  19983.   procedure START_ANONYMOUS_ARRAY_DEFINITION is 
  19984.  
  19985.   --| Effects
  19986.   --|
  19987.  
  19988.   begin
  19989.     SAVE_ANON_ARRAY_TEXT := TRUE;
  19990.     CURRENT_TYPE_IDENTIFIER := MAKE_ANON_TYPE_NAME;
  19991.     STRING_LISTS.ATTACH(ANON_ARRAY_TEXT, 
  19992.       "type " & CURRENT_TYPE_IDENTIFIER & " is");
  19993.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then
  19994.       if not IS_EMPTY(CURRENT_OUTER_SCOPE.QUALIFIED_NAME) then
  19995.         EXPANDED_NAME := CURRENT_OUTER_SCOPE.QUALIFIED_NAME & "." &
  19996.                          SD_PREFIX & CURRENT_SCOPE.SCOPE_NAME &
  19997.                          "." & CURRENT_TYPE_IDENTIFIER;
  19998.       else
  19999.         EXPANDED_NAME := SD_PREFIX & CURRENT_SCOPE.SCOPE_NAME &
  20000.                          "." & CURRENT_TYPE_IDENTIFIER;
  20001.       end if;
  20002.     else
  20003.       EXPANDED_NAME := CURRENT_SCOPE.QUALIFIED_NAME & "." & 
  20004.                        CURRENT_TYPE_IDENTIFIER;
  20005.     end if;
  20006.   end START_ANONYMOUS_ARRAY_DEFINITION; 
  20007.  
  20008.   -----------------------------------------------------------------
  20009.  
  20010.   procedure END_ANONYMOUS_ARRAY_DEFINITION is 
  20011.   begin
  20012.     STRING_LISTS.ATTACH(ANON_ARRAY_TEXT, CREATE(";"));
  20013.     SAVE_ANON_ARRAY_TEXT := FALSE; 
  20014.   end END_ANONYMOUS_ARRAY_DEFINITION; 
  20015.  
  20016.   -----------------------------------------------------------------
  20017.  
  20018.   procedure END_TYPEMARK is 
  20019.  
  20020.   --| Effects
  20021.   --|
  20022.   --| The current expanded name is a typemark name, before any
  20023.   --| constraints which may follow.  Not all typemarks are saved
  20024.   --| but in all cases turn off the "SAVE_EXPANDED_NAME" flag.
  20025.  
  20026.   begin
  20027.     SAVE_EXPANDED_NAME := FALSE; 
  20028.   end END_TYPEMARK; 
  20029.  
  20030.   -----------------------------------------------------------------
  20031.  
  20032.   procedure START_PRIVATE_PART is 
  20033.  
  20034.   --| Effects
  20035.   --|
  20036.   --| This procedure is called at the start of the private part
  20037.   --| of a package specification.  Stack 
  20038.   --| the visible variables list from the public part and set the
  20039.   --| "In_Private_Part" field of the current scope record so that
  20040.   --| tracing information will be written to the private tracing
  20041.   --| files.
  20042.  
  20043.   begin
  20044.     LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20045.     VISIBLE_LIST := NAME_LISTS.CREATE; 
  20046.     STRING_STACK_PKG.PUSH(PACKAGE_LIST_STACK, PACKAGE_LIST);
  20047.     PACKAGE_LIST := STRING_LISTS.CREATE;
  20048.     STRING_STACK_PKG.PUSH(USE_LIST_STACK, STRING_LISTS.COPY(USE_LIST));
  20049.  
  20050.     CURRENT_SCOPE.IN_PRIVATE_PART := TRUE; 
  20051.     SDBF.CREATE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  20052.                               PRIVATE_FILES);
  20053.     SDGU.GENERATE_FINDVAR_SPEC;
  20054.   end START_PRIVATE_PART; 
  20055.  
  20056.   -----------------------------------------------------------------
  20057.   procedure SAVE_CASE_IDENTIFIER is
  20058.   begin
  20059.     SAVE_CASE_DISCRIMINANT := TRUE;
  20060.   end SAVE_CASE_IDENTIFIER;
  20061.  
  20062.   -----------------------------------------------------------------
  20063.   procedure START_RECORD_VARIANT is 
  20064.   begin
  20065.     if not STRING_LISTS.ISEMPTY(CURRENT_RECORD_FIELD.REC_FIELD) then
  20066.       RECORD_LISTS.ATTACH(REC_FIELD_LIST, CURRENT_RECORD_FIELD);
  20067.       CURRENT_RECORD_FIELD.CHOICE_TEXT := STRING_LISTS.CREATE;
  20068.       CURRENT_RECORD_FIELD.REC_FIELD := STRING_LISTS.CREATE;
  20069.     end if;
  20070.     SAVE_RECORD_VARIANT := TRUE;
  20071.   end START_RECORD_VARIANT; 
  20072.  
  20073.   -----------------------------------------------------------------
  20074.  
  20075.   procedure END_RECORD_VARIANT is 
  20076.   begin
  20077.     SAVE_RECORD_VARIANT := FALSE;
  20078.   end END_RECORD_VARIANT; 
  20079.  
  20080.   -----------------------------------------------------------------
  20081.   procedure NULL_RECORD_FIELD is 
  20082.   begin
  20083.     STRING_LISTS.ATTACH(
  20084.       CURRENT_RECORD_FIELD.REC_FIELD, MAKE_PERSISTENT("NULL"));
  20085.   end NULL_RECORD_FIELD;
  20086.  
  20087.   -----------------------------------------------------------------
  20088.   procedure START_GENERIC_SPECIFICATION is 
  20089.   begin
  20090.     if CURRENT_NESTING_LEVEL = 0 then
  20091.       GENERIC_STARTED := TRUE;
  20092.       PRINT_BUFFERED_TOKENS;
  20093.     end if;
  20094.     GENERIC_TYPE_LIST := STRING_LISTS.CREATE;
  20095.   end START_GENERIC_SPECIFICATION; 
  20096.  
  20097.   -----------------------------------------------------------------
  20098.   procedure END_GENERIC_SPECIFICATION is
  20099.     LIST_ITERATOR : STRING_LISTS.LISTITER;
  20100.     CURRENT_TYPE  : STRING_TYPE;
  20101.     FIRST_ONE     : BOOLEAN := TRUE;
  20102.   begin
  20103.     LIST_ITERATOR := STRING_LISTS.MAKELISTITER(GENERIC_TYPE_LIST);
  20104.     while STRING_LISTS.MORE(LIST_ITERATOR) loop
  20105.       STRING_LISTS.NEXT(LIST_ITERATOR, CURRENT_TYPE);
  20106.       if OUTPUT_SOURCE then
  20107.         if FIRST_ONE then
  20108.           TEXT_IO.NEW_LINE(SID.INSTRUMENTED_FILE);
  20109.           FIRST_ONE := FALSE;
  20110.         end if;
  20111.         SDSB.WRITE_LINE_INST_SOURCE("with procedure " & sd_prefix & 
  20112.           "D(NAME: STRING; VAR: " & VALUE(CURRENT_TYPE) &
  20113.           ") IS <>;");
  20114.         SDSB.WRITE_LINE_INST_SOURCE("with procedure " & SD_PREFIX &
  20115.           "S(VAR: in out " & VALUE(CURRENT_TYPE) &
  20116.           ") IS <>;");
  20117.         SDSB.WRITE_LINE_INST_SOURCE("with function " & SD_PREFIX &
  20118.           "M(VAR: " & VALUE(CURRENT_TYPE) &
  20119.           ") return STRING is <>;");
  20120.       end if;
  20121.       FLUSH(CURRENT_TYPE);
  20122.     end loop;
  20123.   end END_GENERIC_SPECIFICATION;
  20124.   
  20125.   -----------------------------------------------------------------
  20126.   procedure INCREMENT_ARRAY_INDEX is 
  20127.   begin
  20128.     if PARSING_ARRAY_INDEX then
  20129.       NUMBER_OF_DIMENSIONS := NUMBER_OF_DIMENSIONS + 1;
  20130.     end if;
  20131.   end INCREMENT_ARRAY_INDEX; 
  20132.  
  20133.   -----------------------------------------------------------------
  20134.   procedure START_ARRAY_INDEX is 
  20135.   begin
  20136.     PARSING_ARRAY_INDEX := TRUE;
  20137.     NUMBER_OF_DIMENSIONS := 0;
  20138.   end START_ARRAY_INDEX; 
  20139.  
  20140.   -----------------------------------------------------------------
  20141.   procedure END_ARRAY_INDEX is 
  20142.   begin
  20143.     PARSING_ARRAY_INDEX := FALSE;
  20144.   end END_ARRAY_INDEX; 
  20145.  
  20146.  
  20147.   --------------------------------------------------------------
  20148.   --     Local Subprogram Bodies
  20149.   --------------------------------------------------------------
  20150.  
  20151.   procedure PRINT_BUFFERED_TOKENS is 
  20152.  
  20153.   --|Effects
  20154.   --|
  20155.   --|If there were any tokens that were buffered then print them out now.
  20156.   --|The last token that was buffered must first be added to the list
  20157.   --|of buffered tokens from the place holder.
  20158.  
  20159.     ITERATOR      : TOKEN_LISTS.LISTITER; 
  20160.     CURRENT_TOKEN : TOKEN_DESCRIPTOR; 
  20161.   begin
  20162.     if CURRENT_BUFFERED_TOKEN.TOKEN.GRAM_SYM_VAL /= PT.COMMENT_TOKENVALUE then 
  20163.       REQUESTS.CHANGES := REQUESTS.CHANGES + 
  20164.                           CURRENT_BUFFERED_TOKEN.REQUESTS.CHANGES; 
  20165.       CURRENT_BUFFERED_TOKEN.REQUESTS := REQUESTS; 
  20166.       REQUESTS := (0, 0, 0, 0, 0); 
  20167.       TOKEN_LISTS.ATTACH(BUFFERED_TOKENS, CURRENT_BUFFERED_TOKEN); 
  20168.       CURRENT_BUFFERED_TOKEN := INITIALIZED_DESCRIPTOR; 
  20169.     end if; 
  20170.     ITERATOR := TOKEN_LISTS.MAKELISTITER(BUFFERED_TOKENS); 
  20171.     while TOKEN_LISTS.MORE(ITERATOR) loop
  20172.       TOKEN_LISTS.NEXT(ITERATOR, CURRENT_TOKEN); 
  20173.       PRINT_COMMENTS(CURRENT_TOKEN.COMMENTS); 
  20174.       PRINT_TOKEN(CURRENT_TOKEN.TOKEN); 
  20175.       REQUESTS := CURRENT_TOKEN.REQUESTS; 
  20176.       if CURRENT_TOKEN.TOKEN.GRAM_SYM_VAL = PT.LEFTPAREN_TOKENVALUE then
  20177.         if CURRENT_COLUMN in SP.INDENTATION_RANGE then
  20178.            CURRENT_CHANGE_COLUMN := CURRENT_COLUMN; 
  20179.         else
  20180.           -- CURRENT_INDENT is 0 at the outermost level
  20181.           CURRENT_CHANGE_COLUMN := SP.INDENTATION_LEVEL + 2;
  20182.         end if;
  20183.       end if;
  20184.     end loop; 
  20185.     CURRENT_CHANGE_COLUMN := 0;
  20186.     TOKEN_LISTS.DESTROY(BUFFERED_TOKENS);
  20187.     BUFFERING_TOKENS := FALSE; 
  20188.   end PRINT_BUFFERED_TOKENS;
  20189.  
  20190.   -----------------------------------------------------------------
  20191.  
  20192.   function MAKE_ANON_TYPE_NAME return STRING_TYPE is
  20193.   begin
  20194.     ANON_NUMBER := ANON_NUMBER + 1;
  20195.     RETURN CREATE(SD_PREFIX & "ANON" & 
  20196.       INTEGER'IMAGE(ANON_NUMBER)(2..INTEGER'IMAGE(ANON_NUMBER)'LAST));
  20197.   end MAKE_ANON_TYPE_NAME;
  20198.  
  20199.   -----------------------------------------------------------------
  20200.  
  20201.   procedure RETRIEVE_SPEC_WITH_LIST is 
  20202.  
  20203.   --| Effects
  20204.   --|
  20205.   --| Get the with list that was saved for the package spec.
  20206.   --| If it named any units that are not in the with list
  20207.   --| for the body, then add those names to the current
  20208.   --| with list. 
  20209.  
  20210.     TEMP_LIST           : STRING_LISTS.LIST; 
  20211.     TEMP_LIST_ITERATOR  : STRING_LISTS.LISTITER; 
  20212.     TEMP_LIST_OBJECT    : STRING_TYPE; 
  20213.  
  20214.     SAVED_LIST          : STRING_LISTS.LIST; 
  20215.     SAVED_LIST_ITERATOR : STRING_LISTS.LISTITER; 
  20216.     SAVED_LIST_OBJECT   : STRING_TYPE; 
  20217.     MATCHED             : BOOLEAN; 
  20218.   begin
  20219.  
  20220.     SAVED_LIST := SDBF.GET_SPEC_WITH_LIST(VALUE(CURRENT_SCOPE.SCOPE_NAME)); 
  20221.  
  20222.     if not STRING_LISTS.ISEMPTY(SAVED_LIST) then 
  20223.       TEMP_LIST := STRING_LISTS.COPY(WITH_LIST); 
  20224.       SAVED_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(SAVED_LIST); 
  20225.       while STRING_LISTS.MORE(SAVED_LIST_ITERATOR) loop
  20226.         STRING_LISTS.NEXT(SAVED_LIST_ITERATOR, SAVED_LIST_OBJECT); 
  20227.         MATCHED := FALSE; 
  20228.  
  20229.         TEMP_LIST_ITERATOR := STRING_LISTS.MAKELISTITER(TEMP_LIST); 
  20230.         while STRING_LISTS.MORE(TEMP_LIST_ITERATOR) and not MATCHED loop
  20231.           STRING_LISTS.NEXT(TEMP_LIST_ITERATOR, TEMP_LIST_OBJECT); 
  20232.           MATCHED := EQUAL(UPPER(TEMP_LIST_OBJECT), UPPER(SAVED_LIST_OBJECT)); 
  20233.         end loop; 
  20234.         if not MATCHED then 
  20235.           STRING_LISTS.ATTACH(WITH_LIST, SAVED_LIST_OBJECT); 
  20236.         else 
  20237.           STRING_LISTS.DELETEITEM(TEMP_LIST, TEMP_LIST_OBJECT); 
  20238.         end if; -- not matched
  20239.       end loop; -- while more (saved_list)
  20240.     end if; -- not empty (saved_list)
  20241.   end RETRIEVE_SPEC_WITH_LIST; 
  20242.  
  20243.   ----------------------------------------------------------------------
  20244.  
  20245.   procedure DISPLAY_MESSAGE is
  20246.   begin
  20247.     TEXT_IO.PUT_LINE(
  20248.      "If your package specification includes a generic declaration and " &
  20249.      "you want");
  20250.     TEXT_IO.PUT_LINE(
  20251.       "to instrument the generic body, then you must answer YES to this " &
  20252.       "question.");
  20253.     TEXT_IO.PUT_LINE("");
  20254.     TEXT_IO.PUT_LINE(
  20255.       "Otherwise, instrumenting will not alter your package specification and");
  20256.     TEXT_IO.PUT_LINE(
  20257.       "recompiling your package specification may not be required.");
  20258.     TEXT_IO.PUT_LINE("");
  20259.     TEXT_IO.PUT_LINE(
  20260.       "The source instrumenter will create a package which has the procedures");
  20261.     TEXT_IO.PUT_LINE(
  20262.       "necessary to trace any types and variables declared in your package");
  20263.     TEXT_IO.PUT_LINE(
  20264.       "specification.  The source instrumenter's package will WITH and USE");
  20265.     TEXT_IO.PUT_LINE(
  20266.       "your package.  Therefore, your package specification must be compiled");
  20267.     TEXT_IO.PUT_LINE(
  20268.       "prior to compiling the source instrumenter's package.");
  20269.     TEXT_IO.PUT_LINE("");
  20270.     TEXT_IO.PUT_LINE(
  20271.       "If you need to compile or recompile your package spcecification, you");
  20272.     TEXT_IO.PUT_LINE(
  20273.       "may have it included in the same file as the source instrumenter's");
  20274.     TEXT_IO.PUT_LINE(
  20275.       "package.  Then when you compile the instrumented source file, both");
  20276.     TEXT_IO.PUT_LINE(
  20277.       "packages will be compiled.  You will have to recompile your package");
  20278.     TEXT_IO.PUT_LINE(
  20279.       "body and all dependent units as usual.");
  20280.     TEXT_IO.PUT_LINE("");
  20281.     TEXT_IO.PUT_LINE(
  20282.       "If you do not want to recompile your package specification, answer NO");
  20283.     TEXT_IO.PUT_LINE(
  20284.       "to the question.  You will still need to compile the instrumented");
  20285.     TEXT_IO.PUT_LINE(
  20286.       "source file, but your package will not be affected.");
  20287.     TEXT_IO.PUT_LINE("");
  20288.   end DISPLAY_MESSAGE;
  20289.  
  20290.   ----------------------------------------------------------------------
  20291.  
  20292.   function ASK_USER_ABOUT_PACKAGE return BOOLEAN is 
  20293.  
  20294.   --| Effects
  20295.   --|
  20296.   --| Before instrumenting a package specification which is a
  20297.   --| library unit, ask the user if the text of the package
  20298.   --| spec should be included in the instrumented source which
  20299.   --| will be compiled.  
  20300.  
  20301.     ANSWER : STRING(1..80);
  20302.     INDEX  : INTEGER := 80; 
  20303.  
  20304.   begin
  20305.     TEXT_IO.NEW_LINE(2); 
  20306.     TEXT_IO.PUT_LINE(ASCII.BEL & ASCII.BEL & 
  20307.       "Instrumenting the package specification for "); 
  20308.     TEXT_IO.PUT_LINE(VALUE(CURRENT_SCOPE_SIMPLE_NAME)); 
  20309.     loop
  20310.       TEXT_IO.PUT_LINE("Do you want this package specification included " &
  20311.                        "in the instrumented source?");
  20312.  
  20313.       TEXT_IO.PUT("Y/N/H or ? for Help "); 
  20314.  
  20315.       ANSWER(1..INDEX) := (others => ' ');
  20316.       TEXT_IO.GET_LINE(TEXT_IO.STANDARD_INPUT, ANSWER, INDEX); 
  20317.       TEXT_IO.PUT_LINE(""); 
  20318.       case ANSWER(1) is 
  20319.         when 'Y' | 'y' => 
  20320.           return TRUE; 
  20321.         when 'N' | 'n' => 
  20322.           return FALSE; 
  20323.         when '?' | 'H' | 'h' =>
  20324.           DISPLAY_MESSAGE;
  20325.         when others => 
  20326.           null;
  20327.       end case; 
  20328.     end loop; 
  20329.   end ASK_USER_ABOUT_PACKAGE; 
  20330.  
  20331.   ---------------------------------------------------------------
  20332.  
  20333.   procedure DISCARD_LIST(WHICH_LIST : in out NAME_LISTS.LIST) is 
  20334.  
  20335.   --| Effects
  20336.   --|
  20337.   --| Before destroying a name_list, the string_type fields
  20338.   --| needs to be flushed.
  20339.  
  20340.     ITER        : NAME_LISTS.LISTITER; 
  20341.     NEXT_OBJECT : NAME_RECORD; 
  20342.   begin
  20343.     if not NAME_LISTS.ISEMPTY(WHICH_LIST) then 
  20344.       ITER := NAME_LISTS.MAKELISTITER(WHICH_LIST); 
  20345.       while NAME_LISTS.MORE(ITER) loop
  20346.         NAME_LISTS.NEXT(ITER, NEXT_OBJECT); 
  20347.         FLUSH(NEXT_OBJECT.OBJECT_NAME); 
  20348.         FLUSH(NEXT_OBJECT.OBJECT_TYPE); 
  20349.       end loop; 
  20350.       NAME_LISTS.DESTROY(WHICH_LIST); 
  20351.     end if; 
  20352.   end DISCARD_LIST; 
  20353.  
  20354.   ---------------------------------------------------------------
  20355.  
  20356.   procedure DISCARD_LIST(WHICH_LIST : in out STRING_LISTS.LIST) is 
  20357.  
  20358.   --| Effects
  20359.   --|
  20360.   --| Before destroying a string_list, the string_type fields
  20361.   --| needs to be flushed.
  20362.  
  20363.     ITER          : STRING_LISTS.LISTITER; 
  20364.     STRING_OBJECT : STRING_TYPE; 
  20365.   begin
  20366.     if not STRING_LISTS.ISEMPTY(WHICH_LIST) then 
  20367.       ITER := STRING_LISTS.MAKELISTITER(WHICH_LIST); 
  20368.       while STRING_LISTS.MORE(ITER) loop
  20369.         STRING_LISTS.NEXT(ITER, STRING_OBJECT); 
  20370.         FLUSH(STRING_OBJECT); 
  20371.       end loop; 
  20372.       STRING_LISTS.DESTROY(WHICH_LIST); 
  20373.     end if; 
  20374.   end DISCARD_LIST; 
  20375.  
  20376.   ---------------------------------------------------------------
  20377.  
  20378.   procedure DISCARD_LIST(WHICH_LIST : in out RECORD_LISTS.LIST) is 
  20379.  
  20380.   --| Effects
  20381.   --|
  20382.   --| Before destroying a record_list, the string_type fields
  20383.   --| needs to be flushed.
  20384.  
  20385.     ITER        : RECORD_LISTS.LISTITER; 
  20386.     NEXT_OBJECT : REC_FIELD_RECORD; 
  20387.   begin
  20388.     if not RECORD_LISTS.ISEMPTY(WHICH_LIST) then 
  20389.       ITER := RECORD_LISTS.MAKELISTITER(WHICH_LIST); 
  20390.       while RECORD_LISTS.MORE(ITER) loop
  20391.         RECORD_LISTS.NEXT(ITER, NEXT_OBJECT); 
  20392.         DISCARD_LIST(NEXT_OBJECT.CHOICE_TEXT);
  20393.         DISCARD_LIST(NEXT_OBJECT.REC_FIELD);
  20394.       end loop; 
  20395.       RECORD_LISTS.DESTROY(WHICH_LIST); 
  20396.     end if; 
  20397.   end DISCARD_LIST; 
  20398.  
  20399.   --------------------------------------------------------------------
  20400.  
  20401.   procedure ADD_WITHS_TO_BODY is 
  20402.  
  20403.   --| Effects
  20404.   --|
  20405.   --| This is called from Increment_Scope when the current
  20406.   --| nesting level is 0, and the type of unit is either
  20407.   --| a subprogram body or a package body.  Add the with
  20408.   --| and use clauses that will be needed by the instrumented 
  20409.   --| source and retrieve any with clauses that were given for
  20410.   --| the specification.
  20411.  
  20412.     ITERATOR    : STRING_LISTS.LISTITER; 
  20413.     NEXT_OBJECT : STRING_TYPE; 
  20414.  
  20415.   begin
  20416.     if not SEPARATE_UNIT then 
  20417.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20418.         "with SD_Run_Time_Monitor; use SD_Run_Time_Monitor;"); 
  20419.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20420.         "with SD_Type_Definitions; use SD_Type_Definitions;"); 
  20421.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20422.         "with SD_User_Interface; use SD_User_Interface;");
  20423.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20424.         "with SD_Runtime_Declarations; use SD_Runtime_Declarations;");
  20425.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20426.         "with SD_Runtime_Utilities; use SD_Runtime_Utilities;");
  20427.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20428.         "with SD_Trace_Predefined_Types; use SD_Trace_Predefined_Types;"); 
  20429.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20430.         "with SD_Generic_Templates; use SD_Generic_Templates;"); 
  20431.       TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, "with String_Pkg;"); 
  20432.       RETRIEVE_SPEC_WITH_LIST; 
  20433.     end if; -- not separate
  20434.  
  20435.     -- if the current unit is a package body and its spec was instrumented
  20436.     -- then with and use its public trace package
  20437.     if CURRENT_SCOPE.TYPE_OF_SCOPE = PACKAGE_BODY and then 
  20438.        SDBF.PACKAGE_FILES_EXIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20439.                                 PUBLIC_FILES) then 
  20440.       SDSB.WRITE_LINE_INST_SOURCE(
  20441.         "with " & SD_PREFIX & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & "; " &
  20442.         "use " & SD_PREFIX & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & ";"); 
  20443.     end if; -- package_body and type_tracing  
  20444.  
  20445.     -- now add with and use for anything in the with list that
  20446.     -- has been instrumented.  Note that the with list won't have
  20447.     -- anything in it if type_tracing is turned off.
  20448.  
  20449.     ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST); 
  20450.     while STRING_LISTS.MORE(ITERATOR) loop
  20451.       STRING_LISTS.NEXT(ITERATOR, NEXT_OBJECT); 
  20452.       SDSB.WRITE_LINE_INST_SOURCE(
  20453.         "with " & SD_PREFIX & VALUE(NEXT_OBJECT) & "; " &
  20454.         "use " & SD_PREFIX & VALUE(NEXT_OBJECT) & ";"); 
  20455.     end loop; 
  20456.  
  20457.   end ADD_WITHS_TO_BODY; 
  20458.  
  20459.   ------------------------------------------------------------------
  20460.  
  20461.   procedure ADD_WITHS_TO_TRACE_PACKAGES is 
  20462.  
  20463.   --| Effects
  20464.   --|
  20465.   --| This is called by Initialize_Trace_Packages when the current
  20466.   --| nesting level is 0. The tracing packages have to have visibility
  20467.   --| of the package specification being traced, the public tracing
  20468.   --| packages of any instrumented units in the context clause, and
  20469.   --| other assorted utility packages.
  20470.  
  20471.     ITERATOR    : STRING_LISTS.LISTITER; 
  20472.     NEXT_OBJECT : STRING_TYPE; 
  20473.  
  20474.     -----------------------------------------------------------------
  20475.     -- See if the name in the with clause is also in the use list.
  20476.     -- We can't use LIST_PACKAGE.ISINLIST because it checks to
  20477.     -- see if the pointers are equal, rather than what they point to.
  20478.  
  20479.     function IS_USED(NAME: STRING_TYPE) return BOOLEAN is
  20480.       USE_ITERATOR : STRING_LISTS.LISTITER;
  20481.       NEXT_NAME    : STRING_TYPE;
  20482.     begin
  20483.       USE_ITERATOR := STRING_LISTS.MAKELISTITER(USE_LIST);
  20484.       while STRING_LISTS.MORE(USE_ITERATOR) loop
  20485.         STRING_LISTS.NEXT(USE_ITERATOR, NEXT_NAME);
  20486.         if STRING_PKG.EQUAL(NAME, NEXT_NAME) then
  20487.           return TRUE;
  20488.         end if;
  20489.       end loop;
  20490.       return FALSE;
  20491.     end IS_USED;
  20492.     -----------------------------------------------------------------
  20493.  
  20494.   begin
  20495.  
  20496.     -- with and use the package being traced
  20497.     SDSB.WRITE_SPEC_BUFFER("with " & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & "; ");
  20498.  
  20499.     if not GENERIC_STARTED then
  20500.       SDSB.WRITE_LINE_SPEC_BUFFER(
  20501.         "use " & VALUE(CURRENT_SCOPE_SIMPLE_NAME) & ";"); 
  20502.     else
  20503.       SDSB.WRITE_LINE_SPEC_BUFFER("");
  20504.     end if;
  20505.  
  20506.     -- with and use the support packages
  20507.     SDSB.WRITE_LINE_SPEC_BUFFER( 
  20508.       "with SD_Runtime_Declarations; use SD_Runtime_Declarations;");
  20509.     SDSB.WRITE_LINE_SPEC_BUFFER( 
  20510.       "with SD_Runtime_Utilities; use SD_Runtime_Utilities;");
  20511.     SDSB.WRITE_LINE_SPEC_BUFFER( 
  20512.       "with SD_Trace_Predefined_Types; use SD_Trace_Predefined_Types;"); 
  20513.     SDSB.WRITE_LINE_SPEC_BUFFER( 
  20514.       "with SD_Generic_Templates; use SD_Generic_Templates;");
  20515.     SDSB.WRITE_LINE_SPEC_BUFFER( 
  20516.       "with STRING_PKG;");
  20517.  
  20518.     -- with and use the packages and public trace packages of anything
  20519.     -- in the with list that was instrumented.
  20520.     ITERATOR := STRING_LISTS.MAKELISTITER(WITH_LIST); 
  20521.     while STRING_LISTS.MORE(ITERATOR) loop
  20522.       STRING_LISTS.NEXT(ITERATOR, NEXT_OBJECT); 
  20523.       SDSB.WRITE_SPEC_BUFFER("with " & VALUE(NEXT_OBJECT) & "; ");
  20524.       if IS_USED(NEXT_OBJECT) then
  20525.         SDSB.WRITE_LINE_SPEC_BUFFER("use " & VALUE(NEXT_OBJECT) & ";"); 
  20526.       else
  20527.         SDSB.WRITE_LINE_SPEC_BUFFER("");
  20528.       end if;
  20529.  
  20530.       SDSB.WRITE_LINE_SPEC_BUFFER( 
  20531.         "with " & SD_PREFIX & VALUE(NEXT_OBJECT) & "; " &
  20532.         "use " & SD_PREFIX & VALUE(NEXT_OBJECT) & ";"); 
  20533.     end loop; 
  20534.  
  20535.   end ADD_WITHS_TO_TRACE_PACKAGES; 
  20536.  
  20537.   -----------------------------------------------------------------
  20538.  
  20539.   procedure INITIALIZE_TRACE_PACKAGES is 
  20540.  
  20541.   --| Effects
  20542.   --|
  20543.   --| This procedure is called by Increment_Scope when the
  20544.   --| current scope is a package specification.
  20545.  
  20546.   begin
  20547.     if CURRENT_OUTER_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  20548.       if CURRENT_OUTER_SCOPE.IN_PRIVATE_PART then      
  20549.         SDBF.CLOSE_PACKAGE_FILES(ALL_FILES); 
  20550.         SDBF.CREATE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20551.                                   PUBLIC_FILES); 
  20552.       end if;
  20553.     else 
  20554.       SDBF.CREATE_PACKAGE_FILES(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20555.                                 PUBLIC_FILES); 
  20556.  
  20557.       if CURRENT_NESTING_LEVEL = 1 then 
  20558.         if not STRING_LISTS.ISEMPTY(WITH_LIST) then 
  20559.           SDBF.SAVE_SPEC_WITH_LIST(VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20560.                                    WITH_LIST); 
  20561.         end if; 
  20562.         ADD_WITHS_TO_TRACE_PACKAGES; 
  20563.       end if; -- Current_Nesting_Level = 1
  20564.  
  20565.       -- Start the public trace packages
  20566.       SDSB.WRITE_LINE_SPEC_BUFFER( 
  20567.         "package " & SD_PREFIX & VALUE(CURRENT_SCOPE.SCOPE_NAME) & " is");
  20568.       SDSB.WRITE_LINE_BODY_BUFFER( 
  20569.         "package body " & SD_PREFIX & VALUE(CURRENT_SCOPE.SCOPE_NAME) & " is"); 
  20570.     end if; 
  20571.  
  20572.     SDGU.GENERATE_FINDVAR_SPEC;
  20573.  
  20574.     -- start new visible variable and local package lists
  20575.     LIST_STACK_PKG.PUSH(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20576.     VISIBLE_LIST := NAME_LISTS.CREATE; 
  20577.     STRING_STACK_PKG.PUSH(PACKAGE_LIST_STACK, PACKAGE_LIST);
  20578.     PACKAGE_LIST := STRING_LISTS.CREATE;
  20579.     STRING_STACK_PKG.PUSH(USE_LIST_STACK, STRING_LISTS.COPY(USE_LIST));
  20580.   end INITIALIZE_TRACE_PACKAGES; 
  20581.  
  20582.   -----------------------------------------------------------------
  20583.  
  20584.   procedure CLOSE_TRACE_PACKAGES is 
  20585.  
  20586.   --| Effects
  20587.   --|
  20588.   --| This procedure is called by Decrement_Scope when the current unit 
  20589.   --| is a package specification.  Finish the tracing information packages.
  20590.    
  20591.   begin
  20592.  
  20593.     -- Finish the private tracing packages
  20594.     if CURRENT_SCOPE.IN_PRIVATE_PART then 
  20595.       SDGU.GENERATE_PACKAGE_FINDVAR(VISIBLE_LIST, PACKAGE_LIST, USE_LIST);
  20596.       LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20597.       STRING_STACK_PKG.POP(PACKAGE_LIST_STACK, PACKAGE_LIST);
  20598.       STRING_STACK_PKG.POP(USE_LIST_STACK, USE_LIST);
  20599.       CURRENT_SCOPE.IN_PRIVATE_PART := FALSE; 
  20600.       SDBF.CLOSE_PACKAGE_FILES(PRIVATE_FILES); 
  20601.     end if; 
  20602.  
  20603.     SDGU.GENERATE_PACKAGE_FINDVAR(VISIBLE_LIST, PACKAGE_LIST, USE_LIST);
  20604.  
  20605.     LIST_STACK_PKG.POP(VISIBLE_LIST_STACK, VISIBLE_LIST); 
  20606.     STRING_STACK_PKG.POP(PACKAGE_LIST_STACK, PACKAGE_LIST);
  20607.     STRING_STACK_PKG.POP(USE_LIST_STACK, USE_LIST);
  20608.  
  20609.     if CURRENT_OUTER_SCOPE.TYPE_OF_SCOPE = PACKAGE_SPECIFICATION then 
  20610.       if CURRENT_OUTER_SCOPE.IN_PRIVATE_PART then
  20611.         SDBF.REOPEN_FILES(VALUE(CURRENT_OUTER_SCOPE.QUALIFIED_NAME),
  20612.                           PRIVATE_FILES); 
  20613.         SDBF.COPY_AND_DELETE(PUBLIC_SPEC_FILE, PRIVATE_SPEC_FILE);
  20614.         SDBF.COPY_AND_DELETE(PUBLIC_BODY_FILE, PRIVATE_BODY_FILE);
  20615.         SDBF.REOPEN_FILES(VALUE(CURRENT_OUTER_SCOPE.QUALIFIED_NAME),
  20616.                           PUBLIC_FILES);
  20617.       end if;
  20618.       STRING_LISTS.ATTACH(PACKAGE_LIST, 
  20619.                           MAKE_PERSISTENT(CURRENT_SCOPE.SCOPE_NAME)); 
  20620.     else 
  20621.       -- End the public trace packages
  20622.       SDSB.WRITE_LINE_SPEC_BUFFER( 
  20623.         "end " & SD_PREFIX & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  20624.       SDSB.WRITE_LINE_BODY_BUFFER( 
  20625.         "end " & SD_PREFIX & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  20626.  
  20627.       SDBF.CLOSE_PACKAGE_FILES(PUBLIC_FILES); 
  20628.  
  20629.       SDBF.COPY_PACKAGE_FILES(PUBLIC_SPEC, 
  20630.                               VALUE(CURRENT_SCOPE.QUALIFIED_NAME), 
  20631.                               SID.INSTRUMENTED_FILE); 
  20632.  
  20633.       if CURRENT_NESTING_LEVEL = 1 then 
  20634.         SDBF.COPY_PACKAGE_FILES(PUBLIC_BODY, 
  20635.                                 VALUE(CURRENT_SCOPE.QUALIFIED_NAME),
  20636.                                 SID.INSTRUMENTED_FILE); 
  20637.       else 
  20638.         TEXT_IO.PUT_LINE(SID.INSTRUMENTED_FILE, 
  20639.           "use " & SD_PREFIX & VALUE(CURRENT_SCOPE.SCOPE_NAME) & ";"); 
  20640.         STRING_LISTS.ATTACH(PACKAGE_LIST, 
  20641.                             MAKE_PERSISTENT(CURRENT_SCOPE.SCOPE_NAME)); 
  20642.       end if; -- if current nesting level = 1
  20643.     end if; 
  20644.   end CLOSE_TRACE_PACKAGES; 
  20645.  
  20646.   -----------------------------------------------------------------
  20647. end SOURCE_INSTRUMENTER_UTILITIES; 
  20648.  
  20649. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20650. --PARSE.BDY
  20651. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20652. with Lex;                       -- the lexical analyzer
  20653. with ParseStack;                -- elements awaiting parsing
  20654. with StateStack;                -- stack of parse states
  20655. with ParseTables;               -- state tables generated by parser
  20656.                                 -- generator
  20657. use ParseTables;
  20658.  
  20659. with Grammar_Constants;         -- constants generated by parser generator
  20660. use Grammar_Constants;
  20661.  
  20662. with Source_Instrumenter_Utilities;-- 
  20663.  
  20664. package body Parser is
  20665.  
  20666.     ------------------------------------------------------------------
  20667.  
  20668.     procedure Apply_Actions(
  20669.         Rule_Number : in PT.LeftHandSideRange) is separate;
  20670.  
  20671.     ------------------------------------------------------------------
  20672.  
  20673.     function Parse return PD.ParseStackElement is
  20674.  
  20675.     --| Overview
  20676.     --|
  20677.     --| The appropriate reference is:
  20678.     --|
  20679.     --| Using the NYU LALR Parser Generator. Philippe Charles and
  20680.     --| Gerald Fisher. Courant Institute, New York University, 251 Mercer
  20681.     --| Street, New York, N.Y.  10012. Unpublished paper. 1981.
  20682.     --|
  20683.  
  20684.     --|
  20685.     --| Notes
  20686.     --|
  20687.     --| Abbreviations Used:
  20688.     --|
  20689.     --| Cur : Current - used as prefix
  20690.     --| LH  : LeftHand
  20691.     --| RH  : RightHand
  20692.     --|
  20693.  
  20694.     ------------------------------------------------------------------
  20695.     -- Reduce Action Work Variables
  20696.     ------------------------------------------------------------------
  20697.  
  20698.     Reduce_Action_Number   : PT.LeftHandSideRange;
  20699.         --| reduction to perform
  20700.  
  20701.     Reduce_Action_LH_Value : GrammarSymbolRange;
  20702.         --| grammar symbol number of left hand side of reduction
  20703.  
  20704.     Reduce_Action_RH_Size  : PD.StateParseStacksIndex;
  20705.         --| number of elements in right hand side of reduction
  20706.  
  20707.     ------------------------------------------------------------------
  20708.     -- Other Objects
  20709.     ------------------------------------------------------------------
  20710.  
  20711.     Current_Action      : ActionRange;
  20712.         --| return from PT.GetAction.
  20713.  
  20714.     Start_State         : constant := 1;
  20715.         --| Start state for parser.
  20716.  
  20717.     Last_Element_Popped : PD.ParseStackElement;
  20718.         --| Last element popped from parse stack
  20719.  
  20720.     ------------------------------------------------------------------
  20721.  
  20722.     begin
  20723.  
  20724.     --|
  20725.     --| Algorithm
  20726.     --|
  20727.     --| Function PT.GetAction returns an action value,
  20728.     --| which indicate one of four possible actions:
  20729.     --|
  20730.     --| Error:  action value = 0.
  20731.     --| Shift:  0 < action value < StateCountPlusOne.
  20732.     --| Accept: action value = StateCountPlusOne.
  20733.     --| Reduce: action value > StateCountPlusOne.
  20734.     --|
  20735.     --| The action is processed (as described below).
  20736.     --| This is repeated until no more tokens are obtained.
  20737.     --|
  20738.     --| The basic action processing is:
  20739.     --|
  20740.     --| SHIFT ACTION: the next token is placed on the ParseStack.
  20741.     --|
  20742.     --| REDUCE ACTION: the handle (a grammar rule's right hand side)
  20743.     --| found on the ParseStack is replaced with a
  20744.     --| non-terminal (grammar rule's left hand side) to which
  20745.     --| it has been reduced, and a new state.
  20746.     --|
  20747.     --| ACCEPT ACTION: the ParseStack contains the root
  20748.     --| of the parse tree, and processing is finished for
  20749.     --| If another compilation unit is present, parsing continues.
  20750.     --|
  20751.     --| ERROR ACTION: the exception Parser_Error is raised.
  20752.  
  20753.     ------------------------------------------------------------------
  20754.     
  20755.         -- Initialize Lexical Analyzer
  20756.         Lex.Initialization;
  20757.  
  20758.         PD.CurToken := Lex.GetNextNonCommentToken;
  20759.  
  20760.         StateStack.Push(Start_State);
  20761.  
  20762.         Do_Parse: loop
  20763.  
  20764.             Current_Action := PT.GetAction(
  20765.                 StateStack.CopyTop,
  20766.                 PD.CurToken.gram_sym_val);
  20767.  
  20768.             -- Accept action
  20769.             exit when (Current_Action in PD.Accept_Action_Range);
  20770.         
  20771.             if Current_Action in PD.Shift_Action_Range then
  20772.  
  20773.                 -- Pretty Printer Utility call
  20774.                 Source_Instrumenter_Utilities.Put(PD.CurToken);
  20775.  
  20776.                 -- Shift token from CurToken to ParseStack.
  20777.                 ParseStack.Push(PD.CurToken);
  20778.  
  20779.                 -- Add new state to top of StateStack
  20780.                 StateStack.Push(Current_Action);
  20781.          
  20782.                 -- Get next token.
  20783.                 PD.CurToken := Lex.GetNextNonCommentToken;
  20784.         
  20785.             elsif Current_Action in PD.Reduce_Action_Range then
  20786.         
  20787.                 Reduce_Action_Number := Current_Action -
  20788.                     StateCountPlusOne;
  20789.  
  20790.                 Reduce_Action_LH_Value  :=
  20791.                     PT.Get_LeftHandSide(Reduce_Action_Number);
  20792.  
  20793.                 Reduce_Action_RH_Size :=
  20794.                     PT.Get_RightHandSide(Reduce_Action_Number);
  20795.  
  20796.                 -- Reduce Parse Stack
  20797.                 ParseStack.Reduce(Reduce_Action_RH_Size);
  20798.  
  20799.                 ParseStack.Push((
  20800.                     gram_sym_val => Reduce_Action_LH_Value,
  20801.                     lexed_token => (
  20802.                         text => PD.Null_Source_Text,
  20803.                         srcpos_line => 0,
  20804.                         srcpos_column => 0)));
  20805.  
  20806.                 -- Reduce State Stack
  20807.                 StateStack.Reduce(Reduce_Action_RH_Size);
  20808.  
  20809.                 StateStack.Push(PT.GetAction(
  20810.                     StateStack.CopyTop,
  20811.                     Reduce_Action_LH_Value));
  20812.  
  20813.                 Apply_Actions(Reduce_Action_Number);
  20814.  
  20815.                 else -- Current_Action is in PD.Error_Action_Range
  20816.                     raise PD.Parser_Error;
  20817.             end if;
  20818.         end loop Do_Parse;
  20819.         return ParseStack.Pop;
  20820.     
  20821.     exception
  20822.         when PD.MemoryOverflow =>
  20823.             -- raised if Parse runs out of newable memory.
  20824.             raise PD.MemoryOverflow;
  20825.     
  20826.     end Parse;
  20827.     
  20828.     ------------------------------------------------------------------
  20829.  
  20830. end Parser;
  20831.  
  20832. ----------------------------------------------------------------------
  20833. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20834. --GETNEXT.SUB
  20835. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20836. with SOURCE_INSTRUMENTER_DECLARATIONS;
  20837. with Source_Instrumenter_Utilities;
  20838. separate (Lex)
  20839. function GetNextNonCommentToken return PD.ParseStackElement is
  20840.  
  20841.     package SIU renames Source_Instrumenter_Utilities;
  20842.     package SID renames SOURCE_INSTRUMENTER_DECLARATIONS;
  20843.  
  20844. begin
  20845.     SIU.Comment_Buffer := SID.Comment_Lists.Create;
  20846.     loop
  20847.         CST := GetNextSourceToken;
  20848.         exit when (CST.gram_sym_val = PT.EOF_TokenValue) or
  20849.             (CST.gram_sym_val /= PT.Comment_TokenValue);
  20850.         SID.Comment_Lists.Attach(SIU.Comment_Buffer, CST);
  20851.     end loop;
  20852.     return CST;    -- return the token that is not a comment
  20853. end GetNextNonCommentToken;
  20854. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20855. --APPLYACT.SUB
  20856. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20857.  
  20858.  with Source_Instrumenter_Declarations;
  20859.  
  20860.  separate (Parser)
  20861.  procedure Apply_Actions(Rule_Number : in PT.LeftHandSideRange) is
  20862.  
  20863.     -- all procedure calls in this unit are procedures in package
  20864.     -- Source_Instrumenter_Utilities
  20865.  
  20866.      use Source_Instrumenter_Declarations;
  20867.      use Source_Instrumenter_Utilities;
  20868.  
  20869.  begin
  20870.  
  20871.      case Rule_Number is
  20872.  
  20873.  
  20874.  -------------------------------------------------------------------
  20875.  -- pragma ::= PRAGMA identifier ( general_component_associations ) ;  
  20876.  
  20877.   when 1
  20878.  
  20879.  -------------------------------------------------------------------
  20880.  -- pragma ::= PRAGMA identifier ;  
  20881.  
  20882.   | 2 =>
  20883.  
  20884.          New_Line;
  20885.  
  20886.  -------------------------------------------------------------------
  20887.  -- basic_declaration ::= type_declaration  
  20888.  
  20889.   when 3 =>
  20890.  
  20891.          End_Type_Declaration;
  20892.  
  20893.  -------------------------------------------------------------------
  20894.  -- basic_colon_declaration ::= object_declaration  
  20895.  
  20896.   when 11
  20897.  
  20898.  -------------------------------------------------------------------
  20899.  -- basic_colon_declaration ::= number_declaration  
  20900.  
  20901.   | 12
  20902.  
  20903.  -------------------------------------------------------------------
  20904.  -- basic_colon_declaration ::= exception_declaration  
  20905.  
  20906.   | 13
  20907.  
  20908.  -------------------------------------------------------------------
  20909.  -- basic_colon_declaration ::= renaming_colon_declaration  
  20910.  
  20911.   | 14 =>
  20912.  
  20913.          New_Line;
  20914.  
  20915.  -------------------------------------------------------------------
  20916.  -- object_declaration ::= identifier_list : subtype_indication [:=expression] ; 
  20917.  
  20918.   when 15 =>
  20919.  
  20920.          Set_Identifier_Mode (Read_Write);
  20921.          Process_Identifier_List (Object_List);
  20922.  
  20923.  -------------------------------------------------------------------
  20924.  -- object_declaration ::= identifier_list : CONSTANT subtype_indication ;  
  20925.  
  20926.   when 16 =>
  20927.  
  20928.          Set_Identifier_Mode (Read_Only);
  20929.          Process_Identifier_List (Object_List);
  20930.  
  20931.  -------------------------------------------------------------------
  20932.  -- object_declaration ::= identifier_list : start_cad  
  20933.  --     constrained_array_definition  
  20934.  
  20935.   when 17 =>
  20936.  
  20937.          Set_Identifier_Mode (Read_Write);
  20938.          Process_Identifier_List (Object_List);
  20939.  
  20940.  -------------------------------------------------------------------
  20941.  -- object_declaration ::= identifier_list : CONSTANT start_cad end_cad ;  
  20942.  
  20943.   when 18 =>
  20944.  
  20945.          Set_Identifier_Mode (Read_Only);
  20946.          Process_Identifier_List (Object_List);
  20947.  
  20948.  -------------------------------------------------------------------
  20949.  -- start_cad ::= empty  
  20950.  
  20951.   when 19 =>
  20952.  
  20953.          Start_Anonymous_Array_Definition;
  20954.  
  20955.  -------------------------------------------------------------------
  20956.  -- end_cad ::= empty  
  20957.  
  20958.   when 20 =>
  20959.  
  20960.          End_Anonymous_Array_Definition;
  20961.  
  20962.  -------------------------------------------------------------------
  20963.  -- number_declaration ::= identifier_list : CONSTANT := expression ;  
  20964.  
  20965.   when 21 =>
  20966.  
  20967.          Set_Identifier_Mode (Const);
  20968.          Process_Identifier_List (Object_List);
  20969.  
  20970.  -------------------------------------------------------------------
  20971.  -- save_identifier ::= identifier  
  20972.  
  20973.   when 23 =>
  20974.  
  20975.          Add_Identifier_To_List;
  20976.  
  20977.  -------------------------------------------------------------------
  20978.  -- type_identifier ::= identifier  
  20979.  
  20980.   when 29 =>
  20981.  
  20982.           Save_Type_Identifier;
  20983.  
  20984.  -------------------------------------------------------------------
  20985.  -- type_definition ::= array_type_definition ;  
  20986.  
  20987.   when 33 =>
  20988.  
  20989.          Save_Type_Class (Array_Type);
  20990.  
  20991.  -------------------------------------------------------------------
  20992.  -- type_definition ::= record_type_definition ;  
  20993.  
  20994.   when 34 =>
  20995.  
  20996.          Decrease_Indent;
  20997.          Save_Type_Class (Record_Type);
  20998.  
  20999.  -------------------------------------------------------------------
  21000.  -- type_definition ::= access_type_definition ;  
  21001.  
  21002.   when 35 =>
  21003.  
  21004.          Save_Type_Class (Access_Type);
  21005.  
  21006.  -------------------------------------------------------------------
  21007.  -- type_mark ::= type_name|subtype_name  
  21008.  
  21009.   when 40 =>
  21010.  
  21011.          End_Typemark;
  21012.  
  21013.  -------------------------------------------------------------------
  21014.  -- derived_type_definition ::= NEW start_expanded_name subtype_indication  
  21015.  
  21016.   when 45 =>
  21017.  
  21018.          Save_Type_Class (Derived_Type);
  21019.  
  21020.  -------------------------------------------------------------------
  21021.  -- enumeration_type_definition ::= ( enumeration_literal_specification )  
  21022.  
  21023.   when 48 =>
  21024.  
  21025.          Save_Type_Class (Enumeration_Type);
  21026.  
  21027.  -------------------------------------------------------------------
  21028.  -- integer_type_definition ::= range_constraint  
  21029.  
  21030.   when 52 =>
  21031.  
  21032.          Save_Type_Class (Integer_Type);
  21033.  
  21034.  -------------------------------------------------------------------
  21035.  -- real_type_definition ::= floating_point_constraint  
  21036.  
  21037.   when 53 =>
  21038.  
  21039.          Save_Type_Class (Float_Type);
  21040.  
  21041.  -------------------------------------------------------------------
  21042.  -- real_type_definition ::= fixed_point_constraint  
  21043.  
  21044.   when 54 =>
  21045.  
  21046.          Save_Type_Class (Fixed_Type);
  21047.  
  21048.  -------------------------------------------------------------------
  21049.  -- index_subtype_definition ::= name RANGE <>  
  21050.  
  21051.   when 63 =>
  21052.  
  21053.          Increment_Array_Index;
  21054.  
  21055.  -------------------------------------------------------------------
  21056.  -- index_left_paren ::= (  
  21057.  
  21058.   when 65 =>
  21059.  
  21060.           Start_Array_Index;
  21061.  
  21062.  -------------------------------------------------------------------
  21063.  -- index_right_paren ::= )  
  21064.  
  21065.   when 66 =>
  21066.  
  21067.           End_Array_Index;
  21068.  
  21069.  -------------------------------------------------------------------
  21070.  -- discrete_range ::= name range_constraint  
  21071.  
  21072.   when 67
  21073.  
  21074.  -------------------------------------------------------------------
  21075.  -- discrete_range ::= range  
  21076.  
  21077.   | 68 =>
  21078.  
  21079.          Increment_Array_Index;
  21080.  
  21081.  -------------------------------------------------------------------
  21082.  -- component_list ::= {pragma_decl} {component_declaration}  
  21083.  --     component_declaration  
  21084.  
  21085.   when 72
  21086.  
  21087.  -------------------------------------------------------------------
  21088.  -- component_list ::= {pragma_decl} {component_declaration}' variant_part  
  21089.  
  21090.   | 73 =>
  21091.  
  21092.           Decrease_Indent;
  21093.  
  21094.  -------------------------------------------------------------------
  21095.  -- component_list ::= null_statement {pragma_decl}  
  21096.  
  21097.   when 74 =>
  21098.  
  21099.          Decrease_Indent;
  21100.          Null_Record_Field;
  21101.  
  21102.  -------------------------------------------------------------------
  21103.  -- component_declaration ::= identifier_list : subtype_indication  
  21104.  --     [:=expression] ;  
  21105.  
  21106.   when 75 =>
  21107.  
  21108.          New_Line;
  21109.          Process_Identifier_List (Record_Field_List);
  21110.  
  21111.  -------------------------------------------------------------------
  21112.  -- discriminant_specification ::= identifier_list : type_mark [:=expression]  
  21113.  
  21114.   when 76 =>
  21115.  
  21116.          Process_Identifier_List (Discriminant_List);
  21117.  
  21118.  -------------------------------------------------------------------
  21119.  -- variant_part ::= CASE__identifier__IS {pragma_variant}__variant__{variant}  
  21120.  --     END  
  21121.  
  21122.   when 77 =>
  21123.  
  21124.          New_Line;
  21125.  
  21126.  -------------------------------------------------------------------
  21127.  -- start_record_variant ::= empty  
  21128.  
  21129.   when 80 =>
  21130.  
  21131.          Start_Record_Variant;
  21132.  
  21133.  -------------------------------------------------------------------
  21134.  -- declarative_part ::= start_bdi {basic_declarative_item}  
  21135.  
  21136.   when 87
  21137.  
  21138.  -------------------------------------------------------------------
  21139.  -- declarative_part ::= start_bdi {basic_declarative_item} body  
  21140.  
  21141.   | 88 =>
  21142.  
  21143.          Decrease_Indent;
  21144.          End_Declarative_Part;
  21145.  
  21146.  -------------------------------------------------------------------
  21147.  -- start_bdi ::= empty  
  21148.  
  21149.   when 89 =>
  21150.  
  21151.          Start_Declarative_Part;
  21152.  
  21153.  -------------------------------------------------------------------
  21154.  -- basic_declarative_item ::= basic_declaration  
  21155.  
  21156.   when 90
  21157.  
  21158.  -------------------------------------------------------------------
  21159.  -- basic_declarative_item ::= representation_clause  
  21160.  
  21161.   | 91
  21162.  
  21163.  -------------------------------------------------------------------
  21164.  -- basic_declarative_item ::= use_clause  
  21165.  
  21166.   | 92
  21167.  
  21168.  -------------------------------------------------------------------
  21169.  -- later_declarative_item ::= subprogram_declaration  
  21170.  
  21171.   | 94
  21172.  
  21173.  -------------------------------------------------------------------
  21174.  -- later_declarative_item ::= package_declaration  
  21175.  
  21176.   | 95
  21177.  
  21178.  -------------------------------------------------------------------
  21179.  -- later_declarative_item ::= task_specification  
  21180.  
  21181.   | 96
  21182.  
  21183.  -------------------------------------------------------------------
  21184.  -- later_declarative_item ::= generic_specification  
  21185.  
  21186.   | 97
  21187.  
  21188.  -------------------------------------------------------------------
  21189.  -- later_declarative_item ::= use_clause  
  21190.  
  21191.   | 98
  21192.  
  21193.  -------------------------------------------------------------------
  21194.  -- later_declarative_item ::= generic_instantiation  
  21195.  
  21196.   | 99
  21197.  
  21198.  -------------------------------------------------------------------
  21199.  -- body ::= proper_body  
  21200.  
  21201.   | 100
  21202.  
  21203.  -------------------------------------------------------------------
  21204.  -- body ::= body_stub  
  21205.  
  21206.   | 101 =>
  21207.  
  21208.          New_Line;
  21209.  
  21210.  -------------------------------------------------------------------
  21211.  -- binary_adding_operator ::= +  
  21212.  
  21213.   when 158
  21214.  
  21215.  -------------------------------------------------------------------
  21216.  -- binary_adding_operator ::= -  
  21217.  
  21218.   | 159 =>
  21219.  
  21220.          Put_Space;
  21221.  
  21222.  -------------------------------------------------------------------
  21223.  -- sequence_of_statements ::= {pragma_stm} statement {statement}  
  21224.  
  21225.   when 176 =>
  21226.  
  21227.          Decrease_Indent;
  21228.  
  21229.  -------------------------------------------------------------------
  21230.  -- simple_statement ::= break_point assignment_statement  
  21231.  
  21232.   when 182
  21233.  
  21234.  -------------------------------------------------------------------
  21235.  -- simple_statement ::= break_point exit_statement  
  21236.  
  21237.   | 183
  21238.  
  21239.  -------------------------------------------------------------------
  21240.  -- simple_statement ::= break_return return_statement  
  21241.  
  21242.   | 184
  21243.  
  21244.  -------------------------------------------------------------------
  21245.  -- simple_statement ::= break_point goto_statement  
  21246.  
  21247.   | 185
  21248.  
  21249.  -------------------------------------------------------------------
  21250.  -- simple_statement ::= break_point abort_statement  
  21251.  
  21252.   | 187
  21253.  
  21254.  -------------------------------------------------------------------
  21255.  -- simple_statement ::= break_point raise_statement  
  21256.  
  21257.   | 188
  21258.  
  21259.  -------------------------------------------------------------------
  21260.  -- simple_statement ::= break_point code_statement  
  21261.  
  21262.   | 189
  21263.  
  21264.  -------------------------------------------------------------------
  21265.  -- compound_statement ::= break_point if_statement  
  21266.  
  21267.   | 191
  21268.  
  21269.  -------------------------------------------------------------------
  21270.  -- compound_statement ::= break_point case_statement  
  21271.  
  21272.   | 192
  21273.  
  21274.  -------------------------------------------------------------------
  21275.  -- compound_statement ::= break_point loop_statement  
  21276.  
  21277.   | 193
  21278.  
  21279.  -------------------------------------------------------------------
  21280.  -- compound_statement ::= break_point block_statement  
  21281.  
  21282.   | 194
  21283.  
  21284.  -------------------------------------------------------------------
  21285.  -- compound_statement ::= break_point select_statement  
  21286.  
  21287.   | 196 =>
  21288.  
  21289.          New_Line;
  21290.  
  21291.  -------------------------------------------------------------------
  21292.  -- break_point ::= empty  
  21293.  
  21294.   when 197 =>
  21295.  
  21296.          Add_Breakpoint;
  21297.  
  21298.  -------------------------------------------------------------------
  21299.  -- break_return ::= empty  
  21300.  
  21301.   when 198 =>
  21302.  
  21303.          Start_Return_Statement;
  21304.  
  21305.  -------------------------------------------------------------------
  21306.  -- null_statement ::= NULL ;  
  21307.  
  21308.   when 200 =>
  21309.  
  21310.          New_Line;
  21311.  
  21312.  -------------------------------------------------------------------
  21313.  -- loop_statement ::= [loop_identifier:] FOR loop_parameter IN discrete_range  
  21314.  
  21315.   when 208
  21316.  
  21317.  -------------------------------------------------------------------
  21318.  -- loop_statement ::= [loop_identifier:] FOR loop_parameter IN REVERSE END LOOP 
  21319.  
  21320.   | 209 =>
  21321.  
  21322.          End_For_Loop;
  21323.  
  21324.  -------------------------------------------------------------------
  21325.  -- loop_parameter ::= identifier  
  21326.  
  21327.   when 211 =>
  21328.  
  21329.           Save_Loop_Parameter;
  21330.  
  21331.  -------------------------------------------------------------------
  21332.  -- sequence_of_statements__end_block_statements ::= sequence_of_statements  
  21333.  
  21334.   when 214 =>
  21335.  
  21336.          End_Block_Sequence_of_Statements;
  21337.  
  21338.  -------------------------------------------------------------------
  21339.  -- block_statement ::= [block_identifier:] declare_terminal [identifier] ;  
  21340.  
  21341.   when 215
  21342.  
  21343.  -------------------------------------------------------------------
  21344.  -- block_statement ::= [block_identifier:] begin_end_block [identifier] ;  
  21345.  
  21346.   | 216 =>
  21347.  
  21348.          End_Block_Statement;
  21349.  
  21350.  -------------------------------------------------------------------
  21351.  -- subprogram_declaration ::= subprogram_specification ;  
  21352.  
  21353.   when 224 =>
  21354.  
  21355.          Pop_Identifier;
  21356.  
  21357.  -------------------------------------------------------------------
  21358.  -- subprogram_specification ::= PROCEDURE start_identifier  
  21359.  
  21360.   when 225
  21361.  
  21362.  -------------------------------------------------------------------
  21363.  -- subprogram_specification ::= PROCEDURE start_identifier left_paren  
  21364.  
  21365.   | 226 =>
  21366.  
  21367.          Subprogram_Type ("procedure");
  21368.  
  21369.  -------------------------------------------------------------------
  21370.  -- subprogram_specification ::= FUNCTION designator RETURN type_mark  
  21371.  
  21372.   when 227
  21373.  
  21374.  -------------------------------------------------------------------
  21375.  -- subprogram_specification ::= FUNCTION designator left_paren right_paren  
  21376.  
  21377.   | 228 =>
  21378.  
  21379.          Subprogram_Type ("function");
  21380.  
  21381.  -------------------------------------------------------------------
  21382.  -- designator ::= identifier  
  21383.  
  21384.   when 229
  21385.  
  21386.  -------------------------------------------------------------------
  21387.  -- designator ::= string_literal  
  21388.  
  21389.   | 230 =>
  21390.  
  21391.          Push_Identifier;
  21392.  
  21393.  -------------------------------------------------------------------
  21394.  -- parameter_specification ::= identifier_list mode type_mark [:=expression]  
  21395.  
  21396.   when 231 =>
  21397.  
  21398.          Process_Identifier_List (Parameter_List);
  21399.  
  21400.  -------------------------------------------------------------------
  21401.  -- mode ::= : OUT  
  21402.  
  21403.   when 233 =>
  21404.  
  21405.          Set_Identifier_Mode (Write_Only);
  21406.  
  21407.  -------------------------------------------------------------------
  21408.  -- generic_parameter_mode ::= :  
  21409.  
  21410.   when 234 =>
  21411.  
  21412.          Set_Identifier_Mode (Read_Only);
  21413.  
  21414.  -------------------------------------------------------------------
  21415.  -- generic_parameter_mode ::= : IN  
  21416.  
  21417.   when 235 =>
  21418.  
  21419.          Set_Identifier_Mode (Read_Only);
  21420.  
  21421.  -------------------------------------------------------------------
  21422.  -- generic_parameter_mode ::= : IN OUT  
  21423.  
  21424.   when 236 =>
  21425.  
  21426.          Set_Identifier_Mode (Read_Write);
  21427.  
  21428.  -------------------------------------------------------------------
  21429.  -- subprogram_body ::= subprogram_specification__IS [end_designator] ;  
  21430.  
  21431.   when 237 =>
  21432.  
  21433.          Decrement_Scope;
  21434.  
  21435.  -------------------------------------------------------------------
  21436.  -- call_statement ::= name ;  
  21437.  
  21438.   when 238 =>
  21439.  
  21440.          New_Line;
  21441.  
  21442.  -------------------------------------------------------------------
  21443.  -- package_declaration ::= package_specification ;  
  21444.  
  21445.   when 239 =>
  21446.  
  21447.          Decrement_Scope;
  21448.  
  21449.  -------------------------------------------------------------------
  21450.  -- package_body ::= PACKAGE__BODY__start_identifier__IS  
  21451.  --     declarative_part__no_begin  
  21452.  
  21453.   when 242
  21454.  
  21455.  -------------------------------------------------------------------
  21456.  -- package_body ::= PACKAGE__BODY__start_identifier__IS [identifier] ;  
  21457.  
  21458.   | 243 =>
  21459.  
  21460.          Decrement_Scope;
  21461.  
  21462.  -------------------------------------------------------------------
  21463.  -- declarative_part__no_begin ::= declarative_part  
  21464.  
  21465.   when 244 =>
  21466.  
  21467.          Add_Package_Body_Begin;
  21468.  
  21469.  -------------------------------------------------------------------
  21470.  -- private_type_declaration ::= TYPE type_identifier IS LIMITED PRIVATE ;  
  21471.  
  21472.   when 245 =>
  21473.  
  21474.          Save_Type_Class (Limited_Private_Type);
  21475.  
  21476.  -------------------------------------------------------------------
  21477.  -- private_type_declaration ::= TYPE type_identifier left_paren right_paren IS  
  21478.  
  21479.   when 246 =>
  21480.  
  21481.          Save_Type_Class (Limited_Private_Type);
  21482.  
  21483.  -------------------------------------------------------------------
  21484.  -- private_type_declaration ::= TYPE type_identifier IS PRIVATE ;  
  21485.  
  21486.   when 247 =>
  21487.  
  21488.          Save_Type_Class (Private_Type);
  21489.  
  21490.  -------------------------------------------------------------------
  21491.  -- private_type_declaration ::= TYPE type_identifier left_paren right_paren IS  
  21492.  
  21493.   when 248 =>
  21494.  
  21495.          Save_Type_Class (Private_Type);
  21496.  
  21497.  -------------------------------------------------------------------
  21498.  -- package_name ::= start_expanded_name expanded_name  
  21499.  
  21500.   when 250 =>
  21501.  
  21502.          Use_Package_Name;
  21503.  
  21504.  -------------------------------------------------------------------
  21505.  -- renaming_colon_declaration ::= identifier_list : type_mark RENAMES name ;  
  21506.  
  21507.   when 251
  21508.  
  21509.  -------------------------------------------------------------------
  21510.  -- renaming_colon_declaration ::= identifier_list : EXCEPTION RENAMES ;  
  21511.  
  21512.   | 252 =>
  21513.  
  21514.          Process_Identifier_List (Renaming_List);
  21515.  
  21516.  -------------------------------------------------------------------
  21517.  -- renaming_declaration ::= PACKAGE start_identifier RENAMES expanded_name ;  
  21518.  
  21519.   when 253
  21520.  
  21521.  -------------------------------------------------------------------
  21522.  -- renaming_declaration ::= subprogram_specification RENAMES name ;  
  21523.  
  21524.   | 254
  21525.  
  21526.  -------------------------------------------------------------------
  21527.  -- task_specification ::= TASK start_identifier ;  
  21528.  
  21529.   | 255 =>
  21530.  
  21531.          Pop_Identifier;
  21532.  
  21533.  -------------------------------------------------------------------
  21534.  -- task_specification ::= TASK TYPE start_identifier ;  
  21535.  
  21536.   when 256 =>
  21537.  
  21538.          Pop_Identifier;
  21539.          Save_Type_Class (Task_Type);
  21540.          End_Type_Declaration;
  21541.  
  21542.  -------------------------------------------------------------------
  21543.  -- task_specification ::= TASK__TYPE__start_identifier__IS END [identifier] ;  
  21544.  
  21545.   when 258 =>
  21546.  
  21547.          End_Type_Declaration;
  21548.  
  21549.  -------------------------------------------------------------------
  21550.  -- task_body ::= TASK__BODY__start_identifier__IS [identifier] ;  
  21551.  
  21552.   when 259 =>
  21553.  
  21554.          Decrement_Scope;
  21555.  
  21556.  -------------------------------------------------------------------
  21557.  -- entry_declaration ::= ENTRY identifier [(discrete_range)][formal_part] ;  
  21558.  
  21559.   when 260 =>
  21560.  
  21561.          New_Line;
  21562.  
  21563.  -------------------------------------------------------------------
  21564.  -- accept_statement ::= ACCEPT start_identifier [(expression)][formal_part] ;  
  21565.  
  21566.   when 261 =>
  21567.  
  21568.          Pop_Identifier;
  21569.          New_Line;
  21570.  
  21571.  -------------------------------------------------------------------
  21572.  -- accept_statement ::=  
  21573.  --     ACCEPT__start_identifier__[(expression)][formal_part]__DO  
  21574.  
  21575.   when 262 =>
  21576.  
  21577.          New_Line;
  21578.  
  21579.  -------------------------------------------------------------------
  21580.  -- do_sequence_of_statements ::= sequence_of_statements  
  21581.  
  21582.   when 263 =>
  21583.  
  21584.          End_Do_Sequence_Of_Statements;
  21585.  
  21586.  -------------------------------------------------------------------
  21587.  -- delay_statement ::= DELAY simple_expression ;  
  21588.  
  21589.   when 264 =>
  21590.  
  21591.          New_Line;
  21592.  
  21593.  -------------------------------------------------------------------
  21594.  -- select_alternative ::= {pragma_stm}  
  21595.  
  21596.   when 269
  21597.  
  21598.  -------------------------------------------------------------------
  21599.  -- select_alternative ::= {pragma_stm} selective_wait_alternative  
  21600.  
  21601.   | 270 =>
  21602.  
  21603.          Decrease_Indent;
  21604.  
  21605.  -------------------------------------------------------------------
  21606.  -- TERMINATE__; ::= TERMINATE ;  
  21607.  
  21608.   when 277 =>
  21609.  
  21610.          New_Line;
  21611.  
  21612.  -------------------------------------------------------------------
  21613.  -- accept_statement__decision_point ::= accept_statement  
  21614.  
  21615.   when 280
  21616.  
  21617.  -------------------------------------------------------------------
  21618.  -- delay_statement__decision_point ::= delay_statement  
  21619.  
  21620.   | 281
  21621.  
  21622.  -------------------------------------------------------------------
  21623.  -- call_statement__decision_point ::= call_statement  
  21624.  
  21625.   | 282 =>
  21626.  
  21627.          Add_Breakpoint;
  21628.  
  21629.  -------------------------------------------------------------------
  21630.  -- compilation_unit ::= pragma_header ( general_component_associations ) ;  
  21631.  
  21632.   when 286
  21633.  
  21634.  -------------------------------------------------------------------
  21635.  -- compilation_unit ::= pragma_header ;  
  21636.  
  21637.   | 287 =>
  21638.  
  21639.          New_Line;
  21640.  
  21641.  -------------------------------------------------------------------
  21642.  -- compilation_unit ::= context_clause library_or_secondary_unit  
  21643.  
  21644.   when 288 =>
  21645.  
  21646.          End_Compilation_Unit;
  21647.  
  21648.  -------------------------------------------------------------------
  21649.  -- library_unit_name ::= identifier  
  21650.  
  21651.   when 298 =>
  21652.  
  21653.          With_Library_Unit;
  21654.  
  21655.  -------------------------------------------------------------------
  21656.  -- body_stub ::= subprogram_specification IS SEPARATE ;  
  21657.  
  21658.   when 299
  21659.  
  21660.  -------------------------------------------------------------------
  21661.  -- body_stub ::= PACKAGE BODY start_identifier IS SEPARATE ;  
  21662.  
  21663.   | 300
  21664.  
  21665.  -------------------------------------------------------------------
  21666.  -- body_stub ::= TASK BODY start_identifier IS SEPARATE ;  
  21667.  
  21668.   | 301 =>
  21669.  
  21670.          Pop_Identifier;
  21671.  
  21672.  -------------------------------------------------------------------
  21673.  -- exception_declaration ::= identifier_list : EXCEPTION ;  
  21674.  
  21675.   when 303 =>
  21676.  
  21677.          Process_Identifier_List (Exception_List);
  21678.  
  21679.  -------------------------------------------------------------------
  21680.  -- non_others_handler ::= WHEN__exception_choice__{|exception_choice}__=>  
  21681.  
  21682.   when 306
  21683.  
  21684.  -------------------------------------------------------------------
  21685.  -- others_handler ::= WHEN__exception_OTHERS__=> sequence_of_statements  
  21686.  
  21687.   | 307 =>
  21688.  
  21689.          End_Exception_Sequence_of_Statements;
  21690.  
  21691.  -------------------------------------------------------------------
  21692.  -- generic_specification ::= generic_formal_part subprogram_specification ;  
  21693.  
  21694.   when 311 =>
  21695.  
  21696.          Pop_Identifier;
  21697.  
  21698.  -------------------------------------------------------------------
  21699.  -- generic_specification ::= generic_formal_part package_specification ;  
  21700.  
  21701.   when 312 =>
  21702.  
  21703.          Decrement_Scope;
  21704.  
  21705.  -------------------------------------------------------------------
  21706.  -- generic_formal_part ::= generic_terminal {generic_parameter_declaration}  
  21707.  
  21708.   when 313 =>
  21709.  
  21710.          Decrease_Indent;
  21711.          End_Generic_Specification;
  21712.  
  21713.  -------------------------------------------------------------------
  21714.  -- generic_parameter_declaration ::= identifier_list generic_parameter_mode ;  
  21715.  
  21716.   when 314 =>
  21717.  
  21718.          New_Line;
  21719.          Process_Identifier_List (Generic_Object_List);
  21720.  
  21721.  -------------------------------------------------------------------
  21722.  -- generic_parameter_declaration ::= TYPE generic_type_identifier IS ;  
  21723.  
  21724.   when 315
  21725.  
  21726.  -------------------------------------------------------------------
  21727.  -- generic_parameter_declaration ::= TYPE generic_type_identifier left_paren IS 
  21728.  
  21729.   | 316 =>
  21730.  
  21731.          New_Line;
  21732.          End_Generic_Type;
  21733.  
  21734.  -------------------------------------------------------------------
  21735.  -- generic_parameter_declaration ::= WITH subprogram_specification ;  
  21736.  
  21737.   when 317 =>
  21738.  
  21739.          New_Line;
  21740.          Pop_Identifier;
  21741.  
  21742.  -------------------------------------------------------------------
  21743.  -- generic_type_identifier ::= identifier  
  21744.  
  21745.   when 318 =>
  21746.  
  21747.        Save_Type_Identifier;
  21748.  
  21749.  -------------------------------------------------------------------
  21750.  -- generic_instantiation ::= PACKAGE start_identifier IS__NEW__expanded_name ;  
  21751.  
  21752.   when 327
  21753.  
  21754.  -------------------------------------------------------------------
  21755.  -- generic_instantiation ::= PACKAGE start_identifier IS__NEW__expanded_name (  
  21756.  --     )  
  21757.  
  21758.   | 328
  21759.  
  21760.  -------------------------------------------------------------------
  21761.  -- generic_instantiation ::= FUNCTION designator IS__NEW__expanded_name ;  
  21762.  
  21763.   | 329
  21764.  
  21765.  -------------------------------------------------------------------
  21766.  -- generic_instantiation ::= FUNCTION designator IS__NEW__expanded_name ( ) ;  
  21767.  
  21768.   | 330
  21769.  
  21770.  -------------------------------------------------------------------
  21771.  -- generic_instantiation ::= subprogram_specification IS__NEW__expanded_name ;  
  21772.  
  21773.   | 331
  21774.  
  21775.  -------------------------------------------------------------------
  21776.  -- generic_instantiation ::= subprogram_specification IS__NEW__expanded_name (  
  21777.  --     )  
  21778.  
  21779.   | 332 =>
  21780.  
  21781.          Decrease_Indent;
  21782.          Pop_Identifier;
  21783.  
  21784.  -------------------------------------------------------------------
  21785.  -- IS__NEW__expanded_name ::= generic_instantiation_IS NEW start_expanded_name  
  21786.  
  21787.   when 333 =>
  21788.  
  21789.          Save_Generic_Name;
  21790.  
  21791.  -------------------------------------------------------------------
  21792.  -- generic_instantiation_IS ::= IS  
  21793.  
  21794.   when 334 =>
  21795.  
  21796.          New_Line;
  21797.          Increase_Indent;
  21798.  
  21799.  -------------------------------------------------------------------
  21800.  -- representation_clause ::= record_representation_clause  
  21801.  
  21802.   when 342 =>
  21803.  
  21804.          Decrease_Indent;
  21805.  
  21806.  -------------------------------------------------------------------
  21807.  -- component_clause ::= name AT simple_expression range_constraint ;  
  21808.  
  21809.   when 347 =>
  21810.  
  21811.          New_Line;
  21812.  
  21813.  -------------------------------------------------------------------
  21814.  -- alignment_clause ::= AT MOD simple_expression ;  
  21815.  
  21816.   when 348 =>
  21817.  
  21818.          New_Line;
  21819.          Increase_Indent;
  21820.  
  21821.  -------------------------------------------------------------------
  21822.  -- [loop_identifier:] ::= empty  
  21823.  
  21824.   when 437 =>
  21825.  
  21826.          Push_Empty_Token;
  21827.  
  21828.  -------------------------------------------------------------------
  21829.  -- [loop_identifier:] ::= identifier :  
  21830.  
  21831.   when 438 =>
  21832.  
  21833.          Push_Identifier;
  21834.  
  21835.  -------------------------------------------------------------------
  21836.  -- [identifier] ::= empty  
  21837.  
  21838.   when 439 =>
  21839.  
  21840.          Pop_Identifier(To_Output);
  21841.  
  21842.  -------------------------------------------------------------------
  21843.  -- [identifier] ::= identifier  
  21844.  
  21845.   when 440 =>
  21846.  
  21847.          Pop_Identifier;
  21848.  
  21849.  -------------------------------------------------------------------
  21850.  -- [block_identifier:] ::= empty  
  21851.  
  21852.   when 441 =>
  21853.  
  21854.          Start_Block (False);
  21855.  
  21856.  -------------------------------------------------------------------
  21857.  -- [block_identifier:] ::= identifier :  
  21858.  
  21859.   when 442 =>
  21860.  
  21861.          Push_Identifier;
  21862.          Start_Block (True);
  21863.  
  21864.  -------------------------------------------------------------------
  21865.  -- [exception_handler_part] ::= empty  
  21866.  
  21867.   when 443 =>
  21868.  
  21869.          Add_Exception_Handler;
  21870.  
  21871.  -------------------------------------------------------------------
  21872.  -- {pragma_alt}__exception_handler ::= {pragma_alt} exception_handler  
  21873.  
  21874.   when 445 =>
  21875.  
  21876.          Decrease_Indent;
  21877.  
  21878.  -------------------------------------------------------------------
  21879.  -- [others_handler] ::= empty  
  21880.  
  21881.   when 448 =>
  21882.  
  21883.          Add_Others_Handler;
  21884.  
  21885.  -------------------------------------------------------------------
  21886.  -- [end_designator] ::= empty  
  21887.  
  21888.   when 452 =>
  21889.  
  21890.          Pop_Identifier(To_Output);
  21891.  
  21892.  -------------------------------------------------------------------
  21893.  -- [end_designator] ::= identifier  
  21894.  
  21895.   when 453
  21896.  
  21897.  -------------------------------------------------------------------
  21898.  -- [end_designator] ::= string_literal  
  21899.  
  21900.   | 454 =>
  21901.  
  21902.          Pop_Identifier;
  21903.  
  21904.  -------------------------------------------------------------------
  21905.  -- {with_clause{use_clause}} ::= {with_clause{use_clause}} with_clause  
  21906.  
  21907.   when 478 =>
  21908.  
  21909.          New_Line;
  21910.  
  21911.  -------------------------------------------------------------------
  21912.  -- record_terminal ::= RECORD  
  21913.  
  21914.   when 496 =>
  21915.  
  21916.          New_Line;
  21917.          Increase_Indent;
  21918.  
  21919.  -------------------------------------------------------------------
  21920.  -- start_of_record_type ::= EMPTY  
  21921.  
  21922.   when 499
  21923.  
  21924.  -------------------------------------------------------------------
  21925.  -- repspec_record_terminal ::= RECORD  
  21926.  
  21927.   | 500
  21928.  
  21929.  -------------------------------------------------------------------
  21930.  -- CASE__identifier__IS ::= CASE__identifier IS  
  21931.  
  21932.   | 501
  21933.  
  21934.  -------------------------------------------------------------------
  21935.  -- WHEN__choice__{|choice}__=> ::= WHEN choice {|choice} =>  
  21936.  
  21937.   | 502
  21938.  
  21939.  -------------------------------------------------------------------
  21940.  -- WHEN__OTHERS__=> ::= WHEN OTHERS =>  
  21941.  
  21942.   | 503
  21943.  
  21944.  -------------------------------------------------------------------
  21945.  -- CASE__expression__IS ::= CASE expression IS  
  21946.  
  21947.   | 504 =>
  21948.  
  21949.          New_Line;
  21950.          Increase_Indent;
  21951.  
  21952.  -------------------------------------------------------------------
  21953.  -- generic_terminal ::= GENERIC  
  21954.  
  21955.   when 505 =>
  21956.  
  21957.          Start_Generic_Specification;
  21958.          New_Line;
  21959.          Increase_Indent;
  21960.  
  21961.  -------------------------------------------------------------------
  21962.  -- CASE__identifier ::= CASE identifier  
  21963.  
  21964.   when 506 =>
  21965.  
  21966.          Save_Case_Identifier;
  21967.  
  21968.  -------------------------------------------------------------------
  21969.  -- WHEN__variant_choice__{|variant_choice}__=> ::= WHEN__choice__{|choice}__=>  
  21970.  
  21971.   when 507
  21972.  
  21973.  -------------------------------------------------------------------
  21974.  -- WHEN__variant_OTHERS__=> ::= WHEN__OTHERS__=>  
  21975.  
  21976.   | 508 =>
  21977.  
  21978.          End_Record_Variant;
  21979.  
  21980.  -------------------------------------------------------------------
  21981.  -- WHEN__case_choice__{|choice}__=> ::= WHEN__choice__{|choice}__=>  
  21982.  
  21983.   when 509
  21984.  
  21985.  -------------------------------------------------------------------
  21986.  -- WHEN__case_OTHERS__=> ::= WHEN__OTHERS__=>  
  21987.  
  21988.   | 510 =>
  21989.  
  21990.          Add_Breakpoint;
  21991.  
  21992.  -------------------------------------------------------------------
  21993.  -- {pragma_alt}__case_statement_alternative__{case_statement_alternative} ::=  
  21994.  
  21995.   when 511 =>
  21996.  
  21997.          Decrease_Indent;
  21998.  
  21999.  -------------------------------------------------------------------
  22000.  -- loop_terminal ::= LOOP  
  22001.  
  22002.   when 512 =>
  22003.  
  22004.          New_Line;
  22005.          Increase_Indent;
  22006.  
  22007.  -------------------------------------------------------------------
  22008.  -- begin_terminal ::= BEGIN  
  22009.  
  22010.   when 513 =>
  22011.  
  22012.          New_Line;
  22013.          Increase_Indent;
  22014.          Start_Begin_End_Block;
  22015.  
  22016.  -------------------------------------------------------------------
  22017.  -- {pragma_variant}__variant__{variant} ::= {pragma_variant} variant {variant}  
  22018.  
  22019.   when 514 =>
  22020.  
  22021.          Decrease_Indent;
  22022.  
  22023.  -------------------------------------------------------------------
  22024.  -- declare_terminal ::= DECLARE  
  22025.  
  22026.   when 515 =>
  22027.  
  22028.          New_Line;
  22029.          Increase_Indent;
  22030.  
  22031.  -------------------------------------------------------------------
  22032.  -- PACKAGE__start_identifier__IS ::= PACKAGE start_identifier IS  
  22033.  
  22034.   when 516 =>
  22035.  
  22036.          Increment_Scope (Package_Specification);
  22037.          New_Line;
  22038.          Increase_Indent;
  22039.  
  22040.  -------------------------------------------------------------------
  22041.  -- start_identifier ::= identifier  
  22042.  
  22043.   when 517 =>
  22044.  
  22045.          Push_Identifier;
  22046.  
  22047.  -------------------------------------------------------------------
  22048.  -- {basic_declarative_item}' ::= {basic_declarative_item}  
  22049.  
  22050.   when 518
  22051.  
  22052.  -------------------------------------------------------------------
  22053.  -- {entry_declaration}__{representation_clause} ::= {entry_declaration}  
  22054.  
  22055.   | 519 =>
  22056.  
  22057.          Decrease_Indent;
  22058.  
  22059.  -------------------------------------------------------------------
  22060.  -- private_terminal ::= PRIVATE  
  22061.  
  22062.   when 520 =>
  22063.  
  22064.          New_Line;
  22065.          Increase_Indent;
  22066.          Start_Private_Part;
  22067.  
  22068.  -------------------------------------------------------------------
  22069.  -- PACKAGE__BODY__start_identifier__IS ::= PACKAGE BODY start_identifier IS  
  22070.  
  22071.   when 521 =>
  22072.  
  22073.          Increment_Scope (Package_Body);
  22074.          New_Line;
  22075.          Increase_Indent;
  22076.  
  22077.  -------------------------------------------------------------------
  22078.  -- TASK__start_identifier__IS ::= TASK start_identifier IS  
  22079.  
  22080.   when 522 =>
  22081.  
  22082.          New_Line;
  22083.          Increase_Indent;
  22084.  
  22085.  -------------------------------------------------------------------
  22086.  -- TASK__TYPE__start_identifier__IS ::= TASK TYPE start_identifier IS  
  22087.  
  22088.   when 523 =>
  22089.  
  22090.          New_Line;
  22091.          Increase_Indent;
  22092.          Save_Type_Class (Task_Type);
  22093.  
  22094.  -------------------------------------------------------------------
  22095.  -- TASK__BODY__start_identifier__IS ::= TASK BODY start_identifier IS  
  22096.  
  22097.   when 524 =>
  22098.  
  22099.          Increment_Scope (Task_Body);
  22100.          New_Line;
  22101.          Increase_Indent;
  22102.  
  22103.  -------------------------------------------------------------------
  22104.  -- ACCEPT__start_identifier__[(expression)][formal_part]__DO ::= ACCEPT DO  
  22105.  
  22106.   when 525 =>
  22107.  
  22108.          New_Line;
  22109.          Increase_Indent;
  22110.          Start_Do_Sequence_Of_Statements;
  22111.  
  22112.  -------------------------------------------------------------------
  22113.  -- select_terminal ::= SELECT  
  22114.  
  22115.   when 526 =>
  22116.  
  22117.          New_Line;
  22118.          Increase_Indent;
  22119.  
  22120.  -------------------------------------------------------------------
  22121.  -- call_statement__[sequence_of_statements] ::= call_statement__decision_point  
  22122.  
  22123.   when 527 =>
  22124.  
  22125.          Decrease_Indent;
  22126.  
  22127.  -------------------------------------------------------------------
  22128.  -- delay_alternative_in_timed_entry ::= delay_alternative  
  22129.  
  22130.   when 529
  22131.  
  22132.  -------------------------------------------------------------------
  22133.  -- WHEN__condition__=>__selective_wait_alternative ::= WHEN__condition__=>  
  22134.  
  22135.   | 530 =>
  22136.  
  22137.          Decrease_Indent;
  22138.  
  22139.  -------------------------------------------------------------------
  22140.  -- WHEN__condition__=> ::= WHEN condition =>  
  22141.  
  22142.   when 531
  22143.  
  22144.  -------------------------------------------------------------------
  22145.  -- exception_terminal ::= EXCEPTION  
  22146.  
  22147.   | 532 =>
  22148.  
  22149.          New_Line;
  22150.          Increase_Indent;
  22151.  
  22152.  -------------------------------------------------------------------
  22153.  -- WHEN__exception_choice__{|exception_choice}__=> ::= WHEN exception_choice => 
  22154.  
  22155.   when 533
  22156.  
  22157.  -------------------------------------------------------------------
  22158.  -- WHEN__exception_OTHERS__=> ::= WHEN OTHERS =>  
  22159.  
  22160.   | 534 =>
  22161.  
  22162.          New_Line;
  22163.          Increase_Indent;
  22164.          Start_Exception_Branch;
  22165.  
  22166.  -------------------------------------------------------------------
  22167.  -- subprogram_specification__IS ::= subprogram_specification IS  
  22168.  
  22169.   when 535 =>
  22170.  
  22171.          Increment_Scope (Subprogram_Body);
  22172.          New_Line;
  22173.          Increase_Indent;
  22174.  
  22175.  -------------------------------------------------------------------
  22176.  -- {component_clause}' ::= {component_clause}  
  22177.  
  22178.   when 536 =>
  22179.  
  22180.          Decrease_Indent;
  22181.  
  22182.  -------------------------------------------------------------------
  22183.  -- SEPARATE__(__expanded_name__) ::= SEPARATE__(__expanded_name )  
  22184.  
  22185.   when 537 =>
  22186.  
  22187.          New_Line;
  22188.  
  22189.  -------------------------------------------------------------------
  22190.  -- SEPARATE__(__expanded_name ::= SEPARATE ( start_expanded_name expanded_name  
  22191.  
  22192.   when 538 =>
  22193.  
  22194.          Save_Separate_Name;
  22195.  
  22196.  -------------------------------------------------------------------
  22197.  -- start_expanded_name ::= empty  
  22198.  
  22199.   when 539 =>
  22200.  
  22201.          Start_Saving_Expanded_Name;
  22202.  
  22203.  -------------------------------------------------------------------
  22204.  -- condition__THEN ::= condition THEN  
  22205.  
  22206.   when 546
  22207.  
  22208.  -------------------------------------------------------------------
  22209.  -- ELSIF__condition__THEN ::= ELSIF condition THEN  
  22210.  
  22211.   | 547
  22212.  
  22213.  -------------------------------------------------------------------
  22214.  -- else_terminal ::= ELSE  
  22215.  
  22216.   | 548 =>
  22217.  
  22218.          New_Line;
  22219.          Increase_Indent;
  22220.          Add_Breakpoint;
  22221.  
  22222.  -------------------------------------------------------------------
  22223.  -- or_terminal ::= OR  
  22224.  
  22225.   when 549 =>
  22226.  
  22227.          New_Line;
  22228.          Increase_Indent;
  22229.  
  22230.  -------------------------------------------------------------------
  22231.  -- discriminant__; ::= ;  
  22232.  
  22233.   when 550
  22234.  
  22235.  -------------------------------------------------------------------
  22236.  -- parameter__; ::= ;  
  22237.  
  22238.   | 551 =>
  22239.  
  22240.          New_Line;
  22241.  
  22242.  -------------------------------------------------------------------
  22243.  -- left_paren ::= (  
  22244.  
  22245.   when 552 =>
  22246.  
  22247.          Change_Indent;
  22248.  
  22249.  -------------------------------------------------------------------
  22250.  -- right_paren ::= )  
  22251.  
  22252.   when 553 =>
  22253.  
  22254.          Resume_Normal_Indentation;
  22255.  
  22256.      when others =>
  22257.          null;
  22258.      end case;
  22259.  end Apply_Actions;
  22260.  
  22261. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22262. --SI.ADA
  22263. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22264. with STRING_PKG;
  22265. with Source_Instrumenter_Declarations;   -- Parameters of pretty printer
  22266. with Source_Instrumenter_Utilities;
  22267. with ParserDeclarations;            -- declarations for parser
  22268. with Parser;                        -- contains parse and Apply_Actions
  22269. with TEXT_IO;
  22270. with STRING_IO;
  22271.  
  22272. procedure Source_Instrument(
  22273.     Source_File : in String;
  22274.     Listing_File : in String := "";
  22275.     Instrumented_File : in String := "") is
  22276.  
  22277.     package SID renames Source_Instrumenter_Declarations;
  22278.     package SIU renames Source_Instrumenter_Utilities;
  22279.     package PD  renames ParserDeclarations;
  22280.  
  22281.                          -- Objects --
  22282.  
  22283.     Return_Value : PD.ParseStackElement;
  22284.     Input_File   : TEXT_IO.FILE_TYPE;
  22285.  
  22286.     procedure CLOSE_FILES is
  22287.     begin
  22288.       if TEXT_IO.IS_OPEN(SID.LISTING_FILE) then
  22289.          TEXT_IO.CLOSE(SID.LISTING_FILE);
  22290.       end if;
  22291.       if TEXT_IO.IS_OPEN(SID.INSTRUMENTED_FILE) then      
  22292.          TEXT_IO.CLOSE(SID.INSTRUMENTED_FILE);
  22293.       end if;
  22294.       if TEXT_IO.IS_OPEN(INPUT_FILE) then
  22295.          TEXT_IO.CLOSE(INPUT_FILE);
  22296.       end if;
  22297.       TEXT_IO.SET_INPUT(TEXT_IO.STANDARD_INPUT);
  22298.       begin
  22299.         STRING_PKG.RELEASE;
  22300.       exception
  22301.         when others => null;
  22302.       end;
  22303.     end CLOSE_FILES;
  22304.  
  22305. begin
  22306.     STRING_PKG.MARK;
  22307.  
  22308.     TEXT_IO.OPEN(FILE => Input_File,
  22309.                  MODE => TEXT_IO.IN_FILE,
  22310.                  NAME => Source_File);
  22311.  
  22312.     TEXT_IO.CREATE(FILE => SID.LISTING_FILE,
  22313.                    MODE => TEXT_IO.OUT_FILE,
  22314.                    NAME => LISTING_FILE);
  22315.  
  22316.     TEXT_IO.CREATE(FILE => SID.INSTRUMENTED_FILE,
  22317.                    MODE => TEXT_IO.OUT_FILE,
  22318.                    NAME => INSTRUMENTED_FILE);
  22319.  
  22320.     SIU.Initialize;
  22321.  
  22322.     TEXT_IO.SET_INPUT(Input_File);
  22323.     Return_Value := Parser.Parse;
  22324.  
  22325.     -- print any comments following the last token in the file.
  22326.     SIU.Print_Comments(SIU.Comment_Buffer);
  22327.     CLOSE_FILES;
  22328.  
  22329. exception
  22330.     when TEXT_IO.NAME_ERROR =>
  22331.         TEXT_IO.NEW_LINE;
  22332.         TEXT_IO.PUT_LINE("ERROR:  Invalid compilation unit name.");
  22333.         CLOSE_FILES;
  22334.  
  22335.     when PD.Parser_Error =>
  22336.         TEXT_IO.NEW_LINE;
  22337.         TEXT_IO.PUT_LINE(ITEM => "Syntax Error in Source: Line: " &
  22338.             NATURAL'image(PD.CurToken.lexed_token.srcpos_line) &
  22339.             " Column: " & NATURAL'image(
  22340.             PD.CurToken.lexed_token.srcpos_column));
  22341.         CLOSE_FILES;
  22342.  
  22343.     -- Handle others in driver.
  22344.     when others =>
  22345.         CLOSE_FILES;
  22346.         raise;
  22347. end Source_Instrument;
  22348.  
  22349. ---------------------------------------------------------------------
  22350. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22351. --WIS_DEBUG.ADA
  22352. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22353. with SYSTEM_PARAMETERS; use SYSTEM_PARAMETERS;
  22354. with SOURCE_INSTRUMENT;
  22355. with TEXT_IO; use TEXT_IO; 
  22356. with SD_TYPE_DEFINITIONS; use SD_TYPE_DEFINITIONS; 
  22357. with STRING_PKG; use STRING_PKG; 
  22358. with STRING_UTILITIES; use STRING_UTILITIES;
  22359. with SD_BUFFER_FILES;
  22360. with CATALOG_PKG;
  22361. with WD_HELP;
  22362. with SYSDEP;
  22363.  
  22364. procedure WIS_DEBUG is 
  22365. --| overview
  22366. --| Test_tools is a shell to incorporate all of the tools together and 
  22367. --| interface with the user.  The user may enter parameters on the command
  22368. --| line or he will be prompted for them.
  22369.  
  22370.  
  22371.   type COMMAND_TYPE is (SOURCE_INSTRUMENT, SET_LIBRARY, COMPILE, LINK, RUN,
  22372.     SYSTEM_COMMAND, DELETE, UNKNOWN, HELP, QUIT);  
  22373.    --| acceptable options
  22374.   COMMAND             : COMMAND_TYPE := UNKNOWN;  --| user entered option
  22375.   MAXLINE             : INTEGER := MAX_SOURCE_LINE_LENGTH;
  22376.          --| maximum length of input string
  22377.   BLANKS              : STRING(1 .. MAXLINE) := (others => ' '); 
  22378.   COMMAND_LINE        : STRING(1 .. MAXLINE); --| user input string
  22379.   COMMAND_INDEX       : NATURAL; --| position in input string
  22380.   END_INDEX           : NATURAL; --| last position in input string
  22381.   LINE_LENGTH         : INTEGER := 80; --| length of input string
  22382.   SOURCE_FILE         : FILENAME; --| user specified parameter
  22383.   SOURCE_LISTING      : FILENAME; --| user specified parameter 
  22384.   INSTRUMENTED_SOURCE : FILENAME; --| user specified parameter 
  22385.   COMPILATION_UNIT    : FILENAME; --| user specified parameter
  22386.   COMMAND_TO_EXECUTE  : STRING_TYPE; --| user specified command 
  22387.   PARAMETER_FOUND     : BOOLEAN := FALSE; 
  22388.   TEMPFILE            : TEXT_IO.FILE_TYPE; --| for deleting source_listing
  22389.  
  22390.   procedure GET_COMMAND( --| Extract command from a string
  22391.                         COMMAND_LINE : in STRING;  --| input string
  22392.                         COMMAND      : out COMMAND_TYPE;  --| returned command
  22393.                         ARG_INDEX    : out INTEGER) --| end position of command
  22394.   is 
  22395.     I : INTEGER; 
  22396.   begin
  22397.     I := COMMAND_LINE'FIRST - 1;
  22398.     loop
  22399.       I := I + 1; 
  22400.       if I > COMMAND_LINE'LAST then 
  22401.         COMMAND := UNKNOWN; 
  22402.         return; 
  22403.       end if; 
  22404.       if COMMAND_LINE(I) /= ' ' then 
  22405.  
  22406.         -- clear blanks
  22407.         if COMMAND_LINE(I) = '?' then 
  22408.           COMMAND := HELP; 
  22409.         elsif COMMAND_LINE(I) = 'H' then 
  22410.           COMMAND := HELP; 
  22411.         elsif COMMAND_LINE(I) = 'D' then 
  22412.           COMMAND := DELETE; 
  22413.         elsif COMMAND_LINE(I) = 'C' then 
  22414.           COMMAND := COMPILE; 
  22415.         elsif COMMAND_LINE(I) = 'R' then 
  22416.           COMMAND := RUN; 
  22417.         elsif COMMAND_LINE(I .. I + 1) = "QU" then 
  22418.           COMMAND := QUIT; 
  22419.         elsif COMMAND_LINE(I .. I + 1) = "EX" then 
  22420.           COMMAND := QUIT; 
  22421.         elsif COMMAND_LINE(I .. I + 1) = "SO" then 
  22422.           COMMAND := SOURCE_INSTRUMENT; 
  22423.         elsif COMMAND_LINE(I .. I + 1) = "SI" then 
  22424.           COMMAND := SOURCE_INSTRUMENT; 
  22425.         elsif COMMAND_LINE(I .. I + 1) = "SE" then 
  22426.           COMMAND := SET_LIBRARY; 
  22427.         elsif COMMAND_LINE(I .. I + 1) = "SY" then 
  22428.           COMMAND := SYSTEM_COMMAND;
  22429.         elsif COMMAND_LINE(I .. I + 2) = "LIB" then 
  22430.           COMMAND := SET_LIBRARY; 
  22431.         elsif COMMAND_LINE(I .. I + 2) = "LIN" then 
  22432.           COMMAND := LINK; 
  22433.         else 
  22434.           COMMAND := UNKNOWN; 
  22435.           PUT("unrecognized command"); 
  22436.         end if; 
  22437.         exit; 
  22438.       end if; 
  22439.     end loop; 
  22440.     while (COMMAND_LINE(I) /= '(' and I /= LINE_LENGTH) loop
  22441.       -- strip off the rest of the command
  22442.       I := I + 1; 
  22443.     end loop; 
  22444.     if COMMAND_LINE(I) = '(' and I = COMMAND_LINE'LAST then
  22445.       -- if the last character is '(', ignore it
  22446.       I := I + 1;
  22447.     end if;
  22448.     ARG_INDEX := I; 
  22449.   exception
  22450.     when CONSTRAINT_ERROR => 
  22451.       PUT("unrecognized command"); 
  22452.       COMMAND := UNKNOWN; 
  22453.   end GET_COMMAND; 
  22454.  
  22455.   function FILE_EXISTS(FILE_NAME : in STRING) return BOOLEAN is
  22456.   begin
  22457.     OPEN(TEMPFILE, IN_FILE, FILE_NAME);
  22458.     CLOSE(TEMPFILE);
  22459.     return TRUE;
  22460.   exception
  22461.     when others =>
  22462.       return FALSE;
  22463.   end;
  22464.  
  22465.  
  22466.   procedure GET_NAMED_PARAMETER( --| find Parameter_Name in String_To_search
  22467.                                 STRING_TO_SEARCH : in STRING;
  22468.                                 PARAMETER_NAME   : in STRING;
  22469.                                 PARAMETER_FOUND  : out FILENAME;
  22470.                                 FOUND            : in out BOOLEAN)
  22471.   -- Get_Named_Parameters will search String_To_Search for Parameter_Found,
  22472.   -- if found, Parameter_Found is set to the string following => and
  22473.   -- terminated by a comma or ).  All blanks are removed and letters are
  22474.   -- capitalized.  Found is true if Parameter_Name is found.
  22475.  
  22476.   is
  22477.     ASSIGNMENT_POSITION : INTEGER;
  22478.     BEGINING_OF_STRING  : INTEGER := STRING_TO_SEARCH'FIRST;
  22479.     END_OF_STRING       : INTEGER;
  22480.   begin
  22481.     FOUND := FALSE;
  22482.     ASSIGNMENT_POSITION := POSITION_OF("=>", STRING_TO_SEARCH);
  22483.     while not FOUND and ASSIGNMENT_POSITION /= 0 loop
  22484.       END_OF_STRING := POSITION_OF(',', STRING_TO_SEARCH(
  22485.         ASSIGNMENT_POSITION + 2 .. STRING_TO_SEARCH'LAST));
  22486.       if END_OF_STRING = 0 then
  22487.         -- no comma found so this must be the last parameter
  22488.         END_OF_STRING := POSITION_OF_REVERSE(')', STRING_TO_SEARCH);
  22489.         if END_OF_STRING = 0 then
  22490.           -- no ) found so take the remainder of the string as input
  22491.           END_OF_STRING := STRING_TO_SEARCH'LAST;
  22492.         else 
  22493.           -- don't include the ) in the name
  22494.           END_OF_STRING := END_OF_STRING - 1;
  22495.         end if;
  22496.       else 
  22497.         -- don't include the comma in the name
  22498.         END_OF_STRING := END_OF_STRING - 1;
  22499.       end if;
  22500.       if STRIP_BLANKS(STRING_TO_SEARCH(BEGINING_OF_STRING .. 
  22501.         ASSIGNMENT_POSITION - 1))'LENGTH = PARAMETER_NAME'LENGTH and then
  22502.         STRIP_BLANKS(STRING_TO_SEARCH(
  22503.         BEGINING_OF_STRING .. ASSIGNMENT_POSITION - 1)) = 
  22504.         PARAMETER_NAME then
  22505.         -- Parameter name matches 
  22506.         FOUND := TRUE;
  22507.         PARAMETER_FOUND := CREATE(STRIP_BLANKS(STRING_TO_SEARCH(
  22508.           ASSIGNMENT_POSITION + 2 .. END_OF_STRING)));
  22509.       else
  22510.         -- check next parameter
  22511.         ASSIGNMENT_POSITION := POSITION_OF("=>", STRING_TO_SEARCH(
  22512.           ASSIGNMENT_POSITION + 2 .. STRING_TO_SEARCH'LAST));
  22513.         if END_OF_STRING < STRING_TO_SEARCH'LAST and then STRING_TO_SEARCH(
  22514.           END_OF_STRING + 1) /= ')' then
  22515.           -- there is another parameter
  22516.           BEGINING_OF_STRING := END_OF_STRING + 2;
  22517.         else
  22518.           ASSIGNMENT_POSITION := 0;
  22519.         end if;
  22520.       end if;
  22521.     end loop;
  22522.   end GET_NAMED_PARAMETER;
  22523.  
  22524.   function VALID_FILE(FILE_NAME : in STRING) return BOOLEAN is
  22525.   -- return true if file_name is a valid filename
  22526.   begin
  22527.     CREATE(TEMPFILE, OUT_FILE, FILE_NAME);
  22528.     DELETE(TEMPFILE);
  22529.     return TRUE;
  22530.   exception
  22531.     when others =>
  22532.       return FALSE;
  22533.   end;
  22534.  
  22535.   procedure GET_SOURCE_FILE( --| get source file from user
  22536.                             SOURCE_FILE : out FILENAME) --| source file name
  22537.   is 
  22538.   --| source file is a required parameter for the source instrumenter and the 
  22539.   --| compiler.
  22540.   --| The user will be prompted until a file name is entered.
  22541.     INPUT_STRING : STRING(1 .. MAXLINE) := BLANKS; 
  22542.      --| string retreived from terminal
  22543.     LINE_LENGTH  : INTEGER := MAXLINE;  --| length of input_String
  22544.   begin
  22545.     loop
  22546.       while INPUT_STRING(1 .. LINE_LENGTH) = BLANKS(1 .. LINE_LENGTH) loop
  22547.         PUT("Enter Source_File => "); 
  22548.         GET_LINE(INPUT_STRING, LINE_LENGTH); 
  22549.       end loop; 
  22550.       if FILE_EXISTS(STRIP_BLANKS(INPUT_STRING(1 .. LINE_LENGTH))) then
  22551.         SOURCE_FILE := CREATE(STRIP_BLANKS(INPUT_STRING(1 .. LINE_LENGTH))); 
  22552.         exit;
  22553.       end if;
  22554.       NEW_LINE;
  22555.       PUT_LINE("ERROR:  Source file has invalid name or does not exist.");
  22556.       NEW_LINE;
  22557.       INPUT_STRING := BLANKS;
  22558.     end loop;
  22559.   end GET_SOURCE_FILE; 
  22560.  
  22561.   procedure GET_COMPILATION_UNIT( --| get compilation unit name from user
  22562.                                  COMPILATION_UNIT : out FILENAME)
  22563.   is 
  22564.   --| compilation unit is required for link and execution of instrumented code.
  22565.   --| The user will be prompted until a compilation unit is entered.
  22566.  
  22567.     INPUT_STRING : STRING(1 .. MAXLINE) := BLANKS; 
  22568.      --| string retreived from terminal
  22569.     LINE_LENGTH  : INTEGER := MAXLINE;  --| length of input_String
  22570.   begin
  22571.     while INPUT_STRING(1 .. LINE_LENGTH) = BLANKS(1 .. LINE_LENGTH) loop
  22572.       PUT("Enter Compilation_Unit => "); 
  22573.       GET_LINE(INPUT_STRING, LINE_LENGTH); 
  22574.     end loop; 
  22575.     COMPILATION_UNIT := CREATE(STRIP_BLANKS(INPUT_STRING(1 .. LINE_LENGTH))); 
  22576.     INPUT_STRING := BLANKS;
  22577.   end GET_COMPILATION_UNIT; 
  22578.  
  22579.   procedure GET_ARGUMENTS --| get necessary file names for tool
  22580.   is 
  22581.     FOUND              : BOOLEAN; 
  22582.     PRINT_BUFFER       : STRING(1 .. 80); 
  22583.     BEGINING_OF_STRING : INTEGER;
  22584.     END_OF_STRING      : INTEGER;
  22585.     STRING_INDEX       : INTEGER;
  22586.  
  22587.  
  22588.  
  22589.     procedure GET_SOURCE_LISTING( --| get listing file name from user
  22590.                               SOURCE_FILE    : in FILENAME; 
  22591.                                       --| source name for default
  22592.                               SOURCE_LISTING : out FILENAME) 
  22593.                                       --| source listing file name
  22594.     is 
  22595.       -- Source_Listing is an optional parameter.  The user will be prompted
  22596.       -- for the file name.  If nothing is entered, a temporary file will be
  22597.       -- created and deleted after instrumentation.
  22598.  
  22599.       INPUT_STRING  : STRING(1 .. MAXLINE) := BLANKS;
  22600.        --| string retreived from terminal
  22601.       LINE_LENGTH   : INTEGER := MAXLINE;  --| length of input_string
  22602.     begin
  22603.       loop
  22604.         PUT("Enter Source_Listing_File => "); 
  22605.         GET_LINE(INPUT_STRING, LINE_LENGTH); 
  22606.         if INPUT_STRING(1 .. LINE_LENGTH) = BLANKS(1 .. LINE_LENGTH) then 
  22607.           -- no report file specified, use default
  22608.           SOURCE_LISTING := CREATE("");
  22609.           exit;
  22610.         else
  22611.           if VALID_FILE(STRIP_BLANKS(INPUT_STRING(1..LINE_LENGTH))) then
  22612.             SOURCE_LISTING := CREATE(STRIP_BLANKS(INPUT_STRING(1 .. LINE_LENGTH))); 
  22613.             exit;
  22614.           else
  22615.             NEW_LINE;
  22616.             PUT_LINE("ERROR : Invalid listing file name.");
  22617.             NEW_LINE;
  22618.           end if;
  22619.         end if; 
  22620.       end loop;
  22621.     end GET_SOURCE_LISTING;
  22622.  
  22623.     procedure GET_INSTRUMENTED_SOURCE(
  22624.                                      --| get instrumented source file from user
  22625.                                       SOURCE_FILE         : in FILENAME; 
  22626.                                          --| source name for default
  22627.                                       INSTRUMENTED_SOURCE : out FILENAME)
  22628.                                                   --| instrumented file name
  22629.     is 
  22630.       -- Istrumented_Source is an optional parameter.  The user will be prompted
  22631.       -- for the file name.  If nothing is entered, the file name will be
  22632.       -- created by appending .INS to the base Source_File.
  22633.  
  22634.       INPUT_STRING  : STRING(1 .. MAXLINE);  --| string retreived from terminal
  22635.       LINE_LENGTH   : INTEGER := MAXLINE;  --| length of input_String
  22636.       N             : INTEGER;  --| length of name
  22637.       END_OF_STRING : INTEGER;  --| last character in input string
  22638.     begin
  22639.       loop
  22640.         INPUT_STRING := BLANKS; 
  22641.         PUT("Enter Instrumented_Source_File => "); 
  22642.         GET_LINE(INPUT_STRING, LINE_LENGTH); 
  22643.         if INPUT_STRING(1 .. LINE_LENGTH) = BLANKS(1 .. LINE_LENGTH) then 
  22644.           -- instrumented source not specified, create default
  22645.           INPUT_STRING(1 .. LENGTH(SOURCE_FILE)) := VALUE(SOURCE_FILE); 
  22646.           N := SKIP_BLANKS_REVERSE(INPUT_STRING(1..LENGTH(SOURCE_FILE)));
  22647.           END_OF_STRING := N; 
  22648.           while INPUT_STRING(N) /= '.' and INPUT_STRING(N) /= ']' and N > 1 loop
  22649.             N := N - 1; 
  22650.           end loop; 
  22651.           if INPUT_STRING(N) /= '.' then 
  22652.             N := END_OF_STRING + 1; 
  22653.             INPUT_STRING(N) := '.'; 
  22654.           end if; 
  22655.           INPUT_STRING(N + 1 .. N + DEFAULT_INST_FILE_EXT'LENGTH)
  22656.                := DEFAULT_INST_FILE_EXT; 
  22657.           INSTRUMENTED_SOURCE := 
  22658.              CREATE(INPUT_STRING(1 ..  N + DEFAULT_INST_FILE_EXT'LENGTH)); 
  22659.           exit;
  22660.         else 
  22661.           -- instrumented source is specified
  22662.           if VALID_FILE(STRIP_BLANKS(INPUT_STRING(1..LINE_LENGTH))) then
  22663.             INSTRUMENTED_SOURCE := CREATE(STRIP_BLANKS(INPUT_STRING(
  22664.               1 .. LINE_LENGTH))); 
  22665.             exit;
  22666.           else
  22667.             NEW_LINE;
  22668.             PUT_LINE("ERROR : Invalid instrumented source file name.");
  22669.             NEW_LINE;
  22670.           end if;
  22671.         end if; 
  22672.       end loop;
  22673.     end GET_INSTRUMENTED_SOURCE; 
  22674.  
  22675.   begin
  22676.     if COMMAND_LINE(COMMAND_INDEX) /= '(' then
  22677.       GET_SOURCE_FILE(SOURCE_FILE);
  22678.       GET_SOURCE_LISTING(SOURCE_FILE, SOURCE_LISTING);
  22679.       GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22680.     else
  22681.       BEGINING_OF_STRING := COMMAND_INDEX + 1;
  22682.       STRING_INDEX := POSITION_OF("=>", COMMAND_LINE(BEGINING_OF_STRING ..
  22683.         LINE_LENGTH));
  22684.       END_OF_STRING := POSITION_OF(',', COMMAND_LINE(BEGINING_OF_STRING ..
  22685.         LINE_LENGTH));
  22686.       if STRING_INDEX = 0 then
  22687.         -- only positional parameters supplied
  22688.         if END_OF_STRING = 0 then
  22689.           -- no comma, only Source_File is supplied
  22690.           END_OF_STRING := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22691.             BEGINING_OF_STRING .. LINE_LENGTH));
  22692.           if END_OF_STRING = 0 then
  22693.             -- no ) found so accept the rest of the string as Source_File
  22694.             END_OF_STRING := LINE_LENGTH;
  22695.           else 
  22696.             -- don't include the ) in the name
  22697.             END_OF_STRING := END_OF_STRING - 1;
  22698.           end if;
  22699.           SOURCE_FILE := CREATE(STRIP_BLANKS(COMMAND_LINE(BEGINING_OF_STRING
  22700.             .. END_OF_STRING)));
  22701.           if not FILE_EXISTS(VALUE(SOURCE_FILE)) then
  22702.              NEW_LINE;
  22703.              PUT_LINE("ERROR: Source file has invalid name or does not exist.");
  22704.              NEW_LINE;
  22705.              GET_SOURCE_FILE(SOURCE_FILE);
  22706.           end if;
  22707.           GET_SOURCE_LISTING(SOURCE_FILE, SOURCE_LISTING);
  22708.           GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22709.         else
  22710.           -- a comma was found so at least two parameters are supplied
  22711.           SOURCE_FILE := CREATE(STRIP_BLANKS(COMMAND_LINE(BEGINING_OF_STRING
  22712.             .. END_OF_STRING - 1)));
  22713.           if not FILE_EXISTS(VALUE(SOURCE_FILE)) then
  22714.              NEW_LINE;
  22715.              PUT_LINE("ERROR: Source file has invalid name or does not exist.");
  22716.              NEW_LINE;
  22717.              GET_SOURCE_FILE(SOURCE_FILE);
  22718.           end if;
  22719.           BEGINING_OF_STRING := END_OF_STRING + 1;
  22720.           END_OF_STRING := POSITION_OF(',', COMMAND_LINE(BEGINING_OF_STRING
  22721.             .. LINE_LENGTH));
  22722.           if END_OF_STRING = 0 then
  22723.             -- this is the last parameter
  22724.             END_OF_STRING := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22725.               BEGINING_OF_STRING .. LINE_LENGTH));
  22726.             if END_OF_STRING = 0 then
  22727.               -- no ) found so accept the rest of the string as the name
  22728.               END_OF_STRING := LINE_LENGTH;
  22729.             else
  22730.               -- don't include the ) in the name
  22731.               END_OF_STRING := END_OF_STRING - 1;
  22732.             end if;
  22733.             SOURCE_LISTING := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22734.               BEGINING_OF_STRING .. END_OF_STRING)));
  22735.             GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22736.           else
  22737.             -- all three parameters were found
  22738.             SOURCE_LISTING := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22739.               BEGINING_OF_STRING .. END_OF_STRING - 1)));
  22740.             BEGINING_OF_STRING := END_OF_STRING + 1;
  22741.              END_OF_STRING := POSITION_OF(',', COMMAND_LINE(BEGINING_OF_STRING
  22742.               .. LINE_LENGTH));
  22743.             if END_OF_STRING = 0 then
  22744.               END_OF_STRING := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22745.                 BEGINING_OF_STRING .. LINE_LENGTH));
  22746.               if END_OF_STRING = 0 then
  22747.                 -- no ) so accept the rest of the string as the name
  22748.                 END_OF_STRING := LINE_LENGTH;
  22749.               else
  22750.                 -- don't include the ) in the name
  22751.                 END_OF_STRING := END_OF_STRING - 1;
  22752.               end if;
  22753.             else
  22754.               -- don't include the , in the name
  22755.               END_OF_STRING := END_OF_STRING - 1;
  22756.             end if;
  22757.             INSTRUMENTED_SOURCE := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22758.               BEGINING_OF_STRING .. END_OF_STRING)));
  22759.           end if;
  22760.         end if;
  22761.       else
  22762.         -- named parameters were found
  22763.         if END_OF_STRING /= 0 and END_OF_STRING < STRING_INDEX then
  22764.           -- the comma is before the => so the first parameter is positional
  22765.           SOURCE_FILE := CREATE(STRIP_BLANKS(COMMAND_LINE(BEGINING_OF_STRING
  22766.             .. END_OF_STRING - 1)));
  22767.           if not FILE_EXISTS(VALUE(SOURCE_FILE)) then
  22768.              NEW_LINE;
  22769.              PUT_LINE("ERROR: Source file has invalid name or does not exist.");
  22770.              NEW_LINE;
  22771.              GET_SOURCE_FILE(SOURCE_FILE);
  22772.           end if;
  22773.           BEGINING_OF_STRING := END_OF_STRING + 1;
  22774.           END_OF_STRING := POSITION_OF(',', COMMAND_LINE(BEGINING_OF_STRING
  22775.             .. LINE_LENGTH));
  22776.           if END_OF_STRING /= 0 and END_OF_STRING < STRING_INDEX then
  22777.             -- the comma is before the => so te second parameter is positional
  22778.             SOURCE_LISTING := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22779.               BEGINING_OF_STRING .. END_OF_STRING - 1)));
  22780.             BEGINING_OF_STRING := END_OF_STRING + 1;
  22781.             END_OF_STRING := POSITION_OF(',', COMMAND_LINE(
  22782.               BEGINING_OF_STRING .. LINE_LENGTH));
  22783.             if END_OF_STRING /= 0 and END_OF_STRING < STRING_INDEX then
  22784.               -- another positional parameter was found so use it and ignore
  22785.               -- the rest of the string
  22786.               INSTRUMENTED_SOURCE := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22787.                 BEGINING_OF_STRING .. END_OF_STRING - 1)));
  22788.             else
  22789.               GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING .. 
  22790.                 LINE_LENGTH), "INSTRUMENTED_SOURCE_FILE", INSTRUMENTED_SOURCE,
  22791.                 FOUND);
  22792.               if not FOUND then
  22793.                 GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22794.               end if;
  22795.             end if;
  22796.           else
  22797.             GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING .. 
  22798.               LINE_LENGTH), "SOURCE_LISTING_FILE", SOURCE_LISTING, FOUND);
  22799.             if not FOUND then
  22800.               GET_SOURCE_LISTING(SOURCE_FILE, SOURCE_LISTING);
  22801.             end if;
  22802.             GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING .. 
  22803.               LINE_LENGTH), "INSTRUMENTED_SOURCE_FILE", INSTRUMENTED_SOURCE,
  22804.               FOUND);
  22805.             if not FOUND then
  22806.               GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22807.             end if;
  22808.           end if;
  22809.         else
  22810.           GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING ..
  22811.             LINE_LENGTH), "SOURCE_FILE", SOURCE_FILE, FOUND);
  22812.           if not FOUND then
  22813.             GET_SOURCE_FILE(SOURCE_FILE);
  22814.           elsif not FILE_EXISTS(VALUE(SOURCE_FILE)) then
  22815.              NEW_LINE;
  22816.              PUT_LINE("ERROR: Source file has invalid name or does not exist.");
  22817.              NEW_LINE;
  22818.              GET_SOURCE_FILE(SOURCE_FILE);
  22819.           end if;
  22820.           GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING .. 
  22821.             LINE_LENGTH), "SOURCE_LISTING_FILE", SOURCE_LISTING, FOUND);
  22822.           if not FOUND then
  22823.             GET_SOURCE_LISTING(SOURCE_FILE, SOURCE_LISTING);
  22824.           end if;
  22825.           GET_NAMED_PARAMETER(COMMAND_LINE(BEGINING_OF_STRING .. 
  22826.             LINE_LENGTH), "INSTRUMENTED_SOURCE_FILE", INSTRUMENTED_SOURCE,
  22827.             FOUND);
  22828.           if not FOUND then
  22829.             GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22830.           end if;
  22831.         end if;
  22832.       end if;            
  22833.     end if;
  22834.     if not VALID_FILE(VALUE(SOURCE_LISTING)) then
  22835.       NEW_LINE;
  22836.       PUT_LINE("ERROR : Invalid listing file name.");
  22837.       NEW_LINE;
  22838.       GET_SOURCE_LISTING(SOURCE_FILE, SOURCE_LISTING);
  22839.     end if;
  22840.     if not VALID_FILE(VALUE(INSTRUMENTED_SOURCE)) then
  22841.       NEW_LINE;
  22842.       PUT_LINE("ERROR : Invalid instrumented source file name.");
  22843.       NEW_LINE;
  22844.       GET_INSTRUMENTED_SOURCE(SOURCE_FILE, INSTRUMENTED_SOURCE);
  22845.     end if;
  22846.     NEW_LINE;
  22847.     NEW_LINE;
  22848.     PRINT_BUFFER := BLANKS; 
  22849.     PRINT_BUFFER(1 .. 14) := "source_file = "; 
  22850.     PRINT_BUFFER(15 .. VALUE(SOURCE_FILE)'LENGTH + 14) := VALUE(SOURCE_FILE); 
  22851.     PUT_LINE(PRINT_BUFFER); 
  22852.     PRINT_BUFFER := BLANKS; 
  22853.     PRINT_BUFFER(1 .. 17) := "source_listing = "; 
  22854.     if not IS_EMPTY(SOURCE_LISTING) then
  22855.       PRINT_BUFFER(18 .. VALUE(SOURCE_LISTING)'LENGTH + 17) := VALUE(
  22856.         SOURCE_LISTING); 
  22857.     end if;
  22858.     PUT_LINE(PRINT_BUFFER); 
  22859.     PRINT_BUFFER := BLANKS;
  22860.     PRINT_BUFFER(1 .. 22) := "instrumented_source = "; 
  22861.     PRINT_BUFFER(23 .. VALUE(INSTRUMENTED_SOURCE)'LENGTH + 22) := VALUE(
  22862.       INSTRUMENTED_SOURCE); 
  22863.     PUT_LINE(PRINT_BUFFER); 
  22864.   
  22865.   end GET_ARGUMENTS; 
  22866.  
  22867.  
  22868. begin
  22869.   NEW_LINE; 
  22870.   COMMAND_LINE := BLANKS; 
  22871.   PUT_LINE("SYMBOLIC DEBUGGER - VERSION 1.0"); 
  22872.   PUT_LINE("SOURCE INSTRUMENTER AND PROGRAM LIBRARY MANAGEMENT"); 
  22873.   NEW_LINE;
  22874.   PUT_LINE("Enter a new program library name or RETURN to continue");
  22875.   PUT("[Current Directory] >> ");
  22876.   GET_LINE(COMMAND_LINE, LINE_LENGTH);
  22877.   if LINE_LENGTH /= COMMAND_LINE'FIRST - 1 then
  22878.     CURRENT_PROGRAM_LIBRARY := CREATE(COMMAND_LINE(COMMAND_LINE'FIRST ..
  22879.       LINE_LENGTH));
  22880.     PUT_LINE("lib = " & VALUE(CURRENT_PROGRAM_LIBRARY));
  22881.   end if;
  22882.   NEW_LINE;
  22883.   PUT_LINE("please enter desired option"); 
  22884.   PUT_LINE("enter ? for a list of options available"); 
  22885.   GET_LINE(COMMAND_LINE, LINE_LENGTH); 
  22886.   COMMAND_LINE(1 .. LINE_LENGTH) := STRING_UTILITIES.UPPER_CASE(COMMAND_LINE(
  22887.     1 .. LINE_LENGTH));
  22888.   NEW_LINE; 
  22889.   GET_COMMAND(COMMAND_LINE(COMMAND_LINE'FIRST .. LINE_LENGTH), COMMAND, 
  22890.     COMMAND_INDEX); 
  22891.   while COMMAND /= QUIT loop
  22892.     case COMMAND is
  22893.       when SOURCE_INSTRUMENT =>
  22894.         GET_ARGUMENTS;
  22895.         SOURCE_INSTRUMENT(VALUE(SOURCE_FILE), VALUE(SOURCE_LISTING), 
  22896.         VALUE(INSTRUMENTED_SOURCE)); 
  22897.         NEW_LINE;
  22898.         PUT("Do you wish to compile the instrumented source (Y/N)?  ");
  22899.         GET_LINE(COMMAND_LINE, LINE_LENGTH);
  22900.         NEW_LINE;
  22901.         if COMMAND_LINE(1) = 'Y' or COMMAND_LINE(1) = 'y' then
  22902.           SYSDEP.SD_COMPILE(VALUE(INSTRUMENTED_SOURCE));
  22903.         end if;
  22904.       when SET_LIBRARY =>
  22905.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  22906.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  22907.             "CURRENT_PROGRAM_LIBRARY", CURRENT_PROGRAM_LIBRARY, 
  22908.             PARAMETER_FOUND);
  22909.           if not PARAMETER_FOUND then
  22910.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22911.               COMMAND_INDEX .. LINE_LENGTH));
  22912.             if END_INDEX = 0 then
  22913.               END_INDEX := LINE_LENGTH;
  22914.             else
  22915.               END_INDEX := END_INDEX - 1;
  22916.             end if;
  22917.             CURRENT_PROGRAM_LIBRARY := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22918.               COMMAND_INDEX + 1 .. END_INDEX)));
  22919.             begin
  22920.               OPEN(TEMPFILE, IN_FILE, TEMP_CPLFILE);
  22921.               DELETE(TEMPFILE);
  22922.             exception 
  22923.               when others =>
  22924.                 null;
  22925.             end;
  22926.             CREATE(TEMPFILE, OUT_FILE, TEMP_CPLFILE);
  22927.             PUT_LINE(TEMPFILE, VALUE(CURRENT_PROGRAM_LIBRARY));
  22928.             CLOSE(TEMPFILE);
  22929.           end if;
  22930.           put_line("lib = " & value(current_program_library));
  22931.         else
  22932.           PUT_LINE("SET_LIBRARY requires a parameter, CURRENT_PROGRAM_LIBRARY");
  22933.         end if;
  22934.       when DELETE =>
  22935.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  22936.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  22937.             "UNIT_NAME", SOURCE_FILE, PARAMETER_FOUND);
  22938.           if not PARAMETER_FOUND then
  22939.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22940.               COMMAND_INDEX .. LINE_LENGTH));
  22941.             if END_INDEX = 0 then
  22942.               END_INDEX := LINE_LENGTH;
  22943.             else
  22944.               END_INDEX := END_INDEX - 1;
  22945.             end if;
  22946.             SD_BUFFER_FILES.PURGE_PACKAGE_FILES(STRIP_BLANKS(COMMAND_LINE(
  22947.               COMMAND_INDEX + 1 .. END_INDEX)));
  22948.             CATALOG_PKG.REMOVE_CATALOG_FILE(STRIP_BLANKS(COMMAND_LINE(
  22949.               COMMAND_INDEX + 1 .. END_INDEX)));
  22950.           else
  22951.             SD_BUFFER_FILES.PURGE_PACKAGE_FILES(VALUE(SOURCE_FILE));
  22952.             CATALOG_PKG.REMOVE_CATALOG_FILE(VALUE(SOURCE_FILE));
  22953.           end if;
  22954.         else
  22955.           PUT_LINE("DELETE requires a parameter, UNIT_NAME");
  22956.         end if;
  22957.       when COMPILE =>
  22958.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  22959.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  22960.             "SOURCE_FILE", SOURCE_FILE, PARAMETER_FOUND);
  22961.           if not PARAMETER_FOUND then
  22962.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22963.               COMMAND_INDEX .. LINE_LENGTH));
  22964.             if END_INDEX = 0 then
  22965.               END_INDEX := LINE_LENGTH;
  22966.             else
  22967.               END_INDEX := END_INDEX - 1;
  22968.             end if;
  22969.             SOURCE_FILE := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22970.               COMMAND_INDEX + 1 .. END_INDEX)));
  22971.           end if;
  22972.         else GET_SOURCE_FILE(SOURCE_FILE);
  22973.         end if;
  22974.         SYSDEP.SD_COMPILE(VALUE(SOURCE_FILE));
  22975.       when LINK =>
  22976.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  22977.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  22978.             "COMPILATION_UNIT", COMPILATION_UNIT, PARAMETER_FOUND);
  22979.           if not PARAMETER_FOUND then
  22980.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22981.               COMMAND_INDEX .. LINE_LENGTH));
  22982.             if END_INDEX = 0 then
  22983.               END_INDEX := LINE_LENGTH;
  22984.             else
  22985.               END_INDEX := END_INDEX - 1;
  22986.             end if;
  22987.             COMPILATION_UNIT := CREATE(STRIP_BLANKS(COMMAND_LINE(
  22988.               COMMAND_INDEX + 1 .. END_INDEX)));
  22989.           end if;
  22990.         else GET_COMPILATION_UNIT(COMPILATION_UNIT);
  22991.         end if;
  22992.         SYSDEP.SD_LINK(VALUE(COMPILATION_UNIT));
  22993.       when RUN =>
  22994.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  22995.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  22996.             "COMPILATION_UNIT", COMPILATION_UNIT, PARAMETER_FOUND);
  22997.           if not PARAMETER_FOUND then
  22998.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  22999.               COMMAND_INDEX .. LINE_LENGTH));
  23000.             if END_INDEX = 0 then
  23001.               END_INDEX := LINE_LENGTH;
  23002.             else
  23003.               END_INDEX := END_INDEX - 1;
  23004.             end if;
  23005.             COMPILATION_UNIT := CREATE(STRIP_BLANKS(COMMAND_LINE(
  23006.               COMMAND_INDEX + 1 .. END_INDEX)));
  23007.           end if;
  23008.         else GET_COMPILATION_UNIT(COMPILATION_UNIT);
  23009.         end if;
  23010.         SYSDEP.SD_RUN(VALUE(COMPILATION_UNIT));
  23011.       when SYSTEM_COMMAND =>
  23012.         if COMMAND_LINE(COMMAND_INDEX) = '(' then
  23013.           GET_NAMED_PARAMETER(COMMAND_LINE(COMMAND_INDEX + 1 .. LINE_LENGTH),
  23014.             "COMMAND", COMMAND_TO_EXECUTE, PARAMETER_FOUND);
  23015.           if not PARAMETER_FOUND then
  23016.             END_INDEX := POSITION_OF_REVERSE(')', COMMAND_LINE(
  23017.               COMMAND_INDEX + 1 .. LINE_LENGTH));
  23018.             if END_INDEX = 0 then
  23019.               END_INDEX := LINE_LENGTH;
  23020.             else
  23021.               END_INDEX := END_INDEX - 1;
  23022.             end if;
  23023.             SYSDEP.SD_SYS(COMMAND_LINE(COMMAND_INDEX + 1 .. END_INDEX));
  23024.           else
  23025.             SYSDEP.SD_SYS(VALUE(COMMAND_TO_EXECUTE));
  23026.           end if;
  23027.         else
  23028.           PUT_LINE("SYSTEM_COMMAND requires a parameter, COMMAND");
  23029.         end if;
  23030.       when HELP =>
  23031.         WD_HELP.HELP(VALUE(BASE_PROGRAM_LIBRARY) & "WISDEBUG.HLP",
  23032.           COMMAND_LINE(1 .. LINE_LENGTH));
  23033.       when OTHERS =>
  23034.         null;
  23035.     end case;
  23036.     NEW_LINE; 
  23037.     COMMAND := UNKNOWN; 
  23038.     COMMAND_LINE := BLANKS; 
  23039.     PUT_LINE("please enter desired option"); 
  23040.     GET_LINE(COMMAND_LINE, LINE_LENGTH); 
  23041.     COMMAND_LINE(1 .. LINE_LENGTH) := STRING_UTILITIES.UPPER_CASE(COMMAND_LINE(
  23042.       1 .. LINE_LENGTH));
  23043.     NEW_LINE; 
  23044.     GET_COMMAND(COMMAND_LINE(COMMAND_LINE'FIRST .. LINE_LENGTH), COMMAND, 
  23045.       COMMAND_INDEX); 
  23046.   end loop; 
  23047.   OPEN(TEMPFILE, IN_FILE, TEMP_CPLFILE);
  23048.   DELETE(TEMPFILE);
  23049. exception
  23050.   when NAME_ERROR =>
  23051.     null;
  23052. end WIS_DEBUG;
  23053.