zdefs.c
author viric@llimona
Sun, 02 Sep 2007 16:01:27 +0200
changeset 27 153c479aa0bc
parent 14 a961bb8806b9
permissions -rw-r--r--
LEGUMIN kaj aliaj gxisdatigoj.
viric@11
     1
#include <stdio.h>
viric@11
     2
#include "dictre.h"
viric@11
     3
viric@11
     4
static void new_word(const char *str)
viric@11
     5
{
viric@11
     6
    printf("%s\n", str);
viric@11
     7
}
viric@11
     8
viric@11
     9
viric@11
    10
void zprocess_def(const char *root, char *def)
viric@11
    11
{
viric@11
    12
    int index = 0;
viric@11
    13
    int res;
viric@11
    14
    /* Jump the first line (index word) Wait for \n */
viric@11
    15
    skip_newline(def, &index);
viric@11
    16
    ++index;
viric@11
    17
viric@11
    18
    res = until_newword(def, &index);
viric@11
    19
    if (res == -1)
viric@11
    20
        return;
viric@11
    21
viric@11
    22
    /* Mark words */
viric@11
    23
    do {
viric@11
    24
        int end;
viric@11
    25
        end = index;
viric@11
    26
        res = until_noword(def, &end);
viric@11
    27
        if (res == -1)
viric@11
    28
            break;
viric@11
    29
        def[end] = 0;
viric@11
    30
        insert_word(&def[index], root);
viric@11
    31
        index = end+1;
viric@11
    32
        res = until_newword(def,&index);
viric@11
    33
        if (res == -1)
viric@11
    34
            break;
viric@11
    35
    } while (1);
viric@11
    36
    free(def);
viric@11
    37
    free(root);
viric@11
    38
}