VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py@ 66474

最後變更 在這個檔案從66474是 63942,由 vboxsync 提交於 8 年 前

OpenGL: fixed the most annoying coding style flaws, mainly removing spaces after '(' and before ')', no semantic change

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 1.9 KB
 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6from __future__ import print_function
7import sys
8import apiutil
9
10
11apiutil.CopyrightC()
12
13print("""
14
15/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spuchange.py SCRIPT */
16
17#include "cr_spu.h"
18#include "cr_error.h"
19
20void crSPUChangeInterface(SPUDispatchTable *table, void *orig_func, void *new_func)
21{
22 struct _copy_list_node *temp;
23 if (table->mark == 1)
24 {
25 return;
26 }
27 if (orig_func == new_func)
28 {
29 return;
30 }
31 table->mark = 1;
32""")
33
34keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
35for func_name in keys:
36 print('\tif ((uintptr_t)table->%s == (uintptr_t)orig_func)' % func_name)
37 print('\t{')
38 print('\t\ttable->%s = (%sFunc_t)(uintptr_t)new_func;' % (func_name, func_name))
39 print('\t\tfor (temp = table->copyList ; temp ; temp = temp->next)')
40 print('\t\t{')
41 print('\t\t\tcrSPUChangeInterface(temp->copy, orig_func, new_func);')
42 print('\t\t}')
43 print('\t}')
44
45print("""
46 if (table->copy_of != NULL)
47 {
48 crSPUChangeInterface(table->copy_of, orig_func, new_func);
49 }
50 for (temp = table->copyList; temp; temp = temp->next)
51 {
52 crSPUChangeInterface(temp->copy, orig_func, new_func);
53 }
54 table->mark = 0;
55""")
56print('}')
57
58print("""
59void crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable)
60{
61 SPUGenericFunction func;
62""")
63keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
64for func_name in keys:
65 print('\tfunc = crSPUFindFunction(newtable, "%s");' % func_name)
66 print('\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name)
67 print('\t{')
68 print('\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % (func_name, func_name))
69 print('\t\tcrSPUChangeInterface(dispatch, (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % func_name)
70 print('\t}\n')
71print("""
72}
73""")
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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