예제 #1
0
def main(arglist):

    # Parse command line arguments
    inputddfiles = []
    outputddfiles = []
    xmlfile = None

    opts, args = getopt.getopt(arglist, "ho:", ["indd=", "outdd=", "output=", "help"])

    for o, a in opts:
        if o in ["-h", "--help"]:
            usage()
            return -1
        elif o in ["--indd"]:
            if a is not "":
                inputddfiles.append(a)
        elif o in ["--outdd"]:
            if a is not "":
                outputddfiles.append(a)
        elif o in ["-o", "--output"]:
            xmlfile = a
        else:
            usage()
            return -1

    if len(args) != 1:
        usage()
        return -1

    excelicdfile = args[0]

    if xmlfile is None:
        xmlfile = excelicdfile.rsplit(".", 1)[0] + ".xml"

    if len(inputddfiles) > 0:
        inputDD = iomGenReadDD.ddread(inputddfiles)
    else:
        inputDD = None

    if len(outputddfiles) > 0:
        outputDD = iomGenReadDD.ddread(outputddfiles)
    else:
        outputDD = None

    inputModel = iomGenCommon.MapReader(excelicdfile, dd=inputDD, msgonly=False, direction="input")
    outputModel = iomGenCommon.MapReader(excelicdfile, dd=outputDD, msgonly=False, direction="output")
    genXml(inputModel, outputModel, xmlfile)

    return 0
예제 #2
0
def main(arglist):

    # Parse command line arguments
    inputddfiles   =  []
    outputddfiles  = []
    xmlfile        = None
    intParamOffset = 0
    intenalSignals = []

    opts, args = getopt.getopt(arglist, 'ho:', ['indd=', 'output=', 'help'])
    
    for o, a in opts:
        if o in ['-h', '--help']:
            usage()
            return -1
        elif o in [ '--indd']:
            if a is not "":
                inputddfiles.append(a)
        elif o in [ '-o', '--output']:
            xmlfile = a
        else:
            usage()
            return -1

    if len(args) != 1:
        usage()
        return -1
        
    excelicdfile = args[0]

    if len(inputddfiles) > 0:
        inputDD = iomGenReadDD.ddread(inputddfiles)
    else:
        inputDD = None

    inputSignals = readExcelFile(excelicdfile, ('InputSignals',))[0]
    
    intParamOffset  = getIntParamsOffset(inputDD)
    internalSignals = extractIntSignals(inputSignals)
   
    createIntDD(intParamOffset,internalSignals, xmlfile)
        
    return 0