CVS difference for arm/progs/arm_frm.adb

Differences between 1.83 and version 1.84
Log of other versions for file arm/progs/arm_frm.adb

--- arm/progs/arm_frm.adb	2019/01/28 04:38:34	1.83
+++ arm/progs/arm_frm.adb	2019/02/20 05:03:08	1.84
@@ -21,7 +21,7 @@
     --
     -- ---------------------------------------
     -- Copyright 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-    --           2010, 2011, 2012, 2013, 2016, 2017
+    --           2010, 2011, 2012, 2013, 2016, 2017, 2019
     -- AXE Consultants. All rights reserved.
     -- P.O. Box 1512, Madison WI  53701
     -- E-Mail: randy@rrsoftware.com
@@ -286,6 +286,7 @@
     --  7/21/17 - RLB - Changed maximum prefix length.
     --  1/27/19 - RLB - Added code to deal with attribute references where
     --			the paragraph is closed.
+    --  2/15/19 - RLB - Improved handling os deleted attribute references.
 
     type Command_Kind_Type is (Normal, Begin_Word, Parameter);
 
@@ -2139,7 +2140,8 @@
 			-- Nothing at all should be showm.
 			-- ** Warning ** If we lie here, the program will crash!
 		        Format_Object.No_Start_Paragraph := True;
-Ada.Text_IO.Put_Line("    -- No Start Paragraph (DelNoMsg)");
+Ada.Text_IO.Put_Line ("    -- No Start Paragraph (DelNoMsg)");
+Ada.Text_IO.Put_Line ("       Skipped number " & Format_Object.Current_Paragraph_String (1 .. Format_Object.Current_Paragraph_Len));
 		    else
 		        ARM_Output.Start_Paragraph (Output_Object,
 					            Style     => Format_Object.Style,
@@ -4099,7 +4101,8 @@
 		    -- For Part, we don't use the information contained,
 		    -- but it would help a human reader.
 		    ARM_Input.Skip_until_Close_Char (Input_Object,
-			Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char);
+			Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char,
+			Exit_on_Para_End => False);
 		    Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1;
 		        -- Remove the "comment" or "part" record.
 
@@ -8284,7 +8287,8 @@
 		when Change_Note =>
 		    -- Skip the contents of this command.
 	            ARM_Input.Skip_until_Close_Char (Input_Object,
-			Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char);
+			Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char,
+			Exit_on_Para_End => False);
 		    Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1;
 		        -- Remove the "Change_Note" record.
 
@@ -8337,7 +8341,8 @@
 		     -- @ChgAttribute{Version=[<version>], Kind=(<kind>),
 		     --    Chginannex=[T|F],Leading=[T|F],
 		     --    Prefix=<Prefix>,AttrName=<Name>,
-		     --    {[A]Ref=[<DR_Number>]},Text=<Text>}
+		     --    {[A]Ref=[<DR_Number>],}
+		     --	   [InitialVersion=[<>],][OmitAnnex=[T|F],]Text=<Text>}
 		     -- Defines a changed attribute.
 		    declare
 			Close_Ch : Character;
@@ -8347,6 +8352,7 @@
 			Kind : ARM_Database.Paragraph_Change_Kind_Type;
 			Version : ARM_Contents.Change_Version_Type;
 			InitialVersion : ARM_Contents.Change_Version_Type;
+			Omit_from_Annex : Boolean := False;
 			Display_Ref : Boolean;
 			References : Reference_Ptr := null;
 
@@ -8387,6 +8393,12 @@
 		    begin
 			Check_End_Paragraph; -- This is always a paragraph end.
 
+			-- No NoPrefix should carry into here (there is always
+			-- a hanging item here):
+			Format_Object.No_Prefix := False;
+			    -- This shouldn't happen, but if it does, just get
+			    -- rid of it rather than crashing.
+
 			Get_Change_Version (Is_First => True,
 			    Version => Version);
 			    -- Read a parameter named "Version".
@@ -8477,7 +8489,8 @@
 			            Param_Name_1 => "Ref" & (4..ARM_Input.Command_Name_Type'Last => ' '),
 			            Param_Name_2 => "ARef" & (5..ARM_Input.Command_Name_Type'Last => ' '),
 			            Param_Name_3 => "InitialVersion" & (15..ARM_Input.Command_Name_Type'Last => ' '),
-			            Param_Name_4 => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '),
+			            Param_Name_4 => "OmitAnnex" & (10..ARM_Input.Command_Name_Type'Last => ' '),
+			            Param_Name_5 => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '),
 			            Is_First => False,
 			            Param_Found => Which_Param,
 			            Param_Close_Bracket => Close_Ch);
@@ -8540,6 +8553,24 @@
 				            ARM_Input.Line_String (Input_Object));
 				        ARM_Input.Replace_Char (Input_Object);
 			            end if;
+			        elsif Which_Param = 4 and then Close_Ch /= ' ' then
+			            -- Found OmitAnnex
+			            ARM_Input.Get_Char (Input_Object, Ch);
+				    case Ch is
+					when 'F' | 'f' | 'N' | 'n' =>
+					    Omit_from_Annex := False;
+					when 'T' | 't' | 'Y' | 'y' =>
+					    Omit_from_Annex := True;
+					when others =>
+					    Ada.Text_IO.Put_Line ("  ** Bad value for boolean parameter OmitAnnex on line " &
+						" on line " & ARM_Input.Line_String (Input_Object));
+				    end case;
+			            ARM_Input.Get_Char (Input_Object, Ch);
+			            if Ch /= Close_Ch then
+				        Ada.Text_IO.Put_Line ("  ** Bad close for OmitAnnex parameter on line " &
+				            ARM_Input.Line_String (Input_Object));
+				        ARM_Input.Replace_Char (Input_Object);
+			            end if;
 			        else
 				    exit; -- We found "Text" (or an error)
 			        end if;
@@ -8549,30 +8580,20 @@
 --**Debug:
 --Ada.Text_IO.Put_Line ("ChgAttr on line " & ARM_Input.Line_String (Input_Object) &
 --   "; Vers=" & Version & "; InitVer=" & InitialVersion & "; Kind=" & ARM_Database.Paragraph_Change_Kind_Type'Image(Format_Object.Attr_Change_Kind));
+--Ada.Text_IO.Put_Line ("  Omit=" & Boolean'Image(Omit_from_Annex));
 			if ARM_Database."/=" (Format_Object.Attr_Change_Kind, ARM_Database.None) then
 			    Format_Object.Attr_Initial_Version := InitialVersion;
+			    Format_Object.Attr_Omit := Omit_from_Annex;
 			-- else ChginAnnex is False, don't care about this.
 			end if;
 
 			-- How the prefix (attribute name) is handled depends
-			-- only on the InitialVersion and its relationship
-			-- to the version we're generating. It does *not*
-			-- depend on the (current) change kind.
-
-			if InitialVersion = '0' then
-			    -- Original version, never an insertion.
-			    Make_Attribute_Text;
-			    if Close_Ch /= ' ' then
-			        -- Now, handle the parameter:
-			        -- The text goes to the file *and* is recorded.
-			        Arm_Input.Start_Recording (Input_Object);
-			        -- Stack the parameter so we can process the end:
-			        Set_Nesting_for_Parameter
-			            (Command => Attribute_Text_Param,
-				     Close_Ch => Close_Ch);
-			    end if;
+			-- primarily on the InitialVersion and its relationship
+			-- to the version we're generating. It only depends on
+			-- the (current) change kind to determine whether the
+			-- item is deleted (it is treated as inserted otherwise).
 
-		        elsif Close_Ch /= ' ' then -- All other cases.
+		        if Close_Ch /= ' ' then -- We have a parameter:
 
 			    -- Stack the parameter so we can process the end:
 			    Set_Nesting_for_Parameter
@@ -8580,38 +8601,101 @@
 				 Close_Ch => Close_Ch);
 
 			    declare
-				Disposition : ARM_Output.Change_Type;
+				Insert_Disposition : ARM_Output.Change_Type;
+				Delete_Disposition : ARM_Output.Change_Type;
 				use type ARM_Output.Change_Type;
 			    begin
+				-- First, we calculate the insertion
+				-- disposition. This only depends upon the
+				-- original number and what we're generating:
+				if InitialVersion = '0' then -- Original,
+							     -- never inserted.
+				    Insert_Disposition := ARM_Output.None;
+				else
+			            Calc_Change_Disposition (
+				        Format_Object => Format_Object,
+				        Version   => InitialVersion,
+				        Operation => ARM_Output.Insertion,
+				        Text_Kind => Insert_Disposition);
+				end if;
 
-			        Calc_Change_Disposition (
-				    Format_Object => Format_Object,
-				    Version   => InitialVersion,
-				    Operation => ARM_Output.Insertion,
-				    Text_Kind => Disposition);
+				if (ARM_Database."=" (Kind, ARM_Database.Deleted_No_Delete_Message) or else
+				    ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message) or else
+				    ARM_Database."=" (Kind, ARM_Database.Deleted) or else
+				    ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number)) then
+				    -- The current version is some sort of delete:
+			            Calc_Change_Disposition (
+				        Format_Object => Format_Object,
+				        Version   => Version,
+				        Operation => ARM_Output.Deletion,
+				        Text_Kind => Delete_Disposition);
+				else
+				    Delete_Disposition := ARM_Output.None;
+				end if;
 
-			        if Disposition = Do_Not_Display_Text then
-			            -- Skip the text:
+
+			        if Delete_Disposition = Do_Not_Display_Text or else
+			           (Delete_Disposition = ARM_Output.None and then
+				    Insert_Disposition = Do_Not_Display_Text) then
+
+				    Check_Paragraph; -- We need to *count* this
+					-- paragraph, lest the numbers get all
+					-- messed up. But we don't want to generate anything.
+			            -- Skip the text: (but only to the end of the first paragraph).
 			            ARM_Input.Skip_until_Close_Char (Input_Object, Close_Ch);
 			            ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up.
 --Ada.Text_IO.Put_Line("--Skip text");
 
-			        elsif Disposition = ARM_Output.None then
+			        elsif Delete_Disposition = ARM_Output.None and then
+				      Insert_Disposition = ARM_Output.None then
 				    -- Display the text normally.
 				    Make_Attribute_Text;
 				    -- Nothing special to do (normal text).
 --Ada.Text_IO.Put_Line("--Normal text");
 
-			        elsif Disposition = ARM_Output.Deletion then
-			            raise Program_Error; -- A deletion inside of an insertion command!
+				else -- We'll need a style change (or there is a horrible error).
 
-			        else -- Insertion.
+				    -- Only the new style depends on the parameters:
+			            if Delete_Disposition = ARM_Output.None and then
+				       Insert_Disposition = ARM_Output.Insertion then -- Normal insertion.
 --Ada.Text_IO.Put_Line("--Insertion");
-				    -- We assume non-empty text and no outer changes;
-				    -- set new change state:
-				    Format_Object.Text_Format.Change := ARM_Output.Insertion;
-				    Format_Object.Text_Format.Version := InitialVersion;
-				    Format_Object.Text_Format.Added_Version := '0';
+				        -- We assume non-empty text and no outer changes;
+				        -- set new change state:
+				        Format_Object.Text_Format.Change := ARM_Output.Insertion;
+				        Format_Object.Text_Format.Version := InitialVersion;
+				        Format_Object.Text_Format.Added_Version := '0';
+			            elsif Delete_Disposition = ARM_Output.Deletion and then
+				          Insert_Disposition = ARM_Output.None then -- Deletion.
+
+--Ada.Text_IO.Put_Line("--Deletion");
+				        -- We assume non-empty text and no outer changes;
+				        -- set new change state:
+				        Format_Object.Text_Format.Change := ARM_Output.Deletion;
+				        Format_Object.Text_Format.Version := Version;
+				        Format_Object.Text_Format.Added_Version := '0';
+
+			            elsif Delete_Disposition = ARM_Output.Deletion and then
+				          Insert_Disposition = ARM_Output.Insertion then -- Both.
+				        Format_Object.Text_Format.Change := ARM_Output.Both;
+				        Format_Object.Text_Format.Version := Version;
+				        Format_Object.Text_Format.Added_Version := InitialVersion;
+
+--Ada.Text_IO.Put_Line("--Both Insert/Delete");
+
+			            elsif Insert_Disposition = ARM_Output.Deletion then
+			                raise Program_Error with "Delete in insert";
+					    -- A deletion inside of an insertion command!
+
+			            elsif Delete_Disposition = ARM_Output.Insertion then
+			                raise Program_Error with "Insert in delete";
+					    -- A insertion inside of a deletion command!
+
+				    else
+Ada.Text_IO.Put_Line ("** Unimplemented disposition on line " & ARM_Input.Line_String (Input_Object) &
+   "Ins=" & ARM_Output.Change_Type'Image(Insert_Disposition) &
+   "Del=" & ARM_Output.Change_Type'Image(Delete_Disposition));
+			                raise Program_Error with "Weird combo";
+				    end if;
 			            Check_Paragraph; -- Change the state *before* outputting the
 						     -- paragraph header, so the AARM prefix is included.
 		                    ARM_Output.Text_Format (Output_Object,
@@ -8625,6 +8709,7 @@
 		                    ARM_Output.Text_Format (Output_Object,
 					                    Format_Object.Text_Format);
 				end if;
+
 			    end;
 
 		            -- The text goes to the file *and* is recorded.
@@ -10065,8 +10150,14 @@
 			-- revision number). We assume that all attributes
 			-- are inserted for their Initial_Version (since it's
 			-- unlikely that we'd delete an attribute).
+
+			if Format_Object.Attr_Omit then
+			    -- We want to omit this entry; typically, this
+			    -- means it is an inserted item that we are moving
+			    -- within the RM.
+			    null;
 
-			if Format_Object.Attr_Initial_Version = '0' then
+			elsif Format_Object.Attr_Initial_Version = '0' then
 			    -- Initial version, not inserted.
 --Ada.Text_IO.Put_Line ("   Attr: Normal initial version");
 				-- Normal reference:
@@ -10158,6 +10249,7 @@
 			        end if;
 			    end;
 			end if;
+			Format_Object.Attr_Name_Len := 0; -- No attribute in progress.
         	    end;
 
 		when Pragma_Syntax | Added_Pragma_Syntax | Deleted_Pragma_Syntax =>

Questions? Ask the ACAA Technical Agent