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 | from __future__ import print_function
|
---|
7 | import sys;
|
---|
8 | import string;
|
---|
9 | import re;
|
---|
10 |
|
---|
11 | import apiutil
|
---|
12 |
|
---|
13 | apiutil.CopyrightC()
|
---|
14 |
|
---|
15 | print("""
|
---|
16 | #include "cr_debugopcodes.h"
|
---|
17 | #include <stdio.h>
|
---|
18 | """)
|
---|
19 |
|
---|
20 | print("""void crDebugOpcodes( FILE *fp, unsigned char *ptr, unsigned int num_opcodes )
|
---|
21 | {
|
---|
22 | \tunsigned int i;
|
---|
23 | \tfor (i = 0 ; i < num_opcodes ; i++)
|
---|
24 | \t{
|
---|
25 | \t\tswitch(*(ptr--))
|
---|
26 | \t\t{
|
---|
27 | """)
|
---|
28 |
|
---|
29 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
30 | keys.sort()
|
---|
31 |
|
---|
32 | for func_name in keys:
|
---|
33 | if "pack" in apiutil.ChromiumProps(func_name):
|
---|
34 | print('\t\tcase %s:' % apiutil.OpcodeName( func_name ))
|
---|
35 | print('\t\t\tfprintf( fp, "%s\\n" ); ' % apiutil.OpcodeName( func_name ))
|
---|
36 | print( '\t\t\tbreak;')
|
---|
37 |
|
---|
38 | print("""
|
---|
39 | \t\t}
|
---|
40 | \t}
|
---|
41 | }
|
---|
42 | """)
|
---|