]> Repositorios git - scryer-prolog.git/commitdiff
add stream alias processing to atom_chars/2, atom_codes/2
authorMark <[email protected]>
Fri, 7 Jul 2023 16:38:05 +0000 (10:38 -0600)
committerMark <[email protected]>
Fri, 7 Jul 2023 16:38:05 +0000 (10:38 -0600)
src/machine/system_calls.rs

index b05dd1022e470b5ff50d2a98cf26f5e31852159c..f74ad4a8df6f98b7e609c467f41c311cc8236d64 100644 (file)
@@ -2181,6 +2181,17 @@ impl Machine {
 
                 self.machine_st.fail = true;
             }
+            (HeapCellValueTag::Cons, ptr) => {
+                match_untyped_arena_ptr!(ptr,
+                     (ArenaHeaderTag::Stream, stream) => {
+                         let alias = stream.options().get_alias().unwrap();
+                         self.machine_st.unify_complete_string(alias, a2);
+                     }
+                     _ => {
+                         unreachable!();
+                     }
+                );
+            }
             _ => {
                 unreachable!();
             }
@@ -2240,6 +2251,22 @@ impl Machine {
                     }
                 }
             }
+            (HeapCellValueTag::Cons, ptr) => {
+                match_untyped_arena_ptr!(ptr,
+                     (ArenaHeaderTag::Stream, stream) => {
+                         let alias = stream.options().get_alias().unwrap();
+
+                         let iter = alias.chars()
+                             .map(|c| fixnum_as_cell!(Fixnum::build_with(c as i64)));
+
+                         let h = iter_to_heap_list(&mut self.machine_st.heap, iter);
+                         unify!(self.machine_st, heap_loc_as_cell!(h), self.machine_st.registers[2]);
+                     }
+                     _ => {
+                         unreachable!();
+                     }
+                );
+            }
             _ => {
                 unreachable!();
             }