ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/aed5.c
(Generate patch)

Comparing ray/src/meta/aed5.c (file contents):
Revision 1.3 by schorsch, Mon Oct 27 10:28:59 2003 UTC vs.
Revision 1.4 by schorsch, Sat Nov 15 02:13:36 2003 UTC

# Line 75 | Line 75 | static short  lmode[4] = {255, 15, 85, 39};    /* line ma
75  
76   static PRIMITIVE  nextp;
77  
78 + static void init(void);
79 + static void plot(FILE  *infp);
80 + static void doprim(register PRIMITIVE  *p);
81 + static void doglobal(PRIMITIVE  *g);
82 + static void longwait(int  t);
83 + static void shortwait(int  t);
84 + static void plotlseg(register PRIMITIVE  *p);
85 + static void printstr(register PRIMITIVE  *p);
86 + static void fillrect(register PRIMITIVE  *p);
87 + static void setcolor(int  cn);
88 + static void move(int x, int y);
89 + static void draw(int  x, int  y);
90 + static void aedcoord(register int  x, register int  y);
91  
92  
93 + int
94   main(argc, argv)
95   int  argc;
96   char  **argv;
# Line 141 | Line 155 | char  **argv;
155  
156  
157  
158 + static void
159 + plot(           /* plot meta-file */
160 +        FILE  *infp
161 + )
162  
145 plot(infp)              /* plot meta-file */
146
147 FILE  *infp;
148
163   {
164  
165          do {
# Line 165 | Line 179 | FILE  *infp;
179  
180  
181  
182 + static void
183 + doglobal(                       /* execute a global command */
184 +        PRIMITIVE  *g
185 + )
186  
169 doglobal(g)                     /* execute a global command */
170
171 PRIMITIVE  *g;
172
187   {
188          int  tty;
189          char  c;
# Line 216 | Line 230 | PRIMITIVE  *g;
230  
231  
232  
233 + static void
234 + doprim(         /* plot primitive */
235 +        register PRIMITIVE  *p
236 + )
237  
220 doprim(p)               /* plot primitive */
221
222 register PRIMITIVE  *p;
223
238   {
239  
240          if (newpage) {                          /* clear screen */
# Line 255 | Line 269 | register PRIMITIVE  *p;
269  
270  
271  
272 + static void
273 + printstr(               /* output a string */
274 +        register PRIMITIVE  *p
275 + )
276  
259 printstr(p)             /* output a string */
260
261 register PRIMITIVE  *p;
262
277   {
278          static int  hsp[4] = {6, 5, 4, 3};
279          char  font, size;
# Line 299 | Line 313 | register PRIMITIVE  *p;
313  
314  
315  
316 + static void
317 + plotlseg(               /* plot a line segment */
318 +        register PRIMITIVE  *p
319 + )
320  
303 plotlseg(p)             /* plot a line segment */
304
305 register PRIMITIVE  *p;
306
321   {
322          static short  right = FALSE;
323          int  y1, y2;
# Line 330 | Line 344 | register PRIMITIVE  *p;
344                  draw(p->xy[XMX], y2);
345          else if (p->xy[XMX] == curx && y2 == cury)
346                  draw(p->xy[XMN], y1);
347 <        else if (right = !right) {
347 >        else if ((right = !right)) {
348                  move(p->xy[XMN], y1);
349                  draw(p->xy[XMX], y2);
350          } else {
# Line 340 | Line 354 | register PRIMITIVE  *p;
354   }
355  
356  
357 < fillrect(p)
357 > static void
358 > fillrect(
359 >        register PRIMITIVE  *p
360 > )
361  
345 register PRIMITIVE  *p;
346
362   {
363  
364          setcolor(p->arg0 & 03);
# Line 355 | Line 370 | register PRIMITIVE  *p;
370  
371   }
372  
373 < init()                  /* initialize terminal */
373 > static void
374 > init(void)                      /* initialize terminal */
375   {
376                  /* Reset AED and tell it the data format */
377          command(RST);
# Line 367 | Line 383 | init()                 /* initialize terminal */
383   }
384  
385  
386 < setcolor(cn)            /* set color */
387 < int  cn;
386 > static void
387 > setcolor(               /* set color */
388 >        int  cn
389 > )
390   {
391          if (cn != curcol) {
392                  command(SEC);
# Line 378 | Line 396 | int  cn;
396   }
397  
398  
399 < move(x, y)              /* move to coordinate (x,y) */
400 < int  x, y;
399 > static void
400 > move(           /* move to coordinate (x,y) */
401 >        int x,
402 >        int y
403 > )
404   {
405          command(MOV);
406          aedcoord(xconv(x), yconv(y));
# Line 388 | Line 409 | int  x, y;
409   }
410  
411  
412 < draw(x, y)              /* draw vector from CAP to (x,y) */
413 < int  x, y;
412 > static void
413 > draw(           /* draw vector from CAP to (x,y) */
414 > int  x,
415 > int  y
416 > )
417   {
418          command(DVA);
419          aedcoord(xconv(x), yconv(y));
# Line 402 | Line 426 | int  x, y;
426   * aedcoord - puts out an (x, y) coordinate in AED 8 bit format.
427   */
428  
429 < aedcoord(x, y)
430 < register int  x, y;
429 > static void
430 > aedcoord(
431 > register int  x,
432 > register int  y
433 > )
434   {
435          putc(((x >> 4) & 0x30) | ((y >> 8) & 0x3), stdout);
436          putc(x & 0xff, stdout);
# Line 411 | Line 438 | register int  x, y;
438   }
439  
440  
441 < longwait(t)             /* longer wait */
442 < int  t;
441 > static void
442 > longwait(               /* longer wait */
443 >        int  t
444 > )
445   {
446          fflush(stdout);
447          sleep(t);
448   }
449  
450  
451 < shortwait(t)            /* shorter wait */
452 < int  t;
451 > static void
452 > shortwait(              /* shorter wait */
453 >        int  t
454 > )
455   {
456          register long  l = t*1000;
457  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines