Browse Source

Merge branch 'master' of https://github.com/achlipala/FrameworkBenchmarks into 1248

Conflicts:
	frameworks/Ur/urweb/install.sh
Mike Smith 10 years ago
parent
commit
6570e56563
2 changed files with 17 additions and 16 deletions
  1. 9 6
      frameworks/Ur/urweb/install.sh
  2. 8 10
      frameworks/Ur/urweb/meta/json.ur

+ 9 - 6
frameworks/Ur/urweb/install.sh

@@ -1,13 +1,16 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists ${IROOT}/urweb.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
+VERSION=20141206
+COMPILER=${IROOT}/urweb
 
-fw_get http://www.impredicative.com/ur/urweb-20140830.tgz
-fw_untar urweb-20140830.tgz
-cd urweb-20140830
+RETCODE=$(fw_exists $COMPILER)
+[ ! "$RETCODE" == 0 ] || [ ! `$COMPILER | grep -oE '[^ ]+$'` == "$VERSION" ] || { return 0; }
+
+fw_get http://www.impredicative.com/ur/urweb-$VERSION.tgz
+fw_untar urweb-$VERSION.tgz
+cd urweb-$VERSION
 ./configure --prefix=${IROOT}/urweb
 make
 make install
 
-touch ${IROOT}/urweb.installed
+touch ${IROOT}/urweb.installed

+ 8 - 10
frameworks/Ur/urweb/meta/json.ur

@@ -39,22 +39,20 @@ fun fromJson [a] (j : json a) (s : string) : a =
 
 fun escape s =
     let
-        val len = String.length s
-
-        fun esc i =
-            if i >= len then
-                "\""
-            else
+        fun esc s =
+            case s of
+                "" => "\""
+              | _ =>
                 let
-                    val ch = String.sub s i
+                    val ch = String.sub s 0
                 in
                     (if ch = #"\"" || ch = #"\\" then
                          "\\" ^ String.str ch
                      else
-                         String.str ch) ^ esc (i+1)
+                         String.str ch) ^ esc (String.suffix s 1)
                 end
     in
-        "\"" ^ esc 0
+        "\"" ^ esc s
     end
 
 fun unescape s =
@@ -210,7 +208,7 @@ fun json_record [ts ::: {Type}] (fl : folder ts) (jss : $(map json ts)) (names :
                              (fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] (j : json t) name v acc =>
                                  escape name ^ ":" ^ j.ToJson v ^ (case acc of
                                                                        "" => ""
-                                                                     | _ => "," ^ acc))
+                                                                     | acc => "," ^ acc))
                              "" fl jss names r ^ "}",
      FromJson = fn s =>
                    let