Go to the first, previous, next, last section, table of contents.


PiLLoW types

Author(s): Daniel Cabeza.

Version: 1.11#222 (2004/5/24, 13:8:7 CEST)

Version of last change: 1.11#131 (2003/12/30, 22:44:12 CET)

Here are defined the regular types used in the documentation of the predicates of the PiLLoW package.

Usage and interface (pillow_types)

Documentation on exports (pillow_types)

REGTYPE: canonic_html_term/1:

A term representing HTML code in canonical, structured way. It is a list of terms defined by the following predicate:

canonic_html_item(comment(S)) :-
        string(S).
canonic_html_item(declare(S)) :-
        string(S).
canonic_html_item(env(Tag,Atts,Terms)) :-
        atm(Tag),
        list(Atts,tag_attrib),
        canonic_html_term(Terms).
canonic_html_item($(Tag,Atts)) :-
        atm(Tag),
        list(Atts,tag_attrib).
canonic_html_item(S) :-
        string(S).
tag_attrib(Att) :-
        atm(Att).
tag_attrib(Att=Val) :-
        atm(Att),
        string(Val).

Each structure represents one HTML construction:

env(tag,attribs,terms)
An HTML environment, with name tag, list of attributes attribs and contents terms.
$(tag,attribs)
An HTML element of name tag and list of attributes attribs. ($)/2 is defined by the pillow package as an infix, binary operator.
comment(string)
An HTML comment (translates to/from <!--string-->).
declare(string)
An HTML declaration, they are used only in the header (translates to/from <!string>).
string
Normal text is represented as a list of character codes.

For example, the term

env(a,[href="www.therainforestsite.com"],
      ["Visit ",img$[src="TRFS.gif"]])

is output to (or parsed from):

<a href="www.therainforestsite.com">Visit <img src="TRFS.gif"></a>

Usage: canonic_html_term(HTMLTerm)

REGTYPE: canonic_xml_term/1:

A term representing XML code in canonical, structured way. It is a list of terms defined by the following predicate (see tag_attrib/1 definition in canonic_html_term/1):

canonic_xml_item(Term) :-
        canonic_html_item(Term).
canonic_xml_item(xmldecl(Atts)) :-
        list(Atts,tag_attrib).
canonic_xml_item(env(Tag,Atts,Terms)) :-
        atm(Tag),
        list(Atts,tag_attrib),
        canonic_xml_term(Terms).
canonic_xml_item(elem(Tag,Atts)) :-
        atm(Tag),
        list(Atts,tag_attrib).

In addition to the structures defined by canonic_html_term/1 (the ($)/2 structure appears only in malformed XML code), the following structures can be used:

elem(tag,atts)
Specifies an XML empty element of name tag and list of attributes atts. For example, the term
elem(arc,[weigh="3",begin="n1",end="n2"])
is output to (or parsed from):
<arc weigh="3" begin="n1" end="n2"/>
xmldecl(atts)
Specifies an XML declaration with attributes atts (translates to/from <?xml atts?>)

Usage: canonic_xml_term(XMLTerm)

REGTYPE: html_term/1:

A term which represents HTML or XML code in a structured way. In addition to the structures defined by canonic_html_term/1 or canonic_xml_term/1, the following structures can be used:

begin(tag,atts)
It translates to the start of an HTML environment of name tag and attributes atts. There exists also a begin(tag) structure. Useful, in conjunction with the next structure, when including in a document output generated by an existing piece of code (e.g. tag = pre). Its use is otherwise discouraged.
end(tag)
Translates to the end of an HTML environment of name tag.
start
Used at the beginning of a document (translates to <html>).
end
Used at the end of a document (translates to </html>).
--
Produces a horizontal rule (translates to <hr>).
\\
Produces a line break (translates to <br>).
$
Produces a paragraph break (translates to <p>).
image(address)
Used to include an image of address (URL) address (equivalent to img$[src=address]).
image(address,atts)
As above with the list of attributes atts.
ref(address,text)
Produces a hypertext link, address is the URL of the referenced resource, text is the text of the reference (equivalent to a([href=address],text)).
label(name,text)
Labels text as a target destination with label name (equivalent to a([name=name],text)).
heading(n,text)
Produces a heading of level n (between 1 and 6), text is the text to be used as heading. Useful when one wants a heading level relative to another heading (equivalent to hn(text)).
itemize(items)
Produces a list of bulleted items, items is a list of corresponding HTML terms (translates to a <ul> environment).
enumerate(items)
Produces a list of numbered items, items is a list of corresponding HTML terms (translates to a <ol> environment).
description(defs)
Produces a list of defined items, defs is a list whose elements are definitions, each of them being a Prolog sequence (composed by ','/2 operators). The last element of the sequence is the definition, the other (if any) are the defined terms (translates to a <dl> environment).
nice_itemize(img,items)
Produces a list of bulleted items, using the image img as bullet. The predicate icon_address/2 provides a colored bullet.
preformatted(text)
Used to include preformatted text, text is a list of HTML terms, each element of the list being a line of the resulting document (translates to a <pre> environment).
verbatim(text)
Used to include text verbatim, special HTML characters (<,>,&," and space) are translated into its quoted HTML equivalent.
prolog_term(term)
Includes any prolog term term, represented in functional notation. Variables are output as _.
nl
Used to include a newline in the HTML source (just to improve human readability).
entity(name)
Includes the entity of name name (ISO-8859-1 special character).
start_form(addr,atts)
Specifies the beginning of a form. addr is the address (URL) of the program that will handle the form, and atts other attributes of the form, as the method used to invoke it. If atts is not present (there is only one argument) the method defaults to POST.
start_form
Specifies the beginning of a form without assigning address to the handler, so that the form handler will be the cgi-bin executable producing the form.
end_form
Specifies the end of a form.
checkbox(name,state)
Specifies an input of type checkbox with name name, state is on if the checkbox is initially checked.
radio(name,value,selected)
Specifies an input of type radio with name name (several radio buttons which are interlocked must share their name), value is the the value returned by the button, if selected=value the button is initially checked.
input(type,atts)
Specifies an input of type type with a list of attributes atts. Possible values of type are text, hidden, submit, reset, ldots
textinput(name,atts,text)
Specifies an input text area of name name. text provides the default text to be shown in the area, atts a list of attributes.
option(name,val,options)
Specifies a simple option selector of name name, options is the list of available options and val is the initial selected option (if val is not in options the first item is selected by default) (translates to a <select> environment).
menu(name,atts,items)
Specifies a menu of name name, list of attributes atts and list of options items. The elements of the list items are marked with the prefix operator $ to indicate that they are selected (translates to a <select> environment).
form_reply
cgi_reply
This two are equivalent, they do not generate HTML, rather, the CGI protocol requires this content descriptor to be used at the beginning by CGI executables (including form handlers) when replying (translates to Content-type: text/html).
pr
Includes in the page a graphical logo with the message "Developed using the PiLLoW Web programming library", which points to the manual and library source.
name(text)
A term with functor name/1, different from the special functors defined herein, represents an HTML environment of name name and included text text. For example, the term
   address('clip@clip.dia.fi.upm.es')
is translated into the HTML source
   <address>clip@clip.dia.fi.upm.es</address>
name(atts,text)
A term with functor name/2, different from the special functors defined herein, represents an HTML environment of name name, attributes atts and included text text. For example, the term

   a([href='http://www.clip.dia.fi.upm.es/'],"Clip home")
represents the HTML source
   <a href="http://www.clip.dia.fi.upm.es/">Clip home</a>

Usage: html_term(HTMLTerm)

REGTYPE: form_dict/1:

Usage: form_dict(Dict)

REGTYPE: form_assignment/1:

Usage: form_assignment(Eq)

REGTYPE: form_value/1:

Usage: form_value(V)

REGTYPE: value_dict/1:

Usage: value_dict(Dict)

REGTYPE: url_term/1:

A term specifying an Internet Uniform Resource Locator. Currently only HTTP URLs are supported. Example: http('www.clip.dia.fi.upm.es',80,"/Software/Ciao/"). Defined as

url_term(http(Host,Port,Document)) :-
        atm(Host),
        int(Port),
        string(Document).

Usage: url_term(URL)

REGTYPE: http_request_param/1:

A parameter of an HTTP request:

Usage: http_request_param(Request)

REGTYPE: http_response_param/1:

A parameter of an HTTP response:

Usage: http_response_param(Response)

REGTYPE: http_date/1:

http_date(Date)

Date is a term defined as

http_date(date(WeekDay,Day,Month,Year,Time)) :-
        weekday(WeekDay),
        int(Day),
        month(Month),
        int(Year),
        hms_time(Time).

.

Usage: http_date(Date)

REGTYPE: weekday/1:

Usage: weekday(WeekDay)

REGTYPE: month/1:

Usage: month(Month)

REGTYPE: hms_time/1:

Usage: hms_time(Time)


Go to the first, previous, next, last section, table of contents.