Mercurial > urweb
comparison src/compiler.sml @ 766:df09c95085f8
More FFI compiler options
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 02 May 2009 12:10:43 -0400 |
parents | a28982de5645 |
children | d27ed5ddeb52 |
comparison
equal
deleted
inserted
replaced
765:a28982de5645 | 766:df09c95085f8 |
---|---|
43 profile : bool, | 43 profile : bool, |
44 timeout : int, | 44 timeout : int, |
45 ffi : string list, | 45 ffi : string list, |
46 link : string list, | 46 link : string list, |
47 headers : string list, | 47 headers : string list, |
48 scripts : string list, | |
48 clientToServer : Settings.ffi list, | 49 clientToServer : Settings.ffi list, |
49 effectful : Settings.ffi list, | 50 effectful : Settings.ffi list, |
50 clientOnly : Settings.ffi list, | 51 clientOnly : Settings.ffi list, |
51 serverOnly : Settings.ffi list, | 52 serverOnly : Settings.ffi list, |
52 jsFuncs : (Settings.ffi * string) list | 53 jsFuncs : (Settings.ffi * string) list |
206 end | 207 end |
207 handle LrParser.ParseError => [], | 208 handle LrParser.ParseError => [], |
208 print = SourcePrint.p_file} | 209 print = SourcePrint.p_file} |
209 | 210 |
210 fun p_job {prefix, database, exe, sql, sources, debug, profile, | 211 fun p_job {prefix, database, exe, sql, sources, debug, profile, |
211 timeout, ffi, link, headers, | 212 timeout, ffi, link, headers, scripts, |
212 clientToServer, effectful, clientOnly, serverOnly, jsFuncs} = | 213 clientToServer, effectful, clientOnly, serverOnly, jsFuncs} = |
213 let | 214 let |
214 open Print.PD | 215 open Print.PD |
215 open Print | 216 open Print |
216 | 217 |
239 string "Timeout: ", | 240 string "Timeout: ", |
240 string (Int.toString timeout), | 241 string (Int.toString timeout), |
241 newline, | 242 newline, |
242 p_list_sep (box []) (fn s => box [string "Ffi", space, string s, newline]) ffi, | 243 p_list_sep (box []) (fn s => box [string "Ffi", space, string s, newline]) ffi, |
243 p_list_sep (box []) (fn s => box [string "Header", space, string s, newline]) headers, | 244 p_list_sep (box []) (fn s => box [string "Header", space, string s, newline]) headers, |
245 p_list_sep (box []) (fn s => box [string "Script", space, string s, newline]) scripts, | |
244 p_list_sep (box []) (fn s => box [string "Link", space, string s, newline]) link, | 246 p_list_sep (box []) (fn s => box [string "Link", space, string s, newline]) link, |
245 p_ffi "ClientToServer" clientToServer, | 247 p_ffi "ClientToServer" clientToServer, |
246 p_ffi "Effectful" effectful, | 248 p_ffi "Effectful" effectful, |
247 p_ffi "ClientOnly" clientOnly, | 249 p_ffi "ClientOnly" clientOnly, |
248 p_ffi "ServerOnly" serverOnly, | 250 p_ffi "ServerOnly" serverOnly, |
303 val profile = ref false | 305 val profile = ref false |
304 val timeout = ref NONE | 306 val timeout = ref NONE |
305 val ffi = ref [] | 307 val ffi = ref [] |
306 val link = ref [] | 308 val link = ref [] |
307 val headers = ref [] | 309 val headers = ref [] |
310 val scripts = ref [] | |
308 val clientToServer = ref [] | 311 val clientToServer = ref [] |
309 val effectful = ref [] | 312 val effectful = ref [] |
310 val clientOnly = ref [] | 313 val clientOnly = ref [] |
311 val serverOnly = ref [] | 314 val serverOnly = ref [] |
312 val jsFuncs = ref [] | 315 val jsFuncs = ref [] |
321 profile = !profile, | 324 profile = !profile, |
322 timeout = Option.getOpt (!timeout, 60), | 325 timeout = Option.getOpt (!timeout, 60), |
323 ffi = rev (!ffi), | 326 ffi = rev (!ffi), |
324 link = rev (!link), | 327 link = rev (!link), |
325 headers = rev (!headers), | 328 headers = rev (!headers), |
329 scripts = rev (!scripts), | |
326 clientToServer = rev (!clientToServer), | 330 clientToServer = rev (!clientToServer), |
327 effectful = rev (!effectful), | 331 effectful = rev (!effectful), |
328 clientOnly = rev (!clientOnly), | 332 clientOnly = rev (!clientOnly), |
329 serverOnly = rev (!serverOnly), | 333 serverOnly = rev (!serverOnly), |
330 jsFuncs = rev (!jsFuncs), | 334 jsFuncs = rev (!jsFuncs), |
385 | SOME _ => ErrorMsg.error "Duplicate 'timeout' directive"; | 389 | SOME _ => ErrorMsg.error "Duplicate 'timeout' directive"; |
386 timeout := SOME (valOf (Int.fromString arg))) | 390 timeout := SOME (valOf (Int.fromString arg))) |
387 | "ffi" => ffi := relify arg :: !ffi | 391 | "ffi" => ffi := relify arg :: !ffi |
388 | "link" => link := relifyA arg :: !link | 392 | "link" => link := relifyA arg :: !link |
389 | "include" => headers := relifyA arg :: !headers | 393 | "include" => headers := relifyA arg :: !headers |
394 | "script" => scripts := arg :: !scripts | |
390 | "clientToServer" => clientToServer := ffiS () :: !clientToServer | 395 | "clientToServer" => clientToServer := ffiS () :: !clientToServer |
391 | "effectful" => effectful := ffiS () :: !effectful | 396 | "effectful" => effectful := ffiS () :: !effectful |
392 | "clientOnly" => clientOnly := ffiS () :: !clientOnly | 397 | "clientOnly" => clientOnly := ffiS () :: !clientOnly |
393 | "serverOnly" => serverOnly := ffiS () :: !serverOnly | 398 | "serverOnly" => serverOnly := ffiS () :: !serverOnly |
394 | "jsFunc" => jsFuncs := ffiM () :: !jsFuncs | 399 | "jsFunc" => jsFuncs := ffiM () :: !jsFuncs |
400 in | 405 in |
401 TextIO.closeIn inf; | 406 TextIO.closeIn inf; |
402 Settings.setUrlPrefix (#prefix job); | 407 Settings.setUrlPrefix (#prefix job); |
403 Settings.setTimeout (#timeout job); | 408 Settings.setTimeout (#timeout job); |
404 Settings.setHeaders (#headers job); | 409 Settings.setHeaders (#headers job); |
410 Settings.setScripts (#scripts job); | |
405 Settings.setClientToServer (#clientToServer job); | 411 Settings.setClientToServer (#clientToServer job); |
406 Settings.setEffectful (#effectful job); | 412 Settings.setEffectful (#effectful job); |
407 Settings.setClientOnly (#clientOnly job); | 413 Settings.setClientOnly (#clientOnly job); |
408 Settings.setServerOnly (#serverOnly job); | 414 Settings.setServerOnly (#serverOnly job); |
409 Settings.setJsFuncs (#jsFuncs job); | 415 Settings.setJsFuncs (#jsFuncs job); |