9 |
|
|
10 |
|
#include <ctype.h> |
11 |
|
#include <string.h> |
12 |
+ |
#include <math.h> |
13 |
|
|
14 |
|
#include "tgraph.h" |
15 |
+ |
#include "plot.h" |
16 |
|
|
15 |
– |
|
17 |
|
#define isfloat(a) (isdigit(a) || (a) == '-' || (a) == '.' || \ |
18 |
|
(a) == 'E' || (a) == '+' || (a) == 'e') |
19 |
|
|
20 |
|
|
20 |
– |
extern double log10(); |
21 |
|
|
22 |
< |
|
23 |
< |
|
24 |
< |
|
25 |
< |
|
26 |
< |
initialize() |
27 |
< |
|
22 |
> |
extern void |
23 |
> |
initialize(void) |
24 |
|
{ |
25 |
|
int i; |
26 |
|
|
27 |
|
for (i = 0; i < NCUR; i++) |
28 |
|
usecurve[i] = 1; |
29 |
+ |
} |
30 |
|
|
34 |
– |
} |
31 |
|
|
32 |
< |
|
33 |
< |
|
34 |
< |
|
35 |
< |
|
40 |
< |
|
41 |
< |
option(s) /* record option */ |
42 |
< |
|
43 |
< |
char *s; |
44 |
< |
|
32 |
> |
extern void |
33 |
> |
option( /* record option */ |
34 |
> |
char *s |
35 |
> |
) |
36 |
|
{ |
37 |
|
double atof(); |
38 |
|
char *sp; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
< |
|
114 |
< |
|
115 |
< |
normalize(fp, fout) /* get extrema from file */ |
116 |
< |
|
117 |
< |
FILE *fp, *fout; |
127 |
< |
|
113 |
> |
extern void |
114 |
> |
normalize( /* get extrema from file */ |
115 |
> |
FILE *fp, |
116 |
> |
FILE *fout |
117 |
> |
) |
118 |
|
{ |
119 |
|
char line[255]; |
120 |
|
double x, y; |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
< |
|
164 |
< |
|
165 |
< |
makeaxis(flag) /* make and print x and y axis */ |
166 |
< |
|
177 |
< |
int flag; |
178 |
< |
|
163 |
> |
extern void |
164 |
> |
makeaxis( /* make and print x and y axis */ |
165 |
> |
int flag |
166 |
> |
) |
167 |
|
{ |
168 |
|
double xstep, ystep, step(), pos; |
169 |
|
int xorg, yorg; |
312 |
|
} |
313 |
|
|
314 |
|
|
315 |
< |
|
316 |
< |
isdata(s) |
317 |
< |
|
318 |
< |
register char *s; |
331 |
< |
|
315 |
> |
extern int |
316 |
> |
isdata( |
317 |
> |
register char *s |
318 |
> |
) |
319 |
|
{ |
320 |
|
int commas = 0; |
321 |
|
|
333 |
|
} |
334 |
|
|
335 |
|
|
336 |
< |
|
337 |
< |
|
338 |
< |
islabel(s) |
339 |
< |
|
353 |
< |
char s[]; |
354 |
< |
|
336 |
> |
extern int |
337 |
> |
islabel( |
338 |
> |
char *s |
339 |
> |
) |
340 |
|
{ |
341 |
|
int i; |
342 |
|
|
343 |
|
i = strlen(s) - 2; |
344 |
|
|
345 |
|
return(i > 0 && s[0] == '"' && s[i] == '"'); |
346 |
< |
} |
346 |
> |
} |
347 |
|
|
348 |
|
|
364 |
– |
|
365 |
– |
|
349 |
|
double |
350 |
< |
step(mn, mx) /* compute step size for axis */ |
351 |
< |
|
352 |
< |
double *mn, *mx; |
353 |
< |
|
350 |
> |
step( /* compute step size for axis */ |
351 |
> |
double *mn, |
352 |
> |
double *mx |
353 |
> |
) |
354 |
|
{ |
355 |
|
static int steps[] = {100, 50, 20, 10, 5, 2, 1}; |
356 |
|
int i; |
377 |
|
|
378 |
|
|
379 |
|
double |
380 |
< |
pown(x, n) /* raise x to an integer power */ |
381 |
< |
|
382 |
< |
double x; |
383 |
< |
int n; |
401 |
< |
|
380 |
> |
pown( /* raise x to an integer power */ |
381 |
> |
double x, |
382 |
> |
int n |
383 |
> |
) |
384 |
|
{ |
385 |
|
register int i; |
386 |
|
double p = 1.0; |
396 |
|
} |
397 |
|
|
398 |
|
|
399 |
< |
|
400 |
< |
|
401 |
< |
istitle(s) |
402 |
< |
|
421 |
< |
char *s; |
422 |
< |
|
399 |
> |
extern int |
400 |
> |
istitle( |
401 |
> |
char *s |
402 |
> |
) |
403 |
|
{ |
404 |
|
char word[32]; |
405 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
< |
|
415 |
< |
isdivlab(s) /* return TRUE if division label(s) */ |
416 |
< |
|
417 |
< |
register char *s; |
438 |
< |
|
414 |
> |
extern int |
415 |
> |
isdivlab( /* return TRUE if division label(s) */ |
416 |
> |
register char *s |
417 |
> |
) |
418 |
|
{ |
419 |
|
|
420 |
|
return(instr(s, "division") != NULL); |
422 |
|
|
423 |
|
|
424 |
|
|
425 |
< |
|
426 |
< |
isxlabel(s) |
427 |
< |
|
428 |
< |
register char *s; |
450 |
< |
|
425 |
> |
extern int |
426 |
> |
isxlabel( |
427 |
> |
register char *s |
428 |
> |
) |
429 |
|
{ |
430 |
|
register char *xindex = instr(s, "x "); |
431 |
|
|
433 |
|
} |
434 |
|
|
435 |
|
|
436 |
< |
|
437 |
< |
|
438 |
< |
isylabel(s) |
439 |
< |
|
462 |
< |
register char *s; |
463 |
< |
|
436 |
> |
extern int |
437 |
> |
isylabel( |
438 |
> |
register char *s |
439 |
> |
) |
440 |
|
{ |
441 |
|
register char *yindex = instr(s, "y "); |
442 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
448 |
< |
char * |
449 |
< |
instr(s, t) /* return pointer to first occurrence of t in s */ |
450 |
< |
|
451 |
< |
char *s, |
452 |
< |
*t; |
477 |
< |
|
448 |
> |
extern char * |
449 |
> |
instr( /* return pointer to first occurrence of t in s */ |
450 |
> |
char *s, |
451 |
> |
char *t |
452 |
> |
) |
453 |
|
{ |
454 |
|
register char *pt, *ps; |
455 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
< |
|
475 |
< |
char * |
476 |
< |
snagquo(s) /* find and return quoted string within s */ |
477 |
< |
|
503 |
< |
register char *s; |
504 |
< |
|
474 |
> |
extern char * |
475 |
> |
snagquo( /* find and return quoted string within s */ |
476 |
> |
register char *s |
477 |
> |
) |
478 |
|
{ |
479 |
|
register char *rval = NULL; |
480 |
|
|
493 |
|
|
494 |
|
|
495 |
|
|
496 |
< |
|
497 |
< |
getdata(s, xp, yp) /* get data from line */ |
498 |
< |
|
499 |
< |
char *s; |
500 |
< |
double *xp, *yp; |
501 |
< |
|
496 |
> |
extern int |
497 |
> |
getdata( /* get data from line */ |
498 |
> |
char *s, |
499 |
> |
double *xp, |
500 |
> |
double *yp |
501 |
> |
) |
502 |
|
{ |
503 |
|
double sin(), cos(); |
504 |
|
int oobounds = 0; |
543 |
|
|
544 |
|
|
545 |
|
|
546 |
< |
|
547 |
< |
symout(a0, x, y, sname) /* output a symbol */ |
548 |
< |
|
549 |
< |
int a0; |
550 |
< |
int x, y; |
551 |
< |
char *sname; |
552 |
< |
|
546 |
> |
extern void |
547 |
> |
symout( /* output a symbol */ |
548 |
> |
int a0, |
549 |
> |
int x, |
550 |
> |
int y, |
551 |
> |
char *sname |
552 |
> |
) |
553 |
|
{ |
554 |
|
|
555 |
|
pprim(PSEG, a0, x-symrad, y-symrad, x+symrad, y+symrad, sname); |
557 |
|
} |
558 |
|
|
559 |
|
|
560 |
< |
|
561 |
< |
boxstring(a0, xmn, ymn, xmx, ymx, s) /* output a string within a box */ |
562 |
< |
|
563 |
< |
int a0; |
564 |
< |
int xmn, ymn, xmx, ymx; |
565 |
< |
char *s; |
566 |
< |
|
560 |
> |
extern void |
561 |
> |
boxstring( /* output a string within a box */ |
562 |
> |
int a0, |
563 |
> |
int xmn, |
564 |
> |
int ymn, |
565 |
> |
int xmx, |
566 |
> |
int ymx, |
567 |
> |
char *s |
568 |
> |
) |
569 |
|
{ |
570 |
|
int start; |
571 |
|
long size; |