home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / IGC.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  3KB  |  81 lines

  1. /* Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* igc.h */
  20. /* Internal interfaces in Ghostscript GC */
  21.  
  22. /* Define the procedures shared among a "genus" of structures. */
  23. /* Currently there are only two genera: refs, and all other structures. */
  24. struct struct_shared_procs_s {
  25.  
  26.     /* Clear the relocation information in an object. */
  27.  
  28. #define gc_proc_clear_reloc(proc)\
  29.   void proc(P2(obj_header_t *pre, uint size))
  30.     gc_proc_clear_reloc((*clear_reloc));
  31.  
  32.     /* Compute any internal relocation for a marked object. */
  33.     /* Return true if the object should be kept. */
  34.     /* The reloc argument shouldn't be required, */
  35.     /* but we need it for ref objects. */
  36.  
  37. #define gc_proc_set_reloc(proc)\
  38.   bool proc(P3(obj_header_t *pre, uint reloc, uint size))
  39.     gc_proc_set_reloc((*set_reloc));
  40.  
  41.     /* Compact an object. */
  42.  
  43. #define gc_proc_compact(proc)\
  44.   void proc(P3(obj_header_t *pre, obj_header_t *dpre, uint size))
  45.     gc_proc_compact((*compact));
  46.  
  47. };
  48.  
  49. /* Exported by igcref.c for igc.c */
  50. void gs_mark_refs(P3(ref_packed *, ref *, bool));
  51. void ptr_ref_unmark(P2(void *, gc_state_t *));
  52. bool ptr_ref_mark(P2(void *, gc_state_t *));
  53. ref_packed *gs_reloc_ref_ptr(P2(ref_packed *, gc_state_t *));
  54.  
  55. /* Exported by igcstr.c for igc.c */
  56. void gc_strings_set_marks(P2(chunk_t *, bool));
  57. bool gc_string_mark(P4(const byte *, uint, bool, gc_state_t *));
  58. void gc_strings_clear_reloc(P1(chunk_t *));
  59. void gc_strings_set_reloc(P1(chunk_t *));
  60. void gc_strings_compact(P1(chunk_t *));
  61.  
  62. /* Macro for returning a relocated pointer */
  63. #ifdef DEBUG
  64. void *print_reloc_proc(P3(void *obj, const char *cname, void *robj));
  65. #  define print_reloc(obj, cname, nobj)\
  66.     (gs_debug_c('9') ? print_reloc_proc(obj, cname, nobj) :\
  67.      (void *)(nobj))
  68. #else
  69. #  define print_reloc(obj, cname, nobj)\
  70.     (void *)(nobj)
  71. #endif
  72.  
  73. /* Define the structure for holding GC state. */
  74. /*typedef struct gc_state_s gc_state_t;*/    /* in gsstruct.h */
  75. struct gc_state_s {
  76.     chunk_locator_t loc;
  77.     gs_ref_memory_t *local;
  78.     gs_ref_memory_t *global;
  79.     gs_ref_memory_t *system;
  80. };
  81.