mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-25 11:07:54 +08:00
Bidi tables
This commit is contained in:
@@ -193,6 +193,7 @@ build_eucjp_support="no"
|
||||
build_shiftjis_support="no"
|
||||
|
||||
build_unicode_support="yes"
|
||||
build_full_unicode="yes"
|
||||
|
||||
dnl Keyboard layout specific options
|
||||
use_kbd_hebrewpc="no"
|
||||
|
||||
+11
-1
@@ -19,7 +19,17 @@ HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype2.h qpf.h se_minigui.h \
|
||||
unicode-tables.h unicode-break-tables.h unicode-script-table.h \
|
||||
unicode-decomp.h unicode-comp.h \
|
||||
unicode-emoji-tables.h \
|
||||
mgbidi.h mgbidi-bidi-types-list.h mgbidi-joining-types-list.h
|
||||
mgbidi.h \
|
||||
mgbidi-bidi-types-list.inc \
|
||||
mgbidi-bidi-type-table.inc \
|
||||
mgbidi-arabic-misc-table.inc \
|
||||
mgbidi-arabic-shaping-table.inc \
|
||||
mgbidi-brackets-table.inc \
|
||||
mgbidi-brackets-type-table.inc \
|
||||
mgbidi-joining-types-list.inc \
|
||||
mgbidi-joining-type-table.inc \
|
||||
mgbidi-mirroring-table.inc
|
||||
|
||||
|
||||
EXTRA_DIST = convgbmap.c jisunimap.c $(SRC_FILES) $(HDR_FILES) \
|
||||
makefile.ng makefile.msvc
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* The tables in this file should all be sorted on their first item. */
|
||||
|
||||
const PairMap mandatory_liga_table[] = {
|
||||
{{0xFEDF, 0xFE82}, 0xFEF5},
|
||||
{{0xFEDF, 0xFE84}, 0xFEF7},
|
||||
{{0xFEDF, 0xFE88}, 0xFEF9},
|
||||
{{0xFEDF, 0xFE8E}, 0xFEFB},
|
||||
{{0xFEE0, 0xFE82}, 0xFEF6},
|
||||
{{0xFEE0, 0xFE84}, 0xFEF8},
|
||||
{{0xFEE0, 0xFE88}, 0xFEFA},
|
||||
{{0xFEE0, 0xFE8E}, 0xFEFC},
|
||||
};
|
||||
|
||||
|
||||
const PairMap console_liga_table[] = {
|
||||
{{0x0640, 0xFC60}, 0xFCF2},
|
||||
{{0x0640, 0xFC61}, 0xFCF3},
|
||||
{{0x0640, 0xFC62}, 0xFCF4},
|
||||
{{0x0640, 0xFE70}, 0xFE71},
|
||||
{{0x0640, 0xFE76}, 0xFE77},
|
||||
{{0x0640, 0xFE78}, 0xFE79},
|
||||
{{0x0640, 0xFE7A}, 0xFE7B},
|
||||
{{0x0640, 0xFE7C}, 0xFE7D},
|
||||
{{0x0640, 0xFE7E}, 0xFE7F},
|
||||
{{0xFBE8, 0x0654}, 0xFE8B},
|
||||
{{0xFBE9, 0x0654}, 0xFE8C},
|
||||
{{0xFBFC, 0x0654}, 0xFE89},
|
||||
{{0xFBFC, 0x0670}, 0xFC5D},
|
||||
{{0xFBFD, 0x0654}, 0xFE8A},
|
||||
{{0xFBFD, 0x0670}, 0xFC90},
|
||||
{{0xFE7C, 0x0670}, 0xFC63},
|
||||
{{0xFE7C, 0xFE72}, 0xFC5E},
|
||||
{{0xFE7C, 0xFE74}, 0xFC5F},
|
||||
{{0xFE7C, 0xFE76}, 0xFC60},
|
||||
{{0xFE7C, 0xFE78}, 0xFC61},
|
||||
{{0xFE7C, 0xFE7A}, 0xFC62},
|
||||
{{0xFE7D, 0xFE76}, 0xFCF2},
|
||||
{{0xFE7D, 0xFE77}, 0xFCF2},
|
||||
{{0xFE7D, 0xFE78}, 0xFCF3},
|
||||
{{0xFE7D, 0xFE79}, 0xFCF3},
|
||||
{{0xFE7D, 0xFE7A}, 0xFCF4},
|
||||
{{0xFE7D, 0xFE7B}, 0xFCF4},
|
||||
{{0xFE8D, 0x0653}, 0xFE81},
|
||||
{{0xFE8D, 0x0654}, 0xFE83},
|
||||
{{0xFE8D, 0x0655}, 0xFE87},
|
||||
{{0xFE8D, 0xFE70}, 0xFD3D},
|
||||
{{0xFE8E, 0x0653}, 0xFE82},
|
||||
{{0xFE8E, 0x0654}, 0xFE84},
|
||||
{{0xFE8E, 0x0655}, 0xFE88},
|
||||
{{0xFE8E, 0xFE70}, 0xFD3C},
|
||||
{{0xFEE9, 0x0654}, 0xFBA4},
|
||||
{{0xFEEA, 0x0654}, 0xFBA5},
|
||||
{{0xFEED, 0x0654}, 0xFE85},
|
||||
{{0xFEEE, 0x0654}, 0xFE86},
|
||||
{{0xFEEF, 0x0654}, 0xFE89},
|
||||
{{0xFEEF, 0x0670}, 0xFC5D},
|
||||
{{0xFEF0, 0x0654}, 0xFE8A},
|
||||
{{0xFEF0, 0x0670}, 0xFC90},
|
||||
{{0xFEF1, 0x0654}, 0xFE89},
|
||||
{{0xFEF1, 0x0670}, 0xFC5D},
|
||||
{{0xFEF2, 0x0654}, 0xFE8A},
|
||||
{{0xFEF2, 0x0670}, 0xFC90},
|
||||
{{0xFEF3, 0x0654}, 0xFE8B},
|
||||
{{0xFEF4, 0x0654}, 0xFE8C},
|
||||
{{0xFEFB, 0x0653}, 0xFEF5},
|
||||
{{0xFEFB, 0x0654}, 0xFEF7},
|
||||
{{0xFEFB, 0x0655}, 0xFEF9},
|
||||
{{0xFEFC, 0x0653}, 0xFEF6},
|
||||
{{0xFEFC, 0x0654}, 0xFEF8},
|
||||
{{0xFEFC, 0x0655}, 0xFEFA},
|
||||
};
|
||||
|
||||
|
||||
static const Uchar32 NSMShap[][4] = {
|
||||
{0xFE70, 0xFE71, 0xFE70, 0xFE71,},
|
||||
{0xFE72, 0xFE72, 0xFE72, 0xFE72,},
|
||||
{0xFE74, 0xFE74, 0xFE74, 0xFE74,},
|
||||
{0xFE76, 0xFE77, 0xFE76, 0xFE77,},
|
||||
{0xFE78, 0xFE79, 0xFE78, 0xFE79,},
|
||||
{0xFE7A, 0xFE7B, 0xFE7A, 0xFE7B,},
|
||||
{0xFE7C, 0xFE7D, 0xFE7C, 0xFE7D,},
|
||||
{0xFE7E, 0xFE7F, 0xFE7E, 0xFE7F,},
|
||||
};
|
||||
|
||||
#ifndef MGBIDI_ACCESS_SHAPE_TABLE
|
||||
# define MGBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \
|
||||
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
|
||||
#endif
|
||||
|
||||
#define MGBIDI_GET_ARABIC_SHAPE_NSM(x,shape) \
|
||||
MGBIDI_ACCESS_SHAPE_TABLE(NSMShap, 0x064B, 0x0652, (x), (shape))
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
/* mgbidi-arabic-shaping-table.h
|
||||
* generated by gen-arabic-shaping-tab
|
||||
* from the files UnicodeData.txt, (null) of Unicode version 12.0.0. */
|
||||
|
||||
/*
|
||||
use MGBIDI_GET_ARABIC_SHAPE_PRES(key,shape) to access your table
|
||||
|
||||
required memory: 2864
|
||||
*/
|
||||
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
static const Uchar32 ArShap[179][4] = {
|
||||
{0xfe80,0x0621,0x0621,0x0621,},
|
||||
{0xfe81,0xfe82,0x0622,0x0622,},
|
||||
{0xfe83,0xfe84,0x0623,0x0623,},
|
||||
{0xfe85,0xfe86,0x0624,0x0624,},
|
||||
{0xfe87,0xfe88,0x0625,0x0625,},
|
||||
{0xfe89,0xfe8a,0xfe8b,0xfe8c,},
|
||||
{0xfe8d,0xfe8e,0x0627,0x0627,},
|
||||
{0xfe8f,0xfe90,0xfe91,0xfe92,},
|
||||
{0xfe93,0xfe94,0x0629,0x0629,},
|
||||
{0xfe95,0xfe96,0xfe97,0xfe98,},
|
||||
{0xfe99,0xfe9a,0xfe9b,0xfe9c,},
|
||||
{0xfe9d,0xfe9e,0xfe9f,0xfea0,},
|
||||
{0xfea1,0xfea2,0xfea3,0xfea4,},
|
||||
{0xfea5,0xfea6,0xfea7,0xfea8,},
|
||||
{0xfea9,0xfeaa,0x062f,0x062f,},
|
||||
{0xfeab,0xfeac,0x0630,0x0630,},
|
||||
{0xfead,0xfeae,0x0631,0x0631,},
|
||||
{0xfeaf,0xfeb0,0x0632,0x0632,},
|
||||
{0xfeb1,0xfeb2,0xfeb3,0xfeb4,},
|
||||
{0xfeb5,0xfeb6,0xfeb7,0xfeb8,},
|
||||
{0xfeb9,0xfeba,0xfebb,0xfebc,},
|
||||
{0xfebd,0xfebe,0xfebf,0xfec0,},
|
||||
{0xfec1,0xfec2,0xfec3,0xfec4,},
|
||||
{0xfec5,0xfec6,0xfec7,0xfec8,},
|
||||
{0xfec9,0xfeca,0xfecb,0xfecc,},
|
||||
{0xfecd,0xfece,0xfecf,0xfed0,},
|
||||
{0x063b,0x063b,0x063b,0x063b,},
|
||||
{0x063c,0x063c,0x063c,0x063c,},
|
||||
{0x063d,0x063d,0x063d,0x063d,},
|
||||
{0x063e,0x063e,0x063e,0x063e,},
|
||||
{0x063f,0x063f,0x063f,0x063f,},
|
||||
{0x0640,0x0640,0x0640,0x0640,},
|
||||
{0xfed1,0xfed2,0xfed3,0xfed4,},
|
||||
{0xfed5,0xfed6,0xfed7,0xfed8,},
|
||||
{0xfed9,0xfeda,0xfedb,0xfedc,},
|
||||
{0xfedd,0xfede,0xfedf,0xfee0,},
|
||||
{0xfee1,0xfee2,0xfee3,0xfee4,},
|
||||
{0xfee5,0xfee6,0xfee7,0xfee8,},
|
||||
{0xfee9,0xfeea,0xfeeb,0xfeec,},
|
||||
{0xfeed,0xfeee,0x0648,0x0648,},
|
||||
{0xfeef,0xfef0,0xfbe8,0xfbe9,},
|
||||
{0xfef1,0xfef2,0xfef3,0xfef4,},
|
||||
{0x064b,0x064b,0x064b,0x064b,},
|
||||
{0x064c,0x064c,0x064c,0x064c,},
|
||||
{0x064d,0x064d,0x064d,0x064d,},
|
||||
{0x064e,0x064e,0x064e,0x064e,},
|
||||
{0x064f,0x064f,0x064f,0x064f,},
|
||||
{0x0650,0x0650,0x0650,0x0650,},
|
||||
{0x0651,0x0651,0x0651,0x0651,},
|
||||
{0x0652,0x0652,0x0652,0x0652,},
|
||||
{0x0653,0x0653,0x0653,0x0653,},
|
||||
{0x0654,0x0654,0x0654,0x0654,},
|
||||
{0x0655,0x0655,0x0655,0x0655,},
|
||||
{0x0656,0x0656,0x0656,0x0656,},
|
||||
{0x0657,0x0657,0x0657,0x0657,},
|
||||
{0x0658,0x0658,0x0658,0x0658,},
|
||||
{0x0659,0x0659,0x0659,0x0659,},
|
||||
{0x065a,0x065a,0x065a,0x065a,},
|
||||
{0x065b,0x065b,0x065b,0x065b,},
|
||||
{0x065c,0x065c,0x065c,0x065c,},
|
||||
{0x065d,0x065d,0x065d,0x065d,},
|
||||
{0x065e,0x065e,0x065e,0x065e,},
|
||||
{0x065f,0x065f,0x065f,0x065f,},
|
||||
{0x0660,0x0660,0x0660,0x0660,},
|
||||
{0x0661,0x0661,0x0661,0x0661,},
|
||||
{0x0662,0x0662,0x0662,0x0662,},
|
||||
{0x0663,0x0663,0x0663,0x0663,},
|
||||
{0x0664,0x0664,0x0664,0x0664,},
|
||||
{0x0665,0x0665,0x0665,0x0665,},
|
||||
{0x0666,0x0666,0x0666,0x0666,},
|
||||
{0x0667,0x0667,0x0667,0x0667,},
|
||||
{0x0668,0x0668,0x0668,0x0668,},
|
||||
{0x0669,0x0669,0x0669,0x0669,},
|
||||
{0x066a,0x066a,0x066a,0x066a,},
|
||||
{0x066b,0x066b,0x066b,0x066b,},
|
||||
{0x066c,0x066c,0x066c,0x066c,},
|
||||
{0x066d,0x066d,0x066d,0x066d,},
|
||||
{0x066e,0x066e,0x066e,0x066e,},
|
||||
{0x066f,0x066f,0x066f,0x066f,},
|
||||
{0x0670,0x0670,0x0670,0x0670,},
|
||||
{0xfb50,0xfb51,0x0671,0x0671,},
|
||||
{0x0672,0x0672,0x0672,0x0672,},
|
||||
{0x0673,0x0673,0x0673,0x0673,},
|
||||
{0x0674,0x0674,0x0674,0x0674,},
|
||||
{0x0675,0x0675,0x0675,0x0675,},
|
||||
{0x0676,0x0676,0x0676,0x0676,},
|
||||
{0xfbdd,0x0677,0x0677,0x0677,},
|
||||
{0x0678,0x0678,0x0678,0x0678,},
|
||||
{0xfb66,0xfb67,0xfb68,0xfb69,},
|
||||
{0xfb5e,0xfb5f,0xfb60,0xfb61,},
|
||||
{0xfb52,0xfb53,0xfb54,0xfb55,},
|
||||
{0x067c,0x067c,0x067c,0x067c,},
|
||||
{0x067d,0x067d,0x067d,0x067d,},
|
||||
{0xfb56,0xfb57,0xfb58,0xfb59,},
|
||||
{0xfb62,0xfb63,0xfb64,0xfb65,},
|
||||
{0xfb5a,0xfb5b,0xfb5c,0xfb5d,},
|
||||
{0x0681,0x0681,0x0681,0x0681,},
|
||||
{0x0682,0x0682,0x0682,0x0682,},
|
||||
{0xfb76,0xfb77,0xfb78,0xfb79,},
|
||||
{0xfb72,0xfb73,0xfb74,0xfb75,},
|
||||
{0x0685,0x0685,0x0685,0x0685,},
|
||||
{0xfb7a,0xfb7b,0xfb7c,0xfb7d,},
|
||||
{0xfb7e,0xfb7f,0xfb80,0xfb81,},
|
||||
{0xfb88,0xfb89,0x0688,0x0688,},
|
||||
{0x0689,0x0689,0x0689,0x0689,},
|
||||
{0x068a,0x068a,0x068a,0x068a,},
|
||||
{0x068b,0x068b,0x068b,0x068b,},
|
||||
{0xfb84,0xfb85,0x068c,0x068c,},
|
||||
{0xfb82,0xfb83,0x068d,0x068d,},
|
||||
{0xfb86,0xfb87,0x068e,0x068e,},
|
||||
{0x068f,0x068f,0x068f,0x068f,},
|
||||
{0x0690,0x0690,0x0690,0x0690,},
|
||||
{0xfb8c,0xfb8d,0x0691,0x0691,},
|
||||
{0x0692,0x0692,0x0692,0x0692,},
|
||||
{0x0693,0x0693,0x0693,0x0693,},
|
||||
{0x0694,0x0694,0x0694,0x0694,},
|
||||
{0x0695,0x0695,0x0695,0x0695,},
|
||||
{0x0696,0x0696,0x0696,0x0696,},
|
||||
{0x0697,0x0697,0x0697,0x0697,},
|
||||
{0xfb8a,0xfb8b,0x0698,0x0698,},
|
||||
{0x0699,0x0699,0x0699,0x0699,},
|
||||
{0x069a,0x069a,0x069a,0x069a,},
|
||||
{0x069b,0x069b,0x069b,0x069b,},
|
||||
{0x069c,0x069c,0x069c,0x069c,},
|
||||
{0x069d,0x069d,0x069d,0x069d,},
|
||||
{0x069e,0x069e,0x069e,0x069e,},
|
||||
{0x069f,0x069f,0x069f,0x069f,},
|
||||
{0x06a0,0x06a0,0x06a0,0x06a0,},
|
||||
{0x06a1,0x06a1,0x06a1,0x06a1,},
|
||||
{0x06a2,0x06a2,0x06a2,0x06a2,},
|
||||
{0x06a3,0x06a3,0x06a3,0x06a3,},
|
||||
{0xfb6a,0xfb6b,0xfb6c,0xfb6d,},
|
||||
{0x06a5,0x06a5,0x06a5,0x06a5,},
|
||||
{0xfb6e,0xfb6f,0xfb70,0xfb71,},
|
||||
{0x06a7,0x06a7,0x06a7,0x06a7,},
|
||||
{0x06a8,0x06a8,0x06a8,0x06a8,},
|
||||
{0xfb8e,0xfb8f,0xfb90,0xfb91,},
|
||||
{0x06aa,0x06aa,0x06aa,0x06aa,},
|
||||
{0x06ab,0x06ab,0x06ab,0x06ab,},
|
||||
{0x06ac,0x06ac,0x06ac,0x06ac,},
|
||||
{0xfbd3,0xfbd4,0xfbd5,0xfbd6,},
|
||||
{0x06ae,0x06ae,0x06ae,0x06ae,},
|
||||
{0xfb92,0xfb93,0xfb94,0xfb95,},
|
||||
{0x06b0,0x06b0,0x06b0,0x06b0,},
|
||||
{0xfb9a,0xfb9b,0xfb9c,0xfb9d,},
|
||||
{0x06b2,0x06b2,0x06b2,0x06b2,},
|
||||
{0xfb96,0xfb97,0xfb98,0xfb99,},
|
||||
{0x06b4,0x06b4,0x06b4,0x06b4,},
|
||||
{0x06b5,0x06b5,0x06b5,0x06b5,},
|
||||
{0x06b6,0x06b6,0x06b6,0x06b6,},
|
||||
{0x06b7,0x06b7,0x06b7,0x06b7,},
|
||||
{0x06b8,0x06b8,0x06b8,0x06b8,},
|
||||
{0x06b9,0x06b9,0x06b9,0x06b9,},
|
||||
{0xfb9e,0xfb9f,0x06ba,0x06ba,},
|
||||
{0xfba0,0xfba1,0xfba2,0xfba3,},
|
||||
{0x06bc,0x06bc,0x06bc,0x06bc,},
|
||||
{0x06bd,0x06bd,0x06bd,0x06bd,},
|
||||
{0xfbaa,0xfbab,0xfbac,0xfbad,},
|
||||
{0x06bf,0x06bf,0x06bf,0x06bf,},
|
||||
{0xfba4,0xfba5,0x06c0,0x06c0,},
|
||||
{0xfba6,0xfba7,0xfba8,0xfba9,},
|
||||
{0x06c2,0x06c2,0x06c2,0x06c2,},
|
||||
{0x06c3,0x06c3,0x06c3,0x06c3,},
|
||||
{0x06c4,0x06c4,0x06c4,0x06c4,},
|
||||
{0xfbe0,0xfbe1,0x06c5,0x06c5,},
|
||||
{0xfbd9,0xfbda,0x06c6,0x06c6,},
|
||||
{0xfbd7,0xfbd8,0x06c7,0x06c7,},
|
||||
{0xfbdb,0xfbdc,0x06c8,0x06c8,},
|
||||
{0xfbe2,0xfbe3,0x06c9,0x06c9,},
|
||||
{0x06ca,0x06ca,0x06ca,0x06ca,},
|
||||
{0xfbde,0xfbdf,0x06cb,0x06cb,},
|
||||
{0xfbfc,0xfbfd,0xfbfe,0xfbff,},
|
||||
{0x06cd,0x06cd,0x06cd,0x06cd,},
|
||||
{0x06ce,0x06ce,0x06ce,0x06ce,},
|
||||
{0x06cf,0x06cf,0x06cf,0x06cf,},
|
||||
{0xfbe4,0xfbe5,0xfbe6,0xfbe7,},
|
||||
{0x06d1,0x06d1,0x06d1,0x06d1,},
|
||||
{0xfbae,0xfbaf,0x06d2,0x06d2,},
|
||||
{0xfbb0,0xfbb1,0x06d3,0x06d3,},
|
||||
};
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifndef MGBIDI_ACCESS_SHAPE_TABLE
|
||||
# define MGBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \
|
||||
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
|
||||
#endif
|
||||
|
||||
#define MGBIDI_GET_ARABIC_SHAPE_PRES(x,shape) MGBIDI_ACCESS_SHAPE_TABLE(ArShap, 0x0621, 0x06d3, (x), (shape))
|
||||
|
||||
/* End of generated mgbidi-arabic-shaping-table.h */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -494,7 +494,7 @@ static const char *gbidi_get_bidi_type_name(BidiType t)
|
||||
switch ((int)t) {
|
||||
# define _BIDI_ADD_TYPE(TYPE,SYMBOL) case BIDI_TYPE_##TYPE: return #TYPE;
|
||||
# define _BIDI_ALL_TYPES
|
||||
# include "mgbidi-bidi-types-list.h"
|
||||
# include "mgbidi-bidi-types-list.inc"
|
||||
# undef _BIDI_ALL_TYPES
|
||||
# undef _BIDI_ADD_TYPE
|
||||
default:
|
||||
|
||||
+53
-2
@@ -1,7 +1,9 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Werror -g -D__MINIGUI_LIB__ -I../../../include/
|
||||
COMPRESSION=2
|
||||
|
||||
all:mkmap-ucs-gb18030 mkmap-ucs-gb2312 \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-unicode-version \
|
||||
gen-bidi-type-tab \
|
||||
gen-joining-type-tab \
|
||||
@@ -15,7 +17,6 @@ mkmap-ucs-gb2312:mkmap-ucs-gb2312.o
|
||||
mkmap-ucs-gb18030:mkmap-ucs-gb18030.o
|
||||
|
||||
gen-unicode-version:gen-unicode-version.o
|
||||
|
||||
gen-bidi-type-tab:gen-bidi-type-tab.o packtab.o
|
||||
gen-joining-type-tab:gen-joining-type-tab.o packtab.o
|
||||
gen-arabic-shaping-tab:gen-arabic-shaping-tab.o packtab.o
|
||||
@@ -23,8 +24,20 @@ gen-mirroring-tab:gen-mirroring-tab.o packtab.o
|
||||
gen-brackets-tab:gen-brackets-tab.o packtab.o
|
||||
gen-brackets-type-tab:gen-brackets-type-tab.o packtab.o
|
||||
|
||||
biditables:mgbidi-unicode-version.h \
|
||||
mgbidi-bidi-type-table.inc \
|
||||
mgbidi-joining-type-table.inc \
|
||||
mgbidi-arabic-shaping-table.inc \
|
||||
mgbidi-mirroring-table.inc \
|
||||
mgbidi-brackets-table.inc \
|
||||
mgbidi-brackets-type-table.inc
|
||||
|
||||
mgbidi-unicode-version.h:ucd/ReadMe.txt gen-unicode-version
|
||||
./gen-unicode-version ucd/ReadMe.txt > mgbidi-unicode-version.h
|
||||
|
||||
clean:
|
||||
rm -f *.o mkmap-ucs-gb2312 mkmap-gb18030-ucs.c mkmap-ucs-gb18030 \
|
||||
rm -f *.o mgbidi-*.h \
|
||||
mkmap-ucs-gb2312 mkmap-gb18030-ucs.c mkmap-ucs-gb18030 \
|
||||
gen-unicode-version \
|
||||
gen-bidi-type-tab \
|
||||
gen-joining-type-tab \
|
||||
@@ -33,3 +46,41 @@ clean:
|
||||
gen-brackets-tab \
|
||||
gen-brackets-type-tab
|
||||
|
||||
mgbidi-bidi-type-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-bidi-type-tab
|
||||
./gen-bidi-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
mgbidi-joining-type-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
ucd/ArabicShaping.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-joining-type-tab
|
||||
./gen-joining-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
mgbidi-arabic-shaping-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-arabic-shaping-tab
|
||||
./gen-arabic-shaping-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
mgbidi-mirroring-table.inc: \
|
||||
ucd/BidiMirroring.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-mirroring-tab
|
||||
./gen-mirroring-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
mgbidi-brackets-table.inc: \
|
||||
ucd/BidiBrackets.txt \
|
||||
ucd/UnicodeData.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-brackets-tab
|
||||
./gen-brackets-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
mgbidi-brackets-type-table.inc: \
|
||||
ucd/BidiBrackets.txt \
|
||||
mgbidi-unicode-version.h \
|
||||
gen-brackets-type-tab
|
||||
./gen-brackets-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
ARABICSHAPING=ucd/ArabicShaping.txt
|
||||
UNICODEDATA=ucd/UnicodeData.txt
|
||||
|
||||
LAMclass="(`grep '; LAM$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
|
||||
ALEFclass="(`grep '; ALEF$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
|
||||
|
||||
grep -E ";<(final|isolated)> $LAMclass $ALEFclass;" "$UNICODEDATA"
|
||||
@@ -8,22 +8,22 @@
|
||||
*
|
||||
* Copyright (C) 2004 Sharif FarsiWeb, Inc
|
||||
* Copyright (C) 2004, 2005 Behdad Esfahbod
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library, in a file named COPYING; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA
|
||||
*
|
||||
*
|
||||
* For licensing issues, contact <fribidi.license@gmail.com>.
|
||||
*/
|
||||
|
||||
@@ -77,6 +77,7 @@ die3 (
|
||||
exit (1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
die3l (
|
||||
const char *fmt,
|
||||
@@ -89,6 +90,7 @@ die3l (
|
||||
fprintf (stderr, "\n");
|
||||
exit (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *arabic_shaping_tags[] = {
|
||||
"isolated",
|
||||
@@ -162,10 +164,10 @@ read_unicode_data_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (*s == '#' || *s == '\0' || *s == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
i = sscanf (s, "%lx;%*[^;];%*[^;];%*[^;];%*[^;];<%[^;> ]> %lx %[^; ]", &c, tag, &unshaped, buf2);
|
||||
|
||||
@@ -173,17 +175,21 @@ read_unicode_data_txt (
|
||||
continue;
|
||||
|
||||
if (i != 3 || c >= MGBIDI_UNICODE_CHARS || unshaped >= MGBIDI_UNICODE_CHARS)
|
||||
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
|
||||
#if 0
|
||||
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
|
||||
#else
|
||||
fprintf (stderr, "UnicodeData.txt: skip character larger than MGBIDI_UNICODE_CHARS at line %ld: %s", l, s);
|
||||
#endif
|
||||
|
||||
shape = shape_is (tag, arabic_shaping_tags);
|
||||
if (shape >= 0)
|
||||
{
|
||||
table[unshaped][shape] = c;
|
||||
if (unshaped < minshaped)
|
||||
minshaped = unshaped;
|
||||
if (unshaped > maxshaped)
|
||||
maxshaped = unshaped;
|
||||
}
|
||||
table[unshaped][shape] = c;
|
||||
if (unshaped < minshaped)
|
||||
minshaped = unshaped;
|
||||
if (unshaped > maxshaped)
|
||||
maxshaped = unshaped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,12 +205,12 @@ read_data (
|
||||
data_file_name++, data_file_type++)
|
||||
{
|
||||
if (!(f = fopen (data_file_name[0], "rt")))
|
||||
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
|
||||
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
|
||||
|
||||
if (!strcmp (data_file_type[0], "UnicodeData.txt"))
|
||||
read_unicode_data_txt (f);
|
||||
read_unicode_data_txt (f);
|
||||
else
|
||||
die2 ("error: unknown data-file type %s", data_file_type[0]);
|
||||
die2 ("error: unknown data-file type %s", data_file_type[0]);
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
@@ -219,20 +225,20 @@ gen_arabic_shaping_tab (
|
||||
{
|
||||
register Uchar32 c;
|
||||
register int shape;
|
||||
|
||||
|
||||
if (maxshaped < minshaped)
|
||||
die ("error: no shaping pair found, something wrong with reading input");
|
||||
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the files %s, %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
|
||||
data_file_type[1]);
|
||||
" * from the files %s, %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
|
||||
data_file_type[1]);
|
||||
|
||||
printf ("/*\n"
|
||||
" use %s(key,shape) to access your table\n\n"
|
||||
" required memory: %ld\n"
|
||||
" */\n\n",
|
||||
macro_name, (long)(maxshaped - minshaped + 1) * 4 * sizeof (Uchar32));
|
||||
" use %s(key,shape) to access your table\n\n"
|
||||
" required memory: %ld\n"
|
||||
" */\n\n",
|
||||
macro_name, (long)(maxshaped - minshaped + 1) * 4 * sizeof (Uchar32));
|
||||
|
||||
printf ("\n" "/* *IND" "ENT-OFF* */\n\n");
|
||||
|
||||
@@ -244,19 +250,19 @@ gen_arabic_shaping_tab (
|
||||
printf ("0x%04lx,", (unsigned long)table[c][shape]);
|
||||
printf ("},\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf ("};\n\n");
|
||||
|
||||
printf ("/* *IND" "ENT-ON* */\n\n");
|
||||
|
||||
printf ("#ifndef MGBIDI_ACCESS_SHAPE_TABLE\n"
|
||||
"# define MGBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \\\n"
|
||||
" (((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])\n"
|
||||
"#endif\n\n");
|
||||
"# define MGBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \\\n"
|
||||
" (((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])\n"
|
||||
"#endif\n\n");
|
||||
printf ("#define %s(x,shape) "
|
||||
"MGBIDI_ACCESS_SHAPE_TABLE(%s, 0x%04lx, 0x%04lx, (x), (shape))\n\n",
|
||||
macro_name, table_name, (unsigned long)minshaped, (unsigned long)maxshaped);
|
||||
"MGBIDI_ACCESS_SHAPE_TABLE(%s, 0x%04lx, 0x%04lx, (x), (shape))\n\n",
|
||||
macro_name, table_name, (unsigned long)minshaped, (unsigned long)maxshaped);
|
||||
|
||||
printf ("/* End of generated " outputname " */\n");
|
||||
}
|
||||
@@ -272,7 +278,7 @@ main (
|
||||
|
||||
if (argc < 3)
|
||||
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
|
||||
data_file_type[0], data_file_type[1]);
|
||||
data_file_type[0], data_file_type[1]);
|
||||
|
||||
{
|
||||
int max_depth = atoi (argv[1]);
|
||||
|
||||
@@ -187,10 +187,10 @@ init_tab_unicode_data_txt (
|
||||
if (MGBIDI_UNICODE_CHARS > 0x10000)
|
||||
{
|
||||
for (c = 0x10800; c < 0x11000; c++)
|
||||
table[c] = RTL;
|
||||
table[c] = RTL;
|
||||
|
||||
for (c = 0xE0000; c < 0xE1000; c++)
|
||||
table[c] = BN;
|
||||
table[c] = BN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,14 +220,18 @@ read_unicode_data_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
i = sscanf (s, "%lx;%*[^;];%*[^;];%*[^;];%[^; ]", &c, tp);
|
||||
if (i != 2 || c >= MGBIDI_UNICODE_CHARS)
|
||||
die3 ("invalid input at line %ld: %s", l, s);
|
||||
#if 0
|
||||
die3 ("invalid input at line %ld: %s", l, s);
|
||||
#else
|
||||
fprintf (stderr, "skip character larger than MGBIDI_UNICODE_CHARS at line %ld: %s", l, s);
|
||||
#endif
|
||||
|
||||
/* FIXME: We don't handle First..Last parts of UnicodeData.txt,
|
||||
* but it works, since all those are LTR. */
|
||||
@@ -254,23 +258,23 @@ read_derived_bidi_class_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
i = sscanf (s, "%lx ; %[^; ]", &c, tp);
|
||||
if (i == 2)
|
||||
c2 = c;
|
||||
c2 = c;
|
||||
else
|
||||
i = sscanf (s, "%lx..%lx ; %[^; ]", &c, &c2, tp) - 1;
|
||||
i = sscanf (s, "%lx..%lx ; %[^; ]", &c, &c2, tp) - 1;
|
||||
|
||||
if (i != 2 || c > c2 || c2 >= MGBIDI_UNICODE_CHARS)
|
||||
die3 ("invalid input at line %ld: %s", l, s);
|
||||
die3 ("invalid input at line %ld: %s", l, s);
|
||||
|
||||
typ = get_type (tp);
|
||||
for (; c <= c2; c++)
|
||||
table[c] = typ;
|
||||
table[c] = typ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,20 +306,21 @@ gen_bidi_type_tab (
|
||||
)
|
||||
{
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
|
||||
printf ("#define PACKTAB_UINT8 uint8_t\n"
|
||||
"#define PACKTAB_UINT16 uint16_t\n"
|
||||
"#define PACKTAB_UINT32 uint32_t\n\n");
|
||||
printf ("#define PACKTAB_UINT8 Uint8\n"
|
||||
"#define PACKTAB_UINT16 Uint16\n"
|
||||
"#define PACKTAB_UINT32 Uint32\n\n");
|
||||
|
||||
if (!pack_table
|
||||
(table, MGBIDI_UNICODE_CHARS, 1, LTR, max_depth, 3, names,
|
||||
"unsigned char", table_name, macro_name, stdout))
|
||||
"Uint8", table_name, macro_name, stdout))
|
||||
die ("error: insufficient memory, decrease max_depth");
|
||||
|
||||
printf ("#undef PACKTAB_UINT8\n"
|
||||
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
|
||||
printf ("#undef PACKTAB_UINT8\n");
|
||||
printf ("#undef PACKTAB_UINT16\n");
|
||||
printf ("#undef PACKTAB_UINT32\n\n");
|
||||
|
||||
printf ("/* End of generated " outputname " */\n");
|
||||
}
|
||||
@@ -330,7 +335,7 @@ main (
|
||||
|
||||
if (argc < 3)
|
||||
die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
|
||||
data_file_type);
|
||||
data_file_type);
|
||||
|
||||
{
|
||||
int max_depth = atoi (argv[1]);
|
||||
|
||||
@@ -148,16 +148,21 @@ read_unicode_data_txt_equivalence (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
/* Field: 0 ; 1 ; 2 ; 3 ; 4 ; 5 */
|
||||
i = sscanf (s, "%lx;%*[^;];%*[^;];%*[^;];%*[^;];%[^;]", &c, ce_string);
|
||||
if (c >= MGBIDI_UNICODE_CHARS)
|
||||
{
|
||||
#if 0
|
||||
fprintf (stderr, "invalid input at line %ld: %s", l, s);
|
||||
exit(1);
|
||||
#else
|
||||
fprintf (stderr, "skip character larger than MGBIDI_UNICODE_CHARS at line %ld: %s", l, s);
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
if (i==1)
|
||||
continue;
|
||||
@@ -208,14 +213,14 @@ read_bidi_brackets_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
k = sscanf (s, "%lx; %lx; %c", &i, &j, &open_close);
|
||||
if (k != 3 || i >= MGBIDI_UNICODE_CHARS || j >= MGBIDI_UNICODE_CHARS)
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
|
||||
/* Open braces map to themself */
|
||||
if (open_close=='o')
|
||||
@@ -231,9 +236,9 @@ read_bidi_brackets_txt (
|
||||
dist = ((signed long) j - (signed long) i);
|
||||
table[i] = dist;
|
||||
if (dist > max_dist)
|
||||
max_dist = dist;
|
||||
max_dist = dist;
|
||||
else if (-dist > max_dist)
|
||||
max_dist = -dist;
|
||||
max_dist = -dist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,24 +284,25 @@ gen_brackets_tab (
|
||||
const char *key_type;
|
||||
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
|
||||
printf ("#define PACKTAB_UINT8 uint8_t\n"
|
||||
"#define PACKTAB_UINT16 uint16_t\n"
|
||||
"#define PACKTAB_UINT32 uint32_t\n\n");
|
||||
printf ("#define PACKTAB_UINT8 Uint8\n"
|
||||
"#define PACKTAB_UINT16 Uint16\n"
|
||||
"#define PACKTAB_UINT32 Uint32\n\n");
|
||||
|
||||
key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
|
||||
key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
|
||||
"int16_t" : "int32_t";
|
||||
key_type = key_bytes == 1 ? "Int8" : key_bytes == 2 ?
|
||||
"Int16" : "Int32";
|
||||
|
||||
if (!pack_table
|
||||
(table, MGBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
|
||||
key_type, table_name, macro_name "_DELTA", stdout))
|
||||
die ("error: insufficient memory, decrease max_depth");
|
||||
|
||||
printf ("#undef PACKTAB_UINT8\n"
|
||||
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
|
||||
printf ("#undef PACKTAB_UINT8\n");
|
||||
printf ("#undef PACKTAB_UINT16\n");
|
||||
printf ("#undef PACKTAB_UINT32\n\n");
|
||||
|
||||
printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");
|
||||
|
||||
@@ -314,7 +320,7 @@ main (
|
||||
|
||||
if (argc < 4)
|
||||
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
|
||||
bracket_datafile_type,
|
||||
bracket_datafile_type,
|
||||
uni_datafile_type);
|
||||
|
||||
{
|
||||
|
||||
@@ -134,14 +134,14 @@ read_bidi_brackets_type_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
k = sscanf (s, "%lx; %lx; %c", &i, &j, &open_close);
|
||||
if (k != 3 || i >= MGBIDI_UNICODE_CHARS || j >= MGBIDI_UNICODE_CHARS)
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
table[i] = 1 + (0x2 * (open_close=='o'));
|
||||
}
|
||||
}
|
||||
@@ -175,16 +175,16 @@ gen_brackets_tab (
|
||||
const char *key_type;
|
||||
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
|
||||
printf ("#define PACKTAB_UINT8 uint8_t\n"
|
||||
"#define PACKTAB_UINT16 uint16_t\n"
|
||||
"#define PACKTAB_UINT32 uint32_t\n\n");
|
||||
printf ("#define PACKTAB_UINT8 Uint8\n"
|
||||
"#define PACKTAB_UINT16 Uint16\n"
|
||||
"#define PACKTAB_UINT32 Uint32\n\n");
|
||||
|
||||
key_bytes = 1;
|
||||
key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
|
||||
"int16_t" : "int32_t";
|
||||
key_type = key_bytes == 1 ? "Int8" : key_bytes == 2 ?
|
||||
"Int16" : "Int32";
|
||||
|
||||
if (!pack_table
|
||||
(table, MGBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
|
||||
@@ -192,7 +192,8 @@ gen_brackets_tab (
|
||||
die ("error: insufficient memory, decrease max_depth");
|
||||
|
||||
printf ("#undef PACKTAB_UINT8\n"
|
||||
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
|
||||
"#undef PACKTAB_UINT16\n"
|
||||
"#undef PACKTAB_UINT32\n\n");
|
||||
|
||||
printf ("/* End of generated " outputname " */\n");
|
||||
}
|
||||
@@ -207,7 +208,7 @@ main (
|
||||
|
||||
if (argc < 3)
|
||||
die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
|
||||
data_file_type);
|
||||
data_file_type);
|
||||
|
||||
{
|
||||
int max_depth = atoi (argv[1]);
|
||||
|
||||
@@ -210,19 +210,23 @@ read_unicode_data_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (*s == '#' || *s == '\0' || *s == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
i = sscanf (s, "%lx;%*[^;];%[^; ];%*[^;];%[^; ]", &c, tp_gen, tp_bidi);
|
||||
if (i != 3 || c >= MGBIDI_UNICODE_CHARS)
|
||||
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
|
||||
#if 0
|
||||
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
|
||||
#else
|
||||
fprintf (stderr, "skip character larger than MGBIDI_UNICODE_CHARS at line %ld: %s", l, s);
|
||||
#endif
|
||||
|
||||
if (type_is (tp_bidi, ignored_bidi_types))
|
||||
table[c] = G;
|
||||
table[c] = G;
|
||||
if (type_is (tp_gen, transparent_general_categories))
|
||||
table[c] = T;
|
||||
table[c] = T;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,23 +247,23 @@ read_arabic_shaping_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (*s == '#' || *s == '\0' || *s == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
i = sscanf (s, "%lx ; %*[^;]; %[^; ]", &c, tp);
|
||||
if (i == 2)
|
||||
c2 = c;
|
||||
c2 = c;
|
||||
else
|
||||
i = sscanf (s, "%lx..%lx ; %*[^;]; %[^; ]", &c, &c2, tp) - 1;
|
||||
i = sscanf (s, "%lx..%lx ; %*[^;]; %[^; ]", &c, &c2, tp) - 1;
|
||||
|
||||
if (i != 2 || c > c2 || c2 >= MGBIDI_UNICODE_CHARS)
|
||||
die3l ("ArabicShaping.txt: invalid input at line %ld: %s", l, s);
|
||||
die3l ("ArabicShaping.txt: invalid input at line %ld: %s", l, s);
|
||||
|
||||
typ = get_type (tp);
|
||||
for (; c <= c2; c++)
|
||||
table[c] = typ;
|
||||
table[c] = typ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,14 +279,14 @@ read_data (
|
||||
data_file_name++, data_file_type++)
|
||||
{
|
||||
if (!(f = fopen (data_file_name[0], "rt")))
|
||||
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
|
||||
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
|
||||
|
||||
if (!strcmp (data_file_type[0], "UnicodeData.txt"))
|
||||
read_unicode_data_txt (f);
|
||||
read_unicode_data_txt (f);
|
||||
else if (!strcmp (data_file_type[0], "ArabicShaping.txt"))
|
||||
read_arabic_shaping_txt (f);
|
||||
read_arabic_shaping_txt (f);
|
||||
else
|
||||
die2 ("error: unknown data-file type %s", data_file_type[0]);
|
||||
die2 ("error: unknown data-file type %s", data_file_type[0]);
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
@@ -296,21 +300,22 @@ gen_joining_type_tab (
|
||||
)
|
||||
{
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the files %s, %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
|
||||
data_file_type[1]);
|
||||
" * from the files %s, %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
|
||||
data_file_type[1]);
|
||||
|
||||
printf ("#define PACKTAB_UINT8 uint8_t\n"
|
||||
"#define PACKTAB_UINT16 uint16_t\n"
|
||||
"#define PACKTAB_UINT32 uint32_t\n\n");
|
||||
printf ("#define PACKTAB_UINT8 Uint8\n"
|
||||
"#define PACKTAB_UINT16 Uint16\n"
|
||||
"#define PACKTAB_UINT32 Uint32\n\n");
|
||||
|
||||
if (!pack_table
|
||||
(table, MGBIDI_UNICODE_CHARS, 1, U, max_depth, 1, names,
|
||||
"unsigned char", table_name, macro_name, stdout))
|
||||
"Uint8", table_name, macro_name, stdout))
|
||||
die ("error: insufficient memory, decrease max_depth");
|
||||
|
||||
printf ("#undef PACKTAB_UINT8\n"
|
||||
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
|
||||
printf ("#undef PACKTAB_UINT8\n");
|
||||
printf ("#undef PACKTAB_UINT16\n");
|
||||
printf ("#undef PACKTAB_UINT32\n\n");
|
||||
|
||||
printf ("/* End of generated " outputname " */\n");
|
||||
}
|
||||
@@ -326,7 +331,7 @@ main (
|
||||
|
||||
if (argc < 4)
|
||||
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
|
||||
data_file_type[0], data_file_type[1]);
|
||||
data_file_type[0], data_file_type[1]);
|
||||
|
||||
{
|
||||
int max_depth = atoi (argv[1]);
|
||||
|
||||
@@ -132,20 +132,20 @@ read_bidi_mirroring_txt (
|
||||
l++;
|
||||
|
||||
while (*s == ' ')
|
||||
s++;
|
||||
s++;
|
||||
|
||||
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
|
||||
continue;
|
||||
continue;
|
||||
|
||||
k = sscanf (s, "%lx; %lx", &i, &j);
|
||||
if (k != 2 || i >= MGBIDI_UNICODE_CHARS || j >= MGBIDI_UNICODE_CHARS)
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
|
||||
dist = ((signed long) j - (signed long) i);
|
||||
table[i] = dist;
|
||||
if (dist > max_dist)
|
||||
max_dist = dist;
|
||||
max_dist = dist;
|
||||
else if (-dist > max_dist)
|
||||
max_dist = -dist;
|
||||
max_dist = -dist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,16 +178,16 @@ gen_mirroring_tab (
|
||||
const char *key_type;
|
||||
|
||||
printf ("/* " outputname "\n * generated by " appname "\n"
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
" * from the file %s of Unicode version "
|
||||
MGBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
|
||||
|
||||
printf ("#define PACKTAB_UINT8 uint8_t\n"
|
||||
"#define PACKTAB_UINT16 uint16_t\n"
|
||||
"#define PACKTAB_UINT32 uint32_t\n\n");
|
||||
printf ("#define PACKTAB_UINT8 Uint8\n"
|
||||
"#define PACKTAB_UINT16 Uint16\n"
|
||||
"#define PACKTAB_UINT32 Uint32\n\n");
|
||||
|
||||
key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
|
||||
key_type = key_bytes == 1 ? "int8_t" : key_bytes == 2 ?
|
||||
"int16_t" : "int32_t";
|
||||
key_type = key_bytes == 1 ? "Int8" : key_bytes == 2 ?
|
||||
"Int16" : "Int32";
|
||||
|
||||
if (!pack_table
|
||||
(table, MGBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
|
||||
@@ -195,7 +195,8 @@ gen_mirroring_tab (
|
||||
die ("error: insufficient memory, decrease max_depth");
|
||||
|
||||
printf ("#undef PACKTAB_UINT8\n"
|
||||
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
|
||||
"#undef PACKTAB_UINT16\n"
|
||||
"#undef PACKTAB_UINT32\n\n");
|
||||
|
||||
printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");
|
||||
|
||||
@@ -212,7 +213,7 @@ main (
|
||||
|
||||
if (argc < 3)
|
||||
die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
|
||||
data_file_type);
|
||||
data_file_type);
|
||||
|
||||
{
|
||||
int max_depth = atoi (argv[1]);
|
||||
|
||||
+75
-77
@@ -65,7 +65,7 @@ most_binary (
|
||||
{
|
||||
/* min is less than half of max */
|
||||
for (i = 21 - 1; min < packtab_pow[i]; i--)
|
||||
;
|
||||
;
|
||||
i++;
|
||||
return packtab_pow[i];
|
||||
}
|
||||
@@ -136,12 +136,12 @@ found (
|
||||
best_s = s;
|
||||
best_lev = lev;
|
||||
for (i = 0; i <= lev; i++)
|
||||
{
|
||||
best_p[i] = p[i];
|
||||
best_c[i] = c[i];
|
||||
best_t[i] = t[i];
|
||||
best_cluster[i] = clusters[i];
|
||||
}
|
||||
{
|
||||
best_p[i] = p[i];
|
||||
best_c[i] = c[i];
|
||||
best_t[i] = t[i];
|
||||
best_cluster[i] = clusters[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,41 +169,41 @@ bt (
|
||||
|
||||
t[lev + 1] = (t[lev] - 1) / cluster + 1;
|
||||
for (j = 0; j < t[lev + 1]; j++)
|
||||
{
|
||||
memmove (temp + j * cmpcluster, tab[lev] + j * cluster,
|
||||
cluster * sizeof (tab[lev][0]));
|
||||
temp[j * cmpcluster + cluster] = j;
|
||||
}
|
||||
{
|
||||
memmove (temp + j * cmpcluster, tab[lev] + j * cluster,
|
||||
cluster * sizeof (tab[lev][0]));
|
||||
temp[j * cmpcluster + cluster] = j;
|
||||
}
|
||||
qsort (temp, t[lev + 1], cmpcluster * sizeof (temp[0]), compare);
|
||||
for (j = 0; j < t[lev + 1]; j++)
|
||||
{
|
||||
perm[j] = temp[j * cmpcluster + cluster];
|
||||
temp[j * cmpcluster + cluster] = 0;
|
||||
}
|
||||
{
|
||||
perm[j] = temp[j * cmpcluster + cluster];
|
||||
temp[j * cmpcluster + cluster] = 0;
|
||||
}
|
||||
k = 1;
|
||||
y = 0;
|
||||
tab[lev + 1][perm[0]] = perm[0];
|
||||
for (j = 1; j < t[lev + 1]; j++)
|
||||
{
|
||||
if (compare (temp + y, temp + y + cmpcluster))
|
||||
{
|
||||
k++;
|
||||
tab[lev + 1][perm[j]] = perm[j];
|
||||
}
|
||||
else
|
||||
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
|
||||
y += cmpcluster;
|
||||
}
|
||||
{
|
||||
if (compare (temp + y, temp + y + cmpcluster))
|
||||
{
|
||||
k++;
|
||||
tab[lev + 1][perm[j]] = perm[j];
|
||||
}
|
||||
else
|
||||
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
|
||||
y += cmpcluster;
|
||||
}
|
||||
sbak = s;
|
||||
s += k * node_size * cluster;
|
||||
c[lev] = k;
|
||||
|
||||
if (s >= best_s)
|
||||
{
|
||||
s = sbak;
|
||||
nn += i;
|
||||
return;
|
||||
}
|
||||
{
|
||||
s = sbak;
|
||||
nn += i;
|
||||
return;
|
||||
}
|
||||
|
||||
key_bytes = k * cluster;
|
||||
key_bytes = key_bytes < 0xff ? 1 : key_bytes < 0xffff ? 2 : 4;
|
||||
@@ -249,7 +249,7 @@ write_array (
|
||||
for (j = 0; j < t[lev + 1]; j++)
|
||||
{
|
||||
memmove (temp + j * cmpcluster, tab[lev] + j * cluster,
|
||||
cluster * sizeof (tab[lev][0]));
|
||||
cluster * sizeof (tab[lev][0]));
|
||||
temp[j * cmpcluster + cluster] = j;
|
||||
}
|
||||
qsort (temp, t[lev + 1], cmpcluster * sizeof (temp[0]), compare);
|
||||
@@ -264,13 +264,13 @@ write_array (
|
||||
for (j = 1; j < t[lev + 1]; j++)
|
||||
{
|
||||
if (compare (temp + y, temp + y + cmpcluster))
|
||||
{
|
||||
x[k] = perm[j];
|
||||
tab[lev + 1][perm[j]] = x[k];
|
||||
k++;
|
||||
}
|
||||
{
|
||||
x[k] = perm[j];
|
||||
tab[lev + 1][perm[j]] = x[k];
|
||||
k++;
|
||||
}
|
||||
else
|
||||
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
|
||||
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
|
||||
y += cmpcluster;
|
||||
}
|
||||
|
||||
@@ -283,42 +283,42 @@ write_array (
|
||||
max_key <= 0xff ? "PACKTAB_UINT8" :
|
||||
max_key <= 0xffff ? "PACKTAB_UINT16" : "PACKTAB_UINT32";
|
||||
fprintf (f, "static const %s %sLev%d[%ld*%d] = {", key_type, table_name,
|
||||
best_lev - lev - 1, cluster, k);
|
||||
best_lev - lev - 1, cluster, k);
|
||||
ofs = 0;
|
||||
for (ii = 0; ii < k; ii++)
|
||||
{
|
||||
int kk, jj;
|
||||
fprintf (f, "\n#define %sLev%d_%0*lX 0x%0X", table_name,
|
||||
best_lev - lev - 1, digits, x[i] * packtab_pow[n - nn], ofs);
|
||||
best_lev - lev - 1, digits, x[i] * packtab_pow[n - nn], ofs);
|
||||
kk = x[i] * cluster;
|
||||
if (!lev)
|
||||
if (name)
|
||||
for (j = 0; j < cluster; j++)
|
||||
{
|
||||
if (!(j % per_row) && j != cluster - 1)
|
||||
fprintf (f, "\n ");
|
||||
fprintf (f, "%*s,", tab_width, name[tab[lev][kk++]]);
|
||||
}
|
||||
else
|
||||
for (j = 0; j < cluster; j++)
|
||||
{
|
||||
if (!(j % per_row) && j != cluster - 1)
|
||||
fprintf (f, "\n ");
|
||||
fprintf (f, "%*d,", tab_width, tab[lev][kk++]);
|
||||
}
|
||||
if (name)
|
||||
for (j = 0; j < cluster; j++)
|
||||
{
|
||||
if (!(j % per_row) && j != cluster - 1)
|
||||
fprintf (f, "\n ");
|
||||
fprintf (f, "%*s,", tab_width, name[tab[lev][kk++]]);
|
||||
}
|
||||
else
|
||||
for (j = 0; j < cluster; j++)
|
||||
{
|
||||
if (!(j % per_row) && j != cluster - 1)
|
||||
fprintf (f, "\n ");
|
||||
fprintf (f, "%*d,", tab_width, tab[lev][kk++]);
|
||||
}
|
||||
else
|
||||
for (j = 0; j < cluster; j++, kk++)
|
||||
fprintf (f, "\n %sLev%d_%0*lX, /* %0*lX..%0*lX */", table_name,
|
||||
best_lev - lev, digits,
|
||||
tab[lev][kk] * packtab_pow[n - nn - best_p[lev]], digits,
|
||||
x[i] * packtab_pow[n - nn] + j * packtab_pow[n - nn - best_p[lev]], digits,
|
||||
x[i] * packtab_pow[n - nn] + (j + 1) * packtab_pow[n - nn - best_p[lev]] -
|
||||
1);
|
||||
for (j = 0; j < cluster; j++, kk++)
|
||||
fprintf (f, "\n %sLev%d_%0*lX, /* %0*lX..%0*lX */", table_name,
|
||||
best_lev - lev, digits,
|
||||
tab[lev][kk] * packtab_pow[n - nn - best_p[lev]], digits,
|
||||
x[i] * packtab_pow[n - nn] + j * packtab_pow[n - nn - best_p[lev]], digits,
|
||||
x[i] * packtab_pow[n - nn] + (j + 1) * packtab_pow[n - nn - best_p[lev]] -
|
||||
1);
|
||||
ofs += cluster;
|
||||
jj = i;
|
||||
for (j = 0; j < k; j++)
|
||||
if (x[j] > x[i] && (x[j] < x[jj] || jj == i))
|
||||
jj = j;
|
||||
if (x[j] > x[i] && (x[j] < x[jj] || jj == i))
|
||||
jj = j;
|
||||
i = jj;
|
||||
}
|
||||
fprintf (f, "\n};\n\n");
|
||||
@@ -338,12 +338,10 @@ write_source (
|
||||
s = 0;
|
||||
nn = n;
|
||||
t[0] = N;
|
||||
fprintf (f, "\n" "/* *IND" "ENT-OFF* */\n\n");
|
||||
write_array (0);
|
||||
fprintf (f, "/* *IND" "ENT-ON* */\n\n");
|
||||
|
||||
fprintf (f, "#define %s(x) \\\n", macro_name);
|
||||
fprintf (f, "\t((x) >= 0x%lx ? ", N);
|
||||
fprintf (f, " ((x) >= 0x%lx ? ", N);
|
||||
if (name)
|
||||
fprintf (f, "%s", name[def_key]);
|
||||
else
|
||||
@@ -352,11 +350,11 @@ write_source (
|
||||
j = 0;
|
||||
for (i = best_lev - 1; i >= 0; i--)
|
||||
{
|
||||
fprintf (f, " \\\n\t%sLev%d[((x)", table_name, i);
|
||||
fprintf (f, " \\\n %sLev%d[((x)", table_name, i);
|
||||
if (j != 0)
|
||||
fprintf (f, " >> %d", j);
|
||||
fprintf (f, " >> %d", j);
|
||||
if (i)
|
||||
fprintf (f, " & 0x%02lx) +", packtab_pow[best_p[best_lev - 1 - i]] - 1);
|
||||
fprintf (f, " & 0x%02lx) +", packtab_pow[best_p[best_lev - 1 - i]] - 1);
|
||||
j += best_p[best_lev - 1 - i];
|
||||
}
|
||||
fprintf (f, ")");
|
||||
@@ -372,14 +370,14 @@ write_out (
|
||||
{
|
||||
int i;
|
||||
fprintf (f, "/*\n"
|
||||
" generated by packtab.c version %d\n\n"
|
||||
" use %s(key) to access your table\n\n"
|
||||
" assumed sizeof(%s): %d\n"
|
||||
" required memory: %ld\n"
|
||||
" lookups: %d\n"
|
||||
" partition shape: %s",
|
||||
packtab_version, macro_name, key_type_name, a, best_s, best_lev,
|
||||
table_name);
|
||||
" generated by packtab.c version %d\n\n"
|
||||
" use %s(key) to access your table\n\n"
|
||||
" assumed sizeof(%s): %d\n"
|
||||
" required memory: %ld\n"
|
||||
" lookups: %d\n"
|
||||
" partition shape: %s",
|
||||
packtab_version, macro_name, key_type_name, a, best_s, best_lev,
|
||||
table_name);
|
||||
for (i = best_lev - 1; i >= 0; i--)
|
||||
fprintf (f, "[%ld]", best_cluster[i]);
|
||||
fprintf (f, "\n" " different table entries:");
|
||||
|
||||
Reference in New Issue
Block a user