[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Enrolling and RegEx in GetFile*

From: Gopal V
Subject: Re: [DotGNU]Enrolling and RegEx in GetFile*
Date: Mon, 4 Nov 2002 23:22:02 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, Charles Shuller wrote:
> Regarding the regex/glob patch, I'm setting a personal goal to get that 
> implemented by Wednesday.  I decided last night to change my approach. 
> Where I was going to implement a ILMatch function with all the internals 
> for creating and analysing the regex match, I've decided we will 
> ultimately be much better off with each of the three regex functions 
> wrapped in IL functions, where they can be re-implemented, if need be, 
> when porting happens.

Implement a System.Private.Regexp class to handle this .... That would
IMHO be cleaner ... So Regexp(String); , .Match and .Dispose() can handle
the 3 functions ?. Declare an internal enum to match the error messages
of regexp and throw an appropriate exception ... (ArgumentException ?).
But this approach would allow us to re-use the stuff cleanly else where 
... But the glob handling is slighly different and kept in Directory.cs
private static Regexp MakeRegexpFromGlob(String glob) ?... and .Match as 

Regexp re=MakeRegexpFromGlob("*.*") ; // gives me the regexp for ".*\..*" 

You might want to call me an OO Nazi after all that .... But I hope that
helps ...

> currently got these implemented in il_sysio.h as IL_REG* as their values 
> in regex.h.  If there is a better way to do this, let me know.

how about directly including regex.h ... which is IMHO cleaner ... 
Redundancy is good but let's not go overboard with it :-) ... And when
we port , we'll still have to redefine something else and another #ifdef.
After all regex.h is standardized by posix (right ?) ... 

> I've also been wrapping everything in #ifdef HAVE_REGEX_H followed by 
> #ifdef HAVE_FUNC.  As I suspect these functions won't be available in 
> most places.  If this assumption is incorrect, le t me know and I'll 
> #ifdef less liberally :)

liberal applications of #ifdef never killed anybody .... (except forcing
people to report porting issues )... But remember to run autoheader which
rebuilds and then run, ./configure and make . 

PS: I'll be free Thursday morning , so I'll be able to commit the 
    patches or help with stuff if you need me ...
The difference between insanity and genius is measured by success

reply via email to

[Prev in Thread] Current Thread [Next in Thread]