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