/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "dangles.p" */ #include /* dangles: DNA angles */ /* begin module version */ #define version 1.07 /* of dangles.p 1996 March 18 updated 1995 Aug 30 origin 1986 Dec 2 */ /* end module version */ /* begin module describe.dangles */ /* name dangles: dangles: DNA angles synopsis dangles(input: in, output: out); files input: a set of integers, one per line output: angles corresponding to the positions. describe DNA angles of a list of positions. author Thomas Dana Schneider bugs none known */ /* end module describe.dangles */ #define bppt 10.6 /* basepairs per turn */ #define pi 3.14159265354 /* circumference divided by diameter of circle */ Static double angle; /* angle relative to coordinate zero */ Static boolean first; /* are we at the first data point? */ Static long position; /* postions from the input file */ Static double turns; /* number of DNA turns from coordinate zero */ Static double x, y; /* coordinates for the angle and the radius */ /* begin module pic.polrec */ Static Void polrec(r, theta, x, y) double r, theta, *x, *y; { /* convert polar to rectangular coordinates, theta is in radians */ *x = r * cos(theta); *y = r * sin(theta); } /* end module pic.polrec */ /* begin module pic.degtorad */ Static double degtorad(angle) double angle; { /* convert angle in degrees to radians */ return (angle / 360 * 2 * pi); } /* end module pic.degtorad */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); first = true; while (!P_eof(stdin)) { if (P_peek(stdin) == '*') { /* copy lines beginning with '*' to output */ while (!P_eoln(stdin)) { putchar(P_peek(stdin)); getc(stdin); } } else { if (first) { printf("* columns:\n"); printf("* 1. position\n"); printf("* 2. turns\n"); printf("* 3. angle\n"); printf("* 4. x\n"); printf("* 5. y\n"); first = false; } scanf("%ld", &position); turns = position / bppt; angle = 360 * (turns - (long)turns); polrec(1.0, degtorad(angle), &x, &y); printf("%6ld %11.1f %11.1f %11.8f %11.8f", position, turns, angle, x, y); } scanf("%*[^\n]"); getchar(); putchar('\n'); } exit(EXIT_SUCCESS); } /* End. */