annotate src/opaque.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 064ab7fed2e0
children 697ef44129c6
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
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
26 #ifndef INCLUDED_opaque_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
27 #define INCLUDED_opaque_h_
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
29 typedef union
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
30 {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
31 struct { Lisp_Object obj; } obj;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
32 struct { void *p; } p;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
33 struct { double d; } d;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
34 } max_align_t;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
35
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
36 typedef struct Lisp_Opaque
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 struct lcrecord_header header;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
39 size_t size;
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
40 max_align_t data[1];
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
41 } Lisp_Opaque;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
43 DECLARE_LRECORD (opaque, Lisp_Opaque);
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
44 #define XOPAQUE(x) XRECORD (x, opaque, Lisp_Opaque)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #define XSETOPAQUE(x, p) XSETRECORD (x, p, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #define OPAQUEP(x) RECORDP (x, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* #define CHECK_OPAQUE(x) CHECK_RECORD (x, opaque)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 Opaque pointers should never escape to the Lisp level, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 functions should not be doing this. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
51 /* Alternative DATA arguments to make_opaque() */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
52 #define OPAQUE_CLEAR ((const void *) 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
53 #define OPAQUE_UNINIT ((const void *) -1)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
55 #define OPAQUE_SIZE(op) ((op)->size)
382
064ab7fed2e0 Import from CVS: tag r21-2-6
cvs
parents: 380
diff changeset
56 #define OPAQUE_DATA(op) ((void *) ((op)->data))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 0
diff changeset
57 #define OPAQUE_MARKFUN(op) ((op)->markfun)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #define XOPAQUE_SIZE(op) OPAQUE_SIZE (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #define XOPAQUE_DATA(op) OPAQUE_DATA (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 #define XOPAQUE_MARKFUN(op) OPAQUE_MARKFUN (XOPAQUE (op))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
62 Lisp_Object make_opaque (const void *data, size_t size);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
63
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
64 typedef struct Lisp_Opaque_Ptr
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
65 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
66 struct lcrecord_header header;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
67 void *ptr;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
68 } Lisp_Opaque_Ptr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
70 DECLARE_LRECORD (opaque_ptr, Lisp_Opaque_Ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
71 #define XOPAQUE_PTR(x) XRECORD (x, opaque_ptr, Lisp_Opaque_Ptr)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
72 #define XSETOPAQUE_PTR(x, p) XSETRECORD (x, p, opaque_ptr)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
73 #define OPAQUE_PTRP(x) RECORDP (x, opaque_ptr)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
75 Lisp_Object make_opaque_ptr (void *val);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
76 void free_opaque_ptr (Lisp_Object ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
77
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
78 #define get_opaque_ptr(op) (XOPAQUE_PTR (op)->ptr)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
79 #define set_opaque_ptr(op, ptr_) (XOPAQUE_PTR (op)->ptr = (ptr_))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
80
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 382
diff changeset
81 #endif /* INCLUDED_opaque_h_ */