From 0f3b23ea376050d2598e6487f12200a5d6919dca Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 5 Mar 2003 20:30:18 +0000 Subject: [PATCH] add $[canonical], bring autoheader up to date --- ppremake/acconfig.h | 42 --------------------------- ppremake/acinclude.m4 | 6 ++-- ppremake/config_msvc.h | 2 +- ppremake/configure.in | 8 ++++-- ppremake/ppScope.cxx | 64 ++++++++++++++++-------------------------- ppremake/ppScope.h | 1 + 6 files changed, 34 insertions(+), 89 deletions(-) delete mode 100644 ppremake/acconfig.h diff --git a/ppremake/acconfig.h b/ppremake/acconfig.h deleted file mode 100644 index a1d06dea8a..0000000000 --- a/ppremake/acconfig.h +++ /dev/null @@ -1,42 +0,0 @@ -/* acconfig.h - This file is in the public domain. - - Descriptive text for the C preprocessor macros that - the distributed Autoconf macros can define. - No software package will use all of them; autoheader copies the ones - your configure.in uses into your configuration header file templates. - - The entries are in sort -df order: alphabetical, case insensitive, - ignoring punctuation (such as underscores). Although this order - can split up related entries, it makes it easier to check whether - a given entry is in the file. - - Leave the following blank line there!! Autoheader needs it. */ - - -/* Define if the C++ compiler uses namespaces. */ -#undef HAVE_NAMESPACE - -/* Define if the C++ iostream library supports ios::binary. */ -#undef HAVE_IOS_BINARY - -/* Define if fstream::open() accepts a third parameter for umask. */ -#undef HAVE_OPEN_MASK - -/* Define if we're compiling with Cygwin. */ -#undef HAVE_CYGWIN - -/* Define if we're compiling using Windows Microsoft Visual C++. */ -#undef WIN32_VC - -/* The platform ppremake is compiled for. This primarily controls the - initial setting of the $[PLATFORM] variable. */ -#define PLATFORM "" - - -/* Leave that blank line there!! Autoheader needs it. - If you're adding to this file, keep in mind: - The entries are in sort -df order: alphabetical, case insensitive, - ignoring punctuation (such as underscores). */ - - diff --git a/ppremake/acinclude.m4 b/ppremake/acinclude.m4 index c0d0a54311..7817888700 100644 --- a/ppremake/acinclude.m4 +++ b/ppremake/acinclude.m4 @@ -24,7 +24,7 @@ fi ]) if test $ac_cv_ios_binary = yes; then - AC_DEFINE(HAVE_IOS_BINARY) + AC_DEFINE(HAVE_IOS_BINARY, 1, [Define if the C++ iostream library supports ios::binary.]) fi ]) @@ -48,7 +48,7 @@ fi ]) if test $ac_cv_open_mask = yes; then - AC_DEFINE(HAVE_OPEN_MASK) + AC_DEFINE(HAVE_OPEN_MASK, 1, [Define if fstream::open() accepts a third parameter for umask.]) fi ]) @@ -62,7 +62,7 @@ using namespace std;], [], ac_cv_namespace=yes, ac_cv_namespace=no)]) if test $ac_cv_namespace = yes; then - AC_DEFINE(HAVE_NAMESPACE) + AC_DEFINE(HAVE_NAMESPACE, 1, [Define if the C++ compiler uses namespaces]) fi ]) diff --git a/ppremake/config_msvc.h b/ppremake/config_msvc.h index ebba8cb41f..1867a060d0 100644 --- a/ppremake/config_msvc.h +++ b/ppremake/config_msvc.h @@ -83,5 +83,5 @@ ** Also be sure to change the version number ** ** at the beginning of configure.in. ** **************** ****************/ -#define VERSION "1.12" +#define VERSION "1.13" /**************** UPDATE VERSION NUMBER HERE ****************/ diff --git a/ppremake/configure.in b/ppremake/configure.in index e81c003126..750e10a244 100644 --- a/ppremake/configure.in +++ b/ppremake/configure.in @@ -5,7 +5,7 @@ dnl **************** UPDATE VERSION NUMBER HERE **************** dnl ** Also be sure to change the version number ** dnl ** at the end of config_msvc.h. ** dnl **************** **************** -AM_INIT_AUTOMAKE(ppremake, 1.12) +AM_INIT_AUTOMAKE(ppremake, 1.13) dnl **************** UPDATE VERSION NUMBER HERE **************** AM_CONFIG_HEADER(config.h) @@ -77,10 +77,12 @@ else fi if test "$PLATFORM" = "Cygwin"; then - AC_DEFINE(HAVE_CYGWIN) + AC_DEFINE(HAVE_CYGWIN, 1, [Define if we're compiling with Cygwin.]) fi -AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM") +AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM", + [The platform ppremake is compiled for. This primarily controls the + initial setting of the PLATFORM ppremake variable.]) AC_OUTPUT(Makefile) diff --git a/ppremake/ppScope.cxx b/ppremake/ppScope.cxx index 5e87dd2b91..5b8107ef29 100644 --- a/ppremake/ppScope.cxx +++ b/ppremake/ppScope.cxx @@ -1011,6 +1011,8 @@ r_expand_variable(const string &str, size_t &vp, return expand_shell(params); } else if (funcname == "standardize") { return expand_standardize(params); + } else if (funcname == "canonical") { + return expand_canonical(params); } else if (funcname == "length") { return expand_length(params); } else if (funcname == "substr") { @@ -1675,52 +1677,34 @@ expand_shell(const string ¶ms) { //////////////////////////////////////////////////////////////////// string PPScope:: expand_standardize(const string ¶ms) { - string filename = trim_blanks(expand_string(params)); + Filename filename = trim_blanks(expand_string(params)); if (filename.empty()) { return string(); } - vector components; + filename.standardize(); + return filename; +} - // Pull off the components of the filename one at a time. - bool global = (filename[0] == '/'); - size_t p = 0; - while (p < filename.length() && filename[p] == '/') { - p++; - } - while (p < filename.length()) { - size_t slash = filename.find('/', p); - string component = filename.substr(p, slash - p); - if (component == ".") { - // Ignore /./. - } else if (component == ".." && !components.empty() && - !(components.back() == "..")) { - // Back up. - components.pop_back(); - } else { - components.push_back(component); - } - - p = slash; - while (p < filename.length() && filename[p] == '/') { - p++; - } - } - - // Now reassemble the filename. - string result; - if (global) { - result = "/"; - } - if (!components.empty()) { - result += components[0]; - for (int i = 1; i < (int)components.size(); i++) { - result += "/" + components[i]; - } - } - - return result; +//////////////////////////////////////////////////////////////////// +// Function: PPScope::expand_canonical +// Access: Private +// Description: Expands the "canonical" function variable. This +// converts this filename to a canonical name by +// replacing the directory part with the fully-qualified +// directory part. This is done by changing to that +// directory and calling getcwd(). +// +// See filename::make_canonical() for a complete +// explanation of the implications of this and of the +// difference between this and standardize, above. +//////////////////////////////////////////////////////////////////// +string PPScope:: +expand_canonical(const string ¶ms) { + Filename filename = trim_blanks(expand_string(params)); + filename.make_canonical(); + return filename; } //////////////////////////////////////////////////////////////////// diff --git a/ppremake/ppScope.h b/ppremake/ppScope.h index 11c41b3234..50505631ed 100644 --- a/ppremake/ppScope.h +++ b/ppremake/ppScope.h @@ -96,6 +96,7 @@ private: string expand_bintest(const string ¶ms); string expand_shell(const string ¶ms); string expand_standardize(const string ¶ms); + string expand_canonical(const string ¶ms); string expand_length(const string ¶ms); string expand_substr(const string ¶ms); string expand_findstring(const string ¶ms);