(f2cmap_file)
| 136 | f2cmap_mapped = [] |
| 137 | |
| 138 | def load_f2cmap_file(f2cmap_file): |
| 139 | global f2cmap_all, f2cmap_mapped |
| 140 | |
| 141 | f2cmap_all = copy.deepcopy(f2cmap_default) |
| 142 | |
| 143 | if f2cmap_file is None: |
| 144 | # Default value |
| 145 | f2cmap_file = '.f2py_f2cmap' |
| 146 | if not os.path.isfile(f2cmap_file): |
| 147 | return |
| 148 | |
| 149 | # User defined additions to f2cmap_all. |
| 150 | # f2cmap_file must contain a dictionary of dictionaries, only. For |
| 151 | # example, {'real':{'low':'float'}} means that Fortran 'real(low)' is |
| 152 | # interpreted as C 'float'. This feature is useful for F90/95 users if |
| 153 | # they use PARAMETERS in type specifications. |
| 154 | try: |
| 155 | outmess('Reading f2cmap from {!r} ...\n'.format(f2cmap_file)) |
| 156 | with open(f2cmap_file) as f: |
| 157 | d = eval(f.read().lower(), {}, {}) |
| 158 | f2cmap_all, f2cmap_mapped = process_f2cmap_dict(f2cmap_all, d, c2py_map, True) |
| 159 | outmess('Successfully applied user defined f2cmap changes\n') |
| 160 | except Exception as msg: |
| 161 | errmess('Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg)) |
| 162 | |
| 163 | |
| 164 | cformat_map = {'double': '%g', |
nothing calls this directly
no test coverage detected