xref: /illumos-gate/usr/src/contrib/ast/src/cmd/ksh93/include/shtable.h (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1*b30d1939SAndy Fiddaman /***********************************************************************
2*b30d1939SAndy Fiddaman *                                                                      *
3*b30d1939SAndy Fiddaman *               This software is part of the ast package               *
4*b30d1939SAndy Fiddaman *          Copyright (c) 1982-2012 AT&T Intellectual Property          *
5*b30d1939SAndy Fiddaman *                      and is licensed under the                       *
6*b30d1939SAndy Fiddaman *                 Eclipse Public License, Version 1.0                  *
7*b30d1939SAndy Fiddaman *                    by AT&T Intellectual Property                     *
8*b30d1939SAndy Fiddaman *                                                                      *
9*b30d1939SAndy Fiddaman *                A copy of the License is available at                 *
10*b30d1939SAndy Fiddaman *          http://www.eclipse.org/org/documents/epl-v10.html           *
11*b30d1939SAndy Fiddaman *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12*b30d1939SAndy Fiddaman *                                                                      *
13*b30d1939SAndy Fiddaman *              Information and Software Systems Research               *
14*b30d1939SAndy Fiddaman *                            AT&T Research                             *
15*b30d1939SAndy Fiddaman *                           Florham Park NJ                            *
16*b30d1939SAndy Fiddaman *                                                                      *
17*b30d1939SAndy Fiddaman *                  David Korn <dgk@research.att.com>                   *
18*b30d1939SAndy Fiddaman *                                                                      *
19*b30d1939SAndy Fiddaman ***********************************************************************/
20*b30d1939SAndy Fiddaman #pragma prototyped
21*b30d1939SAndy Fiddaman #ifndef _SHTABLE_H
22*b30d1939SAndy Fiddaman 
23*b30d1939SAndy Fiddaman /*
24*b30d1939SAndy Fiddaman  * David Korn
25*b30d1939SAndy Fiddaman  * AT&T Labs
26*b30d1939SAndy Fiddaman  *
27*b30d1939SAndy Fiddaman  * Interface definitions read-only data tables for shell
28*b30d1939SAndy Fiddaman  *
29*b30d1939SAndy Fiddaman  */
30*b30d1939SAndy Fiddaman 
31*b30d1939SAndy Fiddaman #define _SHTABLE_H	1
32*b30d1939SAndy Fiddaman 
33*b30d1939SAndy Fiddaman typedef struct shtable1
34*b30d1939SAndy Fiddaman {
35*b30d1939SAndy Fiddaman 	const char	*sh_name;
36*b30d1939SAndy Fiddaman 	const unsigned	sh_number;
37*b30d1939SAndy Fiddaman } Shtable_t;
38*b30d1939SAndy Fiddaman 
39*b30d1939SAndy Fiddaman struct shtable2
40*b30d1939SAndy Fiddaman {
41*b30d1939SAndy Fiddaman 	const char	*sh_name;
42*b30d1939SAndy Fiddaman 	const unsigned	sh_number;
43*b30d1939SAndy Fiddaman 	const char	*sh_value;
44*b30d1939SAndy Fiddaman };
45*b30d1939SAndy Fiddaman 
46*b30d1939SAndy Fiddaman struct shtable3
47*b30d1939SAndy Fiddaman {
48*b30d1939SAndy Fiddaman 	const char	*sh_name;
49*b30d1939SAndy Fiddaman 	const unsigned	sh_number;
50*b30d1939SAndy Fiddaman 	int		(*sh_value)(int, char*[], Shbltin_t*);
51*b30d1939SAndy Fiddaman };
52*b30d1939SAndy Fiddaman 
53*b30d1939SAndy Fiddaman #define sh_lookup(name,value)	(sh_locate(name,(Shtable_t*)(value),sizeof(*(value)))->sh_number)
54*b30d1939SAndy Fiddaman extern const Shtable_t		shtab_testops[];
55*b30d1939SAndy Fiddaman extern const Shtable_t		shtab_options[];
56*b30d1939SAndy Fiddaman extern const Shtable_t		shtab_attributes[];
57*b30d1939SAndy Fiddaman extern const struct shtable2	shtab_variables[];
58*b30d1939SAndy Fiddaman extern const struct shtable2	shtab_aliases[];
59*b30d1939SAndy Fiddaman extern const struct shtable2	shtab_signals[];
60*b30d1939SAndy Fiddaman extern const struct shtable3	shtab_builtins[];
61*b30d1939SAndy Fiddaman extern const Shtable_t		shtab_reserved[];
62*b30d1939SAndy Fiddaman extern const Shtable_t		*sh_locate(const char*, const Shtable_t*, int);
63*b30d1939SAndy Fiddaman extern int			sh_lookopt(const char*, int*);
64*b30d1939SAndy Fiddaman 
65*b30d1939SAndy Fiddaman #endif /* SH_TABLE_H */
66