VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py@ 26753

Last change on this file since 26753 was 20147, checked in by vboxsync, 16 years ago

crOpenGL: some opengl 2.0 parts

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 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
6import sys, string, re
7
8import apiutil
9
10
11
12apiutil.CopyrightC()
13
14print """
15/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch.py SCRIPT */
16#include "cr_spu.h"
17#include "chromium.h"
18#include "cr_error.h"
19#include "server_dispatch.h"
20#include "server.h"
21#include "cr_unpack.h"
22
23CRCurrentStatePointers crServerCurrent;
24"""
25
26
27for func_name in apiutil.AllSpecials( sys.argv[1]+"/../state_tracker/state" ):
28 params = apiutil.Parameters(func_name)
29 if (apiutil.FindSpecial( "server", func_name ) or
30 "get" in apiutil.Properties(func_name)):
31 continue
32
33 wrap = apiutil.GetCategoryWrapper(func_name)
34 if wrap:
35 print '#if defined(CR_%s)' % wrap
36 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString( params ) )
37 print '{'
38 print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString( params ) )
39 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString( params ) )
40 print '}'
41 if wrap:
42 print '#endif'
43
44
45keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
46for func_name in keys:
47 current = 0
48 array = ""
49 m = re.search( r"^(Color|Normal)([1234])(ub|b|us|s|ui|i|f|d)$", func_name )
50 if m :
51 current = 1
52 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
53 type = m.group(3) + m.group(2)
54 m = re.search( r"^(SecondaryColor)(3)(ub|b|us|s|ui|i|f|d)(EXT)$", func_name )
55 if m :
56 current = 1
57 name = string.lower(m.group(1)[:1] ) + m.group(1)[1:]
58 type = m.group(3) + m.group(2)
59 m = re.search( r"^(TexCoord)([1234])(ub|b|us|s|ui|i|f|d)$", func_name )
60 if m :
61 current = 1
62 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
63 type = m.group(3) + m.group(2)
64 array = "[0]"
65 m = re.search( r"^(MultiTexCoord)([1234])(ub|b|us|s|ui|i|f|d)ARB$", func_name )
66 if m :
67 current = 1
68 name = "texCoord"
69 type = m.group(3) + m.group(2)
70 array = "[texture-GL_TEXTURE0_ARB]"
71 m = re.match( r"^(Index)(ub|b|us|s|ui|i|f|d)$", func_name )
72 if m :
73 current = 1
74 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
75 type = m.group(2) + "1"
76 m = re.match( r"^(EdgeFlag)$", func_name )
77 if m :
78 current = 1
79 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
80 type = "l1"
81 m = re.match( r"^(FogCoord)(f|d)(EXT)$", func_name)
82 if m :
83 current = 1
84 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
85 type = m.group(2) + "1"
86
87 # Vertex attribute commands w/ some special cases
88 m = re.search( r"^(VertexAttrib)([1234])(s|i|f|d)ARB$", func_name )
89 if m :
90 current = 1
91 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
92 type = m.group(3) + m.group(2)
93 array = "[index]"
94 if func_name == "VertexAttrib4NubARB":
95 current = 1
96 name = "vertexAttrib"
97 type = "ub4"
98 array = "[index]"
99
100 if current:
101 params = apiutil.Parameters(func_name)
102 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) )
103 print '{'
104 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) )
105 print "\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array)
106 print '}\n'
107
108print """
109void crServerInitDispatch(void)
110{
111 crSPUInitDispatchTable( &(cr_server.dispatch) );
112 crSPUCopyDispatchTable( &(cr_server.dispatch), &(cr_server.head_spu->dispatch_table ) );
113"""
114
115for func_name in keys:
116 if ("get" in apiutil.Properties(func_name) or
117 apiutil.FindSpecial( "server", func_name ) or
118 apiutil.FindSpecial( sys.argv[1]+"/../state_tracker/state", func_name )):
119
120 wrap = apiutil.GetCategoryWrapper(func_name)
121 if wrap:
122 print '#if defined(CR_%s)' % wrap
123
124 print '\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name)
125 if wrap:
126 print '#endif'
127
128print '}'
129
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