OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [widechar.ads] - Blame information for rev 706

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
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-2009  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 3,  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  Subprograms for manipulation of wide character sequences. Note that in
33
--  this package, wide character and wide wide character are not distinguished
34
--  since this package is basically concerned with syntactic notions, and it
35
--  deals with Char_Code values, rather than values of actual Ada types.
36
 
37
with Types; use Types;
38
 
39
package Widechar is
40
 
41
   Wide_Char_Byte_Count : Nat := 0;
42
   --  This value is incremented whenever Scan_Wide or Skip_Wide is called.
43
   --  The amount added is the length of the wide character sequence minus
44
   --  one. This means that the count that accumulates here represents the
45
   --  difference between the length in characters and the length in bytes.
46
   --  This is used for checking the line length in characters.
47
 
48
   function Length_Wide return Nat;
49
   --  Returns the maximum length in characters for the escape sequence that
50
   --  is used to encode wide character literals outside the ASCII range. Used
51
   --  only in the implementation of the attribute Width for Wide_Character
52
   --  and Wide_Wide_Character.
53
 
54
   procedure Scan_Wide
55
     (S   : Source_Buffer_Ptr;
56
      P   : in out Source_Ptr;
57
      C   : out Char_Code;
58
      Err : out Boolean);
59
   --  On entry S (P) points to the first character in the source text for
60
   --  a wide character (i.e. to an ESC character, a left bracket, or an
61
   --  upper half character, depending on the representation method). A
62
   --  single wide character is scanned. If no error is found, the value
63
   --  stored in C is the code for this wide character, P is updated past
64
   --  the sequence and Err is set to False. If an error is found, then
65
   --  P points to the improper character, C is undefined, and Err is
66
   --  set to True.
67
 
68
   procedure Set_Wide
69
     (C : Char_Code;
70
      S : in out String;
71
      P : in out Natural);
72
   --  The escape sequence (including any leading ESC character) for the
73
   --  given character code is stored starting at S (P + 1), and on return
74
   --  P points to the last stored character (i.e. P is the count of stored
75
   --  characters on entry and exit, and the escape sequence is appended to
76
   --  the end of the stored string). The character code C represents a code
77
   --  originally constructed by Scan_Wide, so it is known to be in a range
78
   --  that is appropriate for the encoding method in use.
79
 
80
   procedure Skip_Wide (S : String; P : in out Natural);
81
   --  On entry, S (P) points to an ESC character for a wide character escape
82
   --  sequence or to an upper half character if the encoding method uses the
83
   --  upper bit, or to a left bracket if the brackets encoding method is in
84
   --  use. On exit, P is bumped past the wide character sequence. No error
85
   --  checking is done, since this is only used on escape sequences generated
86
   --  by Set_Wide, which are known to be correct.
87
 
88
   procedure Skip_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr);
89
   --  Similar to the above procedure, but operates on a source buffer
90
   --  instead of a string, with P being a Source_Ptr referencing the
91
   --  contents of the source buffer.
92
 
93
   function Is_Start_Of_Wide_Char
94
     (S : Source_Buffer_Ptr;
95
      P : Source_Ptr) return Boolean;
96
   --  Determines if S (P) is the start of a wide character sequence
97
 
98
end Widechar;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.