William Brew <[EMAIL PROTECTED]> writes:

> Anybody know how to
> 
> - get and set the global value of a special variable?
> 
> - determine if the current binding is the global binding?
> 
> Thanks.

CMUCL uses shallow binding and stores shadowed values on the "Binding
Stack".  You can print the it with the following function:

(defun print-binding-stack ()
  (do ((bsp (kernel:binding-stack-pointer-sap)
            (sys:sap+ bsp (- (* vm:binding-size vm:word-bytes))))
       (start (sys:int-sap (lisp::binding-stack-start))))
      ((sys:sap<= bsp start))
    (format t "~X:  ~S = ~S~%" 
            (sys:sap-int bsp)
            (kernel:make-lisp-obj 
             (sys:sap-ref-32 bsp (* vm:binding-symbol-slot vm:word-bytes)))
            (kernel:make-lisp-obj
             (sys:sap-ref-32 bsp (* vm:binding-value-slot vm:word-bytes))))))

The binding is global if the symbol is not on the binding stack.

Helmut.

Reply via email to