--- /dev/null
+#----------------------------------------------------------------------------
+# jacu
+#----------------------------------------------------------------------------
+# This file is part of jacu.
+#
+# jacu is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# jacu is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along
+# with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#----------------------------------------------------------------------------
+# Creado: jue jun 17 00:41:52 ART 2004
+# Autores: Leandro Lucarella <llucare@fi.uba.ar>
+#----------------------------------------------------------------------------
+#
+# $Id: bufford.c 624 2004-05-30 20:18:04Z llucare $
+#
+
+TARGETS=zg
+COMMON=zerogrouping.o
+SRCS=zerogrouping.c zg.c
+
+#CFLAGS=-O3 -Wall -DNDEBUG
+CFLAGS=-ggdb -Wall -DDEBUG
+
+all: $(TARGETS)
+
+zg: $(COMMON) zg.o
+
+#unvol: $(COMMON) unvol.o
+
+depend:
+ makedepend -- $(CFLAGS) -- $(SRCS)
+
+clean:
+ @$(RM) -f *.o $(TARGETS)
+
+.PHONY: all clean depend
+
+# DO NOT DELETE
+
+zerogrouping.o: zerogrouping.h /usr/include/stdlib.h /usr/include/features.h
+zerogrouping.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+zerogrouping.o: /usr/lib/gcc-lib/i486-linux/3.3.4/include/stddef.h
+zg.o: zerogrouping.h /usr/include/stdlib.h /usr/include/features.h
+zg.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+zg.o: /usr/lib/gcc-lib/i486-linux/3.3.4/include/stddef.h /usr/include/stdio.h
+zg.o: /usr/include/bits/types.h /usr/include/bits/wordsize.h
+zg.o: /usr/include/bits/typesizes.h /usr/include/libio.h
+zg.o: /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h
+zg.o: /usr/include/gconv.h /usr/lib/gcc-lib/i486-linux/3.3.4/include/stdarg.h
+zg.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
--- /dev/null
+/* vim: set noexpandtab tabstop=4 shiftwidth=4 wrap:
+ *----------------------------------------------------------------------------
+ * jacu
+ *----------------------------------------------------------------------------
+ * This file is part of jacu.
+ *
+ * jacu is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * jacu is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *----------------------------------------------------------------------------
+ * Creado: lun jun 21 05:40:38 ART 2004
+ * Autores: Leandro Lucarella <llucare@fi.uba.ar>
+ *----------------------------------------------------------------------------
+ *
+ * $Id: vfile.c 748 2004-06-21 00:46:08Z llucare $
+ *
+ */
+
+#include "zerogrouping.h"
+
+/** \file
+ *
+ * Agrupador de ceros.
+ *
+ * Implementación del agrupador de ceros. TODO completar doc.
+ *
+ */
+
+/** FIXME
+ * El dst se asume que tiene reservada al menos ceil(size/2.0)+size bytes de
+ * memoria por si se llegara a expandir. size es el tamaño a leer de src. Se
+ * devuelve la cantidad de bytes escritos en dst. */
+size_t zg_group(char* dst, char *src, size_t size)
+{
+ char count;
+ size_t i;
+ size_t total = 0;
+ int in_zero = 0;
+ for (i = 0; i < size; ++i)
+ {
+ if (src[i] == '\0')
+ {
+ if (in_zero)
+ {
+ ++count; /* FIXME verificar que no pase 255 */
+ }
+ else
+ {
+ in_zero = 1; /* entramos en serie de ceros */
+ count = 0; /* reiniciamos contador de ceros */
+ }
+ }
+ else
+ {
+ if (in_zero)
+ {
+ in_zero = 0;
+ dst[total++] = '\0';
+ dst[total++] = count;
+ }
+ dst[total++] = src[i];
+ }
+ }
+ if (in_zero) /* si estaba en una serie de ceros, terminamos de escribir. */
+ {
+ dst[total++] = '\0';
+ dst[total++] = count;
+ }
+ return total;
+}
+
+size_t zg_ungroup(char* dst, char *src, size_t size)
+{
+ return 0;
+}
+
--- /dev/null
+/* vim: set noexpandtab tabstop=4 shiftwidth=4 wrap:
+ *----------------------------------------------------------------------------
+ * jacu
+ *----------------------------------------------------------------------------
+ * This file is part of jacu.
+ *
+ * jacu is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * jacu is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *----------------------------------------------------------------------------
+ * Creado: lun jun 21 05:35:10 ART 2004
+ * Autores: Leandro Lucarella <llucare@fi.uba.ar>
+ *----------------------------------------------------------------------------
+ *
+ * $Id: vfile.h 742 2004-06-20 22:34:13Z llucare $
+ *
+ */
+
+#ifndef _JACU_ZG_H_
+#define _JACU_ZG_H_
+
+#include <stdlib.h>
+
+/** \file
+ *
+ * Agrupador de ceros.
+ *
+ * Interfaz del agrupador de ceros. TODO completar doc.
+ *
+ */
+
+/** Agrupa varios ceros seguis en 2 bytes, el primero es cero y el segundo la
+ * cantidad. FIXME */
+size_t zg_group(char* dst, char *src, size_t size);
+
+/** Vuelve al original. FIXME */
+size_t zg_ungroup(char *buffer, size_t size);
+
+#endif /* _JACU_ZG_H_ */
+
--- /dev/null
+/* vim: set noexpandtab tabstop=4 shiftwidth=4 wrap:
+ *----------------------------------------------------------------------------
+ * jacu
+ *----------------------------------------------------------------------------
+ * This file is part of jacu.
+ *
+ * jacu is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * jacu is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *----------------------------------------------------------------------------
+ * Creado: lun jun 21 13:55:48 ART 2004
+ * Autores: Leandro Lucarella <llucare@fi.uba.ar>
+ *----------------------------------------------------------------------------
+ *
+ * $Id: vfile.c 748 2004-06-21 00:46:08Z llucare $
+ *
+ */
+
+#include "zerogrouping.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+/** \file
+ *
+ * Prueba de agrupador de ceros.
+ *
+ */
+
+int main(int argc, char* argv[])
+{
+ size_t pagesize = BUFSIZ;
+ size_t len;
+ char* page;
+ char* pageout;
+ if (argc > 1) pagesize = atoi(argv[1]);
+ if (!(page = malloc(pagesize))) return 1;
+ if (!(pageout = malloc(pagesize/2+pagesize+1))) /* por si se expande */
+ {
+ free(page);
+ return 1;
+ }
+ while ((len = fread(page, 1, pagesize, stdin)))
+ {
+ len = zg_group(pageout, page, len);
+ fwrite(pageout, 1, len, stdout);
+ }
+ free(page);
+ return 0;
+}
+