Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'WinPort/src/Backend/TTY/IsUnstableWidthChar_mk.cpp')
-rw-r--r--WinPort/src/Backend/TTY/IsUnstableWidthChar_mk.cpp72
1 files changed, 0 insertions, 72 deletions
diff --git a/WinPort/src/Backend/TTY/IsUnstableWidthChar_mk.cpp b/WinPort/src/Backend/TTY/IsUnstableWidthChar_mk.cpp
deleted file mode 100644
index e5684611..00000000
--- a/WinPort/src/Backend/TTY/IsUnstableWidthChar_mk.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "unicode/uchar.h"
-#include "unicode/utypes.h"
-#include "unicode/stringoptions.h"
-#include "stdio.h"
-
-/// Usage:
-/// g++ -O2 ./IsUnstableWidthChar_mk.cpp -o /tmp/IsUnstableWidthChar_mk -licuuc && /tmp/IsUnstableWidthChar_mk > IsUnstableWidthChar.cpp
-
-static bool IsUnstableWidthBlock(int block)
-{
- return block == UBLOCK_ARROWS
- || block == UBLOCK_MATHEMATICAL_OPERATORS
- || block == UBLOCK_MISCELLANEOUS_TECHNICAL
- || block == UBLOCK_CONTROL_PICTURES
- || block == UBLOCK_GEOMETRIC_SHAPES
- || block == UBLOCK_MISCELLANEOUS_SYMBOLS
- || block == UBLOCK_COMBINING_DIACRITICAL_MARKS
- || block == UBLOCK_COMBINING_MARKS_FOR_SYMBOLS
- || block == UBLOCK_COMBINING_HALF_MARKS
- || block == UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT
- || block == UBLOCK_COMBINING_DIACRITICAL_MARKS_EXTENDED
- ;
-}
-
-int main()
-{
-// printf("%u\n", u_getIntPropertyValue(0xcbe, UCHAR_GENERAL_CATEGORY));
-// return -1;
- UChar32 c, last = 0x10ffff;
- UChar32 unstable_start = 0;
- bool first = true;
- printf("// this file autogenerated by IsUnstableWidthChar_mk.cpp\n\n");
- printf("#include <wchar.h>\n\n");
- printf("bool IsUnstableWidthChar(wchar_t c)\n");
- printf("{\n");
- printf("\treturn ");
- for (c = 1; c <= last + 1; ++c) {
- bool unstable = false;
- if (c <= last) {
- const auto width = u_getIntPropertyValue(c, UCHAR_EAST_ASIAN_WIDTH);
- const auto jt = u_getIntPropertyValue(c, UCHAR_JOINING_TYPE);
- const auto cat = u_getIntPropertyValue(c, UCHAR_GENERAL_CATEGORY);
- unstable = (width == U_EA_FULLWIDTH || width == U_EA_WIDE
- || (jt != U_JT_NON_JOINING && jt != U_JT_TRANSPARENT)
- || cat == U_NON_SPACING_MARK || cat == U_COMBINING_SPACING_MARK || cat == U_SURROGATE
- || IsUnstableWidthBlock(u_getIntPropertyValue(c, UCHAR_BLOCK)));
- }
-
- if (unstable) {
- if (!unstable_start) {
- unstable_start = c;
- }
-
- } else if (unstable_start) {
- if (first) {
- first = false;
- } else {
- printf("\t || ");
- }
- if (unstable_start + 2 == c) {
- printf("(c == 0x%x || c == 0x%x)\n", (unsigned int)unstable_start, (unsigned int)c - 1);
- } else if (unstable_start + 1 < c) {
- printf("(c >= 0x%x && c <= 0x%x)\n", (unsigned int)unstable_start, (unsigned int)c - 1);
- } else {
- printf("(c == 0x%x)\n", (unsigned int)unstable_start);
- }
- unstable_start = 0;
- }
- }
- printf("\t;\n");
- printf("}\n");
-}