Fixed a bug in dict.c
authorviric@llimona
Tue, 28 Aug 2007 01:01:49 +0200
changeset 10 188a0e3b3fb4
parent 9 225d6c820d23
child 11 68ea18fe402c
Fixed a bug in dict.c
Makefile
dict.c
dictre.h
--- a/Makefile	Sun Aug 19 11:23:57 2007 +0200
+++ b/Makefile	Tue Aug 28 01:01:49 2007 +0200
@@ -1,7 +1,7 @@
 CFLAGS=-O2 -g
 CC=gcc
 
-all: dictre idx2index trim-nou8 ia5 asciiigi-utf8-akcenton
+all: dictre idx2index trim-nou8 ia5 asciiigi-utf8-akcenton zprocess
 
 idx2index: idx2index.o dict.o
 trim-nou8: trim-nou8.c
@@ -12,6 +12,9 @@
 dictre: load.o dict.o write.o sort.o filter.o main.o fastmalloc.o repeated.o
 	$(CC) -o $@ $^
 
+zprocess: zload.o dict.o zdefs.o zhash.o zrus.o fastmalloc.o
+	$(CC) -o $@ $^
+
 dict.c: dictre.h
 write.c: dictre.h
 load.c: dictre.h
@@ -21,3 +24,7 @@
 fastmalloc.c: dictre.h
 repeated.c: dictre.h
 ia5.c: dictre.h
+zload.c: dictre.h
+zdefs.c: dictre.h
+zhash.c: dictre.h
+zrus.c: dictre.h
--- a/dict.c	Sun Aug 19 11:23:57 2007 +0200
+++ b/dict.c	Tue Aug 28 01:01:49 2007 +0200
@@ -151,8 +151,9 @@
     char *out;
     fseek(fdefs, offset, SEEK_SET);
 
-    out = (char *) malloc(length);
+    out = (char *) malloc(length+1);
     fread(out, length, 1, fdefs);
+    out[length] = 0;
     return out;
 }
 
--- a/dictre.h	Sun Aug 19 11:23:57 2007 +0200
+++ b/dictre.h	Tue Aug 28 01:01:49 2007 +0200
@@ -1,3 +1,7 @@
+enum {
+    MAXWORD=200
+};
+
 struct Words
 {
     struct Word *first;
@@ -45,3 +49,18 @@
 int def_repeated(struct Def *ptr);
 void init_repeated();
 void remove_def(int i);
+
+
+/* FOR ZPROCESS */
+/* zdefs.c */
+void zprocess_def(const char *root, char *def);
+
+
+/* zhash.c */
+void insert_word(const char *word, const char *unflexed);
+void init_wordlist();
+void dump_wordlist();
+
+/* zrus.c */
+char * mix_accents(char *a, const char *b);
+void remove_accent(unsigned char *dest, const unsigned char *from);