1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- ADA.STRINGS.TEXT_BUFFERS.FORMATTING --
9 -- Copyright (C) 2020-2023, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Ada
.Strings
.Text_Buffers
.Unbounded
;
33 with Ada
.Strings
.Text_Buffers
.Files
;
35 package body Ada
.Strings
.Text_Buffers
.Formatting
is
37 use Ada
.Strings
.Text_Buffers
.Files
;
38 use Ada
.Strings
.Text_Buffers
.Utils
;
41 (S
: in out Root_Buffer_Type
'Class; T
: Template
;
42 X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
: Utils
.UTF_8_Lines
:= "")
44 J
: Positive := T
'First;
45 Used
: array (1 .. 9) of Boolean := [others => False];
47 while J
<= T
'Last loop
60 Increase_Indent
(S
, 1);
62 Decrease_Indent
(S
, 1);
66 Put_UTF_8_Lines
(S
, X1
);
69 Put_UTF_8_Lines
(S
, X2
);
72 Put_UTF_8_Lines
(S
, X3
);
75 Put_UTF_8_Lines
(S
, X4
);
78 Put_UTF_8_Lines
(S
, X5
);
81 Put_UTF_8_Lines
(S
, X6
);
84 Put_UTF_8_Lines
(S
, X7
);
87 Put_UTF_8_Lines
(S
, X8
);
90 Put_UTF_8_Lines
(S
, X9
);
103 pragma Assert
(X1
= "");
106 pragma Assert
(X2
= "");
109 pragma Assert
(X3
= "");
112 pragma Assert
(X4
= "");
115 pragma Assert
(X5
= "");
118 pragma Assert
(X6
= "");
121 pragma Assert
(X7
= "");
124 pragma Assert
(X8
= "");
127 pragma Assert
(X9
= "");
133 X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
: Utils
.UTF_8_Lines
:= "")
134 return Utils
.UTF_8_Lines
136 Buffer
: Unbounded
.Buffer_Type
;
138 Put
(Buffer
, T
, X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
);
139 return Buffer
.Get_UTF_8
;
144 X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
: Utils
.UTF_8_Lines
:= "") is
145 Buffer
: File_Buffer
:= Create_Standard_Output_Buffer
;
147 Put
(Buffer
, T
, X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
);
152 X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
: Utils
.UTF_8_Lines
:= "") is
153 Buffer
: File_Buffer
:= Create_Standard_Error_Buffer
;
155 Put
(Buffer
, T
, X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
, X9
);
158 end Ada
.Strings
.Text_Buffers
.Formatting
;