Re: Rob?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Vincent wrote:
> Ok... I've thought about dir() some more and concluded that you can use that
> instead?
> 
> Let me explain...
> 
> You could more or less do everything I mentioned with my second proposal, but
> instead of checking and storing for file sizes, check and store results of
> dir(f);
> where f means the current file name.
> 
> So now in order for two or more files to be percieved as the same, the results
> of the current dir() and a stored dir() must be exactly the same.
> 
> Example:
> 
> {
>   {
>     {109,105,115,99,46,101}, -- file name
>     {97},                    -- attribute
>     7577,                    -- byte size
>     2006,                    -- year
>     1,                       -- month
>     11,                      -- day
>     15,                      -- hour
>     18,                      -- minute
>     4                        -- second
>   }
> }
> 
> So in order for Euphoria to quitely ignore an include statement: Two or more
> different files
> will need to have the same exact names, attributes, and byte sizes. But it
> would also need
> to been modified the same exact year, month, day, hour, minute, and second!
> smile
> 
> Heres another simplifed example showing this idea in action:
> }}}
<eucode>
> include file.e
> 
> sequence a, b
> 
> a = dir("C:\\EUPHORIA\\include\\misc.e")
> b = dir("C:\\EUPHORIA\\include\\machine.e")
> 
> if equal(a, b) then
>     puts(1, "The two files are most likely the same.\n")
> else
>     puts(1, "Isn't that cute... but it's WROOONNNGGG!!\n")
> end if
> 
> machine_proc(26, 0)
> </eucode>
{{{

> 
> I think I like this one better than my 180 line solution.
> What do you think?
> 
> This is just as simple as the file size solution but with an extremely higher
> degree of accuracy.

Yes, I thought about this method a few days ago, when I mentioned
dir(), open() etc. in my private e-mail. The fact that it isn't perfect
bothered me at the time, but I think I can accept it. Congratulations.

The "extremely high degree of accuracy" is a bit misleading,
since in some situations, copying a bunch of files will
result in them all having the same time stamp. This is more likely
on Linux/FreeBSD. In fact it's a little bit worrying to think that
a program that's working could now fail just because it got copied
to a new machine or a new directory. But this would be a very rare bug 
so I guess I can accept it. Also, in future I might add a couple of fields to
the dir() result. On Linux/FreeBSD I could easily add the device number
and inode number. The inode number is a unique number for each file
on a device. There is no corresponding thing on DOS/Windows as far
as I know, but maybe there's some extra info I could add.

I guess I'll stick this into the code before the multitasking release,
now that it's on my mind. That'll give me an excuse to delay the release
and go watch a DVD.  smile

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu