rhodes 2.0.0.beta7 → 2.0.0.beta8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +20 -1
- data/bin/rhodes-setup +6 -2
- data/lib/extensions/digest/ext/Rakefile +2 -2
- data/lib/framework/rho/render.rb +2 -0
- data/lib/framework/rho/rho.rb +159 -95
- data/lib/framework/rho/rhoapplication.rb +24 -5
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom_model.rb +32 -23
- data/lib/framework/rhom/rhom_object_factory.rb +2 -2
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/jni/src/callbacks.cpp +8 -1
- data/platform/android/Rhodes/jni/src/mapview.cpp +4 -1
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +5 -1
- data/platform/android/Rhodes/jni/src/webview.cpp +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +3 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeLibraries.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NavBar.java +1 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +24 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +7 -2
- data/platform/android/build/android.rake +11 -38
- data/platform/android/build/androidcommon.rb +50 -2
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/android/build/libsqlite_build.files +1 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -1
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +1 -5
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +3 -6
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +4 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +12 -35
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +2 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.m +4 -4
- data/platform/iphone/Classes/NativeBar.m +12 -6
- data/platform/iphone/Classes/NavBar.m +1 -1
- data/platform/iphone/Classes/RhoMainView.h +4 -1
- data/platform/iphone/Classes/Rhodes.h +6 -2
- data/platform/iphone/Classes/Rhodes.m +23 -3
- data/platform/iphone/Classes/SimpleMainView.h +3 -7
- data/platform/iphone/Classes/SimpleMainView.m +108 -54
- data/platform/iphone/Classes/TabbedMainView.h +3 -2
- data/platform/iphone/Classes/TabbedMainView.m +21 -10
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/shared/common/IRhoClassFactory.h +1 -0
- data/platform/shared/common/RhodesApp.cpp +7 -2
- data/platform/shared/common/ThreadQueue.cpp +110 -0
- data/platform/shared/common/ThreadQueue.h +75 -0
- data/platform/shared/logging/RhoLogCat.h +4 -0
- data/platform/shared/net/AsyncHttp.cpp +134 -135
- data/platform/shared/net/AsyncHttp.h +74 -33
- data/platform/shared/net/HttpServer.cpp +7 -1
- data/platform/shared/ruby/thread.c +4 -0
- data/platform/shared/ruby/thread_win32.c +9 -8
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +26 -5
- data/platform/shared/rubyJVM/src/com/rho/net/INetworkAccess.java +0 -2
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +4 -13
- data/platform/shared/rubyJVM/src/com/rho/net/URI.java +2 -2
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +3 -3
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/ObjectFactory.java +12 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyString.java +6 -3
- data/platform/shared/rubyJVM/src/javolution/util/FastTable.java +12 -2
- data/platform/shared/sync/SyncEngine.cpp +15 -3
- data/platform/shared/sync/SyncEngine.h +1 -1
- data/platform/shared/sync/SyncThread.cpp +18 -101
- data/platform/shared/sync/SyncThread.h +30 -22
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/rhodes/Rhodes.cpp +143 -1
- data/platform/wm/rhodes/memory_helper.cpp +273 -0
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +1 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +46 -3
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +29 -1
- data/res/build-tools/db/syncdb.schema +1 -0
- data/res/generators/rhogen.rb +1 -1
- data/rhodes.gemspec +2 -2
- metadata +23 -6
- data/Manifest.txt +0 -5289
- data/rhobuild.yml +0 -37
|
@@ -4,60 +4,102 @@
|
|
|
4
4
|
|
|
5
5
|
#include "net/INetRequest.h"
|
|
6
6
|
#include "logging/RhoLog.h"
|
|
7
|
-
#include "common/
|
|
8
|
-
#include "common/IRhoClassFactory.h"
|
|
7
|
+
#include "common/ThreadQueue.h"
|
|
9
8
|
|
|
10
9
|
namespace rho
|
|
11
10
|
{
|
|
12
11
|
namespace net
|
|
13
12
|
{
|
|
14
13
|
|
|
15
|
-
class CAsyncHttp : public common::
|
|
14
|
+
class CAsyncHttp : public common::CThreadQueue
|
|
16
15
|
{
|
|
17
16
|
DEFINE_LOGCLASS;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
class CAsyncHttpResponse : public rho::ICallbackObject
|
|
19
|
+
{
|
|
20
|
+
common::CAutoPtr<INetResponse> m_pNetResponse;
|
|
21
|
+
String m_strContentType;
|
|
22
|
+
public:
|
|
23
|
+
CAsyncHttpResponse(INetResponse* pResp, const String& strContentType)
|
|
24
|
+
{
|
|
25
|
+
m_pNetResponse = pResp;
|
|
26
|
+
m_strContentType = strContentType;
|
|
27
|
+
}
|
|
28
|
+
~CAsyncHttpResponse();
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
virtual unsigned long getObjectValue();
|
|
31
|
+
|
|
32
|
+
};
|
|
27
33
|
|
|
28
|
-
String m_strUrl, m_strBody, m_strCallback, m_strCallbackParams;
|
|
29
|
-
String m_strFilePath;
|
|
30
|
-
String m_strResBody;
|
|
31
|
-
boolean m_sslVerifyPeer;
|
|
32
|
-
boolean m_bFinished;
|
|
33
34
|
public:
|
|
34
35
|
enum EHttpCommands{ hcGet = 0, hcPost, hcDownload, hcUpload };
|
|
36
|
+
|
|
37
|
+
class CHttpCommand : public CQueueCommand
|
|
38
|
+
{
|
|
39
|
+
public:
|
|
40
|
+
EHttpCommands m_eCmd;
|
|
41
|
+
String m_strUrl, m_strBody, m_strCallback, m_strCallbackParams;
|
|
42
|
+
String m_strFilePath;
|
|
43
|
+
boolean m_sslVerifyPeer;
|
|
44
|
+
Hashtable<String,String> m_mapHeaders;
|
|
45
|
+
|
|
46
|
+
common::CAutoPtr<INetRequest> m_pNetRequest;
|
|
47
|
+
String m_strResBody;
|
|
48
|
+
|
|
49
|
+
CHttpCommand(EHttpCommands eCmd,
|
|
50
|
+
const char* url, unsigned long headers, const char* body,
|
|
51
|
+
const char* file_path,
|
|
52
|
+
const char* callback, const char* callback_params, boolean ssl_verify_peer = true);
|
|
53
|
+
|
|
54
|
+
void execute();
|
|
55
|
+
void cancel();
|
|
56
|
+
|
|
57
|
+
void callNotify(INetResponse* pResp, int nError );
|
|
58
|
+
unsigned long getRetValue();
|
|
59
|
+
|
|
60
|
+
boolean equals(const CQueueCommand& cmd){ return false; }
|
|
61
|
+
|
|
62
|
+
String toString()
|
|
63
|
+
{
|
|
64
|
+
switch(m_eCmd)
|
|
65
|
+
{
|
|
66
|
+
case hcGet:
|
|
67
|
+
return "GET";
|
|
68
|
+
case hcPost:
|
|
69
|
+
return "POST";
|
|
70
|
+
case hcDownload:
|
|
71
|
+
return "Download";
|
|
72
|
+
case hcUpload:
|
|
73
|
+
return "Upload";
|
|
74
|
+
}
|
|
75
|
+
return "Unknown";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private:
|
|
79
|
+
String makeHeadersString();
|
|
80
|
+
|
|
81
|
+
};
|
|
82
|
+
|
|
35
83
|
private:
|
|
36
|
-
|
|
37
|
-
public:
|
|
84
|
+
static CAsyncHttp* m_pInstance;
|
|
38
85
|
|
|
39
|
-
|
|
86
|
+
CHttpCommand* m_pCurCmd;
|
|
40
87
|
|
|
41
|
-
|
|
42
|
-
const char* url, unsigned long headers, const char* body,
|
|
43
|
-
const char* file_path,
|
|
44
|
-
const char* callback, const char* callback_params, boolean ssl_verify_peer = true);
|
|
88
|
+
public:
|
|
45
89
|
|
|
46
|
-
|
|
90
|
+
static CAsyncHttp* Create();
|
|
91
|
+
static void Destroy();
|
|
92
|
+
static CAsyncHttp* getInstance(){ return m_pInstance; }
|
|
47
93
|
|
|
48
|
-
|
|
94
|
+
void cancelRequest(const char* szCallback, boolean bWait);
|
|
49
95
|
|
|
50
|
-
|
|
51
|
-
virtual unsigned long getObjectValue();
|
|
96
|
+
virtual void addQueueCommand(CQueueCommand* pCmd);
|
|
52
97
|
|
|
53
|
-
unsigned long getRetValue();
|
|
54
98
|
private:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
void callNotify(INetResponse& resp, int nError );
|
|
99
|
+
CAsyncHttp(common::IRhoClassFactory* factory);
|
|
100
|
+
~CAsyncHttp();
|
|
58
101
|
|
|
59
|
-
|
|
60
|
-
static void addNewObject(CAsyncHttp* pObj);
|
|
102
|
+
virtual void processCommand(CQueueCommand* pCmd);
|
|
61
103
|
};
|
|
62
104
|
|
|
63
105
|
} // namespace net
|
|
@@ -74,7 +116,6 @@ unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const c
|
|
|
74
116
|
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
|
75
117
|
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* body, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
|
76
118
|
void rho_asynchttp_cancel(const char* cancel_callback);
|
|
77
|
-
void rho_asynchttp_destroy();
|
|
78
119
|
|
|
79
120
|
#ifdef __cplusplus
|
|
80
121
|
};
|
|
@@ -333,6 +333,8 @@ CHttpServer::callback_t CHttpServer::registered(String const &uri)
|
|
|
333
333
|
return it->second;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
extern "C" void rb_gc(void);
|
|
337
|
+
|
|
336
338
|
bool CHttpServer::run()
|
|
337
339
|
{
|
|
338
340
|
if (m_listener == INVALID_SOCKET)
|
|
@@ -357,13 +359,17 @@ bool CHttpServer::run()
|
|
|
357
359
|
return false;
|
|
358
360
|
}
|
|
359
361
|
|
|
362
|
+
bool bProcessed = false;
|
|
360
363
|
if (!m_bPause){
|
|
361
364
|
RAWTRACE("Connection accepted, process it...");
|
|
362
|
-
process(conn);
|
|
365
|
+
bProcessed = process(conn);
|
|
363
366
|
}
|
|
364
367
|
|
|
365
368
|
RAWTRACE("Close connected socket");
|
|
366
369
|
closesocket(conn);
|
|
370
|
+
|
|
371
|
+
if ( bProcessed )
|
|
372
|
+
rb_gc();
|
|
367
373
|
}
|
|
368
374
|
|
|
369
375
|
return true;
|
|
@@ -190,10 +190,10 @@ typedef LPTHREAD_START_ROUTINE w32_thread_start_func;
|
|
|
190
190
|
static HANDLE
|
|
191
191
|
w32_create_thread(DWORD stack_size, w32_thread_start_func func, void *val)
|
|
192
192
|
{
|
|
193
|
-
return start_thread(0, stack_size
|
|
194
|
-
|
|
195
|
-
|STACK_SIZE_PARAM_IS_A_RESERVATION
|
|
196
|
-
|
|
193
|
+
return start_thread(0, 0/*stack_size*/, func, val, CREATE_SUSPENDED
|
|
194
|
+
//#ifdef _WIN32_WCE
|
|
195
|
+
// |STACK_SIZE_PARAM_IS_A_RESERVATION
|
|
196
|
+
//#endif
|
|
197
197
|
,0);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -587,25 +587,26 @@ timer_thread_func(void *dummy)
|
|
|
587
587
|
static void
|
|
588
588
|
rb_thread_create_timer_thread(void)
|
|
589
589
|
{
|
|
590
|
-
if (timer_thread_id == 0) {
|
|
590
|
+
/* if (timer_thread_id == 0) {
|
|
591
591
|
if (!timer_thread_lock) {
|
|
592
592
|
timer_thread_lock = CreateEvent(0, TRUE, FALSE, 0);
|
|
593
593
|
}
|
|
594
594
|
timer_thread_id = w32_create_thread(1024 + (THREAD_DEBUG ? BUFSIZ : 0),
|
|
595
595
|
timer_thread_func, 0);
|
|
596
596
|
w32_resume_thread(timer_thread_id);
|
|
597
|
-
}
|
|
597
|
+
}*/
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
static int
|
|
601
601
|
native_stop_timer_thread(void)
|
|
602
602
|
{
|
|
603
|
-
|
|
603
|
+
return 1;
|
|
604
|
+
/* int stopped = --system_working <= 0;
|
|
604
605
|
if (stopped) {
|
|
605
606
|
CloseHandle(timer_thread_lock);
|
|
606
607
|
timer_thread_lock = 0;
|
|
607
608
|
}
|
|
608
|
-
return stopped;
|
|
609
|
+
return stopped; */
|
|
609
610
|
}
|
|
610
611
|
|
|
611
612
|
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
|
|
@@ -27,8 +27,6 @@ public class RhodesApp
|
|
|
27
27
|
int m_currentTabIndex = 0;
|
|
28
28
|
String[] m_currentUrls = new String[5];
|
|
29
29
|
|
|
30
|
-
NetRequest getNet() { return RhoClassFactory.createNetRequest();}
|
|
31
|
-
|
|
32
30
|
public static RhodesApp Create(String strRootPath)
|
|
33
31
|
{
|
|
34
32
|
if ( m_pInstance != null )
|
|
@@ -50,6 +48,9 @@ public class RhodesApp
|
|
|
50
48
|
public String getDBDirPath(){return m_strDBDirPath; }
|
|
51
49
|
public String getRhoRootPath(){return m_strRhoRootPath;}
|
|
52
50
|
|
|
51
|
+
NetRequest getNet() { return RhoClassFactory.createNetRequest();}
|
|
52
|
+
public String getHomeUrl(){ return m_strHomeUrl; }
|
|
53
|
+
|
|
53
54
|
RhodesApp(String strRootPath)
|
|
54
55
|
{
|
|
55
56
|
m_strRhoRootPath = strRootPath;
|
|
@@ -61,7 +62,7 @@ public class RhodesApp
|
|
|
61
62
|
|
|
62
63
|
void initAppUrls()
|
|
63
64
|
{
|
|
64
|
-
m_strHomeUrl = "http://localhost:
|
|
65
|
+
m_strHomeUrl = "http://localhost:2375";
|
|
65
66
|
m_strBlobsDirPath = getRhoRootPath() + "db/db-files";
|
|
66
67
|
m_strDBDirPath = getRhoRootPath() + "db";
|
|
67
68
|
}
|
|
@@ -104,9 +105,29 @@ public class RhodesApp
|
|
|
104
105
|
return res;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
boolean isExternalUrl(String strUrl)
|
|
109
|
+
{
|
|
110
|
+
return strUrl.startsWith("http://") || strUrl.startsWith("https://") ||
|
|
111
|
+
strUrl.startsWith("javascript:") || strUrl.startsWith("mailto:")
|
|
112
|
+
|| strUrl.startsWith("tel:")|| strUrl.startsWith("wtai:");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public String canonicalizeRhoUrl(String url)
|
|
116
|
+
{
|
|
117
|
+
if ( url == null || url.length() == 0 )
|
|
118
|
+
return getHomeUrl();
|
|
119
|
+
|
|
120
|
+
String strUrl = new String(url);
|
|
121
|
+
strUrl.replace('\\', '/');
|
|
122
|
+
if ( !strUrl.startsWith(getHomeUrl()) && !isExternalUrl(strUrl) )
|
|
123
|
+
strUrl = FilePath.join(getHomeUrl(), strUrl);
|
|
124
|
+
|
|
125
|
+
return strUrl;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public boolean isRhodesAppUrl(String url)
|
|
108
129
|
{
|
|
109
|
-
return
|
|
130
|
+
return url.startsWith(getHomeUrl());
|
|
110
131
|
}
|
|
111
132
|
|
|
112
133
|
public void setPushNotification(String strUrl, String strParams )throws Exception
|
|
@@ -13,6 +13,7 @@ import com.rho.IRhoRubyHelper;
|
|
|
13
13
|
import com.rho.RhoConf;
|
|
14
14
|
import com.rho.RhoEmptyLogger;
|
|
15
15
|
import com.rho.RhoLogger;
|
|
16
|
+
import com.rho.RhodesApp;
|
|
16
17
|
import com.rho.file.*;
|
|
17
18
|
|
|
18
19
|
import java.util.Enumeration;
|
|
@@ -225,7 +226,7 @@ public class NetRequest
|
|
|
225
226
|
{
|
|
226
227
|
m_bCancel = false;
|
|
227
228
|
|
|
228
|
-
if (
|
|
229
|
+
if ( RhodesApp.getInstance().isRhodesAppUrl(strUrl) )
|
|
229
230
|
{
|
|
230
231
|
IRhoRubyHelper helper = RhoClassFactory.createRhoRubyHelper();
|
|
231
232
|
return helper.postUrl(strUrl,strBody);
|
|
@@ -594,19 +595,9 @@ public class NetRequest
|
|
|
594
595
|
return false;
|
|
595
596
|
}
|
|
596
597
|
|
|
597
|
-
public String resolveUrl(String
|
|
598
|
+
public String resolveUrl(String strUrl) throws Exception
|
|
598
599
|
{
|
|
599
|
-
|
|
600
|
-
return "";
|
|
601
|
-
|
|
602
|
-
String _httpRoot = RhoClassFactory.getNetworkAccess().getHomeUrl();
|
|
603
|
-
if(!_httpRoot.endsWith("/"))
|
|
604
|
-
_httpRoot = _httpRoot + "/";
|
|
605
|
-
url.replace('\\', '/');
|
|
606
|
-
if ( !url.startsWith(_httpRoot) )
|
|
607
|
-
url = FilePath.join(_httpRoot, url);
|
|
608
|
-
|
|
609
|
-
return url;
|
|
600
|
+
return RhodesApp.getInstance().canonicalizeRhoUrl(strUrl);
|
|
610
601
|
}
|
|
611
602
|
|
|
612
603
|
public void cancel()
|
|
@@ -1219,12 +1219,12 @@ import com.rho.Tokenizer;
|
|
|
1219
1219
|
|
|
1220
1220
|
return sb.toString();
|
|
1221
1221
|
}
|
|
1222
|
-
|
|
1222
|
+
/*
|
|
1223
1223
|
public static boolean isLocalHost(String strUrl)
|
|
1224
1224
|
{
|
|
1225
1225
|
return strUrl.startsWith("http://localhost") ||
|
|
1226
1226
|
strUrl.startsWith("http://127.0.0.1");
|
|
1227
|
-
}
|
|
1227
|
+
}*/
|
|
1228
1228
|
|
|
1229
1229
|
public static boolean isLocalData(String strUrl)
|
|
1230
1230
|
{
|
|
@@ -475,10 +475,10 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
|
475
475
|
{
|
|
476
476
|
if ( strSources.length() > 0 )
|
|
477
477
|
{
|
|
478
|
-
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadserversources"), strSources, null);
|
|
478
|
+
/*NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadserversources"), strSources, null);
|
|
479
479
|
loadAllSources();
|
|
480
480
|
|
|
481
|
-
DBAdapter.initAttrManager()
|
|
481
|
+
DBAdapter.initAttrManager();*/
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
|
|
@@ -521,7 +521,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
|
521
521
|
|
|
522
522
|
JSONEntry oJsonEntry = new JSONEntry(szData);
|
|
523
523
|
|
|
524
|
-
if (oJsonEntry.hasName("
|
|
524
|
+
if (oJsonEntry.hasName("sources") )
|
|
525
525
|
processServerSources(szData);
|
|
526
526
|
|
|
527
527
|
JSONEntry oJsonObject = oJsonEntry.getEntry("client");
|
|
@@ -13,6 +13,7 @@ import com.xruby.runtime.lang.RubyMethod;
|
|
|
13
13
|
import com.xruby.runtime.lang.RubyRuntime;
|
|
14
14
|
import com.xruby.runtime.lang.RubySymbol;
|
|
15
15
|
import com.xruby.runtime.lang.RubyValue;
|
|
16
|
+
import java.util.Hashtable;
|
|
16
17
|
|
|
17
18
|
import j2me.math.HugeInt;
|
|
18
19
|
import org.apache.oro.text.regex.MatchResult;
|
|
@@ -83,8 +84,17 @@ public class ObjectFactory {
|
|
|
83
84
|
return new RubyString(c, s);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
private static Hashtable m_hashRegex = new Hashtable();
|
|
88
|
+
public static synchronized RubyRegexp createRegexp(String value, String option)
|
|
89
|
+
{
|
|
90
|
+
String strKey = value+option;
|
|
91
|
+
Object obj = m_hashRegex.get(strKey);
|
|
92
|
+
if ( obj == null )
|
|
93
|
+
{
|
|
94
|
+
obj = new RubyRegexp(value, option);
|
|
95
|
+
m_hashRegex.put(strKey, obj);
|
|
96
|
+
}
|
|
97
|
+
return (RubyRegexp)obj;
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
public static RubyRegexp createRegexp() {
|
|
@@ -126,23 +126,26 @@ public class RubyString extends RubyBasic {
|
|
|
126
126
|
public RubyString appendString(RubyValue v) {
|
|
127
127
|
if (v instanceof RubyString) {
|
|
128
128
|
return appendString((RubyString)v);
|
|
129
|
-
} else {
|
|
129
|
+
} else if (v!=null){
|
|
130
130
|
RubyValue r = RubyAPI.callPublicNoArgMethod(v, null, RubyID.toSID);
|
|
131
131
|
if ( r instanceof RubyString )
|
|
132
132
|
return appendString((RubyString)r);
|
|
133
133
|
|
|
134
134
|
return ObjectFactory.createString(r.toString());
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
return this;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
public int appendString2(RubyValue v) {
|
|
139
141
|
RubyString str = null;
|
|
140
142
|
if (v instanceof RubyString) {
|
|
141
143
|
str = (RubyString)v;
|
|
142
|
-
} else {
|
|
144
|
+
} else if (v!=null){
|
|
143
145
|
RubyValue r = RubyAPI.callPublicNoArgMethod(v, null, RubyID.toSID);
|
|
144
146
|
str = (RubyString)r;
|
|
145
|
-
}
|
|
147
|
+
}else
|
|
148
|
+
str = ObjectFactory.createString("");
|
|
146
149
|
|
|
147
150
|
appendString(str);
|
|
148
151
|
|
|
@@ -534,7 +534,16 @@ public class FastTable/*<E>*/extends FastCollection/*<E>*/implements
|
|
|
534
534
|
if ((fromIndex < 0) || (toIndex > _size) || (fromIndex > toIndex))
|
|
535
535
|
throw new IndexOutOfBoundsException("fromIndex: " + fromIndex
|
|
536
536
|
+ ", toIndex: " + toIndex + " for list of size: " + _size);
|
|
537
|
-
|
|
537
|
+
int size = toIndex - fromIndex;
|
|
538
|
+
FastTable table = new FastTable(size);
|
|
539
|
+
|
|
540
|
+
for( int i = fromIndex; i < size; i++ )
|
|
541
|
+
table.add(this.get(i));
|
|
542
|
+
|
|
543
|
+
return table;
|
|
544
|
+
//RHO
|
|
545
|
+
//return SubTable.valueOf(this, fromIndex, toIndex - fromIndex);
|
|
546
|
+
//RHO
|
|
538
547
|
}
|
|
539
548
|
|
|
540
549
|
/**
|
|
@@ -714,6 +723,7 @@ public class FastTable/*<E>*/extends FastCollection/*<E>*/implements
|
|
|
714
723
|
/**
|
|
715
724
|
* This inner class implements a sub-table.
|
|
716
725
|
*/
|
|
726
|
+
/*
|
|
717
727
|
private static final class SubTable extends FastCollection implements List,
|
|
718
728
|
RandomAccess {
|
|
719
729
|
|
|
@@ -830,7 +840,7 @@ public class FastTable/*<E>*/extends FastCollection/*<E>*/implements
|
|
|
830
840
|
return SubTable.valueOf(_table, _offset + fromIndex, toIndex
|
|
831
841
|
- fromIndex);
|
|
832
842
|
}
|
|
833
|
-
}
|
|
843
|
+
}*/
|
|
834
844
|
|
|
835
845
|
/**
|
|
836
846
|
* This inner class implements a fast table iterator.
|