1 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001 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: iminst.h,v 1.8 2004/08/04 19:36:13 stefan Exp $ */ 18 /* Definition of interpreter instance */ 19 /* Requires stdio_.h, gsmemory.h, iref.h, iapi.h */ 20 21 #ifndef iminst_INCLUDED 22 # define iminst_INCLUDED 23 24 #ifndef gs_main_instance_DEFINED 25 # define gs_main_instance_DEFINED 26 typedef struct gs_main_instance_s gs_main_instance; 27 #endif 28 29 /* 30 * Define the structure of a search path. Currently there is only one, 31 * but there might be more someday. 32 * 33 * container - an array large enough to hold the specified maximum 34 * number of directories. Both the array and all the strings in it are 35 * in the 'foreign' VM space. 36 * list - the initial interval of container that defines the actual 37 * search list. 38 * env - the contents of an environment variable, implicitly added 39 * at the end of the list; may be 0. 40 * final - the final set of directories specified in the makefile; 41 * may be 0. 42 * count - the number of elements in the list, excluding a possible 43 * initial '.', env, and final. 44 */ 45 typedef struct gs_file_path_s { 46 ref container; 47 ref list; 48 const char *env; 49 const char *final; 50 uint count; 51 } gs_file_path; 52 53 /* buffer sizes for stdio */ 54 #define STDIN_BUF_SIZE 128 55 #define STDOUT_BUF_SIZE 128 56 #define STDERR_BUF_SIZE 128 57 58 /* 59 * Here is where we actually define the structure of interpreter instances. 60 * Clients should not reference any of the members. Note that in order to 61 * be able to initialize this structure statically, members including 62 * unions must come last (and be initialized to 0 by default). 63 */ 64 struct gs_main_instance_s { 65 /* The following are set during initialization. */ 66 gs_memory_t *heap; /* (C) heap allocator */ 67 uint memory_chunk_size; /* 'wholesale' allocation unit */ 68 ulong name_table_size; 69 uint run_buffer_size; 70 int init_done; /* highest init done so far */ 71 int user_errors; /* define what to do with errors */ 72 bool search_here_first; /* if true, make '.' first lib dir */ 73 bool run_start; /* if true, run 'start' after */ 74 /* processing command line */ 75 gs_file_path lib_path; /* library search list (GS_LIB) */ 76 long base_time[2]; /* starting usertime */ 77 void *readline_data; /* data for gp_readline */ 78 char stdin_buf[STDIN_BUF_SIZE]; /* for e_NeedStdin callout */ 79 char stdout_buf[STDOUT_BUF_SIZE]; /* for e_NeedStdout callout */ 80 char stderr_buf[STDERR_BUF_SIZE]; /* for e_NeedStderr callout */ 81 ref error_object; /* Use by gsapi_*() */ 82 #if 1 83 /* needs to be removed */ 84 display_callback *display; /* callback structure for display device */ 85 #endif 86 87 /* The following are updated dynamically. */ 88 i_ctx_t *i_ctx_p; /* current interpreter context state */ 89 }; 90 91 /* 92 * Note that any file that uses the following definition of default values 93 * must include gconfig.h, because of SEARCH_HERE_FIRST. 94 */ 95 #define gs_main_instance_default_init_values\ 96 0, 20000, 0, 0, -1, 0, SEARCH_HERE_FIRST, 1 97 extern const gs_main_instance gs_main_instance_init_values; 98 99 #endif /* iminst_INCLUDED */ 100