int PLP_areadef() { int i; char attr[NAMEMAXLEN], val[256]; char *line, *lineval; int nt, lvp; int first; int stat; double xlo, xhi, ylo, yhi; char areaname[NAMEMAXLEN]; char xscaletype[50], yscaletype[50]; char title[256]; char title2[256]; char titledet[256]; char title2det[256]; char frame[256]; int nlines, maxlen; int doframe; int namedarea; int align; double adjx, adjy; int gotarea, gotxrange, gotyrange; int doxaxis, doyaxis; char areacolor[COLORLEN]; char xminstr[256], xmaxstr[120]; /* was xminstr[120] - needs bigger if big autorange datafield list given - scg 10/25/04 */ char yminstr[256], ymaxstr[120]; /* was yminstr[120] - '' - scg 10/25/04 */ double height, width; int locspec; char linebottom[256]; char lineside[256]; double autowf, autowmin, autowmax; double autohf, autohmin, autohmax; char mapurl[MAXPATH]; double cmadj; int docats; char maplabel[MAXTT]; int clickmap_on; TDH_errprog( "pl proc areadef" ); /* initialize */ strcpy( xscaletype, "linear" ); strcpy( yscaletype, "linear" ); strcpy( areaname, "standard" ); gotxrange = gotyrange = 0; if( PLS.device == 'c' || PLS.device == 'p' ) strcpy( areaname, "standardp" ); /* for sheet of paper */ strcpy( title, "" ); strcpy( title2, "" ); doframe = 0; strcpy( frame, "" ); strcpy( titledet, "" ); strcpy( title2det, "" ); namedarea = 1; /* doxaxis = doyaxis = 1; */ doxaxis = doyaxis = 0; strcpy( areacolor, "" ); strcpy( PL_bigbuf, "" ); height = 4.0; width = 6.0; xlo = 1.5; ylo = 5.0; locspec = 0; strcpy( xminstr, "" ); strcpy( xmaxstr, "" ); strcpy( yminstr, "" ); strcpy( ymaxstr, "" ); strcpy( linebottom, "" ); strcpy( lineside, "" ); gotarea = 1; autowf = 0.0; autowmin = 0.0; autowmax = 20.0; autohf = 0.0; autohmin = 0.0; autohmax = 20.0; strcpy( mapurl, "" ); strcpy( maplabel, "" ); docats = 0; clickmap_on = 0; /* get attributes.. */ first = 1; while( 1 ) { line = getnextattr( first, attr, val, &lvp, &nt ); if( line == NULL ) break; first = 0; lineval = &line[lvp]; if( stricmp( attr, "areaname" )==0 ) { strcpy( areaname, val ); gotarea = 1; } else if( stricmp( attr, "rectangle" )==0 ) { stat = getbox( "rectangle", lineval, &xlo, &ylo, &xhi, &yhi ); if( stat ) { PLS.skipout = 1; return( 1 ); } namedarea = 0; gotarea = 1; } else if( stricmp( attr, "box" )==0 ) { sscanf( lineval, "%lf %lf", &width, &height ); if( PLS.usingcm ) { width /= 2.54; height /= 2.54; } namedarea = 0; gotarea = 1; } else if( stricmp( attr, "location" )==0 ) { sscanf( lineval, "%lf %lf", &xlo, &ylo ); if( PLS.usingcm ) { xlo /= 2.54; ylo /= 2.54; } locspec = 1; } else if( stricmp( attr, "autowidth" )==0 ) { nt = sscanf( lineval, "%lf %lf %lf", &autowf, &autowmin, &autowmax ); } else if( stricmp( attr, "autoheight" )==0 ) { nt = sscanf( lineval, "%lf %lf %lf", &autohf, &autohmin, &autohmax ); } else if( stricmp( attr, "xrange" )==0 || stricmp( attr, "xautorange" )==0 ) { if( strnicmp( val, "datafield", 9 )==0 ) strcpy( xminstr, lineval ); else if( stricmp( val, "categories" )==0 ) { strcpy( xscaletype, val ); continue; } else { nt = sscanf( lineval, "%s %s", xminstr, xmaxstr ); if( nt != 2 ) { PLS.skipout = 1; return( Eerr( 105, "both min and max expected", "xrange" )); } } gotxrange = 1; } else if( stricmp( attr, "yrange" )==0 || stricmp( attr, "yautorange" )==0 ) { if( strnicmp( val, "datafield", 9 )==0 ) strcpy( yminstr, lineval ); else if( stricmp( val, "categories" )==0 ) { strcpy( yscaletype, val ); continue; } else { nt = sscanf( lineval, "%s %s", yminstr, ymaxstr ); if( nt != 2 ) { PLS.skipout = 1; return( Eerr( 105, "both min and max expected", "yrange" )); } } gotyrange = 1; } else if( stricmp( attr, "xscaletype" )==0 ) strcpy( xscaletype, lineval ); else if( stricmp( attr, "yscaletype" )==0 ) strcpy( yscaletype, lineval ); else if( stricmp( attr, "frame" )==0 ) { if( strnicmp( val, "no", 2 )==0 ) doframe = 0; else { strcpy( frame, lineval ); doframe = 1; } } else if( stricmp( attr, "title" )==0 ) { strcpy( title, lineval ); convertnl( title ); } else if( stricmp( attr, "title2" )==0 ) { strcpy( title2, lineval ); convertnl( title2 ); } else if( stricmp( attr, "titledetails" )==0 ) strcpy( titledet, lineval ); else if( stricmp( attr, "title2details" )==0 ) strcpy( title2det, lineval ); else if( stricmp( attr, "areacolor" )==0 ) strcpy( areacolor, val ); else if( stricmp( attr, "linebottom" )==0 ) { if( strnicmp( val, "no", 2 )!=0 ) strcpy( linebottom, lineval ); } else if( stricmp( attr, "lineside" )==0 ) { if( strnicmp( val, "no", 2 )!= 0 ) strcpy( lineside, lineval ); } else if( stricmp( attr, "clickmapurl" )==0 ) { if( PLS.clickmap ) { strcpy( mapurl, val ); clickmap_on = 1 ; } } else if( stricmp( attr, "clickmaplabel" )==0 ) { if( PLS.clickmap ) { strcpy( maplabel, lineval ); clickmap_on = 1 ; } } else if( stricmp( attr, "clickmaplabeltext" )==0 ) { if( PLS.clickmap ) { getmultiline( "clickmaplabeltext", lineval, MAXTT, maplabel ); clickmap_on = 1; } } else if( stricmp( attr, "axes" )==0 ) { if( stricmp( val, "none" )==0 ) { doxaxis = 0; doyaxis = 0; } else if( stricmp( val, "x" )==0 ) doxaxis = 1; else if( stricmp( val, "y" )==0 ) doyaxis = 1; else if( stricmp( val, "both" )==0 ) { doxaxis = 1; doyaxis = 1; } } else if( GL_slmember( attr, "?axis.stubs ?axis.selflocatingstubs" )) { if( strnicmp( attr, "xaxis.", 6 )==0 ) doxaxis = 1; if( strnicmp( attr, "yaxis.", 6 )==0 ) doyaxis = 1; if( GL_slmember( val, "none inc* dat*matic file datafield* list categories usecategories" )) ; else getmultiline( "stubtext", lineval, MAXBIGBUF-5, PL_bigbuf ); /* just to skip past it..*/ } else if( strnicmp( attr, "xaxis.", 6 )==0 ) { doxaxis = 1; continue; } else if( strnicmp( attr, "yaxis.", 6 )==0 ) { doyaxis = 1; continue; } else if( GL_slmember( attr, "axisline tic* minortic*" )) continue; else if( GL_slmember( attr, "?categories ?extracategory catcompmethod" )) { docats = 1; if( GL_slmember( attr, "?categories" ) && strnicmp( val, "datafield", 9 )!=0 ) getmultiline( "categories", lineval, MAXBIGBUF-5, PL_bigbuf ); /* skip over it.. */ if( attr[0] == 'x' ) strcpy( xscaletype, "categories" ); if( attr[0] == 'y' ) strcpy( yscaletype, "categories" ); } else Eerr( 1, "areadef attribute not recognized", attr ); } /* now do the plotting work.. */ PL_resetstacklist(); /* (obscure) - reset the bar graph list that tries to keep track of fields for automatic stacking */ /* go set up category sets if needed.. */ if( docats ) { PLP_categories(); TDH_errprog( "pl proc areadef" ); } if( stricmp( xscaletype, "categories" )==0 ) { if( PL_ncats('x') < 1 ) { PLS.skipout = 1; return( Eerr( 5972, "no x categories exist", "" ) ); } gotxrange = 1; /* note- categories could have been filled from a previous data set */ strcpy( xminstr, "0" ); sprintf( xmaxstr, "%d", PL_ncats('x')+1 ); } if( stricmp( yscaletype, "categories" )==0 ) { if( PL_ncats('y') < 1 ) { PLS.skipout = 1; return( Eerr( 5973, "no y categories exist", "" ) ); } gotyrange = 1; /* note- categories could have been filled from a previous data set */ strcpy( yminstr, "0" ); sprintf( ymaxstr, "%d", PL_ncats('y')+1 ); } if( locspec ) { /* location and box specified, calculate xhi and yhi.. */ xhi = xlo + width; yhi = ylo + height; } /* determine area.. */ if( namedarea ) { RETRY: strcat( areaname, " " ); for( i = 0; i < nareas; i++ ) { if( strnicmp( areas[i], areaname, strlen( areaname ) )==0 ) { if( Ecurpaper == 0 ) sscanf( areas[i], "%*s %lf %lf %lf %lf", &xlo, &ylo, &xhi, &yhi ); else if( Ecurpaper == 1 ) sscanf( areas[i], "%*s %*s %*s %*s %*s %lf %lf %lf %lf", &xlo, &ylo, &xhi, &yhi ); break; } } if( i == nareas ) { areaname[ strlen( areaname ) -1 ] = '\0'; Eerr( 110, "warning, areaname not recognized, using 'standard'..", areaname ); strcpy( areaname, "standard" ); goto RETRY; } } if( !gotarea && !locspec ) { /* && !locspec added scg 11/21/00 */ PLS.skipout = 1; return( Eerr( 130, "No plotting area has been specified", "" ) ); } if( !gotxrange ) { PLS.skipout = 1; return( Eerr( 130, "No xrange has been specified", "" ) ); } if( !gotyrange ) { PLS.skipout = 1; return( Eerr( 130, "No yrange has been specified", "" ) ); } /* set scaling type and special units if any.. */ stat = Escaletype( xscaletype, 'x' ); if( stat != 0 ) Escaletype( "linear", 'x' ); if( strnicmp( xscaletype, "log", 3 )==0 ) Esetunits( 'x', "linear" ); else Esetunits( 'x', xscaletype ); stat = Escaletype( yscaletype, 'y' ); if( stat != 0 ) Escaletype( "linear", 'y' ); if( strnicmp( yscaletype, "log", 3 )==0 ) Esetunits( 'y', "linear" ); else Esetunits( 'y', yscaletype ); /* if autoranging is specified, do it now.. */ if( strnicmp( xminstr, "datafield", 9 ) == 0 ) PLP_autorange( 'x', xminstr, xminstr, xmaxstr ); if( strnicmp( yminstr, "datafield", 9 ) == 0 ) PLP_autorange( 'y', yminstr, yminstr, ymaxstr ); /* if scaletype is log but there are data values = 0.0, go to log+1 scaling.. */ if( stricmp( xscaletype, "log" )==0 && atof( xminstr ) <= 0.0 ) Escaletype( "log+1", 'x' ); if( stricmp( yscaletype, "log" )==0 && atof( yminstr ) <= 0.0 ) Escaletype( "log+1", 'y' ); /* if using autowidth or autoheight, revise plotting area now.. */ if( autowf != 0.0 ) { double xmin, xmax; if( stricmp( xscaletype, "categories" )== 0 ) { xmin = atof( xminstr ); xmax = atof( xmaxstr ); } else { xmin = Econv( 'x', xminstr ); xmax = Econv( 'x', xmaxstr ); } xhi = xlo + ((xmax-xmin) * autowf); if( xhi - xlo < autowmin ) xhi = xlo + autowmin; else if( xhi - xlo > autowmax ) xhi = xlo + autowmax; } if( autohf != 0.0 ) { double ymin, ymax; if( stricmp( yscaletype, "categories" )== 0 ) { ymin = atof( yminstr ); ymax = atof( ymaxstr ); } else { ymin = Econv( 'y', yminstr ); ymax = Econv( 'y', ymaxstr ); } yhi = ylo + ((ymax-ymin) * autohf); if( yhi - ylo < autohmin ) yhi = ylo + autohmin; else if( yhi - ylo > autohmax ) yhi = ylo + autohmax; } /* set the scaling for the plot area.. */ stat = Esetscale( 'x', xlo, xhi, xminstr, xmaxstr ); stat += Esetscale( 'y', ylo, yhi, yminstr, ymaxstr ); if( PLS.debug ) fprintf( PLS.diagfp, "areadef: lowerleft: %g,%g upperright: %g,%g\n", xlo, ylo, xhi, yhi ); if( PLS.debug ) fprintf( PLS.diagfp, "areadef: xrange is %s to %s. yrange is %s to %s.\n", xminstr, xmaxstr, yminstr, ymaxstr ); if( stat != 0 ) return( stat ); DT_suppress_twin_warn( 0 ); /* set variables to hold plot area bounds and scale min/max.. */ if( PLS.usingcm ) cmadj = 2.54; else cmadj = 1.0; setfloatvar( "AREATOP", EYhi * cmadj ); setfloatvar( "AREABOTTOM", EYlo * cmadj ); setfloatvar( "AREALEFT", EXlo * cmadj ); setfloatvar( "AREARIGHT", EXhi * cmadj ); setcharvar( "XMIN", xminstr ); setcharvar( "XMAX", xmaxstr ); setcharvar( "YMIN", yminstr ); setcharvar( "YMAX", ymaxstr ); if( areacolor[0] != '\0' ) Ecblock( EXlo, EYlo, EXhi, EYhi, areacolor, 0 ); if( clickmap_on ) { if( GL_slmember( mapurl, "*@XVAL*" ) || GL_slmember( mapurl, "*@YVAL*" )) clickmap_seturlt( mapurl ); else clickmap_entry( 'r', mapurl, 0, EXlo, EYlo, EXhi, EYhi, 0, 0, maplabel ); } /* draw a frame of the graphics area */ if( doframe ) { if( stricmp( frame, "bevel" )==0 ) { Ecblockdress( EXlo, EYlo, EXhi, EYhi, 0.1, "0.6", "0.8", 0.0, "" ); } else { linedet( "frame", frame, 1.0 ); Ecblock( EXlo, EYlo, EXhi, EYhi, "", 1 ); } } /* draw bottom line */ if( linebottom[0] != '\0' ) { linedet( "linebottom", linebottom, 1.0 ); Emov( EXlo, EYlo ); Elin( EXhi, EYlo ); } /* draw side line */ if( lineside[0] != '\0' ) { linedet( "lineside", lineside, 1.0 ); Emov( EXlo, EYlo ); Elin( EXlo, EYhi ); } /* title */ if( title[0] != '\0' ) { textdet( "titledetails", titledet, &align, &adjx, &adjy, 0, "R", 1.0 ); measuretext( title, &nlines, &maxlen ); if( align == '?' ) align = 'L'; if( align == 'L' ) Emov( EXlo + adjx, EYhi + ((nlines-1) * Ecurtextheight ) + adjy + 0.02 ); else if( align == 'C' ) Emov( EXlo+((EXhi-EXlo) / 2.0 ) + adjx, EYhi + ((nlines-1) * Ecurtextheight ) +adjy + 0.02 ); else if( align == 'R' ) Emov( EXhi + adjx, EYhi + ((nlines-1) * Ecurtextheight ) +adjy + 0.02); Edotext( title, align ); } /* title 2 */ if( title2[0] != '\0' ) { textdet( "title2details", title2det, &align, &adjx, &adjy, 0, "R", 1.0 ); measuretext( title2, &nlines, &maxlen ); if( align == '?' ) align = 'L'; if( align == 'L' ) Emov( EXlo + adjx, EYhi + ((nlines-1) * Ecurtextheight ) + adjy + 0.02 ); else if( align == 'C' ) Emov( EXlo+((EXhi-EXlo) / 2.0 ) + adjx, EYhi + ((nlines-1) * Ecurtextheight ) +adjy + 0.02 ); else if( align == 'R' ) Emov( EXhi + adjx, EYhi + ((nlines-1) * Ecurtextheight ) +adjy + 0.02 ); Edotext( title2, align ); } if( doxaxis ) PLP_axis( 'x', 6 ); if( doyaxis ) PLP_axis( 'y', 6 ); return( 0 ); }
int PLP_page( ) { int lvp, first; char attr[NAMEMAXLEN], *line, *lineval; char buf[512], devval[20]; char *outfilename, *mapfilename, *titledet, *pagetitle, *url; int stat, nt, align, nlines, maxlen, landscapemode, dobackground, dopagebox, pagesizegiven, clickmap_enabled_here, tight, map; double adjx, adjy, scalex, scaley, sx, sy; TDH_errprog( "pl proc page" ); /* initialize */ landscapemode = PLS.landscape; /* from command line */ titledet = ""; outfilename = ""; mapfilename = ""; pagetitle = ""; dobackground = 1; dopagebox = 1; if( GL_member( PLS.device, "gesf" )) dopagebox = 0; /* bounding box shouldn't include entire page for gif , eps */ if( PLS.device == 'e' ) dobackground = 0; pagesizegiven = 0; strcpy( devval, "" ); scalex = scaley = 1.0; clickmap_enabled_here = 0; /* get attributes.. */ first = 1; while( 1 ) { line = getnextattr( first, attr, &lvp ); if( line == NULL ) break; first = 0; lineval = &line[lvp]; /* if an attribute is given on command line, it overrides anything here.. */ if( GL_slmember( attr, PLS.cmdlineparms )) continue; if( strcmp( attr, "landscape" )==0 && GL_slmember( "portrait", PLS.cmdlineparms )) continue; if( strcmp( attr, "outfilename" )==0 && GL_slmember( "o", PLS.cmdlineparms )) continue; if( strcmp( attr, "landscape" )==0 ) landscapemode = getyn( lineval ); else if( strcmp( attr, "title" )==0 ) pagetitle = getmultiline( lineval, "get" ); else if( strcmp( attr, "titledetails" )==0 ) titledet = lineval; else if( strcmp( attr, "color" )==0 ) tokncpy( Estandard_color, lineval, COLORLEN ); else if( strcmp( attr, "scale" )==0 ) { nt = sscanf( lineval, "%lf %lf", &scalex, &scaley ); if( nt == 1 ) scaley = scalex; } else if( strcmp( attr, "backgroundcolor" )==0 ) { tokncpy( Estandard_bkcolor, lineval, COLORLEN ); Ebackcolor( Estandard_bkcolor ); dobackground = 1; /* added scg 9/27/99 */ } else if( strcmp( attr, "linewidth" )==0 ) Estandard_lwscale = ftokncpy( lineval ); else if( strcmp( attr, "textsize" )==0 ) Estandard_textsize = itokncpy( lineval ); else if( strcmp( attr, "font" )==0 ) tokncpy( Estandard_font, lineval, FONTLEN ); else if( strcmp( attr, "dobackground" )==0 ) dobackground = getyn( lineval ); else if( strcmp( attr, "dopagebox" )==0 ) dopagebox = getyn( lineval ); else if( strcmp( attr, "tightcrop" )==0 ) { tight = getyn( lineval ); Etightbb( tight ); } else if( strncmp( attr, "crop", 4 )==0 ) { double cropx1, cropy1, cropx2, cropy2; nt = sscanf( lineval, "%lf %lf %lf %lf", &cropx1, &cropy1, &cropx2, &cropy2 ); if( nt != 4 ) Eerr( 2707, "usage: crop x1 y1 x2 y2 OR croprel left bottom right top", "" ); else { if( PLS.usingcm ) { cropx1 /= 2.54; cropy1 /= 2.54; cropx2 /= 2.54; cropy2 /= 2.54; } if( strcmp( attr, "croprel" )==0 ) Especifycrop( 2, cropx1, cropy1, cropx2, cropy2 ); /* relative to tight */ else Especifycrop( 1, cropx1, cropy1, cropx2, cropy2 ); /* absolute */ } } else if( strcmp( attr, "pixsize" ) ==0 ) { /* added scg 1/9/08 */ int reqwidth, reqheight; nt = sscanf( lineval, "%d %d", &reqwidth, &reqheight ); if( nt != 2 ) Eerr( 57233, "pixsize ignored.. it requires width and height (in pixels)", "" ); #ifndef NOGD PLGG_setimpixsize( reqwidth, reqheight ); #endif if( PLS.device != 'g' ) Eerr( 24795, "pixsize ignored.. it's only applicable when generating png/gif/jpeg images", "" ); } else if( strcmp( attr, "pagesize" )==0 ) { getcoords( "pagesize", lineval, &(PLS.winw), &(PLS.winh) ); pagesizegiven = 1; } else if( strcmp( attr, "outfilename" )==0 ) { outfilename = lineval; if( strlen( outfilename ) > MAXPATH-1 ) { PLS.skipout = 1; return( Eerr( 57932, "outfilename too long", "" ) ); } } else if( strncmp( attr, "mapfile", 7 )==0 ) { mapfilename = lineval; if( strlen( mapfilename ) > MAXPATH-1 ) { Eerr( 57932, "mapfile name too long", "" ); mapfilename = ""; } } else if( strcmp( attr, "clickmapdefault" )==0 ) { url = lineval; if( strlen( url ) > MAXURL-1 ) Eerr( 57933, "clickmapdefault url too long", "" ); else clickmap_setdefaulturl( url ); } else if( strcmp( attr, "map" )==0 ) { map = getyn( lineval ); if( map ) { PLS.clickmap = 1; clickmap_enabled_here = 1; }} else if( strcmp( attr, "csmap" )==0 ){ map = getyn( lineval ); if( map ) { PLS.clickmap = 2; clickmap_enabled_here = 1; }} else if( strcmp( attr, "outlabel" )==0 ) Esetoutlabel( lineval ); else Eerr( 1, "page attribute not recognized", attr ); } /* -------------------------- */ /* Page break logic.. */ /* -------------------------- */ if( PLS.npages == 0 ) { /* following 3 lines moved here from above - also replicated below. scg 10/31/00 */ if( scalex != 1.0 || scaley != 1.0 ) Esetglobalscale( scalex, scaley ); Egetglobalscale( &sx, &sy ); if( pagesizegiven ) Esetsize( PLS.winw * sx, PLS.winh * sy, PLS.winx, PLS.winy ); else if( landscapemode && !PLS.winsizegiven ) Esetsize( 11.0, 8.5, PLS.winx, PLS.winy ); /* landscape */ /* clickmap (must come before init for eg. svg - scg 2/7/05) */ if( clickmap_enabled_here ) { if( mapfilename[0] == '\0' ) { if( PLS.clickmap == 2 ) strcpy( PLS.mapfile, "stdout" ); /* csmap defaults to stdout.. scg 8/26/04 */ else if( PLS.outfile[0] != '\0' ) makeoutfilename( PLS.outfile, PLS.mapfile, 'm', 1); else strcpy( PLS.mapfile, "unnamed.map" ); } PL_clickmap_init(); #ifndef NOSVG /* must update this now too.. scg 2/7/05 */ if( PLS.device == 's' ) PLGS_setparms( PLS.debug, PLS.tmpname, PLS.clickmap ); #endif } else if( mapfilename[0] != '\0' ) strcpy( PLS.mapfile, mapfilename ); /* PPP */ /* initialize and give specified output file name .. */ if( outfilename[0] != '\0' ) Esetoutfilename( outfilename ); stat = Einit( PLS.device ); if( stat ) { PLS.skipout = 1; return( stat ); } /* set paper orientation */ if( landscapemode ) Epaper( 1 ); } else if( PLS.npages > 0 ) { if( GL_member( PLS.device, "gesf" )) { /* finish up current page before moving on to next one.. */ Eshow(); stat = Eendoffile(); if( stat ) return( stat ); /* now set file name for next page.. */ if( outfilename[0] != '\0' ) Esetoutfilename( outfilename ); else { makeoutfilename( PLS.outfile, buf, PLS.device, (PLS.npages)+1 ); if( PLS.debug ) fprintf( PLS.diagfp, "Setting output file name to %s\n", PLS.outfile ); Esetoutfilename( buf ); } if( PLS.clickmap ) { /* initialize a new click map file.. */ if( mapfilename[0] != '\0' ) strcpy( PLS.mapfile, mapfilename ); else makeoutfilename( PLS.outfile, PLS.mapfile, 'm', (PLS.npages)+1 ); PL_clickmap_init(); } /* perhaps set global scaling and/or page size for next page.. */ /* following 3 lines copied here from above - scg 10/31/00 */ if( scalex != 1.0 || scaley != 1.0 ) Esetglobalscale( scalex, scaley ); Egetglobalscale( &sx, &sy ); if( pagesizegiven ) Esetsize( PLS.winw * sx, PLS.winh * sy, PLS.winx, PLS.winy ); else if( landscapemode && !PLS.winsizegiven ) Esetsize( 11.0, 8.5, PLS.winx, PLS.winy ); /* landscape */ /* initialize next page.. */ stat = Einit( PLS.device ); if( stat ) return( stat ); } else if ( PLS.device == 'x' ) PL_do_x_button( "More.." ); else if ( GL_member( PLS.device, "pc" ) ) { Eprint(); if( landscapemode ) Epaper( 1 ); /* added scg 2/29/00 */ Elinetype( 0, 0.6, 1.0 ); /* added scg 9/20/99 */ } } (PLS.npages)++; /* -------------------------- */ /* now do other work.. */ /* -------------------------- */ /* do background.. */ /* if( dopagebox ) Ecblock( 0.0, 0.0, EWinx, EWiny, Ecurbkcolor, 0 ); */ /* does update bb */ if( dopagebox ) Ecblock( 0.0, 0.0, PLS.winw, PLS.winh, Ecurbkcolor, 0 ); /* does update bb */ else if( dobackground ) { /* EPS color=transparent - best to do nothing.. */ if( PLS.device == 'e' && strcmp( Ecurbkcolor, "transparent" )==0 ) ; else Eclr(); /* doesn't update bb */ } if( pagetitle[0] != '\0' ) { textdet( "titledetails", titledet, &align, &adjx, &adjy, 3, "B", 1.0 ); if( align == '?' ) align = 'C'; measuretext( pagetitle, &nlines, &maxlen ); if( align == 'L' ) Emov( 1.0 + adjx, (PLS.winh-0.8) + adjy ); else if ( align == 'C' ) Emov( (PLS.winw / 2.0 ) + adjx, (PLS.winh-0.8) + adjy ); else if( align == 'R' ) Emov( (PLS.winw-1.0) + adjx, (PLS.winh-0.8) + adjy ); Edotext( pagetitle, align ); } return( 0 ); }
int PLP_categories() { char attr[NAMEMAXLEN], val[256]; char *line, *lineval; int nt, lvp; int first; char axis; double slideamount; char dfield[NAMEMAXLEN]; char selex[255]; TDH_errprog( "pl proc categories" ); slideamount = -99999.9; axis = '\0'; strcpy( dfield, "" ); strcpy( selex, "" ); /* note: old AREADEF and CATSLIDE category-related attributes supported here as 'overlays'.. * hence, beware of attribute name collision with those procs */ /* note: proc categories is unusual in that attribute order does matter.. * - 'axis' and 'listsize' (if used) must specified before other attributes. * - extracategory adds categories pre or post depending on position relative to category set fill * - select must be given before datafield * - #clone is not supported for this proc */ /* get attributes.. */ first = 1; while( 1 ) { line = getnextattr( first, attr, val, &lvp, &nt ); if( line == NULL ) break; first = 0; lineval = &line[lvp]; if( stricmp( attr, "axis" )==0 ) { axis = tolower( val[0] ); PL_setcatparms( axis, "compmethod", -1 ); /* default to exact.. */ } else if( GL_slmember( attr, "?categories categories" )) { /* put category names into array slots now.. */ if( strnicmp( val, "datafield", 9 )==0 ) strcpy( PL_bigbuf, lineval ); else getmultiline( "categories", lineval, MAXBIGBUF, PL_bigbuf ); if( attr[0] == 'x' || attr[0] == 'y' ) PL_setcats( attr[0], PL_bigbuf ); else if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); else PL_setcats( axis, PL_bigbuf ); } else if( GL_slmember( attr, "?extracategory extracategory" )) { char ax; if( attr[0] == 'x' || attr[0] == 'y' ) ax = attr[0]; else ax = axis; if( ax == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); if( PL_ncats( ax ) < 1 ) PL_addcat( ax, "pre", lineval ); else PL_addcat( ax, "post", lineval ); } else if( GL_slmember( attr, "comparemethod catcompmethod" )) { /* old 'catcompmethod' affects both axes */ int p; if( stricmp( val, "exact" )==0 ) p = -1; else if( strnicmp( val, "length=", 7 )==0 ) p = atoi( val ); else p = 0; if( axis == 'x' || axis == '\0' ) PL_setcatparms( 'x', "compmethod", p ); if( axis == 'y' || axis == '\0' ) PL_setcatparms( 'y', "compmethod", p ); } else if( stricmp( attr, "slideamount" )==0 || stricmp( attr, "amount" )==0 ) slideamount = atof( val ); else if( stricmp( attr, "datafield" )==0 ) { if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); sprintf( PL_bigbuf, "datafield=%s %s%s", val, (selex[0]=='\0')?"":"selectrows=", selex ); PL_setcats( axis, PL_bigbuf ); } else if( stricmp( attr, "select" )==0 ) strcpy( selex, lineval ); else if( stricmp( attr, "listsize" )==0 ) { if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); PL_setcatparms( axis, "listsize", atoi( val ) ); } else if( stricmp( attr, "checkuniq" )==0 ) { if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); if( tolower( val[0] ) == 'y' ) PL_setcatparms( axis, "checkuniq", 1 ); else PL_setcatparms( axis, "checkuniq", 0 ); } else if( stricmp( attr, "roundrobin" )==0 ) { if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); if( tolower( val[0] ) == 'y' ) PL_setcatparms( axis, "roundrobin", 1 ); else PL_setcatparms( axis, "roundrobin", 0 ); } /* else Eerr( 1, "attribute not recognized", attr ); */ /* can't do this because we could be processing an areadef block */ } if( slideamount > -100.0 && slideamount < 100.0 ) { if( axis == '\0' ) return( Eerr( 2795, "'axis' expected as first attribute", "" )); Esetcatslide( axis, slideamount ); } return( 0 ); }