[svn:parrot] r42915 - trunk/src/pmc
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Sun Dec 6 14:42:14 UTC 2009
Author: fperrad
Date: Sun Dec 6 14:42:12 2009
New Revision: 42915
URL: https://trac.parrot.org/parrot/changeset/42915
Log:
[cage] improve C indentation, see TT #1329
Modified:
trunk/src/pmc/callsignature.pmc
trunk/src/pmc/class.pmc
trunk/src/pmc/codestring.pmc
trunk/src/pmc/complex.pmc
trunk/src/pmc/default.pmc
trunk/src/pmc/filehandle.pmc
trunk/src/pmc/fixedpmcarray.pmc
trunk/src/pmc/hash.pmc
trunk/src/pmc/integer.pmc
trunk/src/pmc/key.pmc
trunk/src/pmc/nci.pmc
trunk/src/pmc/orderedhash.pmc
trunk/src/pmc/packfile.pmc
trunk/src/pmc/packfileconstanttable.pmc
trunk/src/pmc/packfiledirectory.pmc
trunk/src/pmc/parrotinterpreter.pmc
trunk/src/pmc/timer.pmc
trunk/src/pmc/unmanagedstruct.pmc
Modified: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/callsignature.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -186,18 +186,18 @@
autobox_intval(PARROT_INTERP, Pcc_cell *cell)
{
switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return CELL_INT(cell);
- case FLOATCELL:
- return (INTVAL)CELL_FLOAT(cell);
- case STRINGCELL:
- return CELL_STRING(cell) ? Parrot_str_to_int(interp, CELL_STRING(cell)) : 0;
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? 0
- : VTABLE_get_integer(interp, CELL_PMC(cell));
- default:
- break;
+ case INTCELL:
+ return CELL_INT(cell);
+ case FLOATCELL:
+ return (INTVAL)CELL_FLOAT(cell);
+ case STRINGCELL:
+ return CELL_STRING(cell) ? Parrot_str_to_int(interp, CELL_STRING(cell)) : 0;
+ case PMCCELL:
+ return PMC_IS_NULL(CELL_PMC(cell))
+ ? 0
+ : VTABLE_get_integer(interp, CELL_PMC(cell));
+ default:
+ break;
}
/* exception */
@@ -208,18 +208,18 @@
autobox_floatval(PARROT_INTERP, Pcc_cell *cell)
{
switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return (FLOATVAL)CELL_INT(cell);
- case FLOATCELL:
- return CELL_FLOAT(cell);
- case STRINGCELL:
- return CELL_STRING(cell) ? Parrot_str_to_num(interp, CELL_STRING(cell)) : 0.0;
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? 0.0
- : VTABLE_get_number(interp, CELL_PMC(cell));
- default:
- break;
+ case INTCELL:
+ return (FLOATVAL)CELL_INT(cell);
+ case FLOATCELL:
+ return CELL_FLOAT(cell);
+ case STRINGCELL:
+ return CELL_STRING(cell) ? Parrot_str_to_num(interp, CELL_STRING(cell)) : 0.0;
+ case PMCCELL:
+ return PMC_IS_NULL(CELL_PMC(cell))
+ ? 0.0
+ : VTABLE_get_number(interp, CELL_PMC(cell));
+ default:
+ break;
}
/* exception */
@@ -230,18 +230,18 @@
autobox_string(PARROT_INTERP, Pcc_cell *cell)
{
switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return Parrot_str_from_int(interp, CELL_INT(cell));
- case FLOATCELL:
- return Parrot_str_from_num(interp, CELL_FLOAT(cell));
- case STRINGCELL:
- return CELL_STRING(cell);
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? NULL
- : VTABLE_get_string(interp, CELL_PMC(cell));
- default:
- break;
+ case INTCELL:
+ return Parrot_str_from_int(interp, CELL_INT(cell));
+ case FLOATCELL:
+ return Parrot_str_from_num(interp, CELL_FLOAT(cell));
+ case STRINGCELL:
+ return CELL_STRING(cell);
+ case PMCCELL:
+ return PMC_IS_NULL(CELL_PMC(cell))
+ ? NULL
+ : VTABLE_get_string(interp, CELL_PMC(cell));
+ default:
+ break;
}
/* exception */
@@ -254,23 +254,23 @@
PMC *result = PMCNULL;
switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_Integer));
- VTABLE_set_integer_native(interp, result, CELL_INT(cell));
- break;
- case FLOATCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_Float));
- VTABLE_set_number_native(interp, result, CELL_FLOAT(cell));
- break;
- case STRINGCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_String));
- VTABLE_set_string_native(interp, result, CELL_STRING(cell));
- break;
- case PMCCELL:
- return CELL_PMC(cell);
- default:
- /* exception */
- break;
+ case INTCELL:
+ result = pmc_new(interp, HLL_TYPE(enum_class_Integer));
+ VTABLE_set_integer_native(interp, result, CELL_INT(cell));
+ break;
+ case FLOATCELL:
+ result = pmc_new(interp, HLL_TYPE(enum_class_Float));
+ VTABLE_set_number_native(interp, result, CELL_FLOAT(cell));
+ break;
+ case STRINGCELL:
+ result = pmc_new(interp, HLL_TYPE(enum_class_String));
+ VTABLE_set_string_native(interp, result, CELL_STRING(cell));
+ break;
+ case PMCCELL:
+ return CELL_PMC(cell);
+ default:
+ /* exception */
+ break;
}
return result;
@@ -296,18 +296,18 @@
{
while (c) {
switch (CELL_TYPE_MASK(c)) {
- case STRINGCELL:
- if (CELL_STRING(c))
- Parrot_gc_mark_STRING_alive(interp, CELL_STRING(c));
- break;
- case PMCCELL:
- if (!PMC_IS_NULL(CELL_PMC(c)))
- Parrot_gc_mark_PMC_alive(interp, CELL_PMC(c));
- break;
- case INTCELL:
- case FLOATCELL:
- default:
- break;
+ case STRINGCELL:
+ if (CELL_STRING(c))
+ Parrot_gc_mark_STRING_alive(interp, CELL_STRING(c));
+ break;
+ case PMCCELL:
+ if (!PMC_IS_NULL(CELL_PMC(c)))
+ Parrot_gc_mark_PMC_alive(interp, CELL_PMC(c));
+ break;
+ case INTCELL:
+ case FLOATCELL:
+ default:
+ break;
}
c = NEXT_CELL(c);
@@ -498,21 +498,21 @@
while (c) {
switch (CELL_TYPE_MASK(c)) {
- case INTCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "I"));
- break;
- case FLOATCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "N"));
- break;
- case STRINGCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "S"));
- break;
- case PMCCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "P"));
- break;
- default:
- PARROT_ASSERT(!"Impossible flag");
- break;
+ case INTCELL:
+ res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "I"));
+ break;
+ case FLOATCELL:
+ res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "N"));
+ break;
+ case STRINGCELL:
+ res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "S"));
+ break;
+ case PMCCELL:
+ res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "P"));
+ break;
+ default:
+ PARROT_ASSERT(!"Impossible flag");
+ break;
}
c = NEXT_CELL(c);
}
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/class.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -537,36 +537,36 @@
/* fast attempt to determine init_data type */
switch (arg_type) {
- case enum_class_String:
- case enum_class_Key:
- case enum_class_ResizableStringArray:
- case enum_class_NameSpace:
+ case enum_class_String:
+ case enum_class_Key:
+ case enum_class_ResizableStringArray:
+ case enum_class_NameSpace:
+ /* set only the name property */
+ arg = pmc_new(interp, enum_class_Hash);
+ VTABLE_set_pmc_keyed_str(interp, arg, name_str, init_data);
+ break;
+
+ case enum_class_Hash:
+ arg = init_data;
+ break;
+
+ /* slow attempt to determine init_data type */
+ default:
+ if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "String"))
+ || VTABLE_isa(interp, init_data, CONST_STRING(interp, "Key"))
+ || VTABLE_isa(interp, init_data, CONST_STRING(interp, "ResizableStringArray"))) {
/* set only the name property */
arg = pmc_new(interp, enum_class_Hash);
VTABLE_set_pmc_keyed_str(interp, arg, name_str, init_data);
- break;
+ }
- case enum_class_Hash:
+ if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "Hash")))
arg = init_data;
- break;
-
- /* slow attempt to determine init_data type */
- default:
- if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "String"))
- || VTABLE_isa(interp, init_data, CONST_STRING(interp, "Key"))
- || VTABLE_isa(interp, init_data, CONST_STRING(interp, "ResizableStringArray"))) {
- /* set only the name property */
- arg = pmc_new(interp, enum_class_Hash);
- VTABLE_set_pmc_keyed_str(interp, arg, name_str, init_data);
- }
-
- if (VTABLE_isa(interp, init_data, CONST_STRING(interp, "Hash")))
- arg = init_data;
- else
- Parrot_ex_throw_from_c_args(INTERP, NULL,
+ else
+ Parrot_ex_throw_from_c_args(INTERP, NULL,
EXCEPTION_INVALID_OPERATION,
"Invalid class name key in init_pmc for Class");
- break;
+ break;
}
/* Initialize the class with the supplied data. */
Modified: trunk/src/pmc/codestring.pmc
==============================================================================
--- trunk/src/pmc/codestring.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/codestring.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -47,12 +47,12 @@
*/
- VTABLE void init() {
- Parrot_CodeString_attributes * const attrs = PARROT_CODESTRING(SELF);
- SUPER();
- attrs->linepos = PMCNULL;
- PObj_custom_mark_SET(SELF);
- }
+ VTABLE void init() {
+ Parrot_CodeString_attributes * const attrs = PARROT_CODESTRING(SELF);
+ SUPER();
+ attrs->linepos = PMCNULL;
+ PObj_custom_mark_SET(SELF);
+ }
/*
@@ -64,12 +64,12 @@
*/
- VTABLE void mark() {
- Parrot_CodeString_attributes * const attrs = PARROT_CODESTRING(SELF);
- SUPER();
- if (!attrs) return;
- Parrot_gc_mark_PMC_alive(INTERP, attrs->linepos);
- }
+ VTABLE void mark() {
+ Parrot_CodeString_attributes * const attrs = PARROT_CODESTRING(SELF);
+ SUPER();
+ if (!attrs) return;
+ Parrot_gc_mark_PMC_alive(INTERP, attrs->linepos);
+ }
/*
Modified: trunk/src/pmc/complex.pmc
==============================================================================
--- trunk/src/pmc/complex.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/complex.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -287,31 +287,31 @@
const INTVAL arg_type = VTABLE_type(interp, initializer);
SELF.init();
switch (arg_type) {
- case enum_class_String:
- SELF.set_string_native(VTABLE_get_string(interp, initializer));
+ case enum_class_String:
+ SELF.set_string_native(VTABLE_get_string(interp, initializer));
+ break;
+ case enum_class_FixedFloatArray:
+ case enum_class_ResizableFloatArray:
+ case enum_class_FixedIntegerArray:
+ case enum_class_ResizableIntegerArray:
+ if (VTABLE_get_integer(interp, initializer) == 2) {
+ FLOATVAL re = VTABLE_get_number_keyed_int(interp, initializer, 0);
+ FLOATVAL im = VTABLE_get_number_keyed_int(interp, initializer, 1);
+ SET_ATTR_re(INTERP, SELF, re);
+ SET_ATTR_im(INTERP, SELF, im);
break;
- case enum_class_FixedFloatArray:
- case enum_class_ResizableFloatArray:
- case enum_class_FixedIntegerArray:
- case enum_class_ResizableIntegerArray:
- if (VTABLE_get_integer(interp, initializer) == 2) {
- FLOATVAL re = VTABLE_get_number_keyed_int(interp, initializer, 0);
- FLOATVAL im = VTABLE_get_number_keyed_int(interp, initializer, 1);
- SET_ATTR_re(INTERP, SELF, re);
- SET_ATTR_im(INTERP, SELF, im);
- break;
- }
- /* else let it fall to default */
- default:
- if (VTABLE_isa(interp, initializer, CONST_STRING(interp, "String"))) {
- STRING * s = VTABLE_get_string(interp, initializer);
- SELF.set_string_native(s);
- }
- else {
- Parrot_ex_throw_from_c_args(interp, NULL,
+ }
+ /* else let it fall to default */
+ default:
+ if (VTABLE_isa(interp, initializer, CONST_STRING(interp, "String"))) {
+ STRING * s = VTABLE_get_string(interp, initializer);
+ SELF.set_string_native(s);
+ }
+ else {
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
"Invalid Complex initializer");
- }
+ }
}
}
@@ -479,14 +479,14 @@
VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
FLOATVAL f;
switch (key) {
- case 0:
- GET_ATTR_re(INTERP, SELF, f);
- break;
- case 1:
- GET_ATTR_im(INTERP, SELF, f);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
+ case 0:
+ GET_ATTR_re(INTERP, SELF, f);
+ break;
+ case 1:
+ GET_ATTR_im(INTERP, SELF, f);
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_INVALID_OPERATION, "Complex: key must be 0 or 1");
}
return f;
@@ -494,14 +494,14 @@
VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL v) {
switch (key) {
- case 0:
- SET_ATTR_re(INTERP, SELF, v);
- break;
- case 1:
- SET_ATTR_im(INTERP, SELF, v);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
+ case 0:
+ SET_ATTR_re(INTERP, SELF, v);
+ break;
+ case 1:
+ SET_ATTR_im(INTERP, SELF, v);
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_INVALID_OPERATION, "Complex: key must be 0 or 1");
}
}
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/default.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -893,8 +893,8 @@
*/
VTABLE INTVAL isa_pmc(PMC *lookup) {
- Hash * const isa_hash = SELF->vtable->isa_hash;
- STRING *pmc_name;
+ Hash * const isa_hash = SELF->vtable->isa_hash;
+ STRING *pmc_name;
if (PMC_IS_NULL(lookup))
return 0;
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/filehandle.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -172,11 +172,11 @@
VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
INTVAL result;
switch (key) {
- case 0:
- GET_ATTR_process_id(INTERP, SELF, result);
- break;
- default:
- result = 0;
+ case 0:
+ GET_ATTR_process_id(INTERP, SELF, result);
+ break;
+ default:
+ result = 0;
}
return result;
@@ -196,11 +196,11 @@
VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
switch (key) {
- case 0:
- SET_ATTR_process_id(INTERP, SELF, value);
- break;
- default:
- break;
+ case 0:
+ SET_ATTR_process_id(INTERP, SELF, value);
+ break;
+ default:
+ break;
}
}
Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/fixedpmcarray.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -45,13 +45,13 @@
const INTVAL n = SELF.elements();
if (n > 1) {
- /* XXX Workaround for TT #218 */
- if (PObj_is_object_TEST(SELF)) {
- PMC *parent = SELF.get_attr_str(CONST_STRING(interp, "proxy"));
- Parrot_pcc_invoke_method_from_c_args(interp, parent, CONST_STRING(interp, "sort"), "P->", cmp_func);
- }
- else
- Parrot_quicksort(interp, (void **)PMC_array(SELF), n, cmp_func);
+ /* XXX Workaround for TT #218 */
+ if (PObj_is_object_TEST(SELF)) {
+ PMC *parent = SELF.get_attr_str(CONST_STRING(interp, "proxy"));
+ Parrot_pcc_invoke_method_from_c_args(interp, parent, CONST_STRING(interp, "sort"), "P->", cmp_func);
+ }
+ else
+ Parrot_quicksort(interp, (void **)PMC_array(SELF), n, cmp_func);
}
}
Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/hash.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -233,17 +233,17 @@
old_hash = parrot_new_hash(INTERP);
switch (type) {
- case enum_type_INTVAL:
- case enum_type_STRING:
- case enum_type_PMC:
- new_hash = parrot_create_hash(interp,
+ case enum_type_INTVAL:
+ case enum_type_STRING:
+ case enum_type_PMC:
+ new_hash = parrot_create_hash(interp,
(PARROT_DATA_TYPE)type,
old_hash->key_type,
old_hash->compare,
old_hash->hash_val);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
"Hash: unsupported entry_type %d", type);
}
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/integer.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -1099,17 +1099,17 @@
PMC *temp;
switch (value->vtable->base_type) {
- case enum_class_BigInt:
- temp = pmc_new(INTERP, enum_class_BigInt);
- VTABLE_set_integer_native(INTERP, temp, SELF.get_integer());
- Parrot_mmd_multi_dispatch_from_c_args(interp,
+ case enum_class_BigInt:
+ temp = pmc_new(INTERP, enum_class_BigInt);
+ VTABLE_set_integer_native(INTERP, temp, SELF.get_integer());
+ Parrot_mmd_multi_dispatch_from_c_args(interp,
"is_equal", "PP->I", temp, value, &retval);
- return retval;
- break;
- default:
- return (VTABLE_get_integer(INTERP, SELF)
- == VTABLE_get_integer(INTERP, value));
- break;
+ return retval;
+ break;
+ default:
+ return (VTABLE_get_integer(INTERP, SELF)
+ == VTABLE_get_integer(INTERP, value));
+ break;
}
}
Modified: trunk/src/pmc/key.pmc
==============================================================================
--- trunk/src/pmc/key.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/key.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -60,28 +60,28 @@
for (; key ;) {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
- case KEY_integer_FLAG:
- case KEY_integer_FLAG | KEY_register_FLAG:
- key_set_integer(INTERP, dkey, key_integer(INTERP, key));
- break;
- case KEY_number_FLAG:
- case KEY_number_FLAG | KEY_register_FLAG:
- key_set_number(INTERP, dkey, key_number(INTERP, key));
- break;
- case KEY_string_FLAG:
- case KEY_string_FLAG | KEY_register_FLAG:
- key_set_string(INTERP, dkey,
+ case KEY_integer_FLAG:
+ case KEY_integer_FLAG | KEY_register_FLAG:
+ key_set_integer(INTERP, dkey, key_integer(INTERP, key));
+ break;
+ case KEY_number_FLAG:
+ case KEY_number_FLAG | KEY_register_FLAG:
+ key_set_number(INTERP, dkey, key_number(INTERP, key));
+ break;
+ case KEY_string_FLAG:
+ case KEY_string_FLAG | KEY_register_FLAG:
+ key_set_string(INTERP, dkey,
Parrot_str_copy(INTERP, VTABLE_get_string(INTERP, key)));
- break;
- case KEY_pmc_FLAG:
- case KEY_pmc_FLAG | KEY_register_FLAG:
- {
+ break;
+ case KEY_pmc_FLAG:
+ case KEY_pmc_FLAG | KEY_register_FLAG:
+ {
PMC * const p = key_pmc(INTERP, key);
key_set_pmc(INTERP, dkey, VTABLE_clone(INTERP, p));
- }
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
key = key_next(INTERP, key);
@@ -330,22 +330,22 @@
/* and contents of this key component */
switch (flags) {
- case KEY_integer_FLAG:
- case KEY_integer_FLAG | KEY_register_FLAG:
- VTABLE_push_integer(INTERP, io, key_integer(INTERP, SELF));
- break;
- case KEY_number_FLAG:
- case KEY_number_FLAG | KEY_register_FLAG:
- VTABLE_push_float(INTERP, io, key_number(INTERP, SELF));
- break;
- case KEY_string_FLAG:
- case KEY_string_FLAG | KEY_register_FLAG:
- VTABLE_push_string(INTERP, io, key_string(INTERP, SELF));
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
+ case KEY_integer_FLAG:
+ case KEY_integer_FLAG | KEY_register_FLAG:
+ VTABLE_push_integer(INTERP, io, key_integer(INTERP, SELF));
+ break;
+ case KEY_number_FLAG:
+ case KEY_number_FLAG | KEY_register_FLAG:
+ VTABLE_push_float(INTERP, io, key_number(INTERP, SELF));
+ break;
+ case KEY_string_FLAG:
+ case KEY_string_FLAG | KEY_register_FLAG:
+ VTABLE_push_string(INTERP, io, key_string(INTERP, SELF));
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
"Unsupported key type in Key.freeze");
- break;
+ break;
}
}
@@ -361,19 +361,19 @@
/* get contents */
switch (flags) {
- case KEY_integer_FLAG:
- SET_ATTR_int_key(INTERP, SELF, VTABLE_shift_integer(INTERP, io));
- break;
- case KEY_number_FLAG:
- VTABLE_set_number_native(INTERP, SELF, VTABLE_shift_float(INTERP, io));
- break;
- case KEY_string_FLAG:
- VTABLE_set_string_native(INTERP, SELF, VTABLE_shift_string(INTERP, io));
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
+ case KEY_integer_FLAG:
+ SET_ATTR_int_key(INTERP, SELF, VTABLE_shift_integer(INTERP, io));
+ break;
+ case KEY_number_FLAG:
+ VTABLE_set_number_native(INTERP, SELF, VTABLE_shift_float(INTERP, io));
+ break;
+ case KEY_string_FLAG:
+ VTABLE_set_string_native(INTERP, SELF, VTABLE_shift_string(INTERP, io));
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
"Unsupported key type in Key.thaw");
- break;
+ break;
}
}
Modified: trunk/src/pmc/nci.pmc
==============================================================================
--- trunk/src/pmc/nci.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/nci.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -36,53 +36,53 @@
INTVAL c = Parrot_str_indexed(interp, sig, i);
switch (c) {
- case (INTVAL)'0': /* null ptr or such - doesn't consume a reg */
- break;
- case (INTVAL)'f':
- case (INTVAL)'N':
- case (INTVAL)'d':
- param_sig[j++] = 'N';
- break;
- case (INTVAL)'I': /* INTVAL */
- case (INTVAL)'l': /* long */
- case (INTVAL)'i': /* int */
- case (INTVAL)'s': /* short */
- case (INTVAL)'c': /* char */
- param_sig[j++] = 'I';
- break;
- case (INTVAL)'S':
- case (INTVAL)'t': /* string, pass a cstring */
- param_sig[j++] = 'S';
- break;
- case (INTVAL)'J': /* interpreter */
- break;
- case (INTVAL)'p': /* push pmc->data */
- case (INTVAL)'O': /* push PMC * object in P2 */
- case (INTVAL)'P': /* push PMC * */
- case (INTVAL)'V': /* push PMC * */
- param_sig[j++] = 'P';
- case (INTVAL)'v':
- break;
- /* I have no idea how to handle these */
- case (INTVAL)'2':
- case (INTVAL)'3':
- case (INTVAL)'4':
- param_sig[j++] = 'I';
- break;
- case (INTVAL)'@':
- param_sig[j++] = '@';
- break;
- case (INTVAL)'b': /* buffer (void*) pass Buffer_bufstart(SReg) */
- case (INTVAL)'B': /* buffer (void**) pass &Buffer_bufstart(SReg) */
- param_sig[j++] = 'S';
- break;
- default:
- if (sig_length > 7)
- mem_sys_free(param_sig);
- Parrot_ex_throw_from_c_args(interp, NULL,
+ case (INTVAL)'0': /* null ptr or such - doesn't consume a reg */
+ break;
+ case (INTVAL)'f':
+ case (INTVAL)'N':
+ case (INTVAL)'d':
+ param_sig[j++] = 'N';
+ break;
+ case (INTVAL)'I': /* INTVAL */
+ case (INTVAL)'l': /* long */
+ case (INTVAL)'i': /* int */
+ case (INTVAL)'s': /* short */
+ case (INTVAL)'c': /* char */
+ param_sig[j++] = 'I';
+ break;
+ case (INTVAL)'S':
+ case (INTVAL)'t': /* string, pass a cstring */
+ param_sig[j++] = 'S';
+ break;
+ case (INTVAL)'J': /* interpreter */
+ break;
+ case (INTVAL)'p': /* push pmc->data */
+ case (INTVAL)'O': /* push PMC * object in P2 */
+ case (INTVAL)'P': /* push PMC * */
+ case (INTVAL)'V': /* push PMC * */
+ param_sig[j++] = 'P';
+ case (INTVAL)'v':
+ break;
+ /* I have no idea how to handle these */
+ case (INTVAL)'2':
+ case (INTVAL)'3':
+ case (INTVAL)'4':
+ param_sig[j++] = 'I';
+ break;
+ case (INTVAL)'@':
+ param_sig[j++] = '@';
+ break;
+ case (INTVAL)'b': /* buffer (void*) pass Buffer_bufstart(SReg) */
+ case (INTVAL)'B': /* buffer (void**) pass &Buffer_bufstart(SReg) */
+ param_sig[j++] = 'S';
+ break;
+ default:
+ if (sig_length > 7)
+ mem_sys_free(param_sig);
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_JIT_ERROR,
"Unknown param Signature %c\n", (char)c);
- break;
+ break;
}
}
Modified: trunk/src/pmc/orderedhash.pmc
==============================================================================
--- trunk/src/pmc/orderedhash.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/orderedhash.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -630,34 +630,34 @@
info->container = SELF;
switch (info->what) {
- case VISIT_THAW_NORMAL:
- case VISIT_THAW_CONSTANTS:
- SUPER(info);
- break;
-
- case VISIT_FREEZE_NORMAL:
- case VISIT_FREEZE_AT_DESTRUCT:
- {
- Hash * const hash = (Hash *)SELF.get_pointer();
- IMAGE_IO * const io = info->image_io;
- const UINTVAL entries = hash->entries;
- UINTVAL i;
-
- for (i = 0; i < entries; i++) {
- HashBucket * const b = hash->bs + i;
-
- if (b) {
- STRING * const key = (STRING *)b->key;
- if (key) {
- VTABLE_push_string(interp, io, key);
- (info->visit_pmc_now)(interp, (PMC *)b->value, info);
- }
+ case VISIT_THAW_NORMAL:
+ case VISIT_THAW_CONSTANTS:
+ SUPER(info);
+ break;
+
+ case VISIT_FREEZE_NORMAL:
+ case VISIT_FREEZE_AT_DESTRUCT:
+ {
+ Hash * const hash = (Hash *)SELF.get_pointer();
+ IMAGE_IO * const io = info->image_io;
+ const UINTVAL entries = hash->entries;
+ UINTVAL i;
+
+ for (i = 0; i < entries; i++) {
+ HashBucket * const b = hash->bs + i;
+
+ if (b) {
+ STRING * const key = (STRING *)b->key;
+ if (key) {
+ VTABLE_push_string(interp, io, key);
+ (info->visit_pmc_now)(interp, (PMC *)b->value, info);
}
}
}
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
+ }
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
"unhandled visit action (%d)", info->what);
}
Modified: trunk/src/pmc/packfile.pmc
==============================================================================
--- trunk/src/pmc/packfile.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/packfile.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -44,18 +44,18 @@
}
pmclass Packfile auto_attrs {
- ATTR INTVAL wordsize;
- ATTR INTVAL byteorder;
- ATTR INTVAL fptype;
- ATTR INTVAL version_major;
- ATTR INTVAL version_minor;
- ATTR INTVAL version_patch;
- ATTR INTVAL bytecode_major;
- ATTR INTVAL bytecode_minor;
- ATTR INTVAL uuid_type;
- ATTR STRING *uuid;
+ ATTR INTVAL wordsize;
+ ATTR INTVAL byteorder;
+ ATTR INTVAL fptype;
+ ATTR INTVAL version_major;
+ ATTR INTVAL version_minor;
+ ATTR INTVAL version_patch;
+ ATTR INTVAL bytecode_major;
+ ATTR INTVAL bytecode_minor;
+ ATTR INTVAL uuid_type;
+ ATTR STRING *uuid;
- ATTR PMC *directory;
+ ATTR PMC *directory;
/*
=item C<void init()>
Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/packfileconstanttable.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -98,21 +98,21 @@
for (i = 0; i < table->const_count; ++i) {
val = table->constants[i];
switch (val->type) {
- case PFC_NONE:
- break;
- case PFC_NUMBER:
- SELF.set_number_keyed_int(i, val->u.number);
- break;
- case PFC_STRING:
- SELF.set_string_keyed_int(i, val->u.string);
- break;
- case PFC_KEY:
- /* fall through */
- case PFC_PMC:
- SELF.set_pmc_keyed_int(i, val->u.key);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
+ case PFC_NONE:
+ break;
+ case PFC_NUMBER:
+ SELF.set_number_keyed_int(i, val->u.number);
+ break;
+ case PFC_STRING:
+ SELF.set_string_keyed_int(i, val->u.string);
+ break;
+ case PFC_KEY:
+ /* fall through */
+ case PFC_PMC:
+ SELF.set_pmc_keyed_int(i, val->u.key);
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_MALFORMED_PACKFILE,
"Unknown PackFile constant type: %d", val->type);
}
@@ -144,23 +144,23 @@
value = PackFile_Constant_new(interp);
value->type = VTABLE_get_integer_keyed_int(interp, attrs->types, i);
switch (value->type) {
- case PFC_NONE:
- break;
- case PFC_NUMBER:
- value->u.number = VTABLE_get_number_keyed_int(interp,
+ case PFC_NONE:
+ break;
+ case PFC_NUMBER:
+ value->u.number = VTABLE_get_number_keyed_int(interp,
attrs->constants, i);
- break;
- case PFC_STRING:
- value->u.string = VTABLE_get_string_keyed_int(interp,
+ break;
+ case PFC_STRING:
+ value->u.string = VTABLE_get_string_keyed_int(interp,
attrs->constants, i);
- break;
- case PFC_KEY:
- case PFC_PMC:
- value->u.key = VTABLE_get_pmc_keyed_int(interp,
+ break;
+ case PFC_KEY:
+ case PFC_PMC:
+ value->u.key = VTABLE_get_pmc_keyed_int(interp,
attrs->constants, i);
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL,
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_MALFORMED_PACKFILE,
"Unknown PackFile constant type: %d", value->type);
}
Modified: trunk/src/pmc/packfiledirectory.pmc
==============================================================================
--- trunk/src/pmc/packfiledirectory.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/packfiledirectory.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -90,24 +90,24 @@
STRING *name;
switch (pfseg->type) {
- case PF_DIR_SEG:
- pmc_type = enum_class_PackfileDirectory;
- break;
- case PF_FIXUP_SEG:
- pmc_type = enum_class_PackfileFixupTable;
- break;
- case PF_CONST_SEG:
- pmc_type = enum_class_PackfileConstantTable;
- break;
- case PF_ANNOTATIONS_SEG:
- pmc_type = enum_class_PackfileAnnotations;
- break;
- case PF_BYTEC_SEG:
- case PF_UNKNOWN_SEG:
- case PF_DEBUG_SEG:
- default:
- pmc_type = enum_class_PackfileRawSegment;
- break;
+ case PF_DIR_SEG:
+ pmc_type = enum_class_PackfileDirectory;
+ break;
+ case PF_FIXUP_SEG:
+ pmc_type = enum_class_PackfileFixupTable;
+ break;
+ case PF_CONST_SEG:
+ pmc_type = enum_class_PackfileConstantTable;
+ break;
+ case PF_ANNOTATIONS_SEG:
+ pmc_type = enum_class_PackfileAnnotations;
+ break;
+ case PF_BYTEC_SEG:
+ case PF_UNKNOWN_SEG:
+ case PF_DEBUG_SEG:
+ default:
+ pmc_type = enum_class_PackfileRawSegment;
+ break;
}
segment = pmc_new(interp, pmc_type);
Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/parrotinterpreter.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -127,12 +127,12 @@
PObj_is_class_TEST(s->vtables[i]->pmc_class)) {
/* Cloning the class into the new interpreter ought
* to be sufficient to instantiate the class. */
- PMC *source = s->vtables[i]->pmc_class;
- PMC *dest = Parrot_clone(d, source);
- Parrot_Class_attributes *source_class = PARROT_CLASS(source);
- Parrot_Class_attributes *dest_class = PARROT_CLASS(dest);
- dest_class->name = Parrot_str_copy(d, source_class->name);
- dest_class->_namespace = VTABLE_clone(d, source_class->_namespace);
+ PMC *source = s->vtables[i]->pmc_class;
+ PMC *dest = Parrot_clone(d, source);
+ Parrot_Class_attributes *source_class = PARROT_CLASS(source);
+ Parrot_Class_attributes *dest_class = PARROT_CLASS(dest);
+ dest_class->name = Parrot_str_copy(d, source_class->name);
+ dest_class->_namespace = VTABLE_clone(d, source_class->_namespace);
}
}
}
Modified: trunk/src/pmc/timer.pmc
==============================================================================
--- trunk/src/pmc/timer.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/timer.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -116,29 +116,29 @@
for (i = 0; i < n; i += 2) {
const INTVAL key = VTABLE_get_integer_keyed_int(INTERP, init, i);
switch (key) {
- case PARROT_TIMER_SEC:
- case PARROT_TIMER_USEC:
- case PARROT_TIMER_REPEAT:
- case PARROT_TIMER_RUNNING:
- {
+ case PARROT_TIMER_SEC:
+ case PARROT_TIMER_USEC:
+ case PARROT_TIMER_REPEAT:
+ case PARROT_TIMER_RUNNING:
+ {
const INTVAL val = VTABLE_get_integer_keyed_int(INTERP, init, i+1);
SELF.set_integer_keyed_int(key, val);
- }
- break;
- case PARROT_TIMER_NSEC:
- {
+ }
+ break;
+ case PARROT_TIMER_NSEC:
+ {
const FLOATVAL nval = VTABLE_get_number_keyed_int(INTERP, init, i+1);
SELF.set_number_keyed_int(key, nval);
- }
- break;
- case PARROT_TIMER_HANDLER:
- {
+ }
+ break;
+ case PARROT_TIMER_HANDLER:
+ {
PMC * const pval = VTABLE_get_pmc_keyed_int(INTERP, init, i+1);
SELF.set_pmc_keyed_int(key, pval);
- }
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
}
}
@@ -194,18 +194,18 @@
const FLOATVAL absolute_time = core_struct->birthtime + core_struct->duration;
switch (key) {
- case PARROT_TIMER_SEC:
- return (INTVAL)absolute_time;
- case PARROT_TIMER_USEC:
- return (INTVAL)((absolute_time - (INTVAL)absolute_time) *1000000.0);
- case PARROT_TIMER_REPEAT:
- return (INTVAL) core_struct->repeat;
- case PARROT_TIMER_INTERVAL:
- return (INTVAL) core_struct->interval;
- case PARROT_TIMER_RUNNING:
- return 0;
- default:
- return -1;
+ case PARROT_TIMER_SEC:
+ return (INTVAL)absolute_time;
+ case PARROT_TIMER_USEC:
+ return (INTVAL)((absolute_time - (INTVAL)absolute_time) *1000000.0);
+ case PARROT_TIMER_REPEAT:
+ return (INTVAL) core_struct->repeat;
+ case PARROT_TIMER_INTERVAL:
+ return (INTVAL) core_struct->interval;
+ case PARROT_TIMER_RUNNING:
+ return 0;
+ default:
+ return -1;
}
}
@@ -242,12 +242,12 @@
Parrot_Timer_attributes * const core_struct = PARROT_TIMER(SELF);
switch (key) {
- case PARROT_TIMER_NSEC:
- return core_struct->birthtime + core_struct->duration;
- case PARROT_TIMER_INTERVAL:
- return core_struct->interval;
- default:
- break;
+ case PARROT_TIMER_NSEC:
+ return core_struct->birthtime + core_struct->duration;
+ case PARROT_TIMER_INTERVAL:
+ return core_struct->interval;
+ default:
+ break;
}
return -1.0;
@@ -267,26 +267,26 @@
Parrot_Timer_attributes * const core_struct = PARROT_TIMER(SELF);
switch (key) {
- case PARROT_TIMER_SEC:
- core_struct->duration = value;
- break;
- case PARROT_TIMER_USEC:
- core_struct->duration += value / 1000000.0;
- break;
- case PARROT_TIMER_REPEAT:
- core_struct->repeat = value;
- break;
- case PARROT_TIMER_INTERVAL:
- core_struct->interval = value;
- break;
- case PARROT_TIMER_RUNNING:
- if (value)
- Parrot_cx_schedule_task(INTERP, SELF);
- else
- Parrot_cx_delete_task(INTERP, SELF);
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL,
+ case PARROT_TIMER_SEC:
+ core_struct->duration = value;
+ break;
+ case PARROT_TIMER_USEC:
+ core_struct->duration += value / 1000000.0;
+ break;
+ case PARROT_TIMER_REPEAT:
+ core_struct->repeat = value;
+ break;
+ case PARROT_TIMER_INTERVAL:
+ core_struct->interval = value;
+ break;
+ case PARROT_TIMER_RUNNING:
+ if (value)
+ Parrot_cx_schedule_task(INTERP, SELF);
+ else
+ Parrot_cx_delete_task(INTERP, SELF);
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL,
EXCEPTION_INVALID_OPERATION,
"Unknown timer type in Timer.set_integer_keyed_int: %d",
key);
@@ -342,14 +342,14 @@
Parrot_Timer_attributes * const core_struct = PARROT_TIMER(SELF);
switch (key) {
- case PARROT_TIMER_NSEC:
- core_struct->duration = value;
- break;
- case PARROT_TIMER_INTERVAL:
- core_struct->interval = value;
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL,
+ case PARROT_TIMER_NSEC:
+ core_struct->duration = value;
+ break;
+ case PARROT_TIMER_INTERVAL:
+ core_struct->interval = value;
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL,
EXCEPTION_INVALID_OPERATION,
"Unknown timer attribute in Timer.set_number_keyed_int: %d",
key);
Modified: trunk/src/pmc/unmanagedstruct.pmc
==============================================================================
--- trunk/src/pmc/unmanagedstruct.pmc Sun Dec 6 11:03:59 2009 (r42914)
+++ trunk/src/pmc/unmanagedstruct.pmc Sun Dec 6 14:42:12 2009 (r42915)
@@ -238,55 +238,55 @@
ret_int(PARROT_INTERP, const char *p, int type)
{
switch (type) {
- case enum_type_INTVAL:
- return *(const INTVAL*) p;
+ case enum_type_INTVAL:
+ return *(const INTVAL*) p;
#if INT_SIZE == 4
- case enum_type_int32:
- case enum_type_uint32:
+ case enum_type_int32:
+ case enum_type_uint32:
#endif
#if INT_SIZE == 8
- case enum_type_int64:
- case enum_type_uint64:
+ case enum_type_int64:
+ case enum_type_uint64:
#endif
- case enum_type_int:
- return *(const int *)p;
+ case enum_type_int:
+ return *(const int *)p;
#if (LONG_SIZE == 4) && !(INT_SIZE == 4) /* Unlikely combination. */
- case enum_type_int32:
- case enum_type_uint32:
+ case enum_type_int32:
+ case enum_type_uint32:
#endif
#if (LONG_SIZE == 8) && !(INT_SIZE == 8)
- case enum_type_int64:
- case enum_type_uint64:
+ case enum_type_int64:
+ case enum_type_uint64:
#endif
- case enum_type_long:
- case enum_type_ulong:
- return *(const long *)p;
+ case enum_type_long:
+ case enum_type_ulong:
+ return *(const long *)p;
#if SHORT_SIZE == 2
- case enum_type_int16:
- case enum_type_uint16:
+ case enum_type_int16:
+ case enum_type_uint16:
#endif
/* If SHORT_SIZE != 2 getting int16s requires extra tricks. */
- case enum_type_short:
- return *(const short *)p;
- case enum_type_uint8:
- case enum_type_uchar:
+ case enum_type_short:
+ return *(const short *)p;
+ case enum_type_uint8:
+ case enum_type_uchar:
{
const unsigned char *uc = (const unsigned char *)p;
return (INTVAL)*uc;
}
- case enum_type_int8:
- case enum_type_char:
- return *p;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ case enum_type_int8:
+ case enum_type_char:
+ return *p;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
"returning unhandled int type in struct");
}
}
@@ -310,14 +310,14 @@
ret_float(PARROT_INTERP, const char *p, int type)
{
switch (type) {
- case enum_type_FLOATVAL:
- return (FLOATVAL) *(const FLOATVAL *)p;
- case enum_type_float:
- return (FLOATVAL) *(const float *)p;
- case enum_type_double:
- return (FLOATVAL) *(const double *)p;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ case enum_type_FLOATVAL:
+ return (FLOATVAL) *(const FLOATVAL *)p;
+ case enum_type_float:
+ return (FLOATVAL) *(const float *)p;
+ case enum_type_double:
+ return (FLOATVAL) *(const double *)p;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
"returning unhandled float type in struct");
}
}
@@ -377,40 +377,40 @@
PMC *ptr = VTABLE_get_pmc_keyed_int(interp, init, idx * 3);
switch (type) {
- case enum_type_func_ptr:
- /* this is a raw function pointer - not a PMC */
- ret = *(PMC**) p;
-
- /* now check if initializer has a signature attached */
- if (PMC_metadata(ptr)) {
- STRING *signature_str = CONST_STRING(interp, "_signature");
- PMC *sig = VTABLE_getprop(interp, ptr, signature_str);
- if (VTABLE_defined(interp, sig)) {
- STRING *sig_str = VTABLE_get_string(interp, sig);
- ret = pmc_new(interp, enum_class_NCI);
- VTABLE_set_pointer_keyed_str(interp, ret, sig_str,
+ case enum_type_func_ptr:
+ /* this is a raw function pointer - not a PMC */
+ ret = *(PMC**) p;
+
+ /* now check if initializer has a signature attached */
+ if (PMC_metadata(ptr)) {
+ STRING *signature_str = CONST_STRING(interp, "_signature");
+ PMC *sig = VTABLE_getprop(interp, ptr, signature_str);
+ if (VTABLE_defined(interp, sig)) {
+ STRING *sig_str = VTABLE_get_string(interp, sig);
+ ret = pmc_new(interp, enum_class_NCI);
+ VTABLE_set_pointer_keyed_str(interp, ret, sig_str,
*(PMC **)p);
- }
}
+ }
- return ret;
- case enum_type_struct_ptr:
- /* check the metadata for an initializer */
-
- /* grab the struct from the metadata */
- if (PMC_metadata(ptr))
- ret = VTABLE_getprop(interp, ptr, CONST_STRING(interp, "_struct"));
- else {
- Parrot_ex_throw_from_c_args(interp, NULL,
+ return ret;
+ case enum_type_struct_ptr:
+ /* check the metadata for an initializer */
+
+ /* grab the struct from the metadata */
+ if (PMC_metadata(ptr))
+ ret = VTABLE_getprop(interp, ptr, CONST_STRING(interp, "_struct"));
+ else {
+ Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
"no initializer available for nested struct");
- }
+ }
- VTABLE_set_pointer(interp, ret, *(void**)p);
+ VTABLE_set_pointer(interp, ret, *(void**)p);
- return ret;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+ return ret;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"returning unhandled pmc type (%d) in struct", type);
}
}
@@ -428,27 +428,27 @@
set_int(PARROT_INTERP, char *p, int type, INTVAL value)
{
switch (type) {
- case enum_type_uint8:
- case enum_type_int8:
- case enum_type_char:
- case enum_type_uchar:
- *(char *)p = (char)(value & 0xff);
- break;
- case enum_type_INTVAL:
- *(INTVAL *)p = value;
- break;
- case enum_type_int:
- *(int *)p = value;
- break;
- case enum_type_int16:
- case enum_type_uint16:
- case enum_type_short:
- *(short *)p = (short)value;
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ case enum_type_uint8:
+ case enum_type_int8:
+ case enum_type_char:
+ case enum_type_uchar:
+ *(char *)p = (char)(value & 0xff);
+ break;
+ case enum_type_INTVAL:
+ *(INTVAL *)p = value;
+ break;
+ case enum_type_int:
+ *(int *)p = value;
+ break;
+ case enum_type_int16:
+ case enum_type_uint16:
+ case enum_type_short:
+ *(short *)p = (short)value;
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
"setting unhandled int type in struct");
- break;
+ break;
}
}
@@ -468,19 +468,19 @@
set_float(PARROT_INTERP, char *p, int type, FLOATVAL value)
{
switch (type) {
- case enum_type_FLOATVAL:
- *(FLOATVAL *)p = (FLOATVAL)value;
- break;
- case enum_type_float:
- *(float *)p = (float)value;
- break;
- case enum_type_double:
- *(double *)p = (double)value;
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ case enum_type_FLOATVAL:
+ *(FLOATVAL *)p = (FLOATVAL)value;
+ break;
+ case enum_type_float:
+ *(float *)p = (float)value;
+ break;
+ case enum_type_double:
+ *(double *)p = (double)value;
+ break;
+ default:
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
"setting unhandled float type in struct");
- break;
+ break;
}
}
More information about the parrot-commits
mailing list