3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 use vars
qw(@ISA @EXPORT @EXPORT_OK $VERSION);
21 my($ret) = << "END_MPL";
22 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
23 /* This Source Code Form is subject to the terms of the Mozilla Public
24 * License
, v
. 2.0. If a copy of the MPL was
not distributed with this
25 * file
, You can obtain one at http
://mozilla
.org
/MPL/2.0/. */
31 ##--------------------------------------------------------------
33 my($char, $clstbl) = @_;
35 for($l =0; $l <= @
$clstbl; $l++) {
36 if(($clstbl->[$l][0] <= $char) && ($char <= $clstbl->[$l][1]))
38 return $clstbl->[$l][2];
41 print "WARNING- there are no class for $char\n";
43 ##--------------------------------------------------------------
45 my($name, $bits) = @_;
46 return GenPkg
($name, $bits, "_cls");
48 ##--------------------------------------------------------------
50 my($name, $bits) = @_;
51 return GenPkg
($name, $bits, "_st");
53 ##--------------------------------------------------------------
55 my($name, $bits, $tbl) = @_;
58 " eIdxSft" . $bits . "bits, \n" .
59 " eSftMsk" . $bits . "bits, \n" .
60 " eBitSft" . $bits . "bits, \n" .
61 " eUnitMsk" . $bits . "bits, \n" .
62 " " . $name . $tbl . " \n" .
66 ##--------------------------------------------------------------
68 my($name, $clstbl) = @_;
73 $ret .= "static const uint32_t " . $name . "_cls [ 256 / 8 ] = {\n";
74 for($i = 0; $i < 0x100; $i+= 8) {
76 for($j = $i; $j < $i + 8; $j++) {
77 $cls = &GetClass
($j,$clstbl);
78 $ret .= sprintf("%d", $cls) ;
88 $ret .= sprintf(" // %02x - %02x \n", $i, ($i+7));
93 ##--------------------------------------------------------------
95 my($name, $charset, $cls, $numcls, $st) = @_;
100 $ret .= Gen4BitsClass
($name, $cls);
102 $ret .= Gen4BitsState
($name, $st);
104 $ret .= "static nsVerifier ns" . $name . "Verifier = {\n";
105 $ret .= ' "' . $charset . '",' . "\n";
106 $ret .= GenClassPkg
($name, 4);
108 $ret .= " " . $numcls;
110 $ret .= GenStatePkg
($name, 4);
115 ##--------------------------------------------------------------
117 my($name, $sttbl) = @_;
118 my($lenafterpad) = (((@
$sttbl-1) >> 3) + 1) << 3;
122 $ret .= "static const uint32_t " . $name . "_st [ " . ($lenafterpad >> 3) . "] = {\n";
123 for($i = 0; $i < $lenafterpad ; $i+= 8) {
125 for($j = $i; $j < $i + 8; $j++) {
126 if(0 == $sttbl->[$j]) {
128 } else { if(1 == $sttbl->[$j]) {
130 } else { if(2 == $sttbl->[$j]) {
133 $ret .= sprintf(" %d", $sttbl->[$j]) ;
139 if( $i+8 >= $lenafterpad ) {
144 $ret .= sprintf("//%02x-%02x \n", $i, ($i+7));
149 ##--------------------------------------------------------------
152 my($ret) = << "END_NOTE";
154 * DO NOT EDIT THIS DOCUMENT MANUALLY
!!!
155 * THIS FILE IS AUTOMATICALLY GENERATED BY THE TOOLS UNDER
156 * mozilla
/intl/chardet
/tools/
157 * Please contact ftang\
@netscape.com
or mozilla
-i18n\
@mozilla.org
158 * if you have any question
. Thanks
164 ##--------------------------------------------------------------
166 my($ret) = << "END_HEADER";
167 #include "nsVerifier.h"
172 ##--------------------------------------------------------------
173 1; # this should be the last line