xref: /titanic_50/usr/src/lib/libast/sparcv9/include/ast/hashkey.h (revision 15d9d0b528387242011cdcc6190c9e598cfe3a07)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                      by AT&T Knowledge Ventures                      *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * AT&T Research
28  *
29  * 1-6 char lower-case keyword -> long hash
30  * digit args passed as HASHKEYN('2')
31  */
32 
33 #ifndef _HASHKEY_H
34 #if !defined(__PROTO__)
35 #include <prototyped.h>
36 #endif
37 #if !defined(__LINKAGE__)
38 #define __LINKAGE__		/* 2004-08-11 transition */
39 #endif
40 
41 #define _HASHKEY_H
42 
43 #define HASHKEYMAX			6
44 #define HASHKEYBIT			5
45 #define HASHKEYOFF			('a'-1)
46 #define HASHKEYPART(h,c)		(((h)<<HASHKEYBIT)+HASHKEY1(c))
47 
48 #define HASHKEYN(n)			((n)-'0'+'z'+1)
49 
50 #define HASHKEY1(c1)			((c1)-HASHKEYOFF)
51 #define HASHKEY2(c1,c2)			HASHKEYPART(HASHKEY1(c1),c2)
52 #define HASHKEY3(c1,c2,c3)		HASHKEYPART(HASHKEY2(c1,c2),c3)
53 #define HASHKEY4(c1,c2,c3,c4)		HASHKEYPART(HASHKEY3(c1,c2,c3),c4)
54 #define HASHKEY5(c1,c2,c3,c4,c5)	HASHKEYPART(HASHKEY4(c1,c2,c3,c4),c5)
55 #define HASHKEY6(c1,c2,c3,c4,c5,c6)	HASHKEYPART(HASHKEY5(c1,c2,c3,c4,c5),c6)
56 
57 #define HASHNKEY1(n,c1)			HASHKEY2((n)+HASHKEYOFF,c1)
58 #define HASHNKEY2(n,c2,c1)		HASHKEY3((n)+HASHKEYOFF,c2,c1)
59 #define HASHNKEY3(n,c3,c2,c1)		HASHKEY4((n)+HASHKEYOFF,c3,c2,c1)
60 #define HASHNKEY4(n,c4,c3,c2,c1)	HASHKEY5((n)+'a',c4,c3,c2,c1)
61 #define HASHNKEY5(n,c5,c4,c3,c2,c1)	HASHKEY6((n)+'a',c5,c4,c3,c2,c1)
62 
63 #if _BLD_ast && defined(__EXPORT__)
64 #undef __MANGLE__
65 #define __MANGLE__ __LINKAGE__		__EXPORT__
66 #endif
67 
68 extern __MANGLE__ long	strkey __PROTO__((const char*));
69 
70 #undef __MANGLE__
71 #define __MANGLE__ __LINKAGE__
72 
73 #endif
74