Changeset 34815
- Timestamp:
- 08/08/09 00:22:24 (4 years ago)
- Location:
- lang/objective-cplusplus/i3/trunk
- Files:
-
- 26 modified
-
am/i3.am (modified) (1 diff)
-
am/mil_test.am (modified) (2 diffs)
-
configure.ac (modified) (4 diffs)
-
src/Test3.cpp (modified) (2 diffs)
-
src/TestInputWindow1.h (modified) (2 diffs)
-
src/gui-windows/GuiTest1.cpp (modified) (1 diff)
-
src/gui-windows/InputWindowPlatform.cpp (modified) (1 diff)
-
src/mil/include/mil/Atomic.h (modified) (2 diffs)
-
src/mil/include/mil/DoubleBuffer.h (modified) (3 diffs)
-
src/mil/include/mil/Memory.h (modified) (6 diffs)
-
src/mil/include/mil/Module.h (modified) (1 diff)
-
src/mil/include/mil/ModuleCommon.h (modified) (4 diffs)
-
src/mil/include/mil/PrecompiledHeaders.h (modified) (1 diff)
-
src/mil/include/mil/Thread.h (modified) (1 diff)
-
src/mil/include/mil/gui-cocoa/CocoaThread.h (modified) (1 diff)
-
src/mil/include/mil/gui-cocoa/GuiModuleObjC.h (modified) (1 diff)
-
src/mil/include/mil/gui-windows/GuiModule.h (modified) (11 diffs)
-
src/mil/src/Test1.cpp (modified) (1 diff)
-
src/mil/src/Test10.cpp (modified) (4 diffs)
-
src/mil/src/Test11.cpp (modified) (1 diff)
-
src/mil/src/Test5.cpp (modified) (1 diff)
-
src/mil/src/Test8.cpp (modified) (1 diff)
-
src/mil/src/Test9.cpp (modified) (1 diff)
-
src/os-windows/CygwinPty.cpp (modified) (4 diffs)
-
src/os-windows/WindowsCommon.h (modified) (1 diff)
-
windows/release.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-cplusplus/i3/trunk/am/i3.am
r34376 r34815 43 43 44 44 else 45 i3_CXXFLAGS += #-fno-rtti45 i3_CXXFLAGS += -fno-rtti 46 46 i3_LDFLAGS += 47 47 i3_LDADD += -
lang/objective-cplusplus/i3/trunk/am/mil_test.am
r34812 r34815 20 20 21 21 # src/mil/src/Test11.cpp 22 # src/mil/src/BoostTestDummyLib.cpp23 22 24 23 mil_test_CXXFLAGS = ${i3_CXXFLAGS} \ … … 45 44 46 45 if WITH_CYGWIN 47 # for cygwin boost/test/included/unit_test.hpp 48 mil_test_CXXFLAGS += -DBOOST_DISABLE_WIN32 46 mil_test_CXXFLAGS += #-DBOOST_DISABLE_WIN32 49 47 mil_test_LDFLAGS += -Wl,--enable-auto-import 50 48 endif -
lang/objective-cplusplus/i3/trunk/configure.ac
r34792 r34815 3 3 4 4 AC_PREREQ(2.60) 5 5 6 AC_INIT([i3], [0.1alpha], [dyob@lunaport.net]) 7 #AC_INIT([i3], m4_esyscmd([./version.sh | tr -d '\n']), [dyob@lunaport.net]) 6 8 7 9 CFLAGS_before_configure="$CFLAGS" … … 10 12 11 13 AC_CONFIG_AUX_DIR([build-aux]) 12 #AM_INIT_AUTOMAKE([gnu no-define check-news std-options tar-paxfilename-length-max=99])14 #AM_INIT_AUTOMAKE([gnu no-define check-news std-options filename-length-max=99]) 13 15 AM_INIT_AUTOMAKE([gnu no-define check-news std-options]) 14 16 AC_CONFIG_SRCDIR([src/Main.cpp]) … … 230 232 AC_SUBST(CXXFLAGS_NO_LANG) 231 233 234 # -Wno-missing-field-initializers 235 AC_MSG_CHECKING([for -Wno-missing-field-initializers]) 236 CXXFLAGS_ORIG="$CXXFLAGS -Wno-missing-field-initializers" 237 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) 238 CXXFLAGS="$CXXFLAGS_ORIG" 239 232 240 # 233 241 # precompiled headers … … 235 243 236 244 use_gch=no 237 if test "$ enable_debug" = "yes"; then238 if test "$ GXX" = "yes"; then245 if test "$GXX" = "yes"; then 246 if test "$enable_debug" = "yes"; then 239 247 AC_MSG_CHECKING([for precompiled headers]) 240 248 CXXFLAGS_ORIG="$CXXFLAGS" -
lang/objective-cplusplus/i3/trunk/src/Test3.cpp
r34500 r34815 25 25 keybd_event( 'F', 0, KEYEVENTF_KEYUP, 0); 26 26 } 27 sleep(1);27 sleep(1); 28 28 29 mil::ExitEvent e;30 mediator.getInputWindow().post(e, *this);31 mediator.getDelegate().post(e, *this);32 destroy();29 mil::ExitEvent e; 30 mediator.getInputWindow().post(e, *this); 31 mediator.getDelegate().post(e, *this); 32 destroy(); 33 33 } 34 34 } … … 43 43 int argc = 0; 44 44 char** argv = NULL; 45 45 46 46 QT_CHECK_EQUAL(init_os_global_data(argc, argv), 0); 47 47 QT_CHECK_EQUAL(init_gui_global_data(argc, argv), 0); -
lang/objective-cplusplus/i3/trunk/src/TestInputWindow1.h
r34500 r34815 15 15 void run(); 16 16 template <typename T> 17 void execute(T& event) {}17 void execute(T& event) {} 18 18 }; 19 19 … … 23 23 DummyModule(Mediator& mediator) : mediator(mediator) {} 24 24 void createGui() {} 25 void run() {}25 void run() {} 26 26 template <typename T> 27 27 void execute(T& event) {} -
lang/objective-cplusplus/i3/trunk/src/gui-windows/GuiTest1.cpp
r34612 r34815 32 32 init_os_global_data(argc, argv); 33 33 init_gui_global_data(argc, argv); 34 34 35 35 basic_string<TCHAR> got; 36 36 #ifndef __CYGWIN__ -
lang/objective-cplusplus/i3/trunk/src/gui-windows/InputWindowPlatform.cpp
r34769 r34815 135 135 return HTCAPTION; 136 136 } 137 137 138 138 if (p.x >= layout.width - layout.margin_right - (layout.width - layout.nc_width) / 2) { 139 139 return HTRIGHT; -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Atomic.h
r34723 r34815 116 116 atomic() { 117 117 BOOST_STATIC_ASSERT(sizeof(T) <= sizeof(void*)); 118 118 119 119 store(T()); 120 120 } … … 148 148 return result2; 149 149 } 150 150 151 151 T fetch_and_add(T val) { 152 152 LONG* arg1 = memcpy_cast<LONG*>(&t); -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/DoubleBuffer.h
r34500 r34815 8 8 T buffer[2]; 9 9 int current_cache; 10 atomic<boost::uint32_t> status; // 0-15: newer buffer 0,1=offset11 // 16-32: reading buffer 0=idle 1=offset0, 2=offset110 atomic<boost::uint32_t> status; // 0-15: newer buffer 0,1=offset 11 // 16-32: reading buffer 0=idle 1=offset0, 2=offset1 12 12 13 13 DoubleBuffer() : current_cache(0), status(0) { … … 15 15 16 16 void write(T data) { 17 using namespace boost;17 using namespace boost; 18 18 // �ǂݍ��ݒ��̃o�b�t�@���ŐV�ł͂Ȃ��� 19 19 uint16_t c_newer = current_cache; … … 35 35 current_cache ^= 1; 36 36 } 37 37 38 38 bool read(T& result) { 39 39 int current = 0; -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Memory.h
r34812 r34815 61 61 BYTES = BYTES_, 62 62 }; 63 63 64 64 typedef SFINAE_CONDITION IsReturnMemoryEvent; 65 65 … … 83 83 } 84 84 85 #define MIL_ PRODUCER_MALLOCasdf86 #ifdef MIL_ PRODUCER_MALLOC85 #define MIL_MALLOC_PRODUCERoo 86 #ifdef MIL_MALLOC_PRODUCER 87 87 88 88 class Producer { … … 116 116 }; 117 117 118 #elif MIL_ PRODUCER_TBB118 #elif MIL_TBB_PRODUCER 119 119 #else 120 120 121 #define MIL_DEBUG_PRODUCER 121 #define MIL_DEBUG_PRODUCERiii 122 122 123 123 class Producer { … … 153 153 } 154 154 #else 155 {156 int blocks = Bytes2Blocks<BYTES>::value;157 if (blocks > MALLOC_BLOCKS_THESHOLD) {158 return ::malloc(BYTES);159 } else if (blocks == 1) {160 return p.malloc();161 } else {162 return p.ordered_malloc(blocks);163 }164 }155 { 156 int blocks = Bytes2Blocks<BYTES>::value; 157 if (blocks > MALLOC_BLOCKS_THESHOLD) { 158 return ::malloc(BYTES); 159 } else if (blocks == 1) { 160 return p.malloc(); 161 } else { 162 return p.ordered_malloc(blocks); 163 } 164 } 165 165 #endif 166 166 … … 172 172 if (d->os_thread_id != GetCurrentThreadId()) { 173 173 halt << "d->os_thread_id != GetCurrentThreadId(), " 174 << d->os_thread_id << " != " << GetCurrentThreadId();174 << d->os_thread_id << " != " << GetCurrentThreadId(); 175 175 } 176 176 if (d->mil_thread_id != thread_id) { 177 177 halt << "d->mil_thread_id == thread_id, " 178 << d->mil_thread_id << " != " << thread_id;178 << d->mil_thread_id << " != " << thread_id; 179 179 } 180 180 if (d->blocks != blocks) { 181 181 halt << "d->blocks != blocks, " 182 << d->blocks << " != " << blocks;182 << d->blocks << " != " << blocks; 183 183 } 184 184 ::free((void*)memory); 185 185 } 186 186 #else 187 {188 if (blocks > (size_t)MALLOC_BLOCKS_THESHOLD) {189 ::free((void*)memory);190 } else if (blocks == 1) {191 p.free(memory);192 } else {193 p.free(memory, blocks);194 }195 }187 { 188 if (blocks > (size_t)MALLOC_BLOCKS_THESHOLD) { 189 ::free((void*)memory); 190 } else if (blocks == 1) { 191 p.free(memory); 192 } else { 193 p.free(memory, blocks); 194 } 195 } 196 196 #endif 197 197 … … 254 254 }; 255 255 256 #endif // MIL_ PRODUCER_MALLOC, MIL_PRODUCER_TBB256 #endif // MIL_MALLOC_PRODUCER, MIL_TBB_PRODUCER 257 257 258 258 /** -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Module.h
r34801 r34815 5 5 6 6 namespace mil { 7 7 8 /** 8 9 * public members should be thread safe 9 10 */ 10 template <typename Child> 11 class Module : public ModuleCommon<Module<Child>, MIL_DEFAULT_THREAD> { 11 template <typename Child> 12 class Module : public ModuleCommon<Module<Child>, MIL_DEFAULT_THREAD> { 13 public: 14 Tls tls; 15 MIL_CRTP_CLASS_MEMBERS; 16 17 private: 18 class EventBase : public boost::noncopyable { 12 19 public: 13 Tls tls; 14 MIL_CRTP_CLASS_MEMBERS; 15 16 private: 17 class EventBase : public boost::noncopyable { 18 public: 19 void (*execute)(void* event, void* target); 20 intptr_t owner_id; 21 EventBase* next; 22 }; 23 24 class EventList : public boost::noncopyable { 25 EventBase* head; 26 EventBase* tail; 27 Mutex mutex; 28 public: 29 EventList() { 20 void (*execute)(void* event, void* target); 21 intptr_t owner_id; 22 EventBase* next; 23 }; 24 25 class EventList : public boost::noncopyable { 26 EventBase* head; 27 EventBase* tail; 28 Mutex mutex; 29 public: 30 EventList() { 31 head = NULL; 32 tail = NULL; 33 } 34 35 void push(EventBase& e) { 36 synchronized (mutex) { 37 e.next = NULL; 38 if (head == NULL) { // tail == NULL 39 head = &e; 40 tail = &e; 41 return; 42 } 43 tail->next = &e; 44 tail = &e; 45 } 46 } 47 48 void pop() { 49 synchronized (mutex) { 50 if (!head) { 51 return; 52 } 53 head = head->next; 54 } 55 } 56 57 EventBase* top() { 58 synchronized (mutex) { 59 return head; 60 } 61 62 return NULL; 63 } 64 65 void clear() { 66 synchronized (mutex) { 30 67 head = NULL; 31 68 tail = NULL; 32 69 } 33 34 void push(EventBase& e) { 35 synchronized (mutex) { 36 e.next = NULL; 37 if (head == NULL) { // tail == NULL 38 head = &e; 39 tail = &e; 40 return; 41 } 42 tail->next = &e; 43 tail = &e; 44 } 45 } 46 47 void pop() { 48 synchronized (mutex) { 49 if (!head) { 50 return; 51 } 52 head = head->next; 53 } 54 } 55 56 EventBase* top() { 57 synchronized (mutex) { 58 return head; 59 } 60 61 return NULL; 62 } 63 64 void clear() { 65 synchronized (mutex) { 66 head = NULL; 67 tail = NULL; 68 } 69 } 70 }; 71 72 template <typename T> 73 class Event : public EventBase { 74 public: 75 typedef T DataType; 76 T data; 77 }; 78 79 friend class Module_test; 80 81 private: 82 EventList list; 83 Conditional c; 84 bool repost; 85 bool breakLoopRequest; 86 atomic<bool> isWaiting; 87 70 } 71 }; 72 73 template <typename T> 74 class Event : public EventBase { 88 75 public: 76 typedef T DataType; 77 T data; 78 }; 79 80 friend class Module_test; 81 82 private: 83 EventList list; 84 Conditional c; 85 bool repost; 86 bool breakLoopRequest; 87 atomic<bool> isWaiting; 88 89 public: 89 90 Module() : tls(this->thread_id), repost(false), breakLoopRequest(false), isWaiting(false) { 90 } 91 92 void run() { 93 MIL_MODULE_GET_SUPER_CHILD(*this).loop(); 94 } 95 96 protected: 97 void repostEvent() { 98 repost = true; 99 } 100 101 template <typename Data, typename Sender> 102 static void dispatcher(void* event_, void* target_) { 103 typedef Child Target; 104 105 // XXX type safety?? 106 Target& target = *static_cast<Target*>(target_); 107 Event<Data>& event = *static_cast<Event<Data>*>(event_); 108 target.list.pop(); 109 target.repost = false; 110 ModuleExecuteProxy::execute<Data, Target>(event.data, target); 111 if (target.repost) { 112 target.list.push(event); 113 return; 114 } 115 116 if (IsExitEvent<Data>::value) { 117 return; 118 } 119 120 if (pool::is_return_memory_event<Event<Data> >() || unlikely(event.owner_id == target.thread_id)) { 121 // ReturnMemoryEvent 122 size_t blocks = pool::bytes_to_blocks(return_memory_considered_sizeof<Data>()); 123 target.tls.producer.free(&event, blocks); 124 return; 125 } 126 127 pool::MemoryList* m = target.tls.consumer.pop(event.owner_id); 128 if (!m) { 129 target.tls.consumer.store(&event); 130 return; 131 } 132 133 pool::ReturnMemoryEvent<sizeof(Event<Data>)> e; 134 e.memory = m; 135 void* t = threads[event.owner_id].load(); 136 if (unlikely(!t)) { 137 return; 138 } 139 (reinterpret_cast<Sender*>(t))->post(e, target, (void*)&event, event.owner_id); 140 } 141 142 public: 143 template <typename T, typename Sender> 144 //void post(const T& event, Sender& sender, void* memory, intptr_t owner_id) 145 void post(const T& event, Sender&, void* memory, intptr_t owner_id) { 146 Event<T>* e = new(memory) Event<T>; 147 e->data = event; 148 e->execute = dispatcher<T, Sender>; 149 e->owner_id = owner_id; 150 151 list.push(*e); 152 if (isWaiting.load()) { 153 c.signal(); 154 } 155 } 156 157 template <typename T, typename Sender> 158 void post(const T& event, Sender& sender) { 159 pool::Producer& producer = sender.tls.producer; 160 void* memory = producer.malloc<sizeof(Event<T>)>(); 161 if (unlikely(memory == NULL)) { 162 halt << "can't allocate event memory"; 163 return; 164 } 165 166 post(event, sender, memory, sender.tls.thread_id); 167 } 168 public: 169 void destroy() { 170 breakLoopRequest = true; 171 } 172 173 void requestExit(void* event_memory) { 174 list.clear(); 175 exitNotifier.tls.flush(); 176 ExitEvent e; 177 post(e, exitNotifier, event_memory, exitNotifier.tls.thread_id); 178 } 179 180 ~Module() { 181 do_auto_join(); 182 } 183 184 bool execute_front() { 91 } 92 93 void run() { 94 MIL_MODULE_GET_SUPER_CHILD(*this).loop(); 95 } 96 97 protected: 98 void repostEvent() { 99 repost = true; 100 } 101 102 template <typename Data, typename Sender> 103 static void dispatcher(void* event_, void* target_) { 104 typedef Child Target; 105 106 // XXX type safety?? 107 Target& target = *static_cast<Target*>(target_); 108 Event<Data>& event = *static_cast<Event<Data>*>(event_); 109 target.list.pop(); 110 target.repost = false; 111 ModuleExecuteProxy::execute<Data, Target>(event.data, target); 112 if (target.repost) { 113 target.list.push(event); 114 return; 115 } 116 117 if (IsExitEvent<Data>::value) { 118 return; 119 } 120 121 if (pool::is_return_memory_event<Event<Data> >() || unlikely(event.owner_id == target.thread_id)) { 122 // ReturnMemoryEvent 123 size_t blocks = pool::bytes_to_blocks(return_memory_considered_sizeof<Data>()); 124 target.tls.producer.free(&event, blocks); 125 return; 126 } 127 128 pool::MemoryList* m = target.tls.consumer.pop(event.owner_id); 129 if (!m) { 130 target.tls.consumer.store(&event); 131 return; 132 } 133 134 pool::ReturnMemoryEvent<sizeof(Event<Data>)> e; 135 e.memory = m; 136 void* t = threads[event.owner_id].load(); 137 if (unlikely(!t)) { 138 return; 139 } 140 (reinterpret_cast<Sender*>(t))->post(e, target, (void*)&event, event.owner_id); 141 } 142 143 public: 144 template <typename T, typename Sender> 145 //void post(const T& event, Sender& sender, void* memory, intptr_t owner_id) 146 void post(const T& event, Sender&, void* memory, intptr_t owner_id) { 147 Event<T>* e = new(memory) Event<T>; 148 e->data = event; 149 e->execute = dispatcher<T, Sender>; 150 e->owner_id = owner_id; 151 152 list.push(*e); 153 if (isWaiting.load()) { 154 c.signal(); 155 } 156 } 157 158 template <typename T, typename Sender> 159 void post(const T& event, Sender& sender) { 160 pool::Producer& producer = sender.tls.producer; 161 void* memory = producer.malloc<sizeof(Event<T>)>(); 162 if (unlikely(memory == NULL)) { 163 halt << "can't allocate event memory"; 164 return; 165 } 166 167 post(event, sender, memory, sender.tls.thread_id); 168 } 169 public: 170 void destroy() { 171 breakLoopRequest = true; 172 } 173 174 void requestExit(void* event_memory) { 175 list.clear(); 176 exitNotifier.tls.flush(); 177 ExitEvent e; 178 post(e, exitNotifier, event_memory, exitNotifier.tls.thread_id); 179 } 180 181 ~Module() { 182 do_auto_join(); 183 } 184 185 bool execute_front() { 186 EventBase* e = list.top(); 187 if (e) { 188 e->execute((void*)e, (void*)this); 189 return true; 190 } 191 return false; 192 } 193 194 protected: 195 void loop() { 196 while (!breakLoopRequest) { 185 197 EventBase* e = list.top(); 186 198 if (e) { 187 199 e->execute((void*)e, (void*)this); 188 return true; 189 } 190 return false; 191 } 192 193 protected: 194 void loop() { 195 while (!breakLoopRequest) { 196 EventBase* e = list.top(); 197 if (e) { 198 e->execute((void*)e, (void*)this); 199 } else { 200 isWaiting.store(true); 201 c.wait(); 202 isWaiting.store(false); 203 } 204 } 205 breakLoopRequest = false; 206 } 207 }; 200 } else { 201 isWaiting.store(true); 202 c.wait(); 203 isWaiting.store(false); 204 } 205 } 206 breakLoopRequest = false; 207 } 208 }; 208 209 209 210 } -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/ModuleCommon.h
r34794 r34815 62 62 template <class EventData, class Target> 63 63 static void execute_body(EventData& data, Target& target, ...) { 64 MIL_MODULE_SUPER_CHILD_TYPE(Target)& o = 64 MIL_MODULE_SUPER_CHILD_TYPE(Target)& o = 65 65 MIL_MODULE_GET_SUPER_CHILD(target); 66 66 … … 70 70 template <class, class Target> 71 71 static void execute_body(ExitEvent, Target& target, ...) { 72 MIL_MODULE_SUPER_CHILD_TYPE(Target)& o = 72 MIL_MODULE_SUPER_CHILD_TYPE(Target)& o = 73 73 MIL_MODULE_GET_SUPER_CHILD(target); 74 74 … … 94 94 template <class T> 95 95 void post_exit_template(void* obj, void* event_memory) { 96 MIL_MODULE_SUPER_CHILD_TYPE(T)& o = 96 MIL_MODULE_SUPER_CHILD_TYPE(T)& o = 97 97 MIL_MODULE_GET_SUPER_CHILD(*reinterpret_cast<T*>(obj)); 98 98 … … 102 102 template <class T> 103 103 void join_template(void* obj) { 104 MIL_MODULE_SUPER_CHILD_TYPE(T)& o = 104 MIL_MODULE_SUPER_CHILD_TYPE(T)& o = 105 105 MIL_MODULE_GET_SUPER_CHILD(*reinterpret_cast<T*>(obj)); 106 106 -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/PrecompiledHeaders.h
r34328 r34815 139 139 //#include <boost/crc.hpp> 140 140 #include <boost/cstdint.hpp> 141 #include <boost/format.hpp>141 //#include <boost/format.hpp> 142 142 //#include <boost/foreach.hpp> 143 143 //#include <boost/function.hpp> -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Thread.h
r34792 r34815 178 178 static int thread_routine_filtered(int, char** argv) { 179 179 Thread<Child, ThreadType>* obj = (Thread<Child, ThreadType>*)argv; 180 typedef Thread<Child, ThreadType> Type;181 182 MIL_MODULE_SUPER_CHILD_TYPE(Type)& o = 180 typedef Thread<Child, ThreadType> Type; 181 182 MIL_MODULE_SUPER_CHILD_TYPE(Type)& o = 183 183 MIL_MODULE_GET_SUPER_CHILD(*obj); 184 184 -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/gui-cocoa/CocoaThread.h
r34792 r34815 1 1 #pragma once 2 2 3 @interface WorkerThread : NSObject { 3 @interface WorkerThread : 4 NSObject { 4 5 void* (*routine)(void*); 5 6 void* arg; -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/gui-cocoa/GuiModuleObjC.h
r34447 r34815 1 @interface WindowType : NSWindow2 {1 @interface WindowType : 2 NSWindow { 3 3 ParentType* parent; 4 4 } -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/gui-windows/GuiModule.h
r34801 r34815 17 17 */ 18 18 template <typename Child> 19 class GuiModule : public ModuleCommon<GuiModule<Child>, MIL_DEFAULT_THREAD> {19 class GuiModule : public ModuleCommon<GuiModule<Child>, MIL_DEFAULT_THREAD> { 20 20 public: 21 21 MIL_CRTP_CLASS_MEMBERS; … … 27 27 28 28 template <typename T> 29 class Event : public EventBase {29 class Event : public EventBase { 30 30 public: 31 31 typedef T DataType; … … 50 50 Tls tls; 51 51 52 GuiModule() :53 hSharedWnd(NULL),54 breakLoopRequest(false),55 breakLoopRequestShared(false),56 repost(false),57 handled(true),58 handled_result(0),59 hLocalWnd(NULL),60 tls(this->thread_id),61 wndproc(getChild()) {52 GuiModule() : 53 hSharedWnd(NULL), 54 breakLoopRequest(false), 55 breakLoopRequestShared(false), 56 repost(false), 57 handled(true), 58 handled_result(0), 59 hLocalWnd(NULL), 60 tls(this->thread_id), 61 wndproc(getChild()) { 62 62 } 63 63 … … 82 82 83 83 template <typename Data, typename Sender> 84 static void dispatch(void* event_, void* target_) {84 static void dispatch(void* event_, void* target_) { 85 85 typedef Child Target; 86 86 Target& target = *static_cast<Target*>(target_); … … 121 121 return; 122 122 } 123 123 124 124 pool::MemoryList* m = target.tls.consumer.pop(event.owner_id); 125 125 if (!m) { … … 127 127 return; 128 128 } 129 129 130 130 pool::ReturnMemoryEvent<sizeof(Event<Data>)> e; 131 131 e.memory = m; … … 197 197 198 198 template <typename Sender> 199 HWND getCachedHWnd(Sender& sender, bool flush = false) {199 HWND getCachedHWnd(Sender& sender, bool flush = false) { 200 200 HWND hWnd = NULL; 201 201 … … 212 212 213 213 template <class Sender> 214 void postWindowsMessage(Sender& sender, UINT msg, LPARAM lParam, WPARAM wParam) {214 void postWindowsMessage(Sender& sender, UINT msg, LPARAM lParam, WPARAM wParam) { 215 215 if (!PostMessage(getCachedHWnd(sender), msg, lParam, wParam)) { 216 216 DWORD e = GetLastError(); … … 222 222 223 223 template <typename T, typename Sender> 224 void post(const T& event, Sender& sender, void* memory, intptr_t owner_id) {224 void post(const T& event, Sender& sender, void* memory, intptr_t owner_id) { 225 225 Event<T>* e = new(memory) Event<T>; 226 226 e->data = event; … … 234 234 235 235 template <typename T, typename Sender> 236 void post(const T& event, Sender& sender) {236 void post(const T& event, Sender& sender) { 237 237 if (sizeof(T) <= sizeof(LPARAM)) { 238 238 LPARAM l = 0; … … 314 314 315 315 mil::WindowProcedureRedirector< 316 GuiModule<Child>, &GuiModule<Child>::WindowProcedure> wndproc;316 GuiModule<Child>, &GuiModule<Child>::WindowProcedure> wndproc; 317 317 }; 318 318 -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test1.cpp
r34474 r34815 320 320 m.execute_front(); 321 321 QT_CHECK_EQUAL(global, 3); 322 322 323 323 } 324 324 { -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test10.cpp
r34519 r34815 24 24 25 25 QT_CHECK_EQUAL(a.load(), (T)0); 26 26 27 27 a.store((T)1); 28 28 QT_CHECK_EQUAL(a.load(), (T)1); … … 54 54 a.store((T)I28BIT(0x12345678)); 55 55 bool b = a.bool_compare_and_swap( 56 (T)I28BIT(0x12345678), (T)I28BIT(0xabcdef98));56 (T)I28BIT(0x12345678), (T)I28BIT(0xabcdef98)); 57 57 QT_CHECK_EQUAL(b, true); 58 58 QT_CHECK_EQUAL(a.load(), (T)I28BIT(0xabcdef98)); 59 59 60 60 b = a.bool_compare_and_swap( 61 (T)I28BIT(0x12345678), (T)I28BIT(0xabcdef98));61 (T)I28BIT(0x12345678), (T)I28BIT(0xabcdef98)); 62 62 QT_CHECK_EQUAL(b, false); 63 63 QT_CHECK_EQUAL(a.load(), (T)I28BIT(0xabcdef98)); … … 82 82 a.store(-8); 83 83 QT_CHECK_EQUAL(a.load(), -8); 84 84 85 85 temp = a.fetch_and_add(-10); 86 86 QT_CHECK_EQUAL(temp, -8); … … 120 120 DoubleBuffer<int> db; 121 121 int data = 0; 122 122 123 123 db.write(100); 124 124 db.read(data); -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test11.cpp
r34812 r34815 128 128 129 129 QT_TEST(test_iaodfioasdfadfaadfasdfadfiiiii) { 130 131 #ifdef MIL_DEBUG_PRODUCER 132 puts("debug producer"); 133 #endif 134 135 #ifdef MIL_TBB_PRODUCER 136 puts("tbb producer"); 137 #endif 138 139 #ifdef MIL_MALLOC_PRODUCER 140 puts("malloc producer"); 141 #endif 142 130 143 n_times(); 131 144 puts("---"); -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test5.cpp
r34447 r34815 72 72 { 73 73 int c = 8; 74 for (ForScopeChecker c; false;) {74 for (ForScopeChecker c; false;) { 75 75 } 76 76 c = c / 5 % 8 * 124; -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test8.cpp
r34769 r34815 120 120 QT_CHECK_NOT_EQUAL(v1.capacity(), v2.capacity()); 121 121 v2 = v1; 122 QT_CHECK_NOT_EQUAL(v1.capacity(), v2.capacity()); 122 QT_CHECK_NOT_EQUAL(v1.capacity(), v2.capacity()); 123 123 } 124 124 -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test9.cpp
r34769 r34815 160 160 161 161 for (int i = 0; i < 50; i++) { 162 162 163 163 MiddleEvent m; 164 164 m.data = 2; -
lang/objective-cplusplus/i3/trunk/src/os-windows/CygwinPty.cpp
r34678 r34815 5 5 template <size_t Size> 6 6 bool query_registory(HKEY root, const TCHAR* SubKey, const TCHAR* value, TCHAR (&retval)[Size]) { 7 HKEY h kResult= NULL;7 HKEY hKey = NULL; 8 8 LONG result = RegOpenKeyEx( 9 root,10 SubKey,11 0,12 KEY_EXECUTE,13 &hkResult);14 9 root, 10 SubKey, 11 0, 12 KEY_EXECUTE, 13 &hKey); 14 15 15 if (result != ERROR_SUCCESS) { 16 16 return false; … … 20 20 DWORD cbCd = sizeof(retval); 21 21 result = RegQueryValueEx( 22 hkResult,23 value,24 NULL,25 &type,26 (BYTE*)retval,27 &cbCd);22 hKey, 23 value, 24 NULL, 25 &type, 26 (BYTE*)retval, 27 &cbCd); 28 28 29 RegClose(hKey); 29 30 if (result != ERROR_SUCCESS) { 30 31 return false; … … 67 68 TCHAR cd[2000] = {}; 68 69 if (!query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygwin\\setup"), TEXT("rootdir"), cd) && 69 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Wow6432Node\\Cygwin\\setup"), TEXT("rootdir"), cd) &&70 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), cd) &&71 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Wow6432Node\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), cd)) {70 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Wow6432Node\\Cygwin\\setup"), TEXT("rootdir"), cd) && 71 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), cd) && 72 !query_registory(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Wow6432Node\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), cd)) { 72 73 return false; 73 74 } … … 85 86 HANDLE cp = GetCurrentProcess(); 86 87 if (!DuplicateHandle(cp, hMyStdInput , cp, NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) || 87 !DuplicateHandle(cp, hMyStdOutput, cp, NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) ||88 !DuplicateHandle(cp, hMyStdError , cp, NULL, 0, FALSE, DUPLICATE_SAME_ACCESS)) {88 !DuplicateHandle(cp, hMyStdOutput, cp, NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) || 89 !DuplicateHandle(cp, hMyStdError , cp, NULL, 0, FALSE, DUPLICATE_SAME_ACCESS)) { 89 90 90 91 return false; -
lang/objective-cplusplus/i3/trunk/src/os-windows/WindowsCommon.h
r34447 r34815 62 62 namespace i3 { 63 63 extern struct dll_ { 64 BOOL (WINAPI *dll_SetLayeredWindowAttributes)(COLORREF crKey, BYTE bAlpha, DWORD dwFlags);64 BOOL (WINAPI *dll_SetLayeredWindowAttributes)(COLORREF crKey, BYTE bAlpha, DWORD dwFlags); 65 65 66 bool have_dwmapi_dll;67 HRESULT (WINAPI *dll_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset);68 HRESULT (WINAPI *dll_DwmIsCompositionEnabled)(BOOL *pfEnabled);69 HRESULT (WINAPI *dll_DwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind);70 HRESULT (WINAPI *dll_DwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend);71 } dll;66 bool have_dwmapi_dll; 67 HRESULT (WINAPI *dll_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset); 68 HRESULT (WINAPI *dll_DwmIsCompositionEnabled)(BOOL *pfEnabled); 69 HRESULT (WINAPI *dll_DwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind); 70 HRESULT (WINAPI *dll_DwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend); 71 } dll; 72 72 extern HINSTANCE hInstance; 73 73 -
lang/objective-cplusplus/i3/trunk/windows/release.sh
r34769 r34815 11 11 #export CROSS_HOST=i386-mingw32msvc 12 12 export CROSS_HOST=i586-mingw32msvc 13 export CFLAGS="-O3 -DNDEBUG "13 export CFLAGS="-O3 -DNDEBUG -U_DEBUG" 14 14 export CXXFLAGS="$CFLAGS" 15 export LDFLAGS="-s -L/usr/local/$CROSS_HOST/lib"15 export LDFLAGS="-s" 16 16 # cross compile: 17 17 # *binutils
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)