diff options
author | Adam Chlipala <adam@chlipala.net> | 2013-12-09 17:23:25 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2013-12-09 17:23:25 -0500 |
commit | 049f9219ead236d4db6c7341db0bcb5944d69943 (patch) | |
tree | 61e6fe93ed1154836f155e7e8420936b347a4a12 | |
parent | db0aff13453186d3f6edf46b42e43690ea113aea (diff) |
Add JavaScript mappings for isprint and ord
-rw-r--r-- | lib/js/urweb.js | 3 | ||||
-rw-r--r-- | src/settings.sml | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 59708150..e211d318 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -35,10 +35,11 @@ function isAlnum(c) { return isAlpha(c) || isDigit(c); } 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) { diff --git a/src/settings.sml b/src/settings.sml index 948906ed..7a75985e 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -299,8 +299,10 @@ val jsFuncsBase = basisM [("alert", "alert"), ("isblank", "isBlank"), ("isspace", "isSpace"), ("isxdigit", "isXdigit"), + ("isprint", "isPrint"), ("tolower", "toLower"), ("toupper", "toUpper"), + ("ord", "ord"), ("checkUrl", "checkUrl"), ("bless", "bless"), |