First_Non_Blank_Location := Scan_Ptr;
Initialize_Checksum;
+ Wide_Char_Byte_Count := 0;
-- Do not call Scan, otherwise the License stuff does not work in Scn
-----------------------
procedure Check_End_Of_Line is
- Len : constant Int := Int (Scan_Ptr) - Int (Current_Line_Start);
+ Len : constant Int :=
+ Int (Scan_Ptr) -
+ Int (Current_Line_Start) -
+ Wide_Char_Byte_Count;
begin
if Style_Check then
elsif Len > Opt.Max_Line_Length then
Error_Long_Line;
end if;
+
+ -- Reset wide character byte count for next line
+
+ Wide_Char_Byte_Count := 0;
end Check_End_Of_Line;
-----------------------
C : out Char_Code;
Err : out Boolean)
is
+ P_Init : constant Source_Ptr := P;
+
function In_Char return Character;
-- Function to obtain characters of wide character escape sequence
begin
C := Char_Code (WC_In (In_Char, Wide_Character_Encoding_Method));
Err := False;
+ Wide_Char_Byte_Count := Wide_Char_Byte_Count + Nat (P - P_Init - 1);
exception
when Constraint_Error =>
---------------
procedure Skip_Wide (S : String; P : in out Natural) is
+ P_Init : constant Natural := P;
+
function Skip_Char return Character;
-- Function to skip one character of wide character escape sequence
begin
Discard := WC_Skip (Skip_Char, Wide_Character_Encoding_Method);
+ Wide_Char_Byte_Count := Wide_Char_Byte_Count + Nat (P - P_Init - 1);
end Skip_Wide;
---------------
---------------
procedure Skip_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr) is
+ P_Init : constant Source_Ptr := P;
+
function Skip_Char return Character;
-- Function to skip one character of wide character escape sequence
begin
Discard := WC_Skip (Skip_Char, Wide_Character_Encoding_Method);
+ Wide_Char_Byte_Count := Wide_Char_Byte_Count + Nat (P - P_Init - 1);
end Skip_Wide;
end Widechar;
package Widechar is
+ Wide_Char_Byte_Count : Nat := 0;
+ -- This value is incremented whenever Scan_Wide or Skip_Wide is called.
+ -- The amount added is the length of the wide character sequence minus
+ -- one. This means that the count that accululates here represents the
+ -- difference between the length in characters and the length in bytes.
+ -- This is used for checking the line length in characters.
+
function Length_Wide return Nat;
-- Returns the maximum length in characters for the escape sequence that
-- is used to encode wide character literals outside the ASCII range. Used