xref: /illumos-gate/usr/src/lib/krb5/dyn/dyn.h (revision 1da57d55)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
37c478bd9Sstevel@tonic-gate  * All rights reserved.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #ifndef _KRB5_DYN_DYN_H
77c478bd9Sstevel@tonic-gate #define	_KRB5_DYN_DYN_H
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
107c478bd9Sstevel@tonic-gate extern "C" {
117c478bd9Sstevel@tonic-gate #endif
127c478bd9Sstevel@tonic-gate 
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate /*
157c478bd9Sstevel@tonic-gate  * This file is part of libdyn.a, the C Dynamic Object library.  It
167c478bd9Sstevel@tonic-gate  * contains the public header file.
177c478bd9Sstevel@tonic-gate  *
187c478bd9Sstevel@tonic-gate  * There are no restrictions on this code; however, if you make any
197c478bd9Sstevel@tonic-gate  * changes, I request that you document them so that I do not get
207c478bd9Sstevel@tonic-gate  * credit or blame for your modifications.
217c478bd9Sstevel@tonic-gate  *
227c478bd9Sstevel@tonic-gate  * Written by Barr3y Jaspan, Student Information Processing Board (SIPB)
237c478bd9Sstevel@tonic-gate  * and MIT-Project Athena, 1989.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * dyn.h -- header file to be included by programs linking against
297c478bd9Sstevel@tonic-gate  * libdyn.a.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate typedef char *DynPtr;
347c478bd9Sstevel@tonic-gate typedef struct _DynObject {
357c478bd9Sstevel@tonic-gate      DynPtr	array;
367c478bd9Sstevel@tonic-gate      int	el_size, num_el, size, inc;
377c478bd9Sstevel@tonic-gate      int	debug, paranoid, initzero;
387c478bd9Sstevel@tonic-gate } DynObjectRec, *DynObject;
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /* Function macros */
417c478bd9Sstevel@tonic-gate #define DynHigh(obj)	(DynSize(obj) - 1)
427c478bd9Sstevel@tonic-gate #define DynLow(obj)	(0)
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /* Return status codes */
457c478bd9Sstevel@tonic-gate #define DYN_OK		-1000
467c478bd9Sstevel@tonic-gate #define DYN_NOMEM	-1001
477c478bd9Sstevel@tonic-gate #define DYN_BADINDEX	-1002
487c478bd9Sstevel@tonic-gate #define DYN_BADVALUE	-1003
49*1da57d55SToomas Soome 
507c478bd9Sstevel@tonic-gate /* Function declarations */
517c478bd9Sstevel@tonic-gate #ifdef __STDC__
527c478bd9Sstevel@tonic-gate #define P(args) args
537c478bd9Sstevel@tonic-gate #else
547c478bd9Sstevel@tonic-gate #define P(args) ()
557c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate DynObject DynCreate P((int el_size, int inc)), DynCopy P((DynObject obj));
587c478bd9Sstevel@tonic-gate int DynDestroy P((DynObject obj)), DynRelease P((DynObject obj));
597c478bd9Sstevel@tonic-gate int DynAdd P((DynObject obj, void *el));
607c478bd9Sstevel@tonic-gate int DynPut P((DynObject obj, void *el, int idx));
617c478bd9Sstevel@tonic-gate int DynInsert P((DynObject obj, int idx, void *els, int num));
627c478bd9Sstevel@tonic-gate int DynDelete P((DynObject obj, int idx));
637c478bd9Sstevel@tonic-gate DynPtr DynGet P((DynObject obj, int num));
647c478bd9Sstevel@tonic-gate DynPtr DynArray P((DynObject obj));
657c478bd9Sstevel@tonic-gate int DynDebug P((DynObject obj, int state));
667c478bd9Sstevel@tonic-gate int DynParanoid P((DynObject obj, int state));
677c478bd9Sstevel@tonic-gate int DynInitzero P((DynObject obj, int state));
687c478bd9Sstevel@tonic-gate int DynSize P((DynObject obj));
697c478bd9Sstevel@tonic-gate int DynCapacity P((DynObject obj));
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #undef P
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * N.B. The original code had the following comment line in it, after the last
757c478bd9Sstevel@tonic-gate  * #endif:
767c478bd9Sstevel@tonic-gate  * DO NOT ADD ANYTHING AFTER THIS #endif *
777c478bd9Sstevel@tonic-gate  * This is in violatation of hdrchk standards, and so has been removed.
787c478bd9Sstevel@tonic-gate  * If this causes any subsequent build problems, the build issues need
797c478bd9Sstevel@tonic-gate  * to be resolved in a different fashion.
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #endif	/* !_KRB5_DYN_DYN_H */
87