Jspice3
breakp.c File Reference
#include "spice.h"
#include "ftedefs.h"
#include "ftedebug.h"
#include "spfteext.h"
#include "scedio.h"
Include dependency graph for breakp.c:

Go to the source code of this file.

Functions

static void printdbg ()
 
static bool print_trace ()
 
static char * spec ()
 
static void printcond ()
 
static int hackplot ()
 
static void unhackplot ()
 
void com_stop (wordlist *wl)
 
void com_trce (wordlist *wl)
 
void com_iplot (wordlist *wl)
 
void com_save (wordlist *wl)
 
void com_step (wordlist *wl)
 
void com_sttus (wordlist *wl)
 
static void printdbg (struct dbcomm *d)
 
void dbfree (struct dbcomm *db)
 
void com_delete (wordlist *wl)
 
bool ft_bpcheck (struct plot *runplot, int iteration)
 
static bool print_trace (struct dbcomm *d, struct plot *plot, bool *flag)
 
void ft_trquery ()
 
int ft_getSaves (char ***savesp)
 
static char * spec (char **str)
 
static void printcond (struct dbcomm *d, FILE *fp)
 
static void unhackplot (int length)
 

Variables

static int debugcnt = 1
 
struct dbcommdbiplot = NULL
 
static struct dbcommdbtrace = NULL
 
static struct dbcommdbsave = NULL
 
static struct dbcommdbstop = NULL
 
static int howmanysteps = 0
 
static int steps = 0
 

Function Documentation

void com_delete ( wordlist wl)

Definition at line 373 of file breakp.c.

377 {
378  int i;
379  char *s, buf[64];
380  struct dbcomm *d, *dt, *dx;
381 
382  if (!wl) {
383  d = dbstop;
384  if (!d) d = dbtrace;
385  if (!d) d = dbiplot;
386  if (!d) d = dbsave;
387  if (!d) {
388  fprintf(cp_err, "Error: no debugs in effect\n");
389  return;
390  }
391  printdbg(d);
392  (void)SCEDfgets(buf,4,cp_in,"delete? [y] ");
393  if (*buf != 'y' && *buf != 'Y' && *buf != '\n')
394  return;
395  if (d == dbstop)
396  dbstop = d->db_next;
397  else if (d == dbtrace)
398  dbtrace = d->db_next;
399  else if (d == dbiplot)
400  dbiplot = d->db_next;
401  else if (d == dbsave)
402  dbsave = d->db_next;
403  dbfree(d);
404  return;
405  }
406 
407  while (wl) {
408  if (eq(wl->wl_word, "trace") || eq(wl->wl_word,"all")) {
409  for (dt = dbtrace; dt; dt = d) {
410  d = dt->db_next;
411  dbfree(dt);
412  }
413  dbtrace = NULL;
414  if (eq(wl->wl_word,"trace")) {
415  wl = wl->wl_next;
416  continue;
417  }
418  }
419  if (eq(wl->wl_word, "save") || eq(wl->wl_word,"all")) {
420  for (dt = dbsave; dt; dt = d) {
421  d = dt->db_next;
422  dbfree(dt);
423  }
424  dbsave = NULL;
425  if (eq(wl->wl_word,"save")) {
426  wl = wl->wl_next;
427  continue;
428  }
429  }
430  if (eq(wl->wl_word, "iplot") || eq(wl->wl_word,"all")) {
431  for (d = dbiplot; d; d = dx) {
432  dx = d->db_next;
433  dbfree(d);
434  }
435  dbiplot = NULL;
436  if (eq(wl->wl_word,"iplot")) {
437  wl = wl->wl_next;
438  continue;
439  }
440  }
441  if (eq(wl->wl_word, "stop") || eq(wl->wl_word,"all")) {
442  for (dt = dbstop; dt; dt = d) {
443  d = dt->db_next;
444  dbfree(dt);
445  }
446  dbstop = NULL;
447  wl = wl->wl_next;
448  continue;
449  }
450 
451  i = 0;
452  for (s = wl->wl_word; *s; s++) {
453  if (!isdigit(*s)) {
454  fprintf(cp_err, "Error: %s isn't a number.\n",
455  wl->wl_word);
456  break;
457  }
458  }
459  if (*s) {
460  wl = wl->wl_next;
461  continue;
462  }
463  i = atoi(wl->wl_word);
464  for (dt = NULL,d = dbtrace; d; dt = d,d = d->db_next) {
465  if (d->db_number != i) continue;
466  if (dt == NULL)
467  dbtrace = d->db_next;
468  else
469  dt->db_next = d->db_next;
470  dbfree(d);
471  goto foundit;
472  }
473  for (dt = NULL,d = dbiplot; d; dt = d,d = d->db_next) {
474  if (d->db_number != i) continue;
475  if (dt == NULL)
476  dbiplot = d->db_next;
477  else
478  dt->db_next = d->db_next;
479  dbfree(d);
480  goto foundit;
481  }
482  for (dt = NULL,d = dbsave; d; dt = d,d = d->db_next) {
483  if (d->db_number != i) continue;
484  if (dt == NULL)
485  dbsave = d->db_next;
486  else
487  dt->db_next = d->db_next;
488  dbfree(d);
489  goto foundit;
490  }
491  for (dt = NULL,d = dbstop; d; dt = d,d = d->db_next) {
492  if (d->db_number != i) continue;
493  if (dt == NULL)
494  dbstop = d->db_next;
495  else
496  dt->db_next = d->db_next;
497  dbfree(d);
498  }
499 foundit:
500  wl = wl->wl_next;
501  }
502 }
static char buf[MAXPROMPT]
Definition: arg.c:18
#define eq(a, b)
Definition: misc.h:29
Definition: cddefs.h:119
static void printdbg()
FILE * cp_err
Definition: help.c:101
static struct dbcomm * dbstop
Definition: breakp.c:38
Definition: cddefs.h:237
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
char * SCEDfgets(char *s, int n, FILE *fp, char *prompt)
Definition: scedstub.c:41
static struct dbcomm * dbtrace
Definition: breakp.c:36
static struct dbcomm * dbsave
Definition: breakp.c:37
struct dbcomm * dbiplot
Definition: breakp.c:35
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
FILE * cp_in
Definition: help.c:101
void dbfree(struct dbcomm *db)
Definition: breakp.c:356
void com_iplot ( wordlist wl)

Definition at line 172 of file breakp.c.

175 {
176  struct dbcomm *d, *td, *currentdb = NULL;
177  char *s;
178  char *which = NULL;
179 
180  /* We use a modified ad-hoc algorithm here where db_also denotes
181  * vectors on the same command line and db_next denotes
182  * separate iplot commands.
183  */
184 
185  /* The user can choose between the two graphics packages by
186  * entering "plot" or "graf" on the command line.
187  */
188 
189  for ( ; wl; wl = wl->wl_next) {
190  s = copy(wl->wl_word);
191  cp_unquote(s);
192 
193  if (eq(s,"plot") || eq(s,"graf")) {
194  which = s;
195  continue;
196  }
197  if (currentdb == NULL) {
198  d = currentdb = alloc(struct dbcomm);
199  }
200  else {
201  d->db_also = alloc(struct dbcomm);
202  d = d->db_also;
203  }
204  d->db_type = DB_IPLOT;
205  d->db_nodename1 = s;
206  }
207 
208  if (currentdb) {
209  currentdb->db_number = debugcnt++;
210  currentdb->db_nodename2 = which;
211  if (currentdb->db_nodename2 == NULL)
212  /* the default package */
213  currentdb->db_nodename2 = copy("plot");
214  if (dbiplot) {
215  for (td = dbiplot; td->db_next; td = td->db_next)
216  ;
217  td->db_next = currentdb;
218  }
219  else
220  dbiplot = currentdb;
221  }
222 }
#define eq(a, b)
Definition: misc.h:29
Definition: cddefs.h:119
#define alloc(type)
Definition: cdmacs.h:21
void cp_unquote()
char * copy()
char * db_nodename1
Definition: ftedebug.h:23
Definition: cddefs.h:237
char db_type
Definition: ftedebug.h:22
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
char * db_nodename2
Definition: ftedebug.h:24
struct dbcomm * dbiplot
Definition: breakp.c:35
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
struct dbcomm * db_also
Definition: ftedebug.h:27
int db_number
Definition: ftedebug.h:21
#define DB_IPLOT
Definition: ftedebug.h:16
static int debugcnt
Definition: breakp.c:34
void com_save ( wordlist wl)

Definition at line 228 of file breakp.c.

231 {
232  struct dbcomm *d = NULL, *td, *ld;
233  char *s;
234 
235  while (wl) {
236  s = copy(wl->wl_word);
237  cp_unquote(s);
238  d = alloc(struct dbcomm);
239  d->db_type = DB_SAVE;
240  d->db_nodename1 = s;
241  d->db_number = debugcnt++;
242  if (dbsave) {
243  ld = NULL;
244  for (td = dbsave; td; ld = td,td = td->db_next)
245  if (eq(td->db_nodename1,d->db_nodename1)) {
246  fprintf(cp_err, "Already saving %s, ignored.\n",
247  td->db_nodename1);
248  dbfree(d);
249  debugcnt--;
250  goto bot;
251  }
252  ld->db_next = d;
253  }
254  else
255  dbsave = d;
256 bot:
257  wl = wl->wl_next;
258  }
259 }
#define eq(a, b)
Definition: misc.h:29
Definition: cddefs.h:119
#define alloc(type)
Definition: cdmacs.h:21
void cp_unquote()
char * copy()
FILE * cp_err
Definition: help.c:101
char * db_nodename1
Definition: ftedebug.h:23
Definition: cddefs.h:237
char db_type
Definition: ftedebug.h:22
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
static struct dbcomm * dbsave
Definition: breakp.c:37
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
#define DB_SAVE
Definition: ftedebug.h:12
int db_number
Definition: ftedebug.h:21
static int debugcnt
Definition: breakp.c:34
void dbfree(struct dbcomm *db)
Definition: breakp.c:356
void com_step ( wordlist wl)

Definition at line 265 of file breakp.c.

268 {
269  if (wl)
270  steps = howmanysteps = atoi(wl->wl_word);
271  else
272  steps = howmanysteps = 1;
273  com_resume((wordlist *) NULL);
274  return;
275 }
static int howmanysteps
Definition: breakp.c:39
void com_resume()
#define NULL
Definition: spdefs.h:121
static int steps
Definition: breakp.c:40
Definition: cpstd.h:21
char * wl_word
Definition: cpstd.h:22
void com_stop ( wordlist wl)

Definition at line 51 of file breakp.c.

54 {
55  struct dbcomm *d, *thisone = NULL;
56  char *s, *t, buf[64];
57  int i;
58  double *val;
59  wordlist *wx;
60 
61  while (wl) {
62  if (thisone == NULL)
63  thisone = d = alloc(struct dbcomm);
64  else {
65  d->db_also = alloc(struct dbcomm);
66  d = d->db_also;
67  }
68 
69  /* Figure out what the first condition is. */
70  if (eq(wl->wl_word, "after")) {
71  d->db_type = DB_STOPAFTER;
72  i = 0;
73  wl = wl->wl_next;
74  if (wl) {
75  if (wl->wl_word) {
76  for (s = wl->wl_word; *s; s++)
77  if (!isdigit(*s))
78  goto bad;
79  i = atoi(wl->wl_word);
80  }
81  wl = wl->wl_next;
82  }
83  d->db_iteration = i;
84  continue;
85  }
86  if (eq(wl->wl_word, "when")) {
87  d->db_type = DB_STOPWHEN;
88  wl = wl->wl_next;
89  if (!wl)
90  goto bad;
91  for (i = 0,wx = wl; wx; wx = wx->wl_next) {
92  if (eq(wx->wl_word,"after") || eq(wx->wl_word,"when"))
93  break;
94  i += strlen(wx->wl_word) + 1;
95  }
96  i++;
97  s = d->db_nodename1 = tmalloc(i*sizeof(char));
98  strcpy(s,wl->wl_word);
99  s += strlen(s);
100  for (wl = wl->wl_next; wl; wl = wl->wl_next) {
101  if (eq(wl->wl_word,"after") || eq(wl->wl_word,"when"))
102  break;
103  t = wl->wl_word;
104  *s++ = ' ';
105  while (*t)
106  *s++ = *t++;
107  }
108  *s = '\0';
110  }
111  else
112  goto bad;
113  }
114  if (thisone) {
115  thisone->db_number = debugcnt++;
116  if (dbstop) {
117  for (d = dbstop; d->db_next; d = d->db_next)
118  ;
119  d->db_next = thisone;
120  }
121  else
122  dbstop = thisone;
123  }
124  return;
125 
126 bad:
127  fprintf(cp_err, "Syntax error.\n");
128  return;
129 }
static char buf[MAXPROMPT]
Definition: arg.c:18
#define eq(a, b)
Definition: misc.h:29
char * strcpy()
Definition: cddefs.h:119
#define alloc(type)
Definition: cdmacs.h:21
void cp_unquote()
#define DB_STOPWHEN
Definition: ftedebug.h:15
FILE * cp_err
Definition: help.c:101
char * tmalloc()
char * db_nodename1
Definition: ftedebug.h:23
static struct dbcomm * dbstop
Definition: breakp.c:38
Definition: cddefs.h:237
char db_type
Definition: ftedebug.h:22
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
Definition: cpstd.h:21
int db_iteration
Definition: ftedebug.h:25
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
#define DB_STOPAFTER
Definition: ftedebug.h:14
struct dbcomm * db_also
Definition: ftedebug.h:27
int db_number
Definition: ftedebug.h:21
Definition: cddefs.h:192
static int debugcnt
Definition: breakp.c:34
void com_sttus ( wordlist wl)

Definition at line 285 of file breakp.c.

288 {
289  struct dbcomm *d;
290 
291  for (d = dbstop; d; d = d->db_next)
292  printdbg(d);
293  for (d = dbtrace; d; d = d->db_next)
294  printdbg(d);
295  for (d = dbiplot; d; d = d->db_next)
296  printdbg(d);
297  for (d = dbsave; d; d = d->db_next)
298  printdbg(d);
299 }
static void printdbg()
static struct dbcomm * dbstop
Definition: breakp.c:38
Definition: cddefs.h:237
struct dbcomm * db_next
Definition: ftedebug.h:28
static struct dbcomm * dbtrace
Definition: breakp.c:36
static struct dbcomm * dbsave
Definition: breakp.c:37
struct dbcomm * dbiplot
Definition: breakp.c:35
void com_trce ( wordlist wl)

Definition at line 135 of file breakp.c.

138 {
139  struct dbcomm *d = NULL, *td, *ld;
140  char *s;
141 
142  while (wl) {
143  s = copy(wl->wl_word);
144  cp_unquote(s);
145  d = alloc(struct dbcomm);
146  d->db_type = DB_TRACE;
147  d->db_nodename1 = s;
148  d->db_number = debugcnt++;
149  if (dbtrace) {
150  ld = NULL;
151  for (td = dbtrace; td; ld = td, td = td->db_next)
152  if (eq(td->db_nodename1,d->db_nodename1)) {
153  fprintf(cp_err, "Already tracing %s, ignored.\n",
154  td->db_nodename1);
155  dbfree(d);
156  debugcnt--;
157  goto bot;
158  }
159  ld->db_next = d;
160  }
161  else
162  dbtrace = d;
163 bot:
164  wl = wl->wl_next;
165  }
166 }
#define eq(a, b)
Definition: misc.h:29
#define DB_TRACE
Definition: ftedebug.h:13
Definition: cddefs.h:119
#define alloc(type)
Definition: cdmacs.h:21
void cp_unquote()
char * copy()
FILE * cp_err
Definition: help.c:101
char * db_nodename1
Definition: ftedebug.h:23
Definition: cddefs.h:237
char db_type
Definition: ftedebug.h:22
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
static struct dbcomm * dbtrace
Definition: breakp.c:36
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
int db_number
Definition: ftedebug.h:21
static int debugcnt
Definition: breakp.c:34
void dbfree(struct dbcomm *db)
Definition: breakp.c:356
void dbfree ( struct dbcomm db)

Definition at line 356 of file breakp.c.

359 {
360  struct dbcomm *dd, *dn;
361 
362  for (dd = db; dd; dd = dn) {
363  dn = dd->db_also;
364  tfree(dd->db_nodename1);
365  tfree(dd->db_nodename2);
366  tfree(dd);
367  }
368  return;
369 }
char * db_nodename1
Definition: ftedebug.h:23
#define tfree(x)
Definition: cdmacs.h:22
char * db_nodename2
Definition: ftedebug.h:24
struct dbcomm * db_also
Definition: ftedebug.h:27
bool ft_bpcheck ( struct plot runplot,
int  iteration 
)

Definition at line 510 of file breakp.c.

514 {
515  struct dbcomm *d, *dt;
516  bool tflag = true;
517  bool after = true;
518  bool when = true;
519  bool nohalt = true;
520  wordlist wl;
521  int len;
522 
523  if (dbtrace || dbstop) {
524  len = hackplot();
525  for (d = dbtrace; d; d = d->db_next) {
526  if (d->db_type == DB_TRACE)
527  print_trace(d,runplot,&tflag);
528  }
529  for (d = dbstop; d; d = d->db_next) {
530  for (dt = d; dt; dt = dt->db_also) {
531  if (dt->db_type == DB_STOPAFTER) {
532  if (iteration != dt->db_iteration)
533  after = false;
534  }
535  else if (dt->db_type == DB_STOPWHEN) {
536  wl.wl_prev = wl.wl_next = NULL;
537  wl.wl_word = dt->db_nodename1;
538  if (!cp_istrue(&wl))
539  when = false;
540  }
541  }
542  if (when && after) {
543  fprintf(cp_err, "%-2d: condition met: stop ",d->db_number);
544  printcond(d, cp_err);
545  (void) putc('\n', cp_err);
546  nohalt = false;
547  }
548  }
549  unhackplot(len);
550  }
551 
552  if ((howmanysteps > 0) && (--howmanysteps == 0)) {
553  if (steps > 1)
554  fprintf(cp_err, "Stopped after %d steps.\n", steps);
555  return (false);
556  }
557  return (nohalt);
558 }
static int hackplot()
Definition: breakp.c:789
#define DB_TRACE
Definition: ftedebug.h:13
static int howmanysteps
Definition: breakp.c:39
static bool print_trace()
Definition: library.c:18
#define DB_STOPWHEN
Definition: ftedebug.h:15
FILE * cp_err
Definition: help.c:101
char * db_nodename1
Definition: ftedebug.h:23
struct wordlist * wl_prev
Definition: cpstd.h:24
static struct dbcomm * dbstop
Definition: breakp.c:38
Definition: cddefs.h:237
char db_type
Definition: ftedebug.h:22
static void unhackplot()
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
static struct dbcomm * dbtrace
Definition: breakp.c:36
static int steps
Definition: breakp.c:40
Definition: cpstd.h:21
int db_iteration
Definition: ftedebug.h:25
bool cp_istrue()
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
#define DB_STOPAFTER
Definition: ftedebug.h:14
struct dbcomm * db_also
Definition: ftedebug.h:27
int db_number
Definition: ftedebug.h:21
static void printcond()
int ft_getSaves ( char ***  savesp)

Definition at line 648 of file breakp.c.

651 {
652  struct dbcomm *d, *dd;
653  int count = 0, icount = 0, i = 0;
654  char *s, *var;
655  char **array;
656 
657  /* In addition to the saves, we hunt through all of the debugs
658  * for special variables that should be saved as well.
659  */
660 
661  for (d = dbtrace; d; d = d->db_next) {
662  s = d->db_nodename1;
663  while ((var = spec(&s)) != NULL) {
664  icount++;
665  free(var);
666  }
667  }
668  for (d = dbiplot; d; d = d->db_next) {
669  for (dd = d; dd; dd = dd->db_also) {
670  s = dd->db_nodename1;
671  while ((var = spec(&s)) != NULL) {
672  icount++;
673  free(var);
674  }
675  }
676  }
677  for (d = dbstop; d; d = d->db_next) {
678  for (dd = d; dd; dd = dd->db_also) {
679  s = dd->db_nodename1;
680  while ((var = spec(&s)) != NULL) {
681  icount++;
682  free(var);
683  }
684  }
685  }
686  for (d = dbsave; d; d = d->db_next)
687  count++;
688  icount += count;
689 
690  if (!icount)
691  return (0);
692  if (!count)
693  icount++;
694 
695  *savesp = array = (char **)tmalloc(sizeof(char *) * icount);
696 
697  if (!count)
698  array[i++] = copy("all");
699  else {
700  for (d = dbsave; d; d = d->db_next)
701  array[i++] = copy(d->db_nodename1);
702  }
703 
704  for (d = dbtrace; d; d = d->db_next) {
705  s = d->db_nodename1;
706  while ((var = spec(&s)) != NULL)
707  array[i++] = var;
708  }
709  for (d = dbiplot; d; d = d->db_next) {
710  s = d->db_nodename1;
711  while ((var = spec(&s)) != NULL)
712  array[i++] = var;
713  for (dd = d->db_also; dd; dd = dd->db_also) {
714  s = dd->db_nodename1;
715  while ((var = spec(&s)) != NULL)
716  array[i++] = var;
717  }
718  }
719  for (d = dbstop; d; d = d->db_next) {
720  s = d->db_nodename1;
721  while ((var = spec(&s)) != NULL)
722  array[i++] = var;
723  s = d->db_nodename2;
724  while ((var = spec(&s)) != NULL)
725  array[i++] = var;
726  }
727  return (icount);
728 }
Definition: cddefs.h:119
char * copy()
char * tmalloc()
char * db_nodename1
Definition: ftedebug.h:23
static struct dbcomm * dbstop
Definition: breakp.c:38
Definition: cddefs.h:237
#define NULL
Definition: spdefs.h:121
struct dbcomm * db_next
Definition: ftedebug.h:28
static char * spec()
char * db_nodename2
Definition: ftedebug.h:24
static struct dbcomm * dbtrace
Definition: breakp.c:36
static struct dbcomm * dbsave
Definition: breakp.c:37
struct dbcomm * dbiplot
Definition: breakp.c:35
int count
Definition: output.c:152
struct dbcomm * db_also
Definition: ftedebug.h:27
void free()
void ft_trquery ( )

Definition at line 641 of file breakp.c.

642 {
643  return;
644 }
static int hackplot ( )
static

Definition at line 789 of file breakp.c.

791 {
792  struct dvec *d;
793  int length;
794  wordlist *wl0, *wl;
795 
796  if (plot_cur->pl_scale)
797  length = plot_cur->pl_scale->v_length;
798  else
799  length = plot_cur->pl_dvecs->v_length;
800  if (length <= 1)
801  return (0);
802  length--;
804  for (wl = wl0; wl; wl = wl->wl_next) {
805  d = (struct dvec*)((char**)wl->wl_word)[1];
806  d->v_length = 1;
807  if (d->v_flags & VF_COMPLEX)
808  d->v_compdata += length;
809  else
810  d->v_realdata += length;
811  }
812  return (length);
813 }
struct plot * plot_cur
Definition: vectors.c:43
struct dvec * pl_dvecs
Definition: ftedata.h:67
Definition: library.c:18
void * pl_hashtab
Definition: ftedata.h:66
complex * v_compdata
Definition: ftedata.h:29
Definition: cddefs.h:237
struct dvec * pl_scale
Definition: ftedata.h:68
Definition: ftedata.h:24
Definition: cpstd.h:21
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
int v_length
Definition: ftedata.h:34
short v_flags
Definition: ftedata.h:27
double * v_realdata
Definition: ftedata.h:28
#define VF_COMPLEX
Definition: fteconst.h:40
void * htab_list()
static bool print_trace ( )
static
static bool print_trace ( struct dbcomm d,
struct plot plot,
bool flag 
)
static

Definition at line 564 of file breakp.c.

569 {
570 
571  struct dvec *v1;
572  struct pnode *pn;
573  double d1, d2;
574  char *s, *t, buf[128];
575  wordlist wl;
576  struct dvlist *dvl, *dv, dv0;
577 
578  if (*flag) {
579  v1 = plot->pl_scale;
580  if (v1) {
581  if (isreal(v1))
582  fprintf(cp_out,"%s = %s:\n",v1->v_name,
583  printnum(v1->v_realdata[0]));
584  else
585  fprintf(cp_out,"%s = %s:\n",v1->v_name,
586  printnum(realpart(&(v1->v_compdata[0]))));
587  }
588  *flag = false;
589  }
590 
591  if (d->db_nodename1) {
592 
593  wl.wl_next = wl.wl_prev = NULL;
594  wl.wl_word = d->db_nodename1;
595  pn = ft_getpnames(&wl, false);
596  if (!pn) {
597  fprintf(cp_err, "Error: can't find %s\n", d->db_nodename1);
598  return (false);
599  }
600  v1 = ft_evaluate(pn);
601  inp_pnfree(pn);
602 
603  if (v1 == NULL) {
604  fprintf(cp_err, "Error: can't find %s\n", d->db_nodename1);
605  return (false);
606  }
607  if (eq(d->db_nodename1,"all"))
608  dvl = v1->v_link2;
609  else {
610  dv0.dl_dvec = v1;
611  dv0.dl_next = NULL;
612  dvl = &dv0;
613  }
614  for (dv = dvl; dv; dv = dvl) {
615  dvl = dv->dl_next;
616  v1 = dv->dl_dvec;
617  if (v1 == plot->pl_scale)
618  continue;
619  if (isreal(v1))
620  fprintf(cp_out," %-10s %s\n",v1->v_name,
621  printnum(v1->v_realdata[0]));
622 
623  else
624  fprintf(cp_out," %-10s %s,%s\n",v1->v_name,
625  printnum(realpart(&(v1->v_compdata[0]))),
626  printnum(imagpart(&(v1->v_compdata[0]))));
627  }
628  }
629  return (true);
630 }
struct dvec * ft_evaluate()
static char buf[MAXPROMPT]
Definition: arg.c:18
#define eq(a, b)
Definition: misc.h:29
struct dvlist * v_link2
Definition: ftedata.h:44
char * printnum()
Definition: cddefs.h:119
Definition: ftedata.h:49
struct pnode * ft_getpnames()
Definition: library.c:18
complex * v_compdata
Definition: ftedata.h:29
struct dvlist * dl_next
Definition: ftedata.h:51
void inp_pnfree()
FILE * cp_err
Definition: help.c:101
char * db_nodename1
Definition: ftedebug.h:23
struct wordlist * wl_prev
Definition: cpstd.h:24
struct dvec * pl_scale
Definition: ftedata.h:68
#define NULL
Definition: spdefs.h:121
FILE * cp_out
Definition: help.c:101
#define isreal(v)
Definition: ftedata.h:54
Definition: ftedata.h:24
struct dvec * dl_dvec
Definition: ftedata.h:50
char * v_name
Definition: ftedata.h:25
#define imagpart(cval)
Definition: cpstd.h:36
Definition: cpstd.h:21
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
double * v_realdata
Definition: ftedata.h:28
Definition: cddefs.h:192
#define realpart(cval)
Definition: cpstd.h:35
Definition: fteparse.h:16
static void printcond ( )
static
static void printcond ( struct dbcomm d,
FILE *  fp 
)
static

Definition at line 762 of file breakp.c.

766 {
767  struct dbcomm *dt;
768  char buf[BSIZE_SP];
769 
770  for (dt = d; dt; dt = dt->db_also) {
771  if (dt->db_type == DB_STOPAFTER)
772  sprintf(buf, " after %ld",dt->db_iteration);
773  else
774  sprintf(buf, " when %s",dt->db_nodename1);
775  if (fp == cp_out)
776  (void)out_send(buf);
777  else
778  (void)fputs(buf, fp);
779  }
780 }
static char buf[MAXPROMPT]
Definition: arg.c:18
#define BSIZE_SP
Definition: misc.h:19
char * db_nodename1
Definition: ftedebug.h:23
char db_type
Definition: ftedebug.h:22
FILE * cp_out
Definition: help.c:101
int db_iteration
Definition: ftedebug.h:25
void out_send()
#define DB_STOPAFTER
Definition: ftedebug.h:14
struct dbcomm * db_also
Definition: ftedebug.h:27
static void printdbg ( )
static
static void printdbg ( struct dbcomm d)
static

Definition at line 303 of file breakp.c.

306 {
307  char *s1, *s2;
308  char *all = "all",*trace = "trace",*iplot = "iplot",*save = "save";
309  struct dbcomm *dc;
310 
311 
312  switch (d->db_type) {
313  case DB_SAVE:
314  s1 = save;
315  s2 = d->db_nodename1;
316  break;
317 
318  case DB_TRACE:
319  s1 = trace;
320  s2 = d->db_nodename1;
321  break;
322 
323  case DB_STOPWHEN:
324  case DB_STOPAFTER:
325  out_printf("%-4d stop", d->db_number);
326  printcond(d, cp_out);
327  out_send("\n");
328  return;
329 
330  case DB_IPLOT:
331  out_printf("%-4d %s (%s) %s", d->db_number, iplot,
332  d->db_nodename2, d->db_nodename1);
333  for (dc = d->db_also; dc; dc = dc->db_also)
334  out_printf(" %s", dc->db_nodename1);
335  out_send("\n");
336  return;
337 
338  case DB_DEADIPLOT:
339  out_printf("%-4d exiting iplot (%s) %s", d->db_number,
340  d->db_nodename2,dc->db_nodename1);
341  for (dc = d->db_also; dc; dc = dc->db_also)
342  out_printf(" %s", dc->db_nodename1);
343  out_send("\n");
344  return;
345 
346  default:
347  fprintf(cp_err,
348  "com_sttus: Internal Error: bad db %d...\n",d->db_type);
349  return;
350  }
351  out_printf("%-4d %s %s\n", d->db_number, s1, s2);
352 }
#define DB_TRACE
Definition: ftedebug.h:13
void out_printf()
#define DB_STOPWHEN
Definition: ftedebug.h:15
static void iplot()
FILE * cp_err
Definition: help.c:101
char * db_nodename1
Definition: ftedebug.h:23
char db_type
Definition: ftedebug.h:22
FILE * cp_out
Definition: help.c:101
char * db_nodename2
Definition: ftedebug.h:24
#define DB_DEADIPLOT
Definition: ftedebug.h:18
void out_send()
#define DB_SAVE
Definition: ftedebug.h:12
#define DB_STOPAFTER
Definition: ftedebug.h:14
struct dbcomm * db_also
Definition: ftedebug.h:27
int db_number
Definition: ftedebug.h:21
#define DB_IPLOT
Definition: ftedebug.h:16
static void printcond()
static char* spec ( )
static
static char* spec ( char **  str)
static

Definition at line 732 of file breakp.c.

735 {
736  /* yank out the 'special' vectors: those keyed with '@' */
737  char *t, *tt, *tok, c;
738 
739  if (!str || !*str)
740  return (NULL);
741  t = strchr(*str, '@');
742  if (t) {
743  tt = t+1;
744  while (*tt && (isalpha(*tt) || isdigit(*tt) || *tt == '_')) tt++;
745  if (*tt && *tt == '[') {
746  tt++;
747  while (*tt && *tt != ']') tt++;
748  if (*tt = ']') tt++;
749  }
750  c = *tt;
751  *tt = '\0';
752  tok = copy(t);
753  *tt = c;
754  *str = tt;
755  return (tok);
756  }
757  return (NULL);
758 }
Definition: xforms.c:16
char * copy()
#define NULL
Definition: spdefs.h:121
static double c
Definition: vectors.c:16
Definition: cddefs.h:192
static void unhackplot ( )
static
static void unhackplot ( int  length)
static

Definition at line 817 of file breakp.c.

820 {
821  struct dvec *d;
822  wordlist *wl0, *wl;
823 
824  if (length <= 0)
825  return;
827  for (wl = wl0; wl; wl = wl->wl_next) {
828  d = (struct dvec*)((char**)wl->wl_word)[1];
829  d->v_length = length + 1;
830  if (d->v_flags & VF_COMPLEX)
831  d->v_compdata -= length;
832  else
833  d->v_realdata -= length;
834  }
835 }
struct plot * plot_cur
Definition: vectors.c:43
Definition: library.c:18
void * pl_hashtab
Definition: ftedata.h:66
complex * v_compdata
Definition: ftedata.h:29
Definition: cddefs.h:237
Definition: ftedata.h:24
Definition: cpstd.h:21
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
int v_length
Definition: ftedata.h:34
short v_flags
Definition: ftedata.h:27
double * v_realdata
Definition: ftedata.h:28
#define VF_COMPLEX
Definition: fteconst.h:40
void * htab_list()

Variable Documentation

struct dbcomm* dbiplot = NULL

Definition at line 35 of file breakp.c.

struct dbcomm* dbsave = NULL
static

Definition at line 37 of file breakp.c.

struct dbcomm* dbstop = NULL
static

Definition at line 38 of file breakp.c.

struct dbcomm* dbtrace = NULL
static

Definition at line 36 of file breakp.c.

int debugcnt = 1
static

Definition at line 34 of file breakp.c.

int howmanysteps = 0
static

Definition at line 39 of file breakp.c.

int steps = 0
static

Definition at line 40 of file breakp.c.