gsfunc4.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Copyright (C) 2000 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: gsfunc4.h,v 1.2 2000/09/19 19:00:28 lpd Exp $ */
  16. /* Definitions for "PostScript Calculator" Functions */
  17. #ifndef gsfunc4_INCLUDED
  18. # define gsfunc4_INCLUDED
  19. #include "gsfunc.h"
  20. /* ---------------- Types and structures ---------------- */
  21. /* Define the Function type. */
  22. #define function_type_PostScript_Calculator 4
  23. /* Define the opcodes. */
  24. typedef enum {
  25. /* Arithmetic operators */
  26. PtCr_abs, PtCr_add, PtCr_and, PtCr_atan, PtCr_bitshift,
  27. PtCr_ceiling, PtCr_cos, PtCr_cvi, PtCr_cvr, PtCr_div, PtCr_exp,
  28. PtCr_floor, PtCr_idiv, PtCr_ln, PtCr_log, PtCr_mod, PtCr_mul,
  29. PtCr_neg, PtCr_not, PtCr_or, PtCr_round,
  30. PtCr_sin, PtCr_sqrt, PtCr_sub, PtCr_truncate, PtCr_xor,
  31. /* Comparison operators */
  32. PtCr_eq, PtCr_ge, PtCr_gt, PtCr_le, PtCr_lt, PtCr_ne,
  33. /* Stack operators */
  34. PtCr_copy, PtCr_dup, PtCr_exch, PtCr_index, PtCr_pop, PtCr_roll,
  35. /* Constants */
  36. PtCr_byte, PtCr_int /* native */, PtCr_float /* native */,
  37. PtCr_true, PtCr_false,
  38. /* Special operators */
  39. PtCr_if, PtCr_else, PtCr_return
  40. } gs_PtCr_opcode_t;
  41. #define PtCr_NUM_OPS ((int)PtCr_byte)
  42. #define PtCr_NUM_OPCODES ((int)PtCr_return + 1)
  43. /* Define PostScript Calculator functions. */
  44. typedef struct gs_function_PtCr_params_s {
  45. gs_function_params_common;
  46. gs_const_string ops; /* gs_PtCr_opcode_t[] */
  47. } gs_function_PtCr_params_t;
  48. /****** NEEDS TO INCLUDE data_source ******/
  49. #define private_st_function_PtCr() /* in gsfunc4.c */\
  50. gs_private_st_suffix_add_strings1(st_function_PtCr, gs_function_PtCr_t,\
  51. "gs_function_PtCr_t", function_PtCr_enum_ptrs, function_PtCr_reloc_ptrs,\
  52. st_function, params.ops)
  53. /* ---------------- Procedures ---------------- */
  54. /* Allocate and initialize a PostScript Calculator function. */
  55. int gs_function_PtCr_init(P3(gs_function_t ** ppfn,
  56. const gs_function_PtCr_params_t * params,
  57. gs_memory_t * mem));
  58. /* Free the parameters of a PostScript Calculator function. */
  59. void gs_function_PtCr_free_params(P2(gs_function_PtCr_params_t * params,
  60. gs_memory_t * mem));
  61. #endif /* gsfunc4_INCLUDED */