xref: /illumos-gate/usr/src/cmd/sh/hash.h (revision 4283d10e18fc3904736c7c067fb29de9bb67d25d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 1990 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 #ifndef	_HASH_H
32 #define	_HASH_H
33 
34 /*
35  *	UNIX shell
36  */
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define		HASHZAP		0x03FF
42 #define		CDMARK		0x8000
43 
44 #define		NOTFOUND		0x0000
45 #define		BUILTIN			0x0100
46 #define		FUNCTION		0x0200
47 #define		COMMAND			0x0400
48 #define		REL_COMMAND		0x0800
49 #define		PATH_COMMAND	0x1000
50 #define		DOT_COMMAND		0x8800	/* CDMARK | REL_COMMAND */
51 
52 #define		hashtype(x)	(x & 0x1F00)
53 #define		hashdata(x)	(x & 0x00FF)
54 
55 
56 typedef struct entry
57 {
58 	unsigned char	*key;
59 	short	data;
60 	unsigned char	hits;
61 	unsigned char 	cost;
62 	struct entry	*next;
63 } ENTRY;
64 
65 extern ENTRY	*hfind();
66 extern ENTRY	*henter();
67 extern void	hcreate(void);
68 
69 #ifdef	__cplusplus
70 }
71 #endif
72 
73 #endif /* !_HASH_H */
74