[e7e81f]: extract-jvmti / run_xml.py  Maximize  Restore  History

Download this file

57 lines (48 with data), 1.6 kB

 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from BeautifulSoup import *
import re
xml = open('jvmti.xml', 'r').read()
soup = BeautifulSoup(xml)
funcs = soup.findAll('function')
required_ids = set()
for func in funcs:
caps = func.findAll('capabilities')
if len(caps) == 1 and caps[0] != None:
if len(caps[0].findAll('required')) == 0:
required_ids.add(func['id'])
html = open('table.html', 'r').read()
soup = BeautifulSoup(html)
rows = soup.findAll('tr')
re_jnicall = re.compile("\(JNICALL \*(.*?)\)")
re_reserved = re.compile("void \*reserved[0-9]{1,3}")
functions = []
longest = 0
for row in rows[2:]:
cells = row.findAll('td')
num = int(cells[0].contents[0].strip())
signature = cells[2].contents[1].contents[0].replace("\n", "")
signature = re.sub("\s+", " ", signature)
jnicall = re_jnicall.search(signature)
if jnicall:
functions.append((num, signature, jnicall.group(1)))
if len(jnicall.group(1)) > longest:
longest = len(jnicall.group(1))
else:
reserved = re_reserved.search(signature)
if reserved:
functions.append((num, signature, "reserved%d" % num))
else:
print "Unknown signature: %d" % num
#print int(cells[0].contents[0].strip()), cells[2].contents[1].contents[0]
i=0
printed = set()
for num,sig,func in functions:
numspaces = longest - len(func)
#print " private final static int %s%s = %d;" % (func.upper(),' '*numspaces, num-1)
#print ' names[%s]%s = "%s";' % (func.upper(), ' '*numspaces, func)
#print " %s" % sig
if func in required_ids:
i += 1
print sig
printed.add(func)
print len(required_ids), i
print required_ids ^ printed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks