aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/types.h4
-rw-r--r--src/c/urweb.c14
-rw-r--r--src/cjr_print.sml6
-rw-r--r--src/prim.sig1
-rw-r--r--src/prim.sml18
5 files changed, 31 insertions, 12 deletions
diff --git a/include/types.h b/include/types.h
index afd4ff45..73a3e575 100644
--- a/include/types.h
+++ b/include/types.h
@@ -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 --git a/src/c/urweb.c b/src/c/urweb.c
index cc6e4f0b..10d474f4 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -233,7 +233,7 @@ char *lw_Basis_attrifyInt(lw_context ctx, lw_Basis_int n) {
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 @@ char *lw_Basis_attrifyString(lw_context ctx, lw_Basis_string s) {
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 @@ char *lw_Basis_urlifyInt(lw_context ctx, lw_Basis_int n) {
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 @@ char *lw_Basis_urlifyBool(lw_context ctx, lw_Basis_bool b) {
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 @@ static char *lw_unurlify_advance(char *s) {
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 --git a/src/cjr_print.sml b/src/cjr_print.sml
index 41ecb7bc..b1f9fd6c 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -157,7 +157,7 @@ fun p_pat (env, exit, depth) (p, _) =
space,
string "!=",
space,
- Prim.p_t (Prim.Int n),
+ Prim.p_t_GCC (Prim.Int n),
string ")",
space,
exit],
@@ -169,7 +169,7 @@ fun p_pat (env, exit, depth) (p, _) =
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 patConInfo env pc =
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 --git a/src/prim.sig b/src/prim.sig
index e443e515..73f23b77 100644
--- a/src/prim.sig
+++ b/src/prim.sig
@@ -33,6 +33,7 @@ signature PRIM = sig
| String of string
val p_t : t Print.printer
+ val p_t_GCC : t Print.printer
val equal : t * t -> bool
diff --git a/src/prim.sml b/src/prim.sml
index 3e8506a9..8c0e03f7 100644
--- a/src/prim.sml
+++ b/src/prim.sml
@@ -41,6 +41,24 @@ fun p_t t =
| 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