OSDN Git Service

Change OpenSSL context mode flags.
[ffftp/ffftp.git] / putty / ICONS / CICON.PL
1 #!/usr/bin/perl \r
2 \r
3 # Given a list of input PNGs, create a C source file containing a\r
4 # const array of XPMs, named by a given C identifier.\r
5 \r
6 $id = shift @ARGV;\r
7 $k = 0;\r
8 @xpms = ();\r
9 foreach $f (@ARGV) {\r
10   # XPM format is generated directly by ImageMagick, so that's easy\r
11   # enough. We just have to adjust the declaration line so that it\r
12   # has the right name, linkage and storage class.\r
13   @lines = ();\r
14   open XPM, "convert $f xpm:- |";\r
15   push @lines, $_ while <XPM>;\r
16   close XPM;\r
17   die "XPM from $f in unexpected format\n" unless $lines[1] =~ /^static.*\{$/;\r
18   $lines[1] = "static const char *const ${id}_$k"."[] = {\n";\r
19   $k++;\r
20   push @xpms, @lines, "\n";\r
21 }\r
22 \r
23 # Now output.\r
24 foreach $line (@xpms) { print $line; }\r
25 print "const char *const *const ${id}[] = {\n";\r
26 for ($i = 0; $i < $k; $i++) { print "    ${id}_$i,\n"; }\r
27 print "};\n";\r
28 print "const int n_${id} = $k;\n";\r