diff src/settings.sml @ 855:28e42b22424d

Initial implementation of protocols in Settings
author Adam Chlipala <adamc@hcoop.net>
date Tue, 23 Jun 2009 15:56:04 -0400
parents 6725d73c3c31
children 86ec89baee01
line wrap: on
line diff
--- a/src/settings.sml	Tue Jun 23 15:40:35 2009 -0400
+++ b/src/settings.sml	Tue Jun 23 15:56:04 2009 -0400
@@ -248,4 +248,27 @@
                     (CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #"."))
                     mime
 
+
+type protocol = {
+     name : string,
+     link : string,
+     supportsPush : bool
+}
+val protocols = ref ([] : protocol list)
+fun addProtocol p = protocols := p :: !protocols
+fun getProtocol s = List.find (fn p => #name p = s) (!protocols)
+
+fun clibFile s = OS.Path.joinDirFile {dir = Config.libC,
+                                      file = s}
+
+val http = {name = "http",
+            link = clibFile "request.o" ^ " " ^ clibFile "http.o",
+            supportsPush = true}
+
+val () = addProtocol http
+
+val curProto = ref http
+fun setProtocol p = curProto := p
+fun currentProtocol () = !curProto
+
 end