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

error messaging, etc. More...

Go to the source code of this file.

Functions

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

Variables

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

Detailed Description

error messaging, etc.

Definition in file error.c.

Function Documentation

long bit_and_warning ( ptr_psi_term  arg,
REAL  val 
)

bit_and_warning

Parameters
arg- ptr_psi_term arg
val- REAL val

Definition at line 992 of file error.c.

References nonint_warning().

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

bit_not_warning

Parameters
arg- ptr_psi_term arg
val- REAL val

Definition at line 1016 of file error.c.

References nonint_warning().

1017 {
1018  return nonint_warning(arg,val,"of bitwise 'not' operation is not an integer");
1019 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
nonint_warning
Definition: error.c:974
long bit_or_warning ( ptr_psi_term  arg,
REAL  val 
)

bit_or_warning

Parameters
arg- ptr_psi_term arg
val- REAL val

Definition at line 1004 of file error.c.

References nonint_warning().

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

depth_cs

Depth of choice point stack

Definition at line 47 of file error.c.

References choice_stack, and wl_choice_point::next.

48 {
49  long i=0;
51 
52  while (c) { i++; c=c->next; }
53  return i;
54 }
ptr_choice_point next
Definition: def_struct.h:250
ptr_choice_point choice_stack
Definition: def_glob.h:1026
static long depth_gs ( )
static

depth_gs

Depth of goal stack

Definition at line 33 of file error.c.

References goal_stack, and wl_goal::next.

34 {
35  long i=0;
37 
38  while (g) { i++; g=g->next; }
39  return i;
40 }
ptr_goal goal_stack
Definition: def_glob.h:1025
ptr_goal next
Definition: def_struct.h:242
static long depth_ts ( )
static

depth_ts

Depth of trail (undo) stack

Definition at line 62 of file error.c.

References wl_stack::next, and undo_stack.

63 {
65  long i=0;
66 
67  while (t) { i++; t=t->next; }
68  return i;
69 }
ptr_stack undo_stack
Definition: def_glob.h:1027
ptr_stack next
Definition: def_struct.h:234
void Errorline ( char *  format,
  ... 
)

Errorline.

Parameters
format- char *format
...New error printing routine

Definition at line 465 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.

466 {
467  va_list VarArg;
468  // int l;
469  char buffer_loc[5];
470  char *p;
471  unsigned long lng2;
472  char *cptr;
473  ptr_int_list pil;
474  ptr_psi_term psi;
475  operator kind;
476  def_type t ;
477 
478  va_start(VarArg,format);
479  // fprintf(stderr,"format = %lx %s\n",(long)format,format);fflush(stdout);
480  fprintf(stderr,"*** Error: ");
481  // fprintf(stderr,"format2 = %lx %s\n",(long)format,format);
482  // vinfoline(format, stderr, VarArg);
483  //#define vinfoline(format, stderr, xxxx) {
484  for (p=format;p && *p; p++)
485  {
486  if (*p == '%')
487  {
488  p++;
489  switch (*p)
490  {
491  case 'd':
492  case 'x':
493  buffer_loc[0] = '%';
494  buffer_loc[1] = 'l';
495  buffer_loc[2] = *p;
496  buffer_loc[3] = 0;
497  lng2 = va_arg(VarArg,long);
498  fprintf(stderr, buffer_loc, lng2);
499  break;
500  case 's':
501  buffer_loc[0] = '%';
502  buffer_loc[1] = *p;
503  buffer_loc[2] = 0;
504  cptr = va_arg(VarArg,char *);
505  fprintf(stderr, buffer_loc, cptr);
506  break;
507  case 'C':
508  /* type coding as bin string */
509  pil = va_arg(VarArg,ptr_int_list);
510  print_code(stderr,pil);
511  break;
512  case 'P':
513  psi = va_arg(VarArg,ptr_psi_term);
514  display_psi(stderr,psi);
515  break;
516  case 'O':
517  kind = va_arg(VarArg,operator);
518  print_operator_kind(stderr,kind);
519  break;
520  case 'T':
521  assert(stderr==stderr);
522  t = va_arg(VarArg,def_type);
523  print_def_type(t);
524  break;
525  case 'E':
526  assert(stderr==stderr);
527  perr_i("near line %ld",psi_term_line_number);
528  if (strcmp(input_file_name,"stdin")) {
529  perr_s(" in file \042%s\042",input_file_name);
530  }
531  parse_ok=FALSE;
532  break;
533  case '%':
534  (void)putc(*p,stderr);
535  break;
536  default:
537  fprintf(stderr,"<%c follows %% : report bug >", *p);
538  break;
539  }
540  }
541  else
542  (void)putc(*p,stderr);
543  }
544  va_end(VarArg);
545 #ifdef CLIFE
546  exit(0);
547 #endif
548 }
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
void infoline ( char *  format,
  ... 
)

infoline

Parameters
format- char *format
...

Definition at line 281 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.

282 {
283  va_list VarArg;
284  // int l;
285  char buffer_loc[5];
286  char *p;
287  unsigned long lng2;
288  char *cptr;
289  ptr_int_list pil;
290  ptr_psi_term psi;
291  operator kind;
292  def_type t ;
293 
294  va_start(VarArg,format);
295  if (NOTQUIET)
296  {
297 
298  // vinfoline(format, stdout, VarArg);
299  //#define vinfoline(format, outfile, xxxx) {
300  for (p=format;p && *p; p++)
301  {
302  if (*p == '%')
303  {
304  p++;
305  switch (*p)
306  {
307  case 'd':
308  case 'x':
309  buffer_loc[0] = '%';
310  buffer_loc[1] = 'l';
311  buffer_loc[2] = *p;
312  buffer_loc[3] = 0;
313  lng2 = va_arg(VarArg,long);
314  fprintf(stdout, buffer_loc, lng2);
315  break;
316  case 's':
317  buffer_loc[0] = '%';
318  buffer_loc[1] = *p;
319  buffer_loc[2] = 0;
320  cptr = va_arg(VarArg,char *);
321  fprintf(stdout, buffer_loc, cptr);
322  break;
323  case 'C':
324  /* type coding as bin string */
325  pil = va_arg(VarArg,ptr_int_list);
326  print_code(stdout,pil);
327  break;
328  case 'P':
329  psi = va_arg(VarArg,ptr_psi_term);
330  display_psi(stdout,psi);
331  break;
332  case 'O':
333  kind = va_arg(VarArg,operator);
334  print_operator_kind(stdout,kind);
335  break;
336  case 'T':
337  assert(stdout==stderr);
338  t = va_arg(VarArg,def_type);
339  print_def_type(t);
340  break;
341  case 'E':
342  assert(stdout==stderr);
343  perr_i("near line %ld",psi_term_line_number);
344  if (strcmp(input_file_name,"stdin")) {
345  perr_s(" in file 042%s042",input_file_name);
346  }
347  parse_ok=FALSE;
348  break;
349  case '%':
350  (void)putc(*p,stdout);
351  break;
352  default:
353  fprintf(stdout,"<%c follows %% : report bug >", *p);
354  break;
355  }
356  }
357  else
358  (void)putc(*p,stdout);
359  }
360  }
361  va_end(VarArg);
362 }
#define NOTQUIET
Definition: def_macro.h:15
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
void init_trace ( )

init_trace

Initialize all tracing variables

Definition at line 651 of file error.c.

References FALSE, stepcount, stepflag, and trace.

652 {
653  trace=FALSE;
654  stepflag=FALSE;
655  stepcount=0;
656 }
#define FALSE
Standard boolean.
Definition: def_const.h:275
long stepcount
Definition: error.c:25
long trace
Definition: error.c:21
long stepflag
Definition: error.c:23
long int_div_warning ( ptr_psi_term  arg,
REAL  val 
)

int_div_warning

Parameters
arg- ptr_psi_term arg
val- REAL val

Definition at line 1028 of file error.c.

References nonint_warning().

1029 {
1030  return nonint_warning(arg,val,"of integer division is not an integer");
1031 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
nonint_warning
Definition: error.c:974
long mod_warning ( ptr_psi_term  arg,
REAL  val,
int  zero 
)

mod_warning

Parameters
arg- ptr_psi_term arg
val- REAL val
zero- int zero

Definition at line 1041 of file error.c.

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

1042 {
1043  int err;
1044 
1045  err=nonint_warning(arg,val,"of modulo operation is not an integer");
1046  if(!err && zero && val==0) {
1047  Errorline("division by 0 in modulo operation\n");
1048  err=TRUE;
1049  }
1050  return err;
1051 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
nonint_warning
Definition: error.c:974
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
#define TRUE
Standard boolean.
Definition: def_const.h:268
void new_step ( long  newstep)

new_step

long newstep

Definition at line 713 of file error.c.

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

714 {
715  stepflag = newstep;
716  printf("*** Single stepping is turned ");
717  printf(stepflag?"on.\n":"off.\n");
720 }
long steptrace
Definition: error.c:24
void new_trace(long newtrace)
new_trace
Definition: error.c:698
#define FALSE
Standard boolean.
Definition: def_const.h:275
long stepflag
Definition: error.c:23
void new_trace ( long  newtrace)

new_trace

Parameters
newtrace- long newtrace

Definition at line 698 of file error.c.

References trace.

699 {
700  trace = newtrace;
701  printf("*** Tracing is turned ");
702  printf(trace?"on.":"off.");
703  if (trace == 2) printf(" Only for Proves");
704  printf("\n");
705 }
long trace
Definition: error.c:21
long nonint_warning ( ptr_psi_term  arg,
REAL  val,
char *  msg 
)

nonint_warning

Parameters
arg- ptr_psi_term arg
val- REAL val
msg- char *msg

Definition at line 974 of file error.c.

References FALSE, report_warning2(), and TRUE.

975 {
976  long err=FALSE;
977 
978  if (val!=floor(val)) {
979  report_warning2(arg, msg);
980  err=TRUE;
981  }
982  return err;
983 }
void report_warning2(ptr_psi_term g, char *s)
report_warning2
Definition: error.c:938
#define TRUE
Standard boolean.
Definition: def_const.h:268
#define FALSE
Standard boolean.
Definition: def_const.h:275
void nonnum_warning ( ptr_psi_term  t,
ptr_psi_term  arg1,
ptr_psi_term  arg2 
)

nonnum_warning

Parameters
t- ptr_psi_term t
arg1- ptr_psi_term arg1
arg2- ptr_psi_term arg2

Give error message if there is an argument which cannot unify with/ a real number.

Definition at line 953 of file error.c.

References curried, overlap_type(), real, report_warning(), and wl_psi_term::type.

954 {
955  if (!curried && /* PVR 15.9.93 */
956  ((arg1 && !overlap_type(arg1->type,real)) ||
957  (arg2 && !overlap_type(arg2->type,real)))) {
958  report_warning(t,"non-numeric argument(s)");
959  }
960 }
long overlap_type(ptr_definition t1, ptr_definition t2)
overlap_type
Definition: types.c:1579
ptr_definition real
symbol in bi module
Definition: def_glob.h:375
long curried
Definition: def_glob.h:868
ptr_definition type
Definition: def_struct.h:181
void report_warning(ptr_psi_term g, char *s)
report_warning
Definition: error.c:890
void outputline ( char *  format,
  ... 
)

void outputline(char *format,...)

outputline

Parameters
format- char *format
...

Definition at line 101 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.

102 {
103  va_list VarArg;
104  // int l;
105  char buffer_loc[5];
106  char *p;
107  unsigned long lng2;
108  char *cptr;
109  ptr_int_list pil;
110  ptr_psi_term psi;
111  operator kind;
112  def_type t ;
113  va_start(VarArg,format);
114  // vinfoline(format,output_stream, VarArg);
115  // #define vinfoline(format, outfile, xxxx) {
116  for (p=format;p && *p; p++)
117  {
118  if (*p == '%')
119  {
120  p++;
121  switch (*p)
122  {
123  case 'd':
124  case 'x':
125  buffer_loc[0] = '%';
126  buffer_loc[1] = 'l';
127  buffer_loc[2] = *p;
128  buffer_loc[3] = 0;
129  lng2 = va_arg(VarArg, long);
130  fprintf(output_stream, buffer_loc, lng2);
131  break;
132  case 's':
133  buffer_loc[0] = '%';
134  buffer_loc[1] = *p;
135  buffer_loc[2] = 0;
136  cptr = va_arg(VarArg,char *);
137  fprintf(output_stream, buffer_loc, cptr);
138  break;
139  case 'C':
140  /* type coding as bin string */
141  pil = va_arg(VarArg,ptr_int_list);
143  break;
144  case 'P':
145  psi = va_arg(VarArg,ptr_psi_term);
147  break;
148  case 'O':
149  kind = va_arg(VarArg,operator);
151  break;
152  case 'T':
153  assert(output_stream==stderr);
154  t = va_arg(VarArg,def_type);
155  print_def_type(t);
156  break;
157  case 'E':
158  assert(output_stream==stderr);
159  perr_i("near line %ld",psi_term_line_number);
160  if (strcmp(input_file_name,"stdin")) {
161  perr_s(" in file \042%s\042",input_file_name);
162  }
163  parse_ok=FALSE;
164  break;
165  case '%':
166  (void)putc(*p,output_stream);
167  break;
168  default:
169  fprintf(output_stream,"<%c follows %% : report bug >", *p);
170  break;
171  }
172  }
173  else
174  (void)putc(*p,output_stream);
175  }
176  va_end(VarArg);
177 }
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
FILE * output_stream
Definition: def_glob.h:1017
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
void perr ( char *  str)

perr

Parameters
str- char *str

Definition at line 763 of file error.c.

764 {
765  (void)fputs(str, stderr);
766 }
void perr_i ( char *  str,
long  i 
)

perr_i

Parameters
str- char *str
i- long i

Definition at line 800 of file error.c.

801 {
802  fprintf(stderr,str,i);
803 }
void perr_s ( char *  s1,
char *  s2 
)

perr_s

Parameters
s1- char *s1
s2- char *s2

Definition at line 775 of file error.c.

776 {
777  fprintf(stderr,s1,s2);
778 }
void perr_s2 ( char *  s1,
char *  s2,
char *  s3 
)

perr_s2

Parameters
s1- char *s1
s2- char *s2
s3- char *s3

Definition at line 788 of file error.c.

789 {
790  fprintf(stderr,s1,s2,s3);
791 }
void report_error ( ptr_psi_term  g,
char *  s 
)

report_error

Parameters
g- ptr_psi_term g
s- char *s

REPORT_ERROR(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Error: s in 'g'.'

Definition at line 856 of file error.c.

References report_error_main().

857 {
858  report_error_main(g,s,"Error");
859 }
void report_error_main(ptr_psi_term g, char *s, char *s2)
report_error_main
Definition: error.c:836
void report_error2 ( ptr_psi_term  g,
char *  s 
)

report_error2

Parameters
g- ptr_psi_term g
s- char *s

REPORT_ERROR2(g,s) Like report_error, with a slightly different format. Format: '*** Error: argument 'g' s.'

Definition at line 923 of file error.c.

References report_error2_main().

924 {
925  report_error2_main(g,s,"Error");
926 }
void report_error2_main(ptr_psi_term g, char *s, char *s2)
report_error2_main
Definition: error.c:904
void report_error2_main ( ptr_psi_term  g,
char *  s,
char *  s2 
)

report_error2_main

Parameters
g- ptr_psi_term g
s- char *s
s2- char *s2

Main routine for report_error2 and report_warning2

Definition at line 904 of file error.c.

References display_psi_stderr(), and perr_s().

905 {
906  // FILE *f;
907 
908  perr_s("*** %s: argument '",s2);
910  perr_s("' %s.\n",s);
911 }
void display_psi_stderr(ptr_psi_term t)
display_psi_stderr
Definition: print.c:1550
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void report_error_main ( ptr_psi_term  g,
char *  s,
char *  s2 
)

report_error_main

Parameters
g- ptr_psi_term g
s- char *s
s2- char *s2

Main routine for report_error and report_warning

Definition at line 836 of file error.c.

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

837 {
838  // FILE *f;
839 
840  perr_s2("*** %s: %s in '",s2,s);
842  perr("'.\n");
843 }
void perr_s2(char *s1, char *s2, char *s3)
perr_s2
Definition: error.c:788
void display_psi_stderr(ptr_psi_term t)
display_psi_stderr
Definition: print.c:1550
void perr(char *str)
perr
Definition: error.c:763
void report_warning ( ptr_psi_term  g,
char *  s 
)

report_warning

Parameters
g- ptr_psi_term g
s- char *s

REPORT_WARNING(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Warning: s in 'g'.'

Definition at line 890 of file error.c.

References report_error_main(), and warningflag.

891 {
892  if (warningflag) report_error_main(g,s,"Warning");
893 }
long warningflag
Definition: error.c:19
void report_error_main(ptr_psi_term g, char *s, char *s2)
report_error_main
Definition: error.c:836
void report_warning2 ( ptr_psi_term  g,
char *  s 
)

report_warning2

Parameters
g- ptr_psi_term g
s- char *s

REPORT_WARNING2(g,s) Like report_warning, with a slightly different format. Format: '*** Warning: argument 'g' s.'

Definition at line 938 of file error.c.

References report_error2_main(), and warningflag.

939 {
940  if (warningflag) report_error2_main(g,s,"Warning");
941 }
long warningflag
Definition: error.c:19
void report_error2_main(ptr_psi_term g, char *s, char *s2)
report_error2_main
Definition: error.c:904
long reportAndAbort ( ptr_psi_term  g,
char *  s 
)

reportAndAbort

Parameters
g- ptr_psi_term g
s- char *s

REPORTANDABORT(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Error: s in 'g'.'

Definition at line 872 of file error.c.

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

873 {
874  report_error_main(g,s,"Error");
875  return abort_life(TRUE); // djd added TRUE
876 }
void report_error_main(ptr_psi_term g, char *s, char *s2)
report_error_main
Definition: error.c:836
long abort_life(int nlflag)
abort_life
Definition: built_ins.c:2259
#define TRUE
Standard boolean.
Definition: def_const.h:268
void reset_step ( )

reset_step

Reset stepcount to zero Should be called when prompt is printed

Definition at line 665 of file error.c.

References stepcount, stepflag, and TRUE.

666 {
667  if (stepcount>0) {
668  stepcount=0;
669  stepflag=TRUE;
670  }
671 }
#define TRUE
Standard boolean.
Definition: def_const.h:268
long stepcount
Definition: error.c:25
long stepflag
Definition: error.c:23
void set_trace_to_prove ( )

set_trace_to_prove

void set_trace_to_prove()

Definition at line 727 of file error.c.

References new_trace().

728 {
729  new_trace(2);
730 }
void new_trace(long newtrace)
new_trace
Definition: error.c:698
long shift_warning ( long  dir,
ptr_psi_term  arg,
REAL  val 
)

shift_warning

Parameters
dir- long dir
arg- ptr_psi_term arg
val- REAL val

Definition at line 1061 of file error.c.

References nonint_warning().

1062 {
1063  if (dir)
1064  return nonint_warning(arg,val,"of right shift operation is not an integer");
1065  else
1066  return nonint_warning(arg,val,"of left shift operation is not an integer");
1067 }
long nonint_warning(ptr_psi_term arg, REAL val, char *msg)
nonint_warning
Definition: error.c:974
void stack_info ( FILE *  outfile)

stack_info

Parameters
outfile- FILE *outfile

Definition at line 77 of file error.c.

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

78 {
79  /* Information about size of embedded stacks */
80  if (verbose) {
81  long gn,cn,tn;
82  fprintf(outfile,"*** Stack depths [");
83  gn=depth_gs();
84  cn=depth_cs();
85  tn=depth_ts();
86  fprintf(outfile,"%ld goal%s, %ld choice point%s, %ld trail entr%s",
87  gn,(gn!=1?"s":""),
88  cn,(cn!=1?"s":""),
89  tn,(tn!=1?"ies":"y"));
90  fprintf(outfile,"]\n");
91  }
92 }
static long depth_gs()
depth_gs
Definition: error.c:33
long verbose
Definition: error.c:22
static long depth_ts()
depth_ts
Definition: error.c:62
FILE * outfile
Definition: def_glob.h:974
static long depth_cs()
depth_cs
Definition: error.c:47
void Syntaxerrorline ( char *  format,
  ... 
)

Syntaxerrorline.

Parameters
format- char *format
...

Definition at line 557 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.

558 {
559  va_list VarArg;
560  // int l;
561  char buffer_loc[5];
562  char *p;
563  unsigned long lng2;
564  char *cptr;
565  ptr_int_list pil;
566  ptr_psi_term psi;
567  operator kind;
568  def_type t ;
569  va_start(VarArg,format);
570  // fprintf(stderr,"format = %lx %s\n",(long)format,format);fflush(stdout);
571  if(parse_ok) { /* RM: Feb 1 1993 */
572  parse_ok=FALSE; /* RM: Feb 1 1993 */
573  fprintf(stderr,"*** Syntax error: ");
574  // fprintf(stderr,"format2 = %lx %s\n",(long)format,format);
575  // vinfoline(format, stderr, VarArg);
576  //#define vinfoline(format, outfile, xxxx) {
577  for (p=format;p && *p; p++)
578  {
579  if (*p == '%')
580  {
581  p++;
582  switch (*p)
583  {
584  case 'd':
585  case 'x':
586  buffer_loc[0] = '%';
587  buffer_loc[1] = 'l';
588  buffer_loc[2] = *p;
589  buffer_loc[3] = 0;
590  lng2 = va_arg(VarArg,long);
591  fprintf(stderr, buffer_loc, lng2);
592  break;
593  case 's':
594  buffer_loc[0] = '%';
595  buffer_loc[1] = *p;
596  buffer_loc[2] = 0;
597  cptr = va_arg(VarArg,char *);
598  fprintf(stderr, buffer_loc, cptr);
599  break;
600  case 'C':
601  /* type coding as bin string */
602  pil = va_arg(VarArg,ptr_int_list);
603  print_code(stderr,pil);
604  break;
605  case 'P':
606  psi = va_arg(VarArg,ptr_psi_term);
607  display_psi(stderr,psi);
608  break;
609  case 'O':
610  kind = va_arg(VarArg,operator);
611  print_operator_kind(stderr,kind);
612  break;
613  case 'T':
614  assert(stderr==stderr);
615  t = va_arg(VarArg,def_type);
616  print_def_type(t);
617  break;
618  case 'E':
619  assert(stderr==stderr);
620  perr_i("near line %ld",psi_term_line_number);
621  if (strcmp(input_file_name,"stdin")) {
622  perr_s(" in file \042%s\042",input_file_name);
623  }
624  parse_ok=FALSE;
625  break;
626  case '%':
627  (void)putc(*p,stderr);
628  break;
629  default:
630  fprintf(stderr,"<%c follows %% : report bug >", *p);
631  break;
632  }
633  }
634  else
635  (void)putc(*p,stderr);
636  }
637  }
638  va_end(VarArg);
639 }
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
void toggle_step ( )

toggle_step

Definition at line 747 of file error.c.

References new_step(), and stepflag.

748 {
749  new_step(!stepflag);
750 }
void new_step(long newstep)
new_step
Definition: error.c:713
long stepflag
Definition: error.c:23
void toggle_trace ( )

toggle_trace

Definition at line 737 of file error.c.

References new_trace(), and trace.

738 {
739  new_trace(trace?0:1);
740 }
void new_trace(long newtrace)
new_trace
Definition: error.c:698
long trace
Definition: error.c:21
void traceline ( char *  format,
  ... 
)

traceline

Parameters
format- char *format
...

Definition at line 186 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().

187 {
188  va_list VarArg;
189  // int l;
190  char buffer_loc[5];
191  char *p;
192  unsigned long lng2;
193  char *cptr;
194  ptr_int_list pil;
195  ptr_psi_term psi;
196  operator kind;
197  def_type t ;
198 
199  va_start(VarArg,format);
200 
201  if (trace) // DJD
202  {
203  /* RM: Nov 10 1993 */
204 
205  if ((trace == 2) && (format[0] != 'p')) return;
206  tracing();
207 
208  // vinfoline(format, stdout, VarArg);
209  // #define vinfoline(format, outfile, xxxx) {
210  for (p=format;p && *p; p++)
211  {
212  if (*p == '%')
213  {
214  p++;
215  switch (*p)
216  {
217  case 'd':
218  case 'x':
219  buffer_loc[0] = '%';
220  buffer_loc[1] = 'l';
221  buffer_loc[2] = *p;
222  buffer_loc[3] = 0;
223  lng2 = va_arg(VarArg, long);
224  fprintf(stdout, buffer_loc, lng2);
225  break;
226  case 's':
227  buffer_loc[0] = '%';
228  buffer_loc[1] = *p;
229  buffer_loc[2] = 0;
230  cptr = va_arg(VarArg,char *);
231  fprintf(stdout, buffer_loc, cptr);
232  break;
233  case 'C':
234  /* type coding as bin string */
235  pil = va_arg(VarArg,ptr_int_list);
236  print_code(stdout,pil);
237  break;
238  case 'P':
239  psi = va_arg(VarArg,ptr_psi_term);
240  display_psi(stdout,psi);
241  break;
242  case 'O':
243  kind = va_arg(VarArg,operator);
244  print_operator_kind(stdout,kind);
245  break;
246  case 'T':
247  assert(stdout==stderr);
248  t = va_arg(VarArg,def_type);
249  print_def_type(t);
250  break;
251  case 'E':
252  assert(stdout==stderr);
253  perr_i("near line %ld",psi_term_line_number);
254  if (strcmp(input_file_name,"stdin")) {
255  perr_s(" in file \042%s\042",input_file_name);
256  }
257  parse_ok=FALSE;
258  break;
259  case '%':
260  (void)putc(*p,stdout);
261  break;
262  default:
263  fprintf(stdout,"<%c follows %% : report bug >", *p);
264  break;
265  }
266  }
267  else
268  (void)putc(*p,stdout);
269  }
270  }
271  va_end(VarArg);
272 }
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void tracing()
tracing
Definition: error.c:678
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
long trace
Definition: error.c:21
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
void tracing ( )

tracing

Definition at line 678 of file error.c.

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

679 {
680  long i;
681  long indent_loc;
682 
683  printf("T%04ld",goal_count);
684  printf(" C%02ld",depth_cs());
685  indent_loc=depth_gs();
686  if (indent_loc>=MAX_TRACE_INDENT) printf(" G%02ld",indent_loc);
687  indent_loc = indent_loc % MAX_TRACE_INDENT;
688  for (i=indent_loc; i>=0; i--) printf(" ");
689  steptrace=TRUE;
690 }
static long depth_gs()
depth_gs
Definition: error.c:33
#define MAX_TRACE_INDENT
Maximum goal indentation during tracing.
Definition: def_const.h:247
long steptrace
Definition: error.c:24
long goal_count
Definition: def_glob.h:678
#define TRUE
Standard boolean.
Definition: def_const.h:268
static long depth_cs()
depth_cs
Definition: error.c:47
long warning ( )

warning

Definition at line 810 of file error.c.

References perr(), and warningflag.

811 {
812  if (warningflag) perr("*** Warning: ");
813  return warningflag;
814 }
long warningflag
Definition: error.c:19
void perr(char *str)
perr
Definition: error.c:763
void warningline ( char *  format,
  ... 
)

warningline

Parameters
format- char *format
...

Definition at line 371 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.

372 {
373  va_list VarArg;
374  // int l;
375  char buffer_loc[5];
376  char *p;
377  unsigned long lng2;
378  char *cptr;
379  ptr_int_list pil;
380  ptr_psi_term psi;
381  operator kind;
382  def_type t ;
383 
384  va_start(VarArg,format);
385 
386  if (warningflag) { // macro would not work
387 
388 
389  if(quietflag) return; /* RM: Sep 24 1993 */
390  fprintf(stderr,"*** Warning: ");
391  // vinfoline(format, stderr, VarArg);
392  // #define vinfoline(format, stderr, xxxx) {
393  for (p=format;p && *p; p++)
394  {
395  if (*p == '%')
396  {
397  p++;
398  switch (*p)
399  {
400  case 'd':
401  case 'x':
402  buffer_loc[0] = '%';
403  buffer_loc[1] = 'l';
404  buffer_loc[2] = *p;
405  buffer_loc[3] = 0;
406  lng2 = va_arg(VarArg,long);
407  fprintf(stderr, buffer_loc, lng2);
408  break;
409  case 's':
410  buffer_loc[0] = '%';
411  buffer_loc[1] = *p;
412  buffer_loc[2] = 0;
413  cptr = va_arg(VarArg,char *);
414  fprintf(stderr, buffer_loc, cptr);
415  break;
416  case 'C':
417  /* type coding as bin string */
418  pil = va_arg(VarArg,ptr_int_list);
419  print_code(stderr,pil);
420  break;
421  case 'P':
422  psi = va_arg(VarArg,ptr_psi_term);
423  display_psi(stderr,psi);
424  break;
425  case 'O':
426  kind = va_arg(VarArg,operator);
427  print_operator_kind(stderr,kind);
428  break;
429  case 'T':
430  assert(stderr==stderr);
431  t = va_arg(VarArg,def_type);
432  print_def_type(t);
433  break;
434  case 'E':
435  assert(stderr==stderr);
436  perr_i("near line %ld",psi_term_line_number);
437  if (strcmp(input_file_name,"stdin")) {
438  perr_s(" in file 042%s042",input_file_name);
439  }
440  parse_ok=FALSE;
441  break;
442  case '%':
443  (void)putc(*p,stderr);
444  break;
445  default:
446  fprintf(stderr,"<%c follows %% : report bug >", *p);
447  break;
448  }
449  }
450  else
451  (void)putc(*p,stderr);
452  }
453  }
454  va_end(VarArg);
455 }
long warningflag
Definition: error.c:19
void perr_i(char *str, long i)
perr_i
Definition: error.c:800
long psi_term_line_number
Definition: def_glob.h:909
string input_file_name
Definition: def_glob.h:1016
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
void perr_s(char *s1, char *s2)
perr_s
Definition: error.c:775
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
void print_def_type(def_type t)
print_def_type
Definition: types.c:24
#define FALSE
Standard boolean.
Definition: def_const.h:275
long quietflag
Definition: error.c:20
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
#define assert(N)
Definition: memory.c:114
long warningx ( )

warningx

Definition at line 821 of file error.c.

References perr(), and warningflag.

822 {
823  if (warningflag) perr("*** Warning");
824  return warningflag;
825 }
long warningflag
Definition: error.c:19
void perr(char *str)
perr
Definition: error.c:763

Variable Documentation

long quietflag =FALSE

Definition at line 20 of file error.c.

long stepcount = 0

Definition at line 25 of file error.c.

long stepflag = 0

Definition at line 23 of file error.c.

long steptrace = 0

Definition at line 24 of file error.c.

long trace =FALSE

Definition at line 21 of file error.c.

long verbose =FALSE

Definition at line 22 of file error.c.

long warningflag =TRUE

Definition at line 19 of file error.c.