blob: f7acaad123eeec0bdcb8b81972f246a0ccc62380 [file] [log] [blame]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001/* Type object implementation */
2
3#include <stdio.h>
4
5#include "PROTO.h"
6#include "object.h"
7#include "stringobject.h"
8#include "objimpl.h"
9
10/* Type object implementation */
11
12static void
13typeprint(v, fp, flags)
14 typeobject *v;
15 FILE *fp;
16 int flags;
17{
18 fprintf(fp, "<type '%s'>", v->tp_name);
19}
20
21static object *
22typerepr(v)
23 typeobject *v;
24{
25 char buf[100];
26 sprintf(buf, "<type '%.80s'>", v->tp_name);
27 return newstringobject(buf);
28}
29
30typedef struct {
31 OB_HEAD
32 long ob_ival;
33} intobject;
34
35typeobject Typetype = {
36 OB_HEAD_INIT(&Typetype)
37 0, /* Number of items for varobject */
38 "type", /* Name of this type */
39 sizeof(typeobject), /* Basic object size */
40 0, /* Item size for varobject */
41 0, /*tp_dealloc*/
42 typeprint, /*tp_print*/
43 0, /*tp_getattr*/
44 0, /*tp_setattr*/
45 0, /*tp_compare*/
46 typerepr, /*tp_repr*/
47};