summaryrefslogtreecommitdiffstats
path: root/cxx
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-06 23:42:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-06 23:42:04 +0000
commitc4c5d5de79310b4bf5de373be45aea1f23f9806c (patch)
tree007e7c5dc861fe28f5d5ad0d9dee13f4dd4c83f2 /cxx
parent2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-examples-c4c5d5de79310b4bf5de373be45aea1f23f9806c.tar.bz2
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* cxx_throw/init.cc, libcpp/Makefile, libcpp/README, libcpp/foo.cc, libcpp/foo.h, libcpp/foo1.cpp: Now builds. * libcpp/.cvsignore: New file.
Diffstat (limited to 'cxx')
-rw-r--r--cxx/ChangeLog6
-rw-r--r--cxx/cxx_throw/init.cc25
-rw-r--r--cxx/libcpp/.cvsignore1
-rw-r--r--cxx/libcpp/Makefile26
-rw-r--r--cxx/libcpp/README6
-rw-r--r--cxx/libcpp/foo.cc9
-rw-r--r--cxx/libcpp/foo.h8
-rw-r--r--cxx/libcpp/foo1.cpp9
8 files changed, 50 insertions, 40 deletions
diff --git a/cxx/ChangeLog b/cxx/ChangeLog
index 856ef29..a394d6c 100644
--- a/cxx/ChangeLog
+++ b/cxx/ChangeLog
@@ -1,5 +1,11 @@
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
+ * cxx_throw/init.cc, libcpp/Makefile, libcpp/README, libcpp/foo.cc,
+ libcpp/foo.h, libcpp/foo1.cpp: Now builds.
+ * libcpp/.cvsignore: New file.
+
+2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
+
* cxx_throw/.cvsignore: New file.
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
diff --git a/cxx/cxx_throw/init.cc b/cxx/cxx_throw/init.cc
index 562e3f5..b17341f 100644
--- a/cxx/cxx_throw/init.cc
+++ b/cxx/cxx_throw/init.cc
@@ -5,10 +5,6 @@
* clock is required for the test, it should also be set to a known
* value by this function.
*
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
* COPYRIGHT (c) 1994 by Division Incorporated
* Based in part on OAR works.
*
@@ -25,11 +21,11 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef RTEMS_TEST_IO_STREAM
-#include <iostream.h>
+ #include <iostream>
#endif
extern "C" {
-extern rtems_task main_task(rtems_task_argument);
+ extern rtems_task main_task(rtems_task_argument);
}
static int num_inst = 0;
@@ -114,7 +110,7 @@ cdtest(void)
B bleak;
#ifdef RTEMS_TEST_IO_STREAM
- cout << "Testing a C++ I/O stream" << endl;
+ std::cout << "Testing a C++ I/O stream" << std::endl;
#else
printf("IO Stream not tested\n");
#endif
@@ -133,14 +129,14 @@ cdtest(void)
printf( "catch got called, exception handling worked !!!\n" );
}
-//
-// main equivalent
-// It can not be called 'main' since the bsp owns that name
-// in many implementations in order to get global constructors
-// run.
-//
+extern "C" {
+ rtems_task Init(
+ rtems_task_argument arg
+ );
+};
+
rtems_task Init(
rtems_task_argument
)
@@ -158,7 +154,8 @@ rtems_task Init(
#include <bsp.h>
-#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
diff --git a/cxx/libcpp/.cvsignore b/cxx/libcpp/.cvsignore
new file mode 100644
index 0000000..fecf58a
--- /dev/null
+++ b/cxx/libcpp/.cvsignore
@@ -0,0 +1 @@
+o-optimize
diff --git a/cxx/libcpp/Makefile b/cxx/libcpp/Makefile
index a3f9408..f6133ac 100644
--- a/cxx/libcpp/Makefile
+++ b/cxx/libcpp/Makefile
@@ -9,30 +9,21 @@ LIBNAME=libfoo.a # xxx- your library names goes here
LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
-C_PIECES=
-C_FILES=$(C_PIECES:%=%.c)
-C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+C_FILES=
+C_O_FILES=$(C_FILES:%.c=${ARCH}/%.o)
-CC_PIECES=foo
-CC_FILES=$(CC_PIECES:%=%.cc)
-CC_O_FILES=$(CC_PIECES:%=${ARCH}/%.o)
+CC_FILES=foo.cc
+CC_O_FILES=$(CC_FILES:%.cc=${ARCH}/%.o)
-CPP_PIECES=foo1
-CPP_FILES=$(CPP_PIECES:%=%.cpp)
-CPP_O_FILES=$(CPP_PIECES:%=${ARCH}/%.o)
+CPP_FILES=foo1.cpp
+CPP_O_FILES=$(CPP_FILES:%.cpp=${ARCH}/%.o)
H_FILES=foo.h
-# Assembly source names, if any, go here -- minus the .s
-S_PIECES=
-S_FILES=$(S_PIECES:%=%.s)
-S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
-
-SRCS=$(C_FILES) $(CC_FILES) $(CPP_FILES) $(H_FILES) $(S_FILES)
-OBJS=$(C_O_FILES) $(CC_O_FILES) $(CPP_O_FILES) $(S_O_FILES)
+SRCS=$(C_FILES) $(CC_FILES) $(CPP_FILES) $(H_FILES)
+OBJS=$(C_O_FILES) $(CC_O_FILES) $(CPP_O_FILES)
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
-
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/lib.cfg
@@ -59,7 +50,6 @@ CFLAGS +=
# to just run 'make clean' first to see what gets missed.
# 'make clobber' already includes 'make clean'
#
-
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
diff --git a/cxx/libcpp/README b/cxx/libcpp/README
index 1a172ad..340da49 100644
--- a/cxx/libcpp/README
+++ b/cxx/libcpp/README
@@ -1 +1,7 @@
+#
+# $Id$
+#
+
Example C++ library submitted by Ralf Corsepius <corsepiu@faw.uni-ulm.de>.
+
+The C++ is just place holders to illustrate the Makefile mechanics needed.
diff --git a/cxx/libcpp/foo.cc b/cxx/libcpp/foo.cc
index b0da6d0..2d518b7 100644
--- a/cxx/libcpp/foo.cc
+++ b/cxx/libcpp/foo.cc
@@ -1,8 +1,11 @@
+//
+// $Id$
+//
#include "foo.h"
-ostream& operator << ( ostream & strm, const foo &f)
+std::ostream& operator << ( std::ostream & strm, const foo &f)
{
- strm << f.i ;
- return strm ;
+ strm << f.i;
+ return strm;
}
diff --git a/cxx/libcpp/foo.h b/cxx/libcpp/foo.h
index ba27d39..95780ec 100644
--- a/cxx/libcpp/foo.h
+++ b/cxx/libcpp/foo.h
@@ -1,3 +1,7 @@
+//
+// $Id$
+//
+
#ifndef _foo_h
#define _foo_h
@@ -10,8 +14,8 @@ public :
foo() : i(0) {} ;
foo( const int i0 ) : i(i0) {};
- friend ostream& operator << (ostream&,const foo&);
- friend ostream& operator << (ostream&,const foo&, const foo&);
+ friend std::ostream& operator << (std::ostream&,const foo&);
+ friend std::ostream& operator << (std::ostream&,const foo*);
};
#endif
diff --git a/cxx/libcpp/foo1.cpp b/cxx/libcpp/foo1.cpp
index f77751f..9b4316a 100644
--- a/cxx/libcpp/foo1.cpp
+++ b/cxx/libcpp/foo1.cpp
@@ -1,8 +1,11 @@
+//
+// $Id$
+//
#include "foo.h"
-ostream& operator << ( ostream & strm, const foo &f, const foo &f1 )
+std::ostream& operator << ( std::ostream & strm, const foo *f )
{
- strm << f.i ;
- return strm ;
+ strm << f->i;
+ return strm;
}