• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision275 (tree)
Time2012-02-02 23:30:52
Authorshirayanagi

Log Message

NaCl 更新

Change Summary

Incremental Difference

--- trunk/framework/sample/Windows/unittest/src/container_test/test_aspect.cpp (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/container_test/test_aspect.cpp (revision 275)
@@ -0,0 +1,44 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file test_accessor.cpp
5+ * @brief FndAccessor テスト ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2010 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+#define _FILE_test_aspect_CPP_
18+
19+//======================================================================
20+// include
21+#include "unit/gt/gt_inchead.h"
22+#include "fnd/container/FndAspect.h"
23+#include "iris_using.h"
24+
25+class CTester
26+{
27+public:
28+ void Update(void)
29+ {
30+ }
31+};
32+
33+TEST(FndAspectTest, Log)
34+{
35+ typedef CLogAspect<CTester*> CTesterLogAspect;
36+ typedef CAspectual< CTester*, CTesterLogAspect > CTesterAspectual;
37+ typedef CAspectual< CTester*, CLogAspect<CTester*, CTesterLogAspect> > CTesterAspectual2;
38+
39+ CTester tester;
40+ CTesterAspectual a1(&tester);
41+ CTesterAspectual2 a2(&tester);
42+ a1->Update();
43+ a2->Update();
44+}
--- trunk/framework/sample/Windows/unittest/src/nacl_test/index.html (revision 274)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/index.html (revision 275)
@@ -29,6 +29,7 @@
2929 </dd>
3030 <dt><a href="hash/hash.html">Hash</a></dt>
3131 <dt><a href="prime/prime.html">is prime number</a></dt>
32+ <dt><a href="iutest/index.html">iutest</a></dt>
3233 <dt><a href="input/index.html">input</a></dt>
3334 <dt><a href="file/index.html">file</a></dt>
3435 <dt><a href="test/test.html">test</a></dt>
--- trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/main.cpp (revision 274)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/main.cpp (revision 275)
@@ -7,8 +7,8 @@
77 /*
88 * include testing framework
99 */
10-#include "../include/iutest.h"
11-//#include "../include/gtest/iutest_switch.h"
10+#include "iutest.h"
11+//#include "gtest/iutest_switch.h"
1212
1313 class FooEnvironment : public iutest::Environment
1414 {
@@ -22,12 +22,10 @@
2222 }
2323 };
2424
25-#ifdef UNICODE
26-int wmain(int argc, const wchar_t* argv[])
27-#else
28-int main(int argc, const char* argv[])
29-#endif
25+int iutest_main(std::vector<std::string> argv)
3026 {
27+ int argc = argv.size();
28+
3129 #if 0
3230 iutest::detail::auto_ptr<iutest::Environment> env = iutest::AddGlobalTestEnvironment(new FooEnvironment());
3331 FooEnvironment env2;
@@ -36,7 +34,7 @@
3634
3735 //iutest::IUTEST_FLAG(shuffle) = false;
3836 //iutest::IUTEST_FLAG(throw_on_failure) = true;
39- IUTEST_INIT(argc, argv);
37+ iutest::InitIrisUnitTest(argv);
4038 return IUTEST_RUN_ALL_TESTS(); // run all
4139 }
4240
--- trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/sub.cpp (revision 274)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/sub.cpp (revision 275)
@@ -7,7 +7,7 @@
77 /*
88 * include testing framework
99 */
10-#include "../include/iutest.h"
10+#include "iutest.h"
1111
1212 #if 1 // Success Tests
1313
--- trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/index.html (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/index.html (revision 275)
@@ -0,0 +1,127 @@
1+<!DOCTYPE html>
2+<html lang="ja">
3+
4+
5+
6+
7+
8+<head>
9+<title>test</title>
10+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11+<script type="text/javascript" src="http://www.google.com/jsapi"></script>
12+<script type="text/javascript">google.load("jquery", "1.5");</script>
13+
14+<script type="text/javascript">
15+ hModule = null; // Global application object.
16+ statusText = 'NO-STATUS';
17+ var kMaxArraySize = 20;
18+ var messageArray = new Array();
19+
20+ function moduleDidLoad() {
21+ hModule = document.getElementById('iutest');
22+ // Add a message handler that accepts messages coming from the NaCl
23+ // module.
24+ hModule.addEventListener('message', handleMessage, false);
25+ updateStatus('SUCCESS');
26+ }
27+
28+ // Handle a message coming from the NaCl module.
29+ function handleMessage(message) {
30+ // Show last |kMaxArraySize| events in html.
31+ messageArray.push(message.data);
32+ if (messageArray.length > kMaxArraySize) {
33+ messageArray.shift();
34+ }
35+ var newData = messageArray.join('<BR>');
36+ document.getElementById('eventString').innerHTML = newData;
37+ // Print event to console.
38+ console.log(message.data);
39+ }
40+
41+ // If the page loads before the Native Client module loads, then set the
42+ // status message indicating that the module is still loading. Otherwise,
43+ // do not change the status message.
44+ function pageDidLoad() {
45+ if (hModule == null) {
46+ updateStatus('LOADING...');
47+ } else {
48+ // It's possible that the Native Client module onload event fired
49+ // before the page's onload event. In this case, the status message
50+ // will reflect 'SUCCESS', but won't be displayed. This call will
51+ // display the current message.
52+ updateStatus();
53+ }
54+ }
55+
56+ function main() {
57+ var inputBox = document.forms.iutestForm.inputBox;
58+ helloWorldModule.postMessage('main:' + inputBox.value);
59+ }
60+
61+ // Set the global status message. If the element with id 'statusField'
62+ // exists, then set its HTML to the status message as well.
63+ // opt_message The message test. If this is null or undefined, then
64+ // attempt to set the element with id 'statusField' to the value of
65+ // |statusText|.
66+ function updateStatus(opt_message) {
67+ if (opt_message)
68+ statusText = opt_message;
69+ var statusField = document.getElementById('status_field');
70+ if (statusField) {
71+ statusField.innerHTML = statusText;
72+ }
73+ }
74+</script>
75+</head>
76+
77+<body onload="pageDidLoad()">
78+<!--[if lte IE 8]>
79+<p style="font-size : 20pt; padding : 1em ;">
80+IE では動作しません。
81+<a href="http://www.google.co.jp/chrome/intl/ja/landing_ie.html" target="_blank">Google Chrome</a> を利用してください。
82+</p>
83+<![endif]-->
84+<p>
85+ <form name="iutestForm" action="" method="get">
86+ <input type="text" id="inputBox" name="inputBox" value="Hello world" /><p>
87+ <input type="button" value="run" onclick="main()" />
88+ </form>
89+ <!-- Load the published .nexe. This includes the 'src' attribute which
90+ shows how to load multi-architecture modules. Each entry in the "nexes"
91+ object in the .nmf manifest file is a key-value pair: the key is the runtime
92+ ('x86-32', 'x86-64', etc.); the value is a URL for the desired NaCl module.
93+ To load the debug versions of your .nexes, set the 'src' attribute to the
94+ _dbg.nmf version of the manifest file.
95+
96+ Note that the <EMBED> element is wrapped inside a <DIV>, which has a 'load'
97+ event listener attached. This method is used instead of attaching the 'load'
98+ event listener directly to the <EMBED> element to ensure that the listener
99+ is active before the NaCl module 'load' event fires.
100+ -->
101+ <div id="listener">
102+ <script type="text/javascript">
103+ function handleError(e) {
104+ var embed_element = document.getElementById('iutest');
105+ window.alert('Error: lastError = ' + embed_element.lastError);
106+ }
107+ document.getElementById('listener')
108+ .addEventListener('error', handleError, true);
109+ document.getElementById('listener')
110+ .addEventListener('load', moduleDidLoad, true);
111+ </script>
112+
113+ <embed name="nacl_module"
114+ id="iutest"
115+ width="0" height="0"
116+ src="iutest.nmf"
117+ type="application/x-nacl" />
118+ </div>
119+
120+</p>
121+<h2>Events</h2>
122+<p><b id='eventString'>None</b></p>
123+
124+<h2>Status</h2>
125+<div id="status_field">NO-STATUS</div>
126+</body>
127+</html>
--- trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/iutest.cpp (nonexistent)
+++ trunk/framework/sample/Windows/unittest/src/nacl_test/iutest/iutest.cpp (revision 275)
@@ -0,0 +1,54 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file test.cpp
5+ * @brief test ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2011 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+
18+//======================================================================
19+// include
20+#include "web/nacl/core/NaclModule.h"
21+#include "web/nacl/core/NaclError.h"
22+#include "web/nacl/debug/NaclDebug.h"
23+#include "web/nacl/object/NaclScriptableObj.h"
24+#include "iris_using.h"
25+
26+int iutest_main(std::vector<std::string> argv);
27+
28+class iuTestInstance : public CInstance<iuTestInstance>
29+{
30+ typedef CInstance<iuTestInstance> _Mybase;
31+public:
32+ iuTestInstance(PP_Instance instance)
33+ : _Mybase(instance)
34+ {
35+ AddMethod("iutest_main", CMethodFactory::CreateMethod(iutest_main));
36+ }
37+};
38+
39+// エントリポイントの記述
40+typedef CModule<iuTestInstance> Module;
41+static CModuleEntry<Module> s_module_entry;
42+
43+#if 1
44+namespace pp
45+{
46+
47+Module* CreateModule()
48+{
49+ if( IModuleEntry::GetInstancePtr() == nullptr ) return nullptr;
50+ return IModuleEntry::GetInstance().CreateInstance();
51+}
52+
53+}
54+#endif
--- trunk/framework/src/c++0x/type_traits/cpp0x_base_derived_traits.hpp (revision 274)
+++ trunk/framework/src/c++0x/type_traits/cpp0x_base_derived_traits.hpp (revision 275)
@@ -15,6 +15,7 @@
1515 //======================================================================
1616 // include
1717 #include "cpp0x_cv_traits.hpp"
18+#include "cpp0x_class_traits.hpp"
1819 #include "cpp0x_same_traits.hpp"
1920
2021 namespace cpp0x
@@ -56,7 +57,7 @@
5657 #endif
5758 operator D const volatile *();
5859 };
59- enum { value = is_iml_yes_t( (is_bd_helper<B, D>::check_sig(host(), 0)) ) };
60+ static const bool value = is_iml_yes_t( (is_bd_helper<B, D>::check_sig(host(), 0)) );
6061 };
6162
6263 template<typename B, typename D>
@@ -90,11 +91,11 @@
9091 typedef typename selector::template rebind<ncvB, ncvD> binder;
9192 typedef typename binder::type type;
9293
93- enum { value = type::value };
94+ static const bool value = type::value;
9495 };
9596
9697 public:
97- enum { value = is_base_and_derived_impl<Base_, Derived_>::value };
98+ static const bool value = is_base_and_derived_impl<Base_, Derived_>::value;
9899 };
99100
100101 /// is base and derived
--- trunk/framework/src/c++0x/type_traits/cpp0x_convertible_traits.hpp (revision 274)
+++ trunk/framework/src/c++0x/type_traits/cpp0x_convertible_traits.hpp (revision 275)
@@ -26,40 +26,40 @@
2626
2727 //======================================================================
2828 // declare
29-template<typename _From, typename _To>class is_convertible; // 型変換可能かどうか
29+template<typename From, typename To>class is_convertible; // 型変換可能かどうか
3030
3131 //======================================================================
3232 // class
3333 /// is convertible
34-template<typename _From, typename _To>
34+template<typename From, typename To>
3535 class is_convertible
3636 {
37- template<typename _TFrom, typename TMP>struct does_convertible_exit
37+ template<typename TFrom, typename TMP>struct does_convertible_exit
3838 {
39- template<typename _TTo>struct result
39+ template<typename TTo>struct result
4040 {
4141 static iml::detail::no_t check(...);
42- static iml::detail::yes_t check(_TTo);
43- static _TFrom _from;
44- enum { value = is_iml_yes_t(check(_from)) };
42+ static iml::detail::yes_t check(TTo);
43+ static TFrom from_;
44+ enum { value = is_iml_yes_t(check(from_)) };
4545 };
4646 };
4747 template<typename TMP>struct does_convertible_exit<void, TMP>
4848 {
49- template<typename _TTo>struct result
49+ template<typename TTo>struct result
5050 {
51- enum { value = is_void<_TTo>::value };
51+ enum { value = is_void<TTo>::value };
5252 };
5353 };
5454
55- template<typename _TFrom, typename _TTo>struct is_convertible_base_impl
56- : public does_convertible_exit<_TFrom, void>:: template result<_TTo> {};
55+ template<typename TFrom, typename TTo>struct is_convertible_base_impl
56+ : public does_convertible_exit<TFrom, void>:: template result<TTo> {};
5757
58- template<typename _TFrom, typename _TTo>struct is_convertible_impl
58+ template<typename TFrom, typename TTo>struct is_convertible_impl
5959 {
60- typedef typename add_reference<_TFrom>::type ref_type;
61- enum { value = iml::op_and< is_convertible_base_impl<ref_type, _TTo>::value
62- , iml::op_not< is_array<_TTo>::value >::value
60+ typedef typename add_reference<TFrom>::type ref_type;
61+ enum { value = iml::op_and< is_convertible_base_impl<ref_type, TTo>::value
62+ , iml::op_not< is_array<TTo>::value >::value
6363 >::value
6464 };
6565 };
@@ -67,9 +67,9 @@
6767 template<bool trivaial1, bool trivaial2, bool abstract_target, typename TMP>
6868 struct is_convertible_select
6969 {
70- template<class _TF, class _TT>struct rebind
70+ template<class TF_, class TT_>struct rebind
7171 {
72- typedef is_convertible_impl<_TF, _TT> type;
72+ typedef is_convertible_impl<TF_, TT_> type;
7373 };
7474 };
7575
@@ -76,7 +76,7 @@
7676 template<typename TMP>
7777 struct is_convertible_select<true, true, false, TMP>
7878 {
79- template<class _TF, class _TT>struct rebind
79+ template<class TF_, class TT_>struct rebind
8080 {
8181 typedef iml::detail::true_type type;
8282 };
@@ -85,7 +85,7 @@
8585 template<typename TMP>
8686 struct is_convertible_select<false, false, true, TMP>
8787 {
88- template<class _TF, class _TT>struct rebind
88+ template<class TF_, class TT_>struct rebind
8989 {
9090 typedef iml::detail::false_type type;
9191 };
@@ -94,25 +94,25 @@
9494 template<typename TMP>
9595 struct is_convertible_select<true, false, true, TMP>
9696 {
97- template<class _TF, class _TT>struct rebind
97+ template<class TF_, class TT_>struct rebind
9898 {
9999 typedef iml::detail::false_type type;
100100 };
101101 };
102102
103- template<typename _TFrom, typename _TTo>struct is_convertible_dispach
103+ template<typename TFrom, typename TTo>struct is_convertible_dispach
104104 {
105105 typedef is_convertible_select<
106- is_arithmetic<_TFrom>::value
107- , is_arithmetic<_TTo>::value
108- , is_abstract<_TTo>::value
106+ is_arithmetic<TFrom>::value
107+ , is_arithmetic<TTo>::value
108+ , is_abstract<TTo>::value
109109 , void> selector;
110- typedef typename selector::template rebind<_TFrom, _TTo> binder;
110+ typedef typename selector::template rebind<TFrom, TTo> binder;
111111 typedef typename binder::type type;
112112 };
113113
114114 public:
115- enum { value = is_convertible_dispach<_From, _To>::type::value };
115+ enum { value = is_convertible_dispach<From, To>::type::value };
116116 };
117117
118118 } // end of namespace cpp0x
--- trunk/framework/src/web/nacl/input/NaclInputEvent.h (revision 274)
+++ trunk/framework/src/web/nacl/input/NaclInputEvent.h (revision 275)
@@ -72,6 +72,14 @@
7272 case PP_INPUTEVENT_TYPE_CONTEXTMENU:
7373 return OnContextMenu(rEvent.GetPosition(), rEvent);
7474 break;
75+
76+ // 警告対策
77+ case PP_INPUTEVENT_TYPE_WHEEL:
78+ case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
79+ case PP_INPUTEVENT_TYPE_KEYDOWN:
80+ case PP_INPUTEVENT_TYPE_KEYUP:
81+ case PP_INPUTEVENT_TYPE_CHAR:
82+ case PP_INPUTEVENT_TYPE_UNDEFINED:
7583 default:
7684 break;
7785 }
@@ -90,6 +98,16 @@
9098 return OnKeyUp(rEvent);
9199 case PP_INPUTEVENT_TYPE_CHAR:
92100 return OnKeyChar(rEvent);
101+
102+ // 警告対策
103+ case PP_INPUTEVENT_TYPE_MOUSEDOWN:
104+ case PP_INPUTEVENT_TYPE_MOUSEUP:
105+ case PP_INPUTEVENT_TYPE_MOUSEMOVE:
106+ case PP_INPUTEVENT_TYPE_MOUSEENTER:
107+ case PP_INPUTEVENT_TYPE_MOUSELEAVE:
108+ case PP_INPUTEVENT_TYPE_CONTEXTMENU:
109+ case PP_INPUTEVENT_TYPE_WHEEL:
110+ case PP_INPUTEVENT_TYPE_UNDEFINED:
93111 default:
94112 break;
95113 }
--- trunk/framework/src/web/nacl/object/NaclVar.h (revision 274)
+++ trunk/framework/src/web/nacl/object/NaclVar.h (revision 275)
@@ -97,6 +97,21 @@
9797 IRIS_VERIFYTHROW( var.is_string() );
9898 return var.AsString();
9999 }
100+ template<typename TN>
101+ static TN GetValue(const pp::Var& var, typename enable_if_t< cpp0x::is_same<TN, std::vector<std::string> > >::type*& = cpp0x::enabler::value )
102+ {
103+ IRIS_VERIFYTHROW( var.is_string() );
104+ std::string str = var.AsString();
105+ std::vector<std::string> vec;
106+ // スペースで分解
107+ std::stringstream stream(str);
108+ while( stream >> str )
109+ {
110+ vec.push_back(str);
111+ }
112+ return vec;
113+
114+ }
100115 };
101116
102117 class construct
--- trunk/framework/src/iris_types.hpp (revision 274)
+++ trunk/framework/src/iris_types.hpp (revision 275)
@@ -307,6 +307,45 @@
307307 STATICINLINE bool operator > (int lhs, const IrisVaugeBool& rhs) { return rhs > lhs; }
308308 STATICINLINE bool operator >= (int lhs, const IrisVaugeBool& rhs) { return rhs >= lhs; }
309309
310+
311+class TYPESAFE_FALSE_T;
312+/**
313+ * @brief 型キャストを厳格化した TRUE
314+*/
315+const
316+class TYPESAFE_TRUE_T
317+{
318+ void operator & (void) const ; //!< アドレス参照を禁止
319+
320+public:
321+ TYPESAFE_TRUE_T(void) {}
322+ // ? 演算子用
323+ TYPESAFE_TRUE_T(const TYPESAFE_FALSE_T&) {}
324+public:
325+ operator BOOL (void) const { return TRUE; }
326+public:
327+ BOOL operator == (BOOL rhs) const { return rhs; }
328+ BOOL operator != (BOOL rhs) const { return !rhs; }
329+} TYPESAFE_TRUE;
330+
331+/**
332+ * @brief 型キャストを厳格化した FALSE
333+*/
334+const
335+class TYPESAFE_FALSE_T
336+{
337+ void operator & (void) const ; //!< アドレス参照を禁止
338+public:
339+ TYPESAFE_FALSE_T(void) {}
340+ // ? 演算子用
341+ TYPESAFE_FALSE_T(const TYPESAFE_TRUE_T&) {}
342+public:
343+ operator BOOL (void) const { return FALSE; }
344+public:
345+ BOOL operator == (BOOL rhs) const { return !rhs; }
346+ BOOL operator != (BOOL rhs) const { return rhs; }
347+} TYPESAFE_FALSE;
348+
310349 #endif
311350
312351 #endif
Show on old repository browser