1
/******************************************************************
2
Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
6
Permission to use, copy, modify, and distribute this software and its
7
documentation for any purpose and without fee is hereby granted,
8
provided that the above copyright notice appear in all copies and that
9
both that copyright notice and this permission notice appear in
10
supporting documentation, and that the names of Digital or MIT not be
11
used in advertising or publicity pertaining to distribution of the
12
software without specific, written prior permission.
14
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22
Author: Hiroyuki Miyamoto Digital Equipment Corporation
25
This version tidied and debugged by Steve Underwood May 1999
27
******************************************************************/
36
#if defined(VAXC) && !defined(__DECC)
37
#define xim_externalref globalref
38
#define xim_externaldef globaldef
40
#define xim_externalref extern
41
#define xim_externaldef
44
/* Definitions for FrameMgr */
46
#define COUNTER_MASK 0x10
50
BIT8 = 0x1, /* {CARD8* | INT8*} */
51
BIT16 = 0x2, /* {CARD16* | INT16*} */
52
BIT32 = 0x3, /* {CARD32* | INT32*} */
53
BIT64 = 0x4, /* {CARD64* | INT64*} */
54
BARRAY = 0x5, /* int*, void* */
55
ITER = 0x6, /* int* */
56
POINTER = 0x7, /* specifies next item is a PTR_ITEM */
57
PTR_ITEM = 0x8, /* specifies the item has a pointer */
58
/* BOGUS - POINTER and PTR_ITEM
59
* In the current implementation, PTR_ITEM should be lead by
60
* POINTER. But actually, it's just redundant logically. Someone
61
* may remove this redundancy and POINTER from the enum member but he
62
* should also modify the logic in FrameMgr program.
64
PADDING = 0x9, /* specifies that a padding is needed.
65
* This requires extra data in data field.
67
EOL = 0xA, /* specifies the end of list */
69
COUNTER_BIT8 = COUNTER_MASK | 0x1,
70
COUNTER_BIT16 = COUNTER_MASK | 0x2,
71
COUNTER_BIT32 = COUNTER_MASK | 0x3,
72
COUNTER_BIT64 = COUNTER_MASK | 0x4
75
/* Convenient macro */
76
#define _FRAME(a) {a, NULL}
77
#define _PTR(p) {PTR_ITEM, (void *)p}
78
/* PADDING's usage of data field
79
* B15-B8 : Shows the number of effective items.
80
* B7-B0 : Shows padding unit. ex) 04 shows 4 unit padding.
82
#define _PAD2(n) {PADDING, (void*)((n)<<8|2)}
83
#define _PAD4(n) {PADDING, (void*)((n)<<8|4)}
85
#define FmCounterByte 0
86
#define FmCounterNumber 1
88
#define _BYTE_COUNTER(type, offset) \
89
{(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterByte)}
91
#define _NUMBER_COUNTER(type, offset) \
92
{(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterNumber)}
94
typedef struct _XimFrame
97
void* data; /* For PTR_ITEM and PADDING */
98
} XimFrameRec, *XimFrame;
110
typedef struct _FrameMgr *FrameMgr;
112
FrameMgr FrameMgrInit(XimFrame frame, char* area, Bool byte_swap);
113
void FrameMgrInitWithData(FrameMgr fm, XimFrame frame, void* area,
115
void FrameMgrFree(FrameMgr fm);
116
FmStatus FrameMgrSetBuffer(FrameMgr, void*);
117
FmStatus _FrameMgrPutToken(FrameMgr, void*, int);
118
FmStatus _FrameMgrGetToken(FrameMgr, void*, int);
119
FmStatus FrameMgrSetSize(FrameMgr, int);
120
FmStatus FrameMgrSetIterCount(FrameMgr, int);
121
FmStatus FrameMgrSetTotalSize(FrameMgr, int);
122
int FrameMgrGetTotalSize(FrameMgr);
123
int FrameMgrGetSize(FrameMgr);
124
FmStatus FrameMgrSkipToken(FrameMgr, int);
125
void FrameMgrReset(FrameMgr);
126
Bool FrameMgrIsIterLoopEnd(FrameMgr, FmStatus*);
128
#define FrameMgrPutToken(fm, obj) _FrameMgrPutToken((fm), &(obj), sizeof(obj))
129
#define FrameMgrGetToken(fm, obj) _FrameMgrGetToken((fm), &(obj), sizeof(obj))
131
#endif /* FRAMEMGR_H */