keysets.pl revision 100928
111891Speter#!/usr/local/bin/perl 29Sjkh 311891Speter$NUMBER=0x01; 49Sjkh$UPPER=0x02; 59Sjkh$LOWER=0x04; 69Sjkh$UNDER=0x100; 79Sjkh$PUNCTUATION=0x200; 89Sjkh$WS=0x10; 99Sjkh$ESC=0x20; 109Sjkh$QUOTE=0x40; 119Sjkh$DQUOTE=0x400; 129Sjkh$COMMENT=0x80; 139Sjkh$FCOMMENT=0x800; 149Sjkh$EOF=0x08; 159Sjkh$HIGHBIT=0x1000; 169Sjkh 179Sjkhforeach (0 .. 255) 189Sjkh { 1911891Speter $v=0; 2011891Speter $c=sprintf("%c",$_); 2111891Speter $v|=$NUMBER if ($c =~ /[0-9]/); 229Sjkh $v|=$UPPER if ($c =~ /[A-Z]/); 239Sjkh $v|=$LOWER if ($c =~ /[a-z]/); 249Sjkh $v|=$UNDER if ($c =~ /_/); 259Sjkh $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/); 269Sjkh $v|=$WS if ($c =~ /[ \t\r\n]/); 279Sjkh $v|=$ESC if ($c =~ /\\/); 289Sjkh $v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/) 299Sjkh $v|=$COMMENT if ($c =~ /\#/); 309Sjkh $v|=$EOF if ($c =~ /\0/); 3150472Speter $v|=$HIGHBIT if ($c =~/[\x80-\xff]/); 329Sjkh 3311891Speter push(@V_def,$v); 349Sjkh } 359Sjkh 369Sjkhforeach (0 .. 255) 379Sjkh { 389Sjkh $v=0; 399Sjkh $c=sprintf("%c",$_); 4011891Speter $v|=$NUMBER if ($c =~ /[0-9]/); 419Sjkh $v|=$UPPER if ($c =~ /[A-Z]/); 429Sjkh $v|=$LOWER if ($c =~ /[a-z]/); 439Sjkh $v|=$UNDER if ($c =~ /_/); 4411891Speter $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/); 4511891Speter $v|=$WS if ($c =~ /[ \t\r\n]/); 4611891Speter $v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/) 4711891Speter $v|=$FCOMMENT if ($c =~ /;/); 4811891Speter $v|=$EOF if ($c =~ /\0/); 4911891Speter $v|=$HIGHBIT if ($c =~/[\x80-\xff]/); 5011891Speter 519Sjkh push(@V_w32,$v); 529Sjkh } 539Sjkh 549Sjkhprint <<"EOF"; 5511891Speter/* crypto/conf/conf_def.h */ 569Sjkh/* Copyright (C) 1995-1998 Eric Young (eay\@cryptsoft.com) 5711891Speter * All rights reserved. 5811891Speter * 599Sjkh * This package is an SSL implementation written 609Sjkh * by Eric Young (eay\@cryptsoft.com). 6111891Speter * The implementation was written so as to conform with Netscapes SSL. 629Sjkh * 6311891Speter * This library is free for commercial and non-commercial use as long as 6411891Speter * the following conditions are aheared to. The following conditions 659Sjkh * apply to all code found in this distribution, be it the RC4, RSA, 669Sjkh * lhash, DES, etc., code; not just the SSL code. The SSL documentation 679Sjkh * included with this distribution is covered by the same copyright terms 689Sjkh * except that the holder is Tim Hudson (tjh\@cryptsoft.com). 699Sjkh * 709Sjkh * Copyright remains Eric Young's, and as such any Copyright notices in 719Sjkh * the code are not to be removed. 729Sjkh * If this package is used in a product, Eric Young should be given attribution 739Sjkh * as the author of the parts of the library used. 749Sjkh * This can be in the form of a textual message at program startup or 759Sjkh * in documentation (online or textual) provided with the package. 769Sjkh * 779Sjkh * Redistribution and use in source and binary forms, with or without 789Sjkh * modification, are permitted provided that the following conditions 799Sjkh * are met: 8011894Speter * 1. Redistributions of source code must retain the copyright 8111891Speter * notice, this list of conditions and the following disclaimer. 8211891Speter * 2. Redistributions in binary form must reproduce the above copyright 839Sjkh * notice, this list of conditions and the following disclaimer in the 849Sjkh * documentation and/or other materials provided with the distribution. 859Sjkh * 3. All advertising materials mentioning features or use of this software 869Sjkh * must display the following acknowledgement: 879Sjkh * "This product includes cryptographic software written by 889Sjkh * Eric Young (eay\@cryptsoft.com)" 8911891Speter * The word 'cryptographic' can be left out if the rouines from the library 9011891Speter * being used are not cryptographic related :-). 9111891Speter * 4. If you include any Windows specific code (or a derivative thereof) from 9211891Speter * the apps directory (application code) you must include an acknowledgement: 9311891Speter * "This product includes software written by Tim Hudson (tjh\@cryptsoft.com)" 949Sjkh * 959Sjkh * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 969Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 979Sjkh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 989Sjkh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 999Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 10011891Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1019Sjkh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1029Sjkh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1039Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1049Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1059Sjkh * SUCH DAMAGE. 10611891Speter * 1079Sjkh * The licence and distribution terms for any publically available version or 10811891Speter * derivative of this code cannot be changed. i.e. this code cannot simply be 1099Sjkh * copied and put under another distribution licence 1109Sjkh * [including the GNU Public Licence.] 1119Sjkh */ 1129Sjkh 1139Sjkh/* THIS FILE WAS AUTOMAGICALLY GENERATED! 1149Sjkh Please modify and use keysets.pl to regenerate it. */ 1159Sjkh 1169Sjkh#define CONF_NUMBER $NUMBER 11711891Speter#define CONF_UPPER $UPPER 1189Sjkh#define CONF_LOWER $LOWER 1199Sjkh#define CONF_UNDER $UNDER 1209Sjkh#define CONF_PUNCTUATION $PUNCTUATION 12111891Speter#define CONF_WS $WS 1229Sjkh#define CONF_ESC $ESC 1239Sjkh#define CONF_QUOTE $QUOTE 1249Sjkh#define CONF_DQUOTE $DQUOTE 12511891Speter#define CONF_COMMENT $COMMENT 12611891Speter#define CONF_FCOMMENT $FCOMMENT 12711891Speter#define CONF_EOF $EOF 1289Sjkh#define CONF_HIGHBIT $HIGHBIT 1299Sjkh#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) 1309Sjkh#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) 13111891Speter#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\ 1329Sjkh CONF_PUNCTUATION) 13311891Speter 1349Sjkh#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 1359Sjkh#ifndef CHARSET_EBCDIC 13611891Speter#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) 13711891Speter#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) 13811891Speter#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) 13911891Speter#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC) 1409Sjkh#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER) 1419Sjkh#define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS) 1429Sjkh#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC) 1439Sjkh#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\ 1449Sjkh (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT) 1459Sjkh#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE) 1469Sjkh#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) 1479Sjkh#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) 1489Sjkh 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 165EOF 166 167print "static unsigned short CONF_type_default[256]={"; 168 169for ($i=0; $i<256; $i++) 170 { 171 print "\n\t" if ($i % 8) == 0; 172 printf "0x%04X,",$V_def[$i]; 173 } 174 175print "\n\t};\n\n"; 176 177print "static unsigned short CONF_type_win32[256]={"; 178 179for ($i=0; $i<256; $i++) 180 { 181 print "\n\t" if ($i % 8) == 0; 182 printf "0x%04X,",$V_w32[$i]; 183 } 184 185print "\n\t};\n\n"; 186