/*   psgraph.h      heaader file for plot in ps
				1996 11 13 --   Tamagawa	*/
/*		psputimage	:    1999 8 31   */
#include <stdio.h>
#include <string.h>
#include <math.h>

#define MAXSTRING 1024

struct psgraphdata {
	float space;
	float papersize_x;
	float papersize_y;
	float factor_xa;
	float factor_xb;
	float factor_ya;
	float factor_yb;
	char fontname[1024];
	float fontsize;
	int logx;	/* 1 log(x), -1 log(-x) */
	int logy;
	};

static struct psgraphdata psgraph;

#define CM_IN_PT (1.0/2.54*72)


FILE * psinit( char file[] );
void psclose(FILE *fp);
void pssetlogx( int flag );
void pssetlogy( int flag );
float pslogch( float x, int logflag );
void psgetpos( float x, float y, float *xcm, float *ycm);

void pssetwindow(float a_xmin, float a_xmax, float a_ymin, float a_ymax,
				float xmin, float xmax, float ymin, float ymax);
int * data2rgb( float *data, int numx, int numy, float min, float max, int *rgb);
int * data2rgb8( float *data, int numx, int numy, float min, float max, int *rgb);
void psputimage(int *image, int numx, int numy,
		float xmin, float xmax, float ymin, float ymax, FILE *fp);
void psmove( FILE *fp, float x, float y);
void psdraw( FILE *fp, float x, float y);
void psmove_cm( FILE *fp, float x, float y);
void psdraw_cm( FILE *fp, float x, float y);
void pslinewidth( int width, FILE *fp);
void pslinegray( int gray, FILE *fp);

void psline( float *x, float *y, int num, FILE *fp);
void psbox( float xmin, float xmax, float ymin, float ymax, FILE *fp );


void pslinewidth( int width, FILE *fp);
void pslinegray( int gray, FILE *fp);
void pssetfont( char fontname[], float scale, FILE * fp );
void psstrings( float x, float y, char strings[], int pos, int angle, FILE *fp);
void psstrings_cm( float x, float y, char strings[], int pos, int angle, FILE *fp);

void pssetfont( char fontname[], float scale, FILE * fp );
void psnumberi_cm( float x, float y, int number, char format[],
				int pos, int angle, FILE *fp);
void psnumberf_cm( float x, float y, float number, char format[],
				int pos, int angle, FILE *fp);
void psnumberi( float x, float y, int number, char format[],
				int pos, int angle, FILE *fp);
void psnumberf( float x, float y, float number, char format[],
				int pos, int angle, FILE *fp);

void psxaxis( float xmin, float xmax, float dx, float y,
        float label_min, float label_max, float d_label, char form[],
	char which[], FILE *fp);

void psyaxis( float ymin, float ymax, float dy, float x,
        float label_min, float label_max, float d_label, char form[],
	char which[], FILE *fp);

void pscircle( float x, float y, float rad, FILE *fp );


/* calc. max, min, dx, d_label    from x[]	*/
void autoscale( float *x, int num,
        float *xmax, float *xmin, float *dx, float *Label_dx);
void autoscale2( float *x, int num,
        float *xmax, float *xmin, float *dx, float *Label_dx, char fmt[]);

void autoscalelog( float *x, int num,
        float *xmax, float *xmin, float *dx, float *Label_dx);

