Permalink
Browse files

Switch to quark and remove glib

  • Loading branch information...
dwaite committed Oct 13, 2007
1 parent 8b13210 commit b5f4b962d805fa45707bf3d66007dc0243297624
View
@@ -26,6 +26,9 @@ runtime/pristine*
*.la
*.bundle
*.swp
+*.dylib
+*.so
+*.d
*~
attic/externals/syd-parser/pkg
@@ -226,19 +229,16 @@ shotgun/external_libs/onig/sample/Makefile
# shotgun/external_libs/libstring
shotgun/external_libs/libbstring/*.d
shotgun/external_libs/libbstring/*.so
-shotgun/external_libs/libbstring/*.dylib
shotgun/external_libs/libbstring/*.a
# shotgun/external_libs/libcchash
shotgun/external_libs/libcchash/*.d
shotgun/external_libs/libcchash/*.so
-shotgun/external_libs/libcchash/*.dylib
shotgun/external_libs/libcchash/*.a
# shotgun/external_libs/libmpa
shotgun/external_libs/libmpa/*.d
shotgun/external_libs/libmpa/*.so
-shotgun/external_libs/libmpa/*.dylib
shotgun/external_libs/libmpa/*.a
# shotgun/lib
View
@@ -17,7 +17,6 @@ any platform-specific requirements.
* "GNU Bison":http://www.gnu.org/software/bison/
* "gmake (GNU Make)":http://savannah.gnu.org/projects/make/
* "pkg-config (configuration tool)":http://pkgconfig.freedesktop.org/
-* "glib2 version >= 2.10 (Gtk2 base libs)":http://www.gtk.org/
* "libtool version >= 1.5":http://www.gnu.org/software/libtool/
* "Ruby version >= 1.8.4 (the Ruby language)":http://www.ruby-lang.org/
* "RubyGems (Ruby package manager)":http://www.rubygems.org/
View
@@ -10,11 +10,11 @@ else
BINSUFFIX?=
endif
-CFLAGS += -iquote . -iquote lib $(CPPFLAGS) -Iexternal_libs/libbstring -Iexternal_libs/libcchash -Iexternal_libs/libmpa
+CFLAGS += -iquote . -iquote lib $(CPPFLAGS) -Iexternal_libs/libbstring -Iexternal_libs/libcchash -Iexternal_libs/libmpa -Iexternal_libs/libmquark
-ALIBS=external_libs/libtommath/libtommath.a external_libs/onig/.libs/libonig.a external_libs/libzip/lib/.libs/libzip.a external_libs/libltdl/.libs/libltdl.a external_libs/libevent/.libs/libevent.a external_libs/libbstring/libbstring.a external_libs/libcchash/libcchash.a external_libs/libmpa/libmpa.a
+ALIBS=external_libs/libtommath/libtommath.a external_libs/onig/.libs/libonig.a external_libs/libzip/lib/.libs/libzip.a external_libs/libltdl/.libs/libltdl.a external_libs/libevent/.libs/libevent.a external_libs/libbstring/libbstring.a external_libs/libcchash/libcchash.a external_libs/libmpa/libmpa.a external_libs/libmquark/libmquark.a
-LIBS=`pkg-config glib-2.0 --libs` $(ALIBS) -lz -lm shotgun/lib
+LIBS=$(ALIBS) -lz -lm shotgun/lib
LDFLAGS=
# amd64 must have fPIC shared
@@ -63,9 +63,10 @@ config.h:
$(COMP) $(CFLAGS) -c $<
external_libs/lightning/config.h:
- cd external_libs/lightning; CFLAGS=-fPIC ./configure $(RBS_LIGHTNING_DISASS); $(MAKE)
+ cd external_libs/lightning; CFLAGS=-fPIC ./configure $(RBS_LIGHTNING_DISASS)
external_libs/lightning/opcode/libdisass.a: external_libs/lightning/config.h
+ cd external_libs/lightning; $(MAKE)
external_libs/libtommath/libtommath.a:
cd external_libs/libtommath; $(MAKE)
@@ -107,6 +108,9 @@ external_libs/libcchash/libcchash.a:
external_libs/libmpa/libmpa.a:
cd external_libs/libmpa; $(MAKE)
+external_libs/libmquark/libmquark.a:
+ cd external_libs/libmquark; $(MAKE)
+
$(RBLIB): config.h $(ALIBS) external_libs/lightning/config.h
cd lib; $(MAKE) library;
@@ -145,6 +149,11 @@ clean:
cd external_libs/libevent; $(MAKE) clean
cd external_libs/libbstring; $(MAKE) clean
cd external_libs/libcchash; $(MAKE) clean
+ cd external_libs/libzip; $(MAKE) clean
+ cd external_libs/lightning; $(MAKE) clean
+ cd external_libs/libmpa; $(MAKE) clean
+ cd external_libs/libmquark; $(MAKE) clean
+ cd external_libs/libltdl; $(MAKE) clean
.PHONY: clean
# Clean, but also nuke configs
View
@@ -12,8 +12,6 @@ DEBUG = -g -ggdb3
CFLAGS = $(WARNINGS) $(DEBUG)
-CPPFLAGS += `pkg-config glib-2.0 --cflags`
-
COMP=$(CC)
ifeq ($(UNAME),Darwin)
LDOPT=-dynamiclib -undefined dynamic_lookup
@@ -27,8 +27,8 @@ const float max_load_factor = 0.65;
/*****************************************************************************/
struct hashtable *
create_hashtable(unsigned int minsize,
- unsigned int (*hashf) (void*),
- int (*eqf) (void*,void*))
+ unsigned int (*hashf) (const void*),
+ int (*eqf) (const void*,const void*))
{
struct hashtable *h;
unsigned int pindex, size = primes[0];
@@ -54,7 +54,7 @@ create_hashtable(unsigned int minsize,
/*****************************************************************************/
unsigned int
-hash(struct hashtable *h, void *k)
+hash(const struct hashtable *h, const void *k)
{
/* Aim to protect against poor hash functions by adding logic here
* - logic taken from java 1.4 hashtable source */
@@ -127,7 +127,7 @@ hashtable_expand(struct hashtable *h)
/*****************************************************************************/
unsigned int
-hashtable_count(struct hashtable *h)
+hashtable_count(const struct hashtable *h)
{
return h->entrycount;
}
@@ -160,7 +160,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
/*****************************************************************************/
void * /* returns value associated with key */
-hashtable_search(struct hashtable *h, void *k)
+hashtable_search(const struct hashtable *h, const void *k)
{
struct entry *e;
unsigned int hashvalue, index;
@@ -178,7 +178,7 @@ hashtable_search(struct hashtable *h, void *k)
/*****************************************************************************/
void * /* returns value associated with key */
-hashtable_remove(struct hashtable *h, void *k)
+hashtable_remove(struct hashtable *h, const void *k)
{
/* TODO: consider compacting the table when the load factor drops enough,
* or provide a 'compact' method. */
@@ -73,8 +73,8 @@ struct hashtable;
struct hashtable *
create_hashtable(unsigned int minsize,
- unsigned int (*hashfunction) (void*),
- int (*key_eq_fn) (void*,void*));
+ unsigned int (*hashfunction) (const void*),
+ int (*key_eq_fn) (const void*,const void*));
/*****************************************************************************
* hashtable_insert
@@ -114,10 +114,10 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
*/
void *
-hashtable_search(struct hashtable *h, void *k);
+hashtable_search(const struct hashtable *h, const void *k);
#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
+valuetype * fnname (const struct hashtable *h, const keytype *k) \
{ \
return (valuetype *) (hashtable_search(h,k)); \
}
@@ -132,7 +132,7 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
*/
void * /* returns value */
-hashtable_remove(struct hashtable *h, void *k);
+hashtable_remove(struct hashtable *h, const void *k);
#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \
valuetype * fnname (struct hashtable *h, keytype *k) \
@@ -149,7 +149,7 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
* @return the number of items stored in the hashtable
*/
unsigned int
-hashtable_count(struct hashtable *h);
+hashtable_count(const struct hashtable *h);
/*****************************************************************************
@@ -19,13 +19,13 @@ struct hashtable {
unsigned int entrycount;
unsigned int loadlimit;
unsigned int primeindex;
- unsigned int (*hashfn) (void *k);
- int (*eqfn) (void *k1, void *k2);
+ unsigned int (*hashfn) (const void *k);
+ int (*eqfn) (const void *k1, const void *k2);
};
/*****************************************************************************/
unsigned int
-hash(struct hashtable *h, void *k);
+hash(const struct hashtable *h, const void *k);
/*****************************************************************************/
/* indexFor */
@@ -84,27 +84,27 @@ void *ptr_array_remove_fast(ptr_array self, const void *obj)
return NULL;
}
-void * ptr_array_get_index(ptr_array self, size_t index)
+void * ptr_array_get_index(const ptr_array self, size_t index)
{
assert (self != NULL);
assert (index < self->length);
- return self->array[index];
+ return (void*)self->array[index];
}
-void * ptr_array_set_index(ptr_array self, size_t index, void *value)
+void * ptr_array_set_index(ptr_array self, size_t index, const void *value)
{
- void * oldval;
+ const void * oldval;
assert( self != NULL);
assert(index < self->length);
oldval = self->array[index];
self->array[index] = value;
- return oldval;
+ return (void*)oldval;
}
void* ptr_array_remove_index_ordered(ptr_array self, size_t index)
{
- void *retval;
+ const void *retval;
size_t i;
assert (self != NULL);
assert (index < self->length);
@@ -117,12 +117,12 @@ void* ptr_array_remove_index_ordered(ptr_array self, size_t index)
#ifdef CLEANUP_REFERENCES
self->array[self->length] = NULL;
#endif
- return retval;
+ return (void*)retval;
}
void* ptr_array_remove_index_fast(ptr_array self, size_t index)
{
- void *retval;
+ const void *retval;
assert (self != NULL);
assert (index < self->length);
@@ -133,10 +133,10 @@ void* ptr_array_remove_index_fast(ptr_array self, size_t index)
#ifdef CLEANUP_REFERENCES
self->array[self->length] = NULL;
#endif
- return retval;
+ return (void*)retval;
}
-int _ptr_array_growing_append(ptr_array self, void *value)
+int _ptr_array_growing_append(ptr_array self, const void *value)
{
size_t good_size = array_good_size(self->size + 1);
void * new_array = realloc(self->array, good_size*sizeof(void*));
@@ -159,7 +159,7 @@ void ptr_array_free(ptr_array self)
}
}
-int ptr_array_contains(ptr_array self, const void *value)
+int ptr_array_contains(const ptr_array self, const void *value)
{
int i;
assert (self != NULL);
@@ -54,7 +54,7 @@ typedef struct ptr_array_t *ptr_array;
struct ptr_array_t
{
- void **array;
+ const void **array;
size_t length;
size_t size;
};
@@ -123,7 +123,7 @@ void * ptr_array_remove_index_fast(ptr_array self, size_t index);
* index, the position of the object to retrieve.
* Result: the value which exists at the given index.
*/
-void * ptr_array_get_index(ptr_array self, size_t index);
+void * ptr_array_get_index(const ptr_array self, size_t index);
/* Modify the pointer at a certain index.
*
@@ -132,7 +132,7 @@ void * ptr_array_get_index(ptr_array self, size_t index);
* value, the value to overwrite at the specified index
* Result: the value which was at the index before.
*/
-void * ptr_array_set_index(ptr_array self, size_t index, void *value);
+void * ptr_array_set_index(ptr_array self, size_t index, const void *value);
/* Determine if the pointer array contains a particular value
*
@@ -141,35 +141,35 @@ void * ptr_array_set_index(ptr_array self, size_t index, void *value);
* array.
* Result: Non-zero if found, zero if not found.
*/
-int ptr_array_contains(ptr_array self, const void *value);
+int ptr_array_contains(const ptr_array self, const void *value);
/* Determine length (number of pointers) of the array.
*
* Arguments: self, the pointer array
* Result: number of entries within the array.
*/
-static inline size_t ptr_array_length(ptr_array self)
+static inline size_t ptr_array_length(const ptr_array self)
{
return self->length;
}
/* Internal method for appending a value which causes array growth */
-int _ptr_array_growing_append(ptr_array self, void *value);
+int _ptr_array_growing_append(ptr_array self, const void *value);
/* Append a new value to the end of the array.
*
* Arguments: self, the pointer array
* value, the pointer to append at the end
* Result: Non-zero on success, zero on failure.
*/
-static inline int ptr_array_append(ptr_array self, void *value)
+static inline int ptr_array_append(ptr_array self, const void *value)
{
if (self->length == self->size)
return _ptr_array_growing_append(self, value);
self->array[self->length] = value;
self->length++;
- return 1;
+ return 1;
}
/* Clear all entries from the array. This does not reduce the
@@ -0,0 +1,24 @@
+Copyright (c) 2007, David Waite
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice
+ this list of conditions and the following disclaimer in the documentatio
+ and/or other materials provided with the distribution.
+* The name(s) of contributors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Oops, something went wrong.

0 comments on commit b5f4b96

Please sign in to comment.