chromatic wrote on Sat, Aug 25, 2007 at 11:09:24PM PDT:
> There's almost no vtable entry documentation in src/pmc/undef.pmc.  You can 
> copy it almost verbatim from almost any other PMC.  This is an easy task that 
> requires almost no C or Perl knowledge.
This isn't much documentation, and I hope it's a step in the right
direction.

- David

-- 
"Liberal education ought to end only with life itself."
    -- Robert Maynard Hutchins, The Great Conversation
diff --git a/src/pmc/undef.pmc b/src/pmc/undef.pmc
index 138a2fd..90a0440 100644
--- a/src/pmc/undef.pmc
+++ b/src/pmc/undef.pmc
@@ -28,11 +28,33 @@ from there.
 
 pmclass Undef extends default no_ro {
 
+/*
+
+=item C<void set_pmc(PMC *other)>
+
+Sets the current PMC to C<*other> by first changing the current PMC to the
+appropriate type.
+
+=cut
+
+*/
+
     void set_pmc(PMC *other) {
         VTABLE_morph(INTERP, SELF, enum_class_Ref);
         VTABLE_set_pmc(INTERP, SELF, other);
     }
 
+/*
+
+=item C<void assign_pmc(PMC *other)>
+
+Assigns the PMC to the value of C<*other>by first changing the PMC to the
+appropriate type.
+
+=cut
+
+*/
+
     void assign_pmc(PMC *other) {
         VTABLE_morph(INTERP, SELF, other->vtable->base_type);
 
@@ -41,49 +63,159 @@ pmclass Undef extends default no_ro {
             VTABLE_set_pmc(INTERP, SELF, other);
     }
 
-    void morph(INTVAL new_type) {
+/*
+
+=item C<void morph(INTVAL new_type)>
+
+Changes the current PMC's type to C<new_type>.
+
+=cut
+
+*/
+
+     void morph(INTVAL new_type) {
         pmc_reuse(INTERP, SELF, new_type, 0);
     }
 
+/*
+
+=item C<INTVAL get_integer()>
+
+Returns 0.
+
+=cut
+
+*/
+
     INTVAL get_integer() {
         return 0;
     }
 
+/*
+
+=item C<INTVAL defined()>
+
+Returns 0.
+
+=cut
+
+*/
+
     INTVAL defined() {
         return 0;
     }
 
+/*
+
+=item C<void set_integer_native(INTVAL value)>
+
+Morphs the current PMC to an C<Integer> and sets the value from C<value>.
+
+=cut
+
+*/
+
     void set_integer_native(INTVAL value) {
         VTABLE_morph(INTERP, SELF, enum_class_Integer);
         VTABLE_set_integer_native(INTERP, SELF, value);
     }
 
+/*
+
+=item C<FLOATVAL get_number()>
+
+Returns 0.0.
+
+=cut
+
+*/
+
     FLOATVAL get_number() {
         return 0.0;
     }
 
+/*
+
+=item C<void set_number_native(FLOATVAL value)>
+
+Morphs the current PMC to a C<Float> and sets the value from C<value>.
+
+=cut
+
+*/
+
     void set_number_native(FLOATVAL value) {
         VTABLE_morph(INTERP, SELF, enum_class_Float);
         VTABLE_set_number_native(INTERP, SELF, value);
     }
 
+/*
+
+=item C<STRING *get_string()>
+
+Returns an empty string.
+
+=cut
+
+*/
+
     STRING *get_string() {
         return string_make_empty(INTERP, enum_stringrep_one, 0);
     }
 
+/*
+
+=item C<void set_string_native(STRING *value)>
+
+Morphs the current PMC to a C<String> and sets the value from C<value>.
+
+=cut
+
+*/
+
     void set_string_native(STRING *value) {
         VTABLE_morph(INTERP, SELF, UNDEF_STRING_CLASS);
         VTABLE_set_string_native(INTERP, SELF, value);
     }
 
+/*
+
+=item C<INTVAL get_bool()>
+
+Returns 0.
+
+=cut
+
+*/
+
     INTVAL get_bool() {
         return 0;
     }
 
+/*
+
+=item C<void share()>
+
+Unknown. (TODO)
+
+=cut
+
+*/
+
     void share() {
         /* see src/pmc/integer.pmc */
     }
 
+/*
+
+=item C<PMC *share_ro()>
+
+Unknown. (TODO)
+
+=cut
+
+*/
+
     PMC *share_ro() {
         if (PObj_is_PMC_shared_TEST(SELF))
             return SELF;
@@ -91,10 +223,30 @@ pmclass Undef extends default no_ro {
             return pt_shared_fixup(INTERP, SELF);
     }
 
+/*
+
+=item C<PMC *clone()>
+
+Clones the current Undef PMC.
+
+=cut
+
+*/
+
     PMC *clone() {
         return pmc_new(INTERP, SELF->vtable->base_type);
     }
 
+/*
+
+=item C<INTVAL is_equal(PMC *value)>
+
+Returns 1 if the C<*value> is an Undef PMC, 0 otherwise.
+
+=cut
+
+*/
+
     INTVAL is_equal(PMC *value) {
         MMD_Undef: {
             return 1;

Reply via email to