2013-03-11 01:19:17 +01:00
|
|
|
#/usr/bin/env python
|
|
|
|
|
|
|
|
import sys, re, os.path
|
|
|
|
from string import Template
|
2013-03-14 08:26:18 +01:00
|
|
|
from hdr_parser import CppHeaderParser
|
|
|
|
from parse_tree import ParseTree, todict
|
|
|
|
|
|
|
|
class MatlabWrapperGenerator(object):
|
|
|
|
|
|
|
|
def gen(self, input_files, output_files):
|
|
|
|
# parse each of the files and store in a dictionary
|
|
|
|
# as a separate "namespace"
|
|
|
|
parser = CppHeaderParser()
|
|
|
|
ns = {}
|
|
|
|
for file in input_files:
|
|
|
|
# get the file name
|
|
|
|
name = os.path.splitext(os.path.basename(file))[0]
|
|
|
|
ns[name] = parser.parse(file)
|
|
|
|
|
|
|
|
# cleanify the parser output
|
|
|
|
parse_tree = ParseTree()
|
|
|
|
parse_tree.build(ns)
|
|
|
|
|
|
|
|
print parse_tree
|