zdefs.c
author viric <viriketo@gmail.com>
Fri, 30 Mar 2012 18:56:20 +0200
changeset 33 ebbedaa090be
parent 14 a961bb8806b9
permissions -rw-r--r--
Adding what I had in the web for zparsetext (akcentiga)
#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);
}