regular expressions in fortran90, 95

Greetings,

Is there any possibility to use the subject?

Thanks a lot in advance.

regards,
Anton.

0
narod (25)
1/21/2004 2:55:02 PM
comp.lang.fortran 11340 articles. 37 followers. Post Follow

6 Replies
367 Views

Similar Articles

[PageSpeed] 19
Anton Ishmurzin wrote:
> 
> Greetings,
> 
> Is there any possibility to use the subject?
> 
> Thanks a lot in advance.
> 
> regards,
> Anton.

I do not know of a ready solution, but it is possible
to take a C library and call that (possibly via a 
few wrapper functions) from Fortran.

(I have contemplated writing such wrapper functions 
but I have not found the energy to actually do it yet ;).

In principle it is no problem - Fortran offers all the
tools you need, but the very task of writing a regular
expressions matcher is mind-boggling.

Regards,

Arjen
0
arjen.markus (2628)
1/22/2004 8:14:14 AM
Arjen Markus (aka Bruce) was almost, but not quite, entirely unlike tea:
> I do not know of a ready solution, but it is possible
> to take a C library and call that (possibly via a 
> few wrapper functions) from Fortran.
> 
> (I have contemplated writing such wrapper functions 
> but I have not found the energy to actually do it yet ;).
> 
> In principle it is no problem - Fortran offers all the
> tools you need, but the very task of writing a regular
> expressions matcher is mind-boggling.

If we could portably use popen(), you could invoke perl :)

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
If a train station is a place where a train stops, what's a workstation?
0
tconnors (94)
1/22/2004 12:46:17 PM
TimC wrote:
> 
> Arjen Markus (aka Bruce) was almost, but not quite, entirely unlike tea:
> > I do not know of a ready solution, but it is possible
> > to take a C library and call that (possibly via a
> > few wrapper functions) from Fortran.
> >
> > (I have contemplated writing such wrapper functions
> > but I have not found the energy to actually do it yet ;).
> >
> > In principle it is no problem - Fortran offers all the
> > tools you need, but the very task of writing a regular
> > expressions matcher is mind-boggling.
> 
> If we could portably use popen(), you could invoke perl :)
> 

A portable interface between C and Fortran is not that 
difficult :) - it just takes some time to realise.
All the technical stuff can be adequately solved via
"cfortran.h". The interface needs to be defined in 
a way that is comfortable for Fortran programmers.
That is where ingenuity comes along...

As far as popen() is concerned, is that not part of
POSIX? Doesn't  POSIX have a Fortran-component?

Regards,

Arjen
0
arjen.markus (2628)
1/22/2004 1:14:47 PM
> Doesn't  POSIX have a Fortran-component?

It has a Fortran language binding, yes. I'm not sure any (useful)
implementations exist.

	Jan
0
jvorbrueggen (238)
1/22/2004 1:43:54 PM
Anton Ishmurzin <narod@izh.com> wrote in message news:<400E92C6.9000100@izh.com>...
> Greetings,
> 
> Is there any possibility to use the subject?
> 
> Thanks a lot in advance.
> 
> regards,
> Anton.

If you do not need the full power of regular expressions, you can
probably solve your problem using the intrinsic Fortran
string-handling functions, such as

INDEX
VERIFY
SCAN
TRIM
ADJUSTL

The book "The Practice of Programming" by Brian W. Kernighan and Rob
Pike show how MOST of grep can be implemented in a fairly small C
code. If that is all you need, translating their code to Fortran
should not be too hard. The code from his book can be downloaded from
http://cm.bell-labs.com/cm/cs/tpop/code.html .

The book "Software Tools" by Kernighan and Plauger has string-handling
code in RATFOR, which can be translated to Fortran using the RATFOR
preprocessor. The code is at
http://cm.bell-labs.com/cm/cs/who/bwk/toolsbook/index.html , in some
strange format.

"Fortran tools for VAX/VMS and MS-DOS"
Jones and Crabtree (1988) 
is a very good book with lots of string-handling code in Fortran 77

"Algorithms and Data Structures in F and Fortran" 
by Robin Vowels (1988)
has lots of string-handling code in Fortran 90/95
0
beliavsky (2212)
1/22/2004 2:40:51 PM
Jan C Vorbr�ggen (aka Bruce) was almost, but not quite, entirely unlike tea:
>> Doesn't  POSIX have a Fortran-component?
> 
> It has a Fortran language binding, yes. I'm not sure any (useful)
> implementations exist.

There's pxfpopen() in Intel FC. 

It returns a fd, not a lun, so one must do nasty things with dup2(),
in order to be able to use write and read transparently. Why I call
this unportable, is because as it is; I had to perform many unexpected
hacks because of some sub-optimalities in the buffering of Intel's
implementation of write/read (seeking all over the place, unless you
open on a fifo before the dup2, in which case it chooses to read/write
one byte at a time -- yuck)

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
Kleeneness is next to Godelness.
0
tconnors (94)
1/22/2004 9:12:32 PM
Reply:
Similar Artilces:

We were searching for some special way to express our good wishes
Dear Flightsim Community; We were searching for some special way to express our good wishes to you for Christmas and the coming year, but we discovered that there are some things in life that cannot be improved upon. So, please accept our very best wishes to you, your family, for a Merry Christmas and a Happy New Year from all of us here at the Scenery Hall of Fame. From our search, we did learn some facts that we hadn't known before, and hope you find them interesting. Saint Nicholas was a bishop of the Christian church of Myra, in Lycia, Anatolia. He enjoyed a reputation ...

Re: Regular expressions #6
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Correct! This is nice code like Toby's original post, but it does not solve the problem. Anybody else have any ideas?<br> <br> data _null_, wrote: <blockquote cite="mid:7367b4e20806180724v41482552qb815fc98c5d2fbc6@mail.gmail.com" type="cite"> <pre wrap=""...

Regular Expression help
i'm trying to turn text like this: A test to turn [text like this] into some [other text]. into this: A test to turn [TextLikeThis] into some [OtherText]. I can get an expression that will match the text in brackets, but I can't work out how to sub-group so I can capitalise each word and remove the spaces. I'm matching the text in brackets using: \[(\w+\s{0,})+\] Any help gratefully received!!! llihp wrote: > i'm trying to turn text like this: > > A test to turn [text like this] into some [other text]. > > into this: > > A test to turn [TextL...

What is regular about regular expressions nowadays?
The language {ww | w is alpha} has been shown to be context-sensitive. But the perl regular expression /(\w*)\1/ will recognize it. There are constructs supported by some regex engines (.NET, for example) that allow sections to be tagged and Why do we insist on calling these "regular"? Anything with back-references or tagging of any sort can't be expressed as DFAs or NFAs because one is not supposed to be able to keep a memory of the input. Still, all books that talk about regex engines talk about NFAs and backtracking. Something like {ww} requires an equivalent LBA (linear bou...

regular expressions and matching delimeters
Greetings. I may be asking the wrong question, so I'll start here: Is it possible, through regular expressions or some other method, to parse a string based on matching delimeters? The "string" that I have is actually a variable declaration for a Javascript program. I don't want to actually *run* Javascript. All I want is the data, and right now, this is the only way I can get the data. It looks something like this: var list = [{"item":1,"tags":["tag1","tag2"],"day":"Friday", "people":[{...

Perl, Regular expression?
Hi all, I am a Perl newbie :) I want to extract the line from a file, which have the division symbol "/" (something like input1/input2 ). But I want to exclude the comment symbol "*/", "/*" and "//"? What's the regular expression? Any suggestions will be appreciated! Best regards, Davy "Davy" <zhushenli@gmail.com> wrote in message news:1135406206.276304.230700@f14g2000cwb.googlegroups.com... > Hi all, > > I am a Perl newbie :) > I want to extract the line from a file, which have the division symbol > "/"...

Regularization
Dear all, Is there a tool in Matlab which helps solve ill-conditioned problems, such as integral equations of the first kind? Using for example the Phillips-Tikhonov method? If yes, which version of Matlab is this available in? Thaks a lot, Wassim AUB wassim jalbout wrote: > Dear all, > Is there a tool in Matlab which helps solve ill-conditioned problems, > such as integral equations of the first kind? Using for example the > Phillips-Tikhonov method? > > > If yes, which version of Matlab is this available in? > > > Thaks a lot, > Wassim &g...

OS/X on 'regular' box | death of Linux?
I was recently at a meeting of sysops I hang out with - total tech-heads - all major Linux, Unix nerds. Someone showed a hacked version os OS/X running on a vanilla Dell - qeustion went around the group - if OS/X were released for (say) $50-100 for any machine out there, would you buy it, and dump whatever you're currently using? Answer was 11/12 said 'absolutely' (the one who said no is a Solaris fanatic who has been using it so long he still thinks Sun is a player in anything - right along with SGI). So, even the guys who comile weird kernels in Linux just for grins have pretty w...

is the language of regular expressions a regular language?
The set REX of regular expressions over the alphabet {a, b} is itself a language over the alphabet {e,0 , a, b, ), (*,U, .} is this language regular? I want to say yes, however, I am not sure what approach to take? Which would be easiest? Construct a DFA or a regular expression? Or am I wrong and this language is not regular? TheGist writes: > The set REX of regular expressions over the alphabet > {a, b} > is itself a language over the alphabet > {e,0 , a, b, ), (*,U, .} > > is this language regular? > > I want to say yes, however, I am not sure what approac...

Using Real Player for Airport Express?
I got an Airport Express for Xmas and am mainly using and enjoying it as a way to play iTunes music including radio streams on my stereo. I was wondering if anyone has figured out a way to use other players than iTunes as a feed through to Airport Express. My favourite radio stations are the BBC ones which are playable only by their own player or Real Player. BBC unhelpfully (and inaccurately) state in their FAQ, in response to the question of hearing them through iTunes, "There are no plans at present to use iTunes to distribute our programmes - the Radio Player is currently the only w...

Regular expressions, strange result from .scan method
Hi, I'm having some strange result from the .scan method used on a string. Here's my code : a = "counter-46382764" r = /counter-(\d+)/ puts (a.scan(r)).inspect It prints : [ [ "46382764" ] ] I was expecting : [ "46382764" ] (just a simple array not an array in an array) What's wrong with me ? :/ Thanks a lot ! pollop. -- Posted via http://www.ruby-forum.com/. On Feb 21, 2011, at 13:10 , John Doe wrote: > I'm having some strange result from the .scan method used on a string. >=20 > Here's my ...

Query problem expressed in PHP
I have this MySQL table: TABLE: content_path +--------------+--------+ | node | parent | +--------------+--------+ | /works | / | | /EIGHNER | / | | / | 0 | | /works/essay | /works | +--------------+--------+ The table will never be very large, so recursion seems to be the best way to traverse this hierarchal information. Obviously these are unix-style file paths, but in researching this, I see the same sort of table often occurs in product category problems. I also note that such tables don't comply with database normalization --- which...

Simplifying expressions using rules with recursion
I would like to use Mathematica to simplify a long expression consisting of tems of products of matrices. These matrices obey equations of the form A = A.B.A, and I would like Mathematica to use these identities to simplify my expression. How can I tell Mathematica to do that? Just entering [1]: A = A.B.A does not work, as Mathematica will complain about too man recursions (which I understand). But how do I do it properly? ...

Full-featured free Ada 95/2005 compiler?
Hi, Is it ever going to be possible to have all the language features of Ada 95/2005 (including the Systems, Real-Time and Security annexes) available in a free compiler, or will one have to pay money to be able to do everything? It looks like the Security and Real-Time annexes are always going to be proprietary. Any thoughts? interpretarian wrote: > Is it ever going to be possible to have all the language features of > Ada 95/2005 (including the Systems, Real-Time and Security annexes) > available in a free compiler, or will one have to pay money to be able > to do everything?...

Best fit ellipse inside a non regular hexagon
Hi, i want to fit an ellipse that is teh best fit ellipse inside a non regular hexagon. It means there would be an ellipse that intersects every side of the hexagon at only one point. Anybody have an idea about it? "Mehmet OZTURK" <mehmetozturk@mathworks.com> wrote in message <fusjd6$ae6$1@fred.mathworks.com>... > Hi, i want to fit an ellipse that is teh best fit ellipse > inside a non regular hexagon. It means there would be an > ellipse that intersects every side of the hexagon at only > one point. Anybody have an idea about it? You could use fm...

Multi-line regular expression match question
Hi, I have been trying to create a solid regular expression to match a possible multi-line expression without success. So after several hours i almost got there but not the point i would like, hoping somebody can point me in the right direction. Here is an example i am dealing with: 01xxxxxxxxxxxxxx |-: <20>ABCD <30>edfghi212 -| |-: <20>EFGH <30>hjkli3232 -| 89xxxxxxxxxxxxx I need to match anything that is enclosed in between "|-:" and "-|" So far i've got "/^\{\|-:$.*^-\|$/m" , this one is greedy, returning the ...

Request for CSSM regulars
I have a request. It's is just my $0.02. Please do not respond to homework requests. Don't even responde with subtle or not so subtle sarcasism or even a suggestion that they post what they have done so far. Doing so just promotes more requests. I'd like to see such requests drop off the first page of most recent cssm posts as fast as possible so I don't have to see them ever again. I particularly do not want to see spammers identify those posts as good ones to refresh with their "useful" information. It's just a thought. Duane Duane Hanselman wrote: > >...

regular expression #5 306201
Hi there, I have strings like asdf asdf asdf "test.gif" blabla or asdf asdf asdf 'test.gif' blabla I want to extract test.gif. Because I will see " or ' in the string, I was (so far) unable to create a regular expression for this problem Regards Bruno Bruno Storz wrote: > I have strings like > > asdf asdf asdf "test.gif" blabla > or > asdf asdf asdf 'test.gif' blabla > > I want to extract test.gif. Because I will see " or ' in the string, I was > (so far) unable to create a regular expression for this p...

Solaris Express 64380
I have something to tell. Last month, we got our SAN and need iSCSI driver. We are running Solaris 9(can not go to 10 yet because the vendor's application is not certified yet). And Solaris Express has iSCSI. The Sun technical support suggested me to install Solaris Express. He told me that Solaris Express is just a package which can run in Solaris 9. I didn't take his idea because Solaris Express is an independent OS based on http://groups.google.com/group/comp.unix.solaris/browse_thread/thread/a6717eeca116fd06/4ef240196adb68c6?q=Solaris+Express&rnum=3#4ef240196adb68c6, http://w...

Regular Expressions #5 1638084
hi! I've been working with Python for about two months now but I just started learning about regular expressions. My question is the following. I have a source file that contains code and comments. A piece of the comments contains a revision history that I would like to erase completely from the file since I never update it and I don't use it anymore. The file looks something like /**************************************** * Some info * * More info * *---------------------------------------- * * Revision History: * * blah * blah * blah * *---------------------------------------...

HP OfficeJet 6110 destroys my HP 56 ink cartridges regularly
My HP OfficeJet 6110 multifunction printer destroys black ink cartridges every couple of months. I print very infrequently (about 10 pages in 6 months?) and the HP 56 (original) cartridges, still with much ink in them, quit working after that time. I've got 3 damaged cartridges so far. Error message that appears after a couple of months is: Remove and check cartridge Right Cartridge Incorrect The color cartridge is never affected. I have tried cleaning the contacts, printer reset routines, re-install printer firmware, etc. The only thing that works is to put in a bran...

US-TX-Austin: Systems Programmer, Linux, Win 2000, Win 95, Windows Mobile 03; 2M (45329857605)
US-TX-Austin: Systems Programmer, Linux, Win 2000, Win 95, Windows Mobile 03; 2M (45329857605) ============================================================================================== Position: Systems Programmer Reference: MKL00840 Location: Austin TX Duration: 2M Skills: Linux Win 2000 Win 95 Win 98 Win NT Windows Mobile 03 Palm OS Java XML J2ME Websphere Web Services Eclipse Scope: The can...

regular expressions and backslashes
I've seen that the library technical report includes a regular expression library. However, since regular expressions use a lot of backslashes (\w, \1, etc.) and they are escape characters in C++ strings, the programmer has to write things like this: "\\w" and "\\\\" for regexps "\w" and "\\", respectively. Have raw-strings been considered to simplify these cases? For example, Python and D work like this: r"\w" == "\\w" r"c:\tsd" == "c:\\tsd" (D has an alternate syntax for this feature, using back...

Semantic Regularity For Regularity's Sake
Hi All, I mentioned in a concurrent post that I am testing Microsoft's new Visual C++ express compiler on a large code base. I got thousands of errors on code I thought was mostly "pure" C++, as it compiled without complaint with Visual C++ 7.1. The errors are my fault - looking at top of page 394, TCPPPL 3rd Ed., it states (more or less), that you cannot, for example, do things like this: struct Outer { struct Inner { } ; } ; using Outer::Inner; Inner i; // not allowed to pull out typename from Outer. must use explicty qualification: Outer::Inner i; One of the othe...

FAQ 6.12 Can I use Perl regular expressions to match balanced text? #2 1204280
This is an excerpt from the latest version perlfaq6.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 6.12: Can I use Perl regular expressions to match balanced text? (contributed by brian d foy) Your first try should probably be the "Text::Balanced" module, which is in the Perl standard libr...