Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.79 KB | None | 0 0
  1. my %willbe_types = (
  2.                     PassRefPtrWillBeRawPtr => "RawPtr",
  3.                     RefCountedWillBeGarbageCollected => "GarbageCollected",
  4.                     RefCountedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
  5.                     RefCountedWillBeRefCountedGarbageCollected => "RefCountedGarbageCollected",
  6.                     RefCountedGarbageCollectedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
  7.                     RefCountedWillBeNoBase => "DummyBase",
  8.                     RefCountedGarbageCollectedWillBeNoBase => "DummyBase",
  9.                     ThreadSafeRefCountedWillBeGarbageCollected => "GarbageCollected",
  10.                     ThreadSafeRefCountedWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
  11.                     PersistentWillBeMember => "Member",
  12.                     CrossThreadPersistentWillBeMember => "Member",
  13.                     RefPtrWillBePersistent => "Persistent",
  14.                     RefPtrWillBeRawPtr => "RawPtr",
  15.                     RefPtrWillBeMember => "Member",
  16.                     RefPtrWillBeWeakMember => "WeakMember",
  17.                     RefPtrWillBeWeakPersistent => "WeakPersistent",
  18.                     RefPtrWillBeCrossThreadPersistent => "CrossThreadPersistent",
  19.                     RawPtrWillBeMember => "Member",
  20.                     RawPtrWillBePersistent => "Persistent",
  21.                     RawPtrWillBeWeakMember => "WeakMember",
  22.                     RawPtrWillBeWeakPersistent => "WeakPersistent",
  23.                     RawPtrWillBeUntracedMember => "UntracedMember",
  24.                     OwnPtrWillBeCrossThreadPersistent => "CrossThreadPersistent",
  25.                     OwnPtrWillBeMember => "Member",
  26.                     OwnPtrWillBePersistent => "Persistent",
  27.                     OwnPtrWillBeRawPtr => "RawPtr",
  28.                     PassOwnPtrWillBeRawPtr => "RawPtr",
  29.                     WeakPtrWillBeCrossThreadWeakPersistent => "CrossThreadWeakPersistent",
  30.                     WeakPtrWillBeMember => "Member",
  31.                     WeakPtrWillBeRawPtr => "RawPtr",
  32.                     WeakPtrWillBeWeakMember => "WeakMember",
  33.                     WeakPtrWillBeWeakPersistent => "WeakPersistent",
  34.                     NoBaseWillBeGarbageCollected => "GarbageCollected",
  35.                     NoBaseWillBeGarbageCollectedFinalized => "GarbageCollectedFinalized",
  36.                     NoBaseWillBeRefCountedGarbageCollected => "RefCountedGarbageCollected",
  37.                     WillBeHeapHashMap => "HeapHashMap",
  38.                     WillBePersistentHeapHashMap => "PersistentHeapHashMap",
  39.                     WillBeHeapHashSet => "HeapHashSet",
  40.                     WillBePersistentHeapHashSet => "PersistentHeapHashSet",
  41.                     WillBeHeapLinkedHashSet => "HeapLinkedHashSet",
  42.                     WillBePersistentHeapLinkedHashSet => "PersistentHeapLinkedHashSet",
  43.                     WillBeHeapListHashSet => "HeapListHashSet",
  44.                     WillBePersistentHeapListHashSet => "PersistentHeapListHashSet",
  45.                     WillBeHeapVector => "HeapVector",
  46.                     WillBePersistentHeapVector => "PersistentHeapVector",
  47.                     WillBeHeapDeque => "HeapDeque",
  48.                     WillBePersistentHeapDeque => "PersistentHeapDeque",
  49.                     WillBeHeapHashCountedSet => "HeapHashCountedSet",
  50.                     WillBePersistentHeapHashCountedSet => "PersistentHeapHashCountedSet",
  51.                     WillBeGarbageCollectedMixin => "GarbageCollectedMixin",
  52.                     WillBeHeapSupplement => "HeapSupplement",
  53.                     WillBeHeapSupplementable => "HeapSupplementable",
  54.                     WillBeHeapTerminatedArray => "HeapTerminatedArray",
  55.                     WillBeHeapTerminatedArrayBuilder => "HeapTerminatedArrayBuilder",
  56.                     WillBeHeapLinkedStack => "HeapLinkedStack",
  57.                     PersistentHeapHashMapWillBeHeapHashMap => "HeapHashMap",
  58.                     PersistentHeapHashSetWillBeHeapHashSet => "HeapHashSet",
  59.                     PersistentHeapDequeWillBeHeapDeque => "HeapDeque",
  60.                     PersistentHeapVectorWillBeHeapVector => "HeapVector",
  61.                     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN => "USING_GARBAGE_COLLECTED_MIXIN",
  62.                    );
  63.  
  64. my @remove_lines = (
  65.                     "USING_FAST_MALLOC_WILL_BE_REMOVED",
  66.                     "USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED",
  67.                     "DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED",
  68.                     "DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED",
  69.                     "DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED",
  70.                     "EAGERLY_FINALIZE_WILL_BE_REMOVED",
  71.                    );
  72.  
  73. for my $key (keys %willbe_types) {
  74.     my $command = "grep -rl '" . $key . "' * | grep -v '.pl' | grep -v 'platform/heap/' | sed -i 's/" . $key . "/" . $willbe_types{$key} . "/g'";
  75.     system $command;
  76. }
  77.  
  78. for my $item (@remove_lines) {
  79.     my $command = "grep -rl '" . $item . "' * | grep -v '.pl' | grep -v 'platform/heap/'";
  80.     my @files = `$command`;
  81.     for my $file (@files) {
  82.         my $str = "";
  83.         my $skipped = 0;
  84.         chomp $file;
  85.         open FH, "<", $file or die;
  86.         while (my $line = <FH>) {
  87.             if ($skipped && $line =~ /^[\s\t]*\n$/) {
  88.                 next;
  89.             }
  90.             $skipped = 0;
  91.             if ($line =~ /${item}/) {
  92.                 if ($line =~ /^[\s\t]*${item}(\([^()]*\))?;?\s*\n$/) {
  93.                     $skipped = 1;
  94.                     next;
  95.                 } else {
  96.                     $line =~ s/[\s\t]*${item}(\([^()]*\))?;?//;
  97.                     # print $line;
  98.                 }
  99.             }
  100.             $str .= $line;
  101.         }
  102.         close FH;
  103.         open FH, ">", $file or die;
  104.         print FH $str;
  105.         close FH;
  106.     }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement