[svn:parrot] r46295 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed May 5 00:33:51 UTC 2010


Author: chromatic
Date: Wed May  5 00:33:49 2010
New Revision: 46295
URL: https://trac.parrot.org/parrot/changeset/46295

Log:
[PMC] Tidied Continuation's code and added documentation.  No functional
changes.

Modified:
   trunk/src/pmc/continuation.pmc

Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc	Wed May  5 00:05:19 2010	(r46294)
+++ trunk/src/pmc/continuation.pmc	Wed May  5 00:33:49 2010	(r46295)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -57,6 +57,7 @@
     ATTR PMC               *from_ctx;        /* sub, this cont is returning from */
     ATTR int                runloop_id;      /* id of the creating runloop. */
     ATTR int                invoked;         /* flag when a handler has been invoked. */
+
 /*
 
 =item C<void init()>
@@ -80,7 +81,19 @@
         PObj_custom_mark_SET(SELF);
     }
 
-    /*if they pass in a PMC to initialize with*/
+
+/*
+
+=item C<void init_pmc(PMC *continuation)>
+
+Initializes the continuation with values from the provided continuation.
+
+=cut
+
+*/
+
+
+    /* if they pass in a PMC to initialize with */
     VTABLE void init_pmc(PMC *values) {
         PMC               *to_ctx;
         opcode_t          *address;
@@ -103,7 +116,6 @@
     }
 
 
-
 /*
 
 =item C<void mark()>
@@ -131,6 +143,7 @@
         Parrot_gc_mark_PMC_alive(INTERP, tmp);
     }
 
+
 /*
 
 =item C<PMC *clone()>
@@ -146,25 +159,27 @@
         return Parrot_pmc_new_init(INTERP, SELF->vtable->base_type, SELF);
     }
 
+
 /*
 
 =item C<PMC *set_pmc()>
 
-Assign context.
+Assigns context.
 
 =cut
 
 */
     VTABLE void set_pmc(PMC *src) {
-        STRUCT_COPY((Parrot_Continuation_attributes *)PMC_data(SELF),
-                (Parrot_Continuation_attributes *)PMC_data(src));
+        STRUCT_COPY(PMC_data_typed(SELF, Parrot_Continuation_attributes *),
+                    PMC_data_typed(src,  Parrot_Continuation_attributes *));
     }
+
 /*
 
 =item C<void set_pointer(void *value)>
 
-Sets the pointer to the return instruction.  Also captures the descriptor
-address for any returned values.
+Sets the pointer to the given return instruction and captures the runloop id
+for any returned values.
 
 =cut
 
@@ -175,6 +190,7 @@
         SET_ATTR_runloop_id(INTERP, SELF, INTERP->current_runloop_id);
     }
 
+
 /*
 
 =item C<void *get_pointer()>
@@ -189,10 +205,10 @@
         opcode_t          *address;
 
         GET_ATTR_address(INTERP, SELF, address);
-
         return address;
     }
 
+
 /*
 
 =item C<INTVAL defined()>
@@ -209,18 +225,18 @@
         opcode_t          *address;
 
         GET_ATTR_address(INTERP, SELF, address);
-
         return address != NULL;
     }
 
+
     VTABLE INTVAL get_bool() {
         opcode_t          *address;
 
         GET_ATTR_address(INTERP, SELF, address);
-
         return address != NULL;
     }
 
+
 /*
 
 =item C<opcode_t *invoke(void *next)>
@@ -247,9 +263,8 @@
         Parrot_continuation_check(INTERP, SELF);
         Parrot_continuation_rewind_environment(INTERP, SELF);
 
-        if (!PMC_IS_NULL(from_obj)) {
+        if (!PMC_IS_NULL(from_obj))
             Parrot_pcc_set_signature(INTERP, CURRENT_CONTEXT(INTERP), from_obj);
-        }
 
         /* switch segment */
         if (INTERP->code != seg)
@@ -258,11 +273,12 @@
         return pc;
     }
 
+
 /*
 
 =item C<STRING *get_string()>
 
-Experimental: return caller info as a STRING.
+Experimental: returns caller info as a STRING.
 
 =cut
 
@@ -272,15 +288,15 @@
         PMC *to_ctx;
 
         GET_ATTR_to_ctx(INTERP, SELF, to_ctx);
-
         return Parrot_Context_infostr(INTERP, to_ctx);
     }
 
+
 /*
 
 =item C<PMC *caller()>
 
-Experimental: return caller PMC or PMCNULL if none.
+Experimental: return callers PMC or PMCNULL if none.
 
 =cut
 
@@ -305,11 +321,13 @@
         RETURN(PMC *caller);
 
     }
+
+
 /*
 
 =item C<PMC *continuation()>
 
-Experimental: return continuation PMC of this Continuation or PMCNULL if none.
+Experimental: returns continuation PMC of this Continuation or PMCNULL if none.
 
 =cut
 
@@ -333,10 +351,6 @@
 
 =back
 
-=head1 HISTORY
-
-Initial revision by sean 2002/08/04.
-
 =cut
 
 */


More information about the parrot-commits mailing list