Karim Belabas on Thu, 12 Feb 1998 00:43:46 +0100


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

patch 12, was: pari-2.0.5 update (strange \r behaviour)


Xavier Roblot (msg 50) wrote:
> The command \r does not give any error message, but doesn't give any
> response neither..

and this turned out (Gerhard Niklasch's "half-hearted fix" in msg 52) to be
related to the use of the GP command allocatemem() within Xavier's script.

  This is a variation on Gerhard's solution (and is incompatible with it, you
will have to unapply Gerhard's patch first). It should not break anything and
seems the most sensible way to deal with the previous broken behaviour: no
longer treat allocatemem as an error.

Karim.

============================= patch 12 ==============================

*** src/gp/gp.c.orig	Sat Feb  7 17:12:04 1998
--- src/gp/gp.c	Wed Feb 11 21:19:06 1998
***************
*** 47,52 ****
--- 47,53 ----
  #define MAX_PATH_LEN 1024
  #define MAX_PROMPT_LEN 128
  #define MAX_BUFFER 64
+ static jmp_buf local_environnement;
  static GEN *g;
  static char path[MAX_PATH_LEN],*bufferlist[MAX_BUFFER];
  static char prompt[MAX_PROMPT_LEN], thestring[256], *help_prg;
***************
*** 497,502 ****
--- 498,504 ----
    bufferlist[bufferindex++] = gpbuffer = (char *) gpmalloc(paribuffsize);
    for(;;)
    {
+     setjmp(local_environnement);
      if (status == MAIN)
      {
        tloc = tglobal; recover(0);
***************
*** 1217,1223 ****
        allocatemoremem(newsize); parisize=newsize;
        if (parisize && status == d_ACKNOWLEDGE)
  	pariputsf("   parisize = %ld\n", parisize);
!       longjmp(environnement,errpile);
      }
      parisize=newsize;
    }
--- 1219,1225 ----
        allocatemoremem(newsize); parisize=newsize;
        if (parisize && status == d_ACKNOWLEDGE)
  	pariputsf("   parisize = %ld\n", parisize);
!       longjmp(local_environnement, 0);
      }
      parisize=newsize;
    }
***************
*** 2679,2685 ****
  allocatemem0(unsigned long newsize)
  {
    allocatemoremem(newsize); parisize=newsize;
!   longjmp(environnement,errpile);
  }
  
  /* print a sequence of (NULL terminated) GEN */
--- 2681,2687 ----
  allocatemem0(unsigned long newsize)
  {
    allocatemoremem(newsize); parisize=newsize;
!   longjmp(local_environnement, 0);
  }
  
  /* print a sequence of (NULL terminated) GEN */
--
Karim Belabas                          e-mail:
Max-Planck-Institut fuer Mathematik       karim@mpim-bonn.mpg.de
Gottfried-Claren-Str. 26               tel:
53225 Bonn (Germany)                      (00 49 228) 402-245