add $[canonical], bring autoheader up to date

This commit is contained in:
David Rose 2003-03-05 20:30:18 +00:00
parent 5ca55e86a7
commit 0f3b23ea37
6 changed files with 34 additions and 89 deletions

View File

@ -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). */

View File

@ -24,7 +24,7 @@ fi
]) ])
if test $ac_cv_ios_binary = yes; then 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 fi
]) ])
@ -48,7 +48,7 @@ fi
]) ])
if test $ac_cv_open_mask = yes; then 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 fi
]) ])
@ -62,7 +62,7 @@ using namespace std;],
[], [],
ac_cv_namespace=yes, ac_cv_namespace=no)]) ac_cv_namespace=yes, ac_cv_namespace=no)])
if test $ac_cv_namespace = yes; then if test $ac_cv_namespace = yes; then
AC_DEFINE(HAVE_NAMESPACE) AC_DEFINE(HAVE_NAMESPACE, 1, [Define if the C++ compiler uses namespaces])
fi fi
]) ])

View File

@ -83,5 +83,5 @@
** Also be sure to change the version number ** ** Also be sure to change the version number **
** at the beginning of configure.in. ** ** at the beginning of configure.in. **
**************** ****************/ **************** ****************/
#define VERSION "1.12" #define VERSION "1.13"
/**************** UPDATE VERSION NUMBER HERE ****************/ /**************** UPDATE VERSION NUMBER HERE ****************/

View File

@ -5,7 +5,7 @@ dnl **************** UPDATE VERSION NUMBER HERE ****************
dnl ** Also be sure to change the version number ** dnl ** Also be sure to change the version number **
dnl ** at the end of config_msvc.h. ** dnl ** at the end of config_msvc.h. **
dnl **************** **************** dnl **************** ****************
AM_INIT_AUTOMAKE(ppremake, 1.12) AM_INIT_AUTOMAKE(ppremake, 1.13)
dnl **************** UPDATE VERSION NUMBER HERE **************** dnl **************** UPDATE VERSION NUMBER HERE ****************
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
@ -77,10 +77,12 @@ else
fi fi
if test "$PLATFORM" = "Cygwin"; then if test "$PLATFORM" = "Cygwin"; then
AC_DEFINE(HAVE_CYGWIN) AC_DEFINE(HAVE_CYGWIN, 1, [Define if we're compiling with Cygwin.])
fi 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) AC_OUTPUT(Makefile)

View File

@ -1011,6 +1011,8 @@ r_expand_variable(const string &str, size_t &vp,
return expand_shell(params); return expand_shell(params);
} else if (funcname == "standardize") { } else if (funcname == "standardize") {
return expand_standardize(params); return expand_standardize(params);
} else if (funcname == "canonical") {
return expand_canonical(params);
} else if (funcname == "length") { } else if (funcname == "length") {
return expand_length(params); return expand_length(params);
} else if (funcname == "substr") { } else if (funcname == "substr") {
@ -1675,52 +1677,34 @@ expand_shell(const string &params) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
string PPScope:: string PPScope::
expand_standardize(const string &params) { expand_standardize(const string &params) {
string filename = trim_blanks(expand_string(params)); Filename filename = trim_blanks(expand_string(params));
if (filename.empty()) { if (filename.empty()) {
return string(); return string();
} }
vector<string> 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] == '/') { // Function: PPScope::expand_canonical
p++; // Access: Private
} // Description: Expands the "canonical" function variable. This
while (p < filename.length()) { // converts this filename to a canonical name by
size_t slash = filename.find('/', p); // replacing the directory part with the fully-qualified
string component = filename.substr(p, slash - p); // directory part. This is done by changing to that
if (component == ".") { // directory and calling getcwd().
// Ignore /./. //
} else if (component == ".." && !components.empty() && // See filename::make_canonical() for a complete
!(components.back() == "..")) { // explanation of the implications of this and of the
// Back up. // difference between this and standardize, above.
components.pop_back(); ////////////////////////////////////////////////////////////////////
} else { string PPScope::
components.push_back(component); expand_canonical(const string &params) {
} Filename filename = trim_blanks(expand_string(params));
filename.make_canonical();
p = slash; return filename;
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;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -96,6 +96,7 @@ private:
string expand_bintest(const string &params); string expand_bintest(const string &params);
string expand_shell(const string &params); string expand_shell(const string &params);
string expand_standardize(const string &params); string expand_standardize(const string &params);
string expand_canonical(const string &params);
string expand_length(const string &params); string expand_length(const string &params);
string expand_substr(const string &params); string expand_substr(const string &params);
string expand_findstring(const string &params); string expand_findstring(const string &params);