<commit_before># Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.

import sys

sys.path.append( "../../glapi_parser" )
import apiutil


keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt")


apiutil.CopyrightC()

print """
/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY pack.py SCRIPT */
#include <stdio.h>
#include "cr_string.h"
#include "cr_spu.h"
#include "replicatespu.h"
#include "cr_packfunctions.h"
#include "replicatespu_proto.h"
"""

num_funcs = len(keys)
print 'SPUNamedFunctionTable _cr_replicate_table[%d];' % (num_funcs+1)

print """
static void __fillin( int offset, char *name, SPUGenericFunction func )
{
	_cr_replicate_table[offset].name = crStrdup( name );
	_cr_replicate_table[offset].fn = func;
}"""

pack_specials = []

for func_name in keys:
	return_type = apiutil.ReturnType(func_name)
	if (return_type != 'void' or 
	    apiutil.FindSpecial( "replicatespu", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_state", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_get", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_flush", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_vertex", func_name )):
	  pack_specials.append( func_name )

for func_name in keys:
	if func_name in pack_specials:
		return_type = apiutil.ReturnType(func_name)
		params = apiutil.Parameters(func_name)
		print 'extern %s REPLICATESPU_APIENTRY replicatespu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) )

print '\nvoid replicatespuCreateFunctions( void )'
print '{'
print '\tint i = 0;'
for index in range(len(keys)):
	func_name = keys[index]
	if apiutil.FindSpecial( "replicatespu_unimplemented", func_name ):
		continue
	if func_name in pack_specials:
		print '\t__fillin( i++, "%s", (SPUGenericFunction) replicatespu_%s );' % (func_name, func_name )
	else:
		print '\t__fillin( i++, "%s", (SPUGenericFunction) (replicate_spu.swap ? crPack%sSWAP : crPack%s) );' % (func_name, func_name, func_name )
print '\t__fillin( i++, NULL, NULL );'
print '\tCRASSERT(i < %d);' % num_funcs
print '}'<commit_msg>we were missing thre writeback special functions<commit_after># Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.

import sys

sys.path.append( "../../glapi_parser" )
import apiutil


keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt")


apiutil.CopyrightC()

print """
/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY replicate.py SCRIPT */
#include <stdio.h>
#include "cr_string.h"
#include "cr_spu.h"
#include "replicatespu.h"
#include "cr_packfunctions.h"
#include "replicatespu_proto.h"
"""

num_funcs = len(keys)
print 'SPUNamedFunctionTable _cr_replicate_table[%d];' % (num_funcs+1)

print """
static void __fillin( int offset, char *name, SPUGenericFunction func )
{
	_cr_replicate_table[offset].name = crStrdup( name );
	_cr_replicate_table[offset].fn = func;
}"""

pack_specials = []

for func_name in keys:
	return_type = apiutil.ReturnType(func_name)
	if (return_type != 'void' or 
	    apiutil.FindSpecial( "replicatespu", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_state", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_get", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_flush", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_writeback", func_name ) or 
	    apiutil.FindSpecial( "replicatespu_vertex", func_name )):
	  pack_specials.append( func_name )

for func_name in keys:
	if func_name in pack_specials:
		return_type = apiutil.ReturnType(func_name)
		params = apiutil.Parameters(func_name)
		print 'extern %s REPLICATESPU_APIENTRY replicatespu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) )

print '\nvoid replicatespuCreateFunctions( void )'
print '{'
print '\tint i = 0;'
for index in range(len(keys)):
	func_name = keys[index]
	if apiutil.FindSpecial( "replicatespu_unimplemented", func_name ):
		continue
	if func_name in pack_specials:
		print '\t__fillin( i++, "%s", (SPUGenericFunction) replicatespu_%s );' % (func_name, func_name )
	else:
		print '\t__fillin( i++, "%s", (SPUGenericFunction) (replicate_spu.swap ? crPack%sSWAP : crPack%s) );' % (func_name, func_name, func_name )
print '\t__fillin( i++, NULL, NULL );'
print '\tCRASSERT(i < %d);' % num_funcs
print '}'
{'fraction_non_alphanumeric': 0.13076578593819974, 'fraction_numerical': 0.0026869682042095834, 'mean_word_length': 5.247552447552447, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5777761', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1576, 'n_words': 368}