File tree Expand file tree Collapse file tree 1 file changed +13
-38
lines changed Expand file tree Collapse file tree 1 file changed +13
-38
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#include "PROTO.h"
6
6
#include "object.h"
7
- #include "node.h"
8
- #include "stringobject.h"
9
7
#include "funcobject.h"
10
8
#include "objimpl.h"
11
- #include "token.h"
12
9
13
10
typedef struct {
14
11
OB_HEAD
15
- node * func_node ;
12
+ object * func_code ;
16
13
object * func_globals ;
17
14
} funcobject ;
18
15
19
16
object *
20
- newfuncobject (n , globals )
21
- node * n ;
17
+ newfuncobject (code , globals )
18
+ object * code ;
22
19
object * globals ;
23
20
{
24
21
funcobject * op = NEWOBJ (funcobject , & Functype );
25
22
if (op != NULL ) {
26
- op -> func_node = n ;
27
- if ( globals != NULL )
28
- INCREF (globals );
23
+ INCREF ( code ) ;
24
+ op -> func_code = code ;
25
+ INCREF (globals );
29
26
op -> func_globals = globals ;
30
27
}
31
28
return (object * )op ;
32
29
}
33
30
34
- node *
35
- getfuncnode (op )
31
+ object *
32
+ getfunccode (op )
36
33
object * op ;
37
34
{
38
35
if (!is_funcobject (op )) {
39
36
err_badcall ();
40
37
return NULL ;
41
38
}
42
- return ((funcobject * ) op ) -> func_node ;
39
+ return ((funcobject * ) op ) -> func_code ;
43
40
}
44
41
45
42
object *
@@ -59,31 +56,9 @@ static void
59
56
funcdealloc (op )
60
57
funcobject * op ;
61
58
{
62
- /* XXX free node? */
59
+ DECREF ( op -> func_code );
63
60
DECREF (op -> func_globals );
64
- free ((char * )op );
65
- }
66
-
67
- static void
68
- funcprint (op , fp , flags )
69
- funcobject * op ;
70
- FILE * fp ;
71
- int flags ;
72
- {
73
- node * n = op -> func_node ;
74
- n = CHILD (n , 1 );
75
- fprintf (fp , "<user function %s>" , STR (n ));
76
- }
77
-
78
- static object *
79
- funcrepr (op )
80
- funcobject * op ;
81
- {
82
- char buf [100 ];
83
- node * n = op -> func_node ;
84
- n = CHILD (n , 1 );
85
- sprintf (buf , "<user function %.80s>" , STR (n ));
86
- return newstringobject (buf );
61
+ DEL (op );
87
62
}
88
63
89
64
typeobject Functype = {
@@ -93,9 +68,9 @@ typeobject Functype = {
93
68
sizeof (funcobject ),
94
69
0 ,
95
70
funcdealloc , /*tp_dealloc*/
96
- funcprint , /*tp_print*/
71
+ 0 , /*tp_print*/
97
72
0 , /*tp_getattr*/
98
73
0 , /*tp_setattr*/
99
74
0 , /*tp_compare*/
100
- funcrepr , /*tp_repr*/
75
+ 0 , /*tp_repr*/
101
76
};
You can’t perform that action at this time.
0 commit comments