bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Yet another editor thingy.


From: Chris Moller
Subject: Re: [Bug-apl] Yet another editor thingy.
Date: Sat, 11 Aug 2018 12:12:24 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

PS, the unitbuf thing was just the result of some bad advice I got when asking around about the way C++ handles streams--the last time I  used C++ for anything significant was in about 1990 and I've forgotten just about everything I knew about it from back then.  Just about everything I do these days is in boring old C.

So, yeah, I think it's safe to say that any and all references to unitbuf should go in a different place: the bit bucket.

--CM


On 11/08/18 11:00, Juergen Sauermann wrote:
Hi Chris,

it would remove the clearerr() and unsetf() calls.
clearerr() has probably no effect at all because the next fgetc()
will do the same. And CIN.unsetf(ios_base::unitbuf) - if at all needed -
should go to a different place.

The new code would be this:

//-----------------------------------------------------------------------------
Unicode
LineInput::get_uni()
{
again:

const int b0 = fgetc(stdin);
   if (b0 == EOF)
      {
        if (errno == EINTR)   goto again;
      }

   ...


Could you please check if your editor still works with that?

I also noticed another fgetc() below the one shown above. I suppose that
I should check for EINTR .in that one as well.

Best Regards,
/// Jürgen



On 08/10/2018 03:35 PM, Chris Moller wrote:

I'm not sure how much the reversion would revert.  If it was the patch I sent you on 2 August:

Index: LineInput.cc
===================================================================
--- LineInput.cc        (revision 1060)
+++ LineInput.cc        (working copy)
@@ -968,9 +968,10 @@
       {
         if (errno == EINTR)
            {
-             clearerr(stdin);
-             CIN.unsetf(ios_base::unitbuf);
-             goto again;
+            clearerr (stdin);
+            CIN.unsetf( std::ios_base::unitbuf );
+            CERR.unsetf( std::ios_base::unitbuf );
+            return UNI_ASCII_CR;
            }
 

I think it's still a good idea to catch EINTR just to avoid having nulls returned:


Index: LineInput.cc
===================================================================
--- LineInput.cc        (revision 1061)
+++ LineInput.cc        (working copy)
@@ -969,7 +969,6 @@
         if (errno == EINTR)
            {
              clearerr(stdin);
-             CIN.unsetf(ios_base::unitbuf);
              goto again;
            }


I.e., getting rid of the CIN.unsetf(ios_base::unitbuf), making the code look like:


const int b0 = fgetc(stdin);
   if (b0 == EOF)
      {
        if (errno == EINTR)
           {
             clearerr(stdin);
             goto again;
           }

       if (got_WINCH)



Thanks,

Chris


On 10/08/18 09:11, Juergen Sauermann wrote:
Hi Chris,

does that mean that I can revert the patch that I have put in for edif recently?

Best Regards,
/// Jürgen


On 08/07/2018 07:09 PM, Chris Moller wrote:

Hans-Peter,

If you want to try it again, I'm pretty sure I've fixed that bug in edif2--I just committed the update to https://github.com/ChrisMoller/edif

--Chris


On 02/08/18 07:12, Hans-Peter Sorge wrote:

Hello Chris,

thank you for this master piece. The line editing in GNU APL is a bit cumbersome.

But the apl session gets blocked during editing (edif2).

Currently I have no clue, how to analyze it.

Thank you again.

Hans-Peter








reply via email to

[Prev in Thread] Current Thread [Next in Thread]