# New Ticket Created by  [EMAIL PROTECTED] 
# Please include the string:  [perl #15802]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=15802 >


I started working on implementing a Tuple pmc as someone else suggested as a good
starting project (and I'm still working :).  In doing that, I noticed that it was
hard to create a new pmc (or at least for me it was).  You had to change
assemble.pl, pmc.h, genclass.h, genclass.pl, Makefile, and classes/Makefile.  And
of course, I learned that slowly, and didn't get everything right the first time
:)  Also, when you create a default pmc, it generates A LOT of warnings when you
only implement a few functions.  This patch does the following:

1) update genclass.pl to quinch some warnings of the type "control reaches end of
non-void function."  All it does is check if the return type is void, if not, it
returns 0, casted to the return type.

2) introduce an addclass.pl file.  This file, given ClassName as an arguemnt,
will
make classname.pmc (it turns its argument to lowercase when making the file to
keep within conventions, but keeps the case in everything else), and add the
appropriate entries to assemble.pl, pmc.h, genclass.h, genclass.pl, Makefile, and
classes/Makefile.  If you run 'perl addclass.pl SuperPMC' then you can assemble,
"new P0, .SuperPMC" and everything will be right.  Of course the vtable functions
are all unimplemented at first, but I can't do everything now can I? :)

Stephen Rawls

-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/31940/26598/86e185/addclass.pl

-- attachment  2 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/31940/26599/b0d257/genclass.patch.txt

Attachment: addclass.pl
Description: addclass.pl

srawls@gandalf:~/parrot/classes$ cvs diff -u genclass.pl
Index: genclass.pl
===================================================================
RCS file: /cvs/public/parrot/classes/genclass.pl,v
retrieving revision 1.12
diff -u -r1.12 genclass.pl
--- genclass.pl 23 Jul 2002 17:57:00 -0000      1.12
+++ genclass.pl 29 Jul 2002 23:39:39 -0000
@@ -41,6 +41,9 @@
     if($methname eq "name") {
         print "        return whoami\;\n";
     }
+    elsif($retval !~ /void/) {
+        print "      return ($retval)0;\n";
+    }
     print "    }\n\n";
 }


Reply via email to