Various fixes:
[SXSI/TextCollection.git] / swcsa / utils / basics.h
index da91efb..8e2f820 100755 (executable)
@@ -5,6 +5,10 @@
 #ifndef BASICSINCLUDED
 #define BASICSINCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
   // Includes 
 
 #include <sys/types.h>
 
   // Memory management
 
-#define malloc(n) Malloc(n)
-#define free(p) Free(p)
-#define realloc(p,n) Realloc(p,n)
+  //#define malloc(n) Malloc(n)
+  //#define free(p) Free(p)
+  //#define realloc(p,n) Realloc(p,n)
 
-void *Malloc (int n);
-void Free (void *p);
-void *Realloc (void *p, int n);
+static void *Malloc (size_t n);
+static void Free (void *p);
+static void *Realloc (void *p, size_t n);
 
   // Data types
 
@@ -49,7 +53,7 @@ void *Realloc (void *p, int n);
 #define W (32)
 
        // bits needed to represent a number between 0 and n
-uint bits (uint n);
+uint _bits (uint n);
         // returns e[p..p+len-1], assuming len <= W
 uint bitread (uint *e, uint p, uint len);
         // writes e[p..p+len-1] = s, assuming len <= W
@@ -58,7 +62,7 @@ void bitwrite (uint *e, uint p, uint len, uint s);
         
     /**/ //FARI. WITH ASSUMPTION ON LEN, OR IT CRASHES 
          //NOt WORKING UPON THE LIMIT OF THE STARTING uint.
-void bitzero (uint *e, uint p, uint len);
+void bitzero2 (uint *e, uint p, uint len);
        // reads bit p from e
 #define bitget(e,p) (((e)[(p)/W] >> ((p)%W)) & 1)
        // sets bit p in e
@@ -108,5 +112,8 @@ void bitzero (uint *e, uint p, uint len);
            } \
          } \
    } 
+#ifdef __cplusplus
+ }
+#endif
 
 #endif