gslibctx.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Portions Copyright (C) 2003 artofcode LLC.
  2. Portions Copyright (C) 2003 Artifex Software Inc.
  3. This software is based in part on the work of the Independent JPEG Group.
  4. All Rights Reserved.
  5. This software is distributed under license and may not be copied, modified
  6. or distributed except as expressly authorized under the terms of that
  7. license. Refer to licensing information at http://www.artifex.com/ or
  8. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  9. San Rafael, CA 94903, (415)492-9861, for further information. */
  10. /*$Id: gslibctx.h,v 1.5 2004/11/03 17:46:16 giles Exp $ */
  11. #ifndef GSLIBCTX_H
  12. #define GSLIBCTX_H
  13. #include "std.h"
  14. #include "stdio_.h"
  15. #include "gs_dll_call.h"
  16. typedef struct name_table_s *name_table_ptr;
  17. typedef struct gs_lib_ctx_s
  18. {
  19. gs_memory_t *memory; /* mem->gs_lib_ctx->memory == mem */
  20. FILE *fstdin;
  21. FILE *fstdout;
  22. FILE *fstderr;
  23. FILE *fstdout2; /* for redirecting %stdout and diagnostics */
  24. bool stdout_is_redirected; /* to stderr or fstdout2 */
  25. bool stdout_to_stderr;
  26. bool stdin_is_interactive;
  27. void *caller_handle; /* identifies caller of GS DLL/shared object */
  28. int (GSDLLCALL *stdin_fn)(void *caller_handle, char *buf, int len);
  29. int (GSDLLCALL *stdout_fn)(void *caller_handle, const char *str, int len);
  30. int (GSDLLCALL *stderr_fn)(void *caller_handle, const char *str, int len);
  31. int (GSDLLCALL *poll_fn)(void *caller_handle);
  32. ulong gs_next_id; /* gs_id initialized here, private variable of gs_next_ids() */
  33. void *top_of_system; /* use accessor functions to walk down the system
  34. * to the desired structure gs_lib_ctx_get_*()
  35. */
  36. name_table_ptr gs_name_table; /* hack this is the ps interpreters name table
  37. * doesn't belong here
  38. */
  39. /* Define whether dictionaries expand automatically when full. */
  40. bool dict_auto_expand; /* ps dictionary: false level 1 true level 2 or 3 */
  41. } gs_lib_ctx_t;
  42. /** initializes and stores itself in the given gs_memory_t pointer.
  43. * it is the responsibility of the gs_memory_t objects to copy
  44. * the pointer to subsequent memory objects.
  45. */
  46. int gs_lib_ctx_init( gs_memory_t *mem );
  47. void *gs_lib_ctx_get_interp_instance( gs_memory_t *mem );
  48. /* HACK to get at non garbage collection memory pointer
  49. *
  50. */
  51. const gs_memory_t * gs_lib_ctx_get_non_gc_memory_t(void);
  52. #endif /* GSLIBCTX_H */