From da10603ec93f44355dd0f51ff065c4d30a527dd9 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 14 Sep 2014 00:42:48 +0200 Subject: [PATCH] update the html table generator --- ext/standard/html_tables/html_table_gen.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ext/standard/html_tables/html_table_gen.php b/ext/standard/html_tables/html_table_gen.php index 2aae24475a..a14cf5064d 100644 --- a/ext/standard/html_tables/html_table_gen.php +++ b/ext/standard/html_tables/html_table_gen.php @@ -371,18 +371,17 @@ $t = <<<'CODE' #define ENT_STAGE3_INDEX(k) ((k) & 0x3F) #define ENT_CODE_POINT_FROM_STAGES(i,j,k) (((i) << 12) | ((j) << 6) | (k)) -/* Table should be organized with a leading row telling the size of - * the table and the default entity (maybe NULL) and the rest being - * normal rows ordered by code point so that we can do a binary search */ +/* The default entity may be NULL. Binary search is still possible while + is senseless as there are just two rows (see also find_entity_for_char()). */ typedef union { struct { - unsigned size; /* number of remaining entries in the table */ const char *default_entity; + unsigned size; /* number of remaining entries in the table */ unsigned short default_entity_len; } leading_entry; struct { - unsigned second_cp; /* second code point */ const char *entity; + unsigned second_cp; /* second code point */ unsigned short entity_len; } normal_entry; } entity_multicodepoint_row; @@ -475,16 +474,16 @@ foreach ($multicp_rows as $k => $v) { if (key_exists("default", $v)) { if ($v['default'] == 'GT') /* hack to make > translate to > not GT; */ $v['default'] = "gt"; - echo "\t{ {", sprintf("%02d", count($v) - 1), - ",\t\t", sprintf("\"%-21s", $v["default"].'",'), "\t", + echo "\t{ {", sprintf("\"%-21s", $v["default"].'",'), + "\t", sprintf("%02d", (count($v) - 1)), ",\t\t", sprintf("% 2d", strlen($v["default"])), '} },', "\n"; } else { - echo "\t{ {", sprintf("%02d", count($v)), - ",\t\t", sprintf("%-22s", 'NULL'), ",\t0} },\n"; + echo "\t{ {", sprintf("%-22s", 'NULL,'), + "\t", sprintf("%02d", count($v)), ",\t\t0} },\n"; } unset($v["default"]); foreach ($v as $l => $w) { - echo "\t{ {", sprintf("0x%05s", $l), ",\t", sprintf("\"%-21s", $w.'",'), "\t", + echo "\t{ {", sprintf("\"%-21s", $w.'",'), "\t", sprintf("0x%05s", $l), ",\t", sprintf("% 2d", strlen($w)), '} },', "\n"; } echo "};\n"; -- 2.50.1