[M3devel] Strange code in Rd.CharsReady

Mika Nystrom mika at async.caltech.edu
Mon Dec 11 07:27:43 CET 2017


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>
wrote:

> not sure the list allows my other email address to email to it...
>
> ---------- Forwarded message ----------
> From: Mika Nystrom <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
>
>
> 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
>
> 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} =
> [image: @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*>
> [image: @jaykrell] <https://github.com/jaykrell>
> initial diff from ../config/PPC_LINUX
> <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
> 10 years ago
> 385
> BEGIN
> [image: @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
> [image: @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;
> [image: @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
> [image: @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;
> [image: @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;
> [image: @jaykrell] <https://github.com/jaykrell>
> initial diff from ../config/PPC_LINUX
> <https://github.com/modula3/cm3/commit/2412437e3043bdfcb5f13463b5b445c78aeb4c9b>
> 10 years ago
> 393
> END CharsReady;
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20171210/74d72773/attachment-0001.html>


More information about the M3devel mailing list