Merge pull request #1287 from triska/rebis-dev-sgml

FIXED: library(sgml): load_html/3 and load_xml/3 now both work again.
This commit is contained in:
Mark Thom
2022-02-22 15:55:03 -07:00
committed by GitHub
2 changed files with 4 additions and 10 deletions

View File

@@ -58,6 +58,7 @@
:- use_module(library(error)).
:- use_module(library(dcgs)).
:- use_module(library(pio)).
:- use_module(library(charsio)).
load_html(Source, Es, Options) :-
load_structure_(Source, Es, Options, html).
@@ -75,15 +76,8 @@ load_structure_(file(Fs), [E], Options, What) :-
load_(What, Cs, E, Options).
load_structure_(stream(Stream), [E], Options, What) :-
must_be(list, Options),
read_to_end(Stream, Cs),
get_n_chars(Stream, _, Cs),
load_(What, Cs, E, Options).
load_(html, Cs, E, Options) :- '$load_html'(Cs, E, Options).
load_(xml, Cs, E, Options) :- '$load_xml'(Cs, E, Options).
read_to_end(Stream, Cs) :-
'$get_n_chars'(Stream, 4096, Cs0),
( Cs0 = [] -> Cs = []
; partial_string(Cs0, Cs, Rest),
read_to_end(Stream, Rest)
).

View File

@@ -6003,7 +6003,7 @@ impl Machine {
let tag = self.machine_st.atom_tbl.build_with(node.tag_name().name());
let result = heap_loc_as_cell!(self.machine_st.heap.len());
let result = str_loc_as_cell!(self.machine_st.heap.len());
self.machine_st.heap.push(atom_as_cell!(atom!("element"), 3));
self.machine_st.heap.push(atom_as_cell!(tag));
@@ -6056,7 +6056,7 @@ impl Machine {
);
let tag = self.machine_st.atom_tbl.build_with(name);
let result = heap_loc_as_cell!(self.machine_st.heap.len());
let result = str_loc_as_cell!(self.machine_st.heap.len());
self.machine_st.heap.push(atom_as_cell!(atom!("element"), 3));
self.machine_st.heap.push(atom_as_cell!(tag));