unpack.py revision e0e0c19eefceaf5d4ec40f9466b58a771f50e799
9ad572a3ac0fd3845a9abecfbf41e8db9b3a5cf0vboxsync# Copyright (c) 2001, Stanford University
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# All rights reserved.
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# See the file LICENSE.txt for information on redistributing this software.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncimport sys
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncimport apiutil
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncapiutil.CopyrightC()
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint """/* DO NOT EDIT! THIS CODE IS AUTOGENERATED BY unpack.py */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "unpacker.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "cr_opcodes.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "cr_error.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "cr_mem.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "cr_spu.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "unpack_extend.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <stdio.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <memory.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/cdefs.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncDECLEXPORT(const unsigned char *) cr_unpackData = NULL;
70bb61ea2f96e80150e807529ce5df435607706bvboxsyncSPUDispatchTable cr_unpackDispatch;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
07bf154df97af02974bb89d4f1ad36afa2b45443vboxsyncstatic void crUnpackExtend(void);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync"""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# Useful functions
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncdef ReadData( offset, arg_type ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync """Emit a READ_DOUBLE or READ_DATA call for pulling a GL function
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync argument out of the buffer's operand area."""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if arg_type == "GLdouble" or arg_type == "GLclampd":
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync retval = "READ_DOUBLE( %d )" % offset
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync retval = "READ_DATA( %d, %s )" % (offset, arg_type)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return retval
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncdef FindReturnPointer( return_type, params ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync """For GL functions that return values (either as the return value or
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync through a pointer parameter) emit a SET_RETURN_PTR call."""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync arg_len = apiutil.PacketLength( params )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (return_type != 'void'):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\tSET_RETURN_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync paramList = [ ('foo', 'void *', 0) ]
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\tSET_RETURN_PTR( %d );' % (arg_len + 8 - apiutil.PacketLength(paramList))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncdef FindWritebackPointer( return_type, params ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync """Emit a SET_WRITEBACK_PTR call."""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync arg_len = apiutil.PacketLength( params )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if return_type != 'void':
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync paramList = [ ('foo', 'void *', 0) ]
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync arg_len += apiutil.PacketLength( paramList )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\tSET_WRITEBACK_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncdef MakeNormalCall( return_type, func_name, params, counter_init = 0 ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync counter = counter_init
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync copy_of_params = params[:]
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for i in range( 0, len(params) ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync (name, type, vecSize) = params[i]
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if apiutil.IsPointer(copy_of_params[i][1]):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync params[i] = ('NULL', type, vecSize)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync copy_of_params[i] = (copy_of_params[i][0], 'void', 0)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if not "get" in apiutil.Properties(func_name):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\tcrError( "%s needs to be special cased!" );' % func_name
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync print "\t%s %s = %s;" % ( copy_of_params[i][1], name, ReadData( counter, copy_of_params[i][1] ) )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync counter += apiutil.sizeof(copy_of_params[i][1])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if ("get" in apiutil.Properties(func_name)):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync FindReturnPointer( return_type, params )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync FindWritebackPointer( return_type, params )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if return_type != "void":
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\t(void)",
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\t",
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "cr_unpackDispatch.%s( %s );" % (func_name, apiutil.MakeCallString(params))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncdef MakeVectorCall( return_type, func_name, arg_type ):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync """Convert a call like glVertex3f to glVertex3fv."""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vec_func = apiutil.VectorFunction(func_name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync params = apiutil.Parameters(vec_func)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync assert len(params) == 1
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync (arg_name, vecType, vecSize) = params[0]
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if arg_type == "GLdouble" or arg_type == "GLclampd":
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync print "#ifdef CR_UNALIGNED_ACCESS_OKAY"
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync print "\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "#else"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for index in range(0, vecSize):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\tGLdouble v" + `index` + " = READ_DOUBLE(", `index * 8`, ");"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if return_type != "void":
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\t(void) cr_unpackDispatch.%s(" % func_name,
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\tcr_unpackDispatch.%s(" % func_name,
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for index in range(0, vecSize):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "v" + `index`,
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if index != vecSize - 1:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print ",",
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print ");"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "#endif"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsynckeys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# Generate unpack functions for all the simple functions.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncfor func_name in keys:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (not "pack" in apiutil.ChromiumProps(func_name) or
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync apiutil.FindSpecial( "unpacker", func_name )):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync continue
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync params = apiutil.Parameters(func_name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return_type = apiutil.ReturnType(func_name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "static void crUnpack%s(void)" % func_name
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "{"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vector_func = apiutil.VectorFunction(func_name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vector_func and len(apiutil.Parameters(vector_func)) == 1):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync MakeVectorCall( return_type, func_name, params[0][1] )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync MakeNormalCall( return_type, func_name, params )
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync packet_length = apiutil.PacketLength( params )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if packet_length == 0:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\tINCR_DATA_PTR_NO_ARGS( );"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "\tINCR_DATA_PTR( %d );" % packet_length
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print "}\n"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# Emit some code
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint """
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsynctypedef struct __dispatchNode {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync const unsigned char *unpackData;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync struct __dispatchNode *next;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync} DispatchNode;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncstatic DispatchNode *unpackStack = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncstatic SPUDispatchTable *cr_lastDispatch = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncvoid crUnpackPush(void)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync DispatchNode *node = (DispatchNode*)crAlloc( sizeof( *node ) );
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync node->next = unpackStack;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unpackStack = node;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync node->unpackData = cr_unpackData;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync}
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncvoid crUnpackPop(void)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync DispatchNode *node = unpackStack;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!node)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync crError( "crUnpackPop called with an empty stack!" );
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unpackStack = node->next;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync cr_unpackData = node->unpackData;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync crFree( node );
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync}
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncvoid crUnpack( const void *data, const void *opcodes,
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned int num_opcodes, SPUDispatchTable *table )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned int i;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync const unsigned char *unpack_opcodes;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (table != cr_lastDispatch)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync crSPUCopyDispatchTable( &cr_unpackDispatch, table );
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync cr_lastDispatch = table;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unpack_opcodes = (const unsigned char *)opcodes;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync cr_unpackData = (const unsigned char *)data;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync for (i = 0 ; i < num_opcodes ; i++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /*crDebug(\"Unpacking opcode \%d\", *unpack_opcodes);*/
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync switch( *unpack_opcodes )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {"""
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync# Emit switch cases for all unextended opcodes
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncfor func_name in keys:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if "pack" in apiutil.ChromiumProps(func_name):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\t\t\tcase %s:' % apiutil.OpcodeName( func_name )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# print '\t\t\t\tcrDebug("Unpack: %s");' % apiutil.OpcodeName( func_name )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsyncprint """
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync case CR_EXTEND_OPCODE: crUnpackExtend(); break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync default:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync crError( "Unknown opcode: %d", *unpack_opcodes );
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unpack_opcodes--;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync}"""
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync#
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync# Emit unpack functions for extended opcodes, non-special functions only.
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync#
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsyncfor func_name in keys:
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync if ("extpack" in apiutil.ChromiumProps(func_name)
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync and not apiutil.FindSpecial("unpacker", func_name)):
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return_type = apiutil.ReturnType(func_name)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync params = apiutil.Parameters(func_name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print 'static void crUnpackExtend%s(void)' % func_name
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '{'
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync MakeNormalCall( return_type, func_name, params, 8 )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '}\n'
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint 'static void crUnpackExtend(void)'
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsyncprint '{'
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsyncprint '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint ''
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint '\tswitch( extend_opcode )'
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint '\t{'
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync#
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync# Emit switch statement for extended opcodes
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncfor func_name in keys:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if "extpack" in apiutil.ChromiumProps(func_name):
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# print '\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync print '\t\t\tcrUnpackExtend%s( );' % func_name
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync print '\t\t\tbreak;'
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncprint """ default:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync crError( "Unknown extended opcode: %d", (int) extend_opcode );
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync INCR_VAR_PTR();
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync}"""
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync