blob: e6f9929f3d80ba9b1d54be2f77f4d5b60c80733e [file] [log] [blame]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001/*
2123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
3
4Additional macros for modules that implement new object types.
5You must first include "object.h".
6
7NEWOBJ(type, typeobj) allocates memory for a new object of the given
8type; here 'type' must be the C structure type used to represent the
9object and 'typeobj' the address of the corresponding type object.
10Reference count and type pointer are filled in; the rest of the bytes of
11the object are *undefined*! The resulting expression type is 'type *'.
12The size of the object is actually determined by the tp_basicsize field
13of the type object.
14
15NEWVAROBJ(type, typeobj, n) is similar but allocates a variable-size
16object with n extra items. The size is computer as tp_basicsize plus
17n * tp_itemsize. This fills in the ob_size field as well.
18*/
19
20extern object *newobject PROTO((typeobject *));
21extern varobject *newvarobject PROTO((typeobject *, unsigned int));
22
23#define NEWOBJ(type, typeobj) ((type *) newobject(typeobj))
24#define NEWVAROBJ(type, typeobj, n) ((type *) newvarobject(typeobj, n))
25
26extern int StopPrint; /* Set when printing is interrupted */
27
28/* Malloc interface */
29#include "malloc.h"
30
Guido van Rossum4ab9b4c1990-10-21 22:13:08 +000031extern char *strdup PROTO((const char *));