summaryrefslogtreecommitdiff
path: root/fns.h
blob: e2785ac725edab36ce2249bc8a912bd7ec6aab03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* parser.c */
Term *parse(int, Biobuf *, int);

/* prettyprint.c */
Rune *prettyprint(Term *, int, int, int, Module *);

/* misc.c */
Term *copyterm(Term *, uvlong *);
Term *appendterm(Term *, Term *);
int termslength(Term *);
Term *mkatom(Rune *);
Term *mkvariable(Rune *);
Term *mkcompound(Rune *, int, Term *);
Term *mkfloat(double);
Term *mkinteger(vlong);
Term *mkstring(Rune *);
Term *mklist(Term *);
Clause *copyclause(Clause *, uvlong *);

/* eval.c */
int evalquery(Term *);
int unify(Term *, Term *, Binding **);
void applybinding(Term *, Binding *);
Goal *addgoals(Goal *, Term *, Module *);
Predicate *findpredicate(Predicate *, Term *);
Clause *findclause(Clause *, Term *, Binding **);

/* builtins.c */
Builtin findbuiltin(Term *);

/* flags.c */
void initflags(void);
void setflag(Rune *, Term *);
Term *getallflags(void);

/* error.c */
Term *instantiationerror(void);
Term *typeerror(Rune *, Term *);
Term *domainerror(Rune *, Term *);
Term *existenceerror(Rune *, Term *);
Term *permissionerror(Rune *, Rune *, Term *);
Term *representationerror(Rune *);
Term *evaluationerror(Rune *);
Term *resourceerror(Rune *);
Term *syntaxerror(Rune *);

/* streams.c */
void initstreams(void);
int openstream(Rune *, Rune *, Term *, Term **);
void closestream(Term *);
Term *currentinputstream(void);
Term *currentoutputstream(void);
void setcurrentinputstream(Term *);
void setcurrentoutputstream(Term *);
int isopenstream(Term *);
int isinputstream(Term *);
int isoutputstream(Term *);
int istextstream(Term *);
int isbinarystream(Term *);
int canreposition(Term *);
int readterm(Term *, Term **);
void writeterm(Term *, Term *, Term *, Module *);
Rune getchar(Term *);
Rune peekchar(Term *);
void putchar(Term *, Rune);
void flushstream(Term *);
Term *streamsproperties(void);
void reposition(Term *, vlong);

/* module.c */
void initmodules(void);
int addtousermod(char *);
Module *getmodule(Rune *);
Module *addemptymodule(Rune *);
void removemodule(Rune *);
Clause *appendclause(Clause *, Clause *);
Predicate *appendpredicate(Predicate *, Predicate *);
Operator *getoperator(Rune *, Module *);
void addoperator(int, int, Rune *, Module *);

/* types.c */
int islist(Term *);
int ispartiallist(Term *t);
int isemptylist(Term *);
int isnonemptylist(Term *);
int ispredicateindicator(Term *, int);
Term *listhead(Term *);
Term *listtail(Term *);

/* arithmetic.c */
Term *aritheval(Term *, int *);

/* garbage.c */
void *gmalloc(ulong);
vlong collectgarbage(void);