CVS difference for arm/progs/arm_cont.adb

Differences between 1.5 and version 1.6
Log of other versions for file arm/progs/arm_cont.adb

--- arm/progs/arm_cont.adb	2006/01/17 07:20:09	1.5
+++ arm/progs/arm_cont.adb	2006/09/23 05:23:32	1.6
@@ -48,14 +48,56 @@
     --  9/ 9/04 - RLB - Removed unused with.
     --  2/ 2/05 - RLB - Allowed more old titles.
     --  1/16/06 - RLB - Added debugging.
+    --  9/22/06 - RLB - Created type Clause_Number_Type and added SubSubClause.
 
+    function "<" (Left, Right : Clause_Number_Type) return Boolean is
+	-- True if Left comes before Right in the collating order.
+    begin
+	if Left.Section < Right.Section then
+	    return True;
+	elsif Left.Section > Right.Section then
+	    return False;
+	elsif Left.Clause < Right.Clause then
+	    return True;
+	elsif Left.Clause > Right.Clause then
+	    return False;
+	elsif Left.Subclause < Right.Subclause then
+	    return True;
+	elsif Left.Subclause > Right.Subclause then
+	    return False;
+	elsif Left.Subsubclause < Right.Subsubclause then
+	    return True;
+	else
+	    return False;
+	end if;
+    end "<";
+
+    function ">" (Left, Right : Clause_Number_Type) return Boolean is
+	-- True if Left comes after Right in the collating order.
+    begin
+	return Right < Left;
+    end ">";
+
+    function "<=" (Left, Right : Clause_Number_Type) return Boolean is
+	-- True if Left comes before or is the same as Right in the
+	-- collating order.
+    begin
+	return not (Right < Left);
+    end "<=";
+
+    function ">=" (Left, Right : Clause_Number_Type) return Boolean is
+	-- True if Left comes after or is the same as Right in the
+	-- collating order.
+    begin
+	return not (Left < Right);
+    end ">=";
+
+
     type Title_Record is record
 	Title : Title_Type; -- Title in original format.
 	Search_Title : Title_Type; -- Title in all lower case.
 	Level : Level_Type;
-	Section_Number : Section_Number_Type;
-	Clause_Number : Natural;
-	Subclause_Number : Natural;
+	Clause_Number : Clause_Number_Type;
         Version : ARM_Contents.Change_Version_Type := '0';
     end record;
 
@@ -74,19 +116,21 @@
 
     procedure Add (Title : in Title_Type;
 		   Level : in Level_Type;
-		   Section_Number : in Section_Number_Type;
-		   Clause_Number : in Natural := 0;
-		   Subclause_Number : in Natural := 0;
+		   Clause_Number : in Clause_Number_Type;
                    Version : in ARM_Contents.Change_Version_Type := '0') is
 	-- Add a section or clause to the contents. It has the specified
 	-- characteristics.
     begin
-	if Level /= Subclause and then Subclause_Number /= 0 then
+	if Level /= Subsubclause and then Clause_Number.Subsubclause /= 0 then
+	    raise Program_Error;
+	end if;
+	if Level /= Subsubclause and then
+	   Level /= Subclause and then Clause_Number.Subclause /= 0 then
 	    raise Program_Error;
 	end if;
-	if (Level /= Subclause and then Level /= Clause and then
-	    Level /= Unnumbered_Section) and then
-	   Clause_Number /= 0 then
+	if (Level /= Subsubclause and then Level /= Subclause and then
+	    Level /= Clause and then Level /= Unnumbered_Section) and then
+	   Clause_Number.Clause /= 0 then
 	    raise Program_Error;
 	end if;
 	Last_Title := Last_Title + 1;
@@ -94,31 +138,32 @@
 	    (Title => Title,
 	     Search_Title => Ada.Characters.Handling.To_Lower (Title),
 	     Level => Level,
-	     Section_Number => Section_Number,
 	     Clause_Number => Clause_Number,
-	     Subclause_Number => Subclause_Number,
              Version => Version);
 --Ada.Text_IO.Put_Line ("  Add " & Title &
 -- " Index=" & Natural'Image(Last_Title) & " Level=" & Level_Type'Image(Level));
---Ada.Text_IO.Put_Line ("    Section" & Section_Number_Type'Image(Section_Number) &
--- e(Clause_Number) & " Subclause" & Natural'Image(Subclause_Number));
+--Ada.Text_IO.Put_Line ("    Section" & Section_Number_Type'Image(Clause_Number.Section) &
+-- " Clause" & Natural'Image(Clause_Number.Clause) & " Subclause" & Natural'Image(Clause_Number.Subclause) &
+-- " Subsubclause" & Natural'Image(Clause_Number.Subsubclause));
     end Add;
 
 
     procedure Add_Old (Old_Title : in Title_Type;
 		       Level : in Level_Type;
-		       Section_Number : in Section_Number_Type;
-		       Clause_Number : in Natural := 0;
-		       Subclause_Number : in Natural := 0) is
+		       Clause_Number : in Clause_Number_Type) is
 	-- Add an old title for a section or clause to the contents. It has
 	-- the specified characteristics.
     begin
-	if Level /= Subclause and then Subclause_Number /= 0 then
+	if Level /= Subsubclause and then Clause_Number.Subsubclause /= 0 then
+	    raise Program_Error;
+	end if;
+	if Level /= Subsubclause and then
+	   Level /= Subclause and then Clause_Number.Subclause /= 0 then
 	    raise Program_Error;
 	end if;
-	if (Level /= Subclause and then Level /= Clause and then
-	    Level /= Unnumbered_Section) and then
-	   Clause_Number /= 0 then
+	if (Level /= Subsubclause and then Level /= Subclause and then
+	    Level /= Clause and then Level /= Unnumbered_Section) and then
+	   Clause_Number.Clause /= 0 then
 	    raise Program_Error;
 	end if;
 	Last_Old_Title := Last_Old_Title + 1;
@@ -126,119 +171,140 @@
 	    (Title => Old_Title,
 	     Search_Title => Ada.Characters.Handling.To_Lower (Old_Title),
 	     Level => Level,
-	     Section_Number => Section_Number,
 	     Clause_Number => Clause_Number,
-	     Subclause_Number => Subclause_Number,
              Version => '0');
 --Ada.Text_IO.Put_Line ("  Add_Old " & Old_Title &
 -- " Index=" & Natural'Image(Last_Old_Title) & " Level=" & Level_Type'Image(Level));
 --Ada.Text_IO.Put_Line ("    Section" & Section_Number_Type'Image(Section_Number) &
--- e(Clause_Number) & " Subclause" & Natural'Image(Subclause_Number));
+-- " Clause" & Natural'Image(Clause_Number.Clause) & " Subclause" & Natural'Image(Clause_Number.Subclause) &
+-- " Subsubclause" & Natural'Image(Clause_Number.Subsubclause));
     end Add_Old;
 
 
     function Make_Clause_Number (Level : in Level_Type;
-		   Section_Number : in Section_Number_Type;
-		   Clause_Number : in Natural := 0;
-		   Subclause_Number : in Natural := 0) return String is
+		   Clause_Number : in Clause_Number_Type) return String is
 	-- Returns a properly formatted Section or clause number reference.
     begin
 	case Level is
 	    when Normative_Annex | Informative_Annex =>
-		if Clause_Number /= 0 or else Subclause_Number /= 0 or else
-		   Section_Number <= 20 then
+		if Clause_Number.Clause /= 0 or else Clause_Number.Subclause /= 0 or else
+		   Clause_Number.Subsubclause /= 0 or else Clause_Number.Section <= 30 then
 		    raise Program_Error; -- Illegal numbers.
 		end if;
-		return "Annex " & Character'Val (Character'Pos('A') + (Section_Number - 21));
+		return "Annex " & Character'Val (Character'Pos('A') + (Clause_Number.Section - ANNEX_START));
 	    when Section =>
-		if Clause_Number /= 0 or else Subclause_Number /= 0 or else
-		   Section_Number > 20 then
+		if Clause_Number.Clause /= 0 or else Clause_Number.Subclause /= 0 or else
+		   Clause_Number.Section >= ANNEX_START then
 		    raise Program_Error; -- Illegal numbers.
 		end if;
-		if Section_Number < 10 then
-		    return Character'Val (Character'Pos('0') + Section_Number) & "";
-		elsif Section_Number < 20 then
-		    return "1" & Character'Val (Character'Pos('0') + Section_Number - 10);
+		if Clause_Number.Section < 10 then
+		    return Character'Val (Character'Pos('0') + Clause_Number.Section) & "";
+		elsif Clause_Number.Section < 20 then
+		    return "1" & Character'Val (Character'Pos('0') + Clause_Number.Section - 10);
+		elsif Clause_Number.Section < 30 then
+		    return "2" & Character'Val (Character'Pos('0') + Clause_Number.Section - 20);
 		else
-		    return "2" & Character'Val (Character'Pos('0') + Section_Number - 20);
+		    return "3" & Character'Val (Character'Pos('0') + Clause_Number.Section - 30);
 		end if;
 	    when Unnumbered_Section =>
-		if Clause_Number = 0 or else Subclause_Number /= 0 or else
-		   Section_Number /= 0 then
+		if Clause_Number.Clause = 0 or else Clause_Number.Subclause /= 0 or else
+		   Clause_Number.Section /= 0 then
 		    raise Program_Error; -- Illegal numbers.
 		end if;
-	        if Clause_Number < 10 then
-		    return "0." & Character'Val (Character'Pos('0') + Clause_Number);
-	        elsif Clause_Number < 20 then
-		    return "0.1" & Character'Val (Character'Pos('0') + Clause_Number - 10);
+	        if Clause_Number.Clause < 10 then
+		    return "0." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+	        elsif Clause_Number.Clause < 20 then
+		    return "0.1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
+	        elsif Clause_Number.Clause < 30 then
+		    return "0.2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
 	        else
-		    return "0.2" & Character'Val (Character'Pos('0') + Clause_Number - 20);
+		    return "0.3" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 30);
 	        end if;
 	    when Clause =>
-		if Subclause_Number /= 0 then
+		if Clause_Number.Subclause /= 0 then
 		    raise Program_Error; -- Illegal number.
 		end if;
-		if Section_Number < 10 then
-		    if Clause_Number < 10 then
-		        return Character'Val (Character'Pos('0') + Section_Number) &
-		            "." & Character'Val (Character'Pos('0') + Clause_Number);
-		    elsif Clause_Number < 20 then
-		        return Character'Val (Character'Pos('0') + Section_Number) &
-		            ".1" & Character'Val (Character'Pos('0') + Clause_Number - 10);
+		if Clause_Number.Section < 10 then
+		    if Clause_Number.Clause < 10 then
+		        return Character'Val (Character'Pos('0') + Clause_Number.Section) &
+		            "." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+		    elsif Clause_Number.Clause < 20 then
+		        return Character'Val (Character'Pos('0') + Clause_Number.Section) &
+		            ".1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
+		    else
+		        return Character'Val (Character'Pos('0') + Clause_Number.Section) &
+		            ".2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
+		    end if;
+		elsif Clause_Number.Section < 20 then
+		    if Clause_Number.Clause < 10 then
+		        return "1" & Character'Val (Character'Pos('0') + Clause_Number.Section - 10) &
+		            "." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+		    elsif Clause_Number.Clause < 20 then
+		        return "1" & Character'Val (Character'Pos('0') + Clause_Number.Section - 10) &
+		            ".1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
 		    else
-		        return Character'Val (Character'Pos('0') + Section_Number) &
-		            ".2" & Character'Val (Character'Pos('0') + Clause_Number - 20);
+		        return "1" & Character'Val (Character'Pos('0') + Clause_Number.Section - 10) &
+		            ".2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
 		    end if;
-		elsif Section_Number < 20 then
-		    if Clause_Number < 10 then
-		        return "1" & Character'Val (Character'Pos('0') + Section_Number - 10) &
-		            "." & Character'Val (Character'Pos('0') + Clause_Number);
-		    elsif Clause_Number < 20 then
-		        return "1" & Character'Val (Character'Pos('0') + Section_Number - 10) &
-		            ".1" & Character'Val (Character'Pos('0') + Clause_Number - 10);
+		elsif Clause_Number.Section < 30 then
+		    if Clause_Number.Clause < 10 then
+		        return "2" & Character'Val (Character'Pos('0') + Clause_Number.Section - 20) &
+		            "." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+		    elsif Clause_Number.Clause < 20 then
+		        return "2" & Character'Val (Character'Pos('0') + Clause_Number.Section - 20) &
+		            ".1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
 		    else
-		        return "1" & Character'Val (Character'Pos('0') + Section_Number - 10) &
-		            ".2" & Character'Val (Character'Pos('0') + Clause_Number - 20);
+		        return "2" & Character'Val (Character'Pos('0') + Clause_Number.Section - 20) &
+		            ".2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
 		    end if;
-		elsif Section_Number = 20 then
-		    if Clause_Number < 10 then
-		        return "20." & Character'Val (Character'Pos('0') + Clause_Number);
-		    elsif Clause_Number < 20 then
-		        return "20.1" & Character'Val (Character'Pos('0') + Clause_Number - 10);
+		elsif Clause_Number.Section = 30 then
+		    if Clause_Number.Clause < 10 then
+		        return "30." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+		    elsif Clause_Number.Clause < 20 then
+		        return "30.1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
 		    else
-		        return "20.2" & Character'Val (Character'Pos('0') + Clause_Number - 20);
+		        return "30.2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
 		    end if;
 		else
-		    if Clause_Number < 10 then
-			return Character'Val (Character'Pos('A') + (Section_Number - 21)) &
-		            "." & Character'Val (Character'Pos('0') + Clause_Number);
-		    elsif Clause_Number < 20 then
-			return Character'Val (Character'Pos('A') + (Section_Number - 21)) &
-		            ".1" & Character'Val (Character'Pos('0') + Clause_Number - 10);
+		    if Clause_Number.Clause < 10 then
+			return Character'Val (Character'Pos('A') + (Clause_Number.Section - ANNEX_START)) &
+		            "." & Character'Val (Character'Pos('0') + Clause_Number.Clause);
+		    elsif Clause_Number.Clause < 20 then
+			return Character'Val (Character'Pos('A') + (Clause_Number.Section - ANNEX_START)) &
+		            ".1" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 10);
 		    else
-			return Character'Val (Character'Pos('A') + (Section_Number - 21)) &
-		            ".2" & Character'Val (Character'Pos('0') + Clause_Number - 20);
+			return Character'Val (Character'Pos('A') + (Clause_Number.Section - ANNEX_START)) &
+		            ".2" & Character'Val (Character'Pos('0') + Clause_Number.Clause - 20);
 		    end if;
 		end if;
 	    when Subclause =>
-		if Subclause_Number < 10 then
-		    return Make_Clause_Number (Clause, Section_Number, Clause_Number) &
-		        "." & Character'Val (Character'Pos('0') + Subclause_Number);
-		elsif Subclause_Number < 20 then
-		    return Make_Clause_Number (Clause, Section_Number, Clause_Number) &
-		        ".1" & Character'Val (Character'Pos('0') + Subclause_Number - 10);
+		if Clause_Number.Subclause < 10 then
+		    return Make_Clause_Number (Clause, (Clause_Number.Section, Clause_Number.Clause, 0, 0)) &
+		        "." & Character'Val (Character'Pos('0') + Clause_Number.Subclause);
+		elsif Clause_Number.Subclause < 20 then
+		    return Make_Clause_Number (Clause, (Clause_Number.Section, Clause_Number.Clause, 0, 0)) &
+		        ".1" & Character'Val (Character'Pos('0') + Clause_Number.Subclause - 10);
 		else
-		    return Make_Clause_Number (Clause, Section_Number, Clause_Number) &
-		        ".2" & Character'Val (Character'Pos('0') + Subclause_Number - 20);
+		    return Make_Clause_Number (Clause, (Clause_Number.Section, Clause_Number.Clause, 0, 0)) &
+		        ".2" & Character'Val (Character'Pos('0') + Clause_Number.Subclause - 20);
 		end if;
+	    when Subsubclause =>
+		if Clause_Number.Subsubclause < 10 then
+		    return Make_Clause_Number (Subclause, (Clause_Number.Section, Clause_Number.Clause, Clause_Number.Subclause, 0)) &
+		        "." & Character'Val (Character'Pos('0') + Clause_Number.Subsubclause);
+		elsif Clause_Number.Subclause < 20 then
+		    return Make_Clause_Number (Subclause, (Clause_Number.Section, Clause_Number.Clause, Clause_Number.Subclause, 0)) &
+		        ".1" & Character'Val (Character'Pos('0') + Clause_Number.Subsubclause - 10);
+		else
+		    return Make_Clause_Number (Subclause, (Clause_Number.Section, Clause_Number.Clause, Clause_Number.Subclause, 0)) &
+		        ".2" & Character'Val (Character'Pos('0') + Clause_Number.Subsubclause - 20);
+		end if;
 	end case;
     end Make_Clause_Number;
 
 
     procedure Make_Clause (Clause_String : in String;
-			   Section_Number : out Section_Number_Type;
-			   Clause_Number : out Natural;
-			   Subclause_Number : out Natural) is
+			   Clause_Number : out Clause_Number_Type) is
 	-- Returns the clause number for a properly formatted Section or
 	-- clause string.
 
@@ -252,7 +318,7 @@
 		if Clause_String (Clause_String'First) in '0' .. '9' then
 	            return Character'Pos(Clause_String (Clause_String'First)) - Character'Pos('0');
 		else
-	            return Character'Pos(Clause_String (Clause_String'First)) - Character'Pos('A') + 21;
+	            return Character'Pos(Clause_String (Clause_String'First)) - Character'Pos('A') + ANNEX_START;
 		end if;
 	    else
 		Next := Clause_String'First + 3;
@@ -279,35 +345,52 @@
 	if Clause_String'Length = 7 and then
 	   Clause_String (Clause_String'First .. Clause_String'First + 5) =
 	    "Annex " then -- Annex clauses.
-	    Clause_Number := 0;
-	    Subclause_Number := 0;
-	    Section_Number := Character'Pos(Clause_String (Clause_String'First + 6)) - Character'Pos('A') + 21;
+	    Clause_Number :=
+		(Section => Character'Pos(Clause_String (Clause_String'First + 6)) - Character'Pos('A') + ANNEX_START,
+		 Clause | Subclause | Subsubclause => 0);
 	elsif Clause_String'Length = 1 then
-	    Clause_Number := 0;
-	    Subclause_Number := 0;
-	    Section_Number := Get_Section_Number;
+	    Clause_Number :=
+		(Section => Get_Section_Number,
+		 Clause | Subclause | Subsubclause => 0);
 	elsif Clause_String'Length = 2 then
-	    Clause_Number := 0;
-	    Subclause_Number := 0;
-	    Section_Number := Get_Section_Number;
+	    Clause_Number :=
+		(Section => Get_Section_Number,
+		 Clause | Subclause | Subsubclause => 0);
 	else
-	    Section_Number := Get_Section_Number;
+	    Clause_Number :=
+		(Section => Get_Section_Number,
+		 Clause | Subclause | Subsubclause => 0);
 	    -- Next is now the start of the Clause:
 	    if Clause_String'Last - Next + 1 = 1 then
-	        Clause_Number := Get_Clause_Number;
-	        Subclause_Number := 0;
+	        Clause_Number.Clause := Get_Clause_Number;
 	    elsif Clause_String'Last - Next + 1 = 2 then
-	        Clause_Number := Get_Clause_Number;
-	        Subclause_Number := 0;
+	        Clause_Number.Clause := Get_Clause_Number;
 	    else
-	        Clause_Number := Get_Clause_Number;
+	        Clause_Number.Clause := Get_Clause_Number;
 		-- Next is now the start of the Subclause:
 	        if Clause_String'Last - Next + 1 = 1 then
-	            Subclause_Number := Character'Pos(Clause_String (Next)) - Character'Pos('0');
-	        else -- Two digit.
-	            Subclause_Number := (Character'Pos(Clause_String (Next)) -
+	            Clause_Number.Subclause := Character'Pos(Clause_String (Next)) - Character'Pos('0');
+	        elsif Clause_String'Last - Next + 1 = 2 then
+	            Clause_Number.Subclause := (Character'Pos(Clause_String (Next)) -
 			Character'Pos('0')) * 10 +
 			    Character'Pos(Clause_String (Next + 1)) - Character'Pos('0');
+		else
+		    if Clause_String'Last - Next + 1 = 1 or else
+			Clause_String(Next + 1) = '.' then
+			Next := Next + 2;
+		        Clause_Number.Subclause := Character'Pos(Clause_String (Next - 2)) - Character'Pos('0');
+		    else
+			Next := Next + 3;
+		        Clause_Number.Subclause := (Character'Pos(Clause_String (Next - 3)) - Character'Pos('0')) * 10 +
+			    Character'Pos(Clause_String (Next - 3 + 1)) - Character'Pos('0');
+		    end if;
+	            if Clause_String'Last - Next + 1 = 1 then
+	                Clause_Number.Subsubclause := Character'Pos(Clause_String (Next)) - Character'Pos('0');
+	            else -- Two digit.
+	                Clause_Number.Subsubclause := (Character'Pos(Clause_String (Next)) -
+			    Character'Pos('0')) * 10 +
+			        Character'Pos(Clause_String (Next + 1)) - Character'Pos('0');
+		    end if;
 		end if;
 	    end if;
 	end if;
@@ -323,9 +406,7 @@
 	for I in 1 .. Last_Title loop
 	    if Lower_Title = Title_List(I).Search_Title then
 		return Make_Clause_Number (Title_List(I).Level,
-					   Title_List(I).Section_Number,
-					   Title_List(I).Clause_Number,
-					   Title_List(I).Subclause_Number);
+					   Title_List(I).Clause_Number);
 	    end if;
 	end loop;
 	raise Not_Found_Error;
@@ -347,17 +428,13 @@
 
 
     function Lookup_Title (Level : in Level_Type;
-		   Section_Number : in Section_Number_Type;
-		   Clause_Number : in Natural := 0;
-		   Subclause_Number : in Natural := 0) return Title_Type is
-	-- Given the level, section, and clause numbers, return the appropriate
+		           Clause_Number : in Clause_Number_Type) return Title_Type is
+	-- Given the level and clause numbers, return the appropriate
 	-- title. Raises Not_Found_Error if not found.
     begin
 	for I in 1 .. Last_Title loop
 	    if Title_List(I).Level = Level and then
-	       Title_List(I).Section_Number = Section_Number and then
-	       Title_List(I).Clause_Number = Clause_Number and then
-	       Title_List(I).Subclause_Number = Subclause_Number then
+	       Title_List(I).Clause_Number = Clause_Number then
 		return Title_List(I).Title;
 	    end if;
 	end loop;
@@ -366,22 +443,18 @@
 
 
     function Lookup_Old_Title (Level : in Level_Type;
-		   Section_Number : in Section_Number_Type;
-		   Clause_Number : in Natural := 0;
-		   Subclause_Number : in Natural := 0) return Title_Type is
-	-- Given the level, section, and clause numbers, return the appropriate
+		   Clause_Number : in Clause_Number_Type) return Title_Type is
+	-- Given the level and clause numbers, return the appropriate
 	-- old title. Calls Lookup_Title if not found (thus returning the
 	-- regular (new) title.
     begin
 	for I in 1 .. Last_Old_Title loop
 	    if Old_Title_List(I).Level = Level and then
-	       Old_Title_List(I).Section_Number = Section_Number and then
-	       Old_Title_List(I).Clause_Number = Clause_Number and then
-	       Old_Title_List(I).Subclause_Number = Subclause_Number then
+	       Old_Title_List(I).Clause_Number = Clause_Number then
 		return Old_Title_List(I).Title;
 	    end if;
 	end loop;
-	return Lookup_Title (Level, Section_Number, Clause_Number, Subclause_Number);
+	return Lookup_Title (Level, Clause_Number);
     end Lookup_Old_Title;
 
 
@@ -389,22 +462,16 @@
 	-- Returns the string of the previous clause (in the table of contents)
 	-- for the properly formatted clause string Clause.
 	-- Raises Not_Found_Error if not found.
-       Section_Number : Section_Number_Type;
-       Clause_Number : Natural;
-       Subclause_Number : Natural;
+        Clause_Number : Clause_Number_Type;
     begin
-	Make_Clause (Clause, Section_Number, Clause_Number, Subclause_Number);
+	Make_Clause (Clause, Clause_Number);
 	for I in 1 .. Last_Title loop
-	    if Title_List(I).Section_Number = Section_Number and then
-	       Title_List(I).Clause_Number = Clause_Number and then
-	       Title_List(I).Subclause_Number = Subclause_Number then
+	    if Title_List(I).Clause_Number = Clause_Number then
 		if I = 1 then
 		    raise Not_Found_Error;
 		else
 		    return Make_Clause_Number (Title_List(I-1).Level,
-					       Title_List(I-1).Section_Number,
-					       Title_List(I-1).Clause_Number,
-					       Title_List(I-1).Subclause_Number);
+					       Title_List(I-1).Clause_Number);
 	        end if;
 	    end if;
 	end loop;
@@ -416,22 +483,16 @@
 	-- Returns the string of the next clause (in the table of contents)
 	-- for the properly formatted clause string Clause.
 	-- Raises Not_Found_Error if not found.
-       Section_Number : Section_Number_Type;
-       Clause_Number : Natural;
-       Subclause_Number : Natural;
+        Clause_Number : Clause_Number_Type;
     begin
-	Make_Clause (Clause, Section_Number, Clause_Number, Subclause_Number);
+	Make_Clause (Clause, Clause_Number);
 	for I in 1 .. Last_Title loop
-	    if Title_List(I).Section_Number = Section_Number and then
-	       Title_List(I).Clause_Number = Clause_Number and then
-	       Title_List(I).Subclause_Number = Subclause_Number then
+	    if Title_List(I).Clause_Number = Clause_Number then
 		if I = Last_Title then
 		    raise Not_Found_Error;
 		else
 		    return Make_Clause_Number (Title_List(I+1).Level,
-					       Title_List(I+1).Section_Number,
-					       Title_List(I+1).Clause_Number,
-					       Title_List(I+1).Subclause_Number);
+					       Title_List(I+1).Clause_Number);
 	        end if;
 	    end if;
 	end loop;
@@ -448,9 +509,7 @@
 	for I in 1 .. Last_Title loop
 	    Operate (Title_List(I).Title,
 		     Title_List(I).Level,
-		     Title_List(I).Section_Number,
 		     Title_List(I).Clause_Number,
-		     Title_List(I).Subclause_Number,
 		     Title_List(I).Version,
 		     Quit);
 	    if Quit then

Questions? Ask the ACAA Technical Agent