Linux makefiles
[canaan.git] / prj / tech / libsrc / dev2d / rsd.h
blobcb58b1408cc33ab12ea7259f1133a0588aaaeeed
1 /*
2 * $Source: s:/prj/tech/libsrc/dev2d/RCS/rsd.h $
3 * $Revision: 1.1 $
4 * $Author: KEVIN $
5 * $Date: 1996/04/10 17:00:40 $
7 * Constants and macros for RSD8 bitmap processing.
9 * $Log: rsd.h $
10 * Revision 1.1 1996/04/10 17:00:40 KEVIN
11 * Initial revision
13 * Revision 1.2 1993/10/26 02:14:30 kevin
14 * Changed algorithm so that rsd_src is never advanced
15 * past the end of the bitmap. (It stays pointed to the
16 * end when the end is reached.)
18 * Revision 1.1 1992/11/12 13:51:29 kaboom
19 * Initial revision
23 #ifndef __RSD_H
24 #define __RSD_H
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 #define RSD_RUN 0
31 #define RSD_SKIP 1
32 #define RSD_DUMP 2
34 /* this is a pretty specific-use macro for getting the next rsd token from an
35 rsd input buffer. the source buffer has to be named rsd_src, the token's
36 code goes in rsd_code, and the count for the operation goes in rsd_count.
37 after a call of this macro, rsd_src is advanced to the actual data for the
38 code (pixel data for dump, run value for run) if there is any, or to the
39 beginning of the next token (for skip). */
40 #define RSD_GET_TOKEN() \
41 { \
42 if (*rsd_src == 0) /* run */ \
43 { \
44 rsd_code = RSD_RUN; \
45 rsd_count = rsd_src[1]; \
46 rsd_src += 2; \
47 /* mprintf ("run %d ",count); */ \
48 } \
49 else if (*rsd_src < 0x80) /* dump */ \
50 { \
51 rsd_code = RSD_DUMP; \
52 rsd_count = *rsd_src; \
53 rsd_src++; \
54 /* mprintf ("dump %d ",count); */ \
55 } \
56 else if (*rsd_src != 0x80) /* skip */ \
57 { \
58 rsd_code = RSD_SKIP; \
59 rsd_count = *rsd_src & 0x7f; \
60 rsd_src++; \
61 /* mprintf ("skip %d ",count); */ \
62 } \
63 else /* long op */ \
64 { \
65 ushort *rsd_usrc = (ushort *)++rsd_src; \
67 if (*rsd_usrc >= 0x8000) \
68 { \
69 if (*rsd_usrc >= 0xc000) /* long run */ \
70 { \
71 rsd_code = RSD_RUN; \
72 rsd_count = *rsd_usrc & 0x3fff; \
73 rsd_src += 2; \
74 /* mprintf ("run %d ",count); */ \
75 } \
76 else /* long dump */ \
77 { \
78 rsd_code = RSD_DUMP; \
79 rsd_count = *rsd_usrc & 0x7fff; \
80 rsd_src += 2; \
81 /* mprintf ("dump %d ",count); */ \
82 } \
83 } \
84 else if (*rsd_usrc != 0) /* long skip */ \
85 { \
86 rsd_code = RSD_SKIP; \
87 rsd_count = *rsd_usrc; \
88 rsd_src += 2; \
89 /* mprintf ("skip %d ",count); */ \
90 } \
91 else { \
92 /* subsequent uses of RSD_GET_TOKEN should also return to rsd_done.*/ \
93 rsd_code = RSD_SKIP; \
94 rsd_src-- ; \
95 goto rsd_done; \
96 } \
97 } \
100 #ifdef __cplusplus
102 #endif
103 #endif