summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
commitf8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch)
tree26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
parentInitial commit. (diff)
downloadvirtualbox-upstream.tar.xz
virtualbox-upstream.zip
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py')
-rwxr-xr-xsrc/VBox/GuestHost/OpenGL/spu_loader/spucopy.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py b/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
new file mode 100755
index 00000000..bf1990a1
--- /dev/null
+++ b/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
@@ -0,0 +1,80 @@
+# Copyright (c) 2001, Stanford University
+# All rights reserved.
+#
+# See the file LICENSE.txt for information on redistributing this software.
+
+from __future__ import print_function
+import sys
+import apiutil
+
+
+apiutil.CopyrightC()
+
+print("""
+
+/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spucopy.py SCRIPT */
+
+#include "cr_spu.h"
+#include "cr_mem.h"
+
+void crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src )
+{
+""")
+
+keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
+for func_name in keys:
+ print('\tdst->%s = src->%s;' % (func_name, func_name))
+
+# if the destination is already a copy of something, we'd better make sure
+# that we take it off its source's copy list first.
+
+print("""
+ if (dst->copy_of != NULL)
+ {
+ /*
+ * dst was already a copy, go back to the original,
+ * and remove dst from the original's copyList.
+ */
+ struct _copy_list_node *temp, *prior = NULL;
+ for (temp = dst->copy_of->copyList; temp; prior = temp, temp = temp->next)
+ {
+ if (temp->copy == dst)
+ {
+ if (prior)
+ {
+ prior->next = temp->next;
+ }
+ else
+ {
+ dst->copy_of->copyList = temp->next;
+ }
+ crFree( temp );
+ break;
+ }
+ }
+ }
+ /*
+ * Now that dst->copy_of is unused, set it to point to our
+ * new original.
+ */
+ if (src->copy_of)
+ {
+ dst->copy_of = src->copy_of;
+ }
+ else
+ {
+ dst->copy_of = src;
+ }
+ /*
+ * Create a new copy node, so the src can keep track of the
+ * new copy (i.e. dst).
+ */
+ {
+ struct _copy_list_node *copynode;
+ copynode = (struct _copy_list_node*)crAlloc( sizeof( *copynode ) );
+ copynode->copy = dst;
+ copynode->next = src->copyList;
+ src->copyList = copynode;
+ }
+}
+""")