shithub: pprolog

ref: 48c0638c7be3f99f2512be42fbb6b3946df26463
dir: /fns.h/

View raw version
/* parser.c */
Term *parse(int, Biobuf *, int);

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

/* 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 *, Binding **);
int unify(Term *, Term *, Binding **);
void applybinding(Term *, Binding *);
Goal *addgoals(Goal *, Term *, Module *);
Predicate *findpredicate(Predicate *, Term *);
Clause *findclause(Clause *, Term *, Binding **);

/* repl.c */
void repl(void);

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

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

/* 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 readterm(Term *, Term *, Term **);
void writeterm(Term *, Term *, Term *);

/* module.c */
void initmodules(void);
Module *parsemodule(char *);
Module *getmodule(Rune *);
Clause *appendclause(Clause *, Clause *);
Predicate *appendpredicate(Predicate *, Predicate *);

/* 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);