OSDN Git Service

* Makefile.in (reload1.o-warn): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / ada / widechar.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             W I D E C H A R                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2005, 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 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.                                              --
21 --                                                                          --
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.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
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.
38
39 with Types; use Types;
40
41 package Widechar is
42
43    Wide_Char_Byte_Count : Nat := 0;
44    --  This value is incremented whenever Scan_Wide or Skip_Wide is called.
45    --  The amount added is the length of the wide character sequence minus
46    --  one. This means that the count that accululates here represents the
47    --  difference between the length in characters and the length in bytes.
48    --  This is used for checking the line length in characters.
49
50    function Length_Wide return Nat;
51    --  Returns the maximum length in characters for the escape sequence that
52    --  is used to encode wide character literals outside the ASCII range. Used
53    --  only in the implementation of the attribute Width for Wide_Character
54    --  and Wide_Wide_Character.
55
56    procedure Scan_Wide
57      (S   : Source_Buffer_Ptr;
58       P   : in out Source_Ptr;
59       C   : out Char_Code;
60       Err : out Boolean);
61    --  On entry S (P) points to the first character in the source text for
62    --  a wide character (i.e. to an ESC character, a left bracket, or an
63    --  upper half character, depending on the representation method). A
64    --  single wide character is scanned. If no error is found, the value
65    --  stored in C is the code for this wide character, P is updated past
66    --  the sequence and Err is set to False. If an error is found, then
67    --  P points to the improper character, C is undefined, and Err is
68    --  set to True.
69
70    procedure Set_Wide
71      (C : Char_Code;
72       S : in out String;
73       P : in out Natural);
74    --  The escape sequence (including any leading ESC character) for the
75    --  given character code is stored starting at S (P + 1), and on return
76    --  P points to the last stored character (i.e. P is the count of stored
77    --  characters on entry and exit, and the escape sequence is appended to
78    --  the end of the stored string). The character code C represents a code
79    --  originally constructed by Scan_Wide, so it is known to be in a range
80    --  that is appropriate for the encoding method in use.
81
82    procedure Skip_Wide (S : String; P : in out Natural);
83    --  On entry, S (P) points to an ESC character for a wide character escape
84    --  sequence or to an upper half character if the encoding method uses the
85    --  upper bit, or to a left bracket if the brackets encoding method is in
86    --  use. On exit, P is bumped past the wide character sequence. No error
87    --  checking is done, since this is only used on escape sequences generated
88    --  by Set_Wide, which are known to be correct.
89
90    procedure Skip_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr);
91    --  Similar to the above procedure, but operates on a source buffer
92    --  instead of a string, with P being a Source_Ptr referencing the
93    --  contents of the source buffer.
94
95    function Is_Start_Of_Wide_Char
96      (S : Source_Buffer_Ptr;
97       P : Source_Ptr) return Boolean;
98    --  Determines if S (P) is the start of a wide character sequence
99
100 end Widechar;