diff options
Diffstat (limited to 'debian')
33 files changed, 2362 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..f0497018 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,48 @@ +urweb (20151220+dfsg-1) unstable; urgency=medium + + * New upstream release. + * Build architecture-independent targets correctly when built with + dpkg-buildpackage -A. (Closes: #806662) + + -- Benjamin Barenblat <bbaren@mit.edu> Wed, 23 Dec 2015 18:36:16 -0500 + +urweb (20151122+dfsg-1) unstable; urgency=medium + + * New upstream release. + + -- Benjamin Barenblat <bbaren@mit.edu> Sun, 22 Nov 2015 11:11:20 -0500 + +urweb (20151018+dfsg-1) unstable; urgency=medium + + * New upstream release. + + -- Benjamin Barenblat <bbaren@mit.edu> Sat, 24 Oct 2015 12:30:31 -0400 + +urweb (20150819+dfsg-1) experimental; urgency=medium + + * New upstream release. + + -- Benjamin Barenblat <bbaren@mit.edu> Wed, 19 Aug 2015 11:40:08 -0400 + +urweb (20150520+dfsg-1) sid; urgency=medium + + * New upstream release. + * Build documentation within an architecture-independent target. (Closes: + #790512) + * Make static linking work on multiarch systems. (Closes: #791551) + * Correct manual page with respect to the behaviour of the -static flag. + + -- Benjamin Barenblat <bbaren@mit.edu> Sun, 26 Jul 2015 19:10:00 -0400 + +urweb (20150412+dfsg-1) unstable; urgency=medium + + * New upstream release. + * Fix debian/watch file. + + -- Benjamin Barenblat <bbaren@mit.edu> Tue, 14 Apr 2015 16:24:31 -0400 + +urweb (20150214+dfsg-1) unstable; urgency=medium + + * Initial release. + + -- Benjamin Barenblat <bbaren@mit.edu> Sun, 05 Apr 2015 15:36:51 -0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..7ee80861 --- /dev/null +++ b/debian/control @@ -0,0 +1,163 @@ +Source: urweb +Section: devel +Priority: extra +Maintainer: Benjamin Barenblat <bbaren@mit.edu> +Build-Depends: + curl, + debhelper (>= 9), + dh-autoreconf, + libmysqlclient-dev, + libpq-dev, + libsqlite3-dev, + libssl-dev, + mlton, + sqlite3, + uthash-dev +Build-Depends-Indep: + emacs24 | emacsen, + texlive-fonts-recommended, + texlive-latex-extra +Standards-Version: 3.9.6 +Homepage: http://impredicative.com/ur/ +Vcs-Browser: https://github.com/urweb/debian-urweb +Vcs-Git: git://github.com/urweb/debian-urweb.git + +Package: urweb +Architecture: any +Multi-Arch: foreign +Pre-Depends: ${misc:Pre-Depends} +Depends: + libmysqlclient-dev, + libpq-dev, + libsqlite3-dev, + libssl-dev, + liburweb0, + liburweb-cgi0, + liburweb-fastcgi0, + liburweb-http0, + liburweb-static0, + uthash-dev, + ${shlibs:Depends}, + ${misc:Depends} +Recommends: + urweb-doc, + urweb-mode +Description: purely functional language for web programming + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the urweb compiler and development libraries; you do not + need to install it to run applications written in Ur/Web. + +Package: liburweb0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: + liburweb-cgi0, + liburweb-fastcgi0, + liburweb-http0, + liburweb-static0 +Description: urweb runtime system + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the runtime library for executables compiled with urweb. + Packages should not depend on this package; instead, they should depend on one + of the urweb backend packages, each of which depends on this one. + +Package: liburweb-cgi0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: urweb CGI backend + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the CGI backend for executables compiled with urweb. + +Package: liburweb-fastcgi0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: urweb FastCGI backend + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the FastCGI backend for executables compiled with urweb. + +Package: liburweb-http0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: urweb standalone backend + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the standalone backend for web servers generated with + urweb. + +Package: liburweb-static0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: urweb static backend + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the static-file backend for executables compiled with + urweb. + +Package: urweb-doc +Section: doc +Architecture: all +Multi-Arch: foreign +Depends: ${misc:Depends} +Recommends: xpdf | pdf-viewer +Description: Ur/Web reference manual + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides the Ur/Web reference manual in PDF format. + +Package: urweb-mode +Section: editors +Architecture: all +Multi-Arch: foreign +Depends: + emacsen-common (>= 2.0.8), + ${misc:Depends} +Description: Emacs mode for editing Ur/Web programs + Ur is a pure, functional, statically typed, strict programming language in the + tradition of ML and Haskell; however, it features a significantly richer type + system. Ur/Web is Ur plus a special standard library and associated rules for + parsing and optimization. Ur/Web supports constructing dynamic web + applications backed by SQL databases. + . + This package provides an Emacs mode for editing Ur/Web source files. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..c5ad63a2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,169 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Ur/Web +Upstream-Contact: Adam Chlipala <adamc@csail.mit.edu> +Source: http://hg.impredicative.com/urweb +Copyright: 2008-2011 Adam Chlipala <adamc@csail.mit.edu> +License: BSD-3-clause + +Files: * +Copyright: 2008-2015 Adam Chlipala <adamc@csail.mit.edu> +License: BSD-3-clause + +Files: debian/* +Copyright: 2013, 2014, 2015 Benjamin Barenblat <bbaren@mit.edu> +License: Apache-2.0 + +Files: debian/*.emacsen* +Copyright: 1998-2011 Craig Small <csmall@debian.org> + 2015 Benjamin Barenblat <bbaren@mit.edu> +License: Apache-2.0 + +Files: m4/ax_check_openssl.m4 +Copyright: 2009, 2010 Zmanda Inc. <http://www.zmanda.com/> + 2009, 2010 Dustin J. Mitchell <dustin@zmanda.com> +License: AX-free + +Files: m4/m4_ax_pthread.m4 +Copyright: 2008 Steven G. Johnson <stevenj@alum.mit.edu> + 2011 Daniel Richard G. <skunk@iSKUNK.ORG> +License: GPL-3+ with Autoconf exception + +Files: src/c/memmem.c +Copyright: 2003 The NetBSD Foundation, Inc. +License: BSD-4-clause + +Files: + src/elisp/urweb-compat.el + src/elisp/urweb-defs.el + src/elisp/urweb-mode.el + src/elisp/urweb-move.el + src/elisp/urweb-util.el +Copyright: 1989 Lars Bo Nielsen + 1994-1997 Matthew J. Morley + 1999, 2000, 2003-2004 Stefan Monnier <monnier@gnu.org> + 2008 Adam Chlipala <adamc@hcoop.net> +License: GPL-2+ + +Files: + xml/xhtml-lat1.ent + xml/xhtml-special.ent + xml/xhtml-symbol.ent +Copyright: 1986 International Organization for Standardization + 2008-2011 Adam Chlipala <adamc@csail.mit.edu> +License: BSD-3-clause + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + . + On Debian systems, the complete text of the Apache License, Version 2.0, can be + found in "/usr/share/common-licenses/Apache-2.0". + +License: AX-free + Copying and distribution of this file, with or without modification, are + permitted in any medium without royalty provided the copyright notice and this + notice are preserved. This file is offered as-is, without any warranty. + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + - Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + - The names of contributors may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD-4-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software must + display the following acknowledgement: + This product includes software developed by the NetBSD Foundation, + Inc. and its contributors. + 4. Neither the name of The NetBSD Foundation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 51 Franklin + Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU General Public License version + 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ with Autoconf exception + This program is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program. If not, see <http://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU General Public License version + 3 can be found in "/usr/share/common-licenses/GPL-3". + . + As a special exception, the respective Autoconf Macro's copyright owner gives + unlimited permission to copy, distribute and modify the configure scripts that + are the output of Autoconf when processing the Macro. You need not follow the + terms of the GNU General Public License when using or distributing such + scripts, even though portions of the text of the Macro appear in them. The GNU + General Public License (GPL) does govern all other use of the material that + constitutes the Autoconf Macro. + . + This special exception to the GPL applies to versions of the Autoconf Macro + released by the Autoconf Archive. When you make and distribute a modified + version of the Autoconf Macro, you may extend this special exception to the GPL + to apply to your modified version as well. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 00000000..86cbc1f2 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,2 @@ +[DEFAULT] +upstream-tag = %(version)s diff --git a/debian/liburweb-cgi0.install b/debian/liburweb-cgi0.install new file mode 100644 index 00000000..bcc294c6 --- /dev/null +++ b/debian/liburweb-cgi0.install @@ -0,0 +1 @@ +usr/lib/*/liburweb_cgi.so.* diff --git a/debian/liburweb-cgi0.symbols b/debian/liburweb-cgi0.symbols new file mode 100644 index 00000000..05145d33 --- /dev/null +++ b/debian/liburweb-cgi0.symbols @@ -0,0 +1,8 @@ +liburweb_cgi.so.0 liburweb-cgi0 #MINVER# + main@Base 20150214 + uw_copy_client_data@Base 20150214 + uw_do_expunge@Base 20150214 + uw_free_client_data@Base 20150214 + uw_init_client_data@Base 20150214 + uw_post_expunge@Base 20150214 + uw_supports_direct_status@Base 20150214 diff --git a/debian/liburweb-fastcgi0.install b/debian/liburweb-fastcgi0.install new file mode 100644 index 00000000..bb13424a --- /dev/null +++ b/debian/liburweb-fastcgi0.install @@ -0,0 +1 @@ +usr/lib/*/liburweb_fastcgi.so.* diff --git a/debian/liburweb-fastcgi0.symbols b/debian/liburweb-fastcgi0.symbols new file mode 100644 index 00000000..1d106269 --- /dev/null +++ b/debian/liburweb-fastcgi0.symbols @@ -0,0 +1,9 @@ +liburweb_fastcgi.so.0 liburweb-fastcgi0 #MINVER# + fastcgi_send_normal@Base 20150214 + main@Base 20150214 + uw_copy_client_data@Base 20150214 + uw_do_expunge@Base 20150214 + uw_free_client_data@Base 20150214 + uw_init_client_data@Base 20150214 + uw_post_expunge@Base 20150214 + uw_supports_direct_status@Base 20150214 diff --git a/debian/liburweb-http0.install b/debian/liburweb-http0.install new file mode 100644 index 00000000..1abcfd81 --- /dev/null +++ b/debian/liburweb-http0.install @@ -0,0 +1 @@ +usr/lib/*/liburweb_http.so.* diff --git a/debian/liburweb-http0.symbols b/debian/liburweb-http0.symbols new file mode 100644 index 00000000..05f42e65 --- /dev/null +++ b/debian/liburweb-http0.symbols @@ -0,0 +1,9 @@ +liburweb_http.so.0 liburweb-http0 #MINVER# + main@Base 20150214 + uw_backlog@Base 20150214 + uw_copy_client_data@Base 20150214 + uw_do_expunge@Base 20150214 + uw_free_client_data@Base 20150214 + uw_init_client_data@Base 20150214 + uw_post_expunge@Base 20150214 + uw_supports_direct_status@Base 20150214 diff --git a/debian/liburweb-static0.install b/debian/liburweb-static0.install new file mode 100644 index 00000000..3f464d5e --- /dev/null +++ b/debian/liburweb-static0.install @@ -0,0 +1 @@ +usr/lib/*/liburweb_static.so.* diff --git a/debian/liburweb-static0.symbols b/debian/liburweb-static0.symbols new file mode 100644 index 00000000..82f4a8ec --- /dev/null +++ b/debian/liburweb-static0.symbols @@ -0,0 +1,8 @@ +liburweb_static.so.0 liburweb-static0 #MINVER# + main@Base 20150214 + uw_copy_client_data@Base 20150214 + uw_do_expunge@Base 20150214 + uw_free_client_data@Base 20150214 + uw_init_client_data@Base 20150214 + uw_post_expunge@Base 20150214 + uw_supports_direct_status@Base 20150214 diff --git a/debian/liburweb0.install b/debian/liburweb0.install new file mode 100644 index 00000000..5aecbb64 --- /dev/null +++ b/debian/liburweb0.install @@ -0,0 +1 @@ +usr/lib/*/liburweb.so.* diff --git a/debian/liburweb0.symbols b/debian/liburweb0.symbols new file mode 100644 index 00000000..ad36ad22 --- /dev/null +++ b/debian/liburweb0.symbols @@ -0,0 +1,350 @@ +liburweb.so.0 liburweb0 #MINVER# + client_pruner@Base 20150214 + memmem@Base 20150214 + pthread_create_big@Base 20150214 + uw_Basis_addSeconds@Base 20150214 + uw_Basis_atom@Base 20150214 + uw_Basis_attrifyChannel@Base 20150214 + uw_Basis_attrifyChar@Base 20150214 + uw_Basis_attrifyChar_w@Base 20150214 + uw_Basis_attrifyClient@Base 20150214 + uw_Basis_attrifyCss_class@Base 20150214 + uw_Basis_attrifyFloat@Base 20150214 + uw_Basis_attrifyFloat_w@Base 20150214 + uw_Basis_attrifyInt@Base 20150214 + uw_Basis_attrifyInt_w@Base 20150214 + uw_Basis_attrifyString@Base 20150214 + uw_Basis_attrifyString_w@Base 20150214 + uw_Basis_attrifyTime@Base 20150214 + uw_Basis_bless@Base 20150214 + uw_Basis_blessData@Base 20150214 + uw_Basis_blessEnvVar@Base 20150214 + uw_Basis_blessMime@Base 20150214 + uw_Basis_blessRequestHeader@Base 20150214 + uw_Basis_blessResponseHeader@Base 20150214 + uw_Basis_blobSize@Base 20150214 + uw_Basis_boolToString@Base 20150214 + uw_Basis_ceil@Base 20150214 + uw_Basis_charToString@Base 20150214 + uw_Basis_checkEnvVar@Base 20150214 + uw_Basis_checkMime@Base 20150214 + uw_Basis_checkRequestHeader@Base 20150214 + uw_Basis_checkResponseHeader@Base 20150214 + uw_Basis_checkUrl@Base 20150214 + uw_Basis_chr@Base 20150214 + uw_Basis_clear_cookie@Base 20150214 + uw_Basis_clear_page@Base 20150214 + uw_Basis_crypt@Base 20150214 + uw_Basis_css_url@Base 20150214 + uw_Basis_currentUrl@Base 20150214 + uw_Basis_currentUrlHasPost@Base 20150214 + uw_Basis_currentUrlHasQueryString@Base 20150214 + uw_Basis_datetimeDay@Base 20150214 + uw_Basis_datetimeDayOfWeek@Base 20150214 + uw_Basis_datetimeHour@Base 20150214 + uw_Basis_datetimeMinute@Base 20150214 + uw_Basis_datetimeMonth@Base 20150214 + uw_Basis_datetimeSecond@Base 20150214 + uw_Basis_datetimeYear@Base 20150214 + uw_Basis_debug@Base 20150214 + uw_Basis_diffInMilliseconds@Base 20150214 + uw_Basis_diffInSeconds@Base 20150214 + uw_Basis_ensqlBool@Base 20150214 + uw_Basis_ensqlTime@Base 20150214 + uw_Basis_eq_time@Base 20150214 + uw_Basis_fieldName@Base 20150214 + uw_Basis_fieldValue@Base 20150214 + uw_Basis_fileData@Base 20150214 + uw_Basis_fileMimeType@Base 20150214 + uw_Basis_fileName@Base 20150214 + uw_Basis_firstFormField@Base 20150214 + uw_Basis_floatFromInt@Base 20150214 + uw_Basis_floatToString@Base 20150214 + uw_Basis_fresh@Base 20150214 + uw_Basis_fromDatetime@Base 20150214 + uw_Basis_fromMilliseconds@Base 20151122 + uw_Basis_getHeader@Base 20150214 + uw_Basis_get_cookie@Base 20150214 + uw_Basis_get_settings@Base 20150214 + uw_Basis_getenv@Base 20150214 + uw_Basis_htmlifyBool@Base 20150214 + uw_Basis_htmlifyBool_w@Base 20150214 + uw_Basis_htmlifyFloat@Base 20150214 + uw_Basis_htmlifyFloat_w@Base 20150214 + uw_Basis_htmlifyInt@Base 20150214 + uw_Basis_htmlifyInt_w@Base 20150214 + uw_Basis_htmlifySource@Base 20150214 + uw_Basis_htmlifySource_w@Base 20150214 + uw_Basis_htmlifySpecialChar@Base 20150214 + uw_Basis_htmlifySpecialChar_w@Base 20150214 + uw_Basis_htmlifyString@Base 20150214 + uw_Basis_htmlifyString_w@Base 20150214 + uw_Basis_htmlifyTime@Base 20150214 + uw_Basis_htmlifyTime_w@Base 20150214 + uw_Basis_intToString@Base 20150214 + uw_Basis_isalnum@Base 20150214 + uw_Basis_isalpha@Base 20150214 + uw_Basis_isblank@Base 20150214 + uw_Basis_iscntrl@Base 20150214 + uw_Basis_isdigit@Base 20150214 + uw_Basis_isgraph@Base 20150214 + uw_Basis_islower@Base 20150214 + uw_Basis_isprint@Base 20150214 + uw_Basis_ispunct@Base 20150214 + uw_Basis_isspace@Base 20150214 + uw_Basis_isupper@Base 20150214 + uw_Basis_isxdigit@Base 20150214 + uw_Basis_jsifyChannel@Base 20150214 + uw_Basis_jsifyChar@Base 20150214 + uw_Basis_jsifyInt_w@Base 20150214 + uw_Basis_jsifyString@Base 20150214 + uw_Basis_jsifyString_ws@Base 20150214 + uw_Basis_jsifyTime@Base 20150214 + uw_Basis_le_time@Base 20150214 + uw_Basis_lt_time@Base 20150214 + uw_Basis_makeSigString@Base 20150214 + uw_Basis_maybe_onload@Base 20150214 + uw_Basis_maybe_onunload@Base 20150214 + uw_Basis_minTime@Base 20150214 + uw_Basis_mstrcat@Base 20150214 + uw_Basis_naughtyDebug@Base 20150214 + uw_Basis_new_channel@Base 20150214 + uw_Basis_new_client_source@Base 20150214 + uw_Basis_now@Base 20150214 + uw_Basis_ord@Base 20150214 + uw_Basis_postData@Base 20150214 + uw_Basis_postType@Base 20150214 + uw_Basis_property@Base 20150214 + uw_Basis_rand@Base 20150214 + uw_Basis_readUtc@Base 20150214 + uw_Basis_remainingFields@Base 20150214 + uw_Basis_requestHeader@Base 20150214 + uw_Basis_round@Base 20150214 + uw_Basis_self@Base 20150214 + uw_Basis_send@Base 20150214 + uw_Basis_setHeader@Base 20150214 + uw_Basis_set_client_source@Base 20150214 + uw_Basis_set_cookie@Base 20150214 + uw_Basis_sigString@Base 20150214 + uw_Basis_sqlifyBlob@Base 20150214 + uw_Basis_sqlifyBool@Base 20150214 + uw_Basis_sqlifyBoolN@Base 20150214 + uw_Basis_sqlifyChannel@Base 20150214 + uw_Basis_sqlifyChar@Base 20150214 + uw_Basis_sqlifyClient@Base 20150214 + uw_Basis_sqlifyFloat@Base 20150214 + uw_Basis_sqlifyFloatN@Base 20150214 + uw_Basis_sqlifyInt@Base 20150214 + uw_Basis_sqlifyIntN@Base 20150214 + uw_Basis_sqlifyString@Base 20150214 + uw_Basis_sqlifyStringN@Base 20150214 + uw_Basis_sqlifyTime@Base 20150214 + uw_Basis_sqlifyTimeN@Base 20150214 + uw_Basis_str1@Base 20150214 + uw_Basis_strcat@Base 20150214 + uw_Basis_strchr@Base 20150214 + uw_Basis_strcspn@Base 20150214 + uw_Basis_strindex@Base 20150214 + uw_Basis_stringToBlob_error@Base 20150214 + uw_Basis_stringToBool@Base 20150214 + uw_Basis_stringToBool_error@Base 20150214 + uw_Basis_stringToChannel_error@Base 20150214 + uw_Basis_stringToChar@Base 20150214 + uw_Basis_stringToChar_error@Base 20150214 + uw_Basis_stringToClient_error@Base 20150214 + uw_Basis_stringToFloat@Base 20150214 + uw_Basis_stringToFloat_error@Base 20150214 + uw_Basis_stringToInt@Base 20150214 + uw_Basis_stringToInt_error@Base 20150214 + uw_Basis_stringToTime@Base 20150214 + uw_Basis_stringToTime_error@Base 20150214 + uw_Basis_stringToTimef@Base 20150214 + uw_Basis_stringToTimef_error@Base 20150214 + uw_Basis_strlen@Base 20150214 + uw_Basis_strlenGe@Base 20150214 + uw_Basis_strsindex@Base 20150214 + uw_Basis_strsub@Base 20150214 + uw_Basis_strsuffix@Base 20150214 + uw_Basis_substring@Base 20150214 + uw_Basis_textBlob@Base 20150214 + uw_Basis_timeToString@Base 20150214 + uw_Basis_timef@Base 20150214 + uw_Basis_toMilliseconds@Base 20150214 + uw_Basis_toSeconds@Base 20150214 + uw_Basis_tolower@Base 20150214 + uw_Basis_toupper@Base 20150214 + uw_Basis_trunc@Base 20150214 + uw_Basis_unAs@Base 20150214 + uw_Basis_unsqlTime@Base 20150214 + uw_Basis_unurlifyBool@Base 20150214 + uw_Basis_unurlifyFloat@Base 20150214 + uw_Basis_unurlifyInt@Base 20150214 + uw_Basis_unurlifyString@Base 20150214 + uw_Basis_unurlifyString_fromClient@Base 20150214 + uw_Basis_unurlifyTime@Base 20150214 + uw_Basis_unurlifyUnit@Base 20150214 + uw_Basis_urlifyBool@Base 20150214 + uw_Basis_urlifyBool_w@Base 20150214 + uw_Basis_urlifyChannel@Base 20150214 + uw_Basis_urlifyChannel_w@Base 20150214 + uw_Basis_urlifyFloat@Base 20150214 + uw_Basis_urlifyFloat_w@Base 20150214 + uw_Basis_urlifyInt@Base 20150214 + uw_Basis_urlifyInt_w@Base 20150214 + uw_Basis_urlifySource@Base 20150214 + uw_Basis_urlifySource_w@Base 20150214 + uw_Basis_urlifyString@Base 20150214 + uw_Basis_urlifyString_w@Base 20150214 + uw_Basis_urlifyTime@Base 20150214 + uw_Basis_urlifyTime_w@Base 20150214 + uw_Basis_writec@Base 20150214 + uw_Estrings@Base 20150214 + uw_Sqlcache_check@Base 20151220 + uw_Sqlcache_flush@Base 20151220 + uw_Sqlcache_rlock@Base 20151220 + uw_Sqlcache_store@Base 20151220 + uw_Sqlcache_wlock@Base 20151220 + uw_app_init@Base 20150214 + uw_begin@Base 20150214 + uw_begin_html5@Base 20150214 + uw_begin_init@Base 20150214 + uw_begin_initializing@Base 20150214 + uw_begin_onError@Base 20150214 + uw_begin_region@Base 20150214 + uw_begin_xhtml@Base 20150214 + uw_buffer_append@Base 20150214 + uw_buffer_avail@Base 20150214 + uw_buffer_check@Base 20150214 + uw_buffer_free@Base 20150214 + uw_buffer_init@Base 20150214 + uw_buffer_reset@Base 20150214 + uw_buffer_used@Base 20150214 + uw_check_deadline@Base 20150214 + uw_check_heap@Base 20150214 + uw_cleanup_max@Base 20150214 + uw_clear_headers@Base 20150214 + uw_client_connect@Base 20150214 + uw_clients_max@Base 20150214 + uw_close@Base 20150214 + uw_commit@Base 20150214 + uw_database_max@Base 20150214 + uw_deltas_max@Base 20150214 + uw_dequeue@Base 20150214 + uw_dup_and_clear_error_message@Base 20150214 + uw_end_initializing@Base 20150214 + uw_end_region@Base 20150214 + uw_enqueue@Base 20150214 + uw_ensure_transaction@Base 20150214 + uw_enter_subform@Base 20150214 + uw_enter_subforms@Base 20150214 + uw_error@Base 20150214 + uw_error_message@Base 20150214 + uw_free@Base 20150214 + uw_free_request_context@Base 20150214 + uw_getPostBody@Base 20150214 + uw_get_app@Base 20150214 + uw_get_db@Base 20150214 + uw_get_file_input@Base 20150214 + uw_get_global@Base 20150214 + uw_get_input@Base 20150214 + uw_get_loggers@Base 20150214 + uw_get_optional_input@Base 20150214 + uw_get_real_script@Base 20150214 + uw_get_url_prefix@Base 20150214 + uw_global_init@Base 20150214 + uw_globals_max@Base 20150214 + uw_hasPostBody@Base 20150214 + uw_has_contentLength@Base 20150214 + uw_has_error@Base 20150214 + uw_hash_blocksize@Base 20150214 + uw_headers_max@Base 20150214 + uw_heap_front@Base 20150214 + uw_heap_max@Base 20150214 + uw_init@Base 20150214 + uw_init_crypto@Base 20150214 + uw_initialize@Base 20150214 + uw_inputs_max@Base 20150214 + uw_isPost@Base 20150214 + uw_leave_subform@Base 20150214 + uw_login@Base 20150214 + uw_malloc@Base 20150214 + uw_mayReturnIndirectly@Base 20150214 + uw_maybe_strdup@Base 20150214 + uw_memdup@Base 20150214 + uw_memstats@Base 20150214 + uw_messages_max@Base 20150214 + uw_min_heap@Base 20150214 + uw_new_request_context@Base 20150214 + uw_next_entry@Base 20150214 + uw_noPostBody@Base 20150214 + uw_output@Base 20150214 + uw_page_max@Base 20150214 + uw_pagelen@Base 20150214 + uw_pop_cleanup@Base 20150214 + uw_postBody@Base 20150214 + uw_print@Base 20150214 + uw_prune_clients@Base 20150214 + uw_push_cleanup@Base 20150214 + uw_queryString@Base 20150214 + uw_really_send@Base 20150214 + uw_really_write@Base 20150214 + uw_recordingRead@Base 20151220 + uw_recordingStart@Base 20151220 + uw_redirect@Base 20150214 + uw_register_transactional@Base 20150214 + uw_remoteSock@Base 20150214 + uw_replace_page@Base 20150214 + uw_request@Base 20150214 + uw_request_init@Base 20150214 + uw_request_new_context@Base 20150214 + uw_reset@Base 20150214 + uw_reset_keep_error_message@Base 20150214 + uw_reset_keep_request@Base 20150214 + uw_return_blob@Base 20150214 + uw_return_blob_from_page@Base 20150214 + uw_rollback@Base 20150214 + uw_runCallback@Base 20150214 + uw_script_max@Base 20150214 + uw_send@Base 20150214 + uw_setQueryString@Base 20150214 + uw_set_app@Base 20150214 + uw_set_at_most_one_query@Base 20150214 + uw_set_client_data@Base 20150214 + uw_set_could_write_db@Base 20150214 + uw_set_currentUrl@Base 20150214 + uw_set_db@Base 20150214 + uw_set_deadline@Base 20150214 + uw_set_env@Base 20150214 + uw_set_error_message@Base 20150214 + uw_set_file_input@Base 20150214 + uw_set_global@Base 20150214 + uw_set_headers@Base 20150214 + uw_set_heap_front@Base 20150214 + uw_set_input@Base 20150214 + uw_set_needs_push@Base 20150214 + uw_set_needs_sig@Base 20150214 + uw_set_on_success@Base 20150214 + uw_set_remoteSock@Base 20150214 + uw_set_script_header@Base 20150214 + uw_sig_file@Base 20150214 + uw_sign@Base 20150214 + uw_sql_type_annotations@Base 20150214 + uw_sqlfmtFloat@Base 20150214 + uw_sqlfmtInt@Base 20150214 + uw_sqlfmtUint4@Base 20150214 + uw_sqlsuffixBlob@Base 20150214 + uw_sqlsuffixChar@Base 20150214 + uw_sqlsuffixString@Base 20150214 + uw_strdup@Base 20150214 + uw_streq@Base 20150214 + uw_subinputs_max@Base 20150214 + uw_time@Base 20150214 + uw_time_max@Base 20150214 + uw_transactionals_max@Base 20150214 + uw_try_reconnecting_and_restarting@Base 20151018 + uw_unit_v@Base 20150214 + uw_unnull@Base 20150214 + uw_write@Base 20150214 + uw_write_header@Base 20150214 + uw_write_script@Base 20150214 + uw_writec@Base 20150214 diff --git a/debian/patches/doc-letterpaper.diff b/debian/patches/doc-letterpaper.diff new file mode 100644 index 00000000..f9f88fc2 --- /dev/null +++ b/debian/patches/doc-letterpaper.diff @@ -0,0 +1,14 @@ +From: Benjamin Barenblat <bbaren@mit.edu> +Subject: Use letter-size paper for reference manual +Forwarded: no + +LaTeX on Debian defaults to A4 paper, but the official reference manual +(as available on the Ur/Web site) uses letter paper. +--- a/doc/manual.tex ++++ b/doc/manual.tex +@@ -1,4 +1,5 @@ + \documentclass{article} ++\usepackage[letterpaper,pass]{geometry} + \usepackage{fullpage,amsmath,amssymb,proof,url} + \usepackage[T1]{fontenc} + \usepackage{ae,aecompl} diff --git a/debian/patches/harden.diff b/debian/patches/harden.diff new file mode 100644 index 00000000..13c6068b --- /dev/null +++ b/debian/patches/harden.diff @@ -0,0 +1,21 @@ +From: Benjamin Barenblat <bbaren@mit.edu> +Subject: Remove build flags which impede hardening +Forwarded: no + +Vanilla urweb builds with -Wno-format-security and -U_FORTIFY_SOURCE. +Apparently, upstream added the former to cope with difficulties building on +OS X [1] and the latter to improve performance [2]. + +[1] http://hg.impredicative.com/urweb/rev/3d0cc841cafd +[2] http://hg.impredicative.com/urweb/rev/126d24ef6678 +--- a/src/c/Makefile.am ++++ b/src/c/Makefile.am +@@ -7,7 +7,7 @@ liburweb_fastcgi_la_SOURCES = fastcgi.c + liburweb_static_la_SOURCES = static.c + + AM_CPPFLAGS = -I$(srcdir)/../../include/urweb $(OPENSSL_INCLUDES) +-AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations -U_FORTIFY_SOURCE $(PTHREAD_CFLAGS) ++AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-deprecated-declarations $(PTHREAD_CFLAGS) + liburweb_la_LDFLAGS = $(AM_LDFLAGS) $(OPENSSL_LDFLAGS) + liburweb_la_LIBADD = $(PTHREAD_LIBS) -lm $(OPENSSL_LIBS) + liburweb_http_la_LIBADD = liburweb.la diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..8bedd73d --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,3 @@ +harden.diff +doc-letterpaper.diff +use-system-uthash.diff diff --git a/debian/patches/use-system-uthash.diff b/debian/patches/use-system-uthash.diff new file mode 100644 index 00000000..0ddc4e28 --- /dev/null +++ b/debian/patches/use-system-uthash.diff @@ -0,0 +1,993 @@ +From: Benjamin Barenblat <bbaren@mit.edu> +Subject: Use Debian’s uthash +Forwarded: no + +Remove upstream’s vendored copy of uthash. +--- a/include/urweb/types_cpp.h ++++ b/include/urweb/types_cpp.h +@@ -122,7 +122,7 @@ typedef struct { + // Caching + + #include <pthread.h> +-#include "uthash.h" ++#include <uthash.h> + + typedef struct uw_Sqlcache_Value { + char *result; +--- a/src/c/urweb.c ++++ b/src/c/urweb.c +@@ -22,7 +22,7 @@ + + #include "types.h" + +-#include "uthash.h" ++#include <uthash.h> + + uw_unit uw_unit_v = 0; + +--- a/include/urweb/uthash.h ++++ /dev/null +@@ -1,963 +0,0 @@ +-/* +-Copyright (c) 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/ +-All rights reserved. +- +-Redistribution and use in source and binary forms, with or without +-modification, are permitted provided that the following conditions are met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- +-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-*/ +- +-#ifndef UTHASH_H +-#define UTHASH_H +- +-#include <string.h> /* memcmp,strlen */ +-#include <stddef.h> /* ptrdiff_t */ +-#include <stdlib.h> /* exit() */ +- +-/* These macros use decltype or the earlier __typeof GNU extension. +- As decltype is only available in newer compilers (VS2010 or gcc 4.3+ +- when compiling c++ source) this code uses whatever method is needed +- or, for VS2008 where neither is available, uses casting workarounds. */ +-#if defined(_MSC_VER) /* MS compiler */ +-#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ +-#define DECLTYPE(x) (decltype(x)) +-#else /* VS2008 or older (or VS2010 in C mode) */ +-#define NO_DECLTYPE +-#define DECLTYPE(x) +-#endif +-#elif defined(__BORLANDC__) || defined(__LCC__) || defined(__WATCOMC__) +-#define NO_DECLTYPE +-#define DECLTYPE(x) +-#else /* GNU, Sun and other compilers */ +-#define DECLTYPE(x) (__typeof(x)) +-#endif +- +-#ifdef NO_DECLTYPE +-#define DECLTYPE_ASSIGN(dst,src) \ +-do { \ +- char **_da_dst = (char**)(&(dst)); \ +- *_da_dst = (char*)(src); \ +-} while(0) +-#else +-#define DECLTYPE_ASSIGN(dst,src) \ +-do { \ +- (dst) = DECLTYPE(dst)(src); \ +-} while(0) +-#endif +- +-/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ +-#if defined (_WIN32) +-#if defined(_MSC_VER) && _MSC_VER >= 1600 +-#include <stdint.h> +-#elif defined(__WATCOMC__) +-#include <stdint.h> +-#else +-typedef unsigned int uint32_t; +-typedef unsigned char uint8_t; +-#endif +-#else +-#include <stdint.h> +-#endif +- +-#define UTHASH_VERSION 1.9.9 +- +-#ifndef uthash_fatal +-#define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ +-#endif +-#ifndef uthash_malloc +-#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ +-#endif +-#ifndef uthash_free +-#define uthash_free(ptr,sz) free(ptr) /* free fcn */ +-#endif +- +-#ifndef uthash_noexpand_fyi +-#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ +-#endif +-#ifndef uthash_expand_fyi +-#define uthash_expand_fyi(tbl) /* can be defined to log expands */ +-#endif +- +-/* initial number of buckets */ +-#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ +-#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ +-#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ +- +-/* calculate the element whose hash handle address is hhe */ +-#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) +- +-#define HASH_FIND(hh,head,keyptr,keylen,out) \ +-do { \ +- out=NULL; \ +- if (head != NULL) { \ +- unsigned _hf_bkt,_hf_hashv; \ +- HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \ +- if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv) != 0) { \ +- HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \ +- keyptr,keylen,out); \ +- } \ +- } \ +-} while (0) +- +-#ifdef HASH_BLOOM +-#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) +-#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) +-#define HASH_BLOOM_MAKE(tbl) \ +-do { \ +- (tbl)->bloom_nbits = HASH_BLOOM; \ +- (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ +- if (!((tbl)->bloom_bv)) { uthash_fatal( "out of memory"); } \ +- memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ +- (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ +-} while (0) +- +-#define HASH_BLOOM_FREE(tbl) \ +-do { \ +- uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ +-} while (0) +- +-#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) +-#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) +- +-#define HASH_BLOOM_ADD(tbl,hashv) \ +- HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) +- +-#define HASH_BLOOM_TEST(tbl,hashv) \ +- HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) +- +-#else +-#define HASH_BLOOM_MAKE(tbl) +-#define HASH_BLOOM_FREE(tbl) +-#define HASH_BLOOM_ADD(tbl,hashv) +-#define HASH_BLOOM_TEST(tbl,hashv) (1) +-#define HASH_BLOOM_BYTELEN 0U +-#endif +- +-#define HASH_MAKE_TABLE(hh,head) \ +-do { \ +- (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \ +- sizeof(UT_hash_table)); \ +- if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \ +- memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ +- (head)->hh.tbl->tail = &((head)->hh); \ +- (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ +- (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ +- (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ +- (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ +- HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ +- if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \ +- memset((head)->hh.tbl->buckets, 0, \ +- HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ +- HASH_BLOOM_MAKE((head)->hh.tbl); \ +- (head)->hh.tbl->signature = HASH_SIGNATURE; \ +-} while(0) +- +-#define HASH_ADD(hh,head,fieldname,keylen_in,add) \ +- HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add) +- +-#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ +-do { \ +- replaced=NULL; \ +- HASH_FIND(hh,head,&((add)->fieldname),keylen_in,replaced); \ +- if (replaced!=NULL) { \ +- HASH_DELETE(hh,head,replaced); \ +- } \ +- HASH_ADD(hh,head,fieldname,keylen_in,add); \ +-} while(0) +- +-#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ +-do { \ +- unsigned _ha_bkt; \ +- (add)->hh.next = NULL; \ +- (add)->hh.key = (char*)(keyptr); \ +- (add)->hh.keylen = (unsigned)(keylen_in); \ +- if (!(head)) { \ +- head = (add); \ +- (head)->hh.prev = NULL; \ +- HASH_MAKE_TABLE(hh,head); \ +- } else { \ +- (head)->hh.tbl->tail->next = (add); \ +- (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ +- (head)->hh.tbl->tail = &((add)->hh); \ +- } \ +- (head)->hh.tbl->num_items++; \ +- (add)->hh.tbl = (head)->hh.tbl; \ +- HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \ +- (add)->hh.hashv, _ha_bkt); \ +- HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \ +- HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \ +- HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \ +- HASH_FSCK(hh,head); \ +-} while(0) +- +-#define HASH_TO_BKT( hashv, num_bkts, bkt ) \ +-do { \ +- bkt = ((hashv) & ((num_bkts) - 1U)); \ +-} while(0) +- +-/* delete "delptr" from the hash table. +- * "the usual" patch-up process for the app-order doubly-linked-list. +- * The use of _hd_hh_del below deserves special explanation. +- * These used to be expressed using (delptr) but that led to a bug +- * if someone used the same symbol for the head and deletee, like +- * HASH_DELETE(hh,users,users); +- * We want that to work, but by changing the head (users) below +- * we were forfeiting our ability to further refer to the deletee (users) +- * in the patch-up process. Solution: use scratch space to +- * copy the deletee pointer, then the latter references are via that +- * scratch pointer rather than through the repointed (users) symbol. +- */ +-#define HASH_DELETE(hh,head,delptr) \ +-do { \ +- struct UT_hash_handle *_hd_hh_del; \ +- if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \ +- uthash_free((head)->hh.tbl->buckets, \ +- (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ +- HASH_BLOOM_FREE((head)->hh.tbl); \ +- uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ +- head = NULL; \ +- } else { \ +- unsigned _hd_bkt; \ +- _hd_hh_del = &((delptr)->hh); \ +- if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \ +- (head)->hh.tbl->tail = \ +- (UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ +- (head)->hh.tbl->hho); \ +- } \ +- if ((delptr)->hh.prev != NULL) { \ +- ((UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ +- (head)->hh.tbl->hho))->next = (delptr)->hh.next; \ +- } else { \ +- DECLTYPE_ASSIGN(head,(delptr)->hh.next); \ +- } \ +- if (_hd_hh_del->next != NULL) { \ +- ((UT_hash_handle*)((ptrdiff_t)_hd_hh_del->next + \ +- (head)->hh.tbl->hho))->prev = \ +- _hd_hh_del->prev; \ +- } \ +- HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ +- HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ +- (head)->hh.tbl->num_items--; \ +- } \ +- HASH_FSCK(hh,head); \ +-} while (0) +- +- +-/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ +-#define HASH_FIND_STR(head,findstr,out) \ +- HASH_FIND(hh,head,findstr,(unsigned)strlen(findstr),out) +-#define HASH_ADD_STR(head,strfield,add) \ +- HASH_ADD(hh,head,strfield[0],(unsigned int)strlen(add->strfield),add) +-#define HASH_REPLACE_STR(head,strfield,add,replaced) \ +- HASH_REPLACE(hh,head,strfield[0],(unsigned)strlen(add->strfield),add,replaced) +-#define HASH_FIND_INT(head,findint,out) \ +- HASH_FIND(hh,head,findint,sizeof(int),out) +-#define HASH_ADD_INT(head,intfield,add) \ +- HASH_ADD(hh,head,intfield,sizeof(int),add) +-#define HASH_REPLACE_INT(head,intfield,add,replaced) \ +- HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) +-#define HASH_FIND_PTR(head,findptr,out) \ +- HASH_FIND(hh,head,findptr,sizeof(void *),out) +-#define HASH_ADD_PTR(head,ptrfield,add) \ +- HASH_ADD(hh,head,ptrfield,sizeof(void *),add) +-#define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ +- HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced) +-#define HASH_DEL(head,delptr) \ +- HASH_DELETE(hh,head,delptr) +- +-/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. +- * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. +- */ +-#ifdef HASH_DEBUG +-#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) +-#define HASH_FSCK(hh,head) \ +-do { \ +- struct UT_hash_handle *_thh; \ +- if (head) { \ +- unsigned _bkt_i; \ +- unsigned _count; \ +- char *_prev; \ +- _count = 0; \ +- for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ +- unsigned _bkt_count = 0; \ +- _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ +- _prev = NULL; \ +- while (_thh) { \ +- if (_prev != (char*)(_thh->hh_prev)) { \ +- HASH_OOPS("invalid hh_prev %p, actual %p\n", \ +- _thh->hh_prev, _prev ); \ +- } \ +- _bkt_count++; \ +- _prev = (char*)(_thh); \ +- _thh = _thh->hh_next; \ +- } \ +- _count += _bkt_count; \ +- if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ +- HASH_OOPS("invalid bucket count %u, actual %u\n", \ +- (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ +- } \ +- } \ +- if (_count != (head)->hh.tbl->num_items) { \ +- HASH_OOPS("invalid hh item count %u, actual %u\n", \ +- (head)->hh.tbl->num_items, _count ); \ +- } \ +- /* traverse hh in app order; check next/prev integrity, count */ \ +- _count = 0; \ +- _prev = NULL; \ +- _thh = &(head)->hh; \ +- while (_thh) { \ +- _count++; \ +- if (_prev !=(char*)(_thh->prev)) { \ +- HASH_OOPS("invalid prev %p, actual %p\n", \ +- _thh->prev, _prev ); \ +- } \ +- _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ +- _thh = ( _thh->next ? (UT_hash_handle*)((char*)(_thh->next) + \ +- (head)->hh.tbl->hho) : NULL ); \ +- } \ +- if (_count != (head)->hh.tbl->num_items) { \ +- HASH_OOPS("invalid app item count %u, actual %u\n", \ +- (head)->hh.tbl->num_items, _count ); \ +- } \ +- } \ +-} while (0) +-#else +-#define HASH_FSCK(hh,head) +-#endif +- +-/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to +- * the descriptor to which this macro is defined for tuning the hash function. +- * The app can #include <unistd.h> to get the prototype for write(2). */ +-#ifdef HASH_EMIT_KEYS +-#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ +-do { \ +- unsigned _klen = fieldlen; \ +- write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ +- write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ +-} while (0) +-#else +-#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) +-#endif +- +-/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ +-#ifdef HASH_FUNCTION +-#define HASH_FCN HASH_FUNCTION +-#else +-#define HASH_FCN HASH_JEN +-#endif +- +-/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ +-#define HASH_BER(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned _hb_keylen=(unsigned)keylen; \ +- const unsigned char *_hb_key=(const unsigned char*)(key); \ +- (hashv) = 0; \ +- while (_hb_keylen-- != 0U) { \ +- (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ +- } \ +- bkt = (hashv) & (num_bkts-1U); \ +-} while (0) +- +- +-/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at +- * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ +-#define HASH_SAX(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned _sx_i; \ +- const unsigned char *_hs_key=(const unsigned char*)(key); \ +- hashv = 0; \ +- for(_sx_i=0; _sx_i < keylen; _sx_i++) { \ +- hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ +- } \ +- bkt = hashv & (num_bkts-1U); \ +-} while (0) +-/* FNV-1a variation */ +-#define HASH_FNV(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned _fn_i; \ +- const unsigned char *_hf_key=(const unsigned char*)(key); \ +- hashv = 2166136261U; \ +- for(_fn_i=0; _fn_i < keylen; _fn_i++) { \ +- hashv = hashv ^ _hf_key[_fn_i]; \ +- hashv = hashv * 16777619U; \ +- } \ +- bkt = hashv & (num_bkts-1U); \ +-} while(0) +- +-#define HASH_OAT(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned _ho_i; \ +- const unsigned char *_ho_key=(const unsigned char*)(key); \ +- hashv = 0; \ +- for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ +- hashv += _ho_key[_ho_i]; \ +- hashv += (hashv << 10); \ +- hashv ^= (hashv >> 6); \ +- } \ +- hashv += (hashv << 3); \ +- hashv ^= (hashv >> 11); \ +- hashv += (hashv << 15); \ +- bkt = hashv & (num_bkts-1U); \ +-} while(0) +- +-#define HASH_JEN_MIX(a,b,c) \ +-do { \ +- a -= b; a -= c; a ^= ( c >> 13 ); \ +- b -= c; b -= a; b ^= ( a << 8 ); \ +- c -= a; c -= b; c ^= ( b >> 13 ); \ +- a -= b; a -= c; a ^= ( c >> 12 ); \ +- b -= c; b -= a; b ^= ( a << 16 ); \ +- c -= a; c -= b; c ^= ( b >> 5 ); \ +- a -= b; a -= c; a ^= ( c >> 3 ); \ +- b -= c; b -= a; b ^= ( a << 10 ); \ +- c -= a; c -= b; c ^= ( b >> 15 ); \ +-} while (0) +- +-#define HASH_JEN(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned _hj_i,_hj_j,_hj_k; \ +- unsigned const char *_hj_key=(unsigned const char*)(key); \ +- hashv = 0xfeedbeefu; \ +- _hj_i = _hj_j = 0x9e3779b9u; \ +- _hj_k = (unsigned)(keylen); \ +- while (_hj_k >= 12U) { \ +- _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ +- + ( (unsigned)_hj_key[2] << 16 ) \ +- + ( (unsigned)_hj_key[3] << 24 ) ); \ +- _hj_j += (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 ) \ +- + ( (unsigned)_hj_key[6] << 16 ) \ +- + ( (unsigned)_hj_key[7] << 24 ) ); \ +- hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 ) \ +- + ( (unsigned)_hj_key[10] << 16 ) \ +- + ( (unsigned)_hj_key[11] << 24 ) ); \ +- \ +- HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ +- \ +- _hj_key += 12; \ +- _hj_k -= 12U; \ +- } \ +- hashv += (unsigned)(keylen); \ +- switch ( _hj_k ) { \ +- case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \ +- case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \ +- case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \ +- case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \ +- case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \ +- case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \ +- case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ +- case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \ +- case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \ +- case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \ +- case 1: _hj_i += _hj_key[0]; \ +- } \ +- HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ +- bkt = hashv & (num_bkts-1U); \ +-} while(0) +- +-/* The Paul Hsieh hash function */ +-#undef get16bits +-#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ +- || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) +-#define get16bits(d) (*((const uint16_t *) (d))) +-#endif +- +-#if !defined (get16bits) +-#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ +- +(uint32_t)(((const uint8_t *)(d))[0]) ) +-#endif +-#define HASH_SFH(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- unsigned const char *_sfh_key=(unsigned const char*)(key); \ +- uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ +- \ +- unsigned _sfh_rem = _sfh_len & 3U; \ +- _sfh_len >>= 2; \ +- hashv = 0xcafebabeu; \ +- \ +- /* Main loop */ \ +- for (;_sfh_len > 0U; _sfh_len--) { \ +- hashv += get16bits (_sfh_key); \ +- _sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \ +- hashv = (hashv << 16) ^ _sfh_tmp; \ +- _sfh_key += 2U*sizeof (uint16_t); \ +- hashv += hashv >> 11; \ +- } \ +- \ +- /* Handle end cases */ \ +- switch (_sfh_rem) { \ +- case 3: hashv += get16bits (_sfh_key); \ +- hashv ^= hashv << 16; \ +- hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \ +- hashv += hashv >> 11; \ +- break; \ +- case 2: hashv += get16bits (_sfh_key); \ +- hashv ^= hashv << 11; \ +- hashv += hashv >> 17; \ +- break; \ +- case 1: hashv += *_sfh_key; \ +- hashv ^= hashv << 10; \ +- hashv += hashv >> 1; \ +- } \ +- \ +- /* Force "avalanching" of final 127 bits */ \ +- hashv ^= hashv << 3; \ +- hashv += hashv >> 5; \ +- hashv ^= hashv << 4; \ +- hashv += hashv >> 17; \ +- hashv ^= hashv << 25; \ +- hashv += hashv >> 6; \ +- bkt = hashv & (num_bkts-1U); \ +-} while(0) +- +-#ifdef HASH_USING_NO_STRICT_ALIASING +-/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. +- * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. +- * MurmurHash uses the faster approach only on CPU's where we know it's safe. +- * +- * Note the preprocessor built-in defines can be emitted using: +- * +- * gcc -m64 -dM -E - < /dev/null (on gcc) +- * cc -## a.c (where a.c is a simple test file) (Sun Studio) +- */ +-#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) +-#define MUR_GETBLOCK(p,i) p[i] +-#else /* non intel */ +-#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL) +-#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL) +-#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) +-#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) +-#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) +-#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) +-#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) +-#define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) +-#define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) +-#else /* assume little endian non-intel */ +-#define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) +-#define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) +-#define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) +-#endif +-#define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ +- (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ +- (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ +- MUR_ONE_THREE(p)))) +-#endif +-#define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) +-#define MUR_FMIX(_h) \ +-do { \ +- _h ^= _h >> 16; \ +- _h *= 0x85ebca6bu; \ +- _h ^= _h >> 13; \ +- _h *= 0xc2b2ae35u; \ +- _h ^= _h >> 16; \ +-} while(0) +- +-#define HASH_MUR(key,keylen,num_bkts,hashv,bkt) \ +-do { \ +- const uint8_t *_mur_data = (const uint8_t*)(key); \ +- const int _mur_nblocks = (int)(keylen) / 4; \ +- uint32_t _mur_h1 = 0xf88D5353u; \ +- uint32_t _mur_c1 = 0xcc9e2d51u; \ +- uint32_t _mur_c2 = 0x1b873593u; \ +- uint32_t _mur_k1 = 0; \ +- const uint8_t *_mur_tail; \ +- const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \ +- int _mur_i; \ +- for(_mur_i = -_mur_nblocks; _mur_i!=0; _mur_i++) { \ +- _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ +- _mur_k1 *= _mur_c1; \ +- _mur_k1 = MUR_ROTL32(_mur_k1,15); \ +- _mur_k1 *= _mur_c2; \ +- \ +- _mur_h1 ^= _mur_k1; \ +- _mur_h1 = MUR_ROTL32(_mur_h1,13); \ +- _mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \ +- } \ +- _mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \ +- _mur_k1=0; \ +- switch((keylen) & 3U) { \ +- case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \ +- case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \ +- case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \ +- _mur_k1 *= _mur_c1; \ +- _mur_k1 = MUR_ROTL32(_mur_k1,15); \ +- _mur_k1 *= _mur_c2; \ +- _mur_h1 ^= _mur_k1; \ +- } \ +- _mur_h1 ^= (uint32_t)(keylen); \ +- MUR_FMIX(_mur_h1); \ +- hashv = _mur_h1; \ +- bkt = hashv & (num_bkts-1U); \ +-} while(0) +-#endif /* HASH_USING_NO_STRICT_ALIASING */ +- +-/* key comparison function; return 0 if keys equal */ +-#define HASH_KEYCMP(a,b,len) memcmp(a,b,(unsigned long)(len)) +- +-/* iterate over items in a known bucket to find desired item */ +-#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out) \ +-do { \ +- if (head.hh_head != NULL) { DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head)); } \ +- else { out=NULL; } \ +- while (out != NULL) { \ +- if ((out)->hh.keylen == (keylen_in)) { \ +- if ((HASH_KEYCMP((out)->hh.key,keyptr,keylen_in)) == 0) { break; } \ +- } \ +- if ((out)->hh.hh_next != NULL) { DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,(out)->hh.hh_next)); } \ +- else { out = NULL; } \ +- } \ +-} while(0) +- +-/* add an item to a bucket */ +-#define HASH_ADD_TO_BKT(head,addhh) \ +-do { \ +- head.count++; \ +- (addhh)->hh_next = head.hh_head; \ +- (addhh)->hh_prev = NULL; \ +- if (head.hh_head != NULL) { (head).hh_head->hh_prev = (addhh); } \ +- (head).hh_head=addhh; \ +- if ((head.count >= ((head.expand_mult+1U) * HASH_BKT_CAPACITY_THRESH)) \ +- && ((addhh)->tbl->noexpand != 1U)) { \ +- HASH_EXPAND_BUCKETS((addhh)->tbl); \ +- } \ +-} while(0) +- +-/* remove an item from a given bucket */ +-#define HASH_DEL_IN_BKT(hh,head,hh_del) \ +- (head).count--; \ +- if ((head).hh_head == hh_del) { \ +- (head).hh_head = hh_del->hh_next; \ +- } \ +- if (hh_del->hh_prev) { \ +- hh_del->hh_prev->hh_next = hh_del->hh_next; \ +- } \ +- if (hh_del->hh_next) { \ +- hh_del->hh_next->hh_prev = hh_del->hh_prev; \ +- } +- +-/* Bucket expansion has the effect of doubling the number of buckets +- * and redistributing the items into the new buckets. Ideally the +- * items will distribute more or less evenly into the new buckets +- * (the extent to which this is true is a measure of the quality of +- * the hash function as it applies to the key domain). +- * +- * With the items distributed into more buckets, the chain length +- * (item count) in each bucket is reduced. Thus by expanding buckets +- * the hash keeps a bound on the chain length. This bounded chain +- * length is the essence of how a hash provides constant time lookup. +- * +- * The calculation of tbl->ideal_chain_maxlen below deserves some +- * explanation. First, keep in mind that we're calculating the ideal +- * maximum chain length based on the *new* (doubled) bucket count. +- * In fractions this is just n/b (n=number of items,b=new num buckets). +- * Since the ideal chain length is an integer, we want to calculate +- * ceil(n/b). We don't depend on floating point arithmetic in this +- * hash, so to calculate ceil(n/b) with integers we could write +- * +- * ceil(n/b) = (n/b) + ((n%b)?1:0) +- * +- * and in fact a previous version of this hash did just that. +- * But now we have improved things a bit by recognizing that b is +- * always a power of two. We keep its base 2 log handy (call it lb), +- * so now we can write this with a bit shift and logical AND: +- * +- * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) +- * +- */ +-#define HASH_EXPAND_BUCKETS(tbl) \ +-do { \ +- unsigned _he_bkt; \ +- unsigned _he_bkt_i; \ +- struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ +- UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ +- _he_new_buckets = (UT_hash_bucket*)uthash_malloc( \ +- 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ +- if (!_he_new_buckets) { uthash_fatal( "out of memory"); } \ +- memset(_he_new_buckets, 0, \ +- 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ +- tbl->ideal_chain_maxlen = \ +- (tbl->num_items >> (tbl->log2_num_buckets+1U)) + \ +- (((tbl->num_items & ((tbl->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \ +- tbl->nonideal_items = 0; \ +- for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) \ +- { \ +- _he_thh = tbl->buckets[ _he_bkt_i ].hh_head; \ +- while (_he_thh != NULL) { \ +- _he_hh_nxt = _he_thh->hh_next; \ +- HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*2U, _he_bkt); \ +- _he_newbkt = &(_he_new_buckets[ _he_bkt ]); \ +- if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \ +- tbl->nonideal_items++; \ +- _he_newbkt->expand_mult = _he_newbkt->count / \ +- tbl->ideal_chain_maxlen; \ +- } \ +- _he_thh->hh_prev = NULL; \ +- _he_thh->hh_next = _he_newbkt->hh_head; \ +- if (_he_newbkt->hh_head != NULL) { _he_newbkt->hh_head->hh_prev = \ +- _he_thh; } \ +- _he_newbkt->hh_head = _he_thh; \ +- _he_thh = _he_hh_nxt; \ +- } \ +- } \ +- uthash_free( tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ +- tbl->num_buckets *= 2U; \ +- tbl->log2_num_buckets++; \ +- tbl->buckets = _he_new_buckets; \ +- tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? \ +- (tbl->ineff_expands+1U) : 0U; \ +- if (tbl->ineff_expands > 1U) { \ +- tbl->noexpand=1; \ +- uthash_noexpand_fyi(tbl); \ +- } \ +- uthash_expand_fyi(tbl); \ +-} while(0) +- +- +-/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ +-/* Note that HASH_SORT assumes the hash handle name to be hh. +- * HASH_SRT was added to allow the hash handle name to be passed in. */ +-#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) +-#define HASH_SRT(hh,head,cmpfcn) \ +-do { \ +- unsigned _hs_i; \ +- unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ +- struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ +- if (head != NULL) { \ +- _hs_insize = 1; \ +- _hs_looping = 1; \ +- _hs_list = &((head)->hh); \ +- while (_hs_looping != 0U) { \ +- _hs_p = _hs_list; \ +- _hs_list = NULL; \ +- _hs_tail = NULL; \ +- _hs_nmerges = 0; \ +- while (_hs_p != NULL) { \ +- _hs_nmerges++; \ +- _hs_q = _hs_p; \ +- _hs_psize = 0; \ +- for ( _hs_i = 0; _hs_i < _hs_insize; _hs_i++ ) { \ +- _hs_psize++; \ +- _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ +- ((void*)((char*)(_hs_q->next) + \ +- (head)->hh.tbl->hho)) : NULL); \ +- if (! (_hs_q) ) { break; } \ +- } \ +- _hs_qsize = _hs_insize; \ +- while ((_hs_psize > 0U) || ((_hs_qsize > 0U) && (_hs_q != NULL))) {\ +- if (_hs_psize == 0U) { \ +- _hs_e = _hs_q; \ +- _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ +- ((void*)((char*)(_hs_q->next) + \ +- (head)->hh.tbl->hho)) : NULL); \ +- _hs_qsize--; \ +- } else if ( (_hs_qsize == 0U) || (_hs_q == NULL) ) { \ +- _hs_e = _hs_p; \ +- if (_hs_p != NULL){ \ +- _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ +- ((void*)((char*)(_hs_p->next) + \ +- (head)->hh.tbl->hho)) : NULL); \ +- } \ +- _hs_psize--; \ +- } else if (( \ +- cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \ +- DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \ +- ) <= 0) { \ +- _hs_e = _hs_p; \ +- if (_hs_p != NULL){ \ +- _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ +- ((void*)((char*)(_hs_p->next) + \ +- (head)->hh.tbl->hho)) : NULL); \ +- } \ +- _hs_psize--; \ +- } else { \ +- _hs_e = _hs_q; \ +- _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ +- ((void*)((char*)(_hs_q->next) + \ +- (head)->hh.tbl->hho)) : NULL); \ +- _hs_qsize--; \ +- } \ +- if ( _hs_tail != NULL ) { \ +- _hs_tail->next = ((_hs_e != NULL) ? \ +- ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \ +- } else { \ +- _hs_list = _hs_e; \ +- } \ +- if (_hs_e != NULL) { \ +- _hs_e->prev = ((_hs_tail != NULL) ? \ +- ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \ +- } \ +- _hs_tail = _hs_e; \ +- } \ +- _hs_p = _hs_q; \ +- } \ +- if (_hs_tail != NULL){ \ +- _hs_tail->next = NULL; \ +- } \ +- if ( _hs_nmerges <= 1U ) { \ +- _hs_looping=0; \ +- (head)->hh.tbl->tail = _hs_tail; \ +- DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ +- } \ +- _hs_insize *= 2U; \ +- } \ +- HASH_FSCK(hh,head); \ +- } \ +-} while (0) +- +-/* This function selects items from one hash into another hash. +- * The end result is that the selected items have dual presence +- * in both hashes. There is no copy of the items made; rather +- * they are added into the new hash through a secondary hash +- * hash handle that must be present in the structure. */ +-#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ +-do { \ +- unsigned _src_bkt, _dst_bkt; \ +- void *_last_elt=NULL, *_elt; \ +- UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ +- ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ +- if (src != NULL) { \ +- for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ +- for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ +- _src_hh != NULL; \ +- _src_hh = _src_hh->hh_next) { \ +- _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ +- if (cond(_elt)) { \ +- _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ +- _dst_hh->key = _src_hh->key; \ +- _dst_hh->keylen = _src_hh->keylen; \ +- _dst_hh->hashv = _src_hh->hashv; \ +- _dst_hh->prev = _last_elt; \ +- _dst_hh->next = NULL; \ +- if (_last_elt_hh != NULL) { _last_elt_hh->next = _elt; } \ +- if (dst == NULL) { \ +- DECLTYPE_ASSIGN(dst,_elt); \ +- HASH_MAKE_TABLE(hh_dst,dst); \ +- } else { \ +- _dst_hh->tbl = (dst)->hh_dst.tbl; \ +- } \ +- HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ +- HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt],_dst_hh); \ +- (dst)->hh_dst.tbl->num_items++; \ +- _last_elt = _elt; \ +- _last_elt_hh = _dst_hh; \ +- } \ +- } \ +- } \ +- } \ +- HASH_FSCK(hh_dst,dst); \ +-} while (0) +- +-#define HASH_CLEAR(hh,head) \ +-do { \ +- if (head != NULL) { \ +- uthash_free((head)->hh.tbl->buckets, \ +- (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ +- HASH_BLOOM_FREE((head)->hh.tbl); \ +- uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ +- (head)=NULL; \ +- } \ +-} while(0) +- +-#define HASH_OVERHEAD(hh,head) \ +- ((head != NULL) ? ( \ +- (size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ +- ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ +- sizeof(UT_hash_table) + \ +- (HASH_BLOOM_BYTELEN))) : 0U) +- +-#ifdef NO_DECLTYPE +-#define HASH_ITER(hh,head,el,tmp) \ +-for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \ +- (el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL))) +-#else +-#define HASH_ITER(hh,head,el,tmp) \ +-for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \ +- (el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL))) +-#endif +- +-/* obtain a count of items in the hash */ +-#define HASH_COUNT(head) HASH_CNT(hh,head) +-#define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) +- +-typedef struct UT_hash_bucket { +- struct UT_hash_handle *hh_head; +- unsigned count; +- +- /* expand_mult is normally set to 0. In this situation, the max chain length +- * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If +- * the bucket's chain exceeds this length, bucket expansion is triggered). +- * However, setting expand_mult to a non-zero value delays bucket expansion +- * (that would be triggered by additions to this particular bucket) +- * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. +- * (The multiplier is simply expand_mult+1). The whole idea of this +- * multiplier is to reduce bucket expansions, since they are expensive, in +- * situations where we know that a particular bucket tends to be overused. +- * It is better to let its chain length grow to a longer yet-still-bounded +- * value, than to do an O(n) bucket expansion too often. +- */ +- unsigned expand_mult; +- +-} UT_hash_bucket; +- +-/* random signature used only to find hash tables in external analysis */ +-#define HASH_SIGNATURE 0xa0111fe1u +-#define HASH_BLOOM_SIGNATURE 0xb12220f2u +- +-typedef struct UT_hash_table { +- UT_hash_bucket *buckets; +- unsigned num_buckets, log2_num_buckets; +- unsigned num_items; +- struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ +- ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ +- +- /* in an ideal situation (all buckets used equally), no bucket would have +- * more than ceil(#items/#buckets) items. that's the ideal chain length. */ +- unsigned ideal_chain_maxlen; +- +- /* nonideal_items is the number of items in the hash whose chain position +- * exceeds the ideal chain maxlen. these items pay the penalty for an uneven +- * hash distribution; reaching them in a chain traversal takes >ideal steps */ +- unsigned nonideal_items; +- +- /* ineffective expands occur when a bucket doubling was performed, but +- * afterward, more than half the items in the hash had nonideal chain +- * positions. If this happens on two consecutive expansions we inhibit any +- * further expansion, as it's not helping; this happens when the hash +- * function isn't a good fit for the key domain. When expansion is inhibited +- * the hash will still work, albeit no longer in constant time. */ +- unsigned ineff_expands, noexpand; +- +- uint32_t signature; /* used only to find hash tables in external analysis */ +-#ifdef HASH_BLOOM +- uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ +- uint8_t *bloom_bv; +- uint8_t bloom_nbits; +-#endif +- +-} UT_hash_table; +- +-typedef struct UT_hash_handle { +- struct UT_hash_table *tbl; +- void *prev; /* prev element in app order */ +- void *next; /* next element in app order */ +- struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ +- struct UT_hash_handle *hh_next; /* next hh in bucket order */ +- void *key; /* ptr to enclosing struct's key */ +- unsigned keylen; /* enclosing struct's key len */ +- unsigned hashv; /* result of hash-fcn(key) */ +-} UT_hash_handle; +- +-#endif /* UTHASH_H */ diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..4fa71ed5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,36 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Build for multiarch. +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +# Avoid overlinking and reduce library dependencies. +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +# Harden SML executables. +export MLTONARGS := \ + -cc-opt "$(shell dpkg-buildflags --get CPPFLAGS) \ + $(shell dpkg-buildflags --get CFLAGS)" \ + -link-opt "$(shell dpkg-buildflags --get LDFLAGS)" + +%: + dh $@ --parallel --with autoreconf + +.PHONY: override_dh_auto_configure +override_dh_auto_configure: + LIB=/usr/lib/$(DEB_HOST_MULTIARCH) \ + SRCLIB=/usr/share/urweb dh_auto_configure -- + +.PHONY: override_dh_auto_build-indep +override_dh_auto_build-indep: + cd doc && make manual.pdf + +# Tests require a working urweb binary, so don't run them on +# architecture-independent builds. +.PHONY: override_dh_auto_test-indep +override_dh_auto_test-indep: + : + +.PHONY: override_dh_auto_install-indep +override_dh_auto_install-indep: + DESTDIR=${CURDIR}/debian/tmp make install-exec-emacs diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/urweb-doc.doc-base b/debian/urweb-doc.doc-base new file mode 100644 index 00000000..d4676ed4 --- /dev/null +++ b/debian/urweb-doc.doc-base @@ -0,0 +1,7 @@ +Document: urweb-manual +Title: The Ur/Web Manual +Author: Adam Chlipala +Section: Programming/UrWeb + +Format: PDF +Files: /usr/share/doc/urweb/manual.pdf.gz
\ No newline at end of file diff --git a/debian/urweb-doc.install b/debian/urweb-doc.install new file mode 100644 index 00000000..f6edbb02 --- /dev/null +++ b/debian/urweb-doc.install @@ -0,0 +1 @@ +doc/manual.pdf usr/share/doc/urweb
\ No newline at end of file diff --git a/debian/urweb-mode.emacsen-compat b/debian/urweb-mode.emacsen-compat new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/debian/urweb-mode.emacsen-compat @@ -0,0 +1 @@ +0 diff --git a/debian/urweb-mode.emacsen-install b/debian/urweb-mode.emacsen-install new file mode 100644 index 00000000..edaa9aa1 --- /dev/null +++ b/debian/urweb-mode.emacsen-install @@ -0,0 +1,41 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/install/urweb-mode + +# Written by Jim Van Zandt <jrv@debian.org>, borrowing heavily +# from the install scripts for gettext by Santiago Vila +# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>. + +FLAVOR=$1 +PACKAGE=urweb-mode + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} +ELRELDIR=../../../emacs/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cd ${ELCDIR} +ln -sf ${ELRELDIR}/*.el . + +cat << EOF > path.el +(debian-pkg-add-load-path-item ".") +(setq byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f path.el + +exit 0 diff --git a/debian/urweb-mode.emacsen-remove b/debian/urweb-mode.emacsen-remove new file mode 100644 index 00000000..9135536d --- /dev/null +++ b/debian/urweb-mode.emacsen-remove @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/urweb-mode + +FLAVOR=$1 +PACKAGE=urweb-mode + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/urweb-mode.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff --git a/debian/urweb-mode.emacsen-startup b/debian/urweb-mode.emacsen-startup new file mode 100644 index 00000000..f2e2a24a --- /dev/null +++ b/debian/urweb-mode.emacsen-startup @@ -0,0 +1,18 @@ +;; -*-emacs-lisp-*- +;; The urweb-mode package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name debian-emacs-flavor) + "/site-lisp/urweb-mode"))) +;; If package-dir does not exist, the urweb-mode package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (if (fboundp 'debian-pkg-add-load-path-item) + (debian-pkg-add-load-path-item package-dir) + (setq load-path (cons package-dir load-path))) + ;; urweb-mode maintains its own autoloads file, so just rely on it instead + ;; of creating another set of autoloads. + (load "urweb-mode-startup"))) diff --git a/debian/urweb-mode.install b/debian/urweb-mode.install new file mode 100644 index 00000000..ab5866c8 --- /dev/null +++ b/debian/urweb-mode.install @@ -0,0 +1 @@ +usr/share/emacs/site-lisp/urweb-mode
\ No newline at end of file diff --git a/debian/urweb.1 b/debian/urweb.1 new file mode 100644 index 00000000..6baf4d0b --- /dev/null +++ b/debian/urweb.1 @@ -0,0 +1,428 @@ +.TH urweb 1 "December 20, 2015" +.\" urweb.1 -- man page for urweb + \" Copyright (C) 2013, 2015 Benjamin Barenblat <bbaren@mit.edu> + \" + \" Licensed under the Apache License, Version 2.0 (the "License"); you may not + \" use this file except in compliance with the License. You may obtain a copy + \" of the License at + \" + \" http://www.apache.org/licenses/LICENSE-2.0 + \" + \" Unless required by applicable law or agreed to in writing, software + \" distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + \" WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + \" License for the specific language governing permissions and limitations + \" under the License. +.SH NAME +\fBurweb\fP \- compiler for the Ur/Web programming language +.SH SYNOPSIS +\fBurweb\fP [\fIoption\fP|\fIproject-name\fP]... +.br +\fBurweb daemon\fP [\fBstart\fP|\fBstop\fP] +.SH DESCRIPTION +.PP +This manual page briefly documents the \fBurweb\fP compiler. Extensive +documentation is available in the Ur/Web reference manual. + +\fBurweb\fP is an optimizing compiler for Ur/Web, a functional, pure, statically +typed, strictly evaluated programming language designed for constructing dynamic +Web applications backed by SQL databases. \fBurweb\fP produces very efficient +object code that does not use garbage collection; compiled programs will often +be even more efficient than what most programmers would bother to write in C. + +The first invocation described compiles an Ur/Web project (see +\fBCOMPILATION\fP), while the second invocation controls the type inference +daemon (see \fBTYPE INFERENCE DAEMON\fP). For simple projects, only +familiarity with the first invocation is required. + +.SH COMPILATION +\fBurweb\fP is a whole-program compiler (i.e., incremental compilation is not +supported). Thus, it operates at project granularity, and it is run from the +command line with a collection of options and a project name. The simplest +case is to run \fBurweb foo\fP, where the file \fBfoo.ur\fP contains a valid +Ur/Web program, in which case \fBurweb\fP will compile the program to the file +\fBfoo.exe\fP. (Despite the extension of the generated files, \fBurweb\fP does +not necessarily produce COFF executables; rather, it produces the default +object format of the default C compiler.) + +Larger programs, spanning many files, may be compiled by specifying an +\fB.urp\fP (i.e., an Ur/Web project) file. The syntax of an \fB.urp\fP file is +relatively simple; see section 3.1 of the Ur/Web reference manual for details. + +With no arguments, \fBurweb\fP prints the version number and exits. + +.SH "Compiler options" +.TP +\fB\-ccompiler\fP \fIprogram\fP +Sets the executable name corresponding to the C compiler. \fBurweb\fP uses +\fBgcc\fP by default, but \fBclang\fP should also work. + +.TP +\fB\-db\fP \fIname\fP=\fIvalue\fP,... +Sets database information using the format expected by Postgres's +\fIPQconnectdb\fP. If the database backend is MySQL or SQLite, \fBurweb\fP +will parse the information string to set connection parameters appropriately. +For MySQL, the only relevant parameters are \fIhost\fP, \fIhostaddr\fP, +\fIport\fP, \fIdbname\fP, \fIuser\fP, and \fIpassword\fP; for SQLite, the only +relevant parameter is \fIdbname\fP, which is interpreted as the file system +path to the database file. All unrecognized parameters are silently ignored. + +.TP +\fB\-dbms\fP (\fBpostgres\fP|\fBmysql\fP|\fBsqlite\fP) +Sets the database backend. If requested, \fBurweb\fP will also emit +initialization code for the selected backend; see the \fB\-sql\fP option. + +.TP +\fB\-debug\fP +Instructs \fBurweb\fP to emit the generated C code as \fI/tmp/webapp.c\fP. +Additionally, \fBurweb\fP will print the command-line options it passes to the +C compiler and linker as it executes. + +.TP +\fB\-dumpSource\fP +Instructs \fBurweb\fP to print a text-based form of the current intermediate +representation (IR) when compilation fails. Output will likely be extremely +long and not very human-readable. + +.TP +\fB\-dumpVerboseSource\fP +Instructs \fBurweb\fP to print a text-based form of every intermediate +representation it generates during compilation. Output will likely be extremely +long and not very human-readable. + +.TP +\fB\-dumpTypes\fP +If specified, \fBurweb\fP will print the types of all named values it finds +during compilation. + +.TP +\fB\-dumpTypesOnError\fP +Identical to \fB\-dumpTypes\fP, but only prints the types if compilation +fails. + +.TP +\fB\-explainEmbed\fP +Enables verbose error messages when \fBurweb\fP is unable to embed server-side +values in client-side code. + +.TP +\fB\-limit \fIclass\fP \fInum\fP +Sets a resource usage limit for generated applications. The limit \fIclass\fP +will be set to the non-negative integer \fInum\fP. The classes are: + +.RS +.IP \fBcleanup\fP +maximum number of cleanup operations (e.g., entries recording the need to +deallocate certain temporary objects) that may be active at once per request + +.IP \fBclients\fP +maximum number of clients that can be simultaneously blocked waiting for new +messages (sent by \fIBasis.send\fP) + +.IP \fBdatabase\fP +maximum size of database file (currently only used by SQLite), in units of +database pages + +.IP \fBdeltas\fP +maximum number of messages sendable in a single request handler with +\fIBasis.send\fP + +.IP \fBglobals\fP +maximum number of global variables that FFI libraries may set in a single +request context + +.IP \fBheaders\fP +maximum size (in bytes) of per-request buffer used to hold HTTP headers for +generated pages + +.IP \fBheap\fP +maximum size (in bytes) of per-request heap for dynamically allocated data + +.IP \fBinputs\fP +maximum number of top-level form fields per request + +.IP \fBmessages\fP +maximum size (in bytes) of per-request buffer used to hold a single outgoing +message sent with \fIBasis.send\fP + +.IP \fBpage\fP +maximum size (in bytes) of per-request buffer used to hold HTML content of +generated pages + +.IP \fBscript\fP +maximum size (in bytes) of per-request buffer used to hold JavaScript content +of generated pages + +.IP \fBsubinputs\fP +maximum number of form fields per request, excluding top-level fields + +.IP \fBtime\fP +maximum running time of a single page request, in units of approximately 0.1 +seconds + +.IP \fBtransactionals\fP +maximum number of custom transactional actions (e.g., sending an e-mail) that +may be run in a single page generation +.RE + +.TP +\fB\-output\fP \fIfilename\fP +Sets where \fBurweb\fP will store the compiled executable. + +.TP +\fB\-path\fP \fIname\fP \fIvalue\fP +Defines a new path alias for use in \fB.urp\fP files. In particular, this +option specifies that all occurrences of $\fIname\fP in any \fB.urp\fP files +processed will be replaced with \fIvalue\fP. You may specify this option more +than once. + +.TP +\fB\-prefix\fP \fIprefix\fP +Sets the application prefix. This controls how Ur/Web functions are bound to +URIs; in particular, if \fIprefix\fP is \fI/directory/myapp.exe/\fP, then URIs +of the form \fI//example.com/directory/myapp.exe/Module/function\fP will +resolve to the function \fIModule.function\fP in Ur/Web. + +.TP +\fB\-protocol\fP (\fBhttp\fP|\fBcgi\fP|\fBfastcgi\fP|\fBstatic\fP) +Instructs \fBurweb\fP to produce an executable which speaks the specified +protocol: + +.RS +.IP \fBhttp\fP +HTTP 1.1. \fBurweb\fP will generate a standalone server executable. + +.IP \fBcgi\fP +The Common Gateway Interface, the classic protocol that Web servers use to +generate dynamic content by spawning new processes. While Ur/Web programs may +in general use message-passing with the \fIsend\fP and \fIrecv\fP functions, +that functionality is not yet supported in CGI, since CGI needs a fresh process +for each request, and message-passing needs to use persistent sockets to +deliver messages. + +Since Ur/Web treats paths in an unusual way, you will need to configure Ur/Web +specially by setting the \fBprefix\fP directive in your \fB.urp\fP file or +passing the \fB\-prefix\fP option on the command line. For example, if you +deploy a Web application at \fI//example.com/directory/myapp.exe\fP, you +should specify \fI/directory/myapp.exe/\fP as the application prefix. See +section 3.2 of the Ur/Web reference manual for more information. + +.IP \fBfastcgi\fP +The faster, newer protocol inspired by CGI, wherein Web servers can start and +reuse persistent external processes to generate dynamic content. Ur/Web +doesn't implement the whole protocol, but Ur/Web's support has been tested to +work with both Apache and lighttpd. + +Applications which use message-passing, while supported, require special +configuration. In particular, if you're using Apache, be sure to specify a +large \fBidle-timout\fP; if you're using lighttpd, be sure to set +\fBmax-procs\fP to 1. The rationale for these configuration changes is +detailed in section 3.2 of the Ur/Web reference manual. + +.IP \fBstatic\fP +The simplest possible protocol. \fBurweb\fP will generate an output executable +which expects a single command-line argument giving the URI of a page to +generate. For instance, this argument might be \fI/main\fP, in which case a +static HTTP response for that page will be written to standard output. +.RE + +.TP +\fB\-root\fP \fIName\fP \fIpath\fP +Triggers an alternate module convention for all source files found in directory +\fIpath\fP or any of its subdirectories. In particular, any file +\fIpath\fP/foo.ur will define a module called \fIName.Foo\fP instead of the +usual \fIFoo\fP. Any file \fIpath\fP/subdir/foo.ur will define a module called +\fIName.Subdir.Foo\fP, and so on for arbitrary nesting of subdirectories. You +may specify this option more than once. + +.TP +\fB\-sigfile\fP \fIpath\fP +If specified, the compiled application will look at \fIpath\fP for a key to use +in cryptographic signing. This is used to prevent cross-site request forgery +attacks for any form handler that both reads a cookie and creates side effects. +If the referenced file doesn't exist, the application will create it and read +its saved data on future invocations. You can also initialize the file +manually with any contents at least 16 bytes long; the first 16 bytes will be +treated as the key. + + +.TP +\fB\-sql\fP \fIfile\fP +Requests that \fBurweb\fP generate database initialization code for the +selected database backend, storing it in \fIfile\fP. If \fIfile\fP already +exists, \fBurweb\fP will overwrite it. + +Note that the generated instructions will not create the application database; +you must do that yourself. + +.TP +\fB\-static\fP +Instructs \fBurweb\fP to statically link the generated executable. + +.TP +\fB\-timing\fP +If specified, \fBurweb\fP will print a timing report at the end of compilation +showing the number of seconds required for each stage of the compilation +process. + +.TP +\fB\-unifyMore\fP +Instructs \fBurweb\fP's type inference engine to make best-effort guesses +rather than immediately failing when performing type inference. If +\fB\-dumpTypes\fP shows unresolved unification variables in positions where you +would like to see \fBurweb\fP make best-guesses effort instead, specify this +option. + +Correct programs compiled with \fB\-unifyMore\fP will be identical to their +counterparts compiled without it; however, \fBurweb\fP will likely generate +many more (and potentially more useful) error messages at a time when asked to +compile an incorrect program with this flag. + +.TP +\fB\-verbose\fP +Instructs \fBurweb\fP to announce the stages of the compilation process as it +performs them. + +.SH "Options which inhibit compilation" +When run with any of these options, \fBurweb\fP will not produce executable +output. + +.TP +\fB\-css\fP +Dumps generated CSS properties and classes. The first output line is a list of +categories of CSS properties that would be worth setting on the document body. +The remaining lines are space-separated pairs of CSS class names and categories +of properties that would be worth setting for that class. The category codes +are divided into two varieties. Codes that reveal properties of a tag or its +(recursive) children are + +.RS +.IP \fBB\fP +for block-level elements, +.IP \fBC\fP +for table captions, +.IP \fBD\fP +for table cells, +.IP \fBL\fP +for lists, and +.IP \fBT\fP +for tables. +.RE + +.RS +Codes that reveal properties of the precise tag that uses a class are + +.IP \fBb\fP +for block-level elements, +.IP \fBt\fP +for tables, +.IP \fBd\fP +for table cells, +.IP \fB\-\fP +for table rows, +.IP \fBH\fP +for the possibility to set a height, +.IP \fBN\fP +for non-replaced inline-level elements, +.IP \fBR\fP +for replaced inline elements, and +.IP \fBW\fP +for the possibility to set a width. +.RE +.RE + +.TP +\fB\-moduleOf\fP \fIfile\fP +Prints the Ur module name corresponding to the source file \fIfile\fP. + +.TP +\fB\-numeric\-version\fP +Prints the version of the compiler executable without any associated English +text. Suitable for use in scripts. + +.TP +\fB\-print\-ccompiler\fP +Prints the executable name of the compiler that \fBurweb\fP will use. + +.TP +\fB\-print\-cinclude\fP +Prints the file system location in which \fBurweb\fP will look for C headers. + +.TP +\fB\-tc\fP +If specified, \fBurweb\fP will stop after the typechecking phase. Liberal use +of this option can substantially speed development, as \fBurweb\fP's +optimization passes can take quite a while. + +.TP +\fB\-version\fP +Prints the version of the compiler executable. Output is identical to +\fBurweb\fP output when run without arguments. + +.SH "Documentation options" +These options customize Ur/Web's documentation generator. + +.TP +\fB\-demo\fP +Performs demo-style formatting. + +.TP +\fB\-guided\-demo\fP +Performs demo-style formatting, but sizes frames to allocate less space to +explanatory text. Useful for generating presentations. + +.TP +\fB\-noEmacs\fP +When used with \fB\-demo\fP, causes \fBurweb\fP to \fInot\fP use Emacs to +syntax-highlight code. The resulting code will not be highlighted. + +.TP +\fB\-tutorial\fP +Performs tutorial-style formatting. + +.SH "Internal options" +These options are not meant for users; they are used to build \fBurweb\fP +releases and to debug the compiler. + +.TP +\fB\-boot\fP +Places \fBurweb\fP into bootstrap mode. Used when building the standard +library for the first time. + +\fB\-stop\fP \fIphase\fP +Causes \fBurweb\fP to exit after the specified phase of compilation. + +.SH "TYPE INFERENCE DAEMON" +Since Ur/Web type inference can take a significant amount of time, it can be +helpful to cache type-inferred versions of source files. This mode can be +activated by running + +.RS +\fBurweb daemon start\fP +.RE + +Further urweb invocations in the same working directory will send requests to a +background daemon process that reuses type inference results whenever possible, +tracking source file dependencies and modification times. + +To stop the background daemon, run + +.RS +\fBurweb daemon stop\fP +.RE + +Communication happens via a Unix domain socket in file .urweb_daemon in the +working directory. + +.SH BUGS +\fBurweb\fP is a product of research; while it is intended to be usable for +real work, it may occasionally fail to produce optimal results. If you believe +you've found a bug (e.g., the compiler throws an unhandled exception), contact +the Ur/Web mailing list, \fIur@impredicative.com\fP. + +.SH COPYRIGHT +\fBurweb\fP is copyright \(co 2008-2015 Adam Chlipala and licensed under the +3-clause BSD license <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>. + +This manual page is copyright \(co 2013, 2015 Benjamin Barenblat and licensed +under the Apache License, Version 2.0. diff --git a/debian/urweb.install b/debian/urweb.install new file mode 100644 index 00000000..b10315fd --- /dev/null +++ b/debian/urweb.install @@ -0,0 +1,5 @@ +usr/bin/urweb +usr/include/urweb +usr/lib/*/*.a +usr/lib/*/*.so +usr/share/urweb diff --git a/debian/urweb.links b/debian/urweb.links new file mode 100644 index 00000000..ef515f25 --- /dev/null +++ b/debian/urweb.links @@ -0,0 +1 @@ +usr/include/uthash.h usr/include/urweb/uthash.h diff --git a/debian/urweb.manpages b/debian/urweb.manpages new file mode 100644 index 00000000..03631e59 --- /dev/null +++ b/debian/urweb.manpages @@ -0,0 +1 @@ +debian/urweb.1 diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..70157dab --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts=dversionmangle=s/\+dfsg-\d+$// \ + http://impredicative.com/ur/main.html urweb-(.+).tgz |