|
|
1.1 ! root 1: /* ! 2: * ! 3: * Copyright (c) 1984, 1985, 1986 Xerox Corp. ! 4: * ! 5: * HISTORY ! 6: * 02-Sep-86 Lee Moore (lee) at Xerox Webster Research Center ! 7: * Changed exit status to be 0 or 1. ! 8: * ! 9: * 07-Jul-86 Lee Moore (lee) at Xerox Webster Research Center ! 10: * Converted for use with getopt. ! 11: * ! 12: * 25-Mar-86 Lee Moore (lee) at Xerox Webster Research Center ! 13: * Fixed the "usage" message to be more helpful. ! 14: * ! 15: * 01-Dec-85 lee at Xerox, WRC ! 16: * Modified to pass lint. ! 17: * ! 18: * 28-apr-85 ed flint add conditional code for vax11-c (vms) ! 19: * now use -s for point size and added -o for ! 20: * output file ! 21: */ ! 22: ! 23: #ifdef vax11c ! 24: #include stdio ! 25: #include ctype ! 26: #else ! 27: # include <stdio.h> ! 28: # include <ctype.h> ! 29: # include <sys/file.h> ! 30: # include <strings.h> ! 31: #endif ! 32: ! 33: # include "iptokens.h" ! 34: # include "literal.h" ! 35: # include "operator.h" ! 36: ! 37: /* frame buffer numbers */ ! 38: # define F_backgroundfont 1 ! 39: # define F_font 2 ! 40: # define F_transform 3 ! 41: ! 42: # define INCH 720 ! 43: # define Top_margin (10 * INCH) ! 44: # define Left_margin (INCH * 2) ! 45: # define Left_table (Left_margin + INCH/2) ! 46: ! 47: main(argc, argv) ! 48: ! 49: int argc; ! 50: char *argv[]; ! 51: ! 52: { ! 53: char u_fontname[256], ! 54: buffer[256], ! 55: *outputname= 0; ! 56: int c; ! 57: int ipressfile; ! 58: int point_size = 10; ! 59: int char_spacing; ! 60: int line_spacing; ! 61: int x_pos; ! 62: int y_pos; ! 63: int i; ! 64: int num; ! 65: int prefix = 0; ! 66: extern int optind; ! 67: extern char *optarg; ! 68: ! 69: while ((c = getopt(argc, argv, "o:O:p:P:s:S:")) != EOF) ! 70: switch (c) { ! 71: case 'o': ! 72: case 'O': ! 73: outputname = optarg; ! 74: break; ! 75: case 'p': ! 76: case 'P': ! 77: (void) sscanf(optarg, "%o", &prefix); ! 78: break; ! 79: case ('s'): ! 80: case ('S'): ! 81: point_size = atoi(optarg); ! 82: break; ! 83: } ! 84: ! 85: if (argc - optind != 1) { ! 86: fprintf(stderr, "charset: [-pcharSet] [-ooutput] [-sptSize] fontName\n"); ! 87: exit(1); ! 88: } ! 89: ! 90: (void) strcpy(u_fontname, "Xerox/XC1-1-1/"); ! 91: (void) strcat(u_fontname, argv[optind]); ! 92: ! 93: /* set spacing parameters */ ! 94: line_spacing = (point_size + 2) * 15; ! 95: char_spacing = point_size * 30; ! 96: ! 97: if ( outputname != 0 ) ! 98: { ! 99: #ifdef vax11c ! 100: if ( (ipressfile= creat(outputname, 0, "rfm=udf")) == -1 ) ! 101: #else ! 102: if ( (ipressfile= open(outputname, O_WRONLY | O_CREAT, 0666)) == -1 ) ! 103: #endif ! 104: { ! 105: perror(outputname); ! 106: exit(1); ! 107: } ! 108: } ! 109: else /* default to stdout */ ! 110: { ! 111: ipressfile= 1; ! 112: } ! 113: ! 114: ip_select(ipressfile); ! 115: ! 116: AppendOp(OP_beginBlock); ! 117: AppendOp(OP_beginBody); ! 118: ! 119: /* set up the two fonts: the background and the font in question */ ! 120: SetupFont("Xerox/XC1-1-1/Classic", 100., F_backgroundfont); ! 121: SetupFont(u_fontname, point_size * 10., F_font); ! 122: ! 123: /* set frame[2] to a scaling transform that uses 1/10 point */ ! 124: /* co-ordiate system */ ! 125: AppendRational(353L, 10000000); ! 126: AppendOp(OP_scale); ! 127: AppendInteger((long) F_transform); ! 128: AppendOp(OP_fset); ! 129: ! 130: AppendOp(OP_endBody); /* end preamble */ ! 131: ! 132: AppendOp(OP_beginBody); /* page 1 (and only) */ ! 133: ! 134: Fget(F_transform); ! 135: AppendOp(OP_concatt); ! 136: Setfont(F_backgroundfont); ! 137: Setxy((double)Left_margin, (double)Top_margin); ! 138: (void) sprintf(buffer, "Xerox/XC1-1-1/%s at %d point, character set %o (octal)", ! 139: argv[optind], point_size, prefix); ! 140: ShowString(buffer); ! 141: ! 142: buffer[0] = '0'; ! 143: buffer[1] = '\0'; ! 144: for (x_pos = Left_table, i = 0; i < 8; ! 145: x_pos += char_spacing, i++) ! 146: { ! 147: Setxy((double)x_pos, (double)(Top_margin - 2 * line_spacing)); ! 148: ShowString(buffer); ! 149: buffer[0] += 1; ! 150: } ! 151: ! 152: for (y_pos = Top_margin - 3 * line_spacing, num = 000; num < 0377; ! 153: y_pos -= line_spacing) ! 154: { ! 155: Setxy((double)Left_margin, (double)y_pos); ! 156: (void) sprintf(buffer, "%03o", num); ! 157: ShowString(buffer); ! 158: Setfont(F_font); ! 159: ! 160: for (x_pos = Left_table, i = 0; i < 8; ! 161: x_pos += char_spacing, i++, num++) ! 162: { ! 163: Setxy((double)x_pos, (double)y_pos); ! 164: if (num != 0377) ! 165: { ! 166: if (prefix > 0) ! 167: { ! 168: (void) sprintf(buffer, "\377%c%c", prefix, num); ! 169: AppendString(buffer); ! 170: } ! 171: else ! 172: { ! 173: buffer[0] = num; ! 174: buffer[1] = '\0'; ! 175: AppendString(buffer); ! 176: } ! 177: AppendOp(OP_show); ! 178: } ! 179: } ! 180: Setfont(F_backgroundfont); ! 181: } ! 182: ! 183: /* wrap it up */ ! 184: AppendOp(OP_endBody); ! 185: AppendOp(OP_endBlock); ! 186: ! 187: ip_flush(); ! 188: exit(0); ! 189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.