-/* Block Sorting Optimizado en memoria! */
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-typedef struct _bs_data_t_ {
- unsigned long int pos_inicial;
- unsigned long int pos_final;
- unsigned long int pos_orden;
- char ord; /* indice si esta ordenada */
-} t_BlockSortData;
+#include "bs.h"
-typedef struct _bs_t_ {
- t_BlockSortData *array;
- unsigned long int *ord;
- unsigned long int len;
-} t_BlockSort;
+/* Block Sorting Optimizado en memoria! */
typedef struct _bs_decode_t_ {
char c;
free(in);
}
-t_BlockSort *bs_create(unsigned int len)
+t_BlockSort *bs_create(unsigned long int len)
{
t_BlockSort *tmp;
free(bs);
}
-int main(int argc, char *argv[])
-{
- char *data;
- char *salida;
- unsigned long int len, i, k;
- FILE *fp;
- char c;
- t_BlockSort *bs;
-
- if (argc != 3) {
- printf("Modo de uso : %s <archivo datos> <tamaƱo pagina>\n", argv[0]);
- return 0;
- }
-
- fp = fopen(argv[1], "r");
- len = atoi(argv[2]);
-
- data = malloc(sizeof(char)*len);
- salida = malloc(sizeof(char)*(len+1));
-
- salida[len] = '\0';
- bs = bs_create(len);
-
- while ((c = fgetc(fp)) != EOF) {
- i = 0;
- while ((c!=EOF) && (i < len)) {
- data[i++] = c;
- c = fgetc(fp);
- }
- bs_solve(data, salida, bs, &k, i);
-
- /* XXX ACA SALIDA DEBERIA PASAR A LA SIGUIENTE ETAPA XXX */
- printf("%s -> %ld\n", salida, k);
- }
- fclose(fp);
- bs_destroy(bs);
-
- free(data);
- free(salida);
- return 0;
-}
-
-