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