Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/seft/tst.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*******************************************************************************
*
* Project:      seft (search engine for text)
*
* File:         tst.h
*
* Author:       Owen de Kretser ([email protected])
*
* Organisation: Dept. of CS&SE, University of Melbourne
*
* Date:         April 1999
*
* Purpose:      ternary search tree functions
*
* Notes:        adapted from Bentley & Sedgewick
* 
*******************************************************************************/

#ifndef __TST
#define __TST

/***** #includes **************************************************************/

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "types.h"

/***** #defines ***************************************************************/

#define NOT_FOUND -1

/***** Data Structures ********************************************************/

typedef struct tnode *Tptr;
typedef struct tnode {
    char splitchar;

    Tptr lokid, eqkid, hikid;
    int term_index;
} Tnode;
Tptr root;

/***** Function Prototypes ****************************************************/

Tptr tst_insert(Tptr p, char *s, int);
void cleanup(Tptr p);
int tst_search(Tptr root, char *s);

/******************************************************************************/

#endif


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].