feat: add std streams as global variables
This commit is contained in:
parent
e6399c1546
commit
7b9bbe576b
@ -10,10 +10,13 @@ import me.topchetoeu.jscript.core.scope.GlobalScope;
|
|||||||
import me.topchetoeu.jscript.core.values.FunctionValue;
|
import me.topchetoeu.jscript.core.values.FunctionValue;
|
||||||
import me.topchetoeu.jscript.core.values.Values;
|
import me.topchetoeu.jscript.core.values.Values;
|
||||||
import me.topchetoeu.jscript.core.exceptions.EngineException;
|
import me.topchetoeu.jscript.core.exceptions.EngineException;
|
||||||
|
import me.topchetoeu.jscript.utils.filesystem.Filesystem;
|
||||||
|
import me.topchetoeu.jscript.utils.filesystem.Mode;
|
||||||
import me.topchetoeu.jscript.utils.interop.Arguments;
|
import me.topchetoeu.jscript.utils.interop.Arguments;
|
||||||
import me.topchetoeu.jscript.utils.interop.Expose;
|
import me.topchetoeu.jscript.utils.interop.Expose;
|
||||||
import me.topchetoeu.jscript.utils.interop.ExposeField;
|
import me.topchetoeu.jscript.utils.interop.ExposeField;
|
||||||
import me.topchetoeu.jscript.utils.interop.ExposeTarget;
|
import me.topchetoeu.jscript.utils.interop.ExposeTarget;
|
||||||
|
import me.topchetoeu.jscript.utils.interop.ExposeType;
|
||||||
import me.topchetoeu.jscript.utils.modules.ModuleRepo;
|
import me.topchetoeu.jscript.utils.modules.ModuleRepo;
|
||||||
|
|
||||||
public class Internals {
|
public class Internals {
|
||||||
@ -126,6 +129,19 @@ public class Internals {
|
|||||||
return NumberLib.__isInfinite(args);
|
return NumberLib.__isInfinite(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Expose(target = ExposeTarget.STATIC, type = ExposeType.GETTER)
|
||||||
|
public static FileLib __stdin(Arguments args) {
|
||||||
|
return new FileLib(Filesystem.get(args.ctx).open("std://in", Mode.READ));
|
||||||
|
}
|
||||||
|
@Expose(target = ExposeTarget.STATIC, type = ExposeType.GETTER)
|
||||||
|
public static FileLib __stdout(Arguments args) {
|
||||||
|
return new FileLib(Filesystem.get(args.ctx).open("std://out", Mode.READ));
|
||||||
|
}
|
||||||
|
@Expose(target = ExposeTarget.STATIC, type = ExposeType.GETTER)
|
||||||
|
public static FileLib __stderr(Arguments args) {
|
||||||
|
return new FileLib(Filesystem.get(args.ctx).open("std://err", Mode.READ));
|
||||||
|
}
|
||||||
|
|
||||||
@ExposeField(target = ExposeTarget.STATIC)
|
@ExposeField(target = ExposeTarget.STATIC)
|
||||||
public static double __NaN = Double.NaN;
|
public static double __NaN = Double.NaN;
|
||||||
@ExposeField(target = ExposeTarget.STATIC)
|
@ExposeField(target = ExposeTarget.STATIC)
|
||||||
|
Loading…
Reference in New Issue
Block a user