summaryrefslogtreecommitdiffstats
path: root/tools/uniParse.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/uniParse.tcl')
-rw-r--r--tools/uniParse.tcl45
1 files changed, 18 insertions, 27 deletions
diff --git a/tools/uniParse.tcl b/tools/uniParse.tcl
index 3acf19c..e33b3c7 100644
--- a/tools/uniParse.tcl
+++ b/tools/uniParse.tcl
@@ -6,7 +6,7 @@
# UnicodeData file from:
# ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
#
-# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
@@ -68,7 +68,7 @@ proc uni::getGroup {value} {
variable groups
set gIndex [lsearch -exact $groups $value]
- if {$gIndex < 0} {
+ if {$gIndex == -1} {
set gIndex [llength $groups]
lappend groups $value
}
@@ -81,7 +81,7 @@ proc uni::addPage {info} {
variable shift
set pIndex [lsearch -exact $pages $info]
- if {$pIndex < 0} {
+ if {$pIndex == -1} {
set pIndex [llength $pages]
lappend pages $info
}
@@ -114,8 +114,8 @@ proc uni::buildTables {data} {
set items [split $line \;]
scan [lindex $items 0] %x index
- if {$index > 0x3FFFF} then {
- # Ignore characters > plane 3
+ if {$index > 0x2ffff} then {
+ # Ignore non-BMP characters, as long as Tcl doesn't support them
continue
}
set index [format %d $index]
@@ -177,7 +177,7 @@ proc uni::main {} {
puts "shift = $shift, space = $size"
set f [open [file join [lindex $argv 1] tclUniData.c] w]
- fconfigure $f -translation lf -encoding utf-8
+ fconfigure $f -translation lf
puts $f "/*
* tclUniData.c --
*
@@ -185,7 +185,7 @@ proc uni::main {} {
* automatically generated by the tools/uniParse.tcl script. Do not
* modify this file by hand.
*
- * Copyright © 1998 Scriptics Corporation.
+ * Copyright (c) 1998 by Scriptics Corporation.
* All rights reserved.
*/
@@ -212,7 +212,7 @@ static const unsigned short pageMap\[\] = {"
puts $f $line
set lastpage [expr {[lindex $line end] >> $shift}]
puts stdout "lastpage: $lastpage"
- puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6"
+ puts $f "#if TCL_UTF_MAX > 3"
set line " ,"
}
append line [lindex $pMap $i]
@@ -242,7 +242,7 @@ static const unsigned char groupMap\[\] = {"
set lastj [expr {[llength $page] - 1}]
if {$i == ($lastpage + 1)} {
puts $f [string trimright $line " \t,"]
- puts $f "#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6"
+ puts $f "#if TCL_UTF_MAX > 3"
set line " ,"
}
for {set j 0} {$j <= $lastj} {incr j} {
@@ -272,7 +272,6 @@ static const unsigned char groupMap\[\] = {"
* 100 = subtract delta for title/upper
* 101 = sub delta for upper, sub 1 for title
* 110 = sub delta for upper, add delta for lower
- * 111 = subtract delta for upper
*
* Bits 8-31 Case delta: delta for case conversions. This should be the
* highest field so we can easily sign extend.
@@ -310,14 +309,10 @@ static const int groups\[\] = {"
}
}
} elseif {$toupper} {
+ # subtract delta for upper, add delta for lower
+ set case 6
set delta $toupper
- if {$tolower == $toupper} {
- # subtract delta for upper, add delta for lower
- set case 6
- } elseif {!$tolower} {
- # subtract delta for upper
- set case 7
- } else {
+ if {$tolower != $toupper} {
error "New case conversion type needed: $toupper $tolower $totitle"
}
} elseif {$tolower} {
@@ -342,10 +337,10 @@ static const int groups\[\] = {"
puts $f $line
puts -nonewline $f "};
-#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
-# define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1FFFFF) >= [format 0x%X $next])
+#if TCL_UTF_MAX > 3
+# define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1fffff) >= [format 0x%x $next])
#else
-# define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1F0000) != 0)
+# define UNICODE_OUT_OF_RANGE(ch) (((ch) & 0x1f0000) != 0)
#endif
/*
@@ -392,8 +387,8 @@ enum {
* to do sign extension on right shifts.
*/
-#define GetCaseType(info) (((info) & 0xE0) >> 5)
-#define GetCategory(ch) (GetUniCharInfo(ch) & 0x1F)
+#define GetCaseType(info) (((info) & 0xe0) >> 5)
+#define GetCategory(ch) (GetUniCharInfo(ch) & 0x1f)
#define GetDelta(info) ((info) >> 8)
/*
@@ -401,11 +396,7 @@ enum {
* Unicode character tables.
*/
-#if TCL_UTF_MAX > 3 || TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
-# define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0x1FFFFF) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
-#else
-# define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0xFFFF) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
-#endif
+#define GetUniCharInfo(ch) (groups\[groupMap\[pageMap\[((ch) & 0xffff) >> OFFSET_BITS\] | ((ch) & ((1 << OFFSET_BITS)-1))\]\])
"
close $f