[jamming] Path specification (was: Majam - keeping jamup-to-date)
Eduard de Jong
info at dejongfrz.nl
Thu Aug 17 12:34:39 PDT 2006
At 09:12 +0200 14-08-2006, Johan Nilsson wrote:
> > Here is a two part solution:
>>
>> 1. Define a portable path format for use in jam, jambase and
> > jamfile's on all platforms.
In Java a file name is represented in a canonical form, that is with
a '/' as component separator. We may look at their solution to
cross-platform file names.
> >
>> 2. Add two modifiers, similar to what Alen has adopted, one
>> for converting native into portable ':~' and one to convert
>> from portable to native ':/'
>
>I'd prefer something like the T/F modifiers suggested by David Turner
>(or why not N(ative)/P(ortable - if they aren't already used).
Maybe we do need modifiers at all, and jam can be smart enough to do it for us
--input--
When jam, interprets a string constant value it performs a scan to
see if it contains a file name. This scan is specific for the
platform that executes jam for variable assignments on the command
line, from the environment, the result of GLOB and of the result of
binding. File name constants in Jamfiles are scanned as 'canonical'.
In all cases the internal representation in memeory of the value is
'canonical.
--output--
When a variable is expanded in an action body any of its elements
that represent file names are converted to the platform that executes
the actions.
In order to get there the internal variable definition needs to
include a marker that indicates if it is a file name or not.
>
>>
>>
>> Based on my quick reading of the OpenVMS links provided by
>> John and Tim a portable path could be defined as follows:
>>
>> Absolute path:
>> "drive:/subpath1/subpath2/file.ext;v"
>> where drive: and ;v optional, leading / mandatory
>>
>> Relative path:
>> "../subpath/file.ext;v"
>> where ;v optional, leading non-/ mandatory
>
>Well, for portable paths, I'd prefer a leading / for absolute paths and
>to get rid of the version altogether, i.e.:
There are other components to consider as part of a file name in the
canonical representation, like the member of an archive or library.
For instance, in Java an '!' is used to separate the archive file
name from the archive member file name, which is also a path name.
So what is needed is a 'canonical file name syntax' that contains all
possible components we may wish to recognize and store&process during
execution.
This 'canonical' syntax is to be used in jamfiles. Any non portable
components present in the syntax are highly unlikely to be present in
portable jamfiles, so the jamfile writer can resort to the subset of
the canonical syntax that is portable.
And, for any of these canonical file name components there is a
:modifier to retrieve or change it. If they are not present in jam
files, the non-portable components of a file name will only emerge
during execution.
We only need one new modifiers :V for the version, and a process rule
that prohibits the version from being propagated when any component
is retrieved or modified. This will guarantee that the version is
only attached to the original file name, and not to any of its
derivations. A similar rule should apply to archive members.
>
>Absolute path:
>"/drive:/subpath1/subpath2/file.ext"
>
>Relative path:
>"subpath/file.ext"
A canonical syntax could be:
[[rootname]:][<dirpath>/]filename[.ext]*[$version][:[memberpath/]memberfilename[.ext]]
Where any component except the filename is optional, and, provided
that the filename and at least one other component are present, a
string in this format can be uniquely recognized as a file name.
With this syntax an absolute path in the canonical representation is
a string starting with a ':'.
And, in this syntax there is the 'hint' that the root of an archive
member is the name of the archive file...
>
>Globbing should always return portable paths on all platforms (version
>stripped under VMS).
Exactly.
>
>/ Johan
--
Eduard de Jong
M: +31 62 669 2972 (NL)
M: +44 787 627 2204 (UK)
M: +1 650 703 4608 (US)
H: +31 20 468 7574 (NL)
O: +31 20 693 7510 (NL)
F: +31 20 6 TBP
skype: +1 650 515 3448
Ax: +1 650 352 4743 (CA)
private: mailto:info at dejongfrz.nl
More information about the jamming
mailing list