sharplispers / clx

a fork of crhodes' fork of danb's fork of the CLX library, an X11 client for Common Lisp
Other
114 stars 46 forks source link

The function XLIB::|Internal-Copy-GCONTEXT-TRAPEZOID-ALIGNMENT| is undefined. #78

Closed TeMPOraL closed 7 years ago

TeMPOraL commented 7 years ago

There's a weird thing happening w/ recompiling vs. just loading CLX.

On a fresh SBCL 1.3.19 the following happens for me:

Rebuilding CLX:

CL-USER> (asdf:load-system :clx :force t)
T
CL-USER> xlib::*gcontext-extensions*
(#(:TRAPEZOID-ALIGNMENT :X XLIB::|Internal-Set-GCONTEXT-TRAPEZOID-ALIGNMENT|
   XLIB::|Internal-Copy-GCONTEXT-TRAPEZOID-ALIGNMENT|))

But after restarting and loading without rebuilding:

CL-USER> (asdf:load-system :clx)
T
CL-USER> xlib::*gcontext-extensions*
NIL

In both cases:

CL-USER> (describe 'XLIB::|Internal-Copy-GCONTEXT-TRAPEZOID-ALIGNMENT|)
XLIB::|Internal-Copy-GCONTEXT-TRAPEZOID-ALIGNMENT|
  [symbol]
; No value

i.e. the symbol is in particular not fbound. The entry in *gcontext-extensions* is, however, used later by CLX via funcall, resulting in the reported error.

The problem disappears (i.e. *gcontext-extensions* stays NIL after recompiling CLX) when I comment out loading demo/zoid.lisp and test/trapezoid.lisp in the ASD file, which suggests it's the zoid demo that's interfering with compilation of the library.

uint commented 7 years ago

The demo and test files don't seem to be loaded automatically. As far as I can tell, the problem is that demo/zoid.lisp expands the define-gcontext-accessor macro during compilation, like so:

(define-gcontext-accessor trapezoid-alignment :default :x
  :set-function set-trapezoid-alignment)

The define-gcontext-accessor macro definition (in gcontext.lisp) has this eval-when block:

(eval-when (:compile-toplevel :load-toplevel :execute)
     (defparameter ,internal-state-index
               (add-gcontext-extension ',key-name ,default ',internal-set-function
                           ',internal-copy-function))
     ) ;; end eval-when

I have no idea what to do with this, though. Just removing :compile-toplevel makes the whole thing fail to build.

TeMPOraL commented 7 years ago

My vote is to move demos and tests into separate systems (the latter probably depending on the former) - this way demos and tests will never unexpectedly pollute the Lisp image used to compile the CLX proper.

dkochmanski commented 7 years ago

fixed.