Diff of /extract-jvmti/run_xml.py [000000] .. [e7e81f] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/extract-jvmti/run_xml.py
@@ -0,0 +1,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