tomwalters@0: /* tomwalters@0: Copyright (c) Applied Psychology Unit, Medical Research Council. 1988, 1989 tomwalters@0: =========================================================================== tomwalters@0: Permission to use, copy, modify, and distribute this software without fee tomwalters@0: is hereby granted for research purposes, provided that this copyright tomwalters@0: notice appears in all copies and in all supporting documentation, and that tomwalters@0: the software is not redistributed for any fee (except for a nominal shipping tomwalters@0: charge). Anyone wanting to incorporate all or part of this software in a tomwalters@0: commercial product must obtain a license from the Medical Research Council. tomwalters@0: The MRC makes no representations about the suitability of this tomwalters@0: software for any purpose. It is provided "as is" without express or implied tomwalters@0: warranty. tomwalters@0: tomwalters@0: THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING tomwalters@0: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE tomwalters@0: A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY tomwalters@0: DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN tomwalters@0: AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF tomwalters@0: OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. tomwalters@0: */ tomwalters@0: tomwalters@0: /* tomwalters@0: ps.c tomwalters@0: ==== tomwalters@0: primitive PostScript interface ala windows.h interface. tomwalters@0: Copyright (c), 1989 The Medical Research Council, Applied Psychology Unit. tomwalters@0: Author : John Holdsworth 22nd March, 1989. tomwalters@0: Michael Akeroyd Summer 1994. tomwalters@0: tomwalters@0: Edited : Roy P 27-11-92: commented out two if statements with this->hidden tomwalters@0: in them to force hiddenline. tomwalters@0: Also added '(void)' at start of line after second of the lines tomwalters@0: commented out to make it symmetric with similar lines. tomwalters@0: tomwalters@0: : MAA. Summer 1994. rebuild. Notes: tomwalters@0: (1) don't print windows bigger than 800 pixels wide; they aren't scaled tomwalters@0: properly. tomwalters@0: (2) all windows get drawn in the centre of the page. tomwalters@0: (3) because of the 'fill's in drawing the data, the tick-marks can tomwalters@0: get blanked out. To avoid this, the whole frame+marks are drawn tomwalters@0: twice, at the begining (to get the coorect clipppath) and at the tomwalters@0: end tomwalters@0: : MAA. Autumn 1994. rebuilt to avoid note (3). tomwalters@0: tomwalters@0: */ tomwalters@0: tomwalters@0: tomwalters@0: #include tomwalters@0: #if defined(THINK_C) || defined(NeXT) tomwalters@0: #include tomwalters@0: #else tomwalters@0: #include tomwalters@0: #endif tomwalters@0: #include "windows.h" tomwalters@0: #include "grey.h" tomwalters@0: #include "options.h" /* MAA: 23-4-1994: required for isON() */ tomwalters@0: #include "string.h" /* MAA: Summer 1994: required for atof() */ tomwalters@0: #ifndef NeXT tomwalters@0: /* extern int fprintf() ; */ /* mha 8/4/97: sgi stops here */ tomwalters@0: #endif tomwalters@0: tomwalters@0: static char *sccs_id = "@(#)ps.c 1.31 J. Holdsworth (MRC-APU) 7/7/93 Revised MAA 1994" ; tomwalters@0: tomwalters@0: tomwalters@0: /* resolution parameters for line width */ tomwalters@0: #define POINTS_PER_INCH 72 /* standard definition of "points" */ tomwalters@0: #define PIXELS_PER_INCH 300 /* laserwriterII */ tomwalters@0: #define PIXELS_PER_POINT ( ( double ) PIXELS_PER_INCH / POINTS_PER_INCH ) tomwalters@0: tomwalters@0: tomwalters@0: /* limitation on graphics path lengths */ tomwalters@0: #define MAX_PATH 350 tomwalters@0: tomwalters@0: tomwalters@0: typedef struct { tomwalters@0: windowEntries *entries ; /* pointers to method routines below */ tomwalters@0: char *xptr ; /* general pointer to postscript device */ tomwalters@0: int (*sender)(), (*closer)() ; /* function to transmit postscript */ tomwalters@0: int (*storer)(), (*recaller)(), (*reader)(), (*writer)(), (*pauser)() ; /* functions which may be used */ tomwalters@0: int x, y, width, height, pixels, hidden, page ; /* window paramaters */ tomwalters@0: enum { False, True } drawn, showpage ; /* if drawn and if clear not used and tomwalters@0: window can be included in document */ tomwalters@0: struct _lookup *lookup ; /* state structure for dithering routines in grey.c*/ tomwalters@0: } *psWindowObject ; tomwalters@0: tomwalters@0: static windowsClass psClass ; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: /* MAA: lots of new options */ tomwalters@0: extern *rotateaxesstr; tomwalters@0: extern char *xstartstr, *ystartstr, *xendstr, *yendstr; tomwalters@0: extern char *xnewtitlestr, *ynewtitlestr; tomwalters@0: extern char *portraitstr, *landscapestr; tomwalters@0: extern char *fontnamestr, *fontsizestr, *titlesizestr; tomwalters@0: extern char *xticksstr, *yticksstr, *outsidestr; tomwalters@0: extern char *axistopstr, *axisbottomstr, *axisleftstr, *axisrightstr; tomwalters@0: extern char *xmajorticksstr, *xminorticksstr; tomwalters@0: extern char *ymajorticksstr, *yminorticksstr; tomwalters@0: extern char *axislinewidthstr, *figurelinewidthstr; tomwalters@0: extern char *boxstr; tomwalters@0: static double temp_xmin; tomwalters@0: static double temp_xmax; tomwalters@0: static double temp_ymin; tomwalters@0: static double temp_ymax; tomwalters@0: tomwalters@0: tomwalters@0: /*-----------------------------------------------------------------------*/ tomwalters@0: tomwalters@0: tomwalters@0: WindowObject newPostScriptWindow( xptr, default_x, default_y, default_width, default_height, pixels, sender, closer, storer, recaller, reader, writer, pauser, pshidden ) tomwalters@0: char *xptr ; tomwalters@0: int default_x, default_y, default_width, default_height, pixels ; tomwalters@0: int (*sender)(), (*closer)() ; tomwalters@0: int (*storer)(), (*recaller)(), (*reader)(), (*writer)(), (*pauser)() ; tomwalters@0: int pshidden; /* =0 if off, =1 if on */ tomwalters@0: { tomwalters@0: psWindowObject this = ( psWindowObject ) malloc( sizeof ( *this ) ) ; tomwalters@0: char psfontstr[30]; tomwalters@0: char **ptr ; tomwalters@0: tomwalters@0: if( psClass.super == (windowsClass *) 0 ) tomwalters@0: (void) initPostScriptClass( &psClass ) ; tomwalters@0: this->entries = &psClass.entries ; tomwalters@0: this->xptr = xptr ; tomwalters@0: this->sender = sender ; tomwalters@0: this->storer = storer ; tomwalters@0: this->recaller = recaller ; tomwalters@0: this->reader = reader ; tomwalters@0: this->writer = writer ; tomwalters@0: this->pauser = pauser ; tomwalters@0: this->closer = closer ; tomwalters@0: this->x = default_x ; tomwalters@0: this->y = default_y ; tomwalters@0: this->width = default_width ; tomwalters@0: this->height = default_height ; tomwalters@0: this->hidden = pshidden ; tomwalters@0: this->pixels = abs( pixels ) ; tomwalters@0: this->lookup = 0 ; tomwalters@0: this->drawn = False ; tomwalters@0: tomwalters@0: (void) this->sender( this->xptr, "%%!PS-Adobe-2.0 EPSF-1.2\n"); tomwalters@0: (void) this->sender( this->xptr, "%%%%Title: Windows postscript file\n"); tomwalters@0: (void) this->sender( this->xptr, "%%%%Creator: %s\n", sccs_id); tomwalters@0: (void) this->sender( this->xptr, "%%%%BoundingBox: %d %d %d %d\n", this->x, this->y, this->x+this->width, this->y+this->height); tomwalters@0: (void) this->sender( this->xptr, "%%%%Pages: (atend)\n", this->y); tomwalters@0: /* (void) this->sender( this->xptr, "%%%%DocumentFonts: Times-Roman\n");*/ tomwalters@0: (void) this->sender( this->xptr, "%%%%EndComments\n") ; tomwalters@0: tomwalters@0: if ( this->hidden == 0 ) { tomwalters@0: (void) this->sender( this->xptr, "\n%%/fill workaround: no hidden lines. MAA. 22-1-1993\n" ); tomwalters@0: (void) this->sender( this->xptr, "/fill {} def\n\n" );} tomwalters@0: else ; tomwalters@0: tomwalters@0: /* Fonts. The only allowed ones are Times-Roman, Helvetica and Courier, tomwalters@0: * because they are the only three you get in the Adobe Red Book, and tomwalters@0: * so are presumably the onyl three you get in all printers.*/ tomwalters@0: if (!strcmp(fontnamestr, "Times")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "times")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "Roman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "roman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "times-roman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "Times-Roman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "timesroman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "RimesRoman")) {strcpy(psfontstr, "Times-Roman");} tomwalters@0: else if (!strcmp(fontnamestr, "TimesBold")) {strcpy(psfontstr, "Times-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "timesbold")) {strcpy(psfontstr, "Times-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "timesbold")) {strcpy(psfontstr, "Times-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "times-bold")) {strcpy(psfontstr, "Times-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "Times-Bold")) {strcpy(psfontstr, "Times-Bold");} tomwalters@0: tomwalters@0: else if (!strcmp(fontnamestr, "Helvetica")) {strcpy(psfontstr, "Helvetica");} tomwalters@0: else if (!strcmp(fontnamestr, "helvetica")) {strcpy(psfontstr, "Helvetica");} tomwalters@0: else if (!strcmp(fontnamestr, "Hel")) {strcpy(psfontstr, "Helvetica");} tomwalters@0: else if (!strcmp(fontnamestr, "hel")) {strcpy(psfontstr, "Helvetica");} tomwalters@0: else if (!strcmp(fontnamestr, "HelveticaBold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "Helveticabold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "helveticabold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "Helvetica-Bold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "helvetica-bold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "helbold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "HelBold")) {strcpy(psfontstr, "Helvetica-Bold");} tomwalters@0: tomwalters@0: else if (!strcmp(fontnamestr, "Courier")) {strcpy(psfontstr, "Courier");} tomwalters@0: else if (!strcmp(fontnamestr, "courier")) {strcpy(psfontstr, "Courier");} tomwalters@0: else if (!strcmp(fontnamestr, "Cou")) {strcpy(psfontstr, "Courier");} tomwalters@0: else if (!strcmp(fontnamestr, "cou")) {strcpy(psfontstr, "Courier");} tomwalters@0: else if (!strcmp(fontnamestr, "Courier-Bold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "courier-bold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "courierbold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "CourierBold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "CouBold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: else if (!strcmp(fontnamestr, "coubold")) {strcpy(psfontstr, "Courier-Bold");} tomwalters@0: tomwalters@0: else { tomwalters@0: fprintf(stderr, "WARNING: Unknown font %s. (allowed time, helvetica or courier.)\n", fontnamestr); tomwalters@0: fprintf(stderr, "WARNING: Stopping here; no Postscript generated\n"); tomwalters@0: exit(-1);} tomwalters@0: tomwalters@0: tomwalters@0: /* copy postscript code for axes into output file */ tomwalters@0: (void) this->sender( this->xptr, "%%! simple postscript axes\n"); tomwalters@0: (void) this->sender( this->xptr, "%% v1.10 John Holdsworth (5/31/91).\n"); tomwalters@0: (void) this->sender( this->xptr, "%% Revised M Akeroyd (Summer, Autumn 1994)\n"); tomwalters@0: (void) this->sender( this->xptr, "\n"); tomwalters@0: (void) this->sender( this->xptr, " /midprint { %% str x y midprint -\n"); tomwalters@0: (void) this->sender( this->xptr, " moveto\n"); tomwalters@0: (void) this->sender( this->xptr, " dup\n"); tomwalters@0: (void) this->sender( this->xptr, " stringwidth pop 2 div neg 0 rmoveto\n"); tomwalters@0: (void) this->sender( this->xptr, " show\n"); tomwalters@0: (void) this->sender( this->xptr, " } def\n"); tomwalters@0: (void) this->sender( this->xptr, "\n"); tomwalters@0: (void) this->sender( this->xptr, " /leftprint { %% str x y leftprint -\n"); tomwalters@0: (void) this->sender( this->xptr, " moveto\n"); tomwalters@0: (void) this->sender( this->xptr, " dup\n"); tomwalters@0: (void) this->sender( this->xptr, " stringwidth pop neg fontsize 0.4 mul neg rmoveto\n"); tomwalters@0: (void) this->sender( this->xptr, " show\n"); tomwalters@0: (void) this->sender( this->xptr, " } def\n"); tomwalters@0: (void) this->sender( this->xptr, "\n"); tomwalters@0: (void) this->sender( this->xptr, " /ticks { %% min max ticker -\n"); tomwalters@0: (void) this->sender( this->xptr, " /ticker exch def %% procedure to draw ticks\n"); tomwalters@0: (void) this->sender( this->xptr, " /fmax exch cvr def %% relative spacing of max ticks (0.5x, etc)\n"); tomwalters@0: (void) this->sender( this->xptr, " /fmin exch cvr def %% relative spacing of min ticks (0.5x, etc)\n"); tomwalters@0: (void) this->sender( this->xptr, " /max exch cvr def %% axis maximum\n"); tomwalters@0: (void) this->sender( this->xptr, " /min exch cvr def %% axis minimum\n"); tomwalters@0: (void) this->sender( this->xptr, " /maxsubticks 50 def\n"); tomwalters@0: (void) this->sender( this->xptr, " max min ne {\n"); tomwalters@0: (void) this->sender( this->xptr, " %% calculate order of magnitude\n"); tomwalters@0: (void) this->sender( this->xptr, " /delta max min sub log ceiling 1 sub 10 exch exp def\n"); tomwalters@0: (void) this->sender( this->xptr, " %% do ticks\n"); tomwalters@0: (void) this->sender( this->xptr, " min delta div ceiling delta mul\n"); tomwalters@0: (void) this->sender( this->xptr, " delta fmax mul\n"); tomwalters@0: (void) this->sender( this->xptr, " max delta div floor delta mul\n"); tomwalters@0: (void) this->sender( this->xptr, " {\n"); tomwalters@0: (void) this->sender( this->xptr, " min sub max min sub div 1.333333 exch ticker\n"); tomwalters@0: (void) this->sender( this->xptr, " }\n"); tomwalters@0: (void) this->sender( this->xptr, " for\n"); tomwalters@0: (void) this->sender( this->xptr, " %% do sub ticks (but only if fmin != 0)\n"); tomwalters@0: (void) this->sender( this->xptr, " fmin 0 ne {"); tomwalters@0: (void) this->sender( this->xptr, " max min sub delta div dup\n"); tomwalters@0: (void) this->sender( this->xptr, " 10 mul maxsubticks lt {.1} {5 mul maxsubticks lt {.2} {.5} ifelse } ifelse\n"); tomwalters@0: (void) this->sender( this->xptr, " delta mul /delta exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " min delta div ceiling delta mul\n"); tomwalters@0: (void) this->sender( this->xptr, " delta fmin mul \n"); tomwalters@0: (void) this->sender( this->xptr, " max delta div floor delta mul\n"); tomwalters@0: (void) this->sender( this->xptr, " {\n"); tomwalters@0: /* MAA: This used to be 0.25; I've changed it (0.25 * 1.33), so its in real points.*/ tomwalters@0: (void) this->sender( this->xptr, " min sub max min sub div 0.666666 exch ticker\n"); tomwalters@0: (void) this->sender( this->xptr, " }\n"); tomwalters@0: (void) this->sender( this->xptr, " for\n"); tomwalters@0: (void) this->sender( this->xptr, " } if\n"); tomwalters@0: (void) this->sender( this->xptr, " } if\n"); tomwalters@0: (void) this->sender( this->xptr, " } def\n"); tomwalters@0: (void) this->sender( this->xptr, "\n"); tomwalters@0: (void) this->sender( this->xptr, "/Axes { %% title xmin xmax xtitle ymin ymax ytitle Axes -\n"); tomwalters@0: (void) this->sender( this->xptr, "/AxesDict 50 dict def\n"); tomwalters@0: (void) this->sender( this->xptr, "AxesDict begin\n"); tomwalters@0: (void) this->sender( this->xptr, " /ytitle exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /ymax exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /ymin exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /xtitle exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /xmax exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /xmin exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /title exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " newpath clippath pathbbox /height exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /width exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " pop pop\n"); tomwalters@0: (void) this->sender( this->xptr, " /tagsize 0.05 height mul neg def\n"); tomwalters@0: if (isOFF(xticksstr)) tomwalters@0: (void) this->sender( this->xptr, " /xtagsize tagsize 1.33 mul def\n"); tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, " /xtagsize %s neg 1.33 mul def\n", xticksstr); tomwalters@0: if (isOFF(yticksstr)) tomwalters@0: (void) this->sender( this->xptr, " /ytagsize tagsize 1.33 mul def\n"); tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, " /ytagsize %s neg 1.33 mul def\n", yticksstr); tomwalters@0: if (isOFF(fontsizestr)) tomwalters@0: (void) this->sender( this->xptr, " /fontsize 0.05 height mul def\n"); tomwalters@0: else { tomwalters@0: /* note 1.333 multiplier: required to get rid of the 0.75 later on */ tomwalters@0: (void) this->sender( this->xptr, " /fontsize %s 1.333 mul def\n", fontsizestr);} tomwalters@0: (void) this->sender( this->xptr, " /space 0.10 height mul def\n"); tomwalters@0: (void) this->sender( this->xptr, " /%s findfont fontsize scalefont setfont\n", psfontstr); tomwalters@0: /* MAA: What do these 0.75/0.75 do? Quite a lot: they seem to be a screen -> paper multiplu constant*/ tomwalters@0: (void) this->sender( this->xptr, " width 0.20 mul 0.15 height mul translate 0.75 0.75 scale\n"); tomwalters@0: (void) this->sender( this->xptr, " gsave\n"); tomwalters@0: (void) this->sender( this->xptr, " gsave\n"); tomwalters@0: (void) this->sender( this->xptr, " %s setlinewidth\n", axislinewidthstr); tomwalters@0: /* MAA: I do not knwo why this (2,2) translation is here, but it seems to get in the way */ tomwalters@0: /* (void) this->sender( this->xptr, " currentlinewidth 2 div neg dup translate\n");*/ tomwalters@0: (void) this->sender( this->xptr, " newpath\n"); tomwalters@0: if (isOFF(titlesizestr)) tomwalters@0: (void) this->sender( this->xptr, " title width 2 div height tagsize 1.75 mul sub midprint\n"); tomwalters@0: else { tomwalters@0: (void) this->sender( this->xptr, " gsave\n"); tomwalters@0: /* note 1.333 multiplier: required to get rid of the 0.75 later on */ tomwalters@0: (void) this->sender( this->xptr, " /%s findfont %s 1.333 mul scalefont setfont\n", psfontstr, titlesizestr); tomwalters@0: (void) this->sender( this->xptr, " title width 2 div height tagsize 1.75 mul sub midprint\n");} tomwalters@0: if (isON(axisbottomstr)){ tomwalters@0: (void) this->sender( this->xptr, " xmin 0 xtagsize fontsize sub midprint\n"); tomwalters@0: (void) this->sender( this->xptr, " xmax width xtagsize fontsize sub midprint\n"); tomwalters@0: (void) this->sender( this->xptr, " xmin cvr 0 lt \n"); tomwalters@0: (void) this->sender( this->xptr, " {xmax cvr 0 ge \n"); tomwalters@0: (void) this->sender( this->xptr, " {(0) width xmin cvr neg xmin cvr neg xmax cvr add div mul xtagsize 1.0 mul fontsize sub midprint \n"); tomwalters@0: (void) this->sender( this->xptr, " /xtitleconstant 2.0 def} \n"); tomwalters@0: (void) this->sender( this->xptr, " {/xtitleconstant 1.0 def} \n"); tomwalters@0: (void) this->sender( this->xptr, " ifelse}\n"); tomwalters@0: (void) this->sender( this->xptr, " {/xtitleconstant 1.0 def} \n"); tomwalters@0: (void) this->sender( this->xptr, " ifelse\n"); tomwalters@0: (void) this->sender( this->xptr, " xtitle width 2 div xtagsize xtitleconstant mul fontsize sub midprint\n"); tomwalters@0: } tomwalters@0: if (isON(axisleftstr)) { tomwalters@0: (void) this->sender( this->xptr, " ymin ytagsize 2.0 mul 0 leftprint\n"); tomwalters@0: (void) this->sender( this->xptr, " ymax ytagsize 2.0 mul height leftprint\n"); tomwalters@0: (void) this->sender( this->xptr, " ymin cvr 0 lt { \n"); tomwalters@0: (void) this->sender( this->xptr, " ymax cvr 0 ge {\n"); tomwalters@0: (void) this->sender( this->xptr, " (0) ytagsize 2.0 mul height ymin cvr neg ymin cvr neg ymax cvr add div mul leftprint} \n"); tomwalters@0: (void) this->sender( this->xptr, " if}\n"); tomwalters@0: (void) this->sender( this->xptr, " if\n");} tomwalters@0: (void) this->sender( this->xptr, " 90 rotate\n"); tomwalters@0: (void) this->sender( this->xptr, " ytitle height 2 div space 1.75 mul midprint\n"); tomwalters@0: (void) this->sender( this->xptr, " grestore\n"); tomwalters@0: (void) this->sender( this->xptr, " grestore\n"); tomwalters@0: (void) this->sender( this->xptr, "end } def\n"); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: /* MAA: New procedure AxesBox, which draws the box ... This is actually a revised workaround tomwalters@0: * for the 'borderframe' problem. */ tomwalters@0: (void) this->sender( this->xptr, "\n\n" ) ; tomwalters@0: (void) this->sender( this->xptr, "/AxesBox { %% xmin xmax ymin ymax AxesBox -\n"); tomwalters@0: (void) this->sender( this->xptr, "/AxesBoxDict 50 dict def\n"); tomwalters@0: (void) this->sender( this->xptr, "AxesBoxDict begin\n"); tomwalters@0: (void) this->sender( this->xptr, " /ymax exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /ymin exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /xmax exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /xmin exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " newpath clippath pathbbox /height exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " /width exch def\n"); tomwalters@0: (void) this->sender( this->xptr, " pop pop\n"); tomwalters@0: (void) this->sender( this->xptr, " /tagsize 0.05 height mul neg def\n"); tomwalters@0: if (isOFF(xticksstr)) tomwalters@0: (void) this->sender( this->xptr, " /xtagsize tagsize def\n"); tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, " /xtagsize %s neg def\n", xticksstr); tomwalters@0: if (isOFF(yticksstr)) tomwalters@0: (void) this->sender( this->xptr, " /ytagsize tagsize def\n"); tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, " /ytagsize %s neg def\n", yticksstr); tomwalters@0: (void) this->sender( this->xptr, " /space 0.10 height mul def\n"); tomwalters@0: (void) this->sender( this->xptr, " width 0.20 mul 0.15 height mul translate 0.75 0.75 scale\n"); tomwalters@0: (void) this->sender( this->xptr, " gsave\n"); tomwalters@0: (void) this->sender( this->xptr, " %s setlinewidth\n", axislinewidthstr); tomwalters@0: (void) this->sender( this->xptr, " newpath\n"); tomwalters@0: if (isON(outsidestr)){ tomwalters@0: (void) this->sender( this->xptr, " /toptagsize xtagsize neg def\n"); tomwalters@0: (void) this->sender( this->xptr, " /bottomtagsize xtagsize def\n"); tomwalters@0: (void) this->sender( this->xptr, " /lefttagsize ytagsize def\n"); tomwalters@0: (void) this->sender( this->xptr, " /righttagsize ytagsize neg def\n");} tomwalters@0: else{ tomwalters@0: (void) this->sender( this->xptr, " /toptagsize xtagsize def\n"); tomwalters@0: (void) this->sender( this->xptr, " /bottomtagsize xtagsize neg def\n"); tomwalters@0: (void) this->sender( this->xptr, " /lefttagsize ytagsize neg def\n"); tomwalters@0: (void) this->sender( this->xptr, " /righttagsize ytagsize def\n");} tomwalters@0: if (isON(axisbottomstr)){ tomwalters@0: (void) this->sender( this->xptr, " 0 bottomtagsize moveto 0 0 lineto stroke\n"); tomwalters@0: (void) this->sender( this->xptr, " width bottomtagsize moveto width 0 lineto stroke\n");} tomwalters@0: if (isON(axistopstr)){ tomwalters@0: (void) this->sender( this->xptr, " 0 height moveto 0 toptagsize rmoveto 0 height lineto stroke\n"); tomwalters@0: (void) this->sender( this->xptr, " width height moveto 0 toptagsize rmoveto width height lineto stroke\n");} tomwalters@0: if (isON(axisleftstr)){ tomwalters@0: (void) this->sender( this->xptr, " 0 0 moveto lefttagsize 0 rmoveto 0 0 lineto stroke\n"); tomwalters@0: (void) this->sender( this->xptr, " 0 height moveto lefttagsize 0 rmoveto 0 height lineto stroke\n");} tomwalters@0: if (isON(axisrightstr)){ tomwalters@0: (void) this->sender( this->xptr, " width 0 moveto righttagsize 0 rmoveto width 0 lineto stroke\n"); tomwalters@0: (void) this->sender( this->xptr, " width height moveto righttagsize 0 rmoveto width height lineto stroke\n");} tomwalters@0: if (isON(axisbottomstr)) tomwalters@0: (void) this->sender( this->xptr, " xmin xmax %s %s {width mul 0 moveto bottomtagsize mul 0 exch rlineto stroke} ticks\n", xminorticksstr, xmajorticksstr); tomwalters@0: if (isON(axistopstr)) tomwalters@0: (void) this->sender( this->xptr, " xmin xmax %s %s {width mul height moveto toptagsize mul 0 exch rlineto stroke} ticks\n", xminorticksstr, xmajorticksstr); tomwalters@0: if (isON(axisleftstr)) tomwalters@0: (void) this->sender( this->xptr, " ymin ymax %s %s {height mul 0 exch moveto lefttagsize mul 0 rlineto stroke} ticks\n", yminorticksstr, ymajorticksstr); tomwalters@0: if (isON(axisrightstr)) tomwalters@0: (void) this->sender( this->xptr, " ymin ymax %s %s {height mul width exch moveto righttagsize mul 0 rlineto stroke} ticks\n", yminorticksstr, ymajorticksstr); tomwalters@0: (void) this->sender( this->xptr, " grestore\n"); tomwalters@0: (void) this->sender( this->xptr, " newpath 0 0 moveto width 0 lineto width height lineto 0 height lineto closepath stroke clip\n"); tomwalters@0: (void) this->sender( this->xptr, "end } def\n"); tomwalters@0: (void) this->sender( this->xptr, "\ngsave\n\n" ) ; tomwalters@0: tomwalters@0: /* rotate for landscape mode */ tomwalters@0: if( this->width > this->height ) { tomwalters@0: (void) this->sender( this->xptr, "%% shift orgin and rotate for landscape mode\n" ) ; tomwalters@0: (void) this->sender( this->xptr, "newpath clippath pathbbox pop exch translate pop 90 rotate %% notstand\n" ) ; } tomwalters@0: (void) this->sender( this->xptr, "%% center image on page\n" ) ; tomwalters@0: (void) this->sender( this->xptr, "newpath clippath pathbbox exch %d sub 2 div exch %d sub 2 div translate pop pop %%notstand\n", this->width, this->height ) ; tomwalters@0: tomwalters@0: /* set clippath - used by axis routine */ tomwalters@0: (void) this->sender( this->xptr, "newpath 0 0 moveto %d 0 rlineto 0 %d rlineto %d neg 0 rlineto closepath clip\n", this->width, this->height, this->width ) ; tomwalters@0: /* (void) this->sender( this->xptr, "%f setlinewidth\n/l { lineto } def\n", this->pixels / PIXELS_PER_POINT ) ;*/ tomwalters@0: (void) this->sender( this->xptr, "%s setlinewidth\n/l { lineto } def\n", figurelinewidthstr) ; tomwalters@0: tomwalters@0: (void) this->sender( this->xptr, "1 setlinecap\n/pt {moveto 0 0 rlineto stroke} def\n" ) ; tomwalters@0: (void) this->sender( this->xptr, "106 45 { dup mul exch\n dup mul add 1.0\n exch sub } setscreen\n" ) ; tomwalters@0: tomwalters@0: this->page = 1 ; tomwalters@0: (void) this->sender( this->xptr, "%%%%EndProlog\n%%%%Page %d %d\ngsave\n", this->page, this->page ) ; tomwalters@0: this->showpage = False ; tomwalters@0: return ( ( WindowObject ) this ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: /*---------------------------------------------------------------*/ tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: WindowObject newFILEWindow( fp, default_x, default_y, default_width, default_height, pixels, pshidden) tomwalters@0: FILE *fp ; tomwalters@0: int default_x, default_y, default_width, default_height, pixels ; tomwalters@0: int pshidden; tomwalters@0: { tomwalters@0: extern int fflush() ; tomwalters@0: tomwalters@0: return ( newPostScriptWindow( fp, default_x, default_y, default_width, default_height, pixels, fprintf, (int (*)())0, (int (*)())0, (int (*)())0, (int (*)())0, (int (*)())0, fflush, pshidden )) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: WindowObject newPSWindow( name, default_x, default_y, default_width, default_height, pixels, pshidden ) tomwalters@0: char *name ; tomwalters@0: int default_x, default_y, default_width, default_height, pixels ; tomwalters@0: int pshidden ; tomwalters@0: { tomwalters@0: extern int fclose() ; tomwalters@0: FILE *fp = stdout ; tomwalters@0: tomwalters@0: if( name != ( char * ) 0 && name[0] != '\000' ) tomwalters@0: if( ( fp = fopen( name, "w" ) ) == ( FILE * ) 0 ) { tomwalters@0: (void) fprintf( stderr, "Could not open file \"%s\" for output\n", name ) ; tomwalters@0: exit( 1 ) ;} tomwalters@0: tomwalters@0: return ( newPostScriptWindow( fp, default_x, default_y, default_width, default_height, pixels, fprintf, fclose, (int (*)())0, (int (*)())0, (int (*)())0, (int (*)())0, (int (*)()) 0 , pshidden ) ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static short ps__x( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: return( this->x ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: static short ps__y( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: return( this->y ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: static short ps__width( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: return( this->width ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: static short ps__height( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: return( this->height ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: static void ps__draw( this, xs, ys, points ) tomwalters@0: psWindowObject this ; tomwalters@0: short xs[], ys[] ; tomwalters@0: int points ; tomwalters@0: { tomwalters@0: int path, point ; tomwalters@0: tomwalters@0: (void) this->sender( this->xptr, "newpath\n" ) ; tomwalters@0: if( points > 0 ) tomwalters@0: for( point=1 ; point < points ; point+=path ) { tomwalters@0: (void) this->sender( this->xptr, "%d %d moveto\n", xs[point-1], ys[point-1] ) ; tomwalters@0: for( path=0 ; point+path < points && path < MAX_PATH ; path++ ) tomwalters@0: (void) this->sender( this->xptr, "%d %d l\n", xs[point+path], ys[point+path] ) ; tomwalters@0: if( this->hidden && xs[point+path] == xs[point-1] && tomwalters@0: ys[point+path] == ys[point-1] ) /*Roy 27-11-92 */ tomwalters@0: (void) this->sender( this->xptr, "gsave 1 setgray fill grestore\n" ) ; tomwalters@0: (void) this->sender( this->xptr, "stroke\n" ) ;} tomwalters@0: else { tomwalters@0: (void) this->sender( this->xptr, "gsave currentlinewidth 10. mul setlinewidth\n" ) ; tomwalters@0: for( point=1 ; point < abs(points) ; point++ ) tomwalters@0: (void) this->sender( this->xptr, "%d %d pt\n", xs[point], ys[point] ) ; tomwalters@0: (void) this->sender( this->xptr, "grestore\n" ) ;} tomwalters@0: tomwalters@0: this->drawn = True ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__clear( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: if( this->drawn ) { tomwalters@0: ++this->page ; tomwalters@0: (void) this->sender( this->xptr, "grestore\n") ; tomwalters@0: (void) this->sender( this->xptr, "%s setlinewidth\n", axislinewidthstr) ; tomwalters@0: if (isON(boxstr)) tomwalters@0: (void) this->sender( this->xptr, "(%g) (%g) (%g) (%g) AxesBox\n", temp_xmin, temp_xmax, temp_ymin, temp_ymax) ; tomwalters@0: (void) this->sender( this->xptr, "showpage\ngrestore\n%%%%Page: %d %d\ngsave\n", this->page, this->page ) ; } tomwalters@0: (void) this->sender( this->xptr, "gsave clippath 1 setgray fill grestore\n" ) ; tomwalters@0: this->showpage = True ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__close( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: (void) this->sender( this->xptr, "grestore\n") ; tomwalters@0: (void) this->sender( this->xptr, "%s setlinewidth\n", axislinewidthstr) ; tomwalters@0: if (isON(boxstr)) tomwalters@0: (void) this->sender( this->xptr, "(%g) (%g) (%g) (%g) AxesBox\n", temp_xmin, temp_xmax, temp_ymin, temp_ymax) ; tomwalters@0: if( this->showpage ) tomwalters@0: (void) this->sender( this->xptr, "showpage %% notstand\n" ) ; tomwalters@0: else tomwalters@0: this->page = 0 ; tomwalters@0: (void) this->sender( this->xptr, "grestore\n%%%%Trailer\ngrestore\n%%%%Pages: %d\n", this->page ) ; tomwalters@0: if( this->closer != 0 ) tomwalters@0: this->closer( this ) ; tomwalters@0: free( (char *) this ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static int ps__store( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: if( this->storer != 0 ) tomwalters@0: return ( this->storer( this->xptr ) ) ; tomwalters@0: else tomwalters@0: (void) fprintf( stderr, "Invalid call to restore postscript image from memory!!" ) ; tomwalters@0: return 0 ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__recall( this, which ) tomwalters@0: psWindowObject this ; tomwalters@0: int which ; tomwalters@0: { tomwalters@0: if( this->recaller != 0 ) tomwalters@0: this->recaller( this->xptr, which ) ; tomwalters@0: else tomwalters@0: (void) fprintf( stderr, "Invalid call to store postscript image in memory!!" ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static char *cmap( npixels ) tomwalters@0: int *npixels ; tomwalters@0: { tomwalters@0: #ifdef NeXT tomwalters@0: static char ps_grey_scale[] = "04bf" ; tomwalters@0: #else tomwalters@0: static char ps_grey_scale[] = "0123456789abcdef" ; tomwalters@0: #endif tomwalters@0: tomwalters@0: *npixels = sizeof ( ps_grey_scale ) - 1 ; tomwalters@0: return ( ps_grey_scale ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__fill( this, col, input, black, white, match, length, row_flag ) tomwalters@0: psWindowObject this ; tomwalters@0: int col ; tomwalters@0: short *input; tomwalters@0: int black, white ; tomwalters@0: int *match, length ; tomwalters@0: int row_flag ; tomwalters@0: { tomwalters@0: int chans, chan, y, blacky ; tomwalters@0: tomwalters@0: if( this->lookup == 0 ) { tomwalters@0: this->lookup = makeLookup( cmap, black, white, length ) ; tomwalters@0: (void) this->sender( this->xptr, "/picstr %d string def\n", length ) ;} tomwalters@0: if( col == 1 ) { tomwalters@0: if( row_flag ) tomwalters@0: (void) this->sender( this->xptr, "%d %d 4\n[1 0 0 -1 0 %d]\n", this->width, this->height, this->height ) ; tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, "%d %d 4\n[0 1 -1 0 %d 0]\n", this->height, this->width, this->height ) ; tomwalters@0: (void) this->sender( this->xptr, "{currentfile\npicstr readhexstring pop}\nimage\n" ) ;} tomwalters@0: tomwalters@0: (void) this->sender( this->xptr, "%s\n", Lookup( col, this->lookup, input, match, length ) ) ; tomwalters@0: this->drawn = True ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__fillRow( this, row, input, black, white, match, width ) tomwalters@0: psWindowObject this ; tomwalters@0: int row ; tomwalters@0: short *input ; tomwalters@0: int black, white ; tomwalters@0: int *match, width ; tomwalters@0: { tomwalters@0: ps__fill( this, row, input, black, white, match, width, 1 ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__fillCol( this, col, input, black, white, match, height ) tomwalters@0: psWindowObject this ; tomwalters@0: int col ; tomwalters@0: short *input ; tomwalters@0: int black, white ; tomwalters@0: int *match, height ; tomwalters@0: { tomwalters@0: ps__fill( this, col, input, black, white, match, height, 0 ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__function( this, ys, segment, skip, offset, yspan, start, points ) tomwalters@0: psWindowObject this ; tomwalters@0: short *ys ; tomwalters@0: int segment, skip ; tomwalters@0: double offset, yspan ; tomwalters@0: int start, points ; tomwalters@0: { tomwalters@0: int stop = start + abs( segment ) ; tomwalters@0: int point, path = MAX_PATH, count, miny ; tomwalters@0: short *yptr = ys ; tomwalters@0: tomwalters@0: for( point = start ; point < stop-1 ; point += path-1 ) { tomwalters@0: if( path > stop - point ) tomwalters@0: path = stop - point ; tomwalters@0: /* too-wide windows: something to do with Width( this) / (points -1.): tomwalters@0: * next line. No fix attempted. MAA, 22-1-1993. tomwalters@0: */ tomwalters@0: this->sender( this->xptr, "newpath 0 0 moveto %d 0 rlineto 0 %d rlineto %d neg 0 rlineto closepath clip\n", this->width, this->height, this->width ) ; tomwalters@0: this->sender( this->xptr, "matrix currentmatrix [0 %g %g 0 0 %g] concat newpath %d %d moveto\n", tomwalters@0: Height( this ) / yspan, Width( this ) / ( points - 1. ), offset, miny = yptr[0], point ) ; tomwalters@0: this->sender( this->xptr, "%s setlinewidth\n", figurelinewidthstr) ; tomwalters@0: tomwalters@0: #if defined(NeXT) tomwalters@0: this->sender( this->xptr, "[\n" ) ; tomwalters@0: for( count=1 ; count < path ; count++ ) { tomwalters@0: yptr += skip ; tomwalters@0: (void) this->sender( this->xptr, "%d\n", yptr[0]-yptr[-skip] ) ; tomwalters@0: if( miny > yptr[0] ) tomwalters@0: miny = yptr[0] ;} tomwalters@0: this->sender( this->xptr, "] {1 rlineto} forall\n" ) ; tomwalters@0: tomwalters@0: #else tomwalters@0: this->sender( this->xptr, "/r {1 rlineto} bind def\n" ) ; tomwalters@0: for( count=1 ; count < path ; count++ ) { tomwalters@0: yptr += skip ; tomwalters@0: (void) this->sender( this->xptr, "%d r\n", yptr[0]-yptr[-skip] ) ; tomwalters@0: if( miny > yptr[0] ) tomwalters@0: miny = yptr[0] ;} tomwalters@0: #endif tomwalters@0: tomwalters@0: if( this->hidden ) /* roy 27-11-92 */ tomwalters@0: this->sender( this->xptr, "gsave %d 0 rlineto 0 -%d rlineto closepath 1 setgray fill grestore\n", miny-yptr[0], path-1 ) ; tomwalters@0: (void) this->sender( this->xptr, "setmatrix stroke\n" ) ;} tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static int ps__read( this, fp, which ) tomwalters@0: psWindowObject this ; tomwalters@0: FILE *fp ; tomwalters@0: int which ; tomwalters@0: { tomwalters@0: if( this->reader != 0 ) tomwalters@0: this->reader( this->xptr, fp, which ) ; tomwalters@0: else tomwalters@0: (void) fprintf( stderr, "Invalid call to read postscript image from file!!" ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__write( this, fp ) tomwalters@0: psWindowObject this ; tomwalters@0: FILE *fp ; tomwalters@0: { tomwalters@0: if( this->writer != 0 ) tomwalters@0: this->writer( this->xptr, fp ) ; tomwalters@0: else tomwalters@0: (void) fprintf( stderr, "Invalid call to write postscript image to file!!" ) ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static char ps__pause( this ) tomwalters@0: psWindowObject this ; tomwalters@0: { tomwalters@0: if( this->pauser != (int (*)()) 0 ) tomwalters@0: return this->pauser( this->xptr ) ; tomwalters@0: return '\000' ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: static void ps__axes( this, title, xmin, xmax, xtitle, ymin, ymax, ytitle ) tomwalters@0: psWindowObject this ; tomwalters@0: char *title ; tomwalters@0: double xmin, xmax ; tomwalters@0: char *xtitle ; tomwalters@0: double ymin, ymax ; tomwalters@0: char *ytitle ; tomwalters@0: { tomwalters@0: if (strcmp(xstartstr, "")) xmin = atoi(xstartstr); tomwalters@0: if (strcmp(xendstr, "")) xmax = atoi(xendstr); tomwalters@0: if (strcmp(ystartstr, "")) ymin = atoi(ystartstr); tomwalters@0: if (strcmp(yendstr, "")) ymax = atoi(yendstr); tomwalters@0: if (!strcmp(xnewtitlestr, "")) xnewtitlestr=xtitle; tomwalters@0: if (!strcmp(ynewtitlestr, "")) ynewtitlestr=ytitle; tomwalters@0: tomwalters@0: temp_xmin = (double) xmin; tomwalters@0: temp_xmax = (double) xmax; tomwalters@0: temp_ymin = (double) ymin; tomwalters@0: temp_ymax = (double) ymax; tomwalters@0: tomwalters@0: if ( isOFF (rotateaxesstr) ) tomwalters@0: (void) this->sender( this->xptr, "(%s) (%g) (%g) (%s) (%g) (%g) (%s) Axes\n", title, xmin, xmax, xnewtitlestr, ymin, ymax, ynewtitlestr ) ; tomwalters@0: else tomwalters@0: (void) this->sender( this->xptr, "(%s) (%g) (%g) (%s) (%g) (%g) (%s) Axes\n", title, ymin, ymax, ytitle, (xmax * -1), (xmin * -1), xtitle ) ; tomwalters@0: this->drawn = True ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: static void ps__marker( this, label, p, points ) tomwalters@0: psWindowObject this ; tomwalters@0: char *label ; tomwalters@0: int p, points ; tomwalters@0: { tomwalters@0: short pos = ( this->entries->width( this ) * p + points / 2 ) / points ; tomwalters@0: tomwalters@0: (void) this->sender( this->xptr, "newpath %d %d moveto %d %d rlineto stroke\n", pos, 0, 0, this->entries->height( this ) ) ; tomwalters@0: tomwalters@0: this->drawn = True ; tomwalters@0: return ; tomwalters@0: } tomwalters@0: tomwalters@0: static int ps__special( this, code, data ) tomwalters@0: psWindowObject this ; tomwalters@0: int code ; tomwalters@0: char *data ; tomwalters@0: { tomwalters@0: this->drawn = True ; tomwalters@0: switch( code ) { tomwalters@0: case 1 : tomwalters@0: (void) this->sender( this->xptr, "%s\n", data ) ; tomwalters@0: return 1 ; tomwalters@0: } tomwalters@0: return 0 ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: windowsClass *initPostScriptClass( class ) tomwalters@0: windowsClass *class ; tomwalters@0: { tomwalters@0: class->super = &psClass ; tomwalters@0: class->entries.x = ps__x ; tomwalters@0: class->entries.y = ps__y ; tomwalters@0: class->entries.width = ps__width ; tomwalters@0: class->entries.height = ps__height ; tomwalters@0: class->entries.draw = ps__draw ; tomwalters@0: class->entries.clear = ps__clear ; tomwalters@0: class->entries.close = ps__close ; tomwalters@0: class->entries.store = ps__store ; tomwalters@0: class->entries.recall = ps__recall ; tomwalters@0: class->entries.fillRow = ps__fillRow ; tomwalters@0: class->entries.fillCol = ps__fillCol ; tomwalters@0: class->entries.function = ps__function ; tomwalters@0: class->entries.read = ps__read ; tomwalters@0: class->entries.write = ps__write ; tomwalters@0: class->entries.pause = ps__pause ; tomwalters@0: class->entries.axes = ps__axes ; tomwalters@0: class->entries.marker = ps__marker ; tomwalters@0: class->entries.special = ps__special ; tomwalters@0: tomwalters@0: if( psClass.super == (windowsClass *) 0 ) tomwalters@0: (void) initPostScriptClass( &psClass ) ; tomwalters@0: return ( &psClass ) ; tomwalters@0: } tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: /* The End */ tomwalters@0: /*----------------------------------------------------------------------*/ tomwalters@0: tomwalters@0: