swi to system.

This commit is contained in:
Vítor Santos Costa 2010-05-03 18:53:45 +01:00
parent a7f99fe465
commit 85361bf920

View File

@ -94,8 +94,10 @@ register_catalog(Base) :-
SocFile), SocFile),
sgml_register_catalog_file(SocFile, end). sgml_register_catalog_file(SocFile, end).
% make sure this is loaded in the current module, not user.
:- load_foreign.
init :- init :-
load_foreign,
ignore(register_catalog('HTML4')). ignore(register_catalog('HTML4')).
:- initialization :- initialization
@ -158,10 +160,10 @@ load_dtd(DTD, DtdFile) :-
load_dtd(DTD, DtdFile, Options) :- load_dtd(DTD, DtdFile, Options) :-
split_dtd_options(Options, DTDOptions, FileOptions), split_dtd_options(Options, DTDOptions, FileOptions),
open_dtd(DTD, DTDOptions, DtdOut), open_dtd(DTD, DTDOptions, DtdOut),
swi:swi_open(DtdFile, read, DtdIn, FileOptions), system:swi_open(DtdFile, read, DtdIn, FileOptions),
swi:swi_copy_stream_data(DtdIn, DtdOut), system:swi_copy_stream_data(DtdIn, DtdOut),
swi:swi_close(DtdIn), system:swi_close(DtdIn),
swi:swi_close(DtdOut). system:swi_close(DtdOut).
split_dtd_options([], [], []). split_dtd_options([], [], []).
split_dtd_options([H|T], [H|TD], S) :- split_dtd_options([H|T], [H|TD], S) :-
@ -294,12 +296,12 @@ load_structure(stream(In), Term, Options) :- !,
), ),
Term = TermRead. Term = TermRead.
load_structure(Stream, Term, Options) :- load_structure(Stream, Term, Options) :-
swi:swi_is_stream(Stream), !, system:swi_is_stream(Stream), !,
load_structure(stream(Stream), Term, Options). load_structure(stream(Stream), Term, Options).
load_structure(File, Term, Options) :- load_structure(File, Term, Options) :-
swi:swi_open(File, read, In, [type(binary)]), system:swi_open(File, read, In, [type(binary)]),
load_structure(stream(In), Term, [file(File)|Options]), load_structure(stream(In), Term, [file(File)|Options]),
swi:swi_close(In). system:swi_close(In).
parse(Parser, Options, Document, In) :- parse(Parser, Options, Document, In) :-
set_parser_options(Parser, Options, Options1), set_parser_options(Parser, Options, Options1),
@ -319,8 +321,8 @@ def_entities([H|T0], DTD, [H|T]) :-
def_entity(DTD, Name, Value) :- def_entity(DTD, Name, Value) :-
open_dtd(DTD, [], Stream), open_dtd(DTD, [], Stream),
xml_quote_attribute(Value, QValue), xml_quote_attribute(Value, QValue),
swi:swi_format(Stream, '<!ENTITY ~w "~w">~n', [Name, QValue]), system:swi_format(Stream, '<!ENTITY ~w "~w">~n', [Name, QValue]),
swi:close(Stream). system:close(Stream).
/******************************* /*******************************