Changeset 127
- Timestamp:
- Dec 16, 2003, 10:13:26 AM (21 years ago)
- Location:
- trunk/ccl/examples
- Files:
-
- 2 edited
-
apple-objc.lisp (modified) (2 diffs)
-
gnu-objc.lisp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/apple-objc.lisp
r92 r127 195 195 (let* ((string (read stream))) 196 196 (check-type string string) 197 `(@ ,string)))) 198 *objc-readtable*) 197 `(@ ,string))))) 199 198 200 199 … … 320 319 ;;; there'd have to be some macrology to handle common cases, since we 321 320 ;;; want the compiler to see all of the args in a foreign call. 321 322 ;;; I don't remmber what the second half of the above comment might 323 ;;; have been talking about. 322 324 323 325 (defmacro objc-message-send (receiver selector-name &rest argspecs) -
trunk/ccl/examples/gnu-objc.lisp
r123 r127 235 235 ;;; Registering named objc classes. 236 236 237 237 238 (defun objc-class-name-string (name) 238 239 (etypecase name … … 243 244 ;;; lookup once per session (in general.) 244 245 (defun lookup-objc-class (name &optional error-p) 245 (with-cstrs ((cstr name))246 (with-cstrs ((cstr (objc-class-name-string name))) 246 247 (let* ((p (#_objc_lookup_class cstr))) 247 248 (if (%null-ptr-p p) … … 286 287 (let* ((name (objc-class-name-string name))) 287 288 `(the (@metaclass ,name) (%objc-class-classptr ,(objc-class-descriptor name))))) 288 289 289 290 290 ;;; This isn't quite the inverse operation of LOOKUP-OBJC-CLASS: it … … 343 343 `(load-objc-selector ,(objc-selector-name s))) 344 344 345 346 345 ;;; A selector isn't just a canonicalized cstring in GNU ObjC, but 346 ;;; we can get our hands on the underlying cstring fairly easily. 347 (defun lisp-string-from-sel (sel) 348 (%get-cstring (#_sel_get_name sel))) 349 350 ;;; #_objc_msgSend takes two required arguments (the receiving object 351 ;;; and the method selector) and 0 or more additional arguments; 352 ;;; there'd have to be some macrology to handle common cases, since we 353 ;;; want the compiler to see all of the args in a foreign call. 354 355 ;;; I don't remmber what the second half of the above comment might 356 ;;; have been talking about. 347 357 (defmacro objc-message-send (receiver selector-name &rest argspecs) 348 358 (when (evenp (length argspecs)) … … 573 583 arg-info)))) 574 584 575 (defun %make-method-vector ()576 (let* ((method-vector (malloc 16)))577 (setf (%get-signed-long method-vector 0) 0578 (%get-signed-long method-vector 4) 0579 (%get-signed-long method-vector 8) 0580 (%get-signed-long method-vector 12) -1)581 method-vector))582 583 585 584 586 ;;; Make a meta-class object (with no instance variables or class 585 587 ;;; methods.) 586 588 (defun %make-basic-meta-class (nameptr superptr rootptr) 587 (let* ((method-vector (%make-method-vector))) 588 (make-record :objc_class 589 :class_pointer (pref rootptr :objc_class.class_pointer) 590 :super_class (pref superptr :objc_class.class_pointer) 591 :name nameptr 592 :version 0 593 :info #$_CLS_META 594 :instance_size 0 595 :ivars (%null-ptr) 596 :methods method-vector 597 :dtable (%null-ptr) 598 :subclass_list (%null-ptr) 599 :sibling_class (%null-ptr) 600 :protocols (%null-ptr) 601 :gc_object_type (%null-ptr)))) 589 (make-record :objc_class 590 :class_pointer (pref rootptr :objc_class.class_pointer) 591 :super_class (pref superptr :objc_class.class_pointer) 592 :name nameptr 593 :version 0 594 :info #$_CLS_META 595 :instance_size 0 596 :ivars (%null-ptr) 597 :methods (%null-ptr) 598 :dtable (%null-ptr) 599 :subclass_list (%null-ptr) 600 :sibling_class (%null-ptr) 601 :protocols (%null-ptr) 602 :gc_object_type (%null-ptr))) 602 603 603 604 (defun %make-class-object (metaptr superptr nameptr ivars instance-size) 604 (let* ((method-vector (%make-method-vector))) 605 (make-record :objc_class 605 (make-record :objc_class 606 606 :class_pointer metaptr 607 607 :super_class superptr … … 611 611 :instance_size instance-size 612 612 :ivars ivars 613 :methods method-vector613 :methods (%null-ptr) 614 614 :dtable (%null-ptr) 615 :protocols (%null-ptr))) )615 :protocols (%null-ptr))) 616 616 617 617 (defstruct objc-class-info
Note:
See TracChangeset
for help on using the changeset viewer.
