1 | """
|
---|
2 | Copyright (C) 2024 Oracle and/or its affiliates.
|
---|
3 |
|
---|
4 | This file is part of VirtualBox base platform packages, as
|
---|
5 | available from https://www.virtualbox.org.
|
---|
6 |
|
---|
7 | This program is free software; you can redistribute it and/or
|
---|
8 | modify it under the terms of the GNU General Public License
|
---|
9 | as published by the Free Software Foundation, in version 3 of the
|
---|
10 | License.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful, but
|
---|
13 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
19 |
|
---|
20 | SPDX-License-Identifier: GPL-3.0-only
|
---|
21 | """
|
---|
22 |
|
---|
23 | import sys
|
---|
24 |
|
---|
25 | #
|
---|
26 | # Strip @d from function names:
|
---|
27 | # glAccum@8 @7
|
---|
28 | # DrvCopyContext@12
|
---|
29 | #
|
---|
30 | def GenerateDef():
|
---|
31 |
|
---|
32 | # Read lines from input file
|
---|
33 | in_file = open(sys.argv[1], "r")
|
---|
34 | if not in_file:
|
---|
35 | print("Error: couldn't open %s file!" % sys.argv[1])
|
---|
36 | sys.exit()
|
---|
37 |
|
---|
38 | lines = in_file.readlines()
|
---|
39 |
|
---|
40 | in_file.close()
|
---|
41 |
|
---|
42 | # Write def file
|
---|
43 | out_file = open(sys.argv[2], "w")
|
---|
44 | if not out_file:
|
---|
45 | print("Error: couldn't open %s file!" % sys.argv[2])
|
---|
46 | sys.exit()
|
---|
47 |
|
---|
48 | out_file.write('EXPORTS\n')
|
---|
49 |
|
---|
50 | for line in lines:
|
---|
51 | line = line.strip()
|
---|
52 | if len(line) == 0:
|
---|
53 | continue
|
---|
54 |
|
---|
55 | line_parts = line.split()
|
---|
56 | if len(line_parts) == 0:
|
---|
57 | continue
|
---|
58 |
|
---|
59 | name_parts = line_parts[0].split('@')
|
---|
60 | if len(name_parts) != 2:
|
---|
61 | continue
|
---|
62 |
|
---|
63 | out_line = name_parts[0]
|
---|
64 | if len(line_parts) > 1:
|
---|
65 | numSpaces = 30 - len(name_parts[0])
|
---|
66 | out_line = out_line + ' '*numSpaces + line_parts[1]
|
---|
67 |
|
---|
68 | out_file.write('\t' + out_line + '\n')
|
---|
69 |
|
---|
70 | out_file.close()
|
---|
71 |
|
---|
72 | GenerateDef()
|
---|