4
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
16
my($ret) = << "END_NPL";
17
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
18
/* ***** BEGIN LICENSE BLOCK *****
19
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
21
* The contents of this file are subject to the Netscape Public License
22
* Version 1.1 (the "License"); you may not use this file except in
23
* compliance with the License. You may obtain a copy of the License at
24
* http://www.mozilla.org/NPL/
26
* Software distributed under the License is distributed on an "AS IS" basis,
27
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
28
* for the specific language governing rights and limitations under the
31
* The Original Code is mozilla.org code.
33
* The Initial Developer of the Original Code is
34
* Netscape Communications Corporation.
35
* Portions created by the Initial Developer are Copyright (C) 1998
36
* the Initial Developer. All Rights Reserved.
41
* Alternatively, the contents of this file may be used under the terms of
42
* either the GNU General Public License Version 2 or later (the "GPL"), or
43
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
44
* in which case the provisions of the GPL or the LGPL are applicable instead
45
* of those above. If you wish to allow use of your version of this file only
46
* under the terms of either the GPL or the LGPL, and not to allow others to
47
* use your version of this file under the terms of the NPL, indicate your
48
* decision by deleting the provisions above and replace them with the notice
49
* and other provisions required by the GPL or the LGPL. If you do not delete
50
* the provisions above, a recipient may use your version of this file under
51
* the terms of any one of the NPL, the GPL or the LGPL.
53
* ***** END LICENSE BLOCK ***** */
59
##--------------------------------------------------------------
61
my($char, $clstbl) = @_;
63
for($l =0; $l <= @$clstbl; $l++) {
64
if(($clstbl->[$l][0] <= $char) && ($char <= $clstbl->[$l][1]))
66
return $clstbl->[$l][2];
69
print "WARNING- there are no class for $char\n";
71
##--------------------------------------------------------------
73
my($name, $bits) = @_;
74
return GenPkg($name, $bits, "_cls");
76
##--------------------------------------------------------------
78
my($name, $bits) = @_;
79
return GenPkg($name, $bits, "_st");
81
##--------------------------------------------------------------
83
my($name, $bits, $tbl) = @_;
86
" eIdxSft" . $bits . "bits, \n" .
87
" eSftMsk" . $bits . "bits, \n" .
88
" eBitSft" . $bits . "bits, \n" .
89
" eUnitMsk" . $bits . "bits, \n" .
90
" " . $name . $tbl . " \n" .
94
##--------------------------------------------------------------
96
my($name, $clstbl) = @_;
101
$ret .= "static const PRUint32 " . $name . "_cls [ 256 / 8 ] = {\n";
102
for($i = 0; $i < 0x100; $i+= 8) {
104
for($j = $i; $j < $i + 8; $j++) {
105
$cls = &GetClass($j,$clstbl);
106
$ret .= sprintf("%d", $cls) ;
116
$ret .= sprintf(" // %02x - %02x \n", $i, ($i+7));
121
##--------------------------------------------------------------
123
my($name, $charset, $cls, $numcls, $st) = @_;
128
$ret .= Gen4BitsClass($name, $cls);
130
$ret .= Gen4BitsState($name, $st);
132
$ret .= "static nsVerifier ns" . $name . "Verifier = {\n";
133
$ret .= ' "' . $charset . '",' . "\n";
134
$ret .= GenClassPkg($name, 4);
136
$ret .= " " . $numcls;
138
$ret .= GenStatePkg($name, 4);
143
##--------------------------------------------------------------
145
my($name, $sttbl) = @_;
146
my($lenafterpad) = (((@$sttbl-1) >> 3) + 1) << 3;
150
$ret .= "static const PRUint32 " . $name . "_st [ " . ($lenafterpad >> 3) . "] = {\n";
151
for($i = 0; $i < $lenafterpad ; $i+= 8) {
153
for($j = $i; $j < $i + 8; $j++) {
154
if(0 == $sttbl->[$j]) {
156
} else { if(1 == $sttbl->[$j]) {
158
} else { if(2 == $sttbl->[$j]) {
161
$ret .= sprintf(" %d", $sttbl->[$j]) ;
167
if( $i+8 >= $lenafterpad ) {
172
$ret .= sprintf("//%02x-%02x \n", $i, ($i+7));
177
##--------------------------------------------------------------
180
my($ret) = << "END_NOTE";
182
* DO NOT EDIT THIS DOCUMENT MANUALLY !!!
183
* THIS FILE IS AUTOMATICALLY GENERATED BY THE TOOLS UNDER
184
* mozilla/intl/chardet/tools/
185
* Please contact ftang\@netscape.com or mozilla-i18n\@mozilla.org
186
* if you have any question. Thanks
192
##--------------------------------------------------------------
194
my($ret) = << "END_HEADER";
195
#include "nsVerifier.h"
200
##--------------------------------------------------------------
201
1; # this should be the last line