ring r=0,(x,y,z,a,b),lp;
poly f=37x3y+x2yz;
ideal i=x*(x-1),y;
LIB "primdec.lib";
//LIB "polylib.lib";
ideal p1=x2,y;
ideal p2=(x-1),(y-5)^2;
ideal p3=(x)^2;
ideal big=intersect(intersect(p1,p2),p3);
ideal i2=cyclic(5);

print(i2);
LIB("python_module.so");
Python_module::python("from interpreter import SingularGlobalsProxy
#import psyco
import sys
sys.argv=['Singular']
#import sre_compile
#psyco.bind(sre_compile._optimize_charset)
#psyco.log()
#psyco.profile()
from cas.singular import *
from context import *
context=Context()
from lxmlencoder import encode as xml

import cd.polyd as polyd
import cd.fieldname1 as fieldname1
import cas.singular
import cd.list1
import cd.primdec
context.addCDImplementation(cd.list1.implementation)
context.addCDImplementation(cd.primdec.implementation)
context.addCDImplementation(polyd.implementation)
context.addCDImplementation(fieldname1.implementation)
from cd.polyd import groebnersym
r=singular.r
inter=SingularGlobalsProxy()



easy=ideal2OM(singular.i)
call=OMA(cd.primdec.implementation.minAss, [easy])
print call
print context.evaluate(call)
r.set()


easy=ideal2OM(singular.i)
call=OMA(cd.primdec.implementation.primdecGTZ, [easy])
print call
print context.evaluate(call)
r.set()


easy=ideal2OM(singular.i)
call=OMA(cd.primdec.implementation.minAssGTZ, [ideal2OM(singular.big)])
print call
#print encode(call)
print context.evaluate(call)
print
print
out=open('blupper','w')
xml(context.evaluate(call)).write(out)
out.close()
print 'ARG'
r.set()

easy=ideal2OM(singular.i)
call=OMA(cd.primdec.implementation.primdecGTZ, [ideal2OM(singular.big)])
print call
#print lxmlencoder.encode(call).tostring
xml(context.evaluate(call)).write(open('primdec.in', 'w'))
print context.evaluate(call)
r.set()
cyc5=ideal2OM(singular.i2)
ord=ordering2OM(singular.r)
gcall=OMA(groebnersym,[ord,cyc5])


print gcall

def myblock(i):
    out=open('blipper'+str(i),'w')
    xml(context.evaluate(gcall)).write(out)
    out.close()
    r.set()

for i in range(20):
    myblock(i)
#from timeit import Timer

#print 'Timing:', t.timeit(1)
#gcout=open('cyc3om','w')
#gcout.write(context.XMLEncodeObject(gcall))
#gcout.close()

#print 'now calculating GB'
#omin=context.XMLEncodeObject(gcall)
#from omxmlreader import *
def inout(context, infn):
  doc=readFile(infn)
  builder=OMFromXMLBuilder()
  doc=builder.build(doc)
  doc=context.evaluate(doc)
  output=context.XMLEncodeObject(doc)
  gcout=open('cyc3om.out','w')
  gcout.write(output)
  gcout.close()

#inout(context,'cyc3om')


");
$
