ftp.nice.ch/pub/next/science/mathematics/hippoplotamus.2.0.s.tar.gz#/hippo2.0/hgraphic.c

This is hgraphic.c in view mode; [Download] [Up]

/*
 * hgraphic.c - Routines for displaying hippo ntuples.
 *
 * Copyright (C)  1993  The Board of Trustees of The Leland Stanford
 * Junior University.  All Rights Reserved.
 *
 * $Id: hgraphic.c,v 5.0 1993/08/17 21:54:55 rensing Exp $
 *
 * by Paul Rensing, July 14, 1993
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "hippo.h"
#include "hgraphic.h"

GLOB_QUAL const char hgraphic_c_rcsid[] = 
     "$Id: hgraphic.c,v 5.0 1993/08/17 21:54:55 rensing Exp $";


/*
 * global variables.
 */
/*static*/ plotdrvr_t plot_drvr = DEF_PLOT_DRVR;


int h_setPlotDrvr( plotdrvr_t drvr, ...)
{
     int rc;
     va_list argPtr;
     void *parm;
     
     switch (drvr)
     {
#ifdef _NEXT_PLOT_
     case NEXT:
#endif
#ifdef _XIV_PLOT_
     case XIVPLOT:
#endif	  
#ifdef _X11_PLOT_
     case X11PLOT:
#endif	  
#ifdef THINK_C
     case MAC:
#endif
     case LPR:
	  rc = 0;
	  break;
	  	  
     case PSPLOT:
     case EPSPLOT:
	  va_start( argPtr, drvr );
	  parm = va_arg(argPtr, FILE *);
	  rc = initDrvr_PS( parm );
	  va_end(argPtr);
	  break;

#ifdef _UNIXPLOT_PLOT_
     case UNIXPLOT:
	  va_start( argPtr, drvr );
	  parm = va_arg(argPtr, FILE *); /* this shit does not work yet */
	  rc = initDrvr_UP( parm );
	  va_end(argPtr);
	  break;
#endif
	  	  
     default:
	  h_error("h_setPlotDrvr - invalid plot driver. Driver may not be compiled in this version.\n");
	  rc = -1;
     }
     
     if (rc == 0) 
	  plot_drvr = drvr;
     else
	  h_error("h_setPlotDrvr - error in driver init. Driver was not changed.\n");
     
     return rc;
}

int h_setPlotVars( int dummy, ... )
{
     int rc;
     
     va_list args;
     va_start( args, dummy );
     rc = h_vsetPlotVars( args );
     va_end( args );
     
     return rc;
}

int h_vsetPlotVars( va_list argPtr )
{
     int rc = 0;
     
     switch (plot_drvr)
     {
     default:
	  break;
	  

#ifdef _XIV_PLOT_
     case XIVPLOT:
     {
	  void * painter = va_arg(argPtr, void *);
	  void * canvas  = va_arg(argPtr, void *);
	  setPlotVars_XIV(painter, canvas);
     }
	  break;
#endif

#ifdef _X11_PLOT_
     case X11PLOT:
     {
	  Display* dpy = va_arg(argPtr, Display *);
	  Screen* screen = va_arg(argPtr, Screen *);
	  Drawable drawable = va_arg(argPtr, Drawable);
	  GC gc = va_arg(argPtr, GC);
	  setPlotVars_X11(dpy, screen, drawable, gc);
     }
	  break;
#endif

     }

     return rc;
}


int h_endPlotDrvr( void )
{
     int rc;
     
     switch (plot_drvr)
     {
     case PSPLOT:
     case EPSPLOT:
	  rc = endDrvr_PS( );
	  break;

     default:
	  rc = 0;
     }
     
     return rc;
}

int h_endPage( void )
{
     int rc;
     
     switch (plot_drvr)
     {
     case PSPLOT:
     case EPSPLOT:
	  rc = endPage_PS( );
	  break;

     default:
	  rc = 0;
     }
     
     return rc;
}

int h_setUserCoord(rectangle *docCoord, rectangle *userCoord)
{
     int rc;
     
     PlotSwitch(plot_drvr,setUserCoord,(docCoord, userCoord));
     
     return rc;
}



int h_endPlot( void )
{
     int rc;
     
     switch (plot_drvr)
     {
	  UPFunc(endPlot,());
	  	  
     default:
	  rc = 0;
     }
     
     return rc;
}


int h_drawText(char *s, float x, float y, float fontsize, float angle,
	       char xp, char yp )
{
     int rc;
     
     PlotSwitch(plot_drvr,drawText,(s, x, y, fontsize, angle, xp, yp));
     
     return rc;
}


int h_drawLine2(float *x, float *y, int npts, linestyle_t style, 
		int userCoords)
{
     int rc;
     
     switch (plot_drvr)
     {
	  X11Func(drawLine2,(x, y, npts, style, userCoords));
	  NeXTFunc(drawLine2,(x, y, npts, style, userCoords));
	  PSFunc(drawLine2,(x, y, npts, style, userCoords));
	  	  
     default:
	  rc = 0;
     }
     
/*     PlotSwitch(plot_drvr,drawLine,(x, y, npts, style, userCoords));*/

     return rc;
}

/*
int h_drawPoints2(float *x, float *y, int npts, plotsymbol_t symbol, 
		 float size, int userCoords)
{
     int rc;
     
     PlotSwitch(plot_drvr,drawPoints2,(x, y, npts, symbol, size, userCoords));

     return rc;
}
*/

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.