]> Repositorios git - scryer-prolog.git/commitdiff
support 'p' to reprint answer with max depth, allowing w -> p -> w ...
authorMarkus Triska <[email protected]>
Sun, 15 Mar 2020 12:16:40 +0000 (13:16 +0100)
committerMarkus Triska <[email protected]>
Sun, 15 Mar 2020 12:26:49 +0000 (13:26 +0100)
src/prolog/machine/system_calls.rs
src/prolog/toplevel.pl

index 2b521d405581b27effb162eb3c3f5a7033969a78..9e4262279754995c3c128bc97af1a45b6b483371 100644 (file)
@@ -34,6 +34,7 @@ pub enum ContinueResult {
     ContinueQuery,
     Conclude,
     PrintWithoutMaxDepth,
+    PrintWithMaxDepth
 }
 
 pub fn next_keypress() -> ContinueResult {
@@ -44,6 +45,9 @@ pub fn next_keypress() -> ContinueResult {
                     KeyCode::Char('w') => {
                         return ContinueResult::PrintWithoutMaxDepth;
                     }
+                    KeyCode::Char('p') => {
+                        return ContinueResult::PrintWithMaxDepth;
+                    }
                     KeyCode::Char(' ') | KeyCode::Char(';') | KeyCode::Char('n') => {
                         return ContinueResult::ContinueQuery;
                     }
@@ -2348,6 +2352,7 @@ impl MachineState {
                     ContinueResult::ContinueQuery => ';',
                     ContinueResult::Conclude => '.',
                     ContinueResult::PrintWithoutMaxDepth => 'w',
+                    ContinueResult::PrintWithMaxDepth => 'p',
                 };
 
                 let target = self[temp_v!(1)].clone();
index edf00883fbb1acca10632d772f5ff96103f30508..be7b255acb81693ffd8cbecf017ea8da4a63e34c 100644 (file)
 
 '$read_input'(ThreadedGoals, NewVarList) :-
     '$raw_input_read_char'(C),
-    (  C == ('w'), !,
+    (  C == w ->
        nl,
        write('   '),
        '$write_eq'(ThreadedGoals, NewVarList, 0),
        '$read_input'(ThreadedGoals, NewVarList)
-    ;  C == (';'), !,
+    ;  C == p ->
+       nl,
+       write('   '),
+       '$write_eq'(ThreadedGoals, NewVarList, 20),
+       '$read_input'(ThreadedGoals, NewVarList)
+    ;  C == (';') ->
        nl, write(';  '), false
-    ;  C == ('.'), !,
+    ;  C == '.',
        nl, write('   ...'), nl
     ).