#include #include #define CTRLC 3 /*^C*/ #define CTRLD 4 /*^D*/ #define BS 8 /*^H*/ #define TAB 9 /*^I*/ #define CTRLJ 10 /*^J*/ #define CTRLL 12 /*^L*/ #define CTRLN 14 /*^N*/ #define CTRLO 15 /*^O*/ #define CTRLS 19 /*^S*/ #define CTRLX 24 /*^X*/ #define CTRLY 25 /*^Y*/ #define ESC 27 /**/ #define CTLCRT 30 /*^^*/ #define OUTNAME "laser.ps" /*defined output filename (LaserWriterPlus)*/ #define TOP 732 /*Top of page in points*/ #define LINEMAX 86 /*Maximum number of 1/2 lines on page*/ #define NLW 0.17 /*Normal line width in pts*/ #define BLW 1.0 /*Bold line width in pts*/ int $$narg = 1; /*Only command name in command line*/ FILE *filein, *fileout; /*Pointers to input and output files (handles)*/ char inname[40], line[255], outchar; /*Name of input file, input line, output char*/ int i,j; /*counters i = line[] counter, j = char in new line*/ int lastj; /*if last character in line = ^J, lastj = 1*/ int bold; /*Bold type or not 1 = True*/ int alt; /*Alternate set 1 = True*/ int underline; /*Underline 1 = True*/ int ital; /*Italics font, 1 = True*/ int boil; /*Bold and italics, 1 = True*/ int left = 72; /*1" left margin, 72 pts/inch*/ int lineno,eqn; /*lineno = actual line number * 2, *eqn = 1 if in eqn mode*/ int page; /*current page*/ main() { /** Change inname into a fixed logical name for VAX **/ /* printf("Input file name: "); /*Prompt for the input file name*/ /* scanf("%s",inname); /*actually read the file name*/ *strcpy(inname,"laserinp"); filein = fopen(inname, "r"); /*Open the input file*/ if (filein == NULL) { /*See if the filename exists*/ printf("Invalid file %s\n",inname); /*Leave the program if input no good*/ exit(); /*Call standard exit with no status*/ } printf("\n"); /*one extra line*/ page = 1; /*We start at page 1*/ printf("%c[A%c[1;5mPROCESSING%c[m %s page %d\n",ESC,ESC,ESC,inname,page); /*Tell the user we are actually processing the file*/ fileout = fopen(OUTNAME, "w"); /*Open the output file (Device)*/ /*Initialize the Laser writer*/ fprintf(fileout,"%c\n",CTRLD); /*Put a ^D to clear any earlier error*/ fputs("erasepage\n",fileout); /*Erase the page*/ /*Define the fonts used "Normal", "Bold", *"Italics", "Bold-Italics", "Supersub", and *"Alternate" -- all using Courier -- *no proportional spacing*/ fputs("/N {/Courier findfont [9.2 0 0 10.12 0 0] makefont setfont} def\n",fileout); /*Normal*/ fputs("/B {/Courier-Bold findfont [9.2 0 0 10.12 0 0] makefont setfont} def\n",fileout); /*Bold*/ fputs("/I {/Courier-Oblique findfont [9.2 0 0 10.12 0 0] makefont setfont} def\n",fileout); /*Italics*/ fputs("/L {/Courier-BoldOblique findfont [9.2 0 0 10.12 0 0] makefont setfont} def\n",fileout); /*Bold+Italics*/ fputs("/A {/Symbol findfont [9.2 0 0 10.12 0 0] makefont setfont} def\n",fileout); /*Alternate -- Symbols*/ fputs("/S {/Courier findfont 6.3 scalefont setfont} def\n",fileout); /*SuperSub -- 7pt characters for super-, sub-script numbers*/ fprintf(fileout,"%f setlinewidth\n",NLW); /*Tell LW normal linewidth*/ fputs("N\n",fileout); /*Tell LW we start in Normal set*/ fputs("90 rotate -40 -792 translate\n",fileout); /*change portrayal to landscape style */ bold = 0; /*We will start in normal type -- flag*/ alt = 0; /*We will not be in Alternate -- flag*/ ital = 0; /*We will not be in Italics -- flag*/ boil = 0; /*We will not be in bold italics -- flag*/ underline = 0; /*We will not be underlining -- flag*/ eqn = 0; /*We will start in normal mode - not eqn mode -- flag*/ lineno = 2; /*start at first line of page (2 lineno = 1 6 line/inch lines*/ lastj = 0; /*last character <> ^J*/ while (fgets(line,sizeof(line),filein) != NULL) { /*Get line until no more*/ if (lastj != 1) { /*last character not control-J*/ j = 0; /*start at 0 character output to LW*/ fprintf(fileout,"%d %d moveto\n",left,TOP-lineno*6); /*move to SOL*/ } /*end if (lastj != 1)*/ else lastj = 0; /*reset last j flag*/ fputs("(",fileout); /*Write the opening "(" to the output file*/ i = 0; /*reset counter for input line*/ while (line[i] != '\0') { /*process the line until end of line (string)*/ ++j; /*increment output character counter one*/ if( j > 124 ) {fprintf(fileout,"%c\n",'\\'); j=1;} switch(line[i]) { /*look for special things*/ case CTRLC : if (alt == 0) { /*if in normal set*/ ++j; /*we put 2 characters so increment j again*/ if (underline == 1) /*if underlined*/ fputs("__) show\n-12 0 rmoveto\n(",fileout); fputs("^C",fileout); /*put its ascii description*/ } else { if (underline == 1) /*if underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it -- Alternate*/ } break; /*leave special character switch*/ case CTRLD : if (alt == 0) { /*if in normal set*/ ++j; /*we put 2 characters so increment j again*/ if (underline == 1) /*if underlined*/ fputs("__) show\n-12 0 rmoveto\n(",fileout); fputs("^D",fileout); /*put its ascii description*/ } else { if (underline == 1) /*if underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it -- Alternate*/ } break; /*leave special character switch*/ case BS : if (alt == 0) { /*not alt'ed*/ fputs(") show\n-6 0 rmoveto\n(",fileout); /*Backspace*/ j = j - 2; /*Backspace decrements output character counter*/ } else { /*process as Alternate character set*/ if (underline == 1) /*if underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it*/ } break; /*leave special character switch*/ case TAB : if (alt == 0) { /*if normal*/ j = 8 * ((j - 1) / 8) + 9; /*calculate next tab stop*/ if (underline == 1) { /*if underlined*/ if ((bold == 1) || (boil == 1)) { /*Bold or BoldItal*/ fprintf(fileout,") show\n0 -3 rmoveto\n%d %d lineto\n",(6 * j + 72),(TOP - lineno * 6) - 3); fprintf(fileout,"stroke\n%d %d moveto\n(",(6 * j + 72),TOP - lineno * 6); /*line to next tab position*/ } else { /*not bold or boldital*/ fprintf(fileout,") show\n0 -3.2 rmoveto\n%d %8.3f lineto\n",(6 * j + 72),(TOP - lineno * 6) - 3.2); fprintf(fileout,"stroke\n%d %d moveto\n(",(6 * j + 72),TOP - lineno * 6); /*line to next tab position*/ } } else fprintf(fileout,") show\n%d %d moveto\n(",(6 * j + 72),TOP - lineno * 6); /*move to next tab position*/ } /*end if normal*/ else { /*treat it as an Alternate Character*/ if (underline == 1) fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); } /*end else*/ break; /*leave special character switch*/ case CTRLJ : if (alt == 1) { /*CTRLJ*/ lastj = 1; /*last character is ^J*/ if (underline == 1) /*if underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); } else /*else we have to decrement j as we don't do anything*/ --j; /*we put 0 characters so decrement j*/ break; /*leave special character switch*/ case CTRLL : if (alt == 0) { /*Formfeed*/ lineno = 2; /*reset line #*/ newpage(0); /*call newpage with arg = 0*/ j = 0; /*reset output character counter (new line)*/ fprintf(fileout,"%d %d moveto\n(",left,TOP-lineno*6); /*goto top of page*/ } else { /*a special character*/ if (underline == 1) /*if underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it as a special character*/ } break; /*leave special character switch*/ case CTRLO : alt = 0; /*Reset to standard character set*/ --j; /*we put 0 characters so decrement j*/ if (bold == 1) /*go back to bold set*/ fputs(") show\nB\n(",fileout); else if (ital == 1) /*go back to ital*/ fputs(") show\nI\n(",fileout); else if (boil == 1) /*go back to bold+ital*/ fputs(") show\nL\n(",fileout); else /*go back to normal set*/ fputs(") show\nN\n(",fileout); break; /*leave special character switch*/ case CTRLN : if (alt == 0) { /*not alt yet*/ --j; /*we put 0 characters so decrement j*/ alt = 1; /*Start alternate character set*/ fputs(") show\nA\n(",fileout); } else { /*treat as alt'ed*/ if (underline == 1) fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); } break; /*leave special character switch*/ case CTRLS : if (alt == 0) { /*normal set*/ ++j; /*we put 2 characters so increment j again*/ if (underline == 1) /*underlined*/ fputs("__) show\n-12 0 rmoveto\n(",fileout); fputs("^S",fileout); /*put its ascii description*/ } else { /*treat as alt'ed*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it -- alternate*/ } break; /*leave special character switch*/ case CTRLY : ++i; /*next character is special, increment counter*/ if (line[i] == ESC) { /*special escape sequence*/ ++i; /*look at next character*/ if(line[i] == 'Y') {{ /*ESCY -- cent sign*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); fputs(") show\nN\n(\\242) show\n",fileout); } if (bold == 1) /*return to bold set*/ fputs("B\n(",fileout); else if (ital == 1) /*return to ital*/ fputs("I\n(",fileout); else if (boil == 1) /*go back to bold+ital*/ fputs(") show\nL\n(",fileout); else fputs("(",fileout); /*continue with output*/ } else if(line[i] == 'Z') {{ /*ESCZ -- accent grave*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); fputs(") show\nN\n(\\302) show\n",fileout); } if (bold == 1) /*return to bold set*/ fputs("B\n(",fileout); else if (ital == 1) /*return to ital*/ fputs("I\n(",fileout); else if (boil == 1) /*go back to bold+ital*/ fputs(") show\nL\n(",fileout); else fputs("(",fileout); /*continue with output*/ } else { /*not special escape sequence*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(0,line[i]); /*do a normal map*/ } } else { /*This is a 1 character special character*/ if (line[i] == CTRLJ) lastj = 1; fputs(") show\nA\n(",fileout); /*change to Alt*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); map(1,line[i]); /*map it*/ if (bold == 1) /*if bold*/ fputs(") show\nB\n(",fileout); /*back to bold*/ else if (ital == 1) /*if ital*/ fputs(") show\nI\n(",fileout); /*back to ital*/ else if (boil == 1) /*go back to bold+ital*/ fputs(") show\nL\n(",fileout); else fputs(") show\nN\n(",fileout); /*back to normal*/ } break; /*leave special character switch*/ case ESC : ++i; /*An escape sequence*/ --j; /*we put 0 characters so decrement j*/ switch(line[i]) { case CTLCRT : ++i; /*look at next character*/ if (line[i] == 5) /*begin eqn*/ eqn = 1; /*set eqn flag*/ else if (line[i] == 9) /*end eqn*/ eqn = 0; /*reset eqn flag*/ break; /*leave esc switch*/ case '&' : if (bold == 1 || boil == 1){ /*end bold*/ fprintf(fileout,") show\n%f setlinewidth\n(",NLW); /*make normal linewidth*/ if (boil == 1){ /*back to ital*/ fputs(") show\nI\n(",fileout); ital = 1; boil = 0; } else {/*back to normal*/ bold = 0; fputs(") show\nN\n(",fileout); /*finish string and change to normal*/ } } break; /*leave esc switch*/ case 'C' : ital = 0; /*End Italics*/ if (boil == 1){ /*back to bold*/ fputs(") show\nB\n(",fileout); /*finish string and change to bold*/ bold = 1; boil = 0; } else fputs(") show\nN\n(",fileout); /*finish string and change to normal*/ break; /*leave esc switch*/ case 'D' : if (eqn == 0) /*not equation mode*/ fputs(") show\n0 6 rmoveto\n(",fileout); /*-1/2 line feed*/ else /*equation mode*/ fputs(") show\n0 3 rmoveto\n(",fileout); /*-1/2 line feed*/ break; /*leave esc switch*/ case 'E' : underline = 1; /*Underline*/ break; /*leave esc switch*/ case 'R' : underline = 0; /*Stop underline*/ break; /*leave esc switch*/ case 'U' : if (eqn == 0) /*not equation mode*/ fputs(") show\n0 -6 rmoveto\n(",fileout); /*+1/2 line feed*/ else /*equation mode*/ fputs(") show\n0 -3 rmoveto\n(",fileout); /*+1/2 line feed*/ break; /*leave esc switch*/ case 'W' : fprintf(fileout,") show\n%f setlinewidth\n(",BLW); /*make bold linewidth*/ if (ital == 1){ boil = 1; /*begin bold+ital*/ fputs(") show\nL\n(",fileout); /*finish string and change to bold+ital*/ ital = 0; } else { bold = 1; /*begin bold*/ fputs(") show\nB\n(",fileout); /*finish string and change to bold*/ } break; /*leave esc switch*/ case 'X' : if (bold == 1){ boil = 1; /*begin bold+ital*/ fputs(") show\nL\n(",fileout); /*finish string and change to bold+ital*/ bold = 0; } else { ital = 1; /*Begin Italics*/ fputs(") show\nI\n(",fileout); /*finish string and change to italics*/ } break; /*leave esc switch*/ case 'Y' : /*ESCY*/ ++j; /*a character*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); /*underline the character*/ fputs(") show\nN\n(",fileout); /*Norm*/ fputs("\\242) show\n",fileout); /*map it*/ if (alt == 1) fputs("A\n(",fileout); /*Alt*/ else { /*std*/ if (bold == 1) fputs("B\n(",fileout); /*bold*/ else if (ital == 1) /*ital*/ fputs("I\n(",fileout); /*back to italics*/ else if (boil == 1) /*bold+ital*/ fputs("L\n(",fileout); /*back to bold+italics*/ else fputs("N\n(",fileout); /*back to normal*/ } break; /*leave esc switch*/ case 'Z' : /*ESCZ*/ ++j; /*a character*/ if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); /*underline it*/ fputs(") show\nN\n(",fileout); /*Norm*/ fputs("\\302) show\n",fileout); /*map it*/ if (alt == 1) fputs("A\n(",fileout); /*Alt*/ else { /*std*/ if (bold == 1) fputs("B\n(",fileout); /*bold*/ else if (ital == 1) /*ital*/ fputs("I\n(",fileout); /*back to italics*/ else if (boil == 1) /*bold+ital*/ fputs("L\n(",fileout); /*back to bold+italics*/ else fputs("N\n(",fileout); /*back to normal*/ } break; /*leave esc switch*/ default : if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); if (alt == 0) /*normal set*/ map(0,line[i]); /*map it normal*/ else /*Alternate set*/ map(1,line[i]); /*map it alternate*/ break; /*leave esc switch*/ } break; /*leave special character switch*/ case '(' : if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); if (alt == 0) /*if normal*/ fputs("\\(",fileout); /*Open paren*/ else /*if alt'ed*/ map(1,line[i]); break; /*leave special character switch*/ case ')' : if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); if (alt == 0) /*if normal*/ fputs("\\)",fileout); /*Close paren*/ else /*if alt'ed*/ map(1,line[i]); break; /*leave special character switch*/ case '\\' : if (underline == 1) /*underlined*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); if (alt == 0) /*if normal*/ fputs("\\\\",fileout); /*Backslash*/ else map(1,line[i]); break; /*leave special character switch*/ default : if (line[i] != '\n') { /*not end of line yet*/ if (underline == 1) /*underlining*/ fputs("_) show\n-6 0 rmoveto\n(",fileout); if (alt == 0) /*not alt'ed*/ map(0,line[i]); else /*alt'ed*/ map(1,line[i]); } break; /*leave special character switch*/ } /*end switch*/ ++i; /*and increment the counter*/ } /*end while not EOL*/ fputs(") show\n",fileout); /*Finish the line*/ if (lastj != 1) { /*last character in line, not ^J*/ if (eqn == 1) /*eqn mode*/ lineno = lineno + 1; /*increment line counter 1/2 line*/ else /*not eqn*/ lineno = lineno + 2; /*increment line counter 1 full line*/ } if (lineno >= LINEMAX) { /*newpage by count*/ lineno = 2; /*reset line to top of page*/ newpage(1); /*call newpage by lines*/ } if (bold == 1 && alt == 0 && lastj == 0) { /*if bold && not alt'ed && not ^J*/ bold = 0; /*Reset bold at end of line (as per Diablo)*/ fprintf(fileout,"%f setlinewidth\n",NLW); /*make normal linewidth*/ fputs("N\n",fileout); /*change to normal set*/ } if (boil == 1 && alt == 0 && lastj == 0) { /*if bold italics && not alt'ed && not ^J*/ ital = 1; boil = 0; /*Reset bold at end of line (as per Diablo)*/ fprintf(fileout,"%f setlinewidth\n",NLW); /*make normal linewidth*/ fputs("I\n",fileout); /*change to italics*/ } } /*end reading of file while*/ fputs("copypage erasepage\n",fileout); /*Print the last page and erase all settings*/ fprintf(fileout,"%c\n",CTRLD); /*put the ^D to tell LW that all data has been transmitted*/ fflush(fileout); /*make sure that all i/o has been completed (necessary when talking to a device)*/ fclose(filein); /*Close the input file*/ fclose(fileout); /*Close the output file*/ printf("%c[A%c[KDONE PROCESSING %s, %d page(s).\n",ESC,ESC,inname,page); /*clear the line telling the user that we are processing*/ } newpage(temp) /*subroutine newpage -- temp = flag; 0 ==> ^L, 1 ==> line count*/ int temp; /*the flag from the subroutine call*/ { if (temp == 0) /*if by ^L*/ fputs(") show\n",fileout); /*finish the line and show it before printing the page*/ fputs("copypage erasepage\n",fileout); /*print the page and erase the data*/ ++page; /*increment page counter*/ printf("%c[A%c[1;5mPROCESSING%c[m %s page %d\n",ESC,ESC,ESC,inname,page); /*tell the user we are processing the next page *note use of the same line as the last message*/ } /*end subroutine newpage*/ map(type,inchar) /*map the character (actually put the character or build string to the output device)*/ int type; /*type = 0 ==> normal, = 1 ==> special(alternate)*/ char *inchar; /*the character to be processed*/ { extern FILE *fileout; /*the pointer to the output file defined earlier*/ char *bstring; /*the string with the built character*/ if (type != 0) { /*we have an alt'ed character*/ if (*inchar < 16) { /*look at the first 15 characters*/ switch (*inchar) { case 1 : bstring = "\\254)show"; /*left arrow*/ break; /*leave 1-15 switch*/ case 2 : bstring = "\\256)show"; /*right arrow*/ break; /*leave 1-15 switch*/ case 3 : bstring = "\\255)show"; /*up arrow*/ break; /*leave 1-15 switch*/ case 4 : bstring = "\\257)show"; /*down arrow*/ break; /*leave 1-15 switch*/ case 5 : bstring = "\\304)show"; /*circle with X*/ break; /*leave 1-15 switch*/ case 6 : bstring = ") show\nN\n(\\250) show"; /*box*/ break; /*leave 1-15 switch*/ case 7 : bstring = ") show\nN\n(\\310) show"; /*umlaut*/ break; /*leave 1-15 switch*/ case 8 : bstring = ") show\nN\n(\\266) show"; /*paragraph symbol*/ break; /*leave 1-15 switch*/ case 9 : bstring = ") show\nN\n(\\262) show"; /*cross symbol*/ break; /*leave 1-15 switch*/ case 10 : bstring = ") show\nN\n(\\243) show"; /*British pound symbol*/ break; /*leave 1-15 switch*/ case 11 : bstring = "\\363) show"; /*top of large integral*/ break; /*leave 1-15 switch*/ case 12 : bstring = "\\365) show"; /*bottom of large integral*/ break; /*leave 1-15 switch*/ case 13 : bstring = "\\260) show"; /*raised small circle*/ break; /*leave 1-15 switch*/ case 14 : bstring = ") show\nN\n(\\101) show\n-5 0 rmoveto\nA\n(\\260) show"; /*angstrom symbol*/ break; /*leave 1-15 switch*/ default : bstring = ") show\nN\n(\\040) show"; /*all undefined characters are changed to space*/ break; /*leave 1-15 switch*/ } /*end 1-15 switch)*/ } /*end if (*inchar < 16)*/ else if (*inchar < 32) { /*16 <= inchar < 32)*/ switch(*inchar) { case 16 : bstring = "\\271) show"; /*not equal*/ break; /*leave 16-31 switch*/ case 17 : bstring = "\\265) show"; /*proportional to*/ break; /*leave 16-31 switch*/ case 18 : bstring = "\\266) show"; /*partial derivative del sign*/ break; /*leave 16-31 switch*/ default : bstring = ") show\nN\n(\\040) show"; /*all undefined characters are changed to space*/ break; /*leave 16-31 switch*/ } } else if (*inchar < 48) { /*32 <= inchar < 48)*/ switch(*inchar) { case 32 : bstring = ") show\nN\n(\\040) show"; /*normal space*/ break; /*leave 32-47 switch*/ case 33 : bstring = "\\101) show"; /*Alpha*/ break; /*leave 32-47 switch*/ case 34 : bstring = "\\102) show"; /*Beta*/ break; /*leave 32-47 switch*/ case 35 : bstring = "\\107) show"; /*Gamma*/ break; /*leave 32-47 switch*/ case 36 : bstring = "\\104) show"; /*Delta*/ break; /*leave 32-47 switch*/ case 37 : bstring = "\\105) show"; /*Epsilon*/ break; /*leave 32-47 switch*/ case 38 : bstring = "\\132) show"; /*Zeta*/ break; /*leave 32-47 switch*/ case 39 : bstring = "\\110) show"; /*Eta*/ break; /*leave 32-47 switch*/ case 40 : bstring = "\\121) show"; /*Theta*/ break; /*leave 32-47 switch*/ case 41 : bstring = "\\111) show"; /*Iota*/ break; /*leave 32-47 switch*/ case 42 : bstring = "\\113) show"; /*Kappa*/ break; /*leave 32-47 switch*/ case 43 : bstring = "\\114) show"; /*Lambda*/ break; /*leave 32-47 switch*/ case 44 : bstring = "\\115) show"; /*Mu*/ break; /*leave 32-47 switch*/ case 45 : bstring = "\\116) show"; /*Nu*/ break; /*leave 32-47 switch*/ case 46 : bstring = "\\130) show"; /*Xi*/ break; /*leave 32-47 switch*/ case 47 : bstring = "\\117) show"; /*Omicron*/ break; /*leave 32-47 switch*/ } /*end 32-47 switch*/ } /*end if(inchar < 48)*/ else if (*inchar < 64) { /*48 <= inchar < 64)*/ switch(*inchar) { case 48 : bstring = "\\120) show"; /*Pi*/ break; /*leave 48-63 switch*/ case 49 : bstring = "\\122) show"; /*Rho*/ break; /*leave 48-63 switch*/ case 50 : bstring = "\\123) show"; /*Sigma*/ break; /*leave 48-63 switch*/ case 51 : bstring = "\\124) show"; /*Tau*/ break; /*leave 48-63 switch*/ case 52 : bstring = "\\125) show"; /*Upsilon*/ break; /*leave 48-63 switch*/ case 53 : bstring = "\\106) show"; /*Phi*/ break; /*leave 48-63 switch*/ case 54 : bstring = "\\103) show"; /*Chi*/ break; /*leave 48-63 switch*/ case 55 : bstring = "\\131) show"; /*Psi*/ break; /*leave 48-63 switch*/ case 56 : bstring = "\\127) show"; /*Omega*/ break; /*leave 48-63 switch*/ case 57 : bstring = "\\345) show"; /*Large Sigma (Summation)*/ break; /*leave 48-63 switch*/ case 58 : bstring = "\\321) show"; /*grad sign*/ break; /*leave 48-63 switch*/ case 59 : bstring = ") show\n0 -6 rmoveto\n(\\350) show\n-4 12 rmoveto\n(\\346) show\n2 -6 rmoveto"; /*large left paren*/ break; /*leave 48-63 switch*/ case 60 : bstring = ") show\n0 -6 rmoveto\n(\\370) show\n-3.9 12 rmoveto\n(\\366) show\n2 -6 rmoveto"; /*large right paren*/ break; /*leave 48-63 switch*/ case 61 : bstring = ") show\n0 -5 rmoveto\n(\\353) show\n-3.9 10 rmoveto\n(\\351) show\n2 -5 rmoveto"; /*large left braket*/ break; /*leave 48-63 switch*/ case 62 : bstring = ") show\n0 -5 rmoveto\n(\\373) show\n-3.9 10 rmoveto\n(\\371) show\n2 -5 rmoveto"; /*large right braket*/ break; /*leave 48-63 switch*/ case 63 : bstring = "\\362) show"; /*integral*/ break; /*leave 48-63 switch*/ } /*end 48-63 switch*/ } /*end if(inchar < 64)*/ else if (*inchar < 80) { /*64 <= inchar < 80*/ switch(*inchar) { case 64 : bstring = ") show\nN\n(\\040) show"; /*script e*/ break; /*script e not available at this time*/ /*leave 64-79 switch*/ case 65 : bstring = "\\141) show"; /*alpha*/ break; /*leave 64-79 switch*/ case 66 : bstring = "\\142) show"; /*beta*/ break; /*leave 64-79 switch*/ case 67 : bstring = "\\147) show"; /*gamma*/ break; /*leave 64-79 switch*/ case 68 : bstring = "\\144) show"; /*delta*/ break; /*leave 64-79 switch*/ case 69 : bstring = "\\145) show"; /*epsilon*/ break; /*leave 64-79 switch*/ case 70 : bstring = "\\172) show"; /*zeta*/ break; /*leave 64-79 switch*/ case 71 : bstring = "\\150) show"; /*eta*/ break; /*leave 64-79 switch*/ case 72 : bstring = "\\161) show"; /*theta*/ break; /*leave 64-79 switch*/ case 73 : bstring = "\\151) show"; /*iota*/ break; /*leave 64-79 switch*/ case 74 : bstring = "\\153) show"; /*kappa*/ break; /*leave 64-79 switch*/ case 75 : bstring = "\\154) show"; /*lambda*/ break; /*leave 64-79 switch*/ case 76 : bstring = "\\155) show"; /*mu*/ break; /*leave 64-79 switch*/ case 77 : bstring = "\\165) show"; /*nu*/ break; /*leave 64-79 switch*/ case 78 : bstring = "\\170) show"; /*xi*/ break; /*leave 64-79 switch*/ case 79 : bstring = "\\157) show"; /*omicron*/ break; /*leave 64-79 switch*/ } /*end 64-79 switch*/ } /*end if(inchar < 80)*/ if (*inchar < 96) { /*80 <= inchar < 96*/ switch(*inchar) { case 80 : bstring = "\\160) show"; /*pi*/ break; /*leave 80-95 switch*/ case 81 : bstring = "\\162) show"; /*rho*/ break; /*leave 80-95 switch*/ case 82 : bstring = "\\163) show"; /*sigma*/ break; /*leave 80-95 switch*/ case 83 : bstring = "\\164) show"; /*tau*/ break; /*leave 80-95 switch*/ case 84 : bstring = "\\156) show"; /*upsilon*/ break; /*leave 80-95 switch*/ case 85 : bstring = "\\146) show"; /*phi*/ break; /*leave 80-95 switch*/ case 86 : bstring = "\\143) show"; /*chi*/ break; /*leave 80-95 switch*/ case 87 : bstring = "\\171) show"; /*psi*/ break; /*leave 80-95 switch*/ case 88 : bstring = "\\167) show"; /*omega*/ break; /*leave 80-95 switch*/ case 89 : bstring = ") show\nN\n( ) show"; /*script l*/ break; /*script l not available at this time*/ /*leave 80-95 switch*/ case 90 : bstring = "\\267) show"; /*centered dot (large, filled in)*/ break; /*leave 80-95 switch*/ case 91 : bstring = "\\326) show"; /*radical*/ break; /*leave 80-95 switch*/ case 92 : bstring = "\\355) show\n-5 8 rmoveto\n(\\354) show\n-4.9 -16 rmoveto\n(\\356) show\n2 8 rmoveto"; /*large right brace*/ break; /*leave 80-95 switch*/ case 93 : bstring = "\\375) show\n-5 8 rmoveto\n(\\374) show\n-5 -16 rmoveto\n(\\376) show\n2 8 rmoveto"; /*large left brace*/ break; /*leave 80-95 switch*/ case 94 : bstring = "\\327) show\n3 0 rmoveto"; /*centered dot (small)*/ break; /*leave 80-95 switch*/ case 95 : bstring = "\\244) show"; /*fraction bar (diagonal, smaller than slash)*/ break; /*leave 80-95 switch*/ } /*end 80-95 switch*/ } /*end if (inchar < 96)*/ else if (*inchar < 112) { /*96 <= inchar < 112)*/ switch(*inchar) { case 96 : bstring = ") show\nS\n0 -4 rmoveto\n(\\060) show\n0 4 rmoveto"; /*sub 0*/ break; /*leave 96-111 siwtch*/ case 97 : bstring = ") show\nS\n0 -4 rmoveto\n(\\061) show\n0 4 rmoveto"; /*sub 1*/ break; /*leave 96-111 siwtch*/ case 98 : bstring = ") show\nS\n0 -4 rmoveto\n(\\062) show\n0 4 rmoveto"; /*sub 2*/ break; /*leave 96-111 siwtch*/ case 99 : bstring = ") show\nS\n0 -4 rmoveto\n(\\063) show\n0 4 rmoveto"; /*sub 3*/ break; /*leave 96-111 siwtch*/ case 100 : bstring = ") show\nS\n0 -4 rmoveto\n(\\064) show\n0 4 rmoveto"; /*sub 4*/ break; /*leave 96-111 siwtch*/ case 101 : bstring = ") show\nS\n0 -4 rmoveto\n(\\065) show\n0 4 rmoveto"; /*sub 5*/ break; /*leave 96-111 siwtch*/ case 102 : bstring = ") show\nS\n0 -4 rmoveto\n(\\066) show\n0 4 rmoveto"; /*sub 6*/ break; /*leave 96-111 siwtch*/ case 103 : bstring = ") show\nS\n0 -4 rmoveto\n(\\067) show\n0 4 rmoveto"; /*sub 7*/ break; /*leave 96-111 siwtch*/ case 104 : bstring = ") show\nS\n0 -4 rmoveto\n(\\070) show\n0 4 rmoveto"; /*sub 8*/ break; /*leave 96-111 siwtch*/ case 105 : bstring = ") show\nS\n0 -4 rmoveto\n(\\071) show\n0 4 rmoveto"; /*sub 9*/ break; /*leave 96-111 siwtch*/ case 106 : bstring = "\\261) show"; /*plus-minus*/ break; /*leave 96-111 siwtch*/ case 107 : bstring = ") show\nN\n0 12 rmoveto\n(\\137) show\n0 -12 rmoveto"; /*overscore*/ break; /*leave 96-111 siwtch*/ case 108 : bstring = "\\243) show"; /*greater than or equal to*/ break; /*leave 96-111 siwtch*/ case 109 : bstring = "\\263) show"; /*less than or equal to*/ break; /*leave 96-111 siwtch*/ case 110 : bstring = "\\176) show"; /*tilde -- approximately equal to*/ break; /*leave 96-111 siwtch*/ case 111 : bstring = "\\273) show"; /*approximately equal to (double squiggle line)*/ break; /*leave 96-111 siwtch*/ } /*end 96-111 switch*/ } /*end if (inchar < 112)*/ else if (*inchar < 128) { /*112 <= inchar < 128*/ switch(*inchar) { case 112 : bstring = ") show\nS\n0 4 rmoveto\n(\\060) show\n0 -4 rmoveto"; /*super 0*/ break; /*leave 112-127 switch*/ case 113 : bstring = ") show\nS\n0 4 rmoveto\n(\\061) show\n0 -4 rmoveto"; /*super 1*/ break; /*leave 112-127 switch*/ case 114 : bstring = ") show\nS\n0 4 rmoveto\n(\\062) show\n0 -4 rmoveto"; /*super 2*/ break; /*leave 112-127 switch*/ case 115 : bstring = ") show\nS\n0 4 rmoveto\n(\\063) show\n0 -4 rmoveto"; /*super 3*/ break; /*leave 112-127 switch*/ case 116 : bstring = ") show\nS\n0 4 rmoveto\n(\\064) show\n0 -4 rmoveto"; /*super 4*/ break; /*leave 112-127 switch*/ case 117 : bstring = ") show\nS\n0 4 rmoveto\n(\\065) show\n0 -4 rmoveto"; /*super 5*/ break; /*leave 112-127 switch*/ case 118 : bstring = ") show\nS\n0 4 rmoveto\n(\\066) show\n0 -4 rmoveto"; /*super 6*/ break; /*leave 112-127 switch*/ case 119 : bstring = ") show\nS\n0 4 rmoveto\n(\\067) show\n0 -4 rmoveto"; /*super 7*/ break; /*leave 112-127 switch*/ case 120 : bstring = ") show\nS\n0 4 rmoveto\n(\\070) show\n0 -4 rmoveto"; /*super 8*/ break; /*leave 112-127 switch*/ case 121 : bstring = ") show\nS\n0 4 rmoveto\n(\\071) show\n0 -4 rmoveto"; /*super 9*/ break; /*leave 112-127 switch*/ case 122 : bstring = "\\053) show"; /*plus*/ break; /*leave 112-127 switch*/ case 123 : bstring = "\\055) show"; /*minus*/ break; /*leave 112-127 switch*/ case 124 : bstring = "\\264) show"; /*multiply (x)*/ break; /*leave 112-127 switch*/ case 125 : bstring = "\\270) show"; /*divided by*/ break; /*leave 112-127 switch*/ case 126 : bstring = "\\245) show"; /*infinity*/ break; /*leave 112-127 switch*/ } /*end 112-127 switch*/ } /*end if (inchar < 127)*/ } /*end if (type != 0)*/ if (type == 0) /*We have normal type*/ fprintf(fileout,"%c",inchar); /*put the character to the output file*/ else /*Alternate mapped character (built) type*/ fprintf(fileout,"%s\nA\n(",bstring); /*print the build string and go to alt set again*/ } /*end subroutine map*/