home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / opaque.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-09  |  2.1 KB  |  61 lines

  1. /* Opaque Lisp objects.
  2.    Copyright (C) 1993 Sun Microsystems, Inc.
  3.  
  4. This file is part of XEmacs.
  5.  
  6. XEmacs is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option) any
  9. later version.
  10.  
  11. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14. for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with XEmacs; see the file COPYING.  If not, write to the Free
  18. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* Synched up with: Not in FSF. */
  21.  
  22. /* Written by Ben Wing, October 1993. */
  23.  
  24. #ifndef _XEMACS_OPAQUE_H_
  25. #define _XEMACS_OPAQUE_H_
  26.  
  27. struct Lisp_Opaque
  28. {
  29.   struct lcrecord_header header;
  30.   Lisp_Object (*markfun) (Lisp_Object obj, void (*markobj) (Lisp_Object));
  31.   long size;
  32.   char data[1];
  33. };
  34.  
  35. DECLARE_LRECORD (opaque, struct Lisp_Opaque);
  36. #define XOPAQUE(x) XRECORD (x, opaque, struct Lisp_Opaque)
  37. #define XSETOPAQUE(x, p) XSETRECORD (x, p, opaque)
  38. #define OPAQUEP(x) RECORDP (x, opaque)
  39. /* #define CHECK_OPAQUE(x, i) CHECK_RECORD (x, opaque)
  40.    Opaque pointers should never escape to the Lisp level, so
  41.    functions should not be doing this. */
  42.  
  43. extern Lisp_Object make_opaque (int size, void *data);
  44. extern Lisp_Object make_opaque_ptr (void *val);
  45. extern Lisp_Object make_opaque_long (long val);
  46.  
  47. #define OPAQUE_SIZE(op) ((op)->size)
  48. #define OPAQUE_DATA(op) ((op)->data)
  49. #define OPAQUE_MARKFUN(op) ((op)->markfun)
  50. #define XOPAQUE_SIZE(op) OPAQUE_SIZE (XOPAQUE (op))
  51. #define XOPAQUE_DATA(op) OPAQUE_DATA (XOPAQUE (op))
  52. #define XOPAQUE_MARKFUN(op) OPAQUE_MARKFUN (XOPAQUE (op))
  53.  
  54. #define get_opaque_ptr(op) (* (void **) XOPAQUE_DATA (op))
  55. #define set_opaque_ptr(op, ptr) (get_opaque_ptr (op) = ptr)
  56. #define get_opaque_long(op) (* (long *) XOPAQUE_DATA (op))
  57. #define set_opaque_long(op, ptr) (get_opaque_long (op) = ptr)
  58. #define set_opaque_markfun(op, fun) (XOPAQUE_MARKFUN (op) = fun)
  59.  
  60. #endif /* _XEMACS_OPAQUE_H_ */
  61.