gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] Error compiling functions w/ (declare (integer x)) prese


From: Camm Maguire
Subject: Re: [Gcl-devel] Error compiling functions w/ (declare (integer x)) present
Date: 07 Jun 2002 10:39:28 -0400

Greetings!

Yes, I'm aware of this issue that first appeared (to me) in R. Toy's
f2cl-lib.lsp.  It seemed that Dr. Schelter was in the process of
redoing the bignum gmp support when he died.  Pari and gmp were setup
as alternatives.  The gmp was not quite finished.

Basically, I (or someone else) just need(s) to write two routines to
copy and replace integers using the gmp bignum structure.  I've
started on this, but if anyone else wants to take this on, let me know
and I'll do something else.  Might have a patch in a few days.

(Specifics: we need gmp analogs for the following (referring to
routines in pari_big.c):

GEN otoi();
#define ISETQ_FIX(a,b,c) isetq_fix(a,c)
void isetq_fix();
#ifdef HAVE_ALLOCA
#define SETQ_II(var,alloc,val) \
  do{GEN _xx =(val) ; \
  int _n = replace_copy1(_xx,var); \
  if(_n) var = replace_copy2(_xx,alloca(_n));}while(0)

#define SETQ_IO(var,alloc,val) {object _xx =(val) ; \
                              int _n = obj_replace_copy1(_xx,var); \
                            if(_n) var = obj_replace_copy2(_xx,alloca(_n));}
#define IDECL(a,b,c) our_ulong b[4];a =(b[0]=0x1010000 +4,b) ; object c
#else
GEN setq_io(),setq_ii();
#define SETQ_IO(x,alloc,val)   (x)=setq_io(x,&alloc,val)
#define SETQ_II(x,alloc,val)   (x)=setq_ii(x,&alloc,val)
#define IDECL(a,b,c) our_ulong b[4];a =(b[0]=0x1010000 +4,b);object c
#endif
)


Take care,

John Jorgensen <address@hidden> writes:

> When I try to compile functions that declare integers, I get errors. They
> interpret just fine, but they don't compile. here is an example;
> ====================================
> (defun pi-inv (bits &aux (m 0))
>   (declare (integer bits m))
>   (let* ((n (+ bits (integer-length bits) 11))
>          (tt (truncate (ash 1 n) 882))
>          (d (* 4 882 882))
>          (s 0))
>     (declare (integer s d tt n))
>     (do ((i 2 (+ i 2))
>          (j 1123 (+ j 21460)))
>         ((zerop tt) (cons s (- (+ n 2))))
>       (declare (integer i j))
>         (setq s (+ s (* j tt))
>               m (- (* (- i 1) (- (* 2 i) 1) (- (* 2 i) 3)))
>               tt (truncate (* m tt) (* d (the integer (expt i 3))))))))
> ==========================
> 
> Right from the bugnum examples in the GCL documentation. running
> (compile 'pi-inv) produces the following errors;
> ==========================
> >(compile 'pi-inv)
> 
> Compiling gazonk1.lsp.
> End of Pass 1.  
> End of Pass 2.  
> gazonk1.c: In function `L1':
> gazonk1.c:3002: `GEN' undeclared (first use in this function)
> gazonk1.c:3002: (Each undeclared identifier is reported only once
> gazonk1.c:3002: for each function it appears in.)
> gazonk1.c:3002: parse error before `V1'
> gazonk1.c:3004: `V1' undeclared (first use in this function)
> gazonk1.c:3004: `V1alloc' undeclared (first use in this function)
> gazonk1.c:3007: parse error before `register'
> gazonk1.c:3008: `V2' undeclared (first use in this function)
> gazonk1.c:3008: `V2alloc' undeclared (first use in this function)
> gazonk1.c:3009: parse error before `register'
> gazonk1.c:3010: parse error before `register'
> gazonk1.c:3011: parse error before `V5'
> gazonk1.c:3012: parse error before `register'
> gazonk1.c:3023: `save_avma' undeclared (first use in this function)
> gazonk1.c:3024: `V3' undeclared (first use in this function)
> gazonk1.c:3024: `V3alloc' undeclared (first use in this function)
> gazonk1.c:3024: `restore_avma' undeclared (first use in this function)
> gazonk1.c:3036: `V4' undeclared (first use in this function)
> gazonk1.c:3036: `V4alloc' undeclared (first use in this function)
> gazonk1.c:3044: `V5' undeclared (first use in this function)
> gazonk1.c:3044: `V5alloc' undeclared (first use in this function)
> gazonk1.c:3045: `V6' undeclared (first use in this function)
> gazonk1.c:3045: `V6alloc' undeclared (first use in this function)
> gazonk1.c:3046: parse error before `register'
> gazonk1.c:3047: parse error before `register'
> gazonk1.c:3048: `V7' undeclared (first use in this function)
> gazonk1.c:3048: `V7alloc' undeclared (first use in this function)
> gazonk1.c:3049: `V8' undeclared (first use in this function)
> gazonk1.c:3049: `V8alloc' undeclared (first use in this function)
> 
> Correctable error: (SYSTEM "(cd . ;gcc -pipe -fwritable-strings
> -DVOL=volatile -I/opt/dl/gcl/o -fsigned-char  -O -c -I. gazonk1.c
> -w)") returned a non-zero value 0.
> Signalled by UNLESS.
> If continued: Continues anyway.
> Broken at CERROR.  Type :H for Help.
> >>
> ============================
> 
> If I remove the declares, it compiles just fine. It looks like this is
> what is keeping CLX from compiling. GEN looks like it's supposed to be a
> long, but I'm not sure.
> 
> J*
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

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