/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "digrab.p" */ #include /* digrab: diagonal grabs of diana data Tom Schneider National Cancer Institute Laboratory of Mathematical Biology Frederick, Maryland 21701-1013 toms@ncifcrf.gov 1990 */ /* end of program */ /* begin module version */ #define version 1.04 /* of digrab.p 1990 August 10 origin 1990 July 20 */ /* end module version */ /* begin module describe.digrab */ /* name digrab: diagonal grabs of diana data synopsis digrab(input: in, ii: in, xyin: out, xyplop: out, output: out) files input: User defines the value of n. ii: output of the diana program, filtered for information lines only. xyin: input to the xyplo plotting program, extracted lines. xyplop: parameters controlling xyplo output: messages to the user description This program extracts lines that have the form (x,x+n) from the da output of diana. The result may be plotted with xyplo. examples documentation see also diana.p, xyplop.p author Thomas Dana Schneider bugs technical notes */ /* end module describe.digrab */ Static _TEXT ii; /* output of diana, filtered for lines with information only */ Static _TEXT xyin; /* input to xyplo */ Static _TEXT xyplop; /* paramters to control xyplo */ Static jmp_buf _JL1; /* begin module halt */ Static Void halt() { /* stop the program. the procedure performs a goto to the end of the program. you must have a label: label 1; declared, and also the end of the program must have this label: 1: end. examples are in the module libraries. this is the only goto in the delila system. */ printf(" program halt.\n"); longjmp(_JL1, 1); } /* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; */ /* begin module copyaline */ Static Void copyaline(fin, fout) _TEXT *fin, *fout; { /* copy a line from file fin to file fout */ while (!P_eoln(fin->f)) { putc(P_peek(fin->f), fout->f); getc(fin->f); } fscanf(fin->f, "%*[^\n]"); getc(fin->f); putc('\n', fout->f); } /* copyaline */ /* end module copyaline version = 'delmod 6.58 90 Jan 2 tds/gds' */ /* begin module makexyplop */ Static Void makexyplop(xyplop, distance) _TEXT *xyplop; long distance; { /* make the xyplop file, with the given distance */ fprintf(xyplop->f, "2 2 zerox zeroy graph coordinate center\n"); fprintf(xyplop->f, "x -50 50 zx min max (char, real, real) if zx=x then set xaxis\n"); fprintf(xyplop->f, "y 0 0.1 zy min max (char, real, real) if zy=y then set yaxis\n"); fprintf(xyplop->f, "10 10 xinterval yinterval number of intervals on axes to plot\n"); fprintf(xyplop->f, "4 6 xwidth ywidth width of numbers in characters\n"); fprintf(xyplop->f, "0 2 xdecimal ydecimal number of decimal places\n"); fprintf(xyplop->f, "5 5 xsize ysize size of axes in inches\n"); fprintf(xyplop->f, "position x in (x,x+%ld)\n", distance); fprintf(xyplop->f, "bits\n"); fprintf(xyplop->f, "a zc c crosshairs, axXyYnN\n"); fprintf(xyplop->f, "n 2 zxl base if zxl=l then make x axis log to the given base\n"); fprintf(xyplop->f, "n 2 zyl base if zyl=l then make y axis log to the given base\n"); fprintf(xyplop->f, " ******************************************************************\n"); fprintf(xyplop->f, "3 8 xcolumn ycolumn columns of xyin that determine plot location\n"); fprintf(xyplop->f, "0 symbol column the xyin column to read symbols from\n"); fprintf(xyplop->f, "0 0 xscolumn yscolumn columns of xyin that determine the symbol size\n"); fprintf(xyplop->f, "0 0 0 hue saturation brightness columns for color manipulation\n"); fprintf(xyplop->f, " ******************************************************************\n"); fprintf(xyplop->f, "c symbol-to-plot c(circle)bd(dotted box)x+Ifgpr(rectangle)\n"); fprintf(xyplop->f, "0 symbol-flag character in xyin\n"); fprintf(xyplop->f, "0.05 symbol sizex side in inches on the x axis of the symbol.\n"); fprintf(xyplop->f, "0.05 symbol sizey as for the x axis, get size from yscolumn\n"); fprintf(xyplop->f, "cl 0.05 connection\n"); fprintf(xyplop->f, "n 0.05 linetype size linetype l.-in and size of dashes or dots\n"); fprintf(xyplop->f, " ******************************************************************\n"); fprintf(xyplop->f, ".\n"); fprintf(xyplop->f, " ******************************************************************\n"); } /* end module makexyplop */ /* begin module digrab.themain */ Static Void themain(ii, xyin, xyplop) _TEXT *ii, *xyin, *xyplop; { /* the main procedure of the program */ Char a, b, c, d; /* first characters of each line */ long distance; /* diagonal identifier */ long x, y; /* coordinates */ printf("digrab %4.2f\n", version); printf("Give distance from the first base that you want the second base:\n"); scanf("%ld%*[^\n]", &distance); getchar(); if (*xyin->name != '\0') { if (xyin->f != NULL) xyin->f = freopen(xyin->name, "w", xyin->f); else xyin->f = fopen(xyin->name, "w"); } else { if (xyin->f != NULL) rewind(xyin->f); else xyin->f = tmpfile(); } if (xyin->f == NULL) _EscIO2(FileNotFound, xyin->name); SETUPBUF(xyin->f, Char); fprintf(xyin->f, "* digrab %4.2f\n", version); fprintf(xyin->f, "* distance between positions x and y: %ld\n", distance); if (*ii->name != '\0') { if (ii->f != NULL) ii->f = freopen(ii->name, "r", ii->f); else ii->f = fopen(ii->name, "r"); } else rewind(ii->f); if (ii->f == NULL) _EscIO2(FileNotFound, ii->name); RESETBUF(ii->f, Char); if (*xyplop->name != '\0') { if (xyplop->f != NULL) xyplop->f = freopen(xyplop->name, "w", xyplop->f); else xyplop->f = fopen(xyplop->name, "w"); } else { if (xyplop->f != NULL) rewind(xyplop->f); else xyplop->f = tmpfile(); } if (xyplop->f == NULL) _EscIO2(FileNotFound, xyplop->name); SETUPBUF(xyplop->f, Char); makexyplop(xyplop, distance); while (P_peek(ii->f) == '*') copyaline(ii, xyin); while (!BUFEOF(ii->f)) { a = getc(ii->f); b = getc(ii->f); c = getc(ii->f); d = getc(ii->f); /* read the coordinates */ if (a == '\n') a = ' '; if (b == '\n') b = ' '; if (c == '\n') c = ' '; if (d == '\n') d = ' '; fscanf(ii->f, "%ld%ld", &x, &y); if (y == x + distance) { fprintf(xyin->f, "%c%c%c%c %ld %ld", a, b, c, d, x, y); while (!P_eoln(ii->f)) { c = getc(ii->f); /* a character */ if (c == '\n') c = ' '; putc(c, xyin->f); } putc('\n', xyin->f); } fscanf(ii->f, "%*[^\n]"); getc(ii->f); } /* pick up the first characters of the line */ } /* end module digrab.themain */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); if (setjmp(_JL1)) goto _L1; xyplop.f = NULL; strcpy(xyplop.name, "xyplop"); xyin.f = NULL; strcpy(xyin.name, "xyin"); ii.f = NULL; strcpy(ii.name, "ii"); themain(&ii, &xyin, &xyplop); _L1: if (ii.f != NULL) fclose(ii.f); if (xyin.f != NULL) fclose(xyin.f); if (xyplop.f != NULL) fclose(xyplop.f); exit(EXIT_SUCCESS); } /* End. */