Commit f43f8f9d authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

More readable output

parent 12bdcaca
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
typedef struct char_info_st typedef struct char_info_st
{ {
int cod;
int srt; int srt;
int uni; int uni;
int low; int low;
...@@ -47,6 +48,8 @@ static int chcmp(const void *vf, const void *vs) ...@@ -47,6 +48,8 @@ static int chcmp(const void *vf, const void *vs)
static void print_cs(CHARSET_INFO *cs) static void print_cs(CHARSET_INFO *cs)
{ {
uint i; uint i;
int srt;
int clr=0;
MY_CH ch[256]; MY_CH ch[256];
printf("<HTML>\n"); printf("<HTML>\n");
...@@ -55,8 +58,12 @@ static void print_cs(CHARSET_INFO *cs) ...@@ -55,8 +58,12 @@ static void print_cs(CHARSET_INFO *cs)
printf("<BODY><PRE>\n"); printf("<BODY><PRE>\n");
printf("Charset %s\n",cs->name); printf("Charset %s\n",cs->name);
printf("<TABLE>\n");
printf("<TR><TH>Code<TH>Uni<TH>Sort<TH>Ctype<TH>Ch<TH>Lo<TH>Up</TR>");
for (i=0; i<256; i++) for (i=0; i<256; i++)
{ {
ch[i].cod=i;
ch[i].srt=cs->sort_order[i]; ch[i].srt=cs->sort_order[i];
ch[i].uni=cs->tab_to_uni[i]; ch[i].uni=cs->tab_to_uni[i];
ch[i].low=cs->tab_to_uni[cs->to_lower[i]]; ch[i].low=cs->tab_to_uni[cs->to_lower[i]];
...@@ -65,12 +72,34 @@ static void print_cs(CHARSET_INFO *cs) ...@@ -65,12 +72,34 @@ static void print_cs(CHARSET_INFO *cs)
} }
qsort(ch,256,sizeof(MY_CH),&chcmp); qsort(ch,256,sizeof(MY_CH),&chcmp);
srt=ch[0].srt;
for (i=1; i<256; i++) for (i=0; i<256; i++)
{ {
printf("%d %d &#%d; &#%d; &#%d;\n",ch[i].srt,ch[i].ctp,ch[i].uni, clr = (srt!=ch[i].srt) ? !clr : clr;
ch[i].low,ch[i].upp);
printf("<TR bgcolor=#%s>",clr ? "DDDDDD" : "EEEE99");
printf("<TD>%02X",ch[i].cod);
printf("<TD>%04X",ch[i].uni);
printf("<TD>%d",ch[i].srt);
printf("<TD>%s%s%s%s%s%s%s%s",
ch[i].ctp & _U ? "U" : "",
ch[i].ctp & _L ? "L" : "",
ch[i].ctp & _NMR ? "N" : "",
ch[i].ctp & _SPC ? "S" : "",
ch[i].ctp & _PNT ? "P" : "",
ch[i].ctp & _CTR ? "C" : "",
ch[i].ctp & _B ? "B" : "",
ch[i].ctp & _X ? "X" : "");
printf("<TD>&#%d;",ch[i].uni);
printf("<TD>&#%d;",ch[i].low);
printf("<TD>&#%d;",ch[i].upp);
printf("</TR>\n");
srt=ch[i].srt;
} }
printf("</TABLE>\n");
printf("</PRE></BODY>\n"); printf("</PRE></BODY>\n");
printf("</HTML>\n"); printf("</HTML>\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment