change support python version
[platform/upstream/boost.git] / tools / build / src / engine / pathsys.h
1 /*
2  * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
3  *
4  * This file is part of Jam - see jam.c for Copyright information.
5  */
6
7 /*
8  * pathsys.h - PATHNAME struct
9  */
10
11 /*
12  * PATHNAME - a name of a file, broken into <grist>dir/base/suffix(member)
13  *
14  * <grist> - salt to distinguish between targets that would otherwise have the
15  * same name - it never appears in the bound name of a target.
16  *
17  * (member) - archive member name: the syntax is arbitrary, but must agree in
18  * path_parse(), path_build() and the Jambase.
19  */
20
21 #ifndef PATHSYS_VP_20020211_H
22 #define PATHSYS_VP_20020211_H
23
24 #include "config.h"
25 #include "object.h"
26 #include "strings.h"
27
28
29 typedef struct _pathpart
30 {
31     char const * ptr;
32     int len;
33 } PATHPART;
34
35 typedef struct _pathname
36 {
37     PATHPART part[ 6 ];
38
39 #define f_grist   part[ 0 ]
40 #define f_root    part[ 1 ]
41 #define f_dir     part[ 2 ]
42 #define f_base    part[ 3 ]
43 #define f_suffix  part[ 4 ]
44 #define f_member  part[ 5 ]
45 } PATHNAME;
46
47
48 void path_build( PATHNAME *, string * file );
49 void path_parse( char const * file, PATHNAME * );
50 void path_parent( PATHNAME * );
51 int path_translate_to_os( char const *, string * file );
52
53 /* Given a path, returns an object containing an equivalent path in canonical
54  * format that can be used as a unique key for that path. Equivalent paths such
55  * as a/b, A\B, and a\B on NT all yield the same key.
56  */
57 OBJECT * path_as_key( OBJECT * path );
58
59 /* Called as an optimization when we know we have a path that is already in its
60  * canonical/long/key form. Avoids the need for some subsequent path_as_key()
61  * call to do a potentially expensive path conversion requiring access to the
62  * actual underlying file system.
63  */
64 void path_register_key( OBJECT * canonic_path );
65
66 /* Returns a static pointer to the system dependent path to the temporary
67  * directory. NOTE: Does *not* include a trailing path separator.
68  */
69 string const * path_tmpdir( void );
70
71 /* Returns a new temporary name. */
72 OBJECT * path_tmpnam( void );
73
74 /* Returns a new temporary path. */
75 OBJECT * path_tmpfile( void );
76
77 /* Give the first argument to 'main', return a full path to our executable.
78  * Returns null in the unlikely case it cannot be determined. Caller is
79  * responsible for freeing the string.
80  *
81  * Implemented in jam.c
82  */
83 char * executable_path( char const * argv0 );
84
85 void path_done( void );
86
87 #endif