Annotation of 43BSDTahoe/new/jove/table.c, revision 1.1

1.1     ! root        1: /***************************************************************************
        !             2:  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
        !             3:  * is provided to you without charge, and with no warranty.  You may give  *
        !             4:  * away copies of JOVE, including sources, provided that this notice is    *
        !             5:  * included in all the files.                                              *
        !             6:  ***************************************************************************/
        !             7: 
        !             8: #include "jove.h"
        !             9: #include "table.h"
        !            10: 
        !            11: private Table  *tables = NIL;
        !            12: 
        !            13: Table *
        !            14: make_table()
        !            15: {
        !            16:        Table   *tab = (Table *) emalloc(sizeof *tab);
        !            17: 
        !            18:        tab->t_next = tables;
        !            19:        tables = tab;
        !            20:        tab->t_wordlist = NIL;
        !            21: 
        !            22:        return tab;
        !            23: }
        !            24: 
        !            25: Word *
        !            26: word_in_table(text, table)
        !            27: char   *text;
        !            28: Table  *table;
        !            29: {
        !            30:        register Word   *w;
        !            31: 
        !            32:        for (w = table_top(table); w != NIL; w = next_word(w))
        !            33:                if (strcmp(word_text(w), text) == 0)
        !            34:                        break;  /* already in list */
        !            35:        return w;
        !            36: }
        !            37: 
        !            38: void
        !            39: add_word(wname, table)
        !            40: char   *wname;
        !            41: Table  *table;
        !            42: {
        !            43:        register Word   *w;
        !            44: 
        !            45:        if (w = word_in_table(wname, table))
        !            46:                return;
        !            47:        w = (Word *) emalloc(sizeof *w);
        !            48:        word_text(w) = wname;
        !            49:        next_word(w) = table_top(table);
        !            50:        table_top(table) = w;
        !            51: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.