summaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-libs-iso/WholeIO.mod
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2023-05-17 00:18:56 +0100
committerGaius Mulley <gaiusmod2@gmail.com>2023-05-17 00:18:56 +0100
commit509eef9314b24eff20a5dbdd92f6ab52e2c0c786 (patch)
tree2a98b53840b958c0e75259c03000d4d8bb4c8b70 /gcc/m2/gm2-libs-iso/WholeIO.mod
parentf25d2de17663a0132f9fe090dee39d3b1132067b (diff)
downloadgcc-509eef9314b24eff20a5dbdd92f6ab52e2c0c786.tar.gz
PR modula2/109879 WholeIO.ReadCard and ReadInt should consume leading space
The Read{TYPE} procedures in LongIO, LongWholeIO, RealIO, ShortWholeIO and WholeIO all require skip space functionality. A new module TextUtil is supplied with this functionality and the previous modules have been changed to call SkipSpaces. gcc/m2/ChangeLog: PR modula2/109879 * gm2-libs-iso/LongIO.mod (ReadReal): Call SkipSpaces. * gm2-libs-iso/LongWholeIO.mod (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/RealIO.mod (ReadReal): Call SkipSpaces. * gm2-libs-iso/ShortWholeIO.mod: (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/TextIO.mod: Import SkipSpaces. * gm2-libs-iso/WholeIO.mod (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/TextUtil.def: New file. * gm2-libs-iso/TextUtil.mod: New file. libgm2/ChangeLog: PR modula2/109879 * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am (M2DEFS): Add TextUtil.def. (M2MODS): Add TextUtil.mod. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.in: Regenerate. gcc/testsuite/ChangeLog: PR modula2/109879 * gm2/isolib/run/pass/testreadint.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc/m2/gm2-libs-iso/WholeIO.mod')
-rw-r--r--gcc/m2/gm2-libs-iso/WholeIO.mod5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/m2/gm2-libs-iso/WholeIO.mod b/gcc/m2/gm2-libs-iso/WholeIO.mod
index 9fc879e20a3..0bfe1a8fc0a 100644
--- a/gcc/m2/gm2-libs-iso/WholeIO.mod
+++ b/gcc/m2/gm2-libs-iso/WholeIO.mod
@@ -33,6 +33,7 @@ FROM StringConvert IMPORT IntegerToString, CardinalToString ;
FROM WholeConv IMPORT ScanInt, ScanCard ;
FROM StringChan IMPORT writeString ;
FROM IOConsts IMPORT ReadResults ;
+FROM TextUtil IMPORT SkipSpaces ;
(* Input and output of whole numbers in decimal text form
@@ -40,7 +41,7 @@ FROM IOConsts IMPORT ReadResults ;
type IOConsts.ReadResults.
*)
-IMPORT IOChan;
+IMPORT IOChan ;
(* The text form of a signed whole number is
["+" | "-"], decimal digit, {decimal digit}
@@ -63,6 +64,7 @@ VAR
ch : CHAR ;
negative : BOOLEAN ;
BEGIN
+ SkipSpaces (cid) ;
ReadChar(cid, ch) ;
negative := FALSE ;
c := 0 ;
@@ -133,6 +135,7 @@ VAR
ch : CHAR ;
c : CARDINAL ;
BEGIN
+ SkipSpaces (cid) ;
ReadChar(cid, ch) ;
c := 0 ;
nextState := ScanCard ;