diff options
author | Franklin Wei <git@fwei.tk> | 2017-04-29 18:21:56 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-04-29 18:24:42 -0400 |
commit | 881746789a489fad85aae8317555f73dbe261556 (patch) | |
tree | cec2946362c4698c8db3c10f3242ef546c2c22dd /apps/plugins/puzzles/src/icons/cicon.pl | |
parent | 03dd4b92be7dcd5c8ab06da3810887060e06abd5 (diff) | |
download | rockbox-881746789a489fad85aae8317555f73dbe261556.tar.gz rockbox-881746789a489fad85aae8317555f73dbe261556.zip |
puzzles: refactor and resync with upstream
This brings puzzles up-to-date with upstream revision
2d333750272c3967cfd5cd3677572cddeaad5932, though certain changes made
by me, including cursor-only Untangle and some compilation fixes
remain. Upstream code has been moved to its separate subdirectory and
future syncs can be done by simply copying over the new sources.
Change-Id: Ia6506ca5f78c3627165ea6791d38db414ace0804
Diffstat (limited to 'apps/plugins/puzzles/src/icons/cicon.pl')
-rwxr-xr-x | apps/plugins/puzzles/src/icons/cicon.pl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/icons/cicon.pl b/apps/plugins/puzzles/src/icons/cicon.pl new file mode 100755 index 0000000000..3578bd33fe --- /dev/null +++ b/apps/plugins/puzzles/src/icons/cicon.pl | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Given a list of input PNGs, create a C source file file | ||
4 | # containing a const array of XPMs, under the name `xpm_icon'. | ||
5 | |||
6 | $k = 0; | ||
7 | @xpms = (); | ||
8 | foreach $f (@ARGV) { | ||
9 | # XPM format is generated directly by ImageMagick, so that's easy | ||
10 | # enough. We just have to adjust the declaration line so that it | ||
11 | # has the right name, linkage and storage class. | ||
12 | @lines = (); | ||
13 | open XPM, "convert $f xpm:- |"; | ||
14 | push @lines, $_ while <XPM>; | ||
15 | close XPM; | ||
16 | die "XPM from $f in unexpected format\n" unless $lines[1] =~ /^static.*\{$/; | ||
17 | $lines[1] = "static const char *const xpm_icon_$k"."[] = {\n"; | ||
18 | $k++; | ||
19 | push @xpms, @lines, "\n"; | ||
20 | } | ||
21 | |||
22 | # Now output. | ||
23 | foreach $line (@xpms) { print $line; } | ||
24 | print "const char *const *const xpm_icons[] = {\n"; | ||
25 | for ($i = 0; $i < $k; $i++) { print " xpm_icon_$i,\n"; } | ||
26 | print "};\n"; | ||
27 | print "const int n_xpm_icons = $k;\n"; | ||