I'm pretty sure GCL's 'defentry' will automatically generate
declarations.

1. When I generate extra "clines" before "defentry", I can get error:

   error: static declaration of ‘writeablep’ follows non-static declaration

(I was intentionally using "clines" to generate "static" declarations
here.)

2. From GCL source code gcl/cmpnew/gcl_cmptop.lsp:

=====
(defmacro defentry (n args c &optional (lt t)
                      &aux (tsyms (load-time-value
(mapl (lambda (x) (setf (car x) (gensym "DEFENTRY"))) (make-list call-arguments-limit)))))
  (let* ((cp (consp c))
         (st (and cp (eq (car c) 'static)))
         (c (if st (cdr c) c))
         (m (if cp (cadr c) c))
         (m (if (symbolp m) (string-downcase m) m))
         (rt (intern (symbol-name (if cp (car c) lt)) 'keyword))
(tps (mapcar (lambda (x) (intern (string (if (consp x) (car x) x)) 'keyword)) args)) (decl (reduce (lambda (y x) (strcat y (if (> (length y) 0) "," "") x)) args :initial-value "")) (decl (concatenate 'string (string-downcase rt) " " m "(" decl ");"))
         (decl (if st "" decl))
(syms (mapcar (lambda (x) (declare (ignore x)) (pop tsyms)) args)))
  `(defun ,n ,syms
     (declare (optimize (safety 2)))
,@(mapcar (lambda (x y) `(check-type ,x ,(get y 'lisp-type))) syms tps)
     (lit ,(if (eq rt :void) :object rt)
          "({" ,decl
          ,@(when (eq rt :void) `("("))
          ,m "("
          ,@(mapcon (lambda (x y z) `((,(car z) ,(car y))
,(if (cdr x) (if (consp (car x)) "+" ",") ""))) args syms tps)
          ")"
          ,@(when (eq rt :void) `(",Cnil)"))
          ";})"))))
=====

I can't confirm it in interpreter by macroexpand because "defentry"
doesn't work in interpreter.

But I'm 99% sure that GCL did generate declarations by itself.

- Qian

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/234010fe-e4d2-4e14-b720-a48bb9b7cbc1%40gmail.com.

Reply via email to