fbs/fontandbitmapserver/group/genbitmaps.pl
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 # Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # Build bitmap test files
       
    15 # 
       
    16 #
       
    17 
       
    18 use Cwd;
       
    19 use File::Path;
       
    20 
       
    21 $dir = getcwd();
       
    22 chdir "..";
       
    23 $parentdir = getcwd();
       
    24 
       
    25 $datadir="/tfbs/mbmfiles";
       
    26 $datadir = $parentdir . $datadir;
       
    27 
       
    28 if (-e "$datadir")
       
    29 { 
       
    30   #proceed with your code
       
    31 }
       
    32 else
       
    33 {
       
    34 	eval { mkpath($datadir) };
       
    35 	if ($@) {
       
    36 	    print "Couldn't create $dir: $@";
       
    37   	} 
       
    38 }
       
    39 
       
    40 
       
    41 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4a.mbm");
       
    42 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4b.mbm");
       
    43 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4c.mbm");
       
    44 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4d.mbm");
       
    45 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4e.mbm");
       
    46 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4f.mbm");
       
    47 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4g.mbm");
       
    48 binaryCopy("$datadir/tfbs_file4.mbm","$datadir/tfbs_file4h.mbm");
       
    49 
       
    50 binaryCopy("$datadir/RscHeader3.Bin","$datadir/DummyRscFile3.RSC","$datadir/TFBS.MBM","$datadir/tfbs_rsc.rsc");
       
    51 
       
    52 sub binaryCopy
       
    53 {
       
    54 	$numOfParams = @_;
       
    55 	my $buffer;
       
    56 	
       
    57 	open OUTF, ">$_[$numOfParams-1]" or die "\nCan't open $_[$numOfParams-1] for writing: $!\n";
       
    58 	binmode OUTF;
       
    59 
       
    60 	for($i=0;$i<$numOfParams-1;$i++)
       
    61 	{
       
    62 		open INF, $_[$i] or die "\nCan't open $_[$i] for reading: $!\n";	
       
    63 		binmode INF;
       
    64 		while	(
       
    65 			read (INF, $buffer, 65536)	# read in (up to) 64k chunks, write
       
    66 			and print OUTF $buffer	# exit if read or write fails
       
    67 			) {};
       
    68 			die "Problem copying: $!\n" if $!;
       
    69 			close INF or die "Can't close $_[$i]: $!\n";
       
    70 	}
       
    71 	close OUTF or die "Can't close $_[$numOfParams-1]: $!\n";
       
    72 }