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

Comparing ray/src/cv/arch2rad.c (file contents):
Revision 2.2 by greg, Sat Feb 22 02:07:23 2003 UTC vs.
Revision 2.3 by schorsch, Sat Nov 15 17:54:06 2003 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *      Greg Ward
8   */
9  
10 + #include <stdlib.h>
11   #include <stdio.h>
12 + #include <string.h>
13  
14 < #include <stdlib.h>
13 <
14 > #include "rtio.h"
15   #include "trans.h"
16  
17   #define DEFMAPFILE      "/usr/local/lib/ray/lib/arch.map"
# Line 93 | Line 94 | char   openmod[] = "opening";
94  
95   char    *progname;              /* argv[0] */
96  
97 + void arch2rad(FILE      *inp, FILE      *out);
98 + void arch2names(FILE    *inp);
99  
100 < main(argc, argv)                /* translate Architrion file */
101 < int     argc;
102 < char    *argv[];
100 > int hasmatch(BLOCK      *bp, RULEHD     *mp);
101 >
102 > void getfhead(FILE      *fp);
103 > void puthead(FILE       *fp);
104 >
105 > int getblock(BLOCK      *bp, FILE       *fp);
106 > void putblock(BLOCK     *bp, FILE       *fp);
107 > void doneblock(BLOCK    *bp);
108 >
109 > int getopening(OPNG     *op, FILE       *fp);
110 > void add2quals(BLOCK    *bp);
111 > int matchrule(BLOCK     *bp, RULEHD     *rp);
112 >
113 > void putopenmod(char    *sm, char       *ml[], int      nm, FILE        *fp);
114 > void putface(char       *m, char        *bn, char       *fn, PRISM      *p,
115 >        int     a, int b, int c, int d, FILE    *fp);
116 > void putfaces(char      *m, BLOCK       *bp, int        ff, FILE        *fp);
117 > void putpoint(PRISM     *p, int n, FILE *fp);
118 > void putopening(OPNG    *op, FILE       *fp);
119 >
120 > int checkface(PRISM     *p, int a, int b, int c, int d);
121 >
122 > void lcross(long        vr[3], long     v1[3], long     v2[3]);
123 >
124 >
125 > int
126 > main(           /* translate Architrion file */
127 >        int     argc,
128 >        char    *argv[]
129 > )
130   {
131          int     donames = 0;            /* -n flag, produce namelist */
132          int     i;
# Line 138 | Line 168 | userr:
168   }
169  
170  
171 < arch2rad(inp, out)      /* translate Architrion file to Radiance */
172 < FILE    *inp, *out;
171 > void
172 > arch2rad(       /* translate Architrion file to Radiance */
173 >        FILE    *inp,
174 >        FILE    *out
175 > )
176   {
177          int     nbs, nos;
178          BLOCK   blk;
# Line 163 | Line 196 | FILE   *inp, *out;
196   }
197  
198  
199 < arch2names(inp)         /* get name list from an Architrion file */
200 < FILE    *inp;
199 > void
200 > arch2names(             /* get name list from an Architrion file */
201 >        FILE    *inp
202 > )
203   {
204          BLOCK   blk;
205          
# Line 176 | Line 211 | FILE   *inp;
211   }
212  
213  
214 < hasmatch(bp, mp)                /* check for any match in rule list */
215 < BLOCK   *bp;
216 < RULEHD  *mp;
214 > int
215 > hasmatch(               /* check for any match in rule list */
216 >        BLOCK   *bp,
217 >        RULEHD  *mp
218 > )
219   {
220          if (mp == NULL)
221                  return(0);
# Line 188 | Line 225 | RULEHD *mp;
225   }
226  
227  
228 < getfhead(fp)                    /* get file header */
229 < FILE    *fp;
228 > void
229 > getfhead(                       /* get file header */
230 >        FILE    *fp
231 > )
232   {
233          char    buf[MAXSTR];
234          int     i, n;
# Line 243 | Line 282 | readerr:
282   }
283  
284  
285 < puthead(fp)                     /* put out header information */
286 < FILE    *fp;
285 > void
286 > puthead(                        /* put out header information */
287 >        FILE    *fp
288 > )
289   {
290          register int    i;
291          
# Line 259 | Line 300 | FILE   *fp;
300   }
301  
302  
303 < getblock(bp, fp)                        /* get an Architrion block */
304 < register BLOCK  *bp;
305 < FILE    *fp;
303 > int
304 > getblock(                       /* get an Architrion block */
305 >        register BLOCK  *bp,
306 >        FILE    *fp
307 > )
308   {
309          char    word[32];
310          int     i;
# Line 300 | Line 343 | memerr:
343   }
344  
345  
346 < getopening(op, fp)              /* read in opening from fp */
347 < register OPNG   *op;
348 < FILE    *fp;
346 > int
347 > getopening(             /* read in opening from fp */
348 >        register OPNG   *op,
349 >        FILE    *fp
350 > )
351   {
352          register int    c;
353          char    word[32];
# Line 339 | Line 384 | FILE   *fp;
384   }
385  
386  
387 < doneblock(bp)                   /* free data associated with bp */
388 < register BLOCK  *bp;
387 > void
388 > doneblock(                      /* free data associated with bp */
389 >        register BLOCK  *bp
390 > )
391   {
392          register int    i;
393  
# Line 353 | Line 400 | register BLOCK *bp;
400   }
401  
402  
403 < add2quals(bp)                   /* add to qualifier lists */
404 < register BLOCK  *bp;
403 > void
404 > add2quals(                      /* add to qualifier lists */
405 >        register BLOCK  *bp
406 > )
407   {
408          ID      tmpid;
409  
# Line 373 | Line 422 | register BLOCK *bp;
422   }
423  
424  
425 < putblock(bp, fp)                        /* put out a block */
426 < BLOCK   *bp;
427 < FILE    *fp;
425 > void
426 > putblock(                       /* put out a block */
427 >        BLOCK   *bp,
428 >        FILE    *fp
429 > )
430   {
431          RULEHD  *rp;
432          char    *mod[NFACES], *sillmod;
# Line 410 | Line 461 | FILE   *fp;
461   }
462  
463  
464 < putopenmod(sm, ml, nm, fp)              /* put out opening modifier */
465 < char    *sm, *ml[];
466 < int     nm;
467 < FILE    *fp;
464 > void
465 > putopenmod(             /* put out opening modifier */
466 >        char    *sm,
467 >        char    *ml[],
468 >        int     nm,
469 >        FILE    *fp
470 > )
471   {
472          int     rept, nrepts;
473          register int    i, j;
# Line 446 | Line 500 | FILE   *fp;
500   }
501  
502  
503 < putopening(op, fp)                      /* put out an opening */
504 < OPNG    *op;
505 < FILE    *fp;
503 > void
504 > putopening(                     /* put out an opening */
505 >        OPNG    *op,
506 >        FILE    *fp
507 > )
508   {
509          static int      nopens = 0;
510          char    buf[32];
# Line 497 | Line 553 | FILE   *fp;
553  
554  
555   int
556 < matchrule(bp, rp)                       /* see if block matches this rule */
557 < register BLOCK  *bp;
558 < register RULEHD *rp;
556 > matchrule(                      /* see if block matches this rule */
557 >        register BLOCK  *bp,
558 >        register RULEHD *rp
559 > )
560   {
561          register int    i;
562          ID      tmpid;
# Line 530 | Line 587 | register RULEHD        *rp;
587   }              
588  
589  
590 < putfaces(m, bp, ff, fp)                 /* put out faces */
591 < char    *m;
592 < BLOCK   *bp;
593 < register int    ff;
594 < FILE    *fp;
590 > void
591 > putfaces(                       /* put out faces */
592 >        char    *m,
593 >        BLOCK   *bp,
594 >        register int    ff,
595 >        FILE    *fp
596 > )
597   {
598          char    *blkname(), *bn;
599  
# Line 557 | Line 616 | FILE   *fp;
616  
617  
618   char *
619 < blkname(bp)             /* think up a good name for this block */
620 < register BLOCK  *bp;
619 > blkname(                /* think up a good name for this block */
620 >        register BLOCK  *bp
621 > )
622   {
623          static char     nambuf[32];
624          static int      blkcnt = 0;
# Line 591 | Line 651 | register BLOCK *bp;
651   }
652  
653  
654 < putface(m, bn, fn, p, a, b, c, d, fp)   /* put out a face */
655 < char    *m;
656 < char    *bn, *fn;
657 < PRISM   *p;
658 < int     a, b, c, d;
659 < FILE    *fp;
654 > void
655 > putface(        /* put out a face */
656 >        char    *m,
657 >        char    *bn,
658 >        char    *fn,
659 >        PRISM   *p,
660 >        int     a,
661 >        int b,
662 >        int c,
663 >        int d,
664 >        FILE    *fp
665 > )
666   {
667          int     cf;
668          
# Line 630 | Line 696 | FILE   *fp;
696   #define ldot(v1,v2)     (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
697  
698  
699 < long
700 < lcross(vr, v1, v2)                      /* compute cross product */
701 < register long   vr[3], v1[3], v2[3];
699 > void
700 > lcross(                 /* compute cross product */
701 >        register long   vr[3],
702 >        register long   v1[3],
703 >        register long   v2[3]
704 > )
705   {
706          vr[0] = v1[1]*v2[2] - v1[2]*v2[1];
707          vr[1] = v1[2]*v2[0] - v1[0]*v2[2];
# Line 643 | Line 712 | register long  vr[3], v1[3], v2[3];
712   #define labs(a)         ((a)>0 ? (a) : -(a))
713  
714  
715 < checkface(p, a, b, c, d)                /* check a face for validity */
716 < register PRISM  *p;
717 < int     a, b, c, d;
715 > int
716 > checkface(              /* check a face for validity */
717 >        register PRISM  *p,
718 >        int     a,
719 >        int b,
720 >        int c,
721 >        int d
722 > )
723   {
724          int     rval = 0;
725          long    lt;
# Line 693 | Line 767 | int    a, b, c, d;
767   }
768  
769  
770 < putpoint(p, n, fp)                      /* put out a point */
771 < register PRISM  *p;
772 < int     n;
773 < FILE    *fp;
770 > void
771 > putpoint(                       /* put out a point */
772 >        register PRISM  *p,
773 >        int     n,
774 >        FILE    *fp
775 > )
776   {
777          register int    i = n&3;
778          
# Line 706 | Line 782 | FILE   *fp;
782  
783  
784   void
785 < eputs(s)
786 < char    *s;
785 > eputs(
786 >        char    *s
787 > )
788   {
789          fputs(s, stderr);
790   }
791  
792  
793   void
794 < quit(code)
795 < int     code;
794 > quit(
795 >        int     code
796 > )
797   {
798          exit(code);
799   }
800 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines