hac_0.26.0_19beb1f4/src/hat.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
--  HAT - HAC Ada Toolbox
-------------------------
--
--  The HAT package and possible children contains definitions
--  that are useful for HAC in its minimal operating mode.
--
--  HAT is compilable by a "full Ada" compiler like GNAT or ObjectAda,
--  so the HAC programs can be run on both HAC and a full Ada system.
--
--  Another purpose of this specification is to have a document,
--  automatically verified by "full Ada" systems, of the standard types
--  and subprograms available in HAC.
--
--  Furthermore, some items of HAT are used in the HAC virtual machine.
--  See occurrences of "HAT" in HAC.PCode.Interpreter's body.
------------------------
--
--  Legal licensing note:
--
--  Copyright (c) 2020 .. 2022 Gautier de Montmollin
--
--  Permission is hereby granted, free of charge, to any person obtaining a copy
--  of this software and associated documentation files (the "Software"), to deal
--  in the Software without restriction, including without limitation the rights
--  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--  copies of the Software, and to permit persons to whom the Software is
--  furnished to do so, subject to the following conditions:
--
--  The above copyright notice and this permission notice shall be included in
--  all copies or substantial portions of the Software.
--
--  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--  THE SOFTWARE.
--
--  NB: this is the MIT License, as found 12-Sep-2013 on the site
--  http://www.opensource.org/licenses/mit-license.php
--
-------------------------------------------------------------------------------------
--
with Ada.Calendar,
     Ada.Characters.Handling,
     Ada.Command_Line,
     Ada.Directories,
     Ada.Environment_Variables,
     Ada.Numerics,
     Ada.Strings.Unbounded,
     Ada.Text_IO;

with System;

--  Disable GNAT warning: declaration of "=" hides predefined operator.
pragma Warnings ("H");

package HAT is

  -----------------------------------------
  --  Floating-point numeric type: Real  --
  -----------------------------------------

  type Real is digits System.Max_Digits;
  package RIO is new Ada.Text_IO.Float_IO (Real);

  function "**" (F1, F2 : Real) return Real with Inline;

  --  Square Root
  function Sqrt (I : Integer) return Real with Inline;
  function Sqrt (F : Real)    return Real with Inline;

  --  Integer to Character (equivalent to Character'Val (I))
  function Chr (I : Integer)   return Character with Inline;

  --  Character to Integer (equivalent to Character'Pos (C))
  function Ord (C : Character) return Integer with Inline;

  --  Next Character (equivalent to Character'Succ (C))
  function Succ (C : Character) return Character with Inline;

  --  Previous Character (equivalent to Character'Pred (C))
  function Pred (C : Character) return Character with Inline;

  --  Round to an Integer (equivalent to Integer (F))
  function Round (F : Real) return Integer with Inline;

  --  Truncate
  function Trunc (F : Real) return Integer with Inline;

  --  Min & Max
  function Min (I, J : Integer) return Integer renames Integer'Min;
  function Max (I, J : Integer) return Integer renames Integer'Max;
  function Min (F, G : Real)    return Real renames Real'Min;
  function Max (F, G : Real)    return Real renames Real'Max;

  Pi : constant := Ada.Numerics.Pi;

  --  Trigonometric functions w/ arguments in radians
  function Sin    (F : Real) return Real with Inline;
  function Cos    (F : Real) return Real with Inline;
  function Arctan (F : Real) return Real with Inline;

  --  Logarithmic / Exponential functions
  function Log (F : Real) return Real with Inline;
  function Exp (F : Real) return Real with Inline;

  --  Sign function
  function Sgn (I : Integer) return Integer with Inline;
  function Sgn (F : Real)    return Real with Inline;

  -----------------------------
  --  Pseudo-random numbers  --
  -----------------------------

  --  Pseudo-random number in the real range [0, I+1[ , truncated to lowest
  --  integer. For example, Rand (10) returns equiprobable integer values
  --  from 0 to 10 (so, there are 11 possible values).
  function Rand (I : Integer) return Integer;

  --  Pseudo-random number from 0 to 1, uniform.
  function Rnd return Real;

  procedure Randomize;
  procedure Random_Seed (New_Seed : Positive);

  --

  package IIO is new Ada.Text_IO.Integer_IO (Integer);
  package BIO is new Ada.Text_IO.Enumeration_IO (Boolean);

  ------------------------------------------
  --  Variable-size string type: VString  --
  ------------------------------------------

  package VStr_Pkg renames Ada.Strings.Unbounded;  --  Could use XStrings instead.
  subtype VString is VStr_Pkg.Unbounded_String;
  Null_VString : VString renames VStr_Pkg.Null_Unbounded_String;
  function To_VString (S : String) return VString renames VStr_Pkg.To_Unbounded_String;
  function To_VString (C : Character) return VString;
  function To_String (V : VString) return String renames VStr_Pkg.To_String;
  package ACH renames Ada.Characters.Handling;
  --
  procedure Delete (Source : in out VString; From : Positive; Through : Natural) renames VStr_Pkg.Delete;
  function Element (Source : VString; Index : Positive) return Character renames VStr_Pkg.Element;
  function Ends_With (Item : VString; Pattern : Character) return Boolean;
  function Ends_With (Item : VString; Pattern : String) return Boolean;
  function Ends_With (Item : VString; Pattern : VString) return Boolean;
  function Head (Source : VString; Count : Natural) return VString;
  --
  function Index (Source : VString; Pattern : Character) return Natural;
  function Index (Source : VString; Pattern : String) return Natural;
  function Index (Source : VString; Pattern : VString) return Natural;
  function Index (Source : VString; Pattern : Character; From : Positive) return Natural;
  function Index (Source : VString; Pattern : String; From : Positive) return Natural;
  function Index (Source : VString; Pattern : VString; From : Positive) return Natural;
  --
  function Index_Backward (Source : VString; Pattern : Character) return Natural;
  function Index_Backward (Source : VString; Pattern : String) return Natural;
  function Index_Backward (Source : VString; Pattern : VString) return Natural;
  function Index_Backward (Source : VString; Pattern : Character; From : Positive) return Natural;
  function Index_Backward (Source : VString; Pattern : String; From : Positive) return Natural;
  function Index_Backward (Source : VString; Pattern : VString; From : Positive) return Natural;
  --
  function Length (Source : VString) return Natural renames VStr_Pkg.Length;
  function Slice (Source : VString; Low : Positive; High : Natural) return VString;
  function Starts_With (Item : VString; Pattern : Character) return Boolean;
  function Starts_With (Item : VString; Pattern : String) return Boolean;
  function Starts_With (Item : VString; Pattern : VString) return Boolean;
  function Tail (Source : VString; Count : Natural) return VString;

  --  Head_Before_Match returns the head of Source preceding first occurence of Pattern.
  --  The result is empty if Pattern is not found.
  function Head_Before_Match (Source : VString; Pattern : Character) return VString;
  function Head_Before_Match (Source : VString; Pattern : String) return VString;
  function Head_Before_Match (Source : VString; Pattern : VString) return VString;

  --  Tail_After_Match returns the tail of Source following last occurence of Pattern.
  --  The result is empty if Pattern is not found.
  function Tail_After_Match (Source : VString; Pattern : Character) return VString;
  function Tail_After_Match (Source : VString; Pattern : String) return VString;
  function Tail_After_Match (Source : VString; Pattern : VString) return VString;

  function To_Lower (Item : Character) return Character renames ACH.To_Lower;  --  RM A.3.2 (6)
  function To_Upper (Item : Character) return Character renames ACH.To_Upper;  --  RM A.3.2 (6)
  function To_Lower (Item : VString) return VString;
  function To_Upper (Item : VString) return VString;

  function Trim_Left  (Source : VString) return VString;
  function Trim_Right (Source : VString) return VString;
  function Trim_Both  (Source : VString) return VString;
  --
  function "+" (S : String) return VString renames To_VString;
  function "+" (C : Character) return VString renames To_VString;
  function "-" (V : VString) return String renames To_String;
  --
  function "*" (Num : Natural; Pattern : Character) return VString renames VStr_Pkg."*";
  function "*" (Num : Natural; Pattern : String) return VString;
  function "*" (Num : Natural; Pattern : VString) return VString renames VStr_Pkg."*";
  --
  function "&" (V1, V2 : VString) return VString renames VStr_Pkg."&";
  --
  function "&" (V : VString; S : String) return VString renames VStr_Pkg."&";
  function "&" (S : String; V : VString) return VString renames VStr_Pkg."&";
  --
  function "&" (V : VString; C : Character) return VString renames VStr_Pkg."&";
  function "&" (C : Character; V : VString) return VString renames VStr_Pkg."&";
  --
  function "&" (I : Integer; V : VString) return VString;
  function "&" (V : VString; I : Integer) return VString;
  --
  function "&" (R : Real; V : VString) return VString;
  function "&" (V : VString; R : Real) return VString;
  --
  function "&" (D : Duration; V : VString) return VString;
  function "&" (V : VString; D : Duration) return VString;
  --
  function "&" (B : Boolean; V : VString) return VString;
  function "&" (V : VString; B : Boolean) return VString;
  --
  function "="  (Left, Right : VString) return Boolean renames VStr_Pkg."=";
  function "<"  (Left, Right : VString) return Boolean renames VStr_Pkg."<";
  function "<=" (Left, Right : VString) return Boolean renames VStr_Pkg."<=";
  function ">"  (Left, Right : VString) return Boolean renames VStr_Pkg.">";
  function ">=" (Left, Right : VString) return Boolean renames VStr_Pkg.">=";
  --
  function "="  (Left : VString;  Right : String) return Boolean renames VStr_Pkg."=";
  function "<"  (Left : VString;  Right : String) return Boolean renames VStr_Pkg."<";
  function "<=" (Left : VString;  Right : String) return Boolean renames VStr_Pkg."<=";
  function ">"  (Left : VString;  Right : String) return Boolean renames VStr_Pkg.">";
  function ">=" (Left : VString;  Right : String) return Boolean renames VStr_Pkg.">=";

  function Image (I : Integer) return VString;
  function Image (F : Real) return VString;            --  "nice" image of F
  function Image (T : Ada.Calendar.Time) return VString;
  function Image (D : Duration) return VString;

  function Integer_Value (V : VString) return Integer;
  function Float_Value (V : VString) return Real;

  -------------------------
  --  Text Input/Output  --
  --  1) Console I/O     --
  -------------------------

  --  We have a real console/terminal input where several
  --  inputs can be made on the same line, followed by a
  --  "Return". It behaves like for a file. Actually it
  --  *could* be a file, if run like this: prog <input.txt .
  --
  function Get_Needs_Skip_Line return Boolean is (True);

  --  Get
  procedure Get (C : out Character) renames Ada.Text_IO.Get;
  procedure Get (S : out String)    renames Ada.Text_IO.Get;
  procedure Get (I : out Integer);
  procedure Get (F : out Real);

  procedure Get_Immediate (C : out Character) renames Ada.Text_IO.Get_Immediate;

  --  Get and then move file pointer to next line (Skip_Line)
  procedure Get_Line (C : out Character);
  procedure Get_Line (I : out Integer);
  procedure Get_Line (F : out Real);
  procedure Get_Line (V : out VString);  --  Gets the line till its end.

  procedure Skip_Line (Spacing : Ada.Text_IO.Positive_Count := 1)
    renames Ada.Text_IO.Skip_Line;

  --  Put
  procedure Put (C     : Character);
  procedure Put (I     : Integer;
                 Width : Ada.Text_IO.Field       := IIO.Default_Width;
                 Base  : Ada.Text_IO.Number_Base := IIO.Default_Base) renames IIO.Put;
  procedure Put (F     : Real;
                 Fore  : Integer := RIO.Default_Fore;
                 Aft   : Integer := RIO.Default_Aft;
                 Expo  : Integer := RIO.Default_Exp) renames RIO.Put;
  procedure Put (B     : Boolean;
                 Width : Ada.Text_IO.Field       := BIO.Default_Width);
  procedure Put (S     : String);
  procedure Put (V     : VString);

  --  Put and then New_Line (for S: it is the same as Ada.Text_IO.Put_Line)
  procedure Put_Line (C     : Character);
  procedure Put_Line (I     : Integer;
                      Width : Ada.Text_IO.Field       := IIO.Default_Width;
                      Base  : Ada.Text_IO.Number_Base := IIO.Default_Base);
  procedure Put_Line (F     : Real;
                      Fore  : Integer := RIO.Default_Fore;
                      Aft   : Integer := RIO.Default_Aft;
                      Expo  : Integer := RIO.Default_Exp);
  procedure Put_Line (B     : Boolean;
                      Width : Ada.Text_IO.Field := BIO.Default_Width);
  procedure Put_Line (S     : String) renames Ada.Text_IO.Put_Line;
  procedure Put_Line (V     : VString);

  procedure New_Line (Spacing : Ada.Text_IO.Positive_Count := 1)
    renames Ada.Text_IO.New_Line;

  function End_Of_Line return Boolean renames Ada.Text_IO.End_Of_Line;
  function End_Of_File return Boolean renames Ada.Text_IO.End_Of_File;

  -------------------------
  --  Text Input/Output  --
  --  2) File I/O        --
  -------------------------

  subtype File_Type is Ada.Text_IO.File_Type;

  --  Open file as input
  procedure Open (File : in out File_Type; Name : String);
  procedure Open (File : in out File_Type; Name : VString);

  --  Create file as output. If Name = "", it creates a temporary file.
  procedure Create (File : in out File_Type; Name : String);
  procedure Create (File : in out File_Type; Name : VString);

  --  Append to existing file (output).
  procedure Append (File : in out File_Type; Name : String);
  procedure Append (File : in out File_Type; Name : VString);

  procedure Close (File : in out File_Type) renames Ada.Text_IO.Close;

  --  Get
  procedure Get (File : File_Type; C : out Character) renames Ada.Text_IO.Get;
  procedure Get (File : File_Type; S : out String)    renames Ada.Text_IO.Get;
  procedure Get (File : File_Type; I : out Integer);
  procedure Get (File : File_Type; F : out Real);

  --  Get and then move file pointer to next line (Skip_Line)
  procedure Get_Line (File : File_Type; C : out Character);
  procedure Get_Line (File : File_Type; I : out Integer);
  procedure Get_Line (File : File_Type; F : out Real);
  procedure Get_Line (File : File_Type; V : out VString);     --  Gets the line till its end.

  procedure Skip_Line (File : File_Type; Spacing : Ada.Text_IO.Positive_Count := 1)
    renames Ada.Text_IO.Skip_Line;

  --  Put
  procedure Put (File  : File_Type; C : Character);
  procedure Put (File  : File_Type;
                 I     : Integer;
                 Width : Ada.Text_IO.Field       := IIO.Default_Width;
                 Base  : Ada.Text_IO.Number_Base := IIO.Default_Base) renames IIO.Put;
  procedure Put (File  : File_Type;
                 F     : Real;
                 Fore  : Integer := RIO.Default_Fore;
                 Aft   : Integer := RIO.Default_Aft;
                 Expo  : Integer := RIO.Default_Exp) renames RIO.Put;
  procedure Put (File  : File_Type;
                 B     : Boolean;
                 Width : Ada.Text_IO.Field       := BIO.Default_Width);
  procedure Put (File  : File_Type;
                 S     : String);
  procedure Put (File  : File_Type;
                 V     : VString);

  --  Put and then New_Line (for S: it is the same as Ada.Text_IO.Put_Line)
  procedure Put_Line (File  : File_Type;
                      C     : Character);
  procedure Put_Line (File  : File_Type;
                      I     : Integer;
                      Width : Ada.Text_IO.Field       := IIO.Default_Width;
                      Base  : Ada.Text_IO.Number_Base := IIO.Default_Base);
  procedure Put_Line (File  : File_Type;
                      F     : Real;
                      Fore  : Integer := RIO.Default_Fore;
                      Aft   : Integer := RIO.Default_Aft;
                      Expo  : Integer := RIO.Default_Exp);
  procedure Put_Line (File  : File_Type;
                      B     : Boolean;
                      Width : Ada.Text_IO.Field := BIO.Default_Width);
  procedure Put_Line (File  : File_Type;
                      S     : String) renames Ada.Text_IO.Put_Line;
  procedure Put_Line (File  : File_Type;
                      V     : VString);

  procedure New_Line (File : File_Type; Spacing : Ada.Text_IO.Positive_Count := 1)
    renames Ada.Text_IO.New_Line;

  function End_Of_Line (File : File_Type) return Boolean renames Ada.Text_IO.End_Of_Line;
  function End_Of_File (File : File_Type) return Boolean renames Ada.Text_IO.End_Of_File;
  function Is_Open     (File : File_Type) return Boolean renames Ada.Text_IO.Is_Open;

  ------------
  --  Time  --
  ------------

  subtype Time is Ada.Calendar.Time;

  function Clock return Time renames Ada.Calendar.Clock;
  function "-" (Left : Time; Right : Time) return Duration renames Ada.Calendar."-";
  --  The following functions are slightly different (no subtypes) from
  --  Ada.Calendar's but GNAT accepts the renaming. Is it correct?
  function Year    (Date : Time) return Integer renames Ada.Calendar.Year;
  function Month   (Date : Time) return Integer renames Ada.Calendar.Month;
  function Day     (Date : Time) return Integer renames Ada.Calendar.Day;
  function Seconds (Date : Time) return Duration renames Ada.Calendar.Seconds;

  -------------------------------------------------------------------------------------
  --  System (items similar to items in Ada.Directories, Ada.Environment_Variables)  --
  -------------------------------------------------------------------------------------

  function Argument_Count return Natural renames Ada.Command_Line.Argument_Count;
  function Argument (Number : Positive) return VString;
  function Command_Name return VString;
  procedure Set_Exit_Status (Code : in Integer);

  --  Get_Env: returns the value of environment variable Name.
  --  If Name is not set, returns an empty string.
  function Get_Env (Name : String)  return VString;
  function Get_Env (Name : VString) return VString;

  --  Set_Env: sets the value of environment variable Name.
  procedure Set_Env (Name : String;  Value : String) renames Ada.Environment_Variables.Set;
  procedure Set_Env (Name : VString; Value : String);
  procedure Set_Env (Name : String;  Value : VString);
  procedure Set_Env (Name : VString; Value : VString);

  --  Virtual Machine Variables work in a similar way as environment variables.
  --  The difference: they are visible only to an instance of the Virtual Machine,
  --  that is, to an object of type Builder.Build_Data.
  --  There are two ways of accessing them:
  --    1) from the HAC program via Get_VM_Variable, Set_VM_Variable below.
  --    2) from the "full Ada" application hosting HAC,
  --       via HAC_Sys.Interfacing.Get_VM_Variable, Set_VM_Variable.

  function Get_VM_Variable (Name : String)  return VString;
  function Get_VM_Variable (Name : VString) return VString;

  procedure Set_VM_Variable (Name : String;  Value : String);
  procedure Set_VM_Variable (Name : VString; Value : String);
  procedure Set_VM_Variable (Name : String;  Value : VString);
  procedure Set_VM_Variable (Name : VString; Value : VString);

  function Current_Directory return VString;

  procedure Set_Directory (Directory : String) renames Ada.Directories.Set_Directory;
  procedure Set_Directory (Directory : VString);

  procedure Copy_File (Source_Name : String;  Target_Name : String);
  procedure Copy_File (Source_Name : VString; Target_Name : String);
  procedure Copy_File (Source_Name : String;  Target_Name : VString);
  procedure Copy_File (Source_Name : VString; Target_Name : VString);

  procedure Delete_File (Name : String) renames Ada.Directories.Delete_File;
  procedure Delete_File (Name : VString);

  function Exists (Name : String) return Boolean renames Ada.Directories.Exists;
  function Exists (Name : VString) return Boolean;
  function Directory_Exists (Name : String) return Boolean;
  function Directory_Exists (Name : VString) return Boolean;
  function File_Exists (Name : String) return Boolean;
  function File_Exists (Name : VString) return Boolean;

  procedure Rename (Old_Name : String;  New_Name : String) renames Ada.Directories.Rename;
  procedure Rename (Old_Name : VString; New_Name : String);
  procedure Rename (Old_Name : String;  New_Name : VString);
  procedure Rename (Old_Name : VString; New_Name : VString);

  ---------------------
  --  Shell_Execute  --
  ---------------------

  procedure Shell_Execute (Command : String; Result : out Integer);
  procedure Shell_Execute (Command : VString; Result : out Integer);

  --  In this version, the result value is discarded:
  procedure Shell_Execute (Command : String);
  procedure Shell_Execute (Command : VString);

  --  The four above, but with piping of standard output into a VString:
  procedure Shell_Execute (Command : String; Result : out Integer; Output : out VString);
  procedure Shell_Execute (Command : VString; Result : out Integer; Output : out VString);
  procedure Shell_Execute (Command : String; Output : out VString);
  procedure Shell_Execute (Command : VString; Output : out VString);

  function Directory_Separator return Character;

  --  Semaphore stuff from SmallAda.
  --  It pre-dates Ada tasks and stems from CoPascal.
  type Semaphore is new Integer; -- private;
  procedure  Wait   (S : Semaphore);
  procedure  Signal (S : Semaphore);

  ---------------------------------
  --  End of compatibility part  --
  ---------------------------------
  --  The following part is formally public, but can only be directly
  --  used by the HAC system itself (HAC_Sys) or other "full Ada"
  --  programs using HAT (HAC programs cannot, so far, return String's
  --  or use generics).
  --  Those "private" items avoid code duplication or incompatibilities
  --  between HAT (as compatibility package) and the HAC run-time system
  --  itself.

  generic
    type Abstract_Integer is range <>;
  function HAC_Generic_Image (I : Abstract_Integer) return String;

  function HAC_Image (F : Real) return String;

  function HAC_Image (T : Ada.Calendar.Time) return String;

private

  --  type       SEMAPHORE is new INTEGER;

end HAT;