home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / metric / halstead.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  1007.0 KB  |  29,927 lines

  1. ::::::::::::::
  2. block_u.bdy
  3. ::::::::::::::
  4. --VMS file: %nosc.work.tools.halstead.source*(block_u.bdy)
  5. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.bdy
  6. -- $Source: /nosc/work/tools/halstead/RCS/block_u.bdy,v $
  7. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:46 $ -- $Author: buddy $
  8.      
  9. --pragma revision ("$Revision: 1.2 $");
  10.      
  11. with ML_Source_Position_Pkg;
  12. package body Block_Utilities is
  13.      
  14.     package MLSP renames ML_Source_Position_Pkg;
  15. --------------------------------------------------------------------------
  16. --                          LOCAL SUBPROGRAMS
  17. --------------------------------------------------------------------------
  18.      
  19.     function Is_Source_Position_Null (
  20.         Position :in    MLSP.Source_Position
  21.     ) return boolean;
  22.      
  23.     --| OVERVIEW
  24.     --| This procedure returns true if the source position passed in
  25.     --| is null.  This means that column and line of the
  26.     --| Position.first_location is 0.
  27.      
  28. --------------------------------------------------------------------------
  29.      
  30.     function In_Declare_Block (  --| This function determines whether
  31.                                  --| we are in a block with declarations.
  32.                                  --| If we are it returns true otherwise
  33.                                  --| false.
  34.                       block :in     BLOCK_STUB.Locator
  35.     ) return boolean is
  36.      
  37.         use SeqOfITEM;
  38.         I :Generator;
  39.      
  40.     begin
  41.         --| OVERVIEW
  42.         --| This function is used to determined if in fact the block
  43.         --| passed in is a block with explicit declarations which
  44.         --| means the token declare appears in the source program.
  45.         --| This is determined by walking down the list of declarations
  46.         --| until something which is not an implicit label is encountered.
  47.         --| Implicit labels are inserted in the as_item_s list
  48.         --| of the enclosing block.  Thus if the only elements of the
  49.         --| as_item_s of the block are implicit_labels then the token
  50.         --| declare does not appear in the source program.
  51.      
  52.         StartForward (as_item_s (block), I);
  53.         while not Finished(I) loop
  54.             case Kind (Cell (I)) is
  55.               when implicit_label_declKind =>
  56.                 Forward (I);
  57.               when others =>
  58.                 EndIterate (I);
  59.                 return true;
  60.             end case;
  61.         end loop;
  62.         EndIterate (I);
  63.         return false;
  64.     end In_declare_block;
  65.      
  66. --------------------------------------------------------------------------
  67.      
  68.     function Is_Block_Labeled ( --| This function returns true
  69.                                 --| if the block passed in has a label
  70.                                 --| and returns false otherwise.
  71.         block :in     block_stmNode.Locator
  72.     ) return boolean is
  73.     begin
  74.         return not Is_Source_Position_Null (
  75.                  lx_srcpos (as_block_label (block))
  76.                                            );
  77.     end;
  78.      
  79. --------------------------------------------------------------------------
  80.      
  81.     function Is_Source_Position_Null (
  82.         Position :in    MLSP.Source_Position
  83.     ) return boolean is
  84.     begin
  85.         return MLSP."=" (Position.first_location,0);
  86.     end;
  87.      
  88. end Block_Utilities;
  89. ::::::::::::::
  90. block_u.spc
  91. ::::::::::::::
  92. --VMS file: %nosc.work.tools.halstead.source*(block_u.spc)
  93. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.spc
  94. -- $Source: /nosc/work/tools/halstead/RCS/block_u.spc,v $
  95. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:09 $ -- $Author: buddy $
  96.      
  97. --pragma revision ("$Revision: 1.2 $");
  98.      
  99.      
  100. with ST_DIANA; use ST_DIANA;
  101. package Block_Utilities is
  102. --------------------------------------------------------------------------
  103.      
  104.     function In_Declare_Block (  --| This function determines whether
  105.                                  --| we are in a block with declarations.
  106.                                  --| If we are it returns true otherwise
  107.                                  --| false.
  108.                       block :in     BLOCK_STUB.Locator
  109.     ) return boolean;
  110.      
  111.      
  112.     function Is_Block_Labeled ( --| This function returns true
  113.                                 --| if the block passed in has a label
  114.                                 --| and returns false otherwise.
  115.         block :in     block_stmNode.Locator
  116.     ) return boolean;
  117. end Block_Utilities;
  118. ::::::::::::::
  119. comlin.bdy
  120. ::::::::::::::
  121. -- $Source: /nosc/work/tools/halstead/RCS/comlin.bdy,v $
  122. -- $Revision: 1.18 $ -- $Date: 85/03/25 21:03:22 $ -- $Author: buddy $
  123. with Text_IO; use Text_IO;
  124. with Int_IO; use Int_IO;
  125. package body CommandLine is
  126.     TokenSeparator :constant character := '%';
  127.      
  128. --------------------------------------------------------------------------
  129.     procedure ScanForChar (
  130.               S     :in     String;
  131.               C     :in     character;
  132.               Start :in     positive;
  133.               Place :   out natural
  134.     ) is
  135.         Temp  :positive := Start;
  136.         Found :boolean := false;
  137.     begin
  138.      
  139.         Place := 0;
  140.         while (Temp <= S'Last) and (not Found) loop
  141.             if S(Temp) = C then
  142.                 Place := Temp;
  143.                 Found := true;
  144.             end if;
  145.             Temp := Temp + 1;
  146.         end loop;
  147.      end;
  148.      
  149. --------------------------------------------------------------------------
  150.      
  151.     function GetNumberOfUnits(
  152.              S     :in    String
  153.     ) return natural is
  154.      
  155.         count :natural := 0;
  156.     begin
  157.         for i in S'Range loop
  158.             if S(i) = TokenSeparator then
  159.                 count := count + 1;
  160.             end if;
  161.         end loop;
  162.         return count;
  163.     end;
  164.      
  165. --------------------------------------------------------------------------
  166.      
  167.     function GetToken (
  168.              S     :in    String;
  169.              Start :in    positive
  170.     ) return String is
  171.         EndOfToken :natural;
  172.     begin
  173.      
  174.         ScanForChar (S, TokenSeparator, Start, EndOfToken);
  175.         if EndOfToken = 0 then
  176.             raise TokenNotFound;
  177.         else
  178.            return S(Start..EndOfToken - 1);
  179.         end if;
  180.      end;
  181.      
  182. --------------------------------------------------------------------------
  183.      
  184.     procedure Advance (
  185.               S     :in     String;
  186.               Start :in out positive
  187.    ) is
  188.    begin
  189.        Start := Start + GetToken (S, Start)'Length + 1;
  190.    end;
  191.      
  192. --------------------------------------------------------------------------
  193.      
  194.     function GetSpec (
  195.              S     :in    String;
  196.              Start :in    positive
  197.     ) return boolean is
  198.     begin
  199.      
  200.         if boolean'Value (GetToken (S, Start)) in false..true then
  201.             return boolean'Value (GetToken (S, Start));
  202.         end if;
  203.     exception
  204.         when CONSTRAINT_ERROR =>
  205.           raise ExpectingBoolean;
  206.     end;
  207.      
  208. --------------------------------------------------------------------------
  209.      
  210.     function IsSubUnit (
  211.              S     :in    String;
  212.              Start :in    positive
  213.     ) return boolean is
  214.         PeriodPosition   :natural;
  215.     begin
  216.         ScanForChar (S, '.', Start, PeriodPosition);
  217.         if (S'First < PeriodPosition) and (PeriodPosition < S'Last) then
  218.             return true;
  219.         else
  220.             return false;
  221.         end if;
  222.     end;
  223.      
  224. --------------------------------------------------------------------------
  225.      
  226.     function GetParent (
  227.              S     :in    String;
  228.              Start :in    positive
  229.     ) return String is
  230.         PeriodPosition :natural;
  231.     begin
  232.         ScanForChar (S, '.', Start, PeriodPosition);
  233.         if PeriodPosition = 0 then
  234.             raise InvalidSubUnit;
  235.         else
  236.             Return S(Start..PeriodPosition - 1);
  237.         end if;
  238.     end;
  239.      
  240. --------------------------------------------------------------------------
  241.      
  242.     function GetSubUnit (
  243.              S     :in    String;
  244.              Start :in    positive
  245.     ) return String is
  246.          PeriodPosition  :natural;
  247.          EndToken        :natural;
  248.     begin
  249.          ScanForChar (S, '.', Start, PeriodPosition);
  250.          ScanForChar (S, TokenSeparator, PeriodPosition, EndToken);
  251.          if EndToken = 0 then
  252.              raise InvalidSubUnit;
  253.          else
  254.              return S(PeriodPosition + 1..EndToken - 1);
  255.          end if;
  256.     end;
  257.      
  258. --------------------------------------------------------------------------
  259.      
  260. end CommandLine;
  261. ::::::::::::::
  262. comlin.spc
  263. ::::::::::::::
  264. -- $Source: /nosc/work/tools/halstead/RCS/comlin.spc,v $
  265. -- $Revision: 1.5 $ -- $Date: 85/03/24 16:17:23 $ -- $Author: buddy $
  266.      
  267. package CommandLine is
  268.     TokenNotFound    :exception;
  269.     ExpectingBoolean :exception;
  270.     InvalidSubUnit   :exception;
  271.      
  272.     function GetNumberOfUnits(
  273.              S     :in    String
  274.     ) return natural;
  275.      
  276. --------------------------------------------------------------------------
  277.      
  278.     procedure Advance (
  279.               S      :in     String;
  280.               Start  :in out positive
  281.     );
  282.      
  283. --------------------------------------------------------------------------
  284.      
  285.     function GetToken (
  286.              S     :in    String;
  287.              Start :in    positive
  288.     ) return String;
  289.      
  290. --------------------------------------------------------------------------
  291.      
  292.     function IsSubUnit (
  293.              S     :in    String;
  294.              Start :in    positive
  295.     ) return boolean;
  296.      
  297. --------------------------------------------------------------------------
  298.      
  299.     function GetParent (
  300.              S     :in    String;
  301.              Start :in    positive
  302.     ) return String;
  303.      
  304. --------------------------------------------------------------------------
  305.      
  306.     function GetSpec (
  307.              S     :in    String;
  308.              Start :in    positive
  309.     ) return boolean;
  310.      
  311. --------------------------------------------------------------------------
  312.      
  313.     function GetSubUnit (
  314.              S     :in    String;
  315.              Start :in    positive
  316.     ) return String;
  317.      
  318. --------------------------------------------------------------------------
  319.      
  320. end CommandLine;
  321. ::::::::::::::
  322. count.bdy
  323. ::::::::::::::
  324. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  325. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  326.      
  327. --pragma revision ("$Revision: 1.1 $");
  328.      
  329. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  330. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  331.      
  332. --pragma revision ("$Revision: 1.1 $");
  333.      
  334. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  335. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  336.      
  337. --pragma revision ("$Revision: 1.1 $");
  338.      
  339. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  340. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  341.      
  342. --pragma revision ("$Revision: 1.1 $");
  343.      
  344. with Text_IO; use Text_IO;
  345. with Int_IO; use Int_IO;
  346. package body count is
  347.     TokenClassification: array (D.TokenItem) of D.Class := (
  348.       D.abortz                  => D.operator,
  349.       D.acceptz                 => D.operator,
  350.       D.accessz                 => D.operator,
  351.       D.allz                    => D.operator,
  352.       D.and_thenz               => D.operator,
  353.       D.arrayz                  => D.operator,
  354.       D.atz                     => D.neither,
  355.       D.beginz                  => D.neither,
  356.       D.bodyz                   => D.neither,
  357.       D.body_packagez           => D.neither,
  358.       D.body_taskz              => D.neither,
  359.       D.casez                   => D.neither,
  360.       D.case_stmz               => D.neither,
  361.       D.case_variantz           => D.neither,
  362.       D.constantz               => D.operator,
  363.       D.declarez                => D.operator,
  364.       D.delayz                  => D.operator,
  365.       D.deltaz                  => D.operator,
  366.       D.digitsz                 => D.operator,
  367.       D.doz                     => D.neither,
  368.       D.elsez                   => D.operator,
  369.       D.else_ifz                => D.operator,
  370.       D.else_orz                => D.operator,
  371.       D.else_selectz            => D.operator,
  372.       D.elsifz                  => D.operator,
  373.       D.endz                    => D.neither,
  374.       D.end_acceptz             => D.neither,
  375.       D.end_beginz              => D.neither,
  376.       D.end_case_stmz           => D.operator,
  377.       D.end_case_variantz       => D.operator,
  378.       D.end_ifz                 => D.operator,
  379.       D.end_loopz               => D.operator,
  380.       D.end_package_bdyz        => D.operator,
  381.       D.end_package_spcz        => D.operator,
  382.       D.end_recordz             => D.operator,
  383.       D.end_record_repz         => D.operator,
  384.       D.end_selectz             => D.operator,
  385.       D.end_task_spcz           => D.operator,
  386.       D.entryz                  => D.operator,
  387.       D.exceptionz              => D.operator,
  388.       D.exitz                   => D.operator,
  389.       D.forz                    => D.neither,
  390.       D.for_loopz               => D.neither,
  391.       D.for_repz                => D.neither,
  392.       D.functionz               => D.operator,
  393.       D.genericz                => D.operator,
  394.       D.gotoz                   => D.operator,
  395.       D.ifz                     => D.neither,
  396.       D.inz                     => D.operator,
  397.       D.in_loopz                => D.operator,
  398.       D.in_membershipz          => D.operator,
  399.       D.in_out_parameterz       => D.neither,
  400.       D.in_parameterz           => D.neither,
  401.       D.isz                     => D.neither,
  402.       D.is_case_stmz            => D.neither,
  403.       D.is_case_variantz        => D.neither,
  404.       D.is_functionz            => D.neither,
  405.       D.is_genericz             => D.neither,
  406.       D.is_package_bdyz         => D.neither,
  407.       D.is_package_spcz         => D.neither,
  408.       D.is_procedurez           => D.neither,
  409.       D.is_separatez            => D.operator,
  410.       D.is_subtypez             => D.neither,
  411.       D.is_typez                => D.neither,
  412.       D.is_task_bdyz            => D.neither,
  413.       D.is_task_spcz            => D.neither,
  414.       D.limitedz                => D.operator,
  415.       D.loopz                   => D.neither,
  416.       D.modz                    => D.operator,
  417.       D.newz                    => D.neither,
  418.       D.new_allocatorz          => D.operator,
  419.       D.new_derived_typez       => D.operator,
  420.       D.new_generic_instz       => D.operator,
  421.       D.not_in_membershipz      => D.operator,
  422.       D.nullz                   => D.neither,
  423.       D.null_valuez             => D.operand,
  424.       D.null_stmz               => D.operator,
  425.       D.null_fieldz             => D.operator,
  426.       D.ofz                     => D.operator,
  427.       D.orz                     => D.operator,
  428.       D.or_elsez                => D.operator,
  429.       D.or_selectz              => D.operator,
  430.       D.othersz                 => D.neither,
  431.       D.others_aggregatez       => D.operator,
  432.       D.others_casez            => D.operator,
  433.       D.others_exceptionz       => D.operator,
  434.       D.others_variantz         => D.operator,
  435.       D.outz                    => D.neither,
  436.       D.packagez                => D.neither,
  437.       D.package_bdyz            => D.neither,
  438.       D.package_spcz            => D.neither,
  439.       D.pragmaz                 => D.operator,
  440.       D.privatez                => D.neither,
  441.       D.private_sectionz        => D.operator,
  442.       D.private_typez           => D.operator,
  443.       D.procedurez              => D.neither,
  444.       D.raisez                  => D.operator,
  445.       D.rangez                  => D.operator,
  446.       D.recordz                 => D.neither,
  447.       D.record_typez            => D.neither,
  448.       D.record_repz             => D.neither,
  449.       D.renamesz                => D.operator,
  450.       D.returnz                 => D.operator,
  451.       D.reversez                => D.operator,
  452.       D.selectz                 => D.neither,
  453.       D.separatez               => D.neither,
  454.       D.subtypez                => D.operator,
  455.       D.taskz                   => D.neither,
  456.       D.task_bdyz               => D.neither,
  457.       D.task_spcz               => D.neither,
  458.       D.terminatez              => D.operator,
  459.       D.thenz                   => D.neither,
  460.       D.then_andz               => D.operator,
  461.       D.typez                   => D.operator,
  462.       D.usez                    => D.neither,
  463.       D.use_contextz            => D.operator,
  464.       D.use_repz                => D.operator,
  465.       D.whenz                   => D.neither,
  466.       D.when_case_stmz          => D.neither,
  467.       D.when_exitz              => D.neither,
  468.       D.when_exceptionz         => D.neither,
  469.       D.when_selectz            => D.neither,
  470.       D.when_case_variantz      => D.neither,
  471.       D.whilez                  => D.operator,
  472.       D.withz                   => D.neither,
  473.       D.with_contextz           => D.operator,
  474.       D.with_genericz           => D.operator,
  475.       -------------  punctuation  --------------
  476.       D.arrowz                  => D.operator,
  477.       D.barz                    => D.operator,
  478.       D.boxz                    => D.neither,
  479.       D.box_rangez              => D.operator,
  480.       D.box_default_subpz       => D.operator,
  481.       D.character_literalz      => D.operand,
  482.       D.closed_anglesz          => D.neither,
  483.       D.closed_parenthesisz     => D.neither,
  484.       D.colon_equalsz           => D.operator,
  485.       D.colonz                  => D.operator,
  486.       D.commaz                  => D.operator,
  487.       D.dotz                    => D.operator,
  488.       D.dot_dot_rangez          => D.operator,
  489.       D.double_quotez           => D.operand,
  490.       D.numeric_literalz        => D.operand,
  491.       D.open_anglesz            => D.operator,
  492.       D.open_parenthesisz       => D.operator,
  493.       D.semicolonz              => D.neither,
  494.       D.single_quotez           => D.neither,
  495.       D.tickz                   => D.operator,
  496.       D.declare_blockz          => D.neither
  497.            );
  498.               --| This is a map from token types to symbol classification.
  499.               --| It indicates which class (D.operator, operand, neither)
  500.               --| a token is in.
  501.      
  502. --------------------------------------------------------------------------
  503.      
  504.     function RemoveLastChar (  --| This removes the last character from
  505.                                --| the string S.  This is used to get
  506.                                --| rid of the z's in the TokenItems.
  507.                    S      :in     String
  508.     ) return String is
  509.      
  510.     begin
  511.         return S(S'first..S'last - 1);
  512.     end;
  513.      
  514. --------------------------------------------------------------------------
  515.      
  516.     procedure HalsteadCount (
  517.       TokenInfo :in     D.TokenCountType;
  518.       VerboseOn :in     boolean;
  519.       Nn:        in out CT.NnInfoType
  520.     )  is
  521.     begin
  522.         for t in D.TokenItem loop
  523.             if TokenInfo(t) > 0  then
  524.                 Nn(TokenClassification(t)).Vocabulary :=
  525.                   Nn(TokenClassification(t)).Vocabulary + 1;
  526.                 Nn(TokenClassification(t)).Usage :=
  527.                   Nn(TokenClassification(t)).Usage + TokenInfo(t);
  528.      
  529.                 if VerboseOn then
  530.                     Put (Standard_Output, "number of ");
  531.                     Put (Standard_Output,
  532.                          RemoveLastChar (D.TokenItem ' image (t)));
  533.                     Put (Standard_Output, " tokens is ");
  534.                     Put (Standard_Output, TokenInfo(t));
  535.                     New_Line (Standard_Output);
  536.                 end if;
  537.      
  538.             end if;
  539.         end loop;
  540.     end HalsteadCount;
  541. end count;
  542. ::::::::::::::
  543. count.spc
  544. ::::::::::::::
  545. -- $Source: /nosc/work/tools/halstead/RCS/count.spc,v $
  546. -- $Revision: 1.3 $ -- $Date: 85/06/13 13:29:12 $ -- $Author: buddy $
  547.      
  548. --pragma revision ("$Revision: 1.3 $");
  549.      
  550. with Definitions;
  551. with Count_Types;
  552. package Count is
  553.      
  554.     package D renames Definitions;
  555.     package CT renames Count_Types;
  556.      
  557. --------------------------------------------------------------------------
  558.      
  559.     procedure HalsteadCount (  --| This procedure determines which tokens
  560.                                --| are operators and operands and counts
  561.                                --| them.
  562.       TokenInfo :in     D.TokenCountType;
  563.       VerboseOn :in     boolean;
  564.       Nn:        in out CT.NnInfoType
  565.     );
  566.      
  567. --------------------------------------------------------------------------
  568. end Count;
  569. ::::::::::::::
  570. countype.bdy
  571. ::::::::::::::
  572. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  573. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  574.      
  575. --pragma revision ("$Revision: 1.1 $");
  576.      
  577. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  578. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  579.      
  580. --pragma revision ("$Revision: 1.1 $");
  581.      
  582. with Definitions;
  583. package body Count_Types is
  584.      
  585. --------------------------------------------------------------------------
  586.      
  587.     function AddCounts (   --| This function Adds two records and
  588.                            --| returns their sum.
  589.                      L   :in     NnInfoType;
  590.                      R   :in     NnInfoType
  591.     ) return NnInfoType is
  592.         Sum :NnInfoType;
  593.     begin
  594.         for c in Definitions.Class loop
  595.             Sum(c).Vocabulary := L(c).Vocabulary + R(c).Vocabulary;
  596.             Sum(c).Usage := L(c).Usage + R(c).Usage;
  597.         end loop;
  598.         return Sum;
  599.     end;
  600. --------------------------------------------------------------------------
  601.      
  602.     procedure ZeroCount (--| Sets the counts of all the classes of  NnInfo
  603.                          --| to 0.
  604.                   NnInfo :in out  NnInfoType
  605.     ) is
  606.     begin
  607.         for c in Definitions.Class loop
  608.             NnInfo(c).Vocabulary := 0;
  609.             NnInfo(c).Usage := 0;
  610.         end loop;
  611.     end;
  612.      
  613. ------------------------------------------------------------------------- -
  614. end Count_Types;
  615. ::::::::::::::
  616. countype.spc
  617. ::::::::::::::
  618. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  619. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  620.      
  621. --pragma revision ("$Revision: 1.1 $");
  622.      
  623. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  624. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  625.      
  626. --pragma revision ("$Revision: 1.1 $");
  627.      
  628. with Definitions;
  629. package Count_Types is
  630.     --| OVERVIEW
  631.     --| This package defines types that are being used in the counting
  632.     --| of tokens.  It also provides an operation AddCounts which
  633.     --| a function which returns the sum of two NnInfoType records.
  634.     --| This is needed because it is necessary to separate the token
  635.     --| counts which result from DEF_ID_Analysis and Literal_Analysis
  636.     --| and the token counts which result from keyword other syntactic
  637.     --| constructs.
  638.      
  639.     type NnRecordType is
  640.         record
  641.           Vocabulary: natural := 0;
  642.           Usage:      natural := 0;
  643.         end record;
  644.         --| This package is used to define the NnInfoType used by all
  645.         --| the different counting strategies.
  646.      
  647.     type NnInfoType is array (Definitions.Class) of NnRecordType;
  648.       --| NnInfoType keeps track of the vocabulary and usage for each
  649.       --| class (i.e. operator, operand, and neither).
  650.       --|
  651.       --| Vocabulary keeps track of the number of unique symbols in
  652.       --| the source program.  For example:
  653.       --|
  654.       --|          Nn :NnInfoType;
  655.       --|
  656.       --| Then Nn(operator).Vocabulary corresponds to n1 the unique
  657.       --| number of operators in Halstead's notation and
  658.       --| Nn(operand).Vocabulary corresponds to n2 the unique number of
  659.       --| operands.  Thus
  660.       --|
  661.       --| Nn(operator).Vocabulary + Nn(operand).Vocabulary =n
  662.       --|
  663.       --|  which is the vocabulary for the source program.
  664.       --|
  665.       --| Usage keeps track of the total usage of each class of
  666.       --| operator, operand, and neither. Nn(operator).Usage
  667.       --| Nn(operand).Usage correspond to N1 and N2 in Halstead
  668.       --| notation and their sum corresponds to N which is the length of
  669.      
  670. --------------------------------------------------------------------------
  671.      
  672.     function AddCounts (   --| This function Adds two records and
  673.                            --| returns their sum.
  674.                      L   :in     NnInfoType;
  675.                      R   :in     NnInfoType
  676.     ) return NnInfoType ;
  677. --------------------------------------------------------------------------
  678.      
  679.     procedure ZeroCount (--| Sets the counts of NnInfo to 0.
  680.                   NnInfo :in out  NnInfoType
  681.     );
  682.      
  683. ------------------------------------------------------------------------- -
  684. end Count_Types;
  685. ::::::::::::::
  686. defs.bdy
  687. ::::::::::::::
  688. -- $Source: /nosc/work/tools/halstead/RCS/defs.bdy,v $
  689. -- $Revision: 5.1 $ -- $Date: 85/04/04 08:30:38 $ -- $Author: buddy $
  690.      
  691. with VmmTextPkg;
  692. with unchecked_deallocation;
  693. package body Definitions is
  694.      
  695.     function "<" ( --| This function compares the text of two literals
  696.                    --| to see if X is lexigraphically less than Y.
  697.            X :in Source_Text.Locator;
  698.            Y :in Source_Text.Locator
  699.     ) return boolean is
  700.      
  701.     begin
  702.         return
  703.         VmmTextPkg.Value (Source_Text.Value (X))
  704.         <
  705.         VmmTextPkg.Value (Source_Text.Value (Y));
  706.     end;
  707.      
  708.     package body Literal_Set is
  709.      
  710.     ------------------------------------------------------------------------------
  711.     --                Nested Private Definitions
  712.     -------------------------------------------------------------------------------
  713.      
  714.      
  715.     package body TreePkg is
  716.     ---------------------------------------------------------------------------
  717.     --                   Nested Private Definitions
  718.     ---------------------------------------------------------------------------
  719.      
  720.      
  721.      
  722.     package body NodeOrder is
  723.      
  724.         procedure Free is new unchecked_deallocation (Cell, List);
  725.      
  726.     --------------------------------------------------------------------------
  727.      
  728.        function Last (L: in     List) return List is
  729.      
  730.            Place_In_L:        List;
  731.            Temp_Place_In_L:   List;
  732.      
  733.        --|  Link down the list L and return the pointer to the last element
  734.        --| of L.  If L is null raise the EmptyList exception.
  735.      
  736.        begin
  737.            if L = null then
  738.                raise EmptyList;
  739.            else
  740.      
  741.                --|  Link down L saving the pointer to the previous element in
  742.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  743.                --|  points to the last element in the list.
  744.      
  745.                Place_In_L := L;
  746.                while Place_In_L /= null loop
  747.                    Temp_Place_In_L := Place_In_L;
  748.                    Place_In_L := Place_In_L.Next;
  749.                end loop;
  750.                return Temp_Place_In_L;
  751.            end if;
  752.         end Last;
  753.      
  754.      
  755.     --------------------------------------------------------------------------
  756.      
  757.         procedure Attach (List1: in out List;
  758.                           List2: in     List ) is
  759.             EndOfList1: List;
  760.      
  761.         --| Attach List2 to List1.
  762.         --| If List1 is null return List2
  763.         --| If List1 equals List2 then raise CircularList
  764.         --| Otherwise get the pointer to the last element of List1 and change
  765.         --| its Next field to be List2.
  766.      
  767.         begin
  768.             if List1 = null then
  769.                 List1 := List2;
  770.                 return;
  771.             elsif List1 = List2 then
  772.                 raise CircularList;
  773.             else
  774.                 EndOfList1 := Last (List1);
  775.                 EndOfList1.Next := List2;
  776.             end if;
  777.         end Attach;
  778.      
  779.     --------------------------------------------------------------------------
  780.      
  781.        procedure Attach (L:       in out List;
  782.                          Element: in     Tree ) is
  783.      
  784.            NewEnd:    List;
  785.      
  786.        --| Create a list containing Element and attach it to the end of L
  787.      
  788.        begin
  789.            NewEnd := new Cell'(Info => Element, Next => null);
  790.            Attach (L, NewEnd);
  791.        end;
  792.      
  793.     --------------------------------------------------------------------------
  794.      
  795.        function Attach (Element1: in   Tree;
  796.                         Element2: in   Tree ) return List is
  797.            NewList: List;
  798.      
  799.        --| Create a new list containing the information in Element1 and
  800.        --| attach Element2 to that list.
  801.      
  802.        begin
  803.            NewList := new Cell'(Info => Element1, Next => null);
  804.            Attach (NewList, Element2);
  805.            return NewList;
  806.        end;
  807.      
  808.     --------------------------------------------------------------------------
  809.      
  810.        procedure Attach (Element: in     Tree;
  811.                          L:       in out List      ) is
  812.      
  813.        --|  Create a new cell whose information is Element and whose Next
  814.        --|  field is the list L.  This prepends Element to the List L.
  815.      
  816.        begin
  817.            L := new Cell'(Info => Element, Next => L);
  818.        end;
  819.      
  820.     --------------------------------------------------------------------------
  821.      
  822.        function Attach ( List1: in    List;
  823.                          List2: in    List   ) return List is
  824.      
  825.        Last_Of_List1: List;
  826.      
  827.        begin
  828.            if List1 = null then
  829.                return List2;
  830.            elsif List1 = List2 then
  831.                raise CircularList;
  832.            else
  833.                Last_Of_List1 := Last (List1);
  834.                Last_Of_List1.Next := List2;
  835.                return List1;
  836.            end if;
  837.        end  Attach;
  838.      
  839.     -------------------------------------------------------------------------
  840.      
  841.        function Attach( L:       in     List;
  842.                         Element: in     Tree ) return List is
  843.      
  844.        NewEnd: List;
  845.        Last_Of_L: List;
  846.      
  847.        --| Create a list called NewEnd and attach it to the end of L.
  848.        --| If L is null return NewEnd
  849.        --| Otherwise get the last element in L and make its Next field
  850.        --| NewEnd.
  851.      
  852.        begin
  853.            NewEnd := new Cell'(Info => Element, Next => null);
  854.            if L = null then
  855.                return NewEnd;
  856.            else
  857.                Last_Of_L := Last (L);
  858.                Last_Of_L.Next := NewEnd;
  859.                return L;
  860.            end if;
  861.        end Attach;
  862.      
  863.     --------------------------------------------------------------------------
  864.      
  865.        function Attach (Element: in     Tree;
  866.                         L:       in     List        ) return List is
  867.      
  868.        begin
  869.            return (new Cell'(Info => Element, Next => L));
  870.        end Attach;
  871.      
  872.     --------------------------------------------------------------------------
  873.      
  874.        function Copy (L: in     List) return List is
  875.      
  876.        --| If L is null return null
  877.        --| Otherwise recursively copy the list by first copying the information
  878.        --| at the head of the list and then making the Next field point to
  879.        --| a copy of the tail of the list.
  880.      
  881.        begin
  882.            if L = null then
  883.                return null;
  884.            else
  885.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  886.            end if;
  887.        end Copy;
  888.      
  889.      
  890.     --------------------------------------------------------------------------
  891.      
  892.         function Create return List is
  893.      
  894.         --| Return the empty list.
  895.      
  896.         begin
  897.             return null;
  898.         end Create;
  899.      
  900.     --------------------------------------------------------------------------
  901.      
  902.        procedure DeleteHead (L: in out List) is
  903.      
  904.            TempList: List;
  905.      
  906.        --| Remove the element of the head of the list and return it to the heap.
  907.        --| If L is null EmptyList.
  908.        --| Otherwise save the Next field of the first element, remove the first
  909.        --| element and then assign to L the Next field of the first element.
  910.      
  911.        begin
  912.            if L = null then
  913.                raise EmptyList;
  914.            else
  915.                TempList := L.Next;
  916.                Free (L);
  917.                L := TempList;
  918.            end if;
  919.        end DeleteHead;
  920.      
  921.     --------------------------------------------------------------------------
  922.      
  923.        procedure DeleteItem (L:       in out List;
  924.                              Element: in     Tree ) is
  925.      
  926.            Temp_L  :List;
  927.      
  928.        --| Remove the first element in the list with the value Element.
  929.        --| If the first element of the list is equal to element then
  930.        --| remove it.  Otherwise, recurse on the tail of the list.
  931.      
  932.        begin
  933.            if L.Info = Element then
  934.                DeleteHead(L);
  935.            else
  936.                DeleteItem(L.Next, Element);
  937.            end if;
  938.        exception
  939.            when constraint_error =>
  940.                raise ItemNotPresent;
  941.        end DeleteItem;
  942.      
  943.     --------------------------------------------------------------------------
  944.      
  945.        procedure DeleteItems (L:       in out List;
  946.                               Element: in     Tree ) is
  947.      
  948.            Place_In_L       :List;     --| Current place in L.
  949.            Last_Place_In_L  :List;     --| Last place in L.
  950.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  951.            Found            :boolean := false;  --| Indicates if an element with
  952.                                                 --| the correct value was found.
  953.      
  954.        --| Walk over the list removing all elements with the value Element.
  955.      
  956.        begin
  957.            Place_In_L := L;
  958.            Last_Place_In_L := null;
  959.            while (Place_In_L /= null) loop
  960.      
  961.                --| Found an element equal to Element
  962.      
  963.                if Place_In_L.Info = Element then
  964.                     Found := true;
  965.      
  966.                     --| If Last_Place_In_L is null then we are at first element
  967.                     --| in L.
  968.      
  969.                     if Last_Place_In_L = null then
  970.                          Temp_Place_In_L := Place_In_L;
  971.                          L := Place_In_L.Next;
  972.                     else
  973.                          Temp_Place_In_L := Place_In_L;
  974.      
  975.                          --| Relink the list Last's Next gets Place's Next
  976.      
  977.                          Last_Place_In_L.Next := Place_In_L.Next;
  978.                     end if;
  979.      
  980.                     --| Move Place_In_L to the next position in the list.
  981.                     --| Free the element.
  982.                     --| Do not update the last element in the list it remains the
  983.                     --| same.
  984.      
  985.                     Place_In_L := Place_In_L.Next;
  986.                     Free (Temp_Place_In_L);
  987.                else
  988.                     --| Update the last place in L and the place in L.
  989.      
  990.                     Last_Place_In_L := Place_In_L;
  991.                     Place_In_L := Place_In_L.Next;
  992.                end if;
  993.            end loop;
  994.      
  995.        --| If we have not found an element raise an exception.
  996.      
  997.        if not Found then
  998.           raise ItemNotPresent;
  999.        end if;
  1000.      
  1001.        end DeleteItems;
  1002.      
  1003.     --------------------------------------------------------------------------
  1004.      
  1005.        procedure Destroy (L: in out List) is
  1006.      
  1007.            Place_In_L:  List;
  1008.            HoldPlace:   List;
  1009.      
  1010.        --| Walk down the list removing all the elements and set the list to
  1011.        --| the empty list.
  1012.      
  1013.        begin
  1014.            Place_In_L := L;
  1015.            while Place_In_L /= null loop
  1016.                HoldPlace := Place_In_L;
  1017.                Place_In_L := Place_In_L.Next;
  1018.                Free (HoldPlace);
  1019.            end loop;
  1020.            L := null;
  1021.        end Destroy;
  1022.      
  1023.     --------------------------------------------------------------------------
  1024.      
  1025.        function FirstValue (L: in    List) return Tree is
  1026.      
  1027.        --| Return the first value in the list.
  1028.      
  1029.        begin
  1030.            if L = null then
  1031.                raise EmptyList;
  1032.            else
  1033.                return (L.Info);
  1034.            end if;
  1035.        end FirstValue;
  1036.      
  1037.     --------------------------------------------------------------------------
  1038.      
  1039.        procedure Forword (I: in out ListIter) is
  1040.      
  1041.            --| Return the pointer to the next member of the list.
  1042.            Temp_L :List;
  1043.        begin
  1044.            Temp_L := List (I);
  1045.            I := ListIter (Temp_L.Next);
  1046.        end Forword;
  1047.      
  1048.     --------------------------------------------------------------------------
  1049.      
  1050.        function IsInList (L:       in    List;
  1051.                           Element: in    Tree  ) return boolean is
  1052.      
  1053.        Place_In_L: List;
  1054.      
  1055.        --| Check if Element is in L.  If it is return true otherwise return false.
  1056.      
  1057.        begin
  1058.            Place_In_L := L;
  1059.            while Place_In_L /= null loop
  1060.                if Place_In_L.Info = Element then
  1061.                    return true;
  1062.                end if;
  1063.                Place_In_L := Place_In_L.Next;
  1064.             end loop;
  1065.             return false;
  1066.        end IsInList;
  1067.      
  1068.     --------------------------------------------------------------------------
  1069.      
  1070.         function IsEmpty (L: in     List) return boolean is
  1071.      
  1072.         --| Is the list L empty.
  1073.      
  1074.         begin
  1075.             return (L = null);
  1076.         end IsEmpty;
  1077.      
  1078.     --------------------------------------------------------------------------
  1079.      
  1080.        function LastValue (L: in     List) return Tree is
  1081.      
  1082.            LastElement: List;
  1083.      
  1084.        --| Return the value of the last element of the list. Get the pointer
  1085.        --| to the last element of L and then return its information.
  1086.      
  1087.        begin
  1088.            LastElement := Last (L);
  1089.            return LastElement.Info;
  1090.        end LastValue;
  1091.      
  1092.     --------------------------------------------------------------------------
  1093.      
  1094.        function Length (L: in     List) return integer is
  1095.      
  1096.        --| Recursively compute the length of L.  The length of a list is
  1097.        --| 0 if it is null or  1 + the length of the tail.
  1098.      
  1099.        begin
  1100.            if L = null then
  1101.                return (0);
  1102.            else
  1103.                return (1 + Length (Tail (L)));
  1104.            end if;
  1105.        end Length;
  1106.      
  1107.     --------------------------------------------------------------------------
  1108.      
  1109.        function MakeListIter (L: in     List) return ListIter is
  1110.      
  1111.        --| Start an iteration operation on the list L.  Do a type conversion
  1112.        --| from List to ListIter.
  1113.      
  1114.        begin
  1115.            return ListIter (L);
  1116.        end MakeListIter;
  1117.      
  1118.     --------------------------------------------------------------------------
  1119.      
  1120.        function More (L: in     ListIter) return boolean is
  1121.      
  1122.        --| This is a test to see whether an iteration is complete.
  1123.      
  1124.        begin
  1125.            return L /= null;
  1126.        end;
  1127.      
  1128.     --------------------------------------------------------------------------
  1129.      
  1130.        procedure Next (Place:   in out ListIter;
  1131.                        Info:       out Tree ) is
  1132.            PlaceInList: List;
  1133.      
  1134.        --| This procedure gets the information at the current place in the List
  1135.        --| and moves the ListIter to the next postion in the list.
  1136.        --| If we are at the end of a list then exception NoMore is raised.
  1137.      
  1138.        begin
  1139.            if Place = null then
  1140.               raise NoMore;
  1141.            else
  1142.               PlaceInList := List(Place);
  1143.               Info := PlaceInList.Info;
  1144.               Place := ListIter(PlaceInList.Next);
  1145.            end if;
  1146.        end Next;
  1147.      
  1148.     --------------------------------------------------------------------------
  1149.      
  1150.        procedure ReplaceHead (L:    in out  List;
  1151.                               Info: in      Tree ) is
  1152.      
  1153.        --| This procedure replaces the information at the head of a list
  1154.        --| with the given information. If the list is empty the exception
  1155.        --| EmptyList is raised.
  1156.      
  1157.        begin
  1158.            if L = null then
  1159.                raise EmptyList;
  1160.            else
  1161.                L.Info := Info;
  1162.            end if;
  1163.        end ReplaceHead;
  1164.      
  1165.     --------------------------------------------------------------------------
  1166.      
  1167.        procedure ReplaceTail (L:        in out List;
  1168.                               NewTail:  in     List  ) is
  1169.            Temp_L: List;
  1170.      
  1171.        --| This destroys the tail of a list and replaces the tail with
  1172.        --| NewTail.  If L is empty EmptyList is raised.
  1173.      
  1174.        begin
  1175.            Destroy(L.Next);
  1176.            L.Next := NewTail;
  1177.        exception
  1178.            when constraint_error =>
  1179.                raise EmptyList;
  1180.        end ReplaceTail;
  1181.      
  1182.     --------------------------------------------------------------------------
  1183.      
  1184.         function Tail (L: in    List) return List is
  1185.      
  1186.         --| This returns the list which is the tail of L.  If L is null Empty
  1187.         --| List is raised.
  1188.      
  1189.         begin
  1190.             if L = null then
  1191.                 raise EmptyList;
  1192.             else
  1193.                 return L.Next;
  1194.             end if;
  1195.         end Tail;
  1196.      
  1197.     --------------------------------------------------------------------------
  1198.         function Equal (List1: in    List;
  1199.                         List2: in    List ) return boolean is
  1200.      
  1201.             PlaceInList1: List;
  1202.             PlaceInList2: List;
  1203.             Contents1:    Tree;
  1204.             Contents2:    Tree;
  1205.      
  1206.         --| This function tests to see if two lists are equal.  Two lists
  1207.         --| are equal if for all the elements of List1 the corresponding
  1208.         --| element of List2 has the same value.  Thus if the 1st elements
  1209.         --| are equal and the second elements are equal and so up to n.
  1210.         --|  Thus a necessary condition for two lists to be equal is that
  1211.         --| they have the same number of elements.
  1212.      
  1213.      
  1214.         --| This function walks over the two list and checks that the
  1215.         --| corresponding elements are equal.  As soon as we reach
  1216.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  1217.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  1218.         --| then the lists are equal.  If they both are not null the lists aren't
  1219.         --| equal.  Note that equality on elements is based on a user supplied
  1220.         --| function Equal which is used to test for item equality.
  1221.      
  1222.         begin
  1223.             PlaceInList1 := List1;
  1224.             PlaceInList2 := List2;
  1225.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  1226.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  1227.                     return false;
  1228.                 end if;
  1229.                 PlaceInList1 := PlaceInList1.Next;
  1230.                 PlaceInList2 := PlaceInList2.Next;
  1231.             end loop;
  1232.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  1233.         end Equal;
  1234.     end NodeOrder;
  1235.      
  1236.     --------------------------------------------------------------------------
  1237.      
  1238.     ----------------------------------------------------------------------------
  1239.     --                   Local Subprograms
  1240.     ----------------------------------------------------------------------------
  1241.      
  1242.     procedure Free is new unchecked_deallocation (Node, Tree);
  1243.      
  1244.     function equal (X, Y: in Member) return boolean is
  1245.      
  1246.     begin
  1247.      
  1248.         return (not (X < Y))  and  (not  (Y < X));
  1249.     end;
  1250.      
  1251.     ------------------------------------------------------------------------------
  1252.      
  1253.     function Generate (T :in Tree ) return  Nodeorder.List is
  1254.         L : Nodeorder.List;
  1255.      
  1256.     --| This routine generates a list of pointers to nodes in the tree t.
  1257.     --| The list is ordered with respect to the order of the nodes in the tree.
  1258.      
  1259.     --| generate does a depth first search of the tree.
  1260.     --| 1.   It first visits the leftchild of t and generates the list for that.
  1261.     --| 2.   It then appends the root node of t to the list generated for the left
  1262.     --|      child.
  1263.     --| 3.   It then appends the list generated for the rightchild to the list
  1264.     --|      generated for the leftchild and the root.
  1265.     --|
  1266.      
  1267.     begin
  1268.         L := NodeOrder.Create;
  1269.         if T /= null then
  1270.            L := Generate (T.Leftchild);
  1271.            Nodeorder.Attach (L, T);
  1272.            Nodeorder.Attach (L, Generate (T.Rightchild));
  1273.         end if;
  1274.         return L;
  1275.     End Generate;
  1276.      
  1277.     ------------------------------------------------------------------------------
  1278.      
  1279.      
  1280.      
  1281.     ------------------------------------------------------------------------------
  1282.     --                    Visible Subprograms
  1283.     ------------------------------------------------------------------------------
  1284.      
  1285.      
  1286.      
  1287.      
  1288.      
  1289.     ------------------------------------------------------------------------------
  1290.      
  1291.     function Create  return Tree is
  1292.      
  1293.     begin
  1294.         return null;
  1295.     end;
  1296.      
  1297.     -----------------------------------------------------------------------------
  1298.      
  1299.     procedure Deposit (
  1300.               I :in      Member;
  1301.               S :in      Tree         ) is
  1302.      
  1303.     begin
  1304.         S.Info := I;
  1305.     end;
  1306.      
  1307.     ------------------------------------------------------------------------------
  1308.      
  1309.     procedure DestroyTree ( T :in out Tree) is
  1310.      
  1311.     --| This procedure recursively destroys the tree T.
  1312.     --|  1.  It destroy the leftchild of T
  1313.     --|  2.  It then destroys the rightchild of T.
  1314.     --|  3.  It then destroy the root T and set T to be null.
  1315.      
  1316.     begin
  1317.         if T /= null then
  1318.             DestroyTree (T.leftchild);
  1319.             DestroyTree (T.rightchild);
  1320.             Free (T);
  1321.         end if;
  1322.     end DestroyTree;
  1323.      
  1324.     ------------------------------------------------------------------------------
  1325.      
  1326.     procedure InsertNode (
  1327.             N           :in out Member;    --| Node being inserted.
  1328.             T           :in out Tree;        --| Tree node is being inserted
  1329.                                              --| into.
  1330.             Root        :   out Tree;        --| Root of the subtree which node N
  1331.                                              --| heads.  This is the position of
  1332.                                              --| node N in T;
  1333.             Exists      :   out boolean      --| If this node already exists in
  1334.                                              --| the tree then Exists is true. If
  1335.                                              --| If this is the first insertion
  1336.                                              --| Exists is false.
  1337.      
  1338.                                                                            ) is
  1339.     --| This inserts the node N in T.
  1340.     --| 1.  If T is null then a new node is allocated and assigned to T
  1341.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  1342.     --|     This is first done by checking whether N < rightchild
  1343.     --| 3.  If this is not true then we check to see if leftchild < N
  1344.     --| 4.  If this is not true then N is in the tree.
  1345.      
  1346.     begin
  1347.         if T = null then
  1348.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  1349.             Root := T;
  1350.             Exists := false;
  1351.             N := T.Info;
  1352.         elsif N < T.Info then
  1353.             InsertNode (N, T.leftchild, Root, Exists);
  1354.         elsif T.Info < N then
  1355.             InsertNode (N, T.rightchild, Root, Exists);
  1356.         else
  1357.             Root := T;
  1358.             Exists := true;
  1359.             N := T.Info;
  1360.      
  1361.         end if;
  1362.     end InsertNode;
  1363.      
  1364.     ------------------------------------------------------------------------------
  1365.      
  1366.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  1367.      
  1368.         I :TreeIter;
  1369.     --| This sets up the iterator for a tree T.
  1370.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  1371.     --| is computed by first invoking Generate of the leftchild then append
  1372.     --| the root node to NodeList and then append the result of Generate
  1373.     --| to NodeList.  Since the tree is ordered such that
  1374.     --|
  1375.     --|    leftchild < root    root < rightchild
  1376.     --|
  1377.     --| NodeOrder returns the nodes in ascending order.
  1378.     --|
  1379.     --| Thus NodeList keeps the list alive for the duration of the iteration
  1380.     --| operation.  The variable State is the a pointer into the NodeList
  1381.     --| which is the current place of the iteration.
  1382.      
  1383.     begin
  1384.         I.NodeList := NodeOrder.Create;
  1385.         if T /= null then
  1386.             I.NodeList := Generate (T.leftchild);
  1387.             NodeOrder.Attach (I.NodeList, T);
  1388.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  1389.         end if;
  1390.         I.State := NodeOrder.MakeListIter (I.NodeList);
  1391.         return I;
  1392.     end;
  1393.      
  1394.     ------------------------------------------------------------------------------
  1395.      
  1396.     function More (I :in TreeIter) return boolean is
  1397.      
  1398.     begin
  1399.         return NodeOrder.More (I.State);
  1400.     end;
  1401.      
  1402.     ------------------------------------------------------------------------------
  1403.      
  1404.     procedure Next (
  1405.               I    :in out TreeIter;
  1406.               Info :   out Member       ) is
  1407.       T: Tree;
  1408.      
  1409.     --| Next returns the information at the current position in the iterator
  1410.     --| and increments the iterator.  This is accomplished by using the iterater
  1411.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  1412.     --| and then the information found at this node in T is returned.
  1413.      
  1414.      
  1415.     begin
  1416.         NodeOrder.Next (I.State, T);
  1417.         Info := T.Info;
  1418.     end;
  1419.      
  1420.     -------------------------------------------------------------------------------
  1421.      
  1422.     end TreePkg;
  1423.      
  1424.      
  1425.     -------------------------------------------------------------------------------
  1426.     --                Local Subprograms
  1427.     -------------------------------------------------------------------------------
  1428.      
  1429.     -------------------------------------------------------------------------------
  1430.      
  1431.     function "<" (     --| Implements "<" for the type member.
  1432.              X :in   Member;
  1433.              Y :in   Member
  1434.     ) return boolean is
  1435.      
  1436.     begin
  1437.          return X.Info < Y.Info;
  1438.     end;
  1439.      
  1440.     -------------------------------------------------------------------------------
  1441.      
  1442.      
  1443.     -------------------------------------------------------------------------------
  1444.     --               Visible Subprograms
  1445.     -------------------------------------------------------------------------------
  1446.      
  1447.      
  1448.     -------------------------------------------------------------------------------
  1449.      
  1450.     function Cardinality (
  1451.                   S :in Set  --| The set whose size is being computed.
  1452.     ) return natural is
  1453.      
  1454.         T        :TreePkg.TreeIter;
  1455.         M        :Member;
  1456.         count    :natural := 0;
  1457.     begin
  1458.         T := TreePkg.MakeTreeIter (S.SetRep);
  1459.         while TreePkg.More (T) loop
  1460.             TreePkg.Next (T, M);
  1461.             count := count + 1;
  1462.         end loop;
  1463.         return count;
  1464.     end Cardinality;
  1465.      
  1466.     -------------------------------------------------------------------------------
  1467.      
  1468.     function Create
  1469.      
  1470.     return Set is
  1471.         S :Set;
  1472.     begin
  1473.         S.SetRep := TreePkg.Create;
  1474.         return S;
  1475.     end Create;
  1476.      
  1477.     ------------------------------------------------------------------------------
  1478.      
  1479.     procedure Destroy (
  1480.              S :in out Set
  1481.     ) is
  1482.      
  1483.     begin
  1484.         TreePkg.DestroyTree (S.SetRep);
  1485.     end Destroy;
  1486.      
  1487.     -----------------------------------------------------------------------------
  1488.      
  1489.     function GetCount (
  1490.              I :in    SetIter
  1491.     ) return natural is
  1492.      
  1493.     begin
  1494.          return I.Count;
  1495.     end;
  1496.      
  1497.     -----------------------------------------------------------------------------
  1498.     procedure Insert(
  1499.               M :in     Source_Text.Locator;
  1500.               S :in out Set
  1501.     ) is
  1502.         Subtree       :TreePkg.Tree;
  1503.         Exists        :boolean;
  1504.         MemberToEnter :Member := ( Info => M, count => 1);
  1505.     begin
  1506.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  1507.         --| Exists comes back true and then M's count is updated.  Since the
  1508.         --| first argument of TreePkg.Insert is in out, after Insert
  1509.         --| MemberToEnter has the value stored in the tree.  Thus if we
  1510.         --| need to update the count we can simple bump the count in MemberToEnter.
  1511.      
  1512.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  1513.         if Exists then
  1514.             MemberToEnter.Count := MemberToEnter.Count + 1;
  1515.             TreePkg.Deposit (MemberToEnter, SubTree);
  1516.         end if;
  1517.     end Insert;
  1518.      
  1519.     ------------------------------------------------------------------------------
  1520.      
  1521.     function MakeSetIter (
  1522.              S :in Set
  1523.     )        return SetIter is
  1524.      
  1525.         I :SetIter;
  1526.     begin
  1527.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  1528.         I.Count := 0;
  1529.         return I;
  1530.     end;
  1531.      
  1532.      ------------------------------------------------------------------------------
  1533.      
  1534.     function More (
  1535.               I :in     SetIter
  1536.     )         return boolean is
  1537.      
  1538.     begin
  1539.         return TreePkg.More (I.Place);
  1540.     end;
  1541.      
  1542.     ------------------------------------------------------------------------------
  1543.      
  1544.     procedure Next (
  1545.              I :in out SetIter;
  1546.              M :   out Source_Text.Locator
  1547.     ) is
  1548.         TempMember :Member;
  1549.     begin
  1550.         TreePkg.Next (I.Place, TempMember);
  1551.         M := TempMember.Info;
  1552.         I.Count := TempMember.Count;
  1553.     end;
  1554.      
  1555.     ------------------------------------------------------------------------------
  1556.      
  1557.     end Literal_Set;
  1558.      
  1559.      
  1560.      
  1561.      
  1562.      
  1563.      
  1564.     package body DEF_ID_Set is
  1565.      
  1566.     ------------------------------------------------------------------------------
  1567.     --                Nested Private Definitions
  1568.     -------------------------------------------------------------------------------
  1569.      
  1570.      
  1571.     package body TreePkg is
  1572.     ---------------------------------------------------------------------------
  1573.     --                   Nested Private Definitions
  1574.     ---------------------------------------------------------------------------
  1575.      
  1576.      
  1577.      
  1578.     package body NodeOrder is
  1579.      
  1580.         procedure Free is new unchecked_deallocation (Cell, List);
  1581.      
  1582.     --------------------------------------------------------------------------
  1583.      
  1584.        function Last (L: in     List) return List is
  1585.      
  1586.            Place_In_L:        List;
  1587.            Temp_Place_In_L:   List;
  1588.      
  1589.        --|  Link down the list L and return the pointer to the last element
  1590.        --| of L.  If L is null raise the EmptyList exception.
  1591.      
  1592.        begin
  1593.            if L = null then
  1594.                raise EmptyList;
  1595.            else
  1596.      
  1597.                --|  Link down L saving the pointer to the previous element in
  1598.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  1599.                --|  points to the last element in the list.
  1600.      
  1601.                Place_In_L := L;
  1602.                while Place_In_L /= null loop
  1603.                    Temp_Place_In_L := Place_In_L;
  1604.                    Place_In_L := Place_In_L.Next;
  1605.                end loop;
  1606.                return Temp_Place_In_L;
  1607.            end if;
  1608.         end Last;
  1609.      
  1610.      
  1611.     --------------------------------------------------------------------------
  1612.      
  1613.         procedure Attach (List1: in out List;
  1614.                           List2: in     List ) is
  1615.             EndOfList1: List;
  1616.      
  1617.         --| Attach List2 to List1.
  1618.         --| If List1 is null return List2
  1619.         --| If List1 equals List2 then raise CircularList
  1620.         --| Otherwise get the pointer to the last element of List1 and change
  1621.         --| its Next field to be List2.
  1622.      
  1623.         begin
  1624.             if List1 = null then
  1625.                 List1 := List2;
  1626.                 return;
  1627.             elsif List1 = List2 then
  1628.                 raise CircularList;
  1629.             else
  1630.                 EndOfList1 := Last (List1);
  1631.                 EndOfList1.Next := List2;
  1632.             end if;
  1633.         end Attach;
  1634.      
  1635.     --------------------------------------------------------------------------
  1636.      
  1637.        procedure Attach (L:       in out List;
  1638.                          Element: in     Tree ) is
  1639.      
  1640.            NewEnd:    List;
  1641.      
  1642.        --| Create a list containing Element and attach it to the end of L
  1643.      
  1644.        begin
  1645.            NewEnd := new Cell'(Info => Element, Next => null);
  1646.            Attach (L, NewEnd);
  1647.        end;
  1648.      
  1649.     --------------------------------------------------------------------------
  1650.      
  1651.        function Attach (Element1: in   Tree;
  1652.                         Element2: in   Tree ) return List is
  1653.            NewList: List;
  1654.      
  1655.        --| Create a new list containing the information in Element1 and
  1656.        --| attach Element2 to that list.
  1657.      
  1658.        begin
  1659.            NewList := new Cell'(Info => Element1, Next => null);
  1660.            Attach (NewList, Element2);
  1661.            return NewList;
  1662.        end;
  1663.      
  1664.     --------------------------------------------------------------------------
  1665.      
  1666.        procedure Attach (Element: in     Tree;
  1667.                          L:       in out List      ) is
  1668.      
  1669.        --|  Create a new cell whose information is Element and whose Next
  1670.        --|  field is the list L.  This prepends Element to the List L.
  1671.      
  1672.        begin
  1673.            L := new Cell'(Info => Element, Next => L);
  1674.        end;
  1675.      
  1676.     --------------------------------------------------------------------------
  1677.      
  1678.        function Attach ( List1: in    List;
  1679.                          List2: in    List   ) return List is
  1680.      
  1681.        Last_Of_List1: List;
  1682.      
  1683.        begin
  1684.            if List1 = null then
  1685.                return List2;
  1686.            elsif List1 = List2 then
  1687.                raise CircularList;
  1688.            else
  1689.                Last_Of_List1 := Last (List1);
  1690.                Last_Of_List1.Next := List2;
  1691.                return List1;
  1692.            end if;
  1693.        end  Attach;
  1694.      
  1695.     -------------------------------------------------------------------------
  1696.      
  1697.        function Attach( L:       in     List;
  1698.                         Element: in     Tree ) return List is
  1699.      
  1700.        NewEnd: List;
  1701.        Last_Of_L: List;
  1702.      
  1703.        --| Create a list called NewEnd and attach it to the end of L.
  1704.        --| If L is null return NewEnd
  1705.        --| Otherwise get the last element in L and make its Next field
  1706.        --| NewEnd.
  1707.      
  1708.        begin
  1709.            NewEnd := new Cell'(Info => Element, Next => null);
  1710.            if L = null then
  1711.                return NewEnd;
  1712.            else
  1713.                Last_Of_L := Last (L);
  1714.                Last_Of_L.Next := NewEnd;
  1715.                return L;
  1716.            end if;
  1717.        end Attach;
  1718.      
  1719.     --------------------------------------------------------------------------
  1720.      
  1721.        function Attach (Element: in     Tree;
  1722.                         L:       in     List        ) return List is
  1723.      
  1724.        begin
  1725.            return (new Cell'(Info => Element, Next => L));
  1726.        end Attach;
  1727.      
  1728.     --------------------------------------------------------------------------
  1729.      
  1730.        function Copy (L: in     List) return List is
  1731.      
  1732.        --| If L is null return null
  1733.        --| Otherwise recursively copy the list by first copying the information
  1734.        --| at the head of the list and then making the Next field point to
  1735.        --| a copy of the tail of the list.
  1736.      
  1737.        begin
  1738.            if L = null then
  1739.                return null;
  1740.            else
  1741.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  1742.            end if;
  1743.        end Copy;
  1744.      
  1745.      
  1746.     --------------------------------------------------------------------------
  1747.      
  1748.         function Create return List is
  1749.      
  1750.         --| Return the empty list.
  1751.      
  1752.         begin
  1753.             return null;
  1754.         end Create;
  1755.      
  1756.     --------------------------------------------------------------------------
  1757.      
  1758.        procedure DeleteHead (L: in out List) is
  1759.      
  1760.            TempList: List;
  1761.      
  1762.        --| Remove the element of the head of the list and return it to the heap.
  1763.        --| If L is null EmptyList.
  1764.        --| Otherwise save the Next field of the first element, remove the first
  1765.        --| element and then assign to L the Next field of the first element.
  1766.      
  1767.        begin
  1768.            if L = null then
  1769.                raise EmptyList;
  1770.            else
  1771.                TempList := L.Next;
  1772.                Free (L);
  1773.                L := TempList;
  1774.            end if;
  1775.        end DeleteHead;
  1776.      
  1777.     --------------------------------------------------------------------------
  1778.      
  1779.        procedure DeleteItem (L:       in out List;
  1780.                              Element: in     Tree ) is
  1781.      
  1782.            Temp_L  :List;
  1783.      
  1784.        --| Remove the first element in the list with the value Element.
  1785.        --| If the first element of the list is equal to element then
  1786.        --| remove it.  Otherwise, recurse on the tail of the list.
  1787.      
  1788.        begin
  1789.            if L.Info = Element then
  1790.                DeleteHead(L);
  1791.            else
  1792.                DeleteItem(L.Next, Element);
  1793.            end if;
  1794.        exception
  1795.            when constraint_error =>
  1796.                raise ItemNotPresent;
  1797.        end DeleteItem;
  1798.      
  1799.     --------------------------------------------------------------------------
  1800.      
  1801.        procedure DeleteItems (L:       in out List;
  1802.                               Element: in     Tree ) is
  1803.      
  1804.            Place_In_L       :List;     --| Current place in L.
  1805.            Last_Place_In_L  :List;     --| Last place in L.
  1806.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  1807.            Found            :boolean := false;  --| Indicates if an element with
  1808.                                                 --| the correct value was found.
  1809.      
  1810.        --| Walk over the list removing all elements with the value Element.
  1811.      
  1812.        begin
  1813.            Place_In_L := L;
  1814.            Last_Place_In_L := null;
  1815.            while (Place_In_L /= null) loop
  1816.      
  1817.                --| Found an element equal to Element
  1818.      
  1819.                if Place_In_L.Info = Element then
  1820.                     Found := true;
  1821.      
  1822.                     --| If Last_Place_In_L is null then we are at first element
  1823.                     --| in L.
  1824.      
  1825.                     if Last_Place_In_L = null then
  1826.                          Temp_Place_In_L := Place_In_L;
  1827.                          L := Place_In_L.Next;
  1828.                     else
  1829.                          Temp_Place_In_L := Place_In_L;
  1830.      
  1831.                          --| Relink the list Last's Next gets Place's Next
  1832.      
  1833.                          Last_Place_In_L.Next := Place_In_L.Next;
  1834.                     end if;
  1835.      
  1836.                     --| Move Place_In_L to the next position in the list.
  1837.                     --| Free the element.
  1838.                     --| Do not update the last element in the list it remains the
  1839.                     --| same.
  1840.      
  1841.                     Place_In_L := Place_In_L.Next;
  1842.                     Free (Temp_Place_In_L);
  1843.                else
  1844.                     --| Update the last place in L and the place in L.
  1845.      
  1846.                     Last_Place_In_L := Place_In_L;
  1847.                     Place_In_L := Place_In_L.Next;
  1848.                end if;
  1849.            end loop;
  1850.      
  1851.        --| If we have not found an element raise an exception.
  1852.      
  1853.        if not Found then
  1854.           raise ItemNotPresent;
  1855.        end if;
  1856.      
  1857.        end DeleteItems;
  1858.      
  1859.     --------------------------------------------------------------------------
  1860.      
  1861.        procedure Destroy (L: in out List) is
  1862.      
  1863.            Place_In_L:  List;
  1864.            HoldPlace:   List;
  1865.      
  1866.        --| Walk down the list removing all the elements and set the list to
  1867.        --| the empty list.
  1868.      
  1869.        begin
  1870.            Place_In_L := L;
  1871.            while Place_In_L /= null loop
  1872.                HoldPlace := Place_In_L;
  1873.                Place_In_L := Place_In_L.Next;
  1874.                Free (HoldPlace);
  1875.            end loop;
  1876.            L := null;
  1877.        end Destroy;
  1878.      
  1879.     --------------------------------------------------------------------------
  1880.      
  1881.        function FirstValue (L: in    List) return Tree is
  1882.      
  1883.        --| Return the first value in the list.
  1884.      
  1885.        begin
  1886.            if L = null then
  1887.                raise EmptyList;
  1888.            else
  1889.                return (L.Info);
  1890.            end if;
  1891.        end FirstValue;
  1892.      
  1893.     --------------------------------------------------------------------------
  1894.      
  1895.        procedure Forword (I: in out ListIter) is
  1896.      
  1897.        --| Return the pointer to the next member of the list.
  1898.            Temp_L :List;
  1899.        begin
  1900.            Temp_L := List (I);
  1901.            I := ListIter (Temp_L.Next);
  1902.        end Forword;
  1903.      
  1904.     --------------------------------------------------------------------------
  1905.      
  1906.        function IsInList (L:       in    List;
  1907.                           Element: in    Tree  ) return boolean is
  1908.      
  1909.        Place_In_L: List;
  1910.      
  1911.        --| Check if Element is in L.  If it is return true otherwise return false.
  1912.      
  1913.        begin
  1914.            Place_In_L := L;
  1915.            while Place_In_L /= null loop
  1916.                if Place_In_L.Info = Element then
  1917.                    return true;
  1918.                end if;
  1919.                Place_In_L := Place_In_L.Next;
  1920.             end loop;
  1921.             return false;
  1922.        end IsInList;
  1923.      
  1924.     --------------------------------------------------------------------------
  1925.      
  1926.         function IsEmpty (L: in     List) return boolean is
  1927.      
  1928.         --| Is the list L empty.
  1929.      
  1930.         begin
  1931.             return (L = null);
  1932.         end IsEmpty;
  1933.      
  1934.     --------------------------------------------------------------------------
  1935.      
  1936.        function LastValue (L: in     List) return Tree is
  1937.      
  1938.            LastElement: List;
  1939.      
  1940.        --| Return the value of the last element of the list. Get the pointer
  1941.        --| to the last element of L and then return its information.
  1942.      
  1943.        begin
  1944.            LastElement := Last (L);
  1945.            return LastElement.Info;
  1946.        end LastValue;
  1947.      
  1948.     --------------------------------------------------------------------------
  1949.      
  1950.        function Length (L: in     List) return integer is
  1951.      
  1952.        --| Recursively compute the length of L.  The length of a list is
  1953.        --| 0 if it is null or  1 + the length of the tail.
  1954.      
  1955.        begin
  1956.            if L = null then
  1957.                return (0);
  1958.            else
  1959.                return (1 + Length (Tail (L)));
  1960.            end if;
  1961.        end Length;
  1962.      
  1963.     --------------------------------------------------------------------------
  1964.      
  1965.        function MakeListIter (L: in     List) return ListIter is
  1966.      
  1967.        --| Start an iteration operation on the list L.  Do a type conversion
  1968.        --| from List to ListIter.
  1969.      
  1970.        begin
  1971.            return ListIter (L);
  1972.        end MakeListIter;
  1973.      
  1974.     --------------------------------------------------------------------------
  1975.      
  1976.        function More (L: in     ListIter) return boolean is
  1977.      
  1978.        --| This is a test to see whether an iteration is complete.
  1979.      
  1980.        begin
  1981.            return L /= null;
  1982.        end;
  1983.      
  1984.     --------------------------------------------------------------------------
  1985.      
  1986.        procedure Next (Place:   in out ListIter;
  1987.                        Info:       out Tree ) is
  1988.            PlaceInList: List;
  1989.      
  1990.        --| This procedure gets the information at the current place in the List
  1991.        --| and moves the ListIter to the next postion in the list.
  1992.        --| If we are at the end of a list then exception NoMore is raised.
  1993.      
  1994.        begin
  1995.            if Place = null then
  1996.               raise NoMore;
  1997.            else
  1998.               PlaceInList := List(Place);
  1999.               Info := PlaceInList.Info;
  2000.               Place := ListIter(PlaceInList.Next);
  2001.            end if;
  2002.        end Next;
  2003.      
  2004.     --------------------------------------------------------------------------
  2005.      
  2006.        procedure ReplaceHead (L:    in out  List;
  2007.                               Info: in      Tree ) is
  2008.      
  2009.        --| This procedure replaces the information at the head of a list
  2010.        --| with the given information. If the list is empty the exception
  2011.        --| EmptyList is raised.
  2012.      
  2013.        begin
  2014.            if L = null then
  2015.                raise EmptyList;
  2016.            else
  2017.                L.Info := Info;
  2018.            end if;
  2019.        end ReplaceHead;
  2020.      
  2021.     --------------------------------------------------------------------------
  2022.      
  2023.        procedure ReplaceTail (L:        in out List;
  2024.                               NewTail:  in     List  ) is
  2025.            Temp_L: List;
  2026.      
  2027.        --| This destroys the tail of a list and replaces the tail with
  2028.        --| NewTail.  If L is empty EmptyList is raised.
  2029.      
  2030.        begin
  2031.            Destroy(L.Next);
  2032.            L.Next := NewTail;
  2033.        exception
  2034.            when constraint_error =>
  2035.                raise EmptyList;
  2036.        end ReplaceTail;
  2037.      
  2038.     --------------------------------------------------------------------------
  2039.      
  2040.         function Tail (L: in    List) return List is
  2041.      
  2042.         --| This returns the list which is the tail of L.  If L is null Empty
  2043.         --| List is raised.
  2044.      
  2045.         begin
  2046.             if L = null then
  2047.                 raise EmptyList;
  2048.             else
  2049.                 return L.Next;
  2050.             end if;
  2051.         end Tail;
  2052.      
  2053.     --------------------------------------------------------------------------
  2054.         function Equal (List1: in    List;
  2055.                         List2: in    List ) return boolean is
  2056.      
  2057.             PlaceInList1: List;
  2058.             PlaceInList2: List;
  2059.             Contents1:    Tree;
  2060.             Contents2:    Tree;
  2061.      
  2062.         --| This function tests to see if two lists are equal.  Two lists
  2063.         --| are equal if for all the elements of List1 the corresponding
  2064.         --| element of List2 has the same value.  Thus if the 1st elements
  2065.         --| are equal and the second elements are equal and so up to n.
  2066.         --|  Thus a necessary condition for two lists to be equal is that
  2067.         --| they have the same number of elements.
  2068.      
  2069.      
  2070.         --| This function walks over the two list and checks that the
  2071.         --| corresponding elements are equal.  As soon as we reach
  2072.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  2073.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  2074.         --| then the lists are equal.  If they both are not null the lists aren't
  2075.         --| equal.  Note that equality on elements is based on a user supplied
  2076.         --| function Equal which is used to test for item equality.
  2077.      
  2078.         begin
  2079.             PlaceInList1 := List1;
  2080.             PlaceInList2 := List2;
  2081.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  2082.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  2083.                     return false;
  2084.                 end if;
  2085.                 PlaceInList1 := PlaceInList1.Next;
  2086.                 PlaceInList2 := PlaceInList2.Next;
  2087.             end loop;
  2088.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  2089.         end Equal;
  2090.     end NodeOrder;
  2091.      
  2092.     --------------------------------------------------------------------------
  2093.      
  2094.     ----------------------------------------------------------------------------
  2095.     --                   Local Subprograms
  2096.     ----------------------------------------------------------------------------
  2097.      
  2098.     procedure Free is new unchecked_deallocation (Node, Tree);
  2099.      
  2100.     function equal (X, Y: in Member) return boolean is
  2101.      
  2102.     begin
  2103.      
  2104.         return (not (X < Y))  and  (not  (Y < X));
  2105.     end;
  2106.      
  2107.     ------------------------------------------------------------------------------
  2108.      
  2109.     function Generate (T :in Tree ) return  Nodeorder.List is
  2110.         L : Nodeorder.List;
  2111.      
  2112.     --| This routine generates a list of pointers to nodes in the tree t.
  2113.     --| The list is ordered with respect to the order of the nodes in the tree.
  2114.      
  2115.     --| generate does a depth first search of the tree.
  2116.     --| 1.   It first visits the leftchild of t and generates the list for that.
  2117.     --| 2.   It then appends the root node of t to the list generated for the left
  2118.     --|      child.
  2119.     --| 3.   It then appends the list generated for the rightchild to the list
  2120.     --|      generated for the leftchild and the root.
  2121.     --|
  2122.      
  2123.     begin
  2124.         L := NodeOrder.Create;
  2125.         if T /= null then
  2126.            L := Generate (T.Leftchild);
  2127.            Nodeorder.Attach (L, T);
  2128.            Nodeorder.Attach (L, Generate (T.Rightchild));
  2129.         end if;
  2130.         return L;
  2131.     end Generate;
  2132.      
  2133.     ------------------------------------------------------------------------------
  2134.      
  2135.      
  2136.      
  2137.     ------------------------------------------------------------------------------
  2138.     --                    Visible Subprograms
  2139.     ------------------------------------------------------------------------------
  2140.      
  2141.      
  2142.      
  2143.      
  2144.      
  2145.     ------------------------------------------------------------------------------
  2146.      
  2147.     function Create  return Tree is
  2148.      
  2149.     begin
  2150.         return null;
  2151.     end;
  2152.      
  2153.     -----------------------------------------------------------------------------
  2154.      
  2155.     procedure Deposit (
  2156.               I :in      Member;
  2157.               S :in      Tree         ) is
  2158.      
  2159.     begin
  2160.         S.Info := I;
  2161.     end;
  2162.      
  2163.     ------------------------------------------------------------------------------
  2164.      
  2165.     procedure DestroyTree ( T :in out Tree) is
  2166.      
  2167.     --| This procedure recursively destroys the tree T.
  2168.     --|  1.  It destroy the leftchild of T
  2169.     --|  2.  It then destroys the rightchild of T.
  2170.     --|  3.  It then destroy the root T and set T to be null.
  2171.      
  2172.     begin
  2173.         if T /= null then
  2174.             DestroyTree (T.leftchild);
  2175.             DestroyTree (T.rightchild);
  2176.             Free (T);
  2177.         end if;
  2178.     end DestroyTree;
  2179.      
  2180.     ------------------------------------------------------------------------------
  2181.      
  2182.     procedure InsertNode (
  2183.             N           :in out Member;    --| Node being inserted.
  2184.             T           :in out Tree;        --| Tree node is being inserted
  2185.                                              --| into.
  2186.             Root        :   out Tree;        --| Root of the subtree which node N
  2187.                                              --| heads.  This is the position of
  2188.                                              --| node N in T;
  2189.             Exists      :   out boolean      --| If this node already exists in
  2190.                                              --| the tree then Exists is true. If
  2191.                                              --| If this is the first insertion
  2192.                                              --| Exists is false.
  2193.      
  2194.                                                                            ) is
  2195.     --| This inserts the node N in T.
  2196.     --| 1.  If T is null then a new node is allocated and assigned to T
  2197.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  2198.     --|     This is first done by checking whether N < rightchild
  2199.     --| 3.  If this is not true then we check to see if leftchild < N
  2200.     --| 4.  If this is not true then N is in the tree.
  2201.      
  2202.     begin
  2203.         if T = null then
  2204.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  2205.             Root := T;
  2206.             Exists := false;
  2207.             N := T.Info;
  2208.         elsif N < T.Info then
  2209.             InsertNode (N, T.leftchild, Root, Exists);
  2210.         elsif T.Info < N then
  2211.             InsertNode (N, T.rightchild, Root, Exists);
  2212.         else
  2213.             Root := T;
  2214.             Exists := true;
  2215.             N := T.Info;
  2216.      
  2217.         end if;
  2218.     end InsertNode;
  2219.      
  2220.     ------------------------------------------------------------------------------
  2221.      
  2222.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  2223.      
  2224.         I :TreeIter;
  2225.     --| This sets up the iterator for a tree T.
  2226.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  2227.     --| is computed by first invoking Generate of the leftchild then append
  2228.     --| the root node to NodeList and then append the result of Generate
  2229.     --| to NodeList.  Since the tree is ordered such that
  2230.     --|
  2231.     --|    leftchild < root    root < rightchild
  2232.     --|
  2233.     --| NodeOrder returns the nodes in ascending order.
  2234.     --|
  2235.     --| Thus NodeList keeps the list alive for the duration of the iteration
  2236.     --| operation.  The variable State is the a pointer into the NodeList
  2237.     --| which is the current place of the iteration.
  2238.      
  2239.     begin
  2240.         I.NodeList := NodeOrder.Create;
  2241.         if T /= null then
  2242.             I.NodeList := Generate (T.leftchild);
  2243.             NodeOrder.Attach (I.NodeList, T);
  2244.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  2245.         end if;
  2246.         I.State := NodeOrder.MakeListIter (I.NodeList);
  2247.         return I;
  2248.     end;
  2249.      
  2250.     ------------------------------------------------------------------------------
  2251.      
  2252.     function More (I :in TreeIter) return boolean is
  2253.      
  2254.     begin
  2255.         return NodeOrder.More (I.State);
  2256.     end;
  2257.      
  2258.     ------------------------------------------------------------------------------
  2259.      
  2260.     procedure Next (
  2261.               I    :in out TreeIter;
  2262.               Info :   out Member       ) is
  2263.       T: Tree;
  2264.      
  2265.     --| Next returns the information at the current position in the iterator
  2266.     --| and increments the iterator.  This is accomplished by using the iterater
  2267.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  2268.     --| and then the information found at this node in T is returned.
  2269.      
  2270.      
  2271.     begin
  2272.         NodeOrder.Next (I.State, T);
  2273.         Info := T.Info;
  2274.     end;
  2275.      
  2276.     -------------------------------------------------------------------------------
  2277.      
  2278.     end TreePkg;
  2279.      
  2280.      
  2281.     -------------------------------------------------------------------------------
  2282.     --                Local Subprograms
  2283.     -------------------------------------------------------------------------------
  2284.      
  2285.     -------------------------------------------------------------------------------
  2286.      
  2287.     function "<" (     --| Implements "<" for the type member.
  2288.              X :in   Member;
  2289.              Y :in   Member
  2290.     ) return boolean is
  2291.      
  2292.     begin
  2293.          return X.Info < Y.Info;
  2294.     end;
  2295.      
  2296.     -------------------------------------------------------------------------------
  2297.      
  2298.      
  2299.     -------------------------------------------------------------------------------
  2300.     --               Visible Subprograms
  2301.     -------------------------------------------------------------------------------
  2302.      
  2303.      
  2304.     -------------------------------------------------------------------------------
  2305.      
  2306.     function Cardinality (
  2307.                   S :in Set  --| The set whose size is being computed.
  2308.     ) return natural is
  2309.      
  2310.         T        :TreePkg.TreeIter;
  2311.         M        :Member;
  2312.         count    :natural := 0;
  2313.     begin
  2314.         T := TreePkg.MakeTreeIter (S.SetRep);
  2315.         while TreePkg.More (T) loop
  2316.             TreePkg.Next (T, M);
  2317.             count := count + 1;
  2318.         end loop;
  2319.         return count;
  2320.     end Cardinality;
  2321.      
  2322.     -------------------------------------------------------------------------------
  2323.      
  2324.     function Create
  2325.      
  2326.     return Set is
  2327.         S :Set;
  2328.     begin
  2329.         S.SetRep := TreePkg.Create;
  2330.         return S;
  2331.     end Create;
  2332.      
  2333.     ------------------------------------------------------------------------------
  2334.      
  2335.     procedure Destroy (
  2336.              S :in out Set
  2337.     ) is
  2338.      
  2339.     begin
  2340.         TreePkg.DestroyTree (S.SetRep);
  2341.     end Destroy;
  2342.      
  2343.     -----------------------------------------------------------------------------
  2344.      
  2345.     function GetCount (
  2346.              I :in    SetIter
  2347.     ) return natural is
  2348.      
  2349.     begin
  2350.          return I.Count;
  2351.     end;
  2352.      
  2353.     -----------------------------------------------------------------------------
  2354.     procedure Insert(
  2355.               M :in     DEF_ID.Locator;
  2356.               S :in out Set
  2357.     ) is
  2358.         Subtree       :TreePkg.Tree;
  2359.         Exists        :boolean;
  2360.         MemberToEnter :Member := ( Info => M, count => 1);
  2361.     begin
  2362.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  2363.         --| Exists comes back true and then M's count is updated.  Since the
  2364.         --| first argument of TreePkg.Insert is in out, after Insert
  2365.         --| MemberToEnter has the value stored in the tree.  Thus if we
  2366.         --| need to update the count we can simple bump the count in MemberToEnter.
  2367.      
  2368.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  2369.         if Exists then
  2370.             MemberToEnter.Count := MemberToEnter.Count + 1;
  2371.             TreePkg.Deposit (MemberToEnter, SubTree);
  2372.         end if;
  2373.     end Insert;
  2374.      
  2375.     ------------------------------------------------------------------------------
  2376.      
  2377.     function MakeSetIter (
  2378.              S :in Set
  2379.     )        return SetIter is
  2380.      
  2381.         I :SetIter;
  2382.     begin
  2383.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  2384.         I.Count := 0;
  2385.         return I;
  2386.     end;
  2387.      
  2388.      ------------------------------------------------------------------------------
  2389.      
  2390.     function More (
  2391.               I :in     SetIter
  2392.     )         return boolean is
  2393.      
  2394.     begin
  2395.         return TreePkg.More (I.Place);
  2396.     end;
  2397.      
  2398.     ------------------------------------------------------------------------------
  2399.      
  2400.     procedure Next (
  2401.              I :in out SetIter;
  2402.              M :   out DEF_ID.Locator
  2403.     ) is
  2404.         TempMember :Member;
  2405.     begin
  2406.         TreePkg.Next (I.Place, TempMember);
  2407.         M := TempMember.Info;
  2408.         I.Count := TempMember.Count;
  2409.     end;
  2410.      
  2411.     ------------------------------------------------------------------------------
  2412.      
  2413.     end DEF_ID_Set;
  2414.      
  2415.      
  2416.      
  2417.      
  2418.      
  2419.     package body BlockInfoStack is
  2420.      
  2421.      
  2422.         use Lists;
  2423.      
  2424.      
  2425.      
  2426.         function create
  2427.             return stack is
  2428.         begin
  2429.             return new stack_rec'(size => 0, elts => create);
  2430.         end create;
  2431.      
  2432.         procedure push(s: in out stack;
  2433.                        e:        BlockInfoType) is
  2434.         begin
  2435.             s.size := s.size + 1;
  2436.             s.elts := attach(e, s.elts);
  2437.         exception
  2438.             when constraint_error =>
  2439.                 raise uninitialized_stack;
  2440.         end push;
  2441.      
  2442.         procedure pop(s: in out stack) is
  2443.         begin
  2444.             DeleteHead(s.elts);
  2445.             s.size := s.size - 1;
  2446.         exception
  2447.             when EmptyList =>
  2448.                 raise empty_stack;
  2449.             when constraint_error =>
  2450.                 raise uninitialized_stack;
  2451.         end pop;
  2452.      
  2453.         procedure pop(s: in out stack;
  2454.                       e: out    BlockInfoType) is
  2455.         begin
  2456.             e := FirstValue(s.elts);
  2457.             DeleteHead(s.elts);
  2458.             s.size := s.size - 1;
  2459.         exception
  2460.             when EmptyList =>
  2461.                 raise empty_stack;
  2462.             when constraint_error =>
  2463.                 raise uninitialized_stack;
  2464.         end pop;
  2465.      
  2466.         function copy(s: stack)
  2467.             return stack is
  2468.         begin
  2469.             if s = null then raise uninitialized_stack; end if;
  2470.      
  2471.             return new stack_rec'(size => s.size,
  2472.                                   elts => copy(s.elts));
  2473.         end;
  2474.      
  2475.      
  2476.      
  2477.         function top(s: stack)
  2478.             return BlockInfoType is
  2479.         begin
  2480.             return FirstValue(s.elts);
  2481.         exception
  2482.             when EmptyList =>
  2483.                 raise empty_stack;
  2484.             when constraint_error =>
  2485.                 raise uninitialized_stack;
  2486.         end top;
  2487.      
  2488.         function size(s: stack)
  2489.             return natural is
  2490.         begin
  2491.             return s.size;
  2492.         exception
  2493.             when constraint_error =>
  2494.                 raise uninitialized_stack;
  2495.         end size;
  2496.      
  2497.         function is_empty(s: stack)
  2498.             return boolean is
  2499.         begin
  2500.             return s.size = 0;
  2501.         exception
  2502.             when constraint_error =>
  2503.                 raise uninitialized_stack;
  2504.         end is_empty;
  2505.      
  2506.      
  2507.      
  2508.         procedure destroy(s: in out stack) is
  2509.             procedure free_stack is
  2510.                 new unchecked_deallocation(stack_rec, stack);
  2511.         begin
  2512.             destroy(s.elts);
  2513.             free_stack(s);
  2514.         exception
  2515.             when constraint_error =>    -- stack is null
  2516.                 return;
  2517.         end destroy;
  2518.      
  2519.         package body Lists is
  2520.      
  2521.             procedure Free is new unchecked_deallocation (Cell, List);
  2522.      
  2523.      
  2524.            function Last (L: in     List) return List is
  2525.      
  2526.                Place_In_L:        List;
  2527.                Temp_Place_In_L:   List;
  2528.      
  2529.      
  2530.            begin
  2531.                if L = null then
  2532.                    raise EmptyList;
  2533.                else
  2534.      
  2535.                    --|  Link down L saving the pointer to the previous element in
  2536.                    --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  2537.                    --|  points to the last element in the list.
  2538.      
  2539.                    Place_In_L := L;
  2540.                    while Place_In_L /= null loop
  2541.                        Temp_Place_In_L := Place_In_L;
  2542.                        Place_In_L := Place_In_L.Next;
  2543.                    end loop;
  2544.                    return Temp_Place_In_L;
  2545.                end if;
  2546.             end Last;
  2547.      
  2548.      
  2549.      
  2550.             procedure Attach (List1: in out List;
  2551.                               List2: in     List ) is
  2552.                 EndOfList1: List;
  2553.      
  2554.             --| Attach List2 to List1.
  2555.             --| If List1 is null return List2
  2556.             --| If List1 equals List2 then raise CircularList
  2557.             --| Otherwise get the pointer to the last element of List1 and change
  2558.             --| its Next field to be List2.
  2559.      
  2560.             begin
  2561.                 if List1 = null then
  2562.                     List1 := List2;
  2563.                     return;
  2564.                 elsif List1 = List2 then
  2565.                     raise CircularList;
  2566.                 else
  2567.                     EndOfList1 := Last (List1);
  2568.                     EndOfList1.Next := List2;
  2569.                 end if;
  2570.             end Attach;
  2571.      
  2572.      
  2573.            procedure Attach (L:       in out List;
  2574.                              Element: in     BlockInfoType ) is
  2575.      
  2576.                NewEnd:    List;
  2577.      
  2578.      
  2579.            begin
  2580.                NewEnd := new Cell'(Info => Element, Next => null);
  2581.                Attach (L, NewEnd);
  2582.            end;
  2583.      
  2584.      
  2585.            function Attach (Element1: in   BlockInfoType;
  2586.                             Element2: in   BlockInfoType ) return List is
  2587.                NewList: List;
  2588.      
  2589.      
  2590.            begin
  2591.                NewList := new Cell'(Info => Element1, Next => null);
  2592.                Attach (NewList, Element2);
  2593.                return NewList;
  2594.            end;
  2595.      
  2596.      
  2597.            procedure Attach (Element: in     BlockInfoType;
  2598.                              L:       in out List      ) is
  2599.      
  2600.      
  2601.            begin
  2602.                L := new Cell'(Info => Element, Next => L);
  2603.            end;
  2604.      
  2605.      
  2606.            function Attach ( List1: in    List;
  2607.                              List2: in    List   ) return List is
  2608.      
  2609.            Last_Of_List1: List;
  2610.      
  2611.            begin
  2612.                if List1 = null then
  2613.                    return List2;
  2614.                elsif List1 = List2 then
  2615.                    raise CircularList;
  2616.                else
  2617.                    Last_Of_List1 := Last (List1);
  2618.                    Last_Of_List1.Next := List2;
  2619.                    return List1;
  2620.                end if;
  2621.            end  Attach;
  2622.      
  2623.      
  2624.            function Attach( L:       in     List;
  2625.                             Element: in     BlockInfoType ) return List is
  2626.      
  2627.            NewEnd: List;
  2628.            Last_Of_L: List;
  2629.      
  2630.      
  2631.            begin
  2632.                NewEnd := new Cell'(Info => Element, Next => null);
  2633.                if L = null then
  2634.                    return NewEnd;
  2635.                else
  2636.                    Last_Of_L := Last (L);
  2637.                    Last_Of_L.Next := NewEnd;
  2638.                    return L;
  2639.                end if;
  2640.            end Attach;
  2641.      
  2642.      
  2643.            function Attach (Element: in     BlockInfoType;
  2644.                             L:       in     List        ) return List is
  2645.      
  2646.            begin
  2647.                return (new Cell'(Info => Element, Next => L));
  2648.            end Attach;
  2649.      
  2650.      
  2651.            function Copy (L: in     List) return List is
  2652.      
  2653.      
  2654.            begin
  2655.                if L = null then
  2656.                    return null;
  2657.                else
  2658.                    return new Cell'(Info => L.Info, Next => Copy (L.Next));
  2659.                end if;
  2660.            end Copy;
  2661.      
  2662.      
  2663.      
  2664.      
  2665.      
  2666.             function Create return List is
  2667.      
  2668.             --| Return the empty list.
  2669.      
  2670.             begin
  2671.                 return null;
  2672.             end Create;
  2673.      
  2674.            procedure DeleteHead (L: in out List) is
  2675.      
  2676.                TempList: List;
  2677.      
  2678.      
  2679.            begin
  2680.                if L = null then
  2681.                    raise EmptyList;
  2682.                else
  2683.                    TempList := L.Next;
  2684.                    Free (L);
  2685.                    L := TempList;
  2686.                end if;
  2687.            end DeleteHead;
  2688.      
  2689.      
  2690.            procedure DeleteItem (L:       in out List;
  2691.                                  Element: in     BlockInfoType ) is
  2692.      
  2693.                Temp_L  :List;
  2694.      
  2695.      
  2696.            begin
  2697.                if L.Info = Element then
  2698.                    DeleteHead(L);
  2699.                else
  2700.                    DeleteItem(L.Next, Element);
  2701.                end if;
  2702.            exception
  2703.                when constraint_error =>
  2704.                    raise ItemNotPresent;
  2705.            end DeleteItem;
  2706.      
  2707.      
  2708.            procedure DeleteItems (L:       in out List;
  2709.                                   Element: in     BlockInfoType ) is
  2710.      
  2711.                Place_In_L       :List;     --| Current place in L.
  2712.                Last_Place_In_L  :List;     --| Last place in L.
  2713.                Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  2714.                Found            :boolean := false;  --| Indicates if an element with
  2715.                                                     --| the correct value was found.
  2716.      
  2717.      
  2718.            begin
  2719.                Place_In_L := L;
  2720.                Last_Place_In_L := null;
  2721.                while (Place_In_L /= null) loop
  2722.      
  2723.                    --| Found an element equal to Element
  2724.      
  2725.                    if Place_In_L.Info = Element then
  2726.                         Found := true;
  2727.      
  2728.                         --| If Last_Place_In_L is null then we are at first element
  2729.                         --| in L.
  2730.      
  2731.                         if Last_Place_In_L = null then
  2732.                              Temp_Place_In_L := Place_In_L;
  2733.                              L := Place_In_L.Next;
  2734.                         else
  2735.                              Temp_Place_In_L := Place_In_L;
  2736.      
  2737.                              --| Relink the list Last's Next gets Place's Next
  2738.      
  2739.                              Last_Place_In_L.Next := Place_In_L.Next;
  2740.                         end if;
  2741.      
  2742.                         --| Move Place_In_L to the next position in the list.
  2743.                         --| Free the element.
  2744.                         --| Do not update the last element in the list it remains the
  2745.                         --| same.
  2746.      
  2747.                         Place_In_L := Place_In_L.Next;
  2748.                         Free (Temp_Place_In_L);
  2749.                    else
  2750.                         --| Update the last place in L and the place in L.
  2751.      
  2752.                         Last_Place_In_L := Place_In_L;
  2753.                         Place_In_L := Place_In_L.Next;
  2754.                    end if;
  2755.                end loop;
  2756.      
  2757.      
  2758.            if not Found then
  2759.               raise ItemNotPresent;
  2760.            end if;
  2761.      
  2762.            end DeleteItems;
  2763.      
  2764.      
  2765.            procedure Destroy (L: in out List) is
  2766.      
  2767.                Place_In_L:  List;
  2768.                HoldPlace:   List;
  2769.      
  2770.      
  2771.            begin
  2772.                Place_In_L := L;
  2773.                while Place_In_L /= null loop
  2774.                    HoldPlace := Place_In_L;
  2775.                    Place_In_L := Place_In_L.Next;
  2776.                    Free (HoldPlace);
  2777.                end loop;
  2778.                L := null;
  2779.            end Destroy;
  2780.      
  2781.      
  2782.            function FirstValue (L: in    List) return BlockInfoType is
  2783.      
  2784.      
  2785.            begin
  2786.                if L = null then
  2787.                    raise EmptyList;
  2788.                else
  2789.                    return (L.Info);
  2790.                end if;
  2791.            end FirstValue;
  2792.      
  2793.      
  2794.            procedure Forword (I: in out ListIter) is
  2795.      
  2796.                PlaceInList :List;
  2797.            begin
  2798.                PlaceInList := List (I);
  2799.                I := ListIter (PlaceInList.Next);
  2800.            end Forword;
  2801.      
  2802.      
  2803.            function IsInList (L:       in    List;
  2804.                               Element: in    BlockInfoType  ) return boolean is
  2805.      
  2806.            Place_In_L: List;
  2807.      
  2808.      
  2809.            begin
  2810.                Place_In_L := L;
  2811.                while Place_In_L /= null loop
  2812.                    if Place_In_L.Info = Element then
  2813.                        return true;
  2814.                    end if;
  2815.                    Place_In_L := Place_In_L.Next;
  2816.                 end loop;
  2817.                 return false;
  2818.            end IsInList;
  2819.      
  2820.      
  2821.             function IsEmpty (L: in     List) return boolean is
  2822.      
  2823.             --| Is the list L empty.
  2824.      
  2825.             begin
  2826.                 return (L = null);
  2827.             end IsEmpty;
  2828.      
  2829.      
  2830.            function LastValue (L: in     List) return BlockInfoType is
  2831.      
  2832.                LastElement: List;
  2833.      
  2834.      
  2835.            begin
  2836.                LastElement := Last (L);
  2837.                return LastElement.Info;
  2838.            end LastValue;
  2839.      
  2840.      
  2841.            function Length (L: in     List) return integer is
  2842.      
  2843.      
  2844.            begin
  2845.                if L = null then
  2846.                    return (0);
  2847.                else
  2848.                    return (1 + Length (Tail (L)));
  2849.                end if;
  2850.            end Length;
  2851.      
  2852.      
  2853.            function MakeListIter (L: in     List) return ListIter is
  2854.      
  2855.      
  2856.            begin
  2857.                return ListIter (L);
  2858.            end MakeListIter;
  2859.      
  2860.      
  2861.            function More (L: in     ListIter) return boolean is
  2862.      
  2863.      
  2864.            begin
  2865.                return L /= null;
  2866.            end;
  2867.      
  2868.      
  2869.            procedure Next (Place:   in out ListIter;
  2870.                            Info:       out BlockInfoType ) is
  2871.                PlaceInList: List;
  2872.      
  2873.      
  2874.            begin
  2875.                if Place = null then
  2876.                   raise NoMore;
  2877.                else
  2878.                   PlaceInList := List(Place);
  2879.                   Info := PlaceInList.Info;
  2880.                   Place := ListIter(PlaceInList.Next);
  2881.                end if;
  2882.            end Next;
  2883.      
  2884.      
  2885.            procedure ReplaceHead (L:    in out  List;
  2886.                                   Info: in      BlockInfoType ) is
  2887.      
  2888.      
  2889.            begin
  2890.                if L = null then
  2891.                    raise EmptyList;
  2892.                else
  2893.                    L.Info := Info;
  2894.                end if;
  2895.            end ReplaceHead;
  2896.      
  2897.      
  2898.            procedure ReplaceTail (L:        in out List;
  2899.                                   NewTail:  in     List  ) is
  2900.                Temp_L: List;
  2901.      
  2902.      
  2903.            begin
  2904.                Destroy(L.Next);
  2905.                L.Next := NewTail;
  2906.            exception
  2907.                when constraint_error =>
  2908.                    raise EmptyList;
  2909.            end ReplaceTail;
  2910.      
  2911.      
  2912.             function Tail (L: in    List) return List is
  2913.      
  2914.             --| This returns the list which is the tail of L.  If L is null Empty
  2915.             --| List is raised.
  2916.      
  2917.             begin
  2918.                 if L = null then
  2919.                     raise EmptyList;
  2920.                 else
  2921.                     return L.Next;
  2922.                 end if;
  2923.             end Tail;
  2924.      
  2925.             function Equal (List1: in    List;
  2926.                             List2: in    List ) return boolean is
  2927.      
  2928.                 PlaceInList1: List;
  2929.                 PlaceInList2: LIst;
  2930.                 Contents1:    BlockInfoType;
  2931.                 Contents2:    BlockInfoType;
  2932.      
  2933.             --| This function tests to see if two lists are equal.  Two lists
  2934.             --| are equal if for all the elements of List1 the corresponding
  2935.             --| element of List2 has the same value.  Thus if the 1st elements
  2936.             --| are equal and the second elements are equal and so up to n.
  2937.             --|  Thus a necessary condition for two lists to be equal is that
  2938.             --| they have the same number of elements.
  2939.      
  2940.             --| This function walks over the two list and checks that the
  2941.             --| corresponding elements are equal.  As soon as we reach
  2942.             --| the end of a list (PlaceInList = null) we fall out of the loop.
  2943.             --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  2944.             --| then the lists are equal.  If they both are not null the lists aren't
  2945.             --| equal.  Note that equality on elements is based on a user supplied
  2946.             --| function Equal which is used to test for item equality.
  2947.      
  2948.             begin
  2949.                 PlaceInList1 := List1;
  2950.                 PlaceInList2 := List2;
  2951.                 while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  2952.                     if not "=" (PlaceInList1.Info, PlaceInList2.Info) then
  2953.                         return false;
  2954.                     end if;
  2955.                     PlaceInList1 := PlaceInList1.Next;
  2956.                     PlaceInList2 := PlaceInList2.Next;
  2957.                 end loop;
  2958.                 return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  2959.             end Equal;
  2960.         end Lists;
  2961.      
  2962.      
  2963.      
  2964.      
  2965.      
  2966.     end BlockInfoStack;
  2967. end Definitions;
  2968. ::::::::::::::
  2969. defs.spc
  2970. ::::::::::::::
  2971. -- $Source: /nosc/work/tools/halstead/RCS/defs.spc,v $
  2972. -- $Revision: 5.7 $ -- $Date: 85/09/04 09:24:19 $ -- $Author: buddy $
  2973. with ST_Diana; use ST_Diana;
  2974. with ML_Source_Position_Pkg;
  2975. package Definitions is
  2976.      
  2977. --| OVERVIEW
  2978. --| This package defines all the data used by the Halstead program.  This
  2979. --| package also defines all the operations on the data types defined.
  2980. --| The following is a list of all the abstract data types which
  2981. --| this package defines.
  2982. --|
  2983. --|
  2984. --|      1. DEF_ID_Set.Set from the package DEF_ID_Set
  2985. --|      2. Literal_Set.Set from the package Literal_Set
  2986. --|      3. BlockInfoStack.Stack from the package BlockInfoStack
  2987. --|
  2988. --| The types defined here are all used to create the BlockInfoType.
  2989. --| BlockInfoType keeps all the information pertaining to current block
  2990. --| being processed.  The type is composed of four components types which
  2991. --| are:
  2992. --|                      1.  TokenCountType
  2993. --|                      2.  BlockIdType
  2994. --|                      3.  Literal_Set.Set
  2995. --|                      4.  DEF_ID_Set.Set
  2996. --|
  2997. --| TokenCountType   keeps track of the number of times each token appears
  2998. --|                  in the source program.
  2999. --|
  3000. --| BlockIdType      maintains the name of the current block being
  3001. --|                  processed, whether the block is a body or a spec, and
  3002. --|                  the type of block whether its a procedure, package...
  3003. --|
  3004. --| Literal_Set      This keeps a counted set of all the literals
  3005. --|                  appearing in a given block.  These literals will be
  3006. --|                  counted as operands.
  3007. --|
  3008. --| DEF_ID_Set.Set   This keeps a list of all the identifiers encounted
  3009. --|                  in a block.  At the end of the block all the
  3010. --|                  identifiers are categorized into operands and
  3011. --|                  operators.
  3012.      
  3013.      
  3014. --| EFFECTS
  3015. --| Associated with the three abstract data types DEF_ID_Set.Set
  3016. --| Literal_Set.Set and BlockInfo.Stack are a complete set of
  3017. --| operations.
  3018. --|
  3019. --| The operations associated with the sets DEF_ID_Set.Set and
  3020. --| Literal_Set.Set are counted sets.  This means that a member in the
  3021. --| set has a count associated with it.  Each time an insert is done
  3022. --| on a member the count for the member is incremented.
  3023. --|
  3024. --| The operations associated with BlockInfoStack are the normal
  3025. --| stack operations Push, Pop and some others.  These operations are
  3026. --| used to stack the information associated with a block.
  3027.      
  3028. --| TUNING
  3029. --| One way to tune this package is to cut out a lot of the functions
  3030. --| which are not used.  For example the users of this package do not
  3031. --| use FirstValue and some of the other operations of the list package.
  3032.      
  3033.      
  3034.     type TokenItem is (
  3035.         abortz,
  3036.         acceptz,
  3037.         accessz,
  3038.         allz,
  3039.         and_thenz,
  3040.         arrayz,
  3041.         atz,
  3042.         beginz,
  3043.         bodyz,
  3044.         body_packagez,
  3045.         body_taskz,
  3046.         casez,
  3047.         case_stmz,
  3048.         case_variantz,
  3049.         constantz,
  3050.         declarez,
  3051.         delayz,
  3052.         deltaz,
  3053.         digitsz,
  3054.         doz,
  3055.         elsez,
  3056.         else_ifz,
  3057.         else_orz,
  3058.         else_selectz,
  3059.         elsifz,
  3060.         endz,
  3061.         end_acceptz,
  3062.         end_beginz,
  3063.         end_case_stmz,
  3064.         end_case_variantz,
  3065.         end_ifz,
  3066.         end_loopz,
  3067.         end_package_bdyz,
  3068.         end_package_spcz,
  3069.         end_recordz,
  3070.         end_record_repz,
  3071.         end_selectz,
  3072.         end_task_spcz,
  3073.         entryz,
  3074.         exceptionz,
  3075.         exitz,
  3076.         forz,
  3077.         for_loopz,
  3078.         for_repz,
  3079.         functionz,
  3080.         genericz,
  3081.         gotoz,
  3082.         ifz,
  3083.         inz,
  3084.         in_loopz,
  3085.         in_membershipz,
  3086.         in_out_parameterz,
  3087.         in_parameterz,
  3088.         isz,
  3089.         is_case_stmz,
  3090.         is_case_variantz,
  3091.         is_functionz,
  3092.         is_genericz,
  3093.         is_package_bdyz,
  3094.         is_package_spcz,
  3095.         is_procedurez,
  3096.         is_separatez,
  3097.         is_subtypez,
  3098.         is_typez,
  3099.         is_task_bdyz,
  3100.         is_task_spcz,
  3101.         limitedz,
  3102.         loopz,
  3103.         modz,
  3104.         newz,
  3105.         new_allocatorz,
  3106.         new_derived_typez,
  3107.         new_generic_instz,
  3108.         not_in_membershipz,
  3109.         nullz,
  3110.         null_valuez,
  3111.         null_stmz,
  3112.         null_fieldz,
  3113.         ofz,
  3114.         orz,
  3115.         or_elsez,
  3116.         or_selectz,
  3117.         othersz,
  3118.         others_aggregatez,
  3119.         others_casez,
  3120.         others_exceptionz,
  3121.         others_variantz,
  3122.         outz,
  3123.         packagez,
  3124.         package_bdyz,
  3125.         package_spcz,
  3126.         pragmaz,
  3127.         privatez,
  3128.         private_sectionz,
  3129.         private_typez,
  3130.         procedurez,
  3131.         raisez,
  3132.         rangez,
  3133.         recordz,
  3134.         record_typez,
  3135.         record_repz,
  3136.         renamesz,
  3137.         returnz,
  3138.         reversez,
  3139.         selectz,
  3140.         separatez,
  3141.         subtypez,
  3142.         taskz,
  3143.         task_bdyz,
  3144.         task_spcz,
  3145.         terminatez,
  3146.         thenz,
  3147.         then_andz,
  3148.         typez,
  3149.         usez,
  3150.         use_contextz,
  3151.         use_repz,
  3152.         whenz,
  3153.         when_case_stmz,
  3154.         when_exitz,
  3155.         when_exceptionz,
  3156.         when_selectz,
  3157.         when_case_variantz,
  3158.         whilez,
  3159.         withz,
  3160.         with_contextz,
  3161.         with_genericz,
  3162.         -------------  punctuation  --------------
  3163.         arrowz,
  3164.         barz,
  3165.         boxz,
  3166.         box_rangez,
  3167.         box_default_subpz,
  3168.         character_literalz,
  3169.         closed_anglesz,
  3170.         closed_parenthesisz,
  3171.         colon_equalsz,
  3172.         colonz,
  3173.         commaz,
  3174.         dotz,
  3175.         dot_dot_rangez,
  3176.         double_quotez,
  3177.         numeric_literalz,
  3178.         open_anglesz,
  3179.         open_parenthesisz,
  3180.         semicolonz,
  3181.         single_quotez,
  3182.         tickz,
  3183.         declare_blockz
  3184.     );
  3185.       --| These are all the tokens which could possibly be counted by
  3186.       --| Halstead.
  3187.      
  3188.     type Class is (operator, operand, neither);
  3189.       --| These are the different ways to classify symbols in the source
  3190.       --| program.
  3191.      
  3192.     type TokenCountType is array(TokenItem) of natural;
  3193.       --| This type is used to count the occurrences of each token
  3194.       --| in the source program.
  3195.      
  3196.     type TokenClassificationType is array(TokenItem) of Class;
  3197.       --| This type is used to defined whether tokens are operators
  3198.       --| or operands or neither.
  3199.      
  3200.     type BlockKind is ( procedure_block,
  3201.                         function_block,
  3202.                         package_body_block,
  3203.                         package_spec_block,
  3204.                         task_body_block,
  3205.                         task_spec_block,
  3206.                         declare_block );
  3207.     --| This keeps track of the type of block being processed currently.
  3208.      
  3209.      
  3210.     BlockNameLength: constant := 16;
  3211.       --| Maximum length of a block name.
  3212.      
  3213.     SpcBdyIdLength: constant := 13;
  3214.       --| Maximum lenght of  a string which indicates whether a block
  3215.       --| is a spec, body, or declare block.
  3216.      
  3217.     subtype SpcBdyIdType is string(1..SpcBdyIdLength);
  3218.      
  3219.     AnonId :constant SpcBdyIdType := "             ";
  3220.     BdyId  :constant SpcBdyIdType := "BODY         ";
  3221.     DecId  :constant SpcBdyIdType := "DECLARE BLOCK";
  3222.     SpcId  :constant SpcBdyIdType := "SPECIFICATION";
  3223.       --| These are used to initialize the SpcOrBdyId field of
  3224.       --| BlockIdType.
  3225.      
  3226.     type StringPtr is access String;
  3227.       --| This is used to keep track of the fully qualified name of the
  3228.       --| block being processed.  Each time a new scope is entered
  3229.       --| the name of that scope is concatenated with the current
  3230.       --| fully qualified name.
  3231.      
  3232.     type BlockIdType is
  3233.        record
  3234.          KindOfBlock   :BlockKind;
  3235.          SpcBdyId      :SpcBdyIdType;
  3236.          BlockName     :StringPtr;
  3237.          LineLocation  :ML_Source_Position_Pkg.Source_Line;
  3238.        end record;
  3239.        --| This type keeps track of the name of a block.  For instance
  3240.        --| if we are processing the body of procedure P then the name
  3241.        --| of the block is P.  The KindOfBlock is "PROCEDURE" and
  3242.        --| SpcOrBdyId = "(B)".
  3243.      
  3244.      
  3245.      
  3246.      
  3247.      
  3248.      
  3249.     --| The following code represents a generic instantiation of the
  3250.     --| OrderedSet package.  It replaces:
  3251.     --|
  3252.     --| package DEF_ID_Set is new OrderedSet
  3253.     --|            (ItemType => DEF_ID.Locator,
  3254.     --|             "<" => ST_Diana.DEF_ID."<");
  3255.      
  3256.      
  3257.     --------------------------------------------------------------------------
  3258.     --               GENERIC INSTANTIATION
  3259.     --------------------------------------------------------------------------
  3260.      
  3261.     function "<" ( X, Y: DEF_ID.Locator) return boolean
  3262.       renames  ST_Diana.DEF_ID."<";
  3263.      
  3264.     package DEF_ID_Set is
  3265.      
  3266.     --| Overview
  3267.     --| This abstractions is a counted ordered set.  This means that
  3268.     --| associated with each member of the set is a count of the number of
  3269.     --| times it appears in the set.  The order part means that there is
  3270.     --| an ordering associated with the members.  This allows fast insertion.
  3271.     --| It also makes it easy to iterate over the set in order.
  3272.      
  3273.      
  3274.      
  3275.     --                    Types
  3276.     --                    -----
  3277.      
  3278.           type Set is private;  --| This is the type exported to represent
  3279.                                 --| the ordered set.
  3280.      
  3281.           type SetIter is private;  --| This is the type exported whose
  3282.                                     --| purpose is to walk over a set.
  3283.      
  3284.      
  3285.     --                   Operations
  3286.     --                   ----------
  3287.      
  3288.     --| Cardinality              Returns cardinality of the set.
  3289.     --| Create                   Creates the empty set.
  3290.     --| CountMember              Returns the number of times the member appears in
  3291.     --|                          the set.
  3292.     --| Destroy                  Destroys a set and returns the space it occupies.
  3293.     --| Insert                   Insert a member into  the set.
  3294.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  3295.     --| More                     Are there more elements to iterate over in the
  3296.     --|                          set.
  3297.     --| Next                     Return the next element in the iteration and
  3298.     --|                          bump the iterator.
  3299.      
  3300.      
  3301.     ------------------------------------------------------------------------------
  3302.      
  3303.     function Cardinality (   --| Return the number of members in the set.
  3304.              S     :in Set   --| The set whose members are being counted.
  3305.     ) return natural;
  3306.      
  3307.     ------------------------------------------------------------------------------
  3308.      
  3309.      
  3310.     function Create   --| Return the empty set.
  3311.     return Set;
  3312.      
  3313.     ------------------------------------------------------------------------------
  3314.      
  3315.     procedure Destroy (        --| Destroy a set and return its space.
  3316.               S   :in out Set  --| Set being destroyed.
  3317.      
  3318.     );
  3319.      
  3320.     ------------------------------------------------------------------------------
  3321.      
  3322.     function GetCount (            --| This returns the count associated with
  3323.                                    --| member which corresponds to the current
  3324.                                    --| iterator I.
  3325.              I :in     SetIter
  3326.     ) return natural;
  3327.      
  3328.     -----------------------------------------------------------------------------
  3329.      
  3330.     procedure Insert (             --| Insert a member M into set S.
  3331.              M :in     DEF_ID.Locator;   --| Member being inserted.
  3332.              S :in out Set         --| Set being inserted into.
  3333.     );
  3334.      
  3335.     ------------------------------------------------------------------------------
  3336.      
  3337.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  3338.                                 --| by returning a SetIter.
  3339.              S :in     Set     --| Set being iterate over.
  3340.     ) return SetIter;
  3341.      
  3342.     ------------------------------------------------------------------------------
  3343.      
  3344.     function More (             --| Returns true if there are more elements in the
  3345.                                 --| set to iterate over.
  3346.              I :in    SetIter   --| The iterator.
  3347.      
  3348.     ) return boolean;
  3349.      
  3350.     ------------------------------------------------------------------------------
  3351.      
  3352.     procedure Next (              --| Returns the current member in the iteration
  3353.                                   --| an increments the iterator.
  3354.              I :in out SetIter;   --| The iterator.
  3355.              M :   out DEF_ID.Locator   --| The current member being returned.
  3356.     );
  3357.      
  3358.     -----------------------------------------------------------------------------
  3359.      
  3360.     private
  3361.      
  3362.        type Member is
  3363.            record
  3364.              Info   :DEF_ID.Locator;
  3365.              Count  :natural;
  3366.            end record;
  3367.      
  3368.        function "<" (
  3369.                 X:in    Member;
  3370.                 Y:in    Member
  3371.        ) return boolean;
  3372.      
  3373.        -- generic instantiation
  3374.        --package TreePkg is new BinaryTrees ( DEF_ID.Locator => Member, "<" => "<" );
  3375.      
  3376.      
  3377.     package TreePkg is
  3378.      
  3379.      
  3380.     --| Overview
  3381.     --| This package creates an ordered binary tree.  This will allow for
  3382.     --| quick insertion, and search.
  3383.     --|
  3384.     --| The tree is organized such that
  3385.     --|
  3386.     --|  leftchild < root    root < rightchild
  3387.     --|
  3388.     --| This means that by doing a left to right search of the tree will can
  3389.     --| produce the nodes of the tree in ascending order.
  3390.      
  3391.      
  3392.      
  3393.      
  3394.      
  3395.     --                             Types
  3396.     --                             -----
  3397.      
  3398.     type Tree is  private;     --| This is the type exported to represent the
  3399.                                --| tree.
  3400.      
  3401.      
  3402.     type TreeIter is private;  --| This is the type which is used to iterate
  3403.                                --| over the set.
  3404.      
  3405.     --|                          Exceptions
  3406.     --|                          ----------
  3407.      
  3408.     --|                          Operations
  3409.     --|                          ----------
  3410.     --|
  3411.     --| Create           Creates a tree.
  3412.     --| Deposit          Replaces the given node's information with
  3413.     --|                  the given information.
  3414.     --| DestroyTree      Destroys the given tree and returns the spaces.
  3415.     --| InsertNode       This inserts a node n into a tree t.
  3416.     --| MakeTreeIter     This returns an iterator to the user in order to start
  3417.     --|                  an iteration.
  3418.     --| More             This returns true if there are more elements to iterate
  3419.     --|                  over in the tree.
  3420.     --| Next             This returns the information associated with the current
  3421.     --|                  iterator and advances the iterator.
  3422.      
  3423.      
  3424.     ---------------------------------------------------------------------------
  3425.      
  3426.     function Create             --| This function creates the tree.
  3427.      
  3428.     return Tree;
  3429.      
  3430.     --| Effects
  3431.     --| This creates a tree containing no information and no children.  An
  3432.     --| emptytree.
  3433.      
  3434.     -------------------------------------------------------------------------------
  3435.      
  3436.     procedure Deposit (              --| This deposits the information I in the
  3437.                                      --| root of the Tree S.
  3438.               I :in     Member;    --| The information being deposited.
  3439.               S :in     Tree         --| The tree where the information is being
  3440.                                      --| stored.
  3441.     );
  3442.      
  3443.     --| Modifies
  3444.     --| This changes the information stored at the root of the tree S.
  3445.      
  3446.     -------------------------------------------------------------------------------
  3447.      
  3448.      
  3449.     procedure DestroyTree (         --| Destroys a tree.
  3450.               T  :in out Tree       --| Tree being destroyed.
  3451.     );
  3452.      
  3453.     --| Effects
  3454.     --| Destroys a tree and returns the space which it is occupying.
  3455.      
  3456.     --------------------------------------------------------------------------
  3457.      
  3458.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  3459.                                     --| Specified Tree.
  3460.            N      :In Out Member; --| The Information To Be Contained In The
  3461.                                     --| Node Being Inserted.
  3462.      
  3463.            T      :In Out Tree;     --| Tree Being Inserted Into.
  3464.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  3465.                                     --| This is the position of the node N in T.
  3466.            Exists :   out boolean   --| If this node already exists in the tree
  3467.                                     --| Exists is true.  If this is the first
  3468.                                     --| insertion Exists is false.
  3469.     );
  3470.      
  3471.     --| Effects
  3472.     --| This adds the node N to the tree T inserting in the proper postion.
  3473.      
  3474.     --| Modifies
  3475.     --| This modifies the tree T by add the node N to it.
  3476.      
  3477.     ------------------------------------------------------------------------------
  3478.      
  3479.     function MakeTreeIter (         --| Sets a variable to a position in the
  3480.                                     --| tree
  3481.                                     --| where the iteration is to begin.  In this
  3482.                                     --| case the position is a pointer to the
  3483.                                     --| the deepest leftmost leaf in the tree.
  3484.             T:in Tree               --| Tree being iterated over
  3485.     ) return TreeIter;
  3486.      
  3487.      
  3488.     --| Effects
  3489.      
  3490.      
  3491.     -----------------------------------------------------------------------------
  3492.      
  3493.     function More (                 --| Returns true if there are more elements
  3494.                                     --| in the tree to iterate over.
  3495.               I :in TreeIter
  3496.     ) return boolean;
  3497.      
  3498.      
  3499.     -----------------------------------------------------------------------------
  3500.      
  3501.     procedure Next (                --| This is the iterator operation.  Given
  3502.                                     --| an Iter in the Tree it returns the
  3503.                                     --| item Iter points to and updates the
  3504.                                     --| iter. If Iter is at the end of the Tree,
  3505.                                     --| yielditer returns false otherwise it
  3506.                                     --| returns true.
  3507.         I        :in out TreeIter;  --| The iter which marks the position in the
  3508.                                     --| Tree.
  3509.      
  3510.         Info     :   out Member   --| Information being returned from a node.
  3511.     );
  3512.      
  3513.      
  3514.     ---------------------------------------------------------------------------
  3515.      
  3516.     private
  3517.      
  3518.        type Node;
  3519.        type Tree is access Node;
  3520.      
  3521.        type Node is
  3522.             record
  3523.                 Info           :Member;
  3524.                 LeftChild      :Tree;
  3525.                 RightChild     :Tree;
  3526.             end record;
  3527.      
  3528.     ---   The following is a generic instantiation of NodeOrder
  3529.     ---   package NodeOrder is new Lists (Tree);
  3530.      
  3531.      
  3532.     package NodeOrder is
  3533.      
  3534.     --| This package provides singly linked lists with elements of type
  3535.     --| Tree, where Tree is specified by a generic parameter.
  3536.      
  3537.     --| Overview
  3538.     --| When this package is instantiated, it provides a linked list type for
  3539.     --| lists of objects of type Tree, which can be any desired type.  A
  3540.     --| complete set of operations for manipulation, and releasing
  3541.     --| those lists is also provided.  For instance, to make lists of strings,
  3542.     --| all that is necessary is:
  3543.     --|
  3544.     --| type StringType is string(1..10);
  3545.     --|
  3546.     --| package Str_List is new Lists(StringType); use Str_List;
  3547.     --|
  3548.     --|    L:List;
  3549.     --|    S:StringType;
  3550.     --|
  3551.     --| Then to add a string S, to the list L, all that is necessary is
  3552.     --|
  3553.     --|    L := Create;
  3554.     --|    Attach(S,L);
  3555.     --|
  3556.     --|
  3557.     --| This package provides basic list operations.
  3558.     --|
  3559.     --| Attach          append an object to an object, an object to a list,
  3560.     --|                 or a list to an object, or a list to a list.
  3561.     --| Copy            copy a list using := on elements
  3562.     --| CopyDeep        copy a list by copying the elements using a copy
  3563.     --|                 operation provided by the user
  3564.     --| Create          Creates an empty list
  3565.     --| DeleteHead      removes the head of a list
  3566.     --| DeleteItem      delete the first occurrence of an element from a list
  3567.     --| DeleteItems     delete all occurrences of an element from a list
  3568.     --| Destroy         remove a list
  3569.     --| Equal           are two lists equal
  3570.     --| FirstValue      get the information from the first element of a list
  3571.     --| IsInList        determines whether a given element is in a given list
  3572.     --| IsEmpty         returns true if the list is empty
  3573.     --| LastValue       return the last value of a list
  3574.     --| Length          Returns the length of a list
  3575.     --| MakeListIter    prepares for an iteration over a list
  3576.     --| More            are there any more items in the list
  3577.     --| Next            get the next item in a list
  3578.     --| ReplaceHead     replace the information at the head of the list
  3579.     --| ReplaceTail     replace the tail of a list with a new list
  3580.     --| Tail            get the tail of a list
  3581.     --|
  3582.      
  3583.     --| N/A: Effects, Requires, Modifies, and Raises.
  3584.      
  3585.     --| Notes
  3586.     --| Programmer Buddy Altus
  3587.      
  3588.     --|                           Types
  3589.     --|                           -----
  3590.      
  3591.               type List       is private;
  3592.               type ListIter   is private;
  3593.      
  3594.      
  3595.     --|                           Exceptions
  3596.     --|                           ----------
  3597.      
  3598.         CircularList     :exception;     --| Raised if an attemp is made to
  3599.                                          --| create a circular list.  This
  3600.                                          --| results when a list is attempted
  3601.                                          --| to be attached to itself.
  3602.      
  3603.         EmptyList        :exception;     --| Raised if an attemp is made to
  3604.                                          --| manipulate an empty list.
  3605.      
  3606.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  3607.                                          --| remove an element from a list in
  3608.                                          --| which it does not exist.
  3609.      
  3610.         NoMore           :exception;     --| Raised if an attemp is made to
  3611.                                          --| get the next element from a list
  3612.                                          --| after iteration is complete.
  3613.      
  3614.      
  3615.      
  3616.     --|                           Operations
  3617.     --|                           ----------
  3618.      
  3619.     ----------------------------------------------------------------------------
  3620.      
  3621.     procedure Attach(                  --| appends List2 to List1
  3622.               List1:     in out List;  --| The list being appended to.
  3623.               List2:     in     List   --| The list being appended.
  3624.     );
  3625.      
  3626.     --| Raises
  3627.     --| CircularList
  3628.      
  3629.     --| Effects
  3630.     --| Appends List1 to List2.  This makes the next field of the last element
  3631.     --| of List1 refer to List2.  This can possibly change the value of List1
  3632.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  3633.     --| user Destroys List1 then List2 will be a dangling reference.
  3634.     --| This procedure raises CircularList if List1 equals List2.  If it is
  3635.     --| necessary to Attach a list to itself first make a copy of the list and
  3636.     --| attach the copy.
  3637.      
  3638.     --| Modifies
  3639.     --| Changes the next field of the last element in List1 to be List2.
  3640.      
  3641.     -------------------------------------------------------------------------------
  3642.      
  3643.     function Attach(                 --| Creates a new list containing the two
  3644.                                      --| Elements.
  3645.              Element1: in Tree;  --| This will be first element in list.
  3646.              Element2: in Tree   --| This will be second element in list.
  3647.     ) return List;
  3648.      
  3649.     --| Effects
  3650.     --| This creates a list containing the two elements in the order
  3651.     --| specified.
  3652.      
  3653.     -------------------------------------------------------------------------------
  3654.     procedure Attach(                   --| List L is appended with Element.
  3655.              L:       in out List;      --| List being appended to.
  3656.              Element: in     Tree   --| This will be last element in l    ist.
  3657.     );
  3658.      
  3659.     --| Effects
  3660.     --| Appends Element onto the end of the list L.  If L is empty then this
  3661.     --| may change the value of L.
  3662.     --|
  3663.     --| Modifies
  3664.     --| This appends List L with Element by changing the next field in List.
  3665.      
  3666.     --------------------------------------------------------------------------------
  3667.     procedure Attach(                   --| Makes Element first item in list L.
  3668.              Element: in      Tree; --| This will be the first element in list.
  3669.              L:       in  out List      --| The List which Element is being
  3670.                                         --| prepended to.
  3671.     );
  3672.      
  3673.     --| Effects
  3674.     --| This prepends list L with Element.
  3675.     --|
  3676.     --| Modifies
  3677.     --| This modifies the list L.
  3678.      
  3679.     --------------------------------------------------------------------------
  3680.      
  3681.     function Attach (                      --| attaches two lists
  3682.              List1: in     List;           --| first list
  3683.              List2: in     List            --| second list
  3684.     ) return List;
  3685.      
  3686.     --| Raises
  3687.     --| CircularList
  3688.      
  3689.     --| Effects
  3690.     --| This returns a list which is List1 attached to List2.  If it is desired
  3691.     --| to make List1 be the new attached list the following ada code should be
  3692.     --| used.
  3693.     --|
  3694.     --| List1 := Attach (List1, List2);
  3695.     --| This procedure raises CircularList if List1 equals List2.  If it is
  3696.     --| necessary to Attach a list to itself first make a copy of the list and
  3697.     --| attach the copy.
  3698.      
  3699.     -------------------------------------------------------------------------
  3700.      
  3701.     function Attach (                   --| prepends an element onto a list
  3702.              Element: in    Tree;   --| element being prepended to list
  3703.              L:       in    List        --| List which element is being added
  3704.                                         --| to
  3705.     ) return List;
  3706.      
  3707.     --| Effects
  3708.     --| Returns a new list which is headed by Element and followed by L.
  3709.      
  3710.     ------------------------------------------------------------------------
  3711.      
  3712.     function Attach (                  --| Adds an element to the end of a list
  3713.              L: in          List;      --| The list which element is being added to.
  3714.              Element: in    Tree   --| The element being added to the end of
  3715.                                        --| the list.
  3716.     ) return List;
  3717.      
  3718.     --| Effects
  3719.     --| Returns a new list which is L followed by Element.
  3720.      
  3721.     --------------------------------------------------------------------------
  3722.      
  3723.      
  3724.     function Copy(          --| returns a copy of list1
  3725.            L: in List       --| list being copied
  3726.     ) return List;
  3727.      
  3728.     --| Effects
  3729.     --| Returns a copy of L.
  3730.      
  3731.     --------------------------------------------------------------------------
  3732.      
  3733.      
  3734.     function Create           --| Returns an empty List
  3735.      
  3736.     return List;
  3737.      
  3738.     ------------------------------------------------------------------------------
  3739.      
  3740.     procedure DeleteHead(            --| Remove the head element from a list.
  3741.               L: in out List         --| The list whose head is being removed.
  3742.     );
  3743.      
  3744.     --| Raises
  3745.     --| EmptyList
  3746.     --|
  3747.     --| Effects
  3748.     --| This will return the space occupied by the first element in the list
  3749.     --| to the heap.  If sharing exists between lists this procedure
  3750.     --| could leave a dangling reference.  If L is empty EmptyList will be
  3751.     --| raised.
  3752.      
  3753.     ------------------------------------------------------------------------------
  3754.      
  3755.     procedure DeleteItem(           --| remove the first occurrence of Element
  3756.                                     --| from L
  3757.           L:       in out List;     --| list element is being  removed from
  3758.           Element: in     Tree  --| element being removed
  3759.     );
  3760.      
  3761.     --| Raises
  3762.     --| ItemNotPresent
  3763.      
  3764.     --| Effects
  3765.     --| Removes the first element of the list equal to Element.  If there is
  3766.     --| not an element equal to Element than ItemNotPresent is raised.
  3767.      
  3768.     --| Modifies
  3769.     --| This operation is destructive, it returns the storage occupied by
  3770.     --| the elements being deleted.
  3771.      
  3772.     ------------------------------------------------------------------------------
  3773.      
  3774.     procedure DeleteItems(          --| remove all occurrences of Element
  3775.                                     --| from  L.
  3776.           L:       in out List;     --| The List element is being removed from
  3777.           Element: in     Tree  --| element being removed
  3778.     );
  3779.      
  3780.     --| Raises
  3781.     --| ItemNotPresent
  3782.     --|
  3783.     --| Effects
  3784.     --| This procedure walks down the list L and removes all elements of the
  3785.     --| list equal to Element.  If there are not any elements equal to Element
  3786.     --| then raise ItemNotPresent.
  3787.      
  3788.     --| Modifies
  3789.     --| This operation is destructive the storage occupied by the items
  3790.     --| removed is returned.
  3791.      
  3792.     ------------------------------------------------------------------------------
  3793.      
  3794.     procedure Destroy(            --| removes the list
  3795.               L: in out List      --| the list being removed
  3796.     );
  3797.      
  3798.     --| Effects
  3799.     --| This returns to the heap all the storage that a list occupies.  Keep in
  3800.     --| mind if there exists sharing between lists then this operation can leave
  3801.     --| dangling references.
  3802.      
  3803.     ------------------------------------------------------------------------------
  3804.      
  3805.     function FirstValue(      --| returns the contents of the first record of the
  3806.                               --| list
  3807.              L: in List       --| the list whose first element is being
  3808.                               --| returned
  3809.      
  3810.     ) return Tree;
  3811.      
  3812.     --| Raises
  3813.     --| EmptyList
  3814.     --|
  3815.     --| Effects
  3816.     --| This returns the Item in the first position in the list.  If the list
  3817.     --| is empty EmptyList is raised.
  3818.      
  3819.     -------------------------------------------------------------------------------
  3820.      
  3821.     function IsEmpty(            --| Checks if a list is empty.
  3822.              L: in     List      --| List being checked.
  3823.     ) return boolean;
  3824.      
  3825.     --------------------------------------------------------------------------
  3826.      
  3827.     function IsInList(                 --| Checks if element is an element of
  3828.                                        --| list.
  3829.              L:       in     List;     --| list being scanned for element
  3830.              Element: in     Tree  --| element being searched for
  3831.     ) return boolean;
  3832.      
  3833.     --| Effects
  3834.     --| Walks down the list L looking for an element whose value is Element.
  3835.      
  3836.     ------------------------------------------------------------------------------
  3837.      
  3838.     function LastValue(       --| Returns the contents of the last record of
  3839.                               --| the list.
  3840.              L: in List       --| The list whose first element is being
  3841.                               --| returned.
  3842.     ) return Tree;
  3843.      
  3844.     --| Raises
  3845.     --| EmptyList
  3846.     --|
  3847.     --| Effects
  3848.     --| Returns the last element in a list.  If the list is empty EmptyList is
  3849.     --| raised.
  3850.      
  3851.      
  3852.     ------------------------------------------------------------------------------
  3853.      
  3854.     function Length(         --| count the number of elements on a list
  3855.              L: in List      --| list whose length is being computed
  3856.     ) return integer;
  3857.      
  3858.     ------------------------------------------------------------------------------
  3859.      
  3860.     function MakeListIter(          --| Sets a variable to point to  the head
  3861.                                     --| of the list.  This will be used to
  3862.                                     --| prepare for iteration over a list.
  3863.              L: in List             --| The list being iterated over.
  3864.     ) return ListIter;
  3865.      
  3866.      
  3867.     --| This prepares a user for iteration operation over a list.  The iterater is
  3868.     --| an operation which returns successive elements of the list on successive
  3869.     --| calls to the iterator.  There needs to be a mechanism which marks the
  3870.     --| position in the list, so on successive calls to the Next operation the
  3871.     --| next item in the list can be returned.  This is the function of the
  3872.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  3873.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  3874.     --| is updated with each call.
  3875.      
  3876.     -----------------------------------------------------------------------------
  3877.      
  3878.     function More(           --| Returns true if there are more elements in
  3879.                              --| the and false if there aren't any more
  3880.                              --| the in the list.
  3881.              L: in ListIter  --| List being checked for elements.
  3882.     ) return boolean;
  3883.      
  3884.     ------------------------------------------------------------------------------
  3885.      
  3886.     procedure Next(                 --| This is the iterator operation.  Given
  3887.                                     --| a ListIter in the list it returns the
  3888.                                     --| current item and updates the ListIter.
  3889.                                     --| If ListIter is at the end of the list,
  3890.                                     --| More returns false otherwise it
  3891.                                     --| returns true.
  3892.         Place:    in out ListIter;  --| The Iter which marks the position in
  3893.                                     --| the list.
  3894.         Info:        out Tree   --| The element being returned.
  3895.      
  3896.     );
  3897.      
  3898.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  3899.     --| in the following way:
  3900.     --|
  3901.     --|         L:        List;
  3902.     --|         Place:    ListIter;
  3903.     --|         Info:     SomeType;
  3904.     --|
  3905.     --|
  3906.     --|         Place := MakeListIter(L);
  3907.     --|
  3908.     --|         while ( More(Place) ) loop
  3909.     --|               NextList(Place, Info);
  3910.     --|               process each element of list L;
  3911.     --|               end loop;
  3912.      
  3913.      
  3914.     ----------------------------------------------------------------------------
  3915.      
  3916.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  3917.                                --| with the parameter Item.
  3918.          L:    in out List;    --| The list being modified.
  3919.          Info: in     Tree --| The information being entered.
  3920.     );
  3921.     --| Raises
  3922.     --| EmptyList
  3923.      
  3924.     --| Effects
  3925.     --| Replaces the information in the first element in the list.  Raises
  3926.     --| EmptyList if the list is empty.
  3927.      
  3928.     ------------------------------------------------------------------------------
  3929.      
  3930.     procedure ReplaceTail(           --| Replace the Tail of a list
  3931.                                      --| with a new list.
  3932.               L:       in out List;  --| List whose Tail is replaced.
  3933.               NewTail: in     List   --| The list which will become the
  3934.                                      --| tail of Oldlist.
  3935.     );
  3936.     --| Raises
  3937.     --| EmptyList
  3938.     --|
  3939.     --| Effects
  3940.     --| Replaces the tail of a list with a new list.  If the list whose tail
  3941.     --| is being replaced is null EmptyList is raised.
  3942.      
  3943.     -------------------------------------------------------------------------------
  3944.      
  3945.     function Tail(           --| returns the tail of a list L
  3946.              L: in List      --| the list whose tail is being returned
  3947.     ) return List;
  3948.      
  3949.     --| Raises
  3950.     --| EmptyList
  3951.     --|
  3952.     --| Effects
  3953.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  3954.     --| L is empty.  If L only has one element then Tail returns the Empty
  3955.     --| list.
  3956.      
  3957.     ------------------------------------------------------------------------------
  3958.      
  3959.     function Equal(            --| compares list1 and list2 for equality
  3960.              List1: in List;   --| first list
  3961.              List2: in List    --| second list
  3962.      )  return boolean;
  3963.      
  3964.     --| Effects
  3965.     --| Returns true if for all elements of List1 the corresponding element
  3966.     --| of List2 has the same value.  This function uses the Equal operation
  3967.     --| provided by the user.  If one is not provided then = is used.
  3968.      
  3969.     ------------------------------------------------------------------------------
  3970.     private
  3971.         type Cell;
  3972.      
  3973.         type List is access Cell;      --| pointer added by this package
  3974.                                        --| in order to make a list
  3975.      
  3976.      
  3977.         type Cell is                   --| Cell for the lists being created
  3978.              record
  3979.                   Info: Tree;
  3980.                   Next: List;
  3981.              end record;
  3982.      
  3983.      
  3984.         type ListIter is new List;     --| This prevents Lists being assigned to
  3985.                                        --| iterators and vice versa
  3986.      
  3987.     end NodeOrder;
  3988.      
  3989.        type TreeIter is
  3990.           record
  3991.               NodeList :NodeOrder.List;
  3992.               State    :NodeOrder.ListIter;
  3993.           end record;
  3994.      
  3995.      
  3996.     end TreePkg;
  3997.        type Set is
  3998.            record
  3999.              SetRep :TreePkg.Tree;
  4000.            end record;
  4001.      
  4002.        type SetIter is
  4003.            record
  4004.              Place :TreePkg.TreeIter;
  4005.              Count :natural;
  4006.            end record;
  4007.      
  4008.     end DEF_ID_Set;
  4009.      
  4010.      
  4011.     function "<" (   --| This is used to order the Source_Text.Locs
  4012.           X :in     Source_Text.Locator;
  4013.           Y :in     Source_Text.Locator
  4014.     ) return boolean;
  4015.      
  4016. --    generic
  4017. --          type Source_Text.Locator is private;
  4018. --          with function "<" ( X ,Y: in     Source_Text.Locator) return boolean;
  4019.      
  4020.     package Literal_Set is
  4021.      
  4022.     --| Overview
  4023.     --| This abstractions is a counted ordered set.  This means that
  4024.     --| associated with each member of the set is a count of the number of
  4025.     --| times it appears in the set.  The order part means that there is
  4026.     --| an ordering associated with the members.  This allows fast insertion.
  4027.     --| It also makes it easy to iterate over the set in order.
  4028.      
  4029.      
  4030.      
  4031.     --                    Types
  4032.     --                    -----
  4033.      
  4034.           type Set is private;  --| This is the type exported to represent
  4035.                                 --| the ordered set.
  4036.      
  4037.           type SetIter is private;  --| This is the type exported whose
  4038.                                     --| purpose is to walk over a set.
  4039.      
  4040.      
  4041.     --                   Operations
  4042.     --                   ----------
  4043.      
  4044.     --| Cardinality              Returns cardinality of the set.
  4045.     --| Create                   Creates the empty set.
  4046.     --| CountMember              Returns the number of times the member appears in
  4047.     --|                          the set.
  4048.     --| Destroy                  Destroys a set and returns the space it occupies.
  4049.     --| Insert                   Insert a member into  the set.
  4050.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  4051.     --| More                     Are there more elements to iterate over in the
  4052.     --|                          set.
  4053.     --| Next                     Return the next element in the iteration and
  4054.     --|                          bump the iterator.
  4055.      
  4056.      
  4057.     ------------------------------------------------------------------------------
  4058.      
  4059.     function Cardinality (   --| Return the number of members in the set.
  4060.              S     :in Set   --| The set whose members are being counted.
  4061.     ) return natural;
  4062.      
  4063.     ------------------------------------------------------------------------------
  4064.      
  4065.      
  4066.     function Create   --| Return the empty set.
  4067.     return Set;
  4068.      
  4069.     ------------------------------------------------------------------------------
  4070.      
  4071.     procedure Destroy (        --| Destroy a set and return its space.
  4072.               S   :in out Set  --| Set being destroyed.
  4073.      
  4074.     );
  4075.      
  4076.     ------------------------------------------------------------------------------
  4077.      
  4078.     function GetCount (            --| This returns the count associated with
  4079.                                    --| member which corresponds to the current
  4080.                                    --| iterator I.
  4081.              I :in     SetIter
  4082.     ) return natural;
  4083.      
  4084.     -----------------------------------------------------------------------------
  4085.      
  4086.     procedure Insert (             --| Insert a member M into set S.
  4087.              M :in     Source_Text.Locator;   --| Member being inserted.
  4088.              S :in out Set         --| Set being inserted into.
  4089.     );
  4090.      
  4091.     ------------------------------------------------------------------------------
  4092.      
  4093.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  4094.                                 --| by returning a SetIter.
  4095.              S :in     Set     --| Set being iterate over.
  4096.     ) return SetIter;
  4097.      
  4098.     ------------------------------------------------------------------------------
  4099.      
  4100.     function More (             --| Returns true if there are more elements in the
  4101.                                 --| set to iterate over.
  4102.              I :in    SetIter   --| The iterator.
  4103.      
  4104.     ) return boolean;
  4105.      
  4106.     ------------------------------------------------------------------------------
  4107.      
  4108.     procedure Next (              --| Returns the current member in the iteration
  4109.                                   --| an increments the iterator.
  4110.              I :in out SetIter;   --| The iterator.
  4111.              M :   out Source_Text.Locator   --| The current member being returned.
  4112.     );
  4113.      
  4114.     -----------------------------------------------------------------------------
  4115.      
  4116.     private
  4117.      
  4118.        type Member is
  4119.            record
  4120.              Info   :Source_Text.Locator;
  4121.              Count  :natural;
  4122.            end record;
  4123.      
  4124.        function "<" (
  4125.                 X:in    Member;
  4126.                 Y:in    Member
  4127.        ) return boolean;
  4128.      
  4129.        -- generic instantiation
  4130.        --package TreePkg is new BinaryTrees ( Source_Text.Locator => Member, "<" => "<" );
  4131.      
  4132.      
  4133.     package TreePkg is
  4134.      
  4135.      
  4136.     --| Overview
  4137.     --| This package creates an ordered binary tree.  This will allow for
  4138.     --| quick insertion, and search.
  4139.     --|
  4140.     --| The tree is organized such that
  4141.     --|
  4142.     --|  leftchild < root    root < rightchild
  4143.     --|
  4144.     --| This means that by doing a left to right search of the tree will can
  4145.     --| produce the nodes of the tree in ascending order.
  4146.      
  4147.      
  4148.      
  4149.      
  4150.      
  4151.     --                             Types
  4152.     --                             -----
  4153.      
  4154.     type Tree is  private;     --| This is the type exported to represent the
  4155.                                --| tree.
  4156.      
  4157.      
  4158.     type TreeIter is private;  --| This is the type which is used to iterate
  4159.                                --| over the set.
  4160.      
  4161.     --|                          Exceptions
  4162.     --|                          ----------
  4163.      
  4164.     --|                          Operations
  4165.     --|                          ----------
  4166.     --|
  4167.     --| Create           Creates a tree.
  4168.     --| Deposit          Replaces the given node's information with
  4169.     --|                  the given information.
  4170.     --| DestroyTree      Destroys the given tree and returns the spaces.
  4171.     --| InsertNode       This inserts a node n into a tree t.
  4172.     --| MakeTreeIter     This returns an iterator to the user in order to start
  4173.     --|                  an iteration.
  4174.     --| More             This returns true if there are more elements to iterate
  4175.     --|                  over in the tree.
  4176.     --| Next             This returns the information associated with the current
  4177.     --|                  iterator and advances the iterator.
  4178.      
  4179.      
  4180.     ---------------------------------------------------------------------------
  4181.      
  4182.     function Create             --| This function creates the tree.
  4183.      
  4184.     return Tree;
  4185.      
  4186.     --| Effects
  4187.     --| This creates a tree containing no information and no children.  An
  4188.     --| emptytree.
  4189.      
  4190.     -------------------------------------------------------------------------------
  4191.      
  4192.     procedure Deposit (              --| This deposits the information I in the
  4193.                                      --| root of the Tree S.
  4194.               I :in     Member;    --| The information being deposited.
  4195.               S :in     Tree         --| The tree where the information is being
  4196.                                      --| stored.
  4197.     );
  4198.      
  4199.     --| Modifies
  4200.     --| This changes the information stored at the root of the tree S.
  4201.      
  4202.     -------------------------------------------------------------------------------
  4203.      
  4204.      
  4205.     procedure DestroyTree (         --| Destroys a tree.
  4206.               T  :in out Tree       --| Tree being destroyed.
  4207.     );
  4208.      
  4209.     --| Effects
  4210.     --| Destroys a tree and returns the space which it is occupying.
  4211.      
  4212.     --------------------------------------------------------------------------
  4213.      
  4214.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  4215.                                     --| Specified Tree.
  4216.            N      :In Out Member; --| The Information To Be Contained In The
  4217.                                     --| Node Being Inserted.
  4218.      
  4219.            T      :In Out Tree;     --| Tree Being Inserted Into.
  4220.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  4221.                                     --| This is the position of the node N in T.
  4222.            Exists :   out boolean   --| If this node already exists in the tree
  4223.                                     --| Exists is true.  If this is the first
  4224.                                     --| insertion Exists is false.
  4225.     );
  4226.      
  4227.     --| Effects
  4228.     --| This adds the node N to the tree T inserting in the proper postion.
  4229.      
  4230.     --| Modifies
  4231.     --| This modifies the tree T by add the node N to it.
  4232.      
  4233.     ------------------------------------------------------------------------------
  4234.      
  4235.     function MakeTreeIter (         --| Sets a variable to a position in the
  4236.                                     --| tree
  4237.                                     --| where the iteration is to begin.  In this
  4238.                                     --| case the position is a pointer to the
  4239.                                     --| the deepest leftmost leaf in the tree.
  4240.             T:in Tree               --| Tree being iterated over
  4241.     ) return TreeIter;
  4242.      
  4243.      
  4244.     --| Effects
  4245.      
  4246.      
  4247.     -----------------------------------------------------------------------------
  4248.      
  4249.     function More (                 --| Returns true if there are more elements
  4250.                                     --| in the tree to iterate over.
  4251.               I :in TreeIter
  4252.     ) return boolean;
  4253.      
  4254.      
  4255.     -----------------------------------------------------------------------------
  4256.      
  4257.     procedure Next (                --| This is the iterator operation.  Given
  4258.                                     --| an Iter in the Tree it returns the
  4259.                                     --| item Iter points to and updates the
  4260.                                     --| iter. If Iter is at the end of the Tree,
  4261.                                     --| yielditer returns false otherwise it
  4262.                                     --| returns true.
  4263.         I        :in out TreeIter;  --| The iter which marks the position in the
  4264.                                     --| Tree.
  4265.      
  4266.         Info     :   out Member   --| Information being returned from a node.
  4267.     );
  4268.      
  4269.      
  4270.     ---------------------------------------------------------------------------
  4271.      
  4272.     private
  4273.      
  4274.        type Node;
  4275.        type Tree is access Node;
  4276.      
  4277.        type Node is
  4278.             record
  4279.                 Info           :Member;
  4280.                 LeftChild      :Tree;
  4281.                 RightChild     :Tree;
  4282.             end record;
  4283.      
  4284.     ---   The following is a generic instantiation of NodeOrder
  4285.     ---   package NodeOrder is new Lists (Tree);
  4286.      
  4287.      
  4288.     package NodeOrder is
  4289.      
  4290.     --| This package provides singly linked lists with elements of type
  4291.     --| Tree, where Tree is specified by a generic parameter.
  4292.      
  4293.     --| Overview
  4294.     --| When this package is instantiated, it provides a linked list type for
  4295.     --| lists of objects of type Tree, which can be any desired type.  A
  4296.     --| complete set of operations for manipulation, and releasing
  4297.     --| those lists is also provided.  For instance, to make lists of strings,
  4298.     --| all that is necessary is:
  4299.     --|
  4300.     --| type StringType is string(1..10);
  4301.     --|
  4302.     --| package Str_List is new Lists(StringType); use Str_List;
  4303.     --|
  4304.     --|    L:List;
  4305.     --|    S:StringType;
  4306.     --|
  4307.     --| Then to add a string S, to the list L, all that is necessary is
  4308.     --|
  4309.     --|    L := Create;
  4310.     --|    Attach(S,L);
  4311.     --|
  4312.     --|
  4313.     --| This package provides basic list operations.
  4314.     --|
  4315.     --| Attach          append an object to an object, an object to a list,
  4316.     --|                 or a list to an object, or a list to a list.
  4317.     --| Copy            copy a list using := on elements
  4318.     --| CopyDeep        copy a list by copying the elements using a copy
  4319.     --|                 operation provided by the user
  4320.     --| Create          Creates an empty list
  4321.     --| DeleteHead      removes the head of a list
  4322.     --| DeleteItem      delete the first occurrence of an element from a list
  4323.     --| DeleteItems     delete all occurrences of an element from a list
  4324.     --| Destroy         remove a list
  4325.     --| Equal           are two lists equal
  4326.     --| FirstValue      get the information from the first element of a list
  4327.     --| IsInList        determines whether a given element is in a given list
  4328.     --| IsEmpty         returns true if the list is empty
  4329.     --| LastValue       return the last value of a list
  4330.     --| Length          Returns the length of a list
  4331.     --| MakeListIter    prepares for an iteration over a list
  4332.     --| More            are there any more items in the list
  4333.     --| Next            get the next item in a list
  4334.     --| ReplaceHead     replace the information at the head of the list
  4335.     --| ReplaceTail     replace the tail of a list with a new list
  4336.     --| Tail            get the tail of a list
  4337.     --|
  4338.      
  4339.     --| N/A: Effects, Requires, Modifies, and Raises.
  4340.      
  4341.     --| Notes
  4342.     --| Programmer Buddy Altus
  4343.      
  4344.     --|                           Types
  4345.     --|                           -----
  4346.      
  4347.               type List       is private;
  4348.               type ListIter   is private;
  4349.      
  4350.      
  4351.     --|                           Exceptions
  4352.     --|                           ----------
  4353.      
  4354.         CircularList     :exception;     --| Raised if an attemp is made to
  4355.                                          --| create a circular list.  This
  4356.                                          --| results when a list is attempted
  4357.                                          --| to be attached to itself.
  4358.      
  4359.         EmptyList        :exception;     --| Raised if an attemp is made to
  4360.                                          --| manipulate an empty list.
  4361.      
  4362.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  4363.                                          --| remove an element from a list in
  4364.                                          --| which it does not exist.
  4365.      
  4366.         NoMore           :exception;     --| Raised if an attemp is made to
  4367.                                          --| get the next element from a list
  4368.                                          --| after iteration is complete.
  4369.      
  4370.      
  4371.      
  4372.     --|                           Operations
  4373.     --|                           ----------
  4374.      
  4375.     ----------------------------------------------------------------------------
  4376.      
  4377.     procedure Attach(                  --| appends List2 to List1
  4378.               List1:     in out List;  --| The list being appended to.
  4379.               List2:     in     List   --| The list being appended.
  4380.     );
  4381.      
  4382.     --| Raises
  4383.     --| CircularList
  4384.      
  4385.     --| Effects
  4386.     --| Appends List1 to List2.  This makes the next field of the last element
  4387.     --| of List1 refer to List2.  This can possibly change the value of List1
  4388.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  4389.     --| user Destroys List1 then List2 will be a dangling reference.
  4390.     --| This procedure raises CircularList if List1 equals List2.  If it is
  4391.     --| necessary to Attach a list to itself first make a copy of the list and
  4392.     --| attach the copy.
  4393.      
  4394.     --| Modifies
  4395.     --| Changes the next field of the last element in List1 to be List2.
  4396.      
  4397.     -------------------------------------------------------------------------------
  4398.      
  4399.     function Attach(                 --| Creates a new list containing the two
  4400.                                      --| Elements.
  4401.              Element1: in Tree;  --| This will be first element in list.
  4402.              Element2: in Tree   --| This will be second element in list.
  4403.     ) return List;
  4404.      
  4405.     --| Effects
  4406.     --| This creates a list containing the two elements in the order
  4407.     --| specified.
  4408.      
  4409.     -------------------------------------------------------------------------------
  4410.     procedure Attach(                   --| List L is appended with Element.
  4411.              L:       in out List;      --| List being appended to.
  4412.              Element: in     Tree   --| This will be last element in l    ist.
  4413.     );
  4414.      
  4415.     --| Effects
  4416.     --| Appends Element onto the end of the list L.  If L is empty then this
  4417.     --| may change the value of L.
  4418.     --|
  4419.     --| Modifies
  4420.     --| This appends List L with Element by changing the next field in List.
  4421.      
  4422.     --------------------------------------------------------------------------------
  4423.     procedure Attach(                   --| Makes Element first item in list L.
  4424.              Element: in      Tree; --| This will be the first element in list.
  4425.              L:       in  out List      --| The List which Element is being
  4426.                                         --| prepended to.
  4427.     );
  4428.      
  4429.     --| Effects
  4430.     --| This prepends list L with Element.
  4431.     --|
  4432.     --| Modifies
  4433.     --| This modifies the list L.
  4434.      
  4435.     --------------------------------------------------------------------------
  4436.      
  4437.     function Attach (                      --| attaches two lists
  4438.              List1: in     List;           --| first list
  4439.              List2: in     List            --| second list
  4440.     ) return List;
  4441.      
  4442.     --| Raises
  4443.     --| CircularList
  4444.      
  4445.     --| Effects
  4446.     --| This returns a list which is List1 attached to List2.  If it is desired
  4447.     --| to make List1 be the new attached list the following ada code should be
  4448.     --| used.
  4449.     --|
  4450.     --| List1 := Attach (List1, List2);
  4451.     --| This procedure raises CircularList if List1 equals List2.  If it is
  4452.     --| necessary to Attach a list to itself first make a copy of the list and
  4453.     --| attach the copy.
  4454.      
  4455.     -------------------------------------------------------------------------
  4456.      
  4457.     function Attach (                   --| prepends an element onto a list
  4458.              Element: in    Tree;   --| element being prepended to list
  4459.              L:       in    List        --| List which element is being added
  4460.                                         --| to
  4461.     ) return List;
  4462.      
  4463.     --| Effects
  4464.     --| Returns a new list which is headed by Element and followed by L.
  4465.      
  4466.     ------------------------------------------------------------------------
  4467.      
  4468.     function Attach (                  --| Adds an element to the end of a list
  4469.              L: in          List;      --| The list which element is being added to.
  4470.              Element: in    Tree   --| The element being added to the end of
  4471.                                        --| the list.
  4472.     ) return List;
  4473.      
  4474.     --| Effects
  4475.     --| Returns a new list which is L followed by Element.
  4476.      
  4477.     --------------------------------------------------------------------------
  4478.      
  4479.      
  4480.     function Copy(          --| returns a copy of list1
  4481.            L: in List       --| list being copied
  4482.     ) return List;
  4483.      
  4484.     --| Effects
  4485.     --| Returns a copy of L.
  4486.      
  4487.     --------------------------------------------------------------------------
  4488.      
  4489.      
  4490.     function Create           --| Returns an empty List
  4491.      
  4492.     return List;
  4493.      
  4494.     ------------------------------------------------------------------------------
  4495.      
  4496.     procedure DeleteHead(            --| Remove the head element from a list.
  4497.               L: in out List         --| The list whose head is being removed.
  4498.     );
  4499.      
  4500.     --| Raises
  4501.     --| EmptyList
  4502.     --|
  4503.     --| Effects
  4504.     --| This will return the space occupied by the first element in the list
  4505.     --| to the heap.  If sharing exists between lists this procedure
  4506.     --| could leave a dangling reference.  If L is empty EmptyList will be
  4507.     --| raised.
  4508.      
  4509.     ------------------------------------------------------------------------------
  4510.      
  4511.     procedure DeleteItem(           --| remove the first occurrence of Element
  4512.                                     --| from L
  4513.           L:       in out List;     --| list element is being  removed from
  4514.           Element: in     Tree  --| element being removed
  4515.     );
  4516.      
  4517.     --| Raises
  4518.     --| ItemNotPresent
  4519.      
  4520.     --| Effects
  4521.     --| Removes the first element of the list equal to Element.  If there is
  4522.     --| not an element equal to Element than ItemNotPresent is raised.
  4523.      
  4524.     --| Modifies
  4525.     --| This operation is destructive, it returns the storage occupied by
  4526.     --| the elements being deleted.
  4527.      
  4528.     ------------------------------------------------------------------------------
  4529.      
  4530.     procedure DeleteItems(          --| remove all occurrences of Element
  4531.                                     --| from  L.
  4532.           L:       in out List;     --| The List element is being removed from
  4533.           Element: in     Tree  --| element being removed
  4534.     );
  4535.      
  4536.     --| Raises
  4537.     --| ItemNotPresent
  4538.     --|
  4539.     --| Effects
  4540.     --| This procedure walks down the list L and removes all elements of the
  4541.     --| list equal to Element.  If there are not any elements equal to Element
  4542.     --| then raise ItemNotPresent.
  4543.      
  4544.     --| Modifies
  4545.     --| This operation is destructive the storage occupied by the items
  4546.     --| removed is returned.
  4547.      
  4548.     ------------------------------------------------------------------------------
  4549.      
  4550.     procedure Destroy(            --| removes the list
  4551.               L: in out List      --| the list being removed
  4552.     );
  4553.      
  4554.     --| Effects
  4555.     --| This returns to the heap all the storage that a list occupies.  Keep in
  4556.     --| mind if there exists sharing between lists then this operation can leave
  4557.     --| dangling references.
  4558.      
  4559.     ------------------------------------------------------------------------------
  4560.      
  4561.     function FirstValue(      --| returns the contents of the first record of the
  4562.                               --| list
  4563.              L: in List       --| the list whose first element is being
  4564.                               --| returned
  4565.      
  4566.     ) return Tree;
  4567.      
  4568.     --| Raises
  4569.     --| EmptyList
  4570.     --|
  4571.     --| Effects
  4572.     --| This returns the Item in the first position in the list.  If the list
  4573.     --| is empty EmptyList is raised.
  4574.      
  4575.     -------------------------------------------------------------------------------
  4576.      
  4577.     function IsEmpty(            --| Checks if a list is empty.
  4578.              L: in     List      --| List being checked.
  4579.     ) return boolean;
  4580.      
  4581.     --------------------------------------------------------------------------
  4582.      
  4583.     function IsInList(                 --| Checks if element is an element of
  4584.                                        --| list.
  4585.              L:       in     List;     --| list being scanned for element
  4586.              Element: in     Tree  --| element being searched for
  4587.     ) return boolean;
  4588.      
  4589.     --| Effects
  4590.     --| Walks down the list L looking for an element whose value is Element.
  4591.      
  4592.     ------------------------------------------------------------------------------
  4593.      
  4594.     function LastValue(       --| Returns the contents of the last record of
  4595.                               --| the list.
  4596.              L: in List       --| The list whose first element is being
  4597.                               --| returned.
  4598.     ) return Tree;
  4599.      
  4600.     --| Raises
  4601.     --| EmptyList
  4602.     --|
  4603.     --| Effects
  4604.     --| Returns the last element in a list.  If the list is empty EmptyList is
  4605.     --| raised.
  4606.      
  4607.      
  4608.     ------------------------------------------------------------------------------
  4609.      
  4610.     function Length(         --| count the number of elements on a list
  4611.              L: in List      --| list whose length is being computed
  4612.     ) return integer;
  4613.      
  4614.     ------------------------------------------------------------------------------
  4615.      
  4616.     function MakeListIter(          --| Sets a variable to point to  the head
  4617.                                     --| of the list.  This will be used to
  4618.                                     --| prepare for iteration over a list.
  4619.              L: in List             --| The list being iterated over.
  4620.     ) return ListIter;
  4621.      
  4622.      
  4623.     --| This prepares a user for iteration operation over a list.  The iterater is
  4624.     --| an operation which returns successive elements of the list on successive
  4625.     --| calls to the iterator.  There needs to be a mechanism which marks the
  4626.     --| position in the list, so on successive calls to the Next operation the
  4627.     --| next item in the list can be returned.  This is the function of the
  4628.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  4629.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  4630.     --| is updated with each call.
  4631.      
  4632.     -----------------------------------------------------------------------------
  4633.      
  4634.     function More(           --| Returns true if there are more elements in
  4635.                              --| the and false if there aren't any more
  4636.                              --| the in the list.
  4637.              L: in ListIter  --| List being checked for elements.
  4638.     ) return boolean;
  4639.      
  4640.     ------------------------------------------------------------------------------
  4641.      
  4642.     procedure Next(                 --| This is the iterator operation.  Given
  4643.                                     --| a ListIter in the list it returns the
  4644.                                     --| current item and updates the ListIter.
  4645.                                     --| If ListIter is at the end of the list,
  4646.                                     --| More returns false otherwise it
  4647.                                     --| returns true.
  4648.         Place:    in out ListIter;  --| The Iter which marks the position in
  4649.                                     --| the list.
  4650.         Info:        out Tree   --| The element being returned.
  4651.      
  4652.     );
  4653.      
  4654.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  4655.     --| in the following way:
  4656.     --|
  4657.     --|         L:        List;
  4658.     --|         Place:    ListIter;
  4659.     --|         Info:     SomeType;
  4660.     --|
  4661.     --|
  4662.     --|         Place := MakeListIter(L);
  4663.     --|
  4664.     --|         while ( More(Place) ) loop
  4665.     --|               NextList(Place, Info);
  4666.     --|               process each element of list L;
  4667.     --|               end loop;
  4668.      
  4669.      
  4670.     ----------------------------------------------------------------------------
  4671.      
  4672.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  4673.                                --| with the parameter Item.
  4674.          L:    in out List;    --| The list being modified.
  4675.          Info: in     Tree --| The information being entered.
  4676.     );
  4677.     --| Raises
  4678.     --| EmptyList
  4679.      
  4680.     --| Effects
  4681.     --| Replaces the information in the first element in the list.  Raises
  4682.     --| EmptyList if the list is empty.
  4683.      
  4684.     ------------------------------------------------------------------------------
  4685.      
  4686.     procedure ReplaceTail(           --| Replace the Tail of a list
  4687.                                      --| with a new list.
  4688.               L:       in out List;  --| List whose Tail is replaced.
  4689.               NewTail: in     List   --| The list which will become the
  4690.                                      --| tail of Oldlist.
  4691.     );
  4692.     --| Raises
  4693.     --| EmptyList
  4694.     --|
  4695.     --| Effects
  4696.     --| Replaces the tail of a list with a new list.  If the list whose tail
  4697.     --| is being replaced is null EmptyList is raised.
  4698.      
  4699.     -------------------------------------------------------------------------------
  4700.      
  4701.     function Tail(           --| returns the tail of a list L
  4702.              L: in List      --| the list whose tail is being returned
  4703.     ) return List;
  4704.      
  4705.     --| Raises
  4706.     --| EmptyList
  4707.     --|
  4708.     --| Effects
  4709.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  4710.     --| L is empty.  If L only has one element then Tail returns the Empty
  4711.     --| list.
  4712.      
  4713.     ------------------------------------------------------------------------------
  4714.      
  4715.     function Equal(            --| compares list1 and list2 for equality
  4716.              List1: in List;   --| first list
  4717.              List2: in List    --| second list
  4718.      )  return boolean;
  4719.      
  4720.     --| Effects
  4721.     --| Returns true if for all elements of List1 the corresponding element
  4722.     --| of List2 has the same value.  This function uses the Equal operation
  4723.     --| provided by the user.  If one is not provided then = is used.
  4724.      
  4725.     ------------------------------------------------------------------------------
  4726.     private
  4727.         type Cell;
  4728.      
  4729.         type List is access Cell;      --| pointer added by this package
  4730.                                        --| in order to make a list
  4731.      
  4732.      
  4733.         type Cell is                   --| Cell for the lists being created
  4734.              record
  4735.                   Info: Tree;
  4736.                   Next: List;
  4737.              end record;
  4738.      
  4739.      
  4740.         type ListIter is new List;     --| This prevents Lists being assigned to
  4741.                                        --| iterators and vice versa
  4742.      
  4743.     end NodeOrder;
  4744.      
  4745.        type TreeIter is
  4746.           record
  4747.               NodeList :NodeOrder.List;
  4748.               State    :NodeOrder.ListIter;
  4749.           end record;
  4750.      
  4751.      
  4752.     end TreePkg;
  4753.        type Set is
  4754.            record
  4755.              SetRep :TreePkg.Tree;
  4756.            end record;
  4757.      
  4758.        type SetIter is
  4759.            record
  4760.              Place :TreePkg.TreeIter;
  4761.              Count :natural;
  4762.            end record;
  4763.      
  4764.     end Literal_Set;
  4765.      
  4766.      
  4767.      
  4768.      
  4769.     -- package Literal_Set is new OrderedSets
  4770.     --           (ItemType => Source_Text.Locator, "<" => "<" );
  4771.     -- generic
  4772.     --       type ItemType is private;
  4773.     --       with function "<" ( X ,Y: in     ItemType) return boolean;
  4774.      
  4775.     type BlockInfoType is
  4776.         record
  4777.           TokenCount             :TokenCountType;
  4778.           BlockId                :BlockIdType;
  4779.           SetOfLiterals          :Literal_Set.Set;
  4780.           SetOfDEF_IDs           :DEF_ID_Set.Set;
  4781.         end record;
  4782.         --| This is the information which pertains to a particular block
  4783.         --| of the source program.  This information is pushed on
  4784.         --| a stack when an new block is encountered.  The
  4785.         --| information is a count of the tokens encountered so far
  4786.         --| and the DEF_ID's which have been found as well as the
  4787.         --| identifying information for the block.  The ListOfLiterals
  4788.         --| is a list of all literals encounter
  4789.      
  4790.     --? package BlockInfoStack is new Stacks(BlockInfoType);
  4791.     --? use StackBlockInfo;
  4792.      
  4793.      
  4794.     package BlockInfoStack is
  4795.      
  4796.      
  4797.      
  4798.      
  4799.         type stack is private;       --| The stack abstract data type.
  4800.      
  4801.      
  4802.         uninitialized_stack: exception;
  4803.             --| The initialization operations are create and copy.
  4804.      
  4805.         empty_stack: exception;
  4806.      
  4807.      
  4808.      
  4809.         function create
  4810.             return stack;
  4811.      
  4812.      
  4813.         procedure push(s: in out stack;
  4814.                        e:        BlockInfoType);
  4815.      
  4816.      
  4817.         procedure pop(s: in out stack);
  4818.      
  4819.      
  4820.         procedure pop(s: in out stack;
  4821.                       e: out    BlockInfoType);
  4822.      
  4823.      
  4824.         function copy(s: stack)
  4825.             return stack;
  4826.      
  4827.      
  4828.      
  4829.      
  4830.         function top(s: stack)
  4831.             return BlockInfoType;
  4832.      
  4833.      
  4834.         function size(s: stack)
  4835.             return natural;
  4836.      
  4837.      
  4838.         function is_empty(s: stack)
  4839.             return boolean;
  4840.      
  4841.      
  4842.      
  4843.      
  4844.         procedure destroy(s: in out stack);
  4845.      
  4846.      
  4847.      
  4848.     private
  4849.         package Lists is
  4850.      
  4851.      
  4852.      
  4853.      
  4854.      
  4855.      
  4856.                   type List       is private;
  4857.                   type ListIter   is private;
  4858.      
  4859.      
  4860.      
  4861.             CircularList     :exception;     --| Raised if an attemp is made to
  4862.                                              --| create a circular list.  This
  4863.                                              --| results when a list is attempted
  4864.                                              --| to be attached to itself.
  4865.      
  4866.             EmptyList        :exception;     --| Raised if an attemp is made to
  4867.                                              --| manipulate an empty list.
  4868.      
  4869.             ItemNotPresent   :exception;     --| Raised if an attempt is made to
  4870.                                              --| remove an element from a list in
  4871.                                              --| which it does not exist.
  4872.      
  4873.             NoMore           :exception;     --| Raised if an attemp is made to
  4874.                                              --| get the next element from a list
  4875.                                              --| after iteration is complete.
  4876.      
  4877.      
  4878.      
  4879.      
  4880.      
  4881.         procedure Attach(                  --| appends List2 to List1
  4882.                   List1:     in out List;  --| The list being appended to.
  4883.                   List2:     in     List   --| The list being appended.
  4884.         );
  4885.      
  4886.      
  4887.      
  4888.      
  4889.      
  4890.         function Attach(                 --| Creates a new list containing the two
  4891.                                          --| Elements.
  4892.                  Element1: in BlockInfoType;  --| This will be first element in list.
  4893.                  Element2: in BlockInfoType   --| This will be second element in list.
  4894.         ) return List;
  4895.      
  4896.      
  4897.         procedure Attach(                   --| List L is appended with Element.
  4898.                  L:       in out List;      --| List being appended to.
  4899.                  Element: in     BlockInfoType   --| This will be last element in l    ist.
  4900.         );
  4901.      
  4902.      
  4903.         procedure Attach(                   --| Makes Element first item in list L.
  4904.                  Element: in      BlockInfoType; --| This will be the first element in list.
  4905.                  L:       in  out List      --| The List which Element is being
  4906.                                             --| prepended to.
  4907.         );
  4908.      
  4909.      
  4910.      
  4911.         function Attach (                      --| attaches two lists
  4912.                  List1: in     List;           --| first list
  4913.                  List2: in     List            --| second list
  4914.         ) return List;
  4915.      
  4916.      
  4917.      
  4918.      
  4919.         function Attach (                   --| prepends an element onto a list
  4920.                  Element: in    BlockInfoType;   --| element being prepended to list
  4921.                  L:       in    List        --| List which element is being added
  4922.                                             --| to
  4923.         ) return List;
  4924.      
  4925.      
  4926.      
  4927.         function Attach (                  --| Adds an element to the end of a list
  4928.                  L: in          List;      --| The list which element is being added to.
  4929.                  Element: in    BlockInfoType   --| The element being added to the end of
  4930.                                            --| the list.
  4931.         ) return List;
  4932.      
  4933.      
  4934.      
  4935.      
  4936.         function Copy(          --| returns a copy of list1
  4937.                L: in List       --| list being copied
  4938.         ) return List;
  4939.      
  4940.      
  4941.      
  4942.      
  4943.      
  4944.         function Create           --| Returns an empty List
  4945.      
  4946.         return List;
  4947.      
  4948.      
  4949.         procedure DeleteHead(            --| Remove the head element from a list.
  4950.                   L: in out List         --| The list whose head is being removed.
  4951.         );
  4952.      
  4953.      
  4954.      
  4955.         procedure DeleteItem(           --| remove the first occurrence of Element
  4956.                                         --| from L
  4957.               L:       in out List;     --| list element is being  removed from
  4958.               Element: in     BlockInfoType  --| element being removed
  4959.         );
  4960.      
  4961.      
  4962.      
  4963.      
  4964.      
  4965.         procedure DeleteItems(          --| remove all occurrences of Element
  4966.                                         --| from  L.
  4967.               L:       in out List;     --| The List element is being removed from
  4968.               Element: in     BlockInfoType  --| element being removed
  4969.         );
  4970.      
  4971.      
  4972.      
  4973.      
  4974.         procedure Destroy(            --| removes the list
  4975.                   L: in out List      --| the list being removed
  4976.         );
  4977.      
  4978.      
  4979.      
  4980.         function FirstValue(      --| returns the contents of the first record of the
  4981.                                   --| list
  4982.                  L: in List       --| the list whose first element is being
  4983.                                   --| returned
  4984.      
  4985.         ) return BlockInfoType;
  4986.      
  4987.      
  4988.      
  4989.         function IsEmpty(            --| Checks if a list is empty.
  4990.                  L: in     List      --| List being checked.
  4991.         ) return boolean;
  4992.      
  4993.      
  4994.         function IsInList(                 --| Checks if element is an element of
  4995.                                            --| list.
  4996.                  L:       in     List;     --| list being scanned for element
  4997.                  Element: in     BlockInfoType  --| element being searched for
  4998.         ) return boolean;
  4999.      
  5000.      
  5001.      
  5002.         function LastValue(       --| Returns the contents of the last record of
  5003.                                   --| the list.
  5004.                  L: in List       --| The list whose first element is being
  5005.                                   --| returned.
  5006.         ) return BlockInfoType;
  5007.      
  5008.      
  5009.      
  5010.      
  5011.         function Length(         --| count the number of elements on a list
  5012.                  L: in List      --| list whose length is being computed
  5013.         ) return integer;
  5014.      
  5015.      
  5016.         function MakeListIter(          --| Sets a variable to point to  the head
  5017.                                         --| of the list.  This will be used to
  5018.                                         --| prepare for iteration over a list.
  5019.                  L: in List             --| The list being iterated over.
  5020.         ) return ListIter;
  5021.      
  5022.      
  5023.      
  5024.      
  5025.         function More(           --| Returns true if there are more elements in
  5026.                                  --| the and false if there aren't any more
  5027.                                  --| the in the list.
  5028.                  L: in ListIter  --| List being checked for elements.
  5029.         ) return boolean;
  5030.      
  5031.      
  5032.         procedure Next(                 --| This is the iterator operation.  Given
  5033.                                         --| a ListIter in the list it returns the
  5034.                                         --| current item and updates the ListIter.
  5035.                                         --| If ListIter is at the end of the list,
  5036.                                         --| More returns false otherwise it
  5037.                                         --| returns true.
  5038.             Place:    in out ListIter;  --| The Iter which marks the position in
  5039.                                         --| the list.
  5040.             Info:        out BlockInfoType   --| The element being returned.
  5041.      
  5042.         );
  5043.      
  5044.      
  5045.      
  5046.      
  5047.         procedure ReplaceHead(     --| Replace the Item at the head of the list
  5048.                                    --| with the parameter Item.
  5049.              L:    in out List;    --| The list being modified.
  5050.              Info: in     BlockInfoType --| The information being entered.
  5051.         );
  5052.      
  5053.      
  5054.      
  5055.         procedure ReplaceTail(           --| Replace the Tail of a list
  5056.                                          --| with a new list.
  5057.                   L:       in out List;  --| List whose Tail is replaced.
  5058.                   NewTail: in     List   --| The list which will become the
  5059.                                          --| tail of Oldlist.
  5060.         );
  5061.      
  5062.      
  5063.         function Tail(           --| returns the tail of a list L
  5064.                  L: in List      --| the list whose tail is being returned
  5065.         ) return List;
  5066.      
  5067.      
  5068.      
  5069.         function Equal(            --| compares list1 and list2 for equality
  5070.                  List1: in List;   --| first list
  5071.                  List2: in List    --| second list
  5072.          )  return boolean;
  5073.      
  5074.      
  5075.         private
  5076.             type Cell;
  5077.      
  5078.             type List is access Cell;      --| pointer added by this package
  5079.                                            --| in order to make a list
  5080.      
  5081.      
  5082.             type Cell is                   --| Cell for the lists being created
  5083.                  record
  5084.                       Info: BlockInfoType;
  5085.                       Next: List;
  5086.                  end record;
  5087.      
  5088.      
  5089.             type ListIter is new List;     --| This prevents Lists being assigned to
  5090.                                            --| iterators and vice versa
  5091.      
  5092.         end Lists;
  5093.      
  5094.             subtype elem_list is lists.list;
  5095.      
  5096.         type stack_rec is
  5097.             record
  5098.                 size: natural := 0;
  5099.                 elts: elem_list;
  5100.             end record;
  5101.      
  5102.         type stack is access stack_rec;
  5103.      
  5104.      
  5105.     end BlockInfoStack;
  5106.      
  5107.      
  5108. end Definitions;
  5109. ::::::::::::::
  5110. halstead.ada
  5111. ::::::::::::::
  5112.  
  5113. -------SPEC---------------------------------------------------------------
  5114. function Halstead return INTEGER; 
  5115.  
  5116. -------BODY---------------------------------------------------------------
  5117.  
  5118. with STRING_LISTS; 
  5119. with COMMANDLINE;
  5120. with STANDARD_INTERFACE; 
  5121. with STRING_PKG; 
  5122. with TEXT_IO; use TEXT_IO;
  5123. with HOST_LIB; 
  5124. with ST_DIANA;
  5125. with PROGRAMLIBRARY;
  5126. with COMP_UNIT_CLASS_PKG;
  5127. with DEFINITIONS;
  5128. with HALSTEAD_DATA_BASE;
  5129. --xx with FILE_MANAGER;
  5130.  
  5131. function Halstead return INTEGER is 
  5132.  
  5133.   package CL renames COMMANDLINE;
  5134.   package SI renames STANDARD_INTERFACE;
  5135.   package SL renames STRING_LISTS; 
  5136.   package SP renames STRING_PKG; 
  5137.   package D  renames DEFINITIONS;
  5138.   package PL renames PROGRAMLIBRARY;
  5139.   package HDB renames HALSTEAD_DATA_BASE; 
  5140. --xx  package FM renames FILE_MANAGER;
  5141.  
  5142.   package STRINGTYPE is new SI.STRING_ARGUMENT("string"); 
  5143.   package UNIT_LIST_PKG is new SI.STRING_LIST_ARGUMENT(
  5144.     STRING_TYPE_NAME => "string_type",
  5145.     STRING_TYPE_LIST => "string_list"); 
  5146.  
  5147.   dd_name    : string(1..200);
  5148.   dd_Last    : natural;
  5149.   dd_changed : boolean;
  5150.   pl_name    : string(1..200);
  5151.   pl_last    : natural;
  5152.  
  5153.   HALSTEAD   : SI.PROCESS_HANDLE; 
  5154.   library_Name : SP.string_type;
  5155.   OUTPUT_FILE: FILE_TYPE;
  5156.   output_File_Name  : sp.string_type;    
  5157.   unit_list  : SL.LIST; 
  5158.   ITER       : SL.LISTITER; 
  5159.   unit_Name    : sp.string_type;            
  5160.   ToTerminal : boolean;
  5161.   verbose    : boolean;       
  5162.   Unit_SD    : PL.Subdomain_Type;
  5163.   COMP_UNIT_Locator: ST_DIANA.COMP_UNIT_CLASS.Locator;
  5164.   UnitPosition : natural := 1;
  5165.  
  5166. begin  -- driver
  5167.  
  5168.   HOST_LIB.SET_ERROR; 
  5169.  
  5170.   SI.set_tool_identifier ("1.0");
  5171.   STANDARD_INTERFACE.DEFINE_PROCESS(PROC => Halstead,
  5172.     NAME => "Halstead", 
  5173.     HELP => "Computes Halstead formulas for Ada compilation units."); 
  5174.     
  5175.   UNIT_LIST_PKG.DEFINE_ARGUMENT(PROC => HALSTEAD,
  5176.     NAME => "Units",
  5177.     DEFAULT => SL.CREATE,
  5178.     HELP => "Names of the compilation units"); 
  5179.  
  5180.   Stringtype.DEFINE_ARGUMENT(PROC => halstead, 
  5181.     NAME => "Output", 
  5182.     DEFAULT => "", 
  5183.     HELP => "Name of the report file (defaults to standard output)"); 
  5184.  
  5185.   STRINGTYPE.DEFINE_ARGUMENT(PROC => HALSTEAD,
  5186.     NAME => "library", DEFAULT => "[.BYRONLIB]",
  5187.     Help => "Name of an Ada program library (NYI)");
  5188.  
  5189.   SI.DEFINE_PROCESS_HELP(PROC => halstead,
  5190.     HELP => "Computes Halstead formulas for Ada compilation units"); 
  5191.  
  5192.   STANDARD_INTERFACE.PARSE_LINE(halstead); 
  5193.  
  5194.   unit_list := unit_LIST_pkg.GET_ARGUMENT(PROC => halstead, NAME => "units"); 
  5195.   library_Name := stringtype.get_argument(proc => halstead, name => "library");
  5196.   output_File_Name := 
  5197.         STRINGTYPE.GET_ARGUMENT(PROC => halstead, NAME => "output"); 
  5198.   verbose := FALSE;
  5199.  
  5200.  
  5201.    if sp.equal(output_File_Name, "") then
  5202.  
  5203.     -- No file name given: output is to the terminal
  5204.     Set_Output(STANDARD_OUTPUT);
  5205.     ToTerminal := true;
  5206.  
  5207.    else
  5208.     -- Create the specified output file
  5209.     create(File => Output_File,
  5210.                Mode => Out_File,
  5211.                Name => sp.value(output_File_Name),
  5212.                Form => ""
  5213.              );
  5214.         Set_Output(Output_File);
  5215.         ToTerminal := false;
  5216.  
  5217.    end if;
  5218.  
  5219.     -- Connect to the program library directory:
  5220. --xx    FM.Show_and_Set_Default(dd_name,dd_last,dd_changed,SP.Value(library_Name));
  5221. --xx    if not dd_changed then
  5222. --xx    Put_Line("?? Cannot connect to program library.");
  5223. --xx    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  5224. --xx    end if;
  5225.      
  5226.     -- Open the catalog.  This is the program library which contains
  5227.     -- the library units which the user is performing the Halstead
  5228.     -- Complexity Measures on.
  5229.  
  5230.    PL.Open_catalog;
  5231.    ST_DIANA.NEWDOMAIN (PL.Get_Primary_Context, PL.Get_Secondary_Context);
  5232.  
  5233.      -- Get each library unit which the user is performing the metric on.
  5234.      -- For each unit get its COMP_UNIT_CLASS.Locator which is the handle
  5235.      -- to the beginning of the DIANA for the unit.  Pass the Locator
  5236.      -- to the bonsai tree walk routine which computes the metrics.
  5237.  
  5238.    ITER := SL.MAKELISTITER(UNIT_LIST);
  5239.    while SL.MORE(ITER) loop
  5240.     SL.next(iter, unit_Name);
  5241.      
  5242.     -- Check to see if the unit specified is a SubUnit.
  5243.      
  5244.     if cl.IsSubUnit(SP.Value(unit_Name), unitposition) then
  5245.       begin
  5246.         Unit_SD := PL.Open_Subdomain(
  5247.             ST_Diana.TheDomain,
  5248.             PL.DIANA_Form,
  5249.             PL.SubUnit_Ident (
  5250.                 CL.GetParent (sp.value(unit_Name), UnitPosition) ,
  5251.                 CL.GetSubUnit (sp.value(unit_Name), UnitPosition),
  5252.                 IsStub => false
  5253.             ));
  5254.       exception
  5255.         when PL.Object_Not_Up_To_Date =>
  5256.         Put(Standard_Output, "%% WARNING: ");
  5257.         Put(Standard_Output, "Subunit " & SP.Value(unit_Name));
  5258.         Put_Line(Standard_Output, " not found");
  5259.       end;
  5260.       -- Pass the necessary data to the Utilities package.
  5261.       HDB.InitializeData(
  5262.                            LibraryUnit    => SP.Value(unit_Name),
  5263.                            IsUnitSpec     => false,
  5264.                            VerboseFlag    => Verbose,
  5265.                            ToTerminalFlag => ToTerminal,
  5266.                            OuterMostBlockFlag => false
  5267.                            );
  5268.      
  5269.       -- If writing to an output file then generate a
  5270.       -- report header.  If writing to the terminal a header is
  5271.       -- generated in the utilities package.
  5272.      
  5273.       if not ToTerminal then
  5274.         HDB.ReportHeader (SP.Value(unit_Name), Spec => false);
  5275.       end if;
  5276.      
  5277.       -- Get the actual locator for the library unit.
  5278.      
  5279.       COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  5280.      
  5281.       -- Now that we have the locator scan the diana which
  5282.       -- the locator points to.
  5283.      
  5284.       COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  5285.     else
  5286.       -- For any library unit which is not a subunit this
  5287.       -- loop scans both the specification (implicit as well
  5288.       -- as explicit) and the body of the unit.
  5289.      
  5290.       for IsSpec in reverse false..true loop
  5291.         -- Open the Subdomain.
  5292.         begin
  5293.           Unit_SD := PL.Open_Subdomain(
  5294.             ST_Diana.TheDomain,
  5295.             PL.DIANA_Form,
  5296.             PL.Library_Unit_Ident (
  5297.                 SP.Value(unit_Name),
  5298.                 IsSpec
  5299.             ));
  5300.      
  5301.           -- Pass the data to the utilities package.
  5302.           HDB.InitializeData(
  5303.             LibraryUnit    => SP.Value(unit_Name),
  5304.             IsUnitSpec     => IsSpec,
  5305.             VerboseFlag    => Verbose,
  5306.             ToTerminalFlag => ToTerminal,
  5307.             OuterMostBlockFlag => false
  5308.             );
  5309.      
  5310.           if not ToTerminal then
  5311.         HDB.ReportHeader (SP.Value(unit_Name), IsSpec);
  5312.           end if;
  5313.      
  5314.           -- Get the locator to the library unit.
  5315.           COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  5316.      
  5317.           -- Perform the scan on the diana which the locator points to.
  5318.           COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  5319.      
  5320.           -- Catch the exception when attempting to open either
  5321.           -- implicit spec or body.
  5322.         exception
  5323.         when PL.Object_Not_Up_To_Date  =>
  5324.           Put_Line(Standard_Output, "%% WARNING: ");
  5325.           if IsSpec then
  5326.             Put(Standard_Output, "The spec of ");
  5327.           else
  5328.             Put(Standard_Output, "The body of ");
  5329.           end if;
  5330.           Put(Standard_Output, "Unit " & SP.Value(unit_Name));
  5331.           Put_Line(Standard_Output, " does not exist");
  5332.         end;
  5333.       end loop;
  5334.     end if;
  5335.     end loop;
  5336.      
  5337. --xx    FM.Show_and_Set_Default(pl_name, pl_last, dd_changed, dd_name(1..dd_last));
  5338.     return HOST_LIB.RETURN_CODE(HOST_LIB.SUCCESS); 
  5339.  
  5340. exception
  5341.  
  5342.   when STANDARD_INTERFACE.PROCESS_HELP => 
  5343.     return HOST_LIB.RETURN_CODE(HOST_LIB.INFORMATION); 
  5344.  
  5345.   when STANDARD_INTERFACE.ABORT_PROCESS => 
  5346.     return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  5347.  
  5348. --  when others => 
  5349. --    TEXT_IO.PUT_LINE("internal error"); 
  5350. --    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  5351.  
  5352. end Halstead; 
  5353. ::::::::::::::
  5354. halstead.obj
  5355. ::::::::::::::
  5356. ADA$ELAB_HALSTEAD01 4-Mar-1986 08:55                 VAX Ada V1.1-10y<    nADA$ELAB_HALSTEAD}>nADA$ELAB_HALSTEADPHALSTEAD STRING_LISTS STRING_PKG_
  5357. STRING_PKGLISTS COMMANDLINE_ COMMANDLINESTANDARD_INTERFACE_STANDARD_INTERFACE
  5358. INTEGER_LISTSPAGINATED_OUTPUT_PAGINATED_OUTPUTTEXT_IO_TEXT_IOIO_EXCEPTIONS_    HOST_LIB_HOST_LIB    ST_DIANA_ST_DIANAML_SOURCE_POSITION_PKG_ML_SOURCE_POSITION_PKGFE_TEMPORARY_ATTRIBUTES_ML_MACHINE_DATA_PKG_TGT_ML_TARGET_CONSTANTS_TGT_ML_TARGET_CONSTANTSML_STORAGE_DIMENSION_PKG_ML_STORAGE_DIMENSION_PKG VMMTEXTPKG_
  5359. VMMTEXTPKG
  5360. VMMSYSTEMPKG_ VMMSYSTEMPKGML_VMM_LOCATOR_PKG_VSUTILS_VSUTILSVSDECLARATIONS_ VMMBASICPKG_ VMMBASICPKGPAGE_IO    DIRECT_IOVMMPAGE_HIF_NODE_DEFS_    HIF_DEFS_HIF_FAKE_NODE_HANDLES_HIF_FAKE_NODE_HANDLESHIF_LIST_UTILS_HIF_LIST_UTILSHIF_TEXT_UTILS_HIF_TEXT_UTILS VMMTYPESPKG_ VMMTYPESPKGPROGRAMLIBRARY_PROGRAMLIBRARYHIF_HOST_FILE_MANAGEMENT_HIF_HOST_FILE_MANAGEMENTHIF_HOST_FILE_DEFS_ PLIF_UTILS_
  5361. PLIF_UTILSLIBRARY_CATALOG_DEFS_LIBRARY_COMPILATION_MANAGER_LIBRARY_COMPILATION_MANAGERHIF_NODE_MANAGEMENT_HIF_NODE_MANAGEMENTHIF_SIMPLE_OBJECT_MANAGER_HIF_SIMPLE_OBJECT_MANAGERHIF_RELATIONSHIP_NAMES_HIF_RELATIONSHIP_NAMES HIF_STRINGS_ HIF_STRINGSHIF_IDENTIFIERS_HIF_IDENTIFIERSHIF_PARTITION_MANAGER_HIF_PARTITION_MANAGERHIF_PARTITION_ELEMENTS_HIF_PARTITION_ELEMENTSHOST_BIN_KEYED_IO_TYPES_HIF_KEYED_IO_DEFS_ RELATIVE_IOAUX_IO_EXCEPTIONS_HIF_PARTITION_MAPPING_HIF_PARTITION_MAPPING
  5362. HIF_KEYED_IO_ HIF_KEYED_IOBIN_KEYED_IO_BLOCKS_BIN_KEYED_IO_BLOCKS
  5363. HOST_PAGE_IO_ HOST_PAGE_IOBIN_KEYED_IO_UTILITIES_BIN_KEYED_IO_UTILITIESHIF_IDENTIFIER_PATTERNS_HIF_IDENTIFIER_PATTERNSLIBRARY_UNIT_DEFS_LIBRARY_IDENTIFICATION_MANAGER_LIBRARY_IDENTIFICATION_MANAGERLIBRARY_IDENT_MANAGER_LIBRARY_IDENT_MANAGERCOMP_UNIT_CLASS_PKG_COMP_UNIT_CLASS_PKG DEFINITIONS_ DEFINITIONSHALSTEAD_DATA_BASE_HALSTEAD_DATA_BASESTRING_UTILITIES_STRING_UTILITIES    STACK_PKGSET_PKGADA$U008E7F1B30B92E00_00000097ADA$U008E7F1B30B92E00_0000009AINT_IO    CALENDAR_CALENDARSTARLET_CONDITION_HANDLING_CONDITION_HANDLINGT_370_ML_TARGET_CONSTANTS_T_1750A_ML_TARGET_CONSTANTS_T_PRIME_ML_TARGET_CONSTANTS_T_SPERRY_ML_TARGET_CONSTANTS_TGT_ML_TARGET_SWITCH_TGT_ML_TARGET_SWITCH
  5364. HIF_DEBUG_    HIF_DEBUG PARAMETERS_
  5365. PARAMETERS PLIF_DEBUG_
  5366. PLIF_DEBUGADA$U008E192A5B0FDC00_00000502LIBRARY_CONFIGURATION_INTERFACELIBRARY_COLLECTION_DEFS_LIBRARY_DEPENDENCY_MANAGER_LIBRARY_DEPENDENCY_MANAGERHIF_NODE_HANDLES_HIF_NODE_HANDLESHOST_SYSTEM_CALLS_HOST_SYSTEM_CALLSHIF_PRS_ATTRIBUTES_HIF_PRS_ATTRIBUTESPLIF_NAME_DEFS_HIF_PATH_NAMES_HIF_PATH_NAMESHIF_ATTRIBUTES_HIF_ATTRIBUTESHIF_KEY_GENERATOR_HIF_KEY_GENERATORHIF_KEYED_IO_LOCALS_HIF_KEYED_IO_LOCALSHIF_RELATIVE_PATHS_PLIF_ATTRIBUTE_NAMES_    ITEM_PKG_ITEM_PKG COUNT_TYPES_ COUNT_TYPESCOUNT_COUNT BOOTOPTIONS_ BOOTOPTIONSPLIF_DEPENDENCY_UTILS_PLIF_DEPENDENCY_UTILSHIF_BIG_ATTRIBUTES_HIF_BIG_ATTRIBUTESUP_TO_DATE_CACHE_PKG_UP_TO_DATE_CACHE_PKGHIF_NODE_INFO_DIOSERIES_UNIT_IH_VARIABLE_DECL_IH_SUBTYPE_DECL_IH_
  5367. TASK_DECL_IH_
  5368. TYPE_DECL_IH_GENERIC_HEADER_CLASS_PKG_GENERIC_HEADER_CLASS_PKG DEF_ID_PKG_
  5369. DEF_ID_PKG PKG_DEF_PKG_ PKG_DEF_PKG HEADER_PKG_
  5370. HEADER_PKGOBJECT_TYPE_PKG_OBJECT_TYPE_PKGOBJECT_DEF_PKG_OBJECT_DEF_PKG
  5371. NAME_EXP_PKG_ NAME_EXP_PKGCONSTRAINT_PKG_CONSTRAINT_PKG
  5372. SUBP_DEF_PKG_ SUBP_DEF_PKGGENERAL_ASSOC_PKG_GENERAL_ASSOC_PKGBLOCK_STUB_PKG_BLOCK_STUB_PKGTYPE_SPEC_PKG_
  5373. TYPE_SPEC_PKGGENERIC_HEADER_IH_IDENTIFIER_UTILITIES_IDENTIFIER_UTILITIESAGG_COMPONENT_PKG_AGG_COMPONENT_PKGSTM_PKG_STM_PKGALTERNATIVE_PKG_ALTERNATIVE_PKG
  5374. BLOCK_STM_IH_SOURCE_POSITION_UTILITIES_SOURCE_POSITION_UTILITIESINNER_RECORD_CLASS_PKG_INNER_RECORD_CLASS_PKG
  5375. AGG_NAMED_IH_ CHOICE_PKG_
  5376. CHOICE_PKGITERATION_PKG_
  5377. ITERATION_PKGBLOCK_UTILITIES_BLOCK_UTILITIESCASE_ALTERNATIVE_IH_HANDLER_ALTERNATIVE_IH_INNER_RECORD_IH_VARIANT_ALTERNATIVE_CLASS_PKG_VARIANT_ALTERNATIVE_CLASS_PKGVMMADDRESSARITHMETIC_VMMADDRESSARITHMETICPLIF_OBJECT_COUNT_UTILS_PLIF_OBJECT_COUNT_UTILS
  5378. ADA$ELAB_HALSTEAD|{    HALSTEADHALSTEADw/
  5379. ]\{ADA$INIT_COMPONENT~P
  5380.     
  5381. LISTS$ELAB
  5382. LISTS$ELAB    IO_EXCEPTIONS_$ELABIO_EXCEPTIONS_$ELAB    ML_SOURCE_POSITION_PKG_$ELABML_SOURCE_POSITION_PKG_$ELAB    ML_SOURCE_POSITION_PKG$ELABML_SOURCE_POSITION_PKG$ELAB    FE_TEMPORARY_ATTRIBUTES_$ELABFE_TEMPORARY_ATTRIBUTES_$ELAB    ML_VMM_LOCATOR_PKG_$ELABML_VMM_LOCATOR_PKG_$ELAB    "VSDECLARATIONS_$ELAB"VSDECLARATIONS_$ELAB    '
  5383. VMMPAGE_$ELAB'
  5384. VMMPAGE_$ELAB    )HIF_DEFS_$ELAB)HIF_DEFS_$ELAB    *HIF_FAKE_NODE_HANDLES_$ELAB*HIF_FAKE_NODE_HANDLES_$ELAB    +HIF_FAKE_NODE_HANDLES$ELAB+HIF_FAKE_NODE_HANDLES$ELAB    BHIF_STRINGS_$ELABBHIF_STRINGS_$ELAB    CHIF_STRINGS$ELABCHIF_STRINGS$ELAB    MAUX_IO_EXCEPTIONS_$ELABMAUX_IO_EXCEPTIONS_$ELAB    iADA$U008E7F1B30B92E00_00000097$iADA$U008E7F1B30B92E00_00000097$    jADA$U008E7F1B30B92E00_0000009A$jADA$U008E7F1B30B92E00_0000009A$    oCONDITION_HANDLING_$ELABoCONDITION_HANDLING_$ELAB    pCONDITION_HANDLING$ELABpCONDITION_HANDLING$ELAB    qT_370_ML_TARGET_CONSTANTS_$ELABqT_370_ML_TARGET_CONSTANTS_$ELAB    rT_1750A_ML_TARGET_CONSTANTS_$ELrT_1750A_ML_TARGET_CONSTANTS_$EL    sT_PRIME_ML_TARGET_CONSTANTS_$ELsT_PRIME_ML_TARGET_CONSTANTS_$EL    tT_SPERRY_ML_TARGET_CONSTANTS_$EtT_SPERRY_ML_TARGET_CONSTANTS_$E    
  5385. HIF_KEY_GENERATOR_$ELAB
  5386. HIF_KEY_GENERATOR_$ELAB    HIF_KEY_GENERATOR$ELABHIF_KEY_GENERATOR$ELAB    gSTACK_PKG$ELABgSTACK_PKG$ELAB        INTEGER_LISTS$ELAB    INTEGER_LISTS$ELAB    h SET_PKG$ELABh SET_PKG$ELAB    &DIRECT_IO$ELAB&DIRECT_IO$ELAB    
  5387. TEXT_IO_$ELAB
  5388. TEXT_IO_$ELAB    
  5389. TEXT_IO$ELAB
  5390. TEXT_IO$ELAB    JSOURCE_POSITION_UTILITIES_$ELABJSOURCE_POSITION_UTILITIES_$ELAB    KSOURCE_POSITION_UTILITIES$ELABKSOURCE_POSITION_UTILITIES$ELAB    ZVMMADDRESSARITHMETIC_$ELABZVMMADDRESSARITHMETIC_$ELAB    [VMMADDRESSARITHMETIC$ELAB[VMMADDRESSARITHMETIC$ELAB    KHIF_KEYED_IO_DEFS_$ELABKHIF_KEYED_IO_DEFS_$ELAB    6HIF_HOST_FILE_DEFS_$ELAB6HIF_HOST_FILE_DEFS_$ELAB    (HIF_NODE_DEFS_$ELAB(HIF_NODE_DEFS_$ELAB    DHIF_IDENTIFIERS_$ELABDHIF_IDENTIFIERS_$ELAB    EHIF_IDENTIFIERS$ELABEHIF_IDENTIFIERS$ELAB    LRELATIVE_IO$ELABLRELATIVE_IO$ELAB    n
  5391. STARLET_$ELABn
  5392. STARLET_$ELAB    STRING_PKG_$ELABSTRING_PKG_$ELAB    STRING_PKG$ELABSTRING_PKG$ELAB    "DIO$ELAB"DIO$ELAB    % PAGE_IO$ELAB% PAGE_IO$ELAB    k INT_IO$ELABk INT_IO$ELAB    .HIF_TEXT_UTILS_$ELAB.HIF_TEXT_UTILS_$ELAB    /HIF_TEXT_UTILS$ELAB/HIF_TEXT_UTILS$ELAB    VMMTEXTPKG_$ELABVMMTEXTPKG_$ELAB    VMMTEXTPKG$ELABVMMTEXTPKG$ELAB    PLIF_ATTRIBUTE_NAMES_$ELABPLIF_ATTRIBUTE_NAMES_$ELAB    PLIF_NAME_DEFS_$ELABPLIF_NAME_DEFS_$ELAB    XHIF_IDENTIFIER_PATTERNS_$ELABXHIF_IDENTIFIER_PATTERNS_$ELAB    YHIF_IDENTIFIER_PATTERNS$ELABYHIF_IDENTIFIER_PATTERNS$ELAB    @HIF_RELATIONSHIP_NAMES_$ELAB@HIF_RELATIONSHIP_NAMES_$ELAB    AHIF_RELATIONSHIP_NAMES$ELABAHIF_RELATIONSHIP_NAMES$ELAB    JHOST_BIN_KEYED_IO_TYPES_$ELABJHOST_BIN_KEYED_IO_TYPES_$ELAB    lCALENDAR_$ELABlCALENDAR_$ELAB    m
  5393. CALENDAR$ELABm
  5394. CALENDAR$ELAB    STRING_LISTS$ELABSTRING_LISTS$ELAB    COMMANDLINE_$ELABCOMMANDLINE_$ELAB    COMMANDLINE$ELABCOMMANDLINE$ELAB    BOOTOPTIONS_$ELABBOOTOPTIONS_$ELAB    BOOTOPTIONS$ELABBOOTOPTIONS$ELAB    ZLIBRARY_UNIT_DEFS_$ELABZLIBRARY_UNIT_DEFS_$ELAB     
  5395. VSUTILS_$ELAB 
  5396. VSUTILS_$ELAB    ! VSUTILS$ELAB! VSUTILS$ELAB    eSTRING_UTILITIES_$ELABeSTRING_UTILITIES_$ELAB    fSTRING_UTILITIES$ELABfSTRING_UTILITIES$ELAB    HOST_SYSTEM_CALLS_$ELABHOST_SYSTEM_CALLS_$ELAB    HOST_SYSTEM_CALLS$ELABHOST_SYSTEM_CALLS$ELAB    yPARAMETERS_$ELAByPARAMETERS_$ELAB    zPARAMETERS$ELABzPARAMETERS$ELAB    VMMSYSTEMPKG_$ELABVMMSYSTEMPKG_$ELAB    VMMSYSTEMPKG$ELABVMMSYSTEMPKG$ELAB    HOST_LIB_$ELABHOST_LIB_$ELAB    
  5397. HOST_LIB$ELAB
  5398. HOST_LIB$ELAB    
  5399. PAGINATED_OUTPUT_$ELAB
  5400. PAGINATED_OUTPUT_$ELAB     PAGINATED_OUTPUT$ELAB PAGINATED_OUTPUT$ELAB    {PLIF_DEBUG_$ELAB{PLIF_DEBUG_$ELAB    |PLIF_DEBUG$ELAB|PLIF_DEBUG$ELAB    wHIF_DEBUG_$ELABwHIF_DEBUG_$ELAB    xHIF_DEBUG$ELABxHIF_DEBUG$ELAB    uTGT_ML_TARGET_SWITCH_$ELABuTGT_ML_TARGET_SWITCH_$ELAB    vTGT_ML_TARGET_SWITCH$ELABvTGT_ML_TARGET_SWITCH$ELAB    STANDARD_INTERFACE_$ELABSTANDARD_INTERFACE_$ELAB    STANDARD_INTERFACE$ELABSTANDARD_INTERFACE$ELAB    ]LIBRARY_IDENT_MANAGER_$ELAB]LIBRARY_IDENT_MANAGER_$ELAB    ^LIBRARY_IDENT_MANAGER$ELAB^LIBRARY_IDENT_MANAGER$ELAB    THOST_PAGE_IO_$ELABTHOST_PAGE_IO_$ELAB    UHOST_PAGE_IO$ELABUHOST_PAGE_IO$ELAB        HIF_PATH_NAMES_$ELAB    HIF_PATH_NAMES_$ELAB    
  5401. HIF_PATH_NAMES$ELAB
  5402. HIF_PATH_NAMES$ELAB    HHIF_PARTITION_ELEMENTS_$ELABHHIF_PARTITION_ELEMENTS_$ELAB    IHIF_PARTITION_ELEMENTS$ELABIHIF_PARTITION_ELEMENTS$ELAB    ,HIF_LIST_UTILS_$ELAB,HIF_LIST_UTILS_$ELAB    -HIF_LIST_UTILS$ELAB-HIF_LIST_UTILS$ELAB    TGT_ML_TARGET_CONSTANTS_$ELABTGT_ML_TARGET_CONSTANTS_$ELAB    TGT_ML_TARGET_CONSTANTS$ELABTGT_ML_TARGET_CONSTANTS$ELAB    RBIN_KEYED_IO_BLOCKS_$ELABRBIN_KEYED_IO_BLOCKS_$ELAB    SBIN_KEYED_IO_BLOCKS$ELABSBIN_KEYED_IO_BLOCKS$ELAB    LIBRARY_COLLECTION_DEFS_$ELABLIBRARY_COLLECTION_DEFS_$ELAB    9LIBRARY_CATALOG_DEFS_$ELAB9LIBRARY_CATALOG_DEFS_$ELAB    ML_STORAGE_DIMENSION_PKG_$ELABML_STORAGE_DIMENSION_PKG_$ELAB    ML_STORAGE_DIMENSION_PKG$ELABML_STORAGE_DIMENSION_PKG$ELAB    ML_MACHINE_DATA_PKG_$ELABML_MACHINE_DATA_PKG_$ELAB    VBIN_KEYED_IO_UTILITIES_$ELABVBIN_KEYED_IO_UTILITIES_$ELAB    WBIN_KEYED_IO_UTILITIES$ELABWBIN_KEYED_IO_UTILITIES$ELAB    HIF_KEYED_IO_LOCALS_$ELABHIF_KEYED_IO_LOCALS_$ELAB    HIF_KEYED_IO_LOCALS$ELABHIF_KEYED_IO_LOCALS$ELAB    PHIF_KEYED_IO_$ELABPHIF_KEYED_IO_$ELAB    QHIF_KEYED_IO$ELABQHIF_KEYED_IO$ELAB    NHIF_PARTITION_MAPPING_$ELABNHIF_PARTITION_MAPPING_$ELAB    OHIF_PARTITION_MAPPING$ELABOHIF_PARTITION_MAPPING$ELAB    FHIF_PARTITION_MANAGER_$ELABFHIF_PARTITION_MANAGER_$ELAB    GHIF_PARTITION_MANAGER$ELABGHIF_PARTITION_MANAGER$ELAB    >HIF_SIMPLE_OBJECT_MANAGER_$ELAB>HIF_SIMPLE_OBJECT_MANAGER_$ELAB    ?HIF_SIMPLE_OBJECT_MANAGER$ELAB?HIF_SIMPLE_OBJECT_MANAGER$ELAB    !HIF_NODE_INFO_$ELAB!HIF_NODE_INFO_$ELAB    HIF_PRS_ATTRIBUTES_$ELABHIF_PRS_ATTRIBUTES_$ELAB    HIF_PRS_ATTRIBUTES$ELABHIF_PRS_ATTRIBUTES$ELAB    HIF_NODE_HANDLES_$ELABHIF_NODE_HANDLES_$ELAB    HIF_NODE_HANDLES$ELABHIF_NODE_HANDLES$ELAB    #VMMBASICPKG_$ELAB#VMMBASICPKG_$ELAB    4HIF_HOST_FILE_MANAGEMENT_$ELAB4HIF_HOST_FILE_MANAGEMENT_$ELAB    7PLIF_UTILS_$ELAB7PLIF_UTILS_$ELAB    <HIF_NODE_MANAGEMENT_$ELAB<HIF_NODE_MANAGEMENT_$ELAB     HIF_ATTRIBUTES_$ELAB HIF_ATTRIBUTES_$ELAB    PLIF_DEPENDENCY_UTILS_$ELABPLIF_DEPENDENCY_UTILS_$ELAB    HIF_BIG_ATTRIBUTES_$ELABHIF_BIG_ATTRIBUTES_$ELAB    UP_TO_DATE_CACHE_PKG_$ELABUP_TO_DATE_CACHE_PKG_$ELAB    0VMMTYPESPKG_$ELAB0VMMTYPESPKG_$ELAB    1VMMTYPESPKG$ELAB1VMMTYPESPKG$ELAB    HIF_RELATIVE_PATHS_$ELABHIF_RELATIVE_PATHS_$ELAB    :LIBRARY_COMPILATION_MANAGER_$EL:LIBRARY_COMPILATION_MANAGER_$EL    ;LIBRARY_COMPILATION_MANAGER$ELA;LIBRARY_COMPILATION_MANAGER$ELA    8PLIF_UTILS$ELAB8PLIF_UTILS$ELAB    5HIF_HOST_FILE_MANAGEMENT$ELAB5HIF_HOST_FILE_MANAGEMENT$ELAB    \PLIF_OBJECT_COUNT_UTILS_$ELAB\PLIF_OBJECT_COUNT_UTILS_$ELAB    ]PLIF_OBJECT_COUNT_UTILS$ELAB]PLIF_OBJECT_COUNT_UTILS$ELAB    $VMMBASICPKG$ELAB$VMMBASICPKG$ELAB    }ADA$U008E192A5B0FDC00_00000502$}ADA$U008E192A5B0FDC00_00000502$    ~LIBRARY_CONFIGURATION_INTERFACE~LIBRARY_CONFIGURATION_INTERFACE    =HIF_NODE_MANAGEMENT$ELAB=HIF_NODE_MANAGEMENT$ELAB     HIF_ATTRIBUTES$ELAB HIF_ATTRIBUTES$ELAB    PLIF_DEPENDENCY_UTILS$ELABPLIF_DEPENDENCY_UTILS$ELAB    HIF_BIG_ATTRIBUTES$ELABHIF_BIG_ATTRIBUTES$ELAB     UP_TO_DATE_CACHE_PKG$ELAB UP_TO_DATE_CACHE_PKG$ELAB    ST_DIANA_$ELABST_DIANA_$ELAB    
  5403. ST_DIANA$ELAB
  5404. ST_DIANA$ELAB    WINNER_RECORD_IH_$ELABWINNER_RECORD_IH_$ELAB    VHANDLER_ALTERNATIVE_IH_$ELABVHANDLER_ALTERNATIVE_IH_$ELAB    UCASE_ALTERNATIVE_IH_$ELABUCASE_ALTERNATIVE_IH_$ELAB    SBLOCK_UTILITIES_$ELABSBLOCK_UTILITIES_$ELAB    TBLOCK_UTILITIES$ELABTBLOCK_UTILITIES$ELAB    NAGG_NAMED_IH_$ELABNAGG_NAMED_IH_$ELAB    IBLOCK_STM_IH_$ELABIBLOCK_STM_IH_$ELAB    AIDENTIFIER_UTILITIES_$ELABAIDENTIFIER_UTILITIES_$ELAB    BIDENTIFIER_UTILITIES$ELABBIDENTIFIER_UTILITIES$ELAB    @GENERIC_HEADER_IH_$ELAB@GENERIC_HEADER_IH_$ELAB    'TYPE_DECL_IH_$ELAB'TYPE_DECL_IH_$ELAB    &TASK_DECL_IH_$ELAB&TASK_DECL_IH_$ELAB    %SUBTYPE_DECL_IH_$ELAB%SUBTYPE_DECL_IH_$ELAB    $VARIABLE_DECL_IH_$ELAB$VARIABLE_DECL_IH_$ELAB    #SERIES_UNIT_IH_$ELAB#SERIES_UNIT_IH_$ELAB    aDEFINITIONS_$ELABaDEFINITIONS_$ELAB    bDEFINITIONS$ELABbDEFINITIONS$ELAB    COUNT_TYPES_$ELABCOUNT_TYPES_$ELAB    COUNT_TYPES$ELABCOUNT_TYPES$ELAB     COUNT_$ELAB COUNT_$ELAB    
  5405. COUNT$ELAB
  5406. COUNT$ELAB    cHALSTEAD_DATA_BASE_$ELABcHALSTEAD_DATA_BASE_$ELAB    dHALSTEAD_DATA_BASE$ELABdHALSTEAD_DATA_BASE$ELAB    *DEF_ID_PKG_$ELAB*DEF_ID_PKG_$ELAB    +DEF_ID_PKG$ELAB+DEF_ID_PKG$ELAB    [LIBRARY_IDENTIFICATION_MANAGER_[LIBRARY_IDENTIFICATION_MANAGER_    _COMP_UNIT_CLASS_PKG_$ELAB_COMP_UNIT_CLASS_PKG_$ELAB    LIBRARY_DEPENDENCY_MANAGER_$ELALIBRARY_DEPENDENCY_MANAGER_$ELA    ITEM_PKG_$ELABITEM_PKG_$ELAB    (GENERIC_HEADER_CLASS_PKG_$ELAB(GENERIC_HEADER_CLASS_PKG_$ELAB    ,PKG_DEF_PKG_$ELAB,PKG_DEF_PKG_$ELAB    .HEADER_PKG_$ELAB.HEADER_PKG_$ELAB    0OBJECT_TYPE_PKG_$ELAB0OBJECT_TYPE_PKG_$ELAB    2OBJECT_DEF_PKG_$ELAB2OBJECT_DEF_PKG_$ELAB    4NAME_EXP_PKG_$ELAB4NAME_EXP_PKG_$ELAB    6CONSTRAINT_PKG_$ELAB6CONSTRAINT_PKG_$ELAB    8SUBP_DEF_PKG_$ELAB8SUBP_DEF_PKG_$ELAB    :GENERAL_ASSOC_PKG_$ELAB:GENERAL_ASSOC_PKG_$ELAB    <BLOCK_STUB_PKG_$ELAB<BLOCK_STUB_PKG_$ELAB    >TYPE_SPEC_PKG_$ELAB>TYPE_SPEC_PKG_$ELAB    CAGG_COMPONENT_PKG_$ELABCAGG_COMPONENT_PKG_$ELAB    E
  5407. STM_PKG_$ELABE
  5408. STM_PKG_$ELAB    GALTERNATIVE_PKG_$ELABGALTERNATIVE_PKG_$ELAB    LINNER_RECORD_CLASS_PKG_$ELABLINNER_RECORD_CLASS_PKG_$ELAB    OCHOICE_PKG_$ELABOCHOICE_PKG_$ELAB    QITERATION_PKG_$ELABQITERATION_PKG_$ELAB    XVARIANT_ALTERNATIVE_CLASS_PKG_$XVARIANT_ALTERNATIVE_CLASS_PKG_$    \LIBRARY_IDENTIFICATION_MANAGER$\LIBRARY_IDENTIFICATION_MANAGER$    2PROGRAMLIBRARY_$ELAB2PROGRAMLIBRARY_$ELAB    3PROGRAMLIBRARY$ELAB3PROGRAMLIBRARY$ELAB    LIBRARY_DEPENDENCY_MANAGER$ELABLIBRARY_DEPENDENCY_MANAGER$ELAB    `COMP_UNIT_CLASS_PKG$ELAB`COMP_UNIT_CLASS_PKG$ELAB    )GENERIC_HEADER_CLASS_PKG$ELAB)GENERIC_HEADER_CLASS_PKG$ELAB    3OBJECT_DEF_PKG$ELAB3OBJECT_DEF_PKG$ELAB    /HEADER_PKG$ELAB/HEADER_PKG$ELAB    ;GENERAL_ASSOC_PKG$ELAB;GENERAL_ASSOC_PKG$ELAB    9SUBP_DEF_PKG$ELAB9SUBP_DEF_PKG$ELAB    -PKG_DEF_PKG$ELAB-PKG_DEF_PKG$ELAB    1OBJECT_TYPE_PKG$ELAB1OBJECT_TYPE_PKG$ELAB    
  5409. ITEM_PKG$ELAB
  5410. ITEM_PKG$ELAB    7CONSTRAINT_PKG$ELAB7CONSTRAINT_PKG$ELAB    5NAME_EXP_PKG$ELAB5NAME_EXP_PKG$ELAB    =BLOCK_STUB_PKG$ELAB=BLOCK_STUB_PKG$ELAB    ?TYPE_SPEC_PKG$ELAB?TYPE_SPEC_PKG$ELAB    HALTERNATIVE_PKG$ELABHALTERNATIVE_PKG$ELAB    DAGG_COMPONENT_PKG$ELABDAGG_COMPONENT_PKG$ELAB    PCHOICE_PKG$ELABPCHOICE_PKG$ELAB    F STM_PKG$ELABF STM_PKG$ELAB    RITERATION_PKG$ELABRITERATION_PKG$ELAB    MINNER_RECORD_CLASS_PKG$ELABMINNER_RECORD_CLASS_PKG$ELAB    YVARIANT_ALTERNATIVE_CLASS_PKG$EYVARIANT_ALTERNATIVE_CLASS_PKG$E    
  5411. HALSTEAD$ELAB
  5412. HALSTEAD$ELABADA$INIT_COMPONENTLIB$INITIALIZEi$CODE|LIB$INITIALIZE}    HALSTEADHALSTEADoTRANSFER$ADDRESSw?=::::::::::::::
  5413. halstead.src
  5414. ::::::::::::::
  5415. ::::::::::::::
  5416. block_u.bdy
  5417. ::::::::::::::
  5418. --VMS file: %nosc.work.tools.halstead.source*(block_u.bdy)
  5419. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.bdy
  5420. -- $Source: /nosc/work/tools/halstead/RCS/block_u.bdy,v $
  5421. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:46 $ -- $Author: buddy $
  5422.      
  5423. --pragma revision ("$Revision: 1.2 $");
  5424.      
  5425. with ML_Source_Position_Pkg;
  5426. package body Block_Utilities is
  5427.      
  5428.     package MLSP renames ML_Source_Position_Pkg;
  5429. --------------------------------------------------------------------------
  5430. --                          LOCAL SUBPROGRAMS
  5431. --------------------------------------------------------------------------
  5432.      
  5433.     function Is_Source_Position_Null (
  5434.         Position :in    MLSP.Source_Position
  5435.     ) return boolean;
  5436.      
  5437.     --| OVERVIEW
  5438.     --| This procedure returns true if the source position passed in
  5439.     --| is null.  This means that column and line of the
  5440.     --| Position.first_location is 0.
  5441.      
  5442. --------------------------------------------------------------------------
  5443.      
  5444.     function In_Declare_Block (  --| This function determines whether
  5445.                                  --| we are in a block with declarations.
  5446.                                  --| If we are it returns true otherwise
  5447.                                  --| false.
  5448.                       block :in     BLOCK_STUB.Locator
  5449.     ) return boolean is
  5450.      
  5451.         use SeqOfITEM;
  5452.         I :Generator;
  5453.      
  5454.     begin
  5455.         --| OVERVIEW
  5456.         --| This function is used to determined if in fact the block
  5457.         --| passed in is a block with explicit declarations which
  5458.         --| means the token declare appears in the source program.
  5459.         --| This is determined by walking down the list of declarations
  5460.         --| until something which is not an implicit label is encountered.
  5461.         --| Implicit labels are inserted in the as_item_s list
  5462.         --| of the enclosing block.  Thus if the only elements of the
  5463.         --| as_item_s of the block are implicit_labels then the token
  5464.         --| declare does not appear in the source program.
  5465.      
  5466.         StartForward (as_item_s (block), I);
  5467.         while not Finished(I) loop
  5468.             case Kind (Cell (I)) is
  5469.               when implicit_label_declKind =>
  5470.                 Forward (I);
  5471.               when others =>
  5472.                 EndIterate (I);
  5473.                 return true;
  5474.             end case;
  5475.         end loop;
  5476.         EndIterate (I);
  5477.         return false;
  5478.     end In_declare_block;
  5479.      
  5480. --------------------------------------------------------------------------
  5481.      
  5482.     function Is_Block_Labeled ( --| This function returns true
  5483.                                 --| if the block passed in has a label
  5484.                                 --| and returns false otherwise.
  5485.         block :in     block_stmNode.Locator
  5486.     ) return boolean is
  5487.     begin
  5488.         return not Is_Source_Position_Null (
  5489.                  lx_srcpos (as_block_label (block))
  5490.                                            );
  5491.     end;
  5492.      
  5493. --------------------------------------------------------------------------
  5494.      
  5495.     function Is_Source_Position_Null (
  5496.         Position :in    MLSP.Source_Position
  5497.     ) return boolean is
  5498.     begin
  5499.         return MLSP."=" (Position.first_location,0);
  5500.     end;
  5501.      
  5502. end Block_Utilities;
  5503. ::::::::::::::
  5504. block_u.spc
  5505. ::::::::::::::
  5506. --VMS file: %nosc.work.tools.halstead.source*(block_u.spc)
  5507. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.spc
  5508. -- $Source: /nosc/work/tools/halstead/RCS/block_u.spc,v $
  5509. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:09 $ -- $Author: buddy $
  5510.      
  5511. --pragma revision ("$Revision: 1.2 $");
  5512.      
  5513.      
  5514. with ST_DIANA; use ST_DIANA;
  5515. package Block_Utilities is
  5516. --------------------------------------------------------------------------
  5517.      
  5518.     function In_Declare_Block (  --| This function determines whether
  5519.                                  --| we are in a block with declarations.
  5520.                                  --| If we are it returns true otherwise
  5521.                                  --| false.
  5522.                       block :in     BLOCK_STUB.Locator
  5523.     ) return boolean;
  5524.      
  5525.      
  5526.     function Is_Block_Labeled ( --| This function returns true
  5527.                                 --| if the block passed in has a label
  5528.                                 --| and returns false otherwise.
  5529.         block :in     block_stmNode.Locator
  5530.     ) return boolean;
  5531. end Block_Utilities;
  5532. ::::::::::::::
  5533. comlin.bdy
  5534. ::::::::::::::
  5535. -- $Source: /nosc/work/tools/halstead/RCS/comlin.bdy,v $
  5536. -- $Revision: 1.18 $ -- $Date: 85/03/25 21:03:22 $ -- $Author: buddy $
  5537. with Text_IO; use Text_IO;
  5538. with Int_IO; use Int_IO;
  5539. package body CommandLine is
  5540.     TokenSeparator :constant character := '%';
  5541.      
  5542. --------------------------------------------------------------------------
  5543.     procedure ScanForChar (
  5544.               S     :in     String;
  5545.               C     :in     character;
  5546.               Start :in     positive;
  5547.               Place :   out natural
  5548.     ) is
  5549.         Temp  :positive := Start;
  5550.         Found :boolean := false;
  5551.     begin
  5552.      
  5553.         Place := 0;
  5554.         while (Temp <= S'Last) and (not Found) loop
  5555.             if S(Temp) = C then
  5556.                 Place := Temp;
  5557.                 Found := true;
  5558.             end if;
  5559.             Temp := Temp + 1;
  5560.         end loop;
  5561.      end;
  5562.      
  5563. --------------------------------------------------------------------------
  5564.      
  5565.     function GetNumberOfUnits(
  5566.              S     :in    String
  5567.     ) return natural is
  5568.      
  5569.         count :natural := 0;
  5570.     begin
  5571.         for i in S'Range loop
  5572.             if S(i) = TokenSeparator then
  5573.                 count := count + 1;
  5574.             end if;
  5575.         end loop;
  5576.         return count;
  5577.     end;
  5578.      
  5579. --------------------------------------------------------------------------
  5580.      
  5581.     function GetToken (
  5582.              S     :in    String;
  5583.              Start :in    positive
  5584.     ) return String is
  5585.         EndOfToken :natural;
  5586.     begin
  5587.      
  5588.         ScanForChar (S, TokenSeparator, Start, EndOfToken);
  5589.         if EndOfToken = 0 then
  5590.             raise TokenNotFound;
  5591.         else
  5592.            return S(Start..EndOfToken - 1);
  5593.         end if;
  5594.      end;
  5595.      
  5596. --------------------------------------------------------------------------
  5597.      
  5598.     procedure Advance (
  5599.               S     :in     String;
  5600.               Start :in out positive
  5601.    ) is
  5602.    begin
  5603.        Start := Start + GetToken (S, Start)'Length + 1;
  5604.    end;
  5605.      
  5606. --------------------------------------------------------------------------
  5607.      
  5608.     function GetSpec (
  5609.              S     :in    String;
  5610.              Start :in    positive
  5611.     ) return boolean is
  5612.     begin
  5613.      
  5614.         if boolean'Value (GetToken (S, Start)) in false..true then
  5615.             return boolean'Value (GetToken (S, Start));
  5616.         end if;
  5617.     exception
  5618.         when CONSTRAINT_ERROR =>
  5619.           raise ExpectingBoolean;
  5620.     end;
  5621.      
  5622. --------------------------------------------------------------------------
  5623.      
  5624.     function IsSubUnit (
  5625.              S     :in    String;
  5626.              Start :in    positive
  5627.     ) return boolean is
  5628.         PeriodPosition   :natural;
  5629.     begin
  5630.         ScanForChar (S, '.', Start, PeriodPosition);
  5631.         if (S'First < PeriodPosition) and (PeriodPosition < S'Last) then
  5632.             return true;
  5633.         else
  5634.             return false;
  5635.         end if;
  5636.     end;
  5637.      
  5638. --------------------------------------------------------------------------
  5639.      
  5640.     function GetParent (
  5641.              S     :in    String;
  5642.              Start :in    positive
  5643.     ) return String is
  5644.         PeriodPosition :natural;
  5645.     begin
  5646.         ScanForChar (S, '.', Start, PeriodPosition);
  5647.         if PeriodPosition = 0 then
  5648.             raise InvalidSubUnit;
  5649.         else
  5650.             Return S(Start..PeriodPosition - 1);
  5651.         end if;
  5652.     end;
  5653.      
  5654. --------------------------------------------------------------------------
  5655.      
  5656.     function GetSubUnit (
  5657.              S     :in    String;
  5658.              Start :in    positive
  5659.     ) return String is
  5660.          PeriodPosition  :natural;
  5661.          EndToken        :natural;
  5662.     begin
  5663.          ScanForChar (S, '.', Start, PeriodPosition);
  5664.          ScanForChar (S, TokenSeparator, PeriodPosition, EndToken);
  5665.          if EndToken = 0 then
  5666.              raise InvalidSubUnit;
  5667.          else
  5668.              return S(PeriodPosition + 1..EndToken - 1);
  5669.          end if;
  5670.     end;
  5671.      
  5672. --------------------------------------------------------------------------
  5673.      
  5674. end CommandLine;
  5675. ::::::::::::::
  5676. comlin.spc
  5677. ::::::::::::::
  5678. -- $Source: /nosc/work/tools/halstead/RCS/comlin.spc,v $
  5679. -- $Revision: 1.5 $ -- $Date: 85/03/24 16:17:23 $ -- $Author: buddy $
  5680.      
  5681. package CommandLine is
  5682.     TokenNotFound    :exception;
  5683.     ExpectingBoolean :exception;
  5684.     InvalidSubUnit   :exception;
  5685.      
  5686.     function GetNumberOfUnits(
  5687.              S     :in    String
  5688.     ) return natural;
  5689.      
  5690. --------------------------------------------------------------------------
  5691.      
  5692.     procedure Advance (
  5693.               S      :in     String;
  5694.               Start  :in out positive
  5695.     );
  5696.      
  5697. --------------------------------------------------------------------------
  5698.      
  5699.     function GetToken (
  5700.              S     :in    String;
  5701.              Start :in    positive
  5702.     ) return String;
  5703.      
  5704. --------------------------------------------------------------------------
  5705.      
  5706.     function IsSubUnit (
  5707.              S     :in    String;
  5708.              Start :in    positive
  5709.     ) return boolean;
  5710.      
  5711. --------------------------------------------------------------------------
  5712.      
  5713.     function GetParent (
  5714.              S     :in    String;
  5715.              Start :in    positive
  5716.     ) return String;
  5717.      
  5718. --------------------------------------------------------------------------
  5719.      
  5720.     function GetSpec (
  5721.              S     :in    String;
  5722.              Start :in    positive
  5723.     ) return boolean;
  5724.      
  5725. --------------------------------------------------------------------------
  5726.      
  5727.     function GetSubUnit (
  5728.              S     :in    String;
  5729.              Start :in    positive
  5730.     ) return String;
  5731.      
  5732. --------------------------------------------------------------------------
  5733.      
  5734. end CommandLine;
  5735. ::::::::::::::
  5736. count.bdy
  5737. ::::::::::::::
  5738. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5739. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5740.      
  5741. --pragma revision ("$Revision: 1.1 $");
  5742.      
  5743. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5744. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5745.      
  5746. --pragma revision ("$Revision: 1.1 $");
  5747.      
  5748. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5749. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5750.      
  5751. --pragma revision ("$Revision: 1.1 $");
  5752.      
  5753. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5754. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5755.      
  5756. --pragma revision ("$Revision: 1.1 $");
  5757.      
  5758. with Text_IO; use Text_IO;
  5759. with Int_IO; use Int_IO;
  5760. package body count is
  5761.     TokenClassification: array (D.TokenItem) of D.Class := (
  5762.       D.abortz                  => D.operator,
  5763.       D.acceptz                 => D.operator,
  5764.       D.accessz                 => D.operator,
  5765.       D.allz                    => D.operator,
  5766.       D.and_thenz               => D.operator,
  5767.       D.arrayz                  => D.operator,
  5768.       D.atz                     => D.neither,
  5769.       D.beginz                  => D.neither,
  5770.       D.bodyz                   => D.neither,
  5771.       D.body_packagez           => D.neither,
  5772.       D.body_taskz              => D.neither,
  5773.       D.casez                   => D.neither,
  5774.       D.case_stmz               => D.neither,
  5775.       D.case_variantz           => D.neither,
  5776.       D.constantz               => D.operator,
  5777.       D.declarez                => D.operator,
  5778.       D.delayz                  => D.operator,
  5779.       D.deltaz                  => D.operator,
  5780.       D.digitsz                 => D.operator,
  5781.       D.doz                     => D.neither,
  5782.       D.elsez                   => D.operator,
  5783.       D.else_ifz                => D.operator,
  5784.       D.else_orz                => D.operator,
  5785.       D.else_selectz            => D.operator,
  5786.       D.elsifz                  => D.operator,
  5787.       D.endz                    => D.neither,
  5788.       D.end_acceptz             => D.neither,
  5789.       D.end_beginz              => D.neither,
  5790.       D.end_case_stmz           => D.operator,
  5791.       D.end_case_variantz       => D.operator,
  5792.       D.end_ifz                 => D.operator,
  5793.       D.end_loopz               => D.operator,
  5794.       D.end_package_bdyz        => D.operator,
  5795.       D.end_package_spcz        => D.operator,
  5796.       D.end_recordz             => D.operator,
  5797.       D.end_record_repz         => D.operator,
  5798.       D.end_selectz             => D.operator,
  5799.       D.end_task_spcz           => D.operator,
  5800.       D.entryz                  => D.operator,
  5801.       D.exceptionz              => D.operator,
  5802.       D.exitz                   => D.operator,
  5803.       D.forz                    => D.neither,
  5804.       D.for_loopz               => D.neither,
  5805.       D.for_repz                => D.neither,
  5806.       D.functionz               => D.operator,
  5807.       D.genericz                => D.operator,
  5808.       D.gotoz                   => D.operator,
  5809.       D.ifz                     => D.neither,
  5810.       D.inz                     => D.operator,
  5811.       D.in_loopz                => D.operator,
  5812.       D.in_membershipz          => D.operator,
  5813.       D.in_out_parameterz       => D.neither,
  5814.       D.in_parameterz           => D.neither,
  5815.       D.isz                     => D.neither,
  5816.       D.is_case_stmz            => D.neither,
  5817.       D.is_case_variantz        => D.neither,
  5818.       D.is_functionz            => D.neither,
  5819.       D.is_genericz             => D.neither,
  5820.       D.is_package_bdyz         => D.neither,
  5821.       D.is_package_spcz         => D.neither,
  5822.       D.is_procedurez           => D.neither,
  5823.       D.is_separatez            => D.operator,
  5824.       D.is_subtypez             => D.neither,
  5825.       D.is_typez                => D.neither,
  5826.       D.is_task_bdyz            => D.neither,
  5827.       D.is_task_spcz            => D.neither,
  5828.       D.limitedz                => D.operator,
  5829.       D.loopz                   => D.neither,
  5830.       D.modz                    => D.operator,
  5831.       D.newz                    => D.neither,
  5832.       D.new_allocatorz          => D.operator,
  5833.       D.new_derived_typez       => D.operator,
  5834.       D.new_generic_instz       => D.operator,
  5835.       D.not_in_membershipz      => D.operator,
  5836.       D.nullz                   => D.neither,
  5837.       D.null_valuez             => D.operand,
  5838.       D.null_stmz               => D.operator,
  5839.       D.null_fieldz             => D.operator,
  5840.       D.ofz                     => D.operator,
  5841.       D.orz                     => D.operator,
  5842.       D.or_elsez                => D.operator,
  5843.       D.or_selectz              => D.operator,
  5844.       D.othersz                 => D.neither,
  5845.       D.others_aggregatez       => D.operator,
  5846.       D.others_casez            => D.operator,
  5847.       D.others_exceptionz       => D.operator,
  5848.       D.others_variantz         => D.operator,
  5849.       D.outz                    => D.neither,
  5850.       D.packagez                => D.neither,
  5851.       D.package_bdyz            => D.neither,
  5852.       D.package_spcz            => D.neither,
  5853.       D.pragmaz                 => D.operator,
  5854.       D.privatez                => D.neither,
  5855.       D.private_sectionz        => D.operator,
  5856.       D.private_typez           => D.operator,
  5857.       D.procedurez              => D.neither,
  5858.       D.raisez                  => D.operator,
  5859.       D.rangez                  => D.operator,
  5860.       D.recordz                 => D.neither,
  5861.       D.record_typez            => D.neither,
  5862.       D.record_repz             => D.neither,
  5863.       D.renamesz                => D.operator,
  5864.       D.returnz                 => D.operator,
  5865.       D.reversez                => D.operator,
  5866.       D.selectz                 => D.neither,
  5867.       D.separatez               => D.neither,
  5868.       D.subtypez                => D.operator,
  5869.       D.taskz                   => D.neither,
  5870.       D.task_bdyz               => D.neither,
  5871.       D.task_spcz               => D.neither,
  5872.       D.terminatez              => D.operator,
  5873.       D.thenz                   => D.neither,
  5874.       D.then_andz               => D.operator,
  5875.       D.typez                   => D.operator,
  5876.       D.usez                    => D.neither,
  5877.       D.use_contextz            => D.operator,
  5878.       D.use_repz                => D.operator,
  5879.       D.whenz                   => D.neither,
  5880.       D.when_case_stmz          => D.neither,
  5881.       D.when_exitz              => D.neither,
  5882.       D.when_exceptionz         => D.neither,
  5883.       D.when_selectz            => D.neither,
  5884.       D.when_case_variantz      => D.neither,
  5885.       D.whilez                  => D.operator,
  5886.       D.withz                   => D.neither,
  5887.       D.with_contextz           => D.operator,
  5888.       D.with_genericz           => D.operator,
  5889.       -------------  punctuation  --------------
  5890.       D.arrowz                  => D.operator,
  5891.       D.barz                    => D.operator,
  5892.       D.boxz                    => D.neither,
  5893.       D.box_rangez              => D.operator,
  5894.       D.box_default_subpz       => D.operator,
  5895.       D.character_literalz      => D.operand,
  5896.       D.closed_anglesz          => D.neither,
  5897.       D.closed_parenthesisz     => D.neither,
  5898.       D.colon_equalsz           => D.operator,
  5899.       D.colonz                  => D.operator,
  5900.       D.commaz                  => D.operator,
  5901.       D.dotz                    => D.operator,
  5902.       D.dot_dot_rangez          => D.operator,
  5903.       D.double_quotez           => D.operand,
  5904.       D.numeric_literalz        => D.operand,
  5905.       D.open_anglesz            => D.operator,
  5906.       D.open_parenthesisz       => D.operator,
  5907.       D.semicolonz              => D.neither,
  5908.       D.single_quotez           => D.neither,
  5909.       D.tickz                   => D.operator,
  5910.       D.declare_blockz          => D.neither
  5911.            );
  5912.               --| This is a map from token types to symbol classification.
  5913.               --| It indicates which class (D.operator, operand, neither)
  5914.               --| a token is in.
  5915.      
  5916. --------------------------------------------------------------------------
  5917.      
  5918.     function RemoveLastChar (  --| This removes the last character from
  5919.                                --| the string S.  This is used to get
  5920.                                --| rid of the z's in the TokenItems.
  5921.                    S      :in     String
  5922.     ) return String is
  5923.      
  5924.     begin
  5925.         return S(S'first..S'last - 1);
  5926.     end;
  5927.      
  5928. --------------------------------------------------------------------------
  5929.      
  5930.     procedure HalsteadCount (
  5931.       TokenInfo :in     D.TokenCountType;
  5932.       VerboseOn :in     boolean;
  5933.       Nn:        in out CT.NnInfoType
  5934.     )  is
  5935.     begin
  5936.         for t in D.TokenItem loop
  5937.             if TokenInfo(t) > 0  then
  5938.                 Nn(TokenClassification(t)).Vocabulary :=
  5939.                   Nn(TokenClassification(t)).Vocabulary + 1;
  5940.                 Nn(TokenClassification(t)).Usage :=
  5941.                   Nn(TokenClassification(t)).Usage + TokenInfo(t);
  5942.      
  5943.                 if VerboseOn then
  5944.                     Put (Standard_Output, "number of ");
  5945.                     Put (Standard_Output,
  5946.                          RemoveLastChar (D.TokenItem ' image (t)));
  5947.                     Put (Standard_Output, " tokens is ");
  5948.                     Put (Standard_Output, TokenInfo(t));
  5949.                     New_Line (Standard_Output);
  5950.                 end if;
  5951.      
  5952.             end if;
  5953.         end loop;
  5954.     end HalsteadCount;
  5955. end count;
  5956. ::::::::::::::
  5957. count.spc
  5958. ::::::::::::::
  5959. -- $Source: /nosc/work/tools/halstead/RCS/count.spc,v $
  5960. -- $Revision: 1.3 $ -- $Date: 85/06/13 13:29:12 $ -- $Author: buddy $
  5961.      
  5962. --pragma revision ("$Revision: 1.3 $");
  5963.      
  5964. with Definitions;
  5965. with Count_Types;
  5966. package Count is
  5967.      
  5968.     package D renames Definitions;
  5969.     package CT renames Count_Types;
  5970.      
  5971. --------------------------------------------------------------------------
  5972.      
  5973.     procedure HalsteadCount (  --| This procedure determines which tokens
  5974.                                --| are operators and operands and counts
  5975.                                --| them.
  5976.       TokenInfo :in     D.TokenCountType;
  5977.       VerboseOn :in     boolean;
  5978.       Nn:        in out CT.NnInfoType
  5979.     );
  5980.      
  5981. --------------------------------------------------------------------------
  5982. end Count;
  5983. ::::::::::::::
  5984. countype.bdy
  5985. ::::::::::::::
  5986. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  5987. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  5988.      
  5989. --pragma revision ("$Revision: 1.1 $");
  5990.      
  5991. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  5992. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  5993.      
  5994. --pragma revision ("$Revision: 1.1 $");
  5995.      
  5996. with Definitions;
  5997. package body Count_Types is
  5998.      
  5999. --------------------------------------------------------------------------
  6000.      
  6001.     function AddCounts (   --| This function Adds two records and
  6002.                            --| returns their sum.
  6003.                      L   :in     NnInfoType;
  6004.                      R   :in     NnInfoType
  6005.     ) return NnInfoType is
  6006.         Sum :NnInfoType;
  6007.     begin
  6008.         for c in Definitions.Class loop
  6009.             Sum(c).Vocabulary := L(c).Vocabulary + R(c).Vocabulary;
  6010.             Sum(c).Usage := L(c).Usage + R(c).Usage;
  6011.         end loop;
  6012.         return Sum;
  6013.     end;
  6014. --------------------------------------------------------------------------
  6015.      
  6016.     procedure ZeroCount (--| Sets the counts of all the classes of  NnInfo
  6017.                          --| to 0.
  6018.                   NnInfo :in out  NnInfoType
  6019.     ) is
  6020.     begin
  6021.         for c in Definitions.Class loop
  6022.             NnInfo(c).Vocabulary := 0;
  6023.             NnInfo(c).Usage := 0;
  6024.         end loop;
  6025.     end;
  6026.      
  6027. ------------------------------------------------------------------------- -
  6028. end Count_Types;
  6029. ::::::::::::::
  6030. countype.spc
  6031. ::::::::::::::
  6032. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  6033. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  6034.      
  6035. --pragma revision ("$Revision: 1.1 $");
  6036.      
  6037. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  6038. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  6039.      
  6040. --pragma revision ("$Revision: 1.1 $");
  6041.      
  6042. with Definitions;
  6043. package Count_Types is
  6044.     --| OVERVIEW
  6045.     --| This package defines types that are being used in the counting
  6046.     --| of tokens.  It also provides an operation AddCounts which
  6047.     --| a function which returns the sum of two NnInfoType records.
  6048.     --| This is needed because it is necessary to separate the token
  6049.     --| counts which result from DEF_ID_Analysis and Literal_Analysis
  6050.     --| and the token counts which result from keyword other syntactic
  6051.     --| constructs.
  6052.      
  6053.     type NnRecordType is
  6054.         record
  6055.           Vocabulary: natural := 0;
  6056.           Usage:      natural := 0;
  6057.         end record;
  6058.         --| This package is used to define the NnInfoType used by all
  6059.         --| the different counting strategies.
  6060.      
  6061.     type NnInfoType is array (Definitions.Class) of NnRecordType;
  6062.       --| NnInfoType keeps track of the vocabulary and usage for each
  6063.       --| class (i.e. operator, operand, and neither).
  6064.       --|
  6065.       --| Vocabulary keeps track of the number of unique symbols in
  6066.       --| the source program.  For example:
  6067.       --|
  6068.       --|          Nn :NnInfoType;
  6069.       --|
  6070.       --| Then Nn(operator).Vocabulary corresponds to n1 the unique
  6071.       --| number of operators in Halstead's notation and
  6072.       --| Nn(operand).Vocabulary corresponds to n2 the unique number of
  6073.       --| operands.  Thus
  6074.       --|
  6075.       --| Nn(operator).Vocabulary + Nn(operand).Vocabulary =n
  6076.       --|
  6077.       --|  which is the vocabulary for the source program.
  6078.       --|
  6079.       --| Usage keeps track of the total usage of each class of
  6080.       --| operator, operand, and neither. Nn(operator).Usage
  6081.       --| Nn(operand).Usage correspond to N1 and N2 in Halstead
  6082.       --| notation and their sum corresponds to N which is the length of
  6083.      
  6084. --------------------------------------------------------------------------
  6085.      
  6086.     function AddCounts (   --| This function Adds two records and
  6087.                            --| returns their sum.
  6088.                      L   :in     NnInfoType;
  6089.                      R   :in     NnInfoType
  6090.     ) return NnInfoType ;
  6091. --------------------------------------------------------------------------
  6092.      
  6093.     procedure ZeroCount (--| Sets the counts of NnInfo to 0.
  6094.                   NnInfo :in out  NnInfoType
  6095.     );
  6096.      
  6097. ------------------------------------------------------------------------- -
  6098. end Count_Types;
  6099. ::::::::::::::
  6100. defs.bdy
  6101. ::::::::::::::
  6102. -- $Source: /nosc/work/tools/halstead/RCS/defs.bdy,v $
  6103. -- $Revision: 5.1 $ -- $Date: 85/04/04 08:30:38 $ -- $Author: buddy $
  6104.      
  6105. with VmmTextPkg;
  6106. with unchecked_deallocation;
  6107. package body Definitions is
  6108.      
  6109.     function "<" ( --| This function compares the text of two literals
  6110.                    --| to see if X is lexigraphically less than Y.
  6111.            X :in Source_Text.Locator;
  6112.            Y :in Source_Text.Locator
  6113.     ) return boolean is
  6114.      
  6115.     begin
  6116.         return
  6117.         VmmTextPkg.Value (Source_Text.Value (X))
  6118.         <
  6119.         VmmTextPkg.Value (Source_Text.Value (Y));
  6120.     end;
  6121.      
  6122.     package body Literal_Set is
  6123.      
  6124.     ------------------------------------------------------------------------------
  6125.     --                Nested Private Definitions
  6126.     -------------------------------------------------------------------------------
  6127.      
  6128.      
  6129.     package body TreePkg is
  6130.     ---------------------------------------------------------------------------
  6131.     --                   Nested Private Definitions
  6132.     ---------------------------------------------------------------------------
  6133.      
  6134.      
  6135.      
  6136.     package body NodeOrder is
  6137.      
  6138.         procedure Free is new unchecked_deallocation (Cell, List);
  6139.      
  6140.     --------------------------------------------------------------------------
  6141.      
  6142.        function Last (L: in     List) return List is
  6143.      
  6144.            Place_In_L:        List;
  6145.            Temp_Place_In_L:   List;
  6146.      
  6147.        --|  Link down the list L and return the pointer to the last element
  6148.        --| of L.  If L is null raise the EmptyList exception.
  6149.      
  6150.        begin
  6151.            if L = null then
  6152.                raise EmptyList;
  6153.            else
  6154.      
  6155.                --|  Link down L saving the pointer to the previous element in
  6156.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  6157.                --|  points to the last element in the list.
  6158.      
  6159.                Place_In_L := L;
  6160.                while Place_In_L /= null loop
  6161.                    Temp_Place_In_L := Place_In_L;
  6162.                    Place_In_L := Place_In_L.Next;
  6163.                end loop;
  6164.                return Temp_Place_In_L;
  6165.            end if;
  6166.         end Last;
  6167.      
  6168.      
  6169.     --------------------------------------------------------------------------
  6170.      
  6171.         procedure Attach (List1: in out List;
  6172.                           List2: in     List ) is
  6173.             EndOfList1: List;
  6174.      
  6175.         --| Attach List2 to List1.
  6176.         --| If List1 is null return List2
  6177.         --| If List1 equals List2 then raise CircularList
  6178.         --| Otherwise get the pointer to the last element of List1 and change
  6179.         --| its Next field to be List2.
  6180.      
  6181.         begin
  6182.             if List1 = null then
  6183.                 List1 := List2;
  6184.                 return;
  6185.             elsif List1 = List2 then
  6186.                 raise CircularList;
  6187.             else
  6188.                 EndOfList1 := Last (List1);
  6189.                 EndOfList1.Next := List2;
  6190.             end if;
  6191.         end Attach;
  6192.      
  6193.     --------------------------------------------------------------------------
  6194.      
  6195.        procedure Attach (L:       in out List;
  6196.                          Element: in     Tree ) is
  6197.      
  6198.            NewEnd:    List;
  6199.      
  6200.        --| Create a list containing Element and attach it to the end of L
  6201.      
  6202.        begin
  6203.            NewEnd := new Cell'(Info => Element, Next => null);
  6204.            Attach (L, NewEnd);
  6205.        end;
  6206.      
  6207.     --------------------------------------------------------------------------
  6208.      
  6209.        function Attach (Element1: in   Tree;
  6210.                         Element2: in   Tree ) return List is
  6211.            NewList: List;
  6212.      
  6213.        --| Create a new list containing the information in Element1 and
  6214.        --| attach Element2 to that list.
  6215.      
  6216.        begin
  6217.            NewList := new Cell'(Info => Element1, Next => null);
  6218.            Attach (NewList, Element2);
  6219.            return NewList;
  6220.        end;
  6221.      
  6222.     --------------------------------------------------------------------------
  6223.      
  6224.        procedure Attach (Element: in     Tree;
  6225.                          L:       in out List      ) is
  6226.      
  6227.        --|  Create a new cell whose information is Element and whose Next
  6228.        --|  field is the list L.  This prepends Element to the List L.
  6229.      
  6230.        begin
  6231.            L := new Cell'(Info => Element, Next => L);
  6232.        end;
  6233.      
  6234.     --------------------------------------------------------------------------
  6235.      
  6236.        function Attach ( List1: in    List;
  6237.                          List2: in    List   ) return List is
  6238.      
  6239.        Last_Of_List1: List;
  6240.      
  6241.        begin
  6242.            if List1 = null then
  6243.                return List2;
  6244.            elsif List1 = List2 then
  6245.                raise CircularList;
  6246.            else
  6247.                Last_Of_List1 := Last (List1);
  6248.                Last_Of_List1.Next := List2;
  6249.                return List1;
  6250.            end if;
  6251.        end  Attach;
  6252.      
  6253.     -------------------------------------------------------------------------
  6254.      
  6255.        function Attach( L:       in     List;
  6256.                         Element: in     Tree ) return List is
  6257.      
  6258.        NewEnd: List;
  6259.        Last_Of_L: List;
  6260.      
  6261.        --| Create a list called NewEnd and attach it to the end of L.
  6262.        --| If L is null return NewEnd
  6263.        --| Otherwise get the last element in L and make its Next field
  6264.        --| NewEnd.
  6265.      
  6266.        begin
  6267.            NewEnd := new Cell'(Info => Element, Next => null);
  6268.            if L = null then
  6269.                return NewEnd;
  6270.            else
  6271.                Last_Of_L := Last (L);
  6272.                Last_Of_L.Next := NewEnd;
  6273.                return L;
  6274.            end if;
  6275.        end Attach;
  6276.      
  6277.     --------------------------------------------------------------------------
  6278.      
  6279.        function Attach (Element: in     Tree;
  6280.                         L:       in     List        ) return List is
  6281.      
  6282.        begin
  6283.            return (new Cell'(Info => Element, Next => L));
  6284.        end Attach;
  6285.      
  6286.     --------------------------------------------------------------------------
  6287.      
  6288.        function Copy (L: in     List) return List is
  6289.      
  6290.        --| If L is null return null
  6291.        --| Otherwise recursively copy the list by first copying the information
  6292.        --| at the head of the list and then making the Next field point to
  6293.        --| a copy of the tail of the list.
  6294.      
  6295.        begin
  6296.            if L = null then
  6297.                return null;
  6298.            else
  6299.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  6300.            end if;
  6301.        end Copy;
  6302.      
  6303.      
  6304.     --------------------------------------------------------------------------
  6305.      
  6306.         function Create return List is
  6307.      
  6308.         --| Return the empty list.
  6309.      
  6310.         begin
  6311.             return null;
  6312.         end Create;
  6313.      
  6314.     --------------------------------------------------------------------------
  6315.      
  6316.        procedure DeleteHead (L: in out List) is
  6317.      
  6318.            TempList: List;
  6319.      
  6320.        --| Remove the element of the head of the list and return it to the heap.
  6321.        --| If L is null EmptyList.
  6322.        --| Otherwise save the Next field of the first element, remove the first
  6323.        --| element and then assign to L the Next field of the first element.
  6324.      
  6325.        begin
  6326.            if L = null then
  6327.                raise EmptyList;
  6328.            else
  6329.                TempList := L.Next;
  6330.                Free (L);
  6331.                L := TempList;
  6332.            end if;
  6333.        end DeleteHead;
  6334.      
  6335.     --------------------------------------------------------------------------
  6336.      
  6337.        procedure DeleteItem (L:       in out List;
  6338.                              Element: in     Tree ) is
  6339.      
  6340.            Temp_L  :List;
  6341.      
  6342.        --| Remove the first element in the list with the value Element.
  6343.        --| If the first element of the list is equal to element then
  6344.        --| remove it.  Otherwise, recurse on the tail of the list.
  6345.      
  6346.        begin
  6347.            if L.Info = Element then
  6348.                DeleteHead(L);
  6349.            else
  6350.                DeleteItem(L.Next, Element);
  6351.            end if;
  6352.        exception
  6353.            when constraint_error =>
  6354.                raise ItemNotPresent;
  6355.        end DeleteItem;
  6356.      
  6357.     --------------------------------------------------------------------------
  6358.      
  6359.        procedure DeleteItems (L:       in out List;
  6360.                               Element: in     Tree ) is
  6361.      
  6362.            Place_In_L       :List;     --| Current place in L.
  6363.            Last_Place_In_L  :List;     --| Last place in L.
  6364.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  6365.            Found            :boolean := false;  --| Indicates if an element with
  6366.                                                 --| the correct value was found.
  6367.      
  6368.        --| Walk over the list removing all elements with the value Element.
  6369.      
  6370.        begin
  6371.            Place_In_L := L;
  6372.            Last_Place_In_L := null;
  6373.            while (Place_In_L /= null) loop
  6374.      
  6375.                --| Found an element equal to Element
  6376.      
  6377.                if Place_In_L.Info = Element then
  6378.                     Found := true;
  6379.      
  6380.                     --| If Last_Place_In_L is null then we are at first element
  6381.                     --| in L.
  6382.      
  6383.                     if Last_Place_In_L = null then
  6384.                          Temp_Place_In_L := Place_In_L;
  6385.                          L := Place_In_L.Next;
  6386.                     else
  6387.                          Temp_Place_In_L := Place_In_L;
  6388.      
  6389.                          --| Relink the list Last's Next gets Place's Next
  6390.      
  6391.                          Last_Place_In_L.Next := Place_In_L.Next;
  6392.                     end if;
  6393.      
  6394.                     --| Move Place_In_L to the next position in the list.
  6395.                     --| Free the element.
  6396.                     --| Do not update the last element in the list it remains the
  6397.                     --| same.
  6398.      
  6399.                     Place_In_L := Place_In_L.Next;
  6400.                     Free (Temp_Place_In_L);
  6401.                else
  6402.                     --| Update the last place in L and the place in L.
  6403.      
  6404.                     Last_Place_In_L := Place_In_L;
  6405.                     Place_In_L := Place_In_L.Next;
  6406.                end if;
  6407.            end loop;
  6408.      
  6409.        --| If we have not found an element raise an exception.
  6410.      
  6411.        if not Found then
  6412.           raise ItemNotPresent;
  6413.        end if;
  6414.      
  6415.        end DeleteItems;
  6416.      
  6417.     --------------------------------------------------------------------------
  6418.      
  6419.        procedure Destroy (L: in out List) is
  6420.      
  6421.            Place_In_L:  List;
  6422.            HoldPlace:   List;
  6423.      
  6424.        --| Walk down the list removing all the elements and set the list to
  6425.        --| the empty list.
  6426.      
  6427.        begin
  6428.            Place_In_L := L;
  6429.            while Place_In_L /= null loop
  6430.                HoldPlace := Place_In_L;
  6431.                Place_In_L := Place_In_L.Next;
  6432.                Free (HoldPlace);
  6433.            end loop;
  6434.            L := null;
  6435.        end Destroy;
  6436.      
  6437.     --------------------------------------------------------------------------
  6438.      
  6439.        function FirstValue (L: in    List) return Tree is
  6440.      
  6441.        --| Return the first value in the list.
  6442.      
  6443.        begin
  6444.            if L = null then
  6445.                raise EmptyList;
  6446.            else
  6447.                return (L.Info);
  6448.            end if;
  6449.        end FirstValue;
  6450.      
  6451.     --------------------------------------------------------------------------
  6452.      
  6453.        procedure Forword (I: in out ListIter) is
  6454.      
  6455.            --| Return the pointer to the next member of the list.
  6456.            Temp_L :List;
  6457.        begin
  6458.            Temp_L := List (I);
  6459.            I := ListIter (Temp_L.Next);
  6460.        end Forword;
  6461.      
  6462.     --------------------------------------------------------------------------
  6463.      
  6464.        function IsInList (L:       in    List;
  6465.                           Element: in    Tree  ) return boolean is
  6466.      
  6467.        Place_In_L: List;
  6468.      
  6469.        --| Check if Element is in L.  If it is return true otherwise return false.
  6470.      
  6471.        begin
  6472.            Place_In_L := L;
  6473.            while Place_In_L /= null loop
  6474.                if Place_In_L.Info = Element then
  6475.                    return true;
  6476.                end if;
  6477.                Place_In_L := Place_In_L.Next;
  6478.             end loop;
  6479.             return false;
  6480.        end IsInList;
  6481.      
  6482.     --------------------------------------------------------------------------
  6483.      
  6484.         function IsEmpty (L: in     List) return boolean is
  6485.      
  6486.         --| Is the list L empty.
  6487.      
  6488.         begin
  6489.             return (L = null);
  6490.         end IsEmpty;
  6491.      
  6492.     --------------------------------------------------------------------------
  6493.      
  6494.        function LastValue (L: in     List) return Tree is
  6495.      
  6496.            LastElement: List;
  6497.      
  6498.        --| Return the value of the last element of the list. Get the pointer
  6499.        --| to the last element of L and then return its information.
  6500.      
  6501.        begin
  6502.            LastElement := Last (L);
  6503.            return LastElement.Info;
  6504.        end LastValue;
  6505.      
  6506.     --------------------------------------------------------------------------
  6507.      
  6508.        function Length (L: in     List) return integer is
  6509.      
  6510.        --| Recursively compute the length of L.  The length of a list is
  6511.        --| 0 if it is null or  1 + the length of the tail.
  6512.      
  6513.        begin
  6514.            if L = null then
  6515.                return (0);
  6516.            else
  6517.                return (1 + Length (Tail (L)));
  6518.            end if;
  6519.        end Length;
  6520.      
  6521.     --------------------------------------------------------------------------
  6522.      
  6523.        function MakeListIter (L: in     List) return ListIter is
  6524.      
  6525.        --| Start an iteration operation on the list L.  Do a type conversion
  6526.        --| from List to ListIter.
  6527.      
  6528.        begin
  6529.            return ListIter (L);
  6530.        end MakeListIter;
  6531.      
  6532.     --------------------------------------------------------------------------
  6533.      
  6534.        function More (L: in     ListIter) return boolean is
  6535.      
  6536.        --| This is a test to see whether an iteration is complete.
  6537.      
  6538.        begin
  6539.            return L /= null;
  6540.        end;
  6541.      
  6542.     --------------------------------------------------------------------------
  6543.      
  6544.        procedure Next (Place:   in out ListIter;
  6545.                        Info:       out Tree ) is
  6546.            PlaceInList: List;
  6547.      
  6548.        --| This procedure gets the information at the current place in the List
  6549.        --| and moves the ListIter to the next postion in the list.
  6550.        --| If we are at the end of a list then exception NoMore is raised.
  6551.      
  6552.        begin
  6553.            if Place = null then
  6554.               raise NoMore;
  6555.            else
  6556.               PlaceInList := List(Place);
  6557.               Info := PlaceInList.Info;
  6558.               Place := ListIter(PlaceInList.Next);
  6559.            end if;
  6560.        end Next;
  6561.      
  6562.     --------------------------------------------------------------------------
  6563.      
  6564.        procedure ReplaceHead (L:    in out  List;
  6565.                               Info: in      Tree ) is
  6566.      
  6567.        --| This procedure replaces the information at the head of a list
  6568.        --| with the given information. If the list is empty the exception
  6569.        --| EmptyList is raised.
  6570.      
  6571.        begin
  6572.            if L = null then
  6573.                raise EmptyList;
  6574.            else
  6575.                L.Info := Info;
  6576.            end if;
  6577.        end ReplaceHead;
  6578.      
  6579.     --------------------------------------------------------------------------
  6580.      
  6581.        procedure ReplaceTail (L:        in out List;
  6582.                               NewTail:  in     List  ) is
  6583.            Temp_L: List;
  6584.      
  6585.        --| This destroys the tail of a list and replaces the tail with
  6586.        --| NewTail.  If L is empty EmptyList is raised.
  6587.      
  6588.        begin
  6589.            Destroy(L.Next);
  6590.            L.Next := NewTail;
  6591.        exception
  6592.            when constraint_error =>
  6593.                raise EmptyList;
  6594.        end ReplaceTail;
  6595.      
  6596.     --------------------------------------------------------------------------
  6597.      
  6598.         function Tail (L: in    List) return List is
  6599.      
  6600.         --| This returns the list which is the tail of L.  If L is null Empty
  6601.         --| List is raised.
  6602.      
  6603.         begin
  6604.             if L = null then
  6605.                 raise EmptyList;
  6606.             else
  6607.                 return L.Next;
  6608.             end if;
  6609.         end Tail;
  6610.      
  6611.     --------------------------------------------------------------------------
  6612.         function Equal (List1: in    List;
  6613.                         List2: in    List ) return boolean is
  6614.      
  6615.             PlaceInList1: List;
  6616.             PlaceInList2: List;
  6617.             Contents1:    Tree;
  6618.             Contents2:    Tree;
  6619.      
  6620.         --| This function tests to see if two lists are equal.  Two lists
  6621.         --| are equal if for all the elements of List1 the corresponding
  6622.         --| element of List2 has the same value.  Thus if the 1st elements
  6623.         --| are equal and the second elements are equal and so up to n.
  6624.         --|  Thus a necessary condition for two lists to be equal is that
  6625.         --| they have the same number of elements.
  6626.      
  6627.      
  6628.         --| This function walks over the two list and checks that the
  6629.         --| corresponding elements are equal.  As soon as we reach
  6630.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  6631.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  6632.         --| then the lists are equal.  If they both are not null the lists aren't
  6633.         --| equal.  Note that equality on elements is based on a user supplied
  6634.         --| function Equal which is used to test for item equality.
  6635.      
  6636.         begin
  6637.             PlaceInList1 := List1;
  6638.             PlaceInList2 := List2;
  6639.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  6640.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  6641.                     return false;
  6642.                 end if;
  6643.                 PlaceInList1 := PlaceInList1.Next;
  6644.                 PlaceInList2 := PlaceInList2.Next;
  6645.             end loop;
  6646.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  6647.         end Equal;
  6648.     end NodeOrder;
  6649.      
  6650.     --------------------------------------------------------------------------
  6651.      
  6652.     ----------------------------------------------------------------------------
  6653.     --                   Local Subprograms
  6654.     ----------------------------------------------------------------------------
  6655.      
  6656.     procedure Free is new unchecked_deallocation (Node, Tree);
  6657.      
  6658.     function equal (X, Y: in Member) return boolean is
  6659.      
  6660.     begin
  6661.      
  6662.         return (not (X < Y))  and  (not  (Y < X));
  6663.     end;
  6664.      
  6665.     ------------------------------------------------------------------------------
  6666.      
  6667.     function Generate (T :in Tree ) return  Nodeorder.List is
  6668.         L : Nodeorder.List;
  6669.      
  6670.     --| This routine generates a list of pointers to nodes in the tree t.
  6671.     --| The list is ordered with respect to the order of the nodes in the tree.
  6672.      
  6673.     --| generate does a depth first search of the tree.
  6674.     --| 1.   It first visits the leftchild of t and generates the list for that.
  6675.     --| 2.   It then appends the root node of t to the list generated for the left
  6676.     --|      child.
  6677.     --| 3.   It then appends the list generated for the rightchild to the list
  6678.     --|      generated for the leftchild and the root.
  6679.     --|
  6680.      
  6681.     begin
  6682.         L := NodeOrder.Create;
  6683.         if T /= null then
  6684.            L := Generate (T.Leftchild);
  6685.            Nodeorder.Attach (L, T);
  6686.            Nodeorder.Attach (L, Generate (T.Rightchild));
  6687.         end if;
  6688.         return L;
  6689.     End Generate;
  6690.      
  6691.     ------------------------------------------------------------------------------
  6692.      
  6693.      
  6694.      
  6695.     ------------------------------------------------------------------------------
  6696.     --                    Visible Subprograms
  6697.     ------------------------------------------------------------------------------
  6698.      
  6699.      
  6700.      
  6701.      
  6702.      
  6703.     ------------------------------------------------------------------------------
  6704.      
  6705.     function Create  return Tree is
  6706.      
  6707.     begin
  6708.         return null;
  6709.     end;
  6710.      
  6711.     -----------------------------------------------------------------------------
  6712.      
  6713.     procedure Deposit (
  6714.               I :in      Member;
  6715.               S :in      Tree         ) is
  6716.      
  6717.     begin
  6718.         S.Info := I;
  6719.     end;
  6720.      
  6721.     ------------------------------------------------------------------------------
  6722.      
  6723.     procedure DestroyTree ( T :in out Tree) is
  6724.      
  6725.     --| This procedure recursively destroys the tree T.
  6726.     --|  1.  It destroy the leftchild of T
  6727.     --|  2.  It then destroys the rightchild of T.
  6728.     --|  3.  It then destroy the root T and set T to be null.
  6729.      
  6730.     begin
  6731.         if T /= null then
  6732.             DestroyTree (T.leftchild);
  6733.             DestroyTree (T.rightchild);
  6734.             Free (T);
  6735.         end if;
  6736.     end DestroyTree;
  6737.      
  6738.     ------------------------------------------------------------------------------
  6739.      
  6740.     procedure InsertNode (
  6741.             N           :in out Member;    --| Node being inserted.
  6742.             T           :in out Tree;        --| Tree node is being inserted
  6743.                                              --| into.
  6744.             Root        :   out Tree;        --| Root of the subtree which node N
  6745.                                              --| heads.  This is the position of
  6746.                                              --| node N in T;
  6747.             Exists      :   out boolean      --| If this node already exists in
  6748.                                              --| the tree then Exists is true. If
  6749.                                              --| If this is the first insertion
  6750.                                              --| Exists is false.
  6751.      
  6752.                                                                            ) is
  6753.     --| This inserts the node N in T.
  6754.     --| 1.  If T is null then a new node is allocated and assigned to T
  6755.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  6756.     --|     This is first done by checking whether N < rightchild
  6757.     --| 3.  If this is not true then we check to see if leftchild < N
  6758.     --| 4.  If this is not true then N is in the tree.
  6759.      
  6760.     begin
  6761.         if T = null then
  6762.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  6763.             Root := T;
  6764.             Exists := false;
  6765.             N := T.Info;
  6766.         elsif N < T.Info then
  6767.             InsertNode (N, T.leftchild, Root, Exists);
  6768.         elsif T.Info < N then
  6769.             InsertNode (N, T.rightchild, Root, Exists);
  6770.         else
  6771.             Root := T;
  6772.             Exists := true;
  6773.             N := T.Info;
  6774.      
  6775.         end if;
  6776.     end InsertNode;
  6777.      
  6778.     ------------------------------------------------------------------------------
  6779.      
  6780.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  6781.      
  6782.         I :TreeIter;
  6783.     --| This sets up the iterator for a tree T.
  6784.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  6785.     --| is computed by first invoking Generate of the leftchild then append
  6786.     --| the root node to NodeList and then append the result of Generate
  6787.     --| to NodeList.  Since the tree is ordered such that
  6788.     --|
  6789.     --|    leftchild < root    root < rightchild
  6790.     --|
  6791.     --| NodeOrder returns the nodes in ascending order.
  6792.     --|
  6793.     --| Thus NodeList keeps the list alive for the duration of the iteration
  6794.     --| operation.  The variable State is the a pointer into the NodeList
  6795.     --| which is the current place of the iteration.
  6796.      
  6797.     begin
  6798.         I.NodeList := NodeOrder.Create;
  6799.         if T /= null then
  6800.             I.NodeList := Generate (T.leftchild);
  6801.             NodeOrder.Attach (I.NodeList, T);
  6802.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  6803.         end if;
  6804.         I.State := NodeOrder.MakeListIter (I.NodeList);
  6805.         return I;
  6806.     end;
  6807.      
  6808.     ------------------------------------------------------------------------------
  6809.      
  6810.     function More (I :in TreeIter) return boolean is
  6811.      
  6812.     begin
  6813.         return NodeOrder.More (I.State);
  6814.     end;
  6815.      
  6816.     ------------------------------------------------------------------------------
  6817.      
  6818.     procedure Next (
  6819.               I    :in out TreeIter;
  6820.               Info :   out Member       ) is
  6821.       T: Tree;
  6822.      
  6823.     --| Next returns the information at the current position in the iterator
  6824.     --| and increments the iterator.  This is accomplished by using the iterater
  6825.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  6826.     --| and then the information found at this node in T is returned.
  6827.      
  6828.      
  6829.     begin
  6830.         NodeOrder.Next (I.State, T);
  6831.         Info := T.Info;
  6832.     end;
  6833.      
  6834.     -------------------------------------------------------------------------------
  6835.      
  6836.     end TreePkg;
  6837.      
  6838.      
  6839.     -------------------------------------------------------------------------------
  6840.     --                Local Subprograms
  6841.     -------------------------------------------------------------------------------
  6842.      
  6843.     -------------------------------------------------------------------------------
  6844.      
  6845.     function "<" (     --| Implements "<" for the type member.
  6846.              X :in   Member;
  6847.              Y :in   Member
  6848.     ) return boolean is
  6849.      
  6850.     begin
  6851.          return X.Info < Y.Info;
  6852.     end;
  6853.      
  6854.     -------------------------------------------------------------------------------
  6855.      
  6856.      
  6857.     -------------------------------------------------------------------------------
  6858.     --               Visible Subprograms
  6859.     -------------------------------------------------------------------------------
  6860.      
  6861.      
  6862.     -------------------------------------------------------------------------------
  6863.      
  6864.     function Cardinality (
  6865.                   S :in Set  --| The set whose size is being computed.
  6866.     ) return natural is
  6867.      
  6868.         T        :TreePkg.TreeIter;
  6869.         M        :Member;
  6870.         count    :natural := 0;
  6871.     begin
  6872.         T := TreePkg.MakeTreeIter (S.SetRep);
  6873.         while TreePkg.More (T) loop
  6874.             TreePkg.Next (T, M);
  6875.             count := count + 1;
  6876.         end loop;
  6877.         return count;
  6878.     end Cardinality;
  6879.      
  6880.     -------------------------------------------------------------------------------
  6881.      
  6882.     function Create
  6883.      
  6884.     return Set is
  6885.         S :Set;
  6886.     begin
  6887.         S.SetRep := TreePkg.Create;
  6888.         return S;
  6889.     end Create;
  6890.      
  6891.     ------------------------------------------------------------------------------
  6892.      
  6893.     procedure Destroy (
  6894.              S :in out Set
  6895.     ) is
  6896.      
  6897.     begin
  6898.         TreePkg.DestroyTree (S.SetRep);
  6899.     end Destroy;
  6900.      
  6901.     -----------------------------------------------------------------------------
  6902.      
  6903.     function GetCount (
  6904.              I :in    SetIter
  6905.     ) return natural is
  6906.      
  6907.     begin
  6908.          return I.Count;
  6909.     end;
  6910.      
  6911.     -----------------------------------------------------------------------------
  6912.     procedure Insert(
  6913.               M :in     Source_Text.Locator;
  6914.               S :in out Set
  6915.     ) is
  6916.         Subtree       :TreePkg.Tree;
  6917.         Exists        :boolean;
  6918.         MemberToEnter :Member := ( Info => M, count => 1);
  6919.     begin
  6920.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  6921.         --| Exists comes back true and then M's count is updated.  Since the
  6922.         --| first argument of TreePkg.Insert is in out, after Insert
  6923.         --| MemberToEnter has the value stored in the tree.  Thus if we
  6924.         --| need to update the count we can simple bump the count in MemberToEnter.
  6925.      
  6926.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  6927.         if Exists then
  6928.             MemberToEnter.Count := MemberToEnter.Count + 1;
  6929.             TreePkg.Deposit (MemberToEnter, SubTree);
  6930.         end if;
  6931.     end Insert;
  6932.      
  6933.     ------------------------------------------------------------------------------
  6934.      
  6935.     function MakeSetIter (
  6936.              S :in Set
  6937.     )        return SetIter is
  6938.      
  6939.         I :SetIter;
  6940.     begin
  6941.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  6942.         I.Count := 0;
  6943.         return I;
  6944.     end;
  6945.      
  6946.      ------------------------------------------------------------------------------
  6947.      
  6948.     function More (
  6949.               I :in     SetIter
  6950.     )         return boolean is
  6951.      
  6952.     begin
  6953.         return TreePkg.More (I.Place);
  6954.     end;
  6955.      
  6956.     ------------------------------------------------------------------------------
  6957.      
  6958.     procedure Next (
  6959.              I :in out SetIter;
  6960.              M :   out Source_Text.Locator
  6961.     ) is
  6962.         TempMember :Member;
  6963.     begin
  6964.         TreePkg.Next (I.Place, TempMember);
  6965.         M := TempMember.Info;
  6966.         I.Count := TempMember.Count;
  6967.     end;
  6968.      
  6969.     ------------------------------------------------------------------------------
  6970.      
  6971.     end Literal_Set;
  6972.      
  6973.      
  6974.      
  6975.      
  6976.      
  6977.      
  6978.     package body DEF_ID_Set is
  6979.      
  6980.     ------------------------------------------------------------------------------
  6981.     --                Nested Private Definitions
  6982.     -------------------------------------------------------------------------------
  6983.      
  6984.      
  6985.     package body TreePkg is
  6986.     ---------------------------------------------------------------------------
  6987.     --                   Nested Private Definitions
  6988.     ---------------------------------------------------------------------------
  6989.      
  6990.      
  6991.      
  6992.     package body NodeOrder is
  6993.      
  6994.         procedure Free is new unchecked_deallocation (Cell, List);
  6995.      
  6996.     --------------------------------------------------------------------------
  6997.      
  6998.        function Last (L: in     List) return List is
  6999.      
  7000.            Place_In_L:        List;
  7001.            Temp_Place_In_L:   List;
  7002.      
  7003.        --|  Link down the list L and return the pointer to the last element
  7004.        --| of L.  If L is null raise the EmptyList exception.
  7005.      
  7006.        begin
  7007.            if L = null then
  7008.                raise EmptyList;
  7009.            else
  7010.      
  7011.                --|  Link down L saving the pointer to the previous element in
  7012.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  7013.                --|  points to the last element in the list.
  7014.      
  7015.                Place_In_L := L;
  7016.                while Place_In_L /= null loop
  7017.                    Temp_Place_In_L := Place_In_L;
  7018.                    Place_In_L := Place_In_L.Next;
  7019.                end loop;
  7020.                return Temp_Place_In_L;
  7021.            end if;
  7022.         end Last;
  7023.      
  7024.      
  7025.     --------------------------------------------------------------------------
  7026.      
  7027.         procedure Attach (List1: in out List;
  7028.                           List2: in     List ) is
  7029.             EndOfList1: List;
  7030.      
  7031.         --| Attach List2 to List1.
  7032.         --| If List1 is null return List2
  7033.         --| If List1 equals List2 then raise CircularList
  7034.         --| Otherwise get the pointer to the last element of List1 and change
  7035.         --| its Next field to be List2.
  7036.      
  7037.         begin
  7038.             if List1 = null then
  7039.                 List1 := List2;
  7040.                 return;
  7041.             elsif List1 = List2 then
  7042.                 raise CircularList;
  7043.             else
  7044.                 EndOfList1 := Last (List1);
  7045.                 EndOfList1.Next := List2;
  7046.             end if;
  7047.         end Attach;
  7048.      
  7049.     --------------------------------------------------------------------------
  7050.      
  7051.        procedure Attach (L:       in out List;
  7052.                          Element: in     Tree ) is
  7053.      
  7054.            NewEnd:    List;
  7055.      
  7056.        --| Create a list containing Element and attach it to the end of L
  7057.      
  7058.        begin
  7059.            NewEnd := new Cell'(Info => Element, Next => null);
  7060.            Attach (L, NewEnd);
  7061.        end;
  7062.      
  7063.     --------------------------------------------------------------------------
  7064.      
  7065.        function Attach (Element1: in   Tree;
  7066.                         Element2: in   Tree ) return List is
  7067.            NewList: List;
  7068.      
  7069.        --| Create a new list containing the information in Element1 and
  7070.        --| attach Element2 to that list.
  7071.      
  7072.        begin
  7073.            NewList := new Cell'(Info => Element1, Next => null);
  7074.            Attach (NewList, Element2);
  7075.            return NewList;
  7076.        end;
  7077.      
  7078.     --------------------------------------------------------------------------
  7079.      
  7080.        procedure Attach (Element: in     Tree;
  7081.                          L:       in out List      ) is
  7082.      
  7083.        --|  Create a new cell whose information is Element and whose Next
  7084.        --|  field is the list L.  This prepends Element to the List L.
  7085.      
  7086.        begin
  7087.            L := new Cell'(Info => Element, Next => L);
  7088.        end;
  7089.      
  7090.     --------------------------------------------------------------------------
  7091.      
  7092.        function Attach ( List1: in    List;
  7093.                          List2: in    List   ) return List is
  7094.      
  7095.        Last_Of_List1: List;
  7096.      
  7097.        begin
  7098.            if List1 = null then
  7099.                return List2;
  7100.            elsif List1 = List2 then
  7101.                raise CircularList;
  7102.            else
  7103.                Last_Of_List1 := Last (List1);
  7104.                Last_Of_List1.Next := List2;
  7105.                return List1;
  7106.            end if;
  7107.        end  Attach;
  7108.      
  7109.     -------------------------------------------------------------------------
  7110.      
  7111.        function Attach( L:       in     List;
  7112.                         Element: in     Tree ) return List is
  7113.      
  7114.        NewEnd: List;
  7115.        Last_Of_L: List;
  7116.      
  7117.        --| Create a list called NewEnd and attach it to the end of L.
  7118.        --| If L is null return NewEnd
  7119.        --| Otherwise get the last element in L and make its Next field
  7120.        --| NewEnd.
  7121.      
  7122.        begin
  7123.            NewEnd := new Cell'(Info => Element, Next => null);
  7124.            if L = null then
  7125.                return NewEnd;
  7126.            else
  7127.                Last_Of_L := Last (L);
  7128.                Last_Of_L.Next := NewEnd;
  7129.                return L;
  7130.            end if;
  7131.        end Attach;
  7132.      
  7133.     --------------------------------------------------------------------------
  7134.      
  7135.        function Attach (Element: in     Tree;
  7136.                         L:       in     List        ) return List is
  7137.      
  7138.        begin
  7139.            return (new Cell'(Info => Element, Next => L));
  7140.        end Attach;
  7141.      
  7142.     --------------------------------------------------------------------------
  7143.      
  7144.        function Copy (L: in     List) return List is
  7145.      
  7146.        --| If L is null return null
  7147.        --| Otherwise recursively copy the list by first copying the information
  7148.        --| at the head of the list and then making the Next field point to
  7149.        --| a copy of the tail of the list.
  7150.      
  7151.        begin
  7152.            if L = null then
  7153.                return null;
  7154.            else
  7155.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  7156.            end if;
  7157.        end Copy;
  7158.      
  7159.      
  7160.     --------------------------------------------------------------------------
  7161.      
  7162.         function Create return List is
  7163.      
  7164.         --| Return the empty list.
  7165.      
  7166.         begin
  7167.             return null;
  7168.         end Create;
  7169.      
  7170.     --------------------------------------------------------------------------
  7171.      
  7172.        procedure DeleteHead (L: in out List) is
  7173.      
  7174.            TempList: List;
  7175.      
  7176.        --| Remove the element of the head of the list and return it to the heap.
  7177.        --| If L is null EmptyList.
  7178.        --| Otherwise save the Next field of the first element, remove the first
  7179.        --| element and then assign to L the Next field of the first element.
  7180.      
  7181.        begin
  7182.            if L = null then
  7183.                raise EmptyList;
  7184.            else
  7185.                TempList := L.Next;
  7186.                Free (L);
  7187.                L := TempList;
  7188.            end if;
  7189.        end DeleteHead;
  7190.      
  7191.     --------------------------------------------------------------------------
  7192.      
  7193.        procedure DeleteItem (L:       in out List;
  7194.                              Element: in     Tree ) is
  7195.      
  7196.            Temp_L  :List;
  7197.      
  7198.        --| Remove the first element in the list with the value Element.
  7199.        --| If the first element of the list is equal to element then
  7200.        --| remove it.  Otherwise, recurse on the tail of the list.
  7201.      
  7202.        begin
  7203.            if L.Info = Element then
  7204.                DeleteHead(L);
  7205.            else
  7206.                DeleteItem(L.Next, Element);
  7207.            end if;
  7208.        exception
  7209.            when constraint_error =>
  7210.                raise ItemNotPresent;
  7211.        end DeleteItem;
  7212.      
  7213.     --------------------------------------------------------------------------
  7214.      
  7215.        procedure DeleteItems (L:       in out List;
  7216.                               Element: in     Tree ) is
  7217.      
  7218.            Place_In_L       :List;     --| Current place in L.
  7219.            Last_Place_In_L  :List;     --| Last place in L.
  7220.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  7221.            Found            :boolean := false;  --| Indicates if an element with
  7222.                                                 --| the correct value was found.
  7223.      
  7224.        --| Walk over the list removing all elements with the value Element.
  7225.      
  7226.        begin
  7227.            Place_In_L := L;
  7228.            Last_Place_In_L := null;
  7229.            while (Place_In_L /= null) loop
  7230.      
  7231.                --| Found an element equal to Element
  7232.      
  7233.                if Place_In_L.Info = Element then
  7234.                     Found := true;
  7235.      
  7236.                     --| If Last_Place_In_L is null then we are at first element
  7237.                     --| in L.
  7238.      
  7239.                     if Last_Place_In_L = null then
  7240.                          Temp_Place_In_L := Place_In_L;
  7241.                          L := Place_In_L.Next;
  7242.                     else
  7243.                          Temp_Place_In_L := Place_In_L;
  7244.      
  7245.                          --| Relink the list Last's Next gets Place's Next
  7246.      
  7247.                          Last_Place_In_L.Next := Place_In_L.Next;
  7248.                     end if;
  7249.      
  7250.                     --| Move Place_In_L to the next position in the list.
  7251.                     --| Free the element.
  7252.                     --| Do not update the last element in the list it remains the
  7253.                     --| same.
  7254.      
  7255.                     Place_In_L := Place_In_L.Next;
  7256.                     Free (Temp_Place_In_L);
  7257.                else
  7258.                     --| Update the last place in L and the place in L.
  7259.      
  7260.                     Last_Place_In_L := Place_In_L;
  7261.                     Place_In_L := Place_In_L.Next;
  7262.                end if;
  7263.            end loop;
  7264.      
  7265.        --| If we have not found an element raise an exception.
  7266.      
  7267.        if not Found then
  7268.           raise ItemNotPresent;
  7269.        end if;
  7270.      
  7271.        end DeleteItems;
  7272.      
  7273.     --------------------------------------------------------------------------
  7274.      
  7275.        procedure Destroy (L: in out List) is
  7276.      
  7277.            Place_In_L:  List;
  7278.            HoldPlace:   List;
  7279.      
  7280.        --| Walk down the list removing all the elements and set the list to
  7281.        --| the empty list.
  7282.      
  7283.        begin
  7284.            Place_In_L := L;
  7285.            while Place_In_L /= null loop
  7286.                HoldPlace := Place_In_L;
  7287.                Place_In_L := Place_In_L.Next;
  7288.                Free (HoldPlace);
  7289.            end loop;
  7290.            L := null;
  7291.        end Destroy;
  7292.      
  7293.     --------------------------------------------------------------------------
  7294.      
  7295.        function FirstValue (L: in    List) return Tree is
  7296.      
  7297.        --| Return the first value in the list.
  7298.      
  7299.        begin
  7300.            if L = null then
  7301.                raise EmptyList;
  7302.            else
  7303.                return (L.Info);
  7304.            end if;
  7305.        end FirstValue;
  7306.      
  7307.     --------------------------------------------------------------------------
  7308.      
  7309.        procedure Forword (I: in out ListIter) is
  7310.      
  7311.        --| Return the pointer to the next member of the list.
  7312.            Temp_L :List;
  7313.        begin
  7314.            Temp_L := List (I);
  7315.            I := ListIter (Temp_L.Next);
  7316.        end Forword;
  7317.      
  7318.     --------------------------------------------------------------------------
  7319.      
  7320.        function IsInList (L:       in    List;
  7321.                           Element: in    Tree  ) return boolean is
  7322.      
  7323.        Place_In_L: List;
  7324.      
  7325.        --| Check if Element is in L.  If it is return true otherwise return false.
  7326.      
  7327.        begin
  7328.            Place_In_L := L;
  7329.            while Place_In_L /= null loop
  7330.                if Place_In_L.Info = Element then
  7331.                    return true;
  7332.                end if;
  7333.                Place_In_L := Place_In_L.Next;
  7334.             end loop;
  7335.             return false;
  7336.        end IsInList;
  7337.      
  7338.     --------------------------------------------------------------------------
  7339.      
  7340.         function IsEmpty (L: in     List) return boolean is
  7341.      
  7342.         --| Is the list L empty.
  7343.      
  7344.         begin
  7345.             return (L = null);
  7346.         end IsEmpty;
  7347.      
  7348.     --------------------------------------------------------------------------
  7349.      
  7350.        function LastValue (L: in     List) return Tree is
  7351.      
  7352.            LastElement: List;
  7353.      
  7354.        --| Return the value of the last element of the list. Get the pointer
  7355.        --| to the last element of L and then return its information.
  7356.      
  7357.        begin
  7358.            LastElement := Last (L);
  7359.            return LastElement.Info;
  7360.        end LastValue;
  7361.      
  7362.     --------------------------------------------------------------------------
  7363.      
  7364.        function Length (L: in     List) return integer is
  7365.      
  7366.        --| Recursively compute the length of L.  The length of a list is
  7367.        --| 0 if it is null or  1 + the length of the tail.
  7368.      
  7369.        begin
  7370.            if L = null then
  7371.                return (0);
  7372.            else
  7373.                return (1 + Length (Tail (L)));
  7374.            end if;
  7375.        end Length;
  7376.      
  7377.     --------------------------------------------------------------------------
  7378.      
  7379.        function MakeListIter (L: in     List) return ListIter is
  7380.      
  7381.        --| Start an iteration operation on the list L.  Do a type conversion
  7382.        --| from List to ListIter.
  7383.      
  7384.        begin
  7385.            return ListIter (L);
  7386.        end MakeListIter;
  7387.      
  7388.     --------------------------------------------------------------------------
  7389.      
  7390.        function More (L: in     ListIter) return boolean is
  7391.      
  7392.        --| This is a test to see whether an iteration is complete.
  7393.      
  7394.        begin
  7395.            return L /= null;
  7396.        end;
  7397.      
  7398.     --------------------------------------------------------------------------
  7399.      
  7400.        procedure Next (Place:   in out ListIter;
  7401.                        Info:       out Tree ) is
  7402.            PlaceInList: List;
  7403.      
  7404.        --| This procedure gets the information at the current place in the List
  7405.        --| and moves the ListIter to the next postion in the list.
  7406.        --| If we are at the end of a list then exception NoMore is raised.
  7407.      
  7408.        begin
  7409.            if Place = null then
  7410.               raise NoMore;
  7411.            else
  7412.               PlaceInList := List(Place);
  7413.               Info := PlaceInList.Info;
  7414.               Place := ListIter(PlaceInList.Next);
  7415.            end if;
  7416.        end Next;
  7417.      
  7418.     --------------------------------------------------------------------------
  7419.      
  7420.        procedure ReplaceHead (L:    in out  List;
  7421.                               Info: in      Tree ) is
  7422.      
  7423.        --| This procedure replaces the information at the head of a list
  7424.        --| with the given information. If the list is empty the exception
  7425.        --| EmptyList is raised.
  7426.      
  7427.        begin
  7428.            if L = null then
  7429.                raise EmptyList;
  7430.            else
  7431.                L.Info := Info;
  7432.            end if;
  7433.        end ReplaceHead;
  7434.      
  7435.     --------------------------------------------------------------------------
  7436.      
  7437.        procedure ReplaceTail (L:        in out List;
  7438.                               NewTail:  in     List  ) is
  7439.            Temp_L: List;
  7440.      
  7441.        --| This destroys the tail of a list and replaces the tail with
  7442.        --| NewTail.  If L is empty EmptyList is raised.
  7443.      
  7444.        begin
  7445.            Destroy(L.Next);
  7446.            L.Next := NewTail;
  7447.        exception
  7448.            when constraint_error =>
  7449.                raise EmptyList;
  7450.        end ReplaceTail;
  7451.      
  7452.     --------------------------------------------------------------------------
  7453.      
  7454.         function Tail (L: in    List) return List is
  7455.      
  7456.         --| This returns the list which is the tail of L.  If L is null Empty
  7457.         --| List is raised.
  7458.      
  7459.         begin
  7460.             if L = null then
  7461.                 raise EmptyList;
  7462.             else
  7463.                 return L.Next;
  7464.             end if;
  7465.         end Tail;
  7466.      
  7467.     --------------------------------------------------------------------------
  7468.         function Equal (List1: in    List;
  7469.                         List2: in    List ) return boolean is
  7470.      
  7471.             PlaceInList1: List;
  7472.             PlaceInList2: List;
  7473.             Contents1:    Tree;
  7474.             Contents2:    Tree;
  7475.      
  7476.         --| This function tests to see if two lists are equal.  Two lists
  7477.         --| are equal if for all the elements of List1 the corresponding
  7478.         --| element of List2 has the same value.  Thus if the 1st elements
  7479.         --| are equal and the second elements are equal and so up to n.
  7480.         --|  Thus a necessary condition for two lists to be equal is that
  7481.         --| they have the same number of elements.
  7482.      
  7483.      
  7484.         --| This function walks over the two list and checks that the
  7485.         --| corresponding elements are equal.  As soon as we reach
  7486.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  7487.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  7488.         --| then the lists are equal.  If they both are not null the lists aren't
  7489.         --| equal.  Note that equality on elements is based on a user supplied
  7490.         --| function Equal which is used to test for item equality.
  7491.      
  7492.         begin
  7493.             PlaceInList1 := List1;
  7494.             PlaceInList2 := List2;
  7495.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  7496.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  7497.                     return false;
  7498.                 end if;
  7499.                 PlaceInList1 := PlaceInList1.Next;
  7500.                 PlaceInList2 := PlaceInList2.Next;
  7501.             end loop;
  7502.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  7503.         end Equal;
  7504.     end NodeOrder;
  7505.      
  7506.     --------------------------------------------------------------------------
  7507.      
  7508.     ----------------------------------------------------------------------------
  7509.     --                   Local Subprograms
  7510.     ----------------------------------------------------------------------------
  7511.      
  7512.     procedure Free is new unchecked_deallocation (Node, Tree);
  7513.      
  7514.     function equal (X, Y: in Member) return boolean is
  7515.      
  7516.     begin
  7517.      
  7518.         return (not (X < Y))  and  (not  (Y < X));
  7519.     end;
  7520.      
  7521.     ------------------------------------------------------------------------------
  7522.      
  7523.     function Generate (T :in Tree ) return  Nodeorder.List is
  7524.         L : Nodeorder.List;
  7525.      
  7526.     --| This routine generates a list of pointers to nodes in the tree t.
  7527.     --| The list is ordered with respect to the order of the nodes in the tree.
  7528.      
  7529.     --| generate does a depth first search of the tree.
  7530.     --| 1.   It first visits the leftchild of t and generates the list for that.
  7531.     --| 2.   It then appends the root node of t to the list generated for the left
  7532.     --|      child.
  7533.     --| 3.   It then appends the list generated for the rightchild to the list
  7534.     --|      generated for the leftchild and the root.
  7535.     --|
  7536.      
  7537.     begin
  7538.         L := NodeOrder.Create;
  7539.         if T /= null then
  7540.            L := Generate (T.Leftchild);
  7541.            Nodeorder.Attach (L, T);
  7542.            Nodeorder.Attach (L, Generate (T.Rightchild));
  7543.         end if;
  7544.         return L;
  7545.     end Generate;
  7546.      
  7547.     ------------------------------------------------------------------------------
  7548.      
  7549.      
  7550.      
  7551.     ------------------------------------------------------------------------------
  7552.     --                    Visible Subprograms
  7553.     ------------------------------------------------------------------------------
  7554.      
  7555.      
  7556.      
  7557.      
  7558.      
  7559.     ------------------------------------------------------------------------------
  7560.      
  7561.     function Create  return Tree is
  7562.      
  7563.     begin
  7564.         return null;
  7565.     end;
  7566.      
  7567.     -----------------------------------------------------------------------------
  7568.      
  7569.     procedure Deposit (
  7570.               I :in      Member;
  7571.               S :in      Tree         ) is
  7572.      
  7573.     begin
  7574.         S.Info := I;
  7575.     end;
  7576.      
  7577.     ------------------------------------------------------------------------------
  7578.      
  7579.     procedure DestroyTree ( T :in out Tree) is
  7580.      
  7581.     --| This procedure recursively destroys the tree T.
  7582.     --|  1.  It destroy the leftchild of T
  7583.     --|  2.  It then destroys the rightchild of T.
  7584.     --|  3.  It then destroy the root T and set T to be null.
  7585.      
  7586.     begin
  7587.         if T /= null then
  7588.             DestroyTree (T.leftchild);
  7589.             DestroyTree (T.rightchild);
  7590.             Free (T);
  7591.         end if;
  7592.     end DestroyTree;
  7593.      
  7594.     ------------------------------------------------------------------------------
  7595.      
  7596.     procedure InsertNode (
  7597.             N           :in out Member;    --| Node being inserted.
  7598.             T           :in out Tree;        --| Tree node is being inserted
  7599.                                              --| into.
  7600.             Root        :   out Tree;        --| Root of the subtree which node N
  7601.                                              --| heads.  This is the position of
  7602.                                              --| node N in T;
  7603.             Exists      :   out boolean      --| If this node already exists in
  7604.                                              --| the tree then Exists is true. If
  7605.                                              --| If this is the first insertion
  7606.                                              --| Exists is false.
  7607.      
  7608.                                                                            ) is
  7609.     --| This inserts the node N in T.
  7610.     --| 1.  If T is null then a new node is allocated and assigned to T
  7611.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  7612.     --|     This is first done by checking whether N < rightchild
  7613.     --| 3.  If this is not true then we check to see if leftchild < N
  7614.     --| 4.  If this is not true then N is in the tree.
  7615.      
  7616.     begin
  7617.         if T = null then
  7618.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  7619.             Root := T;
  7620.             Exists := false;
  7621.             N := T.Info;
  7622.         elsif N < T.Info then
  7623.             InsertNode (N, T.leftchild, Root, Exists);
  7624.         elsif T.Info < N then
  7625.             InsertNode (N, T.rightchild, Root, Exists);
  7626.         else
  7627.             Root := T;
  7628.             Exists := true;
  7629.             N := T.Info;
  7630.      
  7631.         end if;
  7632.     end InsertNode;
  7633.      
  7634.     ------------------------------------------------------------------------------
  7635.      
  7636.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  7637.      
  7638.         I :TreeIter;
  7639.     --| This sets up the iterator for a tree T.
  7640.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  7641.     --| is computed by first invoking Generate of the leftchild then append
  7642.     --| the root node to NodeList and then append the result of Generate
  7643.     --| to NodeList.  Since the tree is ordered such that
  7644.     --|
  7645.     --|    leftchild < root    root < rightchild
  7646.     --|
  7647.     --| NodeOrder returns the nodes in ascending order.
  7648.     --|
  7649.     --| Thus NodeList keeps the list alive for the duration of the iteration
  7650.     --| operation.  The variable State is the a pointer into the NodeList
  7651.     --| which is the current place of the iteration.
  7652.      
  7653.     begin
  7654.         I.NodeList := NodeOrder.Create;
  7655.         if T /= null then
  7656.             I.NodeList := Generate (T.leftchild);
  7657.             NodeOrder.Attach (I.NodeList, T);
  7658.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  7659.         end if;
  7660.         I.State := NodeOrder.MakeListIter (I.NodeList);
  7661.         return I;
  7662.     end;
  7663.      
  7664.     ------------------------------------------------------------------------------
  7665.      
  7666.     function More (I :in TreeIter) return boolean is
  7667.      
  7668.     begin
  7669.         return NodeOrder.More (I.State);
  7670.     end;
  7671.      
  7672.     ------------------------------------------------------------------------------
  7673.      
  7674.     procedure Next (
  7675.               I    :in out TreeIter;
  7676.               Info :   out Member       ) is
  7677.       T: Tree;
  7678.      
  7679.     --| Next returns the information at the current position in the iterator
  7680.     --| and increments the iterator.  This is accomplished by using the iterater
  7681.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  7682.     --| and then the information found at this node in T is returned.
  7683.      
  7684.      
  7685.     begin
  7686.         NodeOrder.Next (I.State, T);
  7687.         Info := T.Info;
  7688.     end;
  7689.      
  7690.     -------------------------------------------------------------------------------
  7691.      
  7692.     end TreePkg;
  7693.      
  7694.      
  7695.     -------------------------------------------------------------------------------
  7696.     --                Local Subprograms
  7697.     -------------------------------------------------------------------------------
  7698.      
  7699.     -------------------------------------------------------------------------------
  7700.      
  7701.     function "<" (     --| Implements "<" for the type member.
  7702.              X :in   Member;
  7703.              Y :in   Member
  7704.     ) return boolean is
  7705.      
  7706.     begin
  7707.          return X.Info < Y.Info;
  7708.     end;
  7709.      
  7710.     -------------------------------------------------------------------------------
  7711.      
  7712.      
  7713.     -------------------------------------------------------------------------------
  7714.     --               Visible Subprograms
  7715.     -------------------------------------------------------------------------------
  7716.      
  7717.      
  7718.     -------------------------------------------------------------------------------
  7719.      
  7720.     function Cardinality (
  7721.                   S :in Set  --| The set whose size is being computed.
  7722.     ) return natural is
  7723.      
  7724.         T        :TreePkg.TreeIter;
  7725.         M        :Member;
  7726.         count    :natural := 0;
  7727.     begin
  7728.         T := TreePkg.MakeTreeIter (S.SetRep);
  7729.         while TreePkg.More (T) loop
  7730.             TreePkg.Next (T, M);
  7731.             count := count + 1;
  7732.         end loop;
  7733.         return count;
  7734.     end Cardinality;
  7735.      
  7736.     -------------------------------------------------------------------------------
  7737.      
  7738.     function Create
  7739.      
  7740.     return Set is
  7741.         S :Set;
  7742.     begin
  7743.         S.SetRep := TreePkg.Create;
  7744.         return S;
  7745.     end Create;
  7746.      
  7747.     ------------------------------------------------------------------------------
  7748.      
  7749.     procedure Destroy (
  7750.              S :in out Set
  7751.     ) is
  7752.      
  7753.     begin
  7754.         TreePkg.DestroyTree (S.SetRep);
  7755.     end Destroy;
  7756.      
  7757.     -----------------------------------------------------------------------------
  7758.      
  7759.     function GetCount (
  7760.              I :in    SetIter
  7761.     ) return natural is
  7762.      
  7763.     begin
  7764.          return I.Count;
  7765.     end;
  7766.      
  7767.     -----------------------------------------------------------------------------
  7768.     procedure Insert(
  7769.               M :in     DEF_ID.Locator;
  7770.               S :in out Set
  7771.     ) is
  7772.         Subtree       :TreePkg.Tree;
  7773.         Exists        :boolean;
  7774.         MemberToEnter :Member := ( Info => M, count => 1);
  7775.     begin
  7776.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  7777.         --| Exists comes back true and then M's count is updated.  Since the
  7778.         --| first argument of TreePkg.Insert is in out, after Insert
  7779.         --| MemberToEnter has the value stored in the tree.  Thus if we
  7780.         --| need to update the count we can simple bump the count in MemberToEnter.
  7781.      
  7782.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  7783.         if Exists then
  7784.             MemberToEnter.Count := MemberToEnter.Count + 1;
  7785.             TreePkg.Deposit (MemberToEnter, SubTree);
  7786.         end if;
  7787.     end Insert;
  7788.      
  7789.     ------------------------------------------------------------------------------
  7790.      
  7791.     function MakeSetIter (
  7792.              S :in Set
  7793.     )        return SetIter is
  7794.      
  7795.         I :SetIter;
  7796.     begin
  7797.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  7798.         I.Count := 0;
  7799.         return I;
  7800.     end;
  7801.      
  7802.      ------------------------------------------------------------------------------
  7803.      
  7804.     function More (
  7805.               I :in     SetIter
  7806.     )         return boolean is
  7807.      
  7808.     begin
  7809.         return TreePkg.More (I.Place);
  7810.     end;
  7811.      
  7812.     ------------------------------------------------------------------------------
  7813.      
  7814.     procedure Next (
  7815.              I :in out SetIter;
  7816.              M :   out DEF_ID.Locator
  7817.     ) is
  7818.         TempMember :Member;
  7819.     begin
  7820.         TreePkg.Next (I.Place, TempMember);
  7821.         M := TempMember.Info;
  7822.         I.Count := TempMember.Count;
  7823.     end;
  7824.      
  7825.     ------------------------------------------------------------------------------
  7826.      
  7827.     end DEF_ID_Set;
  7828.      
  7829.      
  7830.      
  7831.      
  7832.      
  7833.     package body BlockInfoStack is
  7834.      
  7835.      
  7836.         use Lists;
  7837.      
  7838.      
  7839.      
  7840.         function create
  7841.             return stack is
  7842.         begin
  7843.             return new stack_rec'(size => 0, elts => create);
  7844.         end create;
  7845.      
  7846.         procedure push(s: in out stack;
  7847.                        e:        BlockInfoType) is
  7848.         begin
  7849.             s.size := s.size + 1;
  7850.             s.elts := attach(e, s.elts);
  7851.         exception
  7852.             when constraint_error =>
  7853.                 raise uninitialized_stack;
  7854.         end push;
  7855.      
  7856.         procedure pop(s: in out stack) is
  7857.         begin
  7858.             DeleteHead(s.elts);
  7859.             s.size := s.size - 1;
  7860.         exception
  7861.             when EmptyList =>
  7862.                 raise empty_stack;
  7863.             when constraint_error =>
  7864.                 raise uninitialized_stack;
  7865.         end pop;
  7866.      
  7867.         procedure pop(s: in out stack;
  7868.                       e: out    BlockInfoType) is
  7869.         begin
  7870.             e := FirstValue(s.elts);
  7871.             DeleteHead(s.elts);
  7872.             s.size := s.size - 1;
  7873.         exception
  7874.             when EmptyList =>
  7875.                 raise empty_stack;
  7876.             when constraint_error =>
  7877.                 raise uninitialized_stack;
  7878.         end pop;
  7879.      
  7880.         function copy(s: stack)
  7881.             return stack is
  7882.         begin
  7883.             if s = null then raise uninitialized_stack; end if;
  7884.      
  7885.             return new stack_rec'(size => s.size,
  7886.                                   elts => copy(s.elts));
  7887.         end;
  7888.      
  7889.      
  7890.      
  7891.         function top(s: stack)
  7892.             return BlockInfoType is
  7893.         begin
  7894.             return FirstValue(s.elts);
  7895.         exception
  7896.             when EmptyList =>
  7897.                 raise empty_stack;
  7898.             when constraint_error =>
  7899.                 raise uninitialized_stack;
  7900.         end top;
  7901.      
  7902.         function size(s: stack)
  7903.             return natural is
  7904.         begin
  7905.             return s.size;
  7906.         exception
  7907.             when constraint_error =>
  7908.                 raise uninitialized_stack;
  7909.         end size;
  7910.      
  7911.         function is_empty(s: stack)
  7912.             return boolean is
  7913.         begin
  7914.             return s.size = 0;
  7915.         exception
  7916.             when constraint_error =>
  7917.                 raise uninitialized_stack;
  7918.         end is_empty;
  7919.      
  7920.      
  7921.      
  7922.         procedure destroy(s: in out stack) is
  7923.             procedure free_stack is
  7924.                 new unchecked_deallocation(stack_rec, stack);
  7925.         begin
  7926.             destroy(s.elts);
  7927.             free_stack(s);
  7928.         exception
  7929.             when constraint_error =>    -- stack is null
  7930.                 return;
  7931.         end destroy;
  7932.      
  7933.         package body Lists is
  7934.      
  7935.             procedure Free is new unchecked_deallocation (Cell, List);
  7936.      
  7937.      
  7938.            function Last (L: in     List) return List is
  7939.      
  7940.                Place_In_L:        List;
  7941.                Temp_Place_In_L:   List;
  7942.      
  7943.      
  7944.            begin
  7945.                if L = null then
  7946.                    raise EmptyList;
  7947.                else
  7948.      
  7949.                    --|  Link down L saving the pointer to the previous element in
  7950.                    --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  7951.                    --|  points to the last element in the list.
  7952.      
  7953.                    Place_In_L := L;
  7954.                    while Place_In_L /= null loop
  7955.                        Temp_Place_In_L := Place_In_L;
  7956.                        Place_In_L := Place_In_L.Next;
  7957.                    end loop;
  7958.                    return Temp_Place_In_L;
  7959.                end if;
  7960.             end Last;
  7961.      
  7962.      
  7963.      
  7964.             procedure Attach (List1: in out List;
  7965.                               List2: in     List ) is
  7966.                 EndOfList1: List;
  7967.      
  7968.             --| Attach List2 to List1.
  7969.             --| If List1 is null return List2
  7970.             --| If List1 equals List2 then raise CircularList
  7971.             --| Otherwise get the pointer to the last element of List1 and change
  7972.             --| its Next field to be List2.
  7973.      
  7974.             begin
  7975.                 if List1 = null then
  7976.                     List1 := List2;
  7977.                     return;
  7978.                 elsif List1 = List2 then
  7979.                     raise CircularList;
  7980.                 else
  7981.                     EndOfList1 := Last (List1);
  7982.                     EndOfList1.Next := List2;
  7983.                 end if;
  7984.             end Attach;
  7985.      
  7986.      
  7987.            procedure Attach (L:       in out List;
  7988.                              Element: in     BlockInfoType ) is
  7989.      
  7990.                NewEnd:    List;
  7991.      
  7992.      
  7993.            begin
  7994.                NewEnd := new Cell'(Info => Element, Next => null);
  7995.                Attach (L, NewEnd);
  7996.            end;
  7997.      
  7998.      
  7999.            function Attach (Element1: in   BlockInfoType;
  8000.                             Element2: in   BlockInfoType ) return List is
  8001.                NewList: List;
  8002.      
  8003.      
  8004.            begin
  8005.                NewList := new Cell'(Info => Element1, Next => null);
  8006.                Attach (NewList, Element2);
  8007.                return NewList;
  8008.            end;
  8009.      
  8010.      
  8011.            procedure Attach (Element: in     BlockInfoType;
  8012.                              L:       in out List      ) is
  8013.      
  8014.      
  8015.            begin
  8016.                L := new Cell'(Info => Element, Next => L);
  8017.            end;
  8018.      
  8019.      
  8020.            function Attach ( List1: in    List;
  8021.                              List2: in    List   ) return List is
  8022.      
  8023.            Last_Of_List1: List;
  8024.      
  8025.            begin
  8026.                if List1 = null then
  8027.                    return List2;
  8028.                elsif List1 = List2 then
  8029.                    raise CircularList;
  8030.                else
  8031.                    Last_Of_List1 := Last (List1);
  8032.                    Last_Of_List1.Next := List2;
  8033.                    return List1;
  8034.                end if;
  8035.            end  Attach;
  8036.      
  8037.      
  8038.            function Attach( L:       in     List;
  8039.                             Element: in     BlockInfoType ) return List is
  8040.      
  8041.            NewEnd: List;
  8042.            Last_Of_L: List;
  8043.      
  8044.      
  8045.            begin
  8046.                NewEnd := new Cell'(Info => Element, Next => null);
  8047.                if L = null then
  8048.                    return NewEnd;
  8049.                else
  8050.                    Last_Of_L := Last (L);
  8051.                    Last_Of_L.Next := NewEnd;
  8052.                    return L;
  8053.                end if;
  8054.            end Attach;
  8055.      
  8056.      
  8057.            function Attach (Element: in     BlockInfoType;
  8058.                             L:       in     List        ) return List is
  8059.      
  8060.            begin
  8061.                return (new Cell'(Info => Element, Next => L));
  8062.            end Attach;
  8063.      
  8064.      
  8065.            function Copy (L: in     List) return List is
  8066.      
  8067.      
  8068.            begin
  8069.                if L = null then
  8070.                    return null;
  8071.                else
  8072.                    return new Cell'(Info => L.Info, Next => Copy (L.Next));
  8073.                end if;
  8074.            end Copy;
  8075.      
  8076.      
  8077.      
  8078.      
  8079.      
  8080.             function Create return List is
  8081.      
  8082.             --| Return the empty list.
  8083.      
  8084.             begin
  8085.                 return null;
  8086.             end Create;
  8087.      
  8088.            procedure DeleteHead (L: in out List) is
  8089.      
  8090.                TempList: List;
  8091.      
  8092.      
  8093.            begin
  8094.                if L = null then
  8095.                    raise EmptyList;
  8096.                else
  8097.                    TempList := L.Next;
  8098.                    Free (L);
  8099.                    L := TempList;
  8100.                end if;
  8101.            end DeleteHead;
  8102.      
  8103.      
  8104.            procedure DeleteItem (L:       in out List;
  8105.                                  Element: in     BlockInfoType ) is
  8106.      
  8107.                Temp_L  :List;
  8108.      
  8109.      
  8110.            begin
  8111.                if L.Info = Element then
  8112.                    DeleteHead(L);
  8113.                else
  8114.                    DeleteItem(L.Next, Element);
  8115.                end if;
  8116.            exception
  8117.                when constraint_error =>
  8118.                    raise ItemNotPresent;
  8119.            end DeleteItem;
  8120.      
  8121.      
  8122.            procedure DeleteItems (L:       in out List;
  8123.                                   Element: in     BlockInfoType ) is
  8124.      
  8125.                Place_In_L       :List;     --| Current place in L.
  8126.                Last_Place_In_L  :List;     --| Last place in L.
  8127.                Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  8128.                Found            :boolean := false;  --| Indicates if an element with
  8129.                                                     --| the correct value was found.
  8130.      
  8131.      
  8132.            begin
  8133.                Place_In_L := L;
  8134.                Last_Place_In_L := null;
  8135.                while (Place_In_L /= null) loop
  8136.      
  8137.                    --| Found an element equal to Element
  8138.      
  8139.                    if Place_In_L.Info = Element then
  8140.                         Found := true;
  8141.      
  8142.                         --| If Last_Place_In_L is null then we are at first element
  8143.                         --| in L.
  8144.      
  8145.                         if Last_Place_In_L = null then
  8146.                              Temp_Place_In_L := Place_In_L;
  8147.                              L := Place_In_L.Next;
  8148.                         else
  8149.                              Temp_Place_In_L := Place_In_L;
  8150.      
  8151.                              --| Relink the list Last's Next gets Place's Next
  8152.      
  8153.                              Last_Place_In_L.Next := Place_In_L.Next;
  8154.                         end if;
  8155.      
  8156.                         --| Move Place_In_L to the next position in the list.
  8157.                         --| Free the element.
  8158.                         --| Do not update the last element in the list it remains the
  8159.                         --| same.
  8160.      
  8161.                         Place_In_L := Place_In_L.Next;
  8162.                         Free (Temp_Place_In_L);
  8163.                    else
  8164.                         --| Update the last place in L and the place in L.
  8165.      
  8166.                         Last_Place_In_L := Place_In_L;
  8167.                         Place_In_L := Place_In_L.Next;
  8168.                    end if;
  8169.                end loop;
  8170.      
  8171.      
  8172.            if not Found then
  8173.               raise ItemNotPresent;
  8174.            end if;
  8175.      
  8176.            end DeleteItems;
  8177.      
  8178.      
  8179.            procedure Destroy (L: in out List) is
  8180.      
  8181.                Place_In_L:  List;
  8182.                HoldPlace:   List;
  8183.      
  8184.      
  8185.            begin
  8186.                Place_In_L := L;
  8187.                while Place_In_L /= null loop
  8188.                    HoldPlace := Place_In_L;
  8189.                    Place_In_L := Place_In_L.Next;
  8190.                    Free (HoldPlace);
  8191.                end loop;
  8192.                L := null;
  8193.            end Destroy;
  8194.      
  8195.      
  8196.            function FirstValue (L: in    List) return BlockInfoType is
  8197.      
  8198.      
  8199.            begin
  8200.                if L = null then
  8201.                    raise EmptyList;
  8202.                else
  8203.                    return (L.Info);
  8204.                end if;
  8205.            end FirstValue;
  8206.      
  8207.      
  8208.            procedure Forword (I: in out ListIter) is
  8209.      
  8210.                PlaceInList :List;
  8211.            begin
  8212.                PlaceInList := List (I);
  8213.                I := ListIter (PlaceInList.Next);
  8214.            end Forword;
  8215.      
  8216.      
  8217.            function IsInList (L:       in    List;
  8218.                               Element: in    BlockInfoType  ) return boolean is
  8219.      
  8220.            Place_In_L: List;
  8221.      
  8222.      
  8223.            begin
  8224.                Place_In_L := L;
  8225.                while Place_In_L /= null loop
  8226.                    if Place_In_L.Info = Element then
  8227.                        return true;
  8228.                    end if;
  8229.                    Place_In_L := Place_In_L.Next;
  8230.                 end loop;
  8231.                 return false;
  8232.            end IsInList;
  8233.      
  8234.      
  8235.             function IsEmpty (L: in     List) return boolean is
  8236.      
  8237.             --| Is the list L empty.
  8238.      
  8239.             begin
  8240.                 return (L = null);
  8241.             end IsEmpty;
  8242.      
  8243.      
  8244.            function LastValue (L: in     List) return BlockInfoType is
  8245.      
  8246.                LastElement: List;
  8247.      
  8248.      
  8249.            begin
  8250.                LastElement := Last (L);
  8251.                return LastElement.Info;
  8252.            end LastValue;
  8253.      
  8254.      
  8255.            function Length (L: in     List) return integer is
  8256.      
  8257.      
  8258.            begin
  8259.                if L = null then
  8260.                    return (0);
  8261.                else
  8262.                    return (1 + Length (Tail (L)));
  8263.                end if;
  8264.            end Length;
  8265.      
  8266.      
  8267.            function MakeListIter (L: in     List) return ListIter is
  8268.      
  8269.      
  8270.            begin
  8271.                return ListIter (L);
  8272.            end MakeListIter;
  8273.      
  8274.      
  8275.            function More (L: in     ListIter) return boolean is
  8276.      
  8277.      
  8278.            begin
  8279.                return L /= null;
  8280.            end;
  8281.      
  8282.      
  8283.            procedure Next (Place:   in out ListIter;
  8284.                            Info:       out BlockInfoType ) is
  8285.                PlaceInList: List;
  8286.      
  8287.      
  8288.            begin
  8289.                if Place = null then
  8290.                   raise NoMore;
  8291.                else
  8292.                   PlaceInList := List(Place);
  8293.                   Info := PlaceInList.Info;
  8294.                   Place := ListIter(PlaceInList.Next);
  8295.                end if;
  8296.            end Next;
  8297.      
  8298.      
  8299.            procedure ReplaceHead (L:    in out  List;
  8300.                                   Info: in      BlockInfoType ) is
  8301.      
  8302.      
  8303.            begin
  8304.                if L = null then
  8305.                    raise EmptyList;
  8306.                else
  8307.                    L.Info := Info;
  8308.                end if;
  8309.            end ReplaceHead;
  8310.      
  8311.      
  8312.            procedure ReplaceTail (L:        in out List;
  8313.                                   NewTail:  in     List  ) is
  8314.                Temp_L: List;
  8315.      
  8316.      
  8317.            begin
  8318.                Destroy(L.Next);
  8319.                L.Next := NewTail;
  8320.            exception
  8321.                when constraint_error =>
  8322.                    raise EmptyList;
  8323.            end ReplaceTail;
  8324.      
  8325.      
  8326.             function Tail (L: in    List) return List is
  8327.      
  8328.             --| This returns the list which is the tail of L.  If L is null Empty
  8329.             --| List is raised.
  8330.      
  8331.             begin
  8332.                 if L = null then
  8333.                     raise EmptyList;
  8334.                 else
  8335.                     return L.Next;
  8336.                 end if;
  8337.             end Tail;
  8338.      
  8339.             function Equal (List1: in    List;
  8340.                             List2: in    List ) return boolean is
  8341.      
  8342.                 PlaceInList1: List;
  8343.                 PlaceInList2: LIst;
  8344.                 Contents1:    BlockInfoType;
  8345.                 Contents2:    BlockInfoType;
  8346.      
  8347.             --| This function tests to see if two lists are equal.  Two lists
  8348.             --| are equal if for all the elements of List1 the corresponding
  8349.             --| element of List2 has the same value.  Thus if the 1st elements
  8350.             --| are equal and the second elements are equal and so up to n.
  8351.             --|  Thus a necessary condition for two lists to be equal is that
  8352.             --| they have the same number of elements.
  8353.      
  8354.             --| This function walks over the two list and checks that the
  8355.             --| corresponding elements are equal.  As soon as we reach
  8356.             --| the end of a list (PlaceInList = null) we fall out of the loop.
  8357.             --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  8358.             --| then the lists are equal.  If they both are not null the lists aren't
  8359.             --| equal.  Note that equality on elements is based on a user supplied
  8360.             --| function Equal which is used to test for item equality.
  8361.      
  8362.             begin
  8363.                 PlaceInList1 := List1;
  8364.                 PlaceInList2 := List2;
  8365.                 while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  8366.                     if not "=" (PlaceInList1.Info, PlaceInList2.Info) then
  8367.                         return false;
  8368.                     end if;
  8369.                     PlaceInList1 := PlaceInList1.Next;
  8370.                     PlaceInList2 := PlaceInList2.Next;
  8371.                 end loop;
  8372.                 return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  8373.             end Equal;
  8374.         end Lists;
  8375.      
  8376.      
  8377.      
  8378.      
  8379.      
  8380.     end BlockInfoStack;
  8381. end Definitions;
  8382. ::::::::::::::
  8383. defs.spc
  8384. ::::::::::::::
  8385. -- $Source: /nosc/work/tools/halstead/RCS/defs.spc,v $
  8386. -- $Revision: 5.7 $ -- $Date: 85/09/04 09:24:19 $ -- $Author: buddy $
  8387. with ST_Diana; use ST_Diana;
  8388. with ML_Source_Position_Pkg;
  8389. package Definitions is
  8390.      
  8391. --| OVERVIEW
  8392. --| This package defines all the data used by the Halstead program.  This
  8393. --| package also defines all the operations on the data types defined.
  8394. --| The following is a list of all the abstract data types which
  8395. --| this package defines.
  8396. --|
  8397. --|
  8398. --|      1. DEF_ID_Set.Set from the package DEF_ID_Set
  8399. --|      2. Literal_Set.Set from the package Literal_Set
  8400. --|      3. BlockInfoStack.Stack from the package BlockInfoStack
  8401. --|
  8402. --| The types defined here are all used to create the BlockInfoType.
  8403. --| BlockInfoType keeps all the information pertaining to current block
  8404. --| being processed.  The type is composed of four components types which
  8405. --| are:
  8406. --|                      1.  TokenCountType
  8407. --|                      2.  BlockIdType
  8408. --|                      3.  Literal_Set.Set
  8409. --|                      4.  DEF_ID_Set.Set
  8410. --|
  8411. --| TokenCountType   keeps track of the number of times each token appears
  8412. --|                  in the source program.
  8413. --|
  8414. --| BlockIdType      maintains the name of the current block being
  8415. --|                  processed, whether the block is a body or a spec, and
  8416. --|                  the type of block whether its a procedure, package...
  8417. --|
  8418. --| Literal_Set      This keeps a counted set of all the literals
  8419. --|                  appearing in a given block.  These literals will be
  8420. --|                  counted as operands.
  8421. --|
  8422. --| DEF_ID_Set.Set   This keeps a list of all the identifiers encounted
  8423. --|                  in a block.  At the end of the block all the
  8424. --|                  identifiers are categorized into operands and
  8425. --|                  operators.
  8426.      
  8427.      
  8428. --| EFFECTS
  8429. --| Associated with the three abstract data types DEF_ID_Set.Set
  8430. --| Literal_Set.Set and BlockInfo.Stack are a complete set of
  8431. --| operations.
  8432. --|
  8433. --| The operations associated with the sets DEF_ID_Set.Set and
  8434. --| Literal_Set.Set are counted sets.  This means that a member in the
  8435. --| set has a count associated with it.  Each time an insert is done
  8436. --| on a member the count for the member is incremented.
  8437. --|
  8438. --| The operations associated with BlockInfoStack are the normal
  8439. --| stack operations Push, Pop and some others.  These operations are
  8440. --| used to stack the information associated with a block.
  8441.      
  8442. --| TUNING
  8443. --| One way to tune this package is to cut out a lot of the functions
  8444. --| which are not used.  For example the users of this package do not
  8445. --| use FirstValue and some of the other operations of the list package.
  8446.      
  8447.      
  8448.     type TokenItem is (
  8449.         abortz,
  8450.         acceptz,
  8451.         accessz,
  8452.         allz,
  8453.         and_thenz,
  8454.         arrayz,
  8455.         atz,
  8456.         beginz,
  8457.         bodyz,
  8458.         body_packagez,
  8459.         body_taskz,
  8460.         casez,
  8461.         case_stmz,
  8462.         case_variantz,
  8463.         constantz,
  8464.         declarez,
  8465.         delayz,
  8466.         deltaz,
  8467.         digitsz,
  8468.         doz,
  8469.         elsez,
  8470.         else_ifz,
  8471.         else_orz,
  8472.         else_selectz,
  8473.         elsifz,
  8474.         endz,
  8475.         end_acceptz,
  8476.         end_beginz,
  8477.         end_case_stmz,
  8478.         end_case_variantz,
  8479.         end_ifz,
  8480.         end_loopz,
  8481.         end_package_bdyz,
  8482.         end_package_spcz,
  8483.         end_recordz,
  8484.         end_record_repz,
  8485.         end_selectz,
  8486.         end_task_spcz,
  8487.         entryz,
  8488.         exceptionz,
  8489.         exitz,
  8490.         forz,
  8491.         for_loopz,
  8492.         for_repz,
  8493.         functionz,
  8494.         genericz,
  8495.         gotoz,
  8496.         ifz,
  8497.         inz,
  8498.         in_loopz,
  8499.         in_membershipz,
  8500.         in_out_parameterz,
  8501.         in_parameterz,
  8502.         isz,
  8503.         is_case_stmz,
  8504.         is_case_variantz,
  8505.         is_functionz,
  8506.         is_genericz,
  8507.         is_package_bdyz,
  8508.         is_package_spcz,
  8509.         is_procedurez,
  8510.         is_separatez,
  8511.         is_subtypez,
  8512.         is_typez,
  8513.         is_task_bdyz,
  8514.         is_task_spcz,
  8515.         limitedz,
  8516.         loopz,
  8517.         modz,
  8518.         newz,
  8519.         new_allocatorz,
  8520.         new_derived_typez,
  8521.         new_generic_instz,
  8522.         not_in_membershipz,
  8523.         nullz,
  8524.         null_valuez,
  8525.         null_stmz,
  8526.         null_fieldz,
  8527.         ofz,
  8528.         orz,
  8529.         or_elsez,
  8530.         or_selectz,
  8531.         othersz,
  8532.         others_aggregatez,
  8533.         others_casez,
  8534.         others_exceptionz,
  8535.         others_variantz,
  8536.         outz,
  8537.         packagez,
  8538.         package_bdyz,
  8539.         package_spcz,
  8540.         pragmaz,
  8541.         privatez,
  8542.         private_sectionz,
  8543.         private_typez,
  8544.         procedurez,
  8545.         raisez,
  8546.         rangez,
  8547.         recordz,
  8548.         record_typez,
  8549.         record_repz,
  8550.         renamesz,
  8551.         returnz,
  8552.         reversez,
  8553.         selectz,
  8554.         separatez,
  8555.         subtypez,
  8556.         taskz,
  8557.         task_bdyz,
  8558.         task_spcz,
  8559.         terminatez,
  8560.         thenz,
  8561.         then_andz,
  8562.         typez,
  8563.         usez,
  8564.         use_contextz,
  8565.         use_repz,
  8566.         whenz,
  8567.         when_case_stmz,
  8568.         when_exitz,
  8569.         when_exceptionz,
  8570.         when_selectz,
  8571.         when_case_variantz,
  8572.         whilez,
  8573.         withz,
  8574.         with_contextz,
  8575.         with_genericz,
  8576.         -------------  punctuation  --------------
  8577.         arrowz,
  8578.         barz,
  8579.         boxz,
  8580.         box_rangez,
  8581.         box_default_subpz,
  8582.         character_literalz,
  8583.         closed_anglesz,
  8584.         closed_parenthesisz,
  8585.         colon_equalsz,
  8586.         colonz,
  8587.         commaz,
  8588.         dotz,
  8589.         dot_dot_rangez,
  8590.         double_quotez,
  8591.         numeric_literalz,
  8592.         open_anglesz,
  8593.         open_parenthesisz,
  8594.         semicolonz,
  8595.         single_quotez,
  8596.         tickz,
  8597.         declare_blockz
  8598.     );
  8599.       --| These are all the tokens which could possibly be counted by
  8600.       --| Halstead.
  8601.      
  8602.     type Class is (operator, operand, neither);
  8603.       --| These are the different ways to classify symbols in the source
  8604.       --| program.
  8605.      
  8606.     type TokenCountType is array(TokenItem) of natural;
  8607.       --| This type is used to count the occurrences of each token
  8608.       --| in the source program.
  8609.      
  8610.     type TokenClassificationType is array(TokenItem) of Class;
  8611.       --| This type is used to defined whether tokens are operators
  8612.       --| or operands or neither.
  8613.      
  8614.     type BlockKind is ( procedure_block,
  8615.                         function_block,
  8616.                         package_body_block,
  8617.                         package_spec_block,
  8618.                         task_body_block,
  8619.                         task_spec_block,
  8620.                         declare_block );
  8621.     --| This keeps track of the type of block being processed currently.
  8622.      
  8623.      
  8624.     BlockNameLength: constant := 16;
  8625.       --| Maximum length of a block name.
  8626.      
  8627.     SpcBdyIdLength: constant := 13;
  8628.       --| Maximum lenght of  a string which indicates whether a block
  8629.       --| is a spec, body, or declare block.
  8630.      
  8631.     subtype SpcBdyIdType is string(1..SpcBdyIdLength);
  8632.      
  8633.     AnonId :constant SpcBdyIdType := "             ";
  8634.     BdyId  :constant SpcBdyIdType := "BODY         ";
  8635.     DecId  :constant SpcBdyIdType := "DECLARE BLOCK";
  8636.     SpcId  :constant SpcBdyIdType := "SPECIFICATION";
  8637.       --| These are used to initialize the SpcOrBdyId field of
  8638.       --| BlockIdType.
  8639.      
  8640.     type StringPtr is access String;
  8641.       --| This is used to keep track of the fully qualified name of the
  8642.       --| block being processed.  Each time a new scope is entered
  8643.       --| the name of that scope is concatenated with the current
  8644.       --| fully qualified name.
  8645.      
  8646.     type BlockIdType is
  8647.        record
  8648.          KindOfBlock   :BlockKind;
  8649.          SpcBdyId      :SpcBdyIdType;
  8650.          BlockName     :StringPtr;
  8651.          LineLocation  :ML_Source_Position_Pkg.Source_Line;
  8652.        end record;
  8653.        --| This type keeps track of the name of a block.  For instance
  8654.        --| if we are processing the body of procedure P then the name
  8655.        --| of the block is P.  The KindOfBlock is "PROCEDURE" and
  8656.        --| SpcOrBdyId = "(B)".
  8657.      
  8658.      
  8659.      
  8660.      
  8661.      
  8662.      
  8663.     --| The following code represents a generic instantiation of the
  8664.     --| OrderedSet package.  It replaces:
  8665.     --|
  8666.     --| package DEF_ID_Set is new OrderedSet
  8667.     --|            (ItemType => DEF_ID.Locator,
  8668.     --|             "<" => ST_Diana.DEF_ID."<");
  8669.      
  8670.      
  8671.     --------------------------------------------------------------------------
  8672.     --               GENERIC INSTANTIATION
  8673.     --------------------------------------------------------------------------
  8674.      
  8675.     function "<" ( X, Y: DEF_ID.Locator) return boolean
  8676.       renames  ST_Diana.DEF_ID."<";
  8677.      
  8678.     package DEF_ID_Set is
  8679.      
  8680.     --| Overview
  8681.     --| This abstractions is a counted ordered set.  This means that
  8682.     --| associated with each member of the set is a count of the number of
  8683.     --| times it appears in the set.  The order part means that there is
  8684.     --| an ordering associated with the members.  This allows fast insertion.
  8685.     --| It also makes it easy to iterate over the set in order.
  8686.      
  8687.      
  8688.      
  8689.     --                    Types
  8690.     --                    -----
  8691.      
  8692.           type Set is private;  --| This is the type exported to represent
  8693.                                 --| the ordered set.
  8694.      
  8695.           type SetIter is private;  --| This is the type exported whose
  8696.                                     --| purpose is to walk over a set.
  8697.      
  8698.      
  8699.     --                   Operations
  8700.     --                   ----------
  8701.      
  8702.     --| Cardinality              Returns cardinality of the set.
  8703.     --| Create                   Creates the empty set.
  8704.     --| CountMember              Returns the number of times the member appears in
  8705.     --|                          the set.
  8706.     --| Destroy                  Destroys a set and returns the space it occupies.
  8707.     --| Insert                   Insert a member into  the set.
  8708.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  8709.     --| More                     Are there more elements to iterate over in the
  8710.     --|                          set.
  8711.     --| Next                     Return the next element in the iteration and
  8712.     --|                          bump the iterator.
  8713.      
  8714.      
  8715.     ------------------------------------------------------------------------------
  8716.      
  8717.     function Cardinality (   --| Return the number of members in the set.
  8718.              S     :in Set   --| The set whose members are being counted.
  8719.     ) return natural;
  8720.      
  8721.     ------------------------------------------------------------------------------
  8722.      
  8723.      
  8724.     function Create   --| Return the empty set.
  8725.     return Set;
  8726.      
  8727.     ------------------------------------------------------------------------------
  8728.      
  8729.     procedure Destroy (        --| Destroy a set and return its space.
  8730.               S   :in out Set  --| Set being destroyed.
  8731.      
  8732.     );
  8733.      
  8734.     ------------------------------------------------------------------------------
  8735.      
  8736.     function GetCount (            --| This returns the count associated with
  8737.                                    --| member which corresponds to the current
  8738.                                    --| iterator I.
  8739.              I :in     SetIter
  8740.     ) return natural;
  8741.      
  8742.     -----------------------------------------------------------------------------
  8743.      
  8744.     procedure Insert (             --| Insert a member M into set S.
  8745.              M :in     DEF_ID.Locator;   --| Member being inserted.
  8746.              S :in out Set         --| Set being inserted into.
  8747.     );
  8748.      
  8749.     ------------------------------------------------------------------------------
  8750.      
  8751.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  8752.                                 --| by returning a SetIter.
  8753.              S :in     Set     --| Set being iterate over.
  8754.     ) return SetIter;
  8755.      
  8756.     ------------------------------------------------------------------------------
  8757.      
  8758.     function More (             --| Returns true if there are more elements in the
  8759.                                 --| set to iterate over.
  8760.              I :in    SetIter   --| The iterator.
  8761.      
  8762.     ) return boolean;
  8763.      
  8764.     ------------------------------------------------------------------------------
  8765.      
  8766.     procedure Next (              --| Returns the current member in the iteration
  8767.                                   --| an increments the iterator.
  8768.              I :in out SetIter;   --| The iterator.
  8769.              M :   out DEF_ID.Locator   --| The current member being returned.
  8770.     );
  8771.      
  8772.     -----------------------------------------------------------------------------
  8773.      
  8774.     private
  8775.      
  8776.        type Member is
  8777.            record
  8778.              Info   :DEF_ID.Locator;
  8779.              Count  :natural;
  8780.            end record;
  8781.      
  8782.        function "<" (
  8783.                 X:in    Member;
  8784.                 Y:in    Member
  8785.        ) return boolean;
  8786.      
  8787.        -- generic instantiation
  8788.        --package TreePkg is new BinaryTrees ( DEF_ID.Locator => Member, "<" => "<" );
  8789.      
  8790.      
  8791.     package TreePkg is
  8792.      
  8793.      
  8794.     --| Overview
  8795.     --| This package creates an ordered binary tree.  This will allow for
  8796.     --| quick insertion, and search.
  8797.     --|
  8798.     --| The tree is organized such that
  8799.     --|
  8800.     --|  leftchild < root    root < rightchild
  8801.     --|
  8802.     --| This means that by doing a left to right search of the tree will can
  8803.     --| produce the nodes of the tree in ascending order.
  8804.      
  8805.      
  8806.      
  8807.      
  8808.      
  8809.     --                             Types
  8810.     --                             -----
  8811.      
  8812.     type Tree is  private;     --| This is the type exported to represent the
  8813.                                --| tree.
  8814.      
  8815.      
  8816.     type TreeIter is private;  --| This is the type which is used to iterate
  8817.                                --| over the set.
  8818.      
  8819.     --|                          Exceptions
  8820.     --|                          ----------
  8821.      
  8822.     --|                          Operations
  8823.     --|                          ----------
  8824.     --|
  8825.     --| Create           Creates a tree.
  8826.     --| Deposit          Replaces the given node's information with
  8827.     --|                  the given information.
  8828.     --| DestroyTree      Destroys the given tree and returns the spaces.
  8829.     --| InsertNode       This inserts a node n into a tree t.
  8830.     --| MakeTreeIter     This returns an iterator to the user in order to start
  8831.     --|                  an iteration.
  8832.     --| More             This returns true if there are more elements to iterate
  8833.     --|                  over in the tree.
  8834.     --| Next             This returns the information associated with the current
  8835.     --|                  iterator and advances the iterator.
  8836.      
  8837.      
  8838.     ---------------------------------------------------------------------------
  8839.      
  8840.     function Create             --| This function creates the tree.
  8841.      
  8842.     return Tree;
  8843.      
  8844.     --| Effects
  8845.     --| This creates a tree containing no information and no children.  An
  8846.     --| emptytree.
  8847.      
  8848.     -------------------------------------------------------------------------------
  8849.      
  8850.     procedure Deposit (              --| This deposits the information I in the
  8851.                                      --| root of the Tree S.
  8852.               I :in     Member;    --| The information being deposited.
  8853.               S :in     Tree         --| The tree where the information is being
  8854.                                      --| stored.
  8855.     );
  8856.      
  8857.     --| Modifies
  8858.     --| This changes the information stored at the root of the tree S.
  8859.      
  8860.     -------------------------------------------------------------------------------
  8861.      
  8862.      
  8863.     procedure DestroyTree (         --| Destroys a tree.
  8864.               T  :in out Tree       --| Tree being destroyed.
  8865.     );
  8866.      
  8867.     --| Effects
  8868.     --| Destroys a tree and returns the space which it is occupying.
  8869.      
  8870.     --------------------------------------------------------------------------
  8871.      
  8872.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  8873.                                     --| Specified Tree.
  8874.            N      :In Out Member; --| The Information To Be Contained In The
  8875.                                     --| Node Being Inserted.
  8876.      
  8877.            T      :In Out Tree;     --| Tree Being Inserted Into.
  8878.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  8879.                                     --| This is the position of the node N in T.
  8880.            Exists :   out boolean   --| If this node already exists in the tree
  8881.                                     --| Exists is true.  If this is the first
  8882.                                     --| insertion Exists is false.
  8883.     );
  8884.      
  8885.     --| Effects
  8886.     --| This adds the node N to the tree T inserting in the proper postion.
  8887.      
  8888.     --| Modifies
  8889.     --| This modifies the tree T by add the node N to it.
  8890.      
  8891.     ------------------------------------------------------------------------------
  8892.      
  8893.     function MakeTreeIter (         --| Sets a variable to a position in the
  8894.                                     --| tree
  8895.                                     --| where the iteration is to begin.  In this
  8896.                                     --| case the position is a pointer to the
  8897.                                     --| the deepest leftmost leaf in the tree.
  8898.             T:in Tree               --| Tree being iterated over
  8899.     ) return TreeIter;
  8900.      
  8901.      
  8902.     --| Effects
  8903.      
  8904.      
  8905.     -----------------------------------------------------------------------------
  8906.      
  8907.     function More (                 --| Returns true if there are more elements
  8908.                                     --| in the tree to iterate over.
  8909.               I :in TreeIter
  8910.     ) return boolean;
  8911.      
  8912.      
  8913.     -----------------------------------------------------------------------------
  8914.      
  8915.     procedure Next (                --| This is the iterator operation.  Given
  8916.                                     --| an Iter in the Tree it returns the
  8917.                                     --| item Iter points to and updates the
  8918.                                     --| iter. If Iter is at the end of the Tree,
  8919.                                     --| yielditer returns false otherwise it
  8920.                                     --| returns true.
  8921.         I        :in out TreeIter;  --| The iter which marks the position in the
  8922.                                     --| Tree.
  8923.      
  8924.         Info     :   out Member   --| Information being returned from a node.
  8925.     );
  8926.      
  8927.      
  8928.     ---------------------------------------------------------------------------
  8929.      
  8930.     private
  8931.      
  8932.        type Node;
  8933.        type Tree is access Node;
  8934.      
  8935.        type Node is
  8936.             record
  8937.                 Info           :Member;
  8938.                 LeftChild      :Tree;
  8939.                 RightChild     :Tree;
  8940.             end record;
  8941.      
  8942.     ---   The following is a generic instantiation of NodeOrder
  8943.     ---   package NodeOrder is new Lists (Tree);
  8944.      
  8945.      
  8946.     package NodeOrder is
  8947.      
  8948.     --| This package provides singly linked lists with elements of type
  8949.     --| Tree, where Tree is specified by a generic parameter.
  8950.      
  8951.     --| Overview
  8952.     --| When this package is instantiated, it provides a linked list type for
  8953.     --| lists of objects of type Tree, which can be any desired type.  A
  8954.     --| complete set of operations for manipulation, and releasing
  8955.     --| those lists is also provided.  For instance, to make lists of strings,
  8956.     --| all that is necessary is:
  8957.     --|
  8958.     --| type StringType is string(1..10);
  8959.     --|
  8960.     --| package Str_List is new Lists(StringType); use Str_List;
  8961.     --|
  8962.     --|    L:List;
  8963.     --|    S:StringType;
  8964.     --|
  8965.     --| Then to add a string S, to the list L, all that is necessary is
  8966.     --|
  8967.     --|    L := Create;
  8968.     --|    Attach(S,L);
  8969.     --|
  8970.     --|
  8971.     --| This package provides basic list operations.
  8972.     --|
  8973.     --| Attach          append an object to an object, an object to a list,
  8974.     --|                 or a list to an object, or a list to a list.
  8975.     --| Copy            copy a list using := on elements
  8976.     --| CopyDeep        copy a list by copying the elements using a copy
  8977.     --|                 operation provided by the user
  8978.     --| Create          Creates an empty list
  8979.     --| DeleteHead      removes the head of a list
  8980.     --| DeleteItem      delete the first occurrence of an element from a list
  8981.     --| DeleteItems     delete all occurrences of an element from a list
  8982.     --| Destroy         remove a list
  8983.     --| Equal           are two lists equal
  8984.     --| FirstValue      get the information from the first element of a list
  8985.     --| IsInList        determines whether a given element is in a given list
  8986.     --| IsEmpty         returns true if the list is empty
  8987.     --| LastValue       return the last value of a list
  8988.     --| Length          Returns the length of a list
  8989.     --| MakeListIter    prepares for an iteration over a list
  8990.     --| More            are there any more items in the list
  8991.     --| Next            get the next item in a list
  8992.     --| ReplaceHead     replace the information at the head of the list
  8993.     --| ReplaceTail     replace the tail of a list with a new list
  8994.     --| Tail            get the tail of a list
  8995.     --|
  8996.      
  8997.     --| N/A: Effects, Requires, Modifies, and Raises.
  8998.      
  8999.     --| Notes
  9000.     --| Programmer Buddy Altus
  9001.      
  9002.     --|                           Types
  9003.     --|                           -----
  9004.      
  9005.               type List       is private;
  9006.               type ListIter   is private;
  9007.      
  9008.      
  9009.     --|                           Exceptions
  9010.     --|                           ----------
  9011.      
  9012.         CircularList     :exception;     --| Raised if an attemp is made to
  9013.                                          --| create a circular list.  This
  9014.                                          --| results when a list is attempted
  9015.                                          --| to be attached to itself.
  9016.      
  9017.         EmptyList        :exception;     --| Raised if an attemp is made to
  9018.                                          --| manipulate an empty list.
  9019.      
  9020.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  9021.                                          --| remove an element from a list in
  9022.                                          --| which it does not exist.
  9023.      
  9024.         NoMore           :exception;     --| Raised if an attemp is made to
  9025.                                          --| get the next element from a list
  9026.                                          --| after iteration is complete.
  9027.      
  9028.      
  9029.      
  9030.     --|                           Operations
  9031.     --|                           ----------
  9032.      
  9033.     ----------------------------------------------------------------------------
  9034.      
  9035.     procedure Attach(                  --| appends List2 to List1
  9036.               List1:     in out List;  --| The list being appended to.
  9037.               List2:     in     List   --| The list being appended.
  9038.     );
  9039.      
  9040.     --| Raises
  9041.     --| CircularList
  9042.      
  9043.     --| Effects
  9044.     --| Appends List1 to List2.  This makes the next field of the last element
  9045.     --| of List1 refer to List2.  This can possibly change the value of List1
  9046.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  9047.     --| user Destroys List1 then List2 will be a dangling reference.
  9048.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9049.     --| necessary to Attach a list to itself first make a copy of the list and
  9050.     --| attach the copy.
  9051.      
  9052.     --| Modifies
  9053.     --| Changes the next field of the last element in List1 to be List2.
  9054.      
  9055.     -------------------------------------------------------------------------------
  9056.      
  9057.     function Attach(                 --| Creates a new list containing the two
  9058.                                      --| Elements.
  9059.              Element1: in Tree;  --| This will be first element in list.
  9060.              Element2: in Tree   --| This will be second element in list.
  9061.     ) return List;
  9062.      
  9063.     --| Effects
  9064.     --| This creates a list containing the two elements in the order
  9065.     --| specified.
  9066.      
  9067.     -------------------------------------------------------------------------------
  9068.     procedure Attach(                   --| List L is appended with Element.
  9069.              L:       in out List;      --| List being appended to.
  9070.              Element: in     Tree   --| This will be last element in l    ist.
  9071.     );
  9072.      
  9073.     --| Effects
  9074.     --| Appends Element onto the end of the list L.  If L is empty then this
  9075.     --| may change the value of L.
  9076.     --|
  9077.     --| Modifies
  9078.     --| This appends List L with Element by changing the next field in List.
  9079.      
  9080.     --------------------------------------------------------------------------------
  9081.     procedure Attach(                   --| Makes Element first item in list L.
  9082.              Element: in      Tree; --| This will be the first element in list.
  9083.              L:       in  out List      --| The List which Element is being
  9084.                                         --| prepended to.
  9085.     );
  9086.      
  9087.     --| Effects
  9088.     --| This prepends list L with Element.
  9089.     --|
  9090.     --| Modifies
  9091.     --| This modifies the list L.
  9092.      
  9093.     --------------------------------------------------------------------------
  9094.      
  9095.     function Attach (                      --| attaches two lists
  9096.              List1: in     List;           --| first list
  9097.              List2: in     List            --| second list
  9098.     ) return List;
  9099.      
  9100.     --| Raises
  9101.     --| CircularList
  9102.      
  9103.     --| Effects
  9104.     --| This returns a list which is List1 attached to List2.  If it is desired
  9105.     --| to make List1 be the new attached list the following ada code should be
  9106.     --| used.
  9107.     --|
  9108.     --| List1 := Attach (List1, List2);
  9109.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9110.     --| necessary to Attach a list to itself first make a copy of the list and
  9111.     --| attach the copy.
  9112.      
  9113.     -------------------------------------------------------------------------
  9114.      
  9115.     function Attach (                   --| prepends an element onto a list
  9116.              Element: in    Tree;   --| element being prepended to list
  9117.              L:       in    List        --| List which element is being added
  9118.                                         --| to
  9119.     ) return List;
  9120.      
  9121.     --| Effects
  9122.     --| Returns a new list which is headed by Element and followed by L.
  9123.      
  9124.     ------------------------------------------------------------------------
  9125.      
  9126.     function Attach (                  --| Adds an element to the end of a list
  9127.              L: in          List;      --| The list which element is being added to.
  9128.              Element: in    Tree   --| The element being added to the end of
  9129.                                        --| the list.
  9130.     ) return List;
  9131.      
  9132.     --| Effects
  9133.     --| Returns a new list which is L followed by Element.
  9134.      
  9135.     --------------------------------------------------------------------------
  9136.      
  9137.      
  9138.     function Copy(          --| returns a copy of list1
  9139.            L: in List       --| list being copied
  9140.     ) return List;
  9141.      
  9142.     --| Effects
  9143.     --| Returns a copy of L.
  9144.      
  9145.     --------------------------------------------------------------------------
  9146.      
  9147.      
  9148.     function Create           --| Returns an empty List
  9149.      
  9150.     return List;
  9151.      
  9152.     ------------------------------------------------------------------------------
  9153.      
  9154.     procedure DeleteHead(            --| Remove the head element from a list.
  9155.               L: in out List         --| The list whose head is being removed.
  9156.     );
  9157.      
  9158.     --| Raises
  9159.     --| EmptyList
  9160.     --|
  9161.     --| Effects
  9162.     --| This will return the space occupied by the first element in the list
  9163.     --| to the heap.  If sharing exists between lists this procedure
  9164.     --| could leave a dangling reference.  If L is empty EmptyList will be
  9165.     --| raised.
  9166.      
  9167.     ------------------------------------------------------------------------------
  9168.      
  9169.     procedure DeleteItem(           --| remove the first occurrence of Element
  9170.                                     --| from L
  9171.           L:       in out List;     --| list element is being  removed from
  9172.           Element: in     Tree  --| element being removed
  9173.     );
  9174.      
  9175.     --| Raises
  9176.     --| ItemNotPresent
  9177.      
  9178.     --| Effects
  9179.     --| Removes the first element of the list equal to Element.  If there is
  9180.     --| not an element equal to Element than ItemNotPresent is raised.
  9181.      
  9182.     --| Modifies
  9183.     --| This operation is destructive, it returns the storage occupied by
  9184.     --| the elements being deleted.
  9185.      
  9186.     ------------------------------------------------------------------------------
  9187.      
  9188.     procedure DeleteItems(          --| remove all occurrences of Element
  9189.                                     --| from  L.
  9190.           L:       in out List;     --| The List element is being removed from
  9191.           Element: in     Tree  --| element being removed
  9192.     );
  9193.      
  9194.     --| Raises
  9195.     --| ItemNotPresent
  9196.     --|
  9197.     --| Effects
  9198.     --| This procedure walks down the list L and removes all elements of the
  9199.     --| list equal to Element.  If there are not any elements equal to Element
  9200.     --| then raise ItemNotPresent.
  9201.      
  9202.     --| Modifies
  9203.     --| This operation is destructive the storage occupied by the items
  9204.     --| removed is returned.
  9205.      
  9206.     ------------------------------------------------------------------------------
  9207.      
  9208.     procedure Destroy(            --| removes the list
  9209.               L: in out List      --| the list being removed
  9210.     );
  9211.      
  9212.     --| Effects
  9213.     --| This returns to the heap all the storage that a list occupies.  Keep in
  9214.     --| mind if there exists sharing between lists then this operation can leave
  9215.     --| dangling references.
  9216.      
  9217.     ------------------------------------------------------------------------------
  9218.      
  9219.     function FirstValue(      --| returns the contents of the first record of the
  9220.                               --| list
  9221.              L: in List       --| the list whose first element is being
  9222.                               --| returned
  9223.      
  9224.     ) return Tree;
  9225.      
  9226.     --| Raises
  9227.     --| EmptyList
  9228.     --|
  9229.     --| Effects
  9230.     --| This returns the Item in the first position in the list.  If the list
  9231.     --| is empty EmptyList is raised.
  9232.      
  9233.     -------------------------------------------------------------------------------
  9234.      
  9235.     function IsEmpty(            --| Checks if a list is empty.
  9236.              L: in     List      --| List being checked.
  9237.     ) return boolean;
  9238.      
  9239.     --------------------------------------------------------------------------
  9240.      
  9241.     function IsInList(                 --| Checks if element is an element of
  9242.                                        --| list.
  9243.              L:       in     List;     --| list being scanned for element
  9244.              Element: in     Tree  --| element being searched for
  9245.     ) return boolean;
  9246.      
  9247.     --| Effects
  9248.     --| Walks down the list L looking for an element whose value is Element.
  9249.      
  9250.     ------------------------------------------------------------------------------
  9251.      
  9252.     function LastValue(       --| Returns the contents of the last record of
  9253.                               --| the list.
  9254.              L: in List       --| The list whose first element is being
  9255.                               --| returned.
  9256.     ) return Tree;
  9257.      
  9258.     --| Raises
  9259.     --| EmptyList
  9260.     --|
  9261.     --| Effects
  9262.     --| Returns the last element in a list.  If the list is empty EmptyList is
  9263.     --| raised.
  9264.      
  9265.      
  9266.     ------------------------------------------------------------------------------
  9267.      
  9268.     function Length(         --| count the number of elements on a list
  9269.              L: in List      --| list whose length is being computed
  9270.     ) return integer;
  9271.      
  9272.     ------------------------------------------------------------------------------
  9273.      
  9274.     function MakeListIter(          --| Sets a variable to point to  the head
  9275.                                     --| of the list.  This will be used to
  9276.                                     --| prepare for iteration over a list.
  9277.              L: in List             --| The list being iterated over.
  9278.     ) return ListIter;
  9279.      
  9280.      
  9281.     --| This prepares a user for iteration operation over a list.  The iterater is
  9282.     --| an operation which returns successive elements of the list on successive
  9283.     --| calls to the iterator.  There needs to be a mechanism which marks the
  9284.     --| position in the list, so on successive calls to the Next operation the
  9285.     --| next item in the list can be returned.  This is the function of the
  9286.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  9287.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  9288.     --| is updated with each call.
  9289.      
  9290.     -----------------------------------------------------------------------------
  9291.      
  9292.     function More(           --| Returns true if there are more elements in
  9293.                              --| the and false if there aren't any more
  9294.                              --| the in the list.
  9295.              L: in ListIter  --| List being checked for elements.
  9296.     ) return boolean;
  9297.      
  9298.     ------------------------------------------------------------------------------
  9299.      
  9300.     procedure Next(                 --| This is the iterator operation.  Given
  9301.                                     --| a ListIter in the list it returns the
  9302.                                     --| current item and updates the ListIter.
  9303.                                     --| If ListIter is at the end of the list,
  9304.                                     --| More returns false otherwise it
  9305.                                     --| returns true.
  9306.         Place:    in out ListIter;  --| The Iter which marks the position in
  9307.                                     --| the list.
  9308.         Info:        out Tree   --| The element being returned.
  9309.      
  9310.     );
  9311.      
  9312.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  9313.     --| in the following way:
  9314.     --|
  9315.     --|         L:        List;
  9316.     --|         Place:    ListIter;
  9317.     --|         Info:     SomeType;
  9318.     --|
  9319.     --|
  9320.     --|         Place := MakeListIter(L);
  9321.     --|
  9322.     --|         while ( More(Place) ) loop
  9323.     --|               NextList(Place, Info);
  9324.     --|               process each element of list L;
  9325.     --|               end loop;
  9326.      
  9327.      
  9328.     ----------------------------------------------------------------------------
  9329.      
  9330.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  9331.                                --| with the parameter Item.
  9332.          L:    in out List;    --| The list being modified.
  9333.          Info: in     Tree --| The information being entered.
  9334.     );
  9335.     --| Raises
  9336.     --| EmptyList
  9337.      
  9338.     --| Effects
  9339.     --| Replaces the information in the first element in the list.  Raises
  9340.     --| EmptyList if the list is empty.
  9341.      
  9342.     ------------------------------------------------------------------------------
  9343.      
  9344.     procedure ReplaceTail(           --| Replace the Tail of a list
  9345.                                      --| with a new list.
  9346.               L:       in out List;  --| List whose Tail is replaced.
  9347.               NewTail: in     List   --| The list which will become the
  9348.                                      --| tail of Oldlist.
  9349.     );
  9350.     --| Raises
  9351.     --| EmptyList
  9352.     --|
  9353.     --| Effects
  9354.     --| Replaces the tail of a list with a new list.  If the list whose tail
  9355.     --| is being replaced is null EmptyList is raised.
  9356.      
  9357.     -------------------------------------------------------------------------------
  9358.      
  9359.     function Tail(           --| returns the tail of a list L
  9360.              L: in List      --| the list whose tail is being returned
  9361.     ) return List;
  9362.      
  9363.     --| Raises
  9364.     --| EmptyList
  9365.     --|
  9366.     --| Effects
  9367.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  9368.     --| L is empty.  If L only has one element then Tail returns the Empty
  9369.     --| list.
  9370.      
  9371.     ------------------------------------------------------------------------------
  9372.      
  9373.     function Equal(            --| compares list1 and list2 for equality
  9374.              List1: in List;   --| first list
  9375.              List2: in List    --| second list
  9376.      )  return boolean;
  9377.      
  9378.     --| Effects
  9379.     --| Returns true if for all elements of List1 the corresponding element
  9380.     --| of List2 has the same value.  This function uses the Equal operation
  9381.     --| provided by the user.  If one is not provided then = is used.
  9382.      
  9383.     ------------------------------------------------------------------------------
  9384.     private
  9385.         type Cell;
  9386.      
  9387.         type List is access Cell;      --| pointer added by this package
  9388.                                        --| in order to make a list
  9389.      
  9390.      
  9391.         type Cell is                   --| Cell for the lists being created
  9392.              record
  9393.                   Info: Tree;
  9394.                   Next: List;
  9395.              end record;
  9396.      
  9397.      
  9398.         type ListIter is new List;     --| This prevents Lists being assigned to
  9399.                                        --| iterators and vice versa
  9400.      
  9401.     end NodeOrder;
  9402.      
  9403.        type TreeIter is
  9404.           record
  9405.               NodeList :NodeOrder.List;
  9406.               State    :NodeOrder.ListIter;
  9407.           end record;
  9408.      
  9409.      
  9410.     end TreePkg;
  9411.        type Set is
  9412.            record
  9413.              SetRep :TreePkg.Tree;
  9414.            end record;
  9415.      
  9416.        type SetIter is
  9417.            record
  9418.              Place :TreePkg.TreeIter;
  9419.              Count :natural;
  9420.            end record;
  9421.      
  9422.     end DEF_ID_Set;
  9423.      
  9424.      
  9425.     function "<" (   --| This is used to order the Source_Text.Locs
  9426.           X :in     Source_Text.Locator;
  9427.           Y :in     Source_Text.Locator
  9428.     ) return boolean;
  9429.      
  9430. --    generic
  9431. --          type Source_Text.Locator is private;
  9432. --          with function "<" ( X ,Y: in     Source_Text.Locator) return boolean;
  9433.      
  9434.     package Literal_Set is
  9435.      
  9436.     --| Overview
  9437.     --| This abstractions is a counted ordered set.  This means that
  9438.     --| associated with each member of the set is a count of the number of
  9439.     --| times it appears in the set.  The order part means that there is
  9440.     --| an ordering associated with the members.  This allows fast insertion.
  9441.     --| It also makes it easy to iterate over the set in order.
  9442.      
  9443.      
  9444.      
  9445.     --                    Types
  9446.     --                    -----
  9447.      
  9448.           type Set is private;  --| This is the type exported to represent
  9449.                                 --| the ordered set.
  9450.      
  9451.           type SetIter is private;  --| This is the type exported whose
  9452.                                     --| purpose is to walk over a set.
  9453.      
  9454.      
  9455.     --                   Operations
  9456.     --                   ----------
  9457.      
  9458.     --| Cardinality              Returns cardinality of the set.
  9459.     --| Create                   Creates the empty set.
  9460.     --| CountMember              Returns the number of times the member appears in
  9461.     --|                          the set.
  9462.     --| Destroy                  Destroys a set and returns the space it occupies.
  9463.     --| Insert                   Insert a member into  the set.
  9464.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  9465.     --| More                     Are there more elements to iterate over in the
  9466.     --|                          set.
  9467.     --| Next                     Return the next element in the iteration and
  9468.     --|                          bump the iterator.
  9469.      
  9470.      
  9471.     ------------------------------------------------------------------------------
  9472.      
  9473.     function Cardinality (   --| Return the number of members in the set.
  9474.              S     :in Set   --| The set whose members are being counted.
  9475.     ) return natural;
  9476.      
  9477.     ------------------------------------------------------------------------------
  9478.      
  9479.      
  9480.     function Create   --| Return the empty set.
  9481.     return Set;
  9482.      
  9483.     ------------------------------------------------------------------------------
  9484.      
  9485.     procedure Destroy (        --| Destroy a set and return its space.
  9486.               S   :in out Set  --| Set being destroyed.
  9487.      
  9488.     );
  9489.      
  9490.     ------------------------------------------------------------------------------
  9491.      
  9492.     function GetCount (            --| This returns the count associated with
  9493.                                    --| member which corresponds to the current
  9494.                                    --| iterator I.
  9495.              I :in     SetIter
  9496.     ) return natural;
  9497.      
  9498.     -----------------------------------------------------------------------------
  9499.      
  9500.     procedure Insert (             --| Insert a member M into set S.
  9501.              M :in     Source_Text.Locator;   --| Member being inserted.
  9502.              S :in out Set         --| Set being inserted into.
  9503.     );
  9504.      
  9505.     ------------------------------------------------------------------------------
  9506.      
  9507.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  9508.                                 --| by returning a SetIter.
  9509.              S :in     Set     --| Set being iterate over.
  9510.     ) return SetIter;
  9511.      
  9512.     ------------------------------------------------------------------------------
  9513.      
  9514.     function More (             --| Returns true if there are more elements in the
  9515.                                 --| set to iterate over.
  9516.              I :in    SetIter   --| The iterator.
  9517.      
  9518.     ) return boolean;
  9519.      
  9520.     ------------------------------------------------------------------------------
  9521.      
  9522.     procedure Next (              --| Returns the current member in the iteration
  9523.                                   --| an increments the iterator.
  9524.              I :in out SetIter;   --| The iterator.
  9525.              M :   out Source_Text.Locator   --| The current member being returned.
  9526.     );
  9527.      
  9528.     -----------------------------------------------------------------------------
  9529.      
  9530.     private
  9531.      
  9532.        type Member is
  9533.            record
  9534.              Info   :Source_Text.Locator;
  9535.              Count  :natural;
  9536.            end record;
  9537.      
  9538.        function "<" (
  9539.                 X:in    Member;
  9540.                 Y:in    Member
  9541.        ) return boolean;
  9542.      
  9543.        -- generic instantiation
  9544.        --package TreePkg is new BinaryTrees ( Source_Text.Locator => Member, "<" => "<" );
  9545.      
  9546.      
  9547.     package TreePkg is
  9548.      
  9549.      
  9550.     --| Overview
  9551.     --| This package creates an ordered binary tree.  This will allow for
  9552.     --| quick insertion, and search.
  9553.     --|
  9554.     --| The tree is organized such that
  9555.     --|
  9556.     --|  leftchild < root    root < rightchild
  9557.     --|
  9558.     --| This means that by doing a left to right search of the tree will can
  9559.     --| produce the nodes of the tree in ascending order.
  9560.      
  9561.      
  9562.      
  9563.      
  9564.      
  9565.     --                             Types
  9566.     --                             -----
  9567.      
  9568.     type Tree is  private;     --| This is the type exported to represent the
  9569.                                --| tree.
  9570.      
  9571.      
  9572.     type TreeIter is private;  --| This is the type which is used to iterate
  9573.                                --| over the set.
  9574.      
  9575.     --|                          Exceptions
  9576.     --|                          ----------
  9577.      
  9578.     --|                          Operations
  9579.     --|                          ----------
  9580.     --|
  9581.     --| Create           Creates a tree.
  9582.     --| Deposit          Replaces the given node's information with
  9583.     --|                  the given information.
  9584.     --| DestroyTree      Destroys the given tree and returns the spaces.
  9585.     --| InsertNode       This inserts a node n into a tree t.
  9586.     --| MakeTreeIter     This returns an iterator to the user in order to start
  9587.     --|                  an iteration.
  9588.     --| More             This returns true if there are more elements to iterate
  9589.     --|                  over in the tree.
  9590.     --| Next             This returns the information associated with the current
  9591.     --|                  iterator and advances the iterator.
  9592.      
  9593.      
  9594.     ---------------------------------------------------------------------------
  9595.      
  9596.     function Create             --| This function creates the tree.
  9597.      
  9598.     return Tree;
  9599.      
  9600.     --| Effects
  9601.     --| This creates a tree containing no information and no children.  An
  9602.     --| emptytree.
  9603.      
  9604.     -------------------------------------------------------------------------------
  9605.      
  9606.     procedure Deposit (              --| This deposits the information I in the
  9607.                                      --| root of the Tree S.
  9608.               I :in     Member;    --| The information being deposited.
  9609.               S :in     Tree         --| The tree where the information is being
  9610.                                      --| stored.
  9611.     );
  9612.      
  9613.     --| Modifies
  9614.     --| This changes the information stored at the root of the tree S.
  9615.      
  9616.     -------------------------------------------------------------------------------
  9617.      
  9618.      
  9619.     procedure DestroyTree (         --| Destroys a tree.
  9620.               T  :in out Tree       --| Tree being destroyed.
  9621.     );
  9622.      
  9623.     --| Effects
  9624.     --| Destroys a tree and returns the space which it is occupying.
  9625.      
  9626.     --------------------------------------------------------------------------
  9627.      
  9628.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  9629.                                     --| Specified Tree.
  9630.            N      :In Out Member; --| The Information To Be Contained In The
  9631.                                     --| Node Being Inserted.
  9632.      
  9633.            T      :In Out Tree;     --| Tree Being Inserted Into.
  9634.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  9635.                                     --| This is the position of the node N in T.
  9636.            Exists :   out boolean   --| If this node already exists in the tree
  9637.                                     --| Exists is true.  If this is the first
  9638.                                     --| insertion Exists is false.
  9639.     );
  9640.      
  9641.     --| Effects
  9642.     --| This adds the node N to the tree T inserting in the proper postion.
  9643.      
  9644.     --| Modifies
  9645.     --| This modifies the tree T by add the node N to it.
  9646.      
  9647.     ------------------------------------------------------------------------------
  9648.      
  9649.     function MakeTreeIter (         --| Sets a variable to a position in the
  9650.                                     --| tree
  9651.                                     --| where the iteration is to begin.  In this
  9652.                                     --| case the position is a pointer to the
  9653.                                     --| the deepest leftmost leaf in the tree.
  9654.             T:in Tree               --| Tree being iterated over
  9655.     ) return TreeIter;
  9656.      
  9657.      
  9658.     --| Effects
  9659.      
  9660.      
  9661.     -----------------------------------------------------------------------------
  9662.      
  9663.     function More (                 --| Returns true if there are more elements
  9664.                                     --| in the tree to iterate over.
  9665.               I :in TreeIter
  9666.     ) return boolean;
  9667.      
  9668.      
  9669.     -----------------------------------------------------------------------------
  9670.      
  9671.     procedure Next (                --| This is the iterator operation.  Given
  9672.                                     --| an Iter in the Tree it returns the
  9673.                                     --| item Iter points to and updates the
  9674.                                     --| iter. If Iter is at the end of the Tree,
  9675.                                     --| yielditer returns false otherwise it
  9676.                                     --| returns true.
  9677.         I        :in out TreeIter;  --| The iter which marks the position in the
  9678.                                     --| Tree.
  9679.      
  9680.         Info     :   out Member   --| Information being returned from a node.
  9681.     );
  9682.      
  9683.      
  9684.     ---------------------------------------------------------------------------
  9685.      
  9686.     private
  9687.      
  9688.        type Node;
  9689.        type Tree is access Node;
  9690.      
  9691.        type Node is
  9692.             record
  9693.                 Info           :Member;
  9694.                 LeftChild      :Tree;
  9695.                 RightChild     :Tree;
  9696.             end record;
  9697.      
  9698.     ---   The following is a generic instantiation of NodeOrder
  9699.     ---   package NodeOrder is new Lists (Tree);
  9700.      
  9701.      
  9702.     package NodeOrder is
  9703.      
  9704.     --| This package provides singly linked lists with elements of type
  9705.     --| Tree, where Tree is specified by a generic parameter.
  9706.      
  9707.     --| Overview
  9708.     --| When this package is instantiated, it provides a linked list type for
  9709.     --| lists of objects of type Tree, which can be any desired type.  A
  9710.     --| complete set of operations for manipulation, and releasing
  9711.     --| those lists is also provided.  For instance, to make lists of strings,
  9712.     --| all that is necessary is:
  9713.     --|
  9714.     --| type StringType is string(1..10);
  9715.     --|
  9716.     --| package Str_List is new Lists(StringType); use Str_List;
  9717.     --|
  9718.     --|    L:List;
  9719.     --|    S:StringType;
  9720.     --|
  9721.     --| Then to add a string S, to the list L, all that is necessary is
  9722.     --|
  9723.     --|    L := Create;
  9724.     --|    Attach(S,L);
  9725.     --|
  9726.     --|
  9727.     --| This package provides basic list operations.
  9728.     --|
  9729.     --| Attach          append an object to an object, an object to a list,
  9730.     --|                 or a list to an object, or a list to a list.
  9731.     --| Copy            copy a list using := on elements
  9732.     --| CopyDeep        copy a list by copying the elements using a copy
  9733.     --|                 operation provided by the user
  9734.     --| Create          Creates an empty list
  9735.     --| DeleteHead      removes the head of a list
  9736.     --| DeleteItem      delete the first occurrence of an element from a list
  9737.     --| DeleteItems     delete all occurrences of an element from a list
  9738.     --| Destroy         remove a list
  9739.     --| Equal           are two lists equal
  9740.     --| FirstValue      get the information from the first element of a list
  9741.     --| IsInList        determines whether a given element is in a given list
  9742.     --| IsEmpty         returns true if the list is empty
  9743.     --| LastValue       return the last value of a list
  9744.     --| Length          Returns the length of a list
  9745.     --| MakeListIter    prepares for an iteration over a list
  9746.     --| More            are there any more items in the list
  9747.     --| Next            get the next item in a list
  9748.     --| ReplaceHead     replace the information at the head of the list
  9749.     --| ReplaceTail     replace the tail of a list with a new list
  9750.     --| Tail            get the tail of a list
  9751.     --|
  9752.      
  9753.     --| N/A: Effects, Requires, Modifies, and Raises.
  9754.      
  9755.     --| Notes
  9756.     --| Programmer Buddy Altus
  9757.      
  9758.     --|                           Types
  9759.     --|                           -----
  9760.      
  9761.               type List       is private;
  9762.               type ListIter   is private;
  9763.      
  9764.      
  9765.     --|                           Exceptions
  9766.     --|                           ----------
  9767.      
  9768.         CircularList     :exception;     --| Raised if an attemp is made to
  9769.                                          --| create a circular list.  This
  9770.                                          --| results when a list is attempted
  9771.                                          --| to be attached to itself.
  9772.      
  9773.         EmptyList        :exception;     --| Raised if an attemp is made to
  9774.                                          --| manipulate an empty list.
  9775.      
  9776.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  9777.                                          --| remove an element from a list in
  9778.                                          --| which it does not exist.
  9779.      
  9780.         NoMore           :exception;     --| Raised if an attemp is made to
  9781.                                          --| get the next element from a list
  9782.                                          --| after iteration is complete.
  9783.      
  9784.      
  9785.      
  9786.     --|                           Operations
  9787.     --|                           ----------
  9788.      
  9789.     ----------------------------------------------------------------------------
  9790.      
  9791.     procedure Attach(                  --| appends List2 to List1
  9792.               List1:     in out List;  --| The list being appended to.
  9793.               List2:     in     List   --| The list being appended.
  9794.     );
  9795.      
  9796.     --| Raises
  9797.     --| CircularList
  9798.      
  9799.     --| Effects
  9800.     --| Appends List1 to List2.  This makes the next field of the last element
  9801.     --| of List1 refer to List2.  This can possibly change the value of List1
  9802.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  9803.     --| user Destroys List1 then List2 will be a dangling reference.
  9804.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9805.     --| necessary to Attach a list to itself first make a copy of the list and
  9806.     --| attach the copy.
  9807.      
  9808.     --| Modifies
  9809.     --| Changes the next field of the last element in List1 to be List2.
  9810.      
  9811.     -------------------------------------------------------------------------------
  9812.      
  9813.     function Attach(                 --| Creates a new list containing the two
  9814.                                      --| Elements.
  9815.              Element1: in Tree;  --| This will be first element in list.
  9816.              Element2: in Tree   --| This will be second element in list.
  9817.     ) return List;
  9818.      
  9819.     --| Effects
  9820.     --| This creates a list containing the two elements in the order
  9821.     --| specified.
  9822.      
  9823.     -------------------------------------------------------------------------------
  9824.     procedure Attach(                   --| List L is appended with Element.
  9825.              L:       in out List;      --| List being appended to.
  9826.              Element: in     Tree   --| This will be last element in l    ist.
  9827.     );
  9828.      
  9829.     --| Effects
  9830.     --| Appends Element onto the end of the list L.  If L is empty then this
  9831.     --| may change the value of L.
  9832.     --|
  9833.     --| Modifies
  9834.     --| This appends List L with Element by changing the next field in List.
  9835.      
  9836.     --------------------------------------------------------------------------------
  9837.     procedure Attach(                   --| Makes Element first item in list L.
  9838.              Element: in      Tree; --| This will be the first element in list.
  9839.              L:       in  out List      --| The List which Element is being
  9840.                                         --| prepended to.
  9841.     );
  9842.      
  9843.     --| Effects
  9844.     --| This prepends list L with Element.
  9845.     --|
  9846.     --| Modifies
  9847.     --| This modifies the list L.
  9848.      
  9849.     --------------------------------------------------------------------------
  9850.      
  9851.     function Attach (                      --| attaches two lists
  9852.              List1: in     List;           --| first list
  9853.              List2: in     List            --| second list
  9854.     ) return List;
  9855.      
  9856.     --| Raises
  9857.     --| CircularList
  9858.      
  9859.     --| Effects
  9860.     --| This returns a list which is List1 attached to List2.  If it is desired
  9861.     --| to make List1 be the new attached list the following ada code should be
  9862.     --| used.
  9863.     --|
  9864.     --| List1 := Attach (List1, List2);
  9865.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9866.     --| necessary to Attach a list to itself first make a copy of the list and
  9867.     --| attach the copy.
  9868.      
  9869.     -------------------------------------------------------------------------
  9870.      
  9871.     function Attach (                   --| prepends an element onto a list
  9872.              Element: in    Tree;   --| element being prepended to list
  9873.              L:       in    List        --| List which element is being added
  9874.                                         --| to
  9875.     ) return List;
  9876.      
  9877.     --| Effects
  9878.     --| Returns a new list which is headed by Element and followed by L.
  9879.      
  9880.     ------------------------------------------------------------------------
  9881.      
  9882.     function Attach (                  --| Adds an element to the end of a list
  9883.              L: in          List;      --| The list which element is being added to.
  9884.              Element: in    Tree   --| The element being added to the end of
  9885.                                        --| the list.
  9886.     ) return List;
  9887.      
  9888.     --| Effects
  9889.     --| Returns a new list which is L followed by Element.
  9890.      
  9891.     --------------------------------------------------------------------------
  9892.      
  9893.      
  9894.     function Copy(          --| returns a copy of list1
  9895.            L: in List       --| list being copied
  9896.     ) return List;
  9897.      
  9898.     --| Effects
  9899.     --| Returns a copy of L.
  9900.      
  9901.     --------------------------------------------------------------------------
  9902.      
  9903.      
  9904.     function Create           --| Returns an empty List
  9905.      
  9906.     return List;
  9907.      
  9908.     ------------------------------------------------------------------------------
  9909.      
  9910.     procedure DeleteHead(            --| Remove the head element from a list.
  9911.               L: in out List         --| The list whose head is being removed.
  9912.     );
  9913.      
  9914.     --| Raises
  9915.     --| EmptyList
  9916.     --|
  9917.     --| Effects
  9918.     --| This will return the space occupied by the first element in the list
  9919.     --| to the heap.  If sharing exists between lists this procedure
  9920.     --| could leave a dangling reference.  If L is empty EmptyList will be
  9921.     --| raised.
  9922.      
  9923.     ------------------------------------------------------------------------------
  9924.      
  9925.     procedure DeleteItem(           --| remove the first occurrence of Element
  9926.                                     --| from L
  9927.           L:       in out List;     --| list element is being  removed from
  9928.           Element: in     Tree  --| element being removed
  9929.     );
  9930.      
  9931.     --| Raises
  9932.     --| ItemNotPresent
  9933.      
  9934.     --| Effects
  9935.     --| Removes the first element of the list equal to Element.  If there is
  9936.     --| not an element equal to Element than ItemNotPresent is raised.
  9937.      
  9938.     --| Modifies
  9939.     --| This operation is destructive, it returns the storage occupied by
  9940.     --| the elements being deleted.
  9941.      
  9942.     ------------------------------------------------------------------------------
  9943.      
  9944.     procedure DeleteItems(          --| remove all occurrences of Element
  9945.                                     --| from  L.
  9946.           L:       in out List;     --| The List element is being removed from
  9947.           Element: in     Tree  --| element being removed
  9948.     );
  9949.      
  9950.     --| Raises
  9951.     --| ItemNotPresent
  9952.     --|
  9953.     --| Effects
  9954.     --| This procedure walks down the list L and removes all elements of the
  9955.     --| list equal to Element.  If there are not any elements equal to Element
  9956.     --| then raise ItemNotPresent.
  9957.      
  9958.     --| Modifies
  9959.     --| This operation is destructive the storage occupied by the items
  9960.     --| removed is returned.
  9961.      
  9962.     ------------------------------------------------------------------------------
  9963.      
  9964.     procedure Destroy(            --| removes the list
  9965.               L: in out List      --| the list being removed
  9966.     );
  9967.      
  9968.     --| Effects
  9969.     --| This returns to the heap all the storage that a list occupies.  Keep in
  9970.     --| mind if there exists sharing between lists then this operation can leave
  9971.     --| dangling references.
  9972.      
  9973.     ------------------------------------------------------------------------------
  9974.      
  9975.     function FirstValue(      --| returns the contents of the first record of the
  9976.                               --| list
  9977.              L: in List       --| the list whose first element is being
  9978.                               --| returned
  9979.      
  9980.     ) return Tree;
  9981.      
  9982.     --| Raises
  9983.     --| EmptyList
  9984.     --|
  9985.     --| Effects
  9986.     --| This returns the Item in the first position in the list.  If the list
  9987.     --| is empty EmptyList is raised.
  9988.      
  9989.     -------------------------------------------------------------------------------
  9990.      
  9991.     function IsEmpty(            --| Checks if a list is empty.
  9992.              L: in     List      --| List being checked.
  9993.     ) return boolean;
  9994.      
  9995.     --------------------------------------------------------------------------
  9996.      
  9997.     function IsInList(                 --| Checks if element is an element of
  9998.                                        --| list.
  9999.              L:       in     List;     --| list being scanned for element
  10000.              Element: in     Tree  --| element being searched for
  10001.     ) return boolean;
  10002.      
  10003.     --| Effects
  10004.     --| Walks down the list L looking for an element whose value is Element.
  10005.      
  10006.     ------------------------------------------------------------------------------
  10007.      
  10008.     function LastValue(       --| Returns the contents of the last record of
  10009.                               --| the list.
  10010.              L: in List       --| The list whose first element is being
  10011.                               --| returned.
  10012.     ) return Tree;
  10013.      
  10014.     --| Raises
  10015.     --| EmptyList
  10016.     --|
  10017.     --| Effects
  10018.     --| Returns the last element in a list.  If the list is empty EmptyList is
  10019.     --| raised.
  10020.      
  10021.      
  10022.     ------------------------------------------------------------------------------
  10023.      
  10024.     function Length(         --| count the number of elements on a list
  10025.              L: in List      --| list whose length is being computed
  10026.     ) return integer;
  10027.      
  10028.     ------------------------------------------------------------------------------
  10029.      
  10030.     function MakeListIter(          --| Sets a variable to point to  the head
  10031.                                     --| of the list.  This will be used to
  10032.                                     --| prepare for iteration over a list.
  10033.              L: in List             --| The list being iterated over.
  10034.     ) return ListIter;
  10035.      
  10036.      
  10037.     --| This prepares a user for iteration operation over a list.  The iterater is
  10038.     --| an operation which returns successive elements of the list on successive
  10039.     --| calls to the iterator.  There needs to be a mechanism which marks the
  10040.     --| position in the list, so on successive calls to the Next operation the
  10041.     --| next item in the list can be returned.  This is the function of the
  10042.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  10043.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  10044.     --| is updated with each call.
  10045.      
  10046.     -----------------------------------------------------------------------------
  10047.      
  10048.     function More(           --| Returns true if there are more elements in
  10049.                              --| the and false if there aren't any more
  10050.                              --| the in the list.
  10051.              L: in ListIter  --| List being checked for elements.
  10052.     ) return boolean;
  10053.      
  10054.     ------------------------------------------------------------------------------
  10055.      
  10056.     procedure Next(                 --| This is the iterator operation.  Given
  10057.                                     --| a ListIter in the list it returns the
  10058.                                     --| current item and updates the ListIter.
  10059.                                     --| If ListIter is at the end of the list,
  10060.                                     --| More returns false otherwise it
  10061.                                     --| returns true.
  10062.         Place:    in out ListIter;  --| The Iter which marks the position in
  10063.                                     --| the list.
  10064.         Info:        out Tree   --| The element being returned.
  10065.      
  10066.     );
  10067.      
  10068.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  10069.     --| in the following way:
  10070.     --|
  10071.     --|         L:        List;
  10072.     --|         Place:    ListIter;
  10073.     --|         Info:     SomeType;
  10074.     --|
  10075.     --|
  10076.     --|         Place := MakeListIter(L);
  10077.     --|
  10078.     --|         while ( More(Place) ) loop
  10079.     --|               NextList(Place, Info);
  10080.     --|               process each element of list L;
  10081.     --|               end loop;
  10082.      
  10083.      
  10084.     ----------------------------------------------------------------------------
  10085.      
  10086.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  10087.                                --| with the parameter Item.
  10088.          L:    in out List;    --| The list being modified.
  10089.          Info: in     Tree --| The information being entered.
  10090.     );
  10091.     --| Raises
  10092.     --| EmptyList
  10093.      
  10094.     --| Effects
  10095.     --| Replaces the information in the first element in the list.  Raises
  10096.     --| EmptyList if the list is empty.
  10097.      
  10098.     ------------------------------------------------------------------------------
  10099.      
  10100.     procedure ReplaceTail(           --| Replace the Tail of a list
  10101.                                      --| with a new list.
  10102.               L:       in out List;  --| List whose Tail is replaced.
  10103.               NewTail: in     List   --| The list which will become the
  10104.                                      --| tail of Oldlist.
  10105.     );
  10106.     --| Raises
  10107.     --| EmptyList
  10108.     --|
  10109.     --| Effects
  10110.     --| Replaces the tail of a list with a new list.  If the list whose tail
  10111.     --| is being replaced is null EmptyList is raised.
  10112.      
  10113.     -------------------------------------------------------------------------------
  10114.      
  10115.     function Tail(           --| returns the tail of a list L
  10116.              L: in List      --| the list whose tail is being returned
  10117.     ) return List;
  10118.      
  10119.     --| Raises
  10120.     --| EmptyList
  10121.     --|
  10122.     --| Effects
  10123.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  10124.     --| L is empty.  If L only has one element then Tail returns the Empty
  10125.     --| list.
  10126.      
  10127.     ------------------------------------------------------------------------------
  10128.      
  10129.     function Equal(            --| compares list1 and list2 for equality
  10130.              List1: in List;   --| first list
  10131.              List2: in List    --| second list
  10132.      )  return boolean;
  10133.      
  10134.     --| Effects
  10135.     --| Returns true if for all elements of List1 the corresponding element
  10136.     --| of List2 has the same value.  This function uses the Equal operation
  10137.     --| provided by the user.  If one is not provided then = is used.
  10138.      
  10139.     ------------------------------------------------------------------------------
  10140.     private
  10141.         type Cell;
  10142.      
  10143.         type List is access Cell;      --| pointer added by this package
  10144.                                        --| in order to make a list
  10145.      
  10146.      
  10147.         type Cell is                   --| Cell for the lists being created
  10148.              record
  10149.                   Info: Tree;
  10150.                   Next: List;
  10151.              end record;
  10152.      
  10153.      
  10154.         type ListIter is new List;     --| This prevents Lists being assigned to
  10155.                                        --| iterators and vice versa
  10156.      
  10157.     end NodeOrder;
  10158.      
  10159.        type TreeIter is
  10160.           record
  10161.               NodeList :NodeOrder.List;
  10162.               State    :NodeOrder.ListIter;
  10163.           end record;
  10164.      
  10165.      
  10166.     end TreePkg;
  10167.        type Set is
  10168.            record
  10169.              SetRep :TreePkg.Tree;
  10170.            end record;
  10171.      
  10172.        type SetIter is
  10173.            record
  10174.              Place :TreePkg.TreeIter;
  10175.              Count :natural;
  10176.            end record;
  10177.      
  10178.     end Literal_Set;
  10179.      
  10180.      
  10181.      
  10182.      
  10183.     -- package Literal_Set is new OrderedSets
  10184.     --           (ItemType => Source_Text.Locator, "<" => "<" );
  10185.     -- generic
  10186.     --       type ItemType is private;
  10187.     --       with function "<" ( X ,Y: in     ItemType) return boolean;
  10188.      
  10189.     type BlockInfoType is
  10190.         record
  10191.           TokenCount             :TokenCountType;
  10192.           BlockId                :BlockIdType;
  10193.           SetOfLiterals          :Literal_Set.Set;
  10194.           SetOfDEF_IDs           :DEF_ID_Set.Set;
  10195.         end record;
  10196.         --| This is the information which pertains to a particular block
  10197.         --| of the source program.  This information is pushed on
  10198.         --| a stack when an new block is encountered.  The
  10199.         --| information is a count of the tokens encountered so far
  10200.         --| and the DEF_ID's which have been found as well as the
  10201.         --| identifying information for the block.  The ListOfLiterals
  10202.         --| is a list of all literals encounter
  10203.      
  10204.     --? package BlockInfoStack is new Stacks(BlockInfoType);
  10205.     --? use StackBlockInfo;
  10206.      
  10207.      
  10208.     package BlockInfoStack is
  10209.      
  10210.      
  10211.      
  10212.      
  10213.         type stack is private;       --| The stack abstract data type.
  10214.      
  10215.      
  10216.         uninitialized_stack: exception;
  10217.             --| The initialization operations are create and copy.
  10218.      
  10219.         empty_stack: exception;
  10220.      
  10221.      
  10222.      
  10223.         function create
  10224.             return stack;
  10225.      
  10226.      
  10227.         procedure push(s: in out stack;
  10228.                        e:        BlockInfoType);
  10229.      
  10230.      
  10231.         procedure pop(s: in out stack);
  10232.      
  10233.      
  10234.         procedure pop(s: in out stack;
  10235.                       e: out    BlockInfoType);
  10236.      
  10237.      
  10238.         function copy(s: stack)
  10239.             return stack;
  10240.      
  10241.      
  10242.      
  10243.      
  10244.         function top(s: stack)
  10245.             return BlockInfoType;
  10246.      
  10247.      
  10248.         function size(s: stack)
  10249.             return natural;
  10250.      
  10251.      
  10252.         function is_empty(s: stack)
  10253.             return boolean;
  10254.      
  10255.      
  10256.      
  10257.      
  10258.         procedure destroy(s: in out stack);
  10259.      
  10260.      
  10261.      
  10262.     private
  10263.         package Lists is
  10264.      
  10265.      
  10266.      
  10267.      
  10268.      
  10269.      
  10270.                   type List       is private;
  10271.                   type ListIter   is private;
  10272.      
  10273.      
  10274.      
  10275.             CircularList     :exception;     --| Raised if an attemp is made to
  10276.                                              --| create a circular list.  This
  10277.                                              --| results when a list is attempted
  10278.                                              --| to be attached to itself.
  10279.      
  10280.             EmptyList        :exception;     --| Raised if an attemp is made to
  10281.                                              --| manipulate an empty list.
  10282.      
  10283.             ItemNotPresent   :exception;     --| Raised if an attempt is made to
  10284.                                              --| remove an element from a list in
  10285.                                              --| which it does not exist.
  10286.      
  10287.             NoMore           :exception;     --| Raised if an attemp is made to
  10288.                                              --| get the next element from a list
  10289.                                              --| after iteration is complete.
  10290.      
  10291.      
  10292.      
  10293.      
  10294.      
  10295.         procedure Attach(                  --| appends List2 to List1
  10296.                   List1:     in out List;  --| The list being appended to.
  10297.                   List2:     in     List   --| The list being appended.
  10298.         );
  10299.      
  10300.      
  10301.      
  10302.      
  10303.      
  10304.         function Attach(                 --| Creates a new list containing the two
  10305.                                          --| Elements.
  10306.                  Element1: in BlockInfoType;  --| This will be first element in list.
  10307.                  Element2: in BlockInfoType   --| This will be second element in list.
  10308.         ) return List;
  10309.      
  10310.      
  10311.         procedure Attach(                   --| List L is appended with Element.
  10312.                  L:       in out List;      --| List being appended to.
  10313.                  Element: in     BlockInfoType   --| This will be last element in l    ist.
  10314.         );
  10315.      
  10316.      
  10317.         procedure Attach(                   --| Makes Element first item in list L.
  10318.                  Element: in      BlockInfoType; --| This will be the first element in list.
  10319.                  L:       in  out List      --| The List which Element is being
  10320.                                             --| prepended to.
  10321.         );
  10322.      
  10323.      
  10324.      
  10325.         function Attach (                      --| attaches two lists
  10326.                  List1: in     List;           --| first list
  10327.                  List2: in     List            --| second list
  10328.         ) return List;
  10329.      
  10330.      
  10331.      
  10332.      
  10333.         function Attach (                   --| prepends an element onto a list
  10334.                  Element: in    BlockInfoType;   --| element being prepended to list
  10335.                  L:       in    List        --| List which element is being added
  10336.                                             --| to
  10337.         ) return List;
  10338.      
  10339.      
  10340.      
  10341.         function Attach (                  --| Adds an element to the end of a list
  10342.                  L: in          List;      --| The list which element is being added to.
  10343.                  Element: in    BlockInfoType   --| The element being added to the end of
  10344.                                            --| the list.
  10345.         ) return List;
  10346.      
  10347.      
  10348.      
  10349.      
  10350.         function Copy(          --| returns a copy of list1
  10351.                L: in List       --| list being copied
  10352.         ) return List;
  10353.      
  10354.      
  10355.      
  10356.      
  10357.      
  10358.         function Create           --| Returns an empty List
  10359.      
  10360.         return List;
  10361.      
  10362.      
  10363.         procedure DeleteHead(            --| Remove the head element from a list.
  10364.                   L: in out List         --| The list whose head is being removed.
  10365.         );
  10366.      
  10367.      
  10368.      
  10369.         procedure DeleteItem(           --| remove the first occurrence of Element
  10370.                                         --| from L
  10371.               L:       in out List;     --| list element is being  removed from
  10372.               Element: in     BlockInfoType  --| element being removed
  10373.         );
  10374.      
  10375.      
  10376.      
  10377.      
  10378.      
  10379.         procedure DeleteItems(          --| remove all occurrences of Element
  10380.                                         --| from  L.
  10381.               L:       in out List;     --| The List element is being removed from
  10382.               Element: in     BlockInfoType  --| element being removed
  10383.         );
  10384.      
  10385.      
  10386.      
  10387.      
  10388.         procedure Destroy(            --| removes the list
  10389.                   L: in out List      --| the list being removed
  10390.         );
  10391.      
  10392.      
  10393.      
  10394.         function FirstValue(      --| returns the contents of the first record of the
  10395.                                   --| list
  10396.                  L: in List       --| the list whose first element is being
  10397.                                   --| returned
  10398.      
  10399.         ) return BlockInfoType;
  10400.      
  10401.      
  10402.      
  10403.         function IsEmpty(            --| Checks if a list is empty.
  10404.                  L: in     List      --| List being checked.
  10405.         ) return boolean;
  10406.      
  10407.      
  10408.         function IsInList(                 --| Checks if element is an element of
  10409.                                            --| list.
  10410.                  L:       in     List;     --| list being scanned for element
  10411.                  Element: in     BlockInfoType  --| element being searched for
  10412.         ) return boolean;
  10413.      
  10414.      
  10415.      
  10416.         function LastValue(       --| Returns the contents of the last record of
  10417.                                   --| the list.
  10418.                  L: in List       --| The list whose first element is being
  10419.                                   --| returned.
  10420.         ) return BlockInfoType;
  10421.      
  10422.      
  10423.      
  10424.      
  10425.         function Length(         --| count the number of elements on a list
  10426.                  L: in List      --| list whose length is being computed
  10427.         ) return integer;
  10428.      
  10429.      
  10430.         function MakeListIter(          --| Sets a variable to point to  the head
  10431.                                         --| of the list.  This will be used to
  10432.                                         --| prepare for iteration over a list.
  10433.                  L: in List             --| The list being iterated over.
  10434.         ) return ListIter;
  10435.      
  10436.      
  10437.      
  10438.      
  10439.         function More(           --| Returns true if there are more elements in
  10440.                                  --| the and false if there aren't any more
  10441.                                  --| the in the list.
  10442.                  L: in ListIter  --| List being checked for elements.
  10443.         ) return boolean;
  10444.      
  10445.      
  10446.         procedure Next(                 --| This is the iterator operation.  Given
  10447.                                         --| a ListIter in the list it returns the
  10448.                                         --| current item and updates the ListIter.
  10449.                                         --| If ListIter is at the end of the list,
  10450.                                         --| More returns false otherwise it
  10451.                                         --| returns true.
  10452.             Place:    in out ListIter;  --| The Iter which marks the position in
  10453.                                         --| the list.
  10454.             Info:        out BlockInfoType   --| The element being returned.
  10455.      
  10456.         );
  10457.      
  10458.      
  10459.      
  10460.      
  10461.         procedure ReplaceHead(     --| Replace the Item at the head of the list
  10462.                                    --| with the parameter Item.
  10463.              L:    in out List;    --| The list being modified.
  10464.              Info: in     BlockInfoType --| The information being entered.
  10465.         );
  10466.      
  10467.      
  10468.      
  10469.         procedure ReplaceTail(           --| Replace the Tail of a list
  10470.                                          --| with a new list.
  10471.                   L:       in out List;  --| List whose Tail is replaced.
  10472.                   NewTail: in     List   --| The list which will become the
  10473.                                          --| tail of Oldlist.
  10474.         );
  10475.      
  10476.      
  10477.         function Tail(           --| returns the tail of a list L
  10478.                  L: in List      --| the list whose tail is being returned
  10479.         ) return List;
  10480.      
  10481.      
  10482.      
  10483.         function Equal(            --| compares list1 and list2 for equality
  10484.                  List1: in List;   --| first list
  10485.                  List2: in List    --| second list
  10486.          )  return boolean;
  10487.      
  10488.      
  10489.         private
  10490.             type Cell;
  10491.      
  10492.             type List is access Cell;      --| pointer added by this package
  10493.                                            --| in order to make a list
  10494.      
  10495.      
  10496.             type Cell is                   --| Cell for the lists being created
  10497.                  record
  10498.                       Info: BlockInfoType;
  10499.                       Next: List;
  10500.                  end record;
  10501.      
  10502.      
  10503.             type ListIter is new List;     --| This prevents Lists being assigned to
  10504.                                            --| iterators and vice versa
  10505.      
  10506.         end Lists;
  10507.      
  10508.             subtype elem_list is lists.list;
  10509.      
  10510.         type stack_rec is
  10511.             record
  10512.                 size: natural := 0;
  10513.                 elts: elem_list;
  10514.             end record;
  10515.      
  10516.         type stack is access stack_rec;
  10517.      
  10518.      
  10519.     end BlockInfoStack;
  10520.      
  10521.      
  10522. end Definitions;
  10523. ::::::::::::::
  10524. ftpme
  10525. ::::::::::::::
  10526. ::::::::::::::
  10527. halstead.ada
  10528. ::::::::::::::
  10529.  
  10530. -------SPEC---------------------------------------------------------------
  10531. function Halstead return INTEGER; 
  10532.  
  10533. -------BODY---------------------------------------------------------------
  10534.  
  10535. with STRING_LISTS; 
  10536. with COMMANDLINE;
  10537. with STANDARD_INTERFACE; 
  10538. with STRING_PKG; 
  10539. with TEXT_IO; use TEXT_IO;
  10540. with HOST_LIB; 
  10541. with ST_DIANA;
  10542. with PROGRAMLIBRARY;
  10543. with COMP_UNIT_CLASS_PKG;
  10544. with DEFINITIONS;
  10545. with HALSTEAD_DATA_BASE;
  10546. --xx with FILE_MANAGER;
  10547.  
  10548. function Halstead return INTEGER is 
  10549.  
  10550.   package CL renames COMMANDLINE;
  10551.   package SI renames STANDARD_INTERFACE;
  10552.   package SL renames STRING_LISTS; 
  10553.   package SP renames STRING_PKG; 
  10554.   package D  renames DEFINITIONS;
  10555.   package PL renames PROGRAMLIBRARY;
  10556.   package HDB renames HALSTEAD_DATA_BASE; 
  10557. --xx  package FM renames FILE_MANAGER;
  10558.  
  10559.   package STRINGTYPE is new SI.STRING_ARGUMENT("string"); 
  10560.   package UNIT_LIST_PKG is new SI.STRING_LIST_ARGUMENT(
  10561.     STRING_TYPE_NAME => "string_type",
  10562.     STRING_TYPE_LIST => "string_list"); 
  10563.  
  10564.   dd_name    : string(1..200);
  10565.   dd_Last    : natural;
  10566.   dd_changed : boolean;
  10567.   pl_name    : string(1..200);
  10568.   pl_last    : natural;
  10569.  
  10570.   HALSTEAD   : SI.PROCESS_HANDLE; 
  10571.   library_Name : SP.string_type;
  10572.   OUTPUT_FILE: FILE_TYPE;
  10573.   output_File_Name  : sp.string_type;    
  10574.   unit_list  : SL.LIST; 
  10575.   ITER       : SL.LISTITER; 
  10576.   unit_Name    : sp.string_type;            
  10577.   ToTerminal : boolean;
  10578.   verbose    : boolean;       
  10579.   Unit_SD    : PL.Subdomain_Type;
  10580.   COMP_UNIT_Locator: ST_DIANA.COMP_UNIT_CLASS.Locator;
  10581.   UnitPosition : natural := 1;
  10582.  
  10583. begin  -- driver
  10584.  
  10585.   HOST_LIB.SET_ERROR; 
  10586.  
  10587.   SI.set_tool_identifier ("1.0");
  10588.   STANDARD_INTERFACE.DEFINE_PROCESS(PROC => Halstead,
  10589.     NAME => "Halstead", 
  10590.     HELP => "Computes Halstead formulas for Ada compilation units."); 
  10591.     
  10592.   UNIT_LIST_PKG.DEFINE_ARGUMENT(PROC => HALSTEAD,
  10593.     NAME => "Units",
  10594.     DEFAULT => SL.CREATE,
  10595.     HELP => "Names of the compilation units"); 
  10596.  
  10597.   Stringtype.DEFINE_ARGUMENT(PROC => halstead, 
  10598.     NAME => "Output", 
  10599.     DEFAULT => "", 
  10600.     HELP => "Name of the report file (defaults to standard output)"); 
  10601.  
  10602.   STRINGTYPE.DEFINE_ARGUMENT(PROC => HALSTEAD,
  10603.     NAME => "library", DEFAULT => "[.BYRONLIB]",
  10604.     Help => "Name of an Ada program library (NYI)");
  10605.  
  10606.   SI.DEFINE_PROCESS_HELP(PROC => halstead,
  10607.     HELP => "Computes Halstead formulas for Ada compilation units"); 
  10608.  
  10609.   STANDARD_INTERFACE.PARSE_LINE(halstead); 
  10610.  
  10611.   unit_list := unit_LIST_pkg.GET_ARGUMENT(PROC => halstead, NAME => "units"); 
  10612.   library_Name := stringtype.get_argument(proc => halstead, name => "library");
  10613.   output_File_Name := 
  10614.         STRINGTYPE.GET_ARGUMENT(PROC => halstead, NAME => "output"); 
  10615.   verbose := FALSE;
  10616.  
  10617.  
  10618.    if sp.equal(output_File_Name, "") then
  10619.  
  10620.     -- No file name given: output is to the terminal
  10621.     Set_Output(STANDARD_OUTPUT);
  10622.     ToTerminal := true;
  10623.  
  10624.    else
  10625.     -- Create the specified output file
  10626.     create(File => Output_File,
  10627.                Mode => Out_File,
  10628.                Name => sp.value(output_File_Name),
  10629.                Form => ""
  10630.              );
  10631.         Set_Output(Output_File);
  10632.         ToTerminal := false;
  10633.  
  10634.    end if;
  10635.  
  10636.     -- Connect to the program library directory:
  10637. --xx    FM.Show_and_Set_Default(dd_name,dd_last,dd_changed,SP.Value(library_Name));
  10638. --xx    if not dd_changed then
  10639. --xx    Put_Line("?? Cannot connect to program library.");
  10640. --xx    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10641. --xx    end if;
  10642.      
  10643.     -- Open the catalog.  This is the program library which contains
  10644.     -- the library units which the user is performing the Halstead
  10645.     -- Complexity Measures on.
  10646.  
  10647.    PL.Open_catalog;
  10648.    ST_DIANA.NEWDOMAIN (PL.Get_Primary_Context, PL.Get_Secondary_Context);
  10649.  
  10650.      -- Get each library unit which the user is performing the metric on.
  10651.      -- For each unit get its COMP_UNIT_CLASS.Locator which is the handle
  10652.      -- to the beginning of the DIANA for the unit.  Pass the Locator
  10653.      -- to the bonsai tree walk routine which computes the metrics.
  10654.  
  10655.    ITER := SL.MAKELISTITER(UNIT_LIST);
  10656.    while SL.MORE(ITER) loop
  10657.     SL.next(iter, unit_Name);
  10658.      
  10659.     -- Check to see if the unit specified is a SubUnit.
  10660.      
  10661.     if cl.IsSubUnit(SP.Value(unit_Name), unitposition) then
  10662.       begin
  10663.         Unit_SD := PL.Open_Subdomain(
  10664.             ST_Diana.TheDomain,
  10665.             PL.DIANA_Form,
  10666.             PL.SubUnit_Ident (
  10667.                 CL.GetParent (sp.value(unit_Name), UnitPosition) ,
  10668.                 CL.GetSubUnit (sp.value(unit_Name), UnitPosition),
  10669.                 IsStub => false
  10670.             ));
  10671.       exception
  10672.         when PL.Object_Not_Up_To_Date =>
  10673.         Put(Standard_Output, "%% WARNING: ");
  10674.         Put(Standard_Output, "Subunit " & SP.Value(unit_Name));
  10675.         Put_Line(Standard_Output, " not found");
  10676.       end;
  10677.       -- Pass the necessary data to the Utilities package.
  10678.       HDB.InitializeData(
  10679.                            LibraryUnit    => SP.Value(unit_Name),
  10680.                            IsUnitSpec     => false,
  10681.                            VerboseFlag    => Verbose,
  10682.                            ToTerminalFlag => ToTerminal,
  10683.                            OuterMostBlockFlag => false
  10684.                            );
  10685.      
  10686.       -- If writing to an output file then generate a
  10687.       -- report header.  If writing to the terminal a header is
  10688.       -- generated in the utilities package.
  10689.      
  10690.       if not ToTerminal then
  10691.         HDB.ReportHeader (SP.Value(unit_Name), Spec => false);
  10692.       end if;
  10693.      
  10694.       -- Get the actual locator for the library unit.
  10695.      
  10696.       COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  10697.      
  10698.       -- Now that we have the locator scan the diana which
  10699.       -- the locator points to.
  10700.      
  10701.       COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  10702.     else
  10703.       -- For any library unit which is not a subunit this
  10704.       -- loop scans both the specification (implicit as well
  10705.       -- as explicit) and the body of the unit.
  10706.      
  10707.       for IsSpec in reverse false..true loop
  10708.         -- Open the Subdomain.
  10709.         begin
  10710.           Unit_SD := PL.Open_Subdomain(
  10711.             ST_Diana.TheDomain,
  10712.             PL.DIANA_Form,
  10713.             PL.Library_Unit_Ident (
  10714.                 SP.Value(unit_Name),
  10715.                 IsSpec
  10716.             ));
  10717.      
  10718.           -- Pass the data to the utilities package.
  10719.           HDB.InitializeData(
  10720.             LibraryUnit    => SP.Value(unit_Name),
  10721.             IsUnitSpec     => IsSpec,
  10722.             VerboseFlag    => Verbose,
  10723.             ToTerminalFlag => ToTerminal,
  10724.             OuterMostBlockFlag => false
  10725.             );
  10726.      
  10727.           if not ToTerminal then
  10728.         HDB.ReportHeader (SP.Value(unit_Name), IsSpec);
  10729.           end if;
  10730.      
  10731.           -- Get the locator to the library unit.
  10732.           COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  10733.      
  10734.           -- Perform the scan on the diana which the locator points to.
  10735.           COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  10736.      
  10737.           -- Catch the exception when attempting to open either
  10738.           -- implicit spec or body.
  10739.         exception
  10740.         when PL.Object_Not_Up_To_Date  =>
  10741.           Put_Line(Standard_Output, "%% WARNING: ");
  10742.           if IsSpec then
  10743.             Put(Standard_Output, "The spec of ");
  10744.           else
  10745.             Put(Standard_Output, "The body of ");
  10746.           end if;
  10747.           Put(Standard_Output, "Unit " & SP.Value(unit_Name));
  10748.           Put_Line(Standard_Output, " does not exist");
  10749.         end;
  10750.       end loop;
  10751.     end if;
  10752.     end loop;
  10753.      
  10754. --xx    FM.Show_and_Set_Default(pl_name, pl_last, dd_changed, dd_name(1..dd_last));
  10755.     return HOST_LIB.RETURN_CODE(HOST_LIB.SUCCESS); 
  10756.  
  10757. exception
  10758.  
  10759.   when STANDARD_INTERFACE.PROCESS_HELP => 
  10760.     return HOST_LIB.RETURN_CODE(HOST_LIB.INFORMATION); 
  10761.  
  10762.   when STANDARD_INTERFACE.ABORT_PROCESS => 
  10763.     return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10764.  
  10765. --  when others => 
  10766. --    TEXT_IO.PUT_LINE("internal error"); 
  10767. --    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10768.  
  10769. end Halstead; 
  10770. ::::::::::::::
  10771. halstead.obj
  10772. ::::::::::::::
  10773. ADA$ELAB_HALSTEAD01 4-Mar-1986 08:55                 VAX Ada V1.1-10y<    nADA$ELAB_HALSTEAD}>nADA$ELAB_HALSTEADPHALSTEAD STRING_LISTS STRING_PKG_
  10774. STRING_PKGLISTS COMMANDLINE_ COMMANDLINESTANDARD_INTERFACE_STANDARD_INTERFACE
  10775. INTEGER_LISTSPAGINATED_OUTPUT_PAGINATED_OUTPUTTEXT_IO_TEXT_IOIO_EXCEPTIONS_    HOST_LIB_HOST_LIB    ST_DIANA_ST_DIANAML_SOURCE_POSITION_PKG_ML_SOURCE_POSITION_PKGFE_TEMPORARY_ATTRIBUTES_ML_MACHINE_DATA_PKG_TGT_ML_TARGET_CONSTANTS_TGT_ML_TARGET_CONSTANTSML_STORAGE_DIMENSION_PKG_ML_STORAGE_DIMENSION_PKG VMMTEXTPKG_
  10776. VMMTEXTPKG
  10777. VMMSYSTEMPKG_ VMMSYSTEMPKGML_VMM_LOCATOR_PKG_VSUTILS_VSUTILSVSDECLARATIONS_ VMMBASICPKG_ VMMBASICPKGPAGE_IO    DIRECT_IOVMMPAGE_HIF_NODE_DEFS_    HIF_DEFS_HIF_FAKE_NODE_HANDLES_HIF_FAKE_NODE_HANDLESHIF_LIST_UTILS_HIF_LIST_UTILSHIF_TEXT_UTILS_HIF_TEXT_UTILS VMMTYPESPKG_ VMMTYPESPKGPROGRAMLIBRARY_PROGRAMLIBRARYHIF_HOST_FILE_MANAGEMENT_HIF_HOST_FILE_MANAGEMENTHIF_HOST_FILE_DEFS_ PLIF_UTILS_
  10778. PLIF_UTILSLIBRARY_CATALOG_DEFS_LIBRARY_COMPILATION_MANAGER_LIBRARY_COMPILATION_MANAGERHIF_NODE_MANAGEMENT_HIF_NODE_MANAGEMENTHIF_SIMPLE_OBJECT_MANAGER_HIF_SIMPLE_OBJECT_MANAGERHIF_RELATIONSHIP_NAMES_HIF_RELATIONSHIP_NAMES HIF_STRINGS_ HIF_STRINGSHIF_IDENTIFIERS_HIF_IDENTIFIERSHIF_PARTITION_MANAGER_HIF_PARTITION_MANAGERHIF_PARTITION_ELEMENTS_HIF_PARTITION_ELEMENTSHOST_BIN_KEYED_IO_TYPES_HIF_KEYED_IO_DEFS_ RELATIVE_IOAUX_IO_EXCEPTIONS_HIF_PARTITION_MAPPING_HIF_PARTITION_MAPPING
  10779. HIF_KEYED_IO_ HIF_KEYED_IOBIN_KEYED_IO_BLOCKS_BIN_KEYED_IO_BLOCKS
  10780. HOST_PAGE_IO_ HOST_PAGE_IOBIN_KEYED_IO_UTILITIES_BIN_KEYED_IO_UTILITIESHIF_IDENTIFIER_PATTERNS_HIF_IDENTIFIER_PATTERNSLIBRARY_UNIT_DEFS_LIBRARY_IDENTIFICATION_MANAGER_LIBRARY_IDENTIFICATION_MANAGERLIBRARY_IDENT_MANAGER_LIBRARY_IDENT_MANAGERCOMP_UNIT_CLASS_PKG_COMP_UNIT_CLASS_PKG DEFINITIONS_ DEFINITIONSHALSTEAD_DATA_BASE_HALSTEAD_DATA_BASESTRING_UTILITIES_STRING_UTILITIES    STACK_PKGSET_PKGADA$U008E7F1B30B92E00_00000097ADA$U008E7F1B30B92E00_0000009AINT_IO    CALENDAR_CALENDARSTARLET_CONDITION_HANDLING_CONDITION_HANDLINGT_370_ML_TARGET_CONSTANTS_T_1750A_ML_TARGET_CONSTANTS_T_PRIME_ML_TARGET_CONSTANTS_T_SPERRY_ML_TARGET_CONSTANTS_TGT_ML_TARGET_SWITCH_TGT_ML_TARGET_SWITCH
  10781. HIF_DEBUG_    HIF_DEBUG PARAMETERS_
  10782. PARAMETERS PLIF_DEBUG_
  10783. PLIF_DEBUGADA$U008E192A5B0FDC00_00000502LIBRARY_CONFIGURATION_INTERFACELIBRARY_COLLECTION_DEFS_LIBRARY_DEPENDENCY_MANAGER_LIBRARY_DEPENDENCY_MANAGERHIF_NODE_HANDLES_HIF_NODE_HANDLESHOST_SYSTEM_CALLS_HOST_SYSTEM_CALLSHIF_PRS_ATTRIBUTES_HIF_PRS_ATTRIBUTESPLIF_NAME_DEFS_HIF_PATH_NAMES_HIF_PATH_NAMESHIF_ATTRIBUTES_HIF_ATTRIBUTESHIF_KEY_GENERATOR_HIF_KEY_GENERATORHIF_KEYED_IO_LOCALS_HIF_KEYED_IO_LOCALSHIF_RELATIVE_PATHS_PLIF_ATTRIBUTE_NAMES_    ITEM_PKG_ITEM_PKG COUNT_TYPES_ COUNT_TYPESCOUNT_COUNT BOOTOPTIONS_ BOOTOPTIONSPLIF_DEPENDENCY_UTILS_PLIF_DEPENDENCY_UTILSHIF_BIG_ATTRIBUTES_HIF_BIG_ATTRIBUTESUP_TO_DATE_CACHE_PKG_UP_TO_DATE_CACHE_PKGHIF_NODE_INFO_DIOSERIES_UNIT_IH_VARIABLE_DECL_IH_SUBTYPE_DECL_IH_
  10784. TASK_DECL_IH_
  10785. TYPE_DECL_IH_GENERIC_HEADER_CLASS_PKG_GENERIC_HEADER_CLASS_PKG DEF_ID_PKG_
  10786. DEF_ID_PKG PKG_DEF_PKG_ PKG_DEF_PKG HEADER_PKG_
  10787. HEADER_PKGOBJECT_TYPE_PKG_OBJECT_TYPE_PKGOBJECT_DEF_PKG_OBJECT_DEF_PKG
  10788. NAME_EXP_PKG_ NAME_EXP_PKGCONSTRAINT_PKG_CONSTRAINT_PKG
  10789. SUBP_DEF_PKG_ SUBP_DEF_PKGGENERAL_ASSOC_PKG_GENERAL_ASSOC_PKGBLOCK_STUB_PKG_BLOCK_STUB_PKGTYPE_SPEC_PKG_
  10790. TYPE_SPEC_PKGGENERIC_HEADER_IH_IDENTIFIER_UTILITIES_IDENTIFIER_UTILITIESAGG_COMPONENT_PKG_AGG_COMPONENT_PKGSTM_PKG_STM_PKGALTERNATIVE_PKG_ALTERNATIVE_PKG
  10791. BLOCK_STM_IH_SOURCE_POSITION_UTILITIES_SOURCE_POSITION_UTILITIESINNER_RECORD_CLASS_PKG_INNER_RECORD_CLASS_PKG
  10792. AGG_NAMED_IH_ CHOICE_PKG_
  10793. CHOICE_PKGITERATION_PKG_
  10794. ITERATION_PKGBLOCK_UTILITIES_BLOCK_UTILITIESCASE_ALTERNATIVE_IH_HANDLER_ALTERNATIVE_IH_INNER_RECORD_IH_VARIANT_ALTERNATIVE_CLASS_PKG_VARIANT_ALTERNATIVE_CLASS_PKGVMMADDRESSARITHMETIC_VMMADDRESSARITHMETICPLIF_OBJECT_COUNT_UTILS_PLIF_OBJECT_COUNT_UTILS
  10795. ADA$ELAB_HALSTEAD|{    HALSTEADHALSTEADw/
  10796. ]\{ADA$INIT_COMPONENT~P
  10797.     
  10798. LISTS$ELAB
  10799. LISTS$ELAB    IO_EXCEPTIONS_$ELABIO_EXCEPTIONS_$ELAB    ML_SOURCE_POSITION_PKG_$ELABML_SOURCE_POSITION_PKG_$ELAB    ML_SOURCE_POSITION_PKG$ELABML_SOURCE_POSITION_PKG$ELAB    FE_TEMPORARY_ATTRIBUTES_$ELABFE_TEMPORARY_ATTRIBUTES_$ELAB    ML_VMM_LOCATOR_PKG_$ELABML_VMM_LOCATOR_PKG_$ELAB    "VSDECLARATIONS_$ELAB"VSDECLARATIONS_$ELAB    '
  10800. VMMPAGE_$ELAB'
  10801. VMMPAGE_$ELAB    )HIF_DEFS_$ELAB)HIF_DEFS_$ELAB    *HIF_FAKE_NODE_HANDLES_$ELAB*HIF_FAKE_NODE_HANDLES_$ELAB    +HIF_FAKE_NODE_HANDLES$ELAB+HIF_FAKE_NODE_HANDLES$ELAB    BHIF_STRINGS_$ELABBHIF_STRINGS_$ELAB    CHIF_STRINGS$ELABCHIF_STRINGS$ELAB    MAUX_IO_EXCEPTIONS_$ELABMAUX_IO_EXCEPTIONS_$ELAB    iADA$U008E7F1B30B92E00_00000097$iADA$U008E7F1B30B92E00_00000097$    jADA$U008E7F1B30B92E00_0000009A$jADA$U008E7F1B30B92E00_0000009A$    oCONDITION_HANDLING_$ELABoCONDITION_HANDLING_$ELAB    pCONDITION_HANDLING$ELABpCONDITION_HANDLING$ELAB    qT_370_ML_TARGET_CONSTANTS_$ELABqT_370_ML_TARGET_CONSTANTS_$ELAB    rT_1750A_ML_TARGET_CONSTANTS_$ELrT_1750A_ML_TARGET_CONSTANTS_$EL    sT_PRIME_ML_TARGET_CONSTANTS_$ELsT_PRIME_ML_TARGET_CONSTANTS_$EL    tT_SPERRY_ML_TARGET_CONSTANTS_$EtT_SPERRY_ML_TARGET_CONSTANTS_$E    
  10802. HIF_KEY_GENERATOR_$ELAB
  10803. HIF_KEY_GENERATOR_$ELAB    HIF_KEY_GENERATOR$ELABHIF_KEY_GENERATOR$ELAB    gSTACK_PKG$ELABgSTACK_PKG$ELAB        INTEGER_LISTS$ELAB    INTEGER_LISTS$ELAB    h SET_PKG$ELABh SET_PKG$ELAB    &DIRECT_IO$ELAB&DIRECT_IO$ELAB    
  10804. TEXT_IO_$ELAB
  10805. TEXT_IO_$ELAB    
  10806. TEXT_IO$ELAB
  10807. TEXT_IO$ELAB    JSOURCE_POSITION_UTILITIES_$ELABJSOURCE_POSITION_UTILITIES_$ELAB    KSOURCE_POSITION_UTILITIES$ELABKSOURCE_POSITION_UTILITIES$ELAB    ZVMMADDRESSARITHMETIC_$ELABZVMMADDRESSARITHMETIC_$ELAB    [VMMADDRESSARITHMETIC$ELAB[VMMADDRESSARITHMETIC$ELAB    KHIF_KEYED_IO_DEFS_$ELABKHIF_KEYED_IO_DEFS_$ELAB    6HIF_HOST_FILE_DEFS_$ELAB6HIF_HOST_FILE_DEFS_$ELAB    (HIF_NODE_DEFS_$ELAB(HIF_NODE_DEFS_$ELAB    DHIF_IDENTIFIERS_$ELABDHIF_IDENTIFIERS_$ELAB    EHIF_IDENTIFIERS$ELABEHIF_IDENTIFIERS$ELAB    LRELATIVE_IO$ELABLRELATIVE_IO$ELAB    n
  10808. STARLET_$ELABn
  10809. STARLET_$ELAB    STRING_PKG_$ELABSTRING_PKG_$ELAB    STRING_PKG$ELABSTRING_PKG$ELAB    "DIO$ELAB"DIO$ELAB    % PAGE_IO$ELAB% PAGE_IO$ELAB    k INT_IO$ELABk INT_IO$ELAB    .HIF_TEXT_UTILS_$ELAB.HIF_TEXT_UTILS_$ELAB    /HIF_TEXT_UTILS$ELAB/HIF_TEXT_UTILS$ELAB    VMMTEXTPKG_$ELABVMMTEXTPKG_$ELAB    VMMTEXTPKG$ELABVMMTEXTPKG$ELAB    PLIF_ATTRIBUTE_NAMES_$ELABPLIF_ATTRIBUTE_NAMES_$ELAB    PLIF_NAME_DEFS_$ELABPLIF_NAME_DEFS_$ELAB    XHIF_IDENTIFIER_PATTERNS_$ELABXHIF_IDENTIFIER_PATTERNS_$ELAB    YHIF_IDENTIFIER_PATTERNS$ELABYHIF_IDENTIFIER_PATTERNS$ELAB    @HIF_RELATIONSHIP_NAMES_$ELAB@HIF_RELATIONSHIP_NAMES_$ELAB    AHIF_RELATIONSHIP_NAMES$ELABAHIF_RELATIONSHIP_NAMES$ELAB    JHOST_BIN_KEYED_IO_TYPES_$ELABJHOST_BIN_KEYED_IO_TYPES_$ELAB    lCALENDAR_$ELABlCALENDAR_$ELAB    m
  10810. CALENDAR$ELABm
  10811. CALENDAR$ELAB    STRING_LISTS$ELABSTRING_LISTS$ELAB    COMMANDLINE_$ELABCOMMANDLINE_$ELAB    COMMANDLINE$ELABCOMMANDLINE$ELAB    BOOTOPTIONS_$ELABBOOTOPTIONS_$ELAB    BOOTOPTIONS$ELABBOOTOPTIONS$ELAB    ZLIBRARY_UNIT_DEFS_$ELABZLIBRARY_UNIT_DEFS_$ELAB     
  10812. VSUTILS_$ELAB 
  10813. VSUTILS_$ELAB    ! VSUTILS$ELAB! VSUTILS$ELAB    eSTRING_UTILITIES_$ELABeSTRING_UTILITIES_$ELAB    fSTRING_UTILITIES$ELABfSTRING_UTILITIES$ELAB    HOST_SYSTEM_CALLS_$ELABHOST_SYSTEM_CALLS_$ELAB    HOST_SYSTEM_CALLS$ELABHOST_SYSTEM_CALLS$ELAB    yPARAMETERS_$ELAByPARAMETERS_$ELAB    zPARAMETERS$ELABzPARAMETERS$ELAB    VMMSYSTEMPKG_$ELABVMMSYSTEMPKG_$ELAB    VMMSYSTEMPKG$ELABVMMSYSTEMPKG$ELAB    HOST_LIB_$ELABHOST_LIB_$ELAB    
  10814. HOST_LIB$ELAB
  10815. HOST_LIB$ELAB    
  10816. PAGINATED_OUTPUT_$ELAB
  10817. PAGINATED_OUTPUT_$ELAB     PAGINATED_OUTPUT$ELAB PAGINATED_OUTPUT$ELAB    {PLIF_DEBUG_$ELAB{PLIF_DEBUG_$ELAB    |PLIF_DEBUG$ELAB|PLIF_DEBUG$ELAB    wHIF_DEBUG_$ELABwHIF_DEBUG_$ELAB    xHIF_DEBUG$ELABxHIF_DEBUG$ELAB    uTGT_ML_TARGET_SWITCH_$ELABuTGT_ML_TARGET_SWITCH_$ELAB    vTGT_ML_TARGET_SWITCH$ELABvTGT_ML_TARGET_SWITCH$ELAB    STANDARD_INTERFACE_$ELABSTANDARD_INTERFACE_$ELAB    STANDARD_INTERFACE$ELABSTANDARD_INTERFACE$ELAB    ]LIBRARY_IDENT_MANAGER_$ELAB]LIBRARY_IDENT_MANAGER_$ELAB    ^LIBRARY_IDENT_MANAGER$ELAB^LIBRARY_IDENT_MANAGER$ELAB    THOST_PAGE_IO_$ELABTHOST_PAGE_IO_$ELAB    UHOST_PAGE_IO$ELABUHOST_PAGE_IO$ELAB        HIF_PATH_NAMES_$ELAB    HIF_PATH_NAMES_$ELAB    
  10818. HIF_PATH_NAMES$ELAB
  10819. HIF_PATH_NAMES$ELAB    HHIF_PARTITION_ELEMENTS_$ELABHHIF_PARTITION_ELEMENTS_$ELAB    IHIF_PARTITION_ELEMENTS$ELABIHIF_PARTITION_ELEMENTS$ELAB    ,HIF_LIST_UTILS_$ELAB,HIF_LIST_UTILS_$ELAB    -HIF_LIST_UTILS$ELAB-HIF_LIST_UTILS$ELAB    TGT_ML_TARGET_CONSTANTS_$ELABTGT_ML_TARGET_CONSTANTS_$ELAB    TGT_ML_TARGET_CONSTANTS$ELABTGT_ML_TARGET_CONSTANTS$ELAB    RBIN_KEYED_IO_BLOCKS_$ELABRBIN_KEYED_IO_BLOCKS_$ELAB    SBIN_KEYED_IO_BLOCKS$ELABSBIN_KEYED_IO_BLOCKS$ELAB    LIBRARY_COLLECTION_DEFS_$ELABLIBRARY_COLLECTION_DEFS_$ELAB    9LIBRARY_CATALOG_DEFS_$ELAB9LIBRARY_CATALOG_DEFS_$ELAB    ML_STORAGE_DIMENSION_PKG_$ELABML_STORAGE_DIMENSION_PKG_$ELAB    ML_STORAGE_DIMENSION_PKG$ELABML_STORAGE_DIMENSION_PKG$ELAB    ML_MACHINE_DATA_PKG_$ELABML_MACHINE_DATA_PKG_$ELAB    VBIN_KEYED_IO_UTILITIES_$ELABVBIN_KEYED_IO_UTILITIES_$ELAB    WBIN_KEYED_IO_UTILITIES$ELABWBIN_KEYED_IO_UTILITIES$ELAB    HIF_KEYED_IO_LOCALS_$ELABHIF_KEYED_IO_LOCALS_$ELAB    HIF_KEYED_IO_LOCALS$ELABHIF_KEYED_IO_LOCALS$ELAB    PHIF_KEYED_IO_$ELABPHIF_KEYED_IO_$ELAB    QHIF_KEYED_IO$ELABQHIF_KEYED_IO$ELAB    NHIF_PARTITION_MAPPING_$ELABNHIF_PARTITION_MAPPING_$ELAB    OHIF_PARTITION_MAPPING$ELABOHIF_PARTITION_MAPPING$ELAB    FHIF_PARTITION_MANAGER_$ELABFHIF_PARTITION_MANAGER_$ELAB    GHIF_PARTITION_MANAGER$ELABGHIF_PARTITION_MANAGER$ELAB    >HIF_SIMPLE_OBJECT_MANAGER_$ELAB>HIF_SIMPLE_OBJECT_MANAGER_$ELAB    ?HIF_SIMPLE_OBJECT_MANAGER$ELAB?HIF_SIMPLE_OBJECT_MANAGER$ELAB    !HIF_NODE_INFO_$ELAB!HIF_NODE_INFO_$ELAB    HIF_PRS_ATTRIBUTES_$ELABHIF_PRS_ATTRIBUTES_$ELAB    HIF_PRS_ATTRIBUTES$ELABHIF_PRS_ATTRIBUTES$ELAB    HIF_NODE_HANDLES_$ELABHIF_NODE_HANDLES_$ELAB    HIF_NODE_HANDLES$ELABHIF_NODE_HANDLES$ELAB    #VMMBASICPKG_$ELAB#VMMBASICPKG_$ELAB    4HIF_HOST_FILE_MANAGEMENT_$ELAB4HIF_HOST_FILE_MANAGEMENT_$ELAB    7PLIF_UTILS_$ELAB7PLIF_UTILS_$ELAB    <HIF_NODE_MANAGEMENT_$ELAB<HIF_NODE_MANAGEMENT_$ELAB     HIF_ATTRIBUTES_$ELAB HIF_ATTRIBUTES_$ELAB    PLIF_DEPENDENCY_UTILS_$ELABPLIF_DEPENDENCY_UTILS_$ELAB    HIF_BIG_ATTRIBUTES_$ELABHIF_BIG_ATTRIBUTES_$ELAB    UP_TO_DATE_CACHE_PKG_$ELABUP_TO_DATE_CACHE_PKG_$ELAB    0VMMTYPESPKG_$ELAB0VMMTYPESPKG_$ELAB    1VMMTYPESPKG$ELAB1VMMTYPESPKG$ELAB    HIF_RELATIVE_PATHS_$ELABHIF_RELATIVE_PATHS_$ELAB    :LIBRARY_COMPILATION_MANAGER_$EL:LIBRARY_COMPILATION_MANAGER_$EL    ;LIBRARY_COMPILATION_MANAGER$ELA;LIBRARY_COMPILATION_MANAGER$ELA    8PLIF_UTILS$ELAB8PLIF_UTILS$ELAB    5HIF_HOST_FILE_MANAGEMENT$ELAB5HIF_HOST_FILE_MANAGEMENT$ELAB    \PLIF_OBJECT_COUNT_UTILS_$ELAB\PLIF_OBJECT_COUNT_UTILS_$ELAB    ]PLIF_OBJECT_COUNT_UTILS$ELAB]PLIF_OBJECT_COUNT_UTILS$ELAB    $VMMBASICPKG$ELAB$VMMBASICPKG$ELAB    }ADA$U008E192A5B0FDC00_00000502$}ADA$U008E192A5B0FDC00_00000502$    ~LIBRARY_CONFIGURATION_INTERFACE~LIBRARY_CONFIGURATION_INTERFACE    =HIF_NODE_MANAGEMENT$ELAB=HIF_NODE_MANAGEMENT$ELAB     HIF_ATTRIBUTES$ELAB HIF_ATTRIBUTES$ELAB    PLIF_DEPENDENCY_UTILS$ELABPLIF_DEPENDENCY_UTILS$ELAB    HIF_BIG_ATTRIBUTES$ELABHIF_BIG_ATTRIBUTES$ELAB     UP_TO_DATE_CACHE_PKG$ELAB UP_TO_DATE_CACHE_PKG$ELAB    ST_DIANA_$ELABST_DIANA_$ELAB    
  10820. ST_DIANA$ELAB
  10821. ST_DIANA$ELAB    WINNER_RECORD_IH_$ELABWINNER_RECORD_IH_$ELAB    VHANDLER_ALTERNATIVE_IH_$ELABVHANDLER_ALTERNATIVE_IH_$ELAB    UCASE_ALTERNATIVE_IH_$ELABUCASE_ALTERNATIVE_IH_$ELAB    SBLOCK_UTILITIES_$ELABSBLOCK_UTILITIES_$ELAB    TBLOCK_UTILITIES$ELABTBLOCK_UTILITIES$ELAB    NAGG_NAMED_IH_$ELABNAGG_NAMED_IH_$ELAB    IBLOCK_STM_IH_$ELABIBLOCK_STM_IH_$ELAB    AIDENTIFIER_UTILITIES_$ELABAIDENTIFIER_UTILITIES_$ELAB    BIDENTIFIER_UTILITIES$ELABBIDENTIFIER_UTILITIES$ELAB    @GENERIC_HEADER_IH_$ELAB@GENERIC_HEADER_IH_$ELAB    'TYPE_DECL_IH_$ELAB'TYPE_DECL_IH_$ELAB    &TASK_DECL_IH_$ELAB&TASK_DECL_IH_$ELAB    %SUBTYPE_DECL_IH_$ELAB%SUBTYPE_DECL_IH_$ELAB    $VARIABLE_DECL_IH_$ELAB$VARIABLE_DECL_IH_$ELAB    #SERIES_UNIT_IH_$ELAB#SERIES_UNIT_IH_$ELAB    aDEFINITIONS_$ELABaDEFINITIONS_$ELAB    bDEFINITIONS$ELABbDEFINITIONS$ELAB    COUNT_TYPES_$ELABCOUNT_TYPES_$ELAB    COUNT_TYPES$ELABCOUNT_TYPES$ELAB     COUNT_$ELAB COUNT_$ELAB    
  10822. COUNT$ELAB
  10823. COUNT$ELAB    cHALSTEAD_DATA_BASE_$ELABcHALSTEAD_DATA_BASE_$ELAB    dHALSTEAD_DATA_BASE$ELABdHALSTEAD_DATA_BASE$ELAB    *DEF_ID_PKG_$ELAB*DEF_ID_PKG_$ELAB    +DEF_ID_PKG$ELAB+DEF_ID_PKG$ELAB    [LIBRARY_IDENTIFICATION_MANAGER_[LIBRARY_IDENTIFICATION_MANAGER_    _COMP_UNIT_CLASS_PKG_$ELAB_COMP_UNIT_CLASS_PKG_$ELAB    LIBRARY_DEPENDENCY_MANAGER_$ELALIBRARY_DEPENDENCY_MANAGER_$ELA    ITEM_PKG_$ELABITEM_PKG_$ELAB    (GENERIC_HEADER_CLASS_PKG_$ELAB(GENERIC_HEADER_CLASS_PKG_$ELAB    ,PKG_DEF_PKG_$ELAB,PKG_DEF_PKG_$ELAB    .HEADER_PKG_$ELAB.HEADER_PKG_$ELAB    0OBJECT_TYPE_PKG_$ELAB0OBJECT_TYPE_PKG_$ELAB    2OBJECT_DEF_PKG_$ELAB2OBJECT_DEF_PKG_$ELAB    4NAME_EXP_PKG_$ELAB4NAME_EXP_PKG_$ELAB    6CONSTRAINT_PKG_$ELAB6CONSTRAINT_PKG_$ELAB    8SUBP_DEF_PKG_$ELAB8SUBP_DEF_PKG_$ELAB    :GENERAL_ASSOC_PKG_$ELAB:GENERAL_ASSOC_PKG_$ELAB    <BLOCK_STUB_PKG_$ELAB<BLOCK_STUB_PKG_$ELAB    >TYPE_SPEC_PKG_$ELAB>TYPE_SPEC_PKG_$ELAB    CAGG_COMPONENT_PKG_$ELABCAGG_COMPONENT_PKG_$ELAB    E
  10824. STM_PKG_$ELABE
  10825. STM_PKG_$ELAB    GALTERNATIVE_PKG_$ELABGALTERNATIVE_PKG_$ELAB    LINNER_RECORD_CLASS_PKG_$ELABLINNER_RECORD_CLASS_PKG_$ELAB    OCHOICE_PKG_$ELABOCHOICE_PKG_$ELAB    QITERATION_PKG_$ELABQITERATION_PKG_$ELAB    XVARIANT_ALTERNATIVE_CLASS_PKG_$XVARIANT_ALTERNATIVE_CLASS_PKG_$    \LIBRARY_IDENTIFICATION_MANAGER$\LIBRARY_IDENTIFICATION_MANAGER$    2PROGRAMLIBRARY_$ELAB2PROGRAMLIBRARY_$ELAB    3PROGRAMLIBRARY$ELAB3PROGRAMLIBRARY$ELAB    LIBRARY_DEPENDENCY_MANAGER$ELABLIBRARY_DEPENDENCY_MANAGER$ELAB    `COMP_UNIT_CLASS_PKG$ELAB`COMP_UNIT_CLASS_PKG$ELAB    )GENERIC_HEADER_CLASS_PKG$ELAB)GENERIC_HEADER_CLASS_PKG$ELAB    3OBJECT_DEF_PKG$ELAB3OBJECT_DEF_PKG$ELAB    /HEADER_PKG$ELAB/HEADER_PKG$ELAB    ;GENERAL_ASSOC_PKG$ELAB;GENERAL_ASSOC_PKG$ELAB    9SUBP_DEF_PKG$ELAB9SUBP_DEF_PKG$ELAB    -PKG_DEF_PKG$ELAB-PKG_DEF_PKG$ELAB    1OBJECT_TYPE_PKG$ELAB1OBJECT_TYPE_PKG$ELAB    
  10826. ITEM_PKG$ELAB
  10827. ITEM_PKG$ELAB    7CONSTRAINT_PKG$ELAB7CONSTRAINT_PKG$ELAB    5NAME_EXP_PKG$ELAB5NAME_EXP_PKG$ELAB    =BLOCK_STUB_PKG$ELAB=BLOCK_STUB_PKG$ELAB    ?TYPE_SPEC_PKG$ELAB?TYPE_SPEC_PKG$ELAB    HALTERNATIVE_PKG$ELABHALTERNATIVE_PKG$ELAB    DAGG_COMPONENT_PKG$ELABDAGG_COMPONENT_PKG$ELAB    PCHOICE_PKG$ELABPCHOICE_PKG$ELAB    F STM_PKG$ELABF STM_PKG$ELAB    RITERATION_PKG$ELABRITERATION_PKG$ELAB    MINNER_RECORD_CLASS_PKG$ELABMINNER_RECORD_CLASS_PKG$ELAB    YVARIANT_ALTERNATIVE_CLASS_PKG$EYVARIANT_ALTERNATIVE_CLASS_PKG$E    
  10828. HALSTEAD$ELAB
  10829. HALSTEAD$ELABADA$INIT_COMPONENTLIB$INITIALIZEi$CODE|LIB$INITIALIZE}    HALSTEADHALSTEADoTRANSFER$ADDRESSw?=::::::::::::::
  10830. hdb.bdy
  10831. ::::::::::::::
  10832. with Count_Types;
  10833. with Count;
  10834. with Text_IO; use Text_IO;
  10835. with Int_IO; use Int_IO;
  10836. with VmmTextPkg;
  10837. with Unchecked_Deallocation;
  10838. package body Halstead_Data_Base is
  10839.      
  10840. --| OVERVIEW
  10841. --| This package does all the counting and processing of the information
  10842. --| for a block.  It analyzes all the token information and determines
  10843. --| the number of unique operators and operands for the block.  It
  10844. --| scans the list of DEF_ID's in the block and determines whether
  10845. --| each DEF_ID is either an operator or operand. It also scans the
  10846. --| list of literals and determines the number of different literals
  10847. --| as well as the number of times each literal on the list has been
  10848. --| used.  The literals are all counted asoperands.
  10849. --|
  10850. --| Using the number of unique operands and operators all the Halstead
  10851. --| Metrics are computed.   The metrics are then displayed using the
  10852. --| procedure PrintInfo.
  10853.      
  10854. --------------------------------------------------------------------------
  10855. --                          LOCAL OBJECTS
  10856. --------------------------------------------------------------------------
  10857.      
  10858.     package C renames Count;
  10859.     package CT renames Count_Types;
  10860.      
  10861.     BlockKindLength            :constant :=   9;
  10862.     MaxLineLength              :constant :=  80;
  10863.     NumberOfMetrics            :constant :=  17;
  10864.     NumberOfLinesToClearScreen :constant :=   8;
  10865.     BlockStrings: array(BlockKind)
  10866.       of string(1..BlockKindLength) := ( "PROCEDURE",
  10867.                                          "FUNCTION ",
  10868.                                          "PACKAGE  ",
  10869.                                          "PACKAGE  ",
  10870.                                          "TASK     ",
  10871.                                          "TASK     ",
  10872.      
  10873.      -- The following string is used for declare blocks.  It is blank
  10874.      -- because of the DecId string in pkg Definitions.
  10875.      
  10876.                                          "         ");
  10877.       --| These are the strings which will be printed out in the output
  10878.       --| for the corresponding block type.
  10879.      
  10880.     StroudNumber :integer range 5..20 := 5;
  10881.       --| This number is used as a constant in the metric calculations.
  10882.      
  10883.     E0           :integer := 3000;
  10884.       --| Number of elementary  discriminations between errors.
  10885.      
  10886.     type Real is digits 6;
  10887.  
  10888.     type MetricsRecord is
  10889.         record
  10890.           UniqueOperators         :Float;
  10891.           UniqueOperands          :Float;
  10892.           Vocabulary              :Float;
  10893.           OperatorUsage           :Float;
  10894.           OperandUsage            :Float;
  10895.           ProgramLength           :Float;
  10896.           EstimatedProgramLength  :Float;
  10897.           ProgramVolume           :Float;
  10898.           PotentialVolume         :Float;
  10899.           ProgramLevel            :Float;
  10900.           ProgramLevelApprox      :Float;
  10901.           IntelligenceContent     :Float;
  10902.           ProgrammingEffort       :Float;
  10903.           ProgrammingTime         :Float;
  10904.           LanguageLevel           :Float;
  10905.           NumberOfDeliveredErrors :Float;
  10906.           ApproxNumberOfDeliveredErrors :Float;
  10907.         end record;
  10908.         --| Each field of this record corresponds to one of the 17
  10909.         --| Halstead metrics.
  10910.      
  10911. --------------------------------------------------------------------------
  10912. --           LOCAL SUBPROGRAMS
  10913. --------------------------------------------------------------------------
  10914.      
  10915. --------------------------------------------------------------------------
  10916.      
  10917.      procedure Free is new Unchecked_Deallocation (String, StringPtr);
  10918.      
  10919. --------------------------------------------------------------------------
  10920.      
  10921.     function SymRepToString (   --| Converts a SymRep to a string
  10922.           SymRep :in symbol_repNode.Locator
  10923.     ) return String is
  10924.      
  10925.     begin
  10926.         if symbol_repNode.IsNull (SymRep) then
  10927.             return "";
  10928.         else
  10929.             return VmmTextPkg.Value (
  10930.                      Source_Text.Value (
  10931.                        lx_text (
  10932.                          ne_normalized_symrep (
  10933.                            ne_symbol_entry_in_table (
  10934.                              SymRep)))));
  10935.         end if;
  10936.     end SymRepToString;
  10937.      
  10938. --------------------------------------------------------------------------
  10939.      
  10940.     function TruncateSymrep(
  10941.       symrep : symbol_repNode.Locator;
  10942.       length : natural
  10943.     ) return string is
  10944.         TempName : String(1 .. length) := (others => ' ');
  10945.     begin
  10946.         if TOKEN.IsNull (symrep) then
  10947.             return TempName;
  10948.         else
  10949.             declare
  10950.                 FullName : constant String :=SymRepToString (symrep);
  10951.                 size : constant Integer := FullName'length;
  10952.             begin
  10953.                 if size < length then
  10954.                     TempName(1 .. Size) := FullName(1 .. Size);
  10955.                 else
  10956.                     TempName := FullName(1 .. length);
  10957.                 end if;
  10958.                 return TempName;
  10959.             end;
  10960.         end if;
  10961.     end TruncateSymrep;
  10962.      
  10963.      
  10964. --------------------------------------------------------------------- ----
  10965.      
  10966.      
  10967.     procedure DEF_ID_Analysis (  -- This procedure counts and analyzes
  10968.                                  -- all the identifiers in the program as
  10969.                                  -- either operands or operators.
  10970.             SetOfDEF_IDs   :in     DEF_ID_Set.Set;
  10971.             Nn             :in out CT.NnInfoType;
  10972.             N2Star         :in out natural
  10973.     ) is
  10974.      
  10975.         Place          :DEF_ID_Set.SetIter;
  10976.         Member         :DEF_ID.Locator;
  10977.         package DIS renames DEF_ID_Set;
  10978.      
  10979.      
  10980.     begin
  10981.         --| OVERVIEW
  10982.         --| Walk over the SetOfDEF_IDs.  Each member in the set increments
  10983.         --| its class's Vocabulary by 1 and its class's Usage by the
  10984.         --| Countof the member.  The Kind of each member determines
  10985.         --| which class it is in either an operator, an operand or
  10986.         --| neither.
  10987.         --|
  10988.         --| Calculate N2Star by counting the number of parameters to
  10989.         --| the program unit.
  10990.      
  10991.         Place := DIS.MakeSetIter (SetOfDEF_IDs);
  10992.         while DIS.More (Place) loop
  10993.             DIS.Next (Place, Member);
  10994.             case Kind (Member) is
  10995.               when  ATTRIBUTE_IDKind | BUILT_IN_OPERATORKind |
  10996.                     GENERAL_TYPE_IDKind | pkg_idKind | PRAGMA_IDKind |
  10997.                     STM_IDKind | SUBP_IDKind | subtype_idKind |
  10998.                     task_body_idKind =>
  10999.      
  11000.                 Nn(operator).Vocabulary := Nn(operator).Vocabulary + 1;
  11001.                 Nn(operator).Usage :=
  11002.                   Nn(operator).Usage + DIS.GetCount (Place);
  11003.                 if VerboseOn then
  11004.                     Put (Standard_Output, "number of uses of ");
  11005.                     Put (Standard_Output,
  11006.                          SymRepToString (lx_symrep (Member)));
  11007.                     Put (Standard_Output, " ");
  11008.                     Put (Standard_Output,  AnyKind 'image (Kind (Member)));
  11009.                     Put (Standard_Output,  " equals ");
  11010.                     Put (Standard_Output, DIS.GetCount (Place));
  11011.                     Put (Standard_Output,  " operators ");
  11012.                     New_Line(Standard_Output);
  11013.                 end if;
  11014.      
  11015.               when LITERAL_IDKind | OBJECT_IDKind| argument_idKind |
  11016.                    exception_idKind | iteration_id | number_idKind =>
  11017.      
  11018.                  Nn(operand).Vocabulary := Nn(operand).Vocabulary + 1;
  11019.                  Nn(operand).Usage :=
  11020.                    Nn(operand).Usage + DIS.GetCount (Place);
  11021.                  if Kind (Member) in Param_idKind then
  11022.                      N2Star := N2Star + 1;
  11023.                  end if;
  11024.                  if VerboseOn then
  11025.                      Put (Standard_Output, "number of uses of ");
  11026.                      Put (Standard_Output,
  11027.                           SymRepToString (lx_symrep (Member)));
  11028.                      Put (Standard_Output, " which is a ");
  11029.                      Put (Standard_Output, AnyKind 'image (Kind (Member)));
  11030.                      Put (Standard_Output,  " equals ");
  11031.                      Put (Standard_Output,  DIS.GetCount (Place));
  11032.                      Put (Standard_Output,  " operands ");
  11033.                      New_Line (Standard_Output);
  11034.                  end if;
  11035.      
  11036.               when others =>
  11037.                 null;
  11038.      
  11039.             end case;
  11040.         end loop;
  11041.     end DEF_ID_Analysis;
  11042.      
  11043. --------------------------------------------------------------------------
  11044.      
  11045.     procedure Literal_Analysis (
  11046.                SetOfLiterals :in     Literal_Set.Set;
  11047.                Nn            :in out CT.NnInfoType
  11048.     ) is
  11049.         I      :Literal_Set.SetIter;
  11050.         Member :Source_Text.Locator;
  11051.         package LS renames Literal_Set;
  11052.      
  11053.     begin
  11054.         --| OVERVIEW
  11055.         --| Walk over SetOfLiterals.  Each member in the set increments
  11056.         --| the Vocabulary of the operands by one.  The count of each
  11057.         --| member in the set increments the Usage of operands by the
  11058.         --| count.
  11059.      
  11060.         I := LS.MakeSetIter (SetOfLiterals);
  11061.         Nn(operand).Vocabulary :=
  11062.           Nn(operand).Vocabulary + LS.Cardinality (SetOfLiterals);
  11063.         while LS.More (I) loop
  11064.             LS.Next (I, Member);
  11065.             Nn(operand).Usage := Nn(operand).Usage + LS.GetCount (I);
  11066.             if VerboseOn then
  11067.                 Put (Standard_Output, "the literal ");
  11068.                 Put (Standard_Output,
  11069.                      VmmTextPkg.Value (Source_Text.Value (Member)));
  11070.                 Put (Standard_Output, " appears ");
  11071.                 Put (Standard_Output, LS.GetCount(I));
  11072.                 Put (Standard_Output, " times ");
  11073.                 New_Line(Standard_Output);
  11074.             end if;
  11075.         end loop;
  11076.     end Literal_Analysis;
  11077.      
  11078. --------------------------------------------------------------------------
  11079.      
  11080.     function SeriesValue (  --| This function computes the ln (1 + x).
  11081.          X :in     Float
  11082.     ) return Float is
  11083.         N             :integer := 6;
  11084.         SumOfSeries   :Float;
  11085.         Fraction      :Float;
  11086.         LnOfTwo       :Float;
  11087.      
  11088.     begin
  11089.         --| OVERVIEW
  11090.         --|
  11091.         --|  The series for ln (1 + X) =
  11092.         --|
  11093.         --|  x - x**2/2 + x**3/3 - x**4/4 + x**5/5 ....
  11094.         --|
  11095.         --|  This is being factored inorder to save computations to be
  11096.         --|
  11097.         --|  x ( 1 + x(-1/2 + x(1/3 + x(-1/4 .....
  11098.         --|
  11099.         --|  This is being computed from inside out.
  11100.      
  11101.         LnOfTwo := 6931.0/10000.0;
  11102.         SumOfSeries := 0.0;
  11103.         for i in reverse 1..N loop
  11104.         Fraction := 1.0/Float(i);
  11105.             if (i mod 2) = 0 then
  11106.         SumOfSeries := SumOfSeries - Fraction;
  11107.             else
  11108.         SumOfSeries := SumOfSeries + Fraction;
  11109.             end if;
  11110.             SumOfSeries := SumOfSeries * X;
  11111.         end loop;
  11112.     SumOfSeries := SumOfSeries / LnOfTwo;
  11113.         return SumOfSeries;
  11114.  
  11115.     end SeriesValue;
  11116.      
  11117. --------------------------------------------------------------------------
  11118.      
  11119.     function Log2 (
  11120.           X :in     Float
  11121.     ) return Float is
  11122.         U_X              :Float;
  11123.         IntegerPart      :Float;
  11124.         LogForFraction   :Float;
  11125.         LowerBound       :Float;
  11126.         X_For_Series     :Float;
  11127.      
  11128.         InputOutOfBounds :exception;
  11129.      
  11130.     --| This computes the log2(X) by using the following method.
  11131.     --|
  11132.     --| First get the integer part of the log by testing when 2**n is
  11133.     --| greater than X.  The integer part of log2(X) is then n - 1.
  11134.     --|
  11135.     --| Then we calculate the fraction part of log2(x) by using the
  11136.     --| expression
  11137.     --|
  11138.     --| ln(1 + x) = x - x**2/2 + x**3/3 - x**4/4 .....
  11139.     --|
  11140.     --| Then by using the fact log2(x) = ln(X)/ln(2) we have log2(X).
  11141.     --|
  11142.     --| For example if x = 70
  11143.     --|
  11144.     --| log2 (70) = log2 (64 * 70/64) = 6 + log2(70/64)
  11145.     --|
  11146.     --| log2( 70/64 )= log2( 1 + 6/64) = ln(1 + 6/64) / ln(2)
  11147.     --|
  11148.     --| log2 (1 + 64/70) is calculated by the function SeriesValue
  11149.     --| when passed  (64/70).
  11150.      
  11151.     begin
  11152.      
  11153.      
  11154.        if X < 0.0 then
  11155.            raise InputOutOfBounds;
  11156.        else
  11157.       U_X := Float(Integer(X));
  11158.       LowerBound := 1.0;
  11159.       IntegerPart := 0.0;
  11160.       while 2.0 * LowerBound <= U_X loop
  11161.         IntegerPart := IntegerPart + 1.0;
  11162.         LowerBound := LowerBound * 2.0;
  11163.       end loop;
  11164.       if LowerBound = U_X then
  11165.                return IntegerPart;
  11166.       else
  11167.                  -- Following the example above at this point we compute
  11168.                  -- log2 (70/64) = log2 (1 + 6/64)
  11169.                  -- log2 (1 + 6/64) = SeriesValue (6/64).
  11170.                  -- U_X - LowerBound is in the example 70 - 64.  Therefore
  11171.                  -- (U_X - LowerBound) / LowerBound is 6/64.
  11172.      
  11173.       X_For_Series := (U_X - LowerBound)/LowerBound;
  11174.       LogForFraction := SeriesValue(X_For_Series);
  11175.       return IntegerPart + LogForFraction;
  11176.         end if;
  11177.     end if;
  11178.  
  11179. end Log2;
  11180.      
  11181. --------------------------------------------------------------------------
  11182.      
  11183. function Exp (           --| Raises the natural log e to the power X.
  11184.              X  :in    Float
  11185.     ) return Float is
  11186.          NumberOfIterations  :integer := 6;
  11187.                                --| Number of Iterations used to calculate
  11188.                                --| series.
  11189.          Series              :Float;
  11190.          Factorial           :Float;
  11191.     begin
  11192.     Series := 1.0;
  11193.         Factorial := 1.0;
  11194.         for i in 1..NumberOfIterations loop
  11195.                -- Caculate Factorial
  11196.              Factorial := Factorial * Float(i);
  11197.              Series := Series + ((X ** i) / Factorial);
  11198.         end loop;
  11199.         return Series;
  11200.  
  11201.     end Exp;
  11202.      
  11203. --------------------------------------------------------------------------
  11204.      
  11205.     function TwoThirdsPower ( --| Calculates X ** (2/3) by finding a
  11206.                               --| a Y such that X ** 2 = Y ** 3
  11207.          X  :in    Float
  11208.     ) return Float is
  11209.          Y         :float := 1.0;
  11210.          SquareX   :float;
  11211.          CubeY     :float;
  11212.          CubeDelta :float;
  11213.     begin
  11214.         --| OVERVIEW
  11215.         --| Y = x ** (2/3) ->
  11216.         --| Y**3 = X**2
  11217.         --|
  11218.         --| This function computes Y such that
  11219.         --| Y**3 <= X**2 is true.
  11220.      
  11221.         SquareX := X ** 2;
  11222.         CubeY := Y ** 3;
  11223.         CubeDelta := CubeY + ((3.0 * Y) * (Y + 1.0)) + 1.0;
  11224.           -- The following shows how to incremently compute (Y+1)**3 when
  11225.           -- Y **3 exists.
  11226.           --
  11227.           -- ((Y + 1) ** 3)  -   (Y**3) =
  11228.           -- Y**3 + 3Y**2 + 3Y + 1    - Y**3 =
  11229.           -- 3Y**2 + 3Y + 1 =
  11230.           -- 3Y(Y + 1) + 1
  11231.         while CubeY + CubeDelta < SquareX loop
  11232.             Y :=  Y + 1.0;
  11233.             CubeDelta :=  ((3.0 * Y) * (Y + 1.0)) + 1.0;
  11234.         end loop;
  11235.         return Y;
  11236.  
  11237.     end TwoThirdsPower;
  11238.      
  11239. --------------------------------------------------------------------------
  11240.      
  11241.     procedure CalcEstimatedProgramLength (
  11242.                                  --| Computes the estimated program length
  11243.                                  --| given the number of unique operators
  11244.                                  --| and operands.
  11245.              N1       :in     Float;  --| number of unique operators
  11246.              N2       :in     Float;  --| number of unique operands
  11247.              Result   :in out Float
  11248.     ) is
  11249.      
  11250.     begin
  11251.         Result := (N1 * log2(N1)) + (N2 * log2(N2));
  11252.  
  11253.     end CalcEstimatedProgramLength;
  11254.      
  11255. --------------------------------------------------------------------------
  11256.      
  11257.     procedure CalcProgramVolume (    --| Computes the program volume
  11258.                                 --| given the vocabulary.
  11259.              ProgramLength :in     Float;
  11260.              Vocabulary    :in     Float;
  11261.              Result        :in out Float
  11262.     ) is
  11263.      
  11264.     begin
  11265.         Result := ProgramLength * log2(Vocabulary);
  11266.  
  11267.     end CalcProgramVolume;
  11268.      
  11269. --------------------------------------------------------------------------
  11270.      
  11271.     procedure CalcPotentialVolume(
  11272.              N2Star :in     natural;   --| minimum number of input output
  11273.                                        --| parameters.
  11274.              Result :in out Float
  11275.     ) is
  11276.     begin
  11277.          Result := (2.0 + Float(N2Star)) * log2(2.0 + Float(N2Star));
  11278.  
  11279.     end CalcPotentialVolume;
  11280.      
  11281. --------------------------------------------------------------------------
  11282.      
  11283.     procedure CalcProgramLevel (
  11284.              VStar  :in     Float;
  11285.              V      :in     Float;
  11286.              Result :in out Float
  11287.     ) is
  11288.      
  11289.     begin
  11290.         Result := VStar / V;
  11291.      
  11292.     exception
  11293.         when Numeric_Error =>
  11294.             -- This catches the case when the denominator is 0.
  11295.       Result := 0.0;
  11296.      
  11297.     end CalcProgramLevel;
  11298.      
  11299. --------------------------------------------------------------------------
  11300.      
  11301.     procedure  CalcProgramLevelApprox( --| minimum number of operators,
  11302.                                        --| number of unique operators,
  11303.                                        --| number of unique operands
  11304.                                        --| and total number of operands.
  11305.       N1           :in     Float;
  11306.       N2Unique     :in     Float;
  11307.       N2Total      :in     Float;
  11308.       N1Star       :in     natural := 2;
  11309.                                        --| Minimum number of operators
  11310.                                        --| necessary
  11311.       Result       :in out Float
  11312.     ) is
  11313.      
  11314.     begin
  11315.         Result := Float(N1Star)/N1 * N2Unique * N2Total;
  11316.  
  11317.     exception
  11318.       when Numeric_Error =>
  11319.           -- This catches the case when the denominator is 0.
  11320.         Result := 0.0;
  11321.      
  11322.     end CalcProgramLevelApprox;
  11323.      
  11324. --------------------------------------------------------------------------
  11325.      
  11326.     procedure CalcIntelligenceContent (
  11327.         L_Approx :in     Float;
  11328.         V        :in     Float;
  11329.         Result   :in out Float
  11330.     ) is
  11331.     begin
  11332.       Result := L_Approx * V;
  11333.  
  11334.     end CalcIntelligenceContent;
  11335.      
  11336. --------------------------------------------------------------------------
  11337.      
  11338.     procedure CalcProgrammingEffort (
  11339.         V      :in     Float;
  11340.         L      :in     Float;
  11341.         Result :in out Float
  11342.      
  11343.     ) is
  11344.     begin
  11345.         Result := V / L;
  11346.  
  11347.     exception
  11348.         when Numeric_Error =>
  11349.             -- This catches the case when the denominator is 0.
  11350.         Result := 0.0;
  11351.      
  11352.     end CalcProgrammingEffort;
  11353.      
  11354. --------------------------------------------------------------------------
  11355.      
  11356.     procedure CalcProgrammingTime (
  11357.         E      :in     Float;
  11358.         S      :in     natural;      --| Stroud number.
  11359.         Result :in out Float
  11360.     ) is
  11361.     begin
  11362.     Result := E/Float(S);
  11363.  
  11364.     end CalcProgrammingTime;
  11365.      
  11366. --------------------------------------------------------------------------
  11367.      
  11368.     procedure CalcLanguageLevel (
  11369.        L      :in     Float;
  11370.        VStar  :in     Float;
  11371.        Result :in out Float
  11372.     ) is
  11373.      
  11374.     begin
  11375.         Result := L * VStar;
  11376.  
  11377.     end CalcLanguageLevel;
  11378.      
  11379. --------------------------------------------------------------------------
  11380.      
  11381.     procedure CalcNumberOfDeliveredErrors (
  11382.         E       :in     Float;
  11383.         E0      :in     natural;
  11384.         Result  :in out Float
  11385.     ) is
  11386.     begin
  11387.         -- E**(2/3) / E0
  11388.     Result := TwoThirdsPower(E) / Float(E0);
  11389.  
  11390.     end CalcNumberOfDeliveredErrors;
  11391.      
  11392. --------------------------------------------------------------------------
  11393.      
  11394.     procedure CalcApproxNumberOfDeliveredErrors (
  11395.          V      :in     Float;
  11396.          E0     :in    natural;
  11397.          Result :in out Float
  11398.     ) is
  11399.     begin
  11400.     Result := V / Float(E0);
  11401.  
  11402.     end CalcApproxNumberOfDeliveredErrors;
  11403.      
  11404. --------------------------------------------------------------------------
  11405.      
  11406.     procedure MetricCalculations (
  11407.       Nn       :in     CT.NnInfoType;
  11408.       N2Star   :in     natural;
  11409.       Metrics  :in out MetricsRecord
  11410.     ) is
  11411.      
  11412.     begin
  11413.       Metrics.UniqueOperators := Float(Nn(operator).Vocabulary);
  11414.       Metrics.UniqueOperands := Float(Nn(operand).Vocabulary);
  11415.       Metrics.OperandUsage := Float(Nn(operand).Usage);
  11416.       Metrics.OperatorUsage := Float(Nn(operator).Usage);
  11417.       Metrics.Vocabulary := Metrics.UniqueOperators + Metrics.UniqueOperands;
  11418.       Metrics.ProgramLength := Metrics.OperandUsage + Metrics.OperatorUsage;
  11419.       CalcEstimatedProgramLength(Metrics.UniqueOperators,
  11420.                                  Metrics.UniqueOperands,
  11421.                                  Metrics.EstimatedProgramLength);
  11422.       CalcProgramVolume(Metrics.ProgramLength,
  11423.                         Metrics.Vocabulary,
  11424.                         Metrics.ProgramVolume);
  11425.       CalcPotentialVolume(N2Star, Metrics.PotentialVolume);
  11426.       CalcProgramLevel(Metrics.PotentialVolume,
  11427.                        Metrics.ProgramVolume,
  11428.                        Metrics.ProgramLevel);
  11429.       CalcProgramLevelApprox(Metrics.UniqueOperators,
  11430.                              Metrics.UniqueOperands,
  11431.                              Metrics.OperandUsage,
  11432.                              Result => Metrics.ProgramLevelApprox);
  11433.       CalcIntelligenceContent(Metrics.ProgramLevelApprox,
  11434.                               Metrics.ProgramVolume,
  11435.                               Metrics.IntelligenceContent);
  11436.       CalcProgrammingEffort(Metrics.ProgramVolume,
  11437.                             Metrics.ProgramLevel,
  11438.                             Metrics.ProgrammingEffort);
  11439.       CalcProgrammingTime(Metrics.ProgrammingEffort,
  11440.                           StroudNumber,
  11441.                           Metrics.ProgrammingTime);
  11442.       CalcLanguageLevel(Metrics.ProgramLevel,
  11443.                         Metrics.PotentialVolume,
  11444.                         Metrics.LanguageLevel);
  11445.       CalcNumberOfDeliveredErrors(Metrics.ProgrammingEffort,
  11446.                                   E0,
  11447.                                   Metrics.NumberOfDeliveredErrors);
  11448.       CalcApproxNumberOfDeliveredErrors(
  11449.                          Metrics.ProgramVolume,
  11450.                          E0,
  11451.                          Metrics.ApproxNumberOfDeliveredErrors);
  11452.      
  11453.     end MetricCalculations;
  11454.      
  11455. -------------------------------------------------------------------------
  11456.      
  11457.     function Center (   --|This centers the string S in a buffer of blanks
  11458.                         --|whose width is Width.
  11459.       S      :in     String;
  11460.       Width  :in     positive
  11461.     ) return String is
  11462.         Result        :String(1..Width) := (others => ' ');
  11463.         Start         :positive;
  11464.         Finish        :positive;
  11465.         BufferToSmall :exception;
  11466.     begin
  11467.         Start := ((Result'length - S'length) / 2) + 1;
  11468.         Finish := Start + S'length - 1;
  11469.         if S'length > Width then
  11470.             raise BufferToSmall;
  11471.         else
  11472.             Result(Start..Finish) := S(S'range);
  11473.             return Result;
  11474.         end if;
  11475.     end Center;
  11476.      
  11477. --------------------------------------------------------------------------
  11478.      
  11479.     function RightJustify (  --| Right justify the string S in a buffer
  11480.                              --| whose width is Width.
  11481.       S      :in     String;
  11482.       Width  :in     positive
  11483.     ) return String is
  11484.         Result        :String(1..Width) := (others => ' ');
  11485.         Start         :positive;
  11486.         Finish        :positive;
  11487.         BufferToSmall :exception;
  11488.     begin
  11489.         if S'length > Width then
  11490.             raise BufferToSmall;
  11491.         else
  11492.             Start := (Result'length - S'length) + Result'first;
  11493.             Finish := Result'last;
  11494.             Result (Start..Finish) := S(S'range);
  11495.             return Result;
  11496.         end if;
  11497.     end RightJustify;
  11498.      
  11499. --------------------------------------------------------------------------
  11500.      
  11501.     function LeftJustify ( --| Left justify the string S in a buffer
  11502.                            --| of blanks whose width is Width.
  11503.       S      :in    String;
  11504.       Width  :in    positive
  11505.     ) return String is
  11506.         Finish        :positive;
  11507.         Result        :String (1..Width) := (others => ' ');
  11508.         BufferToSmall :exception;
  11509.     begin
  11510.         if S'length > Width then
  11511.             raise BufferToSmall;
  11512.         else
  11513.             Finish := Result'first + S'length - 1;
  11514.             Result (Result'first..Finish) := S(S'range);
  11515.             return Result;
  11516.         end if;
  11517.     end LeftJustify;
  11518.      
  11519. --------------------------------------------------------------------------
  11520.      
  11521.     function StripTrailingBlanks ( --| Remove all trailing blanks from
  11522.                                    --| a string.
  11523.                Token :in     String
  11524.     ) return String is
  11525.      
  11526.     begin
  11527.         for i in reverse Token'range loop
  11528.             if Token(i) /= ' ' then
  11529.                 -- ith character is not a blank so return
  11530.                 -- Token(Token'first..i)
  11531.                 return Token(Token'first..i);
  11532.             end if;
  11533.         end loop;
  11534.         return "";
  11535.     end StripTrailingBlanks;
  11536.      
  11537. --------------------------------------------------------------------------
  11538.      
  11539.     function IntTruncAndConvert (     --| Truncates and Converts an
  11540.                                       --| integer to a string of a given
  11541.                                       --| length.
  11542.       I     :in integer;
  11543.       Width :in integer
  11544.     ) return String is
  11545.      
  11546.         Result :constant String := integer'image(I);
  11547.     begin
  11548.         -- Since image returns a leading blank the number of
  11549.         -- digits in I is length'Result - 1
  11550.      
  11551.         if Result'length - 1 > Width then
  11552.             return Result(2..2 + Width - 1);
  11553.         else
  11554.             return Result(2..Result'length);
  11555.         end if;
  11556.     end IntTruncAndConvert;
  11557.      
  11558. --------------------------------------------------------------------------
  11559.      
  11560.     function Float_To_Int_Str (
  11561.       X  :in     Float
  11562.     ) return String is
  11563.     begin
  11564.         return Integer'Image(Integer(X));
  11565.  
  11566.     end Float_To_Int_Str;
  11567.      
  11568. --------------------------------------------------------------------------
  11569.      
  11570.     function FirstNonBlank (
  11571.       S :in    String
  11572.     ) return natural is
  11573.         Position :natural := S'first;
  11574.     begin
  11575.         while (S(Position) = ' ') and (Position <= S'last) loop
  11576.             Position := Position + 1;
  11577.         end loop;
  11578.         if Position in S'Range then
  11579.             return Position;
  11580.         else
  11581.             return 0;
  11582.         end if;
  11583.     end FirstNonBlank;
  11584.      
  11585. --------------------------------------------------------------------------
  11586.      
  11587.     function Float_To_Dec_Str (
  11588.       X  :in     Float
  11589.     ) return String is
  11590.         TimesX  :Float;
  11591.     begin
  11592.         --| OVERVIEW
  11593.         --| This function takes a Float and returns the image of the
  11594.         --| number in decimal notation.  The number it returns has two
  11595.         --| places to the right of the decimal point or if the number is
  11596.         --| an integer it leaves two blanks.
  11597.      
  11598.         if X < 0.01 then
  11599.             return "<0.01";
  11600.     elsif X > 1000000.0 then
  11601.             return ">1000000   ";
  11602.         end if;
  11603.      
  11604.         TimesX := X * 100.0;
  11605.         declare
  11606.             StrTimesX: constant String := Integer'Image(Integer(TimesX));
  11607.             Result            :String (1..StrTimesX'length + 1);
  11608.             FirstDigitPos     :positive;
  11609.             LastDigitPos      :positive;
  11610.             NumberOfDigits    :positive;
  11611.             DecimalFillSpaces :constant String := "   ";
  11612.               --| This ensures that there are three spaces to the right of
  11613.               --| ones places.  This keeps all the numbers in line.
  11614.         begin
  11615.             if Integer(TimesX) = 0 then
  11616.                 return "0" & DecimalFillSpaces ;
  11617.             else
  11618.                 FirstDigitPos := FirstNonBlank (StrTimesX);
  11619.                 NumberOfDigits := StrTimesX'last - FirstDigitPos + 1;
  11620.                 if StrTimesX(StrTimesX'last - 1..StrTimesx'Last) = "00"
  11621.                    then
  11622.                        return
  11623.                        StrTimesX(StrTimesX'First..StrTimesx'last - 2) &
  11624.                        DecimalFillSpaces;
  11625.                 end if;
  11626.      
  11627.                 case NumberOfDigits is
  11628.                   when 1 =>
  11629.                     Result(1..2) := ".0";
  11630.                     return Result(1..2) & StrTimesX (FirstDigitPos);
  11631.      
  11632.                   when 2 =>
  11633.                     Result(1) := '.';
  11634.                     Result(2..3) :=
  11635.                       StrTimesX
  11636.                        (FirstDigitPos..FirstDigitPos + NumberOfDigits -1);
  11637.                     return Result (1..3);
  11638.      
  11639.                   when others =>
  11640.                     LastDigitPos := FirstDigitPos + NumberOfDigits - 1;
  11641.                     Result(1..NumberOfDigits - 2) :=
  11642.                       StrTimesX (FirstDigitPos..LastDigitPos - 2);
  11643.                     Result(NumberOfDigits - 2  + 1) := '.';
  11644.                     Result(NumberOfDigits..NumberOfDigits + 1) :=
  11645.                       StrTimesX (LastDigitPos - 1..LastDigitPos);
  11646.                     return Result (1..NumberOfDigits + 1);
  11647.      
  11648.                 end case;
  11649.             end if;
  11650.         end;
  11651.     end Float_To_Dec_Str;
  11652.      
  11653. --------------------------------------------------------------------------
  11654.      
  11655.     procedure InsertInBuffer (  --| Insert the string "Insert" into Buffer
  11656.                                 --| preceeding a right Justified Field
  11657.                                 --| and a field which may have to be
  11658.                                 --| truncated with at least one blank.
  11659.                                 --| A left justified field does not have
  11660.                                 --| a blank preceeding it.
  11661.        Buffer       :in out String;
  11662.        Insert       :in     String;
  11663.        StartPos     :in     positive;
  11664.        EndPos       :in     positive
  11665.    ) is
  11666.    begin
  11667.        Buffer (StartPos..EndPos) := Insert(Insert'Range);
  11668.    end InsertInBuffer;
  11669.      
  11670. --------------------------------------------------------------------------
  11671.      
  11672.     procedure PrintBlockId (  --| This procedure prints the identifying
  11673.                               --| information for a block when producing
  11674.                               --| the report.
  11675.       BlockId: in    BlockIdType
  11676.     ) is
  11677.     begin
  11678.          --| OVERVIEW
  11679.          --| This prints
  11680.          --|   1.  the kind of block
  11681.          --|   2.  whether the block is a spec or body
  11682.          --|   3.  the name of the block
  11683.          --|   4.  the line number where the block appears in the source
  11684.      
  11685.          --| ALGORITHM
  11686.          --| Check if this is a declare block which is unnamed.  If it is
  11687.          --| then process it differently.
  11688.      
  11689.          if BlockId.KindOfBlock = Definitions.declare_block
  11690.             and then
  11691.             BlockId.BlockName.all(
  11692.               BlockId.BlockName.all'first..BlockId.BlockName.all'last
  11693.                                  )= ""
  11694.          then
  11695.             Put ("UNNAMED DECLARE BLOCK");
  11696.          else
  11697.             Put (StripTrailingBlanks (BlockStrings(BlockId.KindOfBlock)));
  11698.             Put (" ");
  11699.             Put (StripTrailingBlanks (BlockId.SpcBdyId));
  11700.             Put (" OF ");
  11701.             Put (
  11702.               BlockId.BlockName.all(
  11703.                 BlockId.BlockName.all'first..BlockId.BlockName.all'last
  11704.                                    )
  11705.                 );
  11706.          end if;
  11707.          Put (" AT LINE ");
  11708.          Put (BlockId.LineLocation);
  11709.          New_Line (Spacing => 2);
  11710.     end PrintBlockId;
  11711.      
  11712. --------------------------------------------------------------------------
  11713.      
  11714.     procedure PrintInfo (
  11715.       BlockId: in    BlockIdType;
  11716.       Metrics: in    MetricsRecord
  11717.     ) is
  11718.       subtype BufferType is String (1..MaxLineLength);
  11719.       Output       :BufferType;
  11720.       Blanks       :BufferType := (others => ' ');
  11721.       LabelLength  :constant positive := 20;
  11722.       subtype LabelType is String (1..LabelLength);
  11723.       subtype Metric_Index is natural range 1..NumberOfMetrics + 1;
  11724.       MetricLabels :constant array (Metric_Index) of LabelType:=
  11725.                           ( "UNIQUE OPERATORS    ",
  11726.                             "UNIQUE OPERANDS     ",
  11727.                             "TOTAL OPERATORS     ",
  11728.                             "TOTAL OPERANDS      ",
  11729.                             "VOCABULARY          ",
  11730.                             "                    ",
  11731.                             "PROGRAM LENGTH      ",
  11732.                             "ESTIMATED LENGTH    ",
  11733.                             "PROGRAM VOLUME      ",
  11734.                             "POTENTIAL VOLUME    ",
  11735.                             "PROGRAM LEVEL       ",
  11736.                             "ESTIMATED LEVEL     ",
  11737.                             "INTELLIGENCE CONTENT",
  11738.                             "PROGRAMMING EFFORT  ",
  11739.                             "PROGRAMMING TIME    ",
  11740.                             "LANGUAGE LEVEL      ",
  11741.                             "DELIVERED ERRORS    ",
  11742.                             "ESTIMATED ERRORS    "
  11743.                             );
  11744.            --| This array has one extra space for a metric.  This is
  11745.            --| to make producing the report easier.
  11746.      
  11747.     subtype metric_range is integer range 1..NumberOfMetrics + 1;
  11748.          ProcessArray     :array (metric_Range) of Float;
  11749.            --| This array has one extra space for a metric.  This is
  11750.            --| to make producing the report easier.
  11751.      
  11752.          NumberOfMetricLines :constant positive := 9;
  11753.          FirstColValueField  :positive; -- := LabelLength + 2;
  11754.          FirstCol            :constant positive := 1;
  11755.          EndFirstCol         :constant positive := 38;
  11756.          SecondCol           :constant positive := 41;
  11757.          EndSecondCol        :constant positive  := 80;
  11758.          SecondColValueField :positive; -- := SecondCol+LabelLength+2- 1;
  11759.          i                   :integer;
  11760.    begin
  11761.         --| OVERVIEW
  11762.         --| This procedure produces the report for a block. The format of
  11763.         --| the report is the following:
  11764.         --|
  11765.         --|---------------------------------------------------------------
  11766.         --|        HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF LIBRARY UNIT C36205D
  11767.         --|
  11768.         --|
  11769.         --| PROCEDURE SPECIFICATION OF C36205D AT LINE 12
  11770.         --|
  11771.         --| UNIQUE OPERATORS                  5     UNIQUE OPERANDS                    <0.01
  11772.         --| TOTAL OPERATORS                   6     TOTAL OPERANDS                     <0.01
  11773.         --| VOCABULARY                        5
  11774.         --| PROGRAM LENGTH                    6     ESTIMATED LENGTH                   11.61
  11775.         --| PROGRAM VOLUME                   13.93  POTENTIAL VOLUME                    2
  11776.         --| PROGRAM LEVEL                      .14  ESTIMATED LEVEL                    <0.01
  11777.         --| INTELLIGENCE CONTENT             <0.01  PROGRAMMING EFFORT                 97.06
  11778.         --| PROGRAMMING TIME                 19.41  LANGUAGE LEVEL                       .29
  11779.         --| DELIVERED ERRORS                 <0.01  ESTIMATED ERRORS                   <0.01
  11780.         --|
  11781.         --|---------------------------------------------------------------
  11782.         --| The object FirstCol refers to the labels on the left hand side
  11783.         --| of the report.  These are UNIQUE OPERATORS, TOTAL OPERATORS
  11784.         --| and so on.  FirstColValueField is the refers to the leftmost
  11785.         --| position of the field where the numbers appear.
  11786.         --| The object SecondCol refers to the leftmost position of the
  11787.         --| labels for the second column.  These are UNIQUE OPERANDS,
  11788.         --| TOTAL OPERANDS and so forth.  SecondColValueField refers to
  11789.         --| the leftmost position of the value field.  In this report
  11790.         --| are left justified  or right justified in relation to a field.
  11791.      
  11792.         FirstColValueField := LabelLength + 2;
  11793.         SecondColValueField := SecondCol + LabelLength + 2 - 1;
  11794.         PrintBlockId (BlockId);
  11795.         ProcessArray(1) := Metrics.UniqueOperators;
  11796.         ProcessArray(2) := Metrics.UniqueOperands;
  11797.         ProcessArray(3) := Metrics.OperatorUsage;
  11798.         ProcessArray(4) := Metrics.OperandUsage;
  11799.         ProcessArray(5) := Metrics.Vocabulary;
  11800.         ProcessArray(6) := 0.0;
  11801.         ProcessArray(7) := Metrics.ProgramLength;
  11802.         ProcessArray(8) := Metrics.EstimatedProgramLength;
  11803.         ProcessArray(9) := Metrics.ProgramVolume;
  11804.         ProcessArray(10) := Metrics.PotentialVolume;
  11805.         ProcessArray(11) := Metrics.ProgramLevel;
  11806.         ProcessArray(12) := Metrics.ProgramLevelApprox;
  11807.         ProcessArray(13) := Metrics.IntelligenceContent;
  11808.         ProcessArray(14) := Metrics.ProgrammingEffort;
  11809.         ProcessArray(15) := Metrics.ProgrammingTime;
  11810.         ProcessArray(16) := Metrics.LanguageLevel;
  11811.         ProcessArray(17) := Metrics.NumberOfDeliveredErrors;
  11812.         ProcessArray(18) := Metrics.ApproxNumberOfDeliveredErrors;
  11813.         Output := Blanks;
  11814.         for j in 1..NumberOfMetricLines loop
  11815.             i := (j * 2) - 1;
  11816.             InsertInBuffer (Output,
  11817.                             MetricLabels(i),
  11818.                             FirstCol,
  11819.                             LabelLength);
  11820.             InsertInBuffer (Output,
  11821.                             RightJustify (
  11822.                                  Float_To_Dec_Str (ProcessArray(i)),
  11823.                                  EndFirstCol - FirstColValueField + 1
  11824.                                          ),
  11825.                             FirstColValueField,
  11826.                             EndFirstCol);
  11827.      
  11828.               -- Only do the following if i is not equal to 5 because
  11829.               -- if i equals 5 then we are processing the third line
  11830.               -- which doesn't have a second column so skip it.
  11831.             if i /= 5 then
  11832.                  InsertInBuffer (Output,
  11833.                                  MetricLabels(i + 1),
  11834.                                  SecondCol,
  11835.                                  SecondCol + LabelLength - 1);
  11836.                  InsertInBuffer (Output,
  11837.                                  RightJustify (
  11838.                                   Float_To_Dec_Str (ProcessArray(i + 1) ),
  11839.                                   EndSecondCol - SecondColValueField + 1
  11840.                                               ),
  11841.                                  SecondColValueField,
  11842.                                  EndSecondCol);
  11843.             end if;
  11844.             Put_Line (Output);
  11845.             Output := Blanks;
  11846.         end loop;
  11847.      
  11848.           -- Clear screen if printing to terminal.
  11849.           -- If writing to a file add two lines of spacing.
  11850.      
  11851.         if ToTerminal then
  11852.            New_Line (Spacing => NumberOfLinesToClearScreen);
  11853.         else
  11854.            New_Line (Spacing => 2);
  11855.         end if;
  11856.     end PrintInfo;
  11857.      
  11858. --------------------------------------------------------------------------
  11859.      
  11860.     function CopyQualifiedName (
  11861.       FullyQualifiedName :in      StringPtr
  11862.     ) return StringPtr is
  11863.      
  11864.     begin
  11865.         return new String ' (FullyQualifiedName.all);
  11866.  
  11867.     end CopyQualifiedName;
  11868.      
  11869. --------------------------------------------------------------------------
  11870.      
  11871. procedure ExtendQualifiedName (
  11872.                QualifiedName     :in out StringPtr;
  11873.                Extension         :in     String
  11874. ) is
  11875.      
  11876.   --| ALGORITHM
  11877.   --| Concatentate FullyQualifiedName with "." and the Extension
  11878.   --| then return the access to this.  Free the space used by the
  11879.   --| QualifiedName.
  11880.      
  11881. begin
  11882.     if Extension /= "" then
  11883.         if QualifiedName.all /= "" then
  11884.             QualifiedName :=
  11885.             new String ' (QualifiedName.all & "." & Extension);
  11886.         else
  11887.             QualifiedName := new String ' (Extension);
  11888.         end if;
  11889.     end if;
  11890. end ExtendQualifiedName;
  11891.      
  11892. --------------------------------------------------------------------------
  11893.      
  11894. procedure TruncateQualifiedName (
  11895.                FullyQualifiedName     :in out StringPtr
  11896. ) is
  11897.      
  11898.   --| ALGORITHM
  11899.   --| Remove the last qualification from FullyQualifiedName.
  11900.   --| When changing FullyQualifiedName free the space used by the
  11901.   --| old value.
  11902.      
  11903.     Trash :StringPtr := FullyQualifiedName;
  11904. begin
  11905.     for i in reverse FullyQualifiedName.all'range  loop
  11906.         if FullyQualifiedName(i) = '.' then
  11907.            FullyQualifiedName :=  new String '
  11908.              (FullyQualifiedName(FullyQualifiedName.all'first..i-1));
  11909.            Free (Trash);
  11910.            return;
  11911.         end if;
  11912.     end loop;
  11913.     Free (Trash);
  11914.     FullyQualifiedName := new String ' ("");
  11915. end TruncateQualifiedName;
  11916.      
  11917. --------------------------------------------------------------------------
  11918.      
  11919.      
  11920. --------------------------------------------------------------------------
  11921. --                          VISIBLE SUBPROGRAMS
  11922. --------------------------------------------------------------------------
  11923.      
  11924.      
  11925. --------------------------------------------------------------------------
  11926.      
  11927.    procedure ReportHeader (
  11928.      UnitName : String;
  11929.      Spec     : boolean
  11930.    ) is
  11931.    begin
  11932.       if Spec then
  11933.           Put_Line (
  11934.              Center  (
  11935.                   "HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF" &
  11936.                   " LIBRARY UNIT " & UnitName,
  11937.                    MaxLineLength
  11938.                      )
  11939.      
  11940.               );
  11941.       else
  11942.           Put_Line (
  11943.           Center ("HALSTEAD COMPLEXITY FOR THE BODY OF LIBRARY UNIT " &
  11944.                   UnitName,
  11945.                    MaxLineLength
  11946.                  )
  11947.               );
  11948.       end if;
  11949.       New_Line (Spacing => 2);
  11950.    end ReportHeader;
  11951.      
  11952. --------------------------------------------------------------------------
  11953.      
  11954.    procedure InitializeData (
  11955.        LibraryUnit          :in     String;
  11956.        IsUnitSpec           :in     boolean;
  11957.        VerboseFlag          :in     boolean;
  11958.        ToTerminalFlag       :in     boolean;
  11959.        OuterMostBlockFlag   :in     boolean
  11960.    ) is
  11961.    begin
  11962.      
  11963.        UnitName := new String ' (LibraryUnit(LibraryUnit'range));
  11964.        FullyQualifiedName := new String ' ("");
  11965.        UnitSpec := IsUnitSpec;
  11966.        VerboseOn := VerboseFlag;
  11967.        ToTerminal := ToTerminalFlag;
  11968.        OuterMostBlockSeen := OuterMostBlockFlag;
  11969.        if ToTerminal then
  11970.            New_Page;
  11971.        end if;
  11972.    end InitializeData;
  11973.      
  11974. --------------------------------------------------------------------------
  11975.      
  11976.     procedure IncrementToken (
  11977.       T :in     TokenItem
  11978.     ) is
  11979.      
  11980.     begin
  11981.         CurrentBlock.TokenCount(T) := CurrentBlock.TokenCount(T) + 1;
  11982.     end IncrementToken;
  11983.      
  11984. --------------------------------------------------------------------------
  11985.      
  11986.     procedure FreeSpace (
  11987.       CurrentBlock :in out BlockInfoType
  11988.     ) is
  11989.     begin
  11990.         Literal_Set.Destroy (CurrentBlock.SetOfLiterals);
  11991.         DEF_ID_Set.Destroy (CurrentBlock.SetOfDEF_IDs);
  11992.     end FreeSpace;
  11993.      
  11994.      
  11995. --------------------------------------------------------------------------
  11996.      
  11997.     function InitializeCurrentBlock return BlockInfoType is
  11998.         ClearedBlock :BlockInfoType;
  11999.     begin
  12000.         for t in TokenItem loop
  12001.             ClearedBlock.TokenCount(t) := 0;
  12002.         end loop;
  12003.         ClearedBlock.BlockId.BlockName := null;
  12004.         ClearedBlock.BlockId.KindOfBlock := declare_block;
  12005.         ClearedBlock.BlockId.SpcBdyId := AnonId;
  12006.         ClearedBlock.SetOfLiterals := Literal_Set.Create;
  12007.         ClearedBlock.SetOfDEF_IDs := DEF_ID_Set.Create;
  12008.         return ClearedBlock;
  12009.     end InitializeCurrentBlock;
  12010.      
  12011. --------------------------------------------------------------------------
  12012.      
  12013.     function LineNumber (
  12014.                    Position      :in     MLSP.Source_Position
  12015.     ) return MLSP.Source_Line is
  12016.      
  12017.         -- Get the line number of Position.
  12018.     begin
  12019.         return MLSP.Line (Position.first_location);
  12020.     end LineNumber;
  12021.      
  12022. --------------------------------------------------------------------------
  12023.      
  12024.      
  12025.     function IsSourceRange (
  12026.                    Position :in     MLSP.Source_Position
  12027.     ) return boolean is
  12028.      
  12029.          --| ALGORITHM
  12030.          --| If Position.first_position /= Position.last_position then
  12031.          --|    Position is a range and return true
  12032.          --| else
  12033.          --|    Position is not a range and return false
  12034.      
  12035.     begin
  12036.      return
  12037.           not MLSP."=" (Position.first_location, Position.last_location);
  12038.     end;
  12039.      
  12040. --------------------------------------------------------------------------
  12041.      
  12042.     procedure SetBlockId (
  12043.       ScopeName    :in    Symbol_repNode.Locator;
  12044.       KindOfBlock  :in    BlockKind;
  12045.       SpcBdyId     :in    SpcBdyIdType;
  12046.       Line_Number  :in    MLSP.Source_Line
  12047.     ) is
  12048.     begin
  12049.           -- If the ScopeName is "" then we have an unamed declare block.
  12050.         if SymRepToString (ScopeName) = "" then
  12051.             CurrentBlock.BlockId.BlockName := new  String ' ("");
  12052.         else
  12053.             ExtendQualifiedName (
  12054.               FullyQualifiedName, SymRepToString (ScopeName)
  12055.                                 );
  12056.             CurrentBlock.BlockId.BlockName :=
  12057.               CopyQualifiedName (FullyQualifiedName);
  12058.         end if;
  12059.         CurrentBlock.BlockId.KindOfBlock := KindOfBlock;
  12060.         CurrentBlock.BlockId.SpcBdyId := SpcBdyId;
  12061.         CurrentBlock.BlockId.LineLocation := Line_Number;
  12062.      
  12063.     end SetBlockId;
  12064.      
  12065. --------------------------------------------------------------------------
  12066.      
  12067.     procedure ProcessBlockInfo (
  12068.       BlockInfo: in BlockInfoType
  12069.     ) is
  12070.         Nn      :CT.NnInfoType;
  12071.           --| The counts in Nn represent the counts of operators and
  12072.           --| operands for Literal_Analysis and DEF_ID_Analysis.
  12073.         NnToken :CT.NnInfoType;
  12074.           --| This object keeps the counts of operators and operands
  12075.           --| which pertain to the reserved words and other syntactic
  12076.           --| constructs.
  12077.         Metrics :MetricsRecord;
  12078.         N2Star  :natural := 0;
  12079.     begin
  12080.         if VerboseOn then
  12081.             Put_Line (Standard_Output, "DEF_ID_Analysis ");
  12082.         end if;
  12083.         DEF_ID_Analysis (BlockInfo.SetOfDEF_IDs, Nn, N2Star);
  12084.         if VerboseOn then
  12085.             Put_Line (Standard_Output, "Literal_Analysis");
  12086.         end if;
  12087.         Literal_Analysis (BlockInfo.SetOfLiterals, Nn);
  12088.              CT.ZeroCount (NnToken);
  12089.              C.HalsteadCount (BlockInfo.TokenCount, VerboseOn, NnToken);
  12090.              if VerboseOn then
  12091.                  New_Line (Standard_Output);
  12092.                      Put_Line (Standard_Output,"------------------------------");
  12093.                      Put_Line (Standard_Output,"This separates countable units");
  12094.                      Put_Line (Standard_Output,"------------------------------");
  12095.                      New_Line (Standard_Output);
  12096.              end if;
  12097.      
  12098.              MetricCalculations (
  12099.                CT.AddCounts (Nn, NnToken), N2Star, Metrics
  12100.                                 );
  12101.                   if ToTerminal then
  12102.                         -- This block is needed because the boot seems to
  12103.                    -- have trouble with
  12104.                    -- ReportHeader (UnitName.all,UnitSpec);
  12105.                         -- UnitName.all is causing the problem.
  12106.                       declare
  12107.                      LocalString : constant String :=
  12108.                        UnitName.all(UnitName.all'range);
  12109.                       begin
  12110.                      ReportHeader (LocalString, UnitSpec);
  12111.                       end;
  12112.                   end if;
  12113.      
  12114.                   PrintInfo (BlockInfo.BlockId, Metrics);
  12115.            -- Truncate the current Scope Name.
  12116.         TruncateQualifiedName (FullyQualifiedName);
  12117.     end ProcessBlockInfo;
  12118.      
  12119. --------------------------------------------------------------------------
  12120.      
  12121. end Halstead_Data_Base;
  12122.      
  12123. ::::::::::::::
  12124. hdb.spc
  12125. ::::::::::::::
  12126. -- $Source :/nosc/work/tools/halstead/RCS/utils.spc,v $
  12127. -- $Revision :1.11 $ -- $Date: 85/02/21 08:22:23 $ -- $Author: buddy $
  12128.      
  12129. with St_Diana; use St_Diana;
  12130. with Definitions; use Definitions;
  12131. with ML_Source_Position_Pkg;
  12132.      
  12133. package Halstead_Data_Base is
  12134.      
  12135. --| OVERVIEW
  12136. --| This package holds the major global data structures and subprograms
  12137. --| used to implement the Halstead Complexity Measures.
  12138.      
  12139. --| EFFECTS
  12140. --| This package has the data structures and subprograms used to compute
  12141. --| the Halstead measures.  ProcessBlock organizes the processing of the
  12142. --| block's information.  This entails counting the tokens as either
  12143. --| operators or operands, determining the operand and operator Vocabulary
  12144. --| and counting the total usage of operators and operands.
  12145. --| It also involves counting the number of literals and performing
  12146. --| analysis on all the identifiers in the block.  Keeping track of the
  12147. --| literals is performed by AddLiteral. This maintains a counted set
  12148. --| of all the literals in the current block.  The literal are counted
  12149. --| as operands in the Halstead metrics.
  12150. --| Analyzing the identifiers in the block is done in the subprogram
  12151. --| DEF_ID_ANALYS.The identifiers are classified according to semantic
  12152. --|information provided by DIANA.
  12153.      
  12154. --| TUNING
  12155. --| The procedure IncrementToken should be in lined using a pragma.
  12156.      
  12157. --------------------------------------------------------------------------
  12158. --               VISIBLE OBJECTS
  12159. --------------------------------------------------------------------------
  12160.      
  12161.     package MLSP renames ML_Source_Position_Pkg;
  12162.      
  12163.     CurrentBlock      :BlockInfoType;
  12164.       --| This contains the information about the block currently
  12165.       --| being processed.  When a new block is encountered it is
  12166.       --| this information which gets pushed on the stack.
  12167.      
  12168.     BlockStack        :BlockInfoStack.Stack;
  12169.       --| This structure stacks the information in the current block      .
  12170.       --| Thus information is pushed onto the stack when we enter a
  12171.       --| new block and popped from the stack when we exit a block.
  12172.       --| This is used to reflect the visibility of operators and
  12173.       --| operands.
  12174.      
  12175.     OutermostBlockSeen :boolean;
  12176.       --| This is used to indicate that the outermost scope of the
  12177.       --| compilation unit has been seen.  This is necessary because
  12178.       --| to include the context clauses as adding to the complexity of
  12179.       --| the outermost compilation unit.
  12180.      
  12181.     FullyQualifiedName :StringPtr;
  12182.       --| This is the fully qualified name of the current scope.  This
  12183.       --| string is used in identifying the current scope in the output.
  12184.      
  12185.     UnitName           :StringPtr;
  12186.       --| This is the name of library unit currently being processed.
  12187.       --| It is an access to a string since we don't know how long the
  12188.       --| will be.
  12189.      
  12190.     UnitSpec           :boolean;
  12191.       --| This indicates whether the unit which is currently being
  12192.       --| processed is a specification or a body.
  12193.      
  12194.      
  12195.     VerboseOn          :boolean;
  12196.       --| This boolean is used to control the printing of
  12197.       --| information pertaining to token counting.  This shows
  12198.       --| tokens are counted, and what they are counted as.
  12199.       --| This information is always written to standard output.
  12200.       --| This paramater is set from the command line. The default
  12201.       --| for this is false.
  12202.      
  12203.     ToTerminal   :boolean;
  12204.       --| This boolean is true if the user has not specified an output
  12205.       --| file which means the report is going to standard_output
  12206.       --| which is the terminal.
  12207.      
  12208. --------------------------------------------------------------------------
  12209. --                VISIBLE SUBPROGRAMS
  12210. --------------------------------------------------------------------------
  12211.      
  12212. --------------------------------------------------------------------------
  12213.      
  12214.     procedure InitializeData (  --| This procedure passes the values
  12215.                           --| of certain
  12216.                           --| from the driver to this package which uses
  12217.                           --| it in producing the report.  It needs the
  12218.                           --| the name of the library unit, whether the
  12219.                           --| library unit is a specicification or a body,
  12220.                           --| if the verbose flag is set, and whether the
  12221.                           --| report is going to the terminal.
  12222.      
  12223.        LibraryUnit           :in    String;
  12224.        IsUnitSpec            :in    boolean;
  12225.        VerboseFlag           :in    boolean;
  12226.        ToTerminalFlag        :in    boolean;
  12227.        OuterMostBlockFlag    :in    boolean
  12228.     );
  12229.      
  12230. --------------------------------------------------------------------------
  12231.      
  12232.    procedure ReportHeader  (   --| This prints the header for a Library
  12233.                                --| Unit.
  12234.              UnitName  : String;
  12235.              Spec      : boolean
  12236.    );
  12237.      
  12238. --------------------------------------------------------------------------
  12239.      
  12240.     function InitializeCurrentBlock  --| This function returns a record
  12241.                                      --| of type BlockInfoType which is
  12242.                                      --| initialized.
  12243.     return BlockInfoType;
  12244.      
  12245.     --| OVERVIEW
  12246.     --| This function is used before starting the scan of DIANA and
  12247.     --| then after a Push of CurrentBlock onto the stack.
  12248.      
  12249.     --| EFFECTS
  12250.     --| This function sets the TokenCount for each TokenItem to be 0.
  12251.     --| It also set the LiterSet to be empty and the ListOfDEF_ID to
  12252.     --| empty.
  12253.      
  12254. --------------------------------------------------------------------------
  12255.      
  12256.     procedure IncrementToken ( --| This procedure increments the count of
  12257.                                --| of the given token for the current
  12258.                                --| block.
  12259.      
  12260.               T :in    TokenItem
  12261.                 --| Token whose count is being incremented.
  12262.      );
  12263.      
  12264.      --| OVERVIEW
  12265.      --| This procedure is called during the tree walking when the DIANA
  12266.      --| node which corresponds to the token T has been scanned.
  12267.      
  12268.      --| MODIFIES
  12269.      --| This increments CurrentBlock.TokenCount (T) which is the
  12270.      --| number of occurrences of the token T in the current block.
  12271.      
  12272.      --| TUNING
  12273.      --| This procedure should be pragma inlined.
  12274.      
  12275. --------------------------------------------------------------------------
  12276.      
  12277.     function LineNumber (
  12278.                    Position      :in     MLSP.Source_Position
  12279.     ) return MLSP.Source_Line;
  12280.      
  12281.     --| RAISES
  12282.     --|
  12283.      
  12284.     --| OVERVIEW
  12285.     --| Checks whether Position is a Source_Location or source_range.
  12286.     --| It then returns the line number of the starting position.
  12287.      
  12288.     --| EFFECTS
  12289.     --|
  12290.      
  12291.     --| REQUIRES
  12292.     --|
  12293.      
  12294.     --| MODIFIES
  12295.     --|
  12296.      
  12297.     --| ERRORS
  12298.     --|
  12299.      
  12300.     --| N/A
  12301.     --|
  12302.      
  12303.     --| TUNING
  12304.     --|
  12305.      
  12306.     --| NOTES
  12307.     --|
  12308.      
  12309. --------------------------------------------------------------------------
  12310.      
  12311.     function IsSourceRange (
  12312.                    Position :in     MLSP.Source_Position
  12313.     ) return boolean;
  12314.      
  12315.     --| RAISES
  12316.     --|
  12317.      
  12318.     --| OVERVIEW
  12319.     --| This procedure checks if the Position is a source range.  In
  12320.     --| the diana this indicate that the token had a beginning source
  12321.     --| location and an ending source location.  Other tokens simply
  12322.     --| had a source point which was where the start of the token
  12323.     --| was in the source ( a line number and column position).
  12324.     --| The distinction between source_range and source_point is
  12325.     --| useful for distinguishing certain diana constructs.
  12326.      
  12327. --------------------------------------------------------------------------
  12328.      
  12329.      procedure SetBlockId (  --| This procedure initializes the
  12330.                              --| identifying fields for the block.
  12331.      
  12332.           ScopeName   :in  Symbol_repNode.Locator;
  12333.             --| This is a Locator to the name of the block.
  12334.      
  12335.           KindOfBlock :in  BlockKind;
  12336.             --| This is the kind of block. This can be a procedure,
  12337.             --| function, package, task or declare block.
  12338.      
  12339.           SpcBdyId    :in  SpcBdyIdType;
  12340.             --| This indicates whether the block is a spec or a body.
  12341.      
  12342.           Line_Number :in  MLSP.Source_Line
  12343.      );
  12344.      
  12345.      --| OVERVIEW
  12346.      --| This is used in the tree walk of DIANA when a node is
  12347.      --| scanned which indicates the name and type of the block.
  12348.      --| Typically a DEF_ID will be associated with a package, or
  12349.      --| subprogram, or task.  The information passed to the
  12350.      --| routine is used in the reporting phase.
  12351.      
  12352.      --| MODIFIES
  12353.      --| This updates the BlockId component of CurrentBlock.
  12354.      
  12355.      --| EFFECTS
  12356.      --| The information in BlockId is used in the output routines to
  12357.      --| indicate the block.
  12358.      
  12359. --------------------------------------------------------------------------
  12360.      
  12361.     procedure FreeSpace (   --| Frees all the heap space which this
  12362.                             --| record uses.
  12363.      
  12364.               CurrentBlock :in out BlockInfoType
  12365.     );
  12366.      
  12367. --------------------------------------------------------------------------
  12368.      
  12369.     procedure ProcessBlockInfo (   --| Processes the information gathered
  12370.                                    --| for the current block.
  12371.        BlockInfo :in BlockInfoType
  12372.          --| This is the information for the block.
  12373.     );
  12374.      
  12375.     --| OVERVIEW
  12376.     --| This procedure computes and output the Halstead Metrics for the
  12377.     --| current block.  This procedure is invoked in the DIANA treewalk
  12378.     --| after a node which is a block has been completely processed.
  12379.      
  12380. --------------------------------------------------------------------------
  12381.      
  12382. end Halstead_Data_Base;
  12383.      
  12384. ::::::::::::::
  12385. id_utils.bdy
  12386. ::::::::::::::
  12387. -- $Revision: 1.2 $ -- $Date: 86/02/06 18:05:16 $ -- $Author: buddy $
  12388.      
  12389. with ML_Source_Position_Pkg;
  12390. package body Identifier_Utilities is
  12391.     package MLSP renames ML_Source_Position_Pkg;
  12392.      
  12393. --| OVERVIEW
  12394. --| This package has utilities which are used in processing
  12395. --| DEF_ID's.
  12396.      
  12397.     function Is_Source_Position_Null (
  12398.         Position :in    MLSP.Source_Position
  12399.     ) return boolean;
  12400.      
  12401.     --| OVERVIEW
  12402.     --| This procedure returns true if the source position passed in
  12403.     --| is null.  This means that column and line of the
  12404.     --| Position.first_location is 0.
  12405.      
  12406.     function Is_Id_Null (
  12407.       Id :in     DEF_ID.Locator
  12408.     ) return boolean is
  12409.     begin
  12410.         return Is_Source_Position_Null (lx_srcpos (id));
  12411.     end;
  12412. --------------------------------------------------------------------------
  12413.      
  12414.     function Is_Source_Position_Null (
  12415.         Position :in    MLSP.Source_Position
  12416.     ) return boolean is
  12417.     begin
  12418.         return MLSP."=" (Position.first_location,0);
  12419.     end;
  12420. end Identifier_Utilities;
  12421.      
  12422.      
  12423. --------------------------------------------------------------------------
  12424.      
  12425.      
  12426. ::::::::::::::
  12427. id_utils.spc
  12428. ::::::::::::::
  12429. with ST_DIANA; use ST_DIANA;
  12430.  
  12431. package Identifier_Utilities is
  12432. --| OVERVIEW
  12433. --| This package has utilities which are used in processing
  12434. --| DEF_ID's.
  12435.      
  12436.     function Is_Id_Null (
  12437.       Id :in     DEF_ID.Locator
  12438.     ) return boolean ;
  12439.      
  12440. end Identifier_Utilities;
  12441. ::::::::::::::
  12442. ihagg_nam.dat
  12443. ::::::::::::::
  12444. -- Begin: IHagg_named dat ---------------------------------------------------
  12445.      
  12446. with ST_DIANA; use ST_DIANA;
  12447.              with Unchecked_Deallocation;
  12448. package agg_named_IH is
  12449.       type RecType is record
  12450.         ih_inagg_named : boolean;
  12451.       end record;
  12452.       R : RecType;
  12453. end agg_named_IH;
  12454. -- End: IHagg_named dat -----------------------------------------------------
  12455. ::::::::::::::
  12456. ihblock_s.dat
  12457. ::::::::::::::
  12458. -- Begin: IHblock_stm dat ---------------------------------------------------
  12459.      
  12460. with ST_DIANA; use ST_DIANA;
  12461.              with Unchecked_Deallocation;
  12462. package block_stm_IH is
  12463.       type RecType is record
  12464.         ih_inblock : boolean;
  12465.       end record;
  12466.       R : RecType;
  12467. end block_stm_IH;
  12468. -- End: IHblock_stm dat -----------------------------------------------------
  12469. ::::::::::::::
  12470. ihcase_al.dat
  12471. ::::::::::::::
  12472. -- Begin: IHcase_alternative dat ---------------------------------------------------
  12473.      
  12474. with ST_DIANA; use ST_DIANA;
  12475.              with Unchecked_Deallocation;
  12476. package case_alternative_IH is
  12477.       type RecType is record
  12478.         ih_incase_alternative : boolean;
  12479.       end record;
  12480.       R : RecType;
  12481. end case_alternative_IH;
  12482. -- End: IHcase_alternative dat -----------------------------------------------------
  12483. ::::::::::::::
  12484. ihgeneric.dat
  12485. ::::::::::::::
  12486. -- Begin: IHgeneric_header dat ---------------------------------------------------
  12487.      
  12488. with ST_DIANA; use ST_DIANA;
  12489.              with Unchecked_Deallocation;
  12490. package generic_header_IH is
  12491.       type RecType is record
  12492.         ih_ingeneric_param : boolean;
  12493.       end record;
  12494.       R : RecType;
  12495. end generic_header_IH;
  12496. -- End: IHgeneric_header dat -----------------------------------------------------
  12497. ::::::::::::::
  12498. ihhandler.dat
  12499. ::::::::::::::
  12500. -- Begin: IHhandler_alternative dat ---------------------------------------------------
  12501.      
  12502. with ST_DIANA; use ST_DIANA;
  12503.              with Unchecked_Deallocation;
  12504. package handler_alternative_IH is
  12505.       type RecType is record
  12506.         ih_inhandler_alternative : boolean;
  12507.       end record;
  12508.       R : RecType;
  12509. end handler_alternative_IH;
  12510. -- End: IHhandler_alternative dat -----------------------------------------------------
  12511. ::::::::::::::
  12512. ihinner_r.dat
  12513. ::::::::::::::
  12514. -- Begin: IHinner_record dat ---------------------------------------------------
  12515.      
  12516. with ST_DIANA; use ST_DIANA;
  12517.              with Unchecked_Deallocation;
  12518. package inner_record_IH is
  12519.       type RecType is record
  12520.         ih_in_variant : boolean;
  12521.       end record;
  12522.       R : RecType;
  12523. end inner_record_IH;
  12524. -- End: IHinner_record dat -----------------------------------------------------
  12525. ::::::::::::::
  12526. ihseries_.dat
  12527. ::::::::::::::
  12528. -- Begin: IHSERIES_UNIT dat ---------------------------------------------------
  12529.      
  12530. with ST_DIANA; use ST_DIANA;
  12531.              with Unchecked_Deallocation;
  12532. package SERIES_UNIT_IH is
  12533.       type RecType is record
  12534.         ih_inlist : boolean;
  12535.       end record;
  12536.       R : RecType;
  12537. end SERIES_UNIT_IH;
  12538. -- End: IHSERIES_UNIT dat -----------------------------------------------------
  12539. ::::::::::::::
  12540. ihsubtype.dat
  12541. ::::::::::::::
  12542. -- Begin: IHsubtype_decl dat ---------------------------------------------------
  12543.      
  12544. with ST_DIANA; use ST_DIANA;
  12545.              with Unchecked_Deallocation;
  12546. package subtype_decl_IH is
  12547.       type RecType is record
  12548.         ih_in_subtype_decl : boolean;
  12549.       end record;
  12550.       R : RecType;
  12551. end subtype_decl_IH;
  12552. -- End: IHsubtype_decl dat -----------------------------------------------------
  12553. ::::::::::::::
  12554. ihtask_de.dat
  12555. ::::::::::::::
  12556. -- Begin: IHtask_decl dat ---------------------------------------------------
  12557.      
  12558. with ST_DIANA; use ST_DIANA;
  12559.              with Unchecked_Deallocation;
  12560. package task_decl_IH is
  12561.       type RecType is record
  12562.         ih_intask_decl : boolean;
  12563.       end record;
  12564.       R : RecType;
  12565. end task_decl_IH;
  12566. -- End: IHtask_decl dat -----------------------------------------------------
  12567. ::::::::::::::
  12568. ihtype_de.dat
  12569. ::::::::::::::
  12570. -- Begin: IHtype_decl dat ---------------------------------------------------
  12571.      
  12572. with ST_DIANA; use ST_DIANA;
  12573.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  12574. package type_decl_IH is
  12575.       type RecType is record
  12576.         ih_typespec : Anykind;
  12577.         ih_basetype : DEF_ID.Locator;
  12578.       end record;
  12579.       R : RecType;
  12580. end type_decl_IH;
  12581. -- End: IHtype_decl dat -----------------------------------------------------
  12582. ::::::::::::::
  12583. ihvariabl.dat
  12584. ::::::::::::::
  12585. -- Begin: IHvariable_decl dat ---------------------------------------------------
  12586.      
  12587. with ST_DIANA; use ST_DIANA;
  12588.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  12589. package variable_decl_IH is
  12590.       type RecType is record
  12591.         ih_vartype : MARK.Locator;
  12592.         ih_init : boolean;
  12593.       end record;
  12594.       R : RecType;
  12595. end variable_decl_IH;
  12596. -- End: IHvariable_decl dat -----------------------------------------------------
  12597. ::::::::::::::
  12598. obj.bdy
  12599. ::::::::::::::
  12600. -- Begin: SCOBJECT_TYPE bdy ---------------------------------------------------
  12601.      
  12602. with Halstead_Data_Base;  use Halstead_Data_Base;
  12603. with Definitions; use Definitions;
  12604.              with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  12605. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12606. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  12607.      
  12608.                with subtype_decl_IH;
  12609.                          package body OBJECT_TYPE_Pkg is
  12610.      
  12611.      
  12612.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator) is
  12613.     begin
  12614.         case Kind(Root) is
  12615.           when object_type_anon_arrayKind => Scan_object_type_anon_array(Root);
  12616.           when object_type_anon_taskKind => Scan_object_type_anon_task(Root);
  12617.           when object_type_constrainedKind => Scan_object_type_constrained(Root);
  12618.           when object_type_indexKind => Scan_object_type_index(Root);
  12619.           when object_type_rangeKind => Scan_object_type_range(Root);
  12620.           when others => null;
  12621.         end case;
  12622.     end Scan_OBJECT_TYPE;
  12623.      
  12624.      
  12625.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator) is
  12626.     begin
  12627.         Scan_constrained_array_type(as_array_type_spec(Root));
  12628.      
  12629.     end Scan_object_type_anon_array;
  12630.      
  12631.      
  12632.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator) is
  12633.     begin
  12634.         Scan_task_spec(as_task_spec(Root));
  12635.      
  12636.     end Scan_object_type_anon_task;
  12637.      
  12638.      
  12639.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator) is
  12640.     begin
  12641.       if not MARK.IsNull(as_constrained_name(Root)) then
  12642.         Scan_MARK(as_constrained_name(Root));
  12643.       end if;
  12644.       if not CONSTRAINT.IsNull(as_constraint(Root)) then
  12645.      
  12646.      
  12647.       if (subtype_decl_IH.R.ih_in_subtype_decl)
  12648.            and then
  12649.          (Kind (as_constraint (root)) not in dscrmt_constraintKind)
  12650.          then
  12651.           IncrementToken (rangez);
  12652.       end if;
  12653.      
  12654.      
  12655.         Scan_CONSTRAINT(as_constraint(Root));
  12656.       end if;
  12657.      
  12658.     end Scan_object_type_constrained;
  12659.      
  12660.      
  12661.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator) is
  12662.     begin
  12663.       if not MARK.IsNull(as_index_name(Root)) then
  12664.         Scan_MARK(as_index_name(Root));
  12665.      
  12666.      
  12667.         IncrementToken (rangez);
  12668.      
  12669.      
  12670.       end if;
  12671.      
  12672.     end Scan_object_type_index;
  12673.      
  12674.      
  12675.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator) is
  12676.     begin
  12677.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  12678.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  12679.       end if;
  12680.      
  12681.     end Scan_object_type_range;
  12682.      
  12683. end OBJECT_TYPE_Pkg;
  12684. -- End: SCOBJECT_TYPE bdy -----------------------------------------------------
  12685. ::::::::::::::
  12686. obj.spc
  12687. ::::::::::::::
  12688. -- Begin: SCOBJECT_TYPE spc ---------------------------------------------------
  12689.      
  12690. with ST_DIANA; use ST_DIANA;
  12691.              package OBJECT_TYPE_Pkg is
  12692.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator);
  12693.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator);
  12694.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator);
  12695.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator);
  12696.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator);
  12697.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator);
  12698. end OBJECT_TYPE_Pkg;
  12699. -- End: SCOBJECT_TYPE spc -----------------------------------------------------
  12700. ::::::::::::::
  12701. scagg_com.bdy
  12702. ::::::::::::::
  12703. -- Begin: SCAGG_COMPONENT bdy ---------------------------------------------------
  12704.      
  12705. with Halstead_Data_Base;  use Halstead_Data_Base;
  12706. with Definitions; use Definitions;
  12707.              with SERIES_UNIT_IH;
  12708. with agg_named_IH;
  12709. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12710. with CHOICE_Pkg; use CHOICE_Pkg;
  12711. package body AGG_COMPONENT_Pkg is
  12712.      
  12713.      
  12714.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator) is
  12715.     begin
  12716.         case Kind(Root) is
  12717.           when agg_canonicalKind => Scan_agg_canonical(Root);
  12718.           when agg_expKind => Scan_agg_exp(Root);
  12719.           when agg_namedKind => Scan_agg_named(Root);
  12720.           when others => null;
  12721.         end case;
  12722.     end Scan_AGG_COMPONENT;
  12723.      
  12724.      
  12725.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator) is
  12726.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12727.     begin
  12728.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12729.      
  12730.      
  12731.     SERIES_UNIT_IH.R.ih_inlist := false;
  12732.      
  12733.      
  12734.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12735.      
  12736.     end Scan_agg_canonical;
  12737.      
  12738.      
  12739.     procedure Scan_agg_exp(Root : agg_expNode.Locator) is
  12740.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12741.     begin
  12742.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12743.       if not NAME_EXP.IsNull(as_exp(Root)) then
  12744.         Scan_NAME_EXP(as_exp(Root));
  12745.       end if;
  12746.      
  12747.      
  12748.     SERIES_UNIT_IH.R.ih_inlist := false;
  12749.      
  12750.      
  12751.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12752.      
  12753.     end Scan_agg_exp;
  12754.      
  12755.      
  12756.     procedure Scan_agg_named(Root : agg_namedNode.Locator) is
  12757.         as_choice_s_List : SeqOfCHOICE.Generator;
  12758.         as_choice_s_Item : CHOICE.Locator;
  12759.         use SeqOfCHOICE;
  12760.         Old_agg_named_IHR : agg_named_IH.RecType := agg_named_IH.R;
  12761.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12762.     begin
  12763.         agg_named_IH.R.ih_inagg_named :=  false ;
  12764.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12765.       if not SeqOfCHOICE.IsNull(as_choice_s(Root)) then
  12766.      
  12767.      
  12768.      agg_named_IH.R.ih_inagg_named := true;
  12769.      
  12770.      
  12771.         StartForward(as_choice_s(Root), as_choice_s_List);
  12772.         while not Finished(as_choice_s_List) loop
  12773.             as_choice_s_Item := Cell(as_choice_s_List);
  12774.      
  12775.      
  12776.     if SERIES_UNIT_IH.R.ih_inlist then
  12777.         IncrementToken (barz);
  12778.     end if;
  12779.     SERIES_UNIT_IH.R.ih_inlist := true;
  12780.      
  12781.      
  12782.      
  12783.             Scan_CHOICE(as_choice_s_Item);
  12784.             Forward(as_choice_s_List);
  12785.         end loop;
  12786.         EndIterate(as_choice_s_List);
  12787.      
  12788.      
  12789.      IncrementToken (arrowz);
  12790.      agg_named_IH.R.ih_inagg_named := false;
  12791.      
  12792.      
  12793.       end if;
  12794.       if not NAME_EXP.IsNull(as_exp(Root)) then
  12795.         Scan_NAME_EXP(as_exp(Root));
  12796.       end if;
  12797.      
  12798.      
  12799.     SERIES_UNIT_IH.R.ih_inlist := false;
  12800.      
  12801.      
  12802.         agg_named_IH.R := Old_agg_named_IHR;
  12803.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12804.      
  12805.     end Scan_agg_named;
  12806.      
  12807. end AGG_COMPONENT_Pkg;
  12808. -- End: SCAGG_COMPONENT bdy -----------------------------------------------------
  12809. ::::::::::::::
  12810. scagg_com.spc
  12811. ::::::::::::::
  12812. -- Begin: SCAGG_COMPONENT spc ---------------------------------------------------
  12813.      
  12814. with ST_DIANA; use ST_DIANA;
  12815.              package AGG_COMPONENT_Pkg is
  12816.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator);
  12817.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator);
  12818.     procedure Scan_agg_exp(Root : agg_expNode.Locator);
  12819.     procedure Scan_agg_named(Root : agg_namedNode.Locator);
  12820. end AGG_COMPONENT_Pkg;
  12821. -- End: SCAGG_COMPONENT spc -----------------------------------------------------
  12822. ::::::::::::::
  12823. scalterna.bdy
  12824. ::::::::::::::
  12825. -- Begin: SCALTERNATIVE bdy ---------------------------------------------------
  12826.      
  12827. with Halstead_Data_Base;  use Halstead_Data_Base;
  12828. with Definitions; use Definitions;
  12829.              with SERIES_UNIT_IH;
  12830. with case_alternative_IH;
  12831. with handler_alternative_IH;
  12832. with CHOICE_Pkg; use CHOICE_Pkg;
  12833. with STM_Pkg; use STM_Pkg;
  12834. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12835. with ITEM_Pkg; use ITEM_Pkg;
  12836. package body ALTERNATIVE_Pkg is
  12837.      
  12838.      
  12839.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator) is
  12840.     begin
  12841.         case Kind(Root) is
  12842.           when case_alternativeKind => Scan_case_alternative(Root);
  12843.           when cond_alternativeKind => Scan_cond_alternative(Root);
  12844.           when handler_alternativeKind => Scan_handler_alternative(Root);
  12845.           when pragma_alternativeKind => Scan_pragma_alternative(Root);
  12846.           when select_alternativeKind => Scan_select_alternative(Root);
  12847.           when others => null;
  12848.         end case;
  12849.     end Scan_ALTERNATIVE;
  12850.      
  12851.      
  12852.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator) is
  12853.         as_case_choice_s_List : SeqOfCHOICE.Generator;
  12854.         as_case_choice_s_Item : CHOICE.Locator;
  12855.         use SeqOfCHOICE;
  12856.         as_stm_s_List : SeqOfSTM.Generator;
  12857.         as_stm_s_Item : STM.Locator;
  12858.         use SeqOfSTM;
  12859.         Old_case_alternative_IHR : case_alternative_IH.RecType := case_alternative_IH.R;
  12860.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12861.     begin
  12862.         case_alternative_IH.R.ih_incase_alternative :=  false ;
  12863.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12864.      
  12865.      
  12866.        case_alternative_IH.R.ih_incase_alternative := true;
  12867.        IncrementToken (when_case_stmz);
  12868.        IncrementToken (arrowz);
  12869.      
  12870.      
  12871.       if not SeqOfCHOICE.IsNull(as_case_choice_s(Root)) then
  12872.         StartForward(as_case_choice_s(Root), as_case_choice_s_List);
  12873.         while not Finished(as_case_choice_s_List) loop
  12874.             as_case_choice_s_Item := Cell(as_case_choice_s_List);
  12875.      
  12876.      
  12877.     if SERIES_UNIT_IH.R.ih_inlist then
  12878.         IncrementToken (barz);
  12879.     end if;
  12880.     SERIES_UNIT_IH.R.ih_inlist := true;
  12881.      
  12882.      
  12883.             Scan_CHOICE(as_case_choice_s_Item);
  12884.             Forward(as_case_choice_s_List);
  12885.         end loop;
  12886.         EndIterate(as_case_choice_s_List);
  12887.       end if;
  12888.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12889.         StartForward(as_stm_s(Root), as_stm_s_List);
  12890.         while not Finished(as_stm_s_List) loop
  12891.             as_stm_s_Item := Cell(as_stm_s_List);
  12892.             Scan_STM(as_stm_s_Item);
  12893.             Forward(as_stm_s_List);
  12894.         end loop;
  12895.         EndIterate(as_stm_s_List);
  12896.       end if;
  12897.      
  12898.      
  12899.       case_alternative_IH.R.ih_incase_alternative := false;
  12900.      
  12901.      
  12902.         case_alternative_IH.R := Old_case_alternative_IHR;
  12903.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12904.      
  12905.     end Scan_case_alternative;
  12906.      
  12907.      
  12908.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator) is
  12909.         as_stm_s_List : SeqOfSTM.Generator;
  12910.         as_stm_s_Item : STM.Locator;
  12911.         use SeqOfSTM;
  12912.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12913.     begin
  12914.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12915.      
  12916.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  12917.         then
  12918.      
  12919.     if IsSourceRange (lx_srcpos(root)) then
  12920.           IncrementToken (elsifz);
  12921.     end if;
  12922.      
  12923.         end if;
  12924.      
  12925.         if NAME_EXP.IsNull(as_cond_exp_void(Root))
  12926.         then
  12927.      
  12928.       IncrementToken (else_ifz);
  12929.      
  12930.         end if;
  12931.       if not NAME_EXP.IsNull(as_cond_exp_void(Root)) then
  12932.         Scan_NAME_EXP(as_cond_exp_void(Root));
  12933.       end if;
  12934.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12935.      
  12936.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  12937.         then
  12938.      
  12939.       IncrementToken (thenz);
  12940.      
  12941.         end if;
  12942.         StartForward(as_stm_s(Root), as_stm_s_List);
  12943.         while not Finished(as_stm_s_List) loop
  12944.             as_stm_s_Item := Cell(as_stm_s_List);
  12945.             Scan_STM(as_stm_s_Item);
  12946.             Forward(as_stm_s_List);
  12947.         end loop;
  12948.         EndIterate(as_stm_s_List);
  12949.       end if;
  12950.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12951.      
  12952.     end Scan_cond_alternative;
  12953.      
  12954.      
  12955.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator) is
  12956.         as_handler_choice_s_List : SeqOfCHOICE.Generator;
  12957.         as_handler_choice_s_Item : CHOICE.Locator;
  12958.         use SeqOfCHOICE;
  12959.         as_stm_s_List : SeqOfSTM.Generator;
  12960.         as_stm_s_Item : STM.Locator;
  12961.         use SeqOfSTM;
  12962.         Old_handler_alternative_IHR : handler_alternative_IH.RecType := handler_alternative_IH.R;
  12963.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12964.     begin
  12965.         handler_alternative_IH.R.ih_inhandler_alternative :=  false ;
  12966.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12967.      
  12968.      
  12969.        handler_alternative_IH.R.ih_inhandler_alternative := true;
  12970.        IncrementToken (when_exceptionz);
  12971.        IncrementToken (arrowz);
  12972.      
  12973.      
  12974.       if not SeqOfCHOICE.IsNull(as_handler_choice_s(Root)) then
  12975.         StartForward(as_handler_choice_s(Root), as_handler_choice_s_List);
  12976.         while not Finished(as_handler_choice_s_List) loop
  12977.             as_handler_choice_s_Item := Cell(as_handler_choice_s_List);
  12978.      
  12979.      
  12980.       if SERIES_UNIT_IH.R.ih_inlist then
  12981.           IncrementToken (barz);
  12982.       end if;
  12983.       SERIES_UNIT_IH.R.ih_inlist := true;
  12984.      
  12985.      
  12986.             Scan_CHOICE(as_handler_choice_s_Item);
  12987.             Forward(as_handler_choice_s_List);
  12988.         end loop;
  12989.         EndIterate(as_handler_choice_s_List);
  12990.       end if;
  12991.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12992.         StartForward(as_stm_s(Root), as_stm_s_List);
  12993.         while not Finished(as_stm_s_List) loop
  12994.             as_stm_s_Item := Cell(as_stm_s_List);
  12995.             Scan_STM(as_stm_s_Item);
  12996.             Forward(as_stm_s_List);
  12997.         end loop;
  12998.         EndIterate(as_stm_s_List);
  12999.       end if;
  13000.      
  13001.      
  13002.       handler_alternative_IH.R.ih_inhandler_alternative := false;
  13003.       SERIES_UNIT_IH.R.ih_inlist := false;
  13004.      
  13005.      
  13006.         handler_alternative_IH.R := Old_handler_alternative_IHR;
  13007.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13008.      
  13009.     end Scan_handler_alternative;
  13010.      
  13011.      
  13012.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator) is
  13013.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13014.     begin
  13015.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13016.       if not pragma_declNode.IsNull(as_pragma_alternative(Root)) then
  13017.         Scan_pragma_decl(as_pragma_alternative(Root));
  13018.       end if;
  13019.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13020.      
  13021.     end Scan_pragma_alternative;
  13022.      
  13023.      
  13024.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator) is
  13025.         as_stm_s_List : SeqOfSTM.Generator;
  13026.         as_stm_s_Item : STM.Locator;
  13027.         use SeqOfSTM;
  13028.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13029.     begin
  13030.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13031.       if not NAME_EXP.IsNull(as_select_exp_void(Root)) then
  13032.      
  13033.      
  13034.        IncrementToken (when_selectz);
  13035.      
  13036.      
  13037.         Scan_NAME_EXP(as_select_exp_void(Root));
  13038.      
  13039.      
  13040.      IncrementToken (arrowz);
  13041.      
  13042.      
  13043.       end if;
  13044.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  13045.         StartForward(as_stm_s(Root), as_stm_s_List);
  13046.         while not Finished(as_stm_s_List) loop
  13047.             as_stm_s_Item := Cell(as_stm_s_List);
  13048.      
  13049.      
  13050.     if SERIES_UNIT_IH.R.ih_inlist then
  13051.         IncrementToken (or_selectz);
  13052.     end if;
  13053.     SERIES_UNIT_IH.R.ih_inlist := true;
  13054.      
  13055.      
  13056.             Scan_STM(as_stm_s_Item);
  13057.             Forward(as_stm_s_List);
  13058.         end loop;
  13059.         EndIterate(as_stm_s_List);
  13060.       end if;
  13061.      
  13062.      
  13063.   SERIES_UNIT_IH.R.ih_inlist := false;
  13064.      
  13065.      
  13066.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13067.      
  13068.     end Scan_select_alternative;
  13069.      
  13070. end ALTERNATIVE_Pkg;
  13071. -- End: SCALTERNATIVE bdy -----------------------------------------------------
  13072. ::::::::::::::
  13073. scalterna.spc
  13074. ::::::::::::::
  13075. -- Begin: SCALTERNATIVE spc ---------------------------------------------------
  13076.      
  13077. with ST_DIANA; use ST_DIANA;
  13078.              package ALTERNATIVE_Pkg is
  13079.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator);
  13080.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator);
  13081.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator);
  13082.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator);
  13083.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator);
  13084.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator);
  13085. end ALTERNATIVE_Pkg;
  13086. -- End: SCALTERNATIVE spc -----------------------------------------------------
  13087. ::::::::::::::
  13088. scblock_s.bdy
  13089. ::::::::::::::
  13090. -- Begin: SCBLOCK_STUB bdy ---------------------------------------------------
  13091.      
  13092. with Halstead_Data_Base;  use Halstead_Data_Base;
  13093. with Definitions; use Definitions;
  13094.              with ITEM_Pkg; use ITEM_Pkg;
  13095. with STM_Pkg; use STM_Pkg;
  13096. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  13097.      
  13098.                with BLOCK_STM_IH;
  13099.                with Source_Position_Utilities;
  13100.                          package body BLOCK_STUB_Pkg is
  13101.      
  13102.      
  13103.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator) is
  13104.     begin
  13105.         case Kind(Root) is
  13106.           when body_blockKind => Scan_body_block(Root);
  13107.           when body_stubKind => Scan_body_stub(Root);
  13108.           when others => null;
  13109.         end case;
  13110.     end Scan_BLOCK_STUB;
  13111.      
  13112.      
  13113.     procedure Scan_body_block(Root : body_blockNode.Locator) is
  13114.         as_item_s_List : SeqOfITEM.Generator;
  13115.         as_item_s_Item : ITEM.Locator;
  13116.         use SeqOfITEM;
  13117.         as_stm_s_List : SeqOfSTM.Generator;
  13118.         as_stm_s_Item : STM.Locator;
  13119.         use SeqOfSTM;
  13120.         as_handler_s_List : SeqOfhandler_alternativeNode.Generator;
  13121.         as_handler_s_Item : handler_alternativeNode.Locator;
  13122.         use SeqOfhandler_alternativeNode;
  13123.     begin
  13124.       if not SeqOfITEM.IsNull(as_item_s(Root)) then
  13125.      
  13126.      
  13127.      if block_stm_IH.R.ih_inblock then
  13128.          IncrementToken (declarez);
  13129.          block_stm_IH.R.ih_inblock := false;
  13130.      end if;
  13131.      
  13132.      
  13133.         StartForward(as_item_s(Root), as_item_s_List);
  13134.         while not Finished(as_item_s_List) loop
  13135.             as_item_s_Item := Cell(as_item_s_List);
  13136.             Scan_ITEM(as_item_s_Item);
  13137.             Forward(as_item_s_List);
  13138.         end loop;
  13139.         EndIterate(as_item_s_List);
  13140.       end if;
  13141.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  13142.      
  13143.      
  13144.     IncrementToken (beginz);
  13145.      
  13146.      
  13147.         StartForward(as_stm_s(Root), as_stm_s_List);
  13148.         while not Finished(as_stm_s_List) loop
  13149.             as_stm_s_Item := Cell(as_stm_s_List);
  13150.             Scan_STM(as_stm_s_Item);
  13151.             Forward(as_stm_s_List);
  13152.         end loop;
  13153.         EndIterate(as_stm_s_List);
  13154.       end if;
  13155.       if not SeqOfhandler_alternativeNode.IsNull(as_handler_s(Root)) then
  13156.      
  13157.      
  13158.      IncrementToken (exceptionz);
  13159.      
  13160.      
  13161.         StartForward(as_handler_s(Root), as_handler_s_List);
  13162.         while not Finished(as_handler_s_List) loop
  13163.             as_handler_s_Item := Cell(as_handler_s_List);
  13164.             Scan_handler_alternative(as_handler_s_Item);
  13165.             Forward(as_handler_s_List);
  13166.         end loop;
  13167.         EndIterate(as_handler_s_List);
  13168.       end if;
  13169.      
  13170.      
  13171.    if not Source_Position_Utilities.Is_Srcpos_Null (lx_srcpos (root)) then
  13172.        IncrementToken (end_beginz);
  13173.    end if;
  13174.      
  13175.      
  13176.      
  13177.     end Scan_body_block;
  13178.      
  13179.      
  13180.     procedure Scan_body_stub(Root : body_stubNode.Locator) is
  13181.     begin
  13182.      
  13183.      
  13184.       --- should be is_separatez not is_packagez
  13185.       IncrementToken (is_separatez);
  13186.       IncrementToken (separatez);
  13187.      
  13188.      
  13189.      
  13190.     end Scan_body_stub;
  13191.      
  13192. end BLOCK_STUB_Pkg;
  13193. -- End: SCBLOCK_STUB bdy -----------------------------------------------------
  13194.      
  13195. ::::::::::::::
  13196. scblock_s.spc
  13197. ::::::::::::::
  13198. -- Begin: SCBLOCK_STUB spc ---------------------------------------------------
  13199.      
  13200. with ST_DIANA; use ST_DIANA;
  13201.              package BLOCK_STUB_Pkg is
  13202.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator);
  13203.     procedure Scan_body_block(Root : body_blockNode.Locator);
  13204.     procedure Scan_body_stub(Root : body_stubNode.Locator);
  13205. end BLOCK_STUB_Pkg;
  13206. -- End: SCBLOCK_STUB spc -----------------------------------------------------
  13207. ::::::::::::::
  13208. scchoice.bdy
  13209. ::::::::::::::
  13210. -- Begin: SCCHOICE bdy ---------------------------------------------------
  13211.      
  13212. with Halstead_Data_Base;  use Halstead_Data_Base;
  13213. with Definitions; use Definitions;
  13214.              with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  13215. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  13216.      
  13217.           with agg_named_IH;
  13218.           with case_alternative_IH;
  13219.           with handler_alternative_IH;
  13220.           with inner_record_IH;
  13221.                          package body CHOICE_Pkg is
  13222.      
  13223.      
  13224.     procedure Scan_CHOICE(Root : CHOICE.Locator) is
  13225.     begin
  13226.         case Kind(Root) is
  13227.           when ch_discrete_rangeKind => Scan_ch_discrete_range(Root);
  13228.           when ch_expKind => Scan_ch_exp(Root);
  13229.           when ch_othersKind => Scan_ch_others(Root);
  13230.           when others => null;
  13231.         end case;
  13232.     end Scan_CHOICE;
  13233.      
  13234.      
  13235.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator) is
  13236.     begin
  13237.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  13238.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  13239.       end if;
  13240.      
  13241.     end Scan_ch_discrete_range;
  13242.      
  13243.      
  13244.     procedure Scan_ch_exp(Root : ch_expNode.Locator) is
  13245.     begin
  13246.       if not NAME_EXP.IsNull(as_exp(Root)) then
  13247.         Scan_NAME_EXP(as_exp(Root));
  13248.       end if;
  13249.      
  13250.     end Scan_ch_exp;
  13251.      
  13252.      
  13253.     procedure Scan_ch_others(Root : ch_othersNode.Locator) is
  13254.     begin
  13255.      
  13256.      
  13257.      if agg_named_IH.R.ih_inagg_named then
  13258.         IncrementToken (others_aggregatez);
  13259.      end if;
  13260.      if case_alternative_IH.R.ih_incase_alternative then
  13261.         IncrementToken (others_casez);
  13262.      end if;
  13263.      if handler_alternative_IH.R.ih_inhandler_alternative then
  13264.          IncrementToken (others_exceptionz);
  13265.      end if;
  13266.      if inner_record_IH.R.ih_in_variant then
  13267.          IncrementToken (others_variantz);
  13268.      end if;
  13269.      
  13270.      
  13271.      
  13272.     end Scan_ch_others;
  13273.      
  13274. end CHOICE_Pkg;
  13275. -- End: SCCHOICE bdy -----------------------------------------------------
  13276. ::::::::::::::
  13277. scchoice.spc
  13278. ::::::::::::::
  13279. -- Begin: SCCHOICE spc ---------------------------------------------------
  13280.      
  13281. with ST_DIANA; use ST_DIANA;
  13282.              package CHOICE_Pkg is
  13283.     procedure Scan_CHOICE(Root : CHOICE.Locator);
  13284.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator);
  13285.     procedure Scan_ch_exp(Root : ch_expNode.Locator);
  13286.     procedure Scan_ch_others(Root : ch_othersNode.Locator);
  13287. end CHOICE_Pkg;
  13288. -- End: SCCHOICE spc -----------------------------------------------------
  13289. ::::::::::::::
  13290. sccomp_un.bdy
  13291. ::::::::::::::
  13292. -- Begin: SCCOMP_UNIT_CLASS bdy ---------------------------------------------------
  13293.      
  13294. with Halstead_Data_Base;  use Halstead_Data_Base;
  13295. with Definitions; use Definitions;
  13296.              with ITEM_Pkg; use ITEM_Pkg;
  13297. package body COMP_UNIT_CLASS_Pkg is
  13298.      
  13299.      
  13300.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator) is
  13301.     begin
  13302.         case Kind(Root) is
  13303.           when comp_unitKind => Scan_comp_unit(Root);
  13304.           when others => null;
  13305.         end case;
  13306.     end Scan_COMP_UNIT_CLASS;
  13307.      
  13308.      
  13309.     procedure Scan_comp_unit(Root : comp_unitNode.Locator) is
  13310.         as_context_List : SeqOfITEM.Generator;
  13311.         as_context_Item : ITEM.Locator;
  13312.         use SeqOfITEM;
  13313.         as_pragma_s_List : SeqOfpragma_declNode.Generator;
  13314.         as_pragma_s_Item : pragma_declNode.Locator;
  13315.         use SeqOfpragma_declNode;
  13316.     begin
  13317.      
  13318.      
  13319.      
  13320.      CurrentBlock := InitializeCurrentBlock;
  13321.      BlockStack := BlockInfoStack.Create;
  13322.        -- This adds a dummy frame on the stack so that it is not necessary
  13323.        -- to check when popping the stack at the end of the program
  13324.        -- if the stack has at least one record.
  13325.      BlockInfoStack.Push(BlockStack, CurrentBlock);
  13326.      if Kind (as_unit_body (root)) in subp_declKind then
  13327.          if Kind (as_subp_designator
  13328.             (as_unit_body (root))) in proc_idKind
  13329.             then
  13330.              SetBlockId (lx_symrep
  13331.                            (as_subp_designator (as_unit_body (root))),
  13332.                          procedure_block,
  13333.                          SpcId,
  13334.                          LineNumber (lx_srcpos (as_unit_body (root)))
  13335.                          );
  13336.          else
  13337.              SetBlockId (lx_symrep
  13338.                            (as_subp_designator (as_unit_body (root))),
  13339.                          function_block,
  13340.                          SpcId,
  13341.                          LineNumber (lx_srcpos (as_unit_body (root)))
  13342.                          );
  13343.          end if;
  13344.      
  13345.      end if;
  13346.      
  13347.      
  13348.       if not SeqOfITEM.IsNull(as_context(Root)) then
  13349.         StartForward(as_context(Root), as_context_List);
  13350.         while not Finished(as_context_List) loop
  13351.             as_context_Item := Cell(as_context_List);
  13352.             Scan_ITEM(as_context_Item);
  13353.             Forward(as_context_List);
  13354.         end loop;
  13355.         EndIterate(as_context_List);
  13356.       end if;
  13357.       if not SeqOfpragma_declNode.IsNull(as_pragma_s(Root)) then
  13358.         StartForward(as_pragma_s(Root), as_pragma_s_List);
  13359.         while not Finished(as_pragma_s_List) loop
  13360.             as_pragma_s_Item := Cell(as_pragma_s_List);
  13361.             Scan_pragma_decl(as_pragma_s_Item);
  13362.             Forward(as_pragma_s_List);
  13363.         end loop;
  13364.         EndIterate(as_pragma_s_List);
  13365.       end if;
  13366.       if not ITEM.IsNull(as_unit_body(Root)) then
  13367.         Scan_ITEM(as_unit_body(Root));
  13368.       end if;
  13369.      
  13370.      
  13371.      
  13372.       if Kind (as_unit_body (root)) in subp_declKind then
  13373.           ProcessBlockInfo (CurrentBlock);
  13374.       end if;
  13375.      
  13376.      
  13377.      
  13378.      
  13379.     end Scan_comp_unit;
  13380.      
  13381. end COMP_UNIT_CLASS_Pkg;
  13382. -- End: SCCOMP_UNIT_CLASS bdy -----------------------------------------------------
  13383. ::::::::::::::
  13384. sccomp_un.spc
  13385. ::::::::::::::
  13386. -- Begin: SCCOMP_UNIT_CLASS spc ---------------------------------------------------
  13387.      
  13388. with ST_DIANA; use ST_DIANA;
  13389.              package COMP_UNIT_CLASS_Pkg is
  13390.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator);
  13391.     procedure Scan_comp_unit(Root : comp_unitNode.Locator);
  13392. end COMP_UNIT_CLASS_Pkg;
  13393. -- End: SCCOMP_UNIT_CLASS spc -----------------------------------------------------
  13394.      
  13395. ::::::::::::::
  13396. scconstra.bdy
  13397. ::::::::::::::
  13398. -- Begin: SCCONSTRAINT bdy ---------------------------------------------------
  13399.      
  13400. with Halstead_Data_Base;  use Halstead_Data_Base;
  13401. with Definitions; use Definitions;
  13402.              with SERIES_UNIT_IH;
  13403. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  13404. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  13405. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  13406. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  13407.      
  13408.                with subtype_decl_IH;
  13409.                          package body CONSTRAINT_Pkg is
  13410.      
  13411.      
  13412.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator) is
  13413.     begin
  13414.         case Kind(Root) is
  13415.           when RANGE_CONSTRAINT_CLASSKind => Scan_RANGE_CONSTRAINT_CLASS(Root);
  13416.           when REAL_CONSTRAINTKind => Scan_REAL_CONSTRAINT(Root);
  13417.           when apply_constraintKind => Scan_apply_constraint(Root);
  13418.           when dscrmt_constraintKind => Scan_dscrmt_constraint(Root);
  13419.           when index_constraintKind => Scan_index_constraint(Root);
  13420.           when others => null;
  13421.         end case;
  13422.     end Scan_CONSTRAINT;
  13423.      
  13424.      
  13425.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator) is
  13426.     begin
  13427.         case Kind(Root) is
  13428.           when range_attribute_constraintKind => Scan_range_attribute_constraint(Root);
  13429.           when range_constraintKind => Scan_range_constraint(Root);
  13430.           when others => null;
  13431.         end case;
  13432.     end Scan_RANGE_CONSTRAINT_CLASS;
  13433.      
  13434.      
  13435.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator) is
  13436.     begin
  13437.       if not NAME_EXP.IsNull(as_range_exp(Root)) then
  13438.         Scan_NAME_EXP(as_range_exp(Root));
  13439.       end if;
  13440.      
  13441.      
  13442.      SERIES_UNIT_IH.R.ih_inlist := false;
  13443.      
  13444.      
  13445.      
  13446.     end Scan_range_attribute_constraint;
  13447.      
  13448.      
  13449.     procedure Scan_range_constraint(Root : range_constraintNode.Locator) is
  13450.     begin
  13451.      
  13452.      
  13453.       if IsSourceRange (lx_srcpos (root))
  13454.          and then
  13455.          not subtype_decl_IH.R.ih_in_subtype_decl
  13456.          then
  13457.            -- The check for subtype is necessary because in object_type
  13458.            -- we count range if it is a subtype.  This check prevents
  13459.            -- us from counting range twice.
  13460.           IncrementToken (rangez);
  13461.       end if;
  13462.      
  13463.      
  13464.       if not NAME_EXP.IsNull(as_range_exp1(Root)) then
  13465.         Scan_NAME_EXP(as_range_exp1(Root));
  13466.      
  13467.      
  13468.      IncrementToken (dot_dot_rangez);
  13469.      
  13470.      
  13471.       end if;
  13472.       if not NAME_EXP.IsNull(as_range_exp2(Root)) then
  13473.         Scan_NAME_EXP(as_range_exp2(Root));
  13474.       end if;
  13475.      
  13476.      
  13477.      SERIES_UNIT_IH.R.ih_inlist := false;
  13478.      
  13479.      
  13480.      
  13481.     end Scan_range_constraint;
  13482.      
  13483.      
  13484.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator) is
  13485.     begin
  13486.         case Kind(Root) is
  13487.           when fixed_constraintKind => Scan_fixed_constraint(Root);
  13488.           when float_constraintKind => Scan_float_constraint(Root);
  13489.           when others => null;
  13490.         end case;
  13491.     end Scan_REAL_CONSTRAINT;
  13492.      
  13493.      
  13494.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator) is
  13495.     begin
  13496.       if not NAME_EXP.IsNull(as_delta(Root)) then
  13497.         Scan_NAME_EXP(as_delta(Root));
  13498.       end if;
  13499.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  13500.         Scan_range_constraint(as_range_constraint(Root));
  13501.       end if;
  13502.      
  13503.      
  13504.      SERIES_UNIT_IH.R.ih_inlist := false;
  13505.      
  13506.      
  13507.      
  13508.     end Scan_fixed_constraint;
  13509.      
  13510.      
  13511.     procedure Scan_float_constraint(Root : float_constraintNode.Locator) is
  13512.     begin
  13513.       if not NAME_EXP.IsNull(as_digits(Root)) then
  13514.         Scan_NAME_EXP(as_digits(Root));
  13515.       end if;
  13516.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  13517.         Scan_range_constraint(as_range_constraint(Root));
  13518.       end if;
  13519.      
  13520.      
  13521.      SERIES_UNIT_IH.R.ih_inlist := false;
  13522.      
  13523.      
  13524.      
  13525.     end Scan_float_constraint;
  13526.      
  13527.      
  13528.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator) is
  13529.         as_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  13530.         as_assoc_s_Item : GENERAL_ASSOC.Locator;
  13531.         use SeqOfGENERAL_ASSOC;
  13532.     begin
  13533.       if not SeqOfGENERAL_ASSOC.IsNull(as_assoc_s(Root)) then
  13534.         StartForward(as_assoc_s(Root), as_assoc_s_List);
  13535.         while not Finished(as_assoc_s_List) loop
  13536.             as_assoc_s_Item := Cell(as_assoc_s_List);
  13537.             Scan_GENERAL_ASSOC(as_assoc_s_Item);
  13538.             Forward(as_assoc_s_List);
  13539.         end loop;
  13540.         EndIterate(as_assoc_s_List);
  13541.       end if;
  13542.      
  13543.      
  13544.      SERIES_UNIT_IH.R.ih_inlist := false;
  13545.      
  13546.      
  13547.      
  13548.     end Scan_apply_constraint;
  13549.      
  13550.      
  13551.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator) is
  13552.         as_dscrmt_assoc_s_List : SeqOfAGG_COMPONENT.Generator;
  13553.         as_dscrmt_assoc_s_Item : AGG_COMPONENT.Locator;
  13554.         use SeqOfAGG_COMPONENT;
  13555.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13556.     begin
  13557.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13558.      
  13559.      
  13560.       IncrementToken (open_parenthesisz);
  13561.      
  13562.      
  13563.       if not SeqOfAGG_COMPONENT.IsNull(as_dscrmt_assoc_s(Root)) then
  13564.         StartForward(as_dscrmt_assoc_s(Root), as_dscrmt_assoc_s_List);
  13565.         while not Finished(as_dscrmt_assoc_s_List) loop
  13566.             as_dscrmt_assoc_s_Item := Cell(as_dscrmt_assoc_s_List);
  13567.      
  13568.      
  13569.       if SERIES_UNIT_IH.R.ih_inlist then
  13570.           IncrementToken (commaz);
  13571.       end if;
  13572.       SERIES_UNIT_IH.R.ih_inlist := true;
  13573.      
  13574.      
  13575.             Scan_AGG_COMPONENT(as_dscrmt_assoc_s_Item);
  13576.             Forward(as_dscrmt_assoc_s_List);
  13577.         end loop;
  13578.         EndIterate(as_dscrmt_assoc_s_List);
  13579.       end if;
  13580.      
  13581.      
  13582.       IncrementToken (closed_parenthesisz);
  13583.       SERIES_UNIT_IH.R.ih_inlist := false;
  13584.      
  13585.      
  13586.      
  13587.      
  13588.      SERIES_UNIT_IH.R.ih_inlist := false;
  13589.      
  13590.      
  13591.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13592.      
  13593.     end Scan_dscrmt_constraint;
  13594.      
  13595.      
  13596.     procedure Scan_index_constraint(Root : index_constraintNode.Locator) is
  13597.         as_discrete_range_s_List : SeqOfOBJECT_TYPE.Generator;
  13598.         as_discrete_range_s_Item : OBJECT_TYPE.Locator;
  13599.         use SeqOfOBJECT_TYPE;
  13600.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13601.     begin
  13602.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13603.      
  13604.      
  13605.      IncrementToken (open_parenthesisz);
  13606.      
  13607.      
  13608.       if not SeqOfOBJECT_TYPE.IsNull(as_discrete_range_s(Root)) then
  13609.         StartForward(as_discrete_range_s(Root), as_discrete_range_s_List);
  13610.         while not Finished(as_discrete_range_s_List) loop
  13611.             as_discrete_range_s_Item := Cell(as_discrete_range_s_List);
  13612.      
  13613.      
  13614.       if SERIES_UNIT_IH.R.ih_inlist then
  13615.           IncrementToken (commaz);
  13616.       end if;
  13617.       SERIES_UNIT_IH.R.ih_inlist := true;
  13618.      
  13619.      
  13620.             Scan_OBJECT_TYPE(as_discrete_range_s_Item);
  13621.             Forward(as_discrete_range_s_List);
  13622.         end loop;
  13623.         EndIterate(as_discrete_range_s_List);
  13624.       end if;
  13625.      
  13626.      
  13627.       IncrementToken (closed_parenthesisz);
  13628.       SERIES_UNIT_IH.R.ih_inlist := false;
  13629.      
  13630.      
  13631.      
  13632.      
  13633.      SERIES_UNIT_IH.R.ih_inlist := false;
  13634.      
  13635.      
  13636.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13637.      
  13638.     end Scan_index_constraint;
  13639.      
  13640. end CONSTRAINT_Pkg;
  13641. -- End: SCCONSTRAINT bdy -----------------------------------------------------
  13642. ::::::::::::::
  13643. scconstra.spc
  13644. ::::::::::::::
  13645. -- Begin: SCCONSTRAINT spc ---------------------------------------------------
  13646.      
  13647. with ST_DIANA; use ST_DIANA;
  13648.              package CONSTRAINT_Pkg is
  13649.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator);
  13650.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator);
  13651.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator);
  13652.     procedure Scan_range_constraint(Root : range_constraintNode.Locator);
  13653.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator);
  13654.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator);
  13655.     procedure Scan_float_constraint(Root : float_constraintNode.Locator);
  13656.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator);
  13657.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator);
  13658.     procedure Scan_index_constraint(Root : index_constraintNode.Locator);
  13659. end CONSTRAINT_Pkg;
  13660. -- End: SCCONSTRAINT spc -----------------------------------------------------
  13661. ::::::::::::::
  13662. scdef_id.bdy
  13663. ::::::::::::::
  13664. --VMS file: %nosc.work.tools.halstead.source*(SCDEF_ID.bdy)
  13665. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCDEF_ID.bdy
  13666. -- Begin: SCDEF_ID bdy ---------------------------------------------------
  13667.      
  13668. with Halstead_Data_Base;  use Halstead_Data_Base;
  13669. with Definitions; use Definitions;
  13670.      
  13671.            with variable_decl_IH;
  13672.            with type_decl_IH;
  13673.            with Identifier_Utilities;
  13674.                      package body DEF_ID_Pkg is
  13675.      
  13676.      
  13677.     procedure Scan_DEF_ID(Root : DEF_ID.Locator) is
  13678.     begin
  13679.         case Kind(Root) is
  13680.           when ATTRIBUTE_IDKind => Scan_ATTRIBUTE_ID(Root);
  13681.           when BUILT_IN_OPERATORKind => Scan_BUILT_IN_OPERATOR(Root);
  13682.           when GENERAL_TYPE_IDKind => Scan_GENERAL_TYPE_ID(Root);
  13683.           when LITERAL_IDKind => Scan_LITERAL_ID(Root);
  13684.           when OBJECT_IDKind => Scan_OBJECT_ID(Root);
  13685.           when PKG_ID_CLASSKind => Scan_PKG_ID_CLASS(Root);
  13686.           when PRAGMA_IDKind => Scan_PRAGMA_ID(Root);
  13687.           when STM_IDKind => Scan_STM_ID(Root);
  13688.           when SUBP_IDKind => Scan_SUBP_ID(Root);
  13689.           when argument_idKind => Scan_argument_id(Root);
  13690.           when exception_idKind => Scan_exception_id(Root);
  13691.           when iteration_idKind => Scan_iteration_id(Root);
  13692.           when number_idKind => Scan_number_id(Root);
  13693.           when subtype_idKind => Scan_subtype_id(Root);
  13694.           when task_body_idKind => Scan_task_body_id(Root);
  13695.           when others => null;
  13696.         end case;
  13697.     end Scan_DEF_ID;
  13698.      
  13699.      
  13700.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator) is
  13701.     begin
  13702.         case Kind(Root) is
  13703.           when LRM_ATTRIBUTE_IDKind => Scan_LRM_ATTRIBUTE_ID(Root);
  13704.           when others => null;
  13705.         end case;
  13706.     end Scan_ATTRIBUTE_ID;
  13707.      
  13708.      
  13709.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator) is
  13710.     begin
  13711.         case Kind(Root) is
  13712.           when address_idKind => Scan_address_id(Root);
  13713.           when aft_idKind => Scan_aft_id(Root);
  13714.           when base_idKind => Scan_base_id(Root);
  13715.           when callable_idKind => Scan_callable_id(Root);
  13716.           when constrained_idKind => Scan_constrained_id(Root);
  13717.           when count_idKind => Scan_count_id(Root);
  13718.           when delta_idKind => Scan_delta_id(Root);
  13719.           when digits_idKind => Scan_digits_id(Root);
  13720.           when emax_idKind => Scan_emax_id(Root);
  13721.           when epsilon_idKind => Scan_epsilon_id(Root);
  13722.           when first_bit_idKind => Scan_first_bit_id(Root);
  13723.           when first_index_idKind => Scan_first_index_id(Root);
  13724.           when first_scalar_idKind => Scan_first_scalar_id(Root);
  13725.           when fore_idKind => Scan_fore_id(Root);
  13726.           when image_idKind => Scan_image_id(Root);
  13727.           when large_idKind => Scan_large_id(Root);
  13728.           when last_bit_idKind => Scan_last_bit_id(Root);
  13729.           when last_index_idKind => Scan_last_index_id(Root);
  13730.           when last_scalar_idKind => Scan_last_scalar_id(Root);
  13731.           when length_idKind => Scan_length_id(Root);
  13732.           when machine_emax_idKind => Scan_machine_emax_id(Root);
  13733.           when machine_emin_idKind => Scan_machine_emin_id(Root);
  13734.           when machine_mantissa_idKind => Scan_machine_mantissa_id(Root);
  13735.           when machine_overflows_idKind => Scan_machine_overflows_id(Root);
  13736.           when machine_radix_idKind => Scan_machine_radix_id(Root);
  13737.           when machine_rounds_idKind => Scan_machine_rounds_id(Root);
  13738.           when mantissa_idKind => Scan_mantissa_id(Root);
  13739.           when pos_idKind => Scan_pos_id(Root);
  13740.           when position_idKind => Scan_position_id(Root);
  13741.           when pred_idKind => Scan_pred_id(Root);
  13742.           when range_idKind => Scan_range_id(Root);
  13743.           when safe_emax_idKind => Scan_safe_emax_id(Root);
  13744.           when safe_large_idKind => Scan_safe_large_id(Root);
  13745.           when safe_small_idKind => Scan_safe_small_id(Root);
  13746.           when size_objects_idKind => Scan_size_objects_id(Root);
  13747.           when size_type_idKind => Scan_size_type_id(Root);
  13748.           when small_idKind => Scan_small_id(Root);
  13749.           when storage_size_collection_idKind => Scan_storage_size_collection_id(Root);
  13750.           when storage_size_task_idKind => Scan_storage_size_task_id(Root);
  13751.           when succ_idKind => Scan_succ_id(Root);
  13752.           when terminated_idKind => Scan_terminated_id(Root);
  13753.           when val_idKind => Scan_val_id(Root);
  13754.           when value_idKind => Scan_value_id(Root);
  13755.           when width_idKind => Scan_width_id(Root);
  13756.           when others => null;
  13757.         end case;
  13758.     end Scan_LRM_ATTRIBUTE_ID;
  13759.      
  13760.      
  13761.     procedure Scan_address_id(Root : address_idNode.Locator) is
  13762.     begin
  13763.      
  13764.      
  13765.        if not Identifier_Utilities.Is_Id_Null (root) then
  13766.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13767.        end if;
  13768.      
  13769.      
  13770.      
  13771.     end Scan_address_id;
  13772.      
  13773.      
  13774.     procedure Scan_aft_id(Root : aft_idNode.Locator) is
  13775.     begin
  13776.      
  13777.      
  13778.        if not Identifier_Utilities.Is_Id_Null (root) then
  13779.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13780.        end if;
  13781.      
  13782.      
  13783.      
  13784.     end Scan_aft_id;
  13785.      
  13786.      
  13787.     procedure Scan_base_id(Root : base_idNode.Locator) is
  13788.     begin
  13789.      
  13790.      
  13791.        if not Identifier_Utilities.Is_Id_Null (root) then
  13792.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13793.        end if;
  13794.      
  13795.      
  13796.      
  13797.     end Scan_base_id;
  13798.      
  13799.      
  13800.     procedure Scan_callable_id(Root : callable_idNode.Locator) is
  13801.     begin
  13802.      
  13803.      
  13804.        if not Identifier_Utilities.Is_Id_Null (root) then
  13805.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13806.        end if;
  13807.      
  13808.      
  13809.      
  13810.     end Scan_callable_id;
  13811.      
  13812.      
  13813.     procedure Scan_constrained_id(Root : constrained_idNode.Locator) is
  13814.     begin
  13815.      
  13816.      
  13817.        if not Identifier_Utilities.Is_Id_Null (root) then
  13818.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13819.        end if;
  13820.      
  13821.      
  13822.      
  13823.     end Scan_constrained_id;
  13824.      
  13825.      
  13826.     procedure Scan_count_id(Root : count_idNode.Locator) is
  13827.     begin
  13828.      
  13829.      
  13830.        if not Identifier_Utilities.Is_Id_Null (root) then
  13831.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13832.        end if;
  13833.      
  13834.      
  13835.      
  13836.     end Scan_count_id;
  13837.      
  13838.      
  13839.     procedure Scan_delta_id(Root : delta_idNode.Locator) is
  13840.     begin
  13841.      
  13842.      
  13843.        if not Identifier_Utilities.Is_Id_Null (root) then
  13844.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13845.        end if;
  13846.      
  13847.      
  13848.      
  13849.     end Scan_delta_id;
  13850.      
  13851.      
  13852.     procedure Scan_digits_id(Root : digits_idNode.Locator) is
  13853.     begin
  13854.      
  13855.      
  13856.        if not Identifier_Utilities.Is_Id_Null (root) then
  13857.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13858.        end if;
  13859.      
  13860.      
  13861.      
  13862.     end Scan_digits_id;
  13863.      
  13864.      
  13865.     procedure Scan_emax_id(Root : emax_idNode.Locator) is
  13866.     begin
  13867.      
  13868.      
  13869.        if not Identifier_Utilities.Is_Id_Null (root) then
  13870.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13871.        end if;
  13872.      
  13873.      
  13874.      
  13875.     end Scan_emax_id;
  13876.      
  13877.      
  13878.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator) is
  13879.     begin
  13880.      
  13881.      
  13882.        if not Identifier_Utilities.Is_Id_Null (root) then
  13883.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13884.        end if;
  13885.      
  13886.      
  13887.      
  13888.     end Scan_epsilon_id;
  13889.      
  13890.      
  13891.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator) is
  13892.     begin
  13893.      
  13894.      
  13895.        if not Identifier_Utilities.Is_Id_Null (root) then
  13896.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13897.        end if;
  13898.      
  13899.      
  13900.      
  13901.     end Scan_first_bit_id;
  13902.      
  13903.      
  13904.     procedure Scan_first_index_id(Root : first_index_idNode.Locator) is
  13905.     begin
  13906.      
  13907.      
  13908.        if not Identifier_Utilities.Is_Id_Null (root) then
  13909.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13910.        end if;
  13911.      
  13912.      
  13913.      
  13914.     end Scan_first_index_id;
  13915.      
  13916.      
  13917.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator) is
  13918.     begin
  13919.      
  13920.      
  13921.        if not Identifier_Utilities.Is_Id_Null (root) then
  13922.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13923.        end if;
  13924.      
  13925.      
  13926.      
  13927.     end Scan_first_scalar_id;
  13928.      
  13929.      
  13930.     procedure Scan_fore_id(Root : fore_idNode.Locator) is
  13931.     begin
  13932.      
  13933.      
  13934.        if not Identifier_Utilities.Is_Id_Null (root) then
  13935.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13936.        end if;
  13937.      
  13938.      
  13939.      
  13940.     end Scan_fore_id;
  13941.      
  13942.      
  13943.     procedure Scan_image_id(Root : image_idNode.Locator) is
  13944.     begin
  13945.      
  13946.      
  13947.        if not Identifier_Utilities.Is_Id_Null (root) then
  13948.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13949.        end if;
  13950.      
  13951.      
  13952.      
  13953.     end Scan_image_id;
  13954.      
  13955.      
  13956.     procedure Scan_large_id(Root : large_idNode.Locator) is
  13957.     begin
  13958.      
  13959.      
  13960.        if not Identifier_Utilities.Is_Id_Null (root) then
  13961.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13962.        end if;
  13963.      
  13964.      
  13965.      
  13966.     end Scan_large_id;
  13967.      
  13968.      
  13969.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator) is
  13970.     begin
  13971.      
  13972.      
  13973.        if not Identifier_Utilities.Is_Id_Null (root) then
  13974.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13975.        end if;
  13976.      
  13977.      
  13978.      
  13979.     end Scan_last_bit_id;
  13980.      
  13981.      
  13982.     procedure Scan_last_index_id(Root : last_index_idNode.Locator) is
  13983.     begin
  13984.      
  13985.      
  13986.        if not Identifier_Utilities.Is_Id_Null (root) then
  13987.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13988.        end if;
  13989.      
  13990.      
  13991.      
  13992.     end Scan_last_index_id;
  13993.      
  13994.      
  13995.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator) is
  13996.     begin
  13997.      
  13998.      
  13999.        if not Identifier_Utilities.Is_Id_Null (root) then
  14000.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14001.        end if;
  14002.      
  14003.      
  14004.      
  14005.     end Scan_last_scalar_id;
  14006.      
  14007.      
  14008.     procedure Scan_length_id(Root : length_idNode.Locator) is
  14009.     begin
  14010.      
  14011.      
  14012.        if not Identifier_Utilities.Is_Id_Null (root) then
  14013.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14014.        end if;
  14015.      
  14016.      
  14017.      
  14018.     end Scan_length_id;
  14019.      
  14020.      
  14021.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator) is
  14022.     begin
  14023.      
  14024.      
  14025.        if not Identifier_Utilities.Is_Id_Null (root) then
  14026.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14027.        end if;
  14028.      
  14029.      
  14030.      
  14031.     end Scan_machine_emax_id;
  14032.      
  14033.      
  14034.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator) is
  14035.     begin
  14036.      
  14037.      
  14038.        if not Identifier_Utilities.Is_Id_Null (root) then
  14039.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14040.        end if;
  14041.      
  14042.      
  14043.      
  14044.     end Scan_machine_emin_id;
  14045.      
  14046.      
  14047.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator) is
  14048.     begin
  14049.      
  14050.      
  14051.        if not Identifier_Utilities.Is_Id_Null (root) then
  14052.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14053.        end if;
  14054.      
  14055.      
  14056.      
  14057.     end Scan_machine_mantissa_id;
  14058.      
  14059.      
  14060.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator) is
  14061.     begin
  14062.      
  14063.      
  14064.        if not Identifier_Utilities.Is_Id_Null (root) then
  14065.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14066.        end if;
  14067.      
  14068.      
  14069.      
  14070.     end Scan_machine_overflows_id;
  14071.      
  14072.      
  14073.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator) is
  14074.     begin
  14075.      
  14076.      
  14077.        if not Identifier_Utilities.Is_Id_Null (root) then
  14078.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14079.        end if;
  14080.      
  14081.      
  14082.      
  14083.     end Scan_machine_radix_id;
  14084.      
  14085.      
  14086.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator) is
  14087.     begin
  14088.      
  14089.      
  14090.        if not Identifier_Utilities.Is_Id_Null (root) then
  14091.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14092.        end if;
  14093.      
  14094.      
  14095.      
  14096.     end Scan_machine_rounds_id;
  14097.      
  14098.      
  14099.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator) is
  14100.     begin
  14101.      
  14102.      
  14103.        if not Identifier_Utilities.Is_Id_Null (root) then
  14104.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14105.        end if;
  14106.      
  14107.      
  14108.      
  14109.     end Scan_mantissa_id;
  14110.      
  14111.      
  14112.     procedure Scan_pos_id(Root : pos_idNode.Locator) is
  14113.     begin
  14114.      
  14115.      
  14116.        if not Identifier_Utilities.Is_Id_Null (root) then
  14117.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14118.        end if;
  14119.      
  14120.      
  14121.      
  14122.     end Scan_pos_id;
  14123.      
  14124.      
  14125.     procedure Scan_position_id(Root : position_idNode.Locator) is
  14126.     begin
  14127.      
  14128.      
  14129.        if not Identifier_Utilities.Is_Id_Null (root) then
  14130.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14131.        end if;
  14132.      
  14133.      
  14134.      
  14135.     end Scan_position_id;
  14136.      
  14137.      
  14138.     procedure Scan_pred_id(Root : pred_idNode.Locator) is
  14139.     begin
  14140.      
  14141.      
  14142.        if not Identifier_Utilities.Is_Id_Null (root) then
  14143.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14144.        end if;
  14145.      
  14146.      
  14147.      
  14148.     end Scan_pred_id;
  14149.      
  14150.      
  14151.     procedure Scan_range_id(Root : range_idNode.Locator) is
  14152.     begin
  14153.      
  14154.      
  14155.        if not Identifier_Utilities.Is_Id_Null (root) then
  14156.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14157.        end if;
  14158.      
  14159.      
  14160.      
  14161.     end Scan_range_id;
  14162.      
  14163.      
  14164.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator) is
  14165.     begin
  14166.      
  14167.      
  14168.        if not Identifier_Utilities.Is_Id_Null (root) then
  14169.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14170.        end if;
  14171.      
  14172.      
  14173.      
  14174.     end Scan_safe_emax_id;
  14175.      
  14176.      
  14177.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator) is
  14178.     begin
  14179.      
  14180.      
  14181.        if not Identifier_Utilities.Is_Id_Null (root) then
  14182.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14183.        end if;
  14184.      
  14185.      
  14186.      
  14187.     end Scan_safe_large_id;
  14188.      
  14189.      
  14190.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator) is
  14191.     begin
  14192.      
  14193.      
  14194.        if not Identifier_Utilities.Is_Id_Null (root) then
  14195.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14196.        end if;
  14197.      
  14198.      
  14199.      
  14200.     end Scan_safe_small_id;
  14201.      
  14202.      
  14203.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator) is
  14204.     begin
  14205.      
  14206.      
  14207.        if not Identifier_Utilities.Is_Id_Null (root) then
  14208.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14209.        end if;
  14210.      
  14211.      
  14212.      
  14213.     end Scan_size_objects_id;
  14214.      
  14215.      
  14216.     procedure Scan_size_type_id(Root : size_type_idNode.Locator) is
  14217.     begin
  14218.      
  14219.      
  14220.        if not Identifier_Utilities.Is_Id_Null (root) then
  14221.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14222.        end if;
  14223.      
  14224.      
  14225.      
  14226.     end Scan_size_type_id;
  14227.      
  14228.      
  14229.     procedure Scan_small_id(Root : small_idNode.Locator) is
  14230.     begin
  14231.      
  14232.      
  14233.        if not Identifier_Utilities.Is_Id_Null (root) then
  14234.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14235.        end if;
  14236.      
  14237.      
  14238.      
  14239.     end Scan_small_id;
  14240.      
  14241.      
  14242.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator) is
  14243.     begin
  14244.      
  14245.      
  14246.        if not Identifier_Utilities.Is_Id_Null (root) then
  14247.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14248.        end if;
  14249.      
  14250.      
  14251.      
  14252.     end Scan_storage_size_collection_id;
  14253.      
  14254.      
  14255.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator) is
  14256.     begin
  14257.      
  14258.      
  14259.        if not Identifier_Utilities.Is_Id_Null (root) then
  14260.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14261.        end if;
  14262.      
  14263.      
  14264.      
  14265.     end Scan_storage_size_task_id;
  14266.      
  14267.      
  14268.     procedure Scan_succ_id(Root : succ_idNode.Locator) is
  14269.     begin
  14270.      
  14271.      
  14272.        if not Identifier_Utilities.Is_Id_Null (root) then
  14273.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14274.        end if;
  14275.      
  14276.      
  14277.      
  14278.     end Scan_succ_id;
  14279.      
  14280.      
  14281.     procedure Scan_terminated_id(Root : terminated_idNode.Locator) is
  14282.     begin
  14283.      
  14284.      
  14285.        if not Identifier_Utilities.Is_Id_Null (root) then
  14286.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14287.        end if;
  14288.      
  14289.      
  14290.      
  14291.     end Scan_terminated_id;
  14292.      
  14293.      
  14294.     procedure Scan_val_id(Root : val_idNode.Locator) is
  14295.     begin
  14296.      
  14297.      
  14298.        if not Identifier_Utilities.Is_Id_Null (root) then
  14299.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14300.        end if;
  14301.      
  14302.      
  14303.      
  14304.     end Scan_val_id;
  14305.      
  14306.      
  14307.     procedure Scan_value_id(Root : value_idNode.Locator) is
  14308.     begin
  14309.      
  14310.      
  14311.        if not Identifier_Utilities.Is_Id_Null (root) then
  14312.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14313.        end if;
  14314.      
  14315.      
  14316.      
  14317.     end Scan_value_id;
  14318.      
  14319.      
  14320.     procedure Scan_width_id(Root : width_idNode.Locator) is
  14321.     begin
  14322.      
  14323.      
  14324.        if not Identifier_Utilities.Is_Id_Null (root) then
  14325.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14326.        end if;
  14327.      
  14328.      
  14329.      
  14330.     end Scan_width_id;
  14331.      
  14332.      
  14333.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator) is
  14334.     begin
  14335.         case Kind(Root) is
  14336.           when built_in_absKind => Scan_built_in_abs(Root);
  14337.           when built_in_andKind => Scan_built_in_and(Root);
  14338.           when built_in_modKind => Scan_built_in_mod(Root);
  14339.           when built_in_notKind => Scan_built_in_not(Root);
  14340.           when built_in_orKind => Scan_built_in_or(Root);
  14341.           when built_in_remKind => Scan_built_in_rem(Root);
  14342.           when built_in_xorKind => Scan_built_in_xor(Root);
  14343.           when concatenateKind => Scan_concatenate(Root);
  14344.           when divideKind => Scan_divide(Root);
  14345.           when equalKind => Scan_equal(Root);
  14346.           when exponentKind => Scan_exponent(Root);
  14347.           when greater_thanKind => Scan_greater_than(Root);
  14348.           when greater_than_or_equalKind => Scan_greater_than_or_equal(Root);
  14349.           when less_thanKind => Scan_less_than(Root);
  14350.           when less_than_or_equalKind => Scan_less_than_or_equal(Root);
  14351.           when minusKind => Scan_minus(Root);
  14352.           when multiplyKind => Scan_multiply(Root);
  14353.           when negateKind => Scan_negate(Root);
  14354.           when not_equalKind => Scan_not_equal(Root);
  14355.           when plusKind => Scan_plus(Root);
  14356.           when unary_plusKind => Scan_unary_plus(Root);
  14357.           when others => null;
  14358.         end case;
  14359.     end Scan_BUILT_IN_OPERATOR;
  14360.      
  14361.      
  14362.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator) is
  14363.     begin
  14364.      
  14365.      
  14366.        if not Identifier_Utilities.Is_Id_Null (root) then
  14367.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14368.        end if;
  14369.      
  14370.      
  14371.      
  14372.     end Scan_built_in_abs;
  14373.      
  14374.      
  14375.     procedure Scan_built_in_and(Root : built_in_andNode.Locator) is
  14376.     begin
  14377.      
  14378.      
  14379.        if not Identifier_Utilities.Is_Id_Null (root) then
  14380.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14381.        end if;
  14382.      
  14383.      
  14384.      
  14385.     end Scan_built_in_and;
  14386.      
  14387.      
  14388.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator) is
  14389.     begin
  14390.      
  14391.      
  14392.        if not Identifier_Utilities.Is_Id_Null (root) then
  14393.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14394.        end if;
  14395.      
  14396.      
  14397.      
  14398.     end Scan_built_in_mod;
  14399.      
  14400.      
  14401.     procedure Scan_built_in_not(Root : built_in_notNode.Locator) is
  14402.     begin
  14403.      
  14404.      
  14405.        if not Identifier_Utilities.Is_Id_Null (root) then
  14406.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14407.        end if;
  14408.      
  14409.      
  14410.      
  14411.     end Scan_built_in_not;
  14412.      
  14413.      
  14414.     procedure Scan_built_in_or(Root : built_in_orNode.Locator) is
  14415.     begin
  14416.      
  14417.      
  14418.        if not Identifier_Utilities.Is_Id_Null (root) then
  14419.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14420.        end if;
  14421.      
  14422.      
  14423.      
  14424.     end Scan_built_in_or;
  14425.      
  14426.      
  14427.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator) is
  14428.     begin
  14429.      
  14430.      
  14431.        if not Identifier_Utilities.Is_Id_Null (root) then
  14432.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14433.        end if;
  14434.      
  14435.      
  14436.      
  14437.     end Scan_built_in_rem;
  14438.      
  14439.      
  14440.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator) is
  14441.     begin
  14442.      
  14443.      
  14444.        if not Identifier_Utilities.Is_Id_Null (root) then
  14445.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14446.        end if;
  14447.      
  14448.      
  14449.      
  14450.     end Scan_built_in_xor;
  14451.      
  14452.      
  14453.     procedure Scan_concatenate(Root : concatenateNode.Locator) is
  14454.     begin
  14455.      
  14456.      
  14457.        if not Identifier_Utilities.Is_Id_Null (root) then
  14458.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14459.        end if;
  14460.      
  14461.      
  14462.      
  14463.     end Scan_concatenate;
  14464.      
  14465.      
  14466.     procedure Scan_divide(Root : divideNode.Locator) is
  14467.     begin
  14468.      
  14469.      
  14470.        if not Identifier_Utilities.Is_Id_Null (root) then
  14471.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14472.        end if;
  14473.      
  14474.      
  14475.      
  14476.     end Scan_divide;
  14477.      
  14478.      
  14479.     procedure Scan_equal(Root : equalNode.Locator) is
  14480.     begin
  14481.      
  14482.      
  14483.        if not Identifier_Utilities.Is_Id_Null (root) then
  14484.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14485.        end if;
  14486.      
  14487.      
  14488.      
  14489.     end Scan_equal;
  14490.      
  14491.      
  14492.     procedure Scan_exponent(Root : exponentNode.Locator) is
  14493.     begin
  14494.      
  14495.      
  14496.        if not Identifier_Utilities.Is_Id_Null (root) then
  14497.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14498.        end if;
  14499.      
  14500.      
  14501.      
  14502.     end Scan_exponent;
  14503.      
  14504.      
  14505.     procedure Scan_greater_than(Root : greater_thanNode.Locator) is
  14506.     begin
  14507.      
  14508.      
  14509.        if not Identifier_Utilities.Is_Id_Null (root) then
  14510.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14511.        end if;
  14512.      
  14513.      
  14514.      
  14515.     end Scan_greater_than;
  14516.      
  14517.      
  14518.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator) is
  14519.     begin
  14520.      
  14521.      
  14522.        if not Identifier_Utilities.Is_Id_Null (root) then
  14523.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14524.        end if;
  14525.      
  14526.      
  14527.      
  14528.     end Scan_greater_than_or_equal;
  14529.      
  14530.      
  14531.     procedure Scan_less_than(Root : less_thanNode.Locator) is
  14532.     begin
  14533.      
  14534.      
  14535.        if not Identifier_Utilities.Is_Id_Null (root) then
  14536.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14537.        end if;
  14538.      
  14539.      
  14540.      
  14541.     end Scan_less_than;
  14542.      
  14543.      
  14544.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator) is
  14545.     begin
  14546.      
  14547.      
  14548.        if not Identifier_Utilities.Is_Id_Null (root) then
  14549.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14550.        end if;
  14551.      
  14552.      
  14553.      
  14554.     end Scan_less_than_or_equal;
  14555.      
  14556.      
  14557.     procedure Scan_minus(Root : minusNode.Locator) is
  14558.     begin
  14559.      
  14560.      
  14561.        if not Identifier_Utilities.Is_Id_Null (root) then
  14562.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14563.        end if;
  14564.      
  14565.      
  14566.      
  14567.     end Scan_minus;
  14568.      
  14569.      
  14570.     procedure Scan_multiply(Root : multiplyNode.Locator) is
  14571.     begin
  14572.      
  14573.      
  14574.        if not Identifier_Utilities.Is_Id_Null (root) then
  14575.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14576.        end if;
  14577.      
  14578.      
  14579.      
  14580.     end Scan_multiply;
  14581.      
  14582.      
  14583.     procedure Scan_negate(Root : negateNode.Locator) is
  14584.     begin
  14585.      
  14586.      
  14587.        if not Identifier_Utilities.Is_Id_Null (root) then
  14588.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14589.        end if;
  14590.      
  14591.      
  14592.      
  14593.     end Scan_negate;
  14594.      
  14595.      
  14596.     procedure Scan_not_equal(Root : not_equalNode.Locator) is
  14597.     begin
  14598.      
  14599.      
  14600.        if not Identifier_Utilities.Is_Id_Null (root) then
  14601.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14602.        end if;
  14603.      
  14604.      
  14605.      
  14606.     end Scan_not_equal;
  14607.      
  14608.      
  14609.     procedure Scan_plus(Root : plusNode.Locator) is
  14610.     begin
  14611.      
  14612.      
  14613.        if not Identifier_Utilities.Is_Id_Null (root) then
  14614.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14615.        end if;
  14616.      
  14617.      
  14618.      
  14619.     end Scan_plus;
  14620.      
  14621.      
  14622.     procedure Scan_unary_plus(Root : unary_plusNode.Locator) is
  14623.     begin
  14624.      
  14625.      
  14626.        if not Identifier_Utilities.Is_Id_Null (root) then
  14627.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14628.        end if;
  14629.      
  14630.      
  14631.      
  14632.     end Scan_unary_plus;
  14633.      
  14634.      
  14635.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator) is
  14636.     begin
  14637.         case Kind(Root) is
  14638.           when lim_priv_type_idKind => Scan_lim_priv_type_id(Root);
  14639.           when priv_type_idKind => Scan_priv_type_id(Root);
  14640.           when type_idKind => Scan_type_id(Root);
  14641.           when others => null;
  14642.         end case;
  14643.     end Scan_GENERAL_TYPE_ID;
  14644.      
  14645.      
  14646.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator) is
  14647.     begin
  14648.      
  14649.      
  14650.        if not Identifier_Utilities.Is_Id_Null (root) then
  14651.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14652.        end if;
  14653.      
  14654.      
  14655.      
  14656.     end Scan_lim_priv_type_id;
  14657.      
  14658.      
  14659.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator) is
  14660.     begin
  14661.      
  14662.      
  14663.        if not Identifier_Utilities.Is_Id_Null (root) then
  14664.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14665.        end if;
  14666.      
  14667.      
  14668.      
  14669.     end Scan_priv_type_id;
  14670.      
  14671.      
  14672.     procedure Scan_type_id(Root : type_idNode.Locator) is
  14673.     begin
  14674.      
  14675.      
  14676.        if not Identifier_Utilities.Is_Id_Null (root) then
  14677.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14678.        end if;
  14679.      
  14680.      
  14681.      
  14682.     end Scan_type_id;
  14683.      
  14684.      
  14685.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator) is
  14686.     begin
  14687.         case Kind(Root) is
  14688.           when def_charKind => Scan_def_char(Root);
  14689.           when enum_idKind => Scan_enum_id(Root);
  14690.           when others => null;
  14691.         end case;
  14692.     end Scan_LITERAL_ID;
  14693.      
  14694.      
  14695.     procedure Scan_def_char(Root : def_charNode.Locator) is
  14696.     begin
  14697.      
  14698.      
  14699.        if not Identifier_Utilities.Is_Id_Null (root) then
  14700.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14701.        end if;
  14702.      
  14703.      
  14704.      
  14705.     end Scan_def_char;
  14706.      
  14707.      
  14708.     procedure Scan_enum_id(Root : enum_idNode.Locator) is
  14709.     begin
  14710.      
  14711.      
  14712.        if not Identifier_Utilities.Is_Id_Null (root) then
  14713.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14714.        end if;
  14715.      
  14716.      
  14717.      
  14718.     end Scan_enum_id;
  14719.      
  14720.      
  14721.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator) is
  14722.     begin
  14723.         case Kind(Root) is
  14724.           when PARAM_IDKind => Scan_PARAM_ID(Root);
  14725.           when component_idKind => Scan_component_id(Root);
  14726.           when constant_idKind => Scan_constant_id(Root);
  14727.           when dscrmt_idKind => Scan_dscrmt_id(Root);
  14728.           when variable_idKind => Scan_variable_id(Root);
  14729.           when others => null;
  14730.         end case;
  14731.     end Scan_OBJECT_ID;
  14732.      
  14733.      
  14734.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator) is
  14735.     begin
  14736.         case Kind(Root) is
  14737.           when in_idKind => Scan_in_id(Root);
  14738.           when in_out_idKind => Scan_in_out_id(Root);
  14739.           when out_idKind => Scan_out_id(Root);
  14740.           when others => null;
  14741.         end case;
  14742.     end Scan_PARAM_ID;
  14743.      
  14744.      
  14745.     procedure Scan_in_id(Root : in_idNode.Locator) is
  14746.     begin
  14747.      
  14748.      
  14749.        if not Identifier_Utilities.Is_Id_Null (root) then
  14750.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14751.        end if;
  14752.      
  14753.      
  14754.      
  14755.     end Scan_in_id;
  14756.      
  14757.      
  14758.     procedure Scan_in_out_id(Root : in_out_idNode.Locator) is
  14759.     begin
  14760.      
  14761.      
  14762.        if not Identifier_Utilities.Is_Id_Null (root) then
  14763.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14764.        end if;
  14765.      
  14766.      
  14767.      
  14768.     end Scan_in_out_id;
  14769.      
  14770.      
  14771.     procedure Scan_out_id(Root : out_idNode.Locator) is
  14772.     begin
  14773.      
  14774.      
  14775.        if not Identifier_Utilities.Is_Id_Null (root) then
  14776.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14777.        end if;
  14778.      
  14779.      
  14780.      
  14781.     end Scan_out_id;
  14782.      
  14783.      
  14784.     procedure Scan_component_id(Root : component_idNode.Locator) is
  14785.     begin
  14786.      
  14787.      
  14788.        if not Identifier_Utilities.Is_Id_Null (root) then
  14789.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14790.        end if;
  14791.      
  14792.      
  14793.      
  14794.     end Scan_component_id;
  14795.      
  14796.      
  14797.     procedure Scan_constant_id(Root : constant_idNode.Locator) is
  14798.     begin
  14799.      
  14800.      
  14801.        if not Identifier_Utilities.Is_Id_Null (root) then
  14802.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14803.        end if;
  14804.      
  14805.      
  14806.      
  14807.     end Scan_constant_id;
  14808.      
  14809.      
  14810.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator) is
  14811.     begin
  14812.      
  14813.      
  14814.        if not Identifier_Utilities.Is_Id_Null (root) then
  14815.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14816.        end if;
  14817.      
  14818.      
  14819.      
  14820.     end Scan_dscrmt_id;
  14821.      
  14822.      
  14823.     procedure Scan_variable_id(Root : variable_idNode.Locator) is
  14824.     begin
  14825.      
  14826.      
  14827.        if not Identifier_Utilities.Is_Id_Null (root) then
  14828.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14829.        end if;
  14830.      
  14831.      
  14832.      
  14833.     end Scan_variable_id;
  14834.      
  14835.      
  14836.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator) is
  14837.     begin
  14838.         case Kind(Root) is
  14839.           when generic_pkg_idKind => Scan_generic_pkg_id(Root);
  14840.           when pkg_idKind => Scan_pkg_id(Root);
  14841.           when others => null;
  14842.         end case;
  14843.     end Scan_PKG_ID_CLASS;
  14844.      
  14845.      
  14846.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator) is
  14847.     begin
  14848.      
  14849.      
  14850.        if not Identifier_Utilities.Is_Id_Null (root) then
  14851.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14852.        end if;
  14853.      
  14854.      
  14855.      
  14856.     end Scan_generic_pkg_id;
  14857.      
  14858.      
  14859.     procedure Scan_pkg_id(Root : pkg_idNode.Locator) is
  14860.     begin
  14861.      
  14862.      
  14863.        if not Identifier_Utilities.Is_Id_Null (root) then
  14864.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14865.        end if;
  14866.      
  14867.      
  14868.      
  14869.     end Scan_pkg_id;
  14870.      
  14871.      
  14872.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator) is
  14873.     begin
  14874.         case Kind(Root) is
  14875.           when AIE_PRAGMA_IDKind => Scan_AIE_PRAGMA_ID(Root);
  14876.           when LRM_PRAGMA_IDKind => Scan_LRM_PRAGMA_ID(Root);
  14877.           when others => null;
  14878.         end case;
  14879.     end Scan_PRAGMA_ID;
  14880.      
  14881.      
  14882.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator) is
  14883.     begin
  14884.         case Kind(Root) is
  14885.           when link_name_pragmaKind => Scan_link_name_pragma(Root);
  14886.           when mark_release_pragmaKind => Scan_mark_release_pragma(Root);
  14887.           when monitor_pragmaKind => Scan_monitor_pragma(Root);
  14888.           when unrecognized_pragmaKind => Scan_unrecognized_pragma(Root);
  14889.           when others => null;
  14890.         end case;
  14891.     end Scan_AIE_PRAGMA_ID;
  14892.      
  14893.      
  14894.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator) is
  14895.     begin
  14896.      
  14897.      
  14898.        if not Identifier_Utilities.Is_Id_Null (root) then
  14899.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14900.        end if;
  14901.      
  14902.      
  14903.      
  14904.     end Scan_link_name_pragma;
  14905.      
  14906.      
  14907.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator) is
  14908.     begin
  14909.      
  14910.      
  14911.        if not Identifier_Utilities.Is_Id_Null (root) then
  14912.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14913.        end if;
  14914.      
  14915.      
  14916.      
  14917.     end Scan_mark_release_pragma;
  14918.      
  14919.      
  14920.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator) is
  14921.     begin
  14922.      
  14923.      
  14924.        if not Identifier_Utilities.Is_Id_Null (root) then
  14925.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14926.        end if;
  14927.      
  14928.      
  14929.      
  14930.     end Scan_monitor_pragma;
  14931.      
  14932.      
  14933.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator) is
  14934.     begin
  14935.      
  14936.      
  14937.        if not Identifier_Utilities.Is_Id_Null (root) then
  14938.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14939.        end if;
  14940.      
  14941.      
  14942.      
  14943.     end Scan_unrecognized_pragma;
  14944.      
  14945.      
  14946.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator) is
  14947.     begin
  14948.         case Kind(Root) is
  14949.           when controlled_pragmaKind => Scan_controlled_pragma(Root);
  14950.           when elaborate_pragmaKind => Scan_elaborate_pragma(Root);
  14951.           when inline_pragmaKind => Scan_inline_pragma(Root);
  14952.           when interface_pragmaKind => Scan_interface_pragma(Root);
  14953.           when list_pragmaKind => Scan_list_pragma(Root);
  14954.           when memory_size_pragmaKind => Scan_memory_size_pragma(Root);
  14955.           when optimize_pragmaKind => Scan_optimize_pragma(Root);
  14956.           when pack_pragmaKind => Scan_pack_pragma(Root);
  14957.           when page_pragmaKind => Scan_page_pragma(Root);
  14958.           when priority_pragmaKind => Scan_priority_pragma(Root);
  14959.           when shared_pragmaKind => Scan_shared_pragma(Root);
  14960.           when storage_unit_pragmaKind => Scan_storage_unit_pragma(Root);
  14961.           when suppress_pragmaKind => Scan_suppress_pragma(Root);
  14962.           when system_name_pragmaKind => Scan_system_name_pragma(Root);
  14963.           when others => null;
  14964.         end case;
  14965.     end Scan_LRM_PRAGMA_ID;
  14966.      
  14967.      
  14968.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator) is
  14969.     begin
  14970.      
  14971.      
  14972.        if not Identifier_Utilities.Is_Id_Null (root) then
  14973.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14974.        end if;
  14975.      
  14976.      
  14977.      
  14978.     end Scan_controlled_pragma;
  14979.      
  14980.      
  14981.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator) is
  14982.     begin
  14983.      
  14984.      
  14985.        if not Identifier_Utilities.Is_Id_Null (root) then
  14986.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14987.        end if;
  14988.      
  14989.      
  14990.      
  14991.     end Scan_elaborate_pragma;
  14992.      
  14993.      
  14994.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator) is
  14995.     begin
  14996.      
  14997.      
  14998.        if not Identifier_Utilities.Is_Id_Null (root) then
  14999.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15000.        end if;
  15001.      
  15002.      
  15003.      
  15004.     end Scan_inline_pragma;
  15005.      
  15006.      
  15007.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator) is
  15008.     begin
  15009.      
  15010.      
  15011.        if not Identifier_Utilities.Is_Id_Null (root) then
  15012.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15013.        end if;
  15014.      
  15015.      
  15016.      
  15017.     end Scan_interface_pragma;
  15018.      
  15019.      
  15020.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator) is
  15021.     begin
  15022.      
  15023.      
  15024.        if not Identifier_Utilities.Is_Id_Null (root) then
  15025.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15026.        end if;
  15027.      
  15028.      
  15029.      
  15030.     end Scan_list_pragma;
  15031.      
  15032.      
  15033.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator) is
  15034.     begin
  15035.      
  15036.      
  15037.        if not Identifier_Utilities.Is_Id_Null (root) then
  15038.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15039.        end if;
  15040.      
  15041.      
  15042.      
  15043.     end Scan_memory_size_pragma;
  15044.      
  15045.      
  15046.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator) is
  15047.     begin
  15048.      
  15049.      
  15050.        if not Identifier_Utilities.Is_Id_Null (root) then
  15051.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15052.        end if;
  15053.      
  15054.      
  15055.      
  15056.     end Scan_optimize_pragma;
  15057.      
  15058.      
  15059.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator) is
  15060.     begin
  15061.      
  15062.      
  15063.        if not Identifier_Utilities.Is_Id_Null (root) then
  15064.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15065.        end if;
  15066.      
  15067.      
  15068.      
  15069.     end Scan_pack_pragma;
  15070.      
  15071.      
  15072.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator) is
  15073.     begin
  15074.      
  15075.      
  15076.        if not Identifier_Utilities.Is_Id_Null (root) then
  15077.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15078.        end if;
  15079.      
  15080.      
  15081.      
  15082.     end Scan_page_pragma;
  15083.      
  15084.      
  15085.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator) is
  15086.     begin
  15087.      
  15088.      
  15089.        if not Identifier_Utilities.Is_Id_Null (root) then
  15090.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15091.        end if;
  15092.      
  15093.      
  15094.      
  15095.     end Scan_priority_pragma;
  15096.      
  15097.      
  15098.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator) is
  15099.     begin
  15100.      
  15101.      
  15102.        if not Identifier_Utilities.Is_Id_Null (root) then
  15103.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15104.        end if;
  15105.      
  15106.      
  15107.      
  15108.     end Scan_shared_pragma;
  15109.      
  15110.      
  15111.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator) is
  15112.     begin
  15113.      
  15114.      
  15115.        if not Identifier_Utilities.Is_Id_Null (root) then
  15116.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15117.        end if;
  15118.      
  15119.      
  15120.      
  15121.     end Scan_storage_unit_pragma;
  15122.      
  15123.      
  15124.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator) is
  15125.     begin
  15126.      
  15127.      
  15128.        if not Identifier_Utilities.Is_Id_Null (root) then
  15129.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15130.        end if;
  15131.      
  15132.      
  15133.      
  15134.     end Scan_suppress_pragma;
  15135.      
  15136.      
  15137.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator) is
  15138.     begin
  15139.      
  15140.      
  15141.        if not Identifier_Utilities.Is_Id_Null (root) then
  15142.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15143.        end if;
  15144.      
  15145.      
  15146.      
  15147.     end Scan_system_name_pragma;
  15148.      
  15149.      
  15150.     procedure Scan_STM_ID(Root : STM_ID.Locator) is
  15151.     begin
  15152.         case Kind(Root) is
  15153.           when block_idKind => Scan_block_id(Root);
  15154.           when label_idKind => Scan_label_id(Root);
  15155.           when loop_idKind => Scan_loop_id(Root);
  15156.           when others => null;
  15157.         end case;
  15158.     end Scan_STM_ID;
  15159.      
  15160.      
  15161.     procedure Scan_block_id(Root : block_idNode.Locator) is
  15162.     begin
  15163.      
  15164.      
  15165.        if not Identifier_Utilities.Is_Id_Null (root) then
  15166.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15167.        end if;
  15168.      
  15169.      
  15170.      
  15171.     end Scan_block_id;
  15172.      
  15173.      
  15174.     procedure Scan_label_id(Root : label_idNode.Locator) is
  15175.     begin
  15176.      
  15177.      
  15178.        if not Identifier_Utilities.Is_Id_Null (root) then
  15179.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15180.        end if;
  15181.      
  15182.      
  15183.      
  15184.     end Scan_label_id;
  15185.      
  15186.      
  15187.     procedure Scan_loop_id(Root : loop_idNode.Locator) is
  15188.     begin
  15189.      
  15190.      
  15191.     IncrementToken (colonz);
  15192.      
  15193.      
  15194.      
  15195.      
  15196.        if not Identifier_Utilities.Is_Id_Null (root) then
  15197.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15198.        end if;
  15199.      
  15200.      
  15201.      
  15202.     end Scan_loop_id;
  15203.      
  15204.      
  15205.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator) is
  15206.     begin
  15207.         case Kind(Root) is
  15208.           when GENERIC_SUBP_IDKind => Scan_GENERIC_SUBP_ID(Root);
  15209.           when def_operatorKind => Scan_def_operator(Root);
  15210.           when entry_idKind => Scan_entry_id(Root);
  15211.           when func_idKind => Scan_func_id(Root);
  15212.           when proc_idKind => Scan_proc_id(Root);
  15213.           when others => null;
  15214.         end case;
  15215.     end Scan_SUBP_ID;
  15216.      
  15217.      
  15218.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator) is
  15219.     begin
  15220.         case Kind(Root) is
  15221.           when generic_func_idKind => Scan_generic_func_id(Root);
  15222.           when generic_proc_idKind => Scan_generic_proc_id(Root);
  15223.           when others => null;
  15224.         end case;
  15225.     end Scan_GENERIC_SUBP_ID;
  15226.      
  15227.      
  15228.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator) is
  15229.     begin
  15230.      
  15231.      
  15232.        if not Identifier_Utilities.Is_Id_Null (root) then
  15233.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15234.        end if;
  15235.      
  15236.      
  15237.      
  15238.     end Scan_generic_func_id;
  15239.      
  15240.      
  15241.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator) is
  15242.     begin
  15243.      
  15244.      
  15245.        if not Identifier_Utilities.Is_Id_Null (root) then
  15246.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15247.        end if;
  15248.      
  15249.      
  15250.      
  15251.     end Scan_generic_proc_id;
  15252.      
  15253.      
  15254.     procedure Scan_def_operator(Root : def_operatorNode.Locator) is
  15255.     begin
  15256.      
  15257.      
  15258.        if not Identifier_Utilities.Is_Id_Null (root) then
  15259.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15260.        end if;
  15261.      
  15262.      
  15263.      
  15264.     end Scan_def_operator;
  15265.      
  15266.      
  15267.     procedure Scan_entry_id(Root : entry_idNode.Locator) is
  15268.     begin
  15269.      
  15270.      
  15271.        if not Identifier_Utilities.Is_Id_Null (root) then
  15272.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15273.        end if;
  15274.      
  15275.      
  15276.      
  15277.     end Scan_entry_id;
  15278.      
  15279.      
  15280.     procedure Scan_func_id(Root : func_idNode.Locator) is
  15281.     begin
  15282.      
  15283.      
  15284.        if not Identifier_Utilities.Is_Id_Null (root) then
  15285.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15286.        end if;
  15287.      
  15288.      
  15289.      
  15290.     end Scan_func_id;
  15291.      
  15292.      
  15293.     procedure Scan_proc_id(Root : proc_idNode.Locator) is
  15294.     begin
  15295.      
  15296.      
  15297.        if not Identifier_Utilities.Is_Id_Null (root) then
  15298.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15299.        end if;
  15300.      
  15301.      
  15302.      
  15303.     end Scan_proc_id;
  15304.      
  15305.      
  15306.     procedure Scan_argument_id(Root : argument_idNode.Locator) is
  15307.     begin
  15308.      
  15309.      
  15310.        if not Identifier_Utilities.Is_Id_Null (root) then
  15311.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15312.        end if;
  15313.      
  15314.      
  15315.      
  15316.     end Scan_argument_id;
  15317.      
  15318.      
  15319.     procedure Scan_exception_id(Root : exception_idNode.Locator) is
  15320.     begin
  15321.      
  15322.      
  15323.        if not Identifier_Utilities.Is_Id_Null (root) then
  15324.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15325.        end if;
  15326.      
  15327.      
  15328.      
  15329.     end Scan_exception_id;
  15330.      
  15331.      
  15332.     procedure Scan_iteration_id(Root : iteration_idNode.Locator) is
  15333.     begin
  15334.      
  15335.      
  15336.        if not Identifier_Utilities.Is_Id_Null (root) then
  15337.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15338.        end if;
  15339.      
  15340.      
  15341.      
  15342.     end Scan_iteration_id;
  15343.      
  15344.      
  15345.     procedure Scan_number_id(Root : number_idNode.Locator) is
  15346.     begin
  15347.      
  15348.      
  15349.        if not Identifier_Utilities.Is_Id_Null (root) then
  15350.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15351.        end if;
  15352.      
  15353.      
  15354.      
  15355.     end Scan_number_id;
  15356.      
  15357.      
  15358.     procedure Scan_subtype_id(Root : subtype_idNode.Locator) is
  15359.     begin
  15360.      
  15361.      
  15362.        if not Identifier_Utilities.Is_Id_Null (root) then
  15363.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15364.        end if;
  15365.      
  15366.      
  15367.      
  15368.     end Scan_subtype_id;
  15369.      
  15370.      
  15371.     procedure Scan_task_body_id(Root : task_body_idNode.Locator) is
  15372.     begin
  15373.      
  15374.      
  15375.        if not Identifier_Utilities.Is_Id_Null (root) then
  15376.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15377.        end if;
  15378.      
  15379.      
  15380.      
  15381.     end Scan_task_body_id;
  15382.      
  15383. end DEF_ID_Pkg;
  15384. -- End: SCDEF_ID bdy -----------------------------------------------------
  15385. ::::::::::::::
  15386. scdef_id.spc
  15387. ::::::::::::::
  15388. -- Begin: SCDEF_ID spc ---------------------------------------------------
  15389.      
  15390. with ST_DIANA; use ST_DIANA;
  15391.              package DEF_ID_Pkg is
  15392.     procedure Scan_DEF_ID(Root : DEF_ID.Locator);
  15393.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator);
  15394.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator);
  15395.     procedure Scan_address_id(Root : address_idNode.Locator);
  15396.     procedure Scan_aft_id(Root : aft_idNode.Locator);
  15397.     procedure Scan_base_id(Root : base_idNode.Locator);
  15398.     procedure Scan_callable_id(Root : callable_idNode.Locator);
  15399.     procedure Scan_constrained_id(Root : constrained_idNode.Locator);
  15400.     procedure Scan_count_id(Root : count_idNode.Locator);
  15401.     procedure Scan_delta_id(Root : delta_idNode.Locator);
  15402.     procedure Scan_digits_id(Root : digits_idNode.Locator);
  15403.     procedure Scan_emax_id(Root : emax_idNode.Locator);
  15404.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator);
  15405.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator);
  15406.     procedure Scan_first_index_id(Root : first_index_idNode.Locator);
  15407.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator);
  15408.     procedure Scan_fore_id(Root : fore_idNode.Locator);
  15409.     procedure Scan_image_id(Root : image_idNode.Locator);
  15410.     procedure Scan_large_id(Root : large_idNode.Locator);
  15411.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator);
  15412.     procedure Scan_last_index_id(Root : last_index_idNode.Locator);
  15413.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator);
  15414.     procedure Scan_length_id(Root : length_idNode.Locator);
  15415.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator);
  15416.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator);
  15417.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator);
  15418.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator);
  15419.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator);
  15420.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator);
  15421.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator);
  15422.     procedure Scan_pos_id(Root : pos_idNode.Locator);
  15423.     procedure Scan_position_id(Root : position_idNode.Locator);
  15424.     procedure Scan_pred_id(Root : pred_idNode.Locator);
  15425.     procedure Scan_range_id(Root : range_idNode.Locator);
  15426.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator);
  15427.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator);
  15428.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator);
  15429.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator);
  15430.     procedure Scan_size_type_id(Root : size_type_idNode.Locator);
  15431.     procedure Scan_small_id(Root : small_idNode.Locator);
  15432.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator);
  15433.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator);
  15434.     procedure Scan_succ_id(Root : succ_idNode.Locator);
  15435.     procedure Scan_terminated_id(Root : terminated_idNode.Locator);
  15436.     procedure Scan_val_id(Root : val_idNode.Locator);
  15437.     procedure Scan_value_id(Root : value_idNode.Locator);
  15438.     procedure Scan_width_id(Root : width_idNode.Locator);
  15439.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator);
  15440.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator);
  15441.     procedure Scan_built_in_and(Root : built_in_andNode.Locator);
  15442.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator);
  15443.     procedure Scan_built_in_not(Root : built_in_notNode.Locator);
  15444.     procedure Scan_built_in_or(Root : built_in_orNode.Locator);
  15445.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator);
  15446.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator);
  15447.     procedure Scan_concatenate(Root : concatenateNode.Locator);
  15448.     procedure Scan_divide(Root : divideNode.Locator);
  15449.     procedure Scan_equal(Root : equalNode.Locator);
  15450.     procedure Scan_exponent(Root : exponentNode.Locator);
  15451.     procedure Scan_greater_than(Root : greater_thanNode.Locator);
  15452.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator);
  15453.     procedure Scan_less_than(Root : less_thanNode.Locator);
  15454.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator);
  15455.     procedure Scan_minus(Root : minusNode.Locator);
  15456.     procedure Scan_multiply(Root : multiplyNode.Locator);
  15457.     procedure Scan_negate(Root : negateNode.Locator);
  15458.     procedure Scan_not_equal(Root : not_equalNode.Locator);
  15459.     procedure Scan_plus(Root : plusNode.Locator);
  15460.     procedure Scan_unary_plus(Root : unary_plusNode.Locator);
  15461.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator);
  15462.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator);
  15463.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator);
  15464.     procedure Scan_type_id(Root : type_idNode.Locator);
  15465.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator);
  15466.     procedure Scan_def_char(Root : def_charNode.Locator);
  15467.     procedure Scan_enum_id(Root : enum_idNode.Locator);
  15468.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator);
  15469.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator);
  15470.     procedure Scan_in_id(Root : in_idNode.Locator);
  15471.     procedure Scan_in_out_id(Root : in_out_idNode.Locator);
  15472.     procedure Scan_out_id(Root : out_idNode.Locator);
  15473.     procedure Scan_component_id(Root : component_idNode.Locator);
  15474.     procedure Scan_constant_id(Root : constant_idNode.Locator);
  15475.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator);
  15476.     procedure Scan_variable_id(Root : variable_idNode.Locator);
  15477.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator);
  15478.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator);
  15479.     procedure Scan_pkg_id(Root : pkg_idNode.Locator);
  15480.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator);
  15481.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator);
  15482.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator);
  15483.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator);
  15484.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator);
  15485.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator);
  15486.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator);
  15487.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator);
  15488.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator);
  15489.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator);
  15490.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator);
  15491.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator);
  15492.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator);
  15493.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator);
  15494.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator);
  15495.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator);
  15496.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator);
  15497.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator);
  15498.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator);
  15499.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator);
  15500.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator);
  15501.     procedure Scan_STM_ID(Root : STM_ID.Locator);
  15502.     procedure Scan_block_id(Root : block_idNode.Locator);
  15503.     procedure Scan_label_id(Root : label_idNode.Locator);
  15504.     procedure Scan_loop_id(Root : loop_idNode.Locator);
  15505.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator);
  15506.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator);
  15507.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator);
  15508.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator);
  15509.     procedure Scan_def_operator(Root : def_operatorNode.Locator);
  15510.     procedure Scan_entry_id(Root : entry_idNode.Locator);
  15511.     procedure Scan_func_id(Root : func_idNode.Locator);
  15512.     procedure Scan_proc_id(Root : proc_idNode.Locator);
  15513.     procedure Scan_argument_id(Root : argument_idNode.Locator);
  15514.     procedure Scan_exception_id(Root : exception_idNode.Locator);
  15515.     procedure Scan_iteration_id(Root : iteration_idNode.Locator);
  15516.     procedure Scan_number_id(Root : number_idNode.Locator);
  15517.     procedure Scan_subtype_id(Root : subtype_idNode.Locator);
  15518.     procedure Scan_task_body_id(Root : task_body_idNode.Locator);
  15519. end DEF_ID_Pkg;
  15520. -- End: SCDEF_ID spc -----------------------------------------------------
  15521. ::::::::::::::
  15522. scgeneral.bdy
  15523. ::::::::::::::
  15524. -- Begin: SCGENERAL_ASSOC bdy ---------------------------------------------------
  15525.      
  15526. with Halstead_Data_Base;  use Halstead_Data_Base;
  15527. with Definitions; use Definitions;
  15528.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15529. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  15530. package body GENERAL_ASSOC_Pkg is
  15531.      
  15532.      
  15533.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator) is
  15534.     begin
  15535.         case Kind(Root) is
  15536.           when GA_ASSOC_EXPKind => Scan_GA_ASSOC_EXP(Root);
  15537.           when ga_rangeKind => Scan_ga_range(Root);
  15538.           when others => null;
  15539.         end case;
  15540.     end Scan_GENERAL_ASSOC;
  15541.      
  15542.      
  15543.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator) is
  15544.     begin
  15545.         case Kind(Root) is
  15546.           when ga_assocKind => Scan_ga_assoc(Root);
  15547.           when ga_expKind => Scan_ga_exp(Root);
  15548.           when others => null;
  15549.         end case;
  15550.     end Scan_GA_ASSOC_EXP;
  15551.      
  15552.      
  15553.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator) is
  15554.         as_id_s_List : SeqOfused_idNode.Generator;
  15555.         as_id_s_Item : used_idNode.Locator;
  15556.         use SeqOfused_idNode;
  15557.     begin
  15558.       if not SeqOfused_idNode.IsNull(as_id_s(Root)) then
  15559.         StartForward(as_id_s(Root), as_id_s_List);
  15560.         while not Finished(as_id_s_List) loop
  15561.             as_id_s_Item := Cell(as_id_s_List);
  15562.             Scan_used_id(as_id_s_Item);
  15563.             Forward(as_id_s_List);
  15564.         end loop;
  15565.         EndIterate(as_id_s_List);
  15566.       end if;
  15567.       if not NAME_EXP.IsNull(as_exp(Root)) then
  15568.         Scan_NAME_EXP(as_exp(Root));
  15569.       end if;
  15570.      
  15571.     end Scan_ga_assoc;
  15572.      
  15573.      
  15574.     procedure Scan_ga_exp(Root : ga_expNode.Locator) is
  15575.     begin
  15576.       if not NAME_EXP.IsNull(as_exp(Root)) then
  15577.         Scan_NAME_EXP(as_exp(Root));
  15578.       end if;
  15579.      
  15580.     end Scan_ga_exp;
  15581.      
  15582.      
  15583.     procedure Scan_ga_range(Root : ga_rangeNode.Locator) is
  15584.     begin
  15585.       if not OBJECT_TYPE.IsNull(as_apply_discrete_range(Root)) then
  15586.         Scan_OBJECT_TYPE(as_apply_discrete_range(Root));
  15587.       end if;
  15588.      
  15589.     end Scan_ga_range;
  15590.      
  15591. end GENERAL_ASSOC_Pkg;
  15592. -- End: SCGENERAL_ASSOC bdy -----------------------------------------------------
  15593. ::::::::::::::
  15594. scgeneral.spc
  15595. ::::::::::::::
  15596. -- Begin: SCGENERAL_ASSOC spc ---------------------------------------------------
  15597.      
  15598. with ST_DIANA; use ST_DIANA;
  15599.              package GENERAL_ASSOC_Pkg is
  15600.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator);
  15601.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator);
  15602.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator);
  15603.     procedure Scan_ga_exp(Root : ga_expNode.Locator);
  15604.     procedure Scan_ga_range(Root : ga_rangeNode.Locator);
  15605. end GENERAL_ASSOC_Pkg;
  15606. -- End: SCGENERAL_ASSOC spc -----------------------------------------------------
  15607. ::::::::::::::
  15608. scgeneric.bdy
  15609. ::::::::::::::
  15610. -- Begin: SCGENERIC_HEADER_CLASS bdy ---------------------------------------------------
  15611.      
  15612. with Halstead_Data_Base;  use Halstead_Data_Base;
  15613. with Definitions; use Definitions;
  15614.              with generic_header_IH;
  15615. with ITEM_Pkg; use ITEM_Pkg;
  15616. package body GENERIC_HEADER_CLASS_Pkg is
  15617.      
  15618.      
  15619.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator) is
  15620.     begin
  15621.         case Kind(Root) is
  15622.           when generic_headerKind => Scan_generic_header(Root);
  15623.           when others => null;
  15624.         end case;
  15625.     end Scan_GENERIC_HEADER_CLASS;
  15626.      
  15627.      
  15628.     procedure Scan_generic_header(Root : generic_headerNode.Locator) is
  15629.         as_generic_param_s_List : SeqOfITEM.Generator;
  15630.         as_generic_param_s_Item : ITEM.Locator;
  15631.         use SeqOfITEM;
  15632.         Old_generic_header_IHR : generic_header_IH.RecType := generic_header_IH.R;
  15633.     begin
  15634.         generic_header_IH.R.ih_ingeneric_param :=  false ;
  15635.      
  15636.      
  15637.       generic_header_IH.R.ih_ingeneric_param := true;
  15638.      
  15639.      
  15640.       if not SeqOfITEM.IsNull(as_generic_param_s(Root)) then
  15641.         StartForward(as_generic_param_s(Root), as_generic_param_s_List);
  15642.         while not Finished(as_generic_param_s_List) loop
  15643.             as_generic_param_s_Item := Cell(as_generic_param_s_List);
  15644.      
  15645.      
  15646.        IncrementToken (semicolonz);
  15647.      
  15648.      
  15649.             Scan_ITEM(as_generic_param_s_Item);
  15650.             Forward(as_generic_param_s_List);
  15651.         end loop;
  15652.         EndIterate(as_generic_param_s_List);
  15653.       end if;
  15654.      
  15655.      
  15656.        generic_header_IH.R.ih_ingeneric_param := true;
  15657.      
  15658.      
  15659.         generic_header_IH.R := Old_generic_header_IHR;
  15660.      
  15661.     end Scan_generic_header;
  15662.      
  15663. end GENERIC_HEADER_CLASS_Pkg;
  15664. -- End: SCGENERIC_HEADER_CLASS bdy -----------------------------------------------------
  15665. ::::::::::::::
  15666. scgeneric.spc
  15667. ::::::::::::::
  15668. -- Begin: SCGENERIC_HEADER_CLASS spc ---------------------------------------------------
  15669.      
  15670. with ST_DIANA; use ST_DIANA;
  15671.              package GENERIC_HEADER_CLASS_Pkg is
  15672.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator);
  15673.     procedure Scan_generic_header(Root : generic_headerNode.Locator);
  15674. end GENERIC_HEADER_CLASS_Pkg;
  15675. -- End: SCGENERIC_HEADER_CLASS spc -----------------------------------------------------
  15676.      
  15677. ::::::::::::::
  15678. scheader.bdy
  15679. ::::::::::::::
  15680. -- Begin: SCHEADER bdy ---------------------------------------------------
  15681.      
  15682. with Halstead_Data_Base;  use Halstead_Data_Base;
  15683. with Definitions; use Definitions;
  15684.              with SERIES_UNIT_IH;
  15685. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15686. with ITEM_Pkg; use ITEM_Pkg;
  15687. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  15688.      
  15689.              with generic_header_IH;
  15690.                         package body HEADER_Pkg is
  15691.      
  15692.      
  15693.     procedure Scan_HEADER(Root : HEADER.Locator) is
  15694.     begin
  15695.         case Kind(Root) is
  15696.           when accept_specKind => Scan_accept_spec(Root);
  15697.           when entry_specKind => Scan_entry_spec(Root);
  15698.           when func_specKind => Scan_func_spec(Root);
  15699.           when proc_specKind => Scan_proc_spec(Root);
  15700.           when others => null;
  15701.         end case;
  15702.     end Scan_HEADER;
  15703.      
  15704.      
  15705.     procedure Scan_accept_spec(Root : accept_specNode.Locator) is
  15706.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15707.         as_param_s_Item : OBJECT_ITEM.Locator;
  15708.         use SeqOfOBJECT_ITEM;
  15709.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15710.     begin
  15711.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15712.      
  15713.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15714.         then
  15715.      
  15716.        IncrementToken (open_parenthesisz);
  15717.      
  15718.         end if;
  15719.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  15720.      
  15721.      
  15722.       IncrementToken (open_parenthesisz);
  15723.      
  15724.      
  15725.         Scan_NAME_EXP(as_family_index(Root));
  15726.      
  15727.      
  15728.       IncrementToken (closed_parenthesisz);
  15729.      
  15730.      
  15731.       end if;
  15732.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15733.         StartForward(as_param_s(Root), as_param_s_List);
  15734.         while not Finished(as_param_s_List) loop
  15735.             as_param_s_Item := Cell(as_param_s_List);
  15736.      
  15737.      
  15738.      if SERIES_UNIT_IH.R.ih_inlist then
  15739.          IncrementToken (semicolonz);
  15740.      end if;
  15741.      SERIES_UNIT_IH.R.ih_inlist := true;
  15742.      
  15743.      
  15744.             Scan_OBJECT_ITEM(as_param_s_Item);
  15745.             Forward(as_param_s_List);
  15746.         end loop;
  15747.         EndIterate(as_param_s_List);
  15748.      
  15749.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15750.         then
  15751.      
  15752.    IncrementToken (closed_parenthesisz);
  15753.    SERIES_UNIT_IH.R.ih_inlist := false;
  15754.      
  15755.         end if;
  15756.       end if;
  15757.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15758.      
  15759.     end Scan_accept_spec;
  15760.      
  15761.      
  15762.     procedure Scan_entry_spec(Root : entry_specNode.Locator) is
  15763.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15764.         as_param_s_Item : OBJECT_ITEM.Locator;
  15765.         use SeqOfOBJECT_ITEM;
  15766.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15767.     begin
  15768.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15769.      
  15770.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15771.         then
  15772.      
  15773.        IncrementToken (open_parenthesisz);
  15774.      
  15775.         end if;
  15776.       if not OBJECT_TYPE.IsNull(as_family_range_void(Root)) then
  15777.      
  15778.      
  15779.       IncrementToken (open_parenthesisz);
  15780.      
  15781.      
  15782.         Scan_OBJECT_TYPE(as_family_range_void(Root));
  15783.      
  15784.      
  15785.      IncrementToken (closed_parenthesisz);
  15786.      
  15787.      
  15788.       end if;
  15789.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15790.         StartForward(as_param_s(Root), as_param_s_List);
  15791.         while not Finished(as_param_s_List) loop
  15792.             as_param_s_Item := Cell(as_param_s_List);
  15793.      
  15794.      
  15795.      if SERIES_UNIT_IH.R.ih_inlist then
  15796.          IncrementToken (semicolonz);
  15797.      end if;
  15798.      SERIES_UNIT_IH.R.ih_inlist := true;
  15799.      
  15800.      
  15801.             Scan_OBJECT_ITEM(as_param_s_Item);
  15802.             Forward(as_param_s_List);
  15803.         end loop;
  15804.         EndIterate(as_param_s_List);
  15805.      
  15806.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15807.         then
  15808.      
  15809.    IncrementToken (closed_parenthesisz);
  15810.    SERIES_UNIT_IH.R.ih_inlist := false;
  15811.      
  15812.         end if;
  15813.       end if;
  15814.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15815.      
  15816.     end Scan_entry_spec;
  15817.      
  15818.      
  15819.     procedure Scan_func_spec(Root : func_specNode.Locator) is
  15820.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15821.         as_param_s_Item : OBJECT_ITEM.Locator;
  15822.         use SeqOfOBJECT_ITEM;
  15823.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15824.     begin
  15825.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15826.      
  15827.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15828.         then
  15829.      
  15830.        IncrementToken (open_parenthesisz);
  15831.      
  15832.         end if;
  15833.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15834.         StartForward(as_param_s(Root), as_param_s_List);
  15835.         while not Finished(as_param_s_List) loop
  15836.             as_param_s_Item := Cell(as_param_s_List);
  15837.      
  15838.      
  15839.      if SERIES_UNIT_IH.R.ih_inlist then
  15840.          IncrementToken (semicolonz);
  15841.      end if;
  15842.      SERIES_UNIT_IH.R.ih_inlist := true;
  15843.      
  15844.      
  15845.             Scan_OBJECT_ITEM(as_param_s_Item);
  15846.             Forward(as_param_s_List);
  15847.         end loop;
  15848.         EndIterate(as_param_s_List);
  15849.      
  15850.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15851.         then
  15852.      
  15853.    IncrementToken (closed_parenthesisz);
  15854.    SERIES_UNIT_IH.R.ih_inlist := false;
  15855.      
  15856.         end if;
  15857.       end if;
  15858.       if not object_type_constrainedNode.IsNull(as_return_type(Root)) then
  15859.      
  15860.      
  15861.      IncrementToken (returnz);
  15862.      
  15863.      
  15864.         Scan_object_type_constrained(as_return_type(Root));
  15865.       end if;
  15866.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15867.      
  15868.     end Scan_func_spec;
  15869.      
  15870.      
  15871.     procedure Scan_proc_spec(Root : proc_specNode.Locator) is
  15872.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15873.         as_param_s_Item : OBJECT_ITEM.Locator;
  15874.         use SeqOfOBJECT_ITEM;
  15875.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15876.     begin
  15877.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15878.      
  15879.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15880.         then
  15881.      
  15882.        IncrementToken (open_parenthesisz);
  15883.      
  15884.         end if;
  15885.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15886.         StartForward(as_param_s(Root), as_param_s_List);
  15887.         while not Finished(as_param_s_List) loop
  15888.             as_param_s_Item := Cell(as_param_s_List);
  15889.      
  15890.      
  15891.      if SERIES_UNIT_IH.R.ih_inlist then
  15892.          IncrementToken (semicolonz);
  15893.      end if;
  15894.      SERIES_UNIT_IH.R.ih_inlist := true;
  15895.      
  15896.      
  15897.             Scan_OBJECT_ITEM(as_param_s_Item);
  15898.             Forward(as_param_s_List);
  15899.         end loop;
  15900.         EndIterate(as_param_s_List);
  15901.      
  15902.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15903.         then
  15904.      
  15905.    IncrementToken (closed_parenthesisz);
  15906.    SERIES_UNIT_IH.R.ih_inlist := false;
  15907.      
  15908.         end if;
  15909.       end if;
  15910.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15911.      
  15912.     end Scan_proc_spec;
  15913.      
  15914. end HEADER_Pkg;
  15915. -- End: SCHEADER bdy -----------------------------------------------------
  15916. ::::::::::::::
  15917. scheader.spc
  15918. ::::::::::::::
  15919. -- Begin: SCHEADER spc ---------------------------------------------------
  15920.      
  15921. with ST_DIANA; use ST_DIANA;
  15922.              package HEADER_Pkg is
  15923.     procedure Scan_HEADER(Root : HEADER.Locator);
  15924.     procedure Scan_accept_spec(Root : accept_specNode.Locator);
  15925.     procedure Scan_entry_spec(Root : entry_specNode.Locator);
  15926.     procedure Scan_func_spec(Root : func_specNode.Locator);
  15927.     procedure Scan_proc_spec(Root : proc_specNode.Locator);
  15928. end HEADER_Pkg;
  15929. -- End: SCHEADER spc -----------------------------------------------------
  15930. ::::::::::::::
  15931. scinner_r.bdy
  15932. ::::::::::::::
  15933. -- Begin: SCINNER_RECORD_CLASS bdy ---------------------------------------------------
  15934.      
  15935. with Halstead_Data_Base;  use Halstead_Data_Base;
  15936. with Definitions; use Definitions;
  15937.              with inner_record_IH;
  15938. with ITEM_Pkg; use ITEM_Pkg;
  15939. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15940. with VARIANT_ALTERNATIVE_CLASS_Pkg; use VARIANT_ALTERNATIVE_CLASS_Pkg;
  15941. package body INNER_RECORD_CLASS_Pkg is
  15942.      
  15943.      
  15944.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator) is
  15945.     begin
  15946.         case Kind(Root) is
  15947.           when inner_recordKind => Scan_inner_record(Root);
  15948.           when others => null;
  15949.         end case;
  15950.     end Scan_INNER_RECORD_CLASS;
  15951.      
  15952.      
  15953.     procedure Scan_inner_record(Root : inner_recordNode.Locator) is
  15954.         as_list_List : SeqOfITEM.Generator;
  15955.         as_list_Item : ITEM.Locator;
  15956.         use SeqOfITEM;
  15957.         as_variant_s_List : SeqOfvariant_alternativeNode.Generator;
  15958.         as_variant_s_Item : variant_alternativeNode.Locator;
  15959.         use SeqOfvariant_alternativeNode;
  15960.         as_trailing_pragma_s_List : SeqOfpragma_declNode.Generator;
  15961.         as_trailing_pragma_s_Item : pragma_declNode.Locator;
  15962.         use SeqOfpragma_declNode;
  15963.         Old_inner_record_IHR : inner_record_IH.RecType := inner_record_IH.R;
  15964.     begin
  15965.         inner_record_IH.R.ih_in_variant :=  false ;
  15966.       if not SeqOfITEM.IsNull(as_list(Root)) then
  15967.         StartForward(as_list(Root), as_list_List);
  15968.         while not Finished(as_list_List) loop
  15969.             as_list_Item := Cell(as_list_List);
  15970.             Scan_ITEM(as_list_Item);
  15971.             Forward(as_list_List);
  15972.         end loop;
  15973.         EndIterate(as_list_List);
  15974.       end if;
  15975.       if not NAME_EXP.IsNull(as_variant_name(Root)) then
  15976.      
  15977.      
  15978.        IncrementToken (case_variantz);
  15979.        inner_record_IH.R.ih_in_variant := true;
  15980.      
  15981.      
  15982.         Scan_NAME_EXP(as_variant_name(Root));
  15983.      
  15984.      
  15985.        IncrementToken (is_case_variantz);
  15986.      
  15987.      
  15988.       end if;
  15989.       if not SeqOfvariant_alternativeNode.IsNull(as_variant_s(Root)) then
  15990.         StartForward(as_variant_s(Root), as_variant_s_List);
  15991.         while not Finished(as_variant_s_List) loop
  15992.             as_variant_s_Item := Cell(as_variant_s_List);
  15993.             Scan_variant_alternative(as_variant_s_Item);
  15994.             Forward(as_variant_s_List);
  15995.         end loop;
  15996.         EndIterate(as_variant_s_List);
  15997.      
  15998.      
  15999.        IncrementToken (end_case_variantz);
  16000.        IncrementToken (case_variantz);
  16001.        IncrementToken (semicolonz);
  16002.        inner_record_IH.R.ih_in_variant := false;
  16003.      
  16004.      
  16005.       end if;
  16006.       if not SeqOfpragma_declNode.IsNull(as_trailing_pragma_s(Root)) then
  16007.         StartForward(as_trailing_pragma_s(Root), as_trailing_pragma_s_List);
  16008.         while not Finished(as_trailing_pragma_s_List) loop
  16009.             as_trailing_pragma_s_Item := Cell(as_trailing_pragma_s_List);
  16010.             Scan_pragma_decl(as_trailing_pragma_s_Item);
  16011.             Forward(as_trailing_pragma_s_List);
  16012.         end loop;
  16013.         EndIterate(as_trailing_pragma_s_List);
  16014.       end if;
  16015.         inner_record_IH.R := Old_inner_record_IHR;
  16016.      
  16017.     end Scan_inner_record;
  16018.      
  16019. end INNER_RECORD_CLASS_Pkg;
  16020. -- End: SCINNER_RECORD_CLASS bdy -----------------------------------------------------
  16021. ::::::::::::::
  16022. scinner_r.spc
  16023. ::::::::::::::
  16024. -- Begin: SCINNER_RECORD_CLASS spc ---------------------------------------------------
  16025.      
  16026. with ST_DIANA; use ST_DIANA;
  16027.              package INNER_RECORD_CLASS_Pkg is
  16028.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator);
  16029.     procedure Scan_inner_record(Root : inner_recordNode.Locator);
  16030. end INNER_RECORD_CLASS_Pkg;
  16031. -- End: SCINNER_RECORD_CLASS spc -----------------------------------------------------
  16032.      
  16033. ::::::::::::::
  16034. scitem.bdy
  16035. ::::::::::::::
  16036. -- Begin: SCITEM bdy ---------------------------------------------------
  16037.      
  16038. with Halstead_Data_Base;  use Halstead_Data_Base;
  16039. with Definitions; use Definitions;
  16040.              with SERIES_UNIT_IH;
  16041. with variable_decl_IH;
  16042. with subtype_decl_IH;
  16043. with task_decl_IH;
  16044. with type_decl_IH;
  16045. with GENERIC_HEADER_CLASS_Pkg; use GENERIC_HEADER_CLASS_Pkg;
  16046. with DEF_ID_Pkg; use DEF_ID_Pkg;
  16047. with PKG_DEF_Pkg; use PKG_DEF_Pkg;
  16048. with HEADER_Pkg; use HEADER_Pkg;
  16049. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  16050. with OBJECT_DEF_Pkg; use OBJECT_DEF_Pkg;
  16051. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  16052. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  16053. with SUBP_DEF_Pkg; use SUBP_DEF_Pkg;
  16054. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  16055. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  16056. with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  16057.      
  16058.             with variable_decl_IH;
  16059.             with type_decl_IH;
  16060.             with generic_header_IH;
  16061.                        package body ITEM_Pkg is
  16062.      
  16063.      
  16064.     procedure Scan_ITEM(Root : ITEM.Locator) is
  16065.     begin
  16066.         case Kind(Root) is
  16067.           when GENERIC_ITEMKind => Scan_GENERIC_ITEM(Root);
  16068.           when OBJECT_ITEMKind => Scan_OBJECT_ITEM(Root);
  16069.           when PKG_ITEMKind => Scan_PKG_ITEM(Root);
  16070.           when REP_SPECKind => Scan_REP_SPEC(Root);
  16071.           when SUBP_ITEMKind => Scan_SUBP_ITEM(Root);
  16072.           when entry_declKind => Scan_entry_decl(Root);
  16073.           when exception_declKind => Scan_exception_decl(Root);
  16074.           when null_componentKind => Scan_null_component(Root);
  16075.           when number_declKind => Scan_number_decl(Root);
  16076.           when pragma_declKind => Scan_pragma_decl(Root);
  16077.           when subtype_declKind => Scan_subtype_decl(Root);
  16078.           when subunitKind => Scan_subunit(Root);
  16079.           when task_bodyKind => Scan_task_body(Root);
  16080.           when task_declKind => Scan_task_decl(Root);
  16081.           when type_declKind => Scan_type_decl(Root);
  16082.           when use_clauseKind => Scan_use_clause(Root);
  16083.           when with_clauseKind => Scan_with_clause(Root);
  16084.           when others => null;
  16085.         end case;
  16086.     end Scan_ITEM;
  16087.      
  16088.      
  16089.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator) is
  16090.     begin
  16091.         case Kind(Root) is
  16092.           when generic_pkg_declKind => Scan_generic_pkg_decl(Root);
  16093.           when generic_subp_declKind => Scan_generic_subp_decl(Root);
  16094.           when others => null;
  16095.         end case;
  16096.     end Scan_GENERIC_ITEM;
  16097.      
  16098.      
  16099.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator) is
  16100.     begin
  16101.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  16102.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  16103.       end if;
  16104.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  16105.      
  16106.      
  16107.        if not OuterMostBlockSeen then
  16108.            OuterMostBlockSeen := true;
  16109.        else
  16110.            BlockInfoStack.Push(BlockStack, CurrentBlock);
  16111.            CurrentBlock := InitializeCurrentBlock;
  16112.        end if;
  16113.        SetBlockId (lx_symrep (as_generic_id (root)),
  16114.                    package_spec_block,
  16115.                    SpcId,
  16116.                    LineNumber (lx_srcpos (root))
  16117.                    );
  16118.       IncrementToken (genericz);
  16119.       IncrementToken (package_spcz);
  16120.       IncrementToken (is_package_spcz);
  16121.       IncrementToken (end_package_spcz);
  16122.       IncrementToken (semicolonz);
  16123.      
  16124.      
  16125.         Scan_DEF_ID(as_generic_id(Root));
  16126.       end if;
  16127.       if not pkg_specNode.IsNull(as_generic_pkg_spec(Root)) then
  16128.         Scan_pkg_spec(as_generic_pkg_spec(Root));
  16129.       end if;
  16130.      
  16131.     end Scan_generic_pkg_decl;
  16132.      
  16133.      
  16134.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator) is
  16135.     begin
  16136.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  16137.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  16138.       end if;
  16139.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  16140.      
  16141.      
  16142.         IncrementToken (genericz);
  16143.         if Kind (as_generic_id (root)) in generic_proc_idKind then
  16144.             IncrementToken (procedurez);
  16145.         else
  16146.             IncrementToken (functionz);
  16147.         end if;
  16148.      
  16149.      
  16150.         Scan_DEF_ID(as_generic_id(Root));
  16151.       end if;
  16152.       if not HEADER.IsNull(as_generic_subp_spec(Root)) then
  16153.         Scan_HEADER(as_generic_subp_spec(Root));
  16154.       end if;
  16155.      
  16156.      
  16157.         IncrementToken (semicolonz);
  16158.      
  16159.      
  16160.      
  16161.     end Scan_generic_subp_decl;
  16162.      
  16163.      
  16164.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator) is
  16165.     begin
  16166.         case Kind(Root) is
  16167.           when component_declKind => Scan_component_decl(Root);
  16168.           when constant_declKind => Scan_constant_decl(Root);
  16169.           when dscrmt_declKind => Scan_dscrmt_decl(Root);
  16170.           when in_declKind => Scan_in_decl(Root);
  16171.           when in_out_declKind => Scan_in_out_decl(Root);
  16172.           when out_declKind => Scan_out_decl(Root);
  16173.           when variable_declKind => Scan_variable_decl(Root);
  16174.           when others => null;
  16175.         end case;
  16176.     end Scan_OBJECT_ITEM;
  16177.      
  16178.      
  16179.     procedure Scan_component_decl(Root : component_declNode.Locator) is
  16180.         as_id_s_List : SeqOfDEF_ID.Generator;
  16181.         as_id_s_Item : DEF_ID.Locator;
  16182.         use SeqOfDEF_ID;
  16183.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16184.     begin
  16185.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16186.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16187.         StartForward(as_id_s(Root), as_id_s_List);
  16188.         while not Finished(as_id_s_List) loop
  16189.             as_id_s_Item := Cell(as_id_s_List);
  16190.      
  16191.      
  16192.         if SERIES_UNIT_IH.R.ih_inlist then
  16193.             IncrementToken (commaz);
  16194.         end if;
  16195.         SERIES_UNIT_IH.R.ih_inlist := true;
  16196.      
  16197.      
  16198.             Scan_DEF_ID(as_id_s_Item);
  16199.             Forward(as_id_s_List);
  16200.         end loop;
  16201.         EndIterate(as_id_s_List);
  16202.      
  16203.      
  16204.         IncrementToken (colonz);
  16205.         SERIES_UNIT_IH.R.ih_inlist := false;
  16206.      
  16207.      
  16208.       end if;
  16209.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16210.         Scan_OBJECT_TYPE(as_object_type(Root));
  16211.       end if;
  16212.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16213.         Scan_OBJECT_DEF(as_object_def(Root));
  16214.       end if;
  16215.      
  16216.      
  16217.        IncrementToken (semicolonz);
  16218.      
  16219.      
  16220.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16221.      
  16222.     end Scan_component_decl;
  16223.      
  16224.      
  16225.     procedure Scan_constant_decl(Root : constant_declNode.Locator) is
  16226.         as_id_s_List : SeqOfDEF_ID.Generator;
  16227.         as_id_s_Item : DEF_ID.Locator;
  16228.         use SeqOfDEF_ID;
  16229.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16230.     begin
  16231.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16232.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16233.         StartForward(as_id_s(Root), as_id_s_List);
  16234.         while not Finished(as_id_s_List) loop
  16235.             as_id_s_Item := Cell(as_id_s_List);
  16236.      
  16237.      
  16238.         if SERIES_UNIT_IH.R.ih_inlist then
  16239.             IncrementToken (commaz);
  16240.         end if;
  16241.         SERIES_UNIT_IH.R.ih_inlist := true;
  16242.      
  16243.      
  16244.             Scan_DEF_ID(as_id_s_Item);
  16245.             Forward(as_id_s_List);
  16246.         end loop;
  16247.         EndIterate(as_id_s_List);
  16248.      
  16249.      
  16250.         IncrementToken (colonz);
  16251.         SERIES_UNIT_IH.R.ih_inlist := false;
  16252.      
  16253.      
  16254.       end if;
  16255.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16256.      
  16257.      
  16258.      IncrementToken (constantz);
  16259.      
  16260.      
  16261.         Scan_OBJECT_TYPE(as_object_type(Root));
  16262.       end if;
  16263.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16264.         Scan_OBJECT_DEF(as_object_def(Root));
  16265.       end if;
  16266.      
  16267.      
  16268.      IncrementToken (semicolonz);
  16269.      
  16270.      
  16271.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16272.      
  16273.     end Scan_constant_decl;
  16274.      
  16275.      
  16276.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator) is
  16277.         as_id_s_List : SeqOfDEF_ID.Generator;
  16278.         as_id_s_Item : DEF_ID.Locator;
  16279.         use SeqOfDEF_ID;
  16280.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16281.     begin
  16282.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16283.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16284.         StartForward(as_id_s(Root), as_id_s_List);
  16285.         while not Finished(as_id_s_List) loop
  16286.             as_id_s_Item := Cell(as_id_s_List);
  16287.      
  16288.      
  16289.         if SERIES_UNIT_IH.R.ih_inlist then
  16290.             IncrementToken (commaz);
  16291.         end if;
  16292.         SERIES_UNIT_IH.R.ih_inlist := true;
  16293.      
  16294.      
  16295.             Scan_DEF_ID(as_id_s_Item);
  16296.             Forward(as_id_s_List);
  16297.         end loop;
  16298.         EndIterate(as_id_s_List);
  16299.      
  16300.      
  16301.         IncrementToken (colonz);
  16302.         SERIES_UNIT_IH.R.ih_inlist := false;
  16303.      
  16304.      
  16305.       end if;
  16306.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16307.         Scan_OBJECT_TYPE(as_object_type(Root));
  16308.       end if;
  16309.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16310.         Scan_OBJECT_DEF(as_object_def(Root));
  16311.       end if;
  16312.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16313.      
  16314.     end Scan_dscrmt_decl;
  16315.      
  16316.      
  16317.     procedure Scan_in_decl(Root : in_declNode.Locator) is
  16318.         as_id_s_List : SeqOfDEF_ID.Generator;
  16319.         as_id_s_Item : DEF_ID.Locator;
  16320.         use SeqOfDEF_ID;
  16321.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16322.     begin
  16323.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16324.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16325.         StartForward(as_id_s(Root), as_id_s_List);
  16326.         while not Finished(as_id_s_List) loop
  16327.             as_id_s_Item := Cell(as_id_s_List);
  16328.      
  16329.      
  16330.         if SERIES_UNIT_IH.R.ih_inlist then
  16331.             IncrementToken (commaz);
  16332.         end if;
  16333.         SERIES_UNIT_IH.R.ih_inlist := true;
  16334.      
  16335.      
  16336.             Scan_DEF_ID(as_id_s_Item);
  16337.             Forward(as_id_s_List);
  16338.         end loop;
  16339.         EndIterate(as_id_s_List);
  16340.      
  16341.      
  16342.         IncrementToken (colonz);
  16343.         SERIES_UNIT_IH.R.ih_inlist := false;
  16344.      
  16345.      
  16346.       end if;
  16347.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16348.      
  16349.         if  lx_explicit_in_decl (root)
  16350.         then
  16351.      
  16352.      IncrementToken (in_parameterz);
  16353.      
  16354.         end if;
  16355.         Scan_OBJECT_TYPE(as_object_type(Root));
  16356.       end if;
  16357.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16358.         Scan_OBJECT_DEF(as_object_def(Root));
  16359.       end if;
  16360.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16361.      
  16362.     end Scan_in_decl;
  16363.      
  16364.      
  16365.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator) is
  16366.         as_id_s_List : SeqOfDEF_ID.Generator;
  16367.         as_id_s_Item : DEF_ID.Locator;
  16368.         use SeqOfDEF_ID;
  16369.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16370.     begin
  16371.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16372.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16373.         StartForward(as_id_s(Root), as_id_s_List);
  16374.         while not Finished(as_id_s_List) loop
  16375.             as_id_s_Item := Cell(as_id_s_List);
  16376.      
  16377.      
  16378.         if SERIES_UNIT_IH.R.ih_inlist then
  16379.             IncrementToken (commaz);
  16380.         end if;
  16381.         SERIES_UNIT_IH.R.ih_inlist := true;
  16382.      
  16383.      
  16384.             Scan_DEF_ID(as_id_s_Item);
  16385.             Forward(as_id_s_List);
  16386.         end loop;
  16387.         EndIterate(as_id_s_List);
  16388.      
  16389.      
  16390.         IncrementToken (colonz);
  16391.         SERIES_UNIT_IH.R.ih_inlist := false;
  16392.      
  16393.      
  16394.       end if;
  16395.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16396.      
  16397.      
  16398.      IncrementToken (in_out_parameterz);
  16399.      
  16400.      
  16401.      
  16402.         Scan_OBJECT_TYPE(as_object_type(Root));
  16403.       end if;
  16404.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16405.         Scan_OBJECT_DEF(as_object_def(Root));
  16406.       end if;
  16407.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16408.      
  16409.     end Scan_in_out_decl;
  16410.      
  16411.      
  16412.     procedure Scan_out_decl(Root : out_declNode.Locator) is
  16413.         as_id_s_List : SeqOfDEF_ID.Generator;
  16414.         as_id_s_Item : DEF_ID.Locator;
  16415.         use SeqOfDEF_ID;
  16416.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16417.     begin
  16418.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16419.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16420.         StartForward(as_id_s(Root), as_id_s_List);
  16421.         while not Finished(as_id_s_List) loop
  16422.             as_id_s_Item := Cell(as_id_s_List);
  16423.      
  16424.      
  16425.         if SERIES_UNIT_IH.R.ih_inlist then
  16426.             IncrementToken (commaz);
  16427.         end if;
  16428.         SERIES_UNIT_IH.R.ih_inlist := true;
  16429.      
  16430.      
  16431.             Scan_DEF_ID(as_id_s_Item);
  16432.             Forward(as_id_s_List);
  16433.         end loop;
  16434.         EndIterate(as_id_s_List);
  16435.      
  16436.      
  16437.         IncrementToken (colonz);
  16438.         SERIES_UNIT_IH.R.ih_inlist := false;
  16439.      
  16440.      
  16441.       end if;
  16442.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16443.      
  16444.      
  16445.      IncrementToken (outz);
  16446.      
  16447.      
  16448.         Scan_OBJECT_TYPE(as_object_type(Root));
  16449.       end if;
  16450.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16451.         Scan_OBJECT_DEF(as_object_def(Root));
  16452.       end if;
  16453.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16454.      
  16455.     end Scan_out_decl;
  16456.      
  16457.      
  16458.     procedure Scan_variable_decl(Root : variable_declNode.Locator) is
  16459.         as_id_s_List : SeqOfDEF_ID.Generator;
  16460.         as_id_s_Item : DEF_ID.Locator;
  16461.         use SeqOfDEF_ID;
  16462.         Old_variable_decl_IHR : variable_decl_IH.RecType := variable_decl_IH.R;
  16463.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16464.     begin
  16465.         variable_decl_IH.R.ih_init :=  false ;
  16466.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16467.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16468.         StartForward(as_id_s(Root), as_id_s_List);
  16469.         while not Finished(as_id_s_List) loop
  16470.             as_id_s_Item := Cell(as_id_s_List);
  16471.      
  16472.      
  16473.         if SERIES_UNIT_IH.R.ih_inlist then
  16474.             IncrementToken (commaz);
  16475.         end if;
  16476.         SERIES_UNIT_IH.R.ih_inlist := true;
  16477.      
  16478.      
  16479.             Scan_DEF_ID(as_id_s_Item);
  16480.             Forward(as_id_s_List);
  16481.         end loop;
  16482.         EndIterate(as_id_s_List);
  16483.      
  16484.      
  16485.         IncrementToken (colonz);
  16486.         SERIES_UNIT_IH.R.ih_inlist := false;
  16487.      
  16488.      
  16489.       end if;
  16490.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16491.         Scan_OBJECT_TYPE(as_object_type(Root));
  16492.       end if;
  16493.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16494.         Scan_OBJECT_DEF(as_object_def(Root));
  16495.       end if;
  16496.      
  16497.      
  16498.      IncrementToken (semicolonz);
  16499.      
  16500.      
  16501.         variable_decl_IH.R := Old_variable_decl_IHR;
  16502.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16503.      
  16504.     end Scan_variable_decl;
  16505.      
  16506.      
  16507.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator) is
  16508.     begin
  16509.         case Kind(Root) is
  16510.           when pkg_bodyKind => Scan_pkg_body(Root);
  16511.           when pkg_declKind => Scan_pkg_decl(Root);
  16512.           when others => null;
  16513.         end case;
  16514.     end Scan_PKG_ITEM;
  16515.      
  16516.      
  16517.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator) is
  16518.     begin
  16519.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  16520.         Scan_pkg_id(as_pkg_id(Root));
  16521.      
  16522.      
  16523.          if not OuterMostBlockSeen then
  16524.              OuterMostBlockSeen := true;
  16525.          else
  16526.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  16527.              CurrentBlock := InitializeCurrentBlock;
  16528.          end if;
  16529.          SetBlockId (lx_symrep (as_pkg_id (root)),
  16530.                      package_body_block,
  16531.                      BdyId,
  16532.                      LineNumber (lx_srcpos (root))
  16533.                      );
  16534.          IncrementToken (package_bdyz);
  16535.          IncrementToken (body_packagez);
  16536.          IncrementToken (is_package_bdyz);
  16537.      
  16538.      
  16539.       end if;
  16540.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  16541.         Scan_PKG_DEF(as_pkg_def(Root));
  16542.       end if;
  16543.      
  16544.      
  16545.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16546.         IncrementToken (semicolonz);
  16547.         ProcessBlockInfo (CurrentBlock);
  16548.         FreeSpace (CurrentBlock);
  16549.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16550.    end if;
  16551.      
  16552.      
  16553.      
  16554.     end Scan_pkg_body;
  16555.      
  16556.      
  16557.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator) is
  16558.     begin
  16559.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  16560.         Scan_pkg_id(as_pkg_id(Root));
  16561.      
  16562.      
  16563.       if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16564.          if not OuterMostBlockSeen then
  16565.              OuterMostBlockSeen := true;
  16566.          else
  16567.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  16568.              CurrentBlock := InitializeCurrentBlock;
  16569.          end if;
  16570.          SetBlockId (lx_symrep (as_pkg_id (root)),
  16571.                      package_spec_block,
  16572.                      SpcId,
  16573.                      LineNumber (lx_srcpos (root))
  16574.                      );
  16575.         IncrementToken (end_package_spcz);
  16576.      end if;
  16577.      IncrementToken (package_spcz);
  16578.      IncrementToken (is_package_spcz);
  16579.      
  16580.      
  16581.       end if;
  16582.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  16583.         Scan_PKG_DEF(as_pkg_def(Root));
  16584.       end if;
  16585.      
  16586.      
  16587.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16588.         IncrementToken (semicolonz);
  16589.         ProcessBlockInfo (CurrentBlock);
  16590.         FreeSpace (CurrentBlock);
  16591.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16592.    end if;
  16593.      
  16594.      
  16595.      
  16596.     end Scan_pkg_decl;
  16597.      
  16598.      
  16599.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator) is
  16600.     begin
  16601.         case Kind(Root) is
  16602.           when address_repKind => Scan_address_rep(Root);
  16603.           when record_repKind => Scan_record_rep(Root);
  16604.           when rep_componentKind => Scan_rep_component(Root);
  16605.           when simple_repKind => Scan_simple_rep(Root);
  16606.           when others => null;
  16607.         end case;
  16608.     end Scan_REP_SPEC;
  16609.      
  16610.      
  16611.     procedure Scan_address_rep(Root : address_repNode.Locator) is
  16612.     begin
  16613.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16614.      
  16615.      
  16616.       IncrementToken (for_repz);
  16617.      
  16618.      
  16619.         Scan_NAME_EXP(as_rep_name(Root));
  16620.      
  16621.      
  16622.       IncrementToken (use_repz);
  16623.       IncrementToken (atz);
  16624.       IncrementToken (semicolonz);
  16625.      
  16626.      
  16627.       end if;
  16628.       if not NAME_EXP.IsNull(as_address_rep_exp(Root)) then
  16629.         Scan_NAME_EXP(as_address_rep_exp(Root));
  16630.       end if;
  16631.      
  16632.     end Scan_address_rep;
  16633.      
  16634.      
  16635.     procedure Scan_record_rep(Root : record_repNode.Locator) is
  16636.         as_components_List : SeqOfrep_componentNode.Generator;
  16637.         as_components_Item : rep_componentNode.Locator;
  16638.         use SeqOfrep_componentNode;
  16639.     begin
  16640.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16641.      
  16642.      
  16643.       IncrementToken (for_repz);
  16644.      
  16645.      
  16646.         Scan_NAME_EXP(as_rep_name(Root));
  16647.      
  16648.      
  16649.    IncrementToken (use_repz);
  16650.    IncrementToken (record_repz);
  16651.      
  16652.      
  16653.       end if;
  16654.       if not NAME_EXP.IsNull(as_record_alignment(Root)) then
  16655.      
  16656.      
  16657.       IncrementToken (atz);
  16658.       IncrementToken (modz);
  16659.      
  16660.      
  16661.         Scan_NAME_EXP(as_record_alignment(Root));
  16662.       end if;
  16663.       if not SeqOfrep_componentNode.IsNull(as_components(Root)) then
  16664.         StartForward(as_components(Root), as_components_List);
  16665.         while not Finished(as_components_List) loop
  16666.             as_components_Item := Cell(as_components_List);
  16667.             Scan_rep_component(as_components_Item);
  16668.             Forward(as_components_List);
  16669.         end loop;
  16670.         EndIterate(as_components_List);
  16671.      
  16672.      
  16673.          IncrementToken (end_record_repz);
  16674.          IncrementToken (record_repz);
  16675.          IncrementToken (semicolonz);
  16676.      
  16677.      
  16678.       end if;
  16679.      
  16680.     end Scan_record_rep;
  16681.      
  16682.      
  16683.     procedure Scan_rep_component(Root : rep_componentNode.Locator) is
  16684.     begin
  16685.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16686.         Scan_NAME_EXP(as_rep_name(Root));
  16687.      
  16688.      
  16689.           IncrementToken (atz);
  16690.      
  16691.      
  16692.       end if;
  16693.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_alignment_range(Root)) then
  16694.      
  16695.      
  16696.       IncrementToken (rangez);
  16697.      
  16698.      
  16699.         Scan_RANGE_CONSTRAINT_CLASS(as_alignment_range(Root));
  16700.       end if;
  16701.       if not NAME_EXP.IsNull(as_rep_component_exp(Root)) then
  16702.         Scan_NAME_EXP(as_rep_component_exp(Root));
  16703.       end if;
  16704.      
  16705.     end Scan_rep_component;
  16706.      
  16707.      
  16708.     procedure Scan_simple_rep(Root : simple_repNode.Locator) is
  16709.     begin
  16710.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16711.         Scan_NAME_EXP(as_rep_name(Root));
  16712.       end if;
  16713.       if not NAME_EXP.IsNull(as_simple_rep_exp(Root)) then
  16714.      
  16715.      
  16716.      IncrementToken (for_repz);
  16717.      
  16718.      
  16719.         Scan_NAME_EXP(as_simple_rep_exp(Root));
  16720.      
  16721.      
  16722.       IncrementToken (use_repz);
  16723.      
  16724.      
  16725.       end if;
  16726.      
  16727.     end Scan_simple_rep;
  16728.      
  16729.      
  16730.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator) is
  16731.     begin
  16732.         case Kind(Root) is
  16733.           when subp_bodyKind => Scan_subp_body(Root);
  16734.           when subp_declKind => Scan_subp_decl(Root);
  16735.           when others => null;
  16736.         end case;
  16737.     end Scan_SUBP_ITEM;
  16738.      
  16739.      
  16740.     procedure Scan_subp_body(Root : subp_bodyNode.Locator) is
  16741.     begin
  16742.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  16743.         Scan_DEF_ID(as_subp_designator(Root));
  16744.      
  16745.      
  16746.       if not OuterMostBlockSeen then
  16747.           OuterMostBlockSeen := true;
  16748.       else
  16749.           BlockInfoStack.Push(BlockStack, CurrentBlock);
  16750.           CurrentBlock := InitializeCurrentBlock;
  16751.       end if;
  16752.        if Kind (as_subp_designator (root)) in proc_idKind then
  16753.            SetBlockId (lx_symrep (as_subp_designator (root)),
  16754.                        procedure_block,
  16755.                        BdyId,
  16756.                        LineNumber (lx_srcpos (root))
  16757.                        );
  16758.            IncrementToken (procedurez);
  16759.            IncrementToken (is_procedurez);
  16760.        else
  16761.            SetBlockId (lx_symrep (as_subp_designator (root)),
  16762.                        function_block,
  16763.                        BdyId,
  16764.                        LineNumber (lx_srcpos (root))
  16765.                        );
  16766.            IncrementToken (functionz);
  16767.            IncrementToken (is_functionz);
  16768.        end if;
  16769.      
  16770.      
  16771.       end if;
  16772.       if not HEADER.IsNull(as_subp_spec(Root)) then
  16773.         Scan_HEADER(as_subp_spec(Root));
  16774.       end if;
  16775.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  16776.         Scan_SUBP_DEF(as_subp_def(Root));
  16777.      
  16778.      
  16779.        ProcessBlockInfo (CurrentBlock);
  16780.        FreeSpace (CurrentBlock);
  16781.        BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16782.      
  16783.      
  16784.       end if;
  16785.      
  16786.     end Scan_subp_body;
  16787.      
  16788.      
  16789.     procedure Scan_subp_decl(Root : subp_declNode.Locator) is
  16790.     begin
  16791.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  16792.         Scan_DEF_ID(as_subp_designator(Root));
  16793.       end if;
  16794.       if not HEADER.IsNull(as_subp_spec(Root)) then
  16795.         Scan_HEADER(as_subp_spec(Root));
  16796.       end if;
  16797.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  16798.         Scan_SUBP_DEF(as_subp_def(Root));
  16799.       end if;
  16800.      
  16801.      
  16802.            if generic_header_IH.R.ih_ingeneric_param then
  16803.                IncrementToken (with_genericz);
  16804.            end if;
  16805.            if Kind (as_subp_designator (root)) in proc_idKind then
  16806.                IncrementToken (procedurez);
  16807.            else
  16808.                IncrementToken (functionz);
  16809.            end if;
  16810.      
  16811.      
  16812.      
  16813.      
  16814.         IncrementToken (semicolonz);
  16815.      
  16816.      
  16817.      
  16818.     end Scan_subp_decl;
  16819.      
  16820.      
  16821.     procedure Scan_entry_decl(Root : entry_declNode.Locator) is
  16822.     begin
  16823.      
  16824.      
  16825.      IncrementToken (entryz);
  16826.      
  16827.      
  16828.       if not entry_idNode.IsNull(as_entry_designator(Root)) then
  16829.         Scan_entry_id(as_entry_designator(Root));
  16830.       end if;
  16831.       if not entry_specNode.IsNull(as_entry_spec(Root)) then
  16832.         Scan_entry_spec(as_entry_spec(Root));
  16833.       end if;
  16834.      
  16835.      
  16836.      IncrementToken (semicolonz);
  16837.      
  16838.      
  16839.      
  16840.     end Scan_entry_decl;
  16841.      
  16842.      
  16843.     procedure Scan_exception_decl(Root : exception_declNode.Locator) is
  16844.         as_exception_id_s_List : SeqOfexception_idNode.Generator;
  16845.         as_exception_id_s_Item : exception_idNode.Locator;
  16846.         use SeqOfexception_idNode;
  16847.     begin
  16848.       if not SeqOfexception_idNode.IsNull(as_exception_id_s(Root)) then
  16849.         StartForward(as_exception_id_s(Root), as_exception_id_s_List);
  16850.         while not Finished(as_exception_id_s_List) loop
  16851.             as_exception_id_s_Item := Cell(as_exception_id_s_List);
  16852.      
  16853.      
  16854.       if SERIES_UNIT_IH.R.ih_inlist then
  16855.          IncrementToken (commaz);
  16856.       end if;
  16857.       SERIES_UNIT_IH.R.ih_inlist := true;
  16858.      
  16859.      
  16860.             Scan_exception_id(as_exception_id_s_Item);
  16861.             Forward(as_exception_id_s_List);
  16862.         end loop;
  16863.         EndIterate(as_exception_id_s_List);
  16864.      
  16865.      
  16866.        IncrementToken (colonz);
  16867.        IncrementToken (exceptionz);
  16868.        IncrementToken (semicolonz);
  16869.        SERIES_UNIT_IH.R.ih_inlist := false;
  16870.      
  16871.      
  16872.       end if;
  16873.       if not NAME_EXP.IsNull(as_exception_def(Root)) then
  16874.      
  16875.      
  16876.       IncrementToken (renamesz);
  16877.      
  16878.      
  16879.         Scan_NAME_EXP(as_exception_def(Root));
  16880.       end if;
  16881.      
  16882.     end Scan_exception_decl;
  16883.      
  16884.      
  16885.     procedure Scan_null_component(Root : null_componentNode.Locator) is
  16886.     begin
  16887.      
  16888.      
  16889.       IncrementToken (null_fieldz);
  16890.       IncrementToken (semicolonz);
  16891.      
  16892.      
  16893.      
  16894.     end Scan_null_component;
  16895.      
  16896.      
  16897.     procedure Scan_number_decl(Root : number_declNode.Locator) is
  16898.         as_number_id_s_List : SeqOfnumber_idNode.Generator;
  16899.         as_number_id_s_Item : number_idNode.Locator;
  16900.         use SeqOfnumber_idNode;
  16901.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16902.     begin
  16903.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16904.       if not SeqOfnumber_idNode.IsNull(as_number_id_s(Root)) then
  16905.         StartForward(as_number_id_s(Root), as_number_id_s_List);
  16906.         while not Finished(as_number_id_s_List) loop
  16907.             as_number_id_s_Item := Cell(as_number_id_s_List);
  16908.      
  16909.      
  16910.        if SERIES_UNIT_IH.R.ih_inlist then
  16911.           IncrementToken (commaz);
  16912.        end if;
  16913.        SERIES_UNIT_IH.R.ih_inlist := true;
  16914.      
  16915.      
  16916.             Scan_number_id(as_number_id_s_Item);
  16917.             Forward(as_number_id_s_List);
  16918.         end loop;
  16919.         EndIterate(as_number_id_s_List);
  16920.      
  16921.      
  16922.      IncrementToken (colonz);
  16923.      SERIES_UNIT_IH.R.ih_inlist := false;
  16924.      
  16925.      
  16926.       end if;
  16927.       if not NAME_EXP.IsNull(as_number_exp(Root)) then
  16928.      
  16929.      
  16930.      IncrementToken (constantz);
  16931.      IncrementToken (colon_equalsz);
  16932.      
  16933.      
  16934.         Scan_NAME_EXP(as_number_exp(Root));
  16935.       end if;
  16936.      
  16937.      
  16938.      IncrementToken (semicolonz);
  16939.      
  16940.      
  16941.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16942.      
  16943.     end Scan_number_decl;
  16944.      
  16945.      
  16946.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator) is
  16947.         as_pragma_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  16948.         as_pragma_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  16949.         use SeqOfGENERAL_ASSOC;
  16950.     begin
  16951.      
  16952.      
  16953.       IncrementToken (pragmaz);
  16954.      
  16955.      
  16956.       if not used_idNode.IsNull(as_pragma_id(Root)) then
  16957.         Scan_used_id(as_pragma_id(Root));
  16958.       end if;
  16959.       if not SeqOfGENERAL_ASSOC.IsNull(as_pragma_param_assoc_s(Root)) then
  16960.      
  16961.      
  16962.        IncrementToken (open_parenthesisz);
  16963.      
  16964.      
  16965.         StartForward(as_pragma_param_assoc_s(Root), as_pragma_param_assoc_s_List);
  16966.         while not Finished(as_pragma_param_assoc_s_List) loop
  16967.             as_pragma_param_assoc_s_Item := Cell(as_pragma_param_assoc_s_List);
  16968.      
  16969.      
  16970.         if SERIES_UNIT_IH.R.ih_inlist then
  16971.             IncrementToken (commaz);
  16972.         end if;
  16973.         SERIES_UNIT_IH.R.ih_inlist := true;
  16974.      
  16975.      
  16976.             Scan_GENERAL_ASSOC(as_pragma_param_assoc_s_Item);
  16977.             Forward(as_pragma_param_assoc_s_List);
  16978.         end loop;
  16979.         EndIterate(as_pragma_param_assoc_s_List);
  16980.      
  16981.      
  16982.        IncrementToken (closed_parenthesisz);
  16983.        SERIES_UNIT_IH.R.ih_inlist := false;
  16984.      
  16985.      
  16986.       end if;
  16987.      
  16988.      
  16989.        IncrementToken (semicolonz);
  16990.      
  16991.      
  16992.      
  16993.     end Scan_pragma_decl;
  16994.      
  16995.      
  16996.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator) is
  16997.         Old_subtype_decl_IHR : subtype_decl_IH.RecType := subtype_decl_IH.R;
  16998.     begin
  16999.         subtype_decl_IH.R.ih_in_subtype_decl :=  false ;
  17000.      
  17001.      
  17002.      IncrementToken (subtypez);
  17003.      subtype_decl_IH.R.ih_in_subtype_decl := true;
  17004.      
  17005.      
  17006.       if not subtype_idNode.IsNull(as_subtype_id(Root)) then
  17007.         Scan_subtype_id(as_subtype_id(Root));
  17008.      
  17009.      
  17010.       IncrementToken (is_subtypez);
  17011.      
  17012.      
  17013.       end if;
  17014.       if not object_type_constrainedNode.IsNull(as_subtype_constrained(Root)) then
  17015.         Scan_object_type_constrained(as_subtype_constrained(Root));
  17016.       end if;
  17017.      
  17018.      
  17019.       subtype_decl_IH.R.ih_in_subtype_decl := false;
  17020.       IncrementToken (semicolonz);
  17021.      
  17022.      
  17023.         subtype_decl_IH.R := Old_subtype_decl_IHR;
  17024.      
  17025.     end Scan_subtype_decl;
  17026.      
  17027.      
  17028.     procedure Scan_subunit(Root : subunitNode.Locator) is
  17029.     begin
  17030.      
  17031.      
  17032.      IncrementToken (separatez);
  17033.      
  17034.      
  17035.       if not NAME_EXP.IsNull(as_subunit_path(Root)) then
  17036.      
  17037.      
  17038.      IncrementToken (open_parenthesisz);
  17039.      
  17040.      
  17041.         Scan_NAME_EXP(as_subunit_path(Root));
  17042.      
  17043.      
  17044.      IncrementToken (closed_parenthesisz);
  17045.      
  17046.      
  17047.       end if;
  17048.       if not ITEM.IsNull(as_subunit_body(Root)) then
  17049.         Scan_ITEM(as_subunit_body(Root));
  17050.       end if;
  17051.      
  17052.     end Scan_subunit;
  17053.      
  17054.      
  17055.     procedure Scan_task_body(Root : task_bodyNode.Locator) is
  17056.     begin
  17057.      
  17058.      
  17059.      if not OuterMostBlockSeen then
  17060.          OuterMostBlockSeen := true;
  17061.      else
  17062.          BlockInfoStack.Push(BlockStack, CurrentBlock);
  17063.          CurrentBlock := InitializeCurrentBlock;
  17064.      end if;
  17065.      SetBlockId (lx_symrep (as_task_body_id (root)),
  17066.                  task_body_block,
  17067.                  BdyId,
  17068.                  LineNumber (lx_srcpos (root))
  17069.                  );
  17070.      IncrementToken (task_bdyz);
  17071.      IncrementToken (body_taskz);
  17072.      IncrementToken (is_task_bdyz);
  17073.      
  17074.      
  17075.       if not task_body_idNode.IsNull(as_task_body_id(Root)) then
  17076.         Scan_task_body_id(as_task_body_id(Root));
  17077.       end if;
  17078.       if not BLOCK_STUB.IsNull(as_task_body_block_stub(Root)) then
  17079.         Scan_BLOCK_STUB(as_task_body_block_stub(Root));
  17080.       end if;
  17081.      
  17082.      
  17083.      IncrementToken (semicolonz);
  17084.      ProcessBlockInfo (CurrentBlock);
  17085.      FreeSpace (CurrentBlock);
  17086.      BlockInfoStack.Pop(BlockStack, CurrentBlock);
  17087.      
  17088.      
  17089.      
  17090.     end Scan_task_body;
  17091.      
  17092.      
  17093.     procedure Scan_task_decl(Root : task_declNode.Locator) is
  17094.         Old_task_decl_IHR : task_decl_IH.RecType := task_decl_IH.R;
  17095.     begin
  17096.         task_decl_IH.R.ih_intask_decl :=  false ;
  17097.      
  17098.      
  17099.       task_decl_IH.R.ih_intask_decl := true;
  17100.      
  17101.      
  17102.       if not variable_idNode.IsNull(as_task_id(Root)) then
  17103.         Scan_variable_id(as_task_id(Root));
  17104.       end if;
  17105.       if not task_specNode.IsNull(as_task_def(Root)) then
  17106.         Scan_task_spec(as_task_def(Root));
  17107.       end if;
  17108.      
  17109.      
  17110.  task_decl_IH.R.ih_intask_decl := false;
  17111.      
  17112.      
  17113.         task_decl_IH.R := Old_task_decl_IHR;
  17114.      
  17115.     end Scan_task_decl;
  17116.      
  17117.      
  17118.     procedure Scan_type_decl(Root : type_declNode.Locator) is
  17119.         as_type_dscrmt_s_List : SeqOfdscrmt_declNode.Generator;
  17120.         as_type_dscrmt_s_Item : dscrmt_declNode.Locator;
  17121.         use SeqOfdscrmt_declNode;
  17122.         Old_type_decl_IHR : type_decl_IH.RecType := type_decl_IH.R;
  17123.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17124.     begin
  17125.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17126.      
  17127.      
  17128.      if Kind (as_type_spec (root)) not in task_specKind then
  17129.         IncrementToken (typez);
  17130.         IncrementToken (is_typez);
  17131.      end if;
  17132.      
  17133.      
  17134.       if not type_idNode.IsNull(as_type_id(Root)) then
  17135.         Scan_type_id(as_type_id(Root));
  17136.       end if;
  17137.       if not SeqOfdscrmt_declNode.IsNull(as_type_dscrmt_s(Root)) then
  17138.      
  17139.      
  17140.      IncrementToken (open_parenthesisz);
  17141.      
  17142.      
  17143.         StartForward(as_type_dscrmt_s(Root), as_type_dscrmt_s_List);
  17144.         while not Finished(as_type_dscrmt_s_List) loop
  17145.             as_type_dscrmt_s_Item := Cell(as_type_dscrmt_s_List);
  17146.      
  17147.      
  17148.       if SERIES_UNIT_IH.R.ih_inlist then
  17149.           IncrementToken (semicolonz);
  17150.       end if;
  17151.       SERIES_UNIT_IH.R.ih_inlist := true;
  17152.      
  17153.      
  17154.             Scan_dscrmt_decl(as_type_dscrmt_s_Item);
  17155.             Forward(as_type_dscrmt_s_List);
  17156.         end loop;
  17157.         EndIterate(as_type_dscrmt_s_List);
  17158.      
  17159.      
  17160.      IncrementToken (closed_parenthesisz);
  17161.      SERIES_UNIT_IH.R.ih_inlist := false;
  17162.      
  17163.      
  17164.       end if;
  17165.       if not TYPE_SPEC.IsNull(as_type_spec(Root)) then
  17166.         Scan_TYPE_SPEC(as_type_spec(Root));
  17167.       end if;
  17168.      
  17169.      
  17170.      if Kind (as_type_spec (root)) not in task_specKind then
  17171.         IncrementToken (semicolonz);
  17172.      end if;
  17173.      
  17174.      
  17175.         type_decl_IH.R := Old_type_decl_IHR;
  17176.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17177.      
  17178.     end Scan_type_decl;
  17179.      
  17180.      
  17181.     procedure Scan_use_clause(Root : use_clauseNode.Locator) is
  17182.         as_use_clause_list_List : SeqOfNAME_EXP.Generator;
  17183.         as_use_clause_list_Item : NAME_EXP.Locator;
  17184.         use SeqOfNAME_EXP;
  17185.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17186.     begin
  17187.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17188.       if not SeqOfNAME_EXP.IsNull(as_use_clause_list(Root)) then
  17189.      
  17190.      
  17191.      IncrementToken (use_contextz);
  17192.      
  17193.      
  17194.         StartForward(as_use_clause_list(Root), as_use_clause_list_List);
  17195.         while not Finished(as_use_clause_list_List) loop
  17196.             as_use_clause_list_Item := Cell(as_use_clause_list_List);
  17197.      
  17198.      
  17199.       if SERIES_UNIT_IH.R.ih_inlist then
  17200.           IncrementToken (commaz);
  17201.       end if;
  17202.       SERIES_UNIT_IH.R.ih_inlist := true;
  17203.      
  17204.      
  17205.             Scan_NAME_EXP(as_use_clause_list_Item);
  17206.             Forward(as_use_clause_list_List);
  17207.         end loop;
  17208.         EndIterate(as_use_clause_list_List);
  17209.       end if;
  17210.      
  17211.      
  17212.      IncrementToken (semicolonz);
  17213.      SERIES_UNIT_IH.R.ih_inlist := false;
  17214.      
  17215.      
  17216.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17217.      
  17218.     end Scan_use_clause;
  17219.      
  17220.      
  17221.     procedure Scan_with_clause(Root : with_clauseNode.Locator) is
  17222.         as_with_clause_list_List : SeqOfNAME_EXP.Generator;
  17223.         as_with_clause_list_Item : NAME_EXP.Locator;
  17224.         use SeqOfNAME_EXP;
  17225.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17226.     begin
  17227.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17228.       if not SeqOfNAME_EXP.IsNull(as_with_clause_list(Root)) then
  17229.      
  17230.      
  17231.      IncrementToken (with_contextz);
  17232.      
  17233.      
  17234.         StartForward(as_with_clause_list(Root), as_with_clause_list_List);
  17235.         while not Finished(as_with_clause_list_List) loop
  17236.             as_with_clause_list_Item := Cell(as_with_clause_list_List);
  17237.      
  17238.      
  17239.        if SERIES_UNIT_IH.R.ih_inlist then
  17240.            IncrementToken (commaz);
  17241.        end if;
  17242.        SERIES_UNIT_IH.R.ih_inlist := true;
  17243.      
  17244.      
  17245.             Scan_NAME_EXP(as_with_clause_list_Item);
  17246.             Forward(as_with_clause_list_List);
  17247.         end loop;
  17248.         EndIterate(as_with_clause_list_List);
  17249.       end if;
  17250.      
  17251.      
  17252.       IncrementToken (semicolonz);
  17253.       SERIES_UNIT_IH.R.ih_inlist := false;
  17254.      
  17255.      
  17256.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17257.      
  17258.     end Scan_with_clause;
  17259.      
  17260. end ITEM_Pkg;
  17261. -- End: SCITEM bdy -----------------------------------------------------
  17262. ::::::::::::::
  17263. scitem.spc
  17264. ::::::::::::::
  17265. -- Begin: SCITEM spc ---------------------------------------------------
  17266.      
  17267. with ST_DIANA; use ST_DIANA;
  17268.              package ITEM_Pkg is
  17269.     procedure Scan_ITEM(Root : ITEM.Locator);
  17270.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator);
  17271.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator);
  17272.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator);
  17273.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator);
  17274.     procedure Scan_component_decl(Root : component_declNode.Locator);
  17275.     procedure Scan_constant_decl(Root : constant_declNode.Locator);
  17276.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator);
  17277.     procedure Scan_in_decl(Root : in_declNode.Locator);
  17278.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator);
  17279.     procedure Scan_out_decl(Root : out_declNode.Locator);
  17280.     procedure Scan_variable_decl(Root : variable_declNode.Locator);
  17281.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator);
  17282.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator);
  17283.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator);
  17284.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator);
  17285.     procedure Scan_address_rep(Root : address_repNode.Locator);
  17286.     procedure Scan_record_rep(Root : record_repNode.Locator);
  17287.     procedure Scan_rep_component(Root : rep_componentNode.Locator);
  17288.     procedure Scan_simple_rep(Root : simple_repNode.Locator);
  17289.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator);
  17290.     procedure Scan_subp_body(Root : subp_bodyNode.Locator);
  17291.     procedure Scan_subp_decl(Root : subp_declNode.Locator);
  17292.     procedure Scan_entry_decl(Root : entry_declNode.Locator);
  17293.     procedure Scan_exception_decl(Root : exception_declNode.Locator);
  17294.     procedure Scan_null_component(Root : null_componentNode.Locator);
  17295.     procedure Scan_number_decl(Root : number_declNode.Locator);
  17296.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator);
  17297.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator);
  17298.     procedure Scan_subunit(Root : subunitNode.Locator);
  17299.     procedure Scan_task_body(Root : task_bodyNode.Locator);
  17300.     procedure Scan_task_decl(Root : task_declNode.Locator);
  17301.     procedure Scan_type_decl(Root : type_declNode.Locator);
  17302.     procedure Scan_use_clause(Root : use_clauseNode.Locator);
  17303.     procedure Scan_with_clause(Root : with_clauseNode.Locator);
  17304. end ITEM_Pkg;
  17305. -- End: SCITEM spc -----------------------------------------------------
  17306. ::::::::::::::
  17307. sciterati.bdy
  17308. ::::::::::::::
  17309. -- Begin: SCITERATION bdy ---------------------------------------------------
  17310.      
  17311. with Halstead_Data_Base;  use Halstead_Data_Base;
  17312. with Definitions; use Definitions;
  17313.              with DEF_ID_Pkg; use DEF_ID_Pkg;
  17314. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  17315. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  17316. package body ITERATION_Pkg is
  17317.      
  17318.      
  17319.     procedure Scan_ITERATION(Root : ITERATION.Locator) is
  17320.     begin
  17321.         case Kind(Root) is
  17322.           when FOR_ITERATIONKind => Scan_FOR_ITERATION(Root);
  17323.           when while_iterationKind => Scan_while_iteration(Root);
  17324.           when others => null;
  17325.         end case;
  17326.     end Scan_ITERATION;
  17327.      
  17328.      
  17329.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator) is
  17330.     begin
  17331.         case Kind(Root) is
  17332.           when forward_iterationKind => Scan_forward_iteration(Root);
  17333.           when reverse_iterationKind => Scan_reverse_iteration(Root);
  17334.           when others => null;
  17335.         end case;
  17336.     end Scan_FOR_ITERATION;
  17337.      
  17338.      
  17339.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator) is
  17340.     begin
  17341.       if not iteration_idNode.IsNull(as_id(Root)) then
  17342.      
  17343.      
  17344.        IncrementToken (for_loopz);
  17345.        IncrementToken (in_loopz);
  17346.      
  17347.      
  17348.         Scan_iteration_id(as_id(Root));
  17349.       end if;
  17350.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  17351.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  17352.       end if;
  17353.      
  17354.     end Scan_forward_iteration;
  17355.      
  17356.      
  17357.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator) is
  17358.     begin
  17359.       if not iteration_idNode.IsNull(as_id(Root)) then
  17360.      
  17361.      
  17362.        IncrementToken (for_loopz);
  17363.        IncrementToken (in_loopz);
  17364.      
  17365.      
  17366.         Scan_iteration_id(as_id(Root));
  17367.       end if;
  17368.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  17369.      
  17370.      
  17371.        IncrementToken (reversez);
  17372.      
  17373.      
  17374.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  17375.       end if;
  17376.      
  17377.     end Scan_reverse_iteration;
  17378.      
  17379.      
  17380.     procedure Scan_while_iteration(Root : while_iterationNode.Locator) is
  17381.     begin
  17382.       if not NAME_EXP.IsNull(as_while_exp(Root)) then
  17383.      
  17384.      
  17385.        IncrementToken (whilez);
  17386.      
  17387.      
  17388.         Scan_NAME_EXP(as_while_exp(Root));
  17389.       end if;
  17390.      
  17391.     end Scan_while_iteration;
  17392.      
  17393. end ITERATION_Pkg;
  17394. -- End: SCITERATION bdy -----------------------------------------------------
  17395. ::::::::::::::
  17396. sciterati.spc
  17397. ::::::::::::::
  17398. -- Begin: SCITERATION spc ---------------------------------------------------
  17399.      
  17400. with ST_DIANA; use ST_DIANA;
  17401.              package ITERATION_Pkg is
  17402.     procedure Scan_ITERATION(Root : ITERATION.Locator);
  17403.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator);
  17404.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator);
  17405.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator);
  17406.     procedure Scan_while_iteration(Root : while_iterationNode.Locator);
  17407. end ITERATION_Pkg;
  17408. -- End: SCITERATION spc -----------------------------------------------------
  17409. ::::::::::::::
  17410. scname_ex.bdy
  17411. ::::::::::::::
  17412. -- Begin: SCNAME_EXP bdy ---------------------------------------------------
  17413.      
  17414. with Halstead_Data_Base;  use Halstead_Data_Base;
  17415. with Definitions; use Definitions;
  17416.              with SERIES_UNIT_IH;
  17417. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  17418. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  17419. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  17420.      
  17421.                with VmmTextPkg;
  17422.                with TEXT_IO;
  17423.                          package body NAME_EXP_Pkg is
  17424.      
  17425.      
  17426.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator) is
  17427.     begin
  17428.         case Kind(Root) is
  17429.           when AGGKind => Scan_AGG(Root);
  17430.           when ALL_COMPONENTSKind => Scan_ALL_COMPONENTS(Root);
  17431.           when CALLSKind => Scan_CALLS(Root);
  17432.           when MARKKind => Scan_MARK(Root);
  17433.           when MEMBERSHIP_EXPKind => Scan_MEMBERSHIP_EXP(Root);
  17434.           when OPERATOR_EXPKind => Scan_OPERATOR_EXP(Root);
  17435.           when SHORT_CIRCUIT_EXPKind => Scan_SHORT_CIRCUIT_EXP(Root);
  17436.           when attributeKind => Scan_attribute(Root);
  17437.           when attribute_indexedKind => Scan_attribute_indexed(Root);
  17438.           when conversionKind => Scan_conversion(Root);
  17439.           when family_indexedKind => Scan_family_indexed(Root);
  17440.           when indexedKind => Scan_indexed(Root);
  17441.           when init_allocatorKind => Scan_init_allocator(Root);
  17442.           when null_accessKind => Scan_null_access(Root);
  17443.           when numeric_literalKind => Scan_numeric_literal(Root);
  17444.           when parenthesizedKind => Scan_parenthesized(Root);
  17445.           when qualifiedKind => Scan_qualified(Root);
  17446.           when sliceKind => Scan_slice(Root);
  17447.           when string_literalKind => Scan_string_literal(Root);
  17448.           when uninit_allocatorKind => Scan_uninit_allocator(Root);
  17449.           when others => null;
  17450.         end case;
  17451.     end Scan_NAME_EXP;
  17452.      
  17453.      
  17454.     procedure Scan_AGG(Root : AGG.Locator) is
  17455.     begin
  17456.         case Kind(Root) is
  17457.           when apply_aggKind => Scan_apply_agg(Root);
  17458.           when array_aggKind => Scan_array_agg(Root);
  17459.           when record_aggKind => Scan_record_agg(Root);
  17460.           when others => null;
  17461.         end case;
  17462.     end Scan_AGG;
  17463.      
  17464.      
  17465.     procedure Scan_apply_agg(Root : apply_aggNode.Locator) is
  17466.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17467.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17468.         use SeqOfAGG_COMPONENT;
  17469.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17470.     begin
  17471.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17472.      
  17473.      
  17474.      IncrementToken (open_parenthesisz);
  17475.      
  17476.      
  17477.         StartForward(as_agg_s(Root), as_agg_s_List);
  17478.         while not Finished(as_agg_s_List) loop
  17479.             as_agg_s_Item := Cell(as_agg_s_List);
  17480.      
  17481.      
  17482.      if SERIES_UNIT_IH.R.ih_inlist then
  17483.          IncrementToken (commaz);
  17484.      end if;
  17485.      SERIES_UNIT_IH.R.ih_inlist := true;
  17486.      
  17487.      
  17488.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17489.             Forward(as_agg_s_List);
  17490.         end loop;
  17491.         EndIterate(as_agg_s_List);
  17492.      
  17493.      
  17494.      IncrementToken (closed_parenthesisz);
  17495.      SERIES_UNIT_IH.R.ih_inlist := false;
  17496.      
  17497.      
  17498.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17499.      
  17500.     end Scan_apply_agg;
  17501.      
  17502.      
  17503.     procedure Scan_array_agg(Root : array_aggNode.Locator) is
  17504.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17505.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17506.         use SeqOfAGG_COMPONENT;
  17507.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17508.     begin
  17509.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17510.      
  17511.      
  17512.      IncrementToken (open_parenthesisz);
  17513.      
  17514.      
  17515.         StartForward(as_agg_s(Root), as_agg_s_List);
  17516.         while not Finished(as_agg_s_List) loop
  17517.             as_agg_s_Item := Cell(as_agg_s_List);
  17518.      
  17519.      
  17520.      if SERIES_UNIT_IH.R.ih_inlist then
  17521.          IncrementToken (commaz);
  17522.      end if;
  17523.      SERIES_UNIT_IH.R.ih_inlist := true;
  17524.      
  17525.      
  17526.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17527.             Forward(as_agg_s_List);
  17528.         end loop;
  17529.         EndIterate(as_agg_s_List);
  17530.      
  17531.      
  17532.      IncrementToken (closed_parenthesisz);
  17533.      SERIES_UNIT_IH.R.ih_inlist := false;
  17534.      
  17535.      
  17536.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17537.      
  17538.     end Scan_array_agg;
  17539.      
  17540.      
  17541.     procedure Scan_record_agg(Root : record_aggNode.Locator) is
  17542.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17543.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17544.         use SeqOfAGG_COMPONENT;
  17545.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17546.     begin
  17547.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17548.      
  17549.      
  17550.      IncrementToken (open_parenthesisz);
  17551.      
  17552.      
  17553.         StartForward(as_agg_s(Root), as_agg_s_List);
  17554.         while not Finished(as_agg_s_List) loop
  17555.             as_agg_s_Item := Cell(as_agg_s_List);
  17556.      
  17557.      
  17558.      if SERIES_UNIT_IH.R.ih_inlist then
  17559.          IncrementToken (commaz);
  17560.      end if;
  17561.      SERIES_UNIT_IH.R.ih_inlist := true;
  17562.      
  17563.      
  17564.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17565.             Forward(as_agg_s_List);
  17566.         end loop;
  17567.         EndIterate(as_agg_s_List);
  17568.      
  17569.      
  17570.      IncrementToken (closed_parenthesisz);
  17571.      SERIES_UNIT_IH.R.ih_inlist := false;
  17572.      
  17573.      
  17574.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17575.      
  17576.     end Scan_record_agg;
  17577.      
  17578.      
  17579.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator) is
  17580.     begin
  17581.         case Kind(Root) is
  17582.           when explicit_all_componentsKind => Scan_explicit_all_components(Root);
  17583.           when implicit_all_componentsKind => Scan_implicit_all_components(Root);
  17584.           when others => null;
  17585.         end case;
  17586.     end Scan_ALL_COMPONENTS;
  17587.      
  17588.      
  17589.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator) is
  17590.     begin
  17591.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  17592.         Scan_NAME_EXP(as_all_name(Root));
  17593.       end if;
  17594.      
  17595.      
  17596.       IncrementToken (allz);
  17597.       IncrementToken (dotz);
  17598.      
  17599.      
  17600.      
  17601.     end Scan_explicit_all_components;
  17602.      
  17603.      
  17604.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator) is
  17605.     begin
  17606.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  17607.         Scan_NAME_EXP(as_all_name(Root));
  17608.       end if;
  17609.      
  17610.     end Scan_implicit_all_components;
  17611.      
  17612.      
  17613.     procedure Scan_CALLS(Root : CALLS.Locator) is
  17614.     begin
  17615.         case Kind(Root) is
  17616.           when apply_callKind => Scan_apply_call(Root);
  17617.           when entry_callKind => Scan_entry_call(Root);
  17618.           when func_callKind => Scan_func_call(Root);
  17619.           when proc_callKind => Scan_proc_call(Root);
  17620.           when others => null;
  17621.         end case;
  17622.     end Scan_CALLS;
  17623.      
  17624.      
  17625.     procedure Scan_apply_call(Root : apply_callNode.Locator) is
  17626.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17627.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17628.         use SeqOfGENERAL_ASSOC;
  17629.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17630.     begin
  17631.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17632.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17633.         Scan_NAME_EXP(as_apply_name(Root));
  17634.      
  17635.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17636.         then
  17637.      
  17638.          IncrementToken (open_parenthesisz);
  17639.      
  17640.         end if;
  17641.       end if;
  17642.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17643.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17644.         while not Finished(as_param_assoc_s_List) loop
  17645.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17646.      
  17647.      
  17648.       if SERIES_UNIT_IH.R.ih_inlist then
  17649.           IncrementToken (commaz);
  17650.       end if;
  17651.       SERIES_UNIT_IH.R.ih_inlist := true;
  17652.      
  17653.      
  17654.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17655.             Forward(as_param_assoc_s_List);
  17656.         end loop;
  17657.         EndIterate(as_param_assoc_s_List);
  17658.      
  17659.      
  17660.         IncrementToken (closed_parenthesisz);
  17661.    SERIES_UNIT_IH.R.ih_inlist := false;
  17662.      
  17663.      
  17664.       end if;
  17665.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17666.      
  17667.     end Scan_apply_call;
  17668.      
  17669.      
  17670.     procedure Scan_entry_call(Root : entry_callNode.Locator) is
  17671.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17672.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17673.         use SeqOfGENERAL_ASSOC;
  17674.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17675.     begin
  17676.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17677.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17678.         Scan_NAME_EXP(as_apply_name(Root));
  17679.      
  17680.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17681.         then
  17682.      
  17683.          IncrementToken (open_parenthesisz);
  17684.      
  17685.         end if;
  17686.       end if;
  17687.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17688.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17689.         while not Finished(as_param_assoc_s_List) loop
  17690.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17691.      
  17692.      
  17693.       if SERIES_UNIT_IH.R.ih_inlist then
  17694.           IncrementToken (commaz);
  17695.       end if;
  17696.       SERIES_UNIT_IH.R.ih_inlist := true;
  17697.      
  17698.      
  17699.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17700.             Forward(as_param_assoc_s_List);
  17701.         end loop;
  17702.         EndIterate(as_param_assoc_s_List);
  17703.      
  17704.      
  17705.         IncrementToken (closed_parenthesisz);
  17706.    SERIES_UNIT_IH.R.ih_inlist := false;
  17707.      
  17708.      
  17709.       end if;
  17710.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17711.      
  17712.     end Scan_entry_call;
  17713.      
  17714.      
  17715.     procedure Scan_func_call(Root : func_callNode.Locator) is
  17716.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17717.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17718.         use SeqOfGENERAL_ASSOC;
  17719.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17720.     begin
  17721.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17722.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17723.         Scan_NAME_EXP(as_apply_name(Root));
  17724.      
  17725.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17726.         then
  17727.      
  17728.          IncrementToken (open_parenthesisz);
  17729.      
  17730.         end if;
  17731.       end if;
  17732.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17733.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17734.         while not Finished(as_param_assoc_s_List) loop
  17735.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17736.      
  17737.      
  17738.       if SERIES_UNIT_IH.R.ih_inlist then
  17739.           IncrementToken (commaz);
  17740.       end if;
  17741.       SERIES_UNIT_IH.R.ih_inlist := true;
  17742.      
  17743.      
  17744.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17745.             Forward(as_param_assoc_s_List);
  17746.         end loop;
  17747.         EndIterate(as_param_assoc_s_List);
  17748.      
  17749.      
  17750.         IncrementToken (closed_parenthesisz);
  17751.    SERIES_UNIT_IH.R.ih_inlist := false;
  17752.      
  17753.      
  17754.       end if;
  17755.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17756.      
  17757.     end Scan_func_call;
  17758.      
  17759.      
  17760.     procedure Scan_proc_call(Root : proc_callNode.Locator) is
  17761.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17762.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17763.         use SeqOfGENERAL_ASSOC;
  17764.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17765.     begin
  17766.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17767.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17768.         Scan_NAME_EXP(as_apply_name(Root));
  17769.      
  17770.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17771.         then
  17772.      
  17773.          IncrementToken (open_parenthesisz);
  17774.      
  17775.         end if;
  17776.       end if;
  17777.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17778.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17779.         while not Finished(as_param_assoc_s_List) loop
  17780.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17781.      
  17782.      
  17783.       if SERIES_UNIT_IH.R.ih_inlist then
  17784.           IncrementToken (commaz);
  17785.       end if;
  17786.       SERIES_UNIT_IH.R.ih_inlist := true;
  17787.      
  17788.      
  17789.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17790.             Forward(as_param_assoc_s_List);
  17791.         end loop;
  17792.         EndIterate(as_param_assoc_s_List);
  17793.      
  17794.      
  17795.         IncrementToken (closed_parenthesisz);
  17796.    SERIES_UNIT_IH.R.ih_inlist := false;
  17797.      
  17798.      
  17799.       end if;
  17800.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17801.      
  17802.     end Scan_proc_call;
  17803.      
  17804.      
  17805.     procedure Scan_MARK(Root : MARK.Locator) is
  17806.     begin
  17807.         case Kind(Root) is
  17808.           when USED_SYMBOLKind => Scan_USED_SYMBOL(Root);
  17809.           when selectedKind => Scan_selected(Root);
  17810.           when others => null;
  17811.         end case;
  17812.     end Scan_MARK;
  17813.      
  17814.      
  17815.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator) is
  17816.     begin
  17817.         case Kind(Root) is
  17818.           when used_charKind => Scan_used_char(Root);
  17819.           when used_idKind => Scan_used_id(Root);
  17820.           when used_operatorKind => Scan_used_operator(Root);
  17821.           when others => null;
  17822.         end case;
  17823.     end Scan_USED_SYMBOL;
  17824.      
  17825.      
  17826.     procedure Scan_used_char(Root : used_charNode.Locator) is
  17827.     begin
  17828.      
  17829.      
  17830.      Literal_Set.Insert (lx_text (lx_symrep (root)),
  17831.                          CurrentBlock.SetOfLiterals);
  17832.      IncrementToken (single_quotez);
  17833.      IncrementToken (single_quotez);
  17834.      
  17835.      
  17836.      
  17837.     end Scan_used_char;
  17838.      
  17839.      
  17840.     procedure Scan_used_id(Root : used_idNode.Locator) is
  17841.     begin
  17842.      
  17843.      
  17844.       if not DEF_ID.IsNull (sm_def (root)) then
  17845.          DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  17846.       else
  17847.           TEXT_IO.Put ("?? Unexpected null sm_def: ");
  17848.           TEXT_IO.Put_Line (
  17849.             VmmTextPkg.Value (
  17850.                    Source_Text.Value (
  17851.                      lx_text (
  17852.                        ne_normalized_symrep (
  17853.                          ne_symbol_entry_in_table (
  17854.                            lx_symrep (
  17855.                              root))))))
  17856.               );
  17857.       end if;
  17858.      
  17859.      
  17860.      
  17861.     end Scan_used_id;
  17862.      
  17863.      
  17864.     procedure Scan_used_operator(Root : used_operatorNode.Locator) is
  17865.     begin
  17866.      
  17867.      
  17868.         DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  17869.      
  17870.      
  17871.      
  17872.     end Scan_used_operator;
  17873.      
  17874.      
  17875.     procedure Scan_selected(Root : selectedNode.Locator) is
  17876.     begin
  17877.       if not NAME_EXP.IsNull(as_selected_name(Root)) then
  17878.         Scan_NAME_EXP(as_selected_name(Root));
  17879.      
  17880.      
  17881.      IncrementToken (dotz);
  17882.      
  17883.      
  17884.       end if;
  17885.       if not NAME_EXP.IsNull(as_selected_designator(Root)) then
  17886.         Scan_NAME_EXP(as_selected_designator(Root));
  17887.       end if;
  17888.      
  17889.     end Scan_selected;
  17890.      
  17891.      
  17892.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator) is
  17893.     begin
  17894.         case Kind(Root) is
  17895.           when in_expKind => Scan_in_exp(Root);
  17896.           when not_in_expKind => Scan_not_in_exp(Root);
  17897.           when others => null;
  17898.         end case;
  17899.     end Scan_MEMBERSHIP_EXP;
  17900.      
  17901.      
  17902.     procedure Scan_in_exp(Root : in_expNode.Locator) is
  17903.     begin
  17904.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  17905.         Scan_NAME_EXP(as_membership_exp(Root));
  17906.      
  17907.      
  17908.      IncrementToken (in_membershipz);
  17909.      
  17910.      
  17911.       end if;
  17912.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  17913.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  17914.       end if;
  17915.      
  17916.     end Scan_in_exp;
  17917.      
  17918.      
  17919.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator) is
  17920.     begin
  17921.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  17922.         Scan_NAME_EXP(as_membership_exp(Root));
  17923.      
  17924.      
  17925.      IncrementToken (not_in_membershipz);
  17926.      IncrementToken (in_membershipz);
  17927.      
  17928.      
  17929.       end if;
  17930.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  17931.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  17932.       end if;
  17933.      
  17934.     end Scan_not_in_exp;
  17935.      
  17936.      
  17937.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator) is
  17938.     begin
  17939.         case Kind(Root) is
  17940.           when binary_operationKind => Scan_binary_operation(Root);
  17941.           when unary_operationKind => Scan_unary_operation(Root);
  17942.           when others => null;
  17943.         end case;
  17944.     end Scan_OPERATOR_EXP;
  17945.      
  17946.      
  17947.     procedure Scan_binary_operation(Root : binary_operationNode.Locator) is
  17948.     begin
  17949.       if not NAME_EXP.IsNull(as_left_exp(Root)) then
  17950.         Scan_NAME_EXP(as_left_exp(Root));
  17951.       end if;
  17952.       if not used_operatorNode.IsNull(as_operator(Root)) then
  17953.         Scan_used_operator(as_operator(Root));
  17954.       end if;
  17955.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  17956.         Scan_NAME_EXP(as_right_exp(Root));
  17957.       end if;
  17958.      
  17959.     end Scan_binary_operation;
  17960.      
  17961.      
  17962.     procedure Scan_unary_operation(Root : unary_operationNode.Locator) is
  17963.     begin
  17964.       if not used_operatorNode.IsNull(as_operator(Root)) then
  17965.         Scan_used_operator(as_operator(Root));
  17966.       end if;
  17967.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  17968.         Scan_NAME_EXP(as_right_exp(Root));
  17969.       end if;
  17970.      
  17971.     end Scan_unary_operation;
  17972.      
  17973.      
  17974.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator) is
  17975.     begin
  17976.         case Kind(Root) is
  17977.           when and_then_expKind => Scan_and_then_exp(Root);
  17978.           when or_else_expKind => Scan_or_else_exp(Root);
  17979.           when others => null;
  17980.         end case;
  17981.     end Scan_SHORT_CIRCUIT_EXP;
  17982.      
  17983.      
  17984.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator) is
  17985.     begin
  17986.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  17987.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  17988.       end if;
  17989.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  17990.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  17991.       end if;
  17992.      
  17993.      
  17994.        IncrementToken (and_thenz);
  17995.        IncrementToken (then_andz);
  17996.      
  17997.      
  17998.      
  17999.     end Scan_and_then_exp;
  18000.      
  18001.      
  18002.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator) is
  18003.     begin
  18004.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  18005.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  18006.       end if;
  18007.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  18008.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  18009.       end if;
  18010.      
  18011.      
  18012.        IncrementToken (or_elsez);
  18013.        IncrementToken (else_orz);
  18014.      
  18015.      
  18016.      
  18017.     end Scan_or_else_exp;
  18018.      
  18019.      
  18020.     procedure Scan_attribute(Root : attributeNode.Locator) is
  18021.     begin
  18022.       if not NAME_EXP.IsNull(as_attribute_name(Root)) then
  18023.         Scan_NAME_EXP(as_attribute_name(Root));
  18024.      
  18025.      
  18026.      IncrementToken (tickz);
  18027.      
  18028.      
  18029.       end if;
  18030.       if not NAME_EXP.IsNull(as_attribute_id(Root)) then
  18031.         Scan_NAME_EXP(as_attribute_id(Root));
  18032.       end if;
  18033.      
  18034.     end Scan_attribute;
  18035.      
  18036.      
  18037.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator) is
  18038.     begin
  18039.       if not NAME_EXP.IsNull(as_attribute_indexed_name(Root)) then
  18040.      
  18041.      
  18042.      IncrementToken (open_parenthesisz);
  18043.      
  18044.      
  18045.         Scan_NAME_EXP(as_attribute_indexed_name(Root));
  18046.      
  18047.      
  18048.       IncrementToken (closed_parenthesisz);
  18049.      
  18050.      
  18051.       end if;
  18052.       if not NAME_EXP.IsNull(as_attribute_indexed_exp(Root)) then
  18053.         Scan_NAME_EXP(as_attribute_indexed_exp(Root));
  18054.       end if;
  18055.      
  18056.     end Scan_attribute_indexed;
  18057.      
  18058.      
  18059.     procedure Scan_conversion(Root : conversionNode.Locator) is
  18060.     begin
  18061.       if not NAME_EXP.IsNull(as_conversion_name(Root)) then
  18062.      
  18063.      
  18064.       IncrementToken (open_parenthesisz);
  18065.      
  18066.      
  18067.         Scan_NAME_EXP(as_conversion_name(Root));
  18068.      
  18069.      
  18070.        IncrementToken (closed_parenthesisz);
  18071.      
  18072.      
  18073.       end if;
  18074.       if not NAME_EXP.IsNull(as_conversion_exp(Root)) then
  18075.         Scan_NAME_EXP(as_conversion_exp(Root));
  18076.       end if;
  18077.      
  18078.     end Scan_conversion;
  18079.      
  18080.      
  18081.     procedure Scan_family_indexed(Root : family_indexedNode.Locator) is
  18082.     begin
  18083.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  18084.      
  18085.      
  18086.        IncrementToken (open_parenthesisz);
  18087.      
  18088.      
  18089.         Scan_NAME_EXP(as_family_index(Root));
  18090.      
  18091.      
  18092.        IncrementToken (closed_parenthesisz);
  18093.      
  18094.      
  18095.       end if;
  18096.       if not NAME_EXP.IsNull(as_family_name(Root)) then
  18097.         Scan_NAME_EXP(as_family_name(Root));
  18098.       end if;
  18099.      
  18100.     end Scan_family_indexed;
  18101.      
  18102.      
  18103.     procedure Scan_indexed(Root : indexedNode.Locator) is
  18104.         as_indexed_exp_s_List : SeqOfNAME_EXP.Generator;
  18105.         as_indexed_exp_s_Item : NAME_EXP.Locator;
  18106.         use SeqOfNAME_EXP;
  18107.     begin
  18108.       if not NAME_EXP.IsNull(as_indexed_name(Root)) then
  18109.         Scan_NAME_EXP(as_indexed_name(Root));
  18110.       end if;
  18111.       if not SeqOfNAME_EXP.IsNull(as_indexed_exp_s(Root)) then
  18112.      
  18113.      
  18114.       IncrementToken (open_parenthesisz);
  18115.      
  18116.      
  18117.         StartForward(as_indexed_exp_s(Root), as_indexed_exp_s_List);
  18118.         while not Finished(as_indexed_exp_s_List) loop
  18119.             as_indexed_exp_s_Item := Cell(as_indexed_exp_s_List);
  18120.             Scan_NAME_EXP(as_indexed_exp_s_Item);
  18121.             Forward(as_indexed_exp_s_List);
  18122.         end loop;
  18123.         EndIterate(as_indexed_exp_s_List);
  18124.      
  18125.      
  18126.        IncrementToken (closed_parenthesisz);
  18127.      
  18128.      
  18129.       end if;
  18130.      
  18131.     end Scan_indexed;
  18132.      
  18133.      
  18134.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator) is
  18135.     begin
  18136.      
  18137.      
  18138.           IncrementToken (new_allocatorz);
  18139.      
  18140.      
  18141.       if not qualifiedNode.IsNull(as_allocator_qualified(Root)) then
  18142.         Scan_qualified(as_allocator_qualified(Root));
  18143.       end if;
  18144.      
  18145.     end Scan_init_allocator;
  18146.      
  18147.      
  18148.     procedure Scan_null_access(Root : null_accessNode.Locator) is
  18149.     begin
  18150.      
  18151.      
  18152.      IncrementToken (null_valuez);
  18153.      
  18154.      
  18155.      
  18156.     end Scan_null_access;
  18157.      
  18158.      
  18159.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator) is
  18160.     begin
  18161.      
  18162.      
  18163.     Literal_Set.Insert (lx_text (lx_numrep (root)),
  18164.                         CurrentBlock.SetOfLiterals);
  18165.      
  18166.      
  18167.      
  18168.     end Scan_numeric_literal;
  18169.      
  18170.      
  18171.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator) is
  18172.     begin
  18173.      
  18174.      
  18175.      IncrementToken (open_parenthesisz);
  18176.      
  18177.      
  18178.       if not NAME_EXP.IsNull(as_parenthesized_exp(Root)) then
  18179.         Scan_NAME_EXP(as_parenthesized_exp(Root));
  18180.       end if;
  18181.      
  18182.      
  18183.      IncrementToken (closed_parenthesisz);
  18184.      
  18185.      
  18186.      
  18187.     end Scan_parenthesized;
  18188.      
  18189.      
  18190.     procedure Scan_qualified(Root : qualifiedNode.Locator) is
  18191.     begin
  18192.       if not MARK.IsNull(as_qualified_name(Root)) then
  18193.         Scan_MARK(as_qualified_name(Root));
  18194.      
  18195.      
  18196.      IncrementToken (tickz);
  18197.      
  18198.      
  18199.       end if;
  18200.       if not NAME_EXP.IsNull(as_qualified_exp(Root)) then
  18201.         Scan_NAME_EXP(as_qualified_exp(Root));
  18202.       end if;
  18203.      
  18204.     end Scan_qualified;
  18205.      
  18206.      
  18207.     procedure Scan_slice(Root : sliceNode.Locator) is
  18208.     begin
  18209.      
  18210.      
  18211.      IncrementToken (open_parenthesisz);
  18212.      
  18213.      
  18214.      
  18215.      
  18216.     IncrementToken (closed_parenthesisz);
  18217.      
  18218.      
  18219.       if not NAME_EXP.IsNull(as_slice_name(Root)) then
  18220.         Scan_NAME_EXP(as_slice_name(Root));
  18221.       end if;
  18222.       if not OBJECT_TYPE.IsNull(as_slice_discrete_range(Root)) then
  18223.         Scan_OBJECT_TYPE(as_slice_discrete_range(Root));
  18224.       end if;
  18225.      
  18226.     end Scan_slice;
  18227.      
  18228.      
  18229.     procedure Scan_string_literal(Root : string_literalNode.Locator) is
  18230.     begin
  18231.      
  18232.      
  18233.     IncrementToken (double_quotez);
  18234.     Literal_Set.Insert (lx_text (lx_string_symrep (root)),
  18235.                     CurrentBlock.SetOfLiterals);
  18236.      
  18237.      
  18238.      
  18239.      
  18240.      IncrementToken (double_quotez);
  18241.      
  18242.      
  18243.      
  18244.     end Scan_string_literal;
  18245.      
  18246.      
  18247.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator) is
  18248.     begin
  18249.      
  18250.      
  18251.       IncrementToken (new_allocatorz);
  18252.      
  18253.      
  18254.       if not object_type_constrainedNode.IsNull(as_allocator_constrained(Root)) then
  18255.         Scan_object_type_constrained(as_allocator_constrained(Root));
  18256.       end if;
  18257.      
  18258.     end Scan_uninit_allocator;
  18259.      
  18260. end NAME_EXP_Pkg;
  18261. -- End: SCNAME_EXP bdy -----------------------------------------------------
  18262. ::::::::::::::
  18263. scname_ex.spc
  18264. ::::::::::::::
  18265. -- Begin: SCNAME_EXP spc ---------------------------------------------------
  18266.      
  18267. with ST_DIANA; use ST_DIANA;
  18268.              package NAME_EXP_Pkg is
  18269.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator);
  18270.     procedure Scan_AGG(Root : AGG.Locator);
  18271.     procedure Scan_apply_agg(Root : apply_aggNode.Locator);
  18272.     procedure Scan_array_agg(Root : array_aggNode.Locator);
  18273.     procedure Scan_record_agg(Root : record_aggNode.Locator);
  18274.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator);
  18275.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator);
  18276.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator);
  18277.     procedure Scan_CALLS(Root : CALLS.Locator);
  18278.     procedure Scan_apply_call(Root : apply_callNode.Locator);
  18279.     procedure Scan_entry_call(Root : entry_callNode.Locator);
  18280.     procedure Scan_func_call(Root : func_callNode.Locator);
  18281.     procedure Scan_proc_call(Root : proc_callNode.Locator);
  18282.     procedure Scan_MARK(Root : MARK.Locator);
  18283.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator);
  18284.     procedure Scan_used_char(Root : used_charNode.Locator);
  18285.     procedure Scan_used_id(Root : used_idNode.Locator);
  18286.     procedure Scan_used_operator(Root : used_operatorNode.Locator);
  18287.     procedure Scan_selected(Root : selectedNode.Locator);
  18288.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator);
  18289.     procedure Scan_in_exp(Root : in_expNode.Locator);
  18290.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator);
  18291.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator);
  18292.     procedure Scan_binary_operation(Root : binary_operationNode.Locator);
  18293.     procedure Scan_unary_operation(Root : unary_operationNode.Locator);
  18294.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator);
  18295.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator);
  18296.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator);
  18297.     procedure Scan_attribute(Root : attributeNode.Locator);
  18298.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator);
  18299.     procedure Scan_conversion(Root : conversionNode.Locator);
  18300.     procedure Scan_family_indexed(Root : family_indexedNode.Locator);
  18301.     procedure Scan_indexed(Root : indexedNode.Locator);
  18302.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator);
  18303.     procedure Scan_null_access(Root : null_accessNode.Locator);
  18304.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator);
  18305.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator);
  18306.     procedure Scan_qualified(Root : qualifiedNode.Locator);
  18307.     procedure Scan_slice(Root : sliceNode.Locator);
  18308.     procedure Scan_string_literal(Root : string_literalNode.Locator);
  18309.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator);
  18310. end NAME_EXP_Pkg;
  18311. -- End: SCNAME_EXP spc -----------------------------------------------------
  18312. ::::::::::::::
  18313. scobject_.bdy
  18314. ::::::::::::::
  18315. -- Begin: SCOBJECT_DEF bdy ---------------------------------------------------
  18316.      
  18317. with Halstead_Data_Base;  use Halstead_Data_Base;
  18318. with Definitions; use Definitions;
  18319.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18320. package body OBJECT_DEF_Pkg is
  18321.      
  18322.      
  18323.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator) is
  18324.     begin
  18325.         case Kind(Root) is
  18326.           when object_initKind => Scan_object_init(Root);
  18327.           when object_renameKind => Scan_object_rename(Root);
  18328.           when others => null;
  18329.         end case;
  18330.     end Scan_OBJECT_DEF;
  18331.      
  18332.      
  18333.     procedure Scan_object_init(Root : object_initNode.Locator) is
  18334.     begin
  18335.      
  18336.      
  18337.            IncrementToken (colon_equalsz);
  18338.      
  18339.      
  18340.       if not NAME_EXP.IsNull(as_init_exp(Root)) then
  18341.         Scan_NAME_EXP(as_init_exp(Root));
  18342.       end if;
  18343.      
  18344.     end Scan_object_init;
  18345.      
  18346.      
  18347.     procedure Scan_object_rename(Root : object_renameNode.Locator) is
  18348.     begin
  18349.      
  18350.      
  18351.           IncrementToken (renamesz);
  18352.      
  18353.      
  18354.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  18355.         Scan_NAME_EXP(as_rename_name(Root));
  18356.       end if;
  18357.      
  18358.     end Scan_object_rename;
  18359.      
  18360. end OBJECT_DEF_Pkg;
  18361. -- End: SCOBJECT_DEF bdy -----------------------------------------------------
  18362. ::::::::::::::
  18363. scobject_.spc
  18364. ::::::::::::::
  18365. -- Begin: SCOBJECT_DEF spc ---------------------------------------------------
  18366.      
  18367. with ST_DIANA; use ST_DIANA;
  18368.              package OBJECT_DEF_Pkg is
  18369.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator);
  18370.     procedure Scan_object_init(Root : object_initNode.Locator);
  18371.     procedure Scan_object_rename(Root : object_renameNode.Locator);
  18372. end OBJECT_DEF_Pkg;
  18373. -- End: SCOBJECT_DEF spc -----------------------------------------------------
  18374. ::::::::::::::
  18375. scpkg_def.bdy
  18376. ::::::::::::::
  18377. -- Begin: SCPKG_DEF bdy ---------------------------------------------------
  18378.      
  18379. with Halstead_Data_Base;  use Halstead_Data_Base;
  18380. with Definitions; use Definitions;
  18381.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  18382. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  18383. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18384. with ITEM_Pkg; use ITEM_Pkg;
  18385. package body PKG_DEF_Pkg is
  18386.      
  18387.      
  18388.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator) is
  18389.     begin
  18390.         case Kind(Root) is
  18391.           when pkg_block_stubKind => Scan_pkg_block_stub(Root);
  18392.           when pkg_instantiationKind => Scan_pkg_instantiation(Root);
  18393.           when pkg_renameKind => Scan_pkg_rename(Root);
  18394.           when pkg_specKind => Scan_pkg_spec(Root);
  18395.           when others => null;
  18396.         end case;
  18397.     end Scan_PKG_DEF;
  18398.      
  18399.      
  18400.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator) is
  18401.     begin
  18402.       if not BLOCK_STUB.IsNull(as_pkg_block_stub(Root)) then
  18403.         Scan_BLOCK_STUB(as_pkg_block_stub(Root));
  18404.       end if;
  18405.      
  18406.     end Scan_pkg_block_stub;
  18407.      
  18408.      
  18409.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator) is
  18410.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  18411.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  18412.         use SeqOfGENERAL_ASSOC;
  18413.     begin
  18414.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  18415.      
  18416.      
  18417.       IncrementToken (open_parenthesisz);
  18418.      
  18419.      
  18420.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  18421.         while not Finished(as_generic_assoc_s_List) loop
  18422.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  18423.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  18424.             Forward(as_generic_assoc_s_List);
  18425.         end loop;
  18426.         EndIterate(as_generic_assoc_s_List);
  18427.      
  18428.      
  18429.       IncrementToken (closed_parenthesisz);
  18430.      
  18431.      
  18432.       end if;
  18433.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  18434.         Scan_NAME_EXP(as_instantiation_name(Root));
  18435.      
  18436.      
  18437.       IncrementToken (new_generic_instz);
  18438.      
  18439.      
  18440.       end if;
  18441.      
  18442.     end Scan_pkg_instantiation;
  18443.      
  18444.      
  18445.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator) is
  18446.     begin
  18447.      
  18448.      
  18449.      IncrementToken (renamesz);
  18450.      
  18451.      
  18452.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  18453.      
  18454.      
  18455.                 IncrementToken (renamesz);
  18456.      
  18457.      
  18458.         Scan_NAME_EXP(as_rename_name(Root));
  18459.       end if;
  18460.      
  18461.     end Scan_pkg_rename;
  18462.      
  18463.      
  18464.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator) is
  18465.         as_visible_part_List : SeqOfITEM.Generator;
  18466.         as_visible_part_Item : ITEM.Locator;
  18467.         use SeqOfITEM;
  18468.         as_priv_part_List : SeqOfITEM.Generator;
  18469.         as_priv_part_Item : ITEM.Locator;
  18470.         use SeqOfITEM;
  18471.     begin
  18472.       if not SeqOfITEM.IsNull(as_visible_part(Root)) then
  18473.         StartForward(as_visible_part(Root), as_visible_part_List);
  18474.         while not Finished(as_visible_part_List) loop
  18475.             as_visible_part_Item := Cell(as_visible_part_List);
  18476.             Scan_ITEM(as_visible_part_Item);
  18477.             Forward(as_visible_part_List);
  18478.         end loop;
  18479.         EndIterate(as_visible_part_List);
  18480.       end if;
  18481.       if not SeqOfITEM.IsNull(as_priv_part(Root)) then
  18482.      
  18483.      
  18484.        IncrementToken (private_sectionz);
  18485.      
  18486.      
  18487.         StartForward(as_priv_part(Root), as_priv_part_List);
  18488.         while not Finished(as_priv_part_List) loop
  18489.             as_priv_part_Item := Cell(as_priv_part_List);
  18490.             Scan_ITEM(as_priv_part_Item);
  18491.             Forward(as_priv_part_List);
  18492.         end loop;
  18493.         EndIterate(as_priv_part_List);
  18494.       end if;
  18495.      
  18496.     end Scan_pkg_spec;
  18497.      
  18498. end PKG_DEF_Pkg;
  18499. -- End: SCPKG_DEF bdy -----------------------------------------------------
  18500. ::::::::::::::
  18501. scpkg_def.spc
  18502. ::::::::::::::
  18503. -- Begin: SCPKG_DEF spc ---------------------------------------------------
  18504.      
  18505. with ST_DIANA; use ST_DIANA;
  18506.              package PKG_DEF_Pkg is
  18507.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator);
  18508.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator);
  18509.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator);
  18510.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator);
  18511.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator);
  18512. end PKG_DEF_Pkg;
  18513. -- End: SCPKG_DEF spc -----------------------------------------------------
  18514. ::::::::::::::
  18515. scstm.bdy
  18516. ::::::::::::::
  18517. --VMS file: %nosc.work.tools.halstead.source*(SCSTM.bdy)
  18518. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCSTM.bdy
  18519. -- Begin: SCSTM bdy ---------------------------------------------------
  18520.      
  18521. with Halstead_Data_Base;  use Halstead_Data_Base;
  18522. with Definitions; use Definitions;
  18523.              with SERIES_UNIT_IH;
  18524. with block_stm_IH;
  18525. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18526. with HEADER_Pkg; use HEADER_Pkg;
  18527. with DEF_ID_Pkg; use DEF_ID_Pkg;
  18528. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  18529. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  18530. with ITERATION_Pkg; use ITERATION_Pkg;
  18531. with ITEM_Pkg; use ITEM_Pkg;
  18532.      
  18533.               with TEXT_IO; use TEXT_IO;
  18534.               with VmmTextPkg;
  18535.               with Block_Utilities;
  18536.                   package body STM_Pkg is
  18537.      
  18538.      
  18539.     procedure Scan_STM(Root : STM.Locator) is
  18540.     begin
  18541.         case Kind(Root) is
  18542.           when CALL_STMKind => Scan_CALL_STM(Root);
  18543.           when SELECTIVE_ENTRY_STMKind => Scan_SELECTIVE_ENTRY_STM(Root);
  18544.           when abort_stmKind => Scan_abort_stm(Root);
  18545.           when accept_stmKind => Scan_accept_stm(Root);
  18546.           when assign_stmKind => Scan_assign_stm(Root);
  18547.           when block_stmKind => Scan_block_stm(Root);
  18548.           when case_stmKind => Scan_case_stm(Root);
  18549.           when code_stmKind => Scan_code_stm(Root);
  18550.           when delay_stmKind => Scan_delay_stm(Root);
  18551.           when exit_stmKind => Scan_exit_stm(Root);
  18552.           when goto_stmKind => Scan_goto_stm(Root);
  18553.           when if_stmKind => Scan_if_stm(Root);
  18554.           when labeled_stmKind => Scan_labeled_stm(Root);
  18555.           when loop_stmKind => Scan_loop_stm(Root);
  18556.           when null_stmKind => Scan_null_stm(Root);
  18557.           when pragma_stmKind => Scan_pragma_stm(Root);
  18558.           when raise_stmKind => Scan_raise_stm(Root);
  18559.           when return_stmKind => Scan_return_stm(Root);
  18560.           when select_stmKind => Scan_select_stm(Root);
  18561.           when terminate_stmKind => Scan_terminate_stm(Root);
  18562.           when others => null;
  18563.         end case;
  18564.     end Scan_STM;
  18565.      
  18566.      
  18567.     procedure Scan_CALL_STM(Root : CALL_STM.Locator) is
  18568.     begin
  18569.         case Kind(Root) is
  18570.           when apply_call_stmKind => Scan_apply_call_stm(Root);
  18571.           when entry_call_stmKind => Scan_entry_call_stm(Root);
  18572.           when proc_call_stmKind => Scan_proc_call_stm(Root);
  18573.           when others => null;
  18574.         end case;
  18575.     end Scan_CALL_STM;
  18576.      
  18577.      
  18578.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator) is
  18579.     begin
  18580.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18581.         Scan_NAME_EXP(as_call_name(Root));
  18582.       end if;
  18583.      
  18584.         if  Kind(root) not in labeled_stmKind
  18585.         then
  18586.      
  18587.         if (not (Kind (root) in block_stmKind))
  18588.             or else
  18589.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18590.             then
  18591.      
  18592.               -- If the root is not a block_stm or if it is then
  18593.               -- if it is not a block with declarations increment
  18594.               -- semicolon.
  18595.               -- This is because the semicolon associated with a declare
  18596.               -- block must be counted in that declare block. If we
  18597.               -- counted it here it would increment the count for the
  18598.               -- enclosing block.
  18599.          IncrementToken (semicolonz);
  18600.       end if;
  18601.      
  18602.         end if;
  18603.      
  18604.     end Scan_apply_call_stm;
  18605.      
  18606.      
  18607.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator) is
  18608.     begin
  18609.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18610.         Scan_NAME_EXP(as_call_name(Root));
  18611.       end if;
  18612.      
  18613.         if  Kind(root) not in labeled_stmKind
  18614.         then
  18615.      
  18616.         if (not (Kind (root) in block_stmKind))
  18617.             or else
  18618.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18619.             then
  18620.      
  18621.               -- If the root is not a block_stm or if it is then
  18622.               -- if it is not a block with declarations increment
  18623.               -- semicolon.
  18624.               -- This is because the semicolon associated with a declare
  18625.               -- block must be counted in that declare block. If we
  18626.               -- counted it here it would increment the count for the
  18627.               -- enclosing block.
  18628.          IncrementToken (semicolonz);
  18629.       end if;
  18630.      
  18631.         end if;
  18632.      
  18633.     end Scan_entry_call_stm;
  18634.      
  18635.      
  18636.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator) is
  18637.     begin
  18638.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18639.         Scan_NAME_EXP(as_call_name(Root));
  18640.       end if;
  18641.      
  18642.         if  Kind(root) not in labeled_stmKind
  18643.         then
  18644.      
  18645.         if (not (Kind (root) in block_stmKind))
  18646.             or else
  18647.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18648.             then
  18649.      
  18650.               -- If the root is not a block_stm or if it is then
  18651.               -- if it is not a block with declarations increment
  18652.               -- semicolon.
  18653.               -- This is because the semicolon associated with a declare
  18654.               -- block must be counted in that declare block. If we
  18655.               -- counted it here it would increment the count for the
  18656.               -- enclosing block.
  18657.          IncrementToken (semicolonz);
  18658.       end if;
  18659.      
  18660.         end if;
  18661.      
  18662.     end Scan_proc_call_stm;
  18663.      
  18664.      
  18665.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator) is
  18666.     begin
  18667.         case Kind(Root) is
  18668.           when cond_entry_stmKind => Scan_cond_entry_stm(Root);
  18669.           when timed_entry_stmKind => Scan_timed_entry_stm(Root);
  18670.           when others => null;
  18671.         end case;
  18672.     end Scan_SELECTIVE_ENTRY_STM;
  18673.      
  18674.      
  18675.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator) is
  18676.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  18677.         as_sel_entry_stm_s1_Item : STM.Locator;
  18678.         use SeqOfSTM;
  18679.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  18680.         as_sel_entry_stm_s2_Item : STM.Locator;
  18681.         use SeqOfSTM;
  18682.     begin
  18683.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  18684.      
  18685.      
  18686.      IncrementToken (selectz);
  18687.      
  18688.      
  18689.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  18690.         while not Finished(as_sel_entry_stm_s1_List) loop
  18691.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  18692.             Scan_STM(as_sel_entry_stm_s1_Item);
  18693.             Forward(as_sel_entry_stm_s1_List);
  18694.         end loop;
  18695.         EndIterate(as_sel_entry_stm_s1_List);
  18696.       end if;
  18697.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  18698.      
  18699.      
  18700.      IncrementToken (elsez);
  18701.      
  18702.      
  18703.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  18704.         while not Finished(as_sel_entry_stm_s2_List) loop
  18705.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  18706.             Scan_STM(as_sel_entry_stm_s2_Item);
  18707.             Forward(as_sel_entry_stm_s2_List);
  18708.         end loop;
  18709.         EndIterate(as_sel_entry_stm_s2_List);
  18710.      
  18711.      
  18712.      IncrementToken (end_selectz);
  18713.      IncrementToken (selectz);
  18714.      
  18715.      
  18716.       end if;
  18717.      
  18718.         if  Kind(root) not in labeled_stmKind
  18719.         then
  18720.      
  18721.         if (not (Kind (root) in block_stmKind))
  18722.             or else
  18723.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18724.             then
  18725.      
  18726.               -- If the root is not a block_stm or if it is then
  18727.               -- if it is not a block with declarations increment
  18728.               -- semicolon.
  18729.               -- This is because the semicolon associated with a declare
  18730.               -- block must be counted in that declare block. If we
  18731.               -- counted it here it would increment the count for the
  18732.               -- enclosing block.
  18733.          IncrementToken (semicolonz);
  18734.       end if;
  18735.      
  18736.         end if;
  18737.      
  18738.     end Scan_cond_entry_stm;
  18739.      
  18740.      
  18741.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator) is
  18742.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  18743.         as_sel_entry_stm_s1_Item : STM.Locator;
  18744.         use SeqOfSTM;
  18745.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  18746.         as_sel_entry_stm_s2_Item : STM.Locator;
  18747.         use SeqOfSTM;
  18748.     begin
  18749.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  18750.      
  18751.      
  18752.      IncrementToken (selectz);
  18753.      
  18754.      
  18755.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  18756.         while not Finished(as_sel_entry_stm_s1_List) loop
  18757.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  18758.             Scan_STM(as_sel_entry_stm_s1_Item);
  18759.             Forward(as_sel_entry_stm_s1_List);
  18760.         end loop;
  18761.         EndIterate(as_sel_entry_stm_s1_List);
  18762.       end if;
  18763.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  18764.      
  18765.      
  18766.      IncrementToken (or_selectz);
  18767.      
  18768.      
  18769.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  18770.         while not Finished(as_sel_entry_stm_s2_List) loop
  18771.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  18772.             Scan_STM(as_sel_entry_stm_s2_Item);
  18773.             Forward(as_sel_entry_stm_s2_List);
  18774.         end loop;
  18775.         EndIterate(as_sel_entry_stm_s2_List);
  18776.      
  18777.      
  18778.      IncrementToken (end_selectz);
  18779.      IncrementToken (selectz);
  18780.      
  18781.      
  18782.       end if;
  18783.      
  18784.         if  Kind(root) not in labeled_stmKind
  18785.         then
  18786.      
  18787.         if (not (Kind (root) in block_stmKind))
  18788.             or else
  18789.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18790.             then
  18791.      
  18792.               -- If the root is not a block_stm or if it is then
  18793.               -- if it is not a block with declarations increment
  18794.               -- semicolon.
  18795.               -- This is because the semicolon associated with a declare
  18796.               -- block must be counted in that declare block. If we
  18797.               -- counted it here it would increment the count for the
  18798.               -- enclosing block.
  18799.          IncrementToken (semicolonz);
  18800.       end if;
  18801.      
  18802.         end if;
  18803.      
  18804.     end Scan_timed_entry_stm;
  18805.      
  18806.      
  18807.     procedure Scan_abort_stm(Root : abort_stmNode.Locator) is
  18808.         as_abort_name_s_List : SeqOfNAME_EXP.Generator;
  18809.         as_abort_name_s_Item : NAME_EXP.Locator;
  18810.         use SeqOfNAME_EXP;
  18811.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  18812.     begin
  18813.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  18814.      
  18815.      
  18816.        IncrementToken (abortz);
  18817.      
  18818.      
  18819.       if not SeqOfNAME_EXP.IsNull(as_abort_name_s(Root)) then
  18820.         StartForward(as_abort_name_s(Root), as_abort_name_s_List);
  18821.         while not Finished(as_abort_name_s_List) loop
  18822.             as_abort_name_s_Item := Cell(as_abort_name_s_List);
  18823.      
  18824.      
  18825.        if SERIES_UNIT_IH.R.ih_inlist then
  18826.            IncrementToken (commaz);
  18827.        end if;
  18828.        SERIES_UNIT_IH.R.ih_inlist := true;
  18829.      
  18830.      
  18831.             Scan_NAME_EXP(as_abort_name_s_Item);
  18832.             Forward(as_abort_name_s_List);
  18833.         end loop;
  18834.         EndIterate(as_abort_name_s_List);
  18835.       end if;
  18836.      
  18837.      
  18838.        SERIES_UNIT_IH.R.ih_inlist := false;
  18839.      
  18840.      
  18841.      
  18842.         if  Kind(root) not in labeled_stmKind
  18843.         then
  18844.      
  18845.         if (not (Kind (root) in block_stmKind))
  18846.             or else
  18847.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18848.             then
  18849.      
  18850.               -- If the root is not a block_stm or if it is then
  18851.               -- if it is not a block with declarations increment
  18852.               -- semicolon.
  18853.               -- This is because the semicolon associated with a declare
  18854.               -- block must be counted in that declare block. If we
  18855.               -- counted it here it would increment the count for the
  18856.               -- enclosing block.
  18857.          IncrementToken (semicolonz);
  18858.       end if;
  18859.      
  18860.         end if;
  18861.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  18862.      
  18863.     end Scan_abort_stm;
  18864.      
  18865.      
  18866.     procedure Scan_accept_stm(Root : accept_stmNode.Locator) is
  18867.         as_accept_stm_s_List : SeqOfSTM.Generator;
  18868.         as_accept_stm_s_Item : STM.Locator;
  18869.         use SeqOfSTM;
  18870.     begin
  18871.      
  18872.      
  18873.        IncrementToken (acceptz);
  18874.      
  18875.      
  18876.       if not NAME_EXP.IsNull(as_accept_designator(Root)) then
  18877.         Scan_NAME_EXP(as_accept_designator(Root));
  18878.       end if;
  18879.       if not accept_specNode.IsNull(as_accept_spec(Root)) then
  18880.         Scan_accept_spec(as_accept_spec(Root));
  18881.       end if;
  18882.       if not SeqOfSTM.IsNull(as_accept_stm_s(Root)) then
  18883.      
  18884.      
  18885.        IncrementToken (doz);
  18886.        IncrementToken (end_acceptz);
  18887.      
  18888.      
  18889.         StartForward(as_accept_stm_s(Root), as_accept_stm_s_List);
  18890.         while not Finished(as_accept_stm_s_List) loop
  18891.             as_accept_stm_s_Item := Cell(as_accept_stm_s_List);
  18892.             Scan_STM(as_accept_stm_s_Item);
  18893.             Forward(as_accept_stm_s_List);
  18894.         end loop;
  18895.         EndIterate(as_accept_stm_s_List);
  18896.       end if;
  18897.      
  18898.         if  Kind(root) not in labeled_stmKind
  18899.         then
  18900.      
  18901.         if (not (Kind (root) in block_stmKind))
  18902.             or else
  18903.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18904.             then
  18905.      
  18906.               -- If the root is not a block_stm or if it is then
  18907.               -- if it is not a block with declarations increment
  18908.               -- semicolon.
  18909.               -- This is because the semicolon associated with a declare
  18910.               -- block must be counted in that declare block. If we
  18911.               -- counted it here it would increment the count for the
  18912.               -- enclosing block.
  18913.          IncrementToken (semicolonz);
  18914.       end if;
  18915.      
  18916.         end if;
  18917.      
  18918.     end Scan_accept_stm;
  18919.      
  18920.      
  18921.     procedure Scan_assign_stm(Root : assign_stmNode.Locator) is
  18922.     begin
  18923.      
  18924.      
  18925.   IncrementToken (colon_equalsz);
  18926.      
  18927.      
  18928.       if not NAME_EXP.IsNull(as_assign_name(Root)) then
  18929.         Scan_NAME_EXP(as_assign_name(Root));
  18930.       end if;
  18931.       if not NAME_EXP.IsNull(as_assign_exp(Root)) then
  18932.         Scan_NAME_EXP(as_assign_exp(Root));
  18933.       end if;
  18934.      
  18935.         if  Kind(root) not in labeled_stmKind
  18936.         then
  18937.      
  18938.         if (not (Kind (root) in block_stmKind))
  18939.             or else
  18940.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18941.             then
  18942.      
  18943.               -- If the root is not a block_stm or if it is then
  18944.               -- if it is not a block with declarations increment
  18945.               -- semicolon.
  18946.               -- This is because the semicolon associated with a declare
  18947.               -- block must be counted in that declare block. If we
  18948.               -- counted it here it would increment the count for the
  18949.               -- enclosing block.
  18950.          IncrementToken (semicolonz);
  18951.       end if;
  18952.      
  18953.         end if;
  18954.      
  18955.     end Scan_assign_stm;
  18956.      
  18957.      
  18958.     procedure Scan_block_stm(Root : block_stmNode.Locator) is
  18959.         Old_block_stm_IHR : block_stm_IH.RecType := block_stm_IH.R;
  18960.     begin
  18961.         block_stm_IH.R.ih_inblock :=  false ;
  18962.       if not block_idNode.IsNull(as_block_label(Root)) then
  18963.         Scan_block_id(as_block_label(Root));
  18964.       end if;
  18965.       if not body_blockNode.IsNull(as_block_body(Root)) then
  18966.      
  18967.      
  18968.    if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  18969.        block_stm_IH.R.ih_inblock := true;
  18970.        if not OuterMostBlockSeen then
  18971.            OuterMostBlockSeen := true;
  18972.        else
  18973.            BlockInfoStack.Push (BlockStack, CurrentBlock);
  18974.            CurrentBlock := InitializeCurrentBlock;
  18975.        end if;
  18976.        if Block_Utilities.Is_Block_Labeled (root) then
  18977.              -- Count : which is associated with the block name
  18978.              -- here.   At this point we know we have a label id and
  18979.              -- the colon adds to the complexity of the declare block.
  18980.            SetBlockId (
  18981.                        lx_symrep (as_block_label (root)),
  18982.                        declare_block,
  18983.                        DecId,
  18984.                        LineNumber (lx_srcpos (root))
  18985.                       );
  18986.        else
  18987.            SetBlockId (
  18988.                        TOKEN.NullRef,
  18989.                        declare_block,
  18990.                        DecId,
  18991.                        LineNumber (lx_srcpos (root))
  18992.                       );
  18993.        end if;
  18994.   end if;
  18995.      -- This next check is made regardless of whether we are in
  18996.      -- a block_stm with declarations or one without declarations.  If
  18997.      -- the block has a name then it has a colon.
  18998.      
  18999.   if Block_Utilities.Is_Block_Labeled (root) then
  19000.      IncrementToken (colonz);
  19001.   end if;
  19002.      
  19003.      
  19004.         Scan_body_block(as_block_body(Root));
  19005.       end if;
  19006.      
  19007.      
  19008.      if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  19009.          IncrementToken (semicolonz);
  19010.          ProcessBlockInfo (CurrentBlock);
  19011.          FreeSpace (CurrentBlock);
  19012.          BlockInfoStack.Pop(BlockStack, CurrentBlock);
  19013.          IncrementToken (declare_blockz);
  19014.      end if;
  19015.      block_stm_IH.R.ih_inblock := false;
  19016.      
  19017.      
  19018.      
  19019.         if  Kind(root) not in labeled_stmKind
  19020.         then
  19021.      
  19022.         if (not (Kind (root) in block_stmKind))
  19023.             or else
  19024.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19025.             then
  19026.      
  19027.               -- If the root is not a block_stm or if it is then
  19028.               -- if it is not a block with declarations increment
  19029.               -- semicolon.
  19030.               -- This is because the semicolon associated with a declare
  19031.               -- block must be counted in that declare block. If we
  19032.               -- counted it here it would increment the count for the
  19033.               -- enclosing block.
  19034.          IncrementToken (semicolonz);
  19035.       end if;
  19036.      
  19037.         end if;
  19038.         block_stm_IH.R := Old_block_stm_IHR;
  19039.      
  19040.     end Scan_block_stm;
  19041.      
  19042.      
  19043.     procedure Scan_case_stm(Root : case_stmNode.Locator) is
  19044.         as_case_alternative_s_List : SeqOfcase_alternativeNode.Generator;
  19045.         as_case_alternative_s_Item : case_alternativeNode.Locator;
  19046.         use SeqOfcase_alternativeNode;
  19047.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  19048.     begin
  19049.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  19050.      
  19051.      
  19052.       IncrementToken (case_stmz);
  19053.       IncrementToken (case_stmz);
  19054.       IncrementToken (is_case_stmz);
  19055.       IncrementToken (end_case_stmz);
  19056.      
  19057.      
  19058.       if not NAME_EXP.IsNull(as_case_exp(Root)) then
  19059.         Scan_NAME_EXP(as_case_exp(Root));
  19060.       end if;
  19061.       if not SeqOfcase_alternativeNode.IsNull(as_case_alternative_s(Root)) then
  19062.         StartForward(as_case_alternative_s(Root), as_case_alternative_s_List);
  19063.         while not Finished(as_case_alternative_s_List) loop
  19064.             as_case_alternative_s_Item := Cell(as_case_alternative_s_List);
  19065.             Scan_case_alternative(as_case_alternative_s_Item);
  19066.             Forward(as_case_alternative_s_List);
  19067.         end loop;
  19068.         EndIterate(as_case_alternative_s_List);
  19069.       end if;
  19070.      
  19071.         if  Kind(root) not in labeled_stmKind
  19072.         then
  19073.      
  19074.         if (not (Kind (root) in block_stmKind))
  19075.             or else
  19076.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19077.             then
  19078.      
  19079.               -- If the root is not a block_stm or if it is then
  19080.               -- if it is not a block with declarations increment
  19081.               -- semicolon.
  19082.               -- This is because the semicolon associated with a declare
  19083.               -- block must be counted in that declare block. If we
  19084.               -- counted it here it would increment the count for the
  19085.               -- enclosing block.
  19086.          IncrementToken (semicolonz);
  19087.       end if;
  19088.      
  19089.         end if;
  19090.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  19091.      
  19092.     end Scan_case_stm;
  19093.      
  19094.      
  19095.     procedure Scan_code_stm(Root : code_stmNode.Locator) is
  19096.     begin
  19097.       if not qualifiedNode.IsNull(as_code_exp(Root)) then
  19098.         Scan_qualified(as_code_exp(Root));
  19099.       end if;
  19100.      
  19101.         if  Kind(root) not in labeled_stmKind
  19102.         then
  19103.      
  19104.         if (not (Kind (root) in block_stmKind))
  19105.             or else
  19106.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19107.             then
  19108.      
  19109.               -- If the root is not a block_stm or if it is then
  19110.               -- if it is not a block with declarations increment
  19111.               -- semicolon.
  19112.               -- This is because the semicolon associated with a declare
  19113.               -- block must be counted in that declare block. If we
  19114.               -- counted it here it would increment the count for the
  19115.               -- enclosing block.
  19116.          IncrementToken (semicolonz);
  19117.       end if;
  19118.      
  19119.         end if;
  19120.      
  19121.     end Scan_code_stm;
  19122.      
  19123.      
  19124.     procedure Scan_delay_stm(Root : delay_stmNode.Locator) is
  19125.     begin
  19126.      
  19127.      
  19128.        IncrementToken (delayz);
  19129.      
  19130.      
  19131.       if not NAME_EXP.IsNull(as_delay_exp(Root)) then
  19132.         Scan_NAME_EXP(as_delay_exp(Root));
  19133.       end if;
  19134.      
  19135.         if  Kind(root) not in labeled_stmKind
  19136.         then
  19137.      
  19138.         if (not (Kind (root) in block_stmKind))
  19139.             or else
  19140.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19141.             then
  19142.      
  19143.               -- If the root is not a block_stm or if it is then
  19144.               -- if it is not a block with declarations increment
  19145.               -- semicolon.
  19146.               -- This is because the semicolon associated with a declare
  19147.               -- block must be counted in that declare block. If we
  19148.               -- counted it here it would increment the count for the
  19149.               -- enclosing block.
  19150.          IncrementToken (semicolonz);
  19151.       end if;
  19152.      
  19153.         end if;
  19154.      
  19155.     end Scan_delay_stm;
  19156.      
  19157.      
  19158.     procedure Scan_exit_stm(Root : exit_stmNode.Locator) is
  19159.     begin
  19160.      
  19161.      
  19162.       IncrementToken (exitz);
  19163.      
  19164.      
  19165.       if not NAME_EXP.IsNull(as_exit_name_void(Root)) then
  19166.         Scan_NAME_EXP(as_exit_name_void(Root));
  19167.       end if;
  19168.       if not NAME_EXP.IsNull(as_exit_exp_void(Root)) then
  19169.      
  19170.      
  19171.       IncrementToken (when_exitz);
  19172.      
  19173.      
  19174.         Scan_NAME_EXP(as_exit_exp_void(Root));
  19175.       end if;
  19176.      
  19177.         if  Kind(root) not in labeled_stmKind
  19178.         then
  19179.      
  19180.         if (not (Kind (root) in block_stmKind))
  19181.             or else
  19182.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19183.             then
  19184.      
  19185.               -- If the root is not a block_stm or if it is then
  19186.               -- if it is not a block with declarations increment
  19187.               -- semicolon.
  19188.               -- This is because the semicolon associated with a declare
  19189.               -- block must be counted in that declare block. If we
  19190.               -- counted it here it would increment the count for the
  19191.               -- enclosing block.
  19192.          IncrementToken (semicolonz);
  19193.       end if;
  19194.      
  19195.         end if;
  19196.      
  19197.     end Scan_exit_stm;
  19198.      
  19199.      
  19200.     procedure Scan_goto_stm(Root : goto_stmNode.Locator) is
  19201.     begin
  19202.      
  19203.      
  19204.     IncrementToken (gotoz);
  19205.      
  19206.      
  19207.       if not NAME_EXP.IsNull(as_goto_name(Root)) then
  19208.         Scan_NAME_EXP(as_goto_name(Root));
  19209.       end if;
  19210.      
  19211.         if  Kind(root) not in labeled_stmKind
  19212.         then
  19213.      
  19214.         if (not (Kind (root) in block_stmKind))
  19215.             or else
  19216.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19217.             then
  19218.      
  19219.               -- If the root is not a block_stm or if it is then
  19220.               -- if it is not a block with declarations increment
  19221.               -- semicolon.
  19222.               -- This is because the semicolon associated with a declare
  19223.               -- block must be counted in that declare block. If we
  19224.               -- counted it here it would increment the count for the
  19225.               -- enclosing block.
  19226.          IncrementToken (semicolonz);
  19227.       end if;
  19228.      
  19229.         end if;
  19230.      
  19231.     end Scan_goto_stm;
  19232.      
  19233.      
  19234.     procedure Scan_if_stm(Root : if_stmNode.Locator) is
  19235.         as_if_list_List : SeqOfcond_alternativeNode.Generator;
  19236.         as_if_list_Item : cond_alternativeNode.Locator;
  19237.         use SeqOfcond_alternativeNode;
  19238.     begin
  19239.      
  19240.      
  19241.       IncrementToken (ifz);
  19242.       IncrementToken (ifz);
  19243.       IncrementToken (end_ifz);
  19244.      
  19245.      
  19246.       if not SeqOfcond_alternativeNode.IsNull(as_if_list(Root)) then
  19247.         StartForward(as_if_list(Root), as_if_list_List);
  19248.         while not Finished(as_if_list_List) loop
  19249.             as_if_list_Item := Cell(as_if_list_List);
  19250.             Scan_cond_alternative(as_if_list_Item);
  19251.             Forward(as_if_list_List);
  19252.         end loop;
  19253.         EndIterate(as_if_list_List);
  19254.       end if;
  19255.      
  19256.         if  Kind(root) not in labeled_stmKind
  19257.         then
  19258.      
  19259.         if (not (Kind (root) in block_stmKind))
  19260.             or else
  19261.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19262.             then
  19263.      
  19264.               -- If the root is not a block_stm or if it is then
  19265.               -- if it is not a block with declarations increment
  19266.               -- semicolon.
  19267.               -- This is because the semicolon associated with a declare
  19268.               -- block must be counted in that declare block. If we
  19269.               -- counted it here it would increment the count for the
  19270.               -- enclosing block.
  19271.          IncrementToken (semicolonz);
  19272.       end if;
  19273.      
  19274.         end if;
  19275.      
  19276.     end Scan_if_stm;
  19277.      
  19278.      
  19279.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator) is
  19280.         as_labeled_id_s_List : SeqOflabel_idNode.Generator;
  19281.         as_labeled_id_s_Item : label_idNode.Locator;
  19282.         use SeqOflabel_idNode;
  19283.     begin
  19284.      
  19285.      
  19286.       IncrementToken (open_anglesz);
  19287.      
  19288.      
  19289.       if not SeqOflabel_idNode.IsNull(as_labeled_id_s(Root)) then
  19290.         StartForward(as_labeled_id_s(Root), as_labeled_id_s_List);
  19291.         while not Finished(as_labeled_id_s_List) loop
  19292.             as_labeled_id_s_Item := Cell(as_labeled_id_s_List);
  19293.      
  19294.      
  19295.       if SERIES_UNIT_IH.R.ih_inlist then
  19296.           IncrementToken (open_anglesz);
  19297.           IncrementToken (closed_anglesz);
  19298.       end if;
  19299.       SERIES_UNIT_IH.R.ih_inlist := true;
  19300.      
  19301.      
  19302.             Scan_label_id(as_labeled_id_s_Item);
  19303.             Forward(as_labeled_id_s_List);
  19304.         end loop;
  19305.         EndIterate(as_labeled_id_s_List);
  19306.       end if;
  19307.       if not STM.IsNull(as_labeled_stm(Root)) then
  19308.         Scan_STM(as_labeled_stm(Root));
  19309.       end if;
  19310.      
  19311.      
  19312.       IncrementToken (closed_anglesz);
  19313.       SERIES_UNIT_IH.R.ih_inlist := false;
  19314.      
  19315.      
  19316.      
  19317.         if  Kind(root) not in labeled_stmKind
  19318.         then
  19319.      
  19320.         if (not (Kind (root) in block_stmKind))
  19321.             or else
  19322.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19323.             then
  19324.      
  19325.               -- If the root is not a block_stm or if it is then
  19326.               -- if it is not a block with declarations increment
  19327.               -- semicolon.
  19328.               -- This is because the semicolon associated with a declare
  19329.               -- block must be counted in that declare block. If we
  19330.               -- counted it here it would increment the count for the
  19331.               -- enclosing block.
  19332.          IncrementToken (semicolonz);
  19333.       end if;
  19334.      
  19335.         end if;
  19336.      
  19337.     end Scan_labeled_stm;
  19338.      
  19339.      
  19340.     procedure Scan_loop_stm(Root : loop_stmNode.Locator) is
  19341.         as_loop_stm_s_List : SeqOfSTM.Generator;
  19342.         as_loop_stm_s_Item : STM.Locator;
  19343.         use SeqOfSTM;
  19344.     begin
  19345.      
  19346.      
  19347.       IncrementToken (loopz);
  19348.       IncrementToken (loopz);
  19349.       IncrementToken (end_loopz);
  19350.      
  19351.      
  19352.       if not ITERATION.IsNull(as_iteration(Root)) then
  19353.         Scan_ITERATION(as_iteration(Root));
  19354.       end if;
  19355.       if not loop_idNode.IsNull(as_loop_label(Root)) then
  19356.         Scan_loop_id(as_loop_label(Root));
  19357.       end if;
  19358.       if not SeqOfSTM.IsNull(as_loop_stm_s(Root)) then
  19359.         StartForward(as_loop_stm_s(Root), as_loop_stm_s_List);
  19360.         while not Finished(as_loop_stm_s_List) loop
  19361.             as_loop_stm_s_Item := Cell(as_loop_stm_s_List);
  19362.             Scan_STM(as_loop_stm_s_Item);
  19363.             Forward(as_loop_stm_s_List);
  19364.         end loop;
  19365.         EndIterate(as_loop_stm_s_List);
  19366.       end if;
  19367.      
  19368.         if  Kind(root) not in labeled_stmKind
  19369.         then
  19370.      
  19371.         if (not (Kind (root) in block_stmKind))
  19372.             or else
  19373.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19374.             then
  19375.      
  19376.               -- If the root is not a block_stm or if it is then
  19377.               -- if it is not a block with declarations increment
  19378.               -- semicolon.
  19379.               -- This is because the semicolon associated with a declare
  19380.               -- block must be counted in that declare block. If we
  19381.               -- counted it here it would increment the count for the
  19382.               -- enclosing block.
  19383.          IncrementToken (semicolonz);
  19384.       end if;
  19385.      
  19386.         end if;
  19387.      
  19388.     end Scan_loop_stm;
  19389.      
  19390.      
  19391.     procedure Scan_null_stm(Root : null_stmNode.Locator) is
  19392.     begin
  19393.      
  19394.      
  19395.       IncrementToken (null_stmz);
  19396.      
  19397.      
  19398.      
  19399.         if  Kind(root) not in labeled_stmKind
  19400.         then
  19401.      
  19402.         if (not (Kind (root) in block_stmKind))
  19403.             or else
  19404.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19405.             then
  19406.      
  19407.               -- If the root is not a block_stm or if it is then
  19408.               -- if it is not a block with declarations increment
  19409.               -- semicolon.
  19410.               -- This is because the semicolon associated with a declare
  19411.               -- block must be counted in that declare block. If we
  19412.               -- counted it here it would increment the count for the
  19413.               -- enclosing block.
  19414.          IncrementToken (semicolonz);
  19415.       end if;
  19416.      
  19417.         end if;
  19418.      
  19419.     end Scan_null_stm;
  19420.      
  19421.      
  19422.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator) is
  19423.     begin
  19424.       if not pragma_declNode.IsNull(as_pragma(Root)) then
  19425.         Scan_pragma_decl(as_pragma(Root));
  19426.       end if;
  19427.      
  19428.         if  Kind(root) not in labeled_stmKind
  19429.         then
  19430.      
  19431.         if (not (Kind (root) in block_stmKind))
  19432.             or else
  19433.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19434.             then
  19435.      
  19436.               -- If the root is not a block_stm or if it is then
  19437.               -- if it is not a block with declarations increment
  19438.               -- semicolon.
  19439.               -- This is because the semicolon associated with a declare
  19440.               -- block must be counted in that declare block. If we
  19441.               -- counted it here it would increment the count for the
  19442.               -- enclosing block.
  19443.          IncrementToken (semicolonz);
  19444.       end if;
  19445.      
  19446.         end if;
  19447.      
  19448.     end Scan_pragma_stm;
  19449.      
  19450.      
  19451.     procedure Scan_raise_stm(Root : raise_stmNode.Locator) is
  19452.     begin
  19453.      
  19454.      
  19455.       IncrementToken (raisez);
  19456.      
  19457.      
  19458.       if not NAME_EXP.IsNull(as_raise_name_void(Root)) then
  19459.         Scan_NAME_EXP(as_raise_name_void(Root));
  19460.       end if;
  19461.      
  19462.         if  Kind(root) not in labeled_stmKind
  19463.         then
  19464.      
  19465.         if (not (Kind (root) in block_stmKind))
  19466.             or else
  19467.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19468.             then
  19469.      
  19470.               -- If the root is not a block_stm or if it is then
  19471.               -- if it is not a block with declarations increment
  19472.               -- semicolon.
  19473.               -- This is because the semicolon associated with a declare
  19474.               -- block must be counted in that declare block. If we
  19475.               -- counted it here it would increment the count for the
  19476.               -- enclosing block.
  19477.          IncrementToken (semicolonz);
  19478.       end if;
  19479.      
  19480.         end if;
  19481.      
  19482.     end Scan_raise_stm;
  19483.      
  19484.      
  19485.     procedure Scan_return_stm(Root : return_stmNode.Locator) is
  19486.     begin
  19487.      
  19488.      
  19489.       IncrementToken (returnz);
  19490.      
  19491.      
  19492.       if not NAME_EXP.IsNull(as_return_exp_void(Root)) then
  19493.         Scan_NAME_EXP(as_return_exp_void(Root));
  19494.       end if;
  19495.      
  19496.         if  Kind(root) not in labeled_stmKind
  19497.         then
  19498.      
  19499.         if (not (Kind (root) in block_stmKind))
  19500.             or else
  19501.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19502.             then
  19503.      
  19504.               -- If the root is not a block_stm or if it is then
  19505.               -- if it is not a block with declarations increment
  19506.               -- semicolon.
  19507.               -- This is because the semicolon associated with a declare
  19508.               -- block must be counted in that declare block. If we
  19509.               -- counted it here it would increment the count for the
  19510.               -- enclosing block.
  19511.          IncrementToken (semicolonz);
  19512.       end if;
  19513.      
  19514.         end if;
  19515.      
  19516.     end Scan_return_stm;
  19517.      
  19518.      
  19519.     procedure Scan_select_stm(Root : select_stmNode.Locator) is
  19520.         as_select_clause_s_List : SeqOfselect_alternativeNode.Generator;
  19521.         as_select_clause_s_Item : select_alternativeNode.Locator;
  19522.         use SeqOfselect_alternativeNode;
  19523.     begin
  19524.      
  19525.      
  19526.       IncrementToken (selectz);
  19527.       IncrementToken (selectz);
  19528.       IncrementToken (end_selectz);
  19529.      
  19530.      
  19531.       if not SeqOfselect_alternativeNode.IsNull(as_select_clause_s(Root)) then
  19532.         StartForward(as_select_clause_s(Root), as_select_clause_s_List);
  19533.         while not Finished(as_select_clause_s_List) loop
  19534.             as_select_clause_s_Item := Cell(as_select_clause_s_List);
  19535.      
  19536.      
  19537.      if SERIES_UNIT_IH.R.ih_inlist then
  19538.         IncrementToken (or_selectz);
  19539.      end if;
  19540.      SERIES_UNIT_IH.R.ih_inlist := true;
  19541.      
  19542.      
  19543.             Scan_select_alternative(as_select_clause_s_Item);
  19544.             Forward(as_select_clause_s_List);
  19545.         end loop;
  19546.         EndIterate(as_select_clause_s_List);
  19547.       end if;
  19548.       if not cond_alternativeNode.IsNull(as_select_else(Root)) then
  19549.         Scan_cond_alternative(as_select_else(Root));
  19550.      
  19551.      
  19552.       IncrementToken (elsez);
  19553.      
  19554.      
  19555.       end if;
  19556.      
  19557.      
  19558.      SERIES_UNIT_IH.R.ih_inlist := false;
  19559.      
  19560.      
  19561.      
  19562.         if  Kind(root) not in labeled_stmKind
  19563.         then
  19564.      
  19565.         if (not (Kind (root) in block_stmKind))
  19566.             or else
  19567.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19568.             then
  19569.      
  19570.               -- If the root is not a block_stm or if it is then
  19571.               -- if it is not a block with declarations increment
  19572.               -- semicolon.
  19573.               -- This is because the semicolon associated with a declare
  19574.               -- block must be counted in that declare block. If we
  19575.               -- counted it here it would increment the count for the
  19576.               -- enclosing block.
  19577.          IncrementToken (semicolonz);
  19578.       end if;
  19579.      
  19580.         end if;
  19581.      
  19582.     end Scan_select_stm;
  19583.      
  19584.      
  19585.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator) is
  19586.     begin
  19587.      
  19588.      
  19589.       IncrementToken (terminatez);
  19590.      
  19591.      
  19592.      
  19593.         if  Kind(root) not in labeled_stmKind
  19594.         then
  19595.      
  19596.         if (not (Kind (root) in block_stmKind))
  19597.             or else
  19598.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19599.             then
  19600.      
  19601.               -- If the root is not a block_stm or if it is then
  19602.               -- if it is not a block with declarations increment
  19603.               -- semicolon.
  19604.               -- This is because the semicolon associated with a declare
  19605.               -- block must be counted in that declare block. If we
  19606.               -- counted it here it would increment the count for the
  19607.               -- enclosing block.
  19608.          IncrementToken (semicolonz);
  19609.       end if;
  19610.      
  19611.         end if;
  19612.      
  19613.     end Scan_terminate_stm;
  19614.      
  19615. end STM_Pkg;
  19616. -- End: SCSTM bdy -----------------------------------------------------
  19617. ::::::::::::::
  19618. scstm.spc
  19619. ::::::::::::::
  19620. -- Begin: SCSTM spc ---------------------------------------------------
  19621.      
  19622. with ST_DIANA; use ST_DIANA;
  19623.              package STM_Pkg is
  19624.     procedure Scan_STM(Root : STM.Locator);
  19625.     procedure Scan_CALL_STM(Root : CALL_STM.Locator);
  19626.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator);
  19627.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator);
  19628.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator);
  19629.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator);
  19630.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator);
  19631.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator);
  19632.     procedure Scan_abort_stm(Root : abort_stmNode.Locator);
  19633.     procedure Scan_accept_stm(Root : accept_stmNode.Locator);
  19634.     procedure Scan_assign_stm(Root : assign_stmNode.Locator);
  19635.     procedure Scan_block_stm(Root : block_stmNode.Locator);
  19636.     procedure Scan_case_stm(Root : case_stmNode.Locator);
  19637.     procedure Scan_code_stm(Root : code_stmNode.Locator);
  19638.     procedure Scan_delay_stm(Root : delay_stmNode.Locator);
  19639.     procedure Scan_exit_stm(Root : exit_stmNode.Locator);
  19640.     procedure Scan_goto_stm(Root : goto_stmNode.Locator);
  19641.     procedure Scan_if_stm(Root : if_stmNode.Locator);
  19642.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator);
  19643.     procedure Scan_loop_stm(Root : loop_stmNode.Locator);
  19644.     procedure Scan_null_stm(Root : null_stmNode.Locator);
  19645.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator);
  19646.     procedure Scan_raise_stm(Root : raise_stmNode.Locator);
  19647.     procedure Scan_return_stm(Root : return_stmNode.Locator);
  19648.     procedure Scan_select_stm(Root : select_stmNode.Locator);
  19649.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator);
  19650. end STM_Pkg;
  19651. -- End: SCSTM spc -----------------------------------------------------
  19652.      
  19653. ::::::::::::::
  19654. scsubp_de.bdy
  19655. ::::::::::::::
  19656. -- Begin: SCSUBP_DEF bdy ---------------------------------------------------
  19657.      
  19658. with Halstead_Data_Base;  use Halstead_Data_Base;
  19659. with Definitions; use Definitions;
  19660.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  19661. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  19662. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  19663. package body SUBP_DEF_Pkg is
  19664.      
  19665.      
  19666.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator) is
  19667.     begin
  19668.         case Kind(Root) is
  19669.           when FORMAL_SUBPKind => Scan_FORMAL_SUBP(Root);
  19670.           when subp_block_stubKind => Scan_subp_block_stub(Root);
  19671.           when subp_instantiationKind => Scan_subp_instantiation(Root);
  19672.           when subp_renameKind => Scan_subp_rename(Root);
  19673.           when others => null;
  19674.         end case;
  19675.     end Scan_SUBP_DEF;
  19676.      
  19677.      
  19678.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator) is
  19679.     begin
  19680.         case Kind(Root) is
  19681.           when formal_subp_boxKind => Scan_formal_subp_box(Root);
  19682.           when formal_subp_nameKind => Scan_formal_subp_name(Root);
  19683.           when others => null;
  19684.         end case;
  19685.     end Scan_FORMAL_SUBP;
  19686.      
  19687.      
  19688.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator) is
  19689.     begin
  19690.      
  19691.      
  19692.       IncrementToken (box_default_subpz);
  19693.      
  19694.      
  19695.      
  19696.     end Scan_formal_subp_box;
  19697.      
  19698.      
  19699.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator) is
  19700.     begin
  19701.      
  19702.      
  19703.      IncrementToken (is_procedurez);
  19704.      
  19705.      
  19706.      
  19707.     end Scan_formal_subp_name;
  19708.      
  19709.      
  19710.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator) is
  19711.     begin
  19712.       if not BLOCK_STUB.IsNull(as_subp_block_stub(Root)) then
  19713.         Scan_BLOCK_STUB(as_subp_block_stub(Root));
  19714.       end if;
  19715.      
  19716.      
  19717.      IncrementToken (semicolonz);
  19718.      
  19719.      
  19720.      
  19721.     end Scan_subp_block_stub;
  19722.      
  19723.      
  19724.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator) is
  19725.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  19726.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  19727.         use SeqOfGENERAL_ASSOC;
  19728.     begin
  19729.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  19730.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  19731.         while not Finished(as_generic_assoc_s_List) loop
  19732.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  19733.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  19734.             Forward(as_generic_assoc_s_List);
  19735.         end loop;
  19736.         EndIterate(as_generic_assoc_s_List);
  19737.       end if;
  19738.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  19739.      
  19740.      
  19741.       IncrementToken (is_procedurez);
  19742.       IncrementToken (new_generic_instz);
  19743.      
  19744.      
  19745.      
  19746.      
  19747.       IncrementToken (open_parenthesisz);
  19748.      
  19749.      
  19750.         Scan_NAME_EXP(as_instantiation_name(Root));
  19751.      
  19752.      
  19753.       IncrementToken (closed_parenthesisz);
  19754.      
  19755.      
  19756.       end if;
  19757.      
  19758.     end Scan_subp_instantiation;
  19759.      
  19760.      
  19761.     procedure Scan_subp_rename(Root : subp_renameNode.Locator) is
  19762.     begin
  19763.      
  19764.      
  19765.        IncrementToken (renamesz);
  19766.      
  19767.      
  19768.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  19769.         Scan_NAME_EXP(as_rename_name(Root));
  19770.       end if;
  19771.      
  19772.     end Scan_subp_rename;
  19773.      
  19774. end SUBP_DEF_Pkg;
  19775. -- End: SCSUBP_DEF bdy -----------------------------------------------------
  19776. ::::::::::::::
  19777. scsubp_de.spc
  19778. ::::::::::::::
  19779. -- Begin: SCSUBP_DEF spc ---------------------------------------------------
  19780.      
  19781. with ST_DIANA; use ST_DIANA;
  19782.              package SUBP_DEF_Pkg is
  19783.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator);
  19784.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator);
  19785.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator);
  19786.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator);
  19787.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator);
  19788.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator);
  19789.     procedure Scan_subp_rename(Root : subp_renameNode.Locator);
  19790. end SUBP_DEF_Pkg;
  19791. -- End: SCSUBP_DEF spc -----------------------------------------------------
  19792. ::::::::::::::
  19793. sctype_sp.bdy
  19794. ::::::::::::::
  19795. -- Begin: SCTYPE_SPEC bdy ---------------------------------------------------
  19796.      
  19797. with Halstead_Data_Base;  use Halstead_Data_Base;
  19798. with Definitions; use Definitions;
  19799.              with SERIES_UNIT_IH;
  19800. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  19801. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  19802. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  19803. with DEF_ID_Pkg; use DEF_ID_Pkg;
  19804. with ITEM_Pkg; use ITEM_Pkg;
  19805.      
  19806.    with task_decl_IH;
  19807.                          package body TYPE_SPEC_Pkg is
  19808.      
  19809.      
  19810.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator) is
  19811.     begin
  19812.         case Kind(Root) is
  19813.           when ARRAY_TYPEKind => Scan_ARRAY_TYPE(Root);
  19814.           when DSCRMT_TYPEKind => Scan_DSCRMT_TYPE(Root);
  19815.           when FORMAL_SCALARKind => Scan_FORMAL_SCALAR(Root);
  19816.           when access_typeKind => Scan_access_type(Root);
  19817.           when derived_typeKind => Scan_derived_type(Root);
  19818.           when enum_typeKind => Scan_enum_type(Root);
  19819.           when fixed_typeKind => Scan_fixed_type(Root);
  19820.           when float_typeKind => Scan_float_type(Root);
  19821.           when integer_typeKind => Scan_integer_type(Root);
  19822.           when task_specKind => Scan_task_spec(Root);
  19823.           when others => null;
  19824.         end case;
  19825.     end Scan_TYPE_SPEC;
  19826.      
  19827.      
  19828.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator) is
  19829.     begin
  19830.         case Kind(Root) is
  19831.           when constrained_array_typeKind => Scan_constrained_array_type(Root);
  19832.           when unconstrained_array_typeKind => Scan_unconstrained_array_type(Root);
  19833.           when others => null;
  19834.         end case;
  19835.     end Scan_ARRAY_TYPE;
  19836.      
  19837.      
  19838.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator) is
  19839.     begin
  19840.      
  19841.      
  19842.       IncrementToken (arrayz);
  19843.      
  19844.      
  19845.       if not index_constraintNode.IsNull(as_array_constraint(Root)) then
  19846.         Scan_index_constraint(as_array_constraint(Root));
  19847.       end if;
  19848.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  19849.      
  19850.      
  19851.      IncrementToken (ofz);
  19852.      
  19853.      
  19854.         Scan_object_type_constrained(as_component_constrained(Root));
  19855.       end if;
  19856.      
  19857.     end Scan_constrained_array_type;
  19858.      
  19859.      
  19860.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator) is
  19861.         as_index_list_List : SeqOfobject_type_indexNode.Generator;
  19862.         as_index_list_Item : object_type_indexNode.Locator;
  19863.         use SeqOfobject_type_indexNode;
  19864.     begin
  19865.      
  19866.      
  19867.       IncrementToken (arrayz);
  19868.      
  19869.      
  19870.       if not SeqOfobject_type_indexNode.IsNull(as_index_list(Root)) then
  19871.      
  19872.      
  19873.       IncrementToken (open_parenthesisz);
  19874.      
  19875.      
  19876.         StartForward(as_index_list(Root), as_index_list_List);
  19877.         while not Finished(as_index_list_List) loop
  19878.             as_index_list_Item := Cell(as_index_list_List);
  19879.      
  19880.      
  19881.       if SERIES_UNIT_IH.R.ih_inlist then
  19882.           IncrementToken (box_rangez);
  19883.           IncrementToken (commaz);
  19884.       end if;
  19885.       SERIES_UNIT_IH.R.ih_inlist := true;
  19886.      
  19887.      
  19888.             Scan_object_type_index(as_index_list_Item);
  19889.             Forward(as_index_list_List);
  19890.         end loop;
  19891.         EndIterate(as_index_list_List);
  19892.      
  19893.      
  19894.      IncrementToken (closed_parenthesisz);
  19895.      IncrementToken (box_rangez);
  19896.      SERIES_UNIT_IH.R.ih_inlist := false;
  19897.      
  19898.      
  19899.       end if;
  19900.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  19901.      
  19902.      
  19903.      IncrementToken (ofz);
  19904.      
  19905.      
  19906.         Scan_object_type_constrained(as_component_constrained(Root));
  19907.       end if;
  19908.      
  19909.     end Scan_unconstrained_array_type;
  19910.      
  19911.      
  19912.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator) is
  19913.     begin
  19914.         case Kind(Root) is
  19915.           when PRIV_TYPEKind => Scan_PRIV_TYPE(Root);
  19916.           when record_typeKind => Scan_record_type(Root);
  19917.           when others => null;
  19918.         end case;
  19919.     end Scan_DSCRMT_TYPE;
  19920.      
  19921.      
  19922.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator) is
  19923.     begin
  19924.         case Kind(Root) is
  19925.           when FORMAL_PRIVKind => Scan_FORMAL_PRIV(Root);
  19926.           when lim_priv_typeKind => Scan_lim_priv_type(Root);
  19927.           when nonlim_priv_typeKind => Scan_nonlim_priv_type(Root);
  19928.           when others => null;
  19929.         end case;
  19930.     end Scan_PRIV_TYPE;
  19931.      
  19932.      
  19933.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator) is
  19934.     begin
  19935.         case Kind(Root) is
  19936.           when generic_lim_priv_typeKind => Scan_generic_lim_priv_type(Root);
  19937.           when generic_priv_typeKind => Scan_generic_priv_type(Root);
  19938.           when others => null;
  19939.         end case;
  19940.     end Scan_FORMAL_PRIV;
  19941.      
  19942.      
  19943.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator) is
  19944.     begin
  19945.      
  19946.      
  19947.      IncrementToken (limitedz);
  19948.      IncrementToken (private_typez);
  19949.      
  19950.      
  19951.      
  19952.     end Scan_generic_lim_priv_type;
  19953.      
  19954.      
  19955.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator) is
  19956.     begin
  19957.      
  19958.      
  19959.      IncrementToken (private_typez);
  19960.      
  19961.      
  19962.      
  19963.     end Scan_generic_priv_type;
  19964.      
  19965.      
  19966.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator) is
  19967.     begin
  19968.      
  19969.      
  19970.     IncrementToken (limitedz);
  19971.     IncrementToken (private_typez);
  19972.      
  19973.      
  19974.      
  19975.     end Scan_lim_priv_type;
  19976.      
  19977.      
  19978.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator) is
  19979.     begin
  19980.      
  19981.      
  19982.     IncrementToken (private_typez);
  19983.      
  19984.      
  19985.      
  19986.     end Scan_nonlim_priv_type;
  19987.      
  19988.      
  19989.     procedure Scan_record_type(Root : record_typeNode.Locator) is
  19990.     begin
  19991.      
  19992.      
  19993.     IncrementToken (record_typez);
  19994.      
  19995.      
  19996.       if not inner_recordNode.IsNull(as_inner_record(Root)) then
  19997.         Scan_inner_record(as_inner_record(Root));
  19998.       end if;
  19999.      
  20000.      
  20001.     IncrementToken (end_recordz);
  20002.     IncrementToken (record_typez);
  20003.      
  20004.      
  20005.      
  20006.     end Scan_record_type;
  20007.      
  20008.      
  20009.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator) is
  20010.     begin
  20011.         case Kind(Root) is
  20012.           when formal_discreteKind => Scan_formal_discrete(Root);
  20013.           when formal_fixedKind => Scan_formal_fixed(Root);
  20014.           when formal_floatKind => Scan_formal_float(Root);
  20015.           when formal_integerKind => Scan_formal_integer(Root);
  20016.           when others => null;
  20017.         end case;
  20018.     end Scan_FORMAL_SCALAR;
  20019.      
  20020.      
  20021.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator) is
  20022.     begin
  20023.      
  20024.      
  20025.          IncrementToken (box_rangez);
  20026.      
  20027.      
  20028.      
  20029.      
  20030.       IncrementToken (open_parenthesisz);
  20031.       IncrementToken (closed_parenthesisz);
  20032.      
  20033.      
  20034.      
  20035.     end Scan_formal_discrete;
  20036.      
  20037.      
  20038.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator) is
  20039.     begin
  20040.      
  20041.      
  20042.          IncrementToken (box_rangez);
  20043.      
  20044.      
  20045.      
  20046.      
  20047.       IncrementToken (digitsz);
  20048.      
  20049.      
  20050.      
  20051.     end Scan_formal_fixed;
  20052.      
  20053.      
  20054.     procedure Scan_formal_float(Root : formal_floatNode.Locator) is
  20055.     begin
  20056.      
  20057.      
  20058.          IncrementToken (box_rangez);
  20059.      
  20060.      
  20061.      
  20062.      
  20063.       IncrementToken (deltaz);
  20064.      
  20065.      
  20066.      
  20067.     end Scan_formal_float;
  20068.      
  20069.      
  20070.     procedure Scan_formal_integer(Root : formal_integerNode.Locator) is
  20071.     begin
  20072.      
  20073.      
  20074.          IncrementToken (box_rangez);
  20075.      
  20076.      
  20077.      
  20078.      
  20079.      
  20080.      
  20081.      
  20082.     end Scan_formal_integer;
  20083.      
  20084.      
  20085.     procedure Scan_access_type(Root : access_typeNode.Locator) is
  20086.     begin
  20087.      
  20088.      
  20089.     IncrementToken (accessz);
  20090.      
  20091.      
  20092.       if not object_type_constrainedNode.IsNull(as_access_constrained(Root)) then
  20093.         Scan_object_type_constrained(as_access_constrained(Root));
  20094.       end if;
  20095.      
  20096.     end Scan_access_type;
  20097.      
  20098.      
  20099.     procedure Scan_derived_type(Root : derived_typeNode.Locator) is
  20100.     begin
  20101.      
  20102.      
  20103.      IncrementToken (new_derived_typez);
  20104.      
  20105.      
  20106.       if not object_type_constrainedNode.IsNull(as_parent_constrained(Root)) then
  20107.         Scan_object_type_constrained(as_parent_constrained(Root));
  20108.       end if;
  20109.      
  20110.     end Scan_derived_type;
  20111.      
  20112.      
  20113.     procedure Scan_enum_type(Root : enum_typeNode.Locator) is
  20114.         as_enumeral_s_List : SeqOfLITERAL_ID.Generator;
  20115.         as_enumeral_s_Item : LITERAL_ID.Locator;
  20116.         use SeqOfLITERAL_ID;
  20117.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  20118.     begin
  20119.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  20120.      
  20121.      
  20122.      IncrementToken (open_parenthesisz);
  20123.      
  20124.      
  20125.         StartForward(as_enumeral_s(Root), as_enumeral_s_List);
  20126.         while not Finished(as_enumeral_s_List) loop
  20127.             as_enumeral_s_Item := Cell(as_enumeral_s_List);
  20128.      
  20129.      
  20130.      if SERIES_UNIT_IH.R.ih_inlist then
  20131.          IncrementToken (commaz);
  20132.      end if;
  20133.      SERIES_UNIT_IH.R.ih_inlist := true;
  20134.      
  20135.      
  20136.             Scan_LITERAL_ID(as_enumeral_s_Item);
  20137.             Forward(as_enumeral_s_List);
  20138.         end loop;
  20139.         EndIterate(as_enumeral_s_List);
  20140.      
  20141.      
  20142.      IncrementToken (closed_parenthesisz);
  20143.      SERIES_UNIT_IH.R.ih_inlist := false;
  20144.      
  20145.      
  20146.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  20147.      
  20148.     end Scan_enum_type;
  20149.      
  20150.      
  20151.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator) is
  20152.     begin
  20153.      
  20154.      
  20155.      IncrementToken (deltaz);
  20156.      
  20157.      
  20158.       if not fixed_constraintNode.IsNull(as_fixed_constraint(Root)) then
  20159.         Scan_fixed_constraint(as_fixed_constraint(Root));
  20160.       end if;
  20161.      
  20162.     end Scan_fixed_type;
  20163.      
  20164.      
  20165.     procedure Scan_float_type(Root : float_typeNode.Locator) is
  20166.     begin
  20167.      
  20168.      
  20169.      IncrementToken (digitsz);
  20170.      
  20171.      
  20172.       if not float_constraintNode.IsNull(as_float_constraint(Root)) then
  20173.         Scan_float_constraint(as_float_constraint(Root));
  20174.       end if;
  20175.      
  20176.     end Scan_float_type;
  20177.      
  20178.      
  20179.     procedure Scan_integer_type(Root : integer_typeNode.Locator) is
  20180.     begin
  20181.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  20182.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  20183.       end if;
  20184.      
  20185.     end Scan_integer_type;
  20186.      
  20187.      
  20188.     procedure Scan_task_spec(Root : task_specNode.Locator) is
  20189.         as_task_spec_decl_s_List : SeqOfITEM.Generator;
  20190.         as_task_spec_decl_s_Item : ITEM.Locator;
  20191.         use SeqOfITEM;
  20192.     begin
  20193.      
  20194.      
  20195.     if not OuterMostBlockSeen then
  20196.         OuterMostBlockSeen := true;
  20197.     else
  20198.         BlockInfoStack.Push(BlockStack, CurrentBlock);
  20199.         CurrentBlock := InitializeCurrentBlock;
  20200.     end if;
  20201.     SetBlockId (lx_symrep (sm_def_of_type (root)),
  20202.                 task_body_block,
  20203.                 SpcId,
  20204.                 LineNumber (lx_srcpos (root))
  20205.                 );
  20206.     if not task_decl_IH.R.ih_intask_decl then
  20207.          -- If we are not in a task_decl and we are scanning task_spec
  20208.          -- then we are in a type_decl and the token type appears.
  20209.      
  20210.        IncrementToken (typez);
  20211.     end if;
  20212.     IncrementToken (task_spcz);
  20213.     IncrementToken (is_task_spcz);
  20214.     IncrementToken (end_task_spcz);
  20215.      
  20216.      
  20217.       if not SeqOfITEM.IsNull(as_task_spec_decl_s(Root)) then
  20218.         StartForward(as_task_spec_decl_s(Root), as_task_spec_decl_s_List);
  20219.         while not Finished(as_task_spec_decl_s_List) loop
  20220.             as_task_spec_decl_s_Item := Cell(as_task_spec_decl_s_List);
  20221.             Scan_ITEM(as_task_spec_decl_s_Item);
  20222.             Forward(as_task_spec_decl_s_List);
  20223.         end loop;
  20224.         EndIterate(as_task_spec_decl_s_List);
  20225.       end if;
  20226.      
  20227.      
  20228.   IncrementToken (semicolonz);
  20229.   ProcessBlockInfo (CurrentBlock);
  20230.   FreeSpace (CurrentBlock);
  20231.   BlockInfoStack.Pop(BlockStack, CurrentBlock);
  20232.      
  20233.      
  20234.      
  20235.     end Scan_task_spec;
  20236.      
  20237. end TYPE_SPEC_Pkg;
  20238. -- End: SCTYPE_SPEC bdy -----------------------------------------------------
  20239. ::::::::::::::
  20240. sctype_sp.spc
  20241. ::::::::::::::
  20242. -- Begin: SCTYPE_SPEC spc ---------------------------------------------------
  20243.      
  20244. with ST_DIANA; use ST_DIANA;
  20245.              package TYPE_SPEC_Pkg is
  20246.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator);
  20247.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator);
  20248.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator);
  20249.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator);
  20250.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator);
  20251.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator);
  20252.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator);
  20253.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator);
  20254.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator);
  20255.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator);
  20256.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator);
  20257.     procedure Scan_record_type(Root : record_typeNode.Locator);
  20258.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator);
  20259.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator);
  20260.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator);
  20261.     procedure Scan_formal_float(Root : formal_floatNode.Locator);
  20262.     procedure Scan_formal_integer(Root : formal_integerNode.Locator);
  20263.     procedure Scan_access_type(Root : access_typeNode.Locator);
  20264.     procedure Scan_derived_type(Root : derived_typeNode.Locator);
  20265.     procedure Scan_enum_type(Root : enum_typeNode.Locator);
  20266.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator);
  20267.     procedure Scan_float_type(Root : float_typeNode.Locator);
  20268.     procedure Scan_integer_type(Root : integer_typeNode.Locator);
  20269.     procedure Scan_task_spec(Root : task_specNode.Locator);
  20270. end TYPE_SPEC_Pkg;
  20271. -- End: SCTYPE_SPEC spc -----------------------------------------------------
  20272. ::::::::::::::
  20273. scvariant.bdy
  20274. ::::::::::::::
  20275. -- Begin: SCVARIANT_ALTERNATIVE_CLASS bdy ---------------------------------------------------
  20276.      
  20277. with Halstead_Data_Base;  use Halstead_Data_Base;
  20278. with Definitions; use Definitions;
  20279.              with ITEM_Pkg; use ITEM_Pkg;
  20280. with CHOICE_Pkg; use CHOICE_Pkg;
  20281. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  20282. package body VARIANT_ALTERNATIVE_CLASS_Pkg is
  20283.      
  20284.      
  20285.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator) is
  20286.     begin
  20287.         case Kind(Root) is
  20288.           when pragma_variantKind => Scan_pragma_variant(Root);
  20289.           when variant_alternativeKind => Scan_variant_alternative(Root);
  20290.           when others => null;
  20291.         end case;
  20292.     end Scan_VARIANT_ALTERNATIVE_CLASS;
  20293.      
  20294.      
  20295.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator) is
  20296.     begin
  20297.       if not pragma_declNode.IsNull(as_pragma_variant(Root)) then
  20298.         Scan_pragma_decl(as_pragma_variant(Root));
  20299.       end if;
  20300.      
  20301.     end Scan_pragma_variant;
  20302.      
  20303.      
  20304.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator) is
  20305.         as_variant_choice_s_List : SeqOfCHOICE.Generator;
  20306.         as_variant_choice_s_Item : CHOICE.Locator;
  20307.         use SeqOfCHOICE;
  20308.     begin
  20309.       if not SeqOfCHOICE.IsNull(as_variant_choice_s(Root)) then
  20310.      
  20311.      
  20312.      IncrementToken (when_case_variantz);
  20313.      
  20314.      
  20315.         StartForward(as_variant_choice_s(Root), as_variant_choice_s_List);
  20316.         while not Finished(as_variant_choice_s_List) loop
  20317.             as_variant_choice_s_Item := Cell(as_variant_choice_s_List);
  20318.             Scan_CHOICE(as_variant_choice_s_Item);
  20319.             Forward(as_variant_choice_s_List);
  20320.         end loop;
  20321.         EndIterate(as_variant_choice_s_List);
  20322.      
  20323.      
  20324.       IncrementToken (arrowz);
  20325.      
  20326.      
  20327.       end if;
  20328.       if not inner_recordNode.IsNull(as_record(Root)) then
  20329.         Scan_inner_record(as_record(Root));
  20330.       end if;
  20331.      
  20332.     end Scan_variant_alternative;
  20333.      
  20334. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  20335. -- End: SCVARIANT_ALTERNATIVE_CLASS bdy -----------------------------------------------------
  20336. ::::::::::::::
  20337. scvariant.spc
  20338. ::::::::::::::
  20339. -- Begin: SCVARIANT_ALTERNATIVE_CLASS spc ---------------------------------------------------
  20340.      
  20341. with ST_DIANA; use ST_DIANA;
  20342.              package VARIANT_ALTERNATIVE_CLASS_Pkg is
  20343.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator);
  20344.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator);
  20345.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator);
  20346. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  20347. -- End: SCVARIANT_ALTERNATIVE_CLASS spc -----------------------------------------------------
  20348. ::::::::::::::
  20349. srcutil.bdy
  20350. ::::::::::::::
  20351. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.bdy,v $
  20352. -- $Revision: 1.3 $ -- $Date: 85/12/15 18:29:03 $ -- $Author: buddy $
  20353.      
  20354. --pragma revision ("$Revision: 1.3 $");
  20355.      
  20356. package body Source_Position_Utilities is
  20357.      
  20358.     --| OVERVIEW
  20359.     --| This package creates one routine which checks if a
  20360.     --| MLSP.Source_Position is null.  This is helpful
  20361.     --| at some points in the program scan to determine which
  20362.     --| tokens the source program contained.
  20363.      
  20364.     --| NOTES
  20365.     --| This routine should be incorporated in Halstead_Data_Base
  20366.     --| when the world is recompiled.
  20367.      
  20368. --------------------------------------------------------------------------
  20369.      
  20370.     function Is_Srcpos_Null (
  20371.       Position :in    MLSP.Source_Position
  20372.     ) return boolean is
  20373.      
  20374.     begin
  20375.         return (MLSP."=" (Position.first_location, 0));
  20376.     end;
  20377. end Source_Position_Utilities;
  20378.      
  20379. ::::::::::::::
  20380. srcutil.spc
  20381. ::::::::::::::
  20382. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.spc,v $
  20383. -- $Revision: 1.1 $ -- $Date: 85/12/15 17:35:12 $ -- $Author: buddy $
  20384.      
  20385. --pragma revision ("$Revision: 1.1 $");
  20386.      
  20387. with ML_Source_Position_Pkg;
  20388. package Source_Position_Utilities is
  20389.      
  20390.     --| OVERVIEW
  20391.     --| This package creates one routine which checks if a
  20392.     --| MLSP.Source_Position is null.  This is helpful
  20393.     --| at some points in the program scan to determine which
  20394.     --| tokens the source program contained.
  20395.      
  20396.     --| NOTES
  20397.     --| This routine should be incorporated in Halstead_Data_Base
  20398.     --| when the world is recompiled.
  20399.      
  20400.     package MLSP renames ML_Source_Position_Pkg;
  20401.      
  20402. --------------------------------------------------------------------------
  20403.      
  20404.     function Is_Srcpos_Null (
  20405.       Position :in    MLSP.Source_Position
  20406.     ) return boolean;
  20407.      
  20408.     --| OVERVIEW
  20409.     --| This function returns true if the source position passed in
  20410.     --| is null.
  20411.      
  20412. end Source_Position_Utilities;
  20413.      
  20414. ::::::::::::::
  20415. hdb.bdy
  20416. ::::::::::::::
  20417. with Count_Types;
  20418. with Count;
  20419. with Text_IO; use Text_IO;
  20420. with Int_IO; use Int_IO;
  20421. with VmmTextPkg;
  20422. with Unchecked_Deallocation;
  20423. package body Halstead_Data_Base is
  20424.      
  20425. --| OVERVIEW
  20426. --| This package does all the counting and processing of the information
  20427. --| for a block.  It analyzes all the token information and determines
  20428. --| the number of unique operators and operands for the block.  It
  20429. --| scans the list of DEF_ID's in the block and determines whether
  20430. --| each DEF_ID is either an operator or operand. It also scans the
  20431. --| list of literals and determines the number of different literals
  20432. --| as well as the number of times each literal on the list has been
  20433. --| used.  The literals are all counted asoperands.
  20434. --|
  20435. --| Using the number of unique operands and operators all the Halstead
  20436. --| Metrics are computed.   The metrics are then displayed using the
  20437. --| procedure PrintInfo.
  20438.      
  20439. --------------------------------------------------------------------------
  20440. --                          LOCAL OBJECTS
  20441. --------------------------------------------------------------------------
  20442.      
  20443.     package C renames Count;
  20444.     package CT renames Count_Types;
  20445.      
  20446.     BlockKindLength            :constant :=   9;
  20447.     MaxLineLength              :constant :=  80;
  20448.     NumberOfMetrics            :constant :=  17;
  20449.     NumberOfLinesToClearScreen :constant :=   8;
  20450.     BlockStrings: array(BlockKind)
  20451.       of string(1..BlockKindLength) := ( "PROCEDURE",
  20452.                                          "FUNCTION ",
  20453.                                          "PACKAGE  ",
  20454.                                          "PACKAGE  ",
  20455.                                          "TASK     ",
  20456.                                          "TASK     ",
  20457.      
  20458.      -- The following string is used for declare blocks.  It is blank
  20459.      -- because of the DecId string in pkg Definitions.
  20460.      
  20461.                                          "         ");
  20462.       --| These are the strings which will be printed out in the output
  20463.       --| for the corresponding block type.
  20464.      
  20465.     StroudNumber :integer range 5..20 := 5;
  20466.       --| This number is used as a constant in the metric calculations.
  20467.      
  20468.     E0           :integer := 3000;
  20469.       --| Number of elementary  discriminations between errors.
  20470.      
  20471.     type Real is digits 6;
  20472.  
  20473.     type MetricsRecord is
  20474.         record
  20475.           UniqueOperators         :Float;
  20476.           UniqueOperands          :Float;
  20477.           Vocabulary              :Float;
  20478.           OperatorUsage           :Float;
  20479.           OperandUsage            :Float;
  20480.           ProgramLength           :Float;
  20481.           EstimatedProgramLength  :Float;
  20482.           ProgramVolume           :Float;
  20483.           PotentialVolume         :Float;
  20484.           ProgramLevel            :Float;
  20485.           ProgramLevelApprox      :Float;
  20486.           IntelligenceContent     :Float;
  20487.           ProgrammingEffort       :Float;
  20488.           ProgrammingTime         :Float;
  20489.           LanguageLevel           :Float;
  20490.           NumberOfDeliveredErrors :Float;
  20491.           ApproxNumberOfDeliveredErrors :Float;
  20492.         end record;
  20493.         --| Each field of this record corresponds to one of the 17
  20494.         --| Halstead metrics.
  20495.      
  20496. --------------------------------------------------------------------------
  20497. --           LOCAL SUBPROGRAMS
  20498. --------------------------------------------------------------------------
  20499.      
  20500. --------------------------------------------------------------------------
  20501.      
  20502.      procedure Free is new Unchecked_Deallocation (String, StringPtr);
  20503.      
  20504. --------------------------------------------------------------------------
  20505.      
  20506.     function SymRepToString (   --| Converts a SymRep to a string
  20507.           SymRep :in symbol_repNode.Locator
  20508.     ) return String is
  20509.      
  20510.     begin
  20511.         if symbol_repNode.IsNull (SymRep) then
  20512.             return "";
  20513.         else
  20514.             return VmmTextPkg.Value (
  20515.                      Source_Text.Value (
  20516.                        lx_text (
  20517.                          ne_normalized_symrep (
  20518.                            ne_symbol_entry_in_table (
  20519.                              SymRep)))));
  20520.         end if;
  20521.     end SymRepToString;
  20522.      
  20523. --------------------------------------------------------------------------
  20524.      
  20525.     function TruncateSymrep(
  20526.       symrep : symbol_repNode.Locator;
  20527.       length : natural
  20528.     ) return string is
  20529.         TempName : String(1 .. length) := (others => ' ');
  20530.     begin
  20531.         if TOKEN.IsNull (symrep) then
  20532.             return TempName;
  20533.         else
  20534.             declare
  20535.                 FullName : constant String :=SymRepToString (symrep);
  20536.                 size : constant Integer := FullName'length;
  20537.             begin
  20538.                 if size < length then
  20539.                     TempName(1 .. Size) := FullName(1 .. Size);
  20540.                 else
  20541.                     TempName := FullName(1 .. length);
  20542.                 end if;
  20543.                 return TempName;
  20544.             end;
  20545.         end if;
  20546.     end TruncateSymrep;
  20547.      
  20548.      
  20549. --------------------------------------------------------------------- ----
  20550.      
  20551.      
  20552.     procedure DEF_ID_Analysis (  -- This procedure counts and analyzes
  20553.                                  -- all the identifiers in the program as
  20554.                                  -- either operands or operators.
  20555.             SetOfDEF_IDs   :in     DEF_ID_Set.Set;
  20556.             Nn             :in out CT.NnInfoType;
  20557.             N2Star         :in out natural
  20558.     ) is
  20559.      
  20560.         Place          :DEF_ID_Set.SetIter;
  20561.         Member         :DEF_ID.Locator;
  20562.         package DIS renames DEF_ID_Set;
  20563.      
  20564.      
  20565.     begin
  20566.         --| OVERVIEW
  20567.         --| Walk over the SetOfDEF_IDs.  Each member in the set increments
  20568.         --| its class's Vocabulary by 1 and its class's Usage by the
  20569.         --| Countof the member.  The Kind of each member determines
  20570.         --| which class it is in either an operator, an operand or
  20571.         --| neither.
  20572.         --|
  20573.         --| Calculate N2Star by counting the number of parameters to
  20574.         --| the program unit.
  20575.      
  20576.         Place := DIS.MakeSetIter (SetOfDEF_IDs);
  20577.         while DIS.More (Place) loop
  20578.             DIS.Next (Place, Member);
  20579.             case Kind (Member) is
  20580.               when  ATTRIBUTE_IDKind | BUILT_IN_OPERATORKind |
  20581.                     GENERAL_TYPE_IDKind | pkg_idKind | PRAGMA_IDKind |
  20582.                     STM_IDKind | SUBP_IDKind | subtype_idKind |
  20583.                     task_body_idKind =>
  20584.      
  20585.                 Nn(operator).Vocabulary := Nn(operator).Vocabulary + 1;
  20586.                 Nn(operator).Usage :=
  20587.                   Nn(operator).Usage + DIS.GetCount (Place);
  20588.                 if VerboseOn then
  20589.                     Put (Standard_Output, "number of uses of ");
  20590.                     Put (Standard_Output,
  20591.                          SymRepToString (lx_symrep (Member)));
  20592.                     Put (Standard_Output, " ");
  20593.                     Put (Standard_Output,  AnyKind 'image (Kind (Member)));
  20594.                     Put (Standard_Output,  " equals ");
  20595.                     Put (Standard_Output, DIS.GetCount (Place));
  20596.                     Put (Standard_Output,  " operators ");
  20597.                     New_Line(Standard_Output);
  20598.                 end if;
  20599.      
  20600.               when LITERAL_IDKind | OBJECT_IDKind| argument_idKind |
  20601.                    exception_idKind | iteration_id | number_idKind =>
  20602.      
  20603.                  Nn(operand).Vocabulary := Nn(operand).Vocabulary + 1;
  20604.                  Nn(operand).Usage :=
  20605.                    Nn(operand).Usage + DIS.GetCount (Place);
  20606.                  if Kind (Member) in Param_idKind then
  20607.                      N2Star := N2Star + 1;
  20608.                  end if;
  20609.                  if VerboseOn then
  20610.                      Put (Standard_Output, "number of uses of ");
  20611.                      Put (Standard_Output,
  20612.                           SymRepToString (lx_symrep (Member)));
  20613.                      Put (Standard_Output, " which is a ");
  20614.                      Put (Standard_Output, AnyKind 'image (Kind (Member)));
  20615.                      Put (Standard_Output,  " equals ");
  20616.                      Put (Standard_Output,  DIS.GetCount (Place));
  20617.                      Put (Standard_Output,  " operands ");
  20618.                      New_Line (Standard_Output);
  20619.                  end if;
  20620.      
  20621.               when others =>
  20622.                 null;
  20623.      
  20624.             end case;
  20625.         end loop;
  20626.     end DEF_ID_Analysis;
  20627.      
  20628. --------------------------------------------------------------------------
  20629.      
  20630.     procedure Literal_Analysis (
  20631.                SetOfLiterals :in     Literal_Set.Set;
  20632.                Nn            :in out CT.NnInfoType
  20633.     ) is
  20634.         I      :Literal_Set.SetIter;
  20635.         Member :Source_Text.Locator;
  20636.         package LS renames Literal_Set;
  20637.      
  20638.     begin
  20639.         --| OVERVIEW
  20640.         --| Walk over SetOfLiterals.  Each member in the set increments
  20641.         --| the Vocabulary of the operands by one.  The count of each
  20642.         --| member in the set increments the Usage of operands by the
  20643.         --| count.
  20644.      
  20645.         I := LS.MakeSetIter (SetOfLiterals);
  20646.         Nn(operand).Vocabulary :=
  20647.           Nn(operand).Vocabulary + LS.Cardinality (SetOfLiterals);
  20648.         while LS.More (I) loop
  20649.             LS.Next (I, Member);
  20650.             Nn(operand).Usage := Nn(operand).Usage + LS.GetCount (I);
  20651.             if VerboseOn then
  20652.                 Put (Standard_Output, "the literal ");
  20653.                 Put (Standard_Output,
  20654.                      VmmTextPkg.Value (Source_Text.Value (Member)));
  20655.                 Put (Standard_Output, " appears ");
  20656.                 Put (Standard_Output, LS.GetCount(I));
  20657.                 Put (Standard_Output, " times ");
  20658.                 New_Line(Standard_Output);
  20659.             end if;
  20660.         end loop;
  20661.     end Literal_Analysis;
  20662.      
  20663. --------------------------------------------------------------------------
  20664.      
  20665.     function SeriesValue (  --| This function computes the ln (1 + x).
  20666.          X :in     Float
  20667.     ) return Float is
  20668.         N             :integer := 6;
  20669.         SumOfSeries   :Float;
  20670.         Fraction      :Float;
  20671.         LnOfTwo       :Float;
  20672.      
  20673.     begin
  20674.         --| OVERVIEW
  20675.         --|
  20676.         --|  The series for ln (1 + X) =
  20677.         --|
  20678.         --|  x - x**2/2 + x**3/3 - x**4/4 + x**5/5 ....
  20679.         --|
  20680.         --|  This is being factored inorder to save computations to be
  20681.         --|
  20682.         --|  x ( 1 + x(-1/2 + x(1/3 + x(-1/4 .....
  20683.         --|
  20684.         --|  This is being computed from inside out.
  20685.      
  20686.         LnOfTwo := 6931.0/10000.0;
  20687.         SumOfSeries := 0.0;
  20688.         for i in reverse 1..N loop
  20689.         Fraction := 1.0/Float(i);
  20690.             if (i mod 2) = 0 then
  20691.         SumOfSeries := SumOfSeries - Fraction;
  20692.             else
  20693.         SumOfSeries := SumOfSeries + Fraction;
  20694.             end if;
  20695.             SumOfSeries := SumOfSeries * X;
  20696.         end loop;
  20697.     SumOfSeries := SumOfSeries / LnOfTwo;
  20698.         return SumOfSeries;
  20699.  
  20700.     end SeriesValue;
  20701.      
  20702. --------------------------------------------------------------------------
  20703.      
  20704.     function Log2 (
  20705.           X :in     Float
  20706.     ) return Float is
  20707.         U_X              :Float;
  20708.         IntegerPart      :Float;
  20709.         LogForFraction   :Float;
  20710.         LowerBound       :Float;
  20711.         X_For_Series     :Float;
  20712.      
  20713.         InputOutOfBounds :exception;
  20714.      
  20715.     --| This computes the log2(X) by using the following method.
  20716.     --|
  20717.     --| First get the integer part of the log by testing when 2**n is
  20718.     --| greater than X.  The integer part of log2(X) is then n - 1.
  20719.     --|
  20720.     --| Then we calculate the fraction part of log2(x) by using the
  20721.     --| expression
  20722.     --|
  20723.     --| ln(1 + x) = x - x**2/2 + x**3/3 - x**4/4 .....
  20724.     --|
  20725.     --| Then by using the fact log2(x) = ln(X)/ln(2) we have log2(X).
  20726.     --|
  20727.     --| For example if x = 70
  20728.     --|
  20729.     --| log2 (70) = log2 (64 * 70/64) = 6 + log2(70/64)
  20730.     --|
  20731.     --| log2( 70/64 )= log2( 1 + 6/64) = ln(1 + 6/64) / ln(2)
  20732.     --|
  20733.     --| log2 (1 + 64/70) is calculated by the function SeriesValue
  20734.     --| when passed  (64/70).
  20735.      
  20736.     begin
  20737.      
  20738.      
  20739.        if X < 0.0 then
  20740.            raise InputOutOfBounds;
  20741.        else
  20742.       U_X := Float(Integer(X));
  20743.       LowerBound := 1.0;
  20744.       IntegerPart := 0.0;
  20745.       while 2.0 * LowerBound <= U_X loop
  20746.         IntegerPart := IntegerPart + 1.0;
  20747.         LowerBound := LowerBound * 2.0;
  20748.       end loop;
  20749.       if LowerBound = U_X then
  20750.                return IntegerPart;
  20751.       else
  20752.                  -- Following the example above at this point we compute
  20753.                  -- log2 (70/64) = log2 (1 + 6/64)
  20754.                  -- log2 (1 + 6/64) = SeriesValue (6/64).
  20755.                  -- U_X - LowerBound is in the example 70 - 64.  Therefore
  20756.                  -- (U_X - LowerBound) / LowerBound is 6/64.
  20757.      
  20758.       X_For_Series := (U_X - LowerBound)/LowerBound;
  20759.       LogForFraction := SeriesValue(X_For_Series);
  20760.       return IntegerPart + LogForFraction;
  20761.         end if;
  20762.     end if;
  20763.  
  20764. end Log2;
  20765.      
  20766. --------------------------------------------------------------------------
  20767.      
  20768. function Exp (           --| Raises the natural log e to the power X.
  20769.              X  :in    Float
  20770.     ) return Float is
  20771.          NumberOfIterations  :integer := 6;
  20772.                                --| Number of Iterations used to calculate
  20773.                                --| series.
  20774.          Series              :Float;
  20775.          Factorial           :Float;
  20776.     begin
  20777.     Series := 1.0;
  20778.         Factorial := 1.0;
  20779.         for i in 1..NumberOfIterations loop
  20780.                -- Caculate Factorial
  20781.              Factorial := Factorial * Float(i);
  20782.              Series := Series + ((X ** i) / Factorial);
  20783.         end loop;
  20784.         return Series;
  20785.  
  20786.     end Exp;
  20787.      
  20788. --------------------------------------------------------------------------
  20789.      
  20790.     function TwoThirdsPower ( --| Calculates X ** (2/3) by finding a
  20791.                               --| a Y such that X ** 2 = Y ** 3
  20792.          X  :in    Float
  20793.     ) return Float is
  20794.          Y         :float := 1.0;
  20795.          SquareX   :float;
  20796.          CubeY     :float;
  20797.          CubeDelta :float;
  20798.     begin
  20799.         --| OVERVIEW
  20800.         --| Y = x ** (2/3) ->
  20801.         --| Y**3 = X**2
  20802.         --|
  20803.         --| This function computes Y such that
  20804.         --| Y**3 <= X**2 is true.
  20805.      
  20806.         SquareX := X ** 2;
  20807.         CubeY := Y ** 3;
  20808.         CubeDelta := CubeY + ((3.0 * Y) * (Y + 1.0)) + 1.0;
  20809.           -- The following shows how to incremently compute (Y+1)**3 when
  20810.           -- Y **3 exists.
  20811.           --
  20812.           -- ((Y + 1) ** 3)  -   (Y**3) =
  20813.           -- Y**3 + 3Y**2 + 3Y + 1    - Y**3 =
  20814.           -- 3Y**2 + 3Y + 1 =
  20815.           -- 3Y(Y + 1) + 1
  20816.         while CubeY + CubeDelta < SquareX loop
  20817.             Y :=  Y + 1.0;
  20818.             CubeDelta :=  ((3.0 * Y) * (Y + 1.0)) + 1.0;
  20819.         end loop;
  20820.         return Y;
  20821.  
  20822.     end TwoThirdsPower;
  20823.      
  20824. --------------------------------------------------------------------------
  20825.      
  20826.     procedure CalcEstimatedProgramLength (
  20827.                                  --| Computes the estimated program length
  20828.                                  --| given the number of unique operators
  20829.                                  --| and operands.
  20830.              N1       :in     Float;  --| number of unique operators
  20831.              N2       :in     Float;  --| number of unique operands
  20832.              Result   :in out Float
  20833.     ) is
  20834.      
  20835.     begin
  20836.         Result := (N1 * log2(N1)) + (N2 * log2(N2));
  20837.  
  20838.     end CalcEstimatedProgramLength;
  20839.      
  20840. --------------------------------------------------------------------------
  20841.      
  20842.     procedure CalcProgramVolume (    --| Computes the program volume
  20843.                                 --| given the vocabulary.
  20844.              ProgramLength :in     Float;
  20845.              Vocabulary    :in     Float;
  20846.              Result        :in out Float
  20847.     ) is
  20848.      
  20849.     begin
  20850.         Result := ProgramLength * log2(Vocabulary);
  20851.  
  20852.     end CalcProgramVolume;
  20853.      
  20854. --------------------------------------------------------------------------
  20855.      
  20856.     procedure CalcPotentialVolume(
  20857.              N2Star :in     natural;   --| minimum number of input output
  20858.                                        --| parameters.
  20859.              Result :in out Float
  20860.     ) is
  20861.     begin
  20862.          Result := (2.0 + Float(N2Star)) * log2(2.0 + Float(N2Star));
  20863.  
  20864.     end CalcPotentialVolume;
  20865.      
  20866. --------------------------------------------------------------------------
  20867.      
  20868.     procedure CalcProgramLevel (
  20869.              VStar  :in     Float;
  20870.              V      :in     Float;
  20871.              Result :in out Float
  20872.     ) is
  20873.      
  20874.     begin
  20875.         Result := VStar / V;
  20876.      
  20877.     exception
  20878.         when Numeric_Error =>
  20879.             -- This catches the case when the denominator is 0.
  20880.       Result := 0.0;
  20881.      
  20882.     end CalcProgramLevel;
  20883.      
  20884. --------------------------------------------------------------------------
  20885.      
  20886.     procedure  CalcProgramLevelApprox( --| minimum number of operators,
  20887.                                        --| number of unique operators,
  20888.                                        --| number of unique operands
  20889.                                        --| and total number of operands.
  20890.       N1           :in     Float;
  20891.       N2Unique     :in     Float;
  20892.       N2Total      :in     Float;
  20893.       N1Star       :in     natural := 2;
  20894.                                        --| Minimum number of operators
  20895.                                        --| necessary
  20896.       Result       :in out Float
  20897.     ) is
  20898.      
  20899.     begin
  20900.         Result := Float(N1Star)/N1 * N2Unique * N2Total;
  20901.  
  20902.     exception
  20903.       when Numeric_Error =>
  20904.           -- This catches the case when the denominator is 0.
  20905.         Result := 0.0;
  20906.      
  20907.     end CalcProgramLevelApprox;
  20908.      
  20909. --------------------------------------------------------------------------
  20910.      
  20911.     procedure CalcIntelligenceContent (
  20912.         L_Approx :in     Float;
  20913.         V        :in     Float;
  20914.         Result   :in out Float
  20915.     ) is
  20916.     begin
  20917.       Result := L_Approx * V;
  20918.  
  20919.     end CalcIntelligenceContent;
  20920.      
  20921. --------------------------------------------------------------------------
  20922.      
  20923.     procedure CalcProgrammingEffort (
  20924.         V      :in     Float;
  20925.         L      :in     Float;
  20926.         Result :in out Float
  20927.      
  20928.     ) is
  20929.     begin
  20930.         Result := V / L;
  20931.  
  20932.     exception
  20933.         when Numeric_Error =>
  20934.             -- This catches the case when the denominator is 0.
  20935.         Result := 0.0;
  20936.      
  20937.     end CalcProgrammingEffort;
  20938.      
  20939. --------------------------------------------------------------------------
  20940.      
  20941.     procedure CalcProgrammingTime (
  20942.         E      :in     Float;
  20943.         S      :in     natural;      --| Stroud number.
  20944.         Result :in out Float
  20945.     ) is
  20946.     begin
  20947.     Result := E/Float(S);
  20948.  
  20949.     end CalcProgrammingTime;
  20950.      
  20951. --------------------------------------------------------------------------
  20952.      
  20953.     procedure CalcLanguageLevel (
  20954.        L      :in     Float;
  20955.        VStar  :in     Float;
  20956.        Result :in out Float
  20957.     ) is
  20958.      
  20959.     begin
  20960.         Result := L * VStar;
  20961.  
  20962.     end CalcLanguageLevel;
  20963.      
  20964. --------------------------------------------------------------------------
  20965.      
  20966.     procedure CalcNumberOfDeliveredErrors (
  20967.         E       :in     Float;
  20968.         E0      :in     natural;
  20969.         Result  :in out Float
  20970.     ) is
  20971.     begin
  20972.         -- E**(2/3) / E0
  20973.     Result := TwoThirdsPower(E) / Float(E0);
  20974.  
  20975.     end CalcNumberOfDeliveredErrors;
  20976.      
  20977. --------------------------------------------------------------------------
  20978.      
  20979.     procedure CalcApproxNumberOfDeliveredErrors (
  20980.          V      :in     Float;
  20981.          E0     :in    natural;
  20982.          Result :in out Float
  20983.     ) is
  20984.     begin
  20985.     Result := V / Float(E0);
  20986.  
  20987.     end CalcApproxNumberOfDeliveredErrors;
  20988.      
  20989. --------------------------------------------------------------------------
  20990.      
  20991.     procedure MetricCalculations (
  20992.       Nn       :in     CT.NnInfoType;
  20993.       N2Star   :in     natural;
  20994.       Metrics  :in out MetricsRecord
  20995.     ) is
  20996.      
  20997.     begin
  20998.       Metrics.UniqueOperators := Float(Nn(operator).Vocabulary);
  20999.       Metrics.UniqueOperands := Float(Nn(operand).Vocabulary);
  21000.       Metrics.OperandUsage := Float(Nn(operand).Usage);
  21001.       Metrics.OperatorUsage := Float(Nn(operator).Usage);
  21002.       Metrics.Vocabulary := Metrics.UniqueOperators + Metrics.UniqueOperands;
  21003.       Metrics.ProgramLength := Metrics.OperandUsage + Metrics.OperatorUsage;
  21004.       CalcEstimatedProgramLength(Metrics.UniqueOperators,
  21005.                                  Metrics.UniqueOperands,
  21006.                                  Metrics.EstimatedProgramLength);
  21007.       CalcProgramVolume(Metrics.ProgramLength,
  21008.                         Metrics.Vocabulary,
  21009.                         Metrics.ProgramVolume);
  21010.       CalcPotentialVolume(N2Star, Metrics.PotentialVolume);
  21011.       CalcProgramLevel(Metrics.PotentialVolume,
  21012.                        Metrics.ProgramVolume,
  21013.                        Metrics.ProgramLevel);
  21014.       CalcProgramLevelApprox(Metrics.UniqueOperators,
  21015.                              Metrics.UniqueOperands,
  21016.                              Metrics.OperandUsage,
  21017.                              Result => Metrics.ProgramLevelApprox);
  21018.       CalcIntelligenceContent(Metrics.ProgramLevelApprox,
  21019.                               Metrics.ProgramVolume,
  21020.                               Metrics.IntelligenceContent);
  21021.       CalcProgrammingEffort(Metrics.ProgramVolume,
  21022.                             Metrics.ProgramLevel,
  21023.                             Metrics.ProgrammingEffort);
  21024.       CalcProgrammingTime(Metrics.ProgrammingEffort,
  21025.                           StroudNumber,
  21026.                           Metrics.ProgrammingTime);
  21027.       CalcLanguageLevel(Metrics.ProgramLevel,
  21028.                         Metrics.PotentialVolume,
  21029.                         Metrics.LanguageLevel);
  21030.       CalcNumberOfDeliveredErrors(Metrics.ProgrammingEffort,
  21031.                                   E0,
  21032.                                   Metrics.NumberOfDeliveredErrors);
  21033.       CalcApproxNumberOfDeliveredErrors(
  21034.                          Metrics.ProgramVolume,
  21035.                          E0,
  21036.                          Metrics.ApproxNumberOfDeliveredErrors);
  21037.      
  21038.     end MetricCalculations;
  21039.      
  21040. -------------------------------------------------------------------------
  21041.      
  21042.     function Center (   --|This centers the string S in a buffer of blanks
  21043.                         --|whose width is Width.
  21044.       S      :in     String;
  21045.       Width  :in     positive
  21046.     ) return String is
  21047.         Result        :String(1..Width) := (others => ' ');
  21048.         Start         :positive;
  21049.         Finish        :positive;
  21050.         BufferToSmall :exception;
  21051.     begin
  21052.         Start := ((Result'length - S'length) / 2) + 1;
  21053.         Finish := Start + S'length - 1;
  21054.         if S'length > Width then
  21055.             raise BufferToSmall;
  21056.         else
  21057.             Result(Start..Finish) := S(S'range);
  21058.             return Result;
  21059.         end if;
  21060.     end Center;
  21061.      
  21062. --------------------------------------------------------------------------
  21063.      
  21064.     function RightJustify (  --| Right justify the string S in a buffer
  21065.                              --| whose width is Width.
  21066.       S      :in     String;
  21067.       Width  :in     positive
  21068.     ) return String is
  21069.         Result        :String(1..Width) := (others => ' ');
  21070.         Start         :positive;
  21071.         Finish        :positive;
  21072.         BufferToSmall :exception;
  21073.     begin
  21074.         if S'length > Width then
  21075.             raise BufferToSmall;
  21076.         else
  21077.             Start := (Result'length - S'length) + Result'first;
  21078.             Finish := Result'last;
  21079.             Result (Start..Finish) := S(S'range);
  21080.             return Result;
  21081.         end if;
  21082.     end RightJustify;
  21083.      
  21084. --------------------------------------------------------------------------
  21085.      
  21086.     function LeftJustify ( --| Left justify the string S in a buffer
  21087.                            --| of blanks whose width is Width.
  21088.       S      :in    String;
  21089.       Width  :in    positive
  21090.     ) return String is
  21091.         Finish        :positive;
  21092.         Result        :String (1..Width) := (others => ' ');
  21093.         BufferToSmall :exception;
  21094.     begin
  21095.         if S'length > Width then
  21096.             raise BufferToSmall;
  21097.         else
  21098.             Finish := Result'first + S'length - 1;
  21099.             Result (Result'first..Finish) := S(S'range);
  21100.             return Result;
  21101.         end if;
  21102.     end LeftJustify;
  21103.      
  21104. --------------------------------------------------------------------------
  21105.      
  21106.     function StripTrailingBlanks ( --| Remove all trailing blanks from
  21107.                                    --| a string.
  21108.                Token :in     String
  21109.     ) return String is
  21110.      
  21111.     begin
  21112.         for i in reverse Token'range loop
  21113.             if Token(i) /= ' ' then
  21114.                 -- ith character is not a blank so return
  21115.                 -- Token(Token'first..i)
  21116.                 return Token(Token'first..i);
  21117.             end if;
  21118.         end loop;
  21119.         return "";
  21120.     end StripTrailingBlanks;
  21121.      
  21122. --------------------------------------------------------------------------
  21123.      
  21124.     function IntTruncAndConvert (     --| Truncates and Converts an
  21125.                                       --| integer to a string of a given
  21126.                                       --| length.
  21127.       I     :in integer;
  21128.       Width :in integer
  21129.     ) return String is
  21130.      
  21131.         Result :constant String := integer'image(I);
  21132.     begin
  21133.         -- Since image returns a leading blank the number of
  21134.         -- digits in I is length'Result - 1
  21135.      
  21136.         if Result'length - 1 > Width then
  21137.             return Result(2..2 + Width - 1);
  21138.         else
  21139.             return Result(2..Result'length);
  21140.         end if;
  21141.     end IntTruncAndConvert;
  21142.      
  21143. --------------------------------------------------------------------------
  21144.      
  21145.     function Float_To_Int_Str (
  21146.       X  :in     Float
  21147.     ) return String is
  21148.     begin
  21149.         return Integer'Image(Integer(X));
  21150.  
  21151.     end Float_To_Int_Str;
  21152.      
  21153. --------------------------------------------------------------------------
  21154.      
  21155.     function FirstNonBlank (
  21156.       S :in    String
  21157.     ) return natural is
  21158.         Position :natural := S'first;
  21159.     begin
  21160.         while (S(Position) = ' ') and (Position <= S'last) loop
  21161.             Position := Position + 1;
  21162.         end loop;
  21163.         if Position in S'Range then
  21164.             return Position;
  21165.         else
  21166.             return 0;
  21167.         end if;
  21168.     end FirstNonBlank;
  21169.      
  21170. --------------------------------------------------------------------------
  21171.      
  21172.     function Float_To_Dec_Str (
  21173.       X  :in     Float
  21174.     ) return String is
  21175.         TimesX  :Float;
  21176.     begin
  21177.         --| OVERVIEW
  21178.         --| This function takes a Float and returns the image of the
  21179.         --| number in decimal notation.  The number it returns has two
  21180.         --| places to the right of the decimal point or if the number is
  21181.         --| an integer it leaves two blanks.
  21182.      
  21183.         if X < 0.01 then
  21184.             return "<0.01";
  21185.     elsif X > 1000000.0 then
  21186.             return ">1000000   ";
  21187.         end if;
  21188.      
  21189.         TimesX := X * 100.0;
  21190.         declare
  21191.             StrTimesX: constant String := Integer'Image(Integer(TimesX));
  21192.             Result            :String (1..StrTimesX'length + 1);
  21193.             FirstDigitPos     :positive;
  21194.             LastDigitPos      :positive;
  21195.             NumberOfDigits    :positive;
  21196.             DecimalFillSpaces :constant String := "   ";
  21197.               --| This ensures that there are three spaces to the right of
  21198.               --| ones places.  This keeps all the numbers in line.
  21199.         begin
  21200.             if Integer(TimesX) = 0 then
  21201.                 return "0" & DecimalFillSpaces ;
  21202.             else
  21203.                 FirstDigitPos := FirstNonBlank (StrTimesX);
  21204.                 NumberOfDigits := StrTimesX'last - FirstDigitPos + 1;
  21205.                 if StrTimesX(StrTimesX'last - 1..StrTimesx'Last) = "00"
  21206.                    then
  21207.                        return
  21208.                        StrTimesX(StrTimesX'First..StrTimesx'last - 2) &
  21209.                        DecimalFillSpaces;
  21210.                 end if;
  21211.      
  21212.                 case NumberOfDigits is
  21213.                   when 1 =>
  21214.                     Result(1..2) := ".0";
  21215.                     return Result(1..2) & StrTimesX (FirstDigitPos);
  21216.      
  21217.                   when 2 =>
  21218.                     Result(1) := '.';
  21219.                     Result(2..3) :=
  21220.                       StrTimesX
  21221.                        (FirstDigitPos..FirstDigitPos + NumberOfDigits -1);
  21222.                     return Result (1..3);
  21223.      
  21224.                   when others =>
  21225.                     LastDigitPos := FirstDigitPos + NumberOfDigits - 1;
  21226.                     Result(1..NumberOfDigits - 2) :=
  21227.                       StrTimesX (FirstDigitPos..LastDigitPos - 2);
  21228.                     Result(NumberOfDigits - 2  + 1) := '.';
  21229.                     Result(NumberOfDigits..NumberOfDigits + 1) :=
  21230.                       StrTimesX (LastDigitPos - 1..LastDigitPos);
  21231.                     return Result (1..NumberOfDigits + 1);
  21232.      
  21233.                 end case;
  21234.             end if;
  21235.         end;
  21236.     end Float_To_Dec_Str;
  21237.      
  21238. --------------------------------------------------------------------------
  21239.      
  21240.     procedure InsertInBuffer (  --| Insert the string "Insert" into Buffer
  21241.                                 --| preceeding a right Justified Field
  21242.                                 --| and a field which may have to be
  21243.                                 --| truncated with at least one blank.
  21244.                                 --| A left justified field does not have
  21245.                                 --| a blank preceeding it.
  21246.        Buffer       :in out String;
  21247.        Insert       :in     String;
  21248.        StartPos     :in     positive;
  21249.        EndPos       :in     positive
  21250.    ) is
  21251.    begin
  21252.        Buffer (StartPos..EndPos) := Insert(Insert'Range);
  21253.    end InsertInBuffer;
  21254.      
  21255. --------------------------------------------------------------------------
  21256.      
  21257.     procedure PrintBlockId (  --| This procedure prints the identifying
  21258.                               --| information for a block when producing
  21259.                               --| the report.
  21260.       BlockId: in    BlockIdType
  21261.     ) is
  21262.     begin
  21263.          --| OVERVIEW
  21264.          --| This prints
  21265.          --|   1.  the kind of block
  21266.          --|   2.  whether the block is a spec or body
  21267.          --|   3.  the name of the block
  21268.          --|   4.  the line number where the block appears in the source
  21269.      
  21270.          --| ALGORITHM
  21271.          --| Check if this is a declare block which is unnamed.  If it is
  21272.          --| then process it differently.
  21273.      
  21274.          if BlockId.KindOfBlock = Definitions.declare_block
  21275.             and then
  21276.             BlockId.BlockName.all(
  21277.               BlockId.BlockName.all'first..BlockId.BlockName.all'last
  21278.                                  )= ""
  21279.          then
  21280.             Put ("UNNAMED DECLARE BLOCK");
  21281.          else
  21282.             Put (StripTrailingBlanks (BlockStrings(BlockId.KindOfBlock)));
  21283.             Put (" ");
  21284.             Put (StripTrailingBlanks (BlockId.SpcBdyId));
  21285.             Put (" OF ");
  21286.             Put (
  21287.               BlockId.BlockName.all(
  21288.                 BlockId.BlockName.all'first..BlockId.BlockName.all'last
  21289.                                    )
  21290.                 );
  21291.          end if;
  21292.          Put (" AT LINE ");
  21293.          Put (BlockId.LineLocation);
  21294.          New_Line (Spacing => 2);
  21295.     end PrintBlockId;
  21296.      
  21297. --------------------------------------------------------------------------
  21298.      
  21299.     procedure PrintInfo (
  21300.       BlockId: in    BlockIdType;
  21301.       Metrics: in    MetricsRecord
  21302.     ) is
  21303.       subtype BufferType is String (1..MaxLineLength);
  21304.       Output       :BufferType;
  21305.       Blanks       :BufferType := (others => ' ');
  21306.       LabelLength  :constant positive := 20;
  21307.       subtype LabelType is String (1..LabelLength);
  21308.       subtype Metric_Index is natural range 1..NumberOfMetrics + 1;
  21309.       MetricLabels :constant array (Metric_Index) of LabelType:=
  21310.                           ( "UNIQUE OPERATORS    ",
  21311.                             "UNIQUE OPERANDS     ",
  21312.                             "TOTAL OPERATORS     ",
  21313.                             "TOTAL OPERANDS      ",
  21314.                             "VOCABULARY          ",
  21315.                             "                    ",
  21316.                             "PROGRAM LENGTH      ",
  21317.                             "ESTIMATED LENGTH    ",
  21318.                             "PROGRAM VOLUME      ",
  21319.                             "POTENTIAL VOLUME    ",
  21320.                             "PROGRAM LEVEL       ",
  21321.                             "ESTIMATED LEVEL     ",
  21322.                             "INTELLIGENCE CONTENT",
  21323.                             "PROGRAMMING EFFORT  ",
  21324.                             "PROGRAMMING TIME    ",
  21325.                             "LANGUAGE LEVEL      ",
  21326.                             "DELIVERED ERRORS    ",
  21327.                             "ESTIMATED ERRORS    "
  21328.                             );
  21329.            --| This array has one extra space for a metric.  This is
  21330.            --| to make producing the report easier.
  21331.      
  21332.     subtype metric_range is integer range 1..NumberOfMetrics + 1;
  21333.          ProcessArray     :array (metric_Range) of Float;
  21334.            --| This array has one extra space for a metric.  This is
  21335.            --| to make producing the report easier.
  21336.      
  21337.          NumberOfMetricLines :constant positive := 9;
  21338.          FirstColValueField  :positive; -- := LabelLength + 2;
  21339.          FirstCol            :constant positive := 1;
  21340.          EndFirstCol         :constant positive := 38;
  21341.          SecondCol           :constant positive := 41;
  21342.          EndSecondCol        :constant positive  := 80;
  21343.          SecondColValueField :positive; -- := SecondCol+LabelLength+2- 1;
  21344.          i                   :integer;
  21345.    begin
  21346.         --| OVERVIEW
  21347.         --| This procedure produces the report for a block. The format of
  21348.         --| the report is the following:
  21349.         --|
  21350.         --|---------------------------------------------------------------
  21351.         --|        HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF LIBRARY UNIT C36205D
  21352.         --|
  21353.         --|
  21354.         --| PROCEDURE SPECIFICATION OF C36205D AT LINE 12
  21355.         --|
  21356.         --| UNIQUE OPERATORS                  5     UNIQUE OPERANDS                    <0.01
  21357.         --| TOTAL OPERATORS                   6     TOTAL OPERANDS                     <0.01
  21358.         --| VOCABULARY                        5
  21359.         --| PROGRAM LENGTH                    6     ESTIMATED LENGTH                   11.61
  21360.         --| PROGRAM VOLUME                   13.93  POTENTIAL VOLUME                    2
  21361.         --| PROGRAM LEVEL                      .14  ESTIMATED LEVEL                    <0.01
  21362.         --| INTELLIGENCE CONTENT             <0.01  PROGRAMMING EFFORT                 97.06
  21363.         --| PROGRAMMING TIME                 19.41  LANGUAGE LEVEL                       .29
  21364.         --| DELIVERED ERRORS                 <0.01  ESTIMATED ERRORS                   <0.01
  21365.         --|
  21366.         --|---------------------------------------------------------------
  21367.         --| The object FirstCol refers to the labels on the left hand side
  21368.         --| of the report.  These are UNIQUE OPERATORS, TOTAL OPERATORS
  21369.         --| and so on.  FirstColValueField is the refers to the leftmost
  21370.         --| position of the field where the numbers appear.
  21371.         --| The object SecondCol refers to the leftmost position of the
  21372.         --| labels for the second column.  These are UNIQUE OPERANDS,
  21373.         --| TOTAL OPERANDS and so forth.  SecondColValueField refers to
  21374.         --| the leftmost position of the value field.  In this report
  21375.         --| are left justified  or right justified in relation to a field.
  21376.      
  21377.         FirstColValueField := LabelLength + 2;
  21378.         SecondColValueField := SecondCol + LabelLength + 2 - 1;
  21379.         PrintBlockId (BlockId);
  21380.         ProcessArray(1) := Metrics.UniqueOperators;
  21381.         ProcessArray(2) := Metrics.UniqueOperands;
  21382.         ProcessArray(3) := Metrics.OperatorUsage;
  21383.         ProcessArray(4) := Metrics.OperandUsage;
  21384.         ProcessArray(5) := Metrics.Vocabulary;
  21385.         ProcessArray(6) := 0.0;
  21386.         ProcessArray(7) := Metrics.ProgramLength;
  21387.         ProcessArray(8) := Metrics.EstimatedProgramLength;
  21388.         ProcessArray(9) := Metrics.ProgramVolume;
  21389.         ProcessArray(10) := Metrics.PotentialVolume;
  21390.         ProcessArray(11) := Metrics.ProgramLevel;
  21391.         ProcessArray(12) := Metrics.ProgramLevelApprox;
  21392.         ProcessArray(13) := Metrics.IntelligenceContent;
  21393.         ProcessArray(14) := Metrics.ProgrammingEffort;
  21394.         ProcessArray(15) := Metrics.ProgrammingTime;
  21395.         ProcessArray(16) := Metrics.LanguageLevel;
  21396.         ProcessArray(17) := Metrics.NumberOfDeliveredErrors;
  21397.         ProcessArray(18) := Metrics.ApproxNumberOfDeliveredErrors;
  21398.         Output := Blanks;
  21399.         for j in 1..NumberOfMetricLines loop
  21400.             i := (j * 2) - 1;
  21401.             InsertInBuffer (Output,
  21402.                             MetricLabels(i),
  21403.                             FirstCol,
  21404.                             LabelLength);
  21405.             InsertInBuffer (Output,
  21406.                             RightJustify (
  21407.                                  Float_To_Dec_Str (ProcessArray(i)),
  21408.                                  EndFirstCol - FirstColValueField + 1
  21409.                                          ),
  21410.                             FirstColValueField,
  21411.                             EndFirstCol);
  21412.      
  21413.               -- Only do the following if i is not equal to 5 because
  21414.               -- if i equals 5 then we are processing the third line
  21415.               -- which doesn't have a second column so skip it.
  21416.             if i /= 5 then
  21417.                  InsertInBuffer (Output,
  21418.                                  MetricLabels(i + 1),
  21419.                                  SecondCol,
  21420.                                  SecondCol + LabelLength - 1);
  21421.                  InsertInBuffer (Output,
  21422.                                  RightJustify (
  21423.                                   Float_To_Dec_Str (ProcessArray(i + 1) ),
  21424.                                   EndSecondCol - SecondColValueField + 1
  21425.                                               ),
  21426.                                  SecondColValueField,
  21427.                                  EndSecondCol);
  21428.             end if;
  21429.             Put_Line (Output);
  21430.             Output := Blanks;
  21431.         end loop;
  21432.      
  21433.           -- Clear screen if printing to terminal.
  21434.           -- If writing to a file add two lines of spacing.
  21435.      
  21436.         if ToTerminal then
  21437.            New_Line (Spacing => NumberOfLinesToClearScreen);
  21438.         else
  21439.            New_Line (Spacing => 2);
  21440.         end if;
  21441.     end PrintInfo;
  21442.      
  21443. --------------------------------------------------------------------------
  21444.      
  21445.     function CopyQualifiedName (
  21446.       FullyQualifiedName :in      StringPtr
  21447.     ) return StringPtr is
  21448.      
  21449.     begin
  21450.         return new String ' (FullyQualifiedName.all);
  21451.  
  21452.     end CopyQualifiedName;
  21453.      
  21454. --------------------------------------------------------------------------
  21455.      
  21456. procedure ExtendQualifiedName (
  21457.                QualifiedName     :in out StringPtr;
  21458.                Extension         :in     String
  21459. ) is
  21460.      
  21461.   --| ALGORITHM
  21462.   --| Concatentate FullyQualifiedName with "." and the Extension
  21463.   --| then return the access to this.  Free the space used by the
  21464.   --| QualifiedName.
  21465.      
  21466. begin
  21467.     if Extension /= "" then
  21468.         if QualifiedName.all /= "" then
  21469.             QualifiedName :=
  21470.             new String ' (QualifiedName.all & "." & Extension);
  21471.         else
  21472.             QualifiedName := new String ' (Extension);
  21473.         end if;
  21474.     end if;
  21475. end ExtendQualifiedName;
  21476.      
  21477. --------------------------------------------------------------------------
  21478.      
  21479. procedure TruncateQualifiedName (
  21480.                FullyQualifiedName     :in out StringPtr
  21481. ) is
  21482.      
  21483.   --| ALGORITHM
  21484.   --| Remove the last qualification from FullyQualifiedName.
  21485.   --| When changing FullyQualifiedName free the space used by the
  21486.   --| old value.
  21487.      
  21488.     Trash :StringPtr := FullyQualifiedName;
  21489. begin
  21490.     for i in reverse FullyQualifiedName.all'range  loop
  21491.         if FullyQualifiedName(i) = '.' then
  21492.            FullyQualifiedName :=  new String '
  21493.              (FullyQualifiedName(FullyQualifiedName.all'first..i-1));
  21494.            Free (Trash);
  21495.            return;
  21496.         end if;
  21497.     end loop;
  21498.     Free (Trash);
  21499.     FullyQualifiedName := new String ' ("");
  21500. end TruncateQualifiedName;
  21501.      
  21502. --------------------------------------------------------------------------
  21503.      
  21504.      
  21505. --------------------------------------------------------------------------
  21506. --                          VISIBLE SUBPROGRAMS
  21507. --------------------------------------------------------------------------
  21508.      
  21509.      
  21510. --------------------------------------------------------------------------
  21511.      
  21512.    procedure ReportHeader (
  21513.      UnitName : String;
  21514.      Spec     : boolean
  21515.    ) is
  21516.    begin
  21517.       if Spec then
  21518.           Put_Line (
  21519.              Center  (
  21520.                   "HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF" &
  21521.                   " LIBRARY UNIT " & UnitName,
  21522.                    MaxLineLength
  21523.                      )
  21524.      
  21525.               );
  21526.       else
  21527.           Put_Line (
  21528.           Center ("HALSTEAD COMPLEXITY FOR THE BODY OF LIBRARY UNIT " &
  21529.                   UnitName,
  21530.                    MaxLineLength
  21531.                  )
  21532.               );
  21533.       end if;
  21534.       New_Line (Spacing => 2);
  21535.    end ReportHeader;
  21536.      
  21537. --------------------------------------------------------------------------
  21538.      
  21539.    procedure InitializeData (
  21540.        LibraryUnit          :in     String;
  21541.        IsUnitSpec           :in     boolean;
  21542.        VerboseFlag          :in     boolean;
  21543.        ToTerminalFlag       :in     boolean;
  21544.        OuterMostBlockFlag   :in     boolean
  21545.    ) is
  21546.    begin
  21547.      
  21548.        UnitName := new String ' (LibraryUnit(LibraryUnit'range));
  21549.        FullyQualifiedName := new String ' ("");
  21550.        UnitSpec := IsUnitSpec;
  21551.        VerboseOn := VerboseFlag;
  21552.        ToTerminal := ToTerminalFlag;
  21553.        OuterMostBlockSeen := OuterMostBlockFlag;
  21554.        if ToTerminal then
  21555.            New_Page;
  21556.        end if;
  21557.    end InitializeData;
  21558.      
  21559. --------------------------------------------------------------------------
  21560.      
  21561.     procedure IncrementToken (
  21562.       T :in     TokenItem
  21563.     ) is
  21564.      
  21565.     begin
  21566.         CurrentBlock.TokenCount(T) := CurrentBlock.TokenCount(T) + 1;
  21567.     end IncrementToken;
  21568.      
  21569. --------------------------------------------------------------------------
  21570.      
  21571.     procedure FreeSpace (
  21572.       CurrentBlock :in out BlockInfoType
  21573.     ) is
  21574.     begin
  21575.         Literal_Set.Destroy (CurrentBlock.SetOfLiterals);
  21576.         DEF_ID_Set.Destroy (CurrentBlock.SetOfDEF_IDs);
  21577.     end FreeSpace;
  21578.      
  21579.      
  21580. --------------------------------------------------------------------------
  21581.      
  21582.     function InitializeCurrentBlock return BlockInfoType is
  21583.         ClearedBlock :BlockInfoType;
  21584.     begin
  21585.         for t in TokenItem loop
  21586.             ClearedBlock.TokenCount(t) := 0;
  21587.         end loop;
  21588.         ClearedBlock.BlockId.BlockName := null;
  21589.         ClearedBlock.BlockId.KindOfBlock := declare_block;
  21590.         ClearedBlock.BlockId.SpcBdyId := AnonId;
  21591.         ClearedBlock.SetOfLiterals := Literal_Set.Create;
  21592.         ClearedBlock.SetOfDEF_IDs := DEF_ID_Set.Create;
  21593.         return ClearedBlock;
  21594.     end InitializeCurrentBlock;
  21595.      
  21596. --------------------------------------------------------------------------
  21597.      
  21598.     function LineNumber (
  21599.                    Position      :in     MLSP.Source_Position
  21600.     ) return MLSP.Source_Line is
  21601.      
  21602.         -- Get the line number of Position.
  21603.     begin
  21604.         return MLSP.Line (Position.first_location);
  21605.     end LineNumber;
  21606.      
  21607. --------------------------------------------------------------------------
  21608.      
  21609.      
  21610.     function IsSourceRange (
  21611.                    Position :in     MLSP.Source_Position
  21612.     ) return boolean is
  21613.      
  21614.          --| ALGORITHM
  21615.          --| If Position.first_position /= Position.last_position then
  21616.          --|    Position is a range and return true
  21617.          --| else
  21618.          --|    Position is not a range and return false
  21619.      
  21620.     begin
  21621.      return
  21622.           not MLSP."=" (Position.first_location, Position.last_location);
  21623.     end;
  21624.      
  21625. --------------------------------------------------------------------------
  21626.      
  21627.     procedure SetBlockId (
  21628.       ScopeName    :in    Symbol_repNode.Locator;
  21629.       KindOfBlock  :in    BlockKind;
  21630.       SpcBdyId     :in    SpcBdyIdType;
  21631.       Line_Number  :in    MLSP.Source_Line
  21632.     ) is
  21633.     begin
  21634.           -- If the ScopeName is "" then we have an unamed declare block.
  21635.         if SymRepToString (ScopeName) = "" then
  21636.             CurrentBlock.BlockId.BlockName := new  String ' ("");
  21637.         else
  21638.             ExtendQualifiedName (
  21639.               FullyQualifiedName, SymRepToString (ScopeName)
  21640.                                 );
  21641.             CurrentBlock.BlockId.BlockName :=
  21642.               CopyQualifiedName (FullyQualifiedName);
  21643.         end if;
  21644.         CurrentBlock.BlockId.KindOfBlock := KindOfBlock;
  21645.         CurrentBlock.BlockId.SpcBdyId := SpcBdyId;
  21646.         CurrentBlock.BlockId.LineLocation := Line_Number;
  21647.      
  21648.     end SetBlockId;
  21649.      
  21650. --------------------------------------------------------------------------
  21651.      
  21652.     procedure ProcessBlockInfo (
  21653.       BlockInfo: in BlockInfoType
  21654.     ) is
  21655.         Nn      :CT.NnInfoType;
  21656.           --| The counts in Nn represent the counts of operators and
  21657.           --| operands for Literal_Analysis and DEF_ID_Analysis.
  21658.         NnToken :CT.NnInfoType;
  21659.           --| This object keeps the counts of operators and operands
  21660.           --| which pertain to the reserved words and other syntactic
  21661.           --| constructs.
  21662.         Metrics :MetricsRecord;
  21663.         N2Star  :natural := 0;
  21664.     begin
  21665.         if VerboseOn then
  21666.             Put_Line (Standard_Output, "DEF_ID_Analysis ");
  21667.         end if;
  21668.         DEF_ID_Analysis (BlockInfo.SetOfDEF_IDs, Nn, N2Star);
  21669.         if VerboseOn then
  21670.             Put_Line (Standard_Output, "Literal_Analysis");
  21671.         end if;
  21672.         Literal_Analysis (BlockInfo.SetOfLiterals, Nn);
  21673.              CT.ZeroCount (NnToken);
  21674.              C.HalsteadCount (BlockInfo.TokenCount, VerboseOn, NnToken);
  21675.              if VerboseOn then
  21676.                  New_Line (Standard_Output);
  21677.                      Put_Line (Standard_Output,"------------------------------");
  21678.                      Put_Line (Standard_Output,"This separates countable units");
  21679.                      Put_Line (Standard_Output,"------------------------------");
  21680.                      New_Line (Standard_Output);
  21681.              end if;
  21682.      
  21683.              MetricCalculations (
  21684.                CT.AddCounts (Nn, NnToken), N2Star, Metrics
  21685.                                 );
  21686.                   if ToTerminal then
  21687.                         -- This block is needed because the boot seems to
  21688.                    -- have trouble with
  21689.                    -- ReportHeader (UnitName.all,UnitSpec);
  21690.                         -- UnitName.all is causing the problem.
  21691.                       declare
  21692.                      LocalString : constant String :=
  21693.                        UnitName.all(UnitName.all'range);
  21694.                       begin
  21695.                      ReportHeader (LocalString, UnitSpec);
  21696.                       end;
  21697.                   end if;
  21698.      
  21699.                   PrintInfo (BlockInfo.BlockId, Metrics);
  21700.            -- Truncate the current Scope Name.
  21701.         TruncateQualifiedName (FullyQualifiedName);
  21702.     end ProcessBlockInfo;
  21703.      
  21704. --------------------------------------------------------------------------
  21705.      
  21706. end Halstead_Data_Base;
  21707.      
  21708. ::::::::::::::
  21709. hdb.spc
  21710. ::::::::::::::
  21711. -- $Source :/nosc/work/tools/halstead/RCS/utils.spc,v $
  21712. -- $Revision :1.11 $ -- $Date: 85/02/21 08:22:23 $ -- $Author: buddy $
  21713.      
  21714. with St_Diana; use St_Diana;
  21715. with Definitions; use Definitions;
  21716. with ML_Source_Position_Pkg;
  21717.      
  21718. package Halstead_Data_Base is
  21719.      
  21720. --| OVERVIEW
  21721. --| This package holds the major global data structures and subprograms
  21722. --| used to implement the Halstead Complexity Measures.
  21723.      
  21724. --| EFFECTS
  21725. --| This package has the data structures and subprograms used to compute
  21726. --| the Halstead measures.  ProcessBlock organizes the processing of the
  21727. --| block's information.  This entails counting the tokens as either
  21728. --| operators or operands, determining the operand and operator Vocabulary
  21729. --| and counting the total usage of operators and operands.
  21730. --| It also involves counting the number of literals and performing
  21731. --| analysis on all the identifiers in the block.  Keeping track of the
  21732. --| literals is performed by AddLiteral. This maintains a counted set
  21733. --| of all the literals in the current block.  The literal are counted
  21734. --| as operands in the Halstead metrics.
  21735. --| Analyzing the identifiers in the block is done in the subprogram
  21736. --| DEF_ID_ANALYS.The identifiers are classified according to semantic
  21737. --|information provided by DIANA.
  21738.      
  21739. --| TUNING
  21740. --| The procedure IncrementToken should be in lined using a pragma.
  21741.      
  21742. --------------------------------------------------------------------------
  21743. --               VISIBLE OBJECTS
  21744. --------------------------------------------------------------------------
  21745.      
  21746.     package MLSP renames ML_Source_Position_Pkg;
  21747.      
  21748.     CurrentBlock      :BlockInfoType;
  21749.       --| This contains the information about the block currently
  21750.       --| being processed.  When a new block is encountered it is
  21751.       --| this information which gets pushed on the stack.
  21752.      
  21753.     BlockStack        :BlockInfoStack.Stack;
  21754.       --| This structure stacks the information in the current block      .
  21755.       --| Thus information is pushed onto the stack when we enter a
  21756.       --| new block and popped from the stack when we exit a block.
  21757.       --| This is used to reflect the visibility of operators and
  21758.       --| operands.
  21759.      
  21760.     OutermostBlockSeen :boolean;
  21761.       --| This is used to indicate that the outermost scope of the
  21762.       --| compilation unit has been seen.  This is necessary because
  21763.       --| to include the context clauses as adding to the complexity of
  21764.       --| the outermost compilation unit.
  21765.      
  21766.     FullyQualifiedName :StringPtr;
  21767.       --| This is the fully qualified name of the current scope.  This
  21768.       --| string is used in identifying the current scope in the output.
  21769.      
  21770.     UnitName           :StringPtr;
  21771.       --| This is the name of library unit currently being processed.
  21772.       --| It is an access to a string since we don't know how long the
  21773.       --| will be.
  21774.      
  21775.     UnitSpec           :boolean;
  21776.       --| This indicates whether the unit which is currently being
  21777.       --| processed is a specification or a body.
  21778.      
  21779.      
  21780.     VerboseOn          :boolean;
  21781.       --| This boolean is used to control the printing of
  21782.       --| information pertaining to token counting.  This shows
  21783.       --| tokens are counted, and what they are counted as.
  21784.       --| This information is always written to standard output.
  21785.       --| This paramater is set from the command line. The default
  21786.       --| for this is false.
  21787.      
  21788.     ToTerminal   :boolean;
  21789.       --| This boolean is true if the user has not specified an output
  21790.       --| file which means the report is going to standard_output
  21791.       --| which is the terminal.
  21792.      
  21793. --------------------------------------------------------------------------
  21794. --                VISIBLE SUBPROGRAMS
  21795. --------------------------------------------------------------------------
  21796.      
  21797. --------------------------------------------------------------------------
  21798.      
  21799.     procedure InitializeData (  --| This procedure passes the values
  21800.                           --| of certain
  21801.                           --| from the driver to this package which uses
  21802.                           --| it in producing the report.  It needs the
  21803.                           --| the name of the library unit, whether the
  21804.                           --| library unit is a specicification or a body,
  21805.                           --| if the verbose flag is set, and whether the
  21806.                           --| report is going to the terminal.
  21807.      
  21808.        LibraryUnit           :in    String;
  21809.        IsUnitSpec            :in    boolean;
  21810.        VerboseFlag           :in    boolean;
  21811.        ToTerminalFlag        :in    boolean;
  21812.        OuterMostBlockFlag    :in    boolean
  21813.     );
  21814.      
  21815. --------------------------------------------------------------------------
  21816.      
  21817.    procedure ReportHeader  (   --| This prints the header for a Library
  21818.                                --| Unit.
  21819.              UnitName  : String;
  21820.              Spec      : boolean
  21821.    );
  21822.      
  21823. --------------------------------------------------------------------------
  21824.      
  21825.     function InitializeCurrentBlock  --| This function returns a record
  21826.                                      --| of type BlockInfoType which is
  21827.                                      --| initialized.
  21828.     return BlockInfoType;
  21829.      
  21830.     --| OVERVIEW
  21831.     --| This function is used before starting the scan of DIANA and
  21832.     --| then after a Push of CurrentBlock onto the stack.
  21833.      
  21834.     --| EFFECTS
  21835.     --| This function sets the TokenCount for each TokenItem to be 0.
  21836.     --| It also set the LiterSet to be empty and the ListOfDEF_ID to
  21837.     --| empty.
  21838.      
  21839. --------------------------------------------------------------------------
  21840.      
  21841.     procedure IncrementToken ( --| This procedure increments the count of
  21842.                                --| of the given token for the current
  21843.                                --| block.
  21844.      
  21845.               T :in    TokenItem
  21846.                 --| Token whose count is being incremented.
  21847.      );
  21848.      
  21849.      --| OVERVIEW
  21850.      --| This procedure is called during the tree walking when the DIANA
  21851.      --| node which corresponds to the token T has been scanned.
  21852.      
  21853.      --| MODIFIES
  21854.      --| This increments CurrentBlock.TokenCount (T) which is the
  21855.      --| number of occurrences of the token T in the current block.
  21856.      
  21857.      --| TUNING
  21858.      --| This procedure should be pragma inlined.
  21859.      
  21860. --------------------------------------------------------------------------
  21861.      
  21862.     function LineNumber (
  21863.                    Position      :in     MLSP.Source_Position
  21864.     ) return MLSP.Source_Line;
  21865.      
  21866.     --| RAISES
  21867.     --|
  21868.      
  21869.     --| OVERVIEW
  21870.     --| Checks whether Position is a Source_Location or source_range.
  21871.     --| It then returns the line number of the starting position.
  21872.      
  21873.     --| EFFECTS
  21874.     --|
  21875.      
  21876.     --| REQUIRES
  21877.     --|
  21878.      
  21879.     --| MODIFIES
  21880.     --|
  21881.      
  21882.     --| ERRORS
  21883.     --|
  21884.      
  21885.     --| N/A
  21886.     --|
  21887.      
  21888.     --| TUNING
  21889.     --|
  21890.      
  21891.     --| NOTES
  21892.     --|
  21893.      
  21894. --------------------------------------------------------------------------
  21895.      
  21896.     function IsSourceRange (
  21897.                    Position :in     MLSP.Source_Position
  21898.     ) return boolean;
  21899.      
  21900.     --| RAISES
  21901.     --|
  21902.      
  21903.     --| OVERVIEW
  21904.     --| This procedure checks if the Position is a source range.  In
  21905.     --| the diana this indicate that the token had a beginning source
  21906.     --| location and an ending source location.  Other tokens simply
  21907.     --| had a source point which was where the start of the token
  21908.     --| was in the source ( a line number and column position).
  21909.     --| The distinction between source_range and source_point is
  21910.     --| useful for distinguishing certain diana constructs.
  21911.      
  21912. --------------------------------------------------------------------------
  21913.      
  21914.      procedure SetBlockId (  --| This procedure initializes the
  21915.                              --| identifying fields for the block.
  21916.      
  21917.           ScopeName   :in  Symbol_repNode.Locator;
  21918.             --| This is a Locator to the name of the block.
  21919.      
  21920.           KindOfBlock :in  BlockKind;
  21921.             --| This is the kind of block. This can be a procedure,
  21922.             --| function, package, task or declare block.
  21923.      
  21924.           SpcBdyId    :in  SpcBdyIdType;
  21925.             --| This indicates whether the block is a spec or a body.
  21926.      
  21927.           Line_Number :in  MLSP.Source_Line
  21928.      );
  21929.      
  21930.      --| OVERVIEW
  21931.      --| This is used in the tree walk of DIANA when a node is
  21932.      --| scanned which indicates the name and type of the block.
  21933.      --| Typically a DEF_ID will be associated with a package, or
  21934.      --| subprogram, or task.  The information passed to the
  21935.      --| routine is used in the reporting phase.
  21936.      
  21937.      --| MODIFIES
  21938.      --| This updates the BlockId component of CurrentBlock.
  21939.      
  21940.      --| EFFECTS
  21941.      --| The information in BlockId is used in the output routines to
  21942.      --| indicate the block.
  21943.      
  21944. --------------------------------------------------------------------------
  21945.      
  21946.     procedure FreeSpace (   --| Frees all the heap space which this
  21947.                             --| record uses.
  21948.      
  21949.               CurrentBlock :in out BlockInfoType
  21950.     );
  21951.      
  21952. --------------------------------------------------------------------------
  21953.      
  21954.     procedure ProcessBlockInfo (   --| Processes the information gathered
  21955.                                    --| for the current block.
  21956.        BlockInfo :in BlockInfoType
  21957.          --| This is the information for the block.
  21958.     );
  21959.      
  21960.     --| OVERVIEW
  21961.     --| This procedure computes and output the Halstead Metrics for the
  21962.     --| current block.  This procedure is invoked in the DIANA treewalk
  21963.     --| after a node which is a block has been completely processed.
  21964.      
  21965. --------------------------------------------------------------------------
  21966.      
  21967. end Halstead_Data_Base;
  21968.      
  21969. ::::::::::::::
  21970. id_utils.bdy
  21971. ::::::::::::::
  21972. -- $Revision: 1.2 $ -- $Date: 86/02/06 18:05:16 $ -- $Author: buddy $
  21973.      
  21974. with ML_Source_Position_Pkg;
  21975. package body Identifier_Utilities is
  21976.     package MLSP renames ML_Source_Position_Pkg;
  21977.      
  21978. --| OVERVIEW
  21979. --| This package has utilities which are used in processing
  21980. --| DEF_ID's.
  21981.      
  21982.     function Is_Source_Position_Null (
  21983.         Position :in    MLSP.Source_Position
  21984.     ) return boolean;
  21985.      
  21986.     --| OVERVIEW
  21987.     --| This procedure returns true if the source position passed in
  21988.     --| is null.  This means that column and line of the
  21989.     --| Position.first_location is 0.
  21990.      
  21991.     function Is_Id_Null (
  21992.       Id :in     DEF_ID.Locator
  21993.     ) return boolean is
  21994.     begin
  21995.         return Is_Source_Position_Null (lx_srcpos (id));
  21996.     end;
  21997. --------------------------------------------------------------------------
  21998.      
  21999.     function Is_Source_Position_Null (
  22000.         Position :in    MLSP.Source_Position
  22001.     ) return boolean is
  22002.     begin
  22003.         return MLSP."=" (Position.first_location,0);
  22004.     end;
  22005. end Identifier_Utilities;
  22006.      
  22007.      
  22008. --------------------------------------------------------------------------
  22009.      
  22010.      
  22011. ::::::::::::::
  22012. id_utils.spc
  22013. ::::::::::::::
  22014. with ST_DIANA; use ST_DIANA;
  22015.  
  22016. package Identifier_Utilities is
  22017. --| OVERVIEW
  22018. --| This package has utilities which are used in processing
  22019. --| DEF_ID's.
  22020.      
  22021.     function Is_Id_Null (
  22022.       Id :in     DEF_ID.Locator
  22023.     ) return boolean ;
  22024.      
  22025. end Identifier_Utilities;
  22026. ::::::::::::::
  22027. ihagg_nam.dat
  22028. ::::::::::::::
  22029. -- Begin: IHagg_named dat ---------------------------------------------------
  22030.      
  22031. with ST_DIANA; use ST_DIANA;
  22032.              with Unchecked_Deallocation;
  22033. package agg_named_IH is
  22034.       type RecType is record
  22035.         ih_inagg_named : boolean;
  22036.       end record;
  22037.       R : RecType;
  22038. end agg_named_IH;
  22039. -- End: IHagg_named dat -----------------------------------------------------
  22040. ::::::::::::::
  22041. ihblock_s.dat
  22042. ::::::::::::::
  22043. -- Begin: IHblock_stm dat ---------------------------------------------------
  22044.      
  22045. with ST_DIANA; use ST_DIANA;
  22046.              with Unchecked_Deallocation;
  22047. package block_stm_IH is
  22048.       type RecType is record
  22049.         ih_inblock : boolean;
  22050.       end record;
  22051.       R : RecType;
  22052. end block_stm_IH;
  22053. -- End: IHblock_stm dat -----------------------------------------------------
  22054. ::::::::::::::
  22055. ihcase_al.dat
  22056. ::::::::::::::
  22057. -- Begin: IHcase_alternative dat ---------------------------------------------------
  22058.      
  22059. with ST_DIANA; use ST_DIANA;
  22060.              with Unchecked_Deallocation;
  22061. package case_alternative_IH is
  22062.       type RecType is record
  22063.         ih_incase_alternative : boolean;
  22064.       end record;
  22065.       R : RecType;
  22066. end case_alternative_IH;
  22067. -- End: IHcase_alternative dat -----------------------------------------------------
  22068. ::::::::::::::
  22069. ihgeneric.dat
  22070. ::::::::::::::
  22071. -- Begin: IHgeneric_header dat ---------------------------------------------------
  22072.      
  22073. with ST_DIANA; use ST_DIANA;
  22074.              with Unchecked_Deallocation;
  22075. package generic_header_IH is
  22076.       type RecType is record
  22077.         ih_ingeneric_param : boolean;
  22078.       end record;
  22079.       R : RecType;
  22080. end generic_header_IH;
  22081. -- End: IHgeneric_header dat -----------------------------------------------------
  22082. ::::::::::::::
  22083. ihhandler.dat
  22084. ::::::::::::::
  22085. -- Begin: IHhandler_alternative dat ---------------------------------------------------
  22086.      
  22087. with ST_DIANA; use ST_DIANA;
  22088.              with Unchecked_Deallocation;
  22089. package handler_alternative_IH is
  22090.       type RecType is record
  22091.         ih_inhandler_alternative : boolean;
  22092.       end record;
  22093.       R : RecType;
  22094. end handler_alternative_IH;
  22095. -- End: IHhandler_alternative dat -----------------------------------------------------
  22096. ::::::::::::::
  22097. ihinner_r.dat
  22098. ::::::::::::::
  22099. -- Begin: IHinner_record dat ---------------------------------------------------
  22100.      
  22101. with ST_DIANA; use ST_DIANA;
  22102.              with Unchecked_Deallocation;
  22103. package inner_record_IH is
  22104.       type RecType is record
  22105.         ih_in_variant : boolean;
  22106.       end record;
  22107.       R : RecType;
  22108. end inner_record_IH;
  22109. -- End: IHinner_record dat -----------------------------------------------------
  22110. ::::::::::::::
  22111. ihseries_.dat
  22112. ::::::::::::::
  22113. -- Begin: IHSERIES_UNIT dat ---------------------------------------------------
  22114.      
  22115. with ST_DIANA; use ST_DIANA;
  22116.              with Unchecked_Deallocation;
  22117. package SERIES_UNIT_IH is
  22118.       type RecType is record
  22119.         ih_inlist : boolean;
  22120.       end record;
  22121.       R : RecType;
  22122. end SERIES_UNIT_IH;
  22123. -- End: IHSERIES_UNIT dat -----------------------------------------------------
  22124. ::::::::::::::
  22125. ihsubtype.dat
  22126. ::::::::::::::
  22127. -- Begin: IHsubtype_decl dat ---------------------------------------------------
  22128.      
  22129. with ST_DIANA; use ST_DIANA;
  22130.              with Unchecked_Deallocation;
  22131. package subtype_decl_IH is
  22132.       type RecType is record
  22133.         ih_in_subtype_decl : boolean;
  22134.       end record;
  22135.       R : RecType;
  22136. end subtype_decl_IH;
  22137. -- End: IHsubtype_decl dat -----------------------------------------------------
  22138. ::::::::::::::
  22139. ihtask_de.dat
  22140. ::::::::::::::
  22141. -- Begin: IHtask_decl dat ---------------------------------------------------
  22142.      
  22143. with ST_DIANA; use ST_DIANA;
  22144.              with Unchecked_Deallocation;
  22145. package task_decl_IH is
  22146.       type RecType is record
  22147.         ih_intask_decl : boolean;
  22148.       end record;
  22149.       R : RecType;
  22150. end task_decl_IH;
  22151. -- End: IHtask_decl dat -----------------------------------------------------
  22152. ::::::::::::::
  22153. ihtype_de.dat
  22154. ::::::::::::::
  22155. -- Begin: IHtype_decl dat ---------------------------------------------------
  22156.      
  22157. with ST_DIANA; use ST_DIANA;
  22158.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  22159. package type_decl_IH is
  22160.       type RecType is record
  22161.         ih_typespec : Anykind;
  22162.         ih_basetype : DEF_ID.Locator;
  22163.       end record;
  22164.       R : RecType;
  22165. end type_decl_IH;
  22166. -- End: IHtype_decl dat -----------------------------------------------------
  22167. ::::::::::::::
  22168. ihvariabl.dat
  22169. ::::::::::::::
  22170. -- Begin: IHvariable_decl dat ---------------------------------------------------
  22171.      
  22172. with ST_DIANA; use ST_DIANA;
  22173.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  22174. package variable_decl_IH is
  22175.       type RecType is record
  22176.         ih_vartype : MARK.Locator;
  22177.         ih_init : boolean;
  22178.       end record;
  22179.       R : RecType;
  22180. end variable_decl_IH;
  22181. -- End: IHvariable_decl dat -----------------------------------------------------
  22182. ::::::::::::::
  22183. obj.bdy
  22184. ::::::::::::::
  22185. -- Begin: SCOBJECT_TYPE bdy ---------------------------------------------------
  22186.      
  22187. with Halstead_Data_Base;  use Halstead_Data_Base;
  22188. with Definitions; use Definitions;
  22189.              with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  22190. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22191. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  22192.      
  22193.                with subtype_decl_IH;
  22194.                          package body OBJECT_TYPE_Pkg is
  22195.      
  22196.      
  22197.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator) is
  22198.     begin
  22199.         case Kind(Root) is
  22200.           when object_type_anon_arrayKind => Scan_object_type_anon_array(Root);
  22201.           when object_type_anon_taskKind => Scan_object_type_anon_task(Root);
  22202.           when object_type_constrainedKind => Scan_object_type_constrained(Root);
  22203.           when object_type_indexKind => Scan_object_type_index(Root);
  22204.           when object_type_rangeKind => Scan_object_type_range(Root);
  22205.           when others => null;
  22206.         end case;
  22207.     end Scan_OBJECT_TYPE;
  22208.      
  22209.      
  22210.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator) is
  22211.     begin
  22212.         Scan_constrained_array_type(as_array_type_spec(Root));
  22213.      
  22214.     end Scan_object_type_anon_array;
  22215.      
  22216.      
  22217.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator) is
  22218.     begin
  22219.         Scan_task_spec(as_task_spec(Root));
  22220.      
  22221.     end Scan_object_type_anon_task;
  22222.      
  22223.      
  22224.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator) is
  22225.     begin
  22226.       if not MARK.IsNull(as_constrained_name(Root)) then
  22227.         Scan_MARK(as_constrained_name(Root));
  22228.       end if;
  22229.       if not CONSTRAINT.IsNull(as_constraint(Root)) then
  22230.      
  22231.      
  22232.       if (subtype_decl_IH.R.ih_in_subtype_decl)
  22233.            and then
  22234.          (Kind (as_constraint (root)) not in dscrmt_constraintKind)
  22235.          then
  22236.           IncrementToken (rangez);
  22237.       end if;
  22238.      
  22239.      
  22240.         Scan_CONSTRAINT(as_constraint(Root));
  22241.       end if;
  22242.      
  22243.     end Scan_object_type_constrained;
  22244.      
  22245.      
  22246.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator) is
  22247.     begin
  22248.       if not MARK.IsNull(as_index_name(Root)) then
  22249.         Scan_MARK(as_index_name(Root));
  22250.      
  22251.      
  22252.         IncrementToken (rangez);
  22253.      
  22254.      
  22255.       end if;
  22256.      
  22257.     end Scan_object_type_index;
  22258.      
  22259.      
  22260.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator) is
  22261.     begin
  22262.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  22263.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  22264.       end if;
  22265.      
  22266.     end Scan_object_type_range;
  22267.      
  22268. end OBJECT_TYPE_Pkg;
  22269. -- End: SCOBJECT_TYPE bdy -----------------------------------------------------
  22270. ::::::::::::::
  22271. obj.spc
  22272. ::::::::::::::
  22273. -- Begin: SCOBJECT_TYPE spc ---------------------------------------------------
  22274.      
  22275. with ST_DIANA; use ST_DIANA;
  22276.              package OBJECT_TYPE_Pkg is
  22277.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator);
  22278.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator);
  22279.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator);
  22280.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator);
  22281.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator);
  22282.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator);
  22283. end OBJECT_TYPE_Pkg;
  22284. -- End: SCOBJECT_TYPE spc -----------------------------------------------------
  22285. ::::::::::::::
  22286. scagg_com.bdy
  22287. ::::::::::::::
  22288. -- Begin: SCAGG_COMPONENT bdy ---------------------------------------------------
  22289.      
  22290. with Halstead_Data_Base;  use Halstead_Data_Base;
  22291. with Definitions; use Definitions;
  22292.              with SERIES_UNIT_IH;
  22293. with agg_named_IH;
  22294. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22295. with CHOICE_Pkg; use CHOICE_Pkg;
  22296. package body AGG_COMPONENT_Pkg is
  22297.      
  22298.      
  22299.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator) is
  22300.     begin
  22301.         case Kind(Root) is
  22302.           when agg_canonicalKind => Scan_agg_canonical(Root);
  22303.           when agg_expKind => Scan_agg_exp(Root);
  22304.           when agg_namedKind => Scan_agg_named(Root);
  22305.           when others => null;
  22306.         end case;
  22307.     end Scan_AGG_COMPONENT;
  22308.      
  22309.      
  22310.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator) is
  22311.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22312.     begin
  22313.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22314.      
  22315.      
  22316.     SERIES_UNIT_IH.R.ih_inlist := false;
  22317.      
  22318.      
  22319.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22320.      
  22321.     end Scan_agg_canonical;
  22322.      
  22323.      
  22324.     procedure Scan_agg_exp(Root : agg_expNode.Locator) is
  22325.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22326.     begin
  22327.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22328.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22329.         Scan_NAME_EXP(as_exp(Root));
  22330.       end if;
  22331.      
  22332.      
  22333.     SERIES_UNIT_IH.R.ih_inlist := false;
  22334.      
  22335.      
  22336.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22337.      
  22338.     end Scan_agg_exp;
  22339.      
  22340.      
  22341.     procedure Scan_agg_named(Root : agg_namedNode.Locator) is
  22342.         as_choice_s_List : SeqOfCHOICE.Generator;
  22343.         as_choice_s_Item : CHOICE.Locator;
  22344.         use SeqOfCHOICE;
  22345.         Old_agg_named_IHR : agg_named_IH.RecType := agg_named_IH.R;
  22346.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22347.     begin
  22348.         agg_named_IH.R.ih_inagg_named :=  false ;
  22349.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22350.       if not SeqOfCHOICE.IsNull(as_choice_s(Root)) then
  22351.      
  22352.      
  22353.      agg_named_IH.R.ih_inagg_named := true;
  22354.      
  22355.      
  22356.         StartForward(as_choice_s(Root), as_choice_s_List);
  22357.         while not Finished(as_choice_s_List) loop
  22358.             as_choice_s_Item := Cell(as_choice_s_List);
  22359.      
  22360.      
  22361.     if SERIES_UNIT_IH.R.ih_inlist then
  22362.         IncrementToken (barz);
  22363.     end if;
  22364.     SERIES_UNIT_IH.R.ih_inlist := true;
  22365.      
  22366.      
  22367.      
  22368.             Scan_CHOICE(as_choice_s_Item);
  22369.             Forward(as_choice_s_List);
  22370.         end loop;
  22371.         EndIterate(as_choice_s_List);
  22372.      
  22373.      
  22374.      IncrementToken (arrowz);
  22375.      agg_named_IH.R.ih_inagg_named := false;
  22376.      
  22377.      
  22378.       end if;
  22379.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22380.         Scan_NAME_EXP(as_exp(Root));
  22381.       end if;
  22382.      
  22383.      
  22384.     SERIES_UNIT_IH.R.ih_inlist := false;
  22385.      
  22386.      
  22387.         agg_named_IH.R := Old_agg_named_IHR;
  22388.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22389.      
  22390.     end Scan_agg_named;
  22391.      
  22392. end AGG_COMPONENT_Pkg;
  22393. -- End: SCAGG_COMPONENT bdy -----------------------------------------------------
  22394. ::::::::::::::
  22395. scagg_com.spc
  22396. ::::::::::::::
  22397. -- Begin: SCAGG_COMPONENT spc ---------------------------------------------------
  22398.      
  22399. with ST_DIANA; use ST_DIANA;
  22400.              package AGG_COMPONENT_Pkg is
  22401.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator);
  22402.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator);
  22403.     procedure Scan_agg_exp(Root : agg_expNode.Locator);
  22404.     procedure Scan_agg_named(Root : agg_namedNode.Locator);
  22405. end AGG_COMPONENT_Pkg;
  22406. -- End: SCAGG_COMPONENT spc -----------------------------------------------------
  22407. ::::::::::::::
  22408. scalterna.bdy
  22409. ::::::::::::::
  22410. -- Begin: SCALTERNATIVE bdy ---------------------------------------------------
  22411.      
  22412. with Halstead_Data_Base;  use Halstead_Data_Base;
  22413. with Definitions; use Definitions;
  22414.              with SERIES_UNIT_IH;
  22415. with case_alternative_IH;
  22416. with handler_alternative_IH;
  22417. with CHOICE_Pkg; use CHOICE_Pkg;
  22418. with STM_Pkg; use STM_Pkg;
  22419. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22420. with ITEM_Pkg; use ITEM_Pkg;
  22421. package body ALTERNATIVE_Pkg is
  22422.      
  22423.      
  22424.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator) is
  22425.     begin
  22426.         case Kind(Root) is
  22427.           when case_alternativeKind => Scan_case_alternative(Root);
  22428.           when cond_alternativeKind => Scan_cond_alternative(Root);
  22429.           when handler_alternativeKind => Scan_handler_alternative(Root);
  22430.           when pragma_alternativeKind => Scan_pragma_alternative(Root);
  22431.           when select_alternativeKind => Scan_select_alternative(Root);
  22432.           when others => null;
  22433.         end case;
  22434.     end Scan_ALTERNATIVE;
  22435.      
  22436.      
  22437.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator) is
  22438.         as_case_choice_s_List : SeqOfCHOICE.Generator;
  22439.         as_case_choice_s_Item : CHOICE.Locator;
  22440.         use SeqOfCHOICE;
  22441.         as_stm_s_List : SeqOfSTM.Generator;
  22442.         as_stm_s_Item : STM.Locator;
  22443.         use SeqOfSTM;
  22444.         Old_case_alternative_IHR : case_alternative_IH.RecType := case_alternative_IH.R;
  22445.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22446.     begin
  22447.         case_alternative_IH.R.ih_incase_alternative :=  false ;
  22448.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22449.      
  22450.      
  22451.        case_alternative_IH.R.ih_incase_alternative := true;
  22452.        IncrementToken (when_case_stmz);
  22453.        IncrementToken (arrowz);
  22454.      
  22455.      
  22456.       if not SeqOfCHOICE.IsNull(as_case_choice_s(Root)) then
  22457.         StartForward(as_case_choice_s(Root), as_case_choice_s_List);
  22458.         while not Finished(as_case_choice_s_List) loop
  22459.             as_case_choice_s_Item := Cell(as_case_choice_s_List);
  22460.      
  22461.      
  22462.     if SERIES_UNIT_IH.R.ih_inlist then
  22463.         IncrementToken (barz);
  22464.     end if;
  22465.     SERIES_UNIT_IH.R.ih_inlist := true;
  22466.      
  22467.      
  22468.             Scan_CHOICE(as_case_choice_s_Item);
  22469.             Forward(as_case_choice_s_List);
  22470.         end loop;
  22471.         EndIterate(as_case_choice_s_List);
  22472.       end if;
  22473.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22474.         StartForward(as_stm_s(Root), as_stm_s_List);
  22475.         while not Finished(as_stm_s_List) loop
  22476.             as_stm_s_Item := Cell(as_stm_s_List);
  22477.             Scan_STM(as_stm_s_Item);
  22478.             Forward(as_stm_s_List);
  22479.         end loop;
  22480.         EndIterate(as_stm_s_List);
  22481.       end if;
  22482.      
  22483.      
  22484.       case_alternative_IH.R.ih_incase_alternative := false;
  22485.      
  22486.      
  22487.         case_alternative_IH.R := Old_case_alternative_IHR;
  22488.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22489.      
  22490.     end Scan_case_alternative;
  22491.      
  22492.      
  22493.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator) is
  22494.         as_stm_s_List : SeqOfSTM.Generator;
  22495.         as_stm_s_Item : STM.Locator;
  22496.         use SeqOfSTM;
  22497.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22498.     begin
  22499.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22500.      
  22501.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  22502.         then
  22503.      
  22504.     if IsSourceRange (lx_srcpos(root)) then
  22505.           IncrementToken (elsifz);
  22506.     end if;
  22507.      
  22508.         end if;
  22509.      
  22510.         if NAME_EXP.IsNull(as_cond_exp_void(Root))
  22511.         then
  22512.      
  22513.       IncrementToken (else_ifz);
  22514.      
  22515.         end if;
  22516.       if not NAME_EXP.IsNull(as_cond_exp_void(Root)) then
  22517.         Scan_NAME_EXP(as_cond_exp_void(Root));
  22518.       end if;
  22519.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22520.      
  22521.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  22522.         then
  22523.      
  22524.       IncrementToken (thenz);
  22525.      
  22526.         end if;
  22527.         StartForward(as_stm_s(Root), as_stm_s_List);
  22528.         while not Finished(as_stm_s_List) loop
  22529.             as_stm_s_Item := Cell(as_stm_s_List);
  22530.             Scan_STM(as_stm_s_Item);
  22531.             Forward(as_stm_s_List);
  22532.         end loop;
  22533.         EndIterate(as_stm_s_List);
  22534.       end if;
  22535.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22536.      
  22537.     end Scan_cond_alternative;
  22538.      
  22539.      
  22540.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator) is
  22541.         as_handler_choice_s_List : SeqOfCHOICE.Generator;
  22542.         as_handler_choice_s_Item : CHOICE.Locator;
  22543.         use SeqOfCHOICE;
  22544.         as_stm_s_List : SeqOfSTM.Generator;
  22545.         as_stm_s_Item : STM.Locator;
  22546.         use SeqOfSTM;
  22547.         Old_handler_alternative_IHR : handler_alternative_IH.RecType := handler_alternative_IH.R;
  22548.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22549.     begin
  22550.         handler_alternative_IH.R.ih_inhandler_alternative :=  false ;
  22551.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22552.      
  22553.      
  22554.        handler_alternative_IH.R.ih_inhandler_alternative := true;
  22555.        IncrementToken (when_exceptionz);
  22556.        IncrementToken (arrowz);
  22557.      
  22558.      
  22559.       if not SeqOfCHOICE.IsNull(as_handler_choice_s(Root)) then
  22560.         StartForward(as_handler_choice_s(Root), as_handler_choice_s_List);
  22561.         while not Finished(as_handler_choice_s_List) loop
  22562.             as_handler_choice_s_Item := Cell(as_handler_choice_s_List);
  22563.      
  22564.      
  22565.       if SERIES_UNIT_IH.R.ih_inlist then
  22566.           IncrementToken (barz);
  22567.       end if;
  22568.       SERIES_UNIT_IH.R.ih_inlist := true;
  22569.      
  22570.      
  22571.             Scan_CHOICE(as_handler_choice_s_Item);
  22572.             Forward(as_handler_choice_s_List);
  22573.         end loop;
  22574.         EndIterate(as_handler_choice_s_List);
  22575.       end if;
  22576.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22577.         StartForward(as_stm_s(Root), as_stm_s_List);
  22578.         while not Finished(as_stm_s_List) loop
  22579.             as_stm_s_Item := Cell(as_stm_s_List);
  22580.             Scan_STM(as_stm_s_Item);
  22581.             Forward(as_stm_s_List);
  22582.         end loop;
  22583.         EndIterate(as_stm_s_List);
  22584.       end if;
  22585.      
  22586.      
  22587.       handler_alternative_IH.R.ih_inhandler_alternative := false;
  22588.       SERIES_UNIT_IH.R.ih_inlist := false;
  22589.      
  22590.      
  22591.         handler_alternative_IH.R := Old_handler_alternative_IHR;
  22592.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22593.      
  22594.     end Scan_handler_alternative;
  22595.      
  22596.      
  22597.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator) is
  22598.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22599.     begin
  22600.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22601.       if not pragma_declNode.IsNull(as_pragma_alternative(Root)) then
  22602.         Scan_pragma_decl(as_pragma_alternative(Root));
  22603.       end if;
  22604.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22605.      
  22606.     end Scan_pragma_alternative;
  22607.      
  22608.      
  22609.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator) is
  22610.         as_stm_s_List : SeqOfSTM.Generator;
  22611.         as_stm_s_Item : STM.Locator;
  22612.         use SeqOfSTM;
  22613.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22614.     begin
  22615.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22616.       if not NAME_EXP.IsNull(as_select_exp_void(Root)) then
  22617.      
  22618.      
  22619.        IncrementToken (when_selectz);
  22620.      
  22621.      
  22622.         Scan_NAME_EXP(as_select_exp_void(Root));
  22623.      
  22624.      
  22625.      IncrementToken (arrowz);
  22626.      
  22627.      
  22628.       end if;
  22629.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22630.         StartForward(as_stm_s(Root), as_stm_s_List);
  22631.         while not Finished(as_stm_s_List) loop
  22632.             as_stm_s_Item := Cell(as_stm_s_List);
  22633.      
  22634.      
  22635.     if SERIES_UNIT_IH.R.ih_inlist then
  22636.         IncrementToken (or_selectz);
  22637.     end if;
  22638.     SERIES_UNIT_IH.R.ih_inlist := true;
  22639.      
  22640.      
  22641.             Scan_STM(as_stm_s_Item);
  22642.             Forward(as_stm_s_List);
  22643.         end loop;
  22644.         EndIterate(as_stm_s_List);
  22645.       end if;
  22646.      
  22647.      
  22648.   SERIES_UNIT_IH.R.ih_inlist := false;
  22649.      
  22650.      
  22651.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22652.      
  22653.     end Scan_select_alternative;
  22654.      
  22655. end ALTERNATIVE_Pkg;
  22656. -- End: SCALTERNATIVE bdy -----------------------------------------------------
  22657. ::::::::::::::
  22658. scalterna.spc
  22659. ::::::::::::::
  22660. -- Begin: SCALTERNATIVE spc ---------------------------------------------------
  22661.      
  22662. with ST_DIANA; use ST_DIANA;
  22663.              package ALTERNATIVE_Pkg is
  22664.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator);
  22665.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator);
  22666.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator);
  22667.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator);
  22668.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator);
  22669.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator);
  22670. end ALTERNATIVE_Pkg;
  22671. -- End: SCALTERNATIVE spc -----------------------------------------------------
  22672. ::::::::::::::
  22673. scblock_s.bdy
  22674. ::::::::::::::
  22675. -- Begin: SCBLOCK_STUB bdy ---------------------------------------------------
  22676.      
  22677. with Halstead_Data_Base;  use Halstead_Data_Base;
  22678. with Definitions; use Definitions;
  22679.              with ITEM_Pkg; use ITEM_Pkg;
  22680. with STM_Pkg; use STM_Pkg;
  22681. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  22682.      
  22683.                with BLOCK_STM_IH;
  22684.                with Source_Position_Utilities;
  22685.                          package body BLOCK_STUB_Pkg is
  22686.      
  22687.      
  22688.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator) is
  22689.     begin
  22690.         case Kind(Root) is
  22691.           when body_blockKind => Scan_body_block(Root);
  22692.           when body_stubKind => Scan_body_stub(Root);
  22693.           when others => null;
  22694.         end case;
  22695.     end Scan_BLOCK_STUB;
  22696.      
  22697.      
  22698.     procedure Scan_body_block(Root : body_blockNode.Locator) is
  22699.         as_item_s_List : SeqOfITEM.Generator;
  22700.         as_item_s_Item : ITEM.Locator;
  22701.         use SeqOfITEM;
  22702.         as_stm_s_List : SeqOfSTM.Generator;
  22703.         as_stm_s_Item : STM.Locator;
  22704.         use SeqOfSTM;
  22705.         as_handler_s_List : SeqOfhandler_alternativeNode.Generator;
  22706.         as_handler_s_Item : handler_alternativeNode.Locator;
  22707.         use SeqOfhandler_alternativeNode;
  22708.     begin
  22709.       if not SeqOfITEM.IsNull(as_item_s(Root)) then
  22710.      
  22711.      
  22712.      if block_stm_IH.R.ih_inblock then
  22713.          IncrementToken (declarez);
  22714.          block_stm_IH.R.ih_inblock := false;
  22715.      end if;
  22716.      
  22717.      
  22718.         StartForward(as_item_s(Root), as_item_s_List);
  22719.         while not Finished(as_item_s_List) loop
  22720.             as_item_s_Item := Cell(as_item_s_List);
  22721.             Scan_ITEM(as_item_s_Item);
  22722.             Forward(as_item_s_List);
  22723.         end loop;
  22724.         EndIterate(as_item_s_List);
  22725.       end if;
  22726.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22727.      
  22728.      
  22729.     IncrementToken (beginz);
  22730.      
  22731.      
  22732.         StartForward(as_stm_s(Root), as_stm_s_List);
  22733.         while not Finished(as_stm_s_List) loop
  22734.             as_stm_s_Item := Cell(as_stm_s_List);
  22735.             Scan_STM(as_stm_s_Item);
  22736.             Forward(as_stm_s_List);
  22737.         end loop;
  22738.         EndIterate(as_stm_s_List);
  22739.       end if;
  22740.       if not SeqOfhandler_alternativeNode.IsNull(as_handler_s(Root)) then
  22741.      
  22742.      
  22743.      IncrementToken (exceptionz);
  22744.      
  22745.      
  22746.         StartForward(as_handler_s(Root), as_handler_s_List);
  22747.         while not Finished(as_handler_s_List) loop
  22748.             as_handler_s_Item := Cell(as_handler_s_List);
  22749.             Scan_handler_alternative(as_handler_s_Item);
  22750.             Forward(as_handler_s_List);
  22751.         end loop;
  22752.         EndIterate(as_handler_s_List);
  22753.       end if;
  22754.      
  22755.      
  22756.    if not Source_Position_Utilities.Is_Srcpos_Null (lx_srcpos (root)) then
  22757.        IncrementToken (end_beginz);
  22758.    end if;
  22759.      
  22760.      
  22761.      
  22762.     end Scan_body_block;
  22763.      
  22764.      
  22765.     procedure Scan_body_stub(Root : body_stubNode.Locator) is
  22766.     begin
  22767.      
  22768.      
  22769.       --- should be is_separatez not is_packagez
  22770.       IncrementToken (is_separatez);
  22771.       IncrementToken (separatez);
  22772.      
  22773.      
  22774.      
  22775.     end Scan_body_stub;
  22776.      
  22777. end BLOCK_STUB_Pkg;
  22778. -- End: SCBLOCK_STUB bdy -----------------------------------------------------
  22779.      
  22780. ::::::::::::::
  22781. scblock_s.spc
  22782. ::::::::::::::
  22783. -- Begin: SCBLOCK_STUB spc ---------------------------------------------------
  22784.      
  22785. with ST_DIANA; use ST_DIANA;
  22786.              package BLOCK_STUB_Pkg is
  22787.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator);
  22788.     procedure Scan_body_block(Root : body_blockNode.Locator);
  22789.     procedure Scan_body_stub(Root : body_stubNode.Locator);
  22790. end BLOCK_STUB_Pkg;
  22791. -- End: SCBLOCK_STUB spc -----------------------------------------------------
  22792. ::::::::::::::
  22793. scchoice.bdy
  22794. ::::::::::::::
  22795. -- Begin: SCCHOICE bdy ---------------------------------------------------
  22796.      
  22797. with Halstead_Data_Base;  use Halstead_Data_Base;
  22798. with Definitions; use Definitions;
  22799.              with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  22800. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22801.      
  22802.           with agg_named_IH;
  22803.           with case_alternative_IH;
  22804.           with handler_alternative_IH;
  22805.           with inner_record_IH;
  22806.                          package body CHOICE_Pkg is
  22807.      
  22808.      
  22809.     procedure Scan_CHOICE(Root : CHOICE.Locator) is
  22810.     begin
  22811.         case Kind(Root) is
  22812.           when ch_discrete_rangeKind => Scan_ch_discrete_range(Root);
  22813.           when ch_expKind => Scan_ch_exp(Root);
  22814.           when ch_othersKind => Scan_ch_others(Root);
  22815.           when others => null;
  22816.         end case;
  22817.     end Scan_CHOICE;
  22818.      
  22819.      
  22820.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator) is
  22821.     begin
  22822.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  22823.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  22824.       end if;
  22825.      
  22826.     end Scan_ch_discrete_range;
  22827.      
  22828.      
  22829.     procedure Scan_ch_exp(Root : ch_expNode.Locator) is
  22830.     begin
  22831.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22832.         Scan_NAME_EXP(as_exp(Root));
  22833.       end if;
  22834.      
  22835.     end Scan_ch_exp;
  22836.      
  22837.      
  22838.     procedure Scan_ch_others(Root : ch_othersNode.Locator) is
  22839.     begin
  22840.      
  22841.      
  22842.      if agg_named_IH.R.ih_inagg_named then
  22843.         IncrementToken (others_aggregatez);
  22844.      end if;
  22845.      if case_alternative_IH.R.ih_incase_alternative then
  22846.         IncrementToken (others_casez);
  22847.      end if;
  22848.      if handler_alternative_IH.R.ih_inhandler_alternative then
  22849.          IncrementToken (others_exceptionz);
  22850.      end if;
  22851.      if inner_record_IH.R.ih_in_variant then
  22852.          IncrementToken (others_variantz);
  22853.      end if;
  22854.      
  22855.      
  22856.      
  22857.     end Scan_ch_others;
  22858.      
  22859. end CHOICE_Pkg;
  22860. -- End: SCCHOICE bdy -----------------------------------------------------
  22861. ::::::::::::::
  22862. scchoice.spc
  22863. ::::::::::::::
  22864. -- Begin: SCCHOICE spc ---------------------------------------------------
  22865.      
  22866. with ST_DIANA; use ST_DIANA;
  22867.              package CHOICE_Pkg is
  22868.     procedure Scan_CHOICE(Root : CHOICE.Locator);
  22869.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator);
  22870.     procedure Scan_ch_exp(Root : ch_expNode.Locator);
  22871.     procedure Scan_ch_others(Root : ch_othersNode.Locator);
  22872. end CHOICE_Pkg;
  22873. -- End: SCCHOICE spc -----------------------------------------------------
  22874. ::::::::::::::
  22875. sccomp_un.bdy
  22876. ::::::::::::::
  22877. -- Begin: SCCOMP_UNIT_CLASS bdy ---------------------------------------------------
  22878.      
  22879. with Halstead_Data_Base;  use Halstead_Data_Base;
  22880. with Definitions; use Definitions;
  22881.              with ITEM_Pkg; use ITEM_Pkg;
  22882. package body COMP_UNIT_CLASS_Pkg is
  22883.      
  22884.      
  22885.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator) is
  22886.     begin
  22887.         case Kind(Root) is
  22888.           when comp_unitKind => Scan_comp_unit(Root);
  22889.           when others => null;
  22890.         end case;
  22891.     end Scan_COMP_UNIT_CLASS;
  22892.      
  22893.      
  22894.     procedure Scan_comp_unit(Root : comp_unitNode.Locator) is
  22895.         as_context_List : SeqOfITEM.Generator;
  22896.         as_context_Item : ITEM.Locator;
  22897.         use SeqOfITEM;
  22898.         as_pragma_s_List : SeqOfpragma_declNode.Generator;
  22899.         as_pragma_s_Item : pragma_declNode.Locator;
  22900.         use SeqOfpragma_declNode;
  22901.     begin
  22902.      
  22903.      
  22904.      
  22905.      CurrentBlock := InitializeCurrentBlock;
  22906.      BlockStack := BlockInfoStack.Create;
  22907.        -- This adds a dummy frame on the stack so that it is not necessary
  22908.        -- to check when popping the stack at the end of the program
  22909.        -- if the stack has at least one record.
  22910.      BlockInfoStack.Push(BlockStack, CurrentBlock);
  22911.      if Kind (as_unit_body (root)) in subp_declKind then
  22912.          if Kind (as_subp_designator
  22913.             (as_unit_body (root))) in proc_idKind
  22914.             then
  22915.              SetBlockId (lx_symrep
  22916.                            (as_subp_designator (as_unit_body (root))),
  22917.                          procedure_block,
  22918.                          SpcId,
  22919.                          LineNumber (lx_srcpos (as_unit_body (root)))
  22920.                          );
  22921.          else
  22922.              SetBlockId (lx_symrep
  22923.                            (as_subp_designator (as_unit_body (root))),
  22924.                          function_block,
  22925.                          SpcId,
  22926.                          LineNumber (lx_srcpos (as_unit_body (root)))
  22927.                          );
  22928.          end if;
  22929.      
  22930.      end if;
  22931.      
  22932.      
  22933.       if not SeqOfITEM.IsNull(as_context(Root)) then
  22934.         StartForward(as_context(Root), as_context_List);
  22935.         while not Finished(as_context_List) loop
  22936.             as_context_Item := Cell(as_context_List);
  22937.             Scan_ITEM(as_context_Item);
  22938.             Forward(as_context_List);
  22939.         end loop;
  22940.         EndIterate(as_context_List);
  22941.       end if;
  22942.       if not SeqOfpragma_declNode.IsNull(as_pragma_s(Root)) then
  22943.         StartForward(as_pragma_s(Root), as_pragma_s_List);
  22944.         while not Finished(as_pragma_s_List) loop
  22945.             as_pragma_s_Item := Cell(as_pragma_s_List);
  22946.             Scan_pragma_decl(as_pragma_s_Item);
  22947.             Forward(as_pragma_s_List);
  22948.         end loop;
  22949.         EndIterate(as_pragma_s_List);
  22950.       end if;
  22951.       if not ITEM.IsNull(as_unit_body(Root)) then
  22952.         Scan_ITEM(as_unit_body(Root));
  22953.       end if;
  22954.      
  22955.      
  22956.      
  22957.       if Kind (as_unit_body (root)) in subp_declKind then
  22958.           ProcessBlockInfo (CurrentBlock);
  22959.       end if;
  22960.      
  22961.      
  22962.      
  22963.      
  22964.     end Scan_comp_unit;
  22965.      
  22966. end COMP_UNIT_CLASS_Pkg;
  22967. -- End: SCCOMP_UNIT_CLASS bdy -----------------------------------------------------
  22968. ::::::::::::::
  22969. sccomp_un.spc
  22970. ::::::::::::::
  22971. -- Begin: SCCOMP_UNIT_CLASS spc ---------------------------------------------------
  22972.      
  22973. with ST_DIANA; use ST_DIANA;
  22974.              package COMP_UNIT_CLASS_Pkg is
  22975.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator);
  22976.     procedure Scan_comp_unit(Root : comp_unitNode.Locator);
  22977. end COMP_UNIT_CLASS_Pkg;
  22978. -- End: SCCOMP_UNIT_CLASS spc -----------------------------------------------------
  22979.      
  22980. ::::::::::::::
  22981. scconstra.bdy
  22982. ::::::::::::::
  22983. -- Begin: SCCONSTRAINT bdy ---------------------------------------------------
  22984.      
  22985. with Halstead_Data_Base;  use Halstead_Data_Base;
  22986. with Definitions; use Definitions;
  22987.              with SERIES_UNIT_IH;
  22988. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22989. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  22990. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  22991. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  22992.      
  22993.                with subtype_decl_IH;
  22994.                          package body CONSTRAINT_Pkg is
  22995.      
  22996.      
  22997.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator) is
  22998.     begin
  22999.         case Kind(Root) is
  23000.           when RANGE_CONSTRAINT_CLASSKind => Scan_RANGE_CONSTRAINT_CLASS(Root);
  23001.           when REAL_CONSTRAINTKind => Scan_REAL_CONSTRAINT(Root);
  23002.           when apply_constraintKind => Scan_apply_constraint(Root);
  23003.           when dscrmt_constraintKind => Scan_dscrmt_constraint(Root);
  23004.           when index_constraintKind => Scan_index_constraint(Root);
  23005.           when others => null;
  23006.         end case;
  23007.     end Scan_CONSTRAINT;
  23008.      
  23009.      
  23010.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator) is
  23011.     begin
  23012.         case Kind(Root) is
  23013.           when range_attribute_constraintKind => Scan_range_attribute_constraint(Root);
  23014.           when range_constraintKind => Scan_range_constraint(Root);
  23015.           when others => null;
  23016.         end case;
  23017.     end Scan_RANGE_CONSTRAINT_CLASS;
  23018.      
  23019.      
  23020.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator) is
  23021.     begin
  23022.       if not NAME_EXP.IsNull(as_range_exp(Root)) then
  23023.         Scan_NAME_EXP(as_range_exp(Root));
  23024.       end if;
  23025.      
  23026.      
  23027.      SERIES_UNIT_IH.R.ih_inlist := false;
  23028.      
  23029.      
  23030.      
  23031.     end Scan_range_attribute_constraint;
  23032.      
  23033.      
  23034.     procedure Scan_range_constraint(Root : range_constraintNode.Locator) is
  23035.     begin
  23036.      
  23037.      
  23038.       if IsSourceRange (lx_srcpos (root))
  23039.          and then
  23040.          not subtype_decl_IH.R.ih_in_subtype_decl
  23041.          then
  23042.            -- The check for subtype is necessary because in object_type
  23043.            -- we count range if it is a subtype.  This check prevents
  23044.            -- us from counting range twice.
  23045.           IncrementToken (rangez);
  23046.       end if;
  23047.      
  23048.      
  23049.       if not NAME_EXP.IsNull(as_range_exp1(Root)) then
  23050.         Scan_NAME_EXP(as_range_exp1(Root));
  23051.      
  23052.      
  23053.      IncrementToken (dot_dot_rangez);
  23054.      
  23055.      
  23056.       end if;
  23057.       if not NAME_EXP.IsNull(as_range_exp2(Root)) then
  23058.         Scan_NAME_EXP(as_range_exp2(Root));
  23059.       end if;
  23060.      
  23061.      
  23062.      SERIES_UNIT_IH.R.ih_inlist := false;
  23063.      
  23064.      
  23065.      
  23066.     end Scan_range_constraint;
  23067.      
  23068.      
  23069.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator) is
  23070.     begin
  23071.         case Kind(Root) is
  23072.           when fixed_constraintKind => Scan_fixed_constraint(Root);
  23073.           when float_constraintKind => Scan_float_constraint(Root);
  23074.           when others => null;
  23075.         end case;
  23076.     end Scan_REAL_CONSTRAINT;
  23077.      
  23078.      
  23079.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator) is
  23080.     begin
  23081.       if not NAME_EXP.IsNull(as_delta(Root)) then
  23082.         Scan_NAME_EXP(as_delta(Root));
  23083.       end if;
  23084.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  23085.         Scan_range_constraint(as_range_constraint(Root));
  23086.       end if;
  23087.      
  23088.      
  23089.      SERIES_UNIT_IH.R.ih_inlist := false;
  23090.      
  23091.      
  23092.      
  23093.     end Scan_fixed_constraint;
  23094.      
  23095.      
  23096.     procedure Scan_float_constraint(Root : float_constraintNode.Locator) is
  23097.     begin
  23098.       if not NAME_EXP.IsNull(as_digits(Root)) then
  23099.         Scan_NAME_EXP(as_digits(Root));
  23100.       end if;
  23101.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  23102.         Scan_range_constraint(as_range_constraint(Root));
  23103.       end if;
  23104.      
  23105.      
  23106.      SERIES_UNIT_IH.R.ih_inlist := false;
  23107.      
  23108.      
  23109.      
  23110.     end Scan_float_constraint;
  23111.      
  23112.      
  23113.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator) is
  23114.         as_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  23115.         as_assoc_s_Item : GENERAL_ASSOC.Locator;
  23116.         use SeqOfGENERAL_ASSOC;
  23117.     begin
  23118.       if not SeqOfGENERAL_ASSOC.IsNull(as_assoc_s(Root)) then
  23119.         StartForward(as_assoc_s(Root), as_assoc_s_List);
  23120.         while not Finished(as_assoc_s_List) loop
  23121.             as_assoc_s_Item := Cell(as_assoc_s_List);
  23122.             Scan_GENERAL_ASSOC(as_assoc_s_Item);
  23123.             Forward(as_assoc_s_List);
  23124.         end loop;
  23125.         EndIterate(as_assoc_s_List);
  23126.       end if;
  23127.      
  23128.      
  23129.      SERIES_UNIT_IH.R.ih_inlist := false;
  23130.      
  23131.      
  23132.      
  23133.     end Scan_apply_constraint;
  23134.      
  23135.      
  23136.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator) is
  23137.         as_dscrmt_assoc_s_List : SeqOfAGG_COMPONENT.Generator;
  23138.         as_dscrmt_assoc_s_Item : AGG_COMPONENT.Locator;
  23139.         use SeqOfAGG_COMPONENT;
  23140.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  23141.     begin
  23142.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  23143.      
  23144.      
  23145.       IncrementToken (open_parenthesisz);
  23146.      
  23147.      
  23148.       if not SeqOfAGG_COMPONENT.IsNull(as_dscrmt_assoc_s(Root)) then
  23149.         StartForward(as_dscrmt_assoc_s(Root), as_dscrmt_assoc_s_List);
  23150.         while not Finished(as_dscrmt_assoc_s_List) loop
  23151.             as_dscrmt_assoc_s_Item := Cell(as_dscrmt_assoc_s_List);
  23152.      
  23153.      
  23154.       if SERIES_UNIT_IH.R.ih_inlist then
  23155.           IncrementToken (commaz);
  23156.       end if;
  23157.       SERIES_UNIT_IH.R.ih_inlist := true;
  23158.      
  23159.      
  23160.             Scan_AGG_COMPONENT(as_dscrmt_assoc_s_Item);
  23161.             Forward(as_dscrmt_assoc_s_List);
  23162.         end loop;
  23163.         EndIterate(as_dscrmt_assoc_s_List);
  23164.       end if;
  23165.      
  23166.      
  23167.       IncrementToken (closed_parenthesisz);
  23168.       SERIES_UNIT_IH.R.ih_inlist := false;
  23169.      
  23170.      
  23171.      
  23172.      
  23173.      SERIES_UNIT_IH.R.ih_inlist := false;
  23174.      
  23175.      
  23176.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  23177.      
  23178.     end Scan_dscrmt_constraint;
  23179.      
  23180.      
  23181.     procedure Scan_index_constraint(Root : index_constraintNode.Locator) is
  23182.         as_discrete_range_s_List : SeqOfOBJECT_TYPE.Generator;
  23183.         as_discrete_range_s_Item : OBJECT_TYPE.Locator;
  23184.         use SeqOfOBJECT_TYPE;
  23185.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  23186.     begin
  23187.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  23188.      
  23189.      
  23190.      IncrementToken (open_parenthesisz);
  23191.      
  23192.      
  23193.       if not SeqOfOBJECT_TYPE.IsNull(as_discrete_range_s(Root)) then
  23194.         StartForward(as_discrete_range_s(Root), as_discrete_range_s_List);
  23195.         while not Finished(as_discrete_range_s_List) loop
  23196.             as_discrete_range_s_Item := Cell(as_discrete_range_s_List);
  23197.      
  23198.      
  23199.       if SERIES_UNIT_IH.R.ih_inlist then
  23200.           IncrementToken (commaz);
  23201.       end if;
  23202.       SERIES_UNIT_IH.R.ih_inlist := true;
  23203.      
  23204.      
  23205.             Scan_OBJECT_TYPE(as_discrete_range_s_Item);
  23206.             Forward(as_discrete_range_s_List);
  23207.         end loop;
  23208.         EndIterate(as_discrete_range_s_List);
  23209.       end if;
  23210.      
  23211.      
  23212.       IncrementToken (closed_parenthesisz);
  23213.       SERIES_UNIT_IH.R.ih_inlist := false;
  23214.      
  23215.      
  23216.      
  23217.      
  23218.      SERIES_UNIT_IH.R.ih_inlist := false;
  23219.      
  23220.      
  23221.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  23222.      
  23223.     end Scan_index_constraint;
  23224.      
  23225. end CONSTRAINT_Pkg;
  23226. -- End: SCCONSTRAINT bdy -----------------------------------------------------
  23227. ::::::::::::::
  23228. scconstra.spc
  23229. ::::::::::::::
  23230. -- Begin: SCCONSTRAINT spc ---------------------------------------------------
  23231.      
  23232. with ST_DIANA; use ST_DIANA;
  23233.              package CONSTRAINT_Pkg is
  23234.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator);
  23235.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator);
  23236.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator);
  23237.     procedure Scan_range_constraint(Root : range_constraintNode.Locator);
  23238.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator);
  23239.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator);
  23240.     procedure Scan_float_constraint(Root : float_constraintNode.Locator);
  23241.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator);
  23242.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator);
  23243.     procedure Scan_index_constraint(Root : index_constraintNode.Locator);
  23244. end CONSTRAINT_Pkg;
  23245. -- End: SCCONSTRAINT spc -----------------------------------------------------
  23246. ::::::::::::::
  23247. scdef_id.bdy
  23248. ::::::::::::::
  23249. --VMS file: %nosc.work.tools.halstead.source*(SCDEF_ID.bdy)
  23250. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCDEF_ID.bdy
  23251. -- Begin: SCDEF_ID bdy ---------------------------------------------------
  23252.      
  23253. with Halstead_Data_Base;  use Halstead_Data_Base;
  23254. with Definitions; use Definitions;
  23255.      
  23256.            with variable_decl_IH;
  23257.            with type_decl_IH;
  23258.            with Identifier_Utilities;
  23259.                      package body DEF_ID_Pkg is
  23260.      
  23261.      
  23262.     procedure Scan_DEF_ID(Root : DEF_ID.Locator) is
  23263.     begin
  23264.         case Kind(Root) is
  23265.           when ATTRIBUTE_IDKind => Scan_ATTRIBUTE_ID(Root);
  23266.           when BUILT_IN_OPERATORKind => Scan_BUILT_IN_OPERATOR(Root);
  23267.           when GENERAL_TYPE_IDKind => Scan_GENERAL_TYPE_ID(Root);
  23268.           when LITERAL_IDKind => Scan_LITERAL_ID(Root);
  23269.           when OBJECT_IDKind => Scan_OBJECT_ID(Root);
  23270.           when PKG_ID_CLASSKind => Scan_PKG_ID_CLASS(Root);
  23271.           when PRAGMA_IDKind => Scan_PRAGMA_ID(Root);
  23272.           when STM_IDKind => Scan_STM_ID(Root);
  23273.           when SUBP_IDKind => Scan_SUBP_ID(Root);
  23274.           when argument_idKind => Scan_argument_id(Root);
  23275.           when exception_idKind => Scan_exception_id(Root);
  23276.           when iteration_idKind => Scan_iteration_id(Root);
  23277.           when number_idKind => Scan_number_id(Root);
  23278.           when subtype_idKind => Scan_subtype_id(Root);
  23279.           when task_body_idKind => Scan_task_body_id(Root);
  23280.           when others => null;
  23281.         end case;
  23282.     end Scan_DEF_ID;
  23283.      
  23284.      
  23285.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator) is
  23286.     begin
  23287.         case Kind(Root) is
  23288.           when LRM_ATTRIBUTE_IDKind => Scan_LRM_ATTRIBUTE_ID(Root);
  23289.           when others => null;
  23290.         end case;
  23291.     end Scan_ATTRIBUTE_ID;
  23292.      
  23293.      
  23294.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator) is
  23295.     begin
  23296.         case Kind(Root) is
  23297.           when address_idKind => Scan_address_id(Root);
  23298.           when aft_idKind => Scan_aft_id(Root);
  23299.           when base_idKind => Scan_base_id(Root);
  23300.           when callable_idKind => Scan_callable_id(Root);
  23301.           when constrained_idKind => Scan_constrained_id(Root);
  23302.           when count_idKind => Scan_count_id(Root);
  23303.           when delta_idKind => Scan_delta_id(Root);
  23304.           when digits_idKind => Scan_digits_id(Root);
  23305.           when emax_idKind => Scan_emax_id(Root);
  23306.           when epsilon_idKind => Scan_epsilon_id(Root);
  23307.           when first_bit_idKind => Scan_first_bit_id(Root);
  23308.           when first_index_idKind => Scan_first_index_id(Root);
  23309.           when first_scalar_idKind => Scan_first_scalar_id(Root);
  23310.           when fore_idKind => Scan_fore_id(Root);
  23311.           when image_idKind => Scan_image_id(Root);
  23312.           when large_idKind => Scan_large_id(Root);
  23313.           when last_bit_idKind => Scan_last_bit_id(Root);
  23314.           when last_index_idKind => Scan_last_index_id(Root);
  23315.           when last_scalar_idKind => Scan_last_scalar_id(Root);
  23316.           when length_idKind => Scan_length_id(Root);
  23317.           when machine_emax_idKind => Scan_machine_emax_id(Root);
  23318.           when machine_emin_idKind => Scan_machine_emin_id(Root);
  23319.           when machine_mantissa_idKind => Scan_machine_mantissa_id(Root);
  23320.           when machine_overflows_idKind => Scan_machine_overflows_id(Root);
  23321.           when machine_radix_idKind => Scan_machine_radix_id(Root);
  23322.           when machine_rounds_idKind => Scan_machine_rounds_id(Root);
  23323.           when mantissa_idKind => Scan_mantissa_id(Root);
  23324.           when pos_idKind => Scan_pos_id(Root);
  23325.           when position_idKind => Scan_position_id(Root);
  23326.           when pred_idKind => Scan_pred_id(Root);
  23327.           when range_idKind => Scan_range_id(Root);
  23328.           when safe_emax_idKind => Scan_safe_emax_id(Root);
  23329.           when safe_large_idKind => Scan_safe_large_id(Root);
  23330.           when safe_small_idKind => Scan_safe_small_id(Root);
  23331.           when size_objects_idKind => Scan_size_objects_id(Root);
  23332.           when size_type_idKind => Scan_size_type_id(Root);
  23333.           when small_idKind => Scan_small_id(Root);
  23334.           when storage_size_collection_idKind => Scan_storage_size_collection_id(Root);
  23335.           when storage_size_task_idKind => Scan_storage_size_task_id(Root);
  23336.           when succ_idKind => Scan_succ_id(Root);
  23337.           when terminated_idKind => Scan_terminated_id(Root);
  23338.           when val_idKind => Scan_val_id(Root);
  23339.           when value_idKind => Scan_value_id(Root);
  23340.           when width_idKind => Scan_width_id(Root);
  23341.           when others => null;
  23342.         end case;
  23343.     end Scan_LRM_ATTRIBUTE_ID;
  23344.      
  23345.      
  23346.     procedure Scan_address_id(Root : address_idNode.Locator) is
  23347.     begin
  23348.      
  23349.      
  23350.        if not Identifier_Utilities.Is_Id_Null (root) then
  23351.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23352.        end if;
  23353.      
  23354.      
  23355.      
  23356.     end Scan_address_id;
  23357.      
  23358.      
  23359.     procedure Scan_aft_id(Root : aft_idNode.Locator) is
  23360.     begin
  23361.      
  23362.      
  23363.        if not Identifier_Utilities.Is_Id_Null (root) then
  23364.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23365.        end if;
  23366.      
  23367.      
  23368.      
  23369.     end Scan_aft_id;
  23370.      
  23371.      
  23372.     procedure Scan_base_id(Root : base_idNode.Locator) is
  23373.     begin
  23374.      
  23375.      
  23376.        if not Identifier_Utilities.Is_Id_Null (root) then
  23377.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23378.        end if;
  23379.      
  23380.      
  23381.      
  23382.     end Scan_base_id;
  23383.      
  23384.      
  23385.     procedure Scan_callable_id(Root : callable_idNode.Locator) is
  23386.     begin
  23387.      
  23388.      
  23389.        if not Identifier_Utilities.Is_Id_Null (root) then
  23390.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23391.        end if;
  23392.      
  23393.      
  23394.      
  23395.     end Scan_callable_id;
  23396.      
  23397.      
  23398.     procedure Scan_constrained_id(Root : constrained_idNode.Locator) is
  23399.     begin
  23400.      
  23401.      
  23402.        if not Identifier_Utilities.Is_Id_Null (root) then
  23403.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23404.        end if;
  23405.      
  23406.      
  23407.      
  23408.     end Scan_constrained_id;
  23409.      
  23410.      
  23411.     procedure Scan_count_id(Root : count_idNode.Locator) is
  23412.     begin
  23413.      
  23414.      
  23415.        if not Identifier_Utilities.Is_Id_Null (root) then
  23416.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23417.        end if;
  23418.      
  23419.      
  23420.      
  23421.     end Scan_count_id;
  23422.      
  23423.      
  23424.     procedure Scan_delta_id(Root : delta_idNode.Locator) is
  23425.     begin
  23426.      
  23427.      
  23428.        if not Identifier_Utilities.Is_Id_Null (root) then
  23429.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23430.        end if;
  23431.      
  23432.      
  23433.      
  23434.     end Scan_delta_id;
  23435.      
  23436.      
  23437.     procedure Scan_digits_id(Root : digits_idNode.Locator) is
  23438.     begin
  23439.      
  23440.      
  23441.        if not Identifier_Utilities.Is_Id_Null (root) then
  23442.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23443.        end if;
  23444.      
  23445.      
  23446.      
  23447.     end Scan_digits_id;
  23448.      
  23449.      
  23450.     procedure Scan_emax_id(Root : emax_idNode.Locator) is
  23451.     begin
  23452.      
  23453.      
  23454.        if not Identifier_Utilities.Is_Id_Null (root) then
  23455.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23456.        end if;
  23457.      
  23458.      
  23459.      
  23460.     end Scan_emax_id;
  23461.      
  23462.      
  23463.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator) is
  23464.     begin
  23465.      
  23466.      
  23467.        if not Identifier_Utilities.Is_Id_Null (root) then
  23468.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23469.        end if;
  23470.      
  23471.      
  23472.      
  23473.     end Scan_epsilon_id;
  23474.      
  23475.      
  23476.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator) is
  23477.     begin
  23478.      
  23479.      
  23480.        if not Identifier_Utilities.Is_Id_Null (root) then
  23481.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23482.        end if;
  23483.      
  23484.      
  23485.      
  23486.     end Scan_first_bit_id;
  23487.      
  23488.      
  23489.     procedure Scan_first_index_id(Root : first_index_idNode.Locator) is
  23490.     begin
  23491.      
  23492.      
  23493.        if not Identifier_Utilities.Is_Id_Null (root) then
  23494.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23495.        end if;
  23496.      
  23497.      
  23498.      
  23499.     end Scan_first_index_id;
  23500.      
  23501.      
  23502.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator) is
  23503.     begin
  23504.      
  23505.      
  23506.        if not Identifier_Utilities.Is_Id_Null (root) then
  23507.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23508.        end if;
  23509.      
  23510.      
  23511.      
  23512.     end Scan_first_scalar_id;
  23513.      
  23514.      
  23515.     procedure Scan_fore_id(Root : fore_idNode.Locator) is
  23516.     begin
  23517.      
  23518.      
  23519.        if not Identifier_Utilities.Is_Id_Null (root) then
  23520.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23521.        end if;
  23522.      
  23523.      
  23524.      
  23525.     end Scan_fore_id;
  23526.      
  23527.      
  23528.     procedure Scan_image_id(Root : image_idNode.Locator) is
  23529.     begin
  23530.      
  23531.      
  23532.        if not Identifier_Utilities.Is_Id_Null (root) then
  23533.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23534.        end if;
  23535.      
  23536.      
  23537.      
  23538.     end Scan_image_id;
  23539.      
  23540.      
  23541.     procedure Scan_large_id(Root : large_idNode.Locator) is
  23542.     begin
  23543.      
  23544.      
  23545.        if not Identifier_Utilities.Is_Id_Null (root) then
  23546.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23547.        end if;
  23548.      
  23549.      
  23550.      
  23551.     end Scan_large_id;
  23552.      
  23553.      
  23554.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator) is
  23555.     begin
  23556.      
  23557.      
  23558.        if not Identifier_Utilities.Is_Id_Null (root) then
  23559.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23560.        end if;
  23561.      
  23562.      
  23563.      
  23564.     end Scan_last_bit_id;
  23565.      
  23566.      
  23567.     procedure Scan_last_index_id(Root : last_index_idNode.Locator) is
  23568.     begin
  23569.      
  23570.      
  23571.        if not Identifier_Utilities.Is_Id_Null (root) then
  23572.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23573.        end if;
  23574.      
  23575.      
  23576.      
  23577.     end Scan_last_index_id;
  23578.      
  23579.      
  23580.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator) is
  23581.     begin
  23582.      
  23583.      
  23584.        if not Identifier_Utilities.Is_Id_Null (root) then
  23585.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23586.        end if;
  23587.      
  23588.      
  23589.      
  23590.     end Scan_last_scalar_id;
  23591.      
  23592.      
  23593.     procedure Scan_length_id(Root : length_idNode.Locator) is
  23594.     begin
  23595.      
  23596.      
  23597.        if not Identifier_Utilities.Is_Id_Null (root) then
  23598.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23599.        end if;
  23600.      
  23601.      
  23602.      
  23603.     end Scan_length_id;
  23604.      
  23605.      
  23606.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator) is
  23607.     begin
  23608.      
  23609.      
  23610.        if not Identifier_Utilities.Is_Id_Null (root) then
  23611.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23612.        end if;
  23613.      
  23614.      
  23615.      
  23616.     end Scan_machine_emax_id;
  23617.      
  23618.      
  23619.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator) is
  23620.     begin
  23621.      
  23622.      
  23623.        if not Identifier_Utilities.Is_Id_Null (root) then
  23624.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23625.        end if;
  23626.      
  23627.      
  23628.      
  23629.     end Scan_machine_emin_id;
  23630.      
  23631.      
  23632.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator) is
  23633.     begin
  23634.      
  23635.      
  23636.        if not Identifier_Utilities.Is_Id_Null (root) then
  23637.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23638.        end if;
  23639.      
  23640.      
  23641.      
  23642.     end Scan_machine_mantissa_id;
  23643.      
  23644.      
  23645.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator) is
  23646.     begin
  23647.      
  23648.      
  23649.        if not Identifier_Utilities.Is_Id_Null (root) then
  23650.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23651.        end if;
  23652.      
  23653.      
  23654.      
  23655.     end Scan_machine_overflows_id;
  23656.      
  23657.      
  23658.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator) is
  23659.     begin
  23660.      
  23661.      
  23662.        if not Identifier_Utilities.Is_Id_Null (root) then
  23663.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23664.        end if;
  23665.      
  23666.      
  23667.      
  23668.     end Scan_machine_radix_id;
  23669.      
  23670.      
  23671.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator) is
  23672.     begin
  23673.      
  23674.      
  23675.        if not Identifier_Utilities.Is_Id_Null (root) then
  23676.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23677.        end if;
  23678.      
  23679.      
  23680.      
  23681.     end Scan_machine_rounds_id;
  23682.      
  23683.      
  23684.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator) is
  23685.     begin
  23686.      
  23687.      
  23688.        if not Identifier_Utilities.Is_Id_Null (root) then
  23689.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23690.        end if;
  23691.      
  23692.      
  23693.      
  23694.     end Scan_mantissa_id;
  23695.      
  23696.      
  23697.     procedure Scan_pos_id(Root : pos_idNode.Locator) is
  23698.     begin
  23699.      
  23700.      
  23701.        if not Identifier_Utilities.Is_Id_Null (root) then
  23702.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23703.        end if;
  23704.      
  23705.      
  23706.      
  23707.     end Scan_pos_id;
  23708.      
  23709.      
  23710.     procedure Scan_position_id(Root : position_idNode.Locator) is
  23711.     begin
  23712.      
  23713.      
  23714.        if not Identifier_Utilities.Is_Id_Null (root) then
  23715.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23716.        end if;
  23717.      
  23718.      
  23719.      
  23720.     end Scan_position_id;
  23721.      
  23722.      
  23723.     procedure Scan_pred_id(Root : pred_idNode.Locator) is
  23724.     begin
  23725.      
  23726.      
  23727.        if not Identifier_Utilities.Is_Id_Null (root) then
  23728.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23729.        end if;
  23730.      
  23731.      
  23732.      
  23733.     end Scan_pred_id;
  23734.      
  23735.      
  23736.     procedure Scan_range_id(Root : range_idNode.Locator) is
  23737.     begin
  23738.      
  23739.      
  23740.        if not Identifier_Utilities.Is_Id_Null (root) then
  23741.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23742.        end if;
  23743.      
  23744.      
  23745.      
  23746.     end Scan_range_id;
  23747.      
  23748.      
  23749.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator) is
  23750.     begin
  23751.      
  23752.      
  23753.        if not Identifier_Utilities.Is_Id_Null (root) then
  23754.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23755.        end if;
  23756.      
  23757.      
  23758.      
  23759.     end Scan_safe_emax_id;
  23760.      
  23761.      
  23762.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator) is
  23763.     begin
  23764.      
  23765.      
  23766.        if not Identifier_Utilities.Is_Id_Null (root) then
  23767.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23768.        end if;
  23769.      
  23770.      
  23771.      
  23772.     end Scan_safe_large_id;
  23773.      
  23774.      
  23775.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator) is
  23776.     begin
  23777.      
  23778.      
  23779.        if not Identifier_Utilities.Is_Id_Null (root) then
  23780.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23781.        end if;
  23782.      
  23783.      
  23784.      
  23785.     end Scan_safe_small_id;
  23786.      
  23787.      
  23788.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator) is
  23789.     begin
  23790.      
  23791.      
  23792.        if not Identifier_Utilities.Is_Id_Null (root) then
  23793.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23794.        end if;
  23795.      
  23796.      
  23797.      
  23798.     end Scan_size_objects_id;
  23799.      
  23800.      
  23801.     procedure Scan_size_type_id(Root : size_type_idNode.Locator) is
  23802.     begin
  23803.      
  23804.      
  23805.        if not Identifier_Utilities.Is_Id_Null (root) then
  23806.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23807.        end if;
  23808.      
  23809.      
  23810.      
  23811.     end Scan_size_type_id;
  23812.      
  23813.      
  23814.     procedure Scan_small_id(Root : small_idNode.Locator) is
  23815.     begin
  23816.      
  23817.      
  23818.        if not Identifier_Utilities.Is_Id_Null (root) then
  23819.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23820.        end if;
  23821.      
  23822.      
  23823.      
  23824.     end Scan_small_id;
  23825.      
  23826.      
  23827.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator) is
  23828.     begin
  23829.      
  23830.      
  23831.        if not Identifier_Utilities.Is_Id_Null (root) then
  23832.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23833.        end if;
  23834.      
  23835.      
  23836.      
  23837.     end Scan_storage_size_collection_id;
  23838.      
  23839.      
  23840.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator) is
  23841.     begin
  23842.      
  23843.      
  23844.        if not Identifier_Utilities.Is_Id_Null (root) then
  23845.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23846.        end if;
  23847.      
  23848.      
  23849.      
  23850.     end Scan_storage_size_task_id;
  23851.      
  23852.      
  23853.     procedure Scan_succ_id(Root : succ_idNode.Locator) is
  23854.     begin
  23855.      
  23856.      
  23857.        if not Identifier_Utilities.Is_Id_Null (root) then
  23858.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23859.        end if;
  23860.      
  23861.      
  23862.      
  23863.     end Scan_succ_id;
  23864.      
  23865.      
  23866.     procedure Scan_terminated_id(Root : terminated_idNode.Locator) is
  23867.     begin
  23868.      
  23869.      
  23870.        if not Identifier_Utilities.Is_Id_Null (root) then
  23871.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23872.        end if;
  23873.      
  23874.      
  23875.      
  23876.     end Scan_terminated_id;
  23877.      
  23878.      
  23879.     procedure Scan_val_id(Root : val_idNode.Locator) is
  23880.     begin
  23881.      
  23882.      
  23883.        if not Identifier_Utilities.Is_Id_Null (root) then
  23884.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23885.        end if;
  23886.      
  23887.      
  23888.      
  23889.     end Scan_val_id;
  23890.      
  23891.      
  23892.     procedure Scan_value_id(Root : value_idNode.Locator) is
  23893.     begin
  23894.      
  23895.      
  23896.        if not Identifier_Utilities.Is_Id_Null (root) then
  23897.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23898.        end if;
  23899.      
  23900.      
  23901.      
  23902.     end Scan_value_id;
  23903.      
  23904.      
  23905.     procedure Scan_width_id(Root : width_idNode.Locator) is
  23906.     begin
  23907.      
  23908.      
  23909.        if not Identifier_Utilities.Is_Id_Null (root) then
  23910.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23911.        end if;
  23912.      
  23913.      
  23914.      
  23915.     end Scan_width_id;
  23916.      
  23917.      
  23918.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator) is
  23919.     begin
  23920.         case Kind(Root) is
  23921.           when built_in_absKind => Scan_built_in_abs(Root);
  23922.           when built_in_andKind => Scan_built_in_and(Root);
  23923.           when built_in_modKind => Scan_built_in_mod(Root);
  23924.           when built_in_notKind => Scan_built_in_not(Root);
  23925.           when built_in_orKind => Scan_built_in_or(Root);
  23926.           when built_in_remKind => Scan_built_in_rem(Root);
  23927.           when built_in_xorKind => Scan_built_in_xor(Root);
  23928.           when concatenateKind => Scan_concatenate(Root);
  23929.           when divideKind => Scan_divide(Root);
  23930.           when equalKind => Scan_equal(Root);
  23931.           when exponentKind => Scan_exponent(Root);
  23932.           when greater_thanKind => Scan_greater_than(Root);
  23933.           when greater_than_or_equalKind => Scan_greater_than_or_equal(Root);
  23934.           when less_thanKind => Scan_less_than(Root);
  23935.           when less_than_or_equalKind => Scan_less_than_or_equal(Root);
  23936.           when minusKind => Scan_minus(Root);
  23937.           when multiplyKind => Scan_multiply(Root);
  23938.           when negateKind => Scan_negate(Root);
  23939.           when not_equalKind => Scan_not_equal(Root);
  23940.           when plusKind => Scan_plus(Root);
  23941.           when unary_plusKind => Scan_unary_plus(Root);
  23942.           when others => null;
  23943.         end case;
  23944.     end Scan_BUILT_IN_OPERATOR;
  23945.      
  23946.      
  23947.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator) is
  23948.     begin
  23949.      
  23950.      
  23951.        if not Identifier_Utilities.Is_Id_Null (root) then
  23952.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23953.        end if;
  23954.      
  23955.      
  23956.      
  23957.     end Scan_built_in_abs;
  23958.      
  23959.      
  23960.     procedure Scan_built_in_and(Root : built_in_andNode.Locator) is
  23961.     begin
  23962.      
  23963.      
  23964.        if not Identifier_Utilities.Is_Id_Null (root) then
  23965.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23966.        end if;
  23967.      
  23968.      
  23969.      
  23970.     end Scan_built_in_and;
  23971.      
  23972.      
  23973.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator) is
  23974.     begin
  23975.      
  23976.      
  23977.        if not Identifier_Utilities.Is_Id_Null (root) then
  23978.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23979.        end if;
  23980.      
  23981.      
  23982.      
  23983.     end Scan_built_in_mod;
  23984.      
  23985.      
  23986.     procedure Scan_built_in_not(Root : built_in_notNode.Locator) is
  23987.     begin
  23988.      
  23989.      
  23990.        if not Identifier_Utilities.Is_Id_Null (root) then
  23991.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23992.        end if;
  23993.      
  23994.      
  23995.      
  23996.     end Scan_built_in_not;
  23997.      
  23998.      
  23999.     procedure Scan_built_in_or(Root : built_in_orNode.Locator) is
  24000.     begin
  24001.      
  24002.      
  24003.        if not Identifier_Utilities.Is_Id_Null (root) then
  24004.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24005.        end if;
  24006.      
  24007.      
  24008.      
  24009.     end Scan_built_in_or;
  24010.      
  24011.      
  24012.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator) is
  24013.     begin
  24014.      
  24015.      
  24016.        if not Identifier_Utilities.Is_Id_Null (root) then
  24017.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24018.        end if;
  24019.      
  24020.      
  24021.      
  24022.     end Scan_built_in_rem;
  24023.      
  24024.      
  24025.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator) is
  24026.     begin
  24027.      
  24028.      
  24029.        if not Identifier_Utilities.Is_Id_Null (root) then
  24030.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24031.        end if;
  24032.      
  24033.      
  24034.      
  24035.     end Scan_built_in_xor;
  24036.      
  24037.      
  24038.     procedure Scan_concatenate(Root : concatenateNode.Locator) is
  24039.     begin
  24040.      
  24041.      
  24042.        if not Identifier_Utilities.Is_Id_Null (root) then
  24043.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24044.        end if;
  24045.      
  24046.      
  24047.      
  24048.     end Scan_concatenate;
  24049.      
  24050.      
  24051.     procedure Scan_divide(Root : divideNode.Locator) is
  24052.     begin
  24053.      
  24054.      
  24055.        if not Identifier_Utilities.Is_Id_Null (root) then
  24056.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24057.        end if;
  24058.      
  24059.      
  24060.      
  24061.     end Scan_divide;
  24062.      
  24063.      
  24064.     procedure Scan_equal(Root : equalNode.Locator) is
  24065.     begin
  24066.      
  24067.      
  24068.        if not Identifier_Utilities.Is_Id_Null (root) then
  24069.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24070.        end if;
  24071.      
  24072.      
  24073.      
  24074.     end Scan_equal;
  24075.      
  24076.      
  24077.     procedure Scan_exponent(Root : exponentNode.Locator) is
  24078.     begin
  24079.      
  24080.      
  24081.        if not Identifier_Utilities.Is_Id_Null (root) then
  24082.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24083.        end if;
  24084.      
  24085.      
  24086.      
  24087.     end Scan_exponent;
  24088.      
  24089.      
  24090.     procedure Scan_greater_than(Root : greater_thanNode.Locator) is
  24091.     begin
  24092.      
  24093.      
  24094.        if not Identifier_Utilities.Is_Id_Null (root) then
  24095.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24096.        end if;
  24097.      
  24098.      
  24099.      
  24100.     end Scan_greater_than;
  24101.      
  24102.      
  24103.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator) is
  24104.     begin
  24105.      
  24106.      
  24107.        if not Identifier_Utilities.Is_Id_Null (root) then
  24108.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24109.        end if;
  24110.      
  24111.      
  24112.      
  24113.     end Scan_greater_than_or_equal;
  24114.      
  24115.      
  24116.     procedure Scan_less_than(Root : less_thanNode.Locator) is
  24117.     begin
  24118.      
  24119.      
  24120.        if not Identifier_Utilities.Is_Id_Null (root) then
  24121.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24122.        end if;
  24123.      
  24124.      
  24125.      
  24126.     end Scan_less_than;
  24127.      
  24128.      
  24129.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator) is
  24130.     begin
  24131.      
  24132.      
  24133.        if not Identifier_Utilities.Is_Id_Null (root) then
  24134.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24135.        end if;
  24136.      
  24137.      
  24138.      
  24139.     end Scan_less_than_or_equal;
  24140.      
  24141.      
  24142.     procedure Scan_minus(Root : minusNode.Locator) is
  24143.     begin
  24144.      
  24145.      
  24146.        if not Identifier_Utilities.Is_Id_Null (root) then
  24147.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24148.        end if;
  24149.      
  24150.      
  24151.      
  24152.     end Scan_minus;
  24153.      
  24154.      
  24155.     procedure Scan_multiply(Root : multiplyNode.Locator) is
  24156.     begin
  24157.      
  24158.      
  24159.        if not Identifier_Utilities.Is_Id_Null (root) then
  24160.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24161.        end if;
  24162.      
  24163.      
  24164.      
  24165.     end Scan_multiply;
  24166.      
  24167.      
  24168.     procedure Scan_negate(Root : negateNode.Locator) is
  24169.     begin
  24170.      
  24171.      
  24172.        if not Identifier_Utilities.Is_Id_Null (root) then
  24173.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24174.        end if;
  24175.      
  24176.      
  24177.      
  24178.     end Scan_negate;
  24179.      
  24180.      
  24181.     procedure Scan_not_equal(Root : not_equalNode.Locator) is
  24182.     begin
  24183.      
  24184.      
  24185.        if not Identifier_Utilities.Is_Id_Null (root) then
  24186.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24187.        end if;
  24188.      
  24189.      
  24190.      
  24191.     end Scan_not_equal;
  24192.      
  24193.      
  24194.     procedure Scan_plus(Root : plusNode.Locator) is
  24195.     begin
  24196.      
  24197.      
  24198.        if not Identifier_Utilities.Is_Id_Null (root) then
  24199.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24200.        end if;
  24201.      
  24202.      
  24203.      
  24204.     end Scan_plus;
  24205.      
  24206.      
  24207.     procedure Scan_unary_plus(Root : unary_plusNode.Locator) is
  24208.     begin
  24209.      
  24210.      
  24211.        if not Identifier_Utilities.Is_Id_Null (root) then
  24212.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24213.        end if;
  24214.      
  24215.      
  24216.      
  24217.     end Scan_unary_plus;
  24218.      
  24219.      
  24220.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator) is
  24221.     begin
  24222.         case Kind(Root) is
  24223.           when lim_priv_type_idKind => Scan_lim_priv_type_id(Root);
  24224.           when priv_type_idKind => Scan_priv_type_id(Root);
  24225.           when type_idKind => Scan_type_id(Root);
  24226.           when others => null;
  24227.         end case;
  24228.     end Scan_GENERAL_TYPE_ID;
  24229.      
  24230.      
  24231.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator) is
  24232.     begin
  24233.      
  24234.      
  24235.        if not Identifier_Utilities.Is_Id_Null (root) then
  24236.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24237.        end if;
  24238.      
  24239.      
  24240.      
  24241.     end Scan_lim_priv_type_id;
  24242.      
  24243.      
  24244.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator) is
  24245.     begin
  24246.      
  24247.      
  24248.        if not Identifier_Utilities.Is_Id_Null (root) then
  24249.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24250.        end if;
  24251.      
  24252.      
  24253.      
  24254.     end Scan_priv_type_id;
  24255.      
  24256.      
  24257.     procedure Scan_type_id(Root : type_idNode.Locator) is
  24258.     begin
  24259.      
  24260.      
  24261.        if not Identifier_Utilities.Is_Id_Null (root) then
  24262.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24263.        end if;
  24264.      
  24265.      
  24266.      
  24267.     end Scan_type_id;
  24268.      
  24269.      
  24270.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator) is
  24271.     begin
  24272.         case Kind(Root) is
  24273.           when def_charKind => Scan_def_char(Root);
  24274.           when enum_idKind => Scan_enum_id(Root);
  24275.           when others => null;
  24276.         end case;
  24277.     end Scan_LITERAL_ID;
  24278.      
  24279.      
  24280.     procedure Scan_def_char(Root : def_charNode.Locator) is
  24281.     begin
  24282.      
  24283.      
  24284.        if not Identifier_Utilities.Is_Id_Null (root) then
  24285.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24286.        end if;
  24287.      
  24288.      
  24289.      
  24290.     end Scan_def_char;
  24291.      
  24292.      
  24293.     procedure Scan_enum_id(Root : enum_idNode.Locator) is
  24294.     begin
  24295.      
  24296.      
  24297.        if not Identifier_Utilities.Is_Id_Null (root) then
  24298.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24299.        end if;
  24300.      
  24301.      
  24302.      
  24303.     end Scan_enum_id;
  24304.      
  24305.      
  24306.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator) is
  24307.     begin
  24308.         case Kind(Root) is
  24309.           when PARAM_IDKind => Scan_PARAM_ID(Root);
  24310.           when component_idKind => Scan_component_id(Root);
  24311.           when constant_idKind => Scan_constant_id(Root);
  24312.           when dscrmt_idKind => Scan_dscrmt_id(Root);
  24313.           when variable_idKind => Scan_variable_id(Root);
  24314.           when others => null;
  24315.         end case;
  24316.     end Scan_OBJECT_ID;
  24317.      
  24318.      
  24319.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator) is
  24320.     begin
  24321.         case Kind(Root) is
  24322.           when in_idKind => Scan_in_id(Root);
  24323.           when in_out_idKind => Scan_in_out_id(Root);
  24324.           when out_idKind => Scan_out_id(Root);
  24325.           when others => null;
  24326.         end case;
  24327.     end Scan_PARAM_ID;
  24328.      
  24329.      
  24330.     procedure Scan_in_id(Root : in_idNode.Locator) is
  24331.     begin
  24332.      
  24333.      
  24334.        if not Identifier_Utilities.Is_Id_Null (root) then
  24335.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24336.        end if;
  24337.      
  24338.      
  24339.      
  24340.     end Scan_in_id;
  24341.      
  24342.      
  24343.     procedure Scan_in_out_id(Root : in_out_idNode.Locator) is
  24344.     begin
  24345.      
  24346.      
  24347.        if not Identifier_Utilities.Is_Id_Null (root) then
  24348.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24349.        end if;
  24350.      
  24351.      
  24352.      
  24353.     end Scan_in_out_id;
  24354.      
  24355.      
  24356.     procedure Scan_out_id(Root : out_idNode.Locator) is
  24357.     begin
  24358.      
  24359.      
  24360.        if not Identifier_Utilities.Is_Id_Null (root) then
  24361.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24362.        end if;
  24363.      
  24364.      
  24365.      
  24366.     end Scan_out_id;
  24367.      
  24368.      
  24369.     procedure Scan_component_id(Root : component_idNode.Locator) is
  24370.     begin
  24371.      
  24372.      
  24373.        if not Identifier_Utilities.Is_Id_Null (root) then
  24374.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24375.        end if;
  24376.      
  24377.      
  24378.      
  24379.     end Scan_component_id;
  24380.      
  24381.      
  24382.     procedure Scan_constant_id(Root : constant_idNode.Locator) is
  24383.     begin
  24384.      
  24385.      
  24386.        if not Identifier_Utilities.Is_Id_Null (root) then
  24387.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24388.        end if;
  24389.      
  24390.      
  24391.      
  24392.     end Scan_constant_id;
  24393.      
  24394.      
  24395.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator) is
  24396.     begin
  24397.      
  24398.      
  24399.        if not Identifier_Utilities.Is_Id_Null (root) then
  24400.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24401.        end if;
  24402.      
  24403.      
  24404.      
  24405.     end Scan_dscrmt_id;
  24406.      
  24407.      
  24408.     procedure Scan_variable_id(Root : variable_idNode.Locator) is
  24409.     begin
  24410.      
  24411.      
  24412.        if not Identifier_Utilities.Is_Id_Null (root) then
  24413.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24414.        end if;
  24415.      
  24416.      
  24417.      
  24418.     end Scan_variable_id;
  24419.      
  24420.      
  24421.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator) is
  24422.     begin
  24423.         case Kind(Root) is
  24424.           when generic_pkg_idKind => Scan_generic_pkg_id(Root);
  24425.           when pkg_idKind => Scan_pkg_id(Root);
  24426.           when others => null;
  24427.         end case;
  24428.     end Scan_PKG_ID_CLASS;
  24429.      
  24430.      
  24431.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator) is
  24432.     begin
  24433.      
  24434.      
  24435.        if not Identifier_Utilities.Is_Id_Null (root) then
  24436.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24437.        end if;
  24438.      
  24439.      
  24440.      
  24441.     end Scan_generic_pkg_id;
  24442.      
  24443.      
  24444.     procedure Scan_pkg_id(Root : pkg_idNode.Locator) is
  24445.     begin
  24446.      
  24447.      
  24448.        if not Identifier_Utilities.Is_Id_Null (root) then
  24449.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24450.        end if;
  24451.      
  24452.      
  24453.      
  24454.     end Scan_pkg_id;
  24455.      
  24456.      
  24457.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator) is
  24458.     begin
  24459.         case Kind(Root) is
  24460.           when AIE_PRAGMA_IDKind => Scan_AIE_PRAGMA_ID(Root);
  24461.           when LRM_PRAGMA_IDKind => Scan_LRM_PRAGMA_ID(Root);
  24462.           when others => null;
  24463.         end case;
  24464.     end Scan_PRAGMA_ID;
  24465.      
  24466.      
  24467.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator) is
  24468.     begin
  24469.         case Kind(Root) is
  24470.           when link_name_pragmaKind => Scan_link_name_pragma(Root);
  24471.           when mark_release_pragmaKind => Scan_mark_release_pragma(Root);
  24472.           when monitor_pragmaKind => Scan_monitor_pragma(Root);
  24473.           when unrecognized_pragmaKind => Scan_unrecognized_pragma(Root);
  24474.           when others => null;
  24475.         end case;
  24476.     end Scan_AIE_PRAGMA_ID;
  24477.      
  24478.      
  24479.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator) is
  24480.     begin
  24481.      
  24482.      
  24483.        if not Identifier_Utilities.Is_Id_Null (root) then
  24484.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24485.        end if;
  24486.      
  24487.      
  24488.      
  24489.     end Scan_link_name_pragma;
  24490.      
  24491.      
  24492.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator) is
  24493.     begin
  24494.      
  24495.      
  24496.        if not Identifier_Utilities.Is_Id_Null (root) then
  24497.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24498.        end if;
  24499.      
  24500.      
  24501.      
  24502.     end Scan_mark_release_pragma;
  24503.      
  24504.      
  24505.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator) is
  24506.     begin
  24507.      
  24508.      
  24509.        if not Identifier_Utilities.Is_Id_Null (root) then
  24510.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24511.        end if;
  24512.      
  24513.      
  24514.      
  24515.     end Scan_monitor_pragma;
  24516.      
  24517.      
  24518.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator) is
  24519.     begin
  24520.      
  24521.      
  24522.        if not Identifier_Utilities.Is_Id_Null (root) then
  24523.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24524.        end if;
  24525.      
  24526.      
  24527.      
  24528.     end Scan_unrecognized_pragma;
  24529.      
  24530.      
  24531.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator) is
  24532.     begin
  24533.         case Kind(Root) is
  24534.           when controlled_pragmaKind => Scan_controlled_pragma(Root);
  24535.           when elaborate_pragmaKind => Scan_elaborate_pragma(Root);
  24536.           when inline_pragmaKind => Scan_inline_pragma(Root);
  24537.           when interface_pragmaKind => Scan_interface_pragma(Root);
  24538.           when list_pragmaKind => Scan_list_pragma(Root);
  24539.           when memory_size_pragmaKind => Scan_memory_size_pragma(Root);
  24540.           when optimize_pragmaKind => Scan_optimize_pragma(Root);
  24541.           when pack_pragmaKind => Scan_pack_pragma(Root);
  24542.           when page_pragmaKind => Scan_page_pragma(Root);
  24543.           when priority_pragmaKind => Scan_priority_pragma(Root);
  24544.           when shared_pragmaKind => Scan_shared_pragma(Root);
  24545.           when storage_unit_pragmaKind => Scan_storage_unit_pragma(Root);
  24546.           when suppress_pragmaKind => Scan_suppress_pragma(Root);
  24547.           when system_name_pragmaKind => Scan_system_name_pragma(Root);
  24548.           when others => null;
  24549.         end case;
  24550.     end Scan_LRM_PRAGMA_ID;
  24551.      
  24552.      
  24553.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator) is
  24554.     begin
  24555.      
  24556.      
  24557.        if not Identifier_Utilities.Is_Id_Null (root) then
  24558.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24559.        end if;
  24560.      
  24561.      
  24562.      
  24563.     end Scan_controlled_pragma;
  24564.      
  24565.      
  24566.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator) is
  24567.     begin
  24568.      
  24569.      
  24570.        if not Identifier_Utilities.Is_Id_Null (root) then
  24571.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24572.        end if;
  24573.      
  24574.      
  24575.      
  24576.     end Scan_elaborate_pragma;
  24577.      
  24578.      
  24579.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator) is
  24580.     begin
  24581.      
  24582.      
  24583.        if not Identifier_Utilities.Is_Id_Null (root) then
  24584.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24585.        end if;
  24586.      
  24587.      
  24588.      
  24589.     end Scan_inline_pragma;
  24590.      
  24591.      
  24592.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator) is
  24593.     begin
  24594.      
  24595.      
  24596.        if not Identifier_Utilities.Is_Id_Null (root) then
  24597.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24598.        end if;
  24599.      
  24600.      
  24601.      
  24602.     end Scan_interface_pragma;
  24603.      
  24604.      
  24605.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator) is
  24606.     begin
  24607.      
  24608.      
  24609.        if not Identifier_Utilities.Is_Id_Null (root) then
  24610.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24611.        end if;
  24612.      
  24613.      
  24614.      
  24615.     end Scan_list_pragma;
  24616.      
  24617.      
  24618.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator) is
  24619.     begin
  24620.      
  24621.      
  24622.        if not Identifier_Utilities.Is_Id_Null (root) then
  24623.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24624.        end if;
  24625.      
  24626.      
  24627.      
  24628.     end Scan_memory_size_pragma;
  24629.      
  24630.      
  24631.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator) is
  24632.     begin
  24633.      
  24634.      
  24635.        if not Identifier_Utilities.Is_Id_Null (root) then
  24636.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24637.        end if;
  24638.      
  24639.      
  24640.      
  24641.     end Scan_optimize_pragma;
  24642.      
  24643.      
  24644.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator) is
  24645.     begin
  24646.      
  24647.      
  24648.        if not Identifier_Utilities.Is_Id_Null (root) then
  24649.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24650.        end if;
  24651.      
  24652.      
  24653.      
  24654.     end Scan_pack_pragma;
  24655.      
  24656.      
  24657.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator) is
  24658.     begin
  24659.      
  24660.      
  24661.        if not Identifier_Utilities.Is_Id_Null (root) then
  24662.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24663.        end if;
  24664.      
  24665.      
  24666.      
  24667.     end Scan_page_pragma;
  24668.      
  24669.      
  24670.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator) is
  24671.     begin
  24672.      
  24673.      
  24674.        if not Identifier_Utilities.Is_Id_Null (root) then
  24675.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24676.        end if;
  24677.      
  24678.      
  24679.      
  24680.     end Scan_priority_pragma;
  24681.      
  24682.      
  24683.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator) is
  24684.     begin
  24685.      
  24686.      
  24687.        if not Identifier_Utilities.Is_Id_Null (root) then
  24688.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24689.        end if;
  24690.      
  24691.      
  24692.      
  24693.     end Scan_shared_pragma;
  24694.      
  24695.      
  24696.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator) is
  24697.     begin
  24698.      
  24699.      
  24700.        if not Identifier_Utilities.Is_Id_Null (root) then
  24701.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24702.        end if;
  24703.      
  24704.      
  24705.      
  24706.     end Scan_storage_unit_pragma;
  24707.      
  24708.      
  24709.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator) is
  24710.     begin
  24711.      
  24712.      
  24713.        if not Identifier_Utilities.Is_Id_Null (root) then
  24714.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24715.        end if;
  24716.      
  24717.      
  24718.      
  24719.     end Scan_suppress_pragma;
  24720.      
  24721.      
  24722.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator) is
  24723.     begin
  24724.      
  24725.      
  24726.        if not Identifier_Utilities.Is_Id_Null (root) then
  24727.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24728.        end if;
  24729.      
  24730.      
  24731.      
  24732.     end Scan_system_name_pragma;
  24733.      
  24734.      
  24735.     procedure Scan_STM_ID(Root : STM_ID.Locator) is
  24736.     begin
  24737.         case Kind(Root) is
  24738.           when block_idKind => Scan_block_id(Root);
  24739.           when label_idKind => Scan_label_id(Root);
  24740.           when loop_idKind => Scan_loop_id(Root);
  24741.           when others => null;
  24742.         end case;
  24743.     end Scan_STM_ID;
  24744.      
  24745.      
  24746.     procedure Scan_block_id(Root : block_idNode.Locator) is
  24747.     begin
  24748.      
  24749.      
  24750.        if not Identifier_Utilities.Is_Id_Null (root) then
  24751.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24752.        end if;
  24753.      
  24754.      
  24755.      
  24756.     end Scan_block_id;
  24757.      
  24758.      
  24759.     procedure Scan_label_id(Root : label_idNode.Locator) is
  24760.     begin
  24761.      
  24762.      
  24763.        if not Identifier_Utilities.Is_Id_Null (root) then
  24764.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24765.        end if;
  24766.      
  24767.      
  24768.      
  24769.     end Scan_label_id;
  24770.      
  24771.      
  24772.     procedure Scan_loop_id(Root : loop_idNode.Locator) is
  24773.     begin
  24774.      
  24775.      
  24776.     IncrementToken (colonz);
  24777.      
  24778.      
  24779.      
  24780.      
  24781.        if not Identifier_Utilities.Is_Id_Null (root) then
  24782.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24783.        end if;
  24784.      
  24785.      
  24786.      
  24787.     end Scan_loop_id;
  24788.      
  24789.      
  24790.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator) is
  24791.     begin
  24792.         case Kind(Root) is
  24793.           when GENERIC_SUBP_IDKind => Scan_GENERIC_SUBP_ID(Root);
  24794.           when def_operatorKind => Scan_def_operator(Root);
  24795.           when entry_idKind => Scan_entry_id(Root);
  24796.           when func_idKind => Scan_func_id(Root);
  24797.           when proc_idKind => Scan_proc_id(Root);
  24798.           when others => null;
  24799.         end case;
  24800.     end Scan_SUBP_ID;
  24801.      
  24802.      
  24803.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator) is
  24804.     begin
  24805.         case Kind(Root) is
  24806.           when generic_func_idKind => Scan_generic_func_id(Root);
  24807.           when generic_proc_idKind => Scan_generic_proc_id(Root);
  24808.           when others => null;
  24809.         end case;
  24810.     end Scan_GENERIC_SUBP_ID;
  24811.      
  24812.      
  24813.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator) is
  24814.     begin
  24815.      
  24816.      
  24817.        if not Identifier_Utilities.Is_Id_Null (root) then
  24818.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24819.        end if;
  24820.      
  24821.      
  24822.      
  24823.     end Scan_generic_func_id;
  24824.      
  24825.      
  24826.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator) is
  24827.     begin
  24828.      
  24829.      
  24830.        if not Identifier_Utilities.Is_Id_Null (root) then
  24831.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24832.        end if;
  24833.      
  24834.      
  24835.      
  24836.     end Scan_generic_proc_id;
  24837.      
  24838.      
  24839.     procedure Scan_def_operator(Root : def_operatorNode.Locator) is
  24840.     begin
  24841.      
  24842.      
  24843.        if not Identifier_Utilities.Is_Id_Null (root) then
  24844.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24845.        end if;
  24846.      
  24847.      
  24848.      
  24849.     end Scan_def_operator;
  24850.      
  24851.      
  24852.     procedure Scan_entry_id(Root : entry_idNode.Locator) is
  24853.     begin
  24854.      
  24855.      
  24856.        if not Identifier_Utilities.Is_Id_Null (root) then
  24857.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24858.        end if;
  24859.      
  24860.      
  24861.      
  24862.     end Scan_entry_id;
  24863.      
  24864.      
  24865.     procedure Scan_func_id(Root : func_idNode.Locator) is
  24866.     begin
  24867.      
  24868.      
  24869.        if not Identifier_Utilities.Is_Id_Null (root) then
  24870.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24871.        end if;
  24872.      
  24873.      
  24874.      
  24875.     end Scan_func_id;
  24876.      
  24877.      
  24878.     procedure Scan_proc_id(Root : proc_idNode.Locator) is
  24879.     begin
  24880.      
  24881.      
  24882.        if not Identifier_Utilities.Is_Id_Null (root) then
  24883.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24884.        end if;
  24885.      
  24886.      
  24887.      
  24888.     end Scan_proc_id;
  24889.      
  24890.      
  24891.     procedure Scan_argument_id(Root : argument_idNode.Locator) is
  24892.     begin
  24893.      
  24894.      
  24895.        if not Identifier_Utilities.Is_Id_Null (root) then
  24896.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24897.        end if;
  24898.      
  24899.      
  24900.      
  24901.     end Scan_argument_id;
  24902.      
  24903.      
  24904.     procedure Scan_exception_id(Root : exception_idNode.Locator) is
  24905.     begin
  24906.      
  24907.      
  24908.        if not Identifier_Utilities.Is_Id_Null (root) then
  24909.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24910.        end if;
  24911.      
  24912.      
  24913.      
  24914.     end Scan_exception_id;
  24915.      
  24916.      
  24917.     procedure Scan_iteration_id(Root : iteration_idNode.Locator) is
  24918.     begin
  24919.      
  24920.      
  24921.        if not Identifier_Utilities.Is_Id_Null (root) then
  24922.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24923.        end if;
  24924.      
  24925.      
  24926.      
  24927.     end Scan_iteration_id;
  24928.      
  24929.      
  24930.     procedure Scan_number_id(Root : number_idNode.Locator) is
  24931.     begin
  24932.      
  24933.      
  24934.        if not Identifier_Utilities.Is_Id_Null (root) then
  24935.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24936.        end if;
  24937.      
  24938.      
  24939.      
  24940.     end Scan_number_id;
  24941.      
  24942.      
  24943.     procedure Scan_subtype_id(Root : subtype_idNode.Locator) is
  24944.     begin
  24945.      
  24946.      
  24947.        if not Identifier_Utilities.Is_Id_Null (root) then
  24948.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24949.        end if;
  24950.      
  24951.      
  24952.      
  24953.     end Scan_subtype_id;
  24954.      
  24955.      
  24956.     procedure Scan_task_body_id(Root : task_body_idNode.Locator) is
  24957.     begin
  24958.      
  24959.      
  24960.        if not Identifier_Utilities.Is_Id_Null (root) then
  24961.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24962.        end if;
  24963.      
  24964.      
  24965.      
  24966.     end Scan_task_body_id;
  24967.      
  24968. end DEF_ID_Pkg;
  24969. -- End: SCDEF_ID bdy -----------------------------------------------------
  24970. ::::::::::::::
  24971. scdef_id.spc
  24972. ::::::::::::::
  24973. -- Begin: SCDEF_ID spc ---------------------------------------------------
  24974.      
  24975. with ST_DIANA; use ST_DIANA;
  24976.              package DEF_ID_Pkg is
  24977.     procedure Scan_DEF_ID(Root : DEF_ID.Locator);
  24978.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator);
  24979.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator);
  24980.     procedure Scan_address_id(Root : address_idNode.Locator);
  24981.     procedure Scan_aft_id(Root : aft_idNode.Locator);
  24982.     procedure Scan_base_id(Root : base_idNode.Locator);
  24983.     procedure Scan_callable_id(Root : callable_idNode.Locator);
  24984.     procedure Scan_constrained_id(Root : constrained_idNode.Locator);
  24985.     procedure Scan_count_id(Root : count_idNode.Locator);
  24986.     procedure Scan_delta_id(Root : delta_idNode.Locator);
  24987.     procedure Scan_digits_id(Root : digits_idNode.Locator);
  24988.     procedure Scan_emax_id(Root : emax_idNode.Locator);
  24989.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator);
  24990.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator);
  24991.     procedure Scan_first_index_id(Root : first_index_idNode.Locator);
  24992.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator);
  24993.     procedure Scan_fore_id(Root : fore_idNode.Locator);
  24994.     procedure Scan_image_id(Root : image_idNode.Locator);
  24995.     procedure Scan_large_id(Root : large_idNode.Locator);
  24996.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator);
  24997.     procedure Scan_last_index_id(Root : last_index_idNode.Locator);
  24998.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator);
  24999.     procedure Scan_length_id(Root : length_idNode.Locator);
  25000.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator);
  25001.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator);
  25002.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator);
  25003.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator);
  25004.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator);
  25005.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator);
  25006.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator);
  25007.     procedure Scan_pos_id(Root : pos_idNode.Locator);
  25008.     procedure Scan_position_id(Root : position_idNode.Locator);
  25009.     procedure Scan_pred_id(Root : pred_idNode.Locator);
  25010.     procedure Scan_range_id(Root : range_idNode.Locator);
  25011.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator);
  25012.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator);
  25013.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator);
  25014.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator);
  25015.     procedure Scan_size_type_id(Root : size_type_idNode.Locator);
  25016.     procedure Scan_small_id(Root : small_idNode.Locator);
  25017.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator);
  25018.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator);
  25019.     procedure Scan_succ_id(Root : succ_idNode.Locator);
  25020.     procedure Scan_terminated_id(Root : terminated_idNode.Locator);
  25021.     procedure Scan_val_id(Root : val_idNode.Locator);
  25022.     procedure Scan_value_id(Root : value_idNode.Locator);
  25023.     procedure Scan_width_id(Root : width_idNode.Locator);
  25024.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator);
  25025.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator);
  25026.     procedure Scan_built_in_and(Root : built_in_andNode.Locator);
  25027.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator);
  25028.     procedure Scan_built_in_not(Root : built_in_notNode.Locator);
  25029.     procedure Scan_built_in_or(Root : built_in_orNode.Locator);
  25030.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator);
  25031.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator);
  25032.     procedure Scan_concatenate(Root : concatenateNode.Locator);
  25033.     procedure Scan_divide(Root : divideNode.Locator);
  25034.     procedure Scan_equal(Root : equalNode.Locator);
  25035.     procedure Scan_exponent(Root : exponentNode.Locator);
  25036.     procedure Scan_greater_than(Root : greater_thanNode.Locator);
  25037.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator);
  25038.     procedure Scan_less_than(Root : less_thanNode.Locator);
  25039.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator);
  25040.     procedure Scan_minus(Root : minusNode.Locator);
  25041.     procedure Scan_multiply(Root : multiplyNode.Locator);
  25042.     procedure Scan_negate(Root : negateNode.Locator);
  25043.     procedure Scan_not_equal(Root : not_equalNode.Locator);
  25044.     procedure Scan_plus(Root : plusNode.Locator);
  25045.     procedure Scan_unary_plus(Root : unary_plusNode.Locator);
  25046.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator);
  25047.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator);
  25048.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator);
  25049.     procedure Scan_type_id(Root : type_idNode.Locator);
  25050.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator);
  25051.     procedure Scan_def_char(Root : def_charNode.Locator);
  25052.     procedure Scan_enum_id(Root : enum_idNode.Locator);
  25053.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator);
  25054.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator);
  25055.     procedure Scan_in_id(Root : in_idNode.Locator);
  25056.     procedure Scan_in_out_id(Root : in_out_idNode.Locator);
  25057.     procedure Scan_out_id(Root : out_idNode.Locator);
  25058.     procedure Scan_component_id(Root : component_idNode.Locator);
  25059.     procedure Scan_constant_id(Root : constant_idNode.Locator);
  25060.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator);
  25061.     procedure Scan_variable_id(Root : variable_idNode.Locator);
  25062.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator);
  25063.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator);
  25064.     procedure Scan_pkg_id(Root : pkg_idNode.Locator);
  25065.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator);
  25066.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator);
  25067.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator);
  25068.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator);
  25069.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator);
  25070.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator);
  25071.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator);
  25072.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator);
  25073.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator);
  25074.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator);
  25075.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator);
  25076.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator);
  25077.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator);
  25078.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator);
  25079.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator);
  25080.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator);
  25081.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator);
  25082.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator);
  25083.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator);
  25084.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator);
  25085.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator);
  25086.     procedure Scan_STM_ID(Root : STM_ID.Locator);
  25087.     procedure Scan_block_id(Root : block_idNode.Locator);
  25088.     procedure Scan_label_id(Root : label_idNode.Locator);
  25089.     procedure Scan_loop_id(Root : loop_idNode.Locator);
  25090.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator);
  25091.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator);
  25092.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator);
  25093.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator);
  25094.     procedure Scan_def_operator(Root : def_operatorNode.Locator);
  25095.     procedure Scan_entry_id(Root : entry_idNode.Locator);
  25096.     procedure Scan_func_id(Root : func_idNode.Locator);
  25097.     procedure Scan_proc_id(Root : proc_idNode.Locator);
  25098.     procedure Scan_argument_id(Root : argument_idNode.Locator);
  25099.     procedure Scan_exception_id(Root : exception_idNode.Locator);
  25100.     procedure Scan_iteration_id(Root : iteration_idNode.Locator);
  25101.     procedure Scan_number_id(Root : number_idNode.Locator);
  25102.     procedure Scan_subtype_id(Root : subtype_idNode.Locator);
  25103.     procedure Scan_task_body_id(Root : task_body_idNode.Locator);
  25104. end DEF_ID_Pkg;
  25105. -- End: SCDEF_ID spc -----------------------------------------------------
  25106. ::::::::::::::
  25107. scgeneral.bdy
  25108. ::::::::::::::
  25109. -- Begin: SCGENERAL_ASSOC bdy ---------------------------------------------------
  25110.      
  25111. with Halstead_Data_Base;  use Halstead_Data_Base;
  25112. with Definitions; use Definitions;
  25113.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25114. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25115. package body GENERAL_ASSOC_Pkg is
  25116.      
  25117.      
  25118.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator) is
  25119.     begin
  25120.         case Kind(Root) is
  25121.           when GA_ASSOC_EXPKind => Scan_GA_ASSOC_EXP(Root);
  25122.           when ga_rangeKind => Scan_ga_range(Root);
  25123.           when others => null;
  25124.         end case;
  25125.     end Scan_GENERAL_ASSOC;
  25126.      
  25127.      
  25128.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator) is
  25129.     begin
  25130.         case Kind(Root) is
  25131.           when ga_assocKind => Scan_ga_assoc(Root);
  25132.           when ga_expKind => Scan_ga_exp(Root);
  25133.           when others => null;
  25134.         end case;
  25135.     end Scan_GA_ASSOC_EXP;
  25136.      
  25137.      
  25138.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator) is
  25139.         as_id_s_List : SeqOfused_idNode.Generator;
  25140.         as_id_s_Item : used_idNode.Locator;
  25141.         use SeqOfused_idNode;
  25142.     begin
  25143.       if not SeqOfused_idNode.IsNull(as_id_s(Root)) then
  25144.         StartForward(as_id_s(Root), as_id_s_List);
  25145.         while not Finished(as_id_s_List) loop
  25146.             as_id_s_Item := Cell(as_id_s_List);
  25147.             Scan_used_id(as_id_s_Item);
  25148.             Forward(as_id_s_List);
  25149.         end loop;
  25150.         EndIterate(as_id_s_List);
  25151.       end if;
  25152.       if not NAME_EXP.IsNull(as_exp(Root)) then
  25153.         Scan_NAME_EXP(as_exp(Root));
  25154.       end if;
  25155.      
  25156.     end Scan_ga_assoc;
  25157.      
  25158.      
  25159.     procedure Scan_ga_exp(Root : ga_expNode.Locator) is
  25160.     begin
  25161.       if not NAME_EXP.IsNull(as_exp(Root)) then
  25162.         Scan_NAME_EXP(as_exp(Root));
  25163.       end if;
  25164.      
  25165.     end Scan_ga_exp;
  25166.      
  25167.      
  25168.     procedure Scan_ga_range(Root : ga_rangeNode.Locator) is
  25169.     begin
  25170.       if not OBJECT_TYPE.IsNull(as_apply_discrete_range(Root)) then
  25171.         Scan_OBJECT_TYPE(as_apply_discrete_range(Root));
  25172.       end if;
  25173.      
  25174.     end Scan_ga_range;
  25175.      
  25176. end GENERAL_ASSOC_Pkg;
  25177. -- End: SCGENERAL_ASSOC bdy -----------------------------------------------------
  25178. ::::::::::::::
  25179. scgeneral.spc
  25180. ::::::::::::::
  25181. -- Begin: SCGENERAL_ASSOC spc ---------------------------------------------------
  25182.      
  25183. with ST_DIANA; use ST_DIANA;
  25184.              package GENERAL_ASSOC_Pkg is
  25185.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator);
  25186.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator);
  25187.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator);
  25188.     procedure Scan_ga_exp(Root : ga_expNode.Locator);
  25189.     procedure Scan_ga_range(Root : ga_rangeNode.Locator);
  25190. end GENERAL_ASSOC_Pkg;
  25191. -- End: SCGENERAL_ASSOC spc -----------------------------------------------------
  25192. ::::::::::::::
  25193. scgeneric.bdy
  25194. ::::::::::::::
  25195. -- Begin: SCGENERIC_HEADER_CLASS bdy ---------------------------------------------------
  25196.      
  25197. with Halstead_Data_Base;  use Halstead_Data_Base;
  25198. with Definitions; use Definitions;
  25199.              with generic_header_IH;
  25200. with ITEM_Pkg; use ITEM_Pkg;
  25201. package body GENERIC_HEADER_CLASS_Pkg is
  25202.      
  25203.      
  25204.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator) is
  25205.     begin
  25206.         case Kind(Root) is
  25207.           when generic_headerKind => Scan_generic_header(Root);
  25208.           when others => null;
  25209.         end case;
  25210.     end Scan_GENERIC_HEADER_CLASS;
  25211.      
  25212.      
  25213.     procedure Scan_generic_header(Root : generic_headerNode.Locator) is
  25214.         as_generic_param_s_List : SeqOfITEM.Generator;
  25215.         as_generic_param_s_Item : ITEM.Locator;
  25216.         use SeqOfITEM;
  25217.         Old_generic_header_IHR : generic_header_IH.RecType := generic_header_IH.R;
  25218.     begin
  25219.         generic_header_IH.R.ih_ingeneric_param :=  false ;
  25220.      
  25221.      
  25222.       generic_header_IH.R.ih_ingeneric_param := true;
  25223.      
  25224.      
  25225.       if not SeqOfITEM.IsNull(as_generic_param_s(Root)) then
  25226.         StartForward(as_generic_param_s(Root), as_generic_param_s_List);
  25227.         while not Finished(as_generic_param_s_List) loop
  25228.             as_generic_param_s_Item := Cell(as_generic_param_s_List);
  25229.      
  25230.      
  25231.        IncrementToken (semicolonz);
  25232.      
  25233.      
  25234.             Scan_ITEM(as_generic_param_s_Item);
  25235.             Forward(as_generic_param_s_List);
  25236.         end loop;
  25237.         EndIterate(as_generic_param_s_List);
  25238.       end if;
  25239.      
  25240.      
  25241.        generic_header_IH.R.ih_ingeneric_param := true;
  25242.      
  25243.      
  25244.         generic_header_IH.R := Old_generic_header_IHR;
  25245.      
  25246.     end Scan_generic_header;
  25247.      
  25248. end GENERIC_HEADER_CLASS_Pkg;
  25249. -- End: SCGENERIC_HEADER_CLASS bdy -----------------------------------------------------
  25250. ::::::::::::::
  25251. scgeneric.spc
  25252. ::::::::::::::
  25253. -- Begin: SCGENERIC_HEADER_CLASS spc ---------------------------------------------------
  25254.      
  25255. with ST_DIANA; use ST_DIANA;
  25256.              package GENERIC_HEADER_CLASS_Pkg is
  25257.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator);
  25258.     procedure Scan_generic_header(Root : generic_headerNode.Locator);
  25259. end GENERIC_HEADER_CLASS_Pkg;
  25260. -- End: SCGENERIC_HEADER_CLASS spc -----------------------------------------------------
  25261.      
  25262. ::::::::::::::
  25263. scheader.bdy
  25264. ::::::::::::::
  25265. -- Begin: SCHEADER bdy ---------------------------------------------------
  25266.      
  25267. with Halstead_Data_Base;  use Halstead_Data_Base;
  25268. with Definitions; use Definitions;
  25269.              with SERIES_UNIT_IH;
  25270. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25271. with ITEM_Pkg; use ITEM_Pkg;
  25272. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25273.      
  25274.              with generic_header_IH;
  25275.                         package body HEADER_Pkg is
  25276.      
  25277.      
  25278.     procedure Scan_HEADER(Root : HEADER.Locator) is
  25279.     begin
  25280.         case Kind(Root) is
  25281.           when accept_specKind => Scan_accept_spec(Root);
  25282.           when entry_specKind => Scan_entry_spec(Root);
  25283.           when func_specKind => Scan_func_spec(Root);
  25284.           when proc_specKind => Scan_proc_spec(Root);
  25285.           when others => null;
  25286.         end case;
  25287.     end Scan_HEADER;
  25288.      
  25289.      
  25290.     procedure Scan_accept_spec(Root : accept_specNode.Locator) is
  25291.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25292.         as_param_s_Item : OBJECT_ITEM.Locator;
  25293.         use SeqOfOBJECT_ITEM;
  25294.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25295.     begin
  25296.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25297.      
  25298.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25299.         then
  25300.      
  25301.        IncrementToken (open_parenthesisz);
  25302.      
  25303.         end if;
  25304.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  25305.      
  25306.      
  25307.       IncrementToken (open_parenthesisz);
  25308.      
  25309.      
  25310.         Scan_NAME_EXP(as_family_index(Root));
  25311.      
  25312.      
  25313.       IncrementToken (closed_parenthesisz);
  25314.      
  25315.      
  25316.       end if;
  25317.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25318.         StartForward(as_param_s(Root), as_param_s_List);
  25319.         while not Finished(as_param_s_List) loop
  25320.             as_param_s_Item := Cell(as_param_s_List);
  25321.      
  25322.      
  25323.      if SERIES_UNIT_IH.R.ih_inlist then
  25324.          IncrementToken (semicolonz);
  25325.      end if;
  25326.      SERIES_UNIT_IH.R.ih_inlist := true;
  25327.      
  25328.      
  25329.             Scan_OBJECT_ITEM(as_param_s_Item);
  25330.             Forward(as_param_s_List);
  25331.         end loop;
  25332.         EndIterate(as_param_s_List);
  25333.      
  25334.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25335.         then
  25336.      
  25337.    IncrementToken (closed_parenthesisz);
  25338.    SERIES_UNIT_IH.R.ih_inlist := false;
  25339.      
  25340.         end if;
  25341.       end if;
  25342.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25343.      
  25344.     end Scan_accept_spec;
  25345.      
  25346.      
  25347.     procedure Scan_entry_spec(Root : entry_specNode.Locator) is
  25348.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25349.         as_param_s_Item : OBJECT_ITEM.Locator;
  25350.         use SeqOfOBJECT_ITEM;
  25351.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25352.     begin
  25353.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25354.      
  25355.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25356.         then
  25357.      
  25358.        IncrementToken (open_parenthesisz);
  25359.      
  25360.         end if;
  25361.       if not OBJECT_TYPE.IsNull(as_family_range_void(Root)) then
  25362.      
  25363.      
  25364.       IncrementToken (open_parenthesisz);
  25365.      
  25366.      
  25367.         Scan_OBJECT_TYPE(as_family_range_void(Root));
  25368.      
  25369.      
  25370.      IncrementToken (closed_parenthesisz);
  25371.      
  25372.      
  25373.       end if;
  25374.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25375.         StartForward(as_param_s(Root), as_param_s_List);
  25376.         while not Finished(as_param_s_List) loop
  25377.             as_param_s_Item := Cell(as_param_s_List);
  25378.      
  25379.      
  25380.      if SERIES_UNIT_IH.R.ih_inlist then
  25381.          IncrementToken (semicolonz);
  25382.      end if;
  25383.      SERIES_UNIT_IH.R.ih_inlist := true;
  25384.      
  25385.      
  25386.             Scan_OBJECT_ITEM(as_param_s_Item);
  25387.             Forward(as_param_s_List);
  25388.         end loop;
  25389.         EndIterate(as_param_s_List);
  25390.      
  25391.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25392.         then
  25393.      
  25394.    IncrementToken (closed_parenthesisz);
  25395.    SERIES_UNIT_IH.R.ih_inlist := false;
  25396.      
  25397.         end if;
  25398.       end if;
  25399.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25400.      
  25401.     end Scan_entry_spec;
  25402.      
  25403.      
  25404.     procedure Scan_func_spec(Root : func_specNode.Locator) is
  25405.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25406.         as_param_s_Item : OBJECT_ITEM.Locator;
  25407.         use SeqOfOBJECT_ITEM;
  25408.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25409.     begin
  25410.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25411.      
  25412.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25413.         then
  25414.      
  25415.        IncrementToken (open_parenthesisz);
  25416.      
  25417.         end if;
  25418.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25419.         StartForward(as_param_s(Root), as_param_s_List);
  25420.         while not Finished(as_param_s_List) loop
  25421.             as_param_s_Item := Cell(as_param_s_List);
  25422.      
  25423.      
  25424.      if SERIES_UNIT_IH.R.ih_inlist then
  25425.          IncrementToken (semicolonz);
  25426.      end if;
  25427.      SERIES_UNIT_IH.R.ih_inlist := true;
  25428.      
  25429.      
  25430.             Scan_OBJECT_ITEM(as_param_s_Item);
  25431.             Forward(as_param_s_List);
  25432.         end loop;
  25433.         EndIterate(as_param_s_List);
  25434.      
  25435.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25436.         then
  25437.      
  25438.    IncrementToken (closed_parenthesisz);
  25439.    SERIES_UNIT_IH.R.ih_inlist := false;
  25440.      
  25441.         end if;
  25442.       end if;
  25443.       if not object_type_constrainedNode.IsNull(as_return_type(Root)) then
  25444.      
  25445.      
  25446.      IncrementToken (returnz);
  25447.      
  25448.      
  25449.         Scan_object_type_constrained(as_return_type(Root));
  25450.       end if;
  25451.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25452.      
  25453.     end Scan_func_spec;
  25454.      
  25455.      
  25456.     procedure Scan_proc_spec(Root : proc_specNode.Locator) is
  25457.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25458.         as_param_s_Item : OBJECT_ITEM.Locator;
  25459.         use SeqOfOBJECT_ITEM;
  25460.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25461.     begin
  25462.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25463.      
  25464.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25465.         then
  25466.      
  25467.        IncrementToken (open_parenthesisz);
  25468.      
  25469.         end if;
  25470.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25471.         StartForward(as_param_s(Root), as_param_s_List);
  25472.         while not Finished(as_param_s_List) loop
  25473.             as_param_s_Item := Cell(as_param_s_List);
  25474.      
  25475.      
  25476.      if SERIES_UNIT_IH.R.ih_inlist then
  25477.          IncrementToken (semicolonz);
  25478.      end if;
  25479.      SERIES_UNIT_IH.R.ih_inlist := true;
  25480.      
  25481.      
  25482.             Scan_OBJECT_ITEM(as_param_s_Item);
  25483.             Forward(as_param_s_List);
  25484.         end loop;
  25485.         EndIterate(as_param_s_List);
  25486.      
  25487.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25488.         then
  25489.      
  25490.    IncrementToken (closed_parenthesisz);
  25491.    SERIES_UNIT_IH.R.ih_inlist := false;
  25492.      
  25493.         end if;
  25494.       end if;
  25495.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25496.      
  25497.     end Scan_proc_spec;
  25498.      
  25499. end HEADER_Pkg;
  25500. -- End: SCHEADER bdy -----------------------------------------------------
  25501. ::::::::::::::
  25502. scheader.spc
  25503. ::::::::::::::
  25504. -- Begin: SCHEADER spc ---------------------------------------------------
  25505.      
  25506. with ST_DIANA; use ST_DIANA;
  25507.              package HEADER_Pkg is
  25508.     procedure Scan_HEADER(Root : HEADER.Locator);
  25509.     procedure Scan_accept_spec(Root : accept_specNode.Locator);
  25510.     procedure Scan_entry_spec(Root : entry_specNode.Locator);
  25511.     procedure Scan_func_spec(Root : func_specNode.Locator);
  25512.     procedure Scan_proc_spec(Root : proc_specNode.Locator);
  25513. end HEADER_Pkg;
  25514. -- End: SCHEADER spc -----------------------------------------------------
  25515. ::::::::::::::
  25516. scinner_r.bdy
  25517. ::::::::::::::
  25518. -- Begin: SCINNER_RECORD_CLASS bdy ---------------------------------------------------
  25519.      
  25520. with Halstead_Data_Base;  use Halstead_Data_Base;
  25521. with Definitions; use Definitions;
  25522.              with inner_record_IH;
  25523. with ITEM_Pkg; use ITEM_Pkg;
  25524. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25525. with VARIANT_ALTERNATIVE_CLASS_Pkg; use VARIANT_ALTERNATIVE_CLASS_Pkg;
  25526. package body INNER_RECORD_CLASS_Pkg is
  25527.      
  25528.      
  25529.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator) is
  25530.     begin
  25531.         case Kind(Root) is
  25532.           when inner_recordKind => Scan_inner_record(Root);
  25533.           when others => null;
  25534.         end case;
  25535.     end Scan_INNER_RECORD_CLASS;
  25536.      
  25537.      
  25538.     procedure Scan_inner_record(Root : inner_recordNode.Locator) is
  25539.         as_list_List : SeqOfITEM.Generator;
  25540.         as_list_Item : ITEM.Locator;
  25541.         use SeqOfITEM;
  25542.         as_variant_s_List : SeqOfvariant_alternativeNode.Generator;
  25543.         as_variant_s_Item : variant_alternativeNode.Locator;
  25544.         use SeqOfvariant_alternativeNode;
  25545.         as_trailing_pragma_s_List : SeqOfpragma_declNode.Generator;
  25546.         as_trailing_pragma_s_Item : pragma_declNode.Locator;
  25547.         use SeqOfpragma_declNode;
  25548.         Old_inner_record_IHR : inner_record_IH.RecType := inner_record_IH.R;
  25549.     begin
  25550.         inner_record_IH.R.ih_in_variant :=  false ;
  25551.       if not SeqOfITEM.IsNull(as_list(Root)) then
  25552.         StartForward(as_list(Root), as_list_List);
  25553.         while not Finished(as_list_List) loop
  25554.             as_list_Item := Cell(as_list_List);
  25555.             Scan_ITEM(as_list_Item);
  25556.             Forward(as_list_List);
  25557.         end loop;
  25558.         EndIterate(as_list_List);
  25559.       end if;
  25560.       if not NAME_EXP.IsNull(as_variant_name(Root)) then
  25561.      
  25562.      
  25563.        IncrementToken (case_variantz);
  25564.        inner_record_IH.R.ih_in_variant := true;
  25565.      
  25566.      
  25567.         Scan_NAME_EXP(as_variant_name(Root));
  25568.      
  25569.      
  25570.        IncrementToken (is_case_variantz);
  25571.      
  25572.      
  25573.       end if;
  25574.       if not SeqOfvariant_alternativeNode.IsNull(as_variant_s(Root)) then
  25575.         StartForward(as_variant_s(Root), as_variant_s_List);
  25576.         while not Finished(as_variant_s_List) loop
  25577.             as_variant_s_Item := Cell(as_variant_s_List);
  25578.             Scan_variant_alternative(as_variant_s_Item);
  25579.             Forward(as_variant_s_List);
  25580.         end loop;
  25581.         EndIterate(as_variant_s_List);
  25582.      
  25583.      
  25584.        IncrementToken (end_case_variantz);
  25585.        IncrementToken (case_variantz);
  25586.        IncrementToken (semicolonz);
  25587.        inner_record_IH.R.ih_in_variant := false;
  25588.      
  25589.      
  25590.       end if;
  25591.       if not SeqOfpragma_declNode.IsNull(as_trailing_pragma_s(Root)) then
  25592.         StartForward(as_trailing_pragma_s(Root), as_trailing_pragma_s_List);
  25593.         while not Finished(as_trailing_pragma_s_List) loop
  25594.             as_trailing_pragma_s_Item := Cell(as_trailing_pragma_s_List);
  25595.             Scan_pragma_decl(as_trailing_pragma_s_Item);
  25596.             Forward(as_trailing_pragma_s_List);
  25597.         end loop;
  25598.         EndIterate(as_trailing_pragma_s_List);
  25599.       end if;
  25600.         inner_record_IH.R := Old_inner_record_IHR;
  25601.      
  25602.     end Scan_inner_record;
  25603.      
  25604. end INNER_RECORD_CLASS_Pkg;
  25605. -- End: SCINNER_RECORD_CLASS bdy -----------------------------------------------------
  25606. ::::::::::::::
  25607. scinner_r.spc
  25608. ::::::::::::::
  25609. -- Begin: SCINNER_RECORD_CLASS spc ---------------------------------------------------
  25610.      
  25611. with ST_DIANA; use ST_DIANA;
  25612.              package INNER_RECORD_CLASS_Pkg is
  25613.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator);
  25614.     procedure Scan_inner_record(Root : inner_recordNode.Locator);
  25615. end INNER_RECORD_CLASS_Pkg;
  25616. -- End: SCINNER_RECORD_CLASS spc -----------------------------------------------------
  25617.      
  25618. ::::::::::::::
  25619. scitem.bdy
  25620. ::::::::::::::
  25621. -- Begin: SCITEM bdy ---------------------------------------------------
  25622.      
  25623. with Halstead_Data_Base;  use Halstead_Data_Base;
  25624. with Definitions; use Definitions;
  25625.              with SERIES_UNIT_IH;
  25626. with variable_decl_IH;
  25627. with subtype_decl_IH;
  25628. with task_decl_IH;
  25629. with type_decl_IH;
  25630. with GENERIC_HEADER_CLASS_Pkg; use GENERIC_HEADER_CLASS_Pkg;
  25631. with DEF_ID_Pkg; use DEF_ID_Pkg;
  25632. with PKG_DEF_Pkg; use PKG_DEF_Pkg;
  25633. with HEADER_Pkg; use HEADER_Pkg;
  25634. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25635. with OBJECT_DEF_Pkg; use OBJECT_DEF_Pkg;
  25636. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25637. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  25638. with SUBP_DEF_Pkg; use SUBP_DEF_Pkg;
  25639. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  25640. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  25641. with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  25642.      
  25643.             with variable_decl_IH;
  25644.             with type_decl_IH;
  25645.             with generic_header_IH;
  25646.                        package body ITEM_Pkg is
  25647.      
  25648.      
  25649.     procedure Scan_ITEM(Root : ITEM.Locator) is
  25650.     begin
  25651.         case Kind(Root) is
  25652.           when GENERIC_ITEMKind => Scan_GENERIC_ITEM(Root);
  25653.           when OBJECT_ITEMKind => Scan_OBJECT_ITEM(Root);
  25654.           when PKG_ITEMKind => Scan_PKG_ITEM(Root);
  25655.           when REP_SPECKind => Scan_REP_SPEC(Root);
  25656.           when SUBP_ITEMKind => Scan_SUBP_ITEM(Root);
  25657.           when entry_declKind => Scan_entry_decl(Root);
  25658.           when exception_declKind => Scan_exception_decl(Root);
  25659.           when null_componentKind => Scan_null_component(Root);
  25660.           when number_declKind => Scan_number_decl(Root);
  25661.           when pragma_declKind => Scan_pragma_decl(Root);
  25662.           when subtype_declKind => Scan_subtype_decl(Root);
  25663.           when subunitKind => Scan_subunit(Root);
  25664.           when task_bodyKind => Scan_task_body(Root);
  25665.           when task_declKind => Scan_task_decl(Root);
  25666.           when type_declKind => Scan_type_decl(Root);
  25667.           when use_clauseKind => Scan_use_clause(Root);
  25668.           when with_clauseKind => Scan_with_clause(Root);
  25669.           when others => null;
  25670.         end case;
  25671.     end Scan_ITEM;
  25672.      
  25673.      
  25674.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator) is
  25675.     begin
  25676.         case Kind(Root) is
  25677.           when generic_pkg_declKind => Scan_generic_pkg_decl(Root);
  25678.           when generic_subp_declKind => Scan_generic_subp_decl(Root);
  25679.           when others => null;
  25680.         end case;
  25681.     end Scan_GENERIC_ITEM;
  25682.      
  25683.      
  25684.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator) is
  25685.     begin
  25686.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  25687.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  25688.       end if;
  25689.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  25690.      
  25691.      
  25692.        if not OuterMostBlockSeen then
  25693.            OuterMostBlockSeen := true;
  25694.        else
  25695.            BlockInfoStack.Push(BlockStack, CurrentBlock);
  25696.            CurrentBlock := InitializeCurrentBlock;
  25697.        end if;
  25698.        SetBlockId (lx_symrep (as_generic_id (root)),
  25699.                    package_spec_block,
  25700.                    SpcId,
  25701.                    LineNumber (lx_srcpos (root))
  25702.                    );
  25703.       IncrementToken (genericz);
  25704.       IncrementToken (package_spcz);
  25705.       IncrementToken (is_package_spcz);
  25706.       IncrementToken (end_package_spcz);
  25707.       IncrementToken (semicolonz);
  25708.      
  25709.      
  25710.         Scan_DEF_ID(as_generic_id(Root));
  25711.       end if;
  25712.       if not pkg_specNode.IsNull(as_generic_pkg_spec(Root)) then
  25713.         Scan_pkg_spec(as_generic_pkg_spec(Root));
  25714.       end if;
  25715.      
  25716.     end Scan_generic_pkg_decl;
  25717.      
  25718.      
  25719.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator) is
  25720.     begin
  25721.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  25722.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  25723.       end if;
  25724.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  25725.      
  25726.      
  25727.         IncrementToken (genericz);
  25728.         if Kind (as_generic_id (root)) in generic_proc_idKind then
  25729.             IncrementToken (procedurez);
  25730.         else
  25731.             IncrementToken (functionz);
  25732.         end if;
  25733.      
  25734.      
  25735.         Scan_DEF_ID(as_generic_id(Root));
  25736.       end if;
  25737.       if not HEADER.IsNull(as_generic_subp_spec(Root)) then
  25738.         Scan_HEADER(as_generic_subp_spec(Root));
  25739.       end if;
  25740.      
  25741.      
  25742.         IncrementToken (semicolonz);
  25743.      
  25744.      
  25745.      
  25746.     end Scan_generic_subp_decl;
  25747.      
  25748.      
  25749.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator) is
  25750.     begin
  25751.         case Kind(Root) is
  25752.           when component_declKind => Scan_component_decl(Root);
  25753.           when constant_declKind => Scan_constant_decl(Root);
  25754.           when dscrmt_declKind => Scan_dscrmt_decl(Root);
  25755.           when in_declKind => Scan_in_decl(Root);
  25756.           when in_out_declKind => Scan_in_out_decl(Root);
  25757.           when out_declKind => Scan_out_decl(Root);
  25758.           when variable_declKind => Scan_variable_decl(Root);
  25759.           when others => null;
  25760.         end case;
  25761.     end Scan_OBJECT_ITEM;
  25762.      
  25763.      
  25764.     procedure Scan_component_decl(Root : component_declNode.Locator) is
  25765.         as_id_s_List : SeqOfDEF_ID.Generator;
  25766.         as_id_s_Item : DEF_ID.Locator;
  25767.         use SeqOfDEF_ID;
  25768.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25769.     begin
  25770.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25771.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25772.         StartForward(as_id_s(Root), as_id_s_List);
  25773.         while not Finished(as_id_s_List) loop
  25774.             as_id_s_Item := Cell(as_id_s_List);
  25775.      
  25776.      
  25777.         if SERIES_UNIT_IH.R.ih_inlist then
  25778.             IncrementToken (commaz);
  25779.         end if;
  25780.         SERIES_UNIT_IH.R.ih_inlist := true;
  25781.      
  25782.      
  25783.             Scan_DEF_ID(as_id_s_Item);
  25784.             Forward(as_id_s_List);
  25785.         end loop;
  25786.         EndIterate(as_id_s_List);
  25787.      
  25788.      
  25789.         IncrementToken (colonz);
  25790.         SERIES_UNIT_IH.R.ih_inlist := false;
  25791.      
  25792.      
  25793.       end if;
  25794.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25795.         Scan_OBJECT_TYPE(as_object_type(Root));
  25796.       end if;
  25797.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25798.         Scan_OBJECT_DEF(as_object_def(Root));
  25799.       end if;
  25800.      
  25801.      
  25802.        IncrementToken (semicolonz);
  25803.      
  25804.      
  25805.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25806.      
  25807.     end Scan_component_decl;
  25808.      
  25809.      
  25810.     procedure Scan_constant_decl(Root : constant_declNode.Locator) is
  25811.         as_id_s_List : SeqOfDEF_ID.Generator;
  25812.         as_id_s_Item : DEF_ID.Locator;
  25813.         use SeqOfDEF_ID;
  25814.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25815.     begin
  25816.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25817.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25818.         StartForward(as_id_s(Root), as_id_s_List);
  25819.         while not Finished(as_id_s_List) loop
  25820.             as_id_s_Item := Cell(as_id_s_List);
  25821.      
  25822.      
  25823.         if SERIES_UNIT_IH.R.ih_inlist then
  25824.             IncrementToken (commaz);
  25825.         end if;
  25826.         SERIES_UNIT_IH.R.ih_inlist := true;
  25827.      
  25828.      
  25829.             Scan_DEF_ID(as_id_s_Item);
  25830.             Forward(as_id_s_List);
  25831.         end loop;
  25832.         EndIterate(as_id_s_List);
  25833.      
  25834.      
  25835.         IncrementToken (colonz);
  25836.         SERIES_UNIT_IH.R.ih_inlist := false;
  25837.      
  25838.      
  25839.       end if;
  25840.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25841.      
  25842.      
  25843.      IncrementToken (constantz);
  25844.      
  25845.      
  25846.         Scan_OBJECT_TYPE(as_object_type(Root));
  25847.       end if;
  25848.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25849.         Scan_OBJECT_DEF(as_object_def(Root));
  25850.       end if;
  25851.      
  25852.      
  25853.      IncrementToken (semicolonz);
  25854.      
  25855.      
  25856.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25857.      
  25858.     end Scan_constant_decl;
  25859.      
  25860.      
  25861.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator) is
  25862.         as_id_s_List : SeqOfDEF_ID.Generator;
  25863.         as_id_s_Item : DEF_ID.Locator;
  25864.         use SeqOfDEF_ID;
  25865.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25866.     begin
  25867.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25868.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25869.         StartForward(as_id_s(Root), as_id_s_List);
  25870.         while not Finished(as_id_s_List) loop
  25871.             as_id_s_Item := Cell(as_id_s_List);
  25872.      
  25873.      
  25874.         if SERIES_UNIT_IH.R.ih_inlist then
  25875.             IncrementToken (commaz);
  25876.         end if;
  25877.         SERIES_UNIT_IH.R.ih_inlist := true;
  25878.      
  25879.      
  25880.             Scan_DEF_ID(as_id_s_Item);
  25881.             Forward(as_id_s_List);
  25882.         end loop;
  25883.         EndIterate(as_id_s_List);
  25884.      
  25885.      
  25886.         IncrementToken (colonz);
  25887.         SERIES_UNIT_IH.R.ih_inlist := false;
  25888.      
  25889.      
  25890.       end if;
  25891.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25892.         Scan_OBJECT_TYPE(as_object_type(Root));
  25893.       end if;
  25894.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25895.         Scan_OBJECT_DEF(as_object_def(Root));
  25896.       end if;
  25897.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25898.      
  25899.     end Scan_dscrmt_decl;
  25900.      
  25901.      
  25902.     procedure Scan_in_decl(Root : in_declNode.Locator) is
  25903.         as_id_s_List : SeqOfDEF_ID.Generator;
  25904.         as_id_s_Item : DEF_ID.Locator;
  25905.         use SeqOfDEF_ID;
  25906.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25907.     begin
  25908.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25909.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25910.         StartForward(as_id_s(Root), as_id_s_List);
  25911.         while not Finished(as_id_s_List) loop
  25912.             as_id_s_Item := Cell(as_id_s_List);
  25913.      
  25914.      
  25915.         if SERIES_UNIT_IH.R.ih_inlist then
  25916.             IncrementToken (commaz);
  25917.         end if;
  25918.         SERIES_UNIT_IH.R.ih_inlist := true;
  25919.      
  25920.      
  25921.             Scan_DEF_ID(as_id_s_Item);
  25922.             Forward(as_id_s_List);
  25923.         end loop;
  25924.         EndIterate(as_id_s_List);
  25925.      
  25926.      
  25927.         IncrementToken (colonz);
  25928.         SERIES_UNIT_IH.R.ih_inlist := false;
  25929.      
  25930.      
  25931.       end if;
  25932.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25933.      
  25934.         if  lx_explicit_in_decl (root)
  25935.         then
  25936.      
  25937.      IncrementToken (in_parameterz);
  25938.      
  25939.         end if;
  25940.         Scan_OBJECT_TYPE(as_object_type(Root));
  25941.       end if;
  25942.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25943.         Scan_OBJECT_DEF(as_object_def(Root));
  25944.       end if;
  25945.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25946.      
  25947.     end Scan_in_decl;
  25948.      
  25949.      
  25950.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator) is
  25951.         as_id_s_List : SeqOfDEF_ID.Generator;
  25952.         as_id_s_Item : DEF_ID.Locator;
  25953.         use SeqOfDEF_ID;
  25954.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25955.     begin
  25956.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25957.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25958.         StartForward(as_id_s(Root), as_id_s_List);
  25959.         while not Finished(as_id_s_List) loop
  25960.             as_id_s_Item := Cell(as_id_s_List);
  25961.      
  25962.      
  25963.         if SERIES_UNIT_IH.R.ih_inlist then
  25964.             IncrementToken (commaz);
  25965.         end if;
  25966.         SERIES_UNIT_IH.R.ih_inlist := true;
  25967.      
  25968.      
  25969.             Scan_DEF_ID(as_id_s_Item);
  25970.             Forward(as_id_s_List);
  25971.         end loop;
  25972.         EndIterate(as_id_s_List);
  25973.      
  25974.      
  25975.         IncrementToken (colonz);
  25976.         SERIES_UNIT_IH.R.ih_inlist := false;
  25977.      
  25978.      
  25979.       end if;
  25980.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25981.      
  25982.      
  25983.      IncrementToken (in_out_parameterz);
  25984.      
  25985.      
  25986.      
  25987.         Scan_OBJECT_TYPE(as_object_type(Root));
  25988.       end if;
  25989.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25990.         Scan_OBJECT_DEF(as_object_def(Root));
  25991.       end if;
  25992.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25993.      
  25994.     end Scan_in_out_decl;
  25995.      
  25996.      
  25997.     procedure Scan_out_decl(Root : out_declNode.Locator) is
  25998.         as_id_s_List : SeqOfDEF_ID.Generator;
  25999.         as_id_s_Item : DEF_ID.Locator;
  26000.         use SeqOfDEF_ID;
  26001.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26002.     begin
  26003.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26004.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  26005.         StartForward(as_id_s(Root), as_id_s_List);
  26006.         while not Finished(as_id_s_List) loop
  26007.             as_id_s_Item := Cell(as_id_s_List);
  26008.      
  26009.      
  26010.         if SERIES_UNIT_IH.R.ih_inlist then
  26011.             IncrementToken (commaz);
  26012.         end if;
  26013.         SERIES_UNIT_IH.R.ih_inlist := true;
  26014.      
  26015.      
  26016.             Scan_DEF_ID(as_id_s_Item);
  26017.             Forward(as_id_s_List);
  26018.         end loop;
  26019.         EndIterate(as_id_s_List);
  26020.      
  26021.      
  26022.         IncrementToken (colonz);
  26023.         SERIES_UNIT_IH.R.ih_inlist := false;
  26024.      
  26025.      
  26026.       end if;
  26027.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  26028.      
  26029.      
  26030.      IncrementToken (outz);
  26031.      
  26032.      
  26033.         Scan_OBJECT_TYPE(as_object_type(Root));
  26034.       end if;
  26035.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  26036.         Scan_OBJECT_DEF(as_object_def(Root));
  26037.       end if;
  26038.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26039.      
  26040.     end Scan_out_decl;
  26041.      
  26042.      
  26043.     procedure Scan_variable_decl(Root : variable_declNode.Locator) is
  26044.         as_id_s_List : SeqOfDEF_ID.Generator;
  26045.         as_id_s_Item : DEF_ID.Locator;
  26046.         use SeqOfDEF_ID;
  26047.         Old_variable_decl_IHR : variable_decl_IH.RecType := variable_decl_IH.R;
  26048.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26049.     begin
  26050.         variable_decl_IH.R.ih_init :=  false ;
  26051.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26052.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  26053.         StartForward(as_id_s(Root), as_id_s_List);
  26054.         while not Finished(as_id_s_List) loop
  26055.             as_id_s_Item := Cell(as_id_s_List);
  26056.      
  26057.      
  26058.         if SERIES_UNIT_IH.R.ih_inlist then
  26059.             IncrementToken (commaz);
  26060.         end if;
  26061.         SERIES_UNIT_IH.R.ih_inlist := true;
  26062.      
  26063.      
  26064.             Scan_DEF_ID(as_id_s_Item);
  26065.             Forward(as_id_s_List);
  26066.         end loop;
  26067.         EndIterate(as_id_s_List);
  26068.      
  26069.      
  26070.         IncrementToken (colonz);
  26071.         SERIES_UNIT_IH.R.ih_inlist := false;
  26072.      
  26073.      
  26074.       end if;
  26075.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  26076.         Scan_OBJECT_TYPE(as_object_type(Root));
  26077.       end if;
  26078.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  26079.         Scan_OBJECT_DEF(as_object_def(Root));
  26080.       end if;
  26081.      
  26082.      
  26083.      IncrementToken (semicolonz);
  26084.      
  26085.      
  26086.         variable_decl_IH.R := Old_variable_decl_IHR;
  26087.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26088.      
  26089.     end Scan_variable_decl;
  26090.      
  26091.      
  26092.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator) is
  26093.     begin
  26094.         case Kind(Root) is
  26095.           when pkg_bodyKind => Scan_pkg_body(Root);
  26096.           when pkg_declKind => Scan_pkg_decl(Root);
  26097.           when others => null;
  26098.         end case;
  26099.     end Scan_PKG_ITEM;
  26100.      
  26101.      
  26102.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator) is
  26103.     begin
  26104.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  26105.         Scan_pkg_id(as_pkg_id(Root));
  26106.      
  26107.      
  26108.          if not OuterMostBlockSeen then
  26109.              OuterMostBlockSeen := true;
  26110.          else
  26111.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  26112.              CurrentBlock := InitializeCurrentBlock;
  26113.          end if;
  26114.          SetBlockId (lx_symrep (as_pkg_id (root)),
  26115.                      package_body_block,
  26116.                      BdyId,
  26117.                      LineNumber (lx_srcpos (root))
  26118.                      );
  26119.          IncrementToken (package_bdyz);
  26120.          IncrementToken (body_packagez);
  26121.          IncrementToken (is_package_bdyz);
  26122.      
  26123.      
  26124.       end if;
  26125.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  26126.         Scan_PKG_DEF(as_pkg_def(Root));
  26127.       end if;
  26128.      
  26129.      
  26130.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26131.         IncrementToken (semicolonz);
  26132.         ProcessBlockInfo (CurrentBlock);
  26133.         FreeSpace (CurrentBlock);
  26134.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26135.    end if;
  26136.      
  26137.      
  26138.      
  26139.     end Scan_pkg_body;
  26140.      
  26141.      
  26142.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator) is
  26143.     begin
  26144.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  26145.         Scan_pkg_id(as_pkg_id(Root));
  26146.      
  26147.      
  26148.       if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26149.          if not OuterMostBlockSeen then
  26150.              OuterMostBlockSeen := true;
  26151.          else
  26152.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  26153.              CurrentBlock := InitializeCurrentBlock;
  26154.          end if;
  26155.          SetBlockId (lx_symrep (as_pkg_id (root)),
  26156.                      package_spec_block,
  26157.                      SpcId,
  26158.                      LineNumber (lx_srcpos (root))
  26159.                      );
  26160.         IncrementToken (end_package_spcz);
  26161.      end if;
  26162.      IncrementToken (package_spcz);
  26163.      IncrementToken (is_package_spcz);
  26164.      
  26165.      
  26166.       end if;
  26167.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  26168.         Scan_PKG_DEF(as_pkg_def(Root));
  26169.       end if;
  26170.      
  26171.      
  26172.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26173.         IncrementToken (semicolonz);
  26174.         ProcessBlockInfo (CurrentBlock);
  26175.         FreeSpace (CurrentBlock);
  26176.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26177.    end if;
  26178.      
  26179.      
  26180.      
  26181.     end Scan_pkg_decl;
  26182.      
  26183.      
  26184.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator) is
  26185.     begin
  26186.         case Kind(Root) is
  26187.           when address_repKind => Scan_address_rep(Root);
  26188.           when record_repKind => Scan_record_rep(Root);
  26189.           when rep_componentKind => Scan_rep_component(Root);
  26190.           when simple_repKind => Scan_simple_rep(Root);
  26191.           when others => null;
  26192.         end case;
  26193.     end Scan_REP_SPEC;
  26194.      
  26195.      
  26196.     procedure Scan_address_rep(Root : address_repNode.Locator) is
  26197.     begin
  26198.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26199.      
  26200.      
  26201.       IncrementToken (for_repz);
  26202.      
  26203.      
  26204.         Scan_NAME_EXP(as_rep_name(Root));
  26205.      
  26206.      
  26207.       IncrementToken (use_repz);
  26208.       IncrementToken (atz);
  26209.       IncrementToken (semicolonz);
  26210.      
  26211.      
  26212.       end if;
  26213.       if not NAME_EXP.IsNull(as_address_rep_exp(Root)) then
  26214.         Scan_NAME_EXP(as_address_rep_exp(Root));
  26215.       end if;
  26216.      
  26217.     end Scan_address_rep;
  26218.      
  26219.      
  26220.     procedure Scan_record_rep(Root : record_repNode.Locator) is
  26221.         as_components_List : SeqOfrep_componentNode.Generator;
  26222.         as_components_Item : rep_componentNode.Locator;
  26223.         use SeqOfrep_componentNode;
  26224.     begin
  26225.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26226.      
  26227.      
  26228.       IncrementToken (for_repz);
  26229.      
  26230.      
  26231.         Scan_NAME_EXP(as_rep_name(Root));
  26232.      
  26233.      
  26234.    IncrementToken (use_repz);
  26235.    IncrementToken (record_repz);
  26236.      
  26237.      
  26238.       end if;
  26239.       if not NAME_EXP.IsNull(as_record_alignment(Root)) then
  26240.      
  26241.      
  26242.       IncrementToken (atz);
  26243.       IncrementToken (modz);
  26244.      
  26245.      
  26246.         Scan_NAME_EXP(as_record_alignment(Root));
  26247.       end if;
  26248.       if not SeqOfrep_componentNode.IsNull(as_components(Root)) then
  26249.         StartForward(as_components(Root), as_components_List);
  26250.         while not Finished(as_components_List) loop
  26251.             as_components_Item := Cell(as_components_List);
  26252.             Scan_rep_component(as_components_Item);
  26253.             Forward(as_components_List);
  26254.         end loop;
  26255.         EndIterate(as_components_List);
  26256.      
  26257.      
  26258.          IncrementToken (end_record_repz);
  26259.          IncrementToken (record_repz);
  26260.          IncrementToken (semicolonz);
  26261.      
  26262.      
  26263.       end if;
  26264.      
  26265.     end Scan_record_rep;
  26266.      
  26267.      
  26268.     procedure Scan_rep_component(Root : rep_componentNode.Locator) is
  26269.     begin
  26270.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26271.         Scan_NAME_EXP(as_rep_name(Root));
  26272.      
  26273.      
  26274.           IncrementToken (atz);
  26275.      
  26276.      
  26277.       end if;
  26278.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_alignment_range(Root)) then
  26279.      
  26280.      
  26281.       IncrementToken (rangez);
  26282.      
  26283.      
  26284.         Scan_RANGE_CONSTRAINT_CLASS(as_alignment_range(Root));
  26285.       end if;
  26286.       if not NAME_EXP.IsNull(as_rep_component_exp(Root)) then
  26287.         Scan_NAME_EXP(as_rep_component_exp(Root));
  26288.       end if;
  26289.      
  26290.     end Scan_rep_component;
  26291.      
  26292.      
  26293.     procedure Scan_simple_rep(Root : simple_repNode.Locator) is
  26294.     begin
  26295.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26296.         Scan_NAME_EXP(as_rep_name(Root));
  26297.       end if;
  26298.       if not NAME_EXP.IsNull(as_simple_rep_exp(Root)) then
  26299.      
  26300.      
  26301.      IncrementToken (for_repz);
  26302.      
  26303.      
  26304.         Scan_NAME_EXP(as_simple_rep_exp(Root));
  26305.      
  26306.      
  26307.       IncrementToken (use_repz);
  26308.      
  26309.      
  26310.       end if;
  26311.      
  26312.     end Scan_simple_rep;
  26313.      
  26314.      
  26315.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator) is
  26316.     begin
  26317.         case Kind(Root) is
  26318.           when subp_bodyKind => Scan_subp_body(Root);
  26319.           when subp_declKind => Scan_subp_decl(Root);
  26320.           when others => null;
  26321.         end case;
  26322.     end Scan_SUBP_ITEM;
  26323.      
  26324.      
  26325.     procedure Scan_subp_body(Root : subp_bodyNode.Locator) is
  26326.     begin
  26327.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  26328.         Scan_DEF_ID(as_subp_designator(Root));
  26329.      
  26330.      
  26331.       if not OuterMostBlockSeen then
  26332.           OuterMostBlockSeen := true;
  26333.       else
  26334.           BlockInfoStack.Push(BlockStack, CurrentBlock);
  26335.           CurrentBlock := InitializeCurrentBlock;
  26336.       end if;
  26337.        if Kind (as_subp_designator (root)) in proc_idKind then
  26338.            SetBlockId (lx_symrep (as_subp_designator (root)),
  26339.                        procedure_block,
  26340.                        BdyId,
  26341.                        LineNumber (lx_srcpos (root))
  26342.                        );
  26343.            IncrementToken (procedurez);
  26344.            IncrementToken (is_procedurez);
  26345.        else
  26346.            SetBlockId (lx_symrep (as_subp_designator (root)),
  26347.                        function_block,
  26348.                        BdyId,
  26349.                        LineNumber (lx_srcpos (root))
  26350.                        );
  26351.            IncrementToken (functionz);
  26352.            IncrementToken (is_functionz);
  26353.        end if;
  26354.      
  26355.      
  26356.       end if;
  26357.       if not HEADER.IsNull(as_subp_spec(Root)) then
  26358.         Scan_HEADER(as_subp_spec(Root));
  26359.       end if;
  26360.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  26361.         Scan_SUBP_DEF(as_subp_def(Root));
  26362.      
  26363.      
  26364.        ProcessBlockInfo (CurrentBlock);
  26365.        FreeSpace (CurrentBlock);
  26366.        BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26367.      
  26368.      
  26369.       end if;
  26370.      
  26371.     end Scan_subp_body;
  26372.      
  26373.      
  26374.     procedure Scan_subp_decl(Root : subp_declNode.Locator) is
  26375.     begin
  26376.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  26377.         Scan_DEF_ID(as_subp_designator(Root));
  26378.       end if;
  26379.       if not HEADER.IsNull(as_subp_spec(Root)) then
  26380.         Scan_HEADER(as_subp_spec(Root));
  26381.       end if;
  26382.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  26383.         Scan_SUBP_DEF(as_subp_def(Root));
  26384.       end if;
  26385.      
  26386.      
  26387.            if generic_header_IH.R.ih_ingeneric_param then
  26388.                IncrementToken (with_genericz);
  26389.            end if;
  26390.            if Kind (as_subp_designator (root)) in proc_idKind then
  26391.                IncrementToken (procedurez);
  26392.            else
  26393.                IncrementToken (functionz);
  26394.            end if;
  26395.      
  26396.      
  26397.      
  26398.      
  26399.         IncrementToken (semicolonz);
  26400.      
  26401.      
  26402.      
  26403.     end Scan_subp_decl;
  26404.      
  26405.      
  26406.     procedure Scan_entry_decl(Root : entry_declNode.Locator) is
  26407.     begin
  26408.      
  26409.      
  26410.      IncrementToken (entryz);
  26411.      
  26412.      
  26413.       if not entry_idNode.IsNull(as_entry_designator(Root)) then
  26414.         Scan_entry_id(as_entry_designator(Root));
  26415.       end if;
  26416.       if not entry_specNode.IsNull(as_entry_spec(Root)) then
  26417.         Scan_entry_spec(as_entry_spec(Root));
  26418.       end if;
  26419.      
  26420.      
  26421.      IncrementToken (semicolonz);
  26422.      
  26423.      
  26424.      
  26425.     end Scan_entry_decl;
  26426.      
  26427.      
  26428.     procedure Scan_exception_decl(Root : exception_declNode.Locator) is
  26429.         as_exception_id_s_List : SeqOfexception_idNode.Generator;
  26430.         as_exception_id_s_Item : exception_idNode.Locator;
  26431.         use SeqOfexception_idNode;
  26432.     begin
  26433.       if not SeqOfexception_idNode.IsNull(as_exception_id_s(Root)) then
  26434.         StartForward(as_exception_id_s(Root), as_exception_id_s_List);
  26435.         while not Finished(as_exception_id_s_List) loop
  26436.             as_exception_id_s_Item := Cell(as_exception_id_s_List);
  26437.      
  26438.      
  26439.       if SERIES_UNIT_IH.R.ih_inlist then
  26440.          IncrementToken (commaz);
  26441.       end if;
  26442.       SERIES_UNIT_IH.R.ih_inlist := true;
  26443.      
  26444.      
  26445.             Scan_exception_id(as_exception_id_s_Item);
  26446.             Forward(as_exception_id_s_List);
  26447.         end loop;
  26448.         EndIterate(as_exception_id_s_List);
  26449.      
  26450.      
  26451.        IncrementToken (colonz);
  26452.        IncrementToken (exceptionz);
  26453.        IncrementToken (semicolonz);
  26454.        SERIES_UNIT_IH.R.ih_inlist := false;
  26455.      
  26456.      
  26457.       end if;
  26458.       if not NAME_EXP.IsNull(as_exception_def(Root)) then
  26459.      
  26460.      
  26461.       IncrementToken (renamesz);
  26462.      
  26463.      
  26464.         Scan_NAME_EXP(as_exception_def(Root));
  26465.       end if;
  26466.      
  26467.     end Scan_exception_decl;
  26468.      
  26469.      
  26470.     procedure Scan_null_component(Root : null_componentNode.Locator) is
  26471.     begin
  26472.      
  26473.      
  26474.       IncrementToken (null_fieldz);
  26475.       IncrementToken (semicolonz);
  26476.      
  26477.      
  26478.      
  26479.     end Scan_null_component;
  26480.      
  26481.      
  26482.     procedure Scan_number_decl(Root : number_declNode.Locator) is
  26483.         as_number_id_s_List : SeqOfnumber_idNode.Generator;
  26484.         as_number_id_s_Item : number_idNode.Locator;
  26485.         use SeqOfnumber_idNode;
  26486.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26487.     begin
  26488.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26489.       if not SeqOfnumber_idNode.IsNull(as_number_id_s(Root)) then
  26490.         StartForward(as_number_id_s(Root), as_number_id_s_List);
  26491.         while not Finished(as_number_id_s_List) loop
  26492.             as_number_id_s_Item := Cell(as_number_id_s_List);
  26493.      
  26494.      
  26495.        if SERIES_UNIT_IH.R.ih_inlist then
  26496.           IncrementToken (commaz);
  26497.        end if;
  26498.        SERIES_UNIT_IH.R.ih_inlist := true;
  26499.      
  26500.      
  26501.             Scan_number_id(as_number_id_s_Item);
  26502.             Forward(as_number_id_s_List);
  26503.         end loop;
  26504.         EndIterate(as_number_id_s_List);
  26505.      
  26506.      
  26507.      IncrementToken (colonz);
  26508.      SERIES_UNIT_IH.R.ih_inlist := false;
  26509.      
  26510.      
  26511.       end if;
  26512.       if not NAME_EXP.IsNull(as_number_exp(Root)) then
  26513.      
  26514.      
  26515.      IncrementToken (constantz);
  26516.      IncrementToken (colon_equalsz);
  26517.      
  26518.      
  26519.         Scan_NAME_EXP(as_number_exp(Root));
  26520.       end if;
  26521.      
  26522.      
  26523.      IncrementToken (semicolonz);
  26524.      
  26525.      
  26526.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26527.      
  26528.     end Scan_number_decl;
  26529.      
  26530.      
  26531.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator) is
  26532.         as_pragma_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  26533.         as_pragma_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  26534.         use SeqOfGENERAL_ASSOC;
  26535.     begin
  26536.      
  26537.      
  26538.       IncrementToken (pragmaz);
  26539.      
  26540.      
  26541.       if not used_idNode.IsNull(as_pragma_id(Root)) then
  26542.         Scan_used_id(as_pragma_id(Root));
  26543.       end if;
  26544.       if not SeqOfGENERAL_ASSOC.IsNull(as_pragma_param_assoc_s(Root)) then
  26545.      
  26546.      
  26547.        IncrementToken (open_parenthesisz);
  26548.      
  26549.      
  26550.         StartForward(as_pragma_param_assoc_s(Root), as_pragma_param_assoc_s_List);
  26551.         while not Finished(as_pragma_param_assoc_s_List) loop
  26552.             as_pragma_param_assoc_s_Item := Cell(as_pragma_param_assoc_s_List);
  26553.      
  26554.      
  26555.         if SERIES_UNIT_IH.R.ih_inlist then
  26556.             IncrementToken (commaz);
  26557.         end if;
  26558.         SERIES_UNIT_IH.R.ih_inlist := true;
  26559.      
  26560.      
  26561.             Scan_GENERAL_ASSOC(as_pragma_param_assoc_s_Item);
  26562.             Forward(as_pragma_param_assoc_s_List);
  26563.         end loop;
  26564.         EndIterate(as_pragma_param_assoc_s_List);
  26565.      
  26566.      
  26567.        IncrementToken (closed_parenthesisz);
  26568.        SERIES_UNIT_IH.R.ih_inlist := false;
  26569.      
  26570.      
  26571.       end if;
  26572.      
  26573.      
  26574.        IncrementToken (semicolonz);
  26575.      
  26576.      
  26577.      
  26578.     end Scan_pragma_decl;
  26579.      
  26580.      
  26581.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator) is
  26582.         Old_subtype_decl_IHR : subtype_decl_IH.RecType := subtype_decl_IH.R;
  26583.     begin
  26584.         subtype_decl_IH.R.ih_in_subtype_decl :=  false ;
  26585.      
  26586.      
  26587.      IncrementToken (subtypez);
  26588.      subtype_decl_IH.R.ih_in_subtype_decl := true;
  26589.      
  26590.      
  26591.       if not subtype_idNode.IsNull(as_subtype_id(Root)) then
  26592.         Scan_subtype_id(as_subtype_id(Root));
  26593.      
  26594.      
  26595.       IncrementToken (is_subtypez);
  26596.      
  26597.      
  26598.       end if;
  26599.       if not object_type_constrainedNode.IsNull(as_subtype_constrained(Root)) then
  26600.         Scan_object_type_constrained(as_subtype_constrained(Root));
  26601.       end if;
  26602.      
  26603.      
  26604.       subtype_decl_IH.R.ih_in_subtype_decl := false;
  26605.       IncrementToken (semicolonz);
  26606.      
  26607.      
  26608.         subtype_decl_IH.R := Old_subtype_decl_IHR;
  26609.      
  26610.     end Scan_subtype_decl;
  26611.      
  26612.      
  26613.     procedure Scan_subunit(Root : subunitNode.Locator) is
  26614.     begin
  26615.      
  26616.      
  26617.      IncrementToken (separatez);
  26618.      
  26619.      
  26620.       if not NAME_EXP.IsNull(as_subunit_path(Root)) then
  26621.      
  26622.      
  26623.      IncrementToken (open_parenthesisz);
  26624.      
  26625.      
  26626.         Scan_NAME_EXP(as_subunit_path(Root));
  26627.      
  26628.      
  26629.      IncrementToken (closed_parenthesisz);
  26630.      
  26631.      
  26632.       end if;
  26633.       if not ITEM.IsNull(as_subunit_body(Root)) then
  26634.         Scan_ITEM(as_subunit_body(Root));
  26635.       end if;
  26636.      
  26637.     end Scan_subunit;
  26638.      
  26639.      
  26640.     procedure Scan_task_body(Root : task_bodyNode.Locator) is
  26641.     begin
  26642.      
  26643.      
  26644.      if not OuterMostBlockSeen then
  26645.          OuterMostBlockSeen := true;
  26646.      else
  26647.          BlockInfoStack.Push(BlockStack, CurrentBlock);
  26648.          CurrentBlock := InitializeCurrentBlock;
  26649.      end if;
  26650.      SetBlockId (lx_symrep (as_task_body_id (root)),
  26651.                  task_body_block,
  26652.                  BdyId,
  26653.                  LineNumber (lx_srcpos (root))
  26654.                  );
  26655.      IncrementToken (task_bdyz);
  26656.      IncrementToken (body_taskz);
  26657.      IncrementToken (is_task_bdyz);
  26658.      
  26659.      
  26660.       if not task_body_idNode.IsNull(as_task_body_id(Root)) then
  26661.         Scan_task_body_id(as_task_body_id(Root));
  26662.       end if;
  26663.       if not BLOCK_STUB.IsNull(as_task_body_block_stub(Root)) then
  26664.         Scan_BLOCK_STUB(as_task_body_block_stub(Root));
  26665.       end if;
  26666.      
  26667.      
  26668.      IncrementToken (semicolonz);
  26669.      ProcessBlockInfo (CurrentBlock);
  26670.      FreeSpace (CurrentBlock);
  26671.      BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26672.      
  26673.      
  26674.      
  26675.     end Scan_task_body;
  26676.      
  26677.      
  26678.     procedure Scan_task_decl(Root : task_declNode.Locator) is
  26679.         Old_task_decl_IHR : task_decl_IH.RecType := task_decl_IH.R;
  26680.     begin
  26681.         task_decl_IH.R.ih_intask_decl :=  false ;
  26682.      
  26683.      
  26684.       task_decl_IH.R.ih_intask_decl := true;
  26685.      
  26686.      
  26687.       if not variable_idNode.IsNull(as_task_id(Root)) then
  26688.         Scan_variable_id(as_task_id(Root));
  26689.       end if;
  26690.       if not task_specNode.IsNull(as_task_def(Root)) then
  26691.         Scan_task_spec(as_task_def(Root));
  26692.       end if;
  26693.      
  26694.      
  26695.  task_decl_IH.R.ih_intask_decl := false;
  26696.      
  26697.      
  26698.         task_decl_IH.R := Old_task_decl_IHR;
  26699.      
  26700.     end Scan_task_decl;
  26701.      
  26702.      
  26703.     procedure Scan_type_decl(Root : type_declNode.Locator) is
  26704.         as_type_dscrmt_s_List : SeqOfdscrmt_declNode.Generator;
  26705.         as_type_dscrmt_s_Item : dscrmt_declNode.Locator;
  26706.         use SeqOfdscrmt_declNode;
  26707.         Old_type_decl_IHR : type_decl_IH.RecType := type_decl_IH.R;
  26708.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26709.     begin
  26710.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26711.      
  26712.      
  26713.      if Kind (as_type_spec (root)) not in task_specKind then
  26714.         IncrementToken (typez);
  26715.         IncrementToken (is_typez);
  26716.      end if;
  26717.      
  26718.      
  26719.       if not type_idNode.IsNull(as_type_id(Root)) then
  26720.         Scan_type_id(as_type_id(Root));
  26721.       end if;
  26722.       if not SeqOfdscrmt_declNode.IsNull(as_type_dscrmt_s(Root)) then
  26723.      
  26724.      
  26725.      IncrementToken (open_parenthesisz);
  26726.      
  26727.      
  26728.         StartForward(as_type_dscrmt_s(Root), as_type_dscrmt_s_List);
  26729.         while not Finished(as_type_dscrmt_s_List) loop
  26730.             as_type_dscrmt_s_Item := Cell(as_type_dscrmt_s_List);
  26731.      
  26732.      
  26733.       if SERIES_UNIT_IH.R.ih_inlist then
  26734.           IncrementToken (semicolonz);
  26735.       end if;
  26736.       SERIES_UNIT_IH.R.ih_inlist := true;
  26737.      
  26738.      
  26739.             Scan_dscrmt_decl(as_type_dscrmt_s_Item);
  26740.             Forward(as_type_dscrmt_s_List);
  26741.         end loop;
  26742.         EndIterate(as_type_dscrmt_s_List);
  26743.      
  26744.      
  26745.      IncrementToken (closed_parenthesisz);
  26746.      SERIES_UNIT_IH.R.ih_inlist := false;
  26747.      
  26748.      
  26749.       end if;
  26750.       if not TYPE_SPEC.IsNull(as_type_spec(Root)) then
  26751.         Scan_TYPE_SPEC(as_type_spec(Root));
  26752.       end if;
  26753.      
  26754.      
  26755.      if Kind (as_type_spec (root)) not in task_specKind then
  26756.         IncrementToken (semicolonz);
  26757.      end if;
  26758.      
  26759.      
  26760.         type_decl_IH.R := Old_type_decl_IHR;
  26761.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26762.      
  26763.     end Scan_type_decl;
  26764.      
  26765.      
  26766.     procedure Scan_use_clause(Root : use_clauseNode.Locator) is
  26767.         as_use_clause_list_List : SeqOfNAME_EXP.Generator;
  26768.         as_use_clause_list_Item : NAME_EXP.Locator;
  26769.         use SeqOfNAME_EXP;
  26770.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26771.     begin
  26772.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26773.       if not SeqOfNAME_EXP.IsNull(as_use_clause_list(Root)) then
  26774.      
  26775.      
  26776.      IncrementToken (use_contextz);
  26777.      
  26778.      
  26779.         StartForward(as_use_clause_list(Root), as_use_clause_list_List);
  26780.         while not Finished(as_use_clause_list_List) loop
  26781.             as_use_clause_list_Item := Cell(as_use_clause_list_List);
  26782.      
  26783.      
  26784.       if SERIES_UNIT_IH.R.ih_inlist then
  26785.           IncrementToken (commaz);
  26786.       end if;
  26787.       SERIES_UNIT_IH.R.ih_inlist := true;
  26788.      
  26789.      
  26790.             Scan_NAME_EXP(as_use_clause_list_Item);
  26791.             Forward(as_use_clause_list_List);
  26792.         end loop;
  26793.         EndIterate(as_use_clause_list_List);
  26794.       end if;
  26795.      
  26796.      
  26797.      IncrementToken (semicolonz);
  26798.      SERIES_UNIT_IH.R.ih_inlist := false;
  26799.      
  26800.      
  26801.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26802.      
  26803.     end Scan_use_clause;
  26804.      
  26805.      
  26806.     procedure Scan_with_clause(Root : with_clauseNode.Locator) is
  26807.         as_with_clause_list_List : SeqOfNAME_EXP.Generator;
  26808.         as_with_clause_list_Item : NAME_EXP.Locator;
  26809.         use SeqOfNAME_EXP;
  26810.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26811.     begin
  26812.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26813.       if not SeqOfNAME_EXP.IsNull(as_with_clause_list(Root)) then
  26814.      
  26815.      
  26816.      IncrementToken (with_contextz);
  26817.      
  26818.      
  26819.         StartForward(as_with_clause_list(Root), as_with_clause_list_List);
  26820.         while not Finished(as_with_clause_list_List) loop
  26821.             as_with_clause_list_Item := Cell(as_with_clause_list_List);
  26822.      
  26823.      
  26824.        if SERIES_UNIT_IH.R.ih_inlist then
  26825.            IncrementToken (commaz);
  26826.        end if;
  26827.        SERIES_UNIT_IH.R.ih_inlist := true;
  26828.      
  26829.      
  26830.             Scan_NAME_EXP(as_with_clause_list_Item);
  26831.             Forward(as_with_clause_list_List);
  26832.         end loop;
  26833.         EndIterate(as_with_clause_list_List);
  26834.       end if;
  26835.      
  26836.      
  26837.       IncrementToken (semicolonz);
  26838.       SERIES_UNIT_IH.R.ih_inlist := false;
  26839.      
  26840.      
  26841.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26842.      
  26843.     end Scan_with_clause;
  26844.      
  26845. end ITEM_Pkg;
  26846. -- End: SCITEM bdy -----------------------------------------------------
  26847. ::::::::::::::
  26848. scitem.spc
  26849. ::::::::::::::
  26850. -- Begin: SCITEM spc ---------------------------------------------------
  26851.      
  26852. with ST_DIANA; use ST_DIANA;
  26853.              package ITEM_Pkg is
  26854.     procedure Scan_ITEM(Root : ITEM.Locator);
  26855.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator);
  26856.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator);
  26857.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator);
  26858.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator);
  26859.     procedure Scan_component_decl(Root : component_declNode.Locator);
  26860.     procedure Scan_constant_decl(Root : constant_declNode.Locator);
  26861.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator);
  26862.     procedure Scan_in_decl(Root : in_declNode.Locator);
  26863.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator);
  26864.     procedure Scan_out_decl(Root : out_declNode.Locator);
  26865.     procedure Scan_variable_decl(Root : variable_declNode.Locator);
  26866.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator);
  26867.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator);
  26868.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator);
  26869.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator);
  26870.     procedure Scan_address_rep(Root : address_repNode.Locator);
  26871.     procedure Scan_record_rep(Root : record_repNode.Locator);
  26872.     procedure Scan_rep_component(Root : rep_componentNode.Locator);
  26873.     procedure Scan_simple_rep(Root : simple_repNode.Locator);
  26874.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator);
  26875.     procedure Scan_subp_body(Root : subp_bodyNode.Locator);
  26876.     procedure Scan_subp_decl(Root : subp_declNode.Locator);
  26877.     procedure Scan_entry_decl(Root : entry_declNode.Locator);
  26878.     procedure Scan_exception_decl(Root : exception_declNode.Locator);
  26879.     procedure Scan_null_component(Root : null_componentNode.Locator);
  26880.     procedure Scan_number_decl(Root : number_declNode.Locator);
  26881.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator);
  26882.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator);
  26883.     procedure Scan_subunit(Root : subunitNode.Locator);
  26884.     procedure Scan_task_body(Root : task_bodyNode.Locator);
  26885.     procedure Scan_task_decl(Root : task_declNode.Locator);
  26886.     procedure Scan_type_decl(Root : type_declNode.Locator);
  26887.     procedure Scan_use_clause(Root : use_clauseNode.Locator);
  26888.     procedure Scan_with_clause(Root : with_clauseNode.Locator);
  26889. end ITEM_Pkg;
  26890. -- End: SCITEM spc -----------------------------------------------------
  26891. ::::::::::::::
  26892. sciterati.bdy
  26893. ::::::::::::::
  26894. -- Begin: SCITERATION bdy ---------------------------------------------------
  26895.      
  26896. with Halstead_Data_Base;  use Halstead_Data_Base;
  26897. with Definitions; use Definitions;
  26898.              with DEF_ID_Pkg; use DEF_ID_Pkg;
  26899. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  26900. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  26901. package body ITERATION_Pkg is
  26902.      
  26903.      
  26904.     procedure Scan_ITERATION(Root : ITERATION.Locator) is
  26905.     begin
  26906.         case Kind(Root) is
  26907.           when FOR_ITERATIONKind => Scan_FOR_ITERATION(Root);
  26908.           when while_iterationKind => Scan_while_iteration(Root);
  26909.           when others => null;
  26910.         end case;
  26911.     end Scan_ITERATION;
  26912.      
  26913.      
  26914.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator) is
  26915.     begin
  26916.         case Kind(Root) is
  26917.           when forward_iterationKind => Scan_forward_iteration(Root);
  26918.           when reverse_iterationKind => Scan_reverse_iteration(Root);
  26919.           when others => null;
  26920.         end case;
  26921.     end Scan_FOR_ITERATION;
  26922.      
  26923.      
  26924.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator) is
  26925.     begin
  26926.       if not iteration_idNode.IsNull(as_id(Root)) then
  26927.      
  26928.      
  26929.        IncrementToken (for_loopz);
  26930.        IncrementToken (in_loopz);
  26931.      
  26932.      
  26933.         Scan_iteration_id(as_id(Root));
  26934.       end if;
  26935.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  26936.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  26937.       end if;
  26938.      
  26939.     end Scan_forward_iteration;
  26940.      
  26941.      
  26942.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator) is
  26943.     begin
  26944.       if not iteration_idNode.IsNull(as_id(Root)) then
  26945.      
  26946.      
  26947.        IncrementToken (for_loopz);
  26948.        IncrementToken (in_loopz);
  26949.      
  26950.      
  26951.         Scan_iteration_id(as_id(Root));
  26952.       end if;
  26953.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  26954.      
  26955.      
  26956.        IncrementToken (reversez);
  26957.      
  26958.      
  26959.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  26960.       end if;
  26961.      
  26962.     end Scan_reverse_iteration;
  26963.      
  26964.      
  26965.     procedure Scan_while_iteration(Root : while_iterationNode.Locator) is
  26966.     begin
  26967.       if not NAME_EXP.IsNull(as_while_exp(Root)) then
  26968.      
  26969.      
  26970.        IncrementToken (whilez);
  26971.      
  26972.      
  26973.         Scan_NAME_EXP(as_while_exp(Root));
  26974.       end if;
  26975.      
  26976.     end Scan_while_iteration;
  26977.      
  26978. end ITERATION_Pkg;
  26979. -- End: SCITERATION bdy -----------------------------------------------------
  26980. ::::::::::::::
  26981. sciterati.spc
  26982. ::::::::::::::
  26983. -- Begin: SCITERATION spc ---------------------------------------------------
  26984.      
  26985. with ST_DIANA; use ST_DIANA;
  26986.              package ITERATION_Pkg is
  26987.     procedure Scan_ITERATION(Root : ITERATION.Locator);
  26988.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator);
  26989.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator);
  26990.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator);
  26991.     procedure Scan_while_iteration(Root : while_iterationNode.Locator);
  26992. end ITERATION_Pkg;
  26993. -- End: SCITERATION spc -----------------------------------------------------
  26994. ::::::::::::::
  26995. scname_ex.bdy
  26996. ::::::::::::::
  26997. -- Begin: SCNAME_EXP bdy ---------------------------------------------------
  26998.      
  26999. with Halstead_Data_Base;  use Halstead_Data_Base;
  27000. with Definitions; use Definitions;
  27001.              with SERIES_UNIT_IH;
  27002. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  27003. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  27004. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  27005.      
  27006.                with VmmTextPkg;
  27007.                with TEXT_IO;
  27008.                          package body NAME_EXP_Pkg is
  27009.      
  27010.      
  27011.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator) is
  27012.     begin
  27013.         case Kind(Root) is
  27014.           when AGGKind => Scan_AGG(Root);
  27015.           when ALL_COMPONENTSKind => Scan_ALL_COMPONENTS(Root);
  27016.           when CALLSKind => Scan_CALLS(Root);
  27017.           when MARKKind => Scan_MARK(Root);
  27018.           when MEMBERSHIP_EXPKind => Scan_MEMBERSHIP_EXP(Root);
  27019.           when OPERATOR_EXPKind => Scan_OPERATOR_EXP(Root);
  27020.           when SHORT_CIRCUIT_EXPKind => Scan_SHORT_CIRCUIT_EXP(Root);
  27021.           when attributeKind => Scan_attribute(Root);
  27022.           when attribute_indexedKind => Scan_attribute_indexed(Root);
  27023.           when conversionKind => Scan_conversion(Root);
  27024.           when family_indexedKind => Scan_family_indexed(Root);
  27025.           when indexedKind => Scan_indexed(Root);
  27026.           when init_allocatorKind => Scan_init_allocator(Root);
  27027.           when null_accessKind => Scan_null_access(Root);
  27028.           when numeric_literalKind => Scan_numeric_literal(Root);
  27029.           when parenthesizedKind => Scan_parenthesized(Root);
  27030.           when qualifiedKind => Scan_qualified(Root);
  27031.           when sliceKind => Scan_slice(Root);
  27032.           when string_literalKind => Scan_string_literal(Root);
  27033.           when uninit_allocatorKind => Scan_uninit_allocator(Root);
  27034.           when others => null;
  27035.         end case;
  27036.     end Scan_NAME_EXP;
  27037.      
  27038.      
  27039.     procedure Scan_AGG(Root : AGG.Locator) is
  27040.     begin
  27041.         case Kind(Root) is
  27042.           when apply_aggKind => Scan_apply_agg(Root);
  27043.           when array_aggKind => Scan_array_agg(Root);
  27044.           when record_aggKind => Scan_record_agg(Root);
  27045.           when others => null;
  27046.         end case;
  27047.     end Scan_AGG;
  27048.      
  27049.      
  27050.     procedure Scan_apply_agg(Root : apply_aggNode.Locator) is
  27051.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  27052.         as_agg_s_Item : AGG_COMPONENT.Locator;
  27053.         use SeqOfAGG_COMPONENT;
  27054.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27055.     begin
  27056.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27057.      
  27058.      
  27059.      IncrementToken (open_parenthesisz);
  27060.      
  27061.      
  27062.         StartForward(as_agg_s(Root), as_agg_s_List);
  27063.         while not Finished(as_agg_s_List) loop
  27064.             as_agg_s_Item := Cell(as_agg_s_List);
  27065.      
  27066.      
  27067.      if SERIES_UNIT_IH.R.ih_inlist then
  27068.          IncrementToken (commaz);
  27069.      end if;
  27070.      SERIES_UNIT_IH.R.ih_inlist := true;
  27071.      
  27072.      
  27073.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27074.             Forward(as_agg_s_List);
  27075.         end loop;
  27076.         EndIterate(as_agg_s_List);
  27077.      
  27078.      
  27079.      IncrementToken (closed_parenthesisz);
  27080.      SERIES_UNIT_IH.R.ih_inlist := false;
  27081.      
  27082.      
  27083.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27084.      
  27085.     end Scan_apply_agg;
  27086.      
  27087.      
  27088.     procedure Scan_array_agg(Root : array_aggNode.Locator) is
  27089.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  27090.         as_agg_s_Item : AGG_COMPONENT.Locator;
  27091.         use SeqOfAGG_COMPONENT;
  27092.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27093.     begin
  27094.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27095.      
  27096.      
  27097.      IncrementToken (open_parenthesisz);
  27098.      
  27099.      
  27100.         StartForward(as_agg_s(Root), as_agg_s_List);
  27101.         while not Finished(as_agg_s_List) loop
  27102.             as_agg_s_Item := Cell(as_agg_s_List);
  27103.      
  27104.      
  27105.      if SERIES_UNIT_IH.R.ih_inlist then
  27106.          IncrementToken (commaz);
  27107.      end if;
  27108.      SERIES_UNIT_IH.R.ih_inlist := true;
  27109.      
  27110.      
  27111.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27112.             Forward(as_agg_s_List);
  27113.         end loop;
  27114.         EndIterate(as_agg_s_List);
  27115.      
  27116.      
  27117.      IncrementToken (closed_parenthesisz);
  27118.      SERIES_UNIT_IH.R.ih_inlist := false;
  27119.      
  27120.      
  27121.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27122.      
  27123.     end Scan_array_agg;
  27124.      
  27125.      
  27126.     procedure Scan_record_agg(Root : record_aggNode.Locator) is
  27127.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  27128.         as_agg_s_Item : AGG_COMPONENT.Locator;
  27129.         use SeqOfAGG_COMPONENT;
  27130.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27131.     begin
  27132.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27133.      
  27134.      
  27135.      IncrementToken (open_parenthesisz);
  27136.      
  27137.      
  27138.         StartForward(as_agg_s(Root), as_agg_s_List);
  27139.         while not Finished(as_agg_s_List) loop
  27140.             as_agg_s_Item := Cell(as_agg_s_List);
  27141.      
  27142.      
  27143.      if SERIES_UNIT_IH.R.ih_inlist then
  27144.          IncrementToken (commaz);
  27145.      end if;
  27146.      SERIES_UNIT_IH.R.ih_inlist := true;
  27147.      
  27148.      
  27149.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27150.             Forward(as_agg_s_List);
  27151.         end loop;
  27152.         EndIterate(as_agg_s_List);
  27153.      
  27154.      
  27155.      IncrementToken (closed_parenthesisz);
  27156.      SERIES_UNIT_IH.R.ih_inlist := false;
  27157.      
  27158.      
  27159.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27160.      
  27161.     end Scan_record_agg;
  27162.      
  27163.      
  27164.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator) is
  27165.     begin
  27166.         case Kind(Root) is
  27167.           when explicit_all_componentsKind => Scan_explicit_all_components(Root);
  27168.           when implicit_all_componentsKind => Scan_implicit_all_components(Root);
  27169.           when others => null;
  27170.         end case;
  27171.     end Scan_ALL_COMPONENTS;
  27172.      
  27173.      
  27174.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator) is
  27175.     begin
  27176.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  27177.         Scan_NAME_EXP(as_all_name(Root));
  27178.       end if;
  27179.      
  27180.      
  27181.       IncrementToken (allz);
  27182.       IncrementToken (dotz);
  27183.      
  27184.      
  27185.      
  27186.     end Scan_explicit_all_components;
  27187.      
  27188.      
  27189.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator) is
  27190.     begin
  27191.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  27192.         Scan_NAME_EXP(as_all_name(Root));
  27193.       end if;
  27194.      
  27195.     end Scan_implicit_all_components;
  27196.      
  27197.      
  27198.     procedure Scan_CALLS(Root : CALLS.Locator) is
  27199.     begin
  27200.         case Kind(Root) is
  27201.           when apply_callKind => Scan_apply_call(Root);
  27202.           when entry_callKind => Scan_entry_call(Root);
  27203.           when func_callKind => Scan_func_call(Root);
  27204.           when proc_callKind => Scan_proc_call(Root);
  27205.           when others => null;
  27206.         end case;
  27207.     end Scan_CALLS;
  27208.      
  27209.      
  27210.     procedure Scan_apply_call(Root : apply_callNode.Locator) is
  27211.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27212.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27213.         use SeqOfGENERAL_ASSOC;
  27214.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27215.     begin
  27216.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27217.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27218.         Scan_NAME_EXP(as_apply_name(Root));
  27219.      
  27220.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27221.         then
  27222.      
  27223.          IncrementToken (open_parenthesisz);
  27224.      
  27225.         end if;
  27226.       end if;
  27227.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27228.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27229.         while not Finished(as_param_assoc_s_List) loop
  27230.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27231.      
  27232.      
  27233.       if SERIES_UNIT_IH.R.ih_inlist then
  27234.           IncrementToken (commaz);
  27235.       end if;
  27236.       SERIES_UNIT_IH.R.ih_inlist := true;
  27237.      
  27238.      
  27239.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27240.             Forward(as_param_assoc_s_List);
  27241.         end loop;
  27242.         EndIterate(as_param_assoc_s_List);
  27243.      
  27244.      
  27245.         IncrementToken (closed_parenthesisz);
  27246.    SERIES_UNIT_IH.R.ih_inlist := false;
  27247.      
  27248.      
  27249.       end if;
  27250.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27251.      
  27252.     end Scan_apply_call;
  27253.      
  27254.      
  27255.     procedure Scan_entry_call(Root : entry_callNode.Locator) is
  27256.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27257.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27258.         use SeqOfGENERAL_ASSOC;
  27259.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27260.     begin
  27261.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27262.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27263.         Scan_NAME_EXP(as_apply_name(Root));
  27264.      
  27265.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27266.         then
  27267.      
  27268.          IncrementToken (open_parenthesisz);
  27269.      
  27270.         end if;
  27271.       end if;
  27272.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27273.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27274.         while not Finished(as_param_assoc_s_List) loop
  27275.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27276.      
  27277.      
  27278.       if SERIES_UNIT_IH.R.ih_inlist then
  27279.           IncrementToken (commaz);
  27280.       end if;
  27281.       SERIES_UNIT_IH.R.ih_inlist := true;
  27282.      
  27283.      
  27284.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27285.             Forward(as_param_assoc_s_List);
  27286.         end loop;
  27287.         EndIterate(as_param_assoc_s_List);
  27288.      
  27289.      
  27290.         IncrementToken (closed_parenthesisz);
  27291.    SERIES_UNIT_IH.R.ih_inlist := false;
  27292.      
  27293.      
  27294.       end if;
  27295.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27296.      
  27297.     end Scan_entry_call;
  27298.      
  27299.      
  27300.     procedure Scan_func_call(Root : func_callNode.Locator) is
  27301.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27302.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27303.         use SeqOfGENERAL_ASSOC;
  27304.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27305.     begin
  27306.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27307.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27308.         Scan_NAME_EXP(as_apply_name(Root));
  27309.      
  27310.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27311.         then
  27312.      
  27313.          IncrementToken (open_parenthesisz);
  27314.      
  27315.         end if;
  27316.       end if;
  27317.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27318.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27319.         while not Finished(as_param_assoc_s_List) loop
  27320.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27321.      
  27322.      
  27323.       if SERIES_UNIT_IH.R.ih_inlist then
  27324.           IncrementToken (commaz);
  27325.       end if;
  27326.       SERIES_UNIT_IH.R.ih_inlist := true;
  27327.      
  27328.      
  27329.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27330.             Forward(as_param_assoc_s_List);
  27331.         end loop;
  27332.         EndIterate(as_param_assoc_s_List);
  27333.      
  27334.      
  27335.         IncrementToken (closed_parenthesisz);
  27336.    SERIES_UNIT_IH.R.ih_inlist := false;
  27337.      
  27338.      
  27339.       end if;
  27340.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27341.      
  27342.     end Scan_func_call;
  27343.      
  27344.      
  27345.     procedure Scan_proc_call(Root : proc_callNode.Locator) is
  27346.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27347.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27348.         use SeqOfGENERAL_ASSOC;
  27349.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27350.     begin
  27351.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27352.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27353.         Scan_NAME_EXP(as_apply_name(Root));
  27354.      
  27355.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27356.         then
  27357.      
  27358.          IncrementToken (open_parenthesisz);
  27359.      
  27360.         end if;
  27361.       end if;
  27362.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27363.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27364.         while not Finished(as_param_assoc_s_List) loop
  27365.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27366.      
  27367.      
  27368.       if SERIES_UNIT_IH.R.ih_inlist then
  27369.           IncrementToken (commaz);
  27370.       end if;
  27371.       SERIES_UNIT_IH.R.ih_inlist := true;
  27372.      
  27373.      
  27374.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27375.             Forward(as_param_assoc_s_List);
  27376.         end loop;
  27377.         EndIterate(as_param_assoc_s_List);
  27378.      
  27379.      
  27380.         IncrementToken (closed_parenthesisz);
  27381.    SERIES_UNIT_IH.R.ih_inlist := false;
  27382.      
  27383.      
  27384.       end if;
  27385.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27386.      
  27387.     end Scan_proc_call;
  27388.      
  27389.      
  27390.     procedure Scan_MARK(Root : MARK.Locator) is
  27391.     begin
  27392.         case Kind(Root) is
  27393.           when USED_SYMBOLKind => Scan_USED_SYMBOL(Root);
  27394.           when selectedKind => Scan_selected(Root);
  27395.           when others => null;
  27396.         end case;
  27397.     end Scan_MARK;
  27398.      
  27399.      
  27400.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator) is
  27401.     begin
  27402.         case Kind(Root) is
  27403.           when used_charKind => Scan_used_char(Root);
  27404.           when used_idKind => Scan_used_id(Root);
  27405.           when used_operatorKind => Scan_used_operator(Root);
  27406.           when others => null;
  27407.         end case;
  27408.     end Scan_USED_SYMBOL;
  27409.      
  27410.      
  27411.     procedure Scan_used_char(Root : used_charNode.Locator) is
  27412.     begin
  27413.      
  27414.      
  27415.      Literal_Set.Insert (lx_text (lx_symrep (root)),
  27416.                          CurrentBlock.SetOfLiterals);
  27417.      IncrementToken (single_quotez);
  27418.      IncrementToken (single_quotez);
  27419.      
  27420.      
  27421.      
  27422.     end Scan_used_char;
  27423.      
  27424.      
  27425.     procedure Scan_used_id(Root : used_idNode.Locator) is
  27426.     begin
  27427.      
  27428.      
  27429.       if not DEF_ID.IsNull (sm_def (root)) then
  27430.          DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  27431.       else
  27432.           TEXT_IO.Put ("?? Unexpected null sm_def: ");
  27433.           TEXT_IO.Put_Line (
  27434.             VmmTextPkg.Value (
  27435.                    Source_Text.Value (
  27436.                      lx_text (
  27437.                        ne_normalized_symrep (
  27438.                          ne_symbol_entry_in_table (
  27439.                            lx_symrep (
  27440.                              root))))))
  27441.               );
  27442.       end if;
  27443.      
  27444.      
  27445.      
  27446.     end Scan_used_id;
  27447.      
  27448.      
  27449.     procedure Scan_used_operator(Root : used_operatorNode.Locator) is
  27450.     begin
  27451.      
  27452.      
  27453.         DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  27454.      
  27455.      
  27456.      
  27457.     end Scan_used_operator;
  27458.      
  27459.      
  27460.     procedure Scan_selected(Root : selectedNode.Locator) is
  27461.     begin
  27462.       if not NAME_EXP.IsNull(as_selected_name(Root)) then
  27463.         Scan_NAME_EXP(as_selected_name(Root));
  27464.      
  27465.      
  27466.      IncrementToken (dotz);
  27467.      
  27468.      
  27469.       end if;
  27470.       if not NAME_EXP.IsNull(as_selected_designator(Root)) then
  27471.         Scan_NAME_EXP(as_selected_designator(Root));
  27472.       end if;
  27473.      
  27474.     end Scan_selected;
  27475.      
  27476.      
  27477.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator) is
  27478.     begin
  27479.         case Kind(Root) is
  27480.           when in_expKind => Scan_in_exp(Root);
  27481.           when not_in_expKind => Scan_not_in_exp(Root);
  27482.           when others => null;
  27483.         end case;
  27484.     end Scan_MEMBERSHIP_EXP;
  27485.      
  27486.      
  27487.     procedure Scan_in_exp(Root : in_expNode.Locator) is
  27488.     begin
  27489.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  27490.         Scan_NAME_EXP(as_membership_exp(Root));
  27491.      
  27492.      
  27493.      IncrementToken (in_membershipz);
  27494.      
  27495.      
  27496.       end if;
  27497.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  27498.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  27499.       end if;
  27500.      
  27501.     end Scan_in_exp;
  27502.      
  27503.      
  27504.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator) is
  27505.     begin
  27506.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  27507.         Scan_NAME_EXP(as_membership_exp(Root));
  27508.      
  27509.      
  27510.      IncrementToken (not_in_membershipz);
  27511.      IncrementToken (in_membershipz);
  27512.      
  27513.      
  27514.       end if;
  27515.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  27516.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  27517.       end if;
  27518.      
  27519.     end Scan_not_in_exp;
  27520.      
  27521.      
  27522.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator) is
  27523.     begin
  27524.         case Kind(Root) is
  27525.           when binary_operationKind => Scan_binary_operation(Root);
  27526.           when unary_operationKind => Scan_unary_operation(Root);
  27527.           when others => null;
  27528.         end case;
  27529.     end Scan_OPERATOR_EXP;
  27530.      
  27531.      
  27532.     procedure Scan_binary_operation(Root : binary_operationNode.Locator) is
  27533.     begin
  27534.       if not NAME_EXP.IsNull(as_left_exp(Root)) then
  27535.         Scan_NAME_EXP(as_left_exp(Root));
  27536.       end if;
  27537.       if not used_operatorNode.IsNull(as_operator(Root)) then
  27538.         Scan_used_operator(as_operator(Root));
  27539.       end if;
  27540.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  27541.         Scan_NAME_EXP(as_right_exp(Root));
  27542.       end if;
  27543.      
  27544.     end Scan_binary_operation;
  27545.      
  27546.      
  27547.     procedure Scan_unary_operation(Root : unary_operationNode.Locator) is
  27548.     begin
  27549.       if not used_operatorNode.IsNull(as_operator(Root)) then
  27550.         Scan_used_operator(as_operator(Root));
  27551.       end if;
  27552.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  27553.         Scan_NAME_EXP(as_right_exp(Root));
  27554.       end if;
  27555.      
  27556.     end Scan_unary_operation;
  27557.      
  27558.      
  27559.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator) is
  27560.     begin
  27561.         case Kind(Root) is
  27562.           when and_then_expKind => Scan_and_then_exp(Root);
  27563.           when or_else_expKind => Scan_or_else_exp(Root);
  27564.           when others => null;
  27565.         end case;
  27566.     end Scan_SHORT_CIRCUIT_EXP;
  27567.      
  27568.      
  27569.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator) is
  27570.     begin
  27571.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  27572.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  27573.       end if;
  27574.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  27575.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  27576.       end if;
  27577.      
  27578.      
  27579.        IncrementToken (and_thenz);
  27580.        IncrementToken (then_andz);
  27581.      
  27582.      
  27583.      
  27584.     end Scan_and_then_exp;
  27585.      
  27586.      
  27587.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator) is
  27588.     begin
  27589.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  27590.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  27591.       end if;
  27592.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  27593.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  27594.       end if;
  27595.      
  27596.      
  27597.        IncrementToken (or_elsez);
  27598.        IncrementToken (else_orz);
  27599.      
  27600.      
  27601.      
  27602.     end Scan_or_else_exp;
  27603.      
  27604.      
  27605.     procedure Scan_attribute(Root : attributeNode.Locator) is
  27606.     begin
  27607.       if not NAME_EXP.IsNull(as_attribute_name(Root)) then
  27608.         Scan_NAME_EXP(as_attribute_name(Root));
  27609.      
  27610.      
  27611.      IncrementToken (tickz);
  27612.      
  27613.      
  27614.       end if;
  27615.       if not NAME_EXP.IsNull(as_attribute_id(Root)) then
  27616.         Scan_NAME_EXP(as_attribute_id(Root));
  27617.       end if;
  27618.      
  27619.     end Scan_attribute;
  27620.      
  27621.      
  27622.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator) is
  27623.     begin
  27624.       if not NAME_EXP.IsNull(as_attribute_indexed_name(Root)) then
  27625.      
  27626.      
  27627.      IncrementToken (open_parenthesisz);
  27628.      
  27629.      
  27630.         Scan_NAME_EXP(as_attribute_indexed_name(Root));
  27631.      
  27632.      
  27633.       IncrementToken (closed_parenthesisz);
  27634.      
  27635.      
  27636.       end if;
  27637.       if not NAME_EXP.IsNull(as_attribute_indexed_exp(Root)) then
  27638.         Scan_NAME_EXP(as_attribute_indexed_exp(Root));
  27639.       end if;
  27640.      
  27641.     end Scan_attribute_indexed;
  27642.      
  27643.      
  27644.     procedure Scan_conversion(Root : conversionNode.Locator) is
  27645.     begin
  27646.       if not NAME_EXP.IsNull(as_conversion_name(Root)) then
  27647.      
  27648.      
  27649.       IncrementToken (open_parenthesisz);
  27650.      
  27651.      
  27652.         Scan_NAME_EXP(as_conversion_name(Root));
  27653.      
  27654.      
  27655.        IncrementToken (closed_parenthesisz);
  27656.      
  27657.      
  27658.       end if;
  27659.       if not NAME_EXP.IsNull(as_conversion_exp(Root)) then
  27660.         Scan_NAME_EXP(as_conversion_exp(Root));
  27661.       end if;
  27662.      
  27663.     end Scan_conversion;
  27664.      
  27665.      
  27666.     procedure Scan_family_indexed(Root : family_indexedNode.Locator) is
  27667.     begin
  27668.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  27669.      
  27670.      
  27671.        IncrementToken (open_parenthesisz);
  27672.      
  27673.      
  27674.         Scan_NAME_EXP(as_family_index(Root));
  27675.      
  27676.      
  27677.        IncrementToken (closed_parenthesisz);
  27678.      
  27679.      
  27680.       end if;
  27681.       if not NAME_EXP.IsNull(as_family_name(Root)) then
  27682.         Scan_NAME_EXP(as_family_name(Root));
  27683.       end if;
  27684.      
  27685.     end Scan_family_indexed;
  27686.      
  27687.      
  27688.     procedure Scan_indexed(Root : indexedNode.Locator) is
  27689.         as_indexed_exp_s_List : SeqOfNAME_EXP.Generator;
  27690.         as_indexed_exp_s_Item : NAME_EXP.Locator;
  27691.         use SeqOfNAME_EXP;
  27692.     begin
  27693.       if not NAME_EXP.IsNull(as_indexed_name(Root)) then
  27694.         Scan_NAME_EXP(as_indexed_name(Root));
  27695.       end if;
  27696.       if not SeqOfNAME_EXP.IsNull(as_indexed_exp_s(Root)) then
  27697.      
  27698.      
  27699.       IncrementToken (open_parenthesisz);
  27700.      
  27701.      
  27702.         StartForward(as_indexed_exp_s(Root), as_indexed_exp_s_List);
  27703.         while not Finished(as_indexed_exp_s_List) loop
  27704.             as_indexed_exp_s_Item := Cell(as_indexed_exp_s_List);
  27705.             Scan_NAME_EXP(as_indexed_exp_s_Item);
  27706.             Forward(as_indexed_exp_s_List);
  27707.         end loop;
  27708.         EndIterate(as_indexed_exp_s_List);
  27709.      
  27710.      
  27711.        IncrementToken (closed_parenthesisz);
  27712.      
  27713.      
  27714.       end if;
  27715.      
  27716.     end Scan_indexed;
  27717.      
  27718.      
  27719.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator) is
  27720.     begin
  27721.      
  27722.      
  27723.           IncrementToken (new_allocatorz);
  27724.      
  27725.      
  27726.       if not qualifiedNode.IsNull(as_allocator_qualified(Root)) then
  27727.         Scan_qualified(as_allocator_qualified(Root));
  27728.       end if;
  27729.      
  27730.     end Scan_init_allocator;
  27731.      
  27732.      
  27733.     procedure Scan_null_access(Root : null_accessNode.Locator) is
  27734.     begin
  27735.      
  27736.      
  27737.      IncrementToken (null_valuez);
  27738.      
  27739.      
  27740.      
  27741.     end Scan_null_access;
  27742.      
  27743.      
  27744.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator) is
  27745.     begin
  27746.      
  27747.      
  27748.     Literal_Set.Insert (lx_text (lx_numrep (root)),
  27749.                         CurrentBlock.SetOfLiterals);
  27750.      
  27751.      
  27752.      
  27753.     end Scan_numeric_literal;
  27754.      
  27755.      
  27756.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator) is
  27757.     begin
  27758.      
  27759.      
  27760.      IncrementToken (open_parenthesisz);
  27761.      
  27762.      
  27763.       if not NAME_EXP.IsNull(as_parenthesized_exp(Root)) then
  27764.         Scan_NAME_EXP(as_parenthesized_exp(Root));
  27765.       end if;
  27766.      
  27767.      
  27768.      IncrementToken (closed_parenthesisz);
  27769.      
  27770.      
  27771.      
  27772.     end Scan_parenthesized;
  27773.      
  27774.      
  27775.     procedure Scan_qualified(Root : qualifiedNode.Locator) is
  27776.     begin
  27777.       if not MARK.IsNull(as_qualified_name(Root)) then
  27778.         Scan_MARK(as_qualified_name(Root));
  27779.      
  27780.      
  27781.      IncrementToken (tickz);
  27782.      
  27783.      
  27784.       end if;
  27785.       if not NAME_EXP.IsNull(as_qualified_exp(Root)) then
  27786.         Scan_NAME_EXP(as_qualified_exp(Root));
  27787.       end if;
  27788.      
  27789.     end Scan_qualified;
  27790.      
  27791.      
  27792.     procedure Scan_slice(Root : sliceNode.Locator) is
  27793.     begin
  27794.      
  27795.      
  27796.      IncrementToken (open_parenthesisz);
  27797.      
  27798.      
  27799.      
  27800.      
  27801.     IncrementToken (closed_parenthesisz);
  27802.      
  27803.      
  27804.       if not NAME_EXP.IsNull(as_slice_name(Root)) then
  27805.         Scan_NAME_EXP(as_slice_name(Root));
  27806.       end if;
  27807.       if not OBJECT_TYPE.IsNull(as_slice_discrete_range(Root)) then
  27808.         Scan_OBJECT_TYPE(as_slice_discrete_range(Root));
  27809.       end if;
  27810.      
  27811.     end Scan_slice;
  27812.      
  27813.      
  27814.     procedure Scan_string_literal(Root : string_literalNode.Locator) is
  27815.     begin
  27816.      
  27817.      
  27818.     IncrementToken (double_quotez);
  27819.     Literal_Set.Insert (lx_text (lx_string_symrep (root)),
  27820.                     CurrentBlock.SetOfLiterals);
  27821.      
  27822.      
  27823.      
  27824.      
  27825.      IncrementToken (double_quotez);
  27826.      
  27827.      
  27828.      
  27829.     end Scan_string_literal;
  27830.      
  27831.      
  27832.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator) is
  27833.     begin
  27834.      
  27835.      
  27836.       IncrementToken (new_allocatorz);
  27837.      
  27838.      
  27839.       if not object_type_constrainedNode.IsNull(as_allocator_constrained(Root)) then
  27840.         Scan_object_type_constrained(as_allocator_constrained(Root));
  27841.       end if;
  27842.      
  27843.     end Scan_uninit_allocator;
  27844.      
  27845. end NAME_EXP_Pkg;
  27846. -- End: SCNAME_EXP bdy -----------------------------------------------------
  27847. ::::::::::::::
  27848. scname_ex.spc
  27849. ::::::::::::::
  27850. -- Begin: SCNAME_EXP spc ---------------------------------------------------
  27851.      
  27852. with ST_DIANA; use ST_DIANA;
  27853.              package NAME_EXP_Pkg is
  27854.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator);
  27855.     procedure Scan_AGG(Root : AGG.Locator);
  27856.     procedure Scan_apply_agg(Root : apply_aggNode.Locator);
  27857.     procedure Scan_array_agg(Root : array_aggNode.Locator);
  27858.     procedure Scan_record_agg(Root : record_aggNode.Locator);
  27859.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator);
  27860.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator);
  27861.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator);
  27862.     procedure Scan_CALLS(Root : CALLS.Locator);
  27863.     procedure Scan_apply_call(Root : apply_callNode.Locator);
  27864.     procedure Scan_entry_call(Root : entry_callNode.Locator);
  27865.     procedure Scan_func_call(Root : func_callNode.Locator);
  27866.     procedure Scan_proc_call(Root : proc_callNode.Locator);
  27867.     procedure Scan_MARK(Root : MARK.Locator);
  27868.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator);
  27869.     procedure Scan_used_char(Root : used_charNode.Locator);
  27870.     procedure Scan_used_id(Root : used_idNode.Locator);
  27871.     procedure Scan_used_operator(Root : used_operatorNode.Locator);
  27872.     procedure Scan_selected(Root : selectedNode.Locator);
  27873.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator);
  27874.     procedure Scan_in_exp(Root : in_expNode.Locator);
  27875.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator);
  27876.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator);
  27877.     procedure Scan_binary_operation(Root : binary_operationNode.Locator);
  27878.     procedure Scan_unary_operation(Root : unary_operationNode.Locator);
  27879.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator);
  27880.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator);
  27881.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator);
  27882.     procedure Scan_attribute(Root : attributeNode.Locator);
  27883.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator);
  27884.     procedure Scan_conversion(Root : conversionNode.Locator);
  27885.     procedure Scan_family_indexed(Root : family_indexedNode.Locator);
  27886.     procedure Scan_indexed(Root : indexedNode.Locator);
  27887.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator);
  27888.     procedure Scan_null_access(Root : null_accessNode.Locator);
  27889.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator);
  27890.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator);
  27891.     procedure Scan_qualified(Root : qualifiedNode.Locator);
  27892.     procedure Scan_slice(Root : sliceNode.Locator);
  27893.     procedure Scan_string_literal(Root : string_literalNode.Locator);
  27894.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator);
  27895. end NAME_EXP_Pkg;
  27896. -- End: SCNAME_EXP spc -----------------------------------------------------
  27897. ::::::::::::::
  27898. scobject_.bdy
  27899. ::::::::::::::
  27900. -- Begin: SCOBJECT_DEF bdy ---------------------------------------------------
  27901.      
  27902. with Halstead_Data_Base;  use Halstead_Data_Base;
  27903. with Definitions; use Definitions;
  27904.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  27905. package body OBJECT_DEF_Pkg is
  27906.      
  27907.      
  27908.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator) is
  27909.     begin
  27910.         case Kind(Root) is
  27911.           when object_initKind => Scan_object_init(Root);
  27912.           when object_renameKind => Scan_object_rename(Root);
  27913.           when others => null;
  27914.         end case;
  27915.     end Scan_OBJECT_DEF;
  27916.      
  27917.      
  27918.     procedure Scan_object_init(Root : object_initNode.Locator) is
  27919.     begin
  27920.      
  27921.      
  27922.            IncrementToken (colon_equalsz);
  27923.      
  27924.      
  27925.       if not NAME_EXP.IsNull(as_init_exp(Root)) then
  27926.         Scan_NAME_EXP(as_init_exp(Root));
  27927.       end if;
  27928.      
  27929.     end Scan_object_init;
  27930.      
  27931.      
  27932.     procedure Scan_object_rename(Root : object_renameNode.Locator) is
  27933.     begin
  27934.      
  27935.      
  27936.           IncrementToken (renamesz);
  27937.      
  27938.      
  27939.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  27940.         Scan_NAME_EXP(as_rename_name(Root));
  27941.       end if;
  27942.      
  27943.     end Scan_object_rename;
  27944.      
  27945. end OBJECT_DEF_Pkg;
  27946. -- End: SCOBJECT_DEF bdy -----------------------------------------------------
  27947. ::::::::::::::
  27948. scobject_.spc
  27949. ::::::::::::::
  27950. -- Begin: SCOBJECT_DEF spc ---------------------------------------------------
  27951.      
  27952. with ST_DIANA; use ST_DIANA;
  27953.              package OBJECT_DEF_Pkg is
  27954.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator);
  27955.     procedure Scan_object_init(Root : object_initNode.Locator);
  27956.     procedure Scan_object_rename(Root : object_renameNode.Locator);
  27957. end OBJECT_DEF_Pkg;
  27958. -- End: SCOBJECT_DEF spc -----------------------------------------------------
  27959. ::::::::::::::
  27960. scpkg_def.bdy
  27961. ::::::::::::::
  27962. -- Begin: SCPKG_DEF bdy ---------------------------------------------------
  27963.      
  27964. with Halstead_Data_Base;  use Halstead_Data_Base;
  27965. with Definitions; use Definitions;
  27966.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  27967. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  27968. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  27969. with ITEM_Pkg; use ITEM_Pkg;
  27970. package body PKG_DEF_Pkg is
  27971.      
  27972.      
  27973.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator) is
  27974.     begin
  27975.         case Kind(Root) is
  27976.           when pkg_block_stubKind => Scan_pkg_block_stub(Root);
  27977.           when pkg_instantiationKind => Scan_pkg_instantiation(Root);
  27978.           when pkg_renameKind => Scan_pkg_rename(Root);
  27979.           when pkg_specKind => Scan_pkg_spec(Root);
  27980.           when others => null;
  27981.         end case;
  27982.     end Scan_PKG_DEF;
  27983.      
  27984.      
  27985.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator) is
  27986.     begin
  27987.       if not BLOCK_STUB.IsNull(as_pkg_block_stub(Root)) then
  27988.         Scan_BLOCK_STUB(as_pkg_block_stub(Root));
  27989.       end if;
  27990.      
  27991.     end Scan_pkg_block_stub;
  27992.      
  27993.      
  27994.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator) is
  27995.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27996.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  27997.         use SeqOfGENERAL_ASSOC;
  27998.     begin
  27999.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  28000.      
  28001.      
  28002.       IncrementToken (open_parenthesisz);
  28003.      
  28004.      
  28005.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  28006.         while not Finished(as_generic_assoc_s_List) loop
  28007.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  28008.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  28009.             Forward(as_generic_assoc_s_List);
  28010.         end loop;
  28011.         EndIterate(as_generic_assoc_s_List);
  28012.      
  28013.      
  28014.       IncrementToken (closed_parenthesisz);
  28015.      
  28016.      
  28017.       end if;
  28018.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  28019.         Scan_NAME_EXP(as_instantiation_name(Root));
  28020.      
  28021.      
  28022.       IncrementToken (new_generic_instz);
  28023.      
  28024.      
  28025.       end if;
  28026.      
  28027.     end Scan_pkg_instantiation;
  28028.      
  28029.      
  28030.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator) is
  28031.     begin
  28032.      
  28033.      
  28034.      IncrementToken (renamesz);
  28035.      
  28036.      
  28037.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  28038.      
  28039.      
  28040.                 IncrementToken (renamesz);
  28041.      
  28042.      
  28043.         Scan_NAME_EXP(as_rename_name(Root));
  28044.       end if;
  28045.      
  28046.     end Scan_pkg_rename;
  28047.      
  28048.      
  28049.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator) is
  28050.         as_visible_part_List : SeqOfITEM.Generator;
  28051.         as_visible_part_Item : ITEM.Locator;
  28052.         use SeqOfITEM;
  28053.         as_priv_part_List : SeqOfITEM.Generator;
  28054.         as_priv_part_Item : ITEM.Locator;
  28055.         use SeqOfITEM;
  28056.     begin
  28057.       if not SeqOfITEM.IsNull(as_visible_part(Root)) then
  28058.         StartForward(as_visible_part(Root), as_visible_part_List);
  28059.         while not Finished(as_visible_part_List) loop
  28060.             as_visible_part_Item := Cell(as_visible_part_List);
  28061.             Scan_ITEM(as_visible_part_Item);
  28062.             Forward(as_visible_part_List);
  28063.         end loop;
  28064.         EndIterate(as_visible_part_List);
  28065.       end if;
  28066.       if not SeqOfITEM.IsNull(as_priv_part(Root)) then
  28067.      
  28068.      
  28069.        IncrementToken (private_sectionz);
  28070.      
  28071.      
  28072.         StartForward(as_priv_part(Root), as_priv_part_List);
  28073.         while not Finished(as_priv_part_List) loop
  28074.             as_priv_part_Item := Cell(as_priv_part_List);
  28075.             Scan_ITEM(as_priv_part_Item);
  28076.             Forward(as_priv_part_List);
  28077.         end loop;
  28078.         EndIterate(as_priv_part_List);
  28079.       end if;
  28080.      
  28081.     end Scan_pkg_spec;
  28082.      
  28083. end PKG_DEF_Pkg;
  28084. -- End: SCPKG_DEF bdy -----------------------------------------------------
  28085. ::::::::::::::
  28086. scpkg_def.spc
  28087. ::::::::::::::
  28088. -- Begin: SCPKG_DEF spc ---------------------------------------------------
  28089.      
  28090. with ST_DIANA; use ST_DIANA;
  28091.              package PKG_DEF_Pkg is
  28092.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator);
  28093.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator);
  28094.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator);
  28095.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator);
  28096.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator);
  28097. end PKG_DEF_Pkg;
  28098. -- End: SCPKG_DEF spc -----------------------------------------------------
  28099. ::::::::::::::
  28100. scstm.bdy
  28101. ::::::::::::::
  28102. --VMS file: %nosc.work.tools.halstead.source*(SCSTM.bdy)
  28103. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCSTM.bdy
  28104. -- Begin: SCSTM bdy ---------------------------------------------------
  28105.      
  28106. with Halstead_Data_Base;  use Halstead_Data_Base;
  28107. with Definitions; use Definitions;
  28108.              with SERIES_UNIT_IH;
  28109. with block_stm_IH;
  28110. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  28111. with HEADER_Pkg; use HEADER_Pkg;
  28112. with DEF_ID_Pkg; use DEF_ID_Pkg;
  28113. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  28114. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  28115. with ITERATION_Pkg; use ITERATION_Pkg;
  28116. with ITEM_Pkg; use ITEM_Pkg;
  28117.      
  28118.               with TEXT_IO; use TEXT_IO;
  28119.               with VmmTextPkg;
  28120.               with Block_Utilities;
  28121.                   package body STM_Pkg is
  28122.      
  28123.      
  28124.     procedure Scan_STM(Root : STM.Locator) is
  28125.     begin
  28126.         case Kind(Root) is
  28127.           when CALL_STMKind => Scan_CALL_STM(Root);
  28128.           when SELECTIVE_ENTRY_STMKind => Scan_SELECTIVE_ENTRY_STM(Root);
  28129.           when abort_stmKind => Scan_abort_stm(Root);
  28130.           when accept_stmKind => Scan_accept_stm(Root);
  28131.           when assign_stmKind => Scan_assign_stm(Root);
  28132.           when block_stmKind => Scan_block_stm(Root);
  28133.           when case_stmKind => Scan_case_stm(Root);
  28134.           when code_stmKind => Scan_code_stm(Root);
  28135.           when delay_stmKind => Scan_delay_stm(Root);
  28136.           when exit_stmKind => Scan_exit_stm(Root);
  28137.           when goto_stmKind => Scan_goto_stm(Root);
  28138.           when if_stmKind => Scan_if_stm(Root);
  28139.           when labeled_stmKind => Scan_labeled_stm(Root);
  28140.           when loop_stmKind => Scan_loop_stm(Root);
  28141.           when null_stmKind => Scan_null_stm(Root);
  28142.           when pragma_stmKind => Scan_pragma_stm(Root);
  28143.           when raise_stmKind => Scan_raise_stm(Root);
  28144.           when return_stmKind => Scan_return_stm(Root);
  28145.           when select_stmKind => Scan_select_stm(Root);
  28146.           when terminate_stmKind => Scan_terminate_stm(Root);
  28147.           when others => null;
  28148.         end case;
  28149.     end Scan_STM;
  28150.      
  28151.      
  28152.     procedure Scan_CALL_STM(Root : CALL_STM.Locator) is
  28153.     begin
  28154.         case Kind(Root) is
  28155.           when apply_call_stmKind => Scan_apply_call_stm(Root);
  28156.           when entry_call_stmKind => Scan_entry_call_stm(Root);
  28157.           when proc_call_stmKind => Scan_proc_call_stm(Root);
  28158.           when others => null;
  28159.         end case;
  28160.     end Scan_CALL_STM;
  28161.      
  28162.      
  28163.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator) is
  28164.     begin
  28165.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28166.         Scan_NAME_EXP(as_call_name(Root));
  28167.       end if;
  28168.      
  28169.         if  Kind(root) not in labeled_stmKind
  28170.         then
  28171.      
  28172.         if (not (Kind (root) in block_stmKind))
  28173.             or else
  28174.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28175.             then
  28176.      
  28177.               -- If the root is not a block_stm or if it is then
  28178.               -- if it is not a block with declarations increment
  28179.               -- semicolon.
  28180.               -- This is because the semicolon associated with a declare
  28181.               -- block must be counted in that declare block. If we
  28182.               -- counted it here it would increment the count for the
  28183.               -- enclosing block.
  28184.          IncrementToken (semicolonz);
  28185.       end if;
  28186.      
  28187.         end if;
  28188.      
  28189.     end Scan_apply_call_stm;
  28190.      
  28191.      
  28192.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator) is
  28193.     begin
  28194.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28195.         Scan_NAME_EXP(as_call_name(Root));
  28196.       end if;
  28197.      
  28198.         if  Kind(root) not in labeled_stmKind
  28199.         then
  28200.      
  28201.         if (not (Kind (root) in block_stmKind))
  28202.             or else
  28203.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28204.             then
  28205.      
  28206.               -- If the root is not a block_stm or if it is then
  28207.               -- if it is not a block with declarations increment
  28208.               -- semicolon.
  28209.               -- This is because the semicolon associated with a declare
  28210.               -- block must be counted in that declare block. If we
  28211.               -- counted it here it would increment the count for the
  28212.               -- enclosing block.
  28213.          IncrementToken (semicolonz);
  28214.       end if;
  28215.      
  28216.         end if;
  28217.      
  28218.     end Scan_entry_call_stm;
  28219.      
  28220.      
  28221.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator) is
  28222.     begin
  28223.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28224.         Scan_NAME_EXP(as_call_name(Root));
  28225.       end if;
  28226.      
  28227.         if  Kind(root) not in labeled_stmKind
  28228.         then
  28229.      
  28230.         if (not (Kind (root) in block_stmKind))
  28231.             or else
  28232.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28233.             then
  28234.      
  28235.               -- If the root is not a block_stm or if it is then
  28236.               -- if it is not a block with declarations increment
  28237.               -- semicolon.
  28238.               -- This is because the semicolon associated with a declare
  28239.               -- block must be counted in that declare block. If we
  28240.               -- counted it here it would increment the count for the
  28241.               -- enclosing block.
  28242.          IncrementToken (semicolonz);
  28243.       end if;
  28244.      
  28245.         end if;
  28246.      
  28247.     end Scan_proc_call_stm;
  28248.      
  28249.      
  28250.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator) is
  28251.     begin
  28252.         case Kind(Root) is
  28253.           when cond_entry_stmKind => Scan_cond_entry_stm(Root);
  28254.           when timed_entry_stmKind => Scan_timed_entry_stm(Root);
  28255.           when others => null;
  28256.         end case;
  28257.     end Scan_SELECTIVE_ENTRY_STM;
  28258.      
  28259.      
  28260.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator) is
  28261.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  28262.         as_sel_entry_stm_s1_Item : STM.Locator;
  28263.         use SeqOfSTM;
  28264.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  28265.         as_sel_entry_stm_s2_Item : STM.Locator;
  28266.         use SeqOfSTM;
  28267.     begin
  28268.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  28269.      
  28270.      
  28271.      IncrementToken (selectz);
  28272.      
  28273.      
  28274.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  28275.         while not Finished(as_sel_entry_stm_s1_List) loop
  28276.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  28277.             Scan_STM(as_sel_entry_stm_s1_Item);
  28278.             Forward(as_sel_entry_stm_s1_List);
  28279.         end loop;
  28280.         EndIterate(as_sel_entry_stm_s1_List);
  28281.       end if;
  28282.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  28283.      
  28284.      
  28285.      IncrementToken (elsez);
  28286.      
  28287.      
  28288.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  28289.         while not Finished(as_sel_entry_stm_s2_List) loop
  28290.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  28291.             Scan_STM(as_sel_entry_stm_s2_Item);
  28292.             Forward(as_sel_entry_stm_s2_List);
  28293.         end loop;
  28294.         EndIterate(as_sel_entry_stm_s2_List);
  28295.      
  28296.      
  28297.      IncrementToken (end_selectz);
  28298.      IncrementToken (selectz);
  28299.      
  28300.      
  28301.       end if;
  28302.      
  28303.         if  Kind(root) not in labeled_stmKind
  28304.         then
  28305.      
  28306.         if (not (Kind (root) in block_stmKind))
  28307.             or else
  28308.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28309.             then
  28310.      
  28311.               -- If the root is not a block_stm or if it is then
  28312.               -- if it is not a block with declarations increment
  28313.               -- semicolon.
  28314.               -- This is because the semicolon associated with a declare
  28315.               -- block must be counted in that declare block. If we
  28316.               -- counted it here it would increment the count for the
  28317.               -- enclosing block.
  28318.          IncrementToken (semicolonz);
  28319.       end if;
  28320.      
  28321.         end if;
  28322.      
  28323.     end Scan_cond_entry_stm;
  28324.      
  28325.      
  28326.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator) is
  28327.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  28328.         as_sel_entry_stm_s1_Item : STM.Locator;
  28329.         use SeqOfSTM;
  28330.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  28331.         as_sel_entry_stm_s2_Item : STM.Locator;
  28332.         use SeqOfSTM;
  28333.     begin
  28334.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  28335.      
  28336.      
  28337.      IncrementToken (selectz);
  28338.      
  28339.      
  28340.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  28341.         while not Finished(as_sel_entry_stm_s1_List) loop
  28342.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  28343.             Scan_STM(as_sel_entry_stm_s1_Item);
  28344.             Forward(as_sel_entry_stm_s1_List);
  28345.         end loop;
  28346.         EndIterate(as_sel_entry_stm_s1_List);
  28347.       end if;
  28348.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  28349.      
  28350.      
  28351.      IncrementToken (or_selectz);
  28352.      
  28353.      
  28354.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  28355.         while not Finished(as_sel_entry_stm_s2_List) loop
  28356.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  28357.             Scan_STM(as_sel_entry_stm_s2_Item);
  28358.             Forward(as_sel_entry_stm_s2_List);
  28359.         end loop;
  28360.         EndIterate(as_sel_entry_stm_s2_List);
  28361.      
  28362.      
  28363.      IncrementToken (end_selectz);
  28364.      IncrementToken (selectz);
  28365.      
  28366.      
  28367.       end if;
  28368.      
  28369.         if  Kind(root) not in labeled_stmKind
  28370.         then
  28371.      
  28372.         if (not (Kind (root) in block_stmKind))
  28373.             or else
  28374.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28375.             then
  28376.      
  28377.               -- If the root is not a block_stm or if it is then
  28378.               -- if it is not a block with declarations increment
  28379.               -- semicolon.
  28380.               -- This is because the semicolon associated with a declare
  28381.               -- block must be counted in that declare block. If we
  28382.               -- counted it here it would increment the count for the
  28383.               -- enclosing block.
  28384.          IncrementToken (semicolonz);
  28385.       end if;
  28386.      
  28387.         end if;
  28388.      
  28389.     end Scan_timed_entry_stm;
  28390.      
  28391.      
  28392.     procedure Scan_abort_stm(Root : abort_stmNode.Locator) is
  28393.         as_abort_name_s_List : SeqOfNAME_EXP.Generator;
  28394.         as_abort_name_s_Item : NAME_EXP.Locator;
  28395.         use SeqOfNAME_EXP;
  28396.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  28397.     begin
  28398.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  28399.      
  28400.      
  28401.        IncrementToken (abortz);
  28402.      
  28403.      
  28404.       if not SeqOfNAME_EXP.IsNull(as_abort_name_s(Root)) then
  28405.         StartForward(as_abort_name_s(Root), as_abort_name_s_List);
  28406.         while not Finished(as_abort_name_s_List) loop
  28407.             as_abort_name_s_Item := Cell(as_abort_name_s_List);
  28408.      
  28409.      
  28410.        if SERIES_UNIT_IH.R.ih_inlist then
  28411.            IncrementToken (commaz);
  28412.        end if;
  28413.        SERIES_UNIT_IH.R.ih_inlist := true;
  28414.      
  28415.      
  28416.             Scan_NAME_EXP(as_abort_name_s_Item);
  28417.             Forward(as_abort_name_s_List);
  28418.         end loop;
  28419.         EndIterate(as_abort_name_s_List);
  28420.       end if;
  28421.      
  28422.      
  28423.        SERIES_UNIT_IH.R.ih_inlist := false;
  28424.      
  28425.      
  28426.      
  28427.         if  Kind(root) not in labeled_stmKind
  28428.         then
  28429.      
  28430.         if (not (Kind (root) in block_stmKind))
  28431.             or else
  28432.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28433.             then
  28434.      
  28435.               -- If the root is not a block_stm or if it is then
  28436.               -- if it is not a block with declarations increment
  28437.               -- semicolon.
  28438.               -- This is because the semicolon associated with a declare
  28439.               -- block must be counted in that declare block. If we
  28440.               -- counted it here it would increment the count for the
  28441.               -- enclosing block.
  28442.          IncrementToken (semicolonz);
  28443.       end if;
  28444.      
  28445.         end if;
  28446.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  28447.      
  28448.     end Scan_abort_stm;
  28449.      
  28450.      
  28451.     procedure Scan_accept_stm(Root : accept_stmNode.Locator) is
  28452.         as_accept_stm_s_List : SeqOfSTM.Generator;
  28453.         as_accept_stm_s_Item : STM.Locator;
  28454.         use SeqOfSTM;
  28455.     begin
  28456.      
  28457.      
  28458.        IncrementToken (acceptz);
  28459.      
  28460.      
  28461.       if not NAME_EXP.IsNull(as_accept_designator(Root)) then
  28462.         Scan_NAME_EXP(as_accept_designator(Root));
  28463.       end if;
  28464.       if not accept_specNode.IsNull(as_accept_spec(Root)) then
  28465.         Scan_accept_spec(as_accept_spec(Root));
  28466.       end if;
  28467.       if not SeqOfSTM.IsNull(as_accept_stm_s(Root)) then
  28468.      
  28469.      
  28470.        IncrementToken (doz);
  28471.        IncrementToken (end_acceptz);
  28472.      
  28473.      
  28474.         StartForward(as_accept_stm_s(Root), as_accept_stm_s_List);
  28475.         while not Finished(as_accept_stm_s_List) loop
  28476.             as_accept_stm_s_Item := Cell(as_accept_stm_s_List);
  28477.             Scan_STM(as_accept_stm_s_Item);
  28478.             Forward(as_accept_stm_s_List);
  28479.         end loop;
  28480.         EndIterate(as_accept_stm_s_List);
  28481.       end if;
  28482.      
  28483.         if  Kind(root) not in labeled_stmKind
  28484.         then
  28485.      
  28486.         if (not (Kind (root) in block_stmKind))
  28487.             or else
  28488.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28489.             then
  28490.      
  28491.               -- If the root is not a block_stm or if it is then
  28492.               -- if it is not a block with declarations increment
  28493.               -- semicolon.
  28494.               -- This is because the semicolon associated with a declare
  28495.               -- block must be counted in that declare block. If we
  28496.               -- counted it here it would increment the count for the
  28497.               -- enclosing block.
  28498.          IncrementToken (semicolonz);
  28499.       end if;
  28500.      
  28501.         end if;
  28502.      
  28503.     end Scan_accept_stm;
  28504.      
  28505.      
  28506.     procedure Scan_assign_stm(Root : assign_stmNode.Locator) is
  28507.     begin
  28508.      
  28509.      
  28510.   IncrementToken (colon_equalsz);
  28511.      
  28512.      
  28513.       if not NAME_EXP.IsNull(as_assign_name(Root)) then
  28514.         Scan_NAME_EXP(as_assign_name(Root));
  28515.       end if;
  28516.       if not NAME_EXP.IsNull(as_assign_exp(Root)) then
  28517.         Scan_NAME_EXP(as_assign_exp(Root));
  28518.       end if;
  28519.      
  28520.         if  Kind(root) not in labeled_stmKind
  28521.         then
  28522.      
  28523.         if (not (Kind (root) in block_stmKind))
  28524.             or else
  28525.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28526.             then
  28527.      
  28528.               -- If the root is not a block_stm or if it is then
  28529.               -- if it is not a block with declarations increment
  28530.               -- semicolon.
  28531.               -- This is because the semicolon associated with a declare
  28532.               -- block must be counted in that declare block. If we
  28533.               -- counted it here it would increment the count for the
  28534.               -- enclosing block.
  28535.          IncrementToken (semicolonz);
  28536.       end if;
  28537.      
  28538.         end if;
  28539.      
  28540.     end Scan_assign_stm;
  28541.      
  28542.      
  28543.     procedure Scan_block_stm(Root : block_stmNode.Locator) is
  28544.         Old_block_stm_IHR : block_stm_IH.RecType := block_stm_IH.R;
  28545.     begin
  28546.         block_stm_IH.R.ih_inblock :=  false ;
  28547.       if not block_idNode.IsNull(as_block_label(Root)) then
  28548.         Scan_block_id(as_block_label(Root));
  28549.       end if;
  28550.       if not body_blockNode.IsNull(as_block_body(Root)) then
  28551.      
  28552.      
  28553.    if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  28554.        block_stm_IH.R.ih_inblock := true;
  28555.        if not OuterMostBlockSeen then
  28556.            OuterMostBlockSeen := true;
  28557.        else
  28558.            BlockInfoStack.Push (BlockStack, CurrentBlock);
  28559.            CurrentBlock := InitializeCurrentBlock;
  28560.        end if;
  28561.        if Block_Utilities.Is_Block_Labeled (root) then
  28562.              -- Count : which is associated with the block name
  28563.              -- here.   At this point we know we have a label id and
  28564.              -- the colon adds to the complexity of the declare block.
  28565.            SetBlockId (
  28566.                        lx_symrep (as_block_label (root)),
  28567.                        declare_block,
  28568.                        DecId,
  28569.                        LineNumber (lx_srcpos (root))
  28570.                       );
  28571.        else
  28572.            SetBlockId (
  28573.                        TOKEN.NullRef,
  28574.                        declare_block,
  28575.                        DecId,
  28576.                        LineNumber (lx_srcpos (root))
  28577.                       );
  28578.        end if;
  28579.   end if;
  28580.      -- This next check is made regardless of whether we are in
  28581.      -- a block_stm with declarations or one without declarations.  If
  28582.      -- the block has a name then it has a colon.
  28583.      
  28584.   if Block_Utilities.Is_Block_Labeled (root) then
  28585.      IncrementToken (colonz);
  28586.   end if;
  28587.      
  28588.      
  28589.         Scan_body_block(as_block_body(Root));
  28590.       end if;
  28591.      
  28592.      
  28593.      if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  28594.          IncrementToken (semicolonz);
  28595.          ProcessBlockInfo (CurrentBlock);
  28596.          FreeSpace (CurrentBlock);
  28597.          BlockInfoStack.Pop(BlockStack, CurrentBlock);
  28598.          IncrementToken (declare_blockz);
  28599.      end if;
  28600.      block_stm_IH.R.ih_inblock := false;
  28601.      
  28602.      
  28603.      
  28604.         if  Kind(root) not in labeled_stmKind
  28605.         then
  28606.      
  28607.         if (not (Kind (root) in block_stmKind))
  28608.             or else
  28609.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28610.             then
  28611.      
  28612.               -- If the root is not a block_stm or if it is then
  28613.               -- if it is not a block with declarations increment
  28614.               -- semicolon.
  28615.               -- This is because the semicolon associated with a declare
  28616.               -- block must be counted in that declare block. If we
  28617.               -- counted it here it would increment the count for the
  28618.               -- enclosing block.
  28619.          IncrementToken (semicolonz);
  28620.       end if;
  28621.      
  28622.         end if;
  28623.         block_stm_IH.R := Old_block_stm_IHR;
  28624.      
  28625.     end Scan_block_stm;
  28626.      
  28627.      
  28628.     procedure Scan_case_stm(Root : case_stmNode.Locator) is
  28629.         as_case_alternative_s_List : SeqOfcase_alternativeNode.Generator;
  28630.         as_case_alternative_s_Item : case_alternativeNode.Locator;
  28631.         use SeqOfcase_alternativeNode;
  28632.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  28633.     begin
  28634.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  28635.      
  28636.      
  28637.       IncrementToken (case_stmz);
  28638.       IncrementToken (case_stmz);
  28639.       IncrementToken (is_case_stmz);
  28640.       IncrementToken (end_case_stmz);
  28641.      
  28642.      
  28643.       if not NAME_EXP.IsNull(as_case_exp(Root)) then
  28644.         Scan_NAME_EXP(as_case_exp(Root));
  28645.       end if;
  28646.       if not SeqOfcase_alternativeNode.IsNull(as_case_alternative_s(Root)) then
  28647.         StartForward(as_case_alternative_s(Root), as_case_alternative_s_List);
  28648.         while not Finished(as_case_alternative_s_List) loop
  28649.             as_case_alternative_s_Item := Cell(as_case_alternative_s_List);
  28650.             Scan_case_alternative(as_case_alternative_s_Item);
  28651.             Forward(as_case_alternative_s_List);
  28652.         end loop;
  28653.         EndIterate(as_case_alternative_s_List);
  28654.       end if;
  28655.      
  28656.         if  Kind(root) not in labeled_stmKind
  28657.         then
  28658.      
  28659.         if (not (Kind (root) in block_stmKind))
  28660.             or else
  28661.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28662.             then
  28663.      
  28664.               -- If the root is not a block_stm or if it is then
  28665.               -- if it is not a block with declarations increment
  28666.               -- semicolon.
  28667.               -- This is because the semicolon associated with a declare
  28668.               -- block must be counted in that declare block. If we
  28669.               -- counted it here it would increment the count for the
  28670.               -- enclosing block.
  28671.          IncrementToken (semicolonz);
  28672.       end if;
  28673.      
  28674.         end if;
  28675.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  28676.      
  28677.     end Scan_case_stm;
  28678.      
  28679.      
  28680.     procedure Scan_code_stm(Root : code_stmNode.Locator) is
  28681.     begin
  28682.       if not qualifiedNode.IsNull(as_code_exp(Root)) then
  28683.         Scan_qualified(as_code_exp(Root));
  28684.       end if;
  28685.      
  28686.         if  Kind(root) not in labeled_stmKind
  28687.         then
  28688.      
  28689.         if (not (Kind (root) in block_stmKind))
  28690.             or else
  28691.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28692.             then
  28693.      
  28694.               -- If the root is not a block_stm or if it is then
  28695.               -- if it is not a block with declarations increment
  28696.               -- semicolon.
  28697.               -- This is because the semicolon associated with a declare
  28698.               -- block must be counted in that declare block. If we
  28699.               -- counted it here it would increment the count for the
  28700.               -- enclosing block.
  28701.          IncrementToken (semicolonz);
  28702.       end if;
  28703.      
  28704.         end if;
  28705.      
  28706.     end Scan_code_stm;
  28707.      
  28708.      
  28709.     procedure Scan_delay_stm(Root : delay_stmNode.Locator) is
  28710.     begin
  28711.      
  28712.      
  28713.        IncrementToken (delayz);
  28714.      
  28715.      
  28716.       if not NAME_EXP.IsNull(as_delay_exp(Root)) then
  28717.         Scan_NAME_EXP(as_delay_exp(Root));
  28718.       end if;
  28719.      
  28720.         if  Kind(root) not in labeled_stmKind
  28721.         then
  28722.      
  28723.         if (not (Kind (root) in block_stmKind))
  28724.             or else
  28725.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28726.             then
  28727.      
  28728.               -- If the root is not a block_stm or if it is then
  28729.               -- if it is not a block with declarations increment
  28730.               -- semicolon.
  28731.               -- This is because the semicolon associated with a declare
  28732.               -- block must be counted in that declare block. If we
  28733.               -- counted it here it would increment the count for the
  28734.               -- enclosing block.
  28735.          IncrementToken (semicolonz);
  28736.       end if;
  28737.      
  28738.         end if;
  28739.      
  28740.     end Scan_delay_stm;
  28741.      
  28742.      
  28743.     procedure Scan_exit_stm(Root : exit_stmNode.Locator) is
  28744.     begin
  28745.      
  28746.      
  28747.       IncrementToken (exitz);
  28748.      
  28749.      
  28750.       if not NAME_EXP.IsNull(as_exit_name_void(Root)) then
  28751.         Scan_NAME_EXP(as_exit_name_void(Root));
  28752.       end if;
  28753.       if not NAME_EXP.IsNull(as_exit_exp_void(Root)) then
  28754.      
  28755.      
  28756.       IncrementToken (when_exitz);
  28757.      
  28758.      
  28759.         Scan_NAME_EXP(as_exit_exp_void(Root));
  28760.       end if;
  28761.      
  28762.         if  Kind(root) not in labeled_stmKind
  28763.         then
  28764.      
  28765.         if (not (Kind (root) in block_stmKind))
  28766.             or else
  28767.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28768.             then
  28769.      
  28770.               -- If the root is not a block_stm or if it is then
  28771.               -- if it is not a block with declarations increment
  28772.               -- semicolon.
  28773.               -- This is because the semicolon associated with a declare
  28774.               -- block must be counted in that declare block. If we
  28775.               -- counted it here it would increment the count for the
  28776.               -- enclosing block.
  28777.          IncrementToken (semicolonz);
  28778.       end if;
  28779.      
  28780.         end if;
  28781.      
  28782.     end Scan_exit_stm;
  28783.      
  28784.      
  28785.     procedure Scan_goto_stm(Root : goto_stmNode.Locator) is
  28786.     begin
  28787.      
  28788.      
  28789.     IncrementToken (gotoz);
  28790.      
  28791.      
  28792.       if not NAME_EXP.IsNull(as_goto_name(Root)) then
  28793.         Scan_NAME_EXP(as_goto_name(Root));
  28794.       end if;
  28795.      
  28796.         if  Kind(root) not in labeled_stmKind
  28797.         then
  28798.      
  28799.         if (not (Kind (root) in block_stmKind))
  28800.             or else
  28801.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28802.             then
  28803.      
  28804.               -- If the root is not a block_stm or if it is then
  28805.               -- if it is not a block with declarations increment
  28806.               -- semicolon.
  28807.               -- This is because the semicolon associated with a declare
  28808.               -- block must be counted in that declare block. If we
  28809.               -- counted it here it would increment the count for the
  28810.               -- enclosing block.
  28811.          IncrementToken (semicolonz);
  28812.       end if;
  28813.      
  28814.         end if;
  28815.      
  28816.     end Scan_goto_stm;
  28817.      
  28818.      
  28819.     procedure Scan_if_stm(Root : if_stmNode.Locator) is
  28820.         as_if_list_List : SeqOfcond_alternativeNode.Generator;
  28821.         as_if_list_Item : cond_alternativeNode.Locator;
  28822.         use SeqOfcond_alternativeNode;
  28823.     begin
  28824.      
  28825.      
  28826.       IncrementToken (ifz);
  28827.       IncrementToken (ifz);
  28828.       IncrementToken (end_ifz);
  28829.      
  28830.      
  28831.       if not SeqOfcond_alternativeNode.IsNull(as_if_list(Root)) then
  28832.         StartForward(as_if_list(Root), as_if_list_List);
  28833.         while not Finished(as_if_list_List) loop
  28834.             as_if_list_Item := Cell(as_if_list_List);
  28835.             Scan_cond_alternative(as_if_list_Item);
  28836.             Forward(as_if_list_List);
  28837.         end loop;
  28838.         EndIterate(as_if_list_List);
  28839.       end if;
  28840.      
  28841.         if  Kind(root) not in labeled_stmKind
  28842.         then
  28843.      
  28844.         if (not (Kind (root) in block_stmKind))
  28845.             or else
  28846.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28847.             then
  28848.      
  28849.               -- If the root is not a block_stm or if it is then
  28850.               -- if it is not a block with declarations increment
  28851.               -- semicolon.
  28852.               -- This is because the semicolon associated with a declare
  28853.               -- block must be counted in that declare block. If we
  28854.               -- counted it here it would increment the count for the
  28855.               -- enclosing block.
  28856.          IncrementToken (semicolonz);
  28857.       end if;
  28858.      
  28859.         end if;
  28860.      
  28861.     end Scan_if_stm;
  28862.      
  28863.      
  28864.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator) is
  28865.         as_labeled_id_s_List : SeqOflabel_idNode.Generator;
  28866.         as_labeled_id_s_Item : label_idNode.Locator;
  28867.         use SeqOflabel_idNode;
  28868.     begin
  28869.      
  28870.      
  28871.       IncrementToken (open_anglesz);
  28872.      
  28873.      
  28874.       if not SeqOflabel_idNode.IsNull(as_labeled_id_s(Root)) then
  28875.         StartForward(as_labeled_id_s(Root), as_labeled_id_s_List);
  28876.         while not Finished(as_labeled_id_s_List) loop
  28877.             as_labeled_id_s_Item := Cell(as_labeled_id_s_List);
  28878.      
  28879.      
  28880.       if SERIES_UNIT_IH.R.ih_inlist then
  28881.           IncrementToken (open_anglesz);
  28882.           IncrementToken (closed_anglesz);
  28883.       end if;
  28884.       SERIES_UNIT_IH.R.ih_inlist := true;
  28885.      
  28886.      
  28887.             Scan_label_id(as_labeled_id_s_Item);
  28888.             Forward(as_labeled_id_s_List);
  28889.         end loop;
  28890.         EndIterate(as_labeled_id_s_List);
  28891.       end if;
  28892.       if not STM.IsNull(as_labeled_stm(Root)) then
  28893.         Scan_STM(as_labeled_stm(Root));
  28894.       end if;
  28895.      
  28896.      
  28897.       IncrementToken (closed_anglesz);
  28898.       SERIES_UNIT_IH.R.ih_inlist := false;
  28899.      
  28900.      
  28901.      
  28902.         if  Kind(root) not in labeled_stmKind
  28903.         then
  28904.      
  28905.         if (not (Kind (root) in block_stmKind))
  28906.             or else
  28907.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28908.             then
  28909.      
  28910.               -- If the root is not a block_stm or if it is then
  28911.               -- if it is not a block with declarations increment
  28912.               -- semicolon.
  28913.               -- This is because the semicolon associated with a declare
  28914.               -- block must be counted in that declare block. If we
  28915.               -- counted it here it would increment the count for the
  28916.               -- enclosing block.
  28917.          IncrementToken (semicolonz);
  28918.       end if;
  28919.      
  28920.         end if;
  28921.      
  28922.     end Scan_labeled_stm;
  28923.      
  28924.      
  28925.     procedure Scan_loop_stm(Root : loop_stmNode.Locator) is
  28926.         as_loop_stm_s_List : SeqOfSTM.Generator;
  28927.         as_loop_stm_s_Item : STM.Locator;
  28928.         use SeqOfSTM;
  28929.     begin
  28930.      
  28931.      
  28932.       IncrementToken (loopz);
  28933.       IncrementToken (loopz);
  28934.       IncrementToken (end_loopz);
  28935.      
  28936.      
  28937.       if not ITERATION.IsNull(as_iteration(Root)) then
  28938.         Scan_ITERATION(as_iteration(Root));
  28939.       end if;
  28940.       if not loop_idNode.IsNull(as_loop_label(Root)) then
  28941.         Scan_loop_id(as_loop_label(Root));
  28942.       end if;
  28943.       if not SeqOfSTM.IsNull(as_loop_stm_s(Root)) then
  28944.         StartForward(as_loop_stm_s(Root), as_loop_stm_s_List);
  28945.         while not Finished(as_loop_stm_s_List) loop
  28946.             as_loop_stm_s_Item := Cell(as_loop_stm_s_List);
  28947.             Scan_STM(as_loop_stm_s_Item);
  28948.             Forward(as_loop_stm_s_List);
  28949.         end loop;
  28950.         EndIterate(as_loop_stm_s_List);
  28951.       end if;
  28952.      
  28953.         if  Kind(root) not in labeled_stmKind
  28954.         then
  28955.      
  28956.         if (not (Kind (root) in block_stmKind))
  28957.             or else
  28958.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28959.             then
  28960.      
  28961.               -- If the root is not a block_stm or if it is then
  28962.               -- if it is not a block with declarations increment
  28963.               -- semicolon.
  28964.               -- This is because the semicolon associated with a declare
  28965.               -- block must be counted in that declare block. If we
  28966.               -- counted it here it would increment the count for the
  28967.               -- enclosing block.
  28968.          IncrementToken (semicolonz);
  28969.       end if;
  28970.      
  28971.         end if;
  28972.      
  28973.     end Scan_loop_stm;
  28974.      
  28975.      
  28976.     procedure Scan_null_stm(Root : null_stmNode.Locator) is
  28977.     begin
  28978.      
  28979.      
  28980.       IncrementToken (null_stmz);
  28981.      
  28982.      
  28983.      
  28984.         if  Kind(root) not in labeled_stmKind
  28985.         then
  28986.      
  28987.         if (not (Kind (root) in block_stmKind))
  28988.             or else
  28989.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28990.             then
  28991.      
  28992.               -- If the root is not a block_stm or if it is then
  28993.               -- if it is not a block with declarations increment
  28994.               -- semicolon.
  28995.               -- This is because the semicolon associated with a declare
  28996.               -- block must be counted in that declare block. If we
  28997.               -- counted it here it would increment the count for the
  28998.               -- enclosing block.
  28999.          IncrementToken (semicolonz);
  29000.       end if;
  29001.      
  29002.         end if;
  29003.      
  29004.     end Scan_null_stm;
  29005.      
  29006.      
  29007.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator) is
  29008.     begin
  29009.       if not pragma_declNode.IsNull(as_pragma(Root)) then
  29010.         Scan_pragma_decl(as_pragma(Root));
  29011.       end if;
  29012.      
  29013.         if  Kind(root) not in labeled_stmKind
  29014.         then
  29015.      
  29016.         if (not (Kind (root) in block_stmKind))
  29017.             or else
  29018.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29019.             then
  29020.      
  29021.               -- If the root is not a block_stm or if it is then
  29022.               -- if it is not a block with declarations increment
  29023.               -- semicolon.
  29024.               -- This is because the semicolon associated with a declare
  29025.               -- block must be counted in that declare block. If we
  29026.               -- counted it here it would increment the count for the
  29027.               -- enclosing block.
  29028.          IncrementToken (semicolonz);
  29029.       end if;
  29030.      
  29031.         end if;
  29032.      
  29033.     end Scan_pragma_stm;
  29034.      
  29035.      
  29036.     procedure Scan_raise_stm(Root : raise_stmNode.Locator) is
  29037.     begin
  29038.      
  29039.      
  29040.       IncrementToken (raisez);
  29041.      
  29042.      
  29043.       if not NAME_EXP.IsNull(as_raise_name_void(Root)) then
  29044.         Scan_NAME_EXP(as_raise_name_void(Root));
  29045.       end if;
  29046.      
  29047.         if  Kind(root) not in labeled_stmKind
  29048.         then
  29049.      
  29050.         if (not (Kind (root) in block_stmKind))
  29051.             or else
  29052.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29053.             then
  29054.      
  29055.               -- If the root is not a block_stm or if it is then
  29056.               -- if it is not a block with declarations increment
  29057.               -- semicolon.
  29058.               -- This is because the semicolon associated with a declare
  29059.               -- block must be counted in that declare block. If we
  29060.               -- counted it here it would increment the count for the
  29061.               -- enclosing block.
  29062.          IncrementToken (semicolonz);
  29063.       end if;
  29064.      
  29065.         end if;
  29066.      
  29067.     end Scan_raise_stm;
  29068.      
  29069.      
  29070.     procedure Scan_return_stm(Root : return_stmNode.Locator) is
  29071.     begin
  29072.      
  29073.      
  29074.       IncrementToken (returnz);
  29075.      
  29076.      
  29077.       if not NAME_EXP.IsNull(as_return_exp_void(Root)) then
  29078.         Scan_NAME_EXP(as_return_exp_void(Root));
  29079.       end if;
  29080.      
  29081.         if  Kind(root) not in labeled_stmKind
  29082.         then
  29083.      
  29084.         if (not (Kind (root) in block_stmKind))
  29085.             or else
  29086.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29087.             then
  29088.      
  29089.               -- If the root is not a block_stm or if it is then
  29090.               -- if it is not a block with declarations increment
  29091.               -- semicolon.
  29092.               -- This is because the semicolon associated with a declare
  29093.               -- block must be counted in that declare block. If we
  29094.               -- counted it here it would increment the count for the
  29095.               -- enclosing block.
  29096.          IncrementToken (semicolonz);
  29097.       end if;
  29098.      
  29099.         end if;
  29100.      
  29101.     end Scan_return_stm;
  29102.      
  29103.      
  29104.     procedure Scan_select_stm(Root : select_stmNode.Locator) is
  29105.         as_select_clause_s_List : SeqOfselect_alternativeNode.Generator;
  29106.         as_select_clause_s_Item : select_alternativeNode.Locator;
  29107.         use SeqOfselect_alternativeNode;
  29108.     begin
  29109.      
  29110.      
  29111.       IncrementToken (selectz);
  29112.       IncrementToken (selectz);
  29113.       IncrementToken (end_selectz);
  29114.      
  29115.      
  29116.       if not SeqOfselect_alternativeNode.IsNull(as_select_clause_s(Root)) then
  29117.         StartForward(as_select_clause_s(Root), as_select_clause_s_List);
  29118.         while not Finished(as_select_clause_s_List) loop
  29119.             as_select_clause_s_Item := Cell(as_select_clause_s_List);
  29120.      
  29121.      
  29122.      if SERIES_UNIT_IH.R.ih_inlist then
  29123.         IncrementToken (or_selectz);
  29124.      end if;
  29125.      SERIES_UNIT_IH.R.ih_inlist := true;
  29126.      
  29127.      
  29128.             Scan_select_alternative(as_select_clause_s_Item);
  29129.             Forward(as_select_clause_s_List);
  29130.         end loop;
  29131.         EndIterate(as_select_clause_s_List);
  29132.       end if;
  29133.       if not cond_alternativeNode.IsNull(as_select_else(Root)) then
  29134.         Scan_cond_alternative(as_select_else(Root));
  29135.      
  29136.      
  29137.       IncrementToken (elsez);
  29138.      
  29139.      
  29140.       end if;
  29141.      
  29142.      
  29143.      SERIES_UNIT_IH.R.ih_inlist := false;
  29144.      
  29145.      
  29146.      
  29147.         if  Kind(root) not in labeled_stmKind
  29148.         then
  29149.      
  29150.         if (not (Kind (root) in block_stmKind))
  29151.             or else
  29152.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29153.             then
  29154.      
  29155.               -- If the root is not a block_stm or if it is then
  29156.               -- if it is not a block with declarations increment
  29157.               -- semicolon.
  29158.               -- This is because the semicolon associated with a declare
  29159.               -- block must be counted in that declare block. If we
  29160.               -- counted it here it would increment the count for the
  29161.               -- enclosing block.
  29162.          IncrementToken (semicolonz);
  29163.       end if;
  29164.      
  29165.         end if;
  29166.      
  29167.     end Scan_select_stm;
  29168.      
  29169.      
  29170.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator) is
  29171.     begin
  29172.      
  29173.      
  29174.       IncrementToken (terminatez);
  29175.      
  29176.      
  29177.      
  29178.         if  Kind(root) not in labeled_stmKind
  29179.         then
  29180.      
  29181.         if (not (Kind (root) in block_stmKind))
  29182.             or else
  29183.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29184.             then
  29185.      
  29186.               -- If the root is not a block_stm or if it is then
  29187.               -- if it is not a block with declarations increment
  29188.               -- semicolon.
  29189.               -- This is because the semicolon associated with a declare
  29190.               -- block must be counted in that declare block. If we
  29191.               -- counted it here it would increment the count for the
  29192.               -- enclosing block.
  29193.          IncrementToken (semicolonz);
  29194.       end if;
  29195.      
  29196.         end if;
  29197.      
  29198.     end Scan_terminate_stm;
  29199.      
  29200. end STM_Pkg;
  29201. -- End: SCSTM bdy -----------------------------------------------------
  29202. ::::::::::::::
  29203. scstm.spc
  29204. ::::::::::::::
  29205. -- Begin: SCSTM spc ---------------------------------------------------
  29206.      
  29207. with ST_DIANA; use ST_DIANA;
  29208.              package STM_Pkg is
  29209.     procedure Scan_STM(Root : STM.Locator);
  29210.     procedure Scan_CALL_STM(Root : CALL_STM.Locator);
  29211.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator);
  29212.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator);
  29213.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator);
  29214.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator);
  29215.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator);
  29216.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator);
  29217.     procedure Scan_abort_stm(Root : abort_stmNode.Locator);
  29218.     procedure Scan_accept_stm(Root : accept_stmNode.Locator);
  29219.     procedure Scan_assign_stm(Root : assign_stmNode.Locator);
  29220.     procedure Scan_block_stm(Root : block_stmNode.Locator);
  29221.     procedure Scan_case_stm(Root : case_stmNode.Locator);
  29222.     procedure Scan_code_stm(Root : code_stmNode.Locator);
  29223.     procedure Scan_delay_stm(Root : delay_stmNode.Locator);
  29224.     procedure Scan_exit_stm(Root : exit_stmNode.Locator);
  29225.     procedure Scan_goto_stm(Root : goto_stmNode.Locator);
  29226.     procedure Scan_if_stm(Root : if_stmNode.Locator);
  29227.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator);
  29228.     procedure Scan_loop_stm(Root : loop_stmNode.Locator);
  29229.     procedure Scan_null_stm(Root : null_stmNode.Locator);
  29230.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator);
  29231.     procedure Scan_raise_stm(Root : raise_stmNode.Locator);
  29232.     procedure Scan_return_stm(Root : return_stmNode.Locator);
  29233.     procedure Scan_select_stm(Root : select_stmNode.Locator);
  29234.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator);
  29235. end STM_Pkg;
  29236. -- End: SCSTM spc -----------------------------------------------------
  29237.      
  29238. ::::::::::::::
  29239. scsubp_de.bdy
  29240. ::::::::::::::
  29241. -- Begin: SCSUBP_DEF bdy ---------------------------------------------------
  29242.      
  29243. with Halstead_Data_Base;  use Halstead_Data_Base;
  29244. with Definitions; use Definitions;
  29245.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  29246. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  29247. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  29248. package body SUBP_DEF_Pkg is
  29249.      
  29250.      
  29251.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator) is
  29252.     begin
  29253.         case Kind(Root) is
  29254.           when FORMAL_SUBPKind => Scan_FORMAL_SUBP(Root);
  29255.           when subp_block_stubKind => Scan_subp_block_stub(Root);
  29256.           when subp_instantiationKind => Scan_subp_instantiation(Root);
  29257.           when subp_renameKind => Scan_subp_rename(Root);
  29258.           when others => null;
  29259.         end case;
  29260.     end Scan_SUBP_DEF;
  29261.      
  29262.      
  29263.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator) is
  29264.     begin
  29265.         case Kind(Root) is
  29266.           when formal_subp_boxKind => Scan_formal_subp_box(Root);
  29267.           when formal_subp_nameKind => Scan_formal_subp_name(Root);
  29268.           when others => null;
  29269.         end case;
  29270.     end Scan_FORMAL_SUBP;
  29271.      
  29272.      
  29273.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator) is
  29274.     begin
  29275.      
  29276.      
  29277.       IncrementToken (box_default_subpz);
  29278.      
  29279.      
  29280.      
  29281.     end Scan_formal_subp_box;
  29282.      
  29283.      
  29284.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator) is
  29285.     begin
  29286.      
  29287.      
  29288.      IncrementToken (is_procedurez);
  29289.      
  29290.      
  29291.      
  29292.     end Scan_formal_subp_name;
  29293.      
  29294.      
  29295.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator) is
  29296.     begin
  29297.       if not BLOCK_STUB.IsNull(as_subp_block_stub(Root)) then
  29298.         Scan_BLOCK_STUB(as_subp_block_stub(Root));
  29299.       end if;
  29300.      
  29301.      
  29302.      IncrementToken (semicolonz);
  29303.      
  29304.      
  29305.      
  29306.     end Scan_subp_block_stub;
  29307.      
  29308.      
  29309.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator) is
  29310.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  29311.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  29312.         use SeqOfGENERAL_ASSOC;
  29313.     begin
  29314.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  29315.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  29316.         while not Finished(as_generic_assoc_s_List) loop
  29317.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  29318.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  29319.             Forward(as_generic_assoc_s_List);
  29320.         end loop;
  29321.         EndIterate(as_generic_assoc_s_List);
  29322.       end if;
  29323.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  29324.      
  29325.      
  29326.       IncrementToken (is_procedurez);
  29327.       IncrementToken (new_generic_instz);
  29328.      
  29329.      
  29330.      
  29331.      
  29332.       IncrementToken (open_parenthesisz);
  29333.      
  29334.      
  29335.         Scan_NAME_EXP(as_instantiation_name(Root));
  29336.      
  29337.      
  29338.       IncrementToken (closed_parenthesisz);
  29339.      
  29340.      
  29341.       end if;
  29342.      
  29343.     end Scan_subp_instantiation;
  29344.      
  29345.      
  29346.     procedure Scan_subp_rename(Root : subp_renameNode.Locator) is
  29347.     begin
  29348.      
  29349.      
  29350.        IncrementToken (renamesz);
  29351.      
  29352.      
  29353.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  29354.         Scan_NAME_EXP(as_rename_name(Root));
  29355.       end if;
  29356.      
  29357.     end Scan_subp_rename;
  29358.      
  29359. end SUBP_DEF_Pkg;
  29360. -- End: SCSUBP_DEF bdy -----------------------------------------------------
  29361. ::::::::::::::
  29362. scsubp_de.spc
  29363. ::::::::::::::
  29364. -- Begin: SCSUBP_DEF spc ---------------------------------------------------
  29365.      
  29366. with ST_DIANA; use ST_DIANA;
  29367.              package SUBP_DEF_Pkg is
  29368.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator);
  29369.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator);
  29370.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator);
  29371.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator);
  29372.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator);
  29373.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator);
  29374.     procedure Scan_subp_rename(Root : subp_renameNode.Locator);
  29375. end SUBP_DEF_Pkg;
  29376. -- End: SCSUBP_DEF spc -----------------------------------------------------
  29377. ::::::::::::::
  29378. sctype_sp.bdy
  29379. ::::::::::::::
  29380. -- Begin: SCTYPE_SPEC bdy ---------------------------------------------------
  29381.      
  29382. with Halstead_Data_Base;  use Halstead_Data_Base;
  29383. with Definitions; use Definitions;
  29384.              with SERIES_UNIT_IH;
  29385. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  29386. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  29387. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  29388. with DEF_ID_Pkg; use DEF_ID_Pkg;
  29389. with ITEM_Pkg; use ITEM_Pkg;
  29390.      
  29391.    with task_decl_IH;
  29392.                          package body TYPE_SPEC_Pkg is
  29393.      
  29394.      
  29395.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator) is
  29396.     begin
  29397.         case Kind(Root) is
  29398.           when ARRAY_TYPEKind => Scan_ARRAY_TYPE(Root);
  29399.           when DSCRMT_TYPEKind => Scan_DSCRMT_TYPE(Root);
  29400.           when FORMAL_SCALARKind => Scan_FORMAL_SCALAR(Root);
  29401.           when access_typeKind => Scan_access_type(Root);
  29402.           when derived_typeKind => Scan_derived_type(Root);
  29403.           when enum_typeKind => Scan_enum_type(Root);
  29404.           when fixed_typeKind => Scan_fixed_type(Root);
  29405.           when float_typeKind => Scan_float_type(Root);
  29406.           when integer_typeKind => Scan_integer_type(Root);
  29407.           when task_specKind => Scan_task_spec(Root);
  29408.           when others => null;
  29409.         end case;
  29410.     end Scan_TYPE_SPEC;
  29411.      
  29412.      
  29413.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator) is
  29414.     begin
  29415.         case Kind(Root) is
  29416.           when constrained_array_typeKind => Scan_constrained_array_type(Root);
  29417.           when unconstrained_array_typeKind => Scan_unconstrained_array_type(Root);
  29418.           when others => null;
  29419.         end case;
  29420.     end Scan_ARRAY_TYPE;
  29421.      
  29422.      
  29423.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator) is
  29424.     begin
  29425.      
  29426.      
  29427.       IncrementToken (arrayz);
  29428.      
  29429.      
  29430.       if not index_constraintNode.IsNull(as_array_constraint(Root)) then
  29431.         Scan_index_constraint(as_array_constraint(Root));
  29432.       end if;
  29433.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  29434.      
  29435.      
  29436.      IncrementToken (ofz);
  29437.      
  29438.      
  29439.         Scan_object_type_constrained(as_component_constrained(Root));
  29440.       end if;
  29441.      
  29442.     end Scan_constrained_array_type;
  29443.      
  29444.      
  29445.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator) is
  29446.         as_index_list_List : SeqOfobject_type_indexNode.Generator;
  29447.         as_index_list_Item : object_type_indexNode.Locator;
  29448.         use SeqOfobject_type_indexNode;
  29449.     begin
  29450.      
  29451.      
  29452.       IncrementToken (arrayz);
  29453.      
  29454.      
  29455.       if not SeqOfobject_type_indexNode.IsNull(as_index_list(Root)) then
  29456.      
  29457.      
  29458.       IncrementToken (open_parenthesisz);
  29459.      
  29460.      
  29461.         StartForward(as_index_list(Root), as_index_list_List);
  29462.         while not Finished(as_index_list_List) loop
  29463.             as_index_list_Item := Cell(as_index_list_List);
  29464.      
  29465.      
  29466.       if SERIES_UNIT_IH.R.ih_inlist then
  29467.           IncrementToken (box_rangez);
  29468.           IncrementToken (commaz);
  29469.       end if;
  29470.       SERIES_UNIT_IH.R.ih_inlist := true;
  29471.      
  29472.      
  29473.             Scan_object_type_index(as_index_list_Item);
  29474.             Forward(as_index_list_List);
  29475.         end loop;
  29476.         EndIterate(as_index_list_List);
  29477.      
  29478.      
  29479.      IncrementToken (closed_parenthesisz);
  29480.      IncrementToken (box_rangez);
  29481.      SERIES_UNIT_IH.R.ih_inlist := false;
  29482.      
  29483.      
  29484.       end if;
  29485.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  29486.      
  29487.      
  29488.      IncrementToken (ofz);
  29489.      
  29490.      
  29491.         Scan_object_type_constrained(as_component_constrained(Root));
  29492.       end if;
  29493.      
  29494.     end Scan_unconstrained_array_type;
  29495.      
  29496.      
  29497.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator) is
  29498.     begin
  29499.         case Kind(Root) is
  29500.           when PRIV_TYPEKind => Scan_PRIV_TYPE(Root);
  29501.           when record_typeKind => Scan_record_type(Root);
  29502.           when others => null;
  29503.         end case;
  29504.     end Scan_DSCRMT_TYPE;
  29505.      
  29506.      
  29507.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator) is
  29508.     begin
  29509.         case Kind(Root) is
  29510.           when FORMAL_PRIVKind => Scan_FORMAL_PRIV(Root);
  29511.           when lim_priv_typeKind => Scan_lim_priv_type(Root);
  29512.           when nonlim_priv_typeKind => Scan_nonlim_priv_type(Root);
  29513.           when others => null;
  29514.         end case;
  29515.     end Scan_PRIV_TYPE;
  29516.      
  29517.      
  29518.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator) is
  29519.     begin
  29520.         case Kind(Root) is
  29521.           when generic_lim_priv_typeKind => Scan_generic_lim_priv_type(Root);
  29522.           when generic_priv_typeKind => Scan_generic_priv_type(Root);
  29523.           when others => null;
  29524.         end case;
  29525.     end Scan_FORMAL_PRIV;
  29526.      
  29527.      
  29528.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator) is
  29529.     begin
  29530.      
  29531.      
  29532.      IncrementToken (limitedz);
  29533.      IncrementToken (private_typez);
  29534.      
  29535.      
  29536.      
  29537.     end Scan_generic_lim_priv_type;
  29538.      
  29539.      
  29540.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator) is
  29541.     begin
  29542.      
  29543.      
  29544.      IncrementToken (private_typez);
  29545.      
  29546.      
  29547.      
  29548.     end Scan_generic_priv_type;
  29549.      
  29550.      
  29551.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator) is
  29552.     begin
  29553.      
  29554.      
  29555.     IncrementToken (limitedz);
  29556.     IncrementToken (private_typez);
  29557.      
  29558.      
  29559.      
  29560.     end Scan_lim_priv_type;
  29561.      
  29562.      
  29563.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator) is
  29564.     begin
  29565.      
  29566.      
  29567.     IncrementToken (private_typez);
  29568.      
  29569.      
  29570.      
  29571.     end Scan_nonlim_priv_type;
  29572.      
  29573.      
  29574.     procedure Scan_record_type(Root : record_typeNode.Locator) is
  29575.     begin
  29576.      
  29577.      
  29578.     IncrementToken (record_typez);
  29579.      
  29580.      
  29581.       if not inner_recordNode.IsNull(as_inner_record(Root)) then
  29582.         Scan_inner_record(as_inner_record(Root));
  29583.       end if;
  29584.      
  29585.      
  29586.     IncrementToken (end_recordz);
  29587.     IncrementToken (record_typez);
  29588.      
  29589.      
  29590.      
  29591.     end Scan_record_type;
  29592.      
  29593.      
  29594.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator) is
  29595.     begin
  29596.         case Kind(Root) is
  29597.           when formal_discreteKind => Scan_formal_discrete(Root);
  29598.           when formal_fixedKind => Scan_formal_fixed(Root);
  29599.           when formal_floatKind => Scan_formal_float(Root);
  29600.           when formal_integerKind => Scan_formal_integer(Root);
  29601.           when others => null;
  29602.         end case;
  29603.     end Scan_FORMAL_SCALAR;
  29604.      
  29605.      
  29606.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator) is
  29607.     begin
  29608.      
  29609.      
  29610.          IncrementToken (box_rangez);
  29611.      
  29612.      
  29613.      
  29614.      
  29615.       IncrementToken (open_parenthesisz);
  29616.       IncrementToken (closed_parenthesisz);
  29617.      
  29618.      
  29619.      
  29620.     end Scan_formal_discrete;
  29621.      
  29622.      
  29623.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator) is
  29624.     begin
  29625.      
  29626.      
  29627.          IncrementToken (box_rangez);
  29628.      
  29629.      
  29630.      
  29631.      
  29632.       IncrementToken (digitsz);
  29633.      
  29634.      
  29635.      
  29636.     end Scan_formal_fixed;
  29637.      
  29638.      
  29639.     procedure Scan_formal_float(Root : formal_floatNode.Locator) is
  29640.     begin
  29641.      
  29642.      
  29643.          IncrementToken (box_rangez);
  29644.      
  29645.      
  29646.      
  29647.      
  29648.       IncrementToken (deltaz);
  29649.      
  29650.      
  29651.      
  29652.     end Scan_formal_float;
  29653.      
  29654.      
  29655.     procedure Scan_formal_integer(Root : formal_integerNode.Locator) is
  29656.     begin
  29657.      
  29658.      
  29659.          IncrementToken (box_rangez);
  29660.      
  29661.      
  29662.      
  29663.      
  29664.      
  29665.      
  29666.      
  29667.     end Scan_formal_integer;
  29668.      
  29669.      
  29670.     procedure Scan_access_type(Root : access_typeNode.Locator) is
  29671.     begin
  29672.      
  29673.      
  29674.     IncrementToken (accessz);
  29675.      
  29676.      
  29677.       if not object_type_constrainedNode.IsNull(as_access_constrained(Root)) then
  29678.         Scan_object_type_constrained(as_access_constrained(Root));
  29679.       end if;
  29680.      
  29681.     end Scan_access_type;
  29682.      
  29683.      
  29684.     procedure Scan_derived_type(Root : derived_typeNode.Locator) is
  29685.     begin
  29686.      
  29687.      
  29688.      IncrementToken (new_derived_typez);
  29689.      
  29690.      
  29691.       if not object_type_constrainedNode.IsNull(as_parent_constrained(Root)) then
  29692.         Scan_object_type_constrained(as_parent_constrained(Root));
  29693.       end if;
  29694.      
  29695.     end Scan_derived_type;
  29696.      
  29697.      
  29698.     procedure Scan_enum_type(Root : enum_typeNode.Locator) is
  29699.         as_enumeral_s_List : SeqOfLITERAL_ID.Generator;
  29700.         as_enumeral_s_Item : LITERAL_ID.Locator;
  29701.         use SeqOfLITERAL_ID;
  29702.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  29703.     begin
  29704.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  29705.      
  29706.      
  29707.      IncrementToken (open_parenthesisz);
  29708.      
  29709.      
  29710.         StartForward(as_enumeral_s(Root), as_enumeral_s_List);
  29711.         while not Finished(as_enumeral_s_List) loop
  29712.             as_enumeral_s_Item := Cell(as_enumeral_s_List);
  29713.      
  29714.      
  29715.      if SERIES_UNIT_IH.R.ih_inlist then
  29716.          IncrementToken (commaz);
  29717.      end if;
  29718.      SERIES_UNIT_IH.R.ih_inlist := true;
  29719.      
  29720.      
  29721.             Scan_LITERAL_ID(as_enumeral_s_Item);
  29722.             Forward(as_enumeral_s_List);
  29723.         end loop;
  29724.         EndIterate(as_enumeral_s_List);
  29725.      
  29726.      
  29727.      IncrementToken (closed_parenthesisz);
  29728.      SERIES_UNIT_IH.R.ih_inlist := false;
  29729.      
  29730.      
  29731.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  29732.      
  29733.     end Scan_enum_type;
  29734.      
  29735.      
  29736.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator) is
  29737.     begin
  29738.      
  29739.      
  29740.      IncrementToken (deltaz);
  29741.      
  29742.      
  29743.       if not fixed_constraintNode.IsNull(as_fixed_constraint(Root)) then
  29744.         Scan_fixed_constraint(as_fixed_constraint(Root));
  29745.       end if;
  29746.      
  29747.     end Scan_fixed_type;
  29748.      
  29749.      
  29750.     procedure Scan_float_type(Root : float_typeNode.Locator) is
  29751.     begin
  29752.      
  29753.      
  29754.      IncrementToken (digitsz);
  29755.      
  29756.      
  29757.       if not float_constraintNode.IsNull(as_float_constraint(Root)) then
  29758.         Scan_float_constraint(as_float_constraint(Root));
  29759.       end if;
  29760.      
  29761.     end Scan_float_type;
  29762.      
  29763.      
  29764.     procedure Scan_integer_type(Root : integer_typeNode.Locator) is
  29765.     begin
  29766.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  29767.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  29768.       end if;
  29769.      
  29770.     end Scan_integer_type;
  29771.      
  29772.      
  29773.     procedure Scan_task_spec(Root : task_specNode.Locator) is
  29774.         as_task_spec_decl_s_List : SeqOfITEM.Generator;
  29775.         as_task_spec_decl_s_Item : ITEM.Locator;
  29776.         use SeqOfITEM;
  29777.     begin
  29778.      
  29779.      
  29780.     if not OuterMostBlockSeen then
  29781.         OuterMostBlockSeen := true;
  29782.     else
  29783.         BlockInfoStack.Push(BlockStack, CurrentBlock);
  29784.         CurrentBlock := InitializeCurrentBlock;
  29785.     end if;
  29786.     SetBlockId (lx_symrep (sm_def_of_type (root)),
  29787.                 task_body_block,
  29788.                 SpcId,
  29789.                 LineNumber (lx_srcpos (root))
  29790.                 );
  29791.     if not task_decl_IH.R.ih_intask_decl then
  29792.          -- If we are not in a task_decl and we are scanning task_spec
  29793.          -- then we are in a type_decl and the token type appears.
  29794.      
  29795.        IncrementToken (typez);
  29796.     end if;
  29797.     IncrementToken (task_spcz);
  29798.     IncrementToken (is_task_spcz);
  29799.     IncrementToken (end_task_spcz);
  29800.      
  29801.      
  29802.       if not SeqOfITEM.IsNull(as_task_spec_decl_s(Root)) then
  29803.         StartForward(as_task_spec_decl_s(Root), as_task_spec_decl_s_List);
  29804.         while not Finished(as_task_spec_decl_s_List) loop
  29805.             as_task_spec_decl_s_Item := Cell(as_task_spec_decl_s_List);
  29806.             Scan_ITEM(as_task_spec_decl_s_Item);
  29807.             Forward(as_task_spec_decl_s_List);
  29808.         end loop;
  29809.         EndIterate(as_task_spec_decl_s_List);
  29810.       end if;
  29811.      
  29812.      
  29813.   IncrementToken (semicolonz);
  29814.   ProcessBlockInfo (CurrentBlock);
  29815.   FreeSpace (CurrentBlock);
  29816.   BlockInfoStack.Pop(BlockStack, CurrentBlock);
  29817.      
  29818.      
  29819.      
  29820.     end Scan_task_spec;
  29821.      
  29822. end TYPE_SPEC_Pkg;
  29823. -- End: SCTYPE_SPEC bdy -----------------------------------------------------
  29824. ::::::::::::::
  29825. sctype_sp.spc
  29826. ::::::::::::::
  29827. -- Begin: SCTYPE_SPEC spc ---------------------------------------------------
  29828.      
  29829. with ST_DIANA; use ST_DIANA;
  29830.              package TYPE_SPEC_Pkg is
  29831.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator);
  29832.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator);
  29833.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator);
  29834.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator);
  29835.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator);
  29836.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator);
  29837.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator);
  29838.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator);
  29839.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator);
  29840.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator);
  29841.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator);
  29842.     procedure Scan_record_type(Root : record_typeNode.Locator);
  29843.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator);
  29844.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator);
  29845.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator);
  29846.     procedure Scan_formal_float(Root : formal_floatNode.Locator);
  29847.     procedure Scan_formal_integer(Root : formal_integerNode.Locator);
  29848.     procedure Scan_access_type(Root : access_typeNode.Locator);
  29849.     procedure Scan_derived_type(Root : derived_typeNode.Locator);
  29850.     procedure Scan_enum_type(Root : enum_typeNode.Locator);
  29851.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator);
  29852.     procedure Scan_float_type(Root : float_typeNode.Locator);
  29853.     procedure Scan_integer_type(Root : integer_typeNode.Locator);
  29854.     procedure Scan_task_spec(Root : task_specNode.Locator);
  29855. end TYPE_SPEC_Pkg;
  29856. -- End: SCTYPE_SPEC spc -----------------------------------------------------
  29857. ::::::::::::::
  29858. scvariant.bdy
  29859. ::::::::::::::
  29860. -- Begin: SCVARIANT_ALTERNATIVE_CLASS bdy ---------------------------------------------------
  29861.      
  29862. with Halstead_Data_Base;  use Halstead_Data_Base;
  29863. with Definitions; use Definitions;
  29864.              with ITEM_Pkg; use ITEM_Pkg;
  29865. with CHOICE_Pkg; use CHOICE_Pkg;
  29866. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  29867. package body VARIANT_ALTERNATIVE_CLASS_Pkg is
  29868.      
  29869.      
  29870.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator) is
  29871.     begin
  29872.         case Kind(Root) is
  29873.           when pragma_variantKind => Scan_pragma_variant(Root);
  29874.           when variant_alternativeKind => Scan_variant_alternative(Root);
  29875.           when others => null;
  29876.         end case;
  29877.     end Scan_VARIANT_ALTERNATIVE_CLASS;
  29878.      
  29879.      
  29880.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator) is
  29881.     begin
  29882.       if not pragma_declNode.IsNull(as_pragma_variant(Root)) then
  29883.         Scan_pragma_decl(as_pragma_variant(Root));
  29884.       end if;
  29885.      
  29886.     end Scan_pragma_variant;
  29887.      
  29888.      
  29889.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator) is
  29890.         as_variant_choice_s_List : SeqOfCHOICE.Generator;
  29891.         as_variant_choice_s_Item : CHOICE.Locator;
  29892.         use SeqOfCHOICE;
  29893.     begin
  29894.       if not SeqOfCHOICE.IsNull(as_variant_choice_s(Root)) then
  29895.      
  29896.      
  29897.      IncrementToken (when_case_variantz);
  29898.      
  29899.      
  29900.         StartForward(as_variant_choice_s(Root), as_variant_choice_s_List);
  29901.         while not Finished(as_variant_choice_s_List) loop
  29902.             as_variant_choice_s_Item := Cell(as_variant_choice_s_List);
  29903.             Scan_CHOICE(as_variant_choice_s_Item);
  29904.             Forward(as_variant_choice_s_List);
  29905.         end loop;
  29906.         EndIterate(as_variant_choice_s_List);
  29907.      
  29908.      
  29909.       IncrementToken (arrowz);
  29910.      
  29911.      
  29912.       end if;
  29913.       if not inner_recordNode.IsNull(as_record(Root)) then
  29914.         Scan_inner_record(as_record(Root));
  29915.       end if;
  29916.      
  29917.     end Scan_variant_alternative;
  29918.      
  29919. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  29920. -- End: SCVARIANT_ALTERNATIVE_CLASS bdy -----------------------------------------------------
  29921. ::::::::::::::
  29922. scvariant.spc
  29923. ::::::::::::::
  29924. -- Begin: SCVARIANT_ALTERNATIVE_CLASS spc ---------------------------------------------------
  29925.      
  29926. with ST_DIANA; use ST_DIANA;
  29927.              package VARIANT_ALTERNATIVE_CLASS_Pkg is
  29928.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator);
  29929.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator);
  29930.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator);
  29931. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  29932. -- End: SCVARIANT_ALTERNATIVE_CLASS spc -----------------------------------------------------
  29933. ::::::::::::::
  29934. srcutil.bdy
  29935. ::::::::::::::
  29936. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.bdy,v $
  29937. -- $Revision: 1.3 $ -- $Date: 85/12/15 18:29:03 $ -- $Author: buddy $
  29938.      
  29939. --pragma revision ("$Revision: 1.3 $");
  29940.      
  29941. package body Source_Position_Utilities is
  29942.      
  29943.     --| OVERVIEW
  29944.     --| This package creates one routine which checks if a
  29945.     --| MLSP.Source_Position is null.  This is helpful
  29946.     --| at some points in the program scan to determine which
  29947.     --| tokens the source program contained.
  29948.      
  29949.     --| NOTES
  29950.     --| This routine should be incorporated in Halstead_Data_Base
  29951.     --| when the world is recompiled.
  29952.      
  29953. --------------------------------------------------------------------------
  29954.      
  29955.     function Is_Srcpos_Null (
  29956.       Position :in    MLSP.Source_Position
  29957.     ) return boolean is
  29958.      
  29959.     begin
  29960.         return (MLSP."=" (Position.first_location, 0));
  29961.     end;
  29962. end Source_Position_Utilities;
  29963.      
  29964. ::::::::::::::
  29965. srcutil.spc
  29966. ::::::::::::::
  29967. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.spc,v $
  29968. -- $Revision: 1.1 $ -- $Date: 85/12/15 17:35:12 $ -- $Author: buddy $
  29969.      
  29970. --pragma revision ("$Revision: 1.1 $");
  29971.      
  29972. with ML_Source_Position_Pkg;
  29973. package Source_Position_Utilities is
  29974.      
  29975.     --| OVERVIEW
  29976.     --| This package creates one routine which checks if a
  29977.     --| MLSP.Source_Position is null.  This is helpful
  29978.     --| at some points in the program scan to determine which
  29979.     --| tokens the source program contained.
  29980.      
  29981.     --| NOTES
  29982.     --| This routine should be incorporated in Halstead_Data_Base
  29983.     --| when the world is recompiled.
  29984.      
  29985.     package MLSP renames ML_Source_Position_Pkg;
  29986.      
  29987. --------------------------------------------------------------------------
  29988.      
  29989.     function Is_Srcpos_Null (
  29990.       Position :in    MLSP.Source_Position
  29991.     ) return boolean;
  29992.      
  29993.     --| OVERVIEW
  29994.     --| This function returns true if the source position passed in
  29995.     --| is null.
  29996.      
  29997. end Source_Position_Utilities;
  29998.      
  29999.