Title: [114684] trunk/Source/_javascript_Core
Revision
114684
Author
[email protected]
Date
2012-04-19 15:44:40 -0700 (Thu, 19 Apr 2012)

Log Message

KeywordLookupGenerator.py should take an output file as an argument
https://bugs.webkit.org/show_bug.cgi?id=84292

Patch by Don Olmstead <[email protected]> on 2012-04-19
Reviewed by Eric Seidel.

Extended KeywordLookupGenerator to accept an additional argument specifying an output file. If this argument is found stdout is redirected to a file for the duration of the script.

* KeywordLookupGenerator.py:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (114683 => 114684)


--- trunk/Source/_javascript_Core/ChangeLog	2012-04-19 22:33:30 UTC (rev 114683)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-04-19 22:44:40 UTC (rev 114684)
@@ -1,3 +1,14 @@
+2012-04-19  Don Olmstead  <[email protected]>
+
+        KeywordLookupGenerator.py should take an output file as an argument
+        https://bugs.webkit.org/show_bug.cgi?id=84292
+
+        Reviewed by Eric Seidel.
+
+        Extended KeywordLookupGenerator to accept an additional argument specifying an output file. If this argument is found stdout is redirected to a file for the duration of the script.
+
+        * KeywordLookupGenerator.py:
+
 2012-04-19  Filip Pizlo  <[email protected]>
 
         It should be possible to perform debugCall on ARMv7

Modified: trunk/Source/_javascript_Core/KeywordLookupGenerator.py (114683 => 114684)


--- trunk/Source/_javascript_Core/KeywordLookupGenerator.py	2012-04-19 22:33:30 UTC (rev 114683)
+++ trunk/Source/_javascript_Core/KeywordLookupGenerator.py	2012-04-19 22:44:40 UTC (rev 114684)
@@ -1,4 +1,5 @@
 # Copyright (C) 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2012 Sony Network Entertainment. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -27,6 +28,15 @@
 
 keywordsText = open(sys.argv[1]).read()
 
+# A second argument signifies that the output
+# should be redirected to a file
+redirect_to_file = len(sys.argv) > 2
+
+# Change stdout to point to the file if requested
+if redirect_to_file:
+    file_output = open(sys.argv[-1], "w")
+    sys.stdout = file_output
+
 # Observed weights of the most common keywords, rounded to 2.s.d
 keyWordWeights = {
     "catch": 0.01,
@@ -288,3 +298,8 @@
 """)
 
 trie.printAsC()
+
+# Close the redirected file if requested
+if (redirect_to_file):
+    file_output.close()
+    sys.stdout = sys.__stdout__
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to