| Line | |
|---|
| 1 | ;; selector-utils.lisp
|
|---|
| 2 |
|
|---|
| 3 | (defpackage :interface-utilities
|
|---|
| 4 | (:nicknames :iu)
|
|---|
| 5 | (:export get-selector find-selector-match))
|
|---|
| 6 |
|
|---|
| 7 | (in-package :iu)
|
|---|
| 8 |
|
|---|
| 9 | (defun get-selector (name)
|
|---|
| 10 | ;; we can't use the @selector macro for some uses because it requires a literal name
|
|---|
| 11 | ;; argument and sometimes we want to take a name passed in as a parameter and cause it
|
|---|
| 12 | ;; to be registered as an objective C selector name. We could do this directly with
|
|---|
| 13 | ;; a call to the C function #_sel_get_uid and let lisp figure it out for itself later
|
|---|
| 14 | ;; but we'll play nice with the objective C bridge instead which hashes these things.
|
|---|
| 15 | (ccl::%get-selector (ccl::ensure-objc-selector name)))
|
|---|
| 16 |
|
|---|
| 17 | (defun find-selector-match (sel)
|
|---|
| 18 | (maphash #'(lambda (key val)
|
|---|
| 19 | (when (eql (ccl::objc-selector-%sel val) sel)
|
|---|
| 20 | (return-from find-selector-match key)))
|
|---|
| 21 | ccl::*objc-selectors*))
|
|---|
| 22 |
|
|---|
| 23 | (provide :selector-utils)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.