1 | #!/usr/local/bin/perl
|
---|
2 |
|
---|
3 | # This is used to generate stub entry points. We generate a file to
|
---|
4 | # be included in the declaraion and a file to be used for expanding macros
|
---|
5 | # to represent the implementation of the stubs.
|
---|
6 |
|
---|
7 | #
|
---|
8 | # if "$entry_count" is ever changed and the .inc files regenerated then
|
---|
9 | # the following issues need to be addressed:
|
---|
10 | #
|
---|
11 | # 1) Alpha NT has a .def file that lists exports by symbol. It will need
|
---|
12 | # updating.
|
---|
13 | # 2) The current Linux ARM code has a limitation of only having 256-3 stubs
|
---|
14 | #
|
---|
15 | # more dependencies???
|
---|
16 | #
|
---|
17 |
|
---|
18 | # 3 entries are already 'used' by the 3 methods of nsISupports.
|
---|
19 | # 3+247+5=255 This should get us in under the Linux ARM limitation
|
---|
20 | $entry_count = 247;
|
---|
21 | $sentinel_count = 5;
|
---|
22 |
|
---|
23 | $decl_name = "xptcstubsdecl.inc";
|
---|
24 | $def_name = "xptcstubsdef.inc";
|
---|
25 |
|
---|
26 | ##
|
---|
27 | ## Write the declarations include file
|
---|
28 | ##
|
---|
29 |
|
---|
30 | die "Can't open $decl_name" if !open(OUTFILE, ">$decl_name");
|
---|
31 |
|
---|
32 | print OUTFILE "/* generated file - DO NOT EDIT */\n\n";
|
---|
33 | print OUTFILE "/* includes ",$entry_count," stub entries, and ",
|
---|
34 | $sentinel_count," sentinel entries */\n\n";
|
---|
35 | print OUTFILE "/*\n";
|
---|
36 | print OUTFILE "* declarations of normal stubs...\n";
|
---|
37 | print OUTFILE "* 0 is QueryInterface\n";
|
---|
38 | print OUTFILE "* 1 is AddRef\n";
|
---|
39 | print OUTFILE "* 2 is Release\n";
|
---|
40 | print OUTFILE "*/\n";
|
---|
41 | print OUTFILE "#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))\n";
|
---|
42 | for($i = 0; $i < $entry_count; $i++) {
|
---|
43 | print OUTFILE "NS_IMETHOD Stub",$i+3,"();\n";
|
---|
44 | }
|
---|
45 | print OUTFILE "#else\n";
|
---|
46 | for($i = 0; $i < $entry_count; $i++) {
|
---|
47 | print OUTFILE "NS_IMETHOD Stub",$i+3,"(PRUint64,\n";
|
---|
48 | print OUTFILE " PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);\n";
|
---|
49 |
|
---|
50 | }
|
---|
51 | print OUTFILE "#endif\n";
|
---|
52 |
|
---|
53 | print OUTFILE "\n/* declarations of sentinel stubs */\n";
|
---|
54 |
|
---|
55 | for($i = 0; $i < $sentinel_count; $i++) {
|
---|
56 | print OUTFILE "NS_IMETHOD Sentinel",$i,"();\n";
|
---|
57 | }
|
---|
58 | close(OUTFILE);
|
---|
59 |
|
---|
60 |
|
---|
61 | ##
|
---|
62 | ## Write the definitions include file. This assumes a macro will be used to
|
---|
63 | ## expand the entries written...
|
---|
64 | ##
|
---|
65 |
|
---|
66 | die "Can't open $def_name" if !open(OUTFILE, ">$def_name");
|
---|
67 |
|
---|
68 | print OUTFILE "/* generated file - DO NOT EDIT */\n\n";
|
---|
69 | print OUTFILE "/* includes ",$entry_count," stub entries, and ",
|
---|
70 | $sentinel_count," sentinel entries */\n\n";
|
---|
71 |
|
---|
72 | for($i = 0; $i < $entry_count; $i++) {
|
---|
73 | print OUTFILE "STUB_ENTRY(",$i+3,")\n";
|
---|
74 | }
|
---|
75 |
|
---|
76 | for($i = 0; $i < $sentinel_count; $i++) {
|
---|
77 | print OUTFILE "SENTINEL_ENTRY(",$i,")\n";
|
---|
78 | }
|
---|