]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
Make compiler and virtual-machine compile as C++ code, also removed gmqcc_voidptr...
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 22aa499322d1067a78f581be787a16f6610a8f97..949559442021428f8555b8ce672dbb38c9d02330 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -260,54 +260,28 @@ size_t util_strtononcmd (const char *, char *, size_t);
 
 uint16_t util_crc16(uint16_t crc, const char *data, size_t len);
 
-/*
- * If we're compiling as C++ code we need to fix some subtle issues regarding casts between mem_a/mem_d
- * since C++ doesn't allow implicit conversions between void*
- */
-#ifdef __cplusplus
-        /*
-         * void * will be implicitally converted to gmqcc_voidptr using gmqcc_voidptr(void*).  This is what
-         * essentially allows us to allow implicit conversion to whatever pointer type we're trying to assign
-         * to because it acks as a default assignment constructor.
-         */
-        class gmqcc_voidptr {
-            void *m_pointer;
-        public:
-            gmqcc_voidptr(void *pointer) :
-                m_pointer(pointer)
-            { };
-
-            template <typename T>
-            GMQCC_INLINE operator T *() {
-                return m_pointer;
-            }
-        };
-
-#      define GMQCC_IMPLICIT_POINTER(X) (gmqcc_voidptr(X))
-#else
-#      define GMQCC_IMPLICIT_POINTER(X) (X)
-#endif
-
 #ifdef NOTRACK
-#    define mem_a(x)    GMQCC_IMPLICIT_POINTER(malloc (x))
+#    define mem_a(x)    malloc (x)
 #    define mem_d(x)    free   ((void*)x)
 #    define mem_r(x, n) realloc((void*)x, n)
 #else
-#    define mem_a(x)    GMQCC_IMPLICIT_POINTER(util_memory_a((x), __LINE__, __FILE__))
+#    define mem_a(x)    util_memory_a((x), __LINE__, __FILE__)
 #    define mem_d(x)    util_memory_d((void*)(x),      __LINE__, __FILE__)
 #    define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__)
 #endif
 
 /*
  * A flexible vector implementation: all vector pointers contain some
- * data baout themselfs exactly - sizeof(vector_t) behind the pointer
+ * data about themselfs exactly - sizeof(vector_t) behind the pointer
  * this data is represented in the structure below.  Doing this allows
- * use to use the array [] to access individual data from the vector
+ * us to use the array [] to access individual elements from the vector
  * opposed to using set/get methods.
  */     
 typedef struct {
     size_t  allocated;
     size_t  used;
+
+    /* can be extended now! whoot */
 } vector_t;
 
 /* hidden interface */
@@ -369,12 +343,12 @@ typedef struct hash_table_t {
  */
 hash_table_t *util_htnew (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);
 size_t        util_hthash(hash_table_t *ht, const char *key);
-void         *util_htgeth(hash_table_t *ht, const char *key, size_t hash);
 void          util_htseth(hash_table_t *ht, const char *key, size_t hash, void *value);
 
+void         *util_htget (hash_table_t *ht, const char *key);
+void         *util_htgeth(hash_table_t *ht, const char *key, size_t hash);
 /*===================================================================*/
 /*============================ file.c ===============================*/
 /*===================================================================*/
@@ -917,15 +891,11 @@ qcint             prog_tempstring(qc_program *prog, const char *_str);
 /*===================================================================*/
 
 bool parser_init          ();
-bool parser_compile_file  (const char *filename);
-bool parser_compile_string(const char *name, const char *str);
-bool parser_finish        (const char *output);
+bool parser_compile_file  (const char *);
+bool parser_compile_string(const char *, const char *, size_t);
+bool parser_finish        (const char *);
 void parser_cleanup       ();
 
-/* TODO: make compile_string accept len and remove this */
-/* There's really no need to strlen() preprocessed files */
-bool parser_compile_string_len(const char *name, const char *str, size_t len);
-
 /*===================================================================*/
 /*====================== ftepp.c commandline ========================*/
 /*===================================================================*/