VirtualBox

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

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

crOpenGL: export to OSE

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

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