From b03372ac97f5f49bed5d244e014131fae983d757 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 10 Dec 2003 08:27:21 +0000 Subject: [PATCH] The 'path.exists' rule is now native. [SVN r21201] --- historic/jam/src/build.bat | 2 +- historic/jam/src/build.jam | 3 ++- historic/jam/src/build.sh | 3 ++- historic/jam/src/builtins.c | 1 + historic/jam/src/modules/path.c | 29 +++++++++++++++++++++++++++++ jam_src/build.bat | 2 +- jam_src/build.jam | 3 ++- jam_src/build.sh | 3 ++- jam_src/builtins.c | 1 + jam_src/modules/path.c | 29 +++++++++++++++++++++++++++++ v2/util/path.jam | 1 + 11 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 historic/jam/src/modules/path.c create mode 100644 jam_src/modules/path.c diff --git a/historic/jam/src/build.bat b/historic/jam/src/build.bat index 1ca6bfb4b..f76bb86b1 100644 --- a/historic/jam/src/build.bat +++ b/historic/jam/src/build.bat @@ -319,7 +319,7 @@ set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c l set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c regexp.c set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c pwd.c class.c w32_getreg.c native.c -set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c +set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c @echo ON rd /S /Q bootstrap.%BOOST_JAM_TOOLSET% diff --git a/historic/jam/src/build.jam b/historic/jam/src/build.jam index 018c7e2ff..6863a3959 100644 --- a/historic/jam/src/build.jam +++ b/historic/jam/src/build.jam @@ -275,7 +275,8 @@ jam.source = option.c parse.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c - builtins.c pwd.c class.c native.c modules/set.c + builtins.c pwd.c class.c native.c modules/set.c + modules/path.c ; if $(NT) { diff --git a/historic/jam/src/build.sh b/historic/jam/src/build.sh index f2de9f0b5..0524d52c0 100644 --- a/historic/jam/src/build.sh +++ b/historic/jam/src/build.sh @@ -191,7 +191,8 @@ BJAM_SOURCES="\ hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\ newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\ rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\ - strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c" + strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c\ + modules/path.c" echo_run rm -rf bootstrap.$BOOST_JAM_TOOLSET echo_run mkdir bootstrap.$BOOST_JAM_TOOLSET diff --git a/historic/jam/src/builtins.c b/historic/jam/src/builtins.c index 18fffb37f..a4d882c12 100644 --- a/historic/jam/src/builtins.c +++ b/historic/jam/src/builtins.c @@ -273,6 +273,7 @@ load_builtins() /* Initialize builtin modules */ init_set(); + init_path(); } /* diff --git a/historic/jam/src/modules/path.c b/historic/jam/src/modules/path.c new file mode 100644 index 000000000..38de64bfc --- /dev/null +++ b/historic/jam/src/modules/path.c @@ -0,0 +1,29 @@ + +#include "../native.h" +#include "../timestamp.h" +#include "../newstr.h" + +LIST *path_exists( PARSE *parse, FRAME *frame ) +{ + LIST* l = lol_get( frame->args, 0 ); + + time_t time; + timestamp(l->string, &time); + if (time != 0) + { + return list_new(0, newstr("true")); + } + else + { + return L0; + } +} + +void init_path() +{ + { + char* args[] = { "location", 0 }; + declare_native_rule("path", "exists", args, path_exists); + } + +} diff --git a/jam_src/build.bat b/jam_src/build.bat index 1ca6bfb4b..f76bb86b1 100644 --- a/jam_src/build.bat +++ b/jam_src/build.bat @@ -319,7 +319,7 @@ set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c l set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c regexp.c set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c pwd.c class.c w32_getreg.c native.c -set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c +set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c @echo ON rd /S /Q bootstrap.%BOOST_JAM_TOOLSET% diff --git a/jam_src/build.jam b/jam_src/build.jam index 018c7e2ff..6863a3959 100644 --- a/jam_src/build.jam +++ b/jam_src/build.jam @@ -275,7 +275,8 @@ jam.source = option.c parse.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c - builtins.c pwd.c class.c native.c modules/set.c + builtins.c pwd.c class.c native.c modules/set.c + modules/path.c ; if $(NT) { diff --git a/jam_src/build.sh b/jam_src/build.sh index f2de9f0b5..0524d52c0 100644 --- a/jam_src/build.sh +++ b/jam_src/build.sh @@ -191,7 +191,8 @@ BJAM_SOURCES="\ hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\ newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\ rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\ - strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c" + strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c\ + modules/path.c" echo_run rm -rf bootstrap.$BOOST_JAM_TOOLSET echo_run mkdir bootstrap.$BOOST_JAM_TOOLSET diff --git a/jam_src/builtins.c b/jam_src/builtins.c index 18fffb37f..a4d882c12 100644 --- a/jam_src/builtins.c +++ b/jam_src/builtins.c @@ -273,6 +273,7 @@ load_builtins() /* Initialize builtin modules */ init_set(); + init_path(); } /* diff --git a/jam_src/modules/path.c b/jam_src/modules/path.c new file mode 100644 index 000000000..38de64bfc --- /dev/null +++ b/jam_src/modules/path.c @@ -0,0 +1,29 @@ + +#include "../native.h" +#include "../timestamp.h" +#include "../newstr.h" + +LIST *path_exists( PARSE *parse, FRAME *frame ) +{ + LIST* l = lol_get( frame->args, 0 ); + + time_t time; + timestamp(l->string, &time); + if (time != 0) + { + return list_new(0, newstr("true")); + } + else + { + return L0; + } +} + +void init_path() +{ + { + char* args[] = { "location", 0 }; + declare_native_rule("path", "exists", args, path_exists); + } + +} diff --git a/v2/util/path.jam b/v2/util/path.jam index 305a8d777..ee550de5a 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -202,6 +202,7 @@ rule exists ( file ) { return [ path.glob $(file:D) : $(file:D=) ] ; } +NATIVE_RULE path : exists ;