]> code.delx.au - gnu-emacs/blobdiff - src/character.c
js-mode: Don't indent inside a multiline string literal
[gnu-emacs] / src / character.c
index 39d32c9d41af9e8296eefea2e476139a9a61f9b5..ad78f512f43b57355143ede329bcbd4c808a0686 100644 (file)
@@ -984,6 +984,44 @@ character is not ASCII nor 8-bit character, an error is signaled.  */)
 
 #ifdef emacs
 
+/* Return 'true' if C is an alphabetic character as defined by its
+   Unicode properties.  */
+bool
+alphabeticp (int c)
+{
+  Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
+  if (! INTEGERP (category))
+    return false;
+  EMACS_INT gen_cat = XINT (category);
+
+  /* See UTS #18.  There are additional characters that should be
+     here, those designated as Other_uppercase, Other_lowercase,
+     and Other_alphabetic; FIXME.  */
+  return (gen_cat == UNICODE_CATEGORY_Lu
+         || gen_cat == UNICODE_CATEGORY_Ll
+         || gen_cat == UNICODE_CATEGORY_Lt
+         || gen_cat == UNICODE_CATEGORY_Lm
+         || gen_cat == UNICODE_CATEGORY_Lo
+         || gen_cat == UNICODE_CATEGORY_Mn
+         || gen_cat == UNICODE_CATEGORY_Mc
+         || gen_cat == UNICODE_CATEGORY_Me
+         || gen_cat == UNICODE_CATEGORY_Nl);
+}
+
+/* Return 'true' if C is an decimal-number character as defined by its
+   Unicode properties.  */
+bool
+decimalnump (int c)
+{
+  Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
+  if (! INTEGERP (category))
+    return false;
+  EMACS_INT gen_cat = XINT (category);
+
+  /* See UTS #18.  */
+  return gen_cat == UNICODE_CATEGORY_Nd;
+}
+
 void
 syms_of_character (void)
 {