cvsuser 05/04/05 07:07:38
Modified: . MANIFEST
include/parrot interpreter.h parrot.h
src global.c hash.c inter_create.c mmd.c objects.c
classes array.pmc boolean.pmc complex.pmc fixedpmcarray.pmc
hash.pmc intlist.pmc perlnum.pmc perlstring.pmc
resizablepmcarray.pmc string.pmc
config/gen/makefiles root.in
dynclasses pybuiltin.pmc pyconsts.h
imcc main.c
Removed: include/parrot py_func.h
src py_func.c
Log:
Piethon cleanup
* removed most trails of last summers Piethon hacks
* moved Parrot_py_make_slice to dynclasses/pybuiltin.pmc
Approved by Sam Ruby.
Revision Changes Path
1.861 +0 -2 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.860
retrieving revision 1.861
diff -u -r1.860 -r1.861
--- MANIFEST 4 Apr 2005 22:19:18 -0000 1.860
+++ MANIFEST 5 Apr 2005 14:07:31 -0000 1.861
@@ -1927,7 +1927,6 @@
include/parrot/pmc.h [devel]include
include/parrot/pmc_freeze.h [devel]include
include/parrot/pobj.h [devel]include
-include/parrot/py_func.h [devel]include
include/parrot/regfuncs.h [devel]include
include/parrot/register.h [devel]include
include/parrot/resources.h [devel]include
@@ -2803,7 +2802,6 @@
src/pic.c []
src/pmc.c []
src/pmc_freeze.c []
-src/py_func.c []
src/register.c []
src/res_lea.c []
src/resources.c []
1.171 +2 -3 parrot/include/parrot/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -r1.170 -r1.171
--- interpreter.h 14 Mar 2005 14:45:38 -0000 1.170
+++ interpreter.h 5 Apr 2005 14:07:32 -0000 1.171
@@ -35,9 +35,8 @@
PARROT_THR_TYPE_1 = PARROT_IS_THREAD,
PARROT_THR_TYPE_2 = PARROT_IS_THREAD | PARROT_THR_COPY_INTERP,
PARROT_THR_TYPE_3 = PARROT_IS_THREAD | PARROT_THR_COPY_INTERP |
- PARROT_THR_THREAD_POOL,
+ PARROT_THR_THREAD_POOL
- PARROT_PYTHON_MODE = 0x10000 /* more pythonic behavior */
} Parrot_Interp_flag;
/* &end_gen */
1.105 +1 -2 parrot/include/parrot/parrot.h
Index: parrot.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- parrot.h 25 Mar 2005 21:36:47 -0000 1.104
+++ parrot.h 5 Apr 2005 14:07:32 -0000 1.105
@@ -277,7 +277,6 @@
#include "parrot/global.h"
#include "parrot/stat.h"
#include "parrot/slice.h"
-#include "parrot/py_func.h"
#endif /* PARROT_PARROT_H_GUARD */
1.19 +1 -5 parrot/src/global.c
Index: global.c
===================================================================
RCS file: /cvs/public/parrot/src/global.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- global.c 4 Apr 2005 14:02:22 -0000 1.18
+++ global.c 5 Apr 2005 14:07:33 -0000 1.19
@@ -158,8 +158,6 @@
return g;
if (PARROT_ERRORS_test(interpreter, PARROT_ERRORS_GLOBALS_FLAG)) {
real_exception(interpreter, next, E_NameError,
- Interp_flags_TEST(interpreter, PARROT_PYTHON_MODE) ?
- "global name '%Ss' is not defined" :
"Global '%Ss' not found",
name);
}
@@ -174,8 +172,6 @@
return g;
if (PARROT_ERRORS_test(interpreter, PARROT_ERRORS_GLOBALS_FLAG)) {
real_exception(interpreter, NULL, E_NameError,
- Interp_flags_TEST(interpreter, PARROT_PYTHON_MODE) ?
- "global name '%Ss' is not defined" :
"Global '%Ss' not found",
name);
}
1.90 +6 -5 parrot/src/hash.c
Index: hash.c
===================================================================
RCS file: /cvs/public/parrot/src/hash.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- hash.c 28 Mar 2005 21:02:43 -0000 1.89
+++ hash.c 5 Apr 2005 14:07:33 -0000 1.90
@@ -667,10 +667,11 @@
hash->entry_type = val_type;
hash->key_type = hkey_type;
hash->value_size = val_size; /* extra size */
- if (Interp_flags_TEST(interpreter, PARROT_PYTHON_MODE))
- hash->seed = 3793;
- else
- hash->seed = (size_t) Parrot_uint_rand(0);
+ /*
+ * FIXME xoring the seed doesn't prevent DOS attacks
+ * TODO randomize
+ */
+ hash->seed = 3793;
/* PObj_report_SET(&hash->buffer); */
1.31 +1 -3 parrot/src/inter_create.c
Index: inter_create.c
===================================================================
RCS file: /cvs/public/parrot/src/inter_create.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- inter_create.c 25 Mar 2005 10:19:58 -0000 1.30
+++ inter_create.c 5 Apr 2005 14:07:33 -0000 1.31
@@ -310,8 +310,6 @@
*/
if (!interpreter->parent_interpreter) {
pt_join_threads(interpreter);
- if (Interp_flags_TEST(interpreter, PARROT_PYTHON_MODE))
- Parrot_py_exit(interpreter);
}
/* if something needs destruction (e.g. closing PIOs)
* we must destroy it now:
1.65 +22 -11 parrot/src/mmd.c
Index: mmd.c
===================================================================
RCS file: /cvs/public/parrot/src/mmd.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- mmd.c 5 Apr 2005 11:36:48 -0000 1.64
+++ mmd.c 5 Apr 2005 14:07:33 -0000 1.65
@@ -44,6 +44,9 @@
#include "mmd.str"
#include <assert.h>
+static void mmd_create_builtin_multi_meth_2(Interp *,
+ INTVAL func_nr, INTVAL type, INTVAL right, funcptr_t func_ptr);
+
typedef void (*mmd_f_v_ppp)(Interp *, PMC *, PMC *, PMC *);
typedef void (*mmd_f_v_pip)(Interp *, PMC *, INTVAL, PMC *);
typedef void (*mmd_f_v_pnp)(Interp *, PMC *, FLOATVAL, PMC *);
@@ -596,12 +599,15 @@
void
mmd_register_sub(Interp *interpreter,
- INTVAL type,
+ INTVAL func_nr,
INTVAL left_type, INTVAL right_type,
PMC *sub)
{
PMC *fake = (PMC*)((UINTVAL) sub | 1);
- mmd_register(interpreter, type, left_type, right_type, D2FPTR(fake));
+ mmd_register(interpreter, func_nr, left_type, right_type, D2FPTR(fake));
+
+ mmd_create_builtin_multi_meth_2(interpreter,
+ func_nr, left_type, right_type, D2FPTR(sub));
}
/*
@@ -1420,8 +1426,8 @@
}
static void
-mmd_create_builtin_multi_meth(Interp *interpreter, INTVAL type,
- const MMD_init *entry)
+mmd_create_builtin_multi_meth_2(Interp *interpreter,
+ INTVAL func_nr, INTVAL type, INTVAL right, funcptr_t func_ptr)
{
const char *name, *short_name;
char signature[6], val_sig;
@@ -1429,8 +1435,6 @@
int len;
char *p;
PMC *method, *multi, *class, *multi_sig;
- INTVAL func_nr;
-
if (type == enum_class_Null || type == enum_class_delegate ||
type == enum_class_Ref || type == enum_class_SharedRef ||
@@ -1438,7 +1442,6 @@
type == enum_class_ParrotObject) {
return;
}
- func_nr = entry->func_nr;
name = short_name = Parrot_MMD_methode_name(interpreter, func_nr);
/*
* _int, _float, _str are just native variants of the base
@@ -1483,7 +1486,7 @@
method = constant_pmc_new(interpreter, enum_class_NCI);
VTABLE_set_pointer_keyed_str(interpreter, method,
const_string(interpreter, signature),
- F2DPTR(entry->func_ptr));
+ F2DPTR(func_ptr));
VTABLE_add_method(interpreter, class, meth_name, method);
}
else {
@@ -1501,7 +1504,7 @@
method = constant_pmc_new(interpreter, enum_class_NCI);
VTABLE_set_pointer_keyed_str(interpreter, method,
const_string(interpreter, signature),
- F2DPTR(entry->func_ptr));
+ F2DPTR(func_ptr));
VTABLE_push_pmc(interpreter, multi, method);
}
/* mark MMD */
@@ -1512,7 +1515,7 @@
multi_sig = constant_pmc_new(interpreter, enum_class_FixedIntegerArray);
VTABLE_set_integer_native(interpreter, multi_sig, 2);
VTABLE_set_integer_keyed_int(interpreter, multi_sig, 0, type);
- VTABLE_set_integer_keyed_int(interpreter, multi_sig, 1, entry->right);
+ VTABLE_set_integer_keyed_int(interpreter, multi_sig, 1, right);
PMC_pmc_val(method) = multi_sig;
/*
@@ -1527,6 +1530,14 @@
}
+static void
+mmd_create_builtin_multi_meth(Interp *interpreter, INTVAL type,
+ const MMD_init *entry)
+{
+ mmd_create_builtin_multi_meth_2(interpreter,
+ entry->func_nr, type, entry->right, entry->func_ptr);
+}
+
/*
=item C<void Parrot_mmd_register_table(Interp*, INTVAL type,
1.140 +63 -159 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- objects.c 4 Apr 2005 14:02:22 -0000 1.139
+++ objects.c 5 Apr 2005 14:07:33 -0000 1.140
@@ -24,13 +24,14 @@
#include "objects.str"
-static void* instantiate_py_object(Interp*, PMC*, void*);
-extern void parrot_py_set_vtable(Parrot_Interp interpreter, PMC* class);
static void parrot_class_register(Interp * , STRING *class_name,
PMC *new_class, PMC *parent, PMC *mro);
+/*
+ * FIXME make array clone shallow
+ */
static PMC *
-clone_array(Parrot_Interp interpreter, PMC *source_array)
+clone_array(Interp* interpreter, PMC *source_array)
{
PMC *new_array;
INTVAL count;
@@ -55,7 +56,7 @@
it. Horribly destructive, and definitely not a good thing to do if
there are instantiated objects for the class */
static void
-rebuild_attrib_stuff(Parrot_Interp interpreter, PMC *class)
+rebuild_attrib_stuff(Interp* interpreter, PMC *class)
{
INTVAL cur_offset = POD_FIRST_ATTRIB;
SLOTTYPE *class_slots;
@@ -262,7 +263,7 @@
/*
=item C<PMC *
-Parrot_single_subclass(Parrot_Interp ointerpreter, PMC *base_class,
+Parrot_single_subclass(Interp* ointerpreter, PMC *base_class,
STRING *child_class_name)>
Subclass a class. Single parent class, nice and straightforward. If
@@ -275,7 +276,7 @@
*/
PMC *
-Parrot_single_subclass(Parrot_Interp interpreter, PMC *base_class,
+Parrot_single_subclass(Interp* interpreter, PMC *base_class,
STRING *child_class_name)
{
PMC *child_class;
@@ -283,32 +284,12 @@
PMC *classname_pmc;
PMC *parents, *temp_pmc, *mro;
int parent_is_class;
- int is_python = 0;
-
- if (base_class->vtable->base_type == enum_class_FixedPMCArray) {
- PMC *tuple = base_class;
- /* got a tuple holding parents - Python!
- */
- INTVAL n = VTABLE_elements(interpreter, tuple);
- is_python = 1;
- if (!n) {
- PMC* class = pmc_new(interpreter, enum_class_ParrotClass);
- Parrot_new_class(interpreter, class, child_class_name);
- parrot_py_set_vtable(interpreter, class);
- return class;
- }
- if (n > 1)
- internal_exception(1, "subclass: unimp multiple parents");
- base_class = VTABLE_get_pmc_keyed_int(interpreter, tuple, 0);
- }
/*
* ParrotClass is the baseclass anyway, so build just a new class
*/
if (base_class == Parrot_base_vtables[enum_class_ParrotClass]->class) {
PMC* class = pmc_new(interpreter, enum_class_ParrotClass);
Parrot_new_class(interpreter, class, child_class_name);
- if (is_python)
- parrot_py_set_vtable(interpreter, class);
return class;
}
parent_is_class = PObj_is_class_TEST(base_class);
@@ -321,7 +302,7 @@
/* We will have five entries in this array */
/* We have the same number of attributes as our parent */
- ATTRIB_COUNT(child_class) = ATTRIB_COUNT(base_class);
+ ATTRIB_COUNT(child_class) = parent_is_class ? ATTRIB_COUNT(base_class) :
0;
/* Our parent class array has a single member in it */
parents = pmc_new(interpreter, enum_class_Array);
@@ -372,15 +353,13 @@
*/
create_deleg_pmc_vtable(interpreter, child_class, child_class_name);
}
- if (is_python)
- parrot_py_set_vtable(interpreter, child_class);
return child_class;
}
/*
=item C<void
-Parrot_new_class(Parrot_Interp interpreter, PMC *class, STRING *class_name)>
+Parrot_new_class(Interp* interpreter, PMC *class, STRING *class_name)>
Creates a new class, named C<class_name>.
@@ -389,7 +368,7 @@
*/
void
-Parrot_new_class(Parrot_Interp interpreter, PMC *class, STRING *class_name)
+Parrot_new_class(Interp* interpreter, PMC *class, STRING *class_name)
{
SLOTTYPE *class_array;
PMC *classname_pmc, *mro;
@@ -431,7 +410,7 @@
/*
=item C<PMC *
-Parrot_class_lookup(Parrot_Interp interpreter, STRING *class_name)>
+Parrot_class_lookup(Interp* interpreter, STRING *class_name)>
Looks for the class named C<class_name> and returns it if it exists.
Otherwise it returns C<PMCNULL>.
@@ -441,7 +420,7 @@
*/
PMC *
-Parrot_class_lookup(Parrot_Interp interpreter, STRING *class_name)
+Parrot_class_lookup(Interp* interpreter, STRING *class_name)
{
HashBucket *b;
b = hash_get_bucket(interpreter,
@@ -464,7 +443,7 @@
/*
=item C<static void
-parrot_class_register(Parrot_Interp interpreter, STRING *class_name,
+parrot_class_register(Interp* interpreter, STRING *class_name,
PMC *new_class, PMC *mro)>
This is the way to register a new Parrot class as an instantiatable
@@ -478,7 +457,7 @@
*/
static void
-parrot_class_register(Parrot_Interp interpreter, STRING *class_name,
+parrot_class_register(Interp* interpreter, STRING *class_name,
PMC *new_class, PMC *parent, PMC *mro)
{
INTVAL new_type;
@@ -515,7 +494,6 @@
/* Reset the init method to our instantiation method */
new_vtable->init = Parrot_instantiate_object;
new_vtable->init_pmc = Parrot_instantiate_object_init;
- new_vtable->invoke = instantiate_py_object;
new_class->vtable = new_vtable;
/* Put our new vtable in the global table */
@@ -542,7 +520,7 @@
}
static PMC*
-get_init_meth(Parrot_Interp interpreter, PMC *class,
+get_init_meth(Interp* interpreter, PMC *class,
STRING *prop_str , STRING **meth_str)
{
STRING *meth;
@@ -571,42 +549,7 @@
static void
-do_py_initcall(Parrot_Interp interpreter, PMC* class, PMC *object)
-{
- SLOTTYPE *class_data = PMC_data(class);
- PMC *classsearch_array = class->vtable->mro;
- PMC *parent_class;
- INTVAL nparents;
- STRING *meth_str;
- PMC *meth;
- PMC *arg = REG_PMC(5);
-
- nparents = VTABLE_elements(interpreter, classsearch_array);
- if (nparents >= 1) {
- parent_class = VTABLE_get_pmc_keyed_int(interpreter,
- classsearch_array, 1);
- /* if it's a PMC, we put one PMC of that type into
- * the attribute slot #0.
- */
- if (!PObj_is_class_TEST(parent_class)) {
- PMC *attr;
- SLOTTYPE *obj_data = PMC_data(object);
- if (parent_class->vtable->base_type != enum_class_ParrotClass)
- VTABLE_invoke(interpreter, parent_class, NULL);
- attr = REG_PMC(5);
- set_attrib_num(object, obj_data, POD_FIRST_ATTRIB, attr);
- }
- }
- meth_str = CONST_STRING(interpreter, "__init__");
- meth = Parrot_find_method_with_cache(interpreter, class, meth_str);
- if (meth) {
- /* this passes arguments according to pdd03 */
- Parrot_run_meth_fromc(interpreter, meth, object, meth_str);
- }
-}
-
-static void
-do_initcall(Parrot_Interp interpreter, PMC* class, PMC *object, PMC *init)
+do_initcall(Interp* interpreter, PMC* class, PMC *object, PMC *init)
{
PMC *classsearch_array = class->vtable->mro;
PMC *parent_class;
@@ -695,7 +638,7 @@
/*
=item C<void
-Parrot_instantiate_object(Parrot_Interp interpreter, PMC *object, PMC *init)>
+Parrot_instantiate_object(Interp* interpreter, PMC *object, PMC *init)>
Creates a Parrot object. Takes a passed-in class PMC that has sufficient
information to describe the layout of the object and, well, makes the
@@ -705,54 +648,23 @@
*/
-static void instantiate_object(Parrot_Interp, PMC *object, PMC *init, int);
+static void instantiate_object(Interp*, PMC *object, PMC *init);
void
-Parrot_instantiate_object_init(Parrot_Interp interpreter,
+Parrot_instantiate_object_init(Interp* interpreter,
PMC *object, PMC *init)
{
- instantiate_object(interpreter, object, init, 0);
+ instantiate_object(interpreter, object, init);
}
void
-Parrot_instantiate_object(Parrot_Interp interpreter, PMC *object)
+Parrot_instantiate_object(Interp* interpreter, PMC *object)
{
- instantiate_object(interpreter, object, NULL, 0);
-}
-
-void Parrot_instantiate_py_object(Parrot_Interp, PMC *object);
-void
-Parrot_instantiate_py_object(Parrot_Interp interpreter, PMC *object)
-{
- instantiate_object(interpreter, object, NULL, 1);
-}
-static void*
-instantiate_py_object(Interp* interpreter, PMC* class, void* next)
-{
- INTVAL type = class->vtable->base_type;
- PMC *object = NULL;
- if (PObj_is_class_TEST(class)) {
- /* __new__ is a type constructor, it takes a class and
- * arguments and returns a new object
- */
- STRING *meth_str = CONST_STRING(interpreter, "__new__");
- PMC *meth = Parrot_find_method_with_cache(interpreter, class,
meth_str);
- if (meth) {
- object = Parrot_run_meth_fromc(interpreter,
- meth, class, meth_str);
- }
- }
- if (!object) {
- object = pmc_new_noinit(interpreter, type);
- instantiate_object(interpreter, object, NULL, 1);
- }
- REG_PMC(5) = object;
- return next;
+ instantiate_object(interpreter, object, NULL);
}
static void
-instantiate_object(Parrot_Interp interpreter, PMC *object,
- PMC *init, int is_python)
+instantiate_object(Interp* interpreter, PMC *object, PMC *init)
{
SLOTTYPE *new_object_array;
INTVAL attrib_count, i;
@@ -799,21 +711,13 @@
/* We really ought to call the class init routines here...
* this assumes that an object isa delegate
*/
- if (is_python) {
- /*
- * we are coming from Python
- */
- do_py_initcall(interpreter, class, object);
-
- }
- else
- do_initcall(interpreter, class, object, init);
+ do_initcall(interpreter, class, object, init);
}
/*
=item C<PMC *
-Parrot_add_parent(Parrot_Interp interpreter, PMC *new_base_class,
+Parrot_add_parent(Interp* interpreter, PMC *new_base_class,
PMC *existing_class)>
Add the parent class to the current class' parent list. This also
@@ -825,7 +729,7 @@
*/
PMC *
-Parrot_add_parent(Parrot_Interp interpreter, PMC *current_class_obj,
+Parrot_add_parent(Interp* interpreter, PMC *current_class_obj,
PMC *add_on_class_obj)
{
SLOTTYPE *current_class;
@@ -937,7 +841,7 @@
/*
=item C<PMC *
-Parrot_remove_parent(Parrot_Interp interpreter, PMC *removed_class,
+Parrot_remove_parent(Interp* interpreter, PMC *removed_class,
PMC *existing_class)>
This currently does nothing but return C<NULL>.
@@ -947,7 +851,7 @@
*/
PMC *
-Parrot_remove_parent(Parrot_Interp interpreter, PMC *removed_class,
+Parrot_remove_parent(Interp* interpreter, PMC *removed_class,
PMC *existing_class) {
return NULL;
}
@@ -955,7 +859,7 @@
/*
=item C<PMC *
-Parrot_multi_subclass(Parrot_Interp interpreter, PMC *base_class_array,
+Parrot_multi_subclass(Interp* interpreter, PMC *base_class_array,
STRING *child_class_name)>
This currently does nothing but return C<NULL>.
@@ -965,7 +869,7 @@
*/
PMC *
-Parrot_multi_subclass(Parrot_Interp interpreter, PMC *base_class_array,
+Parrot_multi_subclass(Interp* interpreter, PMC *base_class_array,
STRING *child_class_name) {
return NULL;
}
@@ -973,7 +877,7 @@
/*
=item C<INTVAL
-Parrot_object_isa(Parrot_Interp interpreter, PMC *pmc, PMC *cl)>
+Parrot_object_isa(Interp* interpreter, PMC *pmc, PMC *cl)>
Return whether the object C<pmc> is an instance of class C<cl>.
@@ -982,7 +886,7 @@
*/
INTVAL
-Parrot_object_isa(Parrot_Interp interpreter, PMC *pmc, PMC *cl)
+Parrot_object_isa(Interp* interpreter, PMC *pmc, PMC *cl)
{
PMC *mro;
INTVAL i, classcount;
@@ -1003,7 +907,7 @@
/*
=item C<PMC *
-Parrot_new_method_cache(Parrot_Interp interpreter)>
+Parrot_new_method_cache(Interp* interpreter)>
This should create and return a new method cache PMC.
@@ -1014,14 +918,14 @@
*/
PMC *
-Parrot_new_method_cache(Parrot_Interp interpreter) {
+Parrot_new_method_cache(Interp* interpreter) {
return NULL;
}
/*
=item C<PMC *
-Parrot_find_method_with_cache(Parrot_Interp interpreter, PMC *class,
+Parrot_find_method_with_cache(Interp* interpreter, PMC *class,
STRING *method_name)>
Find a method PMC for a named method, given the class PMC, current
@@ -1041,10 +945,10 @@
*/
-static PMC* find_method_direct(Parrot_Interp, PMC *, STRING*);
+static PMC* find_method_direct(Interp*, PMC *, STRING*);
void
-mark_object_cache(Parrot_Interp interpreter)
+mark_object_cache(Interp* interpreter)
{
/* mark register frame cache */
Stack_Chunk_t *chunk = interpreter->caches->frame_cache;
@@ -1057,7 +961,7 @@
}
void
-init_object_cache(Parrot_Interp interpreter)
+init_object_cache(Interp* interpreter)
{
Caches *mc;
@@ -1131,7 +1035,7 @@
* If this hash is implemented mark it during DOD
*/
PMC *
-Parrot_find_method_with_cache(Parrot_Interp interpreter, PMC *class,
+Parrot_find_method_with_cache(Interp* interpreter, PMC *class,
STRING *method_name)
{
@@ -1239,7 +1143,7 @@
#endif
static PMC *
-find_method_direct_1(Parrot_Interp interpreter, PMC *class,
+find_method_direct_1(Interp* interpreter, PMC *class,
STRING *method_name)
{
PMC* method, *mro;
@@ -1273,7 +1177,7 @@
}
static PMC *
-find_method_direct(Parrot_Interp interpreter, PMC *class,
+find_method_direct(Interp* interpreter, PMC *class,
STRING *method_name)
{
PMC *found = find_method_direct_1(interpreter, class, method_name);
@@ -1289,7 +1193,7 @@
/*
=item C<void
-Parrot_note_method_offset(Parrot_Interp interpreter, UINTVAL offset, PMC
*method)>
+Parrot_note_method_offset(Interp* interpreter, UINTVAL offset, PMC *method)>
Notes where in the hierarchy we just found a method. Used so that we
can do a next and continue the search through the hierarchy for the
@@ -1297,7 +1201,7 @@
*/
void
-Parrot_note_method_offset(Parrot_Interp interpreter, UINTVAL offset, PMC
*method)
+Parrot_note_method_offset(Interp* interpreter, UINTVAL offset, PMC *method)
{
interpreter->ctx.current_class_offset = offset;
}
@@ -1305,7 +1209,7 @@
/*
=item C<INTVAL
-Parrot_add_attribute(Parrot_Interp interpreter, PMC* class, STRING* attr)>
+Parrot_add_attribute(Interp* interpreter, PMC* class, STRING* attr)>
Adds the attribute C<attr> to the class.
@@ -1320,7 +1224,7 @@
subclassed, but it'll do for now */
INTVAL
-Parrot_add_attribute(Parrot_Interp interpreter, PMC* class, STRING* attr)
+Parrot_add_attribute(Interp* interpreter, PMC* class, STRING* attr)
{
SLOTTYPE *class_array;
STRING *class_name;
@@ -1374,13 +1278,13 @@
/*
=item C<PMC *
-Parrot_get_attrib_by_num(Parrot_Interp interpreter, PMC *object, INTVAL
attrib)>
+Parrot_get_attrib_by_num(Interp* interpreter, PMC *object, INTVAL attrib)>
Returns attribute number C<attrib> from C<object>. Presumably the code
is asking for the correct attribute number.
=item C<PMC *
-Parrot_get_attrib_by_str(Parrot_Interp interpreter, PMC *object, STRING
*attr)>
+Parrot_get_attrib_by_str(Interp* interpreter, PMC *object, STRING *attr)>
Returns attribute with full qualified name C<attr> from C<object>.
@@ -1389,7 +1293,7 @@
*/
PMC *
-Parrot_get_attrib_by_num(Parrot_Interp interpreter, PMC *object, INTVAL
attrib)
+Parrot_get_attrib_by_num(Interp* interpreter, PMC *object, INTVAL attrib)
{
SLOTTYPE *attrib_array;
INTVAL attrib_count;
@@ -1409,7 +1313,7 @@
}
static INTVAL
-attr_str_2_num(Parrot_Interp interpreter, PMC *object, STRING *attr)
+attr_str_2_num(Interp* interpreter, PMC *object, STRING *attr)
{
PMC *class;
PMC *attr_hash;
@@ -1438,7 +1342,7 @@
}
PMC *
-Parrot_get_attrib_by_str(Parrot_Interp interpreter, PMC *object, STRING
*attr)
+Parrot_get_attrib_by_str(Interp* interpreter, PMC *object, STRING *attr)
{
return Parrot_get_attrib_by_num(interpreter, object,
POD_FIRST_ATTRIB +
@@ -1448,14 +1352,14 @@
/*
=item C<PMC *
-Parrot_set_attrib_by_num(Parrot_Interp interpreter, PMC *object,
+Parrot_set_attrib_by_num(Interp* interpreter, PMC *object,
INTVAL attrib, PMC *value)>
Set attribute number C<attrib> from C<object> to C<value>. Presumably the
code
is asking for the correct attribute number.
=item C<PMC *
-Parrot_set_attrib_by_str(Parrot_Interp interpreter, PMC *object,
+Parrot_set_attrib_by_str(Interp* interpreter, PMC *object,
STRING *attr, PMC *value)>
Sets attribute with full qualified name C<attr> from C<object> to C<value>.
@@ -1465,7 +1369,7 @@
*/
void
-Parrot_set_attrib_by_num(Parrot_Interp interpreter, PMC *object,
+Parrot_set_attrib_by_num(Interp* interpreter, PMC *object,
INTVAL attrib, PMC *value)
{
SLOTTYPE *attrib_array;
@@ -1481,7 +1385,7 @@
}
void
-Parrot_set_attrib_by_str(Parrot_Interp interpreter, PMC *object,
+Parrot_set_attrib_by_str(Interp* interpreter, PMC *object,
STRING *attr, PMC *value)
{
@@ -1492,7 +1396,7 @@
}
INTVAL
-Parrot_class_offset(Parrot_Interp interpreter, PMC *object, STRING *class) {
+Parrot_class_offset(Interp* interpreter, PMC *object, STRING *class) {
PMC *offset_hash;
PMC *class_pmc;
INTVAL offset;
@@ -1528,7 +1432,7 @@
/*
=item C<PMC *
-Parrot_find_class_constructor(Parrot_Interp interpreter, STRING *class,
INTVAL classtoken)>
+Parrot_find_class_constructor(Interp* interpreter, STRING *class, INTVAL
classtoken)>
Find and return the constructor method PMC for the named sub. The
classtoken is an identifier for the class used for fast lookup, or 0
@@ -1540,35 +1444,35 @@
*/
PMC *
-Parrot_find_class_constructor(Parrot_Interp interpreter, STRING *class,
INTVAL classtoken)
+Parrot_find_class_constructor(Interp* interpreter, STRING *class, INTVAL
classtoken)
{
return NULL;
}
PMC *
-Parrot_find_class_destructor(Parrot_Interp interpreter, STRING *class,
INTVAL classtoken)
+Parrot_find_class_destructor(Interp* interpreter, STRING *class, INTVAL
classtoken)
{
return NULL;
}
PMC *
-Parrot_find_class_fallback(Parrot_Interp interpreter, STRING *class, INTVAL
classtoken)
+Parrot_find_class_fallback(Interp* interpreter, STRING *class, INTVAL
classtoken)
{
return NULL;
}
void
-Parrot_set_class_constructor(Parrot_Interp interpreter, STRING *class,
INTVAL classtoken, STRING *method)
+Parrot_set_class_constructor(Interp* interpreter, STRING *class, INTVAL
classtoken, STRING *method)
{
}
void
-Parrot_set_class_destructor(Parrot_Interp interpreter, STRING *class, INTVAL
classtoken, STRING *method)
+Parrot_set_class_destructor(Interp* interpreter, STRING *class, INTVAL
classtoken, STRING *method)
{
}
void
-Parrot_set_class_fallback(Parrot_Interp interpreter, STRING *class, INTVAL
classtoken, STRING *method)
+Parrot_set_class_fallback(Interp* interpreter, STRING *class, INTVAL
classtoken, STRING *method)
{
}
1.94 +1 -3 parrot/classes/array.pmc
Index: array.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/array.pmc,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- array.pmc 18 Mar 2005 12:15:02 -0000 1.93
+++ array.pmc 5 Apr 2005 14:07:34 -0000 1.94
@@ -1157,8 +1157,6 @@
PMC_struct_val(iter) = key;
return iter;
}
- case 1:
- return Parrot_py_get_slice(INTERP, SELF, key);
}
internal_exception(1, "Array: Unknown slice type");
return NULL;
1.22 +4 -9 parrot/classes/boolean.pmc
Index: boolean.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/boolean.pmc,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- boolean.pmc 27 Mar 2005 12:35:21 -0000 1.21
+++ boolean.pmc 5 Apr 2005 14:07:34 -0000 1.22
@@ -10,7 +10,7 @@
This class implements a boolean value variable.
-Albeit the C<Boolean PMC> is derived from the C<Integer PMC>,
+Albeit the C<Boolean PMC> is derived from the C<Integer PMC>,
it doesn't morph to other types. Only it's value is changed.
=head2 Methods
@@ -73,18 +73,13 @@
=item C<STRING* get_string ()>
-Return "True" or "False" if python_mode is true.
+Return "1" or "0".
=cut
*/
STRING* get_string () {
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE))
- return PMC_int_val(SELF) ?
- CONST_STRING(INTERP, "True") :
- CONST_STRING(INTERP, "False");
- else
- return SUPER();
+ return SUPER();
}
1.20 +7 -20 parrot/classes/complex.pmc
Index: complex.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/complex.pmc,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- complex.pmc 2 Apr 2005 16:54:51 -0000 1.19
+++ complex.pmc 5 Apr 2005 14:07:34 -0000 1.20
@@ -366,25 +366,12 @@
STRING* get_string () {
STRING *s;
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE)) {
- if (RE(SELF) == 0) {
- s = Parrot_sprintf_c(INTERP, "%.12vgj", IM(SELF));
- }
- else if (IM(SELF) >= 0)
- s = Parrot_sprintf_c(INTERP,
- "(%.12vg+%.12vgj)", RE(SELF), IM(SELF));
- else
- s = Parrot_sprintf_c(INTERP,
- "(%.12vg-%.12vgj)", RE(SELF), -IM(SELF));
- }
- else {
- if (IM(SELF) >= 0)
- s = Parrot_sprintf_c(INTERP,
- "%vg+%vgi", RE(SELF), IM(SELF));
- else
- s = Parrot_sprintf_c(INTERP,
- "%vg-%vgi", RE(SELF), -IM(SELF));
- }
+ if (IM(SELF) >= 0)
+ s = Parrot_sprintf_c(INTERP,
+ "%vg+%vgi", RE(SELF), IM(SELF));
+ else
+ s = Parrot_sprintf_c(INTERP,
+ "%vg-%vgi", RE(SELF), -IM(SELF));
return s;
}
1.34 +26 -25 parrot/classes/fixedpmcarray.pmc
Index: fixedpmcarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedpmcarray.pmc,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- fixedpmcarray.pmc 26 Mar 2005 13:22:34 -0000 1.33
+++ fixedpmcarray.pmc 5 Apr 2005 14:07:34 -0000 1.34
@@ -226,7 +226,9 @@
Returns the number of elements in the array as a Parrot string. (??? -leo)
-For Python returns its repr.
+=item C<STRING *get_repr()>
+
+Returns a string representaion of the array contents.
TODO implement freeze/thaw and use that instead.
=cut
@@ -234,30 +236,31 @@
*/
STRING* get_string () {
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE)) {
- STRING *res, *s;
- INTVAL j, n;
- PMC *val;
-
- res = string_from_cstring(INTERP, "(", 0);
- n = VTABLE_elements(INTERP, SELF);
- for (j = 0; j < n; ++j) {
- val = SELF.get_pmc_keyed_int(j);
- res = string_append(INTERP, res,
- VTABLE_get_repr(INTERP, val), 0);
- if (n == 1)
- res = string_append(INTERP, res,
- const_string(INTERP, ","), 0);
- else if (j < n - 1)
- res = string_append(INTERP, res,
- const_string(INTERP, ", "), 0);
- }
+ return string_from_int(INTERP, DYNSELF.elements());
+ }
+
+ STRING* get_repr () {
+ STRING *res, *s;
+ INTVAL j, n;
+ PMC *val;
+
+ res = string_from_cstring(INTERP, "(", 0);
+ n = VTABLE_elements(INTERP, SELF);
+ for (j = 0; j < n; ++j) {
+ val = SELF.get_pmc_keyed_int(j);
res = string_append(INTERP, res,
- const_string(INTERP, ")"), 0);
- return res;
+ VTABLE_get_repr(INTERP, val), 0);
+ if (n == 1)
+ res = string_append(INTERP, res,
+ const_string(INTERP, ","), 0);
+ else if (j < n - 1)
+ res = string_append(INTERP, res,
+ const_string(INTERP, ", "), 0);
}
+ res = string_append(INTERP, res,
+ const_string(INTERP, ")"), 0);
+ return res;
- return string_from_int(INTERP, DYNSELF.elements());
}
/*
@@ -658,8 +661,6 @@
PMC_struct_val(iter) = key;
return iter;
}
- case 1:
- return Parrot_py_get_slice(INTERP, SELF, key);
}
internal_exception(1, "Array: Unknown slice type");
return NULL;
1.7 +42 -71 parrot/classes/hash.pmc
Index: hash.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/hash.pmc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- hash.pmc 28 Mar 2005 09:54:32 -0000 1.6
+++ hash.pmc 5 Apr 2005 14:07:34 -0000 1.7
@@ -158,36 +158,6 @@
/*
-=item C<void* invoke(void* next)>
-
-Pythonic object constructor. SELF is a Hash Class object. Return a new
-C<dict> object according to 2.1. Built-in Functions.
-
-=cut
-
-*/
- void* invoke(void* next) {
- int argcP = REG_INT(3);
- PMC *res = pmc_new(INTERP, pmc->vtable->base_type);
- PMC *arg;
- if (argcP) {
- if (argcP > 1) {
- real_exception(INTERP, NULL, E_TypeError,
- "TypeError: dict expected at most 1 arguments, got
%d",
- (int)argcP);
- }
- arg = REG_PMC(5);
- if (arg->vtable->base_type == enum_class_Hash)
- res = arg; /* a dict was passed, return it */
- else
- Parrot_py_fill_dict(INTERP, res, arg);
- }
- REG_PMC(5) = res;
- return next;
- }
-
-/*
-
=item C<void init()>
Initializes the instance. Creates a global C<Undef> if it doesn't
@@ -435,56 +405,59 @@
Returns a string representation of the hash, showing its class name and
memory address.
-For Python returns its repr.
+=item C<STRING *get_repr()>
+
+Return a representation of the hash contents.
=cut
*/
STRING* get_string () {
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE)) {
- /* TODO use freeze */
- PMC *iter = VTABLE_get_iter(INTERP, SELF);
- STRING *res, *s;
- INTVAL j, n;
-
- res = string_from_cstring(INTERP, "{", 0);
- n = VTABLE_elements(INTERP, SELF);
- for (j = 0; j < n; ++j) {
- STRING *key = VTABLE_shift_string(INTERP, iter);
- int i,all_digit = 1;
- PMC *val;
-
- for (i = 0; i < (int)key->strlen; ++i) {
- if (!isdigit(((char *)key->strstart)[i])) {
- all_digit = 0;
- break;
- }
- }
- if (all_digit) {
- res = string_append(INTERP, res, key, 0);
- }
- else {
- res = string_append(INTERP, res,
- const_string(INTERP, "'"), 0);
- res = string_append(INTERP, res, key, 0);
- res = string_append(INTERP, res,
- const_string(INTERP, "'"), 0);
+ return Parrot_sprintf_c(INTERP, "Hash[0x%x]", SELF);
+ }
+
+ STRING* get_repr () {
+ /* TODO use freeze */
+ PMC *iter = VTABLE_get_iter(INTERP, SELF);
+ STRING *res, *s;
+ INTVAL j, n;
+
+ res = string_from_cstring(INTERP, "{", 0);
+ n = VTABLE_elements(INTERP, SELF);
+ for (j = 0; j < n; ++j) {
+ STRING *key = VTABLE_shift_string(INTERP, iter);
+ int i,all_digit = 1;
+ PMC *val;
+
+ for (i = 0; i < (int)key->strlen; ++i) {
+ if (!isdigit(((char *)key->strstart)[i])) {
+ all_digit = 0;
+ break;
}
+ }
+ if (all_digit) {
+ res = string_append(INTERP, res, key, 0);
+ }
+ else {
res = string_append(INTERP, res,
- const_string(INTERP, ": "), 0);
- val = SELF.get_pmc_keyed_str(key);
- res = string_append(INTERP, res,
- VTABLE_get_string(INTERP, val), 0);
- if (j < n - 1)
+ const_string(INTERP, "'"), 0);
+ res = string_append(INTERP, res, key, 0);
res = string_append(INTERP, res,
- const_string(INTERP, ", "), 0);
+ const_string(INTERP, "'"), 0);
}
res = string_append(INTERP, res,
- const_string(INTERP, "}"), 0);
- return res;
+ const_string(INTERP, ": "), 0);
+ val = SELF.get_pmc_keyed_str(key);
+ res = string_append(INTERP, res,
+ VTABLE_get_string(INTERP, val), 0);
+ if (j < n - 1)
+ res = string_append(INTERP, res,
+ const_string(INTERP, ", "), 0);
}
- return Parrot_sprintf_c(INTERP, "Hash[0x%x]", SELF);
+ res = string_append(INTERP, res,
+ const_string(INTERP, "}"), 0);
+ return res;
}
/*
@@ -1043,8 +1016,6 @@
PMC_struct_val(iter) = key;
return iter;
}
- case 1:
- return Parrot_py_get_slice(INTERP, SELF, key);
}
internal_exception(1, "Hash: Unknown slice type");
return NULL;
1.34 +1 -3 parrot/classes/intlist.pmc
Index: intlist.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/intlist.pmc,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- intlist.pmc 18 Mar 2005 12:15:02 -0000 1.33
+++ intlist.pmc 5 Apr 2005 14:07:34 -0000 1.34
@@ -226,8 +226,6 @@
PMC_struct_val(iter) = key;
return iter;
}
- case 1:
- return Parrot_py_get_slice(INTERP, SELF, key);
}
internal_exception(1, "IntList: Unknown slice type");
return NULL;
1.68 +1 -2 parrot/classes/perlnum.pmc
Index: perlnum.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlnum.pmc,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- perlnum.pmc 12 Jan 2005 11:42:06 -0000 1.67
+++ perlnum.pmc 5 Apr 2005 14:07:34 -0000 1.68
@@ -89,7 +89,6 @@
PMC_num_val(SELF) = value;
/* don't mess around with - 0 */
if (value == vali && (vali || !Parrot_signbit(value)))
- if (!Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE))
DYNSELF.set_integer_native(vali);
}
1.95 +1 -18 parrot/classes/perlstring.pmc
Index: perlstring.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlstring.pmc,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- perlstring.pmc 12 Jan 2005 11:42:06 -0000 1.94
+++ perlstring.pmc 5 Apr 2005 14:07:34 -0000 1.95
@@ -269,21 +269,6 @@
*/
void modulus (PMC* value, PMC* dest) {
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE)) {
- PMC *ar = value;
- /*
- * SELF is formatstring, value = argument array or item
- */
- if (value->vtable->base_type != enum_class_FixedPMCArray) {
- /* not a tuple - make one */
- ar = pmc_new(INTERP, enum_class_FixedPMCArray);
- VTABLE_set_integer_native(INTERP, ar, 1);
- VTABLE_set_pmc_keyed_int( INTERP, ar, 0, value);
- }
- VTABLE_set_string_native(INTERP, dest,
- Parrot_psprintf(INTERP, PMC_str_val(SELF), ar));
- return;
- }
if (value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) %
@@ -334,8 +319,6 @@
STRING *s = PMC_str_val(SELF);
PMC *ret;
- if (key->vtable->base_type == enum_class_Slice)
- return Parrot_py_get_slice(INTERP, SELF, key);
ret = pmc_new_noinit(INTERP, enum_class_PerlString);
PMC_str_val(ret) = string_substr(INTERP, s,
key_integer(INTERP,key), 1, NULL, 0);
1.23 +10 -47 parrot/classes/resizablepmcarray.pmc
Index: resizablepmcarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/resizablepmcarray.pmc,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- resizablepmcarray.pmc 24 Mar 2005 14:08:15 -0000 1.22
+++ resizablepmcarray.pmc 5 Apr 2005 14:07:34 -0000 1.23
@@ -135,26 +135,18 @@
}
void set_pmc_keyed (PMC* key, PMC* src) {
- if (key->vtable->base_type == enum_class_Slice)
- Parrot_py_set_slice(INTERP, SELF, key, src);
- else
- SUPER(key, src);
+ SUPER(key, src);
}
void delete_keyed (PMC* key) {
- if (key->vtable->base_type == enum_class_Slice)
- Parrot_py_set_slice(INTERP, SELF, key, NULL);
- else {
- PMC **data;
- INTVAL idx = key_integer(INTERP, key);
- INTVAL i;
- INTVAL n = PMC_int_val(SELF);
- data = PMC_data(SELF);
- for (i = idx; i < n - 1; ++i)
- data[i] = data[i + 1];
- PMC_int_val(SELF)--;
- }
-
+ PMC **data;
+ INTVAL idx = key_integer(INTERP, key);
+ INTVAL i;
+ INTVAL n = PMC_int_val(SELF);
+ data = PMC_data(SELF);
+ for (i = idx; i < n - 1; ++i)
+ data[i] = data[i + 1];
+ PMC_int_val(SELF)--;
}
/*
@@ -262,35 +254,6 @@
return copy;
}
- STRING* get_repr () {
- return SELF.get_string();
- }
-
- STRING* get_string () {
- if (Interp_flags_TEST(INTERP, PARROT_PYTHON_MODE)) {
- STRING *res, *s;
- INTVAL j, n;
- PMC *val;
-
- res = string_from_cstring(INTERP, "[", 0);
- n = VTABLE_elements(INTERP, SELF);
- for (j = 0; j < n; ++j) {
- STRING *vals;
- val = SELF.get_pmc_keyed_int(j);
- REG_INT(3) = 0;
- vals = VTABLE_get_repr(INTERP, val);
- res = string_append(INTERP, res, vals, 0);
- if (j < n - 1)
- res = string_append(INTERP, res,
- const_string(INTERP, ", "), 0);
- }
- res = string_append(INTERP, res,
- const_string(INTERP, "]"), 0);
- return res;
- }
-
- return string_from_int(INTERP, DYNSELF.elements());
- }
/*
=item C<INTVAL is_equal (PMC* value)>
1.9 +1 -3 parrot/classes/string.pmc
Index: string.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/string.pmc,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- string.pmc 4 Apr 2005 14:02:16 -0000 1.8
+++ string.pmc 5 Apr 2005 14:07:34 -0000 1.9
@@ -701,8 +701,6 @@
PMC_struct_val(iter) = key;
return iter;
}
- case 1:
- return Parrot_py_get_slice(INTERP, SELF, key);
}
internal_exception(1, "PerlString: Unknown slice type");
return NULL;
1.292 +1 -6 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -r1.291 -r1.292
--- root.in 5 Apr 2005 09:12:49 -0000 1.291
+++ root.in 5 Apr 2005 14:07:36 -0000 1.292
@@ -404,7 +404,6 @@
$(SRC_DIR)/builtin$(O) \
$(SRC_DIR)/mmd_fallback$(O) \
$(SRC_DIR)/extend$(O) \
- $(SRC_DIR)/py_func$(O) \
$(PF_DIR)/pf_items$(O) \
$(OPS_DIR)/core_ops$(O) \
$(OPS_DIR)/core_ops_switch$(O) \
@@ -504,7 +503,6 @@
$(SRC_DIR)/library.str \
$(SRC_DIR)/mmd.str \
$(SRC_DIR)/pmc.str \
- $(SRC_DIR)/py_func.str \
$(SRC_DIR)/objects.str \
$(CLASS_STR_FILES)
@@ -844,9 +842,6 @@
$(SRC_DIR)/inter_run$(O) : $(SRC_DIR)/inter_run.c $(GENERAL_H_FILES)
-$(SRC_DIR)/py_func$(O) : $(SRC_DIR)/py_func.c $(GENERAL_H_FILES) \
- $(SRC_DIR)/py_func.str classes/pmc_default.h
-
$(IO_DIR)/io$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h
$(IO_DIR)/io_buf$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h
1.51 +44 -1 parrot/dynclasses/pybuiltin.pmc
Index: pybuiltin.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pybuiltin.pmc,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- pybuiltin.pmc 9 Mar 2005 14:51:59 -0000 1.50
+++ pybuiltin.pmc 5 Apr 2005 14:07:37 -0000 1.51
@@ -34,6 +34,49 @@
return lib_pmc;
}
+/*
+ * convert a key chain PMC to a range slice with end adjusted to
+ * the aggregate.
+ */
+PMC*
+Parrot_py_make_slice(Interp *interpreter, PMC *self, PMC *key)
+{
+ parrot_range_t *range;
+ PMC *slice;
+ INTVAL start, end, n;
+ /*
+ * key is a keychain PMC
+ */
+ slice = pmc_new_init(interpreter, enum_class_Slice, key);
+ range = PMC_struct_val(slice);
+ start = RVal_int(range->start);
+ if ((PObj_get_FLAGS(key) &
+ (KEY_inf_slice_FLAG|KEY_start_slice_FLAG)) ==
+ (KEY_inf_slice_FLAG|KEY_start_slice_FLAG)) {
+ /* last range "start .." */
+ RVal_int(range->end) = VTABLE_elements(interpreter, self) - 1;
+ }
+ /*
+ * set_slice_start did already decrement it
+ */
+ end = RVal_int(range->end) + 1;
+ n = VTABLE_elements(interpreter, self);
+ if (start < 0)
+ start += n;
+ if (end < 0)
+ end += n;
+ if (start < 0)
+ start = 0;
+ else if (start > n)
+ start = n;
+ if (start > end)
+ end = start;
+ else if (end > n)
+ end = n;
+ RVal_int(range->start) = start;
+ RVal_int(range->end) = end;
+ return slice;
+}
static PMC*
make_type(Interp* interpreter, INTVAL class, STRING* name,
PMC *parent, PMC *pad)
1.13 +2 -0 parrot/dynclasses/pyconsts.h
Index: pyconsts.h
===================================================================
RCS file: /cvs/public/parrot/dynclasses/pyconsts.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- pyconsts.h 12 Jan 2005 14:40:18 -0000 1.12
+++ pyconsts.h 5 Apr 2005 14:07:37 -0000 1.13
@@ -82,3 +82,5 @@
PMC *Parrot_PyClass_call_meth_fromc_P_P(Parrot_Interp interpreter, PMC *obj,
STRING *meth, PMC* arg1);
+
+PMC* Parrot_py_make_slice(Interp *interpreter, PMC *self, PMC *key);
1.94 +0 -10 parrot/imcc/main.c
Index: main.c
===================================================================
RCS file: /cvs/public/parrot/imcc/main.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- main.c 25 Mar 2005 10:19:55 -0000 1.93
+++ main.c 5 Apr 2005 14:07:37 -0000 1.94
@@ -88,7 +88,6 @@
" -r --run-pbc\n"
" -y --yydebug\n"
" <Language options>\n"
- " --python\n"
"see docs/running.pod for more\n");
}
@@ -119,7 +118,6 @@
#define OPT_DESTROY_FLAG 129
#define OPT_HELP_DEBUG 130
#define OPT_PBC_OUTPUT 131
-#define OPT_PYTHON 132
static struct longopt_opt_decl options[] = {
{ '.', '.', 0, { "--wait" } },
{ 'C', 'C', 0, { "--CGP-core" } },
@@ -147,7 +145,6 @@
{ 'v', 'v', 0, { "--verbose" } },
{ 'w', 'w', 0, { "--warnings" } },
{ 'y', 'y', 0, { "--yydebug" } },
- { '\0', OPT_PYTHON, 0, { "--python" } },
{ 0, 0, 0, { NULL } }
};
@@ -304,10 +301,6 @@
case OPT_DESTROY_FLAG:
setopt(PARROT_DESTROY_FLAG);
break;
- case OPT_PYTHON:
- setopt(PARROT_PYTHON_MODE);
- break;
-
default:
IMCC_fatal(interp, 1, "main: Invalid flag '%s' used."
"\n\nhelp: parrot -h\n", (*argv)[0]);
@@ -426,9 +419,6 @@
sourcefile = parseflags(interp, &argc, &argv);
output = IMCC_INFO(interp)->output;
- if (Interp_flags_TEST(interp, PARROT_PYTHON_MODE))
- Parrot_py_init(interp);
-
/* Default optimization level is zero; see optimizer.c, imc.h */
if (!*optimizer_opt) {
strcpy(optimizer_opt, "0");