annotate src/opaque.h @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 697ef44129c6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Opaque Lisp objects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Written by Ben Wing, October 1993. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
26 #ifndef _XEMACS_OPAQUE_H_
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
27 #define _XEMACS_OPAQUE_H_
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
29 typedef union {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
30 struct { Lisp_Object obj; } obj;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
31 struct { void *p; } p;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
32 struct { double d; } d;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
33 } max_align_t;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
34
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
35 typedef struct Lisp_Opaque
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 struct lcrecord_header header;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
38 size_t size;
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
39 max_align_t data[1];
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
40 } Lisp_Opaque;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
42 DECLARE_LRECORD (opaque, Lisp_Opaque);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
43 #define XOPAQUE(x) XRECORD (x, opaque, Lisp_Opaque)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #define XSETOPAQUE(x, p) XSETRECORD (x, p, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #define OPAQUEP(x) RECORDP (x, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 /* #define CHECK_OPAQUE(x) CHECK_RECORD (x, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 Opaque pointers should never escape to the Lisp level, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 functions should not be doing this. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
50 /* Alternative DATA arguments to make_opaque */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
51 #define OPAQUE_CLEAR ((CONST void *) 0)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
52 #define OPAQUE_UNINIT ((CONST void *) -1)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
53
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
54 #define OPAQUE_SIZE(op) ((op)->size)
382
064ab7fed2e0 Import from CVS: tag r21-2-6
cvs
parents: 380
diff changeset
55 #define OPAQUE_DATA(op) ((void *) ((op)->data))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
56 #define OPAQUE_MARKFUN(op) ((op)->markfun)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #define XOPAQUE_SIZE(op) OPAQUE_SIZE (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #define XOPAQUE_DATA(op) OPAQUE_DATA (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #define XOPAQUE_MARKFUN(op) OPAQUE_MARKFUN (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
61 Lisp_Object make_opaque (size_t size, CONST void *data);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
62
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
63 typedef struct Lisp_Opaque_Ptr
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
64 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
65 struct lcrecord_header header;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
66 void *ptr;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
67 } Lisp_Opaque_Ptr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
69 DECLARE_LRECORD (opaque_ptr, Lisp_Opaque_Ptr);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
70 #define XOPAQUE_PTR(x) XRECORD (x, opaque_ptr, Lisp_Opaque_Ptr)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
71 #define XSETOPAQUE_PTR(x, p) XSETRECORD (x, p, opaque_ptr)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
72 #define OPAQUE_PTRP(x) RECORDP (x, opaque_ptr)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
73
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
74 Lisp_Object make_opaque_ptr (void *val);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
75 void free_opaque_ptr (Lisp_Object ptr);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
76
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
77 #define get_opaque_ptr(op) (XOPAQUE_PTR (op)->ptr)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
78 #define set_opaque_ptr(op, ptr_) (XOPAQUE_PTR (op)->ptr = (ptr_))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
80 #endif /* _XEMACS_OPAQUE_H_ */