lumino 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/LuminoEngine.dll CHANGED
Binary file
@@ -1,20 +1,19 @@
1
1
  #if 1
2
2
  #include "LuminoRubyRuntimeManager.h"
3
3
 
4
- extern "C" LN_FLAT_API LnResult LnEngine_Finalize();
5
- extern "C" LN_FLAT_API void LnRuntime_RunAppInternal(LnHandle app);
4
+ extern "C" LN_FLAT_API void LNRuntime_RunAppInternal(LNHandle app);
6
5
 
7
6
  //==============================================================================
8
7
  //
9
8
 
10
- static VALUE Wrap_LnRuntime_RunAppInternal(VALUE self, VALUE app)
9
+ static VALUE Wrap_LNRuntime_RunAppInternal(VALUE self, VALUE app)
11
10
  {
12
- LnHandle handle = LuminoRubyRuntimeManager::instance->getHandle(app);
13
- LnRuntime_RunAppInternal(handle);
11
+ LNHandle handle = LuminoRubyRuntimeManager::instance->getHandle(app);
12
+ LNRuntime_RunAppInternal(handle);
14
13
  return Qnil;
15
14
  }
16
15
 
17
- VALUE Wrap_LnRuntime_RegisterType(VALUE self, VALUE type)
16
+ VALUE Wrap_LNRuntime_RegisterType(VALUE self, VALUE type)
18
17
  {
19
18
  std::string className;
20
19
  {
@@ -31,25 +30,25 @@ VALUE Wrap_LnRuntime_RegisterType(VALUE self, VALUE type)
31
30
  LNRB_LOG_D("Usesr type registering. (class: %s, superclass: %s)", className.c_str(), superclassName.c_str());
32
31
 
33
32
  int typeInfoId;
34
- LnTypeInfo_AcquireA(className.c_str(), &typeInfoId);
33
+ LNTypeInfo_AcquireA(className.c_str(), &typeInfoId);
35
34
 
36
35
  int baseTypeInfoId;
37
- LnTypeInfo_AcquireA(superclassName.c_str(), &baseTypeInfoId);
36
+ LNTypeInfo_AcquireA(superclassName.c_str(), &baseTypeInfoId);
38
37
 
39
- LnTypeInfo_SetBaseClass(typeInfoId, baseTypeInfoId);
40
- LnTypeInfo_SetCreateInstanceCallback(typeInfoId, &LuminoRubyRuntimeManager::handleCreateInstanceCallback);
38
+ LNTypeInfo_SetBaseClass(typeInfoId, baseTypeInfoId);
39
+ LNTypeInfo_SetCreateInstanceCallback(typeInfoId, &LuminoRubyRuntimeManager::handleCreateInstanceCallback);
41
40
 
42
41
  // ユーザー定義型として、あとでインスタンス生成時に型情報を関連付けるときに高速に検索できるように覚えておく
43
42
  LuminoRubyRuntimeManager::instance->m_userDefinedClassTypeIdMap[className] = typeInfoId;
44
43
 
45
44
  int managedTypeInfoId = LuminoRubyRuntimeManager::instance->registerTypeInfo(type, nullptr);
46
- LnTypeInfo_SetManagedTypeInfoId(typeInfoId, managedTypeInfoId);
45
+ LNTypeInfo_SetManagedTypeInfoId(typeInfoId, managedTypeInfoId);
47
46
 
48
47
  LNRB_LOG_D("Usesr type registerd. (typeInfoId: %d, baseTypeInfoId: %d, managedTypeInfoId: %d)", typeInfoId, baseTypeInfoId, managedTypeInfoId);
49
48
  return Qnil;
50
49
  }
51
50
 
52
- static VALUE Wrap_LnRuntime_inherited(VALUE self, VALUE type)
51
+ static VALUE Wrap_LNRuntime_inherited(VALUE self, VALUE type)
53
52
  {
54
53
  VALUE v = rb_funcall(type, rb_intern("name"), 0, 0);
55
54
  std::string name2 = StringValuePtr(v);
@@ -59,10 +58,10 @@ static VALUE Wrap_LnRuntime_inherited(VALUE self, VALUE type)
59
58
  LNRB_LOG_D("Usesr type registering from 'self.inherited.' (%s)", name.c_str());
60
59
 
61
60
  int typeInfoId = 0;
62
- LnTypeInfo_FindA(name.c_str(), &typeInfoId);
61
+ LNTypeInfo_FindA(name.c_str(), &typeInfoId);
63
62
 
64
63
  if (typeInfoId == 0) {
65
- Wrap_LnRuntime_RegisterType(self, type);
64
+ Wrap_LNRuntime_RegisterType(self, type);
66
65
  }
67
66
 
68
67
  LNRB_LOG_D("Usesr type registerd from 'self.inherited.' (%d)", typeInfoId);
@@ -73,7 +72,7 @@ static VALUE Wrap_LnRuntime_inherited(VALUE self, VALUE type)
73
72
  // LuminoRubyRuntimeManager
74
73
 
75
74
  LuminoRubyRuntimeManager* LuminoRubyRuntimeManager::instance = nullptr;
76
- LnLogLevel LuminoRubyRuntimeManager::s_logLevel = LN_LOG_LEVEL_INFO;
75
+ LNLogLevel LuminoRubyRuntimeManager::s_logLevel = LN_LOG_LEVEL_INFO;
77
76
 
78
77
  LuminoRubyRuntimeManager* LuminoRubyRuntimeManager::getInstance(VALUE managerInstance)
79
78
  {
@@ -90,23 +89,24 @@ void LuminoRubyRuntimeManager::init()
90
89
  {
91
90
  VALUE LUMINO_LOG_LEVEL = rb_eval_string_protect("$LUMINO_LOG_LEVEL", NULL);
92
91
  if (LUMINO_LOG_LEVEL != Qnil) {
93
- s_logLevel = (LnLogLevel)FIX2INT(LUMINO_LOG_LEVEL);
94
- LnLog_SetLevel(s_logLevel);
92
+ s_logLevel = (LNLogLevel)FIX2INT(LUMINO_LOG_LEVEL);
93
+ LNLog_SetLevel(s_logLevel);
94
+ LNEngineSettings_SetDebugMode(LN_TRUE);
95
95
  }
96
96
 
97
97
  VALUE LUMINO_ENGINE_RESOURCES_DIR = rb_eval_string_protect("$LUMINO_ENGINE_RESOURCES_DIR", NULL);
98
98
  if (LUMINO_ENGINE_RESOURCES_DIR != Qnil) {
99
99
  const char* path = StringValuePtr(LUMINO_ENGINE_RESOURCES_DIR);
100
100
  printf("path: %s\n", path);
101
- LnInternalEngineSettings_SetEngineResourcesPathA(path);
101
+ LNInternalEngineSettings_SetEngineResourcesPathA(path);
102
102
  }
103
103
 
104
- LnRuntimeSettings settings;
104
+ LNRuntimeSettings settings;
105
105
  settings.runtimeFinalizedCallback = handleRuntimeFinalized;
106
106
  settings.referenceCountTrackerCallback = handleReferenceChangedStatic;
107
107
  settings.runtimeGetTypeInfoIdCallback = nullptr;
108
108
 
109
- LnRuntime_Initialize(&settings);
109
+ LNRuntime_Initialize(&settings);
110
110
  }
111
111
 
112
112
  // Define core functions.
@@ -140,12 +140,12 @@ void LuminoRubyRuntimeManager::init()
140
140
  m_eventSignalClass = rb_eval_string("Lumino::EventSignal");
141
141
 
142
142
  m_objectClass = rb_define_class_under(m_luminoModule, "Object", rb_cObject);
143
- rb_define_singleton_method(m_objectClass, "inherited", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LnRuntime_inherited), 1);
143
+ rb_define_singleton_method(m_objectClass, "inherited", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LNRuntime_inherited), 1);
144
144
 
145
145
  VALUE class_Application = rb_define_class_under(m_luminoModule, "Application", m_objectClass);
146
- rb_define_singleton_method(class_Application, "run_app_internal", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LnRuntime_RunAppInternal), 1);
146
+ rb_define_singleton_method(class_Application, "run_app_internal", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LNRuntime_RunAppInternal), 1);
147
147
 
148
- rb_define_module_function(m_luminoModule, "register_type", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LnRuntime_RegisterType), 1);
148
+ rb_define_module_function(m_luminoModule, "register_type", reinterpret_cast<VALUE(__cdecl *)(...)>(Wrap_LNRuntime_RegisterType), 1);
149
149
  }
150
150
 
151
151
  m_typeInfoList.push_back({}); // [0] is dummy
@@ -158,18 +158,18 @@ void LuminoRubyRuntimeManager::init()
158
158
  m_runtimeAliving = true;
159
159
  }
160
160
 
161
- VALUE LuminoRubyRuntimeManager::wrapObjectForGetting(LnHandle handle, bool retain)
161
+ VALUE LuminoRubyRuntimeManager::wrapObjectForGetting(LNHandle handle, bool retain)
162
162
  {
163
163
  if (handle == LN_NULL_HANDLE) return Qnil;
164
164
 
165
- int objectIndex = (int)LnRuntime_GetManagedObjectId(handle);
166
- int typeinfoIndex = (int)LnRuntime_GetManagedTypeInfoId(handle);
165
+ int objectIndex = (int)LNRuntime_GetManagedObjectId(handle);
166
+ int typeinfoIndex = (int)LNRuntime_GetManagedTypeInfoId(handle);
167
167
 
168
168
  if (objectIndex <= 0) {
169
169
  LNRB_LOG_D("New Ruby object from WrapObjectForGetting (typeinfoIndex:%d)", typeinfoIndex);
170
170
  VALUE obj = m_typeInfoList[typeinfoIndex].factory(m_typeInfoList[typeinfoIndex].klass, handle);
171
171
  if (retain) {
172
- LnObject_Retain(handle);
172
+ LNObject_Retain(handle);
173
173
  }
174
174
  registerWrapperObject(obj, true);
175
175
  return obj;
@@ -179,7 +179,7 @@ VALUE LuminoRubyRuntimeManager::wrapObjectForGetting(LnHandle handle, bool retai
179
179
  }
180
180
  }
181
181
 
182
- LnHandle LuminoRubyRuntimeManager::getHandle(VALUE value) const
182
+ LNHandle LuminoRubyRuntimeManager::getHandle(VALUE value) const
183
183
  {
184
184
  if (value == Qnil) {
185
185
  return LN_NULL_HANDLE;
@@ -206,9 +206,9 @@ int LuminoRubyRuntimeManager::registerTypeInfo(VALUE klass, ObjectFactoryFunc fa
206
206
 
207
207
  void LuminoRubyRuntimeManager::registerWrapperObject(VALUE obj, bool forNativeGetting)
208
208
  {
209
- LnHandle handle = getHandle(obj);
209
+ LNHandle handle = getHandle(obj);
210
210
 
211
- int64_t id = LnRuntime_GetManagedObjectId(handle);
211
+ int64_t id = LNRuntime_GetManagedObjectId(handle);
212
212
  if (id > 0) {
213
213
  // 登録済み
214
214
  LNRB_LOG_D("registerWrapperObject: [Registerd] ManagedObjectId: %d\n", id);
@@ -233,7 +233,7 @@ void LuminoRubyRuntimeManager::registerWrapperObject(VALUE obj, bool forNativeGe
233
233
  m_objectList[index].strongRef = obj;
234
234
  }
235
235
 
236
- LnRuntime_SetManagedObjectId(handle, index);
236
+ LNRuntime_SetManagedObjectId(handle, index);
237
237
  LNRB_LOG_D("registerWrapperObject (handle:%u, ManagedObjectId:%d)\n", handle, index);
238
238
 
239
239
  // ユーザー定義型の型情報をオブジェクトにセットする
@@ -245,19 +245,19 @@ void LuminoRubyRuntimeManager::registerWrapperObject(VALUE obj, bool forNativeGe
245
245
  // ユーザー定義型に限定する (Engine 内部型は登録する必要なし)
246
246
  auto itr = m_userDefinedClassTypeIdMap.find(name);
247
247
  if (itr != m_userDefinedClassTypeIdMap.end()) {
248
- LnObject_SetTypeInfoId(handle, itr->second);
249
- LNRB_LOG_D("LnObject_SetTypeInfoId (handle:%u, itr->second:%d)\n", handle, itr->second);
248
+ LNObject_SetTypeInfoId(handle, itr->second);
249
+ LNRB_LOG_D("LNObject_SetTypeInfoId (handle:%u, itr->second:%d)\n", handle, itr->second);
250
250
  }
251
251
  }
252
252
 
253
253
  }
254
254
 
255
- void LuminoRubyRuntimeManager::unregisterWrapperObject(LnHandle handle)
255
+ void LuminoRubyRuntimeManager::unregisterWrapperObject(LNHandle handle)
256
256
  {
257
- LNRB_LOG_D("LuminoRubyRuntimeManager::unregisterWrapperObject: LnHandle=%u\n", handle);
257
+ LNRB_LOG_D("LuminoRubyRuntimeManager::unregisterWrapperObject: LNHandle=%u\n", handle);
258
258
  if (m_runtimeAliving) {
259
- LnObject_Release(handle);
260
- int index = (int)LnRuntime_GetManagedObjectId(handle);
259
+ LNObject_Release(handle);
260
+ int index = (int)LNRuntime_GetManagedObjectId(handle);
261
261
  m_objectList[index].weakRef = Qnil;
262
262
  m_objectList[index].strongRef = Qnil;
263
263
  m_objectListIndexStack.push(index);
@@ -295,14 +295,14 @@ void LuminoRubyRuntimeManager::gc_mark(LuminoRubyRuntimeManager* obj)
295
295
  }
296
296
  }
297
297
 
298
- void LuminoRubyRuntimeManager::handleReferenceChangedStatic(LnHandle handle, int method, int count)
298
+ void LuminoRubyRuntimeManager::handleReferenceChangedStatic(LNHandle handle, int method, int count)
299
299
  {
300
300
  instance->handleReferenceChanged(handle, method, count);
301
301
  }
302
302
 
303
- void LuminoRubyRuntimeManager::handleReferenceChanged(LnHandle handle, int method, int count)
303
+ void LuminoRubyRuntimeManager::handleReferenceChanged(LNHandle handle, int method, int count)
304
304
  {
305
- int objectIndex = (int)LnRuntime_GetManagedObjectId(handle);
305
+ int objectIndex = (int)LNRuntime_GetManagedObjectId(handle);
306
306
 
307
307
  if (method == LNI_REFERENCE_RETAINED) {
308
308
  if (count >= 2) {
@@ -324,13 +324,13 @@ void LuminoRubyRuntimeManager::handleRuntimeFinalized()
324
324
  LNRB_LOG_D("Runtime finalized.");
325
325
  }
326
326
 
327
- void LuminoRubyRuntimeManager::handleCreateInstanceCallback(int typeInfoId, LnHandle* outHandle)
327
+ void LuminoRubyRuntimeManager::handleCreateInstanceCallback(int typeInfoId, LNHandle* outHandle)
328
328
  {
329
329
  LNRB_LOG_D("start: handleCreateInstanceCallback");
330
330
  auto* manager = LuminoRubyRuntimeManager::instance;
331
331
 
332
332
  int managedTypeInfoId = -1;
333
- LnTypeInfo_GetManagedTypeInfoId(typeInfoId, &managedTypeInfoId);
333
+ LNTypeInfo_GetManagedTypeInfoId(typeInfoId, &managedTypeInfoId);
334
334
 
335
335
 
336
336
  printf("managedTypeInfoId: %d\n", managedTypeInfoId);
@@ -355,7 +355,7 @@ void LuminoRubyRuntimeManager::handleCreateInstanceCallback(int typeInfoId, LnHa
355
355
 
356
356
  void LuminoRubyRuntimeManager::dumpInfo() const
357
357
  {
358
- LnRuntime_DumpInfo();
358
+ LNRuntime_DumpInfo();
359
359
 
360
360
  std::cout << std::endl;
361
361
  std::cout << "Ruby alive objects" << std::endl;
@@ -6,11 +6,13 @@
6
6
  #include <stack>
7
7
  #include <unordered_map>
8
8
  #include "FlatCommon.h"
9
+ #include "FlatC.generated.h"
9
10
 
10
- #define LNRB_LOG_D(...) LnLog_PrintA(LN_LOG_LEVEL_DEBUG, "RubyRuntime", __VA_ARGS__)
11
- #define LNRB_LOG_I(...) LnLog_WriteA(LN_LOG_LEVEL_INFO, "RubyRuntime", __VA_ARGS__)
11
+ extern "C" LN_FLAT_API void LNLog_PrintA(LNLogLevel level, const char* tag, const char* format, ...);
12
+ #define LNRB_LOG_D(...) LNLog_PrintA(LN_LOG_LEVEL_DEBUG, "RubyRuntime", __VA_ARGS__)
13
+ #define LNRB_LOG_I(...) LNLog_PrintA(LN_LOG_LEVEL_INFO, "RubyRuntime", __VA_ARGS__)
12
14
 
13
- typedef VALUE(*ObjectFactoryFunc)(VALUE klass, LnHandle handle);
15
+ typedef VALUE(*ObjectFactoryFunc)(VALUE klass, LNHandle handle);
14
16
 
15
17
  struct TypeInfo
16
18
  {
@@ -20,7 +22,7 @@ struct TypeInfo
20
22
 
21
23
  struct Wrap_RubyObject
22
24
  {
23
- LnHandle handle;
25
+ LNHandle handle;
24
26
  Wrap_RubyObject() : handle(0) {}
25
27
  };
26
28
 
@@ -33,25 +35,25 @@ public:
33
35
  static const int InitialListSize = 512;
34
36
 
35
37
  static LuminoRubyRuntimeManager* instance;
36
- static LnLogLevel s_logLevel;
38
+ static LNLogLevel s_logLevel;
37
39
 
38
40
  void init();
39
41
  VALUE luminoModule() const { return m_luminoModule; }
40
42
  VALUE eventSignalClass() const { return m_eventSignalClass; }
41
- VALUE wrapObjectForGetting(LnHandle handle, bool retain = true);
42
- LnHandle getHandle(VALUE value) const;
43
+ VALUE wrapObjectForGetting(LNHandle handle, bool retain = true);
44
+ LNHandle getHandle(VALUE value) const;
43
45
  int registerTypeInfo(VALUE klass, ObjectFactoryFunc factory);
44
46
  void registerWrapperObject(VALUE obj, bool forNativeGetting);
45
- void unregisterWrapperObject(LnHandle handle);
47
+ void unregisterWrapperObject(LNHandle handle);
46
48
 
47
49
  // for generator interface
48
50
  static LuminoRubyRuntimeManager* getInstance(VALUE managerInstance);
49
51
  static void gc_mark(LuminoRubyRuntimeManager* obj);
50
- static void handleReferenceChangedStatic(LnHandle handle, int method, int count);
51
- void handleReferenceChanged(LnHandle handle, int method, int count);
52
+ static void handleReferenceChangedStatic(LNHandle handle, int method, int count);
53
+ void handleReferenceChanged(LNHandle handle, int method, int count);
52
54
 
53
55
  static void handleRuntimeFinalized();
54
- static void handleCreateInstanceCallback(int typeInfoId, LnHandle* outHandle);
56
+ static void handleCreateInstanceCallback(int typeInfoId, LNHandle* outHandle);
55
57
 
56
58
  void dumpInfo() const;
57
59
 
@@ -82,11 +84,11 @@ public:
82
84
  static std::string makeTypeInfoName(VALUE klass);
83
85
  };
84
86
 
85
- inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LnHandle handle) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
86
- inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LnHandle handle, VALUE& accessorCache) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
87
- inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LnHandle handle, std::vector<VALUE>& accessorCache, int index) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
88
- inline void LNRB_SAFE_UNREGISTER_WRAPPER_OBJECT(LnHandle handle) { if ( LuminoRubyRuntimeManager::instance) LuminoRubyRuntimeManager::instance->unregisterWrapperObject(handle); }
87
+ inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LNHandle handle) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
88
+ inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LNHandle handle, VALUE& accessorCache) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
89
+ inline VALUE LNRB_HANDLE_WRAP_TO_VALUE(LNHandle handle, std::vector<VALUE>& accessorCache, int index) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle); }
90
+ inline void LNRB_SAFE_UNREGISTER_WRAPPER_OBJECT(LNHandle handle) { if ( LuminoRubyRuntimeManager::instance) LuminoRubyRuntimeManager::instance->unregisterWrapperObject(handle); }
89
91
 
90
- inline VALUE LNRB_HANDLE_WRAP_TO_VALUE_NO_RETAIN(LnHandle handle) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle, false); }
92
+ inline VALUE LNRB_HANDLE_WRAP_TO_VALUE_NO_RETAIN(LNHandle handle) { return LuminoRubyRuntimeManager::instance->wrapObjectForGetting(handle, false); }
91
93
 
92
94
 
@@ -1,3 +1,3 @@
1
1
  module Lumino
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lriki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 2.1.4
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.1.4
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '13.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '13.0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: thor
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +163,7 @@ homepage: https://github.com/LuminoEngine/Lumino
191
163
  licenses:
192
164
  - MIT
193
165
  metadata: {}
194
- post_install_message:
166
+ post_install_message:
195
167
  rdoc_options: []
196
168
  require_paths:
197
169
  - ext
@@ -208,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
180
  version: '0'
209
181
  requirements: []
210
182
  rubygems_version: 3.0.3
211
- signing_key:
183
+ signing_key:
212
184
  specification_version: 4
213
185
  summary: Real-time graphics application framework.
214
186
  test_files: []