Iwao KIMURA on Mon, 04 Mar 2002 22:44:16 +0900 (JST)

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

Re: flisseq() and filtre()


I tested the behavior of filter() of today's CVS version (es.c is of
the version string: $Id: es.c,v 1.75 2002/02/27 20:30:34 karim Exp $)
and found that it acted as we expected.

From: Karim BELABAS <Karim.Belabas@math.u-psud.fr>
Subject: Re: flisseq() and filtre()
Date: Thu, 21 Feb 2002 22:05:04 +0100 (MET)

> So I have rewritten the filtering code in the cvs unstable branch, so that
> filtre() handles the whole of it, removing all pre/postprocessing code from
> gp.c [ which used to handle line-continuation items, like braces or '\' ]. In
> the process, filtre() has also becom reentrant [ there used to be hidden
> static state variables ].

Reentrance is nice. But pari library itself seems far from being
reentrant (almost all function calls touch pari stack, so almost all
function calls may be critical).

> Please, check whether it solves your problems and that you don't run into
> anything unexpected.

Thanks again. It works fine.

By the way, I now wonder the behavior of lisGEN(). This function reads
a line from a file (given by FILE pointer), evaluates the line and
returns its result. If the line ends with line-continuation `\', it is
natural that lisGEN() reads the next line. So I propose the following

iwao@kagemaru:~/Lang/C/Pari/pari {897}$ cvs -z 5 diff -u src/language/es.c
Index: src/language/es.c
RCS file: /home/megrez/cvsroot/pari/src/language/es.c,v
retrieving revision 1.75
diff -u -r1.75 es.c
--- src/language/es.c   2002/02/27 20:30:34     1.75
+++ src/language/es.c   2002/03/04 13:28:14
@@ -168,7 +168,7 @@
   while (fgets(s, n, fi))
-    if (s[strlen(s)-1] == '\n')
+    if (s[strlen(s)-1] == '\n' && s[strlen(s) - 2] != '\\')
       GEN x = flisexpr(buf);
       free(buf); return x;

Well, I could not find any reason why flisexpr() is used instead of
using flisseq()...


	;#	Iwao KIMURA			;#
	;#	Faculty. Math, Dept. of Sciece	;#
	;#	Toyama University		;#