make update
[openssl.git] / crypto / conf / keysets.pl
1 #!/usr/local/bin/perl
2
3 $NUMBER=0x01;
4 $UPPER=0x02;
5 $LOWER=0x04;
6 $UNDER=0x100;
7 $PUNCTUATION=0x200;
8 $WS=0x10;
9 $ESC=0x20;
10 $QUOTE=0x40;
11 $DQUOTE=0x400;
12 $COMMENT=0x80;
13 $FCOMMENT=0x800;
14 $EOF=0x08;
15 $HIGHBIT=0x1000;
16
17 foreach (0 .. 255)
18         {
19         $v=0;
20         $c=sprintf("%c",$_);
21         $v|=$NUMBER     if ($c =~ /[0-9]/);
22         $v|=$UPPER      if ($c =~ /[A-Z]/);
23         $v|=$LOWER      if ($c =~ /[a-z]/);
24         $v|=$UNDER      if ($c =~ /_/);
25         $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
26         $v|=$WS         if ($c =~ /[ \t\r\n]/);
27         $v|=$ESC        if ($c =~ /\\/);
28         $v|=$QUOTE      if ($c =~ /['`"]/); # for emacs: "`'}/)
29         $v|=$COMMENT    if ($c =~ /\#/);
30         $v|=$EOF        if ($c =~ /\0/);
31         $v|=$HIGHBIT    if ($c =~/[\x80-\xff]/);
32
33         push(@V_def,$v);
34         }
35
36 foreach (0 .. 255)
37         {
38         $v=0;
39         $c=sprintf("%c",$_);
40         $v|=$NUMBER     if ($c =~ /[0-9]/);
41         $v|=$UPPER      if ($c =~ /[A-Z]/);
42         $v|=$LOWER      if ($c =~ /[a-z]/);
43         $v|=$UNDER      if ($c =~ /_/);
44         $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
45         $v|=$WS         if ($c =~ /[ \t\r\n]/);
46         $v|=$DQUOTE     if ($c =~ /["]/); # for emacs: "}/)
47         $v|=$FCOMMENT   if ($c =~ /;/);
48         $v|=$EOF        if ($c =~ /\0/);
49         $v|=$HIGHBIT    if ($c =~/[\x80-\xff]/);
50
51         push(@V_w32,$v);
52         }
53
54 print <<"EOF";
55 /* Copyright (C) 1995-1998 Eric Young (eay\@cryptsoft.com)
56  * All rights reserved.
57  *
58  * This package is an SSL implementation written
59  * by Eric Young (eay\@cryptsoft.com).
60  * The implementation was written so as to conform with Netscapes SSL.
61  *
62  * This library is free for commercial and non-commercial use as long as
63  * the following conditions are aheared to.  The following conditions
64  * apply to all code found in this distribution, be it the RC4, RSA,
65  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
66  * included with this distribution is covered by the same copyright terms
67  * except that the holder is Tim Hudson (tjh\@cryptsoft.com).
68  *
69  * Copyright remains Eric Young's, and as such any Copyright notices in
70  * the code are not to be removed.
71  * If this package is used in a product, Eric Young should be given attribution
72  * as the author of the parts of the library used.
73  * This can be in the form of a textual message at program startup or
74  * in documentation (online or textual) provided with the package.
75  *
76  * Redistribution and use in source and binary forms, with or without
77  * modification, are permitted provided that the following conditions
78  * are met:
79  * 1. Redistributions of source code must retain the copyright
80  *    notice, this list of conditions and the following disclaimer.
81  * 2. Redistributions in binary form must reproduce the above copyright
82  *    notice, this list of conditions and the following disclaimer in the
83  *    documentation and/or other materials provided with the distribution.
84  * 3. All advertising materials mentioning features or use of this software
85  *    must display the following acknowledgement:
86  *    "This product includes cryptographic software written by
87  *     Eric Young (eay\@cryptsoft.com)"
88  *    The word 'cryptographic' can be left out if the rouines from the library
89  *    being used are not cryptographic related :-).
90  * 4. If you include any Windows specific code (or a derivative thereof) from
91  *    the apps directory (application code) you must include an acknowledgement:
92  *    "This product includes software written by Tim Hudson (tjh\@cryptsoft.com)"
93  *
94  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
95  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
96  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
97  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
98  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
99  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
100  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
101  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
103  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104  * SUCH DAMAGE.
105  *
106  * The licence and distribution terms for any publically available version or
107  * derivative of this code cannot be changed.  i.e. this code cannot simply be
108  * copied and put under another distribution licence
109  * [including the GNU Public Licence.]
110  */
111
112 /*
113  * THIS FILE WAS AUTOMAGICALLY GENERATED! Please modify and use keysets.pl to
114  * regenerate it.
115  */
116
117 #define CONF_NUMBER             1
118 #define CONF_UPPER              2
119 #define CONF_LOWER              4
120 #define CONF_UNDER              256
121 #define CONF_PUNCTUATION        512
122 #define CONF_WS                 16
123 #define CONF_ESC                32
124 #define CONF_QUOTE              64
125 #define CONF_DQUOTE             1024
126 #define CONF_COMMENT            128
127 #define CONF_FCOMMENT           2048
128 #define CONF_EOF                8
129 #define CONF_HIGHBIT            4096
130 #define CONF_ALPHA              (CONF_UPPER|CONF_LOWER)
131 #define CONF_ALPHA_NUMERIC      (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
132 #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
133                                         CONF_PUNCTUATION)
134
135 #define KEYTYPES(c)             ((const unsigned short *)((c)->meth_data))
136 #ifndef CHARSET_EBCDIC
137 # define IS_COMMENT(c,a)         (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
138 # define IS_FCOMMENT(c,a)        (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
139 # define IS_EOF(c,a)             (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
140 # define IS_ESC(c,a)             (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
141 # define IS_NUMBER(c,a)          (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
142 # define IS_WS(c,a)              (KEYTYPES(c)[(a)&0xff]&CONF_WS)
143 # define IS_ALPHA_NUMERIC(c,a)   (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
144 # define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
145                                 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
146 # define IS_QUOTE(c,a)           (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
147 # define IS_DQUOTE(c,a)          (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
148 # define IS_HIGHBIT(c,a)         (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
149
150 #else                           /* CHARSET_EBCDIC */
151
152 # define IS_COMMENT(c,a)         (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
153 # define IS_FCOMMENT(c,a)        (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
154 # define IS_EOF(c,a)             (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
155 # define IS_ESC(c,a)             (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
156 # define IS_NUMBER(c,a)          (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
157 # define IS_WS(c,a)              (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
158 # define IS_ALPHA_NUMERIC(c,a)   (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
159 # define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
160                                 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
161 # define IS_QUOTE(c,a)           (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
162 # define IS_DQUOTE(c,a)          (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
163 # define IS_HIGHBIT(c,a)         (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
164 #endif                          /* CHARSET_EBCDIC */
165
166 EOF
167
168 print "static const unsigned short CONF_type_default[256] = {";
169
170 for ($i=0; $i<256; $i++)
171         {
172         print "\n   " if ($i % 8) == 0;
173         printf " 0x%04X,",$V_def[$i];
174         }
175
176 print "\n};\n\n";
177
178 print "static const unsigned short CONF_type_win32[256] = {";
179
180 for ($i=0; $i<256; $i++)
181         {
182         print "\n   " if ($i % 8) == 0;
183         printf " 0x%04X,",$V_w32[$i];
184         }
185
186 print "\n};\n";