11
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: zusparam.c 8022 2007-06-05 22:23:38Z giles $ */
14
/* $Id: zusparam.c 8329 2007-10-28 17:17:47Z alexcher $ */
15
15
/* User and system parameter operators */
16
16
#include "memory_.h"
17
17
#include "string_.h"
88
88
/* Forward references */
89
private int setparams(i_ctx_t *, gs_param_list *, const param_set *);
90
private int currentparams(i_ctx_t *, const param_set *);
91
private int currentparam1(i_ctx_t *, const param_set *);
89
static int setparams(i_ctx_t *, gs_param_list *, const param_set *);
90
static int currentparams(i_ctx_t *, const param_set *);
91
static int currentparam1(i_ctx_t *, const param_set *);
93
93
/* ------ Passwords ------ */
95
95
/* <string|int> .checkpassword <0|1|2> */
97
97
zcheckpassword(i_ctx_t *i_ctx_p)
124
124
/* ------ System parameters ------ */
126
126
/* Integer values */
128
128
current_BuildTime(i_ctx_t *i_ctx_p)
130
130
return gs_buildtime;
133
133
current_MaxFontCache(i_ctx_t *i_ctx_p)
135
135
return gs_currentcachesize(ifont_dir);
138
138
set_MaxFontCache(i_ctx_t *i_ctx_p, long val)
140
140
return gs_setcachesize(ifont_dir,
141
141
(uint)(val < 0 ? 0 : val > max_uint ? max_uint :
145
145
current_CurFontCache(i_ctx_t *i_ctx_p)
167
167
gs_memory_set_gc_status(iimemory_global, &stat);
171
171
current_Revision(i_ctx_t *i_ctx_p)
173
173
return gs_revision;
175
private const long_param_def_t system_long_params[] =
175
static const long_param_def_t system_long_params[] =
177
177
{"BuildTime", min_long, max_long, current_BuildTime, NULL},
178
178
{"MaxFontCache", 0, MAX_UINT_PARAM, current_MaxFontCache, set_MaxFontCache},
185
185
/* Boolean values */
187
187
current_ByteOrder(i_ctx_t *i_ctx_p)
189
189
return !arch_is_big_endian;
191
private const bool_param_def_t system_bool_params[] =
191
static const bool_param_def_t system_bool_params[] =
193
193
{"ByteOrder", current_ByteOrder, NULL}
196
196
/* String values */
198
198
current_RealFormat(i_ctx_t *i_ctx_p, gs_param_string * pval)
200
200
#if ARCH_FLOATS_ARE_IEEE
207
207
pval->size = strlen(rfs);
208
208
pval->persistent = true;
210
private const string_param_def_t system_string_params[] =
210
static const string_param_def_t system_string_params[] =
212
212
{"RealFormat", current_RealFormat, NULL}
215
215
/* The system parameter set */
216
private const param_set system_param_set =
216
static const param_set system_param_set =
218
218
system_long_params, countof(system_long_params),
219
219
system_bool_params, countof(system_bool_params),
288
288
/* - .currentsystemparams <name1> <value1> ... */
290
290
zcurrentsystemparams(i_ctx_t *i_ctx_p)
292
292
return currentparams(i_ctx_p, &system_param_set);
295
295
/* <name> .getsystemparam <value> */
297
297
zgetsystemparam(i_ctx_t *i_ctx_p)
299
299
return currentparam1(i_ctx_p, &system_param_set);
302
302
/* ------ User parameters ------ */
304
304
/* Integer values */
306
306
current_JobTimeout(i_ctx_t *i_ctx_p)
311
311
set_JobTimeout(i_ctx_t *i_ctx_p, long val)
316
316
current_MaxFontItem(i_ctx_t *i_ctx_p)
318
318
return gs_currentcacheupper(ifont_dir);
321
321
set_MaxFontItem(i_ctx_t *i_ctx_p, long val)
323
323
return gs_setcacheupper(ifont_dir, val);
326
326
current_MinFontCompress(i_ctx_t *i_ctx_p)
328
328
return gs_currentcachelower(ifont_dir);
331
331
set_MinFontCompress(i_ctx_t *i_ctx_p, long val)
333
333
return gs_setcachelower(ifont_dir, val);
336
336
current_MaxOpStack(i_ctx_t *i_ctx_p)
338
338
return ref_stack_max_count(&o_stack);
341
341
set_MaxOpStack(i_ctx_t *i_ctx_p, long val)
343
343
return ref_stack_set_max_count(&o_stack, val);
346
346
current_MaxDictStack(i_ctx_t *i_ctx_p)
348
348
return ref_stack_max_count(&d_stack);
351
351
set_MaxDictStack(i_ctx_t *i_ctx_p, long val)
353
353
return ref_stack_set_max_count(&d_stack, val);
356
356
current_MaxExecStack(i_ctx_t *i_ctx_p)
358
358
return ref_stack_max_count(&e_stack);
361
361
set_MaxExecStack(i_ctx_t *i_ctx_p, long val)
363
363
return ref_stack_set_max_count(&e_stack, val);
366
366
current_MaxLocalVM(i_ctx_t *i_ctx_p)
368
368
gs_memory_gc_status_t stat;
389
389
gs_memory_gc_status(iimemory_local, &lstat);
390
390
return (!gstat.enabled ? -2 : !lstat.enabled ? -1 : 0);
393
393
current_VMThreshold(i_ctx_t *i_ctx_p)
395
395
gs_memory_gc_status_t stat;
397
397
gs_memory_gc_status(iimemory_local, &stat);
398
398
return stat.vm_threshold;
401
401
current_WaitTimeout(i_ctx_t *i_ctx_p)
406
406
set_WaitTimeout(i_ctx_t *i_ctx_p, long val)
411
411
current_MinScreenLevels(i_ctx_t *i_ctx_p)
413
413
return gs_currentminscreenlevels();
416
416
set_MinScreenLevels(i_ctx_t *i_ctx_p, long val)
418
418
gs_setminscreenlevels((uint) val);
422
422
current_AlignToPixels(i_ctx_t *i_ctx_p)
424
424
return gs_currentaligntopixels(ifont_dir);
427
427
set_AlignToPixels(i_ctx_t *i_ctx_p, long val)
429
429
gs_setaligntopixels(ifont_dir, (uint)val);
433
433
current_GridFitTT(i_ctx_t *i_ctx_p)
435
435
return gs_currentgridfittt(ifont_dir);
438
438
set_GridFitTT(i_ctx_t *i_ctx_p, long val)
440
440
gs_setgridfittt(ifont_dir, (uint)val);
443
private const long_param_def_t user_long_params[] =
443
static const long_param_def_t user_long_params[] =
445
445
{"JobTimeout", 0, MAX_UINT_PARAM,
446
446
current_JobTimeout, set_JobTimeout},
474
474
/* Boolean values */
476
476
current_AccurateScreens(i_ctx_t *i_ctx_p)
478
478
return gs_currentaccuratescreens();
481
481
set_AccurateScreens(i_ctx_t *i_ctx_p, bool val)
483
483
gs_setaccuratescreens(val);
486
486
/* Boolean values */
488
488
current_UseWTS(i_ctx_t *i_ctx_p)
490
490
return gs_currentusewts();
493
493
set_UseWTS(i_ctx_t *i_ctx_p, bool val)
495
495
gs_setusewts(val);
499
499
current_LockFilePermissions(i_ctx_t *i_ctx_p)
501
501
return i_ctx_p->LockFilePermissions;
504
504
set_LockFilePermissions(i_ctx_t *i_ctx_p, bool val)
506
506
/* allow locking even if already locked */
509
509
i_ctx_p->LockFilePermissions = val;
512
private const bool_param_def_t user_bool_params[] =
512
static const bool_param_def_t user_bool_params[] =
514
514
{"AccurateScreens", current_AccurateScreens, set_AccurateScreens},
515
515
{"UseWTS", current_UseWTS, set_UseWTS},
519
519
/* The user parameter set */
520
private const param_set user_param_set =
520
static const param_set user_param_set =
522
522
user_long_params, countof(user_long_params),
523
523
user_bool_params, countof(user_bool_params),
558
558
/* - .currentuserparams <name1> <value1> ... */
560
560
zcurrentuserparams(i_ctx_t *i_ctx_p)
562
562
return currentparams(i_ctx_p, &user_param_set);
565
565
/* <name> .getuserparam <value> */
567
567
zgetuserparam(i_ctx_t *i_ctx_p)
569
569
return currentparam1(i_ctx_p, &user_param_set);
641
641
!bytes_compare((const byte *)pname, strlen(pname),
642
642
psref->value.const_bytes, r_size(psref)));
645
645
current_param_list(i_ctx_t *i_ctx_p, const param_set * pset,
646
646
const ref * psref /*t_string */ )
689
* Scanner options can be read, but only individually by .getuserparam.
690
* This avoids putting them into userparams, and being affected by save/restore.
696
switch (ztoken_get_scanner_option(psref, i_ctx_p->scanner_options, &pname)) {
698
code = param_write_null(plist, pname);
702
code = param_write_bool(plist, pname, &val);
687
711
#if ENABLE_CUSTOM_COLOR_CALLBACK
688
712
if (pset == &system_param_set) {
689
713
/* The custom_color callback pointer */
697
721
/* Get the current values of a parameter set to the stack. */
699
723
currentparams(i_ctx_t *i_ctx_p, const param_set * pset)
701
725
return current_param_list(i_ctx_p, pset, NULL);
704
728
/* Get the value of a single parameter to the stack, or signal an error. */
706
730
currentparam1(i_ctx_t *i_ctx_p, const param_set * pset)