comparison src/compiler.sml @ 1164:8679ba87cf3c

sigfile directive
author Adam Chlipala <adamc@hcoop.net>
date Thu, 11 Feb 2010 09:10:01 -0500
parents ed3e5329b60e
children 52c6ac6a59f1
comparison
equal deleted inserted replaced
1163:6c507826fae9 1164:8679ba87cf3c
53 jsFuncs : (Settings.ffi * string) list, 53 jsFuncs : (Settings.ffi * string) list,
54 rewrites : Settings.rewrite list, 54 rewrites : Settings.rewrite list,
55 filterUrl : Settings.rule list, 55 filterUrl : Settings.rule list,
56 filterMime : Settings.rule list, 56 filterMime : Settings.rule list,
57 protocol : string option, 57 protocol : string option,
58 dbms : string option 58 dbms : string option,
59 sigFile : string option
59 } 60 }
60 61
61 type ('src, 'dst) phase = { 62 type ('src, 'dst) phase = {
62 func : 'src -> 'dst, 63 func : 'src -> 'dst,
63 print : 'dst -> Print.PD.pp_desc 64 print : 'dst -> Print.PD.pp_desc
377 val url = ref [] 378 val url = ref []
378 val mime = ref [] 379 val mime = ref []
379 val libs = ref [] 380 val libs = ref []
380 val protocol = ref NONE 381 val protocol = ref NONE
381 val dbms = ref NONE 382 val dbms = ref NONE
383 val sigFile = ref (Settings.getSigFile ())
382 384
383 fun finish sources = 385 fun finish sources =
384 let 386 let
385 val job = { 387 val job = {
386 prefix = Option.getOpt (!prefix, "/"), 388 prefix = Option.getOpt (!prefix, "/"),
403 rewrites = rev (!rewrites), 405 rewrites = rev (!rewrites),
404 filterUrl = rev (!url), 406 filterUrl = rev (!url),
405 filterMime = rev (!mime), 407 filterMime = rev (!mime),
406 sources = sources, 408 sources = sources,
407 protocol = !protocol, 409 protocol = !protocol,
408 dbms = !dbms 410 dbms = !dbms,
411 sigFile = !sigFile
409 } 412 }
410 413
411 fun mergeO f (old, new) = 414 fun mergeO f (old, new) =
412 case (old, new) of 415 case (old, new) of
413 (NONE, _) => new 416 (NONE, _) => new
444 filterMime = #filterMime old @ #filterMime new, 447 filterMime = #filterMime old @ #filterMime new,
445 sources = #sources new 448 sources = #sources new
446 @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new)) 449 @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new))
447 (#sources old), 450 (#sources old),
448 protocol = mergeO #2 (#protocol old, #protocol new), 451 protocol = mergeO #2 (#protocol old, #protocol new),
449 dbms = mergeO #2 (#dbms old, #dbms new) 452 dbms = mergeO #2 (#dbms old, #dbms new),
453 sigFile = mergeO #2 (#sigFile old, #sigFile new)
450 } 454 }
451 in 455 in
452 if accLibs then 456 if accLibs then
453 foldr (fn (job', job) => merge (job, job')) job (!libs) 457 foldr (fn (job', job) => merge (job, job')) job (!libs)
454 else 458 else
520 | SOME _ => ErrorMsg.error "Duplicate 'prefix' directive"; 524 | SOME _ => ErrorMsg.error "Duplicate 'prefix' directive";
521 prefix := SOME arg) 525 prefix := SOME arg)
522 | "database" => 526 | "database" =>
523 (case !database of 527 (case !database of
524 NONE => database := SOME arg 528 NONE => database := SOME arg
529 | SOME _ => ())
530 | "dbms" =>
531 (case !dbms of
532 NONE => dbms := SOME arg
533 | SOME _ => ())
534 | "sigfile" =>
535 (case !sigFile of
536 NONE => sigFile := SOME arg
525 | SOME _ => ()) 537 | SOME _ => ())
526 | "exe" => 538 | "exe" =>
527 (case !exe of 539 (case !exe of
528 NONE => exe := SOME (relify arg) 540 NONE => exe := SOME (relify arg)
529 | SOME _ => ()) 541 | SOME _ => ())