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
|
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied, modified
or distributed except as expressly authorized under the terms of that
license. Refer to licensing information at http://www.artifex.com/
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
/* $Id$ */
/* Configuration tables */
#include "memory_.h"
#include "gx.h"
#include "gscdefs.h" /* interface */
#include "gconf.h" /* for #defines */
#include "gxdevice.h"
#include "gxdhtres.h"
#include "gxiclass.h"
#include "gxiodev.h"
#include "gxiparam.h"
#include "gxcomp.h"
/*
* The makefile generates the file gconfig.h, which consists of
* lines of the form
* device_(gs_xxx_device)
* or
* device2_(gs_xxx_device)
* for each installed device;
* emulator_("emulator", strlen("emulator"))
* for each known emulator;
* function_type_(xxx, gs_function_type_xxx)
* for each known function type;
* halftone_(gs_dht_xxx)
* for each known (device) halftone;
* image_class_(gs_image_class_xxx)
* for each known image class;
* image_type_(xxx, gs_image_type_xxx)
* for each known image type;
* init_(gs_xxx_init)
* for each initialization procedure;
* io_device_(gs_iodev_xxx)
* for each known IODevice;
* oper_(xxx_op_defs)
* for each operator option;
* psfile_("gs_xxxx.ps", strlen("gs_xxxx.ps"))
* for each optional initialization file.
* plug_(gs_xxx_init)
* for each plugin;
*
* We include this file multiple times to generate various different
* source structures. (It's a hack, but we haven't come up with anything
* more satisfactory.)
*/
/* ---------------- Resources (devices, inits, IODevices) ---------------- */
/* Declare devices, image types, init procedures, and IODevices as extern. */
#define compositor_(comp_type) extern gs_composite_type_t comp_type;
#define device_(dev) extern gx_device dev;
#define device2_(dev) extern const gx_device dev;
#define halftone_(dht) extern DEVICE_HALFTONE_RESOURCE_PROC(dht);
#define image_class_(cls) extern iclass_proc(cls);
#define image_type_(i,type) extern const gx_image_type_t type;
#define init_(proc) extern init_proc(proc);
#define io_device_(iodev) extern const gx_io_device iodev;
#include "gconf.h"
#undef io_device_
#undef init_
#undef image_type_
#undef image_class_
#undef halftone_
#undef device2_
#undef device_
#undef compositor_
/* Set up compositor type table. */
#define compositor_(comp_type) &comp_type,
static const gs_composite_type_t *const gx_compositor_list[] = {
#include "gconf.h"
0
};
#undef compositor_
/* Set up the device table. */
#define device_(dev) (const gx_device *)&dev,
#define device2_(dev) &dev,
static const gx_device *gx_device_list[1024] = {
/* as shared library are adding drivers here, so removed constness */
#include "gconf.h"
0
};
#undef device2_
#undef device_
/* Set up the (device) halftone table. */
extern_gx_device_halftone_list();
#define halftone_(dht) dht,
const gx_dht_proc gx_device_halftone_list[] = {
#include "gconf.h"
0
};
#undef halftone_
/* Set up the image class table. */
extern_gx_image_class_table();
#define image_class_(cls) cls,
const gx_image_class_t gx_image_class_table[] = {
#include "gconf.h"
0
};
#undef image_class_
/* We must use unsigned here, not uint. See gscdefs.h. */
const unsigned gx_image_class_table_count = countof(gx_image_class_table) - 1;
/* Set up the image type table. */
extern_gx_image_type_table();
#define image_type_(i,type) &type,
const gx_image_type_t *const gx_image_type_table[] = {
#include "gconf.h"
0
};
#undef image_type_
/* We must use unsigned here, not uint. See gscdefs.h. */
const unsigned gx_image_type_table_count = countof(gx_image_type_table) - 1;
/* Set up the initialization procedure table. */
extern_gx_init_table();
#define init_(proc) proc,
const gx_init_proc gx_init_table[] = {
#include "gconf.h"
0
};
#undef init_
/* Set up the IODevice table. The first entry must be %os%, */
/* since it is the default for files with no explicit device specified. */
extern_gx_io_device_table();
extern gx_io_device gs_iodev_os;
#define io_device_(iodev) &iodev,
const gx_io_device *const gx_io_device_table[] = {
&gs_iodev_os,
#include "gconf.h"
0
};
#undef io_device_
/* We must use unsigned here, not uint. See gscdefs.h. */
const unsigned gx_io_device_table_count = countof(gx_io_device_table) - 1;
/* Find a compositor by name. */
extern_gs_find_compositor();
const gs_composite_type_t *
gs_find_compositor(int comp_id)
{
const gs_composite_type_t *const * ppcomp = gx_compositor_list;
const gs_composite_type_t * pcomp;
while ((pcomp = *ppcomp++) != 0 && pcomp->comp_id != comp_id)
;
return pcomp;
}
/* Return the list of device prototypes, a NULL list of their structure */
/* descriptors (no longer used), and (as the value) the length of the lists. */
extern_gs_lib_device_list();
int
gs_lib_device_list(const gx_device * const **plist,
gs_memory_struct_type_t ** pst)
{
int i;
if (plist != 0)
*plist = gx_device_list;
if (pst != 0)
*pst = NULL;
for (i = 0; i < countof(gx_device_list) - 1; ++i)
if (!gx_device_list[i])
break;
return i;
}
#ifdef GS_DEVS_SHARED
void
gs_lib_register_device(const gx_device *dev)
{
int i;
for (i = 0; i < countof(gx_device_list) - 1; ++i)
if (!gx_device_list[i]) {
gx_device_list[i] = dev;
return;
}
}
#endif
|