Added g-quark
authorDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Wed, 25 Feb 2009 12:16:18 +0000 (15:16 +0300)
committerDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Wed, 25 Feb 2009 12:16:18 +0000 (15:16 +0300)
glib/glib.asd
glib/glib.lisp
glib/glib.quark.lisp [new file with mode: 0644]

index fba497c..5612f1b 100644 (file)
@@ -6,6 +6,7 @@
                (:file "glib.glist")
                (:file "glib.gstrv")
                (:file "glib.string")
+               (:file "glib.quark")
                (:file "gobject.package")
                (:file "gobject.structs")
                (:file "gobject.type")
index 64415f4..f3788d6 100644 (file)
@@ -14,7 +14,8 @@
            #:g-malloc
            #:g-strdup
            #:g-string
-           #:gslist))
+           #:gslist
+           #:g-quark))
 
 (in-package :glib)
 
diff --git a/glib/glib.quark.lisp b/glib/glib.quark.lisp
new file mode 100644 (file)
index 0000000..ba1488b
--- /dev/null
@@ -0,0 +1,20 @@
+(in-package :glib)
+
+(defctype quark-value-type :uint32)
+
+(defcfun g-quark-from-string quark-value-type
+  (string :string))
+
+(defcfun g-quark-to-string :string
+  (quark quark-value-type))
+
+(define-foreign-type quark-type ()
+  ()
+  (:actual-type quark-value-type)
+  (:simple-parser g-quark))
+
+(defmethod translate-to-foreign (value (type quark-type))
+  (g-quark-from-string value))
+
+(defmethod translate-from-foreign (value (type quark-type))
+  (g-quark-to-string value))
\ No newline at end of file