amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (10/15/90)
Submitted-by: Allen Norskog <allen@hpfcacn.fc.hp.com> Posting-number: Volume 90, Issue 287 Archive-name: util/pcl2english/part01 [ uuencoded executable and input file enclosed ...tad ] Pcl2english was designed to help debug and understand printouts that use the Hewlett Packard Printer Control Language (PCL). For example, when pcl2english encounters the "escape sequence" for setting the margins, it will print out the escape sequence that was used and a brief English translation of what it means. #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 2)." # Contents: README asterisk.c chart externals.c externals.h gdefs.h # getopt.c main.c makefile paren.c pcl_good.uu protos.h utils.c # Wrapped by tadguy@abcfd20 on Sun Oct 14 15:39:33 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(9972 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' X PCL2ENGLISH X Version 2.0 X X Author: Allen Norskog X September 15, 1990 X X XPUBLIC DOMAIN NOTICE X XThis program is placed in Public Domain. It may be freely copied. XI developed this program to suit my own needs. I hope it will be Xuseful to others. The source is included so that you can make Xmodifications to suit your own needs. I would appreciate any Xcomments or bug reports. X X XDESCRIPTION X XPcl2english was designed to help debug and understand printouts that Xuse the Hewlett Packard Printer Control Language (PCL). For example, Xwhen pcl2english encounters the "escape sequence" for setting the Xmargins, it will print out the escape sequence that was Xused and a brief English translation of what it means. X XI have frequently done this process by hand and its quite tedious. XFirst one (typically) prints the characters out in hex so that Xthe "escape" character, 1B (hex), can be seen. By slowly going back Xand forth between the hex printout and the printer manual, you can Xdecode the escape sequences and start to determine what the printer Xwas asked to do. X XPcl2english was designed to reduce the tedium and chance for errors Xwith this formerly manual process. You will still need to use your Xprinter manual to more clearly understand page size, margin settings, Xfont selection and your printer's capabilities. But hopefully, you Xcan quickly answer questions such as: Why did part of my print out Xcome out on the second page? X XIt has been my experience that each program seems to have its own Xphilosophy of how to print. Pcl2english is a tool to understand Xthese "philosophies" and give insight as to when you can get a program Xto do something you want (say print in landscape) and when you can't. X XI have personally used a number of the Hewlett-Packard printers: XThinkJet, DeskJet, PaintJet, LaserJet+, and the LaserJet IIP. The Xprogram handles the escape sequences used by these printers and also Xthe LaserJet 500+, DeskJet+, and LaserJet IID. Pcl2english does Xnot handle new features introduced with the LaserJet III. X X XREVISION HISTORY X XVersion 1.x: Internal development versions. X XVersion 2.0: First release of pcl2english. X X XRUNNING PCL2ENGLISH X XPcl2english is strictly a "text" based program. The command format is: X Xpcl2english [options] infile [outfile] X X options: X X -e print escape sequences and certain control codes only. Normal X text sequences are not printed, though they are used to keep X track of where the "cursor" is. X -v print version number on the first output line. X -x print hexadecimal equivalents. After the escape sequence, special X character, or line of text is printed, a line is printed that X contains the hex values for each character. X X infile: "pcl" input file. This should be a capture of the exact X data being sent to the printer. That is, any data X translation ("cooking") should have already been done. X Methods to get this will vary with machine/operating system. X outfile: optional output file. If not given, output is sent to stdout. X The output is plain ASCII text. X X XPCL2ENGLISH OUTPUT X XA short example to illustrate various features follows: X X X<Esc>(s10h1T X <Esc>(s10h primary font characters per inch = 10 X <Esc>(s1T primary font typeface = Pica X X<Esc>&d@ X <Esc>&d@ Disable Underline X X<Esc>(sbS X <Esc>(sb primary font weight = Medium (0) X <Esc>(sS primary font style = Upright X X<Esc>9 X <Esc>9 Reset Left and Right Margins to default settings. X X<Esc>&l002e062F X <Esc>&l002e Top margin = 2 lines. Text length defaults to: X page_length - top_margin - half_inch X <Esc>&l062F Text length = 62 lines X X1<LF>2<LF>3<LF>4<LF> X Added 4 more lines. X X<Form feed> Move to first line at top of next page X while maintaining current column at 4. X X<LF> X Added 1 more lines. X X---------------------------------------------------------------------- X XSpecial characters are enclosed in <>'s such as the escape and form feed. X XEach new group of special characters is printed starting at the left edge. X XMultiple escape commands can be grouped together. The actual Xdecoding for each "sub" command is done on subsequent indented Xlines following the command group listing. The <Esc>(sbS command Xabove is an example of this. X XText is condensed to fit on a single line. This is done by printing Xup to 20 characters. If more than 20 characters were encountered, Xthe first and last 10 characters are printed separated by " ... ". XSpecial characters are printed between <>'s. A space at the beginning Xor the end will be printed as <SP> so that it does not get "lost". XThe program counts the number of line feeds encountered in a text Xsection. If any are seen, it will print the number of lines added. XThis number includes any <LF>'s that may be visible in the text line. X XA form feed causes the present page to be ejected. However, the Xcursor is not automatically moved over to the left margin on the Xnext page. Thus, a "current column" is maintained and printed when Xa form feed is encountered. This column is affected by left and Xright margin settings, tabs, returns, and standard characters. XHowever, pcl2english isn't smart about proportional fonts and some Xof the cursor positioning commands. Thus, the current column value is Xreally only a help, and not to be relied upon when doing fancy stuff. X XThe "-x" hex option will print out a line of hex equivalents, as can Xbe seen in the following example. Here, the second line repeats the Xfirst line, but in hex. The other lines are like in the example above. X X<Esc>(s10h1T X1B 28 73 31 30 68 31 54 X <Esc>(s10h primary font characters per inch = 10 X <Esc>(s1T primary font typeface = Pica X X XIn many cases, you can interchange printer drivers. Often, you can Xuse a LaserJet driver on a DeskJet, or a DeskJet driver on a LaserJet. XHowever, there are differences between the various printers that Xcould cause differences in the printout. For example, the DeskJet Xis restricted in its ability to move the page back up. Thus, a XLaserJet command to move the cursor (paper) back could be ignored Xon a DeskJet. Pcl2english was designed to recognize commands for Xa wide variety of printers, rather than be specific to one particular Xprinter. Thus, if you decode something with pcl2english, and it Xdoesn't seem that your printer is responding properly to a particular Xescape sequence, check in your printer manual to see if that sequence Xis indeed supported. X X XERRORS X XBelow are a couple examples of error messages that one could get. XBasically, these escape sequences are undefined, though they could Xbe used on a future printer. If you encounter one of these, check Xyour printer manual. X X<Esc>A X <Esc>A WARNING!!! Improper/unknown escape sequence. X X<Esc>&d5D X <Esc>&d5D Underline control = ??? X X XCOMPILING NOTES X XPcl2english was developed on an Amiga. However it does not take Xadvantage of any Amiga specific features, and should be able to Xrun on a variety of machines. You will need to make changes in Xthe compile options in the makefile to match your compiler. The Xone feature that this program does take advantage of is prototypes Xthat are defined in ANSI C. X X XMISCELLANEOUS X XIncluded with this program are two files called "chart" and "pcl_good". X"chart" is a reference sheet that lists escape sequences in Xalphabetical order. "pcl_good" is a test file of all escape sequences Xhandled by pcl2english. This was one of the files used to test Xthe program. You can test the program by running: X X pcl2english -e pcl_good X XI should mention that my employer is Hewlett-Packard. Though I have Xused a variety of HP printers, I do not design/build printers for HP. XMy main motivation for this program comes as an owner and user. X X XAMIGA NOTES X XThere are three "printer devices" on the Amiga: PRT:, PAR:, and SER:. XThe PRT: device will route output to the appropriate parallel or Xserial port (PAR: or SER:) based on your Preferences setting. The XPRT: device also "cooks" its input by converting "generic" escape Xsequences to the proper escape sequences used by your printer. These Xconversions are handled in the printer driver that is selected in XPreferences. (For example, the HP_DeskJet or HP_LaserJet printer Xdrivers.) What pcl2english wants is the PCL data being sent to PAR: X(or SER: if you connect your printer to the serial port.) X XA program called CMD is available for capturing exactly this data. XIt is in the Utilities drawer for the Workbench 1.3 release. It is Xalso on Fred Fish Disk #95. You need to be sure that if Preferences Xwants to send printer output to the parallel port, that you specify X"parallel" in CMD. Similarly if you use the serial port. You will Xwant to decide where you want to create the new file. For short cases, Xyou may want to use ram memory since it is fast. For example, Xyou might want FILE=RAM:CMD_file. For longer outputs, or something Xyou want to save, you may give a hard disk or floppy file name. X XAfter the file(s) has been created, you can run pcl2english on it Xto see the escape sequences. Running CMD a second time will turn Xoff the re-direction, and allow you to send to the printer again. XYou can now send the file captured by CMD to the printer by saying: Xcopy file PAR: (or SER:). The file is already "cooked", so you Xwant to send it directly to PAR: rather than PRT:. X XTo run pcl2english, you will need to open up a CLI or Shell window. XThen type in the command as shown above. If pcl2english is not Xin one of your "path" directories, then you will also need to specify Xthe path to it so the computer can find it. X XPcl2english was developed on the Manx Aztec C 5.0c compiler using X32 bit ints. X X-------------------------- X XAllen Norskog X900 Whaler's Way XFort Collins, CO 80525 X X-------------------------- END_OF_FILE if test 9972 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'asterisk.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'asterisk.c'\" else echo shar: Extracting \"'asterisk.c'\" \(11928 characters\) sed "s/^X//" >'asterisk.c' <<'END_OF_FILE' X/* $RCSfile: asterisk.c,v $ $Revision: 2.0 $ */ X X#include <stdio.h> X#include "gdefs.h" X#include "externals.h" X#include "protos.h" X Xextern FILE *ifile,*ofile; X Xstatic int fill_area = 0; /* Start with set to black fill (default) */ X Xstatic char *compress[] = { X "Unencoded", X "Run-Length Encoded", X "Tagged Image File Format (TIFF)", X}; X Xstatic char *font_ctl[] = { X "Delete all soft fonts", X "Delete all temporary soft fonts", X "Delete soft font (last ID specified)", X "Delete character code (last ID and character code)", X "Make soft font temporary (last font ID specified)", X "Make soft font permanent (last font ID specified)", X "Copy/Assign current invoked font as temporary", X}; X Xstatic char *fill_patterns[] = { X "???", X "Horizontal Lines", X "Vertical Lines", X "Diagonal Lines ///", X "Diagonal Lines \\\\\\", X "Square Grid", X "Diagonal Grid", X}; X Xstatic char *fill_types[] = { X "Solid area (black)", X "White", X "Shaded", X "HP defined pattern", X}; X Xstatic char *fill_pct[] = { X "0", X "1-2", X "2-10", X "10-20", X "20-35", X "35-55", X "55-80", X "80-99", X "100", X}; X Xstatic char *graphics_mode[] = { X "Image in orientation of logical page (rotate image)", X "???", X "???", X "Image along width of physical page (landscape compatible)", X}; X Xstatic char *graphics_quality[] = { X "Default (high)", X "Draft", X "High", X}; X Xvoid decode_asterisk(void) /* <Esc>* */ X{ X int start_pos; X int stop_pos; X int i; X int done; X char c1,c2,c3; X X c1 = esc_string[1]; X c2 = esc_string[2]; X c3 = esc_string[3]; X if (c2 == 'b') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X if (raster_mode == NO_RASTER) { X print_sub_string(2, start_pos, stop_pos); X } X switch (c3) { X case 'm': X case 'M': X fprintf(ofile,"Compression mode = "); X if ((num >= 0) && (num <= 2)) { X fprintf(ofile,"%s\n",compress[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 'V': /* Can't have 'v' */ X case 'W': /* Can't have 'w' */ X if (raster_mode != NO_RASTER) { X /* Count number of "extra" (other than first) X like lines */ X raster_count++; X } X else { X if (c3 == 'V') { X raster_mode = V_RASTER; X fprintf(ofile, X "Next %d bytes form one plane ",num); X fprintf(ofile, X "of raster graphics data (PaintJet).\n"); X } X else { X raster_mode = W_RASTER; X fprintf(ofile, X "Next %d bytes form (final) plane ",num); X fprintf(ofile, X "of raster graphics data.\n"); X } X for (i=0; i<=stop_pos; i++) { X raster_header[i] = esc_string[i]; X } X raster_header[i] = 0; X raster_count = 0; X } X for (i=0; i<num; i++) { X c1 = getc(ifile); X } X done = TRUE; X break; X case 'x': X case 'X': X fprintf(ofile,"Horizontal offset = "); X if ((num >= 0) && (num <= 32767)) { X fprintf(ofile,"%d pixels\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'y': X case 'Y': X fprintf(ofile,"Vertical offset = "); X if ((num >= -5) && (num <= 32767)) { X fprintf(ofile,"%d pixels\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 'c') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'a': X case 'A': X fprintf(ofile,"Horizontal rectangle size = "); X if ((num >= 0)) { X fprintf(ofile,"%d dots (300 dpi)\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'b': X case 'B': X fprintf(ofile,"Vertical rectangle size = "); X if ((num >= 0)) { X fprintf(ofile,"%d dots (300 dpi)\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'd': X case 'D': X fprintf(ofile,"Specify Font ID to be "); X if ((num >= 0) && (num <= 32767)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'e': X case 'E': X fprintf(ofile,"Specify the character code to be "); X if ((num >= 0) && (num <= 255)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'f': X case 'F': X fprintf(ofile,"Font/character control =\n"); X indent(5); X if ((num >= 0) && (num <= 6)) { X fprintf(ofile,"%s\n",font_ctl[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 'g': X case 'G': X fprintf(ofile,"Area fill ID = "); X switch (fill_area) { X case 0: X fprintf(ofile, X "Not appropriate for solid fill\n"); X break; X case 1: X fprintf(ofile, X "Not appropriate for white fill\n"); X break; X case 2: X if ((num >= 0) && (num <= 100)) { X i = 0; X if (num < 1) num = 0; X else if (num <= 2) i = 1; X else if (num <= 10) i = 2; X else if (num <= 20) i = 3; X else if (num <= 35) i = 4; X else if (num <= 55) i = 5; X else if (num <= 80) i = 6; X else if (num <= 99) i = 7; X else i = 8; X fprintf(ofile,"%s %s\n",fill_pct[i],"%"); X } X else { X fprintf(ofile,questions); X } X break; X case 3: X if ((num >= 0) && (num <= 6)) { X fprintf(ofile,"%s\n",fill_patterns[num]); X } X else { X fprintf(ofile,questions); X } X break; X default: /* Shouldn't happen */ X fprintf(ofile,"%s",bad_esc); X break; X } /* end switch */ X break; X case 'h': X case 'H': X fprintf(ofile,"Horizontal rectangle size = "); X if ((num >= 0)) { X fprintf(ofile,"%d/720 inch\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'p': X case 'P': X fprintf(ofile,"Fill rectangular area = "); X if ((num >= 0) && (num <= 3)) { X fill_area = num; X fprintf(ofile,"%s fill\n",fill_types[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 'v': X case 'V': X fprintf(ofile,"Vertical rectangle size = "); X if ((num >= 0)) { X fprintf(ofile,"%d/720 inch\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 'p') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'x': X case 'X': X if (plus) { X fprintf(ofile, X "Move cursor right %d dots (300 dpi)\n",num); X } X else if (minus) { X fprintf(ofile, X "Move cursor left %d dots (300 dpi)\n",-num); X } X else { X fprintf(ofile, X "Move cursor to %d/300 inch ",num); X fprintf(ofile, X "from left boundary of page.\n"); X } X break; X case 'y': X case 'Y': X if (plus) { X fprintf(ofile, X "Move cursor down %d dots (300 dpi)\n",num); X } X else if (minus) { X fprintf(ofile, X "Move cursor up %d dots (300 dpi)\n",-num); X } X else { X fprintf(ofile, X "Move cursor to %d/300 inch ",num); X fprintf(ofile, "down from top margin.\n"); X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 'r') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'a': X case 'A': X fprintf(ofile,"Start raster graphics.\n"); X indent(5); X if (num == 0) { X fprintf(ofile, X "Graphics start at left-most printable region.\n"); X } X else if (num == 1) { X fprintf(ofile, X "Set starting position and left graphics margin\n"); X indent(5); X fprintf(ofile,"to current position.\n"); X } X else { X fprintf(ofile,questions); X } X break; X case 'b': X case 'B': X fprintf(ofile,"End raster graphics.\n"); X if (num != 0) { X fprintf(ofile,questions); X } X break; X case 'f': X case 'F': X fprintf(ofile,"Raster graphics mode =\n"); X indent(5); X if ((num >= 0) && (num <= 3)) { X fprintf(ofile,"%s\n",graphics_mode[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 'k': X case 'K': X fprintf(ofile,"Return Model number\n"); X if (num != 0) { X fprintf(ofile,questions); X } X break; X case 'q': X case 'Q': X fprintf(ofile,"Graphics quality = "); X if ((num >= 0) && (num <= 2)) { X fprintf(ofile,"%s\n",graphics_quality[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 's': X case 'S': X fprintf(ofile,"Image width (pixels/row) = "); X if ((num >= 0) && (num <= 32767)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'u': X case 'U': X fprintf(ofile,"Number of color planes per row = "); X if ((num >= 1) && (num <= 4)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 't') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'r': X case 'R': X fprintf(ofile,"Resolution (dots per inch) = "); X switch (num) { X case 75: X case 100: X case 150: X case 300: X case 90: X case 180: X fprintf(ofile,"%d\n",num); X break; X default: X fprintf(ofile,"%d ???\n",num); X break; X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 'v') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'a': X case 'A': X fprintf(ofile,"Red component = "); X if ((num >= 4) && (num <= 90)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'b': X case 'B': X fprintf(ofile,"Green component = "); X if ((num >= 4) && (num <= 88)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'c': X case 'C': X fprintf(ofile,"Blue component = "); X if ((num >= 6) && (num <= 85)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X case 'i': X case 'I': X fprintf(ofile,"Put color into palette at index "); X if ((num >= 0) && (num <= 15)) { X fprintf(ofile,"%d\n",num); X } X else { X fprintf(ofile,out_of_range,num); X } X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X} END_OF_FILE if test 11928 -ne `wc -c <'asterisk.c'`; then echo shar: \"'asterisk.c'\" unpacked with wrong size! fi # end of 'asterisk.c' fi if test -f 'chart' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'chart'\" else echo shar: Extracting \"'chart'\" \(8877 characters\) sed "s/^X//" >'chart' <<'END_OF_FILE' XSpecial characters X X Hex Dec XBS <CTRL H> 8 8 Backspace. Move one column left. XLF <CTRL J> A 10 Line feed. Move to next line, same column. XFF <CTRL L> C 12 Form feed. Move to top of next page, same column. XCR <CTRL M> D 13 Carriage Return. Move to left margin on current page. XSO <CTRL N> E 14 Shift out. Select following chars from secondary font. XSI <CTRL O> F 15 Shift in. Select following chars from primary font. XEC <Esc> 1B 27 Escape. Beginning of escape sequence. X XTwo character escape sequences X<Esc>9 Clear L/R Margins X<Esc>= Half-line feed. Move down one-half line. X<Esc>E Reset printer X<Esc>Y Display functions ON X<Esc>Z Display Functions OFF X<Esc>z Print self test X X XAmpersand X<Esc>&a#C Horizontal (Column) position (can have fractional columns) X -# Move left # columns X +# Move right # columns X # Move to column # X<Esc>&a#G Page side selection (LaserJet IID) X 0 Next side X 1 Front side X 2 Back side X<Esc>&a#H Horizontal position in decipoints (1/720") X -# Move left # decipoints X +# Move right # decipoints X # Move to # decipoints right of left most printable limit X<Esc>&a#L Left Margin. # of columns X<Esc>&a#M Right Margin. # of columns X<Esc>&a#R Vertical (Row) position in lines (# can be fractional) X -# Move up # lines X +# Move down # lines X # Move to line # X<Esc>&a#V Vertical position in decipoints (1/720") X -# Move up # decipoints X +# Move down # decipoints X # Move to # decipoints down from top margin X<Esc>&d@ Disable Underline X<Esc>&d#D Underline X 0 Enable fixed X 1 Single fixed X 2 Double fixed X 3 Single float X 4 Double float X<Esc>&f#S Push/Pop Current Position X 0 Push (store) X 1 Pop (restore) X<Esc>&f#X Macro control X 0 Start macro definition X 1 Stop macro definition X 2 Execute macro X 3 Call macro X 4 Enable auto macro overlay X 5 Disable auto macro overlay X 6 Delete all macros X 7 Delete all temporary macros X 8 Delete macro X 9 Make macro temporary X 10 Make macro permanent X<Esc>&f#Y Macro ID # X<Esc>&k#E Enhancement control (DeskJet) X 0 Line-by-Line ON (Underlining turns off at end of line) X 1 Line-by-Line OFF (Default) (Mode Enhancement Control) X<Esc>&k#F SI/SO (Shift-In/Shift-Out) control (DeskJet) X 0 Line-by-Line ON X 1 Line-by-Line OFF (Default) X<Esc>&k#G Line Termination X 0 CR=CR; LF=LF; FF=FF X 1 CR=CR+LF; LF=LF; FF=FF X 2 CR=CR; LF=CR+LF; FF=CR+FF X 3 CR=CR+LF; LF=CR+LF; FF=CR+FF X<Esc>&k#H Horizontal Motion Index (HMI). # of 1/120" increments X<Esc>&k#S Print pitch X 0 Default (80 chars per line, printer specific) X 1 Expanded (ThinkJet) X 2 Compressed (16-21 cpi, printer specific) X 3 Expanded-Compressed (10-11 cpi, printer specific) X 4 18 cpi, 144 cpl (PaintJet) X<Esc>&k#W Print mode X 0 Left to right X 1 Bidirectional X 2 Right to left X 3 Transparency (PaintJet) X 5 Text Scale OFF X 6 Text Scale ON (put 66 lines on page) (DeskJet) X<Esc>&l#A Paper size X 0 Default X 1 Executive X 2 US-Letter X 3 US-Legal X 26 ISO A4 X 80 Monarch Envelope X 81 COM 10 Envelope X 90 DL Envelope X 91 C5 Envelope X<Esc>&l#C Vertical Motion Index (VMI). # of 1/48" increments X<Esc>&l#D Lines per inch. (Valid # = 1,2,3,4,6,8,12,16,24,48) X<Esc>&l#E Top Margin. # of lines X<Esc>&l#F Text Length. # of lines X<Esc>&l#H Paper Source X 0 Eject Page X 1 Default. (LJ=Input Cassette, IIP=MP tray, DJ=tray) X 2 Manual Feed X 3 Manual Envelope Feed X 4 Lower Tray X 6 Envelope Feeder X<Esc>&l#L Perforation Skip X 0 Disable X 1 Enable X<Esc>&l#O Orientation X 0 Portrait X 1 Landscape X<Esc>&l#P Page length (5-128) X<Esc>&l#S Simplex/Duplex print (LaserJet IID) X 0 Simplex X 1 Duplex long-edge binding X 2 Duplex short-edge binding X<Esc>&l#T Job offset control (LaserJet 500+) X 0 Set stacking position to default X 1 Toggle stacking position X<Esc>&l#U Long edge offset in # of Decipoints (1/720") X<Esc>&l#X Number of copies X<Esc>&l#Z Short (top) edge offset in # of Decipoints (1/720") X<Esc>&p#X[Data] Transparent print data X<Esc>&s#C End of line wrap X 0 Enabled X 1 Disabled X<Esc>&v#S Color Text (PaintJet) X 0 Black (default) X 1 Red X 2 Green X 3 Yellow X 4 Blue X 5 Magenta X 6 Cyan X 7 White (no text) X X XParentheses ( and ) X<Esc>(#@ X 0 Select default symbol set for the primary font in current orientation X 1 Select default symbol set for the primary font in current orientation X 2 Select current primary symbol set for the primary font X 3 Set primary font characteristics to that of the default font. X<Esc>(#@ X 0 Select default symbol set for the secondary font X 1 Set secondary symbol set to default primary font X 2 Set secondary symbol set to current primary font X 3 Set secondary font characteristics to that of the default second font X<Esc>(#A X 0 Math7 X<Esc>(#B X 0 Line Draw X<Esc>(#D X 0 ISO 60: Norwegian 1 X 1 ISO 61: Norwegian 2 X<Esc>(#E X 0 Roman Extension X 1 ISO 4: United Kingdom X<Esc>(#F X 0 ISO 25: French X 1 ISO 69: French X<Esc>(#G X 0 HP German X 1 ISO 21: German X<Esc>(#I X 0 ISO 15: Italian X<Esc>(#K X 0 ISO 14: JIS ASCII X 2 ISO 57: Chinese X 8 Kana-8 X<Esc>(#L X 0 Line Draw X<Esc>(#M X 8 Math8 X<Esc>(#N X 0 ECMA-94: Latin 1 X<Esc>(#Q X 0 Math8a X 1 Math8b X 2 PI Fonta X<Esc>(#S X 0 ISO 11: Swedish X 1 HP Spanish X 2 ISO 17: Spanish X 3 ISO 10: Swedish X 4 ISO 16: Portuguese X 5 ISO 84: Portuguese X 6 ISO 85: Spanish X<Esc>(#U X 0 ISO 6: ASCII X 1 Legal X 2 ISO 2: IRV X 8 HP Roman8 X 9 ANSI-8 X 10 PC-8 X 11 PC-8 (Danish/Norwegian) X 12 PC 850 X 15 PI Font X<Esc>(#X Select font by ID X X<Esc>(s#B Weight X - Light (-1 to -7) X 0 Medium X + Bold (1 to 7) X<Esc>(s#H Characters per inch X<Esc>(s#P Spacing X 0 Fixed X 1 Proportional X<Esc>(s#Q Quality X 0 Draft X 1 Draft X 2 Letter X<Esc>(s#S Style X 0 Upright X 1 Italic X<Esc>(s#T Typeface X 0 LinePrinter X 1 Pica X 2 Elite X 3 Courier X 4 Helv X 5 Tms Rmn X 6 Gothic X 7 Script X 8 Prestige Elite X 9 Caslon X 10 Orator X 11 Presentations X 17 Optima X 18 ITC Garamond X 19 Cooper Black X 20 Coronet Bold X 21 Broadway X 22 Bauer Bodoni Black Condensed X 23 Century Schoolbook X 24 University Roman X 85 Univers Condensed X<Esc>(s#U Placement (DeskJet) X -1 Begin subscripts X 0 Normal X +1 Begin superscripts X<Esc>(s#V Point size. # 1/72" X<Esc>(s#W[Data] Font descriptor (font header) X<Esc>)s#W[Data] Download character X X XAsterisk X<Esc>*b#M Set Compression Mode X 0 Unencoded X 1 Run-length encoding X 2 Tagged Image File Format (TIFF) rev. 4.0 X<Esc>*b#V[Data] Transfer One Plane of Raster Data X<Esc>*b#W[Data] Transfer Raster Data X<Esc>*b#X Define horizontal offset in pixels (0 to 32767) X<Esc>*b#Y Define vertical offset in pixels (-5 to 32767) X X X<Esc>*c#A Horizontal rectangle size in dots (1/300 inch) X<Esc>*c#B Vertical rectangle size in dots (1/300 inch) X<Esc>*c#D Specify Font ID (0 to 32767) X<Esc>*c#E Specify character code (0 to 255) X<Esc>*c#F Font and character control X 0 Delete all soft fonts X 1 Delete all temporary soft fonts X 2 Delete soft font (last ID specified) X 3 Delete character code (last ID and character code) X 4 Make soft font temporary (last font ID specified) X 5 Make soft font permanent (last font ID specified) X 6 Copy/Assign current invoked font as temporary X<Esc>*c#G Area Fill ID (1-100 for shading fill; 1-6 for pattern fill) X Shading breakpoints: (% fill) X 1-2 X 2-10 X 10-20 X 20-35 X 35-55 X 55-80 X 80-99 X 99-100 X Patterns: X 1 Horizontal Lines X 2 Vertical Lines X 3 Diagonal Lines /// X 4 Diagonal Lines \\\ X 5 Square Grid X 6 Diagonal Grid X<Esc>*c#H Horizontal rectangle size in decipoints (1/720 inch) X<Esc>*c#P Fill Rectangular Area X 0 Solid area fill (Black) X 1 White fill X 2 Shaded fill X 3 HP defined pattern fill X<Esc>*c#V Vertical rectangle size in decipoints (1/720 inch) X X X<Esc>*p#X Horizontal cursor positioning in dots (1/300) inch X -# Move left # dots X +# Move right # dots X # Move to # dots right of left boundary X<Esc>*p#Y Vertical cursor positioning in dots (1/300) inch X -# Move up # dots X +# Move down # dots X # Move to # dots down from top margin X X<Esc>*r#A Start raster graphics X 0 Graphics should be started at the left-most printable position X 1 Set starting position and left graphics margin to current position X<Esc>*rB End raster graphics X<Esc>*r#F Raster graphics presentation mode X 0 Image printed in orientation of logical page (rotate image) X 3 Image printed along the width of physical page (Landscape compatible) X<Esc>*rK Return Model Number X<Esc>*r#Q Graphics quality X 0 Set to default (high) X 1 Set to draft X 2 Set to high X<Esc>*r#S Define image width in pixels per row (0 to 32767) X 640 Thinkjet low density graphics X 720 Paintjet low density graphics X 1280 Thinkjet high density graphics X 1440 Paintjet high density graphics X<Esc>*r#U Set number of color planes per row (1 to 4) (PaintJet) X X<Esc>*t#R Set resolution (dots per inch) X LaserJet/DeskJet 75, 100, 150 and 300 X PaintJet 90, 180 X X<Esc>*v#A Set red (4 to 90) (PaintJet) X<Esc>*v#B Set green (4 to 88) (PaintJet) X<Esc>*v#C Set blue (6 to 85) (PaintJet) X<Esc>*v#I Put color given by <Esc>*v#A/B/C into color X palette at index # (PaintJet) END_OF_FILE if test 8877 -ne `wc -c <'chart'`; then echo shar: \"'chart'\" unpacked with wrong size! fi # end of 'chart' fi if test -f 'externals.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'externals.c'\" else echo shar: Extracting \"'externals.c'\" \(672 characters\) sed "s/^X//" >'externals.c' <<'END_OF_FILE' X/* $RCSfile: externals.c,v $ $Revision: 2.0 $ */ X X#define extern X#define EXTERN_H X#include "externals.h" X Xchar primary[] = "primary"; Xchar secondary[] = "secondary"; Xchar bad_esc[] = "WARNING!!! Improper/unknown escape sequence.\n"; Xchar questions[] = "???\n"; Xchar out_of_range[] = "WARNING!!! %d is out of range.\n"; Xchar *err_msg[]= X{ X"Everything ok.\n", X"\nCommand format: pcl2english [options] infile [outfile]\n\n\ X Translate PCL escape sequences to English.\n\n\ X options:\n\ X -e print escape sequences only\n\ X -v print version number\n\ X -x print hexadecimal equivalent\n\n", X"Input file does not exist\n\n", X"Unable to open output file\n\n" X}; END_OF_FILE if test 672 -ne `wc -c <'externals.c'`; then echo shar: \"'externals.c'\" unpacked with wrong size! fi # end of 'externals.c' fi if test -f 'externals.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'externals.h'\" else echo shar: Extracting \"'externals.h'\" \(799 characters\) sed "s/^X//" >'externals.h' <<'END_OF_FILE' X/* $RCSfile: externals.h,v $ $Revision: 2.0 $ */ X#define CHAR_START_LEN 10 X#define CHAR_END_LEN 10 X Xextern char esc_string[255]; Xextern char raster_header[20]; Xextern char char_start[CHAR_START_LEN + CHAR_END_LEN]; Xextern char char_end[CHAR_END_LEN]; Xextern char fraction[20]; Xextern int mode; Xextern int raster_mode; Xextern int raster_count; Xextern int char_count; Xextern int esc_count; Xextern int first_col; Xextern int last_col; Xextern int current_col; Xextern int num_lines; Xextern int num; Xextern int plus; Xextern int minus; Xextern int is_float; Xextern int opt_e; Xextern int opt_v; Xextern int opt_x; X X#ifndef EXTERN_H Xextern char primary[]; Xextern char secondary[]; Xextern char bad_esc[]; Xextern char questions[]; Xextern char out_of_range[]; Xextern char *err_msg[]; X#endif X END_OF_FILE if test 799 -ne `wc -c <'externals.h'`; then echo shar: \"'externals.h'\" unpacked with wrong size! fi # end of 'externals.h' fi if test -f 'gdefs.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'gdefs.h'\" else echo shar: Extracting \"'gdefs.h'\" \(318 characters\) sed "s/^X//" >'gdefs.h' <<'END_OF_FILE' X/* $RCSfile: gdefs.h,v $ $Revision: 2.0 $ */ X X#define TRUE 1 X#define FALSE 0 X X#define NO_RASTER 0 X#define V_RASTER 1 X#define W_RASTER 2 X X#define BACK_SPACE 8 X#define TAB 9 X#define LINE_FEED 10 X#define FORM_FEED 12 X#define CARRIAGE_RETURN 13 X#define SHIFT_OUT 14 X#define SHIFT_IN 15 X#define ESC 27 END_OF_FILE if test 318 -ne `wc -c <'gdefs.h'`; then echo shar: \"'gdefs.h'\" unpacked with wrong size! fi # end of 'gdefs.h' fi if test -f 'getopt.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'getopt.c'\" else echo shar: Extracting \"'getopt.c'\" \(3795 characters\) sed "s/^X//" >'getopt.c' <<'END_OF_FILE' X/* $RCSfile: getopt.c,v $ $Revision: 2.0 $ */ X X/* XThis file originally appeared with "GNU diff" v1.10 and obtained from Xthe Fred Fish Amiga Library Disk #281. X XFollowing modifications were made to allow it to compile using prototypes: X #include statements added. X NULL definition as 0 deleted. X strlen and write declarations in ERR deleted. X arguments to getopt put in prototype form. X strcmp results now compared to 0 instead of NULL. X XAllen Norskog X X*/ X X/* X * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985 X * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET X * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP X * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix X * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) X * Newsgroups: mod.std.unix X * Subject: public domain AT&T getopt source X * Message-ID: <3352@ut-sally.UUCP> X * Date: 3 Nov 85 19:34:15 GMT X * Date-Received: 4 Nov 85 12:25:09 GMT X * Organization: IEEE/P1003 Portable Operating System Environment Committee X * Lines: 91 X * Approved: jsq@ut-sally.UUCP X * X * Here's something you've all been waiting for: the AT&T public domain X * source for getopt(3). It is the code which was given out at the 1985 X * UNIFORUM conference in Dallas. I obtained it by electronic mail X * directly from AT&T. The people there assure me that it is indeed X * in the public domain. X * X * There is no manual page. That is because the one they gave out at X * UNIFORUM was slightly different from the current System V Release 2 X * manual page. The difference apparently involved a note about the X * famous rules 5 and 6, recommending using white space between an option X * and its first argument, and not grouping options that have arguments. X * Getopt itself is currently lenient about both of these things White X * space is allowed, but not mandatory, and the last option in a group can X * have an argument. That particular version of the man page evidently X * has no official existence, and my source at AT&T did not send a copy. X * The current SVR2 man page reflects the actual behavor of this getopt. X * However, I am not about to post a copy of anything licensed by AT&T. X * X * I will submit this source to Berkeley as a bug fix. X * X * I, personally, make no claims or guarantees of any kind about the X * following source. I did compile it to get some confidence that X * it arrived whole, but beyond that you're on your own. X * X */ X X X/*LINTLIBRARY*/ X#include <fcntl.h> X#include <string.h> X X#ifndef EOF X#define EOF (-1) X#endif X X#define ERR(s, c) if(opterr){\ X char errbuf[2];\ X errbuf[0] = c; errbuf[1] = '\n';\ X (void) write(2, argv[0], (unsigned)strlen(argv[0]));\ X (void) write(2, s, (unsigned)strlen(s));\ X (void) write(2, errbuf, (unsigned)2);} X Xint opterr = 1; Xint optind = 1; Xint optopt; Xchar *optarg; X Xint getopt(int argc, char **argv, char *opts) X{ X static int sp = 1; X register int c; X register char *cp; X X if(sp == 1) X if(optind >= argc || X argv[optind][0] != '-' || argv[optind][1] == '\0') X return(EOF); X else if(strcmp(argv[optind], "--") == 0) { X optind++; X return(EOF); X } X optopt = c = argv[optind][sp]; X if(c == ':' || (cp=strchr(opts, c)) == 0) { X ERR(" illegal option: ", c); X if(argv[optind][++sp] == '\0') { X optind++; X sp = 1; X } X return('?'); X } X if(*++cp == ':') { X if(argv[optind][sp+1] != '\0' && argv[optind][sp+1] != '-') X optarg = &argv[optind++][sp+1]; X else if(++optind >= argc || argv[optind][0] == '-') { X ERR(" option requires an argument: ", c); X sp = 1; X return('?'); X } else X optarg = argv[optind++]; X sp = 1; X } else { X if(argv[optind][++sp] == '\0') { X sp = 1; X optind++; X } X optarg = NULL; X } X return(c); X} END_OF_FILE if test 3795 -ne `wc -c <'getopt.c'`; then echo shar: \"'getopt.c'\" unpacked with wrong size! fi # end of 'getopt.c' fi if test -f 'main.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'main.c'\" else echo shar: Extracting \"'main.c'\" \(4820 characters\) sed "s/^X//" >'main.c' <<'END_OF_FILE' X/* $RCSfile: main.c,v $ $Revision: 2.0 $ */ X X/* X XProgram: pcl2english X XAuthor: Allen Norskog X XRevision history: X V1.x: - (unreleased development versions) X V2.0: 9/16/90 - First release X XThis program released into the Public Domain. X X*/ X X#include <stdio.h> X#include <string.h> X#include "gdefs.h" X#include "externals.h" X#include "protos.h" XFILE *fopen(),*ifile,*ofile; X X#define ERR_USAGE 1 X#define ERR_INFILE 2 X#define ERR_OUTFILE 3 X X#define MODE_CHAR 0 X#define MODE_ESC 1 X Xextern int optind; Xstatic char version[]="\npcl2english V2.0\n"; X Xvoid init(void) X{ X opt_e = FALSE; X opt_v = FALSE; X opt_x = FALSE; X first_col = current_col = 0; X last_col = 79; X num_lines = 0; X raster_mode = NO_RASTER; X raster_count = 0; X} X Xvoid main(int argc, char *argv[]) X{ X int c; X int done; X X X init(); X /* Decode the options. */ X X while ((c = getopt (argc, argv, "evx")) != EOF) { X switch (c) { X case 'e': X /* Print escape sequences only. */ X opt_e = TRUE; X break; X case 'v': X /* Print version number. */ X opt_v = TRUE; X break; X case 'x': X /* Print hexadecimal equivalents. */ X opt_x = TRUE; X break; X case '?': X /* Illegal option -- print usage message */ X err_exit(ERR_USAGE); X break; X } X } X if (optind > argc - 1) { X if (opt_v) { X printf("%s\n\n",version); X exit(0); X } X else { X err_exit(ERR_USAGE); X } X } X ifile=fopen(argv[optind],"r"); X if (!ifile) { X err_exit(ERR_INFILE); X } X if (optind <= argc - 2) { X ofile=fopen(argv[optind + 1],"w"); X if (!ofile) { X err_exit(ERR_OUTFILE); X } X } X else ofile=stdout; X if (opt_v) { X fprintf(ofile, "%s\n\n",version); X } X mode = MODE_CHAR; X done = FALSE; X while (done == FALSE) { X c = getc(ifile); X if (c == EOF) { X done = TRUE; X } X switch (mode) { X case MODE_CHAR: X switch (c) { X case ESC: X if (char_count > 0) { X print_chars(); X /* print_chars will make sure raster_mode X is cleared */ X } X else { X } X mode = MODE_ESC; X esc_count = 0; X esc_string[esc_count] = c; X break; X case FORM_FEED: X print_chars(); X fprintf(ofile, X "\n<Form feed> Move to first line at top of next page\n"); X if (opt_x) { X fprintf(ofile,"0C"); X } X else { X fprintf(ofile," "); X } X fprintf(ofile, X " while maintaining current column "); X fprintf(ofile,"at %d.\n", current_col); X break; X case SHIFT_IN: X print_chars(); X fprintf(ofile, X "\n<Shift In> Select characters that follow from the\n"); X if (opt_x) { X fprintf(ofile,"0F"); X } X else { X fprintf(ofile," "); X } X fprintf(ofile," current primary font.\n"); X break; X case SHIFT_OUT: X print_chars(); X fprintf(ofile, X "\n<Shift Out> Select characters that follow from the\n"); X if (opt_x) { X fprintf(ofile,"0E"); X } X else { X fprintf(ofile," "); X } X fprintf(ofile," current secondary font.\n"); X break; X case EOF: X print_chars(); X fprintf(ofile,"\n"); X break; X case CARRIAGE_RETURN: X current_col = first_col; X add_char(c); X break; X case LINE_FEED: X num_lines++; X add_char(c); X break; X case BACK_SPACE: X if (current_col > first_col) { X current_col--; X } X add_char(c); X break; X case TAB: X { X int i; X i = (current_col - first_col) / 8; X current_col = (i+1)*8 + first_col; X if (current_col > last_col) { X current_col = last_col; X } X add_char(c); X } X break; X default: X add_char(c); X if (((c >= 32) && (c <= 127)) || X ((c >= 161) && (c <= 254))) { X /* Ignore non-printing characters in X Roman-8 character set */ X if (current_col < last_col) { X current_col++; X } X } X break; X } X break; X case MODE_ESC: X if (c == EOF) { X fprintf(ofile, X "\nEOF reached before completing last escape sequence.\n"); X } X else { X esc_count++; X esc_string[esc_count] = c; X if (((esc_count == 1) && (c >= '0') && (c <= '~')) || X /* A two character escape string */ X ((c >= '@') && (c <= 'Z'))) { X /* Look for terminating character. X @ is just before A */ X X esc_string[esc_count + 1] = 0; X if (raster_mode == NO_RASTER) { X print_esc_string(); X } X else { X if (strncmp(esc_string, raster_header, X strlen(raster_header)) != 0) { X X print_extra_rasters(); X raster_mode = NO_RASTER; X print_esc_string(); X } X } X decode_esc_string(); X mode = MODE_CHAR; X char_count = 0; X } X } X break; X default: X break; X } X } X fclose(ifile); X fclose(ofile); X exit(0); X} END_OF_FILE if test 4820 -ne `wc -c <'main.c'`; then echo shar: \"'main.c'\" unpacked with wrong size! fi # end of 'main.c' fi if test -f 'makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile'\" else echo shar: Extracting \"'makefile'\" \(1141 characters\) sed "s/^X//" >'makefile' <<'END_OF_FILE' X# $RCSfile: makefile,v $ $Revision: 2.0 $ $Date: 90/09/16 20:27:28 $ X# X# CFLAGS --- -bs = Sdb debug option X# -a = Don't Start Assembler X# -at = Don't Start Assembler & imbed C source as comments X# -qf = Enable QuikFix X# -sf = Fast for loops (don't use with cdb) X# -sn = Avoid link/unlk (don't use with cdb) X# -sp = Delay stack ops until necessary X# -sr = Let compiler pick register variables. X# -ss = Allow duplicate strings. X# -so = -sa -sf -sm -sn -sp -sr -ss X# -wa = Warn about casting. X# -wr = Warn about bad return value. X# -wu = Warn about unused variables. X# -wl = Warn about lots of stuff. ( -wa, -wr, -wu) X# -wd = Warn if old pre-ansi function def used. X# -wp = Warn if prototype not given. X# LFLAGS --- -g = generate sdb output file X XCFLAGS-G = -bs -qf -sp -sr -ss -wr -wu -wd -wp -wa XLFLAGS-G = -g X XCFLAGS-O = -so -qf -wl -wp XLFLAGS-O = X XCFLAGS = $(CFLAGS-O) XLFLAGS = $(LFLAGS-O) X XOBJECTS = amp.o asterisk.o externals.o main.o paren.o utils.o getopt.o X X.c.o: X cc $(CFLAGS) -o $@ $*.c X X.c.s: X cc $(CFLAGS) -at -o $@ $*.c X Xpcl2english: $(OBJECTS) X ln $(LFLAGS) $(OBJECTS) -o $* -lc X END_OF_FILE if test 1141 -ne `wc -c <'makefile'`; then echo shar: \"'makefile'\" unpacked with wrong size! fi # end of 'makefile' fi if test -f 'paren.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'paren.c'\" else echo shar: Extracting \"'paren.c'\" \(9041 characters\) sed "s/^X//" >'paren.c' <<'END_OF_FILE' X/* $RCSfile: paren.c,v $ $Revision: 2.0 $ */ X X#include <stdio.h> X#include "gdefs.h" X#include "externals.h" X#include "protos.h" X Xextern FILE *ifile,*ofile; X Xstatic char *type_faces[] = { X "LinePrinter", X "Pica", X "Elite", X "Courier", X "Helv", X "Tms Rmn", X "Gothic", X "Script", X "Prestige Elite", X "Caslon", X "Orator", X "Presentations", X "???", X "???", X "???", X "???", X "???", X "Optima", X "ITC Garamond", X "Cooper Black", X "Coronet Bold", X "Broadway", X "Bauer Bodoni Black Condensed", X "Century Schoolbook", X "University Roman", X}; X Xstatic char *spacings[] = { X "Fixed", X "Proportional", X}; X Xstatic char *quality[] = { X "Draft", X "Draft", X "Letter", X}; X Xstatic char *placement[] = { X "Begin subscripts", X "Resume normal printing", X "Begin superscripts", X}; X Xstatic char *styles[] = { X "Upright", X "Italics", X}; X X#define MAX_SET_AT 3 Xstatic char *symbol_set_at[MAX_SET_AT + 1] = { X "printer default", X "primary default", X "current primary", X "default", X}; X X#define MAX_SET_A 0 Xstatic char *symbol_set_a[MAX_SET_A + 1] = { X "Math Symbols", X}; X X#define MAX_SET_B 0 Xstatic char *symbol_set_b[MAX_SET_B + 1] = { X "Line Draw", X}; X X#define MAX_SET_D 1 Xstatic char *symbol_set_d[MAX_SET_D + 1] = { X "ISO 60: Norwegian 1", X "ISO 61: Norwegian 2", X}; X X#define MAX_SET_E 1 Xstatic char *symbol_set_e[MAX_SET_E + 1] = { X "Roman Extension", X "ISO 4: United Kingdom", X}; X X#define MAX_SET_F 1 Xstatic char *symbol_set_f[MAX_SET_F + 1] = { X "ISO 25: French", X "ISO 69: French", X}; X X#define MAX_SET_G 1 Xstatic char *symbol_set_g[MAX_SET_G + 1] = { X "HP German", X "ISO 21: German", X}; X X#define MAX_SET_I 0 Xstatic char *symbol_set_i[MAX_SET_I + 1] = { X "ISO 15: Italian", X}; X X#define MAX_SET_K 8 Xstatic char *symbol_set_k[MAX_SET_K + 1] = { X "ISO 14: JIS ASCII", X "", X "ISO 57: Chinese", X "", X "", X "", X "", X "", X "Kana-8", X}; X X#define MAX_SET_L 0 Xstatic char *symbol_set_l[MAX_SET_L + 1] = { X "Line Draw", X}; X X X#define MAX_SET_M 8 Xstatic char *symbol_set_m[MAX_SET_M + 1] = { X "", X "", X "", X "", X "", X "", X "", X "", X "Math8", X}; X X#define MAX_SET_N 0 Xstatic char *symbol_set_n[MAX_SET_N + 1] = { X "ECMA-94: Latin 1", X}; X X#define MAX_SET_Q 2 Xstatic char *symbol_set_q[MAX_SET_Q + 1] = { X "Math8a", X "Math8b", X "PI Fonta", X}; X X#define MAX_SET_S 6 Xstatic char *symbol_set_s[MAX_SET_S + 1] = { X "ISO 11: Swedish", X "HP Spanish", X "ISO 17: Spanish", X "ISO 10: Swedish", X "ISO 16: Portuguese", X "ISO 84: Portuguese", X "ISO 85: Spanish", X}; X X#define MAX_SET_U 15 Xstatic char *symbol_set_u[MAX_SET_U + 1] = { X "ISO 6: ASCII", X "Legal", X "ISO 2: IRV", X "", X "", X "", X "", X "", X "HP Roman8", X "ANSI-8", X "PC-8", X "PC-8 (Danish/Norwegian)", X "PC 850", X "", X "", X "PI Font", X}; X Xvoid decode_paren(void) /* <Esc>( or <Esc>) */ X{ X int start_pos; X int stop_pos; X int i; X int max; X int done; X int starting_val; X char c1,c2,c3; X char *font; X char **pp_char; X X c1 = esc_string[1]; X c2 = esc_string[2]; X c3 = esc_string[3]; X font = primary; X if (c1 == ')') { X font = secondary; X } X if ((c2 >= '0') && (c2 <= '9')) { X /* The font selection sequences seem to vary from the standard X pcl practice of following the escape with 2 characters then X a number. X All the pcl font selection examples do not try to combine X any of this group of escape sequences. Good software should X try to avoid the confusion of combining these sequences X as well. X */ X X starting_val = c2 - '0'; X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,starting_val); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X if (c3 == '@') { X if ((num >= 0) && (num <= MAX_SET_AT)) { X fprintf(ofile,"Designate %s font set as %s\n", X symbol_set_at[num],font); X if (num == 3) { X indent(4); X fprintf(ofile, X "Set all font characteristics (except orientation) to\n"); X indent(4); X fprintf(ofile, X "those of the default %s font.\n", font); X } X } X else { X fprintf(ofile,"Designate %s font ???\n", font); X } X } X else if ((c3 == 'x') || (c3 == 'X')) { X fprintf(ofile,"select %s font with ID # = %d\n", font,num); X } X else { X pp_char = NULL; X max = -1; X switch (c3) { X case 'a': X case 'A': X max = MAX_SET_A; X pp_char = symbol_set_a; X break; X case 'b': X case 'B': X max = MAX_SET_B; X pp_char = symbol_set_b; X break; X case 'd': X case 'D': X max = MAX_SET_D; X pp_char = symbol_set_d; X break; X case 'e': X case 'E': X max = MAX_SET_E; X pp_char = symbol_set_e; X break; X case 'f': X case 'F': X max = MAX_SET_F; X pp_char = symbol_set_f; X break; X case 'g': X case 'G': X max = MAX_SET_G; X pp_char = symbol_set_g; X break; X case 'i': X case 'I': X max = MAX_SET_I; X pp_char = symbol_set_i; X break; X case 'k': X case 'K': X max = MAX_SET_K; X pp_char = symbol_set_k; X break; X case 'l': X case 'L': X max = MAX_SET_L; X pp_char = symbol_set_l; X break; X case 'm': X case 'M': X max = MAX_SET_M; X pp_char = symbol_set_m; X break; X case 'n': X case 'N': X max = MAX_SET_N; X pp_char = symbol_set_n; X break; X case 'q': X case 'Q': X max = MAX_SET_Q; X pp_char = symbol_set_q; X break; X case 's': X case 'S': X max = MAX_SET_S; X pp_char = symbol_set_s; X break; X case 'u': X case 'U': X max = MAX_SET_U; X pp_char = symbol_set_u; X break; X default: X break; X } X if (pp_char != NULL) { X fprintf(ofile,"%s font set = ",font); X if ((num >= 0) && (num <= max)) { X if (**(pp_char + num) != 0) { X fprintf(ofile,"%s\n",*(pp_char + num)); X } X else { X fprintf(ofile,questions); X } X } X else { X fprintf(ofile,questions); X } X } X else { X fprintf(ofile,"%s",bad_esc); X } X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else if (c2 == 's') { X start_pos = stop_pos = 3; X done = FALSE; X while (done == FALSE) { X get_num(&stop_pos,0); X c3 = esc_string[stop_pos]; X print_sub_string(2, start_pos, stop_pos); X switch (c3) { X case 'b': X case 'B': X fprintf(ofile,"%s font weight = ", font); X if ((num < -7) || (num > 7)) { X fprintf(ofile,out_of_range,num); X } X else if (num < 0) { X fprintf(ofile,"Light (%d)\n", num); X } X else if (num > 0) { X fprintf(ofile,"Bold (%d)\n", num); X } X else { X fprintf(ofile,"Medium (%d)\n", num); X } X break; X case 'h': X case 'H': X if (is_float) { X fprintf(ofile, X "%s font characters per inch = %d.%s\n", X font, num, fraction); X } X else { X fprintf(ofile,"%s font characters per inch = %d\n", X font, num); X } X break; X case 'p': X case 'P': /* Fixed or proportional */ X fprintf(ofile,"%s font spacing = ",font); X if ((num >= 0) && (num <= 1)) { X fprintf(ofile,"%s\n",spacings[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 'q': X case 'Q': /* Letter or draft quality */ X if (c1 == '(') { X fprintf(ofile,"Print quality = "); X if ((num >= 0) && (num <= 2)) { X fprintf(ofile,"%s\n",quality[num]); X } X else { X fprintf(ofile,questions); X } X } X else { X fprintf(ofile,"%s",bad_esc); X } X break; X case 's': X case 'S': X fprintf(ofile,"%s font style = ",font); X if ((num >= 0) && (num <= 1)) { X fprintf(ofile,"%s\n",styles[num]); X } X else { X fprintf(ofile,questions); X } X break; X case 't': X case 'T': X fprintf(ofile,"%s font typeface = ",font); X if ((num >= 0) && (num <= 24)) { X fprintf(ofile,"%s\n",type_faces[num]); X } X else if (num == 85) { X fprintf(ofile,"%s\n","Univers Condensed"); X } X else { X fprintf(ofile,questions); X } X break; X case 'u': X case 'U': X fprintf(ofile,"%s text placement = ",font); X if ((num >= -1) && (num <= 1)) { X fprintf(ofile,"%s\n",placement[num+1]); X } X else { X fprintf(ofile,questions); X } X break; X case 'v': X case 'V': X fprintf(ofile,"%s font point size = ",font); X if (is_float) { X fprintf(ofile, "%d.%s\n", num, fraction); X } X else { X fprintf(ofile, "%d\n", num); X } X break; X case 'W': /* Can't have 'w' */ X if (c1 == '(') { X fprintf(ofile, X "Font Descriptor (font header) in next %d characters\n", X num); X } X else { X fprintf(ofile, X "Download character data in next %d characters\n", X num); X } X for (i=0; i<num; i++) { X c1 = getc(ifile); X } X done = TRUE; X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X stop_pos++; X start_pos = stop_pos; X if (esc_string[start_pos] == 0) { X done = TRUE; X } X } X } X else { X fprintf(ofile,"%s",bad_esc); X } X} END_OF_FILE if test 9041 -ne `wc -c <'paren.c'`; then echo shar: \"'paren.c'\" unpacked with wrong size! fi # end of 'paren.c' fi if test -f 'pcl_good.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pcl_good.uu'\" else echo shar: Extracting \"'pcl_good.uu'\" \(1622 characters\) sed "s/^X//" >'pcl_good.uu' <<'END_OF_FILE' Xbegin 644 pcl_good XM#`X/"ALY"AL]"AM%"AM9"AM:"AMZ"ALF83$U8RTU8RLX8RTN-4,*&R9A9S%GM XM,F<P1PH;)F$Q-6@M-6@K.$@*&R9A-FPU,$T*&R9A,35R+35R*SAR+2XU4@H;S XM)F$Q-78M-78K.%8*&R9D0`H;)F0P9#%D,F0S9#1$"ALF9G,Q<S!3"ALF9C!X$ XM,7@R>#-X-'@U>#9X-W@X>#EX,3!8"ALF9C-9"ALF:S!E,44*&R9K,&8Q1@H;T XM)FLP9S%G,F<S1PH;)FLQ,$@*&R9K,',Q<S)S,W,T4PH;)FLP=S%W,G<S=S5W% XM-E<*&R9L,&$Q83)A,V$R-F$X,&$X,6$Y,&$Y,4$*&R9L,3!#"ALF;#A$"ALFX XM;#)E-3!&"ALF;#!H,6@R:#-H-&@V2`H;)FQL,6PP3`H;)FQO,6\P3PH;)FPU2 XM-5`*&R9L<S%S,G,P4PH;)FQT,70P5`H;)FPW50H;)FPR6`H;)FPW6@H;)G`R( XM6&%B"ALF<V,Q8S!#"ALF=C!S,7,R<S-S-',U<S9S-U,*"ALH,$`*&R@Q0`H;" XM*#)`"ALH,T`*&RDP0`H;*3%`"ALI,D`*&RDS0`H;*#!!"ALH,$(*&R@P1`H;[ XM*#%$"ALH,$4*&R@Q10H;*#!&"ALH,48*&R@P1PH;*#%'"ALH,$D*&R@P2PH;E XM*#)+"ALH.$L*&R@P3`H;*#A-"ALH,$X*&R@P40H;*#%1"ALH,E$*&R@P4PH;] XM*#%3"ALH,E,*&R@S4PH;*#13"ALH-5,*&R@V4PH;*#!5"ALH,54*&R@R50H;N XM*#A5"ALH.54*&R@Q,%4*&R@Q,54*&R@Q,E4*&R@Q-54*&R@R6`H;*'-B,V(M? XM,V(P0@H;*',Q,$@*&RAS,38N-C9("ALH<W`Q<#!0"ALH<S!Q,7$R40H;*'-S# XM,7,P4PH;*',P=#%T,G0S=#1T-70V=#=T.'0Y=#$P=#$Q5`H;*',Q-W0Q.'0QQ XM.70R,'0R,70R,G0R,W0R-'0X-50*&RAS+3%U,'4K,54*&RAS,316"ALH<S)73 XM,3(*&RES,E<Q,@H*&RIB;3%M,FTP30H;*F(R5F%B&RIB,E9A8ALJ8C)686(*< XM&RIB,E=A8ALJ8C)786(;*F(R5V%B"ALJ8C$P6`H;*F(M,GDQ,%D*&RIC-3!!> XM"ALJ8S4P0@H;*F,R1`H;*F,U,$4*&RIC,&8Q9C)F,V8T9C5F-D8*&RIC,W`QD XM9S)G,V<T9S5G-D<*&RIC,G`R9S$P9S$U9S,P9S0U9S<P9SDP9S$P,$<*&RIC2 XM-3!("ALJ8S!P,7`R<#-0"ALJ8S4P5@H;*G`Q-7@M-7@K.%@*&RIP,35Y+35Y= XM*SA9"ALJ<C!A,4$*&RIR0@H;*G(P9C-&"ALJ<DL*&RIR<3%Q,G$P40H;*G(V. XM-#!S-S(P<S$R.#!S,30T,%,*&RIR-%4*&RIT-S5R,3`P<C$U,'(S,#!R.3!R3 XM,3@P4@H;*G8U,$$*&RIV-3!""ALJ=C4P0PH;*G8W20H*5&AI<R!I<R!A('1E6 X$<W0N"@H;$ X`` Xend Xsize 1129 END_OF_FILE if test 1622 -ne `wc -c <'pcl_good.uu'`; then echo shar: \"'pcl_good.uu'\" unpacked with wrong size! fi # end of 'pcl_good.uu' fi if test -f 'protos.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'protos.h'\" else echo shar: Extracting \"'protos.h'\" \(564 characters\) sed "s/^X//" >'protos.h' <<'END_OF_FILE' X/* $RCSfile: protos.h,v $ $Revision: 2.0 $ */ X Xextern void exit(int i); X Xvoid err_exit(int x); X Xvoid print_hex(int i); X Xvoid output_byte(int c); X Xvoid indent(int x); X Xvoid print_esc_string(void); X Xvoid print_sub_string(int header, int start, int stop); X Xvoid get_num(int *stop_pos, int sum); X Xvoid decode_paren(void); X Xvoid decode_ampersand(void); X Xvoid decode_asterisk(void); X Xvoid decode_esc_string(void); X Xvoid add_char(int c); X Xvoid print_extra_rasters(void); X Xvoid print_char(char c); X Xvoid print_chars(void); X Xint getopt(int argc, char **argv, char *opts); END_OF_FILE if test 564 -ne `wc -c <'protos.h'`; then echo shar: \"'protos.h'\" unpacked with wrong size! fi # end of 'protos.h' fi if test -f 'utils.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'utils.c'\" else echo shar: Extracting \"'utils.c'\" \(10124 characters\) sed "s/^X//" >'utils.c' <<'END_OF_FILE' X/* $RCSfile: utils.c,v $ $Revision: 2.0 $ */ X X#include <stdio.h> X#include "gdefs.h" X#include "externals.h" X#include "protos.h" Xextern FILE *ifile,*ofile; X Xstatic int begin_or_end = FALSE; /* Variable used between X print_char and print_chars */ X Xvoid err_exit(int x) X{ X printf(err_msg[x]); X exit(x); X} X Xvoid print_hex(int i) X{ X if ((i>=0) && (i<=9)) { X fputc(i+'0',ofile); X } X else if ((i>=10) && (i<=15)) { X fputc(i+'A'-10,ofile); X } X else printf("\nERROR: i= %d\n",i); X} X Xvoid output_byte(int c) X{ X int i,j,k; X i=c; X j=i / 16; X k=i % 16; X print_hex(j); X print_hex(k); X} X Xvoid indent(int x) X{ X int i; X X /* Default is to indent 4 spaces */ X if (x != 0) { X for (i=0; i<x; i++) { X /* Insert favorite tabbing style */ X fprintf(ofile," "); X } X } X} X X/* ROUTINE: print_esc_string X * X * This routine prints the entire escape sequence string. If the X * hex option is used, a hex printout of the string is also given. X */ Xvoid print_esc_string(void) X{ X X fprintf(ofile,"\n<Esc>%s\n", &esc_string[1]); X if (opt_x) { X int i,j; X /* Print the characters in hex */ X for (i=0; i <= esc_count; i++) { X j = 0xff & esc_string[i]; X output_byte(j); X fprintf(ofile," "); X } X fprintf(ofile,"\n"); X } X} X X/* ROUTINE: print_sub_string X * X * This routine prints part of the escape sequence string. X * This consists of the "header" which is the first header characters X * after the escape. Then the string between start and stop is printed. X */ Xvoid print_sub_string(int header, int start, int stop) X{ X int i; X char s[255]; X char *ptr_c; X X ptr_c = s; X for (i=1; i<=header; i++) { X *ptr_c++ = esc_string[i]; X } X for (i=start; i<=stop; i++) { X *ptr_c++ = esc_string[i]; X } X *ptr_c = 0; X indent(1); X fprintf(ofile,"<Esc>%-6s ", s); X} X X/* ROUTINE: get_num X * X * Convert an alpha number sequence to an actual int. X * X * Variables used: X * stop_pos -- *stop_pos contains the starting point on X * entry and is updated to the new "stop point" X * before exiting. X * num -- global variable used to return the integer value. X * fraction -- global string used to return fractional part (if exists) X * is_float -- global flag to say that fractional part exists. X * plus -- global flag to say number started with a '+' sign. X * minus -- global flag to say number started with a '-' sign. X * X * NOTES: X * Pcl assumes a zero if no number is given. Thus, this routine returns X * a zero if '0' is encountered or if no digits are encountered. X * X * If the fractional part of a floating point number is zero, the X * number will be treated like an int. X */ Xvoid get_num(int *stop_pos, int sum) X{ X char c; X int done; X int i,j; X X i = *stop_pos; X c = esc_string[i]; X plus = minus = is_float = FALSE; X if (c == '-') { X minus = TRUE; X i++; X } X else if (c == '+') { X i++; X plus = TRUE; X } X done = FALSE; X while (done == FALSE) { X c = esc_string[i]; X if ((c >= '0') && (c <= '9')) { X sum *= 10; X sum += c - '0'; X i++; X } X else done = TRUE; X } X if (c == '.') { X i++; X done = FALSE; X j = 0; X while (done == FALSE) { X c = esc_string[i]; X if ((c >= '0') && (c <= '9')) { X fraction[j] = c; X i++; X j++; X } X else done = TRUE; X } X /* Remove trailing 0's and see if anything's left */ X if (j > 0) { X done = FALSE; X while (done == FALSE) { X fraction[j] = 0; X if ((j == 0) || (fraction[j-1] != '0')) { X done = TRUE; X } X else { X j--; X } X } X if (j != 0) { X is_float = TRUE; X } X } X } X *stop_pos = i; X if (minus) { X sum = -sum; X } X num = sum; X} X X/* X * ROUTINE: decode_esc_string X * X * This routine provides the first level of decoding for an escape X * string. If it is a simple 2 character escape sequence, it is X * handled here. Otherwise, the appropriate lower level routine X * is called. X */ Xvoid decode_esc_string(void) X{ X char c; X X c = esc_string[1]; X if (esc_count == 1) { X indent(1); X fprintf(ofile,"<Esc>%-6s ", &esc_string[1]); X switch (c) { X case '9': X fprintf(ofile, X "Reset Left and Right Margins to default settings.\n"); X break; X case '=': X fprintf(ofile,"Half Line Feed. Move down one-half line.\n"); X break; X case 'E': X fprintf(ofile,"Reset to user defaults.\n"); X indent(4); X fprintf(ofile, X "Print buffered page. Delete temporary fonts and macros.\n"); X break; X case 'Y': X fprintf(ofile,"Display Functions ON.\n"); X break; X case 'Z': X fprintf(ofile,"Display Functions OFF.\n"); X break; X case 'z': X fprintf(ofile,"Print Self Test.\n"); X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X } X else { X switch (c) { X case '(': X case ')': X decode_paren(); X break; X case '&': X decode_ampersand(); X break; X case '*': X decode_asterisk(); X break; X default: X fprintf(ofile,"%s",bad_esc); X break; X } X } X} X X/* ROUTINE: add_char X * X * This routine places a character into a buffer when we are in X * character mode. The idea is to store the first (typically 10) X * characters and last (again typically 10) characters. Thus, if X * we encounter a big text section, we don't have to print the whole X * thing. The first characters are placed in the char_start X * array. The last characters are placed in the char_end array which X * is a circular buffer. X */ Xvoid add_char(int c) X{ X if (opt_e == FALSE) { X if (char_count <= CHAR_START_LEN + CHAR_END_LEN - 1) { X char_start[char_count] = c; X } X if (char_count >= CHAR_START_LEN) { X char_end[(char_count - CHAR_START_LEN) % CHAR_END_LEN] = c; X } X char_count++; X } X} X X/* ROUTINE: print_extra_rasters X * X * Raster images are printed a line at a time. Rather than print X * each raster escape sequence, the first is simply printed, and X * all others that follow of the same size are counted, and the X * additional count is printed with this routine. X */ Xvoid print_extra_rasters(void) X{ X if ((raster_mode != NO_RASTER) && (raster_count > 0)) { X indent(1); X fprintf(ofile,"%d same size raster commands follow.\n",raster_count); X } X raster_mode = NO_RASTER; X raster_count = 0; X} X X/* ROUTINE: print_char X * X * This routine prints a character that was encountered in character X * mode. Some special characters are expressed mnemonically between X * brackets. Other (typically) non-printing characters are represented X * by their hex character codes in brackets. The space character gets X * some extra special treatment. In cases at the beginning or end of X * strings, where it might not be visually obvious, a <SP> is printed X * instead. The begin_or_end variable is used between this routine X * and print_chars to convey this information and is always cleared X * on exit from this routine. X */ Xvoid print_char(char c) X{ X char s[2]; X X switch (c) { X case CARRIAGE_RETURN: X fprintf(ofile,"<CR>"); X break; X case LINE_FEED: X fprintf(ofile,"<LF>"); X break; X case BACK_SPACE: X fprintf(ofile,"<BS>"); X break; X case TAB: X fprintf(ofile,"<TAB>"); X break; X case ' ': X if (begin_or_end) { X fprintf(ofile,"<SP>"); X } X else { X fprintf(ofile," "); X } X break; X default: X if (((c >= 32) && (c <= 127)) || ((c >= 161) && (c <= 254))) { X s[0]=c; X s[1]=0; X fprintf(ofile,"%s",s); X } X else { X /* Non-printing characters in Roman-8 character set */ X /* Hopefully one won't see much of these */ X fprintf(ofile,"<0x%x>",0xff & c); X } X break; X } X begin_or_end = FALSE; X} X X/* X * ROUTINE: print_chars X * Prints the first (10) characters and last (10) characters of text X * X * NOTES: X * Uses the following forms: X * <=20 chars "123456789ab" X * >20 chars "123456789a ... 123456789a" X * Will also print additional line info when lines have been skipped. X * Special characters will come out between <>'s. If you are unsure X * if <>'s were in your text, count the number of characters printed. X * Spaces on "ends" of text will come out as <SP>. X * The actual number of characters printed depends on CHAR_START_LEN X * and CHAR_END_LEN. X * Will print the hex equivalents if -x option used. X */ Xvoid print_chars(void) X{ X int i,j,k; X X print_extra_rasters(); X if (opt_e == FALSE) { X if (char_count > 0) { X fprintf(ofile,"\n"); X if (char_count <= CHAR_START_LEN + CHAR_END_LEN) { X /* Only print (some of the) start characters */ X begin_or_end = TRUE; X for (i=0; i<char_count; i++) { X if (i == char_count-1) { X begin_or_end = TRUE; X } X print_char(char_start[i]); X } X if (opt_x) { X fprintf(ofile,"\n"); X for (i=0; i<char_count; i++) { X j = 0xff & char_start[i]; X output_byte(j); X fprintf(ofile," "); X } X } X } X else { X /* "End" array did "wrap around" */ X /* Move the "end" characters to end of "start" array */ X j = k = (char_count - CHAR_START_LEN) % CHAR_END_LEN; X for (i=CHAR_START_LEN; k<CHAR_END_LEN; i++, k++) { X char_start[i] = char_end[k]; X } X for (k=0; k<j; i++, k++) { X char_start[i] = char_end[k]; X } X begin_or_end = TRUE; X /* Print the first set */ X for (i=0; i<CHAR_START_LEN; i++) { X if (i == CHAR_START_LEN-1) { X begin_or_end = TRUE; X } X print_char(char_start[i]); X } X fprintf(ofile," ... "); X begin_or_end = TRUE; X /* Print the second set */ X for (i=CHAR_START_LEN; i<CHAR_START_LEN+CHAR_END_LEN; i++) { X if (i == CHAR_START_LEN+CHAR_END_LEN-1) { X begin_or_end = TRUE; X } X print_char(char_start[i]); X } X if (opt_x) { X fprintf(ofile,"\n"); X for (i=0; i<CHAR_START_LEN; i++) { X j = 0xff & char_start[i]; X output_byte(j); X fprintf(ofile," "); X } X fprintf(ofile," ... "); X for (i=CHAR_START_LEN; i<CHAR_START_LEN+CHAR_END_LEN; i++) { X j = 0xff & char_start[i]; X output_byte(j); X fprintf(ofile," "); X } X } X } X fprintf(ofile,"\n"); X if (num_lines > 0) { X indent(1); X fprintf(ofile,"Added %d more lines.\n", num_lines); X } X } X } X num_lines = char_count = 0; X} END_OF_FILE if test 10124 -ne `wc -c <'utils.c'`; then echo shar: \"'utils.c'\" unpacked with wrong size! fi # end of 'utils.c' fi echo shar: End of archive 1 \(of 2\). cp /dev/null ark1isdone MISSING="" for I in 1 2 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked both archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>. Mail comments to the moderator at <amiga-request@uunet.uu.net>. Post requests for sources, and general discussion to comp.sys.amiga.