]> Repositorios git - scryer-prolog.git/commitdiff
make chars callable (#713)
authorMark Thom <[email protected]>
Thu, 18 Mar 2021 01:50:41 +0000 (19:50 -0600)
committerMark Thom <[email protected]>
Thu, 18 Mar 2021 01:50:41 +0000 (19:50 -0600)
src/machine/machine_state_impl.rs
src/machine/system_calls.rs

index 71852bfb533f0aa96696dac158ca1b0ba8cf1c63..593523087ede37506fd099707ef55c33f889afeb 100644 (file)
@@ -1711,6 +1711,7 @@ impl MachineState {
                     return None;
                 }
             }
+            Addr::Char(c) => (clause_name!(c.to_string(), self.atom_tbl), 0),
             Addr::Con(h) => match &self.heap[h] {
                 HeapCellValue::Atom(ref name, _) => (name.clone(), 0),
                 _ => {
@@ -1726,7 +1727,7 @@ impl MachineState {
                 self.throw_exception(instantiation_error);
                 return None;
             }
-            _ => {
+            addr => {
                 let stub = MachineError::functor_stub(clause_name!("call"), arity + 1);
                 let type_error = self.error_form(
                     MachineError::type_error(self.heap.h(), ValidType::Callable, addr),
index af8e3e7e911684595768a2c6a968bd28aa7170c8..c7fcb154b64108ce2753d4c3578e2c9b32c90182 100644 (file)
@@ -2775,6 +2775,17 @@ impl MachineState {
                             unreachable!()
                         }
                     }
+                    Addr::Char(c) => {
+                        return self.module_lookup(
+                            indices,
+                            call_policy,
+                            (clause_name!(c.to_string(), self.atom_tbl), narity),
+                            module_name,
+                            true,
+                            current_input_stream,
+                            current_output_stream,
+                        );
+                    }
                     addr => {
                         let stub = MachineError::functor_stub(clause_name!("(:)"), 2);