| Header | cups/ppdc.h | 
|---|---|
| Library | -lcupsppdc | 
| See Also | Programming: Introduction to CUPS Programming | 
The PPD Compiler API provides access to CUPS driver information files and methods for generating and importing PPD files.
// Shared Array
class ppdcArray : public ppdcShared {
  public:
    int count, alloc, current;
    ppdcShared **data;
};
void PPDC_NAME (
    void add(ppdcShared *d
);
void add (
    ppdcShared *d
);
Return the first element in the array.
ppdcShared *first (void);
Return the next element in the array.
ppdcShared *next (void);
void ppdcArray (
    ppdcArray *a
);
void remove (
    ppdcShared *d
);
void ~ppdcArray (void);
// Attribute
class ppdcAttr : public ppdcShared {
  public:
    bool localizable;
    ppdcString *name, *selector, *text, *value;
};
void ppdcAttr (
    const char *n,
    const char *s,
    const char *t,
    const char *v,
    bool loc
);
void ~ppdcAttr (void);
// Translation catalog
class ppdcCatalog : public ppdcShared {
  public:
    ppdcString *filename;
    ppdcString *locale;
    ppdcArray *messages;
};
void PPDC_NAME (
    void add_message(const char *id,
    const char *string = NULL
);
void add_message (
    const char *id,
    const char *string
);
const char *find_message (
    const char *id
);
Message text
int load_messages (
    const char *f
);
0 on success, -1 on failure
void ppdcCatalog (
    const char *l,
    const char *f
);
int save_messages (
    const char *f
);
0 on success, -1 on error
void ~ppdcCatalog (void);
// Option Choice
class ppdcChoice : public ppdcShared {
  public:
    ppdcString *name, *text, *code;
};
void ppdcChoice (
    const char *n,
    const char *t,
    const char *c
);
void ~ppdcChoice (void);
// Constraint
class ppdcConstraint : public ppdcShared {
  public:
    ppdcString *option1, *choice1, *option2, *choice2;
};
void ppdcConstraint (
    const char *o1,
    const char *c1,
    const char *o2,
    const char *c2
);
void ~ppdcConstraint (void);
// Printer Driver Data
class ppdcDriver : public ppdcShared {
  public:
    ppdcArray *copyright;
    ppdcString *custom_size_code;
    ppdcString *default_font, *default_size;
    float left_margin, bottom_margin, right_margin, top_margin, max_width, max_length, min_width, min_length;
    ppdcArray *attrs, *constraints, *filters, *fonts, *groups, *profiles, *sizes;
    int model_number, manual_copies, color_device, throughput;
    ppdcDrvType type;
    int variable_paper_size;
    ppdcString *manufacturer, *model_name, *file_name, *pc_file_name, *version;
};
void PPDC_NAME (
    void add_attr(ppdcAttr *a
);
void add_constraint (
    ppdcConstraint *c
);
void add_copyright (
    const char *c
);
void add_filter (
    ppdcFilter *f
);
void add_font (
    ppdcFont *f
);
void add_group (
    ppdcGroup *g
);
void add_profile (
    ppdcProfile *p
);
void add_size (
    ppdcMediaSize *m
);
ppdcAttr *find_attr (
    const char *k,
    const char *s
);
Attribute or NULL
ppdcGroup *find_group (
    const char *n
);
Matching group or NULL
ppdcOption *find_option (
    const char *n
);
Matching option or NULL
ppdcOption *find_option_group (
    const char *n,
    ppdcGroup **mg
);
Matching option or NULL
void ppdcDriver (
    ppdcDriver *d
);
void set_custom_size_code (
    const char *c
);
void set_default_font (
    ppdcFont *f
);
void set_default_size (
    ppdcMediaSize *m
);
void set_file_name (
    const char *f
);
void set_manufacturer (
    const char *m
);
void set_model_name (
    const char *m
);
void set_pc_file_name (
    const char *f
);
void set_version (
    const char *v
);
int write_ppd_file (
    cups_file_t *fp,
    ppdcCatalog *catalog,
    ppdcArray *locales,
    ppdcSource *src,
    ppdcLineEnding le
);
0 on success, -1 on failure
void ~ppdcDriver (void);
// File
class ppdcFile {
  public:
    bool close_on_delete;
    const char *filename;
    cups_file_t *fp;
    int line;
};
Get a character from a file.
int get (void);
int peek (void);
Next character in file
void ppdcFile (
    const char *f,
    cups_file_t *ffp
);
void ~ppdcFile (void);
// Filter Program
class ppdcFilter : public ppdcShared {
  public:
    int cost;
    ppdcString *mime_type, *program;
};
void ppdcFilter (
    const char *t,
    const char *p,
    int c
);
void ~ppdcFilter (void);
// Shared Font
class ppdcFont : public ppdcShared {
  public:
    ppdcString *name, *encoding, *version, *charset;
    ppdcFontStatus status;
};
void ppdcFont (
    const char *n,
    const char *e,
    const char *v,
    const char *c,
    ppdcFontStatus s
);
void ~ppdcFont (void);
// Group of Options
class ppdcGroup : public ppdcShared {
  public:
    ppdcArray *options;
    ppdcString *name, *text;
};
void PPDC_NAME (
    void add_option(ppdcOption *o
);
Find an option in a group.
ppdcOption *find_option (
    const char *n
);
void ppdcGroup (
    ppdcGroup *g
);
void ~ppdcGroup (void);
// Shared integer
class ppdcInteger : public ppdcShared {
  public:
    int *value;
};
Integer value
void ppdcInteger (
    int *v
);
// Media Size
class ppdcMediaSize : public ppdcShared {
  public:
    ppdcString *size_code, *region_code;
    ppdcString *name, *text;
    float width, length, left, bottom, right, top;
};
void ppdcMediaSize (
    const char *n,
    const char *t,
    float w,
    float l,
    float lm,
    float bm,
    float rm,
    float tm,
    const char *sc,
    const char *rc
);
void ~ppdcMediaSize (void);
// Translation message
class ppdcMessage : public ppdcShared {
  public:
    ppdcString *id, *string;
};
void ppdcMessage (
    const char *i,
    const char *s
);
void ~ppdcMessage (void);
// Option
class ppdcOption : public ppdcShared {
  public:
    ppdcArray *choices;
    ppdcString *defchoice;
    float order;
    ppdcOptSection section;
    ppdcString *name, *text;
    ppdcOptType type;
};
void PPDC_NAME (
    void add_choice(ppdcChoice *c
);
ppdcChoice *find_choice (
    const char *n
);
Choice or NULL
void ppdcOption (
    ppdcOption *o
);
void set_defchoice (
    ppdcChoice *c
);
void ~ppdcOption (void);
// Color Profile
class ppdcProfile : public ppdcShared {
  public:
    ppdcString *resolution, *media_type;
    float density, gamma, profile[9];
};
void ppdcProfile (
    const char *r,
    const char *m,
    float d,
    float g,
    const float *p
);
void ~ppdcProfile (void);
// Shared Data Value
class ppdcShared {
  private:
    int use;
};
virtual const char *class_name (void);
void ppdcShared (void);
void release (void);
void retain (void);
void ~ppdcShared (void);
// Source File
class ppdcSource : public ppdcShared {
  public:
    int cond_state, *cond_current, cond_stack[101];
    static const char *driver_types[];
    ppdcString *filename;
    static ppdcArray *includes;
    ppdcArray *base_fonts, *drivers, *po_files, *sizes, *vars;
};
void PPDC_NAME (
    static void add_include(const char *d
);
void add_include (
    const char *d
);
ppdcDriver *find_driver (
    const char *f
);
Driver
char *find_include (
    const char *f,
    const char *base,
    char *n,
    int nlen
);
Found path or NULL
ppdcCatalog *find_po (
    const char *l
);
Message catalog or NULL
ppdcMediaSize *find_size (
    const char *s
);
Size
ppdcVariable *find_variable (
    const char *n
);
Variable
ppdcAttr *get_attr (
    ppdcFile *fp,
    bool loc
);
Attribute
int get_boolean (
    ppdcFile *fp
);
Boolean value
ppdcChoice *get_choice (
    ppdcFile *fp
);
Choice data
ppdcChoice *get_color_model (
    ppdcFile *fp
);
Choice data
int get_color_order (
    const char *co
);
Color order value
ppdcProfile *get_color_profile (
    ppdcFile *fp
);
Color profile
int get_color_space (
    const char *cs
);
Colorspace value
ppdcConstraint *get_constraint (
    ppdcFile *fp
);
Constraint
ppdcMediaSize *get_custom_size (
    ppdcFile *fp
);
Media size
void get_duplex (
    ppdcFile *fp,
    ppdcDriver *d
);
ppdcFilter *get_filter (
    ppdcFile *fp
);
Filter
float get_float (
    ppdcFile *fp
);
Number
ppdcFont *get_font (
    ppdcFile *fp
);
Font data
ppdcChoice *get_generic (
    ppdcFile *fp,
    const char *keyword,
    const char *tattr,
    const char *nattr
);
Choice data
ppdcGroup *get_group (
    ppdcFile *fp,
    ppdcDriver *d
);
Group
ppdcOption *get_installable (
    ppdcFile *fp
);
Option
int get_integer (
    ppdcFile *fp
);
Integer value
float get_measurement (
    ppdcFile *fp
);
Measurement value in points
ppdcOption *get_option (
    ppdcFile *fp,
    ppdcDriver *d,
    ppdcGroup *g
);
Option
ppdcCatalog *get_po (
    ppdcFile *fp
);
Message catalog
ppdcChoice *get_resolution (
    ppdcFile *fp
);
Choice data
ppdcProfile *get_simple_profile (
    ppdcFile *fp
);
Color profile
ppdcMediaSize *get_size (
    ppdcFile *fp
);
Media size
char *get_token (
    ppdcFile *fp,
    char *buffer,
    int buflen
);
Token string or NULL
ppdcVariable *get_variable (
    ppdcFile *fp
);
Variable
int import_ppd (
    const char *f
);
1 on success, 0 on failure
void ppdcSource (
    const char *f,
    cups_file_t *ffp
);
int quotef (
    cups_file_t *fp,
    const char *format,
    ...
);
Number bytes on success, -1 on failure
void read_file (
    const char *f,
    cups_file_t *ffp
);
void scan_file (
    ppdcFile *fp,
    ppdcDriver *td,
    bool inc
);
ppdcVariable *set_variable (
    const char *name,
    const char *value
);
Variable
int write_file (
    const char *f
);
0 on success, -1 on error
void ~ppdcSource (void);
// Shared String
class ppdcString : public ppdcShared {
  public:
    char *value;
};
void ppdcString (
    const char *v
);
void ~ppdcString (void);
// Variable Definition
class ppdcVariable : public ppdcShared {
  public:
    ppdcString *name, *value;
};
void PPDC_NAME (
    void set_value(const char *v
);
void ppdcVariable (
    const char *n,
    const char *v
);
void set_value (
    const char *v
);
void ~ppdcVariable (void);
typedef enum ppdc_cs_t;
// Printer Driver Data
class ppdcSource;
// Condition flags
// Driver type
// Load status of font
// Line endings
// Option section
// Option type