|
|
1.1 ! root 1: /* program to be run on panther to drive Mergenthaler 202 */ ! 2: /* half [LL [NL]] < ifile */ ! 3: /* extracted from /n/panther/usr/guest/ken/tfb.c on 2 Jul 85 */ ! 4: #include <stdio.h> ! 5: ! 6: int LL = 300; ! 7: int NL = 300; ! 8: unsigned char *buff; ! 9: ! 10: main(argc, argv) ! 11: char **argv; ! 12: { ! 13: char *malloc(); ! 14: ! 15: if (argc > 1) ! 16: { sscanf(argv[1], "%d", &LL); NL=LL; ! 17: if (argc > 2) ! 18: sscanf(argv[2], "%d", &NL); ! 19: } ! 20: fprintf(stderr, "ll %d, nl %d\n", LL, NL); ! 21: ! 22: buff = (unsigned char *) malloc(LL*NL); ! 23: ! 24: Read(0, buff, LL*NL); ! 25: typit(); ! 26: exit(0); ! 27: } ! 28: ! 29: #define putint(x) fputc((x)>>8, f), fputc(x, f) ! 30: typit() ! 31: { ! 32: register j, h, oh, c, d; ! 33: register unsigned char *p; ! 34: FILE *f; ! 35: int D, IH, i, P, F, J; ! 36: ! 37: f = fopen("/dev/202", "w"); ! 38: if(!f) { ! 39: fprintf(stderr, "cannot open: /dev/202\n"); ! 40: exit(1); ! 41: } ! 42: ! 43: fprintf(stderr,"starting to typeset..."); ! 44: IH = 685; ! 45: P = 32; ! 46: D = (P*12)/16; ! 47: F = 87; ! 48: J = 0; ! 49: ! 50: fputc(255, f); fputc('s', f); putint(P); ! 51: fputc(255, f); fputc('f', f); putint(F); ! 52: p = buff; ! 53: for(i=0; i<NL; i++) { ! 54: d = (i*100)/NL; ! 55: fputc(255, f); fputc('p', f); putint(d); ! 56: fputc(255, f); fputc('n', f); ! 57: J -= D; ! 58: while(J <= -54) { ! 59: fputc(255, f); fputc('v', f); putint(16); ! 60: J += 54; ! 61: } ! 62: fputc(255, f); fputc('j', f); putint(J/2); ! 63: h = IH; ! 64: oh = h; ! 65: fputc(255, f); fputc('H', f); putint(h); ! 66: for(j=0; j<LL; j++) { ! 67: c = *p++ & 0377; ! 68: c = (c+6) >> 2; ! 69: h += D; ! 70: if(c >= 64) ! 71: continue; ! 72: d = h-oh; ! 73: if(d >= 256) { ! 74: fputc(255, f); fputc('H', f); putint(h); ! 75: } else { ! 76: fputc(254, f); ! 77: fputc(d, f); ! 78: } ! 79: oh = h; ! 80: fputc(c, f); ! 81: } ! 82: } ! 83: ! 84: /* advance the paper a bit at the end */ ! 85: for(i=0;i<10;i++){ fputc(255, f); fputc('v', f); putint(16); } ! 86: ! 87: fputc(255, f); fputc('x', f); fputc('s', f); fputc('\n', f); ! 88: fclose(f); ! 89: fputc('\n',stderr); ! 90: } ! 91: ! 92: ! 93: Read(f, a, n) ! 94: char *a; ! 95: { ! 96: int nr, total=0; ! 97: while(total<n){ ! 98: nr = read(f, a+total, n-total); ! 99: if(nr<0) error("read error"); ! 100: if(nr==0) error("premature EOF"); ! 101: total += nr; ! 102: } ! 103: } ! 104: ! 105: error(s) ! 106: char *s; ! 107: { ! 108: fputs(s,stderr); ! 109: putc('\n',stderr); ! 110: exit(1); ! 111: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.