www.pudn.com > sdk_host_2520.rar > build_sdm_files.pl


#;/////////////////////////////////////////////////////////////////////////////// 
#; Copyright(C) SigmaTel, Inc. 2000-2001 
#; 
#; Filename: build_SDM_files.pl 
#; Description: Generate all of the intermediate files needed to make the specified  
#               Secondary DBCS Map resource.   
# 
# 
#     
# 
#;/////////////////////////////////////////////////////////////////////////////// 
 
use strict; 
use vars qw($tool_dir); 
 
require "PDM_SDM.pl"; 
 
 
 
 
#;/////////////////////////////////////////////////////////////////////////////// 
#;> Name: build_SDM_files 
#; 
#;  Type: Function 
#;  Description:    Generate all of the intermediate files needed to make the specified  
#                   Secondary DBCS Map resource. 
#   Prototype:      build_SDM_files($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:        SDM_xx.inc 
#                   SDM_yy.src, for yy=00 to FF, hex 
#;  Notes: 
#               The Secondary DBCS Map resource covers a single DBCS Lead Byte.  It  
#               contains one entry for each of the 256 possible Trailing Byte codes. 
# 
#               To create the SDM, you need to create 256 SRC files - one for each  
#               Trailing Byte value (SDM_xx.SRC), plus a Resource Linker control file  
#               (SDM_xx.INC) for assembling the them into a single resource. 
#;< 
#;/////////////////////////////////////////////////////////////////////////////// 
sub build_SDM_files { 
 
    my $PrimaryDBCSMapRef = shift; 
    my $LeadByte = shift; 
    my $defaultUnicodeChar = shift; 
 
 
    open INC_FILE, ">SDM.inc" || die "Can't open file: SDM.inc\n"; 
 
    my $count = 0; 
    for (my $TrailingByte=0; $TrailingByte<=0xff; $TrailingByte++) { 
         
                                              # Add a line to the INC file for this entry 
        printf INC_FILE "SDM_%02x\tequ\t%d\t;\$FILENAME SDM_%02x.src\n", 
            $TrailingByte, 1 + $count++, $TrailingByte; 
 
                                              # Create the SRC file for this entry 
        if (defined $$PrimaryDBCSMapRef{$LeadByte}->{$TrailingByte}) { 
                                              # Either the specified Unicode character, OR 
            generate_PDM_SDM_SBC_src("SDM", $TrailingByte,  
                                     $$PrimaryDBCSMapRef{$LeadByte}->{$TrailingByte}); 
        } 
        else {                                # the default Unicode character 
            generate_PDM_SDM_SBC_src("SDM", $TrailingByte, $defaultUnicodeChar); 
        } 
    } 
 
    close INC_FILE; 
    close LIST_FILE; 
} 
 
 
1; 
 
#;/////////////////////////////////////////////////////////////////////////////// 
#;/////////////////////////////////////////////////////////////////////////////// 
#;///////////////////////////////////////////////////////////////////////////////