def cTemplate_C(obj,db,recursive): identifier = obj.get_basename() template = obj.get_template() # get the cxx type object, for namespaces: tn = cxx_type(identifier) namespace = tn.show_base(kw=False,ns=False) #prepare query if recursion is needed: if isinstance(recursive,set): Q = True recursive.update(struct_letters) recursive.add(tn.lbase) for t in obj['params']: if t.startswith('typename '): t = t.replace('typename ','') recursive.add(t) else: Q = None R = [] #S holds template output lines: S = [u'template%s'%template] if 'cClass' in obj: from ccrawl.core import cClass o = cClass(obj['cClass']) o.identifier = identifier x = cClass_C(o,db,recursive) if 'cFunc' in obj: from ccrawl.core import cFunc o = cFunc(obj['cFunc']) o.identifier = identifier x = cFunc_C(o,db,recursive) x = x.split('\n\n') S.append(x.pop()) if len(x): R.append(x[0]) return '\n'.join(R)+'\n'.join(S)
def FuncTemplate(cur, cxx, errors=None): identifier = cur.spelling if conf.DEBUG: echo('\t' * g_indent + identifier) proto = cur.type.spelling if conf.DEBUG: echo('\t' * g_indent + proto) p = [] for x in cur.get_children(): if x.kind == CursorKind.TEMPLATE_TYPE_PARAMETER: p.append('typename %s' % x.spelling) elif x.kind == CursorKind.TEMPLATE_NON_TYPE_PARAMETER: p.append('%s %s' % (x.type.spelling, x.spelling)) f = re.sub(r'__attribute__.*', '', proto) return identifier, cTemplate(params=p, cFunc=cFunc(f))
def FuncTemplate(cur, cxx, errors=None): identifier = cur.spelling if conf.DEBUG: echo("\t" * g_indent + identifier) proto = cur.type.spelling if conf.DEBUG: echo("\t" * g_indent + proto) p = [] for x in cur.get_children(): if x.kind == CursorKind.TEMPLATE_TYPE_PARAMETER: p.append("typename %s" % x.spelling) elif x.kind == CursorKind.TEMPLATE_NON_TYPE_PARAMETER: p.append("%s %s" % (x.type.spelling, x.spelling)) f = re.sub(r"__attribute__.*", "", proto) if conf.VERBOSE: secho(" cTemplate/cFunc: %s" % identifier) return identifier, cTemplate(params=p, cFunc=cFunc(prototype=f))
def FuncDecl(cur, cxx, errors=None): identifier = cur.spelling t = cur.type.spelling proto = fix_type_conversion(cur, t, cxx, errors) params = [] locs = [] calls = [] f = cFunc(prototype=proto) for e in cur.get_children(): if conf.DEBUG: echo("%s: %s" % (e.kind, e.spelling)) if e.kind == CursorKind.PARM_DECL: params.append(e.spelling) elif e.kind == CursorKind.COMPOUND_STMT: locs, calls = CodeDef(e, cxx, errors) f["params"] = params f["locs"] = locs f["calls"] = calls if conf.VERBOSE: secho(" cFunc: %s" % identifier) return identifier, f
def cTemplate_C(obj, db, recursive): identifier = obj.get_basename() template = obj.get_template() # get the cxx type object, for namespaces: tn = cxx_type(identifier) # namespace = tn.show_base(kw=False,ns=False) # prepare query if recursion is needed: if isinstance(recursive, set): # Q = True recursive.update(struct_letters) recursive.add(tn.lbase) for t in obj["params"]: if t.startswith("typename "): t = t.replace("typename ", "") recursive.add(t) else: # Q = None pass R = [] # S holds template output lines: S = [u"template%s" % template] if "cClass" in obj: from ccrawl.core import cClass o = cClass(obj["cClass"]) o.identifier = identifier x = cClass_C(o, db, recursive) if "cFunc" in obj: from ccrawl.core import cFunc o = cFunc(obj["cFunc"]) o.identifier = identifier x = cFunc_C(o, db, recursive) x = x.split("\n\n") S.append(x.pop()) if len(x): R.append(x[0]) return "\n".join(R) + "\n".join(S)
def FuncDecl(cur, cxx, errors=None): identifier = cur.spelling t = cur.type.spelling proto = fix_type_conversion(cur, t, cxx, errors) return identifier, cFunc(proto)