Gerhard Niklasch on Mon, 9 Feb 1998 16:56:49 +0100


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

Re: pari-2.0.5 update (strange \r behaviour)


Three minutes ago I vowed not to touch this tricky and sensitive area
of code.  I am a liar.  ;^)

Anyway, the following is a half-hearted fix.  It causes gp _not_ to
stop reading from the file it is reading from when allocatemem() is
executed.  (This fix is not quite right, though, because it also causes
gp _not_ to stop reading from a file  [as it should in version 2.0.5.-
alpha]  when there is in fact some serious problem with the stack.
We would need two distinct error numbers to handle these two cases
differently.)

Hope this helps the folks who want to use allocatemem in their scripts
before Karim is back,

Gerhard.


diff -u src/gp/gp.c.orig src/gp/gp.c
--- src/gp/gp.c.orig    Mon Feb  9 16:48:06 1998
+++ src/gp/gp.c Mon Feb  9 16:50:01 1998
@@ -499,12 +499,13 @@
   {
     if (status == MAIN)
     {
+      int whatnow;
       tloc = tglobal; recover(0);
-      if (setjmp(environnement))
+      if ((whatnow = setjmp(environnement)))
       {
        avma = top; tglobal = tloc; parisize = top - bot;
        for (len = (tloc%histsize)+2; len<=histsize; len++) g[len]=NULL;
-       while (switchin(NULL) >= 0) /* empty */;
+       if (whatnow != errpile) { while (switchin(NULL) >= 0) /* empty */; }
       }
     }
     added_newline = 1;