]> git.llucax.com Git - z.facultad/75.06/jacu.git/commitdiff
Limpio de basura todo el codigo
authorRicardo Markiewicz <gazer.arg@gmail.com>
Fri, 25 Jun 2004 04:19:18 +0000 (04:19 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Fri, 25 Jun 2004 04:19:18 +0000 (04:19 +0000)
src/blocksorting/bs.c
src/jacu.c
src/mtf/mtf.c

index ddd6aef86a89e989fb5b7bd200b99bebb4f13be8..fa1415253f979ef07453d44358a123aefa06f14d 100644 (file)
@@ -27,18 +27,11 @@ int _compare(const void *d1, const void *d2) {
 
 int __compare(const void *d1, const void *d2) {
        t_BlockSortData *s1, *s2;
-       char i;
 
        s1 = (t_BlockSortData *)d1;
        s2 = (t_BlockSortData *)d2;
 
-       i = es_menor(s1->bs->data, s1->bs, s1->pos_inicial, s2->pos_inicial);
-
-/*     if (i == 0) {*/
-               /* si ambos strings son iguales, fuerzo a que d1 quede primero */
-               /*return -1;
-       }*/
-       return i;
+       return  es_menor(s1->bs->data, s1->bs, s1->pos_inicial, s2->pos_inicial);
 }
 
 char es_menor(char *data, t_BlockSort *bs, int i, int j)
@@ -73,15 +66,6 @@ void ordenar_array(char *data, t_BlockSort *bs)
        qsort(bs->array, bs->len, sizeof(t_BlockSortData), __compare);
 }
 
-void print_(char *data, Uint32 pos, Uint32 len)
-{
-       Uint32 i;
-
-       for(i=0; i<len; i++)
-               fprintf(stderr, "%c", data[(pos+i)%len]);
-       fprintf(stderr, "\n");
-}
-
 int generar_salida(char *data, t_BlockSort *bs, char *salida)
 {
        Uint32 i, k;
@@ -92,7 +76,6 @@ int generar_salida(char *data, t_BlockSort *bs, char *salida)
 
        k=-1;
        for(i=0; i<bs->len; i++) {
-               /* print_(data, bs->array[i].pos_inicial, bs->len); */
                out[i] = data[bs->array[i].pos_final];
                if (bs->array[i].ord == 1) k = i;
        }
@@ -117,18 +100,6 @@ void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido)
        bs->len = l;
 }
 
-void print_v(t_BlockSortDecode *d, size_t len)
-{
-       size_t i;
-       
-       for(i=0; i<len; i++)
-               printf("(%ld)", d[i].sig);
-       printf("\n");
-       for(i=0; i<len; i++)
-               printf("(%d)", d[i].c);
-       printf("\n");
-}
-
 void bs_restore(char *dst, char *c, Uint32 k, Uint32 len)
 {
        Uint32 i, current;
@@ -141,11 +112,7 @@ void bs_restore(char *dst, char *c, Uint32 k, Uint32 len)
                in[i].sig = i;
        }
 
-       /*printf("Antes de QSort\n");
-       print_v(in, len);*/
        qsort(in, len, sizeof(t_BlockSortDecode), _compare);
-       /*printf("Despues de QSort\n");
-       print_v(in, len);*/
        
        current = k;
        i=0;
@@ -154,8 +121,6 @@ void bs_restore(char *dst, char *c, Uint32 k, Uint32 len)
                current = in[current].sig;
        } while (current != k);
        free(in);
-
-       if (i < len) printf("Noo %ld != %ld\n", i, len);
 }
 
 t_BlockSort *bs_create(Uint32 len)
index 089bc7930fcd5aec94425a45d257448af371c607..62939f47528d0f63fa48059c5df361c466095844 100644 (file)
@@ -130,28 +130,9 @@ int main(int argc, char* argv[])
                        /* Aplico el BlockSorting */
                        bs_solve(data, salida, bs, &k, i);
 
-                       /*printf("BS k=%ld\n", *(Uint32 *)(salida+sizeof(Uint32)));
-                       printf("PageSize = %ld\n", *(Uint32 *)salida);
-
-                       printf("Antes de MTF = %ld [", i);
-                       {
-                               int ii;
-                               for(ii=0; ii<(i+sizeof(Uint32)); ii++)
-                                       printf("(%c)", salida[ii+sizeof(Uint32)]);
-                               printf("]\n");
-                       }*/
-                       
                        /* Le aplico el MTF, salteo el tamaƱo del bloque para que no se pierda. */
                        mtf = jacu_mtf(salida+sizeof(Uint32), i+sizeof(Uint32), &z, &z_len);
-/*
-                       printf("MTF Z (len=%d) = [", z_len);
-                       {
-                               int ii;
-                               for(ii=0; ii<z_len; ii++)
-                                       printf("(%c)", z[ii]);
-                               printf("]\n");
-
-                       }*/
+                       
                        /* Si me lo piden, aplico ZG. */
                        if (zflag) {
                                size_t len;
@@ -216,37 +197,12 @@ int main(int argc, char* argv[])
                                z = malloc(sizeof(unsigned char)*z_len);
                                moredata = shuff_decode_chunk(shuff,z,z_len,&decoded);                          
 
-                               /*printf("MTF Z (len=%d) = [", z_len);
-                               {
-                                       int ii;
-                                       for(ii=0; ii<z_len; ii++)
-                                               printf("(%c)", z[ii]);
-                                       printf("]\n");
-       
-                               }*/
-                               
                                block = malloc(block_size*sizeof(unsigned char)+sizeof(Uint32));
                                orig = malloc(block_size*sizeof(unsigned char));
                                moredata = shuff_decode_chunk(shuff,block,block_size+sizeof(Uint32),&decoded);                          
 
-                               /*printf("Antes MTF_inv = [");
-                               {
-                                       int ii;
-                                       for(ii=0; ii<block_size+sizeof(Uint32); ii++)
-                                               printf("(%c)", block[ii]);
-                                       printf("]\n");
-                               }*/
-                               /* Hago el MTF inverso */
                                mtf = jacu_mtf_inv(z, block, block_size*sizeof(unsigned char)+sizeof(Uint32));
 
-                               /*printf("Luego de MTF Inv= [");
-                               {
-                                       int ii;
-                                       for(ii=0; ii<block_size+sizeof(Uint32); ii++)
-                                               printf("(%c)", mtf[ii]);
-                                       printf("]\n");
-                               }*/
-
                                /* Luego de hacer el MTF inverso ya puedo recuperar el k */
                                memcpy(&k, mtf, sizeof(Uint32));
 
index 9f394e31ae0d6749c7f4b2147a9713729f72c223..460b790d5a7c6cffe90b56c126657ddb178d2993 100644 (file)
@@ -71,7 +71,6 @@ int no_pertenece(char *z, char c, int len)
 {
        int i;
        
-       /* XXX Z NO TIENE 255 POSICIONES XXX */
        for(i=0; i<len; i++)
                if (z[i] == c)
                        return 0;