Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added formatting footer and detabbed

git-svn-id: https://svn.parrot.org/parrot/trunk@5348 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 0eb3eb344287629740d6b6bb4e1a6b405696b0a1 1 parent 8d5a4ad
Michael Scott authored
Showing with 952 additions and 541 deletions.
  1. +14 −4 classes/array.pmc
  2. +11 −1 classes/boolean.pmc
  3. +10 −0 classes/closure.pmc
  4. +10 −0 classes/compiler.pmc
  5. +14 −4 classes/continuation.pmc
  6. +10 −0 classes/coroutine.pmc
  7. +11 −1 classes/csub.pmc
  8. +10 −0 classes/default.pmc
  9. +16 −7 classes/delegate.pmc
  10. +9 −0 classes/env.pmc
  11. +11 −1 classes/eval.pmc
  12. +11 −1 classes/exception.pmc
  13. +11 −1 classes/exception_handler.pmc
  14. +10 −0 classes/float.pmc
  15. +1 −4 classes/genclass.pl
  16. +10 −0 classes/integer.pmc
  17. +14 −4 classes/intlist.pmc
  18. +11 −1 classes/iterator.pmc
  19. +11 −1 classes/key.pmc
  20. +11 −1 classes/managedstruct.pmc
  21. +10 −0 classes/mmd_default.pmc
  22. +18 −8 classes/multiarray.pmc
  23. +10 −1 classes/nci.pmc
  24. +11 −1 classes/null.pmc
  25. +1 −1  classes/orderedhash.pmc
  26. +11 −1 classes/parrotclass.pmc
  27. +11 −1 classes/parrotio.pmc
  28. +11 −1 classes/parrotlibrary.pmc
  29. +10 −0 classes/parrotobject.pmc
  30. +23 −7 classes/perlarray.pmc
  31. +10 −0 classes/perlenv.pmc
  32. +13 −3 classes/perlhash.pmc
  33. +11 −2 classes/perlint.pmc
  34. +12 −1 classes/perlnum.pmc
  35. +46 −36 classes/perlscalar.pmc
  36. +162 −152 classes/perlstring.pmc
  37. +10 −0 classes/perlundef.pmc
  38. +0 −32 classes/pmc2c.pl
  39. +0 −4 classes/pmc2c2.pl
  40. +10 −0 classes/pointer.pmc
  41. +18 −8 classes/random.pmc
  42. +29 −20 classes/ref.pmc
  43. +21 −11 classes/retcontinuation.pmc
  44. +229 −220 classes/sarray.pmc
  45. +10 −0 classes/scalar.pmc
  46. +10 −0 classes/scratchpad.pmc
  47. +9 −0 classes/sharedref.pmc
  48. +10 −0 classes/sub.pmc
  49. +10 −0 classes/timer.pmc
View
18 classes/array.pmc
@@ -54,11 +54,11 @@ static PMC* retval(Interp *interp, void *ret)
/* XXX getting non existent value, exception or undef?
* current is for perlarray */
if (ret == (void*) -1)
- value = undef(interp);
+ value = undef(interp);
else {
- value = *(PMC**) ret;
- if (value == NULL) /* XXX same here */
- value = undef(interp);
+ value = *(PMC**) ret;
+ if (value == NULL) /* XXX same here */
+ value = undef(interp);
}
return value;
}
@@ -1208,3 +1208,13 @@ C<PerlUndef> should really be just C<Undef>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/boolean.pmc
@@ -143,4 +143,14 @@ C<*dest>.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/closure.pmc
@@ -141,3 +141,13 @@ Initial version by Leo.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/compiler.pmc
@@ -81,3 +81,13 @@ Initial revision by leo 2003/01/16
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
18 classes/continuation.pmc
@@ -71,10 +71,10 @@ Creates and returns a clone of the continuation.
struct Parrot_Sub * sub;
PMC* ret = SUPER();
sub = PMC_sub(ret);
- sub->ctx.user_stack = stack_copy(interpreter,
- PMC_sub(SELF)->ctx.user_stack);
- sub->ctx.control_stack = stack_copy(interpreter,
- PMC_sub(SELF)->ctx.control_stack);
+ sub->ctx.user_stack = stack_copy(interpreter,
+ PMC_sub(SELF)->ctx.user_stack);
+ sub->ctx.control_stack = stack_copy(interpreter,
+ PMC_sub(SELF)->ctx.control_stack);
return ret;
}
@@ -106,3 +106,13 @@ 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:
+*/
View
10 classes/coroutine.pmc
@@ -89,3 +89,13 @@ Initial version by Melvin on 2002/06/6.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/csub.pmc
@@ -62,4 +62,14 @@ 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:
+*/
View
10 classes/default.pmc
@@ -809,3 +809,13 @@ Does nothing.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
23 classes/delegate.pmc
@@ -59,7 +59,7 @@ save_regs(Parrot_Interp interp) {
struct regsave *save;
save = mem_sys_allocate(sizeof(struct regsave));
if (!save) {
- internal_exception(ALLOCATION_ERROR, "No memory for save struct");
+ internal_exception(ALLOCATION_ERROR, "No memory for save struct");
}
mem_sys_memcopy(save, interp, sizeof(struct regsave));
return save;
@@ -117,8 +117,8 @@ PARROT_INLINE static PMC *
find_or_die(Parrot_Interp interpreter, PMC *pmc, const char *name) {
PMC *returnPMC = find_meth(interpreter, pmc, name);
if (PMC_IS_NULL(returnPMC)) {
- internal_exception(METH_NOT_FOUND,
- "Can't find method '%s' for object", name);
+ internal_exception(METH_NOT_FOUND,
+ "Can't find method '%s' for object", name);
}
REG_PMC(2) = pmc;
return returnPMC;
@@ -149,11 +149,11 @@ PARROT_INLINE static void
noarg_noreturn(Parrot_Interp interpreter, PMC *obj, const char *meth, int die) {
struct regsave *data = save_regs(interpreter);
PMC *method = die ? find_or_die(interpreter, obj, meth) :
- find_meth (interpreter, obj, meth);
+ find_meth (interpreter, obj, meth);
if (PMC_IS_NULL(method))
- return;
+ return;
REG_PMC(2) = obj;
- REG_INT(0) = 1; /* prototyped */
+ REG_INT(0) = 1; /* prototyped */
REG_INT(1) = 0;
REG_INT(2) = 0;
REG_INT(3) = 0;
@@ -181,7 +181,7 @@ Calls the delegated C<init()> method.
*/
void init () {
- noarg_noreturn(INTERP, SELF, PARROT_VTABLE_INIT_METHNAME, 0);
+ noarg_noreturn(INTERP, SELF, PARROT_VTABLE_INIT_METHNAME, 0);
}
@@ -195,3 +195,12 @@ Calls the delegated C<init()> method.
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
9 classes/env.pmc
@@ -139,3 +139,12 @@ Deletes the the environment variable for C<*key>.
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/eval.pmc
@@ -146,4 +146,14 @@ Initial version by leo 2003/01/16.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/exception.pmc
@@ -231,4 +231,14 @@ Initial revision by leo 2003.07.10.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/exception_handler.pmc
@@ -52,4 +52,14 @@ Initial revision by leo 2003.07.10.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/float.pmc
@@ -144,3 +144,13 @@ Returns a Parrot string representation of the number.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
5 classes/genclass.pl
@@ -1,7 +1,6 @@
#! perl -w
-################################################################################
+# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
# $Id$
-################################################################################
=head1 NAME
@@ -30,8 +29,6 @@ =head1 SEE ALSO
=cut
-################################################################################
-
use FindBin;
use lib "$FindBin::Bin/../lib";
View
10 classes/integer.pmc
@@ -215,3 +215,13 @@ Decrements the integer.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
18 classes/intlist.pmc
@@ -34,11 +34,11 @@ Creates and returns a clone of the list.
*/
- PMC* clone () {
- PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
+ PMC* clone () {
+ PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
PObj_custom_mark_SET(dest);
PMC_data(dest) = intlist_clone(INTERP, (IntList *) PMC_data(SELF));
- return dest;
+ return dest;
}
/*
@@ -213,4 +213,14 @@ Removes and returns the first element in the list.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/iterator.pmc
@@ -263,7 +263,7 @@ Sets the current index to C<value>.
C<value> must be in the range:
- (ITERATE_FROM_START + 1) .. (ITERATE_FROM_END - 1)
+ (ITERATE_FROM_START + 1) .. (ITERATE_FROM_END - 1)
=cut
@@ -548,3 +548,13 @@ Returns the result of calling C<type_keyed(key)> on the aggregate.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/key.pmc
@@ -32,7 +32,7 @@ Initializes the key.
*/
- void init () {
+ void init () {
PObj_custom_mark_SET(SELF);
}
@@ -297,3 +297,13 @@ Raises an exception of an attempt is made to iterate backwards.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/managedstruct.pmc
@@ -37,7 +37,7 @@ Initializes an empty struct.
*/
- void init () {
+ void init () {
SUPER();
PObj_active_destroy_SET(SELF);
PMC_int_val(SELF) = 0;
@@ -114,3 +114,13 @@ 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:
+*/
View
10 classes/mmd_default.pmc
@@ -351,3 +351,13 @@ and C<*value>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
26 classes/multiarray.pmc
@@ -16,8 +16,8 @@ MULTIDIM CALC OFFSET
Algorithm:
- i + j*Ni + k*Ni*Nj + l*Ni*Nj*Nk ...
-
+ i + j*Ni + k*Ni*Nj + l*Ni*Nj*Nk ...
+
where i,j,k,l... are coordinates in a multidimensional space and
Ni,Nj,Nk... are the lengths of the dimensions.
@@ -54,11 +54,11 @@ static INTVAL calc_offset(Interp* interp, List*list, PMC *key)
l = key_integer(interp, key);
ninj = 1;
for(; dim ; dim = key_next(interp, dim)) {
- key = key_next(interp, key);
- if (!key)
- break;
- ninj *= key_integer(interp, dim);
- l += key_integer(interp, key) * ninj;
+ key = key_next(interp, key);
+ if (!key)
+ break;
+ ninj *= key_integer(interp, dim);
+ l += key_integer(interp, key) * ninj;
}
return l;
}
@@ -211,4 +211,14 @@ Initial revision by Josef Hook <joh@stacken.kth.se>
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
11 classes/nci.pmc
@@ -37,7 +37,7 @@ Initializes the NCI with a C<NULL> function pointer.
*/
- void init() {
+ void init() {
PMC_struct_val(SELF) = NULL;
}
@@ -155,3 +155,12 @@ Initial revision by sean 2002/08/04.
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/null.pmc
@@ -33,7 +33,7 @@ Overrides the default to do nothing.
*/
- void init () {
+ void init () {
}
}
@@ -45,3 +45,13 @@ Overrides the default to do nothing.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
2  classes/orderedhash.pmc
@@ -51,7 +51,7 @@ Initializes the ordered hash.
*/
- void init () {
+ void init () {
/* clear the Hash ptr - its not yet existing */
PMC_struct_val(SELF) = NULL;
SUPER();
View
12 classes/parrotclass.pmc
@@ -60,7 +60,7 @@ Initializes the class.
*/
- void init () {
+ void init () {
/* No attributes to start with */
PMC_int_val(SELF) = 0;
/* But we are a class, really */
@@ -186,3 +186,13 @@ Attribute accessor methods.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/parrotio.pmc
@@ -150,4 +150,14 @@ Initial version by leo 2003/06/23.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
12 classes/parrotlibrary.pmc
@@ -46,7 +46,7 @@ Initializes the library with a C<NULL> oplib init function.
*/
- void init() {
+ void init() {
PMC_struct_val(SELF) = NULL;
}
@@ -102,3 +102,13 @@ Initial version by leo 2003.10.12.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/parrotobject.pmc
@@ -578,3 +578,13 @@ Sets C<*value> as the value of attribute C<*attr>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
30 classes/perlarray.pmc
@@ -22,9 +22,9 @@ These are the vtable functions for the PerlArray base class
/*
-=item C<>
-
+=item C<static PMC *undef(struct Parrot_Interp *interpreter)>
+Returns the C<PerlUndef> PMC.
=cut
@@ -37,9 +37,10 @@ static PMC* undef(struct Parrot_Interp* interpreter)
/*
-=item C<>
-
+=item C<static PMC *
+Parrot_PerlArray_set_pmc_ptr(Interp *interp, List *list, INTVAL key)>
+Returns the PMC pointer for the element at index C<key>.
=cut
@@ -53,11 +54,11 @@ Parrot_PerlArray_set_pmc_ptr(Interp *interp, List *list, INTVAL key)
/* assign into a sparse or past end */
if (ret == 0 || ret == (void*) -1 || *(PMC**)ret == 0) {
- value = undef(interp);
- list_assign(interp, list, key, value, enum_type_PMC);
+ value = undef(interp);
+ list_assign(interp, list, key, value, enum_type_PMC);
}
else
- value = *(PMC**) ret;
+ value = *(PMC**) ret;
return value;
}
@@ -65,6 +66,12 @@ pmclass PerlArray extends Array need_ext does array {
/*
+=back
+
+=head2 Methods
+
+=over 4
+
=item C<void set_integer_keyed_int(INTVAL key, INTVAL value)>
Converts C<value> to a C<PerlInt> and assigns it to the array at index
@@ -323,3 +330,12 @@ possibly seg fault).
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/perlenv.pmc
@@ -91,3 +91,13 @@ converted to a Parrot string.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
16 classes/perlhash.pmc
@@ -28,9 +28,9 @@ STRING * hash_get_idx(Interp *interpreter, Hash *hash, PMC *key);
/*
-=item C<>
-
+=item C<static STRING* make_hash_key(Interp *interpreter, PMC *key)>
+Returns a Parrot string for C<*key>.
=cut
@@ -834,4 +834,14 @@ F<docs/pdds/pdd08_keys.pod>.
=cut
-*/
+*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
13 classes/perlint.pmc
@@ -779,7 +779,7 @@ C<*value>.
*/
void repeat (PMC* value, PMC* dest) {
internal_exception(INVALID_OPERATION,
- "repeat() not implemented in class 'PerlInt'\n");
+ "repeat() not implemented in class 'PerlInt'\n");
}
/*
@@ -861,4 +861,13 @@ Used to unarchive the integer.
=cut
*/
-
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
13 classes/perlnum.pmc
@@ -33,7 +33,7 @@ Initializes the number to C<0.0>.
*/
- void init () {
+ void init () {
PMC_num_val(SELF) = 0.0;
}
@@ -643,3 +643,14 @@ Decrements the number.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
+
View
82 classes/perlscalar.pmc
@@ -36,26 +36,26 @@ Morphs the scalar to the specified type.
*/
- void morph (INTVAL type) {
- if (SELF->vtable->base_type == type)
- return;
- if (SELF->vtable->base_type == enum_class_PerlString) {
- PObj_custom_mark_CLEAR(SELF);
- SELF->vtable = Parrot_base_vtables[type];
- return;
- }
- if (type == enum_class_PerlString) {
- /*
- * if we morph to a string, first clear str_val
- * so that after changing the vtable a parallel
- * reader doesn't get a gargabe pointer
- */
- PMC_str_val(SELF) = NULL;
- PObj_custom_mark_SET(SELF);
- SELF->vtable = Parrot_base_vtables[type];
- return;
- }
- SELF->vtable = Parrot_base_vtables[type];
+ void morph (INTVAL type) {
+ if (SELF->vtable->base_type == type)
+ return;
+ if (SELF->vtable->base_type == enum_class_PerlString) {
+ PObj_custom_mark_CLEAR(SELF);
+ SELF->vtable = Parrot_base_vtables[type];
+ return;
+ }
+ if (type == enum_class_PerlString) {
+ /*
+ * if we morph to a string, first clear str_val
+ * so that after changing the vtable a parallel
+ * reader doesn't get a gargabe pointer
+ */
+ PMC_str_val(SELF) = NULL;
+ PObj_custom_mark_SET(SELF);
+ SELF->vtable = Parrot_base_vtables[type];
+ return;
+ }
+ SELF->vtable = Parrot_base_vtables[type];
}
/*
@@ -70,22 +70,22 @@ according to the type of C<*value>.
*/
void set_pmc (PMC* value) {
- DYNSELF.morph(value->vtable->base_type);
- switch (value->vtable->base_type) {
- case enum_class_Boolean:
- case enum_class_PerlInt:
- DYNSELF.set_integer_same(value);
- break;
- case enum_class_PerlNum:
- DYNSELF.set_number_same(value);
- break;
- case enum_class_PerlString:
- DYNSELF.set_string_same(value);
- break;
- case enum_class_PerlUndef:
- (void) VTABLE_get_pmc(interpreter, value);
- break;
- }
+ DYNSELF.morph(value->vtable->base_type);
+ switch (value->vtable->base_type) {
+ case enum_class_Boolean:
+ case enum_class_PerlInt:
+ DYNSELF.set_integer_same(value);
+ break;
+ case enum_class_PerlNum:
+ DYNSELF.set_number_same(value);
+ break;
+ case enum_class_PerlString:
+ DYNSELF.set_string_same(value);
+ break;
+ case enum_class_PerlUndef:
+ (void) VTABLE_get_pmc(interpreter, value);
+ break;
+ }
}
}
@@ -97,3 +97,13 @@ according to the type of C<*value>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
314 classes/perlstring.pmc
@@ -51,8 +51,8 @@ Marks the string as live.
*/
void mark () {
- if (PMC_str_val(SELF))
- pobject_lives(INTERP, (PObj *)PMC_str_val(SELF));
+ if (PMC_str_val(SELF))
+ pobject_lives(INTERP, (PObj *)PMC_str_val(SELF));
}
/*
@@ -66,10 +66,10 @@ Creates and returns a clone of the string.
*/
PMC* clone () {
- PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
+ PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
PObj_custom_mark_SET(dest);
PMC_str_val(dest) = string_copy(INTERP,PMC_str_val(SELF));
- return dest;
+ return dest;
}
/*
@@ -160,7 +160,7 @@ Morphs the string to a C<PerlInt> and sets its value to C<value>.
*/
void set_integer_native (INTVAL value) {
- DYNSELF.morph(enum_class_PerlInt);
+ DYNSELF.morph(enum_class_PerlInt);
DYNSELF.set_integer_native(value);
}
@@ -175,7 +175,7 @@ Morphs the string to a C<PerlNum> and sets its value to C<value>.
*/
void set_number_native (FLOATVAL value) {
- DYNSELF.morph(enum_class_PerlNum);
+ DYNSELF.morph(enum_class_PerlNum);
DYNSELF.set_number_native(value);
}
@@ -205,7 +205,7 @@ Sets the string's value to the value of the specified C<PerlString>.
void set_string_same (PMC * value) {
PMC_str_val(SELF) = string_set(INTERP, PMC_str_val(SELF),
- PMC_str_val(value));
+ PMC_str_val(value));
}
/*
@@ -219,9 +219,9 @@ Adds C<*value> to the string and returns the result in C<*dest>.
*/
void add (PMC * value, PMC* dest) {
- int vtype = VTABLE_type(INTERP, value);
+ int vtype = VTABLE_type(INTERP, value);
- INTVAL val_type;
+ INTVAL val_type;
if (vtype == enum_class_PerlNum) {
VTABLE_set_number_native(INTERP, dest,
@@ -230,15 +230,15 @@ Adds C<*value> to the string and returns the result in C<*dest>.
);
}
else {
- FLOATVAL pmcf = VTABLE_get_number(INTERP, SELF);
- INTVAL pmci = VTABLE_get_integer(INTERP, SELF);
- FLOATVAL valf = VTABLE_get_number(INTERP, value);
- INTVAL vali = VTABLE_get_integer(INTERP, value);
-
- if (pmcf == pmci && valf == vali)
- VTABLE_set_integer_native(INTERP, dest, pmci + vali);
- else
- VTABLE_set_number_native(INTERP, dest, pmcf + valf);
+ FLOATVAL pmcf = VTABLE_get_number(INTERP, SELF);
+ INTVAL pmci = VTABLE_get_integer(INTERP, SELF);
+ FLOATVAL valf = VTABLE_get_number(INTERP, value);
+ INTVAL vali = VTABLE_get_integer(INTERP, value);
+
+ if (pmcf == pmci && valf == vali)
+ VTABLE_set_integer_native(INTERP, dest, pmci + vali);
+ else
+ VTABLE_set_number_native(INTERP, dest, pmcf + valf);
}
}
@@ -266,7 +266,7 @@ Subtracts C<*value> from the string and returns the result in C<*dest>.
);
}
else {
- SUPER(value, dest);
+ SUPER(value, dest);
}
}
@@ -280,7 +280,7 @@ Multiplies the string by C<*value> and returns the result in C<*dest>.
*/
- void multiply (PMC* value, PMC* dest) {
+ void multiply (PMC* value, PMC* dest) {
if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) *
@@ -294,7 +294,7 @@ Multiplies the string by C<*value> and returns the result in C<*dest>.
);
}
else {
- SUPER(value, dest);
+ SUPER(value, dest);
}
}
@@ -322,7 +322,7 @@ Divides the string by C<*value> and returns the result in C<*dest>.
);
}
else {
- SUPER(value, dest);
+ SUPER(value, dest);
}
}
@@ -345,8 +345,8 @@ C<*dest>.
);
}
else {
- internal_exception(INVALID_OPERATION,
- "modulus() not implemented for PerlString\n");
+ internal_exception(INVALID_OPERATION,
+ "modulus() not implemented for PerlString\n");
}
}
@@ -365,11 +365,11 @@ C<*dest>.
*/
void bitwise_ors (PMC* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_or(interpreter, PMC_str_val(SELF),
- VTABLE_get_string(INTERP, value), NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_or(interpreter, PMC_str_val(SELF),
+ VTABLE_get_string(INTERP, value), NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -384,11 +384,11 @@ returns the result in C<*dest>.
*/
void bitwise_ors_str (STRING* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_or(interpreter, PMC_str_val(SELF),
- value, NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_or(interpreter, PMC_str_val(SELF),
+ value, NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -400,11 +400,11 @@ returns the result in C<*dest>.
*/
void bitwise_xors (PMC* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
- VTABLE_get_string(INTERP, value), NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
+ VTABLE_get_string(INTERP, value), NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -419,11 +419,11 @@ returns the result in C<*dest>.
*/
void bitwise_xors_str (STRING* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
- value, NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
+ value, NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -435,11 +435,11 @@ returns the result in C<*dest>.
*/
void bitwise_ands (PMC* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_and(interpreter, PMC_str_val(SELF),
- VTABLE_get_string(INTERP, value), NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_and(interpreter, PMC_str_val(SELF),
+ VTABLE_get_string(INTERP, value), NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -454,11 +454,11 @@ returns the result in C<*dest>.
*/
void bitwise_ands_str (STRING* value, PMC* dest) {
- STRING* result;
+ STRING* result;
- result = string_bitwise_and(interpreter, PMC_str_val(SELF),
- value, NULL);
- VTABLE_set_string_native(INTERP, dest, result);
+ result = string_bitwise_and(interpreter, PMC_str_val(SELF),
+ value, NULL);
+ VTABLE_set_string_native(INTERP, dest, result);
}
/*
@@ -474,7 +474,7 @@ return the result in C<*dest>, morphing it to a PerlString if required.
void concatenate (PMC* value, PMC* dest) {
STRING* s = PMC_str_val(SELF);
- VTABLE_morph(INTERP, dest, enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
PMC_str_val(dest) =
string_concat(INTERP, s, VTABLE_get_string(INTERP, value), 0);
}
@@ -492,7 +492,7 @@ C<*dest>.
void concatenate_native (STRING* value, PMC* dest) {
STRING* s = PMC_str_val(SELF);
- VTABLE_morph(INTERP, dest, enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
PMC_str_val(dest) = string_concat(INTERP, s, value, 0);
}
@@ -525,7 +525,7 @@ Returns the result of comparing the string with C<*value>.
INTVAL cmp(PMC* value) {
return string_compare(INTERP, PMC_str_val(SELF),
- VTABLE_get_string(INTERP, value));
+ VTABLE_get_string(INTERP, value));
}
/*
@@ -539,8 +539,8 @@ Returns in C<*dest> the string repeated C<*value> times.
*/
void repeat (PMC* value, PMC* dest) {
- DYNSELF.morph(enum_class_PerlString);
- VTABLE_morph(INTERP, dest, enum_class_PerlString);
+ DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
PMC_str_val(dest) =
string_repeat(INTERP, PMC_str_val(SELF),
(UINTVAL)VTABLE_get_integer(INTERP, value), NULL
@@ -558,10 +558,10 @@ Returns in C<*dest> the string repeated C<value> times.
*/
void repeat_int (INTVAL value, PMC* dest) {
- DYNSELF.morph(enum_class_PerlString);
- VTABLE_morph(INTERP, dest, enum_class_PerlString);
+ DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
PMC_str_val(dest) = string_repeat(INTERP,
- PMC_str_val(SELF), (UINTVAL)value, NULL);
+ PMC_str_val(SELF), (UINTVAL)value, NULL);
}
/*
@@ -573,7 +573,7 @@ Returns in C<*dest> the string repeated C<value> times.
*/
void increment () {
- /* XXX perl5 like= */
+ /* XXX perl5 like= */
}
/*
@@ -588,7 +588,7 @@ Perl 5 like string incrementation.
*/
void decrement () {
- /* XXX perl5 like= */
+ /* XXX perl5 like= */
}
/*
@@ -603,10 +603,10 @@ starting at C<offset>.
*/
void substr (INTVAL offset, INTVAL length, PMC* dest) {
- DYNSELF.morph(enum_class_PerlString);
- VTABLE_morph(INTERP, dest, enum_class_PerlString);
+ DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
PMC_str_val(dest) = string_substr(INTERP,
- PMC_str_val(SELF), offset, length, NULL, 0);
+ PMC_str_val(SELF), offset, length, NULL, 0);
}
/*
@@ -623,7 +623,7 @@ C<offset>.
STRING* substr_str (INTVAL offset, INTVAL length) {
return string_substr(INTERP, PMC_str_val(SELF), offset,
- length, NULL, 0);
+ length, NULL, 0);
}
/*
@@ -644,63 +644,63 @@ C<what>.
*/
PMC* nextkey_keyed (PMC* key, INTVAL what) {
- PMC *ret = key;
- STRING *s = PMC_str_val(SELF);
- INTVAL n = string_length(s);
- union {
- const void * __c_ptr;
- void * __ptr;
- } __ptr_u;
-
- PObj_get_FLAGS(ret) &= ~KEY_type_FLAGS;
- PObj_get_FLAGS(ret) |= KEY_integer_FLAG;
- switch (what) {
- case ITERATE_FROM_START: /* reset key */
- PMC_int_val(ret) = 0;
- if (!n)
- PMC_int_val(ret) = -1;
- PMC_data(key) = s->strstart;
- break;
- case ITERATE_GET_NEXT:
- if (PMC_int_val(ret) < n - 1) {
- ++PMC_int_val(ret);
- if ((char *)PMC_data(key) >= (char *)s->strstart &&
- (char *)PMC_data(key) <= (char *)s->strstart +
- s->bufused)
- PMC_data(key) = const_cast(
- s->encoding->skip_forward( PMC_data(key), 1));
- else
- PMC_data(key) = const_cast(
- s->encoding->skip_forward(s->strstart,
- PMC_int_val(ret)));
- }
- else
- PMC_int_val(ret) = -1;
- break;
- case ITERATE_GET_PREV:
- if (PMC_int_val(ret) >= 0) {
- --PMC_int_val(ret);
- if (PMC_int_val(ret) >= 0) {
- if ((char *)PMC_data(key) >= (char *)s->strstart &&
- (char *)PMC_data(key) <= (char *)s->strstart +
- s->bufused)
- PMC_data(key) = const_cast(
- s->encoding->skip_backward( PMC_data(key), 1));
- else
- PMC_data(key) = const_cast(
- s->encoding->skip_forward(s->strstart,
- PMC_int_val(ret)));
- }
- }
- break;
- case ITERATE_FROM_END:
- PMC_int_val(ret) = n-1;
- PMC_data(key) = (char *)s->strstart + s->bufused;
- PMC_data(key) = const_cast(
- s->encoding->skip_backward( PMC_data(key), 1));
- break;
- }
- return ret;
+ PMC *ret = key;
+ STRING *s = PMC_str_val(SELF);
+ INTVAL n = string_length(s);
+ union {
+ const void * __c_ptr;
+ void * __ptr;
+ } __ptr_u;
+
+ PObj_get_FLAGS(ret) &= ~KEY_type_FLAGS;
+ PObj_get_FLAGS(ret) |= KEY_integer_FLAG;
+ switch (what) {
+ case ITERATE_FROM_START: /* reset key */
+ PMC_int_val(ret) = 0;
+ if (!n)
+ PMC_int_val(ret) = -1;
+ PMC_data(key) = s->strstart;
+ break;
+ case ITERATE_GET_NEXT:
+ if (PMC_int_val(ret) < n - 1) {
+ ++PMC_int_val(ret);
+ if ((char *)PMC_data(key) >= (char *)s->strstart &&
+ (char *)PMC_data(key) <= (char *)s->strstart +
+ s->bufused)
+ PMC_data(key) = const_cast(
+ s->encoding->skip_forward( PMC_data(key), 1));
+ else
+ PMC_data(key) = const_cast(
+ s->encoding->skip_forward(s->strstart,
+ PMC_int_val(ret)));
+ }
+ else
+ PMC_int_val(ret) = -1;
+ break;
+ case ITERATE_GET_PREV:
+ if (PMC_int_val(ret) >= 0) {
+ --PMC_int_val(ret);
+ if (PMC_int_val(ret) >= 0) {
+ if ((char *)PMC_data(key) >= (char *)s->strstart &&
+ (char *)PMC_data(key) <= (char *)s->strstart +
+ s->bufused)
+ PMC_data(key) = const_cast(
+ s->encoding->skip_backward( PMC_data(key), 1));
+ else
+ PMC_data(key) = const_cast(
+ s->encoding->skip_forward(s->strstart,
+ PMC_int_val(ret)));
+ }
+ }
+ break;
+ case ITERATE_FROM_END:
+ PMC_int_val(ret) = n-1;
+ PMC_data(key) = (char *)s->strstart + s->bufused;
+ PMC_data(key) = const_cast(
+ s->encoding->skip_backward( PMC_data(key), 1));
+ break;
+ }
+ return ret;
}
/*
@@ -714,27 +714,27 @@ Returns the string value for C<*key>.
*/
STRING* get_string_keyed(PMC* key) {
- STRING *res;
- STRING *s = PMC_str_val(SELF);
- union {
- const void * __c_ptr;
- void * __ptr;
- } __ptr_u;
- if ((char*)PMC_data(key) >= (char *)s->strstart &&
- (char *)PMC_data(key) <= (char *)s->strstart + s->bufused)
- ;
- else
- PMC_data(key) = const_cast(s->encoding->skip_forward(
- s->strstart, PMC_int_val(key)));
- res = string_copy(interpreter, s);
- res->strstart = PMC_data(key);
- res->strlen = 1;
- res->bufused = (const char *)res->encoding->skip_forward(
- res->strstart, 1) - (const char *)res->strstart;
- return res;
-
- }
-
+ STRING *res;
+ STRING *s = PMC_str_val(SELF);
+ union {
+ const void * __c_ptr;
+ void * __ptr;
+ } __ptr_u;
+ if ((char*)PMC_data(key) >= (char *)s->strstart &&
+ (char *)PMC_data(key) <= (char *)s->strstart + s->bufused)
+ ;
+ else
+ PMC_data(key) = const_cast(s->encoding->skip_forward(
+ s->strstart, PMC_int_val(key)));
+ res = string_copy(interpreter, s);
+ res->strstart = PMC_data(key);
+ res->strlen = 1;
+ res->bufused = (const char *)res->encoding->skip_forward(
+ res->strstart, 1) - (const char *)res->strstart;
+ return res;
+
+ }
+
/*
=item C<INTVAL get_integer_keyed(PMC *key)>
@@ -745,18 +745,18 @@ Returns the integer value for C<*key>.
*/
- INTVAL get_integer_keyed(PMC* key) {
- STRING *s = PMC_str_val(SELF);
- if ((char*)PMC_data(key) >= (char *)s->strstart &&
- (char *)PMC_data(key) <= (char *)s->strstart + s->bufused) {
- if (s->encoding->index == enum_encoding_singlebyte)
- return *(unsigned char*) PMC_data(key);
- else
- return s->encoding->decode(PMC_data(key));
- }
- else
- return s->encoding->decode(s->encoding->skip_forward(s->strstart,
- PMC_int_val(key)));
+ INTVAL get_integer_keyed(PMC* key) {
+ STRING *s = PMC_str_val(SELF);
+ if ((char*)PMC_data(key) >= (char *)s->strstart &&
+ (char *)PMC_data(key) <= (char *)s->strstart + s->bufused) {
+ if (s->encoding->index == enum_encoding_singlebyte)
+ return *(unsigned char*) PMC_data(key);
+ else
+ return s->encoding->decode(PMC_data(key));
+ }
+ else
+ return s->encoding->decode(s->encoding->skip_forward(s->strstart,
+ PMC_int_val(key)));
}
}
@@ -767,3 +767,13 @@ Returns the integer value for C<*key>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
10 classes/perlundef.pmc
@@ -800,3 +800,13 @@ Morphs to a C<PerlInt> with value C<-1>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
32 classes/pmc2c.pl
@@ -1,8 +1,6 @@
#! perl -w
-################################################################################
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
# $Id$
-################################################################################
=head1 NAME
@@ -174,8 +172,6 @@ =head2 Internal Methods
=cut
-################################################################################
-
use FindBin;
use lib 'lib';
use lib "$FindBin::Bin/..";
@@ -208,8 +204,6 @@ =head2 Internal Methods
\(([^\(]*)\) #parameters
}sx;
-################################################################################
-
=item C<extract_balanced($code)>
This function's purpose is to extract the C code between the opening
@@ -240,8 +234,6 @@ =head2 Internal Methods
=cut
-################################################################################
-
sub extract_balanced {
my $balance = 0;
my $lines = 0;
@@ -293,8 +285,6 @@ sub parse_flags {
($pre, $classname, $superpmc, \%flags);
}
-################################################################################
-
=item C<parse_superpmc($data)>
This function looks for a superclass declaration in the current PMC
@@ -305,8 +295,6 @@ sub parse_flags {
=cut
-################################################################################
-
sub parse_superpmc {
local $_ = shift;
@@ -327,8 +315,6 @@ sub parse_superpmc {
return (\@methods, $superpmc, $flags);
}
-################################################################################
-
=item C<superpmc_info($class)>
This function opens the file containing the superclass reads in the
@@ -336,8 +322,6 @@ sub parse_superpmc {
=cut
-################################################################################
-
sub superpmc_info {
my $pmc = shift;
my $filename = "$FindBin::Bin/\L$pmc\E.pmc";
@@ -353,8 +337,6 @@ sub superpmc_info {
return parse_superpmc($data);
}
-################################################################################
-
=item C<scan_inheritance_tree($classname)>
This function repeatedly calls C<superpmc_info()> passing in the current
@@ -366,8 +348,6 @@ sub superpmc_info {
=cut
-################################################################################
-
sub scan_inheritance_tree {
my ($class) = @_;
@@ -459,16 +439,12 @@ sub Usage {
close SOURCE;
}
-################################################################################
-
=item C<count_newlines($string)>
Returns the number of newlines in C<$string>.
=cut
-################################################################################
-
sub count_newlines {
return scalar(() = $_[0] =~ /\n/g);
}
@@ -618,8 +594,6 @@ sub class_trailer {
$OUT;
}
-################################################################################
-
=item C<filter($contents, $file, $cfile)>
The C<filter()> function choreographs the previous functions actions on
@@ -632,8 +606,6 @@ sub class_trailer {
=cut
-################################################################################
-
my (%flags, %parent_flags);
sub filter {
my ($contents, $pmcfile, $cfile) = @_;
@@ -875,8 +847,6 @@ sub filter {
return ($OUT, $HOUT);
}
-################################################################################
-
=back
=head1 TODO
@@ -888,5 +858,3 @@ =head1 TODO
=back
=cut
-
-################################################################################
View
4 classes/pmc2c2.pl
@@ -1,8 +1,6 @@
#! perl -w
-################################################################################
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
# $Id$
-################################################################################
=head1 NAME
@@ -215,8 +213,6 @@ =head1 AUTHOR
=cut
-################################################################################
-
use FindBin;
use lib 'lib';
use lib "$FindBin::Bin/..";
View
10 classes/pointer.pmc
@@ -178,3 +178,13 @@ Returns whether the pointer has the same value as C<*pmc2>.
=cut
*/
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
26 classes/random.pmc
@@ -36,7 +36,7 @@ pmclass Random singleton {
*/
void* get_pointer() {
- return Rand_PMC;
+ return Rand_PMC;
}
/*
@@ -51,8 +51,8 @@ information see F<src/pmc.c>.
*/
void set_pointer(void* ptr) {
- assert(!Rand_PMC);
- Rand_PMC = (PMC*) ptr;
+ assert(!Rand_PMC);
+ Rand_PMC = (PMC*) ptr;
}
/*
@@ -66,7 +66,7 @@ Sets the random number seed to C<seed>.
*/
void set_integer_native(INTVAL seed) {
- Parrot_srand(seed);
+ Parrot_srand(seed);
}
/*
@@ -80,7 +80,7 @@ Returns a random integer in the range C<-2^31..2^31>.
*/
INTVAL get_integer() {
- return Parrot_int_rand(0);
+ return Parrot_int_rand(0);
}
/*
@@ -94,7 +94,7 @@ Returns a ramdom integer in the range C<0..max>.
*/
INTVAL get_integer_keyed_int(INTVAL max) {
- return Parrot_range_rand(0, max, 0);
+ return Parrot_range_rand(0, max, 0);
}
/*
@@ -108,7 +108,7 @@ Returns a ramdom floating-point number in the range C<0.0..1.0>.
*/
FLOATVAL get_number() {
- return Parrot_float_rand(0);
+ return Parrot_float_rand(0);
}
}
@@ -119,9 +119,19 @@ Returns a ramdom floating-point number in the range C<0.0..1.0>.
=head1 HISTORY
-2003.12.10 first rev by leo.
+2003.12.10 first rev by leo.
=cut
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
+
View
49 classes/ref.pmc
@@ -36,8 +36,8 @@ Raises an exception. Use C<init_pmc()> instead.
*/
- void init () {
- internal_exception(1, "Ref init without PMC\n");
+ void init () {
+ internal_exception(1, "Ref init without PMC\n");
}
/*
@@ -53,18 +53,18 @@ If C<initializer> is C<NULL> then an exception is raised.
*/
void init_pmc (PMC* initializer) {
- if (initializer) {
- PMC_pmc_val(SELF) = initializer; /* the refered PMC itself */
- PObj_custom_mark_SET(SELF);
- /*
- * if referred PMC needs active destruction
- * we have to pass it on
- */
- if (PObj_active_destroy_TEST(initializer))
- PObj_active_destroy_SET(SELF);
- }
- else
- internal_exception(1, "Ref init with NULL PMC\n");
+ if (initializer) {
+ PMC_pmc_val(SELF) = initializer; /* the refered PMC itself */
+ PObj_custom_mark_SET(SELF);
+ /*
+ * if referred PMC needs active destruction
+ * we have to pass it on
+ */
+ if (PObj_active_destroy_TEST(initializer))
+ PObj_active_destroy_SET(SELF);
+ }
+ else
+ internal_exception(1, "Ref init with NULL PMC\n");
}
/*
@@ -80,7 +80,7 @@ C<*props> with the reference.
*/
void init_pmc_props(PMC* init, PMC* props) {
- SUPER(init, props);
+ SUPER(init, props);
}
/*
@@ -94,8 +94,8 @@ Sets the referenced PMC to C<*other>.
*/
void set_pmc(PMC* other) {
- PObj_active_destroy_CLEAR(SELF);
- SELF.init_pmc(other);
+ PObj_active_destroy_CLEAR(SELF);
+ SELF.init_pmc(other);
}
/*
@@ -109,7 +109,7 @@ Marks the referenced PMC as live.
*/
void mark () {
- pobject_lives(INTERP, (PObj *) PMC_pmc_val(SELF));
+ pobject_lives(INTERP, (PObj *) PMC_pmc_val(SELF));
}
/*
@@ -129,7 +129,7 @@ Returns the type of the PMC, not the type of the referenced PMC.
*/
INTVAL type() {
- return SUPER();
+ return SUPER();
}
/*
@@ -143,7 +143,7 @@ Returns the name of the PMC, not the name of the referenced PMC.
*/
STRING* name() {
- return SUPER();
+ return SUPER();
}
}
@@ -159,3 +159,12 @@ Initial revision by leo 2003.09.01.
*/
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+*/
View
32 classes/retcontinuation.pmc
@@ -36,10 +36,10 @@ Initializes the continuation.
*/
- void init () {
- PMC_sub(SELF) = new_ret_continuation(INTERP);
- PMC_struct_val(SELF) = NULL;
- PObj_custom_mark_destroy_SETALL(SELF);
+ void init () {
+ PMC_sub(SELF) = new_ret_continuation(INTERP);
+ PMC_struct_val(SELF) = NULL;
+ PObj_custom_mark_destroy_SETALL(SELF);
}
/*
@@ -53,13 +53,13 @@ Creates and returns a clone of the continuation.
*/
PMC* clone() {
- struct Parrot_Sub * sub;
- PMC* ret = pmc_new_noinit(INTERP, SELF->vtable->base_type);
- sub = PMC_sub(ret) = mem_sys_allocate(sizeof(struct Parrot_Sub));
- memcpy(sub, PMC_sub(SELF), sizeof(struct Parrot_Sub));
- PMC_struct_val(ret) = PMC_struct_val(SELF);
- PObj_custom_mark_destroy_SETALL(ret);
- return ret;
+ struct Parrot_Sub * sub;
+ PMC* ret = pmc_new_noinit(INTERP, SELF->vtable->base_type);
+ sub = PMC_sub(ret) = mem_sys_allocate(sizeof(struct Parrot_Sub));
+ memcpy(sub, PMC_sub(SELF), sizeof(struct Parrot_Sub));
+ PMC_struct_val(ret) = PMC_struct_val(SELF);
+ PObj_custom_mark_destroy_SETALL(ret);
+ return ret;
}
}
@@ -74,3 +74,13 @@ 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:
+*/
View
449 classes/sarray.pmc
@@ -27,7 +27,7 @@ Last index, for C<push>.
Data.
=back
-
+
This is the Simple (or Static) Array class for parameter
passing according to PDD 3.
@@ -61,12 +61,12 @@ static PARROT_INLINE INTVAL
ret_int(Parrot_Interp interpreter, HashEntry *e)
{
switch (e->type) {
- case enum_hash_int:
- return UVal_int(e->val);
- case enum_hash_pmc:
- return VTABLE_get_integer(interpreter, UVal_pmc(e->val));
- default:
- break;
+ case enum_hash_int:
+ return UVal_int(e->val);
+ case enum_hash_pmc:
+ return VTABLE_get_integer(interpreter, UVal_pmc(e->val));
+ default:
+ break;
}
internal_exception(OUT_OF_BOUNDS, "SArray: Entry not an integer!\n");
return 0;
@@ -88,12 +88,12 @@ static PARROT_INLINE FLOATVAL
ret_num(Parrot_Interp interpreter, HashEntry *e)
{
switch (e->type) {
- case enum_hash_num:
- return UVal_num(e->val);
- case enum_hash_pmc:
- return VTABLE_get_number(interpreter, UVal_pmc(e->val));
- default:
- break;
+ case enum_hash_num:
+ return UVal_num(e->val);
+ case enum_hash_pmc:
+ return VTABLE_get_number(interpreter, UVal_pmc(e->val));
+ default:
+ break;
}
internal_exception(OUT_OF_BOUNDS, "SArray: Entry not a number!\n");
return 0;
@@ -115,12 +115,12 @@ static PARROT_INLINE STRING*
ret_string(Parrot_Interp interpreter, HashEntry *e)
{
switch (e->type) {
- case enum_hash_string:
- return UVal_str(e->val);
- case enum_hash_pmc:
- return VTABLE_get_string(interpreter, UVal_pmc(e->val));
- default:
- break;
+ case enum_hash_string:
+ return UVal_str(e->val);
+ case enum_hash_pmc:
+ return VTABLE_get_string(interpreter, UVal_pmc(e->val));
+ default:
+ break;
}
internal_exception(OUT_OF_BOUNDS, "SArray: Entry not a string!\n");
return 0;
@@ -143,22 +143,22 @@ ret_pmc(Parrot_Interp interpreter, HashEntry *e)
{
PMC *ret;
switch (e->type) {
- case enum_hash_int:
- ret = pmc_new(interpreter, enum_class_PerlUndef);
- VTABLE_set_integer_native(interpreter, ret, UVal_int(e->val));
- return ret;
- case enum_hash_num:
- ret = pmc_new(interpreter, enum_class_PerlUndef);
- VTABLE_set_number_native(interpreter, ret, UVal_num(e->val));
- return ret;
- case enum_hash_string:
- ret = pmc_new(interpreter, enum_class_PerlUndef);
- VTABLE_set_string_native(interpreter, ret, UVal_str(e->val));
- return ret;
- case enum_hash_pmc:
- return UVal_pmc(e->val);
- default:
- internal_exception(OUT_OF_BOUNDS, "SArray: Unknown entry!\n");
+ case enum_hash_int:
+ ret = pmc_new(interpreter, enum_class_PerlUndef);
+ VTABLE_set_integer_native(interpreter, ret, UVal_int(e->val));
+ return ret;
+ case enum_hash_num:
+ ret = pmc_new(interpreter, enum_class_PerlUndef);
+ VTABLE_set_number_native(interpreter, ret, UVal_num(e->val));
+ return ret;
+ case enum_hash_string:
+ ret = pmc_new(interpreter, enum_class_PerlUndef);
+ VTABLE_set_string_native(interpreter, ret, UVal_str(e->val));
+ return ret;
+ case enum_hash_pmc:
+ return UVal_pmc(e->val);
+ default:
+ internal_exception(OUT_OF_BOUNDS, "SArray: Unknown entry!\n");
}
return NULL;
}
@@ -183,7 +183,7 @@ shift_entry(PMC *self)
INTVAL end_index = UVal_int(e[1].val);
if (start_index >= end_index)
- internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!\n");
+ internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!\n");
ret = (HashEntry *) PMC_data(self) + (2 + start_index++);
@@ -211,11 +211,11 @@ get_entry(PMC *self, INTVAL key)
INTVAL end_index = UVal_int(e[1].val);
if (key < 0) {
- key += end_index;
+ key += end_index;
}
key += start_index; /* lower bound if already shifted */
if (key < start_index || key >= end_index)
- internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!\n");
+ internal_exception(OUT_OF_BOUNDS, "SArray index out of bounds!\n");
e = (HashEntry *) PMC_data(self) + (2 + key);
return e;
}
@@ -239,7 +239,7 @@ Initializes the array.
*/
void init () {
- PMC_int_val(SELF) = 0;
+ PMC_int_val(SELF) = 0;
PMC_data(SELF) = NULL;
}
@@ -254,7 +254,7 @@ Const classes must have a C<morph()>.
*/
void morph(INTVAL type) {
- SUPER(type);
+ SUPER(type);
}
/*
@@ -268,28 +268,28 @@ Marks the array as live.
*/
void mark () {
- HashEntry *e;
- int i, start, end;
- if (!PMC_data(SELF))
- return;
- e = (HashEntry *) PMC_data(SELF);
- start = UVal_int(e[0].val);
- end = UVal_int(e[1].val);
- e = (HashEntry *) PMC_data(SELF) + (2 + start);
- for (i = start; i < end; i++, e++) {
- switch (e->type) {
- case enum_hash_string:
- if (UVal_str(e->val))
- pobject_lives(INTERP, (PObj *) UVal_str(e->val));
- break;
- case enum_hash_pmc:
- if (UVal_pmc(e->val))
- pobject_lives(INTERP, (PObj *) UVal_pmc(e->val));
- break;
- default:
- break;
- }
- }
+ HashEntry *e;
+ int i, start, end;
+ if (!PMC_data(SELF))
+ return;
+ e = (HashEntry *) PMC_data(SELF);
+ start = UVal_int(e[0].val);
+ end = UVal_int(e[1].val);
+ e = (HashEntry *) PMC_data(SELF) + (2 + start);
+ for (i = start; i < end; i++, e++) {
+ switch (e->type) {
+ case enum_hash_string:
+ if (UVal_str(e->val))
+ pobject_lives(INTERP, (PObj *) UVal_str(e->val));
+ break;
+ case enum_hash_pmc:
+ if (UVal_pmc(e->val))
+ pobject_lives(INTERP, (PObj *) UVal_pmc(e->val));
+ break;
+ default:
+ break;
+ }
+ }
}
/*
@@ -305,7 +305,7 @@ Destroys the array.
void destroy () {
if (PMC_data(SELF))
mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ PMC_data(SELF) = NULL;
}
/*
@@ -319,46 +319,46 @@ Creates and returns a copy of the array.
*/
PMC* clone () {
- HashEntry *e, *d;
- int i, start, end;
- INTVAL size;
- PMC * dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- if (!PMC_data(SELF))
- return dest;
- size = PMC_int_val(SELF);
- PMC_int_val(dest) = size;
- PMC_data(dest) = mem_sys_allocate_zeroed((2 + size) *
- sizeof(HashEntry));
- e = (HashEntry *) PMC_data(SELF);
- d = (HashEntry *) PMC_data(dest);
- start = UVal_int(e[0].val);
- end = UVal_int(e[1].val);
- UVal_int(d[0].val) = start;
- UVal_int(d[1].val) = end;
- e = (HashEntry *) PMC_data(SELF) + (2 + start);
- d = (HashEntry *) PMC_data(dest) + (2 + start);
- for (i = start; i < end; i++, e++, d++) {
- d->type = e->type;
- switch (e->type) {
- case enum_hash_int:
- UVal_int(d->val) = UVal_int(e->val);
- break;
- case enum_hash_num:
- UVal_num(d->val) = UVal_num(e->val);
- break;
- case enum_hash_string:
- UVal_str(d->val) = string_copy(INTERP, UVal_str(e->val));
- break;
- case enum_hash_pmc:
- UVal_pmc(d->val) = VTABLE_clone(INTERP, UVal_pmc(e->val));
- break;
- default:
- break;
- }
- }
- PObj_custom_mark_destroy_SETALL(dest);
- return dest;
+ HashEntry *e, *d;
+ int i, start, end;
+ INTVAL size;
+ PMC * dest = pmc_new(INTERP, SELF->vtable->base_type);
+
+ if (!PMC_data(SELF))
+ return dest;
+ size = PMC_int_val(SELF);
+ PMC_int_val(dest) = size;
+ PMC_data(dest) = mem_sys_allocate_zeroed((2 + size) *
+ sizeof(HashEntry));
+ e = (HashEntry *) PMC_data(SELF);
+ d = (HashEntry *) PMC_data(dest);
+ start = UVal_int(e[0].val);
+ end = UVal_int(e[1].val);
+ UVal_int(d[0].val) = start;
+ UVal_int(d[1].val) = end;
+ e = (HashEntry *) PMC_data(SELF) + (2 + start);
+ d = (HashEntry *) PMC_data(dest) + (2 + start);
+ for (i = start; i < end; i++, e++, d++) {
+ d->type = e->type;
+ switch (e->type) {
+ case enum_hash_int:
+ UVal_int(d->val) = UVal_int(e->val);
+ break;
+ case enum_hash_num:
+ UVal_num(d->val) = UVal_num(e->val);
+ break;
+ case enum_hash_string:
+ UVal_str(d->val) = string_copy(INTERP, UVal_str(e->val));
+ break;
+ case enum_hash_pmc:
+ UVal_pmc(d->val) = VTABLE_clone(INTERP, UVal_pmc(e->val));
+ break;
+ default:
+ break;
+ }
+ }
+ PObj_custom_mark_destroy_SETALL(dest);
+ return dest;
}
/*
@@ -385,11 +385,11 @@ Returns whether the array has any elements.
*/
INTVAL elements () {
- HashEntry *e;
- if (!PMC_data(SELF))
- return 0;
- e = (HashEntry *) PMC_data(SELF);
- return UVal_int(e[1].val) - UVal_int(e[0].val);
+ HashEntry *e;
+ if (!PMC_data(SELF))
+ return 0;
+ e = (HashEntry *) PMC_data(SELF);
+ return UVal_int(e[1].val) - UVal_int(e[0].val);
}
/*
@@ -418,7 +418,7 @@ Returns the type of the element at index C<key>.
INTVAL type_keyed_int (INTVAL key) {
HashEntry *e = get_entry(SELF, key);
- return e->type;
+ return e->type;
}
/*
@@ -433,7 +433,7 @@ Returns the integer value of the element at index C<key>.
INTVAL get_integer_keyed_int (INTVAL key) {
HashEntry *e = get_entry(SELF, key);
- return ret_int(INTERP, e);
+ return ret_int(INTERP, e);