os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tools/uniClass.tcl
First public contribution.
2 # The next line is executed by /bin/sh, but not tcl \
3 exec tclsh "$0" ${1+"$@"}
8 # Generates the character ranges and singletons that are used in
9 # generic/regc_locale.c for translation of character classes.
10 # This file must be generated using a tclsh that contains the
11 # correct corresponding tclUniData.c file (generated by uniParse.tcl)
12 # in order for the class ranges to match.
15 proc emitRange {first last} {
16 global ranges numranges chars numchars
18 if {$first < ($last-1)} {
19 append ranges [format "{0x%04x, 0x%04x}, " \
21 if {[incr numranges] % 4 == 0} {
25 append chars [format "0x%04x, " $first]
27 if {$numchars % 9 == 0} {
30 if {$first != $last} {
31 append chars [format "0x%04x, " $last]
33 if {$numchars % 9 == 0} {
40 proc genTable {type} {
41 global first last ranges numranges chars numchars
50 for {set i 0} {$i <= 0xFFFF} {incr i} {
51 if {[string is $type [format %c $i]]} {
52 if {$i == ($last + 1)} {
56 emitRange $first $last
63 emitRange $first $last
65 set ranges [string trimright $ranges "\t\n ,"]
66 set chars [string trimright $chars "\t\n ,"]
68 puts "static crange ${type}RangeTable\[\] = {\n$ranges\n};\n"
69 puts "#define NUM_[string toupper $type]_RANGE (sizeof(${type}RangeTable)/sizeof(crange))\n"
71 puts "/* no contiguous ranges of $type characters */\n"
74 puts "static chr ${type}CharTable\[\] = {\n$chars\n};\n"
75 puts "#define NUM_[string toupper $type]_CHAR (sizeof(${type}CharTable)/sizeof(chr))\n"
77 puts "/* no singletons of $type characters */\n"
82 * Declarations of Unicode character ranges. This code
83 * is automatically generated by the tools/uniClass.tcl script
84 * and used in generic/regc_locale.c. Do not modify by hand.
89 alpha "alphabetic characters"
90 digit "decimal digit characters"
91 punct "punctuation characters"
92 space "white space characters"
93 lower "lowercase characters"
94 upper "uppercase characters"
95 graph "unicode print characters excluding space"
97 puts "/* Unicode: $desc */\n"
102 * End of auto-generated Unicode character ranges declarations.