| 9 |
|
*/ |
| 10 |
|
|
| 11 |
|
#include <stdio.h> |
| 12 |
+ |
#include <string.h> |
| 13 |
|
|
| 14 |
|
#include "mgvars.h" |
| 15 |
|
|
| 15 |
– |
#ifndef BSD |
| 16 |
– |
#define index strchr |
| 17 |
– |
#endif |
| 16 |
|
|
| 19 |
– |
extern char *index(); |
| 20 |
– |
|
| 17 |
|
static double xsum, xxsum, ysum, yysum, xysum; |
| 18 |
|
static double xmin, xmax, ymin, ymax; |
| 19 |
|
static double lastx, lasty, rsum; |
| 20 |
|
static int npts; |
| 21 |
|
|
| 22 |
+ |
static void gcheader(char *types); |
| 23 |
+ |
static void calcpoint(int c, double x, double y); |
| 24 |
+ |
static void gcvalue(int c, char *types); |
| 25 |
|
|
| 26 |
< |
gcalc(types) /* do a calculation */ |
| 27 |
< |
char *types; |
| 26 |
> |
void |
| 27 |
> |
gcalc( /* do a calculation */ |
| 28 |
> |
char *types |
| 29 |
> |
) |
| 30 |
|
{ |
| 31 |
< |
int i, calcpoint(); |
| 31 |
> |
int i; |
| 32 |
|
|
| 33 |
< |
if (index(types, 'h') == NULL) |
| 33 |
> |
if (strchr(types, 'h') == NULL) |
| 34 |
|
gcheader(types); |
| 35 |
|
|
| 36 |
|
xmin = gparam[XMIN].flags & DEFINED ? |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
|
| 53 |
< |
gcheader(types) /* print header */ |
| 54 |
< |
register char *types; |
| 53 |
> |
void |
| 54 |
> |
gcheader( /* print header */ |
| 55 |
> |
register char *types |
| 56 |
> |
) |
| 57 |
|
{ |
| 58 |
|
printf("__"); |
| 59 |
|
while (*types) |
| 71 |
|
printf("|___Integ_"); |
| 72 |
|
break; |
| 73 |
|
case 'l': |
| 74 |
< |
printf("|___Slope_____Intcp______Corr_"); |
| 74 |
> |
printf("|____Slope_______Intcp____Corr_"); |
| 75 |
|
break; |
| 76 |
|
default: |
| 77 |
|
break; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
< |
gcvalue(c, types) /* print the values for the curve */ |
| 84 |
< |
int c; |
| 85 |
< |
register char *types; |
| 83 |
> |
void |
| 84 |
> |
gcvalue( /* print the values for the curve */ |
| 85 |
> |
int c, |
| 86 |
> |
register char *types |
| 87 |
> |
) |
| 88 |
|
{ |
| 89 |
|
double d1, d2, d3, sqrt(); |
| 90 |
|
|
| 113 |
|
d1 = (xysum - xsum*ysum/npts)/d3; |
| 114 |
|
d2 = (ysum - d1*xsum)/npts; |
| 115 |
|
d3 = d1*sqrt(d3/(yysum - ysum*ysum/npts)); |
| 116 |
< |
printf(" %9.5f %9.2f %9.5f", d1, d2, d3); |
| 116 |
> |
printf(" %10.6f %11.4f %7.3f", d1, d2, d3); |
| 117 |
|
break; |
| 118 |
|
default: |
| 119 |
|
break; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
|
| 125 |
< |
calcpoint(c, x, y) /* add a point to our calculation */ |
| 126 |
< |
int c; |
| 127 |
< |
double x, y; |
| 125 |
> |
void |
| 126 |
> |
calcpoint( /* add a point to our calculation */ |
| 127 |
> |
int c, |
| 128 |
> |
double x, |
| 129 |
> |
double y |
| 130 |
> |
) |
| 131 |
|
{ |
| 132 |
|
if (x < xmin || x > xmax) |
| 133 |
|
return; |