Browse Source

add $[canonical], bring autoheader up to date

David Rose 23 years ago
parent
commit
0f3b23ea37
6 changed files with 34 additions and 89 deletions
  1. 0 42
      ppremake/acconfig.h
  2. 3 3
      ppremake/acinclude.m4
  3. 1 1
      ppremake/config_msvc.h
  4. 5 3
      ppremake/configure.in
  5. 24 40
      ppremake/ppScope.cxx
  6. 1 0
      ppremake/ppScope.h

+ 0 - 42
ppremake/acconfig.h

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

+ 3 - 3
ppremake/acinclude.m4

@@ -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
 ])
 ])
 
 

+ 1 - 1
ppremake/config_msvc.h

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

+ 5 - 3
ppremake/configure.in

@@ -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)

+ 24 - 40
ppremake/ppScope.cxx

@@ -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;
-
-  // Pull off the components of the filename one at a time.
-  bool global = (filename[0] == '/');
+  filename.standardize();
+  return filename;
+}
 
 
-  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 &params) {
+  Filename filename = trim_blanks(expand_string(params));
+  filename.make_canonical();
+  return filename;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
ppremake/ppScope.h

@@ -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);