File: gen_binding_f77.py

package info (click to toggle)
mpich 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 251,828 kB
  • sloc: ansic: 1,323,147; cpp: 82,869; f90: 72,420; javascript: 40,763; perl: 28,296; sh: 19,399; python: 16,191; xml: 14,418; makefile: 9,468; fortran: 8,046; java: 4,635; pascal: 352; asm: 324; ruby: 176; awk: 27; lisp: 19; php: 8; sed: 4
file content (61 lines) | stat: -rw-r--r-- 1,630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
##
## Copyright (C) by Argonne National Laboratory
##     See COPYRIGHT in top-level directory
##

from local_python import MPI_API_Global as G
from local_python.mpi_api import *
from local_python.binding_common import *
from local_python.binding_f77 import *
from local_python import RE
import os

def main():
    # currently support -no-real128, -aint-is-int
    G.parse_cmdline()

    binding_dir = G.get_srcdir_path("src/binding")
    f77_dir = "src/binding/fortran/mpif_h"

    func_list = load_C_func_list(binding_dir, True) # suppress noise

    func_list.extend(get_f77_dummy_func_list())

    # preprocess
    for func in func_list:
        check_func_directives(func)
    func_list = [f for f in func_list if '_skip_fortran' not in f]

    # fortran_binding.c
    def has_cptr(func):
        for p in func['parameters']:
            if p['kind'] == 'C_BUFFER':
                return True
        return False

    G.out = []
    G.profile_out = []
    for func in func_list:
        G.out.append("")
        dump_f77_c_func(func)
        if has_cptr(func):
            dump_f77_c_func(func, True)

    f = "%s/fortran_binding.c" % f77_dir
    dump_f77_c_file(f, G.out)

    f = "%s/fortran_profile.h" % f77_dir
    dump_f77_c_file(f, G.profile_out)

    # .in files has to be generated in the source tree
    if G.is_autogen():
        G.mpih_defines = {}
        load_mpi_h_in("src/include/mpi.h.in")
        load_mpi_h_in("src/mpi/romio/include/mpio.h.in")
        f = "%s/mpif.h.in" % f77_dir
        dump_mpif_h(f)

# ---------------------------------------------------------
if __name__ == "__main__":
    main()