12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- (define-module (Swig swigrun))
- (define-module (Swig common)
- #:use-module (oop goops)
- #:use-module (Swig swigrun))
- (define-class <swig-metaclass> (<class>)
- (new-function #:init-value #f))
- (define-method (initialize (class <swig-metaclass>) initargs)
- (slot-set! class 'new-function (get-keyword #:new-function initargs #f))
- (next-method))
- (define-class <swig> ()
- (swig-smob #:init-value #f)
- #:metaclass <swig-metaclass>
- )
- (define-method (initialize (obj <swig>) initargs)
- (next-method)
- (slot-set! obj 'swig-smob
- (let ((arg (get-keyword #:init-smob initargs #f)))
- (if arg
- arg
- (let ((ret (apply (slot-ref (class-of obj) 'new-function) (get-keyword #:args initargs '()))))
-
-
-
- (if (slot-exists? ret 'swig-smob)
- (slot-ref ret 'swig-smob)
- ret))))))
- (define (display-address o file)
- (display (number->string (object-address o) 16) file))
- (define (display-pointer-address o file)
-
- (let ((address (false-if-exception (SWIG-PointerAddress o))))
- (if address
- (begin
- (display " @ " file)
- (display (number->string address 16) file)))))
- (define-method (write (o <swig>) file)
-
-
-
-
-
- (let ((class (class-of o)))
- (if (slot-bound? class 'name)
- (begin
- (display "#<" file)
- (display (class-name class) file)
- (display #\space file)
- (display-address o file)
- (display-pointer-address o file)
- (display ">" file))
- (next-method))))
-
- (export <swig-metaclass> <swig>)
|