Re: Include system

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

Chris Bensler wrote:
> In my preprocessor, I've implemented the include path search in a fairly
> different
> way than the Eu front end is doing it, so my description may not be entirely
> applicable. Instead of building candidate paths to test if a file will open,
> as the front end does, my preprocessor pushes and pops the current directory,
> which makes the actual search algorithm much simpler although admittedly
> probably
> slower and more prone to error.
> 
> I can try though:
> On program entry, a variable: PROGRAM_PATH stores the program path as
> described
> by the second subscript of command_line().
> 
> The current directory should not be modified or it will affect CLI/drag 'n
> drop
> applications.
> 
> Another variable: ACTIVE_PATH stores the path to the file that is currently
> being included. Initially it will be the same as PROGRAM_PATH.
> 
> 1. When an include file is encountered, build the full path to the file being
> included.
> 
> Determine if an absolute path is specified.
> An absolute path begins with a drive letter designation or a SLASH.
> Technically, I think it should/could begin with a URL moniker (C:\ , ftp:\\,
> http:\\, svn:\\, etc) or a SLASH, but Eu doesn't support networked projects.
> 
> If it is absolute path, then no further searching is needed. Just attempt to
> open the file, fail if it can't. Proceed to step 2.
> 
> If it's not an absolute path, then each directory in the include search path
> must be tried in the following order until the file is successfully opened.
> (note that I've assumed EUINC is a preparsed list of paths)
> 
> A) ACTIVE_PATH & SLASH & INCLUDE_FILE
> B) PROGRAM_PATH & SLASH & INCLUDE_FILE
> C) EUINC[i] & SLASH & INCLUDE_FILE
> D) EUDIR & SLASH & include & SLASH & INCLUDE_FILE
> 
> 2. push the ACTIVE_PATH onto an include_path stack
> 
> 3. update ACTIVE_PATH to the path we just resolved for the included file.
> 
> 4. When an include file is finished being processed and is closed, ACTIVE_PATH
> is popped from the include_path stack, restoring the previously active include
> directory.
> 
> Hopefully that covers it.

That seems reasonable to me.
Maybe others would like to comment.

I don't think efficiency will be an issue here. 
The performance hot spots in the front end are in actions 
that take place for each character (the scanner), or maybe 
each line of source, not each file (unless you call
open() many more times than you logically need to). 
Symbol look up (via hashing) also burns up a fair chunk of time.

> I have to say Rob, I've noticed a change in your disposition/attitude lately
> since Eu is opensource (as have others) and I like it. I hope you will find
> that mine has too.

Thanks. I expect I'll enjoy open source development 
more than closed source. In the past when you raised
this issue, I don't think I expressed any fundamental
disagreement. I simply had other things I was working on
that I thought were more important, so I probably discouraged 
this proposal. In general, I always found it a bit irritating to 
have to spend time discussing side issues that were not relevant 
to the few things I had time for in a given release. 
Now people had better be careful what they ask for, because they may 
be asked to implement it themselves.  smile

If you want to go ahead, I just need your SourceForge id,
so I can give you permission to "check in" source files.
Registration with SourceForge is free.
You can check out the latest source from the Euphoria SVN repository, 
make your changes, test them (well I hope!), and check them back in. 
I've found that TortoiseSVN for Windows is very easy to learn and use. 
If you have any questions, let me know here, so others can also 
learn how to do it. You should read up a bit on SVN if you haven't 
used it before. The concept is quite simple. It lets a group of 
developers work on the same source. It warns you if you try to 
"check in" a file that some other developer has modified 
since you "checked out" that file. The SourceForge site has lots 
of info on it.

   http://sourceforge.net/projects/rapideuphoria

Of course there is no rush on this.
Do it whenever you have time: days, weeks or months from now.

Thanks,
   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