Date   

Re: Fedora build issues

William Henry <whenry@...>
 

Okay so here's what's wrong now and what I did to get to wrong and what I'm doing to fix it.

The ./configure flags the avis_client_config.h file.

So after svn co the avis source. I copied this file (well one of them - there are four but no "linux") to /usr/local/include/avis.

That got me by the ./configure

However it seems that more .h files are needed in this directory for the build. So I'll copy them over one by one. Later: actually I just copied the entire directory over.

Now I'm getting:
bridge.c: In function 'avisBridge_getVersion':
bridge.c:65:30: error: 'VERSION' undeclared (first use in this function)
bridge.c:65:30: note: each undeclared identifier is reported only once for each function it appears in
bridge.c:66:1: warning: control reaches end of non-void function [-Wreturn-type]
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

I wonder if I have the correct .h file versions.

William

----- Original Message -----
Got the build at least going now with the avis stuff installed.

But I'm hitting:
bridge.c:22:24: fatal error: avis/elvin.h: No such file or directory
compilation terminated.
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory
`/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

William

----- Original Message -----
I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@...
[mailto:openmama-dev-
bounces@...] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@...
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current
code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any
attachment
to it is privileged, confidential and protected from disclosure.
If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any
dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message,
and
please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev


Re: Fedora build issues

William Henry <whenry@...>
 

Got the build at least going now with the avis stuff installed.

But I'm hitting:
bridge.c:22:24: fatal error: avis/elvin.h: No such file or directory
compilation terminated.
make[5]: *** [bridge.lo] Error 1
make[5]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge/avis'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c/bridge'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src/c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/whenry/os/openmamam/OpenMAMA-1.1/mama/c_cpp'

William

----- Original Message -----
I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@...
[mailto:openmama-dev-
bounces@...] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@...
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current
code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment
to it is privileged, confidential and protected from disclosure.
If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message,
and
please delete it from your system. Thank you. NYSE Euronext.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev


Re: Fedora build issues

William Henry <whenry@...>
 

I've attached the output from ./configure

I wonder if now my only issue is having avis installed.

William.

----- Original Message -----


-----Original Message-----
From: openmama-dev-bounces@... [mailto:openmama-dev-
bounces@...] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@...
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in
mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment
to it is privileged, confidential and protected from disclosure. If
the reader of this message is not the intended recipient, or an
employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly
prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message, and
please delete it from your system. Thank you. NYSE Euronext.


Re: OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

Mike Schonberg <mschonberg@...>
 

Mark,

 

The current top level configure script is fairly simplistic and passes all of the configure arguments to all the lower level configure scripts. If the option is not supported by the lower level configure, it emits a warning. These are, as you mention, harmless. At some point we should make the higher level script more sophisticated. It might make sense to even use autoconf rather than a simple shell script.

 

At the moment this is fairly low priority, but we should get to it when we have time.

 

Regards,

-Mike

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Mark Spielman
Sent: Thursday, May 03, 2012 9:28 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

 

I’ve cloned the OpenMAMA 2.1 release git repository.  When I try to configure the environment with --wIth-avis, the output from the configure script has a bunch of warnings of the following:

 

configure: WARNING: unrecognized options: --with-avis

 

After debugging, these seem to be benign.  Can the build environment be enhanced to remove these warnings?

 

Cheers,

Mark

 

 

Mark Spielman

Development Lead, Solace Systems Professional Services
+1-613-271-1010 x1021

mark.spielman@...

www.solacesystems.com

 

 


Please consider the environment before printing this email.

Visit our website at http://www.nyse.com
*****************************************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


[PATCH] [mamda] Add patch for -lmama for news and orderbook examples

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

The news and orderbook examples were not building because the linker could not
find libmama. This patch adjusts the link flags to include the path to the mama
c libraries.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
mamda/c_cpp/src/examples/news/Makefile.am | 1 +
mamda/c_cpp/src/examples/orderbooks/Makefile.am | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mamda/c_cpp/src/examples/news/Makefile.am b/mamda/c_cpp/src/examples/news/Makefile.am
index 5cf0964..751cedf 100644
--- a/mamda/c_cpp/src/examples/news/Makefile.am
+++ b/mamda/c_cpp/src/examples/news/Makefile.am
@@ -33,6 +33,7 @@ CPPFLAGS +=-I$(srcdir)/../../cpp \

LDFLAGS += -L${srcdir}/../../cpp \
-L$(srcdir)/../../cpp/news \
+ -L$(srcdir)/../../../../../mama/c_cpp/src/c \
-L$(srcdir)/../../../../../mama/c_cpp/src/cpp

LIBS += -lmamdanews -lmamda -lmamacpp -lmama -lpthread -lnsl -ldl -lm
diff --git a/mamda/c_cpp/src/examples/orderbooks/Makefile.am b/mamda/c_cpp/src/examples/orderbooks/Makefile.am
index 92568b1..36685d6 100644
--- a/mamda/c_cpp/src/examples/orderbooks/Makefile.am
+++ b/mamda/c_cpp/src/examples/orderbooks/Makefile.am
@@ -35,6 +35,7 @@ CPPFLAGS += -I$(srcdir)/../../cpp \

LDFLAGS += -L${srcdir}/../../cpp \
-L$(srcdir)/../../cpp/orderbooks \
+ -L$(srcdir)/../../../../../mama/c_cpp/src/c \
-L$(srcdir)/../../../../../mama/c_cpp/src/cpp

if USE_GCC_FLAGS
--
1.7.7.6


[PATCH] [mama] Add libpthread to library list for sem_timedwait

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

configure.ac needs to search for sem_timedwait in both librt and libpthread.
On OS's like certain Solaris versions that do not support sem_timedwait(),
OpenMAMA provides an implentation.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
mama/c_cpp/configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mama/c_cpp/configure.ac b/mama/c_cpp/configure.ac
index e70e918..0ff4380 100644
--- a/mama/c_cpp/configure.ac
+++ b/mama/c_cpp/configure.ac
@@ -106,7 +106,7 @@ AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,gethostbyname)

# SOLARIS 8 does not have sem_timedwait
-AC_SEARCH_LIBS(sem_timedwait, rt,
+AC_SEARCH_LIBS(sem_timedwait, rt pthread,
[
echo "Found sem_timedwait()."
],
--
1.7.7.6


Re: Fedora build issues

Mike Schonberg <mschonberg@...>
 

-----Original Message-----
From: openmama-dev-bounces@... [mailto:openmama-dev-
bounces@...] On Behalf Of William Henry
Sent: Thursday, May 03, 2012 11:17 AM
To: openmama-dev@...
Subject: [Openmama-dev] Fedora build issues

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().
I also see this error. It occurs because we search librt but not
libpthread. I will post a patch shortly.


This appears to be the cause of no makefile being build in mama/c_cpp
and so that never builds.
The following results in a clean build for me with the current code:
git clean -d -f
./generateBuildFiles.sh
export JAVA_HOME=/home/mike/JDK-6/jdk1.6.0_30/
./configure --with-avis=/usr/local --prefix=`pwd`/dist
make install

Could you post the output from your configure script?

Thanks,
-Mike


William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Re: Bridge devel process

Mike Schonberg <mschonberg@...>
 

-----Original Message-----
From: openmama-dev-bounces@... [mailto:openmama-dev-
bounces@...] On Behalf Of William Henry
Sent: Wednesday, May 02, 2012 4:44 PM
To: openmama-dev@...
Subject: [Openmama-dev] Bridge devel process

Mike or someone,

Would you mind posting a link to the "dummies guide" to OpenMAMA bridge
development?
The current bridge documentation, which we will post soon, does not include a
"dummies guide". We want to add a "getting started" guide before
sending it out for review.

In the mean time, we will post a summary of first steps for writing a bridge
to help you get started.

I also think it makes sense to write a well documented NULL template bridge to
facilitate testing and bridge development.

Regards,
-Mike

Best
William
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
http://lists.openmama.org/listinfo/openmama-dev
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Fedora build issues

William Henry <whenry@...>
 

Hi,

I see configure fail because it can't find sem_timedwait():

checking for library containing sem_timedwait... no
Failed to find sem_timedwait().

This appears to be the cause of no makefile being build in mama/c_cpp and so that never builds.

William


OpenMAMA 2.1 - configure: WARNING: unrecognized options: --with-avis

Mark Spielman
 

I’ve cloned the OpenMAMA 2.1 release git repository.  When I try to configure the environment with --wIth-avis, the output from the configure script has a bunch of warnings of the following:

 

configure: WARNING: unrecognized options: --with-avis

 

After debugging, these seem to be benign.  Can the build environment be enhanced to remove these warnings?

 

Cheers,

Mark

 

 

Mark Spielman

Development Lead, Solace Systems Professional Services
+1-613-271-1010 x1021

mark.spielman@...

www.solacesystems.com

 

 


Bridge devel process

William Henry <whenry@...>
 

Mike or someone,

Would you mind posting a link to the "dummies guide" to OpenMAMA bridge development?

Best
William


[PATCH 50/50] [unittest] Adding C Unit Tests

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>


Signed-off-by: Mike Schonberg <mschonberg@...>
---
mama/c_cpp/src/gunittest/c/Makefile.am | 10 +-
mama/c_cpp/src/gunittest/c/datetimetest.cpp | 133 ++++++++++
mama/c_cpp/src/gunittest/c/openclose.c | 51 ----
mama/c_cpp/src/gunittest/c/openclosetest.cpp | 152 ++++++++++++
mama/c_cpp/src/gunittest/c/pricetest.cpp | 295 +++++++++++++++++++++++
mama/c_cpp/src/gunittest/c/subscriptiontest.cpp | 181 ++++++++++++++
mama/c_cpp/src/gunittest/c/timertest.cpp | 258 ++++++++++++++++++++
7 files changed, 1027 insertions(+), 53 deletions(-)
create mode 100644 mama/c_cpp/src/gunittest/c/datetimetest.cpp
delete mode 100644 mama/c_cpp/src/gunittest/c/openclose.c
create mode 100644 mama/c_cpp/src/gunittest/c/openclosetest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/pricetest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
create mode 100644 mama/c_cpp/src/gunittest/c/timertest.cpp

diff --git a/mama/c_cpp/src/gunittest/c/Makefile.am b/mama/c_cpp/src/gunittest/c/Makefile.am
index 13b5915..e968bce 100644
--- a/mama/c_cpp/src/gunittest/c/Makefile.am
+++ b/mama/c_cpp/src/gunittest/c/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.2.4.1.16.5 2011/09/13 16:01:26 ianbell Exp $
+# $Id$
#
# OpenMAMA: The open middleware agnostic messaging API
# Copyright (C) 2011 NYSE Inc.
@@ -39,10 +39,16 @@ LDFLAGS += -L${srcdir}/../../c \
-L${srcdir}/../../../../../common/c_cpp/src/c

LIBS = -lmama -lwombatcommon -lgtest
+LDADD = -lgtest_main -ldl

bin_PROGRAMS = MainUnitTestC

nodist_MainUnitTestC_SOURCES = MainUnitTestC.cpp \
msgtests.cpp \
- iteration.cpp
+ iteration.cpp \
+ openclosetest.cpp \
+ datetimetest.cpp \
+ subscriptiontest.cpp \
+ pricetest.cpp \
+ timertest.cpp

diff --git a/mama/c_cpp/src/gunittest/c/datetimetest.cpp b/mama/c_cpp/src/gunittest/c/datetimetest.cpp
new file mode 100644
index 0000000..a3c7393
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/datetimetest.cpp
@@ -0,0 +1,133 @@
+/* Text editors: this is -*-C-*- code. */
+/*----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ * Copyright (c) 1999-2007 Wombat Financial Software Inc., of Incline
+ * Village, NV. All rights reserved.
+ *
+ * This software and documentation constitute an unpublished work and
+ * contain valuable trade secrets and proprietary information belonging
+ * to Wombat. None of this material may be copied, duplicated or
+ * disclosed without the express written permission of Wombat.
+ *
+ * WOMBAT EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
+ * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF
+ * MERCHANTABILITY AND/OR FITNESS FOR ANY PARTICULAR PURPOSE, AND
+ * WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE
+ * FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER
+ * EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR
+ * DOCUMENTATION.
+ *
+ * Under no circumstances shall Wombat be liable for incidental, special,
+ * indirect, direct or consequential damages or loss of profits,
+ * interruption of business, or related expenses which may arise from use
+ * of software or documentation, including but not limited to those
+ * resulting from defects in software and/or documentation, or loss or
+ * inaccuracy of data of any kind.
+ *
+ *--------------------------------------------------------------------------*/
+
+#include "gtest/gtest.h"
+#include "mama/mama.h"
+#include "mama/status.h"
+#include "MainUnitTestC.h"
+#include "mama/types.h"
+#include "mama/datetime.h"
+
+class MamaDateTimeTestC : public ::testing::Test
+{
+protected:
+ // This C date time will be used for testing
+ mamaDateTime m_DateTime;
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaDateTimeTestC *m_this;
+
+ MamaDateTimeTestC(void);
+ virtual ~MamaDateTimeTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+
+};
+
+MamaDateTimeTestC::MamaDateTimeTestC(void)
+{
+ m_DateTime = NULL;
+}
+
+MamaDateTimeTestC::~MamaDateTimeTestC(void)
+{
+}
+
+void MamaDateTimeTestC::SetUp(void)
+{
+ ASSERT_EQ(mamaDateTime_create(&m_DateTime), MAMA_STATUS_OK);
+}
+
+void MamaDateTimeTestC::TearDown(void)
+{
+ ASSERT_EQ(mamaDateTime_destroy(m_DateTime), MAMA_STATUS_OK);
+}
+
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* */
+
+TEST_F(MamaDateTimeTestC, NullArguments)
+{
+ // Call with a NULL date time
+ mama_f64_t seconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(NULL, &seconds), MAMA_STATUS_NULL_ARG);
+
+ // NULL seconds
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_DateTime, NULL), MAMA_STATUS_NULL_ARG);
+
+ // NULL for both
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(NULL, NULL), MAMA_STATUS_NULL_ARG);
+}
+
+TEST_F(MamaDateTimeTestC, CompareDates)
+{
+ // Get todays date in a date time
+ mamaDateTime today = NULL;
+
+ ASSERT_EQ(mamaDateTime_create(&today), MAMA_STATUS_OK);
+ ASSERT_EQ(mamaDateTime_setToNow(today), MAMA_STATUS_OK);
+
+ // Get the string representation of the data
+ char stringDate[100] = "";
+ ASSERT_EQ(mamaDateTime_getAsFormattedString(today, stringDate, 100, "%Y-%m-%d"), MAMA_STATUS_OK);
+
+ // Destroy the date
+ ASSERT_EQ(mamaDateTime_destroy(today), MAMA_STATUS_OK);
+
+ // Format a string using today's date and a time, this should be as "2010-07-04 10:00:00.000"
+ const char *time = "10:00:00.000000";
+ char completeDateTime[100] = "";
+ mamaDateTime m_cDateTime;
+ sprintf(completeDateTime, "%s %s", stringDate, time);
+
+ // Set the date from this string
+ ASSERT_EQ(mamaDateTime_setFromString(m_cDateTime, completeDateTime), MAMA_STATUS_OK);
+
+ // Get the number of seconds
+ mama_f64_t completeDateSeconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_cDateTime, &completeDateSeconds), MAMA_STATUS_OK);
+
+ // Set the date using just the time string
+ ASSERT_EQ(mamaDateTime_clear(m_cDateTime), MAMA_STATUS_OK);
+
+ ASSERT_EQ(mamaDateTime_setFromString(m_cDateTime, time), MAMA_STATUS_OK);
+
+ // Get the number of seconds from this
+ mama_f64_t timeSeconds = 0;
+ ASSERT_EQ(mamaDateTime_getEpochTimeSecondsWithCheck(m_cDateTime, &timeSeconds), MAMA_STATUS_OK);
+
+ // These must be the same
+ ASSERT_EQ(completeDateSeconds, timeSeconds);
+}
+
diff --git a/mama/c_cpp/src/gunittest/c/openclose.c b/mama/c_cpp/src/gunittest/c/openclose.c
deleted file mode 100644
index 23adcef..0000000
--- a/mama/c_cpp/src/gunittest/c/openclose.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id: openclose.c,v 1.2.22.2 2011/08/10 14:53:30 nicholasmarriott Exp $
- *
- * OpenMAMA: The open middleware agnostic messaging API
- * Copyright (C) 2011 NYSE Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <gtest/gtest.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-
-
-TEST(ExampleTest, LogicExampleHello) {
- printf("simple example test\n");
-}
-
-
-TEST(ExampleTest, LogicExampleHello2) {
- printf("simple example test 2\n");
-
-}
-
-
-/**
- * *VERY* Simple example
-
-TEST(OpenCloseTest, BasicOpenClose) {
- printf("BasicOpenClose test\n");
-}
-
-
-TEST(OpenCloseTest, RepeatedOpenClose) {
- printf("RepeatedOpenClose\n");
-
-}
-*/
diff --git a/mama/c_cpp/src/gunittest/c/openclosetest.cpp b/mama/c_cpp/src/gunittest/c/openclosetest.cpp
new file mode 100644
index 0000000..25e51b3
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/openclosetest.cpp
@@ -0,0 +1,152 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <gtest/gtest.h>
+#include "mama/mama.h"
+#include "mama/status.h"
+#include "MainUnitTestC.h"
+
+class MamaOpenCloseTestC : public ::testing::Test
+{
+protected:
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaOpenCloseTestC *m_this;
+
+ MamaOpenCloseTestC(void);
+ virtual ~MamaOpenCloseTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+
+
+};
+
+MamaOpenCloseTestC::MamaOpenCloseTestC(void)
+{
+}
+
+MamaOpenCloseTestC::~MamaOpenCloseTestC(void)
+{
+}
+
+void MamaOpenCloseTestC::SetUp(void)
+{
+ m_this = this;
+}
+
+void MamaOpenCloseTestC::TearDown(void)
+{
+ m_this = NULL;
+}
+
+static void MAMACALLTYPE startCallback(mama_status status)
+{
+ printf("In start in background callback\n");
+}
+
+
+/* ************************************************************************* */
+/* Tests */
+/* ************************************************************************* */
+TEST_F(MamaOpenCloseTestC, OpenClose)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ mama_close();
+}
+
+TEST_F(MamaOpenCloseTestC, NestedOpenClose)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ printf("Attempt first open\n");
+ mama_open();
+
+ printf("Attempt second open\n");
+ mama_open();
+
+ printf("Attempt first close\n");
+ mama_close();
+
+ printf("Attempt second close\n");
+ mama_close();
+
+ printf("Finished nested testing\n");
+}
+
+TEST_F(MamaOpenCloseTestC, OpenCloseReopenSameBridge)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ mama_close();
+
+ ASSERT_EQ(MAMA_STATUS_OK, mama_open());
+
+ return;
+
+ // If we get here there is a problem
+ ASSERT_TRUE(1);
+}
+
+TEST_F(MamaOpenCloseTestC, OpenCloseReopenNewBridge)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, "wmw");
+
+ mama_open();
+
+ mama_close();
+
+ mama_loadBridge(&mBridge, "lbm");
+
+ mama_open();
+
+ mama_close();
+}
+
+TEST_F(MamaOpenCloseTestC, StartStopDifferentThreads)
+{
+ mamaBridge mBridge;
+ mama_loadBridge(&mBridge, getMiddleware());
+
+ mama_open();
+
+ // Start mama in the background so it uses a different thread
+ ASSERT_EQ(MAMA_STATUS_OK, mama_startBackground(mBridge, startCallback));
+
+ // Sleep to allow the other thread to complete startup
+ sleep(2);
+
+ mama_stop(mBridge);
+
+ mama_close();
+}
+
diff --git a/mama/c_cpp/src/gunittest/c/pricetest.cpp b/mama/c_cpp/src/gunittest/c/pricetest.cpp
new file mode 100644
index 0000000..8bcc7c8
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/pricetest.cpp
@@ -0,0 +1,295 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/*
+ * Description : This test will check the mamaPrice type to ensure that the
+ * setting the precision will not cause the price value to be
+ * truncated.
+ */
+
+#include "gtest/gtest.h"
+#include "MainUnitTestC.h"
+#include "mama/price.h"
+
+#ifdef WIN32
+#define WMPRICE_LARGE_INT32_FORMAT_SPECIFIER "%I32d"
+#define WMPRICE_LARGE_INT64_FORMAT_SPECIFIER "%I64d"
+#else
+#define WMPRICE_LARGE_INT32_FORMAT_SPECIFIER "%ld"
+#define WMPRICE_LARGE_INT64_FORMAT_SPECIFIER "%lld"
+#endif
+
+class MamaPriceTestC : public ::testing::Test
+{
+protected:
+
+ mamaPrice m_price;
+
+protected:
+
+ MamaPriceTestC(void);
+ virtual ~MamaPriceTestC(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+};
+
+
+MamaPriceTestC::MamaPriceTestC(void)
+{
+ m_price = NULL;
+}
+
+MamaPriceTestC::~MamaPriceTestC(void)
+{
+}
+
+
+void MamaPriceTestC::SetUp(void)
+{
+ // Create a new mama price
+ ASSERT_EQ(mamaPrice_create(&m_price), MAMA_STATUS_OK);
+
+ // Set the value of the price
+ ASSERT_EQ(mamaPrice_setValue(m_price, 4000000000), MAMA_STATUS_OK);
+}
+
+void MamaPriceTestC::TearDown(void)
+{
+ // Delete the price
+ if(m_price != NULL)
+ {
+ ASSERT_EQ(mamaPrice_destroy(m_price), MAMA_STATUS_OK);
+ }
+}
+
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* +*/
+TEST_F(MamaPriceTestC, SetPrecisionInt)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_INT), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv2)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_2), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv4)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_4), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv8)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_8), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv16)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_16), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv32)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_32), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv64)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_64), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv128)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_128), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv256)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_256), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
+
+TEST_F(MamaPriceTestC, SetPrecisionDiv512)
+{
+ // Set the precision
+ ASSERT_EQ(mamaPrice_setPrecision(m_price, MAMA_PRICE_PREC_DIV_512), MAMA_STATUS_OK);
+
+ // Get the value as a double
+ double doubleValue = 0;
+ ASSERT_EQ(mamaPrice_getValue(m_price, &doubleValue), MAMA_STATUS_OK);
+
+ // Format the double value as a string using an integer flag
+ char doubleString[20] = "";
+ sprintf(doubleString, WMPRICE_LARGE_INT64_FORMAT_SPECIFIER, (int64_t)doubleValue);
+
+ // Get the value as a string
+ char stringValue[20] = "";
+ ASSERT_EQ(mamaPrice_getAsString(m_price, stringValue, 19), MAMA_STATUS_OK);
+
+ // Compare the strings
+ ASSERT_STREQ(stringValue, doubleString);
+}
diff --git a/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp b/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
new file mode 100644
index 0000000..ea631dc
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/subscriptiontest.cpp
@@ -0,0 +1,181 @@
+/*----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ * Copyright (c) 1999-2007 Wombat Financial Software Inc., of Incline
+ * Village, NV. All rights reserved.
+ *
+ * This software and documentation constitute an unpublished work and
+ * contain valuable trade secrets and proprietary information belonging
+ * to Wombat. None of this material may be copied, duplicated or
+ * disclosed without the express written permission of Wombat.
+ *
+ * WOMBAT EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
+ * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF
+ * MERCHANTABILITY AND/OR FITNESS FOR ANY PARTICULAR PURPOSE, AND
+ * WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE
+ * FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER
+ * EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR
+ * DOCUMENTATION.
+ *
+ * Under no circumstances shall Wombat be liable for incidental, special,
+ * indirect, direct or consequential damages or loss of profits,
+ * interruption of business, or related expenses which may arise from use
+ * of software or documentation, including but not limited to those
+ * resulting from defects in software and/or documentation, or loss or
+ * inaccuracy of data of any kind.
+ *
+ *--------------------------------------------------------------------------*/
+
+#include "gtest/gtest.h"
+#include "mama/mama.h"
+#include "MainUnitTestC.h"
+#include "mama/subscription.h"
+#include "mama/source.h"
+#include "mama/types.h"
+
+//using namespace Wombat;
+
+class MamaSubscriptionTest : public ::testing::Test
+{
+public:
+ mamaBridge m_bridge;
+protected:
+
+ /* Work around for problem in gtest where the this pointer can't be accessed
+ * from a test fixture.
+ */
+ MamaSubscriptionTest *m_this;
+
+ mamaQueue m_defaultQueue;
+
+ mamaMsgCallbacks simpleCallback;
+
+ mamaSubscription subscription;
+
+ mamaTransport m_transport;
+ char transportName[10];
+
+protected:
+
+ MamaSubscriptionTest(void);
+ virtual ~MamaSubscriptionTest(void);
+
+ virtual void SetUp(void);
+ virtual void TearDown(void);
+};
+
+static void MAMACALLTYPE onSimpleCallbackCreate(mamaSubscription sub, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackDestroy(mamaSubscription sub, void* closure)
+{
+ MamaSubscriptionTest* mamaSubscriptionTest = (MamaSubscriptionTest*) closure;
+ mama_stop(mamaSubscriptionTest->m_bridge);
+}
+
+static void MAMACALLTYPE onSimpleCallbackMsg(mamaSubscription sub, mamaMsg msg, void* closure, void* itemClosure)
+{
+ MamaSubscriptionTest* mamaSubscriptionTest = (MamaSubscriptionTest*) closure;
+ mama_stop(mamaSubscriptionTest->m_bridge);
+}
+
+static void MAMACALLTYPE onSimpleCallbackRecapRequest(mamaSubscription sub, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackQuality(mamaSubscription sub, mamaQuality quality, const char* symbol, short cause, const void* platformInfo, void* closure)
+{
+}
+
+static void MAMACALLTYPE onSimpleCallbackGap(mamaSubscription sub, void* closure)
+{
+}
+
+MamaSubscriptionTest::MamaSubscriptionTest(void)
+{
+ m_bridge = NULL;
+ m_transport = NULL;
+ m_defaultQueue = NULL;
+
+ memset(&simpleCallback, 0, sizeof(simpleCallback));
+ simpleCallback.onCreate = onSimpleCallbackCreate;
+ simpleCallback.onDestroy = onSimpleCallbackDestroy;
+ simpleCallback.onMsg = onSimpleCallbackMsg;
+ simpleCallback.onQuality = onSimpleCallbackQuality;
+ simpleCallback.onGap = onSimpleCallbackGap;
+ simpleCallback.onRecapRequest = onSimpleCallbackRecapRequest;
+
+ subscription = NULL;
+
+ //recreateOnMsgCallback = ;
+ //recreateOnDestroyCallback = NULL;
+}
+
+MamaSubscriptionTest::~MamaSubscriptionTest(void)
+{
+}
+
+
+void MamaSubscriptionTest::SetUp(void)
+{
+ // Save the this pointer in the member variable to get around gtest problems
+ m_this = this;
+
+ mama_loadBridge(&m_bridge, getMiddleware());
+
+ mama_open();
+
+ transportName[0] = '\0';
+ strncat(transportName, "sub_", 5);
+ strncat(transportName, getMiddleware(), 4);
+
+ mamaTransport_allocate(&m_transport);
+ mamaTransport_create(m_transport, transportName, m_bridge);
+}
+
+void MamaSubscriptionTest::TearDown(void)
+{
+ m_transport = NULL;
+
+ mama_close();
+
+ m_this = NULL;
+}
+
+
+
+/* ************************************************************************* */
+/* Test Functions - Basic Subscription */
+/* ************************************************************************* */
+
+TEST_F(MamaSubscriptionTest, BasicSubscription)
+{
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_allocate(&subscription));
+ if(NULL != subscription)
+ {
+ // Get the default queue
+ mama_getDefaultEventQueue(m_bridge, &m_defaultQueue);
+
+ //create a test source
+ mamaSource testSource = NULL;
+ mamaSource_create(&testSource);
+ mamaSource_setId(testSource, "TestSource");
+ mamaSource_setTransport(testSource, m_transport);
+ mamaSource_setSymbolNamespace(testSource, "WOMBAT");
+ printf("Note: as there is no real source, this test should hang\n");
+
+ // Create the subscription
+ ASSERT_EQ( MAMA_STATUS_OK,
+ mamaSubscription_create(subscription, m_defaultQueue, &simpleCallback, testSource, "TEST_SYMBOL", m_this));
+
+ mama_start(m_bridge);
+
+ // Destroy the subscription
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_destroy(subscription));
+
+ // Delete the basic subscription
+ ASSERT_EQ(MAMA_STATUS_OK, mamaSubscription_deallocate(subscription));
+ }
+}
diff --git a/mama/c_cpp/src/gunittest/c/timertest.cpp b/mama/c_cpp/src/gunittest/c/timertest.cpp
new file mode 100644
index 0000000..2604fe7
--- /dev/null
+++ b/mama/c_cpp/src/gunittest/c/timertest.cpp
@@ -0,0 +1,258 @@
+/* $Id$
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/*
+ * Description : This test harness will cover MAMA issue 3418 which includes
+ * several timer tests. See the function header for each
+ * fixture for more information. Note that this test should
+ * be run against different versions of LBM including 3.5.2
+ * and an earlier version.
+ */
+
+#include <gtest/gtest.h>
+#include "MainUnitTestC.h"
+#include "wombat/wConfig.h"
+#include "mama/types.h"
+#include "mama/timer.h"
+#include "mama/queue.h"
+#include <cstring>
+#include <cstdio>
+#include <cstdlib>
+
+
+class MamaTimerTestC : public ::testing::Test
+{
+protected:
+ MamaTimerTestC();
+ virtual ~MamaTimerTestC();
+
+ virtual void SetUp();
+ virtual void TearDown ();
+public:
+ // Initialise all member variables
+ int m_numberForCallbacks;
+ int m_numberForTimers;
+ int m_numberRecursiveCallbacks;
+ double m_timerInterval;
+ mamaBridge m_bridge;
+ mamaQueue m_defaultQueue;
+ mamaTransport m_transport;
+
+ mamaTimer mtarray[1000];
+
+ MamaTimerTestC *m_this;
+ char transportName[10];
+
+ mamaTimer shortTimer;
+ mamaTimer longTimer;
+ mamaTimer stopperTimer;
+ mamaTimer recursiveTimer;
+
+ mamaTimerCb m_TickCallback;
+ mamaTimerCb m_DestroyCallback;
+
+};
+
+MamaTimerTestC::MamaTimerTestC()
+{
+ m_numberForCallbacks = 0;
+ m_numberForTimers = 10;
+ m_numberRecursiveCallbacks = 0;
+ m_timerInterval = 0.0001;
+ m_bridge = NULL;
+ m_defaultQueue = NULL;
+ m_transport = NULL;
+ shortTimer = NULL;
+ longTimer = NULL;
+ stopperTimer = NULL;
+ recursiveTimer = NULL;
+
+ m_TickCallback = NULL;
+ m_DestroyCallback = NULL;
+ m_this = NULL;
+}
+
+MamaTimerTestC::~MamaTimerTestC()
+{
+}
+
+void MamaTimerTestC::SetUp(void)
+{
+ // Save the this pointer in the member variable to get around gtest problems
+ m_this = this;
+
+ mama_loadBridge(&m_bridge, getMiddleware());
+
+ mama_open();
+
+ mama_getDefaultEventQueue(m_bridge, &m_defaultQueue);
+
+ transportName[0] = '\0';
+ strncat(transportName, "sub_", 5);
+ strncat(transportName, getMiddleware(), 4);
+
+ mamaTransport_allocate(&m_transport);
+ mamaTransport_create(m_transport, transportName, m_bridge);
+}
+
+void MamaTimerTestC::TearDown(void)
+{
+ m_this = NULL;
+}
+
+static void MAMACALLTYPE onTimerTick(mamaTimer timer, void* closure)
+{
+ printf("Timer ticking....\n");
+ mamaTimer_destroy(timer);
+}
+
+static void MAMACALLTYPE onTimerDestroy(mamaTimer timer, void* closure)
+{
+ printf("Timer destroying...\n");
+ MamaTimerTestC *fixture = (MamaTimerTestC *)closure;
+ fixture->m_numberForCallbacks ++;
+ printf("m_numberForCallbacks = %i\n", fixture->m_numberForCallbacks);
+
+ // If all the timers have been destroyed then quit out
+ if(fixture->m_numberForCallbacks == fixture->m_numberForTimers)
+ {
+ printf("Stopping timer\n");
+ mama_stop(fixture->m_bridge);
+ }
+}
+
+static void MAMACALLTYPE onStopDispatchingTimerTick(mamaTimer timer, void* closure)
+{
+ mamaTimer_destroy(timer);
+}
+
+static void MAMACALLTYPE onStopDispatchingTimerDestroy(mamaTimer timer, void* closure)
+{
+ printf("Stopping Two Timers ticking\n");
+ MamaTimerTestC* fixture = (MamaTimerTestC *)closure;
+ mama_stop(fixture->m_bridge);
+
+ mamaTimer_destroy(fixture->shortTimer);
+ mamaTimer_destroy(fixture->longTimer);
+}
+
+
+static void MAMACALLTYPE onRecursiveTimerTick(mamaTimer timer, void* closure)
+{
+ MamaTimerTestC *fixture = (MamaTimerTestC*) closure;
+ EXPECT_EQ(mamaTimer_destroy(timer), MAMA_STATUS_OK);
+ fixture->recursiveTimer = NULL;
+}
+
+
+static void MAMACALLTYPE onRecursiveTimerDestroy(mamaTimer timer, void* closure)
+{
+ // Cast the closure to a test fixture
+ printf("in recursive onDestroy\n");
+ MamaTimerTestC *fixture = (MamaTimerTestC *)closure;
+
+ // Increment the number of times this function has been called
+ fixture->m_numberRecursiveCallbacks ++;
+
+ // If this is the 10th pass then quit out
+ if(fixture->m_numberRecursiveCallbacks == 10)
+ {
+ //EXPECT_EQ(mama_stop(fixture->m_init->bridge), MAMA_STATUS_OK);
+ mama_stop(fixture->m_bridge);
+ }
+ else
+ {
+ mamaTimer_create2(&fixture->recursiveTimer, fixture->m_defaultQueue, onRecursiveTimerTick, onRecursiveTimerDestroy, fixture->m_timerInterval, fixture->m_this);
+ }
+}
+
+
+static void MAMACALLTYPE onTwoTimerTick(mamaTimer timer, void* closure)
+{
+ printf("In TwoTimer Tick\n");
+
+}
+
+static void MAMACALLTYPE onTwoTimerDestroy(mamaTimer timer, void * closure)
+{
+ // Cast the closure to a test fixture
+ printf("In TwoTimer Destroy\n");
+}
+/* ************************************************************************* */
+/* Test Functions */
+/* ************************************************************************* */
+
+/* Description : This test will create a large number of timers in a for loop, each one will
+ * be freed in its callback function.
+ */
+TEST_F(MamaTimerTestC, ForTimer)
+{
+ // Create a whole lot of timers
+ for(int counter=0; counter<m_numberForTimers; counter++)
+ {
+ printf("Creating new timer\n");
+ m_timerInterval = (counter + 1)/100;
+ mamaTimer_create2(&mtarray[counter], m_defaultQueue, onTimerTick, onTimerDestroy, m_timerInterval, m_this);
+ }
+
+ ASSERT_EQ(MAMA_STATUS_OK, mama_start(m_bridge));
+
+}
+
+
+/* Description : This function will create a timer which will create another timer
+ * in its callback function, (the first timer will be destroyed).
+ */
+
+TEST_F(MamaTimerTestC, RecursiveTimer)
+{
+ //Store the call
+ mamaTimer_create2(&recursiveTimer, m_defaultQueue, onRecursiveTimerTick, onRecursiveTimerDestroy, m_timerInterval, m_this);
+
+ // Start processing messages, after 10 timers have been created this will stop blocking
+ mama_start(m_bridge);
+}
+
+
+/* Description : This test will create 2 timers, the first will constantly reset itself
+ * while the second will continue to reset the first timer as well.
+ * The whole test will run for 3 seconds.
+ */
+TEST_F(MamaTimerTestC, TwoTimer)
+{
+
+ double interval = 0.1;
+ double testDuration = 3.0;
+
+ mamaTimer_create2(&shortTimer, m_defaultQueue, onTwoTimerTick, onTwoTimerDestroy, interval, m_this);
+ mamaTimer_create2(&longTimer, m_defaultQueue, onTwoTimerTick, onTwoTimerDestroy, interval*2.0, m_this); //use same callback
+
+ mamaTimer_create2( &stopperTimer,
+ m_defaultQueue,
+ onStopDispatchingTimerTick,
+ onStopDispatchingTimerDestroy,
+ testDuration,
+ m_this);
+
+ mama_start(m_bridge);
+
+}
+
--
1.7.7.6


[PATCH 49/50] [common] More Win32 Support

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

wUuid.c for uuid support and strpcasecmp and strptime implementations.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
common/c_cpp/src/c/windows/strpcasecmp.c | 88 +++++++
common/c_cpp/src/c/windows/strptime.c | 376 ++++++++++++++++++++++++++++++
common/c_cpp/src/c/windows/wUuid.c | 69 ++++++
3 files changed, 533 insertions(+), 0 deletions(-)
create mode 100644 common/c_cpp/src/c/windows/strpcasecmp.c
create mode 100644 common/c_cpp/src/c/windows/strptime.c
create mode 100644 common/c_cpp/src/c/windows/wUuid.c

diff --git a/common/c_cpp/src/c/windows/strpcasecmp.c b/common/c_cpp/src/c/windows/strpcasecmp.c
new file mode 100644
index 0000000..5483fa8
--- /dev/null
+++ b/common/c_cpp/src/c/windows/strpcasecmp.c
@@ -0,0 +1,88 @@
+//
+// strcasecmp.cc
+//
+// strcasecmp: replacement of the strcasecmp functions for architectures that do
+// not have it.
+//
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+// $Id: strpcasecmp.c,v 1.1.2.1 2012/03/15 11:02:57 evinkeating Exp $
+//
+
+//#ifdef HAVE_CONFIG_H
+//#include "htconfig.h"
+//#endif /* HAVE_CONFIG_H */
+
+//#include "lib.h"
+#include <ctype.h>
+
+//*****************************************************************************
+//
+int strcasecmp(const char *str1, const char *str2)
+{
+ if (!str1 && !str2)
+ return 0;
+ if (!str1)
+ return 1;
+ if (!str2)
+ return -1;
+ while (*str1 &&
+ *str2 &&
+ tolower((unsigned char)*str1) == tolower((unsigned char)*str2))
+ {
+ str1++;
+ str2++;
+ }
+
+ return tolower((unsigned char)*str1) - tolower((unsigned char)*str2);
+}
+
+
+//#define tolower(ch) (isupper(ch) ? (ch) + 'a' - 'A' : (ch))
+//*****************************************************************************
+//
+int strncasecmp(const char *str1, const char *str2, int n)
+{
+ if (!str1 && !str2)
+ return 0;
+ if (!str1)
+ return 1;
+ if (!str2)
+ return -1;
+ if (n < 0)
+ return 0;
+ while (n &&
+ *str1 &&
+ *str2 &&
+ tolower((unsigned char)*str1) == tolower((unsigned char)*str2))
+ {
+ str1++;
+ str2++;
+ n--;
+ }
+
+ return n == 0 ? 0 :
+ tolower((unsigned char)*str1) - tolower((unsigned char)*str2);
+}
+
+
+//*****************************************************************************
+// char *mystrcasestr(const char *s, const char *pattern)
+//
+const char *
+mystrcasestr(const char *s, const char *pattern)
+{
+ int length = strlen(pattern);
+
+ while (*s)
+ {
+ if (strncasecmp(s, pattern, length) == 0)
+ return s;
+ s++;
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/common/c_cpp/src/c/windows/strptime.c b/common/c_cpp/src/c/windows/strptime.c
new file mode 100644
index 0000000..88035e0
--- /dev/null
+++ b/common/c_cpp/src/c/windows/strptime.c
@@ -0,0 +1,376 @@
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+
+/*
+ * Copyright (c) 1994 Powerdog Industries. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgement:
+ * This product includes software developed by Powerdog Industries.
+ * 4. The name of Powerdog Industries may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY POWERDOG INDUSTRIES ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE POWERDOG INDUSTRIES BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef lint
+/*
+static char copyright[] =
+"@(#) Copyright (c) 1994 Powerdog Industries. All rights reserved.";
+static char sccsid[] = "@(#)strptime.c 1.0 (Powerdog) 94/03/27";
+*/
+#endif /* not lint */
+
+//#include <lib.h>
+
+#include <time.h>
+#include <ctype.h>
+#include <locale.h>
+#include <string.h>
+
+#define asizeof(a) ((int)(sizeof (a) / sizeof ((a)[0])))
+
+struct mydtconv {
+ char *abbrev_month_names[12];
+ char *month_names[12];
+ char *abbrev_weekday_names[7];
+ char *weekday_names[7];
+ char *time_format;
+ char *sdate_format;
+ char *dtime_format;
+ char *am_string;
+ char *pm_string;
+ char *ldate_format;
+};
+
+static struct mydtconv En_US = {
+ { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" },
+ { "January", "February", "March", "April",
+ "May", "June", "July", "August",
+ "September", "October", "November", "December" },
+ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" },
+ { "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday" },
+ "%H:%M:%S",
+ "%m/%d/%y",
+ "%a %b %e %T %Z %Y",
+ "AM",
+ "PM",
+ "%A, %B, %e, %Y"
+};
+
+char *
+strptime(const char *buf, const char *fmt, struct tm *tm)
+{
+ char c;
+ const char *ptr;
+ int i, len = 0;
+
+ ptr = fmt;
+ while (*ptr != 0)
+ {
+ if (*buf == 0)
+ break;
+
+ c = *ptr++;
+
+ if (c != '%')
+ {
+ if (isspace(c))
+ while (*buf != 0 && isspace(*buf))
+ buf++;
+ else if (c != *buf++)
+ return 0;
+ continue;
+ }
+
+ c = *ptr++;
+ switch (c)
+ {
+ case 0:
+ case '%':
+ if (*buf++ != '%')
+ return 0;
+ break;
+
+ case 'C':
+ buf = strptime(buf, En_US.ldate_format, tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'c':
+ buf = strptime(buf, "%x %X", tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'D':
+ buf = strptime(buf, "%m/%d/%y", tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'R':
+ buf = strptime(buf, "%H:%M", tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'r':
+ buf = strptime(buf, "%I:%M:%S %p", tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'T':
+ buf = strptime(buf, "%H:%M:%S", tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'X':
+ buf = strptime(buf, En_US.time_format, tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'x':
+ buf = strptime(buf, En_US.sdate_format, tm);
+ if (buf == 0)
+ return 0;
+ break;
+
+ case 'j':
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (i > 365)
+ return 0;
+
+ tm->tm_yday = i;
+ break;
+
+ case 'M':
+ case 'S':
+ if (*buf == 0 || isspace(*buf))
+ break;
+
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (i > 59)
+ return 0;
+
+ if (c == 'M')
+ tm->tm_min = i;
+ else
+ tm->tm_sec = i;
+
+ if (*buf != 0 && isspace(*buf))
+ while (*ptr != 0 && !isspace(*ptr))
+ ptr++;
+ break;
+
+ case 'H':
+ case 'I':
+ case 'k':
+ case 'l':
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (c == 'H' || c == 'k') {
+ if (i > 23)
+ return 0;
+ } else if (i > 11)
+ return 0;
+
+ tm->tm_hour = i;
+
+ if (*buf != 0 && isspace(*buf))
+ while (*ptr != 0 && !isspace(*ptr))
+ ptr++;
+ break;
+
+ case 'p':
+ len = strlen(En_US.am_string);
+ if (strncasecmp(buf, En_US.am_string, len) == 0)
+ {
+ if (tm->tm_hour > 12)
+ return 0;
+ if (tm->tm_hour == 12)
+ tm->tm_hour = 0;
+ buf += len;
+ break;
+ }
+
+ len = strlen(En_US.pm_string);
+ if (strncasecmp(buf, En_US.pm_string, len) == 0)
+ {
+ if (tm->tm_hour > 12)
+ return 0;
+ if (tm->tm_hour != 12)
+ tm->tm_hour += 12;
+ buf += len;
+ break;
+ }
+
+ return 0;
+
+ case 'A':
+ case 'a':
+ for (i = 0; i < asizeof(En_US.weekday_names); i++)
+ {
+ len = strlen(En_US.weekday_names[i]);
+ if (strncasecmp(buf,
+ En_US.weekday_names[i],
+ len) == 0)
+ break;
+
+ len = strlen(En_US.abbrev_weekday_names[i]);
+ if (strncasecmp(buf,
+ En_US.abbrev_weekday_names[i],
+ len) == 0)
+ break;
+ }
+ if (i == asizeof(En_US.weekday_names))
+ return 0;
+
+ tm->tm_wday = i;
+ buf += len;
+ break;
+
+ case 'd':
+ case 'e':
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (i > 31)
+ return 0;
+
+ tm->tm_mday = i;
+
+ if (*buf != 0 && isspace(*buf))
+ while (*ptr != 0 && !isspace(*ptr))
+ ptr++;
+ break;
+
+ case 'B':
+ case 'b':
+ case 'h':
+ for (i = 0; i < asizeof(En_US.month_names); i++)
+ {
+ len = strlen(En_US.month_names[i]);
+ if (strncasecmp(buf,
+ En_US.month_names[i],
+ len) == 0)
+ break;
+
+ len = strlen(En_US.abbrev_month_names[i]);
+ if (strncasecmp(buf,
+ En_US.abbrev_month_names[i],
+ len) == 0)
+ break;
+ }
+ if (i == asizeof(En_US.month_names))
+ return 0;
+
+ tm->tm_mon = i;
+ buf += len;
+ break;
+
+ case 'm':
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (i < 1 || i > 12)
+ return 0;
+
+ tm->tm_mon = i - 1;
+
+ if (*buf != 0 && isspace(*buf))
+ while (*ptr != 0 && !isspace(*ptr))
+ ptr++;
+ break;
+
+ case 'Y':
+ case 'y':
+ if (*buf == 0 || isspace(*buf))
+ break;
+
+ if (!isdigit(*buf))
+ return 0;
+
+ for (i = 0; *buf != 0 && isdigit(*buf); buf++)
+ {
+ i *= 10;
+ i += *buf - '0';
+ }
+ if (c == 'y' && i < 69) /* Unix Epoch pivot year */
+ i += 100;
+ if (c == 'Y')
+ i -= 1900;
+ if (i < 0)
+ return 0;
+
+ tm->tm_year = i;
+
+ if (*buf != 0 && isspace(*buf))
+ while (*ptr != 0 && !isspace(*ptr))
+ ptr++;
+ break;
+ }
+ }
+
+ return (char *) buf;
+}
\ No newline at end of file
diff --git a/common/c_cpp/src/c/windows/wUuid.c b/common/c_cpp/src/c/windows/wUuid.c
new file mode 100644
index 0000000..54124ec
--- /dev/null
+++ b/common/c_cpp/src/c/windows/wUuid.c
@@ -0,0 +1,69 @@
+/* $Id: wUuid.c,v 1.1.2.3 2012/04/05 09:33:15 evinkeating Exp $
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "wombat/wUuid.h"
+
+static uint64_t gRoot = 0;
+static uint16_t gGotroot = 0;
+
+#ifndef HOST_NAME_MAX
+# define HOST_NAME_MAX 255
+#endif
+
+void wUuid_generate_time (wUuid myUuid)
+{
+}
+
+void wUuid_unparse (wUuid myUuid, char* out)
+{
+ if (!gGotroot)
+ {
+ char hostname[HOST_NAME_MAX+1];
+ if (gethostname (hostname, HOST_NAME_MAX) == 0)
+ {
+ struct in_addr addr;
+ struct hostent* host = gethostbyname (hostname);
+ if ((host != NULL) && (host->h_addrtype == AF_INET))
+ {
+ /* Found host by name - we just look at the first entry.
+ * Maybe we should look at all of the entries (these are not
+ * aliases though). */
+ addr = *(struct in_addr*)(host->h_addr_list[0]);
+ }
+ else
+ addr.s_addr=INADDR_NONE;
+
+ gRoot = (((uint64_t)addr.s_addr) << 32) + getpid();
+ }
+ else
+ {
+ gRoot = getpid();
+ }
+ gGotroot = 1;
+ }
+
+ srand (time (NULL));
+ snprintf (out, 49, "%d%d", gRoot, rand() % 10000);
+}
--
1.7.7.6


[PATCH 48/50] [common] Removed Unnecessary Symlink to wConfig.h

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>


Signed-off-by: Mike Schonberg <mschonberg@...>
---
common/c_cpp/src/c/wombat/wConfig.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
delete mode 120000 common/c_cpp/src/c/wombat/wConfig.h

diff --git a/common/c_cpp/src/c/wombat/wConfig.h b/common/c_cpp/src/c/wombat/wConfig.h
deleted file mode 120000
index e7aeede..0000000
--- a/common/c_cpp/src/c/wombat/wConfig.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../src/c/linux/wConfig.h
\ No newline at end of file
--
1.7.7.6


[PATCH 47/50] [common] Moved windows/port.h to windows/wombat/port.h

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

This addresses some build issues.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
common/c_cpp/src/c/windows/port.h | 293 ------------------------------
common/c_cpp/src/c/windows/wombat/port.h | 293 ++++++++++++++++++++++++++++++
2 files changed, 293 insertions(+), 293 deletions(-)
delete mode 100644 common/c_cpp/src/c/windows/port.h
create mode 100644 common/c_cpp/src/c/windows/wombat/port.h

diff --git a/common/c_cpp/src/c/windows/port.h b/common/c_cpp/src/c/windows/port.h
deleted file mode 100644
index ac35348..0000000
--- a/common/c_cpp/src/c/windows/port.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * OpenMAMA: The open middleware agnostic messaging API
- * Copyright (C) 2011 NYSE Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#ifndef WINDOWS_H__
-#define WINDOWS_H__
-
-#define WIN32_EXTRA_LEAN
-#define WIN32_LEAN_AND_MEAN
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <stdlib.h>
-#include <io.h>
-#include <malloc.h>
-#include <float.h>
-#include <tchar.h>
-#include <pdh.h>
-#include <pdhmsg.h>
-#include <tlhelp32.h>
-#include <time.h>
-
-#include "wombat/targetsxs.h"
-#include "wombat/wConfig.h"
-#include "windows/lock.h"
-#include "windows/mmap.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/* So Windows compiler ignores gcc __attribute__(x) */
-#define __attribute__(a)
-
-/* Type for handle to dynamically loaded library */
-typedef HINSTANCE LIB_HANDLE;
-
-/* Missing typedefs */
-typedef void * caddr_t;
-typedef u_long in_addr_t;
-
-typedef unsigned char uint8_t;
-typedef char int8_t;
-typedef unsigned short uint16_t;
-typedef short int16_t;
-typedef unsigned int uint32_t;
-typedef int int32_t;
-typedef unsigned __int64 uint64_t;
-typedef __int64 int64_t;
-
-
-/* suffix for shared libraries */
-#ifdef _DEBUG
-#define LIB_EXTENSION "mdd.dll"
-#else
-#define LIB_EXTENSION "md.dll"
-#endif
-
-/* 8 byte int typedefs */
-typedef unsigned __int64 w_u64_t;
-typedef __int64 w_i64_t;
-
-/* Network conversion function */
-#define htonll(x) \
- ((uint64_t)htonl((uint32_t)((x)>>32)) | (uint64_t)htonl((uint32_t)(x))<<32)
-#define ntohll(x) \
- ((uint64_t)ntohl((uint32_t)((x)>>32)) | (uint64_t)ntohl((uint32_t)(x))<<32)
-
-/* For delimiting multiple paths in env variables properties */
-#define PATH_DELIM ';'
-
-#define PATHSEP "\\"
-COMMONExpDLL int
-wsocketstartup (void);
-
-COMMONExpDLL void
-wsocketcleanup (void);
-
-/* Socket Pair and set non blocking */
-COMMONExpDLL int
-wsocketpair (int domain, int type, int protocol, int* pair);
-
-COMMONExpDLL int
-wsetnonblock (int s);
-
-#define shutdown(x, y) closesocket((x))
-
-/* net work utility functions */
-COMMONExpDLL const char* getIpAddress (void);
-COMMONExpDLL const char* getHostName (void);
-COMMONExpDLL const char* getlogin (void);
-COMMONExpDLL struct in_addr wresolve_ip (const char * arg);
-
-/* Thread local storage */
-typedef DWORD wthread_key_t;
-
-COMMONExpDLL int
-wthread_key_create(wthread_key_t* key, void* val);
-
-#define wthread_key_delete(x) TlsFree(x)
-#define wthread_setspecific(x, val) TlsSetValue((x),(void*)((val)))
-#define wthread_getspecific(x) TlsGetValue((x))
-
-/* Posix Semaphores for Windows */
-typedef void* wsem_t;
-
-COMMONExpDLL
-int wsem_init (wsem_t* sem, int dummy, int count);
-
-COMMONExpDLL
-int wsem_destroy (wsem_t* sem);
-
-COMMONExpDLL
-int wsem_post (wsem_t* sem);
-
-COMMONExpDLL
-int wsem_wait (wsem_t* sem);
-
-COMMONExpDLL
-int wsem_timedwait (wsem_t* sem, unsigned int ts);
-
-COMMONExpDLL
-int wsem_trywait (wsem_t* sem);
-
-COMMONExpDLL
-int wsem_getvalue (wsem_t*, int* items);
-
-/* These functions are different on Windows */
-#define bzero( x, y ) ZeroMemory( ((void *)(x)), (y) )
-#define strtok_r(x, y, z) strtok((x),(y))
-#define snprintf _snprintf
-#define strdup _strdup
-#define strncasecmp _strnicmp
-#define strcasecmp _stricmp
-#define wread(x,y,z) recv((x),(y),(z),0)
-#define wwrite(x,y,z) send((x),(y),(z),0)
-#define close _close
-#define sleep(x) Sleep( (x)*1000)
-
-COMMONExpDLL
-int gettimeofday( struct timeval *result, void *dummy );
-
-COMMONExpDLL
-int getpid();
-
-const char *index( const char *str, char c );
-
-#define ctime_r ctime
-
-#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
-
-/*
- inttypes.h doesn't exist on windows.
- emulate some definitions here.
-*/
-#define PRId64 "I64d"
-#define PRIu64 "I64u"
-#ifndef INT8_MIN
-#define INT8_MIN SCHAR_MIN
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX SCHAR_MAX
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN SHRT_MIN
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX SHRT_MAX
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN INT_MIN
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX INT_MAX
-#endif
-#ifndef INT64_MIN
-#define INT64_MIN LLONG_MIN
-#endif
-#ifndef INT64_MAX
-#define INT64_MAX LLONG_MAX
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX UCHAR_MAX
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX USHRT_MAX
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX UINT_MAX
-#endif
-#ifndef UINT64_MAX
-#define UINT64_MAX ULLONG_MAX
-#endif
-
-#define wthread_detach( h ) /* noop */
-#define wthread_self GetCurrentThread
-#define wthread_equal( h1, h2 ) ((h1) == (h2))
-
-#define wthread_cond_init( h, zip ) ((*(h)) = CreateEvent( NULL, 1, 0, NULL ))
-#define wthread_cond_signal( h ) (SetEvent( *(h) ))
-#define wthread_cond_destroy( h ) (CloseHandle( *(h) ))
-
-COMMONExpDLL DWORD
-wthread_cond_wait( HANDLE *event, LPCRITICAL_SECTION *cs );
-
-#define wthread_exit ExitThread
-
-#define wthread_cleanup_push( x, y ) /* noop */
-#define wthread_cleanup_pop(x) /* noop */
-
-#define CPU_AFFINITY_SET DWORD
-
-COMMONExpDLL int wthread_create( wthread_t *h, void *atts, void *(*startProc)( void * ), void *arg );
-COMMONExpDLL void wthread_destroy(wthread_t thread);
-COMMONExpDLL int wthread_join (wthread_t t, void **value_ptr);
-COMMONExpDLL void wthread_testcancel( wthread_t h );
-COMMONExpDLL void wthread_cancel( wthread_t h );
-COMMONExpDLL struct tm* localtime_r (const time_t* t, struct tm* result);
-COMMONExpDLL int wthread_set_affinity_mask( wthread_t h, CPU_AFFINITY_SET* dwThreadAffinityMask);
-
-typedef int wthread_attr_t;
-COMMONExpDLL void wthread_attr_init (int* attr);
-COMMONExpDLL void wthread_attr_setdetachstate (int* attr, int);
-
-typedef int wthread_mutexattr_t;
-COMMONExpDLL void wthread_mutexattr_init (int* attr);
-COMMONExpDLL void wthread_mutexattr_settype (int* attr, int);
-
-#define wGetCurrentThreadId GetCurrentThreadId
-
-/* Macros for shared library access */
-#define wdlopen(a,b) LoadLibrary(a)
-#define wdlclose FreeLibrary
-#define wdlerror GetLastError
-#define wdlsym GetProcAddress
-
-#define timersub(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
- if ((vvp)->tv_usec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_usec += 1000000; \
- } \
- } while (0)
-
-#define timeradd(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
- if ((vvp)->tv_usec >= 1000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_usec -= 1000000; \
- } \
- } while (0)
-
-
-/* time gm not available on Windows */
-COMMONExpDLL
-time_t wtimegm (struct tm *tm);
-
-struct wtimespec
-{
- time_t tv_sec;
- long tv_nsec;
-};
-
-COMMONExpDLL int wnanosleep (struct wtimespec* ts, struct timnespec* remain);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-#endif /* WINDOWS_H__ */
diff --git a/common/c_cpp/src/c/windows/wombat/port.h b/common/c_cpp/src/c/windows/wombat/port.h
new file mode 100644
index 0000000..ac35348
--- /dev/null
+++ b/common/c_cpp/src/c/windows/wombat/port.h
@@ -0,0 +1,293 @@
+/*
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef WINDOWS_H__
+#define WINDOWS_H__
+
+#define WIN32_EXTRA_LEAN
+#define WIN32_LEAN_AND_MEAN
+
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windows.h>
+#include <stdlib.h>
+#include <io.h>
+#include <malloc.h>
+#include <float.h>
+#include <tchar.h>
+#include <pdh.h>
+#include <pdhmsg.h>
+#include <tlhelp32.h>
+#include <time.h>
+
+#include "wombat/targetsxs.h"
+#include "wombat/wConfig.h"
+#include "windows/lock.h"
+#include "windows/mmap.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* So Windows compiler ignores gcc __attribute__(x) */
+#define __attribute__(a)
+
+/* Type for handle to dynamically loaded library */
+typedef HINSTANCE LIB_HANDLE;
+
+/* Missing typedefs */
+typedef void * caddr_t;
+typedef u_long in_addr_t;
+
+typedef unsigned char uint8_t;
+typedef char int8_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned __int64 uint64_t;
+typedef __int64 int64_t;
+
+
+/* suffix for shared libraries */
+#ifdef _DEBUG
+#define LIB_EXTENSION "mdd.dll"
+#else
+#define LIB_EXTENSION "md.dll"
+#endif
+
+/* 8 byte int typedefs */
+typedef unsigned __int64 w_u64_t;
+typedef __int64 w_i64_t;
+
+/* Network conversion function */
+#define htonll(x) \
+ ((uint64_t)htonl((uint32_t)((x)>>32)) | (uint64_t)htonl((uint32_t)(x))<<32)
+#define ntohll(x) \
+ ((uint64_t)ntohl((uint32_t)((x)>>32)) | (uint64_t)ntohl((uint32_t)(x))<<32)
+
+/* For delimiting multiple paths in env variables properties */
+#define PATH_DELIM ';'
+
+#define PATHSEP "\\"
+COMMONExpDLL int
+wsocketstartup (void);
+
+COMMONExpDLL void
+wsocketcleanup (void);
+
+/* Socket Pair and set non blocking */
+COMMONExpDLL int
+wsocketpair (int domain, int type, int protocol, int* pair);
+
+COMMONExpDLL int
+wsetnonblock (int s);
+
+#define shutdown(x, y) closesocket((x))
+
+/* net work utility functions */
+COMMONExpDLL const char* getIpAddress (void);
+COMMONExpDLL const char* getHostName (void);
+COMMONExpDLL const char* getlogin (void);
+COMMONExpDLL struct in_addr wresolve_ip (const char * arg);
+
+/* Thread local storage */
+typedef DWORD wthread_key_t;
+
+COMMONExpDLL int
+wthread_key_create(wthread_key_t* key, void* val);
+
+#define wthread_key_delete(x) TlsFree(x)
+#define wthread_setspecific(x, val) TlsSetValue((x),(void*)((val)))
+#define wthread_getspecific(x) TlsGetValue((x))
+
+/* Posix Semaphores for Windows */
+typedef void* wsem_t;
+
+COMMONExpDLL
+int wsem_init (wsem_t* sem, int dummy, int count);
+
+COMMONExpDLL
+int wsem_destroy (wsem_t* sem);
+
+COMMONExpDLL
+int wsem_post (wsem_t* sem);
+
+COMMONExpDLL
+int wsem_wait (wsem_t* sem);
+
+COMMONExpDLL
+int wsem_timedwait (wsem_t* sem, unsigned int ts);
+
+COMMONExpDLL
+int wsem_trywait (wsem_t* sem);
+
+COMMONExpDLL
+int wsem_getvalue (wsem_t*, int* items);
+
+/* These functions are different on Windows */
+#define bzero( x, y ) ZeroMemory( ((void *)(x)), (y) )
+#define strtok_r(x, y, z) strtok((x),(y))
+#define snprintf _snprintf
+#define strdup _strdup
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+#define wread(x,y,z) recv((x),(y),(z),0)
+#define wwrite(x,y,z) send((x),(y),(z),0)
+#define close _close
+#define sleep(x) Sleep( (x)*1000)
+
+COMMONExpDLL
+int gettimeofday( struct timeval *result, void *dummy );
+
+COMMONExpDLL
+int getpid();
+
+const char *index( const char *str, char c );
+
+#define ctime_r ctime
+
+#define gmtime_r( _clock, _result ) \
+ ( *(_result) = *gmtime( (_clock) ), \
+ (_result) )
+
+/*
+ inttypes.h doesn't exist on windows.
+ emulate some definitions here.
+*/
+#define PRId64 "I64d"
+#define PRIu64 "I64u"
+#ifndef INT8_MIN
+#define INT8_MIN SCHAR_MIN
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX SCHAR_MAX
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN SHRT_MIN
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX SHRT_MAX
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN INT_MIN
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX INT_MAX
+#endif
+#ifndef INT64_MIN
+#define INT64_MIN LLONG_MIN
+#endif
+#ifndef INT64_MAX
+#define INT64_MAX LLONG_MAX
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX UCHAR_MAX
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX USHRT_MAX
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX UINT_MAX
+#endif
+#ifndef UINT64_MAX
+#define UINT64_MAX ULLONG_MAX
+#endif
+
+#define wthread_detach( h ) /* noop */
+#define wthread_self GetCurrentThread
+#define wthread_equal( h1, h2 ) ((h1) == (h2))
+
+#define wthread_cond_init( h, zip ) ((*(h)) = CreateEvent( NULL, 1, 0, NULL ))
+#define wthread_cond_signal( h ) (SetEvent( *(h) ))
+#define wthread_cond_destroy( h ) (CloseHandle( *(h) ))
+
+COMMONExpDLL DWORD
+wthread_cond_wait( HANDLE *event, LPCRITICAL_SECTION *cs );
+
+#define wthread_exit ExitThread
+
+#define wthread_cleanup_push( x, y ) /* noop */
+#define wthread_cleanup_pop(x) /* noop */
+
+#define CPU_AFFINITY_SET DWORD
+
+COMMONExpDLL int wthread_create( wthread_t *h, void *atts, void *(*startProc)( void * ), void *arg );
+COMMONExpDLL void wthread_destroy(wthread_t thread);
+COMMONExpDLL int wthread_join (wthread_t t, void **value_ptr);
+COMMONExpDLL void wthread_testcancel( wthread_t h );
+COMMONExpDLL void wthread_cancel( wthread_t h );
+COMMONExpDLL struct tm* localtime_r (const time_t* t, struct tm* result);
+COMMONExpDLL int wthread_set_affinity_mask( wthread_t h, CPU_AFFINITY_SET* dwThreadAffinityMask);
+
+typedef int wthread_attr_t;
+COMMONExpDLL void wthread_attr_init (int* attr);
+COMMONExpDLL void wthread_attr_setdetachstate (int* attr, int);
+
+typedef int wthread_mutexattr_t;
+COMMONExpDLL void wthread_mutexattr_init (int* attr);
+COMMONExpDLL void wthread_mutexattr_settype (int* attr, int);
+
+#define wGetCurrentThreadId GetCurrentThreadId
+
+/* Macros for shared library access */
+#define wdlopen(a,b) LoadLibrary(a)
+#define wdlclose FreeLibrary
+#define wdlerror GetLastError
+#define wdlsym GetProcAddress
+
+#define timersub(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
+ if ((vvp)->tv_usec < 0) { \
+ (vvp)->tv_sec--; \
+ (vvp)->tv_usec += 1000000; \
+ } \
+ } while (0)
+
+#define timeradd(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
+ if ((vvp)->tv_usec >= 1000000) { \
+ (vvp)->tv_sec++; \
+ (vvp)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+
+
+/* time gm not available on Windows */
+COMMONExpDLL
+time_t wtimegm (struct tm *tm);
+
+struct wtimespec
+{
+ time_t tv_sec;
+ long tv_nsec;
+};
+
+COMMONExpDLL int wnanosleep (struct wtimespec* ts, struct timnespec* remain);
+
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif
+
+#endif /* WINDOWS_H__ */
--
1.7.7.6


[PATCH 46/50] [unit tests] Fixed unit tests build

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>


Signed-off-by: Mike Schonberg <mschonberg@...>
---
mama/c_cpp/src/gunittest/c/Makefile.am | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/mama/c_cpp/src/gunittest/c/Makefile.am b/mama/c_cpp/src/gunittest/c/Makefile.am
index abbfee9..13b5915 100644
--- a/mama/c_cpp/src/gunittest/c/Makefile.am
+++ b/mama/c_cpp/src/gunittest/c/Makefile.am
@@ -29,13 +29,16 @@ CFLAGS += -pedantic -Wno-long-long -O2 -pthread -fPIC
CPPFLAGS += -pedantic -Wno-long-long -O2 -pthread -fPIC
endif

-INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../.. -I$(srcdir)/../../../examples
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../.. -I$(srcdir)/../../../examples -I$(srcdir)/../../../../../common/c_cpp/src/c

CFLAGS += -I@builddir@/../../c
CPPFLAGS += -I@builddir@/../../c

-LIBS = -lmama -lwombatcommon -lgtest

+LDFLAGS += -L${srcdir}/../../c \
+ -L${srcdir}/../../../../../common/c_cpp/src/c
+
+LIBS = -lmama -lwombatcommon -lgtest

bin_PROGRAMS = MainUnitTestC

--
1.7.7.6


[PATCH 45/50] [mama] Remove msgFieldPayload from mamaMsg

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>


Signed-off-by: Mike Schonberg <mschonberg@...>
---
mama/c_cpp/src/c/msg.c | 26 +-------------------------
1 files changed, 1 insertions(+), 25 deletions(-)

diff --git a/mama/c_cpp/src/c/msg.c b/mama/c_cpp/src/c/msg.c
index d3c0e80..c0530a6 100644
--- a/mama/c_cpp/src/c/msg.c
+++ b/mama/c_cpp/src/c/msg.c
@@ -85,8 +85,6 @@ typedef struct mamaMsgImpl_
mamaMsgField mCurrentField;
mamaDateTime mCurrentDateTime;

-
- msgFieldPayload mFieldPayload;
/*Hold onto the bridge impl for later use*/
mamaBridgeImpl* mBridgeImpl;
/*The bridge specific message*/
@@ -124,13 +122,6 @@ mamaMsg_destroy (mamaMsg msg)

if (impl->mPayloadBridge && impl->mMessageOwner)
{
- if (impl->mFieldPayload)
- {
- impl->mPayloadBridge->msgFieldPayloadDestroy (
- impl->mFieldPayload);
- impl->mFieldPayload = NULL;
- }
-
if (MAMA_STATUS_OK != impl->mPayloadBridge->msgPayloadDestroy (impl->mPayload))
{
mama_log (MAMA_LOG_LEVEL_ERROR, "mamaMsg_destroy(): "
@@ -197,12 +188,6 @@ mamaMsg_clear (mamaMsg msg)

if (impl->mPayloadBridge)
{
- if (impl->mFieldPayload)
- {
- impl->mPayloadBridge->msgFieldPayloadDestroy (
- impl->mFieldPayload);
- }
-
if (MAMA_STATUS_OK != impl->mPayloadBridge->msgPayloadClear (impl->mPayload))
{
mama_log (MAMA_LOG_LEVEL_ERROR, "mamaMsg_clear(): "
@@ -579,7 +564,6 @@ mamaMsgImpl_createNestedForPayload (mamaMsg* result,

mamaMsgField_create (&impl->mCurrentField);
impl->mCurrentField->myPayloadBridge = parent->mPayloadBridge;
- impl->mFieldPayload = NULL;
impl->mPayloadBridge = parent->mPayloadBridge;
impl->mPayload = payload;
impl->mParent = parent;
@@ -645,7 +629,6 @@ mamaMsgImpl_createForPayload (mamaMsg* msg,

impl->mPayload = payload;
impl->mPayloadBridge = payloadBridge;
- impl->mFieldPayload = NULL;
/*These will be set later if necessary*/
impl->mBridgeImpl = NULL;
impl->mBridgeMessage = NULL;
@@ -1740,22 +1723,15 @@ mamaMsg_getField(

mamaField = (mamaMsgFieldImpl*)impl->mCurrentField;

- if (!impl->mFieldPayload)
- {
- impl->mPayloadBridge->msgFieldPayloadCreate (
- &impl->mFieldPayload);
- }
-
if (MAMA_STATUS_OK!=(status = impl->mPayloadBridge->msgPayloadGetField (
impl->mPayload,
name,
fid,
- &impl->mFieldPayload)))
+ &impl->mCurrentField->myPayload)))
{
return status;
}
impl->mCurrentField->myPayloadBridge = impl->mPayloadBridge;
- impl->mCurrentField->myPayload = impl->mFieldPayload;
impl->mCurrentField->myMsg = impl;

mamaField = (mamaMsgFieldImpl*)impl->mCurrentField;
--
1.7.7.6


[PATCH 44/50] [testtools] Renamed shutdown() method in executables

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

Renamed shutdown() to xxxShutdown() to avoid namespace conflicts with Windows
system libraries.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
.../src/testtools/performance/c/mamaconsumerc_v2.c | 6 +++---
.../src/testtools/performance/c/mamapingpongc.c | 6 +++---
.../src/testtools/performance/c/mamaproducerc_v2.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/mama/c_cpp/src/testtools/performance/c/mamaconsumerc_v2.c b/mama/c_cpp/src/testtools/performance/c/mamaconsumerc_v2.c
index 13b52c6..2dd8153 100644
--- a/mama/c_cpp/src/testtools/performance/c/mamaconsumerc_v2.c
+++ b/mama/c_cpp/src/testtools/performance/c/mamaconsumerc_v2.c
@@ -457,7 +457,7 @@ static void signalCatcher
int sig
);

-static void shutdown(void);
+static void consumerShutdown (void);

static void printHeader
(
@@ -1126,7 +1126,7 @@ int main (int argc, const char** argv)
displayStatsGroupBuckets(&gStatsGroup);
}

- shutdown();
+ consumerShutdown();

for(i=0; i<NUM_STATS_GROUPS; ++i)
destroyStatsGroup(&(gStatsGroups[i]));
@@ -1195,7 +1195,7 @@ static void printHeader
}


-static void shutdown(void)
+static void consumerShutdown (void)
{
int i;
unsigned nsecSleep = gThrottle != -1 ? 1000000000 / gThrottle : 0;
diff --git a/mama/c_cpp/src/testtools/performance/c/mamapingpongc.c b/mama/c_cpp/src/testtools/performance/c/mamapingpongc.c
index 8069892..775db81 100644
--- a/mama/c_cpp/src/testtools/performance/c/mamapingpongc.c
+++ b/mama/c_cpp/src/testtools/performance/c/mamapingpongc.c
@@ -243,7 +243,7 @@ static void signalCatcher
int sig
);

-static void shutdown(pingPongCtx* ppCtx, pingPongEventCtx* eventCtx);
+static void pingpongShutdown (pingPongCtx* ppCtx, pingPongEventCtx* eventCtx);

static void
initMessages(message* pMsgs,
@@ -375,7 +375,7 @@ int main (int argc, const char** argv)
/* start the mama bridge, blocks here */
mama_start (gPingPongCtx.mBridge);

- shutdown(&gPingPongCtx, &eventCtx);
+ pingpongShutdown (&gPingPongCtx, &eventCtx);
mama_close ();

if(!eventCtx.mServer)
@@ -491,7 +491,7 @@ static void publishMessage
seqNum++;
}

-static void shutdown(pingPongCtx* ppCtx, pingPongEventCtx* eventCtx)
+static void pingpongShutdown (pingPongCtx* ppCtx, pingPongEventCtx* eventCtx)
{
pthread_mutexattr_t attr;

diff --git a/mama/c_cpp/src/testtools/performance/c/mamaproducerc_v2.c b/mama/c_cpp/src/testtools/performance/c/mamaproducerc_v2.c
index b8884df..bb64e53 100644
--- a/mama/c_cpp/src/testtools/performance/c/mamaproducerc_v2.c
+++ b/mama/c_cpp/src/testtools/performance/c/mamaproducerc_v2.c
@@ -309,7 +309,7 @@ static void displayCallback
void* closure
);

-static void shutdown
+static void producerShutdown
(
uint32_t msgVar
);
@@ -943,7 +943,7 @@ int main (int argc, const char **argv)
}
pthread_mutex_unlock (&pendingShutdownLock);

- shutdown(msgVar);
+ producerShutdown (msgVar);

MAMA_CHECK (mamaDateTime_destroy (gLastDisplayTime));
MAMA_CHECK (mamaDateTime_destroy (gNowTime));
@@ -953,7 +953,7 @@ int main (int argc, const char **argv)
return 0;
}

-static void shutdown
+static void producerShutdown
(
uint32_t msgVar
)
--
1.7.7.6


[PATCH 43/50] [mama] GCC 4.6.2 Support

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

GCC 4.6.2 requires -ldl and -lrt.

Signed-off-by: Mike Schonberg <mschonberg@...>
---
.../src/testtools/capturereplay/c/Makefile.am | 2 +-
mama/c_cpp/src/testtools/load/c/Makefile.am | 2 +-
mama/c_cpp/src/testtools/performance/c/Makefile.am | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mama/c_cpp/src/testtools/capturereplay/c/Makefile.am b/mama/c_cpp/src/testtools/capturereplay/c/Makefile.am
index 9614251..fc398ed 100644
--- a/mama/c_cpp/src/testtools/capturereplay/c/Makefile.am
+++ b/mama/c_cpp/src/testtools/capturereplay/c/Makefile.am
@@ -37,7 +37,7 @@ CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
CPPFLAGS += -pedantic -Wall -Wimplicit -Wno-long-long -D_GNU_SOURCE
endif

-LDADD = -lmama -lpthread -lm -lwombatcommon
+LDADD = -lmama -lpthread -lm -lwombatcommon -ldl

bin_PROGRAMS = capturereplayc capturec captureconvert

diff --git a/mama/c_cpp/src/testtools/load/c/Makefile.am b/mama/c_cpp/src/testtools/load/c/Makefile.am
index fbf016f..75fc832 100755
--- a/mama/c_cpp/src/testtools/load/c/Makefile.am
+++ b/mama/c_cpp/src/testtools/load/c/Makefile.am
@@ -36,7 +36,7 @@ CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
CPPFLAGS += -pedantic -Wall -Wimplicit -Wno-long-long -D_GNU_SOURCE
endif

-LDADD = -lmama -lpthread -lm -lwombatcommon
+LDADD = -lmama -lpthread -lm -lwombatcommon -ldl


bin_PROGRAMS = mamachurnc
diff --git a/mama/c_cpp/src/testtools/performance/c/Makefile.am b/mama/c_cpp/src/testtools/performance/c/Makefile.am
index eb19b6e..26f9673 100644
--- a/mama/c_cpp/src/testtools/performance/c/Makefile.am
+++ b/mama/c_cpp/src/testtools/performance/c/Makefile.am
@@ -36,7 +36,7 @@ CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
CPPFLAGS += -pedantic -Wall -Wimplicit -Wno-long-long -D_GNU_SOURCE
endif

-LDADD = -lmama -lpthread -lm -lwombatcommon
+LDADD = -lmama -lpthread -lm -lwombatcommon -ldl -lrt


bin_PROGRAMS = mamaproducerc \
--
1.7.7.6


[PATCH 42/50] [common] C Linkage for Detroy Handle

Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>


Signed-off-by: Mike Schonberg <mschonberg@...>
---
common/c_cpp/src/c/destroyHandle.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/common/c_cpp/src/c/destroyHandle.h b/common/c_cpp/src/c/destroyHandle.h
index 08d2067..80c008d 100644
--- a/common/c_cpp/src/c/destroyHandle.h
+++ b/common/c_cpp/src/c/destroyHandle.h
@@ -33,6 +33,9 @@
* although the object may be gone the thread will have valid memory to access.
*/

+#if defined(__cplusplus)
+extern "C" {
+#endif
/* ************************************************************** */
/* Includes. */
/* ************************************************************** */
@@ -121,5 +124,8 @@ extern
void *
destroyHandle_removeReference(
pDestroyHandle handle);
+#if defined(__cplusplus)
+}
+#endif

#endif
--
1.7.7.6

2141 - 2160 of 2312