comparison src/demo.sml @ 776:9f2555f06901

upload demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 May 2009 12:49:47 -0400
parents 412ccd97ab71
children 305bc0a431de
comparison
equal deleted inserted replaced
775:a8bdd5a0d9b0 776:9f2555f06901
361 TextIO.closeOut urOut) 361 TextIO.closeOut urOut)
362 362
363 val fname = OS.Path.joinDirFile {dir = dirname, 363 val fname = OS.Path.joinDirFile {dir = dirname,
364 file = "demo.urp"} 364 file = "demo.urp"}
365 val outf = TextIO.openOut fname 365 val outf = TextIO.openOut fname
366
367 fun filters kind =
368 app (fn rule : Settings.rule =>
369 (TextIO.output (outf, case #action rule of
370 Settings.Allow => "allow"
371 | Settings.Deny => "deny");
372 TextIO.output (outf, " ");
373 TextIO.output (outf, kind);
374 TextIO.output (outf, " ");
375 TextIO.output (outf, #pattern rule);
376 case #kind rule of
377 Settings.Exact => ()
378 | Settings.Prefix => TextIO.output (outf, "*");
379 TextIO.output (outf, "\n")))
366 in 380 in
367 Option.app (fn db => (TextIO.output (outf, "database "); 381 Option.app (fn db => (TextIO.output (outf, "database ");
368 TextIO.output (outf, db); 382 TextIO.output (outf, db);
369 TextIO.output (outf, "\n"))) 383 TextIO.output (outf, "\n")))
370 (#database combined); 384 (#database combined);
389 Settings.Exact => () 403 Settings.Exact => ()
390 | Settings.Prefix => TextIO.output (outf, "*"); 404 | Settings.Prefix => TextIO.output (outf, "*");
391 TextIO.output (outf, " "); 405 TextIO.output (outf, " ");
392 TextIO.output (outf, #to rule); 406 TextIO.output (outf, #to rule);
393 TextIO.output (outf, "\n"))) (#rewrites combined); 407 TextIO.output (outf, "\n"))) (#rewrites combined);
394 app (fn rule => 408 filters "url" (#filterUrl combined);
395 (TextIO.output (outf, case #action rule of 409 filters "mime" (#filterMime combined);
396 Settings.Allow => "allow"
397 | Settings.Deny => "deny");
398 TextIO.output (outf, " url ");
399 TextIO.output (outf, #pattern rule);
400 case #kind rule of
401 Settings.Exact => ()
402 | Settings.Prefix => TextIO.output (outf, "*");
403 TextIO.output (outf, "\n"))) (#filterUrl combined);
404 TextIO.output (outf, "\n"); 410 TextIO.output (outf, "\n");
405 411
406 app (fn s => 412 app (fn s =>
407 let 413 let
408 val s = OS.Path.mkAbsolute {relativeTo = OS.FileSys.getDir (), 414 val s = OS.Path.mkAbsolute {relativeTo = OS.FileSys.getDir (),