-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathxawk.h
66 lines (49 loc) · 1.61 KB
/
xawk.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* xawk.h
*/
#ifdef __STDC__
#define PROTOTYPE(X) X
#else
#define PROTOTYPE(X) ( )
#endif
/* This FBLOCK decliaration must exactally match the one in symtype.h
by having a copy of it here xawk.h is the only file that must be
included in the external function source code.
*/
typedef struct FBLOCK {
char *name ;
void *code ;
Rettype (*addr)() ;
unsigned short nargs ;
unsigned short nrets ;
char *typev ; /* array of size nargs holding types */
} FBLOCK ; /* function block */
/* Stack access functions
*/
/* Return argument #n from the stack as an awk CELL pointer
*/
void *xawk_arg PROTOTYPE((void *sp, int nargs, int n));
/* Extract a number from an awk stack CELL pointer.
*/
double xawk_num PROTOTYPE((void *cp));
/* Extract a string from an awk stack CELL pointer.
*/
char *xawk_str PROTOTYPE((void *cp));
/* Function to get argument #n as a number or string.
*/
double xawk_numarg PROTOTYPE((void *sp, int nargs, int n));
char *xawk_strarg PROTOTYPE((void *sp, int nargs, int n));
/* Functions to index a CELL pointer as an array with a number
or a string.
*/
void *xawk_stridx PROTOTYPE((void *ap, char *idx));
void *xawk_numidx PROTOTYPE((void *ap, double idx));
/* Function to push return values onto the stack.
*/
void *xawk_pshnum PROTOTYPE((void *sp, double d, int format));
void *xawk_pshstr PROTOTYPE((void *sp, char *str));
void xawk_return PROTOTYPE((void *sp, int n));
/* Functions to set values in CELL pointers returned by
array index functions above.
*/
void xawk_setnum PROTOTYPE((void *cell, double d));
void xawk_setstr PROTOTYPE((void *cell, char *str));