diff options
author | Mike Pall <mike> | 2010-11-09 12:09:54 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-11-09 12:09:54 +0100 |
commit | ad29c1f39feb55d4d443b9352448a12a1be8ee23 (patch) | |
tree | 685adbbcad3f65cacf636dda30bf1785191d9c6e /src/lib_string.c | |
parent | fe21a42a92546416cc235511c4e1949d850c0139 (diff) | |
download | luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.gz luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.bz2 luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.zip |
Rename character type handling from lj_ctype* to lj_char*.
Diffstat (limited to 'src/lib_string.c')
-rw-r--r-- | src/lib_string.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib_string.c b/src/lib_string.c index 8ca9ef01..73a09583 100644 --- a/src/lib_string.c +++ b/src/lib_string.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lj_tab.h" | 22 | #include "lj_tab.h" |
23 | #include "lj_state.h" | 23 | #include "lj_state.h" |
24 | #include "lj_ff.h" | 24 | #include "lj_ff.h" |
25 | #include "lj_ctype.h" | 25 | #include "lj_char.h" |
26 | #include "lj_lib.h" | 26 | #include "lj_lib.h" |
27 | 27 | ||
28 | /* ------------------------------------------------------------------------ */ | 28 | /* ------------------------------------------------------------------------ */ |
@@ -181,9 +181,9 @@ static const char *classend(MatchState *ms, const char *p) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | static const unsigned char match_class_map[32] = { | 183 | static const unsigned char match_class_map[32] = { |
184 | 0, LJ_CTYPE_ALPHA, 0, LJ_CTYPE_CNTRL, LJ_CTYPE_DIGIT, 0,0,0,0,0,0,0, | 184 | 0, LJ_CHAR_ALPHA, 0, LJ_CHAR_CNTRL, LJ_CHAR_DIGIT, 0,0,0,0,0,0,0, |
185 | LJ_CTYPE_LOWER, 0,0,0, LJ_CTYPE_PUNCT, 0,0, LJ_CTYPE_SPACE, 0, | 185 | LJ_CHAR_LOWER, 0,0,0, LJ_CHAR_PUNCT, 0,0, LJ_CHAR_SPACE, 0, |
186 | LJ_CTYPE_UPPER, 0, LJ_CTYPE_ALNUM, LJ_CTYPE_XDIGIT, 0,0,0,0,0,0,0 | 186 | LJ_CHAR_UPPER, 0, LJ_CHAR_ALNUM, LJ_CHAR_XDIGIT, 0,0,0,0,0,0,0 |
187 | }; | 187 | }; |
188 | 188 | ||
189 | static int match_class(int c, int cl) | 189 | static int match_class(int c, int cl) |
@@ -191,7 +191,7 @@ static int match_class(int c, int cl) | |||
191 | if ((cl & 0xc0) == 0x40) { | 191 | if ((cl & 0xc0) == 0x40) { |
192 | int t = match_class_map[(cl&0x1f)]; | 192 | int t = match_class_map[(cl&0x1f)]; |
193 | if (t) { | 193 | if (t) { |
194 | t = lj_ctype_isa(c, t); | 194 | t = lj_char_isa(c, t); |
195 | return (cl & 0x20) ? t : !t; | 195 | return (cl & 0x20) ? t : !t; |
196 | } | 196 | } |
197 | if (cl == 'z') return c == 0; | 197 | if (cl == 'z') return c == 0; |
@@ -353,7 +353,7 @@ static const char *match(MatchState *ms, const char *s, const char *p) | |||
353 | goto init; /* else return match(ms, s, ep); */ | 353 | goto init; /* else return match(ms, s, ep); */ |
354 | } | 354 | } |
355 | default: | 355 | default: |
356 | if (lj_ctype_isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ | 356 | if (lj_char_isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ |
357 | s = match_capture(ms, s, uchar(*(p+1))); | 357 | s = match_capture(ms, s, uchar(*(p+1))); |
358 | if (s == NULL) return NULL; | 358 | if (s == NULL) return NULL; |
359 | p+=2; | 359 | p+=2; |
@@ -549,7 +549,7 @@ static void add_s(MatchState *ms, luaL_Buffer *b, const char *s, const char *e) | |||
549 | luaL_addchar(b, news[i]); | 549 | luaL_addchar(b, news[i]); |
550 | } else { | 550 | } else { |
551 | i++; /* skip ESC */ | 551 | i++; /* skip ESC */ |
552 | if (!lj_ctype_isdigit(uchar(news[i]))) { | 552 | if (!lj_char_isdigit(uchar(news[i]))) { |
553 | luaL_addchar(b, news[i]); | 553 | luaL_addchar(b, news[i]); |
554 | } else if (news[i] == '0') { | 554 | } else if (news[i] == '0') { |
555 | luaL_addlstring(b, s, (size_t)(e - s)); | 555 | luaL_addlstring(b, s, (size_t)(e - s)); |
@@ -679,14 +679,14 @@ static const char *scanformat(lua_State *L, const char *strfrmt, char *form) | |||
679 | while (*p != '\0' && strchr(FMT_FLAGS, *p) != NULL) p++; /* skip flags */ | 679 | while (*p != '\0' && strchr(FMT_FLAGS, *p) != NULL) p++; /* skip flags */ |
680 | if ((size_t)(p - strfrmt) >= sizeof(FMT_FLAGS)) | 680 | if ((size_t)(p - strfrmt) >= sizeof(FMT_FLAGS)) |
681 | lj_err_caller(L, LJ_ERR_STRFMTR); | 681 | lj_err_caller(L, LJ_ERR_STRFMTR); |
682 | if (lj_ctype_isdigit(uchar(*p))) p++; /* skip width */ | 682 | if (lj_char_isdigit(uchar(*p))) p++; /* skip width */ |
683 | if (lj_ctype_isdigit(uchar(*p))) p++; /* (2 digits at most) */ | 683 | if (lj_char_isdigit(uchar(*p))) p++; /* (2 digits at most) */ |
684 | if (*p == '.') { | 684 | if (*p == '.') { |
685 | p++; | 685 | p++; |
686 | if (lj_ctype_isdigit(uchar(*p))) p++; /* skip precision */ | 686 | if (lj_char_isdigit(uchar(*p))) p++; /* skip precision */ |
687 | if (lj_ctype_isdigit(uchar(*p))) p++; /* (2 digits at most) */ | 687 | if (lj_char_isdigit(uchar(*p))) p++; /* (2 digits at most) */ |
688 | } | 688 | } |
689 | if (lj_ctype_isdigit(uchar(*p))) | 689 | if (lj_char_isdigit(uchar(*p))) |
690 | lj_err_caller(L, LJ_ERR_STRFMTW); | 690 | lj_err_caller(L, LJ_ERR_STRFMTW); |
691 | *(form++) = '%'; | 691 | *(form++) = '%'; |
692 | strncpy(form, strfrmt, (size_t)(p - strfrmt + 1)); | 692 | strncpy(form, strfrmt, (size_t)(p - strfrmt + 1)); |