/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:18 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_splot s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_splot.h" #include "drsplot.h" #include /* PARAMETER translations */ #define MAXPT 101 #define PLONY 2.e0 #define PLOTXT 14.e0 #define RMAXPT 101.e0 #define XA 0.0e0 #define XB 5.0e0 #define XSIZE 3.2e0 #define YSIZE 2.75e0 /* end of PARAMETER translations */ int main( ) { long int i; float dx, x[MAXPT], y[3][MAXPT]; static float opt[17]={0.e0,PLONY,RMAXPT,3.e0,PLOTXT,1.1e0,.8e0, 0.e0,PLOTXT,1.2e0,.4e0,0.e0,PLOTXT,1.3e0,.1e0,0.e0,0.e0}; static char copt[42] = "F{drsplot.tex}{erf(x)}{erfce(x)}{erfc(x)}"; /* OFFSET Vectors w/subscript range: 1 to dimension */ float *const Opt = &opt[0] - 1; float *const X = &x[0] - 1; /* end of OFFSET VECTORS */ /*>> 1998-01-15 Krogh Generate the plot used in ch02-02.tex *--S replaces "?": DR?PLO, DR?PL1, dr?plot, ?PLOT, ?ERF, ?ERFC, ?ERFCE */ dx = (XB - XA)/(MAXPT - 1); for (i = 1; i <= MAXPT; i++) { X[i] = (float)( i - 1 )*dx; y[0][i - 1] = serf( X[i] ); y[1][i - 1] = serfc( X[i] ); y[2][i - 1] = serfce( X[i] ); } splot( XSIZE, YSIZE, x, MAXPT, (float*)y, opt, copt ); /* Don't use code below this point. This code is included to make * possible automated checks of the software in different environments. * */ drspl1(); exit(0); } /* end of function */ void /*FUNCTION*/ drspl1() { /* Print .tex output for checkout purposes. *++ CODE for ~.C. is inactive * character BUF*80 * integer I * open (unit=10, FILE='drsplot.tex', status='OLD') * 10 BUF = ' ' * read(10, '(A)', END=40) BUF * do 20 I = 80, 2, -1 * if (BUF(I:I) .ne. ' ') go to 30 * 20 continue * 30 print '(1X,A)', BUF(1:I) * go to 10 * 40 continue * close(10) *++ CODE for .C. is active */ char buf[81]; FILE *iofil; iofil = fopen("drsplot.tex", "r"); while (fscanf( iofil, "%[^\n]", buf ) != EOF){ printf("%s\n", buf); if (fscanf( iofil, "%[\n]", buf) == EOF) break;} fclose(iofil); return; /*++ END */ } /* end of function */