<div dir="ltr"> Dear Mailing List members, I fixed the SWIG Perl C++ enumeration problem today. I will now hand code the Perl XS module and compare the CPU times to see if the hand coded Perl XS module is faster than the SWIG wrapper. Thank you.<br>
<br>
<div class="gmail_quote">On Wed, Oct 1, 2008 at 5:00 PM, <span dir="ltr"><<a href="mailto:miltonkeynes-pm-request@pm.org">miltonkeynes-pm-request@pm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Send MiltonKeynes-pm mailing list submissions to<br> <a href="mailto:miltonkeynes-pm@pm.org">miltonkeynes-pm@pm.org</a><br>
<br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="http://mail.pm.org/mailman/listinfo/miltonkeynes-pm" target="_blank">http://mail.pm.org/mailman/listinfo/miltonkeynes-pm</a><br>or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:miltonkeynes-pm-request@pm.org">miltonkeynes-pm-request@pm.org</a><br><br>You can reach the person managing the list at<br> <a href="mailto:miltonkeynes-pm-owner@pm.org">miltonkeynes-pm-owner@pm.org</a><br>
<br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of MiltonKeynes-pm digest..."<br><br><br>Today's Topics:<br><br> 1. Swig Perl C++ enumeration issue (Frank Chang)<br>
<br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Tue, 30 Sep 2008 18:33:04 -0200<br>From: "Frank Chang" <<a href="mailto:frankchang91@gmail.com">frankchang91@gmail.com</a>><br>
Subject: Swig Perl C++ enumeration issue<br>To: <a href="mailto:miltonkeynes-pm@pm.org">miltonkeynes-pm@pm.org</a><br>Message-ID:<br> <<a href="mailto:568ca38c0809301333r29ba713cx9eef103cbb24684f@mail.gmail.com">568ca38c0809301333r29ba713cx9eef103cbb24684f@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br><br> Hi, We are trying to use SWIG 1.3.36 with perl 5.8.8 and the Visual<br>Studio C++ 2005 compiler. The header file used in our mdMatchup.i file is<br>shown below. In our mdMatchup.i , we are using the module mdMatchupTest. We<br>
ran swig -c++ -perl mdMatchup.i and obtained mdMatchup.pm and<br>mdMatchup_wrap.cxx.<br> We read that SWIG Perl can handle C++ enumerations. But, when we use<br>the enumerations in our test.pl program:<br><br>#!perl.exe -w<br>
use strict;<br>use mdMatchupTest;<br><br>my $readwrite;<br>$readwrite = mdMatchupTestc::new_mdMUReadWrite();<br><br>mdMatchupTestc::mdMUReadWrite_SetLicenseString($readwrite,"LL58JH2Y");<br>mdMatchupTestc::mdMUReadWrite_SetPathToMatchUpFiles($readwrite,"C:\\MatchupAPI\\Distribution");<br>
if (mdMatchupTestc::mdMUReadWrite_InitializeDataFiles($readwrite) !=<br>$mdMatchupc::mdMUReadWrite_NoError ){<br> print( "Failed to Initialize mdMatchupTestc::mdMUReadWrite ",<br> mdMatchupTestc::mdMUReadWrite_GetInitializeErrorString($readwrite). "\n");<br>
}<br><br>we get the Perl interprepter message : Name<br>"mdMatchupc::mdMUReadWrite_NoError" used only once: possible typo at test.pl<br>line 10<br>Use of uninitialized value in numeric ne (!=) at test.pl line 10.<br>
When we examine the mdMatchup.pm, we see that<br>mdMatchupc::mdMUReadWrite_NoError looks like a string. An excerpt of<br>mdMatchup.pm is shown below.<br> Is there a correct way to use SWIG packages with C++ enumerations in our<br>
perl program? Thank you.<br>-------------------------------------mdMatchup.pm---------------------------------<br>############# Class : mdMatchupTest::mdMUReadWrite ##############<br>package mdMatchupTest::mdMUReadWrite;<br>
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);<br>@ISA = qw( mdMatchupTest );<br>%OWNER = ();<br>%ITERATORS = ();<br>*NoError = *mdMatchupTestc::mdMUReadWrite_NoError;<br>*ConfigFile = *mdMatchupTestc::mdMUReadWrite_ConfigFile;<br>
-------------------------------------mdMatchup.h------------------------------------<br>#if !defined(MDMATCHUP_H)<br>#define MDMATCHUP_H<br>#if !defined(MDAPI)<br>#if defined(_WIN32) || defined(_WIN64)<br>#define MDAPI __declspec(dllimport)<br>
#else<br>#define MDAPI<br>#define __stdcall<br>#endif<br>#endif<br>/*<br>* C++ version of interface<br>*/<br><br>class MDAPI mdMUReadWrite<br>{<br>protected:<br>struct mdMUReadWrite_ *I;<br>private: /* disable implicit constructor and assignment */<br>
mdMUReadWrite(mdMUReadWrite &X);<br>mdMUReadWrite& operator=(mdMUReadWrite &X);<br>public:<br>enum ProgramStatus {<br>NoError=0,<br>ConfigFile=1,<br>LicenseExpired=2,<br>DatabaseExpired=3<br>};<br><br>mdMUReadWrite();<br>
~mdMUReadWrite();<br><br>/* Setup methods */<br>void SetPathToMatchUpFiles(const char *Path);<br>void SetMatchcodeName(const char *MatchcodeName);<br>void SetMatchcodeObject(mdMUMatchcode *Matchcode);<br>void SetKeyFile(const char *KeyFile);<br>
enum ProgramStatus InitializeDataFiles();<br>const char *GetInitializeErrorString();<br>void Initialize(void);<br>int SetLicenseString(const char*);<br>}<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20080930/293d10a9/attachment-0001.html" target="_blank">http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20080930/293d10a9/attachment-0001.html</a>><br>
<br>------------------------------<br><br>_______________________________________________<br>MiltonKeynes-pm mailing list<br><a href="mailto:MiltonKeynes-pm@pm.org">MiltonKeynes-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/miltonkeynes-pm" target="_blank">http://mail.pm.org/mailman/listinfo/miltonkeynes-pm</a><br>
<br><br>End of MiltonKeynes-pm Digest, Vol 37, Issue 1<br>**********************************************<br></blockquote></div><br></div>