ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/imPfuncs.c
Revision: 1.3
Committed: Sun Mar 28 20:33:13 2004 UTC (20 years, 1 month ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R6P1, rad3R6
Changes since 1.2: +3 -3 lines
Log Message:
Continued ANSIfication, and other fixes and clarifications.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.3 static const char RCSid[] = "$Id: imPfuncs.c,v 1.2 2003/11/15 02:13:37 schorsch Exp $";
3 greg 1.1 #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    
26 schorsch 1.2 void
27     im_w(
28     int code,
29     unsigned int w
30     )
31 greg 1.1
32     {
33     putc(code, imout);
34     im_putword(w);
35     }
36    
37    
38 schorsch 1.2 void
39     im_www(
40     int code,
41     unsigned int wa,
42     unsigned int wb,
43     unsigned int wc
44     )
45 greg 1.1
46     {
47     putc(code, imout);
48     im_putword(wa);
49     im_putword(wb);
50     im_putword(wc);
51     }
52    
53    
54 schorsch 1.2 void
55     im_wwwww(
56     int code,
57     unsigned int wa,
58     unsigned int wb,
59     unsigned int wc,
60     unsigned int wd,
61     unsigned int we
62     )
63 greg 1.1
64     {
65     putc(code, imout);
66     im_putword(wa);
67     im_putword(wb);
68     im_putword(wc);
69     im_putword(wd);
70     im_putword(we);
71     }
72    
73     /* commands with bit operands: */
74    
75 schorsch 1.2 void
76     im_21( /* pads 5 bits on left */
77     int code,
78     unsigned int b2,
79     unsigned int b1
80     )
81 greg 1.1
82     {
83     putc(code, imout);
84     im_putbyte((b2 << 1) | b1);
85     }
86    
87    
88 schorsch 1.2 void
89     im_223( /* pads 1 bit on left */
90     int code,
91     unsigned int b2a,
92     unsigned int b2b,
93     unsigned int b3
94     )
95 greg 1.1
96     {
97     putc(code, imout);
98     im_putbyte((b2a << 5) | (b2b << 3) | b3);
99     }
100    
101    
102 schorsch 1.2 void
103     im_77( /* pads 2 bits on left */
104     int code,
105     unsigned int b7a,
106     unsigned int b7b
107     )
108 greg 1.1
109     {
110     putc(code, imout);
111     im_putword((b7a << 7) | b7b);
112     }
113    
114    
115 schorsch 1.2 void
116     im_putstring(
117     char *string
118     )
119 greg 1.1
120     {
121     fputs(string, imout);
122     im_putbyte(0);
123     }
124    
125 schorsch 1.2
126 schorsch 1.3 extern void
127 greg 1.1 imCreateFamilyTable(va_alist)
128    
129     va_dcl
130    
131     {
132     va_list vars;
133     unsigned int family;
134     unsigned int pairs;
135     unsigned int map_name;
136     char *font_name;
137    
138     va_start(vars);
139    
140     /* first arguments are: family, pairs */
141     family = va_arg(vars, unsigned int);
142     pairs = va_arg(vars, unsigned int);
143    
144     /* write the first part of the command */
145     putc(imP_CREATE_FAMILY_TABLE, imout);
146     im_putbyte(family);
147     im_putbyte(pairs);
148    
149     /* write each map_name, font_name pair */
150     while (pairs-- > 0)
151     {
152     map_name = va_arg(vars, unsigned int);
153     im_putbyte(map_name);
154     font_name = va_arg(vars, char *);
155     im_putstring(font_name);
156     }
157    
158     va_end(vars);
159     }
160    
161 schorsch 1.2
162 schorsch 1.3 extern void
163 greg 1.1 imCreatePath(va_alist)
164    
165     va_dcl
166    
167     {
168     va_list vars;
169     int count;
170     int h;
171     int v;
172    
173     va_start(vars);
174    
175     /* first argument is vertex-count */
176     count = va_arg(vars, int);
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     h = va_arg(vars, int);
186     im_putword(h);
187     v = va_arg(vars, int);
188     im_putword(v);
189     }
190     }
191    
192    
193 schorsch 1.2 void
194     imCreatePathV(
195     unsigned int count,
196     unsigned int *vec
197     )
198 greg 1.1
199     {
200     /* write the first part of the command */
201     putc(imP_CREATE_PATH, imout);
202     im_putword(count);
203    
204     /* write each vertex pair */
205     while (count-- > 0)
206     {
207     im_putword(*vec); /* these are macros... */
208     vec++; /* so im_putword(*vec++) won't always work */
209     im_putword(*vec);
210     vec++;
211     }
212     }
213    
214     #ifdef notyet
215     /* stuff we still have to do: */
216     imBitmap(...)
217     #endif