Now builds all functions except those dependent on Features2d. Improved build detection if cmake is rerun

This commit is contained in:
hbristow
2013-06-27 16:25:18 -07:00
parent 245bc5dcc0
commit d6453cf051
5 changed files with 25 additions and 6 deletions

View File

@@ -44,10 +44,11 @@ def noutputs(args):
return len(outputs(args))
def convertibleToInt(string):
salt = '1+'
try:
int(string)
exec(salt+string)
return True
except ValueError:
except:
return False
def capitalizeFirst(text):

View File

@@ -13,10 +13,8 @@ class MatlabWrapperGenerator(object):
ns[name] = parser.parse(file)
# cleanify the parser output
print ns['ml']
parse_tree = ParseTree()
parse_tree.build(ns)
print parse_tree
# setup the template engine
jtemplate = Environment(loader=PackageLoader('templates', ''), trim_blocks=True, lstrip_blocks=True)

View File

@@ -51,6 +51,13 @@ class Translator(object):
# classes have 'class' prefixed on their name
if 'class' in defn[0].split(' ') or 'struct' in defn[0].split(' '):
return self.translateClass(defn)
# --- operators! ---
#TODO: implement operators: http://www.mathworks.com.au/help/matlab/matlab_oop/implementing-operators-for-your-class.html
if 'operator' in defn[0]:
return self.translateFunction(defn)
# --- constant ---
elif convertibleToInt(defn[1]):
return self.translateConstant(defn)
# --- function ---
# functions either need to have input arguments, or not uppercase names
elif defn[3] or not self.translateName(defn[0]).split('_')[0].isupper():