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 | # This script generates the spu_dispatch_table.h file from gl_header.parsed
|
---|
7 |
|
---|
8 | import sys, string
|
---|
9 |
|
---|
10 | import apiutil
|
---|
11 |
|
---|
12 |
|
---|
13 | apiutil.CopyrightC()
|
---|
14 |
|
---|
15 | print """
|
---|
16 | /* DO NOT EDIT - THIS FILE GENERATED BY THE dispatchheader.py SCRIPT */
|
---|
17 |
|
---|
18 | #ifndef CR_SPU_DISPATCH_TABLE_H
|
---|
19 | #define CR_SPU_DISPATCH_TABLE_H
|
---|
20 |
|
---|
21 | #ifdef WINDOWS
|
---|
22 | #define SPU_APIENTRY __stdcall
|
---|
23 | #else
|
---|
24 | #define SPU_APIENTRY
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #include "chromium.h"
|
---|
28 | #include "state/cr_statetypes.h"
|
---|
29 | """
|
---|
30 |
|
---|
31 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
32 |
|
---|
33 |
|
---|
34 | print '/* Offsets of each function within the dispatch table */'
|
---|
35 | offset = 0
|
---|
36 | for func_name in keys:
|
---|
37 | print '#define DISPATCH_OFFSET_%s %d' % (func_name, offset)
|
---|
38 | offset += 1
|
---|
39 | print ''
|
---|
40 |
|
---|
41 | print '/* Function typedefs */'
|
---|
42 | for func_name in keys:
|
---|
43 | return_type = apiutil.ReturnType(func_name)
|
---|
44 | params = apiutil.Parameters(func_name)
|
---|
45 |
|
---|
46 | print 'typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params))
|
---|
47 | print ''
|
---|
48 |
|
---|
49 | print 'struct _copy_list_node;'
|
---|
50 | print ''
|
---|
51 | print '/* Prototype for SPU internal state load/unload callbacks. */'
|
---|
52 | print ''
|
---|
53 | print 'typedef int (*SPUStateFunc_t)(void *);'
|
---|
54 | print ''
|
---|
55 | print '/* The SPU dispatch table */'
|
---|
56 | print 'typedef struct _spu_dispatch_table {'
|
---|
57 |
|
---|
58 | for func_name in keys:
|
---|
59 | print "\t%sFunc_t %s; " % ( func_name, func_name )
|
---|
60 |
|
---|
61 | print """
|
---|
62 | struct _copy_list_node *copyList;
|
---|
63 | struct _spu_dispatch_table *copy_of;
|
---|
64 | int mark;
|
---|
65 | void *server;
|
---|
66 | SPUStateFunc_t spu_save_state; /* Save SPU internal state callback (optional) */
|
---|
67 | SPUStateFunc_t spu_load_state; /* Load SPU internal state callback (optional) */
|
---|
68 | } SPUDispatchTable;
|
---|
69 |
|
---|
70 | struct _copy_list_node {
|
---|
71 | SPUDispatchTable *copy;
|
---|
72 | struct _copy_list_node *next;
|
---|
73 | };
|
---|
74 |
|
---|
75 |
|
---|
76 | #endif /* CR_SPU_DISPATCH_TABLE_H */
|
---|
77 | """
|
---|