Page 1 of 1 1
Topic Options
#62278 - 2002-01-19 08:25 AM UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Bryce,

I refer to your UDF.

It works fine for me with RC1, but not 4.02. Is there anything I should know?

my test script:

code:

break on


call "dirplus.udf"


$dir=dirplus("h:\temp", "*.*", 1, 0)


vartypename($dir) ?


for each $thing in $dir
$thing ?
next


the output on RC1 is

code:

Variant[]
h:\temp\dilbert.gif
h:\temp\file
h:\temp\file2

but 4.02 returns nothing and just exists on the UDF.

cj

Top
#62279 - 2002-01-19 04:37 PM Re: UDF - DIRPLUS()
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
ok, i will take a look into it
Top
#62280 - 2002-01-19 08:17 PM Re: UDF - DIRPLUS()
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
CJ it worked ok for me... but i did find a empty folder bug...

does @error equal anything after you run the UDF?

Top
#62281 - 2002-01-19 09:04 PM Re: UDF - DIRPLUS()
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Bryce, CJ, Ruud,
I thought I'd give this a whirl, and got an "Application error" "The instruction at "0x0040cc03" referenced memory at "0x00000000". The memory could not be read". Running in debug, ascertained it happens on the 3rd line of the UDF "if vartype($_temparray) = 0".

This happens with KiX32 4.02.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#62282 - 2002-01-21 08:32 PM Re: UDF - DIRPLUS()
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I tried this again today with Build 071 and no longer get the error.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#62283 - 2002-01-23 05:43 AM Re: UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Yep, works in new build. What are the _'s for in the variable names?

I removed them and the script stops working.

cj

Top
#62284 - 2002-01-23 05:44 AM Re: UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
ok, figured out the _'s

cj

Top
#62285 - 2002-01-23 08:49 AM Re: UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Bryce, this is a georgeous UDF! I just tried it on 3GB/11,000 files and in 52 seconds it didn't take the CPU over 50% average.

I haven't figured out how it works yet, but I see that it calls itself for each subdir?

Now the big test: 30GB/150,000 files...


cj

Top
#62286 - 2002-01-23 10:05 AM Re: UDF - DIRPLUS()
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Are you using kix 4.02? Looks like the UBOUND performance issue has been fixed

Yes it calls it self for each subfolder, to accomplish this it uses the global variables $_i and $_temparray as a flag/place holder. one of the first thing the UDF does is check the existence of $_temparray, if is in use it sets a local UDF variable $subflag to equal 1. Since this variable is new for every recursive call the UDF does not preform the final step exits to the parent UDF and continues to build $_temparray.

The only iteration of the UDF that does not have $subflag set to equal 1 is the root UDF, so once all subfolders have been ran, the child UDF's exit, returning control to the parent UDF, stopping at the root UDF, this process is repeated for every folder in the root UDF DIR command and so on and so on.....

Once the root UDF had preformed the DIR command on the root folder, it then checks the $subflag variable, since this is the root UDF, $subflag was never set and the UDF finishes the rest of the script.

did you follow that?

Bryce

Top
#62287 - 2002-01-24 02:07 AM Re: UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I did, thanks

cj

Top
#62288 - 2002-01-24 06:14 AM Re: UDF - DIRPLUS()
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Little bug:

About line 116

code:

if @error <> 0 and vartype($fso) <> 9 exit(@error) endif

I am about to start using the object handle function...

cj

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.061 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org