summaryrefslogtreecommitdiff
path: root/strings/uca-dump.c
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2004-03-23 18:29:07 +0400
committerunknown <bar@bar.intranet.mysql.r18.ru>2004-03-23 18:29:07 +0400
commitd8c5358115abb7134943a8ec9b1f2ec0fabcae26 (patch)
tree721edcbffa129b2986341a3b67142a15622a0e1d /strings/uca-dump.c
parent256321fafa7dd4b1dfd09effcf61406d6219b125 (diff)
downloadmariadb-git-d8c5358115abb7134943a8ec9b1f2ec0fabcae26.tar.gz
uca-dump.c:
Don't dump default implicit weights strings/uca-dump.c: Don't dump default implicit weights
Diffstat (limited to 'strings/uca-dump.c')
-rw-r--r--strings/uca-dump.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/strings/uca-dump.c b/strings/uca-dump.c
index c8339d7b85b..6836c321526 100644
--- a/strings/uca-dump.c
+++ b/strings/uca-dump.c
@@ -8,10 +8,10 @@ typedef unsigned short uint16;
struct uca_item_st
{
uchar num;
- uint16 weight[4][8];
+ uint16 weight[4][9];
};
-#if 1
+#if 0
#define MY_UCA_NPAGES 1024
#define MY_UCA_NCHARS 64
#define MY_UCA_CMASK 63
@@ -30,8 +30,10 @@ int main(int ac, char **av)
struct uca_item_st uca[64*1024];
size_t code, page, w;
int pagemaxlen[MY_UCA_NPAGES];
+ int pageloaded[MY_UCA_NPAGES];
bzero(uca, sizeof(uca));
+ bzero(pageloaded, sizeof(pageloaded));
while (fgets(str,sizeof(str),stdin))
{
@@ -69,7 +71,10 @@ int main(int ac, char **av)
if (codenum>1)
{
- /* Multi-character weight */
+ /* Multi-character weight,
+ i.e. contraction.
+ Not supported yet.
+ */
continue;
}
@@ -97,10 +102,13 @@ int main(int ac, char **av)
s= endptr;
partnum++;
}
-
}
+ /* Mark that a character from this page was loaded */
+ pageloaded[code >> MY_UCA_PSHIFT]++;
}
+
+
/* Now set implicit weights */
for (code=0; code <= 0xFFFF; code++)
{
@@ -156,6 +164,12 @@ int main(int ac, char **av)
size_t nchars= 0;
size_t mchars;
+ /*
+ Skip this page if no weights were loaded
+ */
+
+ if (!pageloaded[page])
+ continue;
/*
Calculate maximum weight
@@ -176,9 +190,8 @@ int main(int ac, char **av)
maxnum= maxnum < num ? num : maxnum;
}
- if (!maxnum)
- maxnum=1;
-
+ maxnum++;
+
switch (maxnum)
{
case 0: mchars= 8; break;
@@ -190,14 +203,16 @@ int main(int ac, char **av)
}
pagemaxlen[page]= maxnum;
-
- printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n",
- page, page*MY_UCA_NCHARS, maxnum);
-
+
+
/*
Now print this page
*/
+
+ printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n",
+ page, page*MY_UCA_NCHARS, maxnum);
+
for (offs=0; offs < MY_UCA_NCHARS; offs++)
{
uint16 weight[8];
@@ -249,7 +264,10 @@ int main(int ac, char **av)
printf("uint16 *ucaw[%d]={\n",MY_UCA_NPAGES);
for (page=0; page < MY_UCA_NPAGES; page++)
{
- printf("page%03Xdata%s%s",page,page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
+ if (!pageloaded[page])
+ printf("NULL %s%s",page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
+ else
+ printf("page%03Xdata%s%s",page,page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
}
printf("};\n");