gnoga_2.1.2_5f127c56/deps/zanyblue/src/text/zanyblue-text.ads

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
--  -*- coding: utf-8 -*-
--
--  ZanyBlue, an Ada library and framework for finite element analysis.
--
--  Copyright (c) 2012, 2017, Michael Rohan <mrohan@zanyblue.com>
--  All rights reserved.
--
--  Redistribution and use in source and binary forms, with or without
--  modification, are permitted provided that the following conditions
--  are met:
--
--    * Redistributions of source code must retain the above copyright
--      notice, this list of conditions and the following disclaimer.
--
--    * Redistributions in binary form must reproduce the above copyright
--      notice, this list of conditions and the following disclaimer in the
--      documentation and/or other materials provided with the distribution.
--
--    * Neither the name of ZanyBlue nor the names of its contributors may
--      be used to endorse or promote products derived from this software
--      without specific prior written permission.
--
--  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
--  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
--  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
--  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
--  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
--  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
--  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
--  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
--  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
--  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--

with Ada.Containers;
with UXStrings.Text_IO;

package ZanyBlue.Text is

   No_Such_Facility_Error : exception;
   --  Exception raised when accessing a message associated with an undefined
   --  facility.  The name of the unknown facility (or index, if accessing the
   --  message data by indexes) is included as an exception message.

   No_Such_Key_Error : exception;
   --  The exception raised when attempting to query for an unknown key value.
   --  The facility and key values separated by a '/' character are included
   --  in the exception message.  These are index values if accessing the
   --  message data by index.

   No_Such_Locale_Error : exception;
   --  The locale supplied is not referenced in the catalog.  This exception
   --  does not indiciate the locale is an invalid locale name.

   No_Such_Message_Error : exception;
   --  The exception raised when a message cannot be found for a particular
   --  facility, key and local triple, e.g., the key exists in some locale
   --  for the facility but not in the locale required.  The facility and
   --  key values separated by a '/' character are included in the exception
   --  message.  Again, these are index values if accessing the message data
   --  by index.

   No_Such_Argument_Error : exception;
   --  This exception is raised when formatting a message that includes a
   --  reference to an argument beyond the set supplied by the user, e.g.,
   --  referencing argument number 5 when only 2 arguments were supplied.
   --  If formatting exceptions are disabled, then the a reference to the
   --  argument number is included in the formatted string.

   Invalid_Format_Error : exception;
   --  This exception is raised if the format string includes syntax errors
   --  wrt the micro-grammar for references, e.g., an argument reference
   --  does not have a corresponding closing '}'.

   Internal_Error : exception;
   --  The exception raised when an inconsistency is detected and represents
   --  a bug in the implementation.

   Unicode_Escape_Error : exception;
   --  The exception raised when processing Unicode escape sequences in a
   --  string that do not contain hexadecimal values, e.g., "\u00xy" would
   --  raise this error.  The exception is raised with the character that
   --  is not a hexadecimal character.  It can also be raised in the context
   --  of loading a properties file, in which case the exception is raised
   --  with the file name, line number and offending character as colon
   --  separated arguments.

   Unicode_Format_Error : exception;
   --  The exception raised when a Unicode escaped string is converted to
   --  a String.

   Duplicate_Key_Error : exception;
   --  This exception is raised when a duplicate key definition is encountered
   --  when processing .properties file.  The exception is raised with the
   --  file name, the duplicate key value, the line number for the duplicate
   --  definition and the line number for the original definition as colon
   --  separated arguments, e.g., "myfile.properties:0001: 10: 5".

   Unsupported_Radix_Error : exception;
   --  When formatting floating point values, the value needs to be inspected.
   --  The inspection support machine radix values of 2, 4, 8 or 16.  This
   --  execption is raised if executed on a system that uses a different value.

   Internal_Container_Error : exception;
   --  Internally, the Text library used the Ada.Containers types to store
   --  the message data.  There are some conditions where errors might be
   --  indicated by the Containers library.  If these errors occurs this
   --  exception is raised.  These conditions are all in the category of
   --  "should never happen", e.g., a failure to get after a successful
   --  lookup.

   Pool_Size_Mismatch_Error : exception;
   --  The "zbmcompile" utility compiles messages into Ada sources.  The
   --  string data is accumulated and eventually written to an Ada source
   --  file as the value of a Pool string.  If this string contains non-Latin
   --  characters, the compilation must use options that allow non-Latin
   --  source character, e.g., "-gnatW8" for GNAT.  If not given, the non-Latin
   --  characters are interpreted as two individual characters increasing the
   --  size of the Pool.  If the compiled length of the Pool does not match
   --  length generated by the "zbmcompile" utility, this exception is raised.

   Invalid_Static_Message_Error : exception;
   --  Internal error

   Multiple_Pools_Error : exception;
   --  Internal error

   type Constant_String_Access is access constant String;

   type Constant_String_List is
     array (Positive range <>) of Constant_String_Access;

   type Static_Message_Pool_Type is access constant String;

   function Files_Differ
     (Left_File_Name  : String;
      Right_File_Name : String)
      return Boolean;
   --  Determine if the contents of two files differ.

   function Wide_Hash
     (Key : String)
      return Ada.Containers.Hash_Type;
   --  Return the container hash value for a wide string.  Simply use the
   --  standard String hash function on the UTF8 encoded value.

--     function To_Wide_String
--       (S : String)
--        return String renames Ada.Characters.Conversions.To_Wide_String;
--     --  Utility name to convert a String to String

   procedure Wide_Create_For_Update
     (File : in out UXStrings.Text_IO.File_Type;
      Name :        String);
   --  Create a file.  The file created is a temporary file that is renamed
   --  to the target file on close using Close_And_Update.  The renaming
   --  only occurs if the file contents have changed.  These routines are
   --  used when generating source code: only create a new version of a file
   --  if the contents have changed.

   procedure Close_And_Update
     (File    : in out UXStrings.Text_IO.File_Type;
      Updated :    out Boolean);
   --  Close the file and rename to the base name if the contents of the file
   --  have changed.

end ZanyBlue.Text;