Exemple #1
0
def add_specstmts(parstmt, numifstmts):
    # create decl stmt
    varstr = ', '.join([ 'ifcondvar%d'%num for num in range(numifstmts) ])
    declstmt = DummyStatement()
    #declstmt.forced_lines = [ 'LOGICAL %s'%varstr ]
    declstmt.forced_lines = [ 'LOGICAL ifcondvar0']

    # add decl
    lastspecstmt, idx = get_lastspecstmt(parstmt)
    if lastspecstmt:
        parstmt.content.insert(idx, declstmt)
Exemple #2
0
def add_specstmts(parstmt, numifstmts):
    # create decl stmt
    varstr = ', '.join(['ifcondvar%d' % num for num in range(numifstmts)])
    declstmt = DummyStatement()
    #declstmt.forced_lines = [ 'LOGICAL %s'%varstr ]
    declstmt.forced_lines = ['LOGICAL ifcondvar0']

    # add decl
    lastspecstmt, idx = get_lastspecstmt(parstmt)
    if lastspecstmt:
        parstmt.content.insert(idx, declstmt)
Exemple #3
0
def simplify(ifstmt, condexpr, ifstmtid):
    # create assign stmt
    #assignstr = 'ifcondvar%d = %s'%(ifstmtid, condexpr.tofortran())
    assignstr = 'ifcondvar0 = %s'%condexpr.tofortran()
    assignstmt = DummyStatement()
    assignstmt.forced_lines = [ assignstr ]

    # create simplified if stmt
    #ifstmt.expr = 'ifcondvar%d'%ifstmtid
    ifstmt.expr = 'ifcondvar0'
    ifstmt.forced_lines = [ ifstmt.tokgen() ]

    # add stmts
    p = ifstmt.parent
    idx = p.content.index(ifstmt)
    p.content.insert(idx, assignstmt)
Exemple #4
0
def simplify(ifstmt, condexpr, ifstmtid):
    # create assign stmt
    #assignstr = 'ifcondvar%d = %s'%(ifstmtid, condexpr.tofortran())
    assignstr = 'ifcondvar0 = %s' % condexpr.tofortran()
    assignstmt = DummyStatement()
    assignstmt.forced_lines = [assignstr]

    # create simplified if stmt
    #ifstmt.expr = 'ifcondvar%d'%ifstmtid
    ifstmt.expr = 'ifcondvar0'
    ifstmt.forced_lines = [ifstmt.tokgen()]

    # add stmts
    p = ifstmt.parent
    idx = p.content.index(ifstmt)
    p.content.insert(idx, assignstmt)