www.digitalmars.com         C & C++   DMDScript  

D - WildCard expansion available

reply larry cowan <larry_member pathlink.com> writes:
I have added a (completed) project to Wiki4d - wildcard filename expansions.
How can I deliver the modules?  Can I put them on the Wiki? or???

Andy - the versions I sent you a while back are obsolete now.
Mar 18 2004
parent reply Helmut Leitner <helmut.leitner wikiservice.at> writes:
larry cowan wrote:
 
 I have added a (completed) project to Wiki4d - wildcard filename expansions.
 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Mar 18 2004
next sibling parent larrycowan <larrycowan_member pathlink.com> writes:
Thanks.

In article <4059EED5.A44E2DD4 wikiservice.at>, Helmut Leitner says...
larry cowan wrote:
 
 I have added a (completed) project to Wiki4d - wildcard filename expansions.
 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com

Mar 18 2004
prev sibling next sibling parent reply "Matthew" <matthew stlsoft.org> writes:
I hadn't realised anyone was working on this.

I am wanting some smart and fast wildcard expansion stuff for recls, and was
thinking I might do that myself in time for the next column (which, believe
it or not, is the September 2004 one; such is the world of in-print
publishing.). Unfortunately, it has to be in C or C++.

Larry, once your lib is (correctness and performance) tested in D, would you
be interested in porting it to C/C++, or helping me do so. The payoff is
that I can wax lyrical about your skills in CUJ, and that your code will be
running in the increasing number of languages for which recls is available -
Ruby is the one I'm currently doing, but there are lots more to come. :)

Even better would be to do a C++/template version which we can incorporate
into STLSoft.

Interested?

Cheers

Matthew Wilson

Synesis Software; Custom Software Solutions
    (www.synesis.com.au)
Contributing editor, C/C++ Users Journal
    (www.synesis.com.au/articles.html#columns)
STLSoft moderator
    (http://www.stlsoft.org)


"Helmut Leitner" <helmut.leitner wikiservice.at> wrote in message
news:4059EED5.A44E2DD4 wikiservice.at...
 larry cowan wrote:
 I have added a (completed) project to Wiki4d - wildcard filename


 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com

Mar 18 2004
next sibling parent reply larry cowan <larry_member pathlink.com> writes:
Yes.  I was thinking of doing a C or C++ version for the compiler.  Walter
has "expand(arg)" in there but commented out.  Could do C version in my
sleep, but would rather do it in C++, and a template version I could take
some advice on.  Why templated?  I have only used that where I wanted to
float the type - doesn't seem apropos here.

In article <c3ctkg$1e3p$1 digitaldaemon.com>, Matthew says...
I hadn't realised anyone was working on this.

I am wanting some smart and fast wildcard expansion stuff for recls, and was
thinking I might do that myself in time for the next column (which, believe
it or not, is the September 2004 one; such is the world of in-print
publishing.). Unfortunately, it has to be in C or C++.

Larry, once your lib is (correctness and performance) tested in D, would you
be interested in porting it to C/C++, or helping me do so. The payoff is
that I can wax lyrical about your skills in CUJ, and that your code will be
running in the increasing number of languages for which recls is available -
Ruby is the one I'm currently doing, but there are lots more to come. :)

Even better would be to do a C++/template version which we can incorporate
into STLSoft.

Interested?

Cheers

Matthew Wilson

Synesis Software; Custom Software Solutions
    (www.synesis.com.au)
Contributing editor, C/C++ Users Journal
    (www.synesis.com.au/articles.html#columns)
STLSoft moderator
    (http://www.stlsoft.org)


"Helmut Leitner" <helmut.leitner wikiservice.at> wrote in message
news:4059EED5.A44E2DD4 wikiservice.at...
 larry cowan wrote:
 I have added a (completed) project to Wiki4d - wildcard filename


 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com


Mar 18 2004
parent "Matthew" <matthew stlsoft.org> writes:
 Yes.  I was thinking of doing a C or C++ version for the compiler.  Walter
 has "expand(arg)" in there but commented out.  Could do C version in my
 sleep, but would rather do it in C++, and a template version I could take
 some advice on.

I'd like to see/help it
  Why templated?  I have only used that where I wanted to
 float the type - doesn't seem apropos here.

I have a little experience in templates, if you need it.
 In article <c3ctkg$1e3p$1 digitaldaemon.com>, Matthew says...
I hadn't realised anyone was working on this.

I am wanting some smart and fast wildcard expansion stuff for recls, and


thinking I might do that myself in time for the next column (which,


it or not, is the September 2004 one; such is the world of in-print
publishing.). Unfortunately, it has to be in C or C++.

Larry, once your lib is (correctness and performance) tested in D, would


be interested in porting it to C/C++, or helping me do so. The payoff is
that I can wax lyrical about your skills in CUJ, and that your code will


running in the increasing number of languages for which recls is


Ruby is the one I'm currently doing, but there are lots more to come. :)

Even better would be to do a C++/template version which we can


into STLSoft.

Interested?

Cheers

Matthew Wilson

Synesis Software; Custom Software Solutions
    (www.synesis.com.au)
Contributing editor, C/C++ Users Journal
    (www.synesis.com.au/articles.html#columns)
STLSoft moderator
    (http://www.stlsoft.org)


"Helmut Leitner" <helmut.leitner wikiservice.at> wrote in message
news:4059EED5.A44E2DD4 wikiservice.at...
 larry cowan wrote:
 I have added a (completed) project to Wiki4d - wildcard filename


 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com



Mar 19 2004
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Matthew" <matthew stlsoft.org> wrote in message
news:c3ctkg$1e3p$1 digitaldaemon.com...
 I am wanting some smart and fast wildcard expansion stuff for recls, and

 thinking I might do that myself in time for the next column (which,

 it or not, is the September 2004 one; such is the world of in-print
 publishing.). Unfortunately, it has to be in C or C++.

Here's one way to do wildcard expansion using existing phobos modules: void findCppFiles(char[] fullpath, char[] directory) { char[][] dirlist = std.file.listdir(fullpath); foreach (char[] fname; dirlist) { if (std.file.isfile(std.path.join(fullpath, fname)) && std.path.fnmatch(fname, "*.cpp")) { printf("file: '%.*s'\n", fname); } } }
Mar 20 2004
parent reply "Matthew" <matthew stlsoft.org> writes:
"Walter" <walter digitalmars.com> wrote in message
news:c3jdgm$93l$1 digitaldaemon.com...
 "Matthew" <matthew stlsoft.org> wrote in message
 news:c3ctkg$1e3p$1 digitaldaemon.com...
 I am wanting some smart and fast wildcard expansion stuff for recls, and

 thinking I might do that myself in time for the next column (which,

 it or not, is the September 2004 one; such is the world of in-print
 publishing.). Unfortunately, it has to be in C or C++.

Here's one way to do wildcard expansion using existing phobos modules: void findCppFiles(char[] fullpath, char[] directory) { char[][] dirlist = std.file.listdir(fullpath); foreach (char[] fname; dirlist) { if (std.file.isfile(std.path.join(fullpath, fname)) && std.path.fnmatch(fname, "*.cpp")) { printf("file: '%.*s'\n", fname); } } }

Cheers, mate, but I need it in C. I think Larry's going to do it in C, and then I can potentially include this in STLSoft for C++ folks.
Mar 22 2004
next sibling parent larry cowan <larry_member pathlink.com> writes:
In article <c3ntb5$1hhg$1 digitaldaemon.com>, Matthew says...
"Walter" <walter digitalmars.com> wrote in message
news:c3jdgm$93l$1 digitaldaemon.com...
 "Matthew" <matthew stlsoft.org> wrote in message
 news:c3ctkg$1e3p$1 digitaldaemon.com...
 I am wanting some smart and fast wildcard expansion stuff for recls, and

 thinking I might do that myself in time for the next column (which,

 it or not, is the September 2004 one; such is the world of in-print
 publishing.). Unfortunately, it has to be in C or C++.

Here's one way to do wildcard expansion using existing phobos modules: void findCppFiles(char[] fullpath, char[] directory) { char[][] dirlist = std.file.listdir(fullpath); foreach (char[] fname; dirlist) { if (std.file.isfile(std.path.join(fullpath, fname)) && std.path.fnmatch(fname, "*.cpp")) { printf("file: '%.*s'\n", fname); } } }

Cheers, mate, but I need it in C. I think Larry's going to do it in C, and then I can potentially include this in STLSoft for C++ folks.

Mar 23 2004
prev sibling parent reply larry cowan <larry_member pathlink.com> writes:
sorry. the first one got away from me and posted before I had any content.

Matthew - (or anybody else)

What do you know of directory access in C for windoughs?  I have been using
dirent.h in unix, but I don't find anythng in my VC6.  Is there something you
know of that is portable?  I will look in djgpp dirent source, but that's the
only lead I know of at the moment.
Other than that, the wildcard stuff ported from D easily with only the debug
stuff growing larger - I'll have to go back and use more D specific stuff on the
original, see if I can cut it smaller and better.  Since it's not really needed
in unix, I'm not putting much effort into that side.

-larry
Mar 23 2004
parent reply "Matthew" <matthew stlsoft.org> writes:
You should write it in C++, and then you can use either
unixstl::glob_sequence or winstl::findfile_sequence, which present virtually
identical interfaces, and hide a great deal of crap away from you.

"larry cowan" <larry_member pathlink.com> wrote in message
news:c3pco5$us0$1 digitaldaemon.com...
 sorry. the first one got away from me and posted before I had any content.

 Matthew - (or anybody else)

 What do you know of directory access in C for windoughs?  I have been

 dirent.h in unix, but I don't find anythng in my VC6.  Is there something

 know of that is portable?  I will look in djgpp dirent source, but that's

 only lead I know of at the moment.
 Other than that, the wildcard stuff ported from D easily with only the

 stuff growing larger - I'll have to go back and use more D specific stuff

 original, see if I can cut it smaller and better.  Since it's not really

 in unix, I'm not putting much effort into that side.

 -larry

Mar 23 2004
parent reply larry cowan <larry_member pathlink.com> writes:
In article <c3pd93$vpj$2 digitaldaemon.com>, Matthew says...
You should write it in C++, and then you can use either
unixstl::glob_sequence or winstl::findfile_sequence, which present virtually
identical interfaces, and hide a great deal of crap away from you.

first. Do you not care about that version?
Mar 23 2004
parent reply "Matthew" <matthew stlsoft.org> writes:
"larry cowan" <larry_member pathlink.com> wrote in message
news:c3phij$17hg$1 digitaldaemon.com...
 In article <c3pd93$vpj$2 digitaldaemon.com>, Matthew says...
You should write it in C++, and then you can use either
unixstl::glob_sequence or winstl::findfile_sequence, which present


identical interfaces, and hide a great deal of crap away from you.


 first.  Do you not care about that version?

Sorry, I misunderstood. I assumed your request for file-matching was part of a test program. I am confused as to why it would be part of the wildcard implementation. I think C is better for the wildcard thing, as it's more widely portable and digestible, and likely to be less coupled. Not really sure what to recommend without knowing why you need the file-system searching. For recls I am hoping that the wildcard functions will take over from the native matching, which would therefore always be *.* on Win32 and * on UNIX.
Mar 23 2004
parent reply larry cowan <larry_member pathlink.com> writes:
In the D version, I was using listdir, isdir, and isfile.  You can't match
patterns to available files without getting their names and climbing up the tree
(hopefully in some efficient, portable way).  One of the things I'm concerned
about using raw i/o is that directory formats change some with different file
systems.  That's a whole bag of worms I'd rather not get into. 
Mar 23 2004
parent larry cowan <larry_member pathlink.com> writes:
In article <c3qgkm$2vdv$1 digitaldaemon.com>, larry cowan says...
In the D version, I was using listdir, isdir, and isfile.  You can't match
patterns to available files without getting their names and climbing up the tree
(hopefully in some efficient, portable way).  One of the things I'm concerned
about using raw i/o is that directory formats change some with different file
systems.  That's a whole bag of worms I'd rather not get into. 

Are you just interested in the matching state machine? That works in C. I'll try it as externC from the D code where it's used for each level of the input pattern to accept or reject subdirectories (as well as filenames at the last level or alternatively in each accepted directory in the tree). I plan to go back into the D version (a WildMatch class) and try to cut it down a bit. With pointers, the C code is shorter a bit except for the debug going to #ifdef/#endif framing.
Mar 24 2004
prev sibling parent reply larry cowan <larry_member pathlink.com> writes:
Have used it - code is posted as wildcard.zip.  It does seem a bit strange to
have the link say "Upload:duser/wildcard.zip" though.  Is there a way to change
the text on the link? or change the "Upload" name to "Code" or something like
that.

In article <4059EED5.A44E2DD4 wikiservice.at>, Helmut Leitner says...
larry cowan wrote:
 
 I have added a (completed) project to Wiki4d - wildcard filename expansions.
 How can I deliver the modules?  Can I put them on the Wiki? or???

You can upload them at "Preferences / Upload directory" Answer login request with username=duser password=duser Currently there is one common upload directory. We can register individual users with separate directories if there is a need. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com

Mar 19 2004
parent Helmut Leitner <helmut.leitner wikiservice.at> writes:
larry cowan wrote:
 
 Have used it - code is posted as wildcard.zip.  It does seem a bit strange to
 have the link say "Upload:duser/wildcard.zip" though.  Is there a way to change
 the text on the link? or change the "Upload" name to "Code" or something like
 that.

This way better? <http://www.prowiki.org/wiki4d/wiki.cgi?WildCard> -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Mar 19 2004