1 /* 2 * BEGIN illumos section 3 * This is an unstable interface; changes may be made 4 * without notice. 5 * END illumos section 6 */ 7 /*********************************************************************** 8 * * 9 * This software is part of the ast package * 10 * Copyright (c) 1985-2011 AT&T Intellectual Property * 11 * and is licensed under the * 12 * Eclipse Public License, Version 1.0 * 13 * by AT&T Intellectual Property * 14 * * 15 * A copy of the License is available at * 16 * http://www.eclipse.org/org/documents/epl-v10.html * 17 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 18 * * 19 * Information and Software Systems Research * 20 * AT&T Research * 21 * Florham Park NJ * 22 * * 23 * Glenn Fowler <gsf@research.att.com> * 24 * David Korn <dgk@research.att.com> * 25 * Phong Vo <kpv@research.att.com> * 26 * * 27 ***********************************************************************/ 28 #pragma prototyped 29 /* 30 * David Korn 31 * AT&T Research 32 * 33 * Interface definitions for a stack-like storage library 34 * 35 */ 36 37 #ifndef _STK_H 38 #define _STK_H 39 40 #include <sfio.h> 41 42 #define _Stk_data _Stak_data 43 44 #define stkstd (&_Stk_data) 45 46 #define Stk_t Sfio_t 47 48 #define STK_SMALL 1 /* small stkopen stack */ 49 #define STK_NULL 2 /* return NULL on overflow */ 50 51 #define stkptr(sp,n) ((char*)((sp)->_data)+(n)) 52 #define stktop(sp) ((char*)(sp)->_next) 53 #define stktell(sp) ((sp)->_next-(sp)->_data) 54 #define stkseek(sp,n) ((n)==0?(char*)((sp)->_next=(sp)->_data):_stkseek(sp,n)) 55 56 #if _BLD_ast && defined(__EXPORT__) 57 #define extern extern __EXPORT__ 58 #endif 59 #if !_BLD_ast && defined(__IMPORT__) 60 #define extern extern __IMPORT__ 61 #endif 62 63 extern Sfio_t _Stk_data; 64 65 #undef extern 66 67 #if _BLD_ast && defined(__EXPORT__) 68 #define extern __EXPORT__ 69 #endif 70 71 extern Stk_t* stkopen(int); 72 extern Stk_t* stkinstall(Stk_t*, char*(*)(int)); 73 extern int stkclose(Stk_t*); 74 extern int stklink(Stk_t*); 75 extern char* stkalloc(Stk_t*, size_t); 76 extern char* stkcopy(Stk_t*, const char*); 77 extern char* stkset(Stk_t*, char*, size_t); 78 extern char* _stkseek(Stk_t*, ssize_t); 79 extern char* stkfreeze(Stk_t*, size_t); 80 extern int stkon(Stk_t*, char*); 81 82 #undef extern 83 84 #endif 85