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