Commit 5b2d1a65 authored by unknown's avatar unknown

Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-mysqladmin


ndb/src/kernel/vm/Configuration.cpp:
  Auto merged
ndb/src/mgmclient/main.cpp:
  Auto merged
ndb/src/mgmsrv/main.cpp:
  Auto merged
ndb/tools/restore/restore_main.cpp:
  Auto merged
ndb/tools/select_all.cpp:
  Auto merged
ndb/tools/waiter.cpp:
  Auto merged
parents 404b1524 6aebd056
...@@ -63,7 +63,7 @@ typedef struct unicase_info_st ...@@ -63,7 +63,7 @@ typedef struct unicase_info_st
#define MY_CS_UNICODE 128 /* is a charset is full unicode */ #define MY_CS_UNICODE 128 /* is a charset is full unicode */
#define MY_CS_READY 256 /* if a charset is initialized */ #define MY_CS_READY 256 /* if a charset is initialized */
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ #define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
#define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_UNDEFINED 0
......
...@@ -296,3 +296,12 @@ FD C3BD FD 1 ...@@ -296,3 +296,12 @@ FD C3BD FD 1
FE C3BE FE 1 FE C3BE FE 1
FF C3BF FF 1 FF C3BF FF 1
DROP TABLE t1; DROP TABLE t1;
select 'a' regexp 'A' collate latin1_general_ci;
'a' regexp 'A' collate latin1_general_ci
1
select 'a' regexp 'A' collate latin1_general_cs;
'a' regexp 'A' collate latin1_general_cs
0
select 'a' regexp 'A' collate latin1_bin;
'a' regexp 'A' collate latin1_bin
0
...@@ -53,3 +53,10 @@ SELECT ...@@ -53,3 +53,10 @@ SELECT
hex(@l:=convert(@u using latin1)), hex(@l:=convert(@u using latin1)),
a=@l FROM t1; a=@l FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #6737: REGEXP gives wrong result with case sensitive collation
#
select 'a' regexp 'A' collate latin1_general_ci;
select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
...@@ -228,6 +228,7 @@ static int add_collation(CHARSET_INFO *cs) ...@@ -228,6 +228,7 @@ static int add_collation(CHARSET_INFO *cs)
} }
else else
{ {
uchar *sort_order= all_charsets[cs->number]->sort_order;
simple_cs_init_functions(all_charsets[cs->number]); simple_cs_init_functions(all_charsets[cs->number]);
new->mbminlen= 1; new->mbminlen= 1;
new->mbmaxlen= 1; new->mbmaxlen= 1;
...@@ -236,6 +237,16 @@ static int add_collation(CHARSET_INFO *cs) ...@@ -236,6 +237,16 @@ static int add_collation(CHARSET_INFO *cs)
all_charsets[cs->number]->state |= MY_CS_LOADED; all_charsets[cs->number]->state |= MY_CS_LOADED;
} }
all_charsets[cs->number]->state|= MY_CS_AVAILABLE; all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
/*
Check if case sensitive sort order: A < a < B.
We need MY_CS_FLAG for regex library, and for
case sensitivity flag for 5.0 client protocol,
to support isCaseSensitive() method in JDBC driver
*/
if (sort_order && sort_order['A'] < sort_order['a'] &&
sort_order['a'] < sort_order['B'])
all_charsets[cs->number]->state|= MY_CS_CSSORT;
} }
} }
else else
......
...@@ -32,10 +32,13 @@ ...@@ -32,10 +32,13 @@
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
{ "version", 'V', "Output version information and exit.", 0, 0, 0, \ { "version", 'V', "Output version information and exit.", 0, 0, 0, \
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
{ "connect-string", 'c', \ { "ndb-connectstring", 'c', \
"Set connect string for connecting to ndb_mgmd. " \ "Set connect string for connecting to ndb_mgmd. " \
"<constr>=\"host=<hostname:port>[;nodeid=<id>]\". " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
"Overides specifying entries in NDB_CONNECTSTRING and config file", \ "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "connect-string", 'c', "same as --ndb-connectstring",\
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
#else #else
...@@ -46,11 +49,14 @@ ...@@ -46,11 +49,14 @@
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
{ "version", 'V', "Output version information and exit.", 0, 0, 0, \ { "version", 'V', "Output version information and exit.", 0, 0, 0, \
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
{ "connect-string", 'c', \ { "ndb-connectstring", 'c', \
"Set connect string for connecting to ndb_mgmd. " \ "Set connect string for connecting to ndb_mgmd. " \
"<constr>=\"host=<hostname:port>[;nodeid=<id>]\". " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
"Overides specifying entries in NDB_CONNECTSTRING and config file", \ "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "connect-string", 'c', "same as --ndb-connectstring",\
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,\
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
#endif #endif
......
...@@ -107,7 +107,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -107,7 +107,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
bool bool
Configuration::init(int argc, char** argv) Configuration::init(int argc, char** argv)
{ {
const char *load_default_groups[]= { "ndbd",0 }; const char *load_default_groups[]= { "mysql_cluster","ndbd",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
......
...@@ -139,7 +139,7 @@ int main(int argc, char** argv){ ...@@ -139,7 +139,7 @@ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *_host = 0; const char *_host = 0;
int _port = 0; int _port = 0;
const char *load_default_groups[]= { "ndb_mgm",0 }; const char *load_default_groups[]= { "mysql_cluster","ndb_mgm",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
......
...@@ -103,10 +103,14 @@ static struct my_option my_long_options[] = ...@@ -103,10 +103,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "version", 'V', "Output version information and exit.", 0, 0, 0, { "version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "connect-string", 1023, { "ndb-connectstring", 1023,
"Set connect string for connecting to ndb_mgmd. " "Set connect string for connecting to ndb_mgmd. "
"<constr>=\"host=<hostname:port>[;nodeid=<id>]\". " "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". "
"Overides specifying entries in NDB_CONNECTSTRING and config file", "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg",
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "connect-string", 1023,
"same as --ndb-connectstring.",
(gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "config-file", 'f', "Specify cluster configuration file", { "config-file", 'f', "Specify cluster configuration file",
...@@ -186,7 +190,7 @@ int main(int argc, char** argv) ...@@ -186,7 +190,7 @@ int main(int argc, char** argv)
global_mgmt_server_check = 1; global_mgmt_server_check = 1;
glob.config_filename= "config.ini"; glob.config_filename= "config.ini";
const char *load_default_groups[]= { "ndb_mgmd",0 }; const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
......
...@@ -67,7 +67,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -67,7 +67,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -67,7 +67,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -67,7 +67,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -64,7 +64,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -64,7 +64,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -64,7 +64,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -64,7 +64,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -220,7 +220,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -220,7 +220,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char* _tabname; const char* _tabname;
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -143,7 +143,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -143,7 +143,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
bool bool
readArguments(int *pargc, char*** pargv) readArguments(int *pargc, char*** pargv)
{ {
const char *load_default_groups[]= { "ndb_tools","ndb_restore",0 }; const char *load_default_groups[]= { "mysql_cluster","ndb_restore",0 };
load_defaults("my",load_default_groups,pargc,pargv); load_defaults("my",load_default_groups,pargc,pargv);
if (handle_options(pargc, pargv, my_long_options, get_one_option)) if (handle_options(pargc, pargv, my_long_options, get_one_option))
{ {
......
...@@ -105,7 +105,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -105,7 +105,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
const char* _tabname; const char* _tabname;
int ho_error; int ho_error;
......
...@@ -83,7 +83,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -83,7 +83,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
......
...@@ -74,7 +74,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -74,7 +74,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "ndb_tools",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
const char* _hostName = NULL; const char* _hostName = NULL;
int ho_error; int ho_error;
......
...@@ -2364,11 +2364,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) ...@@ -2364,11 +2364,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return 0; return 0;
} }
int error; int error;
if ((error=regcomp(&preg,res->c_ptr(), if ((error= regcomp(&preg,res->c_ptr(),
(cmp_collation.collation->state & MY_CS_BINSORT) ? ((cmp_collation.collation->state & MY_CS_BINSORT) ||
REG_EXTENDED | REG_NOSUB : (cmp_collation.collation->state & MY_CS_CSSORT)) ?
REG_EXTENDED | REG_NOSUB | REG_ICASE, REG_EXTENDED | REG_NOSUB :
cmp_collation.collation))) REG_EXTENDED | REG_NOSUB | REG_ICASE,
cmp_collation.collation)))
{ {
(void) regerror(error,&preg,buff,sizeof(buff)); (void) regerror(error,&preg,buff,sizeof(buff));
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff); my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff);
...@@ -2416,10 +2417,11 @@ longlong Item_func_regex::val_int() ...@@ -2416,10 +2417,11 @@ longlong Item_func_regex::val_int()
regex_compiled=0; regex_compiled=0;
} }
if (regcomp(&preg,res2->c_ptr(), if (regcomp(&preg,res2->c_ptr(),
(cmp_collation.collation->state & MY_CS_BINSORT) ? ((cmp_collation.collation->state & MY_CS_BINSORT) ||
REG_EXTENDED | REG_NOSUB : (cmp_collation.collation->state & MY_CS_CSSORT)) ?
REG_EXTENDED | REG_NOSUB | REG_ICASE, REG_EXTENDED | REG_NOSUB :
cmp_collation.collation)) REG_EXTENDED | REG_NOSUB | REG_ICASE,
cmp_collation.collation))
{ {
null_value=1; null_value=1;
return 0; return 0;
......
...@@ -589,12 +589,12 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler = ...@@ -589,12 +589,12 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
CHARSET_INFO my_charset_latin2_czech_ci = CHARSET_INFO my_charset_latin2_czech_ci =
{ {
2,0,0, /* number */ 2,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
"latin2", /* cs name */ "latin2", /* cs name */
"latin2_czech_cs", /* name */ "latin2_czech_cs", /* name */
"", /* comment */ "", /* comment */
NULL, /* tailoring */ NULL, /* tailoring */
ctype_czech, ctype_czech,
to_lower_czech, to_lower_czech,
to_upper_czech, to_upper_czech,
......
...@@ -624,12 +624,12 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler = ...@@ -624,12 +624,12 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
CHARSET_INFO my_charset_cp1250_czech_ci = CHARSET_INFO my_charset_cp1250_czech_ci =
{ {
34,0,0, /* number */ 34,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
"cp1250", /* cs name */ "cp1250", /* cs name */
"cp1250_czech_cs", /* name */ "cp1250_czech_cs", /* name */
"", /* comment */ "", /* comment */
NULL, /* tailoring */ NULL, /* tailoring */
ctype_win1250ch, ctype_win1250ch,
to_lower_win1250ch, to_lower_win1250ch,
to_upper_win1250ch, to_upper_win1250ch,
......
...@@ -23,13 +23,14 @@ struct uca_item_st ...@@ -23,13 +23,14 @@ struct uca_item_st
#define MY_UCA_PSHIFT 8 #define MY_UCA_PSHIFT 8
#endif #endif
static char *pname[]= {"", "2", "3"};
int main(int ac, char **av) int main(int ac, char **av)
{ {
char str[256]; char str[256];
char *weights[64]; char *weights[64];
struct uca_item_st uca[64*1024]; struct uca_item_st uca[64*1024];
size_t code, page, w; size_t code, w;
int pagemaxlen[MY_UCA_NPAGES];
int pageloaded[MY_UCA_NPAGES]; int pageloaded[MY_UCA_NPAGES];
bzero(uca, sizeof(uca)); bzero(uca, sizeof(uca));
...@@ -155,14 +156,20 @@ int main(int ac, char **av) ...@@ -155,14 +156,20 @@ int main(int ac, char **av)
printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK); printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK);
printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT); printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT);
for (w=0; w<1; w++) for (w=0; w<3; w++)
{ {
size_t page;
int pagemaxlen[MY_UCA_NPAGES];
for (page=0; page < MY_UCA_NPAGES; page++) for (page=0; page < MY_UCA_NPAGES; page++)
{ {
size_t offs; size_t offs;
size_t maxnum= 0; size_t maxnum= 0;
size_t nchars= 0; size_t nchars= 0;
size_t mchars; size_t mchars;
size_t ndefs= 0;
pagemaxlen[page]= 0;
/* /*
Skip this page if no weights were loaded Skip this page if no weights were loaded
...@@ -183,15 +190,37 @@ int main(int ac, char **av) ...@@ -183,15 +190,37 @@ int main(int ac, char **av)
code= page*MY_UCA_NCHARS+offs; code= page*MY_UCA_NCHARS+offs;
/* Calculate only non-zero weights */ /* Calculate only non-zero weights */
num=0; for (num=0, i=0; i < uca[code].num; i++)
for (i=0; i < uca[code].num; i++)
if (uca[code].weight[w][i]) if (uca[code].weight[w][i])
num++; num++;
maxnum= maxnum < num ? num : maxnum; maxnum= maxnum < num ? num : maxnum;
/* Check if default weight */
if (w == 1 && num == 1)
{
/* 0020 0000 ... */
if (uca[code].weight[w][0] == 0x0020)
ndefs++;
}
else if (w == 2 && num == 1)
{
/* 0002 0000 ... */
if (uca[code].weight[w][0] == 0x0002)
ndefs++;
}
} }
maxnum++; maxnum++;
/*
If the page have only default weights
then no needs to dump it, skip.
*/
if (ndefs == MY_UCA_NCHARS)
{
printf("/* Don't dump w=%d pg=%3X: ndefs=%d */\n",w, page, ndefs);
continue;
}
switch (maxnum) switch (maxnum)
{ {
case 0: mchars= 8; break; case 0: mchars= 8; break;
...@@ -210,8 +239,8 @@ int main(int ac, char **av) ...@@ -210,8 +239,8 @@ int main(int ac, char **av)
*/ */
printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n", printf("uint16 page%03Xdata%s[]= { /* %04X (%d weights per char) */\n",
page, page*MY_UCA_NCHARS, maxnum); page, pname[w], page*MY_UCA_NCHARS, maxnum);
for (offs=0; offs < MY_UCA_NCHARS; offs++) for (offs=0; offs < MY_UCA_NCHARS; offs++)
{ {
...@@ -251,25 +280,28 @@ int main(int ac, char **av) ...@@ -251,25 +280,28 @@ int main(int ac, char **av)
} }
printf("};\n\n"); printf("};\n\n");
} }
}
printf("uchar ucal[%d]={\n",MY_UCA_NPAGES); printf("uchar ucal%s[%d]={\n", pname[w], MY_UCA_NPAGES);
for (page=0; page < MY_UCA_NPAGES; page++) for (page=0; page < MY_UCA_NPAGES; page++)
{ {
printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n"); printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
} }
printf("};\n"); printf("};\n");
printf("uint16 *ucaw[%d]={\n",MY_UCA_NPAGES); printf("uint16 *ucaw%s[%d]={\n", pname[w], MY_UCA_NPAGES);
for (page=0; page < MY_UCA_NPAGES; page++) for (page=0; page < MY_UCA_NPAGES; page++)
{ {
if (!pageloaded[page]) const char *comma= page < MY_UCA_NPAGES-1 ? "," : "";
printf("NULL %s%s",page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n"); const char *nline= (page+1) % 4 ? "" : "\n";
else if (!pagemaxlen[page])
printf("page%03Xdata%s%s",page,page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n"); printf("NULL %s%s", comma , nline);
else
printf("page%03Xdata%s%s%s", page, pname[w], comma, nline);
}
printf("};\n");
} }
printf("};\n");
printf("int main(void){ return 0;};\n"); printf("int main(void){ return 0;};\n");
return 0; return 0;
......
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