feat(include): add some gx device headers

This commit is contained in:
phaneron 2024-07-08 15:26:09 -04:00
parent 172cf3792d
commit e7bb9a818a
14 changed files with 805 additions and 13 deletions

View file

@ -5,6 +5,6 @@
#include "storm/array.h"
STORM_TS_GROWABLE_ARRAY(uint32_t)
STORM_TS_GROWABLE_ARRAY(uint32_t);
#endif

View file

@ -0,0 +1,10 @@
#ifndef STORM_ARRAY_UINT8_T_H
#define STORM_ARRAY_UINT8_T_H
#include <stdint.h>
#include "storm/array.h"
STORM_TS_GROWABLE_ARRAY(uint8_t);
#endif

View file

@ -0,0 +1,47 @@
#ifndef STORM_HASH_H
#define STORM_HASH_H
#include <stdint.h>
#include "storm/array.h"
#include "storm/list.h"
#define STORM_TS_HASH(T, K) \
STORM_TS_LIST(T) \
STORM_TS_GROWABLE_ARRAY(TSList_##T) \
typedef struct TSHashTable_##T##_##K TSHashTable_##T##_##K; \
typedef struct TSHashObject_##T##_##K TSHashObject_##T##_##K; \
struct TSHashTable_##T##_##K { \
TSList_##T m_fulllist; \
uint32_t m_fulllist; \
TSGrowableArray_TSList_##T m_slotlistarray; \
uint32_t m_slotmask; \
}; \
struct TSHashObject_##T##_##K { \
uint32_t m_hashval; \
TSLink_##T m_linktoslot; \
TSLink_##T m_linktofull; \
K m_key; \
};
typedef struct HASHKEY_PTR HASHKEY_PTR;
typedef struct HASHKEY_STR HASHKEY_STR;
typedef struct HASHKEY_STRI HASHKEY_STRI;
typedef struct HASHKEY_NONE HASHKEY_NONE;
struct HASHKEY_PTR {
void* m_key;
};
struct HASHKEY_STR {
char* m_str;
};
struct HASHKEY_STRI {
char* m_str;
};
struct HASHKEY_NONE {
};
#endif

View file

@ -14,17 +14,18 @@ struct TSLink_##T { \
T* m_next; \
};
// TSList<T>
// TSLinkedNode<T>
#define STORM_TS_LINKED_NODE(T) typedef struct TSLinkedNode_##T TSLinkedNode_##T; \
#define STORM_TS_LIST(T) \
STORM_TS_LINK(T) \
typedef struct TSList_##T TSList_##T##; \
typedef struct TSLinkedNode_##T TSLinkedNode_##T; \
struct TSList_##T { \
ptrdiff_t m_linkoffset; \
TSLink_##T m_terminator; \
}; \
struct TSLinkedNode_##T { \
TSLink_##T m_link; \
};
// TSList<T>
#define STORM_TS_LIST(T) typedef struct TSList_##T TSList_##T##; \
struct TSList_##T { \
ptrdiff_t m_linkoffset; \
TSLink_##T m_terminator; \
};
#endif