Author: tabish
Date: Thu Oct 7 18:53:35 2010
New Revision: 1005572
URL: http://svn.apache.org/viewvc?rev=1005572&view=rev
Log:
Include the start of an example app. Make the cms.h file work in either C or
C++ code.
Added:
activemq/activemq-cpp/trunk/activemq-c/src/examples/
activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am (with
props)
activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c (with props)
Modified:
activemq/activemq-cpp/trunk/activemq-c/Makefile.am
activemq/activemq-cpp/trunk/activemq-c/configure.ac
activemq/activemq-cpp/trunk/activemq-c/src/main/c/cms.h
Modified: activemq/activemq-cpp/trunk/activemq-c/Makefile.am
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/Makefile.am?rev=1005572&r1=1005571&r2=1005572&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-c/Makefile.am Thu Oct 7 18:53:35 2010
@@ -18,7 +18,7 @@
# Since we don't strictly follow the GNU standard of having 'NEWS README
AUTHORS ChangeLog' files
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src/main/c
+SUBDIRS = src/main/c src/examples
if BUILD_CPPUNIT_TESTS
SUBDIRS += src/test/c
endif
@@ -26,7 +26,7 @@ endif
#Distribute these directories:
DIST_SUBDIRS = src/main/c
-bin_SCRIPTS = activemqc-1-config
+bin_SCRIPTS = activemqc-config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = activemq-c.pc
Modified: activemq/activemq-cpp/trunk/activemq-c/configure.ac
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/configure.ac?rev=1005572&r1=1005571&r2=1005572&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/configure.ac (original)
+++ activemq/activemq-cpp/trunk/activemq-c/configure.ac Thu Oct 7 18:53:35 2010
@@ -193,6 +193,7 @@ AC_SUBST([DECAF_TEST_CXXFLAGS])
## Flags for building the activemq-c library
AC_SUBST([AMQ_CXXFLAGS])
+AC_SUBST([AMQ_CFLAGS])
AC_SUBST([AMQ_LIBS])
if test "$GCC" = "yes"; then
@@ -209,7 +210,8 @@ else
AMQ_TEST_CXXFLAGS="$AMQ_CXXFLAGS $AMQCPP_INCLUDES $AMQCPP_CPPFLAGS
$DECAF_INCLUDES $DECAF_CXXFLAGS"
fi
-AMQ_TEST_LIBS="../main/libactivemq-c.la $AMQCPP_LIBS $DECAF_LIBS"
+AMQ_TEST_CFLAGS="$AMQ_CXXFLAGS $AMQCPP_INCLUDES $AMQCPP_CPPFLAGS
$DECAF_INCLUDES $DECAF_CXXFLAGS"
+AMQ_TEST_LIBS="../main/c/libactivemq-c.la $AMQCPP_LIBS $DECAF_LIBS"
## Flags for building the test applications.
AC_SUBST([AMQ_TEST_CXXFLAGS])
@@ -244,6 +246,7 @@ AC_OUTPUT_COMMANDS([chmod +x activemqc-c
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(activemq-c.pc)
AC_CONFIG_FILES(src/main/c/Makefile)
+AC_CONFIG_FILES(src/examples/Makefile)
AC_CONFIG_FILES(activemqc-config)
if test x$cppunit = xyes
Added: activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am?rev=1005572&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am (added)
+++ activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am Thu Oct 7
18:53:35 2010
@@ -0,0 +1,28 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+main_example_sources = main.c
+
+##
+## Compiler / Linker Info
+##
+
+## Main Example
+bin_PROGRAMS = example
+example_SOURCES = $(main_example_sources)
+example_LDADD= $(AMQ_TEST_LIBS)
+example_CFLAGS = $(AMQ_TEST_CFLAGS) -I$(srcdir)/../main/c
Propchange: activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/activemq-cpp/trunk/activemq-c/src/examples/Makefile.am
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c?rev=1005572&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c (added)
+++ activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c Thu Oct 7
18:53:35 2010
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cms.h>
+#include <CMS_Destination.h>
+
+#include <stdio.h>
+
+int main(int argc, char* argv[]) {
+
+ cms_initialize();
+
+ printf("=====================================================\n");
+ printf("Starting the example:\n");
+ printf("-----------------------------------------------------\n");
+
+
+
+ printf("-----------------------------------------------------\n");
+ printf("Finished with the example.\n");
+ printf("=====================================================\n");
+
+ cms_terminate();
+}
+
+// END SNIPPET: demo
Propchange: activemq/activemq-cpp/trunk/activemq-c/src/examples/main.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/cms.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/cms.h?rev=1005572&r1=1005571&r2=1005572&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/cms.h (original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/cms.h Thu Oct 7 18:53:35
2010
@@ -54,30 +54,30 @@ typedef struct CMS_Destination CMS_Desti
*/
/** Enum that defines the various message types supported by CMS. */
-enum MESSAGE_TYPE {
+typedef enum {
CMS_MESSAGE,
CMS_BYTES_MESSAGE,
CMS_MAP_MESSAGE,
CMS_STREAM_MESSAAGE,
CMS_TEXT_MESSAGE
-};
+} MESSAGE_TYPE;
/** Enum that defines the various destination types that are supported by CMS.
*/
-enum DESTINATION_TYPE {
+typedef enum {
CMS_TOPIC,
CMS_QUEUE,
CMS_TEMPORARY_TOPIC,
CMS_TEMPORARY_QUEUE
-};
+} DESTINATION_TYPE;
/** Enum that defines the various Message Acknowledgment modes that are
supported by CMS. */
-enum ACKNOWLEDGMENT_MODE {
+typedef enum {
AUTO_ACKNOWLEDGE,
DUPS_OK_ACKNOWLEDGE,
CLIENT_ACKNOWLEDGE,
SESSION_TRANSACTED,
INDIVIDUAL_ACKNOWLEDGE
-};
+} ACKNOWLEDGMENT_MODE;
/** Result code returned from wrapper functions to indicate success or
failure. */
typedef int cms_status;