rhodes 6.2.0 → 7.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (553) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +14 -10
  3. data/appveyor.yml +1 -1
  4. data/extensions/emdk3-manager/ext/platform/android/Rakefile +2 -0
  5. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/Rakefile +18 -1
  6. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/Rakefile +19 -1
  7. data/lib/commonAPI/RubyServer/ext.yml +21 -0
  8. data/lib/commonAPI/RubyServer/ext/RubyServer.xml +101 -0
  9. data/lib/commonAPI/RubyServer/ext/build +19 -0
  10. data/lib/commonAPI/RubyServer/ext/build.bat +29 -0
  11. data/lib/commonAPI/RubyServer/ext/platform/android/Rakefile +161 -0
  12. data/lib/commonAPI/RubyServer/ext/platform/android/ext_java.files +9 -0
  13. data/lib/commonAPI/RubyServer/ext/platform/android/ext_native.files +7 -0
  14. data/lib/commonAPI/RubyServer/ext/platform/iphone/Rakefile +73 -0
  15. data/lib/commonAPI/RubyServer/ext/platform/iphone/RubyServer.xcodeproj/project.pbxproj +322 -0
  16. data/lib/commonAPI/RubyServer/ext/platform/iphone/RubyServer_Prefix.pch +7 -0
  17. data/lib/commonAPI/RubyServer/ext/shared/RubyServerImpl.cpp +242 -0
  18. data/lib/commonAPI/barcode/ext/platform/android/src/com/rho/barcode/BarcodeFactory.java +23 -3
  19. data/lib/commonAPI/barcode/ext/platform/android/src/com/rho/barcode/BarcodeRhoExtension.java +68 -8
  20. data/lib/commonAPI/barcode/ext/platform/iphone/Barcode.xcodeproj/project.pbxproj +24 -52
  21. data/lib/commonAPI/barcode/ext/platform/iphone/Classes/BarcodeViewController.h +38 -10
  22. data/lib/commonAPI/barcode/ext/platform/iphone/Classes/BarcodeViewController.m +300 -22
  23. data/lib/commonAPI/barcode/ext/platform/iphone/Classes/BarcodeViewFactory.mm +6 -0
  24. data/lib/commonAPI/barcode/ext/platform/iphone/Classes/barcode.m +6 -2
  25. data/lib/commonAPI/barcode/ext/platform/iphone/impl/Barcode.m +7 -3
  26. data/lib/commonAPI/barcode/ext/platform/iphone/impl/BarcodeFactory.m +13 -0
  27. data/lib/commonAPI/barcode/ext/platform/iphone/impl/BarcodeSingleton.m +25 -3
  28. data/lib/commonAPI/bluetooth/ext/platform/android/Rakefile +29 -10
  29. data/lib/commonAPI/clipboard/ext/platform/android/Rakefile +29 -10
  30. data/lib/commonAPI/coreapi/ext/Notification.xml +47 -0
  31. data/lib/commonAPI/coreapi/ext/platform/android/ApplicationManifestAdds.erb +1 -0
  32. data/lib/commonAPI/coreapi/ext/platform/android/Rakefile +19 -0
  33. data/lib/commonAPI/coreapi/ext/platform/android/ext_java.files +2 -0
  34. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/AlarmReceiver.java +27 -0
  35. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +28 -10
  36. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationFactory.java +14 -1
  37. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +260 -0
  38. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +23 -1
  39. data/lib/commonAPI/coreapi/ext/platform/iphone/Coreapi.xcodeproj/project.pbxproj +21 -19
  40. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.h +1 -0
  41. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.m +234 -1
  42. data/lib/commonAPI/coreapi/ext/platform/qt/coreapi.pro +2 -0
  43. data/lib/commonAPI/coreapi/ext/platform/qt/src/CNotificationImpl.cpp +7 -0
  44. data/lib/commonAPI/coreapi/ext/shared/ApplicationImpl.cpp +5 -0
  45. data/lib/commonAPI/coreapi/public/api/rhoapi.js +18 -8
  46. data/lib/commonAPI/devicesecurity/ext/platform/android/Rakefile +19 -0
  47. data/lib/commonAPI/devicesecurity/ext/platform/iphone/DeviceSecurity.xcodeproj/project.pbxproj +16 -0
  48. data/lib/commonAPI/hardwarekeys/ext/keycapture.xml +11 -9
  49. data/lib/commonAPI/hardwarekeys/ext/platform/iphone/impl/KeyCaptureSingleton.h +5 -3
  50. data/lib/commonAPI/hardwarekeys/ext/platform/iphone/impl/KeyCaptureSingleton.m +80 -67
  51. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraEclair.java +25 -14
  52. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraGingerbread.java +55 -25
  53. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +34 -9
  54. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraObject.java +1 -0
  55. data/lib/commonAPI/printing_zebra/ext/platform/android/Rakefile +18 -0
  56. data/lib/commonAPI/sensor/ext/platform/android/src/com/rho/sensor/Sensor.java +4 -4
  57. data/lib/extensions/decrypt/ext/platform/android/Rakefile +19 -1
  58. data/lib/extensions/decryptstub/ext/platform/android/Rakefile +19 -0
  59. data/lib/extensions/decryptstub/ext/platform/iphone/Decryptstub.xcodeproj/project.pbxproj +4 -2
  60. data/lib/extensions/digest-md5/ext/android/Rakefile +18 -0
  61. data/lib/extensions/digest-sha1/ext/android/Rakefile +18 -0
  62. data/lib/extensions/digest-sha2/ext/android/Rakefile +18 -0
  63. data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +19 -19
  64. data/lib/extensions/fcm-push/ext/android/Rakefile +18 -0
  65. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +38 -16
  66. data/lib/extensions/gcm-push/ext/android/Rakefile +19 -0
  67. data/lib/extensions/keyboard/ext.yml +15 -0
  68. data/lib/extensions/keyboard/ext/Keyboard.xml +28 -0
  69. data/lib/extensions/keyboard/ext/build +19 -0
  70. data/lib/extensions/keyboard/ext/build.bat +29 -0
  71. data/lib/extensions/keyboard/ext/platform/android/Rakefile +141 -0
  72. data/lib/extensions/keyboard/ext/platform/android/ext_java.files +9 -0
  73. data/lib/extensions/keyboard/ext/platform/android/ext_native.files +7 -0
  74. data/lib/extensions/keyboard/ext/platform/android/jni/Keyboard_impl.cpp +61 -0
  75. data/lib/extensions/keyboard/ext/platform/android/src/com/rho/keyboard/Keyboard.java +32 -0
  76. data/lib/extensions/keyboard/ext/platform/android/src/com/rho/keyboard/KeyboardFactory.java +18 -0
  77. data/lib/extensions/keyboard/ext/platform/android/src/com/rho/keyboard/KeyboardSingleton.java +29 -0
  78. data/lib/extensions/keyboard/ext/platform/iphone/Keyboard.xcodeproj/project.pbxproj +368 -0
  79. data/lib/extensions/keyboard/ext/platform/iphone/Keyboard_Prefix.pch +7 -0
  80. data/lib/extensions/keyboard/ext/platform/iphone/Rakefile +73 -0
  81. data/lib/extensions/keyboard/ext/platform/iphone/impl/Keyboard.h +14 -0
  82. data/lib/extensions/keyboard/ext/platform/iphone/impl/Keyboard.m +24 -0
  83. data/lib/extensions/keyboard/ext/platform/iphone/impl/KeyboardFactorySingleton.m +16 -0
  84. data/lib/extensions/keyboard/ext/platform/iphone/impl/KeyboardSetup.m +9 -0
  85. data/lib/extensions/keyboard/ext/platform/iphone/impl/KeyboardSingleton.h +17 -0
  86. data/lib/extensions/keyboard/ext/platform/iphone/impl/KeyboardSingleton.m +23 -0
  87. data/lib/extensions/keyboard/ext/platform/iphone/impl/readme.txt +7 -0
  88. data/lib/extensions/keyboard/ext/platform/qt/Keyboard.pro +68 -0
  89. data/lib/extensions/keyboard/ext/platform/qt/Makefile +473 -0
  90. data/lib/extensions/keyboard/ext/platform/qt/Makefile.Release +408 -0
  91. data/lib/extensions/keyboard/ext/platform/qt/Rakefile +39 -0
  92. data/lib/extensions/keyboard/ext/platform/qt/src/Keyboard_impl.cpp +99 -0
  93. data/lib/extensions/keyboard/ext/platform/uwp/Keyboard.props +18 -0
  94. data/lib/extensions/keyboard/ext/platform/uwp/Keyboard.vcxproj +197 -0
  95. data/lib/extensions/keyboard/ext/platform/uwp/Keyboard.vcxproj.filters +50 -0
  96. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardImpl.csproj +119 -0
  97. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardImpl.props +8 -0
  98. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardImpl.targets +7 -0
  99. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardLib.props +18 -0
  100. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardLib.vcxproj +197 -0
  101. data/lib/extensions/keyboard/ext/platform/uwp/KeyboardLib.vcxproj.filters +58 -0
  102. data/lib/extensions/keyboard/ext/platform/uwp/src/Keyboard_impl.cpp +76 -0
  103. data/lib/extensions/keyboard/ext/platform/uwp/src/Keyboard_impl.cs +69 -0
  104. data/lib/extensions/keyboard/ext/platform/uwp/src/Properties/AssemblyInfo.cs +37 -0
  105. data/lib/extensions/keyboard/ext/platform/wm/Keyboard.sln +52 -0
  106. data/lib/extensions/keyboard/ext/platform/wm/Keyboard.vcproj +714 -0
  107. data/lib/extensions/keyboard/ext/platform/wm/Keyboard.vsprops +15 -0
  108. data/lib/extensions/keyboard/ext/platform/wm/src/Keyboard_impl.cpp +77 -0
  109. data/lib/extensions/openssl.so.src/ext/android/Rakefile +18 -0
  110. data/lib/extensions/openssl.so/ext/android/aarch64/libopenssl.so.a +0 -0
  111. data/lib/extensions/openssl.so/ext/iphone/OpenSSl.SDK/howtobuild.txt +2 -0
  112. data/lib/extensions/openssl.so/ext/iphone/OpenSSl.SDK/libcrypto.a +0 -0
  113. data/lib/extensions/openssl.so/ext/iphone/OpenSSl.SDK/libssl.a +0 -0
  114. data/lib/extensions/openssl.so/ext/iphone/Release-iphoneos/libopenssl.so.a +0 -0
  115. data/lib/extensions/openssl.so/ext/iphone/Release-iphonesimulator/libopenssl.so.a +0 -0
  116. data/lib/extensions/openssl/ext/android/Rakefile +18 -0
  117. data/lib/extensions/zlib/ext/zlib.c +5 -1
  118. data/lib/framework/autocomplete/Rhodes.rb +1 -1
  119. data/lib/framework/rhodes.rb +1 -1
  120. data/lib/framework/set.rb +799 -0
  121. data/lib/framework/version.rb +1 -1
  122. data/lib/rhodes.rb +1 -1
  123. data/platform/android/Rhodes/AndroidManifest.xml.erb +11 -2
  124. data/platform/android/Rhodes/jni/include/rhodes.h +6 -0
  125. data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +3 -0
  126. data/platform/android/Rhodes/jni/include/rhodes/SecurityTokenGenerator.h +30 -0
  127. data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +1 -0
  128. data/platform/android/Rhodes/jni/src/JNIRhoRubyCppWrapper.cpp +408 -0
  129. data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +7 -0
  130. data/platform/android/Rhodes/jni/src/SecurityTokenGenerator.cpp +60 -0
  131. data/platform/android/Rhodes/jni/src/fileapi.cpp +318 -12
  132. data/platform/android/Rhodes/jni/src/mapview.cpp +4 -0
  133. data/platform/android/Rhodes/res/drawable/ic_notification.png +0 -0
  134. data/platform/android/Rhodes/res/xml/network_security_config.xml +7 -0
  135. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +9 -0
  136. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +1 -1
  137. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMain.java +8 -0
  138. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoRubyArrayObjects.java +33 -0
  139. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoRubyClassObject.java +20 -0
  140. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoRubyObject.java +115 -0
  141. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoRubySingleton.java +52 -0
  142. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoRubyTypes.java +15 -0
  143. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +25 -13
  144. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SecurityTokenGenerator.java +57 -0
  145. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +1 -1
  146. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +9 -2
  147. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +3 -0
  148. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +7 -0
  149. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality11.java +13 -1
  150. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality26.java +105 -0
  151. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +4 -1
  152. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +24 -4
  153. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +20 -1
  154. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +10 -0
  155. data/platform/android/build/Rakefile +30 -1
  156. data/platform/android/build/RhodesSRC_build.files +8 -0
  157. data/platform/android/build/android.rake +326 -22
  158. data/platform/android/build/android_tools.rb +36 -3
  159. data/platform/android/build/androidcommon.rb +97 -44
  160. data/platform/android/build/librhocommon_build.files +11 -0
  161. data/platform/android/build/librhodes_build.files +2 -0
  162. data/platform/android/build/manifest_generator.rb +9 -2
  163. data/platform/android/build/maven_deps_extractor.rb +96 -15
  164. data/platform/android/build/ndkwrapper.rb +111 -16
  165. data/platform/android/build/pom.erb +2 -2
  166. data/platform/iphone/Classes/AppManager/AppManager.m +31 -1
  167. data/platform/iphone/Classes/MapView/GoogleGeocoder.h +3 -3
  168. data/platform/iphone/Classes/RhoMainViewStubImpl.h +38 -0
  169. data/platform/iphone/Classes/RhoMainViewStubImpl.m +88 -0
  170. data/platform/iphone/Classes/RhoUIWebView.h +5 -0
  171. data/platform/iphone/Classes/RhoUIWebView.m +14 -6
  172. data/platform/iphone/Classes/{RhoWKWebView.m → RhoWKWebView.mm} +98 -18
  173. data/platform/iphone/Classes/RhoWebView.h +1 -1
  174. data/platform/iphone/Classes/RhoWebViewFabrique.m +24 -12
  175. data/platform/iphone/Classes/Rhodes.h +7 -2
  176. data/platform/iphone/Classes/Rhodes.m +46 -8
  177. data/platform/iphone/Classes/SimpleMainView.m +22 -13
  178. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.h +32 -3
  179. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +93 -61
  180. data/platform/iphone/Classes/URLProtocol/CRhoWKURLProtocol.h +22 -0
  181. data/platform/iphone/Classes/URLProtocol/CRhoWKURLProtocol.m +246 -0
  182. data/platform/iphone/Classes/WebView.m +14 -2
  183. data/platform/iphone/Entitlements.plist +1 -1
  184. data/platform/iphone/Framework/RhoApplication/RhoApplication.xcodeproj/project.pbxproj +399 -0
  185. data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1208 -0
  186. data/platform/iphone/Framework/Rhodes/Rhodes/Info.plist +24 -0
  187. data/platform/iphone/Framework/Rhodes/Rhodes/Rhodes.h +21 -0
  188. data/platform/iphone/Framework/Rhodes/Rhodes/StubCode.m +15 -0
  189. data/platform/iphone/Info.plist +1 -3
  190. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +511 -4
  191. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +467 -1
  192. data/platform/iphone/Rhodes.xcodeproj/project.pbxproj +51 -274
  193. data/platform/iphone/RhodesBaseDelegate.h +1 -1
  194. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +85 -3
  195. data/platform/iphone/rbuild/ApplicationPlist.erb +1 -1
  196. data/platform/iphone/rbuild/iphone.rake +497 -25
  197. data/platform/iphone/rbuild/iphonecommon.rb +15 -6
  198. data/platform/iphone/rhodes_stub.cpp +15 -0
  199. data/platform/iphone/rhodeslib/api/RhodesLib.h +28 -0
  200. data/platform/iphone/rhodeslib/impl/RhodesLib.m +52 -0
  201. data/platform/iphone/rhodesruby/api/IRefCountedObject.h +20 -0
  202. data/platform/iphone/rhodesruby/api/IRhoRuby.h +72 -0
  203. data/platform/iphone/rhodesruby/api/IRhoRubyArray.h +12 -0
  204. data/platform/iphone/rhodesruby/api/IRhoRubyBoolean.h +11 -0
  205. data/platform/iphone/rhodesruby/api/IRhoRubyFloat.h +10 -0
  206. data/platform/iphone/rhodesruby/api/IRhoRubyHash.h +15 -0
  207. data/platform/iphone/rhodesruby/api/IRhoRubyInteger.h +10 -0
  208. data/platform/iphone/rhodesruby/api/IRhoRubyMutableArray.h +9 -0
  209. data/platform/iphone/rhodesruby/api/IRhoRubyMutableBoolean.h +10 -0
  210. data/platform/iphone/rhodesruby/api/IRhoRubyMutableFloat.h +10 -0
  211. data/platform/iphone/rhodesruby/api/IRhoRubyMutableHash.h +10 -0
  212. data/platform/iphone/rhodesruby/api/IRhoRubyMutableInteger.h +10 -0
  213. data/platform/iphone/rhodesruby/api/IRhoRubyMutableString.h +10 -0
  214. data/platform/iphone/rhodesruby/api/IRhoRubyNativeCallback.h +9 -0
  215. data/platform/iphone/rhodesruby/api/IRhoRubyNil.h +10 -0
  216. data/platform/iphone/rhodesruby/api/IRhoRubyObject.h +37 -0
  217. data/platform/iphone/rhodesruby/api/IRhoRubyRunnable.h +8 -0
  218. data/platform/iphone/rhodesruby/api/IRhoRubyString.h +10 -0
  219. data/platform/iphone/rhodesruby/api/RhoRuby.h +26 -0
  220. data/platform/iphone/rhodesruby/api/RhoRubySingletone.h +14 -0
  221. data/platform/iphone/rhodesruby/impl/RhoRubyFabrique.h +10 -0
  222. data/platform/iphone/rhodesruby/impl/RhoRubyImpl.h +56 -0
  223. data/platform/iphone/rhodesruby/impl/RhoRubyImpl.mm +432 -0
  224. data/platform/iphone/rhodesruby/impl/RhoRubyMutableArrayImpl.h +24 -0
  225. data/platform/iphone/rhodesruby/impl/RhoRubyMutableArrayImpl.mm +43 -0
  226. data/platform/iphone/rhodesruby/impl/RhoRubyMutableBooleanImpl.h +23 -0
  227. data/platform/iphone/rhodesruby/impl/RhoRubyMutableBooleanImpl.mm +38 -0
  228. data/platform/iphone/rhodesruby/impl/RhoRubyMutableFloatImpl.h +23 -0
  229. data/platform/iphone/rhodesruby/impl/RhoRubyMutableFloatImpl.mm +35 -0
  230. data/platform/iphone/rhodesruby/impl/RhoRubyMutableHashImpl.h +24 -0
  231. data/platform/iphone/rhodesruby/impl/RhoRubyMutableHashImpl.mm +48 -0
  232. data/platform/iphone/rhodesruby/impl/RhoRubyMutableIntegerImpl.h +23 -0
  233. data/platform/iphone/rhodesruby/impl/RhoRubyMutableIntegerImpl.mm +35 -0
  234. data/platform/iphone/rhodesruby/impl/RhoRubyMutableStringImpl.h +23 -0
  235. data/platform/iphone/rhodesruby/impl/RhoRubyMutableStringImpl.mm +35 -0
  236. data/platform/iphone/rhodesruby/impl/RhoRubyNilImpl.h +22 -0
  237. data/platform/iphone/rhodesruby/impl/RhoRubyNilImpl.mm +11 -0
  238. data/platform/iphone/rhodesruby/impl/RhoRubyObjectImpl.h +31 -0
  239. data/platform/iphone/rhodesruby/impl/RhoRubyObjectImpl.mm +49 -0
  240. data/platform/iphone/rhodesruby/impl/RhoRubySingletone.m +19 -0
  241. data/platform/iphone/rhodesruby/impl/RubyServerResponceImpl.h +21 -0
  242. data/platform/iphone/rhodesruby/impl/RubyServerResponceImpl.mm +32 -0
  243. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +79 -0
  244. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +91 -0
  245. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +85 -0
  246. data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
  247. data/platform/shared/common/IRhoClassFactory.h +2 -0
  248. data/platform/shared/common/ISecurityTokenGenerator.h +16 -0
  249. data/platform/shared/common/RhoFile.cpp +11 -0
  250. data/platform/shared/common/RhoMath.h +14 -0
  251. data/platform/shared/common/RhoMutexLock.h +13 -0
  252. data/platform/shared/common/RhoSystem.h +1 -1
  253. data/platform/shared/common/RhoThread.cpp +25 -0
  254. data/platform/shared/common/RhodesApp.cpp +52 -6
  255. data/platform/shared/common/RhodesApp.h +25 -1
  256. data/platform/shared/common/RhodesAppBase.cpp +4 -2
  257. data/platform/shared/common/RhodesAppBase.h +5 -0
  258. data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
  259. data/platform/shared/common/iphone/RhoCryptImpl.mm +21 -2
  260. data/platform/shared/common/map/BaseMapEngine.cpp +2 -2
  261. data/platform/shared/common/map/GeocodingMapEngine.cpp +1 -1
  262. data/platform/shared/common/map/GoogleMapEngine.cpp +1 -1
  263. data/platform/shared/common/map/OSMMapEngine.cpp +1 -1
  264. data/platform/shared/curl/lib/curl_config.h +28 -0
  265. data/platform/shared/db/DBAdapter.cpp +18 -10
  266. data/platform/shared/json.new/JSONIterator.cpp +2 -2
  267. data/platform/shared/net/HttpServer.cpp +32 -0
  268. data/platform/shared/net/HttpServer.h +15 -0
  269. data/platform/shared/net/INetRequest.cpp +54 -0
  270. data/platform/shared/qt/RhoRubylib.pro +10 -0
  271. data/platform/shared/qt/rhodes/impl/AlertImpl.cpp +13 -0
  272. data/platform/shared/qt/rhodes/impl/CameraImpl.cpp +6 -0
  273. data/platform/shared/qt/rhodes/impl/DateTimePickerImpl.cpp +4 -0
  274. data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +36 -7
  275. data/platform/shared/qt/rhodes/impl/MainWindowImpl.h +12 -1
  276. data/platform/shared/qt/rhodes/impl/NativeTabbarImpl.cpp +21 -2
  277. data/platform/shared/qt/rhodes/impl/NativeTabbarImpl.h +1 -0
  278. data/platform/shared/qt/rhodes/impl/NativeToolbarImpl.cpp +10 -0
  279. data/platform/shared/qt/rhodes/impl/QtSystemImpl.cpp +55 -3
  280. data/platform/shared/qt/rhodes/impl/RhoClassFactoryImpl.h +11 -0
  281. data/platform/shared/qt/rhodes/impl/RhoThreadImpl.cpp +71 -7
  282. data/platform/shared/qt/rhodes/impl/RhoThreadImpl.h +79 -2
  283. data/platform/shared/qt/rhodes/impl/RhodesImpl.cpp +16 -6
  284. data/platform/shared/qt/rhodes/impl/SecurityTokenGeneratorImpl.cpp +37 -0
  285. data/platform/shared/qt/rhodes/impl/SecurityTokenGeneratorImpl.h +25 -0
  286. data/platform/shared/qt/rhodes/impl/SignatureImpl.cpp +2 -0
  287. data/platform/shared/qt/rhodes/impl/WebViewImpl.cpp +27 -0
  288. data/platform/shared/qt/rhodes/impl/notificationsound.cpp +16 -2
  289. data/platform/shared/qt/rhodes/impl/notificationsound.h +11 -1
  290. data/platform/shared/qt/rhodes/newVersion/QtMainWindow.cpp +25 -16
  291. data/platform/shared/qt/rhodes/newVersion/QtMainWindow.h +3 -0
  292. data/platform/shared/qt/rhodes/newVersion/WebUrlRequestInterceptor.cpp +17 -0
  293. data/platform/shared/qt/rhodes/rhodes.pro +68 -14
  294. data/platform/shared/qt/rhodes/rhorubyVersion/rhodeslib.cpp +148 -0
  295. data/platform/shared/qt/rhodes/rhorubyVersion/rhodeslib.h +12 -0
  296. data/platform/shared/qt/rholib/rholib.pro +33 -5
  297. data/platform/shared/qt/rhoruby_win32_build.bat +19 -0
  298. data/platform/shared/qt/rhoruby_win32_build_debug.bat +19 -0
  299. data/platform/shared/qt/rhosimulator_win32_build_debug.bat +19 -0
  300. data/platform/shared/qt/rubylib/rubylib.pro +1 -0
  301. data/platform/shared/qt/sqlite3/sqlite3.pro +1 -0
  302. data/platform/shared/qt/syncengine/syncengine.pro +1 -0
  303. data/platform/shared/rhoruby/api/IArray.h +20 -0
  304. data/platform/shared/rhoruby/api/IBoolean.h +17 -0
  305. data/platform/shared/rhoruby/api/IFloat.h +17 -0
  306. data/platform/shared/rhoruby/api/IHash.h +23 -0
  307. data/platform/shared/rhoruby/api/IInteger.h +18 -0
  308. data/platform/shared/rhoruby/api/IMutableArray.h +18 -0
  309. data/platform/shared/rhoruby/api/IMutableBoolean.h +18 -0
  310. data/platform/shared/rhoruby/api/IMutableFloat.h +17 -0
  311. data/platform/shared/rhoruby/api/IMutableHash.h +18 -0
  312. data/platform/shared/rhoruby/api/IMutableInteger.h +17 -0
  313. data/platform/shared/rhoruby/api/IMutableString.h +17 -0
  314. data/platform/shared/rhoruby/api/INil.h +16 -0
  315. data/platform/shared/rhoruby/api/IObject.h +46 -0
  316. data/platform/shared/rhoruby/api/IRefCountedObject.h +20 -0
  317. data/platform/shared/rhoruby/api/IRhoRuby.h +78 -0
  318. data/platform/shared/rhoruby/api/IRunnable.h +17 -0
  319. data/platform/shared/rhoruby/api/IString.h +17 -0
  320. data/platform/shared/rhoruby/api/RhoRuby.h +29 -0
  321. data/platform/shared/rhoruby/api/RhoRubySingletone.h +19 -0
  322. data/platform/shared/rhoruby/api/SmartPointer.h +27 -0
  323. data/platform/shared/rhoruby/impl/MutableArrayImpl.cpp +54 -0
  324. data/platform/shared/rhoruby/impl/MutableArrayImpl.h +48 -0
  325. data/platform/shared/rhoruby/impl/MutableBooleanImpl.cpp +44 -0
  326. data/platform/shared/rhoruby/impl/MutableBooleanImpl.h +44 -0
  327. data/platform/shared/rhoruby/impl/MutableFloatImpl.cpp +41 -0
  328. data/platform/shared/rhoruby/impl/MutableFloatImpl.h +44 -0
  329. data/platform/shared/rhoruby/impl/MutableHashImpl.cpp +64 -0
  330. data/platform/shared/rhoruby/impl/MutableHashImpl.h +49 -0
  331. data/platform/shared/rhoruby/impl/MutableIntegerImpl.cpp +41 -0
  332. data/platform/shared/rhoruby/impl/MutableIntegerImpl.h +44 -0
  333. data/platform/shared/rhoruby/impl/MutableStringImpl.cpp +52 -0
  334. data/platform/shared/rhoruby/impl/MutableStringImpl.h +44 -0
  335. data/platform/shared/rhoruby/impl/NilImpl.cpp +23 -0
  336. data/platform/shared/rhoruby/impl/NilImpl.h +32 -0
  337. data/platform/shared/rhoruby/impl/ObjectImpl.cpp +77 -0
  338. data/platform/shared/rhoruby/impl/ObjectImpl.h +53 -0
  339. data/platform/shared/rhoruby/impl/RefCountedObjectImpl.cpp +28 -0
  340. data/platform/shared/rhoruby/impl/RefCountedObjectImpl.h +33 -0
  341. data/platform/shared/rhoruby/impl/RhoRubyImpl.cpp +799 -0
  342. data/platform/shared/rhoruby/impl/RhoRubyImpl.h +81 -0
  343. data/platform/shared/rhoruby/impl/RhoRubySingletone.cpp +20 -0
  344. data/platform/shared/rhoruby/impl/RubyServerResponceImpl.cpp +32 -0
  345. data/platform/shared/rhoruby/impl/RubyServerResponceImpl.h +21 -0
  346. data/platform/shared/ruby/android/ruby/config.h +55 -3
  347. data/platform/shared/ruby/error.c +1 -1
  348. data/platform/shared/ruby/ext/rho/rhoruby.c +60 -7
  349. data/platform/shared/ruby/ext/rho/rhoruby.h +3 -0
  350. data/platform/shared/rubyext/NativeToolbarExt.h +1 -0
  351. data/platform/uwp/rhodes/rhodes_TemporaryKey.pfx +0 -0
  352. data/platform/uwp/rhoruntime/common/RhoClassFactory.h +6 -0
  353. data/platform/win32/RhoSimulator/Qt5Core.dll +0 -0
  354. data/platform/win32/RhoSimulator/Qt5Gui.dll +0 -0
  355. data/platform/win32/RhoSimulator/Qt5Multimedia.dll +0 -0
  356. data/platform/win32/RhoSimulator/Qt5Network.dll +0 -0
  357. data/platform/win32/RhoSimulator/Qt5Positioning.dll +0 -0
  358. data/platform/win32/RhoSimulator/Qt5PrintSupport.dll +0 -0
  359. data/platform/win32/RhoSimulator/Qt5Qml.dll +0 -0
  360. data/platform/win32/RhoSimulator/Qt5Quick.dll +0 -0
  361. data/platform/win32/RhoSimulator/Qt5QuickWidgets.dll +0 -0
  362. data/platform/win32/RhoSimulator/Qt5SerialPort.dll +0 -0
  363. data/platform/win32/RhoSimulator/Qt5Svg.dll +0 -0
  364. data/platform/win32/RhoSimulator/Qt5WebChannel.dll +0 -0
  365. data/platform/win32/RhoSimulator/Qt5WebEngine.dll +0 -0
  366. data/platform/win32/RhoSimulator/Qt5WebEngineCore.dll +0 -0
  367. data/platform/win32/RhoSimulator/Qt5WebEngineWidgets.dll +0 -0
  368. data/platform/win32/RhoSimulator/Qt5Widgets.dll +0 -0
  369. data/platform/win32/RhoSimulator/QtWebEngineProcess.exe +0 -0
  370. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  371. data/platform/win32/RhoSimulator/audio/qtaudio_wasapi.dll +0 -0
  372. data/platform/win32/RhoSimulator/audio/qtaudio_windows.dll +0 -0
  373. data/platform/win32/RhoSimulator/bearer/qgenericbearer.dll +0 -0
  374. data/platform/win32/RhoSimulator/iconengines/qsvgicon.dll +0 -0
  375. data/platform/win32/RhoSimulator/imageformats/qgif.dll +0 -0
  376. data/platform/win32/RhoSimulator/imageformats/qicns.dll +0 -0
  377. data/platform/win32/RhoSimulator/imageformats/qico.dll +0 -0
  378. data/platform/win32/RhoSimulator/imageformats/qjpeg.dll +0 -0
  379. data/platform/win32/RhoSimulator/imageformats/qsvg.dll +0 -0
  380. data/platform/win32/RhoSimulator/imageformats/qtga.dll +0 -0
  381. data/platform/win32/RhoSimulator/imageformats/qtiff.dll +0 -0
  382. data/platform/win32/RhoSimulator/imageformats/qwbmp.dll +0 -0
  383. data/platform/win32/RhoSimulator/imageformats/qwebp.dll +0 -0
  384. data/platform/win32/RhoSimulator/libEGL.dll +0 -0
  385. data/platform/win32/RhoSimulator/libGLESV2.dll +0 -0
  386. data/platform/win32/RhoSimulator/mediaservice/dsengine.dll +0 -0
  387. data/platform/win32/RhoSimulator/mediaservice/qtmedia_audioengine.dll +0 -0
  388. data/platform/win32/RhoSimulator/mediaservice/wmfengine.dll +0 -0
  389. data/platform/win32/RhoSimulator/platforms/qwindows.dll +0 -0
  390. data/platform/win32/RhoSimulator/playlistformats/qtmultimedia_m3u.dll +0 -0
  391. data/platform/win32/RhoSimulator/position/qtposition_geoclue.dll +0 -0
  392. data/platform/win32/RhoSimulator/position/qtposition_positionpoll.dll +0 -0
  393. data/platform/win32/RhoSimulator/position/qtposition_serialnmea.dll +0 -0
  394. data/platform/win32/RhoSimulator/position/qtposition_winrt.dll +0 -0
  395. data/platform/win32/RhoSimulator/printsupport/windowsprintersupport.dll +0 -0
  396. data/platform/wm/build/wm.rake +110 -5
  397. data/platform/wm/rhodes/rho/common/ExtManager.cpp +30 -0
  398. data/platform/wm/rhodes/rho/common/RhoClassFactory.h +6 -0
  399. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +3 -0
  400. data/platform/wm/rubylib/rubylib.vcxproj +6 -0
  401. data/platform/wp8/rhoruntime/common/RhoClassFactory.h +6 -0
  402. data/rakefile.rb +14 -10
  403. data/res/build-tools/iphonesim/build/Release/iphonesim_8 +23 -15
  404. data/res/build-tools/maven/LICENSE +18 -89
  405. data/res/build-tools/maven/NOTICE +1 -1
  406. data/res/build-tools/maven/README.txt +12 -12
  407. data/res/build-tools/maven/bin/m2.conf +2 -2
  408. data/res/build-tools/maven/bin/mvn +122 -125
  409. data/res/build-tools/maven/bin/mvn.cmd +205 -0
  410. data/res/build-tools/maven/bin/mvnDebug +10 -176
  411. data/res/build-tools/maven/bin/mvnDebug.cmd +33 -0
  412. data/res/build-tools/maven/bin/mvnyjp +9 -181
  413. data/res/build-tools/maven/boot/plexus-classworlds-2.6.0.jar +0 -0
  414. data/res/build-tools/maven/conf/logging/simplelogger.properties +8 -1
  415. data/res/build-tools/maven/conf/settings.xml +1 -1
  416. data/res/build-tools/maven/conf/toolchains.xml +103 -0
  417. data/res/build-tools/maven/lib/animal-sniffer-annotations-1.14.jar +0 -0
  418. data/res/build-tools/maven/lib/animal-sniffer-annotations.license +14 -0
  419. data/res/build-tools/maven/lib/checker-compat-qual-2.0.0.jar +0 -0
  420. data/res/build-tools/maven/lib/checker-compat-qual.license +14 -0
  421. data/res/build-tools/maven/lib/commons-cli-1.4.jar +0 -0
  422. data/res/build-tools/maven/lib/commons-io-2.5.jar +0 -0
  423. data/res/build-tools/maven/lib/commons-lang3-3.8.1.jar +0 -0
  424. data/res/build-tools/maven/lib/error_prone_annotations-2.1.3.jar +0 -0
  425. data/res/build-tools/maven/lib/guava-25.1-android.jar +0 -0
  426. data/res/build-tools/maven/lib/guice-4.2.1-no_aop.jar +0 -0
  427. data/res/build-tools/maven/lib/j2objc-annotations-1.1.jar +0 -0
  428. data/res/build-tools/maven/lib/jansi-1.17.1.jar +0 -0
  429. data/res/build-tools/maven/lib/jansi-native/README.txt +7 -0
  430. data/res/build-tools/maven/lib/jansi-native/freebsd32/libjansi.so +0 -0
  431. data/res/build-tools/maven/lib/jansi-native/freebsd64/libjansi.so +0 -0
  432. data/res/build-tools/maven/lib/jansi-native/linux32/libjansi.so +0 -0
  433. data/res/build-tools/maven/lib/jansi-native/linux64/libjansi.so +0 -0
  434. data/res/build-tools/maven/lib/jansi-native/osx/libjansi.jnilib +0 -0
  435. data/res/build-tools/maven/lib/jansi-native/windows32/jansi.dll +0 -0
  436. data/res/build-tools/maven/lib/jansi-native/windows64/jansi.dll +0 -0
  437. data/res/build-tools/maven/lib/jcl-over-slf4j-1.7.25.jar +0 -0
  438. data/res/build-tools/maven/lib/jcl-over-slf4j.license +14 -0
  439. data/res/build-tools/maven/lib/jsr250-api.license +383 -405
  440. data/res/build-tools/maven/lib/jsr305-3.0.2.jar +0 -0
  441. data/res/build-tools/maven/lib/maven-artifact-3.6.1.jar +0 -0
  442. data/res/build-tools/maven/lib/maven-builder-support-3.6.1.jar +0 -0
  443. data/res/build-tools/maven/lib/maven-compat-3.6.1.jar +0 -0
  444. data/res/build-tools/maven/lib/maven-core-3.6.1.jar +0 -0
  445. data/res/build-tools/maven/lib/maven-embedder-3.6.1.jar +0 -0
  446. data/res/build-tools/maven/lib/maven-model-3.6.1.jar +0 -0
  447. data/res/build-tools/maven/lib/maven-model-builder-3.6.1.jar +0 -0
  448. data/res/build-tools/maven/lib/maven-plugin-api-3.6.1.jar +0 -0
  449. data/res/build-tools/maven/lib/maven-repository-metadata-3.6.1.jar +0 -0
  450. data/res/build-tools/maven/lib/maven-resolver-api-1.3.3.jar +0 -0
  451. data/res/build-tools/maven/lib/maven-resolver-connector-basic-1.3.3.jar +0 -0
  452. data/res/build-tools/maven/lib/maven-resolver-impl-1.3.3.jar +0 -0
  453. data/res/build-tools/maven/lib/maven-resolver-provider-3.6.1.jar +0 -0
  454. data/res/build-tools/maven/lib/maven-resolver-spi-1.3.3.jar +0 -0
  455. data/res/build-tools/maven/lib/maven-resolver-transport-wagon-1.3.3.jar +0 -0
  456. data/res/build-tools/maven/lib/maven-resolver-util-1.3.3.jar +0 -0
  457. data/res/build-tools/maven/lib/maven-settings-3.6.1.jar +0 -0
  458. data/res/build-tools/maven/lib/maven-settings-builder-3.6.1.jar +0 -0
  459. data/res/build-tools/maven/lib/maven-shared-utils-3.2.1.jar +0 -0
  460. data/res/build-tools/maven/lib/maven-slf4j-provider-3.6.1.jar +0 -0
  461. data/res/build-tools/maven/lib/org.eclipse.sisu.inject-0.3.3.jar +0 -0
  462. data/res/build-tools/maven/lib/org.eclipse.sisu.inject.license +210 -261
  463. data/res/build-tools/maven/lib/org.eclipse.sisu.plexus-0.3.3.jar +0 -0
  464. data/res/build-tools/maven/lib/org.eclipse.sisu.plexus.license +210 -261
  465. data/res/build-tools/maven/lib/plexus-component-annotations-1.7.1.jar +0 -0
  466. data/res/build-tools/maven/lib/plexus-interpolation-1.25.jar +0 -0
  467. data/res/build-tools/maven/lib/plexus-sec-dispatcher-1.4.jar +0 -0
  468. data/res/build-tools/maven/lib/plexus-utils-3.2.0.jar +0 -0
  469. data/res/build-tools/maven/lib/slf4j-api-1.7.25.jar +0 -0
  470. data/res/build-tools/maven/lib/slf4j-api.license +10 -186
  471. data/res/build-tools/maven/lib/wagon-file-3.3.2.jar +0 -0
  472. data/res/build-tools/maven/lib/wagon-http-3.3.2-shaded.jar +0 -0
  473. data/res/build-tools/maven/lib/wagon-provider-api-3.3.2.jar +0 -0
  474. data/res/generators/rhogen.rb +150 -0
  475. data/res/generators/templates/application/AndroidManifest.erb +13 -4
  476. data/res/generators/templates/application/build.yml +9 -0
  477. data/res/generators/templates/application/nodejs_build.yml +1 -1
  478. data/res/generators/templates/application/resources/android/res/xml/network_security_config.xml +7 -0
  479. data/res/generators/templates/application/rhoconfig.txt +13 -6
  480. data/res/generators/templates/application/rhoconfig_rubynode.txt +139 -0
  481. data/res/generators/templates/application/rubynodejs_build.yml +95 -0
  482. data/res/generators/templates/extension/extensions/montana/ext/platform/android/Rakefile +19 -0
  483. data/res/generators/templates/iphone_project/root/Entitlements.plist +1 -1
  484. data/res/generators/templates/iphone_project/root/Info.plist +1 -3
  485. data/res/generators/templates/iphone_project/root/rhorunner_development.entitlements +1 -1
  486. data/res/generators/templates/iphone_project/root/rhorunner_production.entitlements +1 -1
  487. data/rhodes.gemspec +2 -2
  488. data/version +1 -1
  489. metadata +244 -71
  490. data/res/build-tools/maven/bin/mvn.bat +0 -197
  491. data/res/build-tools/maven/bin/mvnDebug.bat +0 -200
  492. data/res/build-tools/maven/boot/plexus-classworlds-2.5.2.jar +0 -0
  493. data/res/build-tools/maven/lib/aether-api-1.0.0.v20140518.jar +0 -0
  494. data/res/build-tools/maven/lib/aether-api.license +0 -261
  495. data/res/build-tools/maven/lib/aether-connector-basic-1.0.0.v20140518.jar +0 -0
  496. data/res/build-tools/maven/lib/aether-connector-basic.license +0 -261
  497. data/res/build-tools/maven/lib/aether-impl-1.0.0.v20140518.jar +0 -0
  498. data/res/build-tools/maven/lib/aether-impl.license +0 -261
  499. data/res/build-tools/maven/lib/aether-spi-1.0.0.v20140518.jar +0 -0
  500. data/res/build-tools/maven/lib/aether-spi.license +0 -261
  501. data/res/build-tools/maven/lib/aether-transport-wagon-1.0.0.v20140518.jar +0 -0
  502. data/res/build-tools/maven/lib/aether-transport-wagon.license +0 -261
  503. data/res/build-tools/maven/lib/aether-util-1.0.0.v20140518.jar +0 -0
  504. data/res/build-tools/maven/lib/aether-util.license +0 -261
  505. data/res/build-tools/maven/lib/cdi-api.license +0 -445
  506. data/res/build-tools/maven/lib/commons-cli-1.2.jar +0 -0
  507. data/res/build-tools/maven/lib/commons-io-2.2.jar +0 -0
  508. data/res/build-tools/maven/lib/commons-lang-2.6.jar +0 -0
  509. data/res/build-tools/maven/lib/guava-18.0.jar +0 -0
  510. data/res/build-tools/maven/lib/jsoup-1.7.2.jar +0 -0
  511. data/res/build-tools/maven/lib/jsoup.license +0 -66
  512. data/res/build-tools/maven/lib/maven-aether-provider-3.2.5.jar +0 -0
  513. data/res/build-tools/maven/lib/maven-aether-provider.license +0 -202
  514. data/res/build-tools/maven/lib/maven-artifact-3.2.5.jar +0 -0
  515. data/res/build-tools/maven/lib/maven-artifact.license +0 -202
  516. data/res/build-tools/maven/lib/maven-compat-3.2.5.jar +0 -0
  517. data/res/build-tools/maven/lib/maven-compat.license +0 -202
  518. data/res/build-tools/maven/lib/maven-core-3.2.5.jar +0 -0
  519. data/res/build-tools/maven/lib/maven-core.license +0 -202
  520. data/res/build-tools/maven/lib/maven-embedder-3.2.5.jar +0 -0
  521. data/res/build-tools/maven/lib/maven-embedder.license +0 -202
  522. data/res/build-tools/maven/lib/maven-model-3.2.5.jar +0 -0
  523. data/res/build-tools/maven/lib/maven-model-builder-3.2.5.jar +0 -0
  524. data/res/build-tools/maven/lib/maven-model-builder.license +0 -202
  525. data/res/build-tools/maven/lib/maven-model.license +0 -202
  526. data/res/build-tools/maven/lib/maven-plugin-api-3.2.5.jar +0 -0
  527. data/res/build-tools/maven/lib/maven-plugin-api.license +0 -202
  528. data/res/build-tools/maven/lib/maven-repository-metadata-3.2.5.jar +0 -0
  529. data/res/build-tools/maven/lib/maven-repository-metadata.license +0 -202
  530. data/res/build-tools/maven/lib/maven-settings-3.2.5.jar +0 -0
  531. data/res/build-tools/maven/lib/maven-settings-builder-3.2.5.jar +0 -0
  532. data/res/build-tools/maven/lib/maven-settings-builder.license +0 -202
  533. data/res/build-tools/maven/lib/maven-settings.license +0 -202
  534. data/res/build-tools/maven/lib/org.eclipse.sisu.inject-0.3.0.M1.jar +0 -0
  535. data/res/build-tools/maven/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar +0 -0
  536. data/res/build-tools/maven/lib/plexus-cipher.license +0 -445
  537. data/res/build-tools/maven/lib/plexus-component-annotations-1.5.5.jar +0 -0
  538. data/res/build-tools/maven/lib/plexus-interpolation-1.21.jar +0 -0
  539. data/res/build-tools/maven/lib/plexus-sec-dispatcher-1.3.jar +0 -0
  540. data/res/build-tools/maven/lib/plexus-sec-dispatcher.license +0 -445
  541. data/res/build-tools/maven/lib/plexus-utils-3.0.20.jar +0 -0
  542. data/res/build-tools/maven/lib/sisu-guice-3.2.3-no_aop.jar +0 -0
  543. data/res/build-tools/maven/lib/slf4j-api-1.7.5.jar +0 -0
  544. data/res/build-tools/maven/lib/slf4j-simple-1.7.5.jar +0 -0
  545. data/res/build-tools/maven/lib/slf4j-simple.license +0 -190
  546. data/res/build-tools/maven/lib/wagon-file-2.8.jar +0 -0
  547. data/res/build-tools/maven/lib/wagon-file.license +0 -202
  548. data/res/build-tools/maven/lib/wagon-http-2.8-shaded.jar +0 -0
  549. data/res/build-tools/maven/lib/wagon-http-shared-2.8.jar +0 -0
  550. data/res/build-tools/maven/lib/wagon-http-shared.license +0 -202
  551. data/res/build-tools/maven/lib/wagon-http.license +0 -202
  552. data/res/build-tools/maven/lib/wagon-provider-api-2.8.jar +0 -0
  553. data/res/build-tools/maven/lib/wagon-provider-api.license +0 -202
@@ -0,0 +1,23 @@
1
+
2
+ #include "NilImpl.h"
3
+ #include <stdlib.h>
4
+
5
+ #include "../../ruby/ext/rho/rhoruby.h"
6
+ #include "../../ruby/include/ruby.h"
7
+
8
+ namespace rho {
9
+ namespace ruby {
10
+
11
+
12
+ NilImpl::NilImpl():ObjectImpl(BASIC_TYPES::RubyNil, NULL, rho_ruby_get_NIL()) {
13
+ }
14
+
15
+ NilImpl::~NilImpl() {
16
+ }
17
+
18
+ const char* NilImpl::getClassName() {
19
+ return "NilClass";
20
+ }
21
+
22
+ }
23
+ }
@@ -0,0 +1,32 @@
1
+ #pragma once
2
+
3
+
4
+ #include "../api/INil.h"
5
+ #include "ObjectImpl.h"
6
+
7
+ namespace rho {
8
+ namespace ruby {
9
+
10
+
11
+ class NilImpl : public ObjectImpl {
12
+
13
+ public:
14
+ NilImpl();
15
+ virtual ~NilImpl();
16
+
17
+ virtual const char* getClassName();
18
+
19
+ };
20
+
21
+ // C++ is sucks !
22
+ class CNil : public NilImpl, public INil {
23
+ public:
24
+ CNil() {}
25
+ virtual ~CNil() {}
26
+ virtual void addRef() {RefCountedObjectImpl::addRef();}
27
+ virtual void release() {RefCountedObjectImpl::release();}
28
+ virtual const char* getClassName() {return ObjectImpl::getClassName();}
29
+ virtual BASIC_TYPES getBasicType() {return ObjectImpl::getBasicType();}};
30
+
31
+ }
32
+ }
@@ -0,0 +1,77 @@
1
+
2
+ #include "ObjectImpl.h"
3
+ #include <stdlib.h>
4
+ #include "string.h"
5
+
6
+ namespace rho {
7
+ namespace ruby {
8
+
9
+ ObjectImpl::ObjectImpl(BASIC_TYPES basicType, const char* className, VALUE value)
10
+ :RefCountedObjectImpl() {
11
+ mBasicType = basicType;
12
+ mClassName = NULL;
13
+ setClassName(className);
14
+ mValue = NULL;
15
+ setValue(value);
16
+ }
17
+
18
+ ObjectImpl::ObjectImpl() {
19
+ mBasicType = BASIC_TYPES::None;
20
+ mClassName = NULL;
21
+ mValue = NULL;
22
+ }
23
+
24
+ void ObjectImpl::setBasicType(BASIC_TYPES basicType){
25
+ mBasicType = basicType;
26
+ }
27
+
28
+ void ObjectImpl::setClassName(const char* className) {
29
+ if (mClassName != NULL) {
30
+ free(mClassName);
31
+ mClassName = NULL;
32
+ }
33
+ if (className != NULL) {
34
+ int len = (int)strlen(className);
35
+ mClassName = (char*)malloc(len+1);
36
+ strcpy(mClassName, className);
37
+ }
38
+
39
+ }
40
+
41
+
42
+ ObjectImpl::~ObjectImpl(){
43
+ if (mClassName != NULL) {
44
+ free(mClassName);
45
+ }
46
+ if (mValue != NULL) {
47
+ rho_ruby_releaseValue(mValue);
48
+ }
49
+ }
50
+
51
+ const char* ObjectImpl::getClassName() {
52
+ return (const char*)mClassName;
53
+ }
54
+
55
+ BASIC_TYPES ObjectImpl::getBasicType(){
56
+ return mBasicType;
57
+ }
58
+
59
+ void ObjectImpl::setValue(VALUE value) {
60
+ if (mValue != NULL) {
61
+ rho_ruby_releaseValue(mValue);
62
+ }
63
+ mValue = NULL;
64
+ if (value != NULL) {
65
+ mValue = value;
66
+ rho_ruby_holdValue(mValue);
67
+ }
68
+ }
69
+
70
+ VALUE ObjectImpl::getValue() {
71
+ return mValue;
72
+ }
73
+
74
+
75
+
76
+ }
77
+ }
@@ -0,0 +1,53 @@
1
+ #pragma once
2
+
3
+
4
+ #include "../api/IObject.h"
5
+ #include "RefCountedObjectImpl.h"
6
+ #include <time.h>
7
+ #ifdef WIN32
8
+ #include "ruby/ext/rho/rhoruby.h"
9
+ #else
10
+ #import "ruby/ext/rho/rhoruby.h"
11
+ #endif
12
+
13
+ //#include "common/RhoStd.h"
14
+
15
+ namespace rho {
16
+ namespace ruby {
17
+
18
+
19
+ class ObjectImpl : public RefCountedObjectImpl {
20
+
21
+ public:
22
+ ObjectImpl(BASIC_TYPES basicType, const char* className, VALUE value);
23
+ ObjectImpl();
24
+ void setBasicType(BASIC_TYPES basicType);
25
+ void setClassName(const char* className);
26
+ void setValue(VALUE value);
27
+ VALUE getValue();
28
+
29
+ virtual ~ObjectImpl();
30
+ virtual const char* getClassName();
31
+ virtual BASIC_TYPES getBasicType();
32
+
33
+ private:
34
+ BASIC_TYPES mBasicType;
35
+ char* mClassName;
36
+ VALUE mValue;
37
+ };
38
+
39
+
40
+ // C++ is sucks !
41
+ class CObject : public ObjectImpl, public IObject {
42
+ public:
43
+ CObject(BASIC_TYPES basicType, const char* className, VALUE value):ObjectImpl(basicType, className, value) {}
44
+ CObject() {}
45
+ virtual void addRef() {RefCountedObjectImpl::addRef();}
46
+ virtual void release() {RefCountedObjectImpl::release();}
47
+ virtual const char* getClassName() {return ObjectImpl::getClassName();}
48
+ virtual BASIC_TYPES getBasicType() {return ObjectImpl::getBasicType();}
49
+ };
50
+
51
+
52
+ }
53
+ }
@@ -0,0 +1,28 @@
1
+
2
+ #include "RefCountedObjectImpl.h"
3
+
4
+
5
+ namespace rho {
6
+ namespace ruby {
7
+
8
+ RefCountedObjectImpl::RefCountedObjectImpl() {
9
+ mRefCounter = 1;
10
+ }
11
+
12
+ RefCountedObjectImpl::~RefCountedObjectImpl() {
13
+
14
+ }
15
+
16
+ void RefCountedObjectImpl::addRef() {
17
+ mRefCounter++;
18
+ }
19
+
20
+ void RefCountedObjectImpl::release() {
21
+ mRefCounter--;
22
+ if (mRefCounter <= 0) {
23
+ delete this;
24
+ }
25
+ }
26
+
27
+ }
28
+ }
@@ -0,0 +1,33 @@
1
+ #pragma once
2
+
3
+
4
+ #include "../api/IRefCountedObject.h"
5
+
6
+
7
+ namespace rho {
8
+ namespace ruby {
9
+
10
+ class RefCountedObjectImpl {
11
+
12
+ public:
13
+ RefCountedObjectImpl();
14
+
15
+ virtual ~RefCountedObjectImpl();
16
+
17
+ virtual void addRef();
18
+
19
+ virtual void release();
20
+
21
+ private:
22
+ int mRefCounter;
23
+
24
+ };
25
+
26
+ class CRefCountedObject : public RefCountedObjectImpl, public IRefCountedObject {
27
+ CRefCountedObject() {}
28
+ virtual void addRef() {RefCountedObjectImpl::addRef();}
29
+ virtual void release() {RefCountedObjectImpl::release();}
30
+ };
31
+
32
+ }
33
+ }
@@ -0,0 +1,799 @@
1
+
2
+ #include <cstddef>
3
+ #include <condition_variable>
4
+
5
+
6
+ #include "ruby.h"
7
+
8
+
9
+
10
+
11
+ #include "RhoRubyImpl.h"
12
+ #include "ObjectImpl.h"
13
+ #include "../api/RhoRubySingletone.h"
14
+
15
+
16
+ #include "NilImpl.h"
17
+ #include "MutableStringImpl.h"
18
+ #include "MutableBooleanImpl.h"
19
+ #include "MutableIntegerImpl.h"
20
+ #include "MutableFloatImpl.h"
21
+ #include "MutableArrayImpl.h"
22
+ #include "MutableHashImpl.h"
23
+
24
+ #include "../../ruby/ext/rho/rhoruby.h"
25
+
26
+ #include "common/RhodesApp.h"
27
+
28
+
29
+ #include "../../../../lib/commonAPI/coreapi/ext/shared/generated/cpp/NetworkBase.h"
30
+
31
+
32
+ #define RHOLIB_LOCAL_SERVER_URL "/system/rholib_callback"
33
+
34
+
35
+ static VALUE rb_api_mParent;
36
+ static VALUE rb_api_mRubyNative;
37
+
38
+
39
+ static void _free_class_object(void *p)
40
+ {
41
+ ruby_xfree(p);
42
+ }
43
+
44
+ static VALUE _allocate_class_object(VALUE klass)
45
+ {
46
+ VALUE valObj = 0;
47
+ char ** ppString = NULL;
48
+ void* pData = ALLOC(void*);
49
+ memset( pData, 0, sizeof(pData) );
50
+
51
+ valObj = Data_Wrap_Struct(klass, 0, _free_class_object, pData);
52
+
53
+ Data_Get_Struct(valObj, char *, ppString);
54
+ *ppString = (char*)xmalloc(20);
55
+ sprintf(*ppString, "%X", valObj);
56
+
57
+ return valObj;
58
+ }
59
+
60
+ extern "C" VALUE c_rb_Rho_Ruby_callNativeCallback(int argc, VALUE *argv) {
61
+ rho::ruby::RhoRubyImpl* rr = (rho::ruby::RhoRubyImpl*)(rho::ruby::RhoRubySingletone::getRhoRuby());
62
+ return rr->rb_Rho_Ruby_callNativeCallback(argc, argv);
63
+ }
64
+
65
+ static void rholib_local_server_callback_func(void *arg, rho::String const &strQuery) {
66
+ rho::ruby::RhoRubyImpl* rr = (rho::ruby::RhoRubyImpl*)(rho::ruby::RhoRubySingletone::getRhoRuby());
67
+ rr->rholib_local_server_callback();
68
+ rho_http_sendresponse(arg, "");
69
+ }
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ typedef VALUE (*ruby_method_func_type)(...);
79
+
80
+ namespace rho {
81
+ namespace ruby {
82
+
83
+
84
+ class CRhoLocalServerRequestTask
85
+ {
86
+ rho::String m_strUrl;
87
+ IRubyLocalServerRequestCallback* m_Callback;
88
+ public:
89
+ CRhoLocalServerRequestTask(const rho::String& strUrl, IRubyLocalServerRequestCallback* callback)
90
+ : m_strUrl(strUrl), m_Callback(callback)
91
+ {}
92
+
93
+ void run(common::CRhoThread &)
94
+ {
95
+ rho::net::CNetRequestWrapper wrap_req = rho::net::CNetRequestWrapper( rho_get_RhoClassFactory()->createNetRequestImpl(), NULL );
96
+ NetResponse resp = wrap_req.pullData( m_strUrl.c_str(), NULL );
97
+ IMutableString* str_resp = NULL;
98
+ if (resp.isOK()) {
99
+ const char* body = resp.getCharData();
100
+ if (body != NULL) {
101
+ str_resp = (IMutableString*)rho::ruby::RhoRubySingletone::getRhoRuby()->makeBaseTypeObject(BASIC_TYPES::MutableString);
102
+ str_resp->setUTF8(body);
103
+ }
104
+ }
105
+ if (m_Callback != NULL) {
106
+ m_Callback->onLocalServerResponce(str_resp);
107
+ }
108
+ }
109
+ };
110
+
111
+
112
+
113
+
114
+ RhoRubyImpl::~RhoRubyImpl() {
115
+
116
+ }
117
+
118
+ void RhoRubyImpl::init()
119
+ {
120
+ rho::common::CRhodesApp::getInstance()->registerLocalServerUrl(RHOLIB_LOCAL_SERVER_URL, rholib_local_server_callback_func);
121
+ if(lateInit)
122
+ {
123
+
124
+ class LateInit : public rho::ruby::IRunnable
125
+ {
126
+ friend RhoRubyImpl;
127
+
128
+ std::condition_variable lateWaiter;
129
+ std::mutex mutexWaiter;
130
+ public:
131
+ LateInit() {}
132
+ void run() override
133
+ {
134
+ rb_api_mParent = rb_define_module("Rho");
135
+ rb_api_mRubyNative = rb_define_class_under(rb_api_mParent, "Ruby", rb_cObject);
136
+ rb_define_alloc_func(rb_api_mRubyNative, _allocate_class_object);
137
+ rb_define_singleton_method(rb_api_mRubyNative, "callNativeCallback", (ruby_method_func_type)c_rb_Rho_Ruby_callNativeCallback, -1);
138
+ lateWaiter.notify_one();
139
+ }
140
+ } late_init;
141
+
142
+ std::unique_lock<std::mutex> lock(late_init.mutexWaiter);
143
+ executeInRubyThread(&late_init);
144
+ late_init.lateWaiter.wait(lock);
145
+ }
146
+ }
147
+
148
+
149
+ RhoRubyImpl::RhoRubyImpl(bool _lateInit) : lateInit(_lateInit) {
150
+ // register Rho::Ruby.callNativeCallback(callback_id, param)
151
+
152
+ if(!_lateInit)
153
+ {
154
+ rb_api_mParent = rb_define_module("Rho");
155
+
156
+ rb_api_mRubyNative = rb_define_class_under(rb_api_mParent, "Ruby", rb_cObject);
157
+
158
+ rb_define_alloc_func(rb_api_mRubyNative, _allocate_class_object);
159
+
160
+ rb_define_singleton_method(rb_api_mRubyNative, "callNativeCallback", (ruby_method_func_type)c_rb_Rho_Ruby_callNativeCallback, -1);
161
+
162
+
163
+ rho::common::CRhodesApp::getInstance()->registerLocalServerUrl(RHOLIB_LOCAL_SERVER_URL, rholib_local_server_callback_func);
164
+ }
165
+
166
+
167
+ }
168
+
169
+ void RhoRubyImpl::rholib_local_server_callback() {
170
+
171
+ int i;
172
+ std::vector<IRunnable*> copy_of_commands_list;
173
+
174
+ {
175
+ common::CMutexLock lock(m_mxSyncMutex);
176
+ for (i = 0; i<mRubyCommands.size(); i++) {
177
+ copy_of_commands_list.push_back(mRubyCommands[i]);
178
+ }
179
+ mRubyCommands.clear();
180
+ }
181
+ // call all copied commands
182
+
183
+ for (i = 0; i < copy_of_commands_list.size(); i++) {
184
+ if (copy_of_commands_list[i] != NULL) {
185
+ copy_of_commands_list[i]->run();
186
+ }
187
+ }
188
+
189
+ }
190
+
191
+ // get local Ruby server URL
192
+ IString* RhoRubyImpl::getRubyServerURL() {
193
+ IMutableString* ms = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
194
+ ms->setUTF8(RHODESAPP().getRubyHomeURL().c_str());
195
+ return ms;
196
+ }
197
+
198
+ // call command in ruby thread
199
+ void RhoRubyImpl::executeInRubyThread(IRunnable* command) {
200
+ {
201
+ common::CMutexLock lock(m_mxSyncMutex);
202
+ mRubyCommands.push_back(command);
203
+ }
204
+
205
+ rho::String rurl = RHODESAPP().getRubyHomeURL();
206
+ rurl += RHOLIB_LOCAL_SERVER_URL;
207
+ //rho::common::CRhodesApp::getInstance()->callCallbackWithData(rurl, "", "", false);
208
+ //rho::common::CRhodesApp::getInstance()->runCallbackInThread(rurl, "");
209
+ rho::common::rho_rhodesapp_call_in_thread(new CRhoLocalServerRequestTask(rurl, NULL ) );
210
+
211
+ }
212
+
213
+ void RhoRubyImpl::executeGetRequestToRubyServer(const char* url, IRubyLocalServerRequestCallback* callback) {
214
+ rho::String s_url = RHODESAPP().canonicalizeRhoUrl(url);
215
+ rho::common::rho_rhodesapp_call_in_thread(new CRhoLocalServerRequestTask(s_url, callback ) );
216
+ }
217
+
218
+
219
+ // execute ruby code in current thread. parameters can be simple object (string, integer etc. - in this case one parameters will be passed to method.)
220
+ // also parameters can be IArray - in this case list of parameters will be passed to method (parameters from array)
221
+ // this method recommended execute from ruby thread (from IRunnable command), but can be executed from other thread for very simple opertions without modifying ruby objects
222
+ IObject* RhoRubyImpl::executeRubyObjectMethod(IObject* object, const char* method_name, IObject* parameters) {
223
+ if (object == NULL) {
224
+ return NULL;
225
+ }
226
+ CObject* obj_impl = (CObject*)object;
227
+
228
+ int param_count = 0;
229
+ IArray* params_array = NULL;
230
+
231
+
232
+ VALUE result = rho_ruby_get_NIL();
233
+ VALUE params[10];
234
+ int i;
235
+
236
+ // check for array
237
+ if (parameters != NULL) {
238
+ if ((parameters->getBasicType() == BASIC_TYPES::Array) || (parameters->getBasicType() == BASIC_TYPES::MutableArray)) {
239
+ params_array = (IArray*)parameters;
240
+ param_count = params_array->getItemsCount();
241
+ if (param_count > 10) {
242
+ param_count = 10;
243
+ }
244
+ for (i = 0; i < param_count; i++) {
245
+ params[i] = convertObject_to_VALUE(params_array->getItem(i));
246
+ }
247
+ }
248
+ else {
249
+ param_count = 1;
250
+ params[0] = convertObject_to_VALUE(parameters);
251
+ }
252
+ }
253
+
254
+
255
+ if (param_count == 0) {
256
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 0, NULL);
257
+ }
258
+ else if (param_count == 1) {
259
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 1, params[0]);
260
+ }
261
+ else if (param_count == 2) {
262
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 2, params[0], params[1]);
263
+ }
264
+ else if (param_count == 3) {
265
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 3, params[0], params[1], params[2]);
266
+ }
267
+ else if (param_count == 4) {
268
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 4, params[0], params[1], params[2], params[3]);
269
+ }
270
+ else if (param_count == 5) {
271
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 5, params[0], params[1], params[2], params[3], params[4]);
272
+ }
273
+ else if (param_count == 6) {
274
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 6, params[0], params[1], params[2], params[3], params[4], params[5]);
275
+ }
276
+ else if (param_count == 7) {
277
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 7, params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
278
+ }
279
+ else if (param_count == 8) {
280
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 8, params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7]);
281
+ }
282
+ else if (param_count == 9) {
283
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 9, params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8]);
284
+ }
285
+ else if (param_count == 10) {
286
+ result = rb_funcall(obj_impl->getValue(), rb_intern(method_name), 10, params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8], params[9]);
287
+ }
288
+
289
+ IObject* obj_result = convertVALUE_to_Object(result);
290
+
291
+
292
+ return obj_result;
293
+ }
294
+
295
+ // this method recommended execute from ruby thread (from IRunnable command), but can be executed from other thread
296
+ IObject* RhoRubyImpl::makeRubyClassObject(const char* full_class_name) {
297
+ VALUE rb_klass = rb_path_to_class(rho_ruby_create_string(full_class_name));
298
+ CObject* rho_obj = new CObject();
299
+ rho_obj->setValue(rb_klass);
300
+ rho_obj->setBasicType(BASIC_TYPES::Class);
301
+ rho_obj->setClassName("Class");
302
+ return rho_obj;
303
+ }
304
+
305
+ // can be execute from any thread - for construct parameters for execute ruby code
306
+ IObject* RhoRubyImpl::makeBaseTypeObject(BASIC_TYPES type) {
307
+ switch(type) {
308
+ case BASIC_TYPES::Array:
309
+ case BASIC_TYPES::MutableArray:
310
+ {
311
+ return new CMutableArray(true);
312
+ }
313
+ break;
314
+ case BASIC_TYPES::Boolean:
315
+ case BASIC_TYPES::MutableBoolean:
316
+ {
317
+ return new CMutableBoolean(true);
318
+ }
319
+ break;
320
+ case BASIC_TYPES::Float:
321
+ case BASIC_TYPES::MutableFloat:
322
+ {
323
+ return new CMutableFloat(true);
324
+ }
325
+ break;
326
+ case BASIC_TYPES::Hash:
327
+ case BASIC_TYPES::MutableHash:
328
+ {
329
+ return new CMutableHash(true);
330
+ }
331
+ break;
332
+ case BASIC_TYPES::Integer:
333
+ case BASIC_TYPES::MutableInteger:
334
+ {
335
+ return new CMutableInteger(true);
336
+ }
337
+ break;
338
+ case BASIC_TYPES::String:
339
+ case BASIC_TYPES::MutableString:
340
+ {
341
+ return new CMutableString(true);
342
+ }
343
+ break;
344
+ case BASIC_TYPES::RubyNil:
345
+ {
346
+ return new CNil();
347
+ }
348
+ break;
349
+ default:
350
+ {
351
+ return NULL;
352
+ }
353
+ }
354
+ return NULL;
355
+ }
356
+
357
+
358
+ // register callback for execute from Ruby side via - it is needed for direct call native code foem ruby code
359
+ // Rho::Ruby.callNativeCallback(callback_id, param)
360
+ void RhoRubyImpl::addRubyNativeCallback(const char* callback_id, IRubyNativeCallback* callback) {
361
+ mCallbacks[callback_id] = callback;
362
+ }
363
+
364
+ void RhoRubyImpl::removeRubyNativeCallback(const char* callback_id) {
365
+ mCallbacks.erase(callback_id);
366
+ }
367
+
368
+
369
+
370
+ IObject* RhoRubyImpl::convertJSON_to_Object(json::CJSONEntry* jsonEntry) {
371
+ if (jsonEntry == NULL) {
372
+ return NULL;
373
+ }
374
+ if (jsonEntry->isString()) {
375
+ rho::String str = jsonEntry->getStringObject();
376
+ IMutableString* ms = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
377
+ ms->setUTF8(str.c_str());
378
+ return ms;
379
+ }
380
+ if (jsonEntry->isInteger()) {
381
+ IMutableInteger* ms = (IMutableInteger*)makeBaseTypeObject(BASIC_TYPES::MutableInteger);
382
+ ms->setLong(jsonEntry->getInt());
383
+ return ms;
384
+ }
385
+ if (jsonEntry->isFloat()) {
386
+ IMutableFloat* ms = (IMutableFloat*)makeBaseTypeObject(BASIC_TYPES::MutableFloat);
387
+ ms->setDouble(jsonEntry->getDouble());
388
+ return ms;
389
+ }
390
+ if (jsonEntry->isBoolean()) {
391
+ IMutableBoolean* ms = (IMutableBoolean*)makeBaseTypeObject(BASIC_TYPES::MutableBoolean);
392
+ ms->setBool(jsonEntry->getBoolean());
393
+ return ms;
394
+ }
395
+ if (jsonEntry->isArray()) {
396
+ rho::json::CJSONArray js_array(*jsonEntry);
397
+ int i;
398
+ int count = js_array.getSize();
399
+ IMutableArray* ms = (IMutableArray*)makeBaseTypeObject(BASIC_TYPES::MutableArray);
400
+ for (i =0 ; i < count; i++) {
401
+ rho::json::CJSONEntry js_entry = js_array[i];
402
+ IObject* item = convertJSON_to_Object(&js_entry);
403
+ if (item != NULL) {
404
+ ms->addItem(item);
405
+ item->release();
406
+ }
407
+ else {
408
+ RAWLOG_ERROR1("ERROR during convert JSON data 2 ! data = %s", js_entry.getString());
409
+ }
410
+ }
411
+ return ms;
412
+ }
413
+ if (jsonEntry->isObject()) {
414
+ rho::json::CJSONStructIterator js_iterator(*jsonEntry);
415
+ IMutableHash* ms = (IMutableHash*)makeBaseTypeObject(BASIC_TYPES::MutableHash);
416
+ while (!js_iterator.isEnd()) {
417
+ rho::String key = js_iterator.getCurKey();
418
+ rho::json::CJSONEntry js_entry = js_iterator.getCurValue();
419
+ IObject* item = convertJSON_to_Object(&js_entry);
420
+ if (item != NULL) {
421
+ ms->addItem(key.c_str(), item);
422
+ item->release();
423
+ }
424
+ else {
425
+ RAWLOG_ERROR1("ERROR during convert JSON data 2 ! data = %s", js_entry.getString());
426
+ }
427
+ js_iterator.next();
428
+ }
429
+ return ms;
430
+ }
431
+ return NULL;
432
+ }
433
+
434
+ // util methods (used for parse responce from server etc.)
435
+ IObject* RhoRubyImpl::convertJSON_to_Objects(const char* json) {
436
+ if (json == NULL) {
437
+ return NULL;
438
+ }
439
+ if (strlen(json) <= 0) {
440
+ return NULL;
441
+ }
442
+ json::CJSONEntry oEntry(json);
443
+ return convertJSON_to_Object(&oEntry);
444
+ }
445
+
446
+ IString* RhoRubyImpl::convertObject_to_JSON(IObject* obj) {
447
+ if (obj == NULL) {
448
+ return NULL;
449
+ }
450
+ BASIC_TYPES o_type = obj->getBasicType();
451
+ switch(o_type) {
452
+ case BASIC_TYPES::Array:
453
+ case BASIC_TYPES::MutableArray:
454
+ {
455
+ IArray* ar = (IArray*)obj;
456
+ int count = ar->getItemsCount();
457
+ int i;
458
+ rho::String str;
459
+ str = "[";
460
+ for (i = 0; i < count; i++) {
461
+ IObject* r_obj = ar->getItem(i);
462
+ IString* r_str = convertObject_to_JSON(r_obj);
463
+ if(!r_str) continue;
464
+ str.append(r_str->getUTF8());
465
+ if (i < (count-1)) {
466
+ str.append(",");
467
+ }
468
+ r_str->release();
469
+ }
470
+ str.append("]");
471
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
472
+ o_str->setUTF8(str.c_str());
473
+ return o_str;
474
+ }
475
+ break;
476
+ case BASIC_TYPES::Boolean:
477
+ case BASIC_TYPES::MutableBoolean:
478
+ {
479
+ IBoolean* bo = (IBoolean*)obj;
480
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
481
+ if (bo->getBool()) {
482
+ o_str->setUTF8("true");
483
+ }
484
+ else {
485
+ o_str->setUTF8("false");
486
+ }
487
+ return o_str;
488
+ }
489
+ break;
490
+ case BASIC_TYPES::Float:
491
+ case BASIC_TYPES::MutableFloat:
492
+ {
493
+ IFloat* flo = (IFloat*)obj;
494
+ char buf[100];
495
+ sprintf(buf, "%lf", flo->getDouble());
496
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
497
+ o_str->setUTF8(buf);
498
+ return o_str;
499
+ }
500
+ break;
501
+ case BASIC_TYPES::Hash:
502
+ case BASIC_TYPES::MutableHash:
503
+ {
504
+ IHash* ha = (IHash*)obj;
505
+ IArray* keys = ha->getKeys();
506
+ int i;
507
+ int count = keys->getItemsCount();
508
+ rho::String str;
509
+ str = "{";
510
+ for (i = 0; i < count; i++) {
511
+ IString* r_key = (IString*)keys->getItem(i);
512
+ IObject* r_value = ha->getItem(r_key->getUTF8());
513
+ IString* r_str = convertObject_to_JSON(r_value);
514
+ if(!r_str) continue;
515
+ str.append(rho::json::CJSONEntry::quoteValue(r_key->getUTF8()));
516
+ str.append(":");
517
+ str.append(r_str->getUTF8());
518
+ if (i < (count-1)) {
519
+ str.append(",");
520
+ }
521
+ r_str->release();
522
+ }
523
+ str.append("}");
524
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
525
+ o_str->setUTF8(str.c_str());
526
+ return o_str;
527
+ }
528
+ break;
529
+ case BASIC_TYPES::Integer:
530
+ case BASIC_TYPES::MutableInteger:
531
+ {
532
+ IInteger* flo = (IInteger*)obj;
533
+ char buf[100];
534
+ sprintf(buf, "%ld", flo->getLong());
535
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
536
+ o_str->setUTF8(buf);
537
+ return o_str;
538
+ }
539
+ break;
540
+ case BASIC_TYPES::String:
541
+ case BASIC_TYPES::MutableString:
542
+ {
543
+ IString* str = (IString*)obj;
544
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
545
+ o_str->setUTF8(rho::json::CJSONEntry::quoteValue(str->getUTF8()).c_str());
546
+ return o_str;
547
+ }
548
+ break;
549
+ case BASIC_TYPES::RubyNil:
550
+ {
551
+ IMutableString* o_str = (IMutableString*)makeBaseTypeObject(BASIC_TYPES::MutableString);
552
+ o_str->setUTF8("null");
553
+ return o_str;
554
+ }
555
+ break;
556
+ default:
557
+ {
558
+ RAWLOG_ERROR1("Not supported type for json converting : %d", o_type);
559
+ return NULL;
560
+ }
561
+ }
562
+ return NULL;
563
+ }
564
+
565
+ void RhoRubyImpl::loadRubyFile(const char* ruby_file_path) {
566
+ rb_require(ruby_file_path);
567
+ }
568
+
569
+ void RhoRubyImpl::loadModel(const char* ruby_file_path) {
570
+ VALUE rb_Kernel_klass = rb_path_to_class(rho_ruby_create_string("Kernel"));
571
+ rb_funcall(rb_Kernel_klass, rb_intern("require_model"), 1, rho_ruby_create_string(ruby_file_path));
572
+ }
573
+
574
+ IObject* RhoRubyImpl::executeRubyMethod(const char* full_class_name, const char* method_name, IObject* parameters) {
575
+ IObject* obj = makeRubyClassObject(full_class_name);
576
+ IObject* result = executeRubyObjectMethod(obj, method_name, parameters);
577
+ obj->release();
578
+ return result;
579
+ }
580
+
581
+ IString* RhoRubyImpl::executeRubyMethodWithJSON(const char* full_class_name, const char* method_name, const char* parameters_in_json) {
582
+ IObject* parameters = convertJSON_to_Objects(parameters_in_json);
583
+ if(!parameters && parameters_in_json)
584
+ return nullptr;
585
+ IObject* result = executeRubyMethod(full_class_name, method_name, parameters);
586
+ IString* str = convertObject_to_JSON(result);
587
+ result->release();
588
+ return str;
589
+ }
590
+
591
+
592
+
593
+
594
+
595
+ IObject* RhoRubyImpl::convertVALUE_to_Object(VALUE ruby_value) {
596
+ int i, size;
597
+ switch(rb_type(ruby_value)) {
598
+ case T_STRING:
599
+ {
600
+ CMutableString* str = new CMutableString(false);
601
+ str->setValue(ruby_value);
602
+ str->setUTF8(RSTRING_PTR(ruby_value));
603
+ return str;
604
+ }
605
+ break;
606
+ case T_FLOAT:
607
+ {
608
+ CMutableFloat* o = new CMutableFloat(false);
609
+ o->setValue(ruby_value);
610
+ o->setDouble(RFLOAT_VALUE(ruby_value));
611
+ return o;
612
+ }
613
+ break;
614
+ case T_FIXNUM:
615
+ case T_BIGNUM:
616
+ {
617
+ CMutableInteger* o = new CMutableInteger(false);
618
+ o->setValue(ruby_value);
619
+ o->setLong((long int)(NUM2LL(ruby_value)));
620
+ return o;
621
+ }
622
+ break;
623
+ case T_TRUE:
624
+ {
625
+ CMutableBoolean* o = new CMutableBoolean(false);
626
+ o->setValue(ruby_value);
627
+ o->setBool(true);
628
+ return o;
629
+ }
630
+ break;
631
+ case T_FALSE:
632
+ {
633
+ CMutableBoolean* o = new CMutableBoolean(false);
634
+ o->setValue(ruby_value);
635
+ o->setBool(false);
636
+ return o;
637
+ }
638
+ break;
639
+ case T_ARRAY:
640
+ {
641
+ CMutableArray* ar = new CMutableArray(false);
642
+ size = (int)RARRAY_LEN(ruby_value);
643
+ ar->reserve(size);
644
+ for (i = 0; i < size; ++i) {
645
+ VALUE item = rb_ary_entry(ruby_value, i);
646
+ IObject* o_item = convertVALUE_to_Object(item);
647
+ ar->addItem(o_item);
648
+ o_item->release();
649
+ }
650
+ return ar;
651
+ }
652
+ break;
653
+ case T_HASH:
654
+ {
655
+ VALUE keys = rb_funcall(ruby_value, rb_intern("keys"), 0, NULL);
656
+ size = (int)RARRAY_LEN(keys);
657
+ CMutableHash* hash = new CMutableHash(false);
658
+ for (i = 0; i < size; ++i) {
659
+ VALUE key = rb_ary_entry(keys, i);
660
+ VALUE value = rb_hash_aref(ruby_value, key);
661
+ if (rb_type(key) != T_STRING) {
662
+ key = rb_funcall(key, rb_intern("to_s"), 0, NULL);
663
+ }
664
+ IObject* o_item = convertVALUE_to_Object(value);
665
+ hash->addItem(RSTRING_PTR(key), o_item);
666
+ o_item->release();
667
+ }
668
+ return hash;
669
+ }
670
+ break;
671
+ default:
672
+ {
673
+ if (rho_ruby_is_NIL(ruby_value)) {
674
+ return new CNil();
675
+ }
676
+ CObject* str = new CObject();
677
+ VALUE v_class = rb_funcall(ruby_value, rb_intern("class"), 0, NULL);
678
+ VALUE v_class_name = rb_funcall(v_class, rb_intern("name"), 0, NULL);
679
+ str->setClassName(RSTRING_PTR(v_class_name));
680
+ str->setBasicType(BASIC_TYPES::Object);
681
+ str->setValue(ruby_value);
682
+ return str;
683
+ }
684
+ }
685
+ return NULL;
686
+ }
687
+
688
+ VALUE RhoRubyImpl::convertObject_to_VALUE(IObject* obj) {
689
+ if (obj == NULL) {
690
+ return rho_ruby_get_NIL();
691
+ }
692
+ VALUE v = rho_ruby_get_NIL();
693
+ BASIC_TYPES o_type = obj->getBasicType();
694
+ switch(o_type) {
695
+ case BASIC_TYPES::Array:
696
+ case BASIC_TYPES::MutableArray:
697
+ {
698
+ IArray* ar = (IArray*)obj;
699
+ int count = ar->getItemsCount();
700
+ int i;
701
+ v = rho_ruby_create_array();
702
+ for (i = 0; i < count; i++) {
703
+ IObject* r_obj = ar->getItem(i);
704
+ VALUE objValue = convertObject_to_VALUE(r_obj);
705
+ rho_ruby_add_to_array(v, objValue);
706
+ }
707
+ return v;
708
+ }
709
+ break;
710
+ case BASIC_TYPES::Boolean:
711
+ case BASIC_TYPES::MutableBoolean:
712
+ {
713
+ IBoolean* bo = (IBoolean*)obj;
714
+ v = rho_ruby_create_boolean(bo->getBool());
715
+ return v;
716
+ }
717
+ break;
718
+ case BASIC_TYPES::Float:
719
+ case BASIC_TYPES::MutableFloat:
720
+ {
721
+ IFloat* flo = (IFloat*)obj;
722
+ v = rho_ruby_create_double(flo->getDouble());
723
+ return v;
724
+ }
725
+ break;
726
+ case BASIC_TYPES::Hash:
727
+ case BASIC_TYPES::MutableHash:
728
+ {
729
+ v = rho_ruby_createHash();
730
+ IHash* ha = (IHash*)obj;
731
+ IArray* keys = ha->getKeys();
732
+ int i;
733
+ int count = keys->getItemsCount();
734
+ for (i = 0 ; i < count; i++) {
735
+ IString* r_key = (IString*)keys->getItem(i);
736
+ IObject* r_value = ha->getItem(r_key->getUTF8());
737
+ VALUE vKey = convertObject_to_VALUE(r_key);
738
+ VALUE vItem = convertObject_to_VALUE(r_value);
739
+ rho_ruby_add_to_hash(v, vKey, vItem);
740
+ }
741
+ keys->release();
742
+ return v;
743
+ }
744
+ break;
745
+ case BASIC_TYPES::Integer:
746
+ case BASIC_TYPES::MutableInteger:
747
+ {
748
+ IInteger* in = (IInteger*)obj;
749
+ v = rho_ruby_create_integer(in->getLong());
750
+ return v;
751
+ }
752
+ break;
753
+ case BASIC_TYPES::String:
754
+ case BASIC_TYPES::MutableString:
755
+ {
756
+ IString* str = (IString*)obj;
757
+ v = rho_ruby_create_string(str->getUTF8());
758
+ return v;
759
+ }
760
+ break;
761
+ case BASIC_TYPES::RubyNil:
762
+ {
763
+ return rho_ruby_get_NIL();
764
+ }
765
+ break;
766
+ default:
767
+ {
768
+ return rho_ruby_get_NIL();
769
+ }
770
+ }
771
+ return rho_ruby_get_NIL();
772
+ }
773
+
774
+
775
+ VALUE RhoRubyImpl::rb_Rho_Ruby_callNativeCallback(int argc, VALUE *argv) {
776
+ if (argc != 2) {
777
+ return rho_ruby_get_NIL();
778
+ }
779
+ VALUE v_callback_id = argv[0];
780
+ VALUE v_param = argv[1];
781
+
782
+ if (rb_type(v_callback_id) != T_STRING) {
783
+ return rho_ruby_get_NIL();
784
+ }
785
+ const char* callback_id = RSTRING_PTR(v_callback_id);
786
+
787
+ IRubyNativeCallback* callback = mCallbacks[callback_id];
788
+ if (callback == NULL) {
789
+ return rho_ruby_get_NIL();
790
+ }
791
+ callback->onRubyNative(convertVALUE_to_Object(v_param));
792
+ return rho_ruby_get_NIL();
793
+ }
794
+
795
+
796
+
797
+
798
+ }
799
+ }