@@ -125,6 +125,14 @@ package body GNATdoc.Frontend is
125125 Enclosing : not null GNATdoc.Entities.Entity_Information_Access)
126126 with Pre => Node.Kind in Ada_Single_Task_Decl | Ada_Task_Type_Decl;
127127
128+ procedure Process_Protected_Decl
129+ (Node : Basic_Decl'Class;
130+ Name : Defining_Name'Class;
131+ Definition : Protected_Def'Class;
132+ Enclosing : not null GNATdoc.Entities.Entity_Information_Access)
133+ with
134+ Pre => Node.Kind in Ada_Single_Protected_Decl | Ada_Protected_Type_Decl;
135+
128136 procedure Process_Entry_Decl
129137 (Node : Entry_Decl'Class;
130138 Enclosing : not null GNATdoc.Entities.Entity_Information_Access);
@@ -411,16 +419,26 @@ package body GNATdoc.Frontend is
411419
412420 return Over;
413421
414- when Ada_Entry_Decl =>
415- Process_Entry_Decl (Node.As_Entry_Decl, Enclosing);
422+ when Ada_Single_Protected_Decl =>
423+ Process_Protected_Decl
424+ (Node.As_Single_Protected_Decl,
425+ Node.As_Single_Protected_Decl.F_Name,
426+ Node.As_Single_Protected_Decl.F_Definition,
427+ Enclosing);
416428
417429 return Over;
418430
419- when Ada_Single_Protected_Decl
420- | Ada_Protected_Type_Decl
421- | Ada_Protected_Body
422- =>
423- Ada.Text_IO.Put_Line (Image (Node));
431+ when Ada_Protected_Type_Decl =>
432+ Process_Protected_Decl
433+ (Node.As_Protected_Type_Decl,
434+ Node.As_Protected_Type_Decl.F_Name,
435+ Node.As_Protected_Type_Decl.F_Definition,
436+ Enclosing);
437+
438+ return Over;
439+
440+ when Ada_Entry_Decl =>
441+ Process_Entry_Decl (Node.As_Entry_Decl, Enclosing);
424442
425443 return Over;
426444
@@ -930,6 +948,44 @@ package body GNATdoc.Frontend is
930948 end if ;
931949 end Process_Private_Type_Def ;
932950
951+ -- --------------------------
952+ -- Process_Protected_Decl --
953+ -- --------------------------
954+
955+ procedure Process_Protected_Decl
956+ (Node : Basic_Decl'Class;
957+ Name : Defining_Name'Class;
958+ Definition : Protected_Def'Class;
959+ Enclosing : not null GNATdoc.Entities.Entity_Information_Access)
960+ is
961+ Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
962+ new GNATdoc.Entities.Entity_Information'
963+ (Name => To_Virtual_String (Name.F_Name.Text),
964+ Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
965+ Signature => Signature (Name),
966+ Enclosing =>
967+ Signature (Node.P_Parent_Basic_Decl.P_Defining_Name),
968+ Is_Private =>
969+ (Node.Parent.Kind = Ada_Library_Item
970+ and then Node.Parent.As_Library_Item.F_Has_Private),
971+ Documentation => Extract (Node, GNATdoc.Options.Extractor_Options),
972+ others => <>);
973+
974+ begin
975+ Enclosing.Protected_Types.Insert (Entity);
976+ GNATdoc.Entities.To_Entity.Insert (Entity.Signature, Entity);
977+
978+ if GNATdoc.Entities.Globals'Access /= Enclosing then
979+ GNATdoc.Entities.Globals.Protected_Types.Insert (Entity);
980+ end if ;
981+
982+ Process_Children (Definition.F_Public_Part, Entity);
983+
984+ if GNATdoc.Options.Frontend_Options.Generate_Private then
985+ Process_Children (Definition.F_Private_Part, Entity);
986+ end if ;
987+ end Process_Protected_Decl ;
988+
933989 -- ---------------------------
934990 -- Process_Record_Type_Def --
935991 -- ---------------------------
@@ -1066,8 +1122,9 @@ package body GNATdoc.Frontend is
10661122 | Ada_Subtype_Decl
10671123 | Ada_Exception_Decl
10681124 | Ada_Single_Task_Type_Decl | Ada_Task_Type_Decl
1125+ | Ada_Single_Protected_Decl | Ada_Protected_Type_Decl
10691126 | Ada_Entry_Decl
1070- =>
1127+ =>
10711128 null ;
10721129
10731130 when others =>
0 commit comments