Bug 461810 - Video content menu should operate on .currentSrc, not .src. r=gavin
[wine-gecko.git] / gfx / idl / geniid.pl
blob4fcdcd0ae291428b74e78287b2890118304fa4fc
1 #!/usr/local/bin/perl
3 require "find.pl";
5 $uuid = 0x6f7652e0;
6 $format = "{ 0x%x, 0xee43, 0x11d1, \\\
7 { 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }";
8 $pattern = "--- IID GOES HERE ---";
9 $mydir = cwd();
11 sub replaceText {
12 local ($oldname) = $_;
13 local ($newname) = $_;
14 local ($found) = 0;
15 local ($tempname) = $oldname.'.orig';
16 local ($replacement);
18 if (-T $oldname && -s $oldname) {
19 open(FILE, "<$oldname")
20 || die "Unable to open $oldname\n";
21 while (<FILE>) {
22 if (/$pattern/) {
23 $found = 1;
24 last;
27 close(FILE);
29 if ($found) {
30 print "Setting IID for file: ", $oldname, "\n";
31 rename($oldname, $tempname)
32 || die "Unable to rename $oldname as $tempname";
33 open(REPLACEFILE, ">$newname")
34 || die "Unable to open $newname for writing\n";
36 open(SEARCHFILE, "<$tempname")
37 || die "Unable to open $tempname\n";
39 while (<SEARCHFILE>) {
40 if (/$pattern/) {
41 $replacement = sprintf($format, $uuid++);
42 s/$pattern/$replacement /g;
44 print REPLACEFILE;
46 close(SEARCHFILE);
47 close(REPLACEFILE);
48 if (-z $newname) {
49 die "$newname has zero size\n."
50 ."Restore manually from $tempname\n";
51 } else {
52 unlink($tempname);
55 warn "$name: Renaming as $newname\n" if $newname ne $oldname;
57 $_ = $oldname;
58 return;
61 if ($newname ne $oldname) {
62 warn "$name: Renaming as $newname\n";
63 rename($oldname, $newname) || warn "Unable to rename $oldname\n";
65 $_ = $oldname;
68 eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
69 if $running_under_some_shell;
71 # Traverse desired filesystems
72 $dont_use_nlink = 1;
74 if (!$ARGV[0]) {
75 &find('.');
77 else {
78 foreach $file (@ARGV) {
79 chdir $mydir
80 &find($file);
84 exit;
86 sub wanted {
87 /^nsIDOM.*\.h$/ &&
88 &replaceText($name);