summaryrefslogtreecommitdiff
path: root/builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtins.c')
-rw-r--r--builtins.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/builtins.c b/builtins.c
index 224750a..7230ba4 100644
--- a/builtins.c
+++ b/builtins.c
@@ -137,7 +137,7 @@ findbuiltin(Term *goal)
return builtinsetoutput;
if(Match(L"$read_term", 3))
return builtinreadterm;
- if(Match(L"write_term", 3))
+ if(Match(L"$write_term", 3))
return builtinwriteterm;
if(Match(L">=", 2))
return builtingeq;
@@ -354,7 +354,6 @@ builtincompare(Term *goal, Binding **bindings, Module *module)
int
builtinfunctor(Term *goal, Binding **bindings, Module *module)
{
- USED(module);
Term *term = goal->children;
Term *name = term->next;
Term *arity = name->next;
@@ -395,7 +394,7 @@ builtinfunctor(Term *goal, Binding **bindings, Module *module)
namestr = term->text;
arityint = term->arity;
}else{
- namestr = prettyprint(term, 0, 0, 0);
+ namestr = prettyprint(term, 0, 0, 0, module);
arityint = 0;
}
Term *realname = mkatom(namestr);
@@ -558,11 +557,10 @@ int
builtinthrow(Term *goal, Binding **bindings, Module *module)
{
USED(bindings);
- USED(module);
Term *ball = goal->children;
- print("Throwing: %S\n", prettyprint(ball, 0, 0, 0));
+ print("Throwing: %S\n", prettyprint(ball, 0, 0, 0, module));
Goal *g;
for(g = goalstack; g != nil; g = g->next){
if(g->catcher == nil)
@@ -571,7 +569,7 @@ builtinthrow(Term *goal, Binding **bindings, Module *module)
if(unify(g->catcher, ball, bindings)){
if(g->goal == nil){
/* As soon as we have print facilities as builtins, we can avoid this by having the protector frame have a unhandled exception handler*/
- print("Unhandled exception: %S\n", prettyprint(ball, 0, 0, 0));
+ print("Unhandled exception: %S\n", prettyprint(ball, 0, 0, 0, module));
exits("exception");
return 0;
}else{
@@ -912,8 +910,6 @@ builtinwriteterm(Term *goal, Binding **bindings, Module *module)
if(stream->tag == VariableTerm)
Throw(instantiationerror());
- if(options->tag != AtomTerm || runestrcmp(options->text, L"[]") != 0)
- Throw(typeerror(L"empty_list", options));
if(stream->tag != IntegerTerm && stream->tag != AtomTerm)
Throw(domainerror(L"stream_or_alias", stream));
if(!isopenstream(stream))
@@ -922,7 +918,7 @@ builtinwriteterm(Term *goal, Binding **bindings, Module *module)
Throw(permissionerror(L"output", L"stream", stream));
if(isbinarystream(stream))
Throw(permissionerror(L"output", L"binary_stream", stream));
- writeterm(stream, options, term);
+ writeterm(stream, options, term, module);
return 1;
}