summaryrefslogtreecommitdiffstats
path: root/tools/uniClass.tcl
diff options
context:
space:
mode:
authorstanton <stanton>1999-06-24 03:27:56 (GMT)
committerstanton <stanton>1999-06-24 03:27:56 (GMT)
commit79d36b8166d773a6f2740a59820c30748c102226 (patch)
tree255e71bdabf736a3697e79ffdd09a91136ea7b33 /tools/uniClass.tcl
parent3497f9531e33550bfb1cec92c30b535497e86289 (diff)
downloadtcl-79d36b8166d773a6f2740a59820c30748c102226.zip
tcl-79d36b8166d773a6f2740a59820c30748c102226.tar.gz
tcl-79d36b8166d773a6f2740a59820c30748c102226.tar.bz2
* unix/Makefile.in: Changed install-doc to install-man.
* tools/uniParse.tcl: * tools/uniClass.tcl: * tools/README: * tests/string.test: * generic/regc_locale.c: * generic/tclUniData.c: * generic/tclUtf.c: * doc/string.n: Updated Unicode character tables to reflect latest Unicode 2.1 data. Also rationalized "regexp" and "string is" definitions of character classes.
Diffstat (limited to 'tools/uniClass.tcl')
-rw-r--r--tools/uniClass.tcl61
1 files changed, 61 insertions, 0 deletions
diff --git a/tools/uniClass.tcl b/tools/uniClass.tcl
new file mode 100644
index 0000000..2820ba4
--- /dev/null
+++ b/tools/uniClass.tcl
@@ -0,0 +1,61 @@
+proc emitRange {first last} {
+ global ranges numranges chars numchars
+
+ if {$first < ($last-1)} {
+ append ranges [format "{0x%04x, 0x%04x}, " \
+ $first $last]
+ if {[incr numranges] % 4 == 0} {
+ append ranges "\n "
+ }
+ } else {
+ append chars [format "0x%04x, " $first]
+ incr numchars
+ if {$numchars % 9 == 0} {
+ append chars "\n "
+ }
+ if {$first != $last} {
+ append chars [format "0x%04x, " $last]
+ incr numchars
+ if {$numchars % 9 == 0} {
+ append chars "\n "
+ }
+ }
+ }
+}
+
+proc genTable {type} {
+ global first last ranges numranges chars numchars
+ set first -2
+ set last -2
+
+ set ranges " "
+ set numranges 0
+ set chars " "
+ set numchars 0
+
+ for {set i 0} {$i < 0x10000} {incr i} {
+ if {[string is $type [format %c $i]]} {
+ if {$i == ($last + 1)} {
+ set last $i
+ } else {
+ if {$first > 0} {
+ emitRange $first $last
+ }
+ set first $i
+ set last $i
+ }
+ }
+ }
+ emitRange $first $last
+
+ puts "static crange ${type}RangeTable\[\] = {\n$ranges\n};\n"
+ puts "#define NUM_[string toupper $type]_RANGE (sizeof(${type}RangeTable)/sizeof(crange))\n"
+ puts "static chr ${type}CharTable\[\] = {\n$chars\n};\n"
+ puts "#define NUM_[string toupper $type]_CHAR (sizeof(${type}CharTable)/sizeof(chr))\n"
+}
+
+
+foreach type {alpha digit punct space lower upper graph } {
+ genTable $type
+}
+