-
Notifications
You must be signed in to change notification settings - Fork 0
/
char_io.spc
67 lines (55 loc) · 2.8 KB
/
char_io.spc
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
--------------------------------------------------------------------------
-- ASnip Source Code Decorator
-- Copyright (C) 2006, Georg Bauhaus
--
-- 1. Permission is hereby granted to use, copy, modify and/or distribute
-- this package, provided that:
-- * copyright notices are retained unchanged,
-- * any distribution of this package, whether modified or not,
-- includes this license text.
-- 2. Permission is hereby also granted to distribute binary programs which
-- depend on this package. If the binary program depends on a modified
-- version of this package, you are encouraged to publicly release the
-- modified version of this package.
--
-- THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. 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 AUTHORS BE LIABLE TO ANY PARTY FOR
-- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE.
--------------------------------------------------------------------------
-- eMail: [email protected]
with Ada.Streams;
with ASnip; use ASnip;
package Char_IO is
subtype ROOT_STREAM_TYPE is Ada.Streams.ROOT_STREAM_TYPE;
malformed_encoding: exception;
-- functions actually performing I/O. BMP only.
type CHAR_READER is abstract tagged null record;
--access function(source: access ROOT_STREAM_TYPE'class) return CHAR;
function read_next_char
(the_reader: CHAR_READER;
source: access ROOT_STREAM_TYPE'class) return CHAR is abstract;
type READS_UTF_8 is new CHAR_READER with null record;
function read_next_char
(the_reader: READS_UTF_8;
source: access ROOT_STREAM_TYPE'class) return CHAR;
type READS_UTF_16 is new CHAR_READER with null record;
function read_next_char
(the_reader: READS_UTF_16;
source: access ROOT_STREAM_TYPE'class) return CHAR;
type READS_UTF_16LE is new CHAR_READER with null record;
function read_next_char
(the_reader: READS_UTF_16LE;
source: access ROOT_STREAM_TYPE'class) return CHAR;
-- byte order issue?
type READS_8859 is new CHAR_READER with null record;
function read_next_char
(the_reader: READS_8859;
source: access ROOT_STREAM_TYPE'class) return CHAR;
R8859: aliased constant Char_IO.READS_8859 := (null record);
RUTF8: aliased constant Char_IO.READS_UTF_8 := (null record);
RUTF16: aliased constant Char_IO.READS_UTF_16 := (null record);
RUTF16LE: aliased constant Char_IO.READS_UTF_16LE := (null record);
end Char_IO;