author | Michael Krelin <hacker@klever.net> | 2007-06-28 12:24:23 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-06-28 12:24:23 (UTC) |
commit | 3779aa290c30ee80976b63db0b8d17ab73f64847 (patch) (side-by-side diff) | |
tree | 5ed2262631bd8119c7d03710704812c2ef385eb7 /htdocs | |
parent | f58a286ee7b26101e97e5b69b6c026f4c33a037d (diff) | |
download | sitecing-showcase/master.zip sitecing-showcase/master.tar.gz sitecing-showcase/master.tar.bz2 |
imported amd64bit compile fixespublic/showcase/mastershowcase/master
-rw-r--r-- | htdocs/handlers/exception_dev | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/htdocs/handlers/exception_dev b/htdocs/handlers/exception_dev index d62f462..49b7f45 100644 --- a/htdocs/handlers/exception_dev +++ b/htdocs/handlers/exception_dev @@ -1,75 +1,75 @@ %%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/util.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; + va_list va; va_copy(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; @@ -281,67 +281,68 @@ <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> <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 = konforka::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){ } + return np; </%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: */ |