Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: Source/core/css/make-css-file-arrays.pl

Issue 361693004: Remove make-css-file-arrays.pl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: \s consistentcy Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/perl -w
2 #
3 # Copyright (C) 2006 Apple Computer, Inc.
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Library General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Library General Public License for more details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this library; see the file COPYING.LIB. If not, write to
17 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 # Boston, MA 02110-1301, USA.
19 #
20
21 # Usage: make-css-file-arrays.pl <header> <output> <input> ...
22
23 use strict;
24 use Getopt::Long;
25
26 my $header = $ARGV[0];
27 shift;
28
29 my $out = $ARGV[0];
30 shift;
31
32 $header =~ s|\\|/|g;
33 $out =~ s|\\|/|g;
34 open HEADER, ">", $header or die "$!\n";
35 open OUT, ">", $out or die "$!\n";
36
37 print HEADER "namespace WebCore {\n";
38 print OUT "namespace WebCore {\n";
39
40 for my $in (@ARGV) {
41 $in =~ /(\w+)\.css$/ or $in =~ /(\w+)\.js$/ or die;
42 my $name = $1;
43
44 # Slurp in the CSS file.
45 my $text;
46 open IN, "<", $in or die;
47 { local $/; $text = <IN>; }
48 close IN;
49
50 # Remove comments in a simple-minded way that will work fine for our files.
51 # Could do this a fancier way if we were worried about arbitrary CSS source.
52 $text =~ s|/\*.*?\*/||gs;
53
54 # Crunch whitespace just to make it a little smaller.
55 # Could do work to avoid doing this inside quote marks but our files don't h ave runs of spaces in quotes.
56 # Could crunch further based on places where whitespace is optional.
57 $text =~ s|\s+| |gs;
58 $text =~ s|^ ||;
59 $text =~ s| $||;
60
61 # Write out a C array of the characters.
62 my $length = length $text;
63 if ($in =~ /(\w+)\.css$/) {
64 print HEADER "extern const char ${name}UserAgentStyleSheet[${length}];\n ";
65 print OUT "extern const char ${name}UserAgentStyleSheet[${length}] = {\n ";
66 } else {
67 print HEADER "extern const char ${name}JavaScript[${length}];\n";
68 print OUT "extern const char ${name}JavaScript[${length}] = {\n";
69 }
70 my $i = 0;
71 while ($i < $length) {
72 print OUT " ";
73 my $j = 0;
74 while ($j < 16 && $i < $length) {
75 print OUT ", " unless $j == 0;
76 print OUT ord substr $text, $i, 1;
77 ++$i;
78 ++$j;
79 }
80 print OUT "," unless $i == $length;
81 print OUT "\n";
82 }
83 print OUT "};\n";
84
85 }
86
87 print HEADER "}\n";
88 print OUT "}\n";
OLDNEW
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698