def xprec(srcdir, rctype, prec, xkind, xkindmod): lines = [] if rctype == '': return elif rctype == 'intrinsic': if xkind == '': return else: lines = open(srcdir + 'avh_olo_kinds.f90').readlines() if xkindmod != '': avh_pc.case('XKIND', 'yes', lines) avh_pc.subs('XKINDMOD', xkindmod, lines) avh_pc.subs('kindr2=>KINDPAR', 'kindr2=>' + xkind, lines) else: avh_pc.case('XKIND', 'no', lines) avh_pc.subs('kindr2=KINDPAR', 'kindr2=' + xkind, lines) lines.extend(open(srcdir + 'avh_olo_arrays.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_' + rctype + '.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_print.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_auxfun.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_olog.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_dilog.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_bnlog.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_qmplx.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_bub.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_tri.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_box.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_boxc.f90').readlines()) lines.extend(open(srcdir + 'avh_olo_main.f90').readlines()) avh_pc.incl(srcdir, lines) avh_pc.subs('avh_olo_forIREGI', 'avh_olo_forIREGI_' + prec, lines) avh_pc.subs('avh_olo_forIREGI_' + prec + '_version', 'avh_olo_forIREGI_version', lines) avh_pc.subs('avh_olo_forIREGI_' + prec + '_units', 'avh_olo_forIREGI_units', lines) if rctype == 'intrinsic': avh_pc.case('RCTYPE', 'intrinsic', lines) else: avh_pc.case('RCTYPE', prec + 'type', lines) avh_pc.case('RCPROG', rctype, lines) return lines
def xprec(srcdir,rctype,prec,xkind,xkindmod): lines = [] if rctype == '': return elif rctype == 'intrinsic': if xkind == '': return else: lines = open(srcdir+'avh_olo_kinds.f90').readlines() if xkindmod != '': avh_pc.case('XKIND','yes',lines) avh_pc.subs('XKINDMOD',xkindmod,lines) avh_pc.subs('kindr2=>KINDPAR','kindr2=>'+xkind,lines) else: avh_pc.case('XKIND','no',lines) avh_pc.subs('kindr2=KINDPAR','kindr2='+xkind,lines) lines.extend(open(srcdir+'avh_olo_arrays.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_'+rctype+'.f90').readlines()) lines.extend(open(srcdir+'avh_olo_print.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_auxfun.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_olog.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_dilog.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_bnlog.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_qmplx.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_bub.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_tri.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_box.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_boxc.f90' ).readlines()) lines.extend(open(srcdir+'avh_olo_main.f90' ).readlines()) avh_pc.incl(srcdir,lines) avh_pc.subs('avh_olo','avh_olo_'+prec,lines) avh_pc.subs('avh_olo_'+prec+'_version','avh_olo_version',lines) avh_pc.subs('avh_olo_'+prec+'_units','avh_olo_units',lines) if rctype == 'intrinsic': avh_pc.case('RCTYPE','intrinsic',lines) else: avh_pc.case('RCTYPE',prec+'type',lines) avh_pc.case('RCPROG',rctype,lines) return lines
#!/usr/bin/env python import sys import avh_pc ninput = len(sys.argv) - 1 lines = open(sys.argv[ninput]).readlines() if sys.argv[1] == 'case': avh_pc.case(sys.argv[2], sys.argv[3], lines) elif sys.argv[1] == 'dich': avh_pc.dich(sys.argv[2], sys.argv[3], lines) elif sys.argv[1] == 'incl': avh_pc.incl(sys.argv[2], lines) elif sys.argv[1] == 'subs': avh_pc.subs(sys.argv[2], sys.argv[3], lines) elif sys.argv[1] == 'clean': avh_pc.clean(lines) else: print 'ERROR in avh_pc_exe.py: option ' + sys.argv[1] + ' not defined.' sys.exit iofile = open(sys.argv[ninput], 'w') iofile.writelines(lines) iofile.close()
#!/usr/bin/env python import sys import avh_pc ninput = len(sys.argv)-1 lines = open(sys.argv[ninput]).readlines() if sys.argv[1] == 'case': avh_pc.case(sys.argv[2],sys.argv[3],lines) elif sys.argv[1] == 'dich': avh_pc.dich(sys.argv[2],sys.argv[3],lines) elif sys.argv[1] == 'incl': avh_pc.incl(sys.argv[2],lines) elif sys.argv[1] == 'subs': avh_pc.subs(sys.argv[2],sys.argv[3],lines) elif sys.argv[1] == 'clean': avh_pc.clean(lines) else: print 'ERROR in avh_pc_exe.py: option '+sys.argv[1]+' not defined.' sys.exit iofile = open(sys.argv[ninput],'w') iofile.writelines(lines) iofile.close()