comparison lib/js/urweb.js @ 649:96ebc6bdb5a0

Batch example
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Mar 2009 15:17:23 -0400
parents fb2a0e76dcef
children a93d5324f400
comparison
equal deleted inserted replaced
648:3c6d535d3d8b 649:96ebc6bdb5a0
97 } 97 }
98 98
99 function ts(x) { return x.toString() } 99 function ts(x) { return x.toString() }
100 function bs(b) { return (b ? "True" : "False") } 100 function bs(b) { return (b ? "True" : "False") }
101 101
102 function pf() { alert("Pattern match failure") } 102 function pi(s) {
103 var r = parseInt(s);
104 if (r.toString() == s)
105 return r;
106 else
107 throw "Can't parse int: " + s;
108 }
109
110 function pfl(s) {
111 var r = parseFloat(s);
112 if (r.toString() == s)
113 return r;
114 else
115 throw "Can't parse float: " + s;
116 }
117
118 function pf() {
119 alert("Pattern match failure");
120 throw "Pattern match failure";
121 }
103 122
104 var closures = []; 123 var closures = [];
105 124
106 function ca(f) { 125 function ca(f) {
107 var n = closures.length; 126 var n = closures.length;
143 isok = true; 162 isok = true;
144 } catch (e) { } 163 } catch (e) { }
145 164
146 if (isok) 165 if (isok)
147 k(parse(xhr.responseText)); 166 k(parse(xhr.responseText));
148 else 167 else {
149 alert("Error querying remote server!"); 168 alert("Error querying remote server!");
169 throw "Error querying remote server!";
170 }
150 } 171 }
151 }; 172 };
152 173
153 xhr.open("GET", uri, true); 174 xhr.open("GET", uri, true);
154 xhr.send(null); 175 xhr.send(null);