summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-01-30 00:57:53 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-30 00:57:53 (UTC)
commit71f4cc84c3788c6904ede17cd626a9ca9c349e3b (patch) (side-by-side diff)
treecfe7736ae3416ad314b7451b756e587335c357c7
parentacd2a536dd6bb3ef9438482725f77ac9044ae79b (diff)
downloadsitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.zip
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.gz
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.bz2
initial commit into repository
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore15
-rw-r--r--AUTHORS3
-rw-r--r--COPYING19
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am35
-rw-r--r--NEWS.xml6
-rw-r--r--NEWS.xsl24
-rw-r--r--README0
-rw-r--r--acinclude.m437
-rwxr-xr-xautogen.sh8
-rw-r--r--bin/.gitignore2
-rwxr-xr-xbin/build.in2
-rwxr-xr-xbin/run.in2
-rw-r--r--conf/.gitignore6
-rw-r--r--conf/dudki.conf.in5
-rw-r--r--conf/httpd.conf.in29
-rw-r--r--conf/sitecing.conf.in25
-rw-r--r--configure.ac166
-rw-r--r--htdocs/.htaccess2
-rw-r--r--htdocs/ancestry/.htaccess1
-rw-r--r--htdocs/ancestry/layout.chtml35
-rw-r--r--htdocs/ancestry/page.chtml28
-rw-r--r--htdocs/ancestry/sources.chtml75
-rw-r--r--htdocs/exceptions/compile.chtml50
-rw-r--r--htdocs/exceptions/development/.htaccess3
-rw-r--r--htdocs/exceptions/development/.scrc2
-rw-r--r--htdocs/exceptions/development/compile.chtml12
-rw-r--r--htdocs/exceptions/development/compile.html248
-rw-r--r--htdocs/exceptions/development/erroneous.h1
-rw-r--r--htdocs/exceptions/development/preprocess.chtml14
-rw-r--r--htdocs/exceptions/development/runtime.chtml16
-rw-r--r--htdocs/exceptions/index.chtml52
-rw-r--r--htdocs/exceptions/preprocess.chtml46
-rw-r--r--htdocs/exceptions/production/.htaccess3
-rw-r--r--htdocs/exceptions/production/.scrc2
-rw-r--r--htdocs/exceptions/production/compile.chtml12
-rw-r--r--htdocs/exceptions/production/compile.html44
-rw-r--r--htdocs/exceptions/production/erroneous.h1
-rw-r--r--htdocs/exceptions/production/preprocess.chtml14
-rw-r--r--htdocs/exceptions/production/runtime.chtml16
-rw-r--r--htdocs/exceptions/runtime.chtml47
-rw-r--r--htdocs/handlers/.htaccess1
-rw-r--r--htdocs/handlers/exception_dev346
-rw-r--r--htdocs/handlers/exception_prod52
-rw-r--r--htdocs/index.chtml46
-rw-r--r--htdocs/sources.chtml47
-rw-r--r--htdocs/style.css168
-rw-r--r--htdocs/view.chtml54
-rw-r--r--include/.gitignore3
49 files changed, 1825 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c57e5fe
--- a/dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+configure
+Makefile.in
+config.log
+config.status
+aux
+cache
+autom4te.cache
+INSTALL
+config.sitecing
+NEWS
+aclocal.m4
+Makefile
+fastcgi-bin
+logs
+run
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..a9fb0c7
--- a/dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Klever dissected:
+ Michael 'hacker' Krelin <hacker@klever.net>
+ Leonid Ivanov <kamel@klever.net>
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..7c61600
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
+Copyright (c) 2005 Klever Group (http://www.klever.net/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..cf1fe6d
--- a/dev/null
+++ b/Makefile.am
@@ -0,0 +1,35 @@
+EXTRA_DIST = \
+ $(addprefix htdocs/,.htaccess index.chtml sources.chtml style.css view.chtml) \
+ $(addprefix htdocs/ancestry/,.htaccess layout.chtml page.chtml sources.chtml) \
+ $(addprefix htdocs/exceptions/,index.chtml preprocess.chtml compile.chtml runtime.chtml) \
+ $(addprefix htdocs/exceptions/development/,.htaccess .scrc compile.chtml compile.html preprocess.chtml runtime.chtml erroneous.h) \
+ $(addprefix htdocs/exceptions/production/,.htaccess .scrc compile.chtml compile.html preprocess.chtml runtime.chtml erroneous.h) \
+ $(addprefix htdocs/handlers/,.htaccess exception_dev exception_prod) \
+ autogen.sh \
+ NEWS NEWS.xml NEWS.xsl
+
+DISTCHECK_CONFIGURE_FLAGS=--enable-distcheck
+
+all-local: NEWS sitecode restart restart-apache
+distclean-local:
+ rm -rf config.sitecing \
+ logs fastcgi-bin run cache
+
+NEWS: NEWS.xsl NEWS.xml
+ ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml
+
+sitecode: conf/sitecing.conf include/acconfig.h
+ ${SHELL} bin/build
+restart: conf/sitecing.conf conf/dudki.conf
+if !DISTCHECKING
+if HAVE_DUDKI
+ sudo ${SHELL} -c "@DUDKI@ -k @dudki_id@ ; sleep 3 ; @DUDKI@ -r"
+else
+ kill `cat run/sitecing.pid` ; sleep 3 ; ${SHELL} bin/run
+endif
+endif !DISTCHECKING
+
+restart-apache: conf/httpd.conf
+if !DISTCHECKING
+ @APACHE_RESTART_CMD@
+endif !DISTCHECKING
diff --git a/NEWS.xml b/NEWS.xml
new file mode 100644
index 0000000..d1d89f6
--- a/dev/null
+++ b/NEWS.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<news>
+ <version version="0.0" date="January 29th, 2005">
+ <ni>Initial release</ni>
+ </version>
+</news>
diff --git a/NEWS.xsl b/NEWS.xsl
new file mode 100644
index 0000000..7c71307
--- a/dev/null
+++ b/NEWS.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+ <xsl:output
+ method="text"
+ encoding="us-ascii"
+ media-type="text/plain" />
+
+ <xsl:template match="news">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="version">
+ <xsl:value-of select="concat(@version,' (',@date,')&#xA;')"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="ni">
+ <xsl:text> - </xsl:text>
+ <xsl:apply-templates mode="text"/>
+ <xsl:text>&#xA;</xsl:text>
+ </xsl:template>
+ <xsl:template match="*|text()"/>
+
+</xsl:stylesheet>
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/README
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..e16972c
--- a/dev/null
+++ b/acinclude.m4
@@ -0,0 +1,37 @@
+dnl SC_BUILD_CONF(FILE-NAME,DIRECTIVE,CONTENTS)
+AC_DEFUN([SC_BUILD_CONF],[
+ echo -n "$2" >>"$1"
+ oc=0
+ for o in $3 ; do
+ oc=`expr ${oc} + 1`
+ if test ${oc} -ge 16 ; then
+ (echo ; echo -n "$2") >>"$1"
+ oc=0;
+ fi
+ echo -n " ${o}" >>"$1"
+ done
+ echo >>"$1"
+])
+
+dnl SC_WEB_ROOT(V_SRC,V_RUN)
+AC_DEFUN([SC_WEB_ROOT],[
+ $2="${PWD}"
+ X="${PWD}"
+ cd ${srcdir}
+ $1="${PWD}"
+ cd "${X}"
+ AC_SUBST([$1])
+ AC_SUBST([$2])
+])
+
+dnl SC_USER(VARIABLE[,DEFAULT])
+AC_DEFUN([SC_USER],[
+ $1=ifelse([$2], , ["${USER}"],[$2])
+ AC_ARG_WITH([sitecing-user],
+ AC_HELP_STRING([--with-sitecing-user=user],[set the owner of sitecing process]),
+ [
+ $1="${withval}"
+ ]
+ )
+ AC_SUBST([$1])
+])
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..bfd0e8f
--- a/dev/null
+++ b/autogen.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+WANT_AUTOMAKE=1.8
+export WANT_AUTOMAKE
+aclocal \
+&& autoheader \
+&& automake -a \
+&& autoconf \
+&& ./configure "$@"
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 0000000..266ca8d
--- a/dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+build
+run
diff --git a/bin/build.in b/bin/build.in
new file mode 100755
index 0000000..4ef803c
--- a/dev/null
+++ b/bin/build.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+@sitecing_build@ -f @web_run_root@/conf/sitecing.conf /
diff --git a/bin/run.in b/bin/run.in
new file mode 100755
index 0000000..db88640
--- a/dev/null
+++ b/bin/run.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec @sitecing_fastcgi@ -f @web_run_root@/conf/sitecing.conf
diff --git a/conf/.gitignore b/conf/.gitignore
new file mode 100644
index 0000000..af40a7f
--- a/dev/null
+++ b/conf/.gitignore
@@ -0,0 +1,6 @@
+dudki.conf
+httpd.conf
+banner_top
+sitecing.conf
+banner_bottom
+banner_side
diff --git a/conf/dudki.conf.in b/conf/dudki.conf.in
new file mode 100644
index 0000000..df34f8d
--- a/dev/null
+++ b/conf/dudki.conf.in
@@ -0,0 +1,5 @@
+<Process @dudki_id@>
+ PidFile @web_run_root@/run/sitecing.pid
+ RestartCommand "exec sh @web_run_root@/bin/run"
+ User @sitecing_user@
+</Process>
diff --git a/conf/httpd.conf.in b/conf/httpd.conf.in
new file mode 100644
index 0000000..5910620
--- a/dev/null
+++ b/conf/httpd.conf.in
@@ -0,0 +1,29 @@
+FastCgiExternalServer @web_run_root@/fastcgi-bin/site-c-ing -socket @web_run_root@/run/sitecing-socket
+<VirtualHost *:80>
+ ServerName @v_hostname@
+ DocumentRoot @web_src_root@/htdocs
+ <Directory @web_src_root@/htdocs>
+ AllowOverride All
+ allow from all
+ </Directory>
+ <DirectoryMatch /.svn/>
+ deny from all
+ </DirectoryMatch>
+ <Files .*>
+ deny from all
+ </Files>
+ <Files Makefile*>
+ deny from all
+ </Files>
+ CustomLog @web_run_root@/logs/access.log combined
+ ErrorLog @web_run_root@/logs/error.log
+ LogLevel error
+ Alias /fastcgi-bin/ @web_run_root@/fastcgi-bin/
+ <Directory @web_run_root@/fastcgi-bin/>
+ allow from all
+ </Directory>
+ DefaultLanguage en
+ Action site-c-ing /fastcgi-bin/site-c-ing
+ AddHandler site-c-ing .chtml
+ DirectoryIndex index
+</VirtualHost>
diff --git a/conf/sitecing.conf.in b/conf/sitecing.conf.in
new file mode 100644
index 0000000..67d3cd5
--- a/dev/null
+++ b/conf/sitecing.conf.in
@@ -0,0 +1,25 @@
+MultiProcess on
+ListenSocket @web_run_root@/run/sitecing-socket
+MinChildren 2
+MinSpareChildren 2
+MaxChildren 4
+MaxSpareChildren 4
+RequestsPerChild 64
+PidFile @web_run_root@/run/sitecing.pid
+Daemonize on
+
+RootSource @web_src_root@/htdocs/
+RootIntermediate @web_run_root@/cache/sitecing/intermediate/
+RootSO @web_run_root@/cache/sitecing/so/
+
+@config_sitecing@
+
+CPPFLAGS -I. -I@web_run_root@/include/
+
+ExceptionHandler @exception_handler@
+
+Build @build_on_demand@
+CPPDeps on
+IntermediateDeps @sitecing_prefix@/share/sitecing/component.skel
+
+AutoBuildFiles *.chtml
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..dc1beb3
--- a/dev/null
+++ b/configure.ac
@@ -0,0 +1,166 @@
+AC_INIT([sitecing-showcase], [0.0], [sitecing-bugs@klever.net])
+AC_CONFIG_SRCDIR([htdocs/index.chtml])
+AC_CONFIG_AUX_DIR([aux])
+AC_CONFIG_HEADER([include/acconfig.h])
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+AC_PATH_PROG([XSLTPROC],[xsltproc],[true])
+
+PKG_CHECK_MODULES([SITECING],[sitecing],,[
+ AC_MSG_ERROR([site-C-ing not found. get it at http://kin.klever.net/sitecing/])
+])
+sitecing_prefix="$(${PKG_CONFIG} --variable=prefix sitecing)"
+sitecing_bindir="$(${PKG_CONFIG} --variable=bindir sitecing)"
+AC_MSG_CHECKING([for sitecing-fastcgi binary])
+sitecing_fastcgi="${sitecing_bindir}/sitecing-fastcgi"
+if test -x "${sitecing_fastcgi}" ; then
+ AC_MSG_RESULT([found ${sitecing_fastcgi}])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([broken site-C-ing install detected])
+fi
+AC_MSG_CHECKING([for sitecing-build binary])
+sitecing_build="${sitecing_bindir}/sitecing-build"
+if test -x "${sitecing_build}" ; then
+ AC_MSG_RESULT([found ${sitecing_build}])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([broken site-C-ing install detected])
+fi
+AC_SUBST([sitecing_prefix])
+AC_SUBST([sitecing_bindir])
+AC_SUBST([sitecing_fastcgi])
+AC_SUBST([sitecing_build])
+
+config_sitecing="config.sitecing"
+rm -f "${config_sitecing}"
+SC_BUILD_CONF([${config_sitecing}],[CPPFLAGS],[${SITECING_CFLAGS}])
+SC_BUILD_CONF([${config_sitecing}],[LDFLAGS],[${SITECING_LIBS}])
+AC_SUBST_FILE([config_sitecing])
+
+SC_WEB_ROOT([web_src_root],[web_run_root])
+SC_USER([sitecing_user])
+
+AC_DEFINE_UNQUOTED([WEB_ROOT],["${web_src_root}"],[the site root])
+AC_DEFINE_UNQUOTED([WEB_SRC_ROOT],["${web_src_root}"],[the site root])
+AC_DEFINE_UNQUOTED([WEB_RUN_ROOT],["${web_run_root}"],[the site root])
+
+v_hostname="$(hostname)"
+AC_MSG_CHECKING([for virtual host name])
+AC_ARG_WITH([vhostname],
+ AC_HELP_STRING([--with-vhostname=virtual-host-name],[set the apache ServerName of VirtualHost]),
+ [
+ v_hostname="${withval}"
+ ]
+)
+AC_MSG_RESULT([${v_hostname}])
+AC_SUBST([v_hostname])
+
+HAVE_DUDKI="false"
+WANT_DUDKI="true"
+AC_ARG_ENABLE([dudki],
+ AC_HELP_STRING([--disable-dudki],[disable the use of dudki! to restart daemon]),
+ [
+ test "${enableval}" = "no" && WANT_DUDKI="false"
+ ]
+)
+if ${WANT_DUDKI} ; then
+ AC_PATH_PROG([DUDKI],[dudki],[false],[${PATH}:/usr/local/sbin:/usr/sbin])
+ test "${DUDKI}" = "false" || HAVE_DUDKI="true"
+fi
+AM_CONDITIONAL([HAVE_DUDKI],[${HAVE_DUDKI}])
+
+dudki_id=sitecing-showcase
+AC_ARG_WITH([dudki-id],
+ AC_HELP_STRING([--with-dudki-id],[specify dudki process id]),
+ [
+ dudki_id="${withval}"
+ ]
+)
+AC_SUBST([dudki_id])
+
+APACHE_RESTART_CMD="false"
+AC_ARG_WITH([apache-restart-cmd],
+ AC_HELP_STRING([--with-apache-restart-cmd=command],[use the specified command to restart apache]),
+ [
+ test "${withval}" = "no" || APACHE_RESTART_CMD="${withval}"
+ ]
+)
+if test "${APACHE_RESTART_CMD}" = "false" ; then
+ AC_PATH_PROG([APACHECTL],[apachectl],[false],[${PATH}:/usr/sbin:/usr/local/sbin])
+ if test "${APACHECTL}" != "false" ; then
+ APACHE_RESTART_CMD="sudo ${APACHECTL} graceful"
+ else
+ AC_PATH_PROG([APACHE2CTL],[apache2ctl],[false],[${PATH}:/usr/sbin:/usr/local/sbin])
+ if test "${APACHE2CTL}" != "false" ; then
+ APACHE_RESTART_CMD="sudo ${APACHE2CTL} graceful"
+ else
+ for i_s in /etc/init.d/apache /etc/init.d/apache2 ; do
+ AC_MSG_CHECKING([for ${i_s}])
+ if test -x ${i_s} ; then
+ AC_MSG_RESULT([found])
+ APACHE_RESTART_CMD="sudo ${i_s} restart"
+ break
+ fi
+ AC_MSG_RESULT([not found])
+ done
+ fi
+ fi
+fi
+if test "${APACHE_RESTART_CMD}" = "false" ; then
+ AC_MSG_NOTICE([couldn't figure out how to restart apache. use --with-apache-restart-cmd])
+fi
+AC_SUBST([APACHE_RESTART_CMD])
+
+
+AC_MSG_CHECKING([if we are in the development environment])
+do_devel="false"
+AC_ARG_ENABLE([development],
+ AC_HELP_STRING([--enable-development],[enable build for development environment]),
+ [
+ if test "${enableval}" = "yes" ; then
+ do_devel="true"
+ fi
+ ]
+)
+build_on_demand="off"
+exception_handler="/handlers/exception_prod"
+if ${do_devel} ; then
+ AC_MSG_RESULT([yes])
+ build_on_demand="on"
+ exception_handler="/handlers/exception_dev"
+ AC_DEFINE([_DEVELOPMENT],,[define if development environment])
+else
+ AC_MSG_RESULT([no])
+fi
+AC_SUBST([build_on_demand])
+AC_SUBST([exception_handler])
+
+DISTCHECKING="false"
+AC_ARG_ENABLE([distcheck],,[
+ DISTCHECKING="true"
+])
+AM_CONDITIONAL([DISTCHECKING],[${DISTCHECKING}])
+
+AC_CONFIG_FILES([
+ Makefile
+ conf/httpd.conf conf/sitecing.conf conf/dudki.conf
+ bin/run bin/build
+])
+AC_CONFIG_COMMANDS([logs/stamp],[touch logs/stamp])
+AC_CONFIG_COMMANDS([fastcgi-bin/stamp],[touch fastcgi-bin/stamp])
+AC_CONFIG_COMMANDS([run/stamp],[touch run/stamp])
+AC_OUTPUT
+
+echo
+echo ===
+echo "virtual host name:" "${v_hostname}"
+echo "project src root: " "${web_src_root}"
+echo "project run root: " "${web_run_root}"
+echo "sitecing user: " "${sitecing_user}"
+echo "dudki id: " "${dudki_id}"
+echo "development: " "${do_devel}"
+echo "site-C-ing prefix:" "${sitecing_prefix}"
+echo ===
+echo
+dnl vim:set ft=m4:
diff --git a/htdocs/.htaccess b/htdocs/.htaccess
new file mode 100644
index 0000000..1165068
--- a/dev/null
+++ b/htdocs/.htaccess
@@ -0,0 +1,2 @@
+Options MultiViews
+AddType text/html .chtml
diff --git a/htdocs/ancestry/.htaccess b/htdocs/ancestry/.htaccess
new file mode 100644
index 0000000..8d2f256
--- a/dev/null
+++ b/htdocs/ancestry/.htaccess
@@ -0,0 +1 @@
+deny from all
diff --git a/htdocs/ancestry/layout.chtml b/htdocs/ancestry/layout.chtml
new file mode 100644
index 0000000..11bd74a
--- a/dev/null
+++ b/htdocs/ancestry/layout.chtml
@@ -0,0 +1,35 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive page = "/ancestry/page.chtml";
+%%impl #include "acconfig.h"
+<%method void body() %>
+ <div id="content">
+ <%code>
+ if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) {
+ pass_file_through(WEB_RUN_ROOT "/conf/banner_top");
+ }
+ content();
+ if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) {
+ pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom");
+ }
+ </%code>
+ </div>
+ <div id="sidepanel">
+% sidepanel();
+ </div>
+</%method>
+<%method void content() %>
+</%method>
+<%method void sidepanel() %>
+ <h1><% PACKAGE_STRING %></h1>
+% /* thank MSIE for this awful formatting */
+ <ul><li><a href="/" title="introduction to site-C-ing">intro</a></li><li><a href="/exceptions/" title="exceptions handling">exceptions</a><ul><li><a href="/exceptions/preprocess" title="preprocessor errors">preprocess</a></li><li><a href="/exceptions/compile" title="compiler errors">compile-time</a></li><li><a href="/exceptions/runtime" title="runtime exceptions">runtime</a></li></ul></li><li><a href="/sources" title="browse this site source files">sources</a></li></ul>
+ <%code>
+ if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) {
+ pass_file_through(WEB_RUN_ROOT "/conf/banner_side");
+ }
+ </%code>
+ <ul><li><a href="http://kin.klever.net/sitecing/" title="main site-C-ing page">site-C-ing</a></li><li><a href="http://kin.klever.net/sitecing/sources" title="site-C-ing download page">downloads</a></li></ul>
+ <div class="copyright">
+ &copy; <a href="http://www.klever.net/">Klever Group</a>
+ </div>
+</%method>
diff --git a/htdocs/ancestry/page.chtml b/htdocs/ancestry/page.chtml
new file mode 100644
index 0000000..28bf7f0
--- a/dev/null
+++ b/htdocs/ancestry/page.chtml
@@ -0,0 +1,28 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%var bool b_strict = true;
+<%decl>
+ using std::string;
+</%decl>
+<%method void html() %>
+% if(b_strict){
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+% }else{
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+% }
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+% __SCIF->headers["Content-Type"] = "text/html";
+ <title><% title() %></title>
+ <meta name="copyright" content="Copyright (c) 1996-2005 Klever Group"/>
+ <link rel="stylesheet" href="/style.css" type="text/css" />
+ </head>
+ <body>
+% body();
+ </body>
+ </html>
+</%method>
+<%codemethod string title() %>
+ return "untitled";
+</%codemethod>
+<%method void body() %>
+</%method>
diff --git a/htdocs/ancestry/sources.chtml b/htdocs/ancestry/sources.chtml
new file mode 100644
index 0000000..eb9c790
--- a/dev/null
+++ b/htdocs/ancestry/sources.chtml
@@ -0,0 +1,75 @@
+<%decl>
+ typedef struct {
+ const char *dir;
+ const char *name;
+ const char *desc;
+ } sourcefile_t;
+ extern sourcefile_t source_files[];
+ extern int source_files_count;
+</%decl>
+<%impl>
+ sourcefile_t source_files[] = {
+ { "", 0, "the root" },
+ { "", "configure.ac", "main configuration file" },
+ { "", "acinclude.m4", "autoconf macros" },
+ { "", "autogen.sh", "shell script for building out of source repository" },
+ { "", "Makefile.am", "automake makefile template" },
+ { "", "NEWS.xml", "news since the last release (if any)" },
+ { "", "NEWS.xsl", "the styleshhet to make a plaintext version of NEWS.xml" },
+ { "", "COPYING", "copyright notice" },
+ { "", "AUTHORS", "Klever dissected" },
+ { 0, 0, 0 },
+ { "bin", 0, "various scripts" },
+ { "bin", "build.in", "the template of the script used to precompile the code" },
+ { "bin", "run.in", "the template of the script used to start fastcgi server" },
+ { 0, 0, 0 },
+ { "conf", 0, "configuration files" },
+ { "conf", "dudki.conf.in", "the template for the dudki daemon configuration file" },
+ { "conf", "httpd.conf.in", "the template for the apache configuration" },
+ { "conf", "sitecing.conf.in", "the template for the site-C-ing configuration" },
+ { 0, 0, 0 },
+ { "htdocs", 0, "the source files" },
+ { "htdocs", ".htaccess", "apache access-control file" },
+ { "htdocs", "index.chtml", "the introduction" },
+ { "htdocs", "sources.chtml", "the source browser" },
+ { "htdocs", "style.css", "the CSS style sheet" },
+ { "htdocs", "view.chtml", "the source viewer" },
+ { "htdocs/exceptions", 0, "exceptions handling overview" },
+ { "htdocs/exceptions", "index.chtml", "the overview" },
+ { "htdocs/exceptions", "preprocess.chtml", "preprocessor exceptions" },
+ { "htdocs/exceptions", "compile.chtml", "compile-time exceptions" },
+ { "htdocs/exceptions", "runtime.chtml", "runtime exceptions" },
+ { "htdocs/exceptions/development", 0, "development-mode exceptions samples" },
+ { "htdocs/exceptions/development", ".htaccess", "apache access control file" },
+ { "htdocs/exceptions/development", ".scrc", "site-C-ing local configuration" },
+ { "htdocs/exceptions/development", "preprocess.chtml", "the file that can not be preprocessed" },
+ { "htdocs/exceptions/development", "runtime.chtml", "exception thrown at runtime" },
+ { "htdocs/exceptions/development", "compile.chtml", "the file that can not be compiled" },
+ { "htdocs/exceptions/development", "erroneous.h", "the file to include for more errors" },
+ { "htdocs/exceptions/development", "compile.html", "compile-time exception handler output" },
+ { 0,0,0 },
+ { "htdocs/exceptions/production", 0, "production-mode exceptions samples" },
+ { "htdocs/exceptions/production", ".htaccess", "apache access control file" },
+ { "htdocs/exceptions/production", ".scrc", "site-C-ing local configuration" },
+ { "htdocs/exceptions/production", "preprocess.chtml", "the file that can not be preprocessed" },
+ { "htdocs/exceptions/production", "runtime.chtml", "exception thrown at runtime" },
+ { "htdocs/exceptions/production", "compile.chtml", "the file that can not be compiled" },
+ { "htdocs/exceptions/production", "erroneous.h", "the file to include for more errors" },
+ { "htdocs/exceptions/production", "compile.html", "compile-time exception handler output" },
+ { 0,0,0 },
+ { 0,0,0 },
+ { "htdocs/handlers", 0, "exception handlers" },
+ { "htdocs/handlers", ".htaccess", "apache access-control file" },
+ { "htdocs/handlers", "exception_dev", "development mode exception handler" },
+ { "htdocs/handlers", "exception_prod", "production mode exception handler" },
+ { 0,0,0 },
+ { "htdocs/ancestry", 0, "base components to build the rest upon" },
+ { "htdocs/ancestry", ".htaccess", "apache access control file" },
+ { "htdocs/ancestry", "page.chtml", "the xhtml skeleton" },
+ { "htdocs/ancestry", "layout.chtml", "the layout for the most pages" },
+ { "htdocs/ancestry", "sources.chtml", "the list of files for source browser" },
+ { 0,0,0 },
+ { 0,0,0 }
+ };
+ int source_files_count = sizeof(source_files)/sizeof(*source_files);
+</%impl>
diff --git a/htdocs/exceptions/compile.chtml b/htdocs/exceptions/compile.chtml
new file mode 100644
index 0000000..90ee7d8
--- a/dev/null
+++ b/htdocs/exceptions/compile.chtml
@@ -0,0 +1,50 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+<%constructor>
+ b_strict = false;
+</%constructor>
+<%codemethod string title() %>
+ return "compile-time exceptions handling";
+</%codemethod>
+<%method void content() %>
+ <h1>site-C-ing compile-time exception handling</h1>
+ <p>
+ Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
+ there is a wide range of errors you may put into your code which will pass
+ through preprocessor and will be caught later at the compile-time.
+ </p>
+ <p>
+ Once you complete writing your <a
+ href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
+ title="the link opens in the frame below">erroneous code</a> and
+ <em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
+ code into c++ compiler which will refuse to compile the code like this. This
+ is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
+ title="the link opens in the frame below">the exception handler</a>,
+ specified in <a href="/view/htdocs/exceptions/development/.scrc"
+ target="insert" title="the link opens in the frame below">the configuration
+ file</a>, takes over the process and gives you <a
+ href="/exceptions/development/compile" target="insert" title="the link opens
+ in the frame below">the report</a>. Like with any handler, you may wish to
+ set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
+ title="the link opens in the frame below">different handler</a> in your <a
+ href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
+ link opens in the frame below">production configuration</a>, which just gives
+ user <a href="/exceptions/production/preprocess" target="insert" title="the
+ link opens in the frame below">a friendly yet lame excuse</a>.
+ </p>
+ <p class="note">
+ Note, that these output pages are fakes -- I do not want to spawn the
+ compiler each time you want to see the output and put this unnecessary load
+ on cpu. These static pages are in fact saved output of the real exception
+ handlers.
+ </p>
+
+ <div class="insert">
+ <iframe id="insert" name="insert" src="about:blank" width="95%" height="300" border="1">
+ <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
+ support it. That is okay, it still will open links somehow.</p>
+ </iframe>
+ </div>
+
+</%method>
diff --git a/htdocs/exceptions/development/.htaccess b/htdocs/exceptions/development/.htaccess
new file mode 100644
index 0000000..01cb5ec
--- a/dev/null
+++ b/htdocs/exceptions/development/.htaccess
@@ -0,0 +1,3 @@
+<Files compile.chtml>
+ deny from all
+</Files>
diff --git a/htdocs/exceptions/development/.scrc b/htdocs/exceptions/development/.scrc
new file mode 100644
index 0000000..da24ef7
--- a/dev/null
+++ b/htdocs/exceptions/development/.scrc
@@ -0,0 +1,2 @@
+ExceptionHandler /handlers/exception_dev
+AutoBuildFiles -*
diff --git a/htdocs/exceptions/development/compile.chtml b/htdocs/exceptions/development/compile.chtml
new file mode 100644
index 0000000..3611ca9
--- a/dev/null
+++ b/htdocs/exceptions/development/compile.chtml
@@ -0,0 +1,12 @@
+<html>
+ <head>
+ <title>I'm gonna make a number of mistakes!</title>
+ </head>
+ <body>
+% ind a = 2;
+% #include "erroneous.h"
+% unsigned int a = -1;
+% int j = k;
+ </body>
+</html>
+% /* vim:set ft=sitecing: */
diff --git a/htdocs/exceptions/development/compile.html b/htdocs/exceptions/development/compile.html
new file mode 100644
index 0000000..c3384a2
--- a/dev/null
+++ b/htdocs/exceptions/development/compile.html
@@ -0,0 +1,248 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title>failed to compile component</title>
+ <style type="text/css">
+ <!--
+ body {
+ font-family: sans-serif;
+ font-size: 11pt;
+ }
+
+ h1 {
+ font-family: serif;
+ font-size: 130%;
+ font-weight: bold;
+ text-align: center;
+ }
+ p {
+ text-indent: 2em;
+ text-align: justify;
+ }
+
+ dl.exception-props {
+ margin: 1ex 1em;
+ padding: 0.5ex;
+ border: solid 1px gray;
+ background-color: #e0e0e0;
+ }
+ dl.exception-props dt {
+ font-weight: bold;
+ color: blue;
+ }
+ dl.exception-props dd {
+ color: gray;
+ }
+
+ div.exception-codepoint-report {
+ border: solid 1px black;
+ margin: 0.5ex 1em 0.ex 3em;
+ }
+ div.exception-codepoint-report h3 {
+ display: block;
+ color: blue;
+ border-bottom: 3px double black;
+ padding: 0.3ex; margin: 0px;
+ background: #e0e0e0;
+ }
+ div.exception-codepoint-report ul {
+ padding: 0px;
+ margin: 0px;
+ background: #87fdff;
+ font-size: 70%;
+ }
+ div.exception-codepoint-report li {
+ font-family: monospace;
+ list-style-type: none;
+ white-space: pre;
+ overflow: hidden;
+ }
+ div.exception-codepoint-report li.focused {
+ color: red;
+ border-top: solid 1px red; border-bottom: solid 1px red;
+ }
+ div.exception-codepoint-report li .lineno {
+ padding-right: 0.5ex;
+ border-right: dotted black 1px;
+ }
+ div.exception-codepoint-report div.what {
+ border-top: double 3px black;
+ padding: 0.5ex 2em;
+ font-weight: bold; color: #4040c0;
+ overflow: auto;
+ }
+ div.backtrace div.exception-codepoint-report div.what {
+ color: gray;
+ }
+
+ div.exception-compile div.what {
+ font-weight: normal;
+ color: red;
+ }
+
+ div.powered {
+ margin: 2em 0px 0px 50%;
+ padding: 1ex 2ex;
+ text-align: right;
+ font-family: serif;
+ font-size: 140%;
+ font-weight: bold;
+ border-top: solid 2px black;
+ border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
+ background: #c0c0f0;
+ }
+ -->
+ </style>
+ </head>
+ <body>
+
+ <div class="exception-compile">
+ <h1>error compiling component '<code>exceptions/development/compile.chtml</code>'</h1>
+
+ <div class="exception-codepoint-report">
+ <h3>exceptions/development/compile.chtml</h3>
+ <ul>
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&lt;html&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
+
+ <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
+ </ul>
+ <div class="what">
+ exceptions/development/compile.chtml: In member function `virtual void _SCC_exceptions_development_compile_chtml::main(int, char*)':<br/>
+exceptions/development/compile.chtml:6: error: `ind' undeclared (first use this function)<br/>
+exceptions/development/compile.chtml:6: error: (Each undeclared identifier is reported only once for each function it appears in.)<br/>
+exceptions/development/compile.chtml:6: error: expected `;' before "a"
+ </div>
+ </div>
+
+ <div class="exception-codepoint-report">
+ <h3>exceptions/development/compile.chtml</h3>
+ <ul>
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
+
+ <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
+ </ul>
+ <div class="what">
+ In file included from exceptions/development/compile.chtml:7:
+ </div>
+ </div>
+
+ <div class="exception-codepoint-report">
+ <h3>exceptions/development/erroneous.h</h3>
+ <ul>
+ <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&nbsp;a+2=5;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line"></span></li>
+ </ul>
+ <div class="what">
+ ./erroneous.h:1: error: `a' undeclared (first use this function)
+ </div>
+ </div>
+
+ <div class="exception-codepoint-report">
+ <h3>exceptions/development/compile.chtml</h3>
+ <ul>
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;<span class="line">&nbsp;&nbsp;&lt;title&gt;I'm&nbsp;gonna&nbsp;make&nbsp;a&nbsp;number&nbsp;of&nbsp;mistakes!&lt;/title&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
+
+ <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
+ </ul>
+ <div class="what">
+ exceptions/development/compile.chtml:8: warning: converting of negative value `-0x000000001' to `unsigned int'
+ </div>
+ </div>
+
+ <div class="exception-codepoint-report">
+ <h3>exceptions/development/compile.chtml</h3>
+ <ul>
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;<span class="line">%&nbsp;&nbsp;ind&nbsp;a&nbsp;=&nbsp;2;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;8</span>&nbsp;<span class="line">%&nbsp;&nbsp;unsigned&nbsp;int&nbsp;a&nbsp;=&nbsp;-1;</span></li>
+
+ <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;9</span>&nbsp;<span class="line">%&nbsp;&nbsp;int&nbsp;j&nbsp;=&nbsp;k;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;12</span>&nbsp;<span class="line">%&nbsp;/*&nbsp;vim:set&nbsp;ft=sitecing:&nbsp;*/</span></li>
+
+ <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
+ </ul>
+ <div class="what">
+ exceptions/development/compile.chtml:9: error: `k' undeclared (first use this function)<br/>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
+ </body>
+</html>
+
+
+
+
+
+
+
diff --git a/htdocs/exceptions/development/erroneous.h b/htdocs/exceptions/development/erroneous.h
new file mode 100644
index 0000000..060a57e
--- a/dev/null
+++ b/htdocs/exceptions/development/erroneous.h
@@ -0,0 +1 @@
+ a+2=5;
diff --git a/htdocs/exceptions/development/preprocess.chtml b/htdocs/exceptions/development/preprocess.chtml
new file mode 100644
index 0000000..f7405e7
--- a/dev/null
+++ b/htdocs/exceptions/development/preprocess.chtml
@@ -0,0 +1,14 @@
+<html>
+ <body>
+ <p>
+ I was writing this component in a hurry, having a lot of things to distract
+ me, so no wonder I made mistake.
+ <%code>
+ /* I do not even remember what I was going to put in this code block. And
+ * of course I didn't mean to forget that this is just a block of code, not
+ * a constructor...
+ */
+ </%constructor>
+ </p>
+ </body>
+</html>
diff --git a/htdocs/exceptions/development/runtime.chtml b/htdocs/exceptions/development/runtime.chtml
new file mode 100644
index 0000000..4a494bd
--- a/dev/null
+++ b/htdocs/exceptions/development/runtime.chtml
@@ -0,0 +1,16 @@
+%%decl #include <konforka/exception.h>
+<%code>
+ try{
+ try{
+ try{
+ throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+</%code>
diff --git a/htdocs/exceptions/index.chtml b/htdocs/exceptions/index.chtml
new file mode 100644
index 0000000..cc0ed8a
--- a/dev/null
+++ b/htdocs/exceptions/index.chtml
@@ -0,0 +1,52 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+<%codemethod string title() %>
+ return "exceptions handling";
+</%codemethod>
+<%method void content() %>
+ <h1>site-C-ing exception handling</h1>
+ <p>
+ The purpose of this section is to give an overview of the <em>site-C-ing</em>
+ exception handling mechanism. Before the web visitor can see the page each
+ site-C-ing component goes through a few stages, namely, preprocessing,
+ compiling and execution. Having three stages to go through also means the
+ stages one can fail to go through and three exciting opportunities to handle
+ different errors.
+ </p>
+ <p>
+ First each component is preprocessed so that you can feed the valid c++ code
+ to the compiler. Here is where the preprocessor can choke at your broken
+ source code. Once preprocessor failes to parse your code it will throw an
+ exception which <em>site-C-ing</em> will catch and pass to <a
+ href="/sources/htdocs/handlers/exception_dev" title="development mode
+ exception handler source">the exception handler component</a>. Want to <a
+ href="/exceptions/preprocess">read more</a> about preprocessor exception
+ handling?
+ </p>
+ <p>
+ After the preprocessing stage is over we have a great opportunity to catch
+ the compile-time errors. After <em>site-C-ing</em> fails to compile the
+ component it throws another exception and passes it to the same handler which
+ may show you some information on what's gone wrong with your source code from
+ the compiler's perspective. If you've gone this far you definitely want to <a
+ href="/exceptions/compile">read more</a> about the compiler error handling.
+ </p>
+ <p class="note">
+ Note, that it is likely that you will want to disable the steps above for the
+ production environment to save time on unnecessary checking whether the
+ component is up to date.
+ </p>
+ <p>
+ Finally, we need to execute the component and present its output to the web
+ site visitor. This is also where things may go wrong and here is where your
+ component may throw an exception for the engine to catch and pass to the
+ handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
+ as well.
+ </p>
+ <p class="note">
+ One more thing you will likely want to have differently in production
+ environment is <a href="/sources/htdocs/handlers/exception_prod"
+ title="production mode exception handler source">an exception handler</a>
+ which will not give out that much unnecessary information to the user.
+ </p>
+</%method>
diff --git a/htdocs/exceptions/preprocess.chtml b/htdocs/exceptions/preprocess.chtml
new file mode 100644
index 0000000..8516139
--- a/dev/null
+++ b/htdocs/exceptions/preprocess.chtml
@@ -0,0 +1,46 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+<%constructor>
+ b_strict = false;
+</%constructor>
+<%codemethod string title() %>
+ return "preprocessor exceptions handling";
+</%codemethod>
+<%method void content() %>
+ <h1>site-C-ing preprocessor exception handling</h1>
+ <p>
+ It was one of those days when you just can't type right and can't think of
+ what you're typing. It is not unusual that, under such circumstances, you end
+ up with a code like <a
+ href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
+ title="the link opens in the frame below">this</a> -- by the time you were
+ about to close your <code>&lt;%code&gt;</code> block you were thinking about
+ some constructor in some component elsewhere in the universe.
+ </p>
+ <p>
+ <em>site-C-ing</em> parser will see the inconsistency and throw an exception
+ which will be caught and passed to <a
+ href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
+ opens in the frame below">the handler</a>, specified in <a
+ href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
+ link opens in the frame below">the configuration file</a>, which will produce
+ some nice, human-readable <a href="/exceptions/development/preprocess"
+ target="insert" title="the link opens in the frame below">output</a>. Well,
+ you may not wish to give out all this information in the production
+ environment, so you just put in your <a
+ href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
+ link opens in the frame below">configuration file</a> some <a
+ href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
+ opens in the frame below">different handler</a>, which just gives user <a
+ href="/exceptions/production/preprocess" target="insert" title="the link
+ opens in the frame below">a friendly yet lame excuse</a>.
+ </p>
+
+ <div class="insert">
+ <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
+ <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
+ support it. That is okay, it still will open links somehow.</p>
+ </iframe>
+ </div>
+
+</%method>
diff --git a/htdocs/exceptions/production/.htaccess b/htdocs/exceptions/production/.htaccess
new file mode 100644
index 0000000..01cb5ec
--- a/dev/null
+++ b/htdocs/exceptions/production/.htaccess
@@ -0,0 +1,3 @@
+<Files compile.chtml>
+ deny from all
+</Files>
diff --git a/htdocs/exceptions/production/.scrc b/htdocs/exceptions/production/.scrc
new file mode 100644
index 0000000..d97eeb4
--- a/dev/null
+++ b/htdocs/exceptions/production/.scrc
@@ -0,0 +1,2 @@
+ExceptionHandler /handlers/exception_prod
+AutoBuildFiles -*
diff --git a/htdocs/exceptions/production/compile.chtml b/htdocs/exceptions/production/compile.chtml
new file mode 100644
index 0000000..3611ca9
--- a/dev/null
+++ b/htdocs/exceptions/production/compile.chtml
@@ -0,0 +1,12 @@
+<html>
+ <head>
+ <title>I'm gonna make a number of mistakes!</title>
+ </head>
+ <body>
+% ind a = 2;
+% #include "erroneous.h"
+% unsigned int a = -1;
+% int j = k;
+ </body>
+</html>
+% /* vim:set ft=sitecing: */
diff --git a/htdocs/exceptions/production/compile.html b/htdocs/exceptions/production/compile.html
new file mode 100644
index 0000000..faa0ab9
--- a/dev/null
+++ b/htdocs/exceptions/production/compile.html
@@ -0,0 +1,44 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title>Server-side exception</title>
+ <style type="text/css">
+ <!--
+ body {
+ font-family: sans-serif;
+ font-size: 12pt;
+ }
+ h1 {
+ font-family: serif;
+ font-size: 130%;
+ font-weight: bold;
+ text-align: center;
+ }
+ p {
+ text-indent: 2em;
+ text-align: justify;
+ }
+
+ div.powered {
+ margin: 2em 0px 0px 50%;
+ padding: 1ex 2ex;
+ text-align: right;
+ font-family: serif;
+ font-size: 140%;
+ font-weight: bold;
+ border-top: solid 2px black;
+ border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
+ background: #c0c0f0;
+ }
+ -->
+ </style>
+ </head>
+ <body>
+ <h1>server-side exception</h1>
+ <p>Something has gone really wrong with the server. Feel free to report the
+ incident to <a href="mailto:root@localhost" title="e-mail
+ server administrator">webmaster</a>.</p>
+ <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
+ </body>
+</html>
diff --git a/htdocs/exceptions/production/erroneous.h b/htdocs/exceptions/production/erroneous.h
new file mode 100644
index 0000000..060a57e
--- a/dev/null
+++ b/htdocs/exceptions/production/erroneous.h
@@ -0,0 +1 @@
+ a+2=5;
diff --git a/htdocs/exceptions/production/preprocess.chtml b/htdocs/exceptions/production/preprocess.chtml
new file mode 100644
index 0000000..f7405e7
--- a/dev/null
+++ b/htdocs/exceptions/production/preprocess.chtml
@@ -0,0 +1,14 @@
+<html>
+ <body>
+ <p>
+ I was writing this component in a hurry, having a lot of things to distract
+ me, so no wonder I made mistake.
+ <%code>
+ /* I do not even remember what I was going to put in this code block. And
+ * of course I didn't mean to forget that this is just a block of code, not
+ * a constructor...
+ */
+ </%constructor>
+ </p>
+ </body>
+</html>
diff --git a/htdocs/exceptions/production/runtime.chtml b/htdocs/exceptions/production/runtime.chtml
new file mode 100644
index 0000000..4a494bd
--- a/dev/null
+++ b/htdocs/exceptions/production/runtime.chtml
@@ -0,0 +1,16 @@
+%%decl #include <konforka/exception.h>
+<%code>
+ try{
+ try{
+ try{
+ throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+ }catch(konforka::exception& ke){
+ ke.see(CODEPOINT); throw;
+ }
+</%code>
diff --git a/htdocs/exceptions/runtime.chtml b/htdocs/exceptions/runtime.chtml
new file mode 100644
index 0000000..d0a8e14
--- a/dev/null
+++ b/htdocs/exceptions/runtime.chtml
@@ -0,0 +1,47 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+<%constructor>
+ b_strict = false;
+</%constructor>
+<%codemethod string title() %>
+ return "runtime exceptions handling";
+</%codemethod>
+<%method void content() %>
+ <h1>site-C-ing runtime exception handling</h1>
+ <p>
+ The component may throw an exception while executing and the
+ <em>site-C-ing</em> will gladly pass it to the handler component which will
+ give the user appropriate output (unless it throws an exception itself, of
+ course). Here you will see an example output provided by the handler bundled
+ with the <em>site-C-ing</em>.
+ </p>
+
+ <p>
+ Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
+ target="insert" title="the link opens in the frame below">a component</a>,
+ which at some point throws an exception. Of course, <em>site-C-ing</em> will
+ catch the exception and pass it to <a
+ href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
+ opens in the frame below">the handler</a>, specified in <a
+ href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
+ link opens in the frame below">the configuration file</a>, which will produce
+ some nice, human-readable <a href="/exceptions/development/runtime"
+ target="insert" title="the link opens in the frame below">output</a>. Well,
+ you may not wish to give out all this information in the production
+ environment, so you just put in your <a
+ href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
+ link opens in the frame below">configuration file</a> some <a
+ href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
+ opens in the frame below">different handler</a>, which just gives user <a
+ href="/exceptions/production/runtime" target="insert" title="the link opens
+ in the frame below">a friendly yet lame excuse</a>.
+ </p>
+
+ <div class="insert">
+ <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
+ <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
+ support it. That is okay, it still will open links somehow.</p>
+ </iframe>
+ </div>
+
+</%method>
diff --git a/htdocs/handlers/.htaccess b/htdocs/handlers/.htaccess
new file mode 100644
index 0000000..8d2f256
--- a/dev/null
+++ b/htdocs/handlers/.htaccess
@@ -0,0 +1 @@
+deny from all
diff --git a/htdocs/handlers/exception_dev b/htdocs/handlers/exception_dev
new file mode 100644
index 0000000..d8c84e1
--- a/dev/null
+++ b/htdocs/handlers/exception_dev
@@ -0,0 +1,346 @@
+%%decl using namespace std;
+<%impl>
+ #include <iostream>
+ #include <fstream>
+ #include <sstream>
+ #include <cassert>
+ #include <cstdarg>
+ #include <stdexcept>
+ #include <cxxabi.h>
+ #include <sitecing/sitecing_util.h>
+ #include <sitecing/util.h>
+ #include <sitecing/magic.h>
+ #include <konforka/exception.h>
+</%impl>
+%%var string message;
+%%var string root_source;
+%%var string root_intermediate;
+%%var string root_so;
+%%var string component;
+%%var int line_number = -1;
+%%var const exception* exception_caught;
+<%code>
+ __SCIF->headers.clear();
+ __SCIF->out->seekp(0);
+ int magic = _magic;
+ va_list va = _args;
+ switch(magic) {
+ case sitecing::__magic_compile_error:
+ message = va_arg(va,const char*);
+ root_source = va_arg(va,const char*);
+ root_intermediate = va_arg(va,const char*);
+ root_so = va_arg(va,const char*);
+ component = va_arg(va,const char*);
+ break;
+ case sitecing::__magic_preprocess_error:
+ message = va_arg(va,const char*);
+ root_source = va_arg(va,const char*);
+ root_intermediate = va_arg(va,const char*);
+ root_so = va_arg(va,const char*);
+ component = va_arg(va,const char*);
+ line_number = va_arg(va,int);
+ break;
+ case sitecing::__magic_generic_exception:
+ message = va_arg(va,const char*);
+ root_source = va_arg(va,const char*);
+ root_intermediate = va_arg(va,const char *);
+ root_so = va_arg(va,const char *);
+ component = va_arg(va,const char*);
+ exception_caught = va_arg(va,const exception*);
+ break;
+ default:
+ break;
+ }
+</%code>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title><% message %></title>
+ <style type="text/css">
+ <!--
+ body {
+ font-family: sans-serif;
+ font-size: 11pt;
+ }
+
+ h1 {
+ font-family: serif;
+ font-size: 130%;
+ font-weight: bold;
+ text-align: center;
+ }
+ p {
+ text-indent: 2em;
+ text-align: justify;
+ }
+
+ dl.exception-props {
+ margin: 1ex 1em;
+ padding: 0.5ex;
+ border: solid 1px gray;
+ background-color: #e0e0e0;
+ }
+ dl.exception-props dt {
+ font-weight: bold;
+ color: blue;
+ }
+ dl.exception-props dd {
+ color: gray;
+ }
+
+ div.exception-codepoint-report {
+ border: solid 1px black;
+ margin: 0.5ex 1em 0.ex 3em;
+ }
+ div.exception-codepoint-report h3 {
+ display: block;
+ color: blue;
+ border-bottom: 3px double black;
+ padding: 0.3ex; margin: 0px;
+ background: #e0e0e0;
+ }
+ div.exception-codepoint-report ul {
+ padding: 0px;
+ margin: 0px;
+ background: #87fdff;
+ font-size: 70%;
+ }
+ div.exception-codepoint-report li {
+ font-family: monospace;
+ list-style-type: none;
+ white-space: nowrap;
+ overflow: hidden;
+ }
+ div.exception-codepoint-report li.focused {
+ color: red;
+ border-top: solid 1px red; border-bottom: solid 1px red;
+ }
+ div.exception-codepoint-report li .lineno {
+ padding-right: 0.5ex;
+ border-right: dotted black 1px;
+ }
+ div.exception-codepoint-report div.what {
+ border-top: double 3px black;
+ padding: 0.5ex 2em;
+ font-weight: bold; color: #4040c0;
+ overflow: auto;
+ }
+ div.backtrace div.exception-codepoint-report div.what {
+ color: gray;
+ }
+
+ div.exception-compile div.what {
+ font-weight: normal;
+ color: red;
+ }
+
+ div.powered {
+ margin: 2em 0px 0px 50%;
+ padding: 1ex 2ex;
+ text-align: right;
+ font-family: serif;
+ font-size: 140%;
+ font-weight: bold;
+ border-top: solid 2px black;
+ border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
+ background: #c0c0f0;
+ }
+ -->
+ </style>
+% __SCIF->headers["Content-Type"]="text/html; charset=utf-8";
+% __SCIF->headers["Pragma"]="no-cache";
+ </head>
+ <body>
+ <%code>
+ switch(magic) {
+ case sitecing::__magic_compile_error:
+ handle_compile_error();
+ break;
+ case sitecing::__magic_preprocess_error:
+ handle_preprocess_error();
+ break;
+ case sitecing::__magic_generic_exception:
+ handle_generic_exception();
+ break;
+ default:
+ handle_unknown_error();
+ break;
+ }
+ </%code>
+ <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
+ </body>
+</html>
+<%method void handle_generic_exception() %>
+ <div class="exception-generic">
+ <h1>exception caught while running component '<code><% component %></code>'</h1>
+ <dl class="exception-props">
+ <dt><code>typeid(<em>e</em>).name()</code></dt>
+% int destat;
+% char *demangled = abi::__cxa_demangle(typeid(*exception_caught).name(),NULL,NULL,&destat);
+ <dd><code><% destat?typeid(*exception_caught).name():demangled %></code></dd>
+% if(!destat) free(demangled);
+ <dt><code><em>e</em>.what()</code></dt>
+ <dd><% message %></dd>
+% if(typeid(*exception_caught)==typeid(konforka::exception&)) {
+% konforka::exception* ke = (konforka::exception*)exception_caught;
+ <dt><code><em>e</em>.where()</code></dt>
+ <dd><code>
+% if(ke->_where.line<0) {
+ <% ke->where() %>
+% }else{
+ <% strip_roots(ke->_where.file) %>:<% ke->_where.line %> [<% ke->_where.function %>]
+% }
+ </code></dd>
+% }
+ </dl>
+% if(typeid(*exception_caught)==typeid(konforka::exception&)) {
+% konforka::exception* ke = (konforka::exception*)exception_caught;
+% if(ke->_where.line>=0) {
+% report_error(ke->_where.file,ke->_where.line,ke->what());
+% }
+% if(!ke->_seen.empty()) {
+ <h2>seen at:</h2>
+ <div class="backtrace">
+% for(list<konforka::code_point>::const_iterator i=ke->_seen.begin();i!=ke->_seen.end();++i) {
+% if(i->line>=0) {
+% report_error(i->file,i->line,i->function);
+% }
+% }
+ </div>
+% }
+% }
+ </div>
+</%method>
+<%method void handle_preprocess_error() %>
+ <div class="exception-preprocess">
+ <h1>error preprocessing component '<code><% component %></code>'</h1>
+% report_error(root_source+component,line_number,message);
+ </div>
+</%method>
+<%method void handle_compile_error() %>
+ <div class="exception-compile">
+ <h1>error compiling component '<code><% component %></code>'</h1>
+ <%code>
+ ifstream err((root_intermediate+component+".stderr").c_str(),ios::in);
+ if(err.bad()) {
+ <%output>
+ Failed to access compiler output
+ </%output>
+ }else{
+ string cumulative;
+ string error_file;
+ long error_line = -1;
+ while(!err.eof()) {
+ string oef = error_file;
+ long oel = error_line;
+ string line;
+ getline(err,line);
+ if(line[0]!=' ') {
+ string::size_type c = line.find(':');
+ if(c!=string::npos) {
+ string fn = line.substr(0,c);
+ string::size_type c1 = line.find(':',c+1);
+ if(c1!=string::npos) {
+ string ln = line.substr(c+1,c1-c-1);
+ string::size_type nd = ln.find_first_not_of("0123456789");
+ if(nd==string::npos) {
+ try {
+ error_file = sitecing::strip_prefix(fn,"In file included from ");
+ }catch(sitecing::utility_no_prefix& unp) {
+ error_file = fn;
+ }
+ error_line = strtol(ln.c_str(),0,10);
+ }
+ }
+ }
+ if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) {
+ string ef = "/"+sitecing::combine_path(root_source+component,oef);
+ report_error(ef,oel,remove_roots(cumulative));
+ cumulative.clear();
+ }
+ }
+ if(!cumulative.empty())
+ cumulative += '\n';
+ cumulative += line;
+ }
+ if(!(cumulative.empty() || error_file.empty() || error_line<0)) {
+ error_file = "/"+sitecing::combine_path(root_source+component,error_file);
+ report_error(error_file,error_line,remove_roots(cumulative));
+ }
+ }
+ </%code>
+ </div>
+</%method>
+<%method void handle_unknown_error() %>
+ <div class="exception-unknown">
+ <h1>unknown error</h1>
+ </div>
+</%method>
+<%method void report_error(const string& file,long line,const string& message) %>
+ <div class="exception-codepoint-report">
+ <h3><% sitecing::html_escape(strip_roots(file)) %></h3>
+ <%code>
+ if(line>=0) {
+ int firstline = line-5, lastline = line+5;
+ if(firstline<1)
+ firstline = 1;
+ ifstream ifs(file.c_str(),ios::in);
+ if(ifs.bad()) {
+ // TODO:
+ }else{
+ for(int l=1;l<firstline && !ifs.eof();l++) {
+ ifs.ignore(65536,'\n');
+ }
+ if(ifs.eof()) {
+ // TODO: no such line in file
+ }else{
+ <%output><ul></%output>
+ for(int l=firstline;l<=lastline && !ifs.eof();l++) {
+ string str;
+ getline(ifs,str);
+ for(string::size_type t=str.find('\t');t!=string::npos;t=str.find('\t')) {
+ str.replace(t,1,8-(t%8),' ');
+ }
+ char tln[16];
+ snprintf(tln,sizeof(tln),"%5d",l);
+ <%output>
+ <li class="<% l==line?"focused":"unfocused" %>"><span class="lineno"><% sitecing::html_escape(tln,sitecing::html_escape_nbsp) %></span>&nbsp;<span class="line"><% sitecing::html_escape(str,sitecing::html_escape_nbsp) %></span></li>
+ </%output>
+ }
+ <%output></ul></%output>
+ }
+ }
+ }
+ </%code>
+ <div class="what">
+ <% sitecing::html_escape(message,sitecing::html_escape_br) %>
+ </div>
+ </div>
+</%method>
+<%codemethod string strip_roots(const string& filename) %>
+ string np = sitecing::normalize_path(filename);
+ try{
+ return sitecing::strip_prefix(np,root_source);
+ }catch(sitecing::utility_no_prefix& e){ }
+ try{
+ return sitecing::strip_prefix(np,root_intermediate);
+ }catch(sitecing::utility_no_prefix& e){ }
+</%codemethod>
+<%codemethod string remove_roots(const string& str) %>
+ string rv = str;
+ string::size_type rp;
+ string::size_type rl = root_source.length();
+ while((rp=rv.find(root_source))!=string::npos) {
+ rv.erase(rp,rl);
+ }
+ rl = root_intermediate.length();
+ while((rp=rv.find(root_intermediate))!=string::npos) {
+ rv.erase(rp,rl);
+ }
+ rl = root_so.length();
+ while((rp=rv.find(root_so))!=string::npos) {
+ rv.erase(rp,rl);
+ }
+ return rv;
+</%codemethod>
+% /* vim:set ft=sitecing: */
diff --git a/htdocs/handlers/exception_prod b/htdocs/handlers/exception_prod
new file mode 100644
index 0000000..9768623
--- a/dev/null
+++ b/htdocs/handlers/exception_prod
@@ -0,0 +1,52 @@
+<%code>
+ /* vim:set ft=sitecing: */
+ __SCIF->headers.clear(); /* reset all headers possibly set by the component throwing an exception. */
+ __SCIF->out->seekp(0); /* rollback the output that the exceptional component may have produced. */
+ /* set out headers */
+ __SCIF->headers["Content-Type"] = "text/html";
+ __SCIF->headers["Status"] = "500 server-side exception";
+ __SCIF->headers["Pragma"] = "no-cache";
+</%code>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title>Server-side exception</title>
+ <style type="text/css">
+ <!--
+ body {
+ font-family: sans-serif;
+ font-size: 12pt;
+ }
+ h1 {
+ font-family: serif;
+ font-size: 130%;
+ font-weight: bold;
+ text-align: center;
+ }
+ p {
+ text-indent: 2em;
+ text-align: justify;
+ }
+
+ div.powered {
+ margin: 2em 0px 0px 50%;
+ padding: 1ex 2ex;
+ text-align: right;
+ font-family: serif;
+ font-size: 140%;
+ font-weight: bold;
+ border-top: solid 2px black;
+ border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
+ background: #c0c0f0;
+ }
+ -->
+ </style>
+ </head>
+ <body>
+ <h1>server-side exception</h1>
+ <p>Something has gone really wrong with the server. Feel free to report the
+ incident to <a href="mailto:<% __CGI->get_meta("SERVER_ADMIN") %>" title="e-mail
+ server administrator">webmaster</a>.</p>
+ <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
+ </body>
+</html>
diff --git a/htdocs/index.chtml b/htdocs/index.chtml
new file mode 100644
index 0000000..aa0979a
--- a/dev/null
+++ b/htdocs/index.chtml
@@ -0,0 +1,46 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+<%codemethod string title() %>
+ return "introduction";
+</%codemethod>
+<%method void content() %>
+ <h1>introduction to site-C-ing</h1>
+ <p>
+ This is a sample site, which is supposed to demonstrate <em>site-C-ing</em>
+ features. Since the <em>site-C-ing</em> is still at the early stages of
+ development or rather proof of concept, this site is also far from being
+ complete. I am planning to add more pages as the time permits, though.
+ </p>
+ <p>
+ Once you download and install <a
+ href="http://kin.klever.net/sitecing/">site-C-ing</a> you may wish to try
+ this sample site for yourself. The source is available from <a
+ href="http://kin.klever.net/sitecing/sources">the site-C-ing download
+ page</a>. After you download the source code, you should configure it using
+ the ever so popular <code>configure</code> script. It is likely that you will
+ want to pass the <code>--with-vhostname</code> option to configure to name
+ the apache virtual host.
+ </p>
+ <p>
+ The configure script will generate the apache vhost configuration for you,
+ which you can <code>Include</code> in the main apache configuration file.
+ </p>
+ <p class="note">
+ Note, that the configuration is tailored for apache 2.x. It is no problem to
+ get it working with apache 1.3.x, although I haven't tried and so I am not
+ sure if it will run out of the box (your patches are <a
+ href="mailto:sitecing-patches@klever.net">welcome</a>). Also note that you
+ will need <a href="http://fastcgi.com/">mod_fastcgi</a> apache module, which
+ is the only CGI-interface supported by the <em>site-C-ing</em> engine at the
+ moment.
+ </p>
+ <p>
+ Once you get it all done you will want to restart your apache and start the
+ <em>site-C-ing</em> fastcgi server by issuing the <code>make restart</code>
+ command.
+ </p>
+ <p>
+ Before you download it, you may wish to <a href="/sources" title="source
+ browser">examine the sources</a> to learn more about how it is done.
+ </p>
+</%method>
diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml
new file mode 100644
index 0000000..b1eeed3
--- a/dev/null
+++ b/htdocs/sources.chtml
@@ -0,0 +1,47 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive layout = "/ancestry/layout.chtml";
+%%derive sources = "/ancestry/sources.chtml";
+<%impl>
+ #include <sitecing/sitecing_util.h>
+</%impl>
+<%constructor>
+ b_strict = false;
+</%constructor>
+<%codemethod string title() %>
+ return "runtime exceptions handling";
+</%codemethod>
+<%method void content() %>
+ <h1>browse this site sources</h1>
+
+ <ul class="sourcebrowser">
+% for(int n=0;n<source_files_count;n++) {
+% sourcefile_t& sf = source_files[n];
+% if(!sf.name) { /* the beginning or the end of the directory */
+% if(sf.dir) { /* the beginning */
+ <li class="dir"><% sf.dir %>/<ul class="dir">
+% }else{ /* the end */
+ </ul></li>
+% }
+% }else{
+ <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li>
+% }
+% }
+ </ul>
+
+ <%code>
+ string rfile = sitecing::normalize_path(
+ sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"),
+ sitecing::restrict_dotdot|sitecing::strip_leading_slash );
+ if(rfile.empty())
+ rfile = "about:blank";
+ else
+ rfile = "/view/"+rfile;
+ </%code>
+ <div class="insert">
+ <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300">
+ <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
+ support it. That is okay, it still will open links somehow.</p>
+ </iframe>
+ </div>
+
+</%method>
diff --git a/htdocs/style.css b/htdocs/style.css
new file mode 100644
index 0000000..01fd43a
--- a/dev/null
+++ b/htdocs/style.css
@@ -0,0 +1,168 @@
+body {
+ font-family: sans-serif;
+ font-size: 11pt;
+}
+
+a {
+ text-decoration: none;
+}
+a:hover {
+ text-decoration: underline;
+}
+p {
+ margin: 1ex 1em;
+ text-indent: 2em;
+ text-align: justify;
+}
+p.note {
+ margin-left: 10%;
+ border-width: 1px 1px 1px 6px;
+ border-color: gray gray gray #0000a0;
+ border-style: solid solid solid double;
+ padding: 1ex 1ex 1ex 2em;
+ font-size: 80%;
+ background: #c0c0e0;
+ color: #202020;
+}
+code {
+ color: #d04040;
+}
+em {
+ white-space: nowrap;
+}
+
+div.google_ad {
+ text-align: center;
+ margin: 1ex;
+}
+div.google_ad.top {
+ padding-bottom: 1ex;
+ border-bottom: 1px gray solid;
+}
+div.google_ad.bottom {
+ padding-top: 1ex;
+ border-top: 1px gray solid;
+}
+
+div#sidepanel {
+ position: absolute; top: 0px; left: 0px;
+ margin: 0px;
+ width: 20%;
+ font-size: 80%;
+}
+div#content {
+ position: absolute; top: 0px; right: -0px;
+ margin: 0px;
+ width: 80%;
+}
+
+div#sidepanel h1 {
+ font-size: 80%;
+ text-align: center;
+ font-weight: normal;
+ color: #004080;
+ white-space: nowrap;
+ margin-top: 2ex; margin-bottom: 2ex;
+}
+div#sidepanel ul {
+ padding: 1ex 0.5ex 1ex 1ex;
+ margin: 0.5ex;
+ border-color: #c0c0c0 #404040 #404040 #c0c0c0;
+ border-width: 1px 2px 2px 1px;
+ border-style: solid;
+ background: #d0d0d0;
+ list-style-type: none;
+}
+div#sidepanel ul ul {
+ margin: 0px; padding: 0px;
+ border: none 0px;
+}
+div#sidepanel li {
+ list-style-type: none;
+ margin: 0px; padding: 0px;
+ display: block;
+}
+div#sidepanel ul a {
+ display: block;
+ padding: 1px 1ex;
+ margin: 0.5ex;
+ border: 1px solid gray;
+ text-decoration: none;
+ background: white;
+ color: black;
+}
+div#sidepanel ul a:hover {
+ background: gray;
+ color: white;
+}
+div#sidepanel ul ul a {
+ padding-left: 2.5ex;
+ background: #e0e0e0;
+}
+div#sidepanel div.copyright {
+ text-align: center;
+}
+
+div#content h1 {
+ font-size: 140%;
+ color: gray;
+ font-weight: bold;
+ text-align: center;
+ margin: 1em;
+}
+
+div.insert {
+ text-align: center;
+}
+iframe#insert {
+ border: 1px solid black;
+}
+
+div.source h1 {
+ background: #e0e0e0;
+ border: 1px solid #808080;
+ padding-left: 1em;
+ margin: 0px;
+ font-size: 100%;
+ color: #000060;
+ overflow: hidden;
+}
+div.source ul {
+ background: #80c0c0;
+ margin: 0px;
+ padding: 1px 0.5ex;
+ font-family: monospace;
+ font-size: 80%;
+ overflow: hidden;
+}
+div.source li {
+ list-style-type: none;
+ white-space: nowrap;
+}
+
+ul.sourcebrowser {
+ font-size: 70%;
+}
+ul.sourcebrowser ul.dir {
+ padding: 1px 0px 2px 1em;
+ margin: 1px 0px 1px 0px;
+}
+ul.sourcebrowser li.dir {
+ margin: 1px 0px 1px 0px;
+}
+ul.sourcebrowser li.file {
+ list-style-type: none;
+ white-space: nowrap;
+ display: inline;
+}
+ul.sourcebrowser li.file a {
+ border: 1px solid gray;
+ padding: 1px 0.5ex;
+ text-decoration: none;
+ font-family: monospace;
+}
+ul.sourcebrowser li.file a:hover {
+ background: gray;
+ border: 1px solid black;
+ color: white;
+}
diff --git a/htdocs/view.chtml b/htdocs/view.chtml
new file mode 100644
index 0000000..d885330
--- a/dev/null
+++ b/htdocs/view.chtml
@@ -0,0 +1,54 @@
+% html(); return; /* vim:set ft=sitecing: */
+%%derive page = "/ancestry/page.chtml";
+%%derive sources = "/ancestry/sources.chtml";
+<%impl>
+ #include <iostream>
+ #include <fstream>
+ using namespace std;
+ #include <sitecing/util.h>
+ #include <sitecing/sitecing_util.h>
+ #include <konforka/exception.h>
+ #include "acconfig.h"
+</%impl>
+<%codemethod string title() %>
+ return "introduction";
+</%codemethod>
+<%method void body() %>
+ <%code>
+ string rfile = sitecing::normalize_path(
+ sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"),
+ sitecing::restrict_dotdot|sitecing::strip_leading_slash );
+ sourcefile_t *sof = 0;
+ for(int n=0;n<source_files_count;n++) {
+ sof = &source_files[n];
+ if(sof->name && sof->dir) {
+ if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile)
+ break;
+ }
+ sof = 0;
+ }
+ if(!sof)
+ throw konforka::exception(CODEPOINT,"no access to the file allowed");
+ string afile = sitecing::combine_path(WEB_ROOT,rfile,0);
+ </%code>
+ <div class="source">
+ <h1><% rfile %></h1>
+ <ul>
+ <%code>
+ ifstream sf(afile.c_str());
+ if(!sf.good())
+ throw konforka::exception(CODEPOINT,"could not open source file");
+ while(!sf.eof()) {
+ string sfl;
+ getline(sf,sfl);
+ for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) {
+ sfl.replace(t,1,8-(t%8),' ');
+ }
+ <%output>
+ <li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li>
+ </%output>
+ }
+ </%code>
+ </ul>
+ </div>
+</%method>
diff --git a/include/.gitignore b/include/.gitignore
new file mode 100644
index 0000000..c63497a
--- a/dev/null
+++ b/include/.gitignore
@@ -0,0 +1,3 @@
+acconfig.h
+acconfig.h.in
+stamp-h1