summaryrefslogtreecommitdiffabout
path: root/htdocs
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) (unidiff)
treecfe7736ae3416ad314b7451b756e587335c357c7 /htdocs
parentacd2a536dd6bb3ef9438482725f77ac9044ae79b (diff)
downloadsitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.zip
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.gz
sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.bz2
initial commit into repository
Diffstat (limited to 'htdocs') (more/less context) (ignore whitespace changes)
-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
30 files changed, 1438 insertions, 0 deletions
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 @@
1Options MultiViews
2AddType 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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive page = "/ancestry/page.chtml";
3%%impl #include "acconfig.h"
4<%method void body() %>
5 <div id="content">
6 <%code>
7 if(!access(WEB_RUN_ROOT "/conf/banner_top",R_OK)) {
8 pass_file_through(WEB_RUN_ROOT "/conf/banner_top");
9 }
10 content();
11 if(b_strict && !access(WEB_RUN_ROOT "/conf/banner_bottom",R_OK)) {
12 pass_file_through(WEB_RUN_ROOT "/conf/banner_bottom");
13 }
14 </%code>
15 </div>
16 <div id="sidepanel">
17% sidepanel();
18 </div>
19</%method>
20<%method void content() %>
21</%method>
22<%method void sidepanel() %>
23 <h1><% PACKAGE_STRING %></h1>
24% /* thank MSIE for this awful formatting */
25 <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>
26 <%code>
27 if(!access(WEB_RUN_ROOT "/conf/banner_side",R_OK)) {
28 pass_file_through(WEB_RUN_ROOT "/conf/banner_side");
29 }
30 </%code>
31 <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>
32 <div class="copyright">
33 &copy; <a href="http://www.klever.net/">Klever Group</a>
34 </div>
35</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%var bool b_strict = true;
3<%decl>
4 using std::string;
5</%decl>
6<%method void html() %>
7% if(b_strict){
8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9% }else{
10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
11% }
12 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
13 <head>
14% __SCIF->headers["Content-Type"] = "text/html";
15 <title><% title() %></title>
16 <meta name="copyright" content="Copyright (c) 1996-2005 Klever Group"/>
17 <link rel="stylesheet" href="/style.css" type="text/css" />
18 </head>
19 <body>
20% body();
21 </body>
22 </html>
23</%method>
24<%codemethod string title() %>
25 return "untitled";
26</%codemethod>
27<%method void body() %>
28</%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 @@
1<%decl>
2 typedef struct {
3 const char *dir;
4 const char *name;
5 const char *desc;
6 } sourcefile_t;
7 extern sourcefile_t source_files[];
8 extern int source_files_count;
9</%decl>
10<%impl>
11 sourcefile_t source_files[] = {
12 { "", 0, "the root" },
13 { "", "configure.ac", "main configuration file" },
14 { "", "acinclude.m4", "autoconf macros" },
15 { "", "autogen.sh", "shell script for building out of source repository" },
16 { "", "Makefile.am", "automake makefile template" },
17 { "", "NEWS.xml", "news since the last release (if any)" },
18 { "", "NEWS.xsl", "the styleshhet to make a plaintext version of NEWS.xml" },
19 { "", "COPYING", "copyright notice" },
20 { "", "AUTHORS", "Klever dissected" },
21 { 0, 0, 0 },
22 { "bin", 0, "various scripts" },
23 { "bin", "build.in", "the template of the script used to precompile the code" },
24 { "bin", "run.in", "the template of the script used to start fastcgi server" },
25 { 0, 0, 0 },
26 { "conf", 0, "configuration files" },
27 { "conf", "dudki.conf.in", "the template for the dudki daemon configuration file" },
28 { "conf", "httpd.conf.in", "the template for the apache configuration" },
29 { "conf", "sitecing.conf.in", "the template for the site-C-ing configuration" },
30 { 0, 0, 0 },
31 { "htdocs", 0, "the source files" },
32 { "htdocs", ".htaccess", "apache access-control file" },
33 { "htdocs", "index.chtml", "the introduction" },
34 { "htdocs", "sources.chtml", "the source browser" },
35 { "htdocs", "style.css", "the CSS style sheet" },
36 { "htdocs", "view.chtml", "the source viewer" },
37 { "htdocs/exceptions", 0, "exceptions handling overview" },
38 { "htdocs/exceptions", "index.chtml", "the overview" },
39 { "htdocs/exceptions", "preprocess.chtml", "preprocessor exceptions" },
40 { "htdocs/exceptions", "compile.chtml", "compile-time exceptions" },
41 { "htdocs/exceptions", "runtime.chtml", "runtime exceptions" },
42 { "htdocs/exceptions/development", 0, "development-mode exceptions samples" },
43 { "htdocs/exceptions/development", ".htaccess", "apache access control file" },
44 { "htdocs/exceptions/development", ".scrc", "site-C-ing local configuration" },
45 { "htdocs/exceptions/development", "preprocess.chtml", "the file that can not be preprocessed" },
46 { "htdocs/exceptions/development", "runtime.chtml", "exception thrown at runtime" },
47 { "htdocs/exceptions/development", "compile.chtml", "the file that can not be compiled" },
48 { "htdocs/exceptions/development", "erroneous.h", "the file to include for more errors" },
49 { "htdocs/exceptions/development", "compile.html", "compile-time exception handler output" },
50 { 0,0,0 },
51 { "htdocs/exceptions/production", 0, "production-mode exceptions samples" },
52 { "htdocs/exceptions/production", ".htaccess", "apache access control file" },
53 { "htdocs/exceptions/production", ".scrc", "site-C-ing local configuration" },
54 { "htdocs/exceptions/production", "preprocess.chtml", "the file that can not be preprocessed" },
55 { "htdocs/exceptions/production", "runtime.chtml", "exception thrown at runtime" },
56 { "htdocs/exceptions/production", "compile.chtml", "the file that can not be compiled" },
57 { "htdocs/exceptions/production", "erroneous.h", "the file to include for more errors" },
58 { "htdocs/exceptions/production", "compile.html", "compile-time exception handler output" },
59 { 0,0,0 },
60 { 0,0,0 },
61 { "htdocs/handlers", 0, "exception handlers" },
62 { "htdocs/handlers", ".htaccess", "apache access-control file" },
63 { "htdocs/handlers", "exception_dev", "development mode exception handler" },
64 { "htdocs/handlers", "exception_prod", "production mode exception handler" },
65 { 0,0,0 },
66 { "htdocs/ancestry", 0, "base components to build the rest upon" },
67 { "htdocs/ancestry", ".htaccess", "apache access control file" },
68 { "htdocs/ancestry", "page.chtml", "the xhtml skeleton" },
69 { "htdocs/ancestry", "layout.chtml", "the layout for the most pages" },
70 { "htdocs/ancestry", "sources.chtml", "the list of files for source browser" },
71 { 0,0,0 },
72 { 0,0,0 }
73 };
74 int source_files_count = sizeof(source_files)/sizeof(*source_files);
75</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "compile-time exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing compile-time exception handling</h1>
11 <p>
12 Similar to <a href="/exceptions/preprocess">preprocessing exceptions</a>
13 there is a wide range of errors you may put into your code which will pass
14 through preprocessor and will be caught later at the compile-time.
15 </p>
16 <p>
17 Once you complete writing your <a
18 href="/view/htdocs/exceptions/development/compile.chtml" target="insert"
19 title="the link opens in the frame below">erroneous code</a> and
20 <em>site-C-ing</em> is done preprocessing it, it will feed the preprocessed
21 code into c++ compiler which will refuse to compile the code like this. This
22 is where <a href="/view/htdocs/handlers/exception_dev" target="insert"
23 title="the link opens in the frame below">the exception handler</a>,
24 specified in <a href="/view/htdocs/exceptions/development/.scrc"
25 target="insert" title="the link opens in the frame below">the configuration
26 file</a>, takes over the process and gives you <a
27 href="/exceptions/development/compile" target="insert" title="the link opens
28 in the frame below">the report</a>. Like with any handler, you may wish to
29 set some <a href="/view/htdocs/handlers/exception_prod" target="insert"
30 title="the link opens in the frame below">different handler</a> in your <a
31 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
32 link opens in the frame below">production configuration</a>, which just gives
33 user <a href="/exceptions/production/preprocess" target="insert" title="the
34 link opens in the frame below">a friendly yet lame excuse</a>.
35 </p>
36 <p class="note">
37 Note, that these output pages are fakes -- I do not want to spawn the
38 compiler each time you want to see the output and put this unnecessary load
39 on cpu. These static pages are in fact saved output of the real exception
40 handlers.
41 </p>
42
43 <div class="insert">
44 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300" border="1">
45 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
46 support it. That is okay, it still will open links somehow.</p>
47 </iframe>
48 </div>
49
50</%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 @@
1<Files compile.chtml>
2 deny from all
3</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 @@
1ExceptionHandler /handlers/exception_dev
2AutoBuildFiles -*
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 @@
1<html>
2 <head>
3 <title>I'm gonna make a number of mistakes!</title>
4 </head>
5 <body>
6% ind a = 2;
7% #include "erroneous.h"
8% unsigned int a = -1;
9% int j = k;
10 </body>
11</html>
12% /* 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 @@
1
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4 <head>
5 <title>failed to compile component</title>
6 <style type="text/css">
7 <!--
8 body {
9 font-family: sans-serif;
10 font-size: 11pt;
11 }
12
13 h1 {
14 font-family: serif;
15 font-size: 130%;
16 font-weight: bold;
17 text-align: center;
18 }
19 p {
20 text-indent: 2em;
21 text-align: justify;
22 }
23
24 dl.exception-props {
25 margin: 1ex 1em;
26 padding: 0.5ex;
27 border: solid 1px gray;
28 background-color: #e0e0e0;
29 }
30 dl.exception-props dt {
31 font-weight: bold;
32 color: blue;
33 }
34 dl.exception-props dd {
35 color: gray;
36 }
37
38 div.exception-codepoint-report {
39 border: solid 1px black;
40 margin: 0.5ex 1em 0.ex 3em;
41 }
42 div.exception-codepoint-report h3 {
43 display: block;
44 color: blue;
45 border-bottom: 3px double black;
46 padding: 0.3ex; margin: 0px;
47 background: #e0e0e0;
48 }
49 div.exception-codepoint-report ul {
50 padding: 0px;
51 margin: 0px;
52 background: #87fdff;
53 font-size: 70%;
54 }
55 div.exception-codepoint-report li {
56 font-family: monospace;
57 list-style-type: none;
58 white-space: pre;
59 overflow: hidden;
60 }
61 div.exception-codepoint-report li.focused {
62 color: red;
63 border-top: solid 1px red; border-bottom: solid 1px red;
64 }
65 div.exception-codepoint-report li .lineno {
66 padding-right: 0.5ex;
67 border-right: dotted black 1px;
68 }
69 div.exception-codepoint-report div.what {
70 border-top: double 3px black;
71 padding: 0.5ex 2em;
72 font-weight: bold; color: #4040c0;
73 overflow: auto;
74 }
75 div.backtrace div.exception-codepoint-report div.what {
76 color: gray;
77 }
78
79 div.exception-compile div.what {
80 font-weight: normal;
81 color: red;
82 }
83
84 div.powered {
85 margin: 2em 0px 0px 50%;
86 padding: 1ex 2ex;
87 text-align: right;
88 font-family: serif;
89 font-size: 140%;
90 font-weight: bold;
91 border-top: solid 2px black;
92 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
93 background: #c0c0f0;
94 }
95 -->
96 </style>
97 </head>
98 <body>
99
100 <div class="exception-compile">
101 <h1>error compiling component '<code>exceptions/development/compile.chtml</code>'</h1>
102
103 <div class="exception-codepoint-report">
104 <h3>exceptions/development/compile.chtml</h3>
105 <ul>
106 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&lt;html&gt;</span></li>
107
108 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
109
110 <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>
111
112 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
113
114 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
115
116 <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>
117
118 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
119
120 <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>
121
122 <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>
123
124 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
125
126 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
127 </ul>
128 <div class="what">
129 exceptions/development/compile.chtml: In member function `virtual void _SCC_exceptions_development_compile_chtml::main(int, char*)':<br/>
130exceptions/development/compile.chtml:6: error: `ind' undeclared (first use this function)<br/>
131exceptions/development/compile.chtml:6: error: (Each undeclared identifier is reported only once for each function it appears in.)<br/>
132exceptions/development/compile.chtml:6: error: expected `;' before "a"
133 </div>
134 </div>
135
136 <div class="exception-codepoint-report">
137 <h3>exceptions/development/compile.chtml</h3>
138 <ul>
139 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line">&nbsp;&lt;head&gt;</span></li>
140
141 <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>
142
143 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
144
145 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
146
147 <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>
148
149 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
150
151 <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>
152
153 <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>
154
155 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
156
157 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
158
159 <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>
160 </ul>
161 <div class="what">
162 In file included from exceptions/development/compile.chtml:7:
163 </div>
164 </div>
165
166 <div class="exception-codepoint-report">
167 <h3>exceptions/development/erroneous.h</h3>
168 <ul>
169 <li class="focused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span class="line">&nbsp;a+2=5;</span></li>
170
171 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;<span class="line"></span></li>
172 </ul>
173 <div class="what">
174 ./erroneous.h:1: error: `a' undeclared (first use this function)
175 </div>
176 </div>
177
178 <div class="exception-codepoint-report">
179 <h3>exceptions/development/compile.chtml</h3>
180 <ul>
181 <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>
182
183 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
184
185 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
186
187 <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>
188
189 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
190
191 <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>
192
193 <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>
194
195 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
196
197 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
198
199 <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>
200
201 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
202 </ul>
203 <div class="what">
204 exceptions/development/compile.chtml:8: warning: converting of negative value `-0x000000001' to `unsigned int'
205 </div>
206 </div>
207
208 <div class="exception-codepoint-report">
209 <h3>exceptions/development/compile.chtml</h3>
210 <ul>
211 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;<span class="line">&nbsp;&lt;/head&gt;</span></li>
212
213 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;<span class="line">&nbsp;&lt;body&gt;</span></li>
214
215 <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>
216
217 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;<span class="line">%&nbsp;&nbsp;#include&nbsp;"erroneous.h"</span></li>
218
219 <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>
220
221 <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>
222
223 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;10</span>&nbsp;<span class="line">&nbsp;&lt;/body&gt;</span></li>
224
225 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;11</span>&nbsp;<span class="line">&lt;/html&gt;</span></li>
226
227 <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>
228
229 <li class="unfocused"><span class="lineno">&nbsp;&nbsp;&nbsp;13</span>&nbsp;<span class="line"></span></li>
230 </ul>
231 <div class="what">
232 exceptions/development/compile.chtml:9: error: `k' undeclared (first use this function)<br/>
233
234 </div>
235 </div>
236
237 </div>
238
239 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
240 </body>
241</html>
242
243
244
245
246
247
248
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 @@
1<html>
2 <body>
3 <p>
4 I was writing this component in a hurry, having a lot of things to distract
5 me, so no wonder I made mistake.
6 <%code>
7 /* I do not even remember what I was going to put in this code block. And
8 * of course I didn't mean to forget that this is just a block of code, not
9 * a constructor...
10 */
11 </%constructor>
12 </p>
13 </body>
14</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 @@
1%%decl #include <konforka/exception.h>
2<%code>
3 try{
4 try{
5 try{
6 throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
7 }catch(konforka::exception& ke){
8 ke.see(CODEPOINT); throw;
9 }
10 }catch(konforka::exception& ke){
11 ke.see(CODEPOINT); throw;
12 }
13 }catch(konforka::exception& ke){
14 ke.see(CODEPOINT); throw;
15 }
16</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%codemethod string title() %>
4 return "exceptions handling";
5</%codemethod>
6<%method void content() %>
7 <h1>site-C-ing exception handling</h1>
8 <p>
9 The purpose of this section is to give an overview of the <em>site-C-ing</em>
10 exception handling mechanism. Before the web visitor can see the page each
11 site-C-ing component goes through a few stages, namely, preprocessing,
12 compiling and execution. Having three stages to go through also means the
13 stages one can fail to go through and three exciting opportunities to handle
14 different errors.
15 </p>
16 <p>
17 First each component is preprocessed so that you can feed the valid c++ code
18 to the compiler. Here is where the preprocessor can choke at your broken
19 source code. Once preprocessor failes to parse your code it will throw an
20 exception which <em>site-C-ing</em> will catch and pass to <a
21 href="/sources/htdocs/handlers/exception_dev" title="development mode
22 exception handler source">the exception handler component</a>. Want to <a
23 href="/exceptions/preprocess">read more</a> about preprocessor exception
24 handling?
25 </p>
26 <p>
27 After the preprocessing stage is over we have a great opportunity to catch
28 the compile-time errors. After <em>site-C-ing</em> fails to compile the
29 component it throws another exception and passes it to the same handler which
30 may show you some information on what's gone wrong with your source code from
31 the compiler's perspective. If you've gone this far you definitely want to <a
32 href="/exceptions/compile">read more</a> about the compiler error handling.
33 </p>
34 <p class="note">
35 Note, that it is likely that you will want to disable the steps above for the
36 production environment to save time on unnecessary checking whether the
37 component is up to date.
38 </p>
39 <p>
40 Finally, we need to execute the component and present its output to the web
41 site visitor. This is also where things may go wrong and here is where your
42 component may throw an exception for the engine to catch and pass to the
43 handler. Feel free to <a href="/exceptions/runtime">learn more</a> about it
44 as well.
45 </p>
46 <p class="note">
47 One more thing you will likely want to have differently in production
48 environment is <a href="/sources/htdocs/handlers/exception_prod"
49 title="production mode exception handler source">an exception handler</a>
50 which will not give out that much unnecessary information to the user.
51 </p>
52</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "preprocessor exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing preprocessor exception handling</h1>
11 <p>
12 It was one of those days when you just can't type right and can't think of
13 what you're typing. It is not unusual that, under such circumstances, you end
14 up with a code like <a
15 href="/view/htdocs/exceptions/development/preprocess.chtml" target="insert"
16 title="the link opens in the frame below">this</a> -- by the time you were
17 about to close your <code>&lt;%code&gt;</code> block you were thinking about
18 some constructor in some component elsewhere in the universe.
19 </p>
20 <p>
21 <em>site-C-ing</em> parser will see the inconsistency and throw an exception
22 which will be caught and passed to <a
23 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
24 opens in the frame below">the handler</a>, specified in <a
25 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
26 link opens in the frame below">the configuration file</a>, which will produce
27 some nice, human-readable <a href="/exceptions/development/preprocess"
28 target="insert" title="the link opens in the frame below">output</a>. Well,
29 you may not wish to give out all this information in the production
30 environment, so you just put in your <a
31 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
32 link opens in the frame below">configuration file</a> some <a
33 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
34 opens in the frame below">different handler</a>, which just gives user <a
35 href="/exceptions/production/preprocess" target="insert" title="the link
36 opens in the frame below">a friendly yet lame excuse</a>.
37 </p>
38
39 <div class="insert">
40 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
41 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
42 support it. That is okay, it still will open links somehow.</p>
43 </iframe>
44 </div>
45
46</%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 @@
1<Files compile.chtml>
2 deny from all
3</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 @@
1ExceptionHandler /handlers/exception_prod
2AutoBuildFiles -*
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 @@
1<html>
2 <head>
3 <title>I'm gonna make a number of mistakes!</title>
4 </head>
5 <body>
6% ind a = 2;
7% #include "erroneous.h"
8% unsigned int a = -1;
9% int j = k;
10 </body>
11</html>
12% /* 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 @@
1
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4 <head>
5 <title>Server-side exception</title>
6 <style type="text/css">
7 <!--
8 body {
9 font-family: sans-serif;
10 font-size: 12pt;
11 }
12 h1 {
13 font-family: serif;
14 font-size: 130%;
15 font-weight: bold;
16 text-align: center;
17 }
18 p {
19 text-indent: 2em;
20 text-align: justify;
21 }
22
23 div.powered {
24 margin: 2em 0px 0px 50%;
25 padding: 1ex 2ex;
26 text-align: right;
27 font-family: serif;
28 font-size: 140%;
29 font-weight: bold;
30 border-top: solid 2px black;
31 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
32 background: #c0c0f0;
33 }
34 -->
35 </style>
36 </head>
37 <body>
38 <h1>server-side exception</h1>
39 <p>Something has gone really wrong with the server. Feel free to report the
40 incident to <a href="mailto:root@localhost" title="e-mail
41 server administrator">webmaster</a>.</p>
42 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
43 </body>
44</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 @@
1<html>
2 <body>
3 <p>
4 I was writing this component in a hurry, having a lot of things to distract
5 me, so no wonder I made mistake.
6 <%code>
7 /* I do not even remember what I was going to put in this code block. And
8 * of course I didn't mean to forget that this is just a block of code, not
9 * a constructor...
10 */
11 </%constructor>
12 </p>
13 </body>
14</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 @@
1%%decl #include <konforka/exception.h>
2<%code>
3 try{
4 try{
5 try{
6 throw konforka::exception(CODEPOINT,"throwing an exception to backtrace a bit");
7 }catch(konforka::exception& ke){
8 ke.see(CODEPOINT); throw;
9 }
10 }catch(konforka::exception& ke){
11 ke.see(CODEPOINT); throw;
12 }
13 }catch(konforka::exception& ke){
14 ke.see(CODEPOINT); throw;
15 }
16</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%constructor>
4 b_strict = false;
5</%constructor>
6<%codemethod string title() %>
7 return "runtime exceptions handling";
8</%codemethod>
9<%method void content() %>
10 <h1>site-C-ing runtime exception handling</h1>
11 <p>
12 The component may throw an exception while executing and the
13 <em>site-C-ing</em> will gladly pass it to the handler component which will
14 give the user appropriate output (unless it throws an exception itself, of
15 course). Here you will see an example output provided by the handler bundled
16 with the <em>site-C-ing</em>.
17 </p>
18
19 <p>
20 Suppose you have <a href="/view/htdocs/exceptions/development/runtime.chtml"
21 target="insert" title="the link opens in the frame below">a component</a>,
22 which at some point throws an exception. Of course, <em>site-C-ing</em> will
23 catch the exception and pass it to <a
24 href="/view/htdocs/handlers/exception_dev" target="insert" title="the link
25 opens in the frame below">the handler</a>, specified in <a
26 href="/view/htdocs/exceptions/development/.scrc" target="insert" title="the
27 link opens in the frame below">the configuration file</a>, which will produce
28 some nice, human-readable <a href="/exceptions/development/runtime"
29 target="insert" title="the link opens in the frame below">output</a>. Well,
30 you may not wish to give out all this information in the production
31 environment, so you just put in your <a
32 href="/view/htdocs/exceptions/production/.scrc" target="insert" title="the
33 link opens in the frame below">configuration file</a> some <a
34 href="/view/htdocs/handlers/exception_prod" target="insert" title="the link
35 opens in the frame below">different handler</a>, which just gives user <a
36 href="/exceptions/production/runtime" target="insert" title="the link opens
37 in the frame below">a friendly yet lame excuse</a>.
38 </p>
39
40 <div class="insert">
41 <iframe id="insert" name="insert" src="about:blank" width="95%" height="300">
42 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
43 support it. That is okay, it still will open links somehow.</p>
44 </iframe>
45 </div>
46
47</%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 @@
1%%decl using namespace std;
2<%impl>
3 #include <iostream>
4 #include <fstream>
5 #include <sstream>
6 #include <cassert>
7 #include <cstdarg>
8 #include <stdexcept>
9 #include <cxxabi.h>
10 #include <sitecing/sitecing_util.h>
11 #include <sitecing/util.h>
12 #include <sitecing/magic.h>
13 #include <konforka/exception.h>
14</%impl>
15%%var string message;
16%%var string root_source;
17%%var string root_intermediate;
18%%var string root_so;
19%%var string component;
20%%var int line_number = -1;
21%%var const exception* exception_caught;
22<%code>
23 __SCIF->headers.clear();
24 __SCIF->out->seekp(0);
25 int magic = _magic;
26 va_list va = _args;
27 switch(magic) {
28 case sitecing::__magic_compile_error:
29 message = va_arg(va,const char*);
30 root_source = va_arg(va,const char*);
31 root_intermediate = va_arg(va,const char*);
32 root_so = va_arg(va,const char*);
33 component = va_arg(va,const char*);
34 break;
35 case sitecing::__magic_preprocess_error:
36 message = va_arg(va,const char*);
37 root_source = va_arg(va,const char*);
38 root_intermediate = va_arg(va,const char*);
39 root_so = va_arg(va,const char*);
40 component = va_arg(va,const char*);
41 line_number = va_arg(va,int);
42 break;
43 case sitecing::__magic_generic_exception:
44 message = va_arg(va,const char*);
45 root_source = va_arg(va,const char*);
46 root_intermediate = va_arg(va,const char *);
47 root_so = va_arg(va,const char *);
48 component = va_arg(va,const char*);
49 exception_caught = va_arg(va,const exception*);
50 break;
51 default:
52 break;
53 }
54</%code>
55<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
56<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
57 <head>
58 <title><% message %></title>
59 <style type="text/css">
60 <!--
61 body {
62 font-family: sans-serif;
63 font-size: 11pt;
64 }
65
66 h1 {
67 font-family: serif;
68 font-size: 130%;
69 font-weight: bold;
70 text-align: center;
71 }
72 p {
73 text-indent: 2em;
74 text-align: justify;
75 }
76
77 dl.exception-props {
78 margin: 1ex 1em;
79 padding: 0.5ex;
80 border: solid 1px gray;
81 background-color: #e0e0e0;
82 }
83 dl.exception-props dt {
84 font-weight: bold;
85 color: blue;
86 }
87 dl.exception-props dd {
88 color: gray;
89 }
90
91 div.exception-codepoint-report {
92 border: solid 1px black;
93 margin: 0.5ex 1em 0.ex 3em;
94 }
95 div.exception-codepoint-report h3 {
96 display: block;
97 color: blue;
98 border-bottom: 3px double black;
99 padding: 0.3ex; margin: 0px;
100 background: #e0e0e0;
101 }
102 div.exception-codepoint-report ul {
103 padding: 0px;
104 margin: 0px;
105 background: #87fdff;
106 font-size: 70%;
107 }
108 div.exception-codepoint-report li {
109 font-family: monospace;
110 list-style-type: none;
111 white-space: nowrap;
112 overflow: hidden;
113 }
114 div.exception-codepoint-report li.focused {
115 color: red;
116 border-top: solid 1px red; border-bottom: solid 1px red;
117 }
118 div.exception-codepoint-report li .lineno {
119 padding-right: 0.5ex;
120 border-right: dotted black 1px;
121 }
122 div.exception-codepoint-report div.what {
123 border-top: double 3px black;
124 padding: 0.5ex 2em;
125 font-weight: bold; color: #4040c0;
126 overflow: auto;
127 }
128 div.backtrace div.exception-codepoint-report div.what {
129 color: gray;
130 }
131
132 div.exception-compile div.what {
133 font-weight: normal;
134 color: red;
135 }
136
137 div.powered {
138 margin: 2em 0px 0px 50%;
139 padding: 1ex 2ex;
140 text-align: right;
141 font-family: serif;
142 font-size: 140%;
143 font-weight: bold;
144 border-top: solid 2px black;
145 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
146 background: #c0c0f0;
147 }
148 -->
149 </style>
150% __SCIF->headers["Content-Type"]="text/html; charset=utf-8";
151% __SCIF->headers["Pragma"]="no-cache";
152 </head>
153 <body>
154 <%code>
155 switch(magic) {
156 case sitecing::__magic_compile_error:
157 handle_compile_error();
158 break;
159 case sitecing::__magic_preprocess_error:
160 handle_preprocess_error();
161 break;
162 case sitecing::__magic_generic_exception:
163 handle_generic_exception();
164 break;
165 default:
166 handle_unknown_error();
167 break;
168 }
169 </%code>
170 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
171 </body>
172</html>
173<%method void handle_generic_exception() %>
174 <div class="exception-generic">
175 <h1>exception caught while running component '<code><% component %></code>'</h1>
176 <dl class="exception-props">
177 <dt><code>typeid(<em>e</em>).name()</code></dt>
178% int destat;
179% char *demangled = abi::__cxa_demangle(typeid(*exception_caught).name(),NULL,NULL,&destat);
180 <dd><code><% destat?typeid(*exception_caught).name():demangled %></code></dd>
181% if(!destat) free(demangled);
182 <dt><code><em>e</em>.what()</code></dt>
183 <dd><% message %></dd>
184% if(typeid(*exception_caught)==typeid(konforka::exception&)) {
185% konforka::exception* ke = (konforka::exception*)exception_caught;
186 <dt><code><em>e</em>.where()</code></dt>
187 <dd><code>
188% if(ke->_where.line<0) {
189 <% ke->where() %>
190% }else{
191 <% strip_roots(ke->_where.file) %>:<% ke->_where.line %> [<% ke->_where.function %>]
192% }
193 </code></dd>
194% }
195 </dl>
196% if(typeid(*exception_caught)==typeid(konforka::exception&)) {
197% konforka::exception* ke = (konforka::exception*)exception_caught;
198% if(ke->_where.line>=0) {
199% report_error(ke->_where.file,ke->_where.line,ke->what());
200% }
201% if(!ke->_seen.empty()) {
202 <h2>seen at:</h2>
203 <div class="backtrace">
204% for(list<konforka::code_point>::const_iterator i=ke->_seen.begin();i!=ke->_seen.end();++i) {
205% if(i->line>=0) {
206% report_error(i->file,i->line,i->function);
207% }
208% }
209 </div>
210% }
211% }
212 </div>
213</%method>
214<%method void handle_preprocess_error() %>
215 <div class="exception-preprocess">
216 <h1>error preprocessing component '<code><% component %></code>'</h1>
217% report_error(root_source+component,line_number,message);
218 </div>
219</%method>
220<%method void handle_compile_error() %>
221 <div class="exception-compile">
222 <h1>error compiling component '<code><% component %></code>'</h1>
223 <%code>
224 ifstream err((root_intermediate+component+".stderr").c_str(),ios::in);
225 if(err.bad()) {
226 <%output>
227 Failed to access compiler output
228 </%output>
229 }else{
230 string cumulative;
231 string error_file;
232 long error_line = -1;
233 while(!err.eof()) {
234 string oef = error_file;
235 long oel = error_line;
236 string line;
237 getline(err,line);
238 if(line[0]!=' ') {
239 string::size_type c = line.find(':');
240 if(c!=string::npos) {
241 string fn = line.substr(0,c);
242 string::size_type c1 = line.find(':',c+1);
243 if(c1!=string::npos) {
244 string ln = line.substr(c+1,c1-c-1);
245 string::size_type nd = ln.find_first_not_of("0123456789");
246 if(nd==string::npos) {
247 try {
248 error_file = sitecing::strip_prefix(fn,"In file included from ");
249 }catch(sitecing::utility_no_prefix& unp) {
250 error_file = fn;
251 }
252 error_line = strtol(ln.c_str(),0,10);
253 }
254 }
255 }
256 if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) {
257 string ef = "/"+sitecing::combine_path(root_source+component,oef);
258 report_error(ef,oel,remove_roots(cumulative));
259 cumulative.clear();
260 }
261 }
262 if(!cumulative.empty())
263 cumulative += '\n';
264 cumulative += line;
265 }
266 if(!(cumulative.empty() || error_file.empty() || error_line<0)) {
267 error_file = "/"+sitecing::combine_path(root_source+component,error_file);
268 report_error(error_file,error_line,remove_roots(cumulative));
269 }
270 }
271 </%code>
272 </div>
273</%method>
274<%method void handle_unknown_error() %>
275 <div class="exception-unknown">
276 <h1>unknown error</h1>
277 </div>
278</%method>
279<%method void report_error(const string& file,long line,const string& message) %>
280 <div class="exception-codepoint-report">
281 <h3><% sitecing::html_escape(strip_roots(file)) %></h3>
282 <%code>
283 if(line>=0) {
284 int firstline = line-5, lastline = line+5;
285 if(firstline<1)
286 firstline = 1;
287 ifstream ifs(file.c_str(),ios::in);
288 if(ifs.bad()) {
289 // TODO:
290 }else{
291 for(int l=1;l<firstline && !ifs.eof();l++) {
292 ifs.ignore(65536,'\n');
293 }
294 if(ifs.eof()) {
295 // TODO: no such line in file
296 }else{
297 <%output><ul></%output>
298 for(int l=firstline;l<=lastline && !ifs.eof();l++) {
299 string str;
300 getline(ifs,str);
301 for(string::size_type t=str.find('\t');t!=string::npos;t=str.find('\t')) {
302 str.replace(t,1,8-(t%8),' ');
303 }
304 char tln[16];
305 snprintf(tln,sizeof(tln),"%5d",l);
306 <%output>
307 <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>
308 </%output>
309 }
310 <%output></ul></%output>
311 }
312 }
313 }
314 </%code>
315 <div class="what">
316 <% sitecing::html_escape(message,sitecing::html_escape_br) %>
317 </div>
318 </div>
319</%method>
320<%codemethod string strip_roots(const string& filename) %>
321 string np = sitecing::normalize_path(filename);
322 try{
323 return sitecing::strip_prefix(np,root_source);
324 }catch(sitecing::utility_no_prefix& e){ }
325 try{
326 return sitecing::strip_prefix(np,root_intermediate);
327 }catch(sitecing::utility_no_prefix& e){ }
328</%codemethod>
329<%codemethod string remove_roots(const string& str) %>
330 string rv = str;
331 string::size_type rp;
332 string::size_type rl = root_source.length();
333 while((rp=rv.find(root_source))!=string::npos) {
334 rv.erase(rp,rl);
335 }
336 rl = root_intermediate.length();
337 while((rp=rv.find(root_intermediate))!=string::npos) {
338 rv.erase(rp,rl);
339 }
340 rl = root_so.length();
341 while((rp=rv.find(root_so))!=string::npos) {
342 rv.erase(rp,rl);
343 }
344 return rv;
345</%codemethod>
346% /* 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 @@
1<%code>
2 /* vim:set ft=sitecing: */
3 __SCIF->headers.clear(); /* reset all headers possibly set by the component throwing an exception. */
4 __SCIF->out->seekp(0); /* rollback the output that the exceptional component may have produced. */
5 /* set out headers */
6 __SCIF->headers["Content-Type"] = "text/html";
7 __SCIF->headers["Status"] = "500 server-side exception";
8 __SCIF->headers["Pragma"] = "no-cache";
9</%code>
10<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
11<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
12 <head>
13 <title>Server-side exception</title>
14 <style type="text/css">
15 <!--
16 body {
17 font-family: sans-serif;
18 font-size: 12pt;
19 }
20 h1 {
21 font-family: serif;
22 font-size: 130%;
23 font-weight: bold;
24 text-align: center;
25 }
26 p {
27 text-indent: 2em;
28 text-align: justify;
29 }
30
31 div.powered {
32 margin: 2em 0px 0px 50%;
33 padding: 1ex 2ex;
34 text-align: right;
35 font-family: serif;
36 font-size: 140%;
37 font-weight: bold;
38 border-top: solid 2px black;
39 border-left: solid 1px gray; border-right: solid 1px gray; border-bottom: solid 1px gray;
40 background: #c0c0f0;
41 }
42 -->
43 </style>
44 </head>
45 <body>
46 <h1>server-side exception</h1>
47 <p>Something has gone really wrong with the server. Feel free to report the
48 incident to <a href="mailto:<% __CGI->get_meta("SERVER_ADMIN") %>" title="e-mail
49 server administrator">webmaster</a>.</p>
50 <div class="powered">Powered by <a href="http://kin.klever.net/sitecing/" title="site-C-ing">site-C-ing</a>.</div>
51 </body>
52</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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3<%codemethod string title() %>
4 return "introduction";
5</%codemethod>
6<%method void content() %>
7 <h1>introduction to site-C-ing</h1>
8 <p>
9 This is a sample site, which is supposed to demonstrate <em>site-C-ing</em>
10 features. Since the <em>site-C-ing</em> is still at the early stages of
11 development or rather proof of concept, this site is also far from being
12 complete. I am planning to add more pages as the time permits, though.
13 </p>
14 <p>
15 Once you download and install <a
16 href="http://kin.klever.net/sitecing/">site-C-ing</a> you may wish to try
17 this sample site for yourself. The source is available from <a
18 href="http://kin.klever.net/sitecing/sources">the site-C-ing download
19 page</a>. After you download the source code, you should configure it using
20 the ever so popular <code>configure</code> script. It is likely that you will
21 want to pass the <code>--with-vhostname</code> option to configure to name
22 the apache virtual host.
23 </p>
24 <p>
25 The configure script will generate the apache vhost configuration for you,
26 which you can <code>Include</code> in the main apache configuration file.
27 </p>
28 <p class="note">
29 Note, that the configuration is tailored for apache 2.x. It is no problem to
30 get it working with apache 1.3.x, although I haven't tried and so I am not
31 sure if it will run out of the box (your patches are <a
32 href="mailto:sitecing-patches@klever.net">welcome</a>). Also note that you
33 will need <a href="http://fastcgi.com/">mod_fastcgi</a> apache module, which
34 is the only CGI-interface supported by the <em>site-C-ing</em> engine at the
35 moment.
36 </p>
37 <p>
38 Once you get it all done you will want to restart your apache and start the
39 <em>site-C-ing</em> fastcgi server by issuing the <code>make restart</code>
40 command.
41 </p>
42 <p>
43 Before you download it, you may wish to <a href="/sources" title="source
44 browser">examine the sources</a> to learn more about how it is done.
45 </p>
46</%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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive layout = "/ancestry/layout.chtml";
3%%derive sources = "/ancestry/sources.chtml";
4<%impl>
5 #include <sitecing/sitecing_util.h>
6</%impl>
7<%constructor>
8 b_strict = false;
9</%constructor>
10<%codemethod string title() %>
11 return "runtime exceptions handling";
12</%codemethod>
13<%method void content() %>
14 <h1>browse this site sources</h1>
15
16 <ul class="sourcebrowser">
17% for(int n=0;n<source_files_count;n++) {
18% sourcefile_t& sf = source_files[n];
19% if(!sf.name) { /* the beginning or the end of the directory */
20% if(sf.dir) { /* the beginning */
21 <li class="dir"><% sf.dir %>/<ul class="dir">
22% }else{ /* the end */
23 </ul></li>
24% }
25% }else{
26 <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li>
27% }
28% }
29 </ul>
30
31 <%code>
32 string rfile = sitecing::normalize_path(
33 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"),
34 sitecing::restrict_dotdot|sitecing::strip_leading_slash );
35 if(rfile.empty())
36 rfile = "about:blank";
37 else
38 rfile = "/view/"+rfile;
39 </%code>
40 <div class="insert">
41 <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300">
42 <p>I wanted to put an &lt;iframe&gt; here, but your browser does not seem to
43 support it. That is okay, it still will open links somehow.</p>
44 </iframe>
45 </div>
46
47</%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 @@
1body {
2 font-family: sans-serif;
3 font-size: 11pt;
4}
5
6a {
7 text-decoration: none;
8}
9a:hover {
10 text-decoration: underline;
11}
12p {
13 margin: 1ex 1em;
14 text-indent: 2em;
15 text-align: justify;
16}
17p.note {
18 margin-left: 10%;
19 border-width: 1px 1px 1px 6px;
20 border-color: gray gray gray #0000a0;
21 border-style: solid solid solid double;
22 padding: 1ex 1ex 1ex 2em;
23 font-size: 80%;
24 background: #c0c0e0;
25 color: #202020;
26}
27code {
28 color: #d04040;
29}
30em {
31 white-space: nowrap;
32}
33
34div.google_ad {
35 text-align: center;
36 margin: 1ex;
37}
38div.google_ad.top {
39 padding-bottom: 1ex;
40 border-bottom: 1px gray solid;
41}
42div.google_ad.bottom {
43 padding-top: 1ex;
44 border-top: 1px gray solid;
45}
46
47div#sidepanel {
48 position: absolute; top: 0px; left: 0px;
49 margin: 0px;
50 width: 20%;
51 font-size: 80%;
52}
53div#content {
54 position: absolute; top: 0px; right: -0px;
55 margin: 0px;
56 width: 80%;
57}
58
59div#sidepanel h1 {
60 font-size: 80%;
61 text-align: center;
62 font-weight: normal;
63 color: #004080;
64 white-space: nowrap;
65 margin-top: 2ex; margin-bottom: 2ex;
66}
67div#sidepanel ul {
68 padding: 1ex 0.5ex 1ex 1ex;
69 margin: 0.5ex;
70 border-color: #c0c0c0 #404040 #404040 #c0c0c0;
71 border-width: 1px 2px 2px 1px;
72 border-style: solid;
73 background: #d0d0d0;
74 list-style-type: none;
75}
76div#sidepanel ul ul {
77 margin: 0px; padding: 0px;
78 border: none 0px;
79}
80div#sidepanel li {
81 list-style-type: none;
82 margin: 0px; padding: 0px;
83 display: block;
84}
85div#sidepanel ul a {
86 display: block;
87 padding: 1px 1ex;
88 margin: 0.5ex;
89 border: 1px solid gray;
90 text-decoration: none;
91 background: white;
92 color: black;
93}
94div#sidepanel ul a:hover {
95 background: gray;
96 color: white;
97}
98div#sidepanel ul ul a {
99 padding-left: 2.5ex;
100 background: #e0e0e0;
101}
102div#sidepanel div.copyright {
103 text-align: center;
104}
105
106div#content h1 {
107 font-size: 140%;
108 color: gray;
109 font-weight: bold;
110 text-align: center;
111 margin: 1em;
112}
113
114div.insert {
115 text-align: center;
116}
117iframe#insert {
118 border: 1px solid black;
119}
120
121div.source h1 {
122 background: #e0e0e0;
123 border: 1px solid #808080;
124 padding-left: 1em;
125 margin: 0px;
126 font-size: 100%;
127 color: #000060;
128 overflow: hidden;
129}
130div.source ul {
131 background: #80c0c0;
132 margin: 0px;
133 padding: 1px 0.5ex;
134 font-family: monospace;
135 font-size: 80%;
136 overflow: hidden;
137}
138div.source li {
139 list-style-type: none;
140 white-space: nowrap;
141}
142
143ul.sourcebrowser {
144 font-size: 70%;
145}
146ul.sourcebrowser ul.dir {
147 padding: 1px 0px 2px 1em;
148 margin: 1px 0px 1px 0px;
149}
150ul.sourcebrowser li.dir {
151 margin: 1px 0px 1px 0px;
152}
153ul.sourcebrowser li.file {
154 list-style-type: none;
155 white-space: nowrap;
156 display: inline;
157}
158ul.sourcebrowser li.file a {
159 border: 1px solid gray;
160 padding: 1px 0.5ex;
161 text-decoration: none;
162 font-family: monospace;
163}
164ul.sourcebrowser li.file a:hover {
165 background: gray;
166 border: 1px solid black;
167 color: white;
168}
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 @@
1% html(); return; /* vim:set ft=sitecing: */
2%%derive page = "/ancestry/page.chtml";
3%%derive sources = "/ancestry/sources.chtml";
4<%impl>
5 #include <iostream>
6 #include <fstream>
7 using namespace std;
8 #include <sitecing/util.h>
9 #include <sitecing/sitecing_util.h>
10 #include <konforka/exception.h>
11 #include "acconfig.h"
12</%impl>
13<%codemethod string title() %>
14 return "introduction";
15</%codemethod>
16<%method void body() %>
17 <%code>
18 string rfile = sitecing::normalize_path(
19 sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"),
20 sitecing::restrict_dotdot|sitecing::strip_leading_slash );
21 sourcefile_t *sof = 0;
22 for(int n=0;n<source_files_count;n++) {
23 sof = &source_files[n];
24 if(sof->name && sof->dir) {
25 if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile)
26 break;
27 }
28 sof = 0;
29 }
30 if(!sof)
31 throw konforka::exception(CODEPOINT,"no access to the file allowed");
32 string afile = sitecing::combine_path(WEB_ROOT,rfile,0);
33 </%code>
34 <div class="source">
35 <h1><% rfile %></h1>
36 <ul>
37 <%code>
38 ifstream sf(afile.c_str());
39 if(!sf.good())
40 throw konforka::exception(CODEPOINT,"could not open source file");
41 while(!sf.eof()) {
42 string sfl;
43 getline(sf,sfl);
44 for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) {
45 sfl.replace(t,1,8-(t%8),' ');
46 }
47 <%output>
48 <li><% sfl.empty()?"&nbsp;":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li>
49 </%output>
50 }
51 </%code>
52 </ul>
53 </div>
54</%method>