home *** CD-ROM | disk | FTP | other *** search
- /***( flush.c )*****************************************************************
- * *
- * Written: Brent Faulkner - June 19, 1989 *
- * Updated: Brent Faulkner - June 19, 1989 *
- * *
- ********************************************************************************
- * *
- * Contents: flushprt() - flush the buffers to the printer *
- * outlen() - return output length of line *
- * *
- *******************************************************************************/
- #include <stdio.h>
- #include <bench.h>
- #include "prt.h"
-
- #ifdef ANSI
- static int do_attr(int, int);
- static int outlen(char *, int);
- static void flush1(void);
- static void flush2(void);
- static void ps_attr(int, int);
- static void ps_comment(char *, ...);
- static void ps_line(char *, ...);
- #else
- static int do_attr();
- static int outlen();
- static void flush1();
- static void flush2();
- static void ps_attr();
- static void ps_comment();
- static void ps_line();
- #endif
-
- #define ps_skip() fputs("\015\012", devfp)
-
- /*
- * Flush the page buffers to the printer device
- */
- void flushprt()
- {
- if (prtdef[POSTSCRIPT] == NULL)
- flush1(); /* standard (non-postscript) printer */
- else
- flush2(); /* postscript printer */
- }
-
- static void flush1()
- {
- int i;
- register int j;
- int oldattr = P_DUMMY;
-
- /* for each line */
- for(i = 0; i < (unsigned char)*prtdef[NUM_LINES]; i++)
- {
- /* for each column */
- for(j = 0; j < outlen(pagebuff[i], (unsigned char)*prtdef[NUM_COLS]); j++)
- {
- /* change attribute if required */
- oldattr = do_attr(oldattr, attrbuff[i][j]);
- /* do underline if it isn't defined but BS is */
- if((attrbuff[i][j] & P_UNDER) && prtdef[UNDER_ON] == NULL)
- {
- if (prtdef[BS] != NULL)
- {
- fputc('_', devfp);
- emit_seq(BS);
- }
- }
- /* overstrike for BOLD if it isn't defined but BS is */
- if((attrbuff[i][j] & P_BOLD) && prtdef[BOLD_ON] == NULL)
- {
- if (prtdef[BS] != NULL && pagebuff[i][j] != '\0')
- {
- fputc(pagebuff[i][j], devfp);
- emit_seq(BS);
- }
- }
- /* overstrike for LQ if it isn't defined but BS is */
- if((attrbuff[i][j] & P_LQ) && prtdef[LQ_ON] == NULL)
- {
- if(pagebuff[i][j] != '\0')
- {
- fputc(pagebuff[i][j], devfp);
- emit_seq(BS);
- }
- }
-
- /* output character */
- if(pagebuff[i][j] == '\0')
- fputc(' ', devfp);
- else
- fputc(pagebuff[i][j], devfp);
- }
- if (prtdef[ATTR_REFRESH] != NULL)
- {
- do_attr(oldattr, P_DUMMY);
- oldattr = P_DUMMY;
- }
- emit_seq(LINEFEED); /* do the line feed */
- }
- if (prtdef[ATTR_REFRESH] == NULL)
- do_attr(oldattr, P_DUMMY);
- }
-
- /*
- * Return the output length of a line
- * ie. the number of characters on a line not counting trailing spaces
- * or \0's
- */
- static int outlen(outstr, outsiz)
- char *outstr;
- int outsiz;
- {
- register int i;
-
- for(i = outsiz; i > 0; i--)
- if(outstr[i - 1] != '\0' && outstr[i - 1] != ' ')
- break;
-
- return(i);
- }
-
- /*
- * Output any sequences for a change in attributes
- */
- static int do_attr(oatt, natt)
- int oatt;
- int natt;
- {
- int i;
- register int tbit;
- int tatt;
-
- tatt = natt ^ oatt; /* find any changed attributes */
- /* for each changed attribute turn off if on and on if off */
- for(i = 0; i < 16; i++)
- {
- tbit = 1 << i;
- if(tatt & tbit)
- {
- switch(tbit)
- {
- case P_ITALIC: /* 0x0001 */
- if (natt & P_ITALIC)
- emit_seq(ITALIC_ON);
- else
- emit_seq(ITALIC_OFF);
- break;
- case P_BOLD: /* 0x0002 */
- if (natt & P_BOLD)
- emit_seq(BOLD_ON);
- else
- emit_seq(BOLD_OFF);
- break;
- case P_UNDER: /* 0x0004 */
- if (natt & P_UNDER)
- emit_seq(UNDER_ON);
- else
- emit_seq(UNDER_OFF);
- break;
- case P_LQ: /* 0x0008 */
- if (natt & P_LQ)
- emit_seq(LQ_ON);
- else
- emit_seq(LQ_OFF);
- break;
- case P_PS: /* 0x0010 */
- if (natt & P_PS)
- emit_seq(PS_ON);
- else
- emit_seq(PS_OFF);
- break;
- case P_SUBSCRIPT: /* 0x0020 */
- if (natt & P_SUBSCRIPT)
- emit_seq(SUBSCRIPT_ON);
- else
- emit_seq(SUBSCRIPT_OFF);
- break;
- case P_SUPERSCRIPT: /* 0x0040 */
- if (natt & P_SUPERSCRIPT)
- emit_seq(SUPERSCRIPT_ON);
- else
- emit_seq(SUPERSCRIPT_OFF);
- break;
- case P_DBL_WIDE: /* 0x0080 */
- if (natt & P_DBL_WIDE)
- emit_seq(DBL_WIDE_ON);
- else
- emit_seq(DBL_WIDE_OFF);
- break;
- case P_DBL_HIGH: /* 0x0100 */
- if (natt & P_DBL_HIGH)
- emit_seq(DBL_HIGH_ON);
- else
- emit_seq(DBL_HIGH_OFF);
- break;
- case P_CONDENSED: /* 0x0200 */
- if (natt & P_CONDENSED)
- emit_seq(CONDENSED_ON);
- else
- emit_seq(CONDENSED_OFF);
- break;
- case P_CPI5: /* 0x0400 */
- if (natt & P_CPI5)
- emit_seq(CPI5);
- else
- emit_seq(CPI10);
- break;
- case P_CPI10: /* 0x0800 */
- if (natt & P_CPI10)
- emit_seq(CPI10);
- else
- emit_seq(CPI10);
- break;
- case P_CPI12: /* 0x1000 */
- if (natt & P_CPI12)
- emit_seq(CPI12);
- else
- emit_seq(CPI10);
- break;
- case P_CPI16: /* 0x2000 */
- if (natt & P_CPI16)
- emit_seq(CPI16);
- else
- emit_seq(CPI10);
- break;
- case P_BOX: /* 0x4000 */
- if (natt & P_BOX)
- emit_seq(BOX_ON);
- else
- emit_seq(BOX_OFF);
- break;
- }
- }
- }
- return(natt);
- }
-
- static void flush2()
- {
- int i;
- int j, J;
- register int k;
- unsigned int oldattr = P_DUMMY;
- char LBUFF[512];
- int aflag = 0; /* flag for attribute change */
-
- ps_comment("Beginning of Page"); /* page prefix */
- ps_line("/pg save def");
-
- /* for each line */
- for(i = 0; i < (unsigned char)*prtdef[NUM_LINES]; i++)
- {
- /* calculate line length */
- J = outlen(pagebuff[i], (unsigned char)*prtdef[NUM_COLS]);
- if (J > 0) /* if line has non-zero length do moveto */
- ps_line("18 %d moveto", 756 - i * 12);
- for(j = 0; j < J;) /* for each column */
- {
- memset(LBUFF, '\0', 512); /* zero out line buffer */
- for(k = 0; j < J; j++, k++) /* gather chars with same attribute */
- {
- if (attrbuff[i][j] != oldattr)
- {
- aflag = 1; /* if the attribute changes set the */
- break; /* flag and break out of the loop */
- }
- /* add the char to the line buffer */
- if (pagebuff[i][j] == '\0')
- LBUFF[k] = ' ';
- else
- { /* convert non-printable chars to octal */
- if(pagebuff[i][j] < 0x20 || pagebuff[i][j] > 0x7e)
- {
- int n = pagebuff[i][j];
-
- LBUFF[k] = '\\';
- k++;
- LBUFF[k] = (char)(0x30 + n / 64);
- k++;
- n %= 64;
- LBUFF[k] = (char)(0x30 + n / 8);
- k++;
- n %= 8;
- LBUFF[k] = (char)(0x30 + n);
- }
- else
- {
- if (pagebuff[i][j] == '%')
- {
- LBUFF[k] = '%'; /* do two percents for a percent */
- k++;
- LBUFF[k] = '%';
- }
- else
- LBUFF[k] = pagebuff[i][j];
- }
- }
- }
- if (strlen(LBUFF) > 0)
- {
- if (oldattr & P_DBL_WIDE) /* call any modifying postscript */
- ps_line("dbl-width"); /* functions */
- if (oldattr & P_DBL_HIGH)
- ps_line("dbl-height");
- if (oldattr & P_CONDENSED)
- ps_line("condense");
-
- if (oldattr & P_UNDER) /* output the text using show */
- ps_line("12 (%s) undershow", LBUFF); /* underlined */
- else
- ps_line("(%s) show", LBUFF);
-
- if (oldattr & P_DBL_WIDE) /* call the complimenting */
- ps_line("half-width"); /* postscript function for */
- if (oldattr & P_DBL_HIGH) /* any modifiers */
- ps_line("half-height");
- if (oldattr & P_CONDENSED)
- ps_line("expand");
- }
- if (aflag) /* if an attribute change is */
- { /* do any font changes */
- ps_attr(attrbuff[i][j], oldattr);
- oldattr = attrbuff[i][j];
- aflag = 0;
- }
- }
- }
-
- ps_line("showpage pg restore"); /* end of the page */
- }
-
- static char vpsbuff[512]; /* buffer for varargs functions */
-
- /*
- * Output a postscript comment
- */
- #ifdef ANSI
- static void ps_comment(char *va_alist, ...)
- #else
- static void ps_comment(va_alist)
- va_dcl
- #endif
- {
- va_list ap;
- register char *fmt;
-
- #ifdef ANSI
- va_start(ap, va_alist);
- fmt = va_alist;
- #else
- va_start(ap);
- fmt = va_arg(ap, char *);
- #endif
-
- vsprintf(vpsbuff, fmt, ap);
- va_end(ap);
-
- fprintf(devfp, "%% %s\015\012", vpsbuff);
- }
-
- /*
- * Output a line of postscript (other than a comment or a blank line)
- */
- #ifdef ANSI
- static void ps_line(char *va_alist, ...)
- #else
- static void ps_line(va_alist)
- va_dcl
- #endif
- {
- va_list ap;
- register char *fmt;
-
- #ifdef ANSI
- va_start(ap, va_alist);
- fmt = va_alist;
- #else
- va_start(ap);
- fmt = va_arg(ap, char *);
- #endif
-
- vsprintf(vpsbuff, fmt, ap);
- va_end(ap);
-
- fprintf(devfp, "%s\015\012", vpsbuff);
- }
-
- /*
- * Output any postscript required for a font change
- */
- static void ps_attr(nattr, oattr)
- int nattr;
- int oattr;
- {
- char fontname[40];
- static char lastfont[40];
- int fontsize;
- static int lastsize = 0;
-
- if (nattr & P_BOX) /* get the initial name for a font */
- strcpy(fontname, "LineChars");
- else if (nattr & P_PS)
- strcpy(fontname, "Helvetica");
- else
- strcpy(fontname, "Courier");
-
- if (nattr & P_BOLD) /* modify the font name for BOLD */
- strcat(fontname, "-Bold"); /* or ITALIC */
-
- if (nattr & P_ITALIC && !(nattr & P_BOX))
- {
- if (!(nattr & P_BOLD))
- strcat(fontname, "-");
- strcat(fontname, "Oblique");
- }
-
- if (nattr & P_CPI5) /* set the font size required */
- fontsize = 24;
- else if (nattr & P_CPI12)
- fontsize = 10;
- else if (nattr & P_CPI16)
- fontsize = 8;
- else
- fontsize = 12;
-
- /* only output the change if really required
- * ie. the attribute may change but the font may not
- * such as for condensed, etc.
- */
- if (lastsize != fontsize || strcmp(lastfont, fontname) != 0)
- ps_line("/%s findfont %d scalefont setfont", fontname, fontsize);
- lastsize = fontsize;
- strcpy(lastfont, fontname);
-
- /* do any relative moves required for super/sub scripting */
- if ( ((oattr & P_SUBSCRIPT) && !(nattr & P_SUBSCRIPT)) ||
- (!(oattr & P_SUPERSCRIPT) && (nattr & P_SUPERSCRIPT)) )
- ps_line("0 3 rmoveto");
-
- if ( (!(oattr & P_SUBSCRIPT) && (nattr & P_SUBSCRIPT)) ||
- ((oattr & P_SUPERSCRIPT) && !(nattr & P_SUPERSCRIPT)) )
- ps_line("0 -3 rmoveto");
- }
-
- /*
- * Output the postscript required by all print jobs
- * ie. define the functions for underline, etc. and define the LineChars
- * and LineChars-Bold fonts
- */
- void ps_init()
- {
- ps_comment("!PS-Adobe");
- ps_skip();
- ps_line("/undershow { %% show with underline");
- ps_line(" dup stringwidth pop");
- ps_line(" 3 -1 roll");
- ps_line(" uline");
- ps_line(" show");
- ps_line(" } def");
- ps_skip();
- ps_line("/uline { %% do the underlining");
- ps_line(" /ps exch def");
- ps_line(" gsave");
- ps_line(" currentfont /FontInfo get dup");
- ps_line(" /UnderlinePosition get ps mul 1000 div 0 exch rmoveto exch 0 rlineto");
- ps_line(" /UnderlineThickness get ps mul 1000 div setlinewidth stroke");
- ps_line(" grestore");
- ps_line(" } def");
- ps_skip();
- ps_line("/dbl-height { %% double the y-scale");
- ps_line(" 1 2 scale");
- ps_line(" } def");
- ps_skip();
- ps_line("/half-height { %% half the y-scale");
- ps_line(" 1 .5 scale");
- ps_line(" } def");
- ps_skip();
- ps_line("/dbl-width { %% double the x-scale");
- ps_line(" 2 1 scale");
- ps_line(" } def");
- ps_skip();
- ps_line("/half-width { %% half the x-scale");
- ps_line(" .5 1 scale");
- ps_line(" } def");
- ps_skip();
- ps_line("/condense { %% 2/3 the x-scale");
- ps_line(" 2 3 div 1 scale");
- ps_line(" } def");
- ps_skip();
- ps_line("/expand { %% 3/2 the x-scale");
- ps_line(" 1.5 1 scale");
- ps_line(" } def");
- ps_skip();
- ps_comment("Define the PC line drawing character set (LineChars),");
- ps_comment("and the bold equivalent (LineChars-Bold).");
- ps_comment("");
- ps_comment("The characters are drawn on a 1000 by 1000 square then the x is");
- ps_comment("scaled by .0006 to make it line up with the courier character set.");
- ps_skip();
- ps_line("10 dict dup begin");
- ps_skip();
- ps_line("/FontType 3 def");
- ps_line("/FontMatrix [.0006 0 0 .001 0 0] def");
- ps_line("/FontBBox [0 0 1000 1000] def");
- ps_line("/Encoding 256 array def");
- ps_line("0 1 255 { Encoding exch /.notdef put } for");
- ps_line("Encoding 16#b0 /shade_block put");
- ps_line("Encoding 16#b3 /vertical put");
- ps_line("Encoding 16#b4 /right_tee put");
- ps_line("Encoding 16#b6 /dsright_tee put");
- ps_line("Encoding 16#b5 /sdright_tee put");
- ps_line("Encoding 16#b7 /sdtop_right put");
- ps_line("Encoding 16#b8 /dstop_right put");
- ps_line("Encoding 16#b9 /dright_tee put");
- ps_line("Encoding 16#ba /dvertical put");
- ps_line("Encoding 16#bb /dtop_right put");
- ps_line("Encoding 16#bc /dbot_right put");
- ps_line("Encoding 16#bd /sdbot_right put");
- ps_line("Encoding 16#be /dsbot_right put");
- ps_line("Encoding 16#bf /top_right put");
- ps_line("Encoding 16#c0 /bot_left put");
- ps_line("Encoding 16#c1 /up_tee put");
- ps_line("Encoding 16#c2 /down_tee put");
- ps_line("Encoding 16#c3 /left_tee put");
- ps_line("Encoding 16#c4 /horizontal put");
- ps_line("Encoding 16#c5 /cross put");
- ps_line("Encoding 16#c6 /sdleft_tee put");
- ps_line("Encoding 16#c7 /dsleft_tee put");
- ps_line("Encoding 16#c8 /dbot_left put");
- ps_line("Encoding 16#c9 /dtop_left put");
- ps_line("Encoding 16#ca /dup_tee put");
- ps_line("Encoding 16#cb /ddown_tee put");
- ps_line("Encoding 16#cc /dleft_tee put");
- ps_line("Encoding 16#cd /dhorizontal put");
- ps_line("Encoding 16#ce /dcross put");
- ps_line("Encoding 16#cf /dsup_tee put");
- ps_line("Encoding 16#d0 /sdup_tee put");
- ps_line("Encoding 16#d1 /dsdown_tee put");
- ps_line("Encoding 16#d2 /sddown_tee put");
- ps_line("Encoding 16#d3 /sdbot_left put");
- ps_line("Encoding 16#d4 /dsbot_left put");
- ps_line("Encoding 16#d5 /dstop_left put");
- ps_line("Encoding 16#d6 /sdtop_left put");
- ps_line("Encoding 16#d7 /sdcross put");
- ps_line("Encoding 16#d8 /dscross put");
- ps_line("Encoding 16#d9 /bot_right put");
- ps_line("Encoding 16#da /top_left put");
- ps_line("Encoding 16#db /solid_block put");
- ps_line("Encoding 16#dc /bot_block put");
- ps_line("Encoding 16#df /top_block put");
- ps_skip();
- ps_line("/CharProcs 45 dict def");
- ps_line("CharProcs begin %% The functions for each character");
- ps_line("/.notdef {} def");
- ps_line("/solid_block {");
- ps_line(" newpath");
- ps_line(" 0 0 moveto 1000 0 lineto 1000 1000 lineto 0 1000 lineto");
- ps_line(" closepath");
- ps_line(" fill");
- ps_line(" } def");
- ps_line("/shade_block {");
- ps_line(" newpath");
- ps_line(" 125 0 moveto 250 0 lineto 625 0 moveto 750 0 lineto");
- ps_line(" 375 62 moveto 500 62 lineto 875 62 moveto 1000 62 lineto");
- ps_line(" 125 124 moveto 250 124 lineto 625 124 moveto 750 124 lineto");
- ps_line(" 375 186 moveto 500 186 lineto 875 186 moveto 1000 186 lineto");
- ps_line(" 125 248 moveto 250 248 lineto 625 248 moveto 750 248 lineto");
- ps_line(" 375 310 moveto 500 310 lineto 875 310 moveto 1000 310 lineto");
- ps_line(" 125 372 moveto 250 372 lineto 625 372 moveto 750 372 lineto");
- ps_line(" 375 434 moveto 500 434 lineto 875 434 moveto 1000 434 lineto");
- ps_line(" 125 496 moveto 250 496 lineto 625 496 moveto 750 496 lineto");
- ps_line(" 375 558 moveto 500 558 lineto 875 558 moveto 1000 558 lineto");
- ps_line(" 125 620 moveto 250 620 lineto 625 620 moveto 750 620 lineto");
- ps_line(" 375 682 moveto 500 682 lineto 875 682 moveto 1000 682 lineto");
- ps_line(" 125 744 moveto 250 744 lineto 625 744 moveto 750 744 lineto");
- ps_line(" 375 806 moveto 500 806 lineto 875 806 moveto 1000 806 lineto");
- ps_line(" 125 868 moveto 250 868 lineto 625 868 moveto 750 868 lineto");
- ps_line(" 375 930 moveto 500 930 lineto 875 930 moveto 1000 930 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/horizontal {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dhorizontal {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 0 700 moveto 1000 700 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/vertical {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dvertical {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 1000 lineto");
- ps_line(" 600 0 moveto 600 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/cross {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 500 0 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dcross {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 400 500 lineto 400 0 lineto");
- ps_line(" 0 700 moveto 400 700 lineto 400 1000 lineto");
- ps_line(" 600 0 moveto 600 500 lineto 1000 500 lineto");
- ps_line(" 600 1000 moveto 600 700 lineto 1000 700 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dscross {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 0 700 moveto 1000 700 lineto");
- ps_line(" 500 0 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/top_left {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dtop_left {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 700 lineto 1000 700 lineto");
- ps_line(" 600 0 moveto 600 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dstop_left {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 700 lineto 1000 700 lineto");
- ps_line(" 500 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdtop_left {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 500 lineto 1000 500 lineto");
- ps_line(" 600 0 moveto 600 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/top_right {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 500 500 lineto 500 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdtop_right {");
- ps_line(" newpath");
- ps_line(" 400 500 moveto 400 0 lineto");
- ps_line(" 0 500 moveto 600 500 lineto 600 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dtop_right {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 600 700 lineto 600 0 lineto");
- ps_line(" 0 500 moveto 400 500 lineto 400 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/bot_right {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 500 500 lineto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dbot_right {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 400 700 lineto 400 1000 lineto");
- ps_line(" 0 500 moveto 600 500 lineto 600 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdbot_right {");
- ps_line(" newpath");
- ps_line(" 400 500 moveto 400 1000 lineto");
- ps_line(" 0 500 moveto 600 500 lineto 600 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/bot_left {");
- ps_line(" newpath");
- ps_line(" 500 1000 moveto 500 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dbot_left {");
- ps_line(" newpath");
- ps_line(" 600 1000 moveto 600 700 lineto 1000 700 lineto");
- ps_line(" 400 1000 moveto 400 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsbot_left {");
- ps_line(" newpath");
- ps_line(" 500 700 moveto 1000 700 lineto");
- ps_line(" 500 1000 moveto 500 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsbot_right {");
- ps_line(" newpath");
- ps_line(" 500 700 moveto 0 700 lineto");
- ps_line(" 500 1000 moveto 500 500 lineto 0 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dstop_right {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 500 700 lineto 500 0 lineto");
- ps_line(" 500 500 lineto 0 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdbot_left {");
- ps_line(" newpath");
- ps_line(" 400 1000 moveto 400 500 lineto 1000 500 lineto");
- ps_line(" 600 1000 moveto 600 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/left_tee {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 1000 lineto 500 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dleft_tee {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 1000 lineto");
- ps_line(" 600 0 moveto 600 500 lineto 1000 500 lineto");
- ps_line(" 1000 700 moveto 600 700 lineto 600 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdleft_tee {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 1000 lineto");
- ps_line(" 500 500 moveto 1000 500 lineto");
- ps_line(" 500 700 moveto 1000 700 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdright_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 500 500 lineto");
- ps_line(" 0 700 moveto 500 700 lineto");
- ps_line(" 500 0 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsleft_tee {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 1000 lineto 600 0 moveto 600 1000 lineto 600 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdcross {");
- ps_line(" newpath");
- ps_line(" 400 0 moveto 400 1000 lineto 600 0 moveto 600 1000 lineto 0 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/right_tee {");
- ps_line(" newpath");
- ps_line(" 500 0 moveto 500 1000 lineto 500 500 moveto 0 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dright_tee {");
- ps_line(" newpath");
- ps_line(" 600 1000 moveto 600 0 lineto");
- ps_line(" 400 1000 moveto 400 700 lineto 0 700 lineto");
- ps_line(" 0 500 moveto 400 500 lineto 400 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsright_tee {");
- ps_line(" newpath");
- ps_line(" 600 0 moveto 600 1000 lineto 400 0 moveto 400 1000 lineto 400 500 moveto 0 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/up_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto 500 500 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dup_tee {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 400 700 lineto 400 1000 lineto");
- ps_line(" 600 1000 moveto 600 700 lineto 1000 700 lineto");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsup_tee {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 1000 700 lineto");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 500 700 moveto 500 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sdup_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 400 500 moveto 400 1000 lineto");
- ps_line(" 600 500 moveto 600 1000 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/down_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto 500 500 moveto 500 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/ddown_tee {");
- ps_line(" newpath");
- ps_line(" 0 700 moveto 1000 700 lineto");
- ps_line(" 0 500 moveto 400 500 lineto 400 0 lineto");
- ps_line(" 600 0 moveto 600 500 lineto 1000 500 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/dsdown_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto 500 500 moveto 500 0 lineto");
- ps_line(" 0 700 moveto 1000 700 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/sddown_tee {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto");
- ps_line(" 400 500 moveto 400 0 lineto");
- ps_line(" 600 500 moveto 600 0 lineto");
- ps_line(" stroke");
- ps_line(" } def");
- ps_line("/top_block {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto 1000 1000 lineto 0 1000 lineto");
- ps_line(" closepath");
- ps_line(" fill");
- ps_line(" } def");
- ps_line("/bot_block {");
- ps_line(" newpath");
- ps_line(" 0 500 moveto 1000 500 lineto 1000 0 lineto 0 0 lineto");
- ps_line(" closepath");
- ps_line(" fill");
- ps_line(" } def");
- ps_line("end");
- ps_skip();
- ps_line("/BuildChar {");
- ps_line(" 40 setlinewidth");
- ps_line(" 1000 0");
- ps_line(" 0 0 1000 1000");
- ps_line(" setcachedevice");
- ps_line(" exch");
- ps_line(" begin");
- ps_line(" Encoding exch get");
- ps_line(" CharProcs exch get");
- ps_line(" end");
- ps_line(" exec");
- ps_line(" } def");
- ps_skip();
- ps_line("end");
- ps_skip();
- ps_line("/LineChars exch definefont pop");
- ps_skip();
- ps_comment("Now copy the LineChars font and modify the line width for -Bold");
- ps_line("/makelinecharsbolddict 7 dict def");
- ps_line("/MakeLineChars-BoldFont");
- ps_line("{ makelinecharsbolddict begin");
- ps_skip();
- ps_line(" /linecharsdict /LineChars findfont def");
- ps_skip();
- ps_line(" /numentries linecharsdict maxlength def");
- ps_skip();
- ps_line(" /linecharsbolddict numentries dict def");
- ps_skip();
- ps_line(" linecharsdict");
- ps_line(" { exch dup /FID ne");
- ps_line(" { exch linecharsbolddict 3 1 roll put } ");
- ps_line(" { pop pop }");
- ps_line(" ifelse");
- ps_line(" } forall");
- ps_skip();
- ps_line(" linecharsbolddict begin");
- ps_line(" /BuildChar {");
- ps_line(" 80 setlinewidth");
- ps_line(" 1000 0");
- ps_line(" 0 0 1000 1000");
- ps_line(" setcachedevice");
- ps_line(" exch");
- ps_line(" begin");
- ps_line(" Encoding exch get");
- ps_line(" CharProcs exch get");
- ps_line(" end");
- ps_line(" exec");
- ps_line(" } def");
- ps_line(" end");
- ps_skip();
- ps_line(" /LineChars-Bold linecharsbolddict definefont pop");
- ps_line(" end");
- ps_line("} def");
- ps_skip();
- ps_line("MakeLineChars-BoldFont");
- ps_skip();
- ps_comment("End of Prolog");
- ps_skip();
- }
-