typeobject.c revision bab9d0385585fcddf6ee96a4ca38dd18e3517f54
1/***********************************************************
2Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
3Netherlands.
4
5                        All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Stichting Mathematisch
12Centrum or CWI not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior permission.
14
15STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
23******************************************************************/
24
25/* Type object implementation */
26
27#include "allobjects.h"
28
29/* Type object implementation */
30
31/* ARGSUSED */
32static int
33type_print(v, fp, flags)
34	typeobject *v;
35	FILE *fp;
36	int flags;
37{
38	fprintf(fp, "<type '%s'>", v->tp_name);
39	return 0;
40}
41
42static object *
43type_repr(v)
44	typeobject *v;
45{
46	char buf[100];
47	sprintf(buf, "<type '%.80s'>", v->tp_name);
48	return newstringobject(buf);
49}
50
51typeobject Typetype = {
52	OB_HEAD_INIT(&Typetype)
53	0,			/* Number of items for varobject */
54	"type",			/* Name of this type */
55	sizeof(typeobject),	/* Basic object size */
56	0,			/* Item size for varobject */
57	0,			/*tp_dealloc*/
58	type_print,		/*tp_print*/
59	0,			/*tp_getattr*/
60	0,			/*tp_setattr*/
61	0,			/*tp_compare*/
62	type_repr,		/*tp_repr*/
63};
64