diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-10-16 12:34:37 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-10-16 12:34:37 -0600 |
commit | aaf115d89c591f0fa8149f1d6851589c79fa656a (patch) | |
tree | e4e075c3721faebcc5a0f845f21041fac92112d1 | |
parent | f6a028cbf740969ec96e319b858483c0c4d4c68d (diff) | |
parent | b1ce387fd259b63530ebe5390ad528bac304075f (diff) | |
download | numpy-aaf115d89c591f0fa8149f1d6851589c79fa656a.tar.gz |
Merge pull request #6488 from charris/cleanup-6306
Cleanup 6306: BUG: allow extension of common blocks in numpy.f2py
-rw-r--r-- | doc/source/f2py/signature-file.rst | 21 | ||||
-rwxr-xr-x | numpy/f2py/crackfortran.py | 7 |
2 files changed, 13 insertions, 15 deletions
diff --git a/doc/source/f2py/signature-file.rst b/doc/source/f2py/signature-file.rst index cfc35ebda..a8924712f 100644 --- a/doc/source/f2py/signature-file.rst +++ b/doc/source/f2py/signature-file.rst @@ -21,7 +21,7 @@ scanning Fortran codes and writing a signature file, F2PY lowers all cases automatically except in multiline blocks or when ``--no-lower`` option is used. -The syntax of signature files is overvied below. +The syntax of signature files is presented below. Python module block ===================== @@ -178,12 +178,13 @@ Common block statements: <shortentitydecl> := <name> [ ( <arrayspec> ) ] [ , <shortentitydecl> ] - One ``python module`` block should not contain two or more - ``common`` blocks with the same name. Otherwise, the latter ones are - ignored. The types of variables in ``<shortentitydecl>`` are defined - using ``<argument type declarations>``. Note that the corresponding - ``<argument type declarations>`` may contain array specifications; - then you don't need to specify these in ``<shortentitydecl>``. + If a ``python module`` block contains two or more ``common`` blocks + with the same name, the variables from the additional declarations + are appended. The types of variables in ``<shortentitydecl>`` are + defined using ``<argument type declarations>``. Note that the + corresponding ``<argument type declarations>`` may contain array + specifications; then you don't need to specify these in + ``<shortentitydecl>``. Other statements: The ``<other statement>`` part refers to any other Fortran language @@ -400,8 +401,8 @@ The following attributes are used by F2PY: a C function. This is because the concepts of Fortran- and C contiguity overlap in one-dimensional cases. - If ``intent(c)`` is used as an statement but without entity - declaration list, then F2PY adds ``intent(c)`` attibute to all + If ``intent(c)`` is used as a statement but without an entity + declaration list, then F2PY adds the ``intent(c)`` attribute to all arguments. Also, when wrapping C functions, one must use ``intent(c)`` @@ -596,7 +597,7 @@ A C expression may contain: ``shape(<name>,<n>)`` Returns the ``<n>``-th dimension of an array ``<name>``. ``len(<name>)`` - Returns the lenght of an array ``<name>``. + Returns the length of an array ``<name>``. ``size(<name>)`` Returns the size of an array ``<name>``. ``slen(<name>)`` diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index f392f946c..6146e5098 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -1372,11 +1372,8 @@ def analyzeline(m, case, line): if 'common' in groupcache[groupcounter]: commonkey = groupcache[groupcounter]['common'] for c in cl: - if c[0] in commonkey: - outmess( - 'analyzeline: previously defined common block encountered. Skipping.\n') - continue - commonkey[c[0]] = [] + if c[0] not in commonkey: + commonkey[c[0]] = [] for i in [x.strip() for x in markoutercomma(c[1]).split('@,@')]: if i: commonkey[c[0]].append(i) |