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