1995-02-17 17:29:50 +00:00
|
|
|
%{
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
|
|
|
|
* at Electronni Visti IA, Kiev, Ukraine.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2001-12-02 23:40:46 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2002-08-31 01:48:56 +00:00
|
|
|
#include <arpa/inet.h>
|
1995-02-17 17:29:50 +00:00
|
|
|
#include <err.h>
|
1996-10-15 22:05:18 +00:00
|
|
|
#include <stdarg.h>
|
1995-02-17 17:29:50 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1997-03-11 14:40:40 +00:00
|
|
|
#include <unistd.h>
|
1995-02-17 17:29:50 +00:00
|
|
|
#include <sysexits.h>
|
|
|
|
#include "collate.h"
|
2001-11-27 23:11:05 +00:00
|
|
|
#include "common.h"
|
1995-02-17 17:29:50 +00:00
|
|
|
|
|
|
|
extern FILE *yyin;
|
2001-12-02 23:40:46 +00:00
|
|
|
void yyerror(const char *fmt, ...) __printflike(1, 2);
|
1998-12-06 22:58:23 +00:00
|
|
|
int yyparse(void);
|
|
|
|
int yylex(void);
|
2001-12-02 23:40:46 +00:00
|
|
|
static void usage(void);
|
|
|
|
static void collate_print_tables(void);
|
1995-02-17 17:29:50 +00:00
|
|
|
|
1996-10-15 22:05:18 +00:00
|
|
|
char map_name[FILENAME_MAX] = ".";
|
2002-08-23 04:18:26 +00:00
|
|
|
char curr_chain[STR_LEN];
|
1996-10-15 22:05:18 +00:00
|
|
|
|
|
|
|
char __collate_version[STR_LEN];
|
2001-11-27 23:11:05 +00:00
|
|
|
u_char charmap_table[UCHAR_MAX + 1][CHARMAP_SYMBOL_LEN];
|
2002-08-14 11:51:26 +00:00
|
|
|
|
|
|
|
#undef __collate_substitute_table
|
1995-02-17 17:29:50 +00:00
|
|
|
u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
|
2002-08-14 11:51:26 +00:00
|
|
|
#undef __collate_char_pri_table
|
1995-02-17 17:29:50 +00:00
|
|
|
struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
|
2002-08-30 20:34:36 +00:00
|
|
|
struct __collate_st_chain_pri *__collate_chain_pri_table;
|
2002-08-14 11:51:26 +00:00
|
|
|
|
1996-10-15 22:05:18 +00:00
|
|
|
int chain_index;
|
1995-02-17 17:29:50 +00:00
|
|
|
int prim_pri = 1, sec_pri = 1;
|
|
|
|
#ifdef COLLATE_DEBUG
|
|
|
|
int debug;
|
|
|
|
#endif
|
|
|
|
|
2001-12-02 23:40:46 +00:00
|
|
|
const char *out_file = "LC_COLLATE";
|
1995-02-17 17:29:50 +00:00
|
|
|
%}
|
|
|
|
%union {
|
|
|
|
u_char ch;
|
2001-11-28 09:50:24 +00:00
|
|
|
u_char str[BUFSIZE];
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
%token SUBSTITUTE WITH ORDER RANGE
|
|
|
|
%token <str> STRING
|
1996-10-15 22:05:18 +00:00
|
|
|
%token <str> DEFN
|
1995-02-17 17:29:50 +00:00
|
|
|
%token <ch> CHAR
|
|
|
|
%%
|
|
|
|
collate : statment_list
|
|
|
|
;
|
|
|
|
statment_list : statment
|
|
|
|
| statment_list '\n' statment
|
|
|
|
;
|
|
|
|
statment :
|
|
|
|
| charmap
|
|
|
|
| substitute
|
|
|
|
| order
|
|
|
|
;
|
1996-10-15 22:05:18 +00:00
|
|
|
charmap : DEFN CHAR {
|
2001-11-27 23:39:14 +00:00
|
|
|
if (strlen($1) + 1 > CHARMAP_SYMBOL_LEN)
|
|
|
|
yyerror("Charmap symbol name '%s' is too long", $1);
|
1996-10-15 22:05:18 +00:00
|
|
|
strcpy(charmap_table[$2], $1);
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
;
|
1999-02-13 14:14:47 +00:00
|
|
|
substitute : SUBSTITUTE CHAR WITH STRING {
|
|
|
|
if ($2 == '\0')
|
1999-02-12 20:56:49 +00:00
|
|
|
yyerror("NUL character can't be substituted");
|
1999-02-13 14:14:47 +00:00
|
|
|
if (strchr($4, $2) != NULL)
|
|
|
|
yyerror("Char 0x%02x substitution is recursive", $2);
|
2001-11-28 09:50:24 +00:00
|
|
|
if (strlen($4) + 1 > STR_LEN)
|
|
|
|
yyerror("Char 0x%02x substitution is too long", $2);
|
1999-02-13 14:14:47 +00:00
|
|
|
strcpy(__collate_substitute_table[$2], $4);
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
;
|
|
|
|
order : ORDER order_list {
|
1996-10-23 15:00:18 +00:00
|
|
|
FILE *fp;
|
1999-02-12 20:56:49 +00:00
|
|
|
int ch, substed, ordered;
|
2002-08-31 01:48:56 +00:00
|
|
|
uint32_t u32;
|
1996-10-23 15:00:18 +00:00
|
|
|
|
1999-02-12 20:56:49 +00:00
|
|
|
for (ch = 0; ch < UCHAR_MAX + 1; ch++) {
|
|
|
|
substed = (__collate_substitute_table[ch][0] != ch);
|
|
|
|
ordered = !!__collate_char_pri_table[ch].prim;
|
|
|
|
if (!ordered && !substed)
|
1999-02-12 20:39:06 +00:00
|
|
|
yyerror("Char 0x%02x not found", ch);
|
1999-02-12 20:56:49 +00:00
|
|
|
if (substed && ordered)
|
|
|
|
yyerror("Char 0x%02x can't be ordered since substituted", ch);
|
|
|
|
}
|
1995-02-17 17:29:50 +00:00
|
|
|
|
2002-08-31 01:48:56 +00:00
|
|
|
if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
|
|
|
|
sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
|
|
|
|
yyerror("can't grow chain table");
|
|
|
|
(void)memset(__collate_chain_pri_table[chain_index].str, 0,
|
|
|
|
sizeof(__collate_chain_pri_table[0].str));
|
|
|
|
__collate_chain_pri_table[chain_index].prim = 0;
|
|
|
|
__collate_chain_pri_table[chain_index].sec = 0;
|
|
|
|
chain_index++;
|
|
|
|
|
2002-08-30 20:34:36 +00:00
|
|
|
if ((fp = fopen(out_file, "w")) == NULL)
|
1996-10-15 22:05:18 +00:00
|
|
|
err(EX_UNAVAILABLE, "can't open destination file %s",
|
1995-02-17 17:29:50 +00:00
|
|
|
out_file);
|
|
|
|
|
2002-08-31 01:48:56 +00:00
|
|
|
strcpy(__collate_version, COLLATE_VERSION1_1);
|
2002-08-30 20:34:36 +00:00
|
|
|
if (fwrite(__collate_version, sizeof(__collate_version), 1, fp) != 1)
|
|
|
|
err(EX_IOERR,
|
|
|
|
"IO error writting collate version to destination file %s",
|
|
|
|
out_file);
|
2002-08-31 01:48:56 +00:00
|
|
|
u32 = htonl(chain_index);
|
|
|
|
if (fwrite(&u32, sizeof(u32), 1, fp) != 1)
|
|
|
|
err(EX_IOERR,
|
|
|
|
"IO error writting chains number to destination file %s",
|
|
|
|
out_file);
|
2002-08-30 20:34:36 +00:00
|
|
|
if (fwrite(__collate_substitute_table,
|
|
|
|
sizeof(__collate_substitute_table), 1, fp) != 1)
|
|
|
|
err(EX_IOERR,
|
|
|
|
"IO error writting substitute table to destination file %s",
|
|
|
|
out_file);
|
|
|
|
if (fwrite(__collate_char_pri_table,
|
|
|
|
sizeof(__collate_char_pri_table), 1, fp) != 1)
|
|
|
|
err(EX_IOERR,
|
|
|
|
"IO error writting char table to destination file %s",
|
|
|
|
out_file);
|
|
|
|
if (fwrite(__collate_chain_pri_table,
|
2002-08-31 01:48:56 +00:00
|
|
|
sizeof(*__collate_chain_pri_table), chain_index, fp) !=
|
2002-09-04 21:22:49 +00:00
|
|
|
(size_t)chain_index)
|
2002-08-30 20:34:36 +00:00
|
|
|
err(EX_IOERR,
|
|
|
|
"IO error writting chain table to destination file %s",
|
|
|
|
out_file);
|
|
|
|
if (fclose(fp) != 0)
|
|
|
|
err(EX_IOERR, "IO error closing destination file %s",
|
1996-10-15 22:05:18 +00:00
|
|
|
out_file);
|
1995-02-17 17:29:50 +00:00
|
|
|
#ifdef COLLATE_DEBUG
|
|
|
|
if (debug)
|
1996-10-23 15:00:18 +00:00
|
|
|
collate_print_tables();
|
1995-02-17 17:29:50 +00:00
|
|
|
#endif
|
|
|
|
exit(EX_OK);
|
|
|
|
}
|
|
|
|
;
|
|
|
|
order_list : item
|
|
|
|
| order_list ';' item
|
|
|
|
;
|
2002-08-23 04:18:26 +00:00
|
|
|
chain : CHAR CHAR {
|
|
|
|
curr_chain[0] = $1;
|
|
|
|
curr_chain[1] = $2;
|
|
|
|
if (curr_chain[0] == '\0' || curr_chain[1] == '\0')
|
|
|
|
yyerror("\\0 can't be chained");
|
|
|
|
curr_chain[2] = '\0';
|
|
|
|
}
|
|
|
|
| chain CHAR {
|
|
|
|
static char tb[2];
|
|
|
|
|
|
|
|
tb[0] = $2;
|
|
|
|
if (tb[0] == '\0')
|
|
|
|
yyerror("\\0 can't be chained");
|
|
|
|
if (strlen(curr_chain) + 2 > STR_LEN)
|
|
|
|
yyerror("Chain '%s' grows too long", curr_chain);
|
|
|
|
(void)strcat(curr_chain, tb);
|
|
|
|
}
|
|
|
|
;
|
1996-10-23 15:00:18 +00:00
|
|
|
item : CHAR {
|
|
|
|
if (__collate_char_pri_table[$1].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", $1);
|
1996-10-23 15:00:18 +00:00
|
|
|
__collate_char_pri_table[$1].prim = prim_pri++;
|
|
|
|
}
|
2002-08-23 04:18:26 +00:00
|
|
|
| chain {
|
2002-08-31 01:48:56 +00:00
|
|
|
if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
|
|
|
|
sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
|
|
|
|
yyerror("can't grow chain table");
|
|
|
|
(void)memset(__collate_chain_pri_table[chain_index].str, 0,
|
|
|
|
sizeof(__collate_chain_pri_table[0].str));
|
2002-08-23 04:18:26 +00:00
|
|
|
(void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
|
2002-08-31 01:48:56 +00:00
|
|
|
__collate_chain_pri_table[chain_index].prim = prim_pri++;
|
|
|
|
__collate_chain_pri_table[chain_index].sec = 0;
|
|
|
|
chain_index++;
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
| CHAR RANGE CHAR {
|
|
|
|
u_int i;
|
|
|
|
|
|
|
|
if ($3 <= $1)
|
1996-10-15 22:05:18 +00:00
|
|
|
yyerror("Illegal range 0x%02x -- 0x%02x", $1, $3);
|
1995-02-17 17:29:50 +00:00
|
|
|
|
1996-10-23 15:00:18 +00:00
|
|
|
for (i = $1; i <= $3; i++) {
|
|
|
|
if (__collate_char_pri_table[(u_char)i].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", (u_char)i);
|
1996-10-15 22:05:18 +00:00
|
|
|
__collate_char_pri_table[(u_char)i].prim = prim_pri++;
|
1996-10-23 15:00:18 +00:00
|
|
|
}
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
| '{' prim_order_list '}' {
|
|
|
|
prim_pri++;
|
|
|
|
}
|
|
|
|
| '(' sec_order_list ')' {
|
|
|
|
prim_pri++;
|
|
|
|
sec_pri = 1;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
prim_order_list : prim_sub_item
|
|
|
|
| prim_order_list ',' prim_sub_item
|
|
|
|
;
|
|
|
|
sec_order_list : sec_sub_item
|
|
|
|
| sec_order_list ',' sec_sub_item
|
|
|
|
;
|
|
|
|
prim_sub_item : CHAR {
|
1996-10-23 15:00:18 +00:00
|
|
|
if (__collate_char_pri_table[$1].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", $1);
|
1995-02-17 17:29:50 +00:00
|
|
|
__collate_char_pri_table[$1].prim = prim_pri;
|
|
|
|
}
|
|
|
|
| CHAR RANGE CHAR {
|
|
|
|
u_int i;
|
|
|
|
|
|
|
|
if ($3 <= $1)
|
1996-10-15 22:05:18 +00:00
|
|
|
yyerror("Illegal range 0x%02x -- 0x%02x",
|
|
|
|
$1, $3);
|
1995-02-17 17:29:50 +00:00
|
|
|
|
1996-10-23 15:00:18 +00:00
|
|
|
for (i = $1; i <= $3; i++) {
|
|
|
|
if (__collate_char_pri_table[(u_char)i].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", (u_char)i);
|
1996-10-15 22:05:18 +00:00
|
|
|
__collate_char_pri_table[(u_char)i].prim = prim_pri;
|
1996-10-23 15:00:18 +00:00
|
|
|
}
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
2002-08-23 04:18:26 +00:00
|
|
|
| chain {
|
2002-08-31 01:48:56 +00:00
|
|
|
if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
|
|
|
|
sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
|
|
|
|
yyerror("can't grow chain table");
|
|
|
|
(void)memset(__collate_chain_pri_table[chain_index].str, 0,
|
|
|
|
sizeof(__collate_chain_pri_table[0].str));
|
2002-08-23 04:18:26 +00:00
|
|
|
(void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
|
2002-08-31 01:48:56 +00:00
|
|
|
__collate_chain_pri_table[chain_index].prim = prim_pri;
|
|
|
|
__collate_chain_pri_table[chain_index].sec = 0;
|
|
|
|
chain_index++;
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
;
|
|
|
|
sec_sub_item : CHAR {
|
1996-10-23 15:00:18 +00:00
|
|
|
if (__collate_char_pri_table[$1].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", $1);
|
1995-02-17 17:29:50 +00:00
|
|
|
__collate_char_pri_table[$1].prim = prim_pri;
|
|
|
|
__collate_char_pri_table[$1].sec = sec_pri++;
|
|
|
|
}
|
|
|
|
| CHAR RANGE CHAR {
|
|
|
|
u_int i;
|
|
|
|
|
|
|
|
if ($3 <= $1)
|
1996-10-15 22:05:18 +00:00
|
|
|
yyerror("Illegal range 0x%02x -- 0x%02x",
|
|
|
|
$1, $3);
|
1995-02-17 17:29:50 +00:00
|
|
|
|
|
|
|
for (i = $1; i <= $3; i++) {
|
1996-10-23 15:00:18 +00:00
|
|
|
if (__collate_char_pri_table[(u_char)i].prim)
|
1996-10-25 00:13:14 +00:00
|
|
|
yyerror("Char 0x%02x duplicated", (u_char)i);
|
1995-02-17 17:29:50 +00:00
|
|
|
__collate_char_pri_table[(u_char)i].prim = prim_pri;
|
|
|
|
__collate_char_pri_table[(u_char)i].sec = sec_pri++;
|
|
|
|
}
|
|
|
|
}
|
2002-08-23 04:18:26 +00:00
|
|
|
| chain {
|
2002-08-31 01:48:56 +00:00
|
|
|
if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
|
|
|
|
sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
|
|
|
|
yyerror("can't grow chain table");
|
|
|
|
(void)memset(__collate_chain_pri_table[chain_index].str, 0,
|
|
|
|
sizeof(__collate_chain_pri_table[0].str));
|
2002-08-23 04:18:26 +00:00
|
|
|
(void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
|
1995-02-17 17:29:50 +00:00
|
|
|
__collate_chain_pri_table[chain_index].prim = prim_pri;
|
2002-08-31 01:48:56 +00:00
|
|
|
__collate_chain_pri_table[chain_index].sec = sec_pri++;
|
|
|
|
chain_index++;
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
;
|
|
|
|
%%
|
1998-12-06 22:58:23 +00:00
|
|
|
int
|
2002-07-28 15:20:10 +00:00
|
|
|
main(int ac, char **av)
|
1995-02-17 17:29:50 +00:00
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
|
|
|
|
#ifdef COLLATE_DEBUG
|
2002-10-16 12:56:22 +00:00
|
|
|
while((ch = getopt(ac, av, ":do:I:")) != -1) {
|
1995-02-17 17:29:50 +00:00
|
|
|
#else
|
2002-10-16 12:56:22 +00:00
|
|
|
while((ch = getopt(ac, av, ":o:I:")) != -1) {
|
1995-02-17 17:29:50 +00:00
|
|
|
#endif
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
#ifdef COLLATE_DEBUG
|
|
|
|
case 'd':
|
|
|
|
debug++;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case 'o':
|
|
|
|
out_file = optarg;
|
|
|
|
break;
|
|
|
|
|
1996-10-15 22:05:18 +00:00
|
|
|
case 'I':
|
2001-10-16 09:21:09 +00:00
|
|
|
strlcpy(map_name, optarg, sizeof(map_name));
|
1996-10-15 22:05:18 +00:00
|
|
|
break;
|
|
|
|
|
1995-02-17 17:29:50 +00:00
|
|
|
default:
|
1997-06-26 11:25:17 +00:00
|
|
|
usage();
|
1995-02-17 17:29:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ac -= optind;
|
|
|
|
av += optind;
|
2002-08-30 20:34:36 +00:00
|
|
|
if (ac > 0) {
|
|
|
|
if ((yyin = fopen(*av, "r")) == NULL)
|
1995-02-17 17:29:50 +00:00
|
|
|
err(EX_UNAVAILABLE, "can't open source file %s", *av);
|
|
|
|
}
|
2002-08-30 20:34:36 +00:00
|
|
|
for (ch = 0; ch <= UCHAR_MAX; ch++)
|
1995-02-17 17:29:50 +00:00
|
|
|
__collate_substitute_table[ch][0] = ch;
|
|
|
|
yyparse();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-06-26 11:25:17 +00:00
|
|
|
static void
|
2002-07-28 15:20:10 +00:00
|
|
|
usage(void)
|
1997-06-26 11:25:17 +00:00
|
|
|
{
|
|
|
|
fprintf(stderr, "usage: colldef [-o out_file] [-I map_dir] [filename]\n");
|
1997-06-30 11:24:18 +00:00
|
|
|
exit(EX_USAGE);
|
1997-06-26 11:25:17 +00:00
|
|
|
}
|
|
|
|
|
2001-12-02 23:40:46 +00:00
|
|
|
void
|
|
|
|
yyerror(const char *fmt, ...)
|
1995-02-17 17:29:50 +00:00
|
|
|
{
|
1996-10-15 22:05:18 +00:00
|
|
|
va_list ap;
|
|
|
|
char msg[128];
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
2000-11-26 08:14:55 +00:00
|
|
|
vsnprintf(msg, sizeof(msg), fmt, ap);
|
1996-10-15 22:05:18 +00:00
|
|
|
va_end(ap);
|
1995-02-17 17:29:50 +00:00
|
|
|
errx(EX_UNAVAILABLE, "%s near line %d", msg, line_no);
|
|
|
|
}
|
1996-10-23 15:00:18 +00:00
|
|
|
|
|
|
|
#ifdef COLLATE_DEBUG
|
2001-12-02 23:40:46 +00:00
|
|
|
static void
|
|
|
|
collate_print_tables(void)
|
1996-10-23 15:00:18 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct __collate_st_chain_pri *p2;
|
|
|
|
|
|
|
|
printf("Substitute table:\n");
|
|
|
|
for (i = 0; i < UCHAR_MAX + 1; i++)
|
|
|
|
if (i != *__collate_substitute_table[i])
|
|
|
|
printf("\t'%c' --> \"%s\"\n", i,
|
|
|
|
__collate_substitute_table[i]);
|
|
|
|
printf("Chain priority table:\n");
|
2002-08-31 01:48:56 +00:00
|
|
|
for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++)
|
2002-08-30 20:34:36 +00:00
|
|
|
printf("\t\"%s\" : %d %d\n", p2->str, p2->prim, p2->sec);
|
1996-10-23 15:00:18 +00:00
|
|
|
printf("Char priority table:\n");
|
|
|
|
for (i = 0; i < UCHAR_MAX + 1; i++)
|
|
|
|
printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
|
|
|
|
__collate_char_pri_table[i].sec);
|
|
|
|
}
|
|
|
|
#endif
|