OSDN Git Service

mgcanvas, memdb
[chnosproject/AI004.git] / ai.js
diff --git a/ai.js b/ai.js
index 5cb6d73..baf1e78 100644 (file)
--- a/ai.js
+++ b/ai.js
@@ -3,7 +3,7 @@
 //開発時クロスドメイン許可で起動するには、
 // /Applications/Google\ Chrome.app/ --allow-file-access-from-files --disable-web-security
 
-var DebugModeEnabled = true;
+var IsDebugModeEnabledOnBoot = true;
 
 function AI(messageBoxDOMObject, debugBoxDOMObject){
        //ブラウザチェック
@@ -42,7 +42,7 @@ function AI(messageBoxDOMObject, debugBoxDOMObject){
                this.inputProcess_InternalConsole,
                this.inputProcess_CompileELCHNOS_OSECPU,
        ];
-       if(!DebugModeEnabled){
+       if(!IsDebugModeEnabledOnBoot){
                this.mode = this.UUID_Mode_Standard;
                this.processByMode = this.inputProcess_Standard;
        } else{
@@ -50,6 +50,7 @@ function AI(messageBoxDOMObject, debugBoxDOMObject){
                this.processByMode = this.inputProcess_InternalConsole;
        }
 
+       //初期データの読み込み
        AI_Bootstrap(this);
 
        this.debug("AI system initialized.\n");
@@ -147,22 +148,22 @@ AI.prototype = {
                //表示処理
                if(this.messageBox && this.messageBoxBuffer != ""){
                        //messageBox
-                       var str = this.messageBox.innerHTML + this.messageBoxBuffer;
+                       var str = this.messageBox.value + this.messageBoxBuffer;
                        this.messageBoxBuffer = "";
                        if(str.length > this.maxMessageStringLength){
                                str = str.slice(str.length - (this.maxMessageStringLength >> 1));
                        }
-                       this.messageBox.innerHTML = str;
+                       this.messageBox.value = str;
                        this.messageBox.scrollTop = this.messageBox.scrollHeight;
                }
                if(this.debugBox && this.debugBoxBuffer != ""){
                        //debugBox
-                       var str = this.debugBox.innerHTML + this.debugBoxBuffer;
+                       var str = this.debugBox.value + this.debugBoxBuffer;
                        this.debugBoxBuffer = "";
                        if(str.length > this.maxDebugStringLength){
                                str = str.slice(str.length - (this.maxDebugStringLength >> 1));
                        }
-                       this.debugBox.innerHTML = str;
+                       this.debugBox.value = str;
                        this.debugBox.scrollTop = this.debugBox.scrollHeight;
                }
        },
@@ -206,6 +207,9 @@ AI.prototype = {
                        //show wordList
                        this.debug("wordList:" + this.memory.wordList.length + "\n" );
                        this.memory.wordList.logEachPropertyNamed("str", function(s){ that.debug(s); });
+               } else if(str == "show rlc"){
+                       //show ReadLineCount
+                       this.debug(this.memory.dbInfo.readLineCount + " lines was inputted.\n" );
                } else if(str.indexOf("inputFromURL ") == 0){
                        //webページを読み込む
                        //inputFromURL http://www.aozora.gr.jp/cards/000148/files/773_14560.html
@@ -234,6 +238,10 @@ AI.prototype = {
                        
                } else if(str == "savemem"){
                        this.memory.saveMemory();
+               } else if(str == "netDB update"){
+                       this.networkManager.networkDBUpdate();
+               } else if(str == "netDB viewall"){
+                       this.networkManager.networkDBViewAll();
                } else{
                        this.debug("Unknown command [" + str + "].\n");
                        this.debug("Command list:\n");
@@ -250,7 +258,7 @@ AI.prototype = {
                
                var that = this;
                var cc = new ELCHNOSCompiler(function(s){ that.debug(s); }, this.downloadBox);
-               if(cc.compile(str) == null){
+               if(cc.compile(str) != null){
                        cc.saveBinary();
                }