summaryrefslogtreecommitdiff
path: root/index.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-10-20 20:17:18 +0000
committerSimon Tatham <anakin@pobox.com>1999-10-20 20:17:18 +0000
commit8511f4ae900f48999617bc8384e9c327673e2196 (patch)
treed24d0a7d8cc217bf6d864157c3b08e05ed59868f /index.c
parente44f985bd4f796d4c4b11eb3555436dbaa2d163b (diff)
downloadhalibut-8511f4ae900f48999617bc8384e9c327673e2196.zip
halibut-8511f4ae900f48999617bc8384e9c327673e2196.tar.gz
halibut-8511f4ae900f48999617bc8384e9c327673e2196.tar.bz2
halibut-8511f4ae900f48999617bc8384e9c327673e2196.tar.xz
First backend! Text output now pretty much works.
[originally from svn r240]
Diffstat (limited to 'index.c')
-rw-r--r--index.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/index.c b/index.c
index 3f629a0..4d7cfe9 100644
--- a/index.c
+++ b/index.c
@@ -128,12 +128,13 @@ void index_merge(index *idx, int is_explicit, wchar_t *tags, word *text) {
* entries.
*/
void build_index(index *i) {
- indextag *t, **ta;
+ indextag *t;
+ word **ta;
enum23 e;
int j;
for (t = (indextag *)first23(i->tags, &e); t;
- t = (indextag *)next23(i->tags, &e)) {
+ t = (indextag *)next23(&e)) {
if (t->implicit_text) {
t->nrefs = 1;
ta = &t->implicit_text;
@@ -156,10 +157,9 @@ void cleanup_index(index *i) {
indextag *t;
indexentry *ent;
enum23 e;
- int j;
for (t = (indextag *)first23(i->tags, &e); t;
- t = (indextag *)next23(i->tags, &e)) {
+ t = (indextag *)next23(&e)) {
sfree(t->name);
free_word_list(t->implicit_text);
sfree(t->explicit_texts);
@@ -168,30 +168,29 @@ void cleanup_index(index *i) {
}
freetree23(i->tags);
for (ent = (indexentry *)first23(i->entries, &e); ent;
- ent = (indexentry *)next23(i->entries, &e)) {
+ ent = (indexentry *)next23(&e)) {
sfree(ent);
}
freetree23(i->entries);
sfree(i);
}
+static void dbg_prtwordlist(int level, word *w);
+static void dbg_prtmerge(int is_explicit, wchar_t *tag, word *text);
+
void index_debug(index *i) {
indextag *t;
enum23 e;
int j;
for (t = (indextag *)first23(i->tags, &e); t;
- t = (indextag *)next23(i->tags, &e)) {
+ t = (indextag *)next23(&e)) {
if (t->implicit_text)
dbg_prtmerge(0, t->name, t->implicit_text);
for (j = 0; j < t->nexplicit; j++)
dbg_prtmerge(1, t->name, t->explicit_texts[j]);
}
}
-#define DEBUG
-
-#ifdef DEBUG
-static void dbg_prtwordlist(int level, word *w);
static void dbg_prtmerge(int is_explicit, wchar_t *tag, word *text) {
printf("\\IM: %splicit: \"", is_explicit ? "ex" : "im");
@@ -221,4 +220,3 @@ static void dbg_prtwordlist(int level, word *w) {
printf("\n");
}
}
-#endif