File: java_doc.py

package info (click to toggle)
wiredtiger 3.2.1-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 25,456 kB
  • sloc: ansic: 102,922; python: 52,573; sh: 6,915; java: 6,130; cpp: 2,311; makefile: 1,018; xml: 176
file content (44 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download
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
#!/usr/bin/env python

# This program pulls the function names from wiredtiger.in and generates
# an input file for Java SWIG that adds doxygen copydoc comments to functions.

from __future__ import print_function
import os, re, sys
import api_data
from dist import compare_srcfile

# Temporary file.
tmp_file = '__tmp'

#####################################################################
# Update wiredtiger.in with doxygen comments
#####################################################################
f='../src/include/wiredtiger.in'
o='../lang/java/java_doc.i'
tfile = open(tmp_file, 'w')

tfile.write('''/* DO NOT EDIT: automatically built by dist/java_doc.py. */

''')

cclass_re = re.compile('^struct __([a-z_]*) {')
cfunc_re = re.compile('\s+.*? __F\(([a-z_]*)\)')

curr_class = ""
for line in open(f, 'r'):

    m = cclass_re.match(line)
    if m:
        curr_class = m.group(1)

    if curr_class == "":
        continue

    m = cfunc_re.match(line)
    if m:
        tfile.write('COPYDOC(__' + curr_class.lower() + ', ' +
        curr_class.upper() + ', ' + m.group(1) + ')\n')

tfile.close()
compare_srcfile(tmp_file, o)