changeset 1927:b6aee1d5b9b1

Add JavaScript mappings for isprint and ord
author Adam Chlipala <adam@chlipala.net>
date Mon, 09 Dec 2013 17:23:25 -0500
parents 44f607a7f4cd
children f1c211936557
files lib/js/urweb.js src/settings.sml
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Mon Dec 09 15:47:14 2013 -0500
+++ b/lib/js/urweb.js	Mon Dec 09 17:23:25 2013 -0500
@@ -35,10 +35,11 @@
 function isBlank(c) { return c == ' ' || c == '\t'; }
 function isSpace(c) { return isBlank(c) || c == '\r' || c == '\n'; }
 function isXdigit(c) { return isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); }
+function ord(c) { return c.charCodeAt(0); }
+function isPrint(c) { return ord(c) > 31 && ord(c) < 127; }
 function toLower(c) { return c.toLowerCase(); }
 function toUpper(c) { return c.toUpperCase(); }
 
-
 // Lists
 
 function cons(v, ls) {
--- a/src/settings.sml	Mon Dec 09 15:47:14 2013 -0500
+++ b/src/settings.sml	Mon Dec 09 17:23:25 2013 -0500
@@ -299,8 +299,10 @@
                           ("isblank", "isBlank"),
                           ("isspace", "isSpace"),
                           ("isxdigit", "isXdigit"),
+                          ("isprint", "isPrint"),
                           ("tolower", "toLower"),
                           ("toupper", "toUpper"),
+                          ("ord", "ord"),
 
                           ("checkUrl", "checkUrl"),
                           ("bless", "bless"),