| OLD | NEW |
| 1 # Copyright (C) 2013 Google, Inc. All Rights Reserved. | 1 # Copyright (C) 2013 Google, Inc. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
| 9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
| 10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 use Hasher; | 27 use Hasher; |
| 28 | 28 |
| 29 sub GenerateStrings($) | 29 sub GenerateStrings($) |
| 30 { | 30 { |
| 31 my $stringsRef = shift; | 31 my $stringsRef = shift; |
| 32 my %strings = %$stringsRef; | 32 my %strings = %$stringsRef; |
| 33 | 33 |
| 34 my @result = (); | 34 my @result = (); |
| 35 | 35 |
| 36 while ( my ($name, $value) = each %strings ) { | 36 while ( my ($name, $value) = each %strings ) { |
| 37 my $characterList = join("', '", split("", $value)); |
| 38 push(@result, "static const UChar ${name}String16[] = { '$characterList'
, 0 };\n"); |
| 39 } |
| 40 |
| 41 push(@result, "\n"); |
| 42 |
| 43 while ( my ($name, $value) = each %strings ) { |
| 37 push(@result, "static const LChar ${name}String8[] = \"${value}\";\n"); | 44 push(@result, "static const LChar ${name}String8[] = \"${value}\";\n"); |
| 38 } | 45 } |
| 39 | 46 |
| 40 push(@result, "\n"); | 47 push(@result, "\n"); |
| 41 | 48 |
| 42 while ( my ($name, $value) = each %strings ) { | 49 while ( my ($name, $value) = each %strings ) { |
| 43 my $length = length($value); | 50 my $length = length($value); |
| 44 my $hash = Hasher::GenerateHashValue($value); | 51 my $hash = Hasher::GenerateHashValue($value); |
| 45 push(@result, <<END); | 52 push(@result, <<END); |
| 46 static StringImpl::StaticASCIILiteral ${name}Data = { | 53 static StringImpl::StaticASCIILiteral ${name}Data = { |
| 47 StringImpl::StaticASCIILiteral::s_initialRefCount, | 54 StringImpl::StaticASCIILiteral::s_initialRefCount, |
| 48 $length, | 55 $length, |
| 49 ${name}String8, | 56 ${name}String8, |
| 50 0, | 57 ${name}String16, |
| 51 StringImpl::StaticASCIILiteral::s_initialFlags | (${hash} << StringImpl::Sta
ticASCIILiteral::s_hashShift) | 58 StringImpl::StaticASCIILiteral::s_initialFlags | (${hash} << StringImpl::Sta
ticASCIILiteral::s_hashShift) |
| 52 }; | 59 }; |
| 53 END | 60 END |
| 54 } | 61 } |
| 55 | 62 |
| 56 push(@result, "\n"); | 63 push(@result, "\n"); |
| 57 | 64 |
| 58 while ( my ($name, $value) = each %strings ) { | 65 while ( my ($name, $value) = each %strings ) { |
| 59 push(@result, "static StringImpl* ${name}Impl = reinterpret_cast<StringI
mpl*>(&${name}Data);\n"); | 66 push(@result, "static StringImpl* ${name}Impl = reinterpret_cast<StringI
mpl*>(&${name}Data);\n"); |
| 60 } | 67 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 } | 85 } |
| 79 | 86 |
| 80 push(@result, "#endif // NDEBUG\n"); | 87 push(@result, "#endif // NDEBUG\n"); |
| 81 | 88 |
| 82 push(@result, "\n"); | 89 push(@result, "\n"); |
| 83 | 90 |
| 84 return join "", @result; | 91 return join "", @result; |
| 85 } | 92 } |
| 86 | 93 |
| 87 1; | 94 1; |
| OLD | NEW |