Example #1
0
def get_cymod_docstring(ast, modname):
    from fwrap.version import get_version
    from fwrap.gen_config import all_dtypes
    dstring = ("""\
The %s module was generated with Fwrap v%s.

Below is a listing of functions and data types.
For usage information see the function docstrings.

""" % (modname, get_version())).splitlines()
    dstring += ["Functions",
                "---------"]
    # Functions
    names = sorted(["%s(...)" % proc.name for proc in ast])
    dstring += names

    dstring += [""]

    dstring += ["Data Types",
                "----------"]
    # Datatypes
    dts = all_dtypes(ast)
    names = sorted([dt.py_type_name() for dt in dts])
    dstring += names

    return dstring
Example #2
0
def get_cymod_docstring(ast, modname):
    from fwrap.version import get_version
    from fwrap.gen_config import all_dtypes
    dstring = ("""\
The %s module was generated with Fwrap v%s.

Below is a listing of functions and data types.
For usage information see the function docstrings.

""" % (modname, get_version())).splitlines()
    dstring += ["Functions",
                "---------"]
    # Functions
    names = sorted(["%s(...)" % proc.name for proc in ast])
    dstring += names

    dstring += [""]

    dstring += ["Data Types",
                "----------"]
    # Datatypes
    dts = all_dtypes(ast)
    names = sorted([dt.py_type_name() for dt in dts])
    dstring += names

    return dstring
Example #3
0
File: main.py Project: certik/fwrap
def print_version():
    vandl = """\
fwrap v%s
Copyright (C) 2010 Kurt W. Smith
Fwrap is distributed under an open-source license.   See the source for
licensing information.  There is NO warranty, not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
""" % get_version()
    print vandl
Example #4
0
def print_version():
    from fwrap.version import get_version
    vandl = """\
fwrap v%s
Copyright (C) 2010 Kurt W. Smith
Fwrap is distributed under an open-source license.   See the source for
licensing information.  There is NO warranty, not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
""" % get_version()
    print vandl
Example #5
0
    def test_generate_cy_pyx(self):
        from fwrap.version import get_version
        fort_ast = main.parse(self.source_file_lst)
        c_ast = fc_wrap.wrap_pyf_iface(fort_ast)
        cython_ast = cy_wrap.wrap_fc(c_ast)
        fname, buf = main.generate_cy_pyx(cython_ast, self.name)
        test_str = '''\
"""
The test module was generated with Fwrap v%s.

Below is a listing of functions and data types.
For usage information see the function docstrings.

Functions
---------
empty_func(...)

Data Types
----------
fw_character
fwi_integer

"""
np.import_array()
include 'fwrap_ktp.pxi'
cdef extern from "string.h":
    void *memcpy(void *dest, void *src, size_t n)
cpdef api object empty_func():
    """
    empty_func() -> fw_ret_arg

    Parameters
    ----------
    None

    Returns
    -------
    fw_ret_arg : fwi_integer, intent out

    """
    cdef fwi_integer_t fw_ret_arg
    cdef fwi_integer_t fw_iserr__
    cdef fw_character_t fw_errstr__[fw_errstr_len]
    empty_func_c(&fw_ret_arg, &fw_iserr__, fw_errstr__)
    if fw_iserr__ != FW_NO_ERR__:
        raise RuntimeError("an error was encountered when calling the 'empty_func' wrapper.")
    return fw_ret_arg
''' % get_version()
        compare(test_str, buf.getvalue())
Example #6
0
    def test_generate_cy_pyx(self):
        from fwrap.version import get_version
        fort_ast = fwrapper.parse(self.source_file_lst)
        c_ast = fc_wrap.wrap_pyf_iface(fort_ast)
        cython_ast = cy_wrap.wrap_fc(c_ast)
        fname, buf = fwrapper.generate_cy_pyx(cython_ast, self.name)
        test_str = '''\
"""
The test module was generated with Fwrap v%s.

Below is a listing of functions and data types.
For usage information see the function docstrings.

Functions
---------
empty_func(...)

Data Types
----------
fw_character
fwi_integer

"""
np.import_array()
include 'fwrap_ktp.pxi'
cdef extern from "string.h":
    void *memcpy(void *dest, void *src, size_t n)
cpdef api object empty_func():
    """
    empty_func() -> fw_ret_arg

    Parameters
    ----------
    None

    Returns
    -------
    fw_ret_arg : fwi_integer, intent out

    """
    cdef fwi_integer_t fw_ret_arg
    cdef fwi_integer_t fw_iserr__
    cdef fw_character_t fw_errstr__[fw_errstr_len]
    empty_func_c(&fw_ret_arg, &fw_iserr__, fw_errstr__)
    if fw_iserr__ != FW_NO_ERR__:
        raise RuntimeError("an error was encountered when calling the 'empty_func' wrapper.")
    return fw_ret_arg
''' % get_version()
        compare(test_str, buf.getvalue())
Example #7
0
#------------------------------------------------------------------------------

import os
from distutils.core import setup

scripts = []

if os.name == 'posix':
    scripts = ['bin/fwrapc']
else:
    scripts = ['fwrapc.py']

from fwrap.version import get_version

setup(name="fwrap",
      version=get_version(),
      description="Tool to wrap Fortran 77/90/95 code in C, Cython & Python.",
      author="Kurt W. Smith & contributors",
      author_email="*****@*****.**",
      url="http://fwrap.sourceforge.net/",
      packages=[
          "fwrap",
          "fwrap.fparser"
        ],
      package_data = {
          "fwrap" : ["default.config", "log.config"],
          "fwrap.fparser" : ["log.config"],
        },
      scripts=scripts,
      classifiers = [
          "Development Status :: 4 - Beta",
Example #8
0
#------------------------------------------------------------------------------
# Copyright (c) 2010, Kurt W. Smith
# All rights reserved. See LICENSE.txt.
#------------------------------------------------------------------------------

import os
from distutils.core import setup

scripts = []

scripts = ['fwrapc.py', 'fwrapper.py']

from fwrap.version import get_version

setup(name="fwrap",
      version=get_version(),
      description="Tool to wrap Fortran 77/90/95 code in C, Cython & Python.",
      author="Kurt W. Smith & contributors",
      author_email="*****@*****.**",
      url="http://fwrap.sourceforge.net/",
      packages=[
          "fwrap",
          "fwrap.fparser"
        ],
      package_data = {
          "fwrap" : ["default.config", "log.config"],
          "fwrap.fparser" : ["log.config"],
        },
      scripts=scripts,
      classifiers = [
          "Development Status :: 4 - Beta",