//
// Definitions for the CUPS PPD Compiler.
//
-// Copyright 2007-2008 by Apple Inc.
+// Copyright 2007-2009 by Apple Inc.
// Copyright 2002-2007 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
// Include necessary headers...
//
-# include <cups/string.h>
-
# include <cups/file.h>
# include <stdlib.h>
-# include <errno.h>
+
+
+//
+// Macros...
+//
+
+# define PPDC_NAME(s) const char *class_name() { return (s); }
//
ppdcShared();
virtual ~ppdcShared();
- void get(void);
- void release(void);
+ virtual const char *class_name() = 0;
+
+ void retain();
+ void release();
};
class ppdcArray //// Shared Array
ppdcArray(ppdcArray *a = 0);
~ppdcArray();
+ PPDC_NAME("ppdcArray")
+
void add(ppdcShared *d);
ppdcShared *first();
ppdcShared *next();
ppdcString(const char *v);
~ppdcString();
+
+ PPDC_NAME("ppdcString")
};
class ppdcInteger //// Shared integer
int *value; // Integer value
ppdcInteger(int *v) { value = v; }
+
+ PPDC_NAME("ppdcInteger")
};
class ppdcMessage //// Translation message
ppdcMessage(const char *i, const char *s);
~ppdcMessage();
+
+ PPDC_NAME("ppdcMessage")
};
class ppdcCatalog //// Translation catalog
ppdcCatalog(const char *l, const char *f = 0);
~ppdcCatalog();
- void add_message(ppdcMessage *m) { messages->add(m); }
- void add_message(const char *id);
+ PPDC_NAME("ppdcCatalog")
+
+ void add_message(const char *id, const char *string = NULL);
const char *find_message(const char *id);
int load_messages(const char *f);
int save_messages(const char *f);
ppdcAttr(const char *n, const char *s, const char *t, const char *v,
bool loc = false);
~ppdcAttr();
+
+ PPDC_NAME("ppdcAttr")
};
class ppdcFont //// Shared Font
ppdcFont(const char *n, const char *e, const char *v, const char *c,
ppdcFontStatus s);
~ppdcFont();
+
+ PPDC_NAME("ppdcFont")
};
class ppdcChoice //// Option Choice
ppdcChoice(const char *n, const char *t, const char *c);
~ppdcChoice();
+
+ PPDC_NAME("ppdcChoice")
};
class ppdcOption //// Option
ppdcOption(ppdcOption *o);
~ppdcOption();
+ PPDC_NAME("ppdcOption")
+
void add_choice(ppdcChoice *c) { choices->add(c); }
ppdcChoice *find_choice(const char *n);
void set_defchoice(ppdcChoice *c);
ppdcGroup(ppdcGroup *g);
~ppdcGroup();
+ PPDC_NAME("ppdcGroup")
+
void add_option(ppdcOption *o) { options->add(o); }
ppdcOption *find_option(const char *n);
};
ppdcConstraint(const char *o1, const char *c1, const char *o2,
const char *c2);
~ppdcConstraint();
+
+ PPDC_NAME("ppdcConstraint")
};
class ppdcFilter //// Filter Program
ppdcFilter(const char *t, const char *p, int c);
~ppdcFilter();
+
+ PPDC_NAME("ppdcFilter")
};
class ppdcMediaSize //// Media Size
float lm, float bm, float rm, float tm,
const char *sc = 0, const char *rc = 0);
~ppdcMediaSize();
+
+ PPDC_NAME("ppdcMediaSize")
};
class ppdcProfile //// Color Profile
ppdcProfile(const char *r, const char *m, float d, float g, const float *p);
~ppdcProfile();
+
+ PPDC_NAME("ppdcProfile")
};
class ppdcSource;
ppdcDriver(ppdcDriver *d = 0);
~ppdcDriver();
+ PPDC_NAME("ppdcDriver")
+
void add_attr(ppdcAttr *a) { attrs->add(a); }
void add_constraint(ppdcConstraint *c) { constraints->add(c); }
void add_copyright(const char *c) {
ppdcAttr *find_attr(const char *k, const char *s);
ppdcGroup *find_group(const char *n);
ppdcOption *find_option(const char *n);
+ ppdcOption *find_option_group(const char *n, ppdcGroup **mg);
void set_custom_size_code(const char *c);
void set_default_font(ppdcFont *f);
ppdcVariable(const char *n, const char *v);
~ppdcVariable();
+ PPDC_NAME("ppdcVariable")
+
void set_value(const char *v);
};
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();
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();
+ PPDC_NAME("ppdcSource")
+
static void add_include(const char *d);
ppdcDriver *find_driver(const char *f);
static char *find_include(const char *f, const char *base, char *n,
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);