Exemplo n.º 1
0
def getFunction(elem):
    syms = []
    name = getters.getName(elem)
    include = getters.getLocation(elem)
    params = getters.getParamDesc(elem, getters.getParams(elem))
    briefDesc = getters.getBriefDesc(elem)
    detailedDesc = getters.getFunctionDetailedDesc(elem)
    returnType = getters.getType(elem)
    exceptions = getters.getExceptions(elem)
    returnDesc = getters.getReturnDesc(elem)
    returnValues = getters.getRetvals(elem)

    funcProto = buildPrototype(returnType + " " + name + "(", briefDesc)
    for param in params:
        proto = param.type + " " + param.name
        funcProto.prototype += proto + ", "
        funcProto.addParameter(
            buildParameter(prototype=proto, description=param.desc))
    for ex in exceptions:
        funcProto.addException(
            buildException(linkedSymbol=ex.typename,
                           description=ex.description))
    if len(params) != 0:
        funcProto.prototype = funcProto.prototype[:-2]
    funcProto.prototype += ")"
    funcProto.addParameter(
        buildParameter(prototype="return", description=returnDesc))
    syms.append(
        buildFunction(path=name, prototypeObj=funcProto, importString=include))
    return syms
Exemplo n.º 2
0
def getVariable(elem):
    syms = []
    name = getters.getName(elem)
    include = getters.getLocation(elem)
    vtype = getters.getType(elem)
    value = getters.getInitializer(elem)
    briefDesc = getters.getBriefDesc(elem)

    varProto = buildPrototype(name, briefDesc)
    syms.append(
        buildVariable(path=name, prototypeObj=varProto, importString=include))
    return syms
Exemplo n.º 3
0
def getUnion(fileName):
    root = ET.parse(fileName).getroot()

    syms = []
    name = getters.getCompoundName(root)
    include = getters.getLocation(root.find("compounddef"))
    briefDesc = getters.getBriefDesc(root.find("compounddef"))
    detailedDesc = getters.getDetailedDesc(root.find("compounddef"))

    unionProto = buildPrototype("struct " + name, briefDesc)
    unionSym = buildUnion(path=name,
                          prototypeObj=unionProto,
                          importString=include)
    for elem in root.iter("memberdef"):
        ename = getters.getName(elem)
        etype = getters.getType(elem)
        edesc = getters.getDetailedDesc(elem)
        proto = buildPrototype(etype + " " + ename, edesc)
        syms.append(
            buildVariable(path=(name + "/" + ename), prototypeObj=proto))
        unionSym.addMember(name + "/" + ename)
    syms.append(unionSym)
    return syms
Exemplo n.º 4
0
def getTypedef(elem):
    syms = []
    tdType = getters.getType(elem)
    include = getters.getLocation(elem)
    try:
        if elem.find("argsstring").text:
            tmp = strOp.epurStr(elem.find("argsstring").text)
        else:
            return syms
        tdType = strOp.epurStr(tdType + tmp)
    except Exception as error:
        useful.printExceptionVerbose(error)
        pass
    tdName = getters.getName(elem)
    briefDesc = getters.getBriefDesc(elem)
    detailedDesc = getters.getDetailedDesc(elem)
    typedefProto = buildPrototype("typedef " + tdName + " " + tdType,
                                  briefDesc)
    syms.append(
        buildTypedef(path=tdName,
                     prototypeObj=typedefProto,
                     importString=include))
    return syms