comparison src/cjr_print.sml @ 2212:388ba4dc7c96

Small cleanup.
author Ziv Scully <ziv@mit.edu>
date Mon, 15 Sep 2014 20:01:16 -0400
parents ef766ef6e242
children 365727ff68f4
comparison
equal deleted inserted replaced
2211:ef766ef6e242 2212:388ba4dc7c96
3391 newline, 3391 newline,
3392 string "static int uw_db_rollback(uw_context ctx) { return 0; };"], 3392 string "static int uw_db_rollback(uw_context ctx) { return 0; };"],
3393 newline, 3393 newline,
3394 newline, 3394 newline,
3395 3395
3396 (* For caching. *) 3396 (* For sqlcache. *)
3397 box (List.map 3397 box (List.map
3398 (fn index => 3398 (fn index =>
3399 let val i = Int.toString index 3399 let val i = Int.toString index
3400 in box [string "static char *cache", 3400 in box [string "static char *cache",
3401 string i, 3401 string i,
3402 string " = NULL;", 3402 string " = NULL;",
3403 newline, 3403 newline,
3404 string "static uw_Basis_bool uw_Cache_check", 3404 string "static uw_Basis_bool uw_Cache_check",
3405 string i, 3405 string i,
3406 string "(uw_context ctx) { puts(\"Checked cache ", 3406 string "(uw_context ctx) { puts(\"SQLCACHE: checked ",
3407 string i, 3407 string i,
3408 string ".\"); if (cache", 3408 string ".\"); if (cache",
3409 string i, 3409 string i,
3410 string " == NULL) { uw_recordingStart(ctx); return uw_Basis_False; } else { uw_write(ctx, cache", 3410 string " == NULL) { uw_recordingStart(ctx); return uw_Basis_False; } else { uw_write(ctx, cache",
3411 string i, 3411 string i,
3412 string "); return uw_Basis_True; } };", 3412 string "); puts(\"SQLCACHE: used ",
3413 string i,
3414 string ".\"); return uw_Basis_True; } };",
3413 newline, 3415 newline,
3414 string "static uw_unit uw_Cache_store", 3416 string "static uw_unit uw_Cache_store",
3415 string i, 3417 string i,
3416 string "(uw_context ctx) { cache", 3418 string "(uw_context ctx) { cache",
3417 string i, 3419 string i,
3418 string " = uw_recordingRead(ctx); puts(\"Stored cache ", 3420 string " = uw_recordingRead(ctx); puts(\"SQLCACHE: stored ",
3419 string i, 3421 string i,
3420 string ".\"); return uw_unit_v; };", 3422 string ".\"); return uw_unit_v; };",
3421 newline, 3423 newline,
3422 string "static uw_unit uw_Cache_flush", 3424 string "static uw_unit uw_Cache_flush",
3423 string i, 3425 string i,
3424 string "(uw_context ctx) { free(cache", 3426 string "(uw_context ctx) { free(cache",
3425 string i, 3427 string i,
3426 string "); cache", 3428 string "); cache",
3427 string i, 3429 string i,
3428 string " = NULL; puts(\"Flushed cache ", 3430 string " = NULL; puts(\"SQLCACHE: flushed ",
3429 string i, 3431 string i,
3430 string ".\"); return uw_unit_v; };", 3432 string ".\"); return uw_unit_v; };",
3431 newline, 3433 newline,
3432 string "static uw_unit uw_Cache_ready", 3434 string "static uw_unit uw_Cache_ready",
3433 string i, 3435 string i,
3562 newline]), 3564 newline]),
3563 string ("uw_write_header(ctx, \"Last-Modified: " ^ Date.fmt rfcFmt (Date.fromTimeUniv (#LastModified r)) ^ "\\r\\n\");"), 3565 string ("uw_write_header(ctx, \"Last-Modified: " ^ Date.fmt rfcFmt (Date.fromTimeUniv (#LastModified r)) ^ "\\r\\n\");"),
3564 newline, 3566 newline,
3565 string ("uw_write_header(ctx, \"Content-Length: " ^ Int.toString (Word8Vector.length (#Bytes r)) ^ "\\r\\n\");"), 3567 string ("uw_write_header(ctx, \"Content-Length: " ^ Int.toString (Word8Vector.length (#Bytes r)) ^ "\\r\\n\");"),
3566 newline, 3568 newline,
3567 string ("uw_write_header(ctx, \"Cache-Control: max-age=31536000, public\\r\\n\");"), 3569 string ("uw_write_header(ctx, \"Cache-Control: max-age=31536000, public\\r\\n\");"),
3568 newline, 3570 newline,
3569 string "uw_replace_page(ctx, \"", 3571 string "uw_replace_page(ctx, \"",
3570 string (hexify (#Bytes r)), 3572 string (hexify (#Bytes r)),
3571 string "\", ", 3573 string "\", ",
3572 string (Int.toString (Word8Vector.length (#Bytes r))), 3574 string (Int.toString (Word8Vector.length (#Bytes r))),