1 // This file is part of the brlaser printer driver.
2 //
3 // Copyright 2013 Peter De Wachter
4 //
5 // brlaser is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // brlaser is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with brlaser.  If not, see <http://www.gnu.org/licenses/>.
17 
18 #include "config.h"
19 #include "debug.h"
20 #include <iostream>
21 #include <typeinfo>
22 
23 namespace {
24 
25 template <typename T>
dump(const char * name,const T & value)26 void dump(const char *name, const T &value) {
27   std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " = " << value << '\n';
28 }
29 
30 template <typename T, int N>
dump(const char * name,const T (& value)[N])31 void dump(const char *name, const T (&value)[N]) {
32   std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " =";
33   for (int i = 0; i < N; ++i) {
34     std::cerr << ' ' << value[i];
35   }
36   std::cerr << '\n';
37 }
38 
dump(const char * name,const char * value)39 void dump(const char *name, const char *value) {
40   std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " = \"" << value << "\"\n";
41 }
42 
43 template <int N, int M>
dump(const char * name,const char (& value)[N][M])44 void dump(const char *name, const char (&value)[N][M]) {
45   std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " =";
46   for (int i = 0; i < N; ++i) {
47     std::cerr << " \"" << value[i] << '"';
48   }
49   std::cerr << '\n';
50 }
51 
52 }  // namespace
53 
54 
dump_page_header(const cups_page_header2_t & h)55 void dump_page_header(const cups_page_header2_t &h) {
56 #define d(f) dump(#f, h.f)
57   d(MediaClass);
58   d(MediaColor);
59   d(MediaType);
60   d(OutputType);
61   d(AdvanceDistance);
62   d(AdvanceMedia);
63   d(Collate);
64   d(CutMedia);
65   d(Duplex);
66   d(HWResolution);
67   d(ImagingBoundingBox);
68   d(InsertSheet);
69   d(Jog);
70   d(LeadingEdge);
71   d(Margins);
72   d(ManualFeed);
73   d(MediaPosition);
74   d(MediaWeight);
75   d(MirrorPrint);
76   d(NegativePrint);
77   d(NumCopies);
78   d(Orientation);
79   d(OutputFaceUp);
80   d(PageSize);
81   d(Separations);
82   d(TraySwitch);
83   d(Tumble);
84   d(cupsWidth);
85   d(cupsHeight);
86   d(cupsMediaType);
87   d(cupsBitsPerColor);
88   d(cupsBitsPerPixel);
89   d(cupsBytesPerLine);
90   d(cupsColorOrder);
91   d(cupsColorSpace);
92   d(cupsCompression);
93   d(cupsRowCount);
94   d(cupsRowFeed);
95   d(cupsRowStep);
96   d(cupsNumColors);
97   d(cupsBorderlessScalingFactor);
98   d(cupsPageSize);
99   d(cupsImagingBBox);
100   d(cupsInteger);
101   d(cupsReal);
102   d(cupsString);
103   d(cupsMarkerType);
104   d(cupsRenderingIntent);
105   d(cupsPageSizeName);
106 #undef d
107 }
108