Added 'description' class attribute to every command class (to help the
[python/dscho.git] / Include / structmember.h
blob1dd763bd6167029996c889a9a980884106194474
1 #ifndef Py_STRUCTMEMBER_H
2 #define Py_STRUCTMEMBER_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
9 The Netherlands.
11 All Rights Reserved
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI or Corporation for National Research Initiatives or
19 CNRI not be used in advertising or publicity pertaining to
20 distribution of the software without specific, written prior
21 permission.
23 While CWI is the initial source for this software, a modified version
24 is made available by the Corporation for National Research Initiatives
25 (CNRI) at the Internet address ftp://ftp.python.org.
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34 PERFORMANCE OF THIS SOFTWARE.
36 ******************************************************************/
38 /* Interface to map C struct members to Python object attributes */
40 #ifdef HAVE_STDDEF_H
41 #include <stddef.h> /* For offsetof */
42 #endif
44 /* The offsetof() macro calculates the offset of a structure member
45 in its structure. Unfortunately this cannot be written down
46 portably, hence it is provided by a Standard C header file.
47 For pre-Standard C compilers, here is a version that usually works
48 (but watch out!): */
50 #ifndef offsetof
51 #define offsetof(type, member) ( (int) & ((type*)0) -> member )
52 #endif
54 /* An array of memberlist structures defines the name, type and offset
55 of selected members of a C structure. These can be read by
56 PyMember_Get() and set by PyMember_Set() (except if their READONLY flag
57 is set). The array must be terminated with an entry whose name
58 pointer is NULL. */
60 struct memberlist {
61 char *name;
62 int type;
63 int offset;
64 int readonly;
67 /* Types */
68 #define T_SHORT 0
69 #define T_INT 1
70 #define T_LONG 2
71 #define T_FLOAT 3
72 #define T_DOUBLE 4
73 #define T_STRING 5
74 #define T_OBJECT 6
75 /* XXX the ordering here is weird for binary compatibility */
76 #define T_CHAR 7 /* 1-character string */
77 #define T_BYTE 8 /* 8-bit signed int */
78 /* unsigned variants: */
79 #define T_UBYTE 9
80 #define T_USHORT 10
81 #define T_UINT 11
82 #define T_ULONG 12
84 /* Added by Jack: strings contained in the structure */
85 #define T_STRING_INPLACE 13
86 #ifdef macintosh
87 #define T_PSTRING 14 /* macintosh pascal-style counted string */
88 #define T_PSTRING_INPLACE 15
89 #endif /* macintosh */
91 /* Readonly flag */
92 #define READONLY 1
93 #define RO READONLY /* Shorthand */
95 DL_IMPORT(PyObject *) PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
96 DL_IMPORT(int) PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
98 #ifdef __cplusplus
100 #endif
101 #endif /* !Py_STRUCTMEMBER_H */