summaryrefslogtreecommitdiff
path: root/ppdc
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2008-07-03 05:38:29 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2008-07-03 05:38:29 +0000
commit4509bb49335b3edfdb1b03d83d6cd05890968b59 (patch)
treeddaed95be285a8c010203ca908b7ebeb66056cc2 /ppdc
parent75bd9771f6e44fdd887ee90faac46f403aefc0fc (diff)
downloadcups-4509bb49335b3edfdb1b03d83d6cd05890968b59.tar.gz
Merge changes from CUPS 1.4svn-r7715.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@834 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'ppdc')
-rw-r--r--ppdc/Dependencies6
-rw-r--r--ppdc/Makefile37
-rw-r--r--ppdc/drv.cxx438
-rw-r--r--ppdc/ppdc-catalog.cxx22
-rw-r--r--ppdc/ppdc-driver.cxx11
-rw-r--r--ppdc/ppdc-file.cxx12
-rw-r--r--ppdc/ppdc-source.cxx13
-rw-r--r--ppdc/ppdc.h6
-rw-r--r--ppdc/sample.drv68
-rw-r--r--ppdc/testcatalog.cxx63
10 files changed, 164 insertions, 512 deletions
diff --git a/ppdc/Dependencies b/ppdc/Dependencies
index b5f4d4bac..624f0b214 100644
--- a/ppdc/Dependencies
+++ b/ppdc/Dependencies
@@ -51,10 +51,6 @@ ppdc-string.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
ppdc-string.o: ../cups/versioning.h
ppdc-variable.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
ppdc-variable.o: ../cups/versioning.h
-drv.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
-drv.o: ../cups/versioning.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
-drv.o: ../cups/string.h ../cups/ppd.h ../cups/array.h ../cups/file.h
-drv.o: ../cups/language.h ../cups/dir.h
ppdc.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
ppdc.o: ../cups/versioning.h
ppdhtml.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
@@ -66,3 +62,5 @@ ppdmerge.o: ../cups/string.h ../cups/ppd.h ../cups/array.h ../cups/file.h
ppdmerge.o: ../cups/language.h ../cups/array.h ../cups/string.h ../config.h
ppdpo.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
ppdpo.o: ../cups/versioning.h
+testcatalog.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h
+testcatalog.o: ../cups/versioning.h
diff --git a/ppdc/Makefile b/ppdc/Makefile
index fc0fbc885..34f8a61e0 100644
--- a/ppdc/Makefile
+++ b/ppdc/Makefile
@@ -46,24 +46,24 @@ LIBOBJS = \
ppdc-variable.o
OBJS = \
$(LIBOBJS) \
- drv.o \
ppdc.o \
ppdhtml.o \
ppdi.o \
ppdmerge.o \
- ppdpo.o
+ ppdpo.o \
+ testcatalog.o
LIBTARGETS = \
$(LIBCUPSPPDC) \
libcupsppdc.a \
ppdc-static
TARGETS = \
$(LIBTARGETS) \
- drv \
ppdc \
ppdhtml \
ppdi \
ppdmerge \
- ppdpo
+ ppdpo \
+ testcatalog
#
@@ -115,9 +115,6 @@ install: all install-data install-headers install-libs install-exec
install-data:
$(INSTALL_DIR) $(DATADIR)/drv
$(INSTALL_DATA) sample.drv $(DATADIR)/drv
- if test `uname` = Darwin; then \
- $(INSTALL_DIR) /Library/Printers/PPDs.drv; \
- fi
#
@@ -132,8 +129,6 @@ install-exec:
$(INSTALL_BIN) ppdi $(BINDIR)
$(INSTALL_BIN) ppdmerge $(BINDIR)
$(INSTALL_BIN) ppdpo $(BINDIR)
- $(INSTALL_DIR) $(SERVERBIN)/driver
- $(INSTALL_BIN) drv $(SERVERBIN)/driver
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
for file in $(TARGETS); do \
@@ -189,13 +184,8 @@ uninstall:
$(RM) $(BINDIR)/ppdi
$(RM) $(BINDIR)/ppdmerge
$(RM) $(BINDIR)/ppdpo
- $(RM) $(SERVERBIN)/driver/drv
- $(RMDIR) $(SERVERBIN)/driver
$(RM) $(DATADIR)/drv/sample.drv
$(RMDIR) $(DATADIR)/drv
- if test `uname` = Darwin; then \
- $(RMDIR) /Library/Printers/PPDs.drv; \
- fi
$(RM) $(LIBDIR)/libcupsppdc.1.dylib
$(RM) $(LIBDIR)/libcupsppdc.a
$(RM) $(LIBDIR)/libcupsppdc.dylib
@@ -230,15 +220,6 @@ framedhelp:
#
-# drv, the CUPS driver interface program to the PPD compiler.
-#
-
-drv: drv.o $(LIBCUPSPPDC) ../cups/$(LIBCUPS)
- echo Linking $@...
- $(CXX) $(LDFLAGS) -o $@ drv.o -L. -lcupsppdc $(LIBS)
-
-
-#
# ppdc, the PPD compiler.
#
@@ -293,6 +274,16 @@ ppdpo: ppdpo.o $(LIBCUPSPPDC) ../cups/$(LIBCUPS)
#
+# testcatalog, test ppdcCatalog class.
+#
+
+testcatalog: testcatalog.o libcupsppdc.a ../cups/libcups.a
+ echo Linking $@...
+ $(CXX) $(LDFLAGS) -o $@ testcatalog.o libcupsppdc.a \
+ ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+
+
+#
# libcupsppdc.so.1, libcupsppdc.sl.1
#
diff --git a/ppdc/drv.cxx b/ppdc/drv.cxx
deleted file mode 100644
index 8c0aec6c9..000000000
--- a/ppdc/drv.cxx
+++ /dev/null
@@ -1,438 +0,0 @@
-//
-// "$Id$"
-//
-// DDK driver interface main entry for the CUPS PPD Compiler.
-//
-// Copyright 2007-2008 by Apple Inc.
-// Copyright 2002-2006 by Easy Software Products.
-//
-// These coded instructions, statements, and computer programs are the
-// property of Apple Inc. and are protected by Federal copyright
-// law. Distribution and use rights are outlined in the file "LICENSE.txt"
-// which should have been included with this file. If this file is
-// file is missing or damaged, see the license at "http://www.cups.org/".
-//
-// Contents:
-//
-// main() - Enumerate or display PPD files.
-// cat_ppd() - Display a PPD file.
-// list_ppds() - List PPDs.
-//
-
-//
-// Include necessary headers...
-//
-
-#include "ppdc.h"
-#include <cups/cups.h>
-#include <cups/dir.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-
-//
-// Local functions...
-//
-
-static int cat_ppd(ppdcSource *src, const char *name);
-static int list_drvs(const char *pathname, const char *prefix);
-static int list_ppds(ppdcSource *src, const char *name);
-
-
-//
-// 'main()' - Enumerate or display PPD files.
-//
-
-int // O - Exit status
-main(int argc, // I - Number of command-line arguments
- char *argv[]) // I - Command-line arguments
-{
- const char *datadir; // CUPS_DATADIR
- ppdcSource *src; // PPD source file data
- char filename[1024], // Full path to .drv file(s)
- scheme[32], // URI scheme ("drv")
- userpass[256], // User/password info (unused)
- host[2], // Hostname (unused)
- resource[1024], // Resource path (/dir/to/filename.drv)
- *pc_file_name; // Filename portion of URI
- int port, // Port number (unused)
- status; // Exit status
-
-
- // Determine where CUPS has installed the data files...
- if ((datadir = getenv("CUPS_DATADIR")) == NULL)
- datadir = CUPS_DATADIR;
-
- // List all available PPDs or cat a single PPD...
- if (argc == 2 && !strcmp(argv[1], "list"))
- {
-#ifdef __APPLE__
- if (!access("/Library/Printers/PPDs.drv", 0))
- list_drvs("/Library/Printers/PPDs.drv", "/Library/Printers/PPDs.drv");
-#endif // __APPLE__
-
- snprintf(filename, sizeof(filename), "%s/drv", datadir);
- return (list_drvs(filename, "/"));
- }
- else if (argc == 3 && !strcmp(argv[1], "cat"))
- {
- httpSeparateURI(HTTP_URI_CODING_ALL, argv[2], scheme, sizeof(scheme),
- userpass, sizeof(userpass), host, sizeof(host), &port,
- resource, sizeof(resource));
-
- if (strstr(resource, "../") ||
- (pc_file_name = strrchr(resource, '/')) == NULL ||
- pc_file_name == resource)
- {
- fprintf(stderr, "ERROR: Bad driver info URI \"%s\"!\n", argv[2]);
- return (1);
- }
-
- *pc_file_name++ = '\0';
-
-#ifdef __APPLE__
- if (!strncmp(resource, "/Library/Printers/PPDs.drv/", 27))
- strlcpy(filename, resource, sizeof(filename));
- else
-#endif // __APPLE__
-
- snprintf(filename, sizeof(filename), "%s/drv%s", datadir, resource);
-
- src = new ppdcSource(filename);
-
- status = cat_ppd(src, pc_file_name);
-
- delete src;
-
- return (status);
- }
-
- fprintf(stderr, "ERROR: Usage: %s cat URI\n", argv[0]);
- fprintf(stderr, "ERROR: Usage: %s list\n", argv[0]);
-
- return (1);
-}
-
-
-//
-// 'cat_ppd()' - Display a PPD file.
-//
-
-static int // O - Exit status
-cat_ppd(ppdcSource *src, // I - Driver info file
- const char *name) // I - PC filename
-{
- ppdcDriver *d; // Current driver
- cups_file_t *out; // Stdout via CUPS file API
-
-
- for (d = (ppdcDriver *)src->drivers->first();
- d;
- d = (ppdcDriver *)src->drivers->next())
- if (!strcmp(name, d->pc_file_name->value))
- {
- out = cupsFileStdout();
-
- d->write_ppd_file(out, NULL, NULL, src, PPDC_LFONLY);
- cupsFileClose(out);
- return (0);
- }
-
- return (1);
-}
-
-
-//
-// 'list_drvs()' - List all drv files in the given path...
-//
-
-static int // O - Exit status
-list_drvs(const char *pathname, // I - Full path to directory
- const char *prefix) // I - Prefix for directory
-{
- char *ext, // Extension on file
- filename[1024], // Full path to .drv file(s)
- newprefix[1024]; // New prefix for directory
- cups_dir_t *dir; // Current directory
- cups_dentry_t *dent; // Current directory entry
-
-
- if ((dir = cupsDirOpen(pathname)) == NULL)
- return (1);
-
- while ((dent = cupsDirRead(dir)) != NULL)
- {
- // Skip "dot" files...
- if (dent->filename[0] == '.')
- continue;
-
- // See if this is a file or directory...
- snprintf(filename, sizeof(filename), "%s/%s", pathname, dent->filename);
-
- if (S_ISDIR(dent->fileinfo.st_mode))
- {
- // Descend into the subdirectory...
- snprintf(newprefix, sizeof(newprefix), "%s%s/", prefix, dent->filename);
-
- if (list_drvs(filename, newprefix))
- {
- cupsDirClose(dir);
- return (1);
- }
- }
- else if ((ext = strrchr(dent->filename, '.')) != NULL &&
- (!strcmp(ext, ".drv") || !strcmp(ext, ".drv.gz")))
- {
- // List the PPDs in this driver info file...
- ppdcSource *src = new ppdcSource(filename);
- // Driver info file
-
- snprintf(newprefix, sizeof(newprefix), "%s%s", prefix, dent->filename);
- list_ppds(src, newprefix);
- delete src;
- }
- }
-
- cupsDirClose(dir);
-
- return (0);
-}
-
-
-//
-// 'list_ppds()' - List PPDs in a driver info file.
-//
-
-static int // O - Exit status
-list_ppds(ppdcSource *src, // I - Driver info file
- const char *name) // I - Name of driver info file
-{
- ppdcDriver *d; // Current driver
- ppdcAttr *attr; // 1284DeviceID attribute
- char uri[1024]; // Driver URI
-
-
- for (d = (ppdcDriver *)src->drivers->first();
- d;
- d = (ppdcDriver *)src->drivers->next())
- {
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "drv", "", "", 0,
- "%s/%s", name, d->pc_file_name->value);
-
- attr = d->find_attr("1284DeviceID", NULL);
-
- printf("\"%s\" en \"%s\" \"%s\" \"%s\"\n", uri, d->manufacturer->value,
- d->model_name->value, attr ? attr->value->value : "");
- }
-
- return (0);
-}
-
-
-
-
-#if 0
-
-
-
- // Scan the command-line...
- catalog = NULL;
- outdir = "ppd";
- src = 0;
- verbose = 0;
- locales = NULL;
- comp = PPDC_NO_COMPRESSION;
- le = PPDC_LFONLY;
-
- for (i = 1; i < argc; i ++)
- if (argv[i][0] == '-')
- {
- for (opt = argv[i] + 1; *opt; opt ++)
- switch (*opt)
- {
- case 'c' : // Message catalog...
- i ++;
- if (i >= argc)
- usage();
-
- if (verbose > 1)
- printf("ppdc: Loading messages from \"%s\"...\n", argv[i]);
-
- if (!catalog)
- catalog = new ppdcCatalog("en");
-
- if (catalog->load_messages(argv[i]))
- {
- fprintf(stderr,
- "ppdc: Unable to load localization file \"%s\" - %s\n",
- argv[i], strerror(errno));
- return (1);
- }
- break;
-
- case 'd' : // Output directory...
- i ++;
- if (i >= argc)
- usage();
-
- if (verbose > 1)
- printf("ppdc: Writing PPD files to directory \"%s\"...\n",
- argv[i]);
-
- outdir = argv[i];
- break;
-
- case 'l' : // Language(s)...
- i ++;
- if (i >= argc)
- usage();
-
- if (strchr(argv[i], ','))
- {
- // Comma-delimited list of languages...
- char temp[1024], // Copy of language list
- *start, // Start of current locale name
- *end; // End of current locale name
-
-
- locales = new ppdcArray();
-
- strlcpy(temp, argv[i], sizeof(temp));
- for (start = temp; *start; start = end)
- {
- if ((end = strchr(start, ',')) != NULL)
- *end++ = '\0';
- else
- end = start + strlen(start);
-
- if (end > start)
- locales->add(new ppdcString(start));
- }
- }
- else
- {
- if (verbose > 1)
- printf("ppdc: Loading messages for locale \"%s\"...\n",
- argv[i]);
-
- if (catalog)
- delete catalog;
-
- catalog = new ppdcCatalog(argv[i]);
-
- if (catalog->messages->count == 0)
- {
- fprintf(stderr,
- "ppdc: Unable to find localization for \"%s\" - %s\n",
- argv[i], strerror(errno));
- return (1);
- }
- }
- break;
-
- case 'I' : // Include directory...
- i ++;
- if (i >= argc)
- usage();
-
- if (verbose > 1)
- printf("ppdc: Adding include directory \"%s\"...\n", argv[i]);
-
- ppdcSource::add_include(argv[i]);
- break;
-
- case 'v' : // Be verbose...
- verbose ++;
- break;
-
- case 'z' : // Compress files...
- comp = PPDC_GZIP_COMPRESSION;
- break;
-
- case '-' : // --option
- if (!strcmp(opt, "-lf"))
- {
- le = PPDC_LFONLY;
- opt += strlen(opt) - 1;
- break;
- }
- else if (!strcmp(opt, "-cr"))
- {
- le = PPDC_CRONLY;
- opt += strlen(opt) - 1;
- break;
- }
- else if (!strcmp(opt, "-crlf"))
- {
- le = PPDC_CRLF;
- opt += strlen(opt) - 1;
- break;
- }
-
- default : // Unknown
- usage();
- break;
- }
- }
- else
- {
- // Open and load the driver info file...
- if (verbose > 1)
- printf("ppdc: Loading driver information file \"%s\"...\n", argv[i]);
-
- src = new ppdcSource(argv[i]);
-
- // Create the output directory...
- if (mkdir(outdir, 0777))
- {
- if (errno != EEXIST)
- {
- fprintf(stderr, "ppdc: Unable to create output directory %s: %s\n",
- outdir, strerror(errno));
- return (1);
- }
- }
-
- // Write PPD files...
- for (d = (ppdcDriver *)src->drivers->first();
- d;
- d = (ppdcDriver *)src->drivers->next())
- {
- // Write the PPD file for this driver...
- for (j = 0; d->pc_file_name->value[j]; j ++)
- pcfilename[j] = tolower(d->pc_file_name->value[j]);
-
- pcfilename[j] = '\0';
-
- if (comp == PPDC_GZIP_COMPRESSION)
- snprintf(filename, sizeof(filename), "%s/%s.gz", outdir, pcfilename);
- else
- snprintf(filename, sizeof(filename), "%s/%s", outdir, pcfilename);
-
- if (verbose)
- printf("ppdc: Writing %s...\n", filename);
-
- if (d->write_ppd_file(filename, catalog, locales, src, le, comp))
- return (1);
- }
-
- // Delete the printer driver information...
- delete src;
- }
-
- if (catalog)
- delete catalog;
-
- // If no drivers have been loaded, display the program usage message.
- if (!src)
- usage();
-
- // Return with no errors.
- return (0);
-}
-#endif // 0
-
-
-//
-// End of "$Id$".
-//
diff --git a/ppdc/ppdc-catalog.cxx b/ppdc/ppdc-catalog.cxx
index db9528e6d..2701f7b94 100644
--- a/ppdc/ppdc-catalog.cxx
+++ b/ppdc/ppdc-catalog.cxx
@@ -210,13 +210,19 @@ ppdcCatalog::load_messages(
if ((ch = get_utf16(fp, cs)) == 0)
break;
- if (ch == 'n')
+ if (ch == 'n')
ch = '\n';
else if (ch == 't')
ch = '\t';
}
+ else if (ch == '\"')
+ {
+ *ptr = '\0';
+ ptr = NULL;
+ }
- put_utf8(ch, ptr, end);
+ if (ptr)
+ put_utf8(ch, ptr, end);
}
else if (ch == '/')
{
@@ -247,13 +253,8 @@ ppdcCatalog::load_messages(
}
else if (ch == '\"')
{
- // Start or finish quoted string...
- if (ptr)
- {
- *ptr = '\0';
- ptr = NULL;
- }
- else if (id[0])
+ // Start quoted string...
+ if (id[0])
{
ptr = str;
end = str + sizeof(str) - 1;
@@ -697,7 +698,8 @@ get_utf16(cups_file_t *fp, // I - File to read from
if (cs == PPDC_CS_UTF8)
{
// UTF-8 character...
- ch = cupsFileGetChar(fp);
+ if ((ch = cupsFileGetChar(fp)) < 0)
+ return (0);
if ((ch & 0xe0) == 0xc0)
{
diff --git a/ppdc/ppdc-driver.cxx b/ppdc/ppdc-driver.cxx
index a369ed686..fa0a8a6eb 100644
--- a/ppdc/ppdc-driver.cxx
+++ b/ppdc/ppdc-driver.cxx
@@ -541,10 +541,17 @@ ppdcDriver::write_ppd_file(
!strcmp(a->name->value, "ModelName") ||
!strcmp(a->name->value, "NickName") ||
!strcmp(a->name->value, "ShortNickName") ||
- !strcmp(a->name->value, "cupsVersion") ||
- a->name->value[0] == '?')
+ !strcmp(a->name->value, "cupsVersion"))
continue;
+ if (a->name->value[0] == '?' &&
+ (find_option(a->name->value + 1) ||
+ !strcmp(a->name->value, "?ImageableArea") ||
+ !strcmp(a->name->value, "?PageRegion") ||
+ !strcmp(a->name->value, "?PageSize") ||
+ !strcmp(a->name->value, "?PaperDimension")))
+ continue;
+
if (!a->selector->value || !a->selector->value[0])
cupsFilePrintf(fp, "*%s", a->name->value);
else if (!a->text->value || !a->text->value[0])
diff --git a/ppdc/ppdc-file.cxx b/ppdc/ppdc-file.cxx
index 3af0e4975..29f109ce2 100644
--- a/ppdc/ppdc-file.cxx
+++ b/ppdc/ppdc-file.cxx
@@ -31,9 +31,17 @@
// 'ppdcFile::ppdcFile()' - Create (open) a file.
//
-ppdcFile::ppdcFile(const char *f) // I - File to open
+ppdcFile::ppdcFile(const char *f, // I - File to open
+ cups_file_t *ffp) // I - File pointer to use
{
- fp = cupsFileOpen(f, "r");
+ if (ffp)
+ {
+ fp = ffp;
+ cupsFileRewind(fp);
+ }
+ else
+ fp = cupsFileOpen(f, "r");
+
filename = f;
line = 1;
diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx
index ac64a1a30..92a42f11d 100644
--- a/ppdc/ppdc-source.cxx
+++ b/ppdc/ppdc-source.cxx
@@ -91,7 +91,8 @@ const char *ppdcSource::driver_types[] =
// 'ppdcSource::ppdcSource()' - Load a driver source file.
//
-ppdcSource::ppdcSource(const char *f) // I - File to read
+ppdcSource::ppdcSource(const char *f, // I - File to read
+ cups_file_t *ffp)// I - File pointer to use
{
filename = new ppdcString(f);
base_fonts = new ppdcArray();
@@ -104,7 +105,7 @@ ppdcSource::ppdcSource(const char *f) // I - File to read
cond_stack[0] = PPDC_COND_NORMAL;
if (f)
- read_file(f);
+ read_file(f, ffp);
}
@@ -1616,7 +1617,8 @@ ppdcSource::get_po(ppdcFile *fp) // I - File to read
strcpy(basedir, ".");
// Find the po file...
- if (find_include(poname, basedir, pofilename, sizeof(pofilename)))
+ if (!pofilename[0] ||
+ find_include(poname, basedir, pofilename, sizeof(pofilename)))
{
// Found it, so load it...
cat = new ppdcCatalog(locale, pofilename);
@@ -2284,9 +2286,10 @@ ppdcSource::quotef(cups_file_t *fp, // I - File to write to
//
void
-ppdcSource::read_file(const char *f) // I - File to read
+ppdcSource::read_file(const char *f, // I - File to read
+ cups_file_t *ffp) // I - File pointer to use
{
- ppdcFile *fp = new ppdcFile(f);
+ ppdcFile *fp = new ppdcFile(f, ffp);
scan_file(fp);
delete fp;
diff --git a/ppdc/ppdc.h b/ppdc/ppdc.h
index 40bb9f5b0..1d849c1ad 100644
--- a/ppdc/ppdc.h
+++ b/ppdc/ppdc.h
@@ -413,7 +413,7 @@ class ppdcFile //// File
const char *filename; // Filename
int line; // Line in file
- ppdcFile(const char *f);
+ ppdcFile(const char *f, cups_file_t *ffp = (cups_file_t *)0);
~ppdcFile();
int get();
@@ -439,7 +439,7 @@ class ppdcSource //// Source File
cond_stack[101]; // #if state stack
- ppdcSource(const char *f = 0);
+ ppdcSource(const char *f = 0, cups_file_t *ffp = (cups_file_t *)0);
~ppdcSource();
static void add_include(const char *d);
@@ -478,7 +478,7 @@ class ppdcSource //// Source File
ppdcVariable *get_variable(ppdcFile *fp);
int import_ppd(const char *f);
int quotef(cups_file_t *fp, const char *format, ...);
- void read_file(const char *f);
+ void read_file(const char *f, cups_file_t *ffp = (cups_file_t *)0);
void scan_file(ppdcFile *fp, ppdcDriver *td = 0, bool inc = false);
ppdcVariable *set_variable(const char *name, const char *value);
int write_file(const char *f);
diff --git a/ppdc/sample.drv b/ppdc/sample.drv
index 20a86e57b..d5698359e 100644
--- a/ppdc/sample.drv
+++ b/ppdc/sample.drv
@@ -3,7 +3,7 @@
//
// Driver info file for CUPS-supplied PPDs.
//
-// Copyright 2007 by Apple Inc.
+// Copyright 2007-2008 by Apple Inc.
// Copyright 1993-2006 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
@@ -20,6 +20,29 @@
#include <epson.h>
#include <label.h>
+// Localizations are provided for all of the base languages supported by
+// CUPS...
+#po da ""
+#po de ""
+#po es ""
+#po et ""
+#po fi ""
+#po fr ""
+#po he ""
+#po id ""
+#po it ""
+#po ja ""
+#po ko ""
+#po nl ""
+#po no ""
+#po pl ""
+#po pt ""
+#po pt_BR ""
+#po ru ""
+#po sv ""
+#po zh ""
+#po zh_TW ""
+
// MediaSize sizes used by label drivers...
#media "w81h252/Address - 1 1/8 x 3 1/2\"" 81 252
#media "w101h252/Large Address - 1 4/10 x 3 1/2\"" 101 252
@@ -92,14 +115,9 @@
Attribute "cupsVersion" "" "1.4"
Attribute "FileSystem" "" "False"
Attribute "LandscapeOrientation" "" "Plus90"
-Attribute "LanguageLevel" "" "3"
-Attribute "Product" "" "(ESP Ghostscript)"
-Attribute "Product" "" "(GPL Ghostscript)"
-Attribute "PSVersion" "" "(3010.000) 81504"
-Attribute "PSVersion" "" "(3010.000) 860"
Attribute "TTRasterizer" "" "Type42"
-Copyright "Copyright 2007 by Apple Inc."
+Copyright "Copyright 2007-2008 by Apple Inc."
Copyright "Copyright 1997-2007 by Easy Software Products."
Copyright ""
Copyright "These coded instructions, statements, and computer programs are the"
@@ -116,7 +134,7 @@ Version "1.4"
{
Manufacturer "Dymo"
ModelName "Label Printer"
- PCFileName "DYMO.PPD"
+ PCFileName "dymo.ppd"
DriverType label
ModelNumber $DYMO_3x0
Throughput 8
@@ -167,7 +185,7 @@ Version "1.4"
// Epson 24-Pin Series
{
ModelName "24-Pin Series"
- PCFileName "EPSON24.PPD"
+ PCFileName "epson24.ppd"
ModelNumber $EPSON_24PIN
Resolution k 1 8 0 0 60dpi
@@ -180,7 +198,7 @@ Version "1.4"
// Epson 9-Pin Series
{
ModelName "9-Pin Series"
- PCFileName "EPSON9.PPD"
+ PCFileName "epson9.ppd"
ModelNumber $EPSON_9PIN
ColorDevice No
@@ -192,7 +210,7 @@ Version "1.4"
// Epson Stylus Color Series
{
ModelName "Stylus Color Series"
- PCFileName "STCOLOR.PPD"
+ PCFileName "stcolor.ppd"
ModelNumber $EPSON_COLOR
ColorDevice Yes
@@ -212,7 +230,7 @@ Version "1.4"
// Epson New Stylus Color Series
{
ModelName "New Stylus Color Series"
- PCFileName "STCOLOR2.PPD"
+ PCFileName "stcolor2.ppd"
ModelNumber $EPSON_ICOLOR
ColorDevice Yes
@@ -232,7 +250,7 @@ Version "1.4"
// Epson Stylus Color Series
{
ModelName "Stylus Photo Series"
- PCFileName "STPHOTO.PPD"
+ PCFileName "stphoto.ppd"
ModelNumber $EPSON_PHOTO
ColorDevice Yes
@@ -252,7 +270,7 @@ Version "1.4"
// Epson New Stylus Color Series
{
ModelName "New Stylus Photo Series"
- PCFileName "STPHOTO2.PPD"
+ PCFileName "stphoto2.ppd"
ModelNumber $EPSON_IPHOTO
ColorDevice Yes
@@ -279,7 +297,7 @@ Version "1.4"
DriverType hp
ModelName "PCL Laser Printer"
- PCFileName "GENERPCL.PPD"
+ PCFileName "generpcl.ppd"
Throughput 8
ModelNumber $HP_LASERJET
ColorDevice No
@@ -329,7 +347,7 @@ Version "1.4"
DriverType ps
ModelName "PostScript Printer"
- PCFileName "GENERIC.PPD"
+ PCFileName "generic.ppd"
Throughput 8
ColorDevice No
Attribute PSVersion "" "(2016.0) 0"
@@ -370,7 +388,7 @@ Version "1.4"
// HP DeskJet Series
{
ModelName "DeskJet Series"
- PCFileName "DESKJET.PPD"
+ PCFileName "deskjet.ppd"
ModelNumber $HP_DESKJET
ManualCopies Yes
ColorDevice Yes
@@ -423,7 +441,7 @@ Version "1.4"
// HP LaserJet Series PCL 4/5
{
ModelName "LaserJet Series PCL 4/5"
- PCFileName "LASERJET.PPD"
+ PCFileName "laserjet.ppd"
Throughput 8
ModelNumber $HP_LASERJET
ColorDevice No
@@ -475,7 +493,7 @@ Version "1.4"
Manufacturer "Intellitech"
ModelName "IntelliBar Label Printer"
Attribute ShortNickName "" "Intellibar Label Printer"
- PCFileName "INTELBAR.PPD"
+ PCFileName "intelbar.ppd"
DriverType label
ModelNumber $INTELLITECH_PCL
Throughput 8
@@ -600,7 +618,7 @@ Version "1.4"
// Oki 24-Pin Series
{
ModelName "24-Pin Series"
- PCFileName "OKIDAT24.PPD"
+ PCFileName "okidat24.ppd"
ModelNumber $EPSON_24PIN
Resolution k 1 8 0 0 60dpi
@@ -613,7 +631,7 @@ Version "1.4"
// Oki 9-Pin Series
{
ModelName "9-Pin Series"
- PCFileName "OKIDATA9.PPD"
+ PCFileName "okidata9.ppd"
ModelNumber $EPSON_9PIN
ColorDevice No
@@ -634,7 +652,7 @@ Version "1.4"
// Zebra CPCL Label Printer
{
ModelName "CPCL Label Printer"
- PCFileName "ZEBRACPL.PPD"
+ PCFileName "zebracpl.ppd"
ModelNumber $ZEBRA_CPCL
HWMargins 0 0 0 0
@@ -763,7 +781,7 @@ Version "1.4"
// Zebra EPL1 Label Printer
{
ModelName "EPL1 Label Printer"
- PCFileName "ZEBRAEP1.PPD"
+ PCFileName "zebraep1.ppd"
ModelNumber $ZEBRA_EPL_LINE
HWMargins 0 0 0 0
@@ -860,7 +878,7 @@ Version "1.4"
// Zebra EPL2 Label Printer
{
ModelName "EPL2 Label Printer"
- PCFileName "ZEBRAEP2.PPD"
+ PCFileName "zebraep2.ppd"
ModelNumber $ZEBRA_EPL_PAGE
HWMargins 0 0 0 0
@@ -966,7 +984,7 @@ Version "1.4"
// Zebra ZPL Label Printer
{
ModelName "ZPL Label Printer"
- PCFileName "ZEBRA.PPD"
+ PCFileName "zebra.ppd"
ModelNumber $ZEBRA_ZPL
HWMargins 0 0 0 0
diff --git a/ppdc/testcatalog.cxx b/ppdc/testcatalog.cxx
new file mode 100644
index 000000000..808738d90
--- /dev/null
+++ b/ppdc/testcatalog.cxx
@@ -0,0 +1,63 @@
+//
+// "$Id$"
+//
+// Test program for message catalog class.
+//
+// Copyright 2008 by Apple Inc.
+//
+// These coded instructions, statements, and computer programs are the
+// property of Apple Inc. and are protected by Federal copyright
+// law. Distribution and use rights are outlined in the file "LICENSE.txt"
+// which should have been included with this file. If this file is
+// file is missing or damaged, see the license at "http://www.cups.org/".
+//
+// Contents:
+//
+// main() - Open a message catalog
+//
+
+//
+// Include necessary headers...
+//
+
+#include "ppdc.h"
+
+
+//
+// 'main()' - Open a message catalog
+//
+
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
+{
+ ppdcCatalog *catalog; // Message catalog
+ ppdcMessage *m; // Current message
+
+
+ if (argc != 2)
+ {
+ puts("Usage: testcatalog filename");
+ return (1);
+ }
+
+ // Scan the command-line...
+ catalog = new ppdcCatalog(NULL, argv[1]);
+
+ printf("%s: %d messages\n", argv[1], catalog->messages->count);
+
+ for (m = (ppdcMessage *)catalog->messages->first();
+ m;
+ m = (ppdcMessage *)catalog->messages->next())
+ printf("%s: %s\n", m->id->value, m->string->value);
+
+ delete catalog;
+
+ // Return with no errors.
+ return (0);
+}
+
+
+//
+// End of "$Id$".
+//