Index: doc/help/ref-ppdcfile.html
===================================================================
--- doc/help/ref-ppdcfile.html (revision 8676)
+++ doc/help/ref-ppdcfile.html (working copy)
@@ -98,6 +98,34 @@
case-insensitive and can be any sequence of letters, numbers,
and the underscore. The value can be any valid expression.
+Predefined Names
+
+The following #define
names are set by the PPD compiler:
+
+
+
+ CUPS_VERSION
- The full CUPS version string, e.g.
+ "1.4.0"
+
+ CUPS_VERSION_MAJOR
- The major version number, e.g.
+ "1"
+
+ CUPS_VERSION_MINOR
- The minor version number, e.g.
+ "4"
+
+ CUPS_VERSION_PATCH
- The patch version number, e.g.
+ "0"
+
+ PLATFORM_NAME
- The operating system name used by the
+ current system as reported by "uname" ("Windows" on Microsoft
+ Windows)
+
+ PLATFORM_ARCH
- The processor architecture used by the
+ current system as reported by "uname -m" ("X86" or "X64" on Microsoft
+ Windows)
+
+
+
See Also
#include
Index: ppdc/ppdc-source.cxx
===================================================================
--- ppdc/ppdc-source.cxx (revision 8676)
+++ ppdc/ppdc-source.cxx (working copy)
@@ -71,6 +71,9 @@
#include "data/hp.h"
#include "data/label.h"
#include "data/pcl.h"
+#ifndef WIN32
+# include
+#endif // !WIN32
//
@@ -110,6 +113,25 @@
cond_current = cond_stack;
cond_stack[0] = PPDC_COND_NORMAL;
+ // Add standard #define variables...
+#define MAKE_STRING(x) #x
+
+ vars->add(new ppdcVariable("CUPS_VERSION", MAKE_STRING(CUPS_VERSION)));
+ vars->add(new ppdcVariable("CUPS_VERSION_MAJOR", MAKE_STRING(CUPS_VERSION_MAJOR)));
+ vars->add(new ppdcVariable("CUPS_VERSION_MINOR", MAKE_STRING(CUPS_VERSION_MINOR)));
+ vars->add(new ppdcVariable("CUPS_VERSION_PATCH", MAKE_STRING(CUPS_VERSION_PATCH)));
+
+#ifdef WIN32
+ vars->add(new ppdcVariable("PLATFORM_NAME", "Windows"));
+ vars->add(new ppdcVariable("PLATFORM_ARCH", "X86"));
+
+#else
+ struct utsname name; // uname information
+
+ vars->add(new ppdcVariable("PLATFORM_NAME", name.sysname));
+ vars->add(new ppdcVariable("PLATFORM_ARCH", name.machine));
+#endif // WIN32
+
if (f)
read_file(f, ffp);
}