summaryrefslogtreecommitdiff
path: root/gs/psi/icontext.c
diff options
context:
space:
mode:
Diffstat (limited to 'gs/psi/icontext.c')
-rw-r--r--gs/psi/icontext.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/gs/psi/icontext.c b/gs/psi/icontext.c
index f504875ab..dc8bc5791 100644
--- a/gs/psi/icontext.c
+++ b/gs/psi/icontext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ extern_st(st_exec_stack);
extern_st(st_op_stack);
/* GC descriptors */
-static
+static
CLEAR_MARKS_PROC(context_state_clear_marks)
{
gs_context_state_t *const pcst = vptr;
@@ -49,23 +49,23 @@ CLEAR_MARKS_PROC(context_state_clear_marks)
r_clear_attrs(&pcst->op_array_table_global.table, l_mark);
r_clear_attrs(&pcst->op_array_table_local.table, l_mark);
}
-static
+static
ENUM_PTRS_WITH(context_state_enum_ptrs, gs_context_state_t *pcst) {
index -= 10;
if (index < st_gs_dual_memory_num_ptrs)
- return ENUM_USING(st_gs_dual_memory, &pcst->memory,
- sizeof(pcst->memory), index);
+ return ENUM_USING(st_gs_dual_memory, &pcst->memory,
+ sizeof(pcst->memory), index);
index -= st_gs_dual_memory_num_ptrs;
if (index < st_dict_stack_num_ptrs)
- return ENUM_USING(st_dict_stack, &pcst->dict_stack,
- sizeof(pcst->dict_stack), index);
+ return ENUM_USING(st_dict_stack, &pcst->dict_stack,
+ sizeof(pcst->dict_stack), index);
index -= st_dict_stack_num_ptrs;
if (index < st_exec_stack_num_ptrs)
- return ENUM_USING(st_exec_stack, &pcst->exec_stack,
- sizeof(pcst->exec_stack), index);
+ return ENUM_USING(st_exec_stack, &pcst->exec_stack,
+ sizeof(pcst->exec_stack), index);
index -= st_exec_stack_num_ptrs;
return ENUM_USING(st_op_stack, &pcst->op_stack,
- sizeof(pcst->op_stack), index);
+ sizeof(pcst->op_stack), index);
}
ENUM_PTR(0, gs_context_state_t, pgs);
case 1: ENUM_RETURN_REF(&pcst->stdio[0]);
@@ -104,8 +104,8 @@ public_st_context_state();
/* Allocate the state of a context. */
int
context_state_alloc(gs_context_state_t ** ppcst,
- const ref *psystem_dict,
- const gs_dual_memory_t * dmem)
+ const ref *psystem_dict,
+ const gs_dual_memory_t * dmem)
{
gs_ref_memory_t *mem = dmem->space_local;
gs_context_state_t *pcst = *ppcst;
@@ -113,14 +113,14 @@ context_state_alloc(gs_context_state_t ** ppcst,
int i;
if (pcst == 0) {
- pcst = gs_alloc_struct((gs_memory_t *) mem, gs_context_state_t,
- &st_context_state, "context_state_alloc");
- if (pcst == 0)
- return_error(e_VMerror);
+ pcst = gs_alloc_struct((gs_memory_t *) mem, gs_context_state_t,
+ &st_context_state, "context_state_alloc");
+ if (pcst == 0)
+ return_error(e_VMerror);
}
code = gs_interp_alloc_stacks(mem, pcst);
if (code < 0)
- goto x0;
+ goto x0;
/*
* We have to initialize the dictionary stack early,
* for far-off references to systemdict.
@@ -130,8 +130,8 @@ context_state_alloc(gs_context_state_t ** ppcst,
pcst->dict_stack.userdict_index = 0;
pcst->pgs = int_gstate_alloc(dmem);
if (pcst->pgs == 0) {
- code = gs_note_error(e_VMerror);
- goto x1;
+ code = gs_note_error(e_VMerror);
+ goto x1;
}
pcst->memory = *dmem;
pcst->language_level = 1;
@@ -144,21 +144,21 @@ context_state_alloc(gs_context_state_t ** ppcst,
pcst->plugin_list = 0;
make_t(&pcst->error_object, t__invalid);
{ /*
- * Create an empty userparams dictionary of the right size.
- * If we can't determine the size, pick an arbitrary one.
- */
- ref *puserparams;
- uint size;
- ref *system_dict = &pcst->dict_stack.system_dict;
+ * Create an empty userparams dictionary of the right size.
+ * If we can't determine the size, pick an arbitrary one.
+ */
+ ref *puserparams;
+ uint size;
+ ref *system_dict = &pcst->dict_stack.system_dict;
- if (dict_find_string(system_dict, "userparams", &puserparams) >= 0)
- size = dict_length(puserparams);
- else
- size = 300;
- code = dict_alloc(pcst->memory.space_local, size, &pcst->userparams);
- if (code < 0)
- goto x2;
- /* PostScript code initializes the user parameters. */
+ if (dict_find_string(system_dict, "userparams", &puserparams) >= 0)
+ size = dict_length(puserparams);
+ else
+ size = 300;
+ code = dict_alloc(pcst->memory.space_local, size, &pcst->userparams);
+ if (code < 0)
+ goto x2;
+ /* PostScript code initializes the user parameters. */
}
pcst->scanner_options = 0;
pcst->LockFilePermissions = false;
@@ -169,9 +169,9 @@ context_state_alloc(gs_context_state_t ** ppcst,
/* and so it can act as an empty input stream. */
{
stream *s;
-
- s = (stream*)gs_alloc_bytes_immovable(mem->non_gc_memory->stable_memory,
- sizeof(*s),
+
+ s = (stream*)gs_alloc_bytes_immovable(mem->non_gc_memory->stable_memory,
+ sizeof(*s),
"context_state_alloc");
if (s == NULL)
goto x3;
@@ -184,14 +184,14 @@ context_state_alloc(gs_context_state_t ** ppcst,
}
/* The initial stdio values are bogus.... */
make_file(&pcst->stdio[0], a_readonly | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
make_file(&pcst->stdio[1], a_all | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
make_file(&pcst->stdio[2], a_all | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
for (i = countof(pcst->memory.spaces_indexed); --i >= 0;)
- if (dmem->spaces_indexed[i] != 0)
- ++(dmem->spaces_indexed[i]->num_contexts);
+ if (dmem->spaces_indexed[i] != 0)
+ ++(dmem->spaces_indexed[i]->num_contexts);
/* The number of interpreter "ticks" between calls on the time_slice_proc.
* Currently, the clock ticks before each operator, and at each
* procedure return. */
@@ -202,7 +202,7 @@ context_state_alloc(gs_context_state_t ** ppcst,
x2:gs_state_free(pcst->pgs);
x1:gs_interp_free_stacks(mem, pcst);
x0:if (*ppcst == 0)
- gs_free_object((gs_memory_t *) mem, pcst, "context_state_alloc");
+ gs_free_object((gs_memory_t *) mem, pcst, "context_state_alloc");
return code;
}
@@ -230,17 +230,17 @@ context_state_load(gs_context_state_t * i_ctx_p)
* things that we don't bother.
*/
{
- ref_stack_t *rdstack = &dstack->stack;
- const ref *puserdict =
- ref_stack_index(rdstack, ref_stack_count(rdstack) - 1 -
- dstack->userdict_index);
- ref *plocaldicts;
+ ref_stack_t *rdstack = &dstack->stack;
+ const ref *puserdict =
+ ref_stack_index(rdstack, ref_stack_count(rdstack) - 1 -
+ dstack->userdict_index);
+ ref *plocaldicts;
- if (dict_find_string(puserdict, "localdicts", &plocaldicts) > 0 &&
- r_has_type(plocaldicts, t_dictionary)
- ) {
- dict_copy(plocaldicts, system_dict, dstack);
- }
+ if (dict_find_string(puserdict, "localdicts", &plocaldicts) > 0 &&
+ r_has_type(plocaldicts, t_dictionary)
+ ) {
+ dict_copy(plocaldicts, system_dict, dstack);
+ }
}
/*
* Set systemdict.userparams to the saved copy, and then
@@ -250,12 +250,12 @@ context_state_load(gs_context_state_t * i_ctx_p)
* userparams also appears in localdicts.
*/
code = dict_put_string(system_dict, "userparams", &i_ctx_p->userparams,
- dstack);
+ dstack);
if (code >= 0)
- code = set_user_params(i_ctx_p, &i_ctx_p->userparams);
+ code = set_user_params(i_ctx_p, &i_ctx_p->userparams);
r_set_space(system_dict, space);
if (lmem->save_level > 0)
- alloc_set_in_save(idmemory);
+ alloc_set_in_save(idmemory);
estack_clear_cache(&iexec_stack);
dstack_set_top(&idict_stack);
return code;
@@ -274,13 +274,13 @@ context_state_store(gs_context_state_t * pcst)
* systemdict.userparams to get the correct l_new flag.
*/
{
- ref *puserparams;
- /* We need i_ctx_p for access to the d_stack. */
- i_ctx_t *i_ctx_p = pcst;
+ ref *puserparams;
+ /* We need i_ctx_p for access to the d_stack. */
+ i_ctx_t *i_ctx_p = pcst;
- if (dict_find_string(systemdict, "userparams", &puserparams) < 0)
- return_error(e_Fatal);
- pcst->userparams = *puserparams;
+ if (dict_find_string(systemdict, "userparams", &puserparams) < 0)
+ return_error(e_Fatal);
+ pcst->userparams = *puserparams;
}
return 0;
}
@@ -303,12 +303,12 @@ context_state_free(gs_context_state_t * pcst)
* otherwise, just free the context-related structures.
*/
for (i = countof(pcst->memory.spaces_indexed); --i >= 0;) {
- if (pcst->memory.spaces_indexed[i] != 0 &&
- !--(pcst->memory.spaces_indexed[i]->num_contexts)
- ) {
+ if (pcst->memory.spaces_indexed[i] != 0 &&
+ !--(pcst->memory.spaces_indexed[i]->num_contexts)
+ ) {
/****** FREE THE ENTIRE SPACE ******/
- freed |= 1 << i;
- }
+ freed |= 1 << i;
+ }
}
/*
* If we freed any spaces at all, we must have freed the local
@@ -316,20 +316,20 @@ context_state_free(gs_context_state_t * pcst)
* allocated.
*/
if (freed)
- return freed;
+ return freed;
{
- gs_state *pgs = pcst->pgs;
+ gs_state *pgs = pcst->pgs;
- gs_grestoreall(pgs);
- /* Patch the saved pointer so we can do the last grestore. */
- {
- gs_state *saved = gs_state_saved(pgs);
+ gs_grestoreall(pgs);
+ /* Patch the saved pointer so we can do the last grestore. */
+ {
+ gs_state *saved = gs_state_saved(pgs);
- gs_state_swap_saved(saved, saved);
- }
- gs_grestore(pgs);
- gs_state_swap_saved(pgs, (gs_state *) 0);
- gs_state_free(pgs);
+ gs_state_swap_saved(saved, saved);
+ }
+ gs_grestore(pgs);
+ gs_state_swap_saved(pgs, (gs_state *) 0);
+ gs_state_free(pgs);
}
/****** FREE USERPARAMS ******/
gs_interp_free_stacks(mem, pcst);