## helper functions <% def rank(var): """the number of dimensions""" return len(var["shape"]) %> <% def shape(var): # convert dims to strings dims = (str(0) for dim in var["shape"]) return ",".join(dims) %> %for variable in variables: ## only for rank1 vars %if rank(variable) > 0: allocate(s%${variable['name'].ljust(20)}(${shape(variable)})) %endif %endfor ## vim: filetype=mako