http://code.google.com/p/caffeine-hx/source/detail?r=656
Modified:
/trunk/ext3/EReg.hx
/trunk/ext3/chx/Lib.hx
=======================================
--- /trunk/ext3/EReg.hx Mon Dec 20 16:52:29 2010
+++ /trunk/ext3/EReg.hx Sun Feb 12 15:57:36 2012
@@ -23,6 +23,10 @@
* DAMAGE.
*/
+#if (neko || cpp)
+import chx.Lib;
+#end
+
/**
Regular expressions are a way to find regular patterns into
Strings. Have a look at the tutorial on haXe website to learn
@@ -92,7 +96,7 @@
global = a.length > 1;
if( global )
opt = a.join("");
- this.r = regexp_new_options(untyped r.__s, untyped opt.__s);
+ this.r = regexp_new_options(Lib.haxeStringToNeko(r),
Lib.haxeStringToNeko(opt));
#elseif js
opt = opt.split("u").join(""); // 'u' (utf8) depends on page encoding
this.r = untyped __new__("RegExp",r,opt);
@@ -128,7 +132,7 @@
**/
public function match( s : String ) : Bool {
#if (neko || cpp)
- var p = regexp_match(r,untyped s.__s,0,s.length);
+ var p = regexp_match(r,Lib.haxeStringToNeko(s),0,s.length);
if( p )
last = s;
else
@@ -317,7 +321,7 @@
var a = new Array();
var first = true;
do {
- if( !regexp_match(r,untyped s.__s,pos,len) )
+ if( !regexp_match(r,Lib.haxeStringToNeko(s),pos,len) )
break;
var p = regexp_matched_pos(r,0);
if( p.len == 0 && !first ) {
@@ -357,7 +361,7 @@
var a = by.split("$");
var first = true;
do {
- if( !regexp_match(r,untyped s.__s,pos,len) )
+ if( !regexp_match(r,Lib.haxeStringToNeko(s),pos,len) )
break;
var p = regexp_matched_pos(r,0);
if( p.len == 0 && !first ) {
=======================================
--- /trunk/ext3/chx/Lib.hx Fri Jan 27 14:34:46 2012
+++ /trunk/ext3/chx/Lib.hx Sun Feb 12 15:57:36 2012
@@ -204,23 +204,37 @@
#end
}
+ static var dll_init : Hash<Bool>;
/**
* For platforms that require initialization of loaded libraries. This is
required when
* using ndlls generated with hxcpp for neko
+ * @param libName Short name for lib, without .ndll extension
+ * @param entryFunc Library init function. If not provided, will be
libName_init
*/
- public static function initDll(libName:String, entryFun : String =
null) : Void {
+ public static function initDll(libName:String, entryFunc : String =
null) : Void {
+ if(dll_init == null)
+ dll_init = new Hash();
+ if(dll_init.exists(libName))
+ return;
+ var init : Dynamic = null;
+
#if neko
- var init = chx.Lib.load(libName, "neko_init", 5);
- if (init != null)
- {
- //neko_init(neko_value inNewString,neko_value inNewArray,neko_value
inNull, neko_value inTrue, neko_value inFalse)
+ init = chx.Lib.load(libName, "neko_init", 5);
+ if(init == null)
+ throw("Could not find NekoAPI interface.");
+
+ //neko_init(inNewString,inNewArray,inNull,inTrue,inFalse)
init(function(s) return new String(s),
function(len:Int) { var r = []; if (len > 0) r[len - 1] = null;
return r; },
null, true, false);
- }
- else
- throw("Could not find NekoAPI interface.");
+
#end
+ if(entryFunc == null)
+ entryFunc = libName + "_init";
+ init = chx.Lib.load(libName, entryFunc, 0);
+ if(init != null)
+ init();
+ dll_init.set(libName, true);
}
#if (neko || cpp)