VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py@ 63939

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

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.0 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, re, string
8import apiutil
9
10
11line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s+(.*)\s*$')
12extensions_line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s(\S+)\s+(.*)\s*$')
13
14params = {}
15extended_params = {}
16
17input = open( sys.argv[2]+"/state_isenabled.txt", 'r' )
18for line in input.readlines():
19 match = line_re.match( line )
20 if match:
21 type = match.group(1)
22 pname = match.group(2)
23 fields = match.group(3).split()
24 params[pname] = ( type, fields )
25
26input = open( sys.argv[2]+"/state_extensions_isenabled.txt", 'r' )
27for line in input.readlines():
28 match = extensions_line_re.match( line )
29 if match:
30 type = match.group(1)
31 pname = match.group(2)
32 ifdef = match.group(3)
33 fields = match.group(4).split()
34 extended_params[pname] = ( type, ifdef, fields )
35
36apiutil.CopyrightC()
37
38print("""
39/* DO NOT EDIT - THIS FILE GENERATED BY THE state_isenabled.py SCRIPT */
40#include <stdio.h>
41#include <math.h>
42
43#include "state.h"
44#include "state/cr_statetypes.h"
45
46GLboolean STATE_APIENTRY crStateIsEnabled( GLenum pname )
47{
48 CRContext *g = GetCurrentContext();
49
50 if (g->current.inBeginEnd)
51 {
52 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glGet called in Begin/End");
53 return 0;
54 }
55
56 switch ( pname ) {
57""")
58
59for pname in sorted(params.keys()):
60 print("\tcase %s:" % pname)
61 print("\t\treturn %s;" % params[pname][1][0])
62
63for pname in sorted(extended_params.keys()):
64 (srctype,ifdef,fields) = extended_params[pname]
65 ext = ifdef[3:] # the extension name with the "GL_" prefix removed
66 ext = ifdef
67 print('#ifdef CR_%s' % ext)
68 print("\tcase %s:" % pname)
69 print("\t\treturn %s;" % extended_params[pname][2][0])
70 print('#endif /* CR_%s */' % ext)
71print("\tdefault:")
72print("\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);")
73print("\t\treturn 0;")
74print("\t}")
75print("}")
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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