[M3devel] Strange code in Rd.CharsReady

Rodney M. Bates rodney_bates at lcwb.coop
Tue Dec 12 22:16:42 CET 2017


These got moved to m3core, where similar interfaces for other types were all along.
Also expanded some, and renamed.  Specifically, in m3-libs/m3core/src/float/Common,

RealFloat.i3 LongFloat.i3, and ExtendedFloat.i3.

Subdirectory m3-libs/libm3/src/types is leftover stuff that, by now, should probably
be removed altogether.

On 12/11/2017 12:27 AM, Mika Nystrom wrote:
> Next question.
>
> Why does this keep coming and going?
>
> In
>
> m3-libs/libm3/src/m3makefile:
>
> % include_dir ("types") % which no longer has an m3makefile
>
> This was broken (removed) once before and unbroken somehow... I keep losing "LongrealType", which is an interface needed to instantiate generics with LONGREAL.
>
> Now it's been re-broken?
>
>
> On Sun, Dec 10, 2017 at 1:19 PM, Mika Nystrom <mika at async.caltech.edu <mailto:mika at async.caltech.edu>> wrote:
>
>     not sure the list allows my other email address to email to it...
>
>     ---------- Forwarded message ----------
>     From: *Mika Nystrom* <mika at alum.mit.edu <mailto:mika at alum.mit.edu>>
>     Date: Sun, Dec 10, 2017 at 1:07 PM
>     Subject: Strange code in Rd.CharsReady
>     To: m3devel at elegosoft.com <mailto:m3devel at elegosoft.com>
>
>
>     Hello m3devel,
>
>     Long time no see!
>
>     I am trying to resurrect some old code I have, and I have run into a strange issue.
>
>     According to
>
>     https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3 <https://github.com/modula3/cm3/blame/master/m3-libs/libm3/src/rw/Rd.m3>
>
>     the current source code for the routine Rd.CharsReady is as follows below.
>
>     I am truly suspicious of line 389, which says it comes from some Unicode merge.
>
>     IF NextBuff (rd) THEN RETURN 1 END (*line 389*)
>
>     I have a program that misbehaves.
>
>     This program appears to be BLOCKING in CharsReady.  This behavior obviously defeats the purpose of CharsReady.  I can't seem to cut and paste the traceback for some reason but it's calling Rd__NextBuff at line 151 and further then to ConnRW__RdSeek  with dontBlock FALSE (so "OK to block") and then SchedulerPosix__AlertWait.
>
>     The old version of line 389 I believe was
>
>     IF rd.seek(rd.cur, TRUE) = SeekResult.Eof THEN RETURN 1 END
>
>     where TRUE means "don't block".
>
>     Can someone tell me the rationale for the change and whether I am correct if I say that the new version is wrong?
>
>     I am wonder how this change could even have gotten into the code in the first place if it's causing CharsReady to block, seems like a pretty obvious bug and I don't see a reason for tthe change in the first place.
>
>     Mika
>
>
>
>     PROCEDURE CharsReady(rd: T): CARDINAL
>     383
>     RAISES {Failure} =
>     @hosking <https://github.com/hosking>
>     Hide warning. <https://github.com/modula3/cm3/commit/dbbcc11269c5aa10a13a61572e67a78cb03a7030>
>     3 years ago
>     <https://github.com/modula3/cm3/blame/7032bc21f3fa31450a6600b61de7f0523516309f/m3-libs/libm3/src/rw/Rd.m3>
>     384
>     <*FATAL Thread.Alerted*>
>     @jaykrell <https://github.com/jaykrell>
>     initial diff from ../config/PPC_LINUX <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
>     10 years ago
>     385
>     BEGIN
>     @RodneyBates <https://github.com/RodneyBates>
>     Merge Unicode branch into head. For a summary of the changes, see <https://github.com/modula3/cm3/commit/ea494d1b46c34a6c4c805322cfe6b1c02bfb2bf0>
>     4 years ago
>     <https://github.com/modula3/cm3/blame/e5a6e4ae7feabce4e375a1445ea28dc66a174d58/m3-libs/libm3/src/rw/Rd.m3>
>     386
>     LOCK rd DO
>     @jaykrell <https://github.com/jaykrell>
>     initial diff from ../config/PPC_LINUX <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
>     10 years ago
>     387
>     IF rd.cur = rd.hi THEN
>     388
>     IF rd.closed THEN Die() END;
>     @RodneyBates <https://github.com/RodneyBates>
>     Merge Unicode branch into head. For a summary of the changes, see <https://github.com/modula3/cm3/commit/ea494d1b46c34a6c4c805322cfe6b1c02bfb2bf0>
>     4 years ago
>     <https://github.com/modula3/cm3/blame/e5a6e4ae7feabce4e375a1445ea28dc66a174d58/m3-libs/libm3/src/rw/Rd.m3>
>     389
>     IF NextBuff (rd) THEN RETURN 1 END
>     @jaykrell <https://github.com/jaykrell>
>     initial diff from ../config/PPC_LINUX <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
>     10 years ago
>     390
>     END;
>     391
>     RETURN rd.hi - rd.cur;
>     @RodneyBates <https://github.com/RodneyBates>
>     Merge Unicode branch into head. For a summary of the changes, see <https://github.com/modula3/cm3/commit/ea494d1b46c34a6c4c805322cfe6b1c02bfb2bf0>
>     4 years ago
>     <https://github.com/modula3/cm3/blame/e5a6e4ae7feabce4e375a1445ea28dc66a174d58/m3-libs/libm3/src/rw/Rd.m3>
>     392
>     END;
>     @jaykrell <https://github.com/jaykrell>
>     initial diff from ../config/PPC_LINUX <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
>     10 years ago
>     393
>     END CharsReady;
>
>
>
>
>
>
>
>
> _______________________________________________
> M3devel mailing list
> M3devel at elegosoft.com
> https://m3lists.elegosoft.com/mailman/listinfo/m3devel
>

-- 
Rodney Bates
rodney.m.bates at acm.org


More information about the M3devel mailing list