def extract(code, data): start = data.find("/*") end = data.find("*/") desc, d_in, d_out = data[start+2:end].split("\n\t\n") desc = desc.split(" -- ") print desc r = """
""" return r def gendoc(header, template): import re regexp = re.compile("^IFACEMESSAGE\\(.*, (.*)\\)", re.M) d = open(header).read() t = open(template).read() start = 0 body = "" while 1: s = regexp.search(d[start:]) if not s: break start = start + s.end() body += extract(s.groups()[0], d[start:]) return t.replace("@BODY@", body)