summaryrefslogtreecommitdiffstats
path: root/usr.bin/colldef
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-10-23 15:00:18 +0000
committerache <ache@FreeBSD.org>1996-10-23 15:00:18 +0000
commit3b9a16cb5063881459285cd4d6d527b6c2aa0dad (patch)
treeeeb655bac4dbeedc9072f0a1f55805d812b5038e /usr.bin/colldef
parent0450c4ad17dcd54b6be8cab5f47d733e6e00a50d (diff)
downloadFreeBSD-src-3b9a16cb5063881459285cd4d6d527b6c2aa0dad.zip
FreeBSD-src-3b9a16cb5063881459285cd4d6d527b6c2aa0dad.tar.gz
Check for not defined / redefined chars now
Use backward compatible with ASCII collating tables
Diffstat (limited to 'usr.bin/colldef')
-rw-r--r--usr.bin/colldef/Makefile4
-rw-r--r--usr.bin/colldef/data/lt_LN.ISO_8859-1.src24
-rw-r--r--usr.bin/colldef/data/ru_SU.CP866.src39
-rw-r--r--usr.bin/colldef/data/ru_SU.KOI8-R.src39
-rw-r--r--usr.bin/colldef/parse.y55
5 files changed, 112 insertions, 49 deletions
diff --git a/usr.bin/colldef/Makefile b/usr.bin/colldef/Makefile
index 6ee8624..c138d1e 100644
--- a/usr.bin/colldef/Makefile
+++ b/usr.bin/colldef/Makefile
@@ -1,9 +1,9 @@
-# $Id: Makefile,v 1.6 1995/11/03 14:53:27 ache Exp $
+# $Id: Makefile,v 1.8 1996/06/02 17:18:18 phk Exp $
PROG = colldef
LFLAGS = -8 -i
YFLAGS = -d
-CFLAGS += -I. -I${.CURDIR}/../../lib/libc/locale
+CFLAGS += -I. -I${.CURDIR}/../../lib/libc/locale -DCOLLATE_DEBUG
SRCS = parse.c scan.c
LDADD = -ll
DPADD = ${LIBL}
diff --git a/usr.bin/colldef/data/lt_LN.ISO_8859-1.src b/usr.bin/colldef/data/lt_LN.ISO_8859-1.src
index 59581d1..93a2da0 100644
--- a/usr.bin/colldef/data/lt_LN.ISO_8859-1.src
+++ b/usr.bin/colldef/data/lt_LN.ISO_8859-1.src
@@ -1,17 +1,19 @@
-# latin1
+# latin1 (backward compatible with ASCII)
+#
+# $Id$
+#
charmap map.ISO_8859-1
order \
-# spaces
- <NS>;<SP>;\t;\v;\r;\n;\f;\
-# puncts
- _;<'m>;<-->;-;\,;\;;:;!;<!I>;?;<?I>;/;.;<''>;`;^;<':>;~;<.M>;\
- <',>;';\";<<<>;</>/>>;\(;\);[;];\{;\};<SE>;<PI>;<Co>;<Rg>;@;<Cu>;\
- <Ct>;$;<Pd>;<Ye>;*;\\;&;\#;%;+;<+->;<-:>;<*X>;\<;=;>;<NO>;|;<BB>;\
- <DG>;<My>;\
# controls
- <NU>;...;<BS>;<SO>;...;<US>;<DT>;<PA>;...;<AC>;\
+ <NU>;...;<US>;<PA>;...;<AC>;\
+#
+ <NS>;<SP>;!;<!I>;\";<<<>;</>/>>;<Nb>;\
+ <Cu>;<Ct>;<DO>;<Pd>;<Ye>;\
+ %;&;<',>;';\(;\);*;+;<+->;<-:>;<*X>;\,;<-->;-;.;/;\
# digits
(0,<14>,<12>,<34>);(1,<1S>);(2,<2S>);(3,<3S>);4;...;9;\
+#
+ :;\;;\<;=;>;?;<?I>;<SE>;<PI>;<Co>;<Rg>;<At>;\
# capital
(A,<A'>,<A!>,<A/>>,<AA>,<A:>,<A?>,<AE>);\
B;(C,<C,>);D;(E,<E'>,<E!>,<E/>>,<E:>);\
@@ -20,6 +22,8 @@ order \
P;...;T;(U,<U'>,<U!>,<U/>>,<U:>);\
V;W;X;(Y,<Y'>);Z;\
<D->;<TH>;\
+#
+ [;\\;];^;<':>;_;<'m>;<''>;`;\
# small
(a,<a'>,<a!>,<a/>>,<aa>,<a:>,<a?>,<ae>);\
b;(c,<c,>);d;(e,<e'>,<e!>,<e/>>,<e:>);\
@@ -28,5 +32,7 @@ order \
p;...;t;(u,<u'>,<u!>,<u/>>,<u:>);\
v;w;x;(y,<y'>,<y:>);z;\
<d->;<th>;<ss>;\
+#
+ \{;<NO>;|;<BB>;\};~;<.M>;<DG>;<My>;<DT>;\
# remains
<-a>;<-o>
diff --git a/usr.bin/colldef/data/ru_SU.CP866.src b/usr.bin/colldef/data/ru_SU.CP866.src
index a10a5f2..88ca377 100644
--- a/usr.bin/colldef/data/ru_SU.CP866.src
+++ b/usr.bin/colldef/data/ru_SU.CP866.src
@@ -1,32 +1,39 @@
-# IBM Code Page 866
+# CP866 (backward compatible with ASCII)
+#
+# $Id$
+#
charmap map.CP866
order \
-# spaces
- <NS>;<SP>;\t;\v;\r;\n;\f;\
-# puncts
- _;-;\,;\;;:;!;?;/;.;`;^;~;\
- ';<.M>;\";\(;\);[;];\{;\};<Co>;@;\
- $;*;\\;&;\#;%;+;<-:>;\<;<=<>;=;</>=>;>;|;\
- <DG>;<sb>;<RT>;<?2>;<Iu>;<Il>;\
- <hh>;<HH>;<vv>;<VV>;<dr>;<dR>;<Dr>;<DR>;\
- <dl>;<dL>;<Dl>;<LD>;<ur>;<uR>;<Ur>;<UR>;\
- <ul>;<uL>;<Ul>;<UL>;<vr>;<vR>;<Vr>;<VR>;\
- <vl>;<vL>;<Vl>;<VL>;<dh>;<dH>;<Dh>;<DH>;\
- <uh>;<uH>;<Uh>;<UH>;<vh>;<vH>;<Vh>;<VH>;\
- <TB>;<LB>;<FB>;<lB>;<RB>;<.S>;<:S>;<?S>;<fS>;\
# controls
- <NU>;...;<BS>;<SO>;...;<US>;<DT>;\
+ <NU>;...;<US>;\
+#
+ <NS>;<SP>;!;\";<Nb>;<DO>;\
+ %;&;';\(;\);*;+;<-:>;\,;-;.;/;\
# digits
0;1;(2,<2S>);3;...;9;\
+#
+ :;\;;\<;<=<>;=;</>=>;>;?;<Co>;<At>;\
# capital
A;...;Z;\
<A=>;<B=>;<V=>;<G=>;<D=>;<E=>;<IO>;<Z%>;<Z=>;\
<I=>;<J=>;<K=>;<L=>;<M=>;<N=>;<O=>;<P=>;<R=>;\
<S=>;<T=>;<U=>;<F=>;<H=>;<C=>;<C%>;<S%>;<Sc>;\
<=">;<Y=>;<%">;<JE>;<JU>;<JA>;\
+#
+ [;\\;];^;_;`;\
# small
a;...;z;\
<a=>;<b=>;<v=>;<g=>;<d=>;<e=>;<io>;<z%>;<z=>;\
<i=>;<j=>;<k=>;<l=>;<m=>;<n=>;<o=>;<p=>;<r=>;\
<s=>;<t=>;<u=>;<f=>;<h=>;<c=>;<c%>;<s%>;<sc>;\
- <='>;<y=>;<%'>;<je>;<ju>;<ja>
+ <='>;<y=>;<%'>;<je>;<ju>;<ja>;\
+#
+ \{;|;\};~;<.M>;<DG>;<DT>;\
+#
+ <sb>;<RT>;<?2>;<Iu>;<Il>;\
+ <hh>;<HH>;<vv>;<VV>;<dr>;<dR>;<Dr>;<DR>;\
+ <dl>;<dL>;<Dl>;<LD>;<ur>;<uR>;<Ur>;<UR>;\
+ <ul>;<uL>;<Ul>;<UL>;<vr>;<vR>;<Vr>;<VR>;\
+ <vl>;<vL>;<Vl>;<VL>;<dh>;<dH>;<Dh>;<DH>;\
+ <uh>;<uH>;<Uh>;<UH>;<vh>;<vH>;<Vh>;<VH>;\
+ <TB>;<LB>;<FB>;<lB>;<RB>;<.S>;<:S>;<?S>;<fS>
diff --git a/usr.bin/colldef/data/ru_SU.KOI8-R.src b/usr.bin/colldef/data/ru_SU.KOI8-R.src
index cd55942..f6b0a18 100644
--- a/usr.bin/colldef/data/ru_SU.KOI8-R.src
+++ b/usr.bin/colldef/data/ru_SU.KOI8-R.src
@@ -1,32 +1,39 @@
-# koi8-r
+# koi8-r (backward compatible with ASCII)
+#
+# $Id$
+#
charmap map.KOI8-R
order \
-# spaces
- <NS>;<SP>;\t;\v;\r;\n;\f;\
-# puncts
- _;-;\,;\;;:;!;?;/;.;`;^;~;\
- ';<.M>;\";\(;\);[;];\{;\};<Co>;@;\
- $;*;\\;&;\#;%;+;<-:>;\<;<=<>;=;</>=>;>;|;\
- <DG>;<sb>;<RT>;<?2>;<Iu>;<Il>;\
- <hh>;<HH>;<vv>;<VV>;<dr>;<dR>;<Dr>;<DR>;\
- <dl>;<dL>;<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>;<Vl>;<VL>;<dh>;<dH>;<Dh>;<DH>;\
+ <uh>;<uH>;<Uh>;<UH>;<vh>;<vH>;<Vh>;<VH>;\
+ <TB>;<LB>;<FB>;<lB>;<RB>;<.S>;<:S>;<?S>;<fS>
diff --git a/usr.bin/colldef/parse.y b/usr.bin/colldef/parse.y
index 5823689..db57d21 100644
--- a/usr.bin/colldef/parse.y
+++ b/usr.bin/colldef/parse.y
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: parse.y,v 1.1.1.1 1995/02/17 17:29:50 ache Exp $
+ * $Id: parse.y,v 1.3 1996/10/16 03:12:21 ache Exp $
*/
#include <err.h>
@@ -84,8 +84,14 @@ substitute : SUBSTITUTE STRING WITH STRING {
}
;
order : ORDER order_list {
- FILE *fp = fopen(out_file, "w");
+ FILE *fp;
+ int ch;
+
+ for (ch = 0; ch < UCHAR_MAX + 1; ch++)
+ if (!__collate_char_pri_table[ch].prim)
+ yyerror("Char 0x%02x not defined", ch);
+ fp = fopen(out_file, "w");
if(!fp)
err(EX_UNAVAILABLE, "can't open destination file %s",
out_file);
@@ -101,7 +107,7 @@ order : ORDER order_list {
fclose(fp);
#ifdef COLLATE_DEBUG
if (debug)
- __collate_print_tables();
+ collate_print_tables();
#endif
exit(EX_OK);
}
@@ -109,7 +115,11 @@ order : ORDER order_list {
order_list : item
| order_list ';' item
;
-item : CHAR { __collate_char_pri_table[$1].prim = prim_pri++; }
+item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x redefined", $1);
+ __collate_char_pri_table[$1].prim = prim_pri++;
+}
| CHAIN {
if (chain_index >= TABLE_SIZE - 1)
yyerror("__collate_chain_pri_table overflow");
@@ -122,8 +132,11 @@ item : CHAR { __collate_char_pri_table[$1].prim = prim_pri++; }
if ($3 <= $1)
yyerror("Illegal range 0x%02x -- 0x%02x", $1, $3);
- for (i = $1; i <= $3; i++)
+ for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x redefined", (u_char)i);
__collate_char_pri_table[(u_char)i].prim = prim_pri++;
+ }
}
| '{' prim_order_list '}' {
prim_pri++;
@@ -140,6 +153,8 @@ sec_order_list : sec_sub_item
| sec_order_list ',' sec_sub_item
;
prim_sub_item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x redefined", $1);
__collate_char_pri_table[$1].prim = prim_pri;
}
| CHAR RANGE CHAR {
@@ -149,8 +164,11 @@ prim_sub_item : CHAR {
yyerror("Illegal range 0x%02x -- 0x%02x",
$1, $3);
- for (i = $1; i <= $3; i++)
+ for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x redefined", (u_char)i);
__collate_char_pri_table[(u_char)i].prim = prim_pri;
+ }
}
| CHAIN {
if (chain_index >= TABLE_SIZE - 1)
@@ -160,6 +178,8 @@ prim_sub_item : CHAR {
}
;
sec_sub_item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x redefined", $1);
__collate_char_pri_table[$1].prim = prim_pri;
__collate_char_pri_table[$1].sec = sec_pri++;
}
@@ -171,6 +191,8 @@ sec_sub_item : CHAR {
$1, $3);
for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x redefined", (u_char)i);
__collate_char_pri_table[(u_char)i].prim = prim_pri;
__collate_char_pri_table[(u_char)i].sec = sec_pri++;
}
@@ -237,3 +259,24 @@ void yyerror(char *fmt, ...)
va_end(ap);
errx(EX_UNAVAILABLE, "%s near line %d", msg, line_no);
}
+
+#ifdef COLLATE_DEBUG
+collate_print_tables()
+{
+ 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");
+ for (p2 = __collate_chain_pri_table; p2->str[0]; p2++)
+ printf("\t\"%s\" : %d %d\n\n", p2->str, p2->prim, p2->sec);
+ 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
OpenPOWER on IntegriCloud