[Xfce4-commits] <glib-objc:no-foundation-dep> add initial glib wrapper with some utilities

Brian J. Tarricone noreply at xfce.org
Sun Nov 22 04:02:06 CET 2009


Updating branch refs/heads/no-foundation-dep
         to 058838de888fbdcfcace5547a7750a53a49fa346 (commit)
       from e98f4f9043edbd976712a42be026d215d32debd6 (commit)

commit 058838de888fbdcfcace5547a7750a53a49fa346
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Sun Jul 5 14:41:34 2009 -0700

    add initial glib wrapper with some utilities
    
    there's a lot more to do here, but this is a decent start to removing
    the Foundation dep

 Makefile.am                                        |    1 +
 configure.ac.in                                    |   85 ++-----
 glib-objc/GOCComparable.h                          |   33 ++
 glib-objc/GOCHashTable.h                           |  104 +++++++
 glib-objc/GOCHashTable.m                           |  312 ++++++++++++++++++++
 .../glib-objc.h => glib-objc/GOCHashable.h         |   25 +-
 .../glib-objc.h => glib-objc/GOCIterable.h         |   29 +-
 glib-objc/GOCList.h                                |   99 ++++++
 glib-objc/GOCList.m                                |  295 ++++++++++++++++++
 glib-objc/GOCNumber.h                              |   79 +++++
 glib-objc/GOCNumber.m                              |  269 +++++++++++++++++
 glib-objc/GOCObjectBase.h                          |   44 +++
 glib-objc/GOCObjectBase.m                          |   53 ++++
 glib-objc/Makefile.am                              |   44 +++
 glib-objc/glib-objc-2.0.pc.in                      |   13 +
 {gobject-objc => glib-objc}/glib-objc.h            |   20 +-
 gobject-objc/Makefile.am                           |    8 +-
 gobject-objc/gobject-objc-2.0.pc.in                |    6 +-
 18 files changed, 1410 insertions(+), 109 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0c4526e..24b3bbb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,4 @@
 SUBDIRS = \
+	glib-objc \
 	gobject-objc \
     tests
diff --git a/configure.ac.in b/configure.ac.in
index 0eb1718..8078e96 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -6,8 +6,8 @@ dnl Copyright (c) 2008 Brian Tarricone <bjt23 at cornell.edu>
 dnl
 
 dnl version info
-m4_define([libgobject_objc_verinfo], [0:0:0])
-m4_define([libgobject_objc_api_version], [2.0])
+m4_define([glib_objc_verinfo], [0:0:0])
+m4_define([glib_objc_api_version], [2.0])
 m4_define([go_version_major], [0])
 m4_define([go_version_minor], [1])
 m4_define([go_version_micro], [0])
@@ -41,13 +41,23 @@ AC_HEADER_STDC
 
 dnl version information
 GO_VERSION=go_version
-LIBGOBJECT_OBJC_VERINFO=libgobject_objc_verinfo
-LIBGOBJECT_OBJC_API_VERSION=libgobject_objc_api_version
+GLIB_OBJC_VERINFO=glib_objc_verinfo
+GLIB_OBJC_API_VERSION=glib_objc_api_version
 AC_SUBST(GO_VERSION)
-AC_SUBST(LIBGOBJECT_OBJC_VERINFO)
-AC_SUBST(LIBGOBJECT_OBJC_API_VERSION)
+AC_SUBST(GLIB_OBJC_VERINFO)
+AC_SUBST(GLIB_OBJC_API_VERSION)
 
 dnl required
+
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12.0], , [AC_MSG_ERROR([
+*** Glib version 2.12.0 or greater is required.
+*** YOu can download it from http://gtk.org/
+])])
+AC_MSG_CHECKING([GLIB_CFLAGS])
+AC_MSG_RESULT([$GLIB_CFLAGS])
+AC_MSG_CHECKING([GLIB_LIBS])
+AC_MSG_RESULT([$GLIB_LIBS])
+
 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.12.0], , [AC_MSG_ERROR([
 *** GObject (a part of the Glib library) version 2.12.0 or greater is required.
 *** You can download it from http://gtk.org/
@@ -57,67 +67,6 @@ AC_MSG_RESULT([$GOBJECT_CFLAGS])
 AC_MSG_CHECKING([GOBJECT_LIBS])
 AC_MSG_RESULT([$GOBJECT_LIBS])
 
-FOUNDATION_CFLAGS=
-FOUNDATION_LIBS=
-
-AC_ARG_WITH([gnustep],
-            AC_HELP_STRING([--with-gnustep=PREFIX],
-                           [Specify the root of where GNUStep is installed]),
-            [gnustep_root=$withval])
-if test "x$gnustep_root" != "x"; then
-    FOUNDATION_CFLAGS="-I$gnustep_root/System/Library/Headers"
-    if test "x$GCC" = "xyes"; then
-        FOUNDATION_HACK_CFLAGS="-fconstant-string-class=NSConstantString"
-    fi
-    FOUNDATION_LIBS="-L$gnustep_root/System/Library/Libraries -lgnustep-base"
-else
-    dnl check to see if we're on MacOS X
-    case "$host_os" in
-        [macos* | darwin[6-9]* | darwin[1-9][0-9]*)]
-            FOUNDATION_CFLAGS=
-            FOUNDATION_LIBS="-Wl,-framework,Foundation"
-            ;;
-        *)
-            # we should try to search more places
-            FOUNDATION_CFLAGS=
-            FOUNDATION_LIBS="-lgnustep-base"
-            ;;
-    esac
-fi
-
-dnl make sure Foundation works
-AC_MSG_CHECKING([for a working Foundation])
-AC_LANG_PUSH([Objective C])
-saved_OBJCFLAGS="$CFLAGS"
-saved_LIBS="$LIBS"
-OBJCFLAGS="$OBJCFLAGS $FOUNDATION_CFLAGS"
-LIBS="$LIBS $FOUNDATION_LIBS"
-AC_LINK_IFELSE(
-[#include <Foundation/Foundation.h>
-int main() {
-    [[[[NSAutoreleasePool alloc] init] release];]
-    return 0;
-}
-]
-, [AC_MSG_RESULT([yes])],
-[
-AC_MSG_RESULT([no])
-echo '*** A working Foundation library was not found.  If using GNUStep, please'
-echo '*** specify the GNUStep root directory with --with-gnustep.  If compiling'
-echo '*** for MacOS X, file a bug, because this should be figured out automatically.'
-exit 1
-])
-OBJCFLAGS="$saved_OBJCFLAGS"
-LIBS="$saved_LIBS"
-AC_LANG_POP()
-AC_MSG_CHECKING([FOUNDATION_CFLAGS])
-AC_MSG_RESULT([$FOUNDATION_CFLAGS])
-AC_MSG_CHECKING([FOUNDATION_LIBS])
-AC_MSG_RESULT([$FOUNDATION_LIBS])
-AC_SUBST([FOUNDATION_CFLAGS])
-AC_SUBST([FOUNDATION_HACK_CFLAGS])
-AC_SUBST([FOUNDATION_LIBS])
-
 dnl check for debugging support
 AC_ARG_ENABLE([debug],
               [AC_HELP_STRING([--enable-debug=[full|yes|no]],
@@ -145,6 +94,8 @@ AC_MSG_RESULT([$enable_debug])
 
 AC_OUTPUT([
 Makefile
+glib-objc/Makefile
+glib-objc/glib-objc-2.0.pc
 gobject-objc/Makefile
 gobject-objc/gobject-objc-2.0.pc
 tests/Makefile
diff --git a/glib-objc/GOCComparable.h b/glib-objc/GOCComparable.h
new file mode 100644
index 0000000..5156add
--- /dev/null
+++ b/glib-objc/GOCComparable.h
@@ -0,0 +1,33 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+
+#ifndef __GOC_COMPARABLE_H__
+#define __GOC_COMPARABLE_H__
+
+#import <glib-objc/GOCObjectBase.h>
+
+ at protocol GOCComparable<GOCObject>
+
+- (int)compareTo:(id <GOCComparable>)otherComparable;
+- (BOOL)isEqualTo:(id <GOCComparable>)otherComparable;
+
+ at end
+
+#endif  /* __GOC_COMPARABLE_H__ */
diff --git a/glib-objc/GOCHashTable.h b/glib-objc/GOCHashTable.h
new file mode 100644
index 0000000..c2cb6b7
--- /dev/null
+++ b/glib-objc/GOCHashTable.h
@@ -0,0 +1,104 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __GOC_HASH_TABLE_H__
+#define __GOC_HASH_TABLE_H__
+
+#include <glib.h>
+
+#import <glib-objc/GOCObjectBase.h>
+#import <glib-objc/GOCHashable.h>
+#import <glib-objc/GOCIterable.h>
+
+#import <glib-objc/GOCList.h>
+
+ at interface GOCHashTableEntry : Object
+{
+  @public
+    id key;
+    id value;
+}
+ at end
+
+ at interface GOCHashTableIter : Object <GOCIter>
+{
+  @private
+    void *ghti_ptr;
+    GOCHashTableEntry *lastEntry;
+}
+
+- (id)next;
+
+ at end
+
+ at interface GOCHashTable : GOCObjectBase <GOCIterable>
+{
+  @private
+    void *ght_ptr;
+}
+
+- (void)insertObject:(id <GOCObject>)object
+              forKey:(id <GOCHashable>)key;
+- (void)replaceObject:(id <GOCObject>)object
+               forKey:(id <GOCHashable>)key;
+
+- (BOOL)removeObjectForKey:(id <GOCHashable>)key;
+- (void)removeAll;
+
+- (id)stealObjectForKey:(id <GOCHashable>)key;
+- (void)stealAll;
+
+- (id)lookupForKey:(id <GOCHashable>)key;
+- (id)lookupForKey:(id <GOCHashable>)key
+    getOriginalKey:(id *)originalKey;
+
+- (void)runSelectorForEach:(SEL)selector
+                  onObject:(id)object
+                  withData:(id)userData;
+- (void)runFunctionForEach:(GHFunc)func
+                  withData:(id)userData;
+
+- (unsigned int)removeBySelector:(SEL)selector
+                        onObject:(id)object
+                        withData:(id)userData;
+- (unsigned int)removeByFunction:(GHRFunc)func
+                         withata:(id)userData;
+
+- (unsigned int)stealBySelector:(SEL)selector
+                       onObject:(id)object
+                       withData:(id)userData;
+- (unsigned int)stealByFunction:(GHRFunc)func
+                       withData:(id)userData;
+
+- (id)findBySelector:(SEL)selector
+            onObject:(id)object
+            withData:(id)userData;
+- (id)findByFunction:(GHRFunc)func
+            withData:(id)userData;
+
+- (unsigned int)size;
+
+- (GOCList *)keys;
+- (GOCList *)values;
+
+- (id <GOCIter>)getIter;
+
+ at end
+
+#endif  /* __GLIB_HASH_TABLE_H__ */
diff --git a/glib-objc/GOCHashTable.m b/glib-objc/GOCHashTable.m
new file mode 100644
index 0000000..c188eb2
--- /dev/null
+++ b/glib-objc/GOCHashTable.m
@@ -0,0 +1,312 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#import "GOCHashTable.h"
+#import "GOCNumber.h"
+
+ at implementation GOCHashTableIter
+
+- (id)initWithGHashTable:(GHashTable *)ght
+{
+    self = [super init];
+    if(self) {
+        ghti_ptr = g_slice_new0(GHashTableIter);
+        g_hash_table_iter_init(ghti_ptr, ght);
+
+        lastEntry = [[GOCHashTableEntry alloc] init];
+    }
+
+    return self;
+}
+
+- (void)free
+{
+    g_slice_free(GHashTableIter, ghti_ptr);
+    [lastEntry free];
+    [super free];
+}
+
+- (id)next
+{
+    if(!g_hash_table_iter_next(ghti_ptr, (gpointer)&lastEntry->key, (gpointer)&lastEntry->value))
+        return nil;
+
+    return lastEntry;
+}
+
+ at end
+
+
+
+ at implementation GOCHashTable
+
+static guint
+goc_ht_hash(gconstpointer key)
+{
+    id <GOCHashable> obj = (id)key;
+    return [obj hashCode];
+}
+
+static gboolean
+goc_ht_equal(gconstpointer a,
+             gconstpointer b)
+{
+    id <GOCHashable> obj_a = (id)a, obj_b = (id)b;
+    return [obj_a isEqualTo:obj_b];
+}
+
+static void
+goc_ht_unref(gpointer data)
+{
+    id <GOCHashable> obj = (id)data;
+    [obj unref];
+}
+
+- (id)init
+{
+    self = [super init];
+    if(self) {
+        ght_ptr = g_hash_table_new_full(goc_ht_hash,
+                                        goc_ht_equal,
+                                        goc_ht_unref,
+                                        goc_ht_unref);
+    }
+
+    return self;
+}
+
+- (void)insertObject:(id <GOCObject>)object
+              forKey:(id <GOCHashable>)key
+{
+    g_hash_table_insert(ght_ptr, [key ref], [object ref]);
+}
+
+- (void)replaceObject:(id <GOCObject>)object
+               forKey:(id <GOCHashable>)key
+{
+    g_hash_table_replace(ght_ptr, [key ref], [object ref]);
+}
+
+- (BOOL)removeObjectForKey:(id <GOCHashable>)key
+{
+    return g_hash_table_remove(ght_ptr, key);
+}
+
+- (void)removeAll
+{
+    g_hash_table_remove_all(ght_ptr);
+}
+
+- (id)stealObjectForKey:(id <GOCHashable>)key
+{
+    id obj = g_hash_table_lookup(ght_ptr, key);
+
+    if(obj)
+        g_hash_table_steal(ght_ptr, key);
+
+    return obj;
+}
+
+- (void)stealAll
+{
+    g_hash_table_steal_all(ght_ptr);
+}
+
+- (id)lookupForKey:(id <GOCHashable>)key
+{
+    return g_hash_table_lookup(ght_ptr, key);
+}
+
+- (id)lookupForKey:(id <GOCHashable>)key
+    getOriginalKey:(id *)originalKey;
+{
+    id value = nil;
+
+    if(!g_hash_table_lookup_extended(ght_ptr, (gpointer)key, (gpointer)originalKey, (gpointer)&value))
+        return nil;
+
+    return value;
+}
+
+typedef struct
+{
+    IMP callback;
+    SEL selector;
+    id object;
+    id userData;
+} GHTForeachData;
+
+static void
+ght_foreach(gpointer key,
+            gpointer value,
+            gpointer user_data)
+{
+    GHTForeachData *fedata = user_data;
+    void (*cb)(id,SEL,id,id,id) = (void (*)(id,SEL,id,id,id))fedata->callback;
+
+    cb(fedata->object, fedata->selector, (id)key, (id)value, fedata->userData);
+}
+
+- (void)runSelectorForEach:(SEL)selector
+                  onObject:(id)object
+                  withData:(id)userData;
+{
+    GHTForeachData fedata;
+
+    g_return_if_fail(selector && object);
+
+    fedata.callback = [object methodFor:selector];
+    g_return_if_fail(fedata.callback);
+    fedata.selector = selector;
+    fedata.object = object;
+    fedata.userData = userData;
+
+    g_hash_table_foreach(ght_ptr, ght_foreach, &fedata);
+}
+
+- (void)runFunctionForEach:(GHFunc)func
+                  withData:(id)userData
+{
+    g_hash_table_foreach(ght_ptr, func, userData);
+}
+
+static gboolean
+ght_foreach_remove(gpointer key,
+                   gpointer value,
+                   gpointer user_data)
+{
+    GHTForeachData *fedata = user_data;
+    id (*cb)(id,SEL,id,id,id) = (id (*)(id,SEL,id,id,id))fedata->callback;
+    id ret;
+
+    ret = cb(fedata->object, fedata->selector, (id)key, (id)value, fedata->userData);
+    if(!ret || [ret class] != [GOCNumber class])
+        return FALSE;
+    else
+        return [(GOCNumber *)ret boolValue];
+}
+
+- (unsigned int)removeBySelector:(SEL)selector
+                        onObject:(id)object
+                        withData:(id)userData
+{
+    GHTForeachData fedata;
+
+    g_return_val_if_fail(selector && object, 0);
+
+    fedata.callback = [object methodFor:selector];
+    g_return_val_if_fail(fedata.callback, 0);
+    fedata.selector = selector;
+    fedata.object = object;
+    fedata.userData = userData;
+
+    return g_hash_table_foreach_remove(ght_ptr, ght_foreach_remove, &fedata);
+}
+
+- (unsigned int)removeByFunction:(GHRFunc)func
+                         withata:(id)userData
+{
+    return g_hash_table_foreach_remove(ght_ptr, func, userData);
+}
+
+- (unsigned int)stealBySelector:(SEL)selector
+                       onObject:(id)object
+                       withData:(id)userData;
+{
+    GHTForeachData fedata;
+
+    g_return_val_if_fail(selector && object, 0);
+
+    fedata.callback = [object methodFor:selector];
+    g_return_val_if_fail(fedata.callback, 0);
+    fedata.selector = selector;
+    fedata.object = object;
+    fedata.userData = userData;
+
+    return g_hash_table_foreach_steal(ght_ptr, ght_foreach_remove, &fedata);
+}
+
+- (unsigned int)stealByFunction:(GHRFunc)func
+                       withData:(id)userData
+{
+    return g_hash_table_foreach_steal(ght_ptr, func, userData);
+}
+
+- (id)findBySelector:(SEL)selector
+            onObject:(id)object
+            withData:(id)userData
+{
+    GHTForeachData fedata;
+
+    g_return_val_if_fail(selector && object, nil);
+
+    fedata.callback = [object methodFor:selector];
+    g_return_val_if_fail(fedata.callback, nil);
+    fedata.selector = selector;
+    fedata.object = object;
+    fedata.userData = userData;
+
+    return g_hash_table_find(ght_ptr, ght_foreach_remove, &fedata);
+}
+
+- (id)findByFunction:(GHRFunc)func
+            withData:(id)userData
+{
+    return g_hash_table_find(ght_ptr, func, userData);
+}
+
+- (unsigned int)size
+{
+    return g_hash_table_size(ght_ptr);
+}
+
+- (GOCList *)keys
+{
+    GList *keys_gl = g_hash_table_get_keys(ght_ptr);
+    GOCList *keys_gocl = [[GOCList alloc] initWithGList:keys_gl];
+
+    if(keys_gl)
+        g_list_free(keys_gl);
+
+    return keys_gocl;
+}
+
+- (GOCList *)values
+{
+    GList *values_gl = g_hash_table_get_values(ght_ptr);
+    GOCList *values_gocl = [[GOCList alloc] initWithGList:values_gl];
+
+    if(values_gl)
+        g_list_free(values_gl);
+
+    return values_gocl;
+}
+
+- (id <GOCIter>)getIter
+{
+    return [[GOCHashTableIter alloc] initWithGHashTable:ght_ptr];
+}
+
+ at end
diff --git a/gobject-objc/glib-objc.h b/glib-objc/GOCHashable.h
similarity index 50%
copy from gobject-objc/glib-objc.h
copy to glib-objc/GOCHashable.h
index f4b0826..0f6d434 100644
--- a/gobject-objc/glib-objc.h
+++ b/glib-objc/GOCHashable.h
@@ -1,33 +1,32 @@
 /*
  *  glib-objc - objective-c bindings for glib/gobject
  *
- *  Copyright (c) 2008 Brian Tarricone <bjt23 at cornell.edu>
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; version 2 of the License ONLY.
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU Library General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
+ *  You should have received a copy of the GNU Lesser General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef __GLIB_OBJC_H__
-#define __GLIB_OBJC_H__
 
-#define __IN_GLIB_OBJC_H
+#ifndef __GOC_HASHABLE_H__
+#define __GOC_HASHABLE_H__
 
-#include <gobject-objc/GLIBObject.h>
-#include <gobject-objc/GLIBBoxedValue.h>
-#include <gobject-objc/GLIBValue.h>
+#import <glib-objc/GOCComparable.h>
 
-#include <gobject-objc/ns-object-boxed.h>
+ at protocol GOCHashable<GOCComparable>
 
-#undef __IN_GLIB_OBJC_H
+- (unsigned int)hashCode;
 
-#endif  /* __GLIB_OBJC_H__ */
+ at end
+
+#endif  /* __GOC_HASHABLE_H__ */
diff --git a/gobject-objc/glib-objc.h b/glib-objc/GOCIterable.h
similarity index 50%
copy from gobject-objc/glib-objc.h
copy to glib-objc/GOCIterable.h
index f4b0826..5e15e9e 100644
--- a/gobject-objc/glib-objc.h
+++ b/glib-objc/GOCIterable.h
@@ -1,33 +1,36 @@
 /*
  *  glib-objc - objective-c bindings for glib/gobject
  *
- *  Copyright (c) 2008 Brian Tarricone <bjt23 at cornell.edu>
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; version 2 of the License ONLY.
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU Library General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
+ *  You should have received a copy of the GNU Lesser General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef __GLIB_OBJC_H__
-#define __GLIB_OBJC_H__
+#ifndef __GOC_ITERABLE_H__
+#define __GOC_ITERABLE_H__
 
-#define __IN_GLIB_OBJC_H
+ at protocol GOCIter
 
-#include <gobject-objc/GLIBObject.h>
-#include <gobject-objc/GLIBBoxedValue.h>
-#include <gobject-objc/GLIBValue.h>
+- (id <GOCObject>)next;
 
-#include <gobject-objc/ns-object-boxed.h>
+ at end
 
-#undef __IN_GLIB_OBJC_H
+ at protocol GOCIterable
 
-#endif  /* __GLIB_OBJC_H__ */
+- (id <GOCIter>)getIter;
+
+ at end
+
+
+#endif  /* __GOC_ITERABLE_H__ */
diff --git a/glib-objc/GOCList.h b/glib-objc/GOCList.h
new file mode 100644
index 0000000..3c68036
--- /dev/null
+++ b/glib-objc/GOCList.h
@@ -0,0 +1,99 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+
+#ifndef __GOC_LIST_H__
+#define __GOC_LIST_H__
+
+#include <glib.h>
+
+#import <glib-objc/GOCObjectBase.h>
+
+#import <glib-objc/GOCIterable.h>
+#import <glib-objc/GOCComparable.h>
+
+ at class GOCList;
+
+ at interface GOCListIter : Object <GOCIter>
+{
+  @private
+    id list;
+    GList *cur;
+}
+
+- (id)initWithList:(GOCList *)aList;
+
+- (id <GOCObject>)prev;
+- (id <GOCObject>)next;
+
+ at end
+
+ at interface GOCList : GOCObjectBase <GOCIterable>
+{
+  @private
+    GList *head;
+    GList *tail;
+}
+
+/* designated initializer */
+- (id)initWithItems:(id <GOCObject>)firstItem,...;
+- (id)initWithData:(id <GOCObject>)data;
+/* takes ownership of the GList */
+- (id)initWithGList:(GList *)gList;
+
+- (void)append:(id <GOCObject>)data;
+- (void)prepend:(id <GOCObject>)data;
+- (void)insert:(id <GOCObject>)data
+    atPosition:(int)position;
+
+/* note that *all* items put into the list must implement the
+ * GOCComparable formal protocol for this to work */
+- (void)insertSorted:(id <GOCComparable>)data;
+
+/* otherList will continue to exist after this call, and should be manually
+ * unreffed if no longer needed.  the data in each node is not copied, simply reffed */
+- (void)concatList:(GOCList *)otherList;
+
+/* if data and the items in the list implement GOCComparable, then a match
+ * will be considered based on -[GOCComparable isEqualTo:].  otherwise the
+ * match will be determined based on the pointer itself. */
+- (BOOL)removeByData:(id)data;
+- (BOOL)removeByPosition:(int)position;
+- (void)removeAll;
+
+- (void)reverse;
+
+/* makes a new copy of the list.  the nodes themselves are not shared,
+ * but the data pointers are (with their refcounts incremented) */
+- (id)copy;
+
+- (id)dataAtHead;
+- (id)dataAtTail;
+- (id)dataAtPosition:(int)position;
+
+/* all items in list must implement the GOCComparable protocol */
+- (void)sort;
+
+- (unsigned int)length;
+
+- (id <GOCIter>)getIter;
+
+ at end
+
+#endif  /* __GOC_LIST_H__ */
diff --git a/glib-objc/GOCList.m b/glib-objc/GOCList.m
new file mode 100644
index 0000000..edd8d00
--- /dev/null
+++ b/glib-objc/GOCList.m
@@ -0,0 +1,295 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+
+#include <glib.h>
+
+#import "GOCList.h"
+#import "GOCComparable.h"
+
+
+ at implementation GOCList
+
+/* designated initializer */
+- (id)initWithItems:(id <GOCObject>)firstItem,...
+{
+    va_list var_args;
+    id <GOCObject> curItem;
+
+    self = [super init];
+    if(!self)
+        return nil;
+
+    va_start(var_args, firstItem);
+    curItem = firstItem;
+
+    while(curItem != nil) {
+        [self append:curItem];
+        curItem = va_arg(var_args, id <GOCObject>);
+    }
+
+    va_end(var_args);
+
+    return self;
+}
+
+- (id)initWithData:(id <GOCObject>)data
+{
+    return [self initWithItems:data,nil];
+}
+
+- (id)initWithGList:(GList *)gList
+{
+    self = [self initWithItems:nil];
+    if(self) {
+        head = gList;
+        for(tail = head; tail && tail->next; tail = tail->next)
+            (void)0;  /* nothing */
+    }
+    return self;
+}
+
+- (void)append:(id <GOCObject>)data
+{
+    if(!data)
+        return;
+
+    tail = g_list_append(tail, [data ref]);
+    if(!head)
+        head = tail;
+}
+
+- (void)prepend:(id <GOCObject>)data
+{
+    if(!data)
+        return;
+
+    head = g_list_prepend(head, [data ref]);
+    if(!tail)
+        tail = head;
+}
+
+- (void)insert:(id <GOCObject>)data
+    atPosition:(int)position
+{
+    head = g_list_insert(head, [data ref], position);
+
+    if(!tail)
+        tail = head;
+    else if(tail->next)
+        tail = tail->next;
+}
+
+static gint
+gl_compare(gconstpointer a,
+           gconstpointer b)
+{
+    id <GOCComparable> ia = (id <GOCComparable>)a, ib = (id <GOCComparable>)b;
+    return [ia compareTo:ib];
+}
+
+- (void)insertSorted:(id <GOCComparable>)data
+{
+    head = g_list_insert_sorted(head, [data ref], gl_compare);
+    if(!tail)
+        tail = head;
+    else if(tail->next)
+        tail = tail->next;
+}
+
+- (void)concatList:(GOCList *)otherList
+{
+    GList *cur;
+
+    for(cur = otherList->head; cur; cur = cur->next)
+        [self append:cur->data];
+}
+
+- (BOOL)removeByData:(id)data
+{
+    GList *to_rem = g_list_find(head, data);
+
+    if(!to_rem)
+        return NO;
+
+    if(to_rem == tail)
+        tail = to_rem->prev;
+
+    [(id <GOCObject>)to_rem->data unref];
+    head = g_list_delete_link(head, to_rem);
+
+    if(!tail && head)
+        tail = head;
+
+    return YES;
+}
+
+- (BOOL)removeByPosition:(int)position
+{
+    int i = 0;
+    GList *cur = head;
+    
+    for(i = 0; i < position && cur; ++i)
+        cur = cur->next;
+
+    if(!cur)
+        return NO;
+
+    if(cur == tail)
+        tail = cur->prev;
+
+    [(id <GOCObject>)cur->data unref];
+    head = g_list_delete_link(head, cur);
+    
+    if(!tail && head)
+        tail = head;
+
+    return YES;
+}
+
+- (void)removeAll
+{
+    GList *cur = head, *tmp;
+
+    while(cur) {
+        tmp = cur->next;
+        [(id <GOCObject>)cur->data unref];
+        g_list_free_1(cur);
+        cur = tmp;
+    }
+
+    head = tail = NULL;
+}
+
+- (void)reverse
+{
+    tail = head;
+    head = g_list_reverse(head);
+}
+
+- (id)copy
+{
+    GOCList *newList = [[GOCList alloc] init];
+    GList *cur;
+
+    for(cur = head; cur; cur = cur->next)
+        [newList append:cur->data];
+
+    return newList;
+}
+
+- (id)dataAtHead
+{
+    if(!head)
+        return nil;
+    return head->data;
+}
+
+- (id)dataAtTail
+{
+    if(!tail)
+        return nil;
+    return tail->data;
+}
+
+- (id)dataAtPosition:(int)position
+{
+    return g_list_nth_data(head, position);
+}
+
+- (void)sort
+{
+    head = g_list_sort(head, gl_compare);
+
+    /* ugh.  slow */
+    for(tail = head; tail && tail->next; tail = tail->next)
+        (void)0;  /* nothing */
+}
+
+- (unsigned int)length
+{
+    return g_list_length(head);
+}
+
+- (id <GOCIter>)getIter;
+{
+    return [[GOCListIter alloc] initWithList:self];
+}
+
+- (void)free
+{
+    [self removeAll];
+    [super free];
+}
+
+
+/* private */
+- (void *)nodeAtHead
+{
+    return head;
+}
+
+ at end
+
+
+
+ at implementation GOCListIter
+
+- (id)initWithList:(GOCList *)aList
+{
+    self = [super init];
+    if(self) {
+        list = [aList ref];
+        cur = [list nodeAtHead];
+    }
+    return self;
+}
+
+- (id <GOCObject>)prev
+{
+    if(!cur)
+        return nil;
+
+    cur = cur->prev;
+
+    return cur ? cur->data : nil;
+}
+
+- (id <GOCObject>)next
+{
+    if(!cur)
+        return nil;
+
+    cur = cur->next;
+
+    return cur ? cur->data : nil;
+}
+
+- (void)free
+{
+    [list unref];
+    [super free];
+}
+
+ at end
diff --git a/glib-objc/GOCNumber.h b/glib-objc/GOCNumber.h
new file mode 100644
index 0000000..2809436
--- /dev/null
+++ b/glib-objc/GOCNumber.h
@@ -0,0 +1,79 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __GOC_NUMBER_H__
+#define __GOC_NUMBER_H__
+
+#import <glib-objc/GOCObjectBase.h>
+
+ at interface GOCNumber : GOCObjectBase
+{
+  @protected
+    int type;
+
+  @private
+    union
+    {
+        BOOL b;
+        unsigned char uc;
+        char c;
+        unsigned short us;
+        short s;
+        unsigned int ui;
+        int i;
+        unsigned long ul;
+        long l;
+        unsigned long long ull;
+        long long ll;
+        float f;
+        double d;
+    } data;
+}
+
+- (id)initWithBool:(BOOL)boolValue;
+- (id)initWithUChar:(unsigned char)uCharValue;
+- (id)initWithChar:(char)charValue;
+- (id)initWithUShort:(unsigned short)uShortValue;
+- (id)initWithShort:(short)shortValue;
+- (id)initWithUInt:(unsigned int)uIntValue;
+- (id)initWithInt:(int)intValue;
+- (id)initWithULong:(unsigned long)uLongValue;
+- (id)initWithLong:(long)longValue;
+- (id)initWithUInt64:(unsigned long long)uInt64Value;
+- (id)initWithInt64:(long long)int64Value;
+- (id)initWithFloat:(float)floatValue;
+- (id)initWithDouble:(double)doubleValue;
+
+- (BOOL)boolValue;
+- (unsigned char)uCharValue;
+- (char)charValue;
+- (unsigned short)uShortValue;
+- (short)shortValue;
+- (unsigned int)uIntValue;
+- (int)intValue;
+- (unsigned long)uLongValue;
+- (long)longValue;
+- (unsigned long long)uInt64Value;
+- (long long)int64Value;
+- (float)floatValue;
+- (double)doubleValue;
+
+ at end
+
+#endif  /* __GOC_NUMBER_H__ */
diff --git a/glib-objc/GOCNumber.m b/glib-objc/GOCNumber.m
new file mode 100644
index 0000000..3977656
--- /dev/null
+++ b/glib-objc/GOCNumber.m
@@ -0,0 +1,269 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+
+#import "GOCNumber.h"
+
+ at implementation GOCNumber
+
+typedef enum
+{
+    GN_TYPE_INVALID = 0,
+    GN_TYPE_BOOL,
+    GN_TYPE_UCHAR,
+    GN_TYPE_CHAR,
+    GN_TYPE_USHORT,
+    GN_TYPE_SHORT,
+    GN_TYPE_UINT,
+    GN_TYPE_INT,
+    GN_TYPE_ULONG,
+    GN_TYPE_LONG,
+    GN_TYPE_UINT64,
+    GN_TYPE_INT64,
+    GN_TYPE_FLOAT,
+    GN_TYPE_DOUBLE,
+} GOCNumberType;
+
+- (id)init
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_INVALID;
+        memset(&data, 0, sizeof(data));
+    }
+    return self;
+}
+
+- (id)initWithBool:(BOOL)boolValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_BOOL;
+        data.b = boolValue;
+    }
+    return self;
+}
+
+- (id)initWithUChar:(unsigned char)uCharValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_UCHAR;
+        data.uc = uCharValue;
+    }
+    return self;
+}
+
+- (id)initWithChar:(char)charValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_CHAR;
+        data.c = charValue;
+    }
+    return self;
+}
+
+- (id)initWithUShort:(unsigned short)uShortValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_USHORT;
+        data.us = uShortValue;
+    }
+    return self;
+}
+
+- (id)initWithShort:(short)shortValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_SHORT;
+        data.s = shortValue;
+    }
+    return self;
+}
+
+- (id)initWithUInt:(unsigned int)uIntValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_UINT;
+        data.ui = uIntValue;
+    }
+    return self;
+}
+
+- (id)initWithInt:(int)intValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_INT;
+        data.i = intValue;
+    }
+    return self;
+}
+
+- (id)initWithULong:(unsigned long)uLongValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_ULONG;
+        data.ul = uLongValue;
+    }
+    return self;
+}
+
+- (id)initWithLong:(long)longValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_LONG;
+        data.l = longValue;
+    }
+    return self;
+}
+
+- (id)initWithUInt64:(unsigned long long)uInt64Value
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_UINT64;
+        data.ull = uInt64Value;
+    }
+    return self;
+}
+
+- (id)initWithInt64:(long long)int64Value
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_INT64;
+        data.ll = int64Value;
+    }
+    return self;
+}
+
+- (id)initWithFloat:(float)floatValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_FLOAT;
+        data.f = floatValue;
+    }
+    return self;
+}
+
+- (id)initWithDouble:(double)doubleValue
+{
+    self = [super init];
+    if(self) {
+        type = GN_TYPE_DOUBLE;
+        data.d = doubleValue;
+    }
+    return self;
+}
+
+
+- (BOOL)boolValue
+{
+    g_return_val_if_fail(type == GN_TYPE_BOOL, NO);
+    return data.b;
+}
+
+- (unsigned char)uCharValue
+{
+    g_return_val_if_fail(type == GN_TYPE_UCHAR, 0);
+    return data.uc;
+}
+
+- (char)charValue
+{
+    g_return_val_if_fail(type == GN_TYPE_CHAR, 0);
+    return data.c;
+}
+
+- (unsigned short)uShortValue
+{
+    g_return_val_if_fail(type == GN_TYPE_USHORT, 0);
+    return data.us;
+}
+
+- (short)shortValue
+{
+    g_return_val_if_fail(type == GN_TYPE_SHORT, 0);
+    return data.s;
+}
+
+- (unsigned int)uIntValue
+{
+    g_return_val_if_fail(type == GN_TYPE_UINT, 0);
+    return data.ui;
+}
+
+- (int)intValue
+{
+    g_return_val_if_fail(type == GN_TYPE_INT, 0);
+    return data.i;
+}
+
+- (unsigned long)uLongValue
+{
+    g_return_val_if_fail(type == GN_TYPE_ULONG, 0);
+    return data.ul;
+}
+
+- (long)longValue
+{
+    g_return_val_if_fail(type == GN_TYPE_LONG, 0);
+    return data.l;
+}
+
+- (unsigned long long)uInt64Value
+{
+    g_return_val_if_fail(type == GN_TYPE_UINT64, 0);
+    return data.ull;
+}
+
+- (long long)int64Value
+{
+    g_return_val_if_fail(type == GN_TYPE_INT64, 0);
+    return data.ll;
+}
+
+- (float)floatValue
+{
+    g_return_val_if_fail(type == GN_TYPE_FLOAT, 0.0);
+    return data.f;
+}
+
+- (double)doubleValue
+{
+    g_return_val_if_fail(type == GN_TYPE_DOUBLE, 0.0);
+    return data.d;
+}
+
+ at end
diff --git a/glib-objc/GOCObjectBase.h b/glib-objc/GOCObjectBase.h
new file mode 100644
index 0000000..e3a6937
--- /dev/null
+++ b/glib-objc/GOCObjectBase.h
@@ -0,0 +1,44 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+
+#ifndef __GOC_OBJECT_BASE_H__
+#define __GOC_OBJECT_BASE_H__
+
+#import <objc/Object.h>
+
+ at protocol GOCObject
+
+- (id <GOCObject>)ref;
+- (void)unref;
+
+ at end
+
+ at interface GOCObjectBase : Object <GOCObject>
+{
+  @private
+    volatile int ref_count;
+}
+
+- (id <GOCObject>)ref;
+- (void)unref;
+
+ at end
+
+#endif  /* __GOC_OBJECT_BASE_H__ */
diff --git a/glib-objc/GOCObjectBase.m b/glib-objc/GOCObjectBase.m
new file mode 100644
index 0000000..263f527
--- /dev/null
+++ b/glib-objc/GOCObjectBase.m
@@ -0,0 +1,53 @@
+/*
+ *  glib-objc - objective-c bindings for glib/gobject
+ *
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#import "GOCObjectBase.h"
+
+ at implementation GOCObjectBase
+
+- (id)init
+{
+    self = [super init];
+    if(self) {
+        ref_count = 1;
+    }
+    return self;
+}
+
+- (id <GOCObject>)ref
+{
+    g_atomic_int_inc(&ref_count);
+    return self;
+}
+
+- (void)unref
+{
+    if(g_atomic_int_dec_and_test(&ref_count))
+        return;
+
+    [self free];
+}
+
+ at end
diff --git a/glib-objc/Makefile.am b/glib-objc/Makefile.am
new file mode 100644
index 0000000..50a58a1
--- /dev/null
+++ b/glib-objc/Makefile.am
@@ -0,0 +1,44 @@
+lib_LTLIBRARIES = libglib-objc-2.0.la
+
+glibobjcmainincludedir = $(includedir)/glib-objc-$(GLIB_OBJC_API_VERSION)
+glibobjcmaininclude_HEADERS = \
+	glib-objc.h
+glibobjcincludedir = $(glibobjcmainincludedir)/glib-objc
+glibobjcinclude_HEADERS = \
+	GOCComparable.h \
+	GOCHashable.h \
+	GOCHashTable.h \
+	GOCIterable.h \
+	GOCList.h \
+	GOCNumber.h \
+	GOCObjectBase.h
+
+libglib_objc_2_0_la_SOURCES = \
+	$(glibobjcmaininclude_HEADERS) \
+	$(glibobjcinclude_HEADERS) \
+	GOCHashTable.m \
+	GOCList.m \
+	GOCNumber.m \
+	GOCObjectBase.m
+
+libglib_objc_2_0_la_CFLAGS = \
+	-DGLIB_OBJC_COMPILATION \
+	$(GLIB_CFLAGS)
+
+libglib_objc_2_0_la_OBJCFLAGS = $(libglib_objc_2_0_la_CFLAGS)
+
+libglib_objc_2_0_la_LDFLAGS = \
+	-version-info $(GLIB_OBJC_VERINFO)
+
+libglib_objc_2_0_la_LIBADD = \
+	$(GLIB_LIBS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_in_files = glib-objc-$(GLIB_OBJC_API_VERSION).pc.in
+pkgconfig_DATA = $(pkgconfig_in_files:.in=)
+
+DISTCLEANFILES = \
+	$(pkgconfig_DATA)
+
+EXTRA_DIST = \
+	$(pkgconfig_in_files)
diff --git a/glib-objc/glib-objc-2.0.pc.in b/glib-objc/glib-objc-2.0.pc.in
new file mode 100644
index 0000000..cc13945
--- /dev/null
+++ b/glib-objc/glib-objc-2.0.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+libglib_objc_api_version=@GLIB_OBJC_API_VERSION@
+
+Name: Glib-ObjC
+Description: Objective-C bindings for Glib
+Version: @VERSION@
+Requires: glib-2.0
+Libs: -lglib-objc-${libglib_objc_api_version}
+Cflags: -I${includedir}/glib-objc-${libglib_objc_api_version}
diff --git a/gobject-objc/glib-objc.h b/glib-objc/glib-objc.h
similarity index 56%
copy from gobject-objc/glib-objc.h
copy to glib-objc/glib-objc.h
index f4b0826..6b75ad2 100644
--- a/gobject-objc/glib-objc.h
+++ b/glib-objc/glib-objc.h
@@ -1,18 +1,18 @@
 /*
  *  glib-objc - objective-c bindings for glib/gobject
  *
- *  Copyright (c) 2008 Brian Tarricone <bjt23 at cornell.edu>
+ *  Copyright (c) 2009 Brian Tarricone <brian at tarricone.org>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; version 2 of the License ONLY.
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; version 2 of the License ONLY.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU Library General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
+ *  You should have received a copy of the GNU Lesser General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
@@ -22,11 +22,13 @@
 
 #define __IN_GLIB_OBJC_H
 
-#include <gobject-objc/GLIBObject.h>
-#include <gobject-objc/GLIBBoxedValue.h>
-#include <gobject-objc/GLIBValue.h>
-
-#include <gobject-objc/ns-object-boxed.h>
+#import <glib-objc/GOCComparable.h>
+#import <glib-objc/GOCHashable.h>
+#import <glib-objc/GOCHashTable.h>
+#import <glib-objc/GOCIterable.h>
+#import <glib-objc/GOCList.h>
+#import <glib-objc/GOCNumber.h>
+#import <glib-objc/GOCObjectBase.h>
 
 #undef __IN_GLIB_OBJC_H
 
diff --git a/gobject-objc/Makefile.am b/gobject-objc/Makefile.am
index e723ed5..a762ce0 100644
--- a/gobject-objc/Makefile.am
+++ b/gobject-objc/Makefile.am
@@ -1,9 +1,9 @@
 lib_LTLIBRARIES = libgobject-objc-2.0.la
 
-gobjectobjcmainincludedir = $(includedir)/glib-objc-$(LIBGOBJECT_OBJC_API_VERSION)
-gobjectobjcmaininclude_HEADERS = \
-	glib-objc.h
-gobjectobjcincludedir = $(gobjectobjcmainincludedir)/gobject-objc
+glibobjcmainincludedir = $(includedir)/glib-objc-$(GLIB_OBJC_API_VERSION)
+glibobjcmaininclude_HEADERS = \
+	gobject-objc.h
+gobjectobjcincludedir = $(glibobjcmainincludedir)/gobject-objc
 gobjectobjcinclude_HEADERS = \
 	GLIBBoxedValue.h \
 	GLIBObject.h \
diff --git a/gobject-objc/gobject-objc-2.0.pc.in b/gobject-objc/gobject-objc-2.0.pc.in
index 08cb6b3..aa0390d 100644
--- a/gobject-objc/gobject-objc-2.0.pc.in
+++ b/gobject-objc/gobject-objc-2.0.pc.in
@@ -3,10 +3,10 @@ exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
 
-libgobject_objc_api_version=@LIBGOBJECT_OBJC_API_VERSION@
+libgobject_objc_api_version=@GLIB_OBJC_API_VERSION@
 
-Name: Glib-ObjC
-Description: Objective-C bindings for Glib/GObject
+Name: GObject-ObjC
+Description: Objective-C bindings for GObject
 Version: @VERSION@
 Requires: gobject-2.0
 Libs: -lgobject-objc-${libgobject_objc_api_version} @FOUNDATION_LIBS@



More information about the Xfce4-commits mailing list