www.pudn.com > sdk_host_2520.rar > build_sdm.pl
#;///////////////////////////////////////////////////////////////////////////////
#; Copyright(C) SigmaTel, Inc. 2000-2001
#;
#; Filename: build_SDM.pl
#; Description: Builds the specified Secondary DBCS Map resource (SDM_xx.src)
#
#;///////////////////////////////////////////////////////////////////////////////
require "build_SDM_files.pl";
use strict;
#use vars qw($tool_dir);
#;///////////////////////////////////////////////////////////////////////////////
#;> Name: build_SDM
#;
#; Type: Function
#; Description: Builds the specified Secondary DBCS Map resource (SDM_xx.src)
# Prototype: build_SDM($PrimaryDBCSMapRef, $LeadByte, $defaultUnicodeChar)
#
#; Inputs: $PrimaryDBCSMapRef - Reference to Primary DBCS Map (a hash)
# $LeadByte - 2 digit hex value for the Lead Byte for
# this Multi-Byte Character map.
# $defaultUnicodeChar - Default Unicode character: use when no
# mapping is defined.
#; Outputs: Returns 1 for success, 0 for failure. (May not return on some
# errors.)
#; Notes:
# This routine creates a number of intermediate files (SDM_xx.src,
# SDM.inc, and SDM.bin). It will delete them, at the end, if nothing
# goes wrong. It it fails, you'll have to delete them by hand.
#;<
#;///////////////////////////////////////////////////////////////////////////////
sub build_SDM {
my $PrimaryDBCSMapRef = shift;
my $LeadByte = shift;
my $defaultUnicodeChar = shift;
my $hexLeadByte = sprintf "%02x", $LeadByte;
my $rsclink = "rsclink"; #$tool_dir . "\\rsclink";
my $buildres = "buildres"; #$tool_dir . "\\buildres";
# Build a set of SDM_xx.SRC files, one
# for each possible byte value (00-ff).
# Also, build SDM.INC file, for combining
# the SRC files into a nested resource file
print STDERR "Creating the SDM_$hexLeadByte entries and resource linker include file\n";
build_SDM_files($PrimaryDBCSMapRef, $LeadByte, $defaultUnicodeChar);
# Combine the SDM_xx.SRC files into a
# nested resource file: SDMs_yy_PDM.bin,
# by running the RSCLINK.EXE program.
print STDERR "Combining SDM_$hexLeadByte entries into resource file\n";
(system "\"$rsclink\" -hSDM.inc -oSDMs_$hexLeadByte\.bin") == 0 ||
die "rsclink failed!\n";
# Convert the nested resource file into
# an SRC format: SDMs_yy.SRC,
# by running the BUILDRES.EXE program.
print STDERR "Converting SDM_$hexLeadByte resource file to nested resource\n";
(system "\"$buildres\" -z -rSDMs_$hexLeadByte\.bin") == 0 ||
die "buildres failed!\n";
print STDERR "Cleaning up after build_SDM\n";
system "del SDM_*.src";
system "del SDM.inc";
system "del SDMs_$hexLeadByte\.bin";
return 1;
}
1;
#;///////////////////////////////////////////////////////////////////////////////
#;///////////////////////////////////////////////////////////////////////////////
#;///////////////////////////////////////////////////////////////////////////////