Rename Emscripten target to WebAssembly
This commit is contained in:
@@ -55,7 +55,7 @@ class Bytes
|
||||
return untyped $sget(b, pos);
|
||||
#elseif flash
|
||||
return b[pos];
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
return untyped b[pos];
|
||||
#elseif java
|
||||
return untyped b[pos] & 0xFF;
|
||||
@@ -72,7 +72,7 @@ class Bytes
|
||||
untyped $sset(b, pos, v);
|
||||
#elseif flash
|
||||
b[pos] = v;
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
untyped b[pos] = v;
|
||||
#elseif java
|
||||
b[pos] = cast v;
|
||||
@@ -104,7 +104,7 @@ class Bytes
|
||||
cs.system.Array.Copy(src.b, srcpos, b, pos, len);
|
||||
#elseif python
|
||||
python.Syntax.code("self.b[{0}:{0}+{1}] = src.b[srcpos:srcpos+{1}]", pos, len);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
b.blit(pos, src.b, srcpos, len);
|
||||
#else
|
||||
var b1 = b;
|
||||
@@ -136,7 +136,7 @@ class Bytes
|
||||
pos += len & ~3;
|
||||
for (i in 0...len & 3)
|
||||
set(pos++, value);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
untyped __global__.__hxcpp_memory_memset(b, pos, len, value);
|
||||
#else
|
||||
for (i in 0...len)
|
||||
@@ -206,7 +206,7 @@ class Bytes
|
||||
return length - other.length;
|
||||
// #elseif cs
|
||||
// TODO: memcmp if unsafe flag is on
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
return b.memcmp(other.b);
|
||||
#else
|
||||
var b1 = b;
|
||||
@@ -232,7 +232,7 @@ class Bytes
|
||||
#elseif flash
|
||||
b.position = pos;
|
||||
return b.readDouble();
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
if (pos < 0 || pos + 8 > length) throw Error.OutsideBounds;
|
||||
return untyped __global__.__hxcpp_memory_get_double(b, pos);
|
||||
#else
|
||||
@@ -254,7 +254,7 @@ class Bytes
|
||||
#elseif flash
|
||||
b.position = pos;
|
||||
return b.readFloat();
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
if (pos < 0 || pos + 4 > length) throw Error.OutsideBounds;
|
||||
return untyped __global__.__hxcpp_memory_get_float(b, pos);
|
||||
#else
|
||||
@@ -278,7 +278,7 @@ class Bytes
|
||||
#elseif flash
|
||||
b.position = pos;
|
||||
b.writeDouble(v);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
if (pos < 0 || pos + 8 > length) throw Error.OutsideBounds;
|
||||
untyped __global__.__hxcpp_memory_set_double(b, pos, v);
|
||||
#else
|
||||
@@ -304,7 +304,7 @@ class Bytes
|
||||
#elseif flash
|
||||
b.position = pos;
|
||||
b.writeFloat(v);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
if (pos < 0 || pos + 4 > length) throw Error.OutsideBounds;
|
||||
untyped __global__.__hxcpp_memory_set_float(b, pos, v);
|
||||
#else
|
||||
@@ -398,7 +398,7 @@ class Bytes
|
||||
#elseif flash
|
||||
b.position = pos;
|
||||
return b.readUTFBytes(len);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
var result:String = "";
|
||||
untyped __global__.__hxcpp_string_of_bytes(b, result, pos, len);
|
||||
return result;
|
||||
@@ -510,7 +510,7 @@ class Bytes
|
||||
var b = new flash.utils.ByteArray();
|
||||
b.length = length;
|
||||
return new Bytes(length, b);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
var a = new BytesData();
|
||||
if (length > 0) cpp.NativeArray.setSize(a, length);
|
||||
return new Bytes(length, a);
|
||||
@@ -540,7 +540,7 @@ class Bytes
|
||||
var b = new flash.utils.ByteArray();
|
||||
b.writeUTFBytes(s);
|
||||
return new Bytes(b.length, b);
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
var a = new BytesData();
|
||||
untyped __global__.__hxcpp_bytes_of_string(a, s);
|
||||
return new Bytes(a.length, a);
|
||||
@@ -638,7 +638,7 @@ class Bytes
|
||||
return untyped __dollar__sget(b, pos);
|
||||
#elseif flash
|
||||
return b[pos];
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
return untyped b.unsafeGet(pos);
|
||||
#elseif java
|
||||
return untyped b[pos] & 0xFF;
|
||||
|
||||
@@ -145,7 +145,7 @@ class NativeApplication
|
||||
#elseif lime_cffi
|
||||
var result = NativeCFFI.lime_application_exec(handle);
|
||||
|
||||
#if (!emscripten && !ios && !nodejs)
|
||||
#if (!webassembly && !ios && !nodejs)
|
||||
parent.onExit.dispatch(result);
|
||||
#end
|
||||
|
||||
|
||||
@@ -562,7 +562,7 @@ class NativeAudioSource
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
#if !emscripten
|
||||
#if !webassembly
|
||||
var value = AL.getSource3f(handle, AL.POSITION);
|
||||
position.x = value[0];
|
||||
position.y = value[1];
|
||||
|
||||
@@ -49,8 +49,11 @@ class DefineMacro
|
||||
Compiler.define("mobile");
|
||||
if (cffi) Compiler.define("lime-opengles");
|
||||
}
|
||||
else if (Context.defined("emscripten"))
|
||||
else if (Context.defined("webassembly") || Context.defined("wasm") || Context.defined("emscripten"))
|
||||
{
|
||||
Compiler.define("webassembly");
|
||||
Compiler.define("wasm");
|
||||
Compiler.define("emscripten");
|
||||
Compiler.define("web");
|
||||
if (cffi) Compiler.define("lime-opengles");
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class CFFI
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (cpp && (iphone || emscripten || android || static_link || tvos))
|
||||
#if (cpp && (iphone || webassembly || android || static_link || tvos))
|
||||
return cpp.Lib.load(library, method, args);
|
||||
#end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import lime.app.Event;
|
||||
#if haxe4
|
||||
import sys.thread.Deque;
|
||||
import sys.thread.Thread;
|
||||
#elseif (cpp || emscripten)
|
||||
#elseif (cpp || webassembly)
|
||||
import cpp.vm.Deque;
|
||||
import cpp.vm.Thread;
|
||||
#elseif neko
|
||||
@@ -30,7 +30,7 @@ class ThreadPool
|
||||
public var onProgress = new Event<Dynamic->Void>();
|
||||
public var onRun = new Event<Dynamic->Void>();
|
||||
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
@:noCompletion private var __synchronous:Bool;
|
||||
@:noCompletion private var __workCompleted:Int;
|
||||
@:noCompletion private var __workIncoming = new Deque<ThreadPoolMessage>();
|
||||
@@ -45,12 +45,12 @@ class ThreadPool
|
||||
|
||||
currentThreads = 0;
|
||||
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
__workQueued = 0;
|
||||
__workCompleted = 0;
|
||||
#end
|
||||
|
||||
#if (emscripten || force_synchronous)
|
||||
#if (webassembly || force_synchronous)
|
||||
__synchronous = true;
|
||||
#end
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class ThreadPool
|
||||
// }
|
||||
public function queue(state:Dynamic = null):Void
|
||||
{
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
// TODO: Better way to handle this?
|
||||
|
||||
if (Application.current != null && Application.current.window != null && !__synchronous)
|
||||
@@ -98,7 +98,7 @@ class ThreadPool
|
||||
|
||||
public function sendComplete(state:Dynamic = null):Void
|
||||
{
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
if (!__synchronous)
|
||||
{
|
||||
__workResult.add(new ThreadPoolMessage(COMPLETE, state));
|
||||
@@ -111,7 +111,7 @@ class ThreadPool
|
||||
|
||||
public function sendError(state:Dynamic = null):Void
|
||||
{
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
if (!__synchronous)
|
||||
{
|
||||
__workResult.add(new ThreadPoolMessage(ERROR, state));
|
||||
@@ -124,7 +124,7 @@ class ThreadPool
|
||||
|
||||
public function sendProgress(state:Dynamic = null):Void
|
||||
{
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
if (!__synchronous)
|
||||
{
|
||||
__workResult.add(new ThreadPoolMessage(PROGRESS, state));
|
||||
@@ -137,7 +137,7 @@ class ThreadPool
|
||||
|
||||
@:noCompletion private function runWork(state:Dynamic = null):Void
|
||||
{
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
if (!__synchronous)
|
||||
{
|
||||
__workResult.add(new ThreadPoolMessage(WORK, state));
|
||||
@@ -150,7 +150,7 @@ class ThreadPool
|
||||
doWork.dispatch(state);
|
||||
}
|
||||
|
||||
#if (cpp || neko || emscripten)
|
||||
#if (cpp || neko || webassembly)
|
||||
@:noCompletion private function __doWork():Void
|
||||
{
|
||||
while (true)
|
||||
|
||||
@@ -264,7 +264,7 @@ class AssetHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
if (project.target == EMSCRIPTEN
|
||||
if (project.target == WEB_ASSEMBLY
|
||||
&& (asset.embed != false
|
||||
|| (asset.library != null && libraries.exists(asset.library) && libraries[asset.library].preload)))
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ class HXProject extends Script
|
||||
case AIR if (targetFlags.exists("ios") || targetFlags.exists("android")):
|
||||
PlatformType.MOBILE;
|
||||
|
||||
case FLASH, HTML5, FIREFOX, EMSCRIPTEN:
|
||||
case FLASH, HTML5, FIREFOX, WEB_ASSEMBLY:
|
||||
PlatformType.WEB;
|
||||
|
||||
case ANDROID, BLACKBERRY, IOS, TIZEN, WEBOS, TVOS:
|
||||
|
||||
@@ -16,6 +16,7 @@ package lime.tools;
|
||||
var PS4 = "ps4";
|
||||
var TIZEN = "tizen";
|
||||
var VITA = "vita";
|
||||
var WEB_ASSEMBLY = "webassembly";
|
||||
var WINDOWS = "windows";
|
||||
var WEBOS = "webos";
|
||||
var WIIU = "wiiu";
|
||||
|
||||
@@ -142,7 +142,7 @@ class ProjectXMLParser extends HXProject
|
||||
}
|
||||
else if (targetFlags.exists("cpp")
|
||||
|| ((platformType != PlatformType.WEB) && !targetFlags.exists("html5"))
|
||||
|| target == Platform.EMSCRIPTEN)
|
||||
|| target == Platform.WEB_ASSEMBLY)
|
||||
{
|
||||
defines.set("targetType", "cpp");
|
||||
defines.set("native", "1");
|
||||
|
||||
Reference in New Issue
Block a user