/* Enter a name and value into a dictionary. */ static int i_initial_enter_name_in(i_ctx_t *i_ctx_p, ref *pdict, const char *nstr, const ref * pref) { int code = idict_put_string(pdict, nstr, pref); if (code < 0) lprintf4("initial_enter failed (%d), entering /%s in -dict:%u/%u-\n", code, nstr, dict_length(pdict), dict_maxlength(pdict)); return code; }
/* Note that i_ctx_p may be NULL. */ int add_FID(i_ctx_t *i_ctx_p, ref * fp /* t_dictionary */ , gs_font * pfont, gs_ref_memory_t *imem) { ref fid; make_tav(&fid, t_fontID, a_readonly | imemory_space(imem) | imemory_new_mask(imem), pstruct, (void *)pfont); return (i_ctx_p ? idict_put_string(fp, "FID", &fid) : dict_put_string(fp, "FID", &fid, NULL)); }
/* Set actual frequency and angle in a dictionary. */ static int dict_real_result(i_ctx_t *i_ctx_p, ref * pdict, const char *kstr, floatp val) { int code = 0; ref *ignore; if (dict_find_string(pdict, kstr, &ignore) > 0) { ref rval; check_dict_write(*pdict); make_real(&rval, val); code = idict_put_string(pdict, kstr, &rval); } return code; }
/* <dict> .initialize_dsc_parser - */ static int zinitialize_dsc_parser(i_ctx_t *i_ctx_p) { ref local_ref; int code; os_ptr const op = osp; dict * const pdict = op->value.pdict; gs_memory_t * const mem = (gs_memory_t *)dict_memory(pdict); dsc_data_t * const data = gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init"); data->dsc_data_ptr = dsc_init((void *) "Ghostscript DSC parsing"); if (!data->dsc_data_ptr) return_error(e_VMerror); dsc_set_error_function(data->dsc_data_ptr, dsc_error_handler); make_astruct(&local_ref, a_readonly | r_space(op), (byte *) data); code = idict_put_string(op, dsc_dict_name, &local_ref); if (code >= 0) pop(1); return code; }
/* Create and store [/key any] array in $error.errorinfo. * The key must be a permanently allocated C string. * This routine is here because it is often used with parameter dictionaries. */ int gs_errorinfo_put_pair(i_ctx_t *i_ctx_p, const char *key, int len, const ref *any) { int code; ref pair, *aptr, key_name, *pderror; code = name_ref(imemory_local, (const byte *)key, len, &key_name, 0); if (code < 0) return code; code = gs_alloc_ref_array(iimemory_local, &pair, a_readonly, 2, "gs_errorinfo_put_pair"); if (code < 0) return code; aptr = pair.value.refs; ref_assign_new(aptr, &key_name); ref_assign_new(aptr+1, any); if (dict_find_string(systemdict, "$error", &pderror) <= 0 || !r_has_type(pderror, t_dictionary) || idict_put_string(pderror, "errorinfo", &pair) < 0 ) return_error(e_Fatal); return 0; }