diff options
author | 2014-01-18 18:26:24 -0500 | |
---|---|---|
committer | 2014-01-18 18:26:24 -0500 | |
commit | 4caa5f98146d40715a96aeab6c4ff65e7a0f38b6 (patch) | |
tree | 96e059e285d059c3c9373fdb081041a72121d767 /doc/manual.tex | |
parent | 1ce3acd70b3527add32015267cc916e920661dbb (diff) | |
parent | 6787b686afe5fd3e65b3d377d4c363b4cd086dad (diff) |
Merge in upstream changes.
Diffstat (limited to 'doc/manual.tex')
-rw-r--r-- | doc/manual.tex | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/doc/manual.tex b/doc/manual.tex index ac12c3b7..0a088436 100644 --- a/doc/manual.tex +++ b/doc/manual.tex @@ -64,7 +64,7 @@ apt-get install mlton libssl-dev To build programs that access SQL databases, you also need one of these client libraries for supported backends. \begin{verbatim} -apt-get install libpq-dev libmysqlclient15-dev libsqlite3-dev +apt-get install libpq-dev libmysqlclient-dev libsqlite3-dev \end{verbatim} It is also possible to access the modules of the Ur/Web compiler interactively, within Standard ML of New Jersey. To install the prerequisites in Debian testing: @@ -77,7 +77,7 @@ To begin an interactive session with the Ur compiler modules, run \texttt{make s To run an SQL-backed application with a backend besides SQLite, you will probably want to install one of these servers. \begin{verbatim} -apt-get install postgresql-8.4 mysql-server-5.1 +apt-get install postgresql mysql-server \end{verbatim} To use the Emacs mode, you must have a modern Emacs installed. We assume that you already know how to do this, if you're in the business of looking for an Emacs mode. The demo generation facility of the compiler will also call out to Emacs to syntax-highlight code, and that process depends on the \texttt{htmlize} module, which can be installed in Debian testing via: @@ -146,6 +146,7 @@ Here is the complete list of directive forms. ``FFI'' stands for ``foreign func \item \texttt{effectful Module.ident} registers an FFI function or transaction as having side effects. The optimizer avoids removing, moving, or duplicating calls to such functions. This is the default behavior for \texttt{transaction}-based types. \item \texttt{exe FILENAME} sets the filename to which to write the output executable. The default for file \texttt{P.urp} is \texttt{P.exe}. \item \texttt{ffi FILENAME} reads the file \texttt{FILENAME.urs} to determine the interface to a new FFI module. The name of the module is calculated from \texttt{FILENAME} in the same way as for normal source files. See the files \texttt{include/urweb/urweb\_cpp.h} and \texttt{src/c/urweb.c} for examples of C headers and implementations for FFI modules. In general, every type or value \texttt{Module.ident} becomes \texttt{uw\_Module\_ident} in C. +\item \texttt{html5} activates work-in-progress support for generating HTML5 instead of XHTML. For now, this option only affects the first few tokens on any page, which are always the same. \item \texttt{include FILENAME} adds \texttt{FILENAME} to the list of files to be \texttt{\#include}d in C sources. This is most useful for interfacing with new FFI modules. \item \texttt{jsFunc Module.ident=name} gives the JavaScript name of an FFI value. \item \texttt{library FILENAME} parses \texttt{FILENAME.urp} and merges its contents with the rest of the current file's contents. If \texttt{FILENAME.urp} doesn't exist, the compiler also tries \texttt{FILENAME/lib.urp}. @@ -170,6 +171,7 @@ Here is the complete list of directive forms. ``FFI'' stands for ``foreign func \item \texttt{linker CMD} sets \texttt{CMD} as the command line prefix to use for linking C object files. The command line will be completed with a space-separated list of \texttt{.o} and \texttt{.a} files, \texttt{-L} and \texttt{-l} flags, and finally with a \texttt{-o} flag to set the location where the executable should be written. \item \texttt{minHeap NUMBYTES} sets the initial size for thread-local heaps used in handling requests. These heaps grow automatically as needed (up to any maximum set with \texttt{limit}), but each regrow requires restarting the request handling process. \item \texttt{monoInline TREESIZE} sets how many nodes the AST of a function definition may have before the optimizer stops trying hard to inline calls to that function. (This is one of two options for one of two intermediate languages within the compiler.) +\item \texttt{noMangleSql} avoids adding a \texttt{uw\_} prefix in front of each identifier in SQL. With this experimental feature, the burden is on the programmer to avoid naming tables or columns after SQL keywords! \item \texttt{noXsrfProtection URIPREFIX} turns off automatic cross-site request forgery protection for the page handler identified by the given URI prefix. This will avoid checking cryptographic signatures on cookies, which is generally a reasonable idea for some pages, such as login pages that are going to discard all old cookie values, anyway. \item \texttt{onError Module.var} changes the handling of fatal application errors. Instead of displaying a default, ugly error 500 page, the error page will be generated by calling function \texttt{Module.var} on a piece of XML representing the error message. The error handler should have type $\mt{xbody} \to \mt{transaction} \; \mt{page}$. Note that the error handler \emph{cannot} be in the application's main module, since that would register it as explicitly callable via URLs. \item \texttt{path NAME=VALUE} creates a mapping from \texttt{NAME} to \texttt{VALUE}. This mapping may be used at the beginnings of filesystem paths given to various other configuration directives. A path like \texttt{\$NAME/rest} is expanded to \texttt{VALUE/rest}. There is an initial mapping from the empty name (for paths like \texttt{\$/list}) to the directory where the Ur/Web standard library is installed. If you accept the default \texttt{configure} options, this directory is \texttt{/usr/local/lib/urweb/ur}. @@ -275,6 +277,8 @@ sqlite3 path/to/database/file <app.sql \item \texttt{-print-ccompiler}: Print the C compiler being used. +\item \texttt{-print-cinclude}: Print the name of the directory where C/C++ header files are installed. + \item \texttt{-protocol [http|cgi|fastcgi|static]}: Set the protocol that the generated application speaks. \begin{itemize} \item \texttt{http}: This is the default. It is for building standalone web servers that can be accessed by web browsers directly. @@ -2103,6 +2107,14 @@ $$\begin{array}{l} \mt{val} \; \mt{stopPropagation} : \mt{transaction} \; \mt{unit} \end{array}$$ +Finally, here is an HTML tag to leave a marker in the \cd{<head>} of a document asking for some side-effecting code to be run. This pattern is \emph{much} less common in Ur/Web applications than in normal HTML/JavaScript applications; see Section \ref{signals} for the more idiomatic, functional way of manipulating the visible page. + +$$\begin{array}{l} + \mt{val} \; \mt{script} : \mt{unit} \to \mt{tag} \; [\mt{Code} = \mt{transaction} \; \mt{unit}] \; \mt{head} \; [] \; [] \; [] +\end{array}$$ + +Note that the Ur/Web version of \cd{<script>} is used like \cd{<script code=\{...\}/>}, rather than \cd{<script>...</script>}. + \subsubsection{Node IDs} There is an abstract type of node IDs that may be assigned to \cd{id} attributes of most HTML tags. @@ -2184,7 +2196,7 @@ $$\begin{array}{l} \mt{val} \; \mt{self} : \mt{transaction} \; \mt{client} \end{array}$$ -\emph{Channels} are the means of message-passing. Each channel is created in the context of a client and belongs to that client; no other client may receive the channel's messages. Each channel type includes the type of values that may be sent over the channel. Sending and receiving are asynchronous, in the sense that a client need not be ready to receive a message right away. Rather, sent messages may queue up, waiting to be processed. +\emph{Channels} are the means of message-passing. Each channel is created in the context of a client and belongs to that client; no other client may receive the channel's messages. Note that here \emph{client} has a technical Ur/Web meaning so that it describes only \emph{single page views}, so a user following a traditional link within an application will remove the ability for \emph{any} code to receive messages on the channels associated with the previous client. Each channel type includes the type of values that may be sent over the channel. Sending and receiving are asynchronous, in the sense that a client need not be ready to receive a message right away. Rather, sent messages may queue up, waiting to be processed. $$\begin{array}{l} \mt{con} \; \mt{channel} :: \mt{Type} \to \mt{Type} \\ |