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