Skip to content

Commit

Permalink
Added missing ARM_Paragraph package.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrukardt authored and reznikmm committed Nov 11, 2023
1 parent 93e0ec1 commit 8b22258
Show file tree
Hide file tree
Showing 4 changed files with 616 additions and 3 deletions.
4 changes: 4 additions & 0 deletions progs/arm_frmd.adb
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ package body ARM_Format.Data is
return Permission_Name;
elsif Canonical_Name = "impladvicename" then
return Advice_Name;
elsif Canonical_Name = "usagename" then
return Usage_Name;
elsif Canonical_Name = "notesname" then
return Notes_Name;
elsif Canonical_Name = "singlenotename" then
Expand Down Expand Up @@ -486,6 +488,8 @@ package body ARM_Format.Data is
return Permission_Title;
elsif Canonical_Name = "impladvicetitle" then
return Advice_Title;
elsif Canonical_Name = "usagetitle" then
return Usage_Title;
elsif Canonical_Name = "notestitle" then
return Notes_Title;
elsif Canonical_Name = "singlenotetitle" then
Expand Down
20 changes: 17 additions & 3 deletions progs/arm_html.adb
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ package body ARM_HTML is
-- 2/19/19 - RLB - Added some (commented out) hang tracing.
-- 2/ 4/22 - RLB - Added AI22 links.
-- 8/22/22 - RLB - Added All_Formats parameter to URL_Link.
-- 10/ 9/23 - RLB - Defined change colors for versions 7 and 8.

LINE_LENGTH : constant := 78;
-- Maximum intended line length.
Expand Down Expand Up @@ -1326,9 +1327,22 @@ package body ARM_HTML is
-- else not used, don't generate it.
end if;
if Revision_Used ('6') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert6 {text-decoration: underline; color: rgb(0,102,153) }"); -- Turquiose.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete6 {text-decoration: line-through; color: rgb(0,102,153) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both6 {text-decoration: underline, line-through; color: rgb(0,102,153) }");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert6 {text-decoration: underline; color: rgb(0,51,204) }"); -- Royal blue.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete6 {text-decoration: line-through; color: rgb(0,51,204) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both6 {text-decoration: underline, line-through; color: rgb(0,51,204) }");
-- Both doesn't seem to work, so forget it.
end if;
if Revision_Used ('7') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert7 {text-decoration: underline; color: rgb(0,102,153) }"); -- Turquiose.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete7 {text-decoration: line-through; color: rgb(0,102,153) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both7 {text-decoration: underline, line-through; color: rgb(0,102,153) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('7') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert8 {text-decoration: underline; color: rgb(204,51,0) }"); -- Bright red.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete8 {text-decoration: line-through; color: rgb(204,51,0) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both8 {text-decoration: underline, line-through; color: rgb(204,51,0) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
Expand Down
271 changes: 271 additions & 0 deletions progs/arm_para.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
with Ada.Characters.Handling,
Ada.Strings.Fixed;
package body ARM_Paragraph is

--
-- Ada reference manual formatter (ARM_Form).
--
-- This package contains the types and subprograms to manage paragraph
-- kinds.
--
-- ---------------------------------------
-- Copyright 2022, 2023
-- AXE Consultants. All rights reserved.
-- 621 N. Sherman Ave., Suite B6, Madison WI 53704
-- E-Mail: [email protected]
--
-- ARM_Form is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3
-- as published by the Free Software Foundation.
--
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-- DAMAGES.
--
-- A copy of the GNU General Public License is available in the file
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
-- Otherwise, see <http://www.gnu.org/licenses/>.
--
-- If the GPLv3 license is not satisfactory for your needs, a commercial
-- use license is available for this tool. Contact Randy at AXE Consultants
-- for more information.
--
-- ---------------------------------------
--
-- Edit History:
--
-- 4/13/22 - RLB - Created package, moving Paragraph_Type from ARM_Frm,
-- reorganizing it, and adding subprograms to convert
-- between it and names. Also added Ada 2022 paragraphs.
-- 5/25/22 - RLB - Added Term_Marker.
-- 5/26/22 - RLB - Put Term_Group_Index here as it isn't big enough to
-- justify its own pacakge.
-- 9/11/23 - RLB - Added Usage category.

function Get_Term_Group (Ch : in Character) return Term_Group_Index is
-- Convert a character representing a term grouping into a Term_Group_Index.
-- Raises Program_Error if Ch does not represent a term grouping.
begin
if Ch in '0' .. '9' then
return Term_Group_Index (Character'Pos(Ch) - Character'Pos('0'));
elsif Ch in 'A' .. 'Z' then
return Term_Group_Index (Character'Pos(Ch) - Character'Pos('A') + 10);
elsif Ch in 'a' .. 'z' then
return Term_Group_Index (Character'Pos(Ch) - Character'Pos('a') + 10);
else
raise Program_Error with "Unknown term group - " & Ch;
end if;
end Get_Term_Group;


function Get_Change_Kind (Name : in String) return ARM_Database.Paragraph_Change_Kind_Type is
-- Convert the name of a Change Kind into the appropriate enumeration.
-- Raises Program_Error if Name does not represent a Change Kind.
Clean_Name : constant String :=
Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Name, Ada.Strings.Right));
begin
if Clean_Name = "revised" then
return ARM_Database.Revised;
elsif Clean_Name = "revisedadded" then
return ARM_Database.Revised_Inserted_Number;
elsif Clean_Name = "added" then
return ARM_Database.Inserted;
elsif Clean_Name = "addednormal" then
return ARM_Database.Inserted_Normal_Number;
elsif Clean_Name = "deleted" then
return ARM_Database.Deleted;
elsif Clean_Name = "deletedadded" then
return ARM_Database.Deleted_Inserted_Number;
elsif Clean_Name = "deletednodelmsg" then
return ARM_Database.Deleted_No_Delete_Message;
elsif Clean_Name = "deletedaddednodelmsg" then
return ARM_Database.Deleted_Inserted_Number_No_Delete_Message;
else
raise Program_Error with " ** Bad kind for change kind: " &
Ada.Strings.Fixed.Trim (Name, Ada.Strings.Right);
end if;
end Get_Change_Kind;


function Get_Paragraph_Kind (Name : in ARM_Input.Command_Name_Type)
return Paragraph_Type is
-- For the given name, return the Paragraph_Type. If Name matches
-- no known paragraph type, return Unknown.
Lower_Name : constant String :=
Ada.Characters.Handling.To_Lower (
Ada.Strings.Fixed.Trim (Name, Ada.Strings.Right));
begin
if Lower_Name = "comment" then
return Comment;
elsif Lower_Name = "wideabove" then
return Wide_Above;
elsif Lower_Name = "example" then
return Example_Text;
elsif Lower_Name = "childexample" then
return Child_Example_Text;
elsif Lower_Name = "descexample" then
return Indented_Example_Text;
elsif Lower_Name = "describecode" then
return Code_Indented;
elsif Lower_Name = "indent" then
return Indent;
elsif Lower_Name = "itemize" then
return Bulleted;
elsif Lower_Name = "inneritemize" then
return Nested_Bulleted;
elsif Lower_Name = "innerinneritemize" then
return Nested_X2_Bulleted;
elsif Lower_Name = "display" then
return Display;
elsif Lower_Name = "syntaxdisplay" then
return Syntax_Display;
elsif Lower_Name = "syntaxtext" then
return Syntax_Indented;
elsif Lower_Name = "description" then
return Hanging_Indented_3;
elsif Lower_Name = "small" then
return Small;
elsif Lower_Name = "enumerate" then
return Enumerated;
elsif Lower_Name = "innerenumerate" then
return Nested_Enumerated;
elsif Lower_Name = "hang1list" then
return Hanging_Indented_1;
elsif Lower_Name = "hang2list" then
return Hanging_Indented_2;
elsif Lower_Name = "hang3list" then
return Hanging_Indented_3;
elsif Lower_Name = "hang4list" then
return Hanging_Indented_4;
elsif Lower_Name = "title" then
return Title;

-- RM Groupings:
elsif Lower_Name = "intro" then
return Introduction;
elsif Lower_Name = "syntax" then
return Syntax;
elsif Lower_Name = "resolution" then
return Resolution;
elsif Lower_Name = "legality" then
return Legality;
elsif Lower_Name = "staticsem" then
return Static_Semantics;
elsif Lower_Name = "linktime" then
return Link_Time;
elsif Lower_Name = "runtime" then
return Run_Time;
elsif Lower_Name = "bounded" then
return Bounded_Errors;
elsif Lower_Name = "erron" then
return Erroneous;
elsif Lower_Name = "implreq" then
return Requirements;
elsif Lower_Name = "docreq" then
return Documentation;
elsif Lower_Name = "metrics" then
return Metrics;
elsif Lower_Name = "implperm" then
return Permissions;
elsif Lower_Name = "impladvice" then
return Advice;
elsif Lower_Name = "examples" then
return Examples;
elsif Lower_Name = "usage" then
return Usage;
elsif Lower_Name = "notes" then
return Notes;
elsif Lower_Name = "singlenote" then
return Single_Note;

-- AARM groupings:
elsif Lower_Name = "metarules" then
return Language_Design;
elsif Lower_Name = "inconsistent83" then
return Ada83_Inconsistencies;
elsif Lower_Name = "incompatible83" then
return Ada83_Incompatibilities;
elsif Lower_Name = "extend83" then
return Ada83_Extensions;
elsif Lower_Name = "diffword83" then
return Ada83_Wording;
elsif Lower_Name = "inconsistent95" then
return Ada95_Inconsistencies;
elsif Lower_Name = "incompatible95" then
return Ada95_Incompatibilities;
elsif Lower_Name = "extend95" then
return Ada95_Extensions;
elsif Lower_Name = "diffword95" then
return Ada95_Wording;
elsif Lower_Name = "inconsistent2005" then
return Ada2005_Inconsistencies;
elsif Lower_Name = "incompatible2005" then
return Ada2005_Incompatibilities;
elsif Lower_Name = "extend2005" then
return Ada2005_Extensions;
elsif Lower_Name = "diffword2005" then
return Ada2005_Wording;
elsif Lower_Name = "inconsistent2012" then
return Ada2012_Inconsistencies;
elsif Lower_Name = "incompatible2012" then
return Ada2012_Incompatibilities;
elsif Lower_Name = "extend2012" then
return Ada2012_Extensions;
elsif Lower_Name = "diffword2012" then
return Ada2012_Wording;
elsif Lower_Name = "inconsistent2022" then
return Ada2022_Inconsistencies;
elsif Lower_Name = "incompatible2022" then
return Ada2022_Incompatibilities;
elsif Lower_Name = "extend2022" then
return Ada2022_Extensions;
elsif Lower_Name = "diffword2022" then
return Ada2022_Wording;

-- AARM annotations:
elsif Lower_Name = "discussion" then
return Discussion;
elsif Lower_Name = "reason" then
return Reason;
elsif Lower_Name = "ramification" then
return Ramification;
elsif Lower_Name = "theproof" then
return Proof;
elsif Lower_Name = "implnote" then
return Imp_Note;
elsif Lower_Name = "honest" then
return Honest;
elsif Lower_Name = "glossarymarker" then
return Glossary_Marker;
elsif Lower_Name = "termmarker" then
return Term_Marker;

-- (A)ASIS groupings:
elsif Lower_Name = "elementref" then
return Element_Ref;
elsif Lower_Name = "childref" then
return Child_Ref;
elsif Lower_Name = "usagenote" then
return Usage_Note;

-- Classification kinds:
elsif Lower_Name = "rmonly" then
return RM_Only;
elsif Lower_Name = "aarmonly" then
return AARM_Only;
elsif Lower_Name = "notiso" then
return Not_ISO;
elsif Lower_Name = "isoonly" then
return ISO_Only;

else
-- Dunno what this is, return "Unknown".
return Unknown;
end if;
end Get_Paragraph_Kind;

end ARM_Paragraph;
Loading

0 comments on commit 8b22258

Please sign in to comment.