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
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)