Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rhoconnect-client: moved all syncengine related code to native extension

  • Loading branch information...
commit e9e11662babe25534bc0d2846285751d85cda506 1 parent c2f17e8
@alex-epifanoff alex-epifanoff authored
Showing with 555 additions and 9,327 deletions.
  1. +25 −2 lib/framework/rho/rho.rb
  2. +0 −1  platform/android/Rhodes/jni/src/bluetooth.cpp
  3. +0 −2  platform/android/Rhodes/jni/src/rhodes.cpp
  4. +21 −8 platform/android/Rhodes/jni/src/rhodesapp.cpp
  5. +1 −5 platform/android/build/librhosync_build.files
  6. +0 −1  platform/android/build/libruby_build.files
  7. +11 −7 platform/iphone/Classes/Rhodes.m
  8. +0 −4 platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj
  9. +6 −40 platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj
  10. +6 −2 platform/shared/common/AppMenu.cpp
  11. +245 −127 platform/shared/common/RhodesApp.cpp
  12. +15 −6 platform/shared/common/RhodesAppBase.cpp
  13. +5 −3 platform/shared/common/iphone/RhoClassFactory.cpp
  14. +5 −3 platform/shared/db/DBAdapter.cpp
  15. +30 −3 platform/shared/db/DBImportTransaction.cpp
  16. +8 −3 platform/shared/net/HttpServer.cpp
  17. +0 −1  platform/shared/ruby/Android.mk
  18. +14 −22 platform/shared/ruby/ext/rho/rhoruby.c
  19. +0 −125 platform/shared/ruby/ext/syncengine/syncengine.i
  20. +0 −3,208 platform/shared/ruby/ext/syncengine/syncengine_wrap.c
  21. +5 −3 platform/shared/rubyext/RhoAppAdapter.cpp
  22. +12 −8 platform/shared/rubyext/System.cpp
  23. +0 −14 platform/shared/sync/Android.mk
  24. +0 −273 platform/shared/sync/ClientRegister.cpp
  25. +0 −102 platform/shared/sync/ClientRegister.h
  26. +0 −44 platform/shared/sync/ILoginListener.h
  27. +0 −58 platform/shared/sync/ISyncProtocol.h
  28. +30 −0 platform/shared/sync/RhoconnectClientManager.cpp
  29. +109 −0 platform/shared/sync/RhoconnectClientManager.h
  30. +0 −1,071 platform/shared/sync/SyncEngine.cpp
  31. +0 −185 platform/shared/sync/SyncEngine.h
  32. +0 −675 platform/shared/sync/SyncNotify.cpp
  33. +0 −181 platform/shared/sync/SyncNotify.h
  34. +0 −131 platform/shared/sync/SyncProtocol_3.h
  35. +0 −1,448 platform/shared/sync/SyncSource.cpp
  36. +0 −185 platform/shared/sync/SyncSource.h
  37. +0 −530 platform/shared/sync/SyncThread.cpp
  38. +0 −221 platform/shared/sync/SyncThread.h
  39. +0 −39 platform/shared/sync/Test/NetDataStub.h
  40. +0 −279 platform/shared/sync/Test/SyncEngine_test.cpp
  41. +0 −294 platform/shared/sync/Test/SyncSource_test.cpp
  42. +0 −9 spec/phone_spec/app/spec_runner.rb
  43. +3 −3 spec/rhoconnect_spec/app/spec/blob_bulksync_spec.rb
  44. +4 −1 spec/rhoconnect_spec/build.yml
View
27 lib/framework/rho/rho.rb
@@ -1316,7 +1316,7 @@ def self.stop( callback )
end
end # Rho
-
+=begin
module SyncEngine
def self.get_user_name
Rho::RhoConfig.rho_sync_user
@@ -1366,11 +1366,34 @@ def self.search(args)
args[:callback], callbackParams )
end
end
-
+=end
#at_exit do
#::Rhom::RhomDbAdapter.close
#end
+begin
+ puts "Looking for SyncEngine"
+ require 'syncengine.rb'
+ Module.const_get("SyncEngine")
+ puts "SyncEngine found. do nothing"
+rescue LoadError, NameError
+ puts "SyncEngine not found. Defining stub module"
+
+ module SyncEngine
+ def self.respond_to?(method)
+ puts "SyncEngine won't respond to #{method}. Use 'rhoconnect-client' extension."
+ true
+ end
+
+ def self.method_missing(name, *args, &block)
+ puts "SyncEngine call #{name} not supported. Use 'rhoconnect-client' extension."
+ end
+ end
+
+end
+
+
+
class Module
alias base_const_missing const_missing
View
1  platform/android/Rhodes/jni/src/bluetooth.cpp
@@ -30,7 +30,6 @@
#include <common/RhoConf.h>
#include <logging/RhoLogConf.h>
#include <common/RhodesApp.h>
-#include <sync/SyncThread.h>
#include <sys/stat.h>
#include <sys/resource.h>
View
2  platform/android/Rhodes/jni/src/rhodes.cpp
@@ -31,8 +31,6 @@
#include <common/RhoConf.h>
#include <logging/RhoLogConf.h>
-#include <sync/SyncThread.h>
-#include <sync/ClientRegister.h>
#include <sys/stat.h>
#include <sys/resource.h>
View
29 platform/android/Rhodes/jni/src/rhodesapp.cpp
@@ -32,8 +32,7 @@
#include <logging/RhoLogConf.h>
#include <common/RhodesApp.h>
#include <common/AutoPointer.h>
-#include <sync/SyncThread.h>
-#include <sync/ClientRegister.h>
+#include <sync/RhoconnectClientManager.h>
#include <genconfig.h>
@@ -127,14 +126,20 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesApplication_stopRhodesAp
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doSyncAllSources
(JNIEnv *, jobject, jboolean show_status_popup)
{
- rho_sync_doSyncAllSources(show_status_popup, "", 0);
+ //rho_sync_doSyncAllSources(show_status_popup, "", 0);
+ if ( rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ rho::sync::RhoconnectClientManager::doSyncAllSources(show_status_popup,"",0);
+ }
}
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doSyncSource
(JNIEnv *env, jobject, jstring sourceObj)
{
- std::string source = rho_cast<std::string>(env, sourceObj);
- rho_sync_doSyncSourceByName(source.c_str());
+ if ( rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ std::string source = rho_cast<std::string>(env, sourceObj);
+// rho_sync_doSyncSourceByName(source.c_str());
+ rho::sync::RhoconnectClientManager::doSyncSourceByName(source.c_str());
+ }
}
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesApplication_setStartParameters
@@ -310,14 +315,22 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_callActivationCa
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrationId
(JNIEnv *env, jobject, jstring jId)
{
- std::string deviceId = rho_cast<std::string>(env, jId);
- rho::sync::CClientRegister::Create(deviceId);
+ if ( rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ std::string deviceId = rho_cast<std::string>(env, jId);
+// rho::sync::CClientRegister::Create(deviceId);
+ rho::sync::RhoconnectClientManager::clientRegisterCreate(deviceId.c_str());
+ }
}
RHO_GLOBAL jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_getPushRegistrationId
(JNIEnv * env, jobject)
{
- return rho_cast<jhstring>(env, rho::sync::CClientRegister::Get()->getDevicePin()).release();
+ rho::String ret = "";
+ if ( rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ //return rho_cast<jhstring>(env, rho::sync::CClientRegister::Get()->getDevicePin()).release();
+ ret = rho::sync::RhoconnectClientManager::clientRegisterGetDevicePin();
+ }
+ return rho_cast<jhstring>(env, ret).release();
}
RHO_GLOBAL jboolean JNICALL Java_com_rhomobile_rhodes_RhodesService_callPushCallback
View
6 platform/android/build/librhosync_build.files
@@ -1,5 +1 @@
-platform/shared/sync/ClientRegister.cpp
-platform/shared/sync/SyncEngine.cpp
-platform/shared/sync/SyncNotify.cpp
-platform/shared/sync/SyncSource.cpp
-platform/shared/sync/SyncThread.cpp
+platform/shared/sync/RhoconnectClientManager.cpp
View
1  platform/android/build/libruby_build.files
@@ -45,7 +45,6 @@ platform/shared/ruby/ext/socket/socket.c
platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c
platform/shared/ruby/ext/stringio/stringio.c
platform/shared/ruby/ext/strscan/strscan.c
-platform/shared/ruby/ext/syncengine/syncengine_wrap.c
platform/shared/ruby/ext/system/system_wrap.c
platform/shared/ruby/ext/webview/webview_wrap.c
platform/shared/ruby/file.c
View
18 platform/iphone/Classes/Rhodes.m
@@ -29,8 +29,7 @@
#import "RhoAlert.h"
#import "ParamsWrapper.h"
-#include "sync/ClientRegister.h"
-#include "sync/SyncThread.h"
+#include "sync/RhoconnectClientManager.h"
#include "logging/RhoLogConf.h"
#include "logging/RhoLog.h"
#include "common/RhoConf.h"
@@ -704,6 +703,7 @@ - (void) monitorNetworkStatus
#ifdef __IPHONE_3_0
- (void)processDoSync:(NSDictionary *)userInfo
{
+ if ( rho_rcclient_have_rhoconnect_client() ) {
NSArray *do_sync = [userInfo objectForKey:@"do_sync"];
if (do_sync) {
NSEnumerator *enumerator = [do_sync objectEnumerator];
@@ -718,14 +718,15 @@ - (void)processDoSync:(NSDictionary *)userInfo
} else {
//do sync of individual source
NSString* srcUrl = [url stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n"]];
- rho_sync_doSyncSourceByName([srcUrl cStringUsingEncoding:[NSString defaultCStringEncoding]]);
+ rho_rcclient_doSyncSourceByName([srcUrl cStringUsingEncoding:[NSString defaultCStringEncoding]]);
}
}
if (sync_all) {
- rho_sync_doSyncAllSources(TRUE,"",false);
+ rho_rcclient_doSyncAllSources(TRUE,"",false);
}
}
+ }
}
- (void)processPushMessage:(NSDictionary *)userInfo
{
@@ -1093,8 +1094,10 @@ - (void)applicationDidEnterBackground:(UIApplication *)application {
rho_rhodesapp_callUiDestroyedCallback();
rho_rhodesapp_canstartapp("", ", ");
- if (rho_conf_getBool("finish_sync_in_background")/* && (rho_sync_issyncing()==1)*/) {
- if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) {
+ if (rho_rcclient_have_rhoconnect_client()) {
+
+ if (rho_conf_getBool("finish_sync_in_background")/* && (rho_rcclient_issyncing()==1)*/) {
+ if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) {
if ([[UIDevice currentDevice] isMultitaskingSupported]) { //Check if device supports mulitasking
syncBackgroundTask = [application beginBackgroundTaskWithExpirationHandler: ^ {
@@ -1113,7 +1116,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application {
{
NSLog(@"Check sync");
[NSThread sleepForTimeInterval:1];
- }while (rho_sync_issyncing()==1);
+ }while (rho_rcclient_issyncing()==1);
NSLog(@"Sync is finished");
@@ -1124,6 +1127,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application {
}
}
}
+ }
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
View
4 platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj
@@ -110,7 +110,6 @@
F5E360B80EB6A6B300226287 /* us_ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E360B40EB6A6B300226287 /* us_ascii.c */; };
F5E360B90EB6A6B300226287 /* utf_8.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E360B50EB6A6B300226287 /* utf_8.c */; };
F5E360C20EB6A74D00226287 /* strscan.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E360C10EB6A74D00226287 /* strscan.c */; };
- F5E360C50EB6A77C00226287 /* syncengine_wrap.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E360C40EB6A77C00226287 /* syncengine_wrap.c */; };
F5E360C80EB6A7AF00226287 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = F5E360C70EB6A7AF00226287 /* parse.c */; };
F5E360D40EB6A84600226287 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E360D30EB6A84600226287 /* config.h */; };
F5E362410EB785C100226287 /* crt_externs.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E362400EB785C100226287 /* crt_externs.h */; };
@@ -233,7 +232,6 @@
F5E360B40EB6A6B300226287 /* us_ascii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = us_ascii.c; path = ../../shared/ruby/enc/us_ascii.c; sourceTree = SOURCE_ROOT; };
F5E360B50EB6A6B300226287 /* utf_8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf_8.c; path = ../../shared/ruby/enc/utf_8.c; sourceTree = SOURCE_ROOT; };
F5E360C10EB6A74D00226287 /* strscan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = strscan.c; path = ../../shared/ruby/ext/strscan/strscan.c; sourceTree = SOURCE_ROOT; };
- F5E360C40EB6A77C00226287 /* syncengine_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = syncengine_wrap.c; path = ../../shared/ruby/ext/syncengine/syncengine_wrap.c; sourceTree = SOURCE_ROOT; };
F5E360C70EB6A7AF00226287 /* parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parse.c; path = ../../shared/ruby/generated/parse.c; sourceTree = SOURCE_ROOT; };
F5E360D30EB6A84600226287 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../../shared/ruby/iphone/ruby/config.h; sourceTree = SOURCE_ROOT; };
F5E362400EB785C100226287 /* crt_externs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crt_externs.h; path = ../../shared/ruby/iphone/crt_externs.h; sourceTree = SOURCE_ROOT; };
@@ -579,7 +577,6 @@
F5E360C30EB6A76500226287 /* syncengine */ = {
isa = PBXGroup;
children = (
- F5E360C40EB6A77C00226287 /* syncengine_wrap.c */,
);
name = syncengine;
sourceTree = "<group>";
@@ -792,7 +789,6 @@
F5E360B80EB6A6B300226287 /* us_ascii.c in Sources */,
F5E360B90EB6A6B300226287 /* utf_8.c in Sources */,
F5E360C20EB6A74D00226287 /* strscan.c in Sources */,
- F5E360C50EB6A77C00226287 /* syncengine_wrap.c in Sources */,
F5E360C80EB6A7AF00226287 /* parse.c in Sources */,
F5E362980EB7927100226287 /* thread_pthread.c in Sources */,
F5E362FF0EB79F0200226287 /* miniprelude.c in Sources */,
View
46 platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj
@@ -26,24 +26,15 @@
46E9214C0E9BF40A00F14AC8 /* printbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 46E9213A0E9BF40A00F14AC8 /* printbuf.c */; };
46E9214D0E9BF40A00F14AC8 /* printbuf.h in Headers */ = {isa = PBXBuildFile; fileRef = 46E9213B0E9BF40A00F14AC8 /* printbuf.h */; };
5C329221112C748F00FD3F13 /* RJSONTokener.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C329220112C748F00FD3F13 /* RJSONTokener.c */; };
- 5C5335AC0FC2F3AB00F268F0 /* SyncThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C5335AA0FC2F3AB00F268F0 /* SyncThread.cpp */; };
- 5C5335AD0FC2F3AB00F268F0 /* SyncThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C5335AB0FC2F3AB00F268F0 /* SyncThread.h */; };
5C74058A1064AA4900163569 /* DBAttrManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C7405881064AA4900163569 /* DBAttrManager.cpp */; };
5C74058B1064AA4900163569 /* DBAttrManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7405891064AA4900163569 /* DBAttrManager.h */; };
- 5C7405F2106CF7F400163569 /* SyncNotify.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C7405F0106CF7F400163569 /* SyncNotify.cpp */; };
- 5C7405F3106CF7F400163569 /* SyncNotify.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7405F1106CF7F400163569 /* SyncNotify.h */; };
5C9817230FBC4F20002597A5 /* JSONIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9817210FBC4F20002597A5 /* JSONIterator.cpp */; };
5C9817240FBC4F20002597A5 /* JSONIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9817220FBC4F20002597A5 /* JSONIterator.h */; };
- 5C98172A0FBC4F41002597A5 /* SyncEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9817260FBC4F41002597A5 /* SyncEngine.cpp */; };
- 5C98172B0FBC4F41002597A5 /* SyncEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9817270FBC4F41002597A5 /* SyncEngine.h */; };
- 5C98172C0FBC4F41002597A5 /* SyncSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9817280FBC4F41002597A5 /* SyncSource.cpp */; };
- 5C98172D0FBC4F41002597A5 /* SyncSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9817290FBC4F41002597A5 /* SyncSource.h */; };
5C9817330FBC4F70002597A5 /* DBAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C98172F0FBC4F70002597A5 /* DBAdapter.cpp */; };
5C9817340FBC4F70002597A5 /* DBAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9817300FBC4F70002597A5 /* DBAdapter.h */; };
5C9817350FBC4F70002597A5 /* DBResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9817310FBC4F70002597A5 /* DBResult.cpp */; };
5C9817360FBC4F70002597A5 /* DBResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9817320FBC4F70002597A5 /* DBResult.h */; };
- 5CE2940B1009D8B7009A75F6 /* ClientRegister.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE294091009D8B7009A75F6 /* ClientRegister.cpp */; };
- 5CE2940C1009D8B7009A75F6 /* ClientRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2940A1009D8B7009A75F6 /* ClientRegister.h */; };
+ C503935916821F9C0025B96C /* RhoconnectClientManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C503935816821F9C0025B96C /* RhoconnectClientManager.cpp */; };
C522F0FC159B1FFF007FF96E /* DBImportTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C522F0F8159B1FFF007FF96E /* DBImportTransaction.cpp */; };
C522F0FD159B1FFF007FF96E /* DBImportTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = C522F0F9159B1FFF007FF96E /* DBImportTransaction.h */; };
C522F0FE159B1FFF007FF96E /* DBRequestHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C522F0FA159B1FFF007FF96E /* DBRequestHelper.cpp */; };
@@ -73,24 +64,16 @@
46E9213A0E9BF40A00F14AC8 /* printbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = printbuf.c; path = ../../shared/json/printbuf.c; sourceTree = SOURCE_ROOT; };
46E9213B0E9BF40A00F14AC8 /* printbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printbuf.h; path = ../../shared/json/printbuf.h; sourceTree = SOURCE_ROOT; };
5C329220112C748F00FD3F13 /* RJSONTokener.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = RJSONTokener.c; sourceTree = "<group>"; };
- 5C5335AA0FC2F3AB00F268F0 /* SyncThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyncThread.cpp; path = ../../shared/sync/SyncThread.cpp; sourceTree = SOURCE_ROOT; };
- 5C5335AB0FC2F3AB00F268F0 /* SyncThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SyncThread.h; path = ../../shared/sync/SyncThread.h; sourceTree = SOURCE_ROOT; };
5C7405881064AA4900163569 /* DBAttrManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBAttrManager.cpp; path = ../../shared/db/DBAttrManager.cpp; sourceTree = SOURCE_ROOT; };
5C7405891064AA4900163569 /* DBAttrManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBAttrManager.h; path = ../../shared/db/DBAttrManager.h; sourceTree = SOURCE_ROOT; };
- 5C7405F0106CF7F400163569 /* SyncNotify.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyncNotify.cpp; path = ../../shared/sync/SyncNotify.cpp; sourceTree = SOURCE_ROOT; };
- 5C7405F1106CF7F400163569 /* SyncNotify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SyncNotify.h; path = ../../shared/sync/SyncNotify.h; sourceTree = SOURCE_ROOT; };
5C9817210FBC4F20002597A5 /* JSONIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONIterator.cpp; sourceTree = "<group>"; };
5C9817220FBC4F20002597A5 /* JSONIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONIterator.h; sourceTree = "<group>"; };
- 5C9817260FBC4F41002597A5 /* SyncEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyncEngine.cpp; path = ../../shared/sync/SyncEngine.cpp; sourceTree = SOURCE_ROOT; };
- 5C9817270FBC4F41002597A5 /* SyncEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SyncEngine.h; path = ../../shared/sync/SyncEngine.h; sourceTree = SOURCE_ROOT; };
- 5C9817280FBC4F41002597A5 /* SyncSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyncSource.cpp; path = ../../shared/sync/SyncSource.cpp; sourceTree = SOURCE_ROOT; };
- 5C9817290FBC4F41002597A5 /* SyncSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SyncSource.h; path = ../../shared/sync/SyncSource.h; sourceTree = SOURCE_ROOT; };
5C98172F0FBC4F70002597A5 /* DBAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBAdapter.cpp; path = ../../shared/db/DBAdapter.cpp; sourceTree = SOURCE_ROOT; };
5C9817300FBC4F70002597A5 /* DBAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBAdapter.h; path = ../../shared/db/DBAdapter.h; sourceTree = SOURCE_ROOT; };
5C9817310FBC4F70002597A5 /* DBResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBResult.cpp; path = ../../shared/db/DBResult.cpp; sourceTree = SOURCE_ROOT; };
5C9817320FBC4F70002597A5 /* DBResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBResult.h; path = ../../shared/db/DBResult.h; sourceTree = SOURCE_ROOT; };
- 5CE294091009D8B7009A75F6 /* ClientRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClientRegister.cpp; path = ../../shared/sync/ClientRegister.cpp; sourceTree = SOURCE_ROOT; };
- 5CE2940A1009D8B7009A75F6 /* ClientRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClientRegister.h; path = ../../shared/sync/ClientRegister.h; sourceTree = SOURCE_ROOT; };
+ C503935616821E340025B96C /* RhoconnectClientManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RhoconnectClientManager.h; path = ../../shared/sync/RhoconnectClientManager.h; sourceTree = "<group>"; };
+ C503935816821F9C0025B96C /* RhoconnectClientManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RhoconnectClientManager.cpp; path = ../../shared/sync/RhoconnectClientManager.cpp; sourceTree = "<group>"; };
C522F0F8159B1FFF007FF96E /* DBImportTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBImportTransaction.cpp; path = ../../shared/db/DBImportTransaction.cpp; sourceTree = "<group>"; };
C522F0F9159B1FFF007FF96E /* DBImportTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBImportTransaction.h; path = ../../shared/db/DBImportTransaction.h; sourceTree = "<group>"; };
C522F0FA159B1FFF007FF96E /* DBRequestHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBRequestHelper.cpp; path = ../../shared/db/DBRequestHelper.cpp; sourceTree = "<group>"; };
@@ -172,16 +155,8 @@
5C9817250FBC4F27002597A5 /* sync */ = {
isa = PBXGroup;
children = (
- 5C7405F0106CF7F400163569 /* SyncNotify.cpp */,
- 5C7405F1106CF7F400163569 /* SyncNotify.h */,
- 5CE294091009D8B7009A75F6 /* ClientRegister.cpp */,
- 5CE2940A1009D8B7009A75F6 /* ClientRegister.h */,
- 5C5335AA0FC2F3AB00F268F0 /* SyncThread.cpp */,
- 5C5335AB0FC2F3AB00F268F0 /* SyncThread.h */,
- 5C9817260FBC4F41002597A5 /* SyncEngine.cpp */,
- 5C9817270FBC4F41002597A5 /* SyncEngine.h */,
- 5C9817280FBC4F41002597A5 /* SyncSource.cpp */,
- 5C9817290FBC4F41002597A5 /* SyncSource.h */,
+ C503935616821E340025B96C /* RhoconnectClientManager.h */,
+ C503935816821F9C0025B96C /* RhoconnectClientManager.cpp */,
);
name = sync;
sourceTree = "<group>";
@@ -229,14 +204,9 @@
46E9214B0E9BF40A00F14AC8 /* linkhash.h in Headers */,
46E9214D0E9BF40A00F14AC8 /* printbuf.h in Headers */,
5C9817240FBC4F20002597A5 /* JSONIterator.h in Headers */,
- 5C98172B0FBC4F41002597A5 /* SyncEngine.h in Headers */,
- 5C98172D0FBC4F41002597A5 /* SyncSource.h in Headers */,
5C9817340FBC4F70002597A5 /* DBAdapter.h in Headers */,
5C9817360FBC4F70002597A5 /* DBResult.h in Headers */,
- 5C5335AD0FC2F3AB00F268F0 /* SyncThread.h in Headers */,
- 5CE2940C1009D8B7009A75F6 /* ClientRegister.h in Headers */,
5C74058B1064AA4900163569 /* DBAttrManager.h in Headers */,
- 5C7405F3106CF7F400163569 /* SyncNotify.h in Headers */,
C522F0FD159B1FFF007FF96E /* DBImportTransaction.h in Headers */,
C522F0FF159B1FFF007FF96E /* DBRequestHelper.h in Headers */,
);
@@ -296,17 +266,13 @@
46E9214A0E9BF40A00F14AC8 /* linkhash.c in Sources */,
46E9214C0E9BF40A00F14AC8 /* printbuf.c in Sources */,
5C9817230FBC4F20002597A5 /* JSONIterator.cpp in Sources */,
- 5C98172A0FBC4F41002597A5 /* SyncEngine.cpp in Sources */,
- 5C98172C0FBC4F41002597A5 /* SyncSource.cpp in Sources */,
5C9817330FBC4F70002597A5 /* DBAdapter.cpp in Sources */,
5C9817350FBC4F70002597A5 /* DBResult.cpp in Sources */,
- 5C5335AC0FC2F3AB00F268F0 /* SyncThread.cpp in Sources */,
- 5CE2940B1009D8B7009A75F6 /* ClientRegister.cpp in Sources */,
5C74058A1064AA4900163569 /* DBAttrManager.cpp in Sources */,
- 5C7405F2106CF7F400163569 /* SyncNotify.cpp in Sources */,
5C329221112C748F00FD3F13 /* RJSONTokener.c in Sources */,
C522F0FC159B1FFF007FF96E /* DBImportTransaction.cpp in Sources */,
C522F0FE159B1FFF007FF96E /* DBRequestHelper.cpp in Sources */,
+ C503935916821F9C0025B96C /* RhoconnectClientManager.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
8 platform/shared/common/AppMenu.cpp
@@ -28,8 +28,10 @@
#include "common/RhodesApp.h"
#include "ruby/ext/rho/rhoruby.h"
#include "rubyext/WebView.h"
+#include "sync/RhoconnectClientManager.h"
+
+//extern "C" void rho_sync_doSyncAllSources(int show_status_popup, const char* query_params);
-extern "C" void rho_sync_doSyncAllSources(int show_status_popup, const char* query_params);
extern "C" void rho_conf_show_log();
extern "C" void rho_sys_app_exit();
@@ -118,7 +120,9 @@ boolean CAppMenuItem::processCommand()
rho_webview_refresh(0);
break;
case CAppMenuItem::emtSync:
- rho_sync_doSyncAllSources(1, "");
+ if ( sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ sync::RhoconnectClientManager::doSyncAllSources(1, "", 0);
+ }
break;
case CAppMenuItem::emtLog:
rho_conf_show_log();
View
372 platform/shared/common/RhodesApp.cpp
@@ -32,8 +32,7 @@
#include "common/RhoFilePath.h"
#include "common/RhoAppAdapter.h"
#include "net/INetRequest.h"
-#include "sync/ClientRegister.h"
-#include "sync/SyncThread.h"
+#include "sync/RhoconnectClientManager.h"
#include "net/URI.h"
#include "net/HttpServer.h"
@@ -367,9 +366,13 @@ void CRhodesApp::run()
rubyext::CGeoLocation::Create();
//rho_db_init_attr_manager();
-
- LOG(INFO) + "Starting sync engine...";
- sync::CSyncThread::Create();
+
+
+ if ( sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ LOG(INFO) + "Starting sync engine...";
+// sync::CSyncThread::Create();
+ sync::RhoconnectClientManager::syncThreadCreate();
+ }
LOG(INFO) + "RhoRubyInitApp...";
RhoRubyInitApp();
@@ -393,8 +396,13 @@ void CRhodesApp::run()
getExtManager().close();
rubyext::CGeoLocation::Destroy();
- sync::CClientRegister::Destroy();
- sync::CSyncThread::Destroy();
+
+ if ( sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+// sync::CClientRegister::Destroy();
+// sync::CSyncThread::Destroy();
+ sync::RhoconnectClientManager::clientRegisterDestroy();
+ sync::RhoconnectClientManager::syncThreadDestroy();
+ }
net::CAsyncHttp::Destroy();
@@ -746,28 +754,41 @@ void CRhodesApp::callPopupCallback(String strCallbackUrl, const String &id, cons
static void callback_syncdb(void *arg, String const &/*query*/ )
{
- rho_sync_doSyncAllSources(1,"",false);
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+// rho_sync_doSyncAllSources(1,"",false);
+ rho::sync::RhoconnectClientManager::doSyncAllSources(1,"",false);
+ }
rho_http_sendresponse(arg, "");
}
static void callback_dosync(void *arg, String const &/*query*/ )
{
- rho_sync_doSyncAllSources(1,"",false);
- rho_http_sendresponse(arg, "ok");
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+// rho_sync_doSyncAllSources(1,"",false);
+ rho::sync::RhoconnectClientManager::doSyncAllSources(1,"",false);
+
+ }
+ rho_http_sendresponse(arg, "ok");
}
static void callback_dosync_source(void *arg, String const &strQuery )
{
- size_t nPos = strQuery.find("srcName=");
- if ( nPos != String::npos )
- {
- String strSrcName = strQuery.substr(nPos+8);
- LOG(INFO) + "srcName = '" + strSrcName + "'";
- rho_sync_doSyncSourceByName(strSrcName.c_str());
- } else {
- LOG(WARNING) + "Unable to find 'srcName' parameter";
- }
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl())
+ {
+ size_t nPos = strQuery.find("srcName=");
+ if ( nPos != String::npos )
+ {
+ String strSrcName = strQuery.substr(nPos+8);
+ LOG(INFO) + "srcName = '" + strSrcName + "'";
+// rho_sync_doSyncSourceByName(strSrcName.c_str());
+ rho::sync::RhoconnectClientManager::doSyncSourceByName(strSrcName.c_str());
+ } else {
+ LOG(WARNING) + "Unable to find 'srcName' parameter";
+ }
+ }
+
rho_http_sendresponse(arg, "ok");
+
}
static void callback_logger(void *arg, String const &query )
@@ -881,131 +902,189 @@ const String& CRhodesApp::getRhoMessage(int nError, const char* szName)
static void callback_logged_in(void *arg, String const &strQuery)
{
- rho_http_sendresponse(arg, rho_sync_logged_in() ? "true" : "false");
+ //rho_http_sendresponse(arg, rho_sync_logged_in() ? "true" : "false");
+ bool haveclient = rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl();
+ rho_http_sendresponse(arg, (haveclient && rho::sync::RhoconnectClientManager::logged_in()) ? "true" : "false");
}
static void callback_logout(void *arg, String const &strQuery)
{
- rho_sync_logout();
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ rho::sync::RhoconnectClientManager::logout();
+ //rho_sync_logout();
+ }
rho_http_sendresponse(arg, "ok");
}
static void callback_stop_sync(void *arg, String const &strQuery)
{
- rho_sync_stop();
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ rho::sync::RhoconnectClientManager::stop();
+ //rho_sync_stop();
+ }
rho_http_sendresponse(arg, "ok");
}
static void callback_set_pollinterval(void *arg, String const &strQuery)
{
- int nInterval = 0;
+ int nInterval = 0;
- size_t nPos = strQuery.find("interval=");
- if ( nPos != String::npos )
- {
- String strInterval = strQuery.substr(nPos+9);
- nInterval = atoi(strInterval.c_str());
- } else {
- LOG(WARNING) + "Unable to find 'interval' parameter";
- }
- nInterval = rho_sync_set_pollinterval(nInterval);
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+
+ size_t nPos = strQuery.find("interval=");
+ if ( nPos != String::npos )
+ {
+ String strInterval = strQuery.substr(nPos+9);
+ nInterval = atoi(strInterval.c_str());
+ } else {
+ LOG(WARNING) + "Unable to find 'interval' parameter";
+ }
+ // nInterval = rho_sync_set_pollinterval(nInterval);
+ nInterval = rho::sync::RhoconnectClientManager::set_pollinterval(nInterval);
+
+ }
rho_http_sendresponse(arg, convertToStringA(nInterval).c_str());
}
static void callback_get_pollinterval(void *arg, String const &strQuery)
{
- rho_http_sendresponse(arg, convertToStringA(rho_sync_get_pollinterval()).c_str());
+ String interval = "";
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ interval = convertToStringA(rho::sync::RhoconnectClientManager::get_pollinterval());
+ }
+
+// rho_http_sendresponse(arg, convertToStringA(rho_sync_get_pollinterval()).c_str());
+ rho_http_sendresponse(arg, interval.c_str());
}
static void callback_set_syncserver(void *arg, String const &strQuery)
{
- String strSyncserver = "";
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
- size_t nPos = strQuery.find("syncserver=");
- if ( nPos != String::npos )
- {
- strSyncserver = rho::net::URI::urlDecode(strQuery.substr(nPos+11));
- } else {
- LOG(WARNING) + "Unable to find 'syncserver' parameter";
- }
- rho_sync_set_syncserver(strSyncserver.c_str());
+ String strSyncserver = "";
+
+ size_t nPos = strQuery.find("syncserver=");
+ if ( nPos != String::npos )
+ {
+ strSyncserver = rho::net::URI::urlDecode(strQuery.substr(nPos+11));
+ } else {
+ LOG(WARNING) + "Unable to find 'syncserver' parameter";
+ }
+ // rho_sync_set_syncserver(strSyncserver.c_str());
+ rho::sync::RhoconnectClientManager::set_syncserver(strSyncserver.c_str());
+ }
rho_http_sendresponse(arg, "ok");
}
static void callback_set_pagesize(void *arg, String const &strQuery)
{
int nSize = 0;
+ int nOldSize = 0;
+
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+ size_t nPos = strQuery.find("pagesize=");
+ if ( nPos != String::npos )
+ {
+ String strSize = strQuery.substr(nPos+9);
+ nSize = atoi(strSize.c_str());
+ } else {
+ LOG(WARNING) + "Unable to find 'pagesize' parameter";
+ }
+
+ nOldSize = rho::sync::RhoconnectClientManager::get_pagesize();
+ rho::sync::RhoconnectClientManager::set_pagesize(nSize);
+
+ // int nOldSize = rho_sync_get_pagesize();
+ // rho_sync_set_pagesize(nSize);
+
+ }
- size_t nPos = strQuery.find("pagesize=");
- if ( nPos != String::npos )
- {
- String strSize = strQuery.substr(nPos+9);
- nSize = atoi(strSize.c_str());
- } else {
- LOG(WARNING) + "Unable to find 'pagesize' parameter";
- }
- int nOldSize = rho_sync_get_pagesize();
- rho_sync_set_pagesize(nSize);
rho_http_sendresponse(arg, convertToStringA(nOldSize).c_str());
}
static void callback_get_pagesize(void *arg, String const &strQuery)
{
- rho_http_sendresponse(arg, convertToStringA(rho_sync_get_pagesize()).c_str());
+ int size = 0;
+
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ size = rho::sync::RhoconnectClientManager::get_pagesize();
+ }
+// rho_http_sendresponse(arg, convertToStringA(rho_sync_get_pagesize()).c_str());
+ rho_http_sendresponse(arg, convertToStringA(size).c_str());
}
static void callback_get_lastsync_objectcount(void *arg, String const &strQuery)
{
int nSrcId = -1;
int nCount = -1;
+
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
- size_t nPos = strQuery.find("srcName=");
- if ( nPos != String::npos )
- {
- String strSrcId = strQuery.substr(nPos+8);
- LOG(INFO) + "srcName = '" + strSrcId + "'";
- nSrcId = atoi(strSrcId.c_str());
- nCount = rho_sync_get_lastsync_objectcount(nSrcId);
- } else {
- LOG(WARNING) + "Unable to find 'srcName' parameter";
- }
+ size_t nPos = strQuery.find("srcName=");
+ if ( nPos != String::npos )
+ {
+ String strSrcId = strQuery.substr(nPos+8);
+ LOG(INFO) + "srcName = '" + strSrcId + "'";
+ nSrcId = atoi(strSrcId.c_str());
+ // nCount = rho_sync_get_lastsync_objectcount(nSrcId);
+ nCount = rho::sync::RhoconnectClientManager::get_lastsync_objectcount(nSrcId);
+ } else {
+ LOG(WARNING) + "Unable to find 'srcName' parameter";
+ }
+ }
rho_http_sendresponse(arg, convertToStringA(nCount).c_str());
}
static void callback_is_syncing(void *arg, String const &strQuery)
{
- rho_http_sendresponse(arg, rho_sync_issyncing() ? "true" : "false");
+ bool haveclient = rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl();
+ // rho_http_sendresponse(arg, rho_sync_issyncing() ? "true" : "false");
+ rho_http_sendresponse(arg, ( haveclient && rho::sync::RhoconnectClientManager::issyncing() ) ? "true" : "false");
}
static void callback_enable_status_popup(void *arg, String const &strQuery)
{
- size_t nPos = strQuery.find("enable=");
- if ( nPos != String::npos )
- {
- String strEnable = strQuery.substr(nPos+7);
- rho_sync_enable_status_popup(strEnable == "true" ? 2 : 0);
- } else {
- LOG(WARNING) + "Unable to find 'enable' parameter";
- }
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+ size_t nPos = strQuery.find("enable=");
+ if ( nPos != String::npos )
+ {
+ String strEnable = strQuery.substr(nPos+7);
+ // rho_sync_enable_status_popup(strEnable == "true" ? 2 : 0);
+ rho::sync::RhoconnectClientManager::enable_status_popup(strEnable == "true" ? 2 : 0);
+ } else {
+ LOG(WARNING) + "Unable to find 'enable' parameter";
+ }
+ }
rho_http_sendresponse(arg, "ok");
}
static void callback_set_threaded_mode(void *arg, String const &strQuery)
{
- size_t nPos = strQuery.find("threaded=");
- if ( nPos != String::npos )
- {
- String strThreaded = strQuery.substr(nPos+9);
- rho_sync_set_threaded_mode(strThreaded == "true" ? 2 : 0);
- } else {
- LOG(WARNING) + "Unable to find 'threaded' parameter";
- }
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+ size_t nPos = strQuery.find("threaded=");
+ if ( nPos != String::npos )
+ {
+ String strThreaded = strQuery.substr(nPos+9);
+ // rho_sync_set_threaded_mode(strThreaded == "true" ? 2 : 0);
+ rho::sync::RhoconnectClientManager::set_threaded_mode(strThreaded == "true" ? 2 : 0);
+ } else {
+ LOG(WARNING) + "Unable to find 'threaded' parameter";
+ }
+ }
rho_http_sendresponse(arg, "ok");
}
static void callback_register_push(void *arg, String const &strQuery)
{
- rho_sync_register_push();
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ // rho_sync_register_push();
+ rho::sync::RhoconnectClientManager::register_push();
+
+ }
rho_http_sendresponse(arg, "ok");
}
@@ -1017,14 +1096,18 @@ static void callback_set_source_property(void *arg, String const &strQuery)
static void callback_set_ssl_verify_peer(void *arg, String const &strQuery)
{
- size_t nPos = strQuery.find("verify=");
- if ( nPos != String::npos )
- {
- String strVerify = strQuery.substr(nPos+7);
- rho_sync_set_ssl_verify_peer(strVerify == "true" ? 2 : 0);
- } else {
- LOG(WARNING) + "Unable to find 'verify' parameter";
- }
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+ size_t nPos = strQuery.find("verify=");
+ if ( nPos != String::npos )
+ {
+ String strVerify = strQuery.substr(nPos+7);
+ // rho_sync_set_ssl_verify_peer(strVerify == "true" ? 2 : 0);
+ rho::sync::RhoconnectClientManager::set_ssl_verify_peer(strVerify == "true" ? 2 : 0);
+ } else {
+ LOG(WARNING) + "Unable to find 'verify' parameter";
+ }
+ }
rho_http_sendresponse(arg, "ok");
}
@@ -1036,14 +1119,20 @@ static void callback_update_blob_attribs(void *arg, String const &strQuery)
static void callback_set_objectnotify_url(void *arg, String const &strQuery)
{
- size_t nPos = strQuery.find("url=");
- if ( nPos != String::npos )
- {
- String strUrl = strQuery.substr(nPos+4);
- rho_sync_setobjectnotify_url(strUrl.c_str());
- } else {
- LOG(WARNING) + "Unable to find 'url' parameter";
- }
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+
+ size_t nPos = strQuery.find("url=");
+ if ( nPos != String::npos )
+ {
+ String strUrl = strQuery.substr(nPos+4);
+ // rho_sync_setobjectnotify_url(strUrl.c_str());
+ rho::sync::RhoconnectClientManager::setobjectnotify_url(strUrl.c_str());
+ } else {
+ LOG(WARNING) + "Unable to find 'url' parameter";
+ }
+
+ }
+
rho_http_sendresponse(arg, "ok");
}
@@ -1055,7 +1144,10 @@ static void callback_add_objectnotify(void *arg, String const &strQuery)
static void callback_clean_objectnotify(void *arg, String const &strQuery)
{
- rho_sync_cleanobjectnotify();
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ // rho_sync_cleanobjectnotify();
+ rho::sync::RhoconnectClientManager::cleanobjectnotify();
+ }
rho_http_sendresponse(arg, "ok");
}
@@ -1068,17 +1160,23 @@ static void callback_set_notification(void *arg, String const &strQuery)
static void callback_clear_notification(void *arg, String const &strQuery)
{
int nSrcId = -1;
+
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
- size_t nPos = strQuery.find("srcName=");
- if ( nPos != String::npos )
- {
- String strSrcId = strQuery.substr(nPos+8);
- LOG(INFO) + "srcName = '" + strSrcId + "'";
- nSrcId = atoi(strSrcId.c_str());
- rho_sync_clear_notification(nSrcId);
- } else {
- LOG(WARNING) + "Unable to find 'srcName' parameter";
- }
+ size_t nPos = strQuery.find("srcName=");
+ if ( nPos != String::npos )
+ {
+ String strSrcId = strQuery.substr(nPos+8);
+ LOG(INFO) + "srcName = '" + strSrcId + "'";
+ nSrcId = atoi(strSrcId.c_str());
+ // rho_sync_clear_notification(nSrcId);
+ rho::sync::RhoconnectClientManager::clear_notification(nSrcId);
+ } else {
+ LOG(WARNING) + "Unable to find 'srcName' parameter";
+ }
+
+ }
+
rho_http_sendresponse(arg, "ok");
}
@@ -1086,27 +1184,32 @@ static void callback_login(void *arg, String const &strQuery)
{
int nLevel = 0;
String strLogin, strPassword, strCallback;
+
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
- CTokenizer oTokenizer(strQuery, "&");
- while (oTokenizer.hasMoreTokens())
- {
- String tok = oTokenizer.nextToken();
- if (tok.length() == 0)
- continue;
+ CTokenizer oTokenizer(strQuery, "&");
+ while (oTokenizer.hasMoreTokens())
+ {
+ String tok = oTokenizer.nextToken();
+ if (tok.length() == 0)
+ continue;
- if ( String_startsWith(tok, "login=") )
- {
- strLogin = tok.substr(6);
- }else if ( String_startsWith( tok, "password=") )
- {
- strPassword = tok.substr(9);
- }else if ( String_startsWith( tok, "callback=") )
- {
- strCallback = rho::net::URI::urlDecode(tok.substr(9));
- }
- }
+ if ( String_startsWith(tok, "login=") )
+ {
+ strLogin = tok.substr(6);
+ }else if ( String_startsWith( tok, "password=") )
+ {
+ strPassword = tok.substr(9);
+ }else if ( String_startsWith( tok, "callback=") )
+ {
+ strCallback = rho::net::URI::urlDecode(tok.substr(9));
+ }
+ }
- rho_sync_login(strLogin.c_str(), strPassword.c_str(), strCallback.c_str());
+// rho_sync_login(strLogin.c_str(), strPassword.c_str(), strCallback.c_str());
+ rho::sync::RhoconnectClientManager::login(strLogin.c_str(), strPassword.c_str(), strCallback.c_str());
+ }
+
rho_http_sendresponse(arg, "ok");
}
@@ -1184,6 +1287,7 @@ void CRhodesApp::initHttpServer()
m_httpServer->register_uri("/system/syncengine/dosearch", callback_dosearch);
m_httpServer->register_uri("/system/syncengine/get_src_attrs", callback_get_src_attrs);
m_httpServer->register_uri("/system/syncengine/is_blob_attr", callback_is_blob_attr);
+
}
const char* CRhodesApp::getFreeListeningPort()
@@ -1708,7 +1812,11 @@ void CRhodesApp::loadUrl(String url)
return;
}else if ( strcasecmp(url.c_str(), "sync")==0 )
{
- rho_sync_doSyncAllSources(1,"",false);
+ if ( rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+ rho::sync::RhoconnectClientManager::doSyncAllSources(1,"",false);
+
+ }
+// rho_sync_doSyncAllSources(1,"",false);
return;
}
@@ -2236,3 +2344,13 @@ int rho_can_app_started_with_current_licence(const char* szMotorolaLicence, cons
} //extern "C"
+
+extern "C" void alert_show_status(const char* title, const char* message, const char* szHide);
+
+extern "C"
+{
+ void rho_alert_show_status(char* szTitle, char* szText, char* szHideLabel)
+ {
+ alert_show_status( szTitle ? szTitle : "", szText ? szText : "", szHideLabel ? szHideLabel : "");
+ }
+}
View
21 platform/shared/common/RhodesAppBase.cpp
@@ -28,9 +28,9 @@
#include "common/RhoFilePath.h"
#include "common/RhoFile.h"
#include "common/RhoConf.h"
-#include "sync/ClientRegister.h"
-#include "sync/SyncThread.h"
#include "unzip/unzip.h"
+#include "sync/RhoconnectClientManager.h"
+#include "net/INetRequest.h"
extern "C" void rho_net_request_with_data(const char *url, const char *str_body);
@@ -146,8 +146,13 @@ boolean CRhodesAppBase::isBaseUrl(const String& strUrl)
void rho_do_send_log(const String& strCallback)
{
- String strDevicePin = rho::sync::CClientRegister::Get()->getDevicePin();
- String strClientID = rho::sync::CSyncThread::getSyncEngine().readClientID();
+ if ( sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+
+// String strDevicePin = rho::sync::CClientRegister::Get()->getDevicePin();
+// String strClientID = rho::sync::CSyncThread::getSyncEngine().readClientID();
+
+ String strDevicePin = rho::sync::RhoconnectClientManager::clientRegisterGetDevicePin();
+ String strClientID = rho::sync::RhoconnectClientManager::syncEnineReadClientID();
String strLogUrl = RHOCONF().getPath("logserver");
if ( strLogUrl.length() == 0 )
@@ -165,7 +170,9 @@ void rho_do_send_log(const String& strCallback)
NetRequest oNetRequest;
oNetRequest.setSslVerifyPeer(false);
- NetResponse resp = getNetRequest(&oNetRequest).pushMultipartData( strQuery, oItem, &(rho::sync::CSyncThread::getSyncEngine()), null );
+// NetResponse resp = getNetRequest(&oNetRequest).pushMultipartData( strQuery, oItem, &(rho::sync::CSyncThread::getSyncEngine()), null );
+ NetResponse resp = getNetRequest(&oNetRequest).pushMultipartData( strQuery, oItem, rho::sync::RhoconnectClientManager::getRhoSession(), null );
+
LOGCONF().setLogToFile(bOldSaveToFile);
boolean isOK = true;
@@ -183,7 +190,9 @@ void rho_do_send_log(const String& strCallback)
rho_net_request_with_data(RHODESAPPBASE().canonicalizeRhoUrl(strCallback).c_str(), body);
}
- RHODESAPPBASE().setSendingLog(false);
+ RHODESAPPBASE().setSendingLog(false);
+
+ }
}
View
8 platform/shared/common/iphone/RhoClassFactory.cpp
@@ -25,8 +25,7 @@
*------------------------------------------------------------------------*/
#include "RhoClassfactory.h"
-#include "sync/SyncThread.h"
-#include "sync/ClientRegister.h"
+#include "sync/RhoconnectClientManager.h"
static rho::common::CRhoClassFactory g_oRhoClassFactory;
rho::common::IRhoClassFactory* rho_get_RhoClassFactory()
@@ -38,7 +37,10 @@ extern "C" {
void rho_clientregister_create(const char* szDevicePin)
{
- rho::sync::CClientRegister::Create(szDevicePin);
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
+ rho::sync::RhoconnectClientManager::clientRegisterCreate(szDevicePin);
+ }
+// rho::sync::CClientRegister::Create(szDevicePin);
}
};
View
8 platform/shared/db/DBAdapter.cpp
@@ -25,8 +25,7 @@
*------------------------------------------------------------------------*/
#include "DBAdapter.h"
-#include "sync/SyncThread.h"
-#include "sync/SyncEngine.h"
+#include "sync/RhoconnectClientManager.h"
#include "common/RhoFile.h"
#include "common/RhoFilePath.h"
@@ -766,6 +765,7 @@ void CDBAdapter::copyChangedValues(CDBAdapter& db)
void CDBAdapter::setBulkSyncDB(String fDataName, String strCryptKey)
{
+ if (rho::sync::RhoconnectClientManager::haveRhoconnectClientImpl()) {
CDBAdapter db(m_strDbPartition.c_str(), true);
db.setCryptKey(strCryptKey);
db.open( fDataName, m_strDbVer, true, false );
@@ -777,7 +777,8 @@ void CDBAdapter::setBulkSyncDB(String fDataName, String strCryptKey)
copyChangedValues(db);
getDBPartitions().put(m_strDbPartition.c_str(), &db);
- sync::CSyncThread::getSyncEngine().applyChangedValues(db);
+// sync::CSyncThread::getSyncEngine().applyChangedValues(db);
+ rho::sync::RhoconnectClientManager::syncEngineApplyChangedValues(db);
getDBPartitions().put(m_strDbPartition.c_str(), this);
db.endTransaction();
@@ -792,6 +793,7 @@ void CDBAdapter::setBulkSyncDB(String fDataName, String strCryptKey)
CRhoFile::renameFile(fDataName.c_str(),dbOldName.c_str());
setCryptKey(strCryptKey);
open( dbOldName, m_strDbVer, false, false );
+ }
}
void CDBAdapter::setImportDB(String fDataName, String strCryptKey)
View
33 platform/shared/db/DBImportTransaction.cpp
@@ -13,7 +13,7 @@
#include "common/RhoFilePath.h"
#include "common/Tokenizer.h"
#include "common/RhoAppAdapter.h"
-#include "sync/SyncThread.h"
+//#include "sync/SyncThread.h"
using namespace rho::common;
@@ -46,10 +46,14 @@ namespace db {
//DBLock lock(_db);
switch (_state) {
- case txnNotStarted:
+ case txnNotStarted:
+ LOG(INFO) + "CDBImportTransaction::commit - txnNotStarted";
+
setTxnState(txnPrepareImportData);
//no break here is intentional
- case txnPrepareImportData:
+ case txnPrepareImportData:
+ LOG(INFO) + "CDBImportTransaction::commit - txnPrepareImportData";
+
if (!prepareImportData() ) {
LOG(ERROR) + "Error in prepare import data";
return false;
@@ -57,6 +61,8 @@ namespace db {
setTxnState(txnEnumerateOldBlobs);
//no break here is intentional
case txnEnumerateOldBlobs:
+ LOG(INFO) + "CDBImportTransaction::commit - txnEnumerateOldBlobs";
+
if (!enumerateOldBlobs()) {
LOG(ERROR) + "Can't enumerate old blobs";
return false;
@@ -64,6 +70,8 @@ namespace db {
setTxnState(txnBackupOldDb);
//no break here is intentional
case txnBackupOldDb:
+ LOG(INFO) + "CDBImportTransaction::commit - txnBackupOldDb";
+
if (!backupOldDb()) {
LOG(ERROR) + "Can't backup old DB";
return false;
@@ -71,6 +79,8 @@ namespace db {
setTxnState(txnBackupOldBlobs);
//no break here is intentional
case txnBackupOldBlobs:
+ LOG(INFO) + "CDBImportTransaction::commit - txnBackupOldBlobs";
+
if (!backupOldBlobs()) {
LOG(ERROR) + "Can't backup old blobs";
return false;
@@ -78,6 +88,8 @@ namespace db {
setTxnState(txnImportNewDb);
//no break here is intentional
case txnImportNewDb:
+ LOG(INFO) + "CDBImportTransaction::commit - txnImportNewDb";
+
if (!importNewDb()) {
LOG(ERROR) + "Can't import new DB";
return false;
@@ -85,6 +97,8 @@ namespace db {
setTxnState(txnImportNewBlobs);
//no break here is intentional
case txnImportNewBlobs:
+ LOG(INFO) + "CDBImportTransaction::commit - txnImportNewBlobs";
+
if (!importNewBlobs()) {
LOG(ERROR) + "Can't import new blobs";
return false;
@@ -92,6 +106,8 @@ namespace db {
setTxnState(txnCleanup);
//no break here is intentional
case txnCleanup:
+ LOG(INFO) + "CDBImportTransaction::commit - txnCleanup";
+
cleanup();
//if (!cleanup()) {
// LOG(ERROR) + "Can't cleanup";
@@ -103,6 +119,8 @@ namespace db {
return false;
}
+ LOG(INFO) + "CDBImportTransaction::commit - OK";
+
return true;
}
@@ -165,21 +183,30 @@ namespace db {
extern "C" int rho_sys_unzip_file(const char* szZipPath, const char* psw);
bool CDBImportTransaction::prepareImportData() {
+ LOG(INFO) + "CDBImportTransaction::prepareImportData";
+
if ( (!CRhoFile::isDirectory(_importDirPath.c_str())) && (CRhoFile::createFolder(_importDirPath.c_str())!=0) ) {
LOG(ERROR) + "Can't create import data dir: " + _importDirPath;
return false;
}
+ LOG(INFO) + "CDBImportTransaction::prepareImportData - import dir OK: " + _importDirPath;
+
+
if ( CRhoFile::copyFile(_srcZipPath.c_str(), _importZipPath.c_str())!=0 ) {
LOG(ERROR) + "Can't copy import data file " + _srcZipPath + " to import dir: " + _importZipPath;
return false;
}
+ LOG(INFO) + "CDBImportTransaction::prepareImportData - import DB successfully copied to " + _importZipPath;
+
if ( rho_sys_unzip_file(_importZipPath.c_str(), 0)!=0 ) {
LOG(ERROR) + "Can't unzip import data";
return false;
}
+ LOG(INFO) + "CDBImportTransaction::prepareImportData - unzip import data OK";
+
return true;
}
View
11 platform/shared/net/HttpServer.cpp
@@ -31,6 +31,7 @@
#include "net/URI.h"
#include "ruby/ext/rho/rhoruby.h"
#include "common/Tokenizer.h"
+#include "sync/RhoconnectClientManager.h"
#include <algorithm>
@@ -72,7 +73,7 @@ typedef unsigned __int16 uint16_t;
#undef DEFAULT_LOGCATEGORY
#define DEFAULT_LOGCATEGORY "HttpServer"
-extern "C" void rho_sync_addobjectnotify_bysrcname(const char* szSrcName, const char* szObject);
+//extern "C" void rho_sync_addobjectnotify_bysrcname(const char* szSrcName, const char* szObject);
namespace rho
{
@@ -1229,8 +1230,12 @@ bool CHttpServer::decide(String const &method, String const &arg_uri, String con
if (method == "GET")
rho_rhodesapp_keeplastvisitedurl(uri.c_str());
- if (!route.id.empty())
- rho_sync_addobjectnotify_bysrcname(route.model.c_str(), route.id.c_str());
+ if ( sync::RhoconnectClientManager::haveRhoconnectClientImpl() ) {
+
+ if (!route.id.empty()) {
+ sync::RhoconnectClientManager::rho_sync_addobjectnotify_bysrcname(route.model.c_str(), route.id.c_str());
+ }
+ }
return true;
}
View
1  platform/shared/ruby/Android.mk
@@ -51,7 +51,6 @@ LOCAL_SRC_FILES := \
ext/sqlite3_api/sqlite3_api_wrap.c \
ext/stringio/stringio.c \
ext/strscan/strscan.c \
- ext/syncengine/syncengine_wrap.c \
ext/system/system_wrap.c \
ext/webview/webview_wrap.c \
file.c \
View
36 platform/shared/ruby/ext/rho/rhoruby.c
@@ -48,7 +48,6 @@
extern void Init_strscan();
extern void Init_sqlite3_api();
extern void Init_GeoLocation(void);
-extern void Init_SyncEngine(void);
extern void print_profile_report();
extern void enable_gc_profile(void);
extern void Init_System(void);
@@ -227,13 +226,12 @@ void RhoRubyStart()
#endif
#if !defined(OS_WP8)
-
- Init_strscan();
+
+ Init_strscan();
+ Init_stringio();
Init_sqlite3_api();
Init_GeoLocation();
- Init_SyncEngine();
Init_AsyncHttp();
- Init_System();
Init_Phonebook();
Init_WebView();
Init_RhoConf();
@@ -243,32 +241,30 @@ void RhoRubyStart()
#else
Init_SignatureCapture();
#endif
-
+
+ Init_System();
Init_RhoBluetooth();
Init_RhodesNativeViewManager();
- Init_Camera();
- Init_stringio();
+ Init_Camera();
Init_DateTimePicker();
- Init_NativeBar();
- Init_RhoSupport();
+ Init_NativeBar();
Init_MapView();
Init_RingtoneManager();
Init_socket();
Init_NavBar();
Init_RhoEvent();
Init_Calendar();
+#endif //OS_WP8
+
+ Init_RhoSupport();
+ Init_RhoConf();
+
+#if !defined(OS_WP8)
//TODO: RhoSimulator - load extensions dll dynamically
#if !defined(RHO_SYMBIAN)
Init_Extensions();
#endif //RHO_SYMBIAN
-
-#else // OS_WP8 is set
- Init_sqlite3_api();
- Init_strscan();
- Init_RhoSupport();
- Init_RhoConf();
- Init_SyncEngine();
#endif //OS_WP8
@@ -289,11 +285,7 @@ void RhoRubyStart()
framework = rb_const_get(rb_cObject,rb_intern("RHO_FRAMEWORK"));
#else
{
- VALUE res = rho_ruby_disable_gc();
-
-#if defined(OS_WP8) // temporary constant for wp8 development
- rb_const_set(rb_cObject, rb_intern("RHO_WP8"), Qtrue);
-#endif // OS_WP8
+ VALUE res = rho_ruby_disable_gc();
require_compiled(rb_str_new2("rhoframework"), &framework );
rho_ruby_enable_gc(res);
}
View
125 platform/shared/ruby/ext/syncengine/syncengine.i
@@ -1,125 +0,0 @@
-/* syncengine.i */
-%module SyncEngine
-%{
-/* Put header files here or function declarations like below */
- #define dosync rho_sync_doSyncAllSources
- extern VALUE rho_sync_doSyncAllSources(int show_status_popup, const char * query_params, int sync_only_changed_sources);
- #define dosync_source rho_sync_doSyncSource
- extern VALUE rho_sync_doSyncSource(VALUE source_id,int show_status_popup, const char * query_params);
- #define dosearch rho_sync_doSearch
- extern VALUE rho_sync_doSearch(VALUE ar_sources, const char *from, const char *params, int sync_changes, int nProgressStep, const char* callback, const char* callback_params);
- extern VALUE rho_sync_login(const char *login, const char *password, const char* callback);
- #define login rho_sync_login
- extern int rho_sync_logged_in();
- #define logged_in rho_sync_logged_in
- extern void rho_sync_logout();
- #define logout rho_sync_logout
- extern void rho_sync_stop();
- #define stop_sync rho_sync_stop
- extern void rho_sync_set_notification(int source_id, const char *url, char* params);
- #define set_notification rho_sync_set_notification
- extern void rho_sync_clear_notification(int source_id);
- #define clear_notification rho_sync_clear_notification
- extern int rho_sync_set_pollinterval(int interval);
- #define set_pollinterval rho_sync_set_pollinterval
- extern int rho_sync_get_pollinterval();
- #define get_pollinterval rho_sync_get_pollinterval
-
- extern void rho_sync_set_syncserver(char* syncserver);
- #define set_syncserver rho_sync_set_syncserver
- extern VALUE rho_sync_get_attrs(const char* szPartition, int source_id);
- #define get_src_attrs rho_sync_get_attrs
- extern VALUE rho_sync_is_blob_attr(const char* szPartition, int source_id, const char* szAttrName);
- #define is_blob_attr rho_sync_is_blob_attr
-
- extern void rho_sync_update_blob_attribs(const char* szPartition, int source_id);
- #define update_blob_attribs rho_sync_update_blob_attribs
-
- extern void rho_sync_setobjectnotify_url(const char* szUrl);
- #define set_objectnotify_url rho_sync_setobjectnotify_url
- extern void rho_sync_addobjectnotify(int nSrcID, const char* szObject);
- #define add_objectnotify rho_sync_addobjectnotify
- extern void rho_sync_cleanobjectnotify();
- #define clean_objectnotify rho_sync_cleanobjectnotify
-
- extern int rho_sync_get_lastsync_objectcount(int nSrcID);
- #define get_lastsync_objectcount rho_sync_get_lastsync_objectcount
-
- extern int rho_sync_get_pagesize();
- #define get_pagesize rho_sync_get_pagesize
-
- extern void rho_sync_set_pagesize(int pagesize);
- #define set_pagesize rho_sync_set_pagesize
-
- extern void rho_sync_set_bulk_notification(const char *url, char* params);
- #define set_bulk_notification rho_sync_set_bulk_notification
- extern void rho_sync_clear_bulk_notification();
- #define clear_bulk_notification rho_sync_clear_bulk_notification
- extern void rho_sync_set_threaded_mode(int b);
- #define set_threaded_mode rho_sync_set_threaded_mode
-
- extern void rho_sync_enable_status_popup(int b);
- #define enable_status_popup rho_sync_enable_status_popup
-
- extern void rho_sync_set_source_property(int nSrcID, const char* szPropName, const char* szPropValue);
- #define set_source_property rho_sync_set_source_property
-
- extern VALUE rho_sync_get_source_property(int nSrcID, const char* szPropName);
- #define get_source_property rho_sync_get_source_property
-
- extern void rho_sync_set_ssl_verify_peer(int b);
- #define set_ssl_verify_peer rho_sync_set_ssl_verify_peer
-
- extern VALUE rho_sync_is_syncing();
- #define is_syncing rho_sync_is_syncing
-
- extern VALUE rho_sync_register_push();
- #define register_push rho_sync_register_push
-
- #if !defined(bool)
- #define bool int
- #define true 1
- #define false 0
- #endif
-%}
-
-%typemap(default) bool show_status_popup {
- $1 = 1;
-}
-
-%typemap(default) const char * query_params {
- $1 = 0;
-}
-
-%typemap(default) bool sync_only_changed_sources {
- $1 = 0;
-}
-
-extern VALUE dosync(bool show_status_popup, const char * query_params,bool sync_only_changed_sources);
-extern VALUE dosync_source(VALUE source_id, bool show_status_popup, const char * query_params);
-extern VALUE dosearch(VALUE ar_sources, const char *from, const char *params, bool sync_changes, int nProgressStep, const char* callback, const char* callback_params);
-extern VALUE login(const char *login, const char *password, const char* callback);
-extern int logged_in();
-extern void logout();
-extern void stop_sync();
-extern void set_notification(int source_id, const char *url, char* params);
-extern void clear_notification(int source_id);
-extern int set_pollinterval(int interval);
-extern int get_pollinterval();
-extern void set_syncserver(char* syncserver);
-extern VALUE get_src_attrs(const char* szPartition, int source_id);
-extern VALUE is_blob_attr(const char* szPartition, int source_id, const char* szAttrName);
-extern void set_objectnotify_url(const char* szUrl);
-extern void add_objectnotify(int nSrcID, const char* szObject);
-extern void clean_objectnotify();
-extern int get_lastsync_objectcount(int nSrcID);
-extern int get_pagesize();
-extern void set_pagesize(int pagesize);
-extern void set_threaded_mode(bool b);
-extern void enable_status_popup(bool b);
-extern void set_source_property(int nSrcID, const char* szPropName, const char* szPropValue);
-extern VALUE get_source_property(int nSrcID, const char* szPropName);
-extern void set_ssl_verify_peer(bool b);
-extern void update_blob_attribs(const char* szPartition, int source_id);
-extern VALUE is_syncing();
-extern void register_push();
View
3,208 platform/shared/ruby/ext/syncengine/syncengine_wrap.c
@@ -1,3208 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.8
- *
- * This file is not intended to be easily readable and contains a number of
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG
- * interface file instead.
- * ----------------------------------------------------------------------------- */
-
-#define SWIGRUBY
-
-/* -----------------------------------------------------------------------------
- * This section contains generic SWIG labels for method/variable
- * declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-# define SWIGINLINE inline
-# else
-# define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-#endif
-
-#ifndef SWIG_MSC_UNSUPPRESS_4505
-# if defined(_MSC_VER)
-# pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-# define SWIGUNUSEDPARM(p)
-# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# ifndef GCC_HASCLASSVISIBILITY
-# define GCC_HASCLASSVISIBILITY
-# endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT
-# else
-# define SWIGEXPORT __declspec(dllexport)
-# endif
-# else
-# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-# define SWIGEXPORT __attribute__ ((visibility("default")))
-# else
-# define SWIGEXPORT
-# endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# define SWIGSTDCALL __stdcall
-# else
-# define SWIGSTDCALL
-# endif
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * This section contains generic SWIG labels for method/variable
- * declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-# define SWIGINLINE inline
-# else
-# define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-#endif
-
-#ifndef SWIG_MSC_UNSUPPRESS_4505
-# if defined(_MSC_VER)
-# pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-# define SWIGUNUSEDPARM(p)
-# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# ifndef GCC_HASCLASSVISIBILITY
-# define GCC_HASCLASSVISIBILITY
-# endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT
-# else
-# define SWIGEXPORT __declspec(dllexport)
-# endif
-# else
-# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-# define SWIGEXPORT __attribute__ ((visibility("default")))
-# else
-# define SWIGEXPORT
-# endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# define SWIGSTDCALL __stdcall
-# else
-# define SWIGSTDCALL
-# endif
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic C API SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
- or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
- You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
- creating a static or dynamic library from the SWIG runtime code.
- In 99.9% of the cases, SWIG just needs to declare them as 'static'.
-
- But only do this if strictly necessary, ie, if you have problems
- with your compiler or suchlike.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/* Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN 0x1
-
-
-/*
- Flags/methods for returning states.
-
- The SWIG conversion methods, as ConvertPtr, return an integer
- that tells if the conversion was successful or not. And if not,
- an error code can be returned (see swigerrors.swg for the codes).
-
- Use the following macros/flags to set or process the returning
- states.
-
- In old versions of SWIG, code such as the following was usually written:
-
- if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
- // success code
- } else {
- //fail code
- }
-
- Now you can be more explicit:
-
- int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- } else {
- // fail code
- }
-
- which is the same really, but now you can also do
-
- Type *ptr;
- int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- if (SWIG_IsNewObj(res) {
- ...
- delete *ptr;
- } else {
- ...
- }
- } else {
- // fail code
- }
-
- I.e., now SWIG_ConvertPtr can return new objects and you can
- identify the case and take care of the deallocation. Of course that
- also requires SWIG_ConvertPtr to return new result values, such as
-
- int SWIG_ConvertPtr(obj, ptr,...) {
- if (<obj is ok>) {
- if (<need new object>) {
- *ptr = <ptr to new allocated object>;
- return SWIG_NEWOBJ;
- } else {
- *ptr = <ptr to old object>;
- return SWIG_OLDOBJ;
- }
- } else {
- return SWIG_BADOBJ;
- }
- }
-
- Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
- more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
- SWIG errors code.
-
- Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
- allows to return the 'cast rank', for example, if you have this
-
- int food(double)
- int fooi(int);
-
- and you call
-
- food(1) // cast rank '1' (1 -> 1.0)
- fooi(1) // cast rank '0'
-
- just use the SWIG_AddCast()/SWIG_CheckState()
-*/
-
-#define SWIG_OK (0)
-#define SWIG_ERROR (-1)
-#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
-#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
-/* Simple returning values */
-#define SWIG_BADOBJ (SWIG_ERROR)
-#define SWIG_OLDOBJ (SWIG_OK)
-#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
-#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
-#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
-#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
-#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
-#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
-#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
-#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
-
-/* Cast-Rank Mode */
-#if defined(SWIG_CASTRANK_MODE)
-# ifndef SWIG_TypeRank
-# define SWIG_TypeRank unsigned long
-# endif
-# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
-# define SWIG_MAXCASTRANK (2)
-# endif
-# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
-# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) {
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
-}
-SWIGINTERNINLINE int SWIG_CheckState(int r) {
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
-}
-#else /* no cast-rank mode */
-# define SWIG_AddCast
-# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
-#endif
-
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
-
-/* Structure to store information on one type */
-typedef struct swig_type_info {
- const char *name; /* mangled name of this type */
- const char *str; /* human readable name of this type */
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
- void *clientdata; /* language specific type data */
- int owndata; /* flag if the structure owns the clientdata */
-} swig_type_info;
-
-/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
- swig_type_info *type; /* pointer to type that is equivalent to this type */
- swig_converter_func converter; /* function to cast the void pointers */
- struct swig_cast_info *next; /* pointer to next cast in linked list */
- struct swig_cast_info *prev; /* pointer to the previous cast */
-} swig_cast_info;
-
-/* Structure used to store module information
- * Each module generates one structure like this, and the runtime collects
- * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
- size_t size; /* Number of types in this module */
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
- swig_type_info **type_initial; /* Array of initially generated type structures */
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
- void *clientdata; /* Language specific module data */
-} swig_module_info;
-
-/*
- Compare two type names skipping the space characters, therefore
- "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-
- Return 0 when the two name types are equivalent, as in
- strncmp, but skipping ' '.
-*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
- const char *f2, const char *l2) {
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
- }
- return (int)((l1 - f1) - (l2 - f2));
-}
-
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- Return 0 if not equal, 1 if equal
-*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
-
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- Return 0 if equal, -1 if nb < tb, 1 if nb > tb
-*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
-
-
-/*
- Check the typename
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
- if (ty) {
- swig_cast_info *iter = ty->cast;
- while (iter) {
- if (strcmp(iter->type->name, c) == 0) {
- if (iter == ty->cast)
- return iter;
- /* Move iter to the top of the linked list */
- iter->prev->next = iter->next;
- if (iter->next)
- iter->next->prev = iter->prev;
- iter->next = ty->cast;
- iter->prev = 0;
- if (ty->cast) ty->cast->prev = iter;
- ty->cast = iter;
- return iter;
- }
- iter = iter->next;
- }
- }
- return 0;
-}
-
-/*
- Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
- if (ty) {
- swig_cast_info *iter = ty->cast;
- while (iter) {
- if (iter->type == from) {
- if (iter == ty->cast)
- return iter;
- /* Move iter to the top of the linked list */
- iter->prev->next = iter->next;
- if (iter->next)
- iter->next->prev = iter->prev;
- iter->next = ty->cast;
- iter->prev = 0;
- if (ty->cast) ty->cast->prev = iter;
- ty->cast = iter;
- return iter;
- }
- iter = iter->next;
- }
- }
- return 0;
-}
-
-/*
- Cast a pointer up an inheritance hierarchy
-*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
-
-/*
- Dynamic pointer casting. Down an inheritance hierarchy
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast) return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast)(ptr);
- if (ty) lastty = ty;
- }
- return lastty;
-}
-
-/*
- Return the name associated with this type
-*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
- return ty->name;
-}
-
-/*
- Return the pretty name associated with this type,
- that is an unmangled type name in a form presentable to the user.
-*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
- /* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
- if (!type) return NULL;
- if (type->str != NULL) {
- const char *last_name = type->str;
- const char *s;
- for (s = type->str; *s; s++)
- if (*s == '|') last_name = s+1;
- return last_name;
- }
- else
- return type->name;
-}
-
-/*
- Set the clientdata field for a type
-*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_cast_info *cast = ti->cast;
- /* if (ti->clientdata == clientdata) return; */
- ti->clientdata = clientdata;
-
- while (cast) {
- if (!cast->converter) {
- swig_type_info *tc = cast->type;
- if (!tc->clientdata) {
- SWIG_TypeClientData(tc, clientdata);
- }
- }
- cast = cast->next;
- }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
- SWIG_TypeClientData(ti, clientdata);
- ti->owndata = 1;
-}
-
-/*
- Search for a swig_type_info structure only by mangled name
- Search is a O(log #types)
-
- We start searching at module start, and finish searching when start == end.
- Note: if start == end at the beginning of the function, we go all the way around
- the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- swig_module_info *iter = start;
- do {
- if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
- do {
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
- const char *iname = iter->types[i]->name;
- if (iname) {
- register int compare = strcmp(name, iname);
- if (compare == 0) {
- return iter->types[i];
- } else if (compare < 0) {
- if (i) {
- r = i - 1;
- } else {
- break;
- }
- } else if (compare > 0) {
- l = i + 1;
- }
- } else {
- break; /* should never happen */
- }
- } while (l <= r);
- }
- iter = iter->next;
- } while (iter != end);
- return 0;
-}
-
-/*
- Search for a swig_type_info structure for either a mangled name or a human readable name.
- It first searches the mangled names of the types, which is a O(log #types)
- If a type is not found it then searches the human readable names, which is O(#types).
-
- We start searching at module start, and finish searching when start == end.
- Note: if start == end at the beginning of the function, we go all the way around
- the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- /* STEP 1: Search the name field using binary search */
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
- if (ret) {
- return ret;
- } else {
- /* STEP 2: If the type hasn't been found, do a complete search
- of the str field (the human readable name) */
- swig_module_info *iter = start;
- do {
- register size_t i = 0;
- for (; i < iter->size; ++i) {
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
- return iter->types[i];
- }
- iter = iter->next;
- } while (iter != end);
- }
-
- /* neither found a match */
- return 0;
-}
-
-/*
- Pack binary data into a string
-*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
- static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register unsigned char uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
-}
-
-/*
- Unpack binary data from a string
-*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a'-10)) << 4);
- else
- return (char *) 0;
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a'-10));
- else
- return (char *) 0;
- *u = uu;
- }
- return c;
-}
-
-/*
- Pack 'void *' into a string buffer.
-*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
- char *r = buff;
- if ((2*sizeof(void *) + 2) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
- strcpy(r,name);
- return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- *ptr = (void *) 0;
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
-
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
- char *r = buff;
- size_t lname = (name ? strlen(name) : 0);
- if ((2*sz + 2 + lname) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);