3 # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 # its contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Script to do a rename in JavaScriptCore, WebCore, and WebKit.
33 use lib $FindBin::Bin;
42 # find all files we want to process
45 find(\&wanted, "JavaScriptCore");
46 find(\&wanted, "JavaScriptGlue");
47 find(\&wanted, "WebCore");
48 find(\&wanted, "WebKit");
55 $File::Find::prune = 1;
59 if ($file =~ /^\../) {
60 $File::Find::prune = 1;
64 return if $file =~ /^ChangeLog/;
67 push @paths, $File::Find::name;
71 "JSUnprotectedEventListener" => "JSEventListener",
72 "findJSUnprotectedEventListener" => "findJSEventListener",
73 "findOrCreateJSUnprotectedEventListener" => "findOrCreateJSEventListener",
74 "UnprotectedListenersMap" => "JSListenersMap",
75 "jsUnprotectedEventListeners" => "jsEventListeners",
76 "jsUnprotectedInlineEventListeners" => "jsInlineEventListeners",
79 my %renamesContemplatedForTheFuture = (
80 "DOMObject" => "JSDOMObject",
82 "runtimeObjectGetter" => "pluginElementGetter",
83 "runtimeObjectPropertyGetter" => "pluginElementPropertyGetter",
84 "runtimeObjectCustomGetOwnPropertySlot" => "pluginElementCustomGetOwnPropertySlot",
85 "runtimeObjectCustomPut" => "pluginElementCustomPut",
86 "runtimeObjectImplementsCall" => "pluginElementImplementsCall",
87 "runtimeObjectCallAsFunction" => "pluginElementCallAsFunction",
89 "CLONE_CONTENTS" => "Clone",
90 "DELETE_CONTENTS" => "Delete",
91 "EXTRACT_CONTENTS" => "Extract",
93 "DateInstance" => "JSDate",
94 "ErrorInstance" => "JSError",
97 "KURLCFNet" => "URLCF",
98 "KURLHash" => "URLHash",
99 "KURLMac" => "URLMac",
102 "ThreadSafeShared" => "ThreadSafeRefCounted",
103 "TreeShared" => "TreeRefCounted",
105 "StringImpl" => "SharedString",
107 "RenderView" => "RenderViewport",
109 "ObjcFallbackObjectImp" => "ObjCFallbackObject",
110 "RuntimeObjectImp" => "ForeignObject",
112 "runtime_array" => "BridgedArray",
113 "runtime_method" => "BridgedFunction",
114 "runtime_object" => "BridgedObject",
115 "objc_runtime" => "ObjCBridge",
117 "equalIgnoringCase" => "equalFoldingCase",
119 "FTPDirectoryTokenizer" => "FTPDirectoryDocumentBuilder",
120 "HTMLTokenizer" => "HTMLDocumentBuilder",
121 "ImageTokenizer" => "ImageDocumentBuilder",
122 "PluginTokenizer" => "PluginDocumentBuilder",
123 "TextTokenizer" => "TextDocumentBuilder",
124 "Tokenizer" => "DocumentBuilder",
125 "Tokenizer_h" => "DocumentBuilder_h",
126 "XMLTokenizer" => "XMLDocumentBuilder",
127 "isHTMLTokenizer" => "isHTMLDocumentBuilder",
128 "m_tokenizer" => "m_builder",
129 "createTokenizer" => "createBuilder",
130 "tokenizerProcessedData" => "documentBuilderProcessedData",
132 "WTF_UNICODE_H" => "Unicode_h",
133 "WTF_UNICODE_ICU_H" => "UnicodeICU_h",
134 "WTF_UNICODE_QT4_H" => "UnicodeQt4_h",
135 "UnicodeIcu" => "UnicodeICU",
137 "m_invertibleCTM" => "m_transformIsInvertible",
139 "JSValuePtr" => "JSValue",
140 "ProtectedJSValuePtr" => "ProtectedJSValue",
146 for my $file (sort @paths) {
148 $f = "$1$renames{$2}$3" if $f =~ /^(.*\/)(\w+)(\.\w+)$/ && $renames{$2};
150 $newFile{$file} = $f;
154 for my $file (sort @paths) {
155 if ($newFile{$file}) {
156 my $newFile = $newFile{$file};
157 print "Renaming $file to $newFile\n";
158 system "svn move $file $newFile";
162 # change all file contents
164 for my $file (sort @paths) {
165 $file = $newFile{$file} if $newFile{$file};
169 open FILE, $file or die;
173 my $newContents = $contents;
175 for my $from (keys %renames) {
176 $newContents =~ s/\b$from(?!["\w])/$renames{$from}/g; # this " unconfuses Xcode syntax highlighting
179 if ($newContents ne $contents) {
180 open FILE, ">", $file or die;
181 print FILE $newContents;