ï--RESENDING...Not convinced this made it out the first time---

Iâm having trouble with making alien arrays.  If I specify something 
like:

(defvar shadow-alien-arguments1
        (alien:make-alien
               (alien:array alien:single-float 10)))

It seems to work fine.

If instead I try to pass in something other than a plain number, it 
fails:

;    First dimension is not a non-negative fixnum or NIL: MYLEN

See the form below which attempts to defvar shadow-alien-arguments2.

Am I missing something?  Why isnât the result of a function call like 
(list-length blah) considered a FIXNUM?

Thanks,

--Andrew

CMU Common Lisp 19a, running on dominicks
With core: /usr/lib/cmucl/lib/lisp.core
Dumped on: Wed, 2004-07-28 09:51:48-07:00 on lorien
See <http://www.cons.org/cmucl/> for support information.
Loaded subsystems:
    Python 1.1, target Intel x86
    CLOS based on Gerd's PCL 2004/04/14 03:32:47
* ; here's a list
(defvar shadow-arguments '(1.00232 2.2 3 324.5))

SHADOW-ARGUMENTS
* ; compute the length and save as "mylen"
(defvar mylen (list-length shadow-arguments))

MYLEN
* (print mylen)

4 4
* ; try to make an alien array of the same length

(defvar shadow-alien-arguments1
        (alien:make-alien
               (alien:array alien:single-float 10)))

SHADOW-ALIEN-ARGUMENTS1
* (defvar shadow-alien-arguments2
        (alien:make-alien
               (alien:array alien:single-float mylen)))

; In: UNLESS (BOUNDP 'SHADOW-ALIEN-ARGUMENTS2)

;   (ALIEN:MAKE-ALIEN (ARRAY SINGLE-FLOAT MYLEN))
; Error: (during macroexpansion)
; ; Error in function ALIEN::ALIEN-ARRAY-TYPE-TRANSLATOR:
;    First dimension is not a non-negative fixnum or NIL: MYLEN

Execution of a form compiled with errors:
 (ALIEN:MAKE-ALIEN (ARRAY SINGLE-FLOAT MYLEN))
   [Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]

Restarts:
  0: [ABORT] Return to Top-Level.

Debug  (type H for help)

("Top-Level Form")[:TOP-LEVEL]
Source: (SETQ SHADOW-ALIEN-ARGUMENTS2
                (ALIEN:MAKE-ALIEN (ARRAY SINGLE-FLOAT MYLEN)))
0]



Reply via email to