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 |
|
* |
8 |
|
*/ |
9 |
|
|
10 |
|
#include "standard.h" |
14 |
– |
|
11 |
|
#include "octree.h" |
16 |
– |
|
12 |
|
#include "object.h" |
13 |
+ |
#include "oconv.h" |
14 |
|
|
15 |
|
char *progname; /* argv[0] */ |
16 |
|
|
17 |
|
int nowarn = 0; /* supress warnings? */ |
18 |
|
|
19 |
< |
int (*addobjnotify[])() = {NULL}; /* new object notifier functions */ |
19 |
> |
void (*addobjnotify[])() = {NULL}; /* new object notifier functions */ |
20 |
|
|
21 |
|
FVECT bbmin, bbmax; /* bounding box */ |
22 |
|
|
23 |
< |
addobject(o) /* add object to bounding box */ |
24 |
< |
OBJREC *o; |
23 |
> |
static void addobject(OBJREC *o); |
24 |
> |
|
25 |
> |
|
26 |
> |
|
27 |
> |
static void |
28 |
> |
addobject( /* add object to bounding box */ |
29 |
> |
OBJREC *o |
30 |
> |
) |
31 |
|
{ |
32 |
|
add2bbox(o, bbmin, bbmax); |
33 |
|
} |
34 |
|
|
35 |
|
|
36 |
< |
main(argc, argv) /* read object files and compute bounds */ |
37 |
< |
int argc; |
38 |
< |
char **argv; |
36 |
> |
int |
37 |
> |
main( /* read object files and compute bounds */ |
38 |
> |
int argc, |
39 |
> |
char **argv |
40 |
> |
) |
41 |
|
{ |
42 |
|
extern char *getenv(); |
43 |
|
int nohead = 0; |
61 |
|
bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE; |
62 |
|
/* read input */ |
63 |
|
if (i >= argc) |
64 |
< |
readobj(NULL, addobject); |
64 |
> |
readobj2(NULL, addobject); |
65 |
|
else |
66 |
|
for ( ; i < argc; i++) |
67 |
|
if (!strcmp(argv[i], "-")) /* from stdin */ |
68 |
< |
readobj(NULL, addobject); |
68 |
> |
readobj2(NULL, addobject); |
69 |
|
else /* from file */ |
70 |
< |
readobj(argv[i], addobject); |
70 |
> |
readobj2(argv[i], addobject); |
71 |
|
/* print bounding box */ |
72 |
|
if (!nohead) |
73 |
|
printf( |
76 |
|
printf("%9g %9g %9g %9g %9g %9g\n", bbmin[0], bbmax[0], |
77 |
|
bbmin[1], bbmax[1], bbmin[2], bbmax[2]); |
78 |
|
quit(0); |
79 |
+ |
return 0; /* pro forma return */ |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
< |
quit(code) /* exit program */ |
84 |
< |
int code; |
83 |
> |
void |
84 |
> |
quit( /* exit program */ |
85 |
> |
int code |
86 |
> |
) |
87 |
|
{ |
88 |
|
exit(code); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
< |
cputs() /* interactive error */ |
92 |
> |
void |
93 |
> |
cputs(void) /* interactive error */ |
94 |
|
{ |
95 |
|
/* referenced, but not used */ |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
< |
wputs(s) /* warning message */ |
100 |
< |
char *s; |
99 |
> |
void |
100 |
> |
wputs( /* warning message */ |
101 |
> |
const char *s |
102 |
> |
) |
103 |
|
{ |
104 |
|
if (!nowarn) |
105 |
|
eputs(s); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
< |
eputs(s) /* put string to stderr */ |
110 |
< |
register char *s; |
109 |
> |
void |
110 |
> |
eputs( /* put string to stderr */ |
111 |
> |
const char *s |
112 |
> |
) |
113 |
|
{ |
114 |
|
static int inln = 0; |
115 |
|
|