Wild Life: bi_sys.c File Reference

Wild Life 2.30

- Main Page
- Data Structures
- Files

- File List
- Globals

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

built in system functions More...

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 ()
| trace More...
long | c_tprove ()
| c_tprove More...
static long | c_step ()
| c_step More...
static long | c_verbose ()
| c_verbose More...
static long | c_warning ()
| c_warning More...
static long | c_maxint ()
| c_maxint More...
long | c_quiet ()
| c_quiet More...
static long | c_cputime ()
| c_cputime More...
static long | c_realtime ()
| c_realtime More...
static long | c_localtime ()
| localtime More...
static long | c_statistics ()
| c_statistics More...
static long | c_garbage ()
| c_garbage More...
static long | c_getenv ()
| c_getenv More...
static long | c_system ()
| c_system More...
static long | c_encode ()
| c_encode More...
void | setUnitList (GENERIC x)
| setUnitList(GENERIC x) More...
ptr_psi_term | unitListValue ()
| make psi term from unitListElement More...
GENERIC | unitListNext ()
| set unitListElement to NULL & return NULL More...
ptr_psi_term | intListValue (ptr_int_list p)
| ptr_psi_term intListValue More...
GENERIC | intListNext (ptr_int_list p)
| intListNext More...
ptr_psi_term | quotedStackCopy (psi_term p)
ptr_psi_term | residListGoalQuote (ptr_residuation p)
| residListGoalQuote More...
GENERIC | residListNext (ptr_residuation p)
| residListNext More...
ptr_psi_term | makePsiTerm (ptr_definition x)
| ptr_psi_term makePsiTerm More...
ptr_psi_term | makePsiList (GENERIC head, ptr_psi_term(*valueFunc)(), GENERIC(*nextFunc)())
| makePsiList More...
static long | c_residList ()
| c_residList() More...
ptr_goal | makeGoal (ptr_psi_term p)
| makeGoal More...
static long | c_residuate ()
| c_residuate More...
static long | c_mresiduate ()
| c_mresiduate More...
void | insert_system_builtins ()
| insert_system_builtins More...

## Variables
static GENERIC | unitListElement

## Detailed Description

built in system functions

Definition in file bi_sys.c.

## Macro Definition Documentation

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

Definition at line 10 of file bi_sys.c.

## Function Documentation

static long c_cputime | ( |  | ) |
| static

c_cputime

Return the cpu-time in seconds used by the Wild_Life interpreter.

Definition at line 207 of file bi_sys.c.

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

208 {
209 ptr_psi_term result, t;
210 REAL thetime,val;
211 long num,success;
212
213 t=aim->aaaa_1;
214 deref_args(t,set_empty);
215 result=aim->bbbb_1;
216 deref_ptr(result);
217 success=get_real_value(result,&val,&num);
218 if (success) {
219 (void)times(&life_end);
220 thetime=(life_end.tms_utime-life_start.tms_utime)/60.0;
221 if (num)
222 success=(val==thetime);
223 else
224 success=unify_real_result(result,thetime);
225 }
226 return success;
227 }
life_end
struct tms life_end
Definition: def_glob.h:90
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_real_value
long get_real_value(ptr_psi_term t, REAL *v, long *n)
get_real_value
Definition: built_ins.c:261
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
life_start
struct tms life_start
time life started - seconds
Definition: def_glob.h:83
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
unify_real_result
long unify_real_result(ptr_psi_term t, REAL v)
unify_real_result
Definition: built_ins.c:386
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240

static long c_encode | ( |  | ) |
| static

c_encode

Force type encoding. This need normally never be called by the user.

Definition at line 449 of file bi_sys.c.

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

450 {
451 ptr_psi_term t;
452
453 t=aim->aaaa_1;
454 deref_args(t,set_empty);
455 encode_types();
456 return TRUE;
457 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
encode_types
void encode_types()
encode_types
Definition: types.c:1091
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

static long c_garbage | ( |  | ) |
| static

c_garbage

Force a call to the garbage collector.

Definition at line 343 of file bi_sys.c.

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

344 {
345 ptr_psi_term t;
346
347 t=aim->aaaa_1;
348 deref_args(t,set_empty);
349 garbage();
350 return TRUE;
351 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
garbage
void garbage()
garbage
Definition: memory.c:1530
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

static long c_getenv | ( |  | ) |
| static

c_getenv

Get the value of an environment variable.

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

361 {
362 long success=FALSE;
363 ptr_psi_term arg1,arg2,funct,result,t;
364 long smaller;
365 char * s;
366
367 funct = aim->aaaa_1;
368 result=aim->bbbb_1;
369 deref_ptr(funct);
370 deref_ptr(result);
371
372 get_two_args(funct->attr_list, &arg1, &arg2);
373 if(arg1) {
374 deref_ptr(arg1);
375 if(matches(arg1->type,quoted_string,&smaller) && arg1->value_3) {
376 s=getenv((char *)arg1->value_3);
377 if(s) {
378 success=TRUE;
379 t=stack_psi_term(4);
380 t->type=quoted_string;
381 t->value_3=(GENERIC)heap_copy_string(s);
382 push_goal(unify,result,t,NULL);
383 }
384 }
385 else
386 Errorline("bad argument in %P\n",funct);
387 }
388 else
389 Errorline("argument missing in %P\n",funct);
390
391 return success;
392 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
push_goal
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
push_goal
Definition: login.c:600
wl_psi_term
Definition: def_struct.h:177
matches
long matches(ptr_definition t1, ptr_definition t2, long *smaller)
matches
Definition: types.c:1666
NULL
#define NULL
Definition: def_const.h:533
Errorline
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
heap_copy_string
char * heap_copy_string(char *s)
heap_copy_string
Definition: trees.c:172
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
aim
ptr_goal aim
Definition: def_glob.h:1024
unify
#define unify
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1058
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
quoted_string
ptr_definition quoted_string
symbol in bi module
Definition: def_glob.h:368

static long c_localtime | ( |  | ) |
| static

localtime

Return a psi-term containing the local time split up into year, month, day, hour, minute, second, and weekday. This is useful for building real-time applications such as clocks.

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

270 {
271 ptr_psi_term result, t, psitime;
272 long success=TRUE;
273 struct timeval tp;
274 struct timezone tzp;
275 struct tm *thetime;
276
277 t=aim->aaaa_1;
278 deref_args(t,set_empty);
279 result=aim->bbbb_1;
280 deref_ptr(result);
281
282 gettimeofday(&tp, &tzp);
283 thetime=localtime((time_t *) &(tp.tv_sec));
284
285 psitime=stack_psi_term(4);
286 psitime->type=timesym;
287 stack_add_int_attr(psitime, year_attr, thetime->tm_year+1900);
288 stack_add_int_attr(psitime, month_attr, thetime->tm_mon+1);
289 stack_add_int_attr(psitime, day_attr, thetime->tm_mday);
290 stack_add_int_attr(psitime, hour_attr, thetime->tm_hour);
291 stack_add_int_attr(psitime, minute_attr, thetime->tm_min);
292 stack_add_int_attr(psitime, second_attr, thetime->tm_sec);
293 stack_add_int_attr(psitime, weekday_attr, thetime->tm_wday);
294
295 push_goal(unify,result,psitime,NULL);
296
297 return success;
298 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
push_goal
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
push_goal
Definition: login.c:600
timesym
ptr_definition timesym
symbol in bi module
Definition: def_glob.h:417
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
NULL
#define NULL
Definition: def_const.h:533
stack_add_int_attr
void stack_add_int_attr(ptr_psi_term t, char *attrname, long value)
stack_add_int_attr
Definition: token.c:94
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
aim
ptr_goal aim
Definition: def_glob.h:1024
weekday_attr
char * weekday_attr
Definition: def_glob.h:900
unify
#define unify
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1058
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
minute_attr
char * minute_attr
Definition: def_glob.h:898
year_attr
char * year_attr
Definition: def_glob.h:894
second_attr
char * second_attr
Definition: def_glob.h:899
day_attr
char * day_attr
Definition: def_glob.h:896
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
hour_attr
char * hour_attr
Definition: def_glob.h:897
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240
month_attr
char * month_attr
Definition: def_glob.h:895

static long c_maxint | ( |  | ) |
| static

c_maxint

Return the integer of greatest magnitude that guarantees exact integer arithmetic.

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

158 {
159 ptr_psi_term t,result;
160 REAL val;
161 long num,success;
162
163 t=aim->aaaa_1;
164 deref_args(t,set_empty);
165 result=aim->bbbb_1;
166 deref_ptr(result);
167 success=get_real_value(result,&val,&num);
168 if (success) {
169 if (num)
170 success=(val==(REAL)WL_MAXINT);
171 else
172 success=unify_real_result(result,(REAL)WL_MAXINT);
173 }
174 return success;
175 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_real_value
long get_real_value(ptr_psi_term t, REAL *v, long *n)
get_real_value
Definition: built_ins.c:261
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
WL_MAXINT
#define WL_MAXINT
Maximum exactly representable integer (2^53-1 for double IEEE format)
Definition: def_const.h:140
unify_real_result
long unify_real_result(ptr_psi_term t, REAL v)
unify_real_result
Definition: built_ins.c:386
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240

static long c_mresiduate | ( |  | ) |
| static

c_mresiduate

Multiple-variable residuation of a predicate. mresiduate(A,B) -> residuate goal B on a list of variables A, non_strict in both args. If any of the variables is bound the predicate is executed. The list must have finite length.

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

700 {
701 long success=TRUE;
702 ptr_psi_term pred;
703 ptr_psi_term arg1, arg2, tmp, var;
704 ptr_goal g;
705
706 pred = aim->aaaa_1;
707 deref_ptr(pred);
708
709 get_two_args(pred->attr_list, &arg1, &arg2);
710 if ((!arg1)||(!arg2)) {
711 Errorline("%P requires two arguments.\n",pred);
712 return FALSE;
713 }
714
715 deref_ptr(arg1);
716 deref_ptr(arg2);
717 deref_args(pred, set_1_2);
718
719 g = makeGoal(arg2);
720
721 /* Then residuate on all the list variables: */
722 tmp=arg1;
723 while(tmp && tmp->type==alist) { /* RM: Dec 14 1992 */
724 get_two_args(tmp->attr_list,&var,&tmp);
725 if(var) {
726 deref_ptr(var);
727 (void)residuateGoalOnVar(g,var,NULL);
728 }
729 if(tmp)
730 deref_ptr(tmp);
731 }
732
733 if(!tmp || tmp->type!=nil) {
734 Errorline("%P should be a nil-terminated list in mresiduate.\n",arg1);
735 success=FALSE;
736 }
737
738 return success;
739 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
alist
ptr_definition alist
symbol in bi module
Definition: def_glob.h:319
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
wl_goal
Definition: def_struct.h:237
wl_psi_term
Definition: def_struct.h:177
residuateGoalOnVar
long residuateGoalOnVar(ptr_goal g, ptr_psi_term var, ptr_psi_term othervar)
residuateGoalOnVar
Definition: lefun.c:192
NULL
#define NULL
Definition: def_const.h:533
Errorline
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
set_1_2
#define set_1_2
Set constants for deref_args in lefun.c.
Definition: def_const.h:514
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
nil
ptr_definition nil
symbol in bi module
Definition: def_glob.h:340
aim
ptr_goal aim
Definition: def_glob.h:1024
makeGoal
ptr_goal makeGoal(ptr_psi_term p)
makeGoal
Definition: bi_sys.c:646
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187

long c_quiet | ( |  | ) |

c_quiet

Return the value of not(NOTQUIET).

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

187 {
188 ptr_psi_term t,result,ans;
189 long success=TRUE;
190
191 t=aim->aaaa_1;
192 deref_args(t,set_empty);
193 result=aim->bbbb_1;
194 deref_ptr(result);
195 ans=stack_psi_term(4);
196 ans->type = NOTQUIET ? lf_false : lf_true;
197 push_goal(unify,result,ans,NULL);
198 return success;
199 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
lf_false
ptr_definition lf_false
symbol in bi module
Definition: def_glob.h:284
NOTQUIET
#define NOTQUIET
Definition: def_macro.h:15
push_goal
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
push_goal
Definition: login.c:600
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
NULL
#define NULL
Definition: def_const.h:533
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
aim
ptr_goal aim
Definition: def_glob.h:1024
unify
#define unify
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1058
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
lf_true
ptr_definition lf_true
symbol in bi module
Definition: def_glob.h:410
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240

static long c_realtime | ( |  | ) |
| static

c_realtime

Return the time in seconds since 00:00:00 GMT, January 1, 1970. This is useful for building real-time applications such as clocks.

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

237 {
238 ptr_psi_term result, t;
239 REAL thetime,val;
240 long num,success;
241 struct timeval tp;
242 struct timezone tzp;
243
244 t=aim->aaaa_1;
245 deref_args(t,set_empty);
246 result=aim->bbbb_1;
247 deref_ptr(result);
248 success=get_real_value(result,&val,&num);
249 if (success) {
250 gettimeofday(&tp, &tzp);
251 thetime=(REAL)tp.tv_sec + ((REAL)tp.tv_usec/1000000.0);
252 /* thetime=times(&life_end)/60.0; */
253 if (num)
254 success=(val==thetime);
255 else
256 success=unify_real_result(result,thetime);
257 }
258 return success;
259 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_real_value
long get_real_value(ptr_psi_term t, REAL *v, long *n)
get_real_value
Definition: built_ins.c:261
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
unify_real_result
long unify_real_result(ptr_psi_term t, REAL v)
unify_real_result
Definition: built_ins.c:386
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240

static long c_residList | ( |  | ) |
| static

c_residList()

rlist(A) -> list all eval/prove goals residuated on variable 'A'.

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

613 {
614 ptr_psi_term func;
615 ptr_psi_term result,arg1, other;
616
617 func = aim->aaaa_1;
618 deref_ptr(func);
619
620 get_one_arg(func->attr_list, &arg1);
621 if (!arg1)
622 {
623 curry();
624 return TRUE;
625 }
626
627 result = aim->bbbb_1;
628 deref(result);
629 deref_ptr(arg1);
630 deref_args(func, set_1);
631
632 other = makePsiList((void *)arg1->resid,
633 residListGoalQuote,
634 residListNext);
635 resid_aim = NULL;
636 push_goal(unify,result,other,NULL);
637 return TRUE;
638 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_psi_term::resid
ptr_residuation resid
Definition: def_struct.h:189
push_goal
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
push_goal
Definition: login.c:600
wl_psi_term
Definition: def_struct.h:177
get_one_arg
void get_one_arg(ptr_node t, ptr_psi_term *a)
get_one_arg
Definition: login.c:99
set_1
#define set_1
Set constants for deref_args in lefun.c.
Definition: def_const.h:500
curry
void curry()
curry
Definition: lefun.c:174
NULL
#define NULL
Definition: def_const.h:533
resid_aim
ptr_goal resid_aim
Definition: def_glob.h:865
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
deref
#define deref(P)
Definition: def_macro.h:147
aim
ptr_goal aim
Definition: def_glob.h:1024
unify
#define unify
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1058
residListNext
GENERIC residListNext(ptr_residuation p)
residListNext
Definition: bi_sys.c:562
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
makePsiList
ptr_psi_term makePsiList(GENERIC head, ptr_psi_term(*valueFunc)(), GENERIC(*nextFunc)())
makePsiList
Definition: bi_sys.c:590
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240
residListGoalQuote
ptr_psi_term residListGoalQuote(ptr_residuation p)
residListGoalQuote
Definition: bi_sys.c:546
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187

static long c_residuate | ( |  | ) |
| static

c_residuate

residuate(A,B) -> residuate goal B on variable A, non_strict in both args

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

665 {
666 ptr_psi_term pred;
667 ptr_psi_term arg1, arg2;
668 ptr_goal g;
669
670 pred = aim->aaaa_1;
671 deref_ptr(pred);
672
673 get_two_args(pred->attr_list, &arg1, &arg2);
674 if ((!arg1)||(!arg2)) {
675 Errorline("%P requires two arguments.\n",pred);
676 return FALSE;
677 }
678
679 deref_ptr(arg1);
680 deref_ptr(arg2);
681 deref_args(pred, set_1_2);
682
683 g = makeGoal(arg2);
684 (void)residuateGoalOnVar(g, arg1, NULL);
685
686 return TRUE;
687 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
wl_goal
Definition: def_struct.h:237
wl_psi_term
Definition: def_struct.h:177
residuateGoalOnVar
long residuateGoalOnVar(ptr_goal g, ptr_psi_term var, ptr_psi_term othervar)
residuateGoalOnVar
Definition: lefun.c:192
NULL
#define NULL
Definition: def_const.h:533
Errorline
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
set_1_2
#define set_1_2
Set constants for deref_args in lefun.c.
Definition: def_const.h:514
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
aim
ptr_goal aim
Definition: def_glob.h:1024
makeGoal
ptr_goal makeGoal(ptr_psi_term p)
makeGoal
Definition: bi_sys.c:646
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187

static long c_statistics | ( |  | ) |
| static

c_statistics

Print some information about Wild_Life: stack size, heap size, total memory.

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

307 {
308 ptr_psi_term t;
309 long success=TRUE;
310 long t1,t2,t3;
311
312 t=aim->aaaa_1;
313 deref_args(t,set_empty);
314
315 t1 = sizeof(mem_base)*(stack_pointer-mem_base);
316 t2 = sizeof(mem_base)*(mem_limit-heap_pointer);
317 t3 = sizeof(mem_base)*(mem_limit-mem_base);
318
319 printf("\n");
320 /* printf("************** SYSTEM< INFORMATION **************\n"); */
321 printf("Stack size : %8ld bytes (%5ldK) (%ld%%)\n",t1,t1/1024,100*t1/t3);
322 printf("Heap size : %8ld bytes (%5ldK) (%ld%%)\n",t2,t2/1024,100*t2/t3);
323 printf("Total memory: %8ld bytes (%5ldK)\n",t3,t3/1024);
324
325 #ifdef X11
326 printf("X predicates are installed.\n");
327 #else
328 printf("X predicates are not installed.\n");
329 #endif
330
331 /* printf("\n"); */
332 /* printf("************************************************\n"); */
333 return success;
334 }
stack_pointer
GENERIC stack_pointer
used to allocate from stack - size allocated added - adj for alignment
Definition: def_glob.h:69
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
heap_pointer
GENERIC heap_pointer
used to allocate from heap - size allocated subtracted - adj for alignment
Definition: def_glob.h:55
mem_limit
GENERIC mem_limit
starting point of heap - mem_base aligned
Definition: def_glob.h:62
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
mem_base
GENERIC mem_base
mem_size memory allocated in init_memory by malloc
Definition: def_glob.h:48

static long c_step | ( |  | ) |
| static

c_step

Toggle the single step flag & print a message saying whether single stepping mode is on or off.

Definition at line 98 of file bi_sys.c.

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

99 {
100 ptr_psi_term t;
101
102 t=aim->aaaa_1;
103 deref_args(t,set_empty);
104 toggle_step();
105 return TRUE;
106 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
toggle_step
void toggle_step()
toggle_step
Definition: error.c:747
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

static long c_system | ( |  | ) |
| static

c_system

Pass a string to shell for execution. Return the value as the result.

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

401 {
402 long success=TRUE;
403 ptr_psi_term arg1,arg2,funct,result;
404 REAL value;
405 long smaller;
406
407 funct=aim->aaaa_1;
408 deref_ptr(funct);
409 result=aim->bbbb_1;
410 get_two_args(funct->attr_list,&arg1,&arg2);
411 if(arg1) {
412 deref(arg1);
413 deref_args(funct,set_1);
414 if((success=matches(arg1->type,quoted_string,&smaller)))
415 if(arg1->value_3) {
416 value=(REAL)system((char *)arg1->value_3);
417 if(value==127) {
418 success=FALSE;
419 Errorline("could not execute shell in %P.\n",funct);
420 /* report_error(funct,"couldn't execute shell"); */
421 }
422 else
423 success=unify_real_result(result,value);
424 }
425 else {
426 /* residuate(arg1); */ /* RM: Feb 10 1993 */
427 success=FALSE;
428 Errorline("bad argument in %P.\n",funct);
429 }
430 else {
431 success=FALSE;
432 Errorline("bad argument in %P.\n",funct);
433 /* report_error(funct,"bad argument"); */
434 }
435 }
436 else
437 curry();
438
439 return success;
440 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
wl_psi_term
Definition: def_struct.h:177
matches
long matches(ptr_definition t1, ptr_definition t2, long *smaller)
matches
Definition: types.c:1666
set_1
#define set_1
Set constants for deref_args in lefun.c.
Definition: def_const.h:500
curry
void curry()
curry
Definition: lefun.c:174
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
Errorline
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
deref
#define deref(P)
Definition: def_macro.h:147
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
unify_real_result
long unify_real_result(ptr_psi_term t, REAL v)
unify_real_result
Definition: built_ins.c:386
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_goal::bbbb_1
ptr_psi_term bbbb_1
Definition: def_struct.h:240
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
quoted_string
ptr_definition quoted_string
symbol in bi module
Definition: def_glob.h:368

long c_tprove | ( |  | ) |

c_tprove

UNSURE

Definition at line 81 of file bi_sys.c.

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

82 {
83 ptr_psi_term t;
84
85 t=aim->aaaa_1;
86 deref_args(t,set_empty);
87 set_trace_to_prove();
88 return TRUE;
89 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
set_trace_to_prove
void set_trace_to_prove()
set_trace_to_prove
Definition: error.c:727
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

long c_trace | ( |  | ) |

trace

long c_trace() turn tracing on or off

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

31 {
32 long success=TRUE;
33 ptr_psi_term t,arg1,arg2;
34
35 t=aim->aaaa_1;
36 deref_args(t,set_empty);
37 get_two_args(t->attr_list,&arg1,&arg2);
38 if (arg1) {
39 deref_ptr(arg1);
40 if (is_top(arg1)) {
41 unify_bool_result(arg1,trace);
42 trace=FALSE;
43 }
44 else if (arg1->type==lf_true)
45 trace=TRUE;
46 else if (arg1->type==lf_false)
47 trace=FALSE;
48 else {
49 Errorline("bad first argument in %P.\n",t);
50 /* report_error(t,"bad first argument"); */
51 success=FALSE;
52 }
53 }
54 if (arg2) {
55 deref_ptr(arg2);
56 if (is_top(arg2)) {
57 unify_bool_result(arg2,stepflag);
58 stepflag=FALSE;
59 }
60 else if (arg2->type==lf_true)
61 stepflag=TRUE;
62 else if (arg2->type==lf_false)
63 stepflag=FALSE;
64 else {
65 Errorline("bad second argument in %P.\n",t);
66 /* report_error(t,"bad second argument"); */
67 success=FALSE;
68 }
69 }
70 if (!arg1 && !arg2)
71 toggle_trace();
72 return success;
73 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
is_top
#define is_top(T)
Definition: def_macro.h:113
lf_false
ptr_definition lf_false
symbol in bi module
Definition: def_glob.h:284
unify_bool_result
void unify_bool_result(ptr_psi_term t, long v)
unify_bool_result
Definition: built_ins.c:344
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
trace
long trace
Definition: def_glob.h:913
Errorline
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
toggle_trace
void toggle_trace()
toggle_trace
Definition: error.c:737
stepflag
long stepflag
Definition: def_glob.h:676
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150
lf_true
ptr_definition lf_true
symbol in bi module
Definition: def_glob.h:410
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187

static long c_verbose | ( |  | ) |
| static

c_verbose

Toggle the verbose flag & print a message saying whether verbose mode is on or off.

Definition at line 115 of file bi_sys.c.

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

116 {
117 ptr_psi_term t;
118
119 t=aim->aaaa_1;
120 deref_args(t,set_empty);
121 verbose = !verbose;
122 printf("*** Verbose mode is turned ");
123 printf(verbose?"on.\n":"off.\n");
124 return TRUE;
125 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
verbose
long verbose
Definition: def_glob.h:914
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

static long c_warning | ( |  | ) |
| static

c_warning

Toggle the warning flag & print a message saying whether warnings are printed or not. Default: print warnings. (Errors cannot be turned off.)

Definition at line 136 of file bi_sys.c.

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

137 {
138 ptr_psi_term t;
139
140 t=aim->aaaa_1;
141 deref_args(t,set_empty);
142 warningflag = !warningflag;
143
144 /* RM: Sep 24 1993 */
145 infoline("*** Warning messages are%s printed\n",warningflag?"":" not");
146
147 return TRUE;
148 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_psi_term
Definition: def_struct.h:177
set_empty
#define set_empty
Set constants for deref_args in lefun.c.
Definition: def_const.h:493
warningflag
long warningflag
Definition: def_glob.h:911
infoline
void infoline(char *format,...)
infoline
Definition: error.c:281
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
aim
ptr_goal aim
Definition: def_glob.h:1024
deref_args
#define deref_args(P, S)
Definition: def_macro.h:150

void insert_system_builtins | ( |  | ) |

insert_system_builtins

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

747 {
748 new_built_in(bi_module,"trace",(def_type)predicate_it,c_trace);
749 new_built_in(bi_module,"step",(def_type)predicate_it,c_step);
750 new_built_in(bi_module,"verbose",(def_type)predicate_it,c_verbose);
751 new_built_in(bi_module,"warning",(def_type)predicate_it,c_warning);
752 new_built_in(bi_module,"maxint",(def_type)function_it,c_maxint);
753 new_built_in(bi_module,"cpu_time",(def_type)function_it,c_cputime);
754 new_built_in(bi_module,"quiet",(def_type)function_it,c_quiet); /* 21.1 */
755 new_built_in(bi_module,"real_time",(def_type)function_it,c_realtime);
756 new_built_in(bi_module,"local_time",(def_type)function_it,c_localtime);
757 new_built_in(bi_module,"statistics",(def_type)predicate_it,c_statistics);
758 new_built_in(bi_module,"gc",(def_type)predicate_it,c_garbage);
759 new_built_in(bi_module,"system",(def_type)function_it,c_system);
760 new_built_in(bi_module,"getenv",(def_type)function_it,c_getenv);
761 new_built_in(bi_module,"encode",(def_type)predicate_it,c_encode);
762 new_built_in(bi_module,"rlist",(def_type)function_it,c_residList);
763 new_built_in(bi_module,"residuate",(def_type)predicate_it,c_residuate);
764 new_built_in(bi_module,"mresiduate",(def_type)predicate_it,c_mresiduate);
765 new_built_in(bi_module,"tprove",(def_type)predicate_it,c_tprove);
766 }
new_built_in
void new_built_in(ptr_module m, char *s, def_type t, long(*r)())
new_built_in
Definition: built_ins.c:5375
c_mresiduate
static long c_mresiduate()
c_mresiduate
Definition: bi_sys.c:698
c_garbage
static long c_garbage()
c_garbage
Definition: bi_sys.c:343
function_it
#define function_it
was enum (def_type) in extern.h now there is typedef ptr_definition
Definition: def_const.h:1408
c_step
static long c_step()
c_step
Definition: bi_sys.c:98
c_realtime
static long c_realtime()
c_realtime
Definition: bi_sys.c:236
predicate_it
#define predicate_it
was enum (def_type) in extern.h now there is typedef ptr_definition
Definition: def_const.h:1401
c_verbose
static long c_verbose()
c_verbose
Definition: bi_sys.c:115
c_residuate
static long c_residuate()
c_residuate
Definition: bi_sys.c:664
c_getenv
static long c_getenv()
c_getenv
Definition: bi_sys.c:360
c_trace
long c_trace()
trace
Definition: bi_sys.c:30
c_warning
static long c_warning()
c_warning
Definition: bi_sys.c:136
wl_definition
Definition: def_struct.h:145
bi_module
ptr_module bi_module
Module for public built-ins.
Definition: def_glob.h:687
c_system
static long c_system()
c_system
Definition: bi_sys.c:400
c_cputime
static long c_cputime()
c_cputime
Definition: bi_sys.c:207
c_residList
static long c_residList()
c_residList()
Definition: bi_sys.c:612
c_encode
static long c_encode()
c_encode
Definition: bi_sys.c:449
c_localtime
static long c_localtime()
localtime
Definition: bi_sys.c:269
c_maxint
static long c_maxint()
c_maxint
Definition: bi_sys.c:157
c_statistics
static long c_statistics()
c_statistics
Definition: bi_sys.c:306
c_tprove
long c_tprove()
c_tprove
Definition: bi_sys.c:81
c_quiet
long c_quiet()
c_quiet
Definition: bi_sys.c:186

GENERIC intListNext | ( | ptr_int_list | p | ) |

intListNext

Parameters

  p | - ptr_int_list p

not sure purpose (DJD ???)

Definition at line 515 of file bi_sys.c.

References wl_int_list::next.

516 {
517 return (GENERIC )(p->next);
518 }
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
wl_int_list::next
ptr_int_list next
Definition: def_struct.h:86

ptr_psi_term intListValue | ( | ptr_int_list | p | ) |

ptr_psi_term intListValue

Parameters

  p | - ptr_int_list p

not sure purpose (DJD ???)

Definition at line 503 of file bi_sys.c.

References makePsiTerm(), and wl_int_list::value_1.

504 {
505 return makePsiTerm((void *)p->value_1);
506 }
makePsiTerm
ptr_psi_term makePsiTerm(ptr_definition x)
ptr_psi_term makePsiTerm
Definition: bi_sys.c:573
wl_int_list::value_1
GENERIC value_1
Definition: def_struct.h:85

ptr_goal makeGoal | ( | ptr_psi_term | p | ) |

makeGoal

Parameters

  p | - ptr_psi_term p

Definition at line 646 of file bi_sys.c.

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

647 {
648 ptr_goal old = goal_stack;
649 ptr_goal g;
650
651 push_goal(prove, p,(ptr_psi_term) DEFRULES,(GENERIC) NULL);
652 g = goal_stack;
653 g->next=NULL;
654 goal_stack = old;
655 return g;
656 }
prove
#define prove
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1051
goal_stack
ptr_goal goal_stack
Definition: def_glob.h:1025
push_goal
void push_goal(goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c)
push_goal
Definition: login.c:600
wl_goal
Definition: def_struct.h:237
wl_psi_term
Definition: def_struct.h:177
DEFRULES
#define DEFRULES
Must be different from NULL, a built-in index, and a pointer Used to indicate that the rules of the d...
Definition: def_const.h:302
NULL
#define NULL
Definition: def_const.h:533
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
wl_goal::next
ptr_goal next
Definition: def_struct.h:242

ptr_psi_term makePsiList | ( | GENERIC | head,
|  | ptr_psi_term(*)() | valueFunc,
|  | GENERIC(*)() | nextFunc
| ) |  |

makePsiList

Parameters

  head | - GENERIC head
  *valueFunc | - ptr_psi_term (*valueFunc)()
  nextFunc | - GENERIC (*nextFunc)()

Definition at line 590 of file bi_sys.c.

References stack_cons(), and stack_nil().

591 {
592 ptr_psi_term result;
593
594
595 /* RM: Dec 14 1992: Added the new list representation */
596 result=stack_nil();
597
598 while (head) {
599 result=stack_cons((*valueFunc)(head),result);
600 head=(*nextFunc)(head);
601 }
602 return result;
603 }
stack_cons
ptr_psi_term stack_cons(ptr_psi_term head, ptr_psi_term tail)
stack_cons
Definition: built_ins.c:46
wl_psi_term
Definition: def_struct.h:177
stack_nil
ptr_psi_term stack_nil()
stack_nil
Definition: built_ins.c:26

ptr_psi_term makePsiTerm | ( | ptr_definition | x | ) |

ptr_psi_term makePsiTerm

Parameters

  x | - ptr_definition x

Definition at line 573 of file bi_sys.c.

References stack_psi_term(), and wl_psi_term::type.

574 {
575 ptr_psi_term p;
576
577 p = stack_psi_term(4);
578 p->type = x;
579 return p;
580 }
wl_psi_term
Definition: def_struct.h:177
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181

ptr_psi_term quotedStackCopy | ( | psi_term | p | ) |

Definition at line 528 of file bi_sys.c.

References mark_quote(), and stack_copy_psi_term().

529 {
530 ptr_psi_term q;
531
532 q = (ptr_psi_term) stack_copy_psi_term(p);
533 mark_quote(q);
534 return q;
535 }
wl_psi_term
Definition: def_struct.h:177
ptr_psi_term
struct wl_psi_term * ptr_psi_term
quotedStackCopy
Definition: def_struct.h:62
mark_quote
void mark_quote(ptr_psi_term t)
mark_quote
Definition: copy.c:674
stack_copy_psi_term
ptr_psi_term stack_copy_psi_term(psi_term t)
stack_copy_psi_term
Definition: parser.c:205

ptr_psi_term residListGoalQuote | ( | ptr_residuation | p | ) |

residListGoalQuote

Parameters

  p | - ptr_residuation p

Return a ptr to a psi-term marked as evaluated. The psi-term is a copy at the top level of the goal residuated on p, with the rest of the psi-term shared.

Definition at line 546 of file bi_sys.c.

References wl_goal::aaaa_1, copyPsiTerm, wl_residuation::goal, stack_psi_term(), and wl_psi_term::status.

547 {
548 ptr_psi_term psi;
549
550 psi = stack_psi_term(4);
551 copyPsiTerm(psi, p->goal->aaaa_1);
552 psi->status = 4;
553 return psi;
554 }
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
wl_residuation::goal
ptr_goal goal
Definition: def_struct.h:172
copyPsiTerm
#define copyPsiTerm(a, b)
Definition: bi_sys.c:10
wl_psi_term
Definition: def_struct.h:177
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
wl_psi_term::status
long status
Definition: def_struct.h:182

GENERIC residListNext | ( | ptr_residuation | p | ) |

residListNext

Parameters

  p | - ptr_residuation p

Definition at line 562 of file bi_sys.c.

References wl_residuation::next.

563 {
564 return (GENERIC )(p->next);
565 }
wl_residuation::next
ptr_residuation next
Definition: def_struct.h:173
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35

void setUnitList | ( | GENERIC | x | ) |

setUnitList(GENERIC x)

Parameters

  x | - GENERIC x what to set static unitListElement to (GENERIC)

not sure purpose (DJD ???)

Definition at line 468 of file bi_sys.c.

References unitListElement.

469 {
470 unitListElement = x;
471 }
unitListElement
static GENERIC unitListElement
Definition: bi_sys.c:459

GENERIC unitListNext | ( |  | ) |

set unitListElement to NULL & return NULL

not sure purpose (DJD ???)

Definition at line 490 of file bi_sys.c.

References NULL, and unitListElement.

491 {
492 unitListElement = NULL;
493 return NULL;
494 }
NULL
#define NULL
Definition: def_const.h:533
unitListElement
static GENERIC unitListElement
Definition: bi_sys.c:459

ptr_psi_term unitListValue | ( |  | ) |

make psi term from unitListElement

not sure purpose (DJD ???)

Definition at line 479 of file bi_sys.c.

References makePsiTerm(), and unitListElement.

480 {
481 return makePsiTerm((void *)unitListElement);
482 }
makePsiTerm
ptr_psi_term makePsiTerm(ptr_definition x)
ptr_psi_term makePsiTerm
Definition: bi_sys.c:573
unitListElement
static GENERIC unitListElement
Definition: bi_sys.c:459

## Variable Documentation

GENERIC unitListElement
| static

Definition at line 459 of file bi_sys.c.