summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pd_client.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/pd_client.pl b/pd_client.pl
index 72742e6..497959a 100644
--- a/pd_client.pl
+++ b/pd_client.pl
@@ -13,6 +13,10 @@ launch(Module, StreamIn, StreamOut) :-
atom_concat('rules/', Module, Path), consult(Path),
do([], StreamIn, StreamOut, Module, [], []).
+% -1 = EOF
+byte_to_atom(-1, e):-!.
+byte_to_atom(A, B):-name(B, [A]).
+
do(e, _, _, _, _, _) :- !.
do(Choice, StreamIn, StreamOut, Module, ModuleState, Hist) :-
call(Module, Hist, ModuleDecision, ModuleState, NewModuleState),
@@ -20,5 +24,6 @@ do(Choice, StreamIn, StreamOut, Module, ModuleState, Hist) :-
loop(StreamIn, StreamOut, Module, NewModuleState, [Choice|Hist]).
loop(StreamIn, StreamOut, Module, ModuleState, Hist) :-
- read_atom(StreamIn, Choice), write(Choice),
+ get_code(StreamIn, ChoiceCode), byte_to_atom(ChoiceCode, Choice),
+ write(Choice),
do(Choice, StreamIn, StreamOut, Module, ModuleState, Hist).