summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-31 12:41:34 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-31 12:41:34 -0400
commita6424094365f7d63b6c9dade8f8f72ef26e92b45 (patch)
tree4eac927486b596ee7118f84c2dc468489840e98d /src
parentbd0d3db78996b00e153252f03b02551ac3fde4cf (diff)
strcspn and friends
Diffstat (limited to 'src')
-rw-r--r--src/c/urweb.c4
-rw-r--r--src/settings.sml3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index d8b606fd..ffef10e7 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1815,6 +1815,10 @@ uw_Basis_string uw_Basis_strchr(uw_context ctx, uw_Basis_string s, uw_Basis_char
return strchr(s, ch);
}
+uw_Basis_int uw_Basis_strcspn(uw_context ctx, uw_Basis_string s, uw_Basis_string chs) {
+ return strcspn(s, chs);
+}
+
uw_Basis_int *uw_Basis_strindex(uw_context ctx, uw_Basis_string s, uw_Basis_char ch) {
uw_Basis_string r = strchr(s, ch);
if (r == NULL)
diff --git a/src/settings.sml b/src/settings.sml
index 75302cb9..a71ab872 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -156,7 +156,8 @@ val jsFuncsBase = basisM [("alert", "alert"),
("strlen", "slen"),
("strindex", "sidx"),
("strchr", "schr"),
- ("substring", "ssub")]
+ ("substring", "ssub"),
+ ("strcspn", "sspn")]
val jsFuncs = ref jsFuncsBase
fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls
fun jsFunc x = M.find (!jsFuncs, x)