Added threading support and fixed bugs
Internal functions fixed! now empty args on internal functions will not bug out! Added some new methods
This commit is contained in:
parent
2c849eb01b
commit
70fa89de8c
@ -79,11 +79,8 @@ namespace parseManagerCS
|
|||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
parseManager test = new parseManager(args[0], "define"); // define is where your methods will be held
|
parseManager PM = new parseManager(args[0], "define");
|
||||||
|
nextType next = PM.Next();
|
||||||
//parseManager test = new parseManager("parsetest2.txt","define");
|
|
||||||
|
|
||||||
nextType next = test.Next(); // TODO implement the next method
|
|
||||||
string type;
|
string type;
|
||||||
while (next.GetCMDType() != "EOF") {
|
while (next.GetCMDType() != "EOF") {
|
||||||
type = next.GetCMDType();
|
type = next.GetCMDType();
|
||||||
@ -91,7 +88,7 @@ namespace parseManagerCS
|
|||||||
Console.Write(next.GetText());
|
Console.Write(next.GetText());
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
next = test.Next();
|
next = PM.Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
[TESTER]{
|
|
||||||
"Hello World"
|
|
||||||
}
|
|
||||||
61
parseManager/bin/Debug/test.txt
Normal file
61
parseManager/bin/Debug/test.txt
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
ENTRY TESTSTART
|
||||||
|
[TESTSTART]{
|
||||||
|
SetFG(Color_Blue)
|
||||||
|
write("This is blue ")
|
||||||
|
SetFG(Color_Red)
|
||||||
|
print("This is red")
|
||||||
|
ResetColor()
|
||||||
|
"Hello (Press Enter)"
|
||||||
|
print("PLAY SONG (1)")
|
||||||
|
print("MESSAGE (2)")
|
||||||
|
print("An Adventure (3)")
|
||||||
|
print("QUIT (4)")
|
||||||
|
::choice::
|
||||||
|
write("Choose: ")
|
||||||
|
choice=GetInput()
|
||||||
|
if choice=="1" then JUMP("SONG")|SKIP(0)
|
||||||
|
if choice=="2" then JUMP("YO")|SKIP(0)
|
||||||
|
if choice=="4" then QUIT()|SKIP(0)
|
||||||
|
if choice=="3" then SKIP(2)|SKIP(0)
|
||||||
|
GOTO("choice")
|
||||||
|
"We are here now! Time for some fun..."
|
||||||
|
write("Please enter your name: ")
|
||||||
|
name=GetInput()
|
||||||
|
setCC()
|
||||||
|
if name=="" then SKIP(-4)|SKIP(0)
|
||||||
|
ClearLine()
|
||||||
|
print("So your name is $name$ huh...")
|
||||||
|
"I won't judge haha"
|
||||||
|
"Anyway let's get controls for that song"
|
||||||
|
print("Stop (s)")
|
||||||
|
print("Play (t)")
|
||||||
|
print("Pause (a)")
|
||||||
|
print("Resume (r)")
|
||||||
|
print("Quit (q)")
|
||||||
|
::control::
|
||||||
|
write("Choose: ")
|
||||||
|
choice=GetInput()
|
||||||
|
if choice=="s" then STOP(song)|SKIP(0)
|
||||||
|
if choice=="t" then JUMP("PLAYS")|SKIP(0)
|
||||||
|
if choice=="a" then PAUSE(song)|SKIP(0)
|
||||||
|
if choice=="r" then RESUME(song)|SKIP(0)
|
||||||
|
if choice=="q" then QUIT()|SKIP(0)
|
||||||
|
GOTO("control")
|
||||||
|
}
|
||||||
|
[ClearLine:function()]{
|
||||||
|
whiteOut()
|
||||||
|
setCC()
|
||||||
|
}
|
||||||
|
[PLAYS]{
|
||||||
|
PAUSE(song)
|
||||||
|
song=PLAY("test.flac")
|
||||||
|
GOTO("control")
|
||||||
|
}
|
||||||
|
[SONG]{
|
||||||
|
song=PLAY("test.flac")
|
||||||
|
GOTO("choice")
|
||||||
|
}
|
||||||
|
[YO]{
|
||||||
|
"How are you doing?"
|
||||||
|
GOTO("choice")
|
||||||
|
}
|
||||||
@ -1,5 +1,10 @@
|
|||||||
ENTRY TESTSTART
|
ENTRY TESTSTART
|
||||||
[TESTSTART]{
|
[TESTSTART]{
|
||||||
|
SetFG(Color_Blue)
|
||||||
|
write("This is blue ")
|
||||||
|
SetFG(Color_Red)
|
||||||
|
print("This is red")
|
||||||
|
ResetColor()
|
||||||
"Hello (Press Enter)"
|
"Hello (Press Enter)"
|
||||||
print("PLAY SONG (1)")
|
print("PLAY SONG (1)")
|
||||||
print("MESSAGE (2)")
|
print("MESSAGE (2)")
|
||||||
@ -11,12 +16,15 @@ ENTRY TESTSTART
|
|||||||
if choice=="1" then JUMP("SONG")|SKIP(0)
|
if choice=="1" then JUMP("SONG")|SKIP(0)
|
||||||
if choice=="2" then JUMP("YO")|SKIP(0)
|
if choice=="2" then JUMP("YO")|SKIP(0)
|
||||||
if choice=="4" then QUIT()|SKIP(0)
|
if choice=="4" then QUIT()|SKIP(0)
|
||||||
if choice=="3" then SKIP(2)|SKIP(0)
|
if choice=="3" then SKIP(3)|SKIP(0)
|
||||||
|
setCC()
|
||||||
GOTO("choice")
|
GOTO("choice")
|
||||||
"We are here now! Time for some fun..."
|
"We are here now! Time for some fun..."
|
||||||
write("Please enter your name: ")
|
write("Please enter your name: ")
|
||||||
name=GetInput()
|
name=GetInput()
|
||||||
if name=="" then SKIP(-3)|SKIP(0)
|
setCC()
|
||||||
|
if name=="" then SKIP(-4)|SKIP(0)
|
||||||
|
ClearLine()
|
||||||
print("So your name is $name$ huh...")
|
print("So your name is $name$ huh...")
|
||||||
"I won't judge haha"
|
"I won't judge haha"
|
||||||
"Anyway let's get controls for that song"
|
"Anyway let's get controls for that song"
|
||||||
@ -35,6 +43,10 @@ ENTRY TESTSTART
|
|||||||
if choice=="q" then QUIT()|SKIP(0)
|
if choice=="q" then QUIT()|SKIP(0)
|
||||||
GOTO("control")
|
GOTO("control")
|
||||||
}
|
}
|
||||||
|
[ClearLine:function()]{
|
||||||
|
whiteOut()
|
||||||
|
setCC()
|
||||||
|
}
|
||||||
[PLAYS]{
|
[PLAYS]{
|
||||||
PAUSE(song)
|
PAUSE(song)
|
||||||
song=PLAY("test.flac")
|
song=PLAY("test.flac")
|
||||||
|
|||||||
@ -1,4 +1,20 @@
|
|||||||
[START]{
|
[THREAD]{
|
||||||
print("Testing")
|
::loop::
|
||||||
"Done!"
|
n=random(1,4)
|
||||||
|
if n==1 then SetFG(Color_Blue)|SKIP(0)
|
||||||
|
if n==2 then SetFG(Color_Red)|SKIP(0)
|
||||||
|
if n==3 then SetFG(Color_Green)|SKIP(0)
|
||||||
|
if n==4 then SetFG(Color_Yellow)|SKIP(0)
|
||||||
|
sleep(.1)
|
||||||
|
GOTO("loop")
|
||||||
|
}
|
||||||
|
[START]{
|
||||||
|
print("Testing threading!")
|
||||||
|
n==0
|
||||||
|
newThread("THREAD")
|
||||||
|
c=0
|
||||||
|
::loop::
|
||||||
|
c=c+1
|
||||||
|
"c = $c$ n = $n$"
|
||||||
|
GOTO("loop")
|
||||||
}
|
}
|
||||||
@ -20,8 +20,9 @@ namespace parseManagerCS
|
|||||||
standardDefine _invoke = new standardDefine();
|
standardDefine _invoke = new standardDefine();
|
||||||
string _filepath;
|
string _filepath;
|
||||||
bool _active = true;
|
bool _active = true;
|
||||||
string _define;
|
string _define = "NO_DEFINE";
|
||||||
string _entry = "START";
|
string _entry = "START";
|
||||||
|
bool _isInternal;
|
||||||
Type _defineType;
|
Type _defineType;
|
||||||
standardDefine def = new standardDefine();
|
standardDefine def = new standardDefine();
|
||||||
MethodInfo _defineMethod;
|
MethodInfo _defineMethod;
|
||||||
@ -34,6 +35,25 @@ namespace parseManagerCS
|
|||||||
Dictionary<string, bool> _flags = new Dictionary<string, bool>();
|
Dictionary<string, bool> _flags = new Dictionary<string, bool>();
|
||||||
Dictionary<string, chunk> _chunks = new Dictionary<string, chunk>();
|
Dictionary<string, chunk> _chunks = new Dictionary<string, chunk>();
|
||||||
Dictionary<string, string> _methods = new Dictionary<string, string>();
|
Dictionary<string, string> _methods = new Dictionary<string, string>();
|
||||||
|
void INITENV()
|
||||||
|
{
|
||||||
|
_mainENV["Color_Black"] = ConsoleColor.Black;
|
||||||
|
_mainENV["Color_Blue"] = ConsoleColor.Blue;
|
||||||
|
_mainENV["Color_Cyan"] = ConsoleColor.Cyan;
|
||||||
|
_mainENV["Color_DarkBlue"] = ConsoleColor.DarkBlue;
|
||||||
|
_mainENV["Color_DarkCyan"] = ConsoleColor.DarkCyan;
|
||||||
|
_mainENV["Color_DarkGray"] = ConsoleColor.DarkGray;
|
||||||
|
_mainENV["Color_DarkGreen"] = ConsoleColor.DarkGreen;
|
||||||
|
_mainENV["Color_DarkMagenta"] = ConsoleColor.DarkMagenta;
|
||||||
|
_mainENV["Color_DarkRed"] = ConsoleColor.DarkRed;
|
||||||
|
_mainENV["Color_DarkYellow"] = ConsoleColor.DarkYellow;
|
||||||
|
_mainENV["Color_Gray"] = ConsoleColor.Gray;
|
||||||
|
_mainENV["Color_Green"] = ConsoleColor.Green;
|
||||||
|
_mainENV["Color_Magenta"] = ConsoleColor.Magenta;
|
||||||
|
_mainENV["Color_Red"] = ConsoleColor.Red;
|
||||||
|
_mainENV["Color_White"] = ConsoleColor.White;
|
||||||
|
_mainENV["Color_Yellow"] = ConsoleColor.Yellow;
|
||||||
|
}
|
||||||
public void _SetDENV(ENV env)
|
public void _SetDENV(ENV env)
|
||||||
{
|
{
|
||||||
_mainENV = env;
|
_mainENV = env;
|
||||||
@ -46,6 +66,7 @@ namespace parseManagerCS
|
|||||||
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
||||||
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
||||||
_defualtENV = _mainENV;
|
_defualtENV = _mainENV;
|
||||||
|
INITENV();
|
||||||
Parse();
|
Parse();
|
||||||
}
|
}
|
||||||
public parseManager(string filepath, string define)
|
public parseManager(string filepath, string define)
|
||||||
@ -57,8 +78,46 @@ namespace parseManagerCS
|
|||||||
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
||||||
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
||||||
_defualtENV = _mainENV;
|
_defualtENV = _mainENV;
|
||||||
|
INITENV();
|
||||||
Parse();
|
Parse();
|
||||||
}
|
}
|
||||||
|
public parseManager(string code, string define, bool c)
|
||||||
|
{
|
||||||
|
InitFlags();
|
||||||
|
_define = define;
|
||||||
|
_filepath = code;
|
||||||
|
_isInternal = true;
|
||||||
|
_defineType = Type.GetType(define);
|
||||||
|
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
||||||
|
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
||||||
|
_defualtENV = _mainENV;
|
||||||
|
INITENV();
|
||||||
|
Parse(code, c);
|
||||||
|
}
|
||||||
|
public parseManager(string code, bool c)
|
||||||
|
{
|
||||||
|
_isInternal = true;
|
||||||
|
InitFlags();
|
||||||
|
_filepath = code;
|
||||||
|
_defineType = Type.GetType("standardDefine");
|
||||||
|
ConstructorInfo defineConstructor = _defineType.GetConstructor(Type.EmptyTypes);
|
||||||
|
_defineClassObject = defineConstructor.Invoke(new object[]{ });
|
||||||
|
_defualtENV = _mainENV;
|
||||||
|
INITENV();
|
||||||
|
Parse(code, c);
|
||||||
|
}
|
||||||
|
public bool IsInternal()
|
||||||
|
{
|
||||||
|
return _isInternal;
|
||||||
|
}
|
||||||
|
public string GetFilepath()
|
||||||
|
{
|
||||||
|
return _filepath;
|
||||||
|
}
|
||||||
|
public string GetDefine()
|
||||||
|
{
|
||||||
|
return _define;
|
||||||
|
}
|
||||||
void InitFlags()
|
void InitFlags()
|
||||||
{
|
{
|
||||||
_flags.Add("leaking", false);
|
_flags.Add("leaking", false);
|
||||||
@ -125,6 +184,10 @@ namespace parseManagerCS
|
|||||||
Console.WriteLine("File '" + _filepath + "' does not exist! Loading failled!");
|
Console.WriteLine("File '" + _filepath + "' does not exist! Loading failled!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void Parse(string code, bool c)
|
||||||
|
{
|
||||||
|
_Parse(code);
|
||||||
|
}
|
||||||
void Parse(string filename)
|
void Parse(string filename)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -175,9 +238,11 @@ namespace parseManagerCS
|
|||||||
var argsN = c.GetArgs();
|
var argsN = c.GetArgs();
|
||||||
var fEnv = new ENV();
|
var fEnv = new ENV();
|
||||||
fEnv.SetParent(_defualtENV);
|
fEnv.SetParent(_defualtENV);
|
||||||
|
if (!(argsN.Length == 1 && argsN[0] == "")) {
|
||||||
for (int i = 0; i < argsN.Length; i++) {
|
for (int i = 0; i < argsN.Length; i++) {
|
||||||
fEnv[argsN[i]] = argsV[i];
|
fEnv[argsN[i]] = argsV[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var tempEnv = new ENV();
|
var tempEnv = new ENV();
|
||||||
tempEnv[0] = ccN;
|
tempEnv[0] = ccN;
|
||||||
tempEnv[1] = ccP;
|
tempEnv[1] = ccP;
|
||||||
@ -187,7 +252,7 @@ namespace parseManagerCS
|
|||||||
PushError("Stack Overflow!");
|
PushError("Stack Overflow!");
|
||||||
}
|
}
|
||||||
_defualtENV = fEnv;
|
_defualtENV = fEnv;
|
||||||
def.JUMP(this,method);
|
def.JUMP(this, method);
|
||||||
return fEnv; // TODO Handle returns
|
return fEnv; // TODO Handle returns
|
||||||
}
|
}
|
||||||
public object InvokeR(string method, object[] args)
|
public object InvokeR(string method, object[] args)
|
||||||
@ -199,8 +264,8 @@ namespace parseManagerCS
|
|||||||
try {
|
try {
|
||||||
_defineMethod = _defineType.GetMethod(method);
|
_defineMethod = _defineType.GetMethod(method);
|
||||||
return _defineMethod.Invoke(_defineClassObject, tackBArgs(this, args));
|
return _defineMethod.Invoke(_defineClassObject, tackBArgs(this, args));
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
PushError("Invalid method: " + method);
|
PushError("Invalid method: " + method + "\n\n" + e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,18 +280,19 @@ namespace parseManagerCS
|
|||||||
_defineMethod = _defineType.GetMethod(method);
|
_defineMethod = _defineType.GetMethod(method);
|
||||||
_defineMethod.Invoke(_defineClassObject, tackBArgs(this, args));
|
_defineMethod.Invoke(_defineClassObject, tackBArgs(this, args));
|
||||||
return 0;
|
return 0;
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
PushError("Invalid method: " + method);
|
PushError("Invalid method: " + method + "\n\n" + e);
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
public object[] tackBArgs(object o,object[] args){
|
|
||||||
var len = args.Length;
|
|
||||||
var newargs=new object[len+1];
|
|
||||||
for(int i = 0;i<len;i++){
|
|
||||||
newargs[i+1]=args[i];
|
|
||||||
}
|
}
|
||||||
newargs[0]=o;
|
public object[] tackBArgs(object o, object[] args)
|
||||||
|
{
|
||||||
|
var len = args.Length;
|
||||||
|
var newargs = new object[len + 1];
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
newargs[i + 1] = args[i];
|
||||||
|
}
|
||||||
|
newargs[0] = o;
|
||||||
return newargs;
|
return newargs;
|
||||||
}
|
}
|
||||||
public void SetBlock(string BLOCK)
|
public void SetBlock(string BLOCK)
|
||||||
@ -1140,6 +1206,39 @@ namespace parseManagerCS
|
|||||||
}
|
}
|
||||||
public class standardDefine
|
public class standardDefine
|
||||||
{
|
{
|
||||||
|
Random rnd = new Random();
|
||||||
|
public void newThread(parseManager PM, string Block)
|
||||||
|
{
|
||||||
|
var thread = new Thread(() => _THREAD(Block, PM));
|
||||||
|
thread.Start();
|
||||||
|
}
|
||||||
|
public void _THREAD(string block, parseManager _PM)
|
||||||
|
{
|
||||||
|
var define = _PM.GetDefine();
|
||||||
|
var path = _PM.GetFilepath();
|
||||||
|
parseManager PM;
|
||||||
|
if (_PM.IsInternal()) {
|
||||||
|
if (define == "NO_DEFINE") {
|
||||||
|
PM = new parseManager(path, true);
|
||||||
|
} else {
|
||||||
|
PM = new parseManager(path, define, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (define == "NO_DEFINE") {
|
||||||
|
PM = new parseManager(path);
|
||||||
|
} else {
|
||||||
|
PM = new parseManager(path, define);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PM._SetDENV(_PM.GetDENV());
|
||||||
|
PM.SetENV(_PM.GetENV());
|
||||||
|
nextType next = PM.Next(block);
|
||||||
|
string type;
|
||||||
|
while (next.GetCMDType() != "EOF") {
|
||||||
|
type = next.GetCMDType();
|
||||||
|
next = PM.Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
public void SAVE(parseManager PM)
|
public void SAVE(parseManager PM)
|
||||||
{
|
{
|
||||||
var env = PM.GetDENV();
|
var env = PM.GetDENV();
|
||||||
@ -1149,6 +1248,10 @@ public class standardDefine
|
|||||||
env["__DefualtENV"] = PM.GetENV();
|
env["__DefualtENV"] = PM.GetENV();
|
||||||
GLOBALS.WriteToBinaryFile("savedata.dat", env);
|
GLOBALS.WriteToBinaryFile("savedata.dat", env);
|
||||||
}
|
}
|
||||||
|
public void save(parseManager PM)
|
||||||
|
{
|
||||||
|
SAVE(PM);
|
||||||
|
}
|
||||||
public bool LOAD(parseManager PM)
|
public bool LOAD(parseManager PM)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -1165,18 +1268,26 @@ public class standardDefine
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void load(parseManager PM)
|
||||||
|
{
|
||||||
|
LOAD(PM);
|
||||||
|
}
|
||||||
public void TRACEBACK(parseManager PM)
|
public void TRACEBACK(parseManager PM)
|
||||||
{
|
{
|
||||||
ENV env = PM.Pop();
|
ENV env = PM.Pop();
|
||||||
PM.SetBlock((string)env[0]);
|
PM.SetBlock((string)env[0]);
|
||||||
var c = PM.GetCurrentChunk();
|
var c = PM.GetCurrentChunk();
|
||||||
c.SetPos((int)env[1]);
|
c.SetPos((int)env[1]);
|
||||||
SetENV(PM,(ENV)env[3]);
|
SetENV(PM, (ENV)env[3]);
|
||||||
}
|
}
|
||||||
public void EXIT(parseManager PM)
|
public void EXIT(parseManager PM)
|
||||||
{
|
{
|
||||||
PM.Deactivate();
|
PM.Deactivate();
|
||||||
}
|
}
|
||||||
|
public void exit(parseManager PM)
|
||||||
|
{
|
||||||
|
EXIT(PM);
|
||||||
|
}
|
||||||
public void QUIT(parseManager PM)
|
public void QUIT(parseManager PM)
|
||||||
{
|
{
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
@ -1203,6 +1314,28 @@ public class standardDefine
|
|||||||
{
|
{
|
||||||
return Console.ReadLine();
|
return Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
public void setCC(parseManager PM)
|
||||||
|
{
|
||||||
|
Console.SetCursorPosition(0, Console.CursorTop - 1);
|
||||||
|
}
|
||||||
|
public void whiteOut(parseManager PM)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Console.BufferWidth; i++) {
|
||||||
|
Console.Write(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetBG(parseManager PM, ConsoleColor BG)
|
||||||
|
{
|
||||||
|
Console.BackgroundColor = BG;
|
||||||
|
}
|
||||||
|
public void SetFG(parseManager PM, ConsoleColor FG)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = FG;
|
||||||
|
}
|
||||||
|
public void ResetColor(parseManager PM)
|
||||||
|
{
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
public int GOTO(parseManager PM, string label)
|
public int GOTO(parseManager PM, string label)
|
||||||
{
|
{
|
||||||
var c = PM.GetCurrentChunk();
|
var c = PM.GetCurrentChunk();
|
||||||
@ -1234,18 +1367,30 @@ public class standardDefine
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
public double len(parseManager PM, object o)
|
||||||
|
{
|
||||||
|
return LEN(PM, o);
|
||||||
|
}
|
||||||
public void JUMP(parseManager PM, string block)
|
public void JUMP(parseManager PM, string block)
|
||||||
{
|
{
|
||||||
var c = PM.GetCurrentChunk();
|
var c = PM.GetCurrentChunk();
|
||||||
c.ResetPos();
|
c.ResetPos();
|
||||||
PM.SetBlock(block);
|
PM.SetBlock(block);
|
||||||
}
|
}
|
||||||
|
public void jump(parseManager PM, string block)
|
||||||
|
{
|
||||||
|
JUMP(PM, block);
|
||||||
|
}
|
||||||
public void SKIP(parseManager PM, double n)
|
public void SKIP(parseManager PM, double n)
|
||||||
{
|
{
|
||||||
var c = PM.GetCurrentChunk();
|
var c = PM.GetCurrentChunk();
|
||||||
var pos = c.GetPos();
|
var pos = c.GetPos();
|
||||||
c.SetPos(pos + (int)n);
|
c.SetPos(pos + (int)n);
|
||||||
}
|
}
|
||||||
|
public void skip(parseManager PM, double n)
|
||||||
|
{
|
||||||
|
SKIP(PM, n);
|
||||||
|
}
|
||||||
public double tonumber(parseManager PM, string strn)
|
public double tonumber(parseManager PM, string strn)
|
||||||
{
|
{
|
||||||
double d;
|
double d;
|
||||||
@ -1255,9 +1400,9 @@ public class standardDefine
|
|||||||
PM.debug("Cannot convert to a number!");
|
PM.debug("Cannot convert to a number!");
|
||||||
return double.NaN;
|
return double.NaN;
|
||||||
}
|
}
|
||||||
public void SLEEP(parseManager PM, double n)
|
public void sleep(parseManager PM, double n)
|
||||||
{
|
{
|
||||||
int i = int.Parse(n.ToString()) * 1000;
|
int i = (int)n * 1000;
|
||||||
Thread.Sleep(i);
|
Thread.Sleep(i);
|
||||||
}
|
}
|
||||||
public double ADD(parseManager PM, double a, double b)
|
public double ADD(parseManager PM, double a, double b)
|
||||||
@ -1284,10 +1429,26 @@ public class standardDefine
|
|||||||
{
|
{
|
||||||
return evaluater.Evaluate(ex);
|
return evaluater.Evaluate(ex);
|
||||||
}
|
}
|
||||||
|
public void pause(parseManager PM)
|
||||||
|
{
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
public void print(parseManager PM, object o)
|
public void print(parseManager PM, object o)
|
||||||
{
|
{
|
||||||
Console.WriteLine(o);
|
Console.WriteLine(o);
|
||||||
}
|
}
|
||||||
|
public double random(parseManager PM, double s, double e)
|
||||||
|
{
|
||||||
|
return (double)rnd.Next((int)s, (int)e);
|
||||||
|
}
|
||||||
|
public double rand(parseManager PM)
|
||||||
|
{
|
||||||
|
return rnd.NextDouble();
|
||||||
|
}
|
||||||
|
public double round(parseManager PM, double num, double n)
|
||||||
|
{
|
||||||
|
return Math.Round(num, (int)n);
|
||||||
|
}
|
||||||
public void write(parseManager PM, object o)
|
public void write(parseManager PM, object o)
|
||||||
{
|
{
|
||||||
Console.Write(o);
|
Console.Write(o);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user