[Bese-devel] Re: Is dynamic-forms-demo working in the latest box set? I get a `NIL' is not of the expected type `ARRAY'

Lou Vanek vanek at acd.net
Fri Jun 16 18:17:22 UTC 2006


I downloaded a copy of Allegro 8 express and ran
this in a little window and +string-index-cache+
evaluated properly:

(defvar +string-index-cache+ (make-array 50
                         :element-type 'string
                         :adjustable t))

(map-into +string-index-cache+
             (let ((i -1))
               (lambda ()
                 (princ-to-string (incf i)))))

I think the "modern" option is set but I don't think that
makes a difference.

Anyway, I think this change fixes it.

-lv

Popovich, Thomas wrote:

> I then hacked it further
> First to eval the following live: (to get the string-index-cache
> but when running it it fails - I'm debugging that. 
> First thing that I'm researching is why when I Eval (type-of
> IT.BESE.UCW::+STRING-INDEX-CACHE+) it says FIXNUM.  (sparked by the
> trace back)
> 
> 
> == my eval code ==
> (progn
> 
>   (in-package :it.bese.ucw)
> (defvar +string-index-cache+
>   (map-into (make-array 50
>                         :element-type 'string
>                         :adjustable t)
>             (let ((i -1))
>               (lambda ()
>                 (princ-to-string (incf i))))))
> )
> 
> 
> Then ...
> It dumps even before getting to the spot where I inserted the (break) .
> 
> Error dump: shows bad datatype
> 
> 11: (COND ((<= (LENGTH IT.BESE.UCW::+STRING-INDEX-CACHE+)
> IT.BESE.UCW::I) (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK (1+
> IT.BESE.UCW::I)) (SETF (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I) (PRINC-TO-STRING IT.BESE.UCW::I))) ((NULL (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I)) (SETF (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I) (PRINC-TO-STRING
> IT.BESE.UCW::I))) (T (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I)))
>       Locals:
>         EXCL::X = (((<= (LENGTH IT.BESE.UCW::+STRING-INDEX-CACHE+)
> IT.BESE.UCW::I) (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK (1+
> IT.BESE.UCW::I)) (SETF (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I) (PRINC-TO-STRING IT.BESE.UCW::I))) ((NULL (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I)) (SETF (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I) (PRINC-TO-STRING
> IT.BESE.UCW::I))) (T (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I)))
>         IT.BESE.UCW::I = 0
>         EXCL::LOCAL-0 = (((<= (LENGTH IT.BESE.UCW::+STRING-INDEX-CACHE+)
> IT.BESE.UCW::I) (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK (1+
> IT.BESE.UCW::I)) (SETF (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I) (PRINC-TO-STRING IT.BESE.UCW::I))) ((NULL (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I)) (SETF (AREF
> IT.BESE.UCW::+STRING-INDEX-CACHE+ IT.BESE.UCW::I) (PRINC-TO-STRING
> IT.BESE.UCW::I))) (T (AREF IT.BESE.UCW::+STRING-INDEX-CACHE+
> IT.BESE.UCW::I)))
>         EXCL::LOCAL-1 = COND
>  12: (IT.BESE.UCW::INTEGER-TO-STRING 0)
> 
> 
> 
> -----Original Message-----
> From: Popovich, Thomas 
> Sent: Friday, June 16, 2006 1:35 PM
> To: 'Lou Vanek'
> Subject: RE: Is dynamic-forms-demo working in the latest box set? I get
> a `NIL' is not of the expected type `ARRAY'
> 
> 
> [maybe u can just bcc me and change the email addr to
> tpop.news at gmail.com]
> 
> I was typing this up when your other email came.
> 
> ===
> 
> I hacked the code to allow debugging as shown below.
> ===
> 
> Your hunch was right.  
> 
> As you will see below I hacked it to add a few debug fncts:
> 
> 
> then in emacs I can do this handy inspect trick: 
>  go to the proper SLDB frame and eval an expression( emacs will prompt
> me ... then I've use electric command history to get the thing to reuse
> it quicker)
> 
> here it is:
> (sldb-eval-in-frame "IT.BESE.UCW:: +string-index-cache+ ")
> 
> 
> Looking at the call stack I see:
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>   8: (BREAK)
>   9: (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK=LEVEL-2 1 #<The
> COMMON-LISP-USER package> NIL)
>       Locals:
>         IT.BESE.UCW::I = 1
>         IT.BESE.UCW::P = #<The COMMON-LISP-USER package>
>         IT.BESE.UCW::TC = NIL
>  10: (LET* ((IT.BESE.UCW::PKG *PACKAGE*) (IT.BESE.UCW::TC
> (IT.BESE.UCW::TJP-GET-+STRING-INDEX-CACHE+)))
> (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK=LEVEL-2 IT.BESE.UCW::I
> IT.BESE.UCW::PKG IT.BESE.UCW::TC) (ADJUST-ARRAY
> IT.BESE.UCW::+STRING-INDEX-CACHE+ (1+ IT.BESE.UCW::I)))
>  11: (IT.BESE.UCW::TJP-ADJUST-ARRAY-BREAK 1)
>       Locals:
>         IT.BESE.UCW::I = 1
>  12: (IT.BESE.UCW::INTEGER-TO-STRING 0)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> 
> I doubt that the P var above = #<The COMMON-LISP-USER package> (copy of
> *package*)
> Is a problem right?
> 
> 
> 
> (progn
> 
>   (in-package :it.bese.ucw) ;; hack to enable us to eval this at end of
> progn when *package* is globally some other package
> 
> 
>  
>   (defun tjp-adjust-array-break=level-2 (i p tc) ;; just 3 locals to use
> as watch points
>     (break)
>     )
> 
>  
>   (defun tjp-adjust-array-break (i)
>     (let* (( pkg  *package*)
> 	   ( tc    (tjp-get-+string-index-cache+)))
> 
>       (tjp-adjust-array-break=level-2 i pkg tc)
> 
>       (adjust-array +string-index-cache+ (1+ i)))
>     )
> 
>   ; this did sldb break cmd did not work.
>   ;(sldb-break #'tjp-adjust-array-break)
> 
> 
>   (defun integer-to-string (i)
>     (cond
>       ((<= (length +string-index-cache+) i)
>        (tjp-adjust-array-break (1+ i))
>        ;;(adjust-array +string-index-cache+ (1+ i))  ;; above line is
> used so we can break -- it does the same thing as this commented out
> line
>        (setf (aref +string-index-cache+ i) (princ-to-string i)))
>       ((null (aref +string-index-cache+ i))
>        (setf (aref +string-index-cache+ i) (princ-to-string i)))
>       (t
>        (aref +string-index-cache+ i))))
>   )
> 
> 
> 
> 
> 




More information about the bese-devel mailing list