interp.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* Copyright (C) 1994, 1999 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: interp.h,v 1.2 2000/09/19 19:00:46 lpd Exp $ */
  16. /* Internal interfaces to interp.c and iinit.c */
  17. #ifndef interp_INCLUDED
  18. # define interp_INCLUDED
  19. /* ------ iinit.c ------ */
  20. /* Enter a name and value into systemdict. */
  21. int i_initial_enter_name(P3(i_ctx_t *, const char *, const ref *));
  22. #define initial_enter_name(nstr, pvalue)\
  23. i_initial_enter_name(i_ctx_p, nstr, pvalue)
  24. /* Remove a name from systemdict. */
  25. void i_initial_remove_name(P2(i_ctx_t *, const char *));
  26. #define initial_remove_name(nstr)\
  27. i_initial_remove_name(i_ctx_p, nstr)
  28. /* ------ interp.c ------ */
  29. /*
  30. * Maximum number of arguments (and results) for an operator,
  31. * determined by operand stack block size.
  32. */
  33. extern const int gs_interp_max_op_num_args;
  34. /*
  35. * Number of slots to reserve at the start of op_def_table for
  36. * operators which are hard-coded into the interpreter loop.
  37. */
  38. extern const int gs_interp_num_special_ops;
  39. /*
  40. * Create an operator during initialization.
  41. * If operator is hard-coded into the interpreter,
  42. * assign it a special type and index.
  43. */
  44. void gs_interp_make_oper(P3(ref * opref, op_proc_t, int index));
  45. /* Get the name corresponding to an error number. */
  46. int gs_errorname(P3(i_ctx_t *, int, ref *));
  47. /* Put a string in $error /errorinfo. */
  48. int gs_errorinfo_put_string(P2(i_ctx_t *, const char *));
  49. /* Initialize the interpreter. */
  50. int gs_interp_init(P3(i_ctx_t **pi_ctx_p, const ref *psystem_dict,
  51. gs_dual_memory_t *dmem));
  52. #ifndef gs_context_state_t_DEFINED
  53. # define gs_context_state_t_DEFINED
  54. typedef struct gs_context_state_s gs_context_state_t;
  55. #endif
  56. /*
  57. * Create initial stacks for the interpreter.
  58. * We export this for creating new contexts.
  59. */
  60. int gs_interp_alloc_stacks(P2(gs_ref_memory_t * smem,
  61. gs_context_state_t * pcst));
  62. /*
  63. * Free the stacks when destroying a context. This is the inverse of
  64. * create_stacks.
  65. */
  66. void gs_interp_free_stacks(P2(gs_ref_memory_t * smem,
  67. gs_context_state_t * pcst));
  68. /* Reset the interpreter. */
  69. void gs_interp_reset(P1(i_ctx_t *i_ctx_p));
  70. /* Define the top-level interface to the interpreter. */
  71. int gs_interpret(P5(i_ctx_t **pi_ctx_p, ref * pref, int user_errors,
  72. int *pexit_code, ref * perror_object));
  73. #endif /* interp_INCLUDED */