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

Comparing ray/src/ot/getbbox.c (file contents):
Revision 1.1 by greg, Wed May 29 17:33:17 1991 UTC vs.
Revision 2.5 by greg, Sat Feb 22 02:07:26 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  getbbox.c - compute bounding box for scene files
6   *
# Line 16 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13  
14   #include  "object.h"
15  
19 #ifndef  DEFPATH
20 #define  DEFPATH        ":/usr/local/lib/ray"
21 #endif
22
16   char  *progname;                        /* argv[0] */
17  
25 char  *libpath;                         /* library search path */
26
18   int  nowarn = 0;                        /* supress warnings? */
19  
20 < int  (*addobjnotify[])() = {NULL};      /* new object notifier functions */
20 > void  (*addobjnotify[])() = {NULL};     /* new object notifier functions */
21  
22   FVECT  bbmin, bbmax;                    /* bounding box */
23  
# Line 41 | Line 32 | main(argc, argv)               /* read object files and compute bou
32   int  argc;
33   char  **argv;
34   {
35 <        char  *getenv();
36 <        double  atof();
35 >        extern char  *getenv();
36 >        int  nohead = 0;
37          int  i;
38  
39          progname = argv[0];
40  
41 <        if ((libpath = getenv("RAYPATH")) == NULL)
51 <                libpath = DEFPATH;
52 <
53 <        for (i = 1; i < argc && argv[i][0] == '-'; i++)
41 >        for (i = 1; i < argc && argv[i][0] == '-'; i++) {
42                  switch (argv[i][1]) {
43 <                case '\0':                              /* scene from stdin */
56 <                        goto breakopt;
57 <                case 'w':                               /* supress warnings */
43 >                case 'w':
44                          nowarn = 1;
45 <                        break;
46 <                default:
47 <                        sprintf(errmsg, "unknown option: '%s'", argv[i]);
48 <                        error(USER, errmsg);
63 <                        break;
45 >                        continue;
46 >                case 'h':
47 >                        nohead = 1;
48 >                        continue;
49                  }
50 < breakopt:
50 >                break;
51 >        }
52                                                  /* find bounding box */
53          bbmin[0] = bbmin[1] = bbmin[2] = FHUGE;
54          bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE;
55                                                  /* read input */
56 <        for ( ; i < argc; i++)
57 <                if (!strcmp(argv[i], "-"))      /* from stdin */
58 <                        readobj(NULL, addobject);
59 <                else                            /* from file */
60 <                        readobj(argv[i], addobject);
61 <                                                /* print it out */
62 <        printf("      xmin      xmax      ymin      ymax      zmin      zmax\n");
56 >        if (i >= argc)
57 >                readobj2(NULL, addobject);
58 >        else
59 >                for ( ; i < argc; i++)
60 >                        if (!strcmp(argv[i], "-"))      /* from stdin */
61 >                                readobj2(NULL, addobject);
62 >                        else                            /* from file */
63 >                                readobj2(argv[i], addobject);
64 >                                                /* print bounding box */
65 >        if (!nohead)
66 >                printf(
67 > "     xmin      xmax      ymin      ymax      zmin      zmax\n");
68 >
69          printf("%9g %9g %9g %9g %9g %9g\n", bbmin[0], bbmax[0],
70                          bbmin[1], bbmax[1], bbmin[2], bbmax[2]);
71          quit(0);
72   }
73  
74  
75 + void
76   quit(code)                              /* exit program */
77   int  code;
78   {
# Line 87 | Line 80 | int  code;
80   }
81  
82  
83 + void
84   cputs()                                 /* interactive error */
85   {
86          /* referenced, but not used */
87   }
88  
89  
90 + void
91   wputs(s)                                /* warning message */
92   char  *s;
93   {
# Line 101 | Line 96 | char  *s;
96   }
97  
98  
99 + void
100   eputs(s)                                /* put string to stderr */
101   register char  *s;
102   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines