version 1.1, 2000/01/09 17:01:16 |
version 1.1.1.3, 2003/09/15 07:09:39 |
|
|
/* Hey Emacs this is -*- C -*- |
/* |
* |
|
* $Id$ |
* $Id$ |
*/ |
*/ |
|
|
Line 110 TERM_PUBLIC void PSTRICKS_reset __PROTO((void)); |
|
Line 109 TERM_PUBLIC void PSTRICKS_reset __PROTO((void)); |
|
#ifndef TERM_PROTO_ONLY |
#ifndef TERM_PROTO_ONLY |
#ifdef TERM_BODY |
#ifdef TERM_BODY |
static void PSTRICKS_endline __PROTO((void)); |
static void PSTRICKS_endline __PROTO((void)); |
static char *PSTRICKS_hack_text __PROTO((char s[])); |
static char *PSTRICKS_hack_text __PROTO((char *s)); |
|
|
static float PSTRICKS_xscale = 1.0; |
|
static float PSTRICKS_yscale = 1.0; |
|
static float PSTRICKS_posx; |
static float PSTRICKS_posx; |
static float PSTRICKS_posy; |
static float PSTRICKS_posy; |
enum JUSTIFY PSTRICKS_justify = LEFT; |
static enum JUSTIFY PSTRICKS_justify = LEFT; |
static int PSTRICKS_angle = 0; |
static int PSTRICKS_angle = 0; |
|
|
#define PSTRICKS_TINY_DOT 0.00025 /* A tiny dot */ |
#define PSTRICKS_TINY_DOT 0.00025 /* A tiny dot */ |
|
|
/* POINTS */ |
/* POINTS */ |
#define PSTRICKS_POINT_TYPES 12 /* we supply more point types */ |
#define PSTRICKS_POINT_TYPES 12 /* we supply more point types */ |
static char *PSTRICKS_points[] = |
|
{ |
static char *PSTRICKS_points[] = { |
"\\PST@Diamond", |
"\\PST@Diamond", |
"\\PST@Plus", |
"\\PST@Plus", |
"\\PST@Square", |
"\\PST@Square", |
Line 141 static char *PSTRICKS_points[] = |
|
Line 138 static char *PSTRICKS_points[] = |
|
|
|
/* LINES */ |
/* LINES */ |
#define PSTRICKS_NUMLINES 6 /* number of linetypes below */ |
#define PSTRICKS_NUMLINES 6 /* number of linetypes below */ |
static char *PSTRICKS_lines[] = |
|
{ |
static char *PSTRICKS_lines[] = { |
"\\PST@Border", |
"\\PST@Border", |
"\\PST@Axes", |
"\\PST@Axes", |
"\\PST@Solid", |
"\\PST@Solid", |
Line 173 static int PSTRICKS_linecount = 0; |
|
Line 170 static int PSTRICKS_linecount = 0; |
|
static int PST_hack_text = TRUE; /* Hack text on */ |
static int PST_hack_text = TRUE; /* Hack text on */ |
static int PST_unit_plot = FALSE; /* Unit-sized plot off */ |
static int PST_unit_plot = FALSE; /* Unit-sized plot off */ |
|
|
TERM_PUBLIC void PSTRICKS_options() |
TERM_PUBLIC void |
|
PSTRICKS_options() |
{ |
{ |
if (!END_OF_COMMAND) { |
if (!END_OF_COMMAND) { |
if (almost_equals(c_token, "no$hacktext")) { |
if (almost_equals(c_token, "no$hacktext")) { |
Line 186 TERM_PUBLIC void PSTRICKS_options() |
|
Line 184 TERM_PUBLIC void PSTRICKS_options() |
|
} |
} |
} |
} |
|
|
TERM_PUBLIC void PSTRICKS_init() |
TERM_PUBLIC void |
|
PSTRICKS_init() |
{ |
{ |
PSTRICKS_posx = PSTRICKS_posy = 0; |
PSTRICKS_posx = PSTRICKS_posy = 0; |
PSTRICKS_linetype(-1); |
PSTRICKS_linetype(-1); |
Line 194 TERM_PUBLIC void PSTRICKS_init() |
|
Line 193 TERM_PUBLIC void PSTRICKS_init() |
|
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_graphics() |
TERM_PUBLIC void |
|
PSTRICKS_graphics() |
{ |
{ |
fputs("\ |
fputs("\ |
% Define new PST objects, if not already defined\n\ |
% Define new PST objects, if not already defined\n\ |
Line 248 TERM_PUBLIC void PSTRICKS_graphics() |
|
Line 248 TERM_PUBLIC void PSTRICKS_graphics() |
|
|
|
/* Set the scaled plot size, if it's not a unit plot */ |
/* Set the scaled plot size, if it's not a unit plot */ |
if (!PST_unit_plot) { |
if (!PST_unit_plot) { |
fprintf(gpoutfile, "\\psset{unit=%fin,xunit=%fin,yunit=%fin}\n", |
fputs("\\psset{unit=5.0in,xunit=5.0in,yunit=3.0in}\n", gpoutfile); |
5.0 * PSTRICKS_xscale, |
|
5.0 * PSTRICKS_xscale, |
|
3.0 * PSTRICKS_yscale); |
|
} |
} |
fputs("\ |
/* HBB 20001027: fix bounding box bug by letting the currently |
\\pspicture(0,0)(1,1)\n\ |
* active 'size' and 'offset' setting influence the area used by |
|
* the picture environment */ |
|
fprintf(gpoutfile, "\ |
|
\\pspicture(%f,%f)(%f,%f)\n\ |
\\ifx\\nofigs\\undefined\n\ |
\\ifx\\nofigs\\undefined\n\ |
\\catcode`@=11\n\n", gpoutfile); |
\\catcode`@=11\n\n", |
|
xoffset, |
|
yoffset, |
|
(xoffset + xsize), |
|
(yoffset + ysize) |
|
); |
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_text() |
TERM_PUBLIC void |
|
PSTRICKS_text() |
{ |
{ |
PSTRICKS_endline(); |
PSTRICKS_endline(); |
fputs("\ |
fputs("\ |
Line 270 TERM_PUBLIC void PSTRICKS_text() |
|
Line 276 TERM_PUBLIC void PSTRICKS_text() |
|
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_linetype(linetype) |
TERM_PUBLIC void |
|
PSTRICKS_linetype(linetype) |
int linetype; |
int linetype; |
{ |
{ |
PSTRICKS_endline(); |
PSTRICKS_endline(); |
|
|
|
|
|
|
|
|
TERM_PUBLIC void PSTRICKS_move(x, y) |
TERM_PUBLIC void |
|
PSTRICKS_move(x, y) |
unsigned int x; |
unsigned int x; |
unsigned int y; |
unsigned int y; |
{ |
{ |
|
|
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_point(x, y, number) /* version of line_and_point */ |
TERM_PUBLIC void |
|
PSTRICKS_point(x, y, number) /* version of line_and_point */ |
unsigned x; |
unsigned x; |
unsigned y; |
unsigned y; |
int number; |
int number; |
|
|
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_vector(ux, uy) |
TERM_PUBLIC void |
|
PSTRICKS_vector(ux, uy) |
unsigned ux; |
unsigned ux; |
unsigned uy; |
unsigned uy; |
{ |
{ |
|
|
PSTRICKS_inline = TRUE; |
PSTRICKS_inline = TRUE; |
|
|
/* Start a new line. This depends on line type */ |
/* Start a new line. This depends on line type */ |
fprintf(gpoutfile, "%s(%.4f,%.4f)\n", PSTRICKS_lines[PSTRICKS_type + 2], |
fprintf(gpoutfile, "%s(%.4f,%.4f)\n", |
|
PSTRICKS_lines[PSTRICKS_type + 2], |
PSTRICKS_posx, PSTRICKS_posy); |
PSTRICKS_posx, PSTRICKS_posy); |
PSTRICKS_linecount = 1; |
PSTRICKS_linecount = 1; |
} else { |
} else { |
|
|
* If they are too long then latex will choke. |
* If they are too long then latex will choke. |
*/ |
*/ |
if (PSTRICKS_linecount++ >= PSTRICKS_LINEMAX) { |
if (PSTRICKS_linecount++ >= PSTRICKS_LINEMAX) { |
/* fprintf(gpoutfile, "\n"); */ |
/* fprintf(gpoutfile, "\n"); */ |
fprintf(gpoutfile, "%s(%.4f,%.4f)\n", PSTRICKS_lines[PSTRICKS_type + 2], |
fprintf(gpoutfile, "%s(%.4f,%.4f)\n", |
|
PSTRICKS_lines[PSTRICKS_type + 2], |
PSTRICKS_posx, PSTRICKS_posy); |
PSTRICKS_posx, PSTRICKS_posy); |
PSTRICKS_linecount = 1; |
PSTRICKS_linecount = 1; |
} |
} |
|
|
fprintf(gpoutfile, "(%.4f,%.4f)\n", PSTRICKS_posx, PSTRICKS_posy); |
fprintf(gpoutfile, "(%.4f,%.4f)\n", PSTRICKS_posx, PSTRICKS_posy); |
} |
} |
|
|
static void PSTRICKS_endline() |
static void |
|
PSTRICKS_endline() |
{ |
{ |
if (PSTRICKS_inline) { |
if (PSTRICKS_inline) { |
putc('\n', gpoutfile); |
putc('\n', gpoutfile); |
Line 356 static void PSTRICKS_endline() |
|
Line 369 static void PSTRICKS_endline() |
|
} |
} |
|
|
|
|
TERM_PUBLIC void PSTRICKS_arrow(sx, sy, ex, ey, head) |
TERM_PUBLIC void |
|
PSTRICKS_arrow(sx, sy, ex, ey, head) |
unsigned int sx; |
unsigned int sx; |
unsigned int sy; |
unsigned int sy; |
unsigned int ex; |
unsigned int ex; |
|
|
*/ |
*/ |
|
|
|
|
static char *PSTRICKS_hack_text(s) |
static char * |
char s[]; |
PSTRICKS_hack_text(s) |
|
char *s; |
{ |
{ |
double value; |
double value; |
char *ends; |
char *ends; |
|
|
* is in scientific notation |
* is in scientific notation |
*/ |
*/ |
|
|
safe_strncpy(hack, s, ends - s); |
safe_strncpy(hack, s, ends - s + 1); |
/* hack[ends - s] = '\0'; */ |
/* hack[ends - s] = '\0'; */ |
|
|
ptr = strchr(hack, 'e'); |
ptr = strchr(hack, 'e'); |
|
|
return hack; |
return hack; |
} |
} |
|
|
TERM_PUBLIC void PSTRICKS_put_text(x, y, str) |
TERM_PUBLIC void |
|
PSTRICKS_put_text(x, y, str) |
unsigned int x; |
unsigned int x; |
unsigned int y; |
unsigned int y; |
char str[]; |
char str[]; |
|
|
|
|
|
|
|
|
TERM_PUBLIC int PSTRICKS_justify_text(mode) |
TERM_PUBLIC int |
|
PSTRICKS_justify_text(mode) |
enum JUSTIFY mode; |
enum JUSTIFY mode; |
{ |
{ |
PSTRICKS_justify = mode; |
PSTRICKS_justify = mode; |
return (TRUE); |
return (TRUE); |
} |
} |
|
|
TERM_PUBLIC int PSTRICKS_text_angle(ang) |
TERM_PUBLIC int |
|
PSTRICKS_text_angle(ang) |
int ang; |
int ang; |
{ |
{ |
PSTRICKS_angle = ang; |
PSTRICKS_angle = ang; |
return (TRUE); |
return (TRUE); |
} |
} |
|
|
TERM_PUBLIC void PSTRICKS_reset() |
TERM_PUBLIC void |
|
PSTRICKS_reset() |
{ |
{ |
PSTRICKS_endline(); |
PSTRICKS_endline(); |
PSTRICKS_posx = PSTRICKS_posy = 0; |
PSTRICKS_posx = PSTRICKS_posy = 0; |