comparison src/cjr_print.sml @ 1349:87156c44824f

Periodic tasks
author Adam Chlipala <adam@chlipala.net>
date Sat, 18 Dec 2010 15:17:09 -0500
parents 8a169fc0838b
children 02fc16faecf3
comparison
equal deleted inserted replaced
1348:8a169fc0838b 1349:87156c44824f
2794 string "}", 2794 string "}",
2795 newline] 2795 newline]
2796 2796
2797 val initializers = List.mapPartial (fn (DTask (Initialize, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds 2797 val initializers = List.mapPartial (fn (DTask (Initialize, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds
2798 val expungers = List.mapPartial (fn (DTask (ClientLeaves, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds 2798 val expungers = List.mapPartial (fn (DTask (ClientLeaves, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds
2799 val periodics = List.mapPartial (fn (DTask (Periodic n, x1, x2, e), _) => SOME (n, x1, x2, e) | _ => NONE) ds
2799 2800
2800 val onError = ListUtil.search (fn (DOnError n, _) => SOME n | _ => NONE) ds 2801 val onError = ListUtil.search (fn (DOnError n, _) => SOME n | _ => NONE) ds
2801 2802
2802 val now = Time.now () 2803 val now = Time.now ()
2803 val nowD = Date.fromTimeUniv now 2804 val nowD = Date.fromTimeUniv now
2885 newline, 2886 newline,
2886 string "static int uw_db_rollback(uw_context ctx) { return 0; };"], 2887 string "static int uw_db_rollback(uw_context ctx) { return 0; };"],
2887 newline, 2888 newline,
2888 newline, 2889 newline,
2889 2890
2891 box (ListUtil.mapi (fn (i, (_, x1, x2, e)) =>
2892 box [string "static void uw_periodic",
2893 string (Int.toString i),
2894 string "(uw_context ctx) {",
2895 newline,
2896 box [string "uw_unit __uwr_",
2897 string x1,
2898 string "_0 = uw_unit_v, __uwr_",
2899 string x2,
2900 string "_1 = uw_unit_v;",
2901 newline,
2902 p_exp (E.pushERel (E.pushERel env x1 dummyt) x2 dummyt) e,
2903 string ";",
2904 newline],
2905 string "}",
2906 newline,
2907 newline]) periodics),
2908
2909 string "static uw_periodic my_periodics[] = {",
2910 box (ListUtil.mapi (fn (i, (n, _, _, _)) =>
2911 box [string "{uw_periodic",
2912 string (Int.toString i),
2913 string ",",
2914 space,
2915 string (Int64.toString n),
2916 string "},"]) periodics),
2917 string "{NULL}};",
2918 newline,
2919 newline,
2920
2890 string "static const char begin_xhtml[] = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\\n<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xml:lang=\\\"en\\\" lang=\\\"en\\\">\";", 2921 string "static const char begin_xhtml[] = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\\n<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xml:lang=\\\"en\\\" lang=\\\"en\\\">\";",
2891 newline, 2922 newline,
2892 newline, 2923 newline,
2893 2924
2894 p_list_sep newline (fn x => x) pds, 2925 p_list_sep newline (fn x => x) pds,
3041 "\"" ^ Settings.getUrlPrefix () ^ "\"", 3072 "\"" ^ Settings.getUrlPrefix () ^ "\"",
3042 "uw_client_init", "uw_initializer", "uw_expunger", 3073 "uw_client_init", "uw_initializer", "uw_expunger",
3043 "uw_db_init", "uw_db_begin", "uw_db_commit", "uw_db_rollback", "uw_db_close", 3074 "uw_db_init", "uw_db_begin", "uw_db_commit", "uw_db_rollback", "uw_db_close",
3044 "uw_handle", 3075 "uw_handle",
3045 "uw_input_num", "uw_cookie_sig", "uw_check_url", "uw_check_mime", 3076 "uw_input_num", "uw_cookie_sig", "uw_check_url", "uw_check_mime",
3046 case onError of NONE => "NULL" | SOME _ => "uw_onError"], 3077 case onError of NONE => "NULL" | SOME _ => "uw_onError", "my_periodics"],
3047 string "};", 3078 string "};",
3048 newline] 3079 newline]
3049 end 3080 end
3050 3081
3051 fun p_sql env (ds, _) = 3082 fun p_sql env (ds, _) =