1 /* Copyright (C) 1989, 1995, 1998, 1999 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: iname.h,v 1.5 2004/08/04 19:36:13 stefan Exp $ */ 18 /* Interpreter's name table interface */ 19 20 #ifndef iname_INCLUDED 21 # define iname_INCLUDED 22 23 #include "inames.h" 24 25 /* 26 * This file defines those parts of the name table API that refer to the 27 * interpreter's distinguished instance. Procedures in this file begin 28 * with name_. 29 */ 30 31 /* ---------------- Procedural interface ---------------- */ 32 33 34 /* Get the allocator for the name table. */ 35 #define name_memory(mem)\ 36 names_memory(mem->gs_lib_ctx->gs_name_table) 37 38 /* 39 * Look up and/or enter a name in the name table. 40 * See inames.h for the values of enterflag, and the possible return values. 41 */ 42 #define name_ref(mem, ptr, size, pnref, enterflag)\ 43 names_ref(mem->gs_lib_ctx->gs_name_table, ptr, size, pnref, enterflag) 44 #define name_string_ref(mem, pnref, psref)\ 45 names_string_ref(mem->gs_lib_ctx->gs_name_table, pnref, psref) 46 /* 47 * name_enter_string calls name_ref with a (permanent) C string. 48 */ 49 #define name_enter_string(mem, str, pnref)\ 50 names_enter_string(mem->gs_lib_ctx->gs_name_table, str, pnref) 51 /* 52 * name_from_string essentially implements cvn. 53 * It always enters the name, and copies the executable attribute. 54 */ 55 #define name_from_string(mem, psref, pnref)\ 56 names_from_string(mem->gs_lib_ctx->gs_name_table, psref, pnref) 57 58 /* Compare two names for equality. */ 59 #define name_eq(pnref1, pnref2)\ 60 names_eq(pnref1, pnref2) 61 62 /* Invalidate the value cache for a name. */ 63 #define name_invalidate_value_cache(mem, pnref)\ 64 names_invalidate_value_cache(mem->gs_lib_ctx->gs_name_table, pnref) 65 66 /* Convert between names and indices. */ 67 #define name_index(mem, pnref) /* ref => index */\ 68 names_index(mem->gs_lib_ctx->gs_name_table, pnref) 69 #define name_index_ptr(mem, nidx) /* index => name */\ 70 names_index_ptr(mem->gs_lib_ctx->gs_name_table, nidx) 71 #define name_index_ref(mem, nidx, pnref) /* index => ref */\ 72 names_index_ref(mem->gs_lib_ctx->gs_name_table, nidx, pnref) 73 74 /* Get the index of the next valid name. */ 75 /* The argument is 0 or a valid index. */ 76 /* Return 0 if there are no more. */ 77 #define name_next_valid_index(mem, nidx)\ 78 names_next_valid_index(mem->gs_lib_ctx->gs_name_table, nidx) 79 80 /* Mark a name for the garbage collector. */ 81 /* Return true if this is a new mark. */ 82 #define name_mark_index(mem, nidx)\ 83 names_mark_index(mem->gs_lib_ctx->gs_name_table, nidx) 84 85 /* Get the object (sub-table) containing a name. */ 86 /* The garbage collector needs this so it can relocate pointers to names. */ 87 #define name_ref_sub_table(mem, pnref)\ 88 names_ref_sub_table(mem->gs_lib_ctx->gs_name_table, pnref) 89 90 #endif /* iname_INCLUDED */ 91