From a8a179cf67d8ea50160c7cb97208f5bf223f3037 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 29 Sep 2020 10:39:51 -0400 Subject: organize include/, split Gecko_ExceptionPPC.s --- include/GameSpy/darray.h | 40 ++++++++++++++++++++++++++++++++++++++++ include/GameSpy/hashtable.h | 34 ++++++++++++++++++++++++++++++++++ include/GameSpy/nonport.h | 16 ++++++++++++++++ include/darray.h | 40 ---------------------------------------- include/hashtable.h | 34 ---------------------------------- include/libstdc++/qsort.h | 15 +++++++++++++++ include/nonport.h | 16 ---------------- include/qsort.h | 15 --------------- 8 files changed, 105 insertions(+), 105 deletions(-) create mode 100644 include/GameSpy/darray.h create mode 100644 include/GameSpy/hashtable.h create mode 100644 include/GameSpy/nonport.h delete mode 100644 include/darray.h delete mode 100644 include/hashtable.h create mode 100644 include/libstdc++/qsort.h delete mode 100644 include/nonport.h delete mode 100644 include/qsort.h (limited to 'include') diff --git a/include/GameSpy/darray.h b/include/GameSpy/darray.h new file mode 100644 index 0000000..5c7c170 --- /dev/null +++ b/include/GameSpy/darray.h @@ -0,0 +1,40 @@ +#ifndef POKEREVO_DARRAY_H +#define POKEREVO_DARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef s32 (*CompareFunction)(const void *, const void *); +typedef BOOL (*MapFunction)(const void *, s32); +typedef void (*DtorFunction)(void *); + +typedef struct DArray { + s32 size; + s32 capacity; + u32 elemSz; + s32 growAmount; + DtorFunction elemDtor; + char *buf; +} DArray; + +DArray *ArrayNew(u32 elemSz, s32 initialCap, DtorFunction dtor); +void ArrayFree(DArray *d); +s32 ArrayLength(DArray *d); +void *ArrayNth(DArray *d, s32 n); +void ArrayAppend(DArray *d, void *elem); +void ArrayInsertSorted(DArray *d, void *elem, CompareFunction compar); +void ArrayRemoveAt(DArray *d, s32 n); +void ArrayDeleteAt(DArray *d, s32 n); +void ArrayReplaceAt(DArray *d, void *elem, s32 n); +void ArraySort(DArray *d, CompareFunction compar); +s32 ArraySearch(DArray *d, void *elem, CompareFunction cmp, s32 start, s32 doBinarySearch); +void ArrayMapBackwards(DArray *d, MapFunction map, s32 p3); +void *ArrayMapBackwards2(DArray *d, MapFunction map, s32 p3); +void ArrayClear(DArray *d); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_DARRAY_H diff --git a/include/GameSpy/hashtable.h b/include/GameSpy/hashtable.h new file mode 100644 index 0000000..784ab35 --- /dev/null +++ b/include/GameSpy/hashtable.h @@ -0,0 +1,34 @@ +#ifndef POKEREVO_HASHTABLE_H +#define POKEREVO_HASHTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "darray.h" + +typedef s32 (*HashFunction)(void *, s32); + +typedef struct HashTable { + DArray **chains; + s32 size; + DtorFunction dtor; + HashFunction hashFunc; + CompareFunction compar; +} HashTable; + +HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor); +HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor); +void TableFree(HashTable *table); +s32 TableCount(HashTable *table); +void TableEnter(HashTable *table, void *elem); +BOOL TableRemove(HashTable *table, void *elem); +void *TableLookup(HashTable *table, void *elem); +void TableMapSafe(HashTable *table, MapFunction p2, s32 p3); +void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_HASHTABLE_H diff --git a/include/GameSpy/nonport.h b/include/GameSpy/nonport.h new file mode 100644 index 0000000..c1ed0e7 --- /dev/null +++ b/include/GameSpy/nonport.h @@ -0,0 +1,16 @@ +#ifndef POKEREVO_NONPORT_H +#define POKEREVO_NONPORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *gsimalloc(u32 sz); +void *gsirealloc(void *ptr, u32 sz); +void gsifree(void *ptr); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_NONPORT_H diff --git a/include/darray.h b/include/darray.h deleted file mode 100644 index 5c7c170..0000000 --- a/include/darray.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef POKEREVO_DARRAY_H -#define POKEREVO_DARRAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef s32 (*CompareFunction)(const void *, const void *); -typedef BOOL (*MapFunction)(const void *, s32); -typedef void (*DtorFunction)(void *); - -typedef struct DArray { - s32 size; - s32 capacity; - u32 elemSz; - s32 growAmount; - DtorFunction elemDtor; - char *buf; -} DArray; - -DArray *ArrayNew(u32 elemSz, s32 initialCap, DtorFunction dtor); -void ArrayFree(DArray *d); -s32 ArrayLength(DArray *d); -void *ArrayNth(DArray *d, s32 n); -void ArrayAppend(DArray *d, void *elem); -void ArrayInsertSorted(DArray *d, void *elem, CompareFunction compar); -void ArrayRemoveAt(DArray *d, s32 n); -void ArrayDeleteAt(DArray *d, s32 n); -void ArrayReplaceAt(DArray *d, void *elem, s32 n); -void ArraySort(DArray *d, CompareFunction compar); -s32 ArraySearch(DArray *d, void *elem, CompareFunction cmp, s32 start, s32 doBinarySearch); -void ArrayMapBackwards(DArray *d, MapFunction map, s32 p3); -void *ArrayMapBackwards2(DArray *d, MapFunction map, s32 p3); -void ArrayClear(DArray *d); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_DARRAY_H diff --git a/include/hashtable.h b/include/hashtable.h deleted file mode 100644 index 784ab35..0000000 --- a/include/hashtable.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef POKEREVO_HASHTABLE_H -#define POKEREVO_HASHTABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "darray.h" - -typedef s32 (*HashFunction)(void *, s32); - -typedef struct HashTable { - DArray **chains; - s32 size; - DtorFunction dtor; - HashFunction hashFunc; - CompareFunction compar; -} HashTable; - -HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor); -HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor); -void TableFree(HashTable *table); -s32 TableCount(HashTable *table); -void TableEnter(HashTable *table, void *elem); -BOOL TableRemove(HashTable *table, void *elem); -void *TableLookup(HashTable *table, void *elem); -void TableMapSafe(HashTable *table, MapFunction p2, s32 p3); -void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_HASHTABLE_H diff --git a/include/libstdc++/qsort.h b/include/libstdc++/qsort.h new file mode 100644 index 0000000..c13ae0e --- /dev/null +++ b/include/libstdc++/qsort.h @@ -0,0 +1,15 @@ +#ifndef POKEREVO_QSORT_H +#define POKEREVO_QSORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +void qsort(void *base, u32 nmemb, u32 size, + s32 (*compar)(const void *, const void *)); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_QSORT_H diff --git a/include/nonport.h b/include/nonport.h deleted file mode 100644 index c1ed0e7..0000000 --- a/include/nonport.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEREVO_NONPORT_H -#define POKEREVO_NONPORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -void *gsimalloc(u32 sz); -void *gsirealloc(void *ptr, u32 sz); -void gsifree(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_NONPORT_H diff --git a/include/qsort.h b/include/qsort.h deleted file mode 100644 index c13ae0e..0000000 --- a/include/qsort.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef POKEREVO_QSORT_H -#define POKEREVO_QSORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -void qsort(void *base, u32 nmemb, u32 size, - s32 (*compar)(const void *, const void *)); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_QSORT_H -- cgit v1.2.3 From c285b7af502dfe463479cecfbb26313be3e5f5f4 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 29 Sep 2020 12:42:14 -0400 Subject: fix includes --- include/GameSpy/hashtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/GameSpy/hashtable.h b/include/GameSpy/hashtable.h index 784ab35..26e0b6d 100644 --- a/include/GameSpy/hashtable.h +++ b/include/GameSpy/hashtable.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include "darray.h" +#include "GameSpy/darray.h" typedef s32 (*HashFunction)(void *, s32); -- cgit v1.2.3