rhodes 2.3.2 → 2.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (623) hide show
  1. data/CHANGELOG +18 -0
  2. data/CREDITS +38 -0
  3. data/README.md +2 -2
  4. data/Rakefile +60 -2
  5. data/bin/set-rhodes-sdk.bat +1 -0
  6. data/doc/application.txt +11 -0
  7. data/doc/build.txt +156 -39
  8. data/doc/configuration.txt +1 -10
  9. data/doc/connect-to-web-services.txt +6 -6
  10. data/doc/device-caps.txt +48 -5
  11. data/doc/extensions.txt +8 -1
  12. data/doc/rhom.txt +16 -0
  13. data/doc/synchronization.txt +56 -14
  14. data/doc/ui.txt +23 -2
  15. data/installer/instant-rhodes.nsi +6 -6
  16. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +4 -2
  17. data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
  18. data/lib/extensions/digest-md5/ext/Rakefile +3 -3
  19. data/lib/extensions/digest-md5/ext/build +0 -1
  20. data/lib/extensions/digest-sha1/ext/Rakefile +1 -1
  21. data/lib/extensions/digest-sha1/ext/build +0 -1
  22. data/lib/extensions/digest/ext/Rakefile +3 -3
  23. data/lib/extensions/digest/ext/build +0 -1
  24. data/lib/extensions/fcntl/ext/Rakefile +1 -1
  25. data/lib/extensions/mspec/mspec/guards/guard.rb +4 -0
  26. data/lib/extensions/mspec/mspec/helpers/environment.rb +4 -0
  27. data/lib/extensions/nfc/ext.yml +2 -0
  28. data/lib/extensions/nfc/ext/build +12 -0
  29. data/lib/extensions/nfc/ext/build.bat +8 -0
  30. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +25 -0
  31. data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +94 -0
  32. data/lib/extensions/nfc/ext/nfc/platform/android/ext_build.files +4 -0
  33. data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +404 -0
  34. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +138 -0
  35. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessage.java +34 -0
  36. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessagePack.java +33 -0
  37. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcRecord.java +149 -0
  38. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +22 -0
  39. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +2034 -0
  40. data/lib/extensions/nfc/nfc.rb +120 -0
  41. data/lib/extensions/rholang/{lang_ca.rb → rholang/lang_ca.rb} +0 -0
  42. data/lib/extensions/rholang/{lang_cf.rb → rholang/lang_cf.rb} +0 -0
  43. data/lib/extensions/rholang/{lang_chef.rb → rholang/lang_chef.rb} +0 -0
  44. data/lib/extensions/rholang/{lang_cs.rb → rholang/lang_cs.rb} +0 -0
  45. data/lib/extensions/rholang/{lang_da.rb → rholang/lang_da.rb} +0 -0
  46. data/lib/extensions/rholang/{lang_de.rb → rholang/lang_de.rb} +0 -0
  47. data/lib/extensions/rholang/{lang_es.rb → rholang/lang_es.rb} +0 -0
  48. data/lib/extensions/rholang/{lang_es_ar.rb → rholang/lang_es_ar.rb} +0 -0
  49. data/lib/extensions/rholang/{lang_fi.rb → rholang/lang_fi.rb} +0 -0
  50. data/lib/extensions/rholang/{lang_fr.rb → rholang/lang_fr.rb} +0 -0
  51. data/lib/extensions/rholang/{lang_it.rb → rholang/lang_it.rb} +0 -0
  52. data/lib/extensions/rholang/{lang_ko.rb → rholang/lang_ko.rb} +0 -0
  53. data/lib/extensions/rholang/{lang_nl.rb → rholang/lang_nl.rb} +0 -0
  54. data/lib/extensions/rholang/{lang_no.rb → rholang/lang_no.rb} +0 -0
  55. data/lib/extensions/rholang/{lang_pt.rb → rholang/lang_pt.rb} +0 -0
  56. data/lib/extensions/rholang/{lang_pt_br.rb → rholang/lang_pt_br.rb} +0 -0
  57. data/lib/extensions/rholang/{lang_ru.rb → rholang/lang_ru.rb} +0 -0
  58. data/lib/extensions/rholang/{lang_se.rb → rholang/lang_se.rb} +0 -0
  59. data/lib/extensions/rholang/{lang_sr.rb → rholang/lang_sr.rb} +0 -0
  60. data/lib/extensions/rholang/{rhoerror_ru.rb → rholang/rhoerror_ru.rb} +0 -0
  61. data/lib/extensions/rholang/{rhomsg_ru.rb → rholang/rhomsg_ru.rb} +0 -0
  62. data/lib/framework/date/format.rb +2 -0
  63. data/lib/framework/dateOrig.rb +17 -8
  64. data/lib/framework/rational18.rb +532 -0
  65. data/lib/framework/res/back_btn.wp7.png +0 -0
  66. data/lib/framework/res/blue_pushpin.wp7.png +0 -0
  67. data/lib/framework/res/blue_pushpin_small.wp7.png +0 -0
  68. data/lib/framework/res/callout.wp7.png +0 -0
  69. data/lib/framework/res/callout_link.wp7.png +0 -0
  70. data/lib/framework/res/esri.wp7.png +0 -0
  71. data/lib/framework/res/forward_btn.wp7.png +0 -0
  72. data/lib/framework/res/home_btn.wp7.png +0 -0
  73. data/lib/framework/res/options_btn.wp7.png +0 -0
  74. data/lib/framework/res/refresh_btn.wp7.png +0 -0
  75. data/lib/framework/rho/render.rb +8 -1
  76. data/lib/framework/rho/rho.rb +30 -7
  77. data/lib/framework/rho/rhoapplication.rb +9 -4
  78. data/lib/framework/rho/rhofsconnector.rb +5 -1
  79. data/lib/framework/rho/rhotabbar.rb +8 -0
  80. data/lib/framework/rho/rhotoolbar.rb +1 -1
  81. data/lib/framework/rho/rhoviewhelpers.rb +18 -1
  82. data/lib/framework/rhodes.rb +1 -1
  83. data/lib/framework/rhoframework.rb +46 -1
  84. data/lib/framework/rholang/localization_simplified.rb +17 -16
  85. data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
  86. data/lib/framework/rhom/rhom_object_factory.rb +115 -12
  87. data/lib/framework/rhosystem.rb +135 -0
  88. data/lib/framework/version.rb +1 -1
  89. data/lib/rhodes.rb +1 -1
  90. data/lib/test/apps/rhoconfig.txt +23 -23
  91. data/platform/android/Rhodes/AndroidManifest.full.xml +101 -0
  92. data/platform/android/Rhodes/AndroidManifest.xml +10 -15
  93. data/platform/android/Rhodes/default.properties +11 -0
  94. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +59 -53
  95. data/platform/android/Rhodes/jni/include/rhodes.h +1 -0
  96. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +21 -0
  97. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_alert_PopupActivity.h +21 -0
  98. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +10 -2
  99. data/platform/android/Rhodes/jni/src/alert.cpp +2 -1
  100. data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -0
  101. data/platform/android/Rhodes/jni/src/fileapi.cpp +671 -84
  102. data/platform/android/Rhodes/jni/src/nativebar.cpp +18 -0
  103. data/platform/android/Rhodes/jni/src/rhodes.cpp +92 -1
  104. data/platform/android/Rhodes/res/values/styles.xml +7 -0
  105. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +35 -2
  106. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -13
  107. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +130 -0
  108. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +6 -0
  109. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +5 -1
  110. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +6 -2
  111. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +7 -36
  112. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +43 -20
  113. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +2 -0
  114. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +63 -28
  115. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +2 -2
  116. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +6 -2
  117. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +19 -282
  118. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +354 -0
  119. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +4 -0
  120. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -2
  121. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +71 -5
  122. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +107 -37
  123. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -7
  124. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +156 -56
  125. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
  126. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +40 -32
  127. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +1 -0
  128. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +14 -6
  129. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +46 -0
  130. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +4 -24
  131. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +3 -1
  132. data/platform/android/build/RhodesSRC_build.files +28 -25
  133. data/platform/android/build/android.rake +230 -54
  134. data/platform/android/build/androidcommon.rb +1 -1
  135. data/platform/android/build/librhocommon_build.files +1 -0
  136. data/platform/bb/Hsqldb/BlackBerry_App_Descriptor.xml +20 -0
  137. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +1 -5
  138. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
  139. data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBase.java +1 -1
  140. data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBinary.java +1 -1
  141. data/platform/bb/RubyVM/BlackBerry_App_Descriptor.xml +20 -0
  142. data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
  143. data/platform/bb/RubyVM/src/com/rho/RhoLogOutputSink.java +0 -1
  144. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +12 -10
  145. data/platform/bb/RubyVM/src/com/rho/RhoThread.java +16 -0
  146. data/platform/bb/RubyVM/src/com/rho/RhoTimer.java +89 -0
  147. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +20 -13
  148. data/platform/bb/RubyVM/src/com/rho/SplashScreen.java +1 -2
  149. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +2 -2
  150. data/platform/bb/RubyVM/src/com/rho/TimeInterval.java +5 -0
  151. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +54 -48
  152. data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +0 -1
  153. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -0
  154. data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
  155. data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
  156. data/platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java +1 -1
  157. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -8
  158. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
  159. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +52 -29
  160. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -3
  161. data/platform/bb/build/RubyVM_build.files +1 -0
  162. data/platform/bb/build/bb.rake +29 -9
  163. data/platform/bb/rhodes/BlackBerry_App_Descriptor.xml +23 -0
  164. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
  165. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +0 -4
  166. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +13 -20
  167. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +183 -157
  168. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +22 -0
  169. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
  170. data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +0 -4
  171. data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +13 -20
  172. data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +183 -157
  173. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +46 -1
  174. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +8 -1
  175. data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +13 -3
  176. data/platform/iphone/Classes/AppManager/AppManager.h +5 -1
  177. data/platform/iphone/Classes/AppManager/AppManager.m +170 -7
  178. data/platform/iphone/Classes/DateTimePicker.m +14 -1
  179. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  180. data/platform/iphone/Classes/DateTimePickerDelegate.m +36 -2
  181. data/platform/iphone/Classes/NativeBar.h +1 -0
  182. data/platform/iphone/Classes/NativeBar.m +15 -3
  183. data/platform/iphone/Classes/Phonebook/phonebook.m +8 -9
  184. data/platform/iphone/Classes/Rhodes.m +50 -6
  185. data/platform/iphone/Classes/SimpleMainView.m +7 -6
  186. data/platform/iphone/Classes/SplitView/RightViewController.h +3 -1
  187. data/platform/iphone/Classes/SplitView/RightViewController.m +14 -1
  188. data/platform/iphone/Classes/TabbedMainView.h +4 -0
  189. data/platform/iphone/Classes/TabbedMainView.m +43 -26
  190. data/platform/iphone/Info.plist +1 -1
  191. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  192. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +3 -3
  193. data/platform/iphone/rbuild/iphone.rake +168 -119
  194. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -2
  195. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +3 -3
  196. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +2 -2
  197. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +3 -3
  198. data/platform/shared/SyncClient/SyncClient.cpp +20 -8
  199. data/platform/shared/SyncClient/SyncClient.h +2 -1
  200. data/platform/shared/common/RhoDefs.h +4 -0
  201. data/platform/shared/common/RhoPort.h +22 -0
  202. data/platform/shared/common/RhoStd.h +5 -0
  203. data/platform/shared/common/RhoTime.cpp +73 -0
  204. data/platform/shared/common/RhoTime.h +26 -53
  205. data/platform/shared/common/RhodesApp.cpp +29 -28
  206. data/platform/shared/common/RhodesApp.h +4 -1
  207. data/platform/shared/common/StringConverter.h +37 -10
  208. data/platform/shared/common/app_build_capabilities.h +2 -0
  209. data/platform/shared/common/rhoparams.cpp +25 -12
  210. data/platform/shared/common/rhoparams.h +10 -8
  211. data/platform/shared/db/DBAdapter.cpp +0 -22
  212. data/platform/shared/json/RJSONTokener.c +15 -23
  213. data/platform/shared/net/AsyncHttp.cpp +9 -8
  214. data/platform/shared/net/HttpServer.cpp +61 -19
  215. data/platform/shared/net/HttpServer.h +2 -0
  216. data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +3 -0
  217. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +151 -402
  218. data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
  219. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +154 -403
  220. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  221. data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
  222. data/platform/shared/ruby/ext/system/system.i +8 -0
  223. data/platform/shared/ruby/ext/system/system_wrap.c +80 -5
  224. data/platform/shared/ruby/file.c +6 -4
  225. data/platform/shared/ruby/gc.c +1 -1
  226. data/platform/shared/ruby/linux/ruby/config.h +7 -2
  227. data/platform/shared/ruby/missing/acosh.c +3 -3
  228. data/platform/shared/ruby/wince/_time.h +1 -1
  229. data/platform/shared/ruby/wince/stdlib.c +1 -1
  230. data/platform/shared/ruby/wince/string_wce.c +2 -2
  231. data/platform/shared/ruby/wince/sys/timeb.c +1 -0
  232. data/platform/shared/ruby/wince/time_wce.c +8 -0
  233. data/platform/shared/ruby/wince/wince.c +7 -7
  234. data/platform/shared/ruby/wince/wince.h +22 -0
  235. data/platform/shared/rubyext/System.cpp +19 -1
  236. data/platform/shared/sqlite/sqlite3.c +18993 -8129
  237. data/platform/shared/sqlite/sqlite3.h +953 -358
  238. data/platform/shared/sqlite/sqlite3ext.h +42 -0
  239. data/platform/shared/sync/SyncEngine.cpp +10 -0
  240. data/platform/shared/sync/SyncSource.cpp +41 -19
  241. data/platform/shared/sync/SyncSource.h +1 -1
  242. data/platform/shared/tcmalloc/rhomem.h +7 -2
  243. data/platform/shared/tcmalloc/windows/port.h +2 -0
  244. data/platform/shared/unzip/unzip.cpp +1 -0
  245. data/platform/shared/xruby/src/com/xruby/compiler/parser/RubyParser.java +11 -1
  246. data/platform/wm/RhoLib/RhoLib.vcproj +182 -24
  247. data/platform/wm/build/wm.rake +16 -3
  248. data/platform/wm/rhodes.sln +106 -113
  249. data/platform/wm/rhodes/Alert.cpp +6 -7
  250. data/platform/wm/rhodes/AppManager.cpp +8 -17
  251. data/platform/wm/rhodes/DateTimePicker.cpp +3 -0
  252. data/platform/wm/rhodes/DateTimePicker.h +2 -0
  253. data/platform/wm/rhodes/MainWindow.cpp +36 -16
  254. data/platform/wm/rhodes/MainWindow.h +6 -3
  255. data/platform/wm/rhodes/OutlookApp.cpp +3 -3
  256. data/platform/wm/rhodes/Rhodes.cpp +46 -27
  257. data/platform/wm/rhodes/Rhodes.rc +16 -3
  258. data/platform/wm/rhodes/RingtoneManager.cpp +7 -7
  259. data/platform/wm/rhodes/RingtoneManager.h +1 -1
  260. data/platform/wm/rhodes/Utils.cpp +2 -1
  261. data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1 -13
  262. data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -2
  263. data/platform/wm/rhodes/camera/Camera.cpp +6 -12
  264. data/platform/wm/rhodes/phonebook/phonebook.cpp +11 -11
  265. data/platform/wm/rhodes/phonebook/phonebook.h +1 -1
  266. data/platform/wm/rhodes/resource.h +3 -1
  267. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +7 -5
  268. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +6 -6
  269. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
  270. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +6 -1
  271. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +84 -19
  272. data/platform/wm/rhodes/rho/rubyext/calendar.cpp +2 -2
  273. data/platform/wm/rhodes/rhodes.vcproj +316 -73
  274. data/platform/wm/rhodes/signature/Signature.cpp +336 -6
  275. data/platform/wm/rhodes/signature/Signature.h +55 -0
  276. data/platform/wm/rhodes/stdafx.h +7 -4
  277. data/platform/wm/rubylib/rubylib.vcproj +261 -91
  278. data/platform/wm/sqlite3/sqlite3.vcproj +223 -69
  279. data/platform/wm/syncengine/syncengine.vcproj +220 -66
  280. data/platform/wm/tcmalloc/tcmalloc.vcproj +197 -43
  281. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +107 -0
  282. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/Loader.cs +1037 -0
  283. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +1476 -0
  284. data/platform/wp7/RhoAppRunner/Program.cs +55 -0
  285. data/platform/wp7/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
  286. data/platform/wp7/RhoAppRunner/RhoAppRunner.csproj +69 -0
  287. data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +7 -0
  288. data/platform/wp7/RhoRubyExtGen/Properties/AssemblyInfo.cs +36 -0
  289. data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +38 -0
  290. data/platform/wp7/RhoRubyExtGen/RhoDatabase.cs +93 -0
  291. data/platform/wp7/RhoRubyExtGen/RhoJSON.cs +37 -0
  292. data/platform/wp7/RhoRubyExtGen/RhoNativeBar.cs +106 -0
  293. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +75 -0
  294. data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +123 -0
  295. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +42 -0
  296. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +309 -0
  297. data/platform/wp7/RhoRubyLib/Properties/AssemblyInfo.cs +36 -0
  298. data/platform/wp7/RhoRubyLib/RhoAppAdapter.cs +96 -0
  299. data/platform/wp7/RhoRubyLib/RhoRuby.cs +296 -0
  300. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +155 -0
  301. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +107 -0
  302. data/platform/wp7/RhoRubyLib/common/IInputStream.cs +21 -0
  303. data/platform/wp7/RhoRubyLib/common/Mutex.cs +30 -0
  304. data/platform/wp7/RhoRubyLib/common/RhoConf.cs +389 -0
  305. data/platform/wp7/RhoRubyLib/common/RhoEmptyProfiler.cs +27 -0
  306. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +332 -0
  307. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +89 -0
  308. data/platform/wp7/RhoRubyLib/common/RhoParamArray.cs +33 -0
  309. data/platform/wp7/RhoRubyLib/common/RhoParams.cs +66 -0
  310. data/platform/wp7/RhoRubyLib/common/RhoProfiler.cs +145 -0
  311. data/platform/wp7/RhoRubyLib/common/RhoResourceMap.cs +68 -0
  312. data/platform/wp7/RhoRubyLib/common/RhoStd.cs +205 -0
  313. data/platform/wp7/RhoRubyLib/common/RhoThread.cs +114 -0
  314. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +504 -0
  315. data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +199 -0
  316. data/platform/wp7/RhoRubyLib/common/TimeInterval.cs +56 -0
  317. data/platform/wp7/RhoRubyLib/common/Tokenizer.cs +52 -0
  318. data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +1129 -0
  319. data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +92 -0
  320. data/platform/wp7/RhoRubyLib/db/DBException.cs +35 -0
  321. data/platform/wp7/RhoRubyLib/db/IDBCallback.cs +10 -0
  322. data/platform/wp7/RhoRubyLib/db/IDBResult.cs +33 -0
  323. data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +32 -0
  324. data/platform/wp7/RhoRubyLib/db/SqliteCopyResult.cs +79 -0
  325. data/platform/wp7/RhoRubyLib/db/SqliteResult.cs +267 -0
  326. data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +319 -0
  327. data/platform/wp7/RhoRubyLib/json/JSONArrayIterator.cs +63 -0
  328. data/platform/wp7/RhoRubyLib/json/JSONEntry.cs +96 -0
  329. data/platform/wp7/RhoRubyLib/json/JSONStructIterator.cs +77 -0
  330. data/platform/wp7/RhoRubyLib/json/JsonParser.cs +483 -0
  331. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +406 -0
  332. data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +12 -0
  333. data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +161 -0
  334. data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +174 -0
  335. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +320 -0
  336. data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +362 -0
  337. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +466 -0
  338. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +717 -0
  339. data/platform/wp7/RhoRubyLib/net/NetResponse.cs +64 -0
  340. data/platform/wp7/RhoRubyLib/net/URI.cs +187 -0
  341. data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +43 -0
  342. data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +177 -0
  343. data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +39 -0
  344. data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +19 -0
  345. data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +117 -0
  346. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +199 -0
  347. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +49 -0
  348. data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +142 -0
  349. data/platform/wp7/RhoRubyLib/sync/ISyncProtocol.cs +23 -0
  350. data/platform/wp7/RhoRubyLib/sync/ISyncStatusListener.cs +10 -0
  351. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +1051 -0
  352. data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +651 -0
  353. data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +79 -0
  354. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +1105 -0
  355. data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +301 -0
  356. data/platform/wp7/WPApplication.sln +50 -0
  357. data/platform/wp7/WPApplication/App.xaml +19 -0
  358. data/platform/wp7/WPApplication/App.xaml.cs +211 -0
  359. data/platform/wp7/WPApplication/ApplicationIcon.png +0 -0
  360. data/platform/wp7/WPApplication/Background.png +0 -0
  361. data/platform/wp7/WPApplication/MainPage.xaml +44 -0
  362. data/platform/wp7/WPApplication/MainPage.xaml.cs +132 -0
  363. data/platform/wp7/WPApplication/Properties/AppManifest.xml +6 -0
  364. data/platform/wp7/WPApplication/Properties/AssemblyInfo.cs +35 -0
  365. data/platform/wp7/WPApplication/Properties/WMAppManifest.xml +32 -0
  366. data/platform/wp7/WPApplication/SplashScreenImage.jpg +0 -0
  367. data/platform/wp7/WPApplication/WPApplication.csproj +201 -0
  368. data/platform/wp7/WPApplication/WP_PlatformAdaptationLayer.cs +88 -0
  369. data/platform/wp7/WPApplication/app_manifest.txt +1 -0
  370. data/platform/wp7/WPApplication/readme.htm +40 -0
  371. data/platform/wp7/WPApplication/readme2.htm +37 -0
  372. data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.bb.erb +29 -0
  373. data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.erb +32 -0
  374. data/platform/wp7/WPApplication/rho/apps/app/Model1/index.bb.erb +21 -0
  375. data/platform/wp7/WPApplication/rho/apps/app/Model1/index.erb +26 -0
  376. data/platform/wp7/WPApplication/rho/apps/app/Model1/model1.rb +10 -0
  377. data/platform/wp7/WPApplication/rho/apps/app/Model1/model1_controller.rb +58 -0
  378. data/platform/wp7/WPApplication/rho/apps/app/Model1/new.bb.erb +29 -0
  379. data/platform/wp7/WPApplication/rho/apps/app/Model1/new.erb +31 -0
  380. data/platform/wp7/WPApplication/rho/apps/app/Model1/show.bb.erb +26 -0
  381. data/platform/wp7/WPApplication/rho/apps/app/Model1/show.erb +28 -0
  382. data/platform/wp7/WPApplication/rho/apps/app/Settings/controller.rb +75 -0
  383. data/platform/wp7/WPApplication/rho/apps/app/Settings/home.bb.erb +17 -0
  384. data/platform/wp7/WPApplication/rho/apps/app/Settings/home.erb +20 -0
  385. data/platform/wp7/WPApplication/rho/apps/app/Settings/index.bb.erb +32 -0
  386. data/platform/wp7/WPApplication/rho/apps/app/Settings/index.erb +30 -0
  387. data/platform/wp7/WPApplication/rho/apps/app/Settings/login.bb.erb +35 -0
  388. data/platform/wp7/WPApplication/rho/apps/app/Settings/login.erb +27 -0
  389. data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.bb.erb +15 -0
  390. data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.erb +17 -0
  391. data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.bb.erb +3 -0
  392. data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.erb +5 -0
  393. data/platform/wp7/WPApplication/rho/apps/app/application.rb +16 -0
  394. data/platform/wp7/WPApplication/rho/apps/app/helpers/application_helper.rb +126 -0
  395. data/platform/wp7/WPApplication/rho/apps/app/helpers/browser_helper.rb +18 -0
  396. data/platform/wp7/WPApplication/rho/apps/app/index.bb.erb +26 -0
  397. data/platform/wp7/WPApplication/rho/apps/app/index.erb +26 -0
  398. data/platform/wp7/WPApplication/rho/apps/app/layout.erb +45 -0
  399. data/platform/wp7/WPApplication/rho/apps/app/loading.html +11 -0
  400. data/platform/wp7/WPApplication/rho/apps/app_manifest.txt +1 -0
  401. data/platform/wp7/WPApplication/rho/apps/public/css/android.css +330 -0
  402. data/platform/wp7/WPApplication/rho/apps/public/css/blackberry.css +115 -0
  403. data/platform/wp7/WPApplication/rho/apps/public/css/iphone.css +410 -0
  404. data/platform/wp7/WPApplication/rho/apps/public/css/windows_mobile.css +222 -0
  405. data/platform/wp7/WPApplication/rho/apps/public/images/IUI_LICENSE.txt +21 -0
  406. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_off.png +0 -0
  407. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_on.png +0 -0
  408. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_off.png +0 -0
  409. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_on.png +0 -0
  410. data/platform/wp7/WPApplication/rho/apps/public/images/android/disclosure.png +0 -0
  411. data/platform/wp7/WPApplication/rho/apps/public/images/android/ic_menu_more.png +0 -0
  412. data/platform/wp7/WPApplication/rho/apps/public/images/backButton.png +0 -0
  413. data/platform/wp7/WPApplication/rho/apps/public/images/blueButton.png +0 -0
  414. data/platform/wp7/WPApplication/rho/apps/public/images/cancel.png +0 -0
  415. data/platform/wp7/WPApplication/rho/apps/public/images/grayButton.png +0 -0
  416. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure.png +0 -0
  417. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure_detail.png +0 -0
  418. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/backButton.png +0 -0
  419. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/blueButton.png +0 -0
  420. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/cancel.png +0 -0
  421. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/chevron.png +0 -0
  422. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/grayButton.png +0 -0
  423. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listArrowSel.png +0 -0
  424. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listGroup.png +0 -0
  425. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/loading.gif +0 -0
  426. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/on_off.png +0 -0
  427. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/pinstripes.png +0 -0
  428. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/selection.png +0 -0
  429. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/thumb.png +0 -0
  430. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggle.png +0 -0
  431. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggleOn.png +0 -0
  432. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolButton.png +0 -0
  433. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolbar.png +0 -0
  434. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/whiteButton.png +0 -0
  435. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/radiobutton.png +0 -0
  436. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/select.png +0 -0
  437. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/switch.png +0 -0
  438. data/platform/wp7/WPApplication/rho/apps/public/images/iui-logo-touch-icon.png +0 -0
  439. data/platform/wp7/WPApplication/rho/apps/public/images/listArrow.png +0 -0
  440. data/platform/wp7/WPApplication/rho/apps/public/images/listArrowDown.png +0 -0
  441. data/platform/wp7/WPApplication/rho/apps/public/images/listArrowSel.png +0 -0
  442. data/platform/wp7/WPApplication/rho/apps/public/images/listGroup.png +0 -0
  443. data/platform/wp7/WPApplication/rho/apps/public/images/loading.gif +0 -0
  444. data/platform/wp7/WPApplication/rho/apps/public/images/pinstripes.png +0 -0
  445. data/platform/wp7/WPApplication/rho/apps/public/images/right_button.png +0 -0
  446. data/platform/wp7/WPApplication/rho/apps/public/images/selection.png +0 -0
  447. data/platform/wp7/WPApplication/rho/apps/public/images/thumb.png +0 -0
  448. data/platform/wp7/WPApplication/rho/apps/public/images/toggle.png +0 -0
  449. data/platform/wp7/WPApplication/rho/apps/public/images/toggleOn.png +0 -0
  450. data/platform/wp7/WPApplication/rho/apps/public/images/toolButton.png +0 -0
  451. data/platform/wp7/WPApplication/rho/apps/public/images/toolButton_new.png +0 -0
  452. data/platform/wp7/WPApplication/rho/apps/public/images/toolbar.png +0 -0
  453. data/platform/wp7/WPApplication/rho/apps/public/images/whiteButton.png +0 -0
  454. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch-iphone.css +9 -0
  455. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.css +374 -0
  456. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.js +742 -0
  457. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.transitions.js +60 -0
  458. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jquery.1.3.2.min.js +19 -0
  459. data/platform/wp7/WPApplication/rho/apps/public/js/application.js +1 -0
  460. data/platform/wp7/WPApplication/rho/apps/public/js/rho.js +4 -0
  461. data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation-wm.js +59 -0
  462. data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation.js +11 -0
  463. data/platform/wp7/WPApplication/rho/apps/rhoconfig.txt +32 -0
  464. data/platform/wp7/WPApplication/rhoconfig.txt +32 -0
  465. data/platform/wp7/WPApplication/windows_mobile.css +222 -0
  466. data/platform/wp7/build/wp.rake +261 -0
  467. data/platform/wp7/rhodes.sln +79 -0
  468. data/platform/wp7/rhodes/App.xaml +19 -0
  469. data/platform/wp7/rhodes/App.xaml.cs +144 -0
  470. data/platform/wp7/rhodes/Background.png +0 -0
  471. data/platform/wp7/rhodes/MainPage.xaml +44 -0
  472. data/platform/wp7/rhodes/MainPage.xaml.cs +98 -0
  473. data/platform/wp7/rhodes/Properties/AppManifest.xml +6 -0
  474. data/platform/wp7/rhodes/Properties/AssemblyInfo.cs +35 -0
  475. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +31 -0
  476. data/platform/wp7/rhodes/Rhodes.csproj +127 -0
  477. data/platform/wp7/rhodes/SplashScreenImage.jpg +0 -0
  478. data/platform/wp7/rhodes/icon.png +0 -0
  479. data/platform/wp7/sqlite3/Properties/AssemblyInfo.cs +35 -0
  480. data/platform/wp7/sqlite3/SQLiteClient.cs +550 -0
  481. data/platform/wp7/sqlite3/SqliteWrapper/BtreeInt_h.cs +774 -0
  482. data/platform/wp7/sqlite3/SqliteWrapper/Btree_h.cs +280 -0
  483. data/platform/wp7/sqlite3/SqliteWrapper/ClassDiagram1.cd +1306 -0
  484. data/platform/wp7/sqlite3/SqliteWrapper/Delagates.cs +365 -0
  485. data/platform/wp7/sqlite3/SqliteWrapper/Hash_h.cs +133 -0
  486. data/platform/wp7/sqlite3/SqliteWrapper/VdbeInt_h.cs +620 -0
  487. data/platform/wp7/sqlite3/SqliteWrapper/Vdbe_h.cs +302 -0
  488. data/platform/wp7/sqlite3/SqliteWrapper/_Custom.cs +449 -0
  489. data/platform/wp7/sqlite3/SqliteWrapper/alter_c.cs +872 -0
  490. data/platform/wp7/sqlite3/SqliteWrapper/analyze_c.cs +757 -0
  491. data/platform/wp7/sqlite3/SqliteWrapper/attach_c.cs +628 -0
  492. data/platform/wp7/sqlite3/SqliteWrapper/auth_c.cs +268 -0
  493. data/platform/wp7/sqlite3/SqliteWrapper/backup_c.cs +737 -0
  494. data/platform/wp7/sqlite3/SqliteWrapper/bitvec_c.cs +509 -0
  495. data/platform/wp7/sqlite3/SqliteWrapper/btmutex_c.cs +379 -0
  496. data/platform/wp7/sqlite3/SqliteWrapper/btree_c.cs +9138 -0
  497. data/platform/wp7/sqlite3/SqliteWrapper/build_c.cs +4189 -0
  498. data/platform/wp7/sqlite3/SqliteWrapper/callback_c.cs +548 -0
  499. data/platform/wp7/sqlite3/SqliteWrapper/complete_c.cs +342 -0
  500. data/platform/wp7/sqlite3/SqliteWrapper/ctime_cs.cs +408 -0
  501. data/platform/wp7/sqlite3/SqliteWrapper/date_c.cs +1317 -0
  502. data/platform/wp7/sqlite3/SqliteWrapper/delete_c.cs +726 -0
  503. data/platform/wp7/sqlite3/SqliteWrapper/expr_c.cs +4406 -0
  504. data/platform/wp7/sqlite3/SqliteWrapper/fault_c.cs +115 -0
  505. data/platform/wp7/sqlite3/SqliteWrapper/fkey_c.cs +1330 -0
  506. data/platform/wp7/sqlite3/SqliteWrapper/func_c.cs +2025 -0
  507. data/platform/wp7/sqlite3/SqliteWrapper/global_c.cs +228 -0
  508. data/platform/wp7/sqlite3/SqliteWrapper/hash_c.cs +351 -0
  509. data/platform/wp7/sqlite3/SqliteWrapper/hwtime_c.cs +101 -0
  510. data/platform/wp7/sqlite3/SqliteWrapper/insert_c.cs +2122 -0
  511. data/platform/wp7/sqlite3/SqliteWrapper/journal_c.cs +247 -0
  512. data/platform/wp7/sqlite3/SqliteWrapper/keywordhash_h.cs +302 -0
  513. data/platform/wp7/sqlite3/SqliteWrapper/legacy_c.cs +223 -0
  514. data/platform/wp7/sqlite3/SqliteWrapper/loadext_c.cs +683 -0
  515. data/platform/wp7/sqlite3/SqliteWrapper/main_c.cs +2716 -0
  516. data/platform/wp7/sqlite3/SqliteWrapper/malloc_c.cs +977 -0
  517. data/platform/wp7/sqlite3/SqliteWrapper/mem_Pool.cs +394 -0
  518. data/platform/wp7/sqlite3/SqliteWrapper/memjournal_c.cs +315 -0
  519. data/platform/wp7/sqlite3/SqliteWrapper/mutex_c.cs +182 -0
  520. data/platform/wp7/sqlite3/SqliteWrapper/mutex_h.cs +91 -0
  521. data/platform/wp7/sqlite3/SqliteWrapper/mutex_noop_c.cs +202 -0
  522. data/platform/wp7/sqlite3/SqliteWrapper/mutex_w32.cs +344 -0
  523. data/platform/wp7/sqlite3/SqliteWrapper/notify_c.cs +347 -0
  524. data/platform/wp7/sqlite3/SqliteWrapper/opcodes_c.cs +171 -0
  525. data/platform/wp7/sqlite3/SqliteWrapper/opcodes_h.cs +346 -0
  526. data/platform/wp7/sqlite3/SqliteWrapper/os_c.cs +367 -0
  527. data/platform/wp7/sqlite3/SqliteWrapper/os_common_h.cs +174 -0
  528. data/platform/wp7/sqlite3/SqliteWrapper/os_h.cs +295 -0
  529. data/platform/wp7/sqlite3/SqliteWrapper/os_win_c.cs +1255 -0
  530. data/platform/wp7/sqlite3/SqliteWrapper/pager_c.cs +6078 -0
  531. data/platform/wp7/sqlite3/SqliteWrapper/pager_h.cs +188 -0
  532. data/platform/wp7/sqlite3/SqliteWrapper/parse_c.cs +4045 -0
  533. data/platform/wp7/sqlite3/SqliteWrapper/parse_h.cs +331 -0
  534. data/platform/wp7/sqlite3/SqliteWrapper/pcache1_c.cs +969 -0
  535. data/platform/wp7/sqlite3/SqliteWrapper/pcache_c.cs +712 -0
  536. data/platform/wp7/sqlite3/SqliteWrapper/pcache_h.cs +213 -0
  537. data/platform/wp7/sqlite3/SqliteWrapper/pragma_c.cs +1767 -0
  538. data/platform/wp7/sqlite3/SqliteWrapper/prepare_c.cs +1015 -0
  539. data/platform/wp7/sqlite3/SqliteWrapper/printf_c.cs +1300 -0
  540. data/platform/wp7/sqlite3/SqliteWrapper/random_c.cs +201 -0
  541. data/platform/wp7/sqlite3/SqliteWrapper/resolve_c.cs +1396 -0
  542. data/platform/wp7/sqlite3/SqliteWrapper/rowset_c.cs +519 -0
  543. data/platform/wp7/sqlite3/SqliteWrapper/select_c.cs +4878 -0
  544. data/platform/wp7/sqlite3/SqliteWrapper/sqlite3_h.cs +6253 -0
  545. data/platform/wp7/sqlite3/SqliteWrapper/sqlite3ext_h.cs +397 -0
  546. data/platform/wp7/sqlite3/SqliteWrapper/sqliteInt_h.cs +4075 -0
  547. data/platform/wp7/sqlite3/SqliteWrapper/sqliteLimit_h.cs +214 -0
  548. data/platform/wp7/sqlite3/SqliteWrapper/sqliteicu_h.cs +39 -0
  549. data/platform/wp7/sqlite3/SqliteWrapper/status_c.cs +155 -0
  550. data/platform/wp7/sqlite3/SqliteWrapper/table_c.cs +222 -0
  551. data/platform/wp7/sqlite3/SqliteWrapper/tokenize_c.cs +673 -0
  552. data/platform/wp7/sqlite3/SqliteWrapper/trigger_c.cs +1219 -0
  553. data/platform/wp7/sqlite3/SqliteWrapper/update_c.cs +766 -0
  554. data/platform/wp7/sqlite3/SqliteWrapper/utf_c.cs +612 -0
  555. data/platform/wp7/sqlite3/SqliteWrapper/util_c.cs +1476 -0
  556. data/platform/wp7/sqlite3/SqliteWrapper/vacuum_c.cs +382 -0
  557. data/platform/wp7/sqlite3/SqliteWrapper/vdbe_c.cs +6566 -0
  558. data/platform/wp7/sqlite3/SqliteWrapper/vdbeapi_c.cs +1557 -0
  559. data/platform/wp7/sqlite3/SqliteWrapper/vdbeaux_c.cs +4019 -0
  560. data/platform/wp7/sqlite3/SqliteWrapper/vdbeblob_c.cs +396 -0
  561. data/platform/wp7/sqlite3/SqliteWrapper/vdbemem_c.cs +1480 -0
  562. data/platform/wp7/sqlite3/SqliteWrapper/vdbetrace_c.cs +181 -0
  563. data/platform/wp7/sqlite3/SqliteWrapper/vtab_c.cs +957 -0
  564. data/platform/wp7/sqlite3/SqliteWrapper/walker_c.cs +174 -0
  565. data/platform/wp7/sqlite3/SqliteWrapper/where_c.cs +4651 -0
  566. data/platform/wp7/sqlite3/sqlite3.csproj +155 -0
  567. data/rakefile.rb +60 -2
  568. data/res/build-tools/7za.exe +0 -0
  569. data/res/build-tools/RhoAppRunner.exe +0 -0
  570. data/res/build-tools/xruby-0.3.3.jar +0 -0
  571. data/res/generators/rhogen.rb +9 -1
  572. data/res/generators/templates/application/app/Settings/reset.erb +1 -1
  573. data/res/generators/templates/application/app/layout.erb +17 -10
  574. data/res/generators/templates/application/build.yml +5 -3
  575. data/res/generators/templates/application/public/jqtouch/changes.txt +20 -0
  576. data/res/generators/templates/application/public/jqtouch/jqtouch.js +12 -4
  577. data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
  578. data/res/generators/templates/application/public/js/wp7.js +7 -0
  579. data/res/generators/templates/model/controller.rb +5 -6
  580. data/rhobuild.yml.example +1 -0
  581. data/rhodes.gemspec +2 -1
  582. data/spec/framework_spec/app/spec/core/dir/close_spec.rb +1 -1
  583. data/spec/framework_spec/app/spec/core/dir/shared/pwd.rb +13 -11
  584. data/spec/framework_spec/app/spec/core/env/shared/store.rb +12 -10
  585. data/spec/framework_spec/app/spec/core/env/update_spec.rb +1 -0
  586. data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +3 -2
  587. data/spec/framework_spec/app/spec/core/file/fixtures/file_types.rb +7 -1
  588. data/spec/framework_spec/app/spec/core/file/flock_spec.rb +8 -1
  589. data/spec/framework_spec/app/spec/core/file/ftype_spec.rb +5 -3
  590. data/spec/framework_spec/app/spec/core/file/lchmod_spec.rb +1 -1
  591. data/spec/framework_spec/app/spec/core/file/setgid_spec.rb +1 -1
  592. data/spec/framework_spec/app/spec/core/file/setuid_spec.rb +1 -1
  593. data/spec/framework_spec/app/spec/core/file/stat/ftype_spec.rb +6 -4
  594. data/spec/framework_spec/app/spec/core/file/truncate_spec.rb +5 -1
  595. data/spec/framework_spec/app/spec/core/float/to_s_spec.rb +1 -1
  596. data/spec/framework_spec/app/spec/core/process/gid_spec.rb +5 -3
  597. data/spec/framework_spec/app/spec/core/process/groups_spec.rb +11 -9
  598. data/spec/framework_spec/app/spec/core/process/uid_spec.rb +5 -3
  599. data/spec/framework_spec/app/spec/language/execution_spec.rb +10 -6
  600. data/spec/framework_spec/app/spec/shared/file/directory.rb +6 -1
  601. data/spec/framework_spec/app/spec/shared/file/executable.rb +7 -1
  602. data/spec/framework_spec/app/spec/shared/file/file.rb +6 -1
  603. data/spec/framework_spec/app/spec/shared/file/readable.rb +13 -4
  604. data/spec/framework_spec/app/spec/shared/file/writable.rb +6 -1
  605. data/spec/phone_spec/app/spec/rho_controller_spec.rb +11 -0
  606. data/spec/phone_spec/app/spec/rho_spec.rb +11 -0
  607. data/spec/phone_spec/app/spec/rhom_object_spec.rb +102 -6
  608. data/spec/phone_spec/app/spec/string/end_with_spec.rb +4 -1
  609. data/spec/phone_spec/app/spec/string/slice_spec.rb +5 -1
  610. data/spec/phone_spec/app/spec/string/start_with_spec.rb +4 -0
  611. data/spec/phone_spec/app/spec/syncengine_spec.rb +73 -6
  612. data/spec/phone_spec/app/spec_runner.rb +7 -3
  613. metadata +380 -41
  614. data/Manifest.txt +0 -5819
  615. data/platform/bb/Hsqldb/Hsqldb.cso +0 -5
  616. data/platform/bb/Hsqldb/Hsqldb.jdp +0 -197
  617. data/platform/bb/RhoBundle/RhoBundle.cso +0 -5
  618. data/platform/bb/RhoBundle/RhoBundle.jdp +0 -42
  619. data/platform/bb/RubyVM/RubyVM.cso +0 -5
  620. data/platform/bb/RubyVM/RubyVM.jdp +0 -467
  621. data/platform/bb/rhodes/rhodes.csl +0 -3
  622. data/platform/bb/rhodes/rhodes.cso +0 -5
  623. data/platform/bb/rhodes/rhodes.jdp +0 -104
@@ -0,0 +1,774 @@
1
+ using System;
2
+ using System.Diagnostics;
3
+
4
+ using i16 = System.Int16;
5
+ using i64 = System.Int64;
6
+ using u8 = System.Byte;
7
+ using u16 = System.UInt16;
8
+ using u32 = System.UInt32;
9
+ using u64 = System.UInt64;
10
+
11
+ using sqlite3_int64 = System.Int64;
12
+ using Pgno = System.UInt32;
13
+
14
+ namespace Community.CsharpSqlite
15
+ {
16
+ using DbPage = Sqlite3.PgHdr;
17
+
18
+ public partial class Sqlite3
19
+ {
20
+ /*
21
+ ** 2004 April 6
22
+ **
23
+ ** The author disclaims copyright to this source code. In place of
24
+ ** a legal notice, here is a blessing:
25
+ **
26
+ ** May you do good and not evil.
27
+ ** May you find forgiveness for yourself and forgive others.
28
+ ** May you share freely, never taking more than you give.
29
+ **
30
+ *************************************************************************
31
+ **
32
+ ** This file implements a external (disk-based) database using BTrees.
33
+ ** For a detailed discussion of BTrees, refer to
34
+ **
35
+ ** Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
36
+ ** "Sorting And Searching", pages 473-480. Addison-Wesley
37
+ ** Publishing Company, Reading, Massachusetts.
38
+ **
39
+ ** The basic idea is that each page of the file contains N database
40
+ ** entries and N+1 pointers to subpages.
41
+ **
42
+ ** ----------------------------------------------------------------
43
+ ** | Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
44
+ ** ----------------------------------------------------------------
45
+ **
46
+ ** All of the keys on the page that Ptr(0) points to have values less
47
+ ** than Key(0). All of the keys on page Ptr(1) and its subpages have
48
+ ** values greater than Key(0) and less than Key(1). All of the keys
49
+ ** on Ptr(N) and its subpages have values greater than Key(N-1). And
50
+ ** so forth.
51
+ **
52
+ ** Finding a particular key requires reading O(log(M)) pages from the
53
+ ** disk where M is the number of entries in the tree.
54
+ **
55
+ ** In this implementation, a single file can hold one or more separate
56
+ ** BTrees. Each BTree is identified by the index of its root page. The
57
+ ** key and data for any entry are combined to form the "payload". A
58
+ ** fixed amount of payload can be carried directly on the database
59
+ ** page. If the payload is larger than the preset amount then surplus
60
+ ** bytes are stored on overflow pages. The payload for an entry
61
+ ** and the preceding pointer are combined to form a "Cell". Each
62
+ ** page has a small header which contains the Ptr(N) pointer and other
63
+ ** information such as the size of key and data.
64
+ **
65
+ ** FORMAT DETAILS
66
+ **
67
+ ** The file is divided into pages. The first page is called page 1,
68
+ ** the second is page 2, and so forth. A page number of zero indicates
69
+ ** "no such page". The page size can be any power of 2 between 512 and 32768.
70
+ ** Each page can be either a btree page, a freelist page, an overflow
71
+ ** page, or a pointer-map page.
72
+ **
73
+ ** The first page is always a btree page. The first 100 bytes of the first
74
+ ** page contain a special header (the "file header") that describes the file.
75
+ ** The format of the file header is as follows:
76
+ **
77
+ ** OFFSET SIZE DESCRIPTION
78
+ ** 0 16 Header string: "SQLite format 3\000"
79
+ ** 16 2 Page size in bytes.
80
+ ** 18 1 File format write version
81
+ ** 19 1 File format read version
82
+ ** 20 1 Bytes of unused space at the end of each page
83
+ ** 21 1 Max embedded payload fraction
84
+ ** 22 1 Min embedded payload fraction
85
+ ** 23 1 Min leaf payload fraction
86
+ ** 24 4 File change counter
87
+ ** 28 4 Reserved for future use
88
+ ** 32 4 First freelist page
89
+ ** 36 4 Number of freelist pages in the file
90
+ ** 40 60 15 4-byte meta values passed to higher layers
91
+ **
92
+ ** 40 4 Schema cookie
93
+ ** 44 4 File format of schema layer
94
+ ** 48 4 Size of page cache
95
+ ** 52 4 Largest root-page (auto/incr_vacuum)
96
+ ** 56 4 1=UTF-8 2=UTF16le 3=UTF16be
97
+ ** 60 4 User version
98
+ ** 64 4 Incremental vacuum mode
99
+ ** 68 4 unused
100
+ ** 72 4 unused
101
+ ** 76 4 unused
102
+ **
103
+ ** All of the integer values are big-endian (most significant byte first).
104
+ **
105
+ ** The file change counter is incremented when the database is changed
106
+ ** This counter allows other processes to know when the file has changed
107
+ ** and thus when they need to flush their cache.
108
+ **
109
+ ** The max embedded payload fraction is the amount of the total usable
110
+ ** space in a page that can be consumed by a single cell for standard
111
+ ** B-tree (non-LEAFDATA) tables. A value of 255 means 100%. The default
112
+ ** is to limit the maximum cell size so that at least 4 cells will fit
113
+ ** on one page. Thus the default max embedded payload fraction is 64.
114
+ **
115
+ ** If the payload for a cell is larger than the max payload, then extra
116
+ ** payload is spilled to overflow pages. Once an overflow page is allocated,
117
+ ** as many bytes as possible are moved into the overflow pages without letting
118
+ ** the cell size drop below the min embedded payload fraction.
119
+ **
120
+ ** The min leaf payload fraction is like the min embedded payload fraction
121
+ ** except that it applies to leaf nodes in a LEAFDATA tree. The maximum
122
+ ** payload fraction for a LEAFDATA tree is always 100% (or 255) and it
123
+ ** not specified in the header.
124
+ **
125
+ ** Each btree pages is divided into three sections: The header, the
126
+ ** cell pointer array, and the cell content area. Page 1 also has a 100-byte
127
+ ** file header that occurs before the page header.
128
+ **
129
+ ** |----------------|
130
+ ** | file header | 100 bytes. Page 1 only.
131
+ ** |----------------|
132
+ ** | page header | 8 bytes for leaves. 12 bytes for interior nodes
133
+ ** |----------------|
134
+ ** | cell pointer | | 2 bytes per cell. Sorted order.
135
+ ** | array | | Grows downward
136
+ ** | | v
137
+ ** |----------------|
138
+ ** | unallocated |
139
+ ** | space |
140
+ ** |----------------| ^ Grows upwards
141
+ ** | cell content | | Arbitrary order interspersed with freeblocks.
142
+ ** | area | | and free space fragments.
143
+ ** |----------------|
144
+ **
145
+ ** The page headers looks like this:
146
+ **
147
+ ** OFFSET SIZE DESCRIPTION
148
+ ** 0 1 Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
149
+ ** 1 2 byte offset to the first freeblock
150
+ ** 3 2 number of cells on this page
151
+ ** 5 2 first byte of the cell content area
152
+ ** 7 1 number of fragmented free bytes
153
+ ** 8 4 Right child (the Ptr(N) value). Omitted on leaves.
154
+ **
155
+ ** The flags define the format of this btree page. The leaf flag means that
156
+ ** this page has no children. The zerodata flag means that this page carries
157
+ ** only keys and no data. The intkey flag means that the key is a integer
158
+ ** which is stored in the key size entry of the cell header rather than in
159
+ ** the payload area.
160
+ **
161
+ ** The cell pointer array begins on the first byte after the page header.
162
+ ** The cell pointer array contains zero or more 2-byte numbers which are
163
+ ** offsets from the beginning of the page to the cell content in the cell
164
+ ** content area. The cell pointers occur in sorted order. The system strives
165
+ ** to keep free space after the last cell pointer so that new cells can
166
+ ** be easily added without having to defragment the page.
167
+ **
168
+ ** Cell content is stored at the very end of the page and grows toward the
169
+ ** beginning of the page.
170
+ **
171
+ ** Unused space within the cell content area is collected into a linked list of
172
+ ** freeblocks. Each freeblock is at least 4 bytes in size. The byte offset
173
+ ** to the first freeblock is given in the header. Freeblocks occur in
174
+ ** increasing order. Because a freeblock must be at least 4 bytes in size,
175
+ ** any group of 3 or fewer unused bytes in the cell content area cannot
176
+ ** exist on the freeblock chain. A group of 3 or fewer free bytes is called
177
+ ** a fragment. The total number of bytes in all fragments is recorded.
178
+ ** in the page header at offset 7.
179
+ **
180
+ ** SIZE DESCRIPTION
181
+ ** 2 Byte offset of the next freeblock
182
+ ** 2 Bytes in this freeblock
183
+ **
184
+ ** Cells are of variable length. Cells are stored in the cell content area at
185
+ ** the end of the page. Pointers to the cells are in the cell pointer array
186
+ ** that immediately follows the page header. Cells is not necessarily
187
+ ** contiguous or in order, but cell pointers are contiguous and in order.
188
+ **
189
+ ** Cell content makes use of variable length integers. A variable
190
+ ** length integer is 1 to 9 bytes where the lower 7 bits of each
191
+ ** byte are used. The integer consists of all bytes that have bit 8 set and
192
+ ** the first byte with bit 8 clear. The most significant byte of the integer
193
+ ** appears first. A variable-length integer may not be more than 9 bytes long.
194
+ ** As a special case, all 8 bytes of the 9th byte are used as data. This
195
+ ** allows a 64-bit integer to be encoded in 9 bytes.
196
+ **
197
+ ** 0x00 becomes 0x00000000
198
+ ** 0x7f becomes 0x0000007f
199
+ ** 0x81 0x00 becomes 0x00000080
200
+ ** 0x82 0x00 becomes 0x00000100
201
+ ** 0x80 0x7f becomes 0x0000007f
202
+ ** 0x8a 0x91 0xd1 0xac 0x78 becomes 0x12345678
203
+ ** 0x81 0x81 0x81 0x81 0x01 becomes 0x10204081
204
+ **
205
+ ** Variable length integers are used for rowids and to hold the number of
206
+ ** bytes of key and data in a btree cell.
207
+ **
208
+ ** The content of a cell looks like this:
209
+ **
210
+ ** SIZE DESCRIPTION
211
+ ** 4 Page number of the left child. Omitted if leaf flag is set.
212
+ ** var Number of bytes of data. Omitted if the zerodata flag is set.
213
+ ** var Number of bytes of key. Or the key itself if intkey flag is set.
214
+ ** * Payload
215
+ ** 4 First page of the overflow chain. Omitted if no overflow
216
+ **
217
+ ** Overflow pages form a linked list. Each page except the last is completely
218
+ ** filled with data (pagesize - 4 bytes). The last page can have as little
219
+ ** as 1 byte of data.
220
+ **
221
+ ** SIZE DESCRIPTION
222
+ ** 4 Page number of next overflow page
223
+ ** * Data
224
+ **
225
+ ** Freelist pages come in two subtypes: trunk pages and leaf pages. The
226
+ ** file header points to the first in a linked list of trunk page. Each trunk
227
+ ** page points to multiple leaf pages. The content of a leaf page is
228
+ ** unspecified. A trunk page looks like this:
229
+ **
230
+ ** SIZE DESCRIPTION
231
+ ** 4 Page number of next trunk page
232
+ ** 4 Number of leaf pointers on this page
233
+ ** * zero or more pages numbers of leaves
234
+ *************************************************************************
235
+ ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
236
+ ** C#-SQLite is an independent reimplementation of the SQLite software library
237
+ **
238
+ ** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
239
+ **
240
+ ** $Header$
241
+ *************************************************************************
242
+ */
243
+ //#include "sqliteInt.h"
244
+
245
+ /* The following value is the maximum cell size assuming a maximum page
246
+ ** size give above.
247
+ */
248
+ //#define MX_CELL_SIZE(pBt) (pBt.pageSize-8)
249
+ static int MX_CELL_SIZE( BtShared pBt ) { return ( pBt.pageSize - 8 ); }
250
+
251
+ /* The maximum number of cells on a single page of the database. This
252
+ ** assumes a minimum cell size of 6 bytes (4 bytes for the cell itself
253
+ ** plus 2 bytes for the index to the cell in the page header). Such
254
+ ** small cells will be rare, but they are possible.
255
+ */
256
+ //#define MX_CELL(pBt) ((pBt.pageSize-8)/6)
257
+ static int MX_CELL( BtShared pBt ) { return ( ( pBt.pageSize - 8 ) / 6 ); }
258
+
259
+ /* Forward declarations */
260
+ //typedef struct MemPage MemPage;
261
+ //typedef struct BtLock BtLock;
262
+
263
+ /*
264
+ ** This is a magic string that appears at the beginning of every
265
+ ** SQLite database in order to identify the file as a real database.
266
+ **
267
+ ** You can change this value at compile-time by specifying a
268
+ ** -DSQLITE_FILE_HEADER="..." on the compiler command-line. The
269
+ ** header must be exactly 16 bytes including the zero-terminator so
270
+ ** the string itself should be 15 characters long. If you change
271
+ ** the header, then your custom library will not be able to read
272
+ ** databases generated by the standard tools and the standard tools
273
+ ** will not be able to read databases created by your custom library.
274
+ */
275
+ #if !SQLITE_FILE_HEADER //* 123456789 123456 */
276
+ const string SQLITE_FILE_HEADER = "SQLite format 3\0";
277
+ #endif
278
+
279
+ /*
280
+ ** Page type flags. An ORed combination of these flags appear as the
281
+ ** first byte of on-disk image of every BTree page.
282
+ */
283
+ const byte PTF_INTKEY = 0x01;
284
+ const byte PTF_ZERODATA = 0x02;
285
+ const byte PTF_LEAFDATA = 0x04;
286
+ const byte PTF_LEAF = 0x08;
287
+
288
+ /*
289
+ ** As each page of the file is loaded into memory, an instance of the following
290
+ ** structure is appended and initialized to zero. This structure stores
291
+ ** information about the page that is decoded from the raw file page.
292
+ **
293
+ ** The pParent field points back to the parent page. This allows us to
294
+ ** walk up the BTree from any leaf to the root. Care must be taken to
295
+ ** unref() the parent page pointer when this page is no longer referenced.
296
+ ** The pageDestructor() routine handles that chore.
297
+ **
298
+ ** Access to all fields of this structure is controlled by the mutex
299
+ ** stored in MemPage.pBt.mutex.
300
+ */
301
+ public struct _OvflCell
302
+ { /* Cells that will not fit on aData[] */
303
+ public u8[] pCell; /* Pointers to the body of the overflow cell */
304
+ public u16 idx; /* Insert this cell before idx-th non-overflow cell */
305
+ public _OvflCell Copy()
306
+ {
307
+ _OvflCell cp = new _OvflCell();
308
+ if ( pCell != null )
309
+ {
310
+ cp.pCell = sqlite3Malloc(pCell.Length);
311
+ Buffer.BlockCopy( pCell, 0, cp.pCell, 0, pCell.Length );
312
+ }
313
+ cp.idx = idx;
314
+ return cp;
315
+ }
316
+ };
317
+ public class MemPage
318
+ {
319
+ public u8 isInit; /* True if previously initialized. MUST BE FIRST! */
320
+ public u8 nOverflow; /* Number of overflow cell bodies in aCell[] */
321
+ public u8 intKey; /* True if u8key flag is set */
322
+ public u8 leaf; /* 1 if leaf flag is set */
323
+ public u8 hasData; /* True if this page stores data */
324
+ public u8 hdrOffset; /* 100 for page 1. 0 otherwise */
325
+ public u8 childPtrSize; /* 0 if leaf==1. 4 if leaf==0 */
326
+ public u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
327
+ public u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
328
+ public u16 cellOffset; /* Index in aData of first cell pou16er */
329
+ public u16 nFree; /* Number of free bytes on the page */
330
+ public u16 nCell; /* Number of cells on this page, local and ovfl */
331
+ public u16 maskPage; /* Mask for page offset */
332
+ public _OvflCell[] aOvfl = new _OvflCell[5];
333
+ public BtShared pBt; /* Pointer to BtShared that this page is part of */
334
+ public byte[] aData; /* Pointer to disk image of the page data */
335
+ public DbPage pDbPage; /* Pager page handle */
336
+ public Pgno pgno; /* Page number for this page */
337
+
338
+ public MemPage Copy()
339
+ {
340
+ MemPage cp = (MemPage)MemberwiseClone();
341
+ if ( aOvfl != null )
342
+ {
343
+ cp.aOvfl = new _OvflCell[aOvfl.Length];
344
+ for ( int i = 0; i < aOvfl.Length; i++ ) cp.aOvfl[i] = aOvfl[i].Copy();
345
+ }
346
+ if ( aData != null )
347
+ {
348
+ cp.aData = sqlite3Malloc( aData.Length );
349
+ Buffer.BlockCopy( aData, 0, cp.aData, 0, aData.Length );
350
+ }
351
+ return cp;
352
+ }
353
+ };
354
+
355
+ /*
356
+ ** The in-memory image of a disk page has the auxiliary information appended
357
+ ** to the end. EXTRA_SIZE is the number of bytes of space needed to hold
358
+ ** that extra information.
359
+ */
360
+ const int EXTRA_SIZE = 0;// No used in C#, since we use create a class; was MemPage.Length;
361
+
362
+ /*
363
+ ** A linked list of the following structures is stored at BtShared.pLock.
364
+ ** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor
365
+ ** is opened on the table with root page BtShared.iTable. Locks are removed
366
+ ** from this list when a transaction is committed or rolled back, or when
367
+ ** a btree handle is closed.
368
+ */
369
+ public class BtLock
370
+ {
371
+ Btree pBtree; /* Btree handle holding this lock */
372
+ Pgno iTable; /* Root page of table */
373
+ u8 eLock; /* READ_LOCK or WRITE_LOCK */
374
+ BtLock pNext; /* Next in BtShared.pLock list */
375
+ };
376
+
377
+ /* Candidate values for BtLock.eLock */
378
+ //#define READ_LOCK 1
379
+ //#define WRITE_LOCK 2
380
+ const int READ_LOCK = 1;
381
+ const int WRITE_LOCK = 2;
382
+
383
+ /* A Btree handle
384
+ **
385
+ ** A database connection contains a pointer to an instance of
386
+ ** this object for every database file that it has open. This structure
387
+ ** is opaque to the database connection. The database connection cannot
388
+ ** see the internals of this structure and only deals with pointers to
389
+ ** this structure.
390
+ **
391
+ ** For some database files, the same underlying database cache might be
392
+ ** shared between multiple connections. In that case, each connection
393
+ ** has it own instance of this object. But each instance of this object
394
+ ** points to the same BtShared object. The database cache and the
395
+ ** schema associated with the database file are all contained within
396
+ ** the BtShared object.
397
+ **
398
+ ** All fields in this structure are accessed under sqlite3.mutex.
399
+ ** The pBt pointer itself may not be changed while there exists cursors
400
+ ** in the referenced BtShared that point back to this Btree since those
401
+ ** cursors have to do go through this Btree to find their BtShared and
402
+ ** they often do so without holding sqlite3.mutex.
403
+ */
404
+ public class Btree
405
+ {
406
+ public sqlite3 db; /* The database connection holding this Btree */
407
+ public BtShared pBt; /* Sharable content of this Btree */
408
+ public u8 inTrans; /* TRANS_NONE, TRANS_READ or TRANS_WRITE */
409
+ public bool sharable; /* True if we can share pBt with another db */
410
+ public bool locked; /* True if db currently has pBt locked */
411
+ public int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
412
+ public int nBackup; /* Number of backup operations reading this btree */
413
+ public Btree pNext; /* List of other sharable Btrees from the same db */
414
+ public Btree pPrev; /* Back pointer of the same list */
415
+ #if !SQLITE_OMIT_SHARED_CACHE
416
+ BtLock lock; /* Object used to lock page 1 */
417
+ #endif
418
+ };
419
+
420
+ /*
421
+ ** Btree.inTrans may take one of the following values.
422
+ **
423
+ ** If the shared-data extension is enabled, there may be multiple users
424
+ ** of the Btree structure. At most one of these may open a write transaction,
425
+ ** but any number may have active read transactions.
426
+ */
427
+ const byte TRANS_NONE = 0;
428
+ const byte TRANS_READ = 1;
429
+ const byte TRANS_WRITE = 2;
430
+
431
+ /*
432
+ ** An instance of this object represents a single database file.
433
+ **
434
+ ** A single database file can be in use as the same time by two
435
+ ** or more database connections. When two or more connections are
436
+ ** sharing the same database file, each connection has it own
437
+ ** private Btree object for the file and each of those Btrees points
438
+ ** to this one BtShared object. BtShared.nRef is the number of
439
+ ** connections currently sharing this database file.
440
+ **
441
+ ** Fields in this structure are accessed under the BtShared.mutex
442
+ ** mutex, except for nRef and pNext which are accessed under the
443
+ ** global SQLITE_MUTEX_STATIC_MASTER mutex. The pPager field
444
+ ** may not be modified once it is initially set as long as nRef>0.
445
+ ** The pSchema field may be set once under BtShared.mutex and
446
+ ** thereafter is unchanged as long as nRef>0.
447
+ **
448
+ ** isPending:
449
+ **
450
+ ** If a BtShared client fails to obtain a write-lock on a database
451
+ ** table (because there exists one or more read-locks on the table),
452
+ ** the shared-cache enters 'pending-lock' state and isPending is
453
+ ** set to true.
454
+ **
455
+ ** The shared-cache leaves the 'pending lock' state when either of
456
+ ** the following occur:
457
+ **
458
+ ** 1) The current writer (BtShared.pWriter) concludes its transaction, OR
459
+ ** 2) The number of locks held by other connections drops to zero.
460
+ **
461
+ ** while in the 'pending-lock' state, no connection may start a new
462
+ ** transaction.
463
+ **
464
+ ** This feature is included to help prevent writer-starvation.
465
+ */
466
+ public class BtShared
467
+ {
468
+ public Pager pPager; /* The page cache */
469
+ public sqlite3 db; /* Database connection currently using this Btree */
470
+ public BtCursor pCursor; /* A list of all open cursors */
471
+ public MemPage pPage1; /* First page of the database */
472
+ public bool readOnly; /* True if the underlying file is readonly */
473
+ public bool pageSizeFixed; /* True if the page size can no longer be changed */
474
+ public bool secureDelete; /* True if secure_delete is enabled */
475
+ #if !SQLITE_OMIT_AUTOVACUUM
476
+ public bool autoVacuum; /* True if auto-vacuum is enabled */
477
+ public bool incrVacuum; /* True if incr-vacuum is enabled */
478
+ #endif
479
+ public u16 pageSize; /* Total number of bytes on a page */
480
+ public u16 usableSize; /* Number of usable bytes on each page */
481
+ public u16 maxLocal; /* Maximum local payload in non-LEAFDATA tables */
482
+ public u16 minLocal; /* Minimum local payload in non-LEAFDATA tables */
483
+ public u16 maxLeaf; /* Maximum local payload in a LEAFDATA table */
484
+ public u16 minLeaf; /* Minimum local payload in a LEAFDATA table */
485
+ public u8 inTransaction; /* Transaction state */
486
+ public int nTransaction; /* Number of open transactions (read + write) */
487
+ public Schema pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
488
+ public dxFreeSchema xFreeSchema;/* Destructor for BtShared.pSchema */
489
+ public sqlite3_mutex mutex; /* Non-recursive mutex required to access this struct */
490
+ public Bitvec pHasContent; /* Set of pages moved to free-list this transaction */
491
+ #if !SQLITE_OMIT_SHARED_CACHE
492
+ public int nRef; /* Number of references to this structure */
493
+ public BtShared pNext; /* Next on a list of sharable BtShared structs */
494
+ public BtLock pLock; /* List of locks held on this shared-btree struct */
495
+ public Btree pWriter; /* Btree with currently open write transaction */
496
+ public u8 isExclusive; /* True if pWriter has an EXCLUSIVE lock on the db */
497
+ public u8 isPending; /* If waiting for read-locks to clear */
498
+ #endif
499
+ public byte[] pTmpSpace; /* BtShared.pageSize bytes of space for tmp use */
500
+ };
501
+
502
+ /*
503
+ ** An instance of the following structure is used to hold information
504
+ ** about a cell. The parseCellPtr() function fills in this structure
505
+ ** based on information extract from the raw disk page.
506
+ */
507
+ //typedef struct CellInfo CellInfo;
508
+ public struct CellInfo
509
+ {
510
+ public byte[] pCell; /* Pointer to the start of cell content */
511
+ public int iCell; /* Offset to start of cell content -- Needed for C# */
512
+ public i64 nKey; /* The key for INTKEY tables, or number of bytes in key */
513
+ public u32 nData; /* Number of bytes of data */
514
+ public u32 nPayload; /* Total amount of payload */
515
+ public u16 nHeader; /* Size of the cell content header in bytes */
516
+ public u16 nLocal; /* Amount of payload held locally */
517
+ public u16 iOverflow; /* Offset to overflow page number. Zero if no overflow */
518
+ public u16 nSize; /* Size of the cell content on the main b-tree page */
519
+ public bool Equals( CellInfo ci )
520
+ {
521
+ if ( ci.iCell >= ci.pCell.Length || iCell >= this.pCell.Length) return false;
522
+ if ( ci.pCell[ci.iCell] != this.pCell[iCell] ) return false;
523
+ if ( ci.nKey != this.nKey || ci.nData != this.nData || ci.nPayload != this.nPayload ) return false;
524
+ if ( ci.nHeader != this.nHeader || ci.nLocal != this.nLocal ) return false;
525
+ if ( ci.iOverflow != this.iOverflow || ci.nSize != this.nSize ) return false;
526
+ return true;
527
+ }
528
+ };
529
+
530
+ /*
531
+ ** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than
532
+ ** this will be declared corrupt. This value is calculated based on a
533
+ ** maximum database size of 2^31 pages a minimum fanout of 2 for a
534
+ ** root-node and 3 for all other internal nodes.
535
+ **
536
+ ** If a tree that appears to be taller than this is encountered, it is
537
+ ** assumed that the database is corrupt.
538
+ */
539
+ //#define BTCURSOR_MAX_DEPTH 20
540
+ const int BTCURSOR_MAX_DEPTH = 20;
541
+
542
+ /*
543
+ ** A cursor is a pointer to a particular entry within a particular
544
+ ** b-tree within a database file.
545
+ **
546
+ ** The entry is identified by its MemPage and the index in
547
+ ** MemPage.aCell[] of the entry.
548
+ **
549
+ ** A single database file can shared by two more database connections,
550
+ ** but cursors cannot be shared. Each cursor is associated with a
551
+ ** particular database connection identified BtCursor.pBtree.db.
552
+ **
553
+ ** Fields in this structure are accessed under the BtShared.mutex
554
+ ** found at self.pBt.mutex.
555
+ */
556
+ public class BtCursor
557
+ {
558
+ public Btree pBtree; /* The Btree to which this cursor belongs */
559
+ public BtShared pBt; /* The BtShared this cursor points to */
560
+ public BtCursor pNext;
561
+ public BtCursor pPrev; /* Forms a linked list of all cursors */
562
+ public KeyInfo pKeyInfo; /* Argument passed to comparison function */
563
+ public Pgno pgnoRoot; /* The root page of this tree */
564
+ public sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */
565
+ public CellInfo info = new CellInfo(); /* A parse of the cell we are pointing at */
566
+ public u8 wrFlag; /* True if writable */
567
+ public u8 atLast; /* VdbeCursor pointing to the last entry */
568
+ public bool validNKey; /* True if info.nKey is valid */
569
+ public int eState; /* One of the CURSOR_XXX constants (see below) */
570
+ public byte[] pKey; /* Saved key that was cursor's last known position */
571
+ public i64 nKey; /* Size of pKey, or last integer key */
572
+ public int skipNext; /* Prev() is noop if negative. Next() is noop if positive */
573
+ #if !SQLITE_OMIT_INCRBLOB
574
+ public bool isIncrblobHandle; /* True if this cursor is an incr. io handle */
575
+ public Pgno[] aOverflow; /* Cache of overflow page locations */
576
+ #endif
577
+ public i16 iPage; /* Index of current page in apPage */
578
+ public MemPage[] apPage = new MemPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
579
+ public u16[] aiIdx = new u16[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
580
+
581
+ public void Clear()
582
+ {
583
+ pNext = null;
584
+ pPrev = null;
585
+ pKeyInfo = null;
586
+ pgnoRoot = 0;
587
+ cachedRowid = 0;
588
+ info = new CellInfo();
589
+ wrFlag = 0;
590
+ atLast = 0;
591
+ validNKey = false;
592
+ eState = 0;
593
+ pKey = null;
594
+ nKey = 0;
595
+ skipNext = 0;
596
+ #if !SQLITE_OMIT_INCRBLOB
597
+ isIncrblobHandle=false;
598
+ aOverflow= null;
599
+ #endif
600
+ iPage = 0;
601
+ }
602
+ public BtCursor Copy()
603
+ {
604
+ BtCursor cp = (BtCursor)MemberwiseClone();
605
+ return cp;
606
+ }
607
+ };
608
+
609
+ /*
610
+ ** Potential values for BtCursor.eState.
611
+ **
612
+ ** CURSOR_VALID:
613
+ ** VdbeCursor points to a valid entry. getPayload() etc. may be called.
614
+ **
615
+ ** CURSOR_INVALID:
616
+ ** VdbeCursor does not point to a valid entry. This can happen (for example)
617
+ ** because the table is empty or because BtreeCursorFirst() has not been
618
+ ** called.
619
+ **
620
+ ** CURSOR_REQUIRESEEK:
621
+ ** The table that this cursor was opened on still exists, but has been
622
+ ** modified since the cursor was last used. The cursor position is saved
623
+ ** in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
624
+ ** this state, restoreCursorPosition() can be called to attempt to
625
+ ** seek the cursor to the saved position.
626
+ **
627
+ ** CURSOR_FAULT:
628
+ ** A unrecoverable error (an I/O error or a malloc failure) has occurred
629
+ ** on a different connection that shares the BtShared cache with this
630
+ ** cursor. The error has left the cache in an inconsistent state.
631
+ ** Do nothing else with this cursor. Any attempt to use the cursor
632
+ ** should return the error code stored in BtCursor.skip
633
+ */
634
+ const int CURSOR_INVALID = 0;
635
+ const int CURSOR_VALID = 1;
636
+ const int CURSOR_REQUIRESEEK = 2;
637
+ const int CURSOR_FAULT = 3;
638
+
639
+ /*
640
+ ** The database page the PENDING_BYTE occupies. This page is never used.
641
+ */
642
+ //# define PENDING_BYTE_PAGE(pBt) PAGER_MJ_PGNO(pBt)
643
+ // TODO -- Convert PENDING_BYTE_PAGE to inline
644
+ static u32 PENDING_BYTE_PAGE( BtShared pBt ) { return (u32)PAGER_MJ_PGNO( pBt.pPager ); }
645
+
646
+ /*
647
+ ** These macros define the location of the pointer-map entry for a
648
+ ** database page. The first argument to each is the number of usable
649
+ ** bytes on each page of the database (often 1024). The second is the
650
+ ** page number to look up in the pointer map.
651
+ **
652
+ ** PTRMAP_PAGENO returns the database page number of the pointer-map
653
+ ** page that stores the required pointer. PTRMAP_PTROFFSET returns
654
+ ** the offset of the requested map entry.
655
+ **
656
+ ** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
657
+ ** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
658
+ ** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
659
+ ** this test.
660
+ */
661
+ //#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
662
+ static Pgno PTRMAP_PAGENO( BtShared pBt, Pgno pgno ) { return ptrmapPageno( pBt, pgno ); }
663
+ //#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
664
+ static u32 PTRMAP_PTROFFSET( u32 pgptrmap, u32 pgno ) { return ( 5 * ( pgno - pgptrmap - 1 ) ); }
665
+ //#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))
666
+ static bool PTRMAP_ISPAGE( BtShared pBt, u32 pgno ) { return ( PTRMAP_PAGENO( ( pBt ), ( pgno ) ) == ( pgno ) ); }
667
+ /*
668
+ ** The pointer map is a lookup table that identifies the parent page for
669
+ ** each child page in the database file. The parent page is the page that
670
+ ** contains a pointer to the child. Every page in the database contains
671
+ ** 0 or 1 parent pages. (In this context 'database page' refers
672
+ ** to any page that is not part of the pointer map itself.) Each pointer map
673
+ ** entry consists of a single byte 'type' and a 4 byte parent page number.
674
+ ** The PTRMAP_XXX identifiers below are the valid types.
675
+ **
676
+ ** The purpose of the pointer map is to facility moving pages from one
677
+ ** position in the file to another as part of autovacuum. When a page
678
+ ** is moved, the pointer in its parent must be updated to point to the
679
+ ** new location. The pointer map is used to locate the parent page quickly.
680
+ **
681
+ ** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
682
+ ** used in this case.
683
+ **
684
+ ** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
685
+ ** is not used in this case.
686
+ **
687
+ ** PTRMAP_OVERFLOW1: The database page is the first page in a list of
688
+ ** overflow pages. The page number identifies the page that
689
+ ** contains the cell with a pointer to this overflow page.
690
+ **
691
+ ** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
692
+ ** overflow pages. The page-number identifies the previous
693
+ ** page in the overflow page list.
694
+ **
695
+ ** PTRMAP_BTREE: The database page is a non-root btree page. The page number
696
+ ** identifies the parent page in the btree.
697
+ */
698
+ //#define PTRMAP_ROOTPAGE 1
699
+ //#define PTRMAP_FREEPAGE 2
700
+ //#define PTRMAP_OVERFLOW1 3
701
+ //#define PTRMAP_OVERFLOW2 4
702
+ //#define PTRMAP_BTREE 5
703
+ const int PTRMAP_ROOTPAGE = 1;
704
+ const int PTRMAP_FREEPAGE = 2;
705
+ const int PTRMAP_OVERFLOW1 = 3;
706
+ const int PTRMAP_OVERFLOW2 = 4;
707
+ const int PTRMAP_BTREE = 5;
708
+
709
+ /* A bunch of Debug.Assert() statements to check the transaction state variables
710
+ ** of handle p (type Btree*) are internally consistent.
711
+ */
712
+ #if DEBUG
713
+ //#define btreeIntegrity(p) \
714
+ // Debug.Assert( p.pBt.inTransaction!=TRANS_NONE || p.pBt.nTransaction==0 ); \
715
+ // Debug.Assert( p.pBt.inTransaction>=p.inTrans );
716
+ static void btreeIntegrity( Btree p )
717
+ {
718
+ Debug.Assert( p.pBt.inTransaction != TRANS_NONE || p.pBt.nTransaction == 0 );
719
+ Debug.Assert( p.pBt.inTransaction >= p.inTrans );
720
+ }
721
+ #else
722
+ static void btreeIntegrity(Btree p) { }
723
+ #endif
724
+
725
+ /*
726
+ ** The ISAUTOVACUUM macro is used within balance_nonroot() to determine
727
+ ** if the database supports auto-vacuum or not. Because it is used
728
+ ** within an expression that is an argument to another macro
729
+ ** (sqliteMallocRaw), it is not possible to use conditional compilation.
730
+ ** So, this macro is defined instead.
731
+ */
732
+ #if !SQLITE_OMIT_AUTOVACUUM
733
+ //#define ISAUTOVACUUM (pBt.autoVacuum)
734
+ #else
735
+ //#define ISAUTOVACUUM 0
736
+ public static bool ISAUTOVACUUM =false;
737
+ #endif
738
+
739
+
740
+ /*
741
+ ** This structure is passed around through all the sanity checking routines
742
+ ** in order to keep track of some global state information.
743
+ */
744
+ //typedef struct IntegrityCk IntegrityCk;
745
+ public class IntegrityCk
746
+ {
747
+ public BtShared pBt; /* The tree being checked out */
748
+ public Pager pPager; /* The associated pager. Also accessible by pBt.pPager */
749
+ public Pgno nPage; /* Number of pages in the database */
750
+ public int[] anRef; /* Number of times each page is referenced */
751
+ public int mxErr; /* Stop accumulating errors when this reaches zero */
752
+ public int nErr; /* Number of messages written to zErrMsg so far */
753
+ //public int mallocFailed; /* A memory allocation error has occurred */
754
+ public StrAccum errMsg = new StrAccum(100); /* Accumulate the error message text here */
755
+ };
756
+
757
+ /*
758
+ ** Read or write a two- and four-byte big-endian integer values.
759
+ */
760
+ //#define get2byte(x) ((x)[0]<<8 | (x)[1])
761
+ static int get2byte( byte[] p, int offset )
762
+ { return p[offset + 0] << 8 | p[offset + 1]; }
763
+
764
+ //#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v))
765
+ static void put2byte( byte[] pData, int Offset, u32 v )
766
+ { pData[Offset + 0] = (byte)( v >> 8 ); pData[Offset + 1] = (byte)v; }
767
+ static void put2byte( byte[] pData, int Offset, int v )
768
+ { pData[Offset + 0] = (byte)( v >> 8 ); pData[Offset + 1] = (byte)v; }
769
+
770
+ //#define get4byte sqlite3Get4byte
771
+ //#define put4byte sqlite3Put4byte
772
+
773
+ }
774
+ }