Stripped down jinja, added cmake support

This commit is contained in:
Hilton Bristow
2013-03-18 11:47:48 +10:00
committed by hbristow
parent 09e294711d
commit 827b4f93e4
62 changed files with 20 additions and 713 deletions

View File

@@ -4,6 +4,8 @@ import sys, re, os.path
from string import Template
from hdr_parser import CppHeaderParser
from parse_tree import ParseTree, todict
from filters import *
from jinja2 import Environment, PackageLoader
class MatlabWrapperGenerator(object):
@@ -20,5 +22,20 @@ class MatlabWrapperGenerator(object):
# cleanify the parser output
parse_tree = ParseTree()
parse_tree.build(ns)
print parse_tree
# setup the template engine
jtemplate = Environment(loader=PackageLoader('templates', ''))
# add the custom filters
jtemplate.filters['toUpperCamelCase'] = toUpperCamelCase
jtemplate.filters['toLowerCamelCase'] = toLowerCamelCase
jtemplate.filters['toUnderCase'] = toUnderCase
jtemplate.filters['comment'] = comment
# load the templates
function = jtemplate.get_template('template_function_base.cpp')
classm = jtemplate.get_template('template_class_base.m')
classc = jtemplate.get_template('template_class_base.cpp')
doc = jtemplate.get_template('template_doc_base.m')
# populate!