[M3commit] [modula3/cm3] 79a67a: Implement UnGetCodePoint and several things entail...

Rodney Bates rodney.m.bates at acm.org
Fri Jul 17 22:53:26 CEST 2015

  Branch: refs/heads/master
  Home:   https://github.com/modula3/cm3
  Commit: 79a67a27a680096f54d98a276bdf2508cbd6c1d6
  Author: Rodney Bates <rodney.m.bates at acm.org>
  Date:   2015-07-17 (Fri, 17 Jul 2015)

  Changed paths:
    M m3-libs/libm3/src/rw/Rd.i3
    M m3-libs/libm3/src/rw/Rd.m3
    M m3-libs/libunicode/src/UniRd.i3
    M m3-libs/libunicode/src/UniRd.m3
    M m3-libs/libunicode/src/UniRdClass.i3
    M m3-libs/libunicode/src/UnsafeUniRd.i3
    M m3-libs/libunicode/src/UnsafeUniRd.m3
    M m3-libs/libunicode/tests/ungetmulti/src/TestRd.m3
    M m3-libs/libunicode/tests/unird/src/TestUniRd.m3

  Log Message:
  Implement UnGetCodePoint and several things entailed thereby.

 Changes to be committed:
   (relative to m3-libs/libm3/src/rw)

	modified:   Rd.i3
	modified:   Rd.m3
	modified:   ../../../libunicode/src/UniRd.i3
	modified:   ../../../libunicode/src/UniRd.m3
	modified:   ../../../libunicode/src/UniRdClass.i3
	modified:   ../../../libunicode/src/UnsafeUniRd.i3
	modified:   ../../../libunicode/src/UnsafeUniRd.m3
	modified:   ../../../libunicode/tests/ungetmulti/src/TestRd.m3
	modified:   ../../../libunicode/tests/unird/src/TestUniRd.m3

Implement UniRd.UnGetCodePoint.  This required:

Substantially reworking lots of procedures in UnsafeUniRd.  Formerly,
these handled ungetting of CR and LF code points by keeping state
variables in the UniRd.T.  This was implemented before Rd.UnGetMulti
existed.  This would have gotten a lot messier with UnGetCodePoint.
Now, all ungetting of code points is implemented using ungetting of
single CHARs.  This also makes for somewhat sane semantics of mixing
gets/ungets to the unicode stream (UniRd.T) with those to the source
CHAR stream, (Rd.T), as well as seeks, if you dare, and don't exceed
the maximum unget CHAR count.

Changing Rd.UnGetMulti to accept a new parameter (UnGetCount) giving
the numbef of chars to unget.  Although the above could have been
done-without, it would have been pretty awkward to execute up to 8
successive calls on UnGetMulti.  The new parameter is defaulted to 1,
so existing calls will compile/run without change.  However, a number
of existing calls in the distribution are changed to supply the 1
explicitly, for clarity.

Updating test programs TestRd.m3 and TestUniRd.m3, to test some of the
new behavour.

More information about the M3commit mailing list