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

Go to the source code of this file.

Macros

#define copyPsiTerm(a, b)   (ptr_psi_term )memcpy(a,b,sizeof(psi_term))
 

Functions

long c_trace ()
 
long c_tprove ()
 
static long c_step ()
 
static long c_verbose ()
 
static long c_warning ()
 
static long c_maxint ()
 
long c_quiet ()
 
static long c_cputime ()
 
static long c_realtime ()
 
static long c_localtime ()
 
static long c_statistics ()
 
static long c_garbage ()
 
static long c_getenv ()
 
static long c_system ()
 
static long c_encode ()
 
void setUnitList (GENERIC x)
 
ptr_psi_term unitListValue ()
 
GENERIC unitListNext ()
 
ptr_psi_term intListValue (ptr_int_list p)
 
GENERIC intListNext (ptr_int_list p)
 
ptr_psi_term quotedStackCopy (psi_term p)
 
ptr_psi_term residListGoalQuote (ptr_residuation p)
 
GENERIC residListNext (ptr_residuation p)
 
ptr_psi_term makePsiTerm (ptr_definition x)
 
ptr_psi_term makePsiList (GENERIC head, ptr_psi_term(*valueFunc)(), GENERIC(*nextFunc)())
 
static long c_residList ()
 
ptr_goal makeGoal (ptr_psi_term p)
 
static long c_residuate ()
 
static long c_mresiduate ()
 
void insert_system_builtins ()
 

Variables

static GENERIC unitListElement
 

Macro Definition Documentation

#define copyPsiTerm (   a,
 
)    (ptr_psi_term )memcpy(a,b,sizeof(psi_term))

Definition at line 8 of file bi_sys.c.

Function Documentation

static long c_cputime ( )
static

Definition at line 175 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_args, deref_ptr, get_real_value(), life_end, REAL, set_empty, and unify_real_result().

176 {
177  ptr_psi_term result, t;
178  REAL thetime,val;
179  long num,success;
180 
181  t=aim->aaaa_1;
183  result=aim->bbbb_1;
184  deref_ptr(result);
185  success=get_real_value(result,&val,&num);
186  if (success) {
187  (void)times(&life_end);
188  thetime=(life_end.tms_utime-life_start.tms_utime)/60.0;
189  if (num)
190  success=(val==thetime);
191  else
192  success=unify_real_result(result,thetime);
193  }
194  return success;
195 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
long get_real_value(ptr_psi_term t, REAL *v, long *n)
Definition: built_ins.c:246
#define set_empty
Definition: def_const.h:193
struct tms life_start life_end
Definition: def_glob.h:17
#define REAL
Definition: def_const.h:72
#define deref_ptr(P)
Definition: def_macro.h:95
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
long unify_real_result(ptr_psi_term t, REAL v)
Definition: built_ins.c:371
ptr_psi_term bbbb_1
Definition: def_struct.h:225
static long c_encode ( )
static

Definition at line 395 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, encode_types(), set_empty, and TRUE.

396 {
397  ptr_psi_term t;
398 
399  t=aim->aaaa_1;
401  encode_types();
402  return TRUE;
403 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
#define set_empty
Definition: def_const.h:193
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
void encode_types()
Definition: types.c:1015
#define deref_args(P, S)
Definition: def_macro.h:145
static long c_garbage ( )
static

Definition at line 299 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, garbage(), set_empty, and TRUE.

300 {
301  ptr_psi_term t;
302 
303  t=aim->aaaa_1;
305  garbage();
306  return TRUE;
307 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void garbage()
Definition: memory.c:1430
#define set_empty
Definition: def_const.h:193
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
static long c_getenv ( )
static

Definition at line 313 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, deref_ptr, Errorline(), FALSE, get_two_args(), heap_copy_string(), matches(), NULL, push_goal(), quoted_string, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.

314 {
315  long success=FALSE;
316  ptr_psi_term arg1,arg2,funct,result,t;
317  long smaller;
318  char * s;
319 
320  funct = aim->aaaa_1;
321  result=aim->bbbb_1;
322  deref_ptr(funct);
323  deref_ptr(result);
324 
325  get_two_args(funct->attr_list, &arg1, &arg2);
326  if(arg1) {
327  deref_ptr(arg1);
328  if(matches(arg1->type,quoted_string,&smaller) && arg1->value_3) {
329  s=getenv((char *)arg1->value_3);
330  if(s) {
331  success=TRUE;
332  t=stack_psi_term(4);
333  t->type=quoted_string;
335  push_goal(unify,result,t,NULL);
336  }
337  }
338  else
339  Errorline("bad argument in %P\n",funct);
340  }
341  else
342  Errorline("argument missing in %P\n",funct);
343 
344  return success;
345 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
Definition: login.c:37
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
Definition: login.c:555
long matches(ptr_definition t1, ptr_definition t2, long *smaller)
Definition: types.c:1565
#define NULL
Definition: def_const.h:203
void Errorline(char *format,...)
Definition: error.c:414
char * heap_copy_string(char *s)
Definition: trees.c:147
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
#define FALSE
Definition: def_const.h:128
ptr_definition quoted_string
Definition: def_glob.h:101
ptr_psi_term stack_psi_term(long stat)
Definition: lefun.c:15
GENERIC value_3
Definition: def_struct.h:170
ptr_goal aim
Definition: def_glob.h:49
#define unify
Definition: def_const.h:274
ptr_definition type
Definition: def_struct.h:165
ptr_psi_term bbbb_1
Definition: def_struct.h:225
unsigned long * GENERIC
Definition: def_struct.h:17
ptr_node attr_list
Definition: def_struct.h:171
static long c_localtime ( )
static

Definition at line 231 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, day_attr, deref_args, deref_ptr, hour_attr, minute_attr, month_attr, NULL, push_goal(), second_attr, set_empty, stack_add_int_attr(), stack_psi_term(), timesym, TRUE, wl_psi_term::type, unify, weekday_attr, and year_attr.

232 {
233  ptr_psi_term result, t, psitime;
234  long success=TRUE;
235  struct timeval tp;
236  struct timezone tzp;
237  struct tm *thetime;
238 
239  t=aim->aaaa_1;
241  result=aim->bbbb_1;
242  deref_ptr(result);
243 
244  gettimeofday(&tp, &tzp);
245  thetime=localtime((time_t *) &(tp.tv_sec));
246 
247  psitime=stack_psi_term(4);
248  psitime->type=timesym;
249  stack_add_int_attr(psitime, year_attr, thetime->tm_year+1900);
250  stack_add_int_attr(psitime, month_attr, thetime->tm_mon+1);
251  stack_add_int_attr(psitime, day_attr, thetime->tm_mday);
252  stack_add_int_attr(psitime, hour_attr, thetime->tm_hour);
253  stack_add_int_attr(psitime, minute_attr, thetime->tm_min);
254  stack_add_int_attr(psitime, second_attr, thetime->tm_sec);
255  stack_add_int_attr(psitime, weekday_attr, thetime->tm_wday);
256 
257  push_goal(unify,result,psitime,NULL);
258 
259  return success;
260 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
ptr_definition timesym
Definition: def_glob.h:108
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
Definition: login.c:555
#define set_empty
Definition: def_const.h:193
#define NULL
Definition: def_const.h:203
void stack_add_int_attr(ptr_psi_term t, char *attrname, long value)
Definition: token.c:73
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
ptr_psi_term stack_psi_term(long stat)
Definition: lefun.c:15
ptr_goal aim
Definition: def_glob.h:49
char * weekday_attr
Definition: def_glob.h:259
#define unify
Definition: def_const.h:274
#define deref_args(P, S)
Definition: def_macro.h:145
char * minute_attr
Definition: def_glob.h:257
char * year_attr
Definition: def_glob.h:253
char * second_attr
Definition: def_glob.h:258
char * day_attr
Definition: def_glob.h:255
ptr_definition type
Definition: def_struct.h:165
char * hour_attr
Definition: def_glob.h:256
ptr_psi_term bbbb_1
Definition: def_struct.h:225
char * month_attr
Definition: def_glob.h:254
static long c_maxint ( )
static

Definition at line 129 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_args, deref_ptr, get_real_value(), REAL, set_empty, unify_real_result(), and WL_MAXINT.

130 {
131  ptr_psi_term t,result;
132  REAL val;
133  long num,success;
134 
135  t=aim->aaaa_1;
137  result=aim->bbbb_1;
138  deref_ptr(result);
139  success=get_real_value(result,&val,&num);
140  if (success) {
141  if (num)
142  success=(val==(REAL)WL_MAXINT);
143  else
144  success=unify_real_result(result,(REAL)WL_MAXINT);
145  }
146  return success;
147 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
long get_real_value(ptr_psi_term t, REAL *v, long *n)
Definition: built_ins.c:246
#define set_empty
Definition: def_const.h:193
#define REAL
Definition: def_const.h:72
#define deref_ptr(P)
Definition: def_macro.h:95
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
#define WL_MAXINT
Definition: def_const.h:76
long unify_real_result(ptr_psi_term t, REAL v)
Definition: built_ins.c:371
ptr_psi_term bbbb_1
Definition: def_struct.h:225
static long c_mresiduate ( )
static

Definition at line 581 of file bi_sys.c.

References wl_goal::aaaa_1, aim, alist, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), makeGoal(), nil, NULL, residuateGoalOnVar(), set_1_2, TRUE, and wl_psi_term::type.

583 {
584  long success=TRUE;
585  ptr_psi_term pred;
586  ptr_psi_term arg1, arg2, tmp, var;
587  ptr_goal g;
588 
589  pred = aim->aaaa_1;
590  deref_ptr(pred);
591 
592  get_two_args(pred->attr_list, &arg1, &arg2);
593  if ((!arg1)||(!arg2)) {
594  Errorline("%P requires two arguments.\n",pred);
595  return FALSE;
596  }
597 
598  deref_ptr(arg1);
599  deref_ptr(arg2);
600  deref_args(pred, set_1_2);
601 
602  g = makeGoal(arg2);
603 
604  /* Then residuate on all the list variables: */
605  tmp=arg1;
606  while(tmp && tmp->type==alist) { /* RM: Dec 14 1992 */
607  get_two_args(tmp->attr_list,&var,&tmp);
608  if(var) {
609  deref_ptr(var);
610  (void)residuateGoalOnVar(g,var,NULL);
611  }
612  if(tmp)
613  deref_ptr(tmp);
614  }
615 
616  if(!tmp || tmp->type!=nil) {
617  Errorline("%P should be a nil-terminated list in mresiduate.\n",arg1);
618  success=FALSE;
619  }
620 
621  return success;
622 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
Definition: login.c:37
long residuateGoalOnVar(ptr_goal g, ptr_psi_term var, ptr_psi_term othervar)
Definition: lefun.c:172
#define NULL
Definition: def_const.h:203
void Errorline(char *format,...)
Definition: error.c:414
#define set_1_2
Definition: def_const.h:196
#define deref_ptr(P)
Definition: def_macro.h:95
ptr_definition alist
Definition: def_glob.h:94
#define TRUE
Definition: def_const.h:127
#define FALSE
Definition: def_const.h:128
ptr_goal aim
Definition: def_glob.h:49
ptr_goal makeGoal(ptr_psi_term p)
Definition: bi_sys.c:533
#define deref_args(P, S)
Definition: def_macro.h:145
ptr_definition nil
Definition: def_glob.h:97
ptr_definition type
Definition: def_struct.h:165
ptr_node attr_list
Definition: def_struct.h:171
long c_quiet ( )

Definition at line 155 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_args, deref_ptr, lf_false, lf_true, NOTQUIET, NULL, push_goal(), set_empty, stack_psi_term(), TRUE, wl_psi_term::type, and unify.

156 {
157  ptr_psi_term t,result,ans;
158  long success=TRUE;
159 
160  t=aim->aaaa_1;
162  result=aim->bbbb_1;
163  deref_ptr(result);
164  ans=stack_psi_term(4);
165  ans->type = NOTQUIET ? lf_false : lf_true;
166  push_goal(unify,result,ans,NULL);
167  return success;
168 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
#define NOTQUIET
Definition: def_macro.h:10
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
Definition: login.c:555
#define set_empty
Definition: def_const.h:193
#define NULL
Definition: def_const.h:203
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
ptr_definition lf_true
Definition: def_glob.h:107
ptr_psi_term stack_psi_term(long stat)
Definition: lefun.c:15
ptr_definition lf_false
Definition: def_glob.h:89
ptr_goal aim
Definition: def_glob.h:49
#define unify
Definition: def_const.h:274
#define deref_args(P, S)
Definition: def_macro.h:145
ptr_definition type
Definition: def_struct.h:165
ptr_psi_term bbbb_1
Definition: def_struct.h:225
static long c_realtime ( )
static

Definition at line 201 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_args, deref_ptr, get_real_value(), REAL, set_empty, and unify_real_result().

202 {
203  ptr_psi_term result, t;
204  REAL thetime,val;
205  long num,success;
206  struct timeval tp;
207  struct timezone tzp;
208 
209  t=aim->aaaa_1;
211  result=aim->bbbb_1;
212  deref_ptr(result);
213  success=get_real_value(result,&val,&num);
214  if (success) {
215  gettimeofday(&tp, &tzp);
216  thetime=(REAL)tp.tv_sec + ((REAL)tp.tv_usec/1000000.0);
217  /* thetime=times(&life_end)/60.0; */
218  if (num)
219  success=(val==thetime);
220  else
221  success=unify_real_result(result,thetime);
222  }
223  return success;
224 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
long get_real_value(ptr_psi_term t, REAL *v, long *n)
Definition: built_ins.c:246
#define set_empty
Definition: def_const.h:193
#define REAL
Definition: def_const.h:72
#define deref_ptr(P)
Definition: def_macro.h:95
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
long unify_real_result(ptr_psi_term t, REAL v)
Definition: built_ins.c:371
ptr_psi_term bbbb_1
Definition: def_struct.h:225
static long c_residList ( )
static

Definition at line 504 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), makePsiList(), NULL, push_goal(), wl_psi_term::resid, resid_aim, residListGoalQuote(), residListNext(), set_1, TRUE, and unify.

505 {
506  ptr_psi_term func;
507  ptr_psi_term result,arg1, other;
508 
509  func = aim->aaaa_1;
510  deref_ptr(func);
511 
512  get_one_arg(func->attr_list, &arg1);
513  if (!arg1)
514  {
515  curry();
516  return TRUE;
517  }
518 
519  result = aim->bbbb_1;
520  deref(result);
521  deref_ptr(arg1);
522  deref_args(func, set_1);
523 
524  other = makePsiList((void *)arg1->resid,
526  residListNext);
527  resid_aim = NULL;
528  push_goal(unify,result,other,NULL);
529  return TRUE;
530 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
ptr_residuation resid
Definition: def_struct.h:173
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
Definition: login.c:555
void get_one_arg(ptr_node t, ptr_psi_term *a)
Definition: login.c:86
#define set_1
Definition: def_const.h:194
void curry()
Definition: lefun.c:157
#define NULL
Definition: def_const.h:203
ptr_goal resid_aim
Definition: def_glob.h:220
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
#define deref(P)
Definition: def_macro.h:142
ptr_goal aim
Definition: def_glob.h:49
#define unify
Definition: def_const.h:274
GENERIC residListNext(ptr_residuation p)
Definition: bi_sys.c:462
#define deref_args(P, S)
Definition: def_macro.h:145
ptr_psi_term makePsiList(GENERIC head, ptr_psi_term(*valueFunc)(), GENERIC(*nextFunc)())
Definition: bi_sys.c:480
ptr_psi_term bbbb_1
Definition: def_struct.h:225
ptr_psi_term residListGoalQuote(ptr_residuation p)
Definition: bi_sys.c:451
ptr_node attr_list
Definition: def_struct.h:171
static long c_residuate ( )
static

Definition at line 550 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), makeGoal(), NULL, residuateGoalOnVar(), set_1_2, and TRUE.

551 {
552  ptr_psi_term pred;
553  ptr_psi_term arg1, arg2;
554  ptr_goal g;
555 
556  pred = aim->aaaa_1;
557  deref_ptr(pred);
558 
559  get_two_args(pred->attr_list, &arg1, &arg2);
560  if ((!arg1)||(!arg2)) {
561  Errorline("%P requires two arguments.\n",pred);
562  return FALSE;
563  }
564 
565  deref_ptr(arg1);
566  deref_ptr(arg2);
567  deref_args(pred, set_1_2);
568 
569  g = makeGoal(arg2);
570  (void)residuateGoalOnVar(g, arg1, NULL);
571 
572  return TRUE;
573 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
Definition: login.c:37
long residuateGoalOnVar(ptr_goal g, ptr_psi_term var, ptr_psi_term othervar)
Definition: lefun.c:172
#define NULL
Definition: def_const.h:203
void Errorline(char *format,...)
Definition: error.c:414
#define set_1_2
Definition: def_const.h:196
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
#define FALSE
Definition: def_const.h:128
ptr_goal aim
Definition: def_glob.h:49
ptr_goal makeGoal(ptr_psi_term p)
Definition: bi_sys.c:533
#define deref_args(P, S)
Definition: def_macro.h:145
ptr_node attr_list
Definition: def_struct.h:171
static long c_statistics ( )
static

Definition at line 265 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, heap_pointer, mem_base, mem_limit, set_empty, stack_pointer, and TRUE.

266 {
267  ptr_psi_term t;
268  long success=TRUE;
269  long t1,t2,t3;
270 
271  t=aim->aaaa_1;
273 
274  t1 = sizeof(mem_base)*(stack_pointer-mem_base);
275  t2 = sizeof(mem_base)*(mem_limit-heap_pointer);
276  t3 = sizeof(mem_base)*(mem_limit-mem_base);
277 
278  printf("\n");
279  /* printf("************** SYSTEM< INFORMATION **************\n"); */
280  printf("Stack size : %8ld bytes (%5ldK) (%ld%%)\n",t1,t1/1024,100*t1/t3);
281  printf("Heap size : %8ld bytes (%5ldK) (%ld%%)\n",t2,t2/1024,100*t2/t3);
282  printf("Total memory: %8ld bytes (%5ldK)\n",t3,t3/1024);
283 
284 #ifdef X11
285  printf("X predicates are installed.\n");
286 #else
287  printf("X predicates are not installed.\n");
288 #endif
289 
290  /* printf("\n"); */
291  /* printf("************************************************\n"); */
292  return success;
293 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
GENERIC mem_limit
Definition: def_glob.h:13
#define set_empty
Definition: def_const.h:193
#define TRUE
Definition: def_const.h:127
GENERIC mem_base
Definition: def_glob.h:11
ptr_goal aim
Definition: def_glob.h:49
GENERIC heap_pointer
Definition: def_glob.h:12
#define deref_args(P, S)
Definition: def_macro.h:145
GENERIC stack_pointer
Definition: def_glob.h:14
static long c_step ( )
static

Definition at line 79 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, set_empty, toggle_step(), and TRUE.

80 {
81  ptr_psi_term t;
82 
83  t=aim->aaaa_1;
85  toggle_step();
86  return TRUE;
87 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
#define set_empty
Definition: def_const.h:193
void toggle_step()
Definition: error.c:650
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
static long c_system ( )
static

Definition at line 349 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), matches(), quoted_string, REAL, set_1, TRUE, wl_psi_term::type, unify_real_result(), and wl_psi_term::value_3.

350 {
351  long success=TRUE;
352  ptr_psi_term arg1,arg2,funct,result;
353  REAL value;
354  long smaller;
355 
356  funct=aim->aaaa_1;
357  deref_ptr(funct);
358  result=aim->bbbb_1;
359  get_two_args(funct->attr_list,&arg1,&arg2);
360  if(arg1) {
361  deref(arg1);
362  deref_args(funct,set_1);
363  if((success=matches(arg1->type,quoted_string,&smaller)))
364  if(arg1->value_3) {
365  value=(REAL)system((char *)arg1->value_3);
366  if(value==127) {
367  success=FALSE;
368  Errorline("could not execute shell in %P.\n",funct);
369  /* report_error(funct,"couldn't execute shell"); */
370  }
371  else
372  success=unify_real_result(result,value);
373  }
374  else {
375  /* residuate(arg1); */ /* RM: Feb 10 1993 */
376  success=FALSE;
377  Errorline("bad argument in %P.\n",funct);
378  }
379  else {
380  success=FALSE;
381  Errorline("bad argument in %P.\n",funct);
382  /* report_error(funct,"bad argument"); */
383  }
384  }
385  else
386  curry();
387 
388  return success;
389 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
Definition: login.c:37
long matches(ptr_definition t1, ptr_definition t2, long *smaller)
Definition: types.c:1565
#define set_1
Definition: def_const.h:194
void curry()
Definition: lefun.c:157
#define REAL
Definition: def_const.h:72
void Errorline(char *format,...)
Definition: error.c:414
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
#define FALSE
Definition: def_const.h:128
#define deref(P)
Definition: def_macro.h:142
ptr_definition quoted_string
Definition: def_glob.h:101
GENERIC value_3
Definition: def_struct.h:170
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
long unify_real_result(ptr_psi_term t, REAL v)
Definition: built_ins.c:371
ptr_definition type
Definition: def_struct.h:165
ptr_psi_term bbbb_1
Definition: def_struct.h:225
ptr_node attr_list
Definition: def_struct.h:171
long c_tprove ( )

Definition at line 65 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, set_empty, set_trace_to_prove(), and TRUE.

66 {
67  ptr_psi_term t;
68 
69  t=aim->aaaa_1;
72  return TRUE;
73 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
#define set_empty
Definition: def_const.h:193
void set_trace_to_prove()
Definition: error.c:639
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
long c_trace ( )

Definition at line 20 of file bi_sys.c.

References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), is_top, lf_false, lf_true, set_empty, stepflag, toggle_trace(), trace, TRUE, wl_psi_term::type, and unify_bool_result().

21 {
22  long success=TRUE;
23  ptr_psi_term t,arg1,arg2;
24 
25  t=aim->aaaa_1;
27  get_two_args(t->attr_list,&arg1,&arg2);
28  if (arg1) {
29  deref_ptr(arg1);
30  if (is_top(arg1)) {
32  trace=FALSE;
33  }
34  else if (arg1->type==lf_true)
35  trace=TRUE;
36  else if (arg1->type==lf_false)
37  trace=FALSE;
38  else {
39  Errorline("bad first argument in %P.\n",t);
40  /* report_error(t,"bad first argument"); */
41  success=FALSE;
42  }
43  }
44  if (arg2) {
45  deref_ptr(arg2);
46  if (is_top(arg2)) {
49  }
50  else if (arg2->type==lf_true)
51  stepflag=TRUE;
52  else if (arg2->type==lf_false)
54  else {
55  Errorline("bad second argument in %P.\n",t);
56  /* report_error(t,"bad second argument"); */
57  success=FALSE;
58  }
59  }
60  if (!arg1 && !arg2)
61  toggle_trace();
62  return success;
63 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
Definition: login.c:37
#define is_top(T)
Definition: def_macro.h:108
void unify_bool_result(ptr_psi_term t, long v)
Definition: built_ins.c:329
#define set_empty
Definition: def_const.h:193
long trace
Definition: def_glob.h:272
void Errorline(char *format,...)
Definition: error.c:414
#define deref_ptr(P)
Definition: def_macro.h:95
#define TRUE
Definition: def_const.h:127
ptr_definition lf_true
Definition: def_glob.h:107
#define FALSE
Definition: def_const.h:128
void toggle_trace()
Definition: error.c:644
ptr_definition lf_false
Definition: def_glob.h:89
long stepflag
Definition: def_glob.h:150
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
ptr_definition type
Definition: def_struct.h:165
ptr_node attr_list
Definition: def_struct.h:171
static long c_verbose ( )
static

Definition at line 93 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, set_empty, TRUE, and verbose.

94 {
95  ptr_psi_term t;
96 
97  t=aim->aaaa_1;
99  verbose = !verbose;
100  printf("*** Verbose mode is turned ");
101  printf(verbose?"on.\n":"off.\n");
102  return TRUE;
103 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
long verbose
Definition: def_glob.h:273
#define set_empty
Definition: def_const.h:193
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
static long c_warning ( )
static

Definition at line 111 of file bi_sys.c.

References wl_goal::aaaa_1, aim, deref_args, infoline(), set_empty, TRUE, and warningflag.

112 {
113  ptr_psi_term t;
114 
115  t=aim->aaaa_1;
118 
119  /* RM: Sep 24 1993 */
120  infoline("*** Warning messages are%s printed\n",warningflag?"":" not");
121 
122  return TRUE;
123 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
#define set_empty
Definition: def_const.h:193
long warningflag
Definition: def_glob.h:270
void infoline(char *format,...)
Definition: error.c:245
#define TRUE
Definition: def_const.h:127
ptr_goal aim
Definition: def_glob.h:49
#define deref_args(P, S)
Definition: def_macro.h:145
void insert_system_builtins ( )

Definition at line 626 of file bi_sys.c.

References bi_module, c_cputime(), c_encode(), c_garbage(), c_getenv(), c_localtime(), c_maxint(), c_mresiduate(), c_quiet(), c_realtime(), c_residList(), c_residuate(), c_statistics(), c_step(), c_system(), c_tprove(), c_trace(), c_verbose(), c_warning(), function_it, new_built_in(), and predicate.

627 {
634  new_built_in(bi_module,"quiet",(def_type)function_it,c_quiet); /* 21.1 */
646 }
void new_built_in(ptr_module m, char *s, def_type t, long(*r)())
Definition: built_ins.c:5054
static long c_mresiduate()
Definition: bi_sys.c:581
static long c_garbage()
Definition: bi_sys.c:299
#define predicate
Definition: def_const.h:361
#define function_it
Definition: def_const.h:362
static long c_step()
Definition: bi_sys.c:79
static long c_realtime()
Definition: bi_sys.c:201
static long c_verbose()
Definition: bi_sys.c:93
static long c_residuate()
Definition: bi_sys.c:550
static long c_getenv()
Definition: bi_sys.c:313
long c_trace()
Definition: bi_sys.c:20
static long c_warning()
Definition: bi_sys.c:111
static long c_system()
Definition: bi_sys.c:349
static long c_cputime()
Definition: bi_sys.c:175
static long c_residList()
Definition: bi_sys.c:504
static long c_encode()
Definition: bi_sys.c:395
static long c_localtime()
Definition: bi_sys.c:231
ptr_module bi_module
Definition: def_glob.h:155
static long c_maxint()
Definition: bi_sys.c:129
static long c_statistics()
Definition: bi_sys.c:265
long c_tprove()
Definition: bi_sys.c:65
long c_quiet()
Definition: bi_sys.c:155
GENERIC intListNext ( ptr_int_list  p)

Definition at line 430 of file bi_sys.c.

432 {
433  return (GENERIC )(p->next);
434 }
unsigned long * GENERIC
Definition: def_struct.h:17
ptr_int_list next
Definition: def_struct.h:55
ptr_psi_term intListValue ( ptr_int_list  p)

Definition at line 424 of file bi_sys.c.

References makePsiTerm().

426 {
427  return makePsiTerm((void *)p->value_1);
428 }
ptr_psi_term makePsiTerm(ptr_definition x)
Definition: bi_sys.c:468
GENERIC value_1
Definition: def_struct.h:54
ptr_goal makeGoal ( ptr_psi_term  p)

Definition at line 533 of file bi_sys.c.

References DEFRULES, goal_stack, wl_goal::next, NULL, prove, and push_goal().

535 {
536  ptr_goal old = goal_stack;
537  ptr_goal g;
538 
540  g = goal_stack;
541  g->next=NULL;
542  goal_stack = old;
543  return g;
544 }
#define prove
Definition: def_const.h:273
ptr_goal goal_stack
Definition: def_glob.h:50
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
Definition: login.c:555
#define DEFRULES
Definition: def_const.h:138
#define NULL
Definition: def_const.h:203
unsigned long * GENERIC
Definition: def_struct.h:17
ptr_goal next
Definition: def_struct.h:227
ptr_psi_term makePsiList ( GENERIC  head,
ptr_psi_term (*)()  valueFunc,
GENERIC (*)()  nextFunc 
)

Definition at line 480 of file bi_sys.c.

References stack_cons(), and stack_nil().

485 {
486  ptr_psi_term result;
487 
488 
489  /* RM: Dec 14 1992: Added the new list representation */
490  result=stack_nil();
491 
492  while (head) {
493  result=stack_cons((*valueFunc)(head),result);
494  head=(*nextFunc)(head);
495  }
496  return result;
497 }
ptr_psi_term stack_cons(ptr_psi_term head, ptr_psi_term tail)
Definition: built_ins.c:47
ptr_psi_term stack_nil()
Definition: built_ins.c:29
ptr_psi_term makePsiTerm ( ptr_definition  x)

Definition at line 468 of file bi_sys.c.

References stack_psi_term(), and wl_psi_term::type.

470 {
471  ptr_psi_term p;
472 
473  p = stack_psi_term(4);
474  p->type = x;
475  return p;
476 }
ptr_psi_term stack_psi_term(long stat)
Definition: lefun.c:15
ptr_definition type
Definition: def_struct.h:165
ptr_psi_term quotedStackCopy ( psi_term  p)

Definition at line 436 of file bi_sys.c.

References mark_quote(), and stack_copy_psi_term().

438 {
439  ptr_psi_term q;
440 
442  mark_quote(q);
443  return q;
444 }
void mark_quote(ptr_psi_term t)
Definition: copy.c:601
ptr_psi_term stack_copy_psi_term(psi_term t)
Definition: parser.c:183
struct wl_psi_term * ptr_psi_term
Definition: def_struct.h:34
ptr_psi_term residListGoalQuote ( ptr_residuation  p)

Definition at line 451 of file bi_sys.c.

References copyPsiTerm, stack_psi_term(), and wl_psi_term::status.

453 {
454  ptr_psi_term psi;
455 
456  psi = stack_psi_term(4);
457  copyPsiTerm(psi, p->goal->aaaa_1);
458  psi->status = 4;
459  return psi;
460 }
ptr_psi_term aaaa_1
Definition: def_struct.h:224
ptr_goal goal
Definition: def_struct.h:156
#define copyPsiTerm(a, b)
Definition: bi_sys.c:8
ptr_psi_term stack_psi_term(long stat)
Definition: lefun.c:15
GENERIC residListNext ( ptr_residuation  p)

Definition at line 462 of file bi_sys.c.

464 {
465  return (GENERIC )(p->next);
466 }
ptr_residuation next
Definition: def_struct.h:157
unsigned long * GENERIC
Definition: def_struct.h:17
void setUnitList ( GENERIC  x)

Definition at line 407 of file bi_sys.c.

References unitListElement.

409 {
410  unitListElement = x;
411 }
static GENERIC unitListElement
Definition: bi_sys.c:405
GENERIC unitListNext ( )

Definition at line 418 of file bi_sys.c.

References NULL, and unitListElement.

419 {
421  return NULL;
422 }
#define NULL
Definition: def_const.h:203
static GENERIC unitListElement
Definition: bi_sys.c:405
ptr_psi_term unitListValue ( )

Definition at line 413 of file bi_sys.c.

References makePsiTerm(), and unitListElement.

414 {
415  return makePsiTerm((void *)unitListElement);
416 }
ptr_psi_term makePsiTerm(ptr_definition x)
Definition: bi_sys.c:468
static GENERIC unitListElement
Definition: bi_sys.c:405

Variable Documentation

GENERIC unitListElement
static

Definition at line 405 of file bi_sys.c.