zdefs.c
author viric@llimona
Sat, 08 Sep 2007 09:12:50 +0200
changeset 28 75b6d5659a19
parent 14 a961bb8806b9
permissions -rw-r--r--
Better browser support.
#include <stdio.h>
#include "dictre.h"

static void new_word(const char *str)
{
    printf("%s\n", str);
}


void zprocess_def(const char *root, char *def)
{
    int index = 0;
    int res;
    /* Jump the first line (index word) Wait for \n */
    skip_newline(def, &index);
    ++index;

    res = until_newword(def, &index);
    if (res == -1)
        return;

    /* Mark words */
    do {
        int end;
        end = index;
        res = until_noword(def, &end);
        if (res == -1)
            break;
        def[end] = 0;
        insert_word(&def[index], root);
        index = end+1;
        res = until_newword(def,&index);
        if (res == -1)
            break;
    } while (1);
    free(def);
    free(root);
}