shithub: pprolog

Download patch

ref: a0eb2bb268774a85411f037983d931f35bc7830f
parent: 0c45e33c1b8d094353a5585c44179d1818ff6e1e
author: Peter Mikkelsen <peter@pmikkelsen.com>
date: Tue Jul 6 14:00:47 EDT 2021

Change the output of the repl a lille bit

--- a/repl.c
+++ b/repl.c
@@ -18,26 +18,31 @@
 		choicestack = nil;
 		goalstack = nil; /* should free old choicestack and goalstack */
 		int success;
+		int firsttime = 1;
 FindMore:
 		success = evalquery(query, &bindings);
+		if(firsttime){
+			print(" ");
+			firsttime = 0;
+		}
 		if(success == 0)
-			print("false.\n");
+			print("  false.\n");
 		else{
 			if(bindings == nil)
-				print("true.\n");
+				print("  true");
 			else{
 				while(bindings){
 					print("  %S = %S%s", 
 						bindings->name, 
 						prettyprint(bindings->value, 0, 0, 0), 
-						bindings->next ? " ,\n" : "");
+						bindings->next ? ",\n " : "");
 					bindings = bindings->next;
 				}
 			}
 			if(choicestack != nil){
-				print(" ");
+				print("\n");
 				if(parsefindmore(fd) == L';'){
-					print(";\n");
+					print(";");
 					goto FindMore;
 				}else
 					print(".\n");