[svn:parrot] r45051 - in trunk: . src/pmc t/pmc

coke at svn.parrot.org coke at svn.parrot.org
Fri Mar 19 05:38:00 UTC 2010


Author: coke
Date: Fri Mar 19 05:37:57 2010
New Revision: 45051
URL: https://trac.parrot.org/parrot/changeset/45051

Log:
Remove CPointer PMC, resolve TT #1407.

Deleted:
   trunk/src/pmc/cpointer.pmc
   trunk/t/pmc/cpointer.t
Modified:
   trunk/DEPRECATED.pod
   trunk/MANIFEST

Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod	Fri Mar 19 00:01:59 2010	(r45050)
+++ trunk/DEPRECATED.pod	Fri Mar 19 05:37:57 2010	(r45051)
@@ -66,12 +66,6 @@
 
 L<https://trac.parrot.org/parrot/ticket/103>
 
-=item CPointer PMC [eligible in 2.1]
-
-And all uses in the Parrot calling conventions.
-
-L<https://trac.parrot.org/parrot/ticket/1407>
-
 =item Digest dynpmcs [eligible in 2.4]
 
 The digest dynpmcs are, since the posting of this notice, available on

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Fri Mar 19 00:01:59 2010	(r45050)
+++ trunk/MANIFEST	Fri Mar 19 05:37:57 2010	(r45051)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Mar 15 13:04:03 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Mar 19 05:33:57 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1407,7 +1407,6 @@
 src/pmc/complex.pmc                                         [devel]src
 src/pmc/continuation.pmc                                    [devel]src
 src/pmc/coroutine.pmc                                       [devel]src
-src/pmc/cpointer.pmc                                        [devel]src
 src/pmc/default.pmc                                         [devel]src
 src/pmc/env.pmc                                             [devel]src
 src/pmc/eval.pmc                                            [devel]src
@@ -1874,7 +1873,6 @@
 t/pmc/context.t                                             [test]
 t/pmc/continuation.t                                        [test]
 t/pmc/coroutine.t                                           [test]
-t/pmc/cpointer.t                                            [test]
 t/pmc/default.t                                             [test]
 t/pmc/env.t                                                 [test]
 t/pmc/eval.t                                                [test]

Deleted: trunk/src/pmc/cpointer.pmc
==============================================================================
--- trunk/src/pmc/cpointer.pmc	Fri Mar 19 05:37:57 2010	(r45050)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,511 +0,0 @@
-/*
-Copyright (C) 2008-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/cpointer.pmc - CPointer
-
-=head1 DESCRIPTION
-
-The CPointer PMC creates a PMC abstraction for a typed C pointer. It is
-particularly used by the C<CallSignature> PMC, for the return values of a
-C-level PCC invocation using a C<CallSignature> to pass the arguments and fetch
-the results.
-
-=head2 Attributes
-
-A CPointer PMC has two attributes:
-
-=over 4
-
-=item pointer
-
-A C<void *> pointer to an integer, number, string, or PMC.
-
-=item sig
-
-A string signature for the pointer. The possible signature values follow the
-standard defined for PCC.
-
-  I   a Parrot integer (INTVAL)
-  N   a Parrot number  (FLOATVAL)
-  S   a Parrot string  (STRING *)
-  P   a Parrot object  (PMC *)
-
-=back
-
-
-=head2 Vtable Functions
-
-These are the vtable functions for the CPointer class.
-
-=over 4
-
-=cut
-
-*/
-
-pmclass CPointer auto_attrs {
-    ATTR void   *pointer; /* The stored pointer. */
-    ATTR STRING *sig;     /* A string signature for the pointer. */
-
-/*
-
-=item C<void init()>
-
-Initializes the pointer object.
-
-=cut
-
-*/
-
-    VTABLE void init() {
-        SET_ATTR_pointer(INTERP, SELF, NULL);
-        SET_ATTR_sig(INTERP, SELF, NULL);
-
-        PObj_custom_mark_SET(SELF);
-    }
-
-/*
-
-=item C<void mark()>
-
-Marks the signature as live. Also marks a STRING or PMC pointed to by the
-pointer.
-
-=cut
-
-*/
-
-    VTABLE void mark() {
-        STRING *sig;
-        GET_ATTR_sig(INTERP, SELF, sig);
-        if (sig) {
-            void *pointer;
-            GET_ATTR_pointer(INTERP, SELF, pointer);
-            Parrot_gc_mark_STRING_alive(interp, sig);
-        }
-    }
-
-/*
-
-=item C<PMC *clone()>
-
-Creates and returns a clone of the pointer.
-
-=cut
-
-*/
-
-    VTABLE PMC *clone() {
-        PMC * const dest = Parrot_pmc_new_noinit(INTERP, SELF->vtable->base_type);
-        void       *ptr;
-        STRING     *sig;
-
-        GET_ATTR_pointer(INTERP, SELF, ptr);
-        SET_ATTR_pointer(INTERP, dest, ptr);
-
-        GET_ATTR_sig(INTERP, SELF, sig);
-        SET_ATTR_sig(INTERP, dest, sig);
-
-        PObj_custom_mark_SET(dest);
-        return dest;
-    }
-
-/*
-
-=item C<void *get_pointer()>
-
-Returns the pointer.
-
-=cut
-
-*/
-
-    VTABLE void *get_pointer() {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        return data->pointer;
-    }
-
-/*
-
-=item C<void set_pointer(void *)>
-
-Sets the pointer.
-
-=cut
-
-*/
-
-    VTABLE void set_pointer(void *value) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        data->pointer = value;
-    }
-
-/*
-
-=item C<STRING *get_string_keyed_str(STRING *key)>
-
-Returns the string signature.
-
-=cut
-
-*/
-
-    VTABLE STRING *get_string_keyed_str(STRING *key) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        UNUSED(key)
-
-        return data->sig;
-    }
-
-/*
-
-=item C<void set_string_keyed_str(STRING *key, STRING *value)>
-
-Sets the string signature.
-
-=cut
-
-*/
-
-    VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        UNUSED(key)
-
-        data->sig = value;
-    }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Returns the integer value that the pointer points to (if the pointer is to an
-integer or PMC).
-
-=cut
-
-*/
-
-    VTABLE INTVAL get_integer() {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            return *int_pointer;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            return (INTVAL)*num_pointer;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            return Parrot_str_to_int(INTERP, *str_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            return VTABLE_get_integer(INTERP, *pmc_pointer);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to fetch value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<void set_integer_native(INTVAL value)>
-
-Sets the integer value that the pointer points to (if the pointer is to an
-integer or PMC).
-
-=cut
-
-*/
-
-    VTABLE void set_integer_native(INTVAL value) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            *int_pointer = value;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            *num_pointer = value;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            *str_pointer = Parrot_str_from_int(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            *pmc_pointer = get_integer_pmc(INTERP, value);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to set value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<FLOATVAL get_number()>
-
-Returns the floating point value that the pointer points to (if the pointer is
-to a number or PMC).
-
-=cut
-
-*/
-
-    VTABLE FLOATVAL get_number() {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            return (FLOATVAL)*int_pointer;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            return *num_pointer;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            return Parrot_str_to_num(INTERP, *str_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            return VTABLE_get_number(INTERP, *pmc_pointer);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to fetch value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<void set_number_native(FLOATVAL value)>
-
-Sets the floating point value that the pointer points to (if the pointer is
-to a number or PMC).
-
-=cut
-
-*/
-
-    VTABLE void set_number_native(FLOATVAL value) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            *int_pointer = (INTVAL)value;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            *num_pointer = value;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            *str_pointer = Parrot_str_from_num(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            *pmc_pointer = get_number_pmc(INTERP, value);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to set value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<STRING *get_string()>
-
-Returns the Parrot string value that the pointer points to (if the pointer is
-to a string or PMC).
-
-=cut
-
-*/
-
-    VTABLE STRING *get_string() {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            return Parrot_str_from_int(INTERP, *int_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            return Parrot_str_from_num(INTERP, *num_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            return *str_pointer;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            return VTABLE_get_string(INTERP, *pmc_pointer);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to fetch value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<void set_string_native(STRING *value)>
-
-Sets the Parrot string value that the pointer points to (if the pointer is
-to a string or PMC).
-
-=cut
-
-*/
-
-    VTABLE void set_string_native(STRING *value) {
-        Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            *int_pointer = Parrot_str_to_int(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            *num_pointer = Parrot_str_to_num(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            *str_pointer = value;
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            *pmc_pointer = get_string_pmc(INTERP, value);
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to set value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<PMC *get_pmc()>
-
-Returns the PMC value that the pointer points to (if the pointer is to a PMC).
-
-=cut
-
-*/
-
-    VTABLE PMC *get_pmc() {
-        const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            return get_integer_pmc(INTERP, *int_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            return get_number_pmc(INTERP, *num_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            return get_string_pmc(INTERP, *str_pointer);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            return *pmc_pointer;
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to fetch value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<void set_pmc(PMC *value)>
-
-Sets the PMC value that the pointer points to (if the pointer is to a PMC).
-
-=cut
-
-*/
-
-    VTABLE void set_pmc(PMC *value) {
-        const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
-        if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "I"))) {
-            INTVAL * const int_pointer = (INTVAL *) data->pointer;
-            *int_pointer = VTABLE_get_integer(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "N"))) {
-            FLOATVAL * const num_pointer = (FLOATVAL *) data->pointer;
-            *num_pointer = VTABLE_get_number(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
-            STRING ** const str_pointer = (STRING **) data->pointer;
-            *str_pointer = VTABLE_get_string(INTERP, value);
-        }
-        else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
-            PMC ** const pmc_pointer = (PMC **) data->pointer;
-            *pmc_pointer = value;
-        }
-        else {
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                    "Unable to set value, broken signature!");
-        }
-    }
-
-/*
-
-=item C<INTVAL get_bool()>
-
-Returns whether the pointer is not C<NULL>.
-
-=cut
-
-*/
-
-    VTABLE INTVAL get_bool() {
-        const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        return (INTVAL)(data->pointer != NULL);
-    }
-
-/*
-
-=item C<INTVAL is_same(PMC *pmc2)>
-
-Returns whether the pointer has the same value as C<*pmc2>.
-
-=cut
-
-*/
-
-    VTABLE INTVAL is_same(PMC *pmc2) {
-        const Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-        return (INTVAL)(SELF->vtable  == pmc2->vtable &&
-                        data->pointer == VTABLE_get_pointer(interp, pmc2));
-    }
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Deleted: trunk/t/pmc/cpointer.t
==============================================================================
--- trunk/t/pmc/cpointer.t	Fri Mar 19 05:37:57 2010	(r45050)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,37 +0,0 @@
-#! parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/cpointer.t - test CPointer PMC
-
-=head1 SYNOPSIS
-
-    % prove t/pmc/cpointer.t
-
-=head1 DESCRIPTION
-
-Tests the CPointer PMC.
-
-=cut
-
-.sub main :main
-    .include 'test_more.pir'
-
-    plan(1)
-
-    instantiate()
-.end
-
-
-.sub instantiate
-    $P0 = new ['CPointer']
-    ok(1, 'Instantiated CPointer')
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list