Author: chromatic
Date: Sun Mar 30 18:40:37 2008
New Revision: 26648
Modified:
trunk/languages/amber/lib/kernel/pmc/amber_array.pmc
trunk/languages/amber/lib/kernel/pmc/amber_boolean.pmc
trunk/languages/amber/lib/kernel/pmc/amber_character.pmc
trunk/languages/amber/lib/kernel/pmc/amber_default.pmc
trunk/languages/amber/lib/kernel/pmc/amber_integer.pmc
trunk/languages/amber/lib/kernel/pmc/amber_pathname.pmc
trunk/languages/amber/lib/kernel/pmc/amber_string.pmc
trunk/languages/amber/lib/kernel/pmc/amber_table.pmc
Log:
[Amber] Updated PMCs to match PDD 17 changes.
Made PMCs use parrot/embed.h instead of parrot/parrot.h (RT #39043).
Modified: trunk/languages/amber/lib/kernel/pmc/amber_array.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_array.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_array.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_ARRAY PMC, which implementes the Amber kernel class ARRAY
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
pmclass Amber_ARRAY need_ext
extends Array
@@ -24,7 +24,7 @@
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(INTERP, result, VTABLE_get_integer(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -32,7 +32,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "ARRAY", 5));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* count() {
@@ -40,12 +40,13 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(
INTERP, result, VTABLE_get_integer(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* first() {
/* RT#48180 reject if count = 0 */
- return VTABLE_get_pmc_keyed_int(INTERP, SELF, (INTVAL) 0);
+ PMC *result = VTABLE_get_pmc_keyed_int(INTERP, SELF, (INTVAL) 0);
+ RETURN(PMC *result);
}
METHOD PMC* has(PMC* index) {
@@ -57,20 +58,26 @@
VTABLE_set_bool(INTERP, result, VTABLE_exists_keyed_int(
INTERP, SELF, adjusted_index));
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* item(PMC* index) {
/* RT#48182 reject out-of-range values (0, or > count, or < -count) */
+ PMC *result;
INTVAL adjusted_index = PMC_int_val(index);
- if (adjusted_index > 0) adjusted_index = adjusted_index - 1;
- return VTABLE_get_pmc_keyed_int(INTERP, SELF, adjusted_index);
+
+ if (adjusted_index > 0)
+ adjusted_index--;
+
+ result = VTABLE_get_pmc_keyed_int(INTERP, SELF, adjusted_index);
+ RETURN(PMC *result);
}
METHOD PMC* last() {
/* RT#48180 reject if count = 0 */
- return VTABLE_get_pmc_keyed_int(
+ PMC *result = VTABLE_get_pmc_keyed_int(
INTERP, SELF, VTABLE_get_integer(INTERP, SELF) - 1);
+ RETURN(PMC *result);
}
METHOD void set_count(PMC* new_count) {
Modified: trunk/languages/amber/lib/kernel/pmc/amber_boolean.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_boolean.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_boolean.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_BOOLEAN PMC, which implementes the Amber kernel class BOOLEAN
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
static INTVAL class_CHARACTER;
@@ -33,7 +33,7 @@
PMC* result = pmc_new(INTERP, class_CHARACTER);
VTABLE_set_integer_native(
INTERP, result, PMC_int_val(SELF) ? 't' : 'f');
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -41,14 +41,14 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "BOOLEAN", 7));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* integer() {
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(INTERP, result, PMC_int_val(SELF) ? 1 : 0);
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_character.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_character.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_character.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_CHARACTER PMC, which implementes the Amber kernel class
CHARACTER
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
pmclass Amber_CHARACTER
extends Integer
@@ -22,7 +22,7 @@
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -30,14 +30,14 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "CHARACTER", 9));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* integer() {
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_default.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_default.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_default.pmc Sun Mar 30
18:40:37 2008
@@ -5,14 +5,14 @@
* The am_default PMC, an abstract ancestor for the Amber PMCs
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
pmclass Amber_DEFAULT abstract dynpmc group amber_kernel {
/* non-vtable methods follow */
METHOD PMC* current() {
- return SELF;
+ RETURN(PMC *SELF);
}
METHOD PMC* is_defined() {
@@ -20,7 +20,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_integer_native(
INTERP, result, VTABLE_defined(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* string() {
@@ -28,14 +28,14 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, VTABLE_get_string(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* type_id() {
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(INTERP, result, SELF->vtable->base_type);
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_integer.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_integer.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_integer.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_INTEGER PMC, which implementes the Amber kernel class INTEGER
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
static INTVAL class_CHARACTER;
@@ -37,21 +37,21 @@
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(INTERP, result, abs(PMC_int_val(SELF)));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* boolean() {
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* character() {
/* RT#48186 consider Unicode */
PMC* result = pmc_new(INTERP, class_CHARACTER);
VTABLE_set_integer_native(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -59,18 +59,18 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "INTEGER", 7));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* current() {
- return SELF;
+ RETURN(PMC *SELF);
}
METHOD PMC* integer() {
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_pathname.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_pathname.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_pathname.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_PATHNAME PMC, which implementes the Amber kernel class
PATHNAME
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
#include <dirent.h>
static INTVAL class_PATHNAME;
@@ -67,7 +67,7 @@
start = end + 1;
}
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -75,7 +75,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "PATHNAME", 8));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* entry_names() {
@@ -103,7 +103,7 @@
INTERP, NULL, E_IOError,
"PATHNAME.entry_names: couldn't read directory");
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* file_names() {
@@ -133,7 +133,7 @@
INTERP, NULL, E_IOError,
"PATHNAME.file_names: couldn't read directory");
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* file_pathnames() {
@@ -171,7 +171,7 @@
INTERP, NULL, E_IOError,
"PATHNAME.file_names: couldn't read directory");
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* is_readable_directory() {
@@ -186,7 +186,7 @@
else {
VTABLE_set_integer_native(INTERP, result, 0);
}
- return result;
+ RETURN(PMC *result);
}
/*
METHOD PMC* string() {
@@ -194,7 +194,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, VTABLE_get_string(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
*/
METHOD PMC* subdirectory_names() {
@@ -227,7 +227,7 @@
INTERP, NULL, E_IOError,
"PATHNAME.subdirectory_names: couldn't read directory");
}
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* subdirectory_pathnames() {
@@ -265,7 +265,7 @@
INTERP, NULL, E_IOError,
"PATHNAME.subdirectory_pathnames: couldn't read directory");
}
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_string.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_string.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_string.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_STRING PMC, which implementes the Amber kernel class STRING
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
static INTVAL class_CHARACTER;
@@ -27,7 +27,7 @@
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(INTERP, result, PMC_int_val(SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* count() {
@@ -35,7 +35,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(
INTERP, result, string_compute_strlen(INTERP, PMC_str_val(SELF)));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -43,7 +43,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "STRING", 6));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* first() {
@@ -51,7 +51,7 @@
PMC* result = pmc_new(INTERP, class_CHARACTER);
VTABLE_set_integer_native(INTERP, result, string_ord(
INTERP, PMC_str_val(SELF), (INTVAL) 0));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* integer() { /* RT#48192 OVERFLOW */
@@ -59,7 +59,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(
INTERP, result, string_to_int(INTERP, PMC_str_val(SELF)));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* item(PMC* index) {
@@ -70,7 +70,7 @@
result = pmc_new(INTERP, class_CHARACTER);
VTABLE_set_integer_native(INTERP, result, string_ord(
INTERP, PMC_str_val(SELF), adjusted_index));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* last() {
@@ -79,7 +79,7 @@
VTABLE_set_integer_native(INTERP, result, string_ord(
INTERP, PMC_str_val(SELF), string_compute_strlen(
INTERP, PMC_str_val(SELF)) - 1));
- return result;
+ RETURN(PMC *result);
}
}
Modified: trunk/languages/amber/lib/kernel/pmc/amber_table.pmc
==============================================================================
--- trunk/languages/amber/lib/kernel/pmc/amber_table.pmc (original)
+++ trunk/languages/amber/lib/kernel/pmc/amber_table.pmc Sun Mar 30
18:40:37 2008
@@ -5,7 +5,7 @@
* The Amber_TABLE PMC, which implementes the Amber kernel class TABLE
*/
-#include "parrot/parrot.h"
+#include "parrot/embed.h"
pmclass Amber_TABLE need_ext
extends Hash
@@ -18,7 +18,7 @@
PMC* result = pmc_new(
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(INTERP, result, VTABLE_get_bool(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* classname() {
@@ -26,7 +26,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_String));
VTABLE_set_string_native(
INTERP, result, string_from_cstring(INTERP, "TABLE", 5));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* count() {
@@ -34,7 +34,7 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Integer));
VTABLE_set_integer_native(
INTERP, result, VTABLE_get_integer(INTERP, SELF));
- return result;
+ RETURN(PMC *result);
}
METHOD void delete(PMC* key) {
@@ -46,11 +46,12 @@
INTERP, Parrot_get_ctx_HLL_type(INTERP, enum_class_Boolean));
VTABLE_set_bool(
INTERP, result, VTABLE_exists_keyed(INTERP, SELF, key));
- return result;
+ RETURN(PMC *result);
}
METHOD PMC* item(PMC* key) {
- return VTABLE_get_pmc_keyed(INTERP, SELF, key);
+ PMC *result = VTABLE_get_pmc_keyed(INTERP, SELF, key);
+ RETURN(PMC *result);
}
METHOD void set_item(PMC* key, PMC* value) {