Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/__init__.py +9 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/__init__.pyi +5 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_backend.py +44 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_backend.pyi +46 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_distutils.py +76 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_distutils.pyi +13 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_meson.py +231 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/_meson.pyi +63 -0
- archive/.venv/Lib/site-packages/numpy/f2py/_backends/meson.build.template +55 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/__init__.py +16 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/abstract_interface/foo.f90 +34 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/abstract_interface/gh18403_mod.f90 +6 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c +235 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap +1 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_free.f90 +34 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_mod.f90 +41 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_use.f90 +19 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/precision.f90 +4 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/block_docstring/foo.f +6 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/foo.f +62 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh17797.f90 +7 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh18335.f90 +17 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh25211.f +10 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh25211.pyf +18 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh26681.f90 +18 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/gh_22819.pyf +6 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/hi77.f +3 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/hiworld.f90 +3 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/common/block.f +11 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/common/gh19161.f90 +10 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/accesstype.f90 +13 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/common_with_division.f +17 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_common.f +8 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_multiplier.f +5 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_stmts.f90 +20 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_with_comments.f +8 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/foo_deps.f90 +6 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh15035.f +16 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh17859.f +12 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh22648.pyf +7 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23533.f +5 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23598.f90 +4 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23598Warn.f90 +11 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23879.f90 +20 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh27697.f90 +12 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh2848.f90 +13 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/operators.f90 +49 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/privatemod.f90 +11 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/publicmod.f90 +10 -0
- archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/pubprivmod.f90 +10 -0
archive/.venv/Lib/site-packages/numpy/f2py/_backends/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def f2py_build_generator(name):
|
| 2 |
+
if name == "meson":
|
| 3 |
+
from ._meson import MesonBackend
|
| 4 |
+
return MesonBackend
|
| 5 |
+
elif name == "distutils":
|
| 6 |
+
from ._distutils import DistutilsBackend
|
| 7 |
+
return DistutilsBackend
|
| 8 |
+
else:
|
| 9 |
+
raise ValueError(f"Unknown backend: {name}")
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/__init__.pyi
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal as L
|
| 2 |
+
|
| 3 |
+
from ._backend import Backend
|
| 4 |
+
|
| 5 |
+
def f2py_build_generator(name: L["distutils", "meson"]) -> Backend: ...
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_backend.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class Backend(ABC):
|
| 5 |
+
def __init__(
|
| 6 |
+
self,
|
| 7 |
+
modulename,
|
| 8 |
+
sources,
|
| 9 |
+
extra_objects,
|
| 10 |
+
build_dir,
|
| 11 |
+
include_dirs,
|
| 12 |
+
library_dirs,
|
| 13 |
+
libraries,
|
| 14 |
+
define_macros,
|
| 15 |
+
undef_macros,
|
| 16 |
+
f2py_flags,
|
| 17 |
+
sysinfo_flags,
|
| 18 |
+
fc_flags,
|
| 19 |
+
flib_flags,
|
| 20 |
+
setup_flags,
|
| 21 |
+
remove_build_dir,
|
| 22 |
+
extra_dat,
|
| 23 |
+
):
|
| 24 |
+
self.modulename = modulename
|
| 25 |
+
self.sources = sources
|
| 26 |
+
self.extra_objects = extra_objects
|
| 27 |
+
self.build_dir = build_dir
|
| 28 |
+
self.include_dirs = include_dirs
|
| 29 |
+
self.library_dirs = library_dirs
|
| 30 |
+
self.libraries = libraries
|
| 31 |
+
self.define_macros = define_macros
|
| 32 |
+
self.undef_macros = undef_macros
|
| 33 |
+
self.f2py_flags = f2py_flags
|
| 34 |
+
self.sysinfo_flags = sysinfo_flags
|
| 35 |
+
self.fc_flags = fc_flags
|
| 36 |
+
self.flib_flags = flib_flags
|
| 37 |
+
self.setup_flags = setup_flags
|
| 38 |
+
self.remove_build_dir = remove_build_dir
|
| 39 |
+
self.extra_dat = extra_dat
|
| 40 |
+
|
| 41 |
+
@abstractmethod
|
| 42 |
+
def compile(self) -> None:
|
| 43 |
+
"""Compile the wrapper."""
|
| 44 |
+
pass
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_backend.pyi
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import abc
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from typing import Any, Final
|
| 4 |
+
|
| 5 |
+
class Backend(abc.ABC):
|
| 6 |
+
modulename: Final[str]
|
| 7 |
+
sources: Final[list[str | Path]]
|
| 8 |
+
extra_objects: Final[list[str]]
|
| 9 |
+
build_dir: Final[str | Path]
|
| 10 |
+
include_dirs: Final[list[str | Path]]
|
| 11 |
+
library_dirs: Final[list[str | Path]]
|
| 12 |
+
libraries: Final[list[str]]
|
| 13 |
+
define_macros: Final[list[tuple[str, str | None]]]
|
| 14 |
+
undef_macros: Final[list[str]]
|
| 15 |
+
f2py_flags: Final[list[str]]
|
| 16 |
+
sysinfo_flags: Final[list[str]]
|
| 17 |
+
fc_flags: Final[list[str]]
|
| 18 |
+
flib_flags: Final[list[str]]
|
| 19 |
+
setup_flags: Final[list[str]]
|
| 20 |
+
remove_build_dir: Final[bool]
|
| 21 |
+
extra_dat: Final[dict[str, Any]]
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
/,
|
| 26 |
+
modulename: str,
|
| 27 |
+
sources: list[str | Path],
|
| 28 |
+
extra_objects: list[str],
|
| 29 |
+
build_dir: str | Path,
|
| 30 |
+
include_dirs: list[str | Path],
|
| 31 |
+
library_dirs: list[str | Path],
|
| 32 |
+
libraries: list[str],
|
| 33 |
+
define_macros: list[tuple[str, str | None]],
|
| 34 |
+
undef_macros: list[str],
|
| 35 |
+
f2py_flags: list[str],
|
| 36 |
+
sysinfo_flags: list[str],
|
| 37 |
+
fc_flags: list[str],
|
| 38 |
+
flib_flags: list[str],
|
| 39 |
+
setup_flags: list[str],
|
| 40 |
+
remove_build_dir: bool,
|
| 41 |
+
extra_dat: dict[str, Any],
|
| 42 |
+
) -> None: ...
|
| 43 |
+
|
| 44 |
+
#
|
| 45 |
+
@abc.abstractmethod
|
| 46 |
+
def compile(self) -> None: ...
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_distutils.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import sys
|
| 4 |
+
import warnings
|
| 5 |
+
|
| 6 |
+
from numpy.distutils.core import Extension, setup
|
| 7 |
+
from numpy.distutils.misc_util import dict_append
|
| 8 |
+
from numpy.distutils.system_info import get_info
|
| 9 |
+
from numpy.exceptions import VisibleDeprecationWarning
|
| 10 |
+
|
| 11 |
+
from ._backend import Backend
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class DistutilsBackend(Backend):
|
| 15 |
+
def __init__(sef, *args, **kwargs):
|
| 16 |
+
warnings.warn(
|
| 17 |
+
"\ndistutils has been deprecated since NumPy 1.26.x\n"
|
| 18 |
+
"Use the Meson backend instead, or generate wrappers"
|
| 19 |
+
" without -c and use a custom build script",
|
| 20 |
+
VisibleDeprecationWarning,
|
| 21 |
+
stacklevel=2,
|
| 22 |
+
)
|
| 23 |
+
super().__init__(*args, **kwargs)
|
| 24 |
+
|
| 25 |
+
def compile(self):
|
| 26 |
+
num_info = {}
|
| 27 |
+
if num_info:
|
| 28 |
+
self.include_dirs.extend(num_info.get("include_dirs", []))
|
| 29 |
+
ext_args = {
|
| 30 |
+
"name": self.modulename,
|
| 31 |
+
"sources": self.sources,
|
| 32 |
+
"include_dirs": self.include_dirs,
|
| 33 |
+
"library_dirs": self.library_dirs,
|
| 34 |
+
"libraries": self.libraries,
|
| 35 |
+
"define_macros": self.define_macros,
|
| 36 |
+
"undef_macros": self.undef_macros,
|
| 37 |
+
"extra_objects": self.extra_objects,
|
| 38 |
+
"f2py_options": self.f2py_flags,
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if self.sysinfo_flags:
|
| 42 |
+
for n in self.sysinfo_flags:
|
| 43 |
+
i = get_info(n)
|
| 44 |
+
if not i:
|
| 45 |
+
print(
|
| 46 |
+
f"No {n!r} resources found"
|
| 47 |
+
"in system (try `f2py --help-link`)"
|
| 48 |
+
)
|
| 49 |
+
dict_append(ext_args, **i)
|
| 50 |
+
|
| 51 |
+
ext = Extension(**ext_args)
|
| 52 |
+
|
| 53 |
+
sys.argv = [sys.argv[0]] + self.setup_flags
|
| 54 |
+
sys.argv.extend(
|
| 55 |
+
[
|
| 56 |
+
"build",
|
| 57 |
+
"--build-temp",
|
| 58 |
+
self.build_dir,
|
| 59 |
+
"--build-base",
|
| 60 |
+
self.build_dir,
|
| 61 |
+
"--build-platlib",
|
| 62 |
+
".",
|
| 63 |
+
"--disable-optimization",
|
| 64 |
+
]
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
if self.fc_flags:
|
| 68 |
+
sys.argv.extend(["config_fc"] + self.fc_flags)
|
| 69 |
+
if self.flib_flags:
|
| 70 |
+
sys.argv.extend(["build_ext"] + self.flib_flags)
|
| 71 |
+
|
| 72 |
+
setup(ext_modules=[ext])
|
| 73 |
+
|
| 74 |
+
if self.remove_build_dir and os.path.exists(self.build_dir):
|
| 75 |
+
print(f"Removing build directory {self.build_dir}")
|
| 76 |
+
shutil.rmtree(self.build_dir)
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_distutils.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing_extensions import deprecated, override
|
| 2 |
+
|
| 3 |
+
from ._backend import Backend
|
| 4 |
+
|
| 5 |
+
class DistutilsBackend(Backend):
|
| 6 |
+
@deprecated(
|
| 7 |
+
"distutils has been deprecated since NumPy 1.26.x. Use the Meson backend instead, or generate wrappers without -c and "
|
| 8 |
+
"use a custom build script"
|
| 9 |
+
)
|
| 10 |
+
# NOTE: the `sef` typo matches runtime
|
| 11 |
+
def __init__(sef, *args: object, **kwargs: object) -> None: ...
|
| 12 |
+
@override
|
| 13 |
+
def compile(self) -> None: ...
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_meson.py
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import errno
|
| 2 |
+
import os
|
| 3 |
+
import re
|
| 4 |
+
import shutil
|
| 5 |
+
import subprocess
|
| 6 |
+
import sys
|
| 7 |
+
from itertools import chain
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from string import Template
|
| 10 |
+
|
| 11 |
+
from ._backend import Backend
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class MesonTemplate:
|
| 15 |
+
"""Template meson build file generation class."""
|
| 16 |
+
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
modulename: str,
|
| 20 |
+
sources: list[Path],
|
| 21 |
+
deps: list[str],
|
| 22 |
+
libraries: list[str],
|
| 23 |
+
library_dirs: list[Path],
|
| 24 |
+
include_dirs: list[Path],
|
| 25 |
+
object_files: list[Path],
|
| 26 |
+
linker_args: list[str],
|
| 27 |
+
fortran_args: list[str],
|
| 28 |
+
build_type: str,
|
| 29 |
+
python_exe: str,
|
| 30 |
+
):
|
| 31 |
+
self.modulename = modulename
|
| 32 |
+
self.build_template_path = (
|
| 33 |
+
Path(__file__).parent.absolute() / "meson.build.template"
|
| 34 |
+
)
|
| 35 |
+
self.sources = sources
|
| 36 |
+
self.deps = deps
|
| 37 |
+
self.libraries = libraries
|
| 38 |
+
self.library_dirs = library_dirs
|
| 39 |
+
if include_dirs is not None:
|
| 40 |
+
self.include_dirs = include_dirs
|
| 41 |
+
else:
|
| 42 |
+
self.include_dirs = []
|
| 43 |
+
self.substitutions = {}
|
| 44 |
+
self.objects = object_files
|
| 45 |
+
# Convert args to '' wrapped variant for meson
|
| 46 |
+
self.fortran_args = [
|
| 47 |
+
f"'{x}'" if not (x.startswith("'") and x.endswith("'")) else x
|
| 48 |
+
for x in fortran_args
|
| 49 |
+
]
|
| 50 |
+
self.pipeline = [
|
| 51 |
+
self.initialize_template,
|
| 52 |
+
self.sources_substitution,
|
| 53 |
+
self.deps_substitution,
|
| 54 |
+
self.include_substitution,
|
| 55 |
+
self.libraries_substitution,
|
| 56 |
+
self.fortran_args_substitution,
|
| 57 |
+
]
|
| 58 |
+
self.build_type = build_type
|
| 59 |
+
self.python_exe = python_exe
|
| 60 |
+
self.indent = " " * 21
|
| 61 |
+
|
| 62 |
+
def meson_build_template(self) -> str:
|
| 63 |
+
if not self.build_template_path.is_file():
|
| 64 |
+
raise FileNotFoundError(
|
| 65 |
+
errno.ENOENT,
|
| 66 |
+
"Meson build template"
|
| 67 |
+
f" {self.build_template_path.absolute()}"
|
| 68 |
+
" does not exist.",
|
| 69 |
+
)
|
| 70 |
+
return self.build_template_path.read_text()
|
| 71 |
+
|
| 72 |
+
def initialize_template(self) -> None:
|
| 73 |
+
self.substitutions["modulename"] = self.modulename
|
| 74 |
+
self.substitutions["buildtype"] = self.build_type
|
| 75 |
+
self.substitutions["python"] = self.python_exe
|
| 76 |
+
|
| 77 |
+
def sources_substitution(self) -> None:
|
| 78 |
+
self.substitutions["source_list"] = ",\n".join(
|
| 79 |
+
[f"{self.indent}'''{source}'''," for source in self.sources]
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
def deps_substitution(self) -> None:
|
| 83 |
+
self.substitutions["dep_list"] = f",\n{self.indent}".join(
|
| 84 |
+
[f"{self.indent}dependency('{dep}')," for dep in self.deps]
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
def libraries_substitution(self) -> None:
|
| 88 |
+
self.substitutions["lib_dir_declarations"] = "\n".join(
|
| 89 |
+
[
|
| 90 |
+
f"lib_dir_{i} = declare_dependency(link_args : ['''-L{lib_dir}'''])"
|
| 91 |
+
for i, lib_dir in enumerate(self.library_dirs)
|
| 92 |
+
]
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
self.substitutions["lib_declarations"] = "\n".join(
|
| 96 |
+
[
|
| 97 |
+
f"{lib.replace('.', '_')} = declare_dependency(link_args : ['-l{lib}'])"
|
| 98 |
+
for lib in self.libraries
|
| 99 |
+
]
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
self.substitutions["lib_list"] = f"\n{self.indent}".join(
|
| 103 |
+
[f"{self.indent}{lib.replace('.', '_')}," for lib in self.libraries]
|
| 104 |
+
)
|
| 105 |
+
self.substitutions["lib_dir_list"] = f"\n{self.indent}".join(
|
| 106 |
+
[f"{self.indent}lib_dir_{i}," for i in range(len(self.library_dirs))]
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
def include_substitution(self) -> None:
|
| 110 |
+
self.substitutions["inc_list"] = f",\n{self.indent}".join(
|
| 111 |
+
[f"{self.indent}'''{inc}'''," for inc in self.include_dirs]
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
def fortran_args_substitution(self) -> None:
|
| 115 |
+
if self.fortran_args:
|
| 116 |
+
self.substitutions["fortran_args"] = (
|
| 117 |
+
f"{self.indent}fortran_args: [{', '.join(list(self.fortran_args))}],"
|
| 118 |
+
)
|
| 119 |
+
else:
|
| 120 |
+
self.substitutions["fortran_args"] = ""
|
| 121 |
+
|
| 122 |
+
def generate_meson_build(self):
|
| 123 |
+
for node in self.pipeline:
|
| 124 |
+
node()
|
| 125 |
+
template = Template(self.meson_build_template())
|
| 126 |
+
meson_build = template.substitute(self.substitutions)
|
| 127 |
+
meson_build = meson_build.replace(",,", ",")
|
| 128 |
+
return meson_build
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
class MesonBackend(Backend):
|
| 132 |
+
def __init__(self, *args, **kwargs):
|
| 133 |
+
super().__init__(*args, **kwargs)
|
| 134 |
+
self.dependencies = self.extra_dat.get("dependencies", [])
|
| 135 |
+
self.meson_build_dir = "bbdir"
|
| 136 |
+
self.build_type = (
|
| 137 |
+
"debug" if any("debug" in flag for flag in self.fc_flags) else "release"
|
| 138 |
+
)
|
| 139 |
+
self.fc_flags = _get_flags(self.fc_flags)
|
| 140 |
+
|
| 141 |
+
def _move_exec_to_root(self, build_dir: Path):
|
| 142 |
+
walk_dir = Path(build_dir) / self.meson_build_dir
|
| 143 |
+
path_objects = chain(
|
| 144 |
+
walk_dir.glob(f"{self.modulename}*.so"),
|
| 145 |
+
walk_dir.glob(f"{self.modulename}*.pyd"),
|
| 146 |
+
walk_dir.glob(f"{self.modulename}*.dll"),
|
| 147 |
+
)
|
| 148 |
+
# Same behavior as distutils
|
| 149 |
+
# https://github.com/numpy/numpy/issues/24874#issuecomment-1835632293
|
| 150 |
+
for path_object in path_objects:
|
| 151 |
+
dest_path = Path.cwd() / path_object.name
|
| 152 |
+
if dest_path.exists():
|
| 153 |
+
dest_path.unlink()
|
| 154 |
+
shutil.copy2(path_object, dest_path)
|
| 155 |
+
os.remove(path_object)
|
| 156 |
+
|
| 157 |
+
def write_meson_build(self, build_dir: Path) -> None:
|
| 158 |
+
"""Writes the meson build file at specified location"""
|
| 159 |
+
meson_template = MesonTemplate(
|
| 160 |
+
self.modulename,
|
| 161 |
+
self.sources,
|
| 162 |
+
self.dependencies,
|
| 163 |
+
self.libraries,
|
| 164 |
+
self.library_dirs,
|
| 165 |
+
self.include_dirs,
|
| 166 |
+
self.extra_objects,
|
| 167 |
+
self.flib_flags,
|
| 168 |
+
self.fc_flags,
|
| 169 |
+
self.build_type,
|
| 170 |
+
sys.executable,
|
| 171 |
+
)
|
| 172 |
+
src = meson_template.generate_meson_build()
|
| 173 |
+
Path(build_dir).mkdir(parents=True, exist_ok=True)
|
| 174 |
+
meson_build_file = Path(build_dir) / "meson.build"
|
| 175 |
+
meson_build_file.write_text(src)
|
| 176 |
+
return meson_build_file
|
| 177 |
+
|
| 178 |
+
def _run_subprocess_command(self, command, cwd):
|
| 179 |
+
subprocess.run(command, cwd=cwd, check=True)
|
| 180 |
+
|
| 181 |
+
def run_meson(self, build_dir: Path):
|
| 182 |
+
setup_command = ["meson", "setup", self.meson_build_dir]
|
| 183 |
+
self._run_subprocess_command(setup_command, build_dir)
|
| 184 |
+
compile_command = ["meson", "compile", "-C", self.meson_build_dir]
|
| 185 |
+
self._run_subprocess_command(compile_command, build_dir)
|
| 186 |
+
|
| 187 |
+
def compile(self) -> None:
|
| 188 |
+
self.sources = _prepare_sources(self.modulename, self.sources, self.build_dir)
|
| 189 |
+
self.write_meson_build(self.build_dir)
|
| 190 |
+
self.run_meson(self.build_dir)
|
| 191 |
+
self._move_exec_to_root(self.build_dir)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def _prepare_sources(mname, sources, bdir):
|
| 195 |
+
extended_sources = sources.copy()
|
| 196 |
+
Path(bdir).mkdir(parents=True, exist_ok=True)
|
| 197 |
+
# Copy sources
|
| 198 |
+
for source in sources:
|
| 199 |
+
if Path(source).exists() and Path(source).is_file():
|
| 200 |
+
shutil.copy(source, bdir)
|
| 201 |
+
generated_sources = [
|
| 202 |
+
Path(f"{mname}module.c"),
|
| 203 |
+
Path(f"{mname}-f2pywrappers2.f90"),
|
| 204 |
+
Path(f"{mname}-f2pywrappers.f"),
|
| 205 |
+
]
|
| 206 |
+
bdir = Path(bdir)
|
| 207 |
+
for generated_source in generated_sources:
|
| 208 |
+
if generated_source.exists():
|
| 209 |
+
shutil.copy(generated_source, bdir / generated_source.name)
|
| 210 |
+
extended_sources.append(generated_source.name)
|
| 211 |
+
generated_source.unlink()
|
| 212 |
+
extended_sources = [
|
| 213 |
+
Path(source).name
|
| 214 |
+
for source in extended_sources
|
| 215 |
+
if not Path(source).suffix == ".pyf"
|
| 216 |
+
]
|
| 217 |
+
return extended_sources
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
def _get_flags(fc_flags):
|
| 221 |
+
flag_values = []
|
| 222 |
+
flag_pattern = re.compile(r"--f(77|90)flags=(.*)")
|
| 223 |
+
for flag in fc_flags:
|
| 224 |
+
match_result = flag_pattern.match(flag)
|
| 225 |
+
if match_result:
|
| 226 |
+
values = match_result.group(2).strip().split()
|
| 227 |
+
values = [val.strip("'\"") for val in values]
|
| 228 |
+
flag_values.extend(values)
|
| 229 |
+
# Hacky way to preserve order of flags
|
| 230 |
+
unique_flags = list(dict.fromkeys(flag_values))
|
| 231 |
+
return unique_flags
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/_meson.pyi
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Callable
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from typing import Final
|
| 4 |
+
from typing import Literal as L
|
| 5 |
+
|
| 6 |
+
from typing_extensions import override
|
| 7 |
+
|
| 8 |
+
from ._backend import Backend
|
| 9 |
+
|
| 10 |
+
class MesonTemplate:
|
| 11 |
+
modulename: Final[str]
|
| 12 |
+
build_template_path: Final[Path]
|
| 13 |
+
sources: Final[list[str | Path]]
|
| 14 |
+
deps: Final[list[str]]
|
| 15 |
+
libraries: Final[list[str]]
|
| 16 |
+
library_dirs: Final[list[str | Path]]
|
| 17 |
+
include_dirs: Final[list[str | Path]]
|
| 18 |
+
substitutions: Final[dict[str, str]]
|
| 19 |
+
objects: Final[list[str | Path]]
|
| 20 |
+
fortran_args: Final[list[str]]
|
| 21 |
+
pipeline: Final[list[Callable[[], None]]]
|
| 22 |
+
build_type: Final[str]
|
| 23 |
+
python_exe: Final[str]
|
| 24 |
+
indent: Final[str]
|
| 25 |
+
|
| 26 |
+
def __init__(
|
| 27 |
+
self,
|
| 28 |
+
/,
|
| 29 |
+
modulename: str,
|
| 30 |
+
sources: list[Path],
|
| 31 |
+
deps: list[str],
|
| 32 |
+
libraries: list[str],
|
| 33 |
+
library_dirs: list[str | Path],
|
| 34 |
+
include_dirs: list[str | Path],
|
| 35 |
+
object_files: list[str | Path],
|
| 36 |
+
linker_args: list[str],
|
| 37 |
+
fortran_args: list[str],
|
| 38 |
+
build_type: str,
|
| 39 |
+
python_exe: str,
|
| 40 |
+
) -> None: ...
|
| 41 |
+
|
| 42 |
+
#
|
| 43 |
+
def initialize_template(self) -> None: ...
|
| 44 |
+
def sources_substitution(self) -> None: ...
|
| 45 |
+
def deps_substitution(self) -> None: ...
|
| 46 |
+
def libraries_substitution(self) -> None: ...
|
| 47 |
+
def include_substitution(self) -> None: ...
|
| 48 |
+
def fortran_args_substitution(self) -> None: ...
|
| 49 |
+
|
| 50 |
+
#
|
| 51 |
+
def meson_build_template(self) -> str: ...
|
| 52 |
+
def generate_meson_build(self) -> str: ...
|
| 53 |
+
|
| 54 |
+
class MesonBackend(Backend):
|
| 55 |
+
dependencies: list[str]
|
| 56 |
+
meson_build_dir: L["bdir"]
|
| 57 |
+
build_type: L["debug", "release"]
|
| 58 |
+
|
| 59 |
+
def __init__(self, /, *args: object, **kwargs: object) -> None: ...
|
| 60 |
+
def write_meson_build(self, /, build_dir: Path) -> None: ...
|
| 61 |
+
def run_meson(self, /, build_dir: Path) -> None: ...
|
| 62 |
+
@override
|
| 63 |
+
def compile(self) -> None: ...
|
archive/.venv/Lib/site-packages/numpy/f2py/_backends/meson.build.template
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
project('${modulename}',
|
| 2 |
+
['c', 'fortran'],
|
| 3 |
+
version : '0.1',
|
| 4 |
+
meson_version: '>= 1.1.0',
|
| 5 |
+
default_options : [
|
| 6 |
+
'warning_level=1',
|
| 7 |
+
'buildtype=${buildtype}'
|
| 8 |
+
])
|
| 9 |
+
fc = meson.get_compiler('fortran')
|
| 10 |
+
|
| 11 |
+
py = import('python').find_installation('''${python}''', pure: false)
|
| 12 |
+
py_dep = py.dependency()
|
| 13 |
+
|
| 14 |
+
incdir_numpy = run_command(py,
|
| 15 |
+
['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
|
| 16 |
+
check : true
|
| 17 |
+
).stdout().strip()
|
| 18 |
+
|
| 19 |
+
incdir_f2py = run_command(py,
|
| 20 |
+
['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'],
|
| 21 |
+
check : true
|
| 22 |
+
).stdout().strip()
|
| 23 |
+
|
| 24 |
+
inc_np = include_directories(incdir_numpy)
|
| 25 |
+
np_dep = declare_dependency(include_directories: inc_np)
|
| 26 |
+
|
| 27 |
+
incdir_f2py = incdir_numpy / '..' / '..' / 'f2py' / 'src'
|
| 28 |
+
inc_f2py = include_directories(incdir_f2py)
|
| 29 |
+
fortranobject_c = incdir_f2py / 'fortranobject.c'
|
| 30 |
+
|
| 31 |
+
inc_np = include_directories(incdir_numpy, incdir_f2py)
|
| 32 |
+
# gh-25000
|
| 33 |
+
quadmath_dep = fc.find_library('quadmath', required: false)
|
| 34 |
+
|
| 35 |
+
${lib_declarations}
|
| 36 |
+
${lib_dir_declarations}
|
| 37 |
+
|
| 38 |
+
py.extension_module('${modulename}',
|
| 39 |
+
[
|
| 40 |
+
${source_list},
|
| 41 |
+
fortranobject_c
|
| 42 |
+
],
|
| 43 |
+
include_directories: [
|
| 44 |
+
inc_np,
|
| 45 |
+
${inc_list}
|
| 46 |
+
],
|
| 47 |
+
dependencies : [
|
| 48 |
+
py_dep,
|
| 49 |
+
quadmath_dep,
|
| 50 |
+
${dep_list}
|
| 51 |
+
${lib_list}
|
| 52 |
+
${lib_dir_list}
|
| 53 |
+
],
|
| 54 |
+
${fortran_args}
|
| 55 |
+
install : true)
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
|
| 3 |
+
from numpy.testing import IS_EDITABLE, IS_WASM
|
| 4 |
+
|
| 5 |
+
if IS_WASM:
|
| 6 |
+
pytest.skip(
|
| 7 |
+
"WASM/Pyodide does not use or support Fortran",
|
| 8 |
+
allow_module_level=True
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if IS_EDITABLE:
|
| 13 |
+
pytest.skip(
|
| 14 |
+
"Editable install doesn't support tests with a compile step",
|
| 15 |
+
allow_module_level=True
|
| 16 |
+
)
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/abstract_interface/foo.f90
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module ops_module
|
| 2 |
+
|
| 3 |
+
abstract interface
|
| 4 |
+
subroutine op(x, y, z)
|
| 5 |
+
integer, intent(in) :: x, y
|
| 6 |
+
integer, intent(out) :: z
|
| 7 |
+
end subroutine
|
| 8 |
+
end interface
|
| 9 |
+
|
| 10 |
+
contains
|
| 11 |
+
|
| 12 |
+
subroutine foo(x, y, r1, r2)
|
| 13 |
+
integer, intent(in) :: x, y
|
| 14 |
+
integer, intent(out) :: r1, r2
|
| 15 |
+
procedure (op) add1, add2
|
| 16 |
+
procedure (op), pointer::p
|
| 17 |
+
p=>add1
|
| 18 |
+
call p(x, y, r1)
|
| 19 |
+
p=>add2
|
| 20 |
+
call p(x, y, r2)
|
| 21 |
+
end subroutine
|
| 22 |
+
end module
|
| 23 |
+
|
| 24 |
+
subroutine add1(x, y, z)
|
| 25 |
+
integer, intent(in) :: x, y
|
| 26 |
+
integer, intent(out) :: z
|
| 27 |
+
z = x + y
|
| 28 |
+
end subroutine
|
| 29 |
+
|
| 30 |
+
subroutine add2(x, y, z)
|
| 31 |
+
integer, intent(in) :: x, y
|
| 32 |
+
integer, intent(out) :: z
|
| 33 |
+
z = x + 2 * y
|
| 34 |
+
end subroutine
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/abstract_interface/gh18403_mod.f90
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module test
|
| 2 |
+
abstract interface
|
| 3 |
+
subroutine foo()
|
| 4 |
+
end subroutine
|
| 5 |
+
end interface
|
| 6 |
+
end module test
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This file was auto-generated with f2py (version:2_1330) and hand edited by
|
| 3 |
+
* Pearu for testing purposes. Do not edit this file unless you know what you
|
| 4 |
+
* are doing!!!
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
#ifdef __cplusplus
|
| 8 |
+
extern "C" {
|
| 9 |
+
#endif
|
| 10 |
+
|
| 11 |
+
/*********************** See f2py2e/cfuncs.py: includes ***********************/
|
| 12 |
+
|
| 13 |
+
#define PY_SSIZE_T_CLEAN
|
| 14 |
+
#include <Python.h>
|
| 15 |
+
#include "fortranobject.h"
|
| 16 |
+
#include <math.h>
|
| 17 |
+
|
| 18 |
+
static PyObject *wrap_error;
|
| 19 |
+
static PyObject *wrap_module;
|
| 20 |
+
|
| 21 |
+
/************************************ call ************************************/
|
| 22 |
+
static char doc_f2py_rout_wrap_call[] = "\
|
| 23 |
+
Function signature:\n\
|
| 24 |
+
arr = call(type_num,dims,intent,obj)\n\
|
| 25 |
+
Required arguments:\n"
|
| 26 |
+
" type_num : input int\n"
|
| 27 |
+
" dims : input int-sequence\n"
|
| 28 |
+
" intent : input int\n"
|
| 29 |
+
" obj : input python object\n"
|
| 30 |
+
"Return objects:\n"
|
| 31 |
+
" arr : array";
|
| 32 |
+
static PyObject *f2py_rout_wrap_call(PyObject *capi_self,
|
| 33 |
+
PyObject *capi_args) {
|
| 34 |
+
PyObject * volatile capi_buildvalue = NULL;
|
| 35 |
+
int type_num = 0;
|
| 36 |
+
int elsize = 0;
|
| 37 |
+
npy_intp *dims = NULL;
|
| 38 |
+
PyObject *dims_capi = Py_None;
|
| 39 |
+
int rank = 0;
|
| 40 |
+
int intent = 0;
|
| 41 |
+
PyArrayObject *capi_arr_tmp = NULL;
|
| 42 |
+
PyObject *arr_capi = Py_None;
|
| 43 |
+
int i;
|
| 44 |
+
|
| 45 |
+
if (!PyArg_ParseTuple(capi_args,"iiOiO|:wrap.call",\
|
| 46 |
+
&type_num,&elsize,&dims_capi,&intent,&arr_capi))
|
| 47 |
+
return NULL;
|
| 48 |
+
rank = PySequence_Length(dims_capi);
|
| 49 |
+
dims = malloc(rank*sizeof(npy_intp));
|
| 50 |
+
for (i=0;i<rank;++i) {
|
| 51 |
+
PyObject *tmp;
|
| 52 |
+
tmp = PySequence_GetItem(dims_capi, i);
|
| 53 |
+
if (tmp == NULL) {
|
| 54 |
+
goto fail;
|
| 55 |
+
}
|
| 56 |
+
dims[i] = (npy_intp)PyLong_AsLong(tmp);
|
| 57 |
+
Py_DECREF(tmp);
|
| 58 |
+
if (dims[i] == -1 && PyErr_Occurred()) {
|
| 59 |
+
goto fail;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
capi_arr_tmp = ndarray_from_pyobj(type_num,elsize,dims,rank,intent|F2PY_INTENT_OUT,arr_capi,"wrap.call failed");
|
| 63 |
+
if (capi_arr_tmp == NULL) {
|
| 64 |
+
free(dims);
|
| 65 |
+
return NULL;
|
| 66 |
+
}
|
| 67 |
+
capi_buildvalue = Py_BuildValue("N",capi_arr_tmp);
|
| 68 |
+
free(dims);
|
| 69 |
+
return capi_buildvalue;
|
| 70 |
+
|
| 71 |
+
fail:
|
| 72 |
+
free(dims);
|
| 73 |
+
return NULL;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
static char doc_f2py_rout_wrap_attrs[] = "\
|
| 77 |
+
Function signature:\n\
|
| 78 |
+
arr = array_attrs(arr)\n\
|
| 79 |
+
Required arguments:\n"
|
| 80 |
+
" arr : input array object\n"
|
| 81 |
+
"Return objects:\n"
|
| 82 |
+
" data : data address in hex\n"
|
| 83 |
+
" nd : int\n"
|
| 84 |
+
" dimensions : tuple\n"
|
| 85 |
+
" strides : tuple\n"
|
| 86 |
+
" base : python object\n"
|
| 87 |
+
" (kind,type,type_num,elsize,alignment) : 4-tuple\n"
|
| 88 |
+
" flags : int\n"
|
| 89 |
+
" itemsize : int\n"
|
| 90 |
+
;
|
| 91 |
+
static PyObject *f2py_rout_wrap_attrs(PyObject *capi_self,
|
| 92 |
+
PyObject *capi_args) {
|
| 93 |
+
PyObject *arr_capi = Py_None;
|
| 94 |
+
PyArrayObject *arr = NULL;
|
| 95 |
+
PyObject *dimensions = NULL;
|
| 96 |
+
PyObject *strides = NULL;
|
| 97 |
+
char s[100];
|
| 98 |
+
int i;
|
| 99 |
+
memset(s,0,100);
|
| 100 |
+
if (!PyArg_ParseTuple(capi_args,"O!|:wrap.attrs",
|
| 101 |
+
&PyArray_Type,&arr_capi))
|
| 102 |
+
return NULL;
|
| 103 |
+
arr = (PyArrayObject *)arr_capi;
|
| 104 |
+
sprintf(s,"%p",PyArray_DATA(arr));
|
| 105 |
+
dimensions = PyTuple_New(PyArray_NDIM(arr));
|
| 106 |
+
strides = PyTuple_New(PyArray_NDIM(arr));
|
| 107 |
+
for (i=0;i<PyArray_NDIM(arr);++i) {
|
| 108 |
+
PyTuple_SetItem(dimensions,i,PyLong_FromLong(PyArray_DIM(arr,i)));
|
| 109 |
+
PyTuple_SetItem(strides,i,PyLong_FromLong(PyArray_STRIDE(arr,i)));
|
| 110 |
+
}
|
| 111 |
+
return Py_BuildValue("siNNO(cciii)ii",s,PyArray_NDIM(arr),
|
| 112 |
+
dimensions,strides,
|
| 113 |
+
(PyArray_BASE(arr)==NULL?Py_None:PyArray_BASE(arr)),
|
| 114 |
+
PyArray_DESCR(arr)->kind,
|
| 115 |
+
PyArray_DESCR(arr)->type,
|
| 116 |
+
PyArray_TYPE(arr),
|
| 117 |
+
PyArray_ITEMSIZE(arr),
|
| 118 |
+
PyDataType_ALIGNMENT(PyArray_DESCR(arr)),
|
| 119 |
+
PyArray_FLAGS(arr),
|
| 120 |
+
PyArray_ITEMSIZE(arr));
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
static PyMethodDef f2py_module_methods[] = {
|
| 124 |
+
|
| 125 |
+
{"call",f2py_rout_wrap_call,METH_VARARGS,doc_f2py_rout_wrap_call},
|
| 126 |
+
{"array_attrs",f2py_rout_wrap_attrs,METH_VARARGS,doc_f2py_rout_wrap_attrs},
|
| 127 |
+
{NULL,NULL}
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
static struct PyModuleDef moduledef = {
|
| 131 |
+
PyModuleDef_HEAD_INIT,
|
| 132 |
+
"test_array_from_pyobj_ext",
|
| 133 |
+
NULL,
|
| 134 |
+
-1,
|
| 135 |
+
f2py_module_methods,
|
| 136 |
+
NULL,
|
| 137 |
+
NULL,
|
| 138 |
+
NULL,
|
| 139 |
+
NULL
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
PyMODINIT_FUNC PyInit_test_array_from_pyobj_ext(void) {
|
| 143 |
+
PyObject *m,*d, *s;
|
| 144 |
+
m = wrap_module = PyModule_Create(&moduledef);
|
| 145 |
+
Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
|
| 146 |
+
import_array();
|
| 147 |
+
if (PyErr_Occurred())
|
| 148 |
+
Py_FatalError("can't initialize module wrap (failed to import numpy)");
|
| 149 |
+
d = PyModule_GetDict(m);
|
| 150 |
+
s = PyUnicode_FromString("This module 'wrap' is auto-generated with f2py (version:2_1330).\nFunctions:\n"
|
| 151 |
+
" arr = call(type_num,dims,intent,obj)\n"
|
| 152 |
+
".");
|
| 153 |
+
PyDict_SetItemString(d, "__doc__", s);
|
| 154 |
+
wrap_error = PyErr_NewException ("wrap.error", NULL, NULL);
|
| 155 |
+
Py_DECREF(s);
|
| 156 |
+
|
| 157 |
+
#define ADDCONST(NAME, CONST) \
|
| 158 |
+
s = PyLong_FromLong(CONST); \
|
| 159 |
+
PyDict_SetItemString(d, NAME, s); \
|
| 160 |
+
Py_DECREF(s)
|
| 161 |
+
|
| 162 |
+
ADDCONST("F2PY_INTENT_IN", F2PY_INTENT_IN);
|
| 163 |
+
ADDCONST("F2PY_INTENT_INOUT", F2PY_INTENT_INOUT);
|
| 164 |
+
ADDCONST("F2PY_INTENT_OUT", F2PY_INTENT_OUT);
|
| 165 |
+
ADDCONST("F2PY_INTENT_HIDE", F2PY_INTENT_HIDE);
|
| 166 |
+
ADDCONST("F2PY_INTENT_CACHE", F2PY_INTENT_CACHE);
|
| 167 |
+
ADDCONST("F2PY_INTENT_COPY", F2PY_INTENT_COPY);
|
| 168 |
+
ADDCONST("F2PY_INTENT_C", F2PY_INTENT_C);
|
| 169 |
+
ADDCONST("F2PY_OPTIONAL", F2PY_OPTIONAL);
|
| 170 |
+
ADDCONST("F2PY_INTENT_INPLACE", F2PY_INTENT_INPLACE);
|
| 171 |
+
ADDCONST("NPY_BOOL", NPY_BOOL);
|
| 172 |
+
ADDCONST("NPY_BYTE", NPY_BYTE);
|
| 173 |
+
ADDCONST("NPY_UBYTE", NPY_UBYTE);
|
| 174 |
+
ADDCONST("NPY_SHORT", NPY_SHORT);
|
| 175 |
+
ADDCONST("NPY_USHORT", NPY_USHORT);
|
| 176 |
+
ADDCONST("NPY_INT", NPY_INT);
|
| 177 |
+
ADDCONST("NPY_UINT", NPY_UINT);
|
| 178 |
+
ADDCONST("NPY_INTP", NPY_INTP);
|
| 179 |
+
ADDCONST("NPY_UINTP", NPY_UINTP);
|
| 180 |
+
ADDCONST("NPY_LONG", NPY_LONG);
|
| 181 |
+
ADDCONST("NPY_ULONG", NPY_ULONG);
|
| 182 |
+
ADDCONST("NPY_LONGLONG", NPY_LONGLONG);
|
| 183 |
+
ADDCONST("NPY_ULONGLONG", NPY_ULONGLONG);
|
| 184 |
+
ADDCONST("NPY_FLOAT", NPY_FLOAT);
|
| 185 |
+
ADDCONST("NPY_DOUBLE", NPY_DOUBLE);
|
| 186 |
+
ADDCONST("NPY_LONGDOUBLE", NPY_LONGDOUBLE);
|
| 187 |
+
ADDCONST("NPY_CFLOAT", NPY_CFLOAT);
|
| 188 |
+
ADDCONST("NPY_CDOUBLE", NPY_CDOUBLE);
|
| 189 |
+
ADDCONST("NPY_CLONGDOUBLE", NPY_CLONGDOUBLE);
|
| 190 |
+
ADDCONST("NPY_OBJECT", NPY_OBJECT);
|
| 191 |
+
ADDCONST("NPY_STRING", NPY_STRING);
|
| 192 |
+
ADDCONST("NPY_UNICODE", NPY_UNICODE);
|
| 193 |
+
ADDCONST("NPY_VOID", NPY_VOID);
|
| 194 |
+
ADDCONST("NPY_NTYPES_LEGACY", NPY_NTYPES_LEGACY);
|
| 195 |
+
ADDCONST("NPY_NOTYPE", NPY_NOTYPE);
|
| 196 |
+
ADDCONST("NPY_USERDEF", NPY_USERDEF);
|
| 197 |
+
|
| 198 |
+
ADDCONST("CONTIGUOUS", NPY_ARRAY_C_CONTIGUOUS);
|
| 199 |
+
ADDCONST("FORTRAN", NPY_ARRAY_F_CONTIGUOUS);
|
| 200 |
+
ADDCONST("OWNDATA", NPY_ARRAY_OWNDATA);
|
| 201 |
+
ADDCONST("FORCECAST", NPY_ARRAY_FORCECAST);
|
| 202 |
+
ADDCONST("ENSURECOPY", NPY_ARRAY_ENSURECOPY);
|
| 203 |
+
ADDCONST("ENSUREARRAY", NPY_ARRAY_ENSUREARRAY);
|
| 204 |
+
ADDCONST("ALIGNED", NPY_ARRAY_ALIGNED);
|
| 205 |
+
ADDCONST("WRITEABLE", NPY_ARRAY_WRITEABLE);
|
| 206 |
+
ADDCONST("WRITEBACKIFCOPY", NPY_ARRAY_WRITEBACKIFCOPY);
|
| 207 |
+
|
| 208 |
+
ADDCONST("BEHAVED", NPY_ARRAY_BEHAVED);
|
| 209 |
+
ADDCONST("BEHAVED_NS", NPY_ARRAY_BEHAVED_NS);
|
| 210 |
+
ADDCONST("CARRAY", NPY_ARRAY_CARRAY);
|
| 211 |
+
ADDCONST("FARRAY", NPY_ARRAY_FARRAY);
|
| 212 |
+
ADDCONST("CARRAY_RO", NPY_ARRAY_CARRAY_RO);
|
| 213 |
+
ADDCONST("FARRAY_RO", NPY_ARRAY_FARRAY_RO);
|
| 214 |
+
ADDCONST("DEFAULT", NPY_ARRAY_DEFAULT);
|
| 215 |
+
ADDCONST("UPDATE_ALL", NPY_ARRAY_UPDATE_ALL);
|
| 216 |
+
|
| 217 |
+
#undef ADDCONST
|
| 218 |
+
|
| 219 |
+
if (PyErr_Occurred())
|
| 220 |
+
Py_FatalError("can't initialize module wrap");
|
| 221 |
+
|
| 222 |
+
#ifdef F2PY_REPORT_ATEXIT
|
| 223 |
+
on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call");
|
| 224 |
+
#endif
|
| 225 |
+
|
| 226 |
+
#if Py_GIL_DISABLED
|
| 227 |
+
// signal whether this module supports running with the GIL disabled
|
| 228 |
+
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
| 229 |
+
#endif
|
| 230 |
+
|
| 231 |
+
return m;
|
| 232 |
+
}
|
| 233 |
+
#ifdef __cplusplus
|
| 234 |
+
}
|
| 235 |
+
#endif
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
dict(real=dict(rk="double"))
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_free.f90
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
subroutine sum(x, res)
|
| 3 |
+
implicit none
|
| 4 |
+
real, intent(in) :: x(:)
|
| 5 |
+
real, intent(out) :: res
|
| 6 |
+
|
| 7 |
+
integer :: i
|
| 8 |
+
|
| 9 |
+
!print *, "sum: size(x) = ", size(x)
|
| 10 |
+
|
| 11 |
+
res = 0.0
|
| 12 |
+
|
| 13 |
+
do i = 1, size(x)
|
| 14 |
+
res = res + x(i)
|
| 15 |
+
enddo
|
| 16 |
+
|
| 17 |
+
end subroutine sum
|
| 18 |
+
|
| 19 |
+
function fsum(x) result (res)
|
| 20 |
+
implicit none
|
| 21 |
+
real, intent(in) :: x(:)
|
| 22 |
+
real :: res
|
| 23 |
+
|
| 24 |
+
integer :: i
|
| 25 |
+
|
| 26 |
+
!print *, "fsum: size(x) = ", size(x)
|
| 27 |
+
|
| 28 |
+
res = 0.0
|
| 29 |
+
|
| 30 |
+
do i = 1, size(x)
|
| 31 |
+
res = res + x(i)
|
| 32 |
+
enddo
|
| 33 |
+
|
| 34 |
+
end function fsum
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_mod.f90
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module mod
|
| 3 |
+
|
| 4 |
+
contains
|
| 5 |
+
|
| 6 |
+
subroutine sum(x, res)
|
| 7 |
+
implicit none
|
| 8 |
+
real, intent(in) :: x(:)
|
| 9 |
+
real, intent(out) :: res
|
| 10 |
+
|
| 11 |
+
integer :: i
|
| 12 |
+
|
| 13 |
+
!print *, "sum: size(x) = ", size(x)
|
| 14 |
+
|
| 15 |
+
res = 0.0
|
| 16 |
+
|
| 17 |
+
do i = 1, size(x)
|
| 18 |
+
res = res + x(i)
|
| 19 |
+
enddo
|
| 20 |
+
|
| 21 |
+
end subroutine sum
|
| 22 |
+
|
| 23 |
+
function fsum(x) result (res)
|
| 24 |
+
implicit none
|
| 25 |
+
real, intent(in) :: x(:)
|
| 26 |
+
real :: res
|
| 27 |
+
|
| 28 |
+
integer :: i
|
| 29 |
+
|
| 30 |
+
!print *, "fsum: size(x) = ", size(x)
|
| 31 |
+
|
| 32 |
+
res = 0.0
|
| 33 |
+
|
| 34 |
+
do i = 1, size(x)
|
| 35 |
+
res = res + x(i)
|
| 36 |
+
enddo
|
| 37 |
+
|
| 38 |
+
end function fsum
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
end module mod
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/foo_use.f90
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
subroutine sum_with_use(x, res)
|
| 2 |
+
use precision
|
| 3 |
+
|
| 4 |
+
implicit none
|
| 5 |
+
|
| 6 |
+
real(kind=rk), intent(in) :: x(:)
|
| 7 |
+
real(kind=rk), intent(out) :: res
|
| 8 |
+
|
| 9 |
+
integer :: i
|
| 10 |
+
|
| 11 |
+
!print *, "size(x) = ", size(x)
|
| 12 |
+
|
| 13 |
+
res = 0.0
|
| 14 |
+
|
| 15 |
+
do i = 1, size(x)
|
| 16 |
+
res = res + x(i)
|
| 17 |
+
enddo
|
| 18 |
+
|
| 19 |
+
end subroutine
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/assumed_shape/precision.f90
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module precision
|
| 2 |
+
integer, parameter :: rk = selected_real_kind(8)
|
| 3 |
+
integer, parameter :: ik = selected_real_kind(4)
|
| 4 |
+
end module
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/block_docstring/foo.f
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUBROUTINE FOO()
|
| 2 |
+
INTEGER BAR(2, 3)
|
| 3 |
+
|
| 4 |
+
COMMON /BLOCK/ BAR
|
| 5 |
+
RETURN
|
| 6 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/foo.f
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
subroutine t(fun,a)
|
| 2 |
+
integer a
|
| 3 |
+
cf2py intent(out) a
|
| 4 |
+
external fun
|
| 5 |
+
call fun(a)
|
| 6 |
+
end
|
| 7 |
+
|
| 8 |
+
subroutine func(a)
|
| 9 |
+
cf2py intent(in,out) a
|
| 10 |
+
integer a
|
| 11 |
+
a = a + 11
|
| 12 |
+
end
|
| 13 |
+
|
| 14 |
+
subroutine func0(a)
|
| 15 |
+
cf2py intent(out) a
|
| 16 |
+
integer a
|
| 17 |
+
a = 11
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
subroutine t2(a)
|
| 21 |
+
cf2py intent(callback) fun
|
| 22 |
+
integer a
|
| 23 |
+
cf2py intent(out) a
|
| 24 |
+
external fun
|
| 25 |
+
call fun(a)
|
| 26 |
+
end
|
| 27 |
+
|
| 28 |
+
subroutine string_callback(callback, a)
|
| 29 |
+
external callback
|
| 30 |
+
double precision callback
|
| 31 |
+
double precision a
|
| 32 |
+
character*1 r
|
| 33 |
+
cf2py intent(out) a
|
| 34 |
+
r = 'r'
|
| 35 |
+
a = callback(r)
|
| 36 |
+
end
|
| 37 |
+
|
| 38 |
+
subroutine string_callback_array(callback, cu, lencu, a)
|
| 39 |
+
external callback
|
| 40 |
+
integer callback
|
| 41 |
+
integer lencu
|
| 42 |
+
character*8 cu(lencu)
|
| 43 |
+
integer a
|
| 44 |
+
cf2py intent(out) a
|
| 45 |
+
|
| 46 |
+
a = callback(cu, lencu)
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
subroutine hidden_callback(a, r)
|
| 50 |
+
external global_f
|
| 51 |
+
cf2py intent(callback, hide) global_f
|
| 52 |
+
integer a, r, global_f
|
| 53 |
+
cf2py intent(out) r
|
| 54 |
+
r = global_f(a)
|
| 55 |
+
end
|
| 56 |
+
|
| 57 |
+
subroutine hidden_callback2(a, r)
|
| 58 |
+
external global_f
|
| 59 |
+
integer a, r, global_f
|
| 60 |
+
cf2py intent(out) r
|
| 61 |
+
r = global_f(a)
|
| 62 |
+
end
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh17797.f90
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function gh17797(f, y) result(r)
|
| 2 |
+
external f
|
| 3 |
+
integer(8) :: r, f
|
| 4 |
+
integer(8), dimension(:) :: y
|
| 5 |
+
r = f(0)
|
| 6 |
+
r = r + sum(y)
|
| 7 |
+
end function gh17797
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh18335.f90
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
! When gh18335_workaround is defined as an extension,
|
| 2 |
+
! the issue cannot be reproduced.
|
| 3 |
+
!subroutine gh18335_workaround(f, y)
|
| 4 |
+
! implicit none
|
| 5 |
+
! external f
|
| 6 |
+
! integer(kind=1) :: y(1)
|
| 7 |
+
! call f(y)
|
| 8 |
+
!end subroutine gh18335_workaround
|
| 9 |
+
|
| 10 |
+
function gh18335(f) result (r)
|
| 11 |
+
implicit none
|
| 12 |
+
external f
|
| 13 |
+
integer(kind=1) :: y(1), r
|
| 14 |
+
y(1) = 123
|
| 15 |
+
call f(y)
|
| 16 |
+
r = y(1)
|
| 17 |
+
end function gh18335
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh25211.f
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUBROUTINE FOO(FUN,R)
|
| 2 |
+
EXTERNAL FUN
|
| 3 |
+
INTEGER I
|
| 4 |
+
REAL*8 R, FUN
|
| 5 |
+
Cf2py intent(out) r
|
| 6 |
+
R = 0D0
|
| 7 |
+
DO I=-5,5
|
| 8 |
+
R = R + FUN(I)
|
| 9 |
+
ENDDO
|
| 10 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh25211.pyf
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python module __user__routines
|
| 2 |
+
interface
|
| 3 |
+
function fun(i) result (r)
|
| 4 |
+
integer :: i
|
| 5 |
+
real*8 :: r
|
| 6 |
+
end function fun
|
| 7 |
+
end interface
|
| 8 |
+
end python module __user__routines
|
| 9 |
+
|
| 10 |
+
python module callback2
|
| 11 |
+
interface
|
| 12 |
+
subroutine foo(f,r)
|
| 13 |
+
use __user__routines, f=>fun
|
| 14 |
+
external f
|
| 15 |
+
real*8 intent(out) :: r
|
| 16 |
+
end subroutine foo
|
| 17 |
+
end interface
|
| 18 |
+
end python module callback2
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/callback/gh26681.f90
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module utils
|
| 2 |
+
implicit none
|
| 3 |
+
contains
|
| 4 |
+
subroutine my_abort(message)
|
| 5 |
+
implicit none
|
| 6 |
+
character(len=*), intent(in) :: message
|
| 7 |
+
!f2py callstatement PyErr_SetString(PyExc_ValueError, message);f2py_success = 0;
|
| 8 |
+
!f2py callprotoargument char*
|
| 9 |
+
write(0,*) "THIS SHOULD NOT APPEAR"
|
| 10 |
+
stop 1
|
| 11 |
+
end subroutine my_abort
|
| 12 |
+
|
| 13 |
+
subroutine do_something(message)
|
| 14 |
+
!f2py intent(callback, hide) mypy_abort
|
| 15 |
+
character(len=*), intent(in) :: message
|
| 16 |
+
call mypy_abort(message)
|
| 17 |
+
end subroutine do_something
|
| 18 |
+
end module utils
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/gh_22819.pyf
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python module test_22819
|
| 2 |
+
interface
|
| 3 |
+
subroutine hello()
|
| 4 |
+
end subroutine hello
|
| 5 |
+
end interface
|
| 6 |
+
end python module test_22819
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/hi77.f
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUBROUTINE HI
|
| 2 |
+
PRINT*, "HELLO WORLD"
|
| 3 |
+
END SUBROUTINE
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/cli/hiworld.f90
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function hi()
|
| 2 |
+
print*, "Hello World"
|
| 3 |
+
end function
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/common/block.f
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUBROUTINE INITCB
|
| 2 |
+
DOUBLE PRECISION LONG
|
| 3 |
+
CHARACTER STRING
|
| 4 |
+
INTEGER OK
|
| 5 |
+
|
| 6 |
+
COMMON /BLOCK/ LONG, STRING, OK
|
| 7 |
+
LONG = 1.0
|
| 8 |
+
STRING = '2'
|
| 9 |
+
OK = 3
|
| 10 |
+
RETURN
|
| 11 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/common/gh19161.f90
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module typedefmod
|
| 2 |
+
use iso_fortran_env, only: real32
|
| 3 |
+
end module typedefmod
|
| 4 |
+
|
| 5 |
+
module data
|
| 6 |
+
use typedefmod, only: real32
|
| 7 |
+
implicit none
|
| 8 |
+
real(kind=real32) :: x
|
| 9 |
+
common/test/x
|
| 10 |
+
end module data
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/accesstype.f90
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
public
|
| 3 |
+
type, private, bind(c) :: a
|
| 4 |
+
integer :: i
|
| 5 |
+
end type a
|
| 6 |
+
type, bind(c) :: b_
|
| 7 |
+
integer :: j
|
| 8 |
+
end type b_
|
| 9 |
+
public :: b_
|
| 10 |
+
type :: c
|
| 11 |
+
integer :: k
|
| 12 |
+
end type c
|
| 13 |
+
end module foo
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/common_with_division.f
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
subroutine common_with_division
|
| 2 |
+
integer lmu,lb,lub,lpmin
|
| 3 |
+
parameter (lmu=1)
|
| 4 |
+
parameter (lb=20)
|
| 5 |
+
c crackfortran fails to parse this
|
| 6 |
+
c parameter (lub=(lb-1)*lmu+1)
|
| 7 |
+
c crackfortran can successfully parse this though
|
| 8 |
+
parameter (lub=lb*lmu-lmu+1)
|
| 9 |
+
parameter (lpmin=2)
|
| 10 |
+
|
| 11 |
+
c crackfortran fails to parse this correctly
|
| 12 |
+
c common /mortmp/ ctmp((lub*(lub+1)*(lub+1))/lpmin+1)
|
| 13 |
+
|
| 14 |
+
common /mortmp/ ctmp(lub/lpmin+1)
|
| 15 |
+
|
| 16 |
+
return
|
| 17 |
+
end
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_common.f
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BLOCK DATA PARAM_INI
|
| 2 |
+
COMMON /MYCOM/ MYDATA
|
| 3 |
+
DATA MYDATA /0/
|
| 4 |
+
END
|
| 5 |
+
SUBROUTINE SUB1
|
| 6 |
+
COMMON /MYCOM/ MYDATA
|
| 7 |
+
MYDATA = MYDATA + 1
|
| 8 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_multiplier.f
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BLOCK DATA MYBLK
|
| 2 |
+
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
|
| 3 |
+
COMMON /MYCOM/ IVAR1, IVAR2, IVAR3, IVAR4, EVAR5
|
| 4 |
+
DATA IVAR1, IVAR2, IVAR3, IVAR4, EVAR5 /2*3,2*2,0.0D0/
|
| 5 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_stmts.f90
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
! gh-23276
|
| 2 |
+
module cmplxdat
|
| 3 |
+
implicit none
|
| 4 |
+
integer :: i, j
|
| 5 |
+
real :: x, y
|
| 6 |
+
real, dimension(2) :: z
|
| 7 |
+
real(kind=8) :: pi
|
| 8 |
+
complex(kind=8), target :: medium_ref_index
|
| 9 |
+
complex(kind=8), target :: ref_index_one, ref_index_two
|
| 10 |
+
complex(kind=8), dimension(2) :: my_array
|
| 11 |
+
real(kind=8), dimension(3) :: my_real_array = (/1.0d0, 2.0d0, 3.0d0/)
|
| 12 |
+
|
| 13 |
+
data i, j / 2, 3 /
|
| 14 |
+
data x, y / 1.5, 2.0 /
|
| 15 |
+
data z / 3.5, 7.0 /
|
| 16 |
+
data medium_ref_index / (1.d0, 0.d0) /
|
| 17 |
+
data ref_index_one, ref_index_two / (13.0d0, 21.0d0), (-30.0d0, 43.0d0) /
|
| 18 |
+
data my_array / (1.0d0, 2.0d0), (-3.0d0, 4.0d0) /
|
| 19 |
+
data pi / 3.1415926535897932384626433832795028841971693993751058209749445923078164062d0 /
|
| 20 |
+
end module cmplxdat
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/data_with_comments.f
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BLOCK DATA PARAM_INI
|
| 2 |
+
COMMON /MYCOM/ MYTAB
|
| 3 |
+
INTEGER MYTAB(3)
|
| 4 |
+
DATA MYTAB/
|
| 5 |
+
* 0, ! 1 and more commenty stuff
|
| 6 |
+
* 4, ! 2
|
| 7 |
+
* 0 /
|
| 8 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/foo_deps.f90
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
type bar
|
| 3 |
+
character(len = 4) :: text
|
| 4 |
+
end type bar
|
| 5 |
+
type(bar), parameter :: abar = bar('abar')
|
| 6 |
+
end module foo
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh15035.f
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
subroutine subb(k)
|
| 2 |
+
real(8), intent(inout) :: k(:)
|
| 3 |
+
k=k+1
|
| 4 |
+
endsubroutine
|
| 5 |
+
|
| 6 |
+
subroutine subc(w,k)
|
| 7 |
+
real(8), intent(in) :: w(:)
|
| 8 |
+
real(8), intent(out) :: k(size(w))
|
| 9 |
+
k=w+1
|
| 10 |
+
endsubroutine
|
| 11 |
+
|
| 12 |
+
function t0(value)
|
| 13 |
+
character value
|
| 14 |
+
character t0
|
| 15 |
+
t0 = value
|
| 16 |
+
endfunction
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh17859.f
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
integer(8) function external_as_statement(fcn)
|
| 2 |
+
implicit none
|
| 3 |
+
external fcn
|
| 4 |
+
integer(8) :: fcn
|
| 5 |
+
external_as_statement = fcn(0)
|
| 6 |
+
end
|
| 7 |
+
|
| 8 |
+
integer(8) function external_as_attribute(fcn)
|
| 9 |
+
implicit none
|
| 10 |
+
integer(8), external :: fcn
|
| 11 |
+
external_as_attribute = fcn(0)
|
| 12 |
+
end
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh22648.pyf
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python module iri16py ! in
|
| 2 |
+
interface ! in :iri16py
|
| 3 |
+
block data ! in :iri16py:iridreg_modified.for
|
| 4 |
+
COMMON /fircom/ eden,tabhe,tabla,tabmo,tabza,tabfl
|
| 5 |
+
end block data
|
| 6 |
+
end interface
|
| 7 |
+
end python module iri16py
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23533.f
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUBROUTINE EXAMPLE( )
|
| 2 |
+
IF( .TRUE. ) THEN
|
| 3 |
+
CALL DO_SOMETHING()
|
| 4 |
+
END IF ! ** .TRUE. **
|
| 5 |
+
END
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23598.f90
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
integer function intproduct(a, b) result(res)
|
| 2 |
+
integer, intent(in) :: a, b
|
| 3 |
+
res = a*b
|
| 4 |
+
end function
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23598Warn.f90
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module test_bug
|
| 2 |
+
implicit none
|
| 3 |
+
private
|
| 4 |
+
public :: intproduct
|
| 5 |
+
|
| 6 |
+
contains
|
| 7 |
+
integer function intproduct(a, b) result(res)
|
| 8 |
+
integer, intent(in) :: a, b
|
| 9 |
+
res = a*b
|
| 10 |
+
end function
|
| 11 |
+
end module
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh23879.f90
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module gh23879
|
| 2 |
+
implicit none
|
| 3 |
+
private
|
| 4 |
+
public :: foo
|
| 5 |
+
|
| 6 |
+
contains
|
| 7 |
+
|
| 8 |
+
subroutine foo(a, b)
|
| 9 |
+
integer, intent(in) :: a
|
| 10 |
+
integer, intent(out) :: b
|
| 11 |
+
b = a
|
| 12 |
+
call bar(b)
|
| 13 |
+
end subroutine
|
| 14 |
+
|
| 15 |
+
subroutine bar(x)
|
| 16 |
+
integer, intent(inout) :: x
|
| 17 |
+
x = 2*x
|
| 18 |
+
end subroutine
|
| 19 |
+
|
| 20 |
+
end module gh23879
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh27697.f90
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module utils
|
| 2 |
+
implicit none
|
| 3 |
+
contains
|
| 4 |
+
subroutine my_abort(message)
|
| 5 |
+
implicit none
|
| 6 |
+
character(len=*), intent(in) :: message
|
| 7 |
+
!f2py callstatement PyErr_SetString(PyExc_ValueError, message);f2py_success = 0;
|
| 8 |
+
!f2py callprotoargument char*
|
| 9 |
+
write(0,*) "THIS SHOULD NOT APPEAR"
|
| 10 |
+
stop 1
|
| 11 |
+
end subroutine my_abort
|
| 12 |
+
end module utils
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/gh2848.f90
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
subroutine gh2848( &
|
| 2 |
+
! first 2 parameters
|
| 3 |
+
par1, par2,&
|
| 4 |
+
! last 2 parameters
|
| 5 |
+
par3, par4)
|
| 6 |
+
|
| 7 |
+
integer, intent(in) :: par1, par2
|
| 8 |
+
integer, intent(out) :: par3, par4
|
| 9 |
+
|
| 10 |
+
par3 = par1
|
| 11 |
+
par4 = par2
|
| 12 |
+
|
| 13 |
+
end subroutine gh2848
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/operators.f90
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
type bar
|
| 3 |
+
character(len = 32) :: item
|
| 4 |
+
end type bar
|
| 5 |
+
interface operator(.item.)
|
| 6 |
+
module procedure item_int, item_real
|
| 7 |
+
end interface operator(.item.)
|
| 8 |
+
interface operator(==)
|
| 9 |
+
module procedure items_are_equal
|
| 10 |
+
end interface operator(==)
|
| 11 |
+
interface assignment(=)
|
| 12 |
+
module procedure get_int, get_real
|
| 13 |
+
end interface assignment(=)
|
| 14 |
+
contains
|
| 15 |
+
function item_int(val) result(elem)
|
| 16 |
+
integer, intent(in) :: val
|
| 17 |
+
type(bar) :: elem
|
| 18 |
+
|
| 19 |
+
write(elem%item, "(I32)") val
|
| 20 |
+
end function item_int
|
| 21 |
+
|
| 22 |
+
function item_real(val) result(elem)
|
| 23 |
+
real, intent(in) :: val
|
| 24 |
+
type(bar) :: elem
|
| 25 |
+
|
| 26 |
+
write(elem%item, "(1PE32.12)") val
|
| 27 |
+
end function item_real
|
| 28 |
+
|
| 29 |
+
function items_are_equal(val1, val2) result(equal)
|
| 30 |
+
type(bar), intent(in) :: val1, val2
|
| 31 |
+
logical :: equal
|
| 32 |
+
|
| 33 |
+
equal = (val1%item == val2%item)
|
| 34 |
+
end function items_are_equal
|
| 35 |
+
|
| 36 |
+
subroutine get_real(rval, item)
|
| 37 |
+
real, intent(out) :: rval
|
| 38 |
+
type(bar), intent(in) :: item
|
| 39 |
+
|
| 40 |
+
read(item%item, *) rval
|
| 41 |
+
end subroutine get_real
|
| 42 |
+
|
| 43 |
+
subroutine get_int(rval, item)
|
| 44 |
+
integer, intent(out) :: rval
|
| 45 |
+
type(bar), intent(in) :: item
|
| 46 |
+
|
| 47 |
+
read(item%item, *) rval
|
| 48 |
+
end subroutine get_int
|
| 49 |
+
end module foo
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/privatemod.f90
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
private
|
| 3 |
+
integer :: a
|
| 4 |
+
public :: setA
|
| 5 |
+
integer :: b
|
| 6 |
+
contains
|
| 7 |
+
subroutine setA(v)
|
| 8 |
+
integer, intent(in) :: v
|
| 9 |
+
a = v
|
| 10 |
+
end subroutine setA
|
| 11 |
+
end module foo
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/publicmod.f90
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
public
|
| 3 |
+
integer, private :: a
|
| 4 |
+
public :: setA
|
| 5 |
+
contains
|
| 6 |
+
subroutine setA(v)
|
| 7 |
+
integer, intent(in) :: v
|
| 8 |
+
a = v
|
| 9 |
+
end subroutine setA
|
| 10 |
+
end module foo
|
archive/.venv/Lib/site-packages/numpy/f2py/tests/src/crackfortran/pubprivmod.f90
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module foo
|
| 2 |
+
public
|
| 3 |
+
integer, private :: a
|
| 4 |
+
integer :: b
|
| 5 |
+
contains
|
| 6 |
+
subroutine setA(v)
|
| 7 |
+
integer, intent(in) :: v
|
| 8 |
+
a = v
|
| 9 |
+
end subroutine setA
|
| 10 |
+
end module foo
|