equal
deleted
inserted
replaced
|
1 #!perl |
|
2 # bin2lit.pl |
|
3 # |
|
4 # Copyright (c) 2010 Accenture. All rights reserved. |
|
5 # This component and the accompanying materials are made available |
|
6 # under the terms of the "Eclipse Public License v1.0" |
|
7 # which accompanies this distribution, and is available |
|
8 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 # |
|
10 # Initial Contributors: |
|
11 # Accenture - Initial contribution |
|
12 # |
|
13 |
|
14 my $litName = shift(@ARGV); |
|
15 die "Error: No name specified\n" unless $litName; |
|
16 |
|
17 binmode(STDIN); |
|
18 undef $/; |
|
19 my $content = <>; |
|
20 close (STDIN); |
|
21 |
|
22 print <<__EOS__; |
|
23 // This file has been automatically generated by $0 |
|
24 // Do not edit it directly! |
|
25 |
|
26 _LIT8($litName, |
|
27 __EOS__ |
|
28 print "\t\""; |
|
29 for (my $i=0; $i<length($content); ++$i) { |
|
30 print "\"\n\t\"" if ($i && ($i%20) == 0); |
|
31 my $c = ord(substr($content, $i, 1)); |
|
32 printf "\\x%02x", $c; |
|
33 } |
|
34 print "\");\n\n" |
|
35 |