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 scdv_stubs.h header file and the scdvswitchu.def
17 # file from the scdvu def file.
22 my $COPYRIGHT = "Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).";
24 my $SCDV_DEF = "../bwins/scdvu.def";
25 my $SCDVSWITCH_HEADER = "scdv_stubs.h";
26 my $SCDVSWITCH_DEF = "../bwins/scdvswitchu.def";
27 my $SOURCE_DEF_SIZE = 0;
35 open DEF, $SCDV_DEF or
36 die "Cannot open $SCDV_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, ">${SCDVSWITCH_HEADER}" or
46 die "Cannot create $SCDVSWITCH_HEADER\n";
48 open DEF_OUT, ">${SCDVSWITCH_DEF}" or
49 die "Cannot create $SCDVSWITCH_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 \"$SCDV_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";