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