docs and strings
This commit is contained in:
parent
e315217f0e
commit
f6c5a2eea1
@ -1,86 +1,104 @@
|
|||||||
/* xml.pl : XML Module wrapper for Quintus Prolog.
|
/* xml.pl : XML Module wrapper for Quintus Prolog.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001-2005 Binding Time Limited
|
* Copyright (C) 2001-2005 Binding Time Limited
|
||||||
* Copyright (C) 2005-2011 John Fletcher
|
* Copyright (C) 2005-2011 John Fletcher
|
||||||
*
|
*
|
||||||
* Current Release: $Revision: 3.3 $
|
* Current Release: $Revision: 3.3 $
|
||||||
*
|
*
|
||||||
* TERMS AND CONDITIONS:
|
* TERMS AND CONDITIONS:
|
||||||
*
|
*
|
||||||
* This program is offered free of charge, as unsupported source code. You may
|
* This program is offered free of charge, as unsupported source code. You may
|
||||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||||
* but entirely at your own risk.
|
* but entirely at your own risk.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
:- module( xml,
|
:- module( xml,
|
||||||
[
|
[
|
||||||
xml_parse/2,
|
xml_parse/2,
|
||||||
xml_parse/3,
|
xml_parse/3,
|
||||||
xml_subterm/2,
|
xml_subterm/2,
|
||||||
xml_pp/1
|
xml_pp/1,
|
||||||
] ).
|
load_xml/3,
|
||||||
|
load_xml/2
|
||||||
/* xml is intended to be a rather modular module: it should be easy to
|
] ).
|
||||||
* build a program that can output XML, but not read it, or vice versa.
|
|
||||||
* Similarly, you may be happy to dispense with diagnosis once you are
|
|
||||||
* sure that your code will only try to make valid calls to xml_parse/2.
|
|
||||||
*
|
|
||||||
* It is intended that the code should be very portable too. Clearly,
|
|
||||||
* some small changes will be needed between platforms, but these should
|
|
||||||
* be limited to xml_utilities. xml_utilities contains most of the shared
|
|
||||||
* code and most of the potentially non-portable code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
:- use_module( library(lists), [append/3] ).
|
/* @section xml Prolog XML module
|
||||||
|
* xml is intended to be a rather modular module: it should be easy to
|
||||||
|
* build a program that can output XML, but not read it, or vice versa.
|
||||||
|
* Similarly, you may be happy to dispense with diagnosis once you are
|
||||||
|
* sure that your code will only try to make valid calls to xml_parse/2.
|
||||||
|
*
|
||||||
|
* It is intended that the code should be very portable too. Clearly,
|
||||||
|
* some small changes will be needed between platforms, but these should
|
||||||
|
* be limited to xml_utilities. xml_utilities contains most of the shared
|
||||||
|
* code and most of the potentially non-portable code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
:- use_module( library(lists), [append/3] ).
|
||||||
|
:- use_module( library(readutil) ).
|
||||||
|
|
||||||
|
|
||||||
:- ensure_loaded( xml/xml_driver ).
|
:- ensure_loaded( xml/xml_driver ).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* atom_codes/2, number_codes/2 and throw/1 are ISO predicates, mapped to
|
/* atom_codes/2, number_codes/2 and throw/1 are ISO predicates, mapped to
|
||||||
* the Quintus equivalent here.
|
* the Quintus equivalent here.
|
||||||
*/
|
*/
|
||||||
%atom_codes( Atom, Codes ) :-
|
%atom_codes( Atom, Codes ) :-
|
||||||
% atom_chars( Atom, Codes ).
|
% atom_chars( Atom, Codes ).
|
||||||
|
|
||||||
%number_codes( Number, Codes ) :-
|
%number_codes( Number, Codes ) :-
|
||||||
% number_chars( Number, Codes ).
|
% number_chars( Number, Codes ).
|
||||||
|
|
||||||
/* xml_exception( +Message, +Document, +Culprit, +Path ) is a hook to
|
/** @pred xml_exception( +Message, +Document, +Culprit, +Path )
|
||||||
* raise an exception to be raised in respect of a fault in the XML Term:
|
* a hook to
|
||||||
* Document.
|
* raise an exception to be raised in respect of a fault in the XML Term:
|
||||||
* - Culprit is a sub-term of Document which cannot be serialized;
|
* Document.
|
||||||
* - Message is an atom naming the type of error;
|
* - Culprit is a sub-term of Document which cannot be serialized;
|
||||||
* - Path is a string encoding a list of SubTerm's ancestor elements in the
|
* - Message is an atom naming the type of error;
|
||||||
* form <tag>{(id)}* where <tag> is the element tag and <id> is the value
|
* - Path is a string encoding a list of SubTerm's ancestor elements in the
|
||||||
* of any attribute _named_ id.
|
* form <tag>{(id)}* where <tag> is the element tag and <id> is the value
|
||||||
*/
|
* of any attribute _named_ id.
|
||||||
xml_exception( Message, Document, Culprit, Path ) :-
|
*/
|
||||||
raise_exception(
|
xml_exception( Message, Document, Culprit, Path ) :-
|
||||||
application_error('XML Parse: ~s in ~q~nCulprit: ~q~nPath: ~s',
|
raise_exception(
|
||||||
[Message,Document,Culprit,Path] )
|
application_error('XML Parse: ~s in ~q~nCulprit: ~q~nPath: ~s',
|
||||||
).
|
[Message,Document,Culprit,Path] )
|
||||||
|
).
|
||||||
/* member( ?Element, ?List ) holds when Element is a member of List.
|
|
||||||
*/
|
load_xml(File, XML, []) :-
|
||||||
member( H, [H|_] ).
|
open( File, read, S),
|
||||||
member( H, [_|T] ):-
|
read_stream_to_codes(S, Doc),
|
||||||
member( H, T ).
|
close(S),
|
||||||
|
xml_parse(Doc, XML).
|
||||||
/* select( ?Element, ?List0, ?List1 ) is true if List1 is equal to List0
|
|
||||||
* with Element removed.
|
load_xml(File, XML) :-
|
||||||
*/
|
open( File, read, S),
|
||||||
select( H, [H|T], T ).
|
read_stream_to_codes(S, Doc),
|
||||||
select( Element, [H|T0], [H|T1] ):-
|
close(S),
|
||||||
select( Element, T0, T1 ).
|
xml_parse(Doc, XML).
|
||||||
|
|
||||||
/* is_list( +List ) holds when List is a list.
|
|
||||||
*/
|
/* member( ?Element, ?List ) holds when Element is a member of List.
|
||||||
%is_list( List ) :-
|
*/
|
||||||
% nonvar( List ),
|
member( H, [H|_] ).
|
||||||
% is_list1( List ).
|
member( H, [_|T] ):-
|
||||||
|
member( H, T ).
|
||||||
%is_list1( [] ).
|
|
||||||
%is_list1( [_|_] ).
|
/* select( ?Element, ?List0, ?List1 ) is true if List1 is equal to List0
|
||||||
|
* with Element removed.
|
||||||
|
*/
|
||||||
|
select( H, [H|T], T ).
|
||||||
|
select( Element, [H|T0], [H|T1] ):-
|
||||||
|
select( Element, T0, T1 ).
|
||||||
|
|
||||||
|
/* is_list( +List ) holds when List is a list.
|
||||||
|
*/
|
||||||
|
%is_list( List ) :-
|
||||||
|
% nonvar( List ),
|
||||||
|
% is_list1( List ).
|
||||||
|
|
||||||
|
%is_list1( [] ).
|
||||||
|
%is_list1( [_|_] ).
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,84 +1,87 @@
|
|||||||
/* xml_diagnosis.pl : XML exception diagnosis.
|
/* xml_diagnosis.pl : XML exception diagnosis.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001-2005 Binding Time Limited
|
* Copyright (C) 2001-2005 Binding Time Limited
|
||||||
* Copyright (C) 2005-2011 John Fletcher
|
* Copyright (C) 2005-2011 John Fletcher
|
||||||
*
|
*
|
||||||
* Current Release: $Revision: 3.3 $
|
* Current Release: $Revision: 3.3 $
|
||||||
*
|
*
|
||||||
* TERMS AND CONDITIONS:
|
* TERMS AND CONDITIONS:
|
||||||
*
|
*
|
||||||
* This program is offered free of charge, as unsupported source code. You may
|
* This program is offered free of charge, as unsupported source code. You may
|
||||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||||
* but entirely at your own risk.
|
* but entirely at your own risk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- ensure_loaded( xml_generation ).
|
:- ensure_loaded( xml_generation ).
|
||||||
|
|
||||||
/* xml_fault( +Term, +Indentation, ?SubTerm, ?Path, ?Message ) identifies SubTerm
|
/* @pred xml_fault( +Term, +Indentation, ?SubTerm, ?Path, ?Message )
|
||||||
* as a sub-term of Term which cannot be serialized after Indentation.
|
*
|
||||||
* Message is an atom naming the type of error; Path is a string encoding a
|
* identifies SubTerm
|
||||||
* list of SubTerm's ancestor elements in the form <tag>{(id)}* where <tag> is the
|
* as a sub-term of Term which cannot be serialized after Indentation.
|
||||||
* element tag and <id> is the value of any attribute _named_ id.
|
* Message is an atom naming the type of error; Path is a string encoding a
|
||||||
*/
|
* list of SubTerm's ancestor elements in the form <tag>{(id)}* where <tag> is the
|
||||||
xml_fault( Term, _Indent, Term, [], "Illegal Variable" ) :-
|
* element tag and <id> is the value of any attribute _named_ id.
|
||||||
var( Term ).
|
*/
|
||||||
xml_fault( xml(Attributes,_Content), _Indent, Term, [], Message ) :-
|
xml_fault( Term, _Indent, Term, [], "Illegal Variable" ) :-
|
||||||
member( Attribute, Attributes ),
|
var( Term ).
|
||||||
attribute_fault( Attribute, Term, Message ).
|
xml_fault( xml(Attributes,_Content), _Indent, Term, [], Message ) :-
|
||||||
xml_fault( xml(_Attributes,Content), Indent, Culprit, Path, Message ) :-
|
member( Attribute, Attributes ),
|
||||||
xml_content_fault( Content, Indent, Culprit, Path, Message ).
|
attribute_fault( Attribute, Term, Message ).
|
||||||
xml_fault( Term, _Indent, Term, [], "Illegal Term" ).
|
xml_fault( xml(_Attributes,Content), Indent, Culprit, Path, Message ) :-
|
||||||
|
xml_content_fault( Content, Indent, Culprit, Path, Message ).
|
||||||
xml_content_fault( Term, _Indent, Term, [], "Illegal Variable" ) :-
|
xml_fault( Term, _Indent, Term, [], "Illegal Term" ).
|
||||||
var( Term ).
|
|
||||||
xml_content_fault( pcdata(Chars), _Indent, Chars, [], "Invalid Character Data" ) :-
|
xml_content_fault( Term, _Indent, Term, [], "Illegal Variable" ) :-
|
||||||
\+ is_chars( Chars ).
|
var( Term ).
|
||||||
xml_content_fault( cdata(Chars), _Indent, Chars, [], "Invalid Character Data" ) :-
|
xml_content_fault( pcdata(Chars), _Indent, Chars, [], "Invalid Character Data" ) :-
|
||||||
\+ is_chars( Chars ).
|
\+ is_chars( Chars ).
|
||||||
xml_content_fault( [H|_T], Indent, Culprit, Path, Message ) :-
|
xml_content_fault( cdata(Chars), _Indent, Chars, [], "Invalid Character Data" ) :-
|
||||||
xml_content_fault( H, Indent, Culprit, Path, Message ).
|
\+ is_chars( Chars ).
|
||||||
xml_content_fault( [_H|T], Indent, Culprit, Path, Message ) :-
|
xml_content_fault( [H|_T], Indent, Culprit, Path, Message ) :-
|
||||||
xml_content_fault( T, Indent, Culprit, Path, Message ).
|
xml_content_fault( H, Indent, Culprit, Path, Message ).
|
||||||
xml_content_fault( namespace(_URI,_Prefix,Element), Indent, Culprit, Path, Message ) :-
|
xml_content_fault( [_H|T], Indent, Culprit, Path, Message ) :-
|
||||||
element_fault( Element, [0' |Indent], Culprit, Path, Message ).
|
xml_content_fault( T, Indent, Culprit, Path, Message ).
|
||||||
xml_content_fault( Element, Indent, Culprit, Path, Message ) :-
|
xml_content_fault( namespace(_URI,_Prefix,Element), Indent, Culprit, Path, Message ) :-
|
||||||
element_fault( Element, [0' |Indent], Culprit, Path, Message ).
|
element_fault( Element, [0' |Indent], Culprit, Path, Message ).
|
||||||
xml_content_fault( Term, Indent, Term, [], "Illegal Term" ) :-
|
xml_content_fault( Element, Indent, Culprit, Path, Message ) :-
|
||||||
\+ generation(Term, "", false, Indent, _Format, _Plus, _Minus ).
|
element_fault( Element, [0' |Indent], Culprit, Path, Message ).
|
||||||
|
xml_content_fault( Term, Indent, Term, [], "Illegal Term" ) :-
|
||||||
element_fault( element(Tag, _Attributes, _Contents), _Indent, Tag, [], "Tag must be an atom" ) :-
|
\+ generation(Term, "", false, Indent, _Format, _Plus, _Minus ).
|
||||||
\+ atom( Tag ).
|
|
||||||
element_fault( element(Tag, Attributes, _Contents), _Indent, Tag, [], "Attributes must be instantiated" ) :-
|
element_fault( element(Tag, _Attributes, _Contents), _Indent, Tag, [], "Tag must be an atom" ) :-
|
||||||
var( Attributes ).
|
\+ atom( Tag ).
|
||||||
element_fault( element(Tag, Attributes, _Contents), _Indent, Faulty, Path, Message ) :-
|
element_fault( element(Tag, Attributes, _Contents), _Indent, Tag, [], "Attributes must be instantiated" ) :-
|
||||||
fault_path( Tag, Attributes, Path, [] ),
|
var( Attributes ).
|
||||||
member( Attribute, Attributes ),
|
element_fault( element(Tag, Attributes, _Contents), _Indent, Faulty, Path, Message ) :-
|
||||||
attribute_fault( Attribute, Faulty, Message ).
|
fault_path( Tag, Attributes, Path, [] ),
|
||||||
element_fault( element(Tag, Attributes, Contents), Indent, Culprit, Path, Message ) :-
|
member( Attribute, Attributes ),
|
||||||
fault_path( Tag, Attributes, Path, Path1 ),
|
attribute_fault( Attribute, Faulty, Message ).
|
||||||
xml_content_fault( Contents, Indent, Culprit, Path1, Message ).
|
element_fault( element(Tag, Attributes, Contents), Indent, Culprit, Path, Message ) :-
|
||||||
|
fault_path( Tag, Attributes, Path, Path1 ),
|
||||||
attribute_fault( Attribute, Attribute, "Illegal Variable" ) :-
|
xml_content_fault( Contents, Indent, Culprit, Path1, Message ).
|
||||||
var( Attribute ).
|
|
||||||
attribute_fault( Name=Value, Name=Value, "Attribute Name must be atom" ) :-
|
attribute_fault( Attribute, Attribute, "Illegal Variable" ) :-
|
||||||
\+ atom(Name).
|
var( Attribute ).
|
||||||
attribute_fault( Name=Value, Name=Value, "Attribute Value must be chars" ) :-
|
attribute_fault( Name=Value, Name=Value, "Attribute Name must be atom" ) :-
|
||||||
\+ is_chars( Value ).
|
\+ atom(Name).
|
||||||
attribute_fault( Attribute, Attribute, "Malformed Attribute" ) :-
|
attribute_fault( Name=Value, Name=Value, "Attribute Value must be chars" ) :-
|
||||||
\+ Attribute = (_Name=_Value).
|
\+ is_chars( Value ).
|
||||||
|
attribute_fault( Attribute, Attribute, "Malformed Attribute" ) :-
|
||||||
is_chars( Chars ) :-
|
\+ Attribute = (_Name=_Value).
|
||||||
is_list( Chars ),
|
|
||||||
\+ (member( Char, Chars ), \+ (integer(Char), Char >=0, Char =< 255)).
|
is_chars( Chars ) :-
|
||||||
|
is_list( Chars ),
|
||||||
fault_path( Tag, Attributes ) -->
|
\+ (member( Char, Chars ), \+ (integer(Char), Char >=0, Char =< 255)).
|
||||||
{atom_codes( Tag, Chars )},
|
|
||||||
chars( Chars ),
|
fault_path( Tag, Attributes ) -->
|
||||||
fault_id( Attributes ),
|
{atom_codes( Tag, Chars )},
|
||||||
" ".
|
chars( Chars ),
|
||||||
|
fault_id( Attributes ),
|
||||||
fault_id( Attributes ) -->
|
" ".
|
||||||
{member( id=Chars, Attributes ), is_chars( Chars )},
|
|
||||||
!,
|
fault_id( Attributes ) -->
|
||||||
"(", chars(Chars), ")".
|
{member( id=Chars, Attributes ), is_chars( Chars )},
|
||||||
fault_id( _Attributes ) --> "".
|
!,
|
||||||
|
"(", chars(Chars), ")".
|
||||||
|
fault_id( _Attributes ) --> "".
|
||||||
|
|
||||||
|
@ -11,11 +11,15 @@
|
|||||||
* This program is offered free of charge, as unsupported source code. You may
|
* This program is offered free of charge, as unsupported source code. You may
|
||||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||||
* but entirely at your own risk.
|
* but entirely at your own risk.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @pred xml_parse( {+Controls}, +?Chars, ?+Document )
|
||||||
*
|
*
|
||||||
* xml_parse( {+Controls}, +?Chars, ?+Document ) parses Chars to/from a data
|
* parses Chars to/from a data
|
||||||
* structure of the form xml(<atts>, <content>). <atts> is a list of
|
* structure of the form xml(<atts>, <content>). <atts> is a list of
|
||||||
* <atom>=<string> attributes from the (possibly implicit) XML signature of the
|
* <atom>=<string> attributes from the (possibly implicit) XML signature of the
|
||||||
* document. <content> is a (possibly empty) list comprising occurrences of * ~~~
|
* document. <content> is a (possibly empty) list comprising occurrences of
|
||||||
|
* ~~~
|
||||||
* pcdata(<string>) : Text
|
* pcdata(<string>) : Text
|
||||||
* comment(<string>) : An xml comment;
|
* comment(<string>) : An xml comment;
|
||||||
* element(<tag>,<atts>,<content>) : <tag>..</tag> encloses <content>
|
* element(<tag>,<atts>,<content>) : <tag>..</tag> encloses <content>
|
||||||
@ -75,7 +79,7 @@
|
|||||||
* is not well-formed, diagnosis tries to identify the specific culprit term.
|
* is not well-formed, diagnosis tries to identify the specific culprit term.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module( xml, [xml_parse/2,
|
:- module( xml_driver, [xml_parse/2,
|
||||||
xml_parse/3,
|
xml_parse/3,
|
||||||
document_to_xml/3,
|
document_to_xml/3,
|
||||||
xml_subterm/2
|
xml_subterm/2
|
||||||
@ -105,7 +109,8 @@ document_to_xml( Controls, Document, Chars ) :-
|
|||||||
xml_exception( Message, Document, Culprit, Path )
|
xml_exception( Message, Document, Culprit, Path )
|
||||||
).
|
).
|
||||||
|
|
||||||
/** xml_subterm( +XMLTerm, ?Subterm )
|
/** @pred xml_subterm( +XMLTerm, ?Subterm )
|
||||||
|
*
|
||||||
* unifies Subterm with a sub-term of Term.
|
* unifies Subterm with a sub-term of Term.
|
||||||
* Note that XMLTerm is a sub-term of itself.
|
* Note that XMLTerm is a sub-term of itself.
|
||||||
*/
|
*/
|
||||||
|
@ -1,391 +1,394 @@
|
|||||||
/* xml_generation.pl : Document -> XML translation
|
/* xml_generation.pl : Document -> XML translation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001-2005 Binding Time Limited
|
* Copyright (C) 2001-2005 Binding Time Limited
|
||||||
* Copyright (C) 2005-2011 John Fletcher
|
* Copyright (C) 2005-2011 John Fletcher
|
||||||
*
|
*
|
||||||
* Current Release: $Revision: 3.7 $
|
* Current Release: $Revision: 3.7 $
|
||||||
*
|
*
|
||||||
* TERMS AND CONDITIONS:
|
* TERMS AND CONDITIONS:
|
||||||
*
|
*
|
||||||
* This program is offered free of charge, as unsupported source code. You may
|
* This program is offered free of charge, as unsupported source code. You may
|
||||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||||
* but entirely at your own risk.
|
* but entirely at your own risk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- ensure_loaded( xml_utilities ).
|
:- ensure_loaded( xml_utilities ).
|
||||||
|
|
||||||
:- use_module(library(lists)).
|
:- use_module(library(lists)).
|
||||||
|
|
||||||
/* document_generation( +Format, +Document ) is a DCG generating Document
|
/* @pred document_generation( +Format, +Document )
|
||||||
* as a list of character codes. Format is true|false defining whether layouts,
|
*
|
||||||
* to provide indentation, should be added between the element content of
|
* is a DCG generating Document
|
||||||
* the resultant "string". Note that formatting is disabled for elements that
|
* as a list of character codes. Format is true|false defining whether layouts,
|
||||||
* are interspersed with pcdata/1 terms, such as XHTML's 'inline' elements.
|
* to provide indentation, should be added between the element content of
|
||||||
* Also, Format is over-ridden, for an individual element, by an explicit
|
* the resultant "string". Note that formatting is disabled for elements that
|
||||||
* 'xml:space'="preserve" attribute.
|
* are interspersed with pcdata/1 terms, such as XHTML's 'inline' elements.
|
||||||
*/
|
* Also, Format is over-ridden, for an individual element, by an explicit
|
||||||
document_generation( Format, xml(Attributes, Document) ) -->
|
* 'xml:space'="preserve" attribute.
|
||||||
document_generation_body( Attributes, Format, Document ).
|
*/
|
||||||
|
document_generation( Format, xml(Attributes, Document) ) -->
|
||||||
document_generation_body( [], Format, Document ) -->
|
document_generation_body( Attributes, Format, Document ).
|
||||||
generation( Document, "", Format, [], _Format1 ).
|
|
||||||
document_generation_body( Attributes, Format, Document ) -->
|
document_generation_body( [], Format, Document ) -->
|
||||||
{ Attributes = [_|_],
|
generation( Document, "", Format, [], _Format1 ).
|
||||||
xml_declaration_attributes_valid( Attributes )
|
document_generation_body( Attributes, Format, Document ) -->
|
||||||
},
|
{ Attributes = [_|_],
|
||||||
"<?xml",
|
xml_declaration_attributes_valid( Attributes )
|
||||||
generated_attributes( Attributes, Format, Format0 ),
|
},
|
||||||
"?>",
|
"<?xml",
|
||||||
indent( true, [] ),
|
generated_attributes( Attributes, Format, Format0 ),
|
||||||
generation( Document, "", Format0, [], _Format1 ).
|
"?>",
|
||||||
|
indent( true, [] ),
|
||||||
generation( [], _Prefix, Format, _Indent, Format ) --> [].
|
generation( Document, "", Format0, [], _Format1 ).
|
||||||
generation( [Term|Terms], Prefix, Format0, Indent, Format ) -->
|
|
||||||
generation( Term, Prefix, Format0, Indent, Format1 ),
|
generation( [], _Prefix, Format, _Indent, Format ) --> [].
|
||||||
generation( Terms, Prefix, Format1, Indent, Format ).
|
generation( [Term|Terms], Prefix, Format0, Indent, Format ) -->
|
||||||
generation( doctype(Name, External), _Prefix, Format, [], Format ) -->
|
generation( Term, Prefix, Format0, Indent, Format1 ),
|
||||||
"<!DOCTYPE ",
|
generation( Terms, Prefix, Format1, Indent, Format ).
|
||||||
generated_name( Name ),
|
generation( doctype(Name, External), _Prefix, Format, [], Format ) -->
|
||||||
generated_external_id( External ),
|
"<!DOCTYPE ",
|
||||||
">".
|
generated_name( Name ),
|
||||||
generation( instructions(Target,Process), _Prefix, Format, Indent, Format ) -->
|
generated_external_id( External ),
|
||||||
indent( Format, Indent ),
|
">".
|
||||||
"<?", generated_name(Target), " ", chars( Process ) ,"?>".
|
generation( instructions(Target,Process), _Prefix, Format, Indent, Format ) -->
|
||||||
generation( pcdata(Chars), _Prefix, Format0, _Indent, Format1 ) -->
|
indent( Format, Indent ),
|
||||||
pcdata_generation( Chars ),
|
"<?", generated_name(Target), " ", chars( Process ) ,"?>".
|
||||||
{character_data_format( Chars, Format0, Format1 )}.
|
generation( pcdata(Chars), _Prefix, Format0, _Indent, Format1 ) -->
|
||||||
generation( comment( Comment ), _Prefix, Format, Indent, Format ) -->
|
pcdata_generation( Chars ),
|
||||||
indent( Format, Indent ),
|
{character_data_format( Chars, Format0, Format1 )}.
|
||||||
"<!--", chars( Comment ), "-->".
|
generation( comment( Comment ), _Prefix, Format, Indent, Format ) -->
|
||||||
generation( namespace(URI, Prefix, element(Name, Atts, Content)),
|
indent( Format, Indent ),
|
||||||
_Prefix0, Format, Indent, Format ) -->
|
"<!--", chars( Comment ), "-->".
|
||||||
indent( Format, Indent ),
|
generation( namespace(URI, Prefix, element(Name, Atts, Content)),
|
||||||
"<", generated_prefixed_name( Prefix, Name ),
|
_Prefix0, Format, Indent, Format ) -->
|
||||||
generated_prefixed_attributes( Prefix, URI, Atts, Format, Format1 ),
|
indent( Format, Indent ),
|
||||||
generated_content( Content, Format1, Indent, Prefix, Name ).
|
"<", generated_prefixed_name( Prefix, Name ),
|
||||||
generation( element(Name, Atts, Content), Prefix, Format, Indent, Format ) -->
|
generated_prefixed_attributes( Prefix, URI, Atts, Format, Format1 ),
|
||||||
indent( Format, Indent ),
|
generated_content( Content, Format1, Indent, Prefix, Name ).
|
||||||
"<", generated_prefixed_name( Prefix, Name ),
|
generation( element(Name, Atts, Content), Prefix, Format, Indent, Format ) -->
|
||||||
generated_attributes( Atts, Format, Format1 ),
|
indent( Format, Indent ),
|
||||||
generated_content( Content, Format1, Indent, Prefix, Name ).
|
"<", generated_prefixed_name( Prefix, Name ),
|
||||||
generation( cdata(CData), _Prefix, Format0, _Indent, Format1 ) -->
|
generated_attributes( Atts, Format, Format1 ),
|
||||||
"<![CDATA[", cdata_generation(CData), "]]>",
|
generated_content( Content, Format1, Indent, Prefix, Name ).
|
||||||
{character_data_format( CData, Format0, Format1 )}.
|
generation( cdata(CData), _Prefix, Format0, _Indent, Format1 ) -->
|
||||||
|
"<![CDATA[", cdata_generation(CData), "]]>",
|
||||||
generated_attributes( [], Format, Format ) --> [].
|
{character_data_format( CData, Format0, Format1 )}.
|
||||||
generated_attributes( [Name=Value|Attributes], Format0, Format ) -->
|
|
||||||
{( Name == 'xml:space',
|
generated_attributes( [], Format, Format ) --> [].
|
||||||
Value="preserve" ->
|
generated_attributes( [Name=Value|Attributes], Format0, Format ) -->
|
||||||
Format1 = false
|
{( Name == 'xml:space',
|
||||||
; otherwise ->
|
Value="preserve" ->
|
||||||
Format1 = Format0
|
Format1 = false
|
||||||
)},
|
; otherwise ->
|
||||||
" ",
|
Format1 = Format0
|
||||||
generated_name( Name ),
|
)},
|
||||||
"=""",
|
" ",
|
||||||
quoted_string( Value ),
|
generated_name( Name ),
|
||||||
"""",
|
"=""",
|
||||||
generated_attributes( Attributes, Format1, Format ).
|
quoted_string( Value ),
|
||||||
|
"""",
|
||||||
generated_prefixed_name( [], Name ) -->
|
generated_attributes( Attributes, Format1, Format ).
|
||||||
generated_name( Name ).
|
|
||||||
generated_prefixed_name( Prefix, Name ) -->
|
generated_prefixed_name( [], Name ) -->
|
||||||
{Prefix = [_|_]},
|
generated_name( Name ).
|
||||||
chars( Prefix ), ":",
|
generated_prefixed_name( Prefix, Name ) -->
|
||||||
generated_name( Name ).
|
{Prefix = [_|_]},
|
||||||
|
chars( Prefix ), ":",
|
||||||
generated_content( [], _Format, _Indent, _Prefix, _Namespace ) -->
|
generated_name( Name ).
|
||||||
" />". % Leave an extra space for XHTML output.
|
|
||||||
generated_content( [H|T], Format, Indent, Prefix, Namespace ) -->
|
generated_content( [], _Format, _Indent, _Prefix, _Namespace ) -->
|
||||||
">",
|
" />". % Leave an extra space for XHTML output.
|
||||||
generation( H, Prefix, Format, [0' |Indent], Format1 ),
|
generated_content( [H|T], Format, Indent, Prefix, Namespace ) -->
|
||||||
generation( T, Prefix, Format1, [0' |Indent], Format2 ),
|
">",
|
||||||
indent( Format2, Indent ),
|
generation( H, Prefix, Format, [0' |Indent], Format1 ),
|
||||||
"</", generated_prefixed_name( Prefix, Namespace ), ">".
|
generation( T, Prefix, Format1, [0' |Indent], Format2 ),
|
||||||
|
indent( Format2, Indent ),
|
||||||
generated_prefixed_attributes( [_|_Prefix], _URI, Atts, Format0, Format ) -->
|
"</", generated_prefixed_name( Prefix, Namespace ), ">".
|
||||||
generated_attributes( Atts, Format0, Format ).
|
|
||||||
generated_prefixed_attributes( [], URI, Atts, Format0, Format ) -->
|
generated_prefixed_attributes( [_|_Prefix], _URI, Atts, Format0, Format ) -->
|
||||||
{atom_codes( URI, Namespace ),
|
generated_attributes( Atts, Format0, Format ).
|
||||||
findall( Attr, (member(Attr, Atts), \+ Attr=(xmlns=_Val)), Atts1 )
|
generated_prefixed_attributes( [], URI, Atts, Format0, Format ) -->
|
||||||
},
|
{atom_codes( URI, Namespace ),
|
||||||
generated_attributes( [xmlns=Namespace|Atts1], Format0, Format ).
|
findall( Attr, (member(Attr, Atts), \+ Attr=(xmlns=_Val)), Atts1 )
|
||||||
|
},
|
||||||
generated_name( Name, Plus, Minus ) :-
|
generated_attributes( [xmlns=Namespace|Atts1], Format0, Format ).
|
||||||
atom_codes( Name, Chars ),
|
|
||||||
append( Chars, Minus, Plus ).
|
generated_name( Name, Plus, Minus ) :-
|
||||||
|
atom_codes( Name, Chars ),
|
||||||
generated_external_id( local ) --> "".
|
append( Chars, Minus, Plus ).
|
||||||
generated_external_id( local(Literals) ) --> " [",
|
|
||||||
generated_doctype_literals( Literals ), "
|
generated_external_id( local ) --> "".
|
||||||
]".
|
generated_external_id( local(Literals) ) --> " [",
|
||||||
generated_external_id( system(URL) ) -->
|
generated_doctype_literals( Literals ), "
|
||||||
" SYSTEM """,
|
]".
|
||||||
chars( URL ),
|
generated_external_id( system(URL) ) -->
|
||||||
"""".
|
" SYSTEM """,
|
||||||
generated_external_id( system(URL,Literals) ) -->
|
chars( URL ),
|
||||||
" SYSTEM """,
|
"""".
|
||||||
chars( URL ),
|
generated_external_id( system(URL,Literals) ) -->
|
||||||
""" [",
|
" SYSTEM """,
|
||||||
generated_doctype_literals( Literals ), "
|
chars( URL ),
|
||||||
]".
|
""" [",
|
||||||
generated_external_id( public(URN,URL) ) -->
|
generated_doctype_literals( Literals ), "
|
||||||
" PUBLIC """,
|
]".
|
||||||
chars( URN ),
|
generated_external_id( public(URN,URL) ) -->
|
||||||
""" """,
|
" PUBLIC """,
|
||||||
chars( URL ),
|
chars( URN ),
|
||||||
"""".
|
""" """,
|
||||||
generated_external_id( public(URN,URL,Literals) ) -->
|
chars( URL ),
|
||||||
" PUBLIC """,
|
"""".
|
||||||
chars( URN ),
|
generated_external_id( public(URN,URL,Literals) ) -->
|
||||||
""" """,
|
" PUBLIC """,
|
||||||
chars( URL ),
|
chars( URN ),
|
||||||
""" [",
|
""" """,
|
||||||
generated_doctype_literals( Literals ), "
|
chars( URL ),
|
||||||
]".
|
""" [",
|
||||||
|
generated_doctype_literals( Literals ), "
|
||||||
generated_doctype_literals( [] ) --> "".
|
]".
|
||||||
generated_doctype_literals( [dtd_literal(String)|Literals] ) --> "
|
|
||||||
<!", cdata_generation( String ), ">",
|
generated_doctype_literals( [] ) --> "".
|
||||||
generated_doctype_literals( Literals ).
|
generated_doctype_literals( [dtd_literal(String)|Literals] ) --> "
|
||||||
|
<!", cdata_generation( String ), ">",
|
||||||
/* quoted_string( +Chars ) is a DCG representing Chars, a list of character
|
generated_doctype_literals( Literals ).
|
||||||
* codes, as a legal XML attribute string. Any leading or trailing layout
|
|
||||||
* characters are removed. &, " and < characters are replaced by &, "
|
/* quoted_string( +Chars ) is a DCG representing Chars, a list of character
|
||||||
* and < respectively, .
|
* codes, as a legal XML attribute string. Any leading or trailing layout
|
||||||
*/
|
* characters are removed. &, " and < characters are replaced by &, "
|
||||||
quoted_string( Raw, Plus, Minus ) :-
|
* and < respectively, .
|
||||||
quoted_string1( Raw, NoLeadingLayouts ),
|
*/
|
||||||
quoted_string2( NoLeadingLayouts, Layout, Layout, Plus, Minus ).
|
quoted_string( Raw, Plus, Minus ) :-
|
||||||
|
quoted_string1( Raw, NoLeadingLayouts ),
|
||||||
quoted_string1( [], [] ).
|
quoted_string2( NoLeadingLayouts, Layout, Layout, Plus, Minus ).
|
||||||
quoted_string1( [Char|Chars], NoLeadingLayouts ) :-
|
|
||||||
( Char > 32 ->
|
quoted_string1( [], [] ).
|
||||||
NoLeadingLayouts = [Char|Chars]
|
quoted_string1( [Char|Chars], NoLeadingLayouts ) :-
|
||||||
; otherwise ->
|
( Char > 32 ->
|
||||||
quoted_string1( Chars, NoLeadingLayouts )
|
NoLeadingLayouts = [Char|Chars]
|
||||||
).
|
; otherwise ->
|
||||||
|
quoted_string1( Chars, NoLeadingLayouts )
|
||||||
quoted_string2( [], _LayoutPlus, _LayoutMinus, List, List ).
|
).
|
||||||
quoted_string2( [Char|Chars], LayoutPlus, LayoutMinus, Plus, Minus ) :-
|
|
||||||
( Char =< " " ->
|
quoted_string2( [], _LayoutPlus, _LayoutMinus, List, List ).
|
||||||
Plus = Plus1,
|
quoted_string2( [Char|Chars], LayoutPlus, LayoutMinus, Plus, Minus ) :-
|
||||||
LayoutMinus = [Char|LayoutMinus1],
|
( Char =< " " ->
|
||||||
LayoutPlus = LayoutPlus1
|
Plus = Plus1,
|
||||||
; Char == 34 ->
|
LayoutMinus = [Char|LayoutMinus1],
|
||||||
Plus = LayoutPlus,
|
LayoutPlus = LayoutPlus1
|
||||||
escaped_quote( LayoutMinus, Plus1 ),
|
; Char == 34 ->
|
||||||
LayoutPlus1 = LayoutMinus1
|
Plus = LayoutPlus,
|
||||||
; Char == 39 ->
|
escaped_quote( LayoutMinus, Plus1 ),
|
||||||
Plus = LayoutPlus,
|
LayoutPlus1 = LayoutMinus1
|
||||||
apos( LayoutMinus, Plus1 ),
|
; Char == 39 ->
|
||||||
LayoutPlus1 = LayoutMinus1
|
Plus = LayoutPlus,
|
||||||
; Char =< 127 ->
|
apos( LayoutMinus, Plus1 ),
|
||||||
Plus = LayoutPlus,
|
LayoutPlus1 = LayoutMinus1
|
||||||
pcdata_7bit( Char, LayoutMinus, Plus1 ),
|
; Char =< 127 ->
|
||||||
LayoutPlus1 = LayoutMinus1
|
Plus = LayoutPlus,
|
||||||
; legal_xml_unicode( Char ) ->
|
pcdata_7bit( Char, LayoutMinus, Plus1 ),
|
||||||
Plus = LayoutPlus,
|
LayoutPlus1 = LayoutMinus1
|
||||||
number_codes( Char, Codes ),
|
; legal_xml_unicode( Char ) ->
|
||||||
pcdata_8bits_plus( Codes, LayoutMinus, Plus1 ),
|
Plus = LayoutPlus,
|
||||||
LayoutPlus1 = LayoutMinus1
|
number_codes( Char, Codes ),
|
||||||
; otherwise ->
|
pcdata_8bits_plus( Codes, LayoutMinus, Plus1 ),
|
||||||
LayoutPlus = LayoutPlus1,
|
LayoutPlus1 = LayoutMinus1
|
||||||
LayoutMinus = LayoutMinus1,
|
; otherwise ->
|
||||||
Plus = Plus1
|
LayoutPlus = LayoutPlus1,
|
||||||
),
|
LayoutMinus = LayoutMinus1,
|
||||||
quoted_string2( Chars, LayoutPlus1, LayoutMinus1, Plus1, Minus ).
|
Plus = Plus1
|
||||||
|
),
|
||||||
indent( false, _Indent ) --> [].
|
quoted_string2( Chars, LayoutPlus1, LayoutMinus1, Plus1, Minus ).
|
||||||
indent( true, Indent ) -->
|
|
||||||
[10],
|
indent( false, _Indent ) --> [].
|
||||||
chars( Indent ).
|
indent( true, Indent ) -->
|
||||||
|
[10],
|
||||||
apos --> "'".
|
chars( Indent ).
|
||||||
|
|
||||||
escaped_quote --> """.
|
apos --> "'".
|
||||||
|
|
||||||
/* pcdata_generation( +Chars ) is a DCG representing Chars, a list of character
|
escaped_quote --> """.
|
||||||
* codes as legal XML "Parsed character data" (PCDATA) string. Any codes
|
|
||||||
* which cannot be represented by a 7-bit character are replaced by their
|
/* pcdata_generation( +Chars ) is a DCG representing Chars, a list of character
|
||||||
* decimal numeric character entity e.g. code 160 (non-breaking space) is
|
* codes as legal XML "Parsed character data" (PCDATA) string. Any codes
|
||||||
* represented as  . Any character codes disallowed by the XML
|
* which cannot be represented by a 7-bit character are replaced by their
|
||||||
* specification are not encoded.
|
* decimal numeric character entity e.g. code 160 (non-breaking space) is
|
||||||
*/
|
* represented as  . Any character codes disallowed by the XML
|
||||||
pcdata_generation( [], Plus, Plus ).
|
* specification are not encoded.
|
||||||
pcdata_generation( [Char|Chars], Plus, Minus ) :-
|
*/
|
||||||
( Char =< 127 ->
|
pcdata_generation( [], Plus, Plus ).
|
||||||
pcdata_7bit( Char, Plus, Mid )
|
pcdata_generation( [Char|Chars], Plus, Minus ) :-
|
||||||
; legal_xml_unicode( Char ) ->
|
( Char =< 127 ->
|
||||||
number_codes( Char, Codes ),
|
pcdata_7bit( Char, Plus, Mid )
|
||||||
pcdata_8bits_plus( Codes, Plus, Mid )
|
; legal_xml_unicode( Char ) ->
|
||||||
; otherwise ->
|
number_codes( Char, Codes ),
|
||||||
Plus = Mid
|
pcdata_8bits_plus( Codes, Plus, Mid )
|
||||||
),
|
; otherwise ->
|
||||||
pcdata_generation( Chars, Mid, Minus ).
|
Plus = Mid
|
||||||
|
),
|
||||||
/* pcdata_7bit(+Char) represents the ascii character set in its
|
pcdata_generation( Chars, Mid, Minus ).
|
||||||
* simplest format, using the character entities & < and >.
|
|
||||||
*/
|
/* pcdata_7bit(+Char) represents the ascii character set in its
|
||||||
pcdata_7bit( 0 ) --> "".
|
* simplest format, using the character entities & < and >.
|
||||||
pcdata_7bit( 1 ) --> "".
|
*/
|
||||||
pcdata_7bit( 2 ) --> "".
|
pcdata_7bit( 0 ) --> "".
|
||||||
pcdata_7bit( 3 ) --> "".
|
pcdata_7bit( 1 ) --> "".
|
||||||
pcdata_7bit( 4 ) --> "".
|
pcdata_7bit( 2 ) --> "".
|
||||||
pcdata_7bit( 5 ) --> "".
|
pcdata_7bit( 3 ) --> "".
|
||||||
pcdata_7bit( 6 ) --> "".
|
pcdata_7bit( 4 ) --> "".
|
||||||
pcdata_7bit( 7 ) --> "".
|
pcdata_7bit( 5 ) --> "".
|
||||||
pcdata_7bit( 8 ) --> "".
|
pcdata_7bit( 6 ) --> "".
|
||||||
pcdata_7bit( 9 ) --> [9].
|
pcdata_7bit( 7 ) --> "".
|
||||||
pcdata_7bit( 10 ) --> [10].
|
pcdata_7bit( 8 ) --> "".
|
||||||
pcdata_7bit( 11 ) --> "".
|
pcdata_7bit( 9 ) --> [9].
|
||||||
pcdata_7bit( 12 ) --> "".
|
pcdata_7bit( 10 ) --> [10].
|
||||||
pcdata_7bit( 13 ) --> [13].
|
pcdata_7bit( 11 ) --> "".
|
||||||
pcdata_7bit( 14 ) --> "".
|
pcdata_7bit( 12 ) --> "".
|
||||||
pcdata_7bit( 15 ) --> "".
|
pcdata_7bit( 13 ) --> [13].
|
||||||
pcdata_7bit( 16 ) --> "".
|
pcdata_7bit( 14 ) --> "".
|
||||||
pcdata_7bit( 17 ) --> "".
|
pcdata_7bit( 15 ) --> "".
|
||||||
pcdata_7bit( 18 ) --> "".
|
pcdata_7bit( 16 ) --> "".
|
||||||
pcdata_7bit( 19 ) --> "".
|
pcdata_7bit( 17 ) --> "".
|
||||||
pcdata_7bit( 20 ) --> "".
|
pcdata_7bit( 18 ) --> "".
|
||||||
pcdata_7bit( 21 ) --> "".
|
pcdata_7bit( 19 ) --> "".
|
||||||
pcdata_7bit( 22 ) --> "".
|
pcdata_7bit( 20 ) --> "".
|
||||||
pcdata_7bit( 23 ) --> "".
|
pcdata_7bit( 21 ) --> "".
|
||||||
pcdata_7bit( 24 ) --> "".
|
pcdata_7bit( 22 ) --> "".
|
||||||
pcdata_7bit( 25 ) --> "".
|
pcdata_7bit( 23 ) --> "".
|
||||||
pcdata_7bit( 26 ) --> "".
|
pcdata_7bit( 24 ) --> "".
|
||||||
pcdata_7bit( 27 ) --> "".
|
pcdata_7bit( 25 ) --> "".
|
||||||
pcdata_7bit( 28 ) --> "".
|
pcdata_7bit( 26 ) --> "".
|
||||||
pcdata_7bit( 29 ) --> "".
|
pcdata_7bit( 27 ) --> "".
|
||||||
pcdata_7bit( 30 ) --> "".
|
pcdata_7bit( 28 ) --> "".
|
||||||
pcdata_7bit( 31 ) --> "".
|
pcdata_7bit( 29 ) --> "".
|
||||||
pcdata_7bit( 32 ) --> " ".
|
pcdata_7bit( 30 ) --> "".
|
||||||
pcdata_7bit( 33 ) --> "!".
|
pcdata_7bit( 31 ) --> "".
|
||||||
pcdata_7bit( 34 ) --> [34].
|
pcdata_7bit( 32 ) --> " ".
|
||||||
pcdata_7bit( 35 ) --> "#".
|
pcdata_7bit( 33 ) --> "!".
|
||||||
pcdata_7bit( 36 ) --> "$".
|
pcdata_7bit( 34 ) --> [34].
|
||||||
pcdata_7bit( 37 ) --> "%".
|
pcdata_7bit( 35 ) --> "#".
|
||||||
pcdata_7bit( 38 ) --> "&".
|
pcdata_7bit( 36 ) --> "$".
|
||||||
pcdata_7bit( 39 ) --> "'".
|
pcdata_7bit( 37 ) --> "%".
|
||||||
pcdata_7bit( 40 ) --> "(".
|
pcdata_7bit( 38 ) --> "&".
|
||||||
pcdata_7bit( 41 ) --> ")".
|
pcdata_7bit( 39 ) --> "'".
|
||||||
pcdata_7bit( 42 ) --> "*".
|
pcdata_7bit( 40 ) --> "(".
|
||||||
pcdata_7bit( 43 ) --> "+".
|
pcdata_7bit( 41 ) --> ")".
|
||||||
pcdata_7bit( 44 ) --> ",".
|
pcdata_7bit( 42 ) --> "*".
|
||||||
pcdata_7bit( 45 ) --> "-".
|
pcdata_7bit( 43 ) --> "+".
|
||||||
pcdata_7bit( 46 ) --> ".".
|
pcdata_7bit( 44 ) --> ",".
|
||||||
pcdata_7bit( 47 ) --> "/".
|
pcdata_7bit( 45 ) --> "-".
|
||||||
pcdata_7bit( 48 ) --> "0".
|
pcdata_7bit( 46 ) --> ".".
|
||||||
pcdata_7bit( 49 ) --> "1".
|
pcdata_7bit( 47 ) --> "/".
|
||||||
pcdata_7bit( 50 ) --> "2".
|
pcdata_7bit( 48 ) --> "0".
|
||||||
pcdata_7bit( 51 ) --> "3".
|
pcdata_7bit( 49 ) --> "1".
|
||||||
pcdata_7bit( 52 ) --> "4".
|
pcdata_7bit( 50 ) --> "2".
|
||||||
pcdata_7bit( 53 ) --> "5".
|
pcdata_7bit( 51 ) --> "3".
|
||||||
pcdata_7bit( 54 ) --> "6".
|
pcdata_7bit( 52 ) --> "4".
|
||||||
pcdata_7bit( 55 ) --> "7".
|
pcdata_7bit( 53 ) --> "5".
|
||||||
pcdata_7bit( 56 ) --> "8".
|
pcdata_7bit( 54 ) --> "6".
|
||||||
pcdata_7bit( 57 ) --> "9".
|
pcdata_7bit( 55 ) --> "7".
|
||||||
pcdata_7bit( 58 ) --> ":".
|
pcdata_7bit( 56 ) --> "8".
|
||||||
pcdata_7bit( 59 ) --> ";".
|
pcdata_7bit( 57 ) --> "9".
|
||||||
pcdata_7bit( 60 ) --> "<".
|
pcdata_7bit( 58 ) --> ":".
|
||||||
pcdata_7bit( 61 ) --> "=".
|
pcdata_7bit( 59 ) --> ";".
|
||||||
pcdata_7bit( 62 ) --> ">". % escaping necessary to prevent ']]>' sequences in pcdata.
|
pcdata_7bit( 60 ) --> "<".
|
||||||
pcdata_7bit( 63 ) --> "?".
|
pcdata_7bit( 61 ) --> "=".
|
||||||
pcdata_7bit( 64 ) --> "@".
|
pcdata_7bit( 62 ) --> ">". % escaping necessary to prevent ']]>' sequences in pcdata.
|
||||||
pcdata_7bit( 65 ) --> "A".
|
pcdata_7bit( 63 ) --> "?".
|
||||||
pcdata_7bit( 66 ) --> "B".
|
pcdata_7bit( 64 ) --> "@".
|
||||||
pcdata_7bit( 67 ) --> "C".
|
pcdata_7bit( 65 ) --> "A".
|
||||||
pcdata_7bit( 68 ) --> "D".
|
pcdata_7bit( 66 ) --> "B".
|
||||||
pcdata_7bit( 69 ) --> "E".
|
pcdata_7bit( 67 ) --> "C".
|
||||||
pcdata_7bit( 70 ) --> "F".
|
pcdata_7bit( 68 ) --> "D".
|
||||||
pcdata_7bit( 71 ) --> "G".
|
pcdata_7bit( 69 ) --> "E".
|
||||||
pcdata_7bit( 72 ) --> "H".
|
pcdata_7bit( 70 ) --> "F".
|
||||||
pcdata_7bit( 73 ) --> "I".
|
pcdata_7bit( 71 ) --> "G".
|
||||||
pcdata_7bit( 74 ) --> "J".
|
pcdata_7bit( 72 ) --> "H".
|
||||||
pcdata_7bit( 75 ) --> "K".
|
pcdata_7bit( 73 ) --> "I".
|
||||||
pcdata_7bit( 76 ) --> "L".
|
pcdata_7bit( 74 ) --> "J".
|
||||||
pcdata_7bit( 77 ) --> "M".
|
pcdata_7bit( 75 ) --> "K".
|
||||||
pcdata_7bit( 78 ) --> "N".
|
pcdata_7bit( 76 ) --> "L".
|
||||||
pcdata_7bit( 79 ) --> "O".
|
pcdata_7bit( 77 ) --> "M".
|
||||||
pcdata_7bit( 80 ) --> "P".
|
pcdata_7bit( 78 ) --> "N".
|
||||||
pcdata_7bit( 81 ) --> "Q".
|
pcdata_7bit( 79 ) --> "O".
|
||||||
pcdata_7bit( 82 ) --> "R".
|
pcdata_7bit( 80 ) --> "P".
|
||||||
pcdata_7bit( 83 ) --> "S".
|
pcdata_7bit( 81 ) --> "Q".
|
||||||
pcdata_7bit( 84 ) --> "T".
|
pcdata_7bit( 82 ) --> "R".
|
||||||
pcdata_7bit( 85 ) --> "U".
|
pcdata_7bit( 83 ) --> "S".
|
||||||
pcdata_7bit( 86 ) --> "V".
|
pcdata_7bit( 84 ) --> "T".
|
||||||
pcdata_7bit( 87 ) --> "W".
|
pcdata_7bit( 85 ) --> "U".
|
||||||
pcdata_7bit( 88 ) --> "X".
|
pcdata_7bit( 86 ) --> "V".
|
||||||
pcdata_7bit( 89 ) --> "Y".
|
pcdata_7bit( 87 ) --> "W".
|
||||||
pcdata_7bit( 90 ) --> "Z".
|
pcdata_7bit( 88 ) --> "X".
|
||||||
pcdata_7bit( 91 ) --> "[".
|
pcdata_7bit( 89 ) --> "Y".
|
||||||
pcdata_7bit( 92 ) --> [92].
|
pcdata_7bit( 90 ) --> "Z".
|
||||||
pcdata_7bit( 93 ) --> "]".
|
pcdata_7bit( 91 ) --> "[".
|
||||||
pcdata_7bit( 94 ) --> "^".
|
pcdata_7bit( 92 ) --> [92].
|
||||||
pcdata_7bit( 95 ) --> "_".
|
pcdata_7bit( 93 ) --> "]".
|
||||||
pcdata_7bit( 96 ) --> "`".
|
pcdata_7bit( 94 ) --> "^".
|
||||||
pcdata_7bit( 97 ) --> "a".
|
pcdata_7bit( 95 ) --> "_".
|
||||||
pcdata_7bit( 98 ) --> "b".
|
pcdata_7bit( 96 ) --> "`".
|
||||||
pcdata_7bit( 99 ) --> "c".
|
pcdata_7bit( 97 ) --> "a".
|
||||||
pcdata_7bit( 100 ) --> "d".
|
pcdata_7bit( 98 ) --> "b".
|
||||||
pcdata_7bit( 101 ) --> "e".
|
pcdata_7bit( 99 ) --> "c".
|
||||||
pcdata_7bit( 102 ) --> "f".
|
pcdata_7bit( 100 ) --> "d".
|
||||||
pcdata_7bit( 103 ) --> "g".
|
pcdata_7bit( 101 ) --> "e".
|
||||||
pcdata_7bit( 104 ) --> "h".
|
pcdata_7bit( 102 ) --> "f".
|
||||||
pcdata_7bit( 105 ) --> "i".
|
pcdata_7bit( 103 ) --> "g".
|
||||||
pcdata_7bit( 106 ) --> "j".
|
pcdata_7bit( 104 ) --> "h".
|
||||||
pcdata_7bit( 107 ) --> "k".
|
pcdata_7bit( 105 ) --> "i".
|
||||||
pcdata_7bit( 108 ) --> "l".
|
pcdata_7bit( 106 ) --> "j".
|
||||||
pcdata_7bit( 109 ) --> "m".
|
pcdata_7bit( 107 ) --> "k".
|
||||||
pcdata_7bit( 110 ) --> "n".
|
pcdata_7bit( 108 ) --> "l".
|
||||||
pcdata_7bit( 111 ) --> "o".
|
pcdata_7bit( 109 ) --> "m".
|
||||||
pcdata_7bit( 112 ) --> "p".
|
pcdata_7bit( 110 ) --> "n".
|
||||||
pcdata_7bit( 113 ) --> "q".
|
pcdata_7bit( 111 ) --> "o".
|
||||||
pcdata_7bit( 114 ) --> "r".
|
pcdata_7bit( 112 ) --> "p".
|
||||||
pcdata_7bit( 115 ) --> "s".
|
pcdata_7bit( 113 ) --> "q".
|
||||||
pcdata_7bit( 116 ) --> "t".
|
pcdata_7bit( 114 ) --> "r".
|
||||||
pcdata_7bit( 117 ) --> "u".
|
pcdata_7bit( 115 ) --> "s".
|
||||||
pcdata_7bit( 118 ) --> "v".
|
pcdata_7bit( 116 ) --> "t".
|
||||||
pcdata_7bit( 119 ) --> "w".
|
pcdata_7bit( 117 ) --> "u".
|
||||||
pcdata_7bit( 120 ) --> "x".
|
pcdata_7bit( 118 ) --> "v".
|
||||||
pcdata_7bit( 121 ) --> "y".
|
pcdata_7bit( 119 ) --> "w".
|
||||||
pcdata_7bit( 122 ) --> "z".
|
pcdata_7bit( 120 ) --> "x".
|
||||||
pcdata_7bit( 123 ) --> "{".
|
pcdata_7bit( 121 ) --> "y".
|
||||||
pcdata_7bit( 124 ) --> "|".
|
pcdata_7bit( 122 ) --> "z".
|
||||||
pcdata_7bit( 125 ) --> "}".
|
pcdata_7bit( 123 ) --> "{".
|
||||||
pcdata_7bit( 126 ) --> [126].
|
pcdata_7bit( 124 ) --> "|".
|
||||||
pcdata_7bit( 127 ) --> "".
|
pcdata_7bit( 125 ) --> "}".
|
||||||
|
pcdata_7bit( 126 ) --> [126].
|
||||||
pcdata_8bits_plus( Codes ) -->
|
pcdata_7bit( 127 ) --> "".
|
||||||
"&#", chars( Codes ), ";".
|
|
||||||
|
pcdata_8bits_plus( Codes ) -->
|
||||||
/* character_data_format( +Chars, +Format0, ?Format1 ) holds when Format0 and
|
"&#", chars( Codes ), ";".
|
||||||
* Format1 are the statuses of XML formatting before and after Chars -
|
|
||||||
* which may be null.
|
/* character_data_format( +Chars, +Format0, ?Format1 ) holds when Format0 and
|
||||||
*/
|
* Format1 are the statuses of XML formatting before and after Chars -
|
||||||
character_data_format( [], Format, Format ).
|
* which may be null.
|
||||||
character_data_format( [_Char|_Chars], _Format, false ).
|
*/
|
||||||
|
character_data_format( [], Format, Format ).
|
||||||
/* cdata_generation( +Chars ) is a DCG representing Chars, a list of character
|
character_data_format( [_Char|_Chars], _Format, false ).
|
||||||
* codes as a legal XML CDATA string. Any character codes disallowed by the XML
|
|
||||||
* specification are not encoded.
|
/* cdata_generation( +Chars ) is a DCG representing Chars, a list of character
|
||||||
*/
|
* codes as a legal XML CDATA string. Any character codes disallowed by the XML
|
||||||
cdata_generation( [] ) --> "".
|
* specification are not encoded.
|
||||||
cdata_generation( [Char|Chars] ) -->
|
*/
|
||||||
( {legal_xml_unicode( Char )}, !, [Char]
|
cdata_generation( [] ) --> "".
|
||||||
; ""
|
cdata_generation( [Char|Chars] ) -->
|
||||||
),
|
( {legal_xml_unicode( Char )}, !, [Char]
|
||||||
cdata_generation( Chars ).
|
; ""
|
||||||
|
),
|
||||||
legal_xml_unicode( 9 ).
|
cdata_generation( Chars ).
|
||||||
legal_xml_unicode( 10 ).
|
|
||||||
legal_xml_unicode( 13 ).
|
legal_xml_unicode( 9 ).
|
||||||
legal_xml_unicode( Code ) :-
|
legal_xml_unicode( 10 ).
|
||||||
Code >= 32,
|
legal_xml_unicode( 13 ).
|
||||||
Code =< 55295.
|
legal_xml_unicode( Code ) :-
|
||||||
legal_xml_unicode( Code ) :-
|
Code >= 32,
|
||||||
Code >= 57344,
|
Code =< 55295.
|
||||||
Code =< 65533.
|
legal_xml_unicode( Code ) :-
|
||||||
legal_xml_unicode( Code ) :-
|
Code >= 57344,
|
||||||
Code >= 65536,
|
Code =< 65533.
|
||||||
Code =< 1114111.
|
legal_xml_unicode( Code ) :-
|
||||||
|
Code >= 65536,
|
||||||
|
Code =< 1114111.
|
||||||
|
|
||||||
|
@ -1,198 +1,201 @@
|
|||||||
/* xml_pp: "pretty print" an XML Document on the current output stream.
|
/* xml_pp: "pretty print" an XML Document on the current output stream.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001-2005 Binding Time Limited
|
* Copyright (C) 2001-2005 Binding Time Limited
|
||||||
* Copyright (C) 2005-2011 John Fletcher
|
* Copyright (C) 2005-2011 John Fletcher
|
||||||
*
|
*
|
||||||
* Current Release: $Revision: 3.3 $
|
* Current Release: $Revision: 3.3 $
|
||||||
*
|
*
|
||||||
* TERMS AND CONDITIONS:
|
* TERMS AND CONDITIONS:
|
||||||
*
|
*
|
||||||
* This program is offered free of charge, as unsupported source code. You may
|
* This program is offered free of charge, as unsupported source code. You may
|
||||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||||
* but entirely at your own risk.
|
* but entirely at your own risk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- ensure_loaded( xml_utilities ).
|
:- ensure_loaded( xml_utilities ).
|
||||||
|
|
||||||
/* xml_pp( +XMLDocument ) "pretty prints" XMLDocument on the current
|
/** xml_pp( +XMLDocument )
|
||||||
* output stream.
|
*
|
||||||
*/
|
* "pretty prints" XMLDocument on the current
|
||||||
xml_pp( xml(Attributes, Document) ) :-
|
* output stream.
|
||||||
write( 'xml( ' ), pp_attributes( Attributes, 0 ), pp_comma, nl,
|
*/
|
||||||
pp_list( Document, s(0) ),
|
xml_pp( xml(Attributes, Document) ) :-
|
||||||
write( ' ).' ), nl.
|
write( 'xml( ' ), pp_attributes( Attributes, 0 ), pp_comma, nl,
|
||||||
xml_pp( malformed(Attributes, Document) ) :-
|
pp_list( Document, s(0) ),
|
||||||
write( 'malformed( ' ), pp_attributes( Attributes, 0 ), pp_comma, nl,
|
write( ' ).' ), nl.
|
||||||
pp_list( Document, s(0) ),
|
xml_pp( malformed(Attributes, Document) ) :-
|
||||||
write( ' ).' ), nl.
|
write( 'malformed( ' ), pp_attributes( Attributes, 0 ), pp_comma, nl,
|
||||||
|
pp_list( Document, s(0) ),
|
||||||
pp_indented( [], Indent ) :-
|
write( ' ).' ), nl.
|
||||||
pp_indent( Indent), write( '[]' ).
|
|
||||||
pp_indented( List, Indent ) :-
|
pp_indented( [], Indent ) :-
|
||||||
List = [_|_],
|
pp_indent( Indent), write( '[]' ).
|
||||||
pp_indent( Indent ),
|
pp_indented( List, Indent ) :-
|
||||||
pp_list( List, Indent ).
|
List = [_|_],
|
||||||
pp_indented( comment(Text), Indent ) :-
|
pp_indent( Indent ),
|
||||||
pp_indent( Indent ), write( 'comment(' ), pp_string(Text), write( ')' ).
|
pp_list( List, Indent ).
|
||||||
pp_indented( namespace(URI,Prefix,Element), Indent ) :-
|
pp_indented( comment(Text), Indent ) :-
|
||||||
pp_indent( Indent ),
|
pp_indent( Indent ), write( 'comment(' ), pp_string(Text), write( ')' ).
|
||||||
write( 'namespace( ' ), writeq( URI ), pp_comma_sp,
|
pp_indented( namespace(URI,Prefix,Element), Indent ) :-
|
||||||
pp_string( Prefix ), pp_comma, nl,
|
pp_indent( Indent ),
|
||||||
pp_indented( Element, s(Indent) ), nl,
|
write( 'namespace( ' ), writeq( URI ), pp_comma_sp,
|
||||||
pp_indent( s(Indent) ), write( ')' ).
|
pp_string( Prefix ), pp_comma, nl,
|
||||||
pp_indented( element(Tag,Attributes,Contents), Indent ) :-
|
pp_indented( Element, s(Indent) ), nl,
|
||||||
pp_indent( Indent ), write( 'element( ' ), writeq( Tag ), pp_comma, nl,
|
pp_indent( s(Indent) ), write( ')' ).
|
||||||
pp_attributes( Attributes, s(Indent) ), pp_comma, nl,
|
pp_indented( element(Tag,Attributes,Contents), Indent ) :-
|
||||||
pp_list( Contents, s(Indent) ), write( ' )' ).
|
pp_indent( Indent ), write( 'element( ' ), writeq( Tag ), pp_comma, nl,
|
||||||
pp_indented( instructions(Target, Processing), Indent ) :-
|
pp_attributes( Attributes, s(Indent) ), pp_comma, nl,
|
||||||
pp_indent( Indent ), write( 'instructions( ' ), writeq( Target ), pp_comma_sp,
|
pp_list( Contents, s(Indent) ), write( ' )' ).
|
||||||
pp_string(Processing), write( ')' ).
|
pp_indented( instructions(Target, Processing), Indent ) :-
|
||||||
pp_indented( doctype(Name, DoctypeId), Indent ) :-
|
pp_indent( Indent ), write( 'instructions( ' ), writeq( Target ), pp_comma_sp,
|
||||||
pp_indent( Indent ), write( 'doctype( ' ), writeq( Name ), pp_comma_sp,
|
pp_string(Processing), write( ')' ).
|
||||||
pp_indented( DoctypeId, s(Indent) ), %'
|
pp_indented( doctype(Name, DoctypeId), Indent ) :-
|
||||||
write( ' )' ).
|
pp_indent( Indent ), write( 'doctype( ' ), writeq( Name ), pp_comma_sp,
|
||||||
pp_indented( cdata(CData), Indent ) :-
|
pp_indented( DoctypeId, s(Indent) ), %'
|
||||||
pp_indent( Indent ), write( 'cdata(' ), pp_string(CData), write( ')' ).
|
write( ' )' ).
|
||||||
pp_indented( pcdata(PCData), Indent ) :-
|
pp_indented( cdata(CData), Indent ) :-
|
||||||
pp_indent( Indent ), write( 'pcdata(' ), pp_string(PCData), write( ')' ).
|
pp_indent( Indent ), write( 'cdata(' ), pp_string(CData), write( ')' ).
|
||||||
pp_indented( public(URN,URL), _Indent ) :-
|
pp_indented( pcdata(PCData), Indent ) :-
|
||||||
write( 'public(' ), pp_string(URN), pp_comma_sp,
|
pp_indent( Indent ), write( 'pcdata(' ), pp_string(PCData), write( ')' ).
|
||||||
pp_string(URL), write( ')' ).
|
pp_indented( public(URN,URL), _Indent ) :-
|
||||||
pp_indented( public(URN,URL,Literals), Indent ) :-
|
write( 'public(' ), pp_string(URN), pp_comma_sp,
|
||||||
write( 'public(' ), pp_string(URN), pp_comma_sp,
|
pp_string(URL), write( ')' ).
|
||||||
pp_string(URL), pp_list( Literals, s(Indent) ), write( ')' ).
|
pp_indented( public(URN,URL,Literals), Indent ) :-
|
||||||
pp_indented( system(URL), _Indent ) :-
|
write( 'public(' ), pp_string(URN), pp_comma_sp,
|
||||||
write( 'system(' ), pp_string(URL), write( ')' ).
|
pp_string(URL), pp_list( Literals, s(Indent) ), write( ')' ).
|
||||||
pp_indented( system(URL,Literals), Indent ) :-
|
pp_indented( system(URL), _Indent ) :-
|
||||||
write( 'system(' ), pp_string(URL), pp_comma_sp,
|
write( 'system(' ), pp_string(URL), write( ')' ).
|
||||||
pp_list( Literals, s(Indent) ), write( ')' ).
|
pp_indented( system(URL,Literals), Indent ) :-
|
||||||
pp_indented( local, _Indent ) :-
|
write( 'system(' ), pp_string(URL), pp_comma_sp,
|
||||||
write( local ).
|
pp_list( Literals, s(Indent) ), write( ')' ).
|
||||||
pp_indented( local(Literals), Indent ) :-
|
pp_indented( local, _Indent ) :-
|
||||||
write( 'local(' ), nl,
|
write( local ).
|
||||||
pp_list( Literals, s(Indent) ), write( ')' ).
|
pp_indented( local(Literals), Indent ) :-
|
||||||
pp_indented( dtd_literal(String), Indent ) :-
|
write( 'local(' ), nl,
|
||||||
pp_indent( Indent ), write( 'dtd_literal(' ), pp_string(String), write( ')' ).
|
pp_list( Literals, s(Indent) ), write( ')' ).
|
||||||
pp_indented( out_of_context(Tag), Indent ) :-
|
pp_indented( dtd_literal(String), Indent ) :-
|
||||||
pp_indent( Indent ), write( '/* SYNTAX ERROR */ out_of_context( ' ),
|
pp_indent( Indent ), write( 'dtd_literal(' ), pp_string(String), write( ')' ).
|
||||||
writeq( Tag ), write( ' )' ).
|
pp_indented( out_of_context(Tag), Indent ) :-
|
||||||
pp_indented( unparsed(String), Indent ) :-
|
pp_indent( Indent ), write( '/* SYNTAX ERROR */ out_of_context( ' ),
|
||||||
pp_indent( Indent ), write( '/* SYNTAX ERROR */ unparsed( ' ),
|
writeq( Tag ), write( ' )' ).
|
||||||
pp_string(String), write( ' )' ).
|
pp_indented( unparsed(String), Indent ) :-
|
||||||
|
pp_indent( Indent ), write( '/* SYNTAX ERROR */ unparsed( ' ),
|
||||||
pp_list( [], Indent ) :-
|
pp_string(String), write( ' )' ).
|
||||||
pp_indent( Indent ), write( [] ).
|
|
||||||
pp_list( [H|T], Indent ) :-
|
pp_list( [], Indent ) :-
|
||||||
pp_indent( Indent ), write( '[' ), nl,
|
pp_indent( Indent ), write( [] ).
|
||||||
pp_indented( H, Indent ),
|
pp_list( [H|T], Indent ) :-
|
||||||
pp_list1( T, Indent ),
|
pp_indent( Indent ), write( '[' ), nl,
|
||||||
pp_indent( Indent ), write( ']' ).
|
pp_indented( H, Indent ),
|
||||||
|
pp_list1( T, Indent ),
|
||||||
pp_list1( [], _Indent ) :-
|
pp_indent( Indent ), write( ']' ).
|
||||||
nl.
|
|
||||||
pp_list1( [H|T], Indent ) :-
|
pp_list1( [], _Indent ) :-
|
||||||
pp_comma, nl,
|
nl.
|
||||||
pp_indented( H, Indent ),
|
pp_list1( [H|T], Indent ) :-
|
||||||
pp_list1( T, Indent ).
|
pp_comma, nl,
|
||||||
|
pp_indented( H, Indent ),
|
||||||
pp_attributes( [], Indent ) :-
|
pp_list1( T, Indent ).
|
||||||
pp_indent( Indent ), write( [] ).
|
|
||||||
pp_attributes( [Attribute|Attributes], Indent ) :-
|
pp_attributes( [], Indent ) :-
|
||||||
pp_indent( Indent ), write( '[' ),
|
pp_indent( Indent ), write( [] ).
|
||||||
pp_attributes1( Attributes, Attribute ),
|
pp_attributes( [Attribute|Attributes], Indent ) :-
|
||||||
write( ']' ).
|
pp_indent( Indent ), write( '[' ),
|
||||||
|
pp_attributes1( Attributes, Attribute ),
|
||||||
pp_attributes1( [], Name=Value ) :-
|
write( ']' ).
|
||||||
pp_name( Name ), pp_string( Value ).
|
|
||||||
pp_attributes1( [H|T], Name=Value ) :-
|
pp_attributes1( [], Name=Value ) :-
|
||||||
pp_name( Name ), pp_string( Value ), pp_comma_sp,
|
pp_name( Name ), pp_string( Value ).
|
||||||
pp_attributes1( T, H ).
|
pp_attributes1( [H|T], Name=Value ) :-
|
||||||
|
pp_name( Name ), pp_string( Value ), pp_comma_sp,
|
||||||
|
pp_attributes1( T, H ).
|
||||||
pp_name( Name ) :-
|
|
||||||
( possible_operator( Name ) ->
|
|
||||||
write( '(' ), write( Name ), write( ')=' )
|
pp_name( Name ) :-
|
||||||
; otherwise ->
|
( possible_operator( Name ) ->
|
||||||
writeq( Name ), write( '=' )
|
write( '(' ), write( Name ), write( ')=' )
|
||||||
).
|
; otherwise ->
|
||||||
|
writeq( Name ), write( '=' )
|
||||||
possible_operator( (abolish) ).
|
).
|
||||||
possible_operator( (attribute) ).
|
|
||||||
possible_operator( (check_advice) ).
|
possible_operator( (abolish) ).
|
||||||
possible_operator( (compile_command) ).
|
possible_operator( (attribute) ).
|
||||||
possible_operator( (delay) ).
|
possible_operator( (check_advice) ).
|
||||||
possible_operator( (demon) ).
|
possible_operator( (compile_command) ).
|
||||||
possible_operator( (discontiguous) ).
|
possible_operator( (delay) ).
|
||||||
possible_operator( (div) ).
|
possible_operator( (demon) ).
|
||||||
possible_operator( (do) ).
|
possible_operator( (discontiguous) ).
|
||||||
possible_operator( (document_export) ).
|
possible_operator( (div) ).
|
||||||
possible_operator( (document_import) ).
|
possible_operator( (do) ).
|
||||||
possible_operator( (dy) ).
|
possible_operator( (document_export) ).
|
||||||
possible_operator( (dynamic) ).
|
possible_operator( (document_import) ).
|
||||||
possible_operator( (edb) ).
|
possible_operator( (dy) ).
|
||||||
possible_operator( (eexport) ).
|
possible_operator( (dynamic) ).
|
||||||
possible_operator( (else) ).
|
possible_operator( (edb) ).
|
||||||
possible_operator( (except) ).
|
possible_operator( (eexport) ).
|
||||||
possible_operator( (export) ).
|
possible_operator( (else) ).
|
||||||
possible_operator( (foreign_pred) ).
|
possible_operator( (except) ).
|
||||||
possible_operator( (from) ).
|
possible_operator( (export) ).
|
||||||
possible_operator( (from_chars) ).
|
possible_operator( (foreign_pred) ).
|
||||||
possible_operator( (from_file) ).
|
possible_operator( (from) ).
|
||||||
possible_operator( (from_stream) ).
|
possible_operator( (from_chars) ).
|
||||||
possible_operator( (global) ).
|
possible_operator( (from_file) ).
|
||||||
possible_operator( (help) ).
|
possible_operator( (from_stream) ).
|
||||||
possible_operator( (hilog) ).
|
possible_operator( (global) ).
|
||||||
possible_operator( (if) ).
|
possible_operator( (help) ).
|
||||||
possible_operator( (import) ).
|
possible_operator( (hilog) ).
|
||||||
possible_operator( (index) ).
|
possible_operator( (if) ).
|
||||||
possible_operator( (initialization) ).
|
possible_operator( (import) ).
|
||||||
possible_operator( (is) ).
|
possible_operator( (index) ).
|
||||||
possible_operator( (listing) ).
|
possible_operator( (initialization) ).
|
||||||
possible_operator( (local) ).
|
possible_operator( (is) ).
|
||||||
possible_operator( (locked) ).
|
possible_operator( (listing) ).
|
||||||
possible_operator( (meta_predicate) ).
|
possible_operator( (local) ).
|
||||||
possible_operator( (mod) ).
|
possible_operator( (locked) ).
|
||||||
possible_operator( (mode) ).
|
possible_operator( (meta_predicate) ).
|
||||||
possible_operator( (module_transparent) ).
|
possible_operator( (mod) ).
|
||||||
possible_operator( (multifile) ).
|
possible_operator( (mode) ).
|
||||||
possible_operator( (namic) ).
|
possible_operator( (module_transparent) ).
|
||||||
possible_operator( (nocheck_advice) ).
|
possible_operator( (multifile) ).
|
||||||
possible_operator( (nospy) ).
|
possible_operator( (namic) ).
|
||||||
possible_operator( (not) ).
|
possible_operator( (nocheck_advice) ).
|
||||||
possible_operator( (of) ).
|
possible_operator( (nospy) ).
|
||||||
possible_operator( (once) ).
|
possible_operator( (not) ).
|
||||||
possible_operator( (onto_chars) ).
|
possible_operator( (of) ).
|
||||||
possible_operator( (onto_file) ).
|
possible_operator( (once) ).
|
||||||
possible_operator( (onto_stream) ).
|
possible_operator( (onto_chars) ).
|
||||||
possible_operator( (parallel) ).
|
possible_operator( (onto_file) ).
|
||||||
possible_operator( (public) ).
|
possible_operator( (onto_stream) ).
|
||||||
possible_operator( (r) ).
|
possible_operator( (parallel) ).
|
||||||
possible_operator( (rem) ).
|
possible_operator( (public) ).
|
||||||
possible_operator( (skipped) ).
|
possible_operator( (r) ).
|
||||||
possible_operator( (spy) ).
|
possible_operator( (rem) ).
|
||||||
possible_operator( (table) ).
|
possible_operator( (skipped) ).
|
||||||
possible_operator( (then) ).
|
possible_operator( (spy) ).
|
||||||
possible_operator( (thread_local) ).
|
possible_operator( (table) ).
|
||||||
possible_operator( (ti) ).
|
possible_operator( (then) ).
|
||||||
possible_operator( (ti_off) ).
|
possible_operator( (thread_local) ).
|
||||||
possible_operator( (traceable) ).
|
possible_operator( (ti) ).
|
||||||
possible_operator( (unskipped) ).
|
possible_operator( (ti_off) ).
|
||||||
possible_operator( (untraceable) ).
|
possible_operator( (traceable) ).
|
||||||
possible_operator( (use_subsumptive_tabling) ).
|
possible_operator( (unskipped) ).
|
||||||
possible_operator( (use_variant_tabling) ).
|
possible_operator( (untraceable) ).
|
||||||
possible_operator( (volatile) ).
|
possible_operator( (use_subsumptive_tabling) ).
|
||||||
possible_operator( (with) ).
|
possible_operator( (use_variant_tabling) ).
|
||||||
possible_operator( (with_input_from_chars) ).
|
possible_operator( (volatile) ).
|
||||||
possible_operator( (with_output_to_chars) ).
|
possible_operator( (with) ).
|
||||||
possible_operator( (xor) ).
|
possible_operator( (with_input_from_chars) ).
|
||||||
|
possible_operator( (with_output_to_chars) ).
|
||||||
pp_indent( 0 ).
|
possible_operator( (xor) ).
|
||||||
pp_indent( s(N) ) :-
|
|
||||||
write( ' ' ),
|
pp_indent( 0 ).
|
||||||
pp_indent( N ).
|
pp_indent( s(N) ) :-
|
||||||
|
write( ' ' ),
|
||||||
pp_comma :-
|
pp_indent( N ).
|
||||||
write( ',' ).
|
|
||||||
|
pp_comma :-
|
||||||
pp_comma_sp :-
|
write( ',' ).
|
||||||
write( ', ' ).
|
|
||||||
|
pp_comma_sp :-
|
||||||
|
write( ', ' ).
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user