gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] Gcl 2.6.8


From: Camm Maguire
Subject: Re: [Gcl-devel] Gcl 2.6.8
Date: Fri, 14 Jun 2013 09:48:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Greetings, and thanks for your report!

This is fixed in the below rendition of lsp/gcl_sharp.lsp, shortly to be
committed.   Thanks!  (Never thought #1=nil would be used :-)

=============================================================================
(in-package :si)

(defstruct
  context
  (vec (make-array 0 :adjustable t :fill-pointer t) :type (vector t))
  (hash nil :type (or null hash-table))
  (spice (make-hash-table :test 'eq :rehash-size 2.0) :type hash-table))

(defun get-context (i)
  (declare (fixnum i))
  (when *sharp-eq-context*
    (let ((v (context-vec *sharp-eq-context*)))
      (if (< i (length v)) (aref v i)
        (let ((h (context-hash *sharp-eq-context*)))
          (when h (values (gethash i h))))))))

(defconstant +empty+ (cons nil nil))

(defun push-context (i)
  (declare (fixnum i))
  (unless *sharp-eq-context* (setq *sharp-eq-context* (make-context)))
  (let* ((v (context-vec *sharp-eq-context*))(l (length v))(x (cons nil 
+empty+)))
    (cond ((< i l) (error "Bad index ~s in push-context" i))
          ((= i l) (vector-push-extend x v (1+ l)) x)
          ((let ((h (context-hash *sharp-eq-context*)))
             (if h (multiple-value-bind (r f) (gethash i h) (when f (error 
"Duplicate #= definition ~s" i)))
               (setf (context-hash *sharp-eq-context*) (setq h (make-hash-table 
:test 'eql :rehash-size 2.0))))
             (setf (gethash i h) x))))))

(defun sharp-eq-reader (stream subchar i &aux (x (push-context i)))
  (declare (ignore subchar)(fixnum i))
  (prog1 (setf (car x) (read stream t 'eof t))
    (when (eq (car x) (cdr x)) (error "Read +empty+ in sharp-eq ~s" x))))

(defun sharp-sharp-reader (stream subchar i &aux (x (get-context i)))
  (declare (ignore stream subchar)(fixnum i))
  (unless x (error "#= index ~s undefined" i))
  (if (eq (cdr x) +empty+) (let ((s (alloc-spice))) (setf (gethash s 
(context-spice *sharp-eq-context*)) x (cdr x) s)) (cdr x)))

(defun patch-sharp (x) 
  (typecase
   x
   (cons (setf (car x) (patch-sharp (car x)) (cdr x) (patch-sharp (cdr x))) x)
   ((vector t)
    (dotimes (i (length x) x)
      (setf (aref x i) (patch-sharp (aref x i)))))
   ((array t)
    (dotimes (i (array-total-size x) x)
      (aset1 x i (patch-sharp (row-major-aref x i)))))
   (structure
    (let ((d (structure-def x))) 
      (dotimes (i (structure-length x) x)
        (declare (fixnum i))
        (structure-set x d i (patch-sharp (structure-ref x d i))))))
   (spice (multiple-value-bind (r f) (gethash x (context-spice 
*sharp-eq-context*)) 
            (if f (car r) (error "#= spice ~s undefined" x))))
   (otherwise x)))

(set-dispatch-macro-character #\# #\= #'sharp-eq-reader)
(set-dispatch-macro-character #\# #\# #'sharp-sharp-reader)
=============================================================================


Waldek Hebisch <address@hidden> writes:

> After disabling xgcl I was able to build gcl on Debian 6.0.
> However, the compiler fails to build FriCAS.  I get
> "Caught fatal error [memory may be damaged]" message when
> compiling 'btscan2.clisp" file.  This used executable
> image with liked in extra functionality needed by FriCAS.
> It seems that I am able to reproduce problem also outside
> FriCAS.  Namely, the attached "bts5.clisp" file gives
> me the same error when compiled by plain gcl.
>
>>(compile-file "bts5.clisp")
> <snip>
> ;; Warning: DOUBLE (in lisp package) is called as a function--not yet defined
> Error in EVAL [or a callee]: Caught fatal error [memory may be damaged]
>
> GCL was configured using the following line:
>
> ./configure --enable-ansi --prefix /mnt/lv0/fricas/usr --disable-xgcl > clogg 
> 2>&1

-- 
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]