diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:30:04 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:30:04 +0000 |
commit | 830a3f424d271773b4efa216a3006b108d48d04f (patch) | |
tree | 723bf7b7f6c79be9da7af8b7b5180dc8dc0f63f7 /gcc/ada/s-imgcha.adb | |
parent | 587185fc9008481f0b72ec5dcf732420b1a92288 (diff) | |
download | gcc-830a3f424d271773b4efa216a3006b108d48d04f.tar.gz |
2007-12-06 Robert Dewar <dewar@adacore.com>
* s-imenne.adb, s-imenne.ads: New files.
* s-imgboo.adb, s-imgboo.ads, s-imgcha.adb, s-imgcha.ads, s-imgdec.adb,
s-imgdec.ads, s-imgenu.ads, s-imgint.adb, s-imgint.ads, s-imglld.adb,
s-imglld.ads, s-imglli.adb, s-imglli.ads, s-imgllu.adb, s-imgllu.ads,
s-imgrea.adb, s-imgrea.ads, s-imguns.adb, s-imguns.ads, s-imgwch.adb,
s-imgwch.ads: New calling sequence for Image routines to avoid sec
stack usage.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130852 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-imgcha.adb')
-rw-r--r-- | gcc/ada/s-imgcha.adb | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/gcc/ada/s-imgcha.adb b/gcc/ada/s-imgcha.adb index 97ddb37a38e..a8d7c10bc09 100644 --- a/gcc/ada/s-imgcha.adb +++ b/gcc/ada/s-imgcha.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,10 +37,14 @@ package body System.Img_Char is -- Image_Character -- --------------------- - function Image_Character (V : Character) return String is - subtype Cname is String (1 .. 3); + procedure Image_Character + (V : Character; + S : in out String; + P : out Natural) + is + pragma Assert (S'First = 1); - S : Cname; + subtype Cname is String (1 .. 3); subtype C0_Range is Character range Character'Val (16#00#) .. Character'Val (16#1F#); @@ -121,22 +125,22 @@ package body System.Img_Char is -- Control characters are represented by their names (RM 3.5(32)) if V in C0_Range then - S := C0 (V); + S (1 .. 3) := C0 (V); if S (3) = ' ' then - return S (1 .. 2); + P := 2; else - return S; + P := 3; end if; elsif V in C1_Range then - S := C1 (V); + S (1 .. 3) := C1 (V); if S (1) /= 'r' then if S (3) = ' ' then - return S (1 .. 2); + P := 2; else - return S; + P := 3; end if; -- Special case, res means RESERVED_nnn where nnn is the three digit @@ -146,13 +150,12 @@ package body System.Img_Char is else declare VP : constant Natural := Character'Pos (V); - St : String (1 .. 12) := "RESERVED_xxx"; - begin - St (10) := Character'Val (48 + VP / 100); - St (11) := Character'Val (48 + (VP / 10) mod 10); - St (12) := Character'Val (48 + VP mod 10); - return St; + S (1 .. 9) := "RESERVED_"; + S (10) := Character'Val (48 + VP / 100); + S (11) := Character'Val (48 + (VP / 10) mod 10); + S (12) := Character'Val (48 + VP mod 10); + P := 12; end; end if; @@ -162,7 +165,7 @@ package body System.Img_Char is S (1) := '''; S (2) := V; S (3) := '''; - return S; + P := 3; end if; end Image_Character; |