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