ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/imPfuncs.c
Revision: 1.1
Committed: Sat Feb 22 02:07:26 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id$";
3 #endif
4 /*
5 * imPfuncs - functional interface to imPress, support for imPfuncs.h
6 *
7 * Written by William LeFebvre, LCSE, Rice University
8 *
9 * This program can be freely redistributed to anyone, with the following
10 * provisions: that this comment remain intact, and that no money is
11 * charged or collected for that redistribution.
12 */
13
14 #include <stdio.h>
15 #include <varargs.h>
16 #include "imPcodes.h"
17 #include "imPfuncs.h"
18
19 /* commands with byte operands */
20
21 /* im_b(code, b) is defined in imPfuncs.h */
22
23 /* commands with word operands: */
24
25 im_w(code, w)
26
27 int code;
28 unsigned int w;
29
30 {
31 putc(code, imout);
32 im_putword(w);
33 }
34
35 im_www(code, wa, wb, wc)
36
37 int code;
38 unsigned int wa;
39 unsigned int wb;
40 unsigned int wc;
41
42 {
43 putc(code, imout);
44 im_putword(wa);
45 im_putword(wb);
46 im_putword(wc);
47 }
48
49 im_wwwww(code, wa, wb, wc, wd, we)
50
51 int code;
52 unsigned int wa;
53 unsigned int wb;
54 unsigned int wc;
55 unsigned int wd;
56 unsigned int we;
57
58 {
59 putc(code, imout);
60 im_putword(wa);
61 im_putword(wb);
62 im_putword(wc);
63 im_putword(wd);
64 im_putword(we);
65 }
66
67 /* commands with bit operands: */
68
69 im_21(code, b2, b1) /* pads 5 bits on left */
70
71 unsigned int b2;
72 unsigned int b1;
73
74 {
75 putc(code, imout);
76 im_putbyte((b2 << 1) | b1);
77 }
78
79 im_223(code, b2a, b2b, b3) /* pads 1 bit on left */
80
81 unsigned int b2a;
82 unsigned int b2b;
83 unsigned int b3;
84
85 {
86 putc(code, imout);
87 im_putbyte((b2a << 5) | (b2b << 3) | b3);
88 }
89
90 im_77(code, b7a, b7b) /* pads 2 bits on left */
91
92 unsigned int b7a;
93 unsigned int b7b;
94
95 {
96 putc(code, imout);
97 im_putword((b7a << 7) | b7b);
98 }
99
100 im_putstring(string)
101
102 char *string;
103
104 {
105 fputs(string, imout);
106 im_putbyte(0);
107 }
108
109 imCreateFamilyTable(va_alist)
110
111 va_dcl
112
113 {
114 va_list vars;
115 unsigned int family;
116 unsigned int pairs;
117 unsigned int map_name;
118 char *font_name;
119
120 va_start(vars);
121
122 /* first arguments are: family, pairs */
123 family = va_arg(vars, unsigned int);
124 pairs = va_arg(vars, unsigned int);
125
126 /* write the first part of the command */
127 putc(imP_CREATE_FAMILY_TABLE, imout);
128 im_putbyte(family);
129 im_putbyte(pairs);
130
131 /* write each map_name, font_name pair */
132 while (pairs-- > 0)
133 {
134 map_name = va_arg(vars, unsigned int);
135 im_putbyte(map_name);
136 font_name = va_arg(vars, char *);
137 im_putstring(font_name);
138 }
139
140 va_end(vars);
141 }
142
143 imCreatePath(va_alist)
144
145 va_dcl
146
147 {
148 va_list vars;
149 int count;
150 int h;
151 int v;
152
153 va_start(vars);
154
155 /* first argument is vertex-count */
156 count = va_arg(vars, int);
157
158 /* write the first part of the command */
159 putc(imP_CREATE_PATH, imout);
160 im_putword(count);
161
162 /* write each vertex pair */
163 while (count-- > 0)
164 {
165 h = va_arg(vars, int);
166 im_putword(h);
167 v = va_arg(vars, int);
168 im_putword(v);
169 }
170 }
171
172 imCreatePathV(count, vec)
173
174 unsigned int count;
175 unsigned int *vec;
176
177 {
178 /* write the first part of the command */
179 putc(imP_CREATE_PATH, imout);
180 im_putword(count);
181
182 /* write each vertex pair */
183 while (count-- > 0)
184 {
185 im_putword(*vec); /* these are macros... */
186 vec++; /* so im_putword(*vec++) won't always work */
187 im_putword(*vec);
188 vec++;
189 }
190 }
191
192 #ifdef notyet
193 /* stuff we still have to do: */
194 imBitmap(...)
195 #endif