9 |
|
* 12/21/88 |
10 |
|
*/ |
11 |
|
|
12 |
– |
#include <stdio.h> |
12 |
|
#include <stdlib.h> |
13 |
+ |
#include <stdio.h> |
14 |
+ |
#include <string.h> |
15 |
|
#include <math.h> |
16 |
|
|
17 |
|
#define MAXSTR 128 /* maximum string or id length */ |
23 |
|
|
24 |
|
double rad = 0.0; /* line radius */ |
25 |
|
|
26 |
+ |
static void thf2rad(char *name, char *file); |
27 |
+ |
static int cvobject(char *name, char *file, FILE *fp); |
28 |
+ |
static void header(int ac, char **av); |
29 |
+ |
static void point(char *mat, char *nam, POINT *pos); |
30 |
+ |
static void line(char *mat, char *nam, POINT *p1, POINT *p2); |
31 |
+ |
static void loc(POINT *p); |
32 |
+ |
static void readerr(char *file, char *err); |
33 |
|
|
34 |
< |
main(argc, argv) |
35 |
< |
int argc; |
36 |
< |
char *argv[]; |
34 |
> |
|
35 |
> |
int |
36 |
> |
main( |
37 |
> |
int argc, |
38 |
> |
char *argv[] |
39 |
> |
) |
40 |
|
{ |
41 |
|
char *name = NULL; |
42 |
|
int an; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
< |
thf2rad(name, file) /* convert things file */ |
72 |
< |
char *name, *file; |
71 |
> |
void |
72 |
> |
thf2rad( /* convert things file */ |
73 |
> |
char *name, |
74 |
> |
char *file |
75 |
> |
) |
76 |
|
{ |
77 |
|
char nambuf[MAXSTR]; |
78 |
|
register char *cp; |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
< |
cvobject(name, file, fp) /* convert next object in things file */ |
105 |
< |
char *name, *file; |
106 |
< |
FILE *fp; |
104 |
> |
int |
105 |
> |
cvobject( /* convert next object in things file */ |
106 |
> |
char *name, |
107 |
> |
char *file, |
108 |
> |
FILE *fp |
109 |
> |
) |
110 |
|
{ |
111 |
|
static POINT parr[MAXPTS]; |
112 |
|
static unsigned char haspt[MAXPTS/8]; |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
< |
header(ac, av) /* print header */ |
176 |
< |
int ac; |
177 |
< |
char **av; |
175 |
> |
void |
176 |
> |
header( /* print header */ |
177 |
> |
int ac, |
178 |
> |
char **av |
179 |
> |
) |
180 |
|
{ |
181 |
|
putchar('#'); |
182 |
|
while (ac--) { |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
< |
point(mat, nam, pos) /* print point */ |
191 |
< |
char *mat, *nam; |
192 |
< |
POINT *pos; |
190 |
> |
void |
191 |
> |
point( /* print point */ |
192 |
> |
char *mat, |
193 |
> |
char *nam, |
194 |
> |
POINT *pos |
195 |
> |
) |
196 |
|
{ |
197 |
|
if (rad <= 0.0) |
198 |
|
return; |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
< |
line(mat, nam, p1, p2) /* print line */ |
207 |
< |
char *mat, *nam; |
208 |
< |
POINT *p1, *p2; |
206 |
> |
void |
207 |
> |
line( /* print line */ |
208 |
> |
char *mat, |
209 |
> |
char *nam, |
210 |
> |
POINT *p1, |
211 |
> |
POINT *p2 |
212 |
> |
) |
213 |
|
{ |
214 |
|
if (rad <= 0.0) |
215 |
|
return; |
221 |
|
} |
222 |
|
|
223 |
|
|
224 |
< |
loc(p) /* print location */ |
225 |
< |
register POINT *p; |
224 |
> |
void |
225 |
> |
loc( /* print location */ |
226 |
> |
register POINT *p |
227 |
> |
) |
228 |
|
{ |
229 |
|
printf("\t%14.8g\t%14.8g\t%14.8g\n", p->x, p->y, p->z); |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
< |
readerr(file, err) /* print read error and exit */ |
234 |
< |
char *file, *err; |
233 |
> |
void |
234 |
> |
readerr( /* print read error and exit */ |
235 |
> |
char *file, |
236 |
> |
char *err |
237 |
> |
) |
238 |
|
{ |
239 |
|
fprintf(stderr, "%s: %s\n", file, err); |
240 |
|
exit(1); |