~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/zdscpars.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/* $Id: zdscpars.c 8022 2007-06-05 22:23:38Z giles $ */
 
14
/* $Id: zdscpars.c 8250 2007-09-25 13:31:24Z giles $ */
15
15
/* C language interface routines to DSC parser */
16
16
 
17
17
/*
100
100
} dsc_data_t;
101
101
 
102
102
/* Structure descriptors */
103
 
private void dsc_finalize(void *vptr);
 
103
static void dsc_finalize(void *vptr);
104
104
gs_private_st_simple_final(st_dsc_data_t, dsc_data_t, "dsc_data_struct", dsc_finalize);
105
105
 
106
106
/* Define the key name for storing the instance pointer in a dictionary. */
107
 
private const char * const dsc_dict_name = "DSC_struct";
 
107
static const char * const dsc_dict_name = "DSC_struct";
108
108
 
109
109
/* ---------------- Initialization / finalization ---------------- */
110
110
 
112
112
 * If we return CDSC_OK then Russell's parser will make it best guess when
113
113
 * it encounters unexpected comment situations.
114
114
 */
115
 
private int
 
115
static int
116
116
dsc_error_handler(void *caller_data, CDSC *dsc, unsigned int explanation,
117
117
                  const char *line, unsigned int line_len)
118
118
{
123
123
 * This operator creates a new, initialized instance of the DSC parser.
124
124
 */
125
125
/* <dict> .initialize_dsc_parser - */
126
 
private int
 
126
static int
127
127
zinitialize_dsc_parser(i_ctx_t *i_ctx_p)
128
128
{
129
129
    ref local_ref;
149
149
/*
150
150
 * This routine will free the memory associated with Russell's parser.
151
151
 */
152
 
private void
 
152
static void
153
153
dsc_finalize(void *vptr)
154
154
{
155
155
    dsc_data_t * const st = vptr;
165
165
/* ------ Utilities for returning values ------ */
166
166
 
167
167
/* Return an integer value. */
168
 
private int
 
168
static int
169
169
dsc_put_int(gs_param_list *plist, const char *keyname, int value)
170
170
{
171
171
    return param_write_int(plist, keyname, &value);
172
172
}
173
173
 
174
174
/* Return a string value. */
175
 
private int
 
175
static int
176
176
dsc_put_string(gs_param_list *plist, const char *keyname,
177
177
               const char *string)
178
178
{
183
183
}
184
184
 
185
185
/* Return a BoundingBox value. */
186
 
private int
 
186
static int
187
187
dsc_put_bounding_box(gs_param_list *plist, const char *keyname,
188
188
                     const CDSCBBOX *pbbox)
189
189
{
209
209
 * These routines transfer data from the C structure into Postscript
210
210
 * key/value pairs in a dictionary.
211
211
 */
212
 
private int
 
212
static int
213
213
dsc_adobe_header(gs_param_list *plist, const CDSC *pData)
214
214
{
215
215
    return dsc_put_int(plist, "EPSF", (int)(pData->epsf? 1: 0));
216
216
}
217
217
 
218
 
private int
 
218
static int
219
219
dsc_creator(gs_param_list *plist, const CDSC *pData)
220
220
{
221
221
    return dsc_put_string(plist, "Creator", pData->dsc_creator );
222
222
}
223
223
 
224
 
private int
 
224
static int
225
225
dsc_creation_date(gs_param_list *plist, const CDSC *pData)
226
226
{
227
227
    return dsc_put_string(plist, "CreationDate", pData->dsc_date );
228
228
}
229
229
 
230
 
private int
 
230
static int
231
231
dsc_title(gs_param_list *plist, const CDSC *pData)
232
232
{
233
233
    return dsc_put_string(plist, "Title", pData->dsc_title );
234
234
}
235
235
 
236
 
private int
 
236
static int
237
237
dsc_for(gs_param_list *plist, const CDSC *pData)
238
238
{
239
239
    return dsc_put_string(plist, "For", pData->dsc_for);
240
240
}
241
241
 
242
 
private int
 
242
static int
243
243
dsc_bounding_box(gs_param_list *plist, const CDSC *pData)
244
244
{
245
245
    return dsc_put_bounding_box(plist, "BoundingBox", pData->bbox);
246
246
}
247
247
 
248
 
private int
 
248
static int
249
249
dsc_page(gs_param_list *plist, const CDSC *pData)
250
250
{
251
251
    int page_num = pData->page_count;
257
257
        return dsc_put_int(plist, "PageNum", 0 );
258
258
}
259
259
 
260
 
private int
 
260
static int
261
261
dsc_pages(gs_param_list *plist, const CDSC *pData)
262
262
{
263
263
    return dsc_put_int(plist, "NumPages", pData->page_pages);
264
264
}
265
265
 
266
 
private int
 
266
static int
267
267
dsc_page_bounding_box(gs_param_list *plist, const CDSC *pData)
268
268
{
269
269
    return dsc_put_bounding_box(plist, "PageBoundingBox", pData->page_bbox);
272
272
/*
273
273
 * Translate Russell's defintions of orientation into Postscript's.
274
274
 */
275
 
private int
 
275
static int
276
276
convert_orient(CDSC_ORIENTATION_ENUM orient)
277
277
{
278
278
    switch (orient) {
284
284
    }
285
285
}
286
286
 
287
 
private int
 
287
static int
288
288
dsc_page_orientation(gs_param_list *plist, const CDSC *pData)
289
289
{
290
290
    int page_num = pData->page_count;
302
302
                           convert_orient(pData->page_orientation));
303
303
}
304
304
 
305
 
private int
 
305
static int
306
306
dsc_orientation(gs_param_list *plist, const CDSC *pData)
307
307
{
308
308
    return dsc_put_int(plist, "Orientation", 
309
309
                           convert_orient(pData->page_orientation));
310
310
}
311
311
 
312
 
private int
 
312
static int
313
313
dsc_viewing_orientation(gs_param_list *plist, const CDSC *pData)
314
314
{
315
315
    int page_num = pData->page_count;
352
352
                                   key/value pairs. */
353
353
} cmdlist_t;
354
354
 
355
 
private const cmdlist_t DSCcmdlist[] = { 
 
355
static const cmdlist_t DSCcmdlist[] = { 
356
356
    { CDSC_PSADOBE,         "Header",           dsc_adobe_header },
357
357
    { CDSC_CREATOR,         "Creator",          dsc_creator },
358
358
    { CDSC_CREATIONDATE,    "CreationDate",     dsc_creation_date },
380
380
 * appropriate for our situation.  So we use this list to check for this
381
381
 * type of comment and do not send it to Russell's parser if found.
382
382
 */
383
 
private const char * const BadCmdlist[] = {
 
383
static const char * const BadCmdlist[] = {
384
384
    "%%BeginData:",
385
385
    "%%EndData",
386
386
    "%%BeginBinary:",
390
390
 
391
391
/* See comments at start of module for description. */
392
392
/* <dict> <string> .parse_dsc_comments <dict> <dsc code> */
393
 
private int
 
393
static int
394
394
zparse_dsc_comments(i_ctx_t *i_ctx_p)
395
395
{
396
396
#define MAX_DSC_MSG_SIZE (DSC_LINE_LENGTH + 4)  /* Allow for %% and CR/LF */