getTarget
This commit is contained in:
@@ -78,6 +78,7 @@ class Kiss {
|
|||||||
"assertProcess" => Symbol("Prelude.assertProcess"),
|
"assertProcess" => Symbol("Prelude.assertProcess"),
|
||||||
"random" => Symbol("Std.random"),
|
"random" => Symbol("Std.random"),
|
||||||
"walkDirectory" => Symbol("Prelude.walkDirectory"),
|
"walkDirectory" => Symbol("Prelude.walkDirectory"),
|
||||||
|
"getTarget" => Symbol("Prelude.getTarget"),
|
||||||
// These work with (apply) because they are added as "opAliases" in Macros.kiss:
|
// These work with (apply) because they are added as "opAliases" in Macros.kiss:
|
||||||
"min" => Symbol("Prelude.min"),
|
"min" => Symbol("Prelude.min"),
|
||||||
"max" => Symbol("Prelude.max"),
|
"max" => Symbol("Prelude.max"),
|
||||||
|
@@ -31,6 +31,15 @@ enum ExtraElementHandling {
|
|||||||
Throw; // Throw an error
|
Throw; // Throw an error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum KissTarget {
|
||||||
|
Cpp;
|
||||||
|
CSharp;
|
||||||
|
Haxe;
|
||||||
|
JavaScript;
|
||||||
|
NodeJS;
|
||||||
|
Python;
|
||||||
|
}
|
||||||
|
|
||||||
class Prelude {
|
class Prelude {
|
||||||
static function stringOrFloat(d:Dynamic):Either<String, Float> {
|
static function stringOrFloat(d:Dynamic):Either<String, Float> {
|
||||||
return switch (Type.typeof(d)) {
|
return switch (Type.typeof(d)) {
|
||||||
@@ -446,9 +455,27 @@ class Prelude {
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getTarget():KissTarget {
|
||||||
|
return #if cpp
|
||||||
|
Cpp;
|
||||||
|
#elseif cs
|
||||||
|
CSharp;
|
||||||
|
#elseif interp
|
||||||
|
Haxe;
|
||||||
|
#elseif hxnodejs
|
||||||
|
NodeJS;
|
||||||
|
#elseif js
|
||||||
|
JavaScript;
|
||||||
|
#elseif python
|
||||||
|
Python;
|
||||||
|
#else
|
||||||
|
throw "Unsupported target language for Kiss";
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
public static function assertProcess(command:String, args:Array<String>, ?inputLines:Array<String>, fullProcess = true):String {
|
public static function assertProcess(command:String, args:Array<String>, ?inputLines:Array<String>, fullProcess = true):String {
|
||||||
#if test
|
#if test
|
||||||
Prelude.print('running $command $args $inputLines');
|
Prelude.print('running $command $args $inputLines from ${Prelude.getTarget()}');
|
||||||
#end
|
#end
|
||||||
if (inputLines != null) {
|
if (inputLines != null) {
|
||||||
for (line in inputLines) {
|
for (line in inputLines) {
|
||||||
|
Reference in New Issue
Block a user