• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision271 (tree)
Time2012-01-26 18:03:18
Authorshirayanagi

Log Message

angelscript 更新
80bit float の double への変換が間違っていたので修正

Change Summary

Incremental Difference

--- trunk/framework/src/platform/windows/win/wx_support.h (revision 270)
+++ trunk/framework/src/platform/windows/win/wx_support.h (revision 271)
@@ -149,8 +149,10 @@
149149
150150 #if _MSC_VER <= _MSC_VER_VC8
151151 typedef LONG LSTATUS;
152+#if !defined(_WIN32_WCE)
152153 typedef DWORD NTSTATUS;
153154 #endif
155+#endif
154156
155157 #if defined(_WIN64)
156158 # define GWL_WNDPROC GWLP_WNDPROC
--- trunk/framework/src/iris_platform.h (revision 270)
+++ trunk/framework/src/iris_platform.h (revision 271)
@@ -76,6 +76,7 @@
7676 # if defined(IRIS_WIN32_WCE)
7777 # include <altcecrt.h>
7878 # include <kfuncs.h>
79+# include <typeinfo>
7980 # endif
8081 #elif defined(IRIS_IPHONE) // for iPhone
8182 # include <stdio.h>
--- trunk/framework/src/audio/format/aiff/AXAIFF.cpp (revision 270)
+++ trunk/framework/src/audio/format/aiff/AXAIFF.cpp (revision 271)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -205,7 +205,8 @@
205205 m_Format.nChannels = format.Channels;
206206 m_Format.wBitsPerSample = format.wBitsPerSample;
207207 m_Format.nBlockAlign = (m_Format.wBitsPerSample * m_Format.nChannels) / 8u;
208- m_Format.nSamplesPerSec = static_cast<u32>((double)format.SampleRate); // 80bit ieee -> dobule に変換しています。
208+ double sample_rate = format.SampleRate; // 80bit ieee -> dobule に変換しています。
209+ m_Format.nSamplesPerSec = static_cast<u32>(sample_rate);
209210 m_Format.nAvgBytesPerSec = m_Format.nBlockAlign * m_Format.nSamplesPerSec;
210211 m_File.Ascend();
211212
--- trunk/framework/src/script/angelscript/AsContext.cpp (revision 270)
+++ trunk/framework/src/script/angelscript/AsContext.cpp (revision 271)
@@ -175,6 +175,49 @@
175175
176176 /**********************************************************************//**
177177 *
178+ * 戻り値の取得
179+ *
180+ -----------------------------------------------------------------------
181+ * @param [in] type = 要求型タイプ
182+ * @return 戻り値
183+*//***********************************************************************/
184+CAsVariant CAsContext::GetReturnValue(int type) const
185+{
186+ if( m_pContext != nullptr )
187+ {
188+ switch( type )
189+ {
190+ case asTYPEID_BOOL:
191+ case asTYPEID_INT8:
192+ case asTYPEID_UINT8:
193+ return CAsVariant(m_pContext->GetReturnByte());
194+ case asTYPEID_INT16:
195+ case asTYPEID_UINT16:
196+ return CAsVariant(m_pContext->GetReturnWord());
197+ case asTYPEID_INT32:
198+ case asTYPEID_UINT32:
199+ return CAsVariant(m_pContext->GetReturnDWord());
200+ case asTYPEID_INT64:
201+ case asTYPEID_UINT64:
202+ return CAsVariant(m_pContext->GetReturnQWord());
203+ case asTYPEID_FLOAT:
204+ return CAsVariant(m_pContext->GetReturnFloat());
205+ case asTYPEID_DOUBLE:
206+ return CAsVariant(m_pContext->GetReturnDouble());
207+ case asTYPEID_APPOBJECT:
208+ return CAsVariant(CAsVariant::TypeObject<asTYPEID_APPOBJECT>(), m_pContext->GetReturnObject());
209+ case asTYPEID_SCRIPTOBJECT:
210+ return CAsVariant(CAsVariant::TypeObject<asTYPEID_SCRIPTOBJECT>(), m_pContext->GetReturnObject());
211+ case asTYPEID_VOID:
212+ default:
213+ break;
214+ }
215+ }
216+ return CAsVariant();
217+}
218+
219+/**********************************************************************//**
220+ *
178221 * 実行
179222 *
180223 -----------------------------------------------------------------------
--- trunk/framework/src/script/angelscript/AsFunction.cpp (revision 270)
+++ trunk/framework/src/script/angelscript/AsFunction.cpp (revision 271)
@@ -45,6 +45,7 @@
4545 *//***********************************************************************/
4646 CAsFunction::~CAsFunction(void)
4747 {
48+ Release();
4849 }
4950
5051 /**********************************************************************//**
@@ -83,6 +84,7 @@
8384 void CAsFunction::Release(void)
8485 {
8586 m_Context.Terminate();
87+ m_pFunction = nullptr;
8688 }
8789
8890 /**********************************************************************//**
@@ -137,6 +139,22 @@
137139 }
138140 }
139141
142+/**********************************************************************//**
143+ *
144+ * 戻り値の取得
145+ *
146+ -----------------------------------------------------------------------
147+ * @return 戻り値
148+*//***********************************************************************/
149+CAsVariant CAsFunction::GetReturnValue(void) const
150+{
151+ if( m_pFunction != nullptr )
152+ {
153+ return m_Context.GetReturnValue(m_pFunction->GetReturnTypeId());
154+ }
155+ return CAsVariant();
156+}
157+
140158 } // end of namespace as
141159 } // end of namespace iris
142160
@@ -174,7 +192,8 @@
174192 CAsFunction func;
175193 if( vm.MakeFunctor(func, "as_func0") )
176194 {
177- func();
195+ CAsVariant ret = func();
196+ std::cout << ret << std::endl;
178197 }
179198 }
180199 {
@@ -181,7 +200,11 @@
181200 CAsFunction func;
182201 if( vm.MakeFunctor(func, "as_func1") )
183202 {
184- func(100);
203+ CAsVariant ret = func(100);
204+ std::cout << ret << std::endl;
205+ int x = ret.Get<int>();
206+ float f = ret.Get<float>();
207+ std::cout << x << ", " << f << std::endl;
185208 }
186209 }
187210 {
@@ -188,7 +211,8 @@
188211 CAsFunction func;
189212 if( vm.MakeFunctor(func, "as_func2") )
190213 {
191- func(-1, -90);
214+ CAsVariant ret = func(-1, -90);
215+ std::cout << ret << std::endl;
192216 }
193217 }
194218 }
--- trunk/framework/src/script/angelscript/AsContext.h (revision 270)
+++ trunk/framework/src/script/angelscript/AsContext.h (revision 271)
@@ -19,7 +19,7 @@
1919
2020 //======================================================================
2121 // include
22-#include "as_inchead.h"
22+#include "AsVariant.h"
2323 #include "fnd/container/FndObserver.h"
2424
2525 #ifdef _IRIS_SUPPORT_ANGELSCRIPT
@@ -61,6 +61,9 @@
6161 // 引数にオブジェクト登録
6262 void SetArgObject(asUINT arg, void* obj);
6363
64+ // 戻り値の取得
65+ CAsVariant GetReturnValue(int type) const;
66+
6467 public:
6568 // 実効
6669 int Execute(void);
--- trunk/framework/src/script/angelscript/AsFunction.h (revision 270)
+++ trunk/framework/src/script/angelscript/AsFunction.h (revision 271)
@@ -20,6 +20,7 @@
2020 //======================================================================
2121 // include
2222 #include "AsSystem.h"
23+#include "AsVariant.h"
2324
2425 #ifdef _IRIS_SUPPORT_ANGELSCRIPT
2526
@@ -54,32 +55,122 @@
5455 bool IsValid(void) const;
5556
5657 public:
58+ // 関数のあるモジュールを取得
59+ asIScriptModule* GetModule(void) const;
60+
61+public:
5762 // 関数の実行
58- void operator()(void)
63+ CAsVariant operator()(void)
5964 {
6065 Execute();
66+ return GetReturnValue();
6167 }
6268 template<typename T1>
63- void operator()(const T1& a1)
69+ CAsVariant operator()(const T1& a1)
6470 {
6571 m_Context.SetArgument(0, a1);
6672 Execute();
73+ return GetReturnValue();
6774 }
6875 template<typename T1, typename T2>
69- void operator()(const T1& a1, const T2& a2)
76+ CAsVariant operator()(const T1& a1, const T2& a2)
7077 {
7178 m_Context.SetArgument(0, a1);
7279 m_Context.SetArgument(1, a2);
7380 Execute();
81+ return GetReturnValue();
7482 }
83+ template<typename T1, typename T2, typename T3>
84+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3)
85+ {
86+ m_Context.SetArgument(0, a1);
87+ m_Context.SetArgument(1, a2);
88+ m_Context.SetArgument(2, a3);
89+ Execute();
90+ return GetReturnValue();
91+ }
92+ template<typename T1, typename T2, typename T3, typename T4>
93+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4)
94+ {
95+ m_Context.SetArgument(0, a1);
96+ m_Context.SetArgument(1, a2);
97+ m_Context.SetArgument(2, a3);
98+ m_Context.SetArgument(3, a4);
99+ Execute();
100+ return GetReturnValue();
101+ }
102+ template<typename T1, typename T2, typename T3, typename T4, typename T5>
103+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5)
104+ {
105+ m_Context.SetArgument(0, a1);
106+ m_Context.SetArgument(1, a2);
107+ m_Context.SetArgument(2, a3);
108+ m_Context.SetArgument(3, a4);
109+ m_Context.SetArgument(4, a5);
110+ Execute();
111+ return GetReturnValue();
112+ }
113+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
114+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6)
115+ {
116+ m_Context.SetArgument(0, a1);
117+ m_Context.SetArgument(1, a2);
118+ m_Context.SetArgument(2, a3);
119+ m_Context.SetArgument(3, a4);
120+ m_Context.SetArgument(4, a5);
121+ m_Context.SetArgument(5, a6);
122+ Execute();
123+ return GetReturnValue();
124+ }
125+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
126+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7)
127+ {
128+ m_Context.SetArgument(0, a1);
129+ m_Context.SetArgument(1, a2);
130+ m_Context.SetArgument(2, a3);
131+ m_Context.SetArgument(3, a4);
132+ m_Context.SetArgument(4, a5);
133+ m_Context.SetArgument(5, a6);
134+ m_Context.SetArgument(6, a7);
135+ Execute();
136+ return GetReturnValue();
137+ }
138+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
139+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8)
140+ {
141+ m_Context.SetArgument(0, a1);
142+ m_Context.SetArgument(1, a2);
143+ m_Context.SetArgument(2, a3);
144+ m_Context.SetArgument(3, a4);
145+ m_Context.SetArgument(4, a5);
146+ m_Context.SetArgument(5, a6);
147+ m_Context.SetArgument(6, a7);
148+ m_Context.SetArgument(7, a8);
149+ Execute();
150+ return GetReturnValue();
151+ }
152+ template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
153+ CAsVariant operator()(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9)
154+ {
155+ m_Context.SetArgument(0, a1);
156+ m_Context.SetArgument(1, a2);
157+ m_Context.SetArgument(2, a3);
158+ m_Context.SetArgument(3, a4);
159+ m_Context.SetArgument(4, a5);
160+ m_Context.SetArgument(5, a6);
161+ m_Context.SetArgument(6, a7);
162+ m_Context.SetArgument(7, a8);
163+ m_Context.SetArgument(8, a9);
164+ Execute();
165+ return GetReturnValue();
166+ }
75167
76-public:
77- // 関数のあるモジュールを取得
78- asIScriptModule* GetModule(void) const;
79-
80168 private:
81169 // 関数の実行
82170 void Execute(void);
171+
172+ // 戻り値の取得
173+ CAsVariant GetReturnValue(void) const;
83174 };
84175
85176 } // end of namespace as
--- trunk/framework/src/script/angelscript/AsVariant.cpp (nonexistent)
+++ trunk/framework/src/script/angelscript/AsVariant.cpp (revision 271)
@@ -0,0 +1,57 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file AsVariant.cpp
5+ * @brief angelscript Variant ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ *
11+ * @par copyright
12+ * Copyright (C) 2012 Takazumi Shirayanagi\n
13+ * The new BSD License is applied to this software.
14+ * see iris_LICENSE.txt
15+*/
16+//-----------------------------------------------------------------------
17+//======================================================================
18+#define INCG_IRIS_AsVariant_CPP_
19+
20+//======================================================================
21+// include
22+#include "AsVariant.h"
23+#include "../../iris_debug.h"
24+
25+#ifdef _IRIS_SUPPORT_ANGELSCRIPT
26+
27+namespace iris {
28+namespace as
29+{
30+
31+//======================================================================
32+// class
33+/**********************************************************************//**
34+ *
35+ * コンストラクタ
36+ *
37+*//***********************************************************************/
38+CAsVariant::CAsVariant(void)
39+: m_Flag(asTYPEID_VOID)
40+{
41+}
42+
43+/**********************************************************************//**
44+ *
45+ * コンストラクタ
46+ *
47+*//***********************************************************************/
48+CAsVariant::CAsVariant(const CAsVariant& rhs)
49+: m_Flag(rhs.m_Flag)
50+, m_Var(rhs.m_Var)
51+{
52+}
53+
54+} // end of namespace as
55+} // end of namespace iris
56+
57+#endif
--- trunk/framework/src/script/angelscript/AsVariant.h (nonexistent)
+++ trunk/framework/src/script/angelscript/AsVariant.h (revision 271)
@@ -0,0 +1,356 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file AsVariant.h
5+ * @brief angelscript Variant ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ *
11+ * @par copyright
12+ * Copyright (C) 2012 Takazumi Shirayanagi\n
13+ * The new BSD License is applied to this software.
14+ * see iris_LICENSE.txt
15+*/
16+//-----------------------------------------------------------------------
17+//======================================================================
18+#ifndef INCG_IRIS_AsVariant_H_
19+#define INCG_IRIS_AsVariant_H_
20+
21+//======================================================================
22+// include
23+#include "as_inchead.h"
24+#include "../../iris_object.h"
25+#include "../../c++0x/cpp0x_enable_if.hpp"
26+#include "../../c++0x/cpp0x_type_traits.hpp"
27+#include "../../iris_debug.h"
28+
29+#ifdef _IRIS_SUPPORT_ANGELSCRIPT
30+
31+namespace iris {
32+namespace as
33+{
34+
35+
36+/**
37+ * @brief angelscript Variant
38+*/
39+class CAsVariant : public IIrisObject
40+{
41+public:
42+ union Variant {
43+ BOOL b;
44+ s8 i8;
45+ s16 i16;
46+ s32 i32;
47+ s64 i64;
48+ u8 ui8;
49+ u16 ui16;
50+ u32 ui32;
51+ u64 ui64;
52+ f32 f32;
53+ f64 f64;
54+ void* obj;
55+ asBYTE as_byte;
56+ asWORD as_word;
57+ asDWORD as_dword;
58+ asQWORD as_qword;
59+ asINT64 as_i64;
60+ asPWORD as_pword;
61+ };
62+
63+ template<asETypeIdFlags F>
64+ struct TypeObject
65+ {
66+ static const asETypeIdFlags FLAG = F;
67+ };
68+private:
69+ asETypeIdFlags m_Flag;
70+ Variant m_Var;
71+
72+public:
73+ CAsVariant(void);
74+ CAsVariant(const CAsVariant& rhs);
75+ template<typename T>
76+ CAsVariant(const T& rhs)
77+ : m_Flag(TypeFlag<T>::flag)
78+ , m_Var(VariantT<T>(rhs).var)
79+ {
80+ }
81+ template< template<asETypeIdFlags F>class TYPE, asETypeIdFlags FLAG, typename T>
82+ CAsVariant(TYPE<FLAG> t, T rhs)
83+ : m_Flag(FLAG)
84+ , m_Var(VariantT< FlagType<FLAG>::type >(rhs).var)
85+ {}
86+
87+public:
88+ asETypeIdFlags GetFlag(void) const { return m_Flag; }
89+ Variant GetVar(void) const { return m_Var; }
90+
91+ template<typename T>
92+ T Get(typename disable_if_t< cpp0x::is_pointer<T> >::type*& = cpp0x::enabler::value) const
93+ {
94+ IRIS_ASSERT( m_Flag != asTYPEID_MASK_SEQNBR );
95+ // TODO: ひどい><
96+ switch( m_Flag )
97+ {
98+ case asTYPEID_BOOL:
99+ return static_cast<T>(m_Var.b);
100+ case asTYPEID_INT8:
101+ return static_cast<T>(m_Var.i8);
102+ case asTYPEID_INT16:
103+ return static_cast<T>(m_Var.i16);
104+ case asTYPEID_INT32:
105+ return static_cast<T>(m_Var.i32);
106+ case asTYPEID_INT64:
107+ return static_cast<T>(m_Var.i64);
108+ case asTYPEID_UINT8:
109+ return static_cast<T>(m_Var.ui8);
110+ case asTYPEID_UINT16:
111+ return static_cast<T>(m_Var.ui16);
112+ case asTYPEID_UINT32:
113+ return static_cast<T>(m_Var.ui32);
114+ case asTYPEID_UINT64:
115+ return static_cast<T>(m_Var.ui64);
116+ case asTYPEID_FLOAT:
117+ return static_cast<T>(m_Var.f32);
118+ case asTYPEID_DOUBLE:
119+ return static_cast<T>(m_Var.f64);
120+ default:
121+ IRIS_ASSERT(0);
122+ break;
123+ }
124+ return 0;
125+ }
126+ template<typename T>
127+ T Get(typename enable_if_t< cpp0x::is_pointer<T> >::type*& = cpp0x::enabler::value) const
128+ {
129+ IRIS_ASSERT( m_Flag != asTYPEID_VOID );
130+ if( m_Flag & 0x03FFFFFF )
131+ {
132+ // TODO: ひどい><
133+ switch( m_Flag )
134+ {
135+ case asTYPEID_BOOL:
136+ return (T)(m_Var.b);
137+ case asTYPEID_INT8:
138+ return (T)(m_Var.i8);
139+ case asTYPEID_INT16:
140+ return (T)(m_Var.i16);
141+ case asTYPEID_INT32:
142+ return (T)(m_Var.i32);
143+ case asTYPEID_INT64:
144+ return (T)(m_Var.i64);
145+ case asTYPEID_UINT8:
146+ return (T)(m_Var.ui8);
147+ case asTYPEID_UINT16:
148+ return (T)(m_Var.ui16);
149+ case asTYPEID_UINT32:
150+ return (T)(m_Var.ui32);
151+ case asTYPEID_UINT64:
152+ return (T)(m_Var.ui64);
153+ case asTYPEID_FLOAT:
154+ return (T)(m_Var.f32);
155+ case asTYPEID_DOUBLE:
156+ return (T)(m_Var.f64);
157+ default:
158+ IRIS_ASSERT(0);
159+ break;
160+ }
161+ }
162+ else
163+ {
164+ return (T)(m_Var.obj);
165+ }
166+ }
167+
168+private:
169+ template<typename T>
170+ union VariantT
171+ {
172+ T t;
173+ Variant var;
174+ VariantT(T t_) : t(t_) {}
175+ };
176+
177+ template<typename TN>
178+ class TypeFlag
179+ {
180+ template<typename T, typename DMY>
181+ struct no_integral {};
182+ template<typename DMY>
183+ struct no_integral<bool, DMY>
184+ {
185+ static const asETypeIdFlags flag = asTYPEID_BOOL;
186+ };
187+ template<typename DMY>
188+ struct no_integral<float, DMY>
189+ {
190+ static const asETypeIdFlags flag = asTYPEID_FLOAT;
191+ };
192+ template<typename DMY>
193+ struct no_integral<double, DMY>
194+ {
195+ static const asETypeIdFlags flag = asTYPEID_DOUBLE;
196+ };
197+ template<typename DMY>
198+ struct no_integral<void*, DMY>
199+ {
200+ static const asETypeIdFlags flag = asTYPEID_OBJHANDLE;
201+ };
202+
203+ template<typename T, bool sign>
204+ struct integral
205+ {
206+ static const asETypeIdFlags flag = sizeof(T) == 1 ? asTYPEID_INT8
207+ : sizeof(T) == 2 ? asTYPEID_INT16
208+ : sizeof(T) == 4 ? asTYPEID_INT32
209+ : asTYPEID_INT64;
210+ };
211+ template<typename T>
212+ struct integral<T, false>
213+ {
214+ static const asETypeIdFlags flag = sizeof(T) == 1 ? asTYPEID_UINT8
215+ : sizeof(T) == 2 ? asTYPEID_UINT16
216+ : sizeof(T) == 4 ? asTYPEID_UINT32
217+ : asTYPEID_UINT64;
218+ };
219+
220+ template<typename T, bool is_integral>
221+ struct integral_filter
222+ {
223+ typedef no_integral<T, void> type;
224+ };
225+ template<typename T>
226+ struct integral_filter<T, true>
227+ {
228+ typedef integral<T, cpp0x::is_signed<T>::value> type;
229+ };
230+
231+ template<typename T>
232+ struct impl
233+ {
234+ typedef typename integral_filter<T, cpp0x::is_integral<T>::value>::type type;
235+ };
236+
237+ public:
238+ typedef typename impl< typename cpp0x::remove_cv<TN>::type >::type type;
239+ static const asETypeIdFlags flag = type::flag;
240+ };
241+
242+ template<asETypeIdFlags FLG>
243+ class FlagType
244+ {
245+ template<asETypeIdFlags F, typename DMY>
246+ struct impl
247+ {
248+ typedef void* type;
249+ };
250+ template<typename DMY>
251+ struct impl<asTYPEID_INT8, DMY>
252+ {
253+ typedef s8 type;
254+ };
255+ template<typename DMY>
256+ struct impl<asTYPEID_INT16, DMY>
257+ {
258+ typedef s16 type;
259+ };
260+ template<typename DMY>
261+ struct impl<asTYPEID_INT32, DMY>
262+ {
263+ typedef s32 type;
264+ };
265+ template<typename DMY>
266+ struct impl<asTYPEID_INT64, DMY>
267+ {
268+ typedef s64 type;
269+ };
270+ template<typename DMY>
271+ struct impl<asTYPEID_UINT8, DMY>
272+ {
273+ typedef u8 type;
274+ };
275+ template<typename DMY>
276+ struct impl<asTYPEID_UINT16, DMY>
277+ {
278+ typedef u16 type;
279+ };
280+ template<typename DMY>
281+ struct impl<asTYPEID_UINT32, DMY>
282+ {
283+ typedef u32 type;
284+ };
285+ template<typename DMY>
286+ struct impl<asTYPEID_UINT64, DMY>
287+ {
288+ typedef u64 type;
289+ };
290+ template<typename DMY>
291+ struct impl<asTYPEID_FLOAT, DMY>
292+ {
293+ typedef float type;
294+ };
295+ template<typename DMY>
296+ struct impl<asTYPEID_DOUBLE, DMY>
297+ {
298+ typedef double type;
299+ };
300+ template<typename DMY>
301+ struct impl<asTYPEID_BOOL, DMY>
302+ {
303+ typedef bool type;
304+ };
305+ public:
306+ typedef typename impl<FLG, void>::type type;
307+ };
308+
309+};
310+
311+
312+} // end of namespace as
313+} // end of namespace iris
314+
315+// iostream
316+#ifndef _IRIS_NOT_SUPPORT_IOSTREAM
317+
318+#if defined(__cplusplus)
319+#include <iostream>
320+
321+inline std::ostream& operator << (std::ostream& o, const iris::as::CAsVariant& v)
322+{
323+ switch( v.GetFlag() )
324+ {
325+ case asTYPEID_BOOL:
326+ return o << v.GetVar().b;
327+ case asTYPEID_INT8:
328+ return o << v.GetVar().i8;
329+ case asTYPEID_INT16:
330+ return o << v.GetVar().i16;
331+ case asTYPEID_INT32:
332+ return o << v.GetVar().i32;
333+ case asTYPEID_INT64:
334+ return o << v.GetVar().i64;
335+ case asTYPEID_UINT8:
336+ return o << v.GetVar().ui8;
337+ case asTYPEID_UINT16:
338+ return o << v.GetVar().ui16;
339+ case asTYPEID_UINT32:
340+ return o << v.GetVar().ui32;
341+ case asTYPEID_UINT64:
342+ return o << v.GetVar().ui64;
343+ case asTYPEID_FLOAT:
344+ return o << v.GetVar().f32;
345+ case asTYPEID_DOUBLE:
346+ return o << v.GetVar().f64;
347+ };
348+ return o << v.GetVar().obj;
349+}
350+
351+#endif
352+#endif // #ifndef _IRIS_NOT_SUPPORT_IOSTREAM
353+
354+#endif
355+
356+#endif
\ No newline at end of file
--- trunk/framework/src/fnd/image/FndColor.h (revision 270)
+++ trunk/framework/src/fnd/image/FndColor.h (revision 271)
@@ -431,9 +431,10 @@
431431
432432
433433 template<int SIZE>
434- void a_(value_type_a v) { value_type max = (value_type)max_a(); m_col &= ~(max << SFT_A); m_col |= ((v > max ? max : (value_type)v)) << SFT_A; }
435- template<>
436- void a_<0>(value_type_a /*v*/) {};
434+ void a_(value_type_a v, typename enable_if<(SIZE!=0)>::type*& = cpp0x::enabler::value)
435+ { value_type max = (value_type)max_a(); m_col &= ~(max << SFT_A); m_col |= ((v > max ? max : (value_type)v)) << SFT_A; }
436+ template<int SIZE>
437+ void a_(value_type_a /*v*/, typename enable_if<(SIZE==0)>::type*& = cpp0x::enabler::value) {}
437438 };
438439
439440 } // end of namespace fnd
--- trunk/framework/src/fnd/format/FndAIFF.h (revision 270)
+++ trunk/framework/src/fnd/format/FndAIFF.h (revision 271)
@@ -79,7 +79,7 @@
7979 beu16 Channels; //!< チャンネル数
8080 beu32 SampleFrames; //!< サンプル数
8181 bes16 wBitsPerSample; //!< サンプリングサイズ([1,32])
82- CIEEEBinary80 SampleRate; //!< サンプリングレート(80bit floating point)
82+ CIEEEBinary80 SampleRate; //!< サンプリングレート(80bit floating point)
8383 } AIFF_COMM_CHUNK, *LPAIFF_COMM_CHUNK;
8484 #include "../../misc/iris_poppack.h"
8585
--- trunk/framework/src/fnd/format/FndIEEE.h (revision 270)
+++ trunk/framework/src/fnd/format/FndIEEE.h (revision 271)
@@ -130,16 +130,16 @@
130130 return;
131131 }
132132 }
133- m_value = (value_type)(iml::signed_rshift<(floatType::FUNC+floatType::EXP)-(FUNC+EXP)>::shift<IrisU32>(fi.iv) & iml::static_mask<1, EXP+FUNC>::value);
133+ m_value = (value_type)(iml::signed_rshift<(floatType::FUNC+floatType::EXP)-(FUNC+EXP)>::shift(fi.iv) & iml::static_mask<1, EXP+FUNC>::value);
134134 m_value |= exp << FUNC;
135- m_value |= iml::signed_rshift<floatType::FUNC-FUNC>::shift<IrisU32>( fi.iv & iml::static_mask<floatType::FUNC>::value );
135+ m_value |= iml::signed_rshift<floatType::FUNC-FUNC>::shift( static_cast<IrisU32>(fi.iv & iml::static_mask<floatType::FUNC>::value) );
136136 }
137- template<typename _XTN, int _XSIGN, int _XEXP, int _XFUNC, int _XBIAS>
138- void cast_from_ieee(const CIEEE754<_XTN, _XSIGN, _XEXP, _XFUNC, _XBIAS>& ieee)
137+ template<typename XTN_, int XSIGN_, int XEXP_, int XFUNC_, int XBIAS_>
138+ void cast_from_ieee(const CIEEE754<XTN_, XSIGN_, XEXP_, XFUNC_, XBIAS_>& ieee)
139139 {
140- _XTN value = ieee.value();
141- value_type exp = (value >> _XFUNC) & iml::static_mask<_XEXP>::value;
142- if( exp == iml::static_mask<_XEXP>::value )
140+ XTN_ value = ieee.value();
141+ value_type exp = static_cast<value_type>((value >> XFUNC_) & iml::static_mask<XEXP_>::value);
142+ if( exp == iml::static_mask<XEXP_>::value )
143143 {
144144 exp = iml::static_mask<EXP>::value;
145145 }
@@ -154,9 +154,9 @@
154154 return;
155155 }
156156 }
157- m_value = static_cast<value_type>(iml::signed_rshift<(_XFUNC+_XEXP)-(FUNC+EXP)>::shift<value_type>(value) & iml::static_mask<1, EXP+FUNC>::value);
157+ m_value = static_cast<value_type>(iml::signed_rshift<(XFUNC_+XEXP_)-(FUNC+EXP)>::shift(static_cast<value_type>(value)) & iml::static_mask<1, EXP+FUNC>::value);
158158 m_value |= exp << FUNC;
159- m_value |= iml::signed_rshift<_XFUNC-FUNC>::shift<value_type>( value & iml::static_mask<_XFUNC>::value );
159+ m_value |= iml::signed_rshift<XFUNC_-FUNC>::shift( static_cast<value_type>(value & iml::static_mask<XFUNC_>::value) );
160160 }
161161
162162 float cast_to_float(void) const
--- trunk/framework/src/fnd/format/FndIEEE80.h (revision 270)
+++ trunk/framework/src/fnd/format/FndIEEE80.h (revision 271)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2011-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -29,6 +29,9 @@
2929 // class
3030 /**
3131 * @brief IEEE754 80bit クラス
32+ * @note 符号bit : 1
33+ * 仮数bit : 64
34+ * 指数bit : 15
3235 */
3336 class CIEEEBinary80 : public IIrisObject
3437 {
@@ -50,6 +53,7 @@
5053
5154 public:
5255 operator float (void) const { return cast_to_float(); }
56+ operator double (void) const { return cast_to_double(); }
5357
5458 public:
5559 u8* GetBuffer(void) { return m_buf; }
@@ -74,7 +78,7 @@
7478 u64 exp = (static_cast<u64>(m_buf[0]) << 56) | (static_cast<u64>(m_buf[1]) << 48);
7579 CIEEE754<u64, 1, 15, 48> v;
7680 IRIS_ASSERT( func & 0x0080000000000000 );
77- v.value() = exp | ((func >> 7) & 0xFFFF); // 暗黙の 1bit を捨てる。
81+ v.value() = exp | ((func >> 7) & 0xFFFFFFFFFFFF); // 暗黙の 1bit を捨てる。
7882 return v;
7983 }
8084
--- trunk/framework/src/ml/math/iml_shift.hpp (revision 270)
+++ trunk/framework/src/ml/math/iml_shift.hpp (revision 271)
@@ -107,7 +107,7 @@
107107 /**
108108 * @brief 符号付き右シフト
109109 */
110-template<intmax_t SHIFT>
110+template<intmax_t SHIFT_>
111111 class signed_rshift
112112 {
113113 template<typename TN, intmax_t TS, intmax_t SIGN>
@@ -137,8 +137,8 @@
137137 static TN shift(TN v) { return v << static_abs<TS>::value; }
138138 };
139139 public:
140- template<typename TN>
141- static TN shift(TN v) { return shift_impl<TN, SHIFT, static_sign<SHIFT>::value>::shift(v); }
140+ template<typename TN_>
141+ static TN_ shift(TN_ v) { return shift_impl<TN_, SHIFT_, static_sign<SHIFT_>::value>::shift(v); }
142142 };
143143
144144 } // end of namespace iml
Show on old repository browser