| Bill Allombert on Wed, 15 Jan 2003 19:53:08 +0100 | 
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| GP2C 0.0.2pl4 released | 
Hello PARI developers, I just released GP2C 0.0.2pl4, the GP to C translator. You can download it at <ftp://megrez.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-0.0.2pl4.tar.gz> GP2C is a compiler for GP-scripts that output C code to be linked with libpari or instal'ed in GP. It can be used to compile and run a GP script, to learn how to use the PARI library, or to check a script for mistakes. This is a bugfix release to fix problems reported by John Cremona. This version also solve in part the compatibility issue with PARI CVS. GP2C needs a way to convert strings and GEN to t_STR GEN. The only way I know of with pari 2.1 is to use strtoGENstr. Unfortunately Karim has changed this function in the CVS to take only one argument instead of two, which breaks gp2c. I have fixed gp2c to use the description system when doing type-casting, by reading the file desc/gp2cfunc.desc so a new version of this file is required with current CVS. Please find it in attachment. We are looking for a better solution, but in the meantime sorry for the annoyance. Cheers, Bill.
_avma:
 ():ulong	avma
;
_stack_lim:
 (ulong,small):ulong	 stack_lim($1, $2)
;
_maxprime:
 ():small	maxprime()
;
_badtype:
 (int):bool:parens      typ($1) != t_INT
|(real):bool:parens     typ($1) != t_REAL
|(mp):negbool           is_intreal($1)
|(vec):negbool          is_matvec_t(typ($1))
|(vecsmall):bool:parens typ($1) != t_VECSMALL
|(pol):bool:parens      typ($1) != t_POL
|(*nf):nf:parens        $1=checknf($1)
|(*bnf):bnf:parens      $1=checkbnf($1)
|(bnr):bnf              checkbnr($1)
|(prid):void            checkprimeid($1)
|(@clgp):bool:parens    lg($1) != 3 || typ($(1)[2]) != t_POLMOD
|(ell):lg               checkell($1)
|(bell):void            checkbell($1)
#checkgal is not in the PARI 2.1 headers...
#|(*gal):gal:parens      $1=checkgal($1)
;
# Use type void for inline value
_formatcode:
 (#small):void          $1
|(small):small          %ld
|(#str):void            $%1
|(str):str              %s
|(gen):gen              %Z
;
#_toGENstr:
# (str):genstr   strtoGENstr($1, 0)
#|(gen):genstr   concat(strtoGENstr("", 0), $1)
#;
_toGENstr:
(str):genstr   strtoGENstr($1)
|(gen):genstr   concat(strtoGENstr(""), $1)
;
copy:
 (small):small:parens	$1
|(int):int		icopy($1)
|(real):real		gcopy($1)
|(mp):mp		gcopy($1)
|(vecsmall):vecsmall	gcopy($1)
|(vec):vec		gcopy($1)
|(pol):pol		gcopy($1)
|(gen):gen		gcopy($1)
;
clone:
 (small):small:parens		$1
|(int):int		gclone($1)
|(real):real		gclone($1)
|(mp):mp		gclone($1)
|(vecsmall):vecsmall	gclone($1)
|(vec):vec		gclone($1)
|(pol):pol		gclone($1)
|(gen):gen		gclone($1)
;
unclone:
# avoid semi-comma trouble.
 (small):void	0 /*unclone*/
|(gen):void	gunclone($1)
;
# type0 is  not in libpari
type:
 (gen):typ	 typ($1)
;
whatnow:
 (str):void        whatnow($1, 0)
;
write:
 (gen,gen):void    geval(concat(concat(concat(concat(strtoGENstr("write("), $1), strtoGENstr(",")), $2), strtoGENstr(")")))
;
write1:
 (gen,gen):void    geval(concat(concat(concat(concat(strtoGENstr("write1("), $1), strtoGENstr(",")), $2), strtoGENstr(")")))
;
writetex:
 (gen,gen):void    geval(concat(concat(concat(concat(strtoGENstr("writetex("), $1), strtoGENstr(",")), $2), strtoGENstr(")")))
;
printp:
 (gen):void        geval(concat(concat(strtoGENstr("printp("), $1), strtoGENstr(")")))
;
printp1:
 (gen):void        geval(concat(concat(strtoGENstr("printp1("), $1), strtoGENstr(")")))
;
printtex:
 (gen):void        geval(concat(concat(strtoGENstr("printtex("), $1), strtoGENstr(")")))
;