Jspice3
plotdev.h File Reference
#include "ftegraph.h"
Include dependency graph for plotdev.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  polygn
 
struct  DISPDEVICE
 

Typedefs

typedef struct polygn POLYGON
 

Functions

DISPDEVICEFindDev ()
 
int DevXterm ()
 
void DevGrHalt ()
 
void SaveText ()
 
void DevInit ()
 
int DevNewViewport ()
 
void DevClose ()
 
void DevHalt ()
 
void DevClear ()
 
void DevTitle ()
 
void DevPixel ()
 
void DevLine ()
 
void DevBox ()
 
void DevArc ()
 
void DevPolygon ()
 
void DevText ()
 
void DevSetGhost ()
 
void DevDefineColor ()
 
void DevDefineLinestyle ()
 
void DevSetLinestyle ()
 
void DevSetColor ()
 
void DevUpdate ()
 
void DevDatatoScreen ()
 
void DevInput ()
 
int DevSwitch ()
 
int DevGetchar ()
 
int Plt5_Init ()
 
int Plt5_NewViewport ()
 
int Plt5_Close ()
 
int Plt5_Halt ()
 
int Plt5_Pixel ()
 
int Plt5_Line ()
 
int Plt5_Box ()
 
int Plt5_Arc ()
 
int Plt5_Polygon ()
 
int Plt5_Text ()
 
int Plt5_SetLinestyle ()
 
int Plt5_SetColor ()
 
int Plt5_Update ()
 
int PS_Init ()
 
int PS_NewViewport ()
 
int PS_Close ()
 
int PS_Halt ()
 
int PS_Pixel ()
 
int PS_Line ()
 
int PS_Box ()
 
int PS_Arc ()
 
int PS_Polygon ()
 
int PS_Text ()
 
int PS_SetLinestyle ()
 
int PS_SetColor ()
 
int PS_Update ()
 
int PS_ScaledText ()
 
int HP_Init ()
 
int HP_NewViewport ()
 
int HP_Close ()
 
int HP_Halt ()
 
int HP_Pixel ()
 
int HP_Line ()
 
int HP_Box ()
 
int HP_Arc ()
 
int HP_Polygon ()
 
int HP_Text ()
 
int HP_DefineLinestyle ()
 
int HP_SetLinestyle ()
 
int WP_Init ()
 
int WP_NewViewport ()
 
int WP_Close ()
 
int WP_Halt ()
 
int WP_Pixel ()
 
int WP_Line ()
 
int WP_Box ()
 
int WP_Arc ()
 
int WP_Polygon ()
 
int WP_Text ()
 
int WP_DefineLinestyle ()
 
int WP_SetLinestyle ()
 

Variables

DISPDEVICE device []
 
DISPDEVICEdispdev
 

Typedef Documentation

typedef struct polygn POLYGON

Definition at line 18 of file plotdev.h.

Function Documentation

void DevArc ( )
void DevBox ( )
void DevClear ( )

Definition at line 234 of file display.c.

236 {
237  (void)(*(dispdev->Clear))();
238 }
DISPDEVICE * dispdev
Definition: display.c:112
int(* Clear)()
Definition: plotdev.h:72
void DevClose ( )

Definition at line 218 of file display.c.

220 {
221  (void)(*(dispdev->Close))();
222 }
DISPDEVICE * dispdev
Definition: display.c:112
int(* Close)()
Definition: plotdev.h:70
void DevDatatoScreen ( )
void DevDefineColor ( )
void DevDefineLinestyle ( )
int DevGetchar ( )
void DevGrHalt ( )

Definition at line 151 of file display.c.

153 {
154  int id;
155 
156  /* halt graphics if not windowed */
157  if (!dispdev->windows &&
159  DevHalt();
160  id = currentgraph->graphid;
161  PopGraphContext();
162  DestroyGraph(id);
163  }
164 }
void DevHalt()
Definition: display.c:226
#define GR_SCED
Definition: ftegraph.h:23
bool windows
Definition: plotdev.h:61
int graphtype
Definition: ftegraph.h:31
int graphid
Definition: ftegraph.h:30
DISPDEVICE * dispdev
Definition: display.c:112
void PopGraphContext()
Definition: graphdb.c:270
int DestroyGraph()
GRAPH * currentgraph
Definition: graphdb.c:21
void DevHalt ( )

Definition at line 226 of file display.c.

228 {
229  (void)(*(dispdev->Halt))();
230 }
DISPDEVICE * dispdev
Definition: display.c:112
int(* Halt)()
Definition: plotdev.h:71
void DevInit ( )

Definition at line 168 of file display.c.

170 {
171  char buf[128];
172  extern char *kw_display;
173 
174 /* note: do better determination */
175 /*
176  dumb tradition that got passed on from gi_interface
177  to do compile time determination
178 */
179 #ifdef HAVE_MFB
180 #ifdef HAVE_X11
181  /* determine display type */
182  if (cp_display)
183  dispdev = FindDev("X11");
184  else
185  dispdev = FindDev("MFB");
186 #else /* MFB but not X */
187  dispdev = FindDev("MFB");
188 #endif
189 #else
190 #ifdef HAVE_X11
191  dispdev = FindDev("X11");
192 #else /* no MFB nor X */
194  "no graphics packages; need to define either WANT_X11, or WANT_MFB");
195  dispdev = FindDev("error");
196 #endif
197 #endif
198 
199  if ((*(dispdev->Init))()) {
200  fprintf(cp_err,
201  "Warning: can't initialize display device for graphics.\n");
202  dispdev = FindDev("error");
203  }
204 }
static char buf[MAXPROMPT]
Definition: arg.c:18
DISPDEVICE * FindDev(char *name)
Definition: display.c:118
FILE * cp_err
Definition: help.c:101
int(* Init)()
Definition: plotdev.h:68
char * kw_display
Definition: options.c:352
DISPDEVICE * dispdev
Definition: display.c:112
char * cp_display
Definition: main.c:44
externalerror(char *message)
Definition: error.c:100
void DevInput ( )
void DevLine ( )
int DevNewViewport ( )
void DevPixel ( )
void DevPolygon ( )
void DevSetColor ( )
void DevSetGhost ( )
void DevSetLinestyle ( )
int DevSwitch ( )
void DevText ( )
void DevTitle ( )
void DevUpdate ( )

Definition at line 359 of file display.c.

360 {
361  (void)(*(dispdev->Update))();
362 }
int(* Update)()
Definition: plotdev.h:85
DISPDEVICE * dispdev
Definition: display.c:112
int DevXterm ( )
DISPDEVICE* FindDev ( )
int HP_Arc ( )
int HP_Box ( )
int HP_Close ( )

Definition at line 113 of file hplaser.c.

115 {
116  return (0);
117 }
int HP_DefineLinestyle ( )
int HP_Halt ( )

Definition at line 121 of file hplaser.c.

123 {
124  struct hplaser *hp = (struct hplaser *)currentgraph->devdep;
125  struct hptext *old;
126  char *buf, *rgen, *c;
127  int len, i;
128 
129  /* dump the stuff */
130 
131  /* reset printer
132  * top margin 10
133  * X cursor position OFFSETX
134  * Y cursor position OFFSETY
135  * resolution RESOL dpi
136  * start raster graphics at current position
137  */
138  fprintf(plotfile,
139  "\033E\033&l0E\033*p%dX\033*p%dY\033*t%dR\033*r1A",
141 
142  buf = tmalloc(hp->bytpline+8);
143  sprintf(buf,"\033*b%dW",hp->bytpline);
144  len = strlen(buf);
145  c = buf + len;
146 
147  rgen = hp->base;
148  for (i = 0; i <= hp->maxy; i++) {
149  memcpy(c,rgen,hp->bytpline);
150  rgen += hp->bytpline;
151 
152  if (fwrite(buf,1,hp->bytpline+len,plotfile) != hp->bytpline+len) {
153  break;
154  }
155 
156  }
157  /* end raster graphics */
158  fprintf(plotfile,"\033*rB");
159 
160  /* now for the text */
161 
162  while (hp->textlist) {
163  /* x position, y position, text */
164  fprintf(plotfile,"\033*p%dX\033*p%dY%s",
165  hp->textlist->x,hp->textlist->y,hp->textlist->text);
166  txfree(hp->textlist->text);
167  old = hp->textlist;
168  hp->textlist = hp->textlist->next;
169  txfree((char*)old);
170  }
171 
172  /* form feed
173  * reset printer
174  */
175  fprintf(plotfile,"\033*rB\014\033E");
176 
177  txfree(buf);
178  txfree(hp->base);
179  fclose(plotfile);
180  return (0);
181 }
int y
Definition: hplaser.c:18
static char buf[MAXPROMPT]
Definition: arg.c:18
#define OFFSETY
Definition: hplaser.c:38
Definition: hplaser.c:16
#define RESOL
Definition: hplaser.c:41
#define OFFSETX
Definition: hplaser.c:37
char * tmalloc()
void txfree()
struct hptext * next
Definition: hplaser.c:20
struct hptext * textlist
Definition: hplaser.c:28
int bytpline
Definition: hplaser.c:24
char * text
Definition: hplaser.c:19
char * devdep
Definition: ftegraph.h:144
static FILE * plotfile
Definition: hplaser.c:14
Definition: cddefs.h:177
int x
Definition: hplaser.c:17
char * base
Definition: hplaser.c:27
int maxy
Definition: hplaser.c:26
GRAPH * currentgraph
Definition: graphdb.c:21
int HP_Init ( )

Definition at line 44 of file hplaser.c.

46 {
48  dispdev->numcolors = 2;
49 
50  /* 8" X 10.5" drawable area */
51  dispdev->width = 8*RESOL;
52  dispdev->height = 10*RESOL + RESOL/2;
53  return (0);
54 }
int numlinestyles
Definition: plotdev.h:67
#define RESOL
Definition: hplaser.c:41
DISPDEVICE * dispdev
Definition: display.c:112
int height
Definition: plotdev.h:66
int numcolors
Definition: plotdev.h:67
int width
Definition: plotdev.h:66
int HP_Line ( )
int HP_NewViewport ( )
int HP_Pixel ( )
int HP_Polygon ( )
int HP_SetLinestyle ( )
int HP_Text ( )
int Plt5_Arc ( )
int Plt5_Box ( )
int Plt5_Close ( )

Definition at line 82 of file plot5.c.

84 {
85  return (0);
86 }
int Plt5_Halt ( )

Definition at line 90 of file plot5.c.

91 {
92  if (plotfile)
93  fclose(plotfile);
94  return (0);
95 }
static FILE * plotfile
Definition: plot5.c:11
int Plt5_Init ( )

Definition at line 23 of file plot5.c.

24 {
26  dispdev->numcolors = 2;
27 
28  /* arbitrary drawable area */
29  dispdev->width = 800;
30  dispdev->height = 1050;
31 
32  return(0);
33 }
int numlinestyles
Definition: plotdev.h:67
DISPDEVICE * dispdev
Definition: display.c:112
int height
Definition: plotdev.h:66
int numcolors
Definition: plotdev.h:67
int width
Definition: plotdev.h:66
int Plt5_Line ( )
int Plt5_NewViewport ( )
int Plt5_Pixel ( )
int Plt5_Polygon ( )
int Plt5_SetColor ( )
int Plt5_SetLinestyle ( )
int Plt5_Text ( )
int Plt5_Update ( )

Definition at line 230 of file plot5.c.

232 {
233  fflush(plotfile);
234  return (0);
235 }
static FILE * plotfile
Definition: plot5.c:11
int PS_Arc ( )
int PS_Box ( )
int PS_Close ( )

Definition at line 109 of file postsc.c.

111 {
112  return (0);
113 }
int PS_Halt ( )

Definition at line 117 of file postsc.c.

118 {
119 
120  if (plotfile) {
121  if (DEVDEP(currentgraph).lastlinestyle != -1) {
122  /* haven't stroked last path */
123  fprintf(plotfile, "stroke\n");
124  }
125  fprintf(plotfile, "showpage\n");
126  fclose(plotfile);
127  }
128  return (0);
129 }
#define DEVDEP(g)
Definition: postsc.c:30
GRAPH * currentgraph
Definition: graphdb.c:21
static FILE * plotfile
Definition: postsc.c:15
int PS_Init ( )

Definition at line 39 of file postsc.c.

40 {
42  dispdev->numcolors = 2;
43 
44  /* 8" X 10.5" drawable area */
45  dispdev->width = 576; /* 8 * 72 */
46  dispdev->height = 756; /* 10.5 * 72 */
47 
48  return (0);
49 }
int numlinestyles
Definition: plotdev.h:67
DISPDEVICE * dispdev
Definition: display.c:112
int height
Definition: plotdev.h:66
int numcolors
Definition: plotdev.h:67
int width
Definition: plotdev.h:66
int PS_Line ( )
int PS_NewViewport ( )
int PS_Pixel ( )
int PS_Polygon ( )
int PS_ScaledText ( )
int PS_SetColor ( )
int PS_SetLinestyle ( )
int PS_Text ( )
int PS_Update ( )

Definition at line 381 of file postsc.c.

383 {
384  fflush(plotfile);
385  return (0);
386 }
static FILE * plotfile
Definition: postsc.c:15
void SaveText ( )
int WP_Arc ( )
int WP_Box ( )
int WP_Close ( )

Definition at line 127 of file wp.c.

129 {
130  return (0);
131 }
int WP_DefineLinestyle ( )
int WP_Halt ( )

Definition at line 135 of file wp.c.

136 {
137  putc(16,plotfile);
138  putc(0,plotfile);
139  fclose(plotfile);
140  return (0);
141 }
static FILE * plotfile
Definition: wp.c:14
int WP_Init ( )

Definition at line 24 of file wp.c.

25 {
26  double w, h;
27  extern char *kw_wpboxw, *kw_wpboxh;
28 
30  dispdev->numcolors = 2;
31 
32  if (!cp_getvar(kw_wpboxw,VT_REAL,(char*)&w))
33  w = 4.0;
34  if (!cp_getvar(kw_wpboxh,VT_REAL,(char*)&h))
35  h = 4.0;
36 
37  /* 1200 units per inch */
38  dispdev->width = w*1200;
39  dispdev->height = h*1200;
40 
41  return (0);
42 }
bool cp_getvar(char *n, int t, char *r)
Definition: help.c:184
int numlinestyles
Definition: plotdev.h:67
DISPDEVICE * dispdev
Definition: display.c:112
Definition: cddefs.h:169
char * kw_wpboxw
Definition: options.c:432
int height
Definition: plotdev.h:66
int numcolors
Definition: plotdev.h:67
#define VT_REAL
Definition: cpstd.h:62
int width
Definition: plotdev.h:66
char * kw_wpboxh
Definition: options.c:431
int WP_Line ( )
int WP_NewViewport ( )
int WP_Pixel ( )
int WP_Polygon ( )
int WP_SetLinestyle ( )
int WP_Text ( )

Variable Documentation

DISPDEVICE device[]

Definition at line 24 of file display.c.

DISPDEVICE* dispdev

Definition at line 112 of file display.c.