/usr/include/cups/ppdc.h is in libcupsppdc1-dev 1.7.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | //
// "$Id: ppdc.h 3755 2012-03-30 05:59:14Z msweet $"
//
// Definitions for the CUPS PPD Compiler.
//
// Copyright 2007-2009 by Apple Inc.
// Copyright 2002-2007 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/".
//
#ifndef _PPDC_H_
# define _PPDC_H_
//
// Include necessary headers...
//
# include <cups/file.h>
# include <stdlib.h>
//
// Macros...
//
# define PPDC_NAME(s) const char *class_name() { return (s); }
//
// Enumerations...
//
enum ppdcDrvType //// Driver type
{
PPDC_DRIVER_CUSTOM, // Custom driver
PPDC_DRIVER_PS, // PostScript driver
PPDC_DRIVER_ESCP, // rastertoescpx driver
PPDC_DRIVER_PCL, // rastertopclx driver
PPDC_DRIVER_LABEL, // rastertolabel/rastertodymo driver
PPDC_DRIVER_EPSON, // rastertoepson driver
PPDC_DRIVER_HP, // rastertohp driver
PPDC_DRIVER_MAX // Number of driver types defined
};
enum ppdcFontStatus //// Load status of font
{
PPDC_FONT_ROM, // Font is in ROM
PPDC_FONT_DISK // Font is on disk
};
enum ppdcOptSection //// Option section
{
PPDC_SECTION_ANY, // AnySetup
PPDC_SECTION_DOCUMENT, // DocumentSetup
PPDC_SECTION_EXIT, // ExitServer
PPDC_SECTION_JCL, // JCLSetup
PPDC_SECTION_PAGE, // PageSetup
PPDC_SECTION_PROLOG // Prolog
};
enum ppdcOptType //// Option type
{
PPDC_BOOLEAN, // True/false option
PPDC_PICKONE, // Single choice from list
PPDC_PICKMANY // Multiple choices from list
};
enum ppdcLineEnding //// Line endings
{
PPDC_LFONLY, // LF only
PPDC_CRONLY, // CR only
PPDC_CRLF // CR + LF
};
enum ppdcCondFlags //// Condition flags
{
PPDC_COND_NORMAL = 0, // Normal state
PPDC_COND_SKIP = 1, // Skip state
PPDC_COND_SATISFIED = 2 // At least one condition satisfied
};
//
// Printer description data...
//
class ppdcShared //// Shared Data Value
{
private:
int use; // Use count (delete when 0)
public:
ppdcShared();
virtual ~ppdcShared();
virtual const char *class_name() = 0;
void retain();
void release();
};
class ppdcArray //// Shared Array
: public ppdcShared
{
public:
int count, // Number of elements
alloc, // Allocated elements
current; // Current element
ppdcShared **data; // Elements
ppdcArray(ppdcArray *a = 0);
~ppdcArray();
PPDC_NAME("ppdcArray")
void add(ppdcShared *d);
ppdcShared *first();
ppdcShared *next();
void remove(ppdcShared *d);
};
class ppdcString //// Shared String
: public ppdcShared
{
public:
char *value; // String value
ppdcString(const char *v);
~ppdcString();
PPDC_NAME("ppdcString")
};
class ppdcInteger //// Shared integer
: public ppdcShared
{
public:
int *value; // Integer value
ppdcInteger(int *v) { value = v; }
PPDC_NAME("ppdcInteger")
};
class ppdcMessage //// Translation message
: public ppdcShared
{
public:
ppdcString *id, // Translation ID
*string; // Translation string
ppdcMessage(const char *i, const char *s);
~ppdcMessage();
PPDC_NAME("ppdcMessage")
};
class ppdcCatalog //// Translation catalog
: public ppdcShared
{
public:
ppdcString *locale; // Name of locale
ppdcString *filename; // Name of translation file
ppdcArray *messages; // Array of translation messages
ppdcCatalog(const char *l, const char *f = 0);
~ppdcCatalog();
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);
};
class ppdcAttr //// Attribute
: public ppdcShared
{
public:
ppdcString *name, // Name of attribute
*selector, // Selector string
*text, // Text string
*value; // Value string
bool localizable; // Should this attribute be localized?
ppdcAttr(const char *n, const char *s, const char *t, const char *v,
bool loc = false);
~ppdcAttr();
PPDC_NAME("ppdcAttr")
};
class ppdcFont //// Shared Font
: public ppdcShared
{
public:
ppdcString *name, // Font name
*encoding, // Font base encoding
*version, // Font version
*charset; // Font charset
ppdcFontStatus status; // Font status (ROM or Disk)
ppdcFont(const char *n, const char *e, const char *v, const char *c,
ppdcFontStatus s);
~ppdcFont();
PPDC_NAME("ppdcFont")
};
class ppdcChoice //// Option Choice
: public ppdcShared
{
public:
ppdcString *name, // Name of choice
*text, // Human-readable text of choice
*code; // PS code of choice
ppdcChoice(const char *n, const char *t, const char *c);
~ppdcChoice();
PPDC_NAME("ppdcChoice")
};
class ppdcOption //// Option
: public ppdcShared
{
public:
ppdcOptType type; // Type of option
ppdcString *name, // Name of option
*text; // Human-readable text of option
ppdcOptSection section; // Section for option code
float order; // Order number
ppdcArray *choices; // Choices
ppdcString *defchoice; // Default choice
ppdcOption(ppdcOptType ot, const char *n, const char *t, ppdcOptSection s,
float o);
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);
};
class ppdcGroup //// Group of Options
: public ppdcShared
{
public:
ppdcString *name, // Name of option
*text; // Human-readable text of option
ppdcArray *options; // Options
ppdcGroup(const char *n, const char *t);
ppdcGroup(ppdcGroup *g);
~ppdcGroup();
PPDC_NAME("ppdcGroup")
void add_option(ppdcOption *o) { options->add(o); }
ppdcOption *find_option(const char *n);
};
class ppdcConstraint //// Constraint
: public ppdcShared
{
public:
ppdcString *option1, // First option
*choice1, // First choice
*option2, // Second option
*choice2; // Second choice
ppdcConstraint(const char *o1, const char *c1, const char *o2,
const char *c2);
~ppdcConstraint();
PPDC_NAME("ppdcConstraint")
};
class ppdcFilter //// Filter Program
: public ppdcShared
{
public:
ppdcString *mime_type, // MIME type
*program; // Filter program
int cost; // Relative cost of filter
ppdcFilter(const char *t, const char *p, int c);
~ppdcFilter();
PPDC_NAME("ppdcFilter")
};
class ppdcMediaSize //// Media Size
: public ppdcShared
{
public:
ppdcString *name, // Name of size
*text; // Human-readable text
float width, // Width in points
length, // Length in points
left, // Left limit in points
bottom, // Bottom limit in points
right, // Right limit in points
top; // Top limit in points
ppdcString *size_code, // PageSize code, if any
*region_code; // PageRegion code, if any
ppdcMediaSize(const char *n, const char *t, float w, float l,
float lm, float bm, float rm, float tm,
const char *sc = 0, const char *rc = 0);
~ppdcMediaSize();
PPDC_NAME("ppdcMediaSize")
};
class ppdcProfile //// Color Profile
: public ppdcShared
{
public:
ppdcString *resolution, // Resolution name
*media_type; // Media type name
float density, // Color profile density
gamma, // Color profile gamma
profile[9]; // Color profile matrix
ppdcProfile(const char *r, const char *m, float d, float g, const float *p);
~ppdcProfile();
PPDC_NAME("ppdcProfile")
};
class ppdcSource;
class ppdcDriver //// Printer Driver Data
: public ppdcShared
{
public:
ppdcDrvType type; // Driver type
ppdcArray *copyright; // Copyright strings
ppdcString *manufacturer, // Manufacturer
*model_name, // Name of printer model
*file_name, // Output filename for PPD
*pc_file_name, // 8 character PC filename for PPD
*version; // Version number
int model_number, // Model number for driver
manual_copies, // Do manual copies?
color_device, // Support color?
throughput; // Throughput in pages per minute
ppdcArray *attrs, // Attributes
*constraints, // Constraints
*filters, // Filters
*fonts, // Fonts
*groups, // Option groups
*profiles, // Color profiles
*sizes; // Fixed sizes
ppdcString *default_font, // Default font
*default_size; // Default size option
int variable_paper_size; // Support variable sizes?
ppdcString *custom_size_code; // Custom page size code, if any
float left_margin, // Margins for device in points
bottom_margin,
right_margin,
top_margin,
max_width, // Maximum width (points)
max_length, // Maximum length (points)
min_width, // Minimum width (points)
min_length; // Minimum length (points)
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) {
copyright->add(new ppdcString(c));
}
void add_filter(ppdcFilter *f) { filters->add(f); }
void add_font(ppdcFont *f) { fonts->add(f); }
void add_group(ppdcGroup *g) { groups->add(g); }
void add_profile(ppdcProfile *p) { profiles->add(p); }
void add_size(ppdcMediaSize *m) { sizes->add(m); }
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);
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);
};
class ppdcVariable //// Variable Definition
: public ppdcShared
{
public:
ppdcString *name, // Name of variable
*value; // Value of variable
ppdcVariable(const char *n, const char *v);
~ppdcVariable();
PPDC_NAME("ppdcVariable")
void set_value(const char *v);
};
class ppdcFile //// File
{
public:
bool close_on_delete; // Close file on delete?
cups_file_t *fp; // File pointer
const char *filename; // Filename
int line; // Line in file
ppdcFile(const char *f, cups_file_t *ffp = (cups_file_t *)0);
~ppdcFile();
int get();
int peek();
};
class ppdcSource //// Source File
: public ppdcShared
{
public:
static ppdcArray *includes; // Include directories
static const char *driver_types[]; // Driver types
ppdcString *filename; // Filename
ppdcArray *base_fonts, // Base fonts
*drivers, // Printer drivers
*po_files, // Message catalogs
*sizes, // Predefined media sizes
*vars; // Defined variables
int cond_state, // Cummulative conditional state
*cond_current, // Current #if state
cond_stack[101]; // #if state stack
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,
int nlen);
ppdcCatalog *find_po(const char *l);
ppdcMediaSize *find_size(const char *s);
ppdcVariable *find_variable(const char *n);
ppdcAttr *get_attr(ppdcFile *fp, bool loc = false);
int get_boolean(ppdcFile *fp);
ppdcChoice *get_choice(ppdcFile *fp);
ppdcChoice *get_color_model(ppdcFile *fp);
int get_color_order(const char *co);
ppdcProfile *get_color_profile(ppdcFile *fp);
int get_color_space(const char *cs);
ppdcConstraint *get_constraint(ppdcFile *fp);
ppdcMediaSize *get_custom_size(ppdcFile *fp);
void get_duplex(ppdcFile *fp, ppdcDriver *d);
ppdcFilter *get_filter(ppdcFile *fp);
float get_float(ppdcFile *fp);
ppdcFont *get_font(ppdcFile *fp);
ppdcChoice *get_generic(ppdcFile *fp, const char *keyword,
const char *tattr, const char *nattr);
ppdcGroup *get_group(ppdcFile *fp, ppdcDriver *d);
ppdcOption *get_installable(ppdcFile *fp);
int get_integer(const char *v);
int get_integer(ppdcFile *fp);
float get_measurement(ppdcFile *fp);
ppdcOption *get_option(ppdcFile *fp, ppdcDriver *d, ppdcGroup *g);
ppdcCatalog *get_po(ppdcFile *fp);
ppdcChoice *get_resolution(ppdcFile *fp);
ppdcProfile *get_simple_profile(ppdcFile *fp);
ppdcMediaSize *get_size(ppdcFile *fp);
char *get_token(ppdcFile *fp, char *buffer, int buflen);
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, 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);
};
#endif // !_PPDC_H_
//
// End of "$Id: ppdc.h 3755 2012-03-30 05:59:14Z msweet $".
//
|