VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/windows_exports.py@ 63939

Last change on this file since 63939 was 63939, checked in by vboxsync, 8 years ago

Build/scripts (bugref:6627): Python build scripts updated to generate the same code when used with Python 2 and 3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6
7from __future__ import print_function
8import sys
9
10import apiutil
11
12
13def GenerateEntrypoints():
14
15 apiutil.CopyrightC()
16
17 print('#include "chromium.h"')
18 print('#include "stub.h"')
19 print('')
20 print('#define NAKED __declspec(naked)')
21 print('#define UNUSED(x) ((void)(x))')
22 print('')
23
24
25 # Get sorted list of dispatched functions.
26 # The order is very important - it must match cr_opcodes.h
27 # and spu_dispatch_table.h
28 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
29
30 for index in range(len(keys)):
31 func_name = keys[index]
32 if apiutil.Category(func_name) == "Chromium":
33 continue
34 if apiutil.Category(func_name) == "VBox":
35 continue
36
37 return_type = apiutil.ReturnType(func_name)
38 params = apiutil.Parameters(func_name)
39
40 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name,
41 apiutil.MakeDeclarationString( params )))
42 print("{")
43 print("\t__asm jmp [glim.%s]" % func_name)
44 for (name, type, vecSize) in params:
45 print("\tUNUSED( %s );" % name)
46 print("}")
47 print("")
48
49 print('/*')
50 print('* Aliases')
51 print('*/')
52
53 # Now loop over all the functions and take care of any aliases
54 allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
55 for func_name in allkeys:
56 if "omit" in apiutil.ChromiumProps(func_name):
57 continue
58
59 if func_name in keys:
60 # we already processed this function earlier
61 continue
62
63 # alias is the function we're aliasing
64 alias = apiutil.Alias(func_name)
65 if alias:
66 return_type = apiutil.ReturnType(func_name)
67 params = apiutil.Parameters(func_name)
68 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name,
69 apiutil.MakeDeclarationString( params )))
70 print("{")
71 print("\t__asm jmp [glim.%s]" % alias)
72 for (name, type, vecSize) in params:
73 print("\tUNUSED( %s );" % name)
74 print("}")
75 print("")
76
77
78 print('/*')
79 print('* No-op stubs')
80 print('*/')
81
82 # Now generate no-op stub functions
83 for func_name in allkeys:
84 if "stub" in apiutil.ChromiumProps(func_name):
85 return_type = apiutil.ReturnType(func_name)
86 params = apiutil.Parameters(func_name)
87 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params)))
88 print("{")
89 if return_type != "void":
90 print("return (%s) 0" % return_type)
91 print("}")
92 print("")
93
94
95
96
97GenerateEntrypoints()
98
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette