projects
/
cl-gtk2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add compiler-macro that handles gtype calls with constant args
[cl-gtk2.git]
/
glib
/
gobject.type-designator.lisp
diff --git
a/glib/gobject.type-designator.lisp
b/glib/gobject.type-designator.lisp
index
d31af2e
..
ebd1925
100644
(file)
--- a/
glib/gobject.type-designator.lisp
+++ b/
glib/gobject.type-designator.lisp
@@
-75,13
+75,21
@@
(gethash n *id-to-gtype*) gtype)
n)))
(gethash n *id-to-gtype*) gtype)
n)))
-(defun gtype (thing)
+(defun %gtype (thing)
(etypecase thing
(null nil)
(gtype thing)
(string (gtype-from-name thing))
(integer (gtype-from-id thing))))
(etypecase thing
(null nil)
(gtype thing)
(string (gtype-from-name thing))
(integer (gtype-from-id thing))))
+(defun gtype (thing)
+ (%gtype thing))
+
+(define-compiler-macro gtype (&whole whole thing)
+ (if (constantp thing)
+ `(load-time-value (%gtype ,thing))
+ whole))
+
(define-foreign-type g-type-designator ()
((mangled-p :initarg :mangled-p
:reader g-type-designator-mangled-p
(define-foreign-type g-type-designator ()
((mangled-p :initarg :mangled-p
:reader g-type-designator-mangled-p