Permalink
Browse files

Add examples of output from three methods.

  • Loading branch information...
1 parent 114e8c6 commit 6577d022b4b51c749fefc50f251f2d809891fd6f @jkeenan jkeenan committed Jun 12, 2012
Showing with 38 additions and 9 deletions.
  1. +38 −9 lib/Parrot/Vtable.pm
View
@@ -161,12 +161,16 @@ C<parse_vtable> method.
=item * Return Value
Returns string holding the C C<typedef> definitions for the elements in the
-referenced vtable array.
+referenced vtable array. Example:
-Used in F<tools/build/vtable_h.pl>.
+ typedef PMC* (*absolute_method_t)(PARROT_INTERP, ARGMOD(PMC *pmc), PMC* dest);
+ typedef PMC* (*add_method_t)(PARROT_INTERP, ARGMOD(PMC *pmc), PMC* value, PMC* dest);
+ typedef void (*add_attribute_method_t)(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING* name), PMC* type);
=item * Comment
+Used in F<tools/build/vtable_h.pl>.
+
=back
=cut
@@ -212,13 +216,28 @@ C<parse_vtable> method.
=item * Return Value
-Returns a string holding the C C<struct> definitions for the elements in the
-referenced vtable array.
-
-Used in F<tools/build/vtable_h.pl>.
+Returns a string holding the C C<enum> and C<struct> definitions for the
+elements in the referenced vtable array. Example:
+
+ typedef enum {
+ VTABLE_IS_CONST_FLAG = 0x001,
+ VTABLE_HAS_CONST_TOO = 0x002,
+ ...
+ VTABLE_IS_READONLY_FLAG = 0x100
+ } vtable_flags_t;
+
+ typedef struct _vtable {
+ PMC *_namespace; /* Pointer to namespace for this class */
+ INTVAL base_type; /* 'type' value for MMD */
+ STRING *whoami; /* Name of class this vtable is for */
+ ...
+ UINTVAL attr_size; /* Size of the attributes struct */
+ } _vtable;
=item * Comment
+Used in F<tools/build/vtable_h.pl>.
+
=back
=cut
@@ -290,10 +309,20 @@ C<parse_vtable> method.
String holding the C C<#define> definitions for the elements in the referenced
vtable array.
-Used in F<tools/build/vtable_h.pl>.
+ #define VTABLE_absolute(interp, pmc, dest) \
+ (pmc)->vtable->absolute(interp, pmc, dest)
+ #define VTABLE_add(interp, pmc, value, dest) \
+ (pmc)->vtable->add(interp, pmc, value, dest)
+ ...
+ #define PARROT_VTABLE_SLOT_ABSOLUTE 9
+ #define PARROT_VTABLE_SLOT_ADD 10
+ #define PARROT_VTABLE_SLOT_ADD_ATTRIBUTE 11
+ ...
=item * Comment
+Used in F<tools/build/vtable_h.pl>.
+
=back
=cut
@@ -388,10 +417,10 @@ C<parse_vtable> method.
List of two strings holding the C function definitions to call the vtable functions on a PMC for the elements in the referenced vtable array.
-Used in F<tools/build/vtable_extend.pl>.
-
=item * Comment
+Used in F<tools/build/vtable_extend.pl>.
+
=back
=cut

0 comments on commit 6577d02

Please sign in to comment.