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 *----------------------------------------------------------------------------
31 typedef unsigned long int Uint32;
34 typedef struct _bs_t_ t_BlockSort;
36 typedef struct _bs_data_t_ {
39 char ord; /* indica si esta ordenada */
41 /* Guardo el puntero al padre */
47 t_BlockSortData *array;
52 /** Inicializa un BlockSorting
54 * \param len Tamaño de página a utilizar
56 t_BlockSort *bs_create(Uint32 len);
58 /** Libera un BlockSorting
60 * \param bs BlockSorting previamente inicializado.
62 void bs_destroy(t_BlockSort *bs);
64 /** Resuelve un BlockSorting
66 * \param in Array de bytes que se pretende procesar.
67 * \param out Array donde guardar la columna resultante.
68 * \param k Puntero donde guardar la posicion del array original.
69 * \oaram leido Tamaño de in (por si el tamaño de in es menor al de la pagina).
71 void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido);
73 /** Obtiene el array original a partir de dst y k
75 * \param dst Array donde guardar el array original
76 * \param c Array generado opr bs_solve.
77 * \param k Valor retornado por bs_solve.
78 * \param len Tamaño de c
80 void bs_restore(char *dst, char *c, Uint32 k, Uint32 len);
82 int bs_readblock(FILE *fp, char *data, Uint32 pagesize, int usar_dic);
84 char *bs_finalblock(char *data, Uint32 len, Uint32 *new_size);