VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py@ 62484

Last change on this file since 62484 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 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
6import sys
7import apiutil
8
9
10apiutil.CopyrightC()
11
12print """
13
14/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spucopy.py SCRIPT */
15
16#include "cr_spu.h"
17#include "cr_mem.h"
18
19void crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src )
20{
21"""
22
23keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
24for func_name in keys:
25 print '\tdst->%s = src->%s;' % (func_name, func_name)
26
27# if the destination is already a copy of something, we'd better make sure
28# that we take it off its source's copy list first.
29
30print """
31 if (dst->copy_of != NULL)
32 {
33 /*
34 * dst was already a copy, go back to the original,
35 * and remove dst from the original's copyList.
36 */
37 struct _copy_list_node *temp, *prior = NULL;
38 for (temp = dst->copy_of->copyList; temp; prior = temp, temp = temp->next)
39 {
40 if (temp->copy == dst)
41 {
42 if (prior)
43 {
44 prior->next = temp->next;
45 }
46 else
47 {
48 dst->copy_of->copyList = temp->next;
49 }
50 crFree( temp );
51 break;
52 }
53 }
54 }
55 /*
56 * Now that dst->copy_of is unused, set it to point to our
57 * new original.
58 */
59 if (src->copy_of)
60 {
61 dst->copy_of = src->copy_of;
62 }
63 else
64 {
65 dst->copy_of = src;
66 }
67 /*
68 * Create a new copy node, so the src can keep track of the
69 * new copy (i.e. dst).
70 */
71 {
72 struct _copy_list_node *copynode;
73 copynode = (struct _copy_list_node*)crAlloc( sizeof( *copynode ) );
74 copynode->copy = dst;
75 copynode->next = src->copyList;
76 src->copyList = copynode;
77 }
78}
79"""
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