Changeset 36146
- Timestamp:
- 12/16/09 03:22:32 (3 years ago)
- Location:
- lang/objective-cplusplus/i3/trunk
- Files:
-
- 4 modified
-
configure.ac (modified) (7 diffs)
-
scripts/ac_init_version.sh (modified) (1 diff)
-
src/mil/include/mil/PrecompiledHeaders.h (modified) (3 diffs)
-
src/mil/include/mil/Synchronize.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-cplusplus/i3/trunk/configure.ac
r36145 r36146 24 24 AC_PROG_CXXCPP # for cygwin 25 25 AC_PROG_CXX 26 AC_PROG_CPP_WERROR 26 27 #AC_PROG_OBJC 27 28 AC_LANG([C++]) … … 103 104 104 105 #AC_CHECK_PROG(GNUSTEP_CONFIG, gnustep-config) 105 which gnustep-config > /dev/null 106 if test $? -eq 0; then 107 GNUSTEP_CONFIG="gnustep-config" 106 107 for command in \ 108 "$GNUSTEP_CONFIG" \ 109 gnustep-config \ 110 ~/GNUstep/System/Tools/gnustep-config \ 111 /usr/local/GNUstep/System/Tools/gnustep-config \ 112 /usr/GNUstep/System/Tools/gnustep-config \ 113 ; do 114 which $command > /dev/null 115 if test $? -eq 0; then 116 GNUSTEP_CONFIG=$command 117 break 118 fi 119 done 120 121 if test "$GNUSTEP_CONFIG" != ""; then 108 122 if test "$enable_debug" = "yes"; then 109 123 debug_arg="--debug" … … 132 146 if test "$with_gui" != "windows"; then 133 147 AC_MSG_CHECKING([for Objective C++]) 134 prologue="class Foo {}; @interface Bar {} @end @implementation Bar @end"135 148 body="Foo foo; Bar* bar;" 136 149 LDFLAGS_ORIG="$LDFLAGS" 137 150 LDFLAGS="$LDFLAGS -xobjective-c++" 138 151 AC_LINK_IFELSE( 139 [AC_LANG_PROGRAM([[$prologue]], [[$body]])], 152 [AC_LANG_PROGRAM( 153 [[ 154 #import <Cocoa/Cocoa.h> 155 class Foo {}; 156 @interface Bar {} 157 @end 158 @implementation Bar 159 @end 160 ]], 161 [[$body]])], 140 162 [AC_MSG_RESULT([yes])], 141 163 [AC_MSG_FAILURE([Objective C++ compiler/linker does not work])]) … … 143 165 fi 144 166 145 AC_PROG_CPP_WERROR146 167 AC_CHECK_HEADERS([__NON__EXISTANT__HEADER__FILE__], 147 168 [AC_MSG_FAILURE([no error when include file is not found])]) … … 217 238 218 239 AC_MSG_CHECKING([for unnamed semaphore]) 219 prog="sem_t sem; return (sem_init(&sem, 0, 0) == 0) ? EXIT_SUCCESS : EXIT_FAILURE;" 240 prologue="#include <semaphore.h>" 241 body="sem_t sem; return (sem_init(&sem, 0, 0) == 0) ? EXIT_SUCCESS : EXIT_FAILURE;" 220 242 AC_LINK_IFELSE( 221 243 [AC_LANG_PROGRAM([[]], [[$prog]])], … … 239 261 CXXFLAGS_ORIG="$CXXFLAGS" 240 262 AC_MSG_CHECKING([for __sync_bool_compare_and_swap]) 241 prog="int data = 0; __sync_bool_compare_and_swap(&data, 0, 1);"242 263 243 264 gcc_atomic_operations_found() { … … 246 267 } 247 268 269 body="int data = 0; __sync_bool_compare_and_swap(&data, 0, 1);" 270 248 271 AC_LINK_IFELSE( 249 [AC_LANG_PROGRAM([[]], [[$ prog]])],272 [AC_LANG_PROGRAM([[]], [[$body]])], 250 273 [gcc_atomic_operations_found], 251 274 [ 252 275 CXXFLAGS="$CXXFLAGS -march=$host_cpu" 253 276 AC_LINK_IFELSE( 254 [AC_LANG_PROGRAM([[]], [[$ prog]])],277 [AC_LANG_PROGRAM([[]], [[$body]])], 255 278 [gcc_atomic_operations_found], 256 279 [AC_MSG_RESULT([no]); CXXFLAGS="$CXXFLAGS_ORIG"])]) -
lang/objective-cplusplus/i3/trunk/scripts/ac_init_version.sh
r36132 r36146 18 18 fi 19 19 20 REVISION=`LC_ALL=en svn info | grep "Last Changed Rev:" | head -n 1 | cut -d ' ' -f 4`20 REVISION=`LC_ALL=en svn info 2> /dev/null | grep "Last Changed Rev:" | head -n 1 | cut -d ' ' -f 4` 21 21 UPDATES=`svn status | grep -v "^\?"` 22 22 if [ "${UPDATES}" != "" ]; then -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/PrecompiledHeaders.h
r34863 r36146 39 39 40 40 #if defined(MIL_GUI_COCOA) 41 42 //#define class MIL_REPLACE_class 43 //#import <AppKit/NSObjectController.h> 44 //#undef class 45 41 46 #import <Foundation/Foundation.h> 42 47 #import <AppKit/AppKit.h> … … 44 49 #include "gui-cocoa/PrecompiledHeaders.h" 45 50 46 //#define Object MIL_ BOOST_replace_Object51 //#define Object MIL_REPLACE_Object 47 52 //#include <boost/lambda/lambda.hpp> 48 53 //#undef Object … … 50 55 #ifdef __APPLE__ 51 56 #ifdef HAVE_BOOST_DETAIL_IS_INCREMENTABLE_HPP 52 #define check MIL_ BOOST_replace_check57 #define check MIL_REPLACE_check 53 58 #include <boost/ptr_container/detail/static_move_ptr.hpp> 54 59 #undef check -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Synchronize.h
r36145 r36146 9 9 #include <unistd.h> 10 10 #include <sched.h> 11 #include <boost/cstdint.hpp> 11 12 12 13 /** … … 61 62 }; 62 63 63 #ifdef __APPLE__64 64 class Semaphore { 65 Mutex mutex; 66 unsigned int value; 67 public: 68 Semaphore() : value(0) { 65 sem_t unnamed_sem; 66 sem_t* psem; 67 public: 68 Semaphore() { 69 70 #ifdef HAVE_UNNAMED_SEMAPHOREfoo 71 if (sem_init(&unnamed_sem, 0, 0) == -1) { 72 halt << "sem_init() failed"; 73 } 74 psem = &unnamed_sem; 75 #else 76 std::stringstream name; 77 name << "/" PACKAGE_NAME PACKAGE_VERSION "-pid" << getpid(); 78 psem = sem_open(name.str().c_str(), O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR, 0); 79 if (reinterpret_cast<intptr_t>(psem) == 80 reinterpret_cast<intptr_t>(-1)) { 81 halt << "sem_open() failed"; 82 } 83 #endif 84 69 85 } 70 86 71 87 void passeren() { 88 sem_post(psem); 72 89 } 73 90 … … 77 94 78 95 void verhoog() { 96 sem_wait(psem); 79 97 } 80 98 … … 84 102 85 103 ~Semaphore() { 86 }87 };88 #else89 class Semaphore {90 sem_t sem;91 public:92 Semaphore() {93 if (sem_init(&sem, 0, 0) == -1) {94 halt << "Semaphore(): failed";95 }96 }97 98 void passeren() {99 sem_post(&sem);100 }101 102 void p() {103 104 passeren(); 104 } 105 106 void verhoog() { 107 sem_wait(&sem); 108 } 109 110 void v() { 111 verhoog(); 112 } 113 114 ~Semaphore() { 115 passeren(); 116 for (size_t retry = 500; sem_destroy(&sem) == -1; retry--) { 105 for (size_t retry = 500; sem_destroy(psem) == -1; retry--) { 117 106 if (!retry) { 118 107 halt << "~Semaphore(): failed."; … … 123 112 } 124 113 }; 125 #endif126 114 127 115 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)