-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathdebug.cc
106 lines (97 loc) · 2.51 KB
/
debug.cc
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
// This file is part of the brlaser printer driver.
//
// Copyright 2013 Peter De Wachter
//
// brlaser is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// brlaser is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with brlaser. If not, see <http://www.gnu.org/licenses/>.
#include "debug.h"
#include <iostream>
#include <typeinfo>
namespace {
template <typename T>
void dump(const char *name, const T &value) {
std::cerr << "DEBUG: page header: " << name << " = " << value << '\n';
}
template <typename T, int N>
void dump(const char *name, const T (&value)[N]) {
std::cerr << "DEBUG: page header: " << name << " =";
for (int i = 0; i < N; ++i) {
std::cerr << ' ' << value[i];
}
std::cerr << '\n';
}
void dump(const char *name, const char *value) {
std::cerr << "DEBUG: page header: " << name << " = \"" << value << "\"\n";
}
template <int N, int M>
void dump(const char *name, const char (&value)[N][M]) {
std::cerr << "DEBUG: page header: " << name << " =";
for (int i = 0; i < N; ++i) {
std::cerr << " \"" << value[i] << '"';
}
std::cerr << '\n';
}
} // namespace
void dump_page_header(const cups_page_header2_t &h) {
#define d(f) dump(#f, h.f)
d(MediaClass);
d(MediaColor);
d(MediaType);
d(OutputType);
d(AdvanceDistance);
d(AdvanceMedia);
d(Collate);
d(CutMedia);
d(Duplex);
d(HWResolution);
d(ImagingBoundingBox);
d(InsertSheet);
d(Jog);
d(LeadingEdge);
d(Margins);
d(ManualFeed);
d(MediaPosition);
d(MediaWeight);
d(MirrorPrint);
d(NegativePrint);
d(NumCopies);
d(Orientation);
d(OutputFaceUp);
d(PageSize);
d(Separations);
d(TraySwitch);
d(Tumble);
d(cupsWidth);
d(cupsHeight);
d(cupsMediaType);
d(cupsBitsPerColor);
d(cupsBitsPerPixel);
d(cupsBytesPerLine);
d(cupsColorOrder);
d(cupsColorSpace);
d(cupsCompression);
d(cupsRowCount);
d(cupsRowFeed);
d(cupsRowStep);
d(cupsNumColors);
d(cupsBorderlessScalingFactor);
d(cupsPageSize);
d(cupsImagingBBox);
d(cupsInteger);
d(cupsReal);
d(cupsString);
d(cupsMarkerType);
d(cupsRenderingIntent);
d(cupsPageSizeName);
#undef d
}