Wild Life  2.29
 All Data Structures Files Functions Variables Typedefs Macros
Functions | Variables
error.c File Reference

Go to the source code of this file.

Functions

static long depth_gs ()
 
static long depth_cs ()
 
static long depth_ts ()
 
void stack_info (FILE *outfile)
 
void outputline (char *format,...)
 
void traceline (char *format,...)
 
void infoline (char *format,...)
 
void warningline (char *format,...)
 
void Errorline (char *format,...)
 
void Syntaxerrorline (char *format,...)
 
void init_trace ()
 
void reset_step ()
 
void tracing ()
 
void new_trace (long newtrace)
 
void new_step (long newstep)
 
void set_trace_to_prove ()
 
void toggle_trace ()
 
void toggle_step ()
 
void perr (char *str)
 
void perr_s (char *s1, char *s2)
 
void perr_s2 (char *s1, char *s2, char *s3)
 
void perr_i (char *str, long i)
 
long warning ()
 
long warningx ()
 
void report_error_main (ptr_psi_term g, char *s, char *s2)
 
void report_error (ptr_psi_term g, char *s)
 
long reportAndAbort (ptr_psi_term g, char *s)
 
void report_warning (ptr_psi_term g, char *s)
 
void report_error2_main (ptr_psi_term g, char *s, char *s2)
 
void report_error2 (ptr_psi_term g, char *s)
 
void report_warning2 (ptr_psi_term g, char *s)
 
void nonnum_warning (ptr_psi_term t, ptr_psi_term arg1, ptr_psi_term arg2)
 
long nonint_warning (ptr_psi_term arg, REAL val, char *msg)
 
long bit_and_warning (ptr_psi_term arg, REAL val)
 
long bit_or_warning (ptr_psi_term arg, REAL val)
 
long bit_not_warning (ptr_psi_term arg, REAL val)
 
long int_div_warning (ptr_psi_term arg, REAL val)
 
long mod_warning (ptr_psi_term arg, REAL val, int zero)
 
long shift_warning (long dir, ptr_psi_term arg, REAL val)
 

Variables

long warningflag =TRUE
 
long quietflag =FALSE
 
long trace =FALSE
 
long verbose =FALSE
 
long stepflag = 0
 
long steptrace = 0
 
long stepcount = 0
 

Function Documentation

long bit_and_warning ( ptr_psi_term  arg,
REAL  val 
)

Definition at line 824 of file error.c.

References nonint_warning().

827 {
828  return nonint_warning(arg,val,"of bitwise 'and' operation is not an integer");
829 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
long bit_not_warning ( ptr_psi_term  arg,
REAL  val 
)

Definition at line 838 of file error.c.

References nonint_warning().

841 {
842  return nonint_warning(arg,val,"of bitwise 'not' operation is not an integer");
843 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
long bit_or_warning ( ptr_psi_term  arg,
REAL  val 
)

Definition at line 831 of file error.c.

References nonint_warning().

834 {
835  return nonint_warning(arg,val,"of bitwise 'or' operation is not an integer");
836 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
static long depth_cs ( )
static

Definition at line 37 of file error.c.

References choice_stack, and wl_choice_point::next.

38 {
39  long i=0;
41 
42  while (c) { i++; c=c->next; }
43  return i;
44 }
ptr_choice_point next
Definition: def_struct.h:235
ptr_choice_point choice_stack
Definition: def_glob.h:51
static long depth_gs ( )
static

Definition at line 26 of file error.c.

References goal_stack, and wl_goal::next.

27 {
28  long i=0;
30 
31  while (g) { i++; g=g->next; }
32  return i;
33 }
ptr_goal goal_stack
Definition: def_glob.h:50
ptr_goal next
Definition: def_struct.h:227
static long depth_ts ( )
static

Definition at line 48 of file error.c.

References wl_stack::next, and undo_stack.

49 {
51  long i=0;
52 
53  while (t) { i++; t=t->next; }
54  return i;
55 }
ptr_stack undo_stack
Definition: def_glob.h:53
ptr_stack next
Definition: def_struct.h:219
void Errorline ( char *  format,
  ... 
)

Definition at line 414 of file error.c.

References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.

415 {
416  va_list VarArg;
417  // int l;
418  char buffer_loc[5];
419  char *p;
420  unsigned long lng2;
421  char *cptr;
422  ptr_int_list pil;
423  ptr_psi_term psi;
424  operator kind;
425  def_type t ;
426 
427  va_start(VarArg,format);
428  // fprintf(stderr,"format = %lx %s\n",(long)format,format);fflush(stdout);
429  fprintf(stderr,"*** Error: ");
430  // fprintf(stderr,"format2 = %lx %s\n",(long)format,format);
431  // vinfoline(format, stderr, VarArg);
432  //#define vinfoline(format, stderr, xxxx) {
433  for (p=format;p && *p; p++)
434  {
435  if (*p == '%')
436  {
437  p++;
438  switch (*p)
439  {
440  case 'd':
441  case 'x':
442  buffer_loc[0] = '%';
443  buffer_loc[1] = 'l';
444  buffer_loc[2] = *p;
445  buffer_loc[3] = 0;
446  lng2 = va_arg(VarArg,long);
447  fprintf(stderr, buffer_loc, lng2);
448  break;
449  case 's':
450  buffer_loc[0] = '%';
451  buffer_loc[1] = *p;
452  buffer_loc[2] = 0;
453  cptr = va_arg(VarArg,char *);
454  fprintf(stderr, buffer_loc, cptr);
455  break;
456  case 'C':
457  /* type coding as bin string */
458  pil = va_arg(VarArg,ptr_int_list);
459  print_code(stderr,pil);
460  break;
461  case 'P':
462  psi = va_arg(VarArg,ptr_psi_term);
463  display_psi(stderr,psi);
464  break;
465  case 'O':
466  kind = va_arg(VarArg,operator);
467  print_operator_kind(stderr,kind);
468  break;
469  case 'T':
470  assert(stderr==stderr);
471  t = va_arg(VarArg,def_type);
472  print_def_type(t);
473  break;
474  case 'E':
475  assert(stderr==stderr);
476  perr_i("near line %ld",psi_term_line_number);
477  if (strcmp(input_file_name,"stdin")) {
478  perr_s(" in file \042%s\042",input_file_name);
479  }
480  parse_ok=FALSE;
481  break;
482  case '%':
483  (void)putc(*p,stderr);
484  break;
485  default:
486  fprintf(stderr,"<%c follows %% : report bug >", *p);
487  break;
488  }
489  }
490  else
491  (void)putc(*p,stderr);
492  }
493  va_end(VarArg);
494 #ifdef CLIFE
495 exit(0);
496 #endif
497 }
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
void infoline ( char *  format,
  ... 
)

Definition at line 245 of file error.c.

References assert, display_psi(), FALSE, input_file_name, NOTQUIET, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.

246 {
247  va_list VarArg;
248  // int l;
249  char buffer_loc[5];
250  char *p;
251  unsigned long lng2;
252  char *cptr;
253  ptr_int_list pil;
254  ptr_psi_term psi;
255  operator kind;
256  def_type t ;
257 
258  va_start(VarArg,format);
259  if (NOTQUIET)
260  {
261 
262  // vinfoline(format, stdout, VarArg);
263  //#define vinfoline(format, outfile, xxxx) {
264  for (p=format;p && *p; p++)
265  {
266  if (*p == '%')
267  {
268  p++;
269  switch (*p)
270  {
271  case 'd':
272  case 'x':
273  buffer_loc[0] = '%';
274  buffer_loc[1] = 'l';
275  buffer_loc[2] = *p;
276  buffer_loc[3] = 0;
277  lng2 = va_arg(VarArg,long);
278  fprintf(stdout, buffer_loc, lng2);
279  break;
280  case 's':
281  buffer_loc[0] = '%';
282  buffer_loc[1] = *p;
283  buffer_loc[2] = 0;
284  cptr = va_arg(VarArg,char *);
285  fprintf(stdout, buffer_loc, cptr);
286  break;
287  case 'C':
288  /* type coding as bin string */
289  pil = va_arg(VarArg,ptr_int_list);
290  print_code(stdout,pil);
291  break;
292  case 'P':
293  psi = va_arg(VarArg,ptr_psi_term);
294  display_psi(stdout,psi);
295  break;
296  case 'O':
297  kind = va_arg(VarArg,operator);
298  print_operator_kind(stdout,kind);
299  break;
300  case 'T':
301  assert(stdout==stderr);
302  t = va_arg(VarArg,def_type);
303  print_def_type(t);
304  break;
305  case 'E':
306  assert(stdout==stderr);
307  perr_i("near line %ld",psi_term_line_number);
308  if (strcmp(input_file_name,"stdin")) {
309  perr_s(" in file 042%s042",input_file_name);
310  }
311  parse_ok=FALSE;
312  break;
313  case '%':
314  (void)putc(*p,stdout);
315  break;
316  default:
317  fprintf(stdout,"<%c follows %% : report bug >", *p);
318  break;
319  }
320  }
321  else
322  (void)putc(*p,stdout);
323  }
324  }
325  va_end(VarArg);
326 }
#define NOTQUIET
Definition: def_macro.h:10
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
void init_trace ( )

Definition at line 587 of file error.c.

References FALSE, stepcount, stepflag, and trace.

588 {
589  trace=FALSE;
590  stepflag=FALSE;
591  stepcount=0;
592 }
#define FALSE
Definition: def_const.h:128
long stepcount
Definition: error.c:22
long trace
Definition: error.c:18
long stepflag
Definition: error.c:20
long int_div_warning ( ptr_psi_term  arg,
REAL  val 
)

Definition at line 845 of file error.c.

References nonint_warning().

848 {
849  return nonint_warning(arg,val,"of integer division is not an integer");
850 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
long mod_warning ( ptr_psi_term  arg,
REAL  val,
int  zero 
)

Definition at line 852 of file error.c.

References Errorline(), nonint_warning(), and TRUE.

856 {
857  int err;
858 
859  err=nonint_warning(arg,val,"of modulo operation is not an integer");
860  if(!err && zero && val==0) {
861  Errorline("division by 0 in modulo operation\n");
862  err=TRUE;
863  }
864  return err;
865 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
void Errorline(char *format,...)
Definition: error.c:414
#define TRUE
Definition: def_const.h:127
void new_step ( long  newstep)

Definition at line 629 of file error.c.

References FALSE, new_trace(), stepflag, and steptrace.

631 {
632  stepflag = newstep;
633  printf("*** Single stepping is turned ");
634  printf(stepflag?"on.\n":"off.\n");
637 }
long steptrace
Definition: error.c:21
void new_trace(long newtrace)
Definition: error.c:619
#define FALSE
Definition: def_const.h:128
long stepflag
Definition: error.c:20
void new_trace ( long  newtrace)

Definition at line 619 of file error.c.

References trace.

621 {
622  trace = newtrace;
623  printf("*** Tracing is turned ");
624  printf(trace?"on.":"off.");
625  if (trace == 2) printf(" Only for Proves");
626  printf("\n");
627 }
long trace
Definition: error.c:18
long nonint_warning ( ptr_psi_term  arg,
REAL  val,
char *  msg 
)

Definition at line 810 of file error.c.

References FALSE, report_warning2(), and TRUE.

814 {
815  long err=FALSE;
816 
817  if (val!=floor(val)) {
818  report_warning2(arg, msg);
819  err=TRUE;
820  }
821  return err;
822 }
void report_warning2(ptr_psi_term g, char *s)
Definition: error.c:785
#define TRUE
Definition: def_const.h:127
#define FALSE
Definition: def_const.h:128
void nonnum_warning ( ptr_psi_term  t,
ptr_psi_term  arg1,
ptr_psi_term  arg2 
)

Definition at line 796 of file error.c.

References curried, overlap_type(), real, and report_warning().

798 {
799  if (!curried && /* PVR 15.9.93 */
800  ((arg1 && !overlap_type(arg1->type,real)) ||
801  (arg2 && !overlap_type(arg2->type,real)))) {
802  report_warning(t,"non-numeric argument(s)");
803  }
804 }
long overlap_type(ptr_definition t1, ptr_definition t2)
Definition: types.c:1486
ptr_definition real
Definition: def_glob.h:102
long curried
Definition: def_glob.h:223
ptr_definition type
Definition: def_struct.h:165
void report_warning(ptr_psi_term g, char *s)
Definition: error.c:746
void outputline ( char *  format,
  ... 
)

Definition at line 79 of file error.c.

References assert, display_psi(), FALSE, input_file_name, output_stream, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.

80 {
81  va_list VarArg;
82  // int l;
83  char buffer_loc[5];
84  char *p;
85  unsigned long lng2;
86  char *cptr;
87  ptr_int_list pil;
88  ptr_psi_term psi;
89  operator kind;
90  def_type t ;
91  va_start(VarArg,format);
92  // vinfoline(format,output_stream, VarArg);
93  // #define vinfoline(format, outfile, xxxx) {
94  for (p=format;p && *p; p++)
95  {
96  if (*p == '%')
97  {
98  p++;
99  switch (*p)
100  {
101  case 'd':
102  case 'x':
103  buffer_loc[0] = '%';
104  buffer_loc[1] = 'l';
105  buffer_loc[2] = *p;
106  buffer_loc[3] = 0;
107  lng2 = va_arg(VarArg, long);
108  fprintf(output_stream, buffer_loc, lng2);
109  break;
110  case 's':
111  buffer_loc[0] = '%';
112  buffer_loc[1] = *p;
113  buffer_loc[2] = 0;
114  cptr = va_arg(VarArg,char *);
115  fprintf(output_stream, buffer_loc, cptr);
116  break;
117  case 'C':
118  /* type coding as bin string */
119  pil = va_arg(VarArg,ptr_int_list);
121  break;
122  case 'P':
123  psi = va_arg(VarArg,ptr_psi_term);
125  break;
126  case 'O':
127  kind = va_arg(VarArg,operator);
129  break;
130  case 'T':
131  assert(output_stream==stderr);
132  t = va_arg(VarArg,def_type);
133  print_def_type(t);
134  break;
135  case 'E':
136  assert(output_stream==stderr);
137  perr_i("near line %ld",psi_term_line_number);
138  if (strcmp(input_file_name,"stdin")) {
139  perr_s(" in file \042%s\042",input_file_name);
140  }
141  parse_ok=FALSE;
142  break;
143  case '%':
144  (void)putc(*p,output_stream);
145  break;
146  default:
147  fprintf(output_stream,"<%c follows %% : report bug >", *p);
148  break;
149  }
150  }
151  else
152  (void)putc(*p,output_stream);
153  }
154  va_end(VarArg);
155 }
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
FILE * output_stream
Definition: def_glob.h:41
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
void perr ( char *  str)

Definition at line 659 of file error.c.

661 {
662  (void)fputs(str, stderr);
663 }
void perr_i ( char *  str,
long  i 
)

Definition at line 677 of file error.c.

680 {
681  fprintf(stderr,str,i);
682 }
void perr_s ( char *  s1,
char*  s2 
)

Definition at line 665 of file error.c.

667 {
668  fprintf(stderr,s1,s2);
669 }
void perr_s2 ( char *  s1,
char*  s2,
char*  s3 
)

Definition at line 671 of file error.c.

673 {
674  fprintf(stderr,s1,s2,s3);
675 }
void report_error ( ptr_psi_term  g,
char *  s 
)

Definition at line 718 of file error.c.

References report_error_main().

721 {
722  report_error_main(g,s,"Error");
723 }
void report_error_main(ptr_psi_term g, char *s, char *s2)
Definition: error.c:700
void report_error2 ( ptr_psi_term  g,
char *  s 
)

Definition at line 772 of file error.c.

References report_error2_main().

775 {
776  report_error2_main(g,s,"Error");
777 }
void report_error2_main(ptr_psi_term g, char *s, char *s2)
Definition: error.c:755
void report_error2_main ( ptr_psi_term  g,
char *  s,
char *  s2 
)

Definition at line 755 of file error.c.

References display_psi_stderr(), and perr_s().

758 {
759  // FILE *f;
760 
761  perr_s("*** %s: argument '",s2);
763  perr_s("' %s.\n",s);
764 }
void display_psi_stderr(ptr_psi_term t)
Definition: print.c:1438
void perr_s(char *s1, char *s2)
Definition: error.c:665
void report_error_main ( ptr_psi_term  g,
char *  s,
char *  s2 
)

Definition at line 700 of file error.c.

References display_psi_stderr(), perr(), and perr_s2().

703 {
704  // FILE *f;
705 
706  perr_s2("*** %s: %s in '",s2,s);
708  perr("'.\n");
709 }
void perr_s2(char *s1, char *s2, char *s3)
Definition: error.c:671
void display_psi_stderr(ptr_psi_term t)
Definition: print.c:1438
void perr(char *str)
Definition: error.c:659
void report_warning ( ptr_psi_term  g,
char *  s 
)

Definition at line 746 of file error.c.

References report_error_main(), and warningflag.

749 {
750  if (warningflag) report_error_main(g,s,"Warning");
751 }
long warningflag
Definition: error.c:16
void report_error_main(ptr_psi_term g, char *s, char *s2)
Definition: error.c:700
void report_warning2 ( ptr_psi_term  g,
char *  s 
)

Definition at line 785 of file error.c.

References report_error2_main(), and warningflag.

788 {
789  if (warningflag) report_error2_main(g,s,"Warning");
790 }
long warningflag
Definition: error.c:16
void report_error2_main(ptr_psi_term g, char *s, char *s2)
Definition: error.c:755
long reportAndAbort ( ptr_psi_term  g,
char *  s 
)

Definition at line 732 of file error.c.

References abort_life(), report_error_main(), and TRUE.

735 {
736  report_error_main(g,s,"Error");
737  return abort_life(TRUE); // djd added TRUE
738 }
void report_error_main(ptr_psi_term g, char *s, char *s2)
Definition: error.c:700
long abort_life(int nlflag)
Definition: built_ins.c:2124
#define TRUE
Definition: def_const.h:127
void reset_step ( )

Definition at line 596 of file error.c.

References stepcount, stepflag, and TRUE.

597 {
598  if (stepcount>0) {
599  stepcount=0;
600  stepflag=TRUE;
601  }
602 }
#define TRUE
Definition: def_const.h:127
long stepcount
Definition: error.c:22
long stepflag
Definition: error.c:20
void set_trace_to_prove ( )

Definition at line 639 of file error.c.

References new_trace().

640 {
641  new_trace(2);
642 }
void new_trace(long newtrace)
Definition: error.c:619
long shift_warning ( long  dir,
ptr_psi_term  arg,
REAL  val 
)

Definition at line 867 of file error.c.

References nonint_warning().

871 {
872  if (dir)
873  return nonint_warning(arg,val,"of right shift operation is not an integer");
874  else
875  return nonint_warning(arg,val,"of left shift operation is not an integer");
876 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
Definition: error.c:810
void stack_info ( FILE *  outfile)

Definition at line 58 of file error.c.

References depth_cs(), depth_gs(), depth_ts(), and verbose.

60 {
61  /* Information about size of embedded stacks */
62  if (verbose) {
63  long gn,cn,tn;
64  fprintf(outfile,"*** Stack depths [");
65  gn=depth_gs();
66  cn=depth_cs();
67  tn=depth_ts();
68  fprintf(outfile,"%ld goal%s, %ld choice point%s, %ld trail entr%s",
69  gn,(gn!=1?"s":""),
70  cn,(cn!=1?"s":""),
71  tn,(tn!=1?"ies":"y"));
72  fprintf(outfile,"]\n");
73  }
74 }
static long depth_gs()
Definition: error.c:26
long verbose
Definition: error.c:19
static long depth_ts()
Definition: error.c:48
FILE * outfile
Definition: def_glob.h:333
static long depth_cs()
Definition: error.c:37
void Syntaxerrorline ( char *  format,
  ... 
)

Definition at line 498 of file error.c.

References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.

499 {
500  va_list VarArg;
501  // int l;
502  char buffer_loc[5];
503  char *p;
504  unsigned long lng2;
505  char *cptr;
506  ptr_int_list pil;
507  ptr_psi_term psi;
508  operator kind;
509  def_type t ;
510  va_start(VarArg,format);
511  // fprintf(stderr,"format = %lx %s\n",(long)format,format);fflush(stdout);
512  if(parse_ok) { /* RM: Feb 1 1993 */
513  parse_ok=FALSE; /* RM: Feb 1 1993 */
514  fprintf(stderr,"*** Syntax error: ");
515  // fprintf(stderr,"format2 = %lx %s\n",(long)format,format);
516  // vinfoline(format, stderr, VarArg);
517  //#define vinfoline(format, outfile, xxxx) {
518  for (p=format;p && *p; p++)
519  {
520  if (*p == '%')
521  {
522  p++;
523  switch (*p)
524  {
525  case 'd':
526  case 'x':
527  buffer_loc[0] = '%';
528  buffer_loc[1] = 'l';
529  buffer_loc[2] = *p;
530  buffer_loc[3] = 0;
531  lng2 = va_arg(VarArg,long);
532  fprintf(stderr, buffer_loc, lng2);
533  break;
534  case 's':
535  buffer_loc[0] = '%';
536  buffer_loc[1] = *p;
537  buffer_loc[2] = 0;
538  cptr = va_arg(VarArg,char *);
539  fprintf(stderr, buffer_loc, cptr);
540  break;
541  case 'C':
542  /* type coding as bin string */
543  pil = va_arg(VarArg,ptr_int_list);
544  print_code(stderr,pil);
545  break;
546  case 'P':
547  psi = va_arg(VarArg,ptr_psi_term);
548  display_psi(stderr,psi);
549  break;
550  case 'O':
551  kind = va_arg(VarArg,operator);
552  print_operator_kind(stderr,kind);
553  break;
554  case 'T':
555  assert(stderr==stderr);
556  t = va_arg(VarArg,def_type);
557  print_def_type(t);
558  break;
559  case 'E':
560  assert(stderr==stderr);
561  perr_i("near line %ld",psi_term_line_number);
562  if (strcmp(input_file_name,"stdin")) {
563  perr_s(" in file \042%s\042",input_file_name);
564  }
565  parse_ok=FALSE;
566  break;
567  case '%':
568  (void)putc(*p,stderr);
569  break;
570  default:
571  fprintf(stderr,"<%c follows %% : report bug >", *p);
572  break;
573  }
574  }
575  else
576  (void)putc(*p,stderr);
577  }
578  }
579  va_end(VarArg);
580 }
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
void toggle_step ( )

Definition at line 650 of file error.c.

References new_step(), and stepflag.

651 {
652  new_step(!stepflag);
653 }
void new_step(long newstep)
Definition: error.c:629
long stepflag
Definition: error.c:20
void toggle_trace ( )

Definition at line 644 of file error.c.

References new_trace(), and trace.

645 {
646  new_trace(trace?0:1);
647 }
void new_trace(long newtrace)
Definition: error.c:619
long trace
Definition: error.c:18
void traceline ( char *  format,
  ... 
)

Definition at line 157 of file error.c.

References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), psi_term_line_number, trace, and tracing().

158 {
159  va_list VarArg;
160  // int l;
161  char buffer_loc[5];
162  char *p;
163  unsigned long lng2;
164  char *cptr;
165  ptr_int_list pil;
166  ptr_psi_term psi;
167  operator kind;
168  def_type t ;
169 
170  va_start(VarArg,format);
171 
172  if (trace) // DJD
173  {
174  /* RM: Nov 10 1993 */
175 
176  if ((trace == 2) && (format[0] != 'p')) return;
177  tracing();
178 
179  // vinfoline(format, stdout, VarArg);
180  // #define vinfoline(format, outfile, xxxx) {
181  for (p=format;p && *p; p++)
182  {
183  if (*p == '%')
184  {
185  p++;
186  switch (*p)
187  {
188  case 'd':
189  case 'x':
190  buffer_loc[0] = '%';
191  buffer_loc[1] = 'l';
192  buffer_loc[2] = *p;
193  buffer_loc[3] = 0;
194  lng2 = va_arg(VarArg, long);
195  fprintf(stdout, buffer_loc, lng2);
196  break;
197  case 's':
198  buffer_loc[0] = '%';
199  buffer_loc[1] = *p;
200  buffer_loc[2] = 0;
201  cptr = va_arg(VarArg,char *);
202  fprintf(stdout, buffer_loc, cptr);
203  break;
204  case 'C':
205  /* type coding as bin string */
206  pil = va_arg(VarArg,ptr_int_list);
207  print_code(stdout,pil);
208  break;
209  case 'P':
210  psi = va_arg(VarArg,ptr_psi_term);
211  display_psi(stdout,psi);
212  break;
213  case 'O':
214  kind = va_arg(VarArg,operator);
215  print_operator_kind(stdout,kind);
216  break;
217  case 'T':
218  assert(stdout==stderr);
219  t = va_arg(VarArg,def_type);
220  print_def_type(t);
221  break;
222  case 'E':
223  assert(stdout==stderr);
224  perr_i("near line %ld",psi_term_line_number);
225  if (strcmp(input_file_name,"stdin")) {
226  perr_s(" in file \042%s\042",input_file_name);
227  }
228  parse_ok=FALSE;
229  break;
230  case '%':
231  (void)putc(*p,stdout);
232  break;
233  default:
234  fprintf(stdout,"<%c follows %% : report bug >", *p);
235  break;
236  }
237  }
238  else
239  (void)putc(*p,stdout);
240  }
241  }
242  va_end(VarArg);
243 }
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void tracing()
Definition: error.c:604
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
long trace
Definition: error.c:18
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
void tracing ( )

Definition at line 604 of file error.c.

References depth_cs(), depth_gs(), goal_count, MAX_TRACE_INDENT, steptrace, and TRUE.

605 {
606  long i;
607  long indent_loc;
608 
609  printf("T%04ld",goal_count);
610  printf(" C%02ld",depth_cs());
611  indent_loc=depth_gs();
612  if (indent_loc>=MAX_TRACE_INDENT) printf(" G%02ld",indent_loc);
613  indent_loc = indent_loc % MAX_TRACE_INDENT;
614  for (i=indent_loc; i>=0; i--) printf(" ");
615  steptrace=TRUE;
616 }
static long depth_gs()
Definition: error.c:26
#define MAX_TRACE_INDENT
Definition: def_const.h:120
long steptrace
Definition: error.c:21
long goal_count
Definition: def_glob.h:152
#define TRUE
Definition: def_const.h:127
static long depth_cs()
Definition: error.c:37
long warning ( )

Definition at line 685 of file error.c.

References perr(), and warningflag.

686 {
687  if (warningflag) perr("*** Warning: ");
688  return warningflag;
689 }
long warningflag
Definition: error.c:16
void perr(char *str)
Definition: error.c:659
void warningline ( char *  format,
  ... 
)

Definition at line 327 of file error.c.

References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), psi_term_line_number, quietflag, and warningflag.

328 {
329  va_list VarArg;
330  // int l;
331  char buffer_loc[5];
332  char *p;
333  unsigned long lng2;
334  char *cptr;
335  ptr_int_list pil;
336  ptr_psi_term psi;
337  operator kind;
338  def_type t ;
339 
340  va_start(VarArg,format);
341 
342  if (warningflag) { // macro would not work
343 
344 
345  if(quietflag) return; /* RM: Sep 24 1993 */
346  fprintf(stderr,"*** Warning: ");
347  // vinfoline(format, stderr, VarArg);
348  // #define vinfoline(format, stderr, xxxx) {
349  for (p=format;p && *p; p++)
350  {
351  if (*p == '%')
352  {
353  p++;
354  switch (*p)
355  {
356  case 'd':
357  case 'x':
358  buffer_loc[0] = '%';
359  buffer_loc[1] = 'l';
360  buffer_loc[2] = *p;
361  buffer_loc[3] = 0;
362  lng2 = va_arg(VarArg,long);
363  fprintf(stderr, buffer_loc, lng2);
364  break;
365  case 's':
366  buffer_loc[0] = '%';
367  buffer_loc[1] = *p;
368  buffer_loc[2] = 0;
369  cptr = va_arg(VarArg,char *);
370  fprintf(stderr, buffer_loc, cptr);
371  break;
372  case 'C':
373  /* type coding as bin string */
374  pil = va_arg(VarArg,ptr_int_list);
375  print_code(stderr,pil);
376  break;
377  case 'P':
378  psi = va_arg(VarArg,ptr_psi_term);
379  display_psi(stderr,psi);
380  break;
381  case 'O':
382  kind = va_arg(VarArg,operator);
383  print_operator_kind(stderr,kind);
384  break;
385  case 'T':
386  assert(stderr==stderr);
387  t = va_arg(VarArg,def_type);
388  print_def_type(t);
389  break;
390  case 'E':
391  assert(stderr==stderr);
392  perr_i("near line %ld",psi_term_line_number);
393  if (strcmp(input_file_name,"stdin")) {
394  perr_s(" in file 042%s042",input_file_name);
395  }
396  parse_ok=FALSE;
397  break;
398  case '%':
399  (void)putc(*p,stderr);
400  break;
401  default:
402  fprintf(stderr,"<%c follows %% : report bug >", *p);
403  break;
404  }
405  }
406  else
407  (void)putc(*p,stderr);
408  }
409  }
410  va_end(VarArg);
411 }
long warningflag
Definition: error.c:16
void perr_i(char *str, long i)
Definition: error.c:677
long psi_term_line_number
Definition: def_glob.h:268
string input_file_name
Definition: def_glob.h:40
void display_psi(FILE *s, ptr_psi_term t)
Definition: print.c:1460
void perr_s(char *s1, char *s2)
Definition: error.c:665
void print_code(FILE *s, ptr_int_list c)
Definition: print.c:147
void print_def_type(def_type t)
Definition: types.c:21
#define FALSE
Definition: def_const.h:128
long quietflag
Definition: error.c:17
long parse_ok
Definition: def_glob.h:171
void print_operator_kind(FILE *s, long kind)
Definition: print.c:173
#define assert(N)
Definition: memory.c:104
long warningx ( )

Definition at line 692 of file error.c.

References perr(), and warningflag.

693 {
694  if (warningflag) perr("*** Warning");
695  return warningflag;
696 }
long warningflag
Definition: error.c:16
void perr(char *str)
Definition: error.c:659

Variable Documentation

long quietflag =FALSE

Definition at line 17 of file error.c.

long stepcount = 0

Definition at line 22 of file error.c.

long stepflag = 0

Definition at line 20 of file error.c.

long steptrace = 0

Definition at line 21 of file error.c.

long trace =FALSE

Definition at line 18 of file error.c.

long verbose =FALSE

Definition at line 19 of file error.c.

long warningflag =TRUE

Definition at line 16 of file error.c.