summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/util/debug_opcodes.py
blob: cf07424a2d32fb6c23a156a09f12a87626e80c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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 string;
import re;

import apiutil

apiutil.CopyrightC()

print("""
#include "cr_debugopcodes.h"
#include <stdio.h>
""")

print("""void crDebugOpcodes( FILE *fp, unsigned char *ptr, unsigned int num_opcodes )
{
\tunsigned int i;
\tfor (i = 0; i < num_opcodes; i++)
\t{
\t\tswitch(*(ptr--))
\t\t{
""")

keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
keys.sort()

for func_name in keys:
	if "pack" in apiutil.ChromiumProps(func_name):
		print('\t\tcase %s:' % apiutil.OpcodeName( func_name ))
		print('\t\t\tfprintf(fp, "%s\\n"); ' % apiutil.OpcodeName( func_name ))
		print( '\t\t\tbreak;')

print("""
\t\t}
\t}
}
""")