~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/GuestHost/OpenGL/packer/pack_swap.py

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
 
12
12
if len(sys.argv) != 2:
13
 
        print >> sys.stderr, "Usage: %s <filename>" % sys.argv[0]
14
 
        sys.exit(-1)
 
13
    print >> sys.stderr, "Usage: %s <filename>" % sys.argv[0]
 
14
    sys.exit(-1)
15
15
 
16
16
file = open(sys.argv[1])
17
17
 
18
18
print "/* THIS FILE IS AUTOGENERATED FROM %s BY pack_swap.py */\n\n" % sys.argv[1]
19
19
 
20
20
for 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
 
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_AI") != -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_AI" )]
 
43
        if apiutil.sizeof(args[0]) == 1:
 
44
            print "%sWRITE_DATA_AI(%s, %s);" % (indentation, args[0], args[1])
 
45
        elif apiutil.sizeof(args[0]) == 2:
 
46
            print "%sWRITE_DATA_AI(%s, SWAP16(%s) );" % (indentation, args[0], args[1])
 
47
        elif args[0] == 'GLfloat' or args[0] == 'GLclampf':
 
48
            print "%sWRITE_DATA_AI(GLuint, SWAPFLOAT(%s) );" % (indentation, args[0])
 
49
        elif apiutil.sizeof(args[0]) == 4:
 
50
            print "%sWRITE_DATA_AI(%s, SWAP32(%s) );" % (indentation, args[0], args[1])
 
51
        else:
 
52
            print >> sys.stderr, "UNKNOWN TYPE FOR WRITE_DATA: %s" % args[1]
 
53
            sys.exit(-1)
 
54
    elif line.find( "WRITE_DATA" ) != -1:
 
55
        lparen_index = line.find( "(" )
 
56
        rparen_index = line.rfind( ")" )
 
57
        args = map( string.strip, line[lparen_index+1:rparen_index].split( "," ) )
 
58
        indentation = line[:line.find( "WRITE_DATA" )]
 
59
        if apiutil.sizeof(args[1]) == 1:
 
60
            print "%sWRITE_DATA( %s, %s, %s );" % (indentation, args[0], args[1], args[2])
 
61
        elif apiutil.sizeof(args[1]) == 2:
 
62
            print "%sWRITE_DATA( %s, %s, SWAP16(%s) );" % (indentation, args[0], args[1], args[2])
 
63
        elif args[1] == 'GLfloat' or args[1] == 'GLclampf':
 
64
            print "%sWRITE_DATA( %s, GLuint, SWAPFLOAT(%s) );" % (indentation, args[0], args[2])
 
65
        elif apiutil.sizeof(args[1]) == 4:
 
66
            print "%sWRITE_DATA( %s, %s, SWAP32(%s) );" % (indentation, args[0], args[1], args[2])
 
67
        else:
 
68
            print >> sys.stderr, "UNKNOWN TYPE FOR WRITE_DATA: %s" % args[1]
 
69
            sys.exit(-1)
 
70
    elif line.find( "WRITE_DOUBLE" ) != -1:
 
71
        print line.replace( "WRITE_DOUBLE", "WRITE_SWAPPED_DOUBLE" )
 
72
    else:
 
73
        print line