13 |
|
#include "object.h" |
14 |
|
#include "oconv.h" |
15 |
|
|
16 |
+ |
#ifdef putc_unlocked /* avoid horrendous overhead of flockfile */ |
17 |
+ |
#undef putc |
18 |
+ |
#define putc putc_unlocked |
19 |
+ |
#endif |
20 |
|
|
21 |
|
static void oputstr(char *s); |
22 |
|
static void putfullnode(OCTREE fn); |
59 |
|
/* write the octree */ |
60 |
|
puttree(scene->cutree); |
61 |
|
|
62 |
+ |
if (fflush(stdout) == EOF) |
63 |
+ |
error(SYSTEM, "output error in writeoct"); |
64 |
+ |
|
65 |
|
if (store & IO_FILES || !(store & IO_SCENE)) |
66 |
|
return; |
67 |
|
/* write the scene */ |
71 |
|
|
72 |
|
static void |
73 |
|
oputstr( /* write null-terminated string to stdout */ |
74 |
< |
register char *s |
74 |
> |
char *s |
75 |
|
) |
76 |
|
{ |
77 |
< |
putstr(s, stdout); |
78 |
< |
if (ferror(stdout)) |
72 |
< |
error(SYSTEM, "write error in putstr"); |
77 |
> |
if (putstr(s, stdout) == EOF) |
78 |
> |
error(SYSTEM, "write error in oputstr"); |
79 |
|
} |
80 |
|
|
81 |
|
|
85 |
|
) |
86 |
|
{ |
87 |
|
OBJECT oset[MAXSET+1]; |
88 |
< |
register int i; |
88 |
> |
int i; |
89 |
|
|
90 |
|
objset(oset, fn); |
91 |
|
for (i = 0; i <= oset[0]; i++) |
95 |
|
|
96 |
|
static void |
97 |
|
oputint( /* write a siz-byte integer to stdout */ |
98 |
< |
register long i, |
99 |
< |
register int siz |
98 |
> |
long i, |
99 |
> |
int siz |
100 |
|
) |
101 |
|
{ |
102 |
< |
putint(i, siz, stdout); |
103 |
< |
if (ferror(stdout)) |
98 |
< |
error(SYSTEM, "write error in putint"); |
102 |
> |
if (putint(i, siz, stdout) == EOF) |
103 |
> |
error(SYSTEM, "write error in oputint"); |
104 |
|
} |
105 |
|
|
106 |
|
|
109 |
|
double f |
110 |
|
) |
111 |
|
{ |
112 |
< |
putflt(f, stdout); |
113 |
< |
if (ferror(stdout)) |
109 |
< |
error(SYSTEM, "write error in putflt"); |
112 |
> |
if (putflt(f, stdout) == EOF) |
113 |
> |
error(SYSTEM, "write error in oputflt"); |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
static void |
118 |
|
puttree( /* write octree to stdout in pre-order form */ |
119 |
< |
register OCTREE ot |
119 |
> |
OCTREE ot |
120 |
|
) |
121 |
|
{ |
122 |
< |
register int i; |
122 |
> |
int i; |
123 |
|
|
124 |
|
if (istree(ot)) { |
125 |
|
putc(OT_TREE, stdout); /* indicate tree */ |