Changeset 127


Ignore:
Timestamp:
Dec 16, 2003, 10:13:26 AM (21 years ago)
Author:
Gary Byers
Message:

minor changes

Location:
trunk/ccl/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/examples/apple-objc.lisp

    r92 r127  
    195195    (let* ((string (read stream)))
    196196      (check-type string string)
    197       `(@ ,string))))
    198  *objc-readtable*)
     197      `(@ ,string)))))
    199198
    200199
     
    320319;;; there'd have to be some macrology to handle common cases, since we
    321320;;; 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.
    322324
    323325(defmacro objc-message-send (receiver selector-name &rest argspecs)
  • trunk/ccl/examples/gnu-objc.lisp

    r123 r127  
    235235;;; Registering named objc classes.
    236236
     237
    237238(defun objc-class-name-string (name)
    238239  (etypecase name
     
    243244;;; lookup once per session (in general.)
    244245(defun lookup-objc-class (name &optional error-p)
    245   (with-cstrs ((cstr name))
     246  (with-cstrs ((cstr (objc-class-name-string name)))
    246247    (let* ((p (#_objc_lookup_class cstr)))
    247248      (if (%null-ptr-p p)
     
    286287  (let* ((name (objc-class-name-string name)))
    287288    `(the (@metaclass ,name) (%objc-class-classptr ,(objc-class-descriptor name)))))
    288 
    289289
    290290;;; This isn't quite the inverse operation of LOOKUP-OBJC-CLASS: it
     
    343343  `(load-objc-selector ,(objc-selector-name s)))
    344344
    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.
    347357(defmacro objc-message-send (receiver selector-name &rest argspecs)
    348358  (when (evenp (length argspecs))
     
    573583              arg-info))))
    574584
    575 (defun %make-method-vector ()
    576   (let* ((method-vector (malloc 16)))
    577     (setf (%get-signed-long method-vector 0) 0
    578           (%get-signed-long method-vector 4) 0
    579           (%get-signed-long method-vector 8) 0
    580           (%get-signed-long method-vector 12) -1)
    581     method-vector))
    582  
    583585
    584586;;; Make a meta-class object (with no instance variables or class
    585587;;; methods.)
    586588(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)))
    602603
    603604(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
    606606                 :class_pointer metaptr
    607607                 :super_class superptr
     
    611611                 :instance_size instance-size
    612612                 :ivars ivars
    613                  :methods method-vector
     613                 :methods (%null-ptr)
    614614                 :dtable (%null-ptr)
    615                  :protocols (%null-ptr))))
     615                 :protocols (%null-ptr)))
    616616
    617617(defstruct objc-class-info
Note: See TracChangeset for help on using the changeset viewer.