add array declarations
This commit is contained in:
parent
a44385d35a
commit
e86f463de6
|
|
@ -2,8 +2,10 @@
|
|||
using Qrakhen.Qamp.Core;
|
||||
using Qrakhen.Qamp.Core.Execution;
|
||||
using Qrakhen.Qamp.Core.Logging;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
/*
|
||||
// do args here too, keep console, etc. output with exit, all the spicy things
|
||||
// if no file is given for example in args just keep cli live until quit
|
||||
|
||||
|
|
@ -33,6 +35,115 @@ void Init(string[] args)
|
|||
|
||||
Init(args);
|
||||
|
||||
void git(string path, string cmd)
|
||||
{
|
||||
Console.WriteLine($" > git {cmd}");
|
||||
ProcessStartInfo info = new ProcessStartInfo{
|
||||
WorkingDirectory = path,
|
||||
FileName = "git",
|
||||
Arguments = cmd
|
||||
};
|
||||
Process.Start(info)?.WaitForExit();
|
||||
}
|
||||
|
||||
void del(string path, string cmd)
|
||||
{
|
||||
Console.WriteLine($" > git {cmd}");
|
||||
ProcessStartInfo info = new ProcessStartInfo{
|
||||
WorkingDirectory = path,
|
||||
FileName = "del",
|
||||
Arguments = $"{cmd} /F /Q /S"
|
||||
};
|
||||
Process.Start(info)?.WaitForExit();
|
||||
}
|
||||
|
||||
string x = @"C:\Users\filos\projects";
|
||||
string[] check = ["node_modules", "bin", "obj", "Library"];
|
||||
int scanx(string path)
|
||||
{
|
||||
foreach (var dir in Directory.EnumerateDirectories(path)) {
|
||||
try {
|
||||
var name = dir.Replace(path, "").Replace(@"\", "");
|
||||
if (!check.Contains(name)) {
|
||||
scanx(dir);
|
||||
} else {
|
||||
Console.WriteLine(dir + " (" + (Directory.GetFiles(dir).Length + Directory.GetDirectories(dir).Length) + " files)");
|
||||
if ((Directory.GetFiles(dir).Length + Directory.GetDirectories(dir).Length) == 0) {
|
||||
Console.WriteLine(" skipped (0 files)");
|
||||
continue;
|
||||
}
|
||||
if (name == "Library") {
|
||||
if (!Directory.Exists(path + "\\Assets")) {
|
||||
Console.WriteLine(" skipped (not a definite unity library folder)");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Console.Write(name == "Library" ? " y/n?" : "");
|
||||
do {
|
||||
char c = name == "Library" ? Console.ReadKey(true).KeyChar : 'y';
|
||||
if (c == 'y') {
|
||||
Directory.Delete(dir, true);
|
||||
break;
|
||||
} else if (c == 'n') {
|
||||
break;
|
||||
} else {
|
||||
Console.WriteLine(string.Join("\n", Directory.EnumerateDirectories(dir).Select(_ => $" + {_}")));
|
||||
Console.WriteLine(string.Join("\n", Directory.EnumerateFiles(dir).Select(_ => $" - {_}")));
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
} catch(Exception e) { Console.WriteLine("ERROR: " + e.Message); }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
scanx(x);
|
||||
return;
|
||||
|
||||
|
||||
string path = @"C:\Users\filos\projects";
|
||||
string[] ignore = ["node_modules", "bin", "obj", "Debug", "Build", ".vs"];
|
||||
int scan(string path)
|
||||
{
|
||||
foreach (var dir in Directory.EnumerateDirectories(path)) {
|
||||
var name = dir.Replace(path, "").Replace(@"\", "");
|
||||
if (ignore.Contains(name))
|
||||
continue;
|
||||
if (name == ".git") {
|
||||
Console.WriteLine(path);
|
||||
git(path, "status");
|
||||
Console.Write("y/n? ");
|
||||
do {
|
||||
char c = (char)Console.Read();
|
||||
if (c == 'y') {
|
||||
Console.Write(" origin [master]? ");
|
||||
string t = Console.ReadLine() ?? "master";
|
||||
if (string.IsNullOrEmpty(t))
|
||||
t = "master";
|
||||
|
||||
git(path, "add .");
|
||||
git(path, "commit -m \"backup commit\"");
|
||||
git(path, "push origin " + t);
|
||||
break;
|
||||
} else if (c == 'n') {
|
||||
break;
|
||||
} else if (c > '0' && c < '9') {
|
||||
return (48 - c);
|
||||
}
|
||||
} while (true);
|
||||
} else {
|
||||
int e = scan(dir);
|
||||
if (e < 0)
|
||||
return e+1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
scan(path);
|
||||
return;
|
||||
*/
|
||||
|
||||
List<char> Ignored = [ '\0', '\b' ];
|
||||
LoggerService.Default = LogLevel.Error;
|
||||
List<byte[]> History = [];
|
||||
|
|
|
|||
|
|
@ -193,7 +193,14 @@ public class Runner : IDisposable
|
|||
}
|
||||
|
||||
case Op.Array: {
|
||||
// essentially collect all pushed values and create an array, no?
|
||||
int length = (int)call.Instruction.NextDynamic();
|
||||
Value[] values = new Value[length];
|
||||
for (int i = length - 1; i >= 0; i--) {
|
||||
values[i] = Pop();
|
||||
}
|
||||
var array = new Values.Objects.Array(values);
|
||||
Value value = Obj.Create(array);
|
||||
Push(value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +287,7 @@ public class Runner : IDisposable
|
|||
break;
|
||||
}
|
||||
|
||||
case Op.Return:
|
||||
case Op.Return: {
|
||||
Value result = Pop();
|
||||
CloseOuters(call.StackPtr.Branch());
|
||||
Calls.Pop();
|
||||
|
|
@ -292,6 +299,7 @@ public class Runner : IDisposable
|
|||
Push(result);
|
||||
call = Calls.Peek();
|
||||
break;
|
||||
}
|
||||
|
||||
case Op.Class: {
|
||||
Push(Obj.Create(new Class(call.Instruction.NextString().Value!)));
|
||||
|
|
|
|||
Loading…
Reference in New Issue