Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Directories...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 20 Topic 3988 of 4053
Post > Topic >>

Re: Directories Redux

by m_l_g3 <m_l_g3@[EMAIL PROTECTED] > Apr 9, 2008 at 04:16 PM

On Apr 10, 2:21 am, Bruce McFarling <agil...@[EMAIL PROTECTED]
> wrote:
> On Apr 9, 5:37 pm, m_l_g3 <m_l...@[EMAIL PROTECTED]
> wrote:
> > On Apr 6, 6:34 pm, an...@[EMAIL PROTECTED]
 (Anton Ertl)
> > wrote:
>
> > > Bruce McFarling <agil...@[EMAIL PROTECTED]
> writes:
> > > >SF" ..." returns a string anchored in the directory of the source
file
>
> > > That's certainly an approach that would avoid the whole prefix issue
> > > completely.  Another advantage is that it would do the anchoring at
> > > the right place (in the file where the string sits, rather than in
the
> > > file where the string is used).
> > ...
> > > One disadvantage of F" (or SF") is that most Forth programmers seem
to
> > > prefer INCLUDE and REQUIRE over INCLUDED and REQUIRED, standards be
> > > damned.
> > Yes, exactly.
> > So please provide non-parsing versions of SF" WF" LF"
> > so that we would write ourselves
> > : s-include parse-name src-anchored included ;
> > : l-include parse-name lib-anchored included ;
> > and would be able to write
> > : w-include parse-name wrk-anchored included ;
> > S" win32/process.fth" lib-anchored included
> > it looks enough ugly to be... well... ahem... I want to say, it is the
> > same style that we have in the standard.
>
> Ok:
>
> ANCHORED ( ca1 u1 -- ca2 u2 )
> translate the relative file reference given the string at ( ca1 u1 )
> into an absolute file reference. If contained in a source file, the
> file is relative to the source file currently being interpreted. If
> given on the command line, the file is relative to an implementation
> dependent position in the file hierarchy.
>
> LIB-ANCHORED ( ca1 u1 -- ca2 u2 )
> translate the relative file reference given the string at ( ca1 u1 )
> into an absolute file reference to the first file in the library path
> that matches the file reference. If there is no matching file, an
> absolute file reference is returned that refers to the first directory
> in the library path.
>

That is, ANCHORED is relative to the file being loaded (and not the
project directory), LIB-ANCHORED is somewhere in the library path, and
no "anchored" means `pwd`-relative. Is my understanding correct?

I would like to have WRK-ANCHORED too, to make `pwd`-anchoring
explicit. Some systems may already have some built-in intellect, and
this sort of things is always difficult to hack-around.

Now, what about lifetime and releasing of the converted path strings?
If I store the address and length into a 2VARIABLE, will the filename
be available via that 2VARIABLE while the file loads?

2variable filename
: lib-include
   parse-name lib-anchored  filename 2@[EMAIL PROTECTED]
  2>R 2DUP filename 2! included
2R> filename 2!
;


> In both cases, the relative file reference refers to a subdirectory
> within the file reference

Sorry, can you please re-phrase?

> by appending the character '/', with
> ANCHORED or LIB-ANCHORED providing any translation required by
> INCLUDED and/or REQUIRED.

Sorry, what translation you are talking about?

And as to '/' vs '\', IMO it would be good to allow both.




 20 Posts in Topic:
Directories Redux
Bruce McFarling <agila  2008-04-05 19:00:00 
Re: Directories Redux
anton@[EMAIL PROTECTED]   2008-04-06 14:34:53 
Re: Directories Redux
Jonah Thomas <jethomas  2008-04-06 13:05:02 
Re: Directories Redux
Bruce McFarling <agila  2008-04-06 11:53:00 
Re: Directories Redux
Bruce McFarling <agila  2008-04-06 12:06:04 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-09 14:37:22 
Re: Directories Redux
anton@[EMAIL PROTECTED]   2008-04-10 19:06:56 
Re: Directories Redux
Bruce McFarling <agila  2008-04-09 15:21:11 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-09 16:16:00 
Re: Directories Redux
Bruce McFarling <agila  2008-04-09 22:08:00 
Re: Directories Redux
Bruce McFarling <agila  2008-04-10 19:39:57 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-11 04:43:45 
Re: Directories Redux
Bruce McFarling <agila  2008-04-11 09:28:57 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-11 10:49:13 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-11 11:19:53 
Re: Directories Redux
Bruce McFarling <agila  2008-04-11 20:34:02 
Re: Directories Redux
Bruce McFarling <agila  2008-04-12 07:18:01 
Re: Directories Redux
Bruce McFarling <agila  2008-04-12 10:56:41 
Re: Directories Redux
m_l_g3 <m_l_g3@[EMAIL   2008-04-14 08:35:17 
Re: Directories Redux
Bruce McFarling <agila  2008-04-14 12:46:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 7:40:27 CDT 2008.