comparison src/cjr_print.sml @ 1656:3e7c7e200713

Fix handling of quotes in generating C literals
author Adam Chlipala <adam@chlipala.net>
date Mon, 02 Jan 2012 17:08:39 -0500
parents 8938f7b31573
children 0577be31a435
comparison
equal deleted inserted replaced
1655:b694f9153faa 1656:3e7c7e200713
2386 newline] 2386 newline]
2387 | DDatabase _ => box [] 2387 | DDatabase _ => box []
2388 | DPreparedStatements _ => box [] 2388 | DPreparedStatements _ => box []
2389 2389
2390 | DJavaScript s => box [string "static char jslib[] = \"", 2390 | DJavaScript s => box [string "static char jslib[] = \"",
2391 string (String.toCString s), 2391 string (Prim.toCString s),
2392 string "\";"] 2392 string "\";"]
2393 | DCookie s => box [string "/*", 2393 | DCookie s => box [string "/*",
2394 space, 2394 space,
2395 string "cookie", 2395 string "cookie",
2396 space, 2396 space,
2861 prefix ^ String.extract (s, 1, NONE) 2861 prefix ^ String.extract (s, 1, NONE)
2862 else 2862 else
2863 prefix ^ s 2863 prefix ^ s
2864 in 2864 in
2865 box [string "if (!strncmp(request, \"", 2865 box [string "if (!strncmp(request, \"",
2866 string (String.toCString s), 2866 string (Prim.toCString s),
2867 string "\", ", 2867 string "\", ",
2868 string (Int.toString (size s)), 2868 string (Int.toString (size s)),
2869 string ") && (request[", 2869 string ") && (request[",
2870 string (Int.toString (size s)), 2870 string (Int.toString (size s)),
2871 string "] == 0 || request[", 2871 string "] == 0 || request[",
3088 box [p_list_sep (box []) 3088 box [p_list_sep (box [])
3089 (fn rule => 3089 (fn rule =>
3090 box [string "if (!str", 3090 box [string "if (!str",
3091 case #kind rule of 3091 case #kind rule of
3092 Settings.Exact => box [string "cmp(s, \"", 3092 Settings.Exact => box [string "cmp(s, \"",
3093 string (String.toCString (#pattern rule)), 3093 string (Prim.toCString (#pattern rule)),
3094 string "\"))"] 3094 string "\"))"]
3095 | Settings.Prefix => box [string "ncmp(s, \"", 3095 | Settings.Prefix => box [string "ncmp(s, \"",
3096 string (String.toCString (#pattern rule)), 3096 string (Prim.toCString (#pattern rule)),
3097 string "\", ", 3097 string "\", ",
3098 string (Int.toString (size (#pattern rule))), 3098 string (Int.toString (size (#pattern rule))),
3099 string "))"], 3099 string "))"],
3100 string " return ", 3100 string " return ",
3101 string (case #action rule of 3101 string (case #action rule of
3400 "uw_client_init", "uw_initializer", "uw_expunger", 3400 "uw_client_init", "uw_initializer", "uw_expunger",
3401 "uw_db_init", "uw_db_begin", "uw_db_commit", "uw_db_rollback", "uw_db_close", 3401 "uw_db_init", "uw_db_begin", "uw_db_commit", "uw_db_rollback", "uw_db_close",
3402 "uw_handle", 3402 "uw_handle",
3403 "uw_input_num", "uw_cookie_sig", "uw_check_url", "uw_check_mime", "uw_check_requestHeader", "uw_check_responseHeader", 3403 "uw_input_num", "uw_cookie_sig", "uw_check_url", "uw_check_mime", "uw_check_requestHeader", "uw_check_responseHeader",
3404 case onError of NONE => "NULL" | SOME _ => "uw_onError", "my_periodics", 3404 case onError of NONE => "NULL" | SOME _ => "uw_onError", "my_periodics",
3405 "\"" ^ String.toCString (Settings.getTimeFormat ()) ^ "\""], 3405 "\"" ^ Prim.toCString (Settings.getTimeFormat ()) ^ "\""],
3406 string "};", 3406 string "};",
3407 newline] 3407 newline]
3408 end 3408 end
3409 3409
3410 fun p_sql env (ds, _) = 3410 fun p_sql env (ds, _) =