VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap.py@ 21306

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

crOpenGL: tabs to spaces

  • 屬性 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
6import sys, string
7
8sys.path.append( "../glapi_parser" )
9import apiutil
10
11
12if len(sys.argv) != 2:
13 print >> sys.stderr, "Usage: %s <filename>" % sys.argv[0]
14 sys.exit(-1)
15
16file = open(sys.argv[1])
17
18print "/* THIS FILE IS AUTOGENERATED FROM %s BY pack_swap.py */\n\n" % sys.argv[1]
19
20for line in file.readlines():
21 line = line.rstrip()
22 if line.find( "crPackAlloc" ) != -1 or line.find( "crPackFree" ) != -1:
23 print line
24 continue
25 elif line.find( "crPack" ) != -1:
26 fun_index = line.find( "crPack" )
27 paren_index = line.find( "(", fun_index )
28 space_index = line.find( " ", fun_index )
29 quote_index = line.find( '"', fun_index )
30 if paren_index == -1:
31 paren_index = 1000000; # HACK HACK
32 if space_index == -1:
33 space_index = 1000000; # HACK HACK
34 if quote_index == -1:
35 quote_index = 1000000; # HACK HACK
36 the_index = min( min( paren_index, space_index ), quote_index )
37 print "%sSWAP%s" % (line[:the_index], line[the_index:])
38 elif line.find( "WRITE_DATA" ) != -1:
39 lparen_index = line.find( "(" )
40 rparen_index = line.rfind( ")" )
41 args = map( string.strip, line[lparen_index+1:rparen_index].split( "," ) )
42 indentation = line[:line.find( "WRITE_DATA" )]
43 if apiutil.sizeof(args[1]) == 1:
44 print "%sWRITE_DATA( %s, %s, %s );" % (indentation, args[0], args[1], args[2])
45 elif apiutil.sizeof(args[1]) == 2:
46 print "%sWRITE_DATA( %s, %s, SWAP16(%s) );" % (indentation, args[0], args[1], args[2])
47 elif args[1] == 'GLfloat' or args[1] == 'GLclampf':
48 print "%sWRITE_DATA( %s, GLuint, SWAPFLOAT(%s) );" % (indentation, args[0], args[2])
49 elif apiutil.sizeof(args[1]) == 4:
50 print "%sWRITE_DATA( %s, %s, SWAP32(%s) );" % (indentation, args[0], args[1], args[2])
51 else:
52 print >> sys.stderr, "UNKNOWN TYPE FOR WRITE_DATA: %s" % args[1]
53 sys.exit(-1)
54 elif line.find( "WRITE_DOUBLE" ) != -1:
55 print line.replace( "WRITE_DOUBLE", "WRITE_SWAPPED_DOUBLE" )
56 else:
57 print line
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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