1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2005 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- Subprograms for manipulation of wide character sequences. Note that in
35 -- this package, wide character and wide wide character are not distinguished
36 -- since this package is basically concerned with syntactic notions, and it
37 -- deals with Char_Code values, rather than values of actual Ada types.
39 with Types
; use Types
;
43 function Length_Wide
return Nat
;
44 -- Returns the maximum length in characters for the escape sequence that
45 -- is used to encode wide character literals outside the ASCII range. Used
46 -- only in the implementation of the attribute Width for Wide_Character
47 -- and Wide_Wide_Character.
50 (S
: Source_Buffer_Ptr
;
51 P
: in out Source_Ptr
;
54 -- On entry S (P) points to the first character in the source text for
55 -- a wide character (i.e. to an ESC character, a left bracket, or an
56 -- upper half character, depending on the representation method). A
57 -- single wide character is scanned. If no error is found, the value
58 -- stored in C is the code for this wide character, P is updated past
59 -- the sequence and Err is set to False. If an error is found, then
60 -- P points to the improper character, C is undefined, and Err is
67 -- The escape sequence (including any leading ESC character) for the
68 -- given character code is stored starting at S (P + 1), and on return
69 -- P points to the last stored character (i.e. P is the count of stored
70 -- characters on entry and exit, and the escape sequence is appended to
71 -- the end of the stored string). The character code C represents a code
72 -- originally constructed by Scan_Wide, so it is known to be in a range
73 -- that is appropriate for the encoding method in use.
75 procedure Skip_Wide
(S
: String; P
: in out Natural);
76 -- On entry, S (P) points to an ESC character for a wide character escape
77 -- sequence or to an upper half character if the encoding method uses the
78 -- upper bit, or to a left bracket if the brackets encoding method is in
79 -- use. On exit, P is bumped past the wide character sequence. No error
80 -- checking is done, since this is only used on escape sequences generated
81 -- by Set_Wide, which are known to be correct.
83 procedure Skip_Wide
(S
: Source_Buffer_Ptr
; P
: in out Source_Ptr
);
84 -- Similar to the above procedure, but operates on a source buffer
85 -- instead of a string, with P being a Source_Ptr referencing the
86 -- contents of the source buffer.
88 function Is_Start_Of_Wide_Char
89 (S
: Source_Buffer_Ptr
;
90 P
: Source_Ptr
) return Boolean;
91 -- Determines if S (P) is the start of a wide character sequence