28 |
|
|
29 |
|
int ncurves = 6; /* number of contours */ |
30 |
|
|
31 |
+ |
static void getdata(FILE *fp); |
32 |
+ |
static int xycmp(const void* p1, const void* p2); |
33 |
+ |
static void contour(int n); |
34 |
+ |
static void crossings(double z); |
35 |
+ |
static void cross(DATAPT p0, DATAPT p1, double z); |
36 |
|
|
37 |
< |
main(argc, argv) |
38 |
< |
int argc; |
39 |
< |
char *argv[]; |
37 |
> |
|
38 |
> |
int |
39 |
> |
main( |
40 |
> |
int argc, |
41 |
> |
char *argv[] |
42 |
> |
) |
43 |
|
{ |
36 |
– |
extern int xycmp(); |
44 |
|
FILE *fp; |
45 |
|
int i; |
46 |
|
|
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
< |
getdata(fp) /* read input data */ |
87 |
< |
FILE *fp; |
86 |
> |
static void |
87 |
> |
getdata( /* read input data */ |
88 |
> |
FILE *fp |
89 |
> |
) |
90 |
|
{ |
91 |
|
register int i; |
92 |
|
|
96 |
|
break; |
97 |
|
if (i != 3) |
98 |
|
break; |
99 |
< |
if (xyz[xyzsiz][2] < zmin) |
100 |
< |
if (minset) |
99 |
> |
if (xyz[xyzsiz][2] < zmin) { |
100 |
> |
if (minset) { |
101 |
|
continue; |
102 |
< |
else |
102 |
> |
} else { |
103 |
|
zmin = xyz[xyzsiz][2]; |
104 |
< |
if (xyz[xyzsiz][2] > zmax) |
105 |
< |
if (maxset) |
104 |
> |
} |
105 |
> |
} |
106 |
> |
if (xyz[xyzsiz][2] > zmax) { |
107 |
> |
if (maxset) { |
108 |
|
continue; |
109 |
< |
else |
109 |
> |
} else { |
110 |
|
zmax = xyz[xyzsiz][2]; |
111 |
+ |
} |
112 |
+ |
} |
113 |
|
xyzsiz++; |
114 |
|
} |
115 |
|
if (!feof(fp)) { |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
< |
int |
123 |
< |
xycmp(p1, p2) /* -1 if p1 < p2, 0 if equal, 1 if p1 > p2 */ |
124 |
< |
DATAPT p1, p2; |
122 |
> |
static int |
123 |
> |
xycmp( /* -1 if p1 < p2, 0 if equal, 1 if p1 > p2 */ |
124 |
> |
const void* p1, |
125 |
> |
const void* p2 |
126 |
> |
) |
127 |
|
{ |
128 |
< |
if (p1[0] > p2[0]) |
128 |
> |
const float* pp1 = p1; |
129 |
> |
const float* pp2 = p2; |
130 |
> |
if (pp1[0] > pp2[0]) |
131 |
|
return(1); |
132 |
< |
if (p1[0] < p2[0]) |
132 |
> |
if (pp1[0] < pp2[0]) |
133 |
|
return(-1); |
134 |
< |
if (p1[1] > p2[1]) |
134 |
> |
if (pp1[1] > pp2[1]) |
135 |
|
return(1); |
136 |
< |
if (p1[1] < p2[1]) |
136 |
> |
if (pp1[1] < pp2[1]) |
137 |
|
return(-1); |
138 |
|
return(0); |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
< |
contour(n) /* make contour n */ |
143 |
< |
int n; |
142 |
> |
static void |
143 |
> |
contour( /* make contour n */ |
144 |
> |
int n |
145 |
> |
) |
146 |
|
{ |
147 |
|
double z; |
148 |
|
|
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
< |
crossings(z) /* find crossings for z */ |
158 |
< |
double z; |
157 |
> |
static void |
158 |
> |
crossings( /* find crossings for z */ |
159 |
> |
double z |
160 |
> |
) |
161 |
|
{ |
162 |
|
register DATAPT *p0, *p1; |
163 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
< |
cross(p0, p1, z) /* mark crossing between p0 and p1 */ |
181 |
< |
register DATAPT p0, p1; |
182 |
< |
double z; |
180 |
> |
static void |
181 |
> |
cross( /* mark crossing between p0 and p1 */ |
182 |
> |
register DATAPT p0, |
183 |
> |
register DATAPT p1, |
184 |
> |
double z |
185 |
> |
) |
186 |
|
{ |
187 |
|
if (p1[2] - p0[2] == 0.0) |
188 |
|
return; |