Compare commits
3 Commits
adb758bd53
...
e04021425a
| Author | SHA1 | Date | |
|---|---|---|---|
|
e04021425a
|
|||
|
d89956a626
|
|||
|
dd146d1caf
|
@@ -1,5 +1,6 @@
|
|||||||
package bin;
|
package bin;
|
||||||
|
|
||||||
|
import lib.MathI;
|
||||||
import kernel.EndOfLoop;
|
import kernel.EndOfLoop;
|
||||||
import lua.NativeStringTools;
|
import lua.NativeStringTools;
|
||||||
import kernel.binstore.BinStore;
|
import kernel.binstore.BinStore;
|
||||||
@@ -25,6 +26,8 @@ class Terminal implements IProcess {
|
|||||||
private var history:Array<String> = [];
|
private var history:Array<String> = [];
|
||||||
private var historyIndex:Int = 0;
|
private var historyIndex:Int = 0;
|
||||||
|
|
||||||
|
private var scrollBack = 0;
|
||||||
|
|
||||||
private var runningPID:PID = -1;
|
private var runningPID:PID = -1;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
@@ -61,6 +64,7 @@ class Terminal implements IProcess {
|
|||||||
this.backlog.push("> " + this.input);
|
this.backlog.push("> " + this.input);
|
||||||
var command = this.input;
|
var command = this.input;
|
||||||
this.input = "";
|
this.input = "";
|
||||||
|
this.scrollBack = 0;
|
||||||
this.requestRender();
|
this.requestRender();
|
||||||
this.historyIndex = 0;
|
this.historyIndex = 0;
|
||||||
this.invokeCommand(command);
|
this.invokeCommand(command);
|
||||||
@@ -72,6 +76,12 @@ class Terminal implements IProcess {
|
|||||||
this.input = this.history[this.history.length - this.historyIndex];
|
this.input = this.history[this.history.length - this.historyIndex];
|
||||||
this.requestRender();
|
this.requestRender();
|
||||||
}
|
}
|
||||||
|
case 266: // PAGE UP
|
||||||
|
this.scrollBack = MathI.min(scrollBack + 1, this.backlog.length - 1);
|
||||||
|
this.requestRender();
|
||||||
|
case 267: // PAGE DOWN
|
||||||
|
this.scrollBack = MathI.max(scrollBack - 1, 0);
|
||||||
|
this.requestRender();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -99,7 +109,8 @@ class Terminal implements IProcess {
|
|||||||
var size = this.ctx.getSize();
|
var size = this.ctx.getSize();
|
||||||
var linesAvailable = size.y - 1;
|
var linesAvailable = size.y - 1;
|
||||||
|
|
||||||
var start:Int = this.backlog.length - linesAvailable;
|
var withoutScrollBack = (this.backlog.length - linesAvailable);
|
||||||
|
var start:Int = withoutScrollBack - scrollBack;
|
||||||
|
|
||||||
for (i in 0...linesAvailable) {
|
for (i in 0...linesAvailable) {
|
||||||
var line = this.backlog[start + i];
|
var line = this.backlog[start + i];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package kernel.peripherals;
|
package kernel.peripherals;
|
||||||
|
|
||||||
|
import kernel.log.Log;
|
||||||
import kernel.peripherals.Modem;
|
import kernel.peripherals.Modem;
|
||||||
import kernel.peripherals.Screen;
|
import kernel.peripherals.Screen;
|
||||||
|
|
||||||
@@ -50,12 +51,7 @@ class Peripheral {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var types = getTypes(addr);
|
var types = getTypes(addr);
|
||||||
var methodsMap = cc.Peripheral.getMethods(addr).toMap();
|
var methods = cc.Peripheral.getMethods(addr).toArray();
|
||||||
var methods:Array<String> = [];
|
|
||||||
|
|
||||||
for (k => v in methodsMap) {
|
|
||||||
methods.push(k);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
types: types,
|
types: types,
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
package lib;
|
package lib;
|
||||||
|
|
||||||
import haxe.Serializer;
|
|
||||||
import haxe.Unserializer;
|
|
||||||
import kernel.fs.FS;
|
import kernel.fs.FS;
|
||||||
import haxe.ds.StringMap;
|
import haxe.ds.StringMap;
|
||||||
|
#if kv_use_native
|
||||||
|
import cc.TextUtils;
|
||||||
|
#else
|
||||||
|
import haxe.Unserializer;
|
||||||
|
import haxe.Serializer;
|
||||||
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Key value store with persistence.
|
Key value store with persistence.
|
||||||
|
Use flag kv_use_native to use the cc serialization.
|
||||||
**/
|
**/
|
||||||
class KVStore {
|
class KVStore {
|
||||||
private var kvStore:StringMap<Dynamic> = new StringMap();
|
private var kvStore:StringMap<Dynamic> = new StringMap();
|
||||||
@@ -43,14 +48,21 @@ class KVStore {
|
|||||||
public function save() {
|
public function save() {
|
||||||
var handle = FS.openWrite(getNamespaceFile(this.namespace));
|
var handle = FS.openWrite(getNamespaceFile(this.namespace));
|
||||||
|
|
||||||
|
#if kv_use_native
|
||||||
|
handle.write(TextUtils.serialize(this.kvStore));
|
||||||
|
#else
|
||||||
handle.write(Serializer.run(this.kvStore));
|
handle.write(Serializer.run(this.kvStore));
|
||||||
|
#end
|
||||||
handle.close();
|
handle.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseFile(content:String) {
|
private function parseFile(content:String) {
|
||||||
|
#if kv_use_native
|
||||||
|
this.kvStore = TextUtils.unserialize(content);
|
||||||
|
#else
|
||||||
var unserializer = new Unserializer(content);
|
var unserializer = new Unserializer(content);
|
||||||
this.kvStore = unserializer.unserialize();
|
this.kvStore = unserializer.unserialize();
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline function set(key:String, value:Dynamic) {
|
public inline function set(key:String, value:Dynamic) {
|
||||||
|
|||||||
Reference in New Issue
Block a user