1 /*----------------------------------------------------------------------------
2 * jacu - Just Another Compression Utility
3 *----------------------------------------------------------------------------
4 * This file is part of jacu.
6 * jacu is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the License, or (at your option) any later
11 * jacu is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License along
17 * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place, Suite 330, Boston, MA 02111-1307 USA
19 *----------------------------------------------------------------------------
32 * Implementación del Block Sorting
36 typedef unsigned long int Uint32;
38 typedef struct _bs_t_ t_BlockSort;
40 typedef struct _bs_data_t_ {
43 char ord; /* indica si esta ordenada */
45 /* Guardo el puntero al padre */
51 t_BlockSortData *array;
56 /** Inicializa un BlockSorting
58 * \param len Tamaño de página a utilizar
60 t_BlockSort *bs_create(Uint32 len);
62 /** Libera un BlockSorting
64 * \param bs BlockSorting previamente inicializado.
66 void bs_destroy(t_BlockSort *bs);
68 /** Resuelve un BlockSorting
70 * \param in Array de bytes que se pretende procesar.
71 * \param out Array donde guardar la columna resultante.
72 * \param k Puntero donde guardar la posicion del array original.
73 * \oaram leido Tamaño de in (por si el tamaño de in es menor al de la pagina).
75 void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido);
77 /** Obtiene el array original a partir de dst y k
79 * \param dst Array donde guardar el array original
80 * \param c Array generado opr bs_solve.
81 * \param k Valor retornado por bs_solve.
82 * \param len Tamaño de c
84 void bs_restore(char *dst, char *c, Uint32 k, Uint32 len);
86 int bs_readblock(FILE *fp, char *data, Uint32 pagesize, int usar_dic);
88 char *bs_finalblock(char *data, Uint32 len, Uint32 *new_size);