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