home *** CD-ROM | disk | FTP | other *** search
- /* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
- #include <stdio.h>
- #define EXTERN extern
- #include <typedef.h>
-
- extern FILE *fopen();
-
- static FILE *lst;
-
-
- int ConstructByte(col, row, top)
- int row, col, top;
- {
- static int Bits[] = {128, 64, 32, 16, 8, 4, 2, 1};
- int CByte, k;
-
- CByte = 0;
- for (k = 0; k <= top; k++) {
- if (PD(col, row + k))
- CByte = CByte | Bits[k];
- }
- return(CByte);
- }
-
-
- void doline(row, top, inverse, mode)
- int row, top, inverse, mode;
- {
- int j, PrintByte;
-
- if (mode == 1) {
- fputs("\033L", lst);
- }
- else {
- fputs("\033*", lst);
- fputc(mode, lst);
- }
- /* printf("Initialization code sent %x %x\n",
- 0x0ff & (XScreenMaxGlb + 1), (0xff00 & (XScreenMaxGlb + 1)) >> 8);
- */
- fputc(0x0ff & (XScreenMaxGlb + 1), lst);
- fputc((0xff00 & (XScreenMaxGlb + 1)) >> 8, lst);
-
- for (j = 0; j <= XScreenMaxGlb; j++) { /* scan across columns */
- PrintByte = ConstructByte(j,row, top); /* get byte description */
- if (inverse) /* if inverted image */
- PrintByte = NOT PrintByte; /* then invert it */
- fputc(PrintByte, lst); /* and print it */
- }
- if (mode != 4) {
- /* printf("doline CRLF\n"); */
- fputs("\r\n", lst);
- }
- }
-
- void hardcopy(inverse, mode)
- int inverse, mode;
- {
- int i, j, top;
- int fullim;
- int ColorLoc,PrintByte;
-
- if (NULL == (lst = fopen("prn:", "wb"))) {
- fprintf(stderr, "Hardcopy: Cannot open printer for output.\n");
- return;
- }
-
- /* printf("Printer opened\n"); */
- top = 7; /* top data bit [index origin 0 ] */
- ColorLoc = ColorGlb;
- ColorGlb = 255;
- mode = mode & 7;
- if ((mode == 5) || (mode == 0))
- mode = 4;
-
- fputs("\0333\030", lst);
- /* printf("line spacing changed\n"); */
-
- fullim = 8* (int)((YMaxGlb + 1) / 8);
- /* printf("Fullim is %d\n", fullim); */
- for (i = 0; i < fullim; i += 8) {
- /* printf("Process line %d\n", i); */
- doline(i, 7, inverse, mode);
- }
-
- if (fullim != YMaxGlb + 1) {
- /* printf("Print partial line %d %d\n", fullim, YMaxGlb + 1 - fullim); */
- doline(fullim, YMaxGlb + 1 - fullim, inverse, mode);
- }
-
- fputs("\0332\r\n", lst);
- ColorGlb = ColorLoc;
-
- fclose(lst);
- }
-
-