summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-08-21 10:55:31 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-08-21 10:55:31 -0400
commit1e022eb78e7ca3fd15634e3845756b9c14209cf3 (patch)
tree0838befdc51675455f8e33e979e23dcfaf06eeb5 /src
parentf1096b0e7bd380e9ccfb1438548596fe9e9ab5e9 (diff)
Add prototypes for [un]urlification functions
Diffstat (limited to 'src')
-rw-r--r--src/cjr_print.sml76
1 files changed, 72 insertions, 4 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index fb36e36e..0b900218 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -524,7 +524,7 @@ fun capitalize s =
str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
local
- val urlHandlers = ref ([] : pp_desc list)
+ val urlHandlers = ref ([] : (pp_desc * pp_desc) list)
in
fun addUrlHandler v = urlHandlers := v :: !urlHandlers
@@ -648,6 +648,14 @@ fun unurlify fromClient env (t, loc) =
space,
string "*unurlify_",
string (Int.toString i),
+ string "(uw_context, char **);",
+ newline],
+ box [string "static",
+ space,
+ p_typ env t,
+ space,
+ string "*unurlify_",
+ string (Int.toString i),
string "(uw_context ctx, char **request) {",
newline,
box [string "return ((*request)[0] == '/' ? ++*request : *request,",
@@ -799,6 +807,14 @@ fun unurlify fromClient env (t, loc) =
space,
string "unurlify_",
string (Int.toString i),
+ string "(uw_context, char **);",
+ newline],
+ box [string "static",
+ space,
+ p_typ env (t, ErrorMsg.dummySpan),
+ space,
+ string "unurlify_",
+ string (Int.toString i),
string "(uw_context ctx, char **request) {",
newline,
box [string "return",
@@ -828,6 +844,14 @@ fun unurlify fromClient env (t, loc) =
space,
string "unurlify_list_",
string (Int.toString i),
+ string "(uw_context, char **);",
+ newline],
+ box [string "static",
+ space,
+ p_typ env (t, loc),
+ space,
+ string "unurlify_list_",
+ string (Int.toString i),
string "(uw_context ctx, char **request) {",
newline,
box [string "return ((*request)[0] == '/' ? ++*request : *request,",
@@ -1037,6 +1061,22 @@ fun urlify env t =
space,
string "urlify_",
string (Int.toString i),
+ string "(uw_context,",
+ space,
+ p_typ env t,
+ space,
+ if isUnboxable t then
+ box []
+ else
+ string "*",
+ string ");",
+ newline],
+ box [string "static",
+ space,
+ string "void",
+ space,
+ string "urlify_",
+ string (Int.toString i),
string "(uw_context ctx,",
space,
p_typ env t,
@@ -1153,6 +1193,17 @@ fun urlify env t =
space,
string "urlify_",
string (Int.toString i),
+ string "(uw_context,",
+ space,
+ p_typ env t,
+ string ");",
+ newline],
+ box [string "static",
+ space,
+ string "void",
+ space,
+ string "urlify_",
+ string (Int.toString i),
string "(uw_context ctx,",
space,
p_typ env t,
@@ -1226,6 +1277,19 @@ fun urlify env t =
space,
string "urlifyl_",
string (Int.toString i),
+ string "(uw_context,",
+ space,
+ string "struct __uws_",
+ string (Int.toString i),
+ space,
+ string "*);",
+ newline],
+ box [string "static",
+ space,
+ string "void",
+ space,
+ string "urlifyl_",
+ string (Int.toString i),
string "(uw_context ctx,",
space,
string "struct __uws_",
@@ -2323,8 +2387,10 @@ fun p_file env (ds, ps) =
val (pds, env) = ListUtil.foldlMap (fn (d, env) =>
let
val d' = p_decl env d
+ val hs = latestUrlHandlers ()
+ val (protos, defs) = ListPair.unzip hs
in
- (box (List.revAppend (latestUrlHandlers (), [d'])),
+ (box (List.revAppend (protos, (List.revAppend (defs, [d'])))),
E.declBinds env d)
end)
env ds
@@ -2848,7 +2914,8 @@ fun p_file env (ds, ps) =
in
(p', latestUrlHandlers () @ handlers)
end) [] ps
-
+ val (protos, defs) = ListPair.unzip handlers
+
val hasDb = ref false
val tables = ref []
val views = ref []
@@ -3120,7 +3187,8 @@ fun p_file env (ds, ps) =
newline,
newline,
- box (rev handlers),
+ box (rev protos),
+ box (rev defs),
string "static void uw_handle(uw_context ctx, char *request) {",
newline,