|
Boost-Commit : |
From: ghost_at_[hidden]
Date: 2007-12-11 14:45:38
Author: vladimir_prus
Date: 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
New Revision: 41980
URL: http://svn.boost.org/trac/boost/changeset/41980
Log:
Implement ISFILE for real
Text files modified:
trunk/tools/jam/src/compile.c | 5 +++--
trunk/tools/jam/src/filesys.h | 5 +++++
trunk/tools/jam/src/hcache.c | 8 +++++---
trunk/tools/jam/src/make.c | 3 ++-
trunk/tools/jam/src/make1.c | 3 ++-
trunk/tools/jam/src/rules.c | 2 +-
trunk/tools/jam/src/search.c | 15 +++++++++++----
trunk/tools/jam/src/search.h | 2 +-
8 files changed, 30 insertions(+), 13 deletions(-)
Modified: trunk/tools/jam/src/compile.c
==============================================================================
--- trunk/tools/jam/src/compile.c (original)
+++ trunk/tools/jam/src/compile.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -372,8 +372,9 @@
pushsettings( t->settings );
/* We don't expect that file to be included is generated by some
- action. Therefore, pass 0 as third argument. */
- t->boundname = search( t->name, &t->time, 0 );
+ action. Therefore, pass 0 as third argument.
+ If the name resolves to directory, let it error out. */
+ t->boundname = search( t->name, &t->time, 0, 0 );
popsettings( t->settings );
parse_file( t->boundname, frame );
Modified: trunk/tools/jam/src/filesys.h
==============================================================================
--- trunk/tools/jam/src/filesys.h (original)
+++ trunk/tools/jam/src/filesys.h 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -41,8 +41,13 @@
} ;
typedef struct file_info_t file_info_t ;
+/* Creates a pointer to information about file
+ 'filename', creating it as necessary. If
+ created, the structure will be default initialized. */
file_info_t * file_info(char * filename);
+/* Returns information about a file, queries the OS
+ if needed. */
file_info_t * file_query(char * filename);
void file_done();
Modified: trunk/tools/jam/src/hcache.c
==============================================================================
--- trunk/tools/jam/src/hcache.c (original)
+++ trunk/tools/jam/src/hcache.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -80,9 +80,11 @@
TARGET *t = bindtarget( hcachevar->string );
pushsettings( t->settings );
- /* Don't expect cache file to be generated, so pass 0
- as third argument to search. */
- t->boundname = search( t->name, &t->time, 0 );
+ /* Don't expect cache file to be generated, so pass 0
+ as third argument to search.
+ Expect the location to be specified via LOCATE,
+ so pass 0 as fourth arugment. */
+ t->boundname = search( t->name, &t->time, 0, 0 );
popsettings( t->settings );
if (hcachevar) {
Modified: trunk/tools/jam/src/make.c
==============================================================================
--- trunk/tools/jam/src/make.c (original)
+++ trunk/tools/jam/src/make.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -289,7 +289,8 @@
if( t->binding == T_BIND_UNBOUND && !( t->flags & T_FLAG_NOTFILE ) )
{
char* another_target;
- t->boundname = search( t->name, &t->time, &another_target );
+ t->boundname = search( t->name, &t->time, &another_target,
+ (t->flags & T_FLAG_ISFILE));
/* If it was detected that this target refers to an already
existing and bound one, we add include dependency, so that
every target which depends on us will depend on that other
Modified: trunk/tools/jam/src/make1.c
==============================================================================
--- trunk/tools/jam/src/make1.c (original)
+++ trunk/tools/jam/src/make1.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -1145,7 +1145,8 @@
return;
pushsettings( t->settings );
- t->boundname = search( t->name, &t->time, 0 );
+ t->boundname = search( t->name, &t->time, 0,
+ (t->flags & T_FLAG_ISFILE) );
t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING;
popsettings( t->settings );
}
Modified: trunk/tools/jam/src/rules.c
==============================================================================
--- trunk/tools/jam/src/rules.c (original)
+++ trunk/tools/jam/src/rules.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -165,7 +165,7 @@
/* We're binding a target with explicit LOCATE. So
third argument is of now use: nothing will be returned
through it. */
- t->boundname = search( t->name, &t->time, 0 );
+ t->boundname = search( t->name, &t->time, 0, 0 );
popsettings(t->settings);
break;
}
Modified: trunk/tools/jam/src/search.c
==============================================================================
--- trunk/tools/jam/src/search.c (original)
+++ trunk/tools/jam/src/search.c 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -20,6 +20,7 @@
# include "compile.h"
# include "strings.h"
# include "hash.h"
+# include "filesys.h"
# include <string.h>
typedef struct _binding {
@@ -89,7 +90,8 @@
search(
char *target,
time_t *time,
- char **another_target
+ char **another_target,
+ int file
)
{
PATHNAME f[1];
@@ -135,6 +137,7 @@
while( varlist )
{
BINDING b, *ba = &b;
+ file_info_t *ff;
f->f_root.ptr = varlist->string;
f->f_root.len = strlen( varlist->string );
@@ -145,6 +148,7 @@
if( DEBUG_SEARCH )
printf( "search %s: %s\n", target, buf->value );
+ ff = file_query(buf->value);
timestamp( buf->value, time );
b.binding = buf->value;
@@ -159,10 +163,13 @@
found = 1;
break;
}
- else if( *time )
+ else if( ff && ff->time )
{
- found = 1;
- break;
+ if (!file || ff->is_file)
+ {
+ found = 1;
+ break;
+ }
}
varlist = list_next( varlist );
Modified: trunk/tools/jam/src/search.h
==============================================================================
--- trunk/tools/jam/src/search.h (original)
+++ trunk/tools/jam/src/search.h 2007-12-11 14:45:37 EST (Tue, 11 Dec 2007)
@@ -8,4 +8,4 @@
* search.h - find a target along $(SEARCH) or $(LOCATE)
*/
-char *search( char *target, time_t *time, char **another_target );
+char *search( char *target, time_t *time, char **another_target, int file );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk