First public contribution.
3 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
5 # This component and the accompanying materials are made available
6 # under the terms of "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".
10 # Initial Contributors:
11 # Nokia Corporation - initial contribution.
16 # Generates the bitgdi_stubs.h header file and the bitgdiswitchU.def
17 # file from the bitgdi2U def file.
22 my $COPYRIGHT = "Copyright (c) 2004-2009 Nokia Corporation. All rights reserved.";
24 my $BITGDI_DEF = "../BWINS/BITGDI2U.def";
25 my $BITGDISWITCH_HEADER = "bitgdi_stubs.h";
26 my $BITGDISWITCH_DEF = "../BWINS/bitgdiswitchu.def";
27 my $SOURCE_DEF_SIZE = 0;
35 open DEF, $BITGDI_DEF or
36 die "Cannot open $BITGDI_DEF\n";
38 my ($dev, $ino, $mode, $nlink, $uid, $gid,
39 $rdev, $size, $atime, $mtime, $ctime,
42 # the file size could be checked by the switcher build to verify that the stub is up to date.
43 $SOURCE_DEF_SIZE= $size;
45 open HEADER_OUT, ">${BITGDISWITCH_HEADER}" or
46 die "Cannot create $BITGDISWITCH_HEADER\n";
48 open DEF_OUT, ">${BITGDISWITCH_DEF}" or
49 die "Cannot create $BITGDISWITCH_DEF\n";
51 &printHeaderStart(\*HEADER_OUT);
52 &printDefStart(\*DEF_OUT);
58 &printDefEntry(\*DEF_OUT, $maxOrdinal, $_);
59 &printHeaderEntry(\*HEADER_OUT,$maxOrdinal,$_);
61 &printDefEntry(\*DEF_OUT, $maxOrdinal, "");
62 &printHeaderEntry(\*HEADER_OUT,$maxOrdinal, "(noname)");
67 &printHeaderEnd(\*HEADER_OUT,$maxOrdinal);
68 &printDefEnd(\*DEF_OUT);
75 sub printDefStart(\$) {
77 print $fh "EXPORTS\n";
80 sub printDefEntry(\$\$\$) {
81 my ($fh, $ordinal, $comment) = @_;
82 print $fh "\tcall_vector_${ordinal} @ ${ordinal} NONAME $comment\n";
90 sub printHeaderStart(\$) {
93 print $fh "// Generated from \"$BITGDI_DEF\" file size: $SOURCE_DEF_SIZE\n" .
97 "void common_dispatch();\n" .
101 sub printHeaderEntry(\$\$\$) {
102 my ($fh, $ordinal, $comment) = @_;
104 print $fh "__declspec(dllexport)\n" .
105 "__declspec(naked)\n" .
106 "void call_vector_${ordinal} ()\n" .
108 "\t// ${comment}\n" .
109 "\t_asm mov eax, $ordinal\n" .
110 "\t_asm jmp common_dispatch\n" .
114 sub printHeaderEnd(\$\$) {
115 my ($fh, $maxOrdinal) = @_;
117 "#define MAX_ORDINAL $maxOrdinal\n\n";