xref: /titanic_41/usr/src/lib/libast/amd64/include/ast/recfmt.h (revision 56bbb0b2e5cd8cb63e98621606c4d93bb4b0453b)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * AT&T Research
28  *
29  * record format interface
30  */
31 
32 #ifndef _RECFMT_H
33 #if !defined(__PROTO__)
34 #include <prototyped.h>
35 #endif
36 #if !defined(__LINKAGE__)
37 #define __LINKAGE__		/* 2004-08-11 transition */
38 #endif
39 
40 #define _RECFMT_H		1
41 
42 #include <ast.h>
43 
44 typedef uint32_t Recfmt_t;
45 
46 #define REC_delimited		0
47 #define REC_fixed		1
48 #define REC_variable		2
49 #define REC_method		14
50 #define REC_none		15
51 
52 #define REC_M_path		0
53 #define REC_M_data		1
54 
55 #define RECTYPE(f)		(((f)>>28)&((1<<4)-1))
56 
57 #define REC_D_TYPE(d)		((REC_delimited<<28)|((d)&((1<<8)-1)))
58 #define REC_D_DELIMITER(f)	((f)&((1<<8)-1))
59 
60 #define REC_F_TYPE(s)		((REC_fixed<<28)|((s)&((1<<28)-1)))
61 #define REC_F_SIZE(f)		((f)&((1<<28)-1))
62 
63 #define REC_U_TYPE(t,a)		(((t)<<28)|((a)&((1<<28)-1)))
64 #define REC_U_ATTRIBUTES(f)	((f)&~((1<<28)-1))
65 
66 #define REC_V_TYPE(h,o,z,l,i)	((REC_variable<<28)|((h)<<23)|((o)<<19)|(((z)-1)<<18)|((l)<<17)|((i)<<16))
67 #define REC_V_RECORD(f,s)	(((f)&(((1<<16)-1)<<16))|(s))
68 #define REC_V_HEADER(f)		(((f)>>23)&((1<<5)-1))
69 #define REC_V_OFFSET(f)		(((f)>>19)&((1<<4)-1))
70 #define REC_V_LENGTH(f)		((((f)>>18)&1)+1)
71 #define REC_V_LITTLE(f)		(((f)>>17)&1)
72 #define REC_V_INCLUSIVE(f)	(((f)>>16)&1)
73 #define REC_V_SIZE(f)		((f)&((1<<16)-1))
74 #define REC_V_ATTRIBUTES(f)	((f)&~((1<<16)-1))
75 
76 #define REC_M_TYPE(i)		((REC_method<<28)|(i))
77 #define REC_M_INDEX(f)		((f)&((1<<28)-1))
78 
79 #define REC_N_TYPE()		0xffffffff
80 
81 #if _BLD_ast && defined(__EXPORT__)
82 #undef __MANGLE__
83 #define __MANGLE__ __LINKAGE__		__EXPORT__
84 #endif
85 
86 extern __MANGLE__ char*		fmtrec __PROTO__((Recfmt_t, int));
87 extern __MANGLE__ Recfmt_t		recfmt __PROTO__((const __V_*, size_t, off_t));
88 extern __MANGLE__ Recfmt_t		recstr __PROTO__((const char*, char**));
89 extern __MANGLE__ ssize_t		reclen __PROTO__((Recfmt_t, const __V_*, size_t));
90 
91 #undef __MANGLE__
92 #define __MANGLE__ __LINKAGE__
93 
94 #endif
95