comparison src/cjr_print.sml @ 922:d6a71f19a3d8

Find chances to use mstrcat()
author Adam Chlipala <adamc@hcoop.net>
date Wed, 09 Sep 2009 08:15:46 -0400
parents 7a4b026e45dd
children be6585b4058b
comparison
equal deleted inserted replaced
921:ae0110465421 922:d6a71f19a3d8
1465 string "})"] 1465 string "})"]
1466 | EApp ((EError (e, (TFun (_, ran), _)), loc), _) => 1466 | EApp ((EError (e, (TFun (_, ran), _)), loc), _) =>
1467 p_exp env (EError (e, ran), loc) 1467 p_exp env (EError (e, ran), loc)
1468 | EApp ((EReturnBlob {blob, mimeType, t = (TFun (_, ran), _)}, loc), _) => 1468 | EApp ((EReturnBlob {blob, mimeType, t = (TFun (_, ran), _)}, loc), _) =>
1469 p_exp env (EReturnBlob {blob = blob, mimeType = mimeType, t = ran}, loc) 1469 p_exp env (EReturnBlob {blob = blob, mimeType = mimeType, t = ran}, loc)
1470
1471 | EFfiApp ("Basis", "strcat", [e1, e2]) =>
1472 let
1473 fun flatten e =
1474 case #1 e of
1475 EFfiApp ("Basis", "strcat", [e1, e2]) => flatten e1 @ flatten e2
1476 | _ => [e]
1477 in
1478 case flatten e1 @ flatten e2 of
1479 [e1, e2] => box [string "uw_Basis_strcat(ctx, ",
1480 p_exp env e1,
1481 string ",",
1482 p_exp env e2,
1483 string ")"]
1484 | es => box [string "uw_Basis_mstrcat(ctx, ",
1485 p_list (p_exp env) es,
1486 string ", NULL)"]
1487 end
1470 1488
1471 | EFfiApp (m, x, []) => box [string "uw_", 1489 | EFfiApp (m, x, []) => box [string "uw_",
1472 p_ident m, 1490 p_ident m,
1473 string "_", 1491 string "_",
1474 p_ident x, 1492 p_ident x,