# 'name' is the variable's name, in the context of the _template_. # 'value' is some object whose __str__() method is called when the C code is # to be generated (possibly other times too). # if 'value' is left blank, then it will be generated automatically as a # string by adding some unique value to 'prefix'. # 'type' only matters if 'value' is some sort of C variable, which needs to be # allocated explicitly class C_Name: (most of existing code for generating names can be reused) def __init__(self, name=None, value=None, prefix="v", type=(DEC)): class Namespace: def __init__(self, names, values) def add(self, k, v): def remove(self, k): def set(self, k, v): def eval_template(self, template): class C_Code: def __init__(self, self.argnames - needs to be set somehow def __call__(self, *args): self.tempmap class Layer(C_Name): def __init__(self,*a,**kw): C_Name(self,*a,**kw) # necessary? def __add__, __sub__, etc. return C_Something(*args)