VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/opcodes.py@ 41027

最後變更 在這個檔案從41027是 15532,由 vboxsync 提交於 16 年 前

crOpenGL: export to OSE

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.2 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
6# This script generates include/cr_opcodes.h from the gl_header.parsed file.
7
8import sys;
9import cPickle;
10import string;
11import re;
12
13import apiutil
14
15apiutil.CopyrightC()
16
17print ""
18print "/* DO NOT EDIT - THIS FILE GENERATED BY THE opcodes.py SCRIPT */"
19print ""
20print "#ifndef CR_OPCODES_H"
21print "#define CR_OPCODES_H"
22print ""
23
24keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
25assert len(keys) > 0
26
27print "/* Functions with no return value and input-only parameters */"
28print "typedef enum {"
29
30enum_index = 0
31for func in keys:
32 if "pack" in apiutil.ChromiumProps(func):
33 print "\t%s = %d," % ( apiutil.OpcodeName(func), enum_index )
34 enum_index = enum_index + 1
35
36if enum_index > 255:
37 # This would have saved Mike some grief if it had been here earlier.
38 print >> sys.stderr, "You have more than 255 opcodes! You've been adding functions to"
39 print >> sys.stderr, "glapi_parser/APIspec! Each new function you add"
40 print >> sys.stderr, "gets an opcode assigned to it. Fortunately for you, we have"
41 print >> sys.stderr, "an ``extend'' opcode. Please mark the function as"
42 print >> sys.stderr, "'extpack' in APIspec so as to keep the main opcode pool"
43 print >> sys.stderr, "less than 255! THIS IS A CATASTROPHIC FAILURE, and I WILL NOT CONTINUE!"
44 print >> sys.stderr, "I'm putting an error in the generated header file so you won't miss"
45 print >> sys.stderr, "this even if you're doing a 'make -k.'"
46 print "#error -- more than 255 opcodes!"
47 sys.exit(-1)
48print "\tCR_EXTEND_OPCODE=%d" % enum_index
49print "} CROpcode;\n"
50
51# count up number of extended opcode commands
52num_extends = 0
53for func in keys:
54 if "extpack" in apiutil.ChromiumProps(func):
55 num_extends += 1
56
57print "/* Functions with a return value or output parameters */"
58print "typedef enum {"
59
60enum_index = 0
61for func in keys:
62 if "extpack" in apiutil.ChromiumProps(func):
63 opcodeName = apiutil.ExtendedOpcodeName(func)
64 if enum_index != num_extends-1:
65 print "\t%s = %d," % (opcodeName, enum_index )
66 else:
67 print "\t%s = %d" % (opcodeName, enum_index )
68 enum_index = enum_index + 1
69print "} CRExtendOpcode;\n"
70print "#endif /* CR_OPCODES_H */"
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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