xref: /onnv-gate/usr/src/lib/krb5/dyn/dyn.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
3*0Sstevel@tonic-gate  * All rights reserved.
4*0Sstevel@tonic-gate  */
5*0Sstevel@tonic-gate 
6*0Sstevel@tonic-gate #ifndef _KRB5_DYN_DYN_H
7*0Sstevel@tonic-gate #define	_KRB5_DYN_DYN_H
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate #ifdef	__cplusplus
12*0Sstevel@tonic-gate extern "C" {
13*0Sstevel@tonic-gate #endif
14*0Sstevel@tonic-gate 
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate /*
17*0Sstevel@tonic-gate  * This file is part of libdyn.a, the C Dynamic Object library.  It
18*0Sstevel@tonic-gate  * contains the public header file.
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * There are no restrictions on this code; however, if you make any
21*0Sstevel@tonic-gate  * changes, I request that you document them so that I do not get
22*0Sstevel@tonic-gate  * credit or blame for your modifications.
23*0Sstevel@tonic-gate  *
24*0Sstevel@tonic-gate  * Written by Barr3y Jaspan, Student Information Processing Board (SIPB)
25*0Sstevel@tonic-gate  * and MIT-Project Athena, 1989.
26*0Sstevel@tonic-gate  */
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate /*
30*0Sstevel@tonic-gate  * dyn.h -- header file to be included by programs linking against
31*0Sstevel@tonic-gate  * libdyn.a.
32*0Sstevel@tonic-gate  */
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate typedef char *DynPtr;
36*0Sstevel@tonic-gate typedef struct _DynObject {
37*0Sstevel@tonic-gate      DynPtr	array;
38*0Sstevel@tonic-gate      int	el_size, num_el, size, inc;
39*0Sstevel@tonic-gate      int	debug, paranoid, initzero;
40*0Sstevel@tonic-gate } DynObjectRec, *DynObject;
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate /* Function macros */
43*0Sstevel@tonic-gate #define DynHigh(obj)	(DynSize(obj) - 1)
44*0Sstevel@tonic-gate #define DynLow(obj)	(0)
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate /* Return status codes */
47*0Sstevel@tonic-gate #define DYN_OK		-1000
48*0Sstevel@tonic-gate #define DYN_NOMEM	-1001
49*0Sstevel@tonic-gate #define DYN_BADINDEX	-1002
50*0Sstevel@tonic-gate #define DYN_BADVALUE	-1003
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate /* Function declarations */
53*0Sstevel@tonic-gate #ifdef __STDC__
54*0Sstevel@tonic-gate #define P(args) args
55*0Sstevel@tonic-gate #else
56*0Sstevel@tonic-gate #define P(args) ()
57*0Sstevel@tonic-gate #endif /* __STDC__ */
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate DynObject DynCreate P((int el_size, int inc)), DynCopy P((DynObject obj));
60*0Sstevel@tonic-gate int DynDestroy P((DynObject obj)), DynRelease P((DynObject obj));
61*0Sstevel@tonic-gate int DynAdd P((DynObject obj, void *el));
62*0Sstevel@tonic-gate int DynPut P((DynObject obj, void *el, int idx));
63*0Sstevel@tonic-gate int DynInsert P((DynObject obj, int idx, void *els, int num));
64*0Sstevel@tonic-gate int DynDelete P((DynObject obj, int idx));
65*0Sstevel@tonic-gate DynPtr DynGet P((DynObject obj, int num));
66*0Sstevel@tonic-gate DynPtr DynArray P((DynObject obj));
67*0Sstevel@tonic-gate int DynDebug P((DynObject obj, int state));
68*0Sstevel@tonic-gate int DynParanoid P((DynObject obj, int state));
69*0Sstevel@tonic-gate int DynInitzero P((DynObject obj, int state));
70*0Sstevel@tonic-gate int DynSize P((DynObject obj));
71*0Sstevel@tonic-gate int DynCapacity P((DynObject obj));
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate #undef P
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate /*
76*0Sstevel@tonic-gate  * N.B. The original code had the following comment line in it, after the last
77*0Sstevel@tonic-gate  * #endif:
78*0Sstevel@tonic-gate  * DO NOT ADD ANYTHING AFTER THIS #endif *
79*0Sstevel@tonic-gate  * This is in violatation of hdrchk standards, and so has been removed.
80*0Sstevel@tonic-gate  * If this causes any subsequent build problems, the build issues need
81*0Sstevel@tonic-gate  * to be resolved in a different fashion.
82*0Sstevel@tonic-gate  */
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate #ifdef	__cplusplus
85*0Sstevel@tonic-gate }
86*0Sstevel@tonic-gate #endif
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate #endif	/* !_KRB5_DYN_DYN_H */
89