| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- ADA.STRINGS.TEXT_BUFFERS.UTILS -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2020-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 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. -- |
| 17 |
-- -- |
| 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. -- |
| 21 |
-- -- |
| 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/>. -- |
| 26 |
-- -- |
| 27 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 28 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 29 |
-- -- |
| 30 |
------------------------------------------------------------------------------ |
| 31 |
|
| 32 |
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; |
| 33 |
|
| 34 |
package Ada.Strings.Text_Buffers.Utils with Pure is |
| 35 |
|
| 36 |
-- Ada.Strings.Text_Buffers is a predefined unit (see RM A.4.12). |
| 37 |
-- This is a GNAT-defined child unit of that parent. |
| 38 |
|
| 39 |
subtype Character_7 is |
| 40 |
Character range Character'Val (0) .. Character'Val (2**7 - 1); |
| 41 |
|
| 42 |
procedure Put_7bit |
| 43 |
(Buffer : in out Root_Buffer_Type'Class; Item : Character_7); |
| 44 |
procedure Put_Character |
| 45 |
(Buffer : in out Root_Buffer_Type'Class; Item : Character); |
| 46 |
procedure Put_Wide_Character |
| 47 |
(Buffer : in out Root_Buffer_Type'Class; Item : Wide_Character); |
| 48 |
procedure Put_Wide_Wide_Character |
| 49 |
(Buffer : in out Root_Buffer_Type'Class; Item : Wide_Wide_Character); |
| 50 |
-- Single character output procedures. |
| 51 |
|
| 52 |
function Column (Buffer : Root_Buffer_Type'Class) return Positive with |
| 53 |
Inline; |
| 54 |
-- Current output column. The Column is initially 1, and is incremented for |
| 55 |
-- each 8-bit character output. A call to New_Line sets Column back to 1. |
| 56 |
-- The next character to be output will go in this column. |
| 57 |
|
| 58 |
procedure Tab_To_Column |
| 59 |
(Buffer : in out Root_Buffer_Type'Class; Column : Positive); |
| 60 |
-- Put spaces until we're at or past Column. |
| 61 |
|
| 62 |
subtype Sink is Root_Buffer_Type; |
| 63 |
|
| 64 |
function NL return Character is (ASCII.LF) with Inline; |
| 65 |
|
| 66 |
function UTF_8_Length (Buffer : Root_Buffer_Type'Class) return Natural; |
| 67 |
|
| 68 |
subtype UTF_8_Lines is UTF_Encoding.UTF_8_String with |
| 69 |
Predicate => |
| 70 |
UTF_Encoding.Wide_Wide_Strings.Encode |
| 71 |
(UTF_Encoding.Wide_Wide_Strings.Decode (UTF_8_Lines)) = UTF_8_Lines; |
| 72 |
|
| 73 |
subtype UTF_8 is UTF_8_Lines with |
| 74 |
Predicate => (for all UTF_8_Char of UTF_8 => UTF_8_Char /= NL); |
| 75 |
|
| 76 |
procedure Put_UTF_8_Lines |
| 77 |
(Buffer : in out Root_Buffer_Type'Class; Item : UTF_8_Lines); |
| 78 |
|
| 79 |
private |
| 80 |
function UTF_8_Length (Buffer : Root_Buffer_Type'Class) return Natural |
| 81 |
is (Buffer.UTF_8_Length); |
| 82 |
end Ada.Strings.Text_Buffers.Utils; |