示例#1
0
文件: main.py 项目: certik/fwrap
def generate_fc_f(fc_ast, name):
    buf = CodeBuffer()
    for proc in fc_ast:
        proc.generate_wrapper(buf)
    ret_buf = CodeBuffer()
    ret_buf.putlines(reflow_fort(buf.getvalue()))
    return constants.FC_F_TMPL % name, ret_buf
示例#2
0
def generate_fc_f(fc_ast, name):
    buf = CodeBuffer()
    for proc in fc_ast:
        proc.generate_wrapper(buf)
    ret_buf = CodeBuffer()
    ret_buf.putlines(reflow_fort(buf.getvalue()))
    return constants.FC_F_TMPL % name, ret_buf
示例#3
0
def test_reflow():
    reflow_src = ("subroutine many_args(a0, a1, a2, a3, a4, a5, a6, a7, a8, "
                  "a9, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30"
                  ", a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, "
                  "a42, a43, a44, a45, a46, a47, a48, a49)\n"
                  "    implicit none\n"
                  "    integer, intent(in) :: a0, a1, a2, a3, a4, a5, a6, "
                  "a7, a8, a9, a20, a21, a22, a23, a24, a25, a26, a27, a28, "
                  "a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, "
                  "a40, a41, a42, a43, a44, a45, a46, a47, a48, a49\n"
                  "end subroutine many_args")

    buf = code.CodeBuffer()
    buf.putline(code.reflow_fort(reflow_src))
    for line in buf.getvalue().splitlines():
        ok_(len(line) <= 79, "len('%s') > 79" % line)
示例#4
0
文件: test_code.py 项目: certik/fwrap
def test_reflow():
    reflow_src = ("subroutine many_args(a0, a1, a2, a3, a4, a5, a6, a7, a8, "
                  "a9, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30"
                  ", a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, "
                  "a42, a43, a44, a45, a46, a47, a48, a49)\n"
                  "    implicit none\n"
                  "    integer, intent(in) :: a0, a1, a2, a3, a4, a5, a6, "
                  "a7, a8, a9, a20, a21, a22, a23, a24, a25, a26, a27, a28, "
                  "a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, "
                  "a40, a41, a42, a43, a44, a45, a46, a47, a48, a49\n"
                  "end subroutine many_args")

    buf = code.CodeBuffer()
    buf.putline(code.reflow_fort(reflow_src))
    for line in buf.getvalue().splitlines():
        ok_(len(line) <= 79, "len('%s') > 79" % line)