From e496d09527547d6f6242c1fdb8a20abba4e70068 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 27 Apr 2018 06:27:32 -0700 Subject: [PATCH] Revert "ALC bindings for HL" This reverts commit 8d1ff873d8d11c233b4c254b68cb9d20e2296028. Revert "Binding fix" This reverts commit c606ec5139d3bc8f8b9e7e59ca1adbee2771bc70. Revert "Add support for HL libraries" This reverts commit 6b49f4d24046d1be36892d72f6e4f9f14735d1ca. Revert "Minor fixes" This reverts commit dcacb9f04a1b6b767501133d247d6e4580d90d12. Revert "Compile fixes" This reverts commit 3b9e572f8b8d9b7a4b3c867539c19abfcf4d554c. Revert "Sync with Haxe std library (remove some overrides)" This reverts commit c05061c970e4c7a46dc34f60f9ff65ebf329ec3f. Revert "Initial support for HL target in tools (for testing)" This reverts commit 1dadbb725c3de1076b726bd3aa7bb76e09800cb8. --- haxe/CallStack.hx | 351 ++++++++ haxe/Template.hx | 417 +++++++++ haxe/Timer.hx | 6 +- haxe/crypto/Hmac.hx | 91 ++ haxe/crypto/Sha256.hx | 195 ++++ haxe/io/Bytes.hx | 196 +--- include.xml | 4 +- lime/_backend/native/NativeCFFI.hx | 21 +- lime/app/Promise.hx | 2 +- lime/math/color/RGBA.hx | 2 +- lime/media/openal/ALC.hx | 83 +- lime/media/openal/ALContext.hx | 9 +- lime/media/openal/ALDevice.hx | 9 +- lime/project/ProjectXMLParser.hx | 6 - lime/tools/platforms/LinuxPlatform.hx | 27 +- lime/tools/platforms/MacPlatform.hx | 25 +- lime/tools/platforms/WindowsPlatform.hx | 25 +- lime/utils/Bytes.hx | 2 - project/Build.xml | 3 +- project/include/hl.h | 826 ----------------- project/src/ExternalInterface.cpp | 3 - project/src/media/openal/OpenALBindings.cpp | 937 +------------------- templates/hl/hxml/debug.hxml | 5 - templates/hl/hxml/final.hxml | 5 - templates/hl/hxml/release.hxml | 4 - tools/CommandLineTools.hx | 17 - tools/utils/PlatformSetup.hx | 2 +- 27 files changed, 1135 insertions(+), 2138 deletions(-) create mode 100644 haxe/CallStack.hx create mode 100644 haxe/Template.hx create mode 100644 haxe/crypto/Hmac.hx create mode 100644 haxe/crypto/Sha256.hx delete mode 100644 project/include/hl.h delete mode 100644 templates/hl/hxml/debug.hxml delete mode 100644 templates/hl/hxml/final.hxml delete mode 100644 templates/hl/hxml/release.hxml diff --git a/haxe/CallStack.hx b/haxe/CallStack.hx new file mode 100644 index 000000000..ae931b7ab --- /dev/null +++ b/haxe/CallStack.hx @@ -0,0 +1,351 @@ +/* + * Copyright (C)2005-2012 Haxe Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +package haxe; + +/** + Elements return by `CallStack` methods. +**/ +enum StackItem { + CFunction; + Module( m : String ); + FilePos( s : Null, file : String, line : Int ); + Method( classname : String, method : String ); + LocalFunction( ?v : Int ); +} + +/** + Get informations about the call stack. +**/ +class CallStack { + #if js + static var lastException:js.Error; + + static function getStack(e:js.Error):Array { + if (e == null) return []; + // https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var oldValue = (untyped Error).prepareStackTrace; + (untyped Error).prepareStackTrace = function (error, callsites :Array) { + var stack = []; + for (site in callsites) { + if (wrapCallSite != null) site = wrapCallSite(site); + var method = null; + var fullName :String = site.getFunctionName(); + if (fullName != null) { + var idx = fullName.lastIndexOf("."); + if (idx >= 0) { + var className = fullName.substr(0, idx); + var methodName = fullName.substr(idx+1); + method = Method(className, methodName); + } + } + stack.push(FilePos(method, site.getFileName(), site.getLineNumber())); + } + return stack; + } + var a = makeStack(e.stack); + (untyped Error).prepareStackTrace = oldValue; + return a; + } + + // support for source-map-support module + @:noCompletion + public static var wrapCallSite:Dynamic->Dynamic; + #end + + /** + Return the call stack elements, or an empty array if not available. + **/ + public static function callStack() : Array { + #if neko + var a = makeStack(untyped __dollar__callstack()); + a.shift(); // remove Stack.callStack() + return a; + #elseif flash + var a = makeStack( new flash.errors.Error().getStackTrace() ); + a.shift(); // remove Stack.callStack() + return a; + #elseif php + return makeStack("%s"); + #elseif cpp + var s:Array = untyped __global__.__hxcpp_get_call_stack(true); + return makeStack(s); + #elseif js + try { + throw new js.Error(); + } catch( e : Dynamic ) { + var a = getStack(e); + a.shift(); // remove Stack.callStack() + return a; + } + + #elseif java + var stack = []; + for ( el in java.lang.Thread.currentThread().getStackTrace() ) { + var className = el.getClassName(); + var methodName = el.getMethodName(); + var fileName = el.getFileName(); + var lineNumber = el.getLineNumber(); + var method = Method( className, methodName ); + if ( fileName != null || lineNumber >= 0 ) { + stack.push( FilePos( method, fileName, lineNumber ) ); + } + else { + stack.push( method ); + } + } + stack.shift(); + stack.shift(); + stack.pop(); + return stack; + #elseif cs + return makeStack(new cs.system.diagnostics.StackTrace(1, true)); + #elseif python + var stack = []; + var infos = python.lib.Traceback.extract_stack(); + infos.pop(); + infos.reverse(); + for (elem in infos) + stack.push(FilePos(null, elem._1, elem._2)); + return stack; + #else + return []; // Unsupported + #end + } + + /** + Return the exception stack : this is the stack elements between + the place the last exception was thrown and the place it was + caught, or an empty array if not available. + **/ + #if cpp @:noStack #end /* Do not mess up the exception stack */ + public static function exceptionStack() : Array { + #if neko + return makeStack(untyped __dollar__excstack()); + #elseif as3 + return new Array(); + #elseif flash + var err : flash.errors.Error = untyped flash.Boot.lastError; + if( err == null ) return new Array(); + var a = makeStack( err.getStackTrace() ); + var c = callStack(); + var i = c.length - 1; + while( i > 0 ) { + if( Std.string(a[a.length-1]) == Std.string(c[i]) ) + a.pop(); + else + break; + i--; + } + return a; + #elseif php + return makeStack("%e"); + #elseif cpp + var s:Array = untyped __global__.__hxcpp_get_exception_stack(); + return makeStack(s); + #elseif java + var stack = []; + for ( el in java.internal.Exceptions.currentException().getStackTrace() ) { + var className = el.getClassName(); + var methodName = el.getMethodName(); + var fileName = el.getFileName(); + var lineNumber = el.getLineNumber(); + var method = Method( className, methodName ); + if ( fileName != null || lineNumber >= 0 ) { + stack.push( FilePos( method, fileName, lineNumber ) ); + } + else { + stack.push( method ); + } + } + // stack.shift(); + stack.shift(); + stack.pop(); + return stack; + #elseif cs + return makeStack(new cs.system.diagnostics.StackTrace(cs.internal.Exceptions.exception, true)); + #elseif python + var stack = []; + var exc = python.lib.Sys.exc_info(); + if (exc._3 != null) + { + var infos = python.lib.Traceback.extract_tb(exc._3); + infos.reverse(); + for (elem in infos) + stack.push(FilePos(null, elem._1, elem._2)); + } + return stack; + #elseif js + return untyped __define_feature__("haxe.CallStack.exceptionStack", getStack(lastException)); + #else + return []; // Unsupported + #end + } + + /** + Returns a representation of the stack as a printable string. + **/ + public static function toString( stack : Array ) { + var b = new StringBuf(); + #if cpp + stack = stack.copy (); + stack.reverse(); + #end + for( s in stack ) { + b.add("\nCalled from "); + itemToString(b,s); + } + return b.toString(); + } + + private static function itemToString( b : StringBuf, s ) { + switch( s ) { + case CFunction: + b.add("a C function"); + case Module(m): + b.add("module "); + b.add(m); + case FilePos(s,file,line): + if( s != null ) { + itemToString(b,s); + b.add(" ("); + } + b.add(file); + b.add(" line "); + b.add(line); + if( s != null ) b.add(")"); + case Method(cname,meth): + b.add(cname); + b.add("."); + b.add(meth); + case LocalFunction(n): + b.add("local function #"); + b.add(n); + } + } + + #if cpp @:noStack #end /* Do not mess up the exception stack */ + private static function makeStack(s #if cs : cs.system.diagnostics.StackTrace #end) { + #if neko + var a = new Array(); + var l = untyped __dollar__asize(s); + var i = 0; + while( i < l ) { + var x = s[i++]; + if( x == null ) + a.unshift(CFunction); + else if( untyped __dollar__typeof(x) == __dollar__tstring ) + a.unshift(Module(new String(x))); + else + a.unshift(FilePos(null,new String(untyped x[0]),untyped x[1])); + } + return a; + #elseif flash + var a = new Array(); + var r = ~/at ([^\/]+?)\$?(\/[^\(]+)?\(\)(\[(.*?):([0-9]+)\])?/; + var rlambda = ~/^MethodInfo-([0-9]+)$/g; + while( r.match(s) ) { + var cl = r.matched(1).split("::").join("."); + var meth = r.matched(2); + var item; + if( meth == null ) { + if( rlambda.match(cl) ) + item = LocalFunction(Std.parseInt(rlambda.matched(1))); + else + item = Method(cl,"new"); + } else + item = Method(cl,meth.substr(1)); + if( r.matched(3) != null ) + item = FilePos( item, r.matched(4), Std.parseInt(r.matched(5)) ); + a.push(item); + s = r.matchedRight(); + } + return a; + #elseif php + if (!untyped __call__("isset", __var__("GLOBALS", s))) + return []; + var a : Array = untyped __var__("GLOBALS", s); + var m = []; + for( i in 0...a.length - ((s == "%s") ? 2 : 0)) { + var d = a[i].split("::"); + m.unshift(Method(d[0],d[1])); + } + return m; + #elseif cpp + var stack : Array = s; + var m = new Array(); + for(func in stack) { + var words = func.split("::"); + if (words.length==0) + m.push(CFunction) + else if (words.length==2) + m.push(Method(words[0],words[1])); + else if (words.length==4) + m.push(FilePos( Method(words[0],words[1]),words[2],Std.parseInt(words[3]))); + } + return m; + #elseif js + if (s == null) { + return []; + } else if ((untyped __js__("typeof"))(s) == "string") { + // Return the raw lines in browsers that don't support prepareStackTrace + var stack : Array = s.split("\n"); + if( stack[0] == "Error" ) stack.shift(); + var m = []; + var rie10 = ~/^ at ([A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/; + for( line in stack ) { + if( rie10.match(line) ) { + var path = rie10.matched(1).split("."); + var meth = path.pop(); + var file = rie10.matched(2); + var line = Std.parseInt(rie10.matched(3)); + m.push(FilePos( meth == "Anonymous function" ? LocalFunction() : meth == "Global code" ? null : Method(path.join("."),meth), file, line )); + } else + m.push(Module(StringTools.trim(line))); // A little weird, but better than nothing + } + return m; + } else { + return cast s; + } + #elseif cs + var stack = []; + for (i in 0...s.FrameCount) + { + var frame = s.GetFrame(i); + var m = frame.GetMethod(); + + var method = StackItem.Method(m.ReflectedType.ToString(), m.Name); + + var fileName = frame.GetFileName(); + var lineNumber = frame.GetFileLineNumber(); + + if (fileName != null || lineNumber >= 0) + stack.push(FilePos(method, fileName, lineNumber)); + else + stack.push(method); + } + return stack; + #else + return null; + #end + } + +} diff --git a/haxe/Template.hx b/haxe/Template.hx new file mode 100644 index 000000000..b1545732a --- /dev/null +++ b/haxe/Template.hx @@ -0,0 +1,417 @@ +/* + * Copyright (C)2005-2016 Haxe Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +package haxe; + +private enum TemplateExpr { + OpVar( v : String ); + OpExpr( expr : Void -> Dynamic ); + OpIf( expr : Void -> Dynamic, eif : TemplateExpr, eelse : TemplateExpr ); + OpStr( str : String ); + OpBlock( l : List ); + OpForeach( expr : Void -> Dynamic, loop : TemplateExpr ); + OpMacro( name : String, params : List ); +} + +private typedef Token = { + var s : Bool; + var p : String; + var l : Array; +} + +private typedef ExprToken = { + var s : Bool; + var p : String; +} + +/** + Template provides a basic templating mechanism to replace values in a source + String, and to have some basic logic. + + A complete documentation of the supported syntax is available at: + +**/ +class Template { + + static var splitter = ~/(::[A-Za-z0-9_ ()&|!+=\/><*."-]+::|\$\$([A-Za-z0-9_-]+)\()/; + static var expr_splitter = ~/(\(|\)|[ \r\n\t]*"[^"]*"[ \r\n\t]*|[!+=\/><*.&|-]+)/; + static var expr_trim = ~/^[ ]*([^ ]+)[ ]*$/; + static var expr_int = ~/^[0-9]+$/; + static var expr_float = ~/^([+-]?)(?=\d|,\d)\d*(,\d*)?([Ee]([+-]?\d+))?$/; + + /** + Global replacements which are used across all Template instances. This + has lower priority than the context argument of execute(). + **/ + public static var globals : Dynamic = {}; + + var expr : TemplateExpr; + var context : Dynamic; + var macros : Dynamic; + var stack : List; + var buf : StringBuf; + + /** + Creates a new Template instance from `str`. + + `str` is parsed into tokens, which are stored for internal use. This + means that multiple execute() operations on a single Template instance + are more efficient than one execute() operations on multiple Template + instances. + + If `str` is null, the result is unspecified. + **/ + public function new( str : String ) { + var tokens = parseTokens(str); + expr = parseBlock(tokens); + if( !tokens.isEmpty() ) + throw "Unexpected '"+tokens.first().s+"'"; + } + + /** + Executes `this` Template, taking into account `context` for + replacements and `macros` for callback functions. + + If `context` has a field 'name', its value replaces all occurrences of + ::name:: in the Template. Otherwise Template.globals is checked instead, + If 'name' is not a field of that either, ::name:: is replaced with null. + + If `macros` has a field 'name', all occurrences of $$name(args) are + replaced with the result of calling that field. The first argument is + always the resolve() method, followed by the given arguments. + If `macros` has no such field, the result is unspecified. + + If `context` is null, the result is unspecified. If `macros` is null, + no macros are used. + **/ + public function execute( context : Dynamic, ?macros : Dynamic ):String { + this.macros = if( macros == null ) {} else macros; + this.context = context; + stack = new List(); + buf = new StringBuf(); + run(expr); + return buf.toString(); + } + + function resolve( v : String ) : Dynamic { + if( v == "__current__" ) + return context; + var value = Reflect.getProperty(context, v); + if( value != null || Reflect.hasField(context,v) ) + return value; + for( ctx in stack ) { + value = Reflect.getProperty(ctx,v); + if( value != null || Reflect.hasField(ctx,v) ) + return value; + } + return Reflect.field(globals,v); + } + + function parseTokens( data : String ) { + var tokens = new List(); + while( splitter.match(data) ) { + var p = splitter.matchedPos(); + if( p.pos > 0 ) + tokens.add({ p : data.substr(0,p.pos), s : true, l : null }); + + // : ? + if( data.charCodeAt(p.pos) == 58 ) { + tokens.add({ p : data.substr(p.pos + 2,p.len - 4), s : false, l : null }); + data = splitter.matchedRight(); + continue; + } + + // macro parse + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while( true ) { + var c = data.charCodeAt(parp); + parp++; + if( c == 40 ) { + npar++; + } else if( c == 41 ) { + npar--; + if (npar <= 0) break; + } else if( c == null ){ + throw "Unclosed macro parenthesis"; + } + if ( c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCharCode(c); + } + } + params.push(part); + tokens.add({ p : splitter.matched(2), s : false, l : params }); + data = data.substr(parp,data.length - parp); + } + if( data.length > 0 ) + tokens.add({ p : data, s : true, l : null }); + return tokens; + } + + function parseBlock( tokens : List ) { + var l = new List(); + while( true ) { + var t = tokens.first(); + if( t == null ) + break; + if( !t.s && (t.p == "end" || t.p == "else" || t.p.substr(0,7) == "elseif ") ) + break; + l.add(parse(tokens)); + } + if( l.length == 1 ) + return l.first(); + return OpBlock(l); + } + + function parse( tokens : List ) { + var t = tokens.pop(); + var p = t.p; + if( t.s ) + return OpStr(p); + // macro + if( t.l != null ) { + var pe = new List(); + for( p in t.l ) + pe.add(parseBlock(parseTokens(p))); + return OpMacro(p,pe); + } + // 'end' , 'else', 'elseif' can't be found here + if( p.substr(0,3) == "if " ) { + p = p.substr(3,p.length - 3); + var e = parseExpr(p); + var eif = parseBlock(tokens); + var t = tokens.first(); + var eelse; + if( t == null ) + throw "Unclosed 'if'"; + if( t.p == "end" ) { + tokens.pop(); + eelse = null; + } else if( t.p == "else" ) { + tokens.pop(); + eelse = parseBlock(tokens); + t = tokens.pop(); + if( t == null || t.p != "end" ) + throw "Unclosed 'else'"; + } else { // elseif + t.p = t.p.substr(4,t.p.length - 4); + eelse = parse(tokens); + } + return OpIf(e,eif,eelse); + } + if( p.substr(0,8) == "foreach " ) { + p = p.substr(8,p.length - 8); + var e = parseExpr(p); + var efor = parseBlock(tokens); + var t = tokens.pop(); + if( t == null || t.p != "end" ) + throw "Unclosed 'foreach'"; + return OpForeach(e,efor); + } + if( expr_splitter.match(p) ) + return OpExpr(parseExpr(p)); + return OpVar(p); + } + + function parseExpr( data : String ) { + var l = new List(); + var expr = data; + while( expr_splitter.match(data) ) { + var p = expr_splitter.matchedPos(); + var k = p.pos + p.len; + if( p.pos != 0 ) + l.add({ p : data.substr(0,p.pos), s : true }); + var p = expr_splitter.matched(0); + l.add({ p : p, s : p.indexOf('"') >= 0 }); + data = expr_splitter.matchedRight(); + } + if( data.length != 0 ) + l.add({ p : data, s : true }); + var e:Void->Dynamic; + try { + e = makeExpr(l); + if( !l.isEmpty() ) + throw l.first().p; + } catch( s : String ) { + throw "Unexpected '"+s+"' in "+expr; + } + return function() { + try { + return e(); + } catch( exc : Dynamic ) { + throw "Error : "+Std.string(exc)+" in "+expr; + } + } + } + + function makeConst( v : String ) : Void -> Dynamic { + expr_trim.match(v); + v = expr_trim.matched(1); + if( v.charCodeAt(0) == 34 ) { + var str = v.substr(1,v.length-2); + return function() return str; + } + if( expr_int.match(v) ) { + var i = Std.parseInt(v); + return function() { return i; }; + } + if( expr_float.match(v) ) { + var f = Std.parseFloat(v); + return function() { return f; }; + } + var me = this; + return function() { return me.resolve(v); }; + } + + function makePath( e : Void -> Dynamic, l : List ) { + var p = l.first(); + if( p == null || p.p != "." ) + return e; + l.pop(); + var field = l.pop(); + if( field == null || !field.s ) + throw field.p; + var f = field.p; + expr_trim.match(f); + f = expr_trim.matched(1); + return makePath(function() { return Reflect.field(e(),f); },l); + } + + function makeExpr( l ) { + return makePath(makeExpr2(l),l); + } + + function makeExpr2( l : List ) : Void -> Dynamic { + var p = l.pop(); + if( p == null ) + throw ""; + if( p.s ) + return makeConst(p.p); + switch( p.p ) { + case "(": + var e1:Dynamic = makeExpr(l); + var p = l.pop(); + if( p == null || p.s ) + throw p; + if( p.p == ")" ) + return e1; + var e2:Dynamic = makeExpr(l); + var p2 = l.pop(); + if( p2 == null || p2.p != ")" ) + throw p2; + return switch( p.p ) { + case "+": function() { return cast e1() + e2(); }; + case "-": function() { return cast e1() - e2(); }; + case "*": function() { return cast e1() * e2(); }; + case "/": function() { return cast e1() / e2(); }; + case ">": function() { return cast e1() > e2(); }; + case "<": function() { return cast e1() < e2(); }; + case ">=": function() { return cast e1() >= e2(); }; + case "<=": function() { return cast e1() <= e2(); }; + case "==": function() { return cast e1() == e2(); }; + case "!=": function() { return cast e1() != e2(); }; + case "&&": function() { return cast e1() && e2(); }; + case "||": function() { return cast e1() || e2(); }; + default: throw "Unknown operation "+p.p; + } + case "!": + var e : Void->Dynamic = makeExpr(l); + return function() { + var v : Dynamic = e(); + return (v == null || v == false); + }; + case "-": + var e = makeExpr(l); + return function() { return -e(); }; + } + throw p.p; + } + + function run( e : TemplateExpr ) { + switch( e ) { + case OpVar(v): + buf.add(Std.string(resolve(v))); + case OpExpr(e): + buf.add(Std.string(e())); + case OpIf(e,eif,eelse): + var v : Dynamic = e(); + if( v == null || v == false ) { + if( eelse != null ) run(eelse); + } else + run(eif); + case OpStr(str): + buf.add(str); + case OpBlock(l): + for( e in l ) + run(e); + case OpForeach(e,loop): + var v : Dynamic = e(); + try { + var x : Dynamic = v.iterator(); + if( x.hasNext == null ) throw null; + v = x; + } catch( e : Dynamic ) try { + if( v.hasNext == null ) throw null; + } catch( e : Dynamic ) { + throw "Cannot iter on " + v; + } + stack.push(context); + var v : Iterator = v; + for( ctx in v ) { + context = ctx; + run(loop); + } + context = stack.pop(); + case OpMacro(m,params): + var v : Dynamic = Reflect.field(macros,m); + var pl = new Array(); + var old = buf; + pl.push(resolve); + for( p in params ) { + switch( p ) { + case OpVar(v): pl.push(resolve(v)); + default: + buf = new StringBuf(); + run(p); + pl.push(buf.toString()); + } + } + buf = old; + try { + buf.add(Std.string(Reflect.callMethod(macros,v,pl))); + } catch( e : Dynamic ) { + var plstr = try pl.join(",") catch( e : Dynamic ) "???"; + var msg = "Macro call "+m+"("+plstr+") failed ("+Std.string(e)+")"; + #if neko + neko.Lib.rethrow(msg); + #else + throw msg; + #end + } + } + } + +} diff --git a/haxe/Timer.hx b/haxe/Timer.hx index df6180992..f65fb7118 100644 --- a/haxe/Timer.hx +++ b/haxe/Timer.hx @@ -5,7 +5,7 @@ package haxe; // Original haxe.Timer class /* - * Copyright (C)2005-2018 Haxe Foundation + * Copyright (C)2005-2013 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -177,14 +177,14 @@ class Timer { #elseif (neko || php) return Sys.time(); #elseif js - return Date.now().getTime() / 1000; + return js.Browser.window.performance.now () / 1000; #elseif cpp return untyped __global__.__time_stamp(); #elseif python return Sys.cpuTime(); #elseif sys return Sys.time(); - + #else return 0; #end diff --git a/haxe/crypto/Hmac.hx b/haxe/crypto/Hmac.hx new file mode 100644 index 000000000..9a83f59e2 --- /dev/null +++ b/haxe/crypto/Hmac.hx @@ -0,0 +1,91 @@ +/* + * Copyright (C)2005-2012 Haxe Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +package haxe.crypto; + +/** + Hash methods for Hmac calculation. +*/ +enum HashMethod { + MD5; + SHA1; + SHA256; +} + +/** + Calculates a Hmac of the given Bytes using a HashMethod. +*/ +class Hmac { + + var method : HashMethod; + var blockSize : Int; + var length : Int; + + public function new( hashMethod : HashMethod ) { + method = hashMethod; + blockSize = switch ( hashMethod ) { + case MD5, SHA1, SHA256: 64; + } + length = switch ( hashMethod ) { + case MD5: 16; + case SHA1: 20; + case SHA256: 32; + } + } + + inline function doHash( b : haxe.io.Bytes ) : haxe.io.Bytes { + return switch ( method ) { + case MD5: Md5.make(b); + case SHA1: Sha1.make(b); + case SHA256: Sha256.make(b); + } + } + + function nullPad( s : haxe.io.Bytes, chunkLen : Int ) : haxe.io.Bytes { + var r = chunkLen - (s.length % chunkLen); + if(r == chunkLen && s.length != 0) + return s; + var sb = new haxe.io.BytesBuffer(); + sb.add(s); + for(x in 0...r) + sb.addByte(0); + return sb.getBytes(); + } + + public function make( key : haxe.io.Bytes, msg : haxe.io.Bytes ) : haxe.io.Bytes { + if(key.length > blockSize) { + key = doHash(key); + } + key = nullPad(key, blockSize); + + var Ki = new haxe.io.BytesBuffer(); + var Ko = new haxe.io.BytesBuffer(); + for (i in 0...key.length) { + Ko.addByte(key.get(i) ^ 0x5c); + Ki.addByte(key.get(i) ^ 0x36); + } + // hash(Ko + hash(Ki + message)) + Ki.add(msg); + Ko.add(doHash(Ki.getBytes())); + return doHash(Ko.getBytes()); + } + +} diff --git a/haxe/crypto/Sha256.hx b/haxe/crypto/Sha256.hx new file mode 100644 index 000000000..17292d573 --- /dev/null +++ b/haxe/crypto/Sha256.hx @@ -0,0 +1,195 @@ +/* + * Copyright (C)2005-2012 Haxe Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +package haxe.crypto; + +/** + Creates a Sha256 of a String. +*/ +class Sha256 { + + public static function encode( s:String ) : String { + #if php + return untyped __call__("hash", "sha256", s); + #else + var sh = new Sha256(); + var h = sh.doEncode(str2blks(s), s.length*8); + return sh.hex(h); + #end + } + + public static function make( b : haxe.io.Bytes ) : haxe.io.Bytes { + #if php + return haxe.io.Bytes.ofData(untyped __call__("hash", "sha256", b.getData(), true)); + #else + var h = new Sha256().doEncode(bytes2blks(b), b.length*8); + var out = haxe.io.Bytes.alloc(32); + var p = 0; + for( i in 0...8 ) { + out.set(p++,h[i]>>>24); + out.set(p++,(h[i]>>16)&0xFF); + out.set(p++,(h[i]>>8)&0xFF); + out.set(p++,h[i]&0xFF); + } + return out; + #end + } + + public function new() { + } + + function doEncode( m : Array, l : Int ) : Array { + var K : Array = [ + 0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B, + 0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01, + 0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7, + 0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC, + 0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152, + 0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147, + 0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC, + 0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85, + 0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819, + 0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08, + 0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F, + 0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208, + 0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2 + ]; + var HASH : Array = [ + 0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A, + 0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19 + ]; + + var W = new Array(); + W[64] = 0; + var a:Int,b:Int,c:Int,d:Int,e:Int,f:Int,g:Int,h:Int; + var T1, T2; + m[l >> 5] |= 0x80 << (24 - l % 32); + m[((l + 64 >> 9) << 4) + 15] = l; + var i : Int = 0; + while ( i < m.length ) { + a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; + for ( j in 0...64 ) { + if (j < 16) + W[j] = m[j + i]; + else + W[j] = safeAdd(safeAdd(safeAdd(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]); + T1 = safeAdd(safeAdd(safeAdd(safeAdd(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]); + T2 = safeAdd(Sigma0256(a), Maj(a, b, c)); + h = g; g = f; f = e; e = safeAdd(d, T1); d = c; c = b; b = a; a = safeAdd(T1, T2); + } + HASH[0] = safeAdd(a, HASH[0]); + HASH[1] = safeAdd(b, HASH[1]); + HASH[2] = safeAdd(c, HASH[2]); + HASH[3] = safeAdd(d, HASH[3]); + HASH[4] = safeAdd(e, HASH[4]); + HASH[5] = safeAdd(f, HASH[5]); + HASH[6] = safeAdd(g, HASH[6]); + HASH[7] = safeAdd(h, HASH[7]); + i += 16; + } + return HASH; + } + + /* + Convert a string to a sequence of 16-word blocks, stored as an array. + Append padding bits and the length, as described in the SHA1 standard. + */ + static function str2blks( s :String ) : Array { + var nblk = ((s.length + 8) >> 6) + 1; + var blks = new Array(); + + for (i in 0...nblk*16) + blks[i] = 0; + for (i in 0...s.length){ + var p = i >> 2; + blks[p] |= s.charCodeAt(i) << (24 - ((i & 3) << 3)); + } + var i = s.length; + var p = i >> 2; + blks[p] |= 0x80 << (24 - ((i & 3) << 3)); + blks[nblk * 16 - 1] = s.length * 8; + return blks; + } + + static function bytes2blks( b : haxe.io.Bytes ) : Array { + var nblk = ((b.length + 8) >> 6) + 1; + var blks = new Array(); + + for (i in 0...nblk*16) + blks[i] = 0; + for (i in 0...b.length){ + var p = i >> 2; + blks[p] |= b.get(i) << (24 - ((i & 3) << 3)); + } + var i = b.length; + var p = i >> 2; + blks[p] |= 0x80 << (24 - ((i & 3) << 3)); + blks[nblk * 16 - 1] = b.length * 8; + return blks; + } + + function S(X, n) { + return ( X >>> n ) | (X << (32 - n)); + } + + function R(X, n) { + return ( X >>> n ); + } + + function Ch(x, y, z) { + return ((x & y) ^ ((~x) & z)); + } + + function Maj(x, y, z) { + return ((x & y) ^ (x & z) ^ (y & z)); + } + + function Sigma0256(x) { + return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); + } + + function Sigma1256(x) { + return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); + } + + function Gamma0256(x) { + return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); + } + + function Gamma1256(x) { + return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); + } + + function safeAdd(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + } + + function hex( a : Array ){ + var str = ""; + for( num in a ) { + str += StringTools.hex(num, 8); + } + return str.toLowerCase(); + } + +} diff --git a/haxe/io/Bytes.hx b/haxe/io/Bytes.hx index 13c45f0ac..83ced2db7 100644 --- a/haxe/io/Bytes.hx +++ b/haxe/io/Bytes.hx @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2018 Haxe Foundation + * Copyright (C)2005-2016 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -19,7 +19,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -package haxe.io; #if (!hl && !js) +package haxe.io; #if !js #if cpp @@ -53,6 +53,8 @@ class Bytes { return untyped $sget(b,pos); #elseif flash return b[pos]; + #elseif php + return b.get(pos); #elseif cpp return untyped b[pos]; #elseif java @@ -69,6 +71,8 @@ class Bytes { untyped $sset(b,pos,v); #elseif flash b[pos] = v; + #elseif php + b.set(pos, v); #elseif cpp untyped b[pos] = v; #elseif java @@ -88,6 +92,8 @@ class Bytes { #end #if neko try untyped $sblit(b,pos,src.b,srcpos,len) catch( e : Dynamic ) throw Error.OutsideBounds; + #elseif php + b.blit(pos, src.b, srcpos, len); #elseif flash b.position = pos; if( len > 0 ) b.writeBytes(src.b,srcpos,len); @@ -96,7 +102,7 @@ class Bytes { #elseif cs 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); + python.Syntax.pythonCode("self.b[{0}:{0}+{1}] = src.b[srcpos:srcpos+{1}]", pos, len); #elseif cpp b.blit(pos, src.b, srcpos, len); #else @@ -145,6 +151,8 @@ class Bytes { var b2 = new flash.utils.ByteArray(); b.readBytes(b2,0,len); return new Bytes(len,b2); + #elseif php + return new Bytes(len, b.sub(pos, len)); #elseif java var newarr = new java.NativeArray(len); java.lang.System.arraycopy(b, pos, newarr, 0, len); @@ -189,6 +197,8 @@ class Bytes { b1.endian = flash.utils.Endian.LITTLE_ENDIAN; b2.endian = flash.utils.Endian.LITTLE_ENDIAN; return length - other.length; + #elseif php + return b.compare(other.b); //#elseif cs //TODO: memcmp if unsafe flag is on #elseif cpp @@ -316,7 +326,7 @@ class Bytes { public inline function getInt32( pos : Int ) : Int { #if neko_v21 return untyped $sget32(b, pos, false); - #elseif python + #elseif (php || python) var v = get(pos) | (get(pos + 1) << 8) | (get(pos + 2) << 16) | (get(pos+3) << 24); return if( v & 0x80000000 != 0 ) v | 0x80000000 else v; #elseif lua @@ -365,6 +375,8 @@ class Bytes { #elseif flash b.position = pos; return b.readUTFBytes(len); + #elseif php + return b.getString(pos, len); #elseif cpp var result:String=""; untyped __global__.__hxcpp_string_of_bytes(b,result,pos,len); @@ -376,7 +388,7 @@ class Bytes { return new String(b, pos, len, "UTF-8") catch (e:Dynamic) throw e; #elseif python - return python.Syntax.code("self.b[{0}:{0}+{1}].decode('UTF-8','replace')", pos, len); + return python.Syntax.pythonCode("self.b[{0}:{0}+{1}].decode('UTF-8','replace')", pos, len); #elseif lua var begin = cast(Math.min(pos,b.length),Int); var end = cast(Math.min(pos+len,b.length),Int); @@ -423,6 +435,8 @@ class Bytes { #elseif flash b.position = 0; return b.toString(); + #elseif php + return b.toString(); #elseif cs return cs.system.text.Encoding.UTF8.GetString(b, 0, length); #elseif java @@ -461,6 +475,8 @@ class Bytes { var b = new flash.utils.ByteArray(); b.length = length; return new Bytes(length,b); + #elseif php + return new Bytes(length, BytesData.alloc(length)); #elseif cpp var a = new BytesData(); if (length>0) cpp.NativeArray.setSize(a, length); @@ -487,6 +503,9 @@ class Bytes { var b = new flash.utils.ByteArray(); b.writeUTFBytes(s); return new Bytes(b.length,b); + #elseif php + var x = BytesData.ofString(s); + return new Bytes(x.length, x); #elseif cpp var a = new BytesData(); untyped __global__.__hxcpp_bytes_of_string(a,s); @@ -543,6 +562,8 @@ class Bytes { return new Bytes(b.length,b); #elseif neko return new Bytes(untyped __dollar__ssize(b),b); + #elseif php + return new Bytes(b.length, b); #elseif cs return new Bytes(b.Length,b); #else @@ -559,6 +580,8 @@ class Bytes { return untyped __dollar__sget(b,pos); #elseif flash return b[pos]; + #elseif php + return b.get(pos); #elseif cpp return untyped b.unsafeGet(pos); #elseif java @@ -571,7 +594,7 @@ class Bytes { } -#elseif js +#else #if !nodejs @@ -807,165 +830,4 @@ class Bytes { } -#elseif hl - - -@:coreApi -class Bytes { - - public var length(default,null) : Int; - var b : hl.Bytes; - - function new(b:hl.Bytes,length:Int) : Void { - this.b = b; - this.length = length; - } - - inline function out(pos:Int) : Bool { - return (pos:UInt) >= (length : UInt); - } - - inline function outRange(pos:Int,len:Int) : Bool { - return pos < 0 || len < 0 || ((pos+len):UInt) > (length : UInt); - } - - public function get( pos : Int ) : Int { - return if( out(pos) ) 0 else b[pos]; - } - - public function set( pos : Int, v : Int ) : Void { - if( out(pos) ) throw Error.OutsideBounds; - b[pos] = v; - } - - public function blit( pos : Int, src : Bytes, srcpos : Int, len : Int ) : Void { - if( outRange(pos, len) || src.outRange(srcpos,len) ) throw Error.OutsideBounds; - b.blit(pos, src.b, srcpos, len); - } - - public function fill( pos : Int, len : Int, value : Int ) : Void { - if( outRange(pos,len) ) throw Error.OutsideBounds; - b.fill(pos, len, value); - } - - public function sub( pos : Int, len : Int ) : Bytes { - if( outRange(pos,len) ) throw Error.OutsideBounds; - return new Bytes(b.sub(pos, len), len); - } - - public function compare( other : Bytes ) : Int { - var len = length < other.length ? length : other.length; - var r = b.compare(0, other.b, 0, len); - if( r == 0 ) - r = length - other.length; - return r; - } - - public function getDouble( pos : Int ) : Float { - return if( out(pos + 7) ) 0. else b.getF64(pos); - } - - public function getFloat( pos : Int ) : Float { - return if( out(pos + 3) ) 0. else b.getF32(pos); - } - - public function setDouble( pos : Int, v : Float ) : Void { - if( out(pos + 7) ) throw Error.OutsideBounds; - b.setF64(pos, v); - } - - public function setFloat( pos : Int, v : Float ) : Void { - if( out(pos + 3) ) throw Error.OutsideBounds; - b.setF32(pos, v); - } - - public inline function getUInt16( pos : Int ) : Int { - return if( out(pos + 1) ) 0 else b.getUI16(pos); - } - - public inline function setUInt16( pos : Int, v : Int ) : Void { - if( out(pos + 1) ) throw Error.OutsideBounds; - b.setUI16(pos, v); - } - - public function getInt32( pos : Int ) : Int { - return if( out(pos + 3) ) 0 else b.getI32(pos); - } - - public function getInt64( pos : Int ) : haxe.Int64 { - if( out(pos + 7) ) - return haxe.Int64.ofInt(0); - return haxe.Int64.make(b.getI32(pos+4), b.getI32(pos)); - } - - public function setInt32( pos : Int, v : Int ) : Void { - if( out(pos + 3) ) throw Error.OutsideBounds; - b.setI32(pos, v); - } - - public inline function setInt64( pos : Int, v : haxe.Int64 ) : Void { - setInt32(pos + 4, v.high); - setInt32(pos, v.low); - } - - public function getString( pos : Int, len : Int ) : String { - if( outRange(pos,len) ) throw Error.OutsideBounds; - - var b = new hl.Bytes(len + 1); - b.blit(0, this.b, pos, len); - b[len] = 0; - return @:privateAccess String.fromUTF8(b); - } - - @:deprecated("readString is deprecated, use getString instead") - @:noCompletion - public inline function readString(pos:Int, len:Int):String { - return getString(pos, len); - } - - public function toString() : String { - return getString(0,length); - } - - public function toHex() : String { - var s = new StringBuf(); - var chars = []; - var str = "0123456789abcdef"; - for( i in 0...str.length ) - chars.push(str.charCodeAt(i)); - for( i in 0...length ) { - var c = get(i); - s.addChar(chars[c >> 4]); - s.addChar(chars[c & 15]); - } - return s.toString(); - } - - public inline function getData() : BytesData { - return new haxe.io.BytesData(b,length); - } - - public static function alloc( length : Int ) : Bytes { - var b = new hl.Bytes(length); - b.fill(0, length, 0); - return new Bytes(b,length); - } - - public static function ofString( s : String ) : Bytes @:privateAccess { - var size = 0; - var b = s.bytes.utf16ToUtf8(0, size); - return new Bytes(b,size); - } - - public static function ofData( b : BytesData ) : Bytes { - return new Bytes(b.bytes,b.length); - } - - public inline static function fastGet( b : BytesData, pos : Int ) : Int { - return b[pos]; - } - -} - - #end \ No newline at end of file diff --git a/include.xml b/include.xml index b655d7772..6a6980c78 100644 --- a/include.xml +++ b/include.xml @@ -5,7 +5,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/lime/_backend/native/NativeCFFI.hx b/lime/_backend/native/NativeCFFI.hx index 9e970377c..1bec7d27a 100644 --- a/lime/_backend/native/NativeCFFI.hx +++ b/lime/_backend/native/NativeCFFI.hx @@ -8,8 +8,6 @@ import lime.graphics.opengl.GLRenderbuffer; import lime.graphics.opengl.GLShader; import lime.graphics.opengl.GLTexture; import lime.media.openal.ALAuxiliaryEffectSlot; -import lime.media.openal.ALContext; -import lime.media.openal.ALDevice; import lime.system.CFFIPointer; import lime.utils.DataPointer; @@ -289,35 +287,20 @@ class NativeCFFI { @:cffi private static function lime_alc_resume_device (device:CFFIPointer):Void; @:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void; - #if hl - @:hlNative("lime", "lime_alc_close_device") private static function hl_lime_alc_close_device (device:ALDevice):Bool { return false; } - @:hlNative("lime", "lime_alc_create_context") private static function hl_lime_alc_create_context (device:ALDevice, attrlist:hl.Bytes):ALContext { return null; } - @:hlNative("lime", "lime_alc_destroy_context") private static function hl_lime_alc_destroy_context (context:ALContext):Void {} - @:hlNative("lime", "lime_alc_get_contexts_device") private static function hl_lime_alc_get_contexts_device (context:ALContext):ALDevice { return null; } - @:hlNative("lime", "lime_alc_get_current_context") private static function hl_lime_alc_get_current_context ():ALContext { return null; } - @:hlNative("lime", "lime_alc_get_error") private static function hl_lime_alc_get_error (device:ALDevice):Int { return 0; } - @:hlNative("lime", "lime_alc_get_integerv") private static function hl_lime_alc_get_integerv (device:ALDevice, param:Int, size:Int, values:hl.Bytes):Void {} - @:hlNative("lime", "lime_alc_get_string") private static function hl_lime_alc_get_string (device:ALDevice, param:Int):hl.Bytes { return null; } - @:hlNative("lime", "lime_alc_make_context_current") private static function hl_lime_alc_make_context_current (context:ALContext):Bool { return false; } - @:hlNative("lime", "lime_alc_open_device") private static function hl_lime_alc_open_device (devicename:hl.Bytes):ALDevice { return null; } - @:hlNative("lime", "lime_alc_pause_device") private static function hl_lime_alc_pause_device (device:ALDevice):Void {} - @:hlNative("lime", "lime_alc_process_context") private static function hl_lime_alc_process_context (context:ALContext):Void {} - @:hlNative("lime", "lime_alc_resume_device") private static function hl_lime_alc_resume_device (device:ALDevice):Void {} - @:hlNative("lime", "lime_alc_suspend_context") private static function hl_lime_alc_suspend_context (context:ALContext):Void {} - #end - @:cffi private static function lime_al_gen_filter():CFFIPointer; @:cffi private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void; @:cffi private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:Float32):Void; @:cffi private static function lime_al_remove_direct_filter(source:CFFIPointer):Void; @:cffi private static function lime_al_is_filter (filter:CFFIPointer):Bool; @:cffi private static function lime_al_get_filteri(filter:CFFIPointer, param:Int):Int; + @:cffi private static function lime_al_gen_effect():CFFIPointer; @:cffi private static function lime_al_effectf(effect:CFFIPointer, param:Int, value:Float32):Void; @:cffi private static function lime_al_effectfv(effect:CFFIPointer, param:Int, values:Array):Void; @:cffi private static function lime_al_effecti(effect:CFFIPointer, param:Int, value:Int):Void; @:cffi private static function lime_al_effectiv(effect:CFFIPointer, param:Int, values:Array):Void; @:cffi private static function lime_al_is_effect(effect:CFFIPointer):Bool; + @:cffi private static function lime_al_gen_aux():CFFIPointer; @:cffi private static function lime_al_auxf(aux:CFFIPointer, param:Int, value:Float32):Void; @:cffi private static function lime_al_auxfv(aux:CFFIPointer, param:Int, values:Array):Void; diff --git a/lime/app/Promise.hx b/lime/app/Promise.hx index 67df70d02..dee3eedfd 100644 --- a/lime/app/Promise.hx +++ b/lime/app/Promise.hx @@ -7,7 +7,7 @@ package lime.app; #end @:allow(lime.app.Future) -#if (!hl && !js) @:generic #end +#if !js @:generic #end class Promise { diff --git a/lime/math/color/RGBA.hx b/lime/math/color/RGBA.hx index dca23bbec..ae2fac972 100644 --- a/lime/math/color/RGBA.hx +++ b/lime/math/color/RGBA.hx @@ -35,7 +35,7 @@ abstract RGBA(#if flash Int #else UInt #end) from Int to Int from UInt to UInt { } - __clamp = new UInt8Array (0xFF + 0xFF + 1); + __clamp = new UInt8Array (0xFF + 0xFF); for (i in 0...0xFF) { diff --git a/lime/media/openal/ALC.hx b/lime/media/openal/ALC.hx index 6f2eb6386..7726f0326 100644 --- a/lime/media/openal/ALC.hx +++ b/lime/media/openal/ALC.hx @@ -40,11 +40,9 @@ class ALC { public static function closeDevice (device:ALDevice):Bool { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) return NativeCFFI.lime_alc_close_device (device); #else - return NativeCFFI.hl_lime_alc_close_device (device); - #end #else return false; #end @@ -53,7 +51,7 @@ class ALC { public static function createContext (device:ALDevice, attrlist:Array = null):ALContext { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) var handle:Dynamic = NativeCFFI.lime_alc_create_context (device, attrlist); if (handle != null) { @@ -61,10 +59,7 @@ class ALC { return new ALContext (handle); } - #else - var attrlist = (attrlist != null ? hl.Bytes.fromValue (attrlist, null) : null); - return NativeCFFI.hl_lime_alc_create_context (device, attrlist); - #end #end + #end return null; @@ -73,18 +68,16 @@ class ALC { public static function destroyContext (context:ALContext):Void { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) NativeCFFI.lime_alc_destroy_context (context); - #else - NativeCFFI.hl_lime_alc_destroy_context (context); - #end #end + #end } public static function getContextsDevice (context:ALContext):ALDevice { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) var handle:Dynamic = NativeCFFI.lime_alc_get_contexts_device (context); if (handle != null) { @@ -92,9 +85,6 @@ class ALC { return new ALDevice (handle); } - #else - return NativeCFFI.hl_lime_alc_get_contexts_device (context); - #end #end return null; @@ -104,7 +94,7 @@ class ALC { public static function getCurrentContext ():ALContext { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) var handle:Dynamic = NativeCFFI.lime_alc_get_current_context (); if (handle != null) { @@ -112,9 +102,7 @@ class ALC { return new ALContext (handle); } - #else - return NativeCFFI.hl_lime_alc_get_current_context (); - #end #end + #end return null; @@ -123,11 +111,9 @@ class ALC { public static function getError (device:ALDevice):Int { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) return NativeCFFI.lime_alc_get_error (device); #else - return NativeCFFI.lime_alc_get_error (device); - #end #else return 0; #end @@ -152,18 +138,9 @@ class ALC { public static function getIntegerv (device:ALDevice, param:Int, size:Int):Array { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) return NativeCFFI.lime_alc_get_integerv (device, param, size); #else - // TODO: Make this work - var bytes = new hl.Bytes (size); - NativeCFFI.hl_lime_alc_get_integerv (device, param, size, bytes); - var result = new Array (); - for (i in 0...size) { - result[i] = bytes.getI32 (i); - } - return result; - #end #else return null; #end @@ -172,12 +149,9 @@ class ALC { public static function getString (device:ALDevice, param:Int):String { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) return NativeCFFI.lime_alc_get_string (device, param); #else - // TODO: Is this correct? - return cast NativeCFFI.hl_lime_alc_get_string (device, param); - #end #else return null; #end @@ -186,11 +160,9 @@ class ALC { public static function makeContextCurrent (context:ALContext):Bool { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) return NativeCFFI.lime_alc_make_context_current (context); #else - return NativeCFFI.hl_lime_alc_make_context_current (context); - #end #else return false; #end @@ -199,7 +171,7 @@ class ALC { public static function openDevice (deviceName:String = null):ALDevice { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) var handle:Dynamic = NativeCFFI.lime_alc_open_device (deviceName); if (handle != null) { @@ -207,10 +179,7 @@ class ALC { return new ALDevice (handle); } - #else - var deviceName = (deviceName != null ? hl.Bytes.fromValue (deviceName, null) : null); - return NativeCFFI.hl_lime_alc_open_device (deviceName); - #end #end + #end return null; @@ -219,44 +188,36 @@ class ALC { public static function pauseDevice (device:ALDevice):Void { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) NativeCFFI.lime_alc_pause_device (device); - #else - NativeCFFI.hl_lime_alc_pause_device (device); - #end #end + #end } public static function processContext (context:ALContext):Void { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) NativeCFFI.lime_alc_process_context (context); - #else - NativeCFFI.hl_lime_alc_process_context (context); - #end #end + #end } public static function resumeDevice (device:ALDevice):Void { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) NativeCFFI.lime_alc_resume_device (device); - #else - NativeCFFI.hl_lime_alc_resume_device (device); - #end #end + #end } public static function suspendContext (context:ALContext):Void { - #if (lime_cffi && lime_openal && !macro) #if !hl + #if (lime_cffi && lime_openal && !macro) NativeCFFI.lime_alc_suspend_context (context); - #else - NativeCFFI.hl_lime_alc_suspend_context (context); - #end #end + #end } diff --git a/lime/media/openal/ALContext.hx b/lime/media/openal/ALContext.hx index a2de31863..5c908e1f9 100644 --- a/lime/media/openal/ALContext.hx +++ b/lime/media/openal/ALContext.hx @@ -1,4 +1,4 @@ -package lime.media.openal; #if !hl +package lime.media.openal; import lime.system.CFFIPointer; @@ -17,9 +17,4 @@ abstract ALContext(CFFIPointer) from CFFIPointer to CFFIPointer { } -} - - -#else -typedef ALContext = hl.Abstract<"alc_context">; -#end \ No newline at end of file +} \ No newline at end of file diff --git a/lime/media/openal/ALDevice.hx b/lime/media/openal/ALDevice.hx index 30fafd95e..06c554417 100644 --- a/lime/media/openal/ALDevice.hx +++ b/lime/media/openal/ALDevice.hx @@ -1,4 +1,4 @@ -package lime.media.openal; #if !hl +package lime.media.openal; import lime.system.CFFIPointer; @@ -17,9 +17,4 @@ abstract ALDevice(CFFIPointer) from CFFIPointer to CFFIPointer { } -} - - -#else -typedef ALDevice = hl.Abstract<"alc_device">; -#end \ No newline at end of file +} \ No newline at end of file diff --git a/lime/project/ProjectXMLParser.hx b/lime/project/ProjectXMLParser.hx index c10728ae3..1fb8683d3 100644 --- a/lime/project/ProjectXMLParser.hx +++ b/lime/project/ProjectXMLParser.hx @@ -94,12 +94,6 @@ class ProjectXMLParser extends HXProject { defines.set ("native", "1"); defines.set ("neko", "1"); - } else if (targetFlags.exists ("hl")) { - - defines.set ("targetType", "hl"); - defines.set ("native", "1"); - defines.set ("hl", "1"); - } else if (targetFlags.exists ("java")) { defines.set ("targetType", "java"); diff --git a/lime/tools/platforms/LinuxPlatform.hx b/lime/tools/platforms/LinuxPlatform.hx index 096aa2a34..8db1f546f 100644 --- a/lime/tools/platforms/LinuxPlatform.hx +++ b/lime/tools/platforms/LinuxPlatform.hx @@ -64,10 +64,6 @@ class LinuxPlatform extends PlatformTarget { targetType = "neko"; - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - } else if (project.targetFlags.exists ("nodejs")) { targetType = "nodejs"; @@ -98,17 +94,15 @@ class LinuxPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static") || targetType != "cpp") { - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - for (ndll in project.ndlls) { if (isRaspberryPi) { - FileHelper.copyLibrary (project, ndll, "RPi", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix); + FileHelper.copyLibrary (project, ndll, "RPi", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug); } else { - FileHelper.copyLibrary (project, ndll, "Linux" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix); + FileHelper.copyLibrary (project, ndll, "Linux" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug); } @@ -134,19 +128,11 @@ class LinuxPlatform extends PlatformTarget { } - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl")); - } else if (targetType == "nodejs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); //NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); + NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "java") { @@ -263,7 +249,6 @@ class LinuxPlatform extends PlatformTarget { context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; context.CPP_DIR = targetDirectory + "/obj/"; context.BUILD_DIR = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : ""); context.WIN_ALLOW_SHADERS = false; @@ -325,11 +310,7 @@ class LinuxPlatform extends PlatformTarget { } - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { + if (targetType == "nodejs") { NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments); diff --git a/lime/tools/platforms/MacPlatform.hx b/lime/tools/platforms/MacPlatform.hx index 7154f148e..6ebe9cae9 100644 --- a/lime/tools/platforms/MacPlatform.hx +++ b/lime/tools/platforms/MacPlatform.hx @@ -58,10 +58,6 @@ class MacPlatform extends PlatformTarget { targetType = "neko"; - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - } else if (project.targetFlags.exists ("java")) { targetType = "java"; @@ -98,11 +94,9 @@ class MacPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static") || targetType != "cpp") { - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - for (ndll in project.ndlls) { - FileHelper.copyLibrary (project, ndll, "Mac" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory, project.debug, targetSuffix); + FileHelper.copyLibrary (project, ndll, "Mac" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory, project.debug); } @@ -117,14 +111,6 @@ class MacPlatform extends PlatformTarget { NekoHelper.createExecutable (project.templatePaths, "mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory); - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (executableDirectory, project.app.file + ".hl")); - } else if (targetType == "java") { var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/"); @@ -145,7 +131,7 @@ class MacPlatform extends PlatformTarget { if (noOutput) return; //NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory); + NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory); } else if (targetType == "cs") { @@ -238,7 +224,6 @@ class MacPlatform extends PlatformTarget { var context = project.templateContext; context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; context.NODE_FILE = executableDirectory + "/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; context.CPP_DIR = targetDirectory + "/obj/"; context.BUILD_DIR = project.app.path + "/mac" + (is64 ? "64" : ""); @@ -291,11 +276,7 @@ class MacPlatform extends PlatformTarget { } - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { + if (targetType == "nodejs") { NodeJSHelper.run (project, executableDirectory + "/ApplicationMain.js", arguments); diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx index ebf223ba6..d95b5ddc5 100644 --- a/lime/tools/platforms/WindowsPlatform.hx +++ b/lime/tools/platforms/WindowsPlatform.hx @@ -63,10 +63,6 @@ class WindowsPlatform extends PlatformTarget { targetType = "neko"; - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - } else if (project.targetFlags.exists ("nodejs")) { targetType = "nodejs"; @@ -165,11 +161,9 @@ class WindowsPlatform extends PlatformTarget { if (!project.targetFlags.exists ("static") || targetType != "cpp") { - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - for (ndll in project.ndlls) { - FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix); + FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug); } @@ -194,14 +188,6 @@ class WindowsPlatform extends PlatformTarget { NekoHelper.createWindowsExecutable (project.templatePaths, targetDirectory + "/obj/ApplicationMain.n", executablePath, iconPath); NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl")); - } else if (targetType == "nodejs") { ProcessHelper.runCommand ("", "haxe", [ hxml ]); @@ -209,7 +195,7 @@ class WindowsPlatform extends PlatformTarget { if (noOutput) return; //NekoHelper.createExecutable (project.templatePaths, "windows" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); + NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); } else if (targetType == "cs") { @@ -366,7 +352,6 @@ class WindowsPlatform extends PlatformTarget { context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; context.CPP_DIR = targetDirectory + "/obj"; context.BUILD_DIR = project.app.path + "/windows" + (is64 ? "64" : ""); @@ -430,11 +415,7 @@ class WindowsPlatform extends PlatformTarget { } - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { + if (targetType == "nodejs") { NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments); diff --git a/lime/utils/Bytes.hx b/lime/utils/Bytes.hx index d30ed916b..1950c1283 100644 --- a/lime/utils/Bytes.hx +++ b/lime/utils/Bytes.hx @@ -19,8 +19,6 @@ abstract Bytes(HaxeBytes) from HaxeBytes to HaxeBytes { #if js this = new HaxeBytes (bytesData); - #elseif hl - this = new HaxeBytes (bytesData, length); #else this = new HaxeBytes (length, bytesData); #end diff --git a/project/Build.xml b/project/Build.xml index 3632b830c..bb9c6d776 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -54,7 +54,6 @@ - @@ -413,7 +412,7 @@ - +
diff --git a/project/include/hl.h b/project/include/hl.h deleted file mode 100644 index a132e5bd4..000000000 --- a/project/include/hl.h +++ /dev/null @@ -1,826 +0,0 @@ -/* - * Copyright (C)2005-2016 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -#ifndef HL_H -#define HL_H - -/** - Detailed documentation can be found here: - https://github.com/HaxeFoundation/hashlink/wiki/ -**/ - -#define HL_VERSION 0x160 - -#if defined(_WIN32) -# define HL_WIN -# ifndef _DURANGO -# define HL_WIN_DESKTOP -# endif -#endif - -#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh) -#include -#if TARGET_OS_IOS -#define HL_IOS -#elif TARGET_OS_TV -#define HL_TVOS -#elif TARGET_OS_MAC -#define HL_MAC -#endif -#endif - -#ifdef __ANDROID__ -# define HL_ANDROID -#endif - -#if defined(linux) || defined(__linux__) -# define HL_LINUX -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif -#endif - -#if defined(HL_IOS) || defined(HL_ANDROID) || defined(HL_TVOS) -# define HL_MOBILE -#endif - -#ifdef __ORBIS__ -# define HL_PS -#endif - -#ifdef __NX__ -# define HL_NX -#endif - -#ifdef _DURANGO -# define HL_XBO -#endif - -#if defined(HL_PS) || defined(HL_NX) || defined(HL_XBO) -# define HL_CONSOLE -#endif - -#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && !defined(HL_CONSOLE) -# define HL_BSD -#endif - -#if defined(_64BITS) || defined(__x86_64__) || defined(_M_X64) || defined(__LP64__) -# define HL_64 -#endif - -#if defined(__GNUC__) -# define HL_GCC -#endif - -#if defined(__MINGW32__) -# define HL_MINGW -#endif - -#if defined(__CYGWIN__) -# define HL_CYGWIN -#endif - -#if defined(__llvm__) -# define HL_LLVM -#endif - -#if defined(__clang__) -# define HL_CLANG -#endif - -#if defined(_MSC_VER) && !defined(HL_LLVM) -# define HL_VCC -# pragma warning(disable:4996) // remove deprecated C API usage warnings -# pragma warning(disable:4055) // void* - to - function cast -# pragma warning(disable:4152) // void* - to - function cast -# pragma warning(disable:4201) // anonymous struct -# pragma warning(disable:4127) // while( true ) -# pragma warning(disable:4710) // inline disabled -# pragma warning(disable:4711) // inline activated -# pragma warning(disable:4255) // windows include -# pragma warning(disable:4820) // windows include -# pragma warning(disable:4668) // windows include -# pragma warning(disable:4738) // return float bad performances -#endif - -#if defined(HL_VCC) || defined(HL_MINGW) || defined(HL_CYGWIN) -# define HL_WIN_CALL -#endif - -#ifdef _DEBUG -# define HL_DEBUG -#endif - -#ifndef HL_NO_THREADS -# define HL_THREADS -# ifdef HL_VCC -# define HL_THREAD_VAR __declspec( thread ) -# define HL_THREAD_STATIC_VAR HL_THREAD_VAR static -# else -# define HL_THREAD_VAR __thread -# define HL_THREAD_STATIC_VAR static HL_THREAD_VAR -# endif -#else -# define HL_THREAD_VAR -# define HL_THREAD_STATIC_VAR static -#endif - -#include -#ifndef HL_VCC -# include -#endif - -#if defined(HL_VCC) || defined(HL_MINGW) -# define EXPORT __declspec( dllexport ) -# define IMPORT __declspec( dllimport ) -#else -# define EXPORT -# define IMPORT extern -#endif - -#ifdef HL_64 -# define HL_WSIZE 8 -# define IS_64 1 -# ifdef HL_VCC -# define _PTR_FMT L"%IX" -# else -# define _PTR_FMT u"%lX" -# endif -#else -# define HL_WSIZE 4 -# define IS_64 0 -# ifdef HL_VCC -# define _PTR_FMT L"%IX" -# else -# define _PTR_FMT u"%X" -# endif -#endif - -#ifdef __cplusplus -# define C_FUNCTION_BEGIN extern "C" { -# define C_FUNCTION_END }; -#else -# define C_FUNCTION_BEGIN -# define C_FUNCTION_END -# ifndef true -# define true 1 -# define false 0 - typedef unsigned char bool; -# endif -#endif - -typedef intptr_t int_val; -typedef long long int64; -typedef unsigned long long uint64; - -#include -#include -#include - -#if defined(LIBHL_EXPORTS) -#define HL_API extern EXPORT -#elif defined(LIBHL_STATIC) -#define HL_API extern -#else -#define HL_API IMPORT -#endif - -// -------------- UNICODE ----------------------------------- - -#if defined(HL_WIN) && !defined(HL_LLVM) -#ifdef HL_WIN_DESKTOP -# include -#else -# include -#endif -# include -typedef wchar_t uchar; -# define USTR(str) L##str -# define HL_NATIVE_UCHAR_FUN -# define usprintf swprintf -# define uprintf wprintf -# define ustrlen wcslen -# define ustrdup _wcsdup -# define uvsprintf wvsprintf -# define utod(s,end) wcstod(s,end) -# define utoi(s,end) wcstol(s,end,10) -# define ucmp(a,b) wcscmp(a,b) -# define utostr(out,size,str) wcstombs(out,str,size) -#elif defined(HL_MAC) -typedef uint16_t uchar; -# undef USTR -# define USTR(str) u##str -#else -# include -#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC) -#include -#include -typedef uint16_t char16_t; -typedef uint32_t char32_t; -#else -# include -#endif -typedef char16_t uchar; -# undef USTR -# define USTR(str) u##str -#endif - -#ifndef HL_NATIVE_UCHAR_FUN -C_FUNCTION_BEGIN -HL_API int ustrlen( const uchar *str ); -HL_API uchar *ustrdup( const uchar *str ); -HL_API double utod( const uchar *str, uchar **end ); -HL_API int utoi( const uchar *str, uchar **end ); -HL_API int ucmp( const uchar *a, const uchar *b ); -HL_API int utostr( char *out, int out_size, const uchar *str ); -HL_API int usprintf( uchar *out, int out_size, const uchar *fmt, ... ); -HL_API int uvsprintf( uchar *out, const uchar *fmt, va_list arglist ); -HL_API void uprintf( const uchar *fmt, const uchar *str ); -C_FUNCTION_END -#endif - -#if defined(HL_VCC) -# define hl_debug_break() if( IsDebuggerPresent() ) __debugbreak() -#elif defined(HL_PS) && defined(_DEBUG) -# define hl_debug_break() __debugbreak() -#elif defined(HL_NX) -C_FUNCTION_BEGIN -HL_API void hl_debug_break( void ); -C_FUNCTION_END -#elif defined(HL_LINUX) && defined(__i386__) -# ifdef HL_64 -# define hl_debug_break() \ - if( hl_detect_debugger() ) \ - __asm__("0: int3;" \ - ".pushsection embed-breakpoints;" \ - ".quad 0b;" \ - ".popsection") -# else -# define hl_debug_break() \ - if( hl_detect_debugger() ) \ - __asm__("0: int3;" \ - ".pushsection embed-breakpoints;" \ - ".long 0b;" \ - ".popsection") -# endif -#else -# define hl_debug_break() -#endif - -// ---- TYPES ------------------------------------------- - -typedef enum { - HVOID = 0, - HUI8 = 1, - HUI16 = 2, - HI32 = 3, - HI64 = 4, - HF32 = 5, - HF64 = 6, - HBOOL = 7, - HBYTES = 8, - HDYN = 9, - HFUN = 10, - HOBJ = 11, - HARRAY = 12, - HTYPE = 13, - HREF = 14, - HVIRTUAL= 15, - HDYNOBJ = 16, - HABSTRACT=17, - HENUM = 18, - HNULL = 19, - // --------- - HLAST = 20, - _H_FORCE_INT = 0x7FFFFFFF -} hl_type_kind; - -typedef struct hl_type hl_type; -typedef struct hl_runtime_obj hl_runtime_obj; -typedef struct hl_alloc_block hl_alloc_block; -typedef struct { hl_alloc_block *cur; } hl_alloc; -typedef struct _hl_field_lookup hl_field_lookup; - -typedef struct { - hl_alloc alloc; - void **functions_ptrs; - hl_type **functions_types; -} hl_module_context; - -typedef struct { - hl_type **args; - hl_type *ret; - int nargs; - // storage for closure - hl_type *parent; - struct { - hl_type_kind kind; - void *p; - } closure_type; - struct { - hl_type **args; - hl_type *ret; - int nargs; - hl_type *parent; - } closure; -} hl_type_fun; - -typedef struct { - const uchar *name; - hl_type *t; - int hashed_name; -} hl_obj_field; - -typedef struct { - const uchar *name; - int findex; - int pindex; - int hashed_name; -} hl_obj_proto; - -typedef struct { - int nfields; - int nproto; - int nbindings; - const uchar *name; - hl_type *super; - hl_obj_field *fields; - hl_obj_proto *proto; - int *bindings; - void **global_value; - hl_module_context *m; - hl_runtime_obj *rt; -} hl_type_obj; - -typedef struct { - hl_obj_field *fields; - int nfields; - // runtime - int dataSize; - int *indexes; - hl_field_lookup *lookup; -} hl_type_virtual; - -typedef struct { - const uchar *name; - int nparams; - hl_type **params; - int size; - bool hasptr; - int *offsets; -} hl_enum_construct; - -typedef struct { - const uchar *name; - int nconstructs; - hl_enum_construct *constructs; - void **global_value; -} hl_type_enum; - -struct hl_type { - hl_type_kind kind; - union { - const uchar *abs_name; - hl_type_fun *fun; - hl_type_obj *obj; - hl_type_enum *tenum; - hl_type_virtual *virt; - hl_type *tparam; - }; - void **vobj_proto; - unsigned int *mark_bits; -}; - -C_FUNCTION_BEGIN - -HL_API int hl_type_size( hl_type *t ); -#define hl_pad_size(size,t) ((t)->kind == HVOID ? 0 : ((-(size)) & (hl_type_size(t) - 1))) -HL_API int hl_pad_struct( int size, hl_type *t ); - -HL_API hl_runtime_obj *hl_get_obj_rt( hl_type *ot ); -HL_API hl_runtime_obj *hl_get_obj_proto( hl_type *ot ); -HL_API void hl_init_enum( hl_type *et, hl_module_context *m ); - -/* -------------------- VALUES ------------------------------ */ - -typedef unsigned char vbyte; - -typedef struct { - hl_type *t; -# ifndef HL_64 - int __pad; // force align on 16 bytes for double -# endif - union { - bool b; - unsigned char ui8; - unsigned short ui16; - int i; - float f; - double d; - vbyte *bytes; - void *ptr; - int64 i64; - } v; -} vdynamic; - -typedef struct { - hl_type *t; - /* fields data */ -} vobj; - -typedef struct _vvirtual vvirtual; -struct _vvirtual { - hl_type *t; - vdynamic *value; - vvirtual *next; -}; - -#define hl_vfields(v) ((void**)(((vvirtual*)(v))+1)) - -typedef struct { - hl_type *t; - hl_type *at; - int size; - int __pad; // force align on 16 bytes for double -} varray; - -typedef struct _vclosure { - hl_type *t; - void *fun; - int hasValue; -# ifdef HL_64 - int __pad; -# endif - void *value; -} vclosure; - -typedef struct { - vclosure cl; - vclosure *wrappedFun; -} vclosure_wrapper; - -struct _hl_field_lookup { - hl_type *t; - int hashed_name; - int field_index; // negative or zero : index in methods -}; - -typedef struct { - void *ptr; - hl_type *closure; - int fid; -} hl_runtime_binding; - -struct hl_runtime_obj { - hl_type *t; - // absolute - int nfields; - int nproto; - int size; - int nmethods; - int nbindings; - bool hasPtr; - void **methods; - int *fields_indexes; - hl_runtime_binding *bindings; - hl_runtime_obj *parent; - const uchar *(*toStringFun)( vdynamic *obj ); - int (*compareFun)( vdynamic *a, vdynamic *b ); - vdynamic *(*castFun)( vdynamic *obj, hl_type *t ); - vdynamic *(*getFieldFun)( vdynamic *obj, int hfield ); - // relative - int nlookup; - hl_field_lookup *lookup; -}; - -typedef struct { - hl_type *t; - hl_field_lookup *lookup; - char *raw_data; - void **values; - int nfields; - int raw_size; - int nvalues; - vvirtual *virtuals; -} vdynobj; - -typedef struct _venum { - hl_type *t; - int index; -} venum; - -HL_API hl_type hlt_void; -HL_API hl_type hlt_i32; -HL_API hl_type hlt_i64; -HL_API hl_type hlt_f64; -HL_API hl_type hlt_f32; -HL_API hl_type hlt_dyn; -HL_API hl_type hlt_array; -HL_API hl_type hlt_bytes; -HL_API hl_type hlt_dynobj; -HL_API hl_type hlt_bool; -HL_API hl_type hlt_abstract; - -HL_API double hl_nan( void ); -HL_API bool hl_is_dynamic( hl_type *t ); -#define hl_is_ptr(t) ((t)->kind >= HBYTES) -HL_API bool hl_same_type( hl_type *a, hl_type *b ); -HL_API bool hl_safe_cast( hl_type *t, hl_type *to ); - -#define hl_aptr(a,t) ((t*)(((varray*)(a))+1)) - -HL_API varray *hl_alloc_array( hl_type *t, int size ); -HL_API vdynamic *hl_alloc_dynamic( hl_type *t ); -HL_API vdynamic *hl_alloc_dynbool( bool b ); -HL_API vdynamic *hl_alloc_obj( hl_type *t ); -HL_API venum *hl_alloc_enum( hl_type *t, int index ); -HL_API vvirtual *hl_alloc_virtual( hl_type *t ); -HL_API vdynobj *hl_alloc_dynobj( void ); -HL_API vbyte *hl_alloc_bytes( int size ); -HL_API vbyte *hl_copy_bytes( const vbyte *byte, int size ); -HL_API int hl_utf8_length( const vbyte *s, int pos ); -HL_API int hl_from_utf8( uchar *out, int outLen, const char *str ); -HL_API char *hl_to_utf8( const uchar *bytes ); -HL_API uchar *hl_to_utf16( const char *str ); -HL_API vdynamic *hl_virtual_make_value( vvirtual *v ); -HL_API hl_obj_field *hl_obj_field_fetch( hl_type *t, int fid ); - -HL_API int hl_hash( vbyte *name ); -HL_API int hl_hash_utf8( const char *str ); // no cache -HL_API int hl_hash_gen( const uchar *name, bool cache_name ); -HL_API const uchar *hl_field_name( int hash ); - -#define hl_error(msg) hl_error_msg(USTR(msg)) -HL_API void hl_error_msg( const uchar *msg, ... ); -HL_API void hl_assert( void ); -HL_API void hl_throw( vdynamic *v ); -HL_API void hl_rethrow( vdynamic *v ); -HL_API void hl_setup_longjump( void *j ); -HL_API void hl_setup_exception( void *resolve_symbol, void *capture_stack ); -HL_API void hl_dump_stack( void ); -HL_API varray *hl_exception_stack( void ); -HL_API bool hl_detect_debugger( void ); - -HL_API vvirtual *hl_to_virtual( hl_type *vt, vdynamic *obj ); -HL_API void hl_init_virtual( hl_type *vt, hl_module_context *ctx ); -HL_API hl_field_lookup *hl_lookup_find( hl_field_lookup *l, int size, int hash ); -HL_API hl_field_lookup *hl_lookup_insert( hl_field_lookup *l, int size, int hash, hl_type *t, int index ); - -HL_API int hl_dyn_geti( vdynamic *d, int hfield, hl_type *t ); -HL_API void *hl_dyn_getp( vdynamic *d, int hfield, hl_type *t ); -HL_API float hl_dyn_getf( vdynamic *d, int hfield ); -HL_API double hl_dyn_getd( vdynamic *d, int hfield ); - -HL_API int hl_dyn_casti( void *data, hl_type *t, hl_type *to ); -HL_API void *hl_dyn_castp( void *data, hl_type *t, hl_type *to ); -HL_API float hl_dyn_castf( void *data, hl_type *t ); -HL_API double hl_dyn_castd( void *data, hl_type *t ); - -#define hl_invalid_comparison 0xAABBCCDD -HL_API int hl_dyn_compare( vdynamic *a, vdynamic *b ); -HL_API vdynamic *hl_make_dyn( void *data, hl_type *t ); -HL_API void hl_write_dyn( void *data, hl_type *t, vdynamic *v ); - -HL_API void hl_dyn_seti( vdynamic *d, int hfield, hl_type *t, int value ); -HL_API void hl_dyn_setp( vdynamic *d, int hfield, hl_type *t, void *ptr ); -HL_API void hl_dyn_setf( vdynamic *d, int hfield, float f ); -HL_API void hl_dyn_setd( vdynamic *d, int hfield, double v ); - -typedef enum { - OpAdd, - OpSub, - OpMul, - OpMod, - OpDiv, - OpShl, - OpShr, - OpUShr, - OpAnd, - OpOr, - OpXor, - OpLast -} DynOp; -HL_API vdynamic *hl_dyn_op( int op, vdynamic *a, vdynamic *b ); - -HL_API vclosure *hl_alloc_closure_void( hl_type *t, void *fvalue ); -HL_API vclosure *hl_alloc_closure_ptr( hl_type *fullt, void *fvalue, void *ptr ); -HL_API vclosure *hl_make_fun_wrapper( vclosure *c, hl_type *to ); -HL_API void *hl_wrapper_call( void *value, void **args, vdynamic *ret ); -HL_API void *hl_dyn_call_obj( vdynamic *obj, hl_type *ft, int hfield, void **args, vdynamic *ret ); -HL_API vdynamic *hl_dyn_call( vclosure *c, vdynamic **args, int nargs ); -HL_API vdynamic *hl_dyn_call_safe( vclosure *c, vdynamic **args, int nargs, bool *isException ); - -// ----------------------- THREADS -------------------------------------------------- - -struct _hl_thread; -struct _hl_mutex; -struct _hl_tls; -typedef struct _hl_thread hl_thread; -typedef struct _hl_mutex hl_mutex; -typedef struct _hl_tls hl_tls; - -HL_API hl_thread *hl_thread_start( void *callback, void *param, bool withGC ); -HL_API hl_thread *hl_thread_current( void ); -HL_API void hl_thread_yield(void); -HL_API void hl_register_thread( void *stack_top ); -HL_API void hl_unregister_thread( void ); - -HL_API hl_mutex *hl_mutex_alloc( void ); -HL_API void hl_mutex_acquire( hl_mutex *l ); -HL_API bool hl_mutex_try_acquire( hl_mutex *l ); -HL_API void hl_mutex_release( hl_mutex *l ); -HL_API void hl_mutex_free( hl_mutex *l ); - -HL_API hl_tls *hl_tls_alloc( void ); -HL_API void hl_tls_set( hl_tls *l, void *value ); -HL_API void *hl_tls_get( hl_tls *l ); -HL_API void hl_tls_free( hl_tls *l ); - -// ----------------------- ALLOC -------------------------------------------------- - -#define MEM_HAS_PTR(kind) (!((kind)&2)) -#define MEM_KIND_DYNAMIC 0 -#define MEM_KIND_RAW 1 -#define MEM_KIND_NOPTR 2 -#define MEM_KIND_FINALIZER 3 -#define MEM_ALIGN_DOUBLE 128 -#define MEM_ZERO 256 - -HL_API void *hl_gc_alloc_gen( hl_type *t, int size, int flags ); -HL_API void hl_add_root( void *ptr ); -HL_API void hl_remove_root( void *ptr ); -HL_API void hl_gc_major( void ); -HL_API bool hl_is_gc_ptr( void *ptr ); - -HL_API void hl_blocking( bool b ); -HL_API bool hl_is_blocking( void ); - -typedef void (*hl_types_dump)( void (*)( void *, int) ); -HL_API void hl_gc_set_dump_types( hl_types_dump tdump ); - -#define hl_gc_alloc_noptr(size) hl_gc_alloc_gen(&hlt_bytes,size,MEM_KIND_NOPTR) -#define hl_gc_alloc(t,size) hl_gc_alloc_gen(t,size,MEM_KIND_DYNAMIC) -#define hl_gc_alloc_raw(size) hl_gc_alloc_gen(&hlt_abstract,size,MEM_KIND_RAW) -#define hl_gc_alloc_finalizer(size) hl_gc_alloc_gen(&hlt_abstract,size,MEM_KIND_FINALIZER) - -HL_API void hl_alloc_init( hl_alloc *a ); -HL_API void *hl_malloc( hl_alloc *a, int size ); -HL_API void *hl_zalloc( hl_alloc *a, int size ); -HL_API void hl_free( hl_alloc *a ); - -HL_API void hl_global_init( void ); -HL_API void hl_global_free( void ); - -HL_API void *hl_alloc_executable_memory( int size ); -HL_API void hl_free_executable_memory( void *ptr, int size ); - -// ----------------------- BUFFER -------------------------------------------------- - -typedef struct hl_buffer hl_buffer; - -HL_API hl_buffer *hl_alloc_buffer( void ); -HL_API void hl_buffer_val( hl_buffer *b, vdynamic *v ); -HL_API void hl_buffer_char( hl_buffer *b, uchar c ); -HL_API void hl_buffer_str( hl_buffer *b, const uchar *str ); -HL_API void hl_buffer_cstr( hl_buffer *b, const char *str ); -HL_API void hl_buffer_str_sub( hl_buffer *b, const uchar *str, int len ); -HL_API int hl_buffer_length( hl_buffer *b ); -HL_API uchar *hl_buffer_content( hl_buffer *b, int *len ); -HL_API uchar *hl_to_string( vdynamic *v ); -HL_API const uchar *hl_type_str( hl_type *t ); - -// ----------------------- FFI ------------------------------------------------------ - -// match GNU C++ mangling -#define TYPE_STR "vcsilfdbBDPOATR??X?N" - -#undef _VOID -#define _NO_ARG -#define _VOID "v" -#define _I8 "c" -#define _I16 "s" -#define _I32 "i" -#define _I64 "l" -#define _F32 "f" -#define _F64 "d" -#define _BOOL "b" -#define _BYTES "B" -#define _DYN "D" -#define _FUN(t, args) "P" args "_" t -#define _OBJ(fields) "O" fields "_" -#define _ARR "A" -#define _TYPE "T" -#define _REF(t) "R" t -#define _ABSTRACT(name) "X" #name "_" -#undef _NULL -#define _NULL(t) "N" t - -#undef _STRING -#define _STRING _OBJ(_BYTES _I32) - -typedef struct { - hl_type *t; - uchar *bytes; - int length; -} vstring; - -// #define DEFINE_PRIM(t,name,args) DEFINE_PRIM_WITH_NAME(t,name,args,name) -#define DEFINE_HL_PRIM(t,name,args) DEFINE_PRIM_WITH_NAME(t,name,args,name) -#define _DEFINE_PRIM_WITH_NAME(t,name,args,realName) C_FUNCTION_BEGIN EXPORT void *hlp_##realName( const char **sign ) { *sign = _FUN(t,args); return (void*)(&HL_NAME(name)); } C_FUNCTION_END - -#if !defined(HL_NAME) -# define HL_NAME(p) p -# ifdef LIBHL_EXPORTS -# define HL_PRIM EXPORT -// # undef DEFINE_PRIM -# undef DEFINE_HL_PRIM -// # define DEFINE_PRIM(t,name,args) _DEFINE_PRIM_WITH_NAME(t,hl_##name,args,name) -# define DEFINE_HL_PRIM(t,name,args) _DEFINE_PRIM_WITH_NAME(t,hl_##name,args,name) -# define DEFINE_PRIM_WITH_NAME _DEFINE_PRIM_WITH_NAME -# else -# define HL_PRIM -# define DEFINE_PRIM_WITH_NAME(t,name,args,realName) -# endif -#elif defined(LIBHL_STATIC) -# ifdef __cplusplus -# define HL_PRIM extern "C" -# else -# define HL_PRIM -# endif -#define DEFINE_PRIM_WITH_NAME(t,name,args,realName) -#else -# ifdef __cplusplus -# define HL_PRIM extern "C" EXPORT -# else -# define HL_PRIM EXPORT -# endif -# define DEFINE_PRIM_WITH_NAME _DEFINE_PRIM_WITH_NAME -#endif - -// -------------- EXTRA ------------------------------------ - -#define hl_fatal(msg) hl_fatal_error(msg,__FILE__,__LINE__) -#define hl_fatal1(msg,p0) hl_fatal_fmt(__FILE__,__LINE__,msg,p0) -#define hl_fatal2(msg,p0,p1) hl_fatal_fmt(__FILE__,__LINE__,msg,p0,p1) -#define hl_fatal3(msg,p0,p1,p2) hl_fatal_fmt(__FILE__,__LINE__,msg,p0,p1,p2) -#define hl_fatal4(msg,p0,p1,p2,p3) hl_fatal_fmt(__FILE__,__LINE__,msg,p0,p1,p2,p3) -HL_API void *hl_fatal_error( const char *msg, const char *file, int line ); -HL_API void hl_fatal_fmt( const char *file, int line, const char *fmt, ...); -HL_API void hl_sys_init(void **args, int nargs, void *hlfile); -HL_API void hl_setup_callbacks(void *sc, void *gw); - -#include -typedef struct _hl_trap_ctx hl_trap_ctx; -struct _hl_trap_ctx { - jmp_buf buf; - hl_trap_ctx *prev; -}; -#define hl_trap(ctx,r,label) { hl_thread_info *__tinf = hl_get_thread(); ctx.prev = __tinf->trap_current; __tinf->trap_current = &ctx; if( setjmp(ctx.buf) ) { r = __tinf->exc_value; goto label; } } -#define hl_endtrap(ctx) hl_get_thread()->trap_current = ctx.prev - -#define HL_EXC_MAX_STACK 0x100 -#define HL_EXC_RETHROW 1 -#define HL_EXC_CATCH_ALL 2 -#define HL_EXC_IS_THROW 4 - -typedef struct { - int thread_id; - // gc vars - volatile int gc_blocking; - void *stack_top; - void *stack_cur; - // exception handling - hl_trap_ctx *trap_current; - hl_trap_ctx *trap_uncaught; - vclosure *exc_handler; - vdynamic *exc_value; - int exc_flags; - int exc_stack_count; - // extra - jmp_buf gc_regs; - void *exc_stack_trace[HL_EXC_MAX_STACK]; -} hl_thread_info; - -HL_API hl_thread_info *hl_get_thread(); - -C_FUNCTION_END - -#endif \ No newline at end of file diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 960b2ff26..84379ff44 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -7,9 +7,6 @@ #endif -#ifdef LIME_HASHLINK -#include -#endif #include #include #include diff --git a/project/src/media/openal/OpenALBindings.cpp b/project/src/media/openal/OpenALBindings.cpp index 2ce038bee..57434491b 100644 --- a/project/src/media/openal/OpenALBindings.cpp +++ b/project/src/media/openal/OpenALBindings.cpp @@ -12,7 +12,6 @@ #endif #endif -#include #include #include #include @@ -127,15 +126,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_auxf (unsigned effectslot, int param, float flValue) { - - #ifdef LIME_OPENALSOFT - alAuxiliaryEffectSlotf (effectslot, param, flValue); - #endif - - } - - void lime_al_auxfv (value aux, int param, value values) { #ifdef LIME_OPENALSOFT @@ -161,15 +151,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_auxfv (unsigned effectslot, int param, vbyte* pflValues) { - - #ifdef LIME_OPENALSOFT - alAuxiliaryEffectSlotfv (effectslot, param, (ALfloat*)pflValues); - #endif - - } - - void lime_al_auxi (value aux, int param, value val) { #ifdef LIME_OPENALSOFT @@ -192,15 +173,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_auxi (unsigned effectslot, int param, int iValue) { - - #ifdef LIME_OPENALSOFT - alAuxiliaryEffectSloti(effectslot, param, iValue); - #endif - - } - - void lime_al_auxiv (value aux, int param, value values) { #ifdef LIME_OPENALSOFT @@ -226,15 +198,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_auxiv (unsigned effectslot, int param, vbyte* piValues) { - - #ifdef LIME_OPENALSOFT - alAuxiliaryEffectSlotiv (effectslot, param, (ALint*)piValues); - #endif - - } - - void lime_al_buffer_data (value buffer, int format, value data, int size, int freq) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -244,13 +207,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_buffer_data (unsigned buffer, int format, vbyte* data, int size, int freq) { - - alBufferData (buffer, format, data, size, freq); - - } - - void lime_al_buffer3f (value buffer, int param, float value1, float value2, float value3) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -259,13 +215,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_buffer3f (unsigned buffer, int param, float value1, float value2, float value3) { - - alBuffer3f (buffer, param, value1, value2, value3); - - } - - void lime_al_buffer3i (value buffer, int param, int value1, int value2, int value3) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -274,25 +223,11 @@ namespace lime { } - HL_PRIM void hl_lime_al_buffer3i (unsigned buffer, int param, int value1, int value2, int value3) { - - alBuffer3i (buffer, param, value1, value2, value3); - - } - - void lime_al_bufferf (value buffer, int param, float value) { - + ALuint id = (ALuint)(uintptr_t)val_data (buffer); alBufferf (id, param, value); - - } - - - HL_PRIM void hl_lime_al_bufferf (unsigned buffer, int param, float value) { - - alBufferf (buffer, param, value); - + } @@ -319,13 +254,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_bufferfv (unsigned buffer, int param, vbyte* values) { - - alBufferfv (buffer, param, (ALfloat*)values); - - } - - void lime_al_bufferi (value buffer, int param, int value) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -334,13 +262,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_bufferi (unsigned buffer, int param, int value) { - - alBufferi (buffer, param, value); - - } - - void lime_al_bufferiv (value buffer, int param, value values) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -364,13 +285,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_bufferiv (unsigned buffer, int param, vbyte* values) { - - alBufferiv (buffer, param, (ALint*)values); - - } - - void lime_al_cleanup () { #ifdef LIME_OPENAL_DELETION_DELAY @@ -446,15 +360,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_auxiliary_effect_slot (unsigned aux) { - - #ifdef LIME_OPENALSOFT - alDeleteAuxiliaryEffectSlots (1, &aux); - #endif - - } - - void lime_al_delete_buffer (value buffer) { if (!val_is_null (buffer)) { @@ -476,13 +381,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_buffer (unsigned buffer) { - - alDeleteBuffers (1, &buffer); - - } - - void lime_al_delete_buffers (int n, value buffers) { if (!val_is_null (buffers)) { @@ -531,13 +429,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_buffers (int n, vbyte* buffers) { - - alDeleteBuffers (n, (ALuint*)buffers); - - } - - void lime_al_delete_effect (value effect) { #ifdef LIME_OPENALSOFT @@ -553,13 +444,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_effect (unsigned effect) { - - alDeleteEffects (1, &effect); - - } - - void lime_al_delete_filter (value filter) { #ifdef LIME_OPENALSOFT @@ -575,13 +459,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_filter (unsigned filter) { - - alDeleteFilters (1, &filter); - - } - - void lime_al_delete_source (value source) { if (!val_is_null (source)) { @@ -590,7 +467,7 @@ namespace lime { val_gc (source, 0); #ifdef LIME_OPENAL_DELETION_DELAY al_gc_mutex.Lock (); - alSourcei (data, lime_al_BUFFER, 0); + alSourcei (data, AL_BUFFER, 0); alDeletedSource.push_back (data); alDeletedSourceTime.push_back (time (0)); al_gc_mutex.Unlock (); @@ -603,13 +480,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_source (unsigned source) { - - alDeleteSources (1, &source); - - } - - void lime_al_delete_sources (int n, value sources) { if (!val_is_null (sources)) { @@ -625,7 +495,7 @@ namespace lime { source = val_array_i (sources, i); data = (ALuint)(uintptr_t)val_data (source); - alSourcei (data, lime_al_BUFFER, 0); + alSourcei (data, AL_BUFFER, 0); alDeletedSource.push_back (data); alDeletedSourceTime.push_back (time (0)); val_gc (source, 0); @@ -655,13 +525,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_delete_sources (int n, vbyte* sources) { - - alDeleteSources (n, (ALuint*)sources); - - } - - void lime_al_disable (int capability) { alDisable (capability); @@ -669,13 +532,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_disable (int capability) { - - alDisable (capability); - - } - - void lime_al_distance_model (int distanceModel) { alDistanceModel (distanceModel); @@ -683,13 +539,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_distance_model (int value) { - - alDistanceModel (value); - - } - - void lime_al_doppler_factor (float factor) { alDopplerFactor (factor); @@ -697,13 +546,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_doppler_factor (float value) { - - alDopplerFactor (value); - - } - - void lime_al_doppler_velocity (float velocity) { alDopplerVelocity (velocity); @@ -711,13 +553,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_doppler_velocity (float value) { - - alDopplerVelocity (value); - - } - - void lime_al_effectf (value effect, int param, float value) { #ifdef LIME_OPENALSOFT @@ -728,13 +563,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_effectf (unsigned effect, int param, float flValue) { - - alEffectf (effect, param, flValue); - - } - - void lime_al_effectfv (value effect, int param, value values) { #ifdef LIME_OPENALSOFT @@ -760,13 +588,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_effectfv (unsigned effect, int param, vbyte* pflValues) { - - alEffectfv (effect, param, (ALfloat*)pflValues); - - } - - void lime_al_effecti (value effect, int param, int value) { #ifdef LIME_OPENALSOFT @@ -777,13 +598,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_effecti (unsigned effect, int param, int iValue) { - - alEffecti (effect, param, iValue); - - } - - void lime_al_effectiv (value effect, int param, value values) { #ifdef LIME_OPENALSOFT @@ -809,13 +623,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_effectiv (unsigned effect, int param, vbyte* piValues) { - - alEffectiv (effect, param, (ALint*)piValues); - - } - - void lime_al_enable (int capability) { alEnable (capability); @@ -823,13 +630,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_enable (int capability) { - - alEnable (capability); - - } - - void lime_al_filteri (value filter, int param, value val) { #ifdef LIME_OPENALSOFT @@ -844,13 +644,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_filteri (unsigned filter, int param, int iValue) { - - alFilteri (filter, param, iValue); - - } - - void lime_al_filterf (value filter, int param, float value) { #ifdef LIME_OPENALSOFT @@ -861,13 +654,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_filterf (unsigned filter, int param, float flValue) { - - alFilterf (filter, param, flValue); - - } - - value lime_al_gen_aux () { #ifdef LIME_OPENALSOFT @@ -881,19 +667,6 @@ namespace lime { } - HL_PRIM unsigned hl_lime_al_gen_aux () { - - #ifdef LIME_OPENALSOFT - ALuint aux; - alGenAuxiliaryEffectSlots (1, &aux); - return aux; - #else - return 0; - #endif - - } - - value lime_al_gen_buffer () { alGetError (); @@ -918,13 +691,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_buffer (unsigned buffer) { - - alGenBuffers (1, &buffer); - - } - - value lime_al_gen_buffers (int n) { alGetError (); @@ -964,13 +730,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_buffers (int n, vbyte* buffers) { - - alGenBuffers (n, (ALuint*)buffers); - - } - - value lime_al_gen_effect () { alGetError (); @@ -991,13 +750,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_effect (unsigned effect) { - - alGenEffects (1, &effect); - - } - - value lime_al_gen_filter () { alGetError (); @@ -1018,13 +770,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_filter (unsigned filter) { - - alGenFilters (1, &filter); - - } - - value lime_al_gen_source () { alGetError (); @@ -1045,13 +790,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_source (unsigned source) { - - alGenSources (1, &source); - - } - - value lime_al_gen_sources (int n) { alGetError (); @@ -1082,13 +820,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_gen_sources (int n, vbyte* sources) { - - alGenSources (n, (ALuint*)sources); - - } - - bool lime_al_get_boolean (int param) { return alGetBoolean (param); @@ -1096,13 +827,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_get_boolean (int param) { - - return alGetBoolean (param); - - } - - value lime_al_get_booleanv (int param, int count) { ALboolean* values = new ALboolean[count]; @@ -1122,13 +846,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_booleanv (int param, vbyte* values) { - - alGetBooleanv (param, (ALboolean*)values); - - } - - value lime_al_get_buffer3f (value buffer, int param) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1145,13 +862,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_buffer3f (unsigned buffer, int param, float *value1, float *value2, float *value3) { - - alGetBuffer3f (buffer, param, value1, value2, value3); - - } - - value lime_al_get_buffer3i (value buffer, int param) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1168,13 +878,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_buffer3i (unsigned buffer, int param, int *value1, int *value2, int *value3) { - - alGetBuffer3i (buffer, param, value1, value2, value3); - - } - - float lime_al_get_bufferf (value buffer, int param) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1185,15 +888,6 @@ namespace lime { } - HL_PRIM float hl_lime_al_get_bufferf (unsigned buffer, int param) { - - float value; - alGetBufferf (buffer, param, &value); - return value; - - } - - value lime_al_get_bufferfv (value buffer, int param, int count) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1214,13 +908,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_bufferfv (unsigned buffer, int param, vbyte* values) { - - alGetBufferfv (buffer, param, (ALfloat*)values); - - } - - int lime_al_get_bufferi (value buffer, int param) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1231,15 +918,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_bufferi (unsigned buffer, int param) { - - int value; - alGetBufferi (buffer, param, &value); - return value; - - } - - value lime_al_get_bufferiv (value buffer, int param, int count) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1260,13 +938,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_bufferiv (unsigned buffer, int param, vbyte* values) { - - alGetBufferiv (buffer, param, (ALint*)values); - - } - - double lime_al_get_double (int param) { return alGetDouble (param); @@ -1274,13 +945,6 @@ namespace lime { } - HL_PRIM double hl_lime_al_get_double (int param) { - - return alGetDouble (param); - - } - - value lime_al_get_doublev (int param, int count) { ALdouble* values = new ALdouble[count]; @@ -1300,13 +964,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_doublev (int param, vbyte* values) { - - alGetDoublev (param, (ALdouble*)values); - - } - - int lime_al_get_enum_value (HxString ename) { return alGetEnumValue (ename.__s); @@ -1314,13 +971,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_enum_value (vbyte* ename) { - - return alGetEnumValue ((char*)ename); - - } - - int lime_al_get_error () { return alGetError (); @@ -1328,13 +978,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_error () { - - return alGetError (); - - } - - int lime_al_get_filteri (value filter, int param) { #ifdef LIME_OPENALSOFT @@ -1349,15 +992,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_filteri (unsigned filter, int param) { - - int value; - alGetFilteri (filter, param, &value); - return value; - - } - - float lime_al_get_float (int param) { return alGetFloat (param); @@ -1365,13 +999,6 @@ namespace lime { } - HL_PRIM float hl_lime_al_get_float (int param) { - - return alGetFloat (param); - - } - - value lime_al_get_floatv (int param, int count) { ALfloat* values = new ALfloat[count]; @@ -1391,13 +1018,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_floatv (int param, vbyte* values) { - - alGetFloatv (param, (ALfloat*)values); - - } - - int lime_al_get_integer (int param) { return alGetInteger (param); @@ -1405,13 +1025,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_integer (int param) { - - return alGetInteger (param); - - } - - value lime_al_get_integerv (int param, int count) { ALint* values = new ALint[count]; @@ -1431,13 +1044,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_integerv (int param, vbyte* values) { - - alGetIntegerv (param, (ALint*)values); - - } - - value lime_al_get_listener3f (int param) { ALfloat val1, val2, val3; @@ -1453,13 +1059,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_listener3f (int param, float *value1, float *value2, float *value3) { - - alGetListener3f (param, value1, value2, value3); - - } - - value lime_al_get_listener3i (int param) { ALint val1, val2, val3; @@ -1475,13 +1074,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_listener3i (int param, int *value1, int *value2, int *value3) { - - alGetListener3i (param, value1, value2, value3); - - } - - float lime_al_get_listenerf (int param) { ALfloat data; @@ -1491,15 +1083,6 @@ namespace lime { } - HL_PRIM float hl_lime_al_get_listenerf (int param) { - - float value; - alGetListenerf (param, &value); - return value; - - } - - value lime_al_get_listenerfv (int param, int count) { ALfloat* values = new ALfloat[count]; @@ -1519,13 +1102,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_listenerfv (int param, vbyte* values) { - - alGetListenerfv (param, (ALfloat*)values); - - } - - int lime_al_get_listeneri (int param) { ALint data; @@ -1535,15 +1111,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_listeneri (int param) { - - int value; - alGetListeneri (param, &value); - return value; - - } - - value lime_al_get_listeneriv (int param, int count) { ALint* values = new ALint[count]; @@ -1563,13 +1130,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_listeneriv (int param, vbyte* values) { - - alGetListeneriv (param, (ALint*)values); - - } - - double lime_al_get_proc_address (HxString fname) { return (uintptr_t)alGetProcAddress (fname.__s); @@ -1593,13 +1153,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_source3f (unsigned source, int param, float *value1, float *value2, float *value3) { - - alGetSource3f (source, param, value1, value2, value3); - - } - - value lime_al_get_source3i (value source, int param) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -1616,13 +1169,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_source3i (unsigned source, int param, int *value1, int *value2, int *value3) { - - alGetSource3i (source, param, value1, value2, value3); - - } - - float lime_al_get_sourcef (value source, int param) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -1633,15 +1179,6 @@ namespace lime { } - HL_PRIM float hl_lime_al_get_sourcef (unsigned source, int param) { - - float value; - alGetSourcef(source, param, &value); - return value; - - } - - value lime_al_get_sourcefv (value source, int param, int count) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -1662,13 +1199,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_sourcefv (unsigned source, int param, vbyte* values) { - - alGetSourcefv (source, param, (ALfloat*)values); - - } - - value lime_al_get_sourcei (value source, int param) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -1699,14 +1229,6 @@ namespace lime { } - HL_PRIM int hl_lime_al_get_sourcei (unsigned source, int param) { - - int value; - alGetSourcei (source, param, &value); - return value; - - } - value lime_al_get_sourceiv (value source, int param, int count) { @@ -1728,13 +1250,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_get_sourceiv (unsigned source, int param, vbyte* values) { - - alGetSourceiv (source, param, (ALint*)values); - - } - - value lime_al_get_string (int param) { const char* result = alGetString (param); @@ -1743,13 +1258,6 @@ namespace lime { } - HL_PRIM vbyte* hl_lime_al_get_string (int param) { - - return (vbyte*)alGetString (param); - - } - - bool lime_al_is_aux (value aux) { #ifdef LIME_OPENALSOFT @@ -1762,17 +1270,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_aux (unsigned effectslot) { - - #ifdef LIME_OPENALSOFT - return alIsAuxiliaryEffectSlot (effectslot) == AL_TRUE; - #else - return false; - #endif - - } - - bool lime_al_is_buffer (value buffer) { ALuint id = (ALuint)(uintptr_t)val_data (buffer); @@ -1781,13 +1278,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_buffer (unsigned buffer) { - - return alIsBuffer (buffer) == AL_TRUE; - - } - - bool lime_al_is_effect (value effect) { #ifdef LIME_OPENALSOFT @@ -1800,13 +1290,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_effect (unsigned effect) { - - return alIsEffect (effect) == AL_TRUE; - - } - - bool lime_al_is_enabled (int capability) { return alIsEnabled (capability); @@ -1814,13 +1297,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_enabled (int capability) { - - return alIsEnabled (capability) == AL_TRUE; - - } - - bool lime_al_is_extension_present (HxString extname) { #ifdef LIME_OPENALSOFT @@ -1832,13 +1308,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_extension_present (vbyte* extname) { - - return alIsExtensionPresent ((char*)extname) == AL_TRUE; - - } - - bool lime_al_is_filter (value filter) { #ifdef LIME_OPENALSOFT @@ -1851,13 +1320,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_filter (unsigned filter) { - - return alIsFilter (filter) == AL_TRUE; - - } - - bool lime_al_is_source (value source) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -1866,13 +1328,6 @@ namespace lime { } - HL_PRIM bool hl_lime_al_is_source (unsigned source) { - - return alIsSource (source) == AL_TRUE; - - } - - void lime_al_listener3f (int param, float value1, float value2, float value3) { alListener3f (param, value1, value2, value3); @@ -1880,13 +1335,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listener3f (int param, float value1, float value2, float value3) { - - alListener3f (param, value1, value2, value3); - - } - - void lime_al_listener3i (int param, int value1, int value2, int value3) { alListener3i (param, value1, value2, value3); @@ -1894,13 +1342,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listener3i (int param, int value1, int value2, int value3) { - - alListener3i (param, value1, value2, value3); - - } - - void lime_al_listenerf (int param, float value1) { alListenerf (param, value1); @@ -1908,13 +1349,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listenerf (int param, float value) { - - alListenerf (param, value); - - } - - void lime_al_listenerfv (int param, value values) { if (!val_is_null (values)) { @@ -1936,13 +1370,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listenerfv (int param, vbyte* values) { - - alListenerfv (param, (ALfloat*)values); - - } - - void lime_al_listeneri (int param, int value1) { alListeneri (param, value1); @@ -1950,13 +1377,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listeneri (int param, int value) { - - alListeneri (param, value); - - } - - void lime_al_listeneriv (int param, value values) { if (!val_is_null (values)) { @@ -1978,13 +1398,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_listeneriv (int param, vbyte* values) { - - alListeneriv (param, (ALint*)values); - - } - - void lime_al_remove_direct_filter (value source) { #ifdef LIME_OPENALSOFT @@ -2013,13 +1426,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_pause (unsigned source) { - - alSourcePause (source); - - } - - void lime_al_source_pausev (int n, value sources) { if (!val_is_null (sources)) { @@ -2041,13 +1447,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_pausev (int n, vbyte* sources) { - - alSourcePausev (n, (ALuint*)sources); - - } - - void lime_al_source_play (value source) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2056,13 +1455,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_play (unsigned source) { - - alSourcePlay (source); - - } - - void lime_al_source_playv (int n, value sources) { if (!val_is_null (sources)) { @@ -2084,13 +1476,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_playv (int n, vbyte* sources) { - - alSourcePlayv (n, (ALuint*)sources); - - } - - void lime_al_source_queue_buffers (value source, int nb, value buffers) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2114,13 +1499,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_queue_buffers (unsigned source, int nb, vbyte* buffers) { - - alSourceQueueBuffers (source, nb, (ALuint*)buffers); - - } - - void lime_al_source_rewind (value source) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2129,13 +1507,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_rewind (unsigned source) { - - alSourceRewind (source); - - } - - void lime_al_source_rewindv (int n, value sources) { if (!val_is_null (sources)) { @@ -2157,13 +1528,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_rewindv (int n, vbyte* sources) { - - alSourceRewindv (n, (ALuint*)sources); - - } - - void lime_al_source_stop (value source) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2172,13 +1536,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_stop (unsigned source) { - - alSourceStop (source); - - } - - void lime_al_source_stopv (int n, value sources) { if (!val_is_null (sources)) { @@ -2200,13 +1557,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_stopv (int n, vbyte* sources) { - - alSourceStopv (n, (ALuint*)sources); - - } - - value lime_al_source_unqueue_buffers (value source, int nb) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2244,13 +1594,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source_unqueue_buffers (unsigned source, int nb, vbyte* buffers) { - - alSourceUnqueueBuffers (source, nb, (ALuint*)buffers); - - } - - void lime_al_source3f (value source, int param, float value1, float value2, float value3) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2259,13 +1602,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source3f (unsigned source, int param, float value1, float value2, float value3) { - - alSource3f (source, param, value1, value2, value3); - - } - - void lime_al_source3i (value source, int param, value value1, int value2, int value3) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2290,13 +1626,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_source3i (unsigned source, int param, int value1, int value2, int value3) { - - alSource3i (source, param, value1, value2, value3); - - } - - void lime_al_sourcef (value source, int param, float value) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2305,13 +1634,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_sourcef (unsigned source, int param, float value) { - - alSourcef (source, param, value); - - } - - void lime_al_sourcefv (value source, int param, value values) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2335,13 +1657,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_sourcefv (unsigned source, int param, vbyte* values) { - - alSourcefv (source, param, (ALfloat*)values); - - } - - void lime_al_sourcei (value source, int param, value val) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2378,14 +1693,6 @@ namespace lime { } - - HL_PRIM void hl_lime_al_sourcei (unsigned source, int param, int value) { - - alSourcei (source, param, value); - - } - - void lime_al_sourceiv (value source, int param, value values) { ALuint id = (ALuint)(uintptr_t)val_data (source); @@ -2409,13 +1716,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_sourceiv (unsigned source, int param, vbyte* values) { - - alSourceiv (source, param, (ALint*)values); - - } - - void lime_al_speed_of_sound (float speed) { alSpeedOfSound (speed); @@ -2423,13 +1723,6 @@ namespace lime { } - HL_PRIM void hl_lime_al_speed_of_sound (float speed) { - - alSpeedOfSound (speed); - - } - - bool lime_alc_close_device (value device) { al_gc_mutex.Lock (); @@ -2442,13 +1735,6 @@ namespace lime { } - HL_PRIM bool hl_lime_alc_close_device (ALCdevice *device) { - - return alcCloseDevice (device) == ALC_TRUE; - - } - - value lime_alc_create_context (value device, value attrlist) { ALCdevice* alcDevice = (ALCdevice*)val_data (device); @@ -2484,13 +1770,6 @@ namespace lime { } - HL_PRIM ALCcontext* hl_lime_alc_create_context (ALCdevice* device, vbyte* attrlist) { - - return alcCreateContext (device, (ALCint*)attrlist); - - } - - void lime_alc_destroy_context (value context) { al_gc_mutex.Lock (); @@ -2502,13 +1781,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_destroy_context (ALCcontext* context) { - - alcDestroyContext (context); - - } - - value lime_alc_get_contexts_device (value context) { ALCcontext* alcContext = (ALCcontext*)val_data (context); @@ -2533,13 +1805,6 @@ namespace lime { } - HL_PRIM ALCdevice* hl_lime_alc_get_contexts_device (ALCcontext* context) { - - return alcGetContextsDevice (context); - - } - - value lime_alc_get_current_context () { ALCcontext* alcContext = alcGetCurrentContext (); @@ -2563,13 +1828,6 @@ namespace lime { } - HL_PRIM ALCcontext* hl_lime_alc_get_current_context () { - - return alcGetCurrentContext (); - - } - - int lime_alc_get_error (value device) { ALCdevice* alcDevice = (ALCdevice*)val_data (device); @@ -2578,13 +1836,6 @@ namespace lime { } - HL_PRIM int hl_lime_alc_get_error (ALCdevice* device) { - - return alcGetError (device); - - } - - value lime_alc_get_integerv (value device, int param, int size) { ALCdevice* alcDevice = (ALCdevice*)val_data (device); @@ -2606,13 +1857,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_get_integerv (ALCdevice* device, int param, int size, vbyte* values) { - - alcGetIntegerv (device, param, size, (ALCint*)values); - - } - - value lime_alc_get_string (value device, int param) { ALCdevice* alcDevice = (ALCdevice*)val_data (device); @@ -2622,13 +1866,6 @@ namespace lime { } - HL_PRIM vbyte* hl_lime_alc_get_string (ALCdevice* device, int param) { - - return (vbyte*)alcGetString (device, param); - - } - - bool lime_alc_make_context_current (value context) { ALCcontext* alcContext = (ALCcontext*)val_data (context); @@ -2637,13 +1874,6 @@ namespace lime { } - HL_PRIM bool hl_lime_alc_make_context_current (ALCcontext *context) { - - return alcMakeContextCurrent (context) == ALC_TRUE; - - } - - value lime_alc_open_device (HxString devicename) { ALCdevice* alcDevice = alcOpenDevice (devicename.__s); @@ -2656,20 +1886,8 @@ namespace lime { } - HL_PRIM ALCdevice* hl_lime_alc_open_device (vbyte* devicename) { - - ALCdevice* alcDevice = alcOpenDevice ((char*)devicename); - atexit (lime_al_atexit); - - // TODO: GC - - return alcDevice; - - } - - void lime_alc_pause_device (value device) { - + #ifdef LIME_OPENALSOFT ALCdevice* alcDevice = (ALCdevice*)val_data (device); alcDevicePauseSOFT (alcDevice); @@ -2678,15 +1896,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_pause_device (ALCdevice* device) { - - #ifdef LIME_OPENALSOFT - alcDevicePauseSOFT (device); - #endif - - } - - void lime_alc_process_context (value context) { ALCcontext* alcContext = (ALCcontext*)val_data (context); @@ -2695,13 +1904,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_process_context (ALCcontext* context) { - - alcProcessContext (context); - - } - - void lime_alc_resume_device (value device) { #ifdef LIME_OPENALSOFT @@ -2712,15 +1914,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_resume_device (ALCdevice* device) { - - #ifdef LIME_OPENALSOFT - alcDeviceResumeSOFT (device); - #endif - - } - - void lime_alc_suspend_context (value context) { ALCcontext* alcContext = (ALCcontext*)val_data (context); @@ -2729,13 +1922,6 @@ namespace lime { } - HL_PRIM void hl_lime_alc_suspend_context (ALCcontext* context) { - - alcSuspendContext (context); - - } - - DEFINE_PRIME3v (lime_al_auxf); @@ -2852,119 +2038,6 @@ namespace lime { DEFINE_PRIME1v (lime_alc_resume_device); DEFINE_PRIME1v (lime_alc_suspend_context); - - #define TDEVICE _ABSTRACT (alc_device) - #define TCONTEXT _ABSTRACT (alc_context) - - DEFINE_HL_PRIM (_VOID, lime_al_auxf, _I32 _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_auxfv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_auxi, _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_auxiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_buffer_data, _I32 _I32 _BYTES _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_buffer3f, _I32 _I32 _F32 _F32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_buffer3i, _I32 _I32 _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_bufferf, _I32 _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_bufferfv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_bufferi, _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_bufferiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_delete_auxiliary_effect_slot, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_delete_buffer, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_delete_buffers, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_delete_filter, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_delete_source, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_delete_sources, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_disable, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_distance_model, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_doppler_factor, _F32); - DEFINE_HL_PRIM (_VOID, lime_al_doppler_velocity, _F32); - DEFINE_HL_PRIM (_VOID, lime_al_effectf, _I32 _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_effectfv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_effecti, _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_effectiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_enable, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_filteri, _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_filterf, _I32 _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_gen_aux, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_gen_buffer, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_gen_buffers, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_gen_effect, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_gen_filter, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_gen_source, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_gen_sources, _I32 _BYTES); - DEFINE_HL_PRIM (_BOOL, lime_al_get_boolean, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_booleanv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_get_buffer3f, _I32 _I32 _REF(_F32) _REF(_F32) _REF(_F32)); - DEFINE_HL_PRIM (_VOID, lime_al_get_buffer3i, _I32 _I32 _REF(_I32) _REF(_I32) _REF(_I32)); - DEFINE_HL_PRIM (_F32, lime_al_get_bufferf, _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_bufferfv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_I32, lime_al_get_bufferi, _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_bufferiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_F64, lime_al_get_double, _I32); - DEFINE_HL_PRIM (_I32, lime_al_get_enum_value, _BYTES); - DEFINE_HL_PRIM (_I32, lime_al_get_error, _NO_ARG); - DEFINE_HL_PRIM (_I32, lime_al_get_filteri, _I32 _I32); - DEFINE_HL_PRIM (_F32, lime_al_get_float, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_floatv, _I32 _BYTES); - DEFINE_HL_PRIM (_I32, lime_al_get_integer, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_integerv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_get_listener3f, _I32 _REF(_F32) _REF(_F32) _REF(_F32)); - DEFINE_HL_PRIM (_VOID, lime_al_get_listener3i, _I32 _REF(_I32) _REF(_I32) _REF(_I32)); - DEFINE_HL_PRIM (_F32, lime_al_get_listenerf, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_listenerfv, _I32 _BYTES); - DEFINE_HL_PRIM (_I32, lime_al_get_listeneri, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_listeneriv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_get_source3f, _I32 _I32 _REF(_F32) _REF(_F32) _REF(_F32)); - DEFINE_HL_PRIM (_VOID, lime_al_get_source3i, _I32 _I32 _REF(_I32) _REF(_I32) _REF(_I32)); - DEFINE_HL_PRIM (_F32, lime_al_get_sourcef, _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_sourcefv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_I32, lime_al_get_sourcei, _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_get_sourceiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_BYTES, lime_al_get_string, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_aux, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_buffer, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_effect, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_enabled, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_extension_present, _BYTES); - DEFINE_HL_PRIM (_BOOL, lime_al_is_filter, _I32); - DEFINE_HL_PRIM (_BOOL, lime_al_is_source, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_listener3f, _I32 _F32 _F32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_listener3i, _I32 _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_listenerf, _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_listenerfv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_listeneri, _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_listeneriv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_pause, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_source_pausev, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_play, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_source_playv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_queue_buffers, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_rewind, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_source_rewindv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_stop, _I32); - DEFINE_HL_PRIM (_VOID, lime_al_source_stopv, _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source_unqueue_buffers, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_source3f, _I32 _I32 _F32 _F32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_source3i, _I32 _I32 _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_sourcef, _I32 _I32 _F32); - DEFINE_HL_PRIM (_VOID, lime_al_sourcefv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_sourcei, _I32 _I32 _I32); - DEFINE_HL_PRIM (_VOID, lime_al_sourceiv, _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_VOID, lime_al_speed_of_sound, _F32); - DEFINE_HL_PRIM (TCONTEXT, lime_alc_create_context, TDEVICE _BYTES); - DEFINE_HL_PRIM (_BOOL, lime_alc_close_device, TDEVICE); - DEFINE_HL_PRIM (_VOID, lime_alc_destroy_context, TCONTEXT); - DEFINE_HL_PRIM (TDEVICE, lime_alc_get_contexts_device, TCONTEXT); - DEFINE_HL_PRIM (TCONTEXT, lime_alc_get_current_context, _NO_ARG); - DEFINE_HL_PRIM (_I32, lime_alc_get_error, TDEVICE); - DEFINE_HL_PRIM (_VOID, lime_alc_get_integerv, TDEVICE _I32 _I32 _BYTES); - DEFINE_HL_PRIM (_BYTES, lime_alc_get_string, TDEVICE _I32); - DEFINE_HL_PRIM (_BOOL, lime_alc_make_context_current, TCONTEXT); - DEFINE_HL_PRIM (TDEVICE, lime_alc_open_device, _BYTES); - DEFINE_HL_PRIM (_VOID, lime_alc_pause_device, TDEVICE); - DEFINE_HL_PRIM (_VOID, lime_alc_process_context, TCONTEXT); - DEFINE_HL_PRIM (_VOID, lime_alc_resume_device, TDEVICE); - DEFINE_HL_PRIM (_VOID, lime_alc_suspend_context, TCONTEXT); - } diff --git a/templates/hl/hxml/debug.hxml b/templates/hl/hxml/debug.hxml deleted file mode 100644 index 6d06cf72b..000000000 --- a/templates/hl/hxml/debug.hxml +++ /dev/null @@ -1,5 +0,0 @@ --main ApplicationMain ::HAXE_FLAGS:: --cp ::OUTPUT_DIR::/haxe --hl ::HL_FILE:: ---macro keep("::APP_MAIN::") --debug \ No newline at end of file diff --git a/templates/hl/hxml/final.hxml b/templates/hl/hxml/final.hxml deleted file mode 100644 index 3255f914e..000000000 --- a/templates/hl/hxml/final.hxml +++ /dev/null @@ -1,5 +0,0 @@ --main ApplicationMain ::HAXE_FLAGS:: --cp ::OUTPUT_DIR::/haxe --hl ::HL_FILE:: ---macro keep("::APP_MAIN::") --D final \ No newline at end of file diff --git a/templates/hl/hxml/release.hxml b/templates/hl/hxml/release.hxml deleted file mode 100644 index c6d6863c8..000000000 --- a/templates/hl/hxml/release.hxml +++ /dev/null @@ -1,4 +0,0 @@ --main ApplicationMain ::HAXE_FLAGS:: --cp ::OUTPUT_DIR::/haxe --hl ::HL_FILE:: ---macro keep("::APP_MAIN::") \ No newline at end of file diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index e4543f5bb..bc4fc8ec6 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -279,16 +279,6 @@ class CommandLineTools { target = PlatformHelper.hostPlatform; targetFlags.set ("neko", ""); - case "hl": - - target = PlatformHelper.hostPlatform; - targetFlags.set ("hl", ""); - - case "java": - - target = PlatformHelper.hostPlatform; - targetFlags.set ("java", ""); - case "nodejs": target = PlatformHelper.hostPlatform; @@ -1044,7 +1034,6 @@ class CommandLineTools { LogHelper.println (" \x1b[1mnodejs\x1b[0m -- Alias for host platform (using \x1b[1m-nodejs\x1b[0m)"); LogHelper.println (" \x1b[1mjava\x1b[0m -- Alias for host platform (using \x1b[1m-java\x1b[0m)"); LogHelper.println (" \x1b[1mcs\x1b[0m -- Alias for host platform (using \x1b[1m-cs\x1b[0m)"); - LogHelper.println (" \x1b[1mhl\x1b[0m -- Alias for host platform (using \x1b[1m-hl\x1b[0m)"); LogHelper.println (" \x1b[1muwp\x1b[0;3m/\x1b[0m\x1b[1mwinjs\x1b[0m -- Alias for \x1b[1mwindows -uwp\x1b[0m"); // LogHelper.println (" \x1b[1miphone\x1b[0;3m/\x1b[0m\x1b[1miphoneos\x1b[0m -- \x1b[1mios\x1b[0m"); // LogHelper.println (" \x1b[1miphonesim\x1b[0m -- Alias for \x1b[1mios -simulator\x1b[0m"); @@ -1162,7 +1151,6 @@ class CommandLineTools { LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-java\x1b[0m -- Build for Java instead of C++"); LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-nodejs\x1b[0m -- Build for Node.js instead of C++"); LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-cs\x1b[0m -- Build for C# instead of C++"); - LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-hl\x1b[0m -- Build for HashLink instead of C++"); LogHelper.println (" \x1b[3m(windows)\x1b[0m \x1b[1m-winjs\x1b[0m -- Build for WinJS instead of C++ (implies UWP)"); LogHelper.println (" \x1b[3m(windows)\x1b[0m \x1b[1m-uwp\x1b[0m -- Build for Universal Windows Platform"); @@ -1675,11 +1663,6 @@ class CommandLineTools { target = PlatformHelper.hostPlatform; targetFlags.set ("neko", ""); - case "hl": - - target = PlatformHelper.hostPlatform; - targetFlags.set ("hl", ""); - case "java": target = PlatformHelper.hostPlatform; diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index c8cb207da..3a97e2345 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -523,7 +523,7 @@ class PlatformSetup { } - case "neko", "hl", "cs", "uwp", "winjs", "nodejs", "java": + case "neko", "cs", "uwp", "winjs", "nodejs", "java": LogHelper.println ("\x1b[0;3mNo additional configuration is required.\x1b[0m");