1 #!/usr/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 /* 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 /* THIS FILE WAS AUTOMAGICALLY GENERATED!
 114    Please modify and use keysets.pl to regenerate it. */
 115 
 116 #define CONF_NUMBER             $NUMBER
 117 #define CONF_UPPER              $UPPER
 118 #define CONF_LOWER              $LOWER
 119 #define CONF_UNDER              $UNDER
 120 #define CONF_PUNCTUATION        $PUNCTUATION
 121 #define CONF_WS                 $WS
 122 #define CONF_ESC                $ESC
 123 #define CONF_QUOTE              $QUOTE
 124 #define CONF_DQUOTE             $DQUOTE
 125 #define CONF_COMMENT            $COMMENT
 126 #define CONF_FCOMMENT           $FCOMMENT
 127 #define CONF_EOF                $EOF
 128 #define CONF_HIGHBIT            $HIGHBIT
 129 #define CONF_ALPHA              (CONF_UPPER|CONF_LOWER)
 130 #define CONF_ALPHA_NUMERIC      (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
 131 #define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
 132                                         CONF_PUNCTUATION)
 133 
 134 #define KEYTYPES(c)             ((unsigned short *)((c)->meth_data))
 135 #ifndef CHARSET_EBCDIC
 136 #define IS_COMMENT(c,a)         (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
 137 #define IS_FCOMMENT(c,a)        (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
 138 #define IS_EOF(c,a)             (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
 139 #define IS_ESC(c,a)             (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
 140 #define IS_NUMBER(c,a)          (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
 141 #define IS_WS(c,a)              (KEYTYPES(c)[(a)&0xff]&CONF_WS)
 142 #define IS_ALPHA_NUMERIC(c,a)   (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
 143 #define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
 144                                 (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
 145 #define IS_QUOTE(c,a)           (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
 146 #define IS_DQUOTE(c,a)          (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
 147 #define IS_HIGHBIT(c,a)         (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
 148 
 149 #else /*CHARSET_EBCDIC*/
 150 
 151 #define IS_COMMENT(c,a)         (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
 152 #define IS_FCOMMENT(c,a)        (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
 153 #define IS_EOF(c,a)             (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
 154 #define IS_ESC(c,a)             (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
 155 #define IS_NUMBER(c,a)          (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
 156 #define IS_WS(c,a)              (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
 157 #define IS_ALPHA_NUMERIC(c,a)   (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
 158 #define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
 159                                 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
 160 #define IS_QUOTE(c,a)           (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
 161 #define IS_DQUOTE(c,a)          (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
 162 #define IS_HIGHBIT(c,a)         (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
 163 #endif /*CHARSET_EBCDIC*/
 164 
 165 EOF
 166 
 167 print "static unsigned short CONF_type_default[256]={";
 168 
 169 for ($i=0; $i<256; $i++)
 170         {
 171         print "\n\t" if ($i % 8) == 0;
 172         printf "0x%04X,",$V_def[$i];
 173         }
 174 
 175 print "\n\t};\n\n";
 176 
 177 print "static unsigned short CONF_type_win32[256]={";
 178 
 179 for ($i=0; $i<256; $i++)
 180         {
 181         print "\n\t" if ($i % 8) == 0;
 182         printf "0x%04X,",$V_w32[$i];
 183         }
 184 
 185 print "\n\t};\n\n";