tuc: uc_isalpha() and uc_isdigit() - neatvi - [fork] simple vi-type editor with… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 216450ffabf2b6b07068f583b1a28014144cf53c | |
parent b1c10bc71e9c7d3c7db8cbd85adf17aa63f9736b | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Sun, 3 May 2015 12:30:25 +0430 | |
uc: uc_isalpha() and uc_isdigit() | |
Diffstat: | |
M uc.c | 12 ++++++++++++ | |
M vi.h | 2 ++ | |
2 files changed, 14 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/uc.c b/uc.c | |
t@@ -106,6 +106,18 @@ int uc_isprint(char *s) | |
return c > 0x7f || isprint(c); | |
} | |
+int uc_isalpha(char *s) | |
+{ | |
+ int c = s ? (unsigned char) *s : 0; | |
+ return c <= 0x7f && isalpha(c); | |
+} | |
+ | |
+int uc_isdigit(char *s) | |
+{ | |
+ int c = s ? (unsigned char) *s : 0; | |
+ return c <= 0x7f && isdigit(c); | |
+} | |
+ | |
#define UC_R2L(ch) (((ch) & 0xff00) == 0x0600 || \ | |
((ch) & 0xfffc) == 0x200c || \ | |
((ch) & 0xff00) == 0xfb00 || \ | |
diff --git a/vi.h b/vi.h | |
t@@ -56,6 +56,8 @@ int uc_slen(char *s); | |
int uc_code(char *s); | |
int uc_isspace(char *s); | |
int uc_isprint(char *s); | |
+int uc_isdigit(char *s); | |
+int uc_isalpha(char *s); | |
char **uc_chop(char *s, int *n); | |
char *uc_next(char *s); | |
char *uc_beg(char *beg, char *s); |