<div dir="ltr">&nbsp;&nbsp; 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&nbsp; 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">&lt;<a href="mailto:miltonkeynes-pm-request@pm.org">miltonkeynes-pm-request@pm.org</a>&gt;</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>&nbsp; &nbsp; &nbsp; &nbsp;<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>&nbsp; &nbsp; &nbsp; &nbsp;<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 &#39;help&#39; to<br>
&nbsp; &nbsp; &nbsp; &nbsp;<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>&nbsp; &nbsp; &nbsp; &nbsp;<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 &quot;Re: Contents of MiltonKeynes-pm digest...&quot;<br><br><br>Today&#39;s Topics:<br><br>&nbsp; 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: &quot;Frank Chang&quot; &lt;<a href="mailto:frankchang91@gmail.com">frankchang91@gmail.com</a>&gt;<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>&nbsp; &nbsp; &nbsp; &nbsp;&lt;<a href="mailto:568ca38c0809301333r29ba713cx9eef103cbb24684f@mail.gmail.com">568ca38c0809301333r29ba713cx9eef103cbb24684f@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br><br>&nbsp; &nbsp; &nbsp;Hi, We are trying to use SWIG 1.3.36 with perl &nbsp;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>&nbsp; &nbsp; &nbsp; 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,&quot;LL58JH2Y&quot;);<br>mdMatchupTestc::mdMUReadWrite_SetPathToMatchUpFiles($readwrite,&quot;C:\\MatchupAPI\\Distribution&quot;);<br>
if (mdMatchupTestc::mdMUReadWrite_InitializeDataFiles($readwrite) !=<br>$mdMatchupc::mdMUReadWrite_NoError ){<br>&nbsp;print( &quot;Failed to Initialize mdMatchupTestc::mdMUReadWrite &quot;,<br>&nbsp;mdMatchupTestc::mdMUReadWrite_GetInitializeErrorString($readwrite). &quot;\n&quot;);<br>
}<br><br>we get the Perl interprepter message : Name<br>&quot;mdMatchupc::mdMUReadWrite_NoError&quot; 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>
&nbsp;When we examine the mdMatchup.pm, &nbsp;we see that<br>mdMatchupc::mdMUReadWrite_NoError looks like a string. An excerpt of<br>mdMatchup.pm is shown below.<br>&nbsp;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 &amp;X);<br>mdMUReadWrite&amp; operator=(mdMUReadWrite &amp;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: &lt;<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>&gt;<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>