VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py@ 63939

Last change on this file since 63939 was 63939, checked in by vboxsync, 8 years ago

Build/scripts (bugref:6627): Python build scripts updated to generate the same code when used with Python 2 and 3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
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
8from __future__ import print_function
9import sys, string
10
11import apiutil
12
13
14apiutil.CopyrightC()
15
16print("""
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
32keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
33
34
35print('/* Offsets of each function within the dispatch table */')
36offset = 0
37for func_name in keys:
38 print('#define DISPATCH_OFFSET_%s %d' % (func_name, offset))
39 offset += 1
40print('')
41
42print('/* Function typedefs */')
43for 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)))
48print('')
49
50print('struct _copy_list_node;')
51print('')
52print('/* Prototype for SPU internal state load/unload callbacks. */')
53print('')
54print('typedef int (*SPUStateFunc_t)(void *);')
55print('')
56print('/* The SPU dispatch table */')
57print('typedef struct _spu_dispatch_table {')
58
59for func_name in keys:
60 print("\t%sFunc_t %s; " % ( func_name, func_name ))
61
62print("""
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
71struct _copy_list_node {
72 SPUDispatchTable *copy;
73 struct _copy_list_node *next;
74};
75
76
77#endif /* CR_SPU_DISPATCH_TABLE_H */
78""")
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette