Move macros around

This commit is contained in:
Behdad Esfahbod 2011-04-11 13:16:08 -04:00
parent 07233581c9
commit db5227c40e
2 changed files with 9 additions and 4 deletions

View File

@ -639,10 +639,8 @@ hb_ot_tag_from_language (hb_language_t language)
char tag[4]; char tag[4];
int i; int i;
lang_str += 6; lang_str += 6;
#define IS_LETTER(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) for (i = 0; i < 4 && ISALPHA (lang_str[i]); i++)
#define TO_UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) + 'A' - 'a' : (c)) tag[i] = TOUPPER (lang_str[i]);
for (i = 0; i < 4 && IS_LETTER (lang_str[i]); i++)
tag[i] = TO_UPPER (lang_str[i]);
for (; i < 4; i++) for (; i < 4; i++)
tag[i] = ' '; tag[i] = ' ';
return HB_TAG_CHAR4 (tag); return HB_TAG_CHAR4 (tag);

View File

@ -263,6 +263,13 @@ typedef int hb_mutex_t;
#define hb_be_uint32_cmp(a,b) (a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]) #define hb_be_uint32_cmp(a,b) (a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3])
/* ASCII character handling */
#define ISALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
#define TOUPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c))
#define TOLOWER(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
/* Debug */ /* Debug */
#ifndef HB_DEBUG #ifndef HB_DEBUG