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_INTERFACEINTEGER_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_
  5358. VMMTEXTPKGVMMSYSTEMPKG_ 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_
  5359. 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_MAPPINGHIF_KEYED_IO_ HIF_KEYED_IOBIN_KEYED_IO_BLOCKS_BIN_KEYED_IO_BLOCKSHOST_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
  5360. HIF_DEBUG_    HIF_DEBUG PARAMETERS_
  5361. PARAMETERS PLIF_DEBUG_
  5362. 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_TASK_DECL_IH_TYPE_DECL_IH_GENERIC_HEADER_CLASS_PKG_GENERIC_HEADER_CLASS_PKG DEF_ID_PKG_
  5363. DEF_ID_PKG PKG_DEF_PKG_ PKG_DEF_PKG HEADER_PKG_
  5364. HEADER_PKGOBJECT_TYPE_PKG_OBJECT_TYPE_PKGOBJECT_DEF_PKG_OBJECT_DEF_PKGNAME_EXP_PKG_ NAME_EXP_PKGCONSTRAINT_PKG_CONSTRAINT_PKGSUBP_DEF_PKG_ SUBP_DEF_PKGGENERAL_ASSOC_PKG_GENERAL_ASSOC_PKGBLOCK_STUB_PKG_BLOCK_STUB_PKGTYPE_SPEC_PKG_TYPE_SPEC_PKGGENERIC_HEADER_IH_IDENTIFIER_UTILITIES_IDENTIFIER_UTILITIESAGG_COMPONENT_PKG_AGG_COMPONENT_PKGSTM_PKG_STM_PKGALTERNATIVE_PKG_ALTERNATIVE_PKGBLOCK_STM_IH_SOURCE_POSITION_UTILITIES_SOURCE_POSITION_UTILITIESINNER_RECORD_CLASS_PKG_INNER_RECORD_CLASS_PKGAGG_NAMED_IH_ CHOICE_PKG_
  5365. CHOICE_PKGITERATION_PKG_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
  5366. ADA$ELAB_HALSTEAD|{    HALSTEADHALSTEADw/
  5367. ]\{ADA$INIT_COMPONENT~P
  5368.     
  5369. LISTS$ELAB
  5370. 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    'VMMPAGE_$ELAB'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    HIF_KEY_GENERATOR_$ELABHIF_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     TEXT_IO_$ELAB TEXT_IO_$ELAB     TEXT_IO$ELAB 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    nSTARLET_$ELABnSTARLET_$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    mCALENDAR$ELABmCALENDAR$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     VSUTILS_$ELAB 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    HOST_LIB$ELABHOST_LIB$ELAB    
  5371. PAGINATED_OUTPUT_$ELAB
  5372. 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    
  5373. HIF_PATH_NAMES$ELAB
  5374. 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    ST_DIANA$ELABST_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    
  5375. COUNT$ELAB
  5376. 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    ESTM_PKG_$ELABESTM_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    ITEM_PKG$ELABITEM_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    HALSTEAD$ELABHALSTEAD$ELABADA$INIT_COMPONENTLIB$INITIALIZEi$CODE|LIB$INITIALIZE}    HALSTEADHALSTEADoTRANSFER$ADDRESSw?=::::::::::::::
  5377. halstead.src
  5378. ::::::::::::::
  5379. ::::::::::::::
  5380. block_u.bdy
  5381. ::::::::::::::
  5382. --VMS file: %nosc.work.tools.halstead.source*(block_u.bdy)
  5383. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.bdy
  5384. -- $Source: /nosc/work/tools/halstead/RCS/block_u.bdy,v $
  5385. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:46 $ -- $Author: buddy $
  5386.      
  5387. --pragma revision ("$Revision: 1.2 $");
  5388.      
  5389. with ML_Source_Position_Pkg;
  5390. package body Block_Utilities is
  5391.      
  5392.     package MLSP renames ML_Source_Position_Pkg;
  5393. --------------------------------------------------------------------------
  5394. --                          LOCAL SUBPROGRAMS
  5395. --------------------------------------------------------------------------
  5396.      
  5397.     function Is_Source_Position_Null (
  5398.         Position :in    MLSP.Source_Position
  5399.     ) return boolean;
  5400.      
  5401.     --| OVERVIEW
  5402.     --| This procedure returns true if the source position passed in
  5403.     --| is null.  This means that column and line of the
  5404.     --| Position.first_location is 0.
  5405.      
  5406. --------------------------------------------------------------------------
  5407.      
  5408.     function In_Declare_Block (  --| This function determines whether
  5409.                                  --| we are in a block with declarations.
  5410.                                  --| If we are it returns true otherwise
  5411.                                  --| false.
  5412.                       block :in     BLOCK_STUB.Locator
  5413.     ) return boolean is
  5414.      
  5415.         use SeqOfITEM;
  5416.         I :Generator;
  5417.      
  5418.     begin
  5419.         --| OVERVIEW
  5420.         --| This function is used to determined if in fact the block
  5421.         --| passed in is a block with explicit declarations which
  5422.         --| means the token declare appears in the source program.
  5423.         --| This is determined by walking down the list of declarations
  5424.         --| until something which is not an implicit label is encountered.
  5425.         --| Implicit labels are inserted in the as_item_s list
  5426.         --| of the enclosing block.  Thus if the only elements of the
  5427.         --| as_item_s of the block are implicit_labels then the token
  5428.         --| declare does not appear in the source program.
  5429.      
  5430.         StartForward (as_item_s (block), I);
  5431.         while not Finished(I) loop
  5432.             case Kind (Cell (I)) is
  5433.               when implicit_label_declKind =>
  5434.                 Forward (I);
  5435.               when others =>
  5436.                 EndIterate (I);
  5437.                 return true;
  5438.             end case;
  5439.         end loop;
  5440.         EndIterate (I);
  5441.         return false;
  5442.     end In_declare_block;
  5443.      
  5444. --------------------------------------------------------------------------
  5445.      
  5446.     function Is_Block_Labeled ( --| This function returns true
  5447.                                 --| if the block passed in has a label
  5448.                                 --| and returns false otherwise.
  5449.         block :in     block_stmNode.Locator
  5450.     ) return boolean is
  5451.     begin
  5452.         return not Is_Source_Position_Null (
  5453.                  lx_srcpos (as_block_label (block))
  5454.                                            );
  5455.     end;
  5456.      
  5457. --------------------------------------------------------------------------
  5458.      
  5459.     function Is_Source_Position_Null (
  5460.         Position :in    MLSP.Source_Position
  5461.     ) return boolean is
  5462.     begin
  5463.         return MLSP."=" (Position.first_location,0);
  5464.     end;
  5465.      
  5466. end Block_Utilities;
  5467. ::::::::::::::
  5468. block_u.spc
  5469. ::::::::::::::
  5470. --VMS file: %nosc.work.tools.halstead.source*(block_u.spc)
  5471. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/block_u.spc
  5472. -- $Source: /nosc/work/tools/halstead/RCS/block_u.spc,v $
  5473. -- $Revision: 1.2 $ -- $Date: 86/02/04 22:05:09 $ -- $Author: buddy $
  5474.      
  5475. --pragma revision ("$Revision: 1.2 $");
  5476.      
  5477.      
  5478. with ST_DIANA; use ST_DIANA;
  5479. package Block_Utilities is
  5480. --------------------------------------------------------------------------
  5481.      
  5482.     function In_Declare_Block (  --| This function determines whether
  5483.                                  --| we are in a block with declarations.
  5484.                                  --| If we are it returns true otherwise
  5485.                                  --| false.
  5486.                       block :in     BLOCK_STUB.Locator
  5487.     ) return boolean;
  5488.      
  5489.      
  5490.     function Is_Block_Labeled ( --| This function returns true
  5491.                                 --| if the block passed in has a label
  5492.                                 --| and returns false otherwise.
  5493.         block :in     block_stmNode.Locator
  5494.     ) return boolean;
  5495. end Block_Utilities;
  5496. ::::::::::::::
  5497. comlin.bdy
  5498. ::::::::::::::
  5499. -- $Source: /nosc/work/tools/halstead/RCS/comlin.bdy,v $
  5500. -- $Revision: 1.18 $ -- $Date: 85/03/25 21:03:22 $ -- $Author: buddy $
  5501. with Text_IO; use Text_IO;
  5502. with Int_IO; use Int_IO;
  5503. package body CommandLine is
  5504.     TokenSeparator :constant character := '%';
  5505.      
  5506. --------------------------------------------------------------------------
  5507.     procedure ScanForChar (
  5508.               S     :in     String;
  5509.               C     :in     character;
  5510.               Start :in     positive;
  5511.               Place :   out natural
  5512.     ) is
  5513.         Temp  :positive := Start;
  5514.         Found :boolean := false;
  5515.     begin
  5516.      
  5517.         Place := 0;
  5518.         while (Temp <= S'Last) and (not Found) loop
  5519.             if S(Temp) = C then
  5520.                 Place := Temp;
  5521.                 Found := true;
  5522.             end if;
  5523.             Temp := Temp + 1;
  5524.         end loop;
  5525.      end;
  5526.      
  5527. --------------------------------------------------------------------------
  5528.      
  5529.     function GetNumberOfUnits(
  5530.              S     :in    String
  5531.     ) return natural is
  5532.      
  5533.         count :natural := 0;
  5534.     begin
  5535.         for i in S'Range loop
  5536.             if S(i) = TokenSeparator then
  5537.                 count := count + 1;
  5538.             end if;
  5539.         end loop;
  5540.         return count;
  5541.     end;
  5542.      
  5543. --------------------------------------------------------------------------
  5544.      
  5545.     function GetToken (
  5546.              S     :in    String;
  5547.              Start :in    positive
  5548.     ) return String is
  5549.         EndOfToken :natural;
  5550.     begin
  5551.      
  5552.         ScanForChar (S, TokenSeparator, Start, EndOfToken);
  5553.         if EndOfToken = 0 then
  5554.             raise TokenNotFound;
  5555.         else
  5556.            return S(Start..EndOfToken - 1);
  5557.         end if;
  5558.      end;
  5559.      
  5560. --------------------------------------------------------------------------
  5561.      
  5562.     procedure Advance (
  5563.               S     :in     String;
  5564.               Start :in out positive
  5565.    ) is
  5566.    begin
  5567.        Start := Start + GetToken (S, Start)'Length + 1;
  5568.    end;
  5569.      
  5570. --------------------------------------------------------------------------
  5571.      
  5572.     function GetSpec (
  5573.              S     :in    String;
  5574.              Start :in    positive
  5575.     ) return boolean is
  5576.     begin
  5577.      
  5578.         if boolean'Value (GetToken (S, Start)) in false..true then
  5579.             return boolean'Value (GetToken (S, Start));
  5580.         end if;
  5581.     exception
  5582.         when CONSTRAINT_ERROR =>
  5583.           raise ExpectingBoolean;
  5584.     end;
  5585.      
  5586. --------------------------------------------------------------------------
  5587.      
  5588.     function IsSubUnit (
  5589.              S     :in    String;
  5590.              Start :in    positive
  5591.     ) return boolean is
  5592.         PeriodPosition   :natural;
  5593.     begin
  5594.         ScanForChar (S, '.', Start, PeriodPosition);
  5595.         if (S'First < PeriodPosition) and (PeriodPosition < S'Last) then
  5596.             return true;
  5597.         else
  5598.             return false;
  5599.         end if;
  5600.     end;
  5601.      
  5602. --------------------------------------------------------------------------
  5603.      
  5604.     function GetParent (
  5605.              S     :in    String;
  5606.              Start :in    positive
  5607.     ) return String is
  5608.         PeriodPosition :natural;
  5609.     begin
  5610.         ScanForChar (S, '.', Start, PeriodPosition);
  5611.         if PeriodPosition = 0 then
  5612.             raise InvalidSubUnit;
  5613.         else
  5614.             Return S(Start..PeriodPosition - 1);
  5615.         end if;
  5616.     end;
  5617.      
  5618. --------------------------------------------------------------------------
  5619.      
  5620.     function GetSubUnit (
  5621.              S     :in    String;
  5622.              Start :in    positive
  5623.     ) return String is
  5624.          PeriodPosition  :natural;
  5625.          EndToken        :natural;
  5626.     begin
  5627.          ScanForChar (S, '.', Start, PeriodPosition);
  5628.          ScanForChar (S, TokenSeparator, PeriodPosition, EndToken);
  5629.          if EndToken = 0 then
  5630.              raise InvalidSubUnit;
  5631.          else
  5632.              return S(PeriodPosition + 1..EndToken - 1);
  5633.          end if;
  5634.     end;
  5635.      
  5636. --------------------------------------------------------------------------
  5637.      
  5638. end CommandLine;
  5639. ::::::::::::::
  5640. comlin.spc
  5641. ::::::::::::::
  5642. -- $Source: /nosc/work/tools/halstead/RCS/comlin.spc,v $
  5643. -- $Revision: 1.5 $ -- $Date: 85/03/24 16:17:23 $ -- $Author: buddy $
  5644.      
  5645. package CommandLine is
  5646.     TokenNotFound    :exception;
  5647.     ExpectingBoolean :exception;
  5648.     InvalidSubUnit   :exception;
  5649.      
  5650.     function GetNumberOfUnits(
  5651.              S     :in    String
  5652.     ) return natural;
  5653.      
  5654. --------------------------------------------------------------------------
  5655.      
  5656.     procedure Advance (
  5657.               S      :in     String;
  5658.               Start  :in out positive
  5659.     );
  5660.      
  5661. --------------------------------------------------------------------------
  5662.      
  5663.     function GetToken (
  5664.              S     :in    String;
  5665.              Start :in    positive
  5666.     ) return String;
  5667.      
  5668. --------------------------------------------------------------------------
  5669.      
  5670.     function IsSubUnit (
  5671.              S     :in    String;
  5672.              Start :in    positive
  5673.     ) return boolean;
  5674.      
  5675. --------------------------------------------------------------------------
  5676.      
  5677.     function GetParent (
  5678.              S     :in    String;
  5679.              Start :in    positive
  5680.     ) return String;
  5681.      
  5682. --------------------------------------------------------------------------
  5683.      
  5684.     function GetSpec (
  5685.              S     :in    String;
  5686.              Start :in    positive
  5687.     ) return boolean;
  5688.      
  5689. --------------------------------------------------------------------------
  5690.      
  5691.     function GetSubUnit (
  5692.              S     :in    String;
  5693.              Start :in    positive
  5694.     ) return String;
  5695.      
  5696. --------------------------------------------------------------------------
  5697.      
  5698. end CommandLine;
  5699. ::::::::::::::
  5700. count.bdy
  5701. ::::::::::::::
  5702. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5703. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5704.      
  5705. --pragma revision ("$Revision: 1.1 $");
  5706.      
  5707. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5708. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5709.      
  5710. --pragma revision ("$Revision: 1.1 $");
  5711.      
  5712. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5713. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5714.      
  5715. --pragma revision ("$Revision: 1.1 $");
  5716.      
  5717. -- $Source: /nosc/work/tools/halstead/RCS/count5.bdy,v $
  5718. -- $Revision: 1.1 $ -- $Date: 85/12/31 14:51:21 $ -- $Author: maria $
  5719.      
  5720. --pragma revision ("$Revision: 1.1 $");
  5721.      
  5722. with Text_IO; use Text_IO;
  5723. with Int_IO; use Int_IO;
  5724. package body count is
  5725.     TokenClassification: array (D.TokenItem) of D.Class := (
  5726.       D.abortz                  => D.operator,
  5727.       D.acceptz                 => D.operator,
  5728.       D.accessz                 => D.operator,
  5729.       D.allz                    => D.operator,
  5730.       D.and_thenz               => D.operator,
  5731.       D.arrayz                  => D.operator,
  5732.       D.atz                     => D.neither,
  5733.       D.beginz                  => D.neither,
  5734.       D.bodyz                   => D.neither,
  5735.       D.body_packagez           => D.neither,
  5736.       D.body_taskz              => D.neither,
  5737.       D.casez                   => D.neither,
  5738.       D.case_stmz               => D.neither,
  5739.       D.case_variantz           => D.neither,
  5740.       D.constantz               => D.operator,
  5741.       D.declarez                => D.operator,
  5742.       D.delayz                  => D.operator,
  5743.       D.deltaz                  => D.operator,
  5744.       D.digitsz                 => D.operator,
  5745.       D.doz                     => D.neither,
  5746.       D.elsez                   => D.operator,
  5747.       D.else_ifz                => D.operator,
  5748.       D.else_orz                => D.operator,
  5749.       D.else_selectz            => D.operator,
  5750.       D.elsifz                  => D.operator,
  5751.       D.endz                    => D.neither,
  5752.       D.end_acceptz             => D.neither,
  5753.       D.end_beginz              => D.neither,
  5754.       D.end_case_stmz           => D.operator,
  5755.       D.end_case_variantz       => D.operator,
  5756.       D.end_ifz                 => D.operator,
  5757.       D.end_loopz               => D.operator,
  5758.       D.end_package_bdyz        => D.operator,
  5759.       D.end_package_spcz        => D.operator,
  5760.       D.end_recordz             => D.operator,
  5761.       D.end_record_repz         => D.operator,
  5762.       D.end_selectz             => D.operator,
  5763.       D.end_task_spcz           => D.operator,
  5764.       D.entryz                  => D.operator,
  5765.       D.exceptionz              => D.operator,
  5766.       D.exitz                   => D.operator,
  5767.       D.forz                    => D.neither,
  5768.       D.for_loopz               => D.neither,
  5769.       D.for_repz                => D.neither,
  5770.       D.functionz               => D.operator,
  5771.       D.genericz                => D.operator,
  5772.       D.gotoz                   => D.operator,
  5773.       D.ifz                     => D.neither,
  5774.       D.inz                     => D.operator,
  5775.       D.in_loopz                => D.operator,
  5776.       D.in_membershipz          => D.operator,
  5777.       D.in_out_parameterz       => D.neither,
  5778.       D.in_parameterz           => D.neither,
  5779.       D.isz                     => D.neither,
  5780.       D.is_case_stmz            => D.neither,
  5781.       D.is_case_variantz        => D.neither,
  5782.       D.is_functionz            => D.neither,
  5783.       D.is_genericz             => D.neither,
  5784.       D.is_package_bdyz         => D.neither,
  5785.       D.is_package_spcz         => D.neither,
  5786.       D.is_procedurez           => D.neither,
  5787.       D.is_separatez            => D.operator,
  5788.       D.is_subtypez             => D.neither,
  5789.       D.is_typez                => D.neither,
  5790.       D.is_task_bdyz            => D.neither,
  5791.       D.is_task_spcz            => D.neither,
  5792.       D.limitedz                => D.operator,
  5793.       D.loopz                   => D.neither,
  5794.       D.modz                    => D.operator,
  5795.       D.newz                    => D.neither,
  5796.       D.new_allocatorz          => D.operator,
  5797.       D.new_derived_typez       => D.operator,
  5798.       D.new_generic_instz       => D.operator,
  5799.       D.not_in_membershipz      => D.operator,
  5800.       D.nullz                   => D.neither,
  5801.       D.null_valuez             => D.operand,
  5802.       D.null_stmz               => D.operator,
  5803.       D.null_fieldz             => D.operator,
  5804.       D.ofz                     => D.operator,
  5805.       D.orz                     => D.operator,
  5806.       D.or_elsez                => D.operator,
  5807.       D.or_selectz              => D.operator,
  5808.       D.othersz                 => D.neither,
  5809.       D.others_aggregatez       => D.operator,
  5810.       D.others_casez            => D.operator,
  5811.       D.others_exceptionz       => D.operator,
  5812.       D.others_variantz         => D.operator,
  5813.       D.outz                    => D.neither,
  5814.       D.packagez                => D.neither,
  5815.       D.package_bdyz            => D.neither,
  5816.       D.package_spcz            => D.neither,
  5817.       D.pragmaz                 => D.operator,
  5818.       D.privatez                => D.neither,
  5819.       D.private_sectionz        => D.operator,
  5820.       D.private_typez           => D.operator,
  5821.       D.procedurez              => D.neither,
  5822.       D.raisez                  => D.operator,
  5823.       D.rangez                  => D.operator,
  5824.       D.recordz                 => D.neither,
  5825.       D.record_typez            => D.neither,
  5826.       D.record_repz             => D.neither,
  5827.       D.renamesz                => D.operator,
  5828.       D.returnz                 => D.operator,
  5829.       D.reversez                => D.operator,
  5830.       D.selectz                 => D.neither,
  5831.       D.separatez               => D.neither,
  5832.       D.subtypez                => D.operator,
  5833.       D.taskz                   => D.neither,
  5834.       D.task_bdyz               => D.neither,
  5835.       D.task_spcz               => D.neither,
  5836.       D.terminatez              => D.operator,
  5837.       D.thenz                   => D.neither,
  5838.       D.then_andz               => D.operator,
  5839.       D.typez                   => D.operator,
  5840.       D.usez                    => D.neither,
  5841.       D.use_contextz            => D.operator,
  5842.       D.use_repz                => D.operator,
  5843.       D.whenz                   => D.neither,
  5844.       D.when_case_stmz          => D.neither,
  5845.       D.when_exitz              => D.neither,
  5846.       D.when_exceptionz         => D.neither,
  5847.       D.when_selectz            => D.neither,
  5848.       D.when_case_variantz      => D.neither,
  5849.       D.whilez                  => D.operator,
  5850.       D.withz                   => D.neither,
  5851.       D.with_contextz           => D.operator,
  5852.       D.with_genericz           => D.operator,
  5853.       -------------  punctuation  --------------
  5854.       D.arrowz                  => D.operator,
  5855.       D.barz                    => D.operator,
  5856.       D.boxz                    => D.neither,
  5857.       D.box_rangez              => D.operator,
  5858.       D.box_default_subpz       => D.operator,
  5859.       D.character_literalz      => D.operand,
  5860.       D.closed_anglesz          => D.neither,
  5861.       D.closed_parenthesisz     => D.neither,
  5862.       D.colon_equalsz           => D.operator,
  5863.       D.colonz                  => D.operator,
  5864.       D.commaz                  => D.operator,
  5865.       D.dotz                    => D.operator,
  5866.       D.dot_dot_rangez          => D.operator,
  5867.       D.double_quotez           => D.operand,
  5868.       D.numeric_literalz        => D.operand,
  5869.       D.open_anglesz            => D.operator,
  5870.       D.open_parenthesisz       => D.operator,
  5871.       D.semicolonz              => D.neither,
  5872.       D.single_quotez           => D.neither,
  5873.       D.tickz                   => D.operator,
  5874.       D.declare_blockz          => D.neither
  5875.            );
  5876.               --| This is a map from token types to symbol classification.
  5877.               --| It indicates which class (D.operator, operand, neither)
  5878.               --| a token is in.
  5879.      
  5880. --------------------------------------------------------------------------
  5881.      
  5882.     function RemoveLastChar (  --| This removes the last character from
  5883.                                --| the string S.  This is used to get
  5884.                                --| rid of the z's in the TokenItems.
  5885.                    S      :in     String
  5886.     ) return String is
  5887.      
  5888.     begin
  5889.         return S(S'first..S'last - 1);
  5890.     end;
  5891.      
  5892. --------------------------------------------------------------------------
  5893.      
  5894.     procedure HalsteadCount (
  5895.       TokenInfo :in     D.TokenCountType;
  5896.       VerboseOn :in     boolean;
  5897.       Nn:        in out CT.NnInfoType
  5898.     )  is
  5899.     begin
  5900.         for t in D.TokenItem loop
  5901.             if TokenInfo(t) > 0  then
  5902.                 Nn(TokenClassification(t)).Vocabulary :=
  5903.                   Nn(TokenClassification(t)).Vocabulary + 1;
  5904.                 Nn(TokenClassification(t)).Usage :=
  5905.                   Nn(TokenClassification(t)).Usage + TokenInfo(t);
  5906.      
  5907.                 if VerboseOn then
  5908.                     Put (Standard_Output, "number of ");
  5909.                     Put (Standard_Output,
  5910.                          RemoveLastChar (D.TokenItem ' image (t)));
  5911.                     Put (Standard_Output, " tokens is ");
  5912.                     Put (Standard_Output, TokenInfo(t));
  5913.                     New_Line (Standard_Output);
  5914.                 end if;
  5915.      
  5916.             end if;
  5917.         end loop;
  5918.     end HalsteadCount;
  5919. end count;
  5920. ::::::::::::::
  5921. count.spc
  5922. ::::::::::::::
  5923. -- $Source: /nosc/work/tools/halstead/RCS/count.spc,v $
  5924. -- $Revision: 1.3 $ -- $Date: 85/06/13 13:29:12 $ -- $Author: buddy $
  5925.      
  5926. --pragma revision ("$Revision: 1.3 $");
  5927.      
  5928. with Definitions;
  5929. with Count_Types;
  5930. package Count is
  5931.      
  5932.     package D renames Definitions;
  5933.     package CT renames Count_Types;
  5934.      
  5935. --------------------------------------------------------------------------
  5936.      
  5937.     procedure HalsteadCount (  --| This procedure determines which tokens
  5938.                                --| are operators and operands and counts
  5939.                                --| them.
  5940.       TokenInfo :in     D.TokenCountType;
  5941.       VerboseOn :in     boolean;
  5942.       Nn:        in out CT.NnInfoType
  5943.     );
  5944.      
  5945. --------------------------------------------------------------------------
  5946. end Count;
  5947. ::::::::::::::
  5948. countype.bdy
  5949. ::::::::::::::
  5950. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  5951. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  5952.      
  5953. --pragma revision ("$Revision: 1.1 $");
  5954.      
  5955. -- $Source: /nosc/work/tools/halstead/RCS/countype.bdy,v $
  5956. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:38:21 $ -- $Author: buddy $
  5957.      
  5958. --pragma revision ("$Revision: 1.1 $");
  5959.      
  5960. with Definitions;
  5961. package body Count_Types is
  5962.      
  5963. --------------------------------------------------------------------------
  5964.      
  5965.     function AddCounts (   --| This function Adds two records and
  5966.                            --| returns their sum.
  5967.                      L   :in     NnInfoType;
  5968.                      R   :in     NnInfoType
  5969.     ) return NnInfoType is
  5970.         Sum :NnInfoType;
  5971.     begin
  5972.         for c in Definitions.Class loop
  5973.             Sum(c).Vocabulary := L(c).Vocabulary + R(c).Vocabulary;
  5974.             Sum(c).Usage := L(c).Usage + R(c).Usage;
  5975.         end loop;
  5976.         return Sum;
  5977.     end;
  5978. --------------------------------------------------------------------------
  5979.      
  5980.     procedure ZeroCount (--| Sets the counts of all the classes of  NnInfo
  5981.                          --| to 0.
  5982.                   NnInfo :in out  NnInfoType
  5983.     ) is
  5984.     begin
  5985.         for c in Definitions.Class loop
  5986.             NnInfo(c).Vocabulary := 0;
  5987.             NnInfo(c).Usage := 0;
  5988.         end loop;
  5989.     end;
  5990.      
  5991. ------------------------------------------------------------------------- -
  5992. end Count_Types;
  5993. ::::::::::::::
  5994. countype.spc
  5995. ::::::::::::::
  5996. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  5997. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  5998.      
  5999. --pragma revision ("$Revision: 1.1 $");
  6000.      
  6001. -- $Source: /nosc/work/tools/halstead/RCS/countype.spc,v $
  6002. -- $Revision: 1.1 $ -- $Date: 85/07/04 11:36:37 $ -- $Author: buddy $
  6003.      
  6004. --pragma revision ("$Revision: 1.1 $");
  6005.      
  6006. with Definitions;
  6007. package Count_Types is
  6008.     --| OVERVIEW
  6009.     --| This package defines types that are being used in the counting
  6010.     --| of tokens.  It also provides an operation AddCounts which
  6011.     --| a function which returns the sum of two NnInfoType records.
  6012.     --| This is needed because it is necessary to separate the token
  6013.     --| counts which result from DEF_ID_Analysis and Literal_Analysis
  6014.     --| and the token counts which result from keyword other syntactic
  6015.     --| constructs.
  6016.      
  6017.     type NnRecordType is
  6018.         record
  6019.           Vocabulary: natural := 0;
  6020.           Usage:      natural := 0;
  6021.         end record;
  6022.         --| This package is used to define the NnInfoType used by all
  6023.         --| the different counting strategies.
  6024.      
  6025.     type NnInfoType is array (Definitions.Class) of NnRecordType;
  6026.       --| NnInfoType keeps track of the vocabulary and usage for each
  6027.       --| class (i.e. operator, operand, and neither).
  6028.       --|
  6029.       --| Vocabulary keeps track of the number of unique symbols in
  6030.       --| the source program.  For example:
  6031.       --|
  6032.       --|          Nn :NnInfoType;
  6033.       --|
  6034.       --| Then Nn(operator).Vocabulary corresponds to n1 the unique
  6035.       --| number of operators in Halstead's notation and
  6036.       --| Nn(operand).Vocabulary corresponds to n2 the unique number of
  6037.       --| operands.  Thus
  6038.       --|
  6039.       --| Nn(operator).Vocabulary + Nn(operand).Vocabulary =n
  6040.       --|
  6041.       --|  which is the vocabulary for the source program.
  6042.       --|
  6043.       --| Usage keeps track of the total usage of each class of
  6044.       --| operator, operand, and neither. Nn(operator).Usage
  6045.       --| Nn(operand).Usage correspond to N1 and N2 in Halstead
  6046.       --| notation and their sum corresponds to N which is the length of
  6047.      
  6048. --------------------------------------------------------------------------
  6049.      
  6050.     function AddCounts (   --| This function Adds two records and
  6051.                            --| returns their sum.
  6052.                      L   :in     NnInfoType;
  6053.                      R   :in     NnInfoType
  6054.     ) return NnInfoType ;
  6055. --------------------------------------------------------------------------
  6056.      
  6057.     procedure ZeroCount (--| Sets the counts of NnInfo to 0.
  6058.                   NnInfo :in out  NnInfoType
  6059.     );
  6060.      
  6061. ------------------------------------------------------------------------- -
  6062. end Count_Types;
  6063. ::::::::::::::
  6064. defs.bdy
  6065. ::::::::::::::
  6066. -- $Source: /nosc/work/tools/halstead/RCS/defs.bdy,v $
  6067. -- $Revision: 5.1 $ -- $Date: 85/04/04 08:30:38 $ -- $Author: buddy $
  6068.      
  6069. with VmmTextPkg;
  6070. with unchecked_deallocation;
  6071. package body Definitions is
  6072.      
  6073.     function "<" ( --| This function compares the text of two literals
  6074.                    --| to see if X is lexigraphically less than Y.
  6075.            X :in Source_Text.Locator;
  6076.            Y :in Source_Text.Locator
  6077.     ) return boolean is
  6078.      
  6079.     begin
  6080.         return
  6081.         VmmTextPkg.Value (Source_Text.Value (X))
  6082.         <
  6083.         VmmTextPkg.Value (Source_Text.Value (Y));
  6084.     end;
  6085.      
  6086.     package body Literal_Set is
  6087.      
  6088.     ------------------------------------------------------------------------------
  6089.     --                Nested Private Definitions
  6090.     -------------------------------------------------------------------------------
  6091.      
  6092.      
  6093.     package body TreePkg is
  6094.     ---------------------------------------------------------------------------
  6095.     --                   Nested Private Definitions
  6096.     ---------------------------------------------------------------------------
  6097.      
  6098.      
  6099.      
  6100.     package body NodeOrder is
  6101.      
  6102.         procedure Free is new unchecked_deallocation (Cell, List);
  6103.      
  6104.     --------------------------------------------------------------------------
  6105.      
  6106.        function Last (L: in     List) return List is
  6107.      
  6108.            Place_In_L:        List;
  6109.            Temp_Place_In_L:   List;
  6110.      
  6111.        --|  Link down the list L and return the pointer to the last element
  6112.        --| of L.  If L is null raise the EmptyList exception.
  6113.      
  6114.        begin
  6115.            if L = null then
  6116.                raise EmptyList;
  6117.            else
  6118.      
  6119.                --|  Link down L saving the pointer to the previous element in
  6120.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  6121.                --|  points to the last element in the list.
  6122.      
  6123.                Place_In_L := L;
  6124.                while Place_In_L /= null loop
  6125.                    Temp_Place_In_L := Place_In_L;
  6126.                    Place_In_L := Place_In_L.Next;
  6127.                end loop;
  6128.                return Temp_Place_In_L;
  6129.            end if;
  6130.         end Last;
  6131.      
  6132.      
  6133.     --------------------------------------------------------------------------
  6134.      
  6135.         procedure Attach (List1: in out List;
  6136.                           List2: in     List ) is
  6137.             EndOfList1: List;
  6138.      
  6139.         --| Attach List2 to List1.
  6140.         --| If List1 is null return List2
  6141.         --| If List1 equals List2 then raise CircularList
  6142.         --| Otherwise get the pointer to the last element of List1 and change
  6143.         --| its Next field to be List2.
  6144.      
  6145.         begin
  6146.             if List1 = null then
  6147.                 List1 := List2;
  6148.                 return;
  6149.             elsif List1 = List2 then
  6150.                 raise CircularList;
  6151.             else
  6152.                 EndOfList1 := Last (List1);
  6153.                 EndOfList1.Next := List2;
  6154.             end if;
  6155.         end Attach;
  6156.      
  6157.     --------------------------------------------------------------------------
  6158.      
  6159.        procedure Attach (L:       in out List;
  6160.                          Element: in     Tree ) is
  6161.      
  6162.            NewEnd:    List;
  6163.      
  6164.        --| Create a list containing Element and attach it to the end of L
  6165.      
  6166.        begin
  6167.            NewEnd := new Cell'(Info => Element, Next => null);
  6168.            Attach (L, NewEnd);
  6169.        end;
  6170.      
  6171.     --------------------------------------------------------------------------
  6172.      
  6173.        function Attach (Element1: in   Tree;
  6174.                         Element2: in   Tree ) return List is
  6175.            NewList: List;
  6176.      
  6177.        --| Create a new list containing the information in Element1 and
  6178.        --| attach Element2 to that list.
  6179.      
  6180.        begin
  6181.            NewList := new Cell'(Info => Element1, Next => null);
  6182.            Attach (NewList, Element2);
  6183.            return NewList;
  6184.        end;
  6185.      
  6186.     --------------------------------------------------------------------------
  6187.      
  6188.        procedure Attach (Element: in     Tree;
  6189.                          L:       in out List      ) is
  6190.      
  6191.        --|  Create a new cell whose information is Element and whose Next
  6192.        --|  field is the list L.  This prepends Element to the List L.
  6193.      
  6194.        begin
  6195.            L := new Cell'(Info => Element, Next => L);
  6196.        end;
  6197.      
  6198.     --------------------------------------------------------------------------
  6199.      
  6200.        function Attach ( List1: in    List;
  6201.                          List2: in    List   ) return List is
  6202.      
  6203.        Last_Of_List1: List;
  6204.      
  6205.        begin
  6206.            if List1 = null then
  6207.                return List2;
  6208.            elsif List1 = List2 then
  6209.                raise CircularList;
  6210.            else
  6211.                Last_Of_List1 := Last (List1);
  6212.                Last_Of_List1.Next := List2;
  6213.                return List1;
  6214.            end if;
  6215.        end  Attach;
  6216.      
  6217.     -------------------------------------------------------------------------
  6218.      
  6219.        function Attach( L:       in     List;
  6220.                         Element: in     Tree ) return List is
  6221.      
  6222.        NewEnd: List;
  6223.        Last_Of_L: List;
  6224.      
  6225.        --| Create a list called NewEnd and attach it to the end of L.
  6226.        --| If L is null return NewEnd
  6227.        --| Otherwise get the last element in L and make its Next field
  6228.        --| NewEnd.
  6229.      
  6230.        begin
  6231.            NewEnd := new Cell'(Info => Element, Next => null);
  6232.            if L = null then
  6233.                return NewEnd;
  6234.            else
  6235.                Last_Of_L := Last (L);
  6236.                Last_Of_L.Next := NewEnd;
  6237.                return L;
  6238.            end if;
  6239.        end Attach;
  6240.      
  6241.     --------------------------------------------------------------------------
  6242.      
  6243.        function Attach (Element: in     Tree;
  6244.                         L:       in     List        ) return List is
  6245.      
  6246.        begin
  6247.            return (new Cell'(Info => Element, Next => L));
  6248.        end Attach;
  6249.      
  6250.     --------------------------------------------------------------------------
  6251.      
  6252.        function Copy (L: in     List) return List is
  6253.      
  6254.        --| If L is null return null
  6255.        --| Otherwise recursively copy the list by first copying the information
  6256.        --| at the head of the list and then making the Next field point to
  6257.        --| a copy of the tail of the list.
  6258.      
  6259.        begin
  6260.            if L = null then
  6261.                return null;
  6262.            else
  6263.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  6264.            end if;
  6265.        end Copy;
  6266.      
  6267.      
  6268.     --------------------------------------------------------------------------
  6269.      
  6270.         function Create return List is
  6271.      
  6272.         --| Return the empty list.
  6273.      
  6274.         begin
  6275.             return null;
  6276.         end Create;
  6277.      
  6278.     --------------------------------------------------------------------------
  6279.      
  6280.        procedure DeleteHead (L: in out List) is
  6281.      
  6282.            TempList: List;
  6283.      
  6284.        --| Remove the element of the head of the list and return it to the heap.
  6285.        --| If L is null EmptyList.
  6286.        --| Otherwise save the Next field of the first element, remove the first
  6287.        --| element and then assign to L the Next field of the first element.
  6288.      
  6289.        begin
  6290.            if L = null then
  6291.                raise EmptyList;
  6292.            else
  6293.                TempList := L.Next;
  6294.                Free (L);
  6295.                L := TempList;
  6296.            end if;
  6297.        end DeleteHead;
  6298.      
  6299.     --------------------------------------------------------------------------
  6300.      
  6301.        procedure DeleteItem (L:       in out List;
  6302.                              Element: in     Tree ) is
  6303.      
  6304.            Temp_L  :List;
  6305.      
  6306.        --| Remove the first element in the list with the value Element.
  6307.        --| If the first element of the list is equal to element then
  6308.        --| remove it.  Otherwise, recurse on the tail of the list.
  6309.      
  6310.        begin
  6311.            if L.Info = Element then
  6312.                DeleteHead(L);
  6313.            else
  6314.                DeleteItem(L.Next, Element);
  6315.            end if;
  6316.        exception
  6317.            when constraint_error =>
  6318.                raise ItemNotPresent;
  6319.        end DeleteItem;
  6320.      
  6321.     --------------------------------------------------------------------------
  6322.      
  6323.        procedure DeleteItems (L:       in out List;
  6324.                               Element: in     Tree ) is
  6325.      
  6326.            Place_In_L       :List;     --| Current place in L.
  6327.            Last_Place_In_L  :List;     --| Last place in L.
  6328.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  6329.            Found            :boolean := false;  --| Indicates if an element with
  6330.                                                 --| the correct value was found.
  6331.      
  6332.        --| Walk over the list removing all elements with the value Element.
  6333.      
  6334.        begin
  6335.            Place_In_L := L;
  6336.            Last_Place_In_L := null;
  6337.            while (Place_In_L /= null) loop
  6338.      
  6339.                --| Found an element equal to Element
  6340.      
  6341.                if Place_In_L.Info = Element then
  6342.                     Found := true;
  6343.      
  6344.                     --| If Last_Place_In_L is null then we are at first element
  6345.                     --| in L.
  6346.      
  6347.                     if Last_Place_In_L = null then
  6348.                          Temp_Place_In_L := Place_In_L;
  6349.                          L := Place_In_L.Next;
  6350.                     else
  6351.                          Temp_Place_In_L := Place_In_L;
  6352.      
  6353.                          --| Relink the list Last's Next gets Place's Next
  6354.      
  6355.                          Last_Place_In_L.Next := Place_In_L.Next;
  6356.                     end if;
  6357.      
  6358.                     --| Move Place_In_L to the next position in the list.
  6359.                     --| Free the element.
  6360.                     --| Do not update the last element in the list it remains the
  6361.                     --| same.
  6362.      
  6363.                     Place_In_L := Place_In_L.Next;
  6364.                     Free (Temp_Place_In_L);
  6365.                else
  6366.                     --| Update the last place in L and the place in L.
  6367.      
  6368.                     Last_Place_In_L := Place_In_L;
  6369.                     Place_In_L := Place_In_L.Next;
  6370.                end if;
  6371.            end loop;
  6372.      
  6373.        --| If we have not found an element raise an exception.
  6374.      
  6375.        if not Found then
  6376.           raise ItemNotPresent;
  6377.        end if;
  6378.      
  6379.        end DeleteItems;
  6380.      
  6381.     --------------------------------------------------------------------------
  6382.      
  6383.        procedure Destroy (L: in out List) is
  6384.      
  6385.            Place_In_L:  List;
  6386.            HoldPlace:   List;
  6387.      
  6388.        --| Walk down the list removing all the elements and set the list to
  6389.        --| the empty list.
  6390.      
  6391.        begin
  6392.            Place_In_L := L;
  6393.            while Place_In_L /= null loop
  6394.                HoldPlace := Place_In_L;
  6395.                Place_In_L := Place_In_L.Next;
  6396.                Free (HoldPlace);
  6397.            end loop;
  6398.            L := null;
  6399.        end Destroy;
  6400.      
  6401.     --------------------------------------------------------------------------
  6402.      
  6403.        function FirstValue (L: in    List) return Tree is
  6404.      
  6405.        --| Return the first value in the list.
  6406.      
  6407.        begin
  6408.            if L = null then
  6409.                raise EmptyList;
  6410.            else
  6411.                return (L.Info);
  6412.            end if;
  6413.        end FirstValue;
  6414.      
  6415.     --------------------------------------------------------------------------
  6416.      
  6417.        procedure Forword (I: in out ListIter) is
  6418.      
  6419.            --| Return the pointer to the next member of the list.
  6420.            Temp_L :List;
  6421.        begin
  6422.            Temp_L := List (I);
  6423.            I := ListIter (Temp_L.Next);
  6424.        end Forword;
  6425.      
  6426.     --------------------------------------------------------------------------
  6427.      
  6428.        function IsInList (L:       in    List;
  6429.                           Element: in    Tree  ) return boolean is
  6430.      
  6431.        Place_In_L: List;
  6432.      
  6433.        --| Check if Element is in L.  If it is return true otherwise return false.
  6434.      
  6435.        begin
  6436.            Place_In_L := L;
  6437.            while Place_In_L /= null loop
  6438.                if Place_In_L.Info = Element then
  6439.                    return true;
  6440.                end if;
  6441.                Place_In_L := Place_In_L.Next;
  6442.             end loop;
  6443.             return false;
  6444.        end IsInList;
  6445.      
  6446.     --------------------------------------------------------------------------
  6447.      
  6448.         function IsEmpty (L: in     List) return boolean is
  6449.      
  6450.         --| Is the list L empty.
  6451.      
  6452.         begin
  6453.             return (L = null);
  6454.         end IsEmpty;
  6455.      
  6456.     --------------------------------------------------------------------------
  6457.      
  6458.        function LastValue (L: in     List) return Tree is
  6459.      
  6460.            LastElement: List;
  6461.      
  6462.        --| Return the value of the last element of the list. Get the pointer
  6463.        --| to the last element of L and then return its information.
  6464.      
  6465.        begin
  6466.            LastElement := Last (L);
  6467.            return LastElement.Info;
  6468.        end LastValue;
  6469.      
  6470.     --------------------------------------------------------------------------
  6471.      
  6472.        function Length (L: in     List) return integer is
  6473.      
  6474.        --| Recursively compute the length of L.  The length of a list is
  6475.        --| 0 if it is null or  1 + the length of the tail.
  6476.      
  6477.        begin
  6478.            if L = null then
  6479.                return (0);
  6480.            else
  6481.                return (1 + Length (Tail (L)));
  6482.            end if;
  6483.        end Length;
  6484.      
  6485.     --------------------------------------------------------------------------
  6486.      
  6487.        function MakeListIter (L: in     List) return ListIter is
  6488.      
  6489.        --| Start an iteration operation on the list L.  Do a type conversion
  6490.        --| from List to ListIter.
  6491.      
  6492.        begin
  6493.            return ListIter (L);
  6494.        end MakeListIter;
  6495.      
  6496.     --------------------------------------------------------------------------
  6497.      
  6498.        function More (L: in     ListIter) return boolean is
  6499.      
  6500.        --| This is a test to see whether an iteration is complete.
  6501.      
  6502.        begin
  6503.            return L /= null;
  6504.        end;
  6505.      
  6506.     --------------------------------------------------------------------------
  6507.      
  6508.        procedure Next (Place:   in out ListIter;
  6509.                        Info:       out Tree ) is
  6510.            PlaceInList: List;
  6511.      
  6512.        --| This procedure gets the information at the current place in the List
  6513.        --| and moves the ListIter to the next postion in the list.
  6514.        --| If we are at the end of a list then exception NoMore is raised.
  6515.      
  6516.        begin
  6517.            if Place = null then
  6518.               raise NoMore;
  6519.            else
  6520.               PlaceInList := List(Place);
  6521.               Info := PlaceInList.Info;
  6522.               Place := ListIter(PlaceInList.Next);
  6523.            end if;
  6524.        end Next;
  6525.      
  6526.     --------------------------------------------------------------------------
  6527.      
  6528.        procedure ReplaceHead (L:    in out  List;
  6529.                               Info: in      Tree ) is
  6530.      
  6531.        --| This procedure replaces the information at the head of a list
  6532.        --| with the given information. If the list is empty the exception
  6533.        --| EmptyList is raised.
  6534.      
  6535.        begin
  6536.            if L = null then
  6537.                raise EmptyList;
  6538.            else
  6539.                L.Info := Info;
  6540.            end if;
  6541.        end ReplaceHead;
  6542.      
  6543.     --------------------------------------------------------------------------
  6544.      
  6545.        procedure ReplaceTail (L:        in out List;
  6546.                               NewTail:  in     List  ) is
  6547.            Temp_L: List;
  6548.      
  6549.        --| This destroys the tail of a list and replaces the tail with
  6550.        --| NewTail.  If L is empty EmptyList is raised.
  6551.      
  6552.        begin
  6553.            Destroy(L.Next);
  6554.            L.Next := NewTail;
  6555.        exception
  6556.            when constraint_error =>
  6557.                raise EmptyList;
  6558.        end ReplaceTail;
  6559.      
  6560.     --------------------------------------------------------------------------
  6561.      
  6562.         function Tail (L: in    List) return List is
  6563.      
  6564.         --| This returns the list which is the tail of L.  If L is null Empty
  6565.         --| List is raised.
  6566.      
  6567.         begin
  6568.             if L = null then
  6569.                 raise EmptyList;
  6570.             else
  6571.                 return L.Next;
  6572.             end if;
  6573.         end Tail;
  6574.      
  6575.     --------------------------------------------------------------------------
  6576.         function Equal (List1: in    List;
  6577.                         List2: in    List ) return boolean is
  6578.      
  6579.             PlaceInList1: List;
  6580.             PlaceInList2: List;
  6581.             Contents1:    Tree;
  6582.             Contents2:    Tree;
  6583.      
  6584.         --| This function tests to see if two lists are equal.  Two lists
  6585.         --| are equal if for all the elements of List1 the corresponding
  6586.         --| element of List2 has the same value.  Thus if the 1st elements
  6587.         --| are equal and the second elements are equal and so up to n.
  6588.         --|  Thus a necessary condition for two lists to be equal is that
  6589.         --| they have the same number of elements.
  6590.      
  6591.      
  6592.         --| This function walks over the two list and checks that the
  6593.         --| corresponding elements are equal.  As soon as we reach
  6594.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  6595.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  6596.         --| then the lists are equal.  If they both are not null the lists aren't
  6597.         --| equal.  Note that equality on elements is based on a user supplied
  6598.         --| function Equal which is used to test for item equality.
  6599.      
  6600.         begin
  6601.             PlaceInList1 := List1;
  6602.             PlaceInList2 := List2;
  6603.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  6604.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  6605.                     return false;
  6606.                 end if;
  6607.                 PlaceInList1 := PlaceInList1.Next;
  6608.                 PlaceInList2 := PlaceInList2.Next;
  6609.             end loop;
  6610.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  6611.         end Equal;
  6612.     end NodeOrder;
  6613.      
  6614.     --------------------------------------------------------------------------
  6615.      
  6616.     ----------------------------------------------------------------------------
  6617.     --                   Local Subprograms
  6618.     ----------------------------------------------------------------------------
  6619.      
  6620.     procedure Free is new unchecked_deallocation (Node, Tree);
  6621.      
  6622.     function equal (X, Y: in Member) return boolean is
  6623.      
  6624.     begin
  6625.      
  6626.         return (not (X < Y))  and  (not  (Y < X));
  6627.     end;
  6628.      
  6629.     ------------------------------------------------------------------------------
  6630.      
  6631.     function Generate (T :in Tree ) return  Nodeorder.List is
  6632.         L : Nodeorder.List;
  6633.      
  6634.     --| This routine generates a list of pointers to nodes in the tree t.
  6635.     --| The list is ordered with respect to the order of the nodes in the tree.
  6636.      
  6637.     --| generate does a depth first search of the tree.
  6638.     --| 1.   It first visits the leftchild of t and generates the list for that.
  6639.     --| 2.   It then appends the root node of t to the list generated for the left
  6640.     --|      child.
  6641.     --| 3.   It then appends the list generated for the rightchild to the list
  6642.     --|      generated for the leftchild and the root.
  6643.     --|
  6644.      
  6645.     begin
  6646.         L := NodeOrder.Create;
  6647.         if T /= null then
  6648.            L := Generate (T.Leftchild);
  6649.            Nodeorder.Attach (L, T);
  6650.            Nodeorder.Attach (L, Generate (T.Rightchild));
  6651.         end if;
  6652.         return L;
  6653.     End Generate;
  6654.      
  6655.     ------------------------------------------------------------------------------
  6656.      
  6657.      
  6658.      
  6659.     ------------------------------------------------------------------------------
  6660.     --                    Visible Subprograms
  6661.     ------------------------------------------------------------------------------
  6662.      
  6663.      
  6664.      
  6665.      
  6666.      
  6667.     ------------------------------------------------------------------------------
  6668.      
  6669.     function Create  return Tree is
  6670.      
  6671.     begin
  6672.         return null;
  6673.     end;
  6674.      
  6675.     -----------------------------------------------------------------------------
  6676.      
  6677.     procedure Deposit (
  6678.               I :in      Member;
  6679.               S :in      Tree         ) is
  6680.      
  6681.     begin
  6682.         S.Info := I;
  6683.     end;
  6684.      
  6685.     ------------------------------------------------------------------------------
  6686.      
  6687.     procedure DestroyTree ( T :in out Tree) is
  6688.      
  6689.     --| This procedure recursively destroys the tree T.
  6690.     --|  1.  It destroy the leftchild of T
  6691.     --|  2.  It then destroys the rightchild of T.
  6692.     --|  3.  It then destroy the root T and set T to be null.
  6693.      
  6694.     begin
  6695.         if T /= null then
  6696.             DestroyTree (T.leftchild);
  6697.             DestroyTree (T.rightchild);
  6698.             Free (T);
  6699.         end if;
  6700.     end DestroyTree;
  6701.      
  6702.     ------------------------------------------------------------------------------
  6703.      
  6704.     procedure InsertNode (
  6705.             N           :in out Member;    --| Node being inserted.
  6706.             T           :in out Tree;        --| Tree node is being inserted
  6707.                                              --| into.
  6708.             Root        :   out Tree;        --| Root of the subtree which node N
  6709.                                              --| heads.  This is the position of
  6710.                                              --| node N in T;
  6711.             Exists      :   out boolean      --| If this node already exists in
  6712.                                              --| the tree then Exists is true. If
  6713.                                              --| If this is the first insertion
  6714.                                              --| Exists is false.
  6715.      
  6716.                                                                            ) is
  6717.     --| This inserts the node N in T.
  6718.     --| 1.  If T is null then a new node is allocated and assigned to T
  6719.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  6720.     --|     This is first done by checking whether N < rightchild
  6721.     --| 3.  If this is not true then we check to see if leftchild < N
  6722.     --| 4.  If this is not true then N is in the tree.
  6723.      
  6724.     begin
  6725.         if T = null then
  6726.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  6727.             Root := T;
  6728.             Exists := false;
  6729.             N := T.Info;
  6730.         elsif N < T.Info then
  6731.             InsertNode (N, T.leftchild, Root, Exists);
  6732.         elsif T.Info < N then
  6733.             InsertNode (N, T.rightchild, Root, Exists);
  6734.         else
  6735.             Root := T;
  6736.             Exists := true;
  6737.             N := T.Info;
  6738.      
  6739.         end if;
  6740.     end InsertNode;
  6741.      
  6742.     ------------------------------------------------------------------------------
  6743.      
  6744.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  6745.      
  6746.         I :TreeIter;
  6747.     --| This sets up the iterator for a tree T.
  6748.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  6749.     --| is computed by first invoking Generate of the leftchild then append
  6750.     --| the root node to NodeList and then append the result of Generate
  6751.     --| to NodeList.  Since the tree is ordered such that
  6752.     --|
  6753.     --|    leftchild < root    root < rightchild
  6754.     --|
  6755.     --| NodeOrder returns the nodes in ascending order.
  6756.     --|
  6757.     --| Thus NodeList keeps the list alive for the duration of the iteration
  6758.     --| operation.  The variable State is the a pointer into the NodeList
  6759.     --| which is the current place of the iteration.
  6760.      
  6761.     begin
  6762.         I.NodeList := NodeOrder.Create;
  6763.         if T /= null then
  6764.             I.NodeList := Generate (T.leftchild);
  6765.             NodeOrder.Attach (I.NodeList, T);
  6766.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  6767.         end if;
  6768.         I.State := NodeOrder.MakeListIter (I.NodeList);
  6769.         return I;
  6770.     end;
  6771.      
  6772.     ------------------------------------------------------------------------------
  6773.      
  6774.     function More (I :in TreeIter) return boolean is
  6775.      
  6776.     begin
  6777.         return NodeOrder.More (I.State);
  6778.     end;
  6779.      
  6780.     ------------------------------------------------------------------------------
  6781.      
  6782.     procedure Next (
  6783.               I    :in out TreeIter;
  6784.               Info :   out Member       ) is
  6785.       T: Tree;
  6786.      
  6787.     --| Next returns the information at the current position in the iterator
  6788.     --| and increments the iterator.  This is accomplished by using the iterater
  6789.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  6790.     --| and then the information found at this node in T is returned.
  6791.      
  6792.      
  6793.     begin
  6794.         NodeOrder.Next (I.State, T);
  6795.         Info := T.Info;
  6796.     end;
  6797.      
  6798.     -------------------------------------------------------------------------------
  6799.      
  6800.     end TreePkg;
  6801.      
  6802.      
  6803.     -------------------------------------------------------------------------------
  6804.     --                Local Subprograms
  6805.     -------------------------------------------------------------------------------
  6806.      
  6807.     -------------------------------------------------------------------------------
  6808.      
  6809.     function "<" (     --| Implements "<" for the type member.
  6810.              X :in   Member;
  6811.              Y :in   Member
  6812.     ) return boolean is
  6813.      
  6814.     begin
  6815.          return X.Info < Y.Info;
  6816.     end;
  6817.      
  6818.     -------------------------------------------------------------------------------
  6819.      
  6820.      
  6821.     -------------------------------------------------------------------------------
  6822.     --               Visible Subprograms
  6823.     -------------------------------------------------------------------------------
  6824.      
  6825.      
  6826.     -------------------------------------------------------------------------------
  6827.      
  6828.     function Cardinality (
  6829.                   S :in Set  --| The set whose size is being computed.
  6830.     ) return natural is
  6831.      
  6832.         T        :TreePkg.TreeIter;
  6833.         M        :Member;
  6834.         count    :natural := 0;
  6835.     begin
  6836.         T := TreePkg.MakeTreeIter (S.SetRep);
  6837.         while TreePkg.More (T) loop
  6838.             TreePkg.Next (T, M);
  6839.             count := count + 1;
  6840.         end loop;
  6841.         return count;
  6842.     end Cardinality;
  6843.      
  6844.     -------------------------------------------------------------------------------
  6845.      
  6846.     function Create
  6847.      
  6848.     return Set is
  6849.         S :Set;
  6850.     begin
  6851.         S.SetRep := TreePkg.Create;
  6852.         return S;
  6853.     end Create;
  6854.      
  6855.     ------------------------------------------------------------------------------
  6856.      
  6857.     procedure Destroy (
  6858.              S :in out Set
  6859.     ) is
  6860.      
  6861.     begin
  6862.         TreePkg.DestroyTree (S.SetRep);
  6863.     end Destroy;
  6864.      
  6865.     -----------------------------------------------------------------------------
  6866.      
  6867.     function GetCount (
  6868.              I :in    SetIter
  6869.     ) return natural is
  6870.      
  6871.     begin
  6872.          return I.Count;
  6873.     end;
  6874.      
  6875.     -----------------------------------------------------------------------------
  6876.     procedure Insert(
  6877.               M :in     Source_Text.Locator;
  6878.               S :in out Set
  6879.     ) is
  6880.         Subtree       :TreePkg.Tree;
  6881.         Exists        :boolean;
  6882.         MemberToEnter :Member := ( Info => M, count => 1);
  6883.     begin
  6884.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  6885.         --| Exists comes back true and then M's count is updated.  Since the
  6886.         --| first argument of TreePkg.Insert is in out, after Insert
  6887.         --| MemberToEnter has the value stored in the tree.  Thus if we
  6888.         --| need to update the count we can simple bump the count in MemberToEnter.
  6889.      
  6890.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  6891.         if Exists then
  6892.             MemberToEnter.Count := MemberToEnter.Count + 1;
  6893.             TreePkg.Deposit (MemberToEnter, SubTree);
  6894.         end if;
  6895.     end Insert;
  6896.      
  6897.     ------------------------------------------------------------------------------
  6898.      
  6899.     function MakeSetIter (
  6900.              S :in Set
  6901.     )        return SetIter is
  6902.      
  6903.         I :SetIter;
  6904.     begin
  6905.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  6906.         I.Count := 0;
  6907.         return I;
  6908.     end;
  6909.      
  6910.      ------------------------------------------------------------------------------
  6911.      
  6912.     function More (
  6913.               I :in     SetIter
  6914.     )         return boolean is
  6915.      
  6916.     begin
  6917.         return TreePkg.More (I.Place);
  6918.     end;
  6919.      
  6920.     ------------------------------------------------------------------------------
  6921.      
  6922.     procedure Next (
  6923.              I :in out SetIter;
  6924.              M :   out Source_Text.Locator
  6925.     ) is
  6926.         TempMember :Member;
  6927.     begin
  6928.         TreePkg.Next (I.Place, TempMember);
  6929.         M := TempMember.Info;
  6930.         I.Count := TempMember.Count;
  6931.     end;
  6932.      
  6933.     ------------------------------------------------------------------------------
  6934.      
  6935.     end Literal_Set;
  6936.      
  6937.      
  6938.      
  6939.      
  6940.      
  6941.      
  6942.     package body DEF_ID_Set is
  6943.      
  6944.     ------------------------------------------------------------------------------
  6945.     --                Nested Private Definitions
  6946.     -------------------------------------------------------------------------------
  6947.      
  6948.      
  6949.     package body TreePkg is
  6950.     ---------------------------------------------------------------------------
  6951.     --                   Nested Private Definitions
  6952.     ---------------------------------------------------------------------------
  6953.      
  6954.      
  6955.      
  6956.     package body NodeOrder is
  6957.      
  6958.         procedure Free is new unchecked_deallocation (Cell, List);
  6959.      
  6960.     --------------------------------------------------------------------------
  6961.      
  6962.        function Last (L: in     List) return List is
  6963.      
  6964.            Place_In_L:        List;
  6965.            Temp_Place_In_L:   List;
  6966.      
  6967.        --|  Link down the list L and return the pointer to the last element
  6968.        --| of L.  If L is null raise the EmptyList exception.
  6969.      
  6970.        begin
  6971.            if L = null then
  6972.                raise EmptyList;
  6973.            else
  6974.      
  6975.                --|  Link down L saving the pointer to the previous element in
  6976.                --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  6977.                --|  points to the last element in the list.
  6978.      
  6979.                Place_In_L := L;
  6980.                while Place_In_L /= null loop
  6981.                    Temp_Place_In_L := Place_In_L;
  6982.                    Place_In_L := Place_In_L.Next;
  6983.                end loop;
  6984.                return Temp_Place_In_L;
  6985.            end if;
  6986.         end Last;
  6987.      
  6988.      
  6989.     --------------------------------------------------------------------------
  6990.      
  6991.         procedure Attach (List1: in out List;
  6992.                           List2: in     List ) is
  6993.             EndOfList1: List;
  6994.      
  6995.         --| Attach List2 to List1.
  6996.         --| If List1 is null return List2
  6997.         --| If List1 equals List2 then raise CircularList
  6998.         --| Otherwise get the pointer to the last element of List1 and change
  6999.         --| its Next field to be List2.
  7000.      
  7001.         begin
  7002.             if List1 = null then
  7003.                 List1 := List2;
  7004.                 return;
  7005.             elsif List1 = List2 then
  7006.                 raise CircularList;
  7007.             else
  7008.                 EndOfList1 := Last (List1);
  7009.                 EndOfList1.Next := List2;
  7010.             end if;
  7011.         end Attach;
  7012.      
  7013.     --------------------------------------------------------------------------
  7014.      
  7015.        procedure Attach (L:       in out List;
  7016.                          Element: in     Tree ) is
  7017.      
  7018.            NewEnd:    List;
  7019.      
  7020.        --| Create a list containing Element and attach it to the end of L
  7021.      
  7022.        begin
  7023.            NewEnd := new Cell'(Info => Element, Next => null);
  7024.            Attach (L, NewEnd);
  7025.        end;
  7026.      
  7027.     --------------------------------------------------------------------------
  7028.      
  7029.        function Attach (Element1: in   Tree;
  7030.                         Element2: in   Tree ) return List is
  7031.            NewList: List;
  7032.      
  7033.        --| Create a new list containing the information in Element1 and
  7034.        --| attach Element2 to that list.
  7035.      
  7036.        begin
  7037.            NewList := new Cell'(Info => Element1, Next => null);
  7038.            Attach (NewList, Element2);
  7039.            return NewList;
  7040.        end;
  7041.      
  7042.     --------------------------------------------------------------------------
  7043.      
  7044.        procedure Attach (Element: in     Tree;
  7045.                          L:       in out List      ) is
  7046.      
  7047.        --|  Create a new cell whose information is Element and whose Next
  7048.        --|  field is the list L.  This prepends Element to the List L.
  7049.      
  7050.        begin
  7051.            L := new Cell'(Info => Element, Next => L);
  7052.        end;
  7053.      
  7054.     --------------------------------------------------------------------------
  7055.      
  7056.        function Attach ( List1: in    List;
  7057.                          List2: in    List   ) return List is
  7058.      
  7059.        Last_Of_List1: List;
  7060.      
  7061.        begin
  7062.            if List1 = null then
  7063.                return List2;
  7064.            elsif List1 = List2 then
  7065.                raise CircularList;
  7066.            else
  7067.                Last_Of_List1 := Last (List1);
  7068.                Last_Of_List1.Next := List2;
  7069.                return List1;
  7070.            end if;
  7071.        end  Attach;
  7072.      
  7073.     -------------------------------------------------------------------------
  7074.      
  7075.        function Attach( L:       in     List;
  7076.                         Element: in     Tree ) return List is
  7077.      
  7078.        NewEnd: List;
  7079.        Last_Of_L: List;
  7080.      
  7081.        --| Create a list called NewEnd and attach it to the end of L.
  7082.        --| If L is null return NewEnd
  7083.        --| Otherwise get the last element in L and make its Next field
  7084.        --| NewEnd.
  7085.      
  7086.        begin
  7087.            NewEnd := new Cell'(Info => Element, Next => null);
  7088.            if L = null then
  7089.                return NewEnd;
  7090.            else
  7091.                Last_Of_L := Last (L);
  7092.                Last_Of_L.Next := NewEnd;
  7093.                return L;
  7094.            end if;
  7095.        end Attach;
  7096.      
  7097.     --------------------------------------------------------------------------
  7098.      
  7099.        function Attach (Element: in     Tree;
  7100.                         L:       in     List        ) return List is
  7101.      
  7102.        begin
  7103.            return (new Cell'(Info => Element, Next => L));
  7104.        end Attach;
  7105.      
  7106.     --------------------------------------------------------------------------
  7107.      
  7108.        function Copy (L: in     List) return List is
  7109.      
  7110.        --| If L is null return null
  7111.        --| Otherwise recursively copy the list by first copying the information
  7112.        --| at the head of the list and then making the Next field point to
  7113.        --| a copy of the tail of the list.
  7114.      
  7115.        begin
  7116.            if L = null then
  7117.                return null;
  7118.            else
  7119.                return new Cell'(Info => L.Info, Next => Copy (L.Next));
  7120.            end if;
  7121.        end Copy;
  7122.      
  7123.      
  7124.     --------------------------------------------------------------------------
  7125.      
  7126.         function Create return List is
  7127.      
  7128.         --| Return the empty list.
  7129.      
  7130.         begin
  7131.             return null;
  7132.         end Create;
  7133.      
  7134.     --------------------------------------------------------------------------
  7135.      
  7136.        procedure DeleteHead (L: in out List) is
  7137.      
  7138.            TempList: List;
  7139.      
  7140.        --| Remove the element of the head of the list and return it to the heap.
  7141.        --| If L is null EmptyList.
  7142.        --| Otherwise save the Next field of the first element, remove the first
  7143.        --| element and then assign to L the Next field of the first element.
  7144.      
  7145.        begin
  7146.            if L = null then
  7147.                raise EmptyList;
  7148.            else
  7149.                TempList := L.Next;
  7150.                Free (L);
  7151.                L := TempList;
  7152.            end if;
  7153.        end DeleteHead;
  7154.      
  7155.     --------------------------------------------------------------------------
  7156.      
  7157.        procedure DeleteItem (L:       in out List;
  7158.                              Element: in     Tree ) is
  7159.      
  7160.            Temp_L  :List;
  7161.      
  7162.        --| Remove the first element in the list with the value Element.
  7163.        --| If the first element of the list is equal to element then
  7164.        --| remove it.  Otherwise, recurse on the tail of the list.
  7165.      
  7166.        begin
  7167.            if L.Info = Element then
  7168.                DeleteHead(L);
  7169.            else
  7170.                DeleteItem(L.Next, Element);
  7171.            end if;
  7172.        exception
  7173.            when constraint_error =>
  7174.                raise ItemNotPresent;
  7175.        end DeleteItem;
  7176.      
  7177.     --------------------------------------------------------------------------
  7178.      
  7179.        procedure DeleteItems (L:       in out List;
  7180.                               Element: in     Tree ) is
  7181.      
  7182.            Place_In_L       :List;     --| Current place in L.
  7183.            Last_Place_In_L  :List;     --| Last place in L.
  7184.            Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  7185.            Found            :boolean := false;  --| Indicates if an element with
  7186.                                                 --| the correct value was found.
  7187.      
  7188.        --| Walk over the list removing all elements with the value Element.
  7189.      
  7190.        begin
  7191.            Place_In_L := L;
  7192.            Last_Place_In_L := null;
  7193.            while (Place_In_L /= null) loop
  7194.      
  7195.                --| Found an element equal to Element
  7196.      
  7197.                if Place_In_L.Info = Element then
  7198.                     Found := true;
  7199.      
  7200.                     --| If Last_Place_In_L is null then we are at first element
  7201.                     --| in L.
  7202.      
  7203.                     if Last_Place_In_L = null then
  7204.                          Temp_Place_In_L := Place_In_L;
  7205.                          L := Place_In_L.Next;
  7206.                     else
  7207.                          Temp_Place_In_L := Place_In_L;
  7208.      
  7209.                          --| Relink the list Last's Next gets Place's Next
  7210.      
  7211.                          Last_Place_In_L.Next := Place_In_L.Next;
  7212.                     end if;
  7213.      
  7214.                     --| Move Place_In_L to the next position in the list.
  7215.                     --| Free the element.
  7216.                     --| Do not update the last element in the list it remains the
  7217.                     --| same.
  7218.      
  7219.                     Place_In_L := Place_In_L.Next;
  7220.                     Free (Temp_Place_In_L);
  7221.                else
  7222.                     --| Update the last place in L and the place in L.
  7223.      
  7224.                     Last_Place_In_L := Place_In_L;
  7225.                     Place_In_L := Place_In_L.Next;
  7226.                end if;
  7227.            end loop;
  7228.      
  7229.        --| If we have not found an element raise an exception.
  7230.      
  7231.        if not Found then
  7232.           raise ItemNotPresent;
  7233.        end if;
  7234.      
  7235.        end DeleteItems;
  7236.      
  7237.     --------------------------------------------------------------------------
  7238.      
  7239.        procedure Destroy (L: in out List) is
  7240.      
  7241.            Place_In_L:  List;
  7242.            HoldPlace:   List;
  7243.      
  7244.        --| Walk down the list removing all the elements and set the list to
  7245.        --| the empty list.
  7246.      
  7247.        begin
  7248.            Place_In_L := L;
  7249.            while Place_In_L /= null loop
  7250.                HoldPlace := Place_In_L;
  7251.                Place_In_L := Place_In_L.Next;
  7252.                Free (HoldPlace);
  7253.            end loop;
  7254.            L := null;
  7255.        end Destroy;
  7256.      
  7257.     --------------------------------------------------------------------------
  7258.      
  7259.        function FirstValue (L: in    List) return Tree is
  7260.      
  7261.        --| Return the first value in the list.
  7262.      
  7263.        begin
  7264.            if L = null then
  7265.                raise EmptyList;
  7266.            else
  7267.                return (L.Info);
  7268.            end if;
  7269.        end FirstValue;
  7270.      
  7271.     --------------------------------------------------------------------------
  7272.      
  7273.        procedure Forword (I: in out ListIter) is
  7274.      
  7275.        --| Return the pointer to the next member of the list.
  7276.            Temp_L :List;
  7277.        begin
  7278.            Temp_L := List (I);
  7279.            I := ListIter (Temp_L.Next);
  7280.        end Forword;
  7281.      
  7282.     --------------------------------------------------------------------------
  7283.      
  7284.        function IsInList (L:       in    List;
  7285.                           Element: in    Tree  ) return boolean is
  7286.      
  7287.        Place_In_L: List;
  7288.      
  7289.        --| Check if Element is in L.  If it is return true otherwise return false.
  7290.      
  7291.        begin
  7292.            Place_In_L := L;
  7293.            while Place_In_L /= null loop
  7294.                if Place_In_L.Info = Element then
  7295.                    return true;
  7296.                end if;
  7297.                Place_In_L := Place_In_L.Next;
  7298.             end loop;
  7299.             return false;
  7300.        end IsInList;
  7301.      
  7302.     --------------------------------------------------------------------------
  7303.      
  7304.         function IsEmpty (L: in     List) return boolean is
  7305.      
  7306.         --| Is the list L empty.
  7307.      
  7308.         begin
  7309.             return (L = null);
  7310.         end IsEmpty;
  7311.      
  7312.     --------------------------------------------------------------------------
  7313.      
  7314.        function LastValue (L: in     List) return Tree is
  7315.      
  7316.            LastElement: List;
  7317.      
  7318.        --| Return the value of the last element of the list. Get the pointer
  7319.        --| to the last element of L and then return its information.
  7320.      
  7321.        begin
  7322.            LastElement := Last (L);
  7323.            return LastElement.Info;
  7324.        end LastValue;
  7325.      
  7326.     --------------------------------------------------------------------------
  7327.      
  7328.        function Length (L: in     List) return integer is
  7329.      
  7330.        --| Recursively compute the length of L.  The length of a list is
  7331.        --| 0 if it is null or  1 + the length of the tail.
  7332.      
  7333.        begin
  7334.            if L = null then
  7335.                return (0);
  7336.            else
  7337.                return (1 + Length (Tail (L)));
  7338.            end if;
  7339.        end Length;
  7340.      
  7341.     --------------------------------------------------------------------------
  7342.      
  7343.        function MakeListIter (L: in     List) return ListIter is
  7344.      
  7345.        --| Start an iteration operation on the list L.  Do a type conversion
  7346.        --| from List to ListIter.
  7347.      
  7348.        begin
  7349.            return ListIter (L);
  7350.        end MakeListIter;
  7351.      
  7352.     --------------------------------------------------------------------------
  7353.      
  7354.        function More (L: in     ListIter) return boolean is
  7355.      
  7356.        --| This is a test to see whether an iteration is complete.
  7357.      
  7358.        begin
  7359.            return L /= null;
  7360.        end;
  7361.      
  7362.     --------------------------------------------------------------------------
  7363.      
  7364.        procedure Next (Place:   in out ListIter;
  7365.                        Info:       out Tree ) is
  7366.            PlaceInList: List;
  7367.      
  7368.        --| This procedure gets the information at the current place in the List
  7369.        --| and moves the ListIter to the next postion in the list.
  7370.        --| If we are at the end of a list then exception NoMore is raised.
  7371.      
  7372.        begin
  7373.            if Place = null then
  7374.               raise NoMore;
  7375.            else
  7376.               PlaceInList := List(Place);
  7377.               Info := PlaceInList.Info;
  7378.               Place := ListIter(PlaceInList.Next);
  7379.            end if;
  7380.        end Next;
  7381.      
  7382.     --------------------------------------------------------------------------
  7383.      
  7384.        procedure ReplaceHead (L:    in out  List;
  7385.                               Info: in      Tree ) is
  7386.      
  7387.        --| This procedure replaces the information at the head of a list
  7388.        --| with the given information. If the list is empty the exception
  7389.        --| EmptyList is raised.
  7390.      
  7391.        begin
  7392.            if L = null then
  7393.                raise EmptyList;
  7394.            else
  7395.                L.Info := Info;
  7396.            end if;
  7397.        end ReplaceHead;
  7398.      
  7399.     --------------------------------------------------------------------------
  7400.      
  7401.        procedure ReplaceTail (L:        in out List;
  7402.                               NewTail:  in     List  ) is
  7403.            Temp_L: List;
  7404.      
  7405.        --| This destroys the tail of a list and replaces the tail with
  7406.        --| NewTail.  If L is empty EmptyList is raised.
  7407.      
  7408.        begin
  7409.            Destroy(L.Next);
  7410.            L.Next := NewTail;
  7411.        exception
  7412.            when constraint_error =>
  7413.                raise EmptyList;
  7414.        end ReplaceTail;
  7415.      
  7416.     --------------------------------------------------------------------------
  7417.      
  7418.         function Tail (L: in    List) return List is
  7419.      
  7420.         --| This returns the list which is the tail of L.  If L is null Empty
  7421.         --| List is raised.
  7422.      
  7423.         begin
  7424.             if L = null then
  7425.                 raise EmptyList;
  7426.             else
  7427.                 return L.Next;
  7428.             end if;
  7429.         end Tail;
  7430.      
  7431.     --------------------------------------------------------------------------
  7432.         function Equal (List1: in    List;
  7433.                         List2: in    List ) return boolean is
  7434.      
  7435.             PlaceInList1: List;
  7436.             PlaceInList2: List;
  7437.             Contents1:    Tree;
  7438.             Contents2:    Tree;
  7439.      
  7440.         --| This function tests to see if two lists are equal.  Two lists
  7441.         --| are equal if for all the elements of List1 the corresponding
  7442.         --| element of List2 has the same value.  Thus if the 1st elements
  7443.         --| are equal and the second elements are equal and so up to n.
  7444.         --|  Thus a necessary condition for two lists to be equal is that
  7445.         --| they have the same number of elements.
  7446.      
  7447.      
  7448.         --| This function walks over the two list and checks that the
  7449.         --| corresponding elements are equal.  As soon as we reach
  7450.         --| the end of a list (PlaceInList = null) we fall out of the loop.
  7451.         --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  7452.         --| then the lists are equal.  If they both are not null the lists aren't
  7453.         --| equal.  Note that equality on elements is based on a user supplied
  7454.         --| function Equal which is used to test for item equality.
  7455.      
  7456.         begin
  7457.             PlaceInList1 := List1;
  7458.             PlaceInList2 := List2;
  7459.             while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  7460.                 if  PlaceInList1.Info /= PlaceInList2.Info then
  7461.                     return false;
  7462.                 end if;
  7463.                 PlaceInList1 := PlaceInList1.Next;
  7464.                 PlaceInList2 := PlaceInList2.Next;
  7465.             end loop;
  7466.             return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  7467.         end Equal;
  7468.     end NodeOrder;
  7469.      
  7470.     --------------------------------------------------------------------------
  7471.      
  7472.     ----------------------------------------------------------------------------
  7473.     --                   Local Subprograms
  7474.     ----------------------------------------------------------------------------
  7475.      
  7476.     procedure Free is new unchecked_deallocation (Node, Tree);
  7477.      
  7478.     function equal (X, Y: in Member) return boolean is
  7479.      
  7480.     begin
  7481.      
  7482.         return (not (X < Y))  and  (not  (Y < X));
  7483.     end;
  7484.      
  7485.     ------------------------------------------------------------------------------
  7486.      
  7487.     function Generate (T :in Tree ) return  Nodeorder.List is
  7488.         L : Nodeorder.List;
  7489.      
  7490.     --| This routine generates a list of pointers to nodes in the tree t.
  7491.     --| The list is ordered with respect to the order of the nodes in the tree.
  7492.      
  7493.     --| generate does a depth first search of the tree.
  7494.     --| 1.   It first visits the leftchild of t and generates the list for that.
  7495.     --| 2.   It then appends the root node of t to the list generated for the left
  7496.     --|      child.
  7497.     --| 3.   It then appends the list generated for the rightchild to the list
  7498.     --|      generated for the leftchild and the root.
  7499.     --|
  7500.      
  7501.     begin
  7502.         L := NodeOrder.Create;
  7503.         if T /= null then
  7504.            L := Generate (T.Leftchild);
  7505.            Nodeorder.Attach (L, T);
  7506.            Nodeorder.Attach (L, Generate (T.Rightchild));
  7507.         end if;
  7508.         return L;
  7509.     end Generate;
  7510.      
  7511.     ------------------------------------------------------------------------------
  7512.      
  7513.      
  7514.      
  7515.     ------------------------------------------------------------------------------
  7516.     --                    Visible Subprograms
  7517.     ------------------------------------------------------------------------------
  7518.      
  7519.      
  7520.      
  7521.      
  7522.      
  7523.     ------------------------------------------------------------------------------
  7524.      
  7525.     function Create  return Tree is
  7526.      
  7527.     begin
  7528.         return null;
  7529.     end;
  7530.      
  7531.     -----------------------------------------------------------------------------
  7532.      
  7533.     procedure Deposit (
  7534.               I :in      Member;
  7535.               S :in      Tree         ) is
  7536.      
  7537.     begin
  7538.         S.Info := I;
  7539.     end;
  7540.      
  7541.     ------------------------------------------------------------------------------
  7542.      
  7543.     procedure DestroyTree ( T :in out Tree) is
  7544.      
  7545.     --| This procedure recursively destroys the tree T.
  7546.     --|  1.  It destroy the leftchild of T
  7547.     --|  2.  It then destroys the rightchild of T.
  7548.     --|  3.  It then destroy the root T and set T to be null.
  7549.      
  7550.     begin
  7551.         if T /= null then
  7552.             DestroyTree (T.leftchild);
  7553.             DestroyTree (T.rightchild);
  7554.             Free (T);
  7555.         end if;
  7556.     end DestroyTree;
  7557.      
  7558.     ------------------------------------------------------------------------------
  7559.      
  7560.     procedure InsertNode (
  7561.             N           :in out Member;    --| Node being inserted.
  7562.             T           :in out Tree;        --| Tree node is being inserted
  7563.                                              --| into.
  7564.             Root        :   out Tree;        --| Root of the subtree which node N
  7565.                                              --| heads.  This is the position of
  7566.                                              --| node N in T;
  7567.             Exists      :   out boolean      --| If this node already exists in
  7568.                                              --| the tree then Exists is true. If
  7569.                                              --| If this is the first insertion
  7570.                                              --| Exists is false.
  7571.      
  7572.                                                                            ) is
  7573.     --| This inserts the node N in T.
  7574.     --| 1.  If T is null then a new node is allocated and assigned to T
  7575.     --| 2.  If T is not null then T is searched for the proper place to insert n.
  7576.     --|     This is first done by checking whether N < rightchild
  7577.     --| 3.  If this is not true then we check to see if leftchild < N
  7578.     --| 4.  If this is not true then N is in the tree.
  7579.      
  7580.     begin
  7581.         if T = null then
  7582.             T := new Node ' (Info => N, leftchild => null, rightchild => null);
  7583.             Root := T;
  7584.             Exists := false;
  7585.             N := T.Info;
  7586.         elsif N < T.Info then
  7587.             InsertNode (N, T.leftchild, Root, Exists);
  7588.         elsif T.Info < N then
  7589.             InsertNode (N, T.rightchild, Root, Exists);
  7590.         else
  7591.             Root := T;
  7592.             Exists := true;
  7593.             N := T.Info;
  7594.      
  7595.         end if;
  7596.     end InsertNode;
  7597.      
  7598.     ------------------------------------------------------------------------------
  7599.      
  7600.     function MakeTreeIter (T :in     Tree ) return TreeIter is
  7601.      
  7602.         I :TreeIter;
  7603.     --| This sets up the iterator for a tree T.
  7604.     --| The NodeList keeps track of the order of the nodes of T.  The NodeList
  7605.     --| is computed by first invoking Generate of the leftchild then append
  7606.     --| the root node to NodeList and then append the result of Generate
  7607.     --| to NodeList.  Since the tree is ordered such that
  7608.     --|
  7609.     --|    leftchild < root    root < rightchild
  7610.     --|
  7611.     --| NodeOrder returns the nodes in ascending order.
  7612.     --|
  7613.     --| Thus NodeList keeps the list alive for the duration of the iteration
  7614.     --| operation.  The variable State is the a pointer into the NodeList
  7615.     --| which is the current place of the iteration.
  7616.      
  7617.     begin
  7618.         I.NodeList := NodeOrder.Create;
  7619.         if T /= null then
  7620.             I.NodeList := Generate (T.leftchild);
  7621.             NodeOrder.Attach (I.NodeList, T);
  7622.             NodeOrder.Attach (I.NodeList, Generate (T.rightChild));
  7623.         end if;
  7624.         I.State := NodeOrder.MakeListIter (I.NodeList);
  7625.         return I;
  7626.     end;
  7627.      
  7628.     ------------------------------------------------------------------------------
  7629.      
  7630.     function More (I :in TreeIter) return boolean is
  7631.      
  7632.     begin
  7633.         return NodeOrder.More (I.State);
  7634.     end;
  7635.      
  7636.     ------------------------------------------------------------------------------
  7637.      
  7638.     procedure Next (
  7639.               I    :in out TreeIter;
  7640.               Info :   out Member       ) is
  7641.       T: Tree;
  7642.      
  7643.     --| Next returns the information at the current position in the iterator
  7644.     --| and increments the iterator.  This is accomplished by using the iterater
  7645.     --| associated with the NodeOrder list.  This returns a pointer into the Tree
  7646.     --| and then the information found at this node in T is returned.
  7647.      
  7648.      
  7649.     begin
  7650.         NodeOrder.Next (I.State, T);
  7651.         Info := T.Info;
  7652.     end;
  7653.      
  7654.     -------------------------------------------------------------------------------
  7655.      
  7656.     end TreePkg;
  7657.      
  7658.      
  7659.     -------------------------------------------------------------------------------
  7660.     --                Local Subprograms
  7661.     -------------------------------------------------------------------------------
  7662.      
  7663.     -------------------------------------------------------------------------------
  7664.      
  7665.     function "<" (     --| Implements "<" for the type member.
  7666.              X :in   Member;
  7667.              Y :in   Member
  7668.     ) return boolean is
  7669.      
  7670.     begin
  7671.          return X.Info < Y.Info;
  7672.     end;
  7673.      
  7674.     -------------------------------------------------------------------------------
  7675.      
  7676.      
  7677.     -------------------------------------------------------------------------------
  7678.     --               Visible Subprograms
  7679.     -------------------------------------------------------------------------------
  7680.      
  7681.      
  7682.     -------------------------------------------------------------------------------
  7683.      
  7684.     function Cardinality (
  7685.                   S :in Set  --| The set whose size is being computed.
  7686.     ) return natural is
  7687.      
  7688.         T        :TreePkg.TreeIter;
  7689.         M        :Member;
  7690.         count    :natural := 0;
  7691.     begin
  7692.         T := TreePkg.MakeTreeIter (S.SetRep);
  7693.         while TreePkg.More (T) loop
  7694.             TreePkg.Next (T, M);
  7695.             count := count + 1;
  7696.         end loop;
  7697.         return count;
  7698.     end Cardinality;
  7699.      
  7700.     -------------------------------------------------------------------------------
  7701.      
  7702.     function Create
  7703.      
  7704.     return Set is
  7705.         S :Set;
  7706.     begin
  7707.         S.SetRep := TreePkg.Create;
  7708.         return S;
  7709.     end Create;
  7710.      
  7711.     ------------------------------------------------------------------------------
  7712.      
  7713.     procedure Destroy (
  7714.              S :in out Set
  7715.     ) is
  7716.      
  7717.     begin
  7718.         TreePkg.DestroyTree (S.SetRep);
  7719.     end Destroy;
  7720.      
  7721.     -----------------------------------------------------------------------------
  7722.      
  7723.     function GetCount (
  7724.              I :in    SetIter
  7725.     ) return natural is
  7726.      
  7727.     begin
  7728.          return I.Count;
  7729.     end;
  7730.      
  7731.     -----------------------------------------------------------------------------
  7732.     procedure Insert(
  7733.               M :in     DEF_ID.Locator;
  7734.               S :in out Set
  7735.     ) is
  7736.         Subtree       :TreePkg.Tree;
  7737.         Exists        :boolean;
  7738.         MemberToEnter :Member := ( Info => M, count => 1);
  7739.     begin
  7740.         --| If NewMember doesn't exist in SetRep it is added.  If it does exist
  7741.         --| Exists comes back true and then M's count is updated.  Since the
  7742.         --| first argument of TreePkg.Insert is in out, after Insert
  7743.         --| MemberToEnter has the value stored in the tree.  Thus if we
  7744.         --| need to update the count we can simple bump the count in MemberToEnter.
  7745.      
  7746.         TreePkg.InsertNode (MemberToEnter, S.SetRep, SubTree, Exists);
  7747.         if Exists then
  7748.             MemberToEnter.Count := MemberToEnter.Count + 1;
  7749.             TreePkg.Deposit (MemberToEnter, SubTree);
  7750.         end if;
  7751.     end Insert;
  7752.      
  7753.     ------------------------------------------------------------------------------
  7754.      
  7755.     function MakeSetIter (
  7756.              S :in Set
  7757.     )        return SetIter is
  7758.      
  7759.         I :SetIter;
  7760.     begin
  7761.         I.Place := TreePkg.MakeTreeIter (S.SetRep);
  7762.         I.Count := 0;
  7763.         return I;
  7764.     end;
  7765.      
  7766.      ------------------------------------------------------------------------------
  7767.      
  7768.     function More (
  7769.               I :in     SetIter
  7770.     )         return boolean is
  7771.      
  7772.     begin
  7773.         return TreePkg.More (I.Place);
  7774.     end;
  7775.      
  7776.     ------------------------------------------------------------------------------
  7777.      
  7778.     procedure Next (
  7779.              I :in out SetIter;
  7780.              M :   out DEF_ID.Locator
  7781.     ) is
  7782.         TempMember :Member;
  7783.     begin
  7784.         TreePkg.Next (I.Place, TempMember);
  7785.         M := TempMember.Info;
  7786.         I.Count := TempMember.Count;
  7787.     end;
  7788.      
  7789.     ------------------------------------------------------------------------------
  7790.      
  7791.     end DEF_ID_Set;
  7792.      
  7793.      
  7794.      
  7795.      
  7796.      
  7797.     package body BlockInfoStack is
  7798.      
  7799.      
  7800.         use Lists;
  7801.      
  7802.      
  7803.      
  7804.         function create
  7805.             return stack is
  7806.         begin
  7807.             return new stack_rec'(size => 0, elts => create);
  7808.         end create;
  7809.      
  7810.         procedure push(s: in out stack;
  7811.                        e:        BlockInfoType) is
  7812.         begin
  7813.             s.size := s.size + 1;
  7814.             s.elts := attach(e, s.elts);
  7815.         exception
  7816.             when constraint_error =>
  7817.                 raise uninitialized_stack;
  7818.         end push;
  7819.      
  7820.         procedure pop(s: in out stack) is
  7821.         begin
  7822.             DeleteHead(s.elts);
  7823.             s.size := s.size - 1;
  7824.         exception
  7825.             when EmptyList =>
  7826.                 raise empty_stack;
  7827.             when constraint_error =>
  7828.                 raise uninitialized_stack;
  7829.         end pop;
  7830.      
  7831.         procedure pop(s: in out stack;
  7832.                       e: out    BlockInfoType) is
  7833.         begin
  7834.             e := FirstValue(s.elts);
  7835.             DeleteHead(s.elts);
  7836.             s.size := s.size - 1;
  7837.         exception
  7838.             when EmptyList =>
  7839.                 raise empty_stack;
  7840.             when constraint_error =>
  7841.                 raise uninitialized_stack;
  7842.         end pop;
  7843.      
  7844.         function copy(s: stack)
  7845.             return stack is
  7846.         begin
  7847.             if s = null then raise uninitialized_stack; end if;
  7848.      
  7849.             return new stack_rec'(size => s.size,
  7850.                                   elts => copy(s.elts));
  7851.         end;
  7852.      
  7853.      
  7854.      
  7855.         function top(s: stack)
  7856.             return BlockInfoType is
  7857.         begin
  7858.             return FirstValue(s.elts);
  7859.         exception
  7860.             when EmptyList =>
  7861.                 raise empty_stack;
  7862.             when constraint_error =>
  7863.                 raise uninitialized_stack;
  7864.         end top;
  7865.      
  7866.         function size(s: stack)
  7867.             return natural is
  7868.         begin
  7869.             return s.size;
  7870.         exception
  7871.             when constraint_error =>
  7872.                 raise uninitialized_stack;
  7873.         end size;
  7874.      
  7875.         function is_empty(s: stack)
  7876.             return boolean is
  7877.         begin
  7878.             return s.size = 0;
  7879.         exception
  7880.             when constraint_error =>
  7881.                 raise uninitialized_stack;
  7882.         end is_empty;
  7883.      
  7884.      
  7885.      
  7886.         procedure destroy(s: in out stack) is
  7887.             procedure free_stack is
  7888.                 new unchecked_deallocation(stack_rec, stack);
  7889.         begin
  7890.             destroy(s.elts);
  7891.             free_stack(s);
  7892.         exception
  7893.             when constraint_error =>    -- stack is null
  7894.                 return;
  7895.         end destroy;
  7896.      
  7897.         package body Lists is
  7898.      
  7899.             procedure Free is new unchecked_deallocation (Cell, List);
  7900.      
  7901.      
  7902.            function Last (L: in     List) return List is
  7903.      
  7904.                Place_In_L:        List;
  7905.                Temp_Place_In_L:   List;
  7906.      
  7907.      
  7908.            begin
  7909.                if L = null then
  7910.                    raise EmptyList;
  7911.                else
  7912.      
  7913.                    --|  Link down L saving the pointer to the previous element in
  7914.                    --|  Temp_Place_In_L.  After the last iteration Temp_Place_In_L
  7915.                    --|  points to the last element in the list.
  7916.      
  7917.                    Place_In_L := L;
  7918.                    while Place_In_L /= null loop
  7919.                        Temp_Place_In_L := Place_In_L;
  7920.                        Place_In_L := Place_In_L.Next;
  7921.                    end loop;
  7922.                    return Temp_Place_In_L;
  7923.                end if;
  7924.             end Last;
  7925.      
  7926.      
  7927.      
  7928.             procedure Attach (List1: in out List;
  7929.                               List2: in     List ) is
  7930.                 EndOfList1: List;
  7931.      
  7932.             --| Attach List2 to List1.
  7933.             --| If List1 is null return List2
  7934.             --| If List1 equals List2 then raise CircularList
  7935.             --| Otherwise get the pointer to the last element of List1 and change
  7936.             --| its Next field to be List2.
  7937.      
  7938.             begin
  7939.                 if List1 = null then
  7940.                     List1 := List2;
  7941.                     return;
  7942.                 elsif List1 = List2 then
  7943.                     raise CircularList;
  7944.                 else
  7945.                     EndOfList1 := Last (List1);
  7946.                     EndOfList1.Next := List2;
  7947.                 end if;
  7948.             end Attach;
  7949.      
  7950.      
  7951.            procedure Attach (L:       in out List;
  7952.                              Element: in     BlockInfoType ) is
  7953.      
  7954.                NewEnd:    List;
  7955.      
  7956.      
  7957.            begin
  7958.                NewEnd := new Cell'(Info => Element, Next => null);
  7959.                Attach (L, NewEnd);
  7960.            end;
  7961.      
  7962.      
  7963.            function Attach (Element1: in   BlockInfoType;
  7964.                             Element2: in   BlockInfoType ) return List is
  7965.                NewList: List;
  7966.      
  7967.      
  7968.            begin
  7969.                NewList := new Cell'(Info => Element1, Next => null);
  7970.                Attach (NewList, Element2);
  7971.                return NewList;
  7972.            end;
  7973.      
  7974.      
  7975.            procedure Attach (Element: in     BlockInfoType;
  7976.                              L:       in out List      ) is
  7977.      
  7978.      
  7979.            begin
  7980.                L := new Cell'(Info => Element, Next => L);
  7981.            end;
  7982.      
  7983.      
  7984.            function Attach ( List1: in    List;
  7985.                              List2: in    List   ) return List is
  7986.      
  7987.            Last_Of_List1: List;
  7988.      
  7989.            begin
  7990.                if List1 = null then
  7991.                    return List2;
  7992.                elsif List1 = List2 then
  7993.                    raise CircularList;
  7994.                else
  7995.                    Last_Of_List1 := Last (List1);
  7996.                    Last_Of_List1.Next := List2;
  7997.                    return List1;
  7998.                end if;
  7999.            end  Attach;
  8000.      
  8001.      
  8002.            function Attach( L:       in     List;
  8003.                             Element: in     BlockInfoType ) return List is
  8004.      
  8005.            NewEnd: List;
  8006.            Last_Of_L: List;
  8007.      
  8008.      
  8009.            begin
  8010.                NewEnd := new Cell'(Info => Element, Next => null);
  8011.                if L = null then
  8012.                    return NewEnd;
  8013.                else
  8014.                    Last_Of_L := Last (L);
  8015.                    Last_Of_L.Next := NewEnd;
  8016.                    return L;
  8017.                end if;
  8018.            end Attach;
  8019.      
  8020.      
  8021.            function Attach (Element: in     BlockInfoType;
  8022.                             L:       in     List        ) return List is
  8023.      
  8024.            begin
  8025.                return (new Cell'(Info => Element, Next => L));
  8026.            end Attach;
  8027.      
  8028.      
  8029.            function Copy (L: in     List) return List is
  8030.      
  8031.      
  8032.            begin
  8033.                if L = null then
  8034.                    return null;
  8035.                else
  8036.                    return new Cell'(Info => L.Info, Next => Copy (L.Next));
  8037.                end if;
  8038.            end Copy;
  8039.      
  8040.      
  8041.      
  8042.      
  8043.      
  8044.             function Create return List is
  8045.      
  8046.             --| Return the empty list.
  8047.      
  8048.             begin
  8049.                 return null;
  8050.             end Create;
  8051.      
  8052.            procedure DeleteHead (L: in out List) is
  8053.      
  8054.                TempList: List;
  8055.      
  8056.      
  8057.            begin
  8058.                if L = null then
  8059.                    raise EmptyList;
  8060.                else
  8061.                    TempList := L.Next;
  8062.                    Free (L);
  8063.                    L := TempList;
  8064.                end if;
  8065.            end DeleteHead;
  8066.      
  8067.      
  8068.            procedure DeleteItem (L:       in out List;
  8069.                                  Element: in     BlockInfoType ) is
  8070.      
  8071.                Temp_L  :List;
  8072.      
  8073.      
  8074.            begin
  8075.                if L.Info = Element then
  8076.                    DeleteHead(L);
  8077.                else
  8078.                    DeleteItem(L.Next, Element);
  8079.                end if;
  8080.            exception
  8081.                when constraint_error =>
  8082.                    raise ItemNotPresent;
  8083.            end DeleteItem;
  8084.      
  8085.      
  8086.            procedure DeleteItems (L:       in out List;
  8087.                                   Element: in     BlockInfoType ) is
  8088.      
  8089.                Place_In_L       :List;     --| Current place in L.
  8090.                Last_Place_In_L  :List;     --| Last place in L.
  8091.                Temp_Place_In_L  :List;     --| Holds a place in L to be removed.
  8092.                Found            :boolean := false;  --| Indicates if an element with
  8093.                                                     --| the correct value was found.
  8094.      
  8095.      
  8096.            begin
  8097.                Place_In_L := L;
  8098.                Last_Place_In_L := null;
  8099.                while (Place_In_L /= null) loop
  8100.      
  8101.                    --| Found an element equal to Element
  8102.      
  8103.                    if Place_In_L.Info = Element then
  8104.                         Found := true;
  8105.      
  8106.                         --| If Last_Place_In_L is null then we are at first element
  8107.                         --| in L.
  8108.      
  8109.                         if Last_Place_In_L = null then
  8110.                              Temp_Place_In_L := Place_In_L;
  8111.                              L := Place_In_L.Next;
  8112.                         else
  8113.                              Temp_Place_In_L := Place_In_L;
  8114.      
  8115.                              --| Relink the list Last's Next gets Place's Next
  8116.      
  8117.                              Last_Place_In_L.Next := Place_In_L.Next;
  8118.                         end if;
  8119.      
  8120.                         --| Move Place_In_L to the next position in the list.
  8121.                         --| Free the element.
  8122.                         --| Do not update the last element in the list it remains the
  8123.                         --| same.
  8124.      
  8125.                         Place_In_L := Place_In_L.Next;
  8126.                         Free (Temp_Place_In_L);
  8127.                    else
  8128.                         --| Update the last place in L and the place in L.
  8129.      
  8130.                         Last_Place_In_L := Place_In_L;
  8131.                         Place_In_L := Place_In_L.Next;
  8132.                    end if;
  8133.                end loop;
  8134.      
  8135.      
  8136.            if not Found then
  8137.               raise ItemNotPresent;
  8138.            end if;
  8139.      
  8140.            end DeleteItems;
  8141.      
  8142.      
  8143.            procedure Destroy (L: in out List) is
  8144.      
  8145.                Place_In_L:  List;
  8146.                HoldPlace:   List;
  8147.      
  8148.      
  8149.            begin
  8150.                Place_In_L := L;
  8151.                while Place_In_L /= null loop
  8152.                    HoldPlace := Place_In_L;
  8153.                    Place_In_L := Place_In_L.Next;
  8154.                    Free (HoldPlace);
  8155.                end loop;
  8156.                L := null;
  8157.            end Destroy;
  8158.      
  8159.      
  8160.            function FirstValue (L: in    List) return BlockInfoType is
  8161.      
  8162.      
  8163.            begin
  8164.                if L = null then
  8165.                    raise EmptyList;
  8166.                else
  8167.                    return (L.Info);
  8168.                end if;
  8169.            end FirstValue;
  8170.      
  8171.      
  8172.            procedure Forword (I: in out ListIter) is
  8173.      
  8174.                PlaceInList :List;
  8175.            begin
  8176.                PlaceInList := List (I);
  8177.                I := ListIter (PlaceInList.Next);
  8178.            end Forword;
  8179.      
  8180.      
  8181.            function IsInList (L:       in    List;
  8182.                               Element: in    BlockInfoType  ) return boolean is
  8183.      
  8184.            Place_In_L: List;
  8185.      
  8186.      
  8187.            begin
  8188.                Place_In_L := L;
  8189.                while Place_In_L /= null loop
  8190.                    if Place_In_L.Info = Element then
  8191.                        return true;
  8192.                    end if;
  8193.                    Place_In_L := Place_In_L.Next;
  8194.                 end loop;
  8195.                 return false;
  8196.            end IsInList;
  8197.      
  8198.      
  8199.             function IsEmpty (L: in     List) return boolean is
  8200.      
  8201.             --| Is the list L empty.
  8202.      
  8203.             begin
  8204.                 return (L = null);
  8205.             end IsEmpty;
  8206.      
  8207.      
  8208.            function LastValue (L: in     List) return BlockInfoType is
  8209.      
  8210.                LastElement: List;
  8211.      
  8212.      
  8213.            begin
  8214.                LastElement := Last (L);
  8215.                return LastElement.Info;
  8216.            end LastValue;
  8217.      
  8218.      
  8219.            function Length (L: in     List) return integer is
  8220.      
  8221.      
  8222.            begin
  8223.                if L = null then
  8224.                    return (0);
  8225.                else
  8226.                    return (1 + Length (Tail (L)));
  8227.                end if;
  8228.            end Length;
  8229.      
  8230.      
  8231.            function MakeListIter (L: in     List) return ListIter is
  8232.      
  8233.      
  8234.            begin
  8235.                return ListIter (L);
  8236.            end MakeListIter;
  8237.      
  8238.      
  8239.            function More (L: in     ListIter) return boolean is
  8240.      
  8241.      
  8242.            begin
  8243.                return L /= null;
  8244.            end;
  8245.      
  8246.      
  8247.            procedure Next (Place:   in out ListIter;
  8248.                            Info:       out BlockInfoType ) is
  8249.                PlaceInList: List;
  8250.      
  8251.      
  8252.            begin
  8253.                if Place = null then
  8254.                   raise NoMore;
  8255.                else
  8256.                   PlaceInList := List(Place);
  8257.                   Info := PlaceInList.Info;
  8258.                   Place := ListIter(PlaceInList.Next);
  8259.                end if;
  8260.            end Next;
  8261.      
  8262.      
  8263.            procedure ReplaceHead (L:    in out  List;
  8264.                                   Info: in      BlockInfoType ) is
  8265.      
  8266.      
  8267.            begin
  8268.                if L = null then
  8269.                    raise EmptyList;
  8270.                else
  8271.                    L.Info := Info;
  8272.                end if;
  8273.            end ReplaceHead;
  8274.      
  8275.      
  8276.            procedure ReplaceTail (L:        in out List;
  8277.                                   NewTail:  in     List  ) is
  8278.                Temp_L: List;
  8279.      
  8280.      
  8281.            begin
  8282.                Destroy(L.Next);
  8283.                L.Next := NewTail;
  8284.            exception
  8285.                when constraint_error =>
  8286.                    raise EmptyList;
  8287.            end ReplaceTail;
  8288.      
  8289.      
  8290.             function Tail (L: in    List) return List is
  8291.      
  8292.             --| This returns the list which is the tail of L.  If L is null Empty
  8293.             --| List is raised.
  8294.      
  8295.             begin
  8296.                 if L = null then
  8297.                     raise EmptyList;
  8298.                 else
  8299.                     return L.Next;
  8300.                 end if;
  8301.             end Tail;
  8302.      
  8303.             function Equal (List1: in    List;
  8304.                             List2: in    List ) return boolean is
  8305.      
  8306.                 PlaceInList1: List;
  8307.                 PlaceInList2: LIst;
  8308.                 Contents1:    BlockInfoType;
  8309.                 Contents2:    BlockInfoType;
  8310.      
  8311.             --| This function tests to see if two lists are equal.  Two lists
  8312.             --| are equal if for all the elements of List1 the corresponding
  8313.             --| element of List2 has the same value.  Thus if the 1st elements
  8314.             --| are equal and the second elements are equal and so up to n.
  8315.             --|  Thus a necessary condition for two lists to be equal is that
  8316.             --| they have the same number of elements.
  8317.      
  8318.             --| This function walks over the two list and checks that the
  8319.             --| corresponding elements are equal.  As soon as we reach
  8320.             --| the end of a list (PlaceInList = null) we fall out of the loop.
  8321.             --| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
  8322.             --| then the lists are equal.  If they both are not null the lists aren't
  8323.             --| equal.  Note that equality on elements is based on a user supplied
  8324.             --| function Equal which is used to test for item equality.
  8325.      
  8326.             begin
  8327.                 PlaceInList1 := List1;
  8328.                 PlaceInList2 := List2;
  8329.                 while   (PlaceInList1 /= null) and (PlaceInList2 /= null) loop
  8330.                     if not "=" (PlaceInList1.Info, PlaceInList2.Info) then
  8331.                         return false;
  8332.                     end if;
  8333.                     PlaceInList1 := PlaceInList1.Next;
  8334.                     PlaceInList2 := PlaceInList2.Next;
  8335.                 end loop;
  8336.                 return ((PlaceInList1 = null) and (PlaceInList2 = null) );
  8337.             end Equal;
  8338.         end Lists;
  8339.      
  8340.      
  8341.      
  8342.      
  8343.      
  8344.     end BlockInfoStack;
  8345. end Definitions;
  8346. ::::::::::::::
  8347. defs.spc
  8348. ::::::::::::::
  8349. -- $Source: /nosc/work/tools/halstead/RCS/defs.spc,v $
  8350. -- $Revision: 5.7 $ -- $Date: 85/09/04 09:24:19 $ -- $Author: buddy $
  8351. with ST_Diana; use ST_Diana;
  8352. with ML_Source_Position_Pkg;
  8353. package Definitions is
  8354.      
  8355. --| OVERVIEW
  8356. --| This package defines all the data used by the Halstead program.  This
  8357. --| package also defines all the operations on the data types defined.
  8358. --| The following is a list of all the abstract data types which
  8359. --| this package defines.
  8360. --|
  8361. --|
  8362. --|      1. DEF_ID_Set.Set from the package DEF_ID_Set
  8363. --|      2. Literal_Set.Set from the package Literal_Set
  8364. --|      3. BlockInfoStack.Stack from the package BlockInfoStack
  8365. --|
  8366. --| The types defined here are all used to create the BlockInfoType.
  8367. --| BlockInfoType keeps all the information pertaining to current block
  8368. --| being processed.  The type is composed of four components types which
  8369. --| are:
  8370. --|                      1.  TokenCountType
  8371. --|                      2.  BlockIdType
  8372. --|                      3.  Literal_Set.Set
  8373. --|                      4.  DEF_ID_Set.Set
  8374. --|
  8375. --| TokenCountType   keeps track of the number of times each token appears
  8376. --|                  in the source program.
  8377. --|
  8378. --| BlockIdType      maintains the name of the current block being
  8379. --|                  processed, whether the block is a body or a spec, and
  8380. --|                  the type of block whether its a procedure, package...
  8381. --|
  8382. --| Literal_Set      This keeps a counted set of all the literals
  8383. --|                  appearing in a given block.  These literals will be
  8384. --|                  counted as operands.
  8385. --|
  8386. --| DEF_ID_Set.Set   This keeps a list of all the identifiers encounted
  8387. --|                  in a block.  At the end of the block all the
  8388. --|                  identifiers are categorized into operands and
  8389. --|                  operators.
  8390.      
  8391.      
  8392. --| EFFECTS
  8393. --| Associated with the three abstract data types DEF_ID_Set.Set
  8394. --| Literal_Set.Set and BlockInfo.Stack are a complete set of
  8395. --| operations.
  8396. --|
  8397. --| The operations associated with the sets DEF_ID_Set.Set and
  8398. --| Literal_Set.Set are counted sets.  This means that a member in the
  8399. --| set has a count associated with it.  Each time an insert is done
  8400. --| on a member the count for the member is incremented.
  8401. --|
  8402. --| The operations associated with BlockInfoStack are the normal
  8403. --| stack operations Push, Pop and some others.  These operations are
  8404. --| used to stack the information associated with a block.
  8405.      
  8406. --| TUNING
  8407. --| One way to tune this package is to cut out a lot of the functions
  8408. --| which are not used.  For example the users of this package do not
  8409. --| use FirstValue and some of the other operations of the list package.
  8410.      
  8411.      
  8412.     type TokenItem is (
  8413.         abortz,
  8414.         acceptz,
  8415.         accessz,
  8416.         allz,
  8417.         and_thenz,
  8418.         arrayz,
  8419.         atz,
  8420.         beginz,
  8421.         bodyz,
  8422.         body_packagez,
  8423.         body_taskz,
  8424.         casez,
  8425.         case_stmz,
  8426.         case_variantz,
  8427.         constantz,
  8428.         declarez,
  8429.         delayz,
  8430.         deltaz,
  8431.         digitsz,
  8432.         doz,
  8433.         elsez,
  8434.         else_ifz,
  8435.         else_orz,
  8436.         else_selectz,
  8437.         elsifz,
  8438.         endz,
  8439.         end_acceptz,
  8440.         end_beginz,
  8441.         end_case_stmz,
  8442.         end_case_variantz,
  8443.         end_ifz,
  8444.         end_loopz,
  8445.         end_package_bdyz,
  8446.         end_package_spcz,
  8447.         end_recordz,
  8448.         end_record_repz,
  8449.         end_selectz,
  8450.         end_task_spcz,
  8451.         entryz,
  8452.         exceptionz,
  8453.         exitz,
  8454.         forz,
  8455.         for_loopz,
  8456.         for_repz,
  8457.         functionz,
  8458.         genericz,
  8459.         gotoz,
  8460.         ifz,
  8461.         inz,
  8462.         in_loopz,
  8463.         in_membershipz,
  8464.         in_out_parameterz,
  8465.         in_parameterz,
  8466.         isz,
  8467.         is_case_stmz,
  8468.         is_case_variantz,
  8469.         is_functionz,
  8470.         is_genericz,
  8471.         is_package_bdyz,
  8472.         is_package_spcz,
  8473.         is_procedurez,
  8474.         is_separatez,
  8475.         is_subtypez,
  8476.         is_typez,
  8477.         is_task_bdyz,
  8478.         is_task_spcz,
  8479.         limitedz,
  8480.         loopz,
  8481.         modz,
  8482.         newz,
  8483.         new_allocatorz,
  8484.         new_derived_typez,
  8485.         new_generic_instz,
  8486.         not_in_membershipz,
  8487.         nullz,
  8488.         null_valuez,
  8489.         null_stmz,
  8490.         null_fieldz,
  8491.         ofz,
  8492.         orz,
  8493.         or_elsez,
  8494.         or_selectz,
  8495.         othersz,
  8496.         others_aggregatez,
  8497.         others_casez,
  8498.         others_exceptionz,
  8499.         others_variantz,
  8500.         outz,
  8501.         packagez,
  8502.         package_bdyz,
  8503.         package_spcz,
  8504.         pragmaz,
  8505.         privatez,
  8506.         private_sectionz,
  8507.         private_typez,
  8508.         procedurez,
  8509.         raisez,
  8510.         rangez,
  8511.         recordz,
  8512.         record_typez,
  8513.         record_repz,
  8514.         renamesz,
  8515.         returnz,
  8516.         reversez,
  8517.         selectz,
  8518.         separatez,
  8519.         subtypez,
  8520.         taskz,
  8521.         task_bdyz,
  8522.         task_spcz,
  8523.         terminatez,
  8524.         thenz,
  8525.         then_andz,
  8526.         typez,
  8527.         usez,
  8528.         use_contextz,
  8529.         use_repz,
  8530.         whenz,
  8531.         when_case_stmz,
  8532.         when_exitz,
  8533.         when_exceptionz,
  8534.         when_selectz,
  8535.         when_case_variantz,
  8536.         whilez,
  8537.         withz,
  8538.         with_contextz,
  8539.         with_genericz,
  8540.         -------------  punctuation  --------------
  8541.         arrowz,
  8542.         barz,
  8543.         boxz,
  8544.         box_rangez,
  8545.         box_default_subpz,
  8546.         character_literalz,
  8547.         closed_anglesz,
  8548.         closed_parenthesisz,
  8549.         colon_equalsz,
  8550.         colonz,
  8551.         commaz,
  8552.         dotz,
  8553.         dot_dot_rangez,
  8554.         double_quotez,
  8555.         numeric_literalz,
  8556.         open_anglesz,
  8557.         open_parenthesisz,
  8558.         semicolonz,
  8559.         single_quotez,
  8560.         tickz,
  8561.         declare_blockz
  8562.     );
  8563.       --| These are all the tokens which could possibly be counted by
  8564.       --| Halstead.
  8565.      
  8566.     type Class is (operator, operand, neither);
  8567.       --| These are the different ways to classify symbols in the source
  8568.       --| program.
  8569.      
  8570.     type TokenCountType is array(TokenItem) of natural;
  8571.       --| This type is used to count the occurrences of each token
  8572.       --| in the source program.
  8573.      
  8574.     type TokenClassificationType is array(TokenItem) of Class;
  8575.       --| This type is used to defined whether tokens are operators
  8576.       --| or operands or neither.
  8577.      
  8578.     type BlockKind is ( procedure_block,
  8579.                         function_block,
  8580.                         package_body_block,
  8581.                         package_spec_block,
  8582.                         task_body_block,
  8583.                         task_spec_block,
  8584.                         declare_block );
  8585.     --| This keeps track of the type of block being processed currently.
  8586.      
  8587.      
  8588.     BlockNameLength: constant := 16;
  8589.       --| Maximum length of a block name.
  8590.      
  8591.     SpcBdyIdLength: constant := 13;
  8592.       --| Maximum lenght of  a string which indicates whether a block
  8593.       --| is a spec, body, or declare block.
  8594.      
  8595.     subtype SpcBdyIdType is string(1..SpcBdyIdLength);
  8596.      
  8597.     AnonId :constant SpcBdyIdType := "             ";
  8598.     BdyId  :constant SpcBdyIdType := "BODY         ";
  8599.     DecId  :constant SpcBdyIdType := "DECLARE BLOCK";
  8600.     SpcId  :constant SpcBdyIdType := "SPECIFICATION";
  8601.       --| These are used to initialize the SpcOrBdyId field of
  8602.       --| BlockIdType.
  8603.      
  8604.     type StringPtr is access String;
  8605.       --| This is used to keep track of the fully qualified name of the
  8606.       --| block being processed.  Each time a new scope is entered
  8607.       --| the name of that scope is concatenated with the current
  8608.       --| fully qualified name.
  8609.      
  8610.     type BlockIdType is
  8611.        record
  8612.          KindOfBlock   :BlockKind;
  8613.          SpcBdyId      :SpcBdyIdType;
  8614.          BlockName     :StringPtr;
  8615.          LineLocation  :ML_Source_Position_Pkg.Source_Line;
  8616.        end record;
  8617.        --| This type keeps track of the name of a block.  For instance
  8618.        --| if we are processing the body of procedure P then the name
  8619.        --| of the block is P.  The KindOfBlock is "PROCEDURE" and
  8620.        --| SpcOrBdyId = "(B)".
  8621.      
  8622.      
  8623.      
  8624.      
  8625.      
  8626.      
  8627.     --| The following code represents a generic instantiation of the
  8628.     --| OrderedSet package.  It replaces:
  8629.     --|
  8630.     --| package DEF_ID_Set is new OrderedSet
  8631.     --|            (ItemType => DEF_ID.Locator,
  8632.     --|             "<" => ST_Diana.DEF_ID."<");
  8633.      
  8634.      
  8635.     --------------------------------------------------------------------------
  8636.     --               GENERIC INSTANTIATION
  8637.     --------------------------------------------------------------------------
  8638.      
  8639.     function "<" ( X, Y: DEF_ID.Locator) return boolean
  8640.       renames  ST_Diana.DEF_ID."<";
  8641.      
  8642.     package DEF_ID_Set is
  8643.      
  8644.     --| Overview
  8645.     --| This abstractions is a counted ordered set.  This means that
  8646.     --| associated with each member of the set is a count of the number of
  8647.     --| times it appears in the set.  The order part means that there is
  8648.     --| an ordering associated with the members.  This allows fast insertion.
  8649.     --| It also makes it easy to iterate over the set in order.
  8650.      
  8651.      
  8652.      
  8653.     --                    Types
  8654.     --                    -----
  8655.      
  8656.           type Set is private;  --| This is the type exported to represent
  8657.                                 --| the ordered set.
  8658.      
  8659.           type SetIter is private;  --| This is the type exported whose
  8660.                                     --| purpose is to walk over a set.
  8661.      
  8662.      
  8663.     --                   Operations
  8664.     --                   ----------
  8665.      
  8666.     --| Cardinality              Returns cardinality of the set.
  8667.     --| Create                   Creates the empty set.
  8668.     --| CountMember              Returns the number of times the member appears in
  8669.     --|                          the set.
  8670.     --| Destroy                  Destroys a set and returns the space it occupies.
  8671.     --| Insert                   Insert a member into  the set.
  8672.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  8673.     --| More                     Are there more elements to iterate over in the
  8674.     --|                          set.
  8675.     --| Next                     Return the next element in the iteration and
  8676.     --|                          bump the iterator.
  8677.      
  8678.      
  8679.     ------------------------------------------------------------------------------
  8680.      
  8681.     function Cardinality (   --| Return the number of members in the set.
  8682.              S     :in Set   --| The set whose members are being counted.
  8683.     ) return natural;
  8684.      
  8685.     ------------------------------------------------------------------------------
  8686.      
  8687.      
  8688.     function Create   --| Return the empty set.
  8689.     return Set;
  8690.      
  8691.     ------------------------------------------------------------------------------
  8692.      
  8693.     procedure Destroy (        --| Destroy a set and return its space.
  8694.               S   :in out Set  --| Set being destroyed.
  8695.      
  8696.     );
  8697.      
  8698.     ------------------------------------------------------------------------------
  8699.      
  8700.     function GetCount (            --| This returns the count associated with
  8701.                                    --| member which corresponds to the current
  8702.                                    --| iterator I.
  8703.              I :in     SetIter
  8704.     ) return natural;
  8705.      
  8706.     -----------------------------------------------------------------------------
  8707.      
  8708.     procedure Insert (             --| Insert a member M into set S.
  8709.              M :in     DEF_ID.Locator;   --| Member being inserted.
  8710.              S :in out Set         --| Set being inserted into.
  8711.     );
  8712.      
  8713.     ------------------------------------------------------------------------------
  8714.      
  8715.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  8716.                                 --| by returning a SetIter.
  8717.              S :in     Set     --| Set being iterate over.
  8718.     ) return SetIter;
  8719.      
  8720.     ------------------------------------------------------------------------------
  8721.      
  8722.     function More (             --| Returns true if there are more elements in the
  8723.                                 --| set to iterate over.
  8724.              I :in    SetIter   --| The iterator.
  8725.      
  8726.     ) return boolean;
  8727.      
  8728.     ------------------------------------------------------------------------------
  8729.      
  8730.     procedure Next (              --| Returns the current member in the iteration
  8731.                                   --| an increments the iterator.
  8732.              I :in out SetIter;   --| The iterator.
  8733.              M :   out DEF_ID.Locator   --| The current member being returned.
  8734.     );
  8735.      
  8736.     -----------------------------------------------------------------------------
  8737.      
  8738.     private
  8739.      
  8740.        type Member is
  8741.            record
  8742.              Info   :DEF_ID.Locator;
  8743.              Count  :natural;
  8744.            end record;
  8745.      
  8746.        function "<" (
  8747.                 X:in    Member;
  8748.                 Y:in    Member
  8749.        ) return boolean;
  8750.      
  8751.        -- generic instantiation
  8752.        --package TreePkg is new BinaryTrees ( DEF_ID.Locator => Member, "<" => "<" );
  8753.      
  8754.      
  8755.     package TreePkg is
  8756.      
  8757.      
  8758.     --| Overview
  8759.     --| This package creates an ordered binary tree.  This will allow for
  8760.     --| quick insertion, and search.
  8761.     --|
  8762.     --| The tree is organized such that
  8763.     --|
  8764.     --|  leftchild < root    root < rightchild
  8765.     --|
  8766.     --| This means that by doing a left to right search of the tree will can
  8767.     --| produce the nodes of the tree in ascending order.
  8768.      
  8769.      
  8770.      
  8771.      
  8772.      
  8773.     --                             Types
  8774.     --                             -----
  8775.      
  8776.     type Tree is  private;     --| This is the type exported to represent the
  8777.                                --| tree.
  8778.      
  8779.      
  8780.     type TreeIter is private;  --| This is the type which is used to iterate
  8781.                                --| over the set.
  8782.      
  8783.     --|                          Exceptions
  8784.     --|                          ----------
  8785.      
  8786.     --|                          Operations
  8787.     --|                          ----------
  8788.     --|
  8789.     --| Create           Creates a tree.
  8790.     --| Deposit          Replaces the given node's information with
  8791.     --|                  the given information.
  8792.     --| DestroyTree      Destroys the given tree and returns the spaces.
  8793.     --| InsertNode       This inserts a node n into a tree t.
  8794.     --| MakeTreeIter     This returns an iterator to the user in order to start
  8795.     --|                  an iteration.
  8796.     --| More             This returns true if there are more elements to iterate
  8797.     --|                  over in the tree.
  8798.     --| Next             This returns the information associated with the current
  8799.     --|                  iterator and advances the iterator.
  8800.      
  8801.      
  8802.     ---------------------------------------------------------------------------
  8803.      
  8804.     function Create             --| This function creates the tree.
  8805.      
  8806.     return Tree;
  8807.      
  8808.     --| Effects
  8809.     --| This creates a tree containing no information and no children.  An
  8810.     --| emptytree.
  8811.      
  8812.     -------------------------------------------------------------------------------
  8813.      
  8814.     procedure Deposit (              --| This deposits the information I in the
  8815.                                      --| root of the Tree S.
  8816.               I :in     Member;    --| The information being deposited.
  8817.               S :in     Tree         --| The tree where the information is being
  8818.                                      --| stored.
  8819.     );
  8820.      
  8821.     --| Modifies
  8822.     --| This changes the information stored at the root of the tree S.
  8823.      
  8824.     -------------------------------------------------------------------------------
  8825.      
  8826.      
  8827.     procedure DestroyTree (         --| Destroys a tree.
  8828.               T  :in out Tree       --| Tree being destroyed.
  8829.     );
  8830.      
  8831.     --| Effects
  8832.     --| Destroys a tree and returns the space which it is occupying.
  8833.      
  8834.     --------------------------------------------------------------------------
  8835.      
  8836.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  8837.                                     --| Specified Tree.
  8838.            N      :In Out Member; --| The Information To Be Contained In The
  8839.                                     --| Node Being Inserted.
  8840.      
  8841.            T      :In Out Tree;     --| Tree Being Inserted Into.
  8842.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  8843.                                     --| This is the position of the node N in T.
  8844.            Exists :   out boolean   --| If this node already exists in the tree
  8845.                                     --| Exists is true.  If this is the first
  8846.                                     --| insertion Exists is false.
  8847.     );
  8848.      
  8849.     --| Effects
  8850.     --| This adds the node N to the tree T inserting in the proper postion.
  8851.      
  8852.     --| Modifies
  8853.     --| This modifies the tree T by add the node N to it.
  8854.      
  8855.     ------------------------------------------------------------------------------
  8856.      
  8857.     function MakeTreeIter (         --| Sets a variable to a position in the
  8858.                                     --| tree
  8859.                                     --| where the iteration is to begin.  In this
  8860.                                     --| case the position is a pointer to the
  8861.                                     --| the deepest leftmost leaf in the tree.
  8862.             T:in Tree               --| Tree being iterated over
  8863.     ) return TreeIter;
  8864.      
  8865.      
  8866.     --| Effects
  8867.      
  8868.      
  8869.     -----------------------------------------------------------------------------
  8870.      
  8871.     function More (                 --| Returns true if there are more elements
  8872.                                     --| in the tree to iterate over.
  8873.               I :in TreeIter
  8874.     ) return boolean;
  8875.      
  8876.      
  8877.     -----------------------------------------------------------------------------
  8878.      
  8879.     procedure Next (                --| This is the iterator operation.  Given
  8880.                                     --| an Iter in the Tree it returns the
  8881.                                     --| item Iter points to and updates the
  8882.                                     --| iter. If Iter is at the end of the Tree,
  8883.                                     --| yielditer returns false otherwise it
  8884.                                     --| returns true.
  8885.         I        :in out TreeIter;  --| The iter which marks the position in the
  8886.                                     --| Tree.
  8887.      
  8888.         Info     :   out Member   --| Information being returned from a node.
  8889.     );
  8890.      
  8891.      
  8892.     ---------------------------------------------------------------------------
  8893.      
  8894.     private
  8895.      
  8896.        type Node;
  8897.        type Tree is access Node;
  8898.      
  8899.        type Node is
  8900.             record
  8901.                 Info           :Member;
  8902.                 LeftChild      :Tree;
  8903.                 RightChild     :Tree;
  8904.             end record;
  8905.      
  8906.     ---   The following is a generic instantiation of NodeOrder
  8907.     ---   package NodeOrder is new Lists (Tree);
  8908.      
  8909.      
  8910.     package NodeOrder is
  8911.      
  8912.     --| This package provides singly linked lists with elements of type
  8913.     --| Tree, where Tree is specified by a generic parameter.
  8914.      
  8915.     --| Overview
  8916.     --| When this package is instantiated, it provides a linked list type for
  8917.     --| lists of objects of type Tree, which can be any desired type.  A
  8918.     --| complete set of operations for manipulation, and releasing
  8919.     --| those lists is also provided.  For instance, to make lists of strings,
  8920.     --| all that is necessary is:
  8921.     --|
  8922.     --| type StringType is string(1..10);
  8923.     --|
  8924.     --| package Str_List is new Lists(StringType); use Str_List;
  8925.     --|
  8926.     --|    L:List;
  8927.     --|    S:StringType;
  8928.     --|
  8929.     --| Then to add a string S, to the list L, all that is necessary is
  8930.     --|
  8931.     --|    L := Create;
  8932.     --|    Attach(S,L);
  8933.     --|
  8934.     --|
  8935.     --| This package provides basic list operations.
  8936.     --|
  8937.     --| Attach          append an object to an object, an object to a list,
  8938.     --|                 or a list to an object, or a list to a list.
  8939.     --| Copy            copy a list using := on elements
  8940.     --| CopyDeep        copy a list by copying the elements using a copy
  8941.     --|                 operation provided by the user
  8942.     --| Create          Creates an empty list
  8943.     --| DeleteHead      removes the head of a list
  8944.     --| DeleteItem      delete the first occurrence of an element from a list
  8945.     --| DeleteItems     delete all occurrences of an element from a list
  8946.     --| Destroy         remove a list
  8947.     --| Equal           are two lists equal
  8948.     --| FirstValue      get the information from the first element of a list
  8949.     --| IsInList        determines whether a given element is in a given list
  8950.     --| IsEmpty         returns true if the list is empty
  8951.     --| LastValue       return the last value of a list
  8952.     --| Length          Returns the length of a list
  8953.     --| MakeListIter    prepares for an iteration over a list
  8954.     --| More            are there any more items in the list
  8955.     --| Next            get the next item in a list
  8956.     --| ReplaceHead     replace the information at the head of the list
  8957.     --| ReplaceTail     replace the tail of a list with a new list
  8958.     --| Tail            get the tail of a list
  8959.     --|
  8960.      
  8961.     --| N/A: Effects, Requires, Modifies, and Raises.
  8962.      
  8963.     --| Notes
  8964.     --| Programmer Buddy Altus
  8965.      
  8966.     --|                           Types
  8967.     --|                           -----
  8968.      
  8969.               type List       is private;
  8970.               type ListIter   is private;
  8971.      
  8972.      
  8973.     --|                           Exceptions
  8974.     --|                           ----------
  8975.      
  8976.         CircularList     :exception;     --| Raised if an attemp is made to
  8977.                                          --| create a circular list.  This
  8978.                                          --| results when a list is attempted
  8979.                                          --| to be attached to itself.
  8980.      
  8981.         EmptyList        :exception;     --| Raised if an attemp is made to
  8982.                                          --| manipulate an empty list.
  8983.      
  8984.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  8985.                                          --| remove an element from a list in
  8986.                                          --| which it does not exist.
  8987.      
  8988.         NoMore           :exception;     --| Raised if an attemp is made to
  8989.                                          --| get the next element from a list
  8990.                                          --| after iteration is complete.
  8991.      
  8992.      
  8993.      
  8994.     --|                           Operations
  8995.     --|                           ----------
  8996.      
  8997.     ----------------------------------------------------------------------------
  8998.      
  8999.     procedure Attach(                  --| appends List2 to List1
  9000.               List1:     in out List;  --| The list being appended to.
  9001.               List2:     in     List   --| The list being appended.
  9002.     );
  9003.      
  9004.     --| Raises
  9005.     --| CircularList
  9006.      
  9007.     --| Effects
  9008.     --| Appends List1 to List2.  This makes the next field of the last element
  9009.     --| of List1 refer to List2.  This can possibly change the value of List1
  9010.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  9011.     --| user Destroys List1 then List2 will be a dangling reference.
  9012.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9013.     --| necessary to Attach a list to itself first make a copy of the list and
  9014.     --| attach the copy.
  9015.      
  9016.     --| Modifies
  9017.     --| Changes the next field of the last element in List1 to be List2.
  9018.      
  9019.     -------------------------------------------------------------------------------
  9020.      
  9021.     function Attach(                 --| Creates a new list containing the two
  9022.                                      --| Elements.
  9023.              Element1: in Tree;  --| This will be first element in list.
  9024.              Element2: in Tree   --| This will be second element in list.
  9025.     ) return List;
  9026.      
  9027.     --| Effects
  9028.     --| This creates a list containing the two elements in the order
  9029.     --| specified.
  9030.      
  9031.     -------------------------------------------------------------------------------
  9032.     procedure Attach(                   --| List L is appended with Element.
  9033.              L:       in out List;      --| List being appended to.
  9034.              Element: in     Tree   --| This will be last element in l    ist.
  9035.     );
  9036.      
  9037.     --| Effects
  9038.     --| Appends Element onto the end of the list L.  If L is empty then this
  9039.     --| may change the value of L.
  9040.     --|
  9041.     --| Modifies
  9042.     --| This appends List L with Element by changing the next field in List.
  9043.      
  9044.     --------------------------------------------------------------------------------
  9045.     procedure Attach(                   --| Makes Element first item in list L.
  9046.              Element: in      Tree; --| This will be the first element in list.
  9047.              L:       in  out List      --| The List which Element is being
  9048.                                         --| prepended to.
  9049.     );
  9050.      
  9051.     --| Effects
  9052.     --| This prepends list L with Element.
  9053.     --|
  9054.     --| Modifies
  9055.     --| This modifies the list L.
  9056.      
  9057.     --------------------------------------------------------------------------
  9058.      
  9059.     function Attach (                      --| attaches two lists
  9060.              List1: in     List;           --| first list
  9061.              List2: in     List            --| second list
  9062.     ) return List;
  9063.      
  9064.     --| Raises
  9065.     --| CircularList
  9066.      
  9067.     --| Effects
  9068.     --| This returns a list which is List1 attached to List2.  If it is desired
  9069.     --| to make List1 be the new attached list the following ada code should be
  9070.     --| used.
  9071.     --|
  9072.     --| List1 := Attach (List1, List2);
  9073.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9074.     --| necessary to Attach a list to itself first make a copy of the list and
  9075.     --| attach the copy.
  9076.      
  9077.     -------------------------------------------------------------------------
  9078.      
  9079.     function Attach (                   --| prepends an element onto a list
  9080.              Element: in    Tree;   --| element being prepended to list
  9081.              L:       in    List        --| List which element is being added
  9082.                                         --| to
  9083.     ) return List;
  9084.      
  9085.     --| Effects
  9086.     --| Returns a new list which is headed by Element and followed by L.
  9087.      
  9088.     ------------------------------------------------------------------------
  9089.      
  9090.     function Attach (                  --| Adds an element to the end of a list
  9091.              L: in          List;      --| The list which element is being added to.
  9092.              Element: in    Tree   --| The element being added to the end of
  9093.                                        --| the list.
  9094.     ) return List;
  9095.      
  9096.     --| Effects
  9097.     --| Returns a new list which is L followed by Element.
  9098.      
  9099.     --------------------------------------------------------------------------
  9100.      
  9101.      
  9102.     function Copy(          --| returns a copy of list1
  9103.            L: in List       --| list being copied
  9104.     ) return List;
  9105.      
  9106.     --| Effects
  9107.     --| Returns a copy of L.
  9108.      
  9109.     --------------------------------------------------------------------------
  9110.      
  9111.      
  9112.     function Create           --| Returns an empty List
  9113.      
  9114.     return List;
  9115.      
  9116.     ------------------------------------------------------------------------------
  9117.      
  9118.     procedure DeleteHead(            --| Remove the head element from a list.
  9119.               L: in out List         --| The list whose head is being removed.
  9120.     );
  9121.      
  9122.     --| Raises
  9123.     --| EmptyList
  9124.     --|
  9125.     --| Effects
  9126.     --| This will return the space occupied by the first element in the list
  9127.     --| to the heap.  If sharing exists between lists this procedure
  9128.     --| could leave a dangling reference.  If L is empty EmptyList will be
  9129.     --| raised.
  9130.      
  9131.     ------------------------------------------------------------------------------
  9132.      
  9133.     procedure DeleteItem(           --| remove the first occurrence of Element
  9134.                                     --| from L
  9135.           L:       in out List;     --| list element is being  removed from
  9136.           Element: in     Tree  --| element being removed
  9137.     );
  9138.      
  9139.     --| Raises
  9140.     --| ItemNotPresent
  9141.      
  9142.     --| Effects
  9143.     --| Removes the first element of the list equal to Element.  If there is
  9144.     --| not an element equal to Element than ItemNotPresent is raised.
  9145.      
  9146.     --| Modifies
  9147.     --| This operation is destructive, it returns the storage occupied by
  9148.     --| the elements being deleted.
  9149.      
  9150.     ------------------------------------------------------------------------------
  9151.      
  9152.     procedure DeleteItems(          --| remove all occurrences of Element
  9153.                                     --| from  L.
  9154.           L:       in out List;     --| The List element is being removed from
  9155.           Element: in     Tree  --| element being removed
  9156.     );
  9157.      
  9158.     --| Raises
  9159.     --| ItemNotPresent
  9160.     --|
  9161.     --| Effects
  9162.     --| This procedure walks down the list L and removes all elements of the
  9163.     --| list equal to Element.  If there are not any elements equal to Element
  9164.     --| then raise ItemNotPresent.
  9165.      
  9166.     --| Modifies
  9167.     --| This operation is destructive the storage occupied by the items
  9168.     --| removed is returned.
  9169.      
  9170.     ------------------------------------------------------------------------------
  9171.      
  9172.     procedure Destroy(            --| removes the list
  9173.               L: in out List      --| the list being removed
  9174.     );
  9175.      
  9176.     --| Effects
  9177.     --| This returns to the heap all the storage that a list occupies.  Keep in
  9178.     --| mind if there exists sharing between lists then this operation can leave
  9179.     --| dangling references.
  9180.      
  9181.     ------------------------------------------------------------------------------
  9182.      
  9183.     function FirstValue(      --| returns the contents of the first record of the
  9184.                               --| list
  9185.              L: in List       --| the list whose first element is being
  9186.                               --| returned
  9187.      
  9188.     ) return Tree;
  9189.      
  9190.     --| Raises
  9191.     --| EmptyList
  9192.     --|
  9193.     --| Effects
  9194.     --| This returns the Item in the first position in the list.  If the list
  9195.     --| is empty EmptyList is raised.
  9196.      
  9197.     -------------------------------------------------------------------------------
  9198.      
  9199.     function IsEmpty(            --| Checks if a list is empty.
  9200.              L: in     List      --| List being checked.
  9201.     ) return boolean;
  9202.      
  9203.     --------------------------------------------------------------------------
  9204.      
  9205.     function IsInList(                 --| Checks if element is an element of
  9206.                                        --| list.
  9207.              L:       in     List;     --| list being scanned for element
  9208.              Element: in     Tree  --| element being searched for
  9209.     ) return boolean;
  9210.      
  9211.     --| Effects
  9212.     --| Walks down the list L looking for an element whose value is Element.
  9213.      
  9214.     ------------------------------------------------------------------------------
  9215.      
  9216.     function LastValue(       --| Returns the contents of the last record of
  9217.                               --| the list.
  9218.              L: in List       --| The list whose first element is being
  9219.                               --| returned.
  9220.     ) return Tree;
  9221.      
  9222.     --| Raises
  9223.     --| EmptyList
  9224.     --|
  9225.     --| Effects
  9226.     --| Returns the last element in a list.  If the list is empty EmptyList is
  9227.     --| raised.
  9228.      
  9229.      
  9230.     ------------------------------------------------------------------------------
  9231.      
  9232.     function Length(         --| count the number of elements on a list
  9233.              L: in List      --| list whose length is being computed
  9234.     ) return integer;
  9235.      
  9236.     ------------------------------------------------------------------------------
  9237.      
  9238.     function MakeListIter(          --| Sets a variable to point to  the head
  9239.                                     --| of the list.  This will be used to
  9240.                                     --| prepare for iteration over a list.
  9241.              L: in List             --| The list being iterated over.
  9242.     ) return ListIter;
  9243.      
  9244.      
  9245.     --| This prepares a user for iteration operation over a list.  The iterater is
  9246.     --| an operation which returns successive elements of the list on successive
  9247.     --| calls to the iterator.  There needs to be a mechanism which marks the
  9248.     --| position in the list, so on successive calls to the Next operation the
  9249.     --| next item in the list can be returned.  This is the function of the
  9250.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  9251.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  9252.     --| is updated with each call.
  9253.      
  9254.     -----------------------------------------------------------------------------
  9255.      
  9256.     function More(           --| Returns true if there are more elements in
  9257.                              --| the and false if there aren't any more
  9258.                              --| the in the list.
  9259.              L: in ListIter  --| List being checked for elements.
  9260.     ) return boolean;
  9261.      
  9262.     ------------------------------------------------------------------------------
  9263.      
  9264.     procedure Next(                 --| This is the iterator operation.  Given
  9265.                                     --| a ListIter in the list it returns the
  9266.                                     --| current item and updates the ListIter.
  9267.                                     --| If ListIter is at the end of the list,
  9268.                                     --| More returns false otherwise it
  9269.                                     --| returns true.
  9270.         Place:    in out ListIter;  --| The Iter which marks the position in
  9271.                                     --| the list.
  9272.         Info:        out Tree   --| The element being returned.
  9273.      
  9274.     );
  9275.      
  9276.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  9277.     --| in the following way:
  9278.     --|
  9279.     --|         L:        List;
  9280.     --|         Place:    ListIter;
  9281.     --|         Info:     SomeType;
  9282.     --|
  9283.     --|
  9284.     --|         Place := MakeListIter(L);
  9285.     --|
  9286.     --|         while ( More(Place) ) loop
  9287.     --|               NextList(Place, Info);
  9288.     --|               process each element of list L;
  9289.     --|               end loop;
  9290.      
  9291.      
  9292.     ----------------------------------------------------------------------------
  9293.      
  9294.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  9295.                                --| with the parameter Item.
  9296.          L:    in out List;    --| The list being modified.
  9297.          Info: in     Tree --| The information being entered.
  9298.     );
  9299.     --| Raises
  9300.     --| EmptyList
  9301.      
  9302.     --| Effects
  9303.     --| Replaces the information in the first element in the list.  Raises
  9304.     --| EmptyList if the list is empty.
  9305.      
  9306.     ------------------------------------------------------------------------------
  9307.      
  9308.     procedure ReplaceTail(           --| Replace the Tail of a list
  9309.                                      --| with a new list.
  9310.               L:       in out List;  --| List whose Tail is replaced.
  9311.               NewTail: in     List   --| The list which will become the
  9312.                                      --| tail of Oldlist.
  9313.     );
  9314.     --| Raises
  9315.     --| EmptyList
  9316.     --|
  9317.     --| Effects
  9318.     --| Replaces the tail of a list with a new list.  If the list whose tail
  9319.     --| is being replaced is null EmptyList is raised.
  9320.      
  9321.     -------------------------------------------------------------------------------
  9322.      
  9323.     function Tail(           --| returns the tail of a list L
  9324.              L: in List      --| the list whose tail is being returned
  9325.     ) return List;
  9326.      
  9327.     --| Raises
  9328.     --| EmptyList
  9329.     --|
  9330.     --| Effects
  9331.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  9332.     --| L is empty.  If L only has one element then Tail returns the Empty
  9333.     --| list.
  9334.      
  9335.     ------------------------------------------------------------------------------
  9336.      
  9337.     function Equal(            --| compares list1 and list2 for equality
  9338.              List1: in List;   --| first list
  9339.              List2: in List    --| second list
  9340.      )  return boolean;
  9341.      
  9342.     --| Effects
  9343.     --| Returns true if for all elements of List1 the corresponding element
  9344.     --| of List2 has the same value.  This function uses the Equal operation
  9345.     --| provided by the user.  If one is not provided then = is used.
  9346.      
  9347.     ------------------------------------------------------------------------------
  9348.     private
  9349.         type Cell;
  9350.      
  9351.         type List is access Cell;      --| pointer added by this package
  9352.                                        --| in order to make a list
  9353.      
  9354.      
  9355.         type Cell is                   --| Cell for the lists being created
  9356.              record
  9357.                   Info: Tree;
  9358.                   Next: List;
  9359.              end record;
  9360.      
  9361.      
  9362.         type ListIter is new List;     --| This prevents Lists being assigned to
  9363.                                        --| iterators and vice versa
  9364.      
  9365.     end NodeOrder;
  9366.      
  9367.        type TreeIter is
  9368.           record
  9369.               NodeList :NodeOrder.List;
  9370.               State    :NodeOrder.ListIter;
  9371.           end record;
  9372.      
  9373.      
  9374.     end TreePkg;
  9375.        type Set is
  9376.            record
  9377.              SetRep :TreePkg.Tree;
  9378.            end record;
  9379.      
  9380.        type SetIter is
  9381.            record
  9382.              Place :TreePkg.TreeIter;
  9383.              Count :natural;
  9384.            end record;
  9385.      
  9386.     end DEF_ID_Set;
  9387.      
  9388.      
  9389.     function "<" (   --| This is used to order the Source_Text.Locs
  9390.           X :in     Source_Text.Locator;
  9391.           Y :in     Source_Text.Locator
  9392.     ) return boolean;
  9393.      
  9394. --    generic
  9395. --          type Source_Text.Locator is private;
  9396. --          with function "<" ( X ,Y: in     Source_Text.Locator) return boolean;
  9397.      
  9398.     package Literal_Set is
  9399.      
  9400.     --| Overview
  9401.     --| This abstractions is a counted ordered set.  This means that
  9402.     --| associated with each member of the set is a count of the number of
  9403.     --| times it appears in the set.  The order part means that there is
  9404.     --| an ordering associated with the members.  This allows fast insertion.
  9405.     --| It also makes it easy to iterate over the set in order.
  9406.      
  9407.      
  9408.      
  9409.     --                    Types
  9410.     --                    -----
  9411.      
  9412.           type Set is private;  --| This is the type exported to represent
  9413.                                 --| the ordered set.
  9414.      
  9415.           type SetIter is private;  --| This is the type exported whose
  9416.                                     --| purpose is to walk over a set.
  9417.      
  9418.      
  9419.     --                   Operations
  9420.     --                   ----------
  9421.      
  9422.     --| Cardinality              Returns cardinality of the set.
  9423.     --| Create                   Creates the empty set.
  9424.     --| CountMember              Returns the number of times the member appears in
  9425.     --|                          the set.
  9426.     --| Destroy                  Destroys a set and returns the space it occupies.
  9427.     --| Insert                   Insert a member into  the set.
  9428.     --| MakeSetIter              Return a SetIter which will begin an iteration.
  9429.     --| More                     Are there more elements to iterate over in the
  9430.     --|                          set.
  9431.     --| Next                     Return the next element in the iteration and
  9432.     --|                          bump the iterator.
  9433.      
  9434.      
  9435.     ------------------------------------------------------------------------------
  9436.      
  9437.     function Cardinality (   --| Return the number of members in the set.
  9438.              S     :in Set   --| The set whose members are being counted.
  9439.     ) return natural;
  9440.      
  9441.     ------------------------------------------------------------------------------
  9442.      
  9443.      
  9444.     function Create   --| Return the empty set.
  9445.     return Set;
  9446.      
  9447.     ------------------------------------------------------------------------------
  9448.      
  9449.     procedure Destroy (        --| Destroy a set and return its space.
  9450.               S   :in out Set  --| Set being destroyed.
  9451.      
  9452.     );
  9453.      
  9454.     ------------------------------------------------------------------------------
  9455.      
  9456.     function GetCount (            --| This returns the count associated with
  9457.                                    --| member which corresponds to the current
  9458.                                    --| iterator I.
  9459.              I :in     SetIter
  9460.     ) return natural;
  9461.      
  9462.     -----------------------------------------------------------------------------
  9463.      
  9464.     procedure Insert (             --| Insert a member M into set S.
  9465.              M :in     Source_Text.Locator;   --| Member being inserted.
  9466.              S :in out Set         --| Set being inserted into.
  9467.     );
  9468.      
  9469.     ------------------------------------------------------------------------------
  9470.      
  9471.     function MakeSetIter (      --| Prepares a user for an iteration operation by
  9472.                                 --| by returning a SetIter.
  9473.              S :in     Set     --| Set being iterate over.
  9474.     ) return SetIter;
  9475.      
  9476.     ------------------------------------------------------------------------------
  9477.      
  9478.     function More (             --| Returns true if there are more elements in the
  9479.                                 --| set to iterate over.
  9480.              I :in    SetIter   --| The iterator.
  9481.      
  9482.     ) return boolean;
  9483.      
  9484.     ------------------------------------------------------------------------------
  9485.      
  9486.     procedure Next (              --| Returns the current member in the iteration
  9487.                                   --| an increments the iterator.
  9488.              I :in out SetIter;   --| The iterator.
  9489.              M :   out Source_Text.Locator   --| The current member being returned.
  9490.     );
  9491.      
  9492.     -----------------------------------------------------------------------------
  9493.      
  9494.     private
  9495.      
  9496.        type Member is
  9497.            record
  9498.              Info   :Source_Text.Locator;
  9499.              Count  :natural;
  9500.            end record;
  9501.      
  9502.        function "<" (
  9503.                 X:in    Member;
  9504.                 Y:in    Member
  9505.        ) return boolean;
  9506.      
  9507.        -- generic instantiation
  9508.        --package TreePkg is new BinaryTrees ( Source_Text.Locator => Member, "<" => "<" );
  9509.      
  9510.      
  9511.     package TreePkg is
  9512.      
  9513.      
  9514.     --| Overview
  9515.     --| This package creates an ordered binary tree.  This will allow for
  9516.     --| quick insertion, and search.
  9517.     --|
  9518.     --| The tree is organized such that
  9519.     --|
  9520.     --|  leftchild < root    root < rightchild
  9521.     --|
  9522.     --| This means that by doing a left to right search of the tree will can
  9523.     --| produce the nodes of the tree in ascending order.
  9524.      
  9525.      
  9526.      
  9527.      
  9528.      
  9529.     --                             Types
  9530.     --                             -----
  9531.      
  9532.     type Tree is  private;     --| This is the type exported to represent the
  9533.                                --| tree.
  9534.      
  9535.      
  9536.     type TreeIter is private;  --| This is the type which is used to iterate
  9537.                                --| over the set.
  9538.      
  9539.     --|                          Exceptions
  9540.     --|                          ----------
  9541.      
  9542.     --|                          Operations
  9543.     --|                          ----------
  9544.     --|
  9545.     --| Create           Creates a tree.
  9546.     --| Deposit          Replaces the given node's information with
  9547.     --|                  the given information.
  9548.     --| DestroyTree      Destroys the given tree and returns the spaces.
  9549.     --| InsertNode       This inserts a node n into a tree t.
  9550.     --| MakeTreeIter     This returns an iterator to the user in order to start
  9551.     --|                  an iteration.
  9552.     --| More             This returns true if there are more elements to iterate
  9553.     --|                  over in the tree.
  9554.     --| Next             This returns the information associated with the current
  9555.     --|                  iterator and advances the iterator.
  9556.      
  9557.      
  9558.     ---------------------------------------------------------------------------
  9559.      
  9560.     function Create             --| This function creates the tree.
  9561.      
  9562.     return Tree;
  9563.      
  9564.     --| Effects
  9565.     --| This creates a tree containing no information and no children.  An
  9566.     --| emptytree.
  9567.      
  9568.     -------------------------------------------------------------------------------
  9569.      
  9570.     procedure Deposit (              --| This deposits the information I in the
  9571.                                      --| root of the Tree S.
  9572.               I :in     Member;    --| The information being deposited.
  9573.               S :in     Tree         --| The tree where the information is being
  9574.                                      --| stored.
  9575.     );
  9576.      
  9577.     --| Modifies
  9578.     --| This changes the information stored at the root of the tree S.
  9579.      
  9580.     -------------------------------------------------------------------------------
  9581.      
  9582.      
  9583.     procedure DestroyTree (         --| Destroys a tree.
  9584.               T  :in out Tree       --| Tree being destroyed.
  9585.     );
  9586.      
  9587.     --| Effects
  9588.     --| Destroys a tree and returns the space which it is occupying.
  9589.      
  9590.     --------------------------------------------------------------------------
  9591.      
  9592.     Procedure Insertnode(           --| This Procedure Inserts A Node Into The
  9593.                                     --| Specified Tree.
  9594.            N      :In Out Member; --| The Information To Be Contained In The
  9595.                                     --| Node Being Inserted.
  9596.      
  9597.            T      :In Out Tree;     --| Tree Being Inserted Into.
  9598.            Root   :   Out Tree;     --| Root of the subtree which Node N heads.
  9599.                                     --| This is the position of the node N in T.
  9600.            Exists :   out boolean   --| If this node already exists in the tree
  9601.                                     --| Exists is true.  If this is the first
  9602.                                     --| insertion Exists is false.
  9603.     );
  9604.      
  9605.     --| Effects
  9606.     --| This adds the node N to the tree T inserting in the proper postion.
  9607.      
  9608.     --| Modifies
  9609.     --| This modifies the tree T by add the node N to it.
  9610.      
  9611.     ------------------------------------------------------------------------------
  9612.      
  9613.     function MakeTreeIter (         --| Sets a variable to a position in the
  9614.                                     --| tree
  9615.                                     --| where the iteration is to begin.  In this
  9616.                                     --| case the position is a pointer to the
  9617.                                     --| the deepest leftmost leaf in the tree.
  9618.             T:in Tree               --| Tree being iterated over
  9619.     ) return TreeIter;
  9620.      
  9621.      
  9622.     --| Effects
  9623.      
  9624.      
  9625.     -----------------------------------------------------------------------------
  9626.      
  9627.     function More (                 --| Returns true if there are more elements
  9628.                                     --| in the tree to iterate over.
  9629.               I :in TreeIter
  9630.     ) return boolean;
  9631.      
  9632.      
  9633.     -----------------------------------------------------------------------------
  9634.      
  9635.     procedure Next (                --| This is the iterator operation.  Given
  9636.                                     --| an Iter in the Tree it returns the
  9637.                                     --| item Iter points to and updates the
  9638.                                     --| iter. If Iter is at the end of the Tree,
  9639.                                     --| yielditer returns false otherwise it
  9640.                                     --| returns true.
  9641.         I        :in out TreeIter;  --| The iter which marks the position in the
  9642.                                     --| Tree.
  9643.      
  9644.         Info     :   out Member   --| Information being returned from a node.
  9645.     );
  9646.      
  9647.      
  9648.     ---------------------------------------------------------------------------
  9649.      
  9650.     private
  9651.      
  9652.        type Node;
  9653.        type Tree is access Node;
  9654.      
  9655.        type Node is
  9656.             record
  9657.                 Info           :Member;
  9658.                 LeftChild      :Tree;
  9659.                 RightChild     :Tree;
  9660.             end record;
  9661.      
  9662.     ---   The following is a generic instantiation of NodeOrder
  9663.     ---   package NodeOrder is new Lists (Tree);
  9664.      
  9665.      
  9666.     package NodeOrder is
  9667.      
  9668.     --| This package provides singly linked lists with elements of type
  9669.     --| Tree, where Tree is specified by a generic parameter.
  9670.      
  9671.     --| Overview
  9672.     --| When this package is instantiated, it provides a linked list type for
  9673.     --| lists of objects of type Tree, which can be any desired type.  A
  9674.     --| complete set of operations for manipulation, and releasing
  9675.     --| those lists is also provided.  For instance, to make lists of strings,
  9676.     --| all that is necessary is:
  9677.     --|
  9678.     --| type StringType is string(1..10);
  9679.     --|
  9680.     --| package Str_List is new Lists(StringType); use Str_List;
  9681.     --|
  9682.     --|    L:List;
  9683.     --|    S:StringType;
  9684.     --|
  9685.     --| Then to add a string S, to the list L, all that is necessary is
  9686.     --|
  9687.     --|    L := Create;
  9688.     --|    Attach(S,L);
  9689.     --|
  9690.     --|
  9691.     --| This package provides basic list operations.
  9692.     --|
  9693.     --| Attach          append an object to an object, an object to a list,
  9694.     --|                 or a list to an object, or a list to a list.
  9695.     --| Copy            copy a list using := on elements
  9696.     --| CopyDeep        copy a list by copying the elements using a copy
  9697.     --|                 operation provided by the user
  9698.     --| Create          Creates an empty list
  9699.     --| DeleteHead      removes the head of a list
  9700.     --| DeleteItem      delete the first occurrence of an element from a list
  9701.     --| DeleteItems     delete all occurrences of an element from a list
  9702.     --| Destroy         remove a list
  9703.     --| Equal           are two lists equal
  9704.     --| FirstValue      get the information from the first element of a list
  9705.     --| IsInList        determines whether a given element is in a given list
  9706.     --| IsEmpty         returns true if the list is empty
  9707.     --| LastValue       return the last value of a list
  9708.     --| Length          Returns the length of a list
  9709.     --| MakeListIter    prepares for an iteration over a list
  9710.     --| More            are there any more items in the list
  9711.     --| Next            get the next item in a list
  9712.     --| ReplaceHead     replace the information at the head of the list
  9713.     --| ReplaceTail     replace the tail of a list with a new list
  9714.     --| Tail            get the tail of a list
  9715.     --|
  9716.      
  9717.     --| N/A: Effects, Requires, Modifies, and Raises.
  9718.      
  9719.     --| Notes
  9720.     --| Programmer Buddy Altus
  9721.      
  9722.     --|                           Types
  9723.     --|                           -----
  9724.      
  9725.               type List       is private;
  9726.               type ListIter   is private;
  9727.      
  9728.      
  9729.     --|                           Exceptions
  9730.     --|                           ----------
  9731.      
  9732.         CircularList     :exception;     --| Raised if an attemp is made to
  9733.                                          --| create a circular list.  This
  9734.                                          --| results when a list is attempted
  9735.                                          --| to be attached to itself.
  9736.      
  9737.         EmptyList        :exception;     --| Raised if an attemp is made to
  9738.                                          --| manipulate an empty list.
  9739.      
  9740.         ItemNotPresent   :exception;     --| Raised if an attempt is made to
  9741.                                          --| remove an element from a list in
  9742.                                          --| which it does not exist.
  9743.      
  9744.         NoMore           :exception;     --| Raised if an attemp is made to
  9745.                                          --| get the next element from a list
  9746.                                          --| after iteration is complete.
  9747.      
  9748.      
  9749.      
  9750.     --|                           Operations
  9751.     --|                           ----------
  9752.      
  9753.     ----------------------------------------------------------------------------
  9754.      
  9755.     procedure Attach(                  --| appends List2 to List1
  9756.               List1:     in out List;  --| The list being appended to.
  9757.               List2:     in     List   --| The list being appended.
  9758.     );
  9759.      
  9760.     --| Raises
  9761.     --| CircularList
  9762.      
  9763.     --| Effects
  9764.     --| Appends List1 to List2.  This makes the next field of the last element
  9765.     --| of List1 refer to List2.  This can possibly change the value of List1
  9766.     --| if List1 is an empty list.  This causes sharing of lists.  Thus if
  9767.     --| user Destroys List1 then List2 will be a dangling reference.
  9768.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9769.     --| necessary to Attach a list to itself first make a copy of the list and
  9770.     --| attach the copy.
  9771.      
  9772.     --| Modifies
  9773.     --| Changes the next field of the last element in List1 to be List2.
  9774.      
  9775.     -------------------------------------------------------------------------------
  9776.      
  9777.     function Attach(                 --| Creates a new list containing the two
  9778.                                      --| Elements.
  9779.              Element1: in Tree;  --| This will be first element in list.
  9780.              Element2: in Tree   --| This will be second element in list.
  9781.     ) return List;
  9782.      
  9783.     --| Effects
  9784.     --| This creates a list containing the two elements in the order
  9785.     --| specified.
  9786.      
  9787.     -------------------------------------------------------------------------------
  9788.     procedure Attach(                   --| List L is appended with Element.
  9789.              L:       in out List;      --| List being appended to.
  9790.              Element: in     Tree   --| This will be last element in l    ist.
  9791.     );
  9792.      
  9793.     --| Effects
  9794.     --| Appends Element onto the end of the list L.  If L is empty then this
  9795.     --| may change the value of L.
  9796.     --|
  9797.     --| Modifies
  9798.     --| This appends List L with Element by changing the next field in List.
  9799.      
  9800.     --------------------------------------------------------------------------------
  9801.     procedure Attach(                   --| Makes Element first item in list L.
  9802.              Element: in      Tree; --| This will be the first element in list.
  9803.              L:       in  out List      --| The List which Element is being
  9804.                                         --| prepended to.
  9805.     );
  9806.      
  9807.     --| Effects
  9808.     --| This prepends list L with Element.
  9809.     --|
  9810.     --| Modifies
  9811.     --| This modifies the list L.
  9812.      
  9813.     --------------------------------------------------------------------------
  9814.      
  9815.     function Attach (                      --| attaches two lists
  9816.              List1: in     List;           --| first list
  9817.              List2: in     List            --| second list
  9818.     ) return List;
  9819.      
  9820.     --| Raises
  9821.     --| CircularList
  9822.      
  9823.     --| Effects
  9824.     --| This returns a list which is List1 attached to List2.  If it is desired
  9825.     --| to make List1 be the new attached list the following ada code should be
  9826.     --| used.
  9827.     --|
  9828.     --| List1 := Attach (List1, List2);
  9829.     --| This procedure raises CircularList if List1 equals List2.  If it is
  9830.     --| necessary to Attach a list to itself first make a copy of the list and
  9831.     --| attach the copy.
  9832.      
  9833.     -------------------------------------------------------------------------
  9834.      
  9835.     function Attach (                   --| prepends an element onto a list
  9836.              Element: in    Tree;   --| element being prepended to list
  9837.              L:       in    List        --| List which element is being added
  9838.                                         --| to
  9839.     ) return List;
  9840.      
  9841.     --| Effects
  9842.     --| Returns a new list which is headed by Element and followed by L.
  9843.      
  9844.     ------------------------------------------------------------------------
  9845.      
  9846.     function Attach (                  --| Adds an element to the end of a list
  9847.              L: in          List;      --| The list which element is being added to.
  9848.              Element: in    Tree   --| The element being added to the end of
  9849.                                        --| the list.
  9850.     ) return List;
  9851.      
  9852.     --| Effects
  9853.     --| Returns a new list which is L followed by Element.
  9854.      
  9855.     --------------------------------------------------------------------------
  9856.      
  9857.      
  9858.     function Copy(          --| returns a copy of list1
  9859.            L: in List       --| list being copied
  9860.     ) return List;
  9861.      
  9862.     --| Effects
  9863.     --| Returns a copy of L.
  9864.      
  9865.     --------------------------------------------------------------------------
  9866.      
  9867.      
  9868.     function Create           --| Returns an empty List
  9869.      
  9870.     return List;
  9871.      
  9872.     ------------------------------------------------------------------------------
  9873.      
  9874.     procedure DeleteHead(            --| Remove the head element from a list.
  9875.               L: in out List         --| The list whose head is being removed.
  9876.     );
  9877.      
  9878.     --| Raises
  9879.     --| EmptyList
  9880.     --|
  9881.     --| Effects
  9882.     --| This will return the space occupied by the first element in the list
  9883.     --| to the heap.  If sharing exists between lists this procedure
  9884.     --| could leave a dangling reference.  If L is empty EmptyList will be
  9885.     --| raised.
  9886.      
  9887.     ------------------------------------------------------------------------------
  9888.      
  9889.     procedure DeleteItem(           --| remove the first occurrence of Element
  9890.                                     --| from L
  9891.           L:       in out List;     --| list element is being  removed from
  9892.           Element: in     Tree  --| element being removed
  9893.     );
  9894.      
  9895.     --| Raises
  9896.     --| ItemNotPresent
  9897.      
  9898.     --| Effects
  9899.     --| Removes the first element of the list equal to Element.  If there is
  9900.     --| not an element equal to Element than ItemNotPresent is raised.
  9901.      
  9902.     --| Modifies
  9903.     --| This operation is destructive, it returns the storage occupied by
  9904.     --| the elements being deleted.
  9905.      
  9906.     ------------------------------------------------------------------------------
  9907.      
  9908.     procedure DeleteItems(          --| remove all occurrences of Element
  9909.                                     --| from  L.
  9910.           L:       in out List;     --| The List element is being removed from
  9911.           Element: in     Tree  --| element being removed
  9912.     );
  9913.      
  9914.     --| Raises
  9915.     --| ItemNotPresent
  9916.     --|
  9917.     --| Effects
  9918.     --| This procedure walks down the list L and removes all elements of the
  9919.     --| list equal to Element.  If there are not any elements equal to Element
  9920.     --| then raise ItemNotPresent.
  9921.      
  9922.     --| Modifies
  9923.     --| This operation is destructive the storage occupied by the items
  9924.     --| removed is returned.
  9925.      
  9926.     ------------------------------------------------------------------------------
  9927.      
  9928.     procedure Destroy(            --| removes the list
  9929.               L: in out List      --| the list being removed
  9930.     );
  9931.      
  9932.     --| Effects
  9933.     --| This returns to the heap all the storage that a list occupies.  Keep in
  9934.     --| mind if there exists sharing between lists then this operation can leave
  9935.     --| dangling references.
  9936.      
  9937.     ------------------------------------------------------------------------------
  9938.      
  9939.     function FirstValue(      --| returns the contents of the first record of the
  9940.                               --| list
  9941.              L: in List       --| the list whose first element is being
  9942.                               --| returned
  9943.      
  9944.     ) return Tree;
  9945.      
  9946.     --| Raises
  9947.     --| EmptyList
  9948.     --|
  9949.     --| Effects
  9950.     --| This returns the Item in the first position in the list.  If the list
  9951.     --| is empty EmptyList is raised.
  9952.      
  9953.     -------------------------------------------------------------------------------
  9954.      
  9955.     function IsEmpty(            --| Checks if a list is empty.
  9956.              L: in     List      --| List being checked.
  9957.     ) return boolean;
  9958.      
  9959.     --------------------------------------------------------------------------
  9960.      
  9961.     function IsInList(                 --| Checks if element is an element of
  9962.                                        --| list.
  9963.              L:       in     List;     --| list being scanned for element
  9964.              Element: in     Tree  --| element being searched for
  9965.     ) return boolean;
  9966.      
  9967.     --| Effects
  9968.     --| Walks down the list L looking for an element whose value is Element.
  9969.      
  9970.     ------------------------------------------------------------------------------
  9971.      
  9972.     function LastValue(       --| Returns the contents of the last record of
  9973.                               --| the list.
  9974.              L: in List       --| The list whose first element is being
  9975.                               --| returned.
  9976.     ) return Tree;
  9977.      
  9978.     --| Raises
  9979.     --| EmptyList
  9980.     --|
  9981.     --| Effects
  9982.     --| Returns the last element in a list.  If the list is empty EmptyList is
  9983.     --| raised.
  9984.      
  9985.      
  9986.     ------------------------------------------------------------------------------
  9987.      
  9988.     function Length(         --| count the number of elements on a list
  9989.              L: in List      --| list whose length is being computed
  9990.     ) return integer;
  9991.      
  9992.     ------------------------------------------------------------------------------
  9993.      
  9994.     function MakeListIter(          --| Sets a variable to point to  the head
  9995.                                     --| of the list.  This will be used to
  9996.                                     --| prepare for iteration over a list.
  9997.              L: in List             --| The list being iterated over.
  9998.     ) return ListIter;
  9999.      
  10000.      
  10001.     --| This prepares a user for iteration operation over a list.  The iterater is
  10002.     --| an operation which returns successive elements of the list on successive
  10003.     --| calls to the iterator.  There needs to be a mechanism which marks the
  10004.     --| position in the list, so on successive calls to the Next operation the
  10005.     --| next item in the list can be returned.  This is the function of the
  10006.     --| MakeListIter and the type ListIter.  MakeIter just sets the Iter to the
  10007.     --| the beginning  of the list. On subsequent calls to NextList the Iter
  10008.     --| is updated with each call.
  10009.      
  10010.     -----------------------------------------------------------------------------
  10011.      
  10012.     function More(           --| Returns true if there are more elements in
  10013.                              --| the and false if there aren't any more
  10014.                              --| the in the list.
  10015.              L: in ListIter  --| List being checked for elements.
  10016.     ) return boolean;
  10017.      
  10018.     ------------------------------------------------------------------------------
  10019.      
  10020.     procedure Next(                 --| This is the iterator operation.  Given
  10021.                                     --| a ListIter in the list it returns the
  10022.                                     --| current item and updates the ListIter.
  10023.                                     --| If ListIter is at the end of the list,
  10024.                                     --| More returns false otherwise it
  10025.                                     --| returns true.
  10026.         Place:    in out ListIter;  --| The Iter which marks the position in
  10027.                                     --| the list.
  10028.         Info:        out Tree   --| The element being returned.
  10029.      
  10030.     );
  10031.      
  10032.     --| The iterators subprograms MakeListIter, More, and NextList should be used
  10033.     --| in the following way:
  10034.     --|
  10035.     --|         L:        List;
  10036.     --|         Place:    ListIter;
  10037.     --|         Info:     SomeType;
  10038.     --|
  10039.     --|
  10040.     --|         Place := MakeListIter(L);
  10041.     --|
  10042.     --|         while ( More(Place) ) loop
  10043.     --|               NextList(Place, Info);
  10044.     --|               process each element of list L;
  10045.     --|               end loop;
  10046.      
  10047.      
  10048.     ----------------------------------------------------------------------------
  10049.      
  10050.     procedure ReplaceHead(     --| Replace the Item at the head of the list
  10051.                                --| with the parameter Item.
  10052.          L:    in out List;    --| The list being modified.
  10053.          Info: in     Tree --| The information being entered.
  10054.     );
  10055.     --| Raises
  10056.     --| EmptyList
  10057.      
  10058.     --| Effects
  10059.     --| Replaces the information in the first element in the list.  Raises
  10060.     --| EmptyList if the list is empty.
  10061.      
  10062.     ------------------------------------------------------------------------------
  10063.      
  10064.     procedure ReplaceTail(           --| Replace the Tail of a list
  10065.                                      --| with a new list.
  10066.               L:       in out List;  --| List whose Tail is replaced.
  10067.               NewTail: in     List   --| The list which will become the
  10068.                                      --| tail of Oldlist.
  10069.     );
  10070.     --| Raises
  10071.     --| EmptyList
  10072.     --|
  10073.     --| Effects
  10074.     --| Replaces the tail of a list with a new list.  If the list whose tail
  10075.     --| is being replaced is null EmptyList is raised.
  10076.      
  10077.     -------------------------------------------------------------------------------
  10078.      
  10079.     function Tail(           --| returns the tail of a list L
  10080.              L: in List      --| the list whose tail is being returned
  10081.     ) return List;
  10082.      
  10083.     --| Raises
  10084.     --| EmptyList
  10085.     --|
  10086.     --| Effects
  10087.     --| Returns a list which is the tail of the list L.  Raises EmptyList if
  10088.     --| L is empty.  If L only has one element then Tail returns the Empty
  10089.     --| list.
  10090.      
  10091.     ------------------------------------------------------------------------------
  10092.      
  10093.     function Equal(            --| compares list1 and list2 for equality
  10094.              List1: in List;   --| first list
  10095.              List2: in List    --| second list
  10096.      )  return boolean;
  10097.      
  10098.     --| Effects
  10099.     --| Returns true if for all elements of List1 the corresponding element
  10100.     --| of List2 has the same value.  This function uses the Equal operation
  10101.     --| provided by the user.  If one is not provided then = is used.
  10102.      
  10103.     ------------------------------------------------------------------------------
  10104.     private
  10105.         type Cell;
  10106.      
  10107.         type List is access Cell;      --| pointer added by this package
  10108.                                        --| in order to make a list
  10109.      
  10110.      
  10111.         type Cell is                   --| Cell for the lists being created
  10112.              record
  10113.                   Info: Tree;
  10114.                   Next: List;
  10115.              end record;
  10116.      
  10117.      
  10118.         type ListIter is new List;     --| This prevents Lists being assigned to
  10119.                                        --| iterators and vice versa
  10120.      
  10121.     end NodeOrder;
  10122.      
  10123.        type TreeIter is
  10124.           record
  10125.               NodeList :NodeOrder.List;
  10126.               State    :NodeOrder.ListIter;
  10127.           end record;
  10128.      
  10129.      
  10130.     end TreePkg;
  10131.        type Set is
  10132.            record
  10133.              SetRep :TreePkg.Tree;
  10134.            end record;
  10135.      
  10136.        type SetIter is
  10137.            record
  10138.              Place :TreePkg.TreeIter;
  10139.              Count :natural;
  10140.            end record;
  10141.      
  10142.     end Literal_Set;
  10143.      
  10144.      
  10145.      
  10146.      
  10147.     -- package Literal_Set is new OrderedSets
  10148.     --           (ItemType => Source_Text.Locator, "<" => "<" );
  10149.     -- generic
  10150.     --       type ItemType is private;
  10151.     --       with function "<" ( X ,Y: in     ItemType) return boolean;
  10152.      
  10153.     type BlockInfoType is
  10154.         record
  10155.           TokenCount             :TokenCountType;
  10156.           BlockId                :BlockIdType;
  10157.           SetOfLiterals          :Literal_Set.Set;
  10158.           SetOfDEF_IDs           :DEF_ID_Set.Set;
  10159.         end record;
  10160.         --| This is the information which pertains to a particular block
  10161.         --| of the source program.  This information is pushed on
  10162.         --| a stack when an new block is encountered.  The
  10163.         --| information is a count of the tokens encountered so far
  10164.         --| and the DEF_ID's which have been found as well as the
  10165.         --| identifying information for the block.  The ListOfLiterals
  10166.         --| is a list of all literals encounter
  10167.      
  10168.     --? package BlockInfoStack is new Stacks(BlockInfoType);
  10169.     --? use StackBlockInfo;
  10170.      
  10171.      
  10172.     package BlockInfoStack is
  10173.      
  10174.      
  10175.      
  10176.      
  10177.         type stack is private;       --| The stack abstract data type.
  10178.      
  10179.      
  10180.         uninitialized_stack: exception;
  10181.             --| The initialization operations are create and copy.
  10182.      
  10183.         empty_stack: exception;
  10184.      
  10185.      
  10186.      
  10187.         function create
  10188.             return stack;
  10189.      
  10190.      
  10191.         procedure push(s: in out stack;
  10192.                        e:        BlockInfoType);
  10193.      
  10194.      
  10195.         procedure pop(s: in out stack);
  10196.      
  10197.      
  10198.         procedure pop(s: in out stack;
  10199.                       e: out    BlockInfoType);
  10200.      
  10201.      
  10202.         function copy(s: stack)
  10203.             return stack;
  10204.      
  10205.      
  10206.      
  10207.      
  10208.         function top(s: stack)
  10209.             return BlockInfoType;
  10210.      
  10211.      
  10212.         function size(s: stack)
  10213.             return natural;
  10214.      
  10215.      
  10216.         function is_empty(s: stack)
  10217.             return boolean;
  10218.      
  10219.      
  10220.      
  10221.      
  10222.         procedure destroy(s: in out stack);
  10223.      
  10224.      
  10225.      
  10226.     private
  10227.         package Lists is
  10228.      
  10229.      
  10230.      
  10231.      
  10232.      
  10233.      
  10234.                   type List       is private;
  10235.                   type ListIter   is private;
  10236.      
  10237.      
  10238.      
  10239.             CircularList     :exception;     --| Raised if an attemp is made to
  10240.                                              --| create a circular list.  This
  10241.                                              --| results when a list is attempted
  10242.                                              --| to be attached to itself.
  10243.      
  10244.             EmptyList        :exception;     --| Raised if an attemp is made to
  10245.                                              --| manipulate an empty list.
  10246.      
  10247.             ItemNotPresent   :exception;     --| Raised if an attempt is made to
  10248.                                              --| remove an element from a list in
  10249.                                              --| which it does not exist.
  10250.      
  10251.             NoMore           :exception;     --| Raised if an attemp is made to
  10252.                                              --| get the next element from a list
  10253.                                              --| after iteration is complete.
  10254.      
  10255.      
  10256.      
  10257.      
  10258.      
  10259.         procedure Attach(                  --| appends List2 to List1
  10260.                   List1:     in out List;  --| The list being appended to.
  10261.                   List2:     in     List   --| The list being appended.
  10262.         );
  10263.      
  10264.      
  10265.      
  10266.      
  10267.      
  10268.         function Attach(                 --| Creates a new list containing the two
  10269.                                          --| Elements.
  10270.                  Element1: in BlockInfoType;  --| This will be first element in list.
  10271.                  Element2: in BlockInfoType   --| This will be second element in list.
  10272.         ) return List;
  10273.      
  10274.      
  10275.         procedure Attach(                   --| List L is appended with Element.
  10276.                  L:       in out List;      --| List being appended to.
  10277.                  Element: in     BlockInfoType   --| This will be last element in l    ist.
  10278.         );
  10279.      
  10280.      
  10281.         procedure Attach(                   --| Makes Element first item in list L.
  10282.                  Element: in      BlockInfoType; --| This will be the first element in list.
  10283.                  L:       in  out List      --| The List which Element is being
  10284.                                             --| prepended to.
  10285.         );
  10286.      
  10287.      
  10288.      
  10289.         function Attach (                      --| attaches two lists
  10290.                  List1: in     List;           --| first list
  10291.                  List2: in     List            --| second list
  10292.         ) return List;
  10293.      
  10294.      
  10295.      
  10296.      
  10297.         function Attach (                   --| prepends an element onto a list
  10298.                  Element: in    BlockInfoType;   --| element being prepended to list
  10299.                  L:       in    List        --| List which element is being added
  10300.                                             --| to
  10301.         ) return List;
  10302.      
  10303.      
  10304.      
  10305.         function Attach (                  --| Adds an element to the end of a list
  10306.                  L: in          List;      --| The list which element is being added to.
  10307.                  Element: in    BlockInfoType   --| The element being added to the end of
  10308.                                            --| the list.
  10309.         ) return List;
  10310.      
  10311.      
  10312.      
  10313.      
  10314.         function Copy(          --| returns a copy of list1
  10315.                L: in List       --| list being copied
  10316.         ) return List;
  10317.      
  10318.      
  10319.      
  10320.      
  10321.      
  10322.         function Create           --| Returns an empty List
  10323.      
  10324.         return List;
  10325.      
  10326.      
  10327.         procedure DeleteHead(            --| Remove the head element from a list.
  10328.                   L: in out List         --| The list whose head is being removed.
  10329.         );
  10330.      
  10331.      
  10332.      
  10333.         procedure DeleteItem(           --| remove the first occurrence of Element
  10334.                                         --| from L
  10335.               L:       in out List;     --| list element is being  removed from
  10336.               Element: in     BlockInfoType  --| element being removed
  10337.         );
  10338.      
  10339.      
  10340.      
  10341.      
  10342.      
  10343.         procedure DeleteItems(          --| remove all occurrences of Element
  10344.                                         --| from  L.
  10345.               L:       in out List;     --| The List element is being removed from
  10346.               Element: in     BlockInfoType  --| element being removed
  10347.         );
  10348.      
  10349.      
  10350.      
  10351.      
  10352.         procedure Destroy(            --| removes the list
  10353.                   L: in out List      --| the list being removed
  10354.         );
  10355.      
  10356.      
  10357.      
  10358.         function FirstValue(      --| returns the contents of the first record of the
  10359.                                   --| list
  10360.                  L: in List       --| the list whose first element is being
  10361.                                   --| returned
  10362.      
  10363.         ) return BlockInfoType;
  10364.      
  10365.      
  10366.      
  10367.         function IsEmpty(            --| Checks if a list is empty.
  10368.                  L: in     List      --| List being checked.
  10369.         ) return boolean;
  10370.      
  10371.      
  10372.         function IsInList(                 --| Checks if element is an element of
  10373.                                            --| list.
  10374.                  L:       in     List;     --| list being scanned for element
  10375.                  Element: in     BlockInfoType  --| element being searched for
  10376.         ) return boolean;
  10377.      
  10378.      
  10379.      
  10380.         function LastValue(       --| Returns the contents of the last record of
  10381.                                   --| the list.
  10382.                  L: in List       --| The list whose first element is being
  10383.                                   --| returned.
  10384.         ) return BlockInfoType;
  10385.      
  10386.      
  10387.      
  10388.      
  10389.         function Length(         --| count the number of elements on a list
  10390.                  L: in List      --| list whose length is being computed
  10391.         ) return integer;
  10392.      
  10393.      
  10394.         function MakeListIter(          --| Sets a variable to point to  the head
  10395.                                         --| of the list.  This will be used to
  10396.                                         --| prepare for iteration over a list.
  10397.                  L: in List             --| The list being iterated over.
  10398.         ) return ListIter;
  10399.      
  10400.      
  10401.      
  10402.      
  10403.         function More(           --| Returns true if there are more elements in
  10404.                                  --| the and false if there aren't any more
  10405.                                  --| the in the list.
  10406.                  L: in ListIter  --| List being checked for elements.
  10407.         ) return boolean;
  10408.      
  10409.      
  10410.         procedure Next(                 --| This is the iterator operation.  Given
  10411.                                         --| a ListIter in the list it returns the
  10412.                                         --| current item and updates the ListIter.
  10413.                                         --| If ListIter is at the end of the list,
  10414.                                         --| More returns false otherwise it
  10415.                                         --| returns true.
  10416.             Place:    in out ListIter;  --| The Iter which marks the position in
  10417.                                         --| the list.
  10418.             Info:        out BlockInfoType   --| The element being returned.
  10419.      
  10420.         );
  10421.      
  10422.      
  10423.      
  10424.      
  10425.         procedure ReplaceHead(     --| Replace the Item at the head of the list
  10426.                                    --| with the parameter Item.
  10427.              L:    in out List;    --| The list being modified.
  10428.              Info: in     BlockInfoType --| The information being entered.
  10429.         );
  10430.      
  10431.      
  10432.      
  10433.         procedure ReplaceTail(           --| Replace the Tail of a list
  10434.                                          --| with a new list.
  10435.                   L:       in out List;  --| List whose Tail is replaced.
  10436.                   NewTail: in     List   --| The list which will become the
  10437.                                          --| tail of Oldlist.
  10438.         );
  10439.      
  10440.      
  10441.         function Tail(           --| returns the tail of a list L
  10442.                  L: in List      --| the list whose tail is being returned
  10443.         ) return List;
  10444.      
  10445.      
  10446.      
  10447.         function Equal(            --| compares list1 and list2 for equality
  10448.                  List1: in List;   --| first list
  10449.                  List2: in List    --| second list
  10450.          )  return boolean;
  10451.      
  10452.      
  10453.         private
  10454.             type Cell;
  10455.      
  10456.             type List is access Cell;      --| pointer added by this package
  10457.                                            --| in order to make a list
  10458.      
  10459.      
  10460.             type Cell is                   --| Cell for the lists being created
  10461.                  record
  10462.                       Info: BlockInfoType;
  10463.                       Next: List;
  10464.                  end record;
  10465.      
  10466.      
  10467.             type ListIter is new List;     --| This prevents Lists being assigned to
  10468.                                            --| iterators and vice versa
  10469.      
  10470.         end Lists;
  10471.      
  10472.             subtype elem_list is lists.list;
  10473.      
  10474.         type stack_rec is
  10475.             record
  10476.                 size: natural := 0;
  10477.                 elts: elem_list;
  10478.             end record;
  10479.      
  10480.         type stack is access stack_rec;
  10481.      
  10482.      
  10483.     end BlockInfoStack;
  10484.      
  10485.      
  10486. end Definitions;
  10487. ::::::::::::::
  10488. ftpme
  10489. ::::::::::::::
  10490. ::::::::::::::
  10491. halstead.ada
  10492. ::::::::::::::
  10493.  
  10494. -------SPEC---------------------------------------------------------------
  10495. function Halstead return INTEGER; 
  10496.  
  10497. -------BODY---------------------------------------------------------------
  10498.  
  10499. with STRING_LISTS; 
  10500. with COMMANDLINE;
  10501. with STANDARD_INTERFACE; 
  10502. with STRING_PKG; 
  10503. with TEXT_IO; use TEXT_IO;
  10504. with HOST_LIB; 
  10505. with ST_DIANA;
  10506. with PROGRAMLIBRARY;
  10507. with COMP_UNIT_CLASS_PKG;
  10508. with DEFINITIONS;
  10509. with HALSTEAD_DATA_BASE;
  10510. --xx with FILE_MANAGER;
  10511.  
  10512. function Halstead return INTEGER is 
  10513.  
  10514.   package CL renames COMMANDLINE;
  10515.   package SI renames STANDARD_INTERFACE;
  10516.   package SL renames STRING_LISTS; 
  10517.   package SP renames STRING_PKG; 
  10518.   package D  renames DEFINITIONS;
  10519.   package PL renames PROGRAMLIBRARY;
  10520.   package HDB renames HALSTEAD_DATA_BASE; 
  10521. --xx  package FM renames FILE_MANAGER;
  10522.  
  10523.   package STRINGTYPE is new SI.STRING_ARGUMENT("string"); 
  10524.   package UNIT_LIST_PKG is new SI.STRING_LIST_ARGUMENT(
  10525.     STRING_TYPE_NAME => "string_type",
  10526.     STRING_TYPE_LIST => "string_list"); 
  10527.  
  10528.   dd_name    : string(1..200);
  10529.   dd_Last    : natural;
  10530.   dd_changed : boolean;
  10531.   pl_name    : string(1..200);
  10532.   pl_last    : natural;
  10533.  
  10534.   HALSTEAD   : SI.PROCESS_HANDLE; 
  10535.   library_Name : SP.string_type;
  10536.   OUTPUT_FILE: FILE_TYPE;
  10537.   output_File_Name  : sp.string_type;    
  10538.   unit_list  : SL.LIST; 
  10539.   ITER       : SL.LISTITER; 
  10540.   unit_Name    : sp.string_type;            
  10541.   ToTerminal : boolean;
  10542.   verbose    : boolean;       
  10543.   Unit_SD    : PL.Subdomain_Type;
  10544.   COMP_UNIT_Locator: ST_DIANA.COMP_UNIT_CLASS.Locator;
  10545.   UnitPosition : natural := 1;
  10546.  
  10547. begin  -- driver
  10548.  
  10549.   HOST_LIB.SET_ERROR; 
  10550.  
  10551.   SI.set_tool_identifier ("1.0");
  10552.   STANDARD_INTERFACE.DEFINE_PROCESS(PROC => Halstead,
  10553.     NAME => "Halstead", 
  10554.     HELP => "Computes Halstead formulas for Ada compilation units."); 
  10555.     
  10556.   UNIT_LIST_PKG.DEFINE_ARGUMENT(PROC => HALSTEAD,
  10557.     NAME => "Units",
  10558.     DEFAULT => SL.CREATE,
  10559.     HELP => "Names of the compilation units"); 
  10560.  
  10561.   Stringtype.DEFINE_ARGUMENT(PROC => halstead, 
  10562.     NAME => "Output", 
  10563.     DEFAULT => "", 
  10564.     HELP => "Name of the report file (defaults to standard output)"); 
  10565.  
  10566.   STRINGTYPE.DEFINE_ARGUMENT(PROC => HALSTEAD,
  10567.     NAME => "library", DEFAULT => "[.BYRONLIB]",
  10568.     Help => "Name of an Ada program library (NYI)");
  10569.  
  10570.   SI.DEFINE_PROCESS_HELP(PROC => halstead,
  10571.     HELP => "Computes Halstead formulas for Ada compilation units"); 
  10572.  
  10573.   STANDARD_INTERFACE.PARSE_LINE(halstead); 
  10574.  
  10575.   unit_list := unit_LIST_pkg.GET_ARGUMENT(PROC => halstead, NAME => "units"); 
  10576.   library_Name := stringtype.get_argument(proc => halstead, name => "library");
  10577.   output_File_Name := 
  10578.         STRINGTYPE.GET_ARGUMENT(PROC => halstead, NAME => "output"); 
  10579.   verbose := FALSE;
  10580.  
  10581.  
  10582.    if sp.equal(output_File_Name, "") then
  10583.  
  10584.     -- No file name given: output is to the terminal
  10585.     Set_Output(STANDARD_OUTPUT);
  10586.     ToTerminal := true;
  10587.  
  10588.    else
  10589.     -- Create the specified output file
  10590.     create(File => Output_File,
  10591.                Mode => Out_File,
  10592.                Name => sp.value(output_File_Name),
  10593.                Form => ""
  10594.              );
  10595.         Set_Output(Output_File);
  10596.         ToTerminal := false;
  10597.  
  10598.    end if;
  10599.  
  10600.     -- Connect to the program library directory:
  10601. --xx    FM.Show_and_Set_Default(dd_name,dd_last,dd_changed,SP.Value(library_Name));
  10602. --xx    if not dd_changed then
  10603. --xx    Put_Line("?? Cannot connect to program library.");
  10604. --xx    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10605. --xx    end if;
  10606.      
  10607.     -- Open the catalog.  This is the program library which contains
  10608.     -- the library units which the user is performing the Halstead
  10609.     -- Complexity Measures on.
  10610.  
  10611.    PL.Open_catalog;
  10612.    ST_DIANA.NEWDOMAIN (PL.Get_Primary_Context, PL.Get_Secondary_Context);
  10613.  
  10614.      -- Get each library unit which the user is performing the metric on.
  10615.      -- For each unit get its COMP_UNIT_CLASS.Locator which is the handle
  10616.      -- to the beginning of the DIANA for the unit.  Pass the Locator
  10617.      -- to the bonsai tree walk routine which computes the metrics.
  10618.  
  10619.    ITER := SL.MAKELISTITER(UNIT_LIST);
  10620.    while SL.MORE(ITER) loop
  10621.     SL.next(iter, unit_Name);
  10622.      
  10623.     -- Check to see if the unit specified is a SubUnit.
  10624.      
  10625.     if cl.IsSubUnit(SP.Value(unit_Name), unitposition) then
  10626.       begin
  10627.         Unit_SD := PL.Open_Subdomain(
  10628.             ST_Diana.TheDomain,
  10629.             PL.DIANA_Form,
  10630.             PL.SubUnit_Ident (
  10631.                 CL.GetParent (sp.value(unit_Name), UnitPosition) ,
  10632.                 CL.GetSubUnit (sp.value(unit_Name), UnitPosition),
  10633.                 IsStub => false
  10634.             ));
  10635.       exception
  10636.         when PL.Object_Not_Up_To_Date =>
  10637.         Put(Standard_Output, "%% WARNING: ");
  10638.         Put(Standard_Output, "Subunit " & SP.Value(unit_Name));
  10639.         Put_Line(Standard_Output, " not found");
  10640.       end;
  10641.       -- Pass the necessary data to the Utilities package.
  10642.       HDB.InitializeData(
  10643.                            LibraryUnit    => SP.Value(unit_Name),
  10644.                            IsUnitSpec     => false,
  10645.                            VerboseFlag    => Verbose,
  10646.                            ToTerminalFlag => ToTerminal,
  10647.                            OuterMostBlockFlag => false
  10648.                            );
  10649.      
  10650.       -- If writing to an output file then generate a
  10651.       -- report header.  If writing to the terminal a header is
  10652.       -- generated in the utilities package.
  10653.      
  10654.       if not ToTerminal then
  10655.         HDB.ReportHeader (SP.Value(unit_Name), Spec => false);
  10656.       end if;
  10657.      
  10658.       -- Get the actual locator for the library unit.
  10659.      
  10660.       COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  10661.      
  10662.       -- Now that we have the locator scan the diana which
  10663.       -- the locator points to.
  10664.      
  10665.       COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  10666.     else
  10667.       -- For any library unit which is not a subunit this
  10668.       -- loop scans both the specification (implicit as well
  10669.       -- as explicit) and the body of the unit.
  10670.      
  10671.       for IsSpec in reverse false..true loop
  10672.         -- Open the Subdomain.
  10673.         begin
  10674.           Unit_SD := PL.Open_Subdomain(
  10675.             ST_Diana.TheDomain,
  10676.             PL.DIANA_Form,
  10677.             PL.Library_Unit_Ident (
  10678.                 SP.Value(unit_Name),
  10679.                 IsSpec
  10680.             ));
  10681.      
  10682.           -- Pass the data to the utilities package.
  10683.           HDB.InitializeData(
  10684.             LibraryUnit    => SP.Value(unit_Name),
  10685.             IsUnitSpec     => IsSpec,
  10686.             VerboseFlag    => Verbose,
  10687.             ToTerminalFlag => ToTerminal,
  10688.             OuterMostBlockFlag => false
  10689.             );
  10690.      
  10691.           if not ToTerminal then
  10692.         HDB.ReportHeader (SP.Value(unit_Name), IsSpec);
  10693.           end if;
  10694.      
  10695.           -- Get the locator to the library unit.
  10696.           COMP_UNIT_Locator := ST_Diana.Comp_UnitNode.GetRoot (Unit_SD);
  10697.      
  10698.           -- Perform the scan on the diana which the locator points to.
  10699.           COMP_UNIT_CLASS_Pkg.Scan_Comp_Unit_Class(COMP_UNIT_Locator);
  10700.      
  10701.           -- Catch the exception when attempting to open either
  10702.           -- implicit spec or body.
  10703.         exception
  10704.         when PL.Object_Not_Up_To_Date  =>
  10705.           Put_Line(Standard_Output, "%% WARNING: ");
  10706.           if IsSpec then
  10707.             Put(Standard_Output, "The spec of ");
  10708.           else
  10709.             Put(Standard_Output, "The body of ");
  10710.           end if;
  10711.           Put(Standard_Output, "Unit " & SP.Value(unit_Name));
  10712.           Put_Line(Standard_Output, " does not exist");
  10713.         end;
  10714.       end loop;
  10715.     end if;
  10716.     end loop;
  10717.      
  10718. --xx    FM.Show_and_Set_Default(pl_name, pl_last, dd_changed, dd_name(1..dd_last));
  10719.     return HOST_LIB.RETURN_CODE(HOST_LIB.SUCCESS); 
  10720.  
  10721. exception
  10722.  
  10723.   when STANDARD_INTERFACE.PROCESS_HELP => 
  10724.     return HOST_LIB.RETURN_CODE(HOST_LIB.INFORMATION); 
  10725.  
  10726.   when STANDARD_INTERFACE.ABORT_PROCESS => 
  10727.     return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10728.  
  10729. --  when others => 
  10730. --    TEXT_IO.PUT_LINE("internal error"); 
  10731. --    return HOST_LIB.RETURN_CODE(HOST_LIB.ERROR); 
  10732.  
  10733. end Halstead; 
  10734. ::::::::::::::
  10735. halstead.obj
  10736. ::::::::::::::
  10737. ADA$ELAB_HALSTEAD01 4-Mar-1986 08:55                 VAX Ada V1.1-10y<    nADA$ELAB_HALSTEAD}>nADA$ELAB_HALSTEADPHALSTEAD STRING_LISTS STRING_PKG_
  10738. STRING_PKGLISTS COMMANDLINE_ COMMANDLINESTANDARD_INTERFACE_STANDARD_INTERFACEINTEGER_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_
  10739. VMMTEXTPKGVMMSYSTEMPKG_ 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_
  10740. 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_MAPPINGHIF_KEYED_IO_ HIF_KEYED_IOBIN_KEYED_IO_BLOCKS_BIN_KEYED_IO_BLOCKSHOST_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
  10741. HIF_DEBUG_    HIF_DEBUG PARAMETERS_
  10742. PARAMETERS PLIF_DEBUG_
  10743. 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_TASK_DECL_IH_TYPE_DECL_IH_GENERIC_HEADER_CLASS_PKG_GENERIC_HEADER_CLASS_PKG DEF_ID_PKG_
  10744. DEF_ID_PKG PKG_DEF_PKG_ PKG_DEF_PKG HEADER_PKG_
  10745. HEADER_PKGOBJECT_TYPE_PKG_OBJECT_TYPE_PKGOBJECT_DEF_PKG_OBJECT_DEF_PKGNAME_EXP_PKG_ NAME_EXP_PKGCONSTRAINT_PKG_CONSTRAINT_PKGSUBP_DEF_PKG_ SUBP_DEF_PKGGENERAL_ASSOC_PKG_GENERAL_ASSOC_PKGBLOCK_STUB_PKG_BLOCK_STUB_PKGTYPE_SPEC_PKG_TYPE_SPEC_PKGGENERIC_HEADER_IH_IDENTIFIER_UTILITIES_IDENTIFIER_UTILITIESAGG_COMPONENT_PKG_AGG_COMPONENT_PKGSTM_PKG_STM_PKGALTERNATIVE_PKG_ALTERNATIVE_PKGBLOCK_STM_IH_SOURCE_POSITION_UTILITIES_SOURCE_POSITION_UTILITIESINNER_RECORD_CLASS_PKG_INNER_RECORD_CLASS_PKGAGG_NAMED_IH_ CHOICE_PKG_
  10746. CHOICE_PKGITERATION_PKG_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
  10747. ADA$ELAB_HALSTEAD|{    HALSTEADHALSTEADw/
  10748. ]\{ADA$INIT_COMPONENT~P
  10749.     
  10750. LISTS$ELAB
  10751. 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    'VMMPAGE_$ELAB'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    HIF_KEY_GENERATOR_$ELABHIF_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     TEXT_IO_$ELAB TEXT_IO_$ELAB     TEXT_IO$ELAB 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    nSTARLET_$ELABnSTARLET_$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    mCALENDAR$ELABmCALENDAR$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     VSUTILS_$ELAB 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    HOST_LIB$ELABHOST_LIB$ELAB    
  10752. PAGINATED_OUTPUT_$ELAB
  10753. 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    
  10754. HIF_PATH_NAMES$ELAB
  10755. 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    ST_DIANA$ELABST_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    
  10756. COUNT$ELAB
  10757. 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    ESTM_PKG_$ELABESTM_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    ITEM_PKG$ELABITEM_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    HALSTEAD$ELABHALSTEAD$ELABADA$INIT_COMPONENTLIB$INITIALIZEi$CODE|LIB$INITIALIZE}    HALSTEADHALSTEADoTRANSFER$ADDRESSw?=::::::::::::::
  10758. hdb.bdy
  10759. ::::::::::::::
  10760. with Count_Types;
  10761. with Count;
  10762. with Text_IO; use Text_IO;
  10763. with Int_IO; use Int_IO;
  10764. with VmmTextPkg;
  10765. with Unchecked_Deallocation;
  10766. package body Halstead_Data_Base is
  10767.      
  10768. --| OVERVIEW
  10769. --| This package does all the counting and processing of the information
  10770. --| for a block.  It analyzes all the token information and determines
  10771. --| the number of unique operators and operands for the block.  It
  10772. --| scans the list of DEF_ID's in the block and determines whether
  10773. --| each DEF_ID is either an operator or operand. It also scans the
  10774. --| list of literals and determines the number of different literals
  10775. --| as well as the number of times each literal on the list has been
  10776. --| used.  The literals are all counted asoperands.
  10777. --|
  10778. --| Using the number of unique operands and operators all the Halstead
  10779. --| Metrics are computed.   The metrics are then displayed using the
  10780. --| procedure PrintInfo.
  10781.      
  10782. --------------------------------------------------------------------------
  10783. --                          LOCAL OBJECTS
  10784. --------------------------------------------------------------------------
  10785.      
  10786.     package C renames Count;
  10787.     package CT renames Count_Types;
  10788.      
  10789.     BlockKindLength            :constant :=   9;
  10790.     MaxLineLength              :constant :=  80;
  10791.     NumberOfMetrics            :constant :=  17;
  10792.     NumberOfLinesToClearScreen :constant :=   8;
  10793.     BlockStrings: array(BlockKind)
  10794.       of string(1..BlockKindLength) := ( "PROCEDURE",
  10795.                                          "FUNCTION ",
  10796.                                          "PACKAGE  ",
  10797.                                          "PACKAGE  ",
  10798.                                          "TASK     ",
  10799.                                          "TASK     ",
  10800.      
  10801.      -- The following string is used for declare blocks.  It is blank
  10802.      -- because of the DecId string in pkg Definitions.
  10803.      
  10804.                                          "         ");
  10805.       --| These are the strings which will be printed out in the output
  10806.       --| for the corresponding block type.
  10807.      
  10808.     StroudNumber :integer range 5..20 := 5;
  10809.       --| This number is used as a constant in the metric calculations.
  10810.      
  10811.     E0           :integer := 3000;
  10812.       --| Number of elementary  discriminations between errors.
  10813.      
  10814.     type Real is digits 6;
  10815.  
  10816.     type MetricsRecord is
  10817.         record
  10818.           UniqueOperators         :Float;
  10819.           UniqueOperands          :Float;
  10820.           Vocabulary              :Float;
  10821.           OperatorUsage           :Float;
  10822.           OperandUsage            :Float;
  10823.           ProgramLength           :Float;
  10824.           EstimatedProgramLength  :Float;
  10825.           ProgramVolume           :Float;
  10826.           PotentialVolume         :Float;
  10827.           ProgramLevel            :Float;
  10828.           ProgramLevelApprox      :Float;
  10829.           IntelligenceContent     :Float;
  10830.           ProgrammingEffort       :Float;
  10831.           ProgrammingTime         :Float;
  10832.           LanguageLevel           :Float;
  10833.           NumberOfDeliveredErrors :Float;
  10834.           ApproxNumberOfDeliveredErrors :Float;
  10835.         end record;
  10836.         --| Each field of this record corresponds to one of the 17
  10837.         --| Halstead metrics.
  10838.      
  10839. --------------------------------------------------------------------------
  10840. --           LOCAL SUBPROGRAMS
  10841. --------------------------------------------------------------------------
  10842.      
  10843. --------------------------------------------------------------------------
  10844.      
  10845.      procedure Free is new Unchecked_Deallocation (String, StringPtr);
  10846.      
  10847. --------------------------------------------------------------------------
  10848.      
  10849.     function SymRepToString (   --| Converts a SymRep to a string
  10850.           SymRep :in symbol_repNode.Locator
  10851.     ) return String is
  10852.      
  10853.     begin
  10854.         if symbol_repNode.IsNull (SymRep) then
  10855.             return "";
  10856.         else
  10857.             return VmmTextPkg.Value (
  10858.                      Source_Text.Value (
  10859.                        lx_text (
  10860.                          ne_normalized_symrep (
  10861.                            ne_symbol_entry_in_table (
  10862.                              SymRep)))));
  10863.         end if;
  10864.     end SymRepToString;
  10865.      
  10866. --------------------------------------------------------------------------
  10867.      
  10868.     function TruncateSymrep(
  10869.       symrep : symbol_repNode.Locator;
  10870.       length : natural
  10871.     ) return string is
  10872.         TempName : String(1 .. length) := (others => ' ');
  10873.     begin
  10874.         if TOKEN.IsNull (symrep) then
  10875.             return TempName;
  10876.         else
  10877.             declare
  10878.                 FullName : constant String :=SymRepToString (symrep);
  10879.                 size : constant Integer := FullName'length;
  10880.             begin
  10881.                 if size < length then
  10882.                     TempName(1 .. Size) := FullName(1 .. Size);
  10883.                 else
  10884.                     TempName := FullName(1 .. length);
  10885.                 end if;
  10886.                 return TempName;
  10887.             end;
  10888.         end if;
  10889.     end TruncateSymrep;
  10890.      
  10891.      
  10892. --------------------------------------------------------------------- ----
  10893.      
  10894.      
  10895.     procedure DEF_ID_Analysis (  -- This procedure counts and analyzes
  10896.                                  -- all the identifiers in the program as
  10897.                                  -- either operands or operators.
  10898.             SetOfDEF_IDs   :in     DEF_ID_Set.Set;
  10899.             Nn             :in out CT.NnInfoType;
  10900.             N2Star         :in out natural
  10901.     ) is
  10902.      
  10903.         Place          :DEF_ID_Set.SetIter;
  10904.         Member         :DEF_ID.Locator;
  10905.         package DIS renames DEF_ID_Set;
  10906.      
  10907.      
  10908.     begin
  10909.         --| OVERVIEW
  10910.         --| Walk over the SetOfDEF_IDs.  Each member in the set increments
  10911.         --| its class's Vocabulary by 1 and its class's Usage by the
  10912.         --| Countof the member.  The Kind of each member determines
  10913.         --| which class it is in either an operator, an operand or
  10914.         --| neither.
  10915.         --|
  10916.         --| Calculate N2Star by counting the number of parameters to
  10917.         --| the program unit.
  10918.      
  10919.         Place := DIS.MakeSetIter (SetOfDEF_IDs);
  10920.         while DIS.More (Place) loop
  10921.             DIS.Next (Place, Member);
  10922.             case Kind (Member) is
  10923.               when  ATTRIBUTE_IDKind | BUILT_IN_OPERATORKind |
  10924.                     GENERAL_TYPE_IDKind | pkg_idKind | PRAGMA_IDKind |
  10925.                     STM_IDKind | SUBP_IDKind | subtype_idKind |
  10926.                     task_body_idKind =>
  10927.      
  10928.                 Nn(operator).Vocabulary := Nn(operator).Vocabulary + 1;
  10929.                 Nn(operator).Usage :=
  10930.                   Nn(operator).Usage + DIS.GetCount (Place);
  10931.                 if VerboseOn then
  10932.                     Put (Standard_Output, "number of uses of ");
  10933.                     Put (Standard_Output,
  10934.                          SymRepToString (lx_symrep (Member)));
  10935.                     Put (Standard_Output, " ");
  10936.                     Put (Standard_Output,  AnyKind 'image (Kind (Member)));
  10937.                     Put (Standard_Output,  " equals ");
  10938.                     Put (Standard_Output, DIS.GetCount (Place));
  10939.                     Put (Standard_Output,  " operators ");
  10940.                     New_Line(Standard_Output);
  10941.                 end if;
  10942.      
  10943.               when LITERAL_IDKind | OBJECT_IDKind| argument_idKind |
  10944.                    exception_idKind | iteration_id | number_idKind =>
  10945.      
  10946.                  Nn(operand).Vocabulary := Nn(operand).Vocabulary + 1;
  10947.                  Nn(operand).Usage :=
  10948.                    Nn(operand).Usage + DIS.GetCount (Place);
  10949.                  if Kind (Member) in Param_idKind then
  10950.                      N2Star := N2Star + 1;
  10951.                  end if;
  10952.                  if VerboseOn then
  10953.                      Put (Standard_Output, "number of uses of ");
  10954.                      Put (Standard_Output,
  10955.                           SymRepToString (lx_symrep (Member)));
  10956.                      Put (Standard_Output, " which is a ");
  10957.                      Put (Standard_Output, AnyKind 'image (Kind (Member)));
  10958.                      Put (Standard_Output,  " equals ");
  10959.                      Put (Standard_Output,  DIS.GetCount (Place));
  10960.                      Put (Standard_Output,  " operands ");
  10961.                      New_Line (Standard_Output);
  10962.                  end if;
  10963.      
  10964.               when others =>
  10965.                 null;
  10966.      
  10967.             end case;
  10968.         end loop;
  10969.     end DEF_ID_Analysis;
  10970.      
  10971. --------------------------------------------------------------------------
  10972.      
  10973.     procedure Literal_Analysis (
  10974.                SetOfLiterals :in     Literal_Set.Set;
  10975.                Nn            :in out CT.NnInfoType
  10976.     ) is
  10977.         I      :Literal_Set.SetIter;
  10978.         Member :Source_Text.Locator;
  10979.         package LS renames Literal_Set;
  10980.      
  10981.     begin
  10982.         --| OVERVIEW
  10983.         --| Walk over SetOfLiterals.  Each member in the set increments
  10984.         --| the Vocabulary of the operands by one.  The count of each
  10985.         --| member in the set increments the Usage of operands by the
  10986.         --| count.
  10987.      
  10988.         I := LS.MakeSetIter (SetOfLiterals);
  10989.         Nn(operand).Vocabulary :=
  10990.           Nn(operand).Vocabulary + LS.Cardinality (SetOfLiterals);
  10991.         while LS.More (I) loop
  10992.             LS.Next (I, Member);
  10993.             Nn(operand).Usage := Nn(operand).Usage + LS.GetCount (I);
  10994.             if VerboseOn then
  10995.                 Put (Standard_Output, "the literal ");
  10996.                 Put (Standard_Output,
  10997.                      VmmTextPkg.Value (Source_Text.Value (Member)));
  10998.                 Put (Standard_Output, " appears ");
  10999.                 Put (Standard_Output, LS.GetCount(I));
  11000.                 Put (Standard_Output, " times ");
  11001.                 New_Line(Standard_Output);
  11002.             end if;
  11003.         end loop;
  11004.     end Literal_Analysis;
  11005.      
  11006. --------------------------------------------------------------------------
  11007.      
  11008.     function SeriesValue (  --| This function computes the ln (1 + x).
  11009.          X :in     Float
  11010.     ) return Float is
  11011.         N             :integer := 6;
  11012.         SumOfSeries   :Float;
  11013.         Fraction      :Float;
  11014.         LnOfTwo       :Float;
  11015.      
  11016.     begin
  11017.         --| OVERVIEW
  11018.         --|
  11019.         --|  The series for ln (1 + X) =
  11020.         --|
  11021.         --|  x - x**2/2 + x**3/3 - x**4/4 + x**5/5 ....
  11022.         --|
  11023.         --|  This is being factored inorder to save computations to be
  11024.         --|
  11025.         --|  x ( 1 + x(-1/2 + x(1/3 + x(-1/4 .....
  11026.         --|
  11027.         --|  This is being computed from inside out.
  11028.      
  11029.         LnOfTwo := 6931.0/10000.0;
  11030.         SumOfSeries := 0.0;
  11031.         for i in reverse 1..N loop
  11032.         Fraction := 1.0/Float(i);
  11033.             if (i mod 2) = 0 then
  11034.         SumOfSeries := SumOfSeries - Fraction;
  11035.             else
  11036.         SumOfSeries := SumOfSeries + Fraction;
  11037.             end if;
  11038.             SumOfSeries := SumOfSeries * X;
  11039.         end loop;
  11040.     SumOfSeries := SumOfSeries / LnOfTwo;
  11041.         return SumOfSeries;
  11042.  
  11043.     end SeriesValue;
  11044.      
  11045. --------------------------------------------------------------------------
  11046.      
  11047.     function Log2 (
  11048.           X :in     Float
  11049.     ) return Float is
  11050.         U_X              :Float;
  11051.         IntegerPart      :Float;
  11052.         LogForFraction   :Float;
  11053.         LowerBound       :Float;
  11054.         X_For_Series     :Float;
  11055.      
  11056.         InputOutOfBounds :exception;
  11057.      
  11058.     --| This computes the log2(X) by using the following method.
  11059.     --|
  11060.     --| First get the integer part of the log by testing when 2**n is
  11061.     --| greater than X.  The integer part of log2(X) is then n - 1.
  11062.     --|
  11063.     --| Then we calculate the fraction part of log2(x) by using the
  11064.     --| expression
  11065.     --|
  11066.     --| ln(1 + x) = x - x**2/2 + x**3/3 - x**4/4 .....
  11067.     --|
  11068.     --| Then by using the fact log2(x) = ln(X)/ln(2) we have log2(X).
  11069.     --|
  11070.     --| For example if x = 70
  11071.     --|
  11072.     --| log2 (70) = log2 (64 * 70/64) = 6 + log2(70/64)
  11073.     --|
  11074.     --| log2( 70/64 )= log2( 1 + 6/64) = ln(1 + 6/64) / ln(2)
  11075.     --|
  11076.     --| log2 (1 + 64/70) is calculated by the function SeriesValue
  11077.     --| when passed  (64/70).
  11078.      
  11079.     begin
  11080.      
  11081.      
  11082.        if X < 0.0 then
  11083.            raise InputOutOfBounds;
  11084.        else
  11085.       U_X := Float(Integer(X));
  11086.       LowerBound := 1.0;
  11087.       IntegerPart := 0.0;
  11088.       while 2.0 * LowerBound <= U_X loop
  11089.         IntegerPart := IntegerPart + 1.0;
  11090.         LowerBound := LowerBound * 2.0;
  11091.       end loop;
  11092.       if LowerBound = U_X then
  11093.                return IntegerPart;
  11094.       else
  11095.                  -- Following the example above at this point we compute
  11096.                  -- log2 (70/64) = log2 (1 + 6/64)
  11097.                  -- log2 (1 + 6/64) = SeriesValue (6/64).
  11098.                  -- U_X - LowerBound is in the example 70 - 64.  Therefore
  11099.                  -- (U_X - LowerBound) / LowerBound is 6/64.
  11100.      
  11101.       X_For_Series := (U_X - LowerBound)/LowerBound;
  11102.       LogForFraction := SeriesValue(X_For_Series);
  11103.       return IntegerPart + LogForFraction;
  11104.         end if;
  11105.     end if;
  11106.  
  11107. end Log2;
  11108.      
  11109. --------------------------------------------------------------------------
  11110.      
  11111. function Exp (           --| Raises the natural log e to the power X.
  11112.              X  :in    Float
  11113.     ) return Float is
  11114.          NumberOfIterations  :integer := 6;
  11115.                                --| Number of Iterations used to calculate
  11116.                                --| series.
  11117.          Series              :Float;
  11118.          Factorial           :Float;
  11119.     begin
  11120.     Series := 1.0;
  11121.         Factorial := 1.0;
  11122.         for i in 1..NumberOfIterations loop
  11123.                -- Caculate Factorial
  11124.              Factorial := Factorial * Float(i);
  11125.              Series := Series + ((X ** i) / Factorial);
  11126.         end loop;
  11127.         return Series;
  11128.  
  11129.     end Exp;
  11130.      
  11131. --------------------------------------------------------------------------
  11132.      
  11133.     function TwoThirdsPower ( --| Calculates X ** (2/3) by finding a
  11134.                               --| a Y such that X ** 2 = Y ** 3
  11135.          X  :in    Float
  11136.     ) return Float is
  11137.          Y         :float := 1.0;
  11138.          SquareX   :float;
  11139.          CubeY     :float;
  11140.          CubeDelta :float;
  11141.     begin
  11142.         --| OVERVIEW
  11143.         --| Y = x ** (2/3) ->
  11144.         --| Y**3 = X**2
  11145.         --|
  11146.         --| This function computes Y such that
  11147.         --| Y**3 <= X**2 is true.
  11148.      
  11149.         SquareX := X ** 2;
  11150.         CubeY := Y ** 3;
  11151.         CubeDelta := CubeY + ((3.0 * Y) * (Y + 1.0)) + 1.0;
  11152.           -- The following shows how to incremently compute (Y+1)**3 when
  11153.           -- Y **3 exists.
  11154.           --
  11155.           -- ((Y + 1) ** 3)  -   (Y**3) =
  11156.           -- Y**3 + 3Y**2 + 3Y + 1    - Y**3 =
  11157.           -- 3Y**2 + 3Y + 1 =
  11158.           -- 3Y(Y + 1) + 1
  11159.         while CubeY + CubeDelta < SquareX loop
  11160.             Y :=  Y + 1.0;
  11161.             CubeDelta :=  ((3.0 * Y) * (Y + 1.0)) + 1.0;
  11162.         end loop;
  11163.         return Y;
  11164.  
  11165.     end TwoThirdsPower;
  11166.      
  11167. --------------------------------------------------------------------------
  11168.      
  11169.     procedure CalcEstimatedProgramLength (
  11170.                                  --| Computes the estimated program length
  11171.                                  --| given the number of unique operators
  11172.                                  --| and operands.
  11173.              N1       :in     Float;  --| number of unique operators
  11174.              N2       :in     Float;  --| number of unique operands
  11175.              Result   :in out Float
  11176.     ) is
  11177.      
  11178.     begin
  11179.         Result := (N1 * log2(N1)) + (N2 * log2(N2));
  11180.  
  11181.     end CalcEstimatedProgramLength;
  11182.      
  11183. --------------------------------------------------------------------------
  11184.      
  11185.     procedure CalcProgramVolume (    --| Computes the program volume
  11186.                                 --| given the vocabulary.
  11187.              ProgramLength :in     Float;
  11188.              Vocabulary    :in     Float;
  11189.              Result        :in out Float
  11190.     ) is
  11191.      
  11192.     begin
  11193.         Result := ProgramLength * log2(Vocabulary);
  11194.  
  11195.     end CalcProgramVolume;
  11196.      
  11197. --------------------------------------------------------------------------
  11198.      
  11199.     procedure CalcPotentialVolume(
  11200.              N2Star :in     natural;   --| minimum number of input output
  11201.                                        --| parameters.
  11202.              Result :in out Float
  11203.     ) is
  11204.     begin
  11205.          Result := (2.0 + Float(N2Star)) * log2(2.0 + Float(N2Star));
  11206.  
  11207.     end CalcPotentialVolume;
  11208.      
  11209. --------------------------------------------------------------------------
  11210.      
  11211.     procedure CalcProgramLevel (
  11212.              VStar  :in     Float;
  11213.              V      :in     Float;
  11214.              Result :in out Float
  11215.     ) is
  11216.      
  11217.     begin
  11218.         Result := VStar / V;
  11219.      
  11220.     exception
  11221.         when Numeric_Error =>
  11222.             -- This catches the case when the denominator is 0.
  11223.       Result := 0.0;
  11224.      
  11225.     end CalcProgramLevel;
  11226.      
  11227. --------------------------------------------------------------------------
  11228.      
  11229.     procedure  CalcProgramLevelApprox( --| minimum number of operators,
  11230.                                        --| number of unique operators,
  11231.                                        --| number of unique operands
  11232.                                        --| and total number of operands.
  11233.       N1           :in     Float;
  11234.       N2Unique     :in     Float;
  11235.       N2Total      :in     Float;
  11236.       N1Star       :in     natural := 2;
  11237.                                        --| Minimum number of operators
  11238.                                        --| necessary
  11239.       Result       :in out Float
  11240.     ) is
  11241.      
  11242.     begin
  11243.         Result := Float(N1Star)/N1 * N2Unique * N2Total;
  11244.  
  11245.     exception
  11246.       when Numeric_Error =>
  11247.           -- This catches the case when the denominator is 0.
  11248.         Result := 0.0;
  11249.      
  11250.     end CalcProgramLevelApprox;
  11251.      
  11252. --------------------------------------------------------------------------
  11253.      
  11254.     procedure CalcIntelligenceContent (
  11255.         L_Approx :in     Float;
  11256.         V        :in     Float;
  11257.         Result   :in out Float
  11258.     ) is
  11259.     begin
  11260.       Result := L_Approx * V;
  11261.  
  11262.     end CalcIntelligenceContent;
  11263.      
  11264. --------------------------------------------------------------------------
  11265.      
  11266.     procedure CalcProgrammingEffort (
  11267.         V      :in     Float;
  11268.         L      :in     Float;
  11269.         Result :in out Float
  11270.      
  11271.     ) is
  11272.     begin
  11273.         Result := V / L;
  11274.  
  11275.     exception
  11276.         when Numeric_Error =>
  11277.             -- This catches the case when the denominator is 0.
  11278.         Result := 0.0;
  11279.      
  11280.     end CalcProgrammingEffort;
  11281.      
  11282. --------------------------------------------------------------------------
  11283.      
  11284.     procedure CalcProgrammingTime (
  11285.         E      :in     Float;
  11286.         S      :in     natural;      --| Stroud number.
  11287.         Result :in out Float
  11288.     ) is
  11289.     begin
  11290.     Result := E/Float(S);
  11291.  
  11292.     end CalcProgrammingTime;
  11293.      
  11294. --------------------------------------------------------------------------
  11295.      
  11296.     procedure CalcLanguageLevel (
  11297.        L      :in     Float;
  11298.        VStar  :in     Float;
  11299.        Result :in out Float
  11300.     ) is
  11301.      
  11302.     begin
  11303.         Result := L * VStar;
  11304.  
  11305.     end CalcLanguageLevel;
  11306.      
  11307. --------------------------------------------------------------------------
  11308.      
  11309.     procedure CalcNumberOfDeliveredErrors (
  11310.         E       :in     Float;
  11311.         E0      :in     natural;
  11312.         Result  :in out Float
  11313.     ) is
  11314.     begin
  11315.         -- E**(2/3) / E0
  11316.     Result := TwoThirdsPower(E) / Float(E0);
  11317.  
  11318.     end CalcNumberOfDeliveredErrors;
  11319.      
  11320. --------------------------------------------------------------------------
  11321.      
  11322.     procedure CalcApproxNumberOfDeliveredErrors (
  11323.          V      :in     Float;
  11324.          E0     :in    natural;
  11325.          Result :in out Float
  11326.     ) is
  11327.     begin
  11328.     Result := V / Float(E0);
  11329.  
  11330.     end CalcApproxNumberOfDeliveredErrors;
  11331.      
  11332. --------------------------------------------------------------------------
  11333.      
  11334.     procedure MetricCalculations (
  11335.       Nn       :in     CT.NnInfoType;
  11336.       N2Star   :in     natural;
  11337.       Metrics  :in out MetricsRecord
  11338.     ) is
  11339.      
  11340.     begin
  11341.       Metrics.UniqueOperators := Float(Nn(operator).Vocabulary);
  11342.       Metrics.UniqueOperands := Float(Nn(operand).Vocabulary);
  11343.       Metrics.OperandUsage := Float(Nn(operand).Usage);
  11344.       Metrics.OperatorUsage := Float(Nn(operator).Usage);
  11345.       Metrics.Vocabulary := Metrics.UniqueOperators + Metrics.UniqueOperands;
  11346.       Metrics.ProgramLength := Metrics.OperandUsage + Metrics.OperatorUsage;
  11347.       CalcEstimatedProgramLength(Metrics.UniqueOperators,
  11348.                                  Metrics.UniqueOperands,
  11349.                                  Metrics.EstimatedProgramLength);
  11350.       CalcProgramVolume(Metrics.ProgramLength,
  11351.                         Metrics.Vocabulary,
  11352.                         Metrics.ProgramVolume);
  11353.       CalcPotentialVolume(N2Star, Metrics.PotentialVolume);
  11354.       CalcProgramLevel(Metrics.PotentialVolume,
  11355.                        Metrics.ProgramVolume,
  11356.                        Metrics.ProgramLevel);
  11357.       CalcProgramLevelApprox(Metrics.UniqueOperators,
  11358.                              Metrics.UniqueOperands,
  11359.                              Metrics.OperandUsage,
  11360.                              Result => Metrics.ProgramLevelApprox);
  11361.       CalcIntelligenceContent(Metrics.ProgramLevelApprox,
  11362.                               Metrics.ProgramVolume,
  11363.                               Metrics.IntelligenceContent);
  11364.       CalcProgrammingEffort(Metrics.ProgramVolume,
  11365.                             Metrics.ProgramLevel,
  11366.                             Metrics.ProgrammingEffort);
  11367.       CalcProgrammingTime(Metrics.ProgrammingEffort,
  11368.                           StroudNumber,
  11369.                           Metrics.ProgrammingTime);
  11370.       CalcLanguageLevel(Metrics.ProgramLevel,
  11371.                         Metrics.PotentialVolume,
  11372.                         Metrics.LanguageLevel);
  11373.       CalcNumberOfDeliveredErrors(Metrics.ProgrammingEffort,
  11374.                                   E0,
  11375.                                   Metrics.NumberOfDeliveredErrors);
  11376.       CalcApproxNumberOfDeliveredErrors(
  11377.                          Metrics.ProgramVolume,
  11378.                          E0,
  11379.                          Metrics.ApproxNumberOfDeliveredErrors);
  11380.      
  11381.     end MetricCalculations;
  11382.      
  11383. -------------------------------------------------------------------------
  11384.      
  11385.     function Center (   --|This centers the string S in a buffer of blanks
  11386.                         --|whose width is Width.
  11387.       S      :in     String;
  11388.       Width  :in     positive
  11389.     ) return String is
  11390.         Result        :String(1..Width) := (others => ' ');
  11391.         Start         :positive;
  11392.         Finish        :positive;
  11393.         BufferToSmall :exception;
  11394.     begin
  11395.         Start := ((Result'length - S'length) / 2) + 1;
  11396.         Finish := Start + S'length - 1;
  11397.         if S'length > Width then
  11398.             raise BufferToSmall;
  11399.         else
  11400.             Result(Start..Finish) := S(S'range);
  11401.             return Result;
  11402.         end if;
  11403.     end Center;
  11404.      
  11405. --------------------------------------------------------------------------
  11406.      
  11407.     function RightJustify (  --| Right justify the string S in a buffer
  11408.                              --| whose width is Width.
  11409.       S      :in     String;
  11410.       Width  :in     positive
  11411.     ) return String is
  11412.         Result        :String(1..Width) := (others => ' ');
  11413.         Start         :positive;
  11414.         Finish        :positive;
  11415.         BufferToSmall :exception;
  11416.     begin
  11417.         if S'length > Width then
  11418.             raise BufferToSmall;
  11419.         else
  11420.             Start := (Result'length - S'length) + Result'first;
  11421.             Finish := Result'last;
  11422.             Result (Start..Finish) := S(S'range);
  11423.             return Result;
  11424.         end if;
  11425.     end RightJustify;
  11426.      
  11427. --------------------------------------------------------------------------
  11428.      
  11429.     function LeftJustify ( --| Left justify the string S in a buffer
  11430.                            --| of blanks whose width is Width.
  11431.       S      :in    String;
  11432.       Width  :in    positive
  11433.     ) return String is
  11434.         Finish        :positive;
  11435.         Result        :String (1..Width) := (others => ' ');
  11436.         BufferToSmall :exception;
  11437.     begin
  11438.         if S'length > Width then
  11439.             raise BufferToSmall;
  11440.         else
  11441.             Finish := Result'first + S'length - 1;
  11442.             Result (Result'first..Finish) := S(S'range);
  11443.             return Result;
  11444.         end if;
  11445.     end LeftJustify;
  11446.      
  11447. --------------------------------------------------------------------------
  11448.      
  11449.     function StripTrailingBlanks ( --| Remove all trailing blanks from
  11450.                                    --| a string.
  11451.                Token :in     String
  11452.     ) return String is
  11453.      
  11454.     begin
  11455.         for i in reverse Token'range loop
  11456.             if Token(i) /= ' ' then
  11457.                 -- ith character is not a blank so return
  11458.                 -- Token(Token'first..i)
  11459.                 return Token(Token'first..i);
  11460.             end if;
  11461.         end loop;
  11462.         return "";
  11463.     end StripTrailingBlanks;
  11464.      
  11465. --------------------------------------------------------------------------
  11466.      
  11467.     function IntTruncAndConvert (     --| Truncates and Converts an
  11468.                                       --| integer to a string of a given
  11469.                                       --| length.
  11470.       I     :in integer;
  11471.       Width :in integer
  11472.     ) return String is
  11473.      
  11474.         Result :constant String := integer'image(I);
  11475.     begin
  11476.         -- Since image returns a leading blank the number of
  11477.         -- digits in I is length'Result - 1
  11478.      
  11479.         if Result'length - 1 > Width then
  11480.             return Result(2..2 + Width - 1);
  11481.         else
  11482.             return Result(2..Result'length);
  11483.         end if;
  11484.     end IntTruncAndConvert;
  11485.      
  11486. --------------------------------------------------------------------------
  11487.      
  11488.     function Float_To_Int_Str (
  11489.       X  :in     Float
  11490.     ) return String is
  11491.     begin
  11492.         return Integer'Image(Integer(X));
  11493.  
  11494.     end Float_To_Int_Str;
  11495.      
  11496. --------------------------------------------------------------------------
  11497.      
  11498.     function FirstNonBlank (
  11499.       S :in    String
  11500.     ) return natural is
  11501.         Position :natural := S'first;
  11502.     begin
  11503.         while (S(Position) = ' ') and (Position <= S'last) loop
  11504.             Position := Position + 1;
  11505.         end loop;
  11506.         if Position in S'Range then
  11507.             return Position;
  11508.         else
  11509.             return 0;
  11510.         end if;
  11511.     end FirstNonBlank;
  11512.      
  11513. --------------------------------------------------------------------------
  11514.      
  11515.     function Float_To_Dec_Str (
  11516.       X  :in     Float
  11517.     ) return String is
  11518.         TimesX  :Float;
  11519.     begin
  11520.         --| OVERVIEW
  11521.         --| This function takes a Float and returns the image of the
  11522.         --| number in decimal notation.  The number it returns has two
  11523.         --| places to the right of the decimal point or if the number is
  11524.         --| an integer it leaves two blanks.
  11525.      
  11526.         if X < 0.01 then
  11527.             return "<0.01";
  11528.     elsif X > 1000000.0 then
  11529.             return ">1000000   ";
  11530.         end if;
  11531.      
  11532.         TimesX := X * 100.0;
  11533.         declare
  11534.             StrTimesX: constant String := Integer'Image(Integer(TimesX));
  11535.             Result            :String (1..StrTimesX'length + 1);
  11536.             FirstDigitPos     :positive;
  11537.             LastDigitPos      :positive;
  11538.             NumberOfDigits    :positive;
  11539.             DecimalFillSpaces :constant String := "   ";
  11540.               --| This ensures that there are three spaces to the right of
  11541.               --| ones places.  This keeps all the numbers in line.
  11542.         begin
  11543.             if Integer(TimesX) = 0 then
  11544.                 return "0" & DecimalFillSpaces ;
  11545.             else
  11546.                 FirstDigitPos := FirstNonBlank (StrTimesX);
  11547.                 NumberOfDigits := StrTimesX'last - FirstDigitPos + 1;
  11548.                 if StrTimesX(StrTimesX'last - 1..StrTimesx'Last) = "00"
  11549.                    then
  11550.                        return
  11551.                        StrTimesX(StrTimesX'First..StrTimesx'last - 2) &
  11552.                        DecimalFillSpaces;
  11553.                 end if;
  11554.      
  11555.                 case NumberOfDigits is
  11556.                   when 1 =>
  11557.                     Result(1..2) := ".0";
  11558.                     return Result(1..2) & StrTimesX (FirstDigitPos);
  11559.      
  11560.                   when 2 =>
  11561.                     Result(1) := '.';
  11562.                     Result(2..3) :=
  11563.                       StrTimesX
  11564.                        (FirstDigitPos..FirstDigitPos + NumberOfDigits -1);
  11565.                     return Result (1..3);
  11566.      
  11567.                   when others =>
  11568.                     LastDigitPos := FirstDigitPos + NumberOfDigits - 1;
  11569.                     Result(1..NumberOfDigits - 2) :=
  11570.                       StrTimesX (FirstDigitPos..LastDigitPos - 2);
  11571.                     Result(NumberOfDigits - 2  + 1) := '.';
  11572.                     Result(NumberOfDigits..NumberOfDigits + 1) :=
  11573.                       StrTimesX (LastDigitPos - 1..LastDigitPos);
  11574.                     return Result (1..NumberOfDigits + 1);
  11575.      
  11576.                 end case;
  11577.             end if;
  11578.         end;
  11579.     end Float_To_Dec_Str;
  11580.      
  11581. --------------------------------------------------------------------------
  11582.      
  11583.     procedure InsertInBuffer (  --| Insert the string "Insert" into Buffer
  11584.                                 --| preceeding a right Justified Field
  11585.                                 --| and a field which may have to be
  11586.                                 --| truncated with at least one blank.
  11587.                                 --| A left justified field does not have
  11588.                                 --| a blank preceeding it.
  11589.        Buffer       :in out String;
  11590.        Insert       :in     String;
  11591.        StartPos     :in     positive;
  11592.        EndPos       :in     positive
  11593.    ) is
  11594.    begin
  11595.        Buffer (StartPos..EndPos) := Insert(Insert'Range);
  11596.    end InsertInBuffer;
  11597.      
  11598. --------------------------------------------------------------------------
  11599.      
  11600.     procedure PrintBlockId (  --| This procedure prints the identifying
  11601.                               --| information for a block when producing
  11602.                               --| the report.
  11603.       BlockId: in    BlockIdType
  11604.     ) is
  11605.     begin
  11606.          --| OVERVIEW
  11607.          --| This prints
  11608.          --|   1.  the kind of block
  11609.          --|   2.  whether the block is a spec or body
  11610.          --|   3.  the name of the block
  11611.          --|   4.  the line number where the block appears in the source
  11612.      
  11613.          --| ALGORITHM
  11614.          --| Check if this is a declare block which is unnamed.  If it is
  11615.          --| then process it differently.
  11616.      
  11617.          if BlockId.KindOfBlock = Definitions.declare_block
  11618.             and then
  11619.             BlockId.BlockName.all(
  11620.               BlockId.BlockName.all'first..BlockId.BlockName.all'last
  11621.                                  )= ""
  11622.          then
  11623.             Put ("UNNAMED DECLARE BLOCK");
  11624.          else
  11625.             Put (StripTrailingBlanks (BlockStrings(BlockId.KindOfBlock)));
  11626.             Put (" ");
  11627.             Put (StripTrailingBlanks (BlockId.SpcBdyId));
  11628.             Put (" OF ");
  11629.             Put (
  11630.               BlockId.BlockName.all(
  11631.                 BlockId.BlockName.all'first..BlockId.BlockName.all'last
  11632.                                    )
  11633.                 );
  11634.          end if;
  11635.          Put (" AT LINE ");
  11636.          Put (BlockId.LineLocation);
  11637.          New_Line (Spacing => 2);
  11638.     end PrintBlockId;
  11639.      
  11640. --------------------------------------------------------------------------
  11641.      
  11642.     procedure PrintInfo (
  11643.       BlockId: in    BlockIdType;
  11644.       Metrics: in    MetricsRecord
  11645.     ) is
  11646.       subtype BufferType is String (1..MaxLineLength);
  11647.       Output       :BufferType;
  11648.       Blanks       :BufferType := (others => ' ');
  11649.       LabelLength  :constant positive := 20;
  11650.       subtype LabelType is String (1..LabelLength);
  11651.       subtype Metric_Index is natural range 1..NumberOfMetrics + 1;
  11652.       MetricLabels :constant array (Metric_Index) of LabelType:=
  11653.                           ( "UNIQUE OPERATORS    ",
  11654.                             "UNIQUE OPERANDS     ",
  11655.                             "TOTAL OPERATORS     ",
  11656.                             "TOTAL OPERANDS      ",
  11657.                             "VOCABULARY          ",
  11658.                             "                    ",
  11659.                             "PROGRAM LENGTH      ",
  11660.                             "ESTIMATED LENGTH    ",
  11661.                             "PROGRAM VOLUME      ",
  11662.                             "POTENTIAL VOLUME    ",
  11663.                             "PROGRAM LEVEL       ",
  11664.                             "ESTIMATED LEVEL     ",
  11665.                             "INTELLIGENCE CONTENT",
  11666.                             "PROGRAMMING EFFORT  ",
  11667.                             "PROGRAMMING TIME    ",
  11668.                             "LANGUAGE LEVEL      ",
  11669.                             "DELIVERED ERRORS    ",
  11670.                             "ESTIMATED ERRORS    "
  11671.                             );
  11672.            --| This array has one extra space for a metric.  This is
  11673.            --| to make producing the report easier.
  11674.      
  11675.     subtype metric_range is integer range 1..NumberOfMetrics + 1;
  11676.          ProcessArray     :array (metric_Range) of Float;
  11677.            --| This array has one extra space for a metric.  This is
  11678.            --| to make producing the report easier.
  11679.      
  11680.          NumberOfMetricLines :constant positive := 9;
  11681.          FirstColValueField  :positive; -- := LabelLength + 2;
  11682.          FirstCol            :constant positive := 1;
  11683.          EndFirstCol         :constant positive := 38;
  11684.          SecondCol           :constant positive := 41;
  11685.          EndSecondCol        :constant positive  := 80;
  11686.          SecondColValueField :positive; -- := SecondCol+LabelLength+2- 1;
  11687.          i                   :integer;
  11688.    begin
  11689.         --| OVERVIEW
  11690.         --| This procedure produces the report for a block. The format of
  11691.         --| the report is the following:
  11692.         --|
  11693.         --|---------------------------------------------------------------
  11694.         --|        HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF LIBRARY UNIT C36205D
  11695.         --|
  11696.         --|
  11697.         --| PROCEDURE SPECIFICATION OF C36205D AT LINE 12
  11698.         --|
  11699.         --| UNIQUE OPERATORS                  5     UNIQUE OPERANDS                    <0.01
  11700.         --| TOTAL OPERATORS                   6     TOTAL OPERANDS                     <0.01
  11701.         --| VOCABULARY                        5
  11702.         --| PROGRAM LENGTH                    6     ESTIMATED LENGTH                   11.61
  11703.         --| PROGRAM VOLUME                   13.93  POTENTIAL VOLUME                    2
  11704.         --| PROGRAM LEVEL                      .14  ESTIMATED LEVEL                    <0.01
  11705.         --| INTELLIGENCE CONTENT             <0.01  PROGRAMMING EFFORT                 97.06
  11706.         --| PROGRAMMING TIME                 19.41  LANGUAGE LEVEL                       .29
  11707.         --| DELIVERED ERRORS                 <0.01  ESTIMATED ERRORS                   <0.01
  11708.         --|
  11709.         --|---------------------------------------------------------------
  11710.         --| The object FirstCol refers to the labels on the left hand side
  11711.         --| of the report.  These are UNIQUE OPERATORS, TOTAL OPERATORS
  11712.         --| and so on.  FirstColValueField is the refers to the leftmost
  11713.         --| position of the field where the numbers appear.
  11714.         --| The object SecondCol refers to the leftmost position of the
  11715.         --| labels for the second column.  These are UNIQUE OPERANDS,
  11716.         --| TOTAL OPERANDS and so forth.  SecondColValueField refers to
  11717.         --| the leftmost position of the value field.  In this report
  11718.         --| are left justified  or right justified in relation to a field.
  11719.      
  11720.         FirstColValueField := LabelLength + 2;
  11721.         SecondColValueField := SecondCol + LabelLength + 2 - 1;
  11722.         PrintBlockId (BlockId);
  11723.         ProcessArray(1) := Metrics.UniqueOperators;
  11724.         ProcessArray(2) := Metrics.UniqueOperands;
  11725.         ProcessArray(3) := Metrics.OperatorUsage;
  11726.         ProcessArray(4) := Metrics.OperandUsage;
  11727.         ProcessArray(5) := Metrics.Vocabulary;
  11728.         ProcessArray(6) := 0.0;
  11729.         ProcessArray(7) := Metrics.ProgramLength;
  11730.         ProcessArray(8) := Metrics.EstimatedProgramLength;
  11731.         ProcessArray(9) := Metrics.ProgramVolume;
  11732.         ProcessArray(10) := Metrics.PotentialVolume;
  11733.         ProcessArray(11) := Metrics.ProgramLevel;
  11734.         ProcessArray(12) := Metrics.ProgramLevelApprox;
  11735.         ProcessArray(13) := Metrics.IntelligenceContent;
  11736.         ProcessArray(14) := Metrics.ProgrammingEffort;
  11737.         ProcessArray(15) := Metrics.ProgrammingTime;
  11738.         ProcessArray(16) := Metrics.LanguageLevel;
  11739.         ProcessArray(17) := Metrics.NumberOfDeliveredErrors;
  11740.         ProcessArray(18) := Metrics.ApproxNumberOfDeliveredErrors;
  11741.         Output := Blanks;
  11742.         for j in 1..NumberOfMetricLines loop
  11743.             i := (j * 2) - 1;
  11744.             InsertInBuffer (Output,
  11745.                             MetricLabels(i),
  11746.                             FirstCol,
  11747.                             LabelLength);
  11748.             InsertInBuffer (Output,
  11749.                             RightJustify (
  11750.                                  Float_To_Dec_Str (ProcessArray(i)),
  11751.                                  EndFirstCol - FirstColValueField + 1
  11752.                                          ),
  11753.                             FirstColValueField,
  11754.                             EndFirstCol);
  11755.      
  11756.               -- Only do the following if i is not equal to 5 because
  11757.               -- if i equals 5 then we are processing the third line
  11758.               -- which doesn't have a second column so skip it.
  11759.             if i /= 5 then
  11760.                  InsertInBuffer (Output,
  11761.                                  MetricLabels(i + 1),
  11762.                                  SecondCol,
  11763.                                  SecondCol + LabelLength - 1);
  11764.                  InsertInBuffer (Output,
  11765.                                  RightJustify (
  11766.                                   Float_To_Dec_Str (ProcessArray(i + 1) ),
  11767.                                   EndSecondCol - SecondColValueField + 1
  11768.                                               ),
  11769.                                  SecondColValueField,
  11770.                                  EndSecondCol);
  11771.             end if;
  11772.             Put_Line (Output);
  11773.             Output := Blanks;
  11774.         end loop;
  11775.      
  11776.           -- Clear screen if printing to terminal.
  11777.           -- If writing to a file add two lines of spacing.
  11778.      
  11779.         if ToTerminal then
  11780.            New_Line (Spacing => NumberOfLinesToClearScreen);
  11781.         else
  11782.            New_Line (Spacing => 2);
  11783.         end if;
  11784.     end PrintInfo;
  11785.      
  11786. --------------------------------------------------------------------------
  11787.      
  11788.     function CopyQualifiedName (
  11789.       FullyQualifiedName :in      StringPtr
  11790.     ) return StringPtr is
  11791.      
  11792.     begin
  11793.         return new String ' (FullyQualifiedName.all);
  11794.  
  11795.     end CopyQualifiedName;
  11796.      
  11797. --------------------------------------------------------------------------
  11798.      
  11799. procedure ExtendQualifiedName (
  11800.                QualifiedName     :in out StringPtr;
  11801.                Extension         :in     String
  11802. ) is
  11803.      
  11804.   --| ALGORITHM
  11805.   --| Concatentate FullyQualifiedName with "." and the Extension
  11806.   --| then return the access to this.  Free the space used by the
  11807.   --| QualifiedName.
  11808.      
  11809. begin
  11810.     if Extension /= "" then
  11811.         if QualifiedName.all /= "" then
  11812.             QualifiedName :=
  11813.             new String ' (QualifiedName.all & "." & Extension);
  11814.         else
  11815.             QualifiedName := new String ' (Extension);
  11816.         end if;
  11817.     end if;
  11818. end ExtendQualifiedName;
  11819.      
  11820. --------------------------------------------------------------------------
  11821.      
  11822. procedure TruncateQualifiedName (
  11823.                FullyQualifiedName     :in out StringPtr
  11824. ) is
  11825.      
  11826.   --| ALGORITHM
  11827.   --| Remove the last qualification from FullyQualifiedName.
  11828.   --| When changing FullyQualifiedName free the space used by the
  11829.   --| old value.
  11830.      
  11831.     Trash :StringPtr := FullyQualifiedName;
  11832. begin
  11833.     for i in reverse FullyQualifiedName.all'range  loop
  11834.         if FullyQualifiedName(i) = '.' then
  11835.            FullyQualifiedName :=  new String '
  11836.              (FullyQualifiedName(FullyQualifiedName.all'first..i-1));
  11837.            Free (Trash);
  11838.            return;
  11839.         end if;
  11840.     end loop;
  11841.     Free (Trash);
  11842.     FullyQualifiedName := new String ' ("");
  11843. end TruncateQualifiedName;
  11844.      
  11845. --------------------------------------------------------------------------
  11846.      
  11847.      
  11848. --------------------------------------------------------------------------
  11849. --                          VISIBLE SUBPROGRAMS
  11850. --------------------------------------------------------------------------
  11851.      
  11852.      
  11853. --------------------------------------------------------------------------
  11854.      
  11855.    procedure ReportHeader (
  11856.      UnitName : String;
  11857.      Spec     : boolean
  11858.    ) is
  11859.    begin
  11860.       if Spec then
  11861.           Put_Line (
  11862.              Center  (
  11863.                   "HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF" &
  11864.                   " LIBRARY UNIT " & UnitName,
  11865.                    MaxLineLength
  11866.                      )
  11867.      
  11868.               );
  11869.       else
  11870.           Put_Line (
  11871.           Center ("HALSTEAD COMPLEXITY FOR THE BODY OF LIBRARY UNIT " &
  11872.                   UnitName,
  11873.                    MaxLineLength
  11874.                  )
  11875.               );
  11876.       end if;
  11877.       New_Line (Spacing => 2);
  11878.    end ReportHeader;
  11879.      
  11880. --------------------------------------------------------------------------
  11881.      
  11882.    procedure InitializeData (
  11883.        LibraryUnit          :in     String;
  11884.        IsUnitSpec           :in     boolean;
  11885.        VerboseFlag          :in     boolean;
  11886.        ToTerminalFlag       :in     boolean;
  11887.        OuterMostBlockFlag   :in     boolean
  11888.    ) is
  11889.    begin
  11890.      
  11891.        UnitName := new String ' (LibraryUnit(LibraryUnit'range));
  11892.        FullyQualifiedName := new String ' ("");
  11893.        UnitSpec := IsUnitSpec;
  11894.        VerboseOn := VerboseFlag;
  11895.        ToTerminal := ToTerminalFlag;
  11896.        OuterMostBlockSeen := OuterMostBlockFlag;
  11897.        if ToTerminal then
  11898.            New_Page;
  11899.        end if;
  11900.    end InitializeData;
  11901.      
  11902. --------------------------------------------------------------------------
  11903.      
  11904.     procedure IncrementToken (
  11905.       T :in     TokenItem
  11906.     ) is
  11907.      
  11908.     begin
  11909.         CurrentBlock.TokenCount(T) := CurrentBlock.TokenCount(T) + 1;
  11910.     end IncrementToken;
  11911.      
  11912. --------------------------------------------------------------------------
  11913.      
  11914.     procedure FreeSpace (
  11915.       CurrentBlock :in out BlockInfoType
  11916.     ) is
  11917.     begin
  11918.         Literal_Set.Destroy (CurrentBlock.SetOfLiterals);
  11919.         DEF_ID_Set.Destroy (CurrentBlock.SetOfDEF_IDs);
  11920.     end FreeSpace;
  11921.      
  11922.      
  11923. --------------------------------------------------------------------------
  11924.      
  11925.     function InitializeCurrentBlock return BlockInfoType is
  11926.         ClearedBlock :BlockInfoType;
  11927.     begin
  11928.         for t in TokenItem loop
  11929.             ClearedBlock.TokenCount(t) := 0;
  11930.         end loop;
  11931.         ClearedBlock.BlockId.BlockName := null;
  11932.         ClearedBlock.BlockId.KindOfBlock := declare_block;
  11933.         ClearedBlock.BlockId.SpcBdyId := AnonId;
  11934.         ClearedBlock.SetOfLiterals := Literal_Set.Create;
  11935.         ClearedBlock.SetOfDEF_IDs := DEF_ID_Set.Create;
  11936.         return ClearedBlock;
  11937.     end InitializeCurrentBlock;
  11938.      
  11939. --------------------------------------------------------------------------
  11940.      
  11941.     function LineNumber (
  11942.                    Position      :in     MLSP.Source_Position
  11943.     ) return MLSP.Source_Line is
  11944.      
  11945.         -- Get the line number of Position.
  11946.     begin
  11947.         return MLSP.Line (Position.first_location);
  11948.     end LineNumber;
  11949.      
  11950. --------------------------------------------------------------------------
  11951.      
  11952.      
  11953.     function IsSourceRange (
  11954.                    Position :in     MLSP.Source_Position
  11955.     ) return boolean is
  11956.      
  11957.          --| ALGORITHM
  11958.          --| If Position.first_position /= Position.last_position then
  11959.          --|    Position is a range and return true
  11960.          --| else
  11961.          --|    Position is not a range and return false
  11962.      
  11963.     begin
  11964.      return
  11965.           not MLSP."=" (Position.first_location, Position.last_location);
  11966.     end;
  11967.      
  11968. --------------------------------------------------------------------------
  11969.      
  11970.     procedure SetBlockId (
  11971.       ScopeName    :in    Symbol_repNode.Locator;
  11972.       KindOfBlock  :in    BlockKind;
  11973.       SpcBdyId     :in    SpcBdyIdType;
  11974.       Line_Number  :in    MLSP.Source_Line
  11975.     ) is
  11976.     begin
  11977.           -- If the ScopeName is "" then we have an unamed declare block.
  11978.         if SymRepToString (ScopeName) = "" then
  11979.             CurrentBlock.BlockId.BlockName := new  String ' ("");
  11980.         else
  11981.             ExtendQualifiedName (
  11982.               FullyQualifiedName, SymRepToString (ScopeName)
  11983.                                 );
  11984.             CurrentBlock.BlockId.BlockName :=
  11985.               CopyQualifiedName (FullyQualifiedName);
  11986.         end if;
  11987.         CurrentBlock.BlockId.KindOfBlock := KindOfBlock;
  11988.         CurrentBlock.BlockId.SpcBdyId := SpcBdyId;
  11989.         CurrentBlock.BlockId.LineLocation := Line_Number;
  11990.      
  11991.     end SetBlockId;
  11992.      
  11993. --------------------------------------------------------------------------
  11994.      
  11995.     procedure ProcessBlockInfo (
  11996.       BlockInfo: in BlockInfoType
  11997.     ) is
  11998.         Nn      :CT.NnInfoType;
  11999.           --| The counts in Nn represent the counts of operators and
  12000.           --| operands for Literal_Analysis and DEF_ID_Analysis.
  12001.         NnToken :CT.NnInfoType;
  12002.           --| This object keeps the counts of operators and operands
  12003.           --| which pertain to the reserved words and other syntactic
  12004.           --| constructs.
  12005.         Metrics :MetricsRecord;
  12006.         N2Star  :natural := 0;
  12007.     begin
  12008.         if VerboseOn then
  12009.             Put_Line (Standard_Output, "DEF_ID_Analysis ");
  12010.         end if;
  12011.         DEF_ID_Analysis (BlockInfo.SetOfDEF_IDs, Nn, N2Star);
  12012.         if VerboseOn then
  12013.             Put_Line (Standard_Output, "Literal_Analysis");
  12014.         end if;
  12015.         Literal_Analysis (BlockInfo.SetOfLiterals, Nn);
  12016.              CT.ZeroCount (NnToken);
  12017.              C.HalsteadCount (BlockInfo.TokenCount, VerboseOn, NnToken);
  12018.              if VerboseOn then
  12019.                  New_Line (Standard_Output);
  12020.                      Put_Line (Standard_Output,"------------------------------");
  12021.                      Put_Line (Standard_Output,"This separates countable units");
  12022.                      Put_Line (Standard_Output,"------------------------------");
  12023.                      New_Line (Standard_Output);
  12024.              end if;
  12025.      
  12026.              MetricCalculations (
  12027.                CT.AddCounts (Nn, NnToken), N2Star, Metrics
  12028.                                 );
  12029.                   if ToTerminal then
  12030.                         -- This block is needed because the boot seems to
  12031.                    -- have trouble with
  12032.                    -- ReportHeader (UnitName.all,UnitSpec);
  12033.                         -- UnitName.all is causing the problem.
  12034.                       declare
  12035.                      LocalString : constant String :=
  12036.                        UnitName.all(UnitName.all'range);
  12037.                       begin
  12038.                      ReportHeader (LocalString, UnitSpec);
  12039.                       end;
  12040.                   end if;
  12041.      
  12042.                   PrintInfo (BlockInfo.BlockId, Metrics);
  12043.            -- Truncate the current Scope Name.
  12044.         TruncateQualifiedName (FullyQualifiedName);
  12045.     end ProcessBlockInfo;
  12046.      
  12047. --------------------------------------------------------------------------
  12048.      
  12049. end Halstead_Data_Base;
  12050.      
  12051. ::::::::::::::
  12052. hdb.spc
  12053. ::::::::::::::
  12054. -- $Source :/nosc/work/tools/halstead/RCS/utils.spc,v $
  12055. -- $Revision :1.11 $ -- $Date: 85/02/21 08:22:23 $ -- $Author: buddy $
  12056.      
  12057. with St_Diana; use St_Diana;
  12058. with Definitions; use Definitions;
  12059. with ML_Source_Position_Pkg;
  12060.      
  12061. package Halstead_Data_Base is
  12062.      
  12063. --| OVERVIEW
  12064. --| This package holds the major global data structures and subprograms
  12065. --| used to implement the Halstead Complexity Measures.
  12066.      
  12067. --| EFFECTS
  12068. --| This package has the data structures and subprograms used to compute
  12069. --| the Halstead measures.  ProcessBlock organizes the processing of the
  12070. --| block's information.  This entails counting the tokens as either
  12071. --| operators or operands, determining the operand and operator Vocabulary
  12072. --| and counting the total usage of operators and operands.
  12073. --| It also involves counting the number of literals and performing
  12074. --| analysis on all the identifiers in the block.  Keeping track of the
  12075. --| literals is performed by AddLiteral. This maintains a counted set
  12076. --| of all the literals in the current block.  The literal are counted
  12077. --| as operands in the Halstead metrics.
  12078. --| Analyzing the identifiers in the block is done in the subprogram
  12079. --| DEF_ID_ANALYS.The identifiers are classified according to semantic
  12080. --|information provided by DIANA.
  12081.      
  12082. --| TUNING
  12083. --| The procedure IncrementToken should be in lined using a pragma.
  12084.      
  12085. --------------------------------------------------------------------------
  12086. --               VISIBLE OBJECTS
  12087. --------------------------------------------------------------------------
  12088.      
  12089.     package MLSP renames ML_Source_Position_Pkg;
  12090.      
  12091.     CurrentBlock      :BlockInfoType;
  12092.       --| This contains the information about the block currently
  12093.       --| being processed.  When a new block is encountered it is
  12094.       --| this information which gets pushed on the stack.
  12095.      
  12096.     BlockStack        :BlockInfoStack.Stack;
  12097.       --| This structure stacks the information in the current block      .
  12098.       --| Thus information is pushed onto the stack when we enter a
  12099.       --| new block and popped from the stack when we exit a block.
  12100.       --| This is used to reflect the visibility of operators and
  12101.       --| operands.
  12102.      
  12103.     OutermostBlockSeen :boolean;
  12104.       --| This is used to indicate that the outermost scope of the
  12105.       --| compilation unit has been seen.  This is necessary because
  12106.       --| to include the context clauses as adding to the complexity of
  12107.       --| the outermost compilation unit.
  12108.      
  12109.     FullyQualifiedName :StringPtr;
  12110.       --| This is the fully qualified name of the current scope.  This
  12111.       --| string is used in identifying the current scope in the output.
  12112.      
  12113.     UnitName           :StringPtr;
  12114.       --| This is the name of library unit currently being processed.
  12115.       --| It is an access to a string since we don't know how long the
  12116.       --| will be.
  12117.      
  12118.     UnitSpec           :boolean;
  12119.       --| This indicates whether the unit which is currently being
  12120.       --| processed is a specification or a body.
  12121.      
  12122.      
  12123.     VerboseOn          :boolean;
  12124.       --| This boolean is used to control the printing of
  12125.       --| information pertaining to token counting.  This shows
  12126.       --| tokens are counted, and what they are counted as.
  12127.       --| This information is always written to standard output.
  12128.       --| This paramater is set from the command line. The default
  12129.       --| for this is false.
  12130.      
  12131.     ToTerminal   :boolean;
  12132.       --| This boolean is true if the user has not specified an output
  12133.       --| file which means the report is going to standard_output
  12134.       --| which is the terminal.
  12135.      
  12136. --------------------------------------------------------------------------
  12137. --                VISIBLE SUBPROGRAMS
  12138. --------------------------------------------------------------------------
  12139.      
  12140. --------------------------------------------------------------------------
  12141.      
  12142.     procedure InitializeData (  --| This procedure passes the values
  12143.                           --| of certain
  12144.                           --| from the driver to this package which uses
  12145.                           --| it in producing the report.  It needs the
  12146.                           --| the name of the library unit, whether the
  12147.                           --| library unit is a specicification or a body,
  12148.                           --| if the verbose flag is set, and whether the
  12149.                           --| report is going to the terminal.
  12150.      
  12151.        LibraryUnit           :in    String;
  12152.        IsUnitSpec            :in    boolean;
  12153.        VerboseFlag           :in    boolean;
  12154.        ToTerminalFlag        :in    boolean;
  12155.        OuterMostBlockFlag    :in    boolean
  12156.     );
  12157.      
  12158. --------------------------------------------------------------------------
  12159.      
  12160.    procedure ReportHeader  (   --| This prints the header for a Library
  12161.                                --| Unit.
  12162.              UnitName  : String;
  12163.              Spec      : boolean
  12164.    );
  12165.      
  12166. --------------------------------------------------------------------------
  12167.      
  12168.     function InitializeCurrentBlock  --| This function returns a record
  12169.                                      --| of type BlockInfoType which is
  12170.                                      --| initialized.
  12171.     return BlockInfoType;
  12172.      
  12173.     --| OVERVIEW
  12174.     --| This function is used before starting the scan of DIANA and
  12175.     --| then after a Push of CurrentBlock onto the stack.
  12176.      
  12177.     --| EFFECTS
  12178.     --| This function sets the TokenCount for each TokenItem to be 0.
  12179.     --| It also set the LiterSet to be empty and the ListOfDEF_ID to
  12180.     --| empty.
  12181.      
  12182. --------------------------------------------------------------------------
  12183.      
  12184.     procedure IncrementToken ( --| This procedure increments the count of
  12185.                                --| of the given token for the current
  12186.                                --| block.
  12187.      
  12188.               T :in    TokenItem
  12189.                 --| Token whose count is being incremented.
  12190.      );
  12191.      
  12192.      --| OVERVIEW
  12193.      --| This procedure is called during the tree walking when the DIANA
  12194.      --| node which corresponds to the token T has been scanned.
  12195.      
  12196.      --| MODIFIES
  12197.      --| This increments CurrentBlock.TokenCount (T) which is the
  12198.      --| number of occurrences of the token T in the current block.
  12199.      
  12200.      --| TUNING
  12201.      --| This procedure should be pragma inlined.
  12202.      
  12203. --------------------------------------------------------------------------
  12204.      
  12205.     function LineNumber (
  12206.                    Position      :in     MLSP.Source_Position
  12207.     ) return MLSP.Source_Line;
  12208.      
  12209.     --| RAISES
  12210.     --|
  12211.      
  12212.     --| OVERVIEW
  12213.     --| Checks whether Position is a Source_Location or source_range.
  12214.     --| It then returns the line number of the starting position.
  12215.      
  12216.     --| EFFECTS
  12217.     --|
  12218.      
  12219.     --| REQUIRES
  12220.     --|
  12221.      
  12222.     --| MODIFIES
  12223.     --|
  12224.      
  12225.     --| ERRORS
  12226.     --|
  12227.      
  12228.     --| N/A
  12229.     --|
  12230.      
  12231.     --| TUNING
  12232.     --|
  12233.      
  12234.     --| NOTES
  12235.     --|
  12236.      
  12237. --------------------------------------------------------------------------
  12238.      
  12239.     function IsSourceRange (
  12240.                    Position :in     MLSP.Source_Position
  12241.     ) return boolean;
  12242.      
  12243.     --| RAISES
  12244.     --|
  12245.      
  12246.     --| OVERVIEW
  12247.     --| This procedure checks if the Position is a source range.  In
  12248.     --| the diana this indicate that the token had a beginning source
  12249.     --| location and an ending source location.  Other tokens simply
  12250.     --| had a source point which was where the start of the token
  12251.     --| was in the source ( a line number and column position).
  12252.     --| The distinction between source_range and source_point is
  12253.     --| useful for distinguishing certain diana constructs.
  12254.      
  12255. --------------------------------------------------------------------------
  12256.      
  12257.      procedure SetBlockId (  --| This procedure initializes the
  12258.                              --| identifying fields for the block.
  12259.      
  12260.           ScopeName   :in  Symbol_repNode.Locator;
  12261.             --| This is a Locator to the name of the block.
  12262.      
  12263.           KindOfBlock :in  BlockKind;
  12264.             --| This is the kind of block. This can be a procedure,
  12265.             --| function, package, task or declare block.
  12266.      
  12267.           SpcBdyId    :in  SpcBdyIdType;
  12268.             --| This indicates whether the block is a spec or a body.
  12269.      
  12270.           Line_Number :in  MLSP.Source_Line
  12271.      );
  12272.      
  12273.      --| OVERVIEW
  12274.      --| This is used in the tree walk of DIANA when a node is
  12275.      --| scanned which indicates the name and type of the block.
  12276.      --| Typically a DEF_ID will be associated with a package, or
  12277.      --| subprogram, or task.  The information passed to the
  12278.      --| routine is used in the reporting phase.
  12279.      
  12280.      --| MODIFIES
  12281.      --| This updates the BlockId component of CurrentBlock.
  12282.      
  12283.      --| EFFECTS
  12284.      --| The information in BlockId is used in the output routines to
  12285.      --| indicate the block.
  12286.      
  12287. --------------------------------------------------------------------------
  12288.      
  12289.     procedure FreeSpace (   --| Frees all the heap space which this
  12290.                             --| record uses.
  12291.      
  12292.               CurrentBlock :in out BlockInfoType
  12293.     );
  12294.      
  12295. --------------------------------------------------------------------------
  12296.      
  12297.     procedure ProcessBlockInfo (   --| Processes the information gathered
  12298.                                    --| for the current block.
  12299.        BlockInfo :in BlockInfoType
  12300.          --| This is the information for the block.
  12301.     );
  12302.      
  12303.     --| OVERVIEW
  12304.     --| This procedure computes and output the Halstead Metrics for the
  12305.     --| current block.  This procedure is invoked in the DIANA treewalk
  12306.     --| after a node which is a block has been completely processed.
  12307.      
  12308. --------------------------------------------------------------------------
  12309.      
  12310. end Halstead_Data_Base;
  12311.      
  12312. ::::::::::::::
  12313. id_utils.bdy
  12314. ::::::::::::::
  12315. -- $Revision: 1.2 $ -- $Date: 86/02/06 18:05:16 $ -- $Author: buddy $
  12316.      
  12317. with ML_Source_Position_Pkg;
  12318. package body Identifier_Utilities is
  12319.     package MLSP renames ML_Source_Position_Pkg;
  12320.      
  12321. --| OVERVIEW
  12322. --| This package has utilities which are used in processing
  12323. --| DEF_ID's.
  12324.      
  12325.     function Is_Source_Position_Null (
  12326.         Position :in    MLSP.Source_Position
  12327.     ) return boolean;
  12328.      
  12329.     --| OVERVIEW
  12330.     --| This procedure returns true if the source position passed in
  12331.     --| is null.  This means that column and line of the
  12332.     --| Position.first_location is 0.
  12333.      
  12334.     function Is_Id_Null (
  12335.       Id :in     DEF_ID.Locator
  12336.     ) return boolean is
  12337.     begin
  12338.         return Is_Source_Position_Null (lx_srcpos (id));
  12339.     end;
  12340. --------------------------------------------------------------------------
  12341.      
  12342.     function Is_Source_Position_Null (
  12343.         Position :in    MLSP.Source_Position
  12344.     ) return boolean is
  12345.     begin
  12346.         return MLSP."=" (Position.first_location,0);
  12347.     end;
  12348. end Identifier_Utilities;
  12349.      
  12350.      
  12351. --------------------------------------------------------------------------
  12352.      
  12353.      
  12354. ::::::::::::::
  12355. id_utils.spc
  12356. ::::::::::::::
  12357. with ST_DIANA; use ST_DIANA;
  12358.  
  12359. package Identifier_Utilities is
  12360. --| OVERVIEW
  12361. --| This package has utilities which are used in processing
  12362. --| DEF_ID's.
  12363.      
  12364.     function Is_Id_Null (
  12365.       Id :in     DEF_ID.Locator
  12366.     ) return boolean ;
  12367.      
  12368. end Identifier_Utilities;
  12369. ::::::::::::::
  12370. ihagg_nam.dat
  12371. ::::::::::::::
  12372. -- Begin: IHagg_named dat ---------------------------------------------------
  12373.      
  12374. with ST_DIANA; use ST_DIANA;
  12375.              with Unchecked_Deallocation;
  12376. package agg_named_IH is
  12377.       type RecType is record
  12378.         ih_inagg_named : boolean;
  12379.       end record;
  12380.       R : RecType;
  12381. end agg_named_IH;
  12382. -- End: IHagg_named dat -----------------------------------------------------
  12383. ::::::::::::::
  12384. ihblock_s.dat
  12385. ::::::::::::::
  12386. -- Begin: IHblock_stm dat ---------------------------------------------------
  12387.      
  12388. with ST_DIANA; use ST_DIANA;
  12389.              with Unchecked_Deallocation;
  12390. package block_stm_IH is
  12391.       type RecType is record
  12392.         ih_inblock : boolean;
  12393.       end record;
  12394.       R : RecType;
  12395. end block_stm_IH;
  12396. -- End: IHblock_stm dat -----------------------------------------------------
  12397. ::::::::::::::
  12398. ihcase_al.dat
  12399. ::::::::::::::
  12400. -- Begin: IHcase_alternative dat ---------------------------------------------------
  12401.      
  12402. with ST_DIANA; use ST_DIANA;
  12403.              with Unchecked_Deallocation;
  12404. package case_alternative_IH is
  12405.       type RecType is record
  12406.         ih_incase_alternative : boolean;
  12407.       end record;
  12408.       R : RecType;
  12409. end case_alternative_IH;
  12410. -- End: IHcase_alternative dat -----------------------------------------------------
  12411. ::::::::::::::
  12412. ihgeneric.dat
  12413. ::::::::::::::
  12414. -- Begin: IHgeneric_header dat ---------------------------------------------------
  12415.      
  12416. with ST_DIANA; use ST_DIANA;
  12417.              with Unchecked_Deallocation;
  12418. package generic_header_IH is
  12419.       type RecType is record
  12420.         ih_ingeneric_param : boolean;
  12421.       end record;
  12422.       R : RecType;
  12423. end generic_header_IH;
  12424. -- End: IHgeneric_header dat -----------------------------------------------------
  12425. ::::::::::::::
  12426. ihhandler.dat
  12427. ::::::::::::::
  12428. -- Begin: IHhandler_alternative dat ---------------------------------------------------
  12429.      
  12430. with ST_DIANA; use ST_DIANA;
  12431.              with Unchecked_Deallocation;
  12432. package handler_alternative_IH is
  12433.       type RecType is record
  12434.         ih_inhandler_alternative : boolean;
  12435.       end record;
  12436.       R : RecType;
  12437. end handler_alternative_IH;
  12438. -- End: IHhandler_alternative dat -----------------------------------------------------
  12439. ::::::::::::::
  12440. ihinner_r.dat
  12441. ::::::::::::::
  12442. -- Begin: IHinner_record dat ---------------------------------------------------
  12443.      
  12444. with ST_DIANA; use ST_DIANA;
  12445.              with Unchecked_Deallocation;
  12446. package inner_record_IH is
  12447.       type RecType is record
  12448.         ih_in_variant : boolean;
  12449.       end record;
  12450.       R : RecType;
  12451. end inner_record_IH;
  12452. -- End: IHinner_record dat -----------------------------------------------------
  12453. ::::::::::::::
  12454. ihseries_.dat
  12455. ::::::::::::::
  12456. -- Begin: IHSERIES_UNIT dat ---------------------------------------------------
  12457.      
  12458. with ST_DIANA; use ST_DIANA;
  12459.              with Unchecked_Deallocation;
  12460. package SERIES_UNIT_IH is
  12461.       type RecType is record
  12462.         ih_inlist : boolean;
  12463.       end record;
  12464.       R : RecType;
  12465. end SERIES_UNIT_IH;
  12466. -- End: IHSERIES_UNIT dat -----------------------------------------------------
  12467. ::::::::::::::
  12468. ihsubtype.dat
  12469. ::::::::::::::
  12470. -- Begin: IHsubtype_decl dat ---------------------------------------------------
  12471.      
  12472. with ST_DIANA; use ST_DIANA;
  12473.              with Unchecked_Deallocation;
  12474. package subtype_decl_IH is
  12475.       type RecType is record
  12476.         ih_in_subtype_decl : boolean;
  12477.       end record;
  12478.       R : RecType;
  12479. end subtype_decl_IH;
  12480. -- End: IHsubtype_decl dat -----------------------------------------------------
  12481. ::::::::::::::
  12482. ihtask_de.dat
  12483. ::::::::::::::
  12484. -- Begin: IHtask_decl dat ---------------------------------------------------
  12485.      
  12486. with ST_DIANA; use ST_DIANA;
  12487.              with Unchecked_Deallocation;
  12488. package task_decl_IH is
  12489.       type RecType is record
  12490.         ih_intask_decl : boolean;
  12491.       end record;
  12492.       R : RecType;
  12493. end task_decl_IH;
  12494. -- End: IHtask_decl dat -----------------------------------------------------
  12495. ::::::::::::::
  12496. ihtype_de.dat
  12497. ::::::::::::::
  12498. -- Begin: IHtype_decl dat ---------------------------------------------------
  12499.      
  12500. with ST_DIANA; use ST_DIANA;
  12501.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  12502. package type_decl_IH is
  12503.       type RecType is record
  12504.         ih_typespec : Anykind;
  12505.         ih_basetype : DEF_ID.Locator;
  12506.       end record;
  12507.       R : RecType;
  12508. end type_decl_IH;
  12509. -- End: IHtype_decl dat -----------------------------------------------------
  12510. ::::::::::::::
  12511. ihvariabl.dat
  12512. ::::::::::::::
  12513. -- Begin: IHvariable_decl dat ---------------------------------------------------
  12514.      
  12515. with ST_DIANA; use ST_DIANA;
  12516.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  12517. package variable_decl_IH is
  12518.       type RecType is record
  12519.         ih_vartype : MARK.Locator;
  12520.         ih_init : boolean;
  12521.       end record;
  12522.       R : RecType;
  12523. end variable_decl_IH;
  12524. -- End: IHvariable_decl dat -----------------------------------------------------
  12525. ::::::::::::::
  12526. obj.bdy
  12527. ::::::::::::::
  12528. -- Begin: SCOBJECT_TYPE bdy ---------------------------------------------------
  12529.      
  12530. with Halstead_Data_Base;  use Halstead_Data_Base;
  12531. with Definitions; use Definitions;
  12532.              with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  12533. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12534. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  12535.      
  12536.                with subtype_decl_IH;
  12537.                          package body OBJECT_TYPE_Pkg is
  12538.      
  12539.      
  12540.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator) is
  12541.     begin
  12542.         case Kind(Root) is
  12543.           when object_type_anon_arrayKind => Scan_object_type_anon_array(Root);
  12544.           when object_type_anon_taskKind => Scan_object_type_anon_task(Root);
  12545.           when object_type_constrainedKind => Scan_object_type_constrained(Root);
  12546.           when object_type_indexKind => Scan_object_type_index(Root);
  12547.           when object_type_rangeKind => Scan_object_type_range(Root);
  12548.           when others => null;
  12549.         end case;
  12550.     end Scan_OBJECT_TYPE;
  12551.      
  12552.      
  12553.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator) is
  12554.     begin
  12555.         Scan_constrained_array_type(as_array_type_spec(Root));
  12556.      
  12557.     end Scan_object_type_anon_array;
  12558.      
  12559.      
  12560.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator) is
  12561.     begin
  12562.         Scan_task_spec(as_task_spec(Root));
  12563.      
  12564.     end Scan_object_type_anon_task;
  12565.      
  12566.      
  12567.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator) is
  12568.     begin
  12569.       if not MARK.IsNull(as_constrained_name(Root)) then
  12570.         Scan_MARK(as_constrained_name(Root));
  12571.       end if;
  12572.       if not CONSTRAINT.IsNull(as_constraint(Root)) then
  12573.      
  12574.      
  12575.       if (subtype_decl_IH.R.ih_in_subtype_decl)
  12576.            and then
  12577.          (Kind (as_constraint (root)) not in dscrmt_constraintKind)
  12578.          then
  12579.           IncrementToken (rangez);
  12580.       end if;
  12581.      
  12582.      
  12583.         Scan_CONSTRAINT(as_constraint(Root));
  12584.       end if;
  12585.      
  12586.     end Scan_object_type_constrained;
  12587.      
  12588.      
  12589.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator) is
  12590.     begin
  12591.       if not MARK.IsNull(as_index_name(Root)) then
  12592.         Scan_MARK(as_index_name(Root));
  12593.      
  12594.      
  12595.         IncrementToken (rangez);
  12596.      
  12597.      
  12598.       end if;
  12599.      
  12600.     end Scan_object_type_index;
  12601.      
  12602.      
  12603.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator) is
  12604.     begin
  12605.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  12606.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  12607.       end if;
  12608.      
  12609.     end Scan_object_type_range;
  12610.      
  12611. end OBJECT_TYPE_Pkg;
  12612. -- End: SCOBJECT_TYPE bdy -----------------------------------------------------
  12613. ::::::::::::::
  12614. obj.spc
  12615. ::::::::::::::
  12616. -- Begin: SCOBJECT_TYPE spc ---------------------------------------------------
  12617.      
  12618. with ST_DIANA; use ST_DIANA;
  12619.              package OBJECT_TYPE_Pkg is
  12620.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator);
  12621.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator);
  12622.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator);
  12623.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator);
  12624.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator);
  12625.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator);
  12626. end OBJECT_TYPE_Pkg;
  12627. -- End: SCOBJECT_TYPE spc -----------------------------------------------------
  12628. ::::::::::::::
  12629. scagg_com.bdy
  12630. ::::::::::::::
  12631. -- Begin: SCAGG_COMPONENT bdy ---------------------------------------------------
  12632.      
  12633. with Halstead_Data_Base;  use Halstead_Data_Base;
  12634. with Definitions; use Definitions;
  12635.              with SERIES_UNIT_IH;
  12636. with agg_named_IH;
  12637. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12638. with CHOICE_Pkg; use CHOICE_Pkg;
  12639. package body AGG_COMPONENT_Pkg is
  12640.      
  12641.      
  12642.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator) is
  12643.     begin
  12644.         case Kind(Root) is
  12645.           when agg_canonicalKind => Scan_agg_canonical(Root);
  12646.           when agg_expKind => Scan_agg_exp(Root);
  12647.           when agg_namedKind => Scan_agg_named(Root);
  12648.           when others => null;
  12649.         end case;
  12650.     end Scan_AGG_COMPONENT;
  12651.      
  12652.      
  12653.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator) is
  12654.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12655.     begin
  12656.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12657.      
  12658.      
  12659.     SERIES_UNIT_IH.R.ih_inlist := false;
  12660.      
  12661.      
  12662.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12663.      
  12664.     end Scan_agg_canonical;
  12665.      
  12666.      
  12667.     procedure Scan_agg_exp(Root : agg_expNode.Locator) is
  12668.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12669.     begin
  12670.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12671.       if not NAME_EXP.IsNull(as_exp(Root)) then
  12672.         Scan_NAME_EXP(as_exp(Root));
  12673.       end if;
  12674.      
  12675.      
  12676.     SERIES_UNIT_IH.R.ih_inlist := false;
  12677.      
  12678.      
  12679.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12680.      
  12681.     end Scan_agg_exp;
  12682.      
  12683.      
  12684.     procedure Scan_agg_named(Root : agg_namedNode.Locator) is
  12685.         as_choice_s_List : SeqOfCHOICE.Generator;
  12686.         as_choice_s_Item : CHOICE.Locator;
  12687.         use SeqOfCHOICE;
  12688.         Old_agg_named_IHR : agg_named_IH.RecType := agg_named_IH.R;
  12689.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12690.     begin
  12691.         agg_named_IH.R.ih_inagg_named :=  false ;
  12692.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12693.       if not SeqOfCHOICE.IsNull(as_choice_s(Root)) then
  12694.      
  12695.      
  12696.      agg_named_IH.R.ih_inagg_named := true;
  12697.      
  12698.      
  12699.         StartForward(as_choice_s(Root), as_choice_s_List);
  12700.         while not Finished(as_choice_s_List) loop
  12701.             as_choice_s_Item := Cell(as_choice_s_List);
  12702.      
  12703.      
  12704.     if SERIES_UNIT_IH.R.ih_inlist then
  12705.         IncrementToken (barz);
  12706.     end if;
  12707.     SERIES_UNIT_IH.R.ih_inlist := true;
  12708.      
  12709.      
  12710.      
  12711.             Scan_CHOICE(as_choice_s_Item);
  12712.             Forward(as_choice_s_List);
  12713.         end loop;
  12714.         EndIterate(as_choice_s_List);
  12715.      
  12716.      
  12717.      IncrementToken (arrowz);
  12718.      agg_named_IH.R.ih_inagg_named := false;
  12719.      
  12720.      
  12721.       end if;
  12722.       if not NAME_EXP.IsNull(as_exp(Root)) then
  12723.         Scan_NAME_EXP(as_exp(Root));
  12724.       end if;
  12725.      
  12726.      
  12727.     SERIES_UNIT_IH.R.ih_inlist := false;
  12728.      
  12729.      
  12730.         agg_named_IH.R := Old_agg_named_IHR;
  12731.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12732.      
  12733.     end Scan_agg_named;
  12734.      
  12735. end AGG_COMPONENT_Pkg;
  12736. -- End: SCAGG_COMPONENT bdy -----------------------------------------------------
  12737. ::::::::::::::
  12738. scagg_com.spc
  12739. ::::::::::::::
  12740. -- Begin: SCAGG_COMPONENT spc ---------------------------------------------------
  12741.      
  12742. with ST_DIANA; use ST_DIANA;
  12743.              package AGG_COMPONENT_Pkg is
  12744.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator);
  12745.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator);
  12746.     procedure Scan_agg_exp(Root : agg_expNode.Locator);
  12747.     procedure Scan_agg_named(Root : agg_namedNode.Locator);
  12748. end AGG_COMPONENT_Pkg;
  12749. -- End: SCAGG_COMPONENT spc -----------------------------------------------------
  12750. ::::::::::::::
  12751. scalterna.bdy
  12752. ::::::::::::::
  12753. -- Begin: SCALTERNATIVE bdy ---------------------------------------------------
  12754.      
  12755. with Halstead_Data_Base;  use Halstead_Data_Base;
  12756. with Definitions; use Definitions;
  12757.              with SERIES_UNIT_IH;
  12758. with case_alternative_IH;
  12759. with handler_alternative_IH;
  12760. with CHOICE_Pkg; use CHOICE_Pkg;
  12761. with STM_Pkg; use STM_Pkg;
  12762. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  12763. with ITEM_Pkg; use ITEM_Pkg;
  12764. package body ALTERNATIVE_Pkg is
  12765.      
  12766.      
  12767.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator) is
  12768.     begin
  12769.         case Kind(Root) is
  12770.           when case_alternativeKind => Scan_case_alternative(Root);
  12771.           when cond_alternativeKind => Scan_cond_alternative(Root);
  12772.           when handler_alternativeKind => Scan_handler_alternative(Root);
  12773.           when pragma_alternativeKind => Scan_pragma_alternative(Root);
  12774.           when select_alternativeKind => Scan_select_alternative(Root);
  12775.           when others => null;
  12776.         end case;
  12777.     end Scan_ALTERNATIVE;
  12778.      
  12779.      
  12780.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator) is
  12781.         as_case_choice_s_List : SeqOfCHOICE.Generator;
  12782.         as_case_choice_s_Item : CHOICE.Locator;
  12783.         use SeqOfCHOICE;
  12784.         as_stm_s_List : SeqOfSTM.Generator;
  12785.         as_stm_s_Item : STM.Locator;
  12786.         use SeqOfSTM;
  12787.         Old_case_alternative_IHR : case_alternative_IH.RecType := case_alternative_IH.R;
  12788.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12789.     begin
  12790.         case_alternative_IH.R.ih_incase_alternative :=  false ;
  12791.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12792.      
  12793.      
  12794.        case_alternative_IH.R.ih_incase_alternative := true;
  12795.        IncrementToken (when_case_stmz);
  12796.        IncrementToken (arrowz);
  12797.      
  12798.      
  12799.       if not SeqOfCHOICE.IsNull(as_case_choice_s(Root)) then
  12800.         StartForward(as_case_choice_s(Root), as_case_choice_s_List);
  12801.         while not Finished(as_case_choice_s_List) loop
  12802.             as_case_choice_s_Item := Cell(as_case_choice_s_List);
  12803.      
  12804.      
  12805.     if SERIES_UNIT_IH.R.ih_inlist then
  12806.         IncrementToken (barz);
  12807.     end if;
  12808.     SERIES_UNIT_IH.R.ih_inlist := true;
  12809.      
  12810.      
  12811.             Scan_CHOICE(as_case_choice_s_Item);
  12812.             Forward(as_case_choice_s_List);
  12813.         end loop;
  12814.         EndIterate(as_case_choice_s_List);
  12815.       end if;
  12816.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12817.         StartForward(as_stm_s(Root), as_stm_s_List);
  12818.         while not Finished(as_stm_s_List) loop
  12819.             as_stm_s_Item := Cell(as_stm_s_List);
  12820.             Scan_STM(as_stm_s_Item);
  12821.             Forward(as_stm_s_List);
  12822.         end loop;
  12823.         EndIterate(as_stm_s_List);
  12824.       end if;
  12825.      
  12826.      
  12827.       case_alternative_IH.R.ih_incase_alternative := false;
  12828.      
  12829.      
  12830.         case_alternative_IH.R := Old_case_alternative_IHR;
  12831.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12832.      
  12833.     end Scan_case_alternative;
  12834.      
  12835.      
  12836.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator) is
  12837.         as_stm_s_List : SeqOfSTM.Generator;
  12838.         as_stm_s_Item : STM.Locator;
  12839.         use SeqOfSTM;
  12840.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12841.     begin
  12842.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12843.      
  12844.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  12845.         then
  12846.      
  12847.     if IsSourceRange (lx_srcpos(root)) then
  12848.           IncrementToken (elsifz);
  12849.     end if;
  12850.      
  12851.         end if;
  12852.      
  12853.         if NAME_EXP.IsNull(as_cond_exp_void(Root))
  12854.         then
  12855.      
  12856.       IncrementToken (else_ifz);
  12857.      
  12858.         end if;
  12859.       if not NAME_EXP.IsNull(as_cond_exp_void(Root)) then
  12860.         Scan_NAME_EXP(as_cond_exp_void(Root));
  12861.       end if;
  12862.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12863.      
  12864.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  12865.         then
  12866.      
  12867.       IncrementToken (thenz);
  12868.      
  12869.         end if;
  12870.         StartForward(as_stm_s(Root), as_stm_s_List);
  12871.         while not Finished(as_stm_s_List) loop
  12872.             as_stm_s_Item := Cell(as_stm_s_List);
  12873.             Scan_STM(as_stm_s_Item);
  12874.             Forward(as_stm_s_List);
  12875.         end loop;
  12876.         EndIterate(as_stm_s_List);
  12877.       end if;
  12878.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12879.      
  12880.     end Scan_cond_alternative;
  12881.      
  12882.      
  12883.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator) is
  12884.         as_handler_choice_s_List : SeqOfCHOICE.Generator;
  12885.         as_handler_choice_s_Item : CHOICE.Locator;
  12886.         use SeqOfCHOICE;
  12887.         as_stm_s_List : SeqOfSTM.Generator;
  12888.         as_stm_s_Item : STM.Locator;
  12889.         use SeqOfSTM;
  12890.         Old_handler_alternative_IHR : handler_alternative_IH.RecType := handler_alternative_IH.R;
  12891.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12892.     begin
  12893.         handler_alternative_IH.R.ih_inhandler_alternative :=  false ;
  12894.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12895.      
  12896.      
  12897.        handler_alternative_IH.R.ih_inhandler_alternative := true;
  12898.        IncrementToken (when_exceptionz);
  12899.        IncrementToken (arrowz);
  12900.      
  12901.      
  12902.       if not SeqOfCHOICE.IsNull(as_handler_choice_s(Root)) then
  12903.         StartForward(as_handler_choice_s(Root), as_handler_choice_s_List);
  12904.         while not Finished(as_handler_choice_s_List) loop
  12905.             as_handler_choice_s_Item := Cell(as_handler_choice_s_List);
  12906.      
  12907.      
  12908.       if SERIES_UNIT_IH.R.ih_inlist then
  12909.           IncrementToken (barz);
  12910.       end if;
  12911.       SERIES_UNIT_IH.R.ih_inlist := true;
  12912.      
  12913.      
  12914.             Scan_CHOICE(as_handler_choice_s_Item);
  12915.             Forward(as_handler_choice_s_List);
  12916.         end loop;
  12917.         EndIterate(as_handler_choice_s_List);
  12918.       end if;
  12919.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12920.         StartForward(as_stm_s(Root), as_stm_s_List);
  12921.         while not Finished(as_stm_s_List) loop
  12922.             as_stm_s_Item := Cell(as_stm_s_List);
  12923.             Scan_STM(as_stm_s_Item);
  12924.             Forward(as_stm_s_List);
  12925.         end loop;
  12926.         EndIterate(as_stm_s_List);
  12927.       end if;
  12928.      
  12929.      
  12930.       handler_alternative_IH.R.ih_inhandler_alternative := false;
  12931.       SERIES_UNIT_IH.R.ih_inlist := false;
  12932.      
  12933.      
  12934.         handler_alternative_IH.R := Old_handler_alternative_IHR;
  12935.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12936.      
  12937.     end Scan_handler_alternative;
  12938.      
  12939.      
  12940.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator) is
  12941.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12942.     begin
  12943.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12944.       if not pragma_declNode.IsNull(as_pragma_alternative(Root)) then
  12945.         Scan_pragma_decl(as_pragma_alternative(Root));
  12946.       end if;
  12947.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12948.      
  12949.     end Scan_pragma_alternative;
  12950.      
  12951.      
  12952.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator) is
  12953.         as_stm_s_List : SeqOfSTM.Generator;
  12954.         as_stm_s_Item : STM.Locator;
  12955.         use SeqOfSTM;
  12956.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  12957.     begin
  12958.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  12959.       if not NAME_EXP.IsNull(as_select_exp_void(Root)) then
  12960.      
  12961.      
  12962.        IncrementToken (when_selectz);
  12963.      
  12964.      
  12965.         Scan_NAME_EXP(as_select_exp_void(Root));
  12966.      
  12967.      
  12968.      IncrementToken (arrowz);
  12969.      
  12970.      
  12971.       end if;
  12972.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  12973.         StartForward(as_stm_s(Root), as_stm_s_List);
  12974.         while not Finished(as_stm_s_List) loop
  12975.             as_stm_s_Item := Cell(as_stm_s_List);
  12976.      
  12977.      
  12978.     if SERIES_UNIT_IH.R.ih_inlist then
  12979.         IncrementToken (or_selectz);
  12980.     end if;
  12981.     SERIES_UNIT_IH.R.ih_inlist := true;
  12982.      
  12983.      
  12984.             Scan_STM(as_stm_s_Item);
  12985.             Forward(as_stm_s_List);
  12986.         end loop;
  12987.         EndIterate(as_stm_s_List);
  12988.       end if;
  12989.      
  12990.      
  12991.   SERIES_UNIT_IH.R.ih_inlist := false;
  12992.      
  12993.      
  12994.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  12995.      
  12996.     end Scan_select_alternative;
  12997.      
  12998. end ALTERNATIVE_Pkg;
  12999. -- End: SCALTERNATIVE bdy -----------------------------------------------------
  13000. ::::::::::::::
  13001. scalterna.spc
  13002. ::::::::::::::
  13003. -- Begin: SCALTERNATIVE spc ---------------------------------------------------
  13004.      
  13005. with ST_DIANA; use ST_DIANA;
  13006.              package ALTERNATIVE_Pkg is
  13007.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator);
  13008.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator);
  13009.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator);
  13010.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator);
  13011.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator);
  13012.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator);
  13013. end ALTERNATIVE_Pkg;
  13014. -- End: SCALTERNATIVE spc -----------------------------------------------------
  13015. ::::::::::::::
  13016. scblock_s.bdy
  13017. ::::::::::::::
  13018. -- Begin: SCBLOCK_STUB bdy ---------------------------------------------------
  13019.      
  13020. with Halstead_Data_Base;  use Halstead_Data_Base;
  13021. with Definitions; use Definitions;
  13022.              with ITEM_Pkg; use ITEM_Pkg;
  13023. with STM_Pkg; use STM_Pkg;
  13024. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  13025.      
  13026.                with BLOCK_STM_IH;
  13027.                with Source_Position_Utilities;
  13028.                          package body BLOCK_STUB_Pkg is
  13029.      
  13030.      
  13031.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator) is
  13032.     begin
  13033.         case Kind(Root) is
  13034.           when body_blockKind => Scan_body_block(Root);
  13035.           when body_stubKind => Scan_body_stub(Root);
  13036.           when others => null;
  13037.         end case;
  13038.     end Scan_BLOCK_STUB;
  13039.      
  13040.      
  13041.     procedure Scan_body_block(Root : body_blockNode.Locator) is
  13042.         as_item_s_List : SeqOfITEM.Generator;
  13043.         as_item_s_Item : ITEM.Locator;
  13044.         use SeqOfITEM;
  13045.         as_stm_s_List : SeqOfSTM.Generator;
  13046.         as_stm_s_Item : STM.Locator;
  13047.         use SeqOfSTM;
  13048.         as_handler_s_List : SeqOfhandler_alternativeNode.Generator;
  13049.         as_handler_s_Item : handler_alternativeNode.Locator;
  13050.         use SeqOfhandler_alternativeNode;
  13051.     begin
  13052.       if not SeqOfITEM.IsNull(as_item_s(Root)) then
  13053.      
  13054.      
  13055.      if block_stm_IH.R.ih_inblock then
  13056.          IncrementToken (declarez);
  13057.          block_stm_IH.R.ih_inblock := false;
  13058.      end if;
  13059.      
  13060.      
  13061.         StartForward(as_item_s(Root), as_item_s_List);
  13062.         while not Finished(as_item_s_List) loop
  13063.             as_item_s_Item := Cell(as_item_s_List);
  13064.             Scan_ITEM(as_item_s_Item);
  13065.             Forward(as_item_s_List);
  13066.         end loop;
  13067.         EndIterate(as_item_s_List);
  13068.       end if;
  13069.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  13070.      
  13071.      
  13072.     IncrementToken (beginz);
  13073.      
  13074.      
  13075.         StartForward(as_stm_s(Root), as_stm_s_List);
  13076.         while not Finished(as_stm_s_List) loop
  13077.             as_stm_s_Item := Cell(as_stm_s_List);
  13078.             Scan_STM(as_stm_s_Item);
  13079.             Forward(as_stm_s_List);
  13080.         end loop;
  13081.         EndIterate(as_stm_s_List);
  13082.       end if;
  13083.       if not SeqOfhandler_alternativeNode.IsNull(as_handler_s(Root)) then
  13084.      
  13085.      
  13086.      IncrementToken (exceptionz);
  13087.      
  13088.      
  13089.         StartForward(as_handler_s(Root), as_handler_s_List);
  13090.         while not Finished(as_handler_s_List) loop
  13091.             as_handler_s_Item := Cell(as_handler_s_List);
  13092.             Scan_handler_alternative(as_handler_s_Item);
  13093.             Forward(as_handler_s_List);
  13094.         end loop;
  13095.         EndIterate(as_handler_s_List);
  13096.       end if;
  13097.      
  13098.      
  13099.    if not Source_Position_Utilities.Is_Srcpos_Null (lx_srcpos (root)) then
  13100.        IncrementToken (end_beginz);
  13101.    end if;
  13102.      
  13103.      
  13104.      
  13105.     end Scan_body_block;
  13106.      
  13107.      
  13108.     procedure Scan_body_stub(Root : body_stubNode.Locator) is
  13109.     begin
  13110.      
  13111.      
  13112.       --- should be is_separatez not is_packagez
  13113.       IncrementToken (is_separatez);
  13114.       IncrementToken (separatez);
  13115.      
  13116.      
  13117.      
  13118.     end Scan_body_stub;
  13119.      
  13120. end BLOCK_STUB_Pkg;
  13121. -- End: SCBLOCK_STUB bdy -----------------------------------------------------
  13122.      
  13123. ::::::::::::::
  13124. scblock_s.spc
  13125. ::::::::::::::
  13126. -- Begin: SCBLOCK_STUB spc ---------------------------------------------------
  13127.      
  13128. with ST_DIANA; use ST_DIANA;
  13129.              package BLOCK_STUB_Pkg is
  13130.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator);
  13131.     procedure Scan_body_block(Root : body_blockNode.Locator);
  13132.     procedure Scan_body_stub(Root : body_stubNode.Locator);
  13133. end BLOCK_STUB_Pkg;
  13134. -- End: SCBLOCK_STUB spc -----------------------------------------------------
  13135. ::::::::::::::
  13136. scchoice.bdy
  13137. ::::::::::::::
  13138. -- Begin: SCCHOICE bdy ---------------------------------------------------
  13139.      
  13140. with Halstead_Data_Base;  use Halstead_Data_Base;
  13141. with Definitions; use Definitions;
  13142.              with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  13143. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  13144.      
  13145.           with agg_named_IH;
  13146.           with case_alternative_IH;
  13147.           with handler_alternative_IH;
  13148.           with inner_record_IH;
  13149.                          package body CHOICE_Pkg is
  13150.      
  13151.      
  13152.     procedure Scan_CHOICE(Root : CHOICE.Locator) is
  13153.     begin
  13154.         case Kind(Root) is
  13155.           when ch_discrete_rangeKind => Scan_ch_discrete_range(Root);
  13156.           when ch_expKind => Scan_ch_exp(Root);
  13157.           when ch_othersKind => Scan_ch_others(Root);
  13158.           when others => null;
  13159.         end case;
  13160.     end Scan_CHOICE;
  13161.      
  13162.      
  13163.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator) is
  13164.     begin
  13165.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  13166.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  13167.       end if;
  13168.      
  13169.     end Scan_ch_discrete_range;
  13170.      
  13171.      
  13172.     procedure Scan_ch_exp(Root : ch_expNode.Locator) is
  13173.     begin
  13174.       if not NAME_EXP.IsNull(as_exp(Root)) then
  13175.         Scan_NAME_EXP(as_exp(Root));
  13176.       end if;
  13177.      
  13178.     end Scan_ch_exp;
  13179.      
  13180.      
  13181.     procedure Scan_ch_others(Root : ch_othersNode.Locator) is
  13182.     begin
  13183.      
  13184.      
  13185.      if agg_named_IH.R.ih_inagg_named then
  13186.         IncrementToken (others_aggregatez);
  13187.      end if;
  13188.      if case_alternative_IH.R.ih_incase_alternative then
  13189.         IncrementToken (others_casez);
  13190.      end if;
  13191.      if handler_alternative_IH.R.ih_inhandler_alternative then
  13192.          IncrementToken (others_exceptionz);
  13193.      end if;
  13194.      if inner_record_IH.R.ih_in_variant then
  13195.          IncrementToken (others_variantz);
  13196.      end if;
  13197.      
  13198.      
  13199.      
  13200.     end Scan_ch_others;
  13201.      
  13202. end CHOICE_Pkg;
  13203. -- End: SCCHOICE bdy -----------------------------------------------------
  13204. ::::::::::::::
  13205. scchoice.spc
  13206. ::::::::::::::
  13207. -- Begin: SCCHOICE spc ---------------------------------------------------
  13208.      
  13209. with ST_DIANA; use ST_DIANA;
  13210.              package CHOICE_Pkg is
  13211.     procedure Scan_CHOICE(Root : CHOICE.Locator);
  13212.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator);
  13213.     procedure Scan_ch_exp(Root : ch_expNode.Locator);
  13214.     procedure Scan_ch_others(Root : ch_othersNode.Locator);
  13215. end CHOICE_Pkg;
  13216. -- End: SCCHOICE spc -----------------------------------------------------
  13217. ::::::::::::::
  13218. sccomp_un.bdy
  13219. ::::::::::::::
  13220. -- Begin: SCCOMP_UNIT_CLASS bdy ---------------------------------------------------
  13221.      
  13222. with Halstead_Data_Base;  use Halstead_Data_Base;
  13223. with Definitions; use Definitions;
  13224.              with ITEM_Pkg; use ITEM_Pkg;
  13225. package body COMP_UNIT_CLASS_Pkg is
  13226.      
  13227.      
  13228.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator) is
  13229.     begin
  13230.         case Kind(Root) is
  13231.           when comp_unitKind => Scan_comp_unit(Root);
  13232.           when others => null;
  13233.         end case;
  13234.     end Scan_COMP_UNIT_CLASS;
  13235.      
  13236.      
  13237.     procedure Scan_comp_unit(Root : comp_unitNode.Locator) is
  13238.         as_context_List : SeqOfITEM.Generator;
  13239.         as_context_Item : ITEM.Locator;
  13240.         use SeqOfITEM;
  13241.         as_pragma_s_List : SeqOfpragma_declNode.Generator;
  13242.         as_pragma_s_Item : pragma_declNode.Locator;
  13243.         use SeqOfpragma_declNode;
  13244.     begin
  13245.      
  13246.      
  13247.      
  13248.      CurrentBlock := InitializeCurrentBlock;
  13249.      BlockStack := BlockInfoStack.Create;
  13250.        -- This adds a dummy frame on the stack so that it is not necessary
  13251.        -- to check when popping the stack at the end of the program
  13252.        -- if the stack has at least one record.
  13253.      BlockInfoStack.Push(BlockStack, CurrentBlock);
  13254.      if Kind (as_unit_body (root)) in subp_declKind then
  13255.          if Kind (as_subp_designator
  13256.             (as_unit_body (root))) in proc_idKind
  13257.             then
  13258.              SetBlockId (lx_symrep
  13259.                            (as_subp_designator (as_unit_body (root))),
  13260.                          procedure_block,
  13261.                          SpcId,
  13262.                          LineNumber (lx_srcpos (as_unit_body (root)))
  13263.                          );
  13264.          else
  13265.              SetBlockId (lx_symrep
  13266.                            (as_subp_designator (as_unit_body (root))),
  13267.                          function_block,
  13268.                          SpcId,
  13269.                          LineNumber (lx_srcpos (as_unit_body (root)))
  13270.                          );
  13271.          end if;
  13272.      
  13273.      end if;
  13274.      
  13275.      
  13276.       if not SeqOfITEM.IsNull(as_context(Root)) then
  13277.         StartForward(as_context(Root), as_context_List);
  13278.         while not Finished(as_context_List) loop
  13279.             as_context_Item := Cell(as_context_List);
  13280.             Scan_ITEM(as_context_Item);
  13281.             Forward(as_context_List);
  13282.         end loop;
  13283.         EndIterate(as_context_List);
  13284.       end if;
  13285.       if not SeqOfpragma_declNode.IsNull(as_pragma_s(Root)) then
  13286.         StartForward(as_pragma_s(Root), as_pragma_s_List);
  13287.         while not Finished(as_pragma_s_List) loop
  13288.             as_pragma_s_Item := Cell(as_pragma_s_List);
  13289.             Scan_pragma_decl(as_pragma_s_Item);
  13290.             Forward(as_pragma_s_List);
  13291.         end loop;
  13292.         EndIterate(as_pragma_s_List);
  13293.       end if;
  13294.       if not ITEM.IsNull(as_unit_body(Root)) then
  13295.         Scan_ITEM(as_unit_body(Root));
  13296.       end if;
  13297.      
  13298.      
  13299.      
  13300.       if Kind (as_unit_body (root)) in subp_declKind then
  13301.           ProcessBlockInfo (CurrentBlock);
  13302.       end if;
  13303.      
  13304.      
  13305.      
  13306.      
  13307.     end Scan_comp_unit;
  13308.      
  13309. end COMP_UNIT_CLASS_Pkg;
  13310. -- End: SCCOMP_UNIT_CLASS bdy -----------------------------------------------------
  13311. ::::::::::::::
  13312. sccomp_un.spc
  13313. ::::::::::::::
  13314. -- Begin: SCCOMP_UNIT_CLASS spc ---------------------------------------------------
  13315.      
  13316. with ST_DIANA; use ST_DIANA;
  13317.              package COMP_UNIT_CLASS_Pkg is
  13318.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator);
  13319.     procedure Scan_comp_unit(Root : comp_unitNode.Locator);
  13320. end COMP_UNIT_CLASS_Pkg;
  13321. -- End: SCCOMP_UNIT_CLASS spc -----------------------------------------------------
  13322.      
  13323. ::::::::::::::
  13324. scconstra.bdy
  13325. ::::::::::::::
  13326. -- Begin: SCCONSTRAINT bdy ---------------------------------------------------
  13327.      
  13328. with Halstead_Data_Base;  use Halstead_Data_Base;
  13329. with Definitions; use Definitions;
  13330.              with SERIES_UNIT_IH;
  13331. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  13332. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  13333. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  13334. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  13335.      
  13336.                with subtype_decl_IH;
  13337.                          package body CONSTRAINT_Pkg is
  13338.      
  13339.      
  13340.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator) is
  13341.     begin
  13342.         case Kind(Root) is
  13343.           when RANGE_CONSTRAINT_CLASSKind => Scan_RANGE_CONSTRAINT_CLASS(Root);
  13344.           when REAL_CONSTRAINTKind => Scan_REAL_CONSTRAINT(Root);
  13345.           when apply_constraintKind => Scan_apply_constraint(Root);
  13346.           when dscrmt_constraintKind => Scan_dscrmt_constraint(Root);
  13347.           when index_constraintKind => Scan_index_constraint(Root);
  13348.           when others => null;
  13349.         end case;
  13350.     end Scan_CONSTRAINT;
  13351.      
  13352.      
  13353.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator) is
  13354.     begin
  13355.         case Kind(Root) is
  13356.           when range_attribute_constraintKind => Scan_range_attribute_constraint(Root);
  13357.           when range_constraintKind => Scan_range_constraint(Root);
  13358.           when others => null;
  13359.         end case;
  13360.     end Scan_RANGE_CONSTRAINT_CLASS;
  13361.      
  13362.      
  13363.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator) is
  13364.     begin
  13365.       if not NAME_EXP.IsNull(as_range_exp(Root)) then
  13366.         Scan_NAME_EXP(as_range_exp(Root));
  13367.       end if;
  13368.      
  13369.      
  13370.      SERIES_UNIT_IH.R.ih_inlist := false;
  13371.      
  13372.      
  13373.      
  13374.     end Scan_range_attribute_constraint;
  13375.      
  13376.      
  13377.     procedure Scan_range_constraint(Root : range_constraintNode.Locator) is
  13378.     begin
  13379.      
  13380.      
  13381.       if IsSourceRange (lx_srcpos (root))
  13382.          and then
  13383.          not subtype_decl_IH.R.ih_in_subtype_decl
  13384.          then
  13385.            -- The check for subtype is necessary because in object_type
  13386.            -- we count range if it is a subtype.  This check prevents
  13387.            -- us from counting range twice.
  13388.           IncrementToken (rangez);
  13389.       end if;
  13390.      
  13391.      
  13392.       if not NAME_EXP.IsNull(as_range_exp1(Root)) then
  13393.         Scan_NAME_EXP(as_range_exp1(Root));
  13394.      
  13395.      
  13396.      IncrementToken (dot_dot_rangez);
  13397.      
  13398.      
  13399.       end if;
  13400.       if not NAME_EXP.IsNull(as_range_exp2(Root)) then
  13401.         Scan_NAME_EXP(as_range_exp2(Root));
  13402.       end if;
  13403.      
  13404.      
  13405.      SERIES_UNIT_IH.R.ih_inlist := false;
  13406.      
  13407.      
  13408.      
  13409.     end Scan_range_constraint;
  13410.      
  13411.      
  13412.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator) is
  13413.     begin
  13414.         case Kind(Root) is
  13415.           when fixed_constraintKind => Scan_fixed_constraint(Root);
  13416.           when float_constraintKind => Scan_float_constraint(Root);
  13417.           when others => null;
  13418.         end case;
  13419.     end Scan_REAL_CONSTRAINT;
  13420.      
  13421.      
  13422.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator) is
  13423.     begin
  13424.       if not NAME_EXP.IsNull(as_delta(Root)) then
  13425.         Scan_NAME_EXP(as_delta(Root));
  13426.       end if;
  13427.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  13428.         Scan_range_constraint(as_range_constraint(Root));
  13429.       end if;
  13430.      
  13431.      
  13432.      SERIES_UNIT_IH.R.ih_inlist := false;
  13433.      
  13434.      
  13435.      
  13436.     end Scan_fixed_constraint;
  13437.      
  13438.      
  13439.     procedure Scan_float_constraint(Root : float_constraintNode.Locator) is
  13440.     begin
  13441.       if not NAME_EXP.IsNull(as_digits(Root)) then
  13442.         Scan_NAME_EXP(as_digits(Root));
  13443.       end if;
  13444.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  13445.         Scan_range_constraint(as_range_constraint(Root));
  13446.       end if;
  13447.      
  13448.      
  13449.      SERIES_UNIT_IH.R.ih_inlist := false;
  13450.      
  13451.      
  13452.      
  13453.     end Scan_float_constraint;
  13454.      
  13455.      
  13456.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator) is
  13457.         as_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  13458.         as_assoc_s_Item : GENERAL_ASSOC.Locator;
  13459.         use SeqOfGENERAL_ASSOC;
  13460.     begin
  13461.       if not SeqOfGENERAL_ASSOC.IsNull(as_assoc_s(Root)) then
  13462.         StartForward(as_assoc_s(Root), as_assoc_s_List);
  13463.         while not Finished(as_assoc_s_List) loop
  13464.             as_assoc_s_Item := Cell(as_assoc_s_List);
  13465.             Scan_GENERAL_ASSOC(as_assoc_s_Item);
  13466.             Forward(as_assoc_s_List);
  13467.         end loop;
  13468.         EndIterate(as_assoc_s_List);
  13469.       end if;
  13470.      
  13471.      
  13472.      SERIES_UNIT_IH.R.ih_inlist := false;
  13473.      
  13474.      
  13475.      
  13476.     end Scan_apply_constraint;
  13477.      
  13478.      
  13479.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator) is
  13480.         as_dscrmt_assoc_s_List : SeqOfAGG_COMPONENT.Generator;
  13481.         as_dscrmt_assoc_s_Item : AGG_COMPONENT.Locator;
  13482.         use SeqOfAGG_COMPONENT;
  13483.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13484.     begin
  13485.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13486.      
  13487.      
  13488.       IncrementToken (open_parenthesisz);
  13489.      
  13490.      
  13491.       if not SeqOfAGG_COMPONENT.IsNull(as_dscrmt_assoc_s(Root)) then
  13492.         StartForward(as_dscrmt_assoc_s(Root), as_dscrmt_assoc_s_List);
  13493.         while not Finished(as_dscrmt_assoc_s_List) loop
  13494.             as_dscrmt_assoc_s_Item := Cell(as_dscrmt_assoc_s_List);
  13495.      
  13496.      
  13497.       if SERIES_UNIT_IH.R.ih_inlist then
  13498.           IncrementToken (commaz);
  13499.       end if;
  13500.       SERIES_UNIT_IH.R.ih_inlist := true;
  13501.      
  13502.      
  13503.             Scan_AGG_COMPONENT(as_dscrmt_assoc_s_Item);
  13504.             Forward(as_dscrmt_assoc_s_List);
  13505.         end loop;
  13506.         EndIterate(as_dscrmt_assoc_s_List);
  13507.       end if;
  13508.      
  13509.      
  13510.       IncrementToken (closed_parenthesisz);
  13511.       SERIES_UNIT_IH.R.ih_inlist := false;
  13512.      
  13513.      
  13514.      
  13515.      
  13516.      SERIES_UNIT_IH.R.ih_inlist := false;
  13517.      
  13518.      
  13519.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13520.      
  13521.     end Scan_dscrmt_constraint;
  13522.      
  13523.      
  13524.     procedure Scan_index_constraint(Root : index_constraintNode.Locator) is
  13525.         as_discrete_range_s_List : SeqOfOBJECT_TYPE.Generator;
  13526.         as_discrete_range_s_Item : OBJECT_TYPE.Locator;
  13527.         use SeqOfOBJECT_TYPE;
  13528.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  13529.     begin
  13530.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  13531.      
  13532.      
  13533.      IncrementToken (open_parenthesisz);
  13534.      
  13535.      
  13536.       if not SeqOfOBJECT_TYPE.IsNull(as_discrete_range_s(Root)) then
  13537.         StartForward(as_discrete_range_s(Root), as_discrete_range_s_List);
  13538.         while not Finished(as_discrete_range_s_List) loop
  13539.             as_discrete_range_s_Item := Cell(as_discrete_range_s_List);
  13540.      
  13541.      
  13542.       if SERIES_UNIT_IH.R.ih_inlist then
  13543.           IncrementToken (commaz);
  13544.       end if;
  13545.       SERIES_UNIT_IH.R.ih_inlist := true;
  13546.      
  13547.      
  13548.             Scan_OBJECT_TYPE(as_discrete_range_s_Item);
  13549.             Forward(as_discrete_range_s_List);
  13550.         end loop;
  13551.         EndIterate(as_discrete_range_s_List);
  13552.       end if;
  13553.      
  13554.      
  13555.       IncrementToken (closed_parenthesisz);
  13556.       SERIES_UNIT_IH.R.ih_inlist := false;
  13557.      
  13558.      
  13559.      
  13560.      
  13561.      SERIES_UNIT_IH.R.ih_inlist := false;
  13562.      
  13563.      
  13564.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  13565.      
  13566.     end Scan_index_constraint;
  13567.      
  13568. end CONSTRAINT_Pkg;
  13569. -- End: SCCONSTRAINT bdy -----------------------------------------------------
  13570. ::::::::::::::
  13571. scconstra.spc
  13572. ::::::::::::::
  13573. -- Begin: SCCONSTRAINT spc ---------------------------------------------------
  13574.      
  13575. with ST_DIANA; use ST_DIANA;
  13576.              package CONSTRAINT_Pkg is
  13577.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator);
  13578.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator);
  13579.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator);
  13580.     procedure Scan_range_constraint(Root : range_constraintNode.Locator);
  13581.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator);
  13582.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator);
  13583.     procedure Scan_float_constraint(Root : float_constraintNode.Locator);
  13584.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator);
  13585.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator);
  13586.     procedure Scan_index_constraint(Root : index_constraintNode.Locator);
  13587. end CONSTRAINT_Pkg;
  13588. -- End: SCCONSTRAINT spc -----------------------------------------------------
  13589. ::::::::::::::
  13590. scdef_id.bdy
  13591. ::::::::::::::
  13592. --VMS file: %nosc.work.tools.halstead.source*(SCDEF_ID.bdy)
  13593. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCDEF_ID.bdy
  13594. -- Begin: SCDEF_ID bdy ---------------------------------------------------
  13595.      
  13596. with Halstead_Data_Base;  use Halstead_Data_Base;
  13597. with Definitions; use Definitions;
  13598.      
  13599.            with variable_decl_IH;
  13600.            with type_decl_IH;
  13601.            with Identifier_Utilities;
  13602.                      package body DEF_ID_Pkg is
  13603.      
  13604.      
  13605.     procedure Scan_DEF_ID(Root : DEF_ID.Locator) is
  13606.     begin
  13607.         case Kind(Root) is
  13608.           when ATTRIBUTE_IDKind => Scan_ATTRIBUTE_ID(Root);
  13609.           when BUILT_IN_OPERATORKind => Scan_BUILT_IN_OPERATOR(Root);
  13610.           when GENERAL_TYPE_IDKind => Scan_GENERAL_TYPE_ID(Root);
  13611.           when LITERAL_IDKind => Scan_LITERAL_ID(Root);
  13612.           when OBJECT_IDKind => Scan_OBJECT_ID(Root);
  13613.           when PKG_ID_CLASSKind => Scan_PKG_ID_CLASS(Root);
  13614.           when PRAGMA_IDKind => Scan_PRAGMA_ID(Root);
  13615.           when STM_IDKind => Scan_STM_ID(Root);
  13616.           when SUBP_IDKind => Scan_SUBP_ID(Root);
  13617.           when argument_idKind => Scan_argument_id(Root);
  13618.           when exception_idKind => Scan_exception_id(Root);
  13619.           when iteration_idKind => Scan_iteration_id(Root);
  13620.           when number_idKind => Scan_number_id(Root);
  13621.           when subtype_idKind => Scan_subtype_id(Root);
  13622.           when task_body_idKind => Scan_task_body_id(Root);
  13623.           when others => null;
  13624.         end case;
  13625.     end Scan_DEF_ID;
  13626.      
  13627.      
  13628.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator) is
  13629.     begin
  13630.         case Kind(Root) is
  13631.           when LRM_ATTRIBUTE_IDKind => Scan_LRM_ATTRIBUTE_ID(Root);
  13632.           when others => null;
  13633.         end case;
  13634.     end Scan_ATTRIBUTE_ID;
  13635.      
  13636.      
  13637.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator) is
  13638.     begin
  13639.         case Kind(Root) is
  13640.           when address_idKind => Scan_address_id(Root);
  13641.           when aft_idKind => Scan_aft_id(Root);
  13642.           when base_idKind => Scan_base_id(Root);
  13643.           when callable_idKind => Scan_callable_id(Root);
  13644.           when constrained_idKind => Scan_constrained_id(Root);
  13645.           when count_idKind => Scan_count_id(Root);
  13646.           when delta_idKind => Scan_delta_id(Root);
  13647.           when digits_idKind => Scan_digits_id(Root);
  13648.           when emax_idKind => Scan_emax_id(Root);
  13649.           when epsilon_idKind => Scan_epsilon_id(Root);
  13650.           when first_bit_idKind => Scan_first_bit_id(Root);
  13651.           when first_index_idKind => Scan_first_index_id(Root);
  13652.           when first_scalar_idKind => Scan_first_scalar_id(Root);
  13653.           when fore_idKind => Scan_fore_id(Root);
  13654.           when image_idKind => Scan_image_id(Root);
  13655.           when large_idKind => Scan_large_id(Root);
  13656.           when last_bit_idKind => Scan_last_bit_id(Root);
  13657.           when last_index_idKind => Scan_last_index_id(Root);
  13658.           when last_scalar_idKind => Scan_last_scalar_id(Root);
  13659.           when length_idKind => Scan_length_id(Root);
  13660.           when machine_emax_idKind => Scan_machine_emax_id(Root);
  13661.           when machine_emin_idKind => Scan_machine_emin_id(Root);
  13662.           when machine_mantissa_idKind => Scan_machine_mantissa_id(Root);
  13663.           when machine_overflows_idKind => Scan_machine_overflows_id(Root);
  13664.           when machine_radix_idKind => Scan_machine_radix_id(Root);
  13665.           when machine_rounds_idKind => Scan_machine_rounds_id(Root);
  13666.           when mantissa_idKind => Scan_mantissa_id(Root);
  13667.           when pos_idKind => Scan_pos_id(Root);
  13668.           when position_idKind => Scan_position_id(Root);
  13669.           when pred_idKind => Scan_pred_id(Root);
  13670.           when range_idKind => Scan_range_id(Root);
  13671.           when safe_emax_idKind => Scan_safe_emax_id(Root);
  13672.           when safe_large_idKind => Scan_safe_large_id(Root);
  13673.           when safe_small_idKind => Scan_safe_small_id(Root);
  13674.           when size_objects_idKind => Scan_size_objects_id(Root);
  13675.           when size_type_idKind => Scan_size_type_id(Root);
  13676.           when small_idKind => Scan_small_id(Root);
  13677.           when storage_size_collection_idKind => Scan_storage_size_collection_id(Root);
  13678.           when storage_size_task_idKind => Scan_storage_size_task_id(Root);
  13679.           when succ_idKind => Scan_succ_id(Root);
  13680.           when terminated_idKind => Scan_terminated_id(Root);
  13681.           when val_idKind => Scan_val_id(Root);
  13682.           when value_idKind => Scan_value_id(Root);
  13683.           when width_idKind => Scan_width_id(Root);
  13684.           when others => null;
  13685.         end case;
  13686.     end Scan_LRM_ATTRIBUTE_ID;
  13687.      
  13688.      
  13689.     procedure Scan_address_id(Root : address_idNode.Locator) is
  13690.     begin
  13691.      
  13692.      
  13693.        if not Identifier_Utilities.Is_Id_Null (root) then
  13694.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13695.        end if;
  13696.      
  13697.      
  13698.      
  13699.     end Scan_address_id;
  13700.      
  13701.      
  13702.     procedure Scan_aft_id(Root : aft_idNode.Locator) is
  13703.     begin
  13704.      
  13705.      
  13706.        if not Identifier_Utilities.Is_Id_Null (root) then
  13707.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13708.        end if;
  13709.      
  13710.      
  13711.      
  13712.     end Scan_aft_id;
  13713.      
  13714.      
  13715.     procedure Scan_base_id(Root : base_idNode.Locator) is
  13716.     begin
  13717.      
  13718.      
  13719.        if not Identifier_Utilities.Is_Id_Null (root) then
  13720.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13721.        end if;
  13722.      
  13723.      
  13724.      
  13725.     end Scan_base_id;
  13726.      
  13727.      
  13728.     procedure Scan_callable_id(Root : callable_idNode.Locator) is
  13729.     begin
  13730.      
  13731.      
  13732.        if not Identifier_Utilities.Is_Id_Null (root) then
  13733.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13734.        end if;
  13735.      
  13736.      
  13737.      
  13738.     end Scan_callable_id;
  13739.      
  13740.      
  13741.     procedure Scan_constrained_id(Root : constrained_idNode.Locator) is
  13742.     begin
  13743.      
  13744.      
  13745.        if not Identifier_Utilities.Is_Id_Null (root) then
  13746.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13747.        end if;
  13748.      
  13749.      
  13750.      
  13751.     end Scan_constrained_id;
  13752.      
  13753.      
  13754.     procedure Scan_count_id(Root : count_idNode.Locator) is
  13755.     begin
  13756.      
  13757.      
  13758.        if not Identifier_Utilities.Is_Id_Null (root) then
  13759.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13760.        end if;
  13761.      
  13762.      
  13763.      
  13764.     end Scan_count_id;
  13765.      
  13766.      
  13767.     procedure Scan_delta_id(Root : delta_idNode.Locator) is
  13768.     begin
  13769.      
  13770.      
  13771.        if not Identifier_Utilities.Is_Id_Null (root) then
  13772.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13773.        end if;
  13774.      
  13775.      
  13776.      
  13777.     end Scan_delta_id;
  13778.      
  13779.      
  13780.     procedure Scan_digits_id(Root : digits_idNode.Locator) is
  13781.     begin
  13782.      
  13783.      
  13784.        if not Identifier_Utilities.Is_Id_Null (root) then
  13785.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13786.        end if;
  13787.      
  13788.      
  13789.      
  13790.     end Scan_digits_id;
  13791.      
  13792.      
  13793.     procedure Scan_emax_id(Root : emax_idNode.Locator) is
  13794.     begin
  13795.      
  13796.      
  13797.        if not Identifier_Utilities.Is_Id_Null (root) then
  13798.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13799.        end if;
  13800.      
  13801.      
  13802.      
  13803.     end Scan_emax_id;
  13804.      
  13805.      
  13806.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator) is
  13807.     begin
  13808.      
  13809.      
  13810.        if not Identifier_Utilities.Is_Id_Null (root) then
  13811.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13812.        end if;
  13813.      
  13814.      
  13815.      
  13816.     end Scan_epsilon_id;
  13817.      
  13818.      
  13819.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator) is
  13820.     begin
  13821.      
  13822.      
  13823.        if not Identifier_Utilities.Is_Id_Null (root) then
  13824.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13825.        end if;
  13826.      
  13827.      
  13828.      
  13829.     end Scan_first_bit_id;
  13830.      
  13831.      
  13832.     procedure Scan_first_index_id(Root : first_index_idNode.Locator) is
  13833.     begin
  13834.      
  13835.      
  13836.        if not Identifier_Utilities.Is_Id_Null (root) then
  13837.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13838.        end if;
  13839.      
  13840.      
  13841.      
  13842.     end Scan_first_index_id;
  13843.      
  13844.      
  13845.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator) is
  13846.     begin
  13847.      
  13848.      
  13849.        if not Identifier_Utilities.Is_Id_Null (root) then
  13850.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13851.        end if;
  13852.      
  13853.      
  13854.      
  13855.     end Scan_first_scalar_id;
  13856.      
  13857.      
  13858.     procedure Scan_fore_id(Root : fore_idNode.Locator) is
  13859.     begin
  13860.      
  13861.      
  13862.        if not Identifier_Utilities.Is_Id_Null (root) then
  13863.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13864.        end if;
  13865.      
  13866.      
  13867.      
  13868.     end Scan_fore_id;
  13869.      
  13870.      
  13871.     procedure Scan_image_id(Root : image_idNode.Locator) is
  13872.     begin
  13873.      
  13874.      
  13875.        if not Identifier_Utilities.Is_Id_Null (root) then
  13876.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13877.        end if;
  13878.      
  13879.      
  13880.      
  13881.     end Scan_image_id;
  13882.      
  13883.      
  13884.     procedure Scan_large_id(Root : large_idNode.Locator) is
  13885.     begin
  13886.      
  13887.      
  13888.        if not Identifier_Utilities.Is_Id_Null (root) then
  13889.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13890.        end if;
  13891.      
  13892.      
  13893.      
  13894.     end Scan_large_id;
  13895.      
  13896.      
  13897.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator) is
  13898.     begin
  13899.      
  13900.      
  13901.        if not Identifier_Utilities.Is_Id_Null (root) then
  13902.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13903.        end if;
  13904.      
  13905.      
  13906.      
  13907.     end Scan_last_bit_id;
  13908.      
  13909.      
  13910.     procedure Scan_last_index_id(Root : last_index_idNode.Locator) is
  13911.     begin
  13912.      
  13913.      
  13914.        if not Identifier_Utilities.Is_Id_Null (root) then
  13915.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13916.        end if;
  13917.      
  13918.      
  13919.      
  13920.     end Scan_last_index_id;
  13921.      
  13922.      
  13923.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator) is
  13924.     begin
  13925.      
  13926.      
  13927.        if not Identifier_Utilities.Is_Id_Null (root) then
  13928.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13929.        end if;
  13930.      
  13931.      
  13932.      
  13933.     end Scan_last_scalar_id;
  13934.      
  13935.      
  13936.     procedure Scan_length_id(Root : length_idNode.Locator) is
  13937.     begin
  13938.      
  13939.      
  13940.        if not Identifier_Utilities.Is_Id_Null (root) then
  13941.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13942.        end if;
  13943.      
  13944.      
  13945.      
  13946.     end Scan_length_id;
  13947.      
  13948.      
  13949.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator) is
  13950.     begin
  13951.      
  13952.      
  13953.        if not Identifier_Utilities.Is_Id_Null (root) then
  13954.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13955.        end if;
  13956.      
  13957.      
  13958.      
  13959.     end Scan_machine_emax_id;
  13960.      
  13961.      
  13962.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator) is
  13963.     begin
  13964.      
  13965.      
  13966.        if not Identifier_Utilities.Is_Id_Null (root) then
  13967.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13968.        end if;
  13969.      
  13970.      
  13971.      
  13972.     end Scan_machine_emin_id;
  13973.      
  13974.      
  13975.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator) is
  13976.     begin
  13977.      
  13978.      
  13979.        if not Identifier_Utilities.Is_Id_Null (root) then
  13980.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13981.        end if;
  13982.      
  13983.      
  13984.      
  13985.     end Scan_machine_mantissa_id;
  13986.      
  13987.      
  13988.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator) is
  13989.     begin
  13990.      
  13991.      
  13992.        if not Identifier_Utilities.Is_Id_Null (root) then
  13993.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  13994.        end if;
  13995.      
  13996.      
  13997.      
  13998.     end Scan_machine_overflows_id;
  13999.      
  14000.      
  14001.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator) is
  14002.     begin
  14003.      
  14004.      
  14005.        if not Identifier_Utilities.Is_Id_Null (root) then
  14006.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14007.        end if;
  14008.      
  14009.      
  14010.      
  14011.     end Scan_machine_radix_id;
  14012.      
  14013.      
  14014.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator) is
  14015.     begin
  14016.      
  14017.      
  14018.        if not Identifier_Utilities.Is_Id_Null (root) then
  14019.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14020.        end if;
  14021.      
  14022.      
  14023.      
  14024.     end Scan_machine_rounds_id;
  14025.      
  14026.      
  14027.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator) is
  14028.     begin
  14029.      
  14030.      
  14031.        if not Identifier_Utilities.Is_Id_Null (root) then
  14032.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14033.        end if;
  14034.      
  14035.      
  14036.      
  14037.     end Scan_mantissa_id;
  14038.      
  14039.      
  14040.     procedure Scan_pos_id(Root : pos_idNode.Locator) is
  14041.     begin
  14042.      
  14043.      
  14044.        if not Identifier_Utilities.Is_Id_Null (root) then
  14045.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14046.        end if;
  14047.      
  14048.      
  14049.      
  14050.     end Scan_pos_id;
  14051.      
  14052.      
  14053.     procedure Scan_position_id(Root : position_idNode.Locator) is
  14054.     begin
  14055.      
  14056.      
  14057.        if not Identifier_Utilities.Is_Id_Null (root) then
  14058.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14059.        end if;
  14060.      
  14061.      
  14062.      
  14063.     end Scan_position_id;
  14064.      
  14065.      
  14066.     procedure Scan_pred_id(Root : pred_idNode.Locator) is
  14067.     begin
  14068.      
  14069.      
  14070.        if not Identifier_Utilities.Is_Id_Null (root) then
  14071.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14072.        end if;
  14073.      
  14074.      
  14075.      
  14076.     end Scan_pred_id;
  14077.      
  14078.      
  14079.     procedure Scan_range_id(Root : range_idNode.Locator) is
  14080.     begin
  14081.      
  14082.      
  14083.        if not Identifier_Utilities.Is_Id_Null (root) then
  14084.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14085.        end if;
  14086.      
  14087.      
  14088.      
  14089.     end Scan_range_id;
  14090.      
  14091.      
  14092.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator) is
  14093.     begin
  14094.      
  14095.      
  14096.        if not Identifier_Utilities.Is_Id_Null (root) then
  14097.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14098.        end if;
  14099.      
  14100.      
  14101.      
  14102.     end Scan_safe_emax_id;
  14103.      
  14104.      
  14105.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator) is
  14106.     begin
  14107.      
  14108.      
  14109.        if not Identifier_Utilities.Is_Id_Null (root) then
  14110.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14111.        end if;
  14112.      
  14113.      
  14114.      
  14115.     end Scan_safe_large_id;
  14116.      
  14117.      
  14118.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator) is
  14119.     begin
  14120.      
  14121.      
  14122.        if not Identifier_Utilities.Is_Id_Null (root) then
  14123.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14124.        end if;
  14125.      
  14126.      
  14127.      
  14128.     end Scan_safe_small_id;
  14129.      
  14130.      
  14131.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator) is
  14132.     begin
  14133.      
  14134.      
  14135.        if not Identifier_Utilities.Is_Id_Null (root) then
  14136.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14137.        end if;
  14138.      
  14139.      
  14140.      
  14141.     end Scan_size_objects_id;
  14142.      
  14143.      
  14144.     procedure Scan_size_type_id(Root : size_type_idNode.Locator) is
  14145.     begin
  14146.      
  14147.      
  14148.        if not Identifier_Utilities.Is_Id_Null (root) then
  14149.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14150.        end if;
  14151.      
  14152.      
  14153.      
  14154.     end Scan_size_type_id;
  14155.      
  14156.      
  14157.     procedure Scan_small_id(Root : small_idNode.Locator) is
  14158.     begin
  14159.      
  14160.      
  14161.        if not Identifier_Utilities.Is_Id_Null (root) then
  14162.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14163.        end if;
  14164.      
  14165.      
  14166.      
  14167.     end Scan_small_id;
  14168.      
  14169.      
  14170.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator) is
  14171.     begin
  14172.      
  14173.      
  14174.        if not Identifier_Utilities.Is_Id_Null (root) then
  14175.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14176.        end if;
  14177.      
  14178.      
  14179.      
  14180.     end Scan_storage_size_collection_id;
  14181.      
  14182.      
  14183.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator) is
  14184.     begin
  14185.      
  14186.      
  14187.        if not Identifier_Utilities.Is_Id_Null (root) then
  14188.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14189.        end if;
  14190.      
  14191.      
  14192.      
  14193.     end Scan_storage_size_task_id;
  14194.      
  14195.      
  14196.     procedure Scan_succ_id(Root : succ_idNode.Locator) is
  14197.     begin
  14198.      
  14199.      
  14200.        if not Identifier_Utilities.Is_Id_Null (root) then
  14201.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14202.        end if;
  14203.      
  14204.      
  14205.      
  14206.     end Scan_succ_id;
  14207.      
  14208.      
  14209.     procedure Scan_terminated_id(Root : terminated_idNode.Locator) is
  14210.     begin
  14211.      
  14212.      
  14213.        if not Identifier_Utilities.Is_Id_Null (root) then
  14214.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14215.        end if;
  14216.      
  14217.      
  14218.      
  14219.     end Scan_terminated_id;
  14220.      
  14221.      
  14222.     procedure Scan_val_id(Root : val_idNode.Locator) is
  14223.     begin
  14224.      
  14225.      
  14226.        if not Identifier_Utilities.Is_Id_Null (root) then
  14227.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14228.        end if;
  14229.      
  14230.      
  14231.      
  14232.     end Scan_val_id;
  14233.      
  14234.      
  14235.     procedure Scan_value_id(Root : value_idNode.Locator) is
  14236.     begin
  14237.      
  14238.      
  14239.        if not Identifier_Utilities.Is_Id_Null (root) then
  14240.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14241.        end if;
  14242.      
  14243.      
  14244.      
  14245.     end Scan_value_id;
  14246.      
  14247.      
  14248.     procedure Scan_width_id(Root : width_idNode.Locator) is
  14249.     begin
  14250.      
  14251.      
  14252.        if not Identifier_Utilities.Is_Id_Null (root) then
  14253.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14254.        end if;
  14255.      
  14256.      
  14257.      
  14258.     end Scan_width_id;
  14259.      
  14260.      
  14261.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator) is
  14262.     begin
  14263.         case Kind(Root) is
  14264.           when built_in_absKind => Scan_built_in_abs(Root);
  14265.           when built_in_andKind => Scan_built_in_and(Root);
  14266.           when built_in_modKind => Scan_built_in_mod(Root);
  14267.           when built_in_notKind => Scan_built_in_not(Root);
  14268.           when built_in_orKind => Scan_built_in_or(Root);
  14269.           when built_in_remKind => Scan_built_in_rem(Root);
  14270.           when built_in_xorKind => Scan_built_in_xor(Root);
  14271.           when concatenateKind => Scan_concatenate(Root);
  14272.           when divideKind => Scan_divide(Root);
  14273.           when equalKind => Scan_equal(Root);
  14274.           when exponentKind => Scan_exponent(Root);
  14275.           when greater_thanKind => Scan_greater_than(Root);
  14276.           when greater_than_or_equalKind => Scan_greater_than_or_equal(Root);
  14277.           when less_thanKind => Scan_less_than(Root);
  14278.           when less_than_or_equalKind => Scan_less_than_or_equal(Root);
  14279.           when minusKind => Scan_minus(Root);
  14280.           when multiplyKind => Scan_multiply(Root);
  14281.           when negateKind => Scan_negate(Root);
  14282.           when not_equalKind => Scan_not_equal(Root);
  14283.           when plusKind => Scan_plus(Root);
  14284.           when unary_plusKind => Scan_unary_plus(Root);
  14285.           when others => null;
  14286.         end case;
  14287.     end Scan_BUILT_IN_OPERATOR;
  14288.      
  14289.      
  14290.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator) is
  14291.     begin
  14292.      
  14293.      
  14294.        if not Identifier_Utilities.Is_Id_Null (root) then
  14295.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14296.        end if;
  14297.      
  14298.      
  14299.      
  14300.     end Scan_built_in_abs;
  14301.      
  14302.      
  14303.     procedure Scan_built_in_and(Root : built_in_andNode.Locator) is
  14304.     begin
  14305.      
  14306.      
  14307.        if not Identifier_Utilities.Is_Id_Null (root) then
  14308.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14309.        end if;
  14310.      
  14311.      
  14312.      
  14313.     end Scan_built_in_and;
  14314.      
  14315.      
  14316.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator) is
  14317.     begin
  14318.      
  14319.      
  14320.        if not Identifier_Utilities.Is_Id_Null (root) then
  14321.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14322.        end if;
  14323.      
  14324.      
  14325.      
  14326.     end Scan_built_in_mod;
  14327.      
  14328.      
  14329.     procedure Scan_built_in_not(Root : built_in_notNode.Locator) is
  14330.     begin
  14331.      
  14332.      
  14333.        if not Identifier_Utilities.Is_Id_Null (root) then
  14334.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14335.        end if;
  14336.      
  14337.      
  14338.      
  14339.     end Scan_built_in_not;
  14340.      
  14341.      
  14342.     procedure Scan_built_in_or(Root : built_in_orNode.Locator) is
  14343.     begin
  14344.      
  14345.      
  14346.        if not Identifier_Utilities.Is_Id_Null (root) then
  14347.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14348.        end if;
  14349.      
  14350.      
  14351.      
  14352.     end Scan_built_in_or;
  14353.      
  14354.      
  14355.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator) is
  14356.     begin
  14357.      
  14358.      
  14359.        if not Identifier_Utilities.Is_Id_Null (root) then
  14360.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14361.        end if;
  14362.      
  14363.      
  14364.      
  14365.     end Scan_built_in_rem;
  14366.      
  14367.      
  14368.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator) is
  14369.     begin
  14370.      
  14371.      
  14372.        if not Identifier_Utilities.Is_Id_Null (root) then
  14373.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14374.        end if;
  14375.      
  14376.      
  14377.      
  14378.     end Scan_built_in_xor;
  14379.      
  14380.      
  14381.     procedure Scan_concatenate(Root : concatenateNode.Locator) is
  14382.     begin
  14383.      
  14384.      
  14385.        if not Identifier_Utilities.Is_Id_Null (root) then
  14386.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14387.        end if;
  14388.      
  14389.      
  14390.      
  14391.     end Scan_concatenate;
  14392.      
  14393.      
  14394.     procedure Scan_divide(Root : divideNode.Locator) is
  14395.     begin
  14396.      
  14397.      
  14398.        if not Identifier_Utilities.Is_Id_Null (root) then
  14399.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14400.        end if;
  14401.      
  14402.      
  14403.      
  14404.     end Scan_divide;
  14405.      
  14406.      
  14407.     procedure Scan_equal(Root : equalNode.Locator) is
  14408.     begin
  14409.      
  14410.      
  14411.        if not Identifier_Utilities.Is_Id_Null (root) then
  14412.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14413.        end if;
  14414.      
  14415.      
  14416.      
  14417.     end Scan_equal;
  14418.      
  14419.      
  14420.     procedure Scan_exponent(Root : exponentNode.Locator) is
  14421.     begin
  14422.      
  14423.      
  14424.        if not Identifier_Utilities.Is_Id_Null (root) then
  14425.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14426.        end if;
  14427.      
  14428.      
  14429.      
  14430.     end Scan_exponent;
  14431.      
  14432.      
  14433.     procedure Scan_greater_than(Root : greater_thanNode.Locator) is
  14434.     begin
  14435.      
  14436.      
  14437.        if not Identifier_Utilities.Is_Id_Null (root) then
  14438.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14439.        end if;
  14440.      
  14441.      
  14442.      
  14443.     end Scan_greater_than;
  14444.      
  14445.      
  14446.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator) is
  14447.     begin
  14448.      
  14449.      
  14450.        if not Identifier_Utilities.Is_Id_Null (root) then
  14451.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14452.        end if;
  14453.      
  14454.      
  14455.      
  14456.     end Scan_greater_than_or_equal;
  14457.      
  14458.      
  14459.     procedure Scan_less_than(Root : less_thanNode.Locator) is
  14460.     begin
  14461.      
  14462.      
  14463.        if not Identifier_Utilities.Is_Id_Null (root) then
  14464.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14465.        end if;
  14466.      
  14467.      
  14468.      
  14469.     end Scan_less_than;
  14470.      
  14471.      
  14472.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator) is
  14473.     begin
  14474.      
  14475.      
  14476.        if not Identifier_Utilities.Is_Id_Null (root) then
  14477.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14478.        end if;
  14479.      
  14480.      
  14481.      
  14482.     end Scan_less_than_or_equal;
  14483.      
  14484.      
  14485.     procedure Scan_minus(Root : minusNode.Locator) is
  14486.     begin
  14487.      
  14488.      
  14489.        if not Identifier_Utilities.Is_Id_Null (root) then
  14490.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14491.        end if;
  14492.      
  14493.      
  14494.      
  14495.     end Scan_minus;
  14496.      
  14497.      
  14498.     procedure Scan_multiply(Root : multiplyNode.Locator) is
  14499.     begin
  14500.      
  14501.      
  14502.        if not Identifier_Utilities.Is_Id_Null (root) then
  14503.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14504.        end if;
  14505.      
  14506.      
  14507.      
  14508.     end Scan_multiply;
  14509.      
  14510.      
  14511.     procedure Scan_negate(Root : negateNode.Locator) is
  14512.     begin
  14513.      
  14514.      
  14515.        if not Identifier_Utilities.Is_Id_Null (root) then
  14516.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14517.        end if;
  14518.      
  14519.      
  14520.      
  14521.     end Scan_negate;
  14522.      
  14523.      
  14524.     procedure Scan_not_equal(Root : not_equalNode.Locator) is
  14525.     begin
  14526.      
  14527.      
  14528.        if not Identifier_Utilities.Is_Id_Null (root) then
  14529.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14530.        end if;
  14531.      
  14532.      
  14533.      
  14534.     end Scan_not_equal;
  14535.      
  14536.      
  14537.     procedure Scan_plus(Root : plusNode.Locator) is
  14538.     begin
  14539.      
  14540.      
  14541.        if not Identifier_Utilities.Is_Id_Null (root) then
  14542.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14543.        end if;
  14544.      
  14545.      
  14546.      
  14547.     end Scan_plus;
  14548.      
  14549.      
  14550.     procedure Scan_unary_plus(Root : unary_plusNode.Locator) is
  14551.     begin
  14552.      
  14553.      
  14554.        if not Identifier_Utilities.Is_Id_Null (root) then
  14555.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14556.        end if;
  14557.      
  14558.      
  14559.      
  14560.     end Scan_unary_plus;
  14561.      
  14562.      
  14563.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator) is
  14564.     begin
  14565.         case Kind(Root) is
  14566.           when lim_priv_type_idKind => Scan_lim_priv_type_id(Root);
  14567.           when priv_type_idKind => Scan_priv_type_id(Root);
  14568.           when type_idKind => Scan_type_id(Root);
  14569.           when others => null;
  14570.         end case;
  14571.     end Scan_GENERAL_TYPE_ID;
  14572.      
  14573.      
  14574.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator) is
  14575.     begin
  14576.      
  14577.      
  14578.        if not Identifier_Utilities.Is_Id_Null (root) then
  14579.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14580.        end if;
  14581.      
  14582.      
  14583.      
  14584.     end Scan_lim_priv_type_id;
  14585.      
  14586.      
  14587.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator) is
  14588.     begin
  14589.      
  14590.      
  14591.        if not Identifier_Utilities.Is_Id_Null (root) then
  14592.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14593.        end if;
  14594.      
  14595.      
  14596.      
  14597.     end Scan_priv_type_id;
  14598.      
  14599.      
  14600.     procedure Scan_type_id(Root : type_idNode.Locator) is
  14601.     begin
  14602.      
  14603.      
  14604.        if not Identifier_Utilities.Is_Id_Null (root) then
  14605.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14606.        end if;
  14607.      
  14608.      
  14609.      
  14610.     end Scan_type_id;
  14611.      
  14612.      
  14613.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator) is
  14614.     begin
  14615.         case Kind(Root) is
  14616.           when def_charKind => Scan_def_char(Root);
  14617.           when enum_idKind => Scan_enum_id(Root);
  14618.           when others => null;
  14619.         end case;
  14620.     end Scan_LITERAL_ID;
  14621.      
  14622.      
  14623.     procedure Scan_def_char(Root : def_charNode.Locator) is
  14624.     begin
  14625.      
  14626.      
  14627.        if not Identifier_Utilities.Is_Id_Null (root) then
  14628.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14629.        end if;
  14630.      
  14631.      
  14632.      
  14633.     end Scan_def_char;
  14634.      
  14635.      
  14636.     procedure Scan_enum_id(Root : enum_idNode.Locator) is
  14637.     begin
  14638.      
  14639.      
  14640.        if not Identifier_Utilities.Is_Id_Null (root) then
  14641.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14642.        end if;
  14643.      
  14644.      
  14645.      
  14646.     end Scan_enum_id;
  14647.      
  14648.      
  14649.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator) is
  14650.     begin
  14651.         case Kind(Root) is
  14652.           when PARAM_IDKind => Scan_PARAM_ID(Root);
  14653.           when component_idKind => Scan_component_id(Root);
  14654.           when constant_idKind => Scan_constant_id(Root);
  14655.           when dscrmt_idKind => Scan_dscrmt_id(Root);
  14656.           when variable_idKind => Scan_variable_id(Root);
  14657.           when others => null;
  14658.         end case;
  14659.     end Scan_OBJECT_ID;
  14660.      
  14661.      
  14662.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator) is
  14663.     begin
  14664.         case Kind(Root) is
  14665.           when in_idKind => Scan_in_id(Root);
  14666.           when in_out_idKind => Scan_in_out_id(Root);
  14667.           when out_idKind => Scan_out_id(Root);
  14668.           when others => null;
  14669.         end case;
  14670.     end Scan_PARAM_ID;
  14671.      
  14672.      
  14673.     procedure Scan_in_id(Root : in_idNode.Locator) is
  14674.     begin
  14675.      
  14676.      
  14677.        if not Identifier_Utilities.Is_Id_Null (root) then
  14678.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14679.        end if;
  14680.      
  14681.      
  14682.      
  14683.     end Scan_in_id;
  14684.      
  14685.      
  14686.     procedure Scan_in_out_id(Root : in_out_idNode.Locator) is
  14687.     begin
  14688.      
  14689.      
  14690.        if not Identifier_Utilities.Is_Id_Null (root) then
  14691.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14692.        end if;
  14693.      
  14694.      
  14695.      
  14696.     end Scan_in_out_id;
  14697.      
  14698.      
  14699.     procedure Scan_out_id(Root : out_idNode.Locator) is
  14700.     begin
  14701.      
  14702.      
  14703.        if not Identifier_Utilities.Is_Id_Null (root) then
  14704.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14705.        end if;
  14706.      
  14707.      
  14708.      
  14709.     end Scan_out_id;
  14710.      
  14711.      
  14712.     procedure Scan_component_id(Root : component_idNode.Locator) is
  14713.     begin
  14714.      
  14715.      
  14716.        if not Identifier_Utilities.Is_Id_Null (root) then
  14717.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14718.        end if;
  14719.      
  14720.      
  14721.      
  14722.     end Scan_component_id;
  14723.      
  14724.      
  14725.     procedure Scan_constant_id(Root : constant_idNode.Locator) is
  14726.     begin
  14727.      
  14728.      
  14729.        if not Identifier_Utilities.Is_Id_Null (root) then
  14730.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14731.        end if;
  14732.      
  14733.      
  14734.      
  14735.     end Scan_constant_id;
  14736.      
  14737.      
  14738.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator) is
  14739.     begin
  14740.      
  14741.      
  14742.        if not Identifier_Utilities.Is_Id_Null (root) then
  14743.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14744.        end if;
  14745.      
  14746.      
  14747.      
  14748.     end Scan_dscrmt_id;
  14749.      
  14750.      
  14751.     procedure Scan_variable_id(Root : variable_idNode.Locator) is
  14752.     begin
  14753.      
  14754.      
  14755.        if not Identifier_Utilities.Is_Id_Null (root) then
  14756.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14757.        end if;
  14758.      
  14759.      
  14760.      
  14761.     end Scan_variable_id;
  14762.      
  14763.      
  14764.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator) is
  14765.     begin
  14766.         case Kind(Root) is
  14767.           when generic_pkg_idKind => Scan_generic_pkg_id(Root);
  14768.           when pkg_idKind => Scan_pkg_id(Root);
  14769.           when others => null;
  14770.         end case;
  14771.     end Scan_PKG_ID_CLASS;
  14772.      
  14773.      
  14774.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator) is
  14775.     begin
  14776.      
  14777.      
  14778.        if not Identifier_Utilities.Is_Id_Null (root) then
  14779.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14780.        end if;
  14781.      
  14782.      
  14783.      
  14784.     end Scan_generic_pkg_id;
  14785.      
  14786.      
  14787.     procedure Scan_pkg_id(Root : pkg_idNode.Locator) is
  14788.     begin
  14789.      
  14790.      
  14791.        if not Identifier_Utilities.Is_Id_Null (root) then
  14792.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14793.        end if;
  14794.      
  14795.      
  14796.      
  14797.     end Scan_pkg_id;
  14798.      
  14799.      
  14800.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator) is
  14801.     begin
  14802.         case Kind(Root) is
  14803.           when AIE_PRAGMA_IDKind => Scan_AIE_PRAGMA_ID(Root);
  14804.           when LRM_PRAGMA_IDKind => Scan_LRM_PRAGMA_ID(Root);
  14805.           when others => null;
  14806.         end case;
  14807.     end Scan_PRAGMA_ID;
  14808.      
  14809.      
  14810.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator) is
  14811.     begin
  14812.         case Kind(Root) is
  14813.           when link_name_pragmaKind => Scan_link_name_pragma(Root);
  14814.           when mark_release_pragmaKind => Scan_mark_release_pragma(Root);
  14815.           when monitor_pragmaKind => Scan_monitor_pragma(Root);
  14816.           when unrecognized_pragmaKind => Scan_unrecognized_pragma(Root);
  14817.           when others => null;
  14818.         end case;
  14819.     end Scan_AIE_PRAGMA_ID;
  14820.      
  14821.      
  14822.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator) is
  14823.     begin
  14824.      
  14825.      
  14826.        if not Identifier_Utilities.Is_Id_Null (root) then
  14827.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14828.        end if;
  14829.      
  14830.      
  14831.      
  14832.     end Scan_link_name_pragma;
  14833.      
  14834.      
  14835.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator) is
  14836.     begin
  14837.      
  14838.      
  14839.        if not Identifier_Utilities.Is_Id_Null (root) then
  14840.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14841.        end if;
  14842.      
  14843.      
  14844.      
  14845.     end Scan_mark_release_pragma;
  14846.      
  14847.      
  14848.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator) is
  14849.     begin
  14850.      
  14851.      
  14852.        if not Identifier_Utilities.Is_Id_Null (root) then
  14853.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14854.        end if;
  14855.      
  14856.      
  14857.      
  14858.     end Scan_monitor_pragma;
  14859.      
  14860.      
  14861.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator) is
  14862.     begin
  14863.      
  14864.      
  14865.        if not Identifier_Utilities.Is_Id_Null (root) then
  14866.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14867.        end if;
  14868.      
  14869.      
  14870.      
  14871.     end Scan_unrecognized_pragma;
  14872.      
  14873.      
  14874.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator) is
  14875.     begin
  14876.         case Kind(Root) is
  14877.           when controlled_pragmaKind => Scan_controlled_pragma(Root);
  14878.           when elaborate_pragmaKind => Scan_elaborate_pragma(Root);
  14879.           when inline_pragmaKind => Scan_inline_pragma(Root);
  14880.           when interface_pragmaKind => Scan_interface_pragma(Root);
  14881.           when list_pragmaKind => Scan_list_pragma(Root);
  14882.           when memory_size_pragmaKind => Scan_memory_size_pragma(Root);
  14883.           when optimize_pragmaKind => Scan_optimize_pragma(Root);
  14884.           when pack_pragmaKind => Scan_pack_pragma(Root);
  14885.           when page_pragmaKind => Scan_page_pragma(Root);
  14886.           when priority_pragmaKind => Scan_priority_pragma(Root);
  14887.           when shared_pragmaKind => Scan_shared_pragma(Root);
  14888.           when storage_unit_pragmaKind => Scan_storage_unit_pragma(Root);
  14889.           when suppress_pragmaKind => Scan_suppress_pragma(Root);
  14890.           when system_name_pragmaKind => Scan_system_name_pragma(Root);
  14891.           when others => null;
  14892.         end case;
  14893.     end Scan_LRM_PRAGMA_ID;
  14894.      
  14895.      
  14896.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator) is
  14897.     begin
  14898.      
  14899.      
  14900.        if not Identifier_Utilities.Is_Id_Null (root) then
  14901.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14902.        end if;
  14903.      
  14904.      
  14905.      
  14906.     end Scan_controlled_pragma;
  14907.      
  14908.      
  14909.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator) is
  14910.     begin
  14911.      
  14912.      
  14913.        if not Identifier_Utilities.Is_Id_Null (root) then
  14914.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14915.        end if;
  14916.      
  14917.      
  14918.      
  14919.     end Scan_elaborate_pragma;
  14920.      
  14921.      
  14922.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator) is
  14923.     begin
  14924.      
  14925.      
  14926.        if not Identifier_Utilities.Is_Id_Null (root) then
  14927.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14928.        end if;
  14929.      
  14930.      
  14931.      
  14932.     end Scan_inline_pragma;
  14933.      
  14934.      
  14935.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator) is
  14936.     begin
  14937.      
  14938.      
  14939.        if not Identifier_Utilities.Is_Id_Null (root) then
  14940.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14941.        end if;
  14942.      
  14943.      
  14944.      
  14945.     end Scan_interface_pragma;
  14946.      
  14947.      
  14948.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator) is
  14949.     begin
  14950.      
  14951.      
  14952.        if not Identifier_Utilities.Is_Id_Null (root) then
  14953.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14954.        end if;
  14955.      
  14956.      
  14957.      
  14958.     end Scan_list_pragma;
  14959.      
  14960.      
  14961.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator) is
  14962.     begin
  14963.      
  14964.      
  14965.        if not Identifier_Utilities.Is_Id_Null (root) then
  14966.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14967.        end if;
  14968.      
  14969.      
  14970.      
  14971.     end Scan_memory_size_pragma;
  14972.      
  14973.      
  14974.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator) is
  14975.     begin
  14976.      
  14977.      
  14978.        if not Identifier_Utilities.Is_Id_Null (root) then
  14979.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14980.        end if;
  14981.      
  14982.      
  14983.      
  14984.     end Scan_optimize_pragma;
  14985.      
  14986.      
  14987.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator) is
  14988.     begin
  14989.      
  14990.      
  14991.        if not Identifier_Utilities.Is_Id_Null (root) then
  14992.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  14993.        end if;
  14994.      
  14995.      
  14996.      
  14997.     end Scan_pack_pragma;
  14998.      
  14999.      
  15000.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator) is
  15001.     begin
  15002.      
  15003.      
  15004.        if not Identifier_Utilities.Is_Id_Null (root) then
  15005.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15006.        end if;
  15007.      
  15008.      
  15009.      
  15010.     end Scan_page_pragma;
  15011.      
  15012.      
  15013.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator) is
  15014.     begin
  15015.      
  15016.      
  15017.        if not Identifier_Utilities.Is_Id_Null (root) then
  15018.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15019.        end if;
  15020.      
  15021.      
  15022.      
  15023.     end Scan_priority_pragma;
  15024.      
  15025.      
  15026.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator) is
  15027.     begin
  15028.      
  15029.      
  15030.        if not Identifier_Utilities.Is_Id_Null (root) then
  15031.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15032.        end if;
  15033.      
  15034.      
  15035.      
  15036.     end Scan_shared_pragma;
  15037.      
  15038.      
  15039.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator) is
  15040.     begin
  15041.      
  15042.      
  15043.        if not Identifier_Utilities.Is_Id_Null (root) then
  15044.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15045.        end if;
  15046.      
  15047.      
  15048.      
  15049.     end Scan_storage_unit_pragma;
  15050.      
  15051.      
  15052.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator) is
  15053.     begin
  15054.      
  15055.      
  15056.        if not Identifier_Utilities.Is_Id_Null (root) then
  15057.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15058.        end if;
  15059.      
  15060.      
  15061.      
  15062.     end Scan_suppress_pragma;
  15063.      
  15064.      
  15065.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator) is
  15066.     begin
  15067.      
  15068.      
  15069.        if not Identifier_Utilities.Is_Id_Null (root) then
  15070.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15071.        end if;
  15072.      
  15073.      
  15074.      
  15075.     end Scan_system_name_pragma;
  15076.      
  15077.      
  15078.     procedure Scan_STM_ID(Root : STM_ID.Locator) is
  15079.     begin
  15080.         case Kind(Root) is
  15081.           when block_idKind => Scan_block_id(Root);
  15082.           when label_idKind => Scan_label_id(Root);
  15083.           when loop_idKind => Scan_loop_id(Root);
  15084.           when others => null;
  15085.         end case;
  15086.     end Scan_STM_ID;
  15087.      
  15088.      
  15089.     procedure Scan_block_id(Root : block_idNode.Locator) is
  15090.     begin
  15091.      
  15092.      
  15093.        if not Identifier_Utilities.Is_Id_Null (root) then
  15094.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15095.        end if;
  15096.      
  15097.      
  15098.      
  15099.     end Scan_block_id;
  15100.      
  15101.      
  15102.     procedure Scan_label_id(Root : label_idNode.Locator) is
  15103.     begin
  15104.      
  15105.      
  15106.        if not Identifier_Utilities.Is_Id_Null (root) then
  15107.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15108.        end if;
  15109.      
  15110.      
  15111.      
  15112.     end Scan_label_id;
  15113.      
  15114.      
  15115.     procedure Scan_loop_id(Root : loop_idNode.Locator) is
  15116.     begin
  15117.      
  15118.      
  15119.     IncrementToken (colonz);
  15120.      
  15121.      
  15122.      
  15123.      
  15124.        if not Identifier_Utilities.Is_Id_Null (root) then
  15125.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15126.        end if;
  15127.      
  15128.      
  15129.      
  15130.     end Scan_loop_id;
  15131.      
  15132.      
  15133.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator) is
  15134.     begin
  15135.         case Kind(Root) is
  15136.           when GENERIC_SUBP_IDKind => Scan_GENERIC_SUBP_ID(Root);
  15137.           when def_operatorKind => Scan_def_operator(Root);
  15138.           when entry_idKind => Scan_entry_id(Root);
  15139.           when func_idKind => Scan_func_id(Root);
  15140.           when proc_idKind => Scan_proc_id(Root);
  15141.           when others => null;
  15142.         end case;
  15143.     end Scan_SUBP_ID;
  15144.      
  15145.      
  15146.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator) is
  15147.     begin
  15148.         case Kind(Root) is
  15149.           when generic_func_idKind => Scan_generic_func_id(Root);
  15150.           when generic_proc_idKind => Scan_generic_proc_id(Root);
  15151.           when others => null;
  15152.         end case;
  15153.     end Scan_GENERIC_SUBP_ID;
  15154.      
  15155.      
  15156.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator) is
  15157.     begin
  15158.      
  15159.      
  15160.        if not Identifier_Utilities.Is_Id_Null (root) then
  15161.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15162.        end if;
  15163.      
  15164.      
  15165.      
  15166.     end Scan_generic_func_id;
  15167.      
  15168.      
  15169.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator) is
  15170.     begin
  15171.      
  15172.      
  15173.        if not Identifier_Utilities.Is_Id_Null (root) then
  15174.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15175.        end if;
  15176.      
  15177.      
  15178.      
  15179.     end Scan_generic_proc_id;
  15180.      
  15181.      
  15182.     procedure Scan_def_operator(Root : def_operatorNode.Locator) is
  15183.     begin
  15184.      
  15185.      
  15186.        if not Identifier_Utilities.Is_Id_Null (root) then
  15187.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15188.        end if;
  15189.      
  15190.      
  15191.      
  15192.     end Scan_def_operator;
  15193.      
  15194.      
  15195.     procedure Scan_entry_id(Root : entry_idNode.Locator) is
  15196.     begin
  15197.      
  15198.      
  15199.        if not Identifier_Utilities.Is_Id_Null (root) then
  15200.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15201.        end if;
  15202.      
  15203.      
  15204.      
  15205.     end Scan_entry_id;
  15206.      
  15207.      
  15208.     procedure Scan_func_id(Root : func_idNode.Locator) is
  15209.     begin
  15210.      
  15211.      
  15212.        if not Identifier_Utilities.Is_Id_Null (root) then
  15213.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15214.        end if;
  15215.      
  15216.      
  15217.      
  15218.     end Scan_func_id;
  15219.      
  15220.      
  15221.     procedure Scan_proc_id(Root : proc_idNode.Locator) is
  15222.     begin
  15223.      
  15224.      
  15225.        if not Identifier_Utilities.Is_Id_Null (root) then
  15226.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15227.        end if;
  15228.      
  15229.      
  15230.      
  15231.     end Scan_proc_id;
  15232.      
  15233.      
  15234.     procedure Scan_argument_id(Root : argument_idNode.Locator) is
  15235.     begin
  15236.      
  15237.      
  15238.        if not Identifier_Utilities.Is_Id_Null (root) then
  15239.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15240.        end if;
  15241.      
  15242.      
  15243.      
  15244.     end Scan_argument_id;
  15245.      
  15246.      
  15247.     procedure Scan_exception_id(Root : exception_idNode.Locator) is
  15248.     begin
  15249.      
  15250.      
  15251.        if not Identifier_Utilities.Is_Id_Null (root) then
  15252.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15253.        end if;
  15254.      
  15255.      
  15256.      
  15257.     end Scan_exception_id;
  15258.      
  15259.      
  15260.     procedure Scan_iteration_id(Root : iteration_idNode.Locator) is
  15261.     begin
  15262.      
  15263.      
  15264.        if not Identifier_Utilities.Is_Id_Null (root) then
  15265.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15266.        end if;
  15267.      
  15268.      
  15269.      
  15270.     end Scan_iteration_id;
  15271.      
  15272.      
  15273.     procedure Scan_number_id(Root : number_idNode.Locator) is
  15274.     begin
  15275.      
  15276.      
  15277.        if not Identifier_Utilities.Is_Id_Null (root) then
  15278.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15279.        end if;
  15280.      
  15281.      
  15282.      
  15283.     end Scan_number_id;
  15284.      
  15285.      
  15286.     procedure Scan_subtype_id(Root : subtype_idNode.Locator) is
  15287.     begin
  15288.      
  15289.      
  15290.        if not Identifier_Utilities.Is_Id_Null (root) then
  15291.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15292.        end if;
  15293.      
  15294.      
  15295.      
  15296.     end Scan_subtype_id;
  15297.      
  15298.      
  15299.     procedure Scan_task_body_id(Root : task_body_idNode.Locator) is
  15300.     begin
  15301.      
  15302.      
  15303.        if not Identifier_Utilities.Is_Id_Null (root) then
  15304.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  15305.        end if;
  15306.      
  15307.      
  15308.      
  15309.     end Scan_task_body_id;
  15310.      
  15311. end DEF_ID_Pkg;
  15312. -- End: SCDEF_ID bdy -----------------------------------------------------
  15313. ::::::::::::::
  15314. scdef_id.spc
  15315. ::::::::::::::
  15316. -- Begin: SCDEF_ID spc ---------------------------------------------------
  15317.      
  15318. with ST_DIANA; use ST_DIANA;
  15319.              package DEF_ID_Pkg is
  15320.     procedure Scan_DEF_ID(Root : DEF_ID.Locator);
  15321.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator);
  15322.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator);
  15323.     procedure Scan_address_id(Root : address_idNode.Locator);
  15324.     procedure Scan_aft_id(Root : aft_idNode.Locator);
  15325.     procedure Scan_base_id(Root : base_idNode.Locator);
  15326.     procedure Scan_callable_id(Root : callable_idNode.Locator);
  15327.     procedure Scan_constrained_id(Root : constrained_idNode.Locator);
  15328.     procedure Scan_count_id(Root : count_idNode.Locator);
  15329.     procedure Scan_delta_id(Root : delta_idNode.Locator);
  15330.     procedure Scan_digits_id(Root : digits_idNode.Locator);
  15331.     procedure Scan_emax_id(Root : emax_idNode.Locator);
  15332.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator);
  15333.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator);
  15334.     procedure Scan_first_index_id(Root : first_index_idNode.Locator);
  15335.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator);
  15336.     procedure Scan_fore_id(Root : fore_idNode.Locator);
  15337.     procedure Scan_image_id(Root : image_idNode.Locator);
  15338.     procedure Scan_large_id(Root : large_idNode.Locator);
  15339.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator);
  15340.     procedure Scan_last_index_id(Root : last_index_idNode.Locator);
  15341.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator);
  15342.     procedure Scan_length_id(Root : length_idNode.Locator);
  15343.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator);
  15344.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator);
  15345.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator);
  15346.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator);
  15347.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator);
  15348.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator);
  15349.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator);
  15350.     procedure Scan_pos_id(Root : pos_idNode.Locator);
  15351.     procedure Scan_position_id(Root : position_idNode.Locator);
  15352.     procedure Scan_pred_id(Root : pred_idNode.Locator);
  15353.     procedure Scan_range_id(Root : range_idNode.Locator);
  15354.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator);
  15355.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator);
  15356.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator);
  15357.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator);
  15358.     procedure Scan_size_type_id(Root : size_type_idNode.Locator);
  15359.     procedure Scan_small_id(Root : small_idNode.Locator);
  15360.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator);
  15361.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator);
  15362.     procedure Scan_succ_id(Root : succ_idNode.Locator);
  15363.     procedure Scan_terminated_id(Root : terminated_idNode.Locator);
  15364.     procedure Scan_val_id(Root : val_idNode.Locator);
  15365.     procedure Scan_value_id(Root : value_idNode.Locator);
  15366.     procedure Scan_width_id(Root : width_idNode.Locator);
  15367.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator);
  15368.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator);
  15369.     procedure Scan_built_in_and(Root : built_in_andNode.Locator);
  15370.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator);
  15371.     procedure Scan_built_in_not(Root : built_in_notNode.Locator);
  15372.     procedure Scan_built_in_or(Root : built_in_orNode.Locator);
  15373.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator);
  15374.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator);
  15375.     procedure Scan_concatenate(Root : concatenateNode.Locator);
  15376.     procedure Scan_divide(Root : divideNode.Locator);
  15377.     procedure Scan_equal(Root : equalNode.Locator);
  15378.     procedure Scan_exponent(Root : exponentNode.Locator);
  15379.     procedure Scan_greater_than(Root : greater_thanNode.Locator);
  15380.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator);
  15381.     procedure Scan_less_than(Root : less_thanNode.Locator);
  15382.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator);
  15383.     procedure Scan_minus(Root : minusNode.Locator);
  15384.     procedure Scan_multiply(Root : multiplyNode.Locator);
  15385.     procedure Scan_negate(Root : negateNode.Locator);
  15386.     procedure Scan_not_equal(Root : not_equalNode.Locator);
  15387.     procedure Scan_plus(Root : plusNode.Locator);
  15388.     procedure Scan_unary_plus(Root : unary_plusNode.Locator);
  15389.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator);
  15390.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator);
  15391.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator);
  15392.     procedure Scan_type_id(Root : type_idNode.Locator);
  15393.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator);
  15394.     procedure Scan_def_char(Root : def_charNode.Locator);
  15395.     procedure Scan_enum_id(Root : enum_idNode.Locator);
  15396.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator);
  15397.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator);
  15398.     procedure Scan_in_id(Root : in_idNode.Locator);
  15399.     procedure Scan_in_out_id(Root : in_out_idNode.Locator);
  15400.     procedure Scan_out_id(Root : out_idNode.Locator);
  15401.     procedure Scan_component_id(Root : component_idNode.Locator);
  15402.     procedure Scan_constant_id(Root : constant_idNode.Locator);
  15403.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator);
  15404.     procedure Scan_variable_id(Root : variable_idNode.Locator);
  15405.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator);
  15406.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator);
  15407.     procedure Scan_pkg_id(Root : pkg_idNode.Locator);
  15408.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator);
  15409.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator);
  15410.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator);
  15411.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator);
  15412.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator);
  15413.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator);
  15414.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator);
  15415.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator);
  15416.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator);
  15417.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator);
  15418.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator);
  15419.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator);
  15420.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator);
  15421.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator);
  15422.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator);
  15423.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator);
  15424.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator);
  15425.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator);
  15426.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator);
  15427.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator);
  15428.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator);
  15429.     procedure Scan_STM_ID(Root : STM_ID.Locator);
  15430.     procedure Scan_block_id(Root : block_idNode.Locator);
  15431.     procedure Scan_label_id(Root : label_idNode.Locator);
  15432.     procedure Scan_loop_id(Root : loop_idNode.Locator);
  15433.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator);
  15434.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator);
  15435.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator);
  15436.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator);
  15437.     procedure Scan_def_operator(Root : def_operatorNode.Locator);
  15438.     procedure Scan_entry_id(Root : entry_idNode.Locator);
  15439.     procedure Scan_func_id(Root : func_idNode.Locator);
  15440.     procedure Scan_proc_id(Root : proc_idNode.Locator);
  15441.     procedure Scan_argument_id(Root : argument_idNode.Locator);
  15442.     procedure Scan_exception_id(Root : exception_idNode.Locator);
  15443.     procedure Scan_iteration_id(Root : iteration_idNode.Locator);
  15444.     procedure Scan_number_id(Root : number_idNode.Locator);
  15445.     procedure Scan_subtype_id(Root : subtype_idNode.Locator);
  15446.     procedure Scan_task_body_id(Root : task_body_idNode.Locator);
  15447. end DEF_ID_Pkg;
  15448. -- End: SCDEF_ID spc -----------------------------------------------------
  15449. ::::::::::::::
  15450. scgeneral.bdy
  15451. ::::::::::::::
  15452. -- Begin: SCGENERAL_ASSOC bdy ---------------------------------------------------
  15453.      
  15454. with Halstead_Data_Base;  use Halstead_Data_Base;
  15455. with Definitions; use Definitions;
  15456.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15457. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  15458. package body GENERAL_ASSOC_Pkg is
  15459.      
  15460.      
  15461.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator) is
  15462.     begin
  15463.         case Kind(Root) is
  15464.           when GA_ASSOC_EXPKind => Scan_GA_ASSOC_EXP(Root);
  15465.           when ga_rangeKind => Scan_ga_range(Root);
  15466.           when others => null;
  15467.         end case;
  15468.     end Scan_GENERAL_ASSOC;
  15469.      
  15470.      
  15471.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator) is
  15472.     begin
  15473.         case Kind(Root) is
  15474.           when ga_assocKind => Scan_ga_assoc(Root);
  15475.           when ga_expKind => Scan_ga_exp(Root);
  15476.           when others => null;
  15477.         end case;
  15478.     end Scan_GA_ASSOC_EXP;
  15479.      
  15480.      
  15481.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator) is
  15482.         as_id_s_List : SeqOfused_idNode.Generator;
  15483.         as_id_s_Item : used_idNode.Locator;
  15484.         use SeqOfused_idNode;
  15485.     begin
  15486.       if not SeqOfused_idNode.IsNull(as_id_s(Root)) then
  15487.         StartForward(as_id_s(Root), as_id_s_List);
  15488.         while not Finished(as_id_s_List) loop
  15489.             as_id_s_Item := Cell(as_id_s_List);
  15490.             Scan_used_id(as_id_s_Item);
  15491.             Forward(as_id_s_List);
  15492.         end loop;
  15493.         EndIterate(as_id_s_List);
  15494.       end if;
  15495.       if not NAME_EXP.IsNull(as_exp(Root)) then
  15496.         Scan_NAME_EXP(as_exp(Root));
  15497.       end if;
  15498.      
  15499.     end Scan_ga_assoc;
  15500.      
  15501.      
  15502.     procedure Scan_ga_exp(Root : ga_expNode.Locator) is
  15503.     begin
  15504.       if not NAME_EXP.IsNull(as_exp(Root)) then
  15505.         Scan_NAME_EXP(as_exp(Root));
  15506.       end if;
  15507.      
  15508.     end Scan_ga_exp;
  15509.      
  15510.      
  15511.     procedure Scan_ga_range(Root : ga_rangeNode.Locator) is
  15512.     begin
  15513.       if not OBJECT_TYPE.IsNull(as_apply_discrete_range(Root)) then
  15514.         Scan_OBJECT_TYPE(as_apply_discrete_range(Root));
  15515.       end if;
  15516.      
  15517.     end Scan_ga_range;
  15518.      
  15519. end GENERAL_ASSOC_Pkg;
  15520. -- End: SCGENERAL_ASSOC bdy -----------------------------------------------------
  15521. ::::::::::::::
  15522. scgeneral.spc
  15523. ::::::::::::::
  15524. -- Begin: SCGENERAL_ASSOC spc ---------------------------------------------------
  15525.      
  15526. with ST_DIANA; use ST_DIANA;
  15527.              package GENERAL_ASSOC_Pkg is
  15528.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator);
  15529.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator);
  15530.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator);
  15531.     procedure Scan_ga_exp(Root : ga_expNode.Locator);
  15532.     procedure Scan_ga_range(Root : ga_rangeNode.Locator);
  15533. end GENERAL_ASSOC_Pkg;
  15534. -- End: SCGENERAL_ASSOC spc -----------------------------------------------------
  15535. ::::::::::::::
  15536. scgeneric.bdy
  15537. ::::::::::::::
  15538. -- Begin: SCGENERIC_HEADER_CLASS bdy ---------------------------------------------------
  15539.      
  15540. with Halstead_Data_Base;  use Halstead_Data_Base;
  15541. with Definitions; use Definitions;
  15542.              with generic_header_IH;
  15543. with ITEM_Pkg; use ITEM_Pkg;
  15544. package body GENERIC_HEADER_CLASS_Pkg is
  15545.      
  15546.      
  15547.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator) is
  15548.     begin
  15549.         case Kind(Root) is
  15550.           when generic_headerKind => Scan_generic_header(Root);
  15551.           when others => null;
  15552.         end case;
  15553.     end Scan_GENERIC_HEADER_CLASS;
  15554.      
  15555.      
  15556.     procedure Scan_generic_header(Root : generic_headerNode.Locator) is
  15557.         as_generic_param_s_List : SeqOfITEM.Generator;
  15558.         as_generic_param_s_Item : ITEM.Locator;
  15559.         use SeqOfITEM;
  15560.         Old_generic_header_IHR : generic_header_IH.RecType := generic_header_IH.R;
  15561.     begin
  15562.         generic_header_IH.R.ih_ingeneric_param :=  false ;
  15563.      
  15564.      
  15565.       generic_header_IH.R.ih_ingeneric_param := true;
  15566.      
  15567.      
  15568.       if not SeqOfITEM.IsNull(as_generic_param_s(Root)) then
  15569.         StartForward(as_generic_param_s(Root), as_generic_param_s_List);
  15570.         while not Finished(as_generic_param_s_List) loop
  15571.             as_generic_param_s_Item := Cell(as_generic_param_s_List);
  15572.      
  15573.      
  15574.        IncrementToken (semicolonz);
  15575.      
  15576.      
  15577.             Scan_ITEM(as_generic_param_s_Item);
  15578.             Forward(as_generic_param_s_List);
  15579.         end loop;
  15580.         EndIterate(as_generic_param_s_List);
  15581.       end if;
  15582.      
  15583.      
  15584.        generic_header_IH.R.ih_ingeneric_param := true;
  15585.      
  15586.      
  15587.         generic_header_IH.R := Old_generic_header_IHR;
  15588.      
  15589.     end Scan_generic_header;
  15590.      
  15591. end GENERIC_HEADER_CLASS_Pkg;
  15592. -- End: SCGENERIC_HEADER_CLASS bdy -----------------------------------------------------
  15593. ::::::::::::::
  15594. scgeneric.spc
  15595. ::::::::::::::
  15596. -- Begin: SCGENERIC_HEADER_CLASS spc ---------------------------------------------------
  15597.      
  15598. with ST_DIANA; use ST_DIANA;
  15599.              package GENERIC_HEADER_CLASS_Pkg is
  15600.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator);
  15601.     procedure Scan_generic_header(Root : generic_headerNode.Locator);
  15602. end GENERIC_HEADER_CLASS_Pkg;
  15603. -- End: SCGENERIC_HEADER_CLASS spc -----------------------------------------------------
  15604.      
  15605. ::::::::::::::
  15606. scheader.bdy
  15607. ::::::::::::::
  15608. -- Begin: SCHEADER bdy ---------------------------------------------------
  15609.      
  15610. with Halstead_Data_Base;  use Halstead_Data_Base;
  15611. with Definitions; use Definitions;
  15612.              with SERIES_UNIT_IH;
  15613. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15614. with ITEM_Pkg; use ITEM_Pkg;
  15615. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  15616.      
  15617.              with generic_header_IH;
  15618.                         package body HEADER_Pkg is
  15619.      
  15620.      
  15621.     procedure Scan_HEADER(Root : HEADER.Locator) is
  15622.     begin
  15623.         case Kind(Root) is
  15624.           when accept_specKind => Scan_accept_spec(Root);
  15625.           when entry_specKind => Scan_entry_spec(Root);
  15626.           when func_specKind => Scan_func_spec(Root);
  15627.           when proc_specKind => Scan_proc_spec(Root);
  15628.           when others => null;
  15629.         end case;
  15630.     end Scan_HEADER;
  15631.      
  15632.      
  15633.     procedure Scan_accept_spec(Root : accept_specNode.Locator) is
  15634.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15635.         as_param_s_Item : OBJECT_ITEM.Locator;
  15636.         use SeqOfOBJECT_ITEM;
  15637.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15638.     begin
  15639.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15640.      
  15641.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15642.         then
  15643.      
  15644.        IncrementToken (open_parenthesisz);
  15645.      
  15646.         end if;
  15647.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  15648.      
  15649.      
  15650.       IncrementToken (open_parenthesisz);
  15651.      
  15652.      
  15653.         Scan_NAME_EXP(as_family_index(Root));
  15654.      
  15655.      
  15656.       IncrementToken (closed_parenthesisz);
  15657.      
  15658.      
  15659.       end if;
  15660.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15661.         StartForward(as_param_s(Root), as_param_s_List);
  15662.         while not Finished(as_param_s_List) loop
  15663.             as_param_s_Item := Cell(as_param_s_List);
  15664.      
  15665.      
  15666.      if SERIES_UNIT_IH.R.ih_inlist then
  15667.          IncrementToken (semicolonz);
  15668.      end if;
  15669.      SERIES_UNIT_IH.R.ih_inlist := true;
  15670.      
  15671.      
  15672.             Scan_OBJECT_ITEM(as_param_s_Item);
  15673.             Forward(as_param_s_List);
  15674.         end loop;
  15675.         EndIterate(as_param_s_List);
  15676.      
  15677.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15678.         then
  15679.      
  15680.    IncrementToken (closed_parenthesisz);
  15681.    SERIES_UNIT_IH.R.ih_inlist := false;
  15682.      
  15683.         end if;
  15684.       end if;
  15685.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15686.      
  15687.     end Scan_accept_spec;
  15688.      
  15689.      
  15690.     procedure Scan_entry_spec(Root : entry_specNode.Locator) is
  15691.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15692.         as_param_s_Item : OBJECT_ITEM.Locator;
  15693.         use SeqOfOBJECT_ITEM;
  15694.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15695.     begin
  15696.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15697.      
  15698.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15699.         then
  15700.      
  15701.        IncrementToken (open_parenthesisz);
  15702.      
  15703.         end if;
  15704.       if not OBJECT_TYPE.IsNull(as_family_range_void(Root)) then
  15705.      
  15706.      
  15707.       IncrementToken (open_parenthesisz);
  15708.      
  15709.      
  15710.         Scan_OBJECT_TYPE(as_family_range_void(Root));
  15711.      
  15712.      
  15713.      IncrementToken (closed_parenthesisz);
  15714.      
  15715.      
  15716.       end if;
  15717.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15718.         StartForward(as_param_s(Root), as_param_s_List);
  15719.         while not Finished(as_param_s_List) loop
  15720.             as_param_s_Item := Cell(as_param_s_List);
  15721.      
  15722.      
  15723.      if SERIES_UNIT_IH.R.ih_inlist then
  15724.          IncrementToken (semicolonz);
  15725.      end if;
  15726.      SERIES_UNIT_IH.R.ih_inlist := true;
  15727.      
  15728.      
  15729.             Scan_OBJECT_ITEM(as_param_s_Item);
  15730.             Forward(as_param_s_List);
  15731.         end loop;
  15732.         EndIterate(as_param_s_List);
  15733.      
  15734.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15735.         then
  15736.      
  15737.    IncrementToken (closed_parenthesisz);
  15738.    SERIES_UNIT_IH.R.ih_inlist := false;
  15739.      
  15740.         end if;
  15741.       end if;
  15742.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15743.      
  15744.     end Scan_entry_spec;
  15745.      
  15746.      
  15747.     procedure Scan_func_spec(Root : func_specNode.Locator) is
  15748.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15749.         as_param_s_Item : OBJECT_ITEM.Locator;
  15750.         use SeqOfOBJECT_ITEM;
  15751.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15752.     begin
  15753.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15754.      
  15755.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15756.         then
  15757.      
  15758.        IncrementToken (open_parenthesisz);
  15759.      
  15760.         end if;
  15761.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15762.         StartForward(as_param_s(Root), as_param_s_List);
  15763.         while not Finished(as_param_s_List) loop
  15764.             as_param_s_Item := Cell(as_param_s_List);
  15765.      
  15766.      
  15767.      if SERIES_UNIT_IH.R.ih_inlist then
  15768.          IncrementToken (semicolonz);
  15769.      end if;
  15770.      SERIES_UNIT_IH.R.ih_inlist := true;
  15771.      
  15772.      
  15773.             Scan_OBJECT_ITEM(as_param_s_Item);
  15774.             Forward(as_param_s_List);
  15775.         end loop;
  15776.         EndIterate(as_param_s_List);
  15777.      
  15778.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15779.         then
  15780.      
  15781.    IncrementToken (closed_parenthesisz);
  15782.    SERIES_UNIT_IH.R.ih_inlist := false;
  15783.      
  15784.         end if;
  15785.       end if;
  15786.       if not object_type_constrainedNode.IsNull(as_return_type(Root)) then
  15787.      
  15788.      
  15789.      IncrementToken (returnz);
  15790.      
  15791.      
  15792.         Scan_object_type_constrained(as_return_type(Root));
  15793.       end if;
  15794.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15795.      
  15796.     end Scan_func_spec;
  15797.      
  15798.      
  15799.     procedure Scan_proc_spec(Root : proc_specNode.Locator) is
  15800.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  15801.         as_param_s_Item : OBJECT_ITEM.Locator;
  15802.         use SeqOfOBJECT_ITEM;
  15803.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  15804.     begin
  15805.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  15806.      
  15807.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15808.         then
  15809.      
  15810.        IncrementToken (open_parenthesisz);
  15811.      
  15812.         end if;
  15813.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  15814.         StartForward(as_param_s(Root), as_param_s_List);
  15815.         while not Finished(as_param_s_List) loop
  15816.             as_param_s_Item := Cell(as_param_s_List);
  15817.      
  15818.      
  15819.      if SERIES_UNIT_IH.R.ih_inlist then
  15820.          IncrementToken (semicolonz);
  15821.      end if;
  15822.      SERIES_UNIT_IH.R.ih_inlist := true;
  15823.      
  15824.      
  15825.             Scan_OBJECT_ITEM(as_param_s_Item);
  15826.             Forward(as_param_s_List);
  15827.         end loop;
  15828.         EndIterate(as_param_s_List);
  15829.      
  15830.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  15831.         then
  15832.      
  15833.    IncrementToken (closed_parenthesisz);
  15834.    SERIES_UNIT_IH.R.ih_inlist := false;
  15835.      
  15836.         end if;
  15837.       end if;
  15838.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  15839.      
  15840.     end Scan_proc_spec;
  15841.      
  15842. end HEADER_Pkg;
  15843. -- End: SCHEADER bdy -----------------------------------------------------
  15844. ::::::::::::::
  15845. scheader.spc
  15846. ::::::::::::::
  15847. -- Begin: SCHEADER spc ---------------------------------------------------
  15848.      
  15849. with ST_DIANA; use ST_DIANA;
  15850.              package HEADER_Pkg is
  15851.     procedure Scan_HEADER(Root : HEADER.Locator);
  15852.     procedure Scan_accept_spec(Root : accept_specNode.Locator);
  15853.     procedure Scan_entry_spec(Root : entry_specNode.Locator);
  15854.     procedure Scan_func_spec(Root : func_specNode.Locator);
  15855.     procedure Scan_proc_spec(Root : proc_specNode.Locator);
  15856. end HEADER_Pkg;
  15857. -- End: SCHEADER spc -----------------------------------------------------
  15858. ::::::::::::::
  15859. scinner_r.bdy
  15860. ::::::::::::::
  15861. -- Begin: SCINNER_RECORD_CLASS bdy ---------------------------------------------------
  15862.      
  15863. with Halstead_Data_Base;  use Halstead_Data_Base;
  15864. with Definitions; use Definitions;
  15865.              with inner_record_IH;
  15866. with ITEM_Pkg; use ITEM_Pkg;
  15867. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15868. with VARIANT_ALTERNATIVE_CLASS_Pkg; use VARIANT_ALTERNATIVE_CLASS_Pkg;
  15869. package body INNER_RECORD_CLASS_Pkg is
  15870.      
  15871.      
  15872.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator) is
  15873.     begin
  15874.         case Kind(Root) is
  15875.           when inner_recordKind => Scan_inner_record(Root);
  15876.           when others => null;
  15877.         end case;
  15878.     end Scan_INNER_RECORD_CLASS;
  15879.      
  15880.      
  15881.     procedure Scan_inner_record(Root : inner_recordNode.Locator) is
  15882.         as_list_List : SeqOfITEM.Generator;
  15883.         as_list_Item : ITEM.Locator;
  15884.         use SeqOfITEM;
  15885.         as_variant_s_List : SeqOfvariant_alternativeNode.Generator;
  15886.         as_variant_s_Item : variant_alternativeNode.Locator;
  15887.         use SeqOfvariant_alternativeNode;
  15888.         as_trailing_pragma_s_List : SeqOfpragma_declNode.Generator;
  15889.         as_trailing_pragma_s_Item : pragma_declNode.Locator;
  15890.         use SeqOfpragma_declNode;
  15891.         Old_inner_record_IHR : inner_record_IH.RecType := inner_record_IH.R;
  15892.     begin
  15893.         inner_record_IH.R.ih_in_variant :=  false ;
  15894.       if not SeqOfITEM.IsNull(as_list(Root)) then
  15895.         StartForward(as_list(Root), as_list_List);
  15896.         while not Finished(as_list_List) loop
  15897.             as_list_Item := Cell(as_list_List);
  15898.             Scan_ITEM(as_list_Item);
  15899.             Forward(as_list_List);
  15900.         end loop;
  15901.         EndIterate(as_list_List);
  15902.       end if;
  15903.       if not NAME_EXP.IsNull(as_variant_name(Root)) then
  15904.      
  15905.      
  15906.        IncrementToken (case_variantz);
  15907.        inner_record_IH.R.ih_in_variant := true;
  15908.      
  15909.      
  15910.         Scan_NAME_EXP(as_variant_name(Root));
  15911.      
  15912.      
  15913.        IncrementToken (is_case_variantz);
  15914.      
  15915.      
  15916.       end if;
  15917.       if not SeqOfvariant_alternativeNode.IsNull(as_variant_s(Root)) then
  15918.         StartForward(as_variant_s(Root), as_variant_s_List);
  15919.         while not Finished(as_variant_s_List) loop
  15920.             as_variant_s_Item := Cell(as_variant_s_List);
  15921.             Scan_variant_alternative(as_variant_s_Item);
  15922.             Forward(as_variant_s_List);
  15923.         end loop;
  15924.         EndIterate(as_variant_s_List);
  15925.      
  15926.      
  15927.        IncrementToken (end_case_variantz);
  15928.        IncrementToken (case_variantz);
  15929.        IncrementToken (semicolonz);
  15930.        inner_record_IH.R.ih_in_variant := false;
  15931.      
  15932.      
  15933.       end if;
  15934.       if not SeqOfpragma_declNode.IsNull(as_trailing_pragma_s(Root)) then
  15935.         StartForward(as_trailing_pragma_s(Root), as_trailing_pragma_s_List);
  15936.         while not Finished(as_trailing_pragma_s_List) loop
  15937.             as_trailing_pragma_s_Item := Cell(as_trailing_pragma_s_List);
  15938.             Scan_pragma_decl(as_trailing_pragma_s_Item);
  15939.             Forward(as_trailing_pragma_s_List);
  15940.         end loop;
  15941.         EndIterate(as_trailing_pragma_s_List);
  15942.       end if;
  15943.         inner_record_IH.R := Old_inner_record_IHR;
  15944.      
  15945.     end Scan_inner_record;
  15946.      
  15947. end INNER_RECORD_CLASS_Pkg;
  15948. -- End: SCINNER_RECORD_CLASS bdy -----------------------------------------------------
  15949. ::::::::::::::
  15950. scinner_r.spc
  15951. ::::::::::::::
  15952. -- Begin: SCINNER_RECORD_CLASS spc ---------------------------------------------------
  15953.      
  15954. with ST_DIANA; use ST_DIANA;
  15955.              package INNER_RECORD_CLASS_Pkg is
  15956.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator);
  15957.     procedure Scan_inner_record(Root : inner_recordNode.Locator);
  15958. end INNER_RECORD_CLASS_Pkg;
  15959. -- End: SCINNER_RECORD_CLASS spc -----------------------------------------------------
  15960.      
  15961. ::::::::::::::
  15962. scitem.bdy
  15963. ::::::::::::::
  15964. -- Begin: SCITEM bdy ---------------------------------------------------
  15965.      
  15966. with Halstead_Data_Base;  use Halstead_Data_Base;
  15967. with Definitions; use Definitions;
  15968.              with SERIES_UNIT_IH;
  15969. with variable_decl_IH;
  15970. with subtype_decl_IH;
  15971. with task_decl_IH;
  15972. with type_decl_IH;
  15973. with GENERIC_HEADER_CLASS_Pkg; use GENERIC_HEADER_CLASS_Pkg;
  15974. with DEF_ID_Pkg; use DEF_ID_Pkg;
  15975. with PKG_DEF_Pkg; use PKG_DEF_Pkg;
  15976. with HEADER_Pkg; use HEADER_Pkg;
  15977. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  15978. with OBJECT_DEF_Pkg; use OBJECT_DEF_Pkg;
  15979. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  15980. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  15981. with SUBP_DEF_Pkg; use SUBP_DEF_Pkg;
  15982. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  15983. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  15984. with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  15985.      
  15986.             with variable_decl_IH;
  15987.             with type_decl_IH;
  15988.             with generic_header_IH;
  15989.                        package body ITEM_Pkg is
  15990.      
  15991.      
  15992.     procedure Scan_ITEM(Root : ITEM.Locator) is
  15993.     begin
  15994.         case Kind(Root) is
  15995.           when GENERIC_ITEMKind => Scan_GENERIC_ITEM(Root);
  15996.           when OBJECT_ITEMKind => Scan_OBJECT_ITEM(Root);
  15997.           when PKG_ITEMKind => Scan_PKG_ITEM(Root);
  15998.           when REP_SPECKind => Scan_REP_SPEC(Root);
  15999.           when SUBP_ITEMKind => Scan_SUBP_ITEM(Root);
  16000.           when entry_declKind => Scan_entry_decl(Root);
  16001.           when exception_declKind => Scan_exception_decl(Root);
  16002.           when null_componentKind => Scan_null_component(Root);
  16003.           when number_declKind => Scan_number_decl(Root);
  16004.           when pragma_declKind => Scan_pragma_decl(Root);
  16005.           when subtype_declKind => Scan_subtype_decl(Root);
  16006.           when subunitKind => Scan_subunit(Root);
  16007.           when task_bodyKind => Scan_task_body(Root);
  16008.           when task_declKind => Scan_task_decl(Root);
  16009.           when type_declKind => Scan_type_decl(Root);
  16010.           when use_clauseKind => Scan_use_clause(Root);
  16011.           when with_clauseKind => Scan_with_clause(Root);
  16012.           when others => null;
  16013.         end case;
  16014.     end Scan_ITEM;
  16015.      
  16016.      
  16017.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator) is
  16018.     begin
  16019.         case Kind(Root) is
  16020.           when generic_pkg_declKind => Scan_generic_pkg_decl(Root);
  16021.           when generic_subp_declKind => Scan_generic_subp_decl(Root);
  16022.           when others => null;
  16023.         end case;
  16024.     end Scan_GENERIC_ITEM;
  16025.      
  16026.      
  16027.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator) is
  16028.     begin
  16029.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  16030.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  16031.       end if;
  16032.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  16033.      
  16034.      
  16035.        if not OuterMostBlockSeen then
  16036.            OuterMostBlockSeen := true;
  16037.        else
  16038.            BlockInfoStack.Push(BlockStack, CurrentBlock);
  16039.            CurrentBlock := InitializeCurrentBlock;
  16040.        end if;
  16041.        SetBlockId (lx_symrep (as_generic_id (root)),
  16042.                    package_spec_block,
  16043.                    SpcId,
  16044.                    LineNumber (lx_srcpos (root))
  16045.                    );
  16046.       IncrementToken (genericz);
  16047.       IncrementToken (package_spcz);
  16048.       IncrementToken (is_package_spcz);
  16049.       IncrementToken (end_package_spcz);
  16050.       IncrementToken (semicolonz);
  16051.      
  16052.      
  16053.         Scan_DEF_ID(as_generic_id(Root));
  16054.       end if;
  16055.       if not pkg_specNode.IsNull(as_generic_pkg_spec(Root)) then
  16056.         Scan_pkg_spec(as_generic_pkg_spec(Root));
  16057.       end if;
  16058.      
  16059.     end Scan_generic_pkg_decl;
  16060.      
  16061.      
  16062.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator) is
  16063.     begin
  16064.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  16065.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  16066.       end if;
  16067.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  16068.      
  16069.      
  16070.         IncrementToken (genericz);
  16071.         if Kind (as_generic_id (root)) in generic_proc_idKind then
  16072.             IncrementToken (procedurez);
  16073.         else
  16074.             IncrementToken (functionz);
  16075.         end if;
  16076.      
  16077.      
  16078.         Scan_DEF_ID(as_generic_id(Root));
  16079.       end if;
  16080.       if not HEADER.IsNull(as_generic_subp_spec(Root)) then
  16081.         Scan_HEADER(as_generic_subp_spec(Root));
  16082.       end if;
  16083.      
  16084.      
  16085.         IncrementToken (semicolonz);
  16086.      
  16087.      
  16088.      
  16089.     end Scan_generic_subp_decl;
  16090.      
  16091.      
  16092.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator) is
  16093.     begin
  16094.         case Kind(Root) is
  16095.           when component_declKind => Scan_component_decl(Root);
  16096.           when constant_declKind => Scan_constant_decl(Root);
  16097.           when dscrmt_declKind => Scan_dscrmt_decl(Root);
  16098.           when in_declKind => Scan_in_decl(Root);
  16099.           when in_out_declKind => Scan_in_out_decl(Root);
  16100.           when out_declKind => Scan_out_decl(Root);
  16101.           when variable_declKind => Scan_variable_decl(Root);
  16102.           when others => null;
  16103.         end case;
  16104.     end Scan_OBJECT_ITEM;
  16105.      
  16106.      
  16107.     procedure Scan_component_decl(Root : component_declNode.Locator) is
  16108.         as_id_s_List : SeqOfDEF_ID.Generator;
  16109.         as_id_s_Item : DEF_ID.Locator;
  16110.         use SeqOfDEF_ID;
  16111.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16112.     begin
  16113.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16114.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16115.         StartForward(as_id_s(Root), as_id_s_List);
  16116.         while not Finished(as_id_s_List) loop
  16117.             as_id_s_Item := Cell(as_id_s_List);
  16118.      
  16119.      
  16120.         if SERIES_UNIT_IH.R.ih_inlist then
  16121.             IncrementToken (commaz);
  16122.         end if;
  16123.         SERIES_UNIT_IH.R.ih_inlist := true;
  16124.      
  16125.      
  16126.             Scan_DEF_ID(as_id_s_Item);
  16127.             Forward(as_id_s_List);
  16128.         end loop;
  16129.         EndIterate(as_id_s_List);
  16130.      
  16131.      
  16132.         IncrementToken (colonz);
  16133.         SERIES_UNIT_IH.R.ih_inlist := false;
  16134.      
  16135.      
  16136.       end if;
  16137.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16138.         Scan_OBJECT_TYPE(as_object_type(Root));
  16139.       end if;
  16140.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16141.         Scan_OBJECT_DEF(as_object_def(Root));
  16142.       end if;
  16143.      
  16144.      
  16145.        IncrementToken (semicolonz);
  16146.      
  16147.      
  16148.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16149.      
  16150.     end Scan_component_decl;
  16151.      
  16152.      
  16153.     procedure Scan_constant_decl(Root : constant_declNode.Locator) is
  16154.         as_id_s_List : SeqOfDEF_ID.Generator;
  16155.         as_id_s_Item : DEF_ID.Locator;
  16156.         use SeqOfDEF_ID;
  16157.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16158.     begin
  16159.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16160.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16161.         StartForward(as_id_s(Root), as_id_s_List);
  16162.         while not Finished(as_id_s_List) loop
  16163.             as_id_s_Item := Cell(as_id_s_List);
  16164.      
  16165.      
  16166.         if SERIES_UNIT_IH.R.ih_inlist then
  16167.             IncrementToken (commaz);
  16168.         end if;
  16169.         SERIES_UNIT_IH.R.ih_inlist := true;
  16170.      
  16171.      
  16172.             Scan_DEF_ID(as_id_s_Item);
  16173.             Forward(as_id_s_List);
  16174.         end loop;
  16175.         EndIterate(as_id_s_List);
  16176.      
  16177.      
  16178.         IncrementToken (colonz);
  16179.         SERIES_UNIT_IH.R.ih_inlist := false;
  16180.      
  16181.      
  16182.       end if;
  16183.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16184.      
  16185.      
  16186.      IncrementToken (constantz);
  16187.      
  16188.      
  16189.         Scan_OBJECT_TYPE(as_object_type(Root));
  16190.       end if;
  16191.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16192.         Scan_OBJECT_DEF(as_object_def(Root));
  16193.       end if;
  16194.      
  16195.      
  16196.      IncrementToken (semicolonz);
  16197.      
  16198.      
  16199.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16200.      
  16201.     end Scan_constant_decl;
  16202.      
  16203.      
  16204.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator) is
  16205.         as_id_s_List : SeqOfDEF_ID.Generator;
  16206.         as_id_s_Item : DEF_ID.Locator;
  16207.         use SeqOfDEF_ID;
  16208.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16209.     begin
  16210.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16211.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16212.         StartForward(as_id_s(Root), as_id_s_List);
  16213.         while not Finished(as_id_s_List) loop
  16214.             as_id_s_Item := Cell(as_id_s_List);
  16215.      
  16216.      
  16217.         if SERIES_UNIT_IH.R.ih_inlist then
  16218.             IncrementToken (commaz);
  16219.         end if;
  16220.         SERIES_UNIT_IH.R.ih_inlist := true;
  16221.      
  16222.      
  16223.             Scan_DEF_ID(as_id_s_Item);
  16224.             Forward(as_id_s_List);
  16225.         end loop;
  16226.         EndIterate(as_id_s_List);
  16227.      
  16228.      
  16229.         IncrementToken (colonz);
  16230.         SERIES_UNIT_IH.R.ih_inlist := false;
  16231.      
  16232.      
  16233.       end if;
  16234.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16235.         Scan_OBJECT_TYPE(as_object_type(Root));
  16236.       end if;
  16237.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16238.         Scan_OBJECT_DEF(as_object_def(Root));
  16239.       end if;
  16240.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16241.      
  16242.     end Scan_dscrmt_decl;
  16243.      
  16244.      
  16245.     procedure Scan_in_decl(Root : in_declNode.Locator) is
  16246.         as_id_s_List : SeqOfDEF_ID.Generator;
  16247.         as_id_s_Item : DEF_ID.Locator;
  16248.         use SeqOfDEF_ID;
  16249.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16250.     begin
  16251.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16252.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16253.         StartForward(as_id_s(Root), as_id_s_List);
  16254.         while not Finished(as_id_s_List) loop
  16255.             as_id_s_Item := Cell(as_id_s_List);
  16256.      
  16257.      
  16258.         if SERIES_UNIT_IH.R.ih_inlist then
  16259.             IncrementToken (commaz);
  16260.         end if;
  16261.         SERIES_UNIT_IH.R.ih_inlist := true;
  16262.      
  16263.      
  16264.             Scan_DEF_ID(as_id_s_Item);
  16265.             Forward(as_id_s_List);
  16266.         end loop;
  16267.         EndIterate(as_id_s_List);
  16268.      
  16269.      
  16270.         IncrementToken (colonz);
  16271.         SERIES_UNIT_IH.R.ih_inlist := false;
  16272.      
  16273.      
  16274.       end if;
  16275.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16276.      
  16277.         if  lx_explicit_in_decl (root)
  16278.         then
  16279.      
  16280.      IncrementToken (in_parameterz);
  16281.      
  16282.         end if;
  16283.         Scan_OBJECT_TYPE(as_object_type(Root));
  16284.       end if;
  16285.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16286.         Scan_OBJECT_DEF(as_object_def(Root));
  16287.       end if;
  16288.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16289.      
  16290.     end Scan_in_decl;
  16291.      
  16292.      
  16293.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator) is
  16294.         as_id_s_List : SeqOfDEF_ID.Generator;
  16295.         as_id_s_Item : DEF_ID.Locator;
  16296.         use SeqOfDEF_ID;
  16297.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16298.     begin
  16299.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16300.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16301.         StartForward(as_id_s(Root), as_id_s_List);
  16302.         while not Finished(as_id_s_List) loop
  16303.             as_id_s_Item := Cell(as_id_s_List);
  16304.      
  16305.      
  16306.         if SERIES_UNIT_IH.R.ih_inlist then
  16307.             IncrementToken (commaz);
  16308.         end if;
  16309.         SERIES_UNIT_IH.R.ih_inlist := true;
  16310.      
  16311.      
  16312.             Scan_DEF_ID(as_id_s_Item);
  16313.             Forward(as_id_s_List);
  16314.         end loop;
  16315.         EndIterate(as_id_s_List);
  16316.      
  16317.      
  16318.         IncrementToken (colonz);
  16319.         SERIES_UNIT_IH.R.ih_inlist := false;
  16320.      
  16321.      
  16322.       end if;
  16323.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16324.      
  16325.      
  16326.      IncrementToken (in_out_parameterz);
  16327.      
  16328.      
  16329.      
  16330.         Scan_OBJECT_TYPE(as_object_type(Root));
  16331.       end if;
  16332.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16333.         Scan_OBJECT_DEF(as_object_def(Root));
  16334.       end if;
  16335.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16336.      
  16337.     end Scan_in_out_decl;
  16338.      
  16339.      
  16340.     procedure Scan_out_decl(Root : out_declNode.Locator) is
  16341.         as_id_s_List : SeqOfDEF_ID.Generator;
  16342.         as_id_s_Item : DEF_ID.Locator;
  16343.         use SeqOfDEF_ID;
  16344.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16345.     begin
  16346.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16347.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16348.         StartForward(as_id_s(Root), as_id_s_List);
  16349.         while not Finished(as_id_s_List) loop
  16350.             as_id_s_Item := Cell(as_id_s_List);
  16351.      
  16352.      
  16353.         if SERIES_UNIT_IH.R.ih_inlist then
  16354.             IncrementToken (commaz);
  16355.         end if;
  16356.         SERIES_UNIT_IH.R.ih_inlist := true;
  16357.      
  16358.      
  16359.             Scan_DEF_ID(as_id_s_Item);
  16360.             Forward(as_id_s_List);
  16361.         end loop;
  16362.         EndIterate(as_id_s_List);
  16363.      
  16364.      
  16365.         IncrementToken (colonz);
  16366.         SERIES_UNIT_IH.R.ih_inlist := false;
  16367.      
  16368.      
  16369.       end if;
  16370.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16371.      
  16372.      
  16373.      IncrementToken (outz);
  16374.      
  16375.      
  16376.         Scan_OBJECT_TYPE(as_object_type(Root));
  16377.       end if;
  16378.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16379.         Scan_OBJECT_DEF(as_object_def(Root));
  16380.       end if;
  16381.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16382.      
  16383.     end Scan_out_decl;
  16384.      
  16385.      
  16386.     procedure Scan_variable_decl(Root : variable_declNode.Locator) is
  16387.         as_id_s_List : SeqOfDEF_ID.Generator;
  16388.         as_id_s_Item : DEF_ID.Locator;
  16389.         use SeqOfDEF_ID;
  16390.         Old_variable_decl_IHR : variable_decl_IH.RecType := variable_decl_IH.R;
  16391.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16392.     begin
  16393.         variable_decl_IH.R.ih_init :=  false ;
  16394.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16395.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  16396.         StartForward(as_id_s(Root), as_id_s_List);
  16397.         while not Finished(as_id_s_List) loop
  16398.             as_id_s_Item := Cell(as_id_s_List);
  16399.      
  16400.      
  16401.         if SERIES_UNIT_IH.R.ih_inlist then
  16402.             IncrementToken (commaz);
  16403.         end if;
  16404.         SERIES_UNIT_IH.R.ih_inlist := true;
  16405.      
  16406.      
  16407.             Scan_DEF_ID(as_id_s_Item);
  16408.             Forward(as_id_s_List);
  16409.         end loop;
  16410.         EndIterate(as_id_s_List);
  16411.      
  16412.      
  16413.         IncrementToken (colonz);
  16414.         SERIES_UNIT_IH.R.ih_inlist := false;
  16415.      
  16416.      
  16417.       end if;
  16418.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  16419.         Scan_OBJECT_TYPE(as_object_type(Root));
  16420.       end if;
  16421.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  16422.         Scan_OBJECT_DEF(as_object_def(Root));
  16423.       end if;
  16424.      
  16425.      
  16426.      IncrementToken (semicolonz);
  16427.      
  16428.      
  16429.         variable_decl_IH.R := Old_variable_decl_IHR;
  16430.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16431.      
  16432.     end Scan_variable_decl;
  16433.      
  16434.      
  16435.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator) is
  16436.     begin
  16437.         case Kind(Root) is
  16438.           when pkg_bodyKind => Scan_pkg_body(Root);
  16439.           when pkg_declKind => Scan_pkg_decl(Root);
  16440.           when others => null;
  16441.         end case;
  16442.     end Scan_PKG_ITEM;
  16443.      
  16444.      
  16445.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator) is
  16446.     begin
  16447.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  16448.         Scan_pkg_id(as_pkg_id(Root));
  16449.      
  16450.      
  16451.          if not OuterMostBlockSeen then
  16452.              OuterMostBlockSeen := true;
  16453.          else
  16454.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  16455.              CurrentBlock := InitializeCurrentBlock;
  16456.          end if;
  16457.          SetBlockId (lx_symrep (as_pkg_id (root)),
  16458.                      package_body_block,
  16459.                      BdyId,
  16460.                      LineNumber (lx_srcpos (root))
  16461.                      );
  16462.          IncrementToken (package_bdyz);
  16463.          IncrementToken (body_packagez);
  16464.          IncrementToken (is_package_bdyz);
  16465.      
  16466.      
  16467.       end if;
  16468.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  16469.         Scan_PKG_DEF(as_pkg_def(Root));
  16470.       end if;
  16471.      
  16472.      
  16473.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16474.         IncrementToken (semicolonz);
  16475.         ProcessBlockInfo (CurrentBlock);
  16476.         FreeSpace (CurrentBlock);
  16477.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16478.    end if;
  16479.      
  16480.      
  16481.      
  16482.     end Scan_pkg_body;
  16483.      
  16484.      
  16485.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator) is
  16486.     begin
  16487.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  16488.         Scan_pkg_id(as_pkg_id(Root));
  16489.      
  16490.      
  16491.       if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16492.          if not OuterMostBlockSeen then
  16493.              OuterMostBlockSeen := true;
  16494.          else
  16495.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  16496.              CurrentBlock := InitializeCurrentBlock;
  16497.          end if;
  16498.          SetBlockId (lx_symrep (as_pkg_id (root)),
  16499.                      package_spec_block,
  16500.                      SpcId,
  16501.                      LineNumber (lx_srcpos (root))
  16502.                      );
  16503.         IncrementToken (end_package_spcz);
  16504.      end if;
  16505.      IncrementToken (package_spcz);
  16506.      IncrementToken (is_package_spcz);
  16507.      
  16508.      
  16509.       end if;
  16510.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  16511.         Scan_PKG_DEF(as_pkg_def(Root));
  16512.       end if;
  16513.      
  16514.      
  16515.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  16516.         IncrementToken (semicolonz);
  16517.         ProcessBlockInfo (CurrentBlock);
  16518.         FreeSpace (CurrentBlock);
  16519.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16520.    end if;
  16521.      
  16522.      
  16523.      
  16524.     end Scan_pkg_decl;
  16525.      
  16526.      
  16527.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator) is
  16528.     begin
  16529.         case Kind(Root) is
  16530.           when address_repKind => Scan_address_rep(Root);
  16531.           when record_repKind => Scan_record_rep(Root);
  16532.           when rep_componentKind => Scan_rep_component(Root);
  16533.           when simple_repKind => Scan_simple_rep(Root);
  16534.           when others => null;
  16535.         end case;
  16536.     end Scan_REP_SPEC;
  16537.      
  16538.      
  16539.     procedure Scan_address_rep(Root : address_repNode.Locator) is
  16540.     begin
  16541.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16542.      
  16543.      
  16544.       IncrementToken (for_repz);
  16545.      
  16546.      
  16547.         Scan_NAME_EXP(as_rep_name(Root));
  16548.      
  16549.      
  16550.       IncrementToken (use_repz);
  16551.       IncrementToken (atz);
  16552.       IncrementToken (semicolonz);
  16553.      
  16554.      
  16555.       end if;
  16556.       if not NAME_EXP.IsNull(as_address_rep_exp(Root)) then
  16557.         Scan_NAME_EXP(as_address_rep_exp(Root));
  16558.       end if;
  16559.      
  16560.     end Scan_address_rep;
  16561.      
  16562.      
  16563.     procedure Scan_record_rep(Root : record_repNode.Locator) is
  16564.         as_components_List : SeqOfrep_componentNode.Generator;
  16565.         as_components_Item : rep_componentNode.Locator;
  16566.         use SeqOfrep_componentNode;
  16567.     begin
  16568.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16569.      
  16570.      
  16571.       IncrementToken (for_repz);
  16572.      
  16573.      
  16574.         Scan_NAME_EXP(as_rep_name(Root));
  16575.      
  16576.      
  16577.    IncrementToken (use_repz);
  16578.    IncrementToken (record_repz);
  16579.      
  16580.      
  16581.       end if;
  16582.       if not NAME_EXP.IsNull(as_record_alignment(Root)) then
  16583.      
  16584.      
  16585.       IncrementToken (atz);
  16586.       IncrementToken (modz);
  16587.      
  16588.      
  16589.         Scan_NAME_EXP(as_record_alignment(Root));
  16590.       end if;
  16591.       if not SeqOfrep_componentNode.IsNull(as_components(Root)) then
  16592.         StartForward(as_components(Root), as_components_List);
  16593.         while not Finished(as_components_List) loop
  16594.             as_components_Item := Cell(as_components_List);
  16595.             Scan_rep_component(as_components_Item);
  16596.             Forward(as_components_List);
  16597.         end loop;
  16598.         EndIterate(as_components_List);
  16599.      
  16600.      
  16601.          IncrementToken (end_record_repz);
  16602.          IncrementToken (record_repz);
  16603.          IncrementToken (semicolonz);
  16604.      
  16605.      
  16606.       end if;
  16607.      
  16608.     end Scan_record_rep;
  16609.      
  16610.      
  16611.     procedure Scan_rep_component(Root : rep_componentNode.Locator) is
  16612.     begin
  16613.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16614.         Scan_NAME_EXP(as_rep_name(Root));
  16615.      
  16616.      
  16617.           IncrementToken (atz);
  16618.      
  16619.      
  16620.       end if;
  16621.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_alignment_range(Root)) then
  16622.      
  16623.      
  16624.       IncrementToken (rangez);
  16625.      
  16626.      
  16627.         Scan_RANGE_CONSTRAINT_CLASS(as_alignment_range(Root));
  16628.       end if;
  16629.       if not NAME_EXP.IsNull(as_rep_component_exp(Root)) then
  16630.         Scan_NAME_EXP(as_rep_component_exp(Root));
  16631.       end if;
  16632.      
  16633.     end Scan_rep_component;
  16634.      
  16635.      
  16636.     procedure Scan_simple_rep(Root : simple_repNode.Locator) is
  16637.     begin
  16638.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  16639.         Scan_NAME_EXP(as_rep_name(Root));
  16640.       end if;
  16641.       if not NAME_EXP.IsNull(as_simple_rep_exp(Root)) then
  16642.      
  16643.      
  16644.      IncrementToken (for_repz);
  16645.      
  16646.      
  16647.         Scan_NAME_EXP(as_simple_rep_exp(Root));
  16648.      
  16649.      
  16650.       IncrementToken (use_repz);
  16651.      
  16652.      
  16653.       end if;
  16654.      
  16655.     end Scan_simple_rep;
  16656.      
  16657.      
  16658.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator) is
  16659.     begin
  16660.         case Kind(Root) is
  16661.           when subp_bodyKind => Scan_subp_body(Root);
  16662.           when subp_declKind => Scan_subp_decl(Root);
  16663.           when others => null;
  16664.         end case;
  16665.     end Scan_SUBP_ITEM;
  16666.      
  16667.      
  16668.     procedure Scan_subp_body(Root : subp_bodyNode.Locator) is
  16669.     begin
  16670.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  16671.         Scan_DEF_ID(as_subp_designator(Root));
  16672.      
  16673.      
  16674.       if not OuterMostBlockSeen then
  16675.           OuterMostBlockSeen := true;
  16676.       else
  16677.           BlockInfoStack.Push(BlockStack, CurrentBlock);
  16678.           CurrentBlock := InitializeCurrentBlock;
  16679.       end if;
  16680.        if Kind (as_subp_designator (root)) in proc_idKind then
  16681.            SetBlockId (lx_symrep (as_subp_designator (root)),
  16682.                        procedure_block,
  16683.                        BdyId,
  16684.                        LineNumber (lx_srcpos (root))
  16685.                        );
  16686.            IncrementToken (procedurez);
  16687.            IncrementToken (is_procedurez);
  16688.        else
  16689.            SetBlockId (lx_symrep (as_subp_designator (root)),
  16690.                        function_block,
  16691.                        BdyId,
  16692.                        LineNumber (lx_srcpos (root))
  16693.                        );
  16694.            IncrementToken (functionz);
  16695.            IncrementToken (is_functionz);
  16696.        end if;
  16697.      
  16698.      
  16699.       end if;
  16700.       if not HEADER.IsNull(as_subp_spec(Root)) then
  16701.         Scan_HEADER(as_subp_spec(Root));
  16702.       end if;
  16703.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  16704.         Scan_SUBP_DEF(as_subp_def(Root));
  16705.      
  16706.      
  16707.        ProcessBlockInfo (CurrentBlock);
  16708.        FreeSpace (CurrentBlock);
  16709.        BlockInfoStack.Pop(BlockStack, CurrentBlock);
  16710.      
  16711.      
  16712.       end if;
  16713.      
  16714.     end Scan_subp_body;
  16715.      
  16716.      
  16717.     procedure Scan_subp_decl(Root : subp_declNode.Locator) is
  16718.     begin
  16719.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  16720.         Scan_DEF_ID(as_subp_designator(Root));
  16721.       end if;
  16722.       if not HEADER.IsNull(as_subp_spec(Root)) then
  16723.         Scan_HEADER(as_subp_spec(Root));
  16724.       end if;
  16725.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  16726.         Scan_SUBP_DEF(as_subp_def(Root));
  16727.       end if;
  16728.      
  16729.      
  16730.            if generic_header_IH.R.ih_ingeneric_param then
  16731.                IncrementToken (with_genericz);
  16732.            end if;
  16733.            if Kind (as_subp_designator (root)) in proc_idKind then
  16734.                IncrementToken (procedurez);
  16735.            else
  16736.                IncrementToken (functionz);
  16737.            end if;
  16738.      
  16739.      
  16740.      
  16741.      
  16742.         IncrementToken (semicolonz);
  16743.      
  16744.      
  16745.      
  16746.     end Scan_subp_decl;
  16747.      
  16748.      
  16749.     procedure Scan_entry_decl(Root : entry_declNode.Locator) is
  16750.     begin
  16751.      
  16752.      
  16753.      IncrementToken (entryz);
  16754.      
  16755.      
  16756.       if not entry_idNode.IsNull(as_entry_designator(Root)) then
  16757.         Scan_entry_id(as_entry_designator(Root));
  16758.       end if;
  16759.       if not entry_specNode.IsNull(as_entry_spec(Root)) then
  16760.         Scan_entry_spec(as_entry_spec(Root));
  16761.       end if;
  16762.      
  16763.      
  16764.      IncrementToken (semicolonz);
  16765.      
  16766.      
  16767.      
  16768.     end Scan_entry_decl;
  16769.      
  16770.      
  16771.     procedure Scan_exception_decl(Root : exception_declNode.Locator) is
  16772.         as_exception_id_s_List : SeqOfexception_idNode.Generator;
  16773.         as_exception_id_s_Item : exception_idNode.Locator;
  16774.         use SeqOfexception_idNode;
  16775.     begin
  16776.       if not SeqOfexception_idNode.IsNull(as_exception_id_s(Root)) then
  16777.         StartForward(as_exception_id_s(Root), as_exception_id_s_List);
  16778.         while not Finished(as_exception_id_s_List) loop
  16779.             as_exception_id_s_Item := Cell(as_exception_id_s_List);
  16780.      
  16781.      
  16782.       if SERIES_UNIT_IH.R.ih_inlist then
  16783.          IncrementToken (commaz);
  16784.       end if;
  16785.       SERIES_UNIT_IH.R.ih_inlist := true;
  16786.      
  16787.      
  16788.             Scan_exception_id(as_exception_id_s_Item);
  16789.             Forward(as_exception_id_s_List);
  16790.         end loop;
  16791.         EndIterate(as_exception_id_s_List);
  16792.      
  16793.      
  16794.        IncrementToken (colonz);
  16795.        IncrementToken (exceptionz);
  16796.        IncrementToken (semicolonz);
  16797.        SERIES_UNIT_IH.R.ih_inlist := false;
  16798.      
  16799.      
  16800.       end if;
  16801.       if not NAME_EXP.IsNull(as_exception_def(Root)) then
  16802.      
  16803.      
  16804.       IncrementToken (renamesz);
  16805.      
  16806.      
  16807.         Scan_NAME_EXP(as_exception_def(Root));
  16808.       end if;
  16809.      
  16810.     end Scan_exception_decl;
  16811.      
  16812.      
  16813.     procedure Scan_null_component(Root : null_componentNode.Locator) is
  16814.     begin
  16815.      
  16816.      
  16817.       IncrementToken (null_fieldz);
  16818.       IncrementToken (semicolonz);
  16819.      
  16820.      
  16821.      
  16822.     end Scan_null_component;
  16823.      
  16824.      
  16825.     procedure Scan_number_decl(Root : number_declNode.Locator) is
  16826.         as_number_id_s_List : SeqOfnumber_idNode.Generator;
  16827.         as_number_id_s_Item : number_idNode.Locator;
  16828.         use SeqOfnumber_idNode;
  16829.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  16830.     begin
  16831.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  16832.       if not SeqOfnumber_idNode.IsNull(as_number_id_s(Root)) then
  16833.         StartForward(as_number_id_s(Root), as_number_id_s_List);
  16834.         while not Finished(as_number_id_s_List) loop
  16835.             as_number_id_s_Item := Cell(as_number_id_s_List);
  16836.      
  16837.      
  16838.        if SERIES_UNIT_IH.R.ih_inlist then
  16839.           IncrementToken (commaz);
  16840.        end if;
  16841.        SERIES_UNIT_IH.R.ih_inlist := true;
  16842.      
  16843.      
  16844.             Scan_number_id(as_number_id_s_Item);
  16845.             Forward(as_number_id_s_List);
  16846.         end loop;
  16847.         EndIterate(as_number_id_s_List);
  16848.      
  16849.      
  16850.      IncrementToken (colonz);
  16851.      SERIES_UNIT_IH.R.ih_inlist := false;
  16852.      
  16853.      
  16854.       end if;
  16855.       if not NAME_EXP.IsNull(as_number_exp(Root)) then
  16856.      
  16857.      
  16858.      IncrementToken (constantz);
  16859.      IncrementToken (colon_equalsz);
  16860.      
  16861.      
  16862.         Scan_NAME_EXP(as_number_exp(Root));
  16863.       end if;
  16864.      
  16865.      
  16866.      IncrementToken (semicolonz);
  16867.      
  16868.      
  16869.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  16870.      
  16871.     end Scan_number_decl;
  16872.      
  16873.      
  16874.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator) is
  16875.         as_pragma_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  16876.         as_pragma_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  16877.         use SeqOfGENERAL_ASSOC;
  16878.     begin
  16879.      
  16880.      
  16881.       IncrementToken (pragmaz);
  16882.      
  16883.      
  16884.       if not used_idNode.IsNull(as_pragma_id(Root)) then
  16885.         Scan_used_id(as_pragma_id(Root));
  16886.       end if;
  16887.       if not SeqOfGENERAL_ASSOC.IsNull(as_pragma_param_assoc_s(Root)) then
  16888.      
  16889.      
  16890.        IncrementToken (open_parenthesisz);
  16891.      
  16892.      
  16893.         StartForward(as_pragma_param_assoc_s(Root), as_pragma_param_assoc_s_List);
  16894.         while not Finished(as_pragma_param_assoc_s_List) loop
  16895.             as_pragma_param_assoc_s_Item := Cell(as_pragma_param_assoc_s_List);
  16896.      
  16897.      
  16898.         if SERIES_UNIT_IH.R.ih_inlist then
  16899.             IncrementToken (commaz);
  16900.         end if;
  16901.         SERIES_UNIT_IH.R.ih_inlist := true;
  16902.      
  16903.      
  16904.             Scan_GENERAL_ASSOC(as_pragma_param_assoc_s_Item);
  16905.             Forward(as_pragma_param_assoc_s_List);
  16906.         end loop;
  16907.         EndIterate(as_pragma_param_assoc_s_List);
  16908.      
  16909.      
  16910.        IncrementToken (closed_parenthesisz);
  16911.        SERIES_UNIT_IH.R.ih_inlist := false;
  16912.      
  16913.      
  16914.       end if;
  16915.      
  16916.      
  16917.        IncrementToken (semicolonz);
  16918.      
  16919.      
  16920.      
  16921.     end Scan_pragma_decl;
  16922.      
  16923.      
  16924.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator) is
  16925.         Old_subtype_decl_IHR : subtype_decl_IH.RecType := subtype_decl_IH.R;
  16926.     begin
  16927.         subtype_decl_IH.R.ih_in_subtype_decl :=  false ;
  16928.      
  16929.      
  16930.      IncrementToken (subtypez);
  16931.      subtype_decl_IH.R.ih_in_subtype_decl := true;
  16932.      
  16933.      
  16934.       if not subtype_idNode.IsNull(as_subtype_id(Root)) then
  16935.         Scan_subtype_id(as_subtype_id(Root));
  16936.      
  16937.      
  16938.       IncrementToken (is_subtypez);
  16939.      
  16940.      
  16941.       end if;
  16942.       if not object_type_constrainedNode.IsNull(as_subtype_constrained(Root)) then
  16943.         Scan_object_type_constrained(as_subtype_constrained(Root));
  16944.       end if;
  16945.      
  16946.      
  16947.       subtype_decl_IH.R.ih_in_subtype_decl := false;
  16948.       IncrementToken (semicolonz);
  16949.      
  16950.      
  16951.         subtype_decl_IH.R := Old_subtype_decl_IHR;
  16952.      
  16953.     end Scan_subtype_decl;
  16954.      
  16955.      
  16956.     procedure Scan_subunit(Root : subunitNode.Locator) is
  16957.     begin
  16958.      
  16959.      
  16960.      IncrementToken (separatez);
  16961.      
  16962.      
  16963.       if not NAME_EXP.IsNull(as_subunit_path(Root)) then
  16964.      
  16965.      
  16966.      IncrementToken (open_parenthesisz);
  16967.      
  16968.      
  16969.         Scan_NAME_EXP(as_subunit_path(Root));
  16970.      
  16971.      
  16972.      IncrementToken (closed_parenthesisz);
  16973.      
  16974.      
  16975.       end if;
  16976.       if not ITEM.IsNull(as_subunit_body(Root)) then
  16977.         Scan_ITEM(as_subunit_body(Root));
  16978.       end if;
  16979.      
  16980.     end Scan_subunit;
  16981.      
  16982.      
  16983.     procedure Scan_task_body(Root : task_bodyNode.Locator) is
  16984.     begin
  16985.      
  16986.      
  16987.      if not OuterMostBlockSeen then
  16988.          OuterMostBlockSeen := true;
  16989.      else
  16990.          BlockInfoStack.Push(BlockStack, CurrentBlock);
  16991.          CurrentBlock := InitializeCurrentBlock;
  16992.      end if;
  16993.      SetBlockId (lx_symrep (as_task_body_id (root)),
  16994.                  task_body_block,
  16995.                  BdyId,
  16996.                  LineNumber (lx_srcpos (root))
  16997.                  );
  16998.      IncrementToken (task_bdyz);
  16999.      IncrementToken (body_taskz);
  17000.      IncrementToken (is_task_bdyz);
  17001.      
  17002.      
  17003.       if not task_body_idNode.IsNull(as_task_body_id(Root)) then
  17004.         Scan_task_body_id(as_task_body_id(Root));
  17005.       end if;
  17006.       if not BLOCK_STUB.IsNull(as_task_body_block_stub(Root)) then
  17007.         Scan_BLOCK_STUB(as_task_body_block_stub(Root));
  17008.       end if;
  17009.      
  17010.      
  17011.      IncrementToken (semicolonz);
  17012.      ProcessBlockInfo (CurrentBlock);
  17013.      FreeSpace (CurrentBlock);
  17014.      BlockInfoStack.Pop(BlockStack, CurrentBlock);
  17015.      
  17016.      
  17017.      
  17018.     end Scan_task_body;
  17019.      
  17020.      
  17021.     procedure Scan_task_decl(Root : task_declNode.Locator) is
  17022.         Old_task_decl_IHR : task_decl_IH.RecType := task_decl_IH.R;
  17023.     begin
  17024.         task_decl_IH.R.ih_intask_decl :=  false ;
  17025.      
  17026.      
  17027.       task_decl_IH.R.ih_intask_decl := true;
  17028.      
  17029.      
  17030.       if not variable_idNode.IsNull(as_task_id(Root)) then
  17031.         Scan_variable_id(as_task_id(Root));
  17032.       end if;
  17033.       if not task_specNode.IsNull(as_task_def(Root)) then
  17034.         Scan_task_spec(as_task_def(Root));
  17035.       end if;
  17036.      
  17037.      
  17038.  task_decl_IH.R.ih_intask_decl := false;
  17039.      
  17040.      
  17041.         task_decl_IH.R := Old_task_decl_IHR;
  17042.      
  17043.     end Scan_task_decl;
  17044.      
  17045.      
  17046.     procedure Scan_type_decl(Root : type_declNode.Locator) is
  17047.         as_type_dscrmt_s_List : SeqOfdscrmt_declNode.Generator;
  17048.         as_type_dscrmt_s_Item : dscrmt_declNode.Locator;
  17049.         use SeqOfdscrmt_declNode;
  17050.         Old_type_decl_IHR : type_decl_IH.RecType := type_decl_IH.R;
  17051.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17052.     begin
  17053.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17054.      
  17055.      
  17056.      if Kind (as_type_spec (root)) not in task_specKind then
  17057.         IncrementToken (typez);
  17058.         IncrementToken (is_typez);
  17059.      end if;
  17060.      
  17061.      
  17062.       if not type_idNode.IsNull(as_type_id(Root)) then
  17063.         Scan_type_id(as_type_id(Root));
  17064.       end if;
  17065.       if not SeqOfdscrmt_declNode.IsNull(as_type_dscrmt_s(Root)) then
  17066.      
  17067.      
  17068.      IncrementToken (open_parenthesisz);
  17069.      
  17070.      
  17071.         StartForward(as_type_dscrmt_s(Root), as_type_dscrmt_s_List);
  17072.         while not Finished(as_type_dscrmt_s_List) loop
  17073.             as_type_dscrmt_s_Item := Cell(as_type_dscrmt_s_List);
  17074.      
  17075.      
  17076.       if SERIES_UNIT_IH.R.ih_inlist then
  17077.           IncrementToken (semicolonz);
  17078.       end if;
  17079.       SERIES_UNIT_IH.R.ih_inlist := true;
  17080.      
  17081.      
  17082.             Scan_dscrmt_decl(as_type_dscrmt_s_Item);
  17083.             Forward(as_type_dscrmt_s_List);
  17084.         end loop;
  17085.         EndIterate(as_type_dscrmt_s_List);
  17086.      
  17087.      
  17088.      IncrementToken (closed_parenthesisz);
  17089.      SERIES_UNIT_IH.R.ih_inlist := false;
  17090.      
  17091.      
  17092.       end if;
  17093.       if not TYPE_SPEC.IsNull(as_type_spec(Root)) then
  17094.         Scan_TYPE_SPEC(as_type_spec(Root));
  17095.       end if;
  17096.      
  17097.      
  17098.      if Kind (as_type_spec (root)) not in task_specKind then
  17099.         IncrementToken (semicolonz);
  17100.      end if;
  17101.      
  17102.      
  17103.         type_decl_IH.R := Old_type_decl_IHR;
  17104.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17105.      
  17106.     end Scan_type_decl;
  17107.      
  17108.      
  17109.     procedure Scan_use_clause(Root : use_clauseNode.Locator) is
  17110.         as_use_clause_list_List : SeqOfNAME_EXP.Generator;
  17111.         as_use_clause_list_Item : NAME_EXP.Locator;
  17112.         use SeqOfNAME_EXP;
  17113.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17114.     begin
  17115.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17116.       if not SeqOfNAME_EXP.IsNull(as_use_clause_list(Root)) then
  17117.      
  17118.      
  17119.      IncrementToken (use_contextz);
  17120.      
  17121.      
  17122.         StartForward(as_use_clause_list(Root), as_use_clause_list_List);
  17123.         while not Finished(as_use_clause_list_List) loop
  17124.             as_use_clause_list_Item := Cell(as_use_clause_list_List);
  17125.      
  17126.      
  17127.       if SERIES_UNIT_IH.R.ih_inlist then
  17128.           IncrementToken (commaz);
  17129.       end if;
  17130.       SERIES_UNIT_IH.R.ih_inlist := true;
  17131.      
  17132.      
  17133.             Scan_NAME_EXP(as_use_clause_list_Item);
  17134.             Forward(as_use_clause_list_List);
  17135.         end loop;
  17136.         EndIterate(as_use_clause_list_List);
  17137.       end if;
  17138.      
  17139.      
  17140.      IncrementToken (semicolonz);
  17141.      SERIES_UNIT_IH.R.ih_inlist := false;
  17142.      
  17143.      
  17144.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17145.      
  17146.     end Scan_use_clause;
  17147.      
  17148.      
  17149.     procedure Scan_with_clause(Root : with_clauseNode.Locator) is
  17150.         as_with_clause_list_List : SeqOfNAME_EXP.Generator;
  17151.         as_with_clause_list_Item : NAME_EXP.Locator;
  17152.         use SeqOfNAME_EXP;
  17153.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17154.     begin
  17155.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17156.       if not SeqOfNAME_EXP.IsNull(as_with_clause_list(Root)) then
  17157.      
  17158.      
  17159.      IncrementToken (with_contextz);
  17160.      
  17161.      
  17162.         StartForward(as_with_clause_list(Root), as_with_clause_list_List);
  17163.         while not Finished(as_with_clause_list_List) loop
  17164.             as_with_clause_list_Item := Cell(as_with_clause_list_List);
  17165.      
  17166.      
  17167.        if SERIES_UNIT_IH.R.ih_inlist then
  17168.            IncrementToken (commaz);
  17169.        end if;
  17170.        SERIES_UNIT_IH.R.ih_inlist := true;
  17171.      
  17172.      
  17173.             Scan_NAME_EXP(as_with_clause_list_Item);
  17174.             Forward(as_with_clause_list_List);
  17175.         end loop;
  17176.         EndIterate(as_with_clause_list_List);
  17177.       end if;
  17178.      
  17179.      
  17180.       IncrementToken (semicolonz);
  17181.       SERIES_UNIT_IH.R.ih_inlist := false;
  17182.      
  17183.      
  17184.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17185.      
  17186.     end Scan_with_clause;
  17187.      
  17188. end ITEM_Pkg;
  17189. -- End: SCITEM bdy -----------------------------------------------------
  17190. ::::::::::::::
  17191. scitem.spc
  17192. ::::::::::::::
  17193. -- Begin: SCITEM spc ---------------------------------------------------
  17194.      
  17195. with ST_DIANA; use ST_DIANA;
  17196.              package ITEM_Pkg is
  17197.     procedure Scan_ITEM(Root : ITEM.Locator);
  17198.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator);
  17199.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator);
  17200.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator);
  17201.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator);
  17202.     procedure Scan_component_decl(Root : component_declNode.Locator);
  17203.     procedure Scan_constant_decl(Root : constant_declNode.Locator);
  17204.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator);
  17205.     procedure Scan_in_decl(Root : in_declNode.Locator);
  17206.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator);
  17207.     procedure Scan_out_decl(Root : out_declNode.Locator);
  17208.     procedure Scan_variable_decl(Root : variable_declNode.Locator);
  17209.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator);
  17210.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator);
  17211.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator);
  17212.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator);
  17213.     procedure Scan_address_rep(Root : address_repNode.Locator);
  17214.     procedure Scan_record_rep(Root : record_repNode.Locator);
  17215.     procedure Scan_rep_component(Root : rep_componentNode.Locator);
  17216.     procedure Scan_simple_rep(Root : simple_repNode.Locator);
  17217.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator);
  17218.     procedure Scan_subp_body(Root : subp_bodyNode.Locator);
  17219.     procedure Scan_subp_decl(Root : subp_declNode.Locator);
  17220.     procedure Scan_entry_decl(Root : entry_declNode.Locator);
  17221.     procedure Scan_exception_decl(Root : exception_declNode.Locator);
  17222.     procedure Scan_null_component(Root : null_componentNode.Locator);
  17223.     procedure Scan_number_decl(Root : number_declNode.Locator);
  17224.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator);
  17225.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator);
  17226.     procedure Scan_subunit(Root : subunitNode.Locator);
  17227.     procedure Scan_task_body(Root : task_bodyNode.Locator);
  17228.     procedure Scan_task_decl(Root : task_declNode.Locator);
  17229.     procedure Scan_type_decl(Root : type_declNode.Locator);
  17230.     procedure Scan_use_clause(Root : use_clauseNode.Locator);
  17231.     procedure Scan_with_clause(Root : with_clauseNode.Locator);
  17232. end ITEM_Pkg;
  17233. -- End: SCITEM spc -----------------------------------------------------
  17234. ::::::::::::::
  17235. sciterati.bdy
  17236. ::::::::::::::
  17237. -- Begin: SCITERATION bdy ---------------------------------------------------
  17238.      
  17239. with Halstead_Data_Base;  use Halstead_Data_Base;
  17240. with Definitions; use Definitions;
  17241.              with DEF_ID_Pkg; use DEF_ID_Pkg;
  17242. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  17243. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  17244. package body ITERATION_Pkg is
  17245.      
  17246.      
  17247.     procedure Scan_ITERATION(Root : ITERATION.Locator) is
  17248.     begin
  17249.         case Kind(Root) is
  17250.           when FOR_ITERATIONKind => Scan_FOR_ITERATION(Root);
  17251.           when while_iterationKind => Scan_while_iteration(Root);
  17252.           when others => null;
  17253.         end case;
  17254.     end Scan_ITERATION;
  17255.      
  17256.      
  17257.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator) is
  17258.     begin
  17259.         case Kind(Root) is
  17260.           when forward_iterationKind => Scan_forward_iteration(Root);
  17261.           when reverse_iterationKind => Scan_reverse_iteration(Root);
  17262.           when others => null;
  17263.         end case;
  17264.     end Scan_FOR_ITERATION;
  17265.      
  17266.      
  17267.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator) is
  17268.     begin
  17269.       if not iteration_idNode.IsNull(as_id(Root)) then
  17270.      
  17271.      
  17272.        IncrementToken (for_loopz);
  17273.        IncrementToken (in_loopz);
  17274.      
  17275.      
  17276.         Scan_iteration_id(as_id(Root));
  17277.       end if;
  17278.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  17279.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  17280.       end if;
  17281.      
  17282.     end Scan_forward_iteration;
  17283.      
  17284.      
  17285.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator) is
  17286.     begin
  17287.       if not iteration_idNode.IsNull(as_id(Root)) then
  17288.      
  17289.      
  17290.        IncrementToken (for_loopz);
  17291.        IncrementToken (in_loopz);
  17292.      
  17293.      
  17294.         Scan_iteration_id(as_id(Root));
  17295.       end if;
  17296.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  17297.      
  17298.      
  17299.        IncrementToken (reversez);
  17300.      
  17301.      
  17302.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  17303.       end if;
  17304.      
  17305.     end Scan_reverse_iteration;
  17306.      
  17307.      
  17308.     procedure Scan_while_iteration(Root : while_iterationNode.Locator) is
  17309.     begin
  17310.       if not NAME_EXP.IsNull(as_while_exp(Root)) then
  17311.      
  17312.      
  17313.        IncrementToken (whilez);
  17314.      
  17315.      
  17316.         Scan_NAME_EXP(as_while_exp(Root));
  17317.       end if;
  17318.      
  17319.     end Scan_while_iteration;
  17320.      
  17321. end ITERATION_Pkg;
  17322. -- End: SCITERATION bdy -----------------------------------------------------
  17323. ::::::::::::::
  17324. sciterati.spc
  17325. ::::::::::::::
  17326. -- Begin: SCITERATION spc ---------------------------------------------------
  17327.      
  17328. with ST_DIANA; use ST_DIANA;
  17329.              package ITERATION_Pkg is
  17330.     procedure Scan_ITERATION(Root : ITERATION.Locator);
  17331.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator);
  17332.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator);
  17333.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator);
  17334.     procedure Scan_while_iteration(Root : while_iterationNode.Locator);
  17335. end ITERATION_Pkg;
  17336. -- End: SCITERATION spc -----------------------------------------------------
  17337. ::::::::::::::
  17338. scname_ex.bdy
  17339. ::::::::::::::
  17340. -- Begin: SCNAME_EXP bdy ---------------------------------------------------
  17341.      
  17342. with Halstead_Data_Base;  use Halstead_Data_Base;
  17343. with Definitions; use Definitions;
  17344.              with SERIES_UNIT_IH;
  17345. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  17346. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  17347. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  17348.      
  17349.                with VmmTextPkg;
  17350.                with TEXT_IO;
  17351.                          package body NAME_EXP_Pkg is
  17352.      
  17353.      
  17354.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator) is
  17355.     begin
  17356.         case Kind(Root) is
  17357.           when AGGKind => Scan_AGG(Root);
  17358.           when ALL_COMPONENTSKind => Scan_ALL_COMPONENTS(Root);
  17359.           when CALLSKind => Scan_CALLS(Root);
  17360.           when MARKKind => Scan_MARK(Root);
  17361.           when MEMBERSHIP_EXPKind => Scan_MEMBERSHIP_EXP(Root);
  17362.           when OPERATOR_EXPKind => Scan_OPERATOR_EXP(Root);
  17363.           when SHORT_CIRCUIT_EXPKind => Scan_SHORT_CIRCUIT_EXP(Root);
  17364.           when attributeKind => Scan_attribute(Root);
  17365.           when attribute_indexedKind => Scan_attribute_indexed(Root);
  17366.           when conversionKind => Scan_conversion(Root);
  17367.           when family_indexedKind => Scan_family_indexed(Root);
  17368.           when indexedKind => Scan_indexed(Root);
  17369.           when init_allocatorKind => Scan_init_allocator(Root);
  17370.           when null_accessKind => Scan_null_access(Root);
  17371.           when numeric_literalKind => Scan_numeric_literal(Root);
  17372.           when parenthesizedKind => Scan_parenthesized(Root);
  17373.           when qualifiedKind => Scan_qualified(Root);
  17374.           when sliceKind => Scan_slice(Root);
  17375.           when string_literalKind => Scan_string_literal(Root);
  17376.           when uninit_allocatorKind => Scan_uninit_allocator(Root);
  17377.           when others => null;
  17378.         end case;
  17379.     end Scan_NAME_EXP;
  17380.      
  17381.      
  17382.     procedure Scan_AGG(Root : AGG.Locator) is
  17383.     begin
  17384.         case Kind(Root) is
  17385.           when apply_aggKind => Scan_apply_agg(Root);
  17386.           when array_aggKind => Scan_array_agg(Root);
  17387.           when record_aggKind => Scan_record_agg(Root);
  17388.           when others => null;
  17389.         end case;
  17390.     end Scan_AGG;
  17391.      
  17392.      
  17393.     procedure Scan_apply_agg(Root : apply_aggNode.Locator) is
  17394.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17395.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17396.         use SeqOfAGG_COMPONENT;
  17397.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17398.     begin
  17399.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17400.      
  17401.      
  17402.      IncrementToken (open_parenthesisz);
  17403.      
  17404.      
  17405.         StartForward(as_agg_s(Root), as_agg_s_List);
  17406.         while not Finished(as_agg_s_List) loop
  17407.             as_agg_s_Item := Cell(as_agg_s_List);
  17408.      
  17409.      
  17410.      if SERIES_UNIT_IH.R.ih_inlist then
  17411.          IncrementToken (commaz);
  17412.      end if;
  17413.      SERIES_UNIT_IH.R.ih_inlist := true;
  17414.      
  17415.      
  17416.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17417.             Forward(as_agg_s_List);
  17418.         end loop;
  17419.         EndIterate(as_agg_s_List);
  17420.      
  17421.      
  17422.      IncrementToken (closed_parenthesisz);
  17423.      SERIES_UNIT_IH.R.ih_inlist := false;
  17424.      
  17425.      
  17426.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17427.      
  17428.     end Scan_apply_agg;
  17429.      
  17430.      
  17431.     procedure Scan_array_agg(Root : array_aggNode.Locator) is
  17432.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17433.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17434.         use SeqOfAGG_COMPONENT;
  17435.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17436.     begin
  17437.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17438.      
  17439.      
  17440.      IncrementToken (open_parenthesisz);
  17441.      
  17442.      
  17443.         StartForward(as_agg_s(Root), as_agg_s_List);
  17444.         while not Finished(as_agg_s_List) loop
  17445.             as_agg_s_Item := Cell(as_agg_s_List);
  17446.      
  17447.      
  17448.      if SERIES_UNIT_IH.R.ih_inlist then
  17449.          IncrementToken (commaz);
  17450.      end if;
  17451.      SERIES_UNIT_IH.R.ih_inlist := true;
  17452.      
  17453.      
  17454.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17455.             Forward(as_agg_s_List);
  17456.         end loop;
  17457.         EndIterate(as_agg_s_List);
  17458.      
  17459.      
  17460.      IncrementToken (closed_parenthesisz);
  17461.      SERIES_UNIT_IH.R.ih_inlist := false;
  17462.      
  17463.      
  17464.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17465.      
  17466.     end Scan_array_agg;
  17467.      
  17468.      
  17469.     procedure Scan_record_agg(Root : record_aggNode.Locator) is
  17470.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  17471.         as_agg_s_Item : AGG_COMPONENT.Locator;
  17472.         use SeqOfAGG_COMPONENT;
  17473.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17474.     begin
  17475.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17476.      
  17477.      
  17478.      IncrementToken (open_parenthesisz);
  17479.      
  17480.      
  17481.         StartForward(as_agg_s(Root), as_agg_s_List);
  17482.         while not Finished(as_agg_s_List) loop
  17483.             as_agg_s_Item := Cell(as_agg_s_List);
  17484.      
  17485.      
  17486.      if SERIES_UNIT_IH.R.ih_inlist then
  17487.          IncrementToken (commaz);
  17488.      end if;
  17489.      SERIES_UNIT_IH.R.ih_inlist := true;
  17490.      
  17491.      
  17492.             Scan_AGG_COMPONENT(as_agg_s_Item);
  17493.             Forward(as_agg_s_List);
  17494.         end loop;
  17495.         EndIterate(as_agg_s_List);
  17496.      
  17497.      
  17498.      IncrementToken (closed_parenthesisz);
  17499.      SERIES_UNIT_IH.R.ih_inlist := false;
  17500.      
  17501.      
  17502.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17503.      
  17504.     end Scan_record_agg;
  17505.      
  17506.      
  17507.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator) is
  17508.     begin
  17509.         case Kind(Root) is
  17510.           when explicit_all_componentsKind => Scan_explicit_all_components(Root);
  17511.           when implicit_all_componentsKind => Scan_implicit_all_components(Root);
  17512.           when others => null;
  17513.         end case;
  17514.     end Scan_ALL_COMPONENTS;
  17515.      
  17516.      
  17517.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator) is
  17518.     begin
  17519.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  17520.         Scan_NAME_EXP(as_all_name(Root));
  17521.       end if;
  17522.      
  17523.      
  17524.       IncrementToken (allz);
  17525.       IncrementToken (dotz);
  17526.      
  17527.      
  17528.      
  17529.     end Scan_explicit_all_components;
  17530.      
  17531.      
  17532.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator) is
  17533.     begin
  17534.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  17535.         Scan_NAME_EXP(as_all_name(Root));
  17536.       end if;
  17537.      
  17538.     end Scan_implicit_all_components;
  17539.      
  17540.      
  17541.     procedure Scan_CALLS(Root : CALLS.Locator) is
  17542.     begin
  17543.         case Kind(Root) is
  17544.           when apply_callKind => Scan_apply_call(Root);
  17545.           when entry_callKind => Scan_entry_call(Root);
  17546.           when func_callKind => Scan_func_call(Root);
  17547.           when proc_callKind => Scan_proc_call(Root);
  17548.           when others => null;
  17549.         end case;
  17550.     end Scan_CALLS;
  17551.      
  17552.      
  17553.     procedure Scan_apply_call(Root : apply_callNode.Locator) is
  17554.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17555.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17556.         use SeqOfGENERAL_ASSOC;
  17557.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17558.     begin
  17559.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17560.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17561.         Scan_NAME_EXP(as_apply_name(Root));
  17562.      
  17563.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17564.         then
  17565.      
  17566.          IncrementToken (open_parenthesisz);
  17567.      
  17568.         end if;
  17569.       end if;
  17570.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17571.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17572.         while not Finished(as_param_assoc_s_List) loop
  17573.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17574.      
  17575.      
  17576.       if SERIES_UNIT_IH.R.ih_inlist then
  17577.           IncrementToken (commaz);
  17578.       end if;
  17579.       SERIES_UNIT_IH.R.ih_inlist := true;
  17580.      
  17581.      
  17582.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17583.             Forward(as_param_assoc_s_List);
  17584.         end loop;
  17585.         EndIterate(as_param_assoc_s_List);
  17586.      
  17587.      
  17588.         IncrementToken (closed_parenthesisz);
  17589.    SERIES_UNIT_IH.R.ih_inlist := false;
  17590.      
  17591.      
  17592.       end if;
  17593.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17594.      
  17595.     end Scan_apply_call;
  17596.      
  17597.      
  17598.     procedure Scan_entry_call(Root : entry_callNode.Locator) is
  17599.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17600.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17601.         use SeqOfGENERAL_ASSOC;
  17602.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17603.     begin
  17604.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17605.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17606.         Scan_NAME_EXP(as_apply_name(Root));
  17607.      
  17608.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17609.         then
  17610.      
  17611.          IncrementToken (open_parenthesisz);
  17612.      
  17613.         end if;
  17614.       end if;
  17615.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17616.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17617.         while not Finished(as_param_assoc_s_List) loop
  17618.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17619.      
  17620.      
  17621.       if SERIES_UNIT_IH.R.ih_inlist then
  17622.           IncrementToken (commaz);
  17623.       end if;
  17624.       SERIES_UNIT_IH.R.ih_inlist := true;
  17625.      
  17626.      
  17627.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17628.             Forward(as_param_assoc_s_List);
  17629.         end loop;
  17630.         EndIterate(as_param_assoc_s_List);
  17631.      
  17632.      
  17633.         IncrementToken (closed_parenthesisz);
  17634.    SERIES_UNIT_IH.R.ih_inlist := false;
  17635.      
  17636.      
  17637.       end if;
  17638.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17639.      
  17640.     end Scan_entry_call;
  17641.      
  17642.      
  17643.     procedure Scan_func_call(Root : func_callNode.Locator) is
  17644.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17645.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17646.         use SeqOfGENERAL_ASSOC;
  17647.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17648.     begin
  17649.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17650.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17651.         Scan_NAME_EXP(as_apply_name(Root));
  17652.      
  17653.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17654.         then
  17655.      
  17656.          IncrementToken (open_parenthesisz);
  17657.      
  17658.         end if;
  17659.       end if;
  17660.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17661.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17662.         while not Finished(as_param_assoc_s_List) loop
  17663.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17664.      
  17665.      
  17666.       if SERIES_UNIT_IH.R.ih_inlist then
  17667.           IncrementToken (commaz);
  17668.       end if;
  17669.       SERIES_UNIT_IH.R.ih_inlist := true;
  17670.      
  17671.      
  17672.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17673.             Forward(as_param_assoc_s_List);
  17674.         end loop;
  17675.         EndIterate(as_param_assoc_s_List);
  17676.      
  17677.      
  17678.         IncrementToken (closed_parenthesisz);
  17679.    SERIES_UNIT_IH.R.ih_inlist := false;
  17680.      
  17681.      
  17682.       end if;
  17683.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17684.      
  17685.     end Scan_func_call;
  17686.      
  17687.      
  17688.     procedure Scan_proc_call(Root : proc_callNode.Locator) is
  17689.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  17690.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  17691.         use SeqOfGENERAL_ASSOC;
  17692.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  17693.     begin
  17694.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  17695.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  17696.         Scan_NAME_EXP(as_apply_name(Root));
  17697.      
  17698.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  17699.         then
  17700.      
  17701.          IncrementToken (open_parenthesisz);
  17702.      
  17703.         end if;
  17704.       end if;
  17705.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  17706.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  17707.         while not Finished(as_param_assoc_s_List) loop
  17708.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  17709.      
  17710.      
  17711.       if SERIES_UNIT_IH.R.ih_inlist then
  17712.           IncrementToken (commaz);
  17713.       end if;
  17714.       SERIES_UNIT_IH.R.ih_inlist := true;
  17715.      
  17716.      
  17717.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  17718.             Forward(as_param_assoc_s_List);
  17719.         end loop;
  17720.         EndIterate(as_param_assoc_s_List);
  17721.      
  17722.      
  17723.         IncrementToken (closed_parenthesisz);
  17724.    SERIES_UNIT_IH.R.ih_inlist := false;
  17725.      
  17726.      
  17727.       end if;
  17728.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  17729.      
  17730.     end Scan_proc_call;
  17731.      
  17732.      
  17733.     procedure Scan_MARK(Root : MARK.Locator) is
  17734.     begin
  17735.         case Kind(Root) is
  17736.           when USED_SYMBOLKind => Scan_USED_SYMBOL(Root);
  17737.           when selectedKind => Scan_selected(Root);
  17738.           when others => null;
  17739.         end case;
  17740.     end Scan_MARK;
  17741.      
  17742.      
  17743.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator) is
  17744.     begin
  17745.         case Kind(Root) is
  17746.           when used_charKind => Scan_used_char(Root);
  17747.           when used_idKind => Scan_used_id(Root);
  17748.           when used_operatorKind => Scan_used_operator(Root);
  17749.           when others => null;
  17750.         end case;
  17751.     end Scan_USED_SYMBOL;
  17752.      
  17753.      
  17754.     procedure Scan_used_char(Root : used_charNode.Locator) is
  17755.     begin
  17756.      
  17757.      
  17758.      Literal_Set.Insert (lx_text (lx_symrep (root)),
  17759.                          CurrentBlock.SetOfLiterals);
  17760.      IncrementToken (single_quotez);
  17761.      IncrementToken (single_quotez);
  17762.      
  17763.      
  17764.      
  17765.     end Scan_used_char;
  17766.      
  17767.      
  17768.     procedure Scan_used_id(Root : used_idNode.Locator) is
  17769.     begin
  17770.      
  17771.      
  17772.       if not DEF_ID.IsNull (sm_def (root)) then
  17773.          DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  17774.       else
  17775.           TEXT_IO.Put ("?? Unexpected null sm_def: ");
  17776.           TEXT_IO.Put_Line (
  17777.             VmmTextPkg.Value (
  17778.                    Source_Text.Value (
  17779.                      lx_text (
  17780.                        ne_normalized_symrep (
  17781.                          ne_symbol_entry_in_table (
  17782.                            lx_symrep (
  17783.                              root))))))
  17784.               );
  17785.       end if;
  17786.      
  17787.      
  17788.      
  17789.     end Scan_used_id;
  17790.      
  17791.      
  17792.     procedure Scan_used_operator(Root : used_operatorNode.Locator) is
  17793.     begin
  17794.      
  17795.      
  17796.         DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  17797.      
  17798.      
  17799.      
  17800.     end Scan_used_operator;
  17801.      
  17802.      
  17803.     procedure Scan_selected(Root : selectedNode.Locator) is
  17804.     begin
  17805.       if not NAME_EXP.IsNull(as_selected_name(Root)) then
  17806.         Scan_NAME_EXP(as_selected_name(Root));
  17807.      
  17808.      
  17809.      IncrementToken (dotz);
  17810.      
  17811.      
  17812.       end if;
  17813.       if not NAME_EXP.IsNull(as_selected_designator(Root)) then
  17814.         Scan_NAME_EXP(as_selected_designator(Root));
  17815.       end if;
  17816.      
  17817.     end Scan_selected;
  17818.      
  17819.      
  17820.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator) is
  17821.     begin
  17822.         case Kind(Root) is
  17823.           when in_expKind => Scan_in_exp(Root);
  17824.           when not_in_expKind => Scan_not_in_exp(Root);
  17825.           when others => null;
  17826.         end case;
  17827.     end Scan_MEMBERSHIP_EXP;
  17828.      
  17829.      
  17830.     procedure Scan_in_exp(Root : in_expNode.Locator) is
  17831.     begin
  17832.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  17833.         Scan_NAME_EXP(as_membership_exp(Root));
  17834.      
  17835.      
  17836.      IncrementToken (in_membershipz);
  17837.      
  17838.      
  17839.       end if;
  17840.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  17841.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  17842.       end if;
  17843.      
  17844.     end Scan_in_exp;
  17845.      
  17846.      
  17847.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator) is
  17848.     begin
  17849.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  17850.         Scan_NAME_EXP(as_membership_exp(Root));
  17851.      
  17852.      
  17853.      IncrementToken (not_in_membershipz);
  17854.      IncrementToken (in_membershipz);
  17855.      
  17856.      
  17857.       end if;
  17858.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  17859.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  17860.       end if;
  17861.      
  17862.     end Scan_not_in_exp;
  17863.      
  17864.      
  17865.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator) is
  17866.     begin
  17867.         case Kind(Root) is
  17868.           when binary_operationKind => Scan_binary_operation(Root);
  17869.           when unary_operationKind => Scan_unary_operation(Root);
  17870.           when others => null;
  17871.         end case;
  17872.     end Scan_OPERATOR_EXP;
  17873.      
  17874.      
  17875.     procedure Scan_binary_operation(Root : binary_operationNode.Locator) is
  17876.     begin
  17877.       if not NAME_EXP.IsNull(as_left_exp(Root)) then
  17878.         Scan_NAME_EXP(as_left_exp(Root));
  17879.       end if;
  17880.       if not used_operatorNode.IsNull(as_operator(Root)) then
  17881.         Scan_used_operator(as_operator(Root));
  17882.       end if;
  17883.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  17884.         Scan_NAME_EXP(as_right_exp(Root));
  17885.       end if;
  17886.      
  17887.     end Scan_binary_operation;
  17888.      
  17889.      
  17890.     procedure Scan_unary_operation(Root : unary_operationNode.Locator) is
  17891.     begin
  17892.       if not used_operatorNode.IsNull(as_operator(Root)) then
  17893.         Scan_used_operator(as_operator(Root));
  17894.       end if;
  17895.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  17896.         Scan_NAME_EXP(as_right_exp(Root));
  17897.       end if;
  17898.      
  17899.     end Scan_unary_operation;
  17900.      
  17901.      
  17902.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator) is
  17903.     begin
  17904.         case Kind(Root) is
  17905.           when and_then_expKind => Scan_and_then_exp(Root);
  17906.           when or_else_expKind => Scan_or_else_exp(Root);
  17907.           when others => null;
  17908.         end case;
  17909.     end Scan_SHORT_CIRCUIT_EXP;
  17910.      
  17911.      
  17912.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator) is
  17913.     begin
  17914.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  17915.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  17916.       end if;
  17917.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  17918.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  17919.       end if;
  17920.      
  17921.      
  17922.        IncrementToken (and_thenz);
  17923.        IncrementToken (then_andz);
  17924.      
  17925.      
  17926.      
  17927.     end Scan_and_then_exp;
  17928.      
  17929.      
  17930.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator) is
  17931.     begin
  17932.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  17933.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  17934.       end if;
  17935.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  17936.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  17937.       end if;
  17938.      
  17939.      
  17940.        IncrementToken (or_elsez);
  17941.        IncrementToken (else_orz);
  17942.      
  17943.      
  17944.      
  17945.     end Scan_or_else_exp;
  17946.      
  17947.      
  17948.     procedure Scan_attribute(Root : attributeNode.Locator) is
  17949.     begin
  17950.       if not NAME_EXP.IsNull(as_attribute_name(Root)) then
  17951.         Scan_NAME_EXP(as_attribute_name(Root));
  17952.      
  17953.      
  17954.      IncrementToken (tickz);
  17955.      
  17956.      
  17957.       end if;
  17958.       if not NAME_EXP.IsNull(as_attribute_id(Root)) then
  17959.         Scan_NAME_EXP(as_attribute_id(Root));
  17960.       end if;
  17961.      
  17962.     end Scan_attribute;
  17963.      
  17964.      
  17965.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator) is
  17966.     begin
  17967.       if not NAME_EXP.IsNull(as_attribute_indexed_name(Root)) then
  17968.      
  17969.      
  17970.      IncrementToken (open_parenthesisz);
  17971.      
  17972.      
  17973.         Scan_NAME_EXP(as_attribute_indexed_name(Root));
  17974.      
  17975.      
  17976.       IncrementToken (closed_parenthesisz);
  17977.      
  17978.      
  17979.       end if;
  17980.       if not NAME_EXP.IsNull(as_attribute_indexed_exp(Root)) then
  17981.         Scan_NAME_EXP(as_attribute_indexed_exp(Root));
  17982.       end if;
  17983.      
  17984.     end Scan_attribute_indexed;
  17985.      
  17986.      
  17987.     procedure Scan_conversion(Root : conversionNode.Locator) is
  17988.     begin
  17989.       if not NAME_EXP.IsNull(as_conversion_name(Root)) then
  17990.      
  17991.      
  17992.       IncrementToken (open_parenthesisz);
  17993.      
  17994.      
  17995.         Scan_NAME_EXP(as_conversion_name(Root));
  17996.      
  17997.      
  17998.        IncrementToken (closed_parenthesisz);
  17999.      
  18000.      
  18001.       end if;
  18002.       if not NAME_EXP.IsNull(as_conversion_exp(Root)) then
  18003.         Scan_NAME_EXP(as_conversion_exp(Root));
  18004.       end if;
  18005.      
  18006.     end Scan_conversion;
  18007.      
  18008.      
  18009.     procedure Scan_family_indexed(Root : family_indexedNode.Locator) is
  18010.     begin
  18011.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  18012.      
  18013.      
  18014.        IncrementToken (open_parenthesisz);
  18015.      
  18016.      
  18017.         Scan_NAME_EXP(as_family_index(Root));
  18018.      
  18019.      
  18020.        IncrementToken (closed_parenthesisz);
  18021.      
  18022.      
  18023.       end if;
  18024.       if not NAME_EXP.IsNull(as_family_name(Root)) then
  18025.         Scan_NAME_EXP(as_family_name(Root));
  18026.       end if;
  18027.      
  18028.     end Scan_family_indexed;
  18029.      
  18030.      
  18031.     procedure Scan_indexed(Root : indexedNode.Locator) is
  18032.         as_indexed_exp_s_List : SeqOfNAME_EXP.Generator;
  18033.         as_indexed_exp_s_Item : NAME_EXP.Locator;
  18034.         use SeqOfNAME_EXP;
  18035.     begin
  18036.       if not NAME_EXP.IsNull(as_indexed_name(Root)) then
  18037.         Scan_NAME_EXP(as_indexed_name(Root));
  18038.       end if;
  18039.       if not SeqOfNAME_EXP.IsNull(as_indexed_exp_s(Root)) then
  18040.      
  18041.      
  18042.       IncrementToken (open_parenthesisz);
  18043.      
  18044.      
  18045.         StartForward(as_indexed_exp_s(Root), as_indexed_exp_s_List);
  18046.         while not Finished(as_indexed_exp_s_List) loop
  18047.             as_indexed_exp_s_Item := Cell(as_indexed_exp_s_List);
  18048.             Scan_NAME_EXP(as_indexed_exp_s_Item);
  18049.             Forward(as_indexed_exp_s_List);
  18050.         end loop;
  18051.         EndIterate(as_indexed_exp_s_List);
  18052.      
  18053.      
  18054.        IncrementToken (closed_parenthesisz);
  18055.      
  18056.      
  18057.       end if;
  18058.      
  18059.     end Scan_indexed;
  18060.      
  18061.      
  18062.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator) is
  18063.     begin
  18064.      
  18065.      
  18066.           IncrementToken (new_allocatorz);
  18067.      
  18068.      
  18069.       if not qualifiedNode.IsNull(as_allocator_qualified(Root)) then
  18070.         Scan_qualified(as_allocator_qualified(Root));
  18071.       end if;
  18072.      
  18073.     end Scan_init_allocator;
  18074.      
  18075.      
  18076.     procedure Scan_null_access(Root : null_accessNode.Locator) is
  18077.     begin
  18078.      
  18079.      
  18080.      IncrementToken (null_valuez);
  18081.      
  18082.      
  18083.      
  18084.     end Scan_null_access;
  18085.      
  18086.      
  18087.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator) is
  18088.     begin
  18089.      
  18090.      
  18091.     Literal_Set.Insert (lx_text (lx_numrep (root)),
  18092.                         CurrentBlock.SetOfLiterals);
  18093.      
  18094.      
  18095.      
  18096.     end Scan_numeric_literal;
  18097.      
  18098.      
  18099.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator) is
  18100.     begin
  18101.      
  18102.      
  18103.      IncrementToken (open_parenthesisz);
  18104.      
  18105.      
  18106.       if not NAME_EXP.IsNull(as_parenthesized_exp(Root)) then
  18107.         Scan_NAME_EXP(as_parenthesized_exp(Root));
  18108.       end if;
  18109.      
  18110.      
  18111.      IncrementToken (closed_parenthesisz);
  18112.      
  18113.      
  18114.      
  18115.     end Scan_parenthesized;
  18116.      
  18117.      
  18118.     procedure Scan_qualified(Root : qualifiedNode.Locator) is
  18119.     begin
  18120.       if not MARK.IsNull(as_qualified_name(Root)) then
  18121.         Scan_MARK(as_qualified_name(Root));
  18122.      
  18123.      
  18124.      IncrementToken (tickz);
  18125.      
  18126.      
  18127.       end if;
  18128.       if not NAME_EXP.IsNull(as_qualified_exp(Root)) then
  18129.         Scan_NAME_EXP(as_qualified_exp(Root));
  18130.       end if;
  18131.      
  18132.     end Scan_qualified;
  18133.      
  18134.      
  18135.     procedure Scan_slice(Root : sliceNode.Locator) is
  18136.     begin
  18137.      
  18138.      
  18139.      IncrementToken (open_parenthesisz);
  18140.      
  18141.      
  18142.      
  18143.      
  18144.     IncrementToken (closed_parenthesisz);
  18145.      
  18146.      
  18147.       if not NAME_EXP.IsNull(as_slice_name(Root)) then
  18148.         Scan_NAME_EXP(as_slice_name(Root));
  18149.       end if;
  18150.       if not OBJECT_TYPE.IsNull(as_slice_discrete_range(Root)) then
  18151.         Scan_OBJECT_TYPE(as_slice_discrete_range(Root));
  18152.       end if;
  18153.      
  18154.     end Scan_slice;
  18155.      
  18156.      
  18157.     procedure Scan_string_literal(Root : string_literalNode.Locator) is
  18158.     begin
  18159.      
  18160.      
  18161.     IncrementToken (double_quotez);
  18162.     Literal_Set.Insert (lx_text (lx_string_symrep (root)),
  18163.                     CurrentBlock.SetOfLiterals);
  18164.      
  18165.      
  18166.      
  18167.      
  18168.      IncrementToken (double_quotez);
  18169.      
  18170.      
  18171.      
  18172.     end Scan_string_literal;
  18173.      
  18174.      
  18175.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator) is
  18176.     begin
  18177.      
  18178.      
  18179.       IncrementToken (new_allocatorz);
  18180.      
  18181.      
  18182.       if not object_type_constrainedNode.IsNull(as_allocator_constrained(Root)) then
  18183.         Scan_object_type_constrained(as_allocator_constrained(Root));
  18184.       end if;
  18185.      
  18186.     end Scan_uninit_allocator;
  18187.      
  18188. end NAME_EXP_Pkg;
  18189. -- End: SCNAME_EXP bdy -----------------------------------------------------
  18190. ::::::::::::::
  18191. scname_ex.spc
  18192. ::::::::::::::
  18193. -- Begin: SCNAME_EXP spc ---------------------------------------------------
  18194.      
  18195. with ST_DIANA; use ST_DIANA;
  18196.              package NAME_EXP_Pkg is
  18197.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator);
  18198.     procedure Scan_AGG(Root : AGG.Locator);
  18199.     procedure Scan_apply_agg(Root : apply_aggNode.Locator);
  18200.     procedure Scan_array_agg(Root : array_aggNode.Locator);
  18201.     procedure Scan_record_agg(Root : record_aggNode.Locator);
  18202.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator);
  18203.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator);
  18204.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator);
  18205.     procedure Scan_CALLS(Root : CALLS.Locator);
  18206.     procedure Scan_apply_call(Root : apply_callNode.Locator);
  18207.     procedure Scan_entry_call(Root : entry_callNode.Locator);
  18208.     procedure Scan_func_call(Root : func_callNode.Locator);
  18209.     procedure Scan_proc_call(Root : proc_callNode.Locator);
  18210.     procedure Scan_MARK(Root : MARK.Locator);
  18211.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator);
  18212.     procedure Scan_used_char(Root : used_charNode.Locator);
  18213.     procedure Scan_used_id(Root : used_idNode.Locator);
  18214.     procedure Scan_used_operator(Root : used_operatorNode.Locator);
  18215.     procedure Scan_selected(Root : selectedNode.Locator);
  18216.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator);
  18217.     procedure Scan_in_exp(Root : in_expNode.Locator);
  18218.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator);
  18219.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator);
  18220.     procedure Scan_binary_operation(Root : binary_operationNode.Locator);
  18221.     procedure Scan_unary_operation(Root : unary_operationNode.Locator);
  18222.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator);
  18223.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator);
  18224.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator);
  18225.     procedure Scan_attribute(Root : attributeNode.Locator);
  18226.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator);
  18227.     procedure Scan_conversion(Root : conversionNode.Locator);
  18228.     procedure Scan_family_indexed(Root : family_indexedNode.Locator);
  18229.     procedure Scan_indexed(Root : indexedNode.Locator);
  18230.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator);
  18231.     procedure Scan_null_access(Root : null_accessNode.Locator);
  18232.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator);
  18233.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator);
  18234.     procedure Scan_qualified(Root : qualifiedNode.Locator);
  18235.     procedure Scan_slice(Root : sliceNode.Locator);
  18236.     procedure Scan_string_literal(Root : string_literalNode.Locator);
  18237.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator);
  18238. end NAME_EXP_Pkg;
  18239. -- End: SCNAME_EXP spc -----------------------------------------------------
  18240. ::::::::::::::
  18241. scobject_.bdy
  18242. ::::::::::::::
  18243. -- Begin: SCOBJECT_DEF bdy ---------------------------------------------------
  18244.      
  18245. with Halstead_Data_Base;  use Halstead_Data_Base;
  18246. with Definitions; use Definitions;
  18247.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18248. package body OBJECT_DEF_Pkg is
  18249.      
  18250.      
  18251.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator) is
  18252.     begin
  18253.         case Kind(Root) is
  18254.           when object_initKind => Scan_object_init(Root);
  18255.           when object_renameKind => Scan_object_rename(Root);
  18256.           when others => null;
  18257.         end case;
  18258.     end Scan_OBJECT_DEF;
  18259.      
  18260.      
  18261.     procedure Scan_object_init(Root : object_initNode.Locator) is
  18262.     begin
  18263.      
  18264.      
  18265.            IncrementToken (colon_equalsz);
  18266.      
  18267.      
  18268.       if not NAME_EXP.IsNull(as_init_exp(Root)) then
  18269.         Scan_NAME_EXP(as_init_exp(Root));
  18270.       end if;
  18271.      
  18272.     end Scan_object_init;
  18273.      
  18274.      
  18275.     procedure Scan_object_rename(Root : object_renameNode.Locator) is
  18276.     begin
  18277.      
  18278.      
  18279.           IncrementToken (renamesz);
  18280.      
  18281.      
  18282.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  18283.         Scan_NAME_EXP(as_rename_name(Root));
  18284.       end if;
  18285.      
  18286.     end Scan_object_rename;
  18287.      
  18288. end OBJECT_DEF_Pkg;
  18289. -- End: SCOBJECT_DEF bdy -----------------------------------------------------
  18290. ::::::::::::::
  18291. scobject_.spc
  18292. ::::::::::::::
  18293. -- Begin: SCOBJECT_DEF spc ---------------------------------------------------
  18294.      
  18295. with ST_DIANA; use ST_DIANA;
  18296.              package OBJECT_DEF_Pkg is
  18297.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator);
  18298.     procedure Scan_object_init(Root : object_initNode.Locator);
  18299.     procedure Scan_object_rename(Root : object_renameNode.Locator);
  18300. end OBJECT_DEF_Pkg;
  18301. -- End: SCOBJECT_DEF spc -----------------------------------------------------
  18302. ::::::::::::::
  18303. scpkg_def.bdy
  18304. ::::::::::::::
  18305. -- Begin: SCPKG_DEF bdy ---------------------------------------------------
  18306.      
  18307. with Halstead_Data_Base;  use Halstead_Data_Base;
  18308. with Definitions; use Definitions;
  18309.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  18310. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  18311. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18312. with ITEM_Pkg; use ITEM_Pkg;
  18313. package body PKG_DEF_Pkg is
  18314.      
  18315.      
  18316.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator) is
  18317.     begin
  18318.         case Kind(Root) is
  18319.           when pkg_block_stubKind => Scan_pkg_block_stub(Root);
  18320.           when pkg_instantiationKind => Scan_pkg_instantiation(Root);
  18321.           when pkg_renameKind => Scan_pkg_rename(Root);
  18322.           when pkg_specKind => Scan_pkg_spec(Root);
  18323.           when others => null;
  18324.         end case;
  18325.     end Scan_PKG_DEF;
  18326.      
  18327.      
  18328.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator) is
  18329.     begin
  18330.       if not BLOCK_STUB.IsNull(as_pkg_block_stub(Root)) then
  18331.         Scan_BLOCK_STUB(as_pkg_block_stub(Root));
  18332.       end if;
  18333.      
  18334.     end Scan_pkg_block_stub;
  18335.      
  18336.      
  18337.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator) is
  18338.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  18339.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  18340.         use SeqOfGENERAL_ASSOC;
  18341.     begin
  18342.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  18343.      
  18344.      
  18345.       IncrementToken (open_parenthesisz);
  18346.      
  18347.      
  18348.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  18349.         while not Finished(as_generic_assoc_s_List) loop
  18350.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  18351.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  18352.             Forward(as_generic_assoc_s_List);
  18353.         end loop;
  18354.         EndIterate(as_generic_assoc_s_List);
  18355.      
  18356.      
  18357.       IncrementToken (closed_parenthesisz);
  18358.      
  18359.      
  18360.       end if;
  18361.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  18362.         Scan_NAME_EXP(as_instantiation_name(Root));
  18363.      
  18364.      
  18365.       IncrementToken (new_generic_instz);
  18366.      
  18367.      
  18368.       end if;
  18369.      
  18370.     end Scan_pkg_instantiation;
  18371.      
  18372.      
  18373.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator) is
  18374.     begin
  18375.      
  18376.      
  18377.      IncrementToken (renamesz);
  18378.      
  18379.      
  18380.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  18381.      
  18382.      
  18383.                 IncrementToken (renamesz);
  18384.      
  18385.      
  18386.         Scan_NAME_EXP(as_rename_name(Root));
  18387.       end if;
  18388.      
  18389.     end Scan_pkg_rename;
  18390.      
  18391.      
  18392.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator) is
  18393.         as_visible_part_List : SeqOfITEM.Generator;
  18394.         as_visible_part_Item : ITEM.Locator;
  18395.         use SeqOfITEM;
  18396.         as_priv_part_List : SeqOfITEM.Generator;
  18397.         as_priv_part_Item : ITEM.Locator;
  18398.         use SeqOfITEM;
  18399.     begin
  18400.       if not SeqOfITEM.IsNull(as_visible_part(Root)) then
  18401.         StartForward(as_visible_part(Root), as_visible_part_List);
  18402.         while not Finished(as_visible_part_List) loop
  18403.             as_visible_part_Item := Cell(as_visible_part_List);
  18404.             Scan_ITEM(as_visible_part_Item);
  18405.             Forward(as_visible_part_List);
  18406.         end loop;
  18407.         EndIterate(as_visible_part_List);
  18408.       end if;
  18409.       if not SeqOfITEM.IsNull(as_priv_part(Root)) then
  18410.      
  18411.      
  18412.        IncrementToken (private_sectionz);
  18413.      
  18414.      
  18415.         StartForward(as_priv_part(Root), as_priv_part_List);
  18416.         while not Finished(as_priv_part_List) loop
  18417.             as_priv_part_Item := Cell(as_priv_part_List);
  18418.             Scan_ITEM(as_priv_part_Item);
  18419.             Forward(as_priv_part_List);
  18420.         end loop;
  18421.         EndIterate(as_priv_part_List);
  18422.       end if;
  18423.      
  18424.     end Scan_pkg_spec;
  18425.      
  18426. end PKG_DEF_Pkg;
  18427. -- End: SCPKG_DEF bdy -----------------------------------------------------
  18428. ::::::::::::::
  18429. scpkg_def.spc
  18430. ::::::::::::::
  18431. -- Begin: SCPKG_DEF spc ---------------------------------------------------
  18432.      
  18433. with ST_DIANA; use ST_DIANA;
  18434.              package PKG_DEF_Pkg is
  18435.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator);
  18436.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator);
  18437.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator);
  18438.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator);
  18439.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator);
  18440. end PKG_DEF_Pkg;
  18441. -- End: SCPKG_DEF spc -----------------------------------------------------
  18442. ::::::::::::::
  18443. scstm.bdy
  18444. ::::::::::::::
  18445. --VMS file: %nosc.work.tools.halstead.source*(SCSTM.bdy)
  18446. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCSTM.bdy
  18447. -- Begin: SCSTM bdy ---------------------------------------------------
  18448.      
  18449. with Halstead_Data_Base;  use Halstead_Data_Base;
  18450. with Definitions; use Definitions;
  18451.              with SERIES_UNIT_IH;
  18452. with block_stm_IH;
  18453. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  18454. with HEADER_Pkg; use HEADER_Pkg;
  18455. with DEF_ID_Pkg; use DEF_ID_Pkg;
  18456. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  18457. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  18458. with ITERATION_Pkg; use ITERATION_Pkg;
  18459. with ITEM_Pkg; use ITEM_Pkg;
  18460.      
  18461.               with TEXT_IO; use TEXT_IO;
  18462.               with VmmTextPkg;
  18463.               with Block_Utilities;
  18464.                   package body STM_Pkg is
  18465.      
  18466.      
  18467.     procedure Scan_STM(Root : STM.Locator) is
  18468.     begin
  18469.         case Kind(Root) is
  18470.           when CALL_STMKind => Scan_CALL_STM(Root);
  18471.           when SELECTIVE_ENTRY_STMKind => Scan_SELECTIVE_ENTRY_STM(Root);
  18472.           when abort_stmKind => Scan_abort_stm(Root);
  18473.           when accept_stmKind => Scan_accept_stm(Root);
  18474.           when assign_stmKind => Scan_assign_stm(Root);
  18475.           when block_stmKind => Scan_block_stm(Root);
  18476.           when case_stmKind => Scan_case_stm(Root);
  18477.           when code_stmKind => Scan_code_stm(Root);
  18478.           when delay_stmKind => Scan_delay_stm(Root);
  18479.           when exit_stmKind => Scan_exit_stm(Root);
  18480.           when goto_stmKind => Scan_goto_stm(Root);
  18481.           when if_stmKind => Scan_if_stm(Root);
  18482.           when labeled_stmKind => Scan_labeled_stm(Root);
  18483.           when loop_stmKind => Scan_loop_stm(Root);
  18484.           when null_stmKind => Scan_null_stm(Root);
  18485.           when pragma_stmKind => Scan_pragma_stm(Root);
  18486.           when raise_stmKind => Scan_raise_stm(Root);
  18487.           when return_stmKind => Scan_return_stm(Root);
  18488.           when select_stmKind => Scan_select_stm(Root);
  18489.           when terminate_stmKind => Scan_terminate_stm(Root);
  18490.           when others => null;
  18491.         end case;
  18492.     end Scan_STM;
  18493.      
  18494.      
  18495.     procedure Scan_CALL_STM(Root : CALL_STM.Locator) is
  18496.     begin
  18497.         case Kind(Root) is
  18498.           when apply_call_stmKind => Scan_apply_call_stm(Root);
  18499.           when entry_call_stmKind => Scan_entry_call_stm(Root);
  18500.           when proc_call_stmKind => Scan_proc_call_stm(Root);
  18501.           when others => null;
  18502.         end case;
  18503.     end Scan_CALL_STM;
  18504.      
  18505.      
  18506.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator) is
  18507.     begin
  18508.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18509.         Scan_NAME_EXP(as_call_name(Root));
  18510.       end if;
  18511.      
  18512.         if  Kind(root) not in labeled_stmKind
  18513.         then
  18514.      
  18515.         if (not (Kind (root) in block_stmKind))
  18516.             or else
  18517.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18518.             then
  18519.      
  18520.               -- If the root is not a block_stm or if it is then
  18521.               -- if it is not a block with declarations increment
  18522.               -- semicolon.
  18523.               -- This is because the semicolon associated with a declare
  18524.               -- block must be counted in that declare block. If we
  18525.               -- counted it here it would increment the count for the
  18526.               -- enclosing block.
  18527.          IncrementToken (semicolonz);
  18528.       end if;
  18529.      
  18530.         end if;
  18531.      
  18532.     end Scan_apply_call_stm;
  18533.      
  18534.      
  18535.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator) is
  18536.     begin
  18537.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18538.         Scan_NAME_EXP(as_call_name(Root));
  18539.       end if;
  18540.      
  18541.         if  Kind(root) not in labeled_stmKind
  18542.         then
  18543.      
  18544.         if (not (Kind (root) in block_stmKind))
  18545.             or else
  18546.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18547.             then
  18548.      
  18549.               -- If the root is not a block_stm or if it is then
  18550.               -- if it is not a block with declarations increment
  18551.               -- semicolon.
  18552.               -- This is because the semicolon associated with a declare
  18553.               -- block must be counted in that declare block. If we
  18554.               -- counted it here it would increment the count for the
  18555.               -- enclosing block.
  18556.          IncrementToken (semicolonz);
  18557.       end if;
  18558.      
  18559.         end if;
  18560.      
  18561.     end Scan_entry_call_stm;
  18562.      
  18563.      
  18564.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator) is
  18565.     begin
  18566.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  18567.         Scan_NAME_EXP(as_call_name(Root));
  18568.       end if;
  18569.      
  18570.         if  Kind(root) not in labeled_stmKind
  18571.         then
  18572.      
  18573.         if (not (Kind (root) in block_stmKind))
  18574.             or else
  18575.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18576.             then
  18577.      
  18578.               -- If the root is not a block_stm or if it is then
  18579.               -- if it is not a block with declarations increment
  18580.               -- semicolon.
  18581.               -- This is because the semicolon associated with a declare
  18582.               -- block must be counted in that declare block. If we
  18583.               -- counted it here it would increment the count for the
  18584.               -- enclosing block.
  18585.          IncrementToken (semicolonz);
  18586.       end if;
  18587.      
  18588.         end if;
  18589.      
  18590.     end Scan_proc_call_stm;
  18591.      
  18592.      
  18593.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator) is
  18594.     begin
  18595.         case Kind(Root) is
  18596.           when cond_entry_stmKind => Scan_cond_entry_stm(Root);
  18597.           when timed_entry_stmKind => Scan_timed_entry_stm(Root);
  18598.           when others => null;
  18599.         end case;
  18600.     end Scan_SELECTIVE_ENTRY_STM;
  18601.      
  18602.      
  18603.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator) is
  18604.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  18605.         as_sel_entry_stm_s1_Item : STM.Locator;
  18606.         use SeqOfSTM;
  18607.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  18608.         as_sel_entry_stm_s2_Item : STM.Locator;
  18609.         use SeqOfSTM;
  18610.     begin
  18611.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  18612.      
  18613.      
  18614.      IncrementToken (selectz);
  18615.      
  18616.      
  18617.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  18618.         while not Finished(as_sel_entry_stm_s1_List) loop
  18619.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  18620.             Scan_STM(as_sel_entry_stm_s1_Item);
  18621.             Forward(as_sel_entry_stm_s1_List);
  18622.         end loop;
  18623.         EndIterate(as_sel_entry_stm_s1_List);
  18624.       end if;
  18625.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  18626.      
  18627.      
  18628.      IncrementToken (elsez);
  18629.      
  18630.      
  18631.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  18632.         while not Finished(as_sel_entry_stm_s2_List) loop
  18633.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  18634.             Scan_STM(as_sel_entry_stm_s2_Item);
  18635.             Forward(as_sel_entry_stm_s2_List);
  18636.         end loop;
  18637.         EndIterate(as_sel_entry_stm_s2_List);
  18638.      
  18639.      
  18640.      IncrementToken (end_selectz);
  18641.      IncrementToken (selectz);
  18642.      
  18643.      
  18644.       end if;
  18645.      
  18646.         if  Kind(root) not in labeled_stmKind
  18647.         then
  18648.      
  18649.         if (not (Kind (root) in block_stmKind))
  18650.             or else
  18651.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18652.             then
  18653.      
  18654.               -- If the root is not a block_stm or if it is then
  18655.               -- if it is not a block with declarations increment
  18656.               -- semicolon.
  18657.               -- This is because the semicolon associated with a declare
  18658.               -- block must be counted in that declare block. If we
  18659.               -- counted it here it would increment the count for the
  18660.               -- enclosing block.
  18661.          IncrementToken (semicolonz);
  18662.       end if;
  18663.      
  18664.         end if;
  18665.      
  18666.     end Scan_cond_entry_stm;
  18667.      
  18668.      
  18669.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator) is
  18670.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  18671.         as_sel_entry_stm_s1_Item : STM.Locator;
  18672.         use SeqOfSTM;
  18673.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  18674.         as_sel_entry_stm_s2_Item : STM.Locator;
  18675.         use SeqOfSTM;
  18676.     begin
  18677.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  18678.      
  18679.      
  18680.      IncrementToken (selectz);
  18681.      
  18682.      
  18683.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  18684.         while not Finished(as_sel_entry_stm_s1_List) loop
  18685.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  18686.             Scan_STM(as_sel_entry_stm_s1_Item);
  18687.             Forward(as_sel_entry_stm_s1_List);
  18688.         end loop;
  18689.         EndIterate(as_sel_entry_stm_s1_List);
  18690.       end if;
  18691.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  18692.      
  18693.      
  18694.      IncrementToken (or_selectz);
  18695.      
  18696.      
  18697.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  18698.         while not Finished(as_sel_entry_stm_s2_List) loop
  18699.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  18700.             Scan_STM(as_sel_entry_stm_s2_Item);
  18701.             Forward(as_sel_entry_stm_s2_List);
  18702.         end loop;
  18703.         EndIterate(as_sel_entry_stm_s2_List);
  18704.      
  18705.      
  18706.      IncrementToken (end_selectz);
  18707.      IncrementToken (selectz);
  18708.      
  18709.      
  18710.       end if;
  18711.      
  18712.         if  Kind(root) not in labeled_stmKind
  18713.         then
  18714.      
  18715.         if (not (Kind (root) in block_stmKind))
  18716.             or else
  18717.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18718.             then
  18719.      
  18720.               -- If the root is not a block_stm or if it is then
  18721.               -- if it is not a block with declarations increment
  18722.               -- semicolon.
  18723.               -- This is because the semicolon associated with a declare
  18724.               -- block must be counted in that declare block. If we
  18725.               -- counted it here it would increment the count for the
  18726.               -- enclosing block.
  18727.          IncrementToken (semicolonz);
  18728.       end if;
  18729.      
  18730.         end if;
  18731.      
  18732.     end Scan_timed_entry_stm;
  18733.      
  18734.      
  18735.     procedure Scan_abort_stm(Root : abort_stmNode.Locator) is
  18736.         as_abort_name_s_List : SeqOfNAME_EXP.Generator;
  18737.         as_abort_name_s_Item : NAME_EXP.Locator;
  18738.         use SeqOfNAME_EXP;
  18739.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  18740.     begin
  18741.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  18742.      
  18743.      
  18744.        IncrementToken (abortz);
  18745.      
  18746.      
  18747.       if not SeqOfNAME_EXP.IsNull(as_abort_name_s(Root)) then
  18748.         StartForward(as_abort_name_s(Root), as_abort_name_s_List);
  18749.         while not Finished(as_abort_name_s_List) loop
  18750.             as_abort_name_s_Item := Cell(as_abort_name_s_List);
  18751.      
  18752.      
  18753.        if SERIES_UNIT_IH.R.ih_inlist then
  18754.            IncrementToken (commaz);
  18755.        end if;
  18756.        SERIES_UNIT_IH.R.ih_inlist := true;
  18757.      
  18758.      
  18759.             Scan_NAME_EXP(as_abort_name_s_Item);
  18760.             Forward(as_abort_name_s_List);
  18761.         end loop;
  18762.         EndIterate(as_abort_name_s_List);
  18763.       end if;
  18764.      
  18765.      
  18766.        SERIES_UNIT_IH.R.ih_inlist := false;
  18767.      
  18768.      
  18769.      
  18770.         if  Kind(root) not in labeled_stmKind
  18771.         then
  18772.      
  18773.         if (not (Kind (root) in block_stmKind))
  18774.             or else
  18775.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18776.             then
  18777.      
  18778.               -- If the root is not a block_stm or if it is then
  18779.               -- if it is not a block with declarations increment
  18780.               -- semicolon.
  18781.               -- This is because the semicolon associated with a declare
  18782.               -- block must be counted in that declare block. If we
  18783.               -- counted it here it would increment the count for the
  18784.               -- enclosing block.
  18785.          IncrementToken (semicolonz);
  18786.       end if;
  18787.      
  18788.         end if;
  18789.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  18790.      
  18791.     end Scan_abort_stm;
  18792.      
  18793.      
  18794.     procedure Scan_accept_stm(Root : accept_stmNode.Locator) is
  18795.         as_accept_stm_s_List : SeqOfSTM.Generator;
  18796.         as_accept_stm_s_Item : STM.Locator;
  18797.         use SeqOfSTM;
  18798.     begin
  18799.      
  18800.      
  18801.        IncrementToken (acceptz);
  18802.      
  18803.      
  18804.       if not NAME_EXP.IsNull(as_accept_designator(Root)) then
  18805.         Scan_NAME_EXP(as_accept_designator(Root));
  18806.       end if;
  18807.       if not accept_specNode.IsNull(as_accept_spec(Root)) then
  18808.         Scan_accept_spec(as_accept_spec(Root));
  18809.       end if;
  18810.       if not SeqOfSTM.IsNull(as_accept_stm_s(Root)) then
  18811.      
  18812.      
  18813.        IncrementToken (doz);
  18814.        IncrementToken (end_acceptz);
  18815.      
  18816.      
  18817.         StartForward(as_accept_stm_s(Root), as_accept_stm_s_List);
  18818.         while not Finished(as_accept_stm_s_List) loop
  18819.             as_accept_stm_s_Item := Cell(as_accept_stm_s_List);
  18820.             Scan_STM(as_accept_stm_s_Item);
  18821.             Forward(as_accept_stm_s_List);
  18822.         end loop;
  18823.         EndIterate(as_accept_stm_s_List);
  18824.       end if;
  18825.      
  18826.         if  Kind(root) not in labeled_stmKind
  18827.         then
  18828.      
  18829.         if (not (Kind (root) in block_stmKind))
  18830.             or else
  18831.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18832.             then
  18833.      
  18834.               -- If the root is not a block_stm or if it is then
  18835.               -- if it is not a block with declarations increment
  18836.               -- semicolon.
  18837.               -- This is because the semicolon associated with a declare
  18838.               -- block must be counted in that declare block. If we
  18839.               -- counted it here it would increment the count for the
  18840.               -- enclosing block.
  18841.          IncrementToken (semicolonz);
  18842.       end if;
  18843.      
  18844.         end if;
  18845.      
  18846.     end Scan_accept_stm;
  18847.      
  18848.      
  18849.     procedure Scan_assign_stm(Root : assign_stmNode.Locator) is
  18850.     begin
  18851.      
  18852.      
  18853.   IncrementToken (colon_equalsz);
  18854.      
  18855.      
  18856.       if not NAME_EXP.IsNull(as_assign_name(Root)) then
  18857.         Scan_NAME_EXP(as_assign_name(Root));
  18858.       end if;
  18859.       if not NAME_EXP.IsNull(as_assign_exp(Root)) then
  18860.         Scan_NAME_EXP(as_assign_exp(Root));
  18861.       end if;
  18862.      
  18863.         if  Kind(root) not in labeled_stmKind
  18864.         then
  18865.      
  18866.         if (not (Kind (root) in block_stmKind))
  18867.             or else
  18868.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18869.             then
  18870.      
  18871.               -- If the root is not a block_stm or if it is then
  18872.               -- if it is not a block with declarations increment
  18873.               -- semicolon.
  18874.               -- This is because the semicolon associated with a declare
  18875.               -- block must be counted in that declare block. If we
  18876.               -- counted it here it would increment the count for the
  18877.               -- enclosing block.
  18878.          IncrementToken (semicolonz);
  18879.       end if;
  18880.      
  18881.         end if;
  18882.      
  18883.     end Scan_assign_stm;
  18884.      
  18885.      
  18886.     procedure Scan_block_stm(Root : block_stmNode.Locator) is
  18887.         Old_block_stm_IHR : block_stm_IH.RecType := block_stm_IH.R;
  18888.     begin
  18889.         block_stm_IH.R.ih_inblock :=  false ;
  18890.       if not block_idNode.IsNull(as_block_label(Root)) then
  18891.         Scan_block_id(as_block_label(Root));
  18892.       end if;
  18893.       if not body_blockNode.IsNull(as_block_body(Root)) then
  18894.      
  18895.      
  18896.    if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  18897.        block_stm_IH.R.ih_inblock := true;
  18898.        if not OuterMostBlockSeen then
  18899.            OuterMostBlockSeen := true;
  18900.        else
  18901.            BlockInfoStack.Push (BlockStack, CurrentBlock);
  18902.            CurrentBlock := InitializeCurrentBlock;
  18903.        end if;
  18904.        if Block_Utilities.Is_Block_Labeled (root) then
  18905.              -- Count : which is associated with the block name
  18906.              -- here.   At this point we know we have a label id and
  18907.              -- the colon adds to the complexity of the declare block.
  18908.            SetBlockId (
  18909.                        lx_symrep (as_block_label (root)),
  18910.                        declare_block,
  18911.                        DecId,
  18912.                        LineNumber (lx_srcpos (root))
  18913.                       );
  18914.        else
  18915.            SetBlockId (
  18916.                        TOKEN.NullRef,
  18917.                        declare_block,
  18918.                        DecId,
  18919.                        LineNumber (lx_srcpos (root))
  18920.                       );
  18921.        end if;
  18922.   end if;
  18923.      -- This next check is made regardless of whether we are in
  18924.      -- a block_stm with declarations or one without declarations.  If
  18925.      -- the block has a name then it has a colon.
  18926.      
  18927.   if Block_Utilities.Is_Block_Labeled (root) then
  18928.      IncrementToken (colonz);
  18929.   end if;
  18930.      
  18931.      
  18932.         Scan_body_block(as_block_body(Root));
  18933.       end if;
  18934.      
  18935.      
  18936.      if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  18937.          IncrementToken (semicolonz);
  18938.          ProcessBlockInfo (CurrentBlock);
  18939.          FreeSpace (CurrentBlock);
  18940.          BlockInfoStack.Pop(BlockStack, CurrentBlock);
  18941.          IncrementToken (declare_blockz);
  18942.      end if;
  18943.      block_stm_IH.R.ih_inblock := false;
  18944.      
  18945.      
  18946.      
  18947.         if  Kind(root) not in labeled_stmKind
  18948.         then
  18949.      
  18950.         if (not (Kind (root) in block_stmKind))
  18951.             or else
  18952.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  18953.             then
  18954.      
  18955.               -- If the root is not a block_stm or if it is then
  18956.               -- if it is not a block with declarations increment
  18957.               -- semicolon.
  18958.               -- This is because the semicolon associated with a declare
  18959.               -- block must be counted in that declare block. If we
  18960.               -- counted it here it would increment the count for the
  18961.               -- enclosing block.
  18962.          IncrementToken (semicolonz);
  18963.       end if;
  18964.      
  18965.         end if;
  18966.         block_stm_IH.R := Old_block_stm_IHR;
  18967.      
  18968.     end Scan_block_stm;
  18969.      
  18970.      
  18971.     procedure Scan_case_stm(Root : case_stmNode.Locator) is
  18972.         as_case_alternative_s_List : SeqOfcase_alternativeNode.Generator;
  18973.         as_case_alternative_s_Item : case_alternativeNode.Locator;
  18974.         use SeqOfcase_alternativeNode;
  18975.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  18976.     begin
  18977.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  18978.      
  18979.      
  18980.       IncrementToken (case_stmz);
  18981.       IncrementToken (case_stmz);
  18982.       IncrementToken (is_case_stmz);
  18983.       IncrementToken (end_case_stmz);
  18984.      
  18985.      
  18986.       if not NAME_EXP.IsNull(as_case_exp(Root)) then
  18987.         Scan_NAME_EXP(as_case_exp(Root));
  18988.       end if;
  18989.       if not SeqOfcase_alternativeNode.IsNull(as_case_alternative_s(Root)) then
  18990.         StartForward(as_case_alternative_s(Root), as_case_alternative_s_List);
  18991.         while not Finished(as_case_alternative_s_List) loop
  18992.             as_case_alternative_s_Item := Cell(as_case_alternative_s_List);
  18993.             Scan_case_alternative(as_case_alternative_s_Item);
  18994.             Forward(as_case_alternative_s_List);
  18995.         end loop;
  18996.         EndIterate(as_case_alternative_s_List);
  18997.       end if;
  18998.      
  18999.         if  Kind(root) not in labeled_stmKind
  19000.         then
  19001.      
  19002.         if (not (Kind (root) in block_stmKind))
  19003.             or else
  19004.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19005.             then
  19006.      
  19007.               -- If the root is not a block_stm or if it is then
  19008.               -- if it is not a block with declarations increment
  19009.               -- semicolon.
  19010.               -- This is because the semicolon associated with a declare
  19011.               -- block must be counted in that declare block. If we
  19012.               -- counted it here it would increment the count for the
  19013.               -- enclosing block.
  19014.          IncrementToken (semicolonz);
  19015.       end if;
  19016.      
  19017.         end if;
  19018.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  19019.      
  19020.     end Scan_case_stm;
  19021.      
  19022.      
  19023.     procedure Scan_code_stm(Root : code_stmNode.Locator) is
  19024.     begin
  19025.       if not qualifiedNode.IsNull(as_code_exp(Root)) then
  19026.         Scan_qualified(as_code_exp(Root));
  19027.       end if;
  19028.      
  19029.         if  Kind(root) not in labeled_stmKind
  19030.         then
  19031.      
  19032.         if (not (Kind (root) in block_stmKind))
  19033.             or else
  19034.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19035.             then
  19036.      
  19037.               -- If the root is not a block_stm or if it is then
  19038.               -- if it is not a block with declarations increment
  19039.               -- semicolon.
  19040.               -- This is because the semicolon associated with a declare
  19041.               -- block must be counted in that declare block. If we
  19042.               -- counted it here it would increment the count for the
  19043.               -- enclosing block.
  19044.          IncrementToken (semicolonz);
  19045.       end if;
  19046.      
  19047.         end if;
  19048.      
  19049.     end Scan_code_stm;
  19050.      
  19051.      
  19052.     procedure Scan_delay_stm(Root : delay_stmNode.Locator) is
  19053.     begin
  19054.      
  19055.      
  19056.        IncrementToken (delayz);
  19057.      
  19058.      
  19059.       if not NAME_EXP.IsNull(as_delay_exp(Root)) then
  19060.         Scan_NAME_EXP(as_delay_exp(Root));
  19061.       end if;
  19062.      
  19063.         if  Kind(root) not in labeled_stmKind
  19064.         then
  19065.      
  19066.         if (not (Kind (root) in block_stmKind))
  19067.             or else
  19068.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19069.             then
  19070.      
  19071.               -- If the root is not a block_stm or if it is then
  19072.               -- if it is not a block with declarations increment
  19073.               -- semicolon.
  19074.               -- This is because the semicolon associated with a declare
  19075.               -- block must be counted in that declare block. If we
  19076.               -- counted it here it would increment the count for the
  19077.               -- enclosing block.
  19078.          IncrementToken (semicolonz);
  19079.       end if;
  19080.      
  19081.         end if;
  19082.      
  19083.     end Scan_delay_stm;
  19084.      
  19085.      
  19086.     procedure Scan_exit_stm(Root : exit_stmNode.Locator) is
  19087.     begin
  19088.      
  19089.      
  19090.       IncrementToken (exitz);
  19091.      
  19092.      
  19093.       if not NAME_EXP.IsNull(as_exit_name_void(Root)) then
  19094.         Scan_NAME_EXP(as_exit_name_void(Root));
  19095.       end if;
  19096.       if not NAME_EXP.IsNull(as_exit_exp_void(Root)) then
  19097.      
  19098.      
  19099.       IncrementToken (when_exitz);
  19100.      
  19101.      
  19102.         Scan_NAME_EXP(as_exit_exp_void(Root));
  19103.       end if;
  19104.      
  19105.         if  Kind(root) not in labeled_stmKind
  19106.         then
  19107.      
  19108.         if (not (Kind (root) in block_stmKind))
  19109.             or else
  19110.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19111.             then
  19112.      
  19113.               -- If the root is not a block_stm or if it is then
  19114.               -- if it is not a block with declarations increment
  19115.               -- semicolon.
  19116.               -- This is because the semicolon associated with a declare
  19117.               -- block must be counted in that declare block. If we
  19118.               -- counted it here it would increment the count for the
  19119.               -- enclosing block.
  19120.          IncrementToken (semicolonz);
  19121.       end if;
  19122.      
  19123.         end if;
  19124.      
  19125.     end Scan_exit_stm;
  19126.      
  19127.      
  19128.     procedure Scan_goto_stm(Root : goto_stmNode.Locator) is
  19129.     begin
  19130.      
  19131.      
  19132.     IncrementToken (gotoz);
  19133.      
  19134.      
  19135.       if not NAME_EXP.IsNull(as_goto_name(Root)) then
  19136.         Scan_NAME_EXP(as_goto_name(Root));
  19137.       end if;
  19138.      
  19139.         if  Kind(root) not in labeled_stmKind
  19140.         then
  19141.      
  19142.         if (not (Kind (root) in block_stmKind))
  19143.             or else
  19144.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19145.             then
  19146.      
  19147.               -- If the root is not a block_stm or if it is then
  19148.               -- if it is not a block with declarations increment
  19149.               -- semicolon.
  19150.               -- This is because the semicolon associated with a declare
  19151.               -- block must be counted in that declare block. If we
  19152.               -- counted it here it would increment the count for the
  19153.               -- enclosing block.
  19154.          IncrementToken (semicolonz);
  19155.       end if;
  19156.      
  19157.         end if;
  19158.      
  19159.     end Scan_goto_stm;
  19160.      
  19161.      
  19162.     procedure Scan_if_stm(Root : if_stmNode.Locator) is
  19163.         as_if_list_List : SeqOfcond_alternativeNode.Generator;
  19164.         as_if_list_Item : cond_alternativeNode.Locator;
  19165.         use SeqOfcond_alternativeNode;
  19166.     begin
  19167.      
  19168.      
  19169.       IncrementToken (ifz);
  19170.       IncrementToken (ifz);
  19171.       IncrementToken (end_ifz);
  19172.      
  19173.      
  19174.       if not SeqOfcond_alternativeNode.IsNull(as_if_list(Root)) then
  19175.         StartForward(as_if_list(Root), as_if_list_List);
  19176.         while not Finished(as_if_list_List) loop
  19177.             as_if_list_Item := Cell(as_if_list_List);
  19178.             Scan_cond_alternative(as_if_list_Item);
  19179.             Forward(as_if_list_List);
  19180.         end loop;
  19181.         EndIterate(as_if_list_List);
  19182.       end if;
  19183.      
  19184.         if  Kind(root) not in labeled_stmKind
  19185.         then
  19186.      
  19187.         if (not (Kind (root) in block_stmKind))
  19188.             or else
  19189.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19190.             then
  19191.      
  19192.               -- If the root is not a block_stm or if it is then
  19193.               -- if it is not a block with declarations increment
  19194.               -- semicolon.
  19195.               -- This is because the semicolon associated with a declare
  19196.               -- block must be counted in that declare block. If we
  19197.               -- counted it here it would increment the count for the
  19198.               -- enclosing block.
  19199.          IncrementToken (semicolonz);
  19200.       end if;
  19201.      
  19202.         end if;
  19203.      
  19204.     end Scan_if_stm;
  19205.      
  19206.      
  19207.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator) is
  19208.         as_labeled_id_s_List : SeqOflabel_idNode.Generator;
  19209.         as_labeled_id_s_Item : label_idNode.Locator;
  19210.         use SeqOflabel_idNode;
  19211.     begin
  19212.      
  19213.      
  19214.       IncrementToken (open_anglesz);
  19215.      
  19216.      
  19217.       if not SeqOflabel_idNode.IsNull(as_labeled_id_s(Root)) then
  19218.         StartForward(as_labeled_id_s(Root), as_labeled_id_s_List);
  19219.         while not Finished(as_labeled_id_s_List) loop
  19220.             as_labeled_id_s_Item := Cell(as_labeled_id_s_List);
  19221.      
  19222.      
  19223.       if SERIES_UNIT_IH.R.ih_inlist then
  19224.           IncrementToken (open_anglesz);
  19225.           IncrementToken (closed_anglesz);
  19226.       end if;
  19227.       SERIES_UNIT_IH.R.ih_inlist := true;
  19228.      
  19229.      
  19230.             Scan_label_id(as_labeled_id_s_Item);
  19231.             Forward(as_labeled_id_s_List);
  19232.         end loop;
  19233.         EndIterate(as_labeled_id_s_List);
  19234.       end if;
  19235.       if not STM.IsNull(as_labeled_stm(Root)) then
  19236.         Scan_STM(as_labeled_stm(Root));
  19237.       end if;
  19238.      
  19239.      
  19240.       IncrementToken (closed_anglesz);
  19241.       SERIES_UNIT_IH.R.ih_inlist := false;
  19242.      
  19243.      
  19244.      
  19245.         if  Kind(root) not in labeled_stmKind
  19246.         then
  19247.      
  19248.         if (not (Kind (root) in block_stmKind))
  19249.             or else
  19250.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19251.             then
  19252.      
  19253.               -- If the root is not a block_stm or if it is then
  19254.               -- if it is not a block with declarations increment
  19255.               -- semicolon.
  19256.               -- This is because the semicolon associated with a declare
  19257.               -- block must be counted in that declare block. If we
  19258.               -- counted it here it would increment the count for the
  19259.               -- enclosing block.
  19260.          IncrementToken (semicolonz);
  19261.       end if;
  19262.      
  19263.         end if;
  19264.      
  19265.     end Scan_labeled_stm;
  19266.      
  19267.      
  19268.     procedure Scan_loop_stm(Root : loop_stmNode.Locator) is
  19269.         as_loop_stm_s_List : SeqOfSTM.Generator;
  19270.         as_loop_stm_s_Item : STM.Locator;
  19271.         use SeqOfSTM;
  19272.     begin
  19273.      
  19274.      
  19275.       IncrementToken (loopz);
  19276.       IncrementToken (loopz);
  19277.       IncrementToken (end_loopz);
  19278.      
  19279.      
  19280.       if not ITERATION.IsNull(as_iteration(Root)) then
  19281.         Scan_ITERATION(as_iteration(Root));
  19282.       end if;
  19283.       if not loop_idNode.IsNull(as_loop_label(Root)) then
  19284.         Scan_loop_id(as_loop_label(Root));
  19285.       end if;
  19286.       if not SeqOfSTM.IsNull(as_loop_stm_s(Root)) then
  19287.         StartForward(as_loop_stm_s(Root), as_loop_stm_s_List);
  19288.         while not Finished(as_loop_stm_s_List) loop
  19289.             as_loop_stm_s_Item := Cell(as_loop_stm_s_List);
  19290.             Scan_STM(as_loop_stm_s_Item);
  19291.             Forward(as_loop_stm_s_List);
  19292.         end loop;
  19293.         EndIterate(as_loop_stm_s_List);
  19294.       end if;
  19295.      
  19296.         if  Kind(root) not in labeled_stmKind
  19297.         then
  19298.      
  19299.         if (not (Kind (root) in block_stmKind))
  19300.             or else
  19301.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19302.             then
  19303.      
  19304.               -- If the root is not a block_stm or if it is then
  19305.               -- if it is not a block with declarations increment
  19306.               -- semicolon.
  19307.               -- This is because the semicolon associated with a declare
  19308.               -- block must be counted in that declare block. If we
  19309.               -- counted it here it would increment the count for the
  19310.               -- enclosing block.
  19311.          IncrementToken (semicolonz);
  19312.       end if;
  19313.      
  19314.         end if;
  19315.      
  19316.     end Scan_loop_stm;
  19317.      
  19318.      
  19319.     procedure Scan_null_stm(Root : null_stmNode.Locator) is
  19320.     begin
  19321.      
  19322.      
  19323.       IncrementToken (null_stmz);
  19324.      
  19325.      
  19326.      
  19327.         if  Kind(root) not in labeled_stmKind
  19328.         then
  19329.      
  19330.         if (not (Kind (root) in block_stmKind))
  19331.             or else
  19332.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19333.             then
  19334.      
  19335.               -- If the root is not a block_stm or if it is then
  19336.               -- if it is not a block with declarations increment
  19337.               -- semicolon.
  19338.               -- This is because the semicolon associated with a declare
  19339.               -- block must be counted in that declare block. If we
  19340.               -- counted it here it would increment the count for the
  19341.               -- enclosing block.
  19342.          IncrementToken (semicolonz);
  19343.       end if;
  19344.      
  19345.         end if;
  19346.      
  19347.     end Scan_null_stm;
  19348.      
  19349.      
  19350.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator) is
  19351.     begin
  19352.       if not pragma_declNode.IsNull(as_pragma(Root)) then
  19353.         Scan_pragma_decl(as_pragma(Root));
  19354.       end if;
  19355.      
  19356.         if  Kind(root) not in labeled_stmKind
  19357.         then
  19358.      
  19359.         if (not (Kind (root) in block_stmKind))
  19360.             or else
  19361.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19362.             then
  19363.      
  19364.               -- If the root is not a block_stm or if it is then
  19365.               -- if it is not a block with declarations increment
  19366.               -- semicolon.
  19367.               -- This is because the semicolon associated with a declare
  19368.               -- block must be counted in that declare block. If we
  19369.               -- counted it here it would increment the count for the
  19370.               -- enclosing block.
  19371.          IncrementToken (semicolonz);
  19372.       end if;
  19373.      
  19374.         end if;
  19375.      
  19376.     end Scan_pragma_stm;
  19377.      
  19378.      
  19379.     procedure Scan_raise_stm(Root : raise_stmNode.Locator) is
  19380.     begin
  19381.      
  19382.      
  19383.       IncrementToken (raisez);
  19384.      
  19385.      
  19386.       if not NAME_EXP.IsNull(as_raise_name_void(Root)) then
  19387.         Scan_NAME_EXP(as_raise_name_void(Root));
  19388.       end if;
  19389.      
  19390.         if  Kind(root) not in labeled_stmKind
  19391.         then
  19392.      
  19393.         if (not (Kind (root) in block_stmKind))
  19394.             or else
  19395.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19396.             then
  19397.      
  19398.               -- If the root is not a block_stm or if it is then
  19399.               -- if it is not a block with declarations increment
  19400.               -- semicolon.
  19401.               -- This is because the semicolon associated with a declare
  19402.               -- block must be counted in that declare block. If we
  19403.               -- counted it here it would increment the count for the
  19404.               -- enclosing block.
  19405.          IncrementToken (semicolonz);
  19406.       end if;
  19407.      
  19408.         end if;
  19409.      
  19410.     end Scan_raise_stm;
  19411.      
  19412.      
  19413.     procedure Scan_return_stm(Root : return_stmNode.Locator) is
  19414.     begin
  19415.      
  19416.      
  19417.       IncrementToken (returnz);
  19418.      
  19419.      
  19420.       if not NAME_EXP.IsNull(as_return_exp_void(Root)) then
  19421.         Scan_NAME_EXP(as_return_exp_void(Root));
  19422.       end if;
  19423.      
  19424.         if  Kind(root) not in labeled_stmKind
  19425.         then
  19426.      
  19427.         if (not (Kind (root) in block_stmKind))
  19428.             or else
  19429.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19430.             then
  19431.      
  19432.               -- If the root is not a block_stm or if it is then
  19433.               -- if it is not a block with declarations increment
  19434.               -- semicolon.
  19435.               -- This is because the semicolon associated with a declare
  19436.               -- block must be counted in that declare block. If we
  19437.               -- counted it here it would increment the count for the
  19438.               -- enclosing block.
  19439.          IncrementToken (semicolonz);
  19440.       end if;
  19441.      
  19442.         end if;
  19443.      
  19444.     end Scan_return_stm;
  19445.      
  19446.      
  19447.     procedure Scan_select_stm(Root : select_stmNode.Locator) is
  19448.         as_select_clause_s_List : SeqOfselect_alternativeNode.Generator;
  19449.         as_select_clause_s_Item : select_alternativeNode.Locator;
  19450.         use SeqOfselect_alternativeNode;
  19451.     begin
  19452.      
  19453.      
  19454.       IncrementToken (selectz);
  19455.       IncrementToken (selectz);
  19456.       IncrementToken (end_selectz);
  19457.      
  19458.      
  19459.       if not SeqOfselect_alternativeNode.IsNull(as_select_clause_s(Root)) then
  19460.         StartForward(as_select_clause_s(Root), as_select_clause_s_List);
  19461.         while not Finished(as_select_clause_s_List) loop
  19462.             as_select_clause_s_Item := Cell(as_select_clause_s_List);
  19463.      
  19464.      
  19465.      if SERIES_UNIT_IH.R.ih_inlist then
  19466.         IncrementToken (or_selectz);
  19467.      end if;
  19468.      SERIES_UNIT_IH.R.ih_inlist := true;
  19469.      
  19470.      
  19471.             Scan_select_alternative(as_select_clause_s_Item);
  19472.             Forward(as_select_clause_s_List);
  19473.         end loop;
  19474.         EndIterate(as_select_clause_s_List);
  19475.       end if;
  19476.       if not cond_alternativeNode.IsNull(as_select_else(Root)) then
  19477.         Scan_cond_alternative(as_select_else(Root));
  19478.      
  19479.      
  19480.       IncrementToken (elsez);
  19481.      
  19482.      
  19483.       end if;
  19484.      
  19485.      
  19486.      SERIES_UNIT_IH.R.ih_inlist := false;
  19487.      
  19488.      
  19489.      
  19490.         if  Kind(root) not in labeled_stmKind
  19491.         then
  19492.      
  19493.         if (not (Kind (root) in block_stmKind))
  19494.             or else
  19495.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19496.             then
  19497.      
  19498.               -- If the root is not a block_stm or if it is then
  19499.               -- if it is not a block with declarations increment
  19500.               -- semicolon.
  19501.               -- This is because the semicolon associated with a declare
  19502.               -- block must be counted in that declare block. If we
  19503.               -- counted it here it would increment the count for the
  19504.               -- enclosing block.
  19505.          IncrementToken (semicolonz);
  19506.       end if;
  19507.      
  19508.         end if;
  19509.      
  19510.     end Scan_select_stm;
  19511.      
  19512.      
  19513.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator) is
  19514.     begin
  19515.      
  19516.      
  19517.       IncrementToken (terminatez);
  19518.      
  19519.      
  19520.      
  19521.         if  Kind(root) not in labeled_stmKind
  19522.         then
  19523.      
  19524.         if (not (Kind (root) in block_stmKind))
  19525.             or else
  19526.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  19527.             then
  19528.      
  19529.               -- If the root is not a block_stm or if it is then
  19530.               -- if it is not a block with declarations increment
  19531.               -- semicolon.
  19532.               -- This is because the semicolon associated with a declare
  19533.               -- block must be counted in that declare block. If we
  19534.               -- counted it here it would increment the count for the
  19535.               -- enclosing block.
  19536.          IncrementToken (semicolonz);
  19537.       end if;
  19538.      
  19539.         end if;
  19540.      
  19541.     end Scan_terminate_stm;
  19542.      
  19543. end STM_Pkg;
  19544. -- End: SCSTM bdy -----------------------------------------------------
  19545. ::::::::::::::
  19546. scstm.spc
  19547. ::::::::::::::
  19548. -- Begin: SCSTM spc ---------------------------------------------------
  19549.      
  19550. with ST_DIANA; use ST_DIANA;
  19551.              package STM_Pkg is
  19552.     procedure Scan_STM(Root : STM.Locator);
  19553.     procedure Scan_CALL_STM(Root : CALL_STM.Locator);
  19554.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator);
  19555.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator);
  19556.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator);
  19557.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator);
  19558.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator);
  19559.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator);
  19560.     procedure Scan_abort_stm(Root : abort_stmNode.Locator);
  19561.     procedure Scan_accept_stm(Root : accept_stmNode.Locator);
  19562.     procedure Scan_assign_stm(Root : assign_stmNode.Locator);
  19563.     procedure Scan_block_stm(Root : block_stmNode.Locator);
  19564.     procedure Scan_case_stm(Root : case_stmNode.Locator);
  19565.     procedure Scan_code_stm(Root : code_stmNode.Locator);
  19566.     procedure Scan_delay_stm(Root : delay_stmNode.Locator);
  19567.     procedure Scan_exit_stm(Root : exit_stmNode.Locator);
  19568.     procedure Scan_goto_stm(Root : goto_stmNode.Locator);
  19569.     procedure Scan_if_stm(Root : if_stmNode.Locator);
  19570.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator);
  19571.     procedure Scan_loop_stm(Root : loop_stmNode.Locator);
  19572.     procedure Scan_null_stm(Root : null_stmNode.Locator);
  19573.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator);
  19574.     procedure Scan_raise_stm(Root : raise_stmNode.Locator);
  19575.     procedure Scan_return_stm(Root : return_stmNode.Locator);
  19576.     procedure Scan_select_stm(Root : select_stmNode.Locator);
  19577.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator);
  19578. end STM_Pkg;
  19579. -- End: SCSTM spc -----------------------------------------------------
  19580.      
  19581. ::::::::::::::
  19582. scsubp_de.bdy
  19583. ::::::::::::::
  19584. -- Begin: SCSUBP_DEF bdy ---------------------------------------------------
  19585.      
  19586. with Halstead_Data_Base;  use Halstead_Data_Base;
  19587. with Definitions; use Definitions;
  19588.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  19589. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  19590. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  19591. package body SUBP_DEF_Pkg is
  19592.      
  19593.      
  19594.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator) is
  19595.     begin
  19596.         case Kind(Root) is
  19597.           when FORMAL_SUBPKind => Scan_FORMAL_SUBP(Root);
  19598.           when subp_block_stubKind => Scan_subp_block_stub(Root);
  19599.           when subp_instantiationKind => Scan_subp_instantiation(Root);
  19600.           when subp_renameKind => Scan_subp_rename(Root);
  19601.           when others => null;
  19602.         end case;
  19603.     end Scan_SUBP_DEF;
  19604.      
  19605.      
  19606.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator) is
  19607.     begin
  19608.         case Kind(Root) is
  19609.           when formal_subp_boxKind => Scan_formal_subp_box(Root);
  19610.           when formal_subp_nameKind => Scan_formal_subp_name(Root);
  19611.           when others => null;
  19612.         end case;
  19613.     end Scan_FORMAL_SUBP;
  19614.      
  19615.      
  19616.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator) is
  19617.     begin
  19618.      
  19619.      
  19620.       IncrementToken (box_default_subpz);
  19621.      
  19622.      
  19623.      
  19624.     end Scan_formal_subp_box;
  19625.      
  19626.      
  19627.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator) is
  19628.     begin
  19629.      
  19630.      
  19631.      IncrementToken (is_procedurez);
  19632.      
  19633.      
  19634.      
  19635.     end Scan_formal_subp_name;
  19636.      
  19637.      
  19638.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator) is
  19639.     begin
  19640.       if not BLOCK_STUB.IsNull(as_subp_block_stub(Root)) then
  19641.         Scan_BLOCK_STUB(as_subp_block_stub(Root));
  19642.       end if;
  19643.      
  19644.      
  19645.      IncrementToken (semicolonz);
  19646.      
  19647.      
  19648.      
  19649.     end Scan_subp_block_stub;
  19650.      
  19651.      
  19652.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator) is
  19653.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  19654.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  19655.         use SeqOfGENERAL_ASSOC;
  19656.     begin
  19657.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  19658.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  19659.         while not Finished(as_generic_assoc_s_List) loop
  19660.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  19661.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  19662.             Forward(as_generic_assoc_s_List);
  19663.         end loop;
  19664.         EndIterate(as_generic_assoc_s_List);
  19665.       end if;
  19666.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  19667.      
  19668.      
  19669.       IncrementToken (is_procedurez);
  19670.       IncrementToken (new_generic_instz);
  19671.      
  19672.      
  19673.      
  19674.      
  19675.       IncrementToken (open_parenthesisz);
  19676.      
  19677.      
  19678.         Scan_NAME_EXP(as_instantiation_name(Root));
  19679.      
  19680.      
  19681.       IncrementToken (closed_parenthesisz);
  19682.      
  19683.      
  19684.       end if;
  19685.      
  19686.     end Scan_subp_instantiation;
  19687.      
  19688.      
  19689.     procedure Scan_subp_rename(Root : subp_renameNode.Locator) is
  19690.     begin
  19691.      
  19692.      
  19693.        IncrementToken (renamesz);
  19694.      
  19695.      
  19696.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  19697.         Scan_NAME_EXP(as_rename_name(Root));
  19698.       end if;
  19699.      
  19700.     end Scan_subp_rename;
  19701.      
  19702. end SUBP_DEF_Pkg;
  19703. -- End: SCSUBP_DEF bdy -----------------------------------------------------
  19704. ::::::::::::::
  19705. scsubp_de.spc
  19706. ::::::::::::::
  19707. -- Begin: SCSUBP_DEF spc ---------------------------------------------------
  19708.      
  19709. with ST_DIANA; use ST_DIANA;
  19710.              package SUBP_DEF_Pkg is
  19711.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator);
  19712.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator);
  19713.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator);
  19714.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator);
  19715.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator);
  19716.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator);
  19717.     procedure Scan_subp_rename(Root : subp_renameNode.Locator);
  19718. end SUBP_DEF_Pkg;
  19719. -- End: SCSUBP_DEF spc -----------------------------------------------------
  19720. ::::::::::::::
  19721. sctype_sp.bdy
  19722. ::::::::::::::
  19723. -- Begin: SCTYPE_SPEC bdy ---------------------------------------------------
  19724.      
  19725. with Halstead_Data_Base;  use Halstead_Data_Base;
  19726. with Definitions; use Definitions;
  19727.              with SERIES_UNIT_IH;
  19728. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  19729. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  19730. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  19731. with DEF_ID_Pkg; use DEF_ID_Pkg;
  19732. with ITEM_Pkg; use ITEM_Pkg;
  19733.      
  19734.    with task_decl_IH;
  19735.                          package body TYPE_SPEC_Pkg is
  19736.      
  19737.      
  19738.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator) is
  19739.     begin
  19740.         case Kind(Root) is
  19741.           when ARRAY_TYPEKind => Scan_ARRAY_TYPE(Root);
  19742.           when DSCRMT_TYPEKind => Scan_DSCRMT_TYPE(Root);
  19743.           when FORMAL_SCALARKind => Scan_FORMAL_SCALAR(Root);
  19744.           when access_typeKind => Scan_access_type(Root);
  19745.           when derived_typeKind => Scan_derived_type(Root);
  19746.           when enum_typeKind => Scan_enum_type(Root);
  19747.           when fixed_typeKind => Scan_fixed_type(Root);
  19748.           when float_typeKind => Scan_float_type(Root);
  19749.           when integer_typeKind => Scan_integer_type(Root);
  19750.           when task_specKind => Scan_task_spec(Root);
  19751.           when others => null;
  19752.         end case;
  19753.     end Scan_TYPE_SPEC;
  19754.      
  19755.      
  19756.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator) is
  19757.     begin
  19758.         case Kind(Root) is
  19759.           when constrained_array_typeKind => Scan_constrained_array_type(Root);
  19760.           when unconstrained_array_typeKind => Scan_unconstrained_array_type(Root);
  19761.           when others => null;
  19762.         end case;
  19763.     end Scan_ARRAY_TYPE;
  19764.      
  19765.      
  19766.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator) is
  19767.     begin
  19768.      
  19769.      
  19770.       IncrementToken (arrayz);
  19771.      
  19772.      
  19773.       if not index_constraintNode.IsNull(as_array_constraint(Root)) then
  19774.         Scan_index_constraint(as_array_constraint(Root));
  19775.       end if;
  19776.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  19777.      
  19778.      
  19779.      IncrementToken (ofz);
  19780.      
  19781.      
  19782.         Scan_object_type_constrained(as_component_constrained(Root));
  19783.       end if;
  19784.      
  19785.     end Scan_constrained_array_type;
  19786.      
  19787.      
  19788.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator) is
  19789.         as_index_list_List : SeqOfobject_type_indexNode.Generator;
  19790.         as_index_list_Item : object_type_indexNode.Locator;
  19791.         use SeqOfobject_type_indexNode;
  19792.     begin
  19793.      
  19794.      
  19795.       IncrementToken (arrayz);
  19796.      
  19797.      
  19798.       if not SeqOfobject_type_indexNode.IsNull(as_index_list(Root)) then
  19799.      
  19800.      
  19801.       IncrementToken (open_parenthesisz);
  19802.      
  19803.      
  19804.         StartForward(as_index_list(Root), as_index_list_List);
  19805.         while not Finished(as_index_list_List) loop
  19806.             as_index_list_Item := Cell(as_index_list_List);
  19807.      
  19808.      
  19809.       if SERIES_UNIT_IH.R.ih_inlist then
  19810.           IncrementToken (box_rangez);
  19811.           IncrementToken (commaz);
  19812.       end if;
  19813.       SERIES_UNIT_IH.R.ih_inlist := true;
  19814.      
  19815.      
  19816.             Scan_object_type_index(as_index_list_Item);
  19817.             Forward(as_index_list_List);
  19818.         end loop;
  19819.         EndIterate(as_index_list_List);
  19820.      
  19821.      
  19822.      IncrementToken (closed_parenthesisz);
  19823.      IncrementToken (box_rangez);
  19824.      SERIES_UNIT_IH.R.ih_inlist := false;
  19825.      
  19826.      
  19827.       end if;
  19828.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  19829.      
  19830.      
  19831.      IncrementToken (ofz);
  19832.      
  19833.      
  19834.         Scan_object_type_constrained(as_component_constrained(Root));
  19835.       end if;
  19836.      
  19837.     end Scan_unconstrained_array_type;
  19838.      
  19839.      
  19840.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator) is
  19841.     begin
  19842.         case Kind(Root) is
  19843.           when PRIV_TYPEKind => Scan_PRIV_TYPE(Root);
  19844.           when record_typeKind => Scan_record_type(Root);
  19845.           when others => null;
  19846.         end case;
  19847.     end Scan_DSCRMT_TYPE;
  19848.      
  19849.      
  19850.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator) is
  19851.     begin
  19852.         case Kind(Root) is
  19853.           when FORMAL_PRIVKind => Scan_FORMAL_PRIV(Root);
  19854.           when lim_priv_typeKind => Scan_lim_priv_type(Root);
  19855.           when nonlim_priv_typeKind => Scan_nonlim_priv_type(Root);
  19856.           when others => null;
  19857.         end case;
  19858.     end Scan_PRIV_TYPE;
  19859.      
  19860.      
  19861.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator) is
  19862.     begin
  19863.         case Kind(Root) is
  19864.           when generic_lim_priv_typeKind => Scan_generic_lim_priv_type(Root);
  19865.           when generic_priv_typeKind => Scan_generic_priv_type(Root);
  19866.           when others => null;
  19867.         end case;
  19868.     end Scan_FORMAL_PRIV;
  19869.      
  19870.      
  19871.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator) is
  19872.     begin
  19873.      
  19874.      
  19875.      IncrementToken (limitedz);
  19876.      IncrementToken (private_typez);
  19877.      
  19878.      
  19879.      
  19880.     end Scan_generic_lim_priv_type;
  19881.      
  19882.      
  19883.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator) is
  19884.     begin
  19885.      
  19886.      
  19887.      IncrementToken (private_typez);
  19888.      
  19889.      
  19890.      
  19891.     end Scan_generic_priv_type;
  19892.      
  19893.      
  19894.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator) is
  19895.     begin
  19896.      
  19897.      
  19898.     IncrementToken (limitedz);
  19899.     IncrementToken (private_typez);
  19900.      
  19901.      
  19902.      
  19903.     end Scan_lim_priv_type;
  19904.      
  19905.      
  19906.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator) is
  19907.     begin
  19908.      
  19909.      
  19910.     IncrementToken (private_typez);
  19911.      
  19912.      
  19913.      
  19914.     end Scan_nonlim_priv_type;
  19915.      
  19916.      
  19917.     procedure Scan_record_type(Root : record_typeNode.Locator) is
  19918.     begin
  19919.      
  19920.      
  19921.     IncrementToken (record_typez);
  19922.      
  19923.      
  19924.       if not inner_recordNode.IsNull(as_inner_record(Root)) then
  19925.         Scan_inner_record(as_inner_record(Root));
  19926.       end if;
  19927.      
  19928.      
  19929.     IncrementToken (end_recordz);
  19930.     IncrementToken (record_typez);
  19931.      
  19932.      
  19933.      
  19934.     end Scan_record_type;
  19935.      
  19936.      
  19937.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator) is
  19938.     begin
  19939.         case Kind(Root) is
  19940.           when formal_discreteKind => Scan_formal_discrete(Root);
  19941.           when formal_fixedKind => Scan_formal_fixed(Root);
  19942.           when formal_floatKind => Scan_formal_float(Root);
  19943.           when formal_integerKind => Scan_formal_integer(Root);
  19944.           when others => null;
  19945.         end case;
  19946.     end Scan_FORMAL_SCALAR;
  19947.      
  19948.      
  19949.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator) is
  19950.     begin
  19951.      
  19952.      
  19953.          IncrementToken (box_rangez);
  19954.      
  19955.      
  19956.      
  19957.      
  19958.       IncrementToken (open_parenthesisz);
  19959.       IncrementToken (closed_parenthesisz);
  19960.      
  19961.      
  19962.      
  19963.     end Scan_formal_discrete;
  19964.      
  19965.      
  19966.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator) is
  19967.     begin
  19968.      
  19969.      
  19970.          IncrementToken (box_rangez);
  19971.      
  19972.      
  19973.      
  19974.      
  19975.       IncrementToken (digitsz);
  19976.      
  19977.      
  19978.      
  19979.     end Scan_formal_fixed;
  19980.      
  19981.      
  19982.     procedure Scan_formal_float(Root : formal_floatNode.Locator) is
  19983.     begin
  19984.      
  19985.      
  19986.          IncrementToken (box_rangez);
  19987.      
  19988.      
  19989.      
  19990.      
  19991.       IncrementToken (deltaz);
  19992.      
  19993.      
  19994.      
  19995.     end Scan_formal_float;
  19996.      
  19997.      
  19998.     procedure Scan_formal_integer(Root : formal_integerNode.Locator) is
  19999.     begin
  20000.      
  20001.      
  20002.          IncrementToken (box_rangez);
  20003.      
  20004.      
  20005.      
  20006.      
  20007.      
  20008.      
  20009.      
  20010.     end Scan_formal_integer;
  20011.      
  20012.      
  20013.     procedure Scan_access_type(Root : access_typeNode.Locator) is
  20014.     begin
  20015.      
  20016.      
  20017.     IncrementToken (accessz);
  20018.      
  20019.      
  20020.       if not object_type_constrainedNode.IsNull(as_access_constrained(Root)) then
  20021.         Scan_object_type_constrained(as_access_constrained(Root));
  20022.       end if;
  20023.      
  20024.     end Scan_access_type;
  20025.      
  20026.      
  20027.     procedure Scan_derived_type(Root : derived_typeNode.Locator) is
  20028.     begin
  20029.      
  20030.      
  20031.      IncrementToken (new_derived_typez);
  20032.      
  20033.      
  20034.       if not object_type_constrainedNode.IsNull(as_parent_constrained(Root)) then
  20035.         Scan_object_type_constrained(as_parent_constrained(Root));
  20036.       end if;
  20037.      
  20038.     end Scan_derived_type;
  20039.      
  20040.      
  20041.     procedure Scan_enum_type(Root : enum_typeNode.Locator) is
  20042.         as_enumeral_s_List : SeqOfLITERAL_ID.Generator;
  20043.         as_enumeral_s_Item : LITERAL_ID.Locator;
  20044.         use SeqOfLITERAL_ID;
  20045.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  20046.     begin
  20047.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  20048.      
  20049.      
  20050.      IncrementToken (open_parenthesisz);
  20051.      
  20052.      
  20053.         StartForward(as_enumeral_s(Root), as_enumeral_s_List);
  20054.         while not Finished(as_enumeral_s_List) loop
  20055.             as_enumeral_s_Item := Cell(as_enumeral_s_List);
  20056.      
  20057.      
  20058.      if SERIES_UNIT_IH.R.ih_inlist then
  20059.          IncrementToken (commaz);
  20060.      end if;
  20061.      SERIES_UNIT_IH.R.ih_inlist := true;
  20062.      
  20063.      
  20064.             Scan_LITERAL_ID(as_enumeral_s_Item);
  20065.             Forward(as_enumeral_s_List);
  20066.         end loop;
  20067.         EndIterate(as_enumeral_s_List);
  20068.      
  20069.      
  20070.      IncrementToken (closed_parenthesisz);
  20071.      SERIES_UNIT_IH.R.ih_inlist := false;
  20072.      
  20073.      
  20074.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  20075.      
  20076.     end Scan_enum_type;
  20077.      
  20078.      
  20079.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator) is
  20080.     begin
  20081.      
  20082.      
  20083.      IncrementToken (deltaz);
  20084.      
  20085.      
  20086.       if not fixed_constraintNode.IsNull(as_fixed_constraint(Root)) then
  20087.         Scan_fixed_constraint(as_fixed_constraint(Root));
  20088.       end if;
  20089.      
  20090.     end Scan_fixed_type;
  20091.      
  20092.      
  20093.     procedure Scan_float_type(Root : float_typeNode.Locator) is
  20094.     begin
  20095.      
  20096.      
  20097.      IncrementToken (digitsz);
  20098.      
  20099.      
  20100.       if not float_constraintNode.IsNull(as_float_constraint(Root)) then
  20101.         Scan_float_constraint(as_float_constraint(Root));
  20102.       end if;
  20103.      
  20104.     end Scan_float_type;
  20105.      
  20106.      
  20107.     procedure Scan_integer_type(Root : integer_typeNode.Locator) is
  20108.     begin
  20109.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  20110.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  20111.       end if;
  20112.      
  20113.     end Scan_integer_type;
  20114.      
  20115.      
  20116.     procedure Scan_task_spec(Root : task_specNode.Locator) is
  20117.         as_task_spec_decl_s_List : SeqOfITEM.Generator;
  20118.         as_task_spec_decl_s_Item : ITEM.Locator;
  20119.         use SeqOfITEM;
  20120.     begin
  20121.      
  20122.      
  20123.     if not OuterMostBlockSeen then
  20124.         OuterMostBlockSeen := true;
  20125.     else
  20126.         BlockInfoStack.Push(BlockStack, CurrentBlock);
  20127.         CurrentBlock := InitializeCurrentBlock;
  20128.     end if;
  20129.     SetBlockId (lx_symrep (sm_def_of_type (root)),
  20130.                 task_body_block,
  20131.                 SpcId,
  20132.                 LineNumber (lx_srcpos (root))
  20133.                 );
  20134.     if not task_decl_IH.R.ih_intask_decl then
  20135.          -- If we are not in a task_decl and we are scanning task_spec
  20136.          -- then we are in a type_decl and the token type appears.
  20137.      
  20138.        IncrementToken (typez);
  20139.     end if;
  20140.     IncrementToken (task_spcz);
  20141.     IncrementToken (is_task_spcz);
  20142.     IncrementToken (end_task_spcz);
  20143.      
  20144.      
  20145.       if not SeqOfITEM.IsNull(as_task_spec_decl_s(Root)) then
  20146.         StartForward(as_task_spec_decl_s(Root), as_task_spec_decl_s_List);
  20147.         while not Finished(as_task_spec_decl_s_List) loop
  20148.             as_task_spec_decl_s_Item := Cell(as_task_spec_decl_s_List);
  20149.             Scan_ITEM(as_task_spec_decl_s_Item);
  20150.             Forward(as_task_spec_decl_s_List);
  20151.         end loop;
  20152.         EndIterate(as_task_spec_decl_s_List);
  20153.       end if;
  20154.      
  20155.      
  20156.   IncrementToken (semicolonz);
  20157.   ProcessBlockInfo (CurrentBlock);
  20158.   FreeSpace (CurrentBlock);
  20159.   BlockInfoStack.Pop(BlockStack, CurrentBlock);
  20160.      
  20161.      
  20162.      
  20163.     end Scan_task_spec;
  20164.      
  20165. end TYPE_SPEC_Pkg;
  20166. -- End: SCTYPE_SPEC bdy -----------------------------------------------------
  20167. ::::::::::::::
  20168. sctype_sp.spc
  20169. ::::::::::::::
  20170. -- Begin: SCTYPE_SPEC spc ---------------------------------------------------
  20171.      
  20172. with ST_DIANA; use ST_DIANA;
  20173.              package TYPE_SPEC_Pkg is
  20174.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator);
  20175.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator);
  20176.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator);
  20177.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator);
  20178.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator);
  20179.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator);
  20180.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator);
  20181.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator);
  20182.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator);
  20183.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator);
  20184.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator);
  20185.     procedure Scan_record_type(Root : record_typeNode.Locator);
  20186.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator);
  20187.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator);
  20188.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator);
  20189.     procedure Scan_formal_float(Root : formal_floatNode.Locator);
  20190.     procedure Scan_formal_integer(Root : formal_integerNode.Locator);
  20191.     procedure Scan_access_type(Root : access_typeNode.Locator);
  20192.     procedure Scan_derived_type(Root : derived_typeNode.Locator);
  20193.     procedure Scan_enum_type(Root : enum_typeNode.Locator);
  20194.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator);
  20195.     procedure Scan_float_type(Root : float_typeNode.Locator);
  20196.     procedure Scan_integer_type(Root : integer_typeNode.Locator);
  20197.     procedure Scan_task_spec(Root : task_specNode.Locator);
  20198. end TYPE_SPEC_Pkg;
  20199. -- End: SCTYPE_SPEC spc -----------------------------------------------------
  20200. ::::::::::::::
  20201. scvariant.bdy
  20202. ::::::::::::::
  20203. -- Begin: SCVARIANT_ALTERNATIVE_CLASS bdy ---------------------------------------------------
  20204.      
  20205. with Halstead_Data_Base;  use Halstead_Data_Base;
  20206. with Definitions; use Definitions;
  20207.              with ITEM_Pkg; use ITEM_Pkg;
  20208. with CHOICE_Pkg; use CHOICE_Pkg;
  20209. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  20210. package body VARIANT_ALTERNATIVE_CLASS_Pkg is
  20211.      
  20212.      
  20213.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator) is
  20214.     begin
  20215.         case Kind(Root) is
  20216.           when pragma_variantKind => Scan_pragma_variant(Root);
  20217.           when variant_alternativeKind => Scan_variant_alternative(Root);
  20218.           when others => null;
  20219.         end case;
  20220.     end Scan_VARIANT_ALTERNATIVE_CLASS;
  20221.      
  20222.      
  20223.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator) is
  20224.     begin
  20225.       if not pragma_declNode.IsNull(as_pragma_variant(Root)) then
  20226.         Scan_pragma_decl(as_pragma_variant(Root));
  20227.       end if;
  20228.      
  20229.     end Scan_pragma_variant;
  20230.      
  20231.      
  20232.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator) is
  20233.         as_variant_choice_s_List : SeqOfCHOICE.Generator;
  20234.         as_variant_choice_s_Item : CHOICE.Locator;
  20235.         use SeqOfCHOICE;
  20236.     begin
  20237.       if not SeqOfCHOICE.IsNull(as_variant_choice_s(Root)) then
  20238.      
  20239.      
  20240.      IncrementToken (when_case_variantz);
  20241.      
  20242.      
  20243.         StartForward(as_variant_choice_s(Root), as_variant_choice_s_List);
  20244.         while not Finished(as_variant_choice_s_List) loop
  20245.             as_variant_choice_s_Item := Cell(as_variant_choice_s_List);
  20246.             Scan_CHOICE(as_variant_choice_s_Item);
  20247.             Forward(as_variant_choice_s_List);
  20248.         end loop;
  20249.         EndIterate(as_variant_choice_s_List);
  20250.      
  20251.      
  20252.       IncrementToken (arrowz);
  20253.      
  20254.      
  20255.       end if;
  20256.       if not inner_recordNode.IsNull(as_record(Root)) then
  20257.         Scan_inner_record(as_record(Root));
  20258.       end if;
  20259.      
  20260.     end Scan_variant_alternative;
  20261.      
  20262. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  20263. -- End: SCVARIANT_ALTERNATIVE_CLASS bdy -----------------------------------------------------
  20264. ::::::::::::::
  20265. scvariant.spc
  20266. ::::::::::::::
  20267. -- Begin: SCVARIANT_ALTERNATIVE_CLASS spc ---------------------------------------------------
  20268.      
  20269. with ST_DIANA; use ST_DIANA;
  20270.              package VARIANT_ALTERNATIVE_CLASS_Pkg is
  20271.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator);
  20272.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator);
  20273.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator);
  20274. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  20275. -- End: SCVARIANT_ALTERNATIVE_CLASS spc -----------------------------------------------------
  20276. ::::::::::::::
  20277. srcutil.bdy
  20278. ::::::::::::::
  20279. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.bdy,v $
  20280. -- $Revision: 1.3 $ -- $Date: 85/12/15 18:29:03 $ -- $Author: buddy $
  20281.      
  20282. --pragma revision ("$Revision: 1.3 $");
  20283.      
  20284. package body Source_Position_Utilities is
  20285.      
  20286.     --| OVERVIEW
  20287.     --| This package creates one routine which checks if a
  20288.     --| MLSP.Source_Position is null.  This is helpful
  20289.     --| at some points in the program scan to determine which
  20290.     --| tokens the source program contained.
  20291.      
  20292.     --| NOTES
  20293.     --| This routine should be incorporated in Halstead_Data_Base
  20294.     --| when the world is recompiled.
  20295.      
  20296. --------------------------------------------------------------------------
  20297.      
  20298.     function Is_Srcpos_Null (
  20299.       Position :in    MLSP.Source_Position
  20300.     ) return boolean is
  20301.      
  20302.     begin
  20303.         return (MLSP."=" (Position.first_location, 0));
  20304.     end;
  20305. end Source_Position_Utilities;
  20306.      
  20307. ::::::::::::::
  20308. srcutil.spc
  20309. ::::::::::::::
  20310. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.spc,v $
  20311. -- $Revision: 1.1 $ -- $Date: 85/12/15 17:35:12 $ -- $Author: buddy $
  20312.      
  20313. --pragma revision ("$Revision: 1.1 $");
  20314.      
  20315. with ML_Source_Position_Pkg;
  20316. package Source_Position_Utilities is
  20317.      
  20318.     --| OVERVIEW
  20319.     --| This package creates one routine which checks if a
  20320.     --| MLSP.Source_Position is null.  This is helpful
  20321.     --| at some points in the program scan to determine which
  20322.     --| tokens the source program contained.
  20323.      
  20324.     --| NOTES
  20325.     --| This routine should be incorporated in Halstead_Data_Base
  20326.     --| when the world is recompiled.
  20327.      
  20328.     package MLSP renames ML_Source_Position_Pkg;
  20329.      
  20330. --------------------------------------------------------------------------
  20331.      
  20332.     function Is_Srcpos_Null (
  20333.       Position :in    MLSP.Source_Position
  20334.     ) return boolean;
  20335.      
  20336.     --| OVERVIEW
  20337.     --| This function returns true if the source position passed in
  20338.     --| is null.
  20339.      
  20340. end Source_Position_Utilities;
  20341.      
  20342. ::::::::::::::
  20343. hdb.bdy
  20344. ::::::::::::::
  20345. with Count_Types;
  20346. with Count;
  20347. with Text_IO; use Text_IO;
  20348. with Int_IO; use Int_IO;
  20349. with VmmTextPkg;
  20350. with Unchecked_Deallocation;
  20351. package body Halstead_Data_Base is
  20352.      
  20353. --| OVERVIEW
  20354. --| This package does all the counting and processing of the information
  20355. --| for a block.  It analyzes all the token information and determines
  20356. --| the number of unique operators and operands for the block.  It
  20357. --| scans the list of DEF_ID's in the block and determines whether
  20358. --| each DEF_ID is either an operator or operand. It also scans the
  20359. --| list of literals and determines the number of different literals
  20360. --| as well as the number of times each literal on the list has been
  20361. --| used.  The literals are all counted asoperands.
  20362. --|
  20363. --| Using the number of unique operands and operators all the Halstead
  20364. --| Metrics are computed.   The metrics are then displayed using the
  20365. --| procedure PrintInfo.
  20366.      
  20367. --------------------------------------------------------------------------
  20368. --                          LOCAL OBJECTS
  20369. --------------------------------------------------------------------------
  20370.      
  20371.     package C renames Count;
  20372.     package CT renames Count_Types;
  20373.      
  20374.     BlockKindLength            :constant :=   9;
  20375.     MaxLineLength              :constant :=  80;
  20376.     NumberOfMetrics            :constant :=  17;
  20377.     NumberOfLinesToClearScreen :constant :=   8;
  20378.     BlockStrings: array(BlockKind)
  20379.       of string(1..BlockKindLength) := ( "PROCEDURE",
  20380.                                          "FUNCTION ",
  20381.                                          "PACKAGE  ",
  20382.                                          "PACKAGE  ",
  20383.                                          "TASK     ",
  20384.                                          "TASK     ",
  20385.      
  20386.      -- The following string is used for declare blocks.  It is blank
  20387.      -- because of the DecId string in pkg Definitions.
  20388.      
  20389.                                          "         ");
  20390.       --| These are the strings which will be printed out in the output
  20391.       --| for the corresponding block type.
  20392.      
  20393.     StroudNumber :integer range 5..20 := 5;
  20394.       --| This number is used as a constant in the metric calculations.
  20395.      
  20396.     E0           :integer := 3000;
  20397.       --| Number of elementary  discriminations between errors.
  20398.      
  20399.     type Real is digits 6;
  20400.  
  20401.     type MetricsRecord is
  20402.         record
  20403.           UniqueOperators         :Float;
  20404.           UniqueOperands          :Float;
  20405.           Vocabulary              :Float;
  20406.           OperatorUsage           :Float;
  20407.           OperandUsage            :Float;
  20408.           ProgramLength           :Float;
  20409.           EstimatedProgramLength  :Float;
  20410.           ProgramVolume           :Float;
  20411.           PotentialVolume         :Float;
  20412.           ProgramLevel            :Float;
  20413.           ProgramLevelApprox      :Float;
  20414.           IntelligenceContent     :Float;
  20415.           ProgrammingEffort       :Float;
  20416.           ProgrammingTime         :Float;
  20417.           LanguageLevel           :Float;
  20418.           NumberOfDeliveredErrors :Float;
  20419.           ApproxNumberOfDeliveredErrors :Float;
  20420.         end record;
  20421.         --| Each field of this record corresponds to one of the 17
  20422.         --| Halstead metrics.
  20423.      
  20424. --------------------------------------------------------------------------
  20425. --           LOCAL SUBPROGRAMS
  20426. --------------------------------------------------------------------------
  20427.      
  20428. --------------------------------------------------------------------------
  20429.      
  20430.      procedure Free is new Unchecked_Deallocation (String, StringPtr);
  20431.      
  20432. --------------------------------------------------------------------------
  20433.      
  20434.     function SymRepToString (   --| Converts a SymRep to a string
  20435.           SymRep :in symbol_repNode.Locator
  20436.     ) return String is
  20437.      
  20438.     begin
  20439.         if symbol_repNode.IsNull (SymRep) then
  20440.             return "";
  20441.         else
  20442.             return VmmTextPkg.Value (
  20443.                      Source_Text.Value (
  20444.                        lx_text (
  20445.                          ne_normalized_symrep (
  20446.                            ne_symbol_entry_in_table (
  20447.                              SymRep)))));
  20448.         end if;
  20449.     end SymRepToString;
  20450.      
  20451. --------------------------------------------------------------------------
  20452.      
  20453.     function TruncateSymrep(
  20454.       symrep : symbol_repNode.Locator;
  20455.       length : natural
  20456.     ) return string is
  20457.         TempName : String(1 .. length) := (others => ' ');
  20458.     begin
  20459.         if TOKEN.IsNull (symrep) then
  20460.             return TempName;
  20461.         else
  20462.             declare
  20463.                 FullName : constant String :=SymRepToString (symrep);
  20464.                 size : constant Integer := FullName'length;
  20465.             begin
  20466.                 if size < length then
  20467.                     TempName(1 .. Size) := FullName(1 .. Size);
  20468.                 else
  20469.                     TempName := FullName(1 .. length);
  20470.                 end if;
  20471.                 return TempName;
  20472.             end;
  20473.         end if;
  20474.     end TruncateSymrep;
  20475.      
  20476.      
  20477. --------------------------------------------------------------------- ----
  20478.      
  20479.      
  20480.     procedure DEF_ID_Analysis (  -- This procedure counts and analyzes
  20481.                                  -- all the identifiers in the program as
  20482.                                  -- either operands or operators.
  20483.             SetOfDEF_IDs   :in     DEF_ID_Set.Set;
  20484.             Nn             :in out CT.NnInfoType;
  20485.             N2Star         :in out natural
  20486.     ) is
  20487.      
  20488.         Place          :DEF_ID_Set.SetIter;
  20489.         Member         :DEF_ID.Locator;
  20490.         package DIS renames DEF_ID_Set;
  20491.      
  20492.      
  20493.     begin
  20494.         --| OVERVIEW
  20495.         --| Walk over the SetOfDEF_IDs.  Each member in the set increments
  20496.         --| its class's Vocabulary by 1 and its class's Usage by the
  20497.         --| Countof the member.  The Kind of each member determines
  20498.         --| which class it is in either an operator, an operand or
  20499.         --| neither.
  20500.         --|
  20501.         --| Calculate N2Star by counting the number of parameters to
  20502.         --| the program unit.
  20503.      
  20504.         Place := DIS.MakeSetIter (SetOfDEF_IDs);
  20505.         while DIS.More (Place) loop
  20506.             DIS.Next (Place, Member);
  20507.             case Kind (Member) is
  20508.               when  ATTRIBUTE_IDKind | BUILT_IN_OPERATORKind |
  20509.                     GENERAL_TYPE_IDKind | pkg_idKind | PRAGMA_IDKind |
  20510.                     STM_IDKind | SUBP_IDKind | subtype_idKind |
  20511.                     task_body_idKind =>
  20512.      
  20513.                 Nn(operator).Vocabulary := Nn(operator).Vocabulary + 1;
  20514.                 Nn(operator).Usage :=
  20515.                   Nn(operator).Usage + DIS.GetCount (Place);
  20516.                 if VerboseOn then
  20517.                     Put (Standard_Output, "number of uses of ");
  20518.                     Put (Standard_Output,
  20519.                          SymRepToString (lx_symrep (Member)));
  20520.                     Put (Standard_Output, " ");
  20521.                     Put (Standard_Output,  AnyKind 'image (Kind (Member)));
  20522.                     Put (Standard_Output,  " equals ");
  20523.                     Put (Standard_Output, DIS.GetCount (Place));
  20524.                     Put (Standard_Output,  " operators ");
  20525.                     New_Line(Standard_Output);
  20526.                 end if;
  20527.      
  20528.               when LITERAL_IDKind | OBJECT_IDKind| argument_idKind |
  20529.                    exception_idKind | iteration_id | number_idKind =>
  20530.      
  20531.                  Nn(operand).Vocabulary := Nn(operand).Vocabulary + 1;
  20532.                  Nn(operand).Usage :=
  20533.                    Nn(operand).Usage + DIS.GetCount (Place);
  20534.                  if Kind (Member) in Param_idKind then
  20535.                      N2Star := N2Star + 1;
  20536.                  end if;
  20537.                  if VerboseOn then
  20538.                      Put (Standard_Output, "number of uses of ");
  20539.                      Put (Standard_Output,
  20540.                           SymRepToString (lx_symrep (Member)));
  20541.                      Put (Standard_Output, " which is a ");
  20542.                      Put (Standard_Output, AnyKind 'image (Kind (Member)));
  20543.                      Put (Standard_Output,  " equals ");
  20544.                      Put (Standard_Output,  DIS.GetCount (Place));
  20545.                      Put (Standard_Output,  " operands ");
  20546.                      New_Line (Standard_Output);
  20547.                  end if;
  20548.      
  20549.               when others =>
  20550.                 null;
  20551.      
  20552.             end case;
  20553.         end loop;
  20554.     end DEF_ID_Analysis;
  20555.      
  20556. --------------------------------------------------------------------------
  20557.      
  20558.     procedure Literal_Analysis (
  20559.                SetOfLiterals :in     Literal_Set.Set;
  20560.                Nn            :in out CT.NnInfoType
  20561.     ) is
  20562.         I      :Literal_Set.SetIter;
  20563.         Member :Source_Text.Locator;
  20564.         package LS renames Literal_Set;
  20565.      
  20566.     begin
  20567.         --| OVERVIEW
  20568.         --| Walk over SetOfLiterals.  Each member in the set increments
  20569.         --| the Vocabulary of the operands by one.  The count of each
  20570.         --| member in the set increments the Usage of operands by the
  20571.         --| count.
  20572.      
  20573.         I := LS.MakeSetIter (SetOfLiterals);
  20574.         Nn(operand).Vocabulary :=
  20575.           Nn(operand).Vocabulary + LS.Cardinality (SetOfLiterals);
  20576.         while LS.More (I) loop
  20577.             LS.Next (I, Member);
  20578.             Nn(operand).Usage := Nn(operand).Usage + LS.GetCount (I);
  20579.             if VerboseOn then
  20580.                 Put (Standard_Output, "the literal ");
  20581.                 Put (Standard_Output,
  20582.                      VmmTextPkg.Value (Source_Text.Value (Member)));
  20583.                 Put (Standard_Output, " appears ");
  20584.                 Put (Standard_Output, LS.GetCount(I));
  20585.                 Put (Standard_Output, " times ");
  20586.                 New_Line(Standard_Output);
  20587.             end if;
  20588.         end loop;
  20589.     end Literal_Analysis;
  20590.      
  20591. --------------------------------------------------------------------------
  20592.      
  20593.     function SeriesValue (  --| This function computes the ln (1 + x).
  20594.          X :in     Float
  20595.     ) return Float is
  20596.         N             :integer := 6;
  20597.         SumOfSeries   :Float;
  20598.         Fraction      :Float;
  20599.         LnOfTwo       :Float;
  20600.      
  20601.     begin
  20602.         --| OVERVIEW
  20603.         --|
  20604.         --|  The series for ln (1 + X) =
  20605.         --|
  20606.         --|  x - x**2/2 + x**3/3 - x**4/4 + x**5/5 ....
  20607.         --|
  20608.         --|  This is being factored inorder to save computations to be
  20609.         --|
  20610.         --|  x ( 1 + x(-1/2 + x(1/3 + x(-1/4 .....
  20611.         --|
  20612.         --|  This is being computed from inside out.
  20613.      
  20614.         LnOfTwo := 6931.0/10000.0;
  20615.         SumOfSeries := 0.0;
  20616.         for i in reverse 1..N loop
  20617.         Fraction := 1.0/Float(i);
  20618.             if (i mod 2) = 0 then
  20619.         SumOfSeries := SumOfSeries - Fraction;
  20620.             else
  20621.         SumOfSeries := SumOfSeries + Fraction;
  20622.             end if;
  20623.             SumOfSeries := SumOfSeries * X;
  20624.         end loop;
  20625.     SumOfSeries := SumOfSeries / LnOfTwo;
  20626.         return SumOfSeries;
  20627.  
  20628.     end SeriesValue;
  20629.      
  20630. --------------------------------------------------------------------------
  20631.      
  20632.     function Log2 (
  20633.           X :in     Float
  20634.     ) return Float is
  20635.         U_X              :Float;
  20636.         IntegerPart      :Float;
  20637.         LogForFraction   :Float;
  20638.         LowerBound       :Float;
  20639.         X_For_Series     :Float;
  20640.      
  20641.         InputOutOfBounds :exception;
  20642.      
  20643.     --| This computes the log2(X) by using the following method.
  20644.     --|
  20645.     --| First get the integer part of the log by testing when 2**n is
  20646.     --| greater than X.  The integer part of log2(X) is then n - 1.
  20647.     --|
  20648.     --| Then we calculate the fraction part of log2(x) by using the
  20649.     --| expression
  20650.     --|
  20651.     --| ln(1 + x) = x - x**2/2 + x**3/3 - x**4/4 .....
  20652.     --|
  20653.     --| Then by using the fact log2(x) = ln(X)/ln(2) we have log2(X).
  20654.     --|
  20655.     --| For example if x = 70
  20656.     --|
  20657.     --| log2 (70) = log2 (64 * 70/64) = 6 + log2(70/64)
  20658.     --|
  20659.     --| log2( 70/64 )= log2( 1 + 6/64) = ln(1 + 6/64) / ln(2)
  20660.     --|
  20661.     --| log2 (1 + 64/70) is calculated by the function SeriesValue
  20662.     --| when passed  (64/70).
  20663.      
  20664.     begin
  20665.      
  20666.      
  20667.        if X < 0.0 then
  20668.            raise InputOutOfBounds;
  20669.        else
  20670.       U_X := Float(Integer(X));
  20671.       LowerBound := 1.0;
  20672.       IntegerPart := 0.0;
  20673.       while 2.0 * LowerBound <= U_X loop
  20674.         IntegerPart := IntegerPart + 1.0;
  20675.         LowerBound := LowerBound * 2.0;
  20676.       end loop;
  20677.       if LowerBound = U_X then
  20678.                return IntegerPart;
  20679.       else
  20680.                  -- Following the example above at this point we compute
  20681.                  -- log2 (70/64) = log2 (1 + 6/64)
  20682.                  -- log2 (1 + 6/64) = SeriesValue (6/64).
  20683.                  -- U_X - LowerBound is in the example 70 - 64.  Therefore
  20684.                  -- (U_X - LowerBound) / LowerBound is 6/64.
  20685.      
  20686.       X_For_Series := (U_X - LowerBound)/LowerBound;
  20687.       LogForFraction := SeriesValue(X_For_Series);
  20688.       return IntegerPart + LogForFraction;
  20689.         end if;
  20690.     end if;
  20691.  
  20692. end Log2;
  20693.      
  20694. --------------------------------------------------------------------------
  20695.      
  20696. function Exp (           --| Raises the natural log e to the power X.
  20697.              X  :in    Float
  20698.     ) return Float is
  20699.          NumberOfIterations  :integer := 6;
  20700.                                --| Number of Iterations used to calculate
  20701.                                --| series.
  20702.          Series              :Float;
  20703.          Factorial           :Float;
  20704.     begin
  20705.     Series := 1.0;
  20706.         Factorial := 1.0;
  20707.         for i in 1..NumberOfIterations loop
  20708.                -- Caculate Factorial
  20709.              Factorial := Factorial * Float(i);
  20710.              Series := Series + ((X ** i) / Factorial);
  20711.         end loop;
  20712.         return Series;
  20713.  
  20714.     end Exp;
  20715.      
  20716. --------------------------------------------------------------------------
  20717.      
  20718.     function TwoThirdsPower ( --| Calculates X ** (2/3) by finding a
  20719.                               --| a Y such that X ** 2 = Y ** 3
  20720.          X  :in    Float
  20721.     ) return Float is
  20722.          Y         :float := 1.0;
  20723.          SquareX   :float;
  20724.          CubeY     :float;
  20725.          CubeDelta :float;
  20726.     begin
  20727.         --| OVERVIEW
  20728.         --| Y = x ** (2/3) ->
  20729.         --| Y**3 = X**2
  20730.         --|
  20731.         --| This function computes Y such that
  20732.         --| Y**3 <= X**2 is true.
  20733.      
  20734.         SquareX := X ** 2;
  20735.         CubeY := Y ** 3;
  20736.         CubeDelta := CubeY + ((3.0 * Y) * (Y + 1.0)) + 1.0;
  20737.           -- The following shows how to incremently compute (Y+1)**3 when
  20738.           -- Y **3 exists.
  20739.           --
  20740.           -- ((Y + 1) ** 3)  -   (Y**3) =
  20741.           -- Y**3 + 3Y**2 + 3Y + 1    - Y**3 =
  20742.           -- 3Y**2 + 3Y + 1 =
  20743.           -- 3Y(Y + 1) + 1
  20744.         while CubeY + CubeDelta < SquareX loop
  20745.             Y :=  Y + 1.0;
  20746.             CubeDelta :=  ((3.0 * Y) * (Y + 1.0)) + 1.0;
  20747.         end loop;
  20748.         return Y;
  20749.  
  20750.     end TwoThirdsPower;
  20751.      
  20752. --------------------------------------------------------------------------
  20753.      
  20754.     procedure CalcEstimatedProgramLength (
  20755.                                  --| Computes the estimated program length
  20756.                                  --| given the number of unique operators
  20757.                                  --| and operands.
  20758.              N1       :in     Float;  --| number of unique operators
  20759.              N2       :in     Float;  --| number of unique operands
  20760.              Result   :in out Float
  20761.     ) is
  20762.      
  20763.     begin
  20764.         Result := (N1 * log2(N1)) + (N2 * log2(N2));
  20765.  
  20766.     end CalcEstimatedProgramLength;
  20767.      
  20768. --------------------------------------------------------------------------
  20769.      
  20770.     procedure CalcProgramVolume (    --| Computes the program volume
  20771.                                 --| given the vocabulary.
  20772.              ProgramLength :in     Float;
  20773.              Vocabulary    :in     Float;
  20774.              Result        :in out Float
  20775.     ) is
  20776.      
  20777.     begin
  20778.         Result := ProgramLength * log2(Vocabulary);
  20779.  
  20780.     end CalcProgramVolume;
  20781.      
  20782. --------------------------------------------------------------------------
  20783.      
  20784.     procedure CalcPotentialVolume(
  20785.              N2Star :in     natural;   --| minimum number of input output
  20786.                                        --| parameters.
  20787.              Result :in out Float
  20788.     ) is
  20789.     begin
  20790.          Result := (2.0 + Float(N2Star)) * log2(2.0 + Float(N2Star));
  20791.  
  20792.     end CalcPotentialVolume;
  20793.      
  20794. --------------------------------------------------------------------------
  20795.      
  20796.     procedure CalcProgramLevel (
  20797.              VStar  :in     Float;
  20798.              V      :in     Float;
  20799.              Result :in out Float
  20800.     ) is
  20801.      
  20802.     begin
  20803.         Result := VStar / V;
  20804.      
  20805.     exception
  20806.         when Numeric_Error =>
  20807.             -- This catches the case when the denominator is 0.
  20808.       Result := 0.0;
  20809.      
  20810.     end CalcProgramLevel;
  20811.      
  20812. --------------------------------------------------------------------------
  20813.      
  20814.     procedure  CalcProgramLevelApprox( --| minimum number of operators,
  20815.                                        --| number of unique operators,
  20816.                                        --| number of unique operands
  20817.                                        --| and total number of operands.
  20818.       N1           :in     Float;
  20819.       N2Unique     :in     Float;
  20820.       N2Total      :in     Float;
  20821.       N1Star       :in     natural := 2;
  20822.                                        --| Minimum number of operators
  20823.                                        --| necessary
  20824.       Result       :in out Float
  20825.     ) is
  20826.      
  20827.     begin
  20828.         Result := Float(N1Star)/N1 * N2Unique * N2Total;
  20829.  
  20830.     exception
  20831.       when Numeric_Error =>
  20832.           -- This catches the case when the denominator is 0.
  20833.         Result := 0.0;
  20834.      
  20835.     end CalcProgramLevelApprox;
  20836.      
  20837. --------------------------------------------------------------------------
  20838.      
  20839.     procedure CalcIntelligenceContent (
  20840.         L_Approx :in     Float;
  20841.         V        :in     Float;
  20842.         Result   :in out Float
  20843.     ) is
  20844.     begin
  20845.       Result := L_Approx * V;
  20846.  
  20847.     end CalcIntelligenceContent;
  20848.      
  20849. --------------------------------------------------------------------------
  20850.      
  20851.     procedure CalcProgrammingEffort (
  20852.         V      :in     Float;
  20853.         L      :in     Float;
  20854.         Result :in out Float
  20855.      
  20856.     ) is
  20857.     begin
  20858.         Result := V / L;
  20859.  
  20860.     exception
  20861.         when Numeric_Error =>
  20862.             -- This catches the case when the denominator is 0.
  20863.         Result := 0.0;
  20864.      
  20865.     end CalcProgrammingEffort;
  20866.      
  20867. --------------------------------------------------------------------------
  20868.      
  20869.     procedure CalcProgrammingTime (
  20870.         E      :in     Float;
  20871.         S      :in     natural;      --| Stroud number.
  20872.         Result :in out Float
  20873.     ) is
  20874.     begin
  20875.     Result := E/Float(S);
  20876.  
  20877.     end CalcProgrammingTime;
  20878.      
  20879. --------------------------------------------------------------------------
  20880.      
  20881.     procedure CalcLanguageLevel (
  20882.        L      :in     Float;
  20883.        VStar  :in     Float;
  20884.        Result :in out Float
  20885.     ) is
  20886.      
  20887.     begin
  20888.         Result := L * VStar;
  20889.  
  20890.     end CalcLanguageLevel;
  20891.      
  20892. --------------------------------------------------------------------------
  20893.      
  20894.     procedure CalcNumberOfDeliveredErrors (
  20895.         E       :in     Float;
  20896.         E0      :in     natural;
  20897.         Result  :in out Float
  20898.     ) is
  20899.     begin
  20900.         -- E**(2/3) / E0
  20901.     Result := TwoThirdsPower(E) / Float(E0);
  20902.  
  20903.     end CalcNumberOfDeliveredErrors;
  20904.      
  20905. --------------------------------------------------------------------------
  20906.      
  20907.     procedure CalcApproxNumberOfDeliveredErrors (
  20908.          V      :in     Float;
  20909.          E0     :in    natural;
  20910.          Result :in out Float
  20911.     ) is
  20912.     begin
  20913.     Result := V / Float(E0);
  20914.  
  20915.     end CalcApproxNumberOfDeliveredErrors;
  20916.      
  20917. --------------------------------------------------------------------------
  20918.      
  20919.     procedure MetricCalculations (
  20920.       Nn       :in     CT.NnInfoType;
  20921.       N2Star   :in     natural;
  20922.       Metrics  :in out MetricsRecord
  20923.     ) is
  20924.      
  20925.     begin
  20926.       Metrics.UniqueOperators := Float(Nn(operator).Vocabulary);
  20927.       Metrics.UniqueOperands := Float(Nn(operand).Vocabulary);
  20928.       Metrics.OperandUsage := Float(Nn(operand).Usage);
  20929.       Metrics.OperatorUsage := Float(Nn(operator).Usage);
  20930.       Metrics.Vocabulary := Metrics.UniqueOperators + Metrics.UniqueOperands;
  20931.       Metrics.ProgramLength := Metrics.OperandUsage + Metrics.OperatorUsage;
  20932.       CalcEstimatedProgramLength(Metrics.UniqueOperators,
  20933.                                  Metrics.UniqueOperands,
  20934.                                  Metrics.EstimatedProgramLength);
  20935.       CalcProgramVolume(Metrics.ProgramLength,
  20936.                         Metrics.Vocabulary,
  20937.                         Metrics.ProgramVolume);
  20938.       CalcPotentialVolume(N2Star, Metrics.PotentialVolume);
  20939.       CalcProgramLevel(Metrics.PotentialVolume,
  20940.                        Metrics.ProgramVolume,
  20941.                        Metrics.ProgramLevel);
  20942.       CalcProgramLevelApprox(Metrics.UniqueOperators,
  20943.                              Metrics.UniqueOperands,
  20944.                              Metrics.OperandUsage,
  20945.                              Result => Metrics.ProgramLevelApprox);
  20946.       CalcIntelligenceContent(Metrics.ProgramLevelApprox,
  20947.                               Metrics.ProgramVolume,
  20948.                               Metrics.IntelligenceContent);
  20949.       CalcProgrammingEffort(Metrics.ProgramVolume,
  20950.                             Metrics.ProgramLevel,
  20951.                             Metrics.ProgrammingEffort);
  20952.       CalcProgrammingTime(Metrics.ProgrammingEffort,
  20953.                           StroudNumber,
  20954.                           Metrics.ProgrammingTime);
  20955.       CalcLanguageLevel(Metrics.ProgramLevel,
  20956.                         Metrics.PotentialVolume,
  20957.                         Metrics.LanguageLevel);
  20958.       CalcNumberOfDeliveredErrors(Metrics.ProgrammingEffort,
  20959.                                   E0,
  20960.                                   Metrics.NumberOfDeliveredErrors);
  20961.       CalcApproxNumberOfDeliveredErrors(
  20962.                          Metrics.ProgramVolume,
  20963.                          E0,
  20964.                          Metrics.ApproxNumberOfDeliveredErrors);
  20965.      
  20966.     end MetricCalculations;
  20967.      
  20968. -------------------------------------------------------------------------
  20969.      
  20970.     function Center (   --|This centers the string S in a buffer of blanks
  20971.                         --|whose width is Width.
  20972.       S      :in     String;
  20973.       Width  :in     positive
  20974.     ) return String is
  20975.         Result        :String(1..Width) := (others => ' ');
  20976.         Start         :positive;
  20977.         Finish        :positive;
  20978.         BufferToSmall :exception;
  20979.     begin
  20980.         Start := ((Result'length - S'length) / 2) + 1;
  20981.         Finish := Start + S'length - 1;
  20982.         if S'length > Width then
  20983.             raise BufferToSmall;
  20984.         else
  20985.             Result(Start..Finish) := S(S'range);
  20986.             return Result;
  20987.         end if;
  20988.     end Center;
  20989.      
  20990. --------------------------------------------------------------------------
  20991.      
  20992.     function RightJustify (  --| Right justify the string S in a buffer
  20993.                              --| whose width is Width.
  20994.       S      :in     String;
  20995.       Width  :in     positive
  20996.     ) return String is
  20997.         Result        :String(1..Width) := (others => ' ');
  20998.         Start         :positive;
  20999.         Finish        :positive;
  21000.         BufferToSmall :exception;
  21001.     begin
  21002.         if S'length > Width then
  21003.             raise BufferToSmall;
  21004.         else
  21005.             Start := (Result'length - S'length) + Result'first;
  21006.             Finish := Result'last;
  21007.             Result (Start..Finish) := S(S'range);
  21008.             return Result;
  21009.         end if;
  21010.     end RightJustify;
  21011.      
  21012. --------------------------------------------------------------------------
  21013.      
  21014.     function LeftJustify ( --| Left justify the string S in a buffer
  21015.                            --| of blanks whose width is Width.
  21016.       S      :in    String;
  21017.       Width  :in    positive
  21018.     ) return String is
  21019.         Finish        :positive;
  21020.         Result        :String (1..Width) := (others => ' ');
  21021.         BufferToSmall :exception;
  21022.     begin
  21023.         if S'length > Width then
  21024.             raise BufferToSmall;
  21025.         else
  21026.             Finish := Result'first + S'length - 1;
  21027.             Result (Result'first..Finish) := S(S'range);
  21028.             return Result;
  21029.         end if;
  21030.     end LeftJustify;
  21031.      
  21032. --------------------------------------------------------------------------
  21033.      
  21034.     function StripTrailingBlanks ( --| Remove all trailing blanks from
  21035.                                    --| a string.
  21036.                Token :in     String
  21037.     ) return String is
  21038.      
  21039.     begin
  21040.         for i in reverse Token'range loop
  21041.             if Token(i) /= ' ' then
  21042.                 -- ith character is not a blank so return
  21043.                 -- Token(Token'first..i)
  21044.                 return Token(Token'first..i);
  21045.             end if;
  21046.         end loop;
  21047.         return "";
  21048.     end StripTrailingBlanks;
  21049.      
  21050. --------------------------------------------------------------------------
  21051.      
  21052.     function IntTruncAndConvert (     --| Truncates and Converts an
  21053.                                       --| integer to a string of a given
  21054.                                       --| length.
  21055.       I     :in integer;
  21056.       Width :in integer
  21057.     ) return String is
  21058.      
  21059.         Result :constant String := integer'image(I);
  21060.     begin
  21061.         -- Since image returns a leading blank the number of
  21062.         -- digits in I is length'Result - 1
  21063.      
  21064.         if Result'length - 1 > Width then
  21065.             return Result(2..2 + Width - 1);
  21066.         else
  21067.             return Result(2..Result'length);
  21068.         end if;
  21069.     end IntTruncAndConvert;
  21070.      
  21071. --------------------------------------------------------------------------
  21072.      
  21073.     function Float_To_Int_Str (
  21074.       X  :in     Float
  21075.     ) return String is
  21076.     begin
  21077.         return Integer'Image(Integer(X));
  21078.  
  21079.     end Float_To_Int_Str;
  21080.      
  21081. --------------------------------------------------------------------------
  21082.      
  21083.     function FirstNonBlank (
  21084.       S :in    String
  21085.     ) return natural is
  21086.         Position :natural := S'first;
  21087.     begin
  21088.         while (S(Position) = ' ') and (Position <= S'last) loop
  21089.             Position := Position + 1;
  21090.         end loop;
  21091.         if Position in S'Range then
  21092.             return Position;
  21093.         else
  21094.             return 0;
  21095.         end if;
  21096.     end FirstNonBlank;
  21097.      
  21098. --------------------------------------------------------------------------
  21099.      
  21100.     function Float_To_Dec_Str (
  21101.       X  :in     Float
  21102.     ) return String is
  21103.         TimesX  :Float;
  21104.     begin
  21105.         --| OVERVIEW
  21106.         --| This function takes a Float and returns the image of the
  21107.         --| number in decimal notation.  The number it returns has two
  21108.         --| places to the right of the decimal point or if the number is
  21109.         --| an integer it leaves two blanks.
  21110.      
  21111.         if X < 0.01 then
  21112.             return "<0.01";
  21113.     elsif X > 1000000.0 then
  21114.             return ">1000000   ";
  21115.         end if;
  21116.      
  21117.         TimesX := X * 100.0;
  21118.         declare
  21119.             StrTimesX: constant String := Integer'Image(Integer(TimesX));
  21120.             Result            :String (1..StrTimesX'length + 1);
  21121.             FirstDigitPos     :positive;
  21122.             LastDigitPos      :positive;
  21123.             NumberOfDigits    :positive;
  21124.             DecimalFillSpaces :constant String := "   ";
  21125.               --| This ensures that there are three spaces to the right of
  21126.               --| ones places.  This keeps all the numbers in line.
  21127.         begin
  21128.             if Integer(TimesX) = 0 then
  21129.                 return "0" & DecimalFillSpaces ;
  21130.             else
  21131.                 FirstDigitPos := FirstNonBlank (StrTimesX);
  21132.                 NumberOfDigits := StrTimesX'last - FirstDigitPos + 1;
  21133.                 if StrTimesX(StrTimesX'last - 1..StrTimesx'Last) = "00"
  21134.                    then
  21135.                        return
  21136.                        StrTimesX(StrTimesX'First..StrTimesx'last - 2) &
  21137.                        DecimalFillSpaces;
  21138.                 end if;
  21139.      
  21140.                 case NumberOfDigits is
  21141.                   when 1 =>
  21142.                     Result(1..2) := ".0";
  21143.                     return Result(1..2) & StrTimesX (FirstDigitPos);
  21144.      
  21145.                   when 2 =>
  21146.                     Result(1) := '.';
  21147.                     Result(2..3) :=
  21148.                       StrTimesX
  21149.                        (FirstDigitPos..FirstDigitPos + NumberOfDigits -1);
  21150.                     return Result (1..3);
  21151.      
  21152.                   when others =>
  21153.                     LastDigitPos := FirstDigitPos + NumberOfDigits - 1;
  21154.                     Result(1..NumberOfDigits - 2) :=
  21155.                       StrTimesX (FirstDigitPos..LastDigitPos - 2);
  21156.                     Result(NumberOfDigits - 2  + 1) := '.';
  21157.                     Result(NumberOfDigits..NumberOfDigits + 1) :=
  21158.                       StrTimesX (LastDigitPos - 1..LastDigitPos);
  21159.                     return Result (1..NumberOfDigits + 1);
  21160.      
  21161.                 end case;
  21162.             end if;
  21163.         end;
  21164.     end Float_To_Dec_Str;
  21165.      
  21166. --------------------------------------------------------------------------
  21167.      
  21168.     procedure InsertInBuffer (  --| Insert the string "Insert" into Buffer
  21169.                                 --| preceeding a right Justified Field
  21170.                                 --| and a field which may have to be
  21171.                                 --| truncated with at least one blank.
  21172.                                 --| A left justified field does not have
  21173.                                 --| a blank preceeding it.
  21174.        Buffer       :in out String;
  21175.        Insert       :in     String;
  21176.        StartPos     :in     positive;
  21177.        EndPos       :in     positive
  21178.    ) is
  21179.    begin
  21180.        Buffer (StartPos..EndPos) := Insert(Insert'Range);
  21181.    end InsertInBuffer;
  21182.      
  21183. --------------------------------------------------------------------------
  21184.      
  21185.     procedure PrintBlockId (  --| This procedure prints the identifying
  21186.                               --| information for a block when producing
  21187.                               --| the report.
  21188.       BlockId: in    BlockIdType
  21189.     ) is
  21190.     begin
  21191.          --| OVERVIEW
  21192.          --| This prints
  21193.          --|   1.  the kind of block
  21194.          --|   2.  whether the block is a spec or body
  21195.          --|   3.  the name of the block
  21196.          --|   4.  the line number where the block appears in the source
  21197.      
  21198.          --| ALGORITHM
  21199.          --| Check if this is a declare block which is unnamed.  If it is
  21200.          --| then process it differently.
  21201.      
  21202.          if BlockId.KindOfBlock = Definitions.declare_block
  21203.             and then
  21204.             BlockId.BlockName.all(
  21205.               BlockId.BlockName.all'first..BlockId.BlockName.all'last
  21206.                                  )= ""
  21207.          then
  21208.             Put ("UNNAMED DECLARE BLOCK");
  21209.          else
  21210.             Put (StripTrailingBlanks (BlockStrings(BlockId.KindOfBlock)));
  21211.             Put (" ");
  21212.             Put (StripTrailingBlanks (BlockId.SpcBdyId));
  21213.             Put (" OF ");
  21214.             Put (
  21215.               BlockId.BlockName.all(
  21216.                 BlockId.BlockName.all'first..BlockId.BlockName.all'last
  21217.                                    )
  21218.                 );
  21219.          end if;
  21220.          Put (" AT LINE ");
  21221.          Put (BlockId.LineLocation);
  21222.          New_Line (Spacing => 2);
  21223.     end PrintBlockId;
  21224.      
  21225. --------------------------------------------------------------------------
  21226.      
  21227.     procedure PrintInfo (
  21228.       BlockId: in    BlockIdType;
  21229.       Metrics: in    MetricsRecord
  21230.     ) is
  21231.       subtype BufferType is String (1..MaxLineLength);
  21232.       Output       :BufferType;
  21233.       Blanks       :BufferType := (others => ' ');
  21234.       LabelLength  :constant positive := 20;
  21235.       subtype LabelType is String (1..LabelLength);
  21236.       subtype Metric_Index is natural range 1..NumberOfMetrics + 1;
  21237.       MetricLabels :constant array (Metric_Index) of LabelType:=
  21238.                           ( "UNIQUE OPERATORS    ",
  21239.                             "UNIQUE OPERANDS     ",
  21240.                             "TOTAL OPERATORS     ",
  21241.                             "TOTAL OPERANDS      ",
  21242.                             "VOCABULARY          ",
  21243.                             "                    ",
  21244.                             "PROGRAM LENGTH      ",
  21245.                             "ESTIMATED LENGTH    ",
  21246.                             "PROGRAM VOLUME      ",
  21247.                             "POTENTIAL VOLUME    ",
  21248.                             "PROGRAM LEVEL       ",
  21249.                             "ESTIMATED LEVEL     ",
  21250.                             "INTELLIGENCE CONTENT",
  21251.                             "PROGRAMMING EFFORT  ",
  21252.                             "PROGRAMMING TIME    ",
  21253.                             "LANGUAGE LEVEL      ",
  21254.                             "DELIVERED ERRORS    ",
  21255.                             "ESTIMATED ERRORS    "
  21256.                             );
  21257.            --| This array has one extra space for a metric.  This is
  21258.            --| to make producing the report easier.
  21259.      
  21260.     subtype metric_range is integer range 1..NumberOfMetrics + 1;
  21261.          ProcessArray     :array (metric_Range) of Float;
  21262.            --| This array has one extra space for a metric.  This is
  21263.            --| to make producing the report easier.
  21264.      
  21265.          NumberOfMetricLines :constant positive := 9;
  21266.          FirstColValueField  :positive; -- := LabelLength + 2;
  21267.          FirstCol            :constant positive := 1;
  21268.          EndFirstCol         :constant positive := 38;
  21269.          SecondCol           :constant positive := 41;
  21270.          EndSecondCol        :constant positive  := 80;
  21271.          SecondColValueField :positive; -- := SecondCol+LabelLength+2- 1;
  21272.          i                   :integer;
  21273.    begin
  21274.         --| OVERVIEW
  21275.         --| This procedure produces the report for a block. The format of
  21276.         --| the report is the following:
  21277.         --|
  21278.         --|---------------------------------------------------------------
  21279.         --|        HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF LIBRARY UNIT C36205D
  21280.         --|
  21281.         --|
  21282.         --| PROCEDURE SPECIFICATION OF C36205D AT LINE 12
  21283.         --|
  21284.         --| UNIQUE OPERATORS                  5     UNIQUE OPERANDS                    <0.01
  21285.         --| TOTAL OPERATORS                   6     TOTAL OPERANDS                     <0.01
  21286.         --| VOCABULARY                        5
  21287.         --| PROGRAM LENGTH                    6     ESTIMATED LENGTH                   11.61
  21288.         --| PROGRAM VOLUME                   13.93  POTENTIAL VOLUME                    2
  21289.         --| PROGRAM LEVEL                      .14  ESTIMATED LEVEL                    <0.01
  21290.         --| INTELLIGENCE CONTENT             <0.01  PROGRAMMING EFFORT                 97.06
  21291.         --| PROGRAMMING TIME                 19.41  LANGUAGE LEVEL                       .29
  21292.         --| DELIVERED ERRORS                 <0.01  ESTIMATED ERRORS                   <0.01
  21293.         --|
  21294.         --|---------------------------------------------------------------
  21295.         --| The object FirstCol refers to the labels on the left hand side
  21296.         --| of the report.  These are UNIQUE OPERATORS, TOTAL OPERATORS
  21297.         --| and so on.  FirstColValueField is the refers to the leftmost
  21298.         --| position of the field where the numbers appear.
  21299.         --| The object SecondCol refers to the leftmost position of the
  21300.         --| labels for the second column.  These are UNIQUE OPERANDS,
  21301.         --| TOTAL OPERANDS and so forth.  SecondColValueField refers to
  21302.         --| the leftmost position of the value field.  In this report
  21303.         --| are left justified  or right justified in relation to a field.
  21304.      
  21305.         FirstColValueField := LabelLength + 2;
  21306.         SecondColValueField := SecondCol + LabelLength + 2 - 1;
  21307.         PrintBlockId (BlockId);
  21308.         ProcessArray(1) := Metrics.UniqueOperators;
  21309.         ProcessArray(2) := Metrics.UniqueOperands;
  21310.         ProcessArray(3) := Metrics.OperatorUsage;
  21311.         ProcessArray(4) := Metrics.OperandUsage;
  21312.         ProcessArray(5) := Metrics.Vocabulary;
  21313.         ProcessArray(6) := 0.0;
  21314.         ProcessArray(7) := Metrics.ProgramLength;
  21315.         ProcessArray(8) := Metrics.EstimatedProgramLength;
  21316.         ProcessArray(9) := Metrics.ProgramVolume;
  21317.         ProcessArray(10) := Metrics.PotentialVolume;
  21318.         ProcessArray(11) := Metrics.ProgramLevel;
  21319.         ProcessArray(12) := Metrics.ProgramLevelApprox;
  21320.         ProcessArray(13) := Metrics.IntelligenceContent;
  21321.         ProcessArray(14) := Metrics.ProgrammingEffort;
  21322.         ProcessArray(15) := Metrics.ProgrammingTime;
  21323.         ProcessArray(16) := Metrics.LanguageLevel;
  21324.         ProcessArray(17) := Metrics.NumberOfDeliveredErrors;
  21325.         ProcessArray(18) := Metrics.ApproxNumberOfDeliveredErrors;
  21326.         Output := Blanks;
  21327.         for j in 1..NumberOfMetricLines loop
  21328.             i := (j * 2) - 1;
  21329.             InsertInBuffer (Output,
  21330.                             MetricLabels(i),
  21331.                             FirstCol,
  21332.                             LabelLength);
  21333.             InsertInBuffer (Output,
  21334.                             RightJustify (
  21335.                                  Float_To_Dec_Str (ProcessArray(i)),
  21336.                                  EndFirstCol - FirstColValueField + 1
  21337.                                          ),
  21338.                             FirstColValueField,
  21339.                             EndFirstCol);
  21340.      
  21341.               -- Only do the following if i is not equal to 5 because
  21342.               -- if i equals 5 then we are processing the third line
  21343.               -- which doesn't have a second column so skip it.
  21344.             if i /= 5 then
  21345.                  InsertInBuffer (Output,
  21346.                                  MetricLabels(i + 1),
  21347.                                  SecondCol,
  21348.                                  SecondCol + LabelLength - 1);
  21349.                  InsertInBuffer (Output,
  21350.                                  RightJustify (
  21351.                                   Float_To_Dec_Str (ProcessArray(i + 1) ),
  21352.                                   EndSecondCol - SecondColValueField + 1
  21353.                                               ),
  21354.                                  SecondColValueField,
  21355.                                  EndSecondCol);
  21356.             end if;
  21357.             Put_Line (Output);
  21358.             Output := Blanks;
  21359.         end loop;
  21360.      
  21361.           -- Clear screen if printing to terminal.
  21362.           -- If writing to a file add two lines of spacing.
  21363.      
  21364.         if ToTerminal then
  21365.            New_Line (Spacing => NumberOfLinesToClearScreen);
  21366.         else
  21367.            New_Line (Spacing => 2);
  21368.         end if;
  21369.     end PrintInfo;
  21370.      
  21371. --------------------------------------------------------------------------
  21372.      
  21373.     function CopyQualifiedName (
  21374.       FullyQualifiedName :in      StringPtr
  21375.     ) return StringPtr is
  21376.      
  21377.     begin
  21378.         return new String ' (FullyQualifiedName.all);
  21379.  
  21380.     end CopyQualifiedName;
  21381.      
  21382. --------------------------------------------------------------------------
  21383.      
  21384. procedure ExtendQualifiedName (
  21385.                QualifiedName     :in out StringPtr;
  21386.                Extension         :in     String
  21387. ) is
  21388.      
  21389.   --| ALGORITHM
  21390.   --| Concatentate FullyQualifiedName with "." and the Extension
  21391.   --| then return the access to this.  Free the space used by the
  21392.   --| QualifiedName.
  21393.      
  21394. begin
  21395.     if Extension /= "" then
  21396.         if QualifiedName.all /= "" then
  21397.             QualifiedName :=
  21398.             new String ' (QualifiedName.all & "." & Extension);
  21399.         else
  21400.             QualifiedName := new String ' (Extension);
  21401.         end if;
  21402.     end if;
  21403. end ExtendQualifiedName;
  21404.      
  21405. --------------------------------------------------------------------------
  21406.      
  21407. procedure TruncateQualifiedName (
  21408.                FullyQualifiedName     :in out StringPtr
  21409. ) is
  21410.      
  21411.   --| ALGORITHM
  21412.   --| Remove the last qualification from FullyQualifiedName.
  21413.   --| When changing FullyQualifiedName free the space used by the
  21414.   --| old value.
  21415.      
  21416.     Trash :StringPtr := FullyQualifiedName;
  21417. begin
  21418.     for i in reverse FullyQualifiedName.all'range  loop
  21419.         if FullyQualifiedName(i) = '.' then
  21420.            FullyQualifiedName :=  new String '
  21421.              (FullyQualifiedName(FullyQualifiedName.all'first..i-1));
  21422.            Free (Trash);
  21423.            return;
  21424.         end if;
  21425.     end loop;
  21426.     Free (Trash);
  21427.     FullyQualifiedName := new String ' ("");
  21428. end TruncateQualifiedName;
  21429.      
  21430. --------------------------------------------------------------------------
  21431.      
  21432.      
  21433. --------------------------------------------------------------------------
  21434. --                          VISIBLE SUBPROGRAMS
  21435. --------------------------------------------------------------------------
  21436.      
  21437.      
  21438. --------------------------------------------------------------------------
  21439.      
  21440.    procedure ReportHeader (
  21441.      UnitName : String;
  21442.      Spec     : boolean
  21443.    ) is
  21444.    begin
  21445.       if Spec then
  21446.           Put_Line (
  21447.              Center  (
  21448.                   "HALSTEAD COMPLEXITY FOR THE SPECIFICATION OF" &
  21449.                   " LIBRARY UNIT " & UnitName,
  21450.                    MaxLineLength
  21451.                      )
  21452.      
  21453.               );
  21454.       else
  21455.           Put_Line (
  21456.           Center ("HALSTEAD COMPLEXITY FOR THE BODY OF LIBRARY UNIT " &
  21457.                   UnitName,
  21458.                    MaxLineLength
  21459.                  )
  21460.               );
  21461.       end if;
  21462.       New_Line (Spacing => 2);
  21463.    end ReportHeader;
  21464.      
  21465. --------------------------------------------------------------------------
  21466.      
  21467.    procedure InitializeData (
  21468.        LibraryUnit          :in     String;
  21469.        IsUnitSpec           :in     boolean;
  21470.        VerboseFlag          :in     boolean;
  21471.        ToTerminalFlag       :in     boolean;
  21472.        OuterMostBlockFlag   :in     boolean
  21473.    ) is
  21474.    begin
  21475.      
  21476.        UnitName := new String ' (LibraryUnit(LibraryUnit'range));
  21477.        FullyQualifiedName := new String ' ("");
  21478.        UnitSpec := IsUnitSpec;
  21479.        VerboseOn := VerboseFlag;
  21480.        ToTerminal := ToTerminalFlag;
  21481.        OuterMostBlockSeen := OuterMostBlockFlag;
  21482.        if ToTerminal then
  21483.            New_Page;
  21484.        end if;
  21485.    end InitializeData;
  21486.      
  21487. --------------------------------------------------------------------------
  21488.      
  21489.     procedure IncrementToken (
  21490.       T :in     TokenItem
  21491.     ) is
  21492.      
  21493.     begin
  21494.         CurrentBlock.TokenCount(T) := CurrentBlock.TokenCount(T) + 1;
  21495.     end IncrementToken;
  21496.      
  21497. --------------------------------------------------------------------------
  21498.      
  21499.     procedure FreeSpace (
  21500.       CurrentBlock :in out BlockInfoType
  21501.     ) is
  21502.     begin
  21503.         Literal_Set.Destroy (CurrentBlock.SetOfLiterals);
  21504.         DEF_ID_Set.Destroy (CurrentBlock.SetOfDEF_IDs);
  21505.     end FreeSpace;
  21506.      
  21507.      
  21508. --------------------------------------------------------------------------
  21509.      
  21510.     function InitializeCurrentBlock return BlockInfoType is
  21511.         ClearedBlock :BlockInfoType;
  21512.     begin
  21513.         for t in TokenItem loop
  21514.             ClearedBlock.TokenCount(t) := 0;
  21515.         end loop;
  21516.         ClearedBlock.BlockId.BlockName := null;
  21517.         ClearedBlock.BlockId.KindOfBlock := declare_block;
  21518.         ClearedBlock.BlockId.SpcBdyId := AnonId;
  21519.         ClearedBlock.SetOfLiterals := Literal_Set.Create;
  21520.         ClearedBlock.SetOfDEF_IDs := DEF_ID_Set.Create;
  21521.         return ClearedBlock;
  21522.     end InitializeCurrentBlock;
  21523.      
  21524. --------------------------------------------------------------------------
  21525.      
  21526.     function LineNumber (
  21527.                    Position      :in     MLSP.Source_Position
  21528.     ) return MLSP.Source_Line is
  21529.      
  21530.         -- Get the line number of Position.
  21531.     begin
  21532.         return MLSP.Line (Position.first_location);
  21533.     end LineNumber;
  21534.      
  21535. --------------------------------------------------------------------------
  21536.      
  21537.      
  21538.     function IsSourceRange (
  21539.                    Position :in     MLSP.Source_Position
  21540.     ) return boolean is
  21541.      
  21542.          --| ALGORITHM
  21543.          --| If Position.first_position /= Position.last_position then
  21544.          --|    Position is a range and return true
  21545.          --| else
  21546.          --|    Position is not a range and return false
  21547.      
  21548.     begin
  21549.      return
  21550.           not MLSP."=" (Position.first_location, Position.last_location);
  21551.     end;
  21552.      
  21553. --------------------------------------------------------------------------
  21554.      
  21555.     procedure SetBlockId (
  21556.       ScopeName    :in    Symbol_repNode.Locator;
  21557.       KindOfBlock  :in    BlockKind;
  21558.       SpcBdyId     :in    SpcBdyIdType;
  21559.       Line_Number  :in    MLSP.Source_Line
  21560.     ) is
  21561.     begin
  21562.           -- If the ScopeName is "" then we have an unamed declare block.
  21563.         if SymRepToString (ScopeName) = "" then
  21564.             CurrentBlock.BlockId.BlockName := new  String ' ("");
  21565.         else
  21566.             ExtendQualifiedName (
  21567.               FullyQualifiedName, SymRepToString (ScopeName)
  21568.                                 );
  21569.             CurrentBlock.BlockId.BlockName :=
  21570.               CopyQualifiedName (FullyQualifiedName);
  21571.         end if;
  21572.         CurrentBlock.BlockId.KindOfBlock := KindOfBlock;
  21573.         CurrentBlock.BlockId.SpcBdyId := SpcBdyId;
  21574.         CurrentBlock.BlockId.LineLocation := Line_Number;
  21575.      
  21576.     end SetBlockId;
  21577.      
  21578. --------------------------------------------------------------------------
  21579.      
  21580.     procedure ProcessBlockInfo (
  21581.       BlockInfo: in BlockInfoType
  21582.     ) is
  21583.         Nn      :CT.NnInfoType;
  21584.           --| The counts in Nn represent the counts of operators and
  21585.           --| operands for Literal_Analysis and DEF_ID_Analysis.
  21586.         NnToken :CT.NnInfoType;
  21587.           --| This object keeps the counts of operators and operands
  21588.           --| which pertain to the reserved words and other syntactic
  21589.           --| constructs.
  21590.         Metrics :MetricsRecord;
  21591.         N2Star  :natural := 0;
  21592.     begin
  21593.         if VerboseOn then
  21594.             Put_Line (Standard_Output, "DEF_ID_Analysis ");
  21595.         end if;
  21596.         DEF_ID_Analysis (BlockInfo.SetOfDEF_IDs, Nn, N2Star);
  21597.         if VerboseOn then
  21598.             Put_Line (Standard_Output, "Literal_Analysis");
  21599.         end if;
  21600.         Literal_Analysis (BlockInfo.SetOfLiterals, Nn);
  21601.              CT.ZeroCount (NnToken);
  21602.              C.HalsteadCount (BlockInfo.TokenCount, VerboseOn, NnToken);
  21603.              if VerboseOn then
  21604.                  New_Line (Standard_Output);
  21605.                      Put_Line (Standard_Output,"------------------------------");
  21606.                      Put_Line (Standard_Output,"This separates countable units");
  21607.                      Put_Line (Standard_Output,"------------------------------");
  21608.                      New_Line (Standard_Output);
  21609.              end if;
  21610.      
  21611.              MetricCalculations (
  21612.                CT.AddCounts (Nn, NnToken), N2Star, Metrics
  21613.                                 );
  21614.                   if ToTerminal then
  21615.                         -- This block is needed because the boot seems to
  21616.                    -- have trouble with
  21617.                    -- ReportHeader (UnitName.all,UnitSpec);
  21618.                         -- UnitName.all is causing the problem.
  21619.                       declare
  21620.                      LocalString : constant String :=
  21621.                        UnitName.all(UnitName.all'range);
  21622.                       begin
  21623.                      ReportHeader (LocalString, UnitSpec);
  21624.                       end;
  21625.                   end if;
  21626.      
  21627.                   PrintInfo (BlockInfo.BlockId, Metrics);
  21628.            -- Truncate the current Scope Name.
  21629.         TruncateQualifiedName (FullyQualifiedName);
  21630.     end ProcessBlockInfo;
  21631.      
  21632. --------------------------------------------------------------------------
  21633.      
  21634. end Halstead_Data_Base;
  21635.      
  21636. ::::::::::::::
  21637. hdb.spc
  21638. ::::::::::::::
  21639. -- $Source :/nosc/work/tools/halstead/RCS/utils.spc,v $
  21640. -- $Revision :1.11 $ -- $Date: 85/02/21 08:22:23 $ -- $Author: buddy $
  21641.      
  21642. with St_Diana; use St_Diana;
  21643. with Definitions; use Definitions;
  21644. with ML_Source_Position_Pkg;
  21645.      
  21646. package Halstead_Data_Base is
  21647.      
  21648. --| OVERVIEW
  21649. --| This package holds the major global data structures and subprograms
  21650. --| used to implement the Halstead Complexity Measures.
  21651.      
  21652. --| EFFECTS
  21653. --| This package has the data structures and subprograms used to compute
  21654. --| the Halstead measures.  ProcessBlock organizes the processing of the
  21655. --| block's information.  This entails counting the tokens as either
  21656. --| operators or operands, determining the operand and operator Vocabulary
  21657. --| and counting the total usage of operators and operands.
  21658. --| It also involves counting the number of literals and performing
  21659. --| analysis on all the identifiers in the block.  Keeping track of the
  21660. --| literals is performed by AddLiteral. This maintains a counted set
  21661. --| of all the literals in the current block.  The literal are counted
  21662. --| as operands in the Halstead metrics.
  21663. --| Analyzing the identifiers in the block is done in the subprogram
  21664. --| DEF_ID_ANALYS.The identifiers are classified according to semantic
  21665. --|information provided by DIANA.
  21666.      
  21667. --| TUNING
  21668. --| The procedure IncrementToken should be in lined using a pragma.
  21669.      
  21670. --------------------------------------------------------------------------
  21671. --               VISIBLE OBJECTS
  21672. --------------------------------------------------------------------------
  21673.      
  21674.     package MLSP renames ML_Source_Position_Pkg;
  21675.      
  21676.     CurrentBlock      :BlockInfoType;
  21677.       --| This contains the information about the block currently
  21678.       --| being processed.  When a new block is encountered it is
  21679.       --| this information which gets pushed on the stack.
  21680.      
  21681.     BlockStack        :BlockInfoStack.Stack;
  21682.       --| This structure stacks the information in the current block      .
  21683.       --| Thus information is pushed onto the stack when we enter a
  21684.       --| new block and popped from the stack when we exit a block.
  21685.       --| This is used to reflect the visibility of operators and
  21686.       --| operands.
  21687.      
  21688.     OutermostBlockSeen :boolean;
  21689.       --| This is used to indicate that the outermost scope of the
  21690.       --| compilation unit has been seen.  This is necessary because
  21691.       --| to include the context clauses as adding to the complexity of
  21692.       --| the outermost compilation unit.
  21693.      
  21694.     FullyQualifiedName :StringPtr;
  21695.       --| This is the fully qualified name of the current scope.  This
  21696.       --| string is used in identifying the current scope in the output.
  21697.      
  21698.     UnitName           :StringPtr;
  21699.       --| This is the name of library unit currently being processed.
  21700.       --| It is an access to a string since we don't know how long the
  21701.       --| will be.
  21702.      
  21703.     UnitSpec           :boolean;
  21704.       --| This indicates whether the unit which is currently being
  21705.       --| processed is a specification or a body.
  21706.      
  21707.      
  21708.     VerboseOn          :boolean;
  21709.       --| This boolean is used to control the printing of
  21710.       --| information pertaining to token counting.  This shows
  21711.       --| tokens are counted, and what they are counted as.
  21712.       --| This information is always written to standard output.
  21713.       --| This paramater is set from the command line. The default
  21714.       --| for this is false.
  21715.      
  21716.     ToTerminal   :boolean;
  21717.       --| This boolean is true if the user has not specified an output
  21718.       --| file which means the report is going to standard_output
  21719.       --| which is the terminal.
  21720.      
  21721. --------------------------------------------------------------------------
  21722. --                VISIBLE SUBPROGRAMS
  21723. --------------------------------------------------------------------------
  21724.      
  21725. --------------------------------------------------------------------------
  21726.      
  21727.     procedure InitializeData (  --| This procedure passes the values
  21728.                           --| of certain
  21729.                           --| from the driver to this package which uses
  21730.                           --| it in producing the report.  It needs the
  21731.                           --| the name of the library unit, whether the
  21732.                           --| library unit is a specicification or a body,
  21733.                           --| if the verbose flag is set, and whether the
  21734.                           --| report is going to the terminal.
  21735.      
  21736.        LibraryUnit           :in    String;
  21737.        IsUnitSpec            :in    boolean;
  21738.        VerboseFlag           :in    boolean;
  21739.        ToTerminalFlag        :in    boolean;
  21740.        OuterMostBlockFlag    :in    boolean
  21741.     );
  21742.      
  21743. --------------------------------------------------------------------------
  21744.      
  21745.    procedure ReportHeader  (   --| This prints the header for a Library
  21746.                                --| Unit.
  21747.              UnitName  : String;
  21748.              Spec      : boolean
  21749.    );
  21750.      
  21751. --------------------------------------------------------------------------
  21752.      
  21753.     function InitializeCurrentBlock  --| This function returns a record
  21754.                                      --| of type BlockInfoType which is
  21755.                                      --| initialized.
  21756.     return BlockInfoType;
  21757.      
  21758.     --| OVERVIEW
  21759.     --| This function is used before starting the scan of DIANA and
  21760.     --| then after a Push of CurrentBlock onto the stack.
  21761.      
  21762.     --| EFFECTS
  21763.     --| This function sets the TokenCount for each TokenItem to be 0.
  21764.     --| It also set the LiterSet to be empty and the ListOfDEF_ID to
  21765.     --| empty.
  21766.      
  21767. --------------------------------------------------------------------------
  21768.      
  21769.     procedure IncrementToken ( --| This procedure increments the count of
  21770.                                --| of the given token for the current
  21771.                                --| block.
  21772.      
  21773.               T :in    TokenItem
  21774.                 --| Token whose count is being incremented.
  21775.      );
  21776.      
  21777.      --| OVERVIEW
  21778.      --| This procedure is called during the tree walking when the DIANA
  21779.      --| node which corresponds to the token T has been scanned.
  21780.      
  21781.      --| MODIFIES
  21782.      --| This increments CurrentBlock.TokenCount (T) which is the
  21783.      --| number of occurrences of the token T in the current block.
  21784.      
  21785.      --| TUNING
  21786.      --| This procedure should be pragma inlined.
  21787.      
  21788. --------------------------------------------------------------------------
  21789.      
  21790.     function LineNumber (
  21791.                    Position      :in     MLSP.Source_Position
  21792.     ) return MLSP.Source_Line;
  21793.      
  21794.     --| RAISES
  21795.     --|
  21796.      
  21797.     --| OVERVIEW
  21798.     --| Checks whether Position is a Source_Location or source_range.
  21799.     --| It then returns the line number of the starting position.
  21800.      
  21801.     --| EFFECTS
  21802.     --|
  21803.      
  21804.     --| REQUIRES
  21805.     --|
  21806.      
  21807.     --| MODIFIES
  21808.     --|
  21809.      
  21810.     --| ERRORS
  21811.     --|
  21812.      
  21813.     --| N/A
  21814.     --|
  21815.      
  21816.     --| TUNING
  21817.     --|
  21818.      
  21819.     --| NOTES
  21820.     --|
  21821.      
  21822. --------------------------------------------------------------------------
  21823.      
  21824.     function IsSourceRange (
  21825.                    Position :in     MLSP.Source_Position
  21826.     ) return boolean;
  21827.      
  21828.     --| RAISES
  21829.     --|
  21830.      
  21831.     --| OVERVIEW
  21832.     --| This procedure checks if the Position is a source range.  In
  21833.     --| the diana this indicate that the token had a beginning source
  21834.     --| location and an ending source location.  Other tokens simply
  21835.     --| had a source point which was where the start of the token
  21836.     --| was in the source ( a line number and column position).
  21837.     --| The distinction between source_range and source_point is
  21838.     --| useful for distinguishing certain diana constructs.
  21839.      
  21840. --------------------------------------------------------------------------
  21841.      
  21842.      procedure SetBlockId (  --| This procedure initializes the
  21843.                              --| identifying fields for the block.
  21844.      
  21845.           ScopeName   :in  Symbol_repNode.Locator;
  21846.             --| This is a Locator to the name of the block.
  21847.      
  21848.           KindOfBlock :in  BlockKind;
  21849.             --| This is the kind of block. This can be a procedure,
  21850.             --| function, package, task or declare block.
  21851.      
  21852.           SpcBdyId    :in  SpcBdyIdType;
  21853.             --| This indicates whether the block is a spec or a body.
  21854.      
  21855.           Line_Number :in  MLSP.Source_Line
  21856.      );
  21857.      
  21858.      --| OVERVIEW
  21859.      --| This is used in the tree walk of DIANA when a node is
  21860.      --| scanned which indicates the name and type of the block.
  21861.      --| Typically a DEF_ID will be associated with a package, or
  21862.      --| subprogram, or task.  The information passed to the
  21863.      --| routine is used in the reporting phase.
  21864.      
  21865.      --| MODIFIES
  21866.      --| This updates the BlockId component of CurrentBlock.
  21867.      
  21868.      --| EFFECTS
  21869.      --| The information in BlockId is used in the output routines to
  21870.      --| indicate the block.
  21871.      
  21872. --------------------------------------------------------------------------
  21873.      
  21874.     procedure FreeSpace (   --| Frees all the heap space which this
  21875.                             --| record uses.
  21876.      
  21877.               CurrentBlock :in out BlockInfoType
  21878.     );
  21879.      
  21880. --------------------------------------------------------------------------
  21881.      
  21882.     procedure ProcessBlockInfo (   --| Processes the information gathered
  21883.                                    --| for the current block.
  21884.        BlockInfo :in BlockInfoType
  21885.          --| This is the information for the block.
  21886.     );
  21887.      
  21888.     --| OVERVIEW
  21889.     --| This procedure computes and output the Halstead Metrics for the
  21890.     --| current block.  This procedure is invoked in the DIANA treewalk
  21891.     --| after a node which is a block has been completely processed.
  21892.      
  21893. --------------------------------------------------------------------------
  21894.      
  21895. end Halstead_Data_Base;
  21896.      
  21897. ::::::::::::::
  21898. id_utils.bdy
  21899. ::::::::::::::
  21900. -- $Revision: 1.2 $ -- $Date: 86/02/06 18:05:16 $ -- $Author: buddy $
  21901.      
  21902. with ML_Source_Position_Pkg;
  21903. package body Identifier_Utilities is
  21904.     package MLSP renames ML_Source_Position_Pkg;
  21905.      
  21906. --| OVERVIEW
  21907. --| This package has utilities which are used in processing
  21908. --| DEF_ID's.
  21909.      
  21910.     function Is_Source_Position_Null (
  21911.         Position :in    MLSP.Source_Position
  21912.     ) return boolean;
  21913.      
  21914.     --| OVERVIEW
  21915.     --| This procedure returns true if the source position passed in
  21916.     --| is null.  This means that column and line of the
  21917.     --| Position.first_location is 0.
  21918.      
  21919.     function Is_Id_Null (
  21920.       Id :in     DEF_ID.Locator
  21921.     ) return boolean is
  21922.     begin
  21923.         return Is_Source_Position_Null (lx_srcpos (id));
  21924.     end;
  21925. --------------------------------------------------------------------------
  21926.      
  21927.     function Is_Source_Position_Null (
  21928.         Position :in    MLSP.Source_Position
  21929.     ) return boolean is
  21930.     begin
  21931.         return MLSP."=" (Position.first_location,0);
  21932.     end;
  21933. end Identifier_Utilities;
  21934.      
  21935.      
  21936. --------------------------------------------------------------------------
  21937.      
  21938.      
  21939. ::::::::::::::
  21940. id_utils.spc
  21941. ::::::::::::::
  21942. with ST_DIANA; use ST_DIANA;
  21943.  
  21944. package Identifier_Utilities is
  21945. --| OVERVIEW
  21946. --| This package has utilities which are used in processing
  21947. --| DEF_ID's.
  21948.      
  21949.     function Is_Id_Null (
  21950.       Id :in     DEF_ID.Locator
  21951.     ) return boolean ;
  21952.      
  21953. end Identifier_Utilities;
  21954. ::::::::::::::
  21955. ihagg_nam.dat
  21956. ::::::::::::::
  21957. -- Begin: IHagg_named dat ---------------------------------------------------
  21958.      
  21959. with ST_DIANA; use ST_DIANA;
  21960.              with Unchecked_Deallocation;
  21961. package agg_named_IH is
  21962.       type RecType is record
  21963.         ih_inagg_named : boolean;
  21964.       end record;
  21965.       R : RecType;
  21966. end agg_named_IH;
  21967. -- End: IHagg_named dat -----------------------------------------------------
  21968. ::::::::::::::
  21969. ihblock_s.dat
  21970. ::::::::::::::
  21971. -- Begin: IHblock_stm dat ---------------------------------------------------
  21972.      
  21973. with ST_DIANA; use ST_DIANA;
  21974.              with Unchecked_Deallocation;
  21975. package block_stm_IH is
  21976.       type RecType is record
  21977.         ih_inblock : boolean;
  21978.       end record;
  21979.       R : RecType;
  21980. end block_stm_IH;
  21981. -- End: IHblock_stm dat -----------------------------------------------------
  21982. ::::::::::::::
  21983. ihcase_al.dat
  21984. ::::::::::::::
  21985. -- Begin: IHcase_alternative dat ---------------------------------------------------
  21986.      
  21987. with ST_DIANA; use ST_DIANA;
  21988.              with Unchecked_Deallocation;
  21989. package case_alternative_IH is
  21990.       type RecType is record
  21991.         ih_incase_alternative : boolean;
  21992.       end record;
  21993.       R : RecType;
  21994. end case_alternative_IH;
  21995. -- End: IHcase_alternative dat -----------------------------------------------------
  21996. ::::::::::::::
  21997. ihgeneric.dat
  21998. ::::::::::::::
  21999. -- Begin: IHgeneric_header dat ---------------------------------------------------
  22000.      
  22001. with ST_DIANA; use ST_DIANA;
  22002.              with Unchecked_Deallocation;
  22003. package generic_header_IH is
  22004.       type RecType is record
  22005.         ih_ingeneric_param : boolean;
  22006.       end record;
  22007.       R : RecType;
  22008. end generic_header_IH;
  22009. -- End: IHgeneric_header dat -----------------------------------------------------
  22010. ::::::::::::::
  22011. ihhandler.dat
  22012. ::::::::::::::
  22013. -- Begin: IHhandler_alternative dat ---------------------------------------------------
  22014.      
  22015. with ST_DIANA; use ST_DIANA;
  22016.              with Unchecked_Deallocation;
  22017. package handler_alternative_IH is
  22018.       type RecType is record
  22019.         ih_inhandler_alternative : boolean;
  22020.       end record;
  22021.       R : RecType;
  22022. end handler_alternative_IH;
  22023. -- End: IHhandler_alternative dat -----------------------------------------------------
  22024. ::::::::::::::
  22025. ihinner_r.dat
  22026. ::::::::::::::
  22027. -- Begin: IHinner_record dat ---------------------------------------------------
  22028.      
  22029. with ST_DIANA; use ST_DIANA;
  22030.              with Unchecked_Deallocation;
  22031. package inner_record_IH is
  22032.       type RecType is record
  22033.         ih_in_variant : boolean;
  22034.       end record;
  22035.       R : RecType;
  22036. end inner_record_IH;
  22037. -- End: IHinner_record dat -----------------------------------------------------
  22038. ::::::::::::::
  22039. ihseries_.dat
  22040. ::::::::::::::
  22041. -- Begin: IHSERIES_UNIT dat ---------------------------------------------------
  22042.      
  22043. with ST_DIANA; use ST_DIANA;
  22044.              with Unchecked_Deallocation;
  22045. package SERIES_UNIT_IH is
  22046.       type RecType is record
  22047.         ih_inlist : boolean;
  22048.       end record;
  22049.       R : RecType;
  22050. end SERIES_UNIT_IH;
  22051. -- End: IHSERIES_UNIT dat -----------------------------------------------------
  22052. ::::::::::::::
  22053. ihsubtype.dat
  22054. ::::::::::::::
  22055. -- Begin: IHsubtype_decl dat ---------------------------------------------------
  22056.      
  22057. with ST_DIANA; use ST_DIANA;
  22058.              with Unchecked_Deallocation;
  22059. package subtype_decl_IH is
  22060.       type RecType is record
  22061.         ih_in_subtype_decl : boolean;
  22062.       end record;
  22063.       R : RecType;
  22064. end subtype_decl_IH;
  22065. -- End: IHsubtype_decl dat -----------------------------------------------------
  22066. ::::::::::::::
  22067. ihtask_de.dat
  22068. ::::::::::::::
  22069. -- Begin: IHtask_decl dat ---------------------------------------------------
  22070.      
  22071. with ST_DIANA; use ST_DIANA;
  22072.              with Unchecked_Deallocation;
  22073. package task_decl_IH is
  22074.       type RecType is record
  22075.         ih_intask_decl : boolean;
  22076.       end record;
  22077.       R : RecType;
  22078. end task_decl_IH;
  22079. -- End: IHtask_decl dat -----------------------------------------------------
  22080. ::::::::::::::
  22081. ihtype_de.dat
  22082. ::::::::::::::
  22083. -- Begin: IHtype_decl dat ---------------------------------------------------
  22084.      
  22085. with ST_DIANA; use ST_DIANA;
  22086.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  22087. package type_decl_IH is
  22088.       type RecType is record
  22089.         ih_typespec : Anykind;
  22090.         ih_basetype : DEF_ID.Locator;
  22091.       end record;
  22092.       R : RecType;
  22093. end type_decl_IH;
  22094. -- End: IHtype_decl dat -----------------------------------------------------
  22095. ::::::::::::::
  22096. ihvariabl.dat
  22097. ::::::::::::::
  22098. -- Begin: IHvariable_decl dat ---------------------------------------------------
  22099.      
  22100. with ST_DIANA; use ST_DIANA;
  22101.              with ST_Diana; use ST_Diana; with Unchecked_Deallocation;
  22102. package variable_decl_IH is
  22103.       type RecType is record
  22104.         ih_vartype : MARK.Locator;
  22105.         ih_init : boolean;
  22106.       end record;
  22107.       R : RecType;
  22108. end variable_decl_IH;
  22109. -- End: IHvariable_decl dat -----------------------------------------------------
  22110. ::::::::::::::
  22111. obj.bdy
  22112. ::::::::::::::
  22113. -- Begin: SCOBJECT_TYPE bdy ---------------------------------------------------
  22114.      
  22115. with Halstead_Data_Base;  use Halstead_Data_Base;
  22116. with Definitions; use Definitions;
  22117.              with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  22118. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22119. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  22120.      
  22121.                with subtype_decl_IH;
  22122.                          package body OBJECT_TYPE_Pkg is
  22123.      
  22124.      
  22125.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator) is
  22126.     begin
  22127.         case Kind(Root) is
  22128.           when object_type_anon_arrayKind => Scan_object_type_anon_array(Root);
  22129.           when object_type_anon_taskKind => Scan_object_type_anon_task(Root);
  22130.           when object_type_constrainedKind => Scan_object_type_constrained(Root);
  22131.           when object_type_indexKind => Scan_object_type_index(Root);
  22132.           when object_type_rangeKind => Scan_object_type_range(Root);
  22133.           when others => null;
  22134.         end case;
  22135.     end Scan_OBJECT_TYPE;
  22136.      
  22137.      
  22138.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator) is
  22139.     begin
  22140.         Scan_constrained_array_type(as_array_type_spec(Root));
  22141.      
  22142.     end Scan_object_type_anon_array;
  22143.      
  22144.      
  22145.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator) is
  22146.     begin
  22147.         Scan_task_spec(as_task_spec(Root));
  22148.      
  22149.     end Scan_object_type_anon_task;
  22150.      
  22151.      
  22152.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator) is
  22153.     begin
  22154.       if not MARK.IsNull(as_constrained_name(Root)) then
  22155.         Scan_MARK(as_constrained_name(Root));
  22156.       end if;
  22157.       if not CONSTRAINT.IsNull(as_constraint(Root)) then
  22158.      
  22159.      
  22160.       if (subtype_decl_IH.R.ih_in_subtype_decl)
  22161.            and then
  22162.          (Kind (as_constraint (root)) not in dscrmt_constraintKind)
  22163.          then
  22164.           IncrementToken (rangez);
  22165.       end if;
  22166.      
  22167.      
  22168.         Scan_CONSTRAINT(as_constraint(Root));
  22169.       end if;
  22170.      
  22171.     end Scan_object_type_constrained;
  22172.      
  22173.      
  22174.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator) is
  22175.     begin
  22176.       if not MARK.IsNull(as_index_name(Root)) then
  22177.         Scan_MARK(as_index_name(Root));
  22178.      
  22179.      
  22180.         IncrementToken (rangez);
  22181.      
  22182.      
  22183.       end if;
  22184.      
  22185.     end Scan_object_type_index;
  22186.      
  22187.      
  22188.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator) is
  22189.     begin
  22190.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  22191.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  22192.       end if;
  22193.      
  22194.     end Scan_object_type_range;
  22195.      
  22196. end OBJECT_TYPE_Pkg;
  22197. -- End: SCOBJECT_TYPE bdy -----------------------------------------------------
  22198. ::::::::::::::
  22199. obj.spc
  22200. ::::::::::::::
  22201. -- Begin: SCOBJECT_TYPE spc ---------------------------------------------------
  22202.      
  22203. with ST_DIANA; use ST_DIANA;
  22204.              package OBJECT_TYPE_Pkg is
  22205.     procedure Scan_OBJECT_TYPE(Root : OBJECT_TYPE.Locator);
  22206.     procedure Scan_object_type_anon_array(Root : object_type_anon_arrayNode.Locator);
  22207.     procedure Scan_object_type_anon_task(Root : object_type_anon_taskNode.Locator);
  22208.     procedure Scan_object_type_constrained(Root : object_type_constrainedNode.Locator);
  22209.     procedure Scan_object_type_index(Root : object_type_indexNode.Locator);
  22210.     procedure Scan_object_type_range(Root : object_type_rangeNode.Locator);
  22211. end OBJECT_TYPE_Pkg;
  22212. -- End: SCOBJECT_TYPE spc -----------------------------------------------------
  22213. ::::::::::::::
  22214. scagg_com.bdy
  22215. ::::::::::::::
  22216. -- Begin: SCAGG_COMPONENT bdy ---------------------------------------------------
  22217.      
  22218. with Halstead_Data_Base;  use Halstead_Data_Base;
  22219. with Definitions; use Definitions;
  22220.              with SERIES_UNIT_IH;
  22221. with agg_named_IH;
  22222. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22223. with CHOICE_Pkg; use CHOICE_Pkg;
  22224. package body AGG_COMPONENT_Pkg is
  22225.      
  22226.      
  22227.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator) is
  22228.     begin
  22229.         case Kind(Root) is
  22230.           when agg_canonicalKind => Scan_agg_canonical(Root);
  22231.           when agg_expKind => Scan_agg_exp(Root);
  22232.           when agg_namedKind => Scan_agg_named(Root);
  22233.           when others => null;
  22234.         end case;
  22235.     end Scan_AGG_COMPONENT;
  22236.      
  22237.      
  22238.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator) is
  22239.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22240.     begin
  22241.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22242.      
  22243.      
  22244.     SERIES_UNIT_IH.R.ih_inlist := false;
  22245.      
  22246.      
  22247.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22248.      
  22249.     end Scan_agg_canonical;
  22250.      
  22251.      
  22252.     procedure Scan_agg_exp(Root : agg_expNode.Locator) is
  22253.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22254.     begin
  22255.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22256.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22257.         Scan_NAME_EXP(as_exp(Root));
  22258.       end if;
  22259.      
  22260.      
  22261.     SERIES_UNIT_IH.R.ih_inlist := false;
  22262.      
  22263.      
  22264.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22265.      
  22266.     end Scan_agg_exp;
  22267.      
  22268.      
  22269.     procedure Scan_agg_named(Root : agg_namedNode.Locator) is
  22270.         as_choice_s_List : SeqOfCHOICE.Generator;
  22271.         as_choice_s_Item : CHOICE.Locator;
  22272.         use SeqOfCHOICE;
  22273.         Old_agg_named_IHR : agg_named_IH.RecType := agg_named_IH.R;
  22274.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22275.     begin
  22276.         agg_named_IH.R.ih_inagg_named :=  false ;
  22277.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22278.       if not SeqOfCHOICE.IsNull(as_choice_s(Root)) then
  22279.      
  22280.      
  22281.      agg_named_IH.R.ih_inagg_named := true;
  22282.      
  22283.      
  22284.         StartForward(as_choice_s(Root), as_choice_s_List);
  22285.         while not Finished(as_choice_s_List) loop
  22286.             as_choice_s_Item := Cell(as_choice_s_List);
  22287.      
  22288.      
  22289.     if SERIES_UNIT_IH.R.ih_inlist then
  22290.         IncrementToken (barz);
  22291.     end if;
  22292.     SERIES_UNIT_IH.R.ih_inlist := true;
  22293.      
  22294.      
  22295.      
  22296.             Scan_CHOICE(as_choice_s_Item);
  22297.             Forward(as_choice_s_List);
  22298.         end loop;
  22299.         EndIterate(as_choice_s_List);
  22300.      
  22301.      
  22302.      IncrementToken (arrowz);
  22303.      agg_named_IH.R.ih_inagg_named := false;
  22304.      
  22305.      
  22306.       end if;
  22307.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22308.         Scan_NAME_EXP(as_exp(Root));
  22309.       end if;
  22310.      
  22311.      
  22312.     SERIES_UNIT_IH.R.ih_inlist := false;
  22313.      
  22314.      
  22315.         agg_named_IH.R := Old_agg_named_IHR;
  22316.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22317.      
  22318.     end Scan_agg_named;
  22319.      
  22320. end AGG_COMPONENT_Pkg;
  22321. -- End: SCAGG_COMPONENT bdy -----------------------------------------------------
  22322. ::::::::::::::
  22323. scagg_com.spc
  22324. ::::::::::::::
  22325. -- Begin: SCAGG_COMPONENT spc ---------------------------------------------------
  22326.      
  22327. with ST_DIANA; use ST_DIANA;
  22328.              package AGG_COMPONENT_Pkg is
  22329.     procedure Scan_AGG_COMPONENT(Root : AGG_COMPONENT.Locator);
  22330.     procedure Scan_agg_canonical(Root : agg_canonicalNode.Locator);
  22331.     procedure Scan_agg_exp(Root : agg_expNode.Locator);
  22332.     procedure Scan_agg_named(Root : agg_namedNode.Locator);
  22333. end AGG_COMPONENT_Pkg;
  22334. -- End: SCAGG_COMPONENT spc -----------------------------------------------------
  22335. ::::::::::::::
  22336. scalterna.bdy
  22337. ::::::::::::::
  22338. -- Begin: SCALTERNATIVE bdy ---------------------------------------------------
  22339.      
  22340. with Halstead_Data_Base;  use Halstead_Data_Base;
  22341. with Definitions; use Definitions;
  22342.              with SERIES_UNIT_IH;
  22343. with case_alternative_IH;
  22344. with handler_alternative_IH;
  22345. with CHOICE_Pkg; use CHOICE_Pkg;
  22346. with STM_Pkg; use STM_Pkg;
  22347. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22348. with ITEM_Pkg; use ITEM_Pkg;
  22349. package body ALTERNATIVE_Pkg is
  22350.      
  22351.      
  22352.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator) is
  22353.     begin
  22354.         case Kind(Root) is
  22355.           when case_alternativeKind => Scan_case_alternative(Root);
  22356.           when cond_alternativeKind => Scan_cond_alternative(Root);
  22357.           when handler_alternativeKind => Scan_handler_alternative(Root);
  22358.           when pragma_alternativeKind => Scan_pragma_alternative(Root);
  22359.           when select_alternativeKind => Scan_select_alternative(Root);
  22360.           when others => null;
  22361.         end case;
  22362.     end Scan_ALTERNATIVE;
  22363.      
  22364.      
  22365.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator) is
  22366.         as_case_choice_s_List : SeqOfCHOICE.Generator;
  22367.         as_case_choice_s_Item : CHOICE.Locator;
  22368.         use SeqOfCHOICE;
  22369.         as_stm_s_List : SeqOfSTM.Generator;
  22370.         as_stm_s_Item : STM.Locator;
  22371.         use SeqOfSTM;
  22372.         Old_case_alternative_IHR : case_alternative_IH.RecType := case_alternative_IH.R;
  22373.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22374.     begin
  22375.         case_alternative_IH.R.ih_incase_alternative :=  false ;
  22376.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22377.      
  22378.      
  22379.        case_alternative_IH.R.ih_incase_alternative := true;
  22380.        IncrementToken (when_case_stmz);
  22381.        IncrementToken (arrowz);
  22382.      
  22383.      
  22384.       if not SeqOfCHOICE.IsNull(as_case_choice_s(Root)) then
  22385.         StartForward(as_case_choice_s(Root), as_case_choice_s_List);
  22386.         while not Finished(as_case_choice_s_List) loop
  22387.             as_case_choice_s_Item := Cell(as_case_choice_s_List);
  22388.      
  22389.      
  22390.     if SERIES_UNIT_IH.R.ih_inlist then
  22391.         IncrementToken (barz);
  22392.     end if;
  22393.     SERIES_UNIT_IH.R.ih_inlist := true;
  22394.      
  22395.      
  22396.             Scan_CHOICE(as_case_choice_s_Item);
  22397.             Forward(as_case_choice_s_List);
  22398.         end loop;
  22399.         EndIterate(as_case_choice_s_List);
  22400.       end if;
  22401.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22402.         StartForward(as_stm_s(Root), as_stm_s_List);
  22403.         while not Finished(as_stm_s_List) loop
  22404.             as_stm_s_Item := Cell(as_stm_s_List);
  22405.             Scan_STM(as_stm_s_Item);
  22406.             Forward(as_stm_s_List);
  22407.         end loop;
  22408.         EndIterate(as_stm_s_List);
  22409.       end if;
  22410.      
  22411.      
  22412.       case_alternative_IH.R.ih_incase_alternative := false;
  22413.      
  22414.      
  22415.         case_alternative_IH.R := Old_case_alternative_IHR;
  22416.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22417.      
  22418.     end Scan_case_alternative;
  22419.      
  22420.      
  22421.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator) is
  22422.         as_stm_s_List : SeqOfSTM.Generator;
  22423.         as_stm_s_Item : STM.Locator;
  22424.         use SeqOfSTM;
  22425.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22426.     begin
  22427.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22428.      
  22429.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  22430.         then
  22431.      
  22432.     if IsSourceRange (lx_srcpos(root)) then
  22433.           IncrementToken (elsifz);
  22434.     end if;
  22435.      
  22436.         end if;
  22437.      
  22438.         if NAME_EXP.IsNull(as_cond_exp_void(Root))
  22439.         then
  22440.      
  22441.       IncrementToken (else_ifz);
  22442.      
  22443.         end if;
  22444.       if not NAME_EXP.IsNull(as_cond_exp_void(Root)) then
  22445.         Scan_NAME_EXP(as_cond_exp_void(Root));
  22446.       end if;
  22447.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22448.      
  22449.         if not NAME_EXP.IsNull(as_cond_exp_void(Root))
  22450.         then
  22451.      
  22452.       IncrementToken (thenz);
  22453.      
  22454.         end if;
  22455.         StartForward(as_stm_s(Root), as_stm_s_List);
  22456.         while not Finished(as_stm_s_List) loop
  22457.             as_stm_s_Item := Cell(as_stm_s_List);
  22458.             Scan_STM(as_stm_s_Item);
  22459.             Forward(as_stm_s_List);
  22460.         end loop;
  22461.         EndIterate(as_stm_s_List);
  22462.       end if;
  22463.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22464.      
  22465.     end Scan_cond_alternative;
  22466.      
  22467.      
  22468.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator) is
  22469.         as_handler_choice_s_List : SeqOfCHOICE.Generator;
  22470.         as_handler_choice_s_Item : CHOICE.Locator;
  22471.         use SeqOfCHOICE;
  22472.         as_stm_s_List : SeqOfSTM.Generator;
  22473.         as_stm_s_Item : STM.Locator;
  22474.         use SeqOfSTM;
  22475.         Old_handler_alternative_IHR : handler_alternative_IH.RecType := handler_alternative_IH.R;
  22476.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22477.     begin
  22478.         handler_alternative_IH.R.ih_inhandler_alternative :=  false ;
  22479.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22480.      
  22481.      
  22482.        handler_alternative_IH.R.ih_inhandler_alternative := true;
  22483.        IncrementToken (when_exceptionz);
  22484.        IncrementToken (arrowz);
  22485.      
  22486.      
  22487.       if not SeqOfCHOICE.IsNull(as_handler_choice_s(Root)) then
  22488.         StartForward(as_handler_choice_s(Root), as_handler_choice_s_List);
  22489.         while not Finished(as_handler_choice_s_List) loop
  22490.             as_handler_choice_s_Item := Cell(as_handler_choice_s_List);
  22491.      
  22492.      
  22493.       if SERIES_UNIT_IH.R.ih_inlist then
  22494.           IncrementToken (barz);
  22495.       end if;
  22496.       SERIES_UNIT_IH.R.ih_inlist := true;
  22497.      
  22498.      
  22499.             Scan_CHOICE(as_handler_choice_s_Item);
  22500.             Forward(as_handler_choice_s_List);
  22501.         end loop;
  22502.         EndIterate(as_handler_choice_s_List);
  22503.       end if;
  22504.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22505.         StartForward(as_stm_s(Root), as_stm_s_List);
  22506.         while not Finished(as_stm_s_List) loop
  22507.             as_stm_s_Item := Cell(as_stm_s_List);
  22508.             Scan_STM(as_stm_s_Item);
  22509.             Forward(as_stm_s_List);
  22510.         end loop;
  22511.         EndIterate(as_stm_s_List);
  22512.       end if;
  22513.      
  22514.      
  22515.       handler_alternative_IH.R.ih_inhandler_alternative := false;
  22516.       SERIES_UNIT_IH.R.ih_inlist := false;
  22517.      
  22518.      
  22519.         handler_alternative_IH.R := Old_handler_alternative_IHR;
  22520.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22521.      
  22522.     end Scan_handler_alternative;
  22523.      
  22524.      
  22525.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator) is
  22526.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22527.     begin
  22528.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22529.       if not pragma_declNode.IsNull(as_pragma_alternative(Root)) then
  22530.         Scan_pragma_decl(as_pragma_alternative(Root));
  22531.       end if;
  22532.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22533.      
  22534.     end Scan_pragma_alternative;
  22535.      
  22536.      
  22537.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator) is
  22538.         as_stm_s_List : SeqOfSTM.Generator;
  22539.         as_stm_s_Item : STM.Locator;
  22540.         use SeqOfSTM;
  22541.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  22542.     begin
  22543.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  22544.       if not NAME_EXP.IsNull(as_select_exp_void(Root)) then
  22545.      
  22546.      
  22547.        IncrementToken (when_selectz);
  22548.      
  22549.      
  22550.         Scan_NAME_EXP(as_select_exp_void(Root));
  22551.      
  22552.      
  22553.      IncrementToken (arrowz);
  22554.      
  22555.      
  22556.       end if;
  22557.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22558.         StartForward(as_stm_s(Root), as_stm_s_List);
  22559.         while not Finished(as_stm_s_List) loop
  22560.             as_stm_s_Item := Cell(as_stm_s_List);
  22561.      
  22562.      
  22563.     if SERIES_UNIT_IH.R.ih_inlist then
  22564.         IncrementToken (or_selectz);
  22565.     end if;
  22566.     SERIES_UNIT_IH.R.ih_inlist := true;
  22567.      
  22568.      
  22569.             Scan_STM(as_stm_s_Item);
  22570.             Forward(as_stm_s_List);
  22571.         end loop;
  22572.         EndIterate(as_stm_s_List);
  22573.       end if;
  22574.      
  22575.      
  22576.   SERIES_UNIT_IH.R.ih_inlist := false;
  22577.      
  22578.      
  22579.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  22580.      
  22581.     end Scan_select_alternative;
  22582.      
  22583. end ALTERNATIVE_Pkg;
  22584. -- End: SCALTERNATIVE bdy -----------------------------------------------------
  22585. ::::::::::::::
  22586. scalterna.spc
  22587. ::::::::::::::
  22588. -- Begin: SCALTERNATIVE spc ---------------------------------------------------
  22589.      
  22590. with ST_DIANA; use ST_DIANA;
  22591.              package ALTERNATIVE_Pkg is
  22592.     procedure Scan_ALTERNATIVE(Root : ALTERNATIVE.Locator);
  22593.     procedure Scan_case_alternative(Root : case_alternativeNode.Locator);
  22594.     procedure Scan_cond_alternative(Root : cond_alternativeNode.Locator);
  22595.     procedure Scan_handler_alternative(Root : handler_alternativeNode.Locator);
  22596.     procedure Scan_pragma_alternative(Root : pragma_alternativeNode.Locator);
  22597.     procedure Scan_select_alternative(Root : select_alternativeNode.Locator);
  22598. end ALTERNATIVE_Pkg;
  22599. -- End: SCALTERNATIVE spc -----------------------------------------------------
  22600. ::::::::::::::
  22601. scblock_s.bdy
  22602. ::::::::::::::
  22603. -- Begin: SCBLOCK_STUB bdy ---------------------------------------------------
  22604.      
  22605. with Halstead_Data_Base;  use Halstead_Data_Base;
  22606. with Definitions; use Definitions;
  22607.              with ITEM_Pkg; use ITEM_Pkg;
  22608. with STM_Pkg; use STM_Pkg;
  22609. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  22610.      
  22611.                with BLOCK_STM_IH;
  22612.                with Source_Position_Utilities;
  22613.                          package body BLOCK_STUB_Pkg is
  22614.      
  22615.      
  22616.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator) is
  22617.     begin
  22618.         case Kind(Root) is
  22619.           when body_blockKind => Scan_body_block(Root);
  22620.           when body_stubKind => Scan_body_stub(Root);
  22621.           when others => null;
  22622.         end case;
  22623.     end Scan_BLOCK_STUB;
  22624.      
  22625.      
  22626.     procedure Scan_body_block(Root : body_blockNode.Locator) is
  22627.         as_item_s_List : SeqOfITEM.Generator;
  22628.         as_item_s_Item : ITEM.Locator;
  22629.         use SeqOfITEM;
  22630.         as_stm_s_List : SeqOfSTM.Generator;
  22631.         as_stm_s_Item : STM.Locator;
  22632.         use SeqOfSTM;
  22633.         as_handler_s_List : SeqOfhandler_alternativeNode.Generator;
  22634.         as_handler_s_Item : handler_alternativeNode.Locator;
  22635.         use SeqOfhandler_alternativeNode;
  22636.     begin
  22637.       if not SeqOfITEM.IsNull(as_item_s(Root)) then
  22638.      
  22639.      
  22640.      if block_stm_IH.R.ih_inblock then
  22641.          IncrementToken (declarez);
  22642.          block_stm_IH.R.ih_inblock := false;
  22643.      end if;
  22644.      
  22645.      
  22646.         StartForward(as_item_s(Root), as_item_s_List);
  22647.         while not Finished(as_item_s_List) loop
  22648.             as_item_s_Item := Cell(as_item_s_List);
  22649.             Scan_ITEM(as_item_s_Item);
  22650.             Forward(as_item_s_List);
  22651.         end loop;
  22652.         EndIterate(as_item_s_List);
  22653.       end if;
  22654.       if not SeqOfSTM.IsNull(as_stm_s(Root)) then
  22655.      
  22656.      
  22657.     IncrementToken (beginz);
  22658.      
  22659.      
  22660.         StartForward(as_stm_s(Root), as_stm_s_List);
  22661.         while not Finished(as_stm_s_List) loop
  22662.             as_stm_s_Item := Cell(as_stm_s_List);
  22663.             Scan_STM(as_stm_s_Item);
  22664.             Forward(as_stm_s_List);
  22665.         end loop;
  22666.         EndIterate(as_stm_s_List);
  22667.       end if;
  22668.       if not SeqOfhandler_alternativeNode.IsNull(as_handler_s(Root)) then
  22669.      
  22670.      
  22671.      IncrementToken (exceptionz);
  22672.      
  22673.      
  22674.         StartForward(as_handler_s(Root), as_handler_s_List);
  22675.         while not Finished(as_handler_s_List) loop
  22676.             as_handler_s_Item := Cell(as_handler_s_List);
  22677.             Scan_handler_alternative(as_handler_s_Item);
  22678.             Forward(as_handler_s_List);
  22679.         end loop;
  22680.         EndIterate(as_handler_s_List);
  22681.       end if;
  22682.      
  22683.      
  22684.    if not Source_Position_Utilities.Is_Srcpos_Null (lx_srcpos (root)) then
  22685.        IncrementToken (end_beginz);
  22686.    end if;
  22687.      
  22688.      
  22689.      
  22690.     end Scan_body_block;
  22691.      
  22692.      
  22693.     procedure Scan_body_stub(Root : body_stubNode.Locator) is
  22694.     begin
  22695.      
  22696.      
  22697.       --- should be is_separatez not is_packagez
  22698.       IncrementToken (is_separatez);
  22699.       IncrementToken (separatez);
  22700.      
  22701.      
  22702.      
  22703.     end Scan_body_stub;
  22704.      
  22705. end BLOCK_STUB_Pkg;
  22706. -- End: SCBLOCK_STUB bdy -----------------------------------------------------
  22707.      
  22708. ::::::::::::::
  22709. scblock_s.spc
  22710. ::::::::::::::
  22711. -- Begin: SCBLOCK_STUB spc ---------------------------------------------------
  22712.      
  22713. with ST_DIANA; use ST_DIANA;
  22714.              package BLOCK_STUB_Pkg is
  22715.     procedure Scan_BLOCK_STUB(Root : BLOCK_STUB.Locator);
  22716.     procedure Scan_body_block(Root : body_blockNode.Locator);
  22717.     procedure Scan_body_stub(Root : body_stubNode.Locator);
  22718. end BLOCK_STUB_Pkg;
  22719. -- End: SCBLOCK_STUB spc -----------------------------------------------------
  22720. ::::::::::::::
  22721. scchoice.bdy
  22722. ::::::::::::::
  22723. -- Begin: SCCHOICE bdy ---------------------------------------------------
  22724.      
  22725. with Halstead_Data_Base;  use Halstead_Data_Base;
  22726. with Definitions; use Definitions;
  22727.              with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  22728. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22729.      
  22730.           with agg_named_IH;
  22731.           with case_alternative_IH;
  22732.           with handler_alternative_IH;
  22733.           with inner_record_IH;
  22734.                          package body CHOICE_Pkg is
  22735.      
  22736.      
  22737.     procedure Scan_CHOICE(Root : CHOICE.Locator) is
  22738.     begin
  22739.         case Kind(Root) is
  22740.           when ch_discrete_rangeKind => Scan_ch_discrete_range(Root);
  22741.           when ch_expKind => Scan_ch_exp(Root);
  22742.           when ch_othersKind => Scan_ch_others(Root);
  22743.           when others => null;
  22744.         end case;
  22745.     end Scan_CHOICE;
  22746.      
  22747.      
  22748.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator) is
  22749.     begin
  22750.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  22751.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  22752.       end if;
  22753.      
  22754.     end Scan_ch_discrete_range;
  22755.      
  22756.      
  22757.     procedure Scan_ch_exp(Root : ch_expNode.Locator) is
  22758.     begin
  22759.       if not NAME_EXP.IsNull(as_exp(Root)) then
  22760.         Scan_NAME_EXP(as_exp(Root));
  22761.       end if;
  22762.      
  22763.     end Scan_ch_exp;
  22764.      
  22765.      
  22766.     procedure Scan_ch_others(Root : ch_othersNode.Locator) is
  22767.     begin
  22768.      
  22769.      
  22770.      if agg_named_IH.R.ih_inagg_named then
  22771.         IncrementToken (others_aggregatez);
  22772.      end if;
  22773.      if case_alternative_IH.R.ih_incase_alternative then
  22774.         IncrementToken (others_casez);
  22775.      end if;
  22776.      if handler_alternative_IH.R.ih_inhandler_alternative then
  22777.          IncrementToken (others_exceptionz);
  22778.      end if;
  22779.      if inner_record_IH.R.ih_in_variant then
  22780.          IncrementToken (others_variantz);
  22781.      end if;
  22782.      
  22783.      
  22784.      
  22785.     end Scan_ch_others;
  22786.      
  22787. end CHOICE_Pkg;
  22788. -- End: SCCHOICE bdy -----------------------------------------------------
  22789. ::::::::::::::
  22790. scchoice.spc
  22791. ::::::::::::::
  22792. -- Begin: SCCHOICE spc ---------------------------------------------------
  22793.      
  22794. with ST_DIANA; use ST_DIANA;
  22795.              package CHOICE_Pkg is
  22796.     procedure Scan_CHOICE(Root : CHOICE.Locator);
  22797.     procedure Scan_ch_discrete_range(Root : ch_discrete_rangeNode.Locator);
  22798.     procedure Scan_ch_exp(Root : ch_expNode.Locator);
  22799.     procedure Scan_ch_others(Root : ch_othersNode.Locator);
  22800. end CHOICE_Pkg;
  22801. -- End: SCCHOICE spc -----------------------------------------------------
  22802. ::::::::::::::
  22803. sccomp_un.bdy
  22804. ::::::::::::::
  22805. -- Begin: SCCOMP_UNIT_CLASS bdy ---------------------------------------------------
  22806.      
  22807. with Halstead_Data_Base;  use Halstead_Data_Base;
  22808. with Definitions; use Definitions;
  22809.              with ITEM_Pkg; use ITEM_Pkg;
  22810. package body COMP_UNIT_CLASS_Pkg is
  22811.      
  22812.      
  22813.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator) is
  22814.     begin
  22815.         case Kind(Root) is
  22816.           when comp_unitKind => Scan_comp_unit(Root);
  22817.           when others => null;
  22818.         end case;
  22819.     end Scan_COMP_UNIT_CLASS;
  22820.      
  22821.      
  22822.     procedure Scan_comp_unit(Root : comp_unitNode.Locator) is
  22823.         as_context_List : SeqOfITEM.Generator;
  22824.         as_context_Item : ITEM.Locator;
  22825.         use SeqOfITEM;
  22826.         as_pragma_s_List : SeqOfpragma_declNode.Generator;
  22827.         as_pragma_s_Item : pragma_declNode.Locator;
  22828.         use SeqOfpragma_declNode;
  22829.     begin
  22830.      
  22831.      
  22832.      
  22833.      CurrentBlock := InitializeCurrentBlock;
  22834.      BlockStack := BlockInfoStack.Create;
  22835.        -- This adds a dummy frame on the stack so that it is not necessary
  22836.        -- to check when popping the stack at the end of the program
  22837.        -- if the stack has at least one record.
  22838.      BlockInfoStack.Push(BlockStack, CurrentBlock);
  22839.      if Kind (as_unit_body (root)) in subp_declKind then
  22840.          if Kind (as_subp_designator
  22841.             (as_unit_body (root))) in proc_idKind
  22842.             then
  22843.              SetBlockId (lx_symrep
  22844.                            (as_subp_designator (as_unit_body (root))),
  22845.                          procedure_block,
  22846.                          SpcId,
  22847.                          LineNumber (lx_srcpos (as_unit_body (root)))
  22848.                          );
  22849.          else
  22850.              SetBlockId (lx_symrep
  22851.                            (as_subp_designator (as_unit_body (root))),
  22852.                          function_block,
  22853.                          SpcId,
  22854.                          LineNumber (lx_srcpos (as_unit_body (root)))
  22855.                          );
  22856.          end if;
  22857.      
  22858.      end if;
  22859.      
  22860.      
  22861.       if not SeqOfITEM.IsNull(as_context(Root)) then
  22862.         StartForward(as_context(Root), as_context_List);
  22863.         while not Finished(as_context_List) loop
  22864.             as_context_Item := Cell(as_context_List);
  22865.             Scan_ITEM(as_context_Item);
  22866.             Forward(as_context_List);
  22867.         end loop;
  22868.         EndIterate(as_context_List);
  22869.       end if;
  22870.       if not SeqOfpragma_declNode.IsNull(as_pragma_s(Root)) then
  22871.         StartForward(as_pragma_s(Root), as_pragma_s_List);
  22872.         while not Finished(as_pragma_s_List) loop
  22873.             as_pragma_s_Item := Cell(as_pragma_s_List);
  22874.             Scan_pragma_decl(as_pragma_s_Item);
  22875.             Forward(as_pragma_s_List);
  22876.         end loop;
  22877.         EndIterate(as_pragma_s_List);
  22878.       end if;
  22879.       if not ITEM.IsNull(as_unit_body(Root)) then
  22880.         Scan_ITEM(as_unit_body(Root));
  22881.       end if;
  22882.      
  22883.      
  22884.      
  22885.       if Kind (as_unit_body (root)) in subp_declKind then
  22886.           ProcessBlockInfo (CurrentBlock);
  22887.       end if;
  22888.      
  22889.      
  22890.      
  22891.      
  22892.     end Scan_comp_unit;
  22893.      
  22894. end COMP_UNIT_CLASS_Pkg;
  22895. -- End: SCCOMP_UNIT_CLASS bdy -----------------------------------------------------
  22896. ::::::::::::::
  22897. sccomp_un.spc
  22898. ::::::::::::::
  22899. -- Begin: SCCOMP_UNIT_CLASS spc ---------------------------------------------------
  22900.      
  22901. with ST_DIANA; use ST_DIANA;
  22902.              package COMP_UNIT_CLASS_Pkg is
  22903.     procedure Scan_COMP_UNIT_CLASS(Root : COMP_UNIT_CLASS.Locator);
  22904.     procedure Scan_comp_unit(Root : comp_unitNode.Locator);
  22905. end COMP_UNIT_CLASS_Pkg;
  22906. -- End: SCCOMP_UNIT_CLASS spc -----------------------------------------------------
  22907.      
  22908. ::::::::::::::
  22909. scconstra.bdy
  22910. ::::::::::::::
  22911. -- Begin: SCCONSTRAINT bdy ---------------------------------------------------
  22912.      
  22913. with Halstead_Data_Base;  use Halstead_Data_Base;
  22914. with Definitions; use Definitions;
  22915.              with SERIES_UNIT_IH;
  22916. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  22917. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  22918. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  22919. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  22920.      
  22921.                with subtype_decl_IH;
  22922.                          package body CONSTRAINT_Pkg is
  22923.      
  22924.      
  22925.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator) is
  22926.     begin
  22927.         case Kind(Root) is
  22928.           when RANGE_CONSTRAINT_CLASSKind => Scan_RANGE_CONSTRAINT_CLASS(Root);
  22929.           when REAL_CONSTRAINTKind => Scan_REAL_CONSTRAINT(Root);
  22930.           when apply_constraintKind => Scan_apply_constraint(Root);
  22931.           when dscrmt_constraintKind => Scan_dscrmt_constraint(Root);
  22932.           when index_constraintKind => Scan_index_constraint(Root);
  22933.           when others => null;
  22934.         end case;
  22935.     end Scan_CONSTRAINT;
  22936.      
  22937.      
  22938.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator) is
  22939.     begin
  22940.         case Kind(Root) is
  22941.           when range_attribute_constraintKind => Scan_range_attribute_constraint(Root);
  22942.           when range_constraintKind => Scan_range_constraint(Root);
  22943.           when others => null;
  22944.         end case;
  22945.     end Scan_RANGE_CONSTRAINT_CLASS;
  22946.      
  22947.      
  22948.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator) is
  22949.     begin
  22950.       if not NAME_EXP.IsNull(as_range_exp(Root)) then
  22951.         Scan_NAME_EXP(as_range_exp(Root));
  22952.       end if;
  22953.      
  22954.      
  22955.      SERIES_UNIT_IH.R.ih_inlist := false;
  22956.      
  22957.      
  22958.      
  22959.     end Scan_range_attribute_constraint;
  22960.      
  22961.      
  22962.     procedure Scan_range_constraint(Root : range_constraintNode.Locator) is
  22963.     begin
  22964.      
  22965.      
  22966.       if IsSourceRange (lx_srcpos (root))
  22967.          and then
  22968.          not subtype_decl_IH.R.ih_in_subtype_decl
  22969.          then
  22970.            -- The check for subtype is necessary because in object_type
  22971.            -- we count range if it is a subtype.  This check prevents
  22972.            -- us from counting range twice.
  22973.           IncrementToken (rangez);
  22974.       end if;
  22975.      
  22976.      
  22977.       if not NAME_EXP.IsNull(as_range_exp1(Root)) then
  22978.         Scan_NAME_EXP(as_range_exp1(Root));
  22979.      
  22980.      
  22981.      IncrementToken (dot_dot_rangez);
  22982.      
  22983.      
  22984.       end if;
  22985.       if not NAME_EXP.IsNull(as_range_exp2(Root)) then
  22986.         Scan_NAME_EXP(as_range_exp2(Root));
  22987.       end if;
  22988.      
  22989.      
  22990.      SERIES_UNIT_IH.R.ih_inlist := false;
  22991.      
  22992.      
  22993.      
  22994.     end Scan_range_constraint;
  22995.      
  22996.      
  22997.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator) is
  22998.     begin
  22999.         case Kind(Root) is
  23000.           when fixed_constraintKind => Scan_fixed_constraint(Root);
  23001.           when float_constraintKind => Scan_float_constraint(Root);
  23002.           when others => null;
  23003.         end case;
  23004.     end Scan_REAL_CONSTRAINT;
  23005.      
  23006.      
  23007.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator) is
  23008.     begin
  23009.       if not NAME_EXP.IsNull(as_delta(Root)) then
  23010.         Scan_NAME_EXP(as_delta(Root));
  23011.       end if;
  23012.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  23013.         Scan_range_constraint(as_range_constraint(Root));
  23014.       end if;
  23015.      
  23016.      
  23017.      SERIES_UNIT_IH.R.ih_inlist := false;
  23018.      
  23019.      
  23020.      
  23021.     end Scan_fixed_constraint;
  23022.      
  23023.      
  23024.     procedure Scan_float_constraint(Root : float_constraintNode.Locator) is
  23025.     begin
  23026.       if not NAME_EXP.IsNull(as_digits(Root)) then
  23027.         Scan_NAME_EXP(as_digits(Root));
  23028.       end if;
  23029.       if not range_constraintNode.IsNull(as_range_constraint(Root)) then
  23030.         Scan_range_constraint(as_range_constraint(Root));
  23031.       end if;
  23032.      
  23033.      
  23034.      SERIES_UNIT_IH.R.ih_inlist := false;
  23035.      
  23036.      
  23037.      
  23038.     end Scan_float_constraint;
  23039.      
  23040.      
  23041.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator) is
  23042.         as_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  23043.         as_assoc_s_Item : GENERAL_ASSOC.Locator;
  23044.         use SeqOfGENERAL_ASSOC;
  23045.     begin
  23046.       if not SeqOfGENERAL_ASSOC.IsNull(as_assoc_s(Root)) then
  23047.         StartForward(as_assoc_s(Root), as_assoc_s_List);
  23048.         while not Finished(as_assoc_s_List) loop
  23049.             as_assoc_s_Item := Cell(as_assoc_s_List);
  23050.             Scan_GENERAL_ASSOC(as_assoc_s_Item);
  23051.             Forward(as_assoc_s_List);
  23052.         end loop;
  23053.         EndIterate(as_assoc_s_List);
  23054.       end if;
  23055.      
  23056.      
  23057.      SERIES_UNIT_IH.R.ih_inlist := false;
  23058.      
  23059.      
  23060.      
  23061.     end Scan_apply_constraint;
  23062.      
  23063.      
  23064.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator) is
  23065.         as_dscrmt_assoc_s_List : SeqOfAGG_COMPONENT.Generator;
  23066.         as_dscrmt_assoc_s_Item : AGG_COMPONENT.Locator;
  23067.         use SeqOfAGG_COMPONENT;
  23068.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  23069.     begin
  23070.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  23071.      
  23072.      
  23073.       IncrementToken (open_parenthesisz);
  23074.      
  23075.      
  23076.       if not SeqOfAGG_COMPONENT.IsNull(as_dscrmt_assoc_s(Root)) then
  23077.         StartForward(as_dscrmt_assoc_s(Root), as_dscrmt_assoc_s_List);
  23078.         while not Finished(as_dscrmt_assoc_s_List) loop
  23079.             as_dscrmt_assoc_s_Item := Cell(as_dscrmt_assoc_s_List);
  23080.      
  23081.      
  23082.       if SERIES_UNIT_IH.R.ih_inlist then
  23083.           IncrementToken (commaz);
  23084.       end if;
  23085.       SERIES_UNIT_IH.R.ih_inlist := true;
  23086.      
  23087.      
  23088.             Scan_AGG_COMPONENT(as_dscrmt_assoc_s_Item);
  23089.             Forward(as_dscrmt_assoc_s_List);
  23090.         end loop;
  23091.         EndIterate(as_dscrmt_assoc_s_List);
  23092.       end if;
  23093.      
  23094.      
  23095.       IncrementToken (closed_parenthesisz);
  23096.       SERIES_UNIT_IH.R.ih_inlist := false;
  23097.      
  23098.      
  23099.      
  23100.      
  23101.      SERIES_UNIT_IH.R.ih_inlist := false;
  23102.      
  23103.      
  23104.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  23105.      
  23106.     end Scan_dscrmt_constraint;
  23107.      
  23108.      
  23109.     procedure Scan_index_constraint(Root : index_constraintNode.Locator) is
  23110.         as_discrete_range_s_List : SeqOfOBJECT_TYPE.Generator;
  23111.         as_discrete_range_s_Item : OBJECT_TYPE.Locator;
  23112.         use SeqOfOBJECT_TYPE;
  23113.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  23114.     begin
  23115.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  23116.      
  23117.      
  23118.      IncrementToken (open_parenthesisz);
  23119.      
  23120.      
  23121.       if not SeqOfOBJECT_TYPE.IsNull(as_discrete_range_s(Root)) then
  23122.         StartForward(as_discrete_range_s(Root), as_discrete_range_s_List);
  23123.         while not Finished(as_discrete_range_s_List) loop
  23124.             as_discrete_range_s_Item := Cell(as_discrete_range_s_List);
  23125.      
  23126.      
  23127.       if SERIES_UNIT_IH.R.ih_inlist then
  23128.           IncrementToken (commaz);
  23129.       end if;
  23130.       SERIES_UNIT_IH.R.ih_inlist := true;
  23131.      
  23132.      
  23133.             Scan_OBJECT_TYPE(as_discrete_range_s_Item);
  23134.             Forward(as_discrete_range_s_List);
  23135.         end loop;
  23136.         EndIterate(as_discrete_range_s_List);
  23137.       end if;
  23138.      
  23139.      
  23140.       IncrementToken (closed_parenthesisz);
  23141.       SERIES_UNIT_IH.R.ih_inlist := false;
  23142.      
  23143.      
  23144.      
  23145.      
  23146.      SERIES_UNIT_IH.R.ih_inlist := false;
  23147.      
  23148.      
  23149.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  23150.      
  23151.     end Scan_index_constraint;
  23152.      
  23153. end CONSTRAINT_Pkg;
  23154. -- End: SCCONSTRAINT bdy -----------------------------------------------------
  23155. ::::::::::::::
  23156. scconstra.spc
  23157. ::::::::::::::
  23158. -- Begin: SCCONSTRAINT spc ---------------------------------------------------
  23159.      
  23160. with ST_DIANA; use ST_DIANA;
  23161.              package CONSTRAINT_Pkg is
  23162.     procedure Scan_CONSTRAINT(Root : CONSTRAINT.Locator);
  23163.     procedure Scan_RANGE_CONSTRAINT_CLASS(Root : RANGE_CONSTRAINT_CLASS.Locator);
  23164.     procedure Scan_range_attribute_constraint(Root : range_attribute_constraintNode.Locator);
  23165.     procedure Scan_range_constraint(Root : range_constraintNode.Locator);
  23166.     procedure Scan_REAL_CONSTRAINT(Root : REAL_CONSTRAINT.Locator);
  23167.     procedure Scan_fixed_constraint(Root : fixed_constraintNode.Locator);
  23168.     procedure Scan_float_constraint(Root : float_constraintNode.Locator);
  23169.     procedure Scan_apply_constraint(Root : apply_constraintNode.Locator);
  23170.     procedure Scan_dscrmt_constraint(Root : dscrmt_constraintNode.Locator);
  23171.     procedure Scan_index_constraint(Root : index_constraintNode.Locator);
  23172. end CONSTRAINT_Pkg;
  23173. -- End: SCCONSTRAINT spc -----------------------------------------------------
  23174. ::::::::::::::
  23175. scdef_id.bdy
  23176. ::::::::::::::
  23177. --VMS file: %nosc.work.tools.halstead.source*(SCDEF_ID.bdy)
  23178. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCDEF_ID.bdy
  23179. -- Begin: SCDEF_ID bdy ---------------------------------------------------
  23180.      
  23181. with Halstead_Data_Base;  use Halstead_Data_Base;
  23182. with Definitions; use Definitions;
  23183.      
  23184.            with variable_decl_IH;
  23185.            with type_decl_IH;
  23186.            with Identifier_Utilities;
  23187.                      package body DEF_ID_Pkg is
  23188.      
  23189.      
  23190.     procedure Scan_DEF_ID(Root : DEF_ID.Locator) is
  23191.     begin
  23192.         case Kind(Root) is
  23193.           when ATTRIBUTE_IDKind => Scan_ATTRIBUTE_ID(Root);
  23194.           when BUILT_IN_OPERATORKind => Scan_BUILT_IN_OPERATOR(Root);
  23195.           when GENERAL_TYPE_IDKind => Scan_GENERAL_TYPE_ID(Root);
  23196.           when LITERAL_IDKind => Scan_LITERAL_ID(Root);
  23197.           when OBJECT_IDKind => Scan_OBJECT_ID(Root);
  23198.           when PKG_ID_CLASSKind => Scan_PKG_ID_CLASS(Root);
  23199.           when PRAGMA_IDKind => Scan_PRAGMA_ID(Root);
  23200.           when STM_IDKind => Scan_STM_ID(Root);
  23201.           when SUBP_IDKind => Scan_SUBP_ID(Root);
  23202.           when argument_idKind => Scan_argument_id(Root);
  23203.           when exception_idKind => Scan_exception_id(Root);
  23204.           when iteration_idKind => Scan_iteration_id(Root);
  23205.           when number_idKind => Scan_number_id(Root);
  23206.           when subtype_idKind => Scan_subtype_id(Root);
  23207.           when task_body_idKind => Scan_task_body_id(Root);
  23208.           when others => null;
  23209.         end case;
  23210.     end Scan_DEF_ID;
  23211.      
  23212.      
  23213.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator) is
  23214.     begin
  23215.         case Kind(Root) is
  23216.           when LRM_ATTRIBUTE_IDKind => Scan_LRM_ATTRIBUTE_ID(Root);
  23217.           when others => null;
  23218.         end case;
  23219.     end Scan_ATTRIBUTE_ID;
  23220.      
  23221.      
  23222.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator) is
  23223.     begin
  23224.         case Kind(Root) is
  23225.           when address_idKind => Scan_address_id(Root);
  23226.           when aft_idKind => Scan_aft_id(Root);
  23227.           when base_idKind => Scan_base_id(Root);
  23228.           when callable_idKind => Scan_callable_id(Root);
  23229.           when constrained_idKind => Scan_constrained_id(Root);
  23230.           when count_idKind => Scan_count_id(Root);
  23231.           when delta_idKind => Scan_delta_id(Root);
  23232.           when digits_idKind => Scan_digits_id(Root);
  23233.           when emax_idKind => Scan_emax_id(Root);
  23234.           when epsilon_idKind => Scan_epsilon_id(Root);
  23235.           when first_bit_idKind => Scan_first_bit_id(Root);
  23236.           when first_index_idKind => Scan_first_index_id(Root);
  23237.           when first_scalar_idKind => Scan_first_scalar_id(Root);
  23238.           when fore_idKind => Scan_fore_id(Root);
  23239.           when image_idKind => Scan_image_id(Root);
  23240.           when large_idKind => Scan_large_id(Root);
  23241.           when last_bit_idKind => Scan_last_bit_id(Root);
  23242.           when last_index_idKind => Scan_last_index_id(Root);
  23243.           when last_scalar_idKind => Scan_last_scalar_id(Root);
  23244.           when length_idKind => Scan_length_id(Root);
  23245.           when machine_emax_idKind => Scan_machine_emax_id(Root);
  23246.           when machine_emin_idKind => Scan_machine_emin_id(Root);
  23247.           when machine_mantissa_idKind => Scan_machine_mantissa_id(Root);
  23248.           when machine_overflows_idKind => Scan_machine_overflows_id(Root);
  23249.           when machine_radix_idKind => Scan_machine_radix_id(Root);
  23250.           when machine_rounds_idKind => Scan_machine_rounds_id(Root);
  23251.           when mantissa_idKind => Scan_mantissa_id(Root);
  23252.           when pos_idKind => Scan_pos_id(Root);
  23253.           when position_idKind => Scan_position_id(Root);
  23254.           when pred_idKind => Scan_pred_id(Root);
  23255.           when range_idKind => Scan_range_id(Root);
  23256.           when safe_emax_idKind => Scan_safe_emax_id(Root);
  23257.           when safe_large_idKind => Scan_safe_large_id(Root);
  23258.           when safe_small_idKind => Scan_safe_small_id(Root);
  23259.           when size_objects_idKind => Scan_size_objects_id(Root);
  23260.           when size_type_idKind => Scan_size_type_id(Root);
  23261.           when small_idKind => Scan_small_id(Root);
  23262.           when storage_size_collection_idKind => Scan_storage_size_collection_id(Root);
  23263.           when storage_size_task_idKind => Scan_storage_size_task_id(Root);
  23264.           when succ_idKind => Scan_succ_id(Root);
  23265.           when terminated_idKind => Scan_terminated_id(Root);
  23266.           when val_idKind => Scan_val_id(Root);
  23267.           when value_idKind => Scan_value_id(Root);
  23268.           when width_idKind => Scan_width_id(Root);
  23269.           when others => null;
  23270.         end case;
  23271.     end Scan_LRM_ATTRIBUTE_ID;
  23272.      
  23273.      
  23274.     procedure Scan_address_id(Root : address_idNode.Locator) is
  23275.     begin
  23276.      
  23277.      
  23278.        if not Identifier_Utilities.Is_Id_Null (root) then
  23279.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23280.        end if;
  23281.      
  23282.      
  23283.      
  23284.     end Scan_address_id;
  23285.      
  23286.      
  23287.     procedure Scan_aft_id(Root : aft_idNode.Locator) is
  23288.     begin
  23289.      
  23290.      
  23291.        if not Identifier_Utilities.Is_Id_Null (root) then
  23292.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23293.        end if;
  23294.      
  23295.      
  23296.      
  23297.     end Scan_aft_id;
  23298.      
  23299.      
  23300.     procedure Scan_base_id(Root : base_idNode.Locator) is
  23301.     begin
  23302.      
  23303.      
  23304.        if not Identifier_Utilities.Is_Id_Null (root) then
  23305.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23306.        end if;
  23307.      
  23308.      
  23309.      
  23310.     end Scan_base_id;
  23311.      
  23312.      
  23313.     procedure Scan_callable_id(Root : callable_idNode.Locator) is
  23314.     begin
  23315.      
  23316.      
  23317.        if not Identifier_Utilities.Is_Id_Null (root) then
  23318.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23319.        end if;
  23320.      
  23321.      
  23322.      
  23323.     end Scan_callable_id;
  23324.      
  23325.      
  23326.     procedure Scan_constrained_id(Root : constrained_idNode.Locator) is
  23327.     begin
  23328.      
  23329.      
  23330.        if not Identifier_Utilities.Is_Id_Null (root) then
  23331.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23332.        end if;
  23333.      
  23334.      
  23335.      
  23336.     end Scan_constrained_id;
  23337.      
  23338.      
  23339.     procedure Scan_count_id(Root : count_idNode.Locator) is
  23340.     begin
  23341.      
  23342.      
  23343.        if not Identifier_Utilities.Is_Id_Null (root) then
  23344.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23345.        end if;
  23346.      
  23347.      
  23348.      
  23349.     end Scan_count_id;
  23350.      
  23351.      
  23352.     procedure Scan_delta_id(Root : delta_idNode.Locator) is
  23353.     begin
  23354.      
  23355.      
  23356.        if not Identifier_Utilities.Is_Id_Null (root) then
  23357.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23358.        end if;
  23359.      
  23360.      
  23361.      
  23362.     end Scan_delta_id;
  23363.      
  23364.      
  23365.     procedure Scan_digits_id(Root : digits_idNode.Locator) is
  23366.     begin
  23367.      
  23368.      
  23369.        if not Identifier_Utilities.Is_Id_Null (root) then
  23370.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23371.        end if;
  23372.      
  23373.      
  23374.      
  23375.     end Scan_digits_id;
  23376.      
  23377.      
  23378.     procedure Scan_emax_id(Root : emax_idNode.Locator) is
  23379.     begin
  23380.      
  23381.      
  23382.        if not Identifier_Utilities.Is_Id_Null (root) then
  23383.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23384.        end if;
  23385.      
  23386.      
  23387.      
  23388.     end Scan_emax_id;
  23389.      
  23390.      
  23391.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator) is
  23392.     begin
  23393.      
  23394.      
  23395.        if not Identifier_Utilities.Is_Id_Null (root) then
  23396.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23397.        end if;
  23398.      
  23399.      
  23400.      
  23401.     end Scan_epsilon_id;
  23402.      
  23403.      
  23404.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator) is
  23405.     begin
  23406.      
  23407.      
  23408.        if not Identifier_Utilities.Is_Id_Null (root) then
  23409.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23410.        end if;
  23411.      
  23412.      
  23413.      
  23414.     end Scan_first_bit_id;
  23415.      
  23416.      
  23417.     procedure Scan_first_index_id(Root : first_index_idNode.Locator) is
  23418.     begin
  23419.      
  23420.      
  23421.        if not Identifier_Utilities.Is_Id_Null (root) then
  23422.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23423.        end if;
  23424.      
  23425.      
  23426.      
  23427.     end Scan_first_index_id;
  23428.      
  23429.      
  23430.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator) is
  23431.     begin
  23432.      
  23433.      
  23434.        if not Identifier_Utilities.Is_Id_Null (root) then
  23435.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23436.        end if;
  23437.      
  23438.      
  23439.      
  23440.     end Scan_first_scalar_id;
  23441.      
  23442.      
  23443.     procedure Scan_fore_id(Root : fore_idNode.Locator) is
  23444.     begin
  23445.      
  23446.      
  23447.        if not Identifier_Utilities.Is_Id_Null (root) then
  23448.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23449.        end if;
  23450.      
  23451.      
  23452.      
  23453.     end Scan_fore_id;
  23454.      
  23455.      
  23456.     procedure Scan_image_id(Root : image_idNode.Locator) is
  23457.     begin
  23458.      
  23459.      
  23460.        if not Identifier_Utilities.Is_Id_Null (root) then
  23461.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23462.        end if;
  23463.      
  23464.      
  23465.      
  23466.     end Scan_image_id;
  23467.      
  23468.      
  23469.     procedure Scan_large_id(Root : large_idNode.Locator) is
  23470.     begin
  23471.      
  23472.      
  23473.        if not Identifier_Utilities.Is_Id_Null (root) then
  23474.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23475.        end if;
  23476.      
  23477.      
  23478.      
  23479.     end Scan_large_id;
  23480.      
  23481.      
  23482.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator) is
  23483.     begin
  23484.      
  23485.      
  23486.        if not Identifier_Utilities.Is_Id_Null (root) then
  23487.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23488.        end if;
  23489.      
  23490.      
  23491.      
  23492.     end Scan_last_bit_id;
  23493.      
  23494.      
  23495.     procedure Scan_last_index_id(Root : last_index_idNode.Locator) is
  23496.     begin
  23497.      
  23498.      
  23499.        if not Identifier_Utilities.Is_Id_Null (root) then
  23500.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23501.        end if;
  23502.      
  23503.      
  23504.      
  23505.     end Scan_last_index_id;
  23506.      
  23507.      
  23508.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator) is
  23509.     begin
  23510.      
  23511.      
  23512.        if not Identifier_Utilities.Is_Id_Null (root) then
  23513.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23514.        end if;
  23515.      
  23516.      
  23517.      
  23518.     end Scan_last_scalar_id;
  23519.      
  23520.      
  23521.     procedure Scan_length_id(Root : length_idNode.Locator) is
  23522.     begin
  23523.      
  23524.      
  23525.        if not Identifier_Utilities.Is_Id_Null (root) then
  23526.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23527.        end if;
  23528.      
  23529.      
  23530.      
  23531.     end Scan_length_id;
  23532.      
  23533.      
  23534.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator) is
  23535.     begin
  23536.      
  23537.      
  23538.        if not Identifier_Utilities.Is_Id_Null (root) then
  23539.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23540.        end if;
  23541.      
  23542.      
  23543.      
  23544.     end Scan_machine_emax_id;
  23545.      
  23546.      
  23547.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator) is
  23548.     begin
  23549.      
  23550.      
  23551.        if not Identifier_Utilities.Is_Id_Null (root) then
  23552.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23553.        end if;
  23554.      
  23555.      
  23556.      
  23557.     end Scan_machine_emin_id;
  23558.      
  23559.      
  23560.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator) is
  23561.     begin
  23562.      
  23563.      
  23564.        if not Identifier_Utilities.Is_Id_Null (root) then
  23565.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23566.        end if;
  23567.      
  23568.      
  23569.      
  23570.     end Scan_machine_mantissa_id;
  23571.      
  23572.      
  23573.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator) is
  23574.     begin
  23575.      
  23576.      
  23577.        if not Identifier_Utilities.Is_Id_Null (root) then
  23578.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23579.        end if;
  23580.      
  23581.      
  23582.      
  23583.     end Scan_machine_overflows_id;
  23584.      
  23585.      
  23586.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator) is
  23587.     begin
  23588.      
  23589.      
  23590.        if not Identifier_Utilities.Is_Id_Null (root) then
  23591.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23592.        end if;
  23593.      
  23594.      
  23595.      
  23596.     end Scan_machine_radix_id;
  23597.      
  23598.      
  23599.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator) is
  23600.     begin
  23601.      
  23602.      
  23603.        if not Identifier_Utilities.Is_Id_Null (root) then
  23604.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23605.        end if;
  23606.      
  23607.      
  23608.      
  23609.     end Scan_machine_rounds_id;
  23610.      
  23611.      
  23612.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator) is
  23613.     begin
  23614.      
  23615.      
  23616.        if not Identifier_Utilities.Is_Id_Null (root) then
  23617.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23618.        end if;
  23619.      
  23620.      
  23621.      
  23622.     end Scan_mantissa_id;
  23623.      
  23624.      
  23625.     procedure Scan_pos_id(Root : pos_idNode.Locator) is
  23626.     begin
  23627.      
  23628.      
  23629.        if not Identifier_Utilities.Is_Id_Null (root) then
  23630.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23631.        end if;
  23632.      
  23633.      
  23634.      
  23635.     end Scan_pos_id;
  23636.      
  23637.      
  23638.     procedure Scan_position_id(Root : position_idNode.Locator) is
  23639.     begin
  23640.      
  23641.      
  23642.        if not Identifier_Utilities.Is_Id_Null (root) then
  23643.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23644.        end if;
  23645.      
  23646.      
  23647.      
  23648.     end Scan_position_id;
  23649.      
  23650.      
  23651.     procedure Scan_pred_id(Root : pred_idNode.Locator) is
  23652.     begin
  23653.      
  23654.      
  23655.        if not Identifier_Utilities.Is_Id_Null (root) then
  23656.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23657.        end if;
  23658.      
  23659.      
  23660.      
  23661.     end Scan_pred_id;
  23662.      
  23663.      
  23664.     procedure Scan_range_id(Root : range_idNode.Locator) is
  23665.     begin
  23666.      
  23667.      
  23668.        if not Identifier_Utilities.Is_Id_Null (root) then
  23669.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23670.        end if;
  23671.      
  23672.      
  23673.      
  23674.     end Scan_range_id;
  23675.      
  23676.      
  23677.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator) is
  23678.     begin
  23679.      
  23680.      
  23681.        if not Identifier_Utilities.Is_Id_Null (root) then
  23682.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23683.        end if;
  23684.      
  23685.      
  23686.      
  23687.     end Scan_safe_emax_id;
  23688.      
  23689.      
  23690.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator) is
  23691.     begin
  23692.      
  23693.      
  23694.        if not Identifier_Utilities.Is_Id_Null (root) then
  23695.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23696.        end if;
  23697.      
  23698.      
  23699.      
  23700.     end Scan_safe_large_id;
  23701.      
  23702.      
  23703.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator) is
  23704.     begin
  23705.      
  23706.      
  23707.        if not Identifier_Utilities.Is_Id_Null (root) then
  23708.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23709.        end if;
  23710.      
  23711.      
  23712.      
  23713.     end Scan_safe_small_id;
  23714.      
  23715.      
  23716.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator) is
  23717.     begin
  23718.      
  23719.      
  23720.        if not Identifier_Utilities.Is_Id_Null (root) then
  23721.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23722.        end if;
  23723.      
  23724.      
  23725.      
  23726.     end Scan_size_objects_id;
  23727.      
  23728.      
  23729.     procedure Scan_size_type_id(Root : size_type_idNode.Locator) is
  23730.     begin
  23731.      
  23732.      
  23733.        if not Identifier_Utilities.Is_Id_Null (root) then
  23734.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23735.        end if;
  23736.      
  23737.      
  23738.      
  23739.     end Scan_size_type_id;
  23740.      
  23741.      
  23742.     procedure Scan_small_id(Root : small_idNode.Locator) is
  23743.     begin
  23744.      
  23745.      
  23746.        if not Identifier_Utilities.Is_Id_Null (root) then
  23747.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23748.        end if;
  23749.      
  23750.      
  23751.      
  23752.     end Scan_small_id;
  23753.      
  23754.      
  23755.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator) is
  23756.     begin
  23757.      
  23758.      
  23759.        if not Identifier_Utilities.Is_Id_Null (root) then
  23760.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23761.        end if;
  23762.      
  23763.      
  23764.      
  23765.     end Scan_storage_size_collection_id;
  23766.      
  23767.      
  23768.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator) is
  23769.     begin
  23770.      
  23771.      
  23772.        if not Identifier_Utilities.Is_Id_Null (root) then
  23773.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23774.        end if;
  23775.      
  23776.      
  23777.      
  23778.     end Scan_storage_size_task_id;
  23779.      
  23780.      
  23781.     procedure Scan_succ_id(Root : succ_idNode.Locator) is
  23782.     begin
  23783.      
  23784.      
  23785.        if not Identifier_Utilities.Is_Id_Null (root) then
  23786.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23787.        end if;
  23788.      
  23789.      
  23790.      
  23791.     end Scan_succ_id;
  23792.      
  23793.      
  23794.     procedure Scan_terminated_id(Root : terminated_idNode.Locator) is
  23795.     begin
  23796.      
  23797.      
  23798.        if not Identifier_Utilities.Is_Id_Null (root) then
  23799.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23800.        end if;
  23801.      
  23802.      
  23803.      
  23804.     end Scan_terminated_id;
  23805.      
  23806.      
  23807.     procedure Scan_val_id(Root : val_idNode.Locator) is
  23808.     begin
  23809.      
  23810.      
  23811.        if not Identifier_Utilities.Is_Id_Null (root) then
  23812.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23813.        end if;
  23814.      
  23815.      
  23816.      
  23817.     end Scan_val_id;
  23818.      
  23819.      
  23820.     procedure Scan_value_id(Root : value_idNode.Locator) is
  23821.     begin
  23822.      
  23823.      
  23824.        if not Identifier_Utilities.Is_Id_Null (root) then
  23825.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23826.        end if;
  23827.      
  23828.      
  23829.      
  23830.     end Scan_value_id;
  23831.      
  23832.      
  23833.     procedure Scan_width_id(Root : width_idNode.Locator) is
  23834.     begin
  23835.      
  23836.      
  23837.        if not Identifier_Utilities.Is_Id_Null (root) then
  23838.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23839.        end if;
  23840.      
  23841.      
  23842.      
  23843.     end Scan_width_id;
  23844.      
  23845.      
  23846.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator) is
  23847.     begin
  23848.         case Kind(Root) is
  23849.           when built_in_absKind => Scan_built_in_abs(Root);
  23850.           when built_in_andKind => Scan_built_in_and(Root);
  23851.           when built_in_modKind => Scan_built_in_mod(Root);
  23852.           when built_in_notKind => Scan_built_in_not(Root);
  23853.           when built_in_orKind => Scan_built_in_or(Root);
  23854.           when built_in_remKind => Scan_built_in_rem(Root);
  23855.           when built_in_xorKind => Scan_built_in_xor(Root);
  23856.           when concatenateKind => Scan_concatenate(Root);
  23857.           when divideKind => Scan_divide(Root);
  23858.           when equalKind => Scan_equal(Root);
  23859.           when exponentKind => Scan_exponent(Root);
  23860.           when greater_thanKind => Scan_greater_than(Root);
  23861.           when greater_than_or_equalKind => Scan_greater_than_or_equal(Root);
  23862.           when less_thanKind => Scan_less_than(Root);
  23863.           when less_than_or_equalKind => Scan_less_than_or_equal(Root);
  23864.           when minusKind => Scan_minus(Root);
  23865.           when multiplyKind => Scan_multiply(Root);
  23866.           when negateKind => Scan_negate(Root);
  23867.           when not_equalKind => Scan_not_equal(Root);
  23868.           when plusKind => Scan_plus(Root);
  23869.           when unary_plusKind => Scan_unary_plus(Root);
  23870.           when others => null;
  23871.         end case;
  23872.     end Scan_BUILT_IN_OPERATOR;
  23873.      
  23874.      
  23875.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator) is
  23876.     begin
  23877.      
  23878.      
  23879.        if not Identifier_Utilities.Is_Id_Null (root) then
  23880.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23881.        end if;
  23882.      
  23883.      
  23884.      
  23885.     end Scan_built_in_abs;
  23886.      
  23887.      
  23888.     procedure Scan_built_in_and(Root : built_in_andNode.Locator) is
  23889.     begin
  23890.      
  23891.      
  23892.        if not Identifier_Utilities.Is_Id_Null (root) then
  23893.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23894.        end if;
  23895.      
  23896.      
  23897.      
  23898.     end Scan_built_in_and;
  23899.      
  23900.      
  23901.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator) is
  23902.     begin
  23903.      
  23904.      
  23905.        if not Identifier_Utilities.Is_Id_Null (root) then
  23906.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23907.        end if;
  23908.      
  23909.      
  23910.      
  23911.     end Scan_built_in_mod;
  23912.      
  23913.      
  23914.     procedure Scan_built_in_not(Root : built_in_notNode.Locator) is
  23915.     begin
  23916.      
  23917.      
  23918.        if not Identifier_Utilities.Is_Id_Null (root) then
  23919.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23920.        end if;
  23921.      
  23922.      
  23923.      
  23924.     end Scan_built_in_not;
  23925.      
  23926.      
  23927.     procedure Scan_built_in_or(Root : built_in_orNode.Locator) is
  23928.     begin
  23929.      
  23930.      
  23931.        if not Identifier_Utilities.Is_Id_Null (root) then
  23932.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23933.        end if;
  23934.      
  23935.      
  23936.      
  23937.     end Scan_built_in_or;
  23938.      
  23939.      
  23940.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator) is
  23941.     begin
  23942.      
  23943.      
  23944.        if not Identifier_Utilities.Is_Id_Null (root) then
  23945.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23946.        end if;
  23947.      
  23948.      
  23949.      
  23950.     end Scan_built_in_rem;
  23951.      
  23952.      
  23953.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator) is
  23954.     begin
  23955.      
  23956.      
  23957.        if not Identifier_Utilities.Is_Id_Null (root) then
  23958.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23959.        end if;
  23960.      
  23961.      
  23962.      
  23963.     end Scan_built_in_xor;
  23964.      
  23965.      
  23966.     procedure Scan_concatenate(Root : concatenateNode.Locator) is
  23967.     begin
  23968.      
  23969.      
  23970.        if not Identifier_Utilities.Is_Id_Null (root) then
  23971.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23972.        end if;
  23973.      
  23974.      
  23975.      
  23976.     end Scan_concatenate;
  23977.      
  23978.      
  23979.     procedure Scan_divide(Root : divideNode.Locator) is
  23980.     begin
  23981.      
  23982.      
  23983.        if not Identifier_Utilities.Is_Id_Null (root) then
  23984.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23985.        end if;
  23986.      
  23987.      
  23988.      
  23989.     end Scan_divide;
  23990.      
  23991.      
  23992.     procedure Scan_equal(Root : equalNode.Locator) is
  23993.     begin
  23994.      
  23995.      
  23996.        if not Identifier_Utilities.Is_Id_Null (root) then
  23997.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  23998.        end if;
  23999.      
  24000.      
  24001.      
  24002.     end Scan_equal;
  24003.      
  24004.      
  24005.     procedure Scan_exponent(Root : exponentNode.Locator) is
  24006.     begin
  24007.      
  24008.      
  24009.        if not Identifier_Utilities.Is_Id_Null (root) then
  24010.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24011.        end if;
  24012.      
  24013.      
  24014.      
  24015.     end Scan_exponent;
  24016.      
  24017.      
  24018.     procedure Scan_greater_than(Root : greater_thanNode.Locator) is
  24019.     begin
  24020.      
  24021.      
  24022.        if not Identifier_Utilities.Is_Id_Null (root) then
  24023.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24024.        end if;
  24025.      
  24026.      
  24027.      
  24028.     end Scan_greater_than;
  24029.      
  24030.      
  24031.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator) is
  24032.     begin
  24033.      
  24034.      
  24035.        if not Identifier_Utilities.Is_Id_Null (root) then
  24036.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24037.        end if;
  24038.      
  24039.      
  24040.      
  24041.     end Scan_greater_than_or_equal;
  24042.      
  24043.      
  24044.     procedure Scan_less_than(Root : less_thanNode.Locator) is
  24045.     begin
  24046.      
  24047.      
  24048.        if not Identifier_Utilities.Is_Id_Null (root) then
  24049.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24050.        end if;
  24051.      
  24052.      
  24053.      
  24054.     end Scan_less_than;
  24055.      
  24056.      
  24057.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator) is
  24058.     begin
  24059.      
  24060.      
  24061.        if not Identifier_Utilities.Is_Id_Null (root) then
  24062.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24063.        end if;
  24064.      
  24065.      
  24066.      
  24067.     end Scan_less_than_or_equal;
  24068.      
  24069.      
  24070.     procedure Scan_minus(Root : minusNode.Locator) is
  24071.     begin
  24072.      
  24073.      
  24074.        if not Identifier_Utilities.Is_Id_Null (root) then
  24075.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24076.        end if;
  24077.      
  24078.      
  24079.      
  24080.     end Scan_minus;
  24081.      
  24082.      
  24083.     procedure Scan_multiply(Root : multiplyNode.Locator) is
  24084.     begin
  24085.      
  24086.      
  24087.        if not Identifier_Utilities.Is_Id_Null (root) then
  24088.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24089.        end if;
  24090.      
  24091.      
  24092.      
  24093.     end Scan_multiply;
  24094.      
  24095.      
  24096.     procedure Scan_negate(Root : negateNode.Locator) is
  24097.     begin
  24098.      
  24099.      
  24100.        if not Identifier_Utilities.Is_Id_Null (root) then
  24101.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24102.        end if;
  24103.      
  24104.      
  24105.      
  24106.     end Scan_negate;
  24107.      
  24108.      
  24109.     procedure Scan_not_equal(Root : not_equalNode.Locator) is
  24110.     begin
  24111.      
  24112.      
  24113.        if not Identifier_Utilities.Is_Id_Null (root) then
  24114.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24115.        end if;
  24116.      
  24117.      
  24118.      
  24119.     end Scan_not_equal;
  24120.      
  24121.      
  24122.     procedure Scan_plus(Root : plusNode.Locator) is
  24123.     begin
  24124.      
  24125.      
  24126.        if not Identifier_Utilities.Is_Id_Null (root) then
  24127.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24128.        end if;
  24129.      
  24130.      
  24131.      
  24132.     end Scan_plus;
  24133.      
  24134.      
  24135.     procedure Scan_unary_plus(Root : unary_plusNode.Locator) is
  24136.     begin
  24137.      
  24138.      
  24139.        if not Identifier_Utilities.Is_Id_Null (root) then
  24140.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24141.        end if;
  24142.      
  24143.      
  24144.      
  24145.     end Scan_unary_plus;
  24146.      
  24147.      
  24148.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator) is
  24149.     begin
  24150.         case Kind(Root) is
  24151.           when lim_priv_type_idKind => Scan_lim_priv_type_id(Root);
  24152.           when priv_type_idKind => Scan_priv_type_id(Root);
  24153.           when type_idKind => Scan_type_id(Root);
  24154.           when others => null;
  24155.         end case;
  24156.     end Scan_GENERAL_TYPE_ID;
  24157.      
  24158.      
  24159.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator) is
  24160.     begin
  24161.      
  24162.      
  24163.        if not Identifier_Utilities.Is_Id_Null (root) then
  24164.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24165.        end if;
  24166.      
  24167.      
  24168.      
  24169.     end Scan_lim_priv_type_id;
  24170.      
  24171.      
  24172.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator) is
  24173.     begin
  24174.      
  24175.      
  24176.        if not Identifier_Utilities.Is_Id_Null (root) then
  24177.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24178.        end if;
  24179.      
  24180.      
  24181.      
  24182.     end Scan_priv_type_id;
  24183.      
  24184.      
  24185.     procedure Scan_type_id(Root : type_idNode.Locator) is
  24186.     begin
  24187.      
  24188.      
  24189.        if not Identifier_Utilities.Is_Id_Null (root) then
  24190.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24191.        end if;
  24192.      
  24193.      
  24194.      
  24195.     end Scan_type_id;
  24196.      
  24197.      
  24198.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator) is
  24199.     begin
  24200.         case Kind(Root) is
  24201.           when def_charKind => Scan_def_char(Root);
  24202.           when enum_idKind => Scan_enum_id(Root);
  24203.           when others => null;
  24204.         end case;
  24205.     end Scan_LITERAL_ID;
  24206.      
  24207.      
  24208.     procedure Scan_def_char(Root : def_charNode.Locator) is
  24209.     begin
  24210.      
  24211.      
  24212.        if not Identifier_Utilities.Is_Id_Null (root) then
  24213.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24214.        end if;
  24215.      
  24216.      
  24217.      
  24218.     end Scan_def_char;
  24219.      
  24220.      
  24221.     procedure Scan_enum_id(Root : enum_idNode.Locator) is
  24222.     begin
  24223.      
  24224.      
  24225.        if not Identifier_Utilities.Is_Id_Null (root) then
  24226.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24227.        end if;
  24228.      
  24229.      
  24230.      
  24231.     end Scan_enum_id;
  24232.      
  24233.      
  24234.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator) is
  24235.     begin
  24236.         case Kind(Root) is
  24237.           when PARAM_IDKind => Scan_PARAM_ID(Root);
  24238.           when component_idKind => Scan_component_id(Root);
  24239.           when constant_idKind => Scan_constant_id(Root);
  24240.           when dscrmt_idKind => Scan_dscrmt_id(Root);
  24241.           when variable_idKind => Scan_variable_id(Root);
  24242.           when others => null;
  24243.         end case;
  24244.     end Scan_OBJECT_ID;
  24245.      
  24246.      
  24247.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator) is
  24248.     begin
  24249.         case Kind(Root) is
  24250.           when in_idKind => Scan_in_id(Root);
  24251.           when in_out_idKind => Scan_in_out_id(Root);
  24252.           when out_idKind => Scan_out_id(Root);
  24253.           when others => null;
  24254.         end case;
  24255.     end Scan_PARAM_ID;
  24256.      
  24257.      
  24258.     procedure Scan_in_id(Root : in_idNode.Locator) is
  24259.     begin
  24260.      
  24261.      
  24262.        if not Identifier_Utilities.Is_Id_Null (root) then
  24263.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24264.        end if;
  24265.      
  24266.      
  24267.      
  24268.     end Scan_in_id;
  24269.      
  24270.      
  24271.     procedure Scan_in_out_id(Root : in_out_idNode.Locator) is
  24272.     begin
  24273.      
  24274.      
  24275.        if not Identifier_Utilities.Is_Id_Null (root) then
  24276.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24277.        end if;
  24278.      
  24279.      
  24280.      
  24281.     end Scan_in_out_id;
  24282.      
  24283.      
  24284.     procedure Scan_out_id(Root : out_idNode.Locator) is
  24285.     begin
  24286.      
  24287.      
  24288.        if not Identifier_Utilities.Is_Id_Null (root) then
  24289.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24290.        end if;
  24291.      
  24292.      
  24293.      
  24294.     end Scan_out_id;
  24295.      
  24296.      
  24297.     procedure Scan_component_id(Root : component_idNode.Locator) is
  24298.     begin
  24299.      
  24300.      
  24301.        if not Identifier_Utilities.Is_Id_Null (root) then
  24302.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24303.        end if;
  24304.      
  24305.      
  24306.      
  24307.     end Scan_component_id;
  24308.      
  24309.      
  24310.     procedure Scan_constant_id(Root : constant_idNode.Locator) is
  24311.     begin
  24312.      
  24313.      
  24314.        if not Identifier_Utilities.Is_Id_Null (root) then
  24315.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24316.        end if;
  24317.      
  24318.      
  24319.      
  24320.     end Scan_constant_id;
  24321.      
  24322.      
  24323.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator) is
  24324.     begin
  24325.      
  24326.      
  24327.        if not Identifier_Utilities.Is_Id_Null (root) then
  24328.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24329.        end if;
  24330.      
  24331.      
  24332.      
  24333.     end Scan_dscrmt_id;
  24334.      
  24335.      
  24336.     procedure Scan_variable_id(Root : variable_idNode.Locator) is
  24337.     begin
  24338.      
  24339.      
  24340.        if not Identifier_Utilities.Is_Id_Null (root) then
  24341.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24342.        end if;
  24343.      
  24344.      
  24345.      
  24346.     end Scan_variable_id;
  24347.      
  24348.      
  24349.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator) is
  24350.     begin
  24351.         case Kind(Root) is
  24352.           when generic_pkg_idKind => Scan_generic_pkg_id(Root);
  24353.           when pkg_idKind => Scan_pkg_id(Root);
  24354.           when others => null;
  24355.         end case;
  24356.     end Scan_PKG_ID_CLASS;
  24357.      
  24358.      
  24359.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator) is
  24360.     begin
  24361.      
  24362.      
  24363.        if not Identifier_Utilities.Is_Id_Null (root) then
  24364.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24365.        end if;
  24366.      
  24367.      
  24368.      
  24369.     end Scan_generic_pkg_id;
  24370.      
  24371.      
  24372.     procedure Scan_pkg_id(Root : pkg_idNode.Locator) is
  24373.     begin
  24374.      
  24375.      
  24376.        if not Identifier_Utilities.Is_Id_Null (root) then
  24377.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24378.        end if;
  24379.      
  24380.      
  24381.      
  24382.     end Scan_pkg_id;
  24383.      
  24384.      
  24385.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator) is
  24386.     begin
  24387.         case Kind(Root) is
  24388.           when AIE_PRAGMA_IDKind => Scan_AIE_PRAGMA_ID(Root);
  24389.           when LRM_PRAGMA_IDKind => Scan_LRM_PRAGMA_ID(Root);
  24390.           when others => null;
  24391.         end case;
  24392.     end Scan_PRAGMA_ID;
  24393.      
  24394.      
  24395.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator) is
  24396.     begin
  24397.         case Kind(Root) is
  24398.           when link_name_pragmaKind => Scan_link_name_pragma(Root);
  24399.           when mark_release_pragmaKind => Scan_mark_release_pragma(Root);
  24400.           when monitor_pragmaKind => Scan_monitor_pragma(Root);
  24401.           when unrecognized_pragmaKind => Scan_unrecognized_pragma(Root);
  24402.           when others => null;
  24403.         end case;
  24404.     end Scan_AIE_PRAGMA_ID;
  24405.      
  24406.      
  24407.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator) is
  24408.     begin
  24409.      
  24410.      
  24411.        if not Identifier_Utilities.Is_Id_Null (root) then
  24412.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24413.        end if;
  24414.      
  24415.      
  24416.      
  24417.     end Scan_link_name_pragma;
  24418.      
  24419.      
  24420.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator) is
  24421.     begin
  24422.      
  24423.      
  24424.        if not Identifier_Utilities.Is_Id_Null (root) then
  24425.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24426.        end if;
  24427.      
  24428.      
  24429.      
  24430.     end Scan_mark_release_pragma;
  24431.      
  24432.      
  24433.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator) is
  24434.     begin
  24435.      
  24436.      
  24437.        if not Identifier_Utilities.Is_Id_Null (root) then
  24438.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24439.        end if;
  24440.      
  24441.      
  24442.      
  24443.     end Scan_monitor_pragma;
  24444.      
  24445.      
  24446.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator) is
  24447.     begin
  24448.      
  24449.      
  24450.        if not Identifier_Utilities.Is_Id_Null (root) then
  24451.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24452.        end if;
  24453.      
  24454.      
  24455.      
  24456.     end Scan_unrecognized_pragma;
  24457.      
  24458.      
  24459.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator) is
  24460.     begin
  24461.         case Kind(Root) is
  24462.           when controlled_pragmaKind => Scan_controlled_pragma(Root);
  24463.           when elaborate_pragmaKind => Scan_elaborate_pragma(Root);
  24464.           when inline_pragmaKind => Scan_inline_pragma(Root);
  24465.           when interface_pragmaKind => Scan_interface_pragma(Root);
  24466.           when list_pragmaKind => Scan_list_pragma(Root);
  24467.           when memory_size_pragmaKind => Scan_memory_size_pragma(Root);
  24468.           when optimize_pragmaKind => Scan_optimize_pragma(Root);
  24469.           when pack_pragmaKind => Scan_pack_pragma(Root);
  24470.           when page_pragmaKind => Scan_page_pragma(Root);
  24471.           when priority_pragmaKind => Scan_priority_pragma(Root);
  24472.           when shared_pragmaKind => Scan_shared_pragma(Root);
  24473.           when storage_unit_pragmaKind => Scan_storage_unit_pragma(Root);
  24474.           when suppress_pragmaKind => Scan_suppress_pragma(Root);
  24475.           when system_name_pragmaKind => Scan_system_name_pragma(Root);
  24476.           when others => null;
  24477.         end case;
  24478.     end Scan_LRM_PRAGMA_ID;
  24479.      
  24480.      
  24481.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator) is
  24482.     begin
  24483.      
  24484.      
  24485.        if not Identifier_Utilities.Is_Id_Null (root) then
  24486.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24487.        end if;
  24488.      
  24489.      
  24490.      
  24491.     end Scan_controlled_pragma;
  24492.      
  24493.      
  24494.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator) is
  24495.     begin
  24496.      
  24497.      
  24498.        if not Identifier_Utilities.Is_Id_Null (root) then
  24499.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24500.        end if;
  24501.      
  24502.      
  24503.      
  24504.     end Scan_elaborate_pragma;
  24505.      
  24506.      
  24507.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator) is
  24508.     begin
  24509.      
  24510.      
  24511.        if not Identifier_Utilities.Is_Id_Null (root) then
  24512.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24513.        end if;
  24514.      
  24515.      
  24516.      
  24517.     end Scan_inline_pragma;
  24518.      
  24519.      
  24520.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator) is
  24521.     begin
  24522.      
  24523.      
  24524.        if not Identifier_Utilities.Is_Id_Null (root) then
  24525.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24526.        end if;
  24527.      
  24528.      
  24529.      
  24530.     end Scan_interface_pragma;
  24531.      
  24532.      
  24533.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator) is
  24534.     begin
  24535.      
  24536.      
  24537.        if not Identifier_Utilities.Is_Id_Null (root) then
  24538.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24539.        end if;
  24540.      
  24541.      
  24542.      
  24543.     end Scan_list_pragma;
  24544.      
  24545.      
  24546.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator) is
  24547.     begin
  24548.      
  24549.      
  24550.        if not Identifier_Utilities.Is_Id_Null (root) then
  24551.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24552.        end if;
  24553.      
  24554.      
  24555.      
  24556.     end Scan_memory_size_pragma;
  24557.      
  24558.      
  24559.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator) is
  24560.     begin
  24561.      
  24562.      
  24563.        if not Identifier_Utilities.Is_Id_Null (root) then
  24564.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24565.        end if;
  24566.      
  24567.      
  24568.      
  24569.     end Scan_optimize_pragma;
  24570.      
  24571.      
  24572.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator) is
  24573.     begin
  24574.      
  24575.      
  24576.        if not Identifier_Utilities.Is_Id_Null (root) then
  24577.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24578.        end if;
  24579.      
  24580.      
  24581.      
  24582.     end Scan_pack_pragma;
  24583.      
  24584.      
  24585.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator) is
  24586.     begin
  24587.      
  24588.      
  24589.        if not Identifier_Utilities.Is_Id_Null (root) then
  24590.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24591.        end if;
  24592.      
  24593.      
  24594.      
  24595.     end Scan_page_pragma;
  24596.      
  24597.      
  24598.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator) is
  24599.     begin
  24600.      
  24601.      
  24602.        if not Identifier_Utilities.Is_Id_Null (root) then
  24603.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24604.        end if;
  24605.      
  24606.      
  24607.      
  24608.     end Scan_priority_pragma;
  24609.      
  24610.      
  24611.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator) is
  24612.     begin
  24613.      
  24614.      
  24615.        if not Identifier_Utilities.Is_Id_Null (root) then
  24616.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24617.        end if;
  24618.      
  24619.      
  24620.      
  24621.     end Scan_shared_pragma;
  24622.      
  24623.      
  24624.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator) is
  24625.     begin
  24626.      
  24627.      
  24628.        if not Identifier_Utilities.Is_Id_Null (root) then
  24629.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24630.        end if;
  24631.      
  24632.      
  24633.      
  24634.     end Scan_storage_unit_pragma;
  24635.      
  24636.      
  24637.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator) is
  24638.     begin
  24639.      
  24640.      
  24641.        if not Identifier_Utilities.Is_Id_Null (root) then
  24642.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24643.        end if;
  24644.      
  24645.      
  24646.      
  24647.     end Scan_suppress_pragma;
  24648.      
  24649.      
  24650.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator) is
  24651.     begin
  24652.      
  24653.      
  24654.        if not Identifier_Utilities.Is_Id_Null (root) then
  24655.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24656.        end if;
  24657.      
  24658.      
  24659.      
  24660.     end Scan_system_name_pragma;
  24661.      
  24662.      
  24663.     procedure Scan_STM_ID(Root : STM_ID.Locator) is
  24664.     begin
  24665.         case Kind(Root) is
  24666.           when block_idKind => Scan_block_id(Root);
  24667.           when label_idKind => Scan_label_id(Root);
  24668.           when loop_idKind => Scan_loop_id(Root);
  24669.           when others => null;
  24670.         end case;
  24671.     end Scan_STM_ID;
  24672.      
  24673.      
  24674.     procedure Scan_block_id(Root : block_idNode.Locator) is
  24675.     begin
  24676.      
  24677.      
  24678.        if not Identifier_Utilities.Is_Id_Null (root) then
  24679.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24680.        end if;
  24681.      
  24682.      
  24683.      
  24684.     end Scan_block_id;
  24685.      
  24686.      
  24687.     procedure Scan_label_id(Root : label_idNode.Locator) is
  24688.     begin
  24689.      
  24690.      
  24691.        if not Identifier_Utilities.Is_Id_Null (root) then
  24692.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24693.        end if;
  24694.      
  24695.      
  24696.      
  24697.     end Scan_label_id;
  24698.      
  24699.      
  24700.     procedure Scan_loop_id(Root : loop_idNode.Locator) is
  24701.     begin
  24702.      
  24703.      
  24704.     IncrementToken (colonz);
  24705.      
  24706.      
  24707.      
  24708.      
  24709.        if not Identifier_Utilities.Is_Id_Null (root) then
  24710.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24711.        end if;
  24712.      
  24713.      
  24714.      
  24715.     end Scan_loop_id;
  24716.      
  24717.      
  24718.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator) is
  24719.     begin
  24720.         case Kind(Root) is
  24721.           when GENERIC_SUBP_IDKind => Scan_GENERIC_SUBP_ID(Root);
  24722.           when def_operatorKind => Scan_def_operator(Root);
  24723.           when entry_idKind => Scan_entry_id(Root);
  24724.           when func_idKind => Scan_func_id(Root);
  24725.           when proc_idKind => Scan_proc_id(Root);
  24726.           when others => null;
  24727.         end case;
  24728.     end Scan_SUBP_ID;
  24729.      
  24730.      
  24731.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator) is
  24732.     begin
  24733.         case Kind(Root) is
  24734.           when generic_func_idKind => Scan_generic_func_id(Root);
  24735.           when generic_proc_idKind => Scan_generic_proc_id(Root);
  24736.           when others => null;
  24737.         end case;
  24738.     end Scan_GENERIC_SUBP_ID;
  24739.      
  24740.      
  24741.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator) is
  24742.     begin
  24743.      
  24744.      
  24745.        if not Identifier_Utilities.Is_Id_Null (root) then
  24746.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24747.        end if;
  24748.      
  24749.      
  24750.      
  24751.     end Scan_generic_func_id;
  24752.      
  24753.      
  24754.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator) is
  24755.     begin
  24756.      
  24757.      
  24758.        if not Identifier_Utilities.Is_Id_Null (root) then
  24759.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24760.        end if;
  24761.      
  24762.      
  24763.      
  24764.     end Scan_generic_proc_id;
  24765.      
  24766.      
  24767.     procedure Scan_def_operator(Root : def_operatorNode.Locator) is
  24768.     begin
  24769.      
  24770.      
  24771.        if not Identifier_Utilities.Is_Id_Null (root) then
  24772.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24773.        end if;
  24774.      
  24775.      
  24776.      
  24777.     end Scan_def_operator;
  24778.      
  24779.      
  24780.     procedure Scan_entry_id(Root : entry_idNode.Locator) is
  24781.     begin
  24782.      
  24783.      
  24784.        if not Identifier_Utilities.Is_Id_Null (root) then
  24785.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24786.        end if;
  24787.      
  24788.      
  24789.      
  24790.     end Scan_entry_id;
  24791.      
  24792.      
  24793.     procedure Scan_func_id(Root : func_idNode.Locator) is
  24794.     begin
  24795.      
  24796.      
  24797.        if not Identifier_Utilities.Is_Id_Null (root) then
  24798.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24799.        end if;
  24800.      
  24801.      
  24802.      
  24803.     end Scan_func_id;
  24804.      
  24805.      
  24806.     procedure Scan_proc_id(Root : proc_idNode.Locator) is
  24807.     begin
  24808.      
  24809.      
  24810.        if not Identifier_Utilities.Is_Id_Null (root) then
  24811.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24812.        end if;
  24813.      
  24814.      
  24815.      
  24816.     end Scan_proc_id;
  24817.      
  24818.      
  24819.     procedure Scan_argument_id(Root : argument_idNode.Locator) is
  24820.     begin
  24821.      
  24822.      
  24823.        if not Identifier_Utilities.Is_Id_Null (root) then
  24824.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24825.        end if;
  24826.      
  24827.      
  24828.      
  24829.     end Scan_argument_id;
  24830.      
  24831.      
  24832.     procedure Scan_exception_id(Root : exception_idNode.Locator) is
  24833.     begin
  24834.      
  24835.      
  24836.        if not Identifier_Utilities.Is_Id_Null (root) then
  24837.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24838.        end if;
  24839.      
  24840.      
  24841.      
  24842.     end Scan_exception_id;
  24843.      
  24844.      
  24845.     procedure Scan_iteration_id(Root : iteration_idNode.Locator) is
  24846.     begin
  24847.      
  24848.      
  24849.        if not Identifier_Utilities.Is_Id_Null (root) then
  24850.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24851.        end if;
  24852.      
  24853.      
  24854.      
  24855.     end Scan_iteration_id;
  24856.      
  24857.      
  24858.     procedure Scan_number_id(Root : number_idNode.Locator) is
  24859.     begin
  24860.      
  24861.      
  24862.        if not Identifier_Utilities.Is_Id_Null (root) then
  24863.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24864.        end if;
  24865.      
  24866.      
  24867.      
  24868.     end Scan_number_id;
  24869.      
  24870.      
  24871.     procedure Scan_subtype_id(Root : subtype_idNode.Locator) is
  24872.     begin
  24873.      
  24874.      
  24875.        if not Identifier_Utilities.Is_Id_Null (root) then
  24876.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24877.        end if;
  24878.      
  24879.      
  24880.      
  24881.     end Scan_subtype_id;
  24882.      
  24883.      
  24884.     procedure Scan_task_body_id(Root : task_body_idNode.Locator) is
  24885.     begin
  24886.      
  24887.      
  24888.        if not Identifier_Utilities.Is_Id_Null (root) then
  24889.            DEF_ID_Set.Insert (root, CurrentBlock.SetOfDEF_IDs);
  24890.        end if;
  24891.      
  24892.      
  24893.      
  24894.     end Scan_task_body_id;
  24895.      
  24896. end DEF_ID_Pkg;
  24897. -- End: SCDEF_ID bdy -----------------------------------------------------
  24898. ::::::::::::::
  24899. scdef_id.spc
  24900. ::::::::::::::
  24901. -- Begin: SCDEF_ID spc ---------------------------------------------------
  24902.      
  24903. with ST_DIANA; use ST_DIANA;
  24904.              package DEF_ID_Pkg is
  24905.     procedure Scan_DEF_ID(Root : DEF_ID.Locator);
  24906.     procedure Scan_ATTRIBUTE_ID(Root : ATTRIBUTE_ID.Locator);
  24907.     procedure Scan_LRM_ATTRIBUTE_ID(Root : LRM_ATTRIBUTE_ID.Locator);
  24908.     procedure Scan_address_id(Root : address_idNode.Locator);
  24909.     procedure Scan_aft_id(Root : aft_idNode.Locator);
  24910.     procedure Scan_base_id(Root : base_idNode.Locator);
  24911.     procedure Scan_callable_id(Root : callable_idNode.Locator);
  24912.     procedure Scan_constrained_id(Root : constrained_idNode.Locator);
  24913.     procedure Scan_count_id(Root : count_idNode.Locator);
  24914.     procedure Scan_delta_id(Root : delta_idNode.Locator);
  24915.     procedure Scan_digits_id(Root : digits_idNode.Locator);
  24916.     procedure Scan_emax_id(Root : emax_idNode.Locator);
  24917.     procedure Scan_epsilon_id(Root : epsilon_idNode.Locator);
  24918.     procedure Scan_first_bit_id(Root : first_bit_idNode.Locator);
  24919.     procedure Scan_first_index_id(Root : first_index_idNode.Locator);
  24920.     procedure Scan_first_scalar_id(Root : first_scalar_idNode.Locator);
  24921.     procedure Scan_fore_id(Root : fore_idNode.Locator);
  24922.     procedure Scan_image_id(Root : image_idNode.Locator);
  24923.     procedure Scan_large_id(Root : large_idNode.Locator);
  24924.     procedure Scan_last_bit_id(Root : last_bit_idNode.Locator);
  24925.     procedure Scan_last_index_id(Root : last_index_idNode.Locator);
  24926.     procedure Scan_last_scalar_id(Root : last_scalar_idNode.Locator);
  24927.     procedure Scan_length_id(Root : length_idNode.Locator);
  24928.     procedure Scan_machine_emax_id(Root : machine_emax_idNode.Locator);
  24929.     procedure Scan_machine_emin_id(Root : machine_emin_idNode.Locator);
  24930.     procedure Scan_machine_mantissa_id(Root : machine_mantissa_idNode.Locator);
  24931.     procedure Scan_machine_overflows_id(Root : machine_overflows_idNode.Locator);
  24932.     procedure Scan_machine_radix_id(Root : machine_radix_idNode.Locator);
  24933.     procedure Scan_machine_rounds_id(Root : machine_rounds_idNode.Locator);
  24934.     procedure Scan_mantissa_id(Root : mantissa_idNode.Locator);
  24935.     procedure Scan_pos_id(Root : pos_idNode.Locator);
  24936.     procedure Scan_position_id(Root : position_idNode.Locator);
  24937.     procedure Scan_pred_id(Root : pred_idNode.Locator);
  24938.     procedure Scan_range_id(Root : range_idNode.Locator);
  24939.     procedure Scan_safe_emax_id(Root : safe_emax_idNode.Locator);
  24940.     procedure Scan_safe_large_id(Root : safe_large_idNode.Locator);
  24941.     procedure Scan_safe_small_id(Root : safe_small_idNode.Locator);
  24942.     procedure Scan_size_objects_id(Root : size_objects_idNode.Locator);
  24943.     procedure Scan_size_type_id(Root : size_type_idNode.Locator);
  24944.     procedure Scan_small_id(Root : small_idNode.Locator);
  24945.     procedure Scan_storage_size_collection_id(Root : storage_size_collection_idNode.Locator);
  24946.     procedure Scan_storage_size_task_id(Root : storage_size_task_idNode.Locator);
  24947.     procedure Scan_succ_id(Root : succ_idNode.Locator);
  24948.     procedure Scan_terminated_id(Root : terminated_idNode.Locator);
  24949.     procedure Scan_val_id(Root : val_idNode.Locator);
  24950.     procedure Scan_value_id(Root : value_idNode.Locator);
  24951.     procedure Scan_width_id(Root : width_idNode.Locator);
  24952.     procedure Scan_BUILT_IN_OPERATOR(Root : BUILT_IN_OPERATOR.Locator);
  24953.     procedure Scan_built_in_abs(Root : built_in_absNode.Locator);
  24954.     procedure Scan_built_in_and(Root : built_in_andNode.Locator);
  24955.     procedure Scan_built_in_mod(Root : built_in_modNode.Locator);
  24956.     procedure Scan_built_in_not(Root : built_in_notNode.Locator);
  24957.     procedure Scan_built_in_or(Root : built_in_orNode.Locator);
  24958.     procedure Scan_built_in_rem(Root : built_in_remNode.Locator);
  24959.     procedure Scan_built_in_xor(Root : built_in_xorNode.Locator);
  24960.     procedure Scan_concatenate(Root : concatenateNode.Locator);
  24961.     procedure Scan_divide(Root : divideNode.Locator);
  24962.     procedure Scan_equal(Root : equalNode.Locator);
  24963.     procedure Scan_exponent(Root : exponentNode.Locator);
  24964.     procedure Scan_greater_than(Root : greater_thanNode.Locator);
  24965.     procedure Scan_greater_than_or_equal(Root : greater_than_or_equalNode.Locator);
  24966.     procedure Scan_less_than(Root : less_thanNode.Locator);
  24967.     procedure Scan_less_than_or_equal(Root : less_than_or_equalNode.Locator);
  24968.     procedure Scan_minus(Root : minusNode.Locator);
  24969.     procedure Scan_multiply(Root : multiplyNode.Locator);
  24970.     procedure Scan_negate(Root : negateNode.Locator);
  24971.     procedure Scan_not_equal(Root : not_equalNode.Locator);
  24972.     procedure Scan_plus(Root : plusNode.Locator);
  24973.     procedure Scan_unary_plus(Root : unary_plusNode.Locator);
  24974.     procedure Scan_GENERAL_TYPE_ID(Root : GENERAL_TYPE_ID.Locator);
  24975.     procedure Scan_lim_priv_type_id(Root : lim_priv_type_idNode.Locator);
  24976.     procedure Scan_priv_type_id(Root : priv_type_idNode.Locator);
  24977.     procedure Scan_type_id(Root : type_idNode.Locator);
  24978.     procedure Scan_LITERAL_ID(Root : LITERAL_ID.Locator);
  24979.     procedure Scan_def_char(Root : def_charNode.Locator);
  24980.     procedure Scan_enum_id(Root : enum_idNode.Locator);
  24981.     procedure Scan_OBJECT_ID(Root : OBJECT_ID.Locator);
  24982.     procedure Scan_PARAM_ID(Root : PARAM_ID.Locator);
  24983.     procedure Scan_in_id(Root : in_idNode.Locator);
  24984.     procedure Scan_in_out_id(Root : in_out_idNode.Locator);
  24985.     procedure Scan_out_id(Root : out_idNode.Locator);
  24986.     procedure Scan_component_id(Root : component_idNode.Locator);
  24987.     procedure Scan_constant_id(Root : constant_idNode.Locator);
  24988.     procedure Scan_dscrmt_id(Root : dscrmt_idNode.Locator);
  24989.     procedure Scan_variable_id(Root : variable_idNode.Locator);
  24990.     procedure Scan_PKG_ID_CLASS(Root : PKG_ID_CLASS.Locator);
  24991.     procedure Scan_generic_pkg_id(Root : generic_pkg_idNode.Locator);
  24992.     procedure Scan_pkg_id(Root : pkg_idNode.Locator);
  24993.     procedure Scan_PRAGMA_ID(Root : PRAGMA_ID.Locator);
  24994.     procedure Scan_AIE_PRAGMA_ID(Root : AIE_PRAGMA_ID.Locator);
  24995.     procedure Scan_link_name_pragma(Root : link_name_pragmaNode.Locator);
  24996.     procedure Scan_mark_release_pragma(Root : mark_release_pragmaNode.Locator);
  24997.     procedure Scan_monitor_pragma(Root : monitor_pragmaNode.Locator);
  24998.     procedure Scan_unrecognized_pragma(Root : unrecognized_pragmaNode.Locator);
  24999.     procedure Scan_LRM_PRAGMA_ID(Root : LRM_PRAGMA_ID.Locator);
  25000.     procedure Scan_controlled_pragma(Root : controlled_pragmaNode.Locator);
  25001.     procedure Scan_elaborate_pragma(Root : elaborate_pragmaNode.Locator);
  25002.     procedure Scan_inline_pragma(Root : inline_pragmaNode.Locator);
  25003.     procedure Scan_interface_pragma(Root : interface_pragmaNode.Locator);
  25004.     procedure Scan_list_pragma(Root : list_pragmaNode.Locator);
  25005.     procedure Scan_memory_size_pragma(Root : memory_size_pragmaNode.Locator);
  25006.     procedure Scan_optimize_pragma(Root : optimize_pragmaNode.Locator);
  25007.     procedure Scan_pack_pragma(Root : pack_pragmaNode.Locator);
  25008.     procedure Scan_page_pragma(Root : page_pragmaNode.Locator);
  25009.     procedure Scan_priority_pragma(Root : priority_pragmaNode.Locator);
  25010.     procedure Scan_shared_pragma(Root : shared_pragmaNode.Locator);
  25011.     procedure Scan_storage_unit_pragma(Root : storage_unit_pragmaNode.Locator);
  25012.     procedure Scan_suppress_pragma(Root : suppress_pragmaNode.Locator);
  25013.     procedure Scan_system_name_pragma(Root : system_name_pragmaNode.Locator);
  25014.     procedure Scan_STM_ID(Root : STM_ID.Locator);
  25015.     procedure Scan_block_id(Root : block_idNode.Locator);
  25016.     procedure Scan_label_id(Root : label_idNode.Locator);
  25017.     procedure Scan_loop_id(Root : loop_idNode.Locator);
  25018.     procedure Scan_SUBP_ID(Root : SUBP_ID.Locator);
  25019.     procedure Scan_GENERIC_SUBP_ID(Root : GENERIC_SUBP_ID.Locator);
  25020.     procedure Scan_generic_func_id(Root : generic_func_idNode.Locator);
  25021.     procedure Scan_generic_proc_id(Root : generic_proc_idNode.Locator);
  25022.     procedure Scan_def_operator(Root : def_operatorNode.Locator);
  25023.     procedure Scan_entry_id(Root : entry_idNode.Locator);
  25024.     procedure Scan_func_id(Root : func_idNode.Locator);
  25025.     procedure Scan_proc_id(Root : proc_idNode.Locator);
  25026.     procedure Scan_argument_id(Root : argument_idNode.Locator);
  25027.     procedure Scan_exception_id(Root : exception_idNode.Locator);
  25028.     procedure Scan_iteration_id(Root : iteration_idNode.Locator);
  25029.     procedure Scan_number_id(Root : number_idNode.Locator);
  25030.     procedure Scan_subtype_id(Root : subtype_idNode.Locator);
  25031.     procedure Scan_task_body_id(Root : task_body_idNode.Locator);
  25032. end DEF_ID_Pkg;
  25033. -- End: SCDEF_ID spc -----------------------------------------------------
  25034. ::::::::::::::
  25035. scgeneral.bdy
  25036. ::::::::::::::
  25037. -- Begin: SCGENERAL_ASSOC bdy ---------------------------------------------------
  25038.      
  25039. with Halstead_Data_Base;  use Halstead_Data_Base;
  25040. with Definitions; use Definitions;
  25041.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25042. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25043. package body GENERAL_ASSOC_Pkg is
  25044.      
  25045.      
  25046.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator) is
  25047.     begin
  25048.         case Kind(Root) is
  25049.           when GA_ASSOC_EXPKind => Scan_GA_ASSOC_EXP(Root);
  25050.           when ga_rangeKind => Scan_ga_range(Root);
  25051.           when others => null;
  25052.         end case;
  25053.     end Scan_GENERAL_ASSOC;
  25054.      
  25055.      
  25056.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator) is
  25057.     begin
  25058.         case Kind(Root) is
  25059.           when ga_assocKind => Scan_ga_assoc(Root);
  25060.           when ga_expKind => Scan_ga_exp(Root);
  25061.           when others => null;
  25062.         end case;
  25063.     end Scan_GA_ASSOC_EXP;
  25064.      
  25065.      
  25066.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator) is
  25067.         as_id_s_List : SeqOfused_idNode.Generator;
  25068.         as_id_s_Item : used_idNode.Locator;
  25069.         use SeqOfused_idNode;
  25070.     begin
  25071.       if not SeqOfused_idNode.IsNull(as_id_s(Root)) then
  25072.         StartForward(as_id_s(Root), as_id_s_List);
  25073.         while not Finished(as_id_s_List) loop
  25074.             as_id_s_Item := Cell(as_id_s_List);
  25075.             Scan_used_id(as_id_s_Item);
  25076.             Forward(as_id_s_List);
  25077.         end loop;
  25078.         EndIterate(as_id_s_List);
  25079.       end if;
  25080.       if not NAME_EXP.IsNull(as_exp(Root)) then
  25081.         Scan_NAME_EXP(as_exp(Root));
  25082.       end if;
  25083.      
  25084.     end Scan_ga_assoc;
  25085.      
  25086.      
  25087.     procedure Scan_ga_exp(Root : ga_expNode.Locator) is
  25088.     begin
  25089.       if not NAME_EXP.IsNull(as_exp(Root)) then
  25090.         Scan_NAME_EXP(as_exp(Root));
  25091.       end if;
  25092.      
  25093.     end Scan_ga_exp;
  25094.      
  25095.      
  25096.     procedure Scan_ga_range(Root : ga_rangeNode.Locator) is
  25097.     begin
  25098.       if not OBJECT_TYPE.IsNull(as_apply_discrete_range(Root)) then
  25099.         Scan_OBJECT_TYPE(as_apply_discrete_range(Root));
  25100.       end if;
  25101.      
  25102.     end Scan_ga_range;
  25103.      
  25104. end GENERAL_ASSOC_Pkg;
  25105. -- End: SCGENERAL_ASSOC bdy -----------------------------------------------------
  25106. ::::::::::::::
  25107. scgeneral.spc
  25108. ::::::::::::::
  25109. -- Begin: SCGENERAL_ASSOC spc ---------------------------------------------------
  25110.      
  25111. with ST_DIANA; use ST_DIANA;
  25112.              package GENERAL_ASSOC_Pkg is
  25113.     procedure Scan_GENERAL_ASSOC(Root : GENERAL_ASSOC.Locator);
  25114.     procedure Scan_GA_ASSOC_EXP(Root : GA_ASSOC_EXP.Locator);
  25115.     procedure Scan_ga_assoc(Root : ga_assocNode.Locator);
  25116.     procedure Scan_ga_exp(Root : ga_expNode.Locator);
  25117.     procedure Scan_ga_range(Root : ga_rangeNode.Locator);
  25118. end GENERAL_ASSOC_Pkg;
  25119. -- End: SCGENERAL_ASSOC spc -----------------------------------------------------
  25120. ::::::::::::::
  25121. scgeneric.bdy
  25122. ::::::::::::::
  25123. -- Begin: SCGENERIC_HEADER_CLASS bdy ---------------------------------------------------
  25124.      
  25125. with Halstead_Data_Base;  use Halstead_Data_Base;
  25126. with Definitions; use Definitions;
  25127.              with generic_header_IH;
  25128. with ITEM_Pkg; use ITEM_Pkg;
  25129. package body GENERIC_HEADER_CLASS_Pkg is
  25130.      
  25131.      
  25132.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator) is
  25133.     begin
  25134.         case Kind(Root) is
  25135.           when generic_headerKind => Scan_generic_header(Root);
  25136.           when others => null;
  25137.         end case;
  25138.     end Scan_GENERIC_HEADER_CLASS;
  25139.      
  25140.      
  25141.     procedure Scan_generic_header(Root : generic_headerNode.Locator) is
  25142.         as_generic_param_s_List : SeqOfITEM.Generator;
  25143.         as_generic_param_s_Item : ITEM.Locator;
  25144.         use SeqOfITEM;
  25145.         Old_generic_header_IHR : generic_header_IH.RecType := generic_header_IH.R;
  25146.     begin
  25147.         generic_header_IH.R.ih_ingeneric_param :=  false ;
  25148.      
  25149.      
  25150.       generic_header_IH.R.ih_ingeneric_param := true;
  25151.      
  25152.      
  25153.       if not SeqOfITEM.IsNull(as_generic_param_s(Root)) then
  25154.         StartForward(as_generic_param_s(Root), as_generic_param_s_List);
  25155.         while not Finished(as_generic_param_s_List) loop
  25156.             as_generic_param_s_Item := Cell(as_generic_param_s_List);
  25157.      
  25158.      
  25159.        IncrementToken (semicolonz);
  25160.      
  25161.      
  25162.             Scan_ITEM(as_generic_param_s_Item);
  25163.             Forward(as_generic_param_s_List);
  25164.         end loop;
  25165.         EndIterate(as_generic_param_s_List);
  25166.       end if;
  25167.      
  25168.      
  25169.        generic_header_IH.R.ih_ingeneric_param := true;
  25170.      
  25171.      
  25172.         generic_header_IH.R := Old_generic_header_IHR;
  25173.      
  25174.     end Scan_generic_header;
  25175.      
  25176. end GENERIC_HEADER_CLASS_Pkg;
  25177. -- End: SCGENERIC_HEADER_CLASS bdy -----------------------------------------------------
  25178. ::::::::::::::
  25179. scgeneric.spc
  25180. ::::::::::::::
  25181. -- Begin: SCGENERIC_HEADER_CLASS spc ---------------------------------------------------
  25182.      
  25183. with ST_DIANA; use ST_DIANA;
  25184.              package GENERIC_HEADER_CLASS_Pkg is
  25185.     procedure Scan_GENERIC_HEADER_CLASS(Root : GENERIC_HEADER_CLASS.Locator);
  25186.     procedure Scan_generic_header(Root : generic_headerNode.Locator);
  25187. end GENERIC_HEADER_CLASS_Pkg;
  25188. -- End: SCGENERIC_HEADER_CLASS spc -----------------------------------------------------
  25189.      
  25190. ::::::::::::::
  25191. scheader.bdy
  25192. ::::::::::::::
  25193. -- Begin: SCHEADER bdy ---------------------------------------------------
  25194.      
  25195. with Halstead_Data_Base;  use Halstead_Data_Base;
  25196. with Definitions; use Definitions;
  25197.              with SERIES_UNIT_IH;
  25198. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25199. with ITEM_Pkg; use ITEM_Pkg;
  25200. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25201.      
  25202.              with generic_header_IH;
  25203.                         package body HEADER_Pkg is
  25204.      
  25205.      
  25206.     procedure Scan_HEADER(Root : HEADER.Locator) is
  25207.     begin
  25208.         case Kind(Root) is
  25209.           when accept_specKind => Scan_accept_spec(Root);
  25210.           when entry_specKind => Scan_entry_spec(Root);
  25211.           when func_specKind => Scan_func_spec(Root);
  25212.           when proc_specKind => Scan_proc_spec(Root);
  25213.           when others => null;
  25214.         end case;
  25215.     end Scan_HEADER;
  25216.      
  25217.      
  25218.     procedure Scan_accept_spec(Root : accept_specNode.Locator) is
  25219.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25220.         as_param_s_Item : OBJECT_ITEM.Locator;
  25221.         use SeqOfOBJECT_ITEM;
  25222.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25223.     begin
  25224.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25225.      
  25226.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25227.         then
  25228.      
  25229.        IncrementToken (open_parenthesisz);
  25230.      
  25231.         end if;
  25232.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  25233.      
  25234.      
  25235.       IncrementToken (open_parenthesisz);
  25236.      
  25237.      
  25238.         Scan_NAME_EXP(as_family_index(Root));
  25239.      
  25240.      
  25241.       IncrementToken (closed_parenthesisz);
  25242.      
  25243.      
  25244.       end if;
  25245.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25246.         StartForward(as_param_s(Root), as_param_s_List);
  25247.         while not Finished(as_param_s_List) loop
  25248.             as_param_s_Item := Cell(as_param_s_List);
  25249.      
  25250.      
  25251.      if SERIES_UNIT_IH.R.ih_inlist then
  25252.          IncrementToken (semicolonz);
  25253.      end if;
  25254.      SERIES_UNIT_IH.R.ih_inlist := true;
  25255.      
  25256.      
  25257.             Scan_OBJECT_ITEM(as_param_s_Item);
  25258.             Forward(as_param_s_List);
  25259.         end loop;
  25260.         EndIterate(as_param_s_List);
  25261.      
  25262.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25263.         then
  25264.      
  25265.    IncrementToken (closed_parenthesisz);
  25266.    SERIES_UNIT_IH.R.ih_inlist := false;
  25267.      
  25268.         end if;
  25269.       end if;
  25270.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25271.      
  25272.     end Scan_accept_spec;
  25273.      
  25274.      
  25275.     procedure Scan_entry_spec(Root : entry_specNode.Locator) is
  25276.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25277.         as_param_s_Item : OBJECT_ITEM.Locator;
  25278.         use SeqOfOBJECT_ITEM;
  25279.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25280.     begin
  25281.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25282.      
  25283.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25284.         then
  25285.      
  25286.        IncrementToken (open_parenthesisz);
  25287.      
  25288.         end if;
  25289.       if not OBJECT_TYPE.IsNull(as_family_range_void(Root)) then
  25290.      
  25291.      
  25292.       IncrementToken (open_parenthesisz);
  25293.      
  25294.      
  25295.         Scan_OBJECT_TYPE(as_family_range_void(Root));
  25296.      
  25297.      
  25298.      IncrementToken (closed_parenthesisz);
  25299.      
  25300.      
  25301.       end if;
  25302.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25303.         StartForward(as_param_s(Root), as_param_s_List);
  25304.         while not Finished(as_param_s_List) loop
  25305.             as_param_s_Item := Cell(as_param_s_List);
  25306.      
  25307.      
  25308.      if SERIES_UNIT_IH.R.ih_inlist then
  25309.          IncrementToken (semicolonz);
  25310.      end if;
  25311.      SERIES_UNIT_IH.R.ih_inlist := true;
  25312.      
  25313.      
  25314.             Scan_OBJECT_ITEM(as_param_s_Item);
  25315.             Forward(as_param_s_List);
  25316.         end loop;
  25317.         EndIterate(as_param_s_List);
  25318.      
  25319.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25320.         then
  25321.      
  25322.    IncrementToken (closed_parenthesisz);
  25323.    SERIES_UNIT_IH.R.ih_inlist := false;
  25324.      
  25325.         end if;
  25326.       end if;
  25327.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25328.      
  25329.     end Scan_entry_spec;
  25330.      
  25331.      
  25332.     procedure Scan_func_spec(Root : func_specNode.Locator) is
  25333.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25334.         as_param_s_Item : OBJECT_ITEM.Locator;
  25335.         use SeqOfOBJECT_ITEM;
  25336.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25337.     begin
  25338.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25339.      
  25340.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25341.         then
  25342.      
  25343.        IncrementToken (open_parenthesisz);
  25344.      
  25345.         end if;
  25346.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25347.         StartForward(as_param_s(Root), as_param_s_List);
  25348.         while not Finished(as_param_s_List) loop
  25349.             as_param_s_Item := Cell(as_param_s_List);
  25350.      
  25351.      
  25352.      if SERIES_UNIT_IH.R.ih_inlist then
  25353.          IncrementToken (semicolonz);
  25354.      end if;
  25355.      SERIES_UNIT_IH.R.ih_inlist := true;
  25356.      
  25357.      
  25358.             Scan_OBJECT_ITEM(as_param_s_Item);
  25359.             Forward(as_param_s_List);
  25360.         end loop;
  25361.         EndIterate(as_param_s_List);
  25362.      
  25363.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25364.         then
  25365.      
  25366.    IncrementToken (closed_parenthesisz);
  25367.    SERIES_UNIT_IH.R.ih_inlist := false;
  25368.      
  25369.         end if;
  25370.       end if;
  25371.       if not object_type_constrainedNode.IsNull(as_return_type(Root)) then
  25372.      
  25373.      
  25374.      IncrementToken (returnz);
  25375.      
  25376.      
  25377.         Scan_object_type_constrained(as_return_type(Root));
  25378.       end if;
  25379.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25380.      
  25381.     end Scan_func_spec;
  25382.      
  25383.      
  25384.     procedure Scan_proc_spec(Root : proc_specNode.Locator) is
  25385.         as_param_s_List : SeqOfOBJECT_ITEM.Generator;
  25386.         as_param_s_Item : OBJECT_ITEM.Locator;
  25387.         use SeqOfOBJECT_ITEM;
  25388.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25389.     begin
  25390.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25391.      
  25392.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25393.         then
  25394.      
  25395.        IncrementToken (open_parenthesisz);
  25396.      
  25397.         end if;
  25398.       if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root)) then
  25399.         StartForward(as_param_s(Root), as_param_s_List);
  25400.         while not Finished(as_param_s_List) loop
  25401.             as_param_s_Item := Cell(as_param_s_List);
  25402.      
  25403.      
  25404.      if SERIES_UNIT_IH.R.ih_inlist then
  25405.          IncrementToken (semicolonz);
  25406.      end if;
  25407.      SERIES_UNIT_IH.R.ih_inlist := true;
  25408.      
  25409.      
  25410.             Scan_OBJECT_ITEM(as_param_s_Item);
  25411.             Forward(as_param_s_List);
  25412.         end loop;
  25413.         EndIterate(as_param_s_List);
  25414.      
  25415.         if not SeqOfOBJECT_ITEM.IsNull(as_param_s(Root))
  25416.         then
  25417.      
  25418.    IncrementToken (closed_parenthesisz);
  25419.    SERIES_UNIT_IH.R.ih_inlist := false;
  25420.      
  25421.         end if;
  25422.       end if;
  25423.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25424.      
  25425.     end Scan_proc_spec;
  25426.      
  25427. end HEADER_Pkg;
  25428. -- End: SCHEADER bdy -----------------------------------------------------
  25429. ::::::::::::::
  25430. scheader.spc
  25431. ::::::::::::::
  25432. -- Begin: SCHEADER spc ---------------------------------------------------
  25433.      
  25434. with ST_DIANA; use ST_DIANA;
  25435.              package HEADER_Pkg is
  25436.     procedure Scan_HEADER(Root : HEADER.Locator);
  25437.     procedure Scan_accept_spec(Root : accept_specNode.Locator);
  25438.     procedure Scan_entry_spec(Root : entry_specNode.Locator);
  25439.     procedure Scan_func_spec(Root : func_specNode.Locator);
  25440.     procedure Scan_proc_spec(Root : proc_specNode.Locator);
  25441. end HEADER_Pkg;
  25442. -- End: SCHEADER spc -----------------------------------------------------
  25443. ::::::::::::::
  25444. scinner_r.bdy
  25445. ::::::::::::::
  25446. -- Begin: SCINNER_RECORD_CLASS bdy ---------------------------------------------------
  25447.      
  25448. with Halstead_Data_Base;  use Halstead_Data_Base;
  25449. with Definitions; use Definitions;
  25450.              with inner_record_IH;
  25451. with ITEM_Pkg; use ITEM_Pkg;
  25452. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25453. with VARIANT_ALTERNATIVE_CLASS_Pkg; use VARIANT_ALTERNATIVE_CLASS_Pkg;
  25454. package body INNER_RECORD_CLASS_Pkg is
  25455.      
  25456.      
  25457.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator) is
  25458.     begin
  25459.         case Kind(Root) is
  25460.           when inner_recordKind => Scan_inner_record(Root);
  25461.           when others => null;
  25462.         end case;
  25463.     end Scan_INNER_RECORD_CLASS;
  25464.      
  25465.      
  25466.     procedure Scan_inner_record(Root : inner_recordNode.Locator) is
  25467.         as_list_List : SeqOfITEM.Generator;
  25468.         as_list_Item : ITEM.Locator;
  25469.         use SeqOfITEM;
  25470.         as_variant_s_List : SeqOfvariant_alternativeNode.Generator;
  25471.         as_variant_s_Item : variant_alternativeNode.Locator;
  25472.         use SeqOfvariant_alternativeNode;
  25473.         as_trailing_pragma_s_List : SeqOfpragma_declNode.Generator;
  25474.         as_trailing_pragma_s_Item : pragma_declNode.Locator;
  25475.         use SeqOfpragma_declNode;
  25476.         Old_inner_record_IHR : inner_record_IH.RecType := inner_record_IH.R;
  25477.     begin
  25478.         inner_record_IH.R.ih_in_variant :=  false ;
  25479.       if not SeqOfITEM.IsNull(as_list(Root)) then
  25480.         StartForward(as_list(Root), as_list_List);
  25481.         while not Finished(as_list_List) loop
  25482.             as_list_Item := Cell(as_list_List);
  25483.             Scan_ITEM(as_list_Item);
  25484.             Forward(as_list_List);
  25485.         end loop;
  25486.         EndIterate(as_list_List);
  25487.       end if;
  25488.       if not NAME_EXP.IsNull(as_variant_name(Root)) then
  25489.      
  25490.      
  25491.        IncrementToken (case_variantz);
  25492.        inner_record_IH.R.ih_in_variant := true;
  25493.      
  25494.      
  25495.         Scan_NAME_EXP(as_variant_name(Root));
  25496.      
  25497.      
  25498.        IncrementToken (is_case_variantz);
  25499.      
  25500.      
  25501.       end if;
  25502.       if not SeqOfvariant_alternativeNode.IsNull(as_variant_s(Root)) then
  25503.         StartForward(as_variant_s(Root), as_variant_s_List);
  25504.         while not Finished(as_variant_s_List) loop
  25505.             as_variant_s_Item := Cell(as_variant_s_List);
  25506.             Scan_variant_alternative(as_variant_s_Item);
  25507.             Forward(as_variant_s_List);
  25508.         end loop;
  25509.         EndIterate(as_variant_s_List);
  25510.      
  25511.      
  25512.        IncrementToken (end_case_variantz);
  25513.        IncrementToken (case_variantz);
  25514.        IncrementToken (semicolonz);
  25515.        inner_record_IH.R.ih_in_variant := false;
  25516.      
  25517.      
  25518.       end if;
  25519.       if not SeqOfpragma_declNode.IsNull(as_trailing_pragma_s(Root)) then
  25520.         StartForward(as_trailing_pragma_s(Root), as_trailing_pragma_s_List);
  25521.         while not Finished(as_trailing_pragma_s_List) loop
  25522.             as_trailing_pragma_s_Item := Cell(as_trailing_pragma_s_List);
  25523.             Scan_pragma_decl(as_trailing_pragma_s_Item);
  25524.             Forward(as_trailing_pragma_s_List);
  25525.         end loop;
  25526.         EndIterate(as_trailing_pragma_s_List);
  25527.       end if;
  25528.         inner_record_IH.R := Old_inner_record_IHR;
  25529.      
  25530.     end Scan_inner_record;
  25531.      
  25532. end INNER_RECORD_CLASS_Pkg;
  25533. -- End: SCINNER_RECORD_CLASS bdy -----------------------------------------------------
  25534. ::::::::::::::
  25535. scinner_r.spc
  25536. ::::::::::::::
  25537. -- Begin: SCINNER_RECORD_CLASS spc ---------------------------------------------------
  25538.      
  25539. with ST_DIANA; use ST_DIANA;
  25540.              package INNER_RECORD_CLASS_Pkg is
  25541.     procedure Scan_INNER_RECORD_CLASS(Root : INNER_RECORD_CLASS.Locator);
  25542.     procedure Scan_inner_record(Root : inner_recordNode.Locator);
  25543. end INNER_RECORD_CLASS_Pkg;
  25544. -- End: SCINNER_RECORD_CLASS spc -----------------------------------------------------
  25545.      
  25546. ::::::::::::::
  25547. scitem.bdy
  25548. ::::::::::::::
  25549. -- Begin: SCITEM bdy ---------------------------------------------------
  25550.      
  25551. with Halstead_Data_Base;  use Halstead_Data_Base;
  25552. with Definitions; use Definitions;
  25553.              with SERIES_UNIT_IH;
  25554. with variable_decl_IH;
  25555. with subtype_decl_IH;
  25556. with task_decl_IH;
  25557. with type_decl_IH;
  25558. with GENERIC_HEADER_CLASS_Pkg; use GENERIC_HEADER_CLASS_Pkg;
  25559. with DEF_ID_Pkg; use DEF_ID_Pkg;
  25560. with PKG_DEF_Pkg; use PKG_DEF_Pkg;
  25561. with HEADER_Pkg; use HEADER_Pkg;
  25562. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  25563. with OBJECT_DEF_Pkg; use OBJECT_DEF_Pkg;
  25564. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  25565. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  25566. with SUBP_DEF_Pkg; use SUBP_DEF_Pkg;
  25567. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  25568. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  25569. with TYPE_SPEC_Pkg; use TYPE_SPEC_Pkg;
  25570.      
  25571.             with variable_decl_IH;
  25572.             with type_decl_IH;
  25573.             with generic_header_IH;
  25574.                        package body ITEM_Pkg is
  25575.      
  25576.      
  25577.     procedure Scan_ITEM(Root : ITEM.Locator) is
  25578.     begin
  25579.         case Kind(Root) is
  25580.           when GENERIC_ITEMKind => Scan_GENERIC_ITEM(Root);
  25581.           when OBJECT_ITEMKind => Scan_OBJECT_ITEM(Root);
  25582.           when PKG_ITEMKind => Scan_PKG_ITEM(Root);
  25583.           when REP_SPECKind => Scan_REP_SPEC(Root);
  25584.           when SUBP_ITEMKind => Scan_SUBP_ITEM(Root);
  25585.           when entry_declKind => Scan_entry_decl(Root);
  25586.           when exception_declKind => Scan_exception_decl(Root);
  25587.           when null_componentKind => Scan_null_component(Root);
  25588.           when number_declKind => Scan_number_decl(Root);
  25589.           when pragma_declKind => Scan_pragma_decl(Root);
  25590.           when subtype_declKind => Scan_subtype_decl(Root);
  25591.           when subunitKind => Scan_subunit(Root);
  25592.           when task_bodyKind => Scan_task_body(Root);
  25593.           when task_declKind => Scan_task_decl(Root);
  25594.           when type_declKind => Scan_type_decl(Root);
  25595.           when use_clauseKind => Scan_use_clause(Root);
  25596.           when with_clauseKind => Scan_with_clause(Root);
  25597.           when others => null;
  25598.         end case;
  25599.     end Scan_ITEM;
  25600.      
  25601.      
  25602.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator) is
  25603.     begin
  25604.         case Kind(Root) is
  25605.           when generic_pkg_declKind => Scan_generic_pkg_decl(Root);
  25606.           when generic_subp_declKind => Scan_generic_subp_decl(Root);
  25607.           when others => null;
  25608.         end case;
  25609.     end Scan_GENERIC_ITEM;
  25610.      
  25611.      
  25612.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator) is
  25613.     begin
  25614.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  25615.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  25616.       end if;
  25617.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  25618.      
  25619.      
  25620.        if not OuterMostBlockSeen then
  25621.            OuterMostBlockSeen := true;
  25622.        else
  25623.            BlockInfoStack.Push(BlockStack, CurrentBlock);
  25624.            CurrentBlock := InitializeCurrentBlock;
  25625.        end if;
  25626.        SetBlockId (lx_symrep (as_generic_id (root)),
  25627.                    package_spec_block,
  25628.                    SpcId,
  25629.                    LineNumber (lx_srcpos (root))
  25630.                    );
  25631.       IncrementToken (genericz);
  25632.       IncrementToken (package_spcz);
  25633.       IncrementToken (is_package_spcz);
  25634.       IncrementToken (end_package_spcz);
  25635.       IncrementToken (semicolonz);
  25636.      
  25637.      
  25638.         Scan_DEF_ID(as_generic_id(Root));
  25639.       end if;
  25640.       if not pkg_specNode.IsNull(as_generic_pkg_spec(Root)) then
  25641.         Scan_pkg_spec(as_generic_pkg_spec(Root));
  25642.       end if;
  25643.      
  25644.     end Scan_generic_pkg_decl;
  25645.      
  25646.      
  25647.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator) is
  25648.     begin
  25649.       if not GENERIC_HEADER_CLASS.IsNull(as_generic_spec(Root)) then
  25650.         Scan_GENERIC_HEADER_CLASS(as_generic_spec(Root));
  25651.       end if;
  25652.       if not DEF_ID.IsNull(as_generic_id(Root)) then
  25653.      
  25654.      
  25655.         IncrementToken (genericz);
  25656.         if Kind (as_generic_id (root)) in generic_proc_idKind then
  25657.             IncrementToken (procedurez);
  25658.         else
  25659.             IncrementToken (functionz);
  25660.         end if;
  25661.      
  25662.      
  25663.         Scan_DEF_ID(as_generic_id(Root));
  25664.       end if;
  25665.       if not HEADER.IsNull(as_generic_subp_spec(Root)) then
  25666.         Scan_HEADER(as_generic_subp_spec(Root));
  25667.       end if;
  25668.      
  25669.      
  25670.         IncrementToken (semicolonz);
  25671.      
  25672.      
  25673.      
  25674.     end Scan_generic_subp_decl;
  25675.      
  25676.      
  25677.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator) is
  25678.     begin
  25679.         case Kind(Root) is
  25680.           when component_declKind => Scan_component_decl(Root);
  25681.           when constant_declKind => Scan_constant_decl(Root);
  25682.           when dscrmt_declKind => Scan_dscrmt_decl(Root);
  25683.           when in_declKind => Scan_in_decl(Root);
  25684.           when in_out_declKind => Scan_in_out_decl(Root);
  25685.           when out_declKind => Scan_out_decl(Root);
  25686.           when variable_declKind => Scan_variable_decl(Root);
  25687.           when others => null;
  25688.         end case;
  25689.     end Scan_OBJECT_ITEM;
  25690.      
  25691.      
  25692.     procedure Scan_component_decl(Root : component_declNode.Locator) is
  25693.         as_id_s_List : SeqOfDEF_ID.Generator;
  25694.         as_id_s_Item : DEF_ID.Locator;
  25695.         use SeqOfDEF_ID;
  25696.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25697.     begin
  25698.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25699.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25700.         StartForward(as_id_s(Root), as_id_s_List);
  25701.         while not Finished(as_id_s_List) loop
  25702.             as_id_s_Item := Cell(as_id_s_List);
  25703.      
  25704.      
  25705.         if SERIES_UNIT_IH.R.ih_inlist then
  25706.             IncrementToken (commaz);
  25707.         end if;
  25708.         SERIES_UNIT_IH.R.ih_inlist := true;
  25709.      
  25710.      
  25711.             Scan_DEF_ID(as_id_s_Item);
  25712.             Forward(as_id_s_List);
  25713.         end loop;
  25714.         EndIterate(as_id_s_List);
  25715.      
  25716.      
  25717.         IncrementToken (colonz);
  25718.         SERIES_UNIT_IH.R.ih_inlist := false;
  25719.      
  25720.      
  25721.       end if;
  25722.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25723.         Scan_OBJECT_TYPE(as_object_type(Root));
  25724.       end if;
  25725.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25726.         Scan_OBJECT_DEF(as_object_def(Root));
  25727.       end if;
  25728.      
  25729.      
  25730.        IncrementToken (semicolonz);
  25731.      
  25732.      
  25733.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25734.      
  25735.     end Scan_component_decl;
  25736.      
  25737.      
  25738.     procedure Scan_constant_decl(Root : constant_declNode.Locator) is
  25739.         as_id_s_List : SeqOfDEF_ID.Generator;
  25740.         as_id_s_Item : DEF_ID.Locator;
  25741.         use SeqOfDEF_ID;
  25742.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25743.     begin
  25744.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25745.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25746.         StartForward(as_id_s(Root), as_id_s_List);
  25747.         while not Finished(as_id_s_List) loop
  25748.             as_id_s_Item := Cell(as_id_s_List);
  25749.      
  25750.      
  25751.         if SERIES_UNIT_IH.R.ih_inlist then
  25752.             IncrementToken (commaz);
  25753.         end if;
  25754.         SERIES_UNIT_IH.R.ih_inlist := true;
  25755.      
  25756.      
  25757.             Scan_DEF_ID(as_id_s_Item);
  25758.             Forward(as_id_s_List);
  25759.         end loop;
  25760.         EndIterate(as_id_s_List);
  25761.      
  25762.      
  25763.         IncrementToken (colonz);
  25764.         SERIES_UNIT_IH.R.ih_inlist := false;
  25765.      
  25766.      
  25767.       end if;
  25768.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25769.      
  25770.      
  25771.      IncrementToken (constantz);
  25772.      
  25773.      
  25774.         Scan_OBJECT_TYPE(as_object_type(Root));
  25775.       end if;
  25776.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25777.         Scan_OBJECT_DEF(as_object_def(Root));
  25778.       end if;
  25779.      
  25780.      
  25781.      IncrementToken (semicolonz);
  25782.      
  25783.      
  25784.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25785.      
  25786.     end Scan_constant_decl;
  25787.      
  25788.      
  25789.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator) is
  25790.         as_id_s_List : SeqOfDEF_ID.Generator;
  25791.         as_id_s_Item : DEF_ID.Locator;
  25792.         use SeqOfDEF_ID;
  25793.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25794.     begin
  25795.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25796.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25797.         StartForward(as_id_s(Root), as_id_s_List);
  25798.         while not Finished(as_id_s_List) loop
  25799.             as_id_s_Item := Cell(as_id_s_List);
  25800.      
  25801.      
  25802.         if SERIES_UNIT_IH.R.ih_inlist then
  25803.             IncrementToken (commaz);
  25804.         end if;
  25805.         SERIES_UNIT_IH.R.ih_inlist := true;
  25806.      
  25807.      
  25808.             Scan_DEF_ID(as_id_s_Item);
  25809.             Forward(as_id_s_List);
  25810.         end loop;
  25811.         EndIterate(as_id_s_List);
  25812.      
  25813.      
  25814.         IncrementToken (colonz);
  25815.         SERIES_UNIT_IH.R.ih_inlist := false;
  25816.      
  25817.      
  25818.       end if;
  25819.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25820.         Scan_OBJECT_TYPE(as_object_type(Root));
  25821.       end if;
  25822.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25823.         Scan_OBJECT_DEF(as_object_def(Root));
  25824.       end if;
  25825.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25826.      
  25827.     end Scan_dscrmt_decl;
  25828.      
  25829.      
  25830.     procedure Scan_in_decl(Root : in_declNode.Locator) is
  25831.         as_id_s_List : SeqOfDEF_ID.Generator;
  25832.         as_id_s_Item : DEF_ID.Locator;
  25833.         use SeqOfDEF_ID;
  25834.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25835.     begin
  25836.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25837.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25838.         StartForward(as_id_s(Root), as_id_s_List);
  25839.         while not Finished(as_id_s_List) loop
  25840.             as_id_s_Item := Cell(as_id_s_List);
  25841.      
  25842.      
  25843.         if SERIES_UNIT_IH.R.ih_inlist then
  25844.             IncrementToken (commaz);
  25845.         end if;
  25846.         SERIES_UNIT_IH.R.ih_inlist := true;
  25847.      
  25848.      
  25849.             Scan_DEF_ID(as_id_s_Item);
  25850.             Forward(as_id_s_List);
  25851.         end loop;
  25852.         EndIterate(as_id_s_List);
  25853.      
  25854.      
  25855.         IncrementToken (colonz);
  25856.         SERIES_UNIT_IH.R.ih_inlist := false;
  25857.      
  25858.      
  25859.       end if;
  25860.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25861.      
  25862.         if  lx_explicit_in_decl (root)
  25863.         then
  25864.      
  25865.      IncrementToken (in_parameterz);
  25866.      
  25867.         end if;
  25868.         Scan_OBJECT_TYPE(as_object_type(Root));
  25869.       end if;
  25870.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25871.         Scan_OBJECT_DEF(as_object_def(Root));
  25872.       end if;
  25873.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25874.      
  25875.     end Scan_in_decl;
  25876.      
  25877.      
  25878.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator) is
  25879.         as_id_s_List : SeqOfDEF_ID.Generator;
  25880.         as_id_s_Item : DEF_ID.Locator;
  25881.         use SeqOfDEF_ID;
  25882.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25883.     begin
  25884.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25885.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25886.         StartForward(as_id_s(Root), as_id_s_List);
  25887.         while not Finished(as_id_s_List) loop
  25888.             as_id_s_Item := Cell(as_id_s_List);
  25889.      
  25890.      
  25891.         if SERIES_UNIT_IH.R.ih_inlist then
  25892.             IncrementToken (commaz);
  25893.         end if;
  25894.         SERIES_UNIT_IH.R.ih_inlist := true;
  25895.      
  25896.      
  25897.             Scan_DEF_ID(as_id_s_Item);
  25898.             Forward(as_id_s_List);
  25899.         end loop;
  25900.         EndIterate(as_id_s_List);
  25901.      
  25902.      
  25903.         IncrementToken (colonz);
  25904.         SERIES_UNIT_IH.R.ih_inlist := false;
  25905.      
  25906.      
  25907.       end if;
  25908.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25909.      
  25910.      
  25911.      IncrementToken (in_out_parameterz);
  25912.      
  25913.      
  25914.      
  25915.         Scan_OBJECT_TYPE(as_object_type(Root));
  25916.       end if;
  25917.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25918.         Scan_OBJECT_DEF(as_object_def(Root));
  25919.       end if;
  25920.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25921.      
  25922.     end Scan_in_out_decl;
  25923.      
  25924.      
  25925.     procedure Scan_out_decl(Root : out_declNode.Locator) is
  25926.         as_id_s_List : SeqOfDEF_ID.Generator;
  25927.         as_id_s_Item : DEF_ID.Locator;
  25928.         use SeqOfDEF_ID;
  25929.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25930.     begin
  25931.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25932.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25933.         StartForward(as_id_s(Root), as_id_s_List);
  25934.         while not Finished(as_id_s_List) loop
  25935.             as_id_s_Item := Cell(as_id_s_List);
  25936.      
  25937.      
  25938.         if SERIES_UNIT_IH.R.ih_inlist then
  25939.             IncrementToken (commaz);
  25940.         end if;
  25941.         SERIES_UNIT_IH.R.ih_inlist := true;
  25942.      
  25943.      
  25944.             Scan_DEF_ID(as_id_s_Item);
  25945.             Forward(as_id_s_List);
  25946.         end loop;
  25947.         EndIterate(as_id_s_List);
  25948.      
  25949.      
  25950.         IncrementToken (colonz);
  25951.         SERIES_UNIT_IH.R.ih_inlist := false;
  25952.      
  25953.      
  25954.       end if;
  25955.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  25956.      
  25957.      
  25958.      IncrementToken (outz);
  25959.      
  25960.      
  25961.         Scan_OBJECT_TYPE(as_object_type(Root));
  25962.       end if;
  25963.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  25964.         Scan_OBJECT_DEF(as_object_def(Root));
  25965.       end if;
  25966.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  25967.      
  25968.     end Scan_out_decl;
  25969.      
  25970.      
  25971.     procedure Scan_variable_decl(Root : variable_declNode.Locator) is
  25972.         as_id_s_List : SeqOfDEF_ID.Generator;
  25973.         as_id_s_Item : DEF_ID.Locator;
  25974.         use SeqOfDEF_ID;
  25975.         Old_variable_decl_IHR : variable_decl_IH.RecType := variable_decl_IH.R;
  25976.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  25977.     begin
  25978.         variable_decl_IH.R.ih_init :=  false ;
  25979.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  25980.       if not SeqOfDEF_ID.IsNull(as_id_s(Root)) then
  25981.         StartForward(as_id_s(Root), as_id_s_List);
  25982.         while not Finished(as_id_s_List) loop
  25983.             as_id_s_Item := Cell(as_id_s_List);
  25984.      
  25985.      
  25986.         if SERIES_UNIT_IH.R.ih_inlist then
  25987.             IncrementToken (commaz);
  25988.         end if;
  25989.         SERIES_UNIT_IH.R.ih_inlist := true;
  25990.      
  25991.      
  25992.             Scan_DEF_ID(as_id_s_Item);
  25993.             Forward(as_id_s_List);
  25994.         end loop;
  25995.         EndIterate(as_id_s_List);
  25996.      
  25997.      
  25998.         IncrementToken (colonz);
  25999.         SERIES_UNIT_IH.R.ih_inlist := false;
  26000.      
  26001.      
  26002.       end if;
  26003.       if not OBJECT_TYPE.IsNull(as_object_type(Root)) then
  26004.         Scan_OBJECT_TYPE(as_object_type(Root));
  26005.       end if;
  26006.       if not OBJECT_DEF.IsNull(as_object_def(Root)) then
  26007.         Scan_OBJECT_DEF(as_object_def(Root));
  26008.       end if;
  26009.      
  26010.      
  26011.      IncrementToken (semicolonz);
  26012.      
  26013.      
  26014.         variable_decl_IH.R := Old_variable_decl_IHR;
  26015.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26016.      
  26017.     end Scan_variable_decl;
  26018.      
  26019.      
  26020.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator) is
  26021.     begin
  26022.         case Kind(Root) is
  26023.           when pkg_bodyKind => Scan_pkg_body(Root);
  26024.           when pkg_declKind => Scan_pkg_decl(Root);
  26025.           when others => null;
  26026.         end case;
  26027.     end Scan_PKG_ITEM;
  26028.      
  26029.      
  26030.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator) is
  26031.     begin
  26032.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  26033.         Scan_pkg_id(as_pkg_id(Root));
  26034.      
  26035.      
  26036.          if not OuterMostBlockSeen then
  26037.              OuterMostBlockSeen := true;
  26038.          else
  26039.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  26040.              CurrentBlock := InitializeCurrentBlock;
  26041.          end if;
  26042.          SetBlockId (lx_symrep (as_pkg_id (root)),
  26043.                      package_body_block,
  26044.                      BdyId,
  26045.                      LineNumber (lx_srcpos (root))
  26046.                      );
  26047.          IncrementToken (package_bdyz);
  26048.          IncrementToken (body_packagez);
  26049.          IncrementToken (is_package_bdyz);
  26050.      
  26051.      
  26052.       end if;
  26053.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  26054.         Scan_PKG_DEF(as_pkg_def(Root));
  26055.       end if;
  26056.      
  26057.      
  26058.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26059.         IncrementToken (semicolonz);
  26060.         ProcessBlockInfo (CurrentBlock);
  26061.         FreeSpace (CurrentBlock);
  26062.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26063.    end if;
  26064.      
  26065.      
  26066.      
  26067.     end Scan_pkg_body;
  26068.      
  26069.      
  26070.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator) is
  26071.     begin
  26072.       if not pkg_idNode.IsNull(as_pkg_id(Root)) then
  26073.         Scan_pkg_id(as_pkg_id(Root));
  26074.      
  26075.      
  26076.       if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26077.          if not OuterMostBlockSeen then
  26078.              OuterMostBlockSeen := true;
  26079.          else
  26080.              BlockInfoStack.Push(BlockStack, CurrentBlock);
  26081.              CurrentBlock := InitializeCurrentBlock;
  26082.          end if;
  26083.          SetBlockId (lx_symrep (as_pkg_id (root)),
  26084.                      package_spec_block,
  26085.                      SpcId,
  26086.                      LineNumber (lx_srcpos (root))
  26087.                      );
  26088.         IncrementToken (end_package_spcz);
  26089.      end if;
  26090.      IncrementToken (package_spcz);
  26091.      IncrementToken (is_package_spcz);
  26092.      
  26093.      
  26094.       end if;
  26095.       if not PKG_DEF.IsNull(as_pkg_def(Root)) then
  26096.         Scan_PKG_DEF(as_pkg_def(Root));
  26097.       end if;
  26098.      
  26099.      
  26100.     if Kind (as_pkg_def (root)) not in pkg_instantiationKind then
  26101.         IncrementToken (semicolonz);
  26102.         ProcessBlockInfo (CurrentBlock);
  26103.         FreeSpace (CurrentBlock);
  26104.         BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26105.    end if;
  26106.      
  26107.      
  26108.      
  26109.     end Scan_pkg_decl;
  26110.      
  26111.      
  26112.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator) is
  26113.     begin
  26114.         case Kind(Root) is
  26115.           when address_repKind => Scan_address_rep(Root);
  26116.           when record_repKind => Scan_record_rep(Root);
  26117.           when rep_componentKind => Scan_rep_component(Root);
  26118.           when simple_repKind => Scan_simple_rep(Root);
  26119.           when others => null;
  26120.         end case;
  26121.     end Scan_REP_SPEC;
  26122.      
  26123.      
  26124.     procedure Scan_address_rep(Root : address_repNode.Locator) is
  26125.     begin
  26126.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26127.      
  26128.      
  26129.       IncrementToken (for_repz);
  26130.      
  26131.      
  26132.         Scan_NAME_EXP(as_rep_name(Root));
  26133.      
  26134.      
  26135.       IncrementToken (use_repz);
  26136.       IncrementToken (atz);
  26137.       IncrementToken (semicolonz);
  26138.      
  26139.      
  26140.       end if;
  26141.       if not NAME_EXP.IsNull(as_address_rep_exp(Root)) then
  26142.         Scan_NAME_EXP(as_address_rep_exp(Root));
  26143.       end if;
  26144.      
  26145.     end Scan_address_rep;
  26146.      
  26147.      
  26148.     procedure Scan_record_rep(Root : record_repNode.Locator) is
  26149.         as_components_List : SeqOfrep_componentNode.Generator;
  26150.         as_components_Item : rep_componentNode.Locator;
  26151.         use SeqOfrep_componentNode;
  26152.     begin
  26153.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26154.      
  26155.      
  26156.       IncrementToken (for_repz);
  26157.      
  26158.      
  26159.         Scan_NAME_EXP(as_rep_name(Root));
  26160.      
  26161.      
  26162.    IncrementToken (use_repz);
  26163.    IncrementToken (record_repz);
  26164.      
  26165.      
  26166.       end if;
  26167.       if not NAME_EXP.IsNull(as_record_alignment(Root)) then
  26168.      
  26169.      
  26170.       IncrementToken (atz);
  26171.       IncrementToken (modz);
  26172.      
  26173.      
  26174.         Scan_NAME_EXP(as_record_alignment(Root));
  26175.       end if;
  26176.       if not SeqOfrep_componentNode.IsNull(as_components(Root)) then
  26177.         StartForward(as_components(Root), as_components_List);
  26178.         while not Finished(as_components_List) loop
  26179.             as_components_Item := Cell(as_components_List);
  26180.             Scan_rep_component(as_components_Item);
  26181.             Forward(as_components_List);
  26182.         end loop;
  26183.         EndIterate(as_components_List);
  26184.      
  26185.      
  26186.          IncrementToken (end_record_repz);
  26187.          IncrementToken (record_repz);
  26188.          IncrementToken (semicolonz);
  26189.      
  26190.      
  26191.       end if;
  26192.      
  26193.     end Scan_record_rep;
  26194.      
  26195.      
  26196.     procedure Scan_rep_component(Root : rep_componentNode.Locator) is
  26197.     begin
  26198.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26199.         Scan_NAME_EXP(as_rep_name(Root));
  26200.      
  26201.      
  26202.           IncrementToken (atz);
  26203.      
  26204.      
  26205.       end if;
  26206.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_alignment_range(Root)) then
  26207.      
  26208.      
  26209.       IncrementToken (rangez);
  26210.      
  26211.      
  26212.         Scan_RANGE_CONSTRAINT_CLASS(as_alignment_range(Root));
  26213.       end if;
  26214.       if not NAME_EXP.IsNull(as_rep_component_exp(Root)) then
  26215.         Scan_NAME_EXP(as_rep_component_exp(Root));
  26216.       end if;
  26217.      
  26218.     end Scan_rep_component;
  26219.      
  26220.      
  26221.     procedure Scan_simple_rep(Root : simple_repNode.Locator) is
  26222.     begin
  26223.       if not NAME_EXP.IsNull(as_rep_name(Root)) then
  26224.         Scan_NAME_EXP(as_rep_name(Root));
  26225.       end if;
  26226.       if not NAME_EXP.IsNull(as_simple_rep_exp(Root)) then
  26227.      
  26228.      
  26229.      IncrementToken (for_repz);
  26230.      
  26231.      
  26232.         Scan_NAME_EXP(as_simple_rep_exp(Root));
  26233.      
  26234.      
  26235.       IncrementToken (use_repz);
  26236.      
  26237.      
  26238.       end if;
  26239.      
  26240.     end Scan_simple_rep;
  26241.      
  26242.      
  26243.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator) is
  26244.     begin
  26245.         case Kind(Root) is
  26246.           when subp_bodyKind => Scan_subp_body(Root);
  26247.           when subp_declKind => Scan_subp_decl(Root);
  26248.           when others => null;
  26249.         end case;
  26250.     end Scan_SUBP_ITEM;
  26251.      
  26252.      
  26253.     procedure Scan_subp_body(Root : subp_bodyNode.Locator) is
  26254.     begin
  26255.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  26256.         Scan_DEF_ID(as_subp_designator(Root));
  26257.      
  26258.      
  26259.       if not OuterMostBlockSeen then
  26260.           OuterMostBlockSeen := true;
  26261.       else
  26262.           BlockInfoStack.Push(BlockStack, CurrentBlock);
  26263.           CurrentBlock := InitializeCurrentBlock;
  26264.       end if;
  26265.        if Kind (as_subp_designator (root)) in proc_idKind then
  26266.            SetBlockId (lx_symrep (as_subp_designator (root)),
  26267.                        procedure_block,
  26268.                        BdyId,
  26269.                        LineNumber (lx_srcpos (root))
  26270.                        );
  26271.            IncrementToken (procedurez);
  26272.            IncrementToken (is_procedurez);
  26273.        else
  26274.            SetBlockId (lx_symrep (as_subp_designator (root)),
  26275.                        function_block,
  26276.                        BdyId,
  26277.                        LineNumber (lx_srcpos (root))
  26278.                        );
  26279.            IncrementToken (functionz);
  26280.            IncrementToken (is_functionz);
  26281.        end if;
  26282.      
  26283.      
  26284.       end if;
  26285.       if not HEADER.IsNull(as_subp_spec(Root)) then
  26286.         Scan_HEADER(as_subp_spec(Root));
  26287.       end if;
  26288.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  26289.         Scan_SUBP_DEF(as_subp_def(Root));
  26290.      
  26291.      
  26292.        ProcessBlockInfo (CurrentBlock);
  26293.        FreeSpace (CurrentBlock);
  26294.        BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26295.      
  26296.      
  26297.       end if;
  26298.      
  26299.     end Scan_subp_body;
  26300.      
  26301.      
  26302.     procedure Scan_subp_decl(Root : subp_declNode.Locator) is
  26303.     begin
  26304.       if not DEF_ID.IsNull(as_subp_designator(Root)) then
  26305.         Scan_DEF_ID(as_subp_designator(Root));
  26306.       end if;
  26307.       if not HEADER.IsNull(as_subp_spec(Root)) then
  26308.         Scan_HEADER(as_subp_spec(Root));
  26309.       end if;
  26310.       if not SUBP_DEF.IsNull(as_subp_def(Root)) then
  26311.         Scan_SUBP_DEF(as_subp_def(Root));
  26312.       end if;
  26313.      
  26314.      
  26315.            if generic_header_IH.R.ih_ingeneric_param then
  26316.                IncrementToken (with_genericz);
  26317.            end if;
  26318.            if Kind (as_subp_designator (root)) in proc_idKind then
  26319.                IncrementToken (procedurez);
  26320.            else
  26321.                IncrementToken (functionz);
  26322.            end if;
  26323.      
  26324.      
  26325.      
  26326.      
  26327.         IncrementToken (semicolonz);
  26328.      
  26329.      
  26330.      
  26331.     end Scan_subp_decl;
  26332.      
  26333.      
  26334.     procedure Scan_entry_decl(Root : entry_declNode.Locator) is
  26335.     begin
  26336.      
  26337.      
  26338.      IncrementToken (entryz);
  26339.      
  26340.      
  26341.       if not entry_idNode.IsNull(as_entry_designator(Root)) then
  26342.         Scan_entry_id(as_entry_designator(Root));
  26343.       end if;
  26344.       if not entry_specNode.IsNull(as_entry_spec(Root)) then
  26345.         Scan_entry_spec(as_entry_spec(Root));
  26346.       end if;
  26347.      
  26348.      
  26349.      IncrementToken (semicolonz);
  26350.      
  26351.      
  26352.      
  26353.     end Scan_entry_decl;
  26354.      
  26355.      
  26356.     procedure Scan_exception_decl(Root : exception_declNode.Locator) is
  26357.         as_exception_id_s_List : SeqOfexception_idNode.Generator;
  26358.         as_exception_id_s_Item : exception_idNode.Locator;
  26359.         use SeqOfexception_idNode;
  26360.     begin
  26361.       if not SeqOfexception_idNode.IsNull(as_exception_id_s(Root)) then
  26362.         StartForward(as_exception_id_s(Root), as_exception_id_s_List);
  26363.         while not Finished(as_exception_id_s_List) loop
  26364.             as_exception_id_s_Item := Cell(as_exception_id_s_List);
  26365.      
  26366.      
  26367.       if SERIES_UNIT_IH.R.ih_inlist then
  26368.          IncrementToken (commaz);
  26369.       end if;
  26370.       SERIES_UNIT_IH.R.ih_inlist := true;
  26371.      
  26372.      
  26373.             Scan_exception_id(as_exception_id_s_Item);
  26374.             Forward(as_exception_id_s_List);
  26375.         end loop;
  26376.         EndIterate(as_exception_id_s_List);
  26377.      
  26378.      
  26379.        IncrementToken (colonz);
  26380.        IncrementToken (exceptionz);
  26381.        IncrementToken (semicolonz);
  26382.        SERIES_UNIT_IH.R.ih_inlist := false;
  26383.      
  26384.      
  26385.       end if;
  26386.       if not NAME_EXP.IsNull(as_exception_def(Root)) then
  26387.      
  26388.      
  26389.       IncrementToken (renamesz);
  26390.      
  26391.      
  26392.         Scan_NAME_EXP(as_exception_def(Root));
  26393.       end if;
  26394.      
  26395.     end Scan_exception_decl;
  26396.      
  26397.      
  26398.     procedure Scan_null_component(Root : null_componentNode.Locator) is
  26399.     begin
  26400.      
  26401.      
  26402.       IncrementToken (null_fieldz);
  26403.       IncrementToken (semicolonz);
  26404.      
  26405.      
  26406.      
  26407.     end Scan_null_component;
  26408.      
  26409.      
  26410.     procedure Scan_number_decl(Root : number_declNode.Locator) is
  26411.         as_number_id_s_List : SeqOfnumber_idNode.Generator;
  26412.         as_number_id_s_Item : number_idNode.Locator;
  26413.         use SeqOfnumber_idNode;
  26414.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26415.     begin
  26416.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26417.       if not SeqOfnumber_idNode.IsNull(as_number_id_s(Root)) then
  26418.         StartForward(as_number_id_s(Root), as_number_id_s_List);
  26419.         while not Finished(as_number_id_s_List) loop
  26420.             as_number_id_s_Item := Cell(as_number_id_s_List);
  26421.      
  26422.      
  26423.        if SERIES_UNIT_IH.R.ih_inlist then
  26424.           IncrementToken (commaz);
  26425.        end if;
  26426.        SERIES_UNIT_IH.R.ih_inlist := true;
  26427.      
  26428.      
  26429.             Scan_number_id(as_number_id_s_Item);
  26430.             Forward(as_number_id_s_List);
  26431.         end loop;
  26432.         EndIterate(as_number_id_s_List);
  26433.      
  26434.      
  26435.      IncrementToken (colonz);
  26436.      SERIES_UNIT_IH.R.ih_inlist := false;
  26437.      
  26438.      
  26439.       end if;
  26440.       if not NAME_EXP.IsNull(as_number_exp(Root)) then
  26441.      
  26442.      
  26443.      IncrementToken (constantz);
  26444.      IncrementToken (colon_equalsz);
  26445.      
  26446.      
  26447.         Scan_NAME_EXP(as_number_exp(Root));
  26448.       end if;
  26449.      
  26450.      
  26451.      IncrementToken (semicolonz);
  26452.      
  26453.      
  26454.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26455.      
  26456.     end Scan_number_decl;
  26457.      
  26458.      
  26459.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator) is
  26460.         as_pragma_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  26461.         as_pragma_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  26462.         use SeqOfGENERAL_ASSOC;
  26463.     begin
  26464.      
  26465.      
  26466.       IncrementToken (pragmaz);
  26467.      
  26468.      
  26469.       if not used_idNode.IsNull(as_pragma_id(Root)) then
  26470.         Scan_used_id(as_pragma_id(Root));
  26471.       end if;
  26472.       if not SeqOfGENERAL_ASSOC.IsNull(as_pragma_param_assoc_s(Root)) then
  26473.      
  26474.      
  26475.        IncrementToken (open_parenthesisz);
  26476.      
  26477.      
  26478.         StartForward(as_pragma_param_assoc_s(Root), as_pragma_param_assoc_s_List);
  26479.         while not Finished(as_pragma_param_assoc_s_List) loop
  26480.             as_pragma_param_assoc_s_Item := Cell(as_pragma_param_assoc_s_List);
  26481.      
  26482.      
  26483.         if SERIES_UNIT_IH.R.ih_inlist then
  26484.             IncrementToken (commaz);
  26485.         end if;
  26486.         SERIES_UNIT_IH.R.ih_inlist := true;
  26487.      
  26488.      
  26489.             Scan_GENERAL_ASSOC(as_pragma_param_assoc_s_Item);
  26490.             Forward(as_pragma_param_assoc_s_List);
  26491.         end loop;
  26492.         EndIterate(as_pragma_param_assoc_s_List);
  26493.      
  26494.      
  26495.        IncrementToken (closed_parenthesisz);
  26496.        SERIES_UNIT_IH.R.ih_inlist := false;
  26497.      
  26498.      
  26499.       end if;
  26500.      
  26501.      
  26502.        IncrementToken (semicolonz);
  26503.      
  26504.      
  26505.      
  26506.     end Scan_pragma_decl;
  26507.      
  26508.      
  26509.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator) is
  26510.         Old_subtype_decl_IHR : subtype_decl_IH.RecType := subtype_decl_IH.R;
  26511.     begin
  26512.         subtype_decl_IH.R.ih_in_subtype_decl :=  false ;
  26513.      
  26514.      
  26515.      IncrementToken (subtypez);
  26516.      subtype_decl_IH.R.ih_in_subtype_decl := true;
  26517.      
  26518.      
  26519.       if not subtype_idNode.IsNull(as_subtype_id(Root)) then
  26520.         Scan_subtype_id(as_subtype_id(Root));
  26521.      
  26522.      
  26523.       IncrementToken (is_subtypez);
  26524.      
  26525.      
  26526.       end if;
  26527.       if not object_type_constrainedNode.IsNull(as_subtype_constrained(Root)) then
  26528.         Scan_object_type_constrained(as_subtype_constrained(Root));
  26529.       end if;
  26530.      
  26531.      
  26532.       subtype_decl_IH.R.ih_in_subtype_decl := false;
  26533.       IncrementToken (semicolonz);
  26534.      
  26535.      
  26536.         subtype_decl_IH.R := Old_subtype_decl_IHR;
  26537.      
  26538.     end Scan_subtype_decl;
  26539.      
  26540.      
  26541.     procedure Scan_subunit(Root : subunitNode.Locator) is
  26542.     begin
  26543.      
  26544.      
  26545.      IncrementToken (separatez);
  26546.      
  26547.      
  26548.       if not NAME_EXP.IsNull(as_subunit_path(Root)) then
  26549.      
  26550.      
  26551.      IncrementToken (open_parenthesisz);
  26552.      
  26553.      
  26554.         Scan_NAME_EXP(as_subunit_path(Root));
  26555.      
  26556.      
  26557.      IncrementToken (closed_parenthesisz);
  26558.      
  26559.      
  26560.       end if;
  26561.       if not ITEM.IsNull(as_subunit_body(Root)) then
  26562.         Scan_ITEM(as_subunit_body(Root));
  26563.       end if;
  26564.      
  26565.     end Scan_subunit;
  26566.      
  26567.      
  26568.     procedure Scan_task_body(Root : task_bodyNode.Locator) is
  26569.     begin
  26570.      
  26571.      
  26572.      if not OuterMostBlockSeen then
  26573.          OuterMostBlockSeen := true;
  26574.      else
  26575.          BlockInfoStack.Push(BlockStack, CurrentBlock);
  26576.          CurrentBlock := InitializeCurrentBlock;
  26577.      end if;
  26578.      SetBlockId (lx_symrep (as_task_body_id (root)),
  26579.                  task_body_block,
  26580.                  BdyId,
  26581.                  LineNumber (lx_srcpos (root))
  26582.                  );
  26583.      IncrementToken (task_bdyz);
  26584.      IncrementToken (body_taskz);
  26585.      IncrementToken (is_task_bdyz);
  26586.      
  26587.      
  26588.       if not task_body_idNode.IsNull(as_task_body_id(Root)) then
  26589.         Scan_task_body_id(as_task_body_id(Root));
  26590.       end if;
  26591.       if not BLOCK_STUB.IsNull(as_task_body_block_stub(Root)) then
  26592.         Scan_BLOCK_STUB(as_task_body_block_stub(Root));
  26593.       end if;
  26594.      
  26595.      
  26596.      IncrementToken (semicolonz);
  26597.      ProcessBlockInfo (CurrentBlock);
  26598.      FreeSpace (CurrentBlock);
  26599.      BlockInfoStack.Pop(BlockStack, CurrentBlock);
  26600.      
  26601.      
  26602.      
  26603.     end Scan_task_body;
  26604.      
  26605.      
  26606.     procedure Scan_task_decl(Root : task_declNode.Locator) is
  26607.         Old_task_decl_IHR : task_decl_IH.RecType := task_decl_IH.R;
  26608.     begin
  26609.         task_decl_IH.R.ih_intask_decl :=  false ;
  26610.      
  26611.      
  26612.       task_decl_IH.R.ih_intask_decl := true;
  26613.      
  26614.      
  26615.       if not variable_idNode.IsNull(as_task_id(Root)) then
  26616.         Scan_variable_id(as_task_id(Root));
  26617.       end if;
  26618.       if not task_specNode.IsNull(as_task_def(Root)) then
  26619.         Scan_task_spec(as_task_def(Root));
  26620.       end if;
  26621.      
  26622.      
  26623.  task_decl_IH.R.ih_intask_decl := false;
  26624.      
  26625.      
  26626.         task_decl_IH.R := Old_task_decl_IHR;
  26627.      
  26628.     end Scan_task_decl;
  26629.      
  26630.      
  26631.     procedure Scan_type_decl(Root : type_declNode.Locator) is
  26632.         as_type_dscrmt_s_List : SeqOfdscrmt_declNode.Generator;
  26633.         as_type_dscrmt_s_Item : dscrmt_declNode.Locator;
  26634.         use SeqOfdscrmt_declNode;
  26635.         Old_type_decl_IHR : type_decl_IH.RecType := type_decl_IH.R;
  26636.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26637.     begin
  26638.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26639.      
  26640.      
  26641.      if Kind (as_type_spec (root)) not in task_specKind then
  26642.         IncrementToken (typez);
  26643.         IncrementToken (is_typez);
  26644.      end if;
  26645.      
  26646.      
  26647.       if not type_idNode.IsNull(as_type_id(Root)) then
  26648.         Scan_type_id(as_type_id(Root));
  26649.       end if;
  26650.       if not SeqOfdscrmt_declNode.IsNull(as_type_dscrmt_s(Root)) then
  26651.      
  26652.      
  26653.      IncrementToken (open_parenthesisz);
  26654.      
  26655.      
  26656.         StartForward(as_type_dscrmt_s(Root), as_type_dscrmt_s_List);
  26657.         while not Finished(as_type_dscrmt_s_List) loop
  26658.             as_type_dscrmt_s_Item := Cell(as_type_dscrmt_s_List);
  26659.      
  26660.      
  26661.       if SERIES_UNIT_IH.R.ih_inlist then
  26662.           IncrementToken (semicolonz);
  26663.       end if;
  26664.       SERIES_UNIT_IH.R.ih_inlist := true;
  26665.      
  26666.      
  26667.             Scan_dscrmt_decl(as_type_dscrmt_s_Item);
  26668.             Forward(as_type_dscrmt_s_List);
  26669.         end loop;
  26670.         EndIterate(as_type_dscrmt_s_List);
  26671.      
  26672.      
  26673.      IncrementToken (closed_parenthesisz);
  26674.      SERIES_UNIT_IH.R.ih_inlist := false;
  26675.      
  26676.      
  26677.       end if;
  26678.       if not TYPE_SPEC.IsNull(as_type_spec(Root)) then
  26679.         Scan_TYPE_SPEC(as_type_spec(Root));
  26680.       end if;
  26681.      
  26682.      
  26683.      if Kind (as_type_spec (root)) not in task_specKind then
  26684.         IncrementToken (semicolonz);
  26685.      end if;
  26686.      
  26687.      
  26688.         type_decl_IH.R := Old_type_decl_IHR;
  26689.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26690.      
  26691.     end Scan_type_decl;
  26692.      
  26693.      
  26694.     procedure Scan_use_clause(Root : use_clauseNode.Locator) is
  26695.         as_use_clause_list_List : SeqOfNAME_EXP.Generator;
  26696.         as_use_clause_list_Item : NAME_EXP.Locator;
  26697.         use SeqOfNAME_EXP;
  26698.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26699.     begin
  26700.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26701.       if not SeqOfNAME_EXP.IsNull(as_use_clause_list(Root)) then
  26702.      
  26703.      
  26704.      IncrementToken (use_contextz);
  26705.      
  26706.      
  26707.         StartForward(as_use_clause_list(Root), as_use_clause_list_List);
  26708.         while not Finished(as_use_clause_list_List) loop
  26709.             as_use_clause_list_Item := Cell(as_use_clause_list_List);
  26710.      
  26711.      
  26712.       if SERIES_UNIT_IH.R.ih_inlist then
  26713.           IncrementToken (commaz);
  26714.       end if;
  26715.       SERIES_UNIT_IH.R.ih_inlist := true;
  26716.      
  26717.      
  26718.             Scan_NAME_EXP(as_use_clause_list_Item);
  26719.             Forward(as_use_clause_list_List);
  26720.         end loop;
  26721.         EndIterate(as_use_clause_list_List);
  26722.       end if;
  26723.      
  26724.      
  26725.      IncrementToken (semicolonz);
  26726.      SERIES_UNIT_IH.R.ih_inlist := false;
  26727.      
  26728.      
  26729.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26730.      
  26731.     end Scan_use_clause;
  26732.      
  26733.      
  26734.     procedure Scan_with_clause(Root : with_clauseNode.Locator) is
  26735.         as_with_clause_list_List : SeqOfNAME_EXP.Generator;
  26736.         as_with_clause_list_Item : NAME_EXP.Locator;
  26737.         use SeqOfNAME_EXP;
  26738.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26739.     begin
  26740.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26741.       if not SeqOfNAME_EXP.IsNull(as_with_clause_list(Root)) then
  26742.      
  26743.      
  26744.      IncrementToken (with_contextz);
  26745.      
  26746.      
  26747.         StartForward(as_with_clause_list(Root), as_with_clause_list_List);
  26748.         while not Finished(as_with_clause_list_List) loop
  26749.             as_with_clause_list_Item := Cell(as_with_clause_list_List);
  26750.      
  26751.      
  26752.        if SERIES_UNIT_IH.R.ih_inlist then
  26753.            IncrementToken (commaz);
  26754.        end if;
  26755.        SERIES_UNIT_IH.R.ih_inlist := true;
  26756.      
  26757.      
  26758.             Scan_NAME_EXP(as_with_clause_list_Item);
  26759.             Forward(as_with_clause_list_List);
  26760.         end loop;
  26761.         EndIterate(as_with_clause_list_List);
  26762.       end if;
  26763.      
  26764.      
  26765.       IncrementToken (semicolonz);
  26766.       SERIES_UNIT_IH.R.ih_inlist := false;
  26767.      
  26768.      
  26769.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  26770.      
  26771.     end Scan_with_clause;
  26772.      
  26773. end ITEM_Pkg;
  26774. -- End: SCITEM bdy -----------------------------------------------------
  26775. ::::::::::::::
  26776. scitem.spc
  26777. ::::::::::::::
  26778. -- Begin: SCITEM spc ---------------------------------------------------
  26779.      
  26780. with ST_DIANA; use ST_DIANA;
  26781.              package ITEM_Pkg is
  26782.     procedure Scan_ITEM(Root : ITEM.Locator);
  26783.     procedure Scan_GENERIC_ITEM(Root : GENERIC_ITEM.Locator);
  26784.     procedure Scan_generic_pkg_decl(Root : generic_pkg_declNode.Locator);
  26785.     procedure Scan_generic_subp_decl(Root : generic_subp_declNode.Locator);
  26786.     procedure Scan_OBJECT_ITEM(Root : OBJECT_ITEM.Locator);
  26787.     procedure Scan_component_decl(Root : component_declNode.Locator);
  26788.     procedure Scan_constant_decl(Root : constant_declNode.Locator);
  26789.     procedure Scan_dscrmt_decl(Root : dscrmt_declNode.Locator);
  26790.     procedure Scan_in_decl(Root : in_declNode.Locator);
  26791.     procedure Scan_in_out_decl(Root : in_out_declNode.Locator);
  26792.     procedure Scan_out_decl(Root : out_declNode.Locator);
  26793.     procedure Scan_variable_decl(Root : variable_declNode.Locator);
  26794.     procedure Scan_PKG_ITEM(Root : PKG_ITEM.Locator);
  26795.     procedure Scan_pkg_body(Root : pkg_bodyNode.Locator);
  26796.     procedure Scan_pkg_decl(Root : pkg_declNode.Locator);
  26797.     procedure Scan_REP_SPEC(Root : REP_SPEC.Locator);
  26798.     procedure Scan_address_rep(Root : address_repNode.Locator);
  26799.     procedure Scan_record_rep(Root : record_repNode.Locator);
  26800.     procedure Scan_rep_component(Root : rep_componentNode.Locator);
  26801.     procedure Scan_simple_rep(Root : simple_repNode.Locator);
  26802.     procedure Scan_SUBP_ITEM(Root : SUBP_ITEM.Locator);
  26803.     procedure Scan_subp_body(Root : subp_bodyNode.Locator);
  26804.     procedure Scan_subp_decl(Root : subp_declNode.Locator);
  26805.     procedure Scan_entry_decl(Root : entry_declNode.Locator);
  26806.     procedure Scan_exception_decl(Root : exception_declNode.Locator);
  26807.     procedure Scan_null_component(Root : null_componentNode.Locator);
  26808.     procedure Scan_number_decl(Root : number_declNode.Locator);
  26809.     procedure Scan_pragma_decl(Root : pragma_declNode.Locator);
  26810.     procedure Scan_subtype_decl(Root : subtype_declNode.Locator);
  26811.     procedure Scan_subunit(Root : subunitNode.Locator);
  26812.     procedure Scan_task_body(Root : task_bodyNode.Locator);
  26813.     procedure Scan_task_decl(Root : task_declNode.Locator);
  26814.     procedure Scan_type_decl(Root : type_declNode.Locator);
  26815.     procedure Scan_use_clause(Root : use_clauseNode.Locator);
  26816.     procedure Scan_with_clause(Root : with_clauseNode.Locator);
  26817. end ITEM_Pkg;
  26818. -- End: SCITEM spc -----------------------------------------------------
  26819. ::::::::::::::
  26820. sciterati.bdy
  26821. ::::::::::::::
  26822. -- Begin: SCITERATION bdy ---------------------------------------------------
  26823.      
  26824. with Halstead_Data_Base;  use Halstead_Data_Base;
  26825. with Definitions; use Definitions;
  26826.              with DEF_ID_Pkg; use DEF_ID_Pkg;
  26827. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  26828. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  26829. package body ITERATION_Pkg is
  26830.      
  26831.      
  26832.     procedure Scan_ITERATION(Root : ITERATION.Locator) is
  26833.     begin
  26834.         case Kind(Root) is
  26835.           when FOR_ITERATIONKind => Scan_FOR_ITERATION(Root);
  26836.           when while_iterationKind => Scan_while_iteration(Root);
  26837.           when others => null;
  26838.         end case;
  26839.     end Scan_ITERATION;
  26840.      
  26841.      
  26842.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator) is
  26843.     begin
  26844.         case Kind(Root) is
  26845.           when forward_iterationKind => Scan_forward_iteration(Root);
  26846.           when reverse_iterationKind => Scan_reverse_iteration(Root);
  26847.           when others => null;
  26848.         end case;
  26849.     end Scan_FOR_ITERATION;
  26850.      
  26851.      
  26852.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator) is
  26853.     begin
  26854.       if not iteration_idNode.IsNull(as_id(Root)) then
  26855.      
  26856.      
  26857.        IncrementToken (for_loopz);
  26858.        IncrementToken (in_loopz);
  26859.      
  26860.      
  26861.         Scan_iteration_id(as_id(Root));
  26862.       end if;
  26863.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  26864.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  26865.       end if;
  26866.      
  26867.     end Scan_forward_iteration;
  26868.      
  26869.      
  26870.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator) is
  26871.     begin
  26872.       if not iteration_idNode.IsNull(as_id(Root)) then
  26873.      
  26874.      
  26875.        IncrementToken (for_loopz);
  26876.        IncrementToken (in_loopz);
  26877.      
  26878.      
  26879.         Scan_iteration_id(as_id(Root));
  26880.       end if;
  26881.       if not OBJECT_TYPE.IsNull(as_discrete_range(Root)) then
  26882.      
  26883.      
  26884.        IncrementToken (reversez);
  26885.      
  26886.      
  26887.         Scan_OBJECT_TYPE(as_discrete_range(Root));
  26888.       end if;
  26889.      
  26890.     end Scan_reverse_iteration;
  26891.      
  26892.      
  26893.     procedure Scan_while_iteration(Root : while_iterationNode.Locator) is
  26894.     begin
  26895.       if not NAME_EXP.IsNull(as_while_exp(Root)) then
  26896.      
  26897.      
  26898.        IncrementToken (whilez);
  26899.      
  26900.      
  26901.         Scan_NAME_EXP(as_while_exp(Root));
  26902.       end if;
  26903.      
  26904.     end Scan_while_iteration;
  26905.      
  26906. end ITERATION_Pkg;
  26907. -- End: SCITERATION bdy -----------------------------------------------------
  26908. ::::::::::::::
  26909. sciterati.spc
  26910. ::::::::::::::
  26911. -- Begin: SCITERATION spc ---------------------------------------------------
  26912.      
  26913. with ST_DIANA; use ST_DIANA;
  26914.              package ITERATION_Pkg is
  26915.     procedure Scan_ITERATION(Root : ITERATION.Locator);
  26916.     procedure Scan_FOR_ITERATION(Root : FOR_ITERATION.Locator);
  26917.     procedure Scan_forward_iteration(Root : forward_iterationNode.Locator);
  26918.     procedure Scan_reverse_iteration(Root : reverse_iterationNode.Locator);
  26919.     procedure Scan_while_iteration(Root : while_iterationNode.Locator);
  26920. end ITERATION_Pkg;
  26921. -- End: SCITERATION spc -----------------------------------------------------
  26922. ::::::::::::::
  26923. scname_ex.bdy
  26924. ::::::::::::::
  26925. -- Begin: SCNAME_EXP bdy ---------------------------------------------------
  26926.      
  26927. with Halstead_Data_Base;  use Halstead_Data_Base;
  26928. with Definitions; use Definitions;
  26929.              with SERIES_UNIT_IH;
  26930. with AGG_COMPONENT_Pkg; use AGG_COMPONENT_Pkg;
  26931. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  26932. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  26933.      
  26934.                with VmmTextPkg;
  26935.                with TEXT_IO;
  26936.                          package body NAME_EXP_Pkg is
  26937.      
  26938.      
  26939.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator) is
  26940.     begin
  26941.         case Kind(Root) is
  26942.           when AGGKind => Scan_AGG(Root);
  26943.           when ALL_COMPONENTSKind => Scan_ALL_COMPONENTS(Root);
  26944.           when CALLSKind => Scan_CALLS(Root);
  26945.           when MARKKind => Scan_MARK(Root);
  26946.           when MEMBERSHIP_EXPKind => Scan_MEMBERSHIP_EXP(Root);
  26947.           when OPERATOR_EXPKind => Scan_OPERATOR_EXP(Root);
  26948.           when SHORT_CIRCUIT_EXPKind => Scan_SHORT_CIRCUIT_EXP(Root);
  26949.           when attributeKind => Scan_attribute(Root);
  26950.           when attribute_indexedKind => Scan_attribute_indexed(Root);
  26951.           when conversionKind => Scan_conversion(Root);
  26952.           when family_indexedKind => Scan_family_indexed(Root);
  26953.           when indexedKind => Scan_indexed(Root);
  26954.           when init_allocatorKind => Scan_init_allocator(Root);
  26955.           when null_accessKind => Scan_null_access(Root);
  26956.           when numeric_literalKind => Scan_numeric_literal(Root);
  26957.           when parenthesizedKind => Scan_parenthesized(Root);
  26958.           when qualifiedKind => Scan_qualified(Root);
  26959.           when sliceKind => Scan_slice(Root);
  26960.           when string_literalKind => Scan_string_literal(Root);
  26961.           when uninit_allocatorKind => Scan_uninit_allocator(Root);
  26962.           when others => null;
  26963.         end case;
  26964.     end Scan_NAME_EXP;
  26965.      
  26966.      
  26967.     procedure Scan_AGG(Root : AGG.Locator) is
  26968.     begin
  26969.         case Kind(Root) is
  26970.           when apply_aggKind => Scan_apply_agg(Root);
  26971.           when array_aggKind => Scan_array_agg(Root);
  26972.           when record_aggKind => Scan_record_agg(Root);
  26973.           when others => null;
  26974.         end case;
  26975.     end Scan_AGG;
  26976.      
  26977.      
  26978.     procedure Scan_apply_agg(Root : apply_aggNode.Locator) is
  26979.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  26980.         as_agg_s_Item : AGG_COMPONENT.Locator;
  26981.         use SeqOfAGG_COMPONENT;
  26982.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  26983.     begin
  26984.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  26985.      
  26986.      
  26987.      IncrementToken (open_parenthesisz);
  26988.      
  26989.      
  26990.         StartForward(as_agg_s(Root), as_agg_s_List);
  26991.         while not Finished(as_agg_s_List) loop
  26992.             as_agg_s_Item := Cell(as_agg_s_List);
  26993.      
  26994.      
  26995.      if SERIES_UNIT_IH.R.ih_inlist then
  26996.          IncrementToken (commaz);
  26997.      end if;
  26998.      SERIES_UNIT_IH.R.ih_inlist := true;
  26999.      
  27000.      
  27001.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27002.             Forward(as_agg_s_List);
  27003.         end loop;
  27004.         EndIterate(as_agg_s_List);
  27005.      
  27006.      
  27007.      IncrementToken (closed_parenthesisz);
  27008.      SERIES_UNIT_IH.R.ih_inlist := false;
  27009.      
  27010.      
  27011.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27012.      
  27013.     end Scan_apply_agg;
  27014.      
  27015.      
  27016.     procedure Scan_array_agg(Root : array_aggNode.Locator) is
  27017.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  27018.         as_agg_s_Item : AGG_COMPONENT.Locator;
  27019.         use SeqOfAGG_COMPONENT;
  27020.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27021.     begin
  27022.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27023.      
  27024.      
  27025.      IncrementToken (open_parenthesisz);
  27026.      
  27027.      
  27028.         StartForward(as_agg_s(Root), as_agg_s_List);
  27029.         while not Finished(as_agg_s_List) loop
  27030.             as_agg_s_Item := Cell(as_agg_s_List);
  27031.      
  27032.      
  27033.      if SERIES_UNIT_IH.R.ih_inlist then
  27034.          IncrementToken (commaz);
  27035.      end if;
  27036.      SERIES_UNIT_IH.R.ih_inlist := true;
  27037.      
  27038.      
  27039.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27040.             Forward(as_agg_s_List);
  27041.         end loop;
  27042.         EndIterate(as_agg_s_List);
  27043.      
  27044.      
  27045.      IncrementToken (closed_parenthesisz);
  27046.      SERIES_UNIT_IH.R.ih_inlist := false;
  27047.      
  27048.      
  27049.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27050.      
  27051.     end Scan_array_agg;
  27052.      
  27053.      
  27054.     procedure Scan_record_agg(Root : record_aggNode.Locator) is
  27055.         as_agg_s_List : SeqOfAGG_COMPONENT.Generator;
  27056.         as_agg_s_Item : AGG_COMPONENT.Locator;
  27057.         use SeqOfAGG_COMPONENT;
  27058.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27059.     begin
  27060.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27061.      
  27062.      
  27063.      IncrementToken (open_parenthesisz);
  27064.      
  27065.      
  27066.         StartForward(as_agg_s(Root), as_agg_s_List);
  27067.         while not Finished(as_agg_s_List) loop
  27068.             as_agg_s_Item := Cell(as_agg_s_List);
  27069.      
  27070.      
  27071.      if SERIES_UNIT_IH.R.ih_inlist then
  27072.          IncrementToken (commaz);
  27073.      end if;
  27074.      SERIES_UNIT_IH.R.ih_inlist := true;
  27075.      
  27076.      
  27077.             Scan_AGG_COMPONENT(as_agg_s_Item);
  27078.             Forward(as_agg_s_List);
  27079.         end loop;
  27080.         EndIterate(as_agg_s_List);
  27081.      
  27082.      
  27083.      IncrementToken (closed_parenthesisz);
  27084.      SERIES_UNIT_IH.R.ih_inlist := false;
  27085.      
  27086.      
  27087.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27088.      
  27089.     end Scan_record_agg;
  27090.      
  27091.      
  27092.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator) is
  27093.     begin
  27094.         case Kind(Root) is
  27095.           when explicit_all_componentsKind => Scan_explicit_all_components(Root);
  27096.           when implicit_all_componentsKind => Scan_implicit_all_components(Root);
  27097.           when others => null;
  27098.         end case;
  27099.     end Scan_ALL_COMPONENTS;
  27100.      
  27101.      
  27102.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator) is
  27103.     begin
  27104.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  27105.         Scan_NAME_EXP(as_all_name(Root));
  27106.       end if;
  27107.      
  27108.      
  27109.       IncrementToken (allz);
  27110.       IncrementToken (dotz);
  27111.      
  27112.      
  27113.      
  27114.     end Scan_explicit_all_components;
  27115.      
  27116.      
  27117.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator) is
  27118.     begin
  27119.       if not NAME_EXP.IsNull(as_all_name(Root)) then
  27120.         Scan_NAME_EXP(as_all_name(Root));
  27121.       end if;
  27122.      
  27123.     end Scan_implicit_all_components;
  27124.      
  27125.      
  27126.     procedure Scan_CALLS(Root : CALLS.Locator) is
  27127.     begin
  27128.         case Kind(Root) is
  27129.           when apply_callKind => Scan_apply_call(Root);
  27130.           when entry_callKind => Scan_entry_call(Root);
  27131.           when func_callKind => Scan_func_call(Root);
  27132.           when proc_callKind => Scan_proc_call(Root);
  27133.           when others => null;
  27134.         end case;
  27135.     end Scan_CALLS;
  27136.      
  27137.      
  27138.     procedure Scan_apply_call(Root : apply_callNode.Locator) is
  27139.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27140.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27141.         use SeqOfGENERAL_ASSOC;
  27142.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27143.     begin
  27144.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27145.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27146.         Scan_NAME_EXP(as_apply_name(Root));
  27147.      
  27148.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27149.         then
  27150.      
  27151.          IncrementToken (open_parenthesisz);
  27152.      
  27153.         end if;
  27154.       end if;
  27155.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27156.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27157.         while not Finished(as_param_assoc_s_List) loop
  27158.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27159.      
  27160.      
  27161.       if SERIES_UNIT_IH.R.ih_inlist then
  27162.           IncrementToken (commaz);
  27163.       end if;
  27164.       SERIES_UNIT_IH.R.ih_inlist := true;
  27165.      
  27166.      
  27167.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27168.             Forward(as_param_assoc_s_List);
  27169.         end loop;
  27170.         EndIterate(as_param_assoc_s_List);
  27171.      
  27172.      
  27173.         IncrementToken (closed_parenthesisz);
  27174.    SERIES_UNIT_IH.R.ih_inlist := false;
  27175.      
  27176.      
  27177.       end if;
  27178.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27179.      
  27180.     end Scan_apply_call;
  27181.      
  27182.      
  27183.     procedure Scan_entry_call(Root : entry_callNode.Locator) is
  27184.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27185.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27186.         use SeqOfGENERAL_ASSOC;
  27187.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27188.     begin
  27189.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27190.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27191.         Scan_NAME_EXP(as_apply_name(Root));
  27192.      
  27193.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27194.         then
  27195.      
  27196.          IncrementToken (open_parenthesisz);
  27197.      
  27198.         end if;
  27199.       end if;
  27200.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27201.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27202.         while not Finished(as_param_assoc_s_List) loop
  27203.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27204.      
  27205.      
  27206.       if SERIES_UNIT_IH.R.ih_inlist then
  27207.           IncrementToken (commaz);
  27208.       end if;
  27209.       SERIES_UNIT_IH.R.ih_inlist := true;
  27210.      
  27211.      
  27212.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27213.             Forward(as_param_assoc_s_List);
  27214.         end loop;
  27215.         EndIterate(as_param_assoc_s_List);
  27216.      
  27217.      
  27218.         IncrementToken (closed_parenthesisz);
  27219.    SERIES_UNIT_IH.R.ih_inlist := false;
  27220.      
  27221.      
  27222.       end if;
  27223.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27224.      
  27225.     end Scan_entry_call;
  27226.      
  27227.      
  27228.     procedure Scan_func_call(Root : func_callNode.Locator) is
  27229.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27230.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27231.         use SeqOfGENERAL_ASSOC;
  27232.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27233.     begin
  27234.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27235.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27236.         Scan_NAME_EXP(as_apply_name(Root));
  27237.      
  27238.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27239.         then
  27240.      
  27241.          IncrementToken (open_parenthesisz);
  27242.      
  27243.         end if;
  27244.       end if;
  27245.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27246.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27247.         while not Finished(as_param_assoc_s_List) loop
  27248.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27249.      
  27250.      
  27251.       if SERIES_UNIT_IH.R.ih_inlist then
  27252.           IncrementToken (commaz);
  27253.       end if;
  27254.       SERIES_UNIT_IH.R.ih_inlist := true;
  27255.      
  27256.      
  27257.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27258.             Forward(as_param_assoc_s_List);
  27259.         end loop;
  27260.         EndIterate(as_param_assoc_s_List);
  27261.      
  27262.      
  27263.         IncrementToken (closed_parenthesisz);
  27264.    SERIES_UNIT_IH.R.ih_inlist := false;
  27265.      
  27266.      
  27267.       end if;
  27268.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27269.      
  27270.     end Scan_func_call;
  27271.      
  27272.      
  27273.     procedure Scan_proc_call(Root : proc_callNode.Locator) is
  27274.         as_param_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27275.         as_param_assoc_s_Item : GENERAL_ASSOC.Locator;
  27276.         use SeqOfGENERAL_ASSOC;
  27277.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  27278.     begin
  27279.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  27280.       if not NAME_EXP.IsNull(as_apply_name(Root)) then
  27281.         Scan_NAME_EXP(as_apply_name(Root));
  27282.      
  27283.         if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root))
  27284.         then
  27285.      
  27286.          IncrementToken (open_parenthesisz);
  27287.      
  27288.         end if;
  27289.       end if;
  27290.       if not SeqOfGENERAL_ASSOC.IsNull(as_param_assoc_s(Root)) then
  27291.         StartForward(as_param_assoc_s(Root), as_param_assoc_s_List);
  27292.         while not Finished(as_param_assoc_s_List) loop
  27293.             as_param_assoc_s_Item := Cell(as_param_assoc_s_List);
  27294.      
  27295.      
  27296.       if SERIES_UNIT_IH.R.ih_inlist then
  27297.           IncrementToken (commaz);
  27298.       end if;
  27299.       SERIES_UNIT_IH.R.ih_inlist := true;
  27300.      
  27301.      
  27302.             Scan_GENERAL_ASSOC(as_param_assoc_s_Item);
  27303.             Forward(as_param_assoc_s_List);
  27304.         end loop;
  27305.         EndIterate(as_param_assoc_s_List);
  27306.      
  27307.      
  27308.         IncrementToken (closed_parenthesisz);
  27309.    SERIES_UNIT_IH.R.ih_inlist := false;
  27310.      
  27311.      
  27312.       end if;
  27313.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  27314.      
  27315.     end Scan_proc_call;
  27316.      
  27317.      
  27318.     procedure Scan_MARK(Root : MARK.Locator) is
  27319.     begin
  27320.         case Kind(Root) is
  27321.           when USED_SYMBOLKind => Scan_USED_SYMBOL(Root);
  27322.           when selectedKind => Scan_selected(Root);
  27323.           when others => null;
  27324.         end case;
  27325.     end Scan_MARK;
  27326.      
  27327.      
  27328.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator) is
  27329.     begin
  27330.         case Kind(Root) is
  27331.           when used_charKind => Scan_used_char(Root);
  27332.           when used_idKind => Scan_used_id(Root);
  27333.           when used_operatorKind => Scan_used_operator(Root);
  27334.           when others => null;
  27335.         end case;
  27336.     end Scan_USED_SYMBOL;
  27337.      
  27338.      
  27339.     procedure Scan_used_char(Root : used_charNode.Locator) is
  27340.     begin
  27341.      
  27342.      
  27343.      Literal_Set.Insert (lx_text (lx_symrep (root)),
  27344.                          CurrentBlock.SetOfLiterals);
  27345.      IncrementToken (single_quotez);
  27346.      IncrementToken (single_quotez);
  27347.      
  27348.      
  27349.      
  27350.     end Scan_used_char;
  27351.      
  27352.      
  27353.     procedure Scan_used_id(Root : used_idNode.Locator) is
  27354.     begin
  27355.      
  27356.      
  27357.       if not DEF_ID.IsNull (sm_def (root)) then
  27358.          DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  27359.       else
  27360.           TEXT_IO.Put ("?? Unexpected null sm_def: ");
  27361.           TEXT_IO.Put_Line (
  27362.             VmmTextPkg.Value (
  27363.                    Source_Text.Value (
  27364.                      lx_text (
  27365.                        ne_normalized_symrep (
  27366.                          ne_symbol_entry_in_table (
  27367.                            lx_symrep (
  27368.                              root))))))
  27369.               );
  27370.       end if;
  27371.      
  27372.      
  27373.      
  27374.     end Scan_used_id;
  27375.      
  27376.      
  27377.     procedure Scan_used_operator(Root : used_operatorNode.Locator) is
  27378.     begin
  27379.      
  27380.      
  27381.         DEF_ID_Set.Insert (sm_def (root), CurrentBlock.SetOfDEF_IDs);
  27382.      
  27383.      
  27384.      
  27385.     end Scan_used_operator;
  27386.      
  27387.      
  27388.     procedure Scan_selected(Root : selectedNode.Locator) is
  27389.     begin
  27390.       if not NAME_EXP.IsNull(as_selected_name(Root)) then
  27391.         Scan_NAME_EXP(as_selected_name(Root));
  27392.      
  27393.      
  27394.      IncrementToken (dotz);
  27395.      
  27396.      
  27397.       end if;
  27398.       if not NAME_EXP.IsNull(as_selected_designator(Root)) then
  27399.         Scan_NAME_EXP(as_selected_designator(Root));
  27400.       end if;
  27401.      
  27402.     end Scan_selected;
  27403.      
  27404.      
  27405.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator) is
  27406.     begin
  27407.         case Kind(Root) is
  27408.           when in_expKind => Scan_in_exp(Root);
  27409.           when not_in_expKind => Scan_not_in_exp(Root);
  27410.           when others => null;
  27411.         end case;
  27412.     end Scan_MEMBERSHIP_EXP;
  27413.      
  27414.      
  27415.     procedure Scan_in_exp(Root : in_expNode.Locator) is
  27416.     begin
  27417.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  27418.         Scan_NAME_EXP(as_membership_exp(Root));
  27419.      
  27420.      
  27421.      IncrementToken (in_membershipz);
  27422.      
  27423.      
  27424.       end if;
  27425.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  27426.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  27427.       end if;
  27428.      
  27429.     end Scan_in_exp;
  27430.      
  27431.      
  27432.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator) is
  27433.     begin
  27434.       if not NAME_EXP.IsNull(as_membership_exp(Root)) then
  27435.         Scan_NAME_EXP(as_membership_exp(Root));
  27436.      
  27437.      
  27438.      IncrementToken (not_in_membershipz);
  27439.      IncrementToken (in_membershipz);
  27440.      
  27441.      
  27442.       end if;
  27443.       if not OBJECT_TYPE.IsNull(as_membership_type_range(Root)) then
  27444.         Scan_OBJECT_TYPE(as_membership_type_range(Root));
  27445.       end if;
  27446.      
  27447.     end Scan_not_in_exp;
  27448.      
  27449.      
  27450.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator) is
  27451.     begin
  27452.         case Kind(Root) is
  27453.           when binary_operationKind => Scan_binary_operation(Root);
  27454.           when unary_operationKind => Scan_unary_operation(Root);
  27455.           when others => null;
  27456.         end case;
  27457.     end Scan_OPERATOR_EXP;
  27458.      
  27459.      
  27460.     procedure Scan_binary_operation(Root : binary_operationNode.Locator) is
  27461.     begin
  27462.       if not NAME_EXP.IsNull(as_left_exp(Root)) then
  27463.         Scan_NAME_EXP(as_left_exp(Root));
  27464.       end if;
  27465.       if not used_operatorNode.IsNull(as_operator(Root)) then
  27466.         Scan_used_operator(as_operator(Root));
  27467.       end if;
  27468.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  27469.         Scan_NAME_EXP(as_right_exp(Root));
  27470.       end if;
  27471.      
  27472.     end Scan_binary_operation;
  27473.      
  27474.      
  27475.     procedure Scan_unary_operation(Root : unary_operationNode.Locator) is
  27476.     begin
  27477.       if not used_operatorNode.IsNull(as_operator(Root)) then
  27478.         Scan_used_operator(as_operator(Root));
  27479.       end if;
  27480.       if not NAME_EXP.IsNull(as_right_exp(Root)) then
  27481.         Scan_NAME_EXP(as_right_exp(Root));
  27482.       end if;
  27483.      
  27484.     end Scan_unary_operation;
  27485.      
  27486.      
  27487.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator) is
  27488.     begin
  27489.         case Kind(Root) is
  27490.           when and_then_expKind => Scan_and_then_exp(Root);
  27491.           when or_else_expKind => Scan_or_else_exp(Root);
  27492.           when others => null;
  27493.         end case;
  27494.     end Scan_SHORT_CIRCUIT_EXP;
  27495.      
  27496.      
  27497.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator) is
  27498.     begin
  27499.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  27500.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  27501.       end if;
  27502.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  27503.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  27504.       end if;
  27505.      
  27506.      
  27507.        IncrementToken (and_thenz);
  27508.        IncrementToken (then_andz);
  27509.      
  27510.      
  27511.      
  27512.     end Scan_and_then_exp;
  27513.      
  27514.      
  27515.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator) is
  27516.     begin
  27517.       if not NAME_EXP.IsNull(as_short_circuit_exp1(Root)) then
  27518.         Scan_NAME_EXP(as_short_circuit_exp1(Root));
  27519.       end if;
  27520.       if not NAME_EXP.IsNull(as_short_circuit_exp2(Root)) then
  27521.         Scan_NAME_EXP(as_short_circuit_exp2(Root));
  27522.       end if;
  27523.      
  27524.      
  27525.        IncrementToken (or_elsez);
  27526.        IncrementToken (else_orz);
  27527.      
  27528.      
  27529.      
  27530.     end Scan_or_else_exp;
  27531.      
  27532.      
  27533.     procedure Scan_attribute(Root : attributeNode.Locator) is
  27534.     begin
  27535.       if not NAME_EXP.IsNull(as_attribute_name(Root)) then
  27536.         Scan_NAME_EXP(as_attribute_name(Root));
  27537.      
  27538.      
  27539.      IncrementToken (tickz);
  27540.      
  27541.      
  27542.       end if;
  27543.       if not NAME_EXP.IsNull(as_attribute_id(Root)) then
  27544.         Scan_NAME_EXP(as_attribute_id(Root));
  27545.       end if;
  27546.      
  27547.     end Scan_attribute;
  27548.      
  27549.      
  27550.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator) is
  27551.     begin
  27552.       if not NAME_EXP.IsNull(as_attribute_indexed_name(Root)) then
  27553.      
  27554.      
  27555.      IncrementToken (open_parenthesisz);
  27556.      
  27557.      
  27558.         Scan_NAME_EXP(as_attribute_indexed_name(Root));
  27559.      
  27560.      
  27561.       IncrementToken (closed_parenthesisz);
  27562.      
  27563.      
  27564.       end if;
  27565.       if not NAME_EXP.IsNull(as_attribute_indexed_exp(Root)) then
  27566.         Scan_NAME_EXP(as_attribute_indexed_exp(Root));
  27567.       end if;
  27568.      
  27569.     end Scan_attribute_indexed;
  27570.      
  27571.      
  27572.     procedure Scan_conversion(Root : conversionNode.Locator) is
  27573.     begin
  27574.       if not NAME_EXP.IsNull(as_conversion_name(Root)) then
  27575.      
  27576.      
  27577.       IncrementToken (open_parenthesisz);
  27578.      
  27579.      
  27580.         Scan_NAME_EXP(as_conversion_name(Root));
  27581.      
  27582.      
  27583.        IncrementToken (closed_parenthesisz);
  27584.      
  27585.      
  27586.       end if;
  27587.       if not NAME_EXP.IsNull(as_conversion_exp(Root)) then
  27588.         Scan_NAME_EXP(as_conversion_exp(Root));
  27589.       end if;
  27590.      
  27591.     end Scan_conversion;
  27592.      
  27593.      
  27594.     procedure Scan_family_indexed(Root : family_indexedNode.Locator) is
  27595.     begin
  27596.       if not NAME_EXP.IsNull(as_family_index(Root)) then
  27597.      
  27598.      
  27599.        IncrementToken (open_parenthesisz);
  27600.      
  27601.      
  27602.         Scan_NAME_EXP(as_family_index(Root));
  27603.      
  27604.      
  27605.        IncrementToken (closed_parenthesisz);
  27606.      
  27607.      
  27608.       end if;
  27609.       if not NAME_EXP.IsNull(as_family_name(Root)) then
  27610.         Scan_NAME_EXP(as_family_name(Root));
  27611.       end if;
  27612.      
  27613.     end Scan_family_indexed;
  27614.      
  27615.      
  27616.     procedure Scan_indexed(Root : indexedNode.Locator) is
  27617.         as_indexed_exp_s_List : SeqOfNAME_EXP.Generator;
  27618.         as_indexed_exp_s_Item : NAME_EXP.Locator;
  27619.         use SeqOfNAME_EXP;
  27620.     begin
  27621.       if not NAME_EXP.IsNull(as_indexed_name(Root)) then
  27622.         Scan_NAME_EXP(as_indexed_name(Root));
  27623.       end if;
  27624.       if not SeqOfNAME_EXP.IsNull(as_indexed_exp_s(Root)) then
  27625.      
  27626.      
  27627.       IncrementToken (open_parenthesisz);
  27628.      
  27629.      
  27630.         StartForward(as_indexed_exp_s(Root), as_indexed_exp_s_List);
  27631.         while not Finished(as_indexed_exp_s_List) loop
  27632.             as_indexed_exp_s_Item := Cell(as_indexed_exp_s_List);
  27633.             Scan_NAME_EXP(as_indexed_exp_s_Item);
  27634.             Forward(as_indexed_exp_s_List);
  27635.         end loop;
  27636.         EndIterate(as_indexed_exp_s_List);
  27637.      
  27638.      
  27639.        IncrementToken (closed_parenthesisz);
  27640.      
  27641.      
  27642.       end if;
  27643.      
  27644.     end Scan_indexed;
  27645.      
  27646.      
  27647.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator) is
  27648.     begin
  27649.      
  27650.      
  27651.           IncrementToken (new_allocatorz);
  27652.      
  27653.      
  27654.       if not qualifiedNode.IsNull(as_allocator_qualified(Root)) then
  27655.         Scan_qualified(as_allocator_qualified(Root));
  27656.       end if;
  27657.      
  27658.     end Scan_init_allocator;
  27659.      
  27660.      
  27661.     procedure Scan_null_access(Root : null_accessNode.Locator) is
  27662.     begin
  27663.      
  27664.      
  27665.      IncrementToken (null_valuez);
  27666.      
  27667.      
  27668.      
  27669.     end Scan_null_access;
  27670.      
  27671.      
  27672.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator) is
  27673.     begin
  27674.      
  27675.      
  27676.     Literal_Set.Insert (lx_text (lx_numrep (root)),
  27677.                         CurrentBlock.SetOfLiterals);
  27678.      
  27679.      
  27680.      
  27681.     end Scan_numeric_literal;
  27682.      
  27683.      
  27684.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator) is
  27685.     begin
  27686.      
  27687.      
  27688.      IncrementToken (open_parenthesisz);
  27689.      
  27690.      
  27691.       if not NAME_EXP.IsNull(as_parenthesized_exp(Root)) then
  27692.         Scan_NAME_EXP(as_parenthesized_exp(Root));
  27693.       end if;
  27694.      
  27695.      
  27696.      IncrementToken (closed_parenthesisz);
  27697.      
  27698.      
  27699.      
  27700.     end Scan_parenthesized;
  27701.      
  27702.      
  27703.     procedure Scan_qualified(Root : qualifiedNode.Locator) is
  27704.     begin
  27705.       if not MARK.IsNull(as_qualified_name(Root)) then
  27706.         Scan_MARK(as_qualified_name(Root));
  27707.      
  27708.      
  27709.      IncrementToken (tickz);
  27710.      
  27711.      
  27712.       end if;
  27713.       if not NAME_EXP.IsNull(as_qualified_exp(Root)) then
  27714.         Scan_NAME_EXP(as_qualified_exp(Root));
  27715.       end if;
  27716.      
  27717.     end Scan_qualified;
  27718.      
  27719.      
  27720.     procedure Scan_slice(Root : sliceNode.Locator) is
  27721.     begin
  27722.      
  27723.      
  27724.      IncrementToken (open_parenthesisz);
  27725.      
  27726.      
  27727.      
  27728.      
  27729.     IncrementToken (closed_parenthesisz);
  27730.      
  27731.      
  27732.       if not NAME_EXP.IsNull(as_slice_name(Root)) then
  27733.         Scan_NAME_EXP(as_slice_name(Root));
  27734.       end if;
  27735.       if not OBJECT_TYPE.IsNull(as_slice_discrete_range(Root)) then
  27736.         Scan_OBJECT_TYPE(as_slice_discrete_range(Root));
  27737.       end if;
  27738.      
  27739.     end Scan_slice;
  27740.      
  27741.      
  27742.     procedure Scan_string_literal(Root : string_literalNode.Locator) is
  27743.     begin
  27744.      
  27745.      
  27746.     IncrementToken (double_quotez);
  27747.     Literal_Set.Insert (lx_text (lx_string_symrep (root)),
  27748.                     CurrentBlock.SetOfLiterals);
  27749.      
  27750.      
  27751.      
  27752.      
  27753.      IncrementToken (double_quotez);
  27754.      
  27755.      
  27756.      
  27757.     end Scan_string_literal;
  27758.      
  27759.      
  27760.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator) is
  27761.     begin
  27762.      
  27763.      
  27764.       IncrementToken (new_allocatorz);
  27765.      
  27766.      
  27767.       if not object_type_constrainedNode.IsNull(as_allocator_constrained(Root)) then
  27768.         Scan_object_type_constrained(as_allocator_constrained(Root));
  27769.       end if;
  27770.      
  27771.     end Scan_uninit_allocator;
  27772.      
  27773. end NAME_EXP_Pkg;
  27774. -- End: SCNAME_EXP bdy -----------------------------------------------------
  27775. ::::::::::::::
  27776. scname_ex.spc
  27777. ::::::::::::::
  27778. -- Begin: SCNAME_EXP spc ---------------------------------------------------
  27779.      
  27780. with ST_DIANA; use ST_DIANA;
  27781.              package NAME_EXP_Pkg is
  27782.     procedure Scan_NAME_EXP(Root : NAME_EXP.Locator);
  27783.     procedure Scan_AGG(Root : AGG.Locator);
  27784.     procedure Scan_apply_agg(Root : apply_aggNode.Locator);
  27785.     procedure Scan_array_agg(Root : array_aggNode.Locator);
  27786.     procedure Scan_record_agg(Root : record_aggNode.Locator);
  27787.     procedure Scan_ALL_COMPONENTS(Root : ALL_COMPONENTS.Locator);
  27788.     procedure Scan_explicit_all_components(Root : explicit_all_componentsNode.Locator);
  27789.     procedure Scan_implicit_all_components(Root : implicit_all_componentsNode.Locator);
  27790.     procedure Scan_CALLS(Root : CALLS.Locator);
  27791.     procedure Scan_apply_call(Root : apply_callNode.Locator);
  27792.     procedure Scan_entry_call(Root : entry_callNode.Locator);
  27793.     procedure Scan_func_call(Root : func_callNode.Locator);
  27794.     procedure Scan_proc_call(Root : proc_callNode.Locator);
  27795.     procedure Scan_MARK(Root : MARK.Locator);
  27796.     procedure Scan_USED_SYMBOL(Root : USED_SYMBOL.Locator);
  27797.     procedure Scan_used_char(Root : used_charNode.Locator);
  27798.     procedure Scan_used_id(Root : used_idNode.Locator);
  27799.     procedure Scan_used_operator(Root : used_operatorNode.Locator);
  27800.     procedure Scan_selected(Root : selectedNode.Locator);
  27801.     procedure Scan_MEMBERSHIP_EXP(Root : MEMBERSHIP_EXP.Locator);
  27802.     procedure Scan_in_exp(Root : in_expNode.Locator);
  27803.     procedure Scan_not_in_exp(Root : not_in_expNode.Locator);
  27804.     procedure Scan_OPERATOR_EXP(Root : OPERATOR_EXP.Locator);
  27805.     procedure Scan_binary_operation(Root : binary_operationNode.Locator);
  27806.     procedure Scan_unary_operation(Root : unary_operationNode.Locator);
  27807.     procedure Scan_SHORT_CIRCUIT_EXP(Root : SHORT_CIRCUIT_EXP.Locator);
  27808.     procedure Scan_and_then_exp(Root : and_then_expNode.Locator);
  27809.     procedure Scan_or_else_exp(Root : or_else_expNode.Locator);
  27810.     procedure Scan_attribute(Root : attributeNode.Locator);
  27811.     procedure Scan_attribute_indexed(Root : attribute_indexedNode.Locator);
  27812.     procedure Scan_conversion(Root : conversionNode.Locator);
  27813.     procedure Scan_family_indexed(Root : family_indexedNode.Locator);
  27814.     procedure Scan_indexed(Root : indexedNode.Locator);
  27815.     procedure Scan_init_allocator(Root : init_allocatorNode.Locator);
  27816.     procedure Scan_null_access(Root : null_accessNode.Locator);
  27817.     procedure Scan_numeric_literal(Root : numeric_literalNode.Locator);
  27818.     procedure Scan_parenthesized(Root : parenthesizedNode.Locator);
  27819.     procedure Scan_qualified(Root : qualifiedNode.Locator);
  27820.     procedure Scan_slice(Root : sliceNode.Locator);
  27821.     procedure Scan_string_literal(Root : string_literalNode.Locator);
  27822.     procedure Scan_uninit_allocator(Root : uninit_allocatorNode.Locator);
  27823. end NAME_EXP_Pkg;
  27824. -- End: SCNAME_EXP spc -----------------------------------------------------
  27825. ::::::::::::::
  27826. scobject_.bdy
  27827. ::::::::::::::
  27828. -- Begin: SCOBJECT_DEF bdy ---------------------------------------------------
  27829.      
  27830. with Halstead_Data_Base;  use Halstead_Data_Base;
  27831. with Definitions; use Definitions;
  27832.              with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  27833. package body OBJECT_DEF_Pkg is
  27834.      
  27835.      
  27836.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator) is
  27837.     begin
  27838.         case Kind(Root) is
  27839.           when object_initKind => Scan_object_init(Root);
  27840.           when object_renameKind => Scan_object_rename(Root);
  27841.           when others => null;
  27842.         end case;
  27843.     end Scan_OBJECT_DEF;
  27844.      
  27845.      
  27846.     procedure Scan_object_init(Root : object_initNode.Locator) is
  27847.     begin
  27848.      
  27849.      
  27850.            IncrementToken (colon_equalsz);
  27851.      
  27852.      
  27853.       if not NAME_EXP.IsNull(as_init_exp(Root)) then
  27854.         Scan_NAME_EXP(as_init_exp(Root));
  27855.       end if;
  27856.      
  27857.     end Scan_object_init;
  27858.      
  27859.      
  27860.     procedure Scan_object_rename(Root : object_renameNode.Locator) is
  27861.     begin
  27862.      
  27863.      
  27864.           IncrementToken (renamesz);
  27865.      
  27866.      
  27867.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  27868.         Scan_NAME_EXP(as_rename_name(Root));
  27869.       end if;
  27870.      
  27871.     end Scan_object_rename;
  27872.      
  27873. end OBJECT_DEF_Pkg;
  27874. -- End: SCOBJECT_DEF bdy -----------------------------------------------------
  27875. ::::::::::::::
  27876. scobject_.spc
  27877. ::::::::::::::
  27878. -- Begin: SCOBJECT_DEF spc ---------------------------------------------------
  27879.      
  27880. with ST_DIANA; use ST_DIANA;
  27881.              package OBJECT_DEF_Pkg is
  27882.     procedure Scan_OBJECT_DEF(Root : OBJECT_DEF.Locator);
  27883.     procedure Scan_object_init(Root : object_initNode.Locator);
  27884.     procedure Scan_object_rename(Root : object_renameNode.Locator);
  27885. end OBJECT_DEF_Pkg;
  27886. -- End: SCOBJECT_DEF spc -----------------------------------------------------
  27887. ::::::::::::::
  27888. scpkg_def.bdy
  27889. ::::::::::::::
  27890. -- Begin: SCPKG_DEF bdy ---------------------------------------------------
  27891.      
  27892. with Halstead_Data_Base;  use Halstead_Data_Base;
  27893. with Definitions; use Definitions;
  27894.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  27895. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  27896. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  27897. with ITEM_Pkg; use ITEM_Pkg;
  27898. package body PKG_DEF_Pkg is
  27899.      
  27900.      
  27901.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator) is
  27902.     begin
  27903.         case Kind(Root) is
  27904.           when pkg_block_stubKind => Scan_pkg_block_stub(Root);
  27905.           when pkg_instantiationKind => Scan_pkg_instantiation(Root);
  27906.           when pkg_renameKind => Scan_pkg_rename(Root);
  27907.           when pkg_specKind => Scan_pkg_spec(Root);
  27908.           when others => null;
  27909.         end case;
  27910.     end Scan_PKG_DEF;
  27911.      
  27912.      
  27913.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator) is
  27914.     begin
  27915.       if not BLOCK_STUB.IsNull(as_pkg_block_stub(Root)) then
  27916.         Scan_BLOCK_STUB(as_pkg_block_stub(Root));
  27917.       end if;
  27918.      
  27919.     end Scan_pkg_block_stub;
  27920.      
  27921.      
  27922.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator) is
  27923.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  27924.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  27925.         use SeqOfGENERAL_ASSOC;
  27926.     begin
  27927.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  27928.      
  27929.      
  27930.       IncrementToken (open_parenthesisz);
  27931.      
  27932.      
  27933.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  27934.         while not Finished(as_generic_assoc_s_List) loop
  27935.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  27936.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  27937.             Forward(as_generic_assoc_s_List);
  27938.         end loop;
  27939.         EndIterate(as_generic_assoc_s_List);
  27940.      
  27941.      
  27942.       IncrementToken (closed_parenthesisz);
  27943.      
  27944.      
  27945.       end if;
  27946.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  27947.         Scan_NAME_EXP(as_instantiation_name(Root));
  27948.      
  27949.      
  27950.       IncrementToken (new_generic_instz);
  27951.      
  27952.      
  27953.       end if;
  27954.      
  27955.     end Scan_pkg_instantiation;
  27956.      
  27957.      
  27958.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator) is
  27959.     begin
  27960.      
  27961.      
  27962.      IncrementToken (renamesz);
  27963.      
  27964.      
  27965.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  27966.      
  27967.      
  27968.                 IncrementToken (renamesz);
  27969.      
  27970.      
  27971.         Scan_NAME_EXP(as_rename_name(Root));
  27972.       end if;
  27973.      
  27974.     end Scan_pkg_rename;
  27975.      
  27976.      
  27977.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator) is
  27978.         as_visible_part_List : SeqOfITEM.Generator;
  27979.         as_visible_part_Item : ITEM.Locator;
  27980.         use SeqOfITEM;
  27981.         as_priv_part_List : SeqOfITEM.Generator;
  27982.         as_priv_part_Item : ITEM.Locator;
  27983.         use SeqOfITEM;
  27984.     begin
  27985.       if not SeqOfITEM.IsNull(as_visible_part(Root)) then
  27986.         StartForward(as_visible_part(Root), as_visible_part_List);
  27987.         while not Finished(as_visible_part_List) loop
  27988.             as_visible_part_Item := Cell(as_visible_part_List);
  27989.             Scan_ITEM(as_visible_part_Item);
  27990.             Forward(as_visible_part_List);
  27991.         end loop;
  27992.         EndIterate(as_visible_part_List);
  27993.       end if;
  27994.       if not SeqOfITEM.IsNull(as_priv_part(Root)) then
  27995.      
  27996.      
  27997.        IncrementToken (private_sectionz);
  27998.      
  27999.      
  28000.         StartForward(as_priv_part(Root), as_priv_part_List);
  28001.         while not Finished(as_priv_part_List) loop
  28002.             as_priv_part_Item := Cell(as_priv_part_List);
  28003.             Scan_ITEM(as_priv_part_Item);
  28004.             Forward(as_priv_part_List);
  28005.         end loop;
  28006.         EndIterate(as_priv_part_List);
  28007.       end if;
  28008.      
  28009.     end Scan_pkg_spec;
  28010.      
  28011. end PKG_DEF_Pkg;
  28012. -- End: SCPKG_DEF bdy -----------------------------------------------------
  28013. ::::::::::::::
  28014. scpkg_def.spc
  28015. ::::::::::::::
  28016. -- Begin: SCPKG_DEF spc ---------------------------------------------------
  28017.      
  28018. with ST_DIANA; use ST_DIANA;
  28019.              package PKG_DEF_Pkg is
  28020.     procedure Scan_PKG_DEF(Root : PKG_DEF.Locator);
  28021.     procedure Scan_pkg_block_stub(Root : pkg_block_stubNode.Locator);
  28022.     procedure Scan_pkg_instantiation(Root : pkg_instantiationNode.Locator);
  28023.     procedure Scan_pkg_rename(Root : pkg_renameNode.Locator);
  28024.     procedure Scan_pkg_spec(Root : pkg_specNode.Locator);
  28025. end PKG_DEF_Pkg;
  28026. -- End: SCPKG_DEF spc -----------------------------------------------------
  28027. ::::::::::::::
  28028. scstm.bdy
  28029. ::::::::::::::
  28030. --VMS file: %nosc.work.tools.halstead.source*(SCSTM.bdy)
  28031. --UTS file: /nosccomp/byron/_vms//nosc/work/tools/halstead/COMP/SCSTM.bdy
  28032. -- Begin: SCSTM bdy ---------------------------------------------------
  28033.      
  28034. with Halstead_Data_Base;  use Halstead_Data_Base;
  28035. with Definitions; use Definitions;
  28036.              with SERIES_UNIT_IH;
  28037. with block_stm_IH;
  28038. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  28039. with HEADER_Pkg; use HEADER_Pkg;
  28040. with DEF_ID_Pkg; use DEF_ID_Pkg;
  28041. with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  28042. with ALTERNATIVE_Pkg; use ALTERNATIVE_Pkg;
  28043. with ITERATION_Pkg; use ITERATION_Pkg;
  28044. with ITEM_Pkg; use ITEM_Pkg;
  28045.      
  28046.               with TEXT_IO; use TEXT_IO;
  28047.               with VmmTextPkg;
  28048.               with Block_Utilities;
  28049.                   package body STM_Pkg is
  28050.      
  28051.      
  28052.     procedure Scan_STM(Root : STM.Locator) is
  28053.     begin
  28054.         case Kind(Root) is
  28055.           when CALL_STMKind => Scan_CALL_STM(Root);
  28056.           when SELECTIVE_ENTRY_STMKind => Scan_SELECTIVE_ENTRY_STM(Root);
  28057.           when abort_stmKind => Scan_abort_stm(Root);
  28058.           when accept_stmKind => Scan_accept_stm(Root);
  28059.           when assign_stmKind => Scan_assign_stm(Root);
  28060.           when block_stmKind => Scan_block_stm(Root);
  28061.           when case_stmKind => Scan_case_stm(Root);
  28062.           when code_stmKind => Scan_code_stm(Root);
  28063.           when delay_stmKind => Scan_delay_stm(Root);
  28064.           when exit_stmKind => Scan_exit_stm(Root);
  28065.           when goto_stmKind => Scan_goto_stm(Root);
  28066.           when if_stmKind => Scan_if_stm(Root);
  28067.           when labeled_stmKind => Scan_labeled_stm(Root);
  28068.           when loop_stmKind => Scan_loop_stm(Root);
  28069.           when null_stmKind => Scan_null_stm(Root);
  28070.           when pragma_stmKind => Scan_pragma_stm(Root);
  28071.           when raise_stmKind => Scan_raise_stm(Root);
  28072.           when return_stmKind => Scan_return_stm(Root);
  28073.           when select_stmKind => Scan_select_stm(Root);
  28074.           when terminate_stmKind => Scan_terminate_stm(Root);
  28075.           when others => null;
  28076.         end case;
  28077.     end Scan_STM;
  28078.      
  28079.      
  28080.     procedure Scan_CALL_STM(Root : CALL_STM.Locator) is
  28081.     begin
  28082.         case Kind(Root) is
  28083.           when apply_call_stmKind => Scan_apply_call_stm(Root);
  28084.           when entry_call_stmKind => Scan_entry_call_stm(Root);
  28085.           when proc_call_stmKind => Scan_proc_call_stm(Root);
  28086.           when others => null;
  28087.         end case;
  28088.     end Scan_CALL_STM;
  28089.      
  28090.      
  28091.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator) is
  28092.     begin
  28093.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28094.         Scan_NAME_EXP(as_call_name(Root));
  28095.       end if;
  28096.      
  28097.         if  Kind(root) not in labeled_stmKind
  28098.         then
  28099.      
  28100.         if (not (Kind (root) in block_stmKind))
  28101.             or else
  28102.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28103.             then
  28104.      
  28105.               -- If the root is not a block_stm or if it is then
  28106.               -- if it is not a block with declarations increment
  28107.               -- semicolon.
  28108.               -- This is because the semicolon associated with a declare
  28109.               -- block must be counted in that declare block. If we
  28110.               -- counted it here it would increment the count for the
  28111.               -- enclosing block.
  28112.          IncrementToken (semicolonz);
  28113.       end if;
  28114.      
  28115.         end if;
  28116.      
  28117.     end Scan_apply_call_stm;
  28118.      
  28119.      
  28120.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator) is
  28121.     begin
  28122.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28123.         Scan_NAME_EXP(as_call_name(Root));
  28124.       end if;
  28125.      
  28126.         if  Kind(root) not in labeled_stmKind
  28127.         then
  28128.      
  28129.         if (not (Kind (root) in block_stmKind))
  28130.             or else
  28131.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28132.             then
  28133.      
  28134.               -- If the root is not a block_stm or if it is then
  28135.               -- if it is not a block with declarations increment
  28136.               -- semicolon.
  28137.               -- This is because the semicolon associated with a declare
  28138.               -- block must be counted in that declare block. If we
  28139.               -- counted it here it would increment the count for the
  28140.               -- enclosing block.
  28141.          IncrementToken (semicolonz);
  28142.       end if;
  28143.      
  28144.         end if;
  28145.      
  28146.     end Scan_entry_call_stm;
  28147.      
  28148.      
  28149.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator) is
  28150.     begin
  28151.       if not NAME_EXP.IsNull(as_call_name(Root)) then
  28152.         Scan_NAME_EXP(as_call_name(Root));
  28153.       end if;
  28154.      
  28155.         if  Kind(root) not in labeled_stmKind
  28156.         then
  28157.      
  28158.         if (not (Kind (root) in block_stmKind))
  28159.             or else
  28160.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28161.             then
  28162.      
  28163.               -- If the root is not a block_stm or if it is then
  28164.               -- if it is not a block with declarations increment
  28165.               -- semicolon.
  28166.               -- This is because the semicolon associated with a declare
  28167.               -- block must be counted in that declare block. If we
  28168.               -- counted it here it would increment the count for the
  28169.               -- enclosing block.
  28170.          IncrementToken (semicolonz);
  28171.       end if;
  28172.      
  28173.         end if;
  28174.      
  28175.     end Scan_proc_call_stm;
  28176.      
  28177.      
  28178.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator) is
  28179.     begin
  28180.         case Kind(Root) is
  28181.           when cond_entry_stmKind => Scan_cond_entry_stm(Root);
  28182.           when timed_entry_stmKind => Scan_timed_entry_stm(Root);
  28183.           when others => null;
  28184.         end case;
  28185.     end Scan_SELECTIVE_ENTRY_STM;
  28186.      
  28187.      
  28188.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator) is
  28189.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  28190.         as_sel_entry_stm_s1_Item : STM.Locator;
  28191.         use SeqOfSTM;
  28192.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  28193.         as_sel_entry_stm_s2_Item : STM.Locator;
  28194.         use SeqOfSTM;
  28195.     begin
  28196.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  28197.      
  28198.      
  28199.      IncrementToken (selectz);
  28200.      
  28201.      
  28202.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  28203.         while not Finished(as_sel_entry_stm_s1_List) loop
  28204.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  28205.             Scan_STM(as_sel_entry_stm_s1_Item);
  28206.             Forward(as_sel_entry_stm_s1_List);
  28207.         end loop;
  28208.         EndIterate(as_sel_entry_stm_s1_List);
  28209.       end if;
  28210.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  28211.      
  28212.      
  28213.      IncrementToken (elsez);
  28214.      
  28215.      
  28216.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  28217.         while not Finished(as_sel_entry_stm_s2_List) loop
  28218.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  28219.             Scan_STM(as_sel_entry_stm_s2_Item);
  28220.             Forward(as_sel_entry_stm_s2_List);
  28221.         end loop;
  28222.         EndIterate(as_sel_entry_stm_s2_List);
  28223.      
  28224.      
  28225.      IncrementToken (end_selectz);
  28226.      IncrementToken (selectz);
  28227.      
  28228.      
  28229.       end if;
  28230.      
  28231.         if  Kind(root) not in labeled_stmKind
  28232.         then
  28233.      
  28234.         if (not (Kind (root) in block_stmKind))
  28235.             or else
  28236.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28237.             then
  28238.      
  28239.               -- If the root is not a block_stm or if it is then
  28240.               -- if it is not a block with declarations increment
  28241.               -- semicolon.
  28242.               -- This is because the semicolon associated with a declare
  28243.               -- block must be counted in that declare block. If we
  28244.               -- counted it here it would increment the count for the
  28245.               -- enclosing block.
  28246.          IncrementToken (semicolonz);
  28247.       end if;
  28248.      
  28249.         end if;
  28250.      
  28251.     end Scan_cond_entry_stm;
  28252.      
  28253.      
  28254.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator) is
  28255.         as_sel_entry_stm_s1_List : SeqOfSTM.Generator;
  28256.         as_sel_entry_stm_s1_Item : STM.Locator;
  28257.         use SeqOfSTM;
  28258.         as_sel_entry_stm_s2_List : SeqOfSTM.Generator;
  28259.         as_sel_entry_stm_s2_Item : STM.Locator;
  28260.         use SeqOfSTM;
  28261.     begin
  28262.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s1(Root)) then
  28263.      
  28264.      
  28265.      IncrementToken (selectz);
  28266.      
  28267.      
  28268.         StartForward(as_sel_entry_stm_s1(Root), as_sel_entry_stm_s1_List);
  28269.         while not Finished(as_sel_entry_stm_s1_List) loop
  28270.             as_sel_entry_stm_s1_Item := Cell(as_sel_entry_stm_s1_List);
  28271.             Scan_STM(as_sel_entry_stm_s1_Item);
  28272.             Forward(as_sel_entry_stm_s1_List);
  28273.         end loop;
  28274.         EndIterate(as_sel_entry_stm_s1_List);
  28275.       end if;
  28276.       if not SeqOfSTM.IsNull(as_sel_entry_stm_s2(Root)) then
  28277.      
  28278.      
  28279.      IncrementToken (or_selectz);
  28280.      
  28281.      
  28282.         StartForward(as_sel_entry_stm_s2(Root), as_sel_entry_stm_s2_List);
  28283.         while not Finished(as_sel_entry_stm_s2_List) loop
  28284.             as_sel_entry_stm_s2_Item := Cell(as_sel_entry_stm_s2_List);
  28285.             Scan_STM(as_sel_entry_stm_s2_Item);
  28286.             Forward(as_sel_entry_stm_s2_List);
  28287.         end loop;
  28288.         EndIterate(as_sel_entry_stm_s2_List);
  28289.      
  28290.      
  28291.      IncrementToken (end_selectz);
  28292.      IncrementToken (selectz);
  28293.      
  28294.      
  28295.       end if;
  28296.      
  28297.         if  Kind(root) not in labeled_stmKind
  28298.         then
  28299.      
  28300.         if (not (Kind (root) in block_stmKind))
  28301.             or else
  28302.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28303.             then
  28304.      
  28305.               -- If the root is not a block_stm or if it is then
  28306.               -- if it is not a block with declarations increment
  28307.               -- semicolon.
  28308.               -- This is because the semicolon associated with a declare
  28309.               -- block must be counted in that declare block. If we
  28310.               -- counted it here it would increment the count for the
  28311.               -- enclosing block.
  28312.          IncrementToken (semicolonz);
  28313.       end if;
  28314.      
  28315.         end if;
  28316.      
  28317.     end Scan_timed_entry_stm;
  28318.      
  28319.      
  28320.     procedure Scan_abort_stm(Root : abort_stmNode.Locator) is
  28321.         as_abort_name_s_List : SeqOfNAME_EXP.Generator;
  28322.         as_abort_name_s_Item : NAME_EXP.Locator;
  28323.         use SeqOfNAME_EXP;
  28324.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  28325.     begin
  28326.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  28327.      
  28328.      
  28329.        IncrementToken (abortz);
  28330.      
  28331.      
  28332.       if not SeqOfNAME_EXP.IsNull(as_abort_name_s(Root)) then
  28333.         StartForward(as_abort_name_s(Root), as_abort_name_s_List);
  28334.         while not Finished(as_abort_name_s_List) loop
  28335.             as_abort_name_s_Item := Cell(as_abort_name_s_List);
  28336.      
  28337.      
  28338.        if SERIES_UNIT_IH.R.ih_inlist then
  28339.            IncrementToken (commaz);
  28340.        end if;
  28341.        SERIES_UNIT_IH.R.ih_inlist := true;
  28342.      
  28343.      
  28344.             Scan_NAME_EXP(as_abort_name_s_Item);
  28345.             Forward(as_abort_name_s_List);
  28346.         end loop;
  28347.         EndIterate(as_abort_name_s_List);
  28348.       end if;
  28349.      
  28350.      
  28351.        SERIES_UNIT_IH.R.ih_inlist := false;
  28352.      
  28353.      
  28354.      
  28355.         if  Kind(root) not in labeled_stmKind
  28356.         then
  28357.      
  28358.         if (not (Kind (root) in block_stmKind))
  28359.             or else
  28360.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28361.             then
  28362.      
  28363.               -- If the root is not a block_stm or if it is then
  28364.               -- if it is not a block with declarations increment
  28365.               -- semicolon.
  28366.               -- This is because the semicolon associated with a declare
  28367.               -- block must be counted in that declare block. If we
  28368.               -- counted it here it would increment the count for the
  28369.               -- enclosing block.
  28370.          IncrementToken (semicolonz);
  28371.       end if;
  28372.      
  28373.         end if;
  28374.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  28375.      
  28376.     end Scan_abort_stm;
  28377.      
  28378.      
  28379.     procedure Scan_accept_stm(Root : accept_stmNode.Locator) is
  28380.         as_accept_stm_s_List : SeqOfSTM.Generator;
  28381.         as_accept_stm_s_Item : STM.Locator;
  28382.         use SeqOfSTM;
  28383.     begin
  28384.      
  28385.      
  28386.        IncrementToken (acceptz);
  28387.      
  28388.      
  28389.       if not NAME_EXP.IsNull(as_accept_designator(Root)) then
  28390.         Scan_NAME_EXP(as_accept_designator(Root));
  28391.       end if;
  28392.       if not accept_specNode.IsNull(as_accept_spec(Root)) then
  28393.         Scan_accept_spec(as_accept_spec(Root));
  28394.       end if;
  28395.       if not SeqOfSTM.IsNull(as_accept_stm_s(Root)) then
  28396.      
  28397.      
  28398.        IncrementToken (doz);
  28399.        IncrementToken (end_acceptz);
  28400.      
  28401.      
  28402.         StartForward(as_accept_stm_s(Root), as_accept_stm_s_List);
  28403.         while not Finished(as_accept_stm_s_List) loop
  28404.             as_accept_stm_s_Item := Cell(as_accept_stm_s_List);
  28405.             Scan_STM(as_accept_stm_s_Item);
  28406.             Forward(as_accept_stm_s_List);
  28407.         end loop;
  28408.         EndIterate(as_accept_stm_s_List);
  28409.       end if;
  28410.      
  28411.         if  Kind(root) not in labeled_stmKind
  28412.         then
  28413.      
  28414.         if (not (Kind (root) in block_stmKind))
  28415.             or else
  28416.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28417.             then
  28418.      
  28419.               -- If the root is not a block_stm or if it is then
  28420.               -- if it is not a block with declarations increment
  28421.               -- semicolon.
  28422.               -- This is because the semicolon associated with a declare
  28423.               -- block must be counted in that declare block. If we
  28424.               -- counted it here it would increment the count for the
  28425.               -- enclosing block.
  28426.          IncrementToken (semicolonz);
  28427.       end if;
  28428.      
  28429.         end if;
  28430.      
  28431.     end Scan_accept_stm;
  28432.      
  28433.      
  28434.     procedure Scan_assign_stm(Root : assign_stmNode.Locator) is
  28435.     begin
  28436.      
  28437.      
  28438.   IncrementToken (colon_equalsz);
  28439.      
  28440.      
  28441.       if not NAME_EXP.IsNull(as_assign_name(Root)) then
  28442.         Scan_NAME_EXP(as_assign_name(Root));
  28443.       end if;
  28444.       if not NAME_EXP.IsNull(as_assign_exp(Root)) then
  28445.         Scan_NAME_EXP(as_assign_exp(Root));
  28446.       end if;
  28447.      
  28448.         if  Kind(root) not in labeled_stmKind
  28449.         then
  28450.      
  28451.         if (not (Kind (root) in block_stmKind))
  28452.             or else
  28453.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28454.             then
  28455.      
  28456.               -- If the root is not a block_stm or if it is then
  28457.               -- if it is not a block with declarations increment
  28458.               -- semicolon.
  28459.               -- This is because the semicolon associated with a declare
  28460.               -- block must be counted in that declare block. If we
  28461.               -- counted it here it would increment the count for the
  28462.               -- enclosing block.
  28463.          IncrementToken (semicolonz);
  28464.       end if;
  28465.      
  28466.         end if;
  28467.      
  28468.     end Scan_assign_stm;
  28469.      
  28470.      
  28471.     procedure Scan_block_stm(Root : block_stmNode.Locator) is
  28472.         Old_block_stm_IHR : block_stm_IH.RecType := block_stm_IH.R;
  28473.     begin
  28474.         block_stm_IH.R.ih_inblock :=  false ;
  28475.       if not block_idNode.IsNull(as_block_label(Root)) then
  28476.         Scan_block_id(as_block_label(Root));
  28477.       end if;
  28478.       if not body_blockNode.IsNull(as_block_body(Root)) then
  28479.      
  28480.      
  28481.    if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  28482.        block_stm_IH.R.ih_inblock := true;
  28483.        if not OuterMostBlockSeen then
  28484.            OuterMostBlockSeen := true;
  28485.        else
  28486.            BlockInfoStack.Push (BlockStack, CurrentBlock);
  28487.            CurrentBlock := InitializeCurrentBlock;
  28488.        end if;
  28489.        if Block_Utilities.Is_Block_Labeled (root) then
  28490.              -- Count : which is associated with the block name
  28491.              -- here.   At this point we know we have a label id and
  28492.              -- the colon adds to the complexity of the declare block.
  28493.            SetBlockId (
  28494.                        lx_symrep (as_block_label (root)),
  28495.                        declare_block,
  28496.                        DecId,
  28497.                        LineNumber (lx_srcpos (root))
  28498.                       );
  28499.        else
  28500.            SetBlockId (
  28501.                        TOKEN.NullRef,
  28502.                        declare_block,
  28503.                        DecId,
  28504.                        LineNumber (lx_srcpos (root))
  28505.                       );
  28506.        end if;
  28507.   end if;
  28508.      -- This next check is made regardless of whether we are in
  28509.      -- a block_stm with declarations or one without declarations.  If
  28510.      -- the block has a name then it has a colon.
  28511.      
  28512.   if Block_Utilities.Is_Block_Labeled (root) then
  28513.      IncrementToken (colonz);
  28514.   end if;
  28515.      
  28516.      
  28517.         Scan_body_block(as_block_body(Root));
  28518.       end if;
  28519.      
  28520.      
  28521.      if Block_Utilities.In_Declare_Block (as_block_body (root)) then
  28522.          IncrementToken (semicolonz);
  28523.          ProcessBlockInfo (CurrentBlock);
  28524.          FreeSpace (CurrentBlock);
  28525.          BlockInfoStack.Pop(BlockStack, CurrentBlock);
  28526.          IncrementToken (declare_blockz);
  28527.      end if;
  28528.      block_stm_IH.R.ih_inblock := false;
  28529.      
  28530.      
  28531.      
  28532.         if  Kind(root) not in labeled_stmKind
  28533.         then
  28534.      
  28535.         if (not (Kind (root) in block_stmKind))
  28536.             or else
  28537.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28538.             then
  28539.      
  28540.               -- If the root is not a block_stm or if it is then
  28541.               -- if it is not a block with declarations increment
  28542.               -- semicolon.
  28543.               -- This is because the semicolon associated with a declare
  28544.               -- block must be counted in that declare block. If we
  28545.               -- counted it here it would increment the count for the
  28546.               -- enclosing block.
  28547.          IncrementToken (semicolonz);
  28548.       end if;
  28549.      
  28550.         end if;
  28551.         block_stm_IH.R := Old_block_stm_IHR;
  28552.      
  28553.     end Scan_block_stm;
  28554.      
  28555.      
  28556.     procedure Scan_case_stm(Root : case_stmNode.Locator) is
  28557.         as_case_alternative_s_List : SeqOfcase_alternativeNode.Generator;
  28558.         as_case_alternative_s_Item : case_alternativeNode.Locator;
  28559.         use SeqOfcase_alternativeNode;
  28560.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  28561.     begin
  28562.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  28563.      
  28564.      
  28565.       IncrementToken (case_stmz);
  28566.       IncrementToken (case_stmz);
  28567.       IncrementToken (is_case_stmz);
  28568.       IncrementToken (end_case_stmz);
  28569.      
  28570.      
  28571.       if not NAME_EXP.IsNull(as_case_exp(Root)) then
  28572.         Scan_NAME_EXP(as_case_exp(Root));
  28573.       end if;
  28574.       if not SeqOfcase_alternativeNode.IsNull(as_case_alternative_s(Root)) then
  28575.         StartForward(as_case_alternative_s(Root), as_case_alternative_s_List);
  28576.         while not Finished(as_case_alternative_s_List) loop
  28577.             as_case_alternative_s_Item := Cell(as_case_alternative_s_List);
  28578.             Scan_case_alternative(as_case_alternative_s_Item);
  28579.             Forward(as_case_alternative_s_List);
  28580.         end loop;
  28581.         EndIterate(as_case_alternative_s_List);
  28582.       end if;
  28583.      
  28584.         if  Kind(root) not in labeled_stmKind
  28585.         then
  28586.      
  28587.         if (not (Kind (root) in block_stmKind))
  28588.             or else
  28589.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28590.             then
  28591.      
  28592.               -- If the root is not a block_stm or if it is then
  28593.               -- if it is not a block with declarations increment
  28594.               -- semicolon.
  28595.               -- This is because the semicolon associated with a declare
  28596.               -- block must be counted in that declare block. If we
  28597.               -- counted it here it would increment the count for the
  28598.               -- enclosing block.
  28599.          IncrementToken (semicolonz);
  28600.       end if;
  28601.      
  28602.         end if;
  28603.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  28604.      
  28605.     end Scan_case_stm;
  28606.      
  28607.      
  28608.     procedure Scan_code_stm(Root : code_stmNode.Locator) is
  28609.     begin
  28610.       if not qualifiedNode.IsNull(as_code_exp(Root)) then
  28611.         Scan_qualified(as_code_exp(Root));
  28612.       end if;
  28613.      
  28614.         if  Kind(root) not in labeled_stmKind
  28615.         then
  28616.      
  28617.         if (not (Kind (root) in block_stmKind))
  28618.             or else
  28619.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28620.             then
  28621.      
  28622.               -- If the root is not a block_stm or if it is then
  28623.               -- if it is not a block with declarations increment
  28624.               -- semicolon.
  28625.               -- This is because the semicolon associated with a declare
  28626.               -- block must be counted in that declare block. If we
  28627.               -- counted it here it would increment the count for the
  28628.               -- enclosing block.
  28629.          IncrementToken (semicolonz);
  28630.       end if;
  28631.      
  28632.         end if;
  28633.      
  28634.     end Scan_code_stm;
  28635.      
  28636.      
  28637.     procedure Scan_delay_stm(Root : delay_stmNode.Locator) is
  28638.     begin
  28639.      
  28640.      
  28641.        IncrementToken (delayz);
  28642.      
  28643.      
  28644.       if not NAME_EXP.IsNull(as_delay_exp(Root)) then
  28645.         Scan_NAME_EXP(as_delay_exp(Root));
  28646.       end if;
  28647.      
  28648.         if  Kind(root) not in labeled_stmKind
  28649.         then
  28650.      
  28651.         if (not (Kind (root) in block_stmKind))
  28652.             or else
  28653.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28654.             then
  28655.      
  28656.               -- If the root is not a block_stm or if it is then
  28657.               -- if it is not a block with declarations increment
  28658.               -- semicolon.
  28659.               -- This is because the semicolon associated with a declare
  28660.               -- block must be counted in that declare block. If we
  28661.               -- counted it here it would increment the count for the
  28662.               -- enclosing block.
  28663.          IncrementToken (semicolonz);
  28664.       end if;
  28665.      
  28666.         end if;
  28667.      
  28668.     end Scan_delay_stm;
  28669.      
  28670.      
  28671.     procedure Scan_exit_stm(Root : exit_stmNode.Locator) is
  28672.     begin
  28673.      
  28674.      
  28675.       IncrementToken (exitz);
  28676.      
  28677.      
  28678.       if not NAME_EXP.IsNull(as_exit_name_void(Root)) then
  28679.         Scan_NAME_EXP(as_exit_name_void(Root));
  28680.       end if;
  28681.       if not NAME_EXP.IsNull(as_exit_exp_void(Root)) then
  28682.      
  28683.      
  28684.       IncrementToken (when_exitz);
  28685.      
  28686.      
  28687.         Scan_NAME_EXP(as_exit_exp_void(Root));
  28688.       end if;
  28689.      
  28690.         if  Kind(root) not in labeled_stmKind
  28691.         then
  28692.      
  28693.         if (not (Kind (root) in block_stmKind))
  28694.             or else
  28695.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28696.             then
  28697.      
  28698.               -- If the root is not a block_stm or if it is then
  28699.               -- if it is not a block with declarations increment
  28700.               -- semicolon.
  28701.               -- This is because the semicolon associated with a declare
  28702.               -- block must be counted in that declare block. If we
  28703.               -- counted it here it would increment the count for the
  28704.               -- enclosing block.
  28705.          IncrementToken (semicolonz);
  28706.       end if;
  28707.      
  28708.         end if;
  28709.      
  28710.     end Scan_exit_stm;
  28711.      
  28712.      
  28713.     procedure Scan_goto_stm(Root : goto_stmNode.Locator) is
  28714.     begin
  28715.      
  28716.      
  28717.     IncrementToken (gotoz);
  28718.      
  28719.      
  28720.       if not NAME_EXP.IsNull(as_goto_name(Root)) then
  28721.         Scan_NAME_EXP(as_goto_name(Root));
  28722.       end if;
  28723.      
  28724.         if  Kind(root) not in labeled_stmKind
  28725.         then
  28726.      
  28727.         if (not (Kind (root) in block_stmKind))
  28728.             or else
  28729.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28730.             then
  28731.      
  28732.               -- If the root is not a block_stm or if it is then
  28733.               -- if it is not a block with declarations increment
  28734.               -- semicolon.
  28735.               -- This is because the semicolon associated with a declare
  28736.               -- block must be counted in that declare block. If we
  28737.               -- counted it here it would increment the count for the
  28738.               -- enclosing block.
  28739.          IncrementToken (semicolonz);
  28740.       end if;
  28741.      
  28742.         end if;
  28743.      
  28744.     end Scan_goto_stm;
  28745.      
  28746.      
  28747.     procedure Scan_if_stm(Root : if_stmNode.Locator) is
  28748.         as_if_list_List : SeqOfcond_alternativeNode.Generator;
  28749.         as_if_list_Item : cond_alternativeNode.Locator;
  28750.         use SeqOfcond_alternativeNode;
  28751.     begin
  28752.      
  28753.      
  28754.       IncrementToken (ifz);
  28755.       IncrementToken (ifz);
  28756.       IncrementToken (end_ifz);
  28757.      
  28758.      
  28759.       if not SeqOfcond_alternativeNode.IsNull(as_if_list(Root)) then
  28760.         StartForward(as_if_list(Root), as_if_list_List);
  28761.         while not Finished(as_if_list_List) loop
  28762.             as_if_list_Item := Cell(as_if_list_List);
  28763.             Scan_cond_alternative(as_if_list_Item);
  28764.             Forward(as_if_list_List);
  28765.         end loop;
  28766.         EndIterate(as_if_list_List);
  28767.       end if;
  28768.      
  28769.         if  Kind(root) not in labeled_stmKind
  28770.         then
  28771.      
  28772.         if (not (Kind (root) in block_stmKind))
  28773.             or else
  28774.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28775.             then
  28776.      
  28777.               -- If the root is not a block_stm or if it is then
  28778.               -- if it is not a block with declarations increment
  28779.               -- semicolon.
  28780.               -- This is because the semicolon associated with a declare
  28781.               -- block must be counted in that declare block. If we
  28782.               -- counted it here it would increment the count for the
  28783.               -- enclosing block.
  28784.          IncrementToken (semicolonz);
  28785.       end if;
  28786.      
  28787.         end if;
  28788.      
  28789.     end Scan_if_stm;
  28790.      
  28791.      
  28792.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator) is
  28793.         as_labeled_id_s_List : SeqOflabel_idNode.Generator;
  28794.         as_labeled_id_s_Item : label_idNode.Locator;
  28795.         use SeqOflabel_idNode;
  28796.     begin
  28797.      
  28798.      
  28799.       IncrementToken (open_anglesz);
  28800.      
  28801.      
  28802.       if not SeqOflabel_idNode.IsNull(as_labeled_id_s(Root)) then
  28803.         StartForward(as_labeled_id_s(Root), as_labeled_id_s_List);
  28804.         while not Finished(as_labeled_id_s_List) loop
  28805.             as_labeled_id_s_Item := Cell(as_labeled_id_s_List);
  28806.      
  28807.      
  28808.       if SERIES_UNIT_IH.R.ih_inlist then
  28809.           IncrementToken (open_anglesz);
  28810.           IncrementToken (closed_anglesz);
  28811.       end if;
  28812.       SERIES_UNIT_IH.R.ih_inlist := true;
  28813.      
  28814.      
  28815.             Scan_label_id(as_labeled_id_s_Item);
  28816.             Forward(as_labeled_id_s_List);
  28817.         end loop;
  28818.         EndIterate(as_labeled_id_s_List);
  28819.       end if;
  28820.       if not STM.IsNull(as_labeled_stm(Root)) then
  28821.         Scan_STM(as_labeled_stm(Root));
  28822.       end if;
  28823.      
  28824.      
  28825.       IncrementToken (closed_anglesz);
  28826.       SERIES_UNIT_IH.R.ih_inlist := false;
  28827.      
  28828.      
  28829.      
  28830.         if  Kind(root) not in labeled_stmKind
  28831.         then
  28832.      
  28833.         if (not (Kind (root) in block_stmKind))
  28834.             or else
  28835.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28836.             then
  28837.      
  28838.               -- If the root is not a block_stm or if it is then
  28839.               -- if it is not a block with declarations increment
  28840.               -- semicolon.
  28841.               -- This is because the semicolon associated with a declare
  28842.               -- block must be counted in that declare block. If we
  28843.               -- counted it here it would increment the count for the
  28844.               -- enclosing block.
  28845.          IncrementToken (semicolonz);
  28846.       end if;
  28847.      
  28848.         end if;
  28849.      
  28850.     end Scan_labeled_stm;
  28851.      
  28852.      
  28853.     procedure Scan_loop_stm(Root : loop_stmNode.Locator) is
  28854.         as_loop_stm_s_List : SeqOfSTM.Generator;
  28855.         as_loop_stm_s_Item : STM.Locator;
  28856.         use SeqOfSTM;
  28857.     begin
  28858.      
  28859.      
  28860.       IncrementToken (loopz);
  28861.       IncrementToken (loopz);
  28862.       IncrementToken (end_loopz);
  28863.      
  28864.      
  28865.       if not ITERATION.IsNull(as_iteration(Root)) then
  28866.         Scan_ITERATION(as_iteration(Root));
  28867.       end if;
  28868.       if not loop_idNode.IsNull(as_loop_label(Root)) then
  28869.         Scan_loop_id(as_loop_label(Root));
  28870.       end if;
  28871.       if not SeqOfSTM.IsNull(as_loop_stm_s(Root)) then
  28872.         StartForward(as_loop_stm_s(Root), as_loop_stm_s_List);
  28873.         while not Finished(as_loop_stm_s_List) loop
  28874.             as_loop_stm_s_Item := Cell(as_loop_stm_s_List);
  28875.             Scan_STM(as_loop_stm_s_Item);
  28876.             Forward(as_loop_stm_s_List);
  28877.         end loop;
  28878.         EndIterate(as_loop_stm_s_List);
  28879.       end if;
  28880.      
  28881.         if  Kind(root) not in labeled_stmKind
  28882.         then
  28883.      
  28884.         if (not (Kind (root) in block_stmKind))
  28885.             or else
  28886.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28887.             then
  28888.      
  28889.               -- If the root is not a block_stm or if it is then
  28890.               -- if it is not a block with declarations increment
  28891.               -- semicolon.
  28892.               -- This is because the semicolon associated with a declare
  28893.               -- block must be counted in that declare block. If we
  28894.               -- counted it here it would increment the count for the
  28895.               -- enclosing block.
  28896.          IncrementToken (semicolonz);
  28897.       end if;
  28898.      
  28899.         end if;
  28900.      
  28901.     end Scan_loop_stm;
  28902.      
  28903.      
  28904.     procedure Scan_null_stm(Root : null_stmNode.Locator) is
  28905.     begin
  28906.      
  28907.      
  28908.       IncrementToken (null_stmz);
  28909.      
  28910.      
  28911.      
  28912.         if  Kind(root) not in labeled_stmKind
  28913.         then
  28914.      
  28915.         if (not (Kind (root) in block_stmKind))
  28916.             or else
  28917.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28918.             then
  28919.      
  28920.               -- If the root is not a block_stm or if it is then
  28921.               -- if it is not a block with declarations increment
  28922.               -- semicolon.
  28923.               -- This is because the semicolon associated with a declare
  28924.               -- block must be counted in that declare block. If we
  28925.               -- counted it here it would increment the count for the
  28926.               -- enclosing block.
  28927.          IncrementToken (semicolonz);
  28928.       end if;
  28929.      
  28930.         end if;
  28931.      
  28932.     end Scan_null_stm;
  28933.      
  28934.      
  28935.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator) is
  28936.     begin
  28937.       if not pragma_declNode.IsNull(as_pragma(Root)) then
  28938.         Scan_pragma_decl(as_pragma(Root));
  28939.       end if;
  28940.      
  28941.         if  Kind(root) not in labeled_stmKind
  28942.         then
  28943.      
  28944.         if (not (Kind (root) in block_stmKind))
  28945.             or else
  28946.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28947.             then
  28948.      
  28949.               -- If the root is not a block_stm or if it is then
  28950.               -- if it is not a block with declarations increment
  28951.               -- semicolon.
  28952.               -- This is because the semicolon associated with a declare
  28953.               -- block must be counted in that declare block. If we
  28954.               -- counted it here it would increment the count for the
  28955.               -- enclosing block.
  28956.          IncrementToken (semicolonz);
  28957.       end if;
  28958.      
  28959.         end if;
  28960.      
  28961.     end Scan_pragma_stm;
  28962.      
  28963.      
  28964.     procedure Scan_raise_stm(Root : raise_stmNode.Locator) is
  28965.     begin
  28966.      
  28967.      
  28968.       IncrementToken (raisez);
  28969.      
  28970.      
  28971.       if not NAME_EXP.IsNull(as_raise_name_void(Root)) then
  28972.         Scan_NAME_EXP(as_raise_name_void(Root));
  28973.       end if;
  28974.      
  28975.         if  Kind(root) not in labeled_stmKind
  28976.         then
  28977.      
  28978.         if (not (Kind (root) in block_stmKind))
  28979.             or else
  28980.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  28981.             then
  28982.      
  28983.               -- If the root is not a block_stm or if it is then
  28984.               -- if it is not a block with declarations increment
  28985.               -- semicolon.
  28986.               -- This is because the semicolon associated with a declare
  28987.               -- block must be counted in that declare block. If we
  28988.               -- counted it here it would increment the count for the
  28989.               -- enclosing block.
  28990.          IncrementToken (semicolonz);
  28991.       end if;
  28992.      
  28993.         end if;
  28994.      
  28995.     end Scan_raise_stm;
  28996.      
  28997.      
  28998.     procedure Scan_return_stm(Root : return_stmNode.Locator) is
  28999.     begin
  29000.      
  29001.      
  29002.       IncrementToken (returnz);
  29003.      
  29004.      
  29005.       if not NAME_EXP.IsNull(as_return_exp_void(Root)) then
  29006.         Scan_NAME_EXP(as_return_exp_void(Root));
  29007.       end if;
  29008.      
  29009.         if  Kind(root) not in labeled_stmKind
  29010.         then
  29011.      
  29012.         if (not (Kind (root) in block_stmKind))
  29013.             or else
  29014.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29015.             then
  29016.      
  29017.               -- If the root is not a block_stm or if it is then
  29018.               -- if it is not a block with declarations increment
  29019.               -- semicolon.
  29020.               -- This is because the semicolon associated with a declare
  29021.               -- block must be counted in that declare block. If we
  29022.               -- counted it here it would increment the count for the
  29023.               -- enclosing block.
  29024.          IncrementToken (semicolonz);
  29025.       end if;
  29026.      
  29027.         end if;
  29028.      
  29029.     end Scan_return_stm;
  29030.      
  29031.      
  29032.     procedure Scan_select_stm(Root : select_stmNode.Locator) is
  29033.         as_select_clause_s_List : SeqOfselect_alternativeNode.Generator;
  29034.         as_select_clause_s_Item : select_alternativeNode.Locator;
  29035.         use SeqOfselect_alternativeNode;
  29036.     begin
  29037.      
  29038.      
  29039.       IncrementToken (selectz);
  29040.       IncrementToken (selectz);
  29041.       IncrementToken (end_selectz);
  29042.      
  29043.      
  29044.       if not SeqOfselect_alternativeNode.IsNull(as_select_clause_s(Root)) then
  29045.         StartForward(as_select_clause_s(Root), as_select_clause_s_List);
  29046.         while not Finished(as_select_clause_s_List) loop
  29047.             as_select_clause_s_Item := Cell(as_select_clause_s_List);
  29048.      
  29049.      
  29050.      if SERIES_UNIT_IH.R.ih_inlist then
  29051.         IncrementToken (or_selectz);
  29052.      end if;
  29053.      SERIES_UNIT_IH.R.ih_inlist := true;
  29054.      
  29055.      
  29056.             Scan_select_alternative(as_select_clause_s_Item);
  29057.             Forward(as_select_clause_s_List);
  29058.         end loop;
  29059.         EndIterate(as_select_clause_s_List);
  29060.       end if;
  29061.       if not cond_alternativeNode.IsNull(as_select_else(Root)) then
  29062.         Scan_cond_alternative(as_select_else(Root));
  29063.      
  29064.      
  29065.       IncrementToken (elsez);
  29066.      
  29067.      
  29068.       end if;
  29069.      
  29070.      
  29071.      SERIES_UNIT_IH.R.ih_inlist := false;
  29072.      
  29073.      
  29074.      
  29075.         if  Kind(root) not in labeled_stmKind
  29076.         then
  29077.      
  29078.         if (not (Kind (root) in block_stmKind))
  29079.             or else
  29080.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29081.             then
  29082.      
  29083.               -- If the root is not a block_stm or if it is then
  29084.               -- if it is not a block with declarations increment
  29085.               -- semicolon.
  29086.               -- This is because the semicolon associated with a declare
  29087.               -- block must be counted in that declare block. If we
  29088.               -- counted it here it would increment the count for the
  29089.               -- enclosing block.
  29090.          IncrementToken (semicolonz);
  29091.       end if;
  29092.      
  29093.         end if;
  29094.      
  29095.     end Scan_select_stm;
  29096.      
  29097.      
  29098.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator) is
  29099.     begin
  29100.      
  29101.      
  29102.       IncrementToken (terminatez);
  29103.      
  29104.      
  29105.      
  29106.         if  Kind(root) not in labeled_stmKind
  29107.         then
  29108.      
  29109.         if (not (Kind (root) in block_stmKind))
  29110.             or else
  29111.            (not (Block_Utilities.In_Declare_Block (as_block_body (root))))
  29112.             then
  29113.      
  29114.               -- If the root is not a block_stm or if it is then
  29115.               -- if it is not a block with declarations increment
  29116.               -- semicolon.
  29117.               -- This is because the semicolon associated with a declare
  29118.               -- block must be counted in that declare block. If we
  29119.               -- counted it here it would increment the count for the
  29120.               -- enclosing block.
  29121.          IncrementToken (semicolonz);
  29122.       end if;
  29123.      
  29124.         end if;
  29125.      
  29126.     end Scan_terminate_stm;
  29127.      
  29128. end STM_Pkg;
  29129. -- End: SCSTM bdy -----------------------------------------------------
  29130. ::::::::::::::
  29131. scstm.spc
  29132. ::::::::::::::
  29133. -- Begin: SCSTM spc ---------------------------------------------------
  29134.      
  29135. with ST_DIANA; use ST_DIANA;
  29136.              package STM_Pkg is
  29137.     procedure Scan_STM(Root : STM.Locator);
  29138.     procedure Scan_CALL_STM(Root : CALL_STM.Locator);
  29139.     procedure Scan_apply_call_stm(Root : apply_call_stmNode.Locator);
  29140.     procedure Scan_entry_call_stm(Root : entry_call_stmNode.Locator);
  29141.     procedure Scan_proc_call_stm(Root : proc_call_stmNode.Locator);
  29142.     procedure Scan_SELECTIVE_ENTRY_STM(Root : SELECTIVE_ENTRY_STM.Locator);
  29143.     procedure Scan_cond_entry_stm(Root : cond_entry_stmNode.Locator);
  29144.     procedure Scan_timed_entry_stm(Root : timed_entry_stmNode.Locator);
  29145.     procedure Scan_abort_stm(Root : abort_stmNode.Locator);
  29146.     procedure Scan_accept_stm(Root : accept_stmNode.Locator);
  29147.     procedure Scan_assign_stm(Root : assign_stmNode.Locator);
  29148.     procedure Scan_block_stm(Root : block_stmNode.Locator);
  29149.     procedure Scan_case_stm(Root : case_stmNode.Locator);
  29150.     procedure Scan_code_stm(Root : code_stmNode.Locator);
  29151.     procedure Scan_delay_stm(Root : delay_stmNode.Locator);
  29152.     procedure Scan_exit_stm(Root : exit_stmNode.Locator);
  29153.     procedure Scan_goto_stm(Root : goto_stmNode.Locator);
  29154.     procedure Scan_if_stm(Root : if_stmNode.Locator);
  29155.     procedure Scan_labeled_stm(Root : labeled_stmNode.Locator);
  29156.     procedure Scan_loop_stm(Root : loop_stmNode.Locator);
  29157.     procedure Scan_null_stm(Root : null_stmNode.Locator);
  29158.     procedure Scan_pragma_stm(Root : pragma_stmNode.Locator);
  29159.     procedure Scan_raise_stm(Root : raise_stmNode.Locator);
  29160.     procedure Scan_return_stm(Root : return_stmNode.Locator);
  29161.     procedure Scan_select_stm(Root : select_stmNode.Locator);
  29162.     procedure Scan_terminate_stm(Root : terminate_stmNode.Locator);
  29163. end STM_Pkg;
  29164. -- End: SCSTM spc -----------------------------------------------------
  29165.      
  29166. ::::::::::::::
  29167. scsubp_de.bdy
  29168. ::::::::::::::
  29169. -- Begin: SCSUBP_DEF bdy ---------------------------------------------------
  29170.      
  29171. with Halstead_Data_Base;  use Halstead_Data_Base;
  29172. with Definitions; use Definitions;
  29173.              with BLOCK_STUB_Pkg; use BLOCK_STUB_Pkg;
  29174. with GENERAL_ASSOC_Pkg; use GENERAL_ASSOC_Pkg;
  29175. with NAME_EXP_Pkg; use NAME_EXP_Pkg;
  29176. package body SUBP_DEF_Pkg is
  29177.      
  29178.      
  29179.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator) is
  29180.     begin
  29181.         case Kind(Root) is
  29182.           when FORMAL_SUBPKind => Scan_FORMAL_SUBP(Root);
  29183.           when subp_block_stubKind => Scan_subp_block_stub(Root);
  29184.           when subp_instantiationKind => Scan_subp_instantiation(Root);
  29185.           when subp_renameKind => Scan_subp_rename(Root);
  29186.           when others => null;
  29187.         end case;
  29188.     end Scan_SUBP_DEF;
  29189.      
  29190.      
  29191.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator) is
  29192.     begin
  29193.         case Kind(Root) is
  29194.           when formal_subp_boxKind => Scan_formal_subp_box(Root);
  29195.           when formal_subp_nameKind => Scan_formal_subp_name(Root);
  29196.           when others => null;
  29197.         end case;
  29198.     end Scan_FORMAL_SUBP;
  29199.      
  29200.      
  29201.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator) is
  29202.     begin
  29203.      
  29204.      
  29205.       IncrementToken (box_default_subpz);
  29206.      
  29207.      
  29208.      
  29209.     end Scan_formal_subp_box;
  29210.      
  29211.      
  29212.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator) is
  29213.     begin
  29214.      
  29215.      
  29216.      IncrementToken (is_procedurez);
  29217.      
  29218.      
  29219.      
  29220.     end Scan_formal_subp_name;
  29221.      
  29222.      
  29223.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator) is
  29224.     begin
  29225.       if not BLOCK_STUB.IsNull(as_subp_block_stub(Root)) then
  29226.         Scan_BLOCK_STUB(as_subp_block_stub(Root));
  29227.       end if;
  29228.      
  29229.      
  29230.      IncrementToken (semicolonz);
  29231.      
  29232.      
  29233.      
  29234.     end Scan_subp_block_stub;
  29235.      
  29236.      
  29237.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator) is
  29238.         as_generic_assoc_s_List : SeqOfGENERAL_ASSOC.Generator;
  29239.         as_generic_assoc_s_Item : GENERAL_ASSOC.Locator;
  29240.         use SeqOfGENERAL_ASSOC;
  29241.     begin
  29242.       if not SeqOfGENERAL_ASSOC.IsNull(as_generic_assoc_s(Root)) then
  29243.         StartForward(as_generic_assoc_s(Root), as_generic_assoc_s_List);
  29244.         while not Finished(as_generic_assoc_s_List) loop
  29245.             as_generic_assoc_s_Item := Cell(as_generic_assoc_s_List);
  29246.             Scan_GENERAL_ASSOC(as_generic_assoc_s_Item);
  29247.             Forward(as_generic_assoc_s_List);
  29248.         end loop;
  29249.         EndIterate(as_generic_assoc_s_List);
  29250.       end if;
  29251.       if not NAME_EXP.IsNull(as_instantiation_name(Root)) then
  29252.      
  29253.      
  29254.       IncrementToken (is_procedurez);
  29255.       IncrementToken (new_generic_instz);
  29256.      
  29257.      
  29258.      
  29259.      
  29260.       IncrementToken (open_parenthesisz);
  29261.      
  29262.      
  29263.         Scan_NAME_EXP(as_instantiation_name(Root));
  29264.      
  29265.      
  29266.       IncrementToken (closed_parenthesisz);
  29267.      
  29268.      
  29269.       end if;
  29270.      
  29271.     end Scan_subp_instantiation;
  29272.      
  29273.      
  29274.     procedure Scan_subp_rename(Root : subp_renameNode.Locator) is
  29275.     begin
  29276.      
  29277.      
  29278.        IncrementToken (renamesz);
  29279.      
  29280.      
  29281.       if not NAME_EXP.IsNull(as_rename_name(Root)) then
  29282.         Scan_NAME_EXP(as_rename_name(Root));
  29283.       end if;
  29284.      
  29285.     end Scan_subp_rename;
  29286.      
  29287. end SUBP_DEF_Pkg;
  29288. -- End: SCSUBP_DEF bdy -----------------------------------------------------
  29289. ::::::::::::::
  29290. scsubp_de.spc
  29291. ::::::::::::::
  29292. -- Begin: SCSUBP_DEF spc ---------------------------------------------------
  29293.      
  29294. with ST_DIANA; use ST_DIANA;
  29295.              package SUBP_DEF_Pkg is
  29296.     procedure Scan_SUBP_DEF(Root : SUBP_DEF.Locator);
  29297.     procedure Scan_FORMAL_SUBP(Root : FORMAL_SUBP.Locator);
  29298.     procedure Scan_formal_subp_box(Root : formal_subp_boxNode.Locator);
  29299.     procedure Scan_formal_subp_name(Root : formal_subp_nameNode.Locator);
  29300.     procedure Scan_subp_block_stub(Root : subp_block_stubNode.Locator);
  29301.     procedure Scan_subp_instantiation(Root : subp_instantiationNode.Locator);
  29302.     procedure Scan_subp_rename(Root : subp_renameNode.Locator);
  29303. end SUBP_DEF_Pkg;
  29304. -- End: SCSUBP_DEF spc -----------------------------------------------------
  29305. ::::::::::::::
  29306. sctype_sp.bdy
  29307. ::::::::::::::
  29308. -- Begin: SCTYPE_SPEC bdy ---------------------------------------------------
  29309.      
  29310. with Halstead_Data_Base;  use Halstead_Data_Base;
  29311. with Definitions; use Definitions;
  29312.              with SERIES_UNIT_IH;
  29313. with CONSTRAINT_Pkg; use CONSTRAINT_Pkg;
  29314. with OBJECT_TYPE_Pkg; use OBJECT_TYPE_Pkg;
  29315. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  29316. with DEF_ID_Pkg; use DEF_ID_Pkg;
  29317. with ITEM_Pkg; use ITEM_Pkg;
  29318.      
  29319.    with task_decl_IH;
  29320.                          package body TYPE_SPEC_Pkg is
  29321.      
  29322.      
  29323.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator) is
  29324.     begin
  29325.         case Kind(Root) is
  29326.           when ARRAY_TYPEKind => Scan_ARRAY_TYPE(Root);
  29327.           when DSCRMT_TYPEKind => Scan_DSCRMT_TYPE(Root);
  29328.           when FORMAL_SCALARKind => Scan_FORMAL_SCALAR(Root);
  29329.           when access_typeKind => Scan_access_type(Root);
  29330.           when derived_typeKind => Scan_derived_type(Root);
  29331.           when enum_typeKind => Scan_enum_type(Root);
  29332.           when fixed_typeKind => Scan_fixed_type(Root);
  29333.           when float_typeKind => Scan_float_type(Root);
  29334.           when integer_typeKind => Scan_integer_type(Root);
  29335.           when task_specKind => Scan_task_spec(Root);
  29336.           when others => null;
  29337.         end case;
  29338.     end Scan_TYPE_SPEC;
  29339.      
  29340.      
  29341.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator) is
  29342.     begin
  29343.         case Kind(Root) is
  29344.           when constrained_array_typeKind => Scan_constrained_array_type(Root);
  29345.           when unconstrained_array_typeKind => Scan_unconstrained_array_type(Root);
  29346.           when others => null;
  29347.         end case;
  29348.     end Scan_ARRAY_TYPE;
  29349.      
  29350.      
  29351.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator) is
  29352.     begin
  29353.      
  29354.      
  29355.       IncrementToken (arrayz);
  29356.      
  29357.      
  29358.       if not index_constraintNode.IsNull(as_array_constraint(Root)) then
  29359.         Scan_index_constraint(as_array_constraint(Root));
  29360.       end if;
  29361.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  29362.      
  29363.      
  29364.      IncrementToken (ofz);
  29365.      
  29366.      
  29367.         Scan_object_type_constrained(as_component_constrained(Root));
  29368.       end if;
  29369.      
  29370.     end Scan_constrained_array_type;
  29371.      
  29372.      
  29373.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator) is
  29374.         as_index_list_List : SeqOfobject_type_indexNode.Generator;
  29375.         as_index_list_Item : object_type_indexNode.Locator;
  29376.         use SeqOfobject_type_indexNode;
  29377.     begin
  29378.      
  29379.      
  29380.       IncrementToken (arrayz);
  29381.      
  29382.      
  29383.       if not SeqOfobject_type_indexNode.IsNull(as_index_list(Root)) then
  29384.      
  29385.      
  29386.       IncrementToken (open_parenthesisz);
  29387.      
  29388.      
  29389.         StartForward(as_index_list(Root), as_index_list_List);
  29390.         while not Finished(as_index_list_List) loop
  29391.             as_index_list_Item := Cell(as_index_list_List);
  29392.      
  29393.      
  29394.       if SERIES_UNIT_IH.R.ih_inlist then
  29395.           IncrementToken (box_rangez);
  29396.           IncrementToken (commaz);
  29397.       end if;
  29398.       SERIES_UNIT_IH.R.ih_inlist := true;
  29399.      
  29400.      
  29401.             Scan_object_type_index(as_index_list_Item);
  29402.             Forward(as_index_list_List);
  29403.         end loop;
  29404.         EndIterate(as_index_list_List);
  29405.      
  29406.      
  29407.      IncrementToken (closed_parenthesisz);
  29408.      IncrementToken (box_rangez);
  29409.      SERIES_UNIT_IH.R.ih_inlist := false;
  29410.      
  29411.      
  29412.       end if;
  29413.       if not object_type_constrainedNode.IsNull(as_component_constrained(Root)) then
  29414.      
  29415.      
  29416.      IncrementToken (ofz);
  29417.      
  29418.      
  29419.         Scan_object_type_constrained(as_component_constrained(Root));
  29420.       end if;
  29421.      
  29422.     end Scan_unconstrained_array_type;
  29423.      
  29424.      
  29425.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator) is
  29426.     begin
  29427.         case Kind(Root) is
  29428.           when PRIV_TYPEKind => Scan_PRIV_TYPE(Root);
  29429.           when record_typeKind => Scan_record_type(Root);
  29430.           when others => null;
  29431.         end case;
  29432.     end Scan_DSCRMT_TYPE;
  29433.      
  29434.      
  29435.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator) is
  29436.     begin
  29437.         case Kind(Root) is
  29438.           when FORMAL_PRIVKind => Scan_FORMAL_PRIV(Root);
  29439.           when lim_priv_typeKind => Scan_lim_priv_type(Root);
  29440.           when nonlim_priv_typeKind => Scan_nonlim_priv_type(Root);
  29441.           when others => null;
  29442.         end case;
  29443.     end Scan_PRIV_TYPE;
  29444.      
  29445.      
  29446.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator) is
  29447.     begin
  29448.         case Kind(Root) is
  29449.           when generic_lim_priv_typeKind => Scan_generic_lim_priv_type(Root);
  29450.           when generic_priv_typeKind => Scan_generic_priv_type(Root);
  29451.           when others => null;
  29452.         end case;
  29453.     end Scan_FORMAL_PRIV;
  29454.      
  29455.      
  29456.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator) is
  29457.     begin
  29458.      
  29459.      
  29460.      IncrementToken (limitedz);
  29461.      IncrementToken (private_typez);
  29462.      
  29463.      
  29464.      
  29465.     end Scan_generic_lim_priv_type;
  29466.      
  29467.      
  29468.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator) is
  29469.     begin
  29470.      
  29471.      
  29472.      IncrementToken (private_typez);
  29473.      
  29474.      
  29475.      
  29476.     end Scan_generic_priv_type;
  29477.      
  29478.      
  29479.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator) is
  29480.     begin
  29481.      
  29482.      
  29483.     IncrementToken (limitedz);
  29484.     IncrementToken (private_typez);
  29485.      
  29486.      
  29487.      
  29488.     end Scan_lim_priv_type;
  29489.      
  29490.      
  29491.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator) is
  29492.     begin
  29493.      
  29494.      
  29495.     IncrementToken (private_typez);
  29496.      
  29497.      
  29498.      
  29499.     end Scan_nonlim_priv_type;
  29500.      
  29501.      
  29502.     procedure Scan_record_type(Root : record_typeNode.Locator) is
  29503.     begin
  29504.      
  29505.      
  29506.     IncrementToken (record_typez);
  29507.      
  29508.      
  29509.       if not inner_recordNode.IsNull(as_inner_record(Root)) then
  29510.         Scan_inner_record(as_inner_record(Root));
  29511.       end if;
  29512.      
  29513.      
  29514.     IncrementToken (end_recordz);
  29515.     IncrementToken (record_typez);
  29516.      
  29517.      
  29518.      
  29519.     end Scan_record_type;
  29520.      
  29521.      
  29522.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator) is
  29523.     begin
  29524.         case Kind(Root) is
  29525.           when formal_discreteKind => Scan_formal_discrete(Root);
  29526.           when formal_fixedKind => Scan_formal_fixed(Root);
  29527.           when formal_floatKind => Scan_formal_float(Root);
  29528.           when formal_integerKind => Scan_formal_integer(Root);
  29529.           when others => null;
  29530.         end case;
  29531.     end Scan_FORMAL_SCALAR;
  29532.      
  29533.      
  29534.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator) is
  29535.     begin
  29536.      
  29537.      
  29538.          IncrementToken (box_rangez);
  29539.      
  29540.      
  29541.      
  29542.      
  29543.       IncrementToken (open_parenthesisz);
  29544.       IncrementToken (closed_parenthesisz);
  29545.      
  29546.      
  29547.      
  29548.     end Scan_formal_discrete;
  29549.      
  29550.      
  29551.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator) is
  29552.     begin
  29553.      
  29554.      
  29555.          IncrementToken (box_rangez);
  29556.      
  29557.      
  29558.      
  29559.      
  29560.       IncrementToken (digitsz);
  29561.      
  29562.      
  29563.      
  29564.     end Scan_formal_fixed;
  29565.      
  29566.      
  29567.     procedure Scan_formal_float(Root : formal_floatNode.Locator) is
  29568.     begin
  29569.      
  29570.      
  29571.          IncrementToken (box_rangez);
  29572.      
  29573.      
  29574.      
  29575.      
  29576.       IncrementToken (deltaz);
  29577.      
  29578.      
  29579.      
  29580.     end Scan_formal_float;
  29581.      
  29582.      
  29583.     procedure Scan_formal_integer(Root : formal_integerNode.Locator) is
  29584.     begin
  29585.      
  29586.      
  29587.          IncrementToken (box_rangez);
  29588.      
  29589.      
  29590.      
  29591.      
  29592.      
  29593.      
  29594.      
  29595.     end Scan_formal_integer;
  29596.      
  29597.      
  29598.     procedure Scan_access_type(Root : access_typeNode.Locator) is
  29599.     begin
  29600.      
  29601.      
  29602.     IncrementToken (accessz);
  29603.      
  29604.      
  29605.       if not object_type_constrainedNode.IsNull(as_access_constrained(Root)) then
  29606.         Scan_object_type_constrained(as_access_constrained(Root));
  29607.       end if;
  29608.      
  29609.     end Scan_access_type;
  29610.      
  29611.      
  29612.     procedure Scan_derived_type(Root : derived_typeNode.Locator) is
  29613.     begin
  29614.      
  29615.      
  29616.      IncrementToken (new_derived_typez);
  29617.      
  29618.      
  29619.       if not object_type_constrainedNode.IsNull(as_parent_constrained(Root)) then
  29620.         Scan_object_type_constrained(as_parent_constrained(Root));
  29621.       end if;
  29622.      
  29623.     end Scan_derived_type;
  29624.      
  29625.      
  29626.     procedure Scan_enum_type(Root : enum_typeNode.Locator) is
  29627.         as_enumeral_s_List : SeqOfLITERAL_ID.Generator;
  29628.         as_enumeral_s_Item : LITERAL_ID.Locator;
  29629.         use SeqOfLITERAL_ID;
  29630.         Old_SERIES_UNIT_IHR : SERIES_UNIT_IH.RecType := SERIES_UNIT_IH.R;
  29631.     begin
  29632.         SERIES_UNIT_IH.R.ih_inlist :=  false ;
  29633.      
  29634.      
  29635.      IncrementToken (open_parenthesisz);
  29636.      
  29637.      
  29638.         StartForward(as_enumeral_s(Root), as_enumeral_s_List);
  29639.         while not Finished(as_enumeral_s_List) loop
  29640.             as_enumeral_s_Item := Cell(as_enumeral_s_List);
  29641.      
  29642.      
  29643.      if SERIES_UNIT_IH.R.ih_inlist then
  29644.          IncrementToken (commaz);
  29645.      end if;
  29646.      SERIES_UNIT_IH.R.ih_inlist := true;
  29647.      
  29648.      
  29649.             Scan_LITERAL_ID(as_enumeral_s_Item);
  29650.             Forward(as_enumeral_s_List);
  29651.         end loop;
  29652.         EndIterate(as_enumeral_s_List);
  29653.      
  29654.      
  29655.      IncrementToken (closed_parenthesisz);
  29656.      SERIES_UNIT_IH.R.ih_inlist := false;
  29657.      
  29658.      
  29659.         SERIES_UNIT_IH.R := Old_SERIES_UNIT_IHR;
  29660.      
  29661.     end Scan_enum_type;
  29662.      
  29663.      
  29664.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator) is
  29665.     begin
  29666.      
  29667.      
  29668.      IncrementToken (deltaz);
  29669.      
  29670.      
  29671.       if not fixed_constraintNode.IsNull(as_fixed_constraint(Root)) then
  29672.         Scan_fixed_constraint(as_fixed_constraint(Root));
  29673.       end if;
  29674.      
  29675.     end Scan_fixed_type;
  29676.      
  29677.      
  29678.     procedure Scan_float_type(Root : float_typeNode.Locator) is
  29679.     begin
  29680.      
  29681.      
  29682.      IncrementToken (digitsz);
  29683.      
  29684.      
  29685.       if not float_constraintNode.IsNull(as_float_constraint(Root)) then
  29686.         Scan_float_constraint(as_float_constraint(Root));
  29687.       end if;
  29688.      
  29689.     end Scan_float_type;
  29690.      
  29691.      
  29692.     procedure Scan_integer_type(Root : integer_typeNode.Locator) is
  29693.     begin
  29694.       if not RANGE_CONSTRAINT_CLASS.IsNull(as_range_constraint(Root)) then
  29695.         Scan_RANGE_CONSTRAINT_CLASS(as_range_constraint(Root));
  29696.       end if;
  29697.      
  29698.     end Scan_integer_type;
  29699.      
  29700.      
  29701.     procedure Scan_task_spec(Root : task_specNode.Locator) is
  29702.         as_task_spec_decl_s_List : SeqOfITEM.Generator;
  29703.         as_task_spec_decl_s_Item : ITEM.Locator;
  29704.         use SeqOfITEM;
  29705.     begin
  29706.      
  29707.      
  29708.     if not OuterMostBlockSeen then
  29709.         OuterMostBlockSeen := true;
  29710.     else
  29711.         BlockInfoStack.Push(BlockStack, CurrentBlock);
  29712.         CurrentBlock := InitializeCurrentBlock;
  29713.     end if;
  29714.     SetBlockId (lx_symrep (sm_def_of_type (root)),
  29715.                 task_body_block,
  29716.                 SpcId,
  29717.                 LineNumber (lx_srcpos (root))
  29718.                 );
  29719.     if not task_decl_IH.R.ih_intask_decl then
  29720.          -- If we are not in a task_decl and we are scanning task_spec
  29721.          -- then we are in a type_decl and the token type appears.
  29722.      
  29723.        IncrementToken (typez);
  29724.     end if;
  29725.     IncrementToken (task_spcz);
  29726.     IncrementToken (is_task_spcz);
  29727.     IncrementToken (end_task_spcz);
  29728.      
  29729.      
  29730.       if not SeqOfITEM.IsNull(as_task_spec_decl_s(Root)) then
  29731.         StartForward(as_task_spec_decl_s(Root), as_task_spec_decl_s_List);
  29732.         while not Finished(as_task_spec_decl_s_List) loop
  29733.             as_task_spec_decl_s_Item := Cell(as_task_spec_decl_s_List);
  29734.             Scan_ITEM(as_task_spec_decl_s_Item);
  29735.             Forward(as_task_spec_decl_s_List);
  29736.         end loop;
  29737.         EndIterate(as_task_spec_decl_s_List);
  29738.       end if;
  29739.      
  29740.      
  29741.   IncrementToken (semicolonz);
  29742.   ProcessBlockInfo (CurrentBlock);
  29743.   FreeSpace (CurrentBlock);
  29744.   BlockInfoStack.Pop(BlockStack, CurrentBlock);
  29745.      
  29746.      
  29747.      
  29748.     end Scan_task_spec;
  29749.      
  29750. end TYPE_SPEC_Pkg;
  29751. -- End: SCTYPE_SPEC bdy -----------------------------------------------------
  29752. ::::::::::::::
  29753. sctype_sp.spc
  29754. ::::::::::::::
  29755. -- Begin: SCTYPE_SPEC spc ---------------------------------------------------
  29756.      
  29757. with ST_DIANA; use ST_DIANA;
  29758.              package TYPE_SPEC_Pkg is
  29759.     procedure Scan_TYPE_SPEC(Root : TYPE_SPEC.Locator);
  29760.     procedure Scan_ARRAY_TYPE(Root : ARRAY_TYPE.Locator);
  29761.     procedure Scan_constrained_array_type(Root : constrained_array_typeNode.Locator);
  29762.     procedure Scan_unconstrained_array_type(Root : unconstrained_array_typeNode.Locator);
  29763.     procedure Scan_DSCRMT_TYPE(Root : DSCRMT_TYPE.Locator);
  29764.     procedure Scan_PRIV_TYPE(Root : PRIV_TYPE.Locator);
  29765.     procedure Scan_FORMAL_PRIV(Root : FORMAL_PRIV.Locator);
  29766.     procedure Scan_generic_lim_priv_type(Root : generic_lim_priv_typeNode.Locator);
  29767.     procedure Scan_generic_priv_type(Root : generic_priv_typeNode.Locator);
  29768.     procedure Scan_lim_priv_type(Root : lim_priv_typeNode.Locator);
  29769.     procedure Scan_nonlim_priv_type(Root : nonlim_priv_typeNode.Locator);
  29770.     procedure Scan_record_type(Root : record_typeNode.Locator);
  29771.     procedure Scan_FORMAL_SCALAR(Root : FORMAL_SCALAR.Locator);
  29772.     procedure Scan_formal_discrete(Root : formal_discreteNode.Locator);
  29773.     procedure Scan_formal_fixed(Root : formal_fixedNode.Locator);
  29774.     procedure Scan_formal_float(Root : formal_floatNode.Locator);
  29775.     procedure Scan_formal_integer(Root : formal_integerNode.Locator);
  29776.     procedure Scan_access_type(Root : access_typeNode.Locator);
  29777.     procedure Scan_derived_type(Root : derived_typeNode.Locator);
  29778.     procedure Scan_enum_type(Root : enum_typeNode.Locator);
  29779.     procedure Scan_fixed_type(Root : fixed_typeNode.Locator);
  29780.     procedure Scan_float_type(Root : float_typeNode.Locator);
  29781.     procedure Scan_integer_type(Root : integer_typeNode.Locator);
  29782.     procedure Scan_task_spec(Root : task_specNode.Locator);
  29783. end TYPE_SPEC_Pkg;
  29784. -- End: SCTYPE_SPEC spc -----------------------------------------------------
  29785. ::::::::::::::
  29786. scvariant.bdy
  29787. ::::::::::::::
  29788. -- Begin: SCVARIANT_ALTERNATIVE_CLASS bdy ---------------------------------------------------
  29789.      
  29790. with Halstead_Data_Base;  use Halstead_Data_Base;
  29791. with Definitions; use Definitions;
  29792.              with ITEM_Pkg; use ITEM_Pkg;
  29793. with CHOICE_Pkg; use CHOICE_Pkg;
  29794. with INNER_RECORD_CLASS_Pkg; use INNER_RECORD_CLASS_Pkg;
  29795. package body VARIANT_ALTERNATIVE_CLASS_Pkg is
  29796.      
  29797.      
  29798.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator) is
  29799.     begin
  29800.         case Kind(Root) is
  29801.           when pragma_variantKind => Scan_pragma_variant(Root);
  29802.           when variant_alternativeKind => Scan_variant_alternative(Root);
  29803.           when others => null;
  29804.         end case;
  29805.     end Scan_VARIANT_ALTERNATIVE_CLASS;
  29806.      
  29807.      
  29808.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator) is
  29809.     begin
  29810.       if not pragma_declNode.IsNull(as_pragma_variant(Root)) then
  29811.         Scan_pragma_decl(as_pragma_variant(Root));
  29812.       end if;
  29813.      
  29814.     end Scan_pragma_variant;
  29815.      
  29816.      
  29817.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator) is
  29818.         as_variant_choice_s_List : SeqOfCHOICE.Generator;
  29819.         as_variant_choice_s_Item : CHOICE.Locator;
  29820.         use SeqOfCHOICE;
  29821.     begin
  29822.       if not SeqOfCHOICE.IsNull(as_variant_choice_s(Root)) then
  29823.      
  29824.      
  29825.      IncrementToken (when_case_variantz);
  29826.      
  29827.      
  29828.         StartForward(as_variant_choice_s(Root), as_variant_choice_s_List);
  29829.         while not Finished(as_variant_choice_s_List) loop
  29830.             as_variant_choice_s_Item := Cell(as_variant_choice_s_List);
  29831.             Scan_CHOICE(as_variant_choice_s_Item);
  29832.             Forward(as_variant_choice_s_List);
  29833.         end loop;
  29834.         EndIterate(as_variant_choice_s_List);
  29835.      
  29836.      
  29837.       IncrementToken (arrowz);
  29838.      
  29839.      
  29840.       end if;
  29841.       if not inner_recordNode.IsNull(as_record(Root)) then
  29842.         Scan_inner_record(as_record(Root));
  29843.       end if;
  29844.      
  29845.     end Scan_variant_alternative;
  29846.      
  29847. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  29848. -- End: SCVARIANT_ALTERNATIVE_CLASS bdy -----------------------------------------------------
  29849. ::::::::::::::
  29850. scvariant.spc
  29851. ::::::::::::::
  29852. -- Begin: SCVARIANT_ALTERNATIVE_CLASS spc ---------------------------------------------------
  29853.      
  29854. with ST_DIANA; use ST_DIANA;
  29855.              package VARIANT_ALTERNATIVE_CLASS_Pkg is
  29856.     procedure Scan_VARIANT_ALTERNATIVE_CLASS(Root : VARIANT_ALTERNATIVE_CLASS.Locator);
  29857.     procedure Scan_pragma_variant(Root : pragma_variantNode.Locator);
  29858.     procedure Scan_variant_alternative(Root : variant_alternativeNode.Locator);
  29859. end VARIANT_ALTERNATIVE_CLASS_Pkg;
  29860. -- End: SCVARIANT_ALTERNATIVE_CLASS spc -----------------------------------------------------
  29861. ::::::::::::::
  29862. srcutil.bdy
  29863. ::::::::::::::
  29864. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.bdy,v $
  29865. -- $Revision: 1.3 $ -- $Date: 85/12/15 18:29:03 $ -- $Author: buddy $
  29866.      
  29867. --pragma revision ("$Revision: 1.3 $");
  29868.      
  29869. package body Source_Position_Utilities is
  29870.      
  29871.     --| OVERVIEW
  29872.     --| This package creates one routine which checks if a
  29873.     --| MLSP.Source_Position is null.  This is helpful
  29874.     --| at some points in the program scan to determine which
  29875.     --| tokens the source program contained.
  29876.      
  29877.     --| NOTES
  29878.     --| This routine should be incorporated in Halstead_Data_Base
  29879.     --| when the world is recompiled.
  29880.      
  29881. --------------------------------------------------------------------------
  29882.      
  29883.     function Is_Srcpos_Null (
  29884.       Position :in    MLSP.Source_Position
  29885.     ) return boolean is
  29886.      
  29887.     begin
  29888.         return (MLSP."=" (Position.first_location, 0));
  29889.     end;
  29890. end Source_Position_Utilities;
  29891.      
  29892. ::::::::::::::
  29893. srcutil.spc
  29894. ::::::::::::::
  29895. -- $Source: /nosc/work/tools/halstead/RCS/SrcUtil.spc,v $
  29896. -- $Revision: 1.1 $ -- $Date: 85/12/15 17:35:12 $ -- $Author: buddy $
  29897.      
  29898. --pragma revision ("$Revision: 1.1 $");
  29899.      
  29900. with ML_Source_Position_Pkg;
  29901. package Source_Position_Utilities is
  29902.      
  29903.     --| OVERVIEW
  29904.     --| This package creates one routine which checks if a
  29905.     --| MLSP.Source_Position is null.  This is helpful
  29906.     --| at some points in the program scan to determine which
  29907.     --| tokens the source program contained.
  29908.      
  29909.     --| NOTES
  29910.     --| This routine should be incorporated in Halstead_Data_Base
  29911.     --| when the world is recompiled.
  29912.      
  29913.     package MLSP renames ML_Source_Position_Pkg;
  29914.      
  29915. --------------------------------------------------------------------------
  29916.      
  29917.     function Is_Srcpos_Null (
  29918.       Position :in    MLSP.Source_Position
  29919.     ) return boolean;
  29920.      
  29921.     --| OVERVIEW
  29922.     --| This function returns true if the source position passed in
  29923.     --| is null.
  29924.      
  29925. end Source_Position_Utilities;
  29926.      
  29927.