March 23, 2004
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
>> 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++.
>>
>> 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.
>
>


March 23, 2004
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


March 23, 2004
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
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
>
>


March 23, 2004
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.
>
Sorry. We were talking about C and C++ both, I thought you said to do it in C first.  Do you not care about that version?



March 23, 2004
"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
virtually
> >identical interfaces, and hide a great deal of crap away from you.
> >
> Sorry. We were talking about C and C++ both, I thought you said to do it
in C
> 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.



March 23, 2004
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.


March 24, 2004
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.
>
>
Matthew -
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.


1 2
Next ›   Last »