2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: suftree.h /main/3 1995/11/01 19:11:36 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
31 * Copyright (c) 1995 AT&T Corp. *
32 * All Rights Reserved *
34 * This software is licensed by AT&T Corp. *
35 * under the terms and conditions of the license in *
36 * http://www.research.att.com/orgs/ssr/book/reuse *
38 * This software was created by the *
39 * Software Engineering Research Department *
40 * AT&T Bell Laboratories *
42 * For further information contact *
43 * gsf@research.att.com *
45 ***************************************************************/
47 /* : : generated by proto : : */
50 #if !defined(__PROTO__)
51 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
52 #if defined(__cplusplus)
53 #define __MANGLE__ "C"
58 #define __PROTO__(x) x
60 #define __PARAM__(n,o) n
61 #if !defined(__STDC__) && !defined(__cplusplus)
62 #if !defined(c_plusplus)
73 #define __PROTO__(x) ()
74 #define __OTORP__(x) x
75 #define __PARAM__(n,o) o
83 #if defined(__cplusplus) || defined(c_plusplus)
84 #define __VARARG__ ...
88 #if defined(__STDARG__)
89 #define __VA_START__(p,a) va_start(p,a)
91 #define __VA_START__(p,a) va_start(p)
99 /* the type of list elements we play with */
100 typedef char Element;
102 /* for suffix trees, a tree node looks like this */
105 Element *_label; /* substring labeling the edge */
106 long int _length; /* the length of the string */
107 struct _ts_ *_child; /* list of children */
108 struct _ts_ *_sibling; /* link for the child list */
110 { /* these two fields are mutual exclusive */
111 struct _ts_ *_link; /* sub-link */
112 Element *_suffix; /* suffix */
116 /* short hand for various fields in a tree node */
117 #define LABEL(n) ((n)->_label)
118 #define LENGTH(n) ((n)->_length)
119 #define CHILD(n) ((n)->_child)
120 #define SIBLING(n) ((n)->_sibling)
121 #define LINK(n) ((n)->_uls_._link)
122 #define SUFFIX(n) ((n)->_uls_._suffix)
124 /* the following definitions are not to be seen by users */
127 #define ASSERT(p) if(!(p)) abort();
136 #define ALLOCSIZE 256 /* amount of nodes to allocate each time */
137 #define NEXT(n) ((n)->_sibling)
139 #endif /*_IN_SUF_TREE*/
141 extern __MANGLE__ Suftree* bldsuftree __PROTO__((Element*, long));
142 extern __MANGLE__ void delsuftree __PROTO__((Suftree*));
143 extern __MANGLE__ long mtchsuftree __PROTO__((Suftree*, Element*, long, Element**));