From: kim Date: Tue, 14 Feb 2012 13:45:44 +0000 (+0000) Subject: Create branch new-trunk to track developpement of trunk and allow to make non compati... X-Git-Url: http://git.nguyen.vg/gitweb/?a=commitdiff_plain;h=a56dda3a95d2df268969bd3c2c994b5d2f020410;hp=338b9d601d0bae8ee76813852ea146ef7ba901d8;p=SXSI%2FTextCollection.git Create branch new-trunk to track developpement of trunk and allow to make non compatible changes (manly to the makefile). git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/branches/TextCollection/new-trunk@1227 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- diff --git a/HeapProfiler.cpp b/HeapProfiler.cpp index 7091a53..348fee6 100644 --- a/HeapProfiler.cpp +++ b/HeapProfiler.cpp @@ -27,7 +27,7 @@ unsigned long HeapProfiler::consumption = 0, HeapProfiler::maxConsumption = 0; AllocatedBlocks HeapProfiler::blocks; // Override initialising hook from the C library. -void (* volatile __malloc_initialize_hook) (void) = HeapProfiler::InitHooks; +void (*__malloc_initialize_hook) (void) = HeapProfiler::InitHooks; // Variables to save original hooks. void *(*HeapProfiler::old_malloc_hook)(size_t, const void *); diff --git a/lzindex/lztrie.c b/lzindex/lztrie.c index 2ac090a..7e4453d 100644 --- a/lzindex/lztrie.c +++ b/lzindex/lztrie.c @@ -174,7 +174,7 @@ trieNode parentLZTrie (lztrie T, trieNode i) { if (i == ROOT) return NULLT; // parent of root if (T->boost[T->letters[i-rank(T->pdata->bdata,i)]] == i) return ROOT; - return _enclose (T->pdata,i); + return enclose (T->pdata,i); } // subtree size diff --git a/lzindex/parentheses.c b/lzindex/parentheses.c index abb0a17..15c8a92 100644 --- a/lzindex/parentheses.c +++ b/lzindex/parentheses.c @@ -275,7 +275,7 @@ uint excess (parentheses P, uint i) // open position of closest parentheses pair that contains the pair // that opens at i, ~0 if no parent -uint _enclose (parentheses P, uint i) +uint enclose (parentheses P, uint i) { if (i == 0) return ~0; // no parent! return findparent (P,i); diff --git a/lzindex/parentheses.h b/lzindex/parentheses.h index b1a821a..05b6aaa 100644 --- a/lzindex/parentheses.h +++ b/lzindex/parentheses.h @@ -35,7 +35,7 @@ uint findopen (parentheses P, uint i); uint excess (parentheses P, uint i); // open position of closest parentheses pair that contains the pair // that opens at i, ~0 if no parent -uint _enclose (parentheses P, uint i); +uint enclose (parentheses P, uint i); uint sizeofParentheses(parentheses P); #endif diff --git a/makefile b/makefile index 92d83d8..8c88467 100644 --- a/makefile +++ b/makefile @@ -1,28 +1,24 @@ -HIDE=@ CC = g++ LIBCDSPATH = ../libcds -CPPFLAGS = -Wall -ansi -g -I$(LIBCDSPATH)/includes/ -O3 -DNDEBUG -Wno-deprecated-declarations +CPPFLAGS = -Wall -ansi -g -I$(LIBCDSPATH)/includes/ -O3 -DNDEBUG #CPPFLAGS = -Wall -ansi -g -I$(LIBCDSPATH)/includes/ LIBCDSA = $(LIBCDSPATH)/lib/libcds.a LIBRLCSA = incbwt/rlcsa.a LIBLZTRIE = lzindex/lztrie.a LIBSWCSA = swcsa/swcsa.a -LIBS= ${LIBRLCSA} ${LIBCDSA} ${LIBLZTRIE} ${LIBSWCSA} dcover_obs = dcover/difference_cover.o TextCollection_obs = TextCollection.o TextCollectionBuilder.o FMIndexBuilder.o RLCSABuilder.o FMIndex.o Tools.o \ - TextStorage.o Query.o EditDistance.o ResultSet.o + TextStorage.o Query.o EditDistance.o ResultSet.o ${LIBRLCSA} ${LIBCDSA} ${LIBLZTRIE} ${LIBSWCSA} TCDebug_obs = bittree.o rbtree.o dynFMI.o -TEXTCOLLECTION_A=libTextCollection.a - all: testTextCollection -testTextCollection: testTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs) HeapProfiler.o - $(CC) -o testTextCollection testTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs) HeapProfiler.o +testTextCollection: testTextCollection.o $(TextCollection_obs) $(TCDebug_obs) HeapProfiler.o + $(CC) -o testTextCollection testTextCollection.o $(TextCollection_obs) $(TCDebug_obs) HeapProfiler.o -timeTextCollection: timeTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs) +timeTextCollection: timeTextCollection.o $(TextCollection_obs) $(TCDebug_obs) $(CC) -o timeTextCollection timeTextCollection.o $(TextCollection_obs) $(TCDebug_obs) test2dRange: test2dRange.o ${LIBCDSA} @@ -37,24 +33,6 @@ lzindex/lztrie.a: swcsa/swcsa.a: @make -C swcsa -%o: %c - @echo [C] $@ - $(HIDE) (gcc -c $(CPPFLAGS) $< -o $@ - -%o: %cpp - @echo [C++] $@ - $(HIDE) $(CC) -c $(CPPFLAGS) $< -o $@ - - -$(TEXTCOLLECTION_A): $(TextCollection_obs) $(LIBS) - @echo [Link] $@ - $(HIDE) rm -rf .objs - $(HIDE) mkdir .objs - $(HIDE) (cd .objs; ar x ../${LIBRLCSA};ar x ../${LIBLZTRIE}; ar x ../${LIBSWCSA}) - $(HIDE) ar rcs $@ $(TextCollection_obs) .objs/*.o -# $(HIDE) rm -rf .objs - - clean: @make clean -C incbwt @make clean -C lzindex diff --git a/swcsa/Makefile b/swcsa/Makefile index cdd5672..1d07e36 100644 --- a/swcsa/Makefile +++ b/swcsa/Makefile @@ -32,7 +32,7 @@ wcsa: intIndexPackage buildFacade.o parameters.o hash.o valstring.o MemoryManage mv bitmap.o bitmapswcsa.o mv parameters.o parametswcsa.o ar rc $(LIBINTINDEX) parametswcsa.o buildFacade.o hashswcsa.o valstring.o MemoryManager.o basicsswcsa.o \ - bitmapswcsa.o huffDecswcsa.o huffswcsa.o fileInfo.o + bitmapswcsa.o huffDecswcsa.o huffswcsa.o fileInfo.o mv $(LIBINTINDEX) $(LIBINDEX) ################# SELF INDEX ON INTEGERS ############################## @@ -44,10 +44,10 @@ intIndexPackage: ####################### UTILS MODULES ################################# -parameters.o: - $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/parameters.c +parameters.o: + $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/parameters.c -fileInfo.o: +fileInfo.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/fileInfo.c hash.o: MemoryManager.o @@ -57,28 +57,28 @@ hash.o: MemoryManager.o MemoryManager.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/MemoryManager.c -valstring.o: - $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/valstring.c +valstring.o: + $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/valstring.c -huff.o: +huff.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/huff.c -huffDec.o: +huffDec.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/huffDec.c -basics.o: +basics.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/basics.c -bitmap.o: +bitmap.o: $(CC) $(CFLAGS) -c $(SRCDIRUTILS)/bitmap.c ############################ CLEANING ################################# -cleanO: +cleanO: rm -f *.o - + clean: cd $(SRCDIRCSA) && $(MAKE) clean -w rm -rf *~ *% *.o core *.bak $(LIBINTINDEX) $(LIBINDEX) diff --git a/swcsa/buildFacade.c b/swcsa/buildFacade.c index b581059..3647e99 100755 --- a/swcsa/buildFacade.c +++ b/swcsa/buildFacade.c @@ -823,7 +823,7 @@ int build_WCSA (uchar *text, ulong length, char *build_options, void **index) { tmpOffsets[zeroNode]=tmpOffset; //setting pointer to the "virtual" word {zeroNode+1}^{th} //kbit encoding of the offsets - uint elemSize = _bits(tmpOffset); + uint elemSize = bits(tmpOffset); wcsa->wordsData.elemSize = elemSize; wcsa->wordsData.words = (uint *) malloc (((((zeroNode +1)*elemSize)+W-1) /W) * sizeof(uint)); //with 1 extra slot !. wcsa->wordsData.words[((((zeroNode +1)*elemSize)+W-1) /W) -1 ] =0000; diff --git a/swcsa/intIndex/Makefile b/swcsa/intIndex/Makefile index 8f02954..3fb9c0c 100755 --- a/swcsa/intIndex/Makefile +++ b/swcsa/intIndex/Makefile @@ -5,7 +5,7 @@ CC = g++ ifndef CFLAGS ##possibly already defined by the "main Makefile". ##CFLAGS = -O9 -m32 - CFLAGS = -O9 -m32 + CFLAGS = -O9 -m32 ##CFLAGS = -g -m32 -O0 endif @@ -15,41 +15,41 @@ all: intIndex cleanO intIndex: icsa.o parameters.o basics.o huff.o bitmap.o psiHuffmanRLE.o psiDeltaCode.o psiGonzalo.o - ar rc $(LIBINTINDEX) icsa.o psiHuffmanRLE.o psiDeltaCode.o psiGonzalo.o + ar rc $(LIBINTINDEX) icsa.o psiHuffmanRLE.o psiDeltaCode.o psiGonzalo.o #not including "parameters.o basics.o bitmap.o huff.o" as they are included by wcsa #they are already included into the library by the presentation layer. -icsa.o: parameters.o basics.o bitmap.o huff.o psiHuffmanRLE.o psiDeltaCode.o psiGonzalo.o - $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/icsa.c +icsa.o: parameters.o basics.o bitmap.o huff.o psiHuffmanRLE.o psiDeltaCode.o psiGonzalo.o + $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/icsa.c psiHuffmanRLE.o: huff.o - $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiHuffmanRLE.c + $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiHuffmanRLE.c psiDeltaCode.o: - $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiDeltaCode.c + $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiDeltaCode.c psiGonzalo.o: huff.o - $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiGonzalo.c + $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRCSA)/psiGonzalo.c -parameters.o: - $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRUTILS)/parameters.c - - -huff.o: +parameters.o: + $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRUTILS)/parameters.c + + +huff.o: $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRUTILS)/huff.c -basics.o: +basics.o: $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRUTILS)/basics.c -bitmap.o: +bitmap.o: $(CC) $(CFLAGS) -c $(SRCDIR)/$(SRCDIRUTILS)/bitmap.c -cleanO: +cleanO: rm -f *.o - + clean: - rm -rf *~ *% *.o core *.bak icsa.a + rm -rf *~ *% *.o core *.bak icsa.a tar: tar czvf icsa.tar.gz Makefile diff --git a/swcsa/intIndex/icsa.h b/swcsa/intIndex/icsa.h index 523859d..102832c 100644 --- a/swcsa/intIndex/icsa.h +++ b/swcsa/intIndex/icsa.h @@ -1 +1 @@ -//#include #include #include #include #include #include "defValues.h" #include "../utils/bitmap.h" #include "../utils/huff.h" #include "../utils/parameters.h" #ifdef PSI_HUFFMANRLE #include "psiHuffmanRLE.h" #endif #ifdef PSI_GONZALO #include "psiGonzalo.h" #endif #ifdef PSI_DELTACODES #include "psiDeltaCode.h" #endif typedef struct { uint suffixArraySize; uint T_Psi; uint *D; bitmap bD; uint T_A; uint T_AInv; uint *samplesA; uint samplesASize; uint *BA; bitmap bBA; uint *samplesAInv; uint samplesAInvSize; uint displayCSAState; int displayCSAPrevPosition; #ifdef PSI_HUFFMANRLE HuffmanCompressedPsi hcPsi; #endif #ifdef PSI_GONZALO GonzaloCompressedPsi gcPsi; #endif #ifdef PSI_DELTACODES DeltaCompressedPsi dcPsi; #endif //only needed during "parse_parameters". uint tempNSHUFF; uint psiSearchFactorJump; //factor of the T_Psi value. } ticsa; // FUNCTION PROTOTYPES: BUILDING THE INDEX //Creates the ICSA int buildIntIndex (uint *intVector, uint n, char *build_options, void **index ); //ticsa *createIntegerCSA (uint **aintVector, uint SAsize, char *build_options); //Returns number of elements in the indexed sequence of integers int sourceLenIntIndex(void *index, uint *numInts); //Save the index to disk int saveIntIndex(void *index, char *pathname); //void storeStructsCSA(ticsa *myicsa, char *basename); // Loads the index from disk. int loadIntIndex(char *pathname, void **index); //ticsa *loadCSA(char *basename); // Frees memory int freeIntIndex(void *index); //uint destroyStructsCSA(ticsa *myicsa); //Returns the size (in bytes) of the index over the sequence of integers. int sizeIntIndex(void *index, uint *numBytes); //uint CSA_size(ticsa *myicsa); // Shows detailed summary info of the self-index (memory usage of each structure) int printInfoIntIndex(void *index, const char tab[]); //Number of occurrences of the pattern, and the interval [left,right] in the suffix array. int countIntIndex(void *index, uint *pattern, uint length, ulong *numocc, ulong *left, ulong *right); //uint countCSA(ticsa *myicsa, uint *pattern, uint patternSize, uint *left, uint *right); // Exponential search //uint countCSABin(ticsa *myicsa, uint *pattern, uint patternSize, uint *left, uint *right); // Binary search // Returns an array with integers corresponding offsets to the occurrences of the pattern, // as well as the number of occurrences int locateIntIndex(void *index, uint *pattern, uint length, ulong **occ, ulong *numocc); //uint *locateCSA(ticsa *myicsa, uint *pattern, uint patternSize, uint *occ); //Returns the value of the source (array of integers) at a given offset. // (that is, the element "position" from the original array of uints) int displayIntIndex(void *index, ulong position, uint *value); //uint displayCSA(ticsa *myicsa, uint position); /* Private function prototypes ********************************************/ uint parametersCSA(ticsa *myicsa, char *build_options); uint displayCSAFirst(ticsa *myicsa, uint position); uint displayCSANext(ticsa *myicsa); int SadCSACompare(ticsa *myicsa, uint *pattern, uint patternSize, uint p); uint A(ticsa *myicsa, uint position); uint inverseA(ticsa *myicsa, uint offset); void showStructsCSA(ticsa *myicsa); // For Debugging \ No newline at end of file +#include #include #include #include #include #include "defValues.h" #include "../utils/bitmap.h" #include "../utils/huff.h" #include "../utils/parameters.h" #ifdef PSI_HUFFMANRLE #include "psiHuffmanRLE.h" #endif #ifdef PSI_GONZALO #include "psiGonzalo.h" #endif #ifdef PSI_DELTACODES #include "psiDeltaCode.h" #endif typedef struct { uint suffixArraySize; uint T_Psi; uint *D; bitmap bD; uint T_A; uint T_AInv; uint *samplesA; uint samplesASize; uint *BA; bitmap bBA; uint *samplesAInv; uint samplesAInvSize; uint displayCSAState; int displayCSAPrevPosition; #ifdef PSI_HUFFMANRLE HuffmanCompressedPsi hcPsi; #endif #ifdef PSI_GONZALO GonzaloCompressedPsi gcPsi; #endif #ifdef PSI_DELTACODES DeltaCompressedPsi dcPsi; #endif //only needed during "parse_parameters". uint tempNSHUFF; uint psiSearchFactorJump; //factor of the T_Psi value. } ticsa; // FUNCTION PROTOTYPES: BUILDING THE INDEX //Creates the ICSA int buildIntIndex (uint *intVector, uint n, char *build_options, void **index ); //ticsa *createIntegerCSA (uint **aintVector, uint SAsize, char *build_options); //Returns number of elements in the indexed sequence of integers int sourceLenIntIndex(void *index, uint *numInts); //Save the index to disk int saveIntIndex(void *index, char *pathname); //void storeStructsCSA(ticsa *myicsa, char *basename); // Loads the index from disk. int loadIntIndex(char *pathname, void **index); //ticsa *loadCSA(char *basename); // Frees memory int freeIntIndex(void *index); //uint destroyStructsCSA(ticsa *myicsa); //Returns the size (in bytes) of the index over the sequence of integers. int sizeIntIndex(void *index, uint *numBytes); //uint CSA_size(ticsa *myicsa); // Shows detailed summary info of the self-index (memory usage of each structure) int printInfoIntIndex(void *index, const char tab[]); //Number of occurrences of the pattern, and the interval [left,right] in the suffix array. int countIntIndex(void *index, uint *pattern, uint length, ulong *numocc, ulong *left, ulong *right); //uint countCSA(ticsa *myicsa, uint *pattern, uint patternSize, uint *left, uint *right); // Exponential search //uint countCSABin(ticsa *myicsa, uint *pattern, uint patternSize, uint *left, uint *right); // Binary search // Returns an array with integers corresponding offsets to the occurrences of the pattern, // as well as the number of occurrences int locateIntIndex(void *index, uint *pattern, uint length, ulong **occ, ulong *numocc); //uint *locateCSA(ticsa *myicsa, uint *pattern, uint patternSize, uint *occ); //Returns the value of the source (array of integers) at a given offset. // (that is, the element "position" from the original array of uints) int displayIntIndex(void *index, ulong position, uint *value); //uint displayCSA(ticsa *myicsa, uint position); /* Private function prototypes ********************************************/ uint parametersCSA(ticsa *myicsa, char *build_options); uint displayCSAFirst(ticsa *myicsa, uint position); uint displayCSANext(ticsa *myicsa); int SadCSACompare(ticsa *myicsa, uint *pattern, uint patternSize, uint p); uint A(ticsa *myicsa, uint position); uint inverseA(ticsa *myicsa, uint offset); void showStructsCSA(ticsa *myicsa); // For Debugging \ No newline at end of file diff --git a/swcsa/intIndex/psiGonzalo.c b/swcsa/intIndex/psiGonzalo.c index f5e4715..ee8f086 100644 --- a/swcsa/intIndex/psiGonzalo.c +++ b/swcsa/intIndex/psiGonzalo.c @@ -71,8 +71,8 @@ GonzaloCompressedPsi gonzaloCompressPsi(uint *Psi, uint psiSize, uint T, uint HU Hacc = createHuff (acc,HUFF-1, UNSORTED); Hlen = createHuff (lacc,samplen-2, UNSORTED); totexc = acc[0]; - pslen = _bits(psiSize+1); - _bplen = _bits(Hacc.total+Hlen.total+(1+links/samplen+totexc)*pslen); + pslen = bits(psiSize+1); + _bplen = bits(Hacc.total+Hlen.total+(1+links/samplen+totexc)*pslen); _bposS = (uint *)malloc ((((1+links/samplen)*_bplen+W-1)/W)*sizeof(uint)); _cPsi = (uint *)malloc (((Hacc.total+Hlen.total+(1+links/samplen+totexc)*pslen+W-1)/W)*sizeof(uint)); diff --git a/swcsa/intIndex/psiHuffmanRLE.c b/swcsa/intIndex/psiHuffmanRLE.c index c5b9451..ac619a1 100644 --- a/swcsa/intIndex/psiHuffmanRLE.c +++ b/swcsa/intIndex/psiHuffmanRLE.c @@ -67,11 +67,11 @@ HuffmanCompressedPsi huffmanCompressPsi(unsigned int *Psi, unsigned int psiSize, else if(diffs[index]<0) { // Valor negativo absolute_value = -diffs[index]; - binaryLenght = _bits(absolute_value); + binaryLenght = bits(absolute_value); huffmanDst[binaryLenght+negStart-1]++; } else { // Valor grande >= 128 absolute_value = diffs[index]; - binaryLenght = _bits(absolute_value); + binaryLenght = bits(absolute_value); huffmanDst[binaryLenght+bigStart-1]++; } } @@ -99,8 +99,8 @@ HuffmanCompressedPsi huffmanCompressPsi(unsigned int *Psi, unsigned int psiSize, // Calculamos o numero de mostras e o espacio ocupado por cada mostra e por cada punteiro numberOfSamples = (psiSize+T-1)/T; - sampleSize = _bits(psiSize); - pointerSize = _bits(streamSize); + sampleSize = bits(psiSize); + pointerSize = bits(streamSize); // Reservamos espacio para a secuencia e para as mostras e punteiros samples = (unsigned int *)malloc(sizeof(uint)*((numberOfSamples*sampleSize+31)/32)); @@ -132,13 +132,13 @@ HuffmanCompressedPsi huffmanCompressPsi(unsigned int *Psi, unsigned int psiSize, else if(diffs[index]<0) { // Valor negativo absolute_value = -diffs[index]; - binaryLenght = _bits(absolute_value); + binaryLenght = bits(absolute_value); ptr = encodeHuff(diffsHT,binaryLenght+negStart-1,stream,ptr); bitwrite(stream,ptr,binaryLenght,absolute_value); ptr += binaryLenght; } else { // Valor grande >= 128 absolute_value = diffs[index]; - binaryLenght = _bits(absolute_value); + binaryLenght = bits(absolute_value); ptr = encodeHuff(diffsHT,binaryLenght+bigStart-1,stream,ptr); bitwrite(stream,ptr,binaryLenght,absolute_value); ptr += binaryLenght; diff --git a/swcsa/utils/basics.c b/swcsa/utils/basics.c index c9cb275..398e975 100755 --- a/swcsa/utils/basics.c +++ b/swcsa/utils/basics.c @@ -1,6 +1,3 @@ -#ifdef __cplusplus -extern "C" { -#endif // Basics @@ -10,9 +7,9 @@ extern "C" { #include // Memory management - -static void *Malloc (size_t n) - + + void *Malloc (int n) + { void *p; if (n == 0) return NULL; p = (void*) malloc (n); @@ -22,14 +19,14 @@ static void *Malloc (size_t n) } return p; } - -static void Free (void *p) - - { if (p) free (p); + + void Free (void *p) + + { if (p) free (p); } - -static void *Realloc (void *p, size_t n) - + + void *Realloc (void *p, int n) + { if (p == NULL) return Malloc (n); if (n == 0) { Free(p); return NULL; } p = (void*) realloc (p,n); @@ -44,7 +41,7 @@ static void *Realloc (void *p, size_t n) // bits needed to represent a number between 0 and n -uint _bits (uint n) +uint bits (uint n) { uint b = 0; while (n) @@ -71,7 +68,7 @@ uint bitread (uint *e, uint p, uint len) // writes e[p..p+len-1] = s, len <= W -void bitwrite (register uint *e, register uint p, +void bitwrite (register uint *e, register uint p, register uint len, register uint s) { e += p/W; p %= W; @@ -92,7 +89,7 @@ void bitwrite (register uint *e, register uint p, } // writes e[p..p+len-1] = 0 -void bitzero2 (register uint *e, register uint p, +void bitzero2 (register uint *e, register uint p, register uint len) { e += p/W; p %= W; @@ -108,6 +105,3 @@ void bitzero2 (register uint *e, register uint p, if (len > 0) *e &= ~(((1< @@ -23,13 +19,13 @@ extern "C" { // 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) -static void *Malloc (size_t n); -static void Free (void *p); -static void *Realloc (void *p, size_t n); +void *Malloc (int n); +void Free (void *p); +void *Realloc (void *p, int n); // Data types @@ -53,7 +49,7 @@ static void *Realloc (void *p, size_t 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 @@ -112,8 +108,5 @@ void bitzero2 (uint *e, uint p, uint len); } \ } \ } -#ifdef __cplusplus - } -#endif #endif