Jspice3
plotext.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ft_agraf ()
 
bool clip_line ()
 
bool clip_to_circle ()
 
void com_asciiplot ()
 
void com_xgraph ()
 
void com_hardcopy ()
 
void ft_hardcopy ()
 
void com_plot ()
 
void plot_extend ()
 
void ft_xgraph ()
 
void com_fourier ()
 
GRAPHgr_init ()
 
void gr_point ()
 
void gr_end ()
 
void gr_fixgrid ()
 
void gr_redrawgrid ()
 
int ft_makehardcopy ()
 
void gr_iplot ()
 
void gr_end_iplot ()
 
void com_graf ()
 
int iplot_begin ()
 
int iplot_point ()
 
void iplot_end ()
 
void graf_newdisplay ()
 
void graf_slopelocation ()
 
void com_mplot ()
 
int mp_init ()
 
int mp_where ()
 
int mp_mark ()
 
int mp_done ()
 
void com_echo ()
 
void WARNmsg ()
 
char * KbEdit ()
 
void KbRepaint ()
 
void KbCursor ()
 
double * ft_minmax ()
 
int ft_findpoint ()
 
double * ft_SMITHminmax ()
 
void com_setrdb ()
 
int PopUpErrMessage ()
 
void ScedESC ()
 

Variables

bool ft_nopage
 
char ErrorMessage []
 

Function Documentation

bool clip_line ( )
bool clip_to_circle ( )
void com_asciiplot ( )
void com_echo ( )
void com_fourier ( )
void com_graf ( )
void com_hardcopy ( )
void com_mplot ( )
void com_plot ( )
void com_setrdb ( )
void com_xgraph ( )
void ft_agraf ( )
int ft_findpoint ( )
void ft_hardcopy ( )
int ft_makehardcopy ( )
double* ft_minmax ( )
double* ft_SMITHminmax ( )
void ft_xgraph ( )
void gr_end ( )

Definition at line 168 of file graf.c.

171 {
172  char buf[BSIZE_SP];
173  char *text = "Enter p for hardcopy, return to continue";
174  char *text1 = "Hit p for hardcopy, any other key to continue";
175  char c;
176  int x, y;
179  extern char *kw_device;
180 
181  buf[0] = 0;
182  DevUpdate();
183  if (!dispdev->windows && !dispdev->hardcopy) {
184 
185  if (cp_getvar(kw_device, VT_STRING, buf)
186  && prefix("/dev/tty", buf)) {
187  fprintf(cp_err, "%s", text);
188  fflush(cp_err);
189  c = getchar();
190  }
191  else {
192  x = (currentgraph->absolute.width -
193  strlen(text1)*currentgraph->fontwidth)/2;
194  if (x < 0) x = 0;
196  DevSetColor(8);
197  DevText(text1,x,y);
198  request.option = char_option;
199  request.fp = (FILE*)0;
200  DevInput(&request, &response);
201  c = response.reply.ch;
202  DevSetColor(0);
203  DevBox(x,y,x + strlen(text1)*currentgraph->fontwidth,
204  y + currentgraph->fontheight);
205  DevUpdate();
206  }
207  if (c == 'p') {
208  ft_hardcopy(NULL,currentgraph,true,NULL,false);
209  }
210  }
211 }
char * kw_device
Definition: options.c:351
static char buf[MAXPROMPT]
Definition: arg.c:18
#define BSIZE_SP
Definition: misc.h:19
bool cp_getvar(char *n, int t, char *r)
Definition: help.c:184
struct graph::@2 absolute
FILE * fp
Definition: ftegraph.h:188
#define prefix(x, y)
Definition: readhelp.c:39
OPTION option
Definition: ftegraph.h:187
void DevSetColor()
void DevText()
DISPDEVICE * dispdev
Definition: display.c:112
int height
Definition: ftegraph.h:45
bool hardcopy
Definition: plotdev.h:64
int ch
Definition: ftegraph.h:196
union response::@11 reply
FILE * cp_err
Definition: help.c:101
bool windows
Definition: plotdev.h:61
void DevBox()
int fontwidth
Definition: ftegraph.h:82
#define NULL
Definition: spdefs.h:121
int fontheight
Definition: ftegraph.h:82
static double c
Definition: vectors.c:16
#define VT_STRING
Definition: cpstd.h:63
void DevUpdate()
Definition: display.c:359
void DevInput()
GRAPH * currentgraph
Definition: graphdb.c:21
int width
Definition: ftegraph.h:45
void ft_hardcopy()
void gr_end_iplot ( )

Definition at line 397 of file iplot.c.

398 {
399 
400  struct dbcomm *db, *prev, *next;
401  GRAPH *graph;
402  struct dvec *dv;
403  struct dvlist *ddv, *ddn;
404 
405  EchoGraph = NULL;
406 
407  /* redraw for the last time */
408  for (db = dbiplot; db; db = db->db_next) {
409  if (db->db_type == DB_IPLOT) {
410 
411  if (db->db_graphid) {
412  graph = FindGraph(db->db_graphid);
413  PushGraphContext(graph);
414  if (eq(db->db_nodename2,"graf"))
415  iplot_end();
416  else {
417  (*graph->redraw)(graph);
418  gr_end();
419  }
420  if (!dispdev->windows) {
421  db->db_graphid = 0;
422  if (graph->graphtype == GR_PLOT) {
423  /* the dveclist has not been copied */
424  for (ddv = (struct dvlist *)graph->plotdata; ddv;
425  ddv = ddn) {
426  ddn = ddv->dl_next;
427  txfree((char*)ddv);
428  }
429  graph->plotdata = (GRDATA)NULL;
430  }
431  DevHalt();
432  PopGraphContext();
433  DestroyGraph(graph->graphid);
434  return;
435  }
436  PopGraphContext();
437  }
438  }
439  }
440 
441  /* Tricky stuff - if an iplot window is closed before the simulation
442  * is complete, it is assumed that the debug is no longer wanted.
443  * DestroyGraph simply sets the debug type to DB_DEADIPLOT (so that
444  * no more plotting is done). Below we finish killing the associated
445  * graph, and unlink the dead iplot from the debug list.
446  * After the simulation finishes, we can kill the window without
447  * affecting the debug list, as the db_graphid is set to zero (below).
448  */
449 
450  prev = NULL;
451  for (db = dbiplot; db; prev = db, db = next) {
452  next = db->db_next;
453  if (db->db_type == DB_DEADIPLOT) {
454  if (db->db_graphid) {
455  /* should always be true */
456 
457  graph = FindGraph(db->db_graphid);
458  if (graph->graphtype == GR_PLOT) {
459  /* the dveclist has not been copied */
460  for (ddv = (struct dvlist *)graph->plotdata; ddv;
461  ddv = ddn) {
462  ddn = ddv->dl_next;
463  txfree((char*)ddv);
464  }
465  graph->plotdata = (GRDATA)NULL;
466  }
467  DestroyGraph(db->db_graphid);
468  if (prev)
469  prev->db_next = next;
470  else
471  dbiplot = next;
472  dbfree(db);
473  }
474  }
475  else if (db->db_type == DB_IPLOT) {
476 
477  if (db->db_graphid) {
478 
479  graph = FindGraph(db->db_graphid);
480  if (graph->graphtype == GR_PLOT) {
481  /* get private copy of dvecs, free list */
482  ddv = (struct dvlist*)graph->plotdata;
483  graph->plotdata = (*graph->copydata)(graph->plotdata);
484  for ( ; ddv; ddv = ddn) {
485  ddn = ddv->dl_next;
486  txfree((char*)ddv);
487  }
488  }
489  db->db_graphid = 0;
490  }
491  else {
492  /* warn that this wasn't plotted */
493  fprintf(cp_err, "Warning: iplot %d was not executed.\n",
494  db->db_number);
495  }
496  }
497  }
498  return;
499 }
#define eq(a, b)
Definition: misc.h:29
struct dbcomm * dbiplot
Definition: main.c:186
char * GRDATA
Definition: ftegraph.h:26
int db_graphid
Definition: ftedebug.h:26
void dbfree()
void iplot_end()
Definition: newgraf.c:709
Definition: ftedata.h:49
DISPDEVICE * dispdev
Definition: display.c:112
GRDATA(* copydata)()
Definition: ftegraph.h:72
GRAPH * EchoGraph
Definition: newgraf.c:53
struct dvlist * dl_next
Definition: ftedata.h:51
FILE * cp_err
Definition: help.c:101
bool windows
Definition: plotdev.h:61
void DevHalt()
Definition: display.c:226
char db_type
Definition: ftedebug.h:22
void txfree()
void PushGraphContext()
#define NULL
Definition: spdefs.h:121
int graphtype
Definition: ftegraph.h:31
int graphid
Definition: ftegraph.h:30
GRDATA plotdata
Definition: ftegraph.h:33
struct dbcomm * db_next
Definition: ftedebug.h:28
Definition: ftegraph.h:29
char * db_nodename2
Definition: ftedebug.h:24
Definition: ftedata.h:24
GRAPH * FindGraph()
#define DB_DEADIPLOT
Definition: ftedebug.h:18
void PopGraphContext()
Definition: graphdb.c:270
int DestroyGraph()
#define GR_PLOT
Definition: ftegraph.h:20
void(* redraw)()
Definition: ftegraph.h:70
#define DB_IPLOT
Definition: ftedebug.h:16
void gr_end()
Definition: graf.c:168
void gr_fixgrid ( )
GRAPH* gr_init ( )
void gr_iplot ( )
void gr_point ( )
void gr_redrawgrid ( )
void graf_newdisplay ( )
void graf_slopelocation ( )
int iplot_begin ( )
void iplot_end ( )

Definition at line 709 of file newgraf.c.

712 {
713  int i;
714  char q[8];
715  struct gplot *graf = (struct gplot *)currentgraph->plotdata;
716  struct dvlist *dl, *dl0;
717  struct dvec *scale;
718 
719  if (graf == NULL || currentgraph->graphtype != GR_GRAF)
720  return;
721 
722  dl0 = graf->dlist;
723  if (dl0) {
724  scale = graf->plot->pl_scale;
725 
726  for (dl = dl0, i = 0; dl; dl = dl->dl_next, i++) {
727  interpolateY(graf,i,dl->dl_dvec);
728  }
729  interpolateX(graf,graf->plot->pl_scale);
730 
731  /* free the dvlist, not the dvecs! */
732  for (dl = dl0; dl; dl = dl0) {
733  dl0 = dl->dl_next;
734  txfree((char*)dl);
735  }
736  graf->dlist = NULL;
737  }
738 
739  DevClear();
740  Running = true;
741  graf->iniplot = false;
742 
743  for (i = 0; Running; ) {
745  if (dispdev->windows || dispdev->hardcopy)
746  break;
747  what_now(q);
748  if (i == 0 && *q == '\0') break;
749  i = 1;
750  proc_option(graf,q);
751  }
752 }
static void interpolateX()
static void interpolateY()
if(TDesc==NULL)
Definition: cd.c:1326
Definition: ftedata.h:49
DISPDEVICE * dispdev
Definition: display.c:112
bool hardcopy
Definition: plotdev.h:64
Definition: newgraf.h:103
void DevClear()
Definition: display.c:234
struct dvlist * dl_next
Definition: ftedata.h:51
bool windows
Definition: plotdev.h:61
static bool Running
Definition: newgraf.c:61
struct dvlist * dlist
Definition: newgraf.h:112
void txfree()
struct dvec * pl_scale
Definition: ftedata.h:68
#define NULL
Definition: spdefs.h:121
int graphtype
Definition: ftegraph.h:31
struct gscale * scale
Definition: newgraf.h:110
GRDATA plotdata
Definition: ftegraph.h:33
struct plot * plot
Definition: newgraf.h:111
bool iniplot
Definition: newgraf.h:108
Definition: ftedata.h:24
struct dvec * dl_dvec
Definition: ftedata.h:50
static void proc_option()
static void what_now()
GRAPH * currentgraph
Definition: graphdb.c:21
static void graf_display()
#define GR_GRAF
Definition: ftegraph.h:21
int iplot_point ( )

Definition at line 602 of file newgraf.c.

605 {
606  struct dvlist *dl0, *dl;
607  struct dvec *d, *xs;
608  int i, k, l, n;
609  bool newdim;
610  double *ah, *al, xx, xl, yy, dy, amx, amn;
611  struct gplot *graf = (struct gplot *)currentgraph->plotdata;
612 
613  if (graf == NULL || currentgraph->graphtype != GR_GRAF)
614  return (true);
615 
616  xs = graf->plot->pl_scale;
617  if (isreal(xs)) {
618  xx = xs->v_realdata[xs->v_length-1];
619  xl = xs->v_realdata[xs->v_length-2];
620  }
621  else {
622  xx = realpart(&xs->v_compdata[xs->v_length-1]);
623  xl = realpart(&xs->v_compdata[xs->v_length-2]);
624  }
625  if (xx < xl)
626  newdim = true;
627  else
628  newdim = false;
629 
630  if (xs->v_numdims <= 1 && newdim) {
631  /* error, free the dvlist, not the dvecs! */
632  for (dl = graf->dlist; dl; dl = dl0) {
633  dl0 = dl->dl_next;
634  txfree((char*)dl);
635  }
636  graf->dlist = NULL;
637  graf->iniplot = false;
638  DevSetColor(8);
639  DevText("Monotonicity error, partial plot",graf->scr.XU,
640  graf->scr.YL - 3*graf->scr.H);
641  return (true);
642  }
643  if (graf->scale->lflg)
644  xx = log10(xx);
645 
646  init_viewport(&graf->scr);
647  dl0 = graf->dlist;
648  if (xx > graf->scale->xcurr.max +
649  .001*(graf->scale->xcurr.max - graf->scale->xcurr.min)) goto redraw;
650 
651  for (dl = dl0, i = 0; dl; dl = dl->dl_next, i++) {
652 
653  d = dl->dl_dvec;
654  if (isreal(d))
655  yy = d->v_realdata[d->v_length-1];
656  else
657  yy = realpart(&d->v_compdata[d->v_length-1]);
658 
659  dy = .001*(graf->tdata[i].scale[1] - graf->tdata[i].scale[0]);
660  if (yy > graf->tdata[i].scale[1] + dy ||
661  yy < graf->tdata[i].scale[0] - dy) goto redraw;
662  }
663 
664  ah = graf->scale->ymax;
665  al = graf->scale->ymin;
666  n = graf->numtr;
667 
668  k = graf->scr.X*(xx - graf->scale->xcurr.min) /
669  (graf->scale->xcurr.max - graf->scale->xcurr.min);
670 
671  for (dl = dl0, i = 0; dl; dl = dl->dl_next, i++) {
672 
673  d = dl->dl_dvec;
674  amx = ((ah[i]+al[i])+(ah[i]-al[i])*(2*i+1))/2;
675  amn = ((ah[i]+al[i])-(ah[i]-al[i])*(2*(n-i)-1))/2;
676  if (amx == amn)
677  continue;
678 
679  if (isreal(d))
680  yy = d->v_realdata[d->v_length-1];
681  else
682  yy = realpart(&d->v_compdata[d->v_length-1]);
683 
684  l = (int) (.5 + graf->scr.Y*(yy - amn)/(amx - amn));
685  if (!newdim) {
686  DevSetColor(i+2);
687  DevLine(graf->lastx,graf->tdata[i].lasty,
688  graf->scr.XL + k,graf->scr.YL + l);
689  }
690  graf->tdata[i].lasty = graf->scr.YL + l;
691  }
692  graf->lastx = graf->scr.XL + k;
693  return (false);
694 
695 redraw:
696  graf->iniplot = true;
697  for (dl = dl0, i = 0; dl; dl = dl->dl_next, i++) {
698  interpolateY(graf,i,dl->dl_dvec);
699  }
700  interpolateX(graf,xs);
701  DevSetColor(0);
702  DevBox(0,0,graf->scr.XU,graf->scr.YU);
703  displ(graf);
704  return (false);
705 }
struct gframe xcurr
Definition: newgraf.h:63
struct gtrace tdata[PNUM]
Definition: newgraf.h:113
static void interpolateX()
struct screen scr
Definition: newgraf.h:114
static void interpolateY()
void DevSetColor()
if(TDesc==NULL)
Definition: cd.c:1326
Definition: ftedata.h:49
void DevText()
double ymin[PNUM+4]
Definition: newgraf.h:60
double max
Definition: newgraf.h:43
Definition: cddefs.h:312
int numtr
Definition: newgraf.h:104
Definition: newgraf.h:103
int lflg
Definition: newgraf.h:51
complex * v_compdata
Definition: ftedata.h:29
double scale[2]
Definition: newgraf.h:72
struct dvlist * dl_next
Definition: ftedata.h:51
void DevBox()
static void redraw()
struct dvlist * dlist
Definition: newgraf.h:112
Definition: cddefs.h:237
void txfree()
struct dvec * pl_scale
Definition: ftedata.h:68
#define NULL
Definition: spdefs.h:121
int graphtype
Definition: ftegraph.h:31
int XU
Definition: newgraf.h:87
struct gscale * scale
Definition: newgraf.h:110
GRDATA plotdata
Definition: ftegraph.h:33
struct plot * plot
Definition: newgraf.h:111
void DevLine()
bool iniplot
Definition: newgraf.h:108
#define isreal(v)
Definition: ftedata.h:54
Definition: ftedata.h:24
struct dvec * dl_dvec
Definition: ftedata.h:50
int H
Definition: newgraf.h:82
double ymax[PNUM+4]
Definition: newgraf.h:61
int YU
Definition: newgraf.h:89
int X
Definition: newgraf.h:79
int lasty
Definition: newgraf.h:73
int YL
Definition: newgraf.h:88
int lastx
Definition: newgraf.h:107
int XL
Definition: newgraf.h:86
double min
Definition: newgraf.h:42
int v_numdims
Definition: ftedata.h:40
GRAPH * currentgraph
Definition: graphdb.c:21
static void displ()
int v_length
Definition: ftedata.h:34
double * v_realdata
Definition: ftedata.h:28
static void init_viewport()
int Y
Definition: newgraf.h:80
#define GR_GRAF
Definition: ftegraph.h:21
#define realpart(cval)
Definition: cpstd.h:35
void KbCursor ( )
char* KbEdit ( )
void KbRepaint ( )
int mp_done ( )
int mp_init ( )
int mp_mark ( )
int mp_where ( )
void plot_extend ( )
int PopUpErrMessage ( )
void ScedESC ( )

Definition at line 2222 of file x11.c.

2223 {
2224  return;
2225 }
void WARNmsg ( )

Variable Documentation

char ErrorMessage[]

Definition at line 20 of file error.c.

bool ft_nopage

Definition at line 23 of file options.c.