comparison doc/manual.tex @ 556:5703a2ad5221

.urp files
author Adam Chlipala <adamc@hcoop.net>
date Tue, 09 Dec 2008 11:52:56 -0500
parents 0b2cf25a5eba
children 0d3db8d6a586
comparison
equal deleted inserted replaced
555:0b2cf25a5eba 556:5703a2ad5221
95 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/urweb-mode") 95 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/urweb-mode")
96 (load "urweb-mode-startup") 96 (load "urweb-mode-startup")
97 \end{verbatim} 97 \end{verbatim}
98 98
99 Change the path in the first line if you chose a different Emacs installation path during configuration. 99 Change the path in the first line if you chose a different Emacs installation path during configuration.
100
101
102 \section{Command-Line Compiler}
103
104 \subsection{Project Files}
105
106 The basic inputs to the \texttt{urweb} compiler are project files, which have the extension \texttt{.urp}. Here is a sample \texttt{.urp} file.
107
108 \begin{verbatim}
109 database dbname=test
110 sql crud1.sql
111
112 crud
113 crud1
114 \end{verbatim}
115
116 The \texttt{database} line gives the database information string to pass to libpq. In this case, the string only says to connect to a local database named \texttt{test}.
117
118 The \texttt{sql} line asks for an SQL source file to be generated, giving the commands to run to create the tables and sequences that this application expects to find. After building this \texttt{.urp} file, the following commands could be used to initialize the database, assuming that the current UNIX user exists as a Postgres user with database creation privileges:
119
120 \begin{verbatim}
121 createdb test
122 psql -f crud1.sql test
123 \end{verbatim}
124
125 A blank line always separates the named directives from a list of modules to include in the project; if there are no named directives, a blank line must begin the file.
126
127 For each entry \texttt{M} in the module list, the file \texttt{M.urs} is included in the project if it exists, and the file \texttt{M.ur} must exist and is always included.
128
129 A few other named directives are supported. \texttt{prefix PREFIX} sets the prefix included before every URI within the generated application; the default is \texttt{/}. \texttt{exe FILENAME} sets the filename to which to write the output executable; the default for file \texttt{P.urp} is \texttt{P.exe}. \texttt{debug} saves some intermediate C files, which is mostly useful to help in debugging the compiler itself. \texttt{profile} generates an executable that may be used with gprof.
100 130
101 131
102 \section{Ur Syntax} 132 \section{Ur Syntax}
103 133
104 In this section, we describe the syntax of Ur, deferring to a later section discussion of most of the syntax specific to SQL and XML. The sole exceptions are the declaration forms for tables, sequences, and cookies. 134 In this section, we describe the syntax of Ur, deferring to a later section discussion of most of the syntax specific to SQL and XML. The sole exceptions are the declaration forms for tables, sequences, and cookies.