Re: [f2py] Newbie question
Jean-Christophe Roche <roche-/[email protected]> Wed, 22 Jun 2011 15:57:20 +0200
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Le 21/06/2011 20:33, Pearu Peterson a écrit : > > > On Tue, Jun 21, 2011 at 8:17 PM, Jean-Christophe Roche <roche-/[email protected] > <mailto:roche-/[email protected]>> wrote: > > Hi, > > I would like to extract a piece of code (a type, a subroutine, > ...) from > a Fortran file. I need to extract the code exactly as it is in the > source file (with comments, blank lines, spaces, tabs, ...). > > I try to use the api.walk function but comments are not take into > account. Then I try to work with the api.parse function with the > option > ignore_comments=False but I don't find how to get exactly the code > as it > is in the source file (stmt.item.line and stmt.item.strline are not > exactly the original code). > > > You could use either of methods for establishing the starting and > finishing line numbers of the interested piece of code. And then > read only those lines via simple file operations. > > HTH, > Pearu > > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users Hi Pearu, Thanks for your prompt answer. It was a way I was considering. Jean-Christophe -- Jean-Christophe Roche IRAM, Astronomy & Science Support group Institut de Radio Astronomie Millimetrique P: +33 (0) 47682 4967 F: +33 (0) 47651 5938 M: roche-/[email protected] C: [email protected] W: www.iram-institute.org/~roche _______________________________________________ f2py-users mailing list f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] http://cens.ioc.ee/mailman/listinfo/f2py-users