]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
Merge branch 'master' of github.com:graphitemaster/gmqcc
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 76412eda196d226a22fc7afc21a9817e99067954..f0f67cd2802a7afdd0de7bfa42317a3ba9580de9 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
 #    else
 #       define GMQCC_INLINE inline
 #    endif
+/*
+ * Visual studio has __forcinline we can use.  So lets use that
+ * I suspect it also has just __inline of some sort, but our use
+ * of inline is correct (not guessed), WE WANT IT TO BE INLINE
+ */
+#elseif defined(_MSC_VER)
+#    define GMQCC_INLINE __forceinline
 #else
 #    define GMQCC_INLINE
 #endif /* !__STDC_VERSION__ */
 
 
 #if defined(__GNUC__) || defined (__CLANG__)
-       typedef int          int64_t  __attribute__((__mode__(__DI__)));
-       typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
+       typedef int              int64_t  __attribute__((__mode__(__DI__)));
+       typedef unsigned int     uint64_t __attribute__((__mode__(__DI__)));
 #elif defined(_MSC_VER)
        typedef __int64          int64_t;
        typedef unsigned __int64 uint64_t;
 #else
     /*
-    * Incoorectly size the types so static assertions below will
+    * Incorrectly size the types so static assertions below will
     * fail.  There is no valid way to get a 64bit type at this point
     * without making assumptions of too many things.
     */
@@ -263,6 +270,13 @@ typedef struct hash_table_t {
 /*
  * hashtable implementation:
  * 
+ * Note:
+ *      This was designed for pointers:  you manage the life of the object yourself
+ *      if you do use this for non-pointers please be warned that the object may not
+ *      be valid if the duration of it exceeds (i.e on stack).  So you need to allocate
+ *      yourself, or put those in global scope to ensure duration is for the whole
+ *      runtime.
+ * 
  * util_htnew(size)                             -- to make a new hashtable
  * util_htset(table, key, value, sizeof(value)) -- to set something in the table
  * util_htget(table, key)                       -- to get something from the table
@@ -273,8 +287,8 @@ typedef struct hash_table_t {
  * ht    foo  = util_htnew(1024);
  * int   data = 100;
  * char *test = "hello world\n";
- * util_htset(foo, "foo", (void*)&data, sizeof(int));
- * util_gtset(foo, "bar", (void*)test,  strlen(test));
+ * util_htset(foo, "foo", (void*)&data);
+ * util_gtset(foo, "bar", (void*)test);
  * 
  * printf("foo: %d, bar %s",
  *     *((int *)util_htget(foo, "foo")),
@@ -284,7 +298,7 @@ typedef struct hash_table_t {
  * util_htdel(foo);
  */
 hash_table_t *util_htnew(size_t size);
-void          util_htset(hash_table_t *ht, const char *key, void *value, size_t size);
+void          util_htset(hash_table_t *ht, const char *key, void *value);
 void         *util_htget(hash_table_t *ht, const char *key);
 void          util_htdel(hash_table_t *ht);
 /*===================================================================*/
@@ -797,6 +811,7 @@ bool ftepp_preprocess_string(const char *name, const char *str);
 void ftepp_finish           ();
 const char *ftepp_get       ();
 void ftepp_flush            ();
+void ftepp_add_define       (const char *source, const char *name);
 
 /*===================================================================*/
 /*======================= main.c commandline ========================*/