This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Re: advanced spagetti programming for athttpd jim tcl
On Fri, Nov 16, 2007 at 08:39:59AM +0100, Øyvind Harboe wrote:
> > Rough idea for a syntax of a ".tclp" file...
> >
> > <html>
> > <body>
> > Hello <tcl>write_chunked "testabc"</tcl>
> > </body>
> > </html>
>
> Implementation:
>
> - write a tcl script to convert a .tclp file to a .tcl file that runs
> on the developer machine
> - the converted .tcl file is then uploaded to the target
>
> Modifications to eCos repository:
>
> - commit said conversion tool as a host .tcl script
> - add a small example in the doc
>
I didn't saw many advantages in same two-stage generation of the HTML
templates. The main Tcl's power is the substitutions. If you look for
more information about dynamic page generation in Tcl and the HTM+Tcl
templates, please, read this nice document (a chapter from Brent Welch
book)
http://www.tcl.tk/software/tclhttpd/TCLHTTPD.html (online HTML)
http://www.tcl.tk/software/tclhttpd/tclhttpd.pdf (same in PDF)
Same code like the above I would prefer to write just in Tcl (no hyper
text), but this is just my opinion.
--------------------------------------------------------->8
#! env embedded
#
puts "content-type: text/html
<html>
<head><title>Dynamic Jim page</title></head>
<h1>ATHTTPD server uptime: [uptime]</h1>
</body></html>
"
--------------------------------------------------------->8
I would prefer a bit to modify Jim's source/puts commands to write cgi
scripts in Jim using usual Tcl semantic (without those *_chunked calls).
Jim_EvalFile() (cyg_httpd_exec_cgi_tcl() -> [source] -> Jim_EvalFile())
can check "shbang" in source and Jim will be know which [puts] version
it's needed to use. New [source] should call cyg_httpd_end_chunked() at
exit.
Sergei
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss