diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2011-03-11 09:40:33 +0200 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2011-03-11 09:40:33 +0200 |
commit | 87e0f5576f80cc3314ae368edae3461ec5c1b188 (patch) | |
tree | 89178833f79bcc4e98a94a8f9691a665b5e47f88 /numpy/f2py | |
parent | 81fbb517544bdae0af202de2be7f4af34e29e509 (diff) | |
parent | 7bb54efde16bc81ee4eedd77828edc54c12dec75 (diff) | |
download | numpy-87e0f5576f80cc3314ae368edae3461ec5c1b188.tar.gz |
Merge remote branch 'upstream/master' into f2py-assumed-shape
* upstream/master: (310 commits)
REL: add 1.6.0 release notes.
DEP: remove deprecated np.lib.ufunclike.log2 function.
DOC: fix typo in test guidelines.
DEP: remove deprecated items from ma/core.py
DEP: remove deprecated get_numpy_include.
DEP: remove unique1d, setmember1d and intersect1d_nu.
DEP: remove deprecated names in fftpack.
DEP: remove deprecated methods sync() and close() from memmap.
DEP: Update deprecation messages in genloadtxt with a version number.
BLD: update C API version again after Mark's renaming of functions.
DOC: Replace 'deprecated' with 'superceded' in a few places, fix a typo.
STY: Remove a micro-optimization to make code more clear
DOC: Add some missing documentation, hyper-link the iterator documentation
API: Remove PyArray_FillWithZero from public API
API: Rename the iterator function pointer types to be more consistent with NumPy convention
STY: Work around lack of variadic macros in debug tracing
API: Change iterator API parameters ndim and niter from npy_intp to int
ENH: add Intel 64-bit C compiler. Closes #960.
TST: fix two divide-by-zero test warnings.
BUG: Broadcast shape was backwards in error message (Ticket #1762)
...
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-x | numpy/f2py/crackfortran.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index ccc62188b..c3082bbf7 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -696,7 +696,7 @@ def appenddecl(decl,decl2,force=1): return decl selectpattern=re.compile(r'\s*(?P<this>(@\(@.*?@\)@|[*][\d*]+|[*]\s*@\(@.*?@\)@|))(?P<after>.*)\Z',re.I) -nameargspattern=re.compile(r'\s*(?P<name>\b[\w$]+\b)\s*(@\(@\s*(?P<args>[\w\s,]*)\s*@\)@|)\s*(result(\s*@\(@\s*(?P<result>\b[\w$]+\b)\s*@\)@|))*\s*\Z',re.I) +nameargspattern=re.compile(r'\s*(?P<name>\b[\w$]+\b)\s*(@\(@\s*(?P<args>[\w\s,]*)\s*@\)@|)\s*((result(\s*@\(@\s*(?P<result>\b[\w$]+\b)\s*@\)@|))|(bind\s*@\(@\s*(?P<bind>.*)\s*@\)@))*\s*\Z',re.I) callnameargspattern=re.compile(r'\s*(?P<name>\b[\w$]+\b)\s*@\(@\s*(?P<args>.*)\s*@\)@\s*\Z',re.I) real16pattern = re.compile(r'([-+]?(?:\d+(?:\.\d*)?|\d*\.\d+))[dD]((?:[-+]?\d+)?)') real8pattern = re.compile(r'([-+]?((?:\d+(?:\.\d*)?|\d*\.\d+))[eE]((?:[-+]?\d+)?)|(\d+\.\d*))') @@ -711,10 +711,12 @@ def _is_intent_callback(vdecl): def _resolvenameargspattern(line): line = markouterparen(line) m1=nameargspattern.match(line) - if m1: return m1.group('name'),m1.group('args'),m1.group('result') + if m1: + return m1.group('name'),m1.group('args'),m1.group('result'), m1.group('bind') m1=callnameargspattern.match(line) - if m1: return m1.group('name'),m1.group('args'),None - return None,[],None + if m1: + return m1.group('name'),m1.group('args'),None, None + return None,[],None, None def analyzeline(m,case,line): global groupcounter,groupname,groupcache,grouplist,filepositiontext,\ @@ -743,7 +745,7 @@ def analyzeline(m,case,line): block = block.lower() if re.match(r'block\s*data',block,re.I): block='block data' if re.match(r'python\s*module',block,re.I): block='python module' - name,args,result = _resolvenameargspattern(m.group('after')) + name,args,result,bind = _resolvenameargspattern(m.group('after')) if name is None: if block=='block data': name = '_BLOCK_DATA_' @@ -779,7 +781,8 @@ def analyzeline(m,case,line): if f77modulename and neededmodule==-1 and groupcounter<=1: neededmodule=groupcounter+2 needmodule=1 - needinterface=1 + if block != 'interface': + needinterface=1 # Create new block(s) groupcounter=groupcounter+1 groupcache[groupcounter]={} @@ -826,7 +829,9 @@ def analyzeline(m,case,line): else: groupcache[groupcounter]['from']='%s:%s'%(groupcache[groupcounter-1]['from'],groupcache[groupcounter-1]['name']) for k in groupcache[groupcounter].keys(): - if not groupcache[groupcounter][k]: del groupcache[groupcounter][k] + if not groupcache[groupcounter][k]: + del groupcache[groupcounter][k] + groupcache[groupcounter]['args']=args groupcache[groupcounter]['body']=[] groupcache[groupcounter]['externals']=[] @@ -860,6 +865,7 @@ def analyzeline(m,case,line): if t: typespec,selector,attr,edecl=cracktypespec0(t.group('this'),t.group('after')) updatevars(typespec,selector,attr,edecl) + if case in ['call','callfun']: grouplist[groupcounter-1].append(groupcache[groupcounter]) grouplist[groupcounter-1][-1]['body']=grouplist[groupcounter] @@ -869,8 +875,9 @@ def analyzeline(m,case,line): grouplist[groupcounter-1][-1]['body']=grouplist[groupcounter] del grouplist[groupcounter] groupcounter=groupcounter-1 # end interface + elif case=='entry': - name,args,result=_resolvenameargspattern(m.group('after')) + name,args,result,bind=_resolvenameargspattern(m.group('after')) if name is not None: if args: args=rmbadname([x.strip() for x in markoutercomma(args).split('@,@')]) @@ -921,11 +928,12 @@ def analyzeline(m,case,line): if _intentcallbackpattern.match(ap): if k not in groupcache[groupcounter]['args']: if groupcounter>1: - outmess('analyzeline: appending intent(callback) %s'\ - ' to %s arguments\n' % (k,groupcache[groupcounter]['name'])) if '__user__' not in groupcache[groupcounter-2]['name']: outmess('analyzeline: missing __user__ module (could be nothing)\n') - groupcache[groupcounter]['args'].append(k) + if k!=groupcache[groupcounter]['name']: # fixes ticket 1693 + outmess('analyzeline: appending intent(callback) %s'\ + ' to %s arguments\n' % (k,groupcache[groupcounter]['name'])) + groupcache[groupcounter]['args'].append(k) else: errmess('analyzeline: intent(callback) %s is ignored' % (k)) else: |