 Reece H. Dunn
					
					8 years ago
						Reece H. Dunn
					
					8 years ago
				| @@ -335,7 +335,7 @@ typedef enum ucd_property_ | |||
| UCD_PROPERTY_JOIN_CONTROL = 0x00000008, /**< @brief Join_Control */ | |||
| UCD_PROPERTY_DASH = 0x00000010, /**< @brief Dash */ | |||
| UCD_PROPERTY_HYPHEN = 0x00000020, /**< @brief Hyphen */ | |||
| UCD_PROPERTY_QUOTATION_MARK = 0x00000020, /**< @brief Quotation_Mark */ | |||
| UCD_PROPERTY_QUOTATION_MARK = 0x00000040, /**< @brief Quotation_Mark */ | |||
| } ucd_property; | |||
| /** @brief Return the properties of the specified codepoint. | |||
| @@ -163,6 +163,9 @@ void uprintf(FILE *out, codepoint_t c, const char *format) | |||
| case 'p': // codepoint | |||
| uprintf_codepoint(out, c, *++format); | |||
| break; | |||
| case 'P': // properties | |||
| fprintf(out, "%08x", ucd_properties(c, ucd_lookup_category(c))); | |||
| break; | |||
| case 'i': // is* | |||
| uprintf_is(out, c, *++format); | |||
| break; | |||
| @@ -249,7 +252,7 @@ int main(int argc, char **argv) | |||
| { | |||
| for (codepoint_t c = 0; c <= 0x10FFFF; ++c) | |||
| uprintf(stdout, c, format ? format : | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n"); | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il %P\n"); | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -160,6 +160,9 @@ void uprintf(FILE *out, codepoint_t c, const char *format) | |||
| case 'p': // codepoint | |||
| uprintf_codepoint(out, c, *++format); | |||
| break; | |||
| case 'P': // properties | |||
| fprintf(out, "%08x", ucd_properties(c, ucd_lookup_category(c))); | |||
| break; | |||
| case 'i': // is* | |||
| uprintf_is(out, c, *++format); | |||
| break; | |||
| @@ -244,7 +247,7 @@ int main(int argc, char **argv) | |||
| { | |||
| for (codepoint_t c = 0; c <= 0x10FFFF; ++c) | |||
| uprintf(stdout, c, format ? format : | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n"); | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il %P\n"); | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -160,6 +160,9 @@ void uprintf(FILE *out, ucd::codepoint_t c, const char *format) | |||
| case 'p': // codepoint | |||
| uprintf_codepoint(out, c, *++format); | |||
| break; | |||
| case 'P': // properties | |||
| fprintf(out, "%08x", ucd::properties(c, ucd::lookup_category(c))); | |||
| break; | |||
| case 'i': // is* | |||
| uprintf_is(out, c, *++format); | |||
| break; | |||
| @@ -244,7 +247,7 @@ int main(int argc, char **argv) | |||
| { | |||
| for (ucd::codepoint_t c = 0; c <= 0x10FFFF; ++c) | |||
| uprintf(stdout, c, format ? format : | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n"); | |||
| "%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il %P\n"); | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -113,6 +113,23 @@ def islower(data): | |||
| else: | |||
| return 0 | |||
| def decomposition_type(data, dtype): | |||
| value = data.get('DecompositionType', None) | |||
| if value and value.startswith(dtype): | |||
| return value | |||
| return None | |||
| def properties(data): | |||
| props = 0 | |||
| props += 1 * data.get('White_Space', 0) | |||
| props += 2 * (decomposition_type(data, '<noBreak>') != None) | |||
| props += 4 * data.get('Bidi_Control', 0) | |||
| props += 8 * data.get('Join_Control', 0) | |||
| props += 16 * data.get('Dash', 0) | |||
| props += 32 * data.get('Hyphen', 0) | |||
| props += 64 * data.get('Quotation_Mark', 0) | |||
| return props | |||
| if __name__ == '__main__': | |||
| for codepoint in ucd.CodeRange('000000..10FFFF'): | |||
| try: | |||
| @@ -126,10 +143,11 @@ if __name__ == '__main__': | |||
| if title == null: title = codepoint | |||
| if upper == null: upper = codepoint | |||
| if lower == null: lower = codepoint | |||
| print('%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s' % ( | |||
| print('%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %08x' % ( | |||
| codepoint, script, | |||
| data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'), | |||
| upper, lower, title, | |||
| isdigit(data), isxdigit(data), | |||
| iscntrl(data), isspace(data), isblank(data), ispunct(data), | |||
| isprint(data), isgraph(data), isalnum(data), isalpha(data), isupper(data), islower(data))) | |||
| isprint(data), isgraph(data), isalnum(data), isalpha(data), isupper(data), islower(data), | |||
| properties(data))) | |||