slang-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] preprocessor module


On Fri, Oct 15, 2004 at 10:11:51AM -0400, Michael Noble wrote:
> Perhaps SLIRP 1.5.0, even in beta form, will be of assistance here, so
> I plopped at tarball at
> 
> 	ftp://space.mit.edu/pub/mnoble/slirp/slirp-1.5.0-beta1.tar.gz
The preprocessor module is interesting.

#v+
static define html_handler(line)
{
   if (line != NULL)
     ()=printf("%S", line);
}
preproc_handler_add("html",, &html_handler);
#html
<html>
  <head>
    <title>The table of multiplication of two
  </head>
  <body>
#end
variable i;
_for (1, 10, 1)
{
   i=();
   vmessage ("%d * 2 = %d", i, 2 * i);
#html
  <br>
#end
}
#html
  </body>
</html>
#v-

Outputs

#v+
<html>
  <head>
    <title>The table of multiplication of two
  </head>
  <body>

  <br>
1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
4 * 2 = 8
5 * 2 = 10
6 * 2 = 12
7 * 2 = 14
8 * 2 = 16
9 * 2 = 18
10 * 2 = 20

  </body>
</html>
#v-

It's a shame the <br> is only printed once. Still, with this, the mysql
module and the cgi module we can take over the World Wide Web!

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]