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 the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
CA 94129, USA, for further information.
*/
#ifndef inames_INCLUDED
# define inames_INCLUDED
#include "std.h"
#include "iref.h"
#include "imemory.h"
* This file defines those parts of the name table API that depend neither
* on the implementation nor on the existence of a single distinguished
* instance. Procedures in this file begin with names_.
*/
typedef struct name_table_s name_table;
typedef uint name_index_t;
extern const uint name_max_string;
name_table *names_init(ulong size, gs_ref_memory_t *imem);
void names_free(name_table *nt);
gs_memory_t *names_memory(const name_table * nt);
* Look up and/or enter a name in the name table.
* The values of enterflag are:
* -1 -- don't enter (return an error) if missing;
* 0 -- enter if missing, don't copy the string, which was allocated
* statically;
* 1 -- enter if missing, copy the string;
* 2 -- enter if missing, don't copy the string, which was already
* allocated dynamically (using the names_memory allocator).
* Possible errors: VMerror, limitcheck (if string is too long or if
* we have assigned all possible name indices).
*/
int names_ref(name_table * nt, const byte * ptr, uint size, ref * pnref,
int enterflag);
void names_string_ref(const name_table * nt, const ref * pnref, ref * psref);
* names_enter_string calls names_ref with a (permanent) C string.
*/
int names_enter_string(name_table * nt, const char *str, ref * pnref);
* names_from_string essentially implements cvn.
* It always enters the name, and copies the executable attribute.
*/
int names_from_string(name_table * nt, const ref * psref, ref * pnref);
#define names_eq(pnref1, pnref2)\
((pnref1)->value.pname == (pnref2)->value.pname)
void names_invalidate_value_cache(name_table * nt, const ref * pnref);
name_index_t names_index(const name_table * nt, const ref * pnref);
name *names_index_ptr(const name_table * nt, name_index_t nidx);
void names_index_ref(const name_table * nt, name_index_t nidx, ref * pnref);
name_index_t names_next_valid_index(name_table * nt, name_index_t nidx);
bool names_mark_index(name_table * nt, name_index_t nidx);
void *
names_ref_sub_table(name_table * nt, const ref * pnref);
void *
names_index_sub_table(name_table * nt, name_index_t nidx);
void *
names_index_string_sub_table(name_table * nt, name_index_t nidx);
#endif