Skip to content

Commit 1ce004f

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents aacfffb + 18f9ad8 commit 1ce004f

File tree

14 files changed

+245
-149
lines changed

14 files changed

+245
-149
lines changed

source/backend/gnatdoc-backend-html.adb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ package body GNATdoc.Backend.HTML is
9191
end if;
9292
end loop;
9393

94-
for Item of Globals.Subprograms loop
95-
if not Is_Private_Entity (Item) then
96-
Index_Entities.Insert (Item);
94+
for Item of Globals.Contain_Subprograms loop
95+
if not Is_Private_Entity
96+
(GNATdoc.Entities.To_Entity (Item.Signature))
97+
then
98+
Index_Entities.Insert
99+
(GNATdoc.Entities.To_Entity (Item.Signature));
97100
end if;
98101
end loop;
99102

@@ -235,9 +238,9 @@ package body GNATdoc.Backend.HTML is
235238
Nested.Union (Entity.Tagged_Types);
236239
Nested.Union (Entity.Access_Types);
237240
Nested.Union (Entity.Subtypes);
238-
Nested.Union (Entity.Constants);
241+
Nested.Union (Entity.Contain_Constants);
239242
Nested.Union (Entity.Variables);
240-
Union (Nested, Entity.Belongs_Subprograms);
243+
Union (Nested, Entity.Belong_Subprograms);
241244
Nested.Union (Entity.Entries);
242245
Nested.Union (Entity.Generic_Instantiations);
243246

@@ -321,14 +324,14 @@ package body GNATdoc.Backend.HTML is
321324
Nested.Union (Entity.Tagged_Types);
322325
Nested.Union (Entity.Access_Types);
323326
Nested.Union (Entity.Subtypes);
324-
Nested.Union (Entity.Constants);
327+
Nested.Union (Entity.Contain_Constants);
325328
Nested.Union (Entity.Variables);
326329

327330
if Self.OOP_Mode then
328-
Union (Nested, Entity.Belongs_Subprograms);
331+
Union (Nested, Entity.Belong_Subprograms);
329332

330333
else
331-
Nested.Union (Entity.Subprograms);
334+
Union (Nested, Entity.Contain_Subprograms);
332335
end if;
333336

334337
Nested.Union (Entity.Entries);

source/backend/odf/gnatdoc-backend-odf.adb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ package body GNATdoc.Backend.ODF is
5959
end if;
6060
end loop;
6161

62-
for Item of GNATdoc.Entities.Globals.Subprograms loop
63-
if not Is_Private_Entity (Item) then
64-
Index_Entities.Insert (Item);
62+
for Item of GNATdoc.Entities.Globals.Contain_Subprograms loop
63+
if not Is_Private_Entity
64+
(GNATdoc.Entities.To_Entity (Item.Signature))
65+
then
66+
Index_Entities.Insert
67+
(GNATdoc.Entities.To_Entity (Item.Signature));
6568
end if;
6669
end loop;
6770

source/backend/rst/gnatdoc-backend-rst-pt.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ package body GNATdoc.Backend.RST.PT is
337337
Constants.Clear;
338338
Methods.Clear;
339339

340-
for Object of Entity.Belongs_Constants loop
340+
for Object of Entity.Belong_Constants loop
341341
if not Is_Private_Entity
342342
(GNATdoc.Entities.To_Entity (Object.Signature))
343343
then
@@ -351,7 +351,7 @@ package body GNATdoc.Backend.RST.PT is
351351
(" ", Object.all, Entity.Qualified_Name, True);
352352
end loop;
353353

354-
for Method of Entity.Belongs_Subprograms loop
354+
for Method of Entity.Belong_Subprograms loop
355355
if not Is_Private_Entity
356356
(GNATdoc.Entities.To_Entity (Method.Signature))
357357
then

source/backend/rst/gnatdoc-backend-rst.adb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ package body GNATdoc.Backend.RST is
415415
Constants.Clear;
416416
Methods.Clear;
417417

418-
for Object of Item.Belongs_Constants loop
418+
for Object of Item.Belong_Constants loop
419419
if not Is_Private_Entity
420420
(GNATdoc.Entities.To_Entity (Object.Signature))
421421
then
@@ -429,7 +429,7 @@ package body GNATdoc.Backend.RST is
429429
(" ", Object.all, Entity.Qualified_Name);
430430
end loop;
431431

432-
for Method of Item.Belongs_Subprograms loop
432+
for Method of Item.Belong_Subprograms loop
433433
if not Is_Private_Entity
434434
(GNATdoc.Entities.To_Entity (Method.Signature))
435435
then
@@ -456,13 +456,14 @@ package body GNATdoc.Backend.RST is
456456

457457
begin
458458
if Self.OOP_Mode then
459-
for Subprogram of Entity.Belongs_Subprograms loop
459+
for Subprogram of Entity.Belong_Subprograms loop
460460
Subprograms.Insert (To_Entity (Subprogram.Signature));
461461
end loop;
462462

463463
else
464-
for Subprogram of Entity.Subprograms loop
465-
Subprograms.Insert (Subprogram);
464+
for Subprogram of Entity.Contain_Subprograms loop
465+
Subprograms.Insert
466+
(GNATdoc.Entities.To_Entity (Subprogram.Signature));
466467
end loop;
467468
end if;
468469

source/backend/test/gnatdoc-backend-test.adb

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ package body GNATdoc.Backend.Test is
224224
Offset := @ - 2;
225225
end if;
226226

227-
if not Entity.Constants.Is_Empty then
227+
if not Entity.Contain_Constants.Is_Empty then
228228
Offset := @ + 2;
229229

230230
Output.Put_Line
@@ -235,15 +235,15 @@ package body GNATdoc.Backend.Test is
235235

236236
Offset := @ + 2;
237237

238-
for E of Entity.Constants loop
238+
for E of Entity.Contain_Constants loop
239239
Dump (E.Reference, Success);
240240
end loop;
241241

242242
Offset := @ - 2;
243243
Offset := @ - 2;
244244
end if;
245245

246-
if not Entity.Subprograms.Is_Empty then
246+
if not Entity.Contain_Subprograms.Is_Empty then
247247
Offset := @ + 2;
248248

249249
Output.Put_Line
@@ -254,15 +254,15 @@ package body GNATdoc.Backend.Test is
254254

255255
Offset := @ + 2;
256256

257-
for E of Entity.Subprograms loop
258-
Dump (E.Reference, Success);
257+
for E of Entity.Contain_Subprograms loop
258+
Dump (E, Success);
259259
end loop;
260260

261261
Offset := @ - 2;
262262
Offset := @ - 2;
263263
end if;
264264

265-
if not Entity.Belongs_Constants.Is_Empty then
265+
if not Entity.Belong_Constants.Is_Empty then
266266
Offset := @ + 2;
267267

268268
Output.Put_Line
@@ -273,15 +273,15 @@ package body GNATdoc.Backend.Test is
273273

274274
Offset := @ + 2;
275275

276-
for R of Entity.Belongs_Constants loop
276+
for R of Entity.Belong_Constants loop
277277
Dump (R, Success);
278278
end loop;
279279

280280
Offset := @ - 2;
281281
Offset := @ - 2;
282282
end if;
283283

284-
if not Entity.Belongs_Subprograms.Is_Empty then
284+
if not Entity.Belong_Subprograms.Is_Empty then
285285
Offset := @ + 2;
286286

287287
Output.Put_Line
@@ -293,15 +293,15 @@ package body GNATdoc.Backend.Test is
293293

294294
Offset := @ + 2;
295295

296-
for R of Entity.Belongs_Subprograms loop
296+
for R of Entity.Belong_Subprograms loop
297297
Dump (R, Success);
298298
end loop;
299299

300300
Offset := @ - 2;
301301
Offset := @ - 2;
302302
end if;
303303

304-
if not Entity.Entities.Is_Empty then
304+
if not Entity.Contain_Entities.Is_Empty then
305305
Offset := @ + 2;
306306

307307
Output.Put_Line
@@ -312,7 +312,7 @@ package body GNATdoc.Backend.Test is
312312

313313
Offset := @ + 2;
314314

315-
for E of Entity.Entities loop
315+
for E of Entity.Contain_Entities loop
316316
Dump (E.all);
317317
end loop;
318318

@@ -370,9 +370,11 @@ package body GNATdoc.Backend.Test is
370370
Summary_Template : constant
371371
VSS.Strings.Templates.Virtual_String_Template :=
372372
"{}{}{}{}{} ({}) '{}'";
373-
373+
Object_Template : constant
374+
VSS.Strings.Templates.Virtual_String_Template :=
375+
" [of '{}']";
374376
begin
375-
Output.Put_Line
377+
Output.Put
376378
(Summary_Template.Format
377379
(VSS.Strings.Formatters.Strings.Image (Offset * ' '),
378380
VSS.Strings.Formatters.Strings.Image
@@ -390,6 +392,16 @@ package body GNATdoc.Backend.Test is
390392
Entity_Kind_Formatters.Image (Entity.Kind),
391393
VSS.Strings.Formatters.Strings.Image (Entity.Signature.Image)),
392394
Success);
395+
396+
if not Entity.Type_Signature.Image.Is_Empty then
397+
Output.Put
398+
(Object_Template.Format
399+
(VSS.Strings.Formatters.Strings.Image
400+
(Entity.Type_Signature.Image)),
401+
Success);
402+
end if;
403+
404+
Output.New_Line (Success);
393405
end Dump_Entity_Summary;
394406

395407
-------------------------

source/backend/xml/gnatdoc-backend-xml.adb

Lines changed: 92 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,87 @@ package body GNATdoc.Backend.XML is
4141
use Line_Count_Formatters;
4242
-- XXX VSS 20251204+ provides it as `VSS.Strings.Formatters.Line_Offsets`.
4343

44-
GNATdoc_Element : constant VSS.Strings.Virtual_String := "gnatdoc";
44+
Formal_Tag : constant VSS.Strings.Virtual_String := "formal";
45+
Function_Tag : constant VSS.Strings.Virtual_String := "function";
46+
Exception_Tag : constant VSS.Strings.Virtual_String := "exception";
47+
Generic_Package_Declaration_Tag : constant VSS.Strings.Virtual_String :=
48+
"generic-package-declaration";
49+
Generic_Package_Instantiation_Tag : constant VSS.Strings.Virtual_String :=
50+
"generic-package-instantiation";
51+
Generic_Subprogram_Instantiation_Tag : constant
52+
VSS.Strings.Virtual_String := "generic-subprogram-instantiation";
53+
GNATdoc_Tag : constant VSS.Strings.Virtual_String := "gnatdoc";
54+
Interface_Type_Tag : constant VSS.Strings.Virtual_String :=
55+
"interface-type";
56+
Named_Number_Tag : constant VSS.Strings.Virtual_String :=
57+
"named-number";
58+
Object_Tag : constant VSS.Strings.Virtual_String := "object";
59+
Package_Body_Tag : constant VSS.Strings.Virtual_String := "package-body";
60+
Package_Declaration_Tag : constant VSS.Strings.Virtual_String :=
61+
"package-declaration";
62+
Procedure_Tag : constant VSS.Strings.Virtual_String := "procedure";
63+
Tagged_Type_Tag : constant VSS.Strings.Virtual_String := "tagged-type";
64+
Type_Tag : constant VSS.Strings.Virtual_String := "type";
65+
66+
function Entity_Tag
67+
(Entity : not null GNATdoc.Entities.Entity_Information_Access)
68+
return VSS.Strings.Virtual_String;
69+
70+
----------------
71+
-- Entity_Tag --
72+
----------------
73+
74+
function Entity_Tag
75+
(Entity : not null GNATdoc.Entities.Entity_Information_Access)
76+
return VSS.Strings.Virtual_String is
77+
begin
78+
case Entity.Kind is
79+
when GNATdoc.Entities.Undefined =>
80+
raise Program_Error with "not classified entity";
81+
82+
when GNATdoc.Entities.Ada_Tagged_Type =>
83+
return Tagged_Type_Tag;
84+
85+
when GNATdoc.Entities.Ada_Interface_Type =>
86+
return Interface_Type_Tag;
87+
88+
when GNATdoc.Entities.Ada_Other_Type =>
89+
return Type_Tag;
90+
91+
when GNATdoc.Entities.Ada_Named_Number =>
92+
return Named_Number_Tag;
93+
94+
when GNATdoc.Entities.Ada_Object =>
95+
return Object_Tag;
96+
97+
when GNATdoc.Entities.Ada_Exception =>
98+
return Exception_Tag;
99+
100+
when GNATdoc.Entities.Ada_Function =>
101+
return Function_Tag;
102+
103+
when GNATdoc.Entities.Ada_Procedure =>
104+
return Procedure_Tag;
105+
106+
when GNATdoc.Entities.Ada_Package_Declaration =>
107+
return Package_Declaration_Tag;
108+
109+
when GNATdoc.Entities.Ada_Package_Body =>
110+
return Package_Body_Tag;
111+
112+
when GNATdoc.Entities.Ada_Formal =>
113+
return Formal_Tag;
114+
115+
when GNATdoc.Entities.Ada_Generic_Package_Declaration =>
116+
return Generic_Package_Declaration_Tag;
117+
118+
when GNATdoc.Entities.Ada_Generic_Package_Instantiation =>
119+
return Generic_Package_Instantiation_Tag;
120+
121+
when GNATdoc.Entities.Ada_Generic_Subprogram_Instantiation =>
122+
return Generic_Subprogram_Instantiation_Tag;
123+
end case;
124+
end Entity_Tag;
45125

46126
--------------
47127
-- Generate --
@@ -70,11 +150,6 @@ package body GNATdoc.Backend.XML is
70150

71151
begin
72152
Attributes.Clear;
73-
Attributes.Insert
74-
(VSS.IRIs.Empty_IRI,
75-
"kind",
76-
VSS.Strings.To_Virtual_String
77-
(GNATdoc.Entities.Entity_Kind'Wide_Wide_Image (Entity.Kind)));
78153
Attributes.Insert
79154
(VSS.IRIs.Empty_IRI,
80155
"location",
@@ -104,17 +179,22 @@ package body GNATdoc.Backend.XML is
104179
(VSS.IRIs.Empty_IRI, "progenitor_types", Signatures.Join (' '));
105180
end if;
106181

182+
if not Entity.Type_Signature.Image.Is_Empty then
183+
Attributes.Insert
184+
(VSS.IRIs.Empty_IRI, "type", Entity.Type_Signature.Image);
185+
end if;
186+
107187
Writer.Start_Element
108-
(GNATdoc_Namespace, "entity", Attributes, Success);
188+
(GNATdoc_Namespace, Entity_Tag (Entity), Attributes, Success);
109189

110190
GNATdoc.Comments.XML_Helpers.Generate
111191
(Entity.Documentation, Writer, Success);
112192

113-
for E of Entity.Entities loop
193+
for E of Entity.Contain_Entities loop
114194
Generate (Writer, E, Success);
115195
end loop;
116196

117-
Writer.End_Element (GNATdoc_Namespace, "entity", Success);
197+
Writer.End_Element (GNATdoc_Namespace, Entity_Tag (Entity), Success);
118198
end Generate;
119199

120200
Writer : aliased VSS.XML.Writers.Pretty.Pretty_XML_Writer;
@@ -141,13 +221,13 @@ package body GNATdoc.Backend.XML is
141221

142222
Attributes.Clear;
143223
Writer.Start_Element
144-
(GNATdoc_Namespace, GNATdoc_Element, Attributes, Success);
224+
(GNATdoc_Namespace, GNATdoc_Tag, Attributes, Success);
145225

146-
for E of GNATdoc.Entities.Globals.Entities loop
226+
for E of GNATdoc.Entities.Globals.Contain_Entities loop
147227
Generate (Writer, E, Success);
148228
end loop;
149229

150-
Writer.End_Element (GNATdoc_Namespace, GNATdoc_Element, Success);
230+
Writer.End_Element (GNATdoc_Namespace, GNATdoc_Tag, Success);
151231

152232
-- Close output file.
153233

0 commit comments

Comments
 (0)