cvsuser 04/12/27 08:21:26
Modified: . MANIFEST
config/gen/makefiles dynclasses.in
dynclasses pybuiltin.pmc pyconsts.h pyexception.pmc
pytuple.pmc pytype.pmc
src call_list.txt
Added: dynclasses pystaticmeth.pmc
Log:
Progress towards passing t/pie/b0
Revision Changes Path
1.813 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.812
retrieving revision 1.813
diff -u -r1.812 -r1.813
--- MANIFEST 24 Dec 2004 23:08:28 -0000 1.812
+++ MANIFEST 27 Dec 2004 16:21:12 -0000 1.813
@@ -383,6 +383,7 @@
dynclasses/pyproxyclass.pmc [devel]
dynclasses/pyproxytype.pmc [devel]
dynclasses/pyslice.pmc [devel]
+dynclasses/pystaticmeth.pmc [devel]
dynclasses/pystring.pmc [devel]
dynclasses/pytuple.pmc [devel]
dynclasses/pytype.pmc [devel]
1.20 +1 -0 parrot/config/gen/makefiles/dynclasses.in
Index: dynclasses.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses.in,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- dynclasses.in 24 Dec 2004 23:08:29 -0000 1.19
+++ dynclasses.in 27 Dec 2004 16:21:14 -0000 1.20
@@ -27,6 +27,7 @@
pymodule \
pynone \
pytype \
+ pystaticmeth \
pyslice \
pystring \
pytuple \
1.36 +21 -1 parrot/dynclasses/pybuiltin.pmc
Index: pybuiltin.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pybuiltin.pmc,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- pybuiltin.pmc 24 Dec 2004 23:08:30 -0000 1.35
+++ pybuiltin.pmc 27 Dec 2004 16:21:18 -0000 1.36
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pybuiltin.pmc,v 1.35 2004/12/24 23:08:30 rubys Exp $
+$Id: pybuiltin.pmc,v 1.36 2004/12/27 16:21:18 rubys Exp $
=head1 NAME
@@ -98,6 +98,7 @@
PyBuiltin_PyProxyType = Parrot_PMC_typenum(INTERP,
"PyProxyType");
PyBuiltin_PySlice = Parrot_PMC_typenum(INTERP, "PySlice");
PyBuiltin_PyString = Parrot_PMC_typenum(INTERP, "PyString");
+ PyBuiltin_PyStaticMeth = Parrot_PMC_typenum(INTERP,
"PyStaticMeth");
PyBuiltin_PyTuple = Parrot_PMC_typenum(INTERP, "PyTuple");
PyBuiltin_PyType = Parrot_PMC_typenum(INTERP, "PyType");
@@ -236,6 +237,12 @@
scratchpad_store_by_name(INTERP, pad, 0, key, item);
PyBuiltin_PyDict_class = item;
+ key = const_string(INTERP, "Exception");
+ item = make_type(INTERP, PyBuiltin_PyException, key);
+ VTABLE_setprop(INTERP, item, PyString_bases, parent);
+ scratchpad_store_by_name(INTERP, pad, 0, key, item);
+ PyBuiltin_PyException_class = item;
+
key = const_string(INTERP, "int");
item = make_type(INTERP, PyBuiltin_PyInt, key);
VTABLE_setprop(INTERP, item, PyString_bases, parent);
@@ -266,6 +273,19 @@
scratchpad_store_by_name(INTERP, pad, 0, key, item);
PyBuiltin_PyTuple_class = item;
+ key = const_string(INTERP, "type");
+ item = make_type(INTERP, PyBuiltin_PyType, key);
+ VTABLE_setprop(INTERP, item, PyString_bases, parent);
+ scratchpad_store_by_name(INTERP, pad, 0, key, item);
+ PyBuiltin_PyType_class = item;
+ item->vtable = Parrot_base_vtables[PyBuiltin_PyType];
+
+ key = const_string(INTERP, "staticmethod");
+ item = make_type(INTERP, PyBuiltin_PyStaticMeth, key);
+ VTABLE_setprop(INTERP, item, PyString_bases, parent);
+ scratchpad_store_by_name(INTERP, pad, 0, key, item);
+ PyBuiltin_PyStaticMeth_class = item;
+
key = const_string(INTERP, "xrange");
item = make_type(INTERP, PyBuiltin_PySlice, key);
VTABLE_setprop(INTERP, item, PyString_bases, parent);
1.3 +4 -0 parrot/dynclasses/pyconsts.h
Index: pyconsts.h
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pyconsts.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyconsts.h 24 Dec 2004 23:08:30 -0000 1.2
+++ pyconsts.h 27 Dec 2004 16:21:18 -0000 1.3
@@ -16,6 +16,7 @@
INTVAL PyBuiltin_PyProxyClass;
INTVAL PyBuiltin_PyProxyType;
INTVAL PyBuiltin_PySlice;
+INTVAL PyBuiltin_PyStaticMeth;
INTVAL PyBuiltin_PyString;
INTVAL PyBuiltin_PyTuple;
INTVAL PyBuiltin_PyType;
@@ -25,12 +26,15 @@
PMC *PyBuiltin_PyBoolean_class;
PMC *PyBuiltin_PyComplex_class;
PMC *PyBuiltin_PyDict_class;
+PMC *PyBuiltin_PyException_class;
PMC *PyBuiltin_PyInt_class;
PMC *PyBuiltin_PyFloat_class;
PMC *PyBuiltin_PyList_class;
PMC *PyBuiltin_PyLong_class;
PMC *PyBuiltin_PySlice_class;
+PMC *PyBuiltin_PyStaticMeth_class;
PMC *PyBuiltin_PyTuple_class;
+PMC *PyBuiltin_PyType_class;
/* constant strings */
1.3 +21 -1 parrot/dynclasses/pyexception.pmc
Index: pyexception.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pyexception.pmc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyexception.pmc 18 Dec 2004 03:51:47 -0000 1.2
+++ pyexception.pmc 27 Dec 2004 16:21:18 -0000 1.3
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pyexception.pmc,v 1.2 2004/12/18 03:51:47 rubys Exp $
+$Id: pyexception.pmc,v 1.3 2004/12/27 16:21:18 rubys Exp $
=head1 NAME
@@ -65,6 +65,26 @@
/*
+=item C<PMC* "__new__"(PMC *class, PMC *source)>
+
+Create a new integer
+
+=cut
+
+*/
+
+ METHOD PMC* __new__(PMC *class) {
+ PMC *exception = pmc_new(interpreter, enum_class_Exception);
+
+ /* set type, severity */
+ VTABLE_set_integer_keyed_int(interpreter, exception, 1, 1);
+ VTABLE_set_integer_keyed_int(interpreter, exception, 2, 2);
+
+ return exception;
+ }
+
+/*
+
=back
=cut
1.10 +17 -1 parrot/dynclasses/pytuple.pmc
Index: pytuple.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pytuple.pmc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- pytuple.pmc 23 Dec 2004 23:49:33 -0000 1.9
+++ pytuple.pmc 27 Dec 2004 16:21:18 -0000 1.10
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pytuple.pmc,v 1.9 2004/12/23 23:49:33 rubys Exp $
+$Id: pytuple.pmc,v 1.10 2004/12/27 16:21:18 rubys Exp $
=head1 NAME
@@ -349,6 +349,22 @@
/*
+=item C<void set_string_keyed_int(INTVAL key, STRING* value)>
+
+Sets the string value of the PMC at element C<key> to C<value>.
+
+=cut
+
+*/
+
+ void set_string_keyed_int (INTVAL key, STRING* value) {
+ PMC *src = pmc_new_noinit(INTERP, PyBuiltin_PyString);
+ VTABLE_set_string_native(INTERP, src, value);
+ DYNSELF.set_pmc_keyed_int(key, src);
+ }
+
+/*
+
=back
=cut
1.12 +41 -1 parrot/dynclasses/pytype.pmc
Index: pytype.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pytype.pmc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pytype.pmc 23 Dec 2004 23:49:33 -0000 1.11
+++ pytype.pmc 27 Dec 2004 16:21:18 -0000 1.12
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pytype.pmc,v 1.11 2004/12/23 23:49:33 rubys Exp $
+$Id: pytype.pmc,v 1.12 2004/12/27 16:21:18 rubys Exp $
=head1 NAME
@@ -104,6 +104,20 @@
/*
+=item C<PMC *get_class()>
+
+Return the class of this object.
+
+=cut
+
+*/
+
+ PMC* get_class() {
+ return PyBuiltin_PyType_class;
+ }
+
+/*
+
=item C<void* invoke(void* next)>
Pythonic object constructor.
@@ -194,6 +208,32 @@
/*
+=item C<PMC* "__new__"(PMC *class, PMC *source)>
+
+Create a new integer
+
+=cut
+
+*/
+
+ METHOD PMC* __new__(PMC *instance, PMC *metaclass, PMC *name, PMC
*bases, PMC *dict)
+ {
+ INTVAL argc = REG_INT(3);
+ if (argc == 1)
+ return VTABLE_get_class(INTERP, instance);
+ else {
+ /* XXX: quick hack: class method called directly */
+ /* TODO: multiple bases */
+ /* TODO: vars */
+ PMC *base = VTABLE_get_pmc_keyed_int(INTERP, bases, 0);
+ PMC *type = VTABLE_subclass(INTERP, base,
+ VTABLE_get_string(INTERP, name));
+ return type;
+ }
+ }
+
+/*
+
=back
=cut
1.1 parrot/dynclasses/pystaticmeth.pmc
Index: pystaticmeth.pmc
===================================================================
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
$Id: pystaticmeth.pmc,v 1.1 2004/12/27 16:21:18 rubys Exp $
=head1 NAME
classes/nci.pmc - Python Native Call Interface Functions
=head1 DESCRIPTION
Extends Parrot's NCI to include attributes, implemented as properties.
=head2 Methods
=over 4
=cut
*/
#include "parrot/parrot.h"
#include "pyconsts.h"
pmclass PyStaticMeth extends PyFunc dynpmc group python_group {
/*
=item C<PMC* "__new__"(PMC *class, PMC *source)>
Create a new static method
=cut
*/
METHOD PMC* __new__(PMC *class, PMC *source) {
INTVAL argc = REG_INT(3);
if (argc > 1)
return source;
else
return pmc_new(INTERP, PyBuiltin_PyStaticMeth);
}
}
/*
=back
=head1 SEE ALSO
F<docs/pdds/pdd03_calling_conventions.pod>.
=head1 HISTORY
Initial revision by sean 2002/08/04.
=cut
*/
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
1.52 +1 -0 parrot/src/call_list.txt
Index: call_list.txt
===================================================================
RCS file: /cvs/public/parrot/src/call_list.txt,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- call_list.txt 24 Dec 2004 23:08:32 -0000 1.51
+++ call_list.txt 27 Dec 2004 16:21:21 -0000 1.52
@@ -252,6 +252,7 @@
P IOPPP
v IOPP
P IOPPPP
+P IOPPPPP
# Parrot builtins
d IOd