mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Initial revision
This commit is contained in:
parent
c636014c43
commit
85a5fbbdfe
78 changed files with 13589 additions and 0 deletions
47
Objects/typeobject.c
Normal file
47
Objects/typeobject.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* Type object implementation */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "PROTO.h"
|
||||
#include "object.h"
|
||||
#include "stringobject.h"
|
||||
#include "objimpl.h"
|
||||
|
||||
/* Type object implementation */
|
||||
|
||||
static void
|
||||
typeprint(v, fp, flags)
|
||||
typeobject *v;
|
||||
FILE *fp;
|
||||
int flags;
|
||||
{
|
||||
fprintf(fp, "<type '%s'>", v->tp_name);
|
||||
}
|
||||
|
||||
static object *
|
||||
typerepr(v)
|
||||
typeobject *v;
|
||||
{
|
||||
char buf[100];
|
||||
sprintf(buf, "<type '%.80s'>", v->tp_name);
|
||||
return newstringobject(buf);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
OB_HEAD
|
||||
long ob_ival;
|
||||
} intobject;
|
||||
|
||||
typeobject Typetype = {
|
||||
OB_HEAD_INIT(&Typetype)
|
||||
0, /* Number of items for varobject */
|
||||
"type", /* Name of this type */
|
||||
sizeof(typeobject), /* Basic object size */
|
||||
0, /* Item size for varobject */
|
||||
0, /*tp_dealloc*/
|
||||
typeprint, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
0, /*tp_compare*/
|
||||
typerepr, /*tp_repr*/
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue