Changeset b651ed in git


Ignore:
Timestamp:
Jun 14, 2005, 5:44:55 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
859b51c6367722cffc34100946fcb3cb3631f282
Parents:
9b973c144b1c3a7ddd2df88833b75055fc1688ae
Message:
*bricken: so much fun, lalala


git-svn-id: file:///usr/local/Singular/svn/trunk@8364 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/openmathserver/omxmlreader.py

    r9b973c rb651ed  
    7171        return self.buildFromNode(root)
    7272#TODO: handle hex floats
     73#TODO: handle floats
    7374#TODO: handle ancestors cdbase
    7475if __name__=='__main__':
    75     if len(argv<=2):
     76    import arith1
     77   
     78    if len(sys.argv)<=2:
    7679        print "Usage: python omxmlreader [--evaluate] input output"
    77     for arg in argv:
    78        
     80    state=0
     81    eval=False
     82    #TODO: use optparse
     83    for arg in sys.argv[1:]:
     84        if state==0:
     85            if arg=="--evaluate":
     86                eval=True
     87            else:
     88                inputf=arg
     89                state=1
     90            continue
     91        if state==1:
     92            outputf=arg
     93            continue
     94        if state==2:
     95            print "argument ignored:", arg
    7996    from context import Context
    80     inputf=sys.argv[1]
     97    #inputf=sys.argv[1]
    8198    root=readFile(inputf)
    8299    builder=OMFromXMLBuilder()
    83100    context=Context()
    84    
    85     print context.XMLEncodeObject(builder.build(root))
     101    context.addCDImplementation(arith1.implementation)
     102    doc=builder.build(root)
     103    if eval:
     104        doc=context.evaluate(doc)
     105    output=context.XMLEncodeObject(doc)
     106    try:
     107        out=open(outputf,"w")
     108    except NameError:
     109        print "no output file"
     110        sys.exit(1)
     111    out.write(output)
     112    out.close()
    86113    #print repr(root.getAttribute("blabla"))
Note: See TracChangeset for help on using the changeset viewer.