module Io:Definitions of the types of data exchanged between browsers and the internet.sig
..end
type
path = {
|
path_value : |
(* | A sequence of path elements:
for example, ["music"; "artists"; "Bauhaus.html"] . | *) |
type
req_uri = {
|
req_uri_path : |
|||
|
req_uri_params : |
(* | The part of the URL after a ? :
for example, "artist=bauhaus&song=slice+of+life" . | *) |
type
url =
| |
Blank_url |
(* | The URL of a blank browser window (typically written as
about:blank ). | *) |
| |
Http_url of |
(* | A URL that begins with http:// . | *) |
type
typ =
| |
Null_type |
| |
Bool_type |
| |
Int_type |
| |
String_type |
| |
Url_type |
| |
Type_type |
| |
Function_type |
| |
Code_type |
| |
Window_type |
| |
Node_type |
type
var = {
|
var_name : |
type
void =
| |
Void of |
type 'a
expr =
| |
X of |
(* | Allows this data type to be extended with additional language constructs to be added, which will be needed for the internal language. | *) |
| |
Null |
(* | The unique value "null". | *) |
| |
Bool of |
(* | A Boolean value. | *) |
| |
Int of |
(* | An integer value. | *) |
| |
String of |
(* | A string value. | *) |
| |
Url of |
(* | A URL value. | *) |
| |
Type of |
(* | A value representing a type. | *) |
| |
Seq of |
(* | Execute two expressions in sequence, discarding the results of the first and returning the results of the second. | *) |
| |
If of |
(* | A conditional expression. | *) |
| |
While of |
(* | A while loop. | *) |
| |
Prim1 of |
(* | Applies a unary primitive operation to an argument. | *) |
| |
Prim2 of |
(* | Applies a binary primitive operation to two arguments. | *) |
| |
Alert of |
(* | Sends a message to the user. | *) |
| |
Function of |
(* | Function(param, locals, body) is a single-argument function, where
locals are the additional variable names that will be used in the
body. | *) |
| |
Apply of |
(* | Applies a function to an argument. | *) |
| |
Code of |
(* | A suspended script expression. | *) |
| |
Eval of |
(* | Forces the execution of a Code value. | *) |
| |
Var of |
(* | Looks up a variable in the nearest enclosing scope. | *) |
| |
Set_var of |
(* | Updates a variable in the nearest enclosing scope, or creates a name in the statically enclosing window environment if the name is not found. It evaluates to the value of the expression. | *) |
| |
Get_cookie of |
(* | Get_cookie(url, key) gets the cookie value associated with url .
Returns null if there is no such cookie. | *) |
| |
Set_cookie of |
(* | Set_cookie(url, key, str) updates (or creates) the cookie value
associated with url . If str is null , then the cookie is
deleted. | *) |
| |
Xhr of |
(* | Xhr(url, msg, handler) sends an HTTP request to url with the
request body msg . If the response is a script and handler is a
function, then the reponse will be supplied as a Code value to the
handler when the response is received. It is an error if handler is
not a function. If the response is not a script, the handler will be
invoked with a null argument. | *) |
| |
Self_win |
(* | A reference to the statically enclosing window. | *) |
| |
Named_win of |
(* | Named_win(str) evaluates to the window whose string name is str .
It evalutes to null if there is no such window. | *) |
| |
Open_win of |
(* | Open_win(url) causes url to be loaded in a new, unnamed window. A
reference to the window is returned. (The document will not be loaded
in the window while the current script is running.) If url is null ,
a new blank window will be opened. Returns a reference to the opened
window. | *) |
| |
Open_named_win of |
(* | Open_named_win(url, str) causes url to be loaded in the window
with the name str . If a window with name str does not exist, then
it is created. A reference to the window is returned. (The document
will not be loaded in the window while the current script is running.)
If url is null and a window with that name exists, the window will not
be navigated. Returns a reference to the window. | *) |
| |
Close_win of |
(* | Close_win(win) closes win . It is a no-op if win is not open. | *) |
| |
Navigate_win of |
(* | Navigate_win(win, url) causes url to be loaded in win and
evaluates to null . (win will not be ready while the current script
is running.) It is an error if win is not open. | *) |
| |
Is_win_closed of |
(* | Is_win_closed(win) evaluates to false if win refers to an open
* window and true otherwise. | *) |
| |
Get_win_opener of |
(* | Get_win_opener(win) evaluates to the "opener" of win or null if
win has no opener. | *) |
| |
Get_win_location of |
(* | Get_win_location(win) evaluates to the URL that is loaded into the
window win . It is an error if win is not open. | *) |
| |
Get_win_name of |
(* | Get_win_name(win) returns the string name of the window, or null if
the window has no name. It is an error if win is not open. | *) |
| |
Set_win_name of |
(* | Set_win_name(win, str) set the name of win to str , or removes the
name if str is null . It evaluates to null . It is an error if
win is not open. | *) |
| |
Get_win_root_node of |
(* | Get_win_root_node(win) gets the document root node of a window. Returns
null if the window has no document. It is an error if win is not
open. | *) |
| |
Set_win_root_node of |
(* | Set_win_root_node(win, node) updates the document root node of a
window. It evaluates to null . It is an error if win is not
open. | *) |
| |
Get_win_var of |
(* | Get_win_var(win, var) looks up a variable in a window's environment. It
is an error if win is not open. | *) |
| |
Set_win_var of |
(* | Set_win_var(win, var, expr) updates (or creates) a variable in a
window's environment and evaluates to the new value. It is an error if
win is not open and ready. | *) |
| |
New_node of |
(* | New_node(desc) returns a new node of the type matching desc , which
should be one of the following: "para", "link", "textbox", "button",
"inl_script", "rem_script", or "div". It is an error if desc does not
match one of these strings. | *) |
| |
Get_node_type of |
(* | Get_node_type(node) returns one of the strings "para", "link",
"textbox", "button", "inl_script", "rem_script", or "div". | *) |
| |
Get_node_contents of |
(* | Get_node_contents(node) returns the contents of nodes that may have
non-empty contents. For "para", "link", and "button" nodes, this is a
String value. For "inl_script" nodes, this is a Code value. It is
an error if node is not one of these types. | *) |
| |
Set_node_contents of |
(* | Set_node_contents(node, value) updates the contents of nodes that may
have non-empty contents. For "para", "link", and "button" nodes,
value should be a String value. For "inl_script" nodes, value
should be a Code value. It is an error if node is not one of these
types. | *) |
| |
Get_node_attr of |
(* | Get_node_attr(node, attr) returns the attributes described by the
string attr of the node node . All node types have an attribute
"id", which can be a Null or String value. "link" nodes have an
"href" attribute, which is a Url value. "textbox" nodes have a
"value" attribute, which is a String value. "rem_script" nodes have a
"src" attribute, which is a Url value. | *) |
| |
Set_node_attr of |
(* | Set_node_attr(node, attr, value) updates the attributes described by
the string attr of the node node to have the value value . See
Get_node_attr for attribute descriptions. | *) |
| |
Remove_handlers of |
(* | Remove_handlers(node) removes all handlers from the "textbox" or
"button" node node . It is an error if node is not a "textbox" or
"button" node. | *) |
| |
Add_handler of |
(* | Add_handler(node, h) adds the Function value h as a handler to the
"textbox" or "button" node node . h will be applied to node itself
at the time the handler is triggered. | *) |
| |
Get_parent of |
(* | Get_parent(node) returns the parent node of node if it has one or
returns null if it does not (or if it is the root node of a page). | *) |
| |
Get_child of |
(* | Get_child(node, pos) returns the child node of node in
position pos (counting from 0), or null if node has less than
pos + 1 children. It is an error if node is not a "div" node. | *) |
| |
Insert_node of |
(* | Insert_node(parent, node, pos) inserts node as the child at
position pos of the "div" node parent . It is an error if parent
is not a "div" node; it is an error if node is an ancestor of
parent ; it is an error if parent has less than pos nodes. | *) |
| |
Remove_node of |
(* | Remove_node(node) removes node (and therefore all of its
descendents) from its parent node or removes directly from its enclosing
window if it is a document root node. | *) |
type
elt_id = {
|
elt_id_value : |
id
attribute of an HTML tag.type
doc =
| |
Para of |
(* | Para(id, text) represents a block of text. | *) |
| |
Link of |
(* | Link(id, link_text, href) represents to an HTML a tag. | *) |
| |
Textbox of |
(* | Textbox(id, contents) represents a text input box. | *) |
| |
Button of |
(* | Button(id, button_text) represents to an HTML button. | *) |
| |
Inl_script of |
(* | Represents a script tag with an inline script. | *) |
| |
Rem_script of |
(* | Represents a script tag with a src attribute. | *) |
| |
Div of |
(* | Contains a sequence of subdocuments. For simplicity, this is the only document structure with children. | *) |
type
req = {
|
req_uri : |
|
req_cookies : |
|
req_body : |
type
file_data =
| |
Empty_file |
| |
Html_file of |
| |
Script_file of |
type
resp = {
|
resp_del_cookies : |
|
resp_set_cookies : |
|
resp_body : |
type
net_connection =
| |
Net_connection of |
type
rendered_doc =
| |
Para_rendered of |
| |
Link_rendered of |
| |
Textbox_rendered of |
| |
Button_rendered of |
| |
Div_rendered of |
type
user_window =
| |
User_window of |
type
user_textbox =
| |
User_textbox of |
=
| |
User_button of |
type
input_event =
| |
User_load_in_new_win_event of |
(* | Represents the action of a user opening a new window at a the given URL. | *) |
| |
User_load_in_win_event of |
(* | Represents the action of a user loading a new URL in a window. The may be the result of typing in the address bar or of clicking on a link in the window's current page. | *) |
| |
User_link_to_new_win_event of |
(* | Represents the action of a user loading a URL from one page in a new
window. This may be the result of a clicking on a link with a target
attribute set to "_blank" or of clicking on a link in a special way
(e.g., with the control key pressed). | *) |
| |
User_link_to_named_win_event of |
(* | Represents the action of a user loading a URL from one page in a window
with a particular name. This may be the result of clicking on a link
with a target attribute set to some particular name. | *) |
| |
User_close_win_event of |
(* | Represents the action of a user closing a window. | *) |
| |
User_input_text_event of |
(* | Represents the action of a user updating the text in a text input box. | *) |
| |
User_click_button_event of |
(* | Represents the action of a user clicking on a button in a page. | *) |
| |
Network_response_event of |
(* | Represents the receipt of an HTTP response. | *) |
type
output_event =
| |
UI_win_opened_event |
|||
| |
UI_win_closed_event of |
(* | Represents the closing of a window. | *) |
| |
UI_page_loaded_event of |
(* | Represents a new document being loaded in a window. If the rendered
document is None , then the updated page has no visible contents. | *) |
| |
UI_page_updated_event of |
(* | Represents an update to the structure of a page. The entire page is included in this event representation, even if the update only affected some portiion of the page. | *) |
| |
UI_alert of |
(* | Represents a pop-up box with a message. | *) |
| |
UI_error of |
(* | Represents an error event. | *) |
| |
Network_send_event of |
(* | Represents an HTTP request. | *) |