1 | # Copyright (c) 2001, Stanford University
|
---|
2 | # All rights reserved.
|
---|
3 | #
|
---|
4 | # See the file LICENSE.txt for information on redistributing this software.
|
---|
5 |
|
---|
6 | import sys
|
---|
7 |
|
---|
8 | import apiutil
|
---|
9 |
|
---|
10 |
|
---|
11 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
12 |
|
---|
13 |
|
---|
14 | apiutil.CopyrightC()
|
---|
15 |
|
---|
16 | print """
|
---|
17 | /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY pack.py SCRIPT */
|
---|
18 | #include <stdio.h>
|
---|
19 | #include "cr_string.h"
|
---|
20 | #include "cr_spu.h"
|
---|
21 | #include "packspu.h"
|
---|
22 | #include "cr_packfunctions.h"
|
---|
23 | #include "packspu_proto.h"
|
---|
24 | """
|
---|
25 |
|
---|
26 | num_funcs = len(keys) - len(apiutil.AllSpecials('packspu_unimplemented'))
|
---|
27 | print 'SPUNamedFunctionTable _cr_pack_table[%d];' % (num_funcs+1)
|
---|
28 |
|
---|
29 | print """
|
---|
30 | static void __fillin( int offset, char *name, SPUGenericFunction func )
|
---|
31 | {
|
---|
32 | _cr_pack_table[offset].name = crStrdup( name );
|
---|
33 | _cr_pack_table[offset].fn = func;
|
---|
34 | }"""
|
---|
35 |
|
---|
36 | pack_specials = []
|
---|
37 |
|
---|
38 | for func_name in keys:
|
---|
39 | if ("get" in apiutil.Properties(func_name) or
|
---|
40 | apiutil.FindSpecial( "packspu", func_name ) or
|
---|
41 | apiutil.FindSpecial( "packspu_flush", func_name ) or
|
---|
42 | apiutil.FindSpecial( "packspu_vertex", func_name )):
|
---|
43 | pack_specials.append( func_name )
|
---|
44 |
|
---|
45 | print '\nvoid packspuCreateFunctions( void )'
|
---|
46 | print '{'
|
---|
47 | for index in range(len(keys)):
|
---|
48 | func_name = keys[index]
|
---|
49 | if apiutil.FindSpecial( "packspu_unimplemented", func_name ):
|
---|
50 | continue
|
---|
51 | if func_name in pack_specials:
|
---|
52 | print '\t__fillin( %3d, "%s", (SPUGenericFunction) packspu_%s );' % (index, func_name, func_name )
|
---|
53 | else:
|
---|
54 | print '\t__fillin( %3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s) );' % (index, func_name, func_name, func_name )
|
---|
55 | print '\t__fillin( %3d, NULL, NULL );' % num_funcs
|
---|
56 | print '}'
|
---|