[decnum-dynpmcs] r181 committed - Convert DecNum and DecInt to use auto_attrs.

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 29, 2009, 12:15:10 PM8/29/09
to decnum-...@googlegroups.com
Revision: 181
Author: arbelo
Date: Sat Aug 29 06:09:45 2009
Log: Convert DecNum and DecInt to use auto_attrs.


http://code.google.com/p/decnum-dynpmcs/source/detail?r=181

Modified:
/trunk/src/pmc/decint.pmc
/trunk/src/pmc/decnum.pmc

=======================================
--- /trunk/src/pmc/decint.pmc Wed Aug 26 15:24:59 2009
+++ /trunk/src/pmc/decint.pmc Sat Aug 29 06:09:45 2009
@@ -35,7 +35,7 @@
}

pmclass DecInt
- dynpmc
+ dynpmc auto_attrs
group decnumber
extends DecNum {

=======================================
--- /trunk/src/pmc/decnum.pmc Wed Aug 26 14:11:19 2009
+++ /trunk/src/pmc/decnum.pmc Sat Aug 29 06:09:45 2009
@@ -29,7 +29,7 @@
}

pmclass DecNum
- dynpmc
+ dynpmc auto_attrs
group decnumber
extends DecBase {

@@ -38,31 +38,18 @@

VTABLE void init() {
INTVAL context_type;
- Parrot_DecNum_attributes *attr = NULL;
-
- if (decContextTestEndian(1)) {
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INVALID_OPERATION,
- "This dynpmc has been compiled with the wrong endianness.");
- }
-
- attr = mem_allocate_zeroed_typed(Parrot_DecNum_attributes);
- attr->ctx = NULL;
-
- attr->number = mem_allocate_typed(decNumber);
- decNumberZero(attr->number);
+
+ PARROT_DECNUM(SELF)->number = mem_allocate_typed(decNumber);
+ decNumberZero(PARROT_DECNUM(SELF)->number);

context_type = pmc_type(interp,
CONST_STRING(interp, "DecNumContext"));
- attr->context = pmc_new(interp, context_type);
-
- PMC_data(SELF) = attr;
+ PARROT_DECNUM(SELF)->context = pmc_new(interp, context_type);

PObj_active_destroy_SET(SELF);
}

VTABLE void destroy() {
mem_sys_free(PARROT_DECNUM(SELF)->number);
- mem_sys_free(PMC_data(SELF));
}

VTABLE void freeze(visit_info *info) {

Reply all
Reply to author
Forward
0 new messages