# HG changeset patch # User Adam Chlipala # Date 1220381967 14400 # Node ID ed4af33681d896407cdd68429cc2849c2602f945 # Parent 73456bfde98847cd6c783fa89ebdff4f0073963d Switch base types to 64-bit versions diff -r 73456bfde988 -r ed4af33681d8 include/types.h --- a/include/types.h Tue Sep 02 14:40:57 2008 -0400 +++ b/include/types.h Tue Sep 02 14:59:27 2008 -0400 @@ -1,5 +1,5 @@ -typedef int lw_Basis_int; -typedef float lw_Basis_float; +typedef long long lw_Basis_int; +typedef double lw_Basis_float; typedef char* lw_Basis_string; struct __lws_0 { diff -r 73456bfde988 -r ed4af33681d8 src/c/urweb.c --- a/src/c/urweb.c Tue Sep 02 14:40:57 2008 -0400 +++ b/src/c/urweb.c Tue Sep 02 14:59:27 2008 -0400 @@ -233,7 +233,7 @@ int len; lw_check_heap(ctx, INTS_MAX); result = ctx->heap_front; - sprintf(result, "%d%n", n, &len); + sprintf(result, "%lld%n", n, &len); ctx->heap_front += len+1; return result; } @@ -282,7 +282,7 @@ static void lw_Basis_attrifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) { int len; - sprintf(ctx->page_front, "%d%n", n, &len); + sprintf(ctx->page_front, "%lld%n", n, &len); ctx->page_front += len; } @@ -326,7 +326,7 @@ lw_check_heap(ctx, INTS_MAX); r = ctx->heap_front; - sprintf(r, "%d%n", n, &len); + sprintf(r, "%lld%n", n, &len); ctx->heap_front += len+1; return r; } @@ -375,7 +375,7 @@ static void lw_Basis_urlifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) { int len; - sprintf(ctx->page_front, "%d%n", n, &len); + sprintf(ctx->page_front, "%lld%n", n, &len); ctx->page_front += len; } @@ -430,16 +430,16 @@ lw_Basis_int lw_Basis_unurlifyInt(lw_context ctx, char **s) { char *new_s = lw_unurlify_advance(*s); - int r; + lw_Basis_int r; - r = atoi(*s); + r = atoll(*s); *s = new_s; return r; } lw_Basis_float lw_Basis_unurlifyFloat(lw_context ctx, char **s) { char *new_s = lw_unurlify_advance(*s); - int r; + lw_Basis_float r; r = atof(*s); *s = new_s; diff -r 73456bfde988 -r ed4af33681d8 src/cjr_print.sml --- a/src/cjr_print.sml Tue Sep 02 14:40:57 2008 -0400 +++ b/src/cjr_print.sml Tue Sep 02 14:59:27 2008 -0400 @@ -157,7 +157,7 @@ space, string "!=", space, - Prim.p_t (Prim.Int n), + Prim.p_t_GCC (Prim.Int n), string ")", space, exit], @@ -169,7 +169,7 @@ string (Int.toString depth), string ",", space, - Prim.p_t (Prim.String s), + Prim.p_t_GCC (Prim.String s), string "))", space, exit], @@ -323,7 +323,7 @@ fun p_exp' par env (e, loc) = case e of - EPrim p => Prim.p_t p + EPrim p => Prim.p_t_GCC p | ERel n => p_rel env n | ENamed n => p_enamed env n | ECon (Enum, pc, _) => p_patCon env pc diff -r 73456bfde988 -r ed4af33681d8 src/prim.sig --- a/src/prim.sig Tue Sep 02 14:40:57 2008 -0400 +++ b/src/prim.sig Tue Sep 02 14:59:27 2008 -0400 @@ -33,6 +33,7 @@ | String of string val p_t : t Print.printer + val p_t_GCC : t Print.printer val equal : t * t -> bool diff -r 73456bfde988 -r ed4af33681d8 src/prim.sml --- a/src/prim.sml Tue Sep 02 14:40:57 2008 -0400 +++ b/src/prim.sml Tue Sep 02 14:59:27 2008 -0400 @@ -41,6 +41,24 @@ | Float n => string (Real64.toString n) | String s => box [string "\"", string (String.toString s), string "\""] +fun int2s n = + if Int64.compare (n, Int64.fromInt 0) = LESS then + "-" ^ Int64.toString (Int64.~ n) ^ "LL" + else + Int64.toString n ^ "LL" + +fun float2s n = + if Real64.compare (n, Real64.fromInt 0) = LESS then + "-" ^ Real64.toString (Real64.~ n) ^ "L" + else + Real64.toString n ^ "L" + +fun p_t_GCC t = + case t of + Int n => string (int2s n) + | Float n => string (float2s n) + | String s => box [string "\"", string (String.toString s), string "\""] + fun equal x = case x of (Int n1, Int n2) => n1 = n2