Whitespace cleanup in crypto
[openssl.git] / crypto / asn1 / charmap.pl
index c36cf78a903bdaf72e5e41f2ab0b50f4414063b8..a3511da072880756a94e99b3b1aaa49bf384d15b 100644 (file)
@@ -21,6 +21,7 @@ my $NOESC_QUOTE       = 8;    # Not escaped if quoted
 my $PSTRING_CHAR = 0x10;       # Valid PrintableString character
 my $RFC2253_FIRST_ESC = 0x20; # Escaped with \ if first character
 my $RFC2253_LAST_ESC = 0x40;  # Escaped with \ if last character
+my $RFC2254_ESC = 0x400;       # Character escaped \XX
 
 for($i = 0; $i < 128; $i++) {
        # Set the RFC2253 escape characters (control)
@@ -52,6 +53,14 @@ $arr[ord("<")] |= $NOESC_QUOTE | $RFC2253_ESC;
 $arr[ord(">")] |= $NOESC_QUOTE | $RFC2253_ESC;
 $arr[ord(";")] |= $NOESC_QUOTE | $RFC2253_ESC;
 
+# Remaining RFC2254 characters
+
+$arr[0] |= $RFC2254_ESC;
+$arr[ord("(")] |= $RFC2254_ESC;
+$arr[ord(")")] |= $RFC2254_ESC;
+$arr[ord("*")] |= $RFC2254_ESC;
+$arr[ord("\\")] |= $RFC2254_ESC;
+
 # Remaining PrintableString characters
 
 $arr[ord(" ")] |= $PSTRING_CHAR;
@@ -70,17 +79,30 @@ $arr[ord("?")] |= $PSTRING_CHAR;
 # Now generate the C code
 
 print <<EOF;
-/* Auto generated with chartype.pl script.
+/*
+ * WARNING: do not edit!
+ * Generated by crypto/asn1/charmap.pl
+ *
+ * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
  * Mask of various character properties
  */
 
-static const unsigned char char_type[] = {
+static const unsigned short char_type[] = {
 EOF
 
+print "   ";
 for($i = 0; $i < 128; $i++) {
-       print("\n") if($i && (($i % 16) == 0));
-       printf("%2d", $arr[$i]);
+       print("\n   ") if($i && (($i % 16) == 0));
+       printf(" %2d", $arr[$i]);
        print(",") if ($i != 127);
 }
-print("\n};\n\n");
+print("\n};\n");